UNPKG

@graphql-hive/laboratory

Version:

32,504 lines 1.41 MB
import { $ as DEFAULT_FONT_FAMILY, $a as IEnvironmentService, $c as isLowerAsciiLetter, $i as listHighlightForeground, $l as illegalArgument, $n as mapObservableArrayCached, $o as registerEditorCommand, $r as LineTokens, $s as getDomNodePagePosition, $t as FindInput, A as observableCodeEditor, Aa as editorWarningBorder, Ac as disposableTimeout, Ai as renderLabelWithIcons, Al as URI, An as ActionBar, Ao as LRUCache, Ar as WORKSPACE_EXTENSION, As as ICodeEditorService, At as IStandaloneThemeService, Au as isObject, B as diffDeleteDecorationEmpty, Ba as foreground, Bc as commonSuffixLength, Bi as Widget, Bl as PauseableEmitter, Bn as IStorageService, Bo as ILanguageService, Br as EditOperation, Bs as ModifierKeyEmitter, Bt as HighlightedLabel, Bu as groupBy, C as EditorState, Ca as editorInlayHintForeground, Cc as AsyncIterableObject, Ci as fuzzyScoreGracefulAggressive, Cl as TokenizationRegistry, Cn as IMarkerDecorationsService, Co as UnicodeTextModelHighlighter, Cr as GoToLineNLS, Cs as ThemeIcon, Ct as RenderLineInput, Cu as deepClone, D as bindContextKey, Da as editorInlayHintTypeForeground, Dc as TimeoutTimer, Di as matchesWords, Dl as Selection, Dn as IMarkerService, Do as OverviewRulerLane, Dr as QuickOutlineNLS, Ds as toAction, Dt as AccessibilitySignal, Du as isDefined, E as DiffEditorWidget, Ea as editorInlayHintTypeBackground, Ec as RunOnceScheduler, Ei as matchesSubString, El as Codicon, En as IMarkerData, Eo as InjectedTextCursorStops, Er as QuickHelpNLS, Es as SubmenuAction, Et as registerEditorFeature, Eu as assertType, F as isHotReloadEnabled, Fa as overviewRulerSelectionHighlightForeground, Fc as StandardKeyboardEvent, Fi as HoverWidget, Fl as CancellationToken, Fn as defaultCountBadgeStyles, Fo as ILanguageConfigurationService, Fr as TernarySearchTree, Fs as PixelRatio, Ft as registerIcon, Fu as binarySearch, G as DisposableCancellationTokenSource, Ga as transparent, Gc as escapeRegExpCharacters, Gi as IContextMenuService, Gl as RefCountedDisposable, Gn as getBaseLayerHoverDelegate, Go as createTrustedTypesPolicy, Gr as status, Gs as append, Gt as WorkbenchTreeElementCanExpand, Gu as reverseOrder, H as diffLineDeleteDecorationBackgroundWithIndicator, Ha as asCssVariable, Hc as compareIgnoreCase, Hi as Gesture, Hl as Disposable, Hn as isLocalizedString, Ho as StringBuilder, Hr as IBulkEditService, Hs as addDisposableListener, Ht as WorkbenchAsyncDataTree, Hu as isNonEmptyArray, I as IDiffProviderFactoryService, Ia as widgetBorder, Ic as KeyCodeChord, Ii as KeyDownAction, Il as CancellationTokenSource, In as defaultInputBoxStyles, Io as PLAINTEXT_LANGUAGE_ID, Ir as IEditorProgressService, Is as $, It as widgetClose, Iu as coalesce, J as StableEditorScrollState, Ja as ISemanticTokensStylingService, Jc as getLeadingWhitespace, Ji as WorkbenchHoverDelegate, Jl as isDisposable, Jn as DataTransfers, Jo as EditorCommand, Jr as MarkdownRenderer, Js as createStyleSheet2, Jt as IsWindowsContext, K as appendRemoveOnDispose, Ka as score, Kc as firstNonWhitespaceIndex, Ki as IContextViewService, Kl as combinedDisposable, Kn as createInstantHoverDelegate, Ko as EditorAction, Kr as CONTEXT_ACCESSIBILITY_MODE_ENABLED, Ks as clearNode, Kt as InputFocusedContext, L as diffAddDecoration, La as widgetShadow, Lc as isFirefox, Li as getHoverAccessibleViewHint, Ll as cancelOnDispose, Ln as defaultListStyles, Lo as Extensions$1, Lr as IProgressService, Ls as Dimension, Lt as KeybindingLabel, Lu as compareBy, M as reactToChangeWithStore, Ma as editorWidgetBackground, Mc as raceCancellation, Mi as IOpenerService, Ml as dirname$1, Mn as TextOnlyMenuEntryActionViewItem, Mo as SetMap, Mr as isSingleFolderWorkspaceIdentifier, Ms as createDecorator, Mt as HC_LIGHT_THEME_NAME, Mu as isUndefined, N as WorkbenchToolBar, Na as editorWidgetBorder, Nc as timeout, Ni as ClickAction, Nl as sep, Nn as createActionViewItem, No as CharacterSet, Nr as isStandaloneEditorWorkspace, Ns as EditorZoom, Nt as VS_DARK_THEME_NAME, Nu as Permutation, O as observableConfigValue, Oa as editorSelectionBackground, Oc as createCancelableAsyncIterable, Oi as or, Ol as Range, On as MarkerSeverity, Oo as shouldSynchronizeModel, Or as ToggleHighContrastNLS, Os as ITextModelService, Ot as IAccessibilitySignalService, Ou as isFunction, P as readHotReloadableExport, Pa as overviewRulerFindMatchForeground, Pc as StandardMouseEvent, Pi as HoverAction, Pl as KeyChord, Pn as createAndFillInActionBarActions, Po as LcsDiff, Pr as toWorkspaceIdentifier, Ps as applyFontInfo, Pt as VS_LIGHT_THEME_NAME, Pu as asArray, Q as isModelDecorationVisible, Qa as ILanguageFeatureDebounceService, Qc as isLowSurrogate, Qi as listFocusHighlightForeground, Ql as CancellationError, Qn as derivedObservableWithCache, Qo as registerEditorAction, Qr as nullTokenizeEncoded, Qs as getComputedStyle, Qt as Sash, R as diffAddDecorationEmpty, Ra as activeContrastBorder, Rc as InvisibleCharacters, Ri as DomScrollableElement, Rl as Emitter, Rn as defaultToggleStyles, Ro as Mimes, Rr as Progress, Rs as EventHelper, Rt as unthemedKeybindingLabelOptions, Ru as distinct, S as isDiffEditor, Sa as editorInlayHintBackground, Sc as matchesSomeScheme, Si as fuzzyScore, Sl as SymbolKinds, Sn as CursorColumns, So as mapFindFirst, Sr as IWorkspaceTrustManagementService, Ss as ICommandService, St as TabFocus, Su as localize2, T as TextModelCancellationTokenSource, Ta as editorInlayHintParameterForeground, Tc as Delayer, Ti as matchesPrefix, Tl as isLocationLink, Tn as overviewRulerRangeHighlight, To as GlyphMarginLane, Tr as QuickCommandNLS, Ts as Separator, Tt as LineDecoration, Tu as assertIsDefined, U as diffWholeLineAddDecoration, Ua as oneOf, Uc as containsRTL, Ui as GlobalPointerMoveMonitor, Ul as DisposableStore, Un as ActionViewItem, Uo as VSBuffer, Ur as ResourceTextEdit, Us as addStandardDisposableGenericMouseDownListener, Ut as WorkbenchListFocusContextKey, Uu as numberComparator, V as diffLineAddDecorationBackgroundWithIndicator, Va as iconForeground, Vc as compare, Vi as EventType, Vl as StopWatch, Vn as WillSaveStateReason, Vo as IConfigurationService, Vr as editorConfigurationBaseNode, Vs as WindowIdleValue, Vt as IListService, Vu as isFalsyOrEmpty, W as diffWholeLineDeleteDecoration, Wa as registerColor, Wc as containsUppercaseCharacter, Wi as IKeybindingService, Wl as MutableDisposable, Wn as List, Wo as IndentAction, Wr as alert, Ws as addStandardDisposableListener, Wt as WorkbenchTreeElementCanCollapse, Wu as quickSelect, X as isModelDecorationInComment, Xa as countEOL, Xc as isFalsyOrWhitespace, Xi as quickInputListFocusForeground, Xl as createSingleCallFunction, Xn as waitForState, Xo as MultiCommand, Xr as NullState, Xs as getActiveElement, Xt as SplitView, Y as CodeEditorWidget, Ya as toMultilineTokens2, Yc as isBasicASCII, Yi as quickInputListFocusBackground, Yl as toDisposable, Yn as ObservablePromise, Yo as EditorExtensionsRegistry, Yr as openLinkFromMarkdown, Ys as getActiveDocument, Yt as Sizing, Z as isModelDecorationInString, Za as TokenMetadata, Zc as isHighSurrogate, Zi as quickInputListFocusIconForeground, Zl as BugIndicatingError, Zn as constObservable, Zo as MultiEditorAction, Zr as nullTokenize, Zs as getClientArea, Zt as OrthogonalEdge, _ as formatDocumentWithSelectedProvider, _a as editorForeground, _c as svgElem, _i as stripIcons, _l as InlineEditTriggerKind, _n as DenseKeyProvider, _o as TextLength, _r as transaction, _s as ContextKeyEqualsExpr, _t as ClipboardEventUtils, _u as isNative, aa as inputForeground, ac as h, ai as isEmptyMarkdownString, al as stripWildcards, an as Button, ao as IThemeService, ar as autorunOpts, as as ITelemetryService, at as getIndentMetadata, au as EditorOptions, b as getCodeEditor, ba as editorInfoBorder, bc as Schemas, bi as anyScore, bl as SelectedSuggestionInfo, bn as lengthZero, bo as findFirstMax, br as itemsEquals, bs as RawContextKey, bt as getColumnOfNodeOffset, bu as language, ca as editorActiveLinkForeground, cc as isAncestor, ci as basename, cl as mainWindow, cn as ItemActivation, co as isDark, cr as derivedDisposable, cs as MenuId, ct as ProcessedIndentRulesSupport, cu as unicodeHighlightConfigKeys, da as editorErrorForeground, dc as reset, di as extUri, dl as DocumentHighlightKind, dn as ModelDecorationOptions, do as ITextResourceConfigurationService, dr as derivedWithSetter, ds as SubmenuItemAction, dt as WordPartOperations, du as Iterable, ea as inputActiveOptionBackground, ec as getShadowRoot, ei as getStandardTokenTypeAtPosition, el as isUpperAsciiLetter, en as HistoryInputBox, eo as clamp, er as observableFromEvent, es as registerEditorContribution, et as CoreEditingCommands, eu as isCancellationError, fa as editorFindMatchForeground, fc as runAtThisOrScheduleAtNextAnimationFrame, fi as extname, fl as DocumentPasteTriggerKind, fn as TextModel, fo as Color, fr as derivedWithStore, fs as isIMenuItem, ft as MoveOperations, fu as OS, g as formatDocumentRangesWithSelectedProvider, ga as editorFindRangeHighlightBorder, gc as size, gi as relativePath, gl as InlineCompletionTriggerKind, gn as TextBufferTokenizer, go as TextEdit, gr as subtransaction, gs as assertNever, gt as CursorState, gu as isMacintosh, ha as editorFindMatchHighlightForeground, hc as show, hi as originalFSPath, hl as InlayHintKind, hn as LanguageAgnosticBracketTokens, ho as SingleTextEdit, hr as observableValue, hs as Registry, ht as ReplaceCommandThatSelectsText, hu as isLittleEndian, ia as inputBorder, ic as getWindow, ii as MarkdownString, il as splitLinesIncludeSeparators, in as CountBadge, io as severity_default, ir as autorun, is as ILogService, it as getGoodIndentForLine, iu as EditorFontLigatures, j as reactToChange, ja as editorWarningForeground, jc as first, ji as DomEmitter, jl as basename$1, jn as MenuEntryActionViewItem, jo as ResourceMap, jr as isEmptyWorkspaceIdentifier, js as IInstantiationService, jt as HC_BLACK_THEME_NAME, ju as isString, k as HideUnchangedRegionsFeature, ka as editorSelectionHighlight, kc as createCancelablePromise, ki as renderIcon, kl as Position, kn as IEditorWorkerService, ko as getMapForWordSeparators, kr as IWorkspaceContextService, ks as IModelService, kt as IClipboardService, ku as isNumber, la as editorBackground, lc as isHTMLElement, li as basenameOrAuthority, ll as Command, ln as Extensions, lo as isHighContrast, lr as derivedHandleChanges, ls as MenuItemAction, lt as CursorMoveCommands, lu as USUAL_WORD_SEPARATORS, m as editor_api_exports, ma as editorFindMatchHighlightBorder, mc as setVisibility, mi as joinPath, ml as HoverVerbosityAction, mn as parseDocument, mo as RGBA, mr as disposableObservableValue, ms as KeybindingsRegistry, mt as ReplaceCommandThatPreservesSelection, mu as isLinux, na as inputActiveOptionForeground, nc as getTotalHeight, ni as IdGenerator, nl as noBreakWhitespace, nn as RegexToggle, no as Severity, nr as observableSignalFromEvent, ns as registerModelAndPositionCommand, nt as TypeOperations, nu as onUnexpectedExternalError, oa as minimapFindMatch, oc as hide, oi as isMarkdownString, ol as trim, on as Toggle, oo as registerThemingParticipant, or as autorunWithStore, os as Action2, ot as ShiftCommand, ou as ShowLightbulbIconMode, pa as editorFindMatchHighlight, pc as runWhenWindowIdle, pi as isEqual, pl as FoldingRangeKind, pn as computeIndentLevel, po as HSVA, pr as asyncTransaction, ps as registerAction2, pt as ReplaceCommand, pu as isIOS, q as applyStyle, qa as hasDriveLetter, qc as format, qi as IHoverService, ql as dispose, qn as getDefaultHoverDelegate, qo as EditorAction2, qr as IAccessibilityService, qs as createCSSRule, qt as IsWebContext, ra as inputBackground, rc as getTotalWidth, ri as defaultGenerator, rl as splitLines, rn as WholeWordsToggle, ro as IDialogService, rr as recomputeInitiallyAndOnChange, rs as registerMultiEditorAction, rt as EnterOperation, ru as EDITOR_FONT_DEFAULTS, sa as minimapSelectionOccurrenceHighlight, sc as isActiveElement, si as DataUri, sl as Lazy, sn as IQuickInputService, so as themeColorFromId, sr as derived, ss as IMenuService, st as getEnterAction, su as inUntrustedWorkspace, ta as inputActiveOptionBorder, tc as getTopLeftOffset, ti as renderMarkdown, tl as lastNonWhitespaceIndex, tn as CaseSensitiveToggle, to as INotificationService, tr as observableSignal, ts as registerInstantiatedEditorAction, tt as EditorContextKeys, tu as onUnexpectedError, ua as editorErrorBorder, uc as removeCSSRulesContainingSelector, ui as dirname, ul as CompletionItemKinds, un as ModelDecorationInjectedTextOptions, uo as ILanguageFeaturesService, ur as derivedOpts, us as MenuRegistry, ut as WordOperations, uu as LinkedList, v as getOnTypeFormattingEdits, va as editorHoverBackground, vc as trackFocus, vi as FuzzyScore, vl as NewSymbolNameTag, vn as lengthAdd, vo as LineRange, vr as equalsIfDefined, vs as ContextKeyExpr, vt as CopyOptions, vu as isWeb, w as EditorStateCancellationTokenSource, wa as editorInlayHintParameterBackground, wc as DeferredPromise, wi as matchesContiguousSubString, wl as getAriaLabelForSymbol, wn as ghostTextForeground, wo as SearchParams, wr as InspectTokensNLS, ws as Action, wt as renderViewLine, wu as mixin, x as isCodeEditor, xa as editorInfoForeground, xc as matchesScheme, xi as createMatches, xl as SignatureHelpTriggerKind, xn as normalizeIndentation, xo as findLast, xr as structuralEquals, xs as CommandsRegistry, xt as DynamicCssRules, xu as localize, y as FormattingEdit, ya as editorHoverBorder, yc as hash, yi as FuzzyScoreOptions, yl as NewSymbolNameTriggerKind, yn as lengthGetColumnCountIfZeroLineCount, yo as findFirstIdxMonotonousOrArrLen, yr as itemEquals, ys as IContextKeyService, yt as InMemoryClipboardMetadataManager, yu as isWindows, z as diffDeleteDecoration, za as contrastBorder, zc as commonPrefixLength, zi as ScrollableElement, zl as Event, zn as getListStyles, zo as registerSingleton, zr as ILabelService, zs as EventType$1, zt as IconLabel, zu as equals } from "./editor.api-erJ7GEVs.js";
function devAssert(e, O) {
	if (!e) throw Error(O);
}
function isObjectLike(e) {
	return typeof e == "object" && !!e;
}
function invariant(e, O) {
	if (!e) throw Error(O ?? "Unexpected invariant triggered.");
}
var LineRegExp = /\r\n|[\n\r]/g;
function getLocation(e, O) {
	let k = 0, A = 1;
	for (let j of e.body.matchAll(LineRegExp)) {
		if (typeof j.index == "number" || invariant(!1), j.index >= O) break;
		k = j.index + j[0].length, A += 1;
	}
	return {
		line: A,
		column: O + 1 - k
	};
}
function printLocation(e) {
	return printSourceLocation(e.source, getLocation(e.source, e.start));
}
function printSourceLocation(e, O) {
	let k = e.locationOffset.column - 1, A = "".padStart(k) + e.body, j = O.line - 1, M = e.locationOffset.line - 1, N = O.line + M, P = O.line === 1 ? k : 0, F = O.column + P, I = `${e.name}:${N}:${F}\n`, L = A.split(/\r\n|[\n\r]/g), R = L[j];
	if (R.length > 120) {
		let e = Math.floor(F / 80), O = F % 80, k = [];
		for (let e = 0; e < R.length; e += 80) k.push(R.slice(e, e + 80));
		return I + printPrefixedLines([
			[`${N} |`, k[0]],
			...k.slice(1, e + 1).map((e) => ["|", e]),
			["|", "^".padStart(O)],
			["|", k[e + 1]]
		]);
	}
	return I + printPrefixedLines([
		[`${N - 1} |`, L[j - 1]],
		[`${N} |`, R],
		["|", "^".padStart(F)],
		[`${N + 1} |`, L[j + 1]]
	]);
}
function printPrefixedLines(e) {
	let O = e.filter(([e, O]) => O !== void 0), k = Math.max(...O.map(([e]) => e.length));
	return O.map(([e, O]) => e.padStart(k) + (O ? " " + O : "")).join("\n");
}
function toNormalizedOptions(e) {
	let O = e[0];
	return O == null || "kind" in O || "length" in O ? {
		nodes: O,
		source: e[1],
		positions: e[2],
		path: e[3],
		originalError: e[4],
		extensions: e[5]
	} : O;
}
var GraphQLError = class e extends Error {
	constructor(O, ...k) {
		let { nodes: A, source: j, positions: M, path: N, originalError: P, extensions: F } = toNormalizedOptions(k);
		super(O), this.name = "GraphQLError", this.path = N ?? void 0, this.originalError = P ?? void 0, this.nodes = undefinedIfEmpty(Array.isArray(A) ? A : A ? [A] : void 0);
		let I = undefinedIfEmpty(this.nodes?.map((e) => e.loc).filter((e) => e != null));
		this.source = j ?? I?.[0]?.source, this.positions = M ?? I?.map((e) => e.start), this.locations = M && j ? M.map((e) => getLocation(j, e)) : I?.map((e) => getLocation(e.source, e.start));
		let L = isObjectLike(P?.extensions) ? P?.extensions : void 0;
		/* c8 ignore start */
		this.extensions = F ?? L ?? Object.create(null), Object.defineProperties(this, {
			message: {
				writable: !0,
				enumerable: !0
			},
			name: { enumerable: !1 },
			nodes: { enumerable: !1 },
			source: { enumerable: !1 },
			positions: { enumerable: !1 },
			originalError: { enumerable: !1 }
		}), P != null && P.stack ? Object.defineProperty(this, "stack", {
			value: P.stack,
			writable: !0,
			configurable: !0
		}) : Error.captureStackTrace ? Error.captureStackTrace(this, e) : Object.defineProperty(this, "stack", {
			value: Error().stack,
			writable: !0,
			configurable: !0
		});
		/* c8 ignore stop */
	}
	get [Symbol.toStringTag]() {
		return "GraphQLError";
	}
	toString() {
		let e = this.message;
		if (this.nodes) for (let O of this.nodes) O.loc && (e += "\n\n" + printLocation(O.loc));
		else if (this.source && this.locations) for (let O of this.locations) e += "\n\n" + printSourceLocation(this.source, O);
		return e;
	}
	toJSON() {
		let e = { message: this.message };
		return this.locations != null && (e.locations = this.locations), this.path != null && (e.path = this.path), this.extensions != null && Object.keys(this.extensions).length > 0 && (e.extensions = this.extensions), e;
	}
};
function undefinedIfEmpty(e) {
	return e === void 0 || e.length === 0 ? void 0 : e;
}
function syntaxError(e, O, k) {
	return new GraphQLError(`Syntax Error: ${k}`, {
		source: e,
		positions: [O]
	});
}
var Location = class {
	constructor(e, O, k) {
		this.start = e.start, this.end = O.end, this.startToken = e, this.endToken = O, this.source = k;
	}
	get [Symbol.toStringTag]() {
		return "Location";
	}
	toJSON() {
		return {
			start: this.start,
			end: this.end
		};
	}
}, Token = class {
	constructor(e, O, k, A, j, M) {
		this.kind = e, this.start = O, this.end = k, this.line = A, this.column = j, this.value = M, this.prev = null, this.next = null;
	}
	get [Symbol.toStringTag]() {
		return "Token";
	}
	toJSON() {
		return {
			kind: this.kind,
			value: this.value,
			line: this.line,
			column: this.column
		};
	}
};
const QueryDocumentKeys = {
	Name: [],
	Document: ["definitions"],
	OperationDefinition: [
		"description",
		"name",
		"variableDefinitions",
		"directives",
		"selectionSet"
	],
	VariableDefinition: [
		"description",
		"variable",
		"type",
		"defaultValue",
		"directives"
	],
	Variable: ["name"],
	SelectionSet: ["selections"],
	Field: [
		"alias",
		"name",
		"arguments",
		"directives",
		"selectionSet"
	],
	Argument: ["name", "value"],
	FragmentSpread: ["name", "directives"],
	InlineFragment: [
		"typeCondition",
		"directives",
		"selectionSet"
	],
	FragmentDefinition: [
		"description",
		"name",
		"variableDefinitions",
		"typeCondition",
		"directives",
		"selectionSet"
	],
	IntValue: [],
	FloatValue: [],
	StringValue: [],
	BooleanValue: [],
	NullValue: [],
	EnumValue: [],
	ListValue: ["values"],
	ObjectValue: ["fields"],
	ObjectField: ["name", "value"],
	Directive: ["name", "arguments"],
	NamedType: ["name"],
	ListType: ["type"],
	NonNullType: ["type"],
	SchemaDefinition: [
		"description",
		"directives",
		"operationTypes"
	],
	OperationTypeDefinition: ["type"],
	ScalarTypeDefinition: [
		"description",
		"name",
		"directives"
	],
	ObjectTypeDefinition: [
		"description",
		"name",
		"interfaces",
		"directives",
		"fields"
	],
	FieldDefinition: [
		"description",
		"name",
		"arguments",
		"type",
		"directives"
	],
	InputValueDefinition: [
		"description",
		"name",
		"type",
		"defaultValue",
		"directives"
	],
	InterfaceTypeDefinition: [
		"description",
		"name",
		"interfaces",
		"directives",
		"fields"
	],
	UnionTypeDefinition: [
		"description",
		"name",
		"directives",
		"types"
	],
	EnumTypeDefinition: [
		"description",
		"name",
		"directives",
		"values"
	],
	EnumValueDefinition: [
		"description",
		"name",
		"directives"
	],
	InputObjectTypeDefinition: [
		"description",
		"name",
		"directives",
		"fields"
	],
	DirectiveDefinition: [
		"description",
		"name",
		"arguments",
		"locations"
	],
	SchemaExtension: ["directives", "operationTypes"],
	ScalarTypeExtension: ["name", "directives"],
	ObjectTypeExtension: [
		"name",
		"interfaces",
		"directives",
		"fields"
	],
	InterfaceTypeExtension: [
		"name",
		"interfaces",
		"directives",
		"fields"
	],
	UnionTypeExtension: [
		"name",
		"directives",
		"types"
	],
	EnumTypeExtension: [
		"name",
		"directives",
		"values"
	],
	InputObjectTypeExtension: [
		"name",
		"directives",
		"fields"
	],
	TypeCoordinate: ["name"],
	MemberCoordinate: ["name", "memberName"],
	ArgumentCoordinate: [
		"name",
		"fieldName",
		"argumentName"
	],
	DirectiveCoordinate: ["name"],
	DirectiveArgumentCoordinate: ["name", "argumentName"]
};
var kindValues = new Set(Object.keys(QueryDocumentKeys));
function isNode(e) {
	let O = e?.kind;
	return typeof O == "string" && kindValues.has(O);
}
var OperationTypeNode;
(function(e) {
	e.QUERY = "query", e.MUTATION = "mutation", e.SUBSCRIPTION = "subscription";
})(OperationTypeNode ||= {});
var DirectiveLocation;
(function(e) {
	e.QUERY = "QUERY", e.MUTATION = "MUTATION", e.SUBSCRIPTION = "SUBSCRIPTION", e.FIELD = "FIELD", e.FRAGMENT_DEFINITION = "FRAGMENT_DEFINITION", e.FRAGMENT_SPREAD = "FRAGMENT_SPREAD", e.INLINE_FRAGMENT = "INLINE_FRAGMENT", e.VARIABLE_DEFINITION = "VARIABLE_DEFINITION", e.SCHEMA = "SCHEMA", e.SCALAR = "SCALAR", e.OBJECT = "OBJECT", e.FIELD_DEFINITION = "FIELD_DEFINITION", e.ARGUMENT_DEFINITION = "ARGUMENT_DEFINITION", e.INTERFACE = "INTERFACE", e.UNION = "UNION", e.ENUM = "ENUM", e.ENUM_VALUE = "ENUM_VALUE", e.INPUT_OBJECT = "INPUT_OBJECT", e.INPUT_FIELD_DEFINITION = "INPUT_FIELD_DEFINITION";
})(DirectiveLocation ||= {});
var Kind;
(function(e) {
	e.NAME = "Name", e.DOCUMENT = "Document", e.OPERATION_DEFINITION = "OperationDefinition", e.VARIABLE_DEFINITION = "VariableDefinition", e.SELECTION_SET = "SelectionSet", e.FIELD = "Field", e.ARGUMENT = "Argument", e.FRAGMENT_SPREAD = "FragmentSpread", e.INLINE_FRAGMENT = "InlineFragment", e.FRAGMENT_DEFINITION = "FragmentDefinition", e.VARIABLE = "Variable", e.INT = "IntValue", e.FLOAT = "FloatValue", e.STRING = "StringValue", e.BOOLEAN = "BooleanValue", e.NULL = "NullValue", e.ENUM = "EnumValue", e.LIST = "ListValue", e.OBJECT = "ObjectValue", e.OBJECT_FIELD = "ObjectField", e.DIRECTIVE = "Directive", e.NAMED_TYPE = "NamedType", e.LIST_TYPE = "ListType", e.NON_NULL_TYPE = "NonNullType", e.SCHEMA_DEFINITION = "SchemaDefinition", e.OPERATION_TYPE_DEFINITION = "OperationTypeDefinition", e.SCALAR_TYPE_DEFINITION = "ScalarTypeDefinition", e.OBJECT_TYPE_DEFINITION = "ObjectTypeDefinition", e.FIELD_DEFINITION = "FieldDefinition", e.INPUT_VALUE_DEFINITION = "InputValueDefinition", e.INTERFACE_TYPE_DEFINITION = "InterfaceTypeDefinition", e.UNION_TYPE_DEFINITION = "UnionTypeDefinition", e.ENUM_TYPE_DEFINITION = "EnumTypeDefinition", e.ENUM_VALUE_DEFINITION = "EnumValueDefinition", e.INPUT_OBJECT_TYPE_DEFINITION = "InputObjectTypeDefinition", e.DIRECTIVE_DEFINITION = "DirectiveDefinition", e.SCHEMA_EXTENSION = "SchemaExtension", e.SCALAR_TYPE_EXTENSION = "ScalarTypeExtension", e.OBJECT_TYPE_EXTENSION = "ObjectTypeExtension", e.INTERFACE_TYPE_EXTENSION = "InterfaceTypeExtension", e.UNION_TYPE_EXTENSION = "UnionTypeExtension", e.ENUM_TYPE_EXTENSION = "EnumTypeExtension", e.INPUT_OBJECT_TYPE_EXTENSION = "InputObjectTypeExtension", e.TYPE_COORDINATE = "TypeCoordinate", e.MEMBER_COORDINATE = "MemberCoordinate", e.ARGUMENT_COORDINATE = "ArgumentCoordinate", e.DIRECTIVE_COORDINATE = "DirectiveCoordinate", e.DIRECTIVE_ARGUMENT_COORDINATE = "DirectiveArgumentCoordinate";
})(Kind ||= {});
function isWhiteSpace(e) {
	return e === 9 || e === 32;
}
function isDigit$1(e) {
	return e >= 48 && e <= 57;
}
function isLetter(e) {
	return e >= 97 && e <= 122 || e >= 65 && e <= 90;
}
function isNameStart(e) {
	return isLetter(e) || e === 95;
}
function isNameContinue(e) {
	return isLetter(e) || isDigit$1(e) || e === 95;
}
function dedentBlockStringLines(e) {
	let O = 2 ** 53 - 1, k = null, A = -1;
	for (let j = 0; j < e.length; ++j) {
		let M = e[j], N = leadingWhitespace(M);
		N !== M.length && (k ??= j, A = j, j !== 0 && N < O && (O = N));
	}
	return e.map((e, k) => k === 0 ? e : e.slice(O)).slice(k ?? 0, A + 1);
}
function leadingWhitespace(e) {
	let O = 0;
	for (; O < e.length && isWhiteSpace(e.charCodeAt(O));) ++O;
	return O;
}
function isPrintableAsBlockString(e) {
	if (e === "") return !0;
	let O = !0, k = !1, A = !0, j = !1;
	for (let M = 0; M < e.length; ++M) switch (e.codePointAt(M)) {
		case 0:
		case 1:
		case 2:
		case 3:
		case 4:
		case 5:
		case 6:
		case 7:
		case 8:
		case 11:
		case 12:
		case 14:
		case 15: return !1;
		case 13: return !1;
		case 10:
			if (O && !j) return !1;
			j = !0, O = !0, k = !1;
			break;
		case 9:
		case 32:
			k ||= O;
			break;
		default: A &&= k, O = !1;
	}
	return !(O || A && j);
}
function printBlockString(e, O) {
	let k = e.replace(/"""/g, "\\\"\"\""), A = k.split(/\r\n|[\n\r]/g), j = A.length === 1, M = A.length > 1 && A.slice(1).every((e) => e.length === 0 || isWhiteSpace(e.charCodeAt(0))), N = k.endsWith("\\\"\"\""), P = e.endsWith("\"") && !N, F = e.endsWith("\\"), I = P || F, L = !(O != null && O.minimize) && (!j || e.length > 70 || I || M || N), R = "", z = j && isWhiteSpace(e.charCodeAt(0));
	return (L && !z || M) && (R += "\n"), R += k, (L || I) && (R += "\n"), "\"\"\"" + R + "\"\"\"";
}
var TokenKind;
(function(e) {
	e.SOF = "<SOF>", e.EOF = "<EOF>", e.BANG = "!", e.DOLLAR = "$", e.AMP = "&", e.PAREN_L = "(", e.PAREN_R = ")", e.DOT = ".", e.SPREAD = "...", e.COLON = ":", e.EQUALS = "=", e.AT = "@", e.BRACKET_L = "[", e.BRACKET_R = "]", e.BRACE_L = "{", e.PIPE = "|", e.BRACE_R = "}", e.NAME = "Name", e.INT = "Int", e.FLOAT = "Float", e.STRING = "String", e.BLOCK_STRING = "BlockString", e.COMMENT = "Comment";
})(TokenKind ||= {});
var Lexer = class {
	constructor(e) {
		let O = new Token(TokenKind.SOF, 0, 0, 0, 0);
		this.source = e, this.lastToken = O, this.token = O, this.line = 1, this.lineStart = 0;
	}
	get [Symbol.toStringTag]() {
		return "Lexer";
	}
	advance() {
		return this.lastToken = this.token, this.token = this.lookahead();
	}
	lookahead() {
		let e = this.token;
		if (e.kind !== TokenKind.EOF) do
			if (e.next) e = e.next;
			else {
				let O = readNextToken(this, e.end);
				e.next = O, O.prev = e, e = O;
			}
		while (e.kind === TokenKind.COMMENT);
		return e;
	}
};
function isPunctuatorTokenKind(e) {
	return e === TokenKind.BANG || e === TokenKind.DOLLAR || e === TokenKind.AMP || e === TokenKind.PAREN_L || e === TokenKind.PAREN_R || e === TokenKind.DOT || e === TokenKind.SPREAD || e === TokenKind.COLON || e === TokenKind.EQUALS || e === TokenKind.AT || e === TokenKind.BRACKET_L || e === TokenKind.BRACKET_R || e === TokenKind.BRACE_L || e === TokenKind.PIPE || e === TokenKind.BRACE_R;
}
function isUnicodeScalarValue(e) {
	return e >= 0 && e <= 55295 || e >= 57344 && e <= 1114111;
}
function isSupplementaryCodePoint(e, O) {
	return isLeadingSurrogate(e.charCodeAt(O)) && isTrailingSurrogate(e.charCodeAt(O + 1));
}
function isLeadingSurrogate(e) {
	return e >= 55296 && e <= 56319;
}
function isTrailingSurrogate(e) {
	return e >= 56320 && e <= 57343;
}
function printCodePointAt(e, O) {
	let k = e.source.body.codePointAt(O);
	if (k === void 0) return TokenKind.EOF;
	if (k >= 32 && k <= 126) {
		let e = String.fromCodePoint(k);
		return e === "\"" ? "'\"'" : `"${e}"`;
	}
	return "U+" + k.toString(16).toUpperCase().padStart(4, "0");
}
function createToken(e, O, k, A, j) {
	let M = e.line, N = 1 + k - e.lineStart;
	return new Token(O, k, A, M, N, j);
}
function readNextToken(e, O) {
	let k = e.source.body, A = k.length, j = O;
	for (; j < A;) {
		let O = k.charCodeAt(j);
		switch (O) {
			case 65279:
			case 9:
			case 32:
			case 44:
				++j;
				continue;
			case 10:
				++j, ++e.line, e.lineStart = j;
				continue;
			case 13:
				k.charCodeAt(j + 1) === 10 ? j += 2 : ++j, ++e.line, e.lineStart = j;
				continue;
			case 35: return readComment(e, j);
			case 33: return createToken(e, TokenKind.BANG, j, j + 1);
			case 36: return createToken(e, TokenKind.DOLLAR, j, j + 1);
			case 38: return createToken(e, TokenKind.AMP, j, j + 1);
			case 40: return createToken(e, TokenKind.PAREN_L, j, j + 1);
			case 41: return createToken(e, TokenKind.PAREN_R, j, j + 1);
			case 46:
				if (k.charCodeAt(j + 1) === 46 && k.charCodeAt(j + 2) === 46) return createToken(e, TokenKind.SPREAD, j, j + 3);
				break;
			case 58: return createToken(e, TokenKind.COLON, j, j + 1);
			case 61: return createToken(e, TokenKind.EQUALS, j, j + 1);
			case 64: return createToken(e, TokenKind.AT, j, j + 1);
			case 91: return createToken(e, TokenKind.BRACKET_L, j, j + 1);
			case 93: return createToken(e, TokenKind.BRACKET_R, j, j + 1);
			case 123: return createToken(e, TokenKind.BRACE_L, j, j + 1);
			case 124: return createToken(e, TokenKind.PIPE, j, j + 1);
			case 125: return createToken(e, TokenKind.BRACE_R, j, j + 1);
			case 34: return k.charCodeAt(j + 1) === 34 && k.charCodeAt(j + 2) === 34 ? readBlockString(e, j) : readString(e, j);
		}
		if (isDigit$1(O) || O === 45) return readNumber(e, j, O);
		if (isNameStart(O)) return readName(e, j);
		throw syntaxError(e.source, j, O === 39 ? "Unexpected single quote character ('), did you mean to use a double quote (\")?" : isUnicodeScalarValue(O) || isSupplementaryCodePoint(k, j) ? `Unexpected character: ${printCodePointAt(e, j)}.` : `Invalid character: ${printCodePointAt(e, j)}.`);
	}
	return createToken(e, TokenKind.EOF, A, A);
}
function readComment(e, O) {
	let k = e.source.body, A = k.length, j = O + 1;
	for (; j < A;) {
		let e = k.charCodeAt(j);
		if (e === 10 || e === 13) break;
		if (isUnicodeScalarValue(e)) ++j;
		else if (isSupplementaryCodePoint(k, j)) j += 2;
		else break;
	}
	return createToken(e, TokenKind.COMMENT, O, j, k.slice(O + 1, j));
}
function readNumber(e, O, k) {
	let A = e.source.body, j = O, M = k, N = !1;
	if (M === 45 && (M = A.charCodeAt(++j)), M === 48) {
		if (M = A.charCodeAt(++j), isDigit$1(M)) throw syntaxError(e.source, j, `Invalid number, unexpected digit after 0: ${printCodePointAt(e, j)}.`);
	} else j = readDigits(e, j, M), M = A.charCodeAt(j);
	if (M === 46 && (N = !0, M = A.charCodeAt(++j), j = readDigits(e, j, M), M = A.charCodeAt(j)), (M === 69 || M === 101) && (N = !0, M = A.charCodeAt(++j), (M === 43 || M === 45) && (M = A.charCodeAt(++j)), j = readDigits(e, j, M), M = A.charCodeAt(j)), M === 46 || isNameStart(M)) throw syntaxError(e.source, j, `Invalid number, expected digit but got: ${printCodePointAt(e, j)}.`);
	return createToken(e, N ? TokenKind.FLOAT : TokenKind.INT, O, j, A.slice(O, j));
}
function readDigits(e, O, k) {
	if (!isDigit$1(k)) throw syntaxError(e.source, O, `Invalid number, expected digit but got: ${printCodePointAt(e, O)}.`);
	let A = e.source.body, j = O + 1;
	for (; isDigit$1(A.charCodeAt(j));) ++j;
	return j;
}
function readString(e, O) {
	let k = e.source.body, A = k.length, j = O + 1, M = j, N = "";
	for (; j < A;) {
		let A = k.charCodeAt(j);
		if (A === 34) return N += k.slice(M, j), createToken(e, TokenKind.STRING, O, j + 1, N);
		if (A === 92) {
			N += k.slice(M, j);
			let O = k.charCodeAt(j + 1) === 117 ? k.charCodeAt(j + 2) === 123 ? readEscapedUnicodeVariableWidth(e, j) : readEscapedUnicodeFixedWidth(e, j) : readEscapedCharacter(e, j);
			N += O.value, j += O.size, M = j;
			continue;
		}
		if (A === 10 || A === 13) break;
		if (isUnicodeScalarValue(A)) ++j;
		else if (isSupplementaryCodePoint(k, j)) j += 2;
		else throw syntaxError(e.source, j, `Invalid character within String: ${printCodePointAt(e, j)}.`);
	}
	throw syntaxError(e.source, j, "Unterminated string.");
}
function readEscapedUnicodeVariableWidth(e, O) {
	let k = e.source.body, A = 0, j = 3;
	for (; j < 12;) {
		let e = k.charCodeAt(O + j++);
		if (e === 125) {
			if (j < 5 || !isUnicodeScalarValue(A)) break;
			return {
				value: String.fromCodePoint(A),
				size: j
			};
		}
		if (A = A << 4 | readHexDigit(e), A < 0) break;
	}
	throw syntaxError(e.source, O, `Invalid Unicode escape sequence: "${k.slice(O, O + j)}".`);
}
function readEscapedUnicodeFixedWidth(e, O) {
	let k = e.source.body, A = read16BitHexCode(k, O + 2);
	if (isUnicodeScalarValue(A)) return {
		value: String.fromCodePoint(A),
		size: 6
	};
	if (isLeadingSurrogate(A) && k.charCodeAt(O + 6) === 92 && k.charCodeAt(O + 7) === 117) {
		let e = read16BitHexCode(k, O + 8);
		if (isTrailingSurrogate(e)) return {
			value: String.fromCodePoint(A, e),
			size: 12
		};
	}
	throw syntaxError(e.source, O, `Invalid Unicode escape sequence: "${k.slice(O, O + 6)}".`);
}
function read16BitHexCode(e, O) {
	return readHexDigit(e.charCodeAt(O)) << 12 | readHexDigit(e.charCodeAt(O + 1)) << 8 | readHexDigit(e.charCodeAt(O + 2)) << 4 | readHexDigit(e.charCodeAt(O + 3));
}
function readHexDigit(e) {
	return e >= 48 && e <= 57 ? e - 48 : e >= 65 && e <= 70 ? e - 55 : e >= 97 && e <= 102 ? e - 87 : -1;
}
function readEscapedCharacter(e, O) {
	let k = e.source.body;
	switch (k.charCodeAt(O + 1)) {
		case 34: return {
			value: "\"",
			size: 2
		};
		case 92: return {
			value: "\\",
			size: 2
		};
		case 47: return {
			value: "/",
			size: 2
		};
		case 98: return {
			value: "\b",
			size: 2
		};
		case 102: return {
			value: "\f",
			size: 2
		};
		case 110: return {
			value: "\n",
			size: 2
		};
		case 114: return {
			value: "\r",
			size: 2
		};
		case 116: return {
			value: "	",
			size: 2
		};
	}
	throw syntaxError(e.source, O, `Invalid character escape sequence: "${k.slice(O, O + 2)}".`);
}
function readBlockString(e, O) {
	let k = e.source.body, A = k.length, j = e.lineStart, M = O + 3, N = M, P = "", F = [];
	for (; M < A;) {
		let A = k.charCodeAt(M);
		if (A === 34 && k.charCodeAt(M + 1) === 34 && k.charCodeAt(M + 2) === 34) {
			P += k.slice(N, M), F.push(P);
			let A = createToken(e, TokenKind.BLOCK_STRING, O, M + 3, dedentBlockStringLines(F).join("\n"));
			return e.line += F.length - 1, e.lineStart = j, A;
		}
		if (A === 92 && k.charCodeAt(M + 1) === 34 && k.charCodeAt(M + 2) === 34 && k.charCodeAt(M + 3) === 34) {
			P += k.slice(N, M), N = M + 1, M += 4;
			continue;
		}
		if (A === 10 || A === 13) {
			P += k.slice(N, M), F.push(P), A === 13 && k.charCodeAt(M + 1) === 10 ? M += 2 : ++M, P = "", N = M, j = M;
			continue;
		}
		if (isUnicodeScalarValue(A)) ++M;
		else if (isSupplementaryCodePoint(k, M)) M += 2;
		else throw syntaxError(e.source, M, `Invalid character within String: ${printCodePointAt(e, M)}.`);
	}
	throw syntaxError(e.source, M, "Unterminated string.");
}
function readName(e, O) {
	let k = e.source.body, A = k.length, j = O + 1;
	for (; j < A;) {
		let e = k.charCodeAt(j);
		if (isNameContinue(e)) ++j;
		else break;
	}
	return createToken(e, TokenKind.NAME, O, j, k.slice(O, j));
}
var MAX_ARRAY_LENGTH = 10, MAX_RECURSIVE_DEPTH = 2;
function inspect(e) {
	return formatValue(e, []);
}
function formatValue(e, O) {
	switch (typeof e) {
		case "string": return JSON.stringify(e);
		case "function": return e.name ? `[function ${e.name}]` : "[function]";
		case "object": return formatObjectValue(e, O);
		default: return String(e);
	}
}
function formatObjectValue(e, O) {
	if (e === null) return "null";
	if (O.includes(e)) return "[Circular]";
	let k = [...O, e];
	if (isJSONable(e)) {
		let O = e.toJSON();
		if (O !== e) return typeof O == "string" ? O : formatValue(O, k);
	} else if (Array.isArray(e)) return formatArray(e, k);
	return formatObject(e, k);
}
function isJSONable(e) {
	return typeof e.toJSON == "function";
}
function formatObject(e, O) {
	let k = Object.entries(e);
	return k.length === 0 ? "{}" : O.length > MAX_RECURSIVE_DEPTH ? "[" + getObjectTag(e) + "]" : "{ " + k.map(([e, k]) => e + ": " + formatValue(k, O)).join(", ") + " }";
}
function formatArray(e, O) {
	if (e.length === 0) return "[]";
	if (O.length > MAX_RECURSIVE_DEPTH) return "[Array]";
	let k = Math.min(MAX_ARRAY_LENGTH, e.length), A = e.length - k, j = [];
	for (let A = 0; A < k; ++A) j.push(formatValue(e[A], O));
	return A === 1 ? j.push("... 1 more item") : A > 1 && j.push(`... ${A} more items`), "[" + j.join(", ") + "]";
}
function getObjectTag(e) {
	let O = Object.prototype.toString.call(e).replace(/^\[object /, "").replace(/]$/, "");
	if (O === "Object" && typeof e.constructor == "function") {
		let O = e.constructor.name;
		if (typeof O == "string" && O !== "") return O;
	}
	return O;
}
const instanceOf = globalThis.process && process.env.NODE_ENV === "production" ? function(e, O) {
	return e instanceof O;
} : function(e, O) {
	if (e instanceof O) return !0;
	if (typeof e == "object" && e) {
		let k = O.prototype[Symbol.toStringTag], A = Symbol.toStringTag in e ? e[Symbol.toStringTag] : e.constructor?.name;
		if (k === A) {
			let O = inspect(e);
			throw Error(`Cannot use ${k} "${O}" from another module or realm.

Ensure that there is only one instance of "graphql" in the node_modules
directory. If different versions of "graphql" are the dependencies of other
relied on modules, use "resolutions" to ensure only one version is installed.

https://yarnpkg.com/en/docs/selective-version-resolutions

Duplicate "graphql" modules cannot be used at the same time since different
versions may have different capabilities and behavior. The data from one
version used in the function from another could produce confusing and
spurious results.`);
		}
	}
	return !1;
};
var Source = class {
	constructor(e, O = "GraphQL request", k = {
		line: 1,
		column: 1
	}) {
		typeof e == "string" || devAssert(!1, `Body must be a string. Received: ${inspect(e)}.`), this.body = e, this.name = O, this.locationOffset = k, this.locationOffset.line > 0 || devAssert(!1, "line in locationOffset is 1-indexed and must be positive."), this.locationOffset.column > 0 || devAssert(!1, "column in locationOffset is 1-indexed and must be positive.");
	}
	get [Symbol.toStringTag]() {
		return "Source";
	}
};
function isSource(e) {
	return instanceOf(e, Source);
}
function parse(e, O) {
	let k = new Parser(e, O), A = k.parseDocument();
	return Object.defineProperty(A, "tokenCount", {
		enumerable: !1,
		value: k.tokenCount
	}), A;
}
function parseValue(e, O) {
	let k = new Parser(e, O);
	k.expectToken(TokenKind.SOF);
	let A = k.parseValueLiteral(!1);
	return k.expectToken(TokenKind.EOF), A;
}
var Parser = class {
	constructor(e, O = {}) {
		let { lexer: k,...A } = O;
		if (k) this._lexer = k;
		else {
			let O = isSource(e) ? e : new Source(e);
			this._lexer = new Lexer(O);
		}
		this._options = A, this._tokenCounter = 0;
	}
	get tokenCount() {
		return this._tokenCounter;
	}
	parseName() {
		let e = this.expectToken(TokenKind.NAME);
		return this.node(e, {
			kind: Kind.NAME,
			value: e.value
		});
	}
	parseDocument() {
		return this.node(this._lexer.token, {
			kind: Kind.DOCUMENT,
			definitions: this.many(TokenKind.SOF, this.parseDefinition, TokenKind.EOF)
		});
	}
	parseDefinition() {
		if (this.peek(TokenKind.BRACE_L)) return this.parseOperationDefinition();
		let e = this.peekDescription(), O = e ? this._lexer.lookahead() : this._lexer.token;
		if (e && O.kind === TokenKind.BRACE_L) throw syntaxError(this._lexer.source, this._lexer.token.start, "Unexpected description, descriptions are not supported on shorthand queries.");
		if (O.kind === TokenKind.NAME) {
			switch (O.value) {
				case "schema": return this.parseSchemaDefinition();
				case "scalar": return this.parseScalarTypeDefinition();
				case "type": return this.parseObjectTypeDefinition();
				case "interface": return this.parseInterfaceTypeDefinition();
				case "union": return this.parseUnionTypeDefinition();
				case "enum": return this.parseEnumTypeDefinition();
				case "input": return this.parseInputObjectTypeDefinition();
				case "directive": return this.parseDirectiveDefinition();
			}
			switch (O.value) {
				case "query":
				case "mutation":
				case "subscription": return this.parseOperationDefinition();
				case "fragment": return this.parseFragmentDefinition();
			}
			if (e) throw syntaxError(this._lexer.source, this._lexer.token.start, "Unexpected description, only GraphQL definitions support descriptions.");
			switch (O.value) {
				case "extend": return this.parseTypeSystemExtension();
			}
		}
		throw this.unexpected(O);
	}
	parseOperationDefinition() {
		let e = this._lexer.token;
		if (this.peek(TokenKind.BRACE_L)) return this.node(e, {
			kind: Kind.OPERATION_DEFINITION,
			operation: OperationTypeNode.QUERY,
			description: void 0,
			name: void 0,
			variableDefinitions: [],
			directives: [],
			selectionSet: this.parseSelectionSet()
		});
		let O = this.parseDescription(), k = this.parseOperationType(), A;
		return this.peek(TokenKind.NAME) && (A = this.parseName()), this.node(e, {
			kind: Kind.OPERATION_DEFINITION,
			operation: k,
			description: O,
			name: A,
			variableDefinitions: this.parseVariableDefinitions(),
			directives: this.parseDirectives(!1),
			selectionSet: this.parseSelectionSet()
		});
	}
	parseOperationType() {
		let e = this.expectToken(TokenKind.NAME);
		switch (e.value) {
			case "query": return OperationTypeNode.QUERY;
			case "mutation": return OperationTypeNode.MUTATION;
			case "subscription": return OperationTypeNode.SUBSCRIPTION;
		}
		throw this.unexpected(e);
	}
	parseVariableDefinitions() {
		return this.optionalMany(TokenKind.PAREN_L, this.parseVariableDefinition, TokenKind.PAREN_R);
	}
	parseVariableDefinition() {
		return this.node(this._lexer.token, {
			kind: Kind.VARIABLE_DEFINITION,
			description: this.parseDescription(),
			variable: this.parseVariable(),
			type: (this.expectToken(TokenKind.COLON), this.parseTypeReference()),
			defaultValue: this.expectOptionalToken(TokenKind.EQUALS) ? this.parseConstValueLiteral() : void 0,
			directives: this.parseConstDirectives()
		});
	}
	parseVariable() {
		let e = this._lexer.token;
		return this.expectToken(TokenKind.DOLLAR), this.node(e, {
			kind: Kind.VARIABLE,
			name: this.parseName()
		});
	}
	parseSelectionSet() {
		return this.node(this._lexer.token, {
			kind: Kind.SELECTION_SET,
			selections: this.many(TokenKind.BRACE_L, this.parseSelection, TokenKind.BRACE_R)
		});
	}
	parseSelection() {
		return this.peek(TokenKind.SPREAD) ? this.parseFragment() : this.parseField();
	}
	parseField() {
		let e = this._lexer.token, O = this.parseName(), k, A;
		return this.expectOptionalToken(TokenKind.COLON) ? (k = O, A = this.parseName()) : A = O, this.node(e, {
			kind: Kind.FIELD,
			alias: k,
			name: A,
			arguments: this.parseArguments(!1),
			directives: this.parseDirectives(!1),
			selectionSet: this.peek(TokenKind.BRACE_L) ? this.parseSelectionSet() : void 0
		});
	}
	parseArguments(e) {
		let O = e ? this.parseConstArgument : this.parseArgument;
		return this.optionalMany(TokenKind.PAREN_L, O, TokenKind.PAREN_R);
	}
	parseArgument(e = !1) {
		let O = this._lexer.token, k = this.parseName();
		return this.expectToken(TokenKind.COLON), this.node(O, {
			kind: Kind.ARGUMENT,
			name: k,
			value: this.parseValueLiteral(e)
		});
	}
	parseConstArgument() {
		return this.parseArgument(!0);
	}
	parseFragment() {
		let e = this._lexer.token;
		this.expectToken(TokenKind.SPREAD);
		let O = this.expectOptionalKeyword("on");
		return !O && this.peek(TokenKind.NAME) ? this.node(e, {
			kind: Kind.FRAGMENT_SPREAD,
			name: this.parseFragmentName(),
			directives: this.parseDirectives(!1)
		}) : this.node(e, {
			kind: Kind.INLINE_FRAGMENT,
			typeCondition: O ? this.parseNamedType() : void 0,
			directives: this.parseDirectives(!1),
			selectionSet: this.parseSelectionSet()
		});
	}
	parseFragmentDefinition() {
		let e = this._lexer.token, O = this.parseDescription();
		return this.expectKeyword("fragment"), this._options.allowLegacyFragmentVariables === !0 ? this.node(e, {
			kind: Kind.FRAGMENT_DEFINITION,
			description: O,
			name: this.parseFragmentName(),
			variableDefinitions: this.parseVariableDefinitions(),
			typeCondition: (this.expectKeyword("on"), this.parseNamedType()),
			directives: this.parseDirectives(!1),
			selectionSet: this.parseSelectionSet()
		}) : this.node(e, {
			kind: Kind.FRAGMENT_DEFINITION,
			description: O,
			name: this.parseFragmentName(),
			typeCondition: (this.expectKeyword("on"), this.parseNamedType()),
			directives: this.parseDirectives(!1),
			selectionSet: this.parseSelectionSet()
		});
	}
	parseFragmentName() {
		if (this._lexer.token.value === "on") throw this.unexpected();
		return this.parseName();
	}
	parseValueLiteral(e) {
		let O = this._lexer.token;
		switch (O.kind) {
			case TokenKind.BRACKET_L: return this.parseList(e);
			case TokenKind.BRACE_L: return this.parseObject(e);
			case TokenKind.INT: return this.advanceLexer(), this.node(O, {
				kind: Kind.INT,
				value: O.value
			});
			case TokenKind.FLOAT: return this.advanceLexer(), this.node(O, {
				kind: Kind.FLOAT,
				value: O.value
			});
			case TokenKind.STRING:
			case TokenKind.BLOCK_STRING: return this.parseStringLiteral();
			case TokenKind.NAME: switch (this.advanceLexer(), O.value) {
				case "true": return this.node(O, {
					kind: Kind.BOOLEAN,
					value: !0
				});
				case "false": return this.node(O, {
					kind: Kind.BOOLEAN,
					value: !1
				});
				case "null": return this.node(O, { kind: Kind.NULL });
				default: return this.node(O, {
					kind: Kind.ENUM,
					value: O.value
				});
			}
			case TokenKind.DOLLAR:
				if (e) if (this.expectToken(TokenKind.DOLLAR), this._lexer.token.kind === TokenKind.NAME) {
					let e = this._lexer.token.value;
					throw syntaxError(this._lexer.source, O.start, `Unexpected variable "$${e}" in constant value.`);
				} else throw this.unexpected(O);
				return this.parseVariable();
			default: throw this.unexpected();
		}
	}
	parseConstValueLiteral() {
		return this.parseValueLiteral(!0);
	}
	parseStringLiteral() {
		let e = this._lexer.token;
		return this.advanceLexer(), this.node(e, {
			kind: Kind.STRING,
			value: e.value,
			block: e.kind === TokenKind.BLOCK_STRING
		});
	}
	parseList(e) {
		return this.node(this._lexer.token, {
			kind: Kind.LIST,
			values: this.any(TokenKind.BRACKET_L, () => this.parseValueLiteral(e), TokenKind.BRACKET_R)
		});
	}
	parseObject(e) {
		return this.node(this._lexer.token, {
			kind: Kind.OBJECT,
			fields: this.any(TokenKind.BRACE_L, () => this.parseObjectField(e), TokenKind.BRACE_R)
		});
	}
	parseObjectField(e) {
		let O = this._lexer.token, k = this.parseName();
		return this.expectToken(TokenKind.COLON), this.node(O, {
			kind: Kind.OBJECT_FIELD,
			name: k,
			value: this.parseValueLiteral(e)
		});
	}
	parseDirectives(e) {
		let O = [];
		for (; this.peek(TokenKind.AT);) O.push(this.parseDirective(e));
		return O;
	}
	parseConstDirectives() {
		return this.parseDirectives(!0);
	}
	parseDirective(e) {
		let O = this._lexer.token;
		return this.expectToken(TokenKind.AT), this.node(O, {
			kind: Kind.DIRECTIVE,
			name: this.parseName(),
			arguments: this.parseArguments(e)
		});
	}
	parseTypeReference() {
		let e = this._lexer.token, O;
		if (this.expectOptionalToken(TokenKind.BRACKET_L)) {
			let k = this.parseTypeReference();
			this.expectToken(TokenKind.BRACKET_R), O = this.node(e, {
				kind: Kind.LIST_TYPE,
				type: k
			});
		} else O = this.parseNamedType();
		return this.expectOptionalToken(TokenKind.BANG) ? this.node(e, {
			kind: Kind.NON_NULL_TYPE,
			type: O
		}) : O;
	}
	parseNamedType() {
		return this.node(this._lexer.token, {
			kind: Kind.NAMED_TYPE,
			name: this.parseName()
		});
	}
	peekDescription() {
		return this.peek(TokenKind.STRING) || this.peek(TokenKind.BLOCK_STRING);
	}
	parseDescription() {
		if (this.peekDescription()) return this.parseStringLiteral();
	}
	parseSchemaDefinition() {
		let e = this._lexer.token, O = this.parseDescription();
		this.expectKeyword("schema");
		let k = this.parseConstDirectives(), A = this.many(TokenKind.BRACE_L, this.parseOperationTypeDefinition, TokenKind.BRACE_R);
		return this.node(e, {
			kind: Kind.SCHEMA_DEFINITION,
			description: O,
			directives: k,
			operationTypes: A
		});
	}
	parseOperationTypeDefinition() {
		let e = this._lexer.token, O = this.parseOperationType();
		this.expectToken(TokenKind.COLON);
		let k = this.parseNamedType();
		return this.node(e, {
			kind: Kind.OPERATION_TYPE_DEFINITION,
			operation: O,
			type: k
		});
	}
	parseScalarTypeDefinition() {
		let e = this._lexer.token, O = this.parseDescription();
		this.expectKeyword("scalar");
		let k = this.parseName(), A = this.parseConstDirectives();
		return this.node(e, {
			kind: Kind.SCALAR_TYPE_DEFINITION,
			description: O,
			name: k,
			directives: A
		});
	}
	parseObjectTypeDefinition() {
		let e = this._lexer.token, O = this.parseDescription();
		this.expectKeyword("type");
		let k = this.parseName(), A = this.parseImplementsInterfaces(), j = this.parseConstDirectives(), M = this.parseFieldsDefinition();
		return this.node(e, {
			kind: Kind.OBJECT_TYPE_DEFINITION,
			description: O,
			name: k,
			interfaces: A,
			directives: j,
			fields: M
		});
	}
	parseImplementsInterfaces() {
		return this.expectOptionalKeyword("implements") ? this.delimitedMany(TokenKind.AMP, this.parseNamedType) : [];
	}
	parseFieldsDefinition() {
		return this.optionalMany(TokenKind.BRACE_L, this.parseFieldDefinition, TokenKind.BRACE_R);
	}
	parseFieldDefinition() {
		let e = this._lexer.token, O = this.parseDescription(), k = this.parseName(), A = this.parseArgumentDefs();
		this.expectToken(TokenKind.COLON);
		let j = this.parseTypeReference(), M = this.parseConstDirectives();
		return this.node(e, {
			kind: Kind.FIELD_DEFINITION,
			description: O,
			name: k,
			arguments: A,
			type: j,
			directives: M
		});
	}
	parseArgumentDefs() {
		return this.optionalMany(TokenKind.PAREN_L, this.parseInputValueDef, TokenKind.PAREN_R);
	}
	parseInputValueDef() {
		let e = this._lexer.token, O = this.parseDescription(), k = this.parseName();
		this.expectToken(TokenKind.COLON);
		let A = this.parseTypeReference(), j;
		this.expectOptionalToken(TokenKind.EQUALS) && (j = this.parseConstValueLiteral());
		let M = this.parseConstDirectives();
		return this.node(e, {
			kind: Kind.INPUT_VALUE_DEFINITION,
			description: O,
			name: k,
			type: A,
			defaultValue: j,
			directives: M
		});
	}
	parseInterfaceTypeDefinition() {
		let e = this._lexer.token, O = this.parseDescription();
		this.expectKeyword("interface");
		let k = this.parseName(), A = this.parseImplementsInterfaces(), j = this.parseConstDirectives(), M = this.parseFieldsDefinition();
		return this.node(e, {
			kind: Kind.INTERFACE_TYPE_DEFINITION,
			description: O,
			name: k,
			interfaces: A,
			directives: j,
			fields: M
		});
	}
	parseUnionTypeDefinition() {
		let e = this._lexer.token, O = this.parseDescription();
		this.expectKeyword("union");
		let k = this.parseName(), A = this.parseConstDirectives(), j = this.parseUnionMemberTypes();
		return this.node(e, {
			kind: Kind.UNION_TYPE_DEFINITION,
			description: O,
			name: k,
			directives: A,
			types: j
		});
	}
	parseUnionMemberTypes() {
		return this.expectOptionalToken(TokenKind.EQUALS) ? this.delimitedMany(TokenKind.PIPE, this.parseNamedType) : [];
	}
	parseEnumTypeDefinition() {
		let e = this._lexer.token, O = this.parseDescription();
		this.expectKeyword("enum");
		let k = this.parseName(), A = this.parseConstDirectives(), j = this.parseEnumValuesDefinition();
		return this.node(e, {
			kind: Kind.ENUM_TYPE_DEFINITION,
			description: O,
			name: k,
			directives: A,
			values: j
		});
	}
	parseEnumValuesDefinition() {
		return this.optionalMany(TokenKind.BRACE_L, this.parseEnumValueDefinition, TokenKind.BRACE_R);
	}
	parseEnumValueDefinition() {
		let e = this._lexer.token, O = this.parseDescription(), k = this.parseEnumValueName(), A = this.parseConstDirectives();
		return this.node(e, {
			kind: Kind.ENUM_VALUE_DEFINITION,
			description: O,
			name: k,
			directives: A
		});
	}
	parseEnumValueName() {
		if (this._lexer.token.value === "true" || this._lexer.token.value === "false" || this._lexer.token.value === "null") throw syntaxError(this._lexer.source, this._lexer.token.start, `${getTokenDesc(this._lexer.token)} is reserved and cannot be used for an enum value.`);
		return this.parseName();
	}
	parseInputObjectTypeDefinition() {
		let e = this._lexer.token, O = this.parseDescription();
		this.expectKeyword("input");
		let k = this.parseName(), A = this.parseConstDirectives(), j = this.parseInputFieldsDefinition();
		return this.node(e, {
			kind: Kind.INPUT_OBJECT_TYPE_DEFINITION,
			description: O,
			name: k,
			directives: A,
			fields: j
		});
	}
	parseInputFieldsDefinition() {
		return this.optionalMany(TokenKind.BRACE_L, this.parseInputValueDef, TokenKind.BRACE_R);
	}
	parseTypeSystemExtension() {
		let e = this._lexer.lookahead();
		if (e.kind === TokenKind.NAME) switch (e.value) {
			case "schema": return this.parseSchemaExtension();
			case "scalar": return this.parseScalarTypeExtension();
			case "type": return this.parseObjectTypeExtension();
			case "interface": return this.parseInterfaceTypeExtension();
			case "union": return this.parseUnionTypeExtension();
			case "enum": return this.parseEnumTypeExtension();
			case "input": return this.parseInputObjectTypeExtension();
		}
		throw this.unexpected(e);
	}
	parseSchemaExtension() {
		let e = this._lexer.token;
		this.expectKeyword("extend"), this.expectKeyword("schema");
		let O = this.parseConstDirectives(), k = this.optionalMany(TokenKind.BRACE_L, this.parseOperationTypeDefinition, TokenKind.BRACE_R);
		if (O.length === 0 && k.length === 0) throw this.unexpected();
		return this.node(e, {
			kind: Kind.SCHEMA_EXTENSION,
			directives: O,
			operationTypes: k
		});
	}
	parseScalarTypeExtension() {
		let e = this._lexer.token;
		this.expectKeyword("extend"), this.expectKeyword("scalar");
		let O = this.parseName(), k = this.parseConstDirectives();
		if (k.length === 0) throw this.unexpected();
		return this.node(e, {
			kind: Kind.SCALAR_TYPE_EXTENSION,
			name: O,
			directives: k
		});
	}
	parseObjectTypeExtension() {
		let e = this._lexer.token;
		this.expectKeyword("extend"), this.expectKeyword("type");
		let O = this.parseName(), k = this.parseImplementsInterfaces(), A = this.parseConstDirectives(), j = this.parseFieldsDefinition();
		if (k.length === 0 && A.length === 0 && j.length === 0) throw this.unexpected();
		return this.node(e, {
			kind: Kind.OBJECT_TYPE_EXTENSION,
			name: O,
			interfaces: k,
			directives: A,
			fields: j
		});
	}
	parseInterfaceTypeExtension() {
		let e = this._lexer.token;
		this.expectKeyword("extend"), this.expectKeyword("interface");
		let O = this.parseName(), k = this.parseImplementsInterfaces(), A = this.parseConstDirectives(), j = this.parseFieldsDefinition();
		if (k.length === 0 && A.length === 0 && j.length === 0) throw this.unexpected();
		return this.node(e, {
			kind: Kind.INTERFACE_TYPE_EXTENSION,
			name: O,
			interfaces: k,
			directives: A,
			fields: j
		});
	}
	parseUnionTypeExtension() {
		let e = this._lexer.token;
		this.expectKeyword("extend"), this.expectKeyword("union");
		let O = this.parseName(), k = this.parseConstDirectives(), A = this.parseUnionMemberTypes();
		if (k.length === 0 && A.length === 0) throw this.unexpected();
		return this.node(e, {
			kind: Kind.UNION_TYPE_EXTENSION,
			name: O,
			directives: k,
			types: A
		});
	}
	parseEnumTypeExtension() {
		let e = this._lexer.token;
		this.expectKeyword("extend"), this.expectKeyword("enum");
		let O = this.parseName(), k = this.parseConstDirectives(), A = this.parseEnumValuesDefinition();
		if (k.length === 0 && A.length === 0) throw this.unexpected();
		return this.node(e, {
			kind: Kind.ENUM_TYPE_EXTENSION,
			name: O,
			directives: k,
			values: A
		});
	}
	parseInputObjectTypeExtension() {
		let e = this._lexer.token;
		this.expectKeyword("extend"), this.expectKeyword("input");
		let O = this.parseName(), k = this.parseConstDirectives(), A = this.parseInputFieldsDefinition();
		if (k.length === 0 && A.length === 0) throw this.unexpected();
		return this.node(e, {
			kind: Kind.INPUT_OBJECT_TYPE_EXTENSION,
			name: O,
			directives: k,
			fields: A
		});
	}
	parseDirectiveDefinition() {
		let e = this._lexer.token, O = this.parseDescription();
		this.expectKeyword("directive"), this.expectToken(TokenKind.AT);
		let k = this.parseName(), A = this.parseArgumentDefs(), j = this.expectOptionalKeyword("repeatable");
		this.expectKeyword("on");
		let M = this.parseDirectiveLocations();
		return this.node(e, {
			kind: Kind.DIRECTIVE_DEFINITION,
			description: O,
			name: k,
			arguments: A,
			repeatable: j,
			locations: M
		});
	}
	parseDirectiveLocations() {
		return this.delimitedMany(TokenKind.PIPE, this.parseDirectiveLocation);
	}
	parseDirectiveLocation() {
		let e = this._lexer.token, O = this.parseName();
		if (Object.prototype.hasOwnProperty.call(DirectiveLocation, O.value)) return O;
		throw this.unexpected(e);
	}
	parseSchemaCoordinate() {
		let e = this._lexer.token, O = this.expectOptionalToken(TokenKind.AT), k = this.parseName(), A;
		!O && this.expectOptionalToken(TokenKind.DOT) && (A = this.parseName());
		let j;
		return (O || A) && this.expectOptionalToken(TokenKind.PAREN_L) && (j = this.parseName(), this.expectToken(TokenKind.COLON), this.expectToken(TokenKind.PAREN_R)), O ? j ? this.node(e, {
			kind: Kind.DIRECTIVE_ARGUMENT_COORDINATE,
			name: k,
			argumentName: j
		}) : this.node(e, {
			kind: Kind.DIRECTIVE_COORDINATE,
			name: k
		}) : A ? j ? this.node(e, {
			kind: Kind.ARGUMENT_COORDINATE,
			name: k,
			fieldName: A,
			argumentName: j
		}) : this.node(e, {
			kind: Kind.MEMBER_COORDINATE,
			name: k,
			memberName: A
		}) : this.node(e, {
			kind: Kind.TYPE_COORDINATE,
			name: k
		});
	}
	node(e, O) {
		return this._options.noLocation !== !0 && (O.loc = new Location(e, this._lexer.lastToken, this._lexer.source)), O;
	}
	peek(e) {
		return this._lexer.token.kind === e;
	}
	expectToken(e) {
		let O = this._lexer.token;
		if (O.kind === e) return this.advanceLexer(), O;
		throw syntaxError(this._lexer.source, O.start, `Expected ${getTokenKindDesc(e)}, found ${getTokenDesc(O)}.`);
	}
	expectOptionalToken(e) {
		return this._lexer.token.kind === e ? (this.advanceLexer(), !0) : !1;
	}
	expectKeyword(e) {
		let O = this._lexer.token;
		if (O.kind === TokenKind.NAME && O.value === e) this.advanceLexer();
		else throw syntaxError(this._lexer.source, O.start, `Expected "${e}", found ${getTokenDesc(O)}.`);
	}
	expectOptionalKeyword(e) {
		let O = this._lexer.token;
		return O.kind === TokenKind.NAME && O.value === e ? (this.advanceLexer(), !0) : !1;
	}
	unexpected(e) {
		let O = e ?? this._lexer.token;
		return syntaxError(this._lexer.source, O.start, `Unexpected ${getTokenDesc(O)}.`);
	}
	any(e, O, k) {
		this.expectToken(e);
		let A = [];
		for (; !this.expectOptionalToken(k);) A.push(O.call(this));
		return A;
	}
	optionalMany(e, O, k) {
		if (this.expectOptionalToken(e)) {
			let e = [];
			do
				e.push(O.call(this));
			while (!this.expectOptionalToken(k));
			return e;
		}
		return [];
	}
	many(e, O, k) {
		this.expectToken(e);
		let A = [];
		do
			A.push(O.call(this));
		while (!this.expectOptionalToken(k));
		return A;
	}
	delimitedMany(e, O) {
		this.expectOptionalToken(e);
		let k = [];
		do
			k.push(O.call(this));
		while (this.expectOptionalToken(e));
		return k;
	}
	advanceLexer() {
		let { maxTokens: e } = this._options, O = this._lexer.advance();
		if (O.kind !== TokenKind.EOF && (++this._tokenCounter, e !== void 0 && this._tokenCounter > e)) throw syntaxError(this._lexer.source, O.start, `Document contains more that ${e} tokens. Parsing aborted.`);
	}
};
function getTokenDesc(e) {
	let O = e.value;
	return getTokenKindDesc(e.kind) + (O == null ? "" : ` "${O}"`);
}
function getTokenKindDesc(e) {
	return isPunctuatorTokenKind(e) ? `"${e}"` : e;
}
var MAX_SUGGESTIONS = 5;
function didYouMean(e, O) {
	let [k, A] = O ? [e, O] : [void 0, e], j = " Did you mean ";
	k && (j += k + " ");
	let M = A.map((e) => `"${e}"`);
	switch (M.length) {
		case 0: return "";
		case 1: return j + M[0] + "?";
		case 2: return j + M[0] + " or " + M[1] + "?";
	}
	let N = M.slice(0, MAX_SUGGESTIONS), P = N.pop();
	return j + N.join(", ") + ", or " + P + "?";
}
function identityFunc(e) {
	return e;
}
function keyMap(e, O) {
	let k = Object.create(null);
	for (let A of e) k[O(A)] = A;
	return k;
}
function keyValMap(e, O, k) {
	let A = Object.create(null);
	for (let j of e) A[O(j)] = k(j);
	return A;
}
function mapValue(e, O) {
	let k = Object.create(null);
	for (let A of Object.keys(e)) k[A] = O(e[A], A);
	return k;
}
function naturalCompare(e, O) {
	let k = 0, A = 0;
	for (; k < e.length && A < O.length;) {
		let j = e.charCodeAt(k), M = O.charCodeAt(A);
		if (isDigit(j) && isDigit(M)) {
			let N = 0;
			do
				++k, N = N * 10 + j - DIGIT_0, j = e.charCodeAt(k);
			while (isDigit(j) && N > 0);
			let P = 0;
			do
				++A, P = P * 10 + M - DIGIT_0, M = O.charCodeAt(A);
			while (isDigit(M) && P > 0);
			if (N < P) return -1;
			if (N > P) return 1;
		} else {
			if (j < M) return -1;
			if (j > M) return 1;
			++k, ++A;
		}
	}
	return e.length - O.length;
}
var DIGIT_0 = 48, DIGIT_9 = 57;
function isDigit(e) {
	return !isNaN(e) && DIGIT_0 <= e && e <= DIGIT_9;
}
function suggestionList(e, O) {
	let k = Object.create(null), A = new LexicalDistance(e), j = Math.floor(e.length * .4) + 1;
	for (let e of O) {
		let O = A.measure(e, j);
		O !== void 0 && (k[e] = O);
	}
	return Object.keys(k).sort((e, O) => {
		let A = k[e] - k[O];
		return A === 0 ? naturalCompare(e, O) : A;
	});
}
var LexicalDistance = class {
	constructor(e) {
		this._input = e, this._inputLowerCase = e.toLowerCase(), this._inputArray = stringToArray(this._inputLowerCase), this._rows = [
			Array(e.length + 1).fill(0),
			Array(e.length + 1).fill(0),
			Array(e.length + 1).fill(0)
		];
	}
	measure(e, O) {
		if (this._input === e) return 0;
		let k = e.toLowerCase();
		if (this._inputLowerCase === k) return 1;
		let A = stringToArray(k), j = this._inputArray;
		if (A.length < j.length) {
			let e = A;
			A = j, j = e;
		}
		let M = A.length, N = j.length;
		if (M - N > O) return;
		let P = this._rows;
		for (let e = 0; e <= N; e++) P[0][e] = e;
		for (let e = 1; e <= M; e++) {
			let k = P[(e - 1) % 3], M = P[e % 3], F = M[0] = e;
			for (let O = 1; O <= N; O++) {
				let N = A[e - 1] === j[O - 1] ? 0 : 1, I = Math.min(k[O] + 1, M[O - 1] + 1, k[O - 1] + N);
				if (e > 1 && O > 1 && A[e - 1] === j[O - 2] && A[e - 2] === j[O - 1]) {
					let k = P[(e - 2) % 3][O - 2];
					I = Math.min(I, k + 1);
				}
				I < F && (F = I), M[O] = I;
			}
			if (F > O) return;
		}
		let F = P[M % 3][N];
		return F <= O ? F : void 0;
	}
};
function stringToArray(e) {
	let O = e.length, k = Array(O);
	for (let A = 0; A < O; ++A) k[A] = e.charCodeAt(A);
	return k;
}
function toObjMap(e) {
	if (e == null) return Object.create(null);
	if (Object.getPrototypeOf(e) === null) return e;
	let O = Object.create(null);
	for (let [k, A] of Object.entries(e)) O[k] = A;
	return O;
}
function printString(e) {
	return `"${e.replace(escapedRegExp, escapedReplacer)}"`;
}
var escapedRegExp = /[\x00-\x1f\x22\x5c\x7f-\x9f]/g;
function escapedReplacer(e) {
	return escapeSequences[e.charCodeAt(0)];
}
var escapeSequences = /* @__PURE__ */ "\\u0000.\\u0001.\\u0002.\\u0003.\\u0004.\\u0005.\\u0006.\\u0007.\\b.\\t.\\n.\\u000B.\\f.\\r.\\u000E.\\u000F.\\u0010.\\u0011.\\u0012.\\u0013.\\u0014.\\u0015.\\u0016.\\u0017.\\u0018.\\u0019.\\u001A.\\u001B.\\u001C.\\u001D.\\u001E.\\u001F...\\\"..........................................................\\\\...................................\\u007F.\\u0080.\\u0081.\\u0082.\\u0083.\\u0084.\\u0085.\\u0086.\\u0087.\\u0088.\\u0089.\\u008A.\\u008B.\\u008C.\\u008D.\\u008E.\\u008F.\\u0090.\\u0091.\\u0092.\\u0093.\\u0094.\\u0095.\\u0096.\\u0097.\\u0098.\\u0099.\\u009A.\\u009B.\\u009C.\\u009D.\\u009E.\\u009F".split(".");
const BREAK = Object.freeze({});
function visit(e, O, k = QueryDocumentKeys) {
	let A = /* @__PURE__ */ new Map();
	for (let e of Object.values(Kind)) A.set(e, getEnterLeaveForKind(O, e));
	let j, M = Array.isArray(e), N = [e], P = -1, F = [], I = e, L, R, z = [], B = [];
	do {
		P++;
		let e = P === N.length, V = e && F.length !== 0;
		if (e) {
			if (L = B.length === 0 ? void 0 : z[z.length - 1], I = R, R = B.pop(), V) if (M) {
				I = I.slice();
				let e = 0;
				for (let [O, k] of F) {
					let A = O - e;
					k === null ? (I.splice(A, 1), e++) : I[A] = k;
				}
			} else {
				I = { ...I };
				for (let [e, O] of F) I[e] = O;
			}
			P = j.index, N = j.keys, F = j.edits, M = j.inArray, j = j.prev;
		} else if (R) {
			if (L = M ? P : N[P], I = R[L], I == null) continue;
			z.push(L);
		}
		let H;
		if (!Array.isArray(I)) {
			if (isNode(I) || devAssert(!1, `Invalid AST Node: ${inspect(I)}.`), H = (e ? A.get(I.kind)?.leave : A.get(I.kind)?.enter)?.call(O, I, L, R, z, B), H === BREAK) break;
			if (H === !1) {
				if (!e) {
					z.pop();
					continue;
				}
			} else if (H !== void 0 && (F.push([L, H]), !e)) if (isNode(H)) I = H;
			else {
				z.pop();
				continue;
			}
		}
		H === void 0 && V && F.push([L, I]), e ? z.pop() : (j = {
			inArray: M,
			index: P,
			keys: N,
			edits: F,
			prev: j
		}, M = Array.isArray(I), N = M ? I : k[I.kind] ?? [], P = -1, F = [], R && B.push(R), R = I);
	} while (j !== void 0);
	return F.length === 0 ? e : F[F.length - 1][1];
}
function visitInParallel(e) {
	let O = Array(e.length).fill(null), k = Object.create(null);
	for (let A of Object.values(Kind)) {
		let j = !1, M = Array(e.length).fill(void 0), N = Array(e.length).fill(void 0);
		for (let O = 0; O < e.length; ++O) {
			let { enter: k, leave: P } = getEnterLeaveForKind(e[O], A);
			j ||= k != null || P != null, M[O] = k, N[O] = P;
		}
		j && (k[A] = {
			enter(...k) {
				let A = k[0];
				for (let j = 0; j < e.length; j++) if (O[j] === null) {
					let N = M[j]?.apply(e[j], k);
					if (N === !1) O[j] = A;
					else if (N === BREAK) O[j] = BREAK;
					else if (N !== void 0) return N;
				}
			},
			leave(...k) {
				let A = k[0];
				for (let j = 0; j < e.length; j++) if (O[j] === null) {
					let A = N[j]?.apply(e[j], k);
					if (A === BREAK) O[j] = BREAK;
					else if (A !== void 0 && A !== !1) return A;
				} else O[j] === A && (O[j] = null);
			}
		});
	}
	return k;
}
function getEnterLeaveForKind(e, O) {
	let k = e[O];
	return typeof k == "object" ? k : typeof k == "function" ? {
		enter: k,
		leave: void 0
	} : {
		enter: e.enter,
		leave: e.leave
	};
}
function print(e) {
	return visit(e, printDocASTReducer);
}
var MAX_LINE_LENGTH = 80, printDocASTReducer = {
	Name: { leave: (e) => e.value },
	Variable: { leave: (e) => "$" + e.name },
	Document: { leave: (e) => join(e.definitions, "\n\n") },
	OperationDefinition: { leave(e) {
		let O = hasMultilineItems(e.variableDefinitions) ? wrap("(\n", join(e.variableDefinitions, "\n"), "\n)") : wrap("(", join(e.variableDefinitions, ", "), ")"), k = wrap("", e.description, "\n") + join([
			e.operation,
			join([e.name, O]),
			join(e.directives, " ")
		], " ");
		return (k === "query" ? "" : k + " ") + e.selectionSet;
	} },
	VariableDefinition: { leave: ({ variable: e, type: O, defaultValue: k, directives: A, description: j }) => wrap("", j, "\n") + e + ": " + O + wrap(" = ", k) + wrap(" ", join(A, " ")) },
	SelectionSet: { leave: ({ selections: e }) => block(e) },
	Field: { leave({ alias: e, name: O, arguments: k, directives: A, selectionSet: j }) {
		let M = wrap("", e, ": ") + O, N = M + wrap("(", join(k, ", "), ")");
		return N.length > MAX_LINE_LENGTH && (N = M + wrap("(\n", indent(join(k, "\n")), "\n)")), join([
			N,
			join(A, " "),
			j
		], " ");
	} },
	Argument: { leave: ({ name: e, value: O }) => e + ": " + O },
	FragmentSpread: { leave: ({ name: e, directives: O }) => "..." + e + wrap(" ", join(O, " ")) },
	InlineFragment: { leave: ({ typeCondition: e, directives: O, selectionSet: k }) => join([
		"...",
		wrap("on ", e),
		join(O, " "),
		k
	], " ") },
	FragmentDefinition: { leave: ({ name: e, typeCondition: O, variableDefinitions: k, directives: A, selectionSet: j, description: M }) => wrap("", M, "\n") + `fragment ${e}${wrap("(", join(k, ", "), ")")} on ${O} ${wrap("", join(A, " "), " ")}` + j },
	IntValue: { leave: ({ value: e }) => e },
	FloatValue: { leave: ({ value: e }) => e },
	StringValue: { leave: ({ value: e, block: O }) => O ? printBlockString(e) : printString(e) },
	BooleanValue: { leave: ({ value: e }) => e ? "true" : "false" },
	NullValue: { leave: () => "null" },
	EnumValue: { leave: ({ value: e }) => e },
	ListValue: { leave: ({ values: e }) => "[" + join(e, ", ") + "]" },
	ObjectValue: { leave: ({ fields: e }) => "{" + join(e, ", ") + "}" },
	ObjectField: { leave: ({ name: e, value: O }) => e + ": " + O },
	Directive: { leave: ({ name: e, arguments: O }) => "@" + e + wrap("(", join(O, ", "), ")") },
	NamedType: { leave: ({ name: e }) => e },
	ListType: { leave: ({ type: e }) => "[" + e + "]" },
	NonNullType: { leave: ({ type: e }) => e + "!" },
	SchemaDefinition: { leave: ({ description: e, directives: O, operationTypes: k }) => wrap("", e, "\n") + join([
		"schema",
		join(O, " "),
		block(k)
	], " ") },
	OperationTypeDefinition: { leave: ({ operation: e, type: O }) => e + ": " + O },
	ScalarTypeDefinition: { leave: ({ description: e, name: O, directives: k }) => wrap("", e, "\n") + join([
		"scalar",
		O,
		join(k, " ")
	], " ") },
	ObjectTypeDefinition: { leave: ({ description: e, name: O, interfaces: k, directives: A, fields: j }) => wrap("", e, "\n") + join([
		"type",
		O,
		wrap("implements ", join(k, " & ")),
		join(A, " "),
		block(j)
	], " ") },
	FieldDefinition: { leave: ({ description: e, name: O, arguments: k, type: A, directives: j }) => wrap("", e, "\n") + O + (hasMultilineItems(k) ? wrap("(\n", indent(join(k, "\n")), "\n)") : wrap("(", join(k, ", "), ")")) + ": " + A + wrap(" ", join(j, " ")) },
	InputValueDefinition: { leave: ({ description: e, name: O, type: k, defaultValue: A, directives: j }) => wrap("", e, "\n") + join([
		O + ": " + k,
		wrap("= ", A),
		join(j, " ")
	], " ") },
	InterfaceTypeDefinition: { leave: ({ description: e, name: O, interfaces: k, directives: A, fields: j }) => wrap("", e, "\n") + join([
		"interface",
		O,
		wrap("implements ", join(k, " & ")),
		join(A, " "),
		block(j)
	], " ") },
	UnionTypeDefinition: { leave: ({ description: e, name: O, directives: k, types: A }) => wrap("", e, "\n") + join([
		"union",
		O,
		join(k, " "),
		wrap("= ", join(A, " | "))
	], " ") },
	EnumTypeDefinition: { leave: ({ description: e, name: O, directives: k, values: A }) => wrap("", e, "\n") + join([
		"enum",
		O,
		join(k, " "),
		block(A)
	], " ") },
	EnumValueDefinition: { leave: ({ description: e, name: O, directives: k }) => wrap("", e, "\n") + join([O, join(k, " ")], " ") },
	InputObjectTypeDefinition: { leave: ({ description: e, name: O, directives: k, fields: A }) => wrap("", e, "\n") + join([
		"input",
		O,
		join(k, " "),
		block(A)
	], " ") },
	DirectiveDefinition: { leave: ({ description: e, name: O, arguments: k, repeatable: A, locations: j }) => wrap("", e, "\n") + "directive @" + O + (hasMultilineItems(k) ? wrap("(\n", indent(join(k, "\n")), "\n)") : wrap("(", join(k, ", "), ")")) + (A ? " repeatable" : "") + " on " + join(j, " | ") },
	SchemaExtension: { leave: ({ directives: e, operationTypes: O }) => join([
		"extend schema",
		join(e, " "),
		block(O)
	], " ") },
	ScalarTypeExtension: { leave: ({ name: e, directives: O }) => join([
		"extend scalar",
		e,
		join(O, " ")
	], " ") },
	ObjectTypeExtension: { leave: ({ name: e, interfaces: O, directives: k, fields: A }) => join([
		"extend type",
		e,
		wrap("implements ", join(O, " & ")),
		join(k, " "),
		block(A)
	], " ") },
	InterfaceTypeExtension: { leave: ({ name: e, interfaces: O, directives: k, fields: A }) => join([
		"extend interface",
		e,
		wrap("implements ", join(O, " & ")),
		join(k, " "),
		block(A)
	], " ") },
	UnionTypeExtension: { leave: ({ name: e, directives: O, types: k }) => join([
		"extend union",
		e,
		join(O, " "),
		wrap("= ", join(k, " | "))
	], " ") },
	EnumTypeExtension: { leave: ({ name: e, directives: O, values: k }) => join([
		"extend enum",
		e,
		join(O, " "),
		block(k)
	], " ") },
	InputObjectTypeExtension: { leave: ({ name: e, directives: O, fields: k }) => join([
		"extend input",
		e,
		join(O, " "),
		block(k)
	], " ") },
	TypeCoordinate: { leave: ({ name: e }) => e },
	MemberCoordinate: { leave: ({ name: e, memberName: O }) => join([e, wrap(".", O)]) },
	ArgumentCoordinate: { leave: ({ name: e, fieldName: O, argumentName: k }) => join([
		e,
		wrap(".", O),
		wrap("(", k, ":)")
	]) },
	DirectiveCoordinate: { leave: ({ name: e }) => join(["@", e]) },
	DirectiveArgumentCoordinate: { leave: ({ name: e, argumentName: O }) => join([
		"@",
		e,
		wrap("(", O, ":)")
	]) }
};
function join(e, O = "") {
	return e?.filter((e) => e).join(O) ?? "";
}
function block(e) {
	return wrap("{\n", indent(join(e, "\n")), "\n}");
}
function wrap(e, O, k = "") {
	return O != null && O !== "" ? e + O + k : "";
}
function indent(e) {
	return wrap("  ", e.replace(/\n/g, "\n  "));
}
function hasMultilineItems(e) {
	/* c8 ignore next */
	return e?.some((e) => e.includes("\n")) ?? !1;
}
function valueFromASTUntyped(e, O) {
	switch (e.kind) {
		case Kind.NULL: return null;
		case Kind.INT: return parseInt(e.value, 10);
		case Kind.FLOAT: return parseFloat(e.value);
		case Kind.STRING:
		case Kind.ENUM:
		case Kind.BOOLEAN: return e.value;
		case Kind.LIST: return e.values.map((e) => valueFromASTUntyped(e, O));
		case Kind.OBJECT: return keyValMap(e.fields, (e) => e.name.value, (e) => valueFromASTUntyped(e.value, O));
		case Kind.VARIABLE: return O?.[e.name.value];
	}
}
function assertName(e) {
	if (e ?? devAssert(!1, "Must provide name."), typeof e == "string" || devAssert(!1, "Expected name to be a string."), e.length === 0) throw new GraphQLError("Expected name to be a non-empty string.");
	for (let O = 1; O < e.length; ++O) if (!isNameContinue(e.charCodeAt(O))) throw new GraphQLError(`Names must only contain [_a-zA-Z0-9] but "${e}" does not.`);
	if (!isNameStart(e.charCodeAt(0))) throw new GraphQLError(`Names must start with [_a-zA-Z] but "${e}" does not.`);
	return e;
}
function assertEnumValueName(e) {
	if (e === "true" || e === "false" || e === "null") throw new GraphQLError(`Enum values cannot be named: ${e}`);
	return assertName(e);
}
function isType(e) {
	return isScalarType(e) || isObjectType(e) || isInterfaceType(e) || isUnionType(e) || isEnumType(e) || isInputObjectType(e) || isListType(e) || isNonNullType(e);
}
function isScalarType(e) {
	return instanceOf(e, GraphQLScalarType);
}
function isObjectType(e) {
	return instanceOf(e, GraphQLObjectType);
}
function assertObjectType(e) {
	if (!isObjectType(e)) throw Error(`Expected ${inspect(e)} to be a GraphQL Object type.`);
	return e;
}
function isInterfaceType(e) {
	return instanceOf(e, GraphQLInterfaceType);
}
function assertInterfaceType(e) {
	if (!isInterfaceType(e)) throw Error(`Expected ${inspect(e)} to be a GraphQL Interface type.`);
	return e;
}
function isUnionType(e) {
	return instanceOf(e, GraphQLUnionType);
}
function isEnumType(e) {
	return instanceOf(e, GraphQLEnumType);
}
function isInputObjectType(e) {
	return instanceOf(e, GraphQLInputObjectType);
}
function isListType(e) {
	return instanceOf(e, GraphQLList);
}
function isNonNullType(e) {
	return instanceOf(e, GraphQLNonNull);
}
function isInputType(e) {
	return isScalarType(e) || isEnumType(e) || isInputObjectType(e) || isWrappingType(e) && isInputType(e.ofType);
}
function isOutputType(e) {
	return isScalarType(e) || isObjectType(e) || isInterfaceType(e) || isUnionType(e) || isEnumType(e) || isWrappingType(e) && isOutputType(e.ofType);
}
function isLeafType(e) {
	return isScalarType(e) || isEnumType(e);
}
function isCompositeType(e) {
	return isObjectType(e) || isInterfaceType(e) || isUnionType(e);
}
function isAbstractType(e) {
	return isInterfaceType(e) || isUnionType(e);
}
var GraphQLList = class {
	constructor(e) {
		isType(e) || devAssert(!1, `Expected ${inspect(e)} to be a GraphQL type.`), this.ofType = e;
	}
	get [Symbol.toStringTag]() {
		return "GraphQLList";
	}
	toString() {
		return "[" + String(this.ofType) + "]";
	}
	toJSON() {
		return this.toString();
	}
}, GraphQLNonNull = class {
	constructor(e) {
		isNullableType(e) || devAssert(!1, `Expected ${inspect(e)} to be a GraphQL nullable type.`), this.ofType = e;
	}
	get [Symbol.toStringTag]() {
		return "GraphQLNonNull";
	}
	toString() {
		return String(this.ofType) + "!";
	}
	toJSON() {
		return this.toString();
	}
};
function isWrappingType(e) {
	return isListType(e) || isNonNullType(e);
}
function isNullableType(e) {
	return isType(e) && !isNonNullType(e);
}
function assertNullableType(e) {
	if (!isNullableType(e)) throw Error(`Expected ${inspect(e)} to be a GraphQL nullable type.`);
	return e;
}
function getNullableType(e) {
	if (e) return isNonNullType(e) ? e.ofType : e;
}
function getNamedType(e) {
	if (e) {
		let O = e;
		for (; isWrappingType(O);) O = O.ofType;
		return O;
	}
}
function resolveReadonlyArrayThunk(e) {
	return typeof e == "function" ? e() : e;
}
function resolveObjMapThunk(e) {
	return typeof e == "function" ? e() : e;
}
var GraphQLScalarType = class {
	constructor(e) {
		let O = e.parseValue ?? identityFunc;
		this.name = assertName(e.name), this.description = e.description, this.specifiedByURL = e.specifiedByURL, this.serialize = e.serialize ?? identityFunc, this.parseValue = O, this.parseLiteral = e.parseLiteral ?? ((e, k) => O(valueFromASTUntyped(e, k))), this.extensions = toObjMap(e.extensions), this.astNode = e.astNode, this.extensionASTNodes = e.extensionASTNodes ?? [], e.specifiedByURL == null || typeof e.specifiedByURL == "string" || devAssert(!1, `${this.name} must provide "specifiedByURL" as a string, but got: ${inspect(e.specifiedByURL)}.`), e.serialize == null || typeof e.serialize == "function" || devAssert(!1, `${this.name} must provide "serialize" function. If this custom Scalar is also used as an input type, ensure "parseValue" and "parseLiteral" functions are also provided.`), e.parseLiteral && (typeof e.parseValue == "function" && typeof e.parseLiteral == "function" || devAssert(!1, `${this.name} must provide both "parseValue" and "parseLiteral" functions.`));
	}
	get [Symbol.toStringTag]() {
		return "GraphQLScalarType";
	}
	toConfig() {
		return {
			name: this.name,
			description: this.description,
			specifiedByURL: this.specifiedByURL,
			serialize: this.serialize,
			parseValue: this.parseValue,
			parseLiteral: this.parseLiteral,
			extensions: this.extensions,
			astNode: this.astNode,
			extensionASTNodes: this.extensionASTNodes
		};
	}
	toString() {
		return this.name;
	}
	toJSON() {
		return this.toString();
	}
}, GraphQLObjectType = class {
	constructor(e) {
		this.name = assertName(e.name), this.description = e.description, this.isTypeOf = e.isTypeOf, this.extensions = toObjMap(e.extensions), this.astNode = e.astNode, this.extensionASTNodes = e.extensionASTNodes ?? [], this._fields = () => defineFieldMap(e), this._interfaces = () => defineInterfaces(e), e.isTypeOf == null || typeof e.isTypeOf == "function" || devAssert(!1, `${this.name} must provide "isTypeOf" as a function, but got: ${inspect(e.isTypeOf)}.`);
	}
	get [Symbol.toStringTag]() {
		return "GraphQLObjectType";
	}
	getFields() {
		return typeof this._fields == "function" && (this._fields = this._fields()), this._fields;
	}
	getInterfaces() {
		return typeof this._interfaces == "function" && (this._interfaces = this._interfaces()), this._interfaces;
	}
	toConfig() {
		return {
			name: this.name,
			description: this.description,
			interfaces: this.getInterfaces(),
			fields: fieldsToFieldsConfig(this.getFields()),
			isTypeOf: this.isTypeOf,
			extensions: this.extensions,
			astNode: this.astNode,
			extensionASTNodes: this.extensionASTNodes
		};
	}
	toString() {
		return this.name;
	}
	toJSON() {
		return this.toString();
	}
};
function defineInterfaces(e) {
	let O = resolveReadonlyArrayThunk(e.interfaces ?? []);
	return Array.isArray(O) || devAssert(!1, `${e.name} interfaces must be an Array or a function which returns an Array.`), O;
}
function defineFieldMap(e) {
	let O = resolveObjMapThunk(e.fields);
	return isPlainObj(O) || devAssert(!1, `${e.name} fields must be an object with field names as keys or a function which returns such an object.`), mapValue(O, (O, k) => {
		isPlainObj(O) || devAssert(!1, `${e.name}.${k} field config must be an object.`), O.resolve == null || typeof O.resolve == "function" || devAssert(!1, `${e.name}.${k} field resolver must be a function if provided, but got: ${inspect(O.resolve)}.`);
		let A = O.args ?? {};
		return isPlainObj(A) || devAssert(!1, `${e.name}.${k} args must be an object with argument names as keys.`), {
			name: assertName(k),
			description: O.description,
			type: O.type,
			args: defineArguments(A),
			resolve: O.resolve,
			subscribe: O.subscribe,
			deprecationReason: O.deprecationReason,
			extensions: toObjMap(O.extensions),
			astNode: O.astNode
		};
	});
}
function defineArguments(e) {
	return Object.entries(e).map(([e, O]) => ({
		name: assertName(e),
		description: O.description,
		type: O.type,
		defaultValue: O.defaultValue,
		deprecationReason: O.deprecationReason,
		extensions: toObjMap(O.extensions),
		astNode: O.astNode
	}));
}
function isPlainObj(e) {
	return isObjectLike(e) && !Array.isArray(e);
}
function fieldsToFieldsConfig(e) {
	return mapValue(e, (e) => ({
		description: e.description,
		type: e.type,
		args: argsToArgsConfig(e.args),
		resolve: e.resolve,
		subscribe: e.subscribe,
		deprecationReason: e.deprecationReason,
		extensions: e.extensions,
		astNode: e.astNode
	}));
}
function argsToArgsConfig(e) {
	return keyValMap(e, (e) => e.name, (e) => ({
		description: e.description,
		type: e.type,
		defaultValue: e.defaultValue,
		deprecationReason: e.deprecationReason,
		extensions: e.extensions,
		astNode: e.astNode
	}));
}
function isRequiredArgument(e) {
	return isNonNullType(e.type) && e.defaultValue === void 0;
}
var GraphQLInterfaceType = class {
	constructor(e) {
		this.name = assertName(e.name), this.description = e.description, this.resolveType = e.resolveType, this.extensions = toObjMap(e.extensions), this.astNode = e.astNode, this.extensionASTNodes = e.extensionASTNodes ?? [], this._fields = defineFieldMap.bind(void 0, e), this._interfaces = defineInterfaces.bind(void 0, e), e.resolveType == null || typeof e.resolveType == "function" || devAssert(!1, `${this.name} must provide "resolveType" as a function, but got: ${inspect(e.resolveType)}.`);
	}
	get [Symbol.toStringTag]() {
		return "GraphQLInterfaceType";
	}
	getFields() {
		return typeof this._fields == "function" && (this._fields = this._fields()), this._fields;
	}
	getInterfaces() {
		return typeof this._interfaces == "function" && (this._interfaces = this._interfaces()), this._interfaces;
	}
	toConfig() {
		return {
			name: this.name,
			description: this.description,
			interfaces: this.getInterfaces(),
			fields: fieldsToFieldsConfig(this.getFields()),
			resolveType: this.resolveType,
			extensions: this.extensions,
			astNode: this.astNode,
			extensionASTNodes: this.extensionASTNodes
		};
	}
	toString() {
		return this.name;
	}
	toJSON() {
		return this.toString();
	}
}, GraphQLUnionType = class {
	constructor(e) {
		this.name = assertName(e.name), this.description = e.description, this.resolveType = e.resolveType, this.extensions = toObjMap(e.extensions), this.astNode = e.astNode, this.extensionASTNodes = e.extensionASTNodes ?? [], this._types = defineTypes.bind(void 0, e), e.resolveType == null || typeof e.resolveType == "function" || devAssert(!1, `${this.name} must provide "resolveType" as a function, but got: ${inspect(e.resolveType)}.`);
	}
	get [Symbol.toStringTag]() {
		return "GraphQLUnionType";
	}
	getTypes() {
		return typeof this._types == "function" && (this._types = this._types()), this._types;
	}
	toConfig() {
		return {
			name: this.name,
			description: this.description,
			types: this.getTypes(),
			resolveType: this.resolveType,
			extensions: this.extensions,
			astNode: this.astNode,
			extensionASTNodes: this.extensionASTNodes
		};
	}
	toString() {
		return this.name;
	}
	toJSON() {
		return this.toString();
	}
};
function defineTypes(e) {
	let O = resolveReadonlyArrayThunk(e.types);
	return Array.isArray(O) || devAssert(!1, `Must provide Array of types or a function which returns such an array for Union ${e.name}.`), O;
}
var GraphQLEnumType = class {
	constructor(e) {
		this.name = assertName(e.name), this.description = e.description, this.extensions = toObjMap(e.extensions), this.astNode = e.astNode, this.extensionASTNodes = e.extensionASTNodes ?? [], this._values = typeof e.values == "function" ? e.values : defineEnumValues(this.name, e.values), this._valueLookup = null, this._nameLookup = null;
	}
	get [Symbol.toStringTag]() {
		return "GraphQLEnumType";
	}
	getValues() {
		return typeof this._values == "function" && (this._values = defineEnumValues(this.name, this._values())), this._values;
	}
	getValue(e) {
		return this._nameLookup === null && (this._nameLookup = keyMap(this.getValues(), (e) => e.name)), this._nameLookup[e];
	}
	serialize(e) {
		this._valueLookup === null && (this._valueLookup = new Map(this.getValues().map((e) => [e.value, e])));
		let O = this._valueLookup.get(e);
		if (O === void 0) throw new GraphQLError(`Enum "${this.name}" cannot represent value: ${inspect(e)}`);
		return O.name;
	}
	parseValue(e) {
		if (typeof e != "string") {
			let O = inspect(e);
			throw new GraphQLError(`Enum "${this.name}" cannot represent non-string value: ${O}.` + didYouMeanEnumValue(this, O));
		}
		let O = this.getValue(e);
		if (O == null) throw new GraphQLError(`Value "${e}" does not exist in "${this.name}" enum.` + didYouMeanEnumValue(this, e));
		return O.value;
	}
	parseLiteral(e, O) {
		if (e.kind !== Kind.ENUM) {
			let O = print(e);
			throw new GraphQLError(`Enum "${this.name}" cannot represent non-enum value: ${O}.` + didYouMeanEnumValue(this, O), { nodes: e });
		}
		let k = this.getValue(e.value);
		if (k == null) {
			let O = print(e);
			throw new GraphQLError(`Value "${O}" does not exist in "${this.name}" enum.` + didYouMeanEnumValue(this, O), { nodes: e });
		}
		return k.value;
	}
	toConfig() {
		let e = keyValMap(this.getValues(), (e) => e.name, (e) => ({
			description: e.description,
			value: e.value,
			deprecationReason: e.deprecationReason,
			extensions: e.extensions,
			astNode: e.astNode
		}));
		return {
			name: this.name,
			description: this.description,
			values: e,
			extensions: this.extensions,
			astNode: this.astNode,
			extensionASTNodes: this.extensionASTNodes
		};
	}
	toString() {
		return this.name;
	}
	toJSON() {
		return this.toString();
	}
};
function didYouMeanEnumValue(e, O) {
	let k = e.getValues().map((e) => e.name), A = suggestionList(O, k);
	return didYouMean("the enum value", A);
}
function defineEnumValues(e, O) {
	return isPlainObj(O) || devAssert(!1, `${e} values must be an object with value names as keys.`), Object.entries(O).map(([O, k]) => (isPlainObj(k) || devAssert(!1, `${e}.${O} must refer to an object with a "value" key representing an internal value but got: ${inspect(k)}.`), {
		name: assertEnumValueName(O),
		description: k.description,
		value: k.value === void 0 ? O : k.value,
		deprecationReason: k.deprecationReason,
		extensions: toObjMap(k.extensions),
		astNode: k.astNode
	}));
}
var GraphQLInputObjectType = class {
	constructor(e) {
		this.name = assertName(e.name), this.description = e.description, this.extensions = toObjMap(e.extensions), this.astNode = e.astNode, this.extensionASTNodes = e.extensionASTNodes ?? [], this.isOneOf = e.isOneOf ?? !1, this._fields = defineInputFieldMap.bind(void 0, e);
	}
	get [Symbol.toStringTag]() {
		return "GraphQLInputObjectType";
	}
	getFields() {
		return typeof this._fields == "function" && (this._fields = this._fields()), this._fields;
	}
	toConfig() {
		let e = mapValue(this.getFields(), (e) => ({
			description: e.description,
			type: e.type,
			defaultValue: e.defaultValue,
			deprecationReason: e.deprecationReason,
			extensions: e.extensions,
			astNode: e.astNode
		}));
		return {
			name: this.name,
			description: this.description,
			fields: e,
			extensions: this.extensions,
			astNode: this.astNode,
			extensionASTNodes: this.extensionASTNodes,
			isOneOf: this.isOneOf
		};
	}
	toString() {
		return this.name;
	}
	toJSON() {
		return this.toString();
	}
};
function defineInputFieldMap(e) {
	let O = resolveObjMapThunk(e.fields);
	return isPlainObj(O) || devAssert(!1, `${e.name} fields must be an object with field names as keys or a function which returns such an object.`), mapValue(O, (O, k) => (!("resolve" in O) || devAssert(!1, `${e.name}.${k} field has a resolve property, but Input Types cannot define resolvers.`), {
		name: assertName(k),
		description: O.description,
		type: O.type,
		defaultValue: O.defaultValue,
		deprecationReason: O.deprecationReason,
		extensions: toObjMap(O.extensions),
		astNode: O.astNode
	}));
}
function isRequiredInputField(e) {
	return isNonNullType(e.type) && e.defaultValue === void 0;
}
const GraphQLInt = new GraphQLScalarType({
	name: "Int",
	description: "The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.",
	serialize(e) {
		let O = serializeObject(e);
		if (typeof O == "boolean") return O ? 1 : 0;
		let k = O;
		if (typeof O == "string" && O !== "" && (k = Number(O)), typeof k != "number" || !Number.isInteger(k)) throw new GraphQLError(`Int cannot represent non-integer value: ${inspect(O)}`);
		if (k > 2147483647 || k < -2147483648) throw new GraphQLError("Int cannot represent non 32-bit signed integer value: " + inspect(O));
		return k;
	},
	parseValue(e) {
		if (typeof e != "number" || !Number.isInteger(e)) throw new GraphQLError(`Int cannot represent non-integer value: ${inspect(e)}`);
		if (e > 2147483647 || e < -2147483648) throw new GraphQLError(`Int cannot represent non 32-bit signed integer value: ${e}`);
		return e;
	},
	parseLiteral(e) {
		if (e.kind !== Kind.INT) throw new GraphQLError(`Int cannot represent non-integer value: ${print(e)}`, { nodes: e });
		let O = parseInt(e.value, 10);
		if (O > 2147483647 || O < -2147483648) throw new GraphQLError(`Int cannot represent non 32-bit signed integer value: ${e.value}`, { nodes: e });
		return O;
	}
}), GraphQLFloat = new GraphQLScalarType({
	name: "Float",
	description: "The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point).",
	serialize(e) {
		let O = serializeObject(e);
		if (typeof O == "boolean") return O ? 1 : 0;
		let k = O;
		if (typeof O == "string" && O !== "" && (k = Number(O)), typeof k != "number" || !Number.isFinite(k)) throw new GraphQLError(`Float cannot represent non numeric value: ${inspect(O)}`);
		return k;
	},
	parseValue(e) {
		if (typeof e != "number" || !Number.isFinite(e)) throw new GraphQLError(`Float cannot represent non numeric value: ${inspect(e)}`);
		return e;
	},
	parseLiteral(e) {
		if (e.kind !== Kind.FLOAT && e.kind !== Kind.INT) throw new GraphQLError(`Float cannot represent non numeric value: ${print(e)}`, e);
		return parseFloat(e.value);
	}
}), GraphQLString = new GraphQLScalarType({
	name: "String",
	description: "The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.",
	serialize(e) {
		let O = serializeObject(e);
		if (typeof O == "string") return O;
		if (typeof O == "boolean") return O ? "true" : "false";
		if (typeof O == "number" && Number.isFinite(O)) return O.toString();
		throw new GraphQLError(`String cannot represent value: ${inspect(e)}`);
	},
	parseValue(e) {
		if (typeof e != "string") throw new GraphQLError(`String cannot represent a non string value: ${inspect(e)}`);
		return e;
	},
	parseLiteral(e) {
		if (e.kind !== Kind.STRING) throw new GraphQLError(`String cannot represent a non string value: ${print(e)}`, { nodes: e });
		return e.value;
	}
}), GraphQLBoolean = new GraphQLScalarType({
	name: "Boolean",
	description: "The `Boolean` scalar type represents `true` or `false`.",
	serialize(e) {
		let O = serializeObject(e);
		if (typeof O == "boolean") return O;
		if (Number.isFinite(O)) return O !== 0;
		throw new GraphQLError(`Boolean cannot represent a non boolean value: ${inspect(O)}`);
	},
	parseValue(e) {
		if (typeof e != "boolean") throw new GraphQLError(`Boolean cannot represent a non boolean value: ${inspect(e)}`);
		return e;
	},
	parseLiteral(e) {
		if (e.kind !== Kind.BOOLEAN) throw new GraphQLError(`Boolean cannot represent a non boolean value: ${print(e)}`, { nodes: e });
		return e.value;
	}
}), GraphQLID = new GraphQLScalarType({
	name: "ID",
	description: "The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `\"4\"`) or integer (such as `4`) input value will be accepted as an ID.",
	serialize(e) {
		let O = serializeObject(e);
		if (typeof O == "string") return O;
		if (Number.isInteger(O)) return String(O);
		throw new GraphQLError(`ID cannot represent value: ${inspect(e)}`);
	},
	parseValue(e) {
		if (typeof e == "string") return e;
		if (typeof e == "number" && Number.isInteger(e)) return e.toString();
		throw new GraphQLError(`ID cannot represent value: ${inspect(e)}`);
	},
	parseLiteral(e) {
		if (e.kind !== Kind.STRING && e.kind !== Kind.INT) throw new GraphQLError("ID cannot represent a non-string and non-integer value: " + print(e), { nodes: e });
		return e.value;
	}
}), specifiedScalarTypes = Object.freeze([
	GraphQLString,
	GraphQLInt,
	GraphQLFloat,
	GraphQLBoolean,
	GraphQLID
]);
function isSpecifiedScalarType(e) {
	return specifiedScalarTypes.some(({ name: O }) => e.name === O);
}
function serializeObject(e) {
	if (isObjectLike(e)) {
		if (typeof e.valueOf == "function") {
			let O = e.valueOf();
			if (!isObjectLike(O)) return O;
		}
		if (typeof e.toJSON == "function") return e.toJSON();
	}
	return e;
}
function isDirective(e) {
	return instanceOf(e, GraphQLDirective);
}
var GraphQLDirective = class {
	constructor(e) {
		this.name = assertName(e.name), this.description = e.description, this.locations = e.locations, this.isRepeatable = e.isRepeatable ?? !1, this.extensions = toObjMap(e.extensions), this.astNode = e.astNode, Array.isArray(e.locations) || devAssert(!1, `@${e.name} locations must be an Array.`);
		let O = e.args ?? {};
		isObjectLike(O) && !Array.isArray(O) || devAssert(!1, `@${e.name} args must be an object with argument names as keys.`), this.args = defineArguments(O);
	}
	get [Symbol.toStringTag]() {
		return "GraphQLDirective";
	}
	toConfig() {
		return {
			name: this.name,
			description: this.description,
			locations: this.locations,
			args: argsToArgsConfig(this.args),
			isRepeatable: this.isRepeatable,
			extensions: this.extensions,
			astNode: this.astNode
		};
	}
	toString() {
		return "@" + this.name;
	}
	toJSON() {
		return this.toString();
	}
};
const GraphQLIncludeDirective = new GraphQLDirective({
	name: "include",
	description: "Directs the executor to include this field or fragment only when the `if` argument is true.",
	locations: [
		DirectiveLocation.FIELD,
		DirectiveLocation.FRAGMENT_SPREAD,
		DirectiveLocation.INLINE_FRAGMENT
	],
	args: { if: {
		type: new GraphQLNonNull(GraphQLBoolean),
		description: "Included when true."
	} }
}), GraphQLSkipDirective = new GraphQLDirective({
	name: "skip",
	description: "Directs the executor to skip this field or fragment when the `if` argument is true.",
	locations: [
		DirectiveLocation.FIELD,
		DirectiveLocation.FRAGMENT_SPREAD,
		DirectiveLocation.INLINE_FRAGMENT
	],
	args: { if: {
		type: new GraphQLNonNull(GraphQLBoolean),
		description: "Skipped when true."
	} }
}), DEFAULT_DEPRECATION_REASON = "No longer supported", GraphQLDeprecatedDirective = new GraphQLDirective({
	name: "deprecated",
	description: "Marks an element of a GraphQL schema as no longer supported.",
	locations: [
		DirectiveLocation.FIELD_DEFINITION,
		DirectiveLocation.ARGUMENT_DEFINITION,
		DirectiveLocation.INPUT_FIELD_DEFINITION,
		DirectiveLocation.ENUM_VALUE
	],
	args: { reason: {
		type: GraphQLString,
		description: "Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/).",
		defaultValue: DEFAULT_DEPRECATION_REASON
	} }
}), GraphQLSpecifiedByDirective = new GraphQLDirective({
	name: "specifiedBy",
	description: "Exposes a URL that specifies the behavior of this scalar.",
	locations: [DirectiveLocation.SCALAR],
	args: { url: {
		type: new GraphQLNonNull(GraphQLString),
		description: "The URL that specifies the behavior of this scalar."
	} }
}), GraphQLOneOfDirective = new GraphQLDirective({
	name: "oneOf",
	description: "Indicates exactly one field must be supplied and this field must not be `null`.",
	locations: [DirectiveLocation.INPUT_OBJECT],
	args: {}
}), specifiedDirectives = Object.freeze([
	GraphQLIncludeDirective,
	GraphQLSkipDirective,
	GraphQLDeprecatedDirective,
	GraphQLSpecifiedByDirective,
	GraphQLOneOfDirective
]);
function isSpecifiedDirective(e) {
	return specifiedDirectives.some(({ name: O }) => O === e.name);
}
function isIterableObject(e) {
	return typeof e == "object" && typeof e?.[Symbol.iterator] == "function";
}
function astFromValue(e, O) {
	if (isNonNullType(O)) {
		let k = astFromValue(e, O.ofType);
		return k?.kind === Kind.NULL ? null : k;
	}
	if (e === null) return { kind: Kind.NULL };
	if (e === void 0) return null;
	if (isListType(O)) {
		let k = O.ofType;
		if (isIterableObject(e)) {
			let O = [];
			for (let A of e) {
				let e = astFromValue(A, k);
				e != null && O.push(e);
			}
			return {
				kind: Kind.LIST,
				values: O
			};
		}
		return astFromValue(e, k);
	}
	if (isInputObjectType(O)) {
		if (!isObjectLike(e)) return null;
		let k = [];
		for (let A of Object.values(O.getFields())) {
			let O = astFromValue(e[A.name], A.type);
			O && k.push({
				kind: Kind.OBJECT_FIELD,
				name: {
					kind: Kind.NAME,
					value: A.name
				},
				value: O
			});
		}
		return {
			kind: Kind.OBJECT,
			fields: k
		};
	}
	if (isLeafType(O)) {
		let k = O.serialize(e);
		if (k == null) return null;
		if (typeof k == "boolean") return {
			kind: Kind.BOOLEAN,
			value: k
		};
		if (typeof k == "number" && Number.isFinite(k)) {
			let e = String(k);
			return integerStringRegExp.test(e) ? {
				kind: Kind.INT,
				value: e
			} : {
				kind: Kind.FLOAT,
				value: e
			};
		}
		if (typeof k == "string") return isEnumType(O) ? {
			kind: Kind.ENUM,
			value: k
		} : O === GraphQLID && integerStringRegExp.test(k) ? {
			kind: Kind.INT,
			value: k
		} : {
			kind: Kind.STRING,
			value: k
		};
		throw TypeError(`Cannot convert value to AST: ${inspect(k)}.`);
	}
	/* c8 ignore next 3 */
	invariant(!1, "Unexpected input type: " + inspect(O));
}
var integerStringRegExp = /^-?(?:0|[1-9][0-9]*)$/;
const __Schema = new GraphQLObjectType({
	name: "__Schema",
	description: "A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.",
	fields: () => ({
		description: {
			type: GraphQLString,
			resolve: (e) => e.description
		},
		types: {
			description: "A list of all types supported by this server.",
			type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(__Type))),
			resolve(e) {
				return Object.values(e.getTypeMap());
			}
		},
		queryType: {
			description: "The type that query operations will be rooted at.",
			type: new GraphQLNonNull(__Type),
			resolve: (e) => e.getQueryType()
		},
		mutationType: {
			description: "If this server supports mutation, the type that mutation operations will be rooted at.",
			type: __Type,
			resolve: (e) => e.getMutationType()
		},
		subscriptionType: {
			description: "If this server support subscription, the type that subscription operations will be rooted at.",
			type: __Type,
			resolve: (e) => e.getSubscriptionType()
		},
		directives: {
			description: "A list of all directives supported by this server.",
			type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(__Directive))),
			resolve: (e) => e.getDirectives()
		}
	})
}), __Directive = new GraphQLObjectType({
	name: "__Directive",
	description: "A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.\n\nIn some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.",
	fields: () => ({
		name: {
			type: new GraphQLNonNull(GraphQLString),
			resolve: (e) => e.name
		},
		description: {
			type: GraphQLString,
			resolve: (e) => e.description
		},
		isRepeatable: {
			type: new GraphQLNonNull(GraphQLBoolean),
			resolve: (e) => e.isRepeatable
		},
		locations: {
			type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(__DirectiveLocation))),
			resolve: (e) => e.locations
		},
		args: {
			type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(__InputValue))),
			args: { includeDeprecated: {
				type: GraphQLBoolean,
				defaultValue: !1
			} },
			resolve(e, { includeDeprecated: O }) {
				return O ? e.args : e.args.filter((e) => e.deprecationReason == null);
			}
		}
	})
}), __DirectiveLocation = new GraphQLEnumType({
	name: "__DirectiveLocation",
	description: "A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.",
	values: {
		QUERY: {
			value: DirectiveLocation.QUERY,
			description: "Location adjacent to a query operation."
		},
		MUTATION: {
			value: DirectiveLocation.MUTATION,
			description: "Location adjacent to a mutation operation."
		},
		SUBSCRIPTION: {
			value: DirectiveLocation.SUBSCRIPTION,
			description: "Location adjacent to a subscription operation."
		},
		FIELD: {
			value: DirectiveLocation.FIELD,
			description: "Location adjacent to a field."
		},
		FRAGMENT_DEFINITION: {
			value: DirectiveLocation.FRAGMENT_DEFINITION,
			description: "Location adjacent to a fragment definition."
		},
		FRAGMENT_SPREAD: {
			value: DirectiveLocation.FRAGMENT_SPREAD,
			description: "Location adjacent to a fragment spread."
		},
		INLINE_FRAGMENT: {
			value: DirectiveLocation.INLINE_FRAGMENT,
			description: "Location adjacent to an inline fragment."
		},
		VARIABLE_DEFINITION: {
			value: DirectiveLocation.VARIABLE_DEFINITION,
			description: "Location adjacent to a variable definition."
		},
		SCHEMA: {
			value: DirectiveLocation.SCHEMA,
			description: "Location adjacent to a schema definition."
		},
		SCALAR: {
			value: DirectiveLocation.SCALAR,
			description: "Location adjacent to a scalar definition."
		},
		OBJECT: {
			value: DirectiveLocation.OBJECT,
			description: "Location adjacent to an object type definition."
		},
		FIELD_DEFINITION: {
			value: DirectiveLocation.FIELD_DEFINITION,
			description: "Location adjacent to a field definition."
		},
		ARGUMENT_DEFINITION: {
			value: DirectiveLocation.ARGUMENT_DEFINITION,
			description: "Location adjacent to an argument definition."
		},
		INTERFACE: {
			value: DirectiveLocation.INTERFACE,
			description: "Location adjacent to an interface definition."
		},
		UNION: {
			value: DirectiveLocation.UNION,
			description: "Location adjacent to a union definition."
		},
		ENUM: {
			value: DirectiveLocation.ENUM,
			description: "Location adjacent to an enum definition."
		},
		ENUM_VALUE: {
			value: DirectiveLocation.ENUM_VALUE,
			description: "Location adjacent to an enum value definition."
		},
		INPUT_OBJECT: {
			value: DirectiveLocation.INPUT_OBJECT,
			description: "Location adjacent to an input object type definition."
		},
		INPUT_FIELD_DEFINITION: {
			value: DirectiveLocation.INPUT_FIELD_DEFINITION,
			description: "Location adjacent to an input object field definition."
		}
	}
}), __Type = new GraphQLObjectType({
	name: "__Type",
	description: "The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name, description and optional `specifiedByURL`, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.",
	fields: () => ({
		kind: {
			type: new GraphQLNonNull(__TypeKind),
			resolve(e) {
				if (isScalarType(e)) return TypeKind.SCALAR;
				if (isObjectType(e)) return TypeKind.OBJECT;
				if (isInterfaceType(e)) return TypeKind.INTERFACE;
				if (isUnionType(e)) return TypeKind.UNION;
				if (isEnumType(e)) return TypeKind.ENUM;
				if (isInputObjectType(e)) return TypeKind.INPUT_OBJECT;
				if (isListType(e)) return TypeKind.LIST;
				if (isNonNullType(e)) return TypeKind.NON_NULL;
				/* c8 ignore next 3 */
				invariant(!1, `Unexpected type: "${inspect(e)}".`);
			}
		},
		name: {
			type: GraphQLString,
			resolve: (e) => "name" in e ? e.name : void 0
		},
		description: {
			type: GraphQLString,
			resolve: (e) => "description" in e ? e.description : void 0
		},
		specifiedByURL: {
			type: GraphQLString,
			resolve: (e) => "specifiedByURL" in e ? e.specifiedByURL : void 0
		},
		fields: {
			type: new GraphQLList(new GraphQLNonNull(__Field)),
			args: { includeDeprecated: {
				type: GraphQLBoolean,
				defaultValue: !1
			} },
			resolve(e, { includeDeprecated: O }) {
				if (isObjectType(e) || isInterfaceType(e)) {
					let k = Object.values(e.getFields());
					return O ? k : k.filter((e) => e.deprecationReason == null);
				}
			}
		},
		interfaces: {
			type: new GraphQLList(new GraphQLNonNull(__Type)),
			resolve(e) {
				if (isObjectType(e) || isInterfaceType(e)) return e.getInterfaces();
			}
		},
		possibleTypes: {
			type: new GraphQLList(new GraphQLNonNull(__Type)),
			resolve(e, O, k, { schema: A }) {
				if (isAbstractType(e)) return A.getPossibleTypes(e);
			}
		},
		enumValues: {
			type: new GraphQLList(new GraphQLNonNull(__EnumValue)),
			args: { includeDeprecated: {
				type: GraphQLBoolean,
				defaultValue: !1
			} },
			resolve(e, { includeDeprecated: O }) {
				if (isEnumType(e)) {
					let k = e.getValues();
					return O ? k : k.filter((e) => e.deprecationReason == null);
				}
			}
		},
		inputFields: {
			type: new GraphQLList(new GraphQLNonNull(__InputValue)),
			args: { includeDeprecated: {
				type: GraphQLBoolean,
				defaultValue: !1
			} },
			resolve(e, { includeDeprecated: O }) {
				if (isInputObjectType(e)) {
					let k = Object.values(e.getFields());
					return O ? k : k.filter((e) => e.deprecationReason == null);
				}
			}
		},
		ofType: {
			type: __Type,
			resolve: (e) => "ofType" in e ? e.ofType : void 0
		},
		isOneOf: {
			type: GraphQLBoolean,
			resolve: (e) => {
				if (isInputObjectType(e)) return e.isOneOf;
			}
		}
	})
}), __Field = new GraphQLObjectType({
	name: "__Field",
	description: "Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.",
	fields: () => ({
		name: {
			type: new GraphQLNonNull(GraphQLString),
			resolve: (e) => e.name
		},
		description: {
			type: GraphQLString,
			resolve: (e) => e.description
		},
		args: {
			type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(__InputValue))),
			args: { includeDeprecated: {
				type: GraphQLBoolean,
				defaultValue: !1
			} },
			resolve(e, { includeDeprecated: O }) {
				return O ? e.args : e.args.filter((e) => e.deprecationReason == null);
			}
		},
		type: {
			type: new GraphQLNonNull(__Type),
			resolve: (e) => e.type
		},
		isDeprecated: {
			type: new GraphQLNonNull(GraphQLBoolean),
			resolve: (e) => e.deprecationReason != null
		},
		deprecationReason: {
			type: GraphQLString,
			resolve: (e) => e.deprecationReason
		}
	})
}), __InputValue = new GraphQLObjectType({
	name: "__InputValue",
	description: "Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.",
	fields: () => ({
		name: {
			type: new GraphQLNonNull(GraphQLString),
			resolve: (e) => e.name
		},
		description: {
			type: GraphQLString,
			resolve: (e) => e.description
		},
		type: {
			type: new GraphQLNonNull(__Type),
			resolve: (e) => e.type
		},
		defaultValue: {
			type: GraphQLString,
			description: "A GraphQL-formatted string representing the default value for this input value.",
			resolve(e) {
				let { type: O, defaultValue: k } = e, A = astFromValue(k, O);
				return A ? print(A) : null;
			}
		},
		isDeprecated: {
			type: new GraphQLNonNull(GraphQLBoolean),
			resolve: (e) => e.deprecationReason != null
		},
		deprecationReason: {
			type: GraphQLString,
			resolve: (e) => e.deprecationReason
		}
	})
}), __EnumValue = new GraphQLObjectType({
	name: "__EnumValue",
	description: "One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.",
	fields: () => ({
		name: {
			type: new GraphQLNonNull(GraphQLString),
			resolve: (e) => e.name
		},
		description: {
			type: GraphQLString,
			resolve: (e) => e.description
		},
		isDeprecated: {
			type: new GraphQLNonNull(GraphQLBoolean),
			resolve: (e) => e.deprecationReason != null
		},
		deprecationReason: {
			type: GraphQLString,
			resolve: (e) => e.deprecationReason
		}
	})
});
var TypeKind;
(function(e) {
	e.SCALAR = "SCALAR", e.OBJECT = "OBJECT", e.INTERFACE = "INTERFACE", e.UNION = "UNION", e.ENUM = "ENUM", e.INPUT_OBJECT = "INPUT_OBJECT", e.LIST = "LIST", e.NON_NULL = "NON_NULL";
})(TypeKind ||= {});
const __TypeKind = new GraphQLEnumType({
	name: "__TypeKind",
	description: "An enum describing what kind of type a given `__Type` is.",
	values: {
		SCALAR: {
			value: TypeKind.SCALAR,
			description: "Indicates this type is a scalar."
		},
		OBJECT: {
			value: TypeKind.OBJECT,
			description: "Indicates this type is an object. `fields` and `interfaces` are valid fields."
		},
		INTERFACE: {
			value: TypeKind.INTERFACE,
			description: "Indicates this type is an interface. `fields`, `interfaces`, and `possibleTypes` are valid fields."
		},
		UNION: {
			value: TypeKind.UNION,
			description: "Indicates this type is a union. `possibleTypes` is a valid field."
		},
		ENUM: {
			value: TypeKind.ENUM,
			description: "Indicates this type is an enum. `enumValues` is a valid field."
		},
		INPUT_OBJECT: {
			value: TypeKind.INPUT_OBJECT,
			description: "Indicates this type is an input object. `inputFields` is a valid field."
		},
		LIST: {
			value: TypeKind.LIST,
			description: "Indicates this type is a list. `ofType` is a valid field."
		},
		NON_NULL: {
			value: TypeKind.NON_NULL,
			description: "Indicates this type is a non-null. `ofType` is a valid field."
		}
	}
}), SchemaMetaFieldDef = {
	name: "__schema",
	type: new GraphQLNonNull(__Schema),
	description: "Access the current type schema of this server.",
	args: [],
	resolve: (e, O, k, { schema: A }) => A,
	deprecationReason: void 0,
	extensions: Object.create(null),
	astNode: void 0
}, TypeMetaFieldDef = {
	name: "__type",
	type: __Type,
	description: "Request the type information of a single type.",
	args: [{
		name: "name",
		description: void 0,
		type: new GraphQLNonNull(GraphQLString),
		defaultValue: void 0,
		deprecationReason: void 0,
		extensions: Object.create(null),
		astNode: void 0
	}],
	resolve: (e, { name: O }, k, { schema: A }) => A.getType(O),
	deprecationReason: void 0,
	extensions: Object.create(null),
	astNode: void 0
}, TypeNameMetaFieldDef = {
	name: "__typename",
	type: new GraphQLNonNull(GraphQLString),
	description: "The name of the current Object type at runtime.",
	args: [],
	resolve: (e, O, k, { parentType: A }) => A.name,
	deprecationReason: void 0,
	extensions: Object.create(null),
	astNode: void 0
}, introspectionTypes = Object.freeze([
	__Schema,
	__Directive,
	__DirectiveLocation,
	__Type,
	__Field,
	__InputValue,
	__EnumValue,
	__TypeKind
]);
function isIntrospectionType(e) {
	return introspectionTypes.some(({ name: O }) => e.name === O);
}
var GraphQLSchema = class {
	constructor(e) {
		this.__validationErrors = e.assumeValid === !0 ? [] : void 0, isObjectLike(e) || devAssert(!1, "Must provide configuration object."), !e.types || Array.isArray(e.types) || devAssert(!1, `"types" must be Array if provided but got: ${inspect(e.types)}.`), !e.directives || Array.isArray(e.directives) || devAssert(!1, `"directives" must be Array if provided but got: ${inspect(e.directives)}.`), this.description = e.description, this.extensions = toObjMap(e.extensions), this.astNode = e.astNode, this.extensionASTNodes = e.extensionASTNodes ?? [], this._queryType = e.query, this._mutationType = e.mutation, this._subscriptionType = e.subscription, this._directives = e.directives ?? specifiedDirectives;
		let O = new Set(e.types);
		if (e.types != null) for (let k of e.types) O.delete(k), collectReferencedTypes(k, O);
		this._queryType != null && collectReferencedTypes(this._queryType, O), this._mutationType != null && collectReferencedTypes(this._mutationType, O), this._subscriptionType != null && collectReferencedTypes(this._subscriptionType, O);
		for (let e of this._directives) if (isDirective(e)) for (let k of e.args) collectReferencedTypes(k.type, O);
		collectReferencedTypes(__Schema, O), this._typeMap = Object.create(null), this._subTypeMap = Object.create(null), this._implementationsMap = Object.create(null);
		for (let e of O) {
			if (e == null) continue;
			let O = e.name;
			if (O || devAssert(!1, "One of the provided types for building the Schema is missing a name."), this._typeMap[O] !== void 0) throw Error(`Schema must contain uniquely named types but contains multiple types named "${O}".`);
			if (this._typeMap[O] = e, isInterfaceType(e)) {
				for (let O of e.getInterfaces()) if (isInterfaceType(O)) {
					let k = this._implementationsMap[O.name];
					k === void 0 && (k = this._implementationsMap[O.name] = {
						objects: [],
						interfaces: []
					}), k.interfaces.push(e);
				}
			} else if (isObjectType(e)) {
				for (let O of e.getInterfaces()) if (isInterfaceType(O)) {
					let k = this._implementationsMap[O.name];
					k === void 0 && (k = this._implementationsMap[O.name] = {
						objects: [],
						interfaces: []
					}), k.objects.push(e);
				}
			}
		}
	}
	get [Symbol.toStringTag]() {
		return "GraphQLSchema";
	}
	getQueryType() {
		return this._queryType;
	}
	getMutationType() {
		return this._mutationType;
	}
	getSubscriptionType() {
		return this._subscriptionType;
	}
	getRootType(e) {
		switch (e) {
			case OperationTypeNode.QUERY: return this.getQueryType();
			case OperationTypeNode.MUTATION: return this.getMutationType();
			case OperationTypeNode.SUBSCRIPTION: return this.getSubscriptionType();
		}
	}
	getTypeMap() {
		return this._typeMap;
	}
	getType(e) {
		return this.getTypeMap()[e];
	}
	getPossibleTypes(e) {
		return isUnionType(e) ? e.getTypes() : this.getImplementations(e).objects;
	}
	getImplementations(e) {
		return this._implementationsMap[e.name] ?? {
			objects: [],
			interfaces: []
		};
	}
	isSubType(e, O) {
		let k = this._subTypeMap[e.name];
		if (k === void 0) {
			if (k = Object.create(null), isUnionType(e)) for (let O of e.getTypes()) k[O.name] = !0;
			else {
				let O = this.getImplementations(e);
				for (let e of O.objects) k[e.name] = !0;
				for (let e of O.interfaces) k[e.name] = !0;
			}
			this._subTypeMap[e.name] = k;
		}
		return k[O.name] !== void 0;
	}
	getDirectives() {
		return this._directives;
	}
	getDirective(e) {
		return this.getDirectives().find((O) => O.name === e);
	}
	toConfig() {
		return {
			description: this.description,
			query: this.getQueryType(),
			mutation: this.getMutationType(),
			subscription: this.getSubscriptionType(),
			types: Object.values(this.getTypeMap()),
			directives: this.getDirectives(),
			extensions: this.extensions,
			astNode: this.astNode,
			extensionASTNodes: this.extensionASTNodes,
			assumeValid: this.__validationErrors !== void 0
		};
	}
};
function collectReferencedTypes(e, O) {
	let k = getNamedType(e);
	if (!O.has(k)) {
		if (O.add(k), isUnionType(k)) for (let e of k.getTypes()) collectReferencedTypes(e, O);
		else if (isObjectType(k) || isInterfaceType(k)) {
			for (let e of k.getInterfaces()) collectReferencedTypes(e, O);
			for (let e of Object.values(k.getFields())) {
				collectReferencedTypes(e.type, O);
				for (let k of e.args) collectReferencedTypes(k.type, O);
			}
		} else if (isInputObjectType(k)) for (let e of Object.values(k.getFields())) collectReferencedTypes(e.type, O);
	}
	return O;
}
function valueFromAST(e, O, k) {
	if (e) {
		if (e.kind === Kind.VARIABLE) {
			let A = e.name.value;
			if (k == null || k[A] === void 0) return;
			let j = k[A];
			return j === null && isNonNullType(O) ? void 0 : j;
		}
		if (isNonNullType(O)) return e.kind === Kind.NULL ? void 0 : valueFromAST(e, O.ofType, k);
		if (e.kind === Kind.NULL) return null;
		if (isListType(O)) {
			let A = O.ofType;
			if (e.kind === Kind.LIST) {
				let O = [];
				for (let j of e.values) if (isMissingVariable(j, k)) {
					if (isNonNullType(A)) return;
					O.push(null);
				} else {
					let e = valueFromAST(j, A, k);
					if (e === void 0) return;
					O.push(e);
				}
				return O;
			}
			let j = valueFromAST(e, A, k);
			return j === void 0 ? void 0 : [j];
		}
		if (isInputObjectType(O)) {
			if (e.kind !== Kind.OBJECT) return;
			let A = Object.create(null), j = keyMap(e.fields, (e) => e.name.value);
			for (let e of Object.values(O.getFields())) {
				let O = j[e.name];
				if (!O || isMissingVariable(O.value, k)) {
					if (e.defaultValue !== void 0) A[e.name] = e.defaultValue;
					else if (isNonNullType(e.type)) return;
					continue;
				}
				let M = valueFromAST(O.value, e.type, k);
				if (M === void 0) return;
				A[e.name] = M;
			}
			if (O.isOneOf) {
				let e = Object.keys(A);
				if (e.length !== 1 || A[e[0]] === null) return;
			}
			return A;
		}
		if (isLeafType(O)) {
			let A;
			try {
				A = O.parseLiteral(e, k);
			} catch {
				return;
			}
			return A === void 0 ? void 0 : A;
		}
		/* c8 ignore next 3 */
		invariant(!1, "Unexpected input type: " + inspect(O));
	}
}
function isMissingVariable(e, O) {
	return e.kind === Kind.VARIABLE && (O == null || O[e.name.value] === void 0);
}
/*!-----------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
* Released under the MIT license
* https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
*-----------------------------------------------------------------------------*/
var __defProp = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __getOwnPropNames = Object.getOwnPropertyNames, __hasOwnProp = Object.prototype.hasOwnProperty, __copyProps = (e, O, k, A) => {
	if (O && typeof O == "object" || typeof O == "function") for (let j of __getOwnPropNames(O)) !__hasOwnProp.call(e, j) && j !== k && __defProp(e, j, {
		get: () => O[j],
		enumerable: !(A = __getOwnPropDesc(O, j)) || A.enumerable
	});
	return e;
}, __reExport = (e, O, k) => (__copyProps(e, O, "default"), k && __copyProps(k, O, "default")), monaco_editor_core_exports = {};
__reExport(monaco_editor_core_exports, editor_api_exports);
var languageDefinitions = {}, lazyLanguageLoaders = {}, LazyLanguageLoader = class e {
	static getOrCreate(O) {
		return lazyLanguageLoaders[O] || (lazyLanguageLoaders[O] = new e(O)), lazyLanguageLoaders[O];
	}
	constructor(e) {
		this._languageId = e, this._loadingTriggered = !1, this._lazyLoadPromise = new Promise((e, O) => {
			this._lazyLoadPromiseResolve = e, this._lazyLoadPromiseReject = O;
		});
	}
	load() {
		return this._loadingTriggered || (this._loadingTriggered = !0, languageDefinitions[this._languageId].loader().then((e) => this._lazyLoadPromiseResolve(e), (e) => this._lazyLoadPromiseReject(e))), this._lazyLoadPromise;
	}
};
function registerLanguage(e) {
	let O = e.id;
	languageDefinitions[O] = e, monaco_editor_core_exports.languages.register(e);
	let k = LazyLanguageLoader.getOrCreate(O);
	monaco_editor_core_exports.languages.registerTokensProviderFactory(O, { create: async () => (await k.load()).language }), monaco_editor_core_exports.languages.onLanguageEncountered(O, async () => {
		let e = await k.load();
		monaco_editor_core_exports.languages.setLanguageConfiguration(O, e.conf);
	});
}
registerLanguage({
	id: "graphql",
	extensions: [".graphql", ".gql"],
	aliases: [
		"GraphQL",
		"graphql",
		"gql"
	],
	mimetypes: ["application/graphql"],
	loader: () => import("./graphql-CFvHDT0S.js")
});
var ToggleCollapseUnchangedRegions = class extends Action2 {
	constructor() {
		super({
			id: "diffEditor.toggleCollapseUnchangedRegions",
			title: localize2("toggleCollapseUnchangedRegions", "Toggle Collapse Unchanged Regions"),
			icon: Codicon.map,
			toggled: ContextKeyExpr.has("config.diffEditor.hideUnchangedRegions.enabled"),
			precondition: ContextKeyExpr.has("isInDiffEditor"),
			menu: {
				when: ContextKeyExpr.has("isInDiffEditor"),
				id: MenuId.EditorTitle,
				order: 22,
				group: "navigation"
			}
		});
	}
	run(e, ...O) {
		let k = e.get(IConfigurationService), A = !k.getValue("diffEditor.hideUnchangedRegions.enabled");
		k.updateValue("diffEditor.hideUnchangedRegions.enabled", A);
	}
}, ToggleShowMovedCodeBlocks = class extends Action2 {
	constructor() {
		super({
			id: "diffEditor.toggleShowMovedCodeBlocks",
			title: localize2("toggleShowMovedCodeBlocks", "Toggle Show Moved Code Blocks"),
			precondition: ContextKeyExpr.has("isInDiffEditor")
		});
	}
	run(e, ...O) {
		let k = e.get(IConfigurationService), A = !k.getValue("diffEditor.experimental.showMoves");
		k.updateValue("diffEditor.experimental.showMoves", A);
	}
}, ToggleUseInlineViewWhenSpaceIsLimited = class extends Action2 {
	constructor() {
		super({
			id: "diffEditor.toggleUseInlineViewWhenSpaceIsLimited",
			title: localize2("toggleUseInlineViewWhenSpaceIsLimited", "Toggle Use Inline View When Space Is Limited"),
			precondition: ContextKeyExpr.has("isInDiffEditor")
		});
	}
	run(e, ...O) {
		let k = e.get(IConfigurationService), A = !k.getValue("diffEditor.useInlineViewWhenSpaceIsLimited");
		k.updateValue("diffEditor.useInlineViewWhenSpaceIsLimited", A);
	}
}, diffEditorCategory = localize2("diffEditor", "Diff Editor"), SwitchSide = class extends EditorAction2 {
	constructor() {
		super({
			id: "diffEditor.switchSide",
			title: localize2("switchSide", "Switch Side"),
			icon: Codicon.arrowSwap,
			precondition: ContextKeyExpr.has("isInDiffEditor"),
			f1: !0,
			category: diffEditorCategory
		});
	}
	runEditorCommand(e, O, k) {
		let A = findFocusedDiffEditor(e);
		if (A instanceof DiffEditorWidget) {
			if (k && k.dryRun) return { destinationSelection: A.mapToOtherSide().destinationSelection };
			A.switchSide();
		}
	}
}, ExitCompareMove = class extends EditorAction2 {
	constructor() {
		super({
			id: "diffEditor.exitCompareMove",
			title: localize2("exitCompareMove", "Exit Compare Move"),
			icon: Codicon.close,
			precondition: EditorContextKeys.comparingMovedCode,
			f1: !1,
			category: diffEditorCategory,
			keybinding: {
				weight: 1e4,
				primary: 9
			}
		});
	}
	runEditorCommand(e, O, ...k) {
		let A = findFocusedDiffEditor(e);
		A instanceof DiffEditorWidget && A.exitCompareMove();
	}
}, CollapseAllUnchangedRegions = class extends EditorAction2 {
	constructor() {
		super({
			id: "diffEditor.collapseAllUnchangedRegions",
			title: localize2("collapseAllUnchangedRegions", "Collapse All Unchanged Regions"),
			icon: Codicon.fold,
			precondition: ContextKeyExpr.has("isInDiffEditor"),
			f1: !0,
			category: diffEditorCategory
		});
	}
	runEditorCommand(e, O, ...k) {
		let A = findFocusedDiffEditor(e);
		A instanceof DiffEditorWidget && A.collapseAllUnchangedRegions();
	}
}, ShowAllUnchangedRegions = class extends EditorAction2 {
	constructor() {
		super({
			id: "diffEditor.showAllUnchangedRegions",
			title: localize2("showAllUnchangedRegions", "Show All Unchanged Regions"),
			icon: Codicon.unfold,
			precondition: ContextKeyExpr.has("isInDiffEditor"),
			f1: !0,
			category: diffEditorCategory
		});
	}
	runEditorCommand(e, O, ...k) {
		let A = findFocusedDiffEditor(e);
		A instanceof DiffEditorWidget && A.showAllUnchangedRegions();
	}
}, RevertHunkOrSelection = class extends Action2 {
	constructor() {
		super({
			id: "diffEditor.revert",
			title: localize2("revert", "Revert"),
			f1: !1,
			category: diffEditorCategory
		});
	}
	run(e, O) {
		let k = findDiffEditor(e, O.originalUri, O.modifiedUri);
		k instanceof DiffEditorWidget && k.revertRangeMappings(O.mapping.innerChanges ?? []);
	}
}, accessibleDiffViewerCategory = localize2("accessibleDiffViewer", "Accessible Diff Viewer"), AccessibleDiffViewerNext = class e extends Action2 {
	static {
		this.id = "editor.action.accessibleDiffViewer.next";
	}
	constructor() {
		super({
			id: e.id,
			title: localize2("editor.action.accessibleDiffViewer.next", "Go to Next Difference"),
			category: accessibleDiffViewerCategory,
			precondition: ContextKeyExpr.has("isInDiffEditor"),
			keybinding: {
				primary: 65,
				weight: 100
			},
			f1: !0
		});
	}
	run(e) {
		findFocusedDiffEditor(e)?.accessibleDiffViewerNext();
	}
}, AccessibleDiffViewerPrev = class e extends Action2 {
	static {
		this.id = "editor.action.accessibleDiffViewer.prev";
	}
	constructor() {
		super({
			id: e.id,
			title: localize2("editor.action.accessibleDiffViewer.prev", "Go to Previous Difference"),
			category: accessibleDiffViewerCategory,
			precondition: ContextKeyExpr.has("isInDiffEditor"),
			keybinding: {
				primary: 1089,
				weight: 100
			},
			f1: !0
		});
	}
	run(e) {
		findFocusedDiffEditor(e)?.accessibleDiffViewerPrev();
	}
};
function findDiffEditor(e, O, k) {
	return e.get(ICodeEditorService).listDiffEditors().find((e) => {
		let A = e.getModifiedEditor(), j = e.getOriginalEditor();
		return A && A.getModel()?.uri.toString() === k.toString() && j && j.getModel()?.uri.toString() === O.toString();
	}) || null;
}
function findFocusedDiffEditor(e) {
	let O = e.get(ICodeEditorService).listDiffEditors(), k = getActiveElement();
	if (k) for (let e of O) {
		let O = e.getContainerDomNode();
		if (isElementOrParentOf(O, k)) return e;
	}
	return null;
}
function isElementOrParentOf(e, O) {
	let k = O;
	for (; k;) {
		if (k === e) return !0;
		k = k.parentElement;
	}
	return !1;
}
registerAction2(ToggleCollapseUnchangedRegions), registerAction2(ToggleShowMovedCodeBlocks), registerAction2(ToggleUseInlineViewWhenSpaceIsLimited), MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
	command: {
		id: new ToggleUseInlineViewWhenSpaceIsLimited().desc.id,
		title: localize("useInlineViewWhenSpaceIsLimited", "Use Inline View When Space Is Limited"),
		toggled: ContextKeyExpr.has("config.diffEditor.useInlineViewWhenSpaceIsLimited"),
		precondition: ContextKeyExpr.has("isInDiffEditor")
	},
	order: 11,
	group: "1_diff",
	when: ContextKeyExpr.and(EditorContextKeys.diffEditorRenderSideBySideInlineBreakpointReached, ContextKeyExpr.has("isInDiffEditor"))
}), MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
	command: {
		id: new ToggleShowMovedCodeBlocks().desc.id,
		title: localize("showMoves", "Show Moved Code Blocks"),
		icon: Codicon.move,
		toggled: ContextKeyEqualsExpr.create("config.diffEditor.experimental.showMoves", !0),
		precondition: ContextKeyExpr.has("isInDiffEditor")
	},
	order: 10,
	group: "1_diff",
	when: ContextKeyExpr.has("isInDiffEditor")
}), registerAction2(RevertHunkOrSelection);
for (let e of [{
	icon: Codicon.arrowRight,
	key: EditorContextKeys.diffEditorInlineMode.toNegated()
}, {
	icon: Codicon.discard,
	key: EditorContextKeys.diffEditorInlineMode
}]) MenuRegistry.appendMenuItem(MenuId.DiffEditorHunkToolbar, {
	command: {
		id: new RevertHunkOrSelection().desc.id,
		title: localize("revertHunk", "Revert Block"),
		icon: e.icon
	},
	when: ContextKeyExpr.and(EditorContextKeys.diffEditorModifiedWritable, e.key),
	order: 5,
	group: "primary"
}), MenuRegistry.appendMenuItem(MenuId.DiffEditorSelectionToolbar, {
	command: {
		id: new RevertHunkOrSelection().desc.id,
		title: localize("revertSelection", "Revert Selection"),
		icon: e.icon
	},
	when: ContextKeyExpr.and(EditorContextKeys.diffEditorModifiedWritable, e.key),
	order: 5,
	group: "primary"
});
registerAction2(SwitchSide), registerAction2(ExitCompareMove), registerAction2(CollapseAllUnchangedRegions), registerAction2(ShowAllUnchangedRegions), MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
	command: {
		id: AccessibleDiffViewerNext.id,
		title: localize("Open Accessible Diff Viewer", "Open Accessible Diff Viewer"),
		precondition: ContextKeyExpr.has("isInDiffEditor")
	},
	order: 10,
	group: "2_diff",
	when: ContextKeyExpr.and(EditorContextKeys.accessibleDiffViewerVisible.negate(), ContextKeyExpr.has("isInDiffEditor"))
}), CommandsRegistry.registerCommandAlias("editor.action.diffReview.next", AccessibleDiffViewerNext.id), registerAction2(AccessibleDiffViewerNext), CommandsRegistry.registerCommandAlias("editor.action.diffReview.prev", AccessibleDiffViewerPrev.id), registerAction2(AccessibleDiffViewerPrev);
var __decorate$102 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$102 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, SelectionAnchorController_1;
const SelectionAnchorSet = new RawContextKey("selectionAnchorSet", !1);
var SelectionAnchorController = class {
	static {
		SelectionAnchorController_1 = this;
	}
	static {
		this.ID = "editor.contrib.selectionAnchorController";
	}
	static get(e) {
		return e.getContribution(SelectionAnchorController_1.ID);
	}
	constructor(e, O) {
		this.editor = e, this.selectionAnchorSetContextKey = SelectionAnchorSet.bindTo(O), this.modelChangeListener = e.onDidChangeModel(() => this.selectionAnchorSetContextKey.reset());
	}
	setSelectionAnchor() {
		if (this.editor.hasModel()) {
			let e = this.editor.getPosition();
			this.editor.changeDecorations((O) => {
				this.decorationId && O.removeDecoration(this.decorationId), this.decorationId = O.addDecoration(Selection.fromPositions(e, e), {
					description: "selection-anchor",
					stickiness: 1,
					hoverMessage: new MarkdownString().appendText(localize("selectionAnchor", "Selection Anchor")),
					className: "selection-anchor"
				});
			}), this.selectionAnchorSetContextKey.set(!!this.decorationId), alert(localize("anchorSet", "Anchor set at {0}:{1}", e.lineNumber, e.column));
		}
	}
	goToSelectionAnchor() {
		if (this.editor.hasModel() && this.decorationId) {
			let e = this.editor.getModel().getDecorationRange(this.decorationId);
			e && this.editor.setPosition(e.getStartPosition());
		}
	}
	selectFromAnchorToCursor() {
		if (this.editor.hasModel() && this.decorationId) {
			let e = this.editor.getModel().getDecorationRange(this.decorationId);
			if (e) {
				let O = this.editor.getPosition();
				this.editor.setSelection(Selection.fromPositions(e.getStartPosition(), O)), this.cancelSelectionAnchor();
			}
		}
	}
	cancelSelectionAnchor() {
		if (this.decorationId) {
			let e = this.decorationId;
			this.editor.changeDecorations((O) => {
				O.removeDecoration(e), this.decorationId = void 0;
			}), this.selectionAnchorSetContextKey.set(!1);
		}
	}
	dispose() {
		this.cancelSelectionAnchor(), this.modelChangeListener.dispose();
	}
};
SelectionAnchorController = SelectionAnchorController_1 = __decorate$102([__param$102(1, IContextKeyService)], SelectionAnchorController);
var SetSelectionAnchor = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.setSelectionAnchor",
			label: localize("setSelectionAnchor", "Set Selection Anchor"),
			alias: "Set Selection Anchor",
			precondition: void 0,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: KeyChord(2089, 2080),
				weight: 100
			}
		});
	}
	async run(e, O) {
		SelectionAnchorController.get(O)?.setSelectionAnchor();
	}
}, GoToSelectionAnchor = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.goToSelectionAnchor",
			label: localize("goToSelectionAnchor", "Go to Selection Anchor"),
			alias: "Go to Selection Anchor",
			precondition: SelectionAnchorSet
		});
	}
	async run(e, O) {
		SelectionAnchorController.get(O)?.goToSelectionAnchor();
	}
}, SelectFromAnchorToCursor = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.selectFromAnchorToCursor",
			label: localize("selectFromAnchorToCursor", "Select from Anchor to Cursor"),
			alias: "Select from Anchor to Cursor",
			precondition: SelectionAnchorSet,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: KeyChord(2089, 2089),
				weight: 100
			}
		});
	}
	async run(e, O) {
		SelectionAnchorController.get(O)?.selectFromAnchorToCursor();
	}
}, CancelSelectionAnchor = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.cancelSelectionAnchor",
			label: localize("cancelSelectionAnchor", "Cancel Selection Anchor"),
			alias: "Cancel Selection Anchor",
			precondition: SelectionAnchorSet,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: 9,
				weight: 100
			}
		});
	}
	async run(e, O) {
		SelectionAnchorController.get(O)?.cancelSelectionAnchor();
	}
};
registerEditorContribution(SelectionAnchorController.ID, SelectionAnchorController, 4), registerEditorAction(SetSelectionAnchor), registerEditorAction(GoToSelectionAnchor), registerEditorAction(SelectFromAnchorToCursor), registerEditorAction(CancelSelectionAnchor);
var overviewRulerBracketMatchForeground = registerColor("editorOverviewRuler.bracketMatchForeground", "#A0A0A0", localize("overviewRulerBracketMatchForeground", "Overview ruler marker color for matching brackets.")), JumpToBracketAction = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.jumpToBracket",
			label: localize("smartSelect.jumpBracket", "Go to Bracket"),
			alias: "Go to Bracket",
			precondition: void 0,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: 3165,
				weight: 100
			}
		});
	}
	run(e, O) {
		BracketMatchingController.get(O)?.jumpToBracket();
	}
}, SelectToBracketAction = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.selectToBracket",
			label: localize("smartSelect.selectToBracket", "Select to Bracket"),
			alias: "Select to Bracket",
			precondition: void 0,
			metadata: {
				description: localize2("smartSelect.selectToBracketDescription", "Select the text inside and including the brackets or curly braces"),
				args: [{
					name: "args",
					schema: {
						type: "object",
						properties: { selectBrackets: {
							type: "boolean",
							default: !0
						} }
					}
				}]
			}
		});
	}
	run(e, O, k) {
		let A = !0;
		k && k.selectBrackets === !1 && (A = !1), BracketMatchingController.get(O)?.selectToBracket(A);
	}
}, RemoveBracketsAction = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.removeBrackets",
			label: localize("smartSelect.removeBrackets", "Remove Brackets"),
			alias: "Remove Brackets",
			precondition: void 0,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: 2561,
				weight: 100
			}
		});
	}
	run(e, O) {
		BracketMatchingController.get(O)?.removeBrackets(this.id);
	}
}, BracketsData = class {
	constructor(e, O, k) {
		this.position = e, this.brackets = O, this.options = k;
	}
}, BracketMatchingController = class e extends Disposable {
	static {
		this.ID = "editor.contrib.bracketMatchingController";
	}
	static get(O) {
		return O.getContribution(e.ID);
	}
	constructor(e) {
		super(), this._editor = e, this._lastBracketsData = [], this._lastVersionId = 0, this._decorations = this._editor.createDecorationsCollection(), this._updateBracketsSoon = this._register(new RunOnceScheduler(() => this._updateBrackets(), 50)), this._matchBrackets = this._editor.getOption(72), this._updateBracketsSoon.schedule(), this._register(e.onDidChangeCursorPosition((e) => {
			this._matchBrackets !== "never" && this._updateBracketsSoon.schedule();
		})), this._register(e.onDidChangeModelContent((e) => {
			this._updateBracketsSoon.schedule();
		})), this._register(e.onDidChangeModel((e) => {
			this._lastBracketsData = [], this._updateBracketsSoon.schedule();
		})), this._register(e.onDidChangeModelLanguageConfiguration((e) => {
			this._lastBracketsData = [], this._updateBracketsSoon.schedule();
		})), this._register(e.onDidChangeConfiguration((e) => {
			e.hasChanged(72) && (this._matchBrackets = this._editor.getOption(72), this._decorations.clear(), this._lastBracketsData = [], this._lastVersionId = 0, this._updateBracketsSoon.schedule());
		})), this._register(e.onDidBlurEditorWidget(() => {
			this._updateBracketsSoon.schedule();
		})), this._register(e.onDidFocusEditorWidget(() => {
			this._updateBracketsSoon.schedule();
		}));
	}
	jumpToBracket() {
		if (!this._editor.hasModel()) return;
		let e = this._editor.getModel(), O = this._editor.getSelections().map((O) => {
			let k = O.getStartPosition(), A = e.bracketPairs.matchBracket(k), j = null;
			if (A) A[0].containsPosition(k) && !A[1].containsPosition(k) ? j = A[1].getStartPosition() : A[1].containsPosition(k) && (j = A[0].getStartPosition());
			else {
				let O = e.bracketPairs.findEnclosingBrackets(k);
				if (O) j = O[1].getStartPosition();
				else {
					let O = e.bracketPairs.findNextBracket(k);
					O && O.range && (j = O.range.getStartPosition());
				}
			}
			return j ? new Selection(j.lineNumber, j.column, j.lineNumber, j.column) : new Selection(k.lineNumber, k.column, k.lineNumber, k.column);
		});
		this._editor.setSelections(O), this._editor.revealRange(O[0]);
	}
	selectToBracket(e) {
		if (!this._editor.hasModel()) return;
		let O = this._editor.getModel(), k = [];
		this._editor.getSelections().forEach((A) => {
			let j = A.getStartPosition(), M = O.bracketPairs.matchBracket(j);
			if (!M && (M = O.bracketPairs.findEnclosingBrackets(j), !M)) {
				let e = O.bracketPairs.findNextBracket(j);
				e && e.range && (M = O.bracketPairs.matchBracket(e.range.getStartPosition()));
			}
			let N = null, P = null;
			if (M) {
				M.sort(Range.compareRangesUsingStarts);
				let [O, k] = M;
				if (N = e ? O.getStartPosition() : O.getEndPosition(), P = e ? k.getEndPosition() : k.getStartPosition(), k.containsPosition(j)) {
					let e = N;
					N = P, P = e;
				}
			}
			N && P && k.push(new Selection(N.lineNumber, N.column, P.lineNumber, P.column));
		}), k.length > 0 && (this._editor.setSelections(k), this._editor.revealRange(k[0]));
	}
	removeBrackets(e) {
		if (!this._editor.hasModel()) return;
		let O = this._editor.getModel();
		this._editor.getSelections().forEach((k) => {
			let A = k.getPosition(), j = O.bracketPairs.matchBracket(A);
			j ||= O.bracketPairs.findEnclosingBrackets(A), j && (this._editor.pushUndoStop(), this._editor.executeEdits(e, [{
				range: j[0],
				text: ""
			}, {
				range: j[1],
				text: ""
			}]), this._editor.pushUndoStop());
		});
	}
	static {
		this._DECORATION_OPTIONS_WITH_OVERVIEW_RULER = ModelDecorationOptions.register({
			description: "bracket-match-overview",
			stickiness: 1,
			className: "bracket-match",
			overviewRuler: {
				color: themeColorFromId(overviewRulerBracketMatchForeground),
				position: OverviewRulerLane.Center
			}
		});
	}
	static {
		this._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER = ModelDecorationOptions.register({
			description: "bracket-match-no-overview",
			stickiness: 1,
			className: "bracket-match"
		});
	}
	_updateBrackets() {
		if (this._matchBrackets === "never") return;
		this._recomputeBrackets();
		let e = [], O = 0;
		for (let k of this._lastBracketsData) {
			let A = k.brackets;
			A && (e[O++] = {
				range: A[0],
				options: k.options
			}, e[O++] = {
				range: A[1],
				options: k.options
			});
		}
		this._decorations.set(e);
	}
	_recomputeBrackets() {
		if (!this._editor.hasModel() || !this._editor.hasWidgetFocus()) {
			this._lastBracketsData = [], this._lastVersionId = 0;
			return;
		}
		let O = this._editor.getSelections();
		if (O.length > 100) {
			this._lastBracketsData = [], this._lastVersionId = 0;
			return;
		}
		let k = this._editor.getModel(), A = k.getVersionId(), j = [];
		this._lastVersionId === A && (j = this._lastBracketsData);
		let M = [], N = 0;
		for (let e = 0, k = O.length; e < k; e++) {
			let k = O[e];
			k.isEmpty() && (M[N++] = k.getStartPosition());
		}
		M.length > 1 && M.sort(Position.compare);
		let P = [], F = 0, I = 0, L = j.length;
		for (let O = 0, A = M.length; O < A; O++) {
			let A = M[O];
			for (; I < L && j[I].position.isBefore(A);) I++;
			if (I < L && j[I].position.equals(A)) P[F++] = j[I];
			else {
				let O = k.bracketPairs.matchBracket(A, 20), j = e._DECORATION_OPTIONS_WITH_OVERVIEW_RULER;
				!O && this._matchBrackets === "always" && (O = k.bracketPairs.findEnclosingBrackets(A, 20), j = e._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER), P[F++] = new BracketsData(A, O, j);
			}
		}
		this._lastBracketsData = P, this._lastVersionId = A;
	}
};
registerEditorContribution(BracketMatchingController.ID, BracketMatchingController, 1), registerEditorAction(SelectToBracketAction), registerEditorAction(JumpToBracketAction), registerEditorAction(RemoveBracketsAction), MenuRegistry.appendMenuItem(MenuId.MenubarGoMenu, {
	group: "5_infile_nav",
	command: {
		id: "editor.action.jumpToBracket",
		title: localize({
			key: "miGoToBracket",
			comment: ["&& denotes a mnemonic"]
		}, "Go to &&Bracket")
	},
	order: 2
});
var MoveCaretCommand = class {
	constructor(e, O) {
		this._selection = e, this._isMovingLeft = O;
	}
	getEditOperations(e, O) {
		if (this._selection.startLineNumber !== this._selection.endLineNumber || this._selection.isEmpty()) return;
		let k = this._selection.startLineNumber, A = this._selection.startColumn, j = this._selection.endColumn;
		if (!(this._isMovingLeft && A === 1) && !(!this._isMovingLeft && j === e.getLineMaxColumn(k))) if (this._isMovingLeft) {
			let M = new Range(k, A - 1, k, A), N = e.getValueInRange(M);
			O.addEditOperation(M, null), O.addEditOperation(new Range(k, j, k, j), N);
		} else {
			let M = new Range(k, j, k, j + 1), N = e.getValueInRange(M);
			O.addEditOperation(M, null), O.addEditOperation(new Range(k, A, k, A), N);
		}
	}
	computeCursorState(e, O) {
		return this._isMovingLeft ? new Selection(this._selection.startLineNumber, this._selection.startColumn - 1, this._selection.endLineNumber, this._selection.endColumn - 1) : new Selection(this._selection.startLineNumber, this._selection.startColumn + 1, this._selection.endLineNumber, this._selection.endColumn + 1);
	}
}, MoveCaretAction = class extends EditorAction {
	constructor(e, O) {
		super(O), this.left = e;
	}
	run(e, O) {
		if (!O.hasModel()) return;
		let k = [], A = O.getSelections();
		for (let e of A) k.push(new MoveCaretCommand(e, this.left));
		O.pushUndoStop(), O.executeCommands(this.id, k), O.pushUndoStop();
	}
}, MoveCaretLeftAction = class extends MoveCaretAction {
	constructor() {
		super(!0, {
			id: "editor.action.moveCarretLeftAction",
			label: localize("caret.moveLeft", "Move Selected Text Left"),
			alias: "Move Selected Text Left",
			precondition: EditorContextKeys.writable
		});
	}
}, MoveCaretRightAction = class extends MoveCaretAction {
	constructor() {
		super(!1, {
			id: "editor.action.moveCarretRightAction",
			label: localize("caret.moveRight", "Move Selected Text Right"),
			alias: "Move Selected Text Right",
			precondition: EditorContextKeys.writable
		});
	}
};
registerEditorAction(MoveCaretLeftAction), registerEditorAction(MoveCaretRightAction), registerEditorAction(class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.transposeLetters",
			label: localize("transposeLetters.label", "Transpose Letters"),
			alias: "Transpose Letters",
			precondition: EditorContextKeys.writable,
			kbOpts: {
				kbExpr: EditorContextKeys.textInputFocus,
				primary: 0,
				mac: { primary: 306 },
				weight: 100
			}
		});
	}
	run(e, O) {
		if (!O.hasModel()) return;
		let k = O.getModel(), A = [], j = O.getSelections();
		for (let e of j) {
			if (!e.isEmpty()) continue;
			let O = e.startLineNumber, j = e.startColumn, M = k.getLineMaxColumn(O);
			if (O === 1 && (j === 1 || j === 2 && M === 2)) continue;
			let N = j === M ? e.getPosition() : MoveOperations.rightPosition(k, e.getPosition().lineNumber, e.getPosition().column), P = MoveOperations.leftPosition(k, N), F = MoveOperations.leftPosition(k, P), I = k.getValueInRange(Range.fromPositions(F, P)), L = k.getValueInRange(Range.fromPositions(P, N)), R = Range.fromPositions(F, N);
			A.push(new ReplaceCommand(R, L + I));
		}
		A.length > 0 && (O.pushUndoStop(), O.executeCommands(this.id, A), O.pushUndoStop());
	}
});
const generateUuid = (function() {
	if (typeof crypto == "object" && typeof crypto.randomUUID == "function") return crypto.randomUUID.bind(crypto);
	let e;
	e = typeof crypto == "object" && typeof crypto.getRandomValues == "function" ? crypto.getRandomValues.bind(crypto) : function(e) {
		for (let O = 0; O < e.length; O++) e[O] = Math.floor(Math.random() * 256);
		return e;
	};
	let O = new Uint8Array(16), k = [];
	for (let e = 0; e < 256; e++) k.push(e.toString(16).padStart(2, "0"));
	return function() {
		e(O), O[6] = O[6] & 15 | 64, O[8] = O[8] & 63 | 128;
		let A = 0, j = "";
		return j += k[O[A++]], j += k[O[A++]], j += k[O[A++]], j += k[O[A++]], j += "-", j += k[O[A++]], j += k[O[A++]], j += "-", j += k[O[A++]], j += k[O[A++]], j += "-", j += k[O[A++]], j += k[O[A++]], j += "-", j += k[O[A++]], j += k[O[A++]], j += k[O[A++]], j += k[O[A++]], j += k[O[A++]], j += k[O[A++]], j;
	};
})();
function createStringDataTransferItem(e) {
	return {
		asString: async () => e,
		asFile: () => void 0,
		value: typeof e == "string" ? e : void 0
	};
}
function createFileDataTransferItem(e, O, k) {
	let A = {
		id: generateUuid(),
		name: e,
		uri: O,
		data: k
	};
	return {
		asString: async () => "",
		asFile: () => A,
		value: void 0
	};
}
var VSDataTransfer = class {
	constructor() {
		this._entries = /* @__PURE__ */ new Map();
	}
	get size() {
		let e = 0;
		for (let O of this._entries) e++;
		return e;
	}
	has(e) {
		return this._entries.has(this.toKey(e));
	}
	matches(e) {
		let O = [...this._entries.keys()];
		return Iterable.some(this, ([e, O]) => O.asFile()) && O.push("files"), matchesMimeType_normalized(normalizeMimeType(e), O);
	}
	get(e) {
		return this._entries.get(this.toKey(e))?.[0];
	}
	append(e, O) {
		let k = this._entries.get(e);
		k ? k.push(O) : this._entries.set(this.toKey(e), [O]);
	}
	replace(e, O) {
		this._entries.set(this.toKey(e), [O]);
	}
	delete(e) {
		this._entries.delete(this.toKey(e));
	}
	*[Symbol.iterator]() {
		for (let [e, O] of this._entries) for (let k of O) yield [e, k];
	}
	toKey(e) {
		return normalizeMimeType(e);
	}
};
function normalizeMimeType(e) {
	return e.toLowerCase();
}
function matchesMimeType(e, O) {
	return matchesMimeType_normalized(normalizeMimeType(e), O.map(normalizeMimeType));
}
function matchesMimeType_normalized(e, O) {
	if (e === "*/*") return O.length > 0;
	if (O.includes(e)) return !0;
	let k = e.match(/^([a-z]+)\/([a-z]+|\*)$/i);
	if (!k) return !1;
	let [A, j, M] = k;
	return M === "*" ? O.some((e) => e.startsWith(j + "/")) : !1;
}
const UriList = Object.freeze({
	create: (e) => distinct(e.map((e) => e.toString())).join("\r\n"),
	split: (e) => e.split("\r\n"),
	parse: (e) => UriList.split(e).filter((e) => !e.startsWith("#"))
});
var HierarchicalKind = class e {
	static {
		this.sep = ".";
	}
	static {
		this.None = new e("@@none@@");
	}
	static {
		this.Empty = new e("");
	}
	constructor(e) {
		this.value = e;
	}
	equals(e) {
		return this.value === e.value;
	}
	contains(O) {
		return this.equals(O) || this.value === "" || O.value.startsWith(this.value + e.sep);
	}
	intersects(e) {
		return this.contains(e) || e.contains(this);
	}
	append(...O) {
		return new e((this.value ? [this.value, ...O] : O).join(e.sep));
	}
};
const CodeDataTransfers = {
	EDITORS: "CodeEditors",
	FILES: "CodeFiles"
};
var DragAndDropContributionRegistry = class {};
Registry.add({ DragAndDropContribution: "workbench.contributions.dragAndDrop" }.DragAndDropContribution, new DragAndDropContributionRegistry());
var LocalSelectionTransfer = class e {
	static {
		this.INSTANCE = new e();
	}
	constructor() {}
	static getInstance() {
		return e.INSTANCE;
	}
	hasData(e) {
		return e && e === this.proto;
	}
	getData(e) {
		if (this.hasData(e)) return this.data;
	}
};
function toVSDataTransfer(e) {
	let O = new VSDataTransfer();
	for (let k of e.items) {
		let e = k.type;
		if (k.kind === "string") {
			let A = new Promise((e) => k.getAsString(e));
			O.append(e, createStringDataTransferItem(A));
		} else if (k.kind === "file") {
			let A = k.getAsFile();
			A && O.append(e, createFileDataTransferItemFromFile(A));
		}
	}
	return O;
}
function createFileDataTransferItemFromFile(e) {
	let O = e.path ? URI.parse(e.path) : void 0;
	return createFileDataTransferItem(e.name, O, async () => new Uint8Array(await e.arrayBuffer()));
}
var INTERNAL_DND_MIME_TYPES = Object.freeze([
	CodeDataTransfers.EDITORS,
	CodeDataTransfers.FILES,
	DataTransfers.RESOURCES,
	DataTransfers.INTERNAL_URI_LIST
]);
function toExternalVSDataTransfer(e, O = !1) {
	let k = toVSDataTransfer(e), A = k.get(DataTransfers.INTERNAL_URI_LIST);
	if (A) k.replace(Mimes.uriList, A);
	else if (O || !k.has(Mimes.uriList)) {
		let O = [];
		for (let k of e.items) {
			let e = k.getAsFile();
			if (e) {
				let k = e.path;
				try {
					k ? O.push(URI.file(k).toString()) : O.push(URI.parse(e.name, !0).toString());
				} catch {}
			}
		}
		O.length && k.replace(Mimes.uriList, createStringDataTransferItem(UriList.create(O)));
	}
	for (let e of INTERNAL_DND_MIME_TYPES) k.delete(e);
	return k;
}
var __decorate$101 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$101 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, SimplePasteAndDropProvider = class {
	async provideDocumentPasteEdits(e, O, k, A, j) {
		let M = await this.getEdit(k, j);
		if (M) return {
			edits: [{
				insertText: M.insertText,
				title: M.title,
				kind: M.kind,
				handledMimeType: M.handledMimeType,
				yieldTo: M.yieldTo
			}],
			dispose() {}
		};
	}
	async provideDocumentDropEdits(e, O, k, A) {
		let j = await this.getEdit(k, A);
		if (j) return {
			edits: [{
				insertText: j.insertText,
				title: j.title,
				kind: j.kind,
				handledMimeType: j.handledMimeType,
				yieldTo: j.yieldTo
			}],
			dispose() {}
		};
	}
}, DefaultTextPasteOrDropEditProvider = class e extends SimplePasteAndDropProvider {
	constructor() {
		super(...arguments), this.kind = e.kind, this.dropMimeTypes = [Mimes.text], this.pasteMimeTypes = [Mimes.text];
	}
	static {
		this.id = "text";
	}
	static {
		this.kind = new HierarchicalKind("text.plain");
	}
	async getEdit(e, O) {
		let k = e.get(Mimes.text);
		if (!k || e.has(Mimes.uriList)) return;
		let A = await k.asString();
		return {
			handledMimeType: Mimes.text,
			title: localize("text.label", "Insert Plain Text"),
			insertText: A,
			kind: this.kind
		};
	}
}, PathProvider = class extends SimplePasteAndDropProvider {
	constructor() {
		super(...arguments), this.kind = new HierarchicalKind("uri.absolute"), this.dropMimeTypes = [Mimes.uriList], this.pasteMimeTypes = [Mimes.uriList];
	}
	async getEdit(e, O) {
		let k = await extractUriList(e);
		if (!k.length || O.isCancellationRequested) return;
		let A = 0, j = k.map(({ uri: e, originalText: O }) => e.scheme === Schemas.file ? e.fsPath : (A++, O)).join(" "), M;
		return M = A > 0 ? k.length > 1 ? localize("defaultDropProvider.uriList.uris", "Insert Uris") : localize("defaultDropProvider.uriList.uri", "Insert Uri") : k.length > 1 ? localize("defaultDropProvider.uriList.paths", "Insert Paths") : localize("defaultDropProvider.uriList.path", "Insert Path"), {
			handledMimeType: Mimes.uriList,
			insertText: j,
			title: M,
			kind: this.kind
		};
	}
}, RelativePathProvider = class extends SimplePasteAndDropProvider {
	constructor(e) {
		super(), this._workspaceContextService = e, this.kind = new HierarchicalKind("uri.relative"), this.dropMimeTypes = [Mimes.uriList], this.pasteMimeTypes = [Mimes.uriList];
	}
	async getEdit(e, O) {
		let k = await extractUriList(e);
		if (!k.length || O.isCancellationRequested) return;
		let A = coalesce(k.map(({ uri: e }) => {
			let O = this._workspaceContextService.getWorkspaceFolder(e);
			return O ? relativePath(O.uri, e) : void 0;
		}));
		if (A.length) return {
			handledMimeType: Mimes.uriList,
			insertText: A.join(" "),
			title: k.length > 1 ? localize("defaultDropProvider.uriList.relativePaths", "Insert Relative Paths") : localize("defaultDropProvider.uriList.relativePath", "Insert Relative Path"),
			kind: this.kind
		};
	}
};
RelativePathProvider = __decorate$101([__param$101(0, IWorkspaceContextService)], RelativePathProvider);
var PasteHtmlProvider = class {
	constructor() {
		this.kind = new HierarchicalKind("html"), this.pasteMimeTypes = ["text/html"], this._yieldTo = [{ mimeType: Mimes.text }];
	}
	async provideDocumentPasteEdits(e, O, k, A, j) {
		if (A.triggerKind !== DocumentPasteTriggerKind.PasteAs && !A.only?.contains(this.kind)) return;
		let M = await k.get("text/html")?.asString();
		if (!(!M || j.isCancellationRequested)) return {
			dispose() {},
			edits: [{
				insertText: M,
				yieldTo: this._yieldTo,
				title: localize("pasteHtmlLabel", "Insert HTML"),
				kind: this.kind
			}]
		};
	}
};
async function extractUriList(e) {
	let O = e.get(Mimes.uriList);
	if (!O) return [];
	let k = await O.asString(), A = [];
	for (let e of UriList.parse(k)) try {
		A.push({
			uri: URI.parse(e),
			originalText: e
		});
	} catch {}
	return A;
}
var DefaultDropProvidersFeature = class extends Disposable {
	constructor(e, O) {
		super(), this._register(e.documentDropEditProvider.register("*", new DefaultTextPasteOrDropEditProvider())), this._register(e.documentDropEditProvider.register("*", new PathProvider())), this._register(e.documentDropEditProvider.register("*", new RelativePathProvider(O)));
	}
};
DefaultDropProvidersFeature = __decorate$101([__param$101(0, ILanguageFeaturesService), __param$101(1, IWorkspaceContextService)], DefaultDropProvidersFeature);
var DefaultPasteProvidersFeature = class extends Disposable {
	constructor(e, O) {
		super(), this._register(e.documentPasteEditProvider.register("*", new DefaultTextPasteOrDropEditProvider())), this._register(e.documentPasteEditProvider.register("*", new PathProvider())), this._register(e.documentPasteEditProvider.register("*", new RelativePathProvider(O))), this._register(e.documentPasteEditProvider.register("*", new PasteHtmlProvider()));
	}
};
DefaultPasteProvidersFeature = __decorate$101([__param$101(0, ILanguageFeaturesService), __param$101(1, IWorkspaceContextService)], DefaultPasteProvidersFeature);
var Scanner = class e {
	constructor() {
		this.value = "", this.pos = 0;
	}
	static {
		this._table = {
			36: 0,
			58: 1,
			44: 2,
			123: 3,
			125: 4,
			92: 5,
			47: 6,
			124: 7,
			43: 11,
			45: 12,
			63: 13
		};
	}
	static isDigitCharacter(e) {
		return e >= 48 && e <= 57;
	}
	static isVariableCharacter(e) {
		return e === 95 || e >= 97 && e <= 122 || e >= 65 && e <= 90;
	}
	text(e) {
		this.value = e, this.pos = 0;
	}
	tokenText(e) {
		return this.value.substr(e.pos, e.len);
	}
	next() {
		if (this.pos >= this.value.length) return {
			type: 14,
			pos: this.pos,
			len: 0
		};
		let O = this.pos, k = 0, A = this.value.charCodeAt(O), j;
		if (j = e._table[A], typeof j == "number") return this.pos += 1, {
			type: j,
			pos: O,
			len: 1
		};
		if (e.isDigitCharacter(A)) {
			j = 8;
			do
				k += 1, A = this.value.charCodeAt(O + k);
			while (e.isDigitCharacter(A));
			return this.pos += k, {
				type: j,
				pos: O,
				len: k
			};
		}
		if (e.isVariableCharacter(A)) {
			j = 9;
			do
				A = this.value.charCodeAt(O + ++k);
			while (e.isVariableCharacter(A) || e.isDigitCharacter(A));
			return this.pos += k, {
				type: j,
				pos: O,
				len: k
			};
		}
		j = 10;
		do
			k += 1, A = this.value.charCodeAt(O + k);
		while (!isNaN(A) && e._table[A] === void 0 && !e.isDigitCharacter(A) && !e.isVariableCharacter(A));
		return this.pos += k, {
			type: j,
			pos: O,
			len: k
		};
	}
}, Marker = class {
	constructor() {
		this._children = [];
	}
	appendChild(e) {
		return e instanceof Text && this._children[this._children.length - 1] instanceof Text ? this._children[this._children.length - 1].value += e.value : (e.parent = this, this._children.push(e)), this;
	}
	replace(e, O) {
		let { parent: k } = e, A = k.children.indexOf(e), j = k.children.slice(0);
		j.splice(A, 1, ...O), k._children = j, (function e(O, k) {
			for (let A of O) A.parent = k, e(A.children, A);
		})(O, k);
	}
	get children() {
		return this._children;
	}
	get rightMostDescendant() {
		return this._children.length > 0 ? this._children[this._children.length - 1].rightMostDescendant : this;
	}
	get snippet() {
		let e = this;
		for (;;) {
			if (!e) return;
			if (e instanceof TextmateSnippet) return e;
			e = e.parent;
		}
	}
	toString() {
		return this.children.reduce((e, O) => e + O.toString(), "");
	}
	len() {
		return 0;
	}
}, Text = class e extends Marker {
	constructor(e) {
		super(), this.value = e;
	}
	toString() {
		return this.value;
	}
	len() {
		return this.value.length;
	}
	clone() {
		return new e(this.value);
	}
}, TransformableMarker = class extends Marker {}, Placeholder = class e extends TransformableMarker {
	static compareByIndex(e, O) {
		return e.index === O.index ? 0 : e.isFinalTabstop ? 1 : O.isFinalTabstop || e.index < O.index ? -1 : e.index > O.index ? 1 : 0;
	}
	constructor(e) {
		super(), this.index = e;
	}
	get isFinalTabstop() {
		return this.index === 0;
	}
	get choice() {
		return this._children.length === 1 && this._children[0] instanceof Choice ? this._children[0] : void 0;
	}
	clone() {
		let O = new e(this.index);
		return this.transform && (O.transform = this.transform.clone()), O._children = this.children.map((e) => e.clone()), O;
	}
}, Choice = class e extends Marker {
	constructor() {
		super(...arguments), this.options = [];
	}
	appendChild(e) {
		return e instanceof Text && (e.parent = this, this.options.push(e)), this;
	}
	toString() {
		return this.options[0].value;
	}
	len() {
		return this.options[0].len();
	}
	clone() {
		let O = new e();
		return this.options.forEach(O.appendChild, O), O;
	}
}, Transform = class e extends Marker {
	constructor() {
		super(...arguments), this.regexp = /* @__PURE__ */ RegExp("");
	}
	resolve(e) {
		let O = this, k = !1, A = e.replace(this.regexp, function() {
			return k = !0, O._replace(Array.prototype.slice.call(arguments, 0, -2));
		});
		return !k && this._children.some((e) => e instanceof FormatString && !!e.elseValue) && (A = this._replace([])), A;
	}
	_replace(e) {
		let O = "";
		for (let k of this._children) if (k instanceof FormatString) {
			let A = e[k.index] || "";
			A = k.resolve(A), O += A;
		} else O += k.toString();
		return O;
	}
	toString() {
		return "";
	}
	clone() {
		let O = new e();
		return O.regexp = new RegExp(this.regexp.source, (this.regexp.ignoreCase ? "i" : "") + (this.regexp.global ? "g" : "")), O._children = this.children.map((e) => e.clone()), O;
	}
}, FormatString = class e extends Marker {
	constructor(e, O, k, A) {
		super(), this.index = e, this.shorthandName = O, this.ifValue = k, this.elseValue = A;
	}
	resolve(e) {
		return this.shorthandName === "upcase" ? e ? e.toLocaleUpperCase() : "" : this.shorthandName === "downcase" ? e ? e.toLocaleLowerCase() : "" : this.shorthandName === "capitalize" ? e ? e[0].toLocaleUpperCase() + e.substr(1) : "" : this.shorthandName === "pascalcase" ? e ? this._toPascalCase(e) : "" : this.shorthandName === "camelcase" ? e ? this._toCamelCase(e) : "" : e && typeof this.ifValue == "string" ? this.ifValue : !e && typeof this.elseValue == "string" ? this.elseValue : e || "";
	}
	_toPascalCase(e) {
		let O = e.match(/[a-z0-9]+/gi);
		return O ? O.map((e) => e.charAt(0).toUpperCase() + e.substr(1)).join("") : e;
	}
	_toCamelCase(e) {
		let O = e.match(/[a-z0-9]+/gi);
		return O ? O.map((e, O) => O === 0 ? e.charAt(0).toLowerCase() + e.substr(1) : e.charAt(0).toUpperCase() + e.substr(1)).join("") : e;
	}
	clone() {
		return new e(this.index, this.shorthandName, this.ifValue, this.elseValue);
	}
}, Variable = class e extends TransformableMarker {
	constructor(e) {
		super(), this.name = e;
	}
	resolve(e) {
		let O = e.resolve(this);
		return this.transform && (O = this.transform.resolve(O || "")), O === void 0 ? !1 : (this._children = [new Text(O)], !0);
	}
	clone() {
		let O = new e(this.name);
		return this.transform && (O.transform = this.transform.clone()), O._children = this.children.map((e) => e.clone()), O;
	}
};
function walk(e, O) {
	let k = [...e];
	for (; k.length > 0;) {
		let e = k.shift();
		if (!O(e)) break;
		k.unshift(...e.children);
	}
}
var TextmateSnippet = class e extends Marker {
	get placeholderInfo() {
		if (!this._placeholders) {
			let e = [], O;
			this.walk(function(k) {
				return k instanceof Placeholder && (e.push(k), O = !O || O.index < k.index ? k : O), !0;
			}), this._placeholders = {
				all: e,
				last: O
			};
		}
		return this._placeholders;
	}
	get placeholders() {
		let { all: e } = this.placeholderInfo;
		return e;
	}
	offset(e) {
		let O = 0, k = !1;
		return this.walk((A) => A === e ? (k = !0, !1) : (O += A.len(), !0)), k ? O : -1;
	}
	fullLen(e) {
		let O = 0;
		return walk([e], (e) => (O += e.len(), !0)), O;
	}
	enclosingPlaceholders(e) {
		let O = [], { parent: k } = e;
		for (; k;) k instanceof Placeholder && O.push(k), k = k.parent;
		return O;
	}
	resolveVariables(e) {
		return this.walk((O) => (O instanceof Variable && O.resolve(e) && (this._placeholders = void 0), !0)), this;
	}
	appendChild(e) {
		return this._placeholders = void 0, super.appendChild(e);
	}
	replace(e, O) {
		return this._placeholders = void 0, super.replace(e, O);
	}
	clone() {
		let O = new e();
		return this._children = this.children.map((e) => e.clone()), O;
	}
	walk(e) {
		walk(this.children, e);
	}
}, SnippetParser = class {
	constructor() {
		this._scanner = new Scanner(), this._token = {
			type: 14,
			pos: 0,
			len: 0
		};
	}
	static escape(e) {
		return e.replace(/\$|}|\\/g, "\\$&");
	}
	static guessNeedsClipboard(e) {
		return /\${?CLIPBOARD/.test(e);
	}
	parse(e, O, k) {
		let A = new TextmateSnippet();
		return this.parseFragment(e, A), this.ensureFinalTabstop(A, k ?? !1, O ?? !1), A;
	}
	parseFragment(e, O) {
		let k = O.children.length;
		for (this._scanner.text(e), this._token = this._scanner.next(); this._parse(O););
		let A = /* @__PURE__ */ new Map(), j = [];
		O.walk((e) => (e instanceof Placeholder && (e.isFinalTabstop ? A.set(0, void 0) : !A.has(e.index) && e.children.length > 0 ? A.set(e.index, e.children) : j.push(e)), !0));
		let M = (e, k) => {
			let j = A.get(e.index);
			if (!j) return;
			let N = new Placeholder(e.index);
			N.transform = e.transform;
			for (let e of j) {
				let O = e.clone();
				N.appendChild(O), O instanceof Placeholder && A.has(O.index) && !k.has(O.index) && (k.add(O.index), M(O, k), k.delete(O.index));
			}
			O.replace(e, [N]);
		}, N = /* @__PURE__ */ new Set();
		for (let e of j) M(e, N);
		return O.children.slice(k);
	}
	ensureFinalTabstop(e, O, k) {
		(O || k && e.placeholders.length > 0) && (e.placeholders.find((e) => e.index === 0) || e.appendChild(new Placeholder(0)));
	}
	_accept(e, O) {
		if (e === void 0 || this._token.type === e) {
			let e = O ? this._scanner.tokenText(this._token) : !0;
			return this._token = this._scanner.next(), e;
		}
		return !1;
	}
	_backTo(e) {
		return this._scanner.pos = e.pos + e.len, this._token = e, !1;
	}
	_until(e) {
		let O = this._token;
		for (; this._token.type !== e;) {
			if (this._token.type === 14) return !1;
			if (this._token.type === 5) {
				let e = this._scanner.next();
				if (e.type !== 0 && e.type !== 4 && e.type !== 5) return !1;
			}
			this._token = this._scanner.next();
		}
		let k = this._scanner.value.substring(O.pos, this._token.pos).replace(/\\(\$|}|\\)/g, "$1");
		return this._token = this._scanner.next(), k;
	}
	_parse(e) {
		return this._parseEscaped(e) || this._parseTabstopOrVariableName(e) || this._parseComplexPlaceholder(e) || this._parseComplexVariable(e) || this._parseAnything(e);
	}
	_parseEscaped(e) {
		let O;
		return (O = this._accept(5, !0)) ? (O = this._accept(0, !0) || this._accept(4, !0) || this._accept(5, !0) || O, e.appendChild(new Text(O)), !0) : !1;
	}
	_parseTabstopOrVariableName(e) {
		let O, k = this._token;
		return this._accept(0) && (O = this._accept(9, !0) || this._accept(8, !0)) ? (e.appendChild(/^\d+$/.test(O) ? new Placeholder(Number(O)) : new Variable(O)), !0) : this._backTo(k);
	}
	_parseComplexPlaceholder(e) {
		let O, k = this._token;
		if (!(this._accept(0) && this._accept(3) && (O = this._accept(8, !0)))) return this._backTo(k);
		let A = new Placeholder(Number(O));
		if (this._accept(1)) for (;;) {
			if (this._accept(4)) return e.appendChild(A), !0;
			if (!this._parse(A)) return e.appendChild(new Text("${" + O + ":")), A.children.forEach(e.appendChild, e), !0;
		}
		else if (A.index > 0 && this._accept(7)) {
			let O = new Choice();
			for (;;) {
				if (this._parseChoiceElement(O)) {
					if (this._accept(2)) continue;
					if (this._accept(7) && (A.appendChild(O), this._accept(4))) return e.appendChild(A), !0;
				}
				return this._backTo(k), !1;
			}
		} else if (this._accept(6)) return this._parseTransform(A) ? (e.appendChild(A), !0) : (this._backTo(k), !1);
		else if (this._accept(4)) return e.appendChild(A), !0;
		else return this._backTo(k);
	}
	_parseChoiceElement(e) {
		let O = this._token, k = [];
		for (; !(this._token.type === 2 || this._token.type === 7);) {
			let e;
			if (e = (e = this._accept(5, !0)) ? this._accept(2, !0) || this._accept(7, !0) || this._accept(5, !0) || e : this._accept(void 0, !0), !e) return this._backTo(O), !1;
			k.push(e);
		}
		return k.length === 0 ? (this._backTo(O), !1) : (e.appendChild(new Text(k.join(""))), !0);
	}
	_parseComplexVariable(e) {
		let O, k = this._token;
		if (!(this._accept(0) && this._accept(3) && (O = this._accept(9, !0)))) return this._backTo(k);
		let A = new Variable(O);
		if (this._accept(1)) for (;;) {
			if (this._accept(4)) return e.appendChild(A), !0;
			if (!this._parse(A)) return e.appendChild(new Text("${" + O + ":")), A.children.forEach(e.appendChild, e), !0;
		}
		else if (this._accept(6)) return this._parseTransform(A) ? (e.appendChild(A), !0) : (this._backTo(k), !1);
		else if (this._accept(4)) return e.appendChild(A), !0;
		else return this._backTo(k);
	}
	_parseTransform(e) {
		let O = new Transform(), k = "", A = "";
		for (; !this._accept(6);) {
			let e;
			if (e = this._accept(5, !0)) {
				e = this._accept(6, !0) || e, k += e;
				continue;
			}
			if (this._token.type !== 14) {
				k += this._accept(void 0, !0);
				continue;
			}
			return !1;
		}
		for (; !this._accept(6);) {
			let e;
			if (e = this._accept(5, !0)) {
				e = this._accept(5, !0) || this._accept(6, !0) || e, O.appendChild(new Text(e));
				continue;
			}
			if (!(this._parseFormatString(O) || this._parseAnything(O))) return !1;
		}
		for (; !this._accept(4);) {
			if (this._token.type !== 14) {
				A += this._accept(void 0, !0);
				continue;
			}
			return !1;
		}
		try {
			O.regexp = new RegExp(k, A);
		} catch {
			return !1;
		}
		return e.transform = O, !0;
	}
	_parseFormatString(e) {
		let O = this._token;
		if (!this._accept(0)) return !1;
		let k = !1;
		this._accept(3) && (k = !0);
		let A = this._accept(8, !0);
		if (A) if (k) {
			if (this._accept(4)) return e.appendChild(new FormatString(Number(A))), !0;
			if (!this._accept(1)) return this._backTo(O), !1;
		} else return e.appendChild(new FormatString(Number(A))), !0;
		else return this._backTo(O), !1;
		if (this._accept(6)) {
			let k = this._accept(9, !0);
			return !k || !this._accept(4) ? (this._backTo(O), !1) : (e.appendChild(new FormatString(Number(A), k)), !0);
		} else if (this._accept(11)) {
			let O = this._until(4);
			if (O) return e.appendChild(new FormatString(Number(A), void 0, O, void 0)), !0;
		} else if (this._accept(12)) {
			let O = this._until(4);
			if (O) return e.appendChild(new FormatString(Number(A), void 0, void 0, O)), !0;
		} else if (this._accept(13)) {
			let O = this._until(1);
			if (O) {
				let k = this._until(4);
				if (k) return e.appendChild(new FormatString(Number(A), void 0, O, k)), !0;
			}
		} else {
			let O = this._until(4);
			if (O) return e.appendChild(new FormatString(Number(A), void 0, void 0, O)), !0;
		}
		return this._backTo(O), !1;
	}
	_parseAnything(e) {
		return this._token.type === 14 ? !1 : (e.appendChild(new Text(this._scanner.tokenText(this._token))), this._accept(void 0), !0);
	}
};
function createCombinedWorkspaceEdit(e, O, k) {
	return (typeof k.insertText == "string" ? k.insertText === "" : k.insertText.snippet === "") ? { edits: k.additionalEdit?.edits ?? [] } : { edits: [...O.map((O) => new ResourceTextEdit(e, {
		range: O,
		text: typeof k.insertText == "string" ? SnippetParser.escape(k.insertText) + "$0" : k.insertText.snippet,
		insertAsSnippet: !0
	})), ...k.additionalEdit?.edits ?? []] };
}
function sortEditsByYieldTo(e) {
	function O(e, O) {
		return "mimeType" in e ? e.mimeType === O.handledMimeType : !!O.kind && e.kind.contains(O.kind);
	}
	let k = /* @__PURE__ */ new Map();
	for (let A of e) for (let j of A.yieldTo ?? []) for (let M of e) if (M !== A && O(j, M)) {
		let e = k.get(A);
		e || (e = [], k.set(A, e)), e.push(M);
	}
	if (!k.size) return Array.from(e);
	let A = /* @__PURE__ */ new Set(), j = [];
	function M(e) {
		if (!e.length) return [];
		let O = e[0];
		if (j.includes(O)) return console.warn("Yield to cycle detected", O), e;
		if (A.has(O)) return M(e.slice(1));
		let N = [], P = k.get(O);
		return P && (j.push(O), N = M(P), j.pop()), A.add(O), [
			...N,
			O,
			...M(e.slice(1))
		];
	}
	return M(Array.from(e));
}
var __decorate$100 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$100 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, inlineProgressDecoration = ModelDecorationOptions.register({
	description: "inline-progress-widget",
	stickiness: 1,
	showIfCollapsed: !0,
	after: {
		content: "\xA0",
		inlineClassName: "inline-editor-progress-decoration",
		inlineClassNameAffectsLetterSpacing: !0
	}
}), InlineProgressWidget = class e extends Disposable {
	static {
		this.baseId = "editor.widget.inlineProgressWidget";
	}
	constructor(e, O, k, A, j) {
		super(), this.typeId = e, this.editor = O, this.range = k, this.delegate = j, this.allowEditorOverflow = !1, this.suppressMouseDown = !0, this.create(A), this.editor.addContentWidget(this), this.editor.layoutContentWidget(this);
	}
	create(e) {
		this.domNode = $(".inline-progress-widget"), this.domNode.role = "button", this.domNode.title = e;
		let O = $("span.icon");
		this.domNode.append(O), O.classList.add(...ThemeIcon.asClassNameArray(Codicon.loading), "codicon-modifier-spin");
		let k = () => {
			let e = this.editor.getOption(67);
			this.domNode.style.height = `${e}px`, this.domNode.style.width = `${Math.ceil(.8 * e)}px`;
		};
		k(), this._register(this.editor.onDidChangeConfiguration((e) => {
			(e.hasChanged(52) || e.hasChanged(67)) && k();
		})), this._register(addDisposableListener(this.domNode, EventType$1.CLICK, (e) => {
			this.delegate.cancel();
		}));
	}
	getId() {
		return e.baseId + "." + this.typeId;
	}
	getDomNode() {
		return this.domNode;
	}
	getPosition() {
		return {
			position: {
				lineNumber: this.range.startLineNumber,
				column: this.range.startColumn
			},
			preference: [0]
		};
	}
	dispose() {
		super.dispose(), this.editor.removeContentWidget(this);
	}
}, InlineProgressManager = class extends Disposable {
	constructor(e, O, k) {
		super(), this.id = e, this._editor = O, this._instantiationService = k, this._showDelay = 500, this._showPromise = this._register(new MutableDisposable()), this._currentWidget = this._register(new MutableDisposable()), this._operationIdPool = 0, this._currentDecorations = O.createDecorationsCollection();
	}
	dispose() {
		super.dispose(), this._currentDecorations.clear();
	}
	async showWhile(e, O, k, A, j) {
		let M = this._operationIdPool++;
		this._currentOperation = M, this.clear(), this._showPromise.value = disposableTimeout(() => {
			let k = Range.fromPositions(e);
			this._currentDecorations.set([{
				range: k,
				options: inlineProgressDecoration
			}]).length > 0 && (this._currentWidget.value = this._instantiationService.createInstance(InlineProgressWidget, this.id, this._editor, k, O, A));
		}, j ?? this._showDelay);
		try {
			return await k;
		} finally {
			this._currentOperation === M && (this.clear(), this._currentOperation = void 0);
		}
	}
	clear() {
		this._showPromise.clear(), this._currentDecorations.clear(), this._currentWidget.clear();
	}
};
InlineProgressManager = __decorate$100([__param$100(2, IInstantiationService)], InlineProgressManager);
var __decorate$99 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$99 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, MessageController_1, MessageController = class {
	static {
		MessageController_1 = this;
	}
	static {
		this.ID = "editor.contrib.messageController";
	}
	static {
		this.MESSAGE_VISIBLE = new RawContextKey("messageVisible", !1, localize("messageVisible", "Whether the editor is currently showing an inline message"));
	}
	static get(e) {
		return e.getContribution(MessageController_1.ID);
	}
	constructor(e, O, k) {
		this._openerService = k, this._messageWidget = new MutableDisposable(), this._messageListeners = new DisposableStore(), this._mouseOverMessage = !1, this._editor = e, this._visible = MessageController_1.MESSAGE_VISIBLE.bindTo(O);
	}
	dispose() {
		this._message?.dispose(), this._messageListeners.dispose(), this._messageWidget.dispose(), this._visible.reset();
	}
	showMessage(e, O) {
		alert(isMarkdownString(e) ? e.value : e), this._visible.set(!0), this._messageWidget.clear(), this._messageListeners.clear(), this._message = isMarkdownString(e) ? renderMarkdown(e, { actionHandler: {
			callback: (O) => {
				this.closeMessage(), openLinkFromMarkdown(this._openerService, O, isMarkdownString(e) ? e.isTrusted : void 0);
			},
			disposables: this._messageListeners
		} }) : void 0, this._messageWidget.value = new MessageWidget$1(this._editor, O, typeof e == "string" ? e : this._message.element), this._messageListeners.add(Event.debounce(this._editor.onDidBlurEditorText, (e, O) => O, 0)(() => {
			this._mouseOverMessage || this._messageWidget.value && isAncestor(getActiveElement(), this._messageWidget.value.getDomNode()) || this.closeMessage();
		})), this._messageListeners.add(this._editor.onDidChangeCursorPosition(() => this.closeMessage())), this._messageListeners.add(this._editor.onDidDispose(() => this.closeMessage())), this._messageListeners.add(this._editor.onDidChangeModel(() => this.closeMessage())), this._messageListeners.add(addDisposableListener(this._messageWidget.value.getDomNode(), EventType$1.MOUSE_ENTER, () => this._mouseOverMessage = !0, !0)), this._messageListeners.add(addDisposableListener(this._messageWidget.value.getDomNode(), EventType$1.MOUSE_LEAVE, () => this._mouseOverMessage = !1, !0));
		let k;
		this._messageListeners.add(this._editor.onMouseMove((e) => {
			e.target.position && (k ? k.containsPosition(e.target.position) || this.closeMessage() : k = new Range(O.lineNumber - 3, 1, e.target.position.lineNumber + 3, 1));
		}));
	}
	closeMessage() {
		this._visible.reset(), this._messageListeners.clear(), this._messageWidget.value && this._messageListeners.add(MessageWidget$1.fadeOut(this._messageWidget.value));
	}
};
MessageController = MessageController_1 = __decorate$99([__param$99(1, IContextKeyService), __param$99(2, IOpenerService)], MessageController);
var MessageCommand = EditorCommand.bindToContribution(MessageController.get);
registerEditorCommand(new MessageCommand({
	id: "leaveEditorMessage",
	precondition: MessageController.MESSAGE_VISIBLE,
	handler: (e) => e.closeMessage(),
	kbOpts: {
		weight: 130,
		primary: 9
	}
}));
var MessageWidget$1 = class {
	static fadeOut(e) {
		let O = () => {
			e.dispose(), clearTimeout(k), e.getDomNode().removeEventListener("animationend", O);
		}, k = setTimeout(O, 110);
		return e.getDomNode().addEventListener("animationend", O), e.getDomNode().classList.add("fadeOut"), { dispose: O };
	}
	constructor(e, { lineNumber: O, column: k }, A) {
		this.allowEditorOverflow = !0, this.suppressMouseDown = !1, this._editor = e, this._editor.revealLinesInCenterIfOutsideViewport(O, O, 0), this._position = {
			lineNumber: O,
			column: k
		}, this._domNode = document.createElement("div"), this._domNode.classList.add("monaco-editor-overlaymessage"), this._domNode.style.marginLeft = "-6px";
		let j = document.createElement("div");
		j.classList.add("anchor", "top"), this._domNode.appendChild(j);
		let M = document.createElement("div");
		typeof A == "string" ? (M.classList.add("message"), M.textContent = A) : (A.classList.add("message"), M.appendChild(A)), this._domNode.appendChild(M);
		let N = document.createElement("div");
		N.classList.add("anchor", "below"), this._domNode.appendChild(N), this._editor.addContentWidget(this), this._domNode.classList.add("fadeIn");
	}
	dispose() {
		this._editor.removeContentWidget(this);
	}
	getId() {
		return "messageoverlay";
	}
	getDomNode() {
		return this._domNode;
	}
	getPosition() {
		return {
			position: this._position,
			preference: [1, 2],
			positionAffinity: 1
		};
	}
	afterRender(e) {
		this._domNode.classList.toggle("below", e === 2);
	}
};
registerEditorContribution(MessageController.ID, MessageController, 4);
function exceptionToErrorMessage(e, O) {
	return O && (e.stack || e.stacktrace) ? localize("stackTrace.format", "{0}: {1}", detectSystemErrorMessage(e), stackToString(e.stack) || stackToString(e.stacktrace)) : detectSystemErrorMessage(e);
}
function stackToString(e) {
	return Array.isArray(e) ? e.join("\n") : e;
}
function detectSystemErrorMessage(e) {
	return e.code === "ERR_UNC_HOST_NOT_ALLOWED" ? `${e.message}. Please update the 'security.allowedUNCHosts' setting if you want to allow this host.` : typeof e.code == "string" && typeof e.errno == "number" && typeof e.syscall == "string" ? localize("nodeExceptionMessage", "A system error occurred ({0})", e.message) : e.message || localize("error.defaultMessage", "An unknown error occurred. Please consult the log for more details.");
}
function toErrorMessage(e = null, O = !1) {
	if (!e) return localize("error.defaultMessage", "An unknown error occurred. Please consult the log for more details.");
	if (Array.isArray(e)) {
		let k = coalesce(e), A = toErrorMessage(k[0], O);
		return k.length > 1 ? localize("error.moreErrors", "{0} ({1} errors in total)", A, k.length) : A;
	}
	if (isString(e)) return e;
	if (e.detail) {
		let k = e.detail;
		if (k.error) return exceptionToErrorMessage(k.error, O);
		if (k.exception) return exceptionToErrorMessage(k.exception, O);
	}
	return e.stack ? exceptionToErrorMessage(e, O) : e.message ? e.message : localize("error.defaultMessage", "An unknown error occurred. Please consult the log for more details.");
}
var __decorate$98 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$98 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, PostEditWidget_1, PostEditWidget = class extends Disposable {
	static {
		PostEditWidget_1 = this;
	}
	static {
		this.baseId = "editor.widget.postEditWidget";
	}
	constructor(e, O, k, A, j, M, N, P, F, I) {
		super(), this.typeId = e, this.editor = O, this.showCommand = A, this.range = j, this.edits = M, this.onSelectNewEdit = N, this._contextMenuService = P, this._keybindingService = I, this.allowEditorOverflow = !0, this.suppressMouseDown = !0, this.create(), this.visibleContext = k.bindTo(F), this.visibleContext.set(!0), this._register(toDisposable(() => this.visibleContext.reset())), this.editor.addContentWidget(this), this.editor.layoutContentWidget(this), this._register(toDisposable((() => this.editor.removeContentWidget(this)))), this._register(this.editor.onDidChangeCursorPosition((e) => {
			j.containsPosition(e.position) || this.dispose();
		})), this._register(Event.runAndSubscribe(I.onDidUpdateKeybindings, () => {
			this._updateButtonTitle();
		}));
	}
	_updateButtonTitle() {
		let e = this._keybindingService.lookupKeybinding(this.showCommand.id)?.getLabel();
		this.button.element.title = this.showCommand.label + (e ? ` (${e})` : "");
	}
	create() {
		this.domNode = $(".post-edit-widget"), this.button = this._register(new Button(this.domNode, { supportIcons: !0 })), this.button.label = "$(insert)", this._register(addDisposableListener(this.domNode, EventType$1.CLICK, () => this.showSelector()));
	}
	getId() {
		return PostEditWidget_1.baseId + "." + this.typeId;
	}
	getDomNode() {
		return this.domNode;
	}
	getPosition() {
		return {
			position: this.range.getEndPosition(),
			preference: [2]
		};
	}
	showSelector() {
		this._contextMenuService.showContextMenu({
			getAnchor: () => {
				let e = getDomNodePagePosition(this.button.element);
				return {
					x: e.left + e.width,
					y: e.top + e.height
				};
			},
			getActions: () => this.edits.allEdits.map((e, O) => toAction({
				id: "",
				label: e.title,
				checked: O === this.edits.activeEditIndex,
				run: () => {
					if (O !== this.edits.activeEditIndex) return this.onSelectNewEdit(O);
				}
			}))
		});
	}
};
PostEditWidget = PostEditWidget_1 = __decorate$98([
	__param$98(7, IContextMenuService),
	__param$98(8, IContextKeyService),
	__param$98(9, IKeybindingService)
], PostEditWidget);
var PostEditWidgetManager = class extends Disposable {
	constructor(e, O, k, A, j, M, N) {
		super(), this._id = e, this._editor = O, this._visibleContext = k, this._showCommand = A, this._instantiationService = j, this._bulkEditService = M, this._notificationService = N, this._currentWidget = this._register(new MutableDisposable()), this._register(Event.any(O.onDidChangeModel, O.onDidChangeModelContent)(() => this.clear()));
	}
	async applyEditAndShowIfNeeded(e, O, k, A, j) {
		let M = this._editor.getModel();
		if (!M || !e.length) return;
		let N = O.allEdits.at(O.activeEditIndex);
		if (!N) return;
		let P = async (M) => {
			let N = this._editor.getModel();
			N && (await N.undo(), this.applyEditAndShowIfNeeded(e, {
				activeEditIndex: M,
				allEdits: O.allEdits
			}, k, A, j));
		}, F = (A, j) => {
			isCancellationError(A) || (this._notificationService.error(j), k && this.show(e[0], O, P));
		}, I;
		try {
			I = await A(N, j);
		} catch (e) {
			return F(e, localize("resolveError", "Error resolving edit '{0}':\n{1}", N.title, toErrorMessage(e)));
		}
		if (j.isCancellationRequested) return;
		let L = createCombinedWorkspaceEdit(M.uri, e, I), R = e[0], z = M.deltaDecorations([], [{
			range: R,
			options: {
				description: "paste-line-suffix",
				stickiness: 0
			}
		}]);
		this._editor.focus();
		let B, V;
		try {
			B = await this._bulkEditService.apply(L, {
				editor: this._editor,
				token: j
			}), V = M.getDecorationRange(z[0]);
		} catch (e) {
			return F(e, localize("applyError", "Error applying edit '{0}':\n{1}", N.title, toErrorMessage(e)));
		} finally {
			M.deltaDecorations(z, []);
		}
		j.isCancellationRequested || k && B.isApplied && O.allEdits.length > 1 && this.show(V ?? R, O, P);
	}
	show(e, O, k) {
		this.clear(), this._editor.hasModel() && (this._currentWidget.value = this._instantiationService.createInstance(PostEditWidget, this._id, this._editor, this._visibleContext, this._showCommand, e, O, k));
	}
	clear() {
		this._currentWidget.clear();
	}
	tryShowSelector() {
		this._currentWidget.value?.showSelector();
	}
};
PostEditWidgetManager = __decorate$98([
	__param$98(4, IInstantiationService),
	__param$98(5, IBulkEditService),
	__param$98(6, INotificationService)
], PostEditWidgetManager);
var __decorate$97 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$97 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, CopyPasteController_1;
const changePasteTypeCommandId = "editor.changePasteType", pasteWidgetVisibleCtx = new RawContextKey("pasteWidgetVisible", !1, localize("pasteWidgetVisible", "Whether the paste widget is showing"));
var vscodeClipboardMime = "application/vnd.code.copyMetadata", CopyPasteController = class extends Disposable {
	static {
		CopyPasteController_1 = this;
	}
	static {
		this.ID = "editor.contrib.copyPasteActionController";
	}
	static get(e) {
		return e.getContribution(CopyPasteController_1.ID);
	}
	constructor(e, O, k, A, j, M, N) {
		super(), this._bulkEditService = k, this._clipboardService = A, this._languageFeaturesService = j, this._quickInputService = M, this._progressService = N, this._editor = e;
		let P = e.getContainerDomNode();
		this._register(addDisposableListener(P, "copy", (e) => this.handleCopy(e))), this._register(addDisposableListener(P, "cut", (e) => this.handleCopy(e))), this._register(addDisposableListener(P, "paste", (e) => this.handlePaste(e), !0)), this._pasteProgressManager = this._register(new InlineProgressManager("pasteIntoEditor", e, O)), this._postPasteWidgetManager = this._register(O.createInstance(PostEditWidgetManager, "pasteIntoEditor", e, pasteWidgetVisibleCtx, {
			id: changePasteTypeCommandId,
			label: localize("postPasteWidgetTitle", "Show paste options...")
		}));
	}
	changePasteType() {
		this._postPasteWidgetManager.tryShowSelector();
	}
	pasteAs(e) {
		this._editor.focus();
		try {
			this._pasteAsActionContext = { preferred: e }, getActiveDocument().execCommand("paste");
		} finally {
			this._pasteAsActionContext = void 0;
		}
	}
	clearWidgets() {
		this._postPasteWidgetManager.clear();
	}
	isPasteAsEnabled() {
		return this._editor.getOption(85).enabled;
	}
	async finishedPaste() {
		await this._currentPasteOperation;
	}
	handleCopy(e) {
		if (!this._editor.hasTextFocus() || (this._clipboardService.clearInternalState?.(), !e.clipboardData || !this.isPasteAsEnabled())) return;
		let O = this._editor.getModel(), k = this._editor.getSelections();
		if (!O || !k?.length) return;
		let A = this._editor.getOption(37), j = k, M = k.length === 1 && k[0].isEmpty();
		if (M) {
			if (!A) return;
			j = [new Range(j[0].startLineNumber, 1, j[0].startLineNumber, 1 + O.getLineLength(j[0].startLineNumber))];
		}
		let N = this._editor._getViewModel()?.getPlainTextToCopy(k, A, isWindows), P = {
			multicursorText: Array.isArray(N) ? N : null,
			pasteOnNewLine: M,
			mode: null
		}, F = this._languageFeaturesService.documentPasteEditProvider.ordered(O).filter((e) => !!e.prepareDocumentPaste);
		if (!F.length) {
			this.setCopyMetadata(e.clipboardData, { defaultPastePayload: P });
			return;
		}
		let I = toVSDataTransfer(e.clipboardData), L = F.flatMap((e) => e.copyMimeTypes ?? []), R = generateUuid();
		this.setCopyMetadata(e.clipboardData, {
			id: R,
			providerCopyMimeTypes: L,
			defaultPastePayload: P
		});
		let z = createCancelablePromise(async (e) => {
			let k = coalesce(await Promise.all(F.map(async (k) => {
				try {
					return await k.prepareDocumentPaste(O, j, I, e);
				} catch (e) {
					console.error(e);
					return;
				}
			})));
			k.reverse();
			for (let e of k) for (let [O, k] of e) I.replace(O, k);
			return I;
		});
		CopyPasteController_1._currentCopyOperation?.dataTransferPromise.cancel(), CopyPasteController_1._currentCopyOperation = {
			handle: R,
			dataTransferPromise: z
		};
	}
	async handlePaste(e) {
		if (!e.clipboardData || !this._editor.hasTextFocus()) return;
		MessageController.get(this._editor)?.closeMessage(), this._currentPasteOperation?.cancel(), this._currentPasteOperation = void 0;
		let O = this._editor.getModel(), k = this._editor.getSelections();
		if (!k?.length || !O || this._editor.getOption(92) || !this.isPasteAsEnabled() && !this._pasteAsActionContext) return;
		let A = this.fetchCopyMetadata(e), j = toExternalVSDataTransfer(e.clipboardData);
		j.delete(vscodeClipboardMime);
		let M = [
			...e.clipboardData.types,
			...A?.providerCopyMimeTypes ?? [],
			Mimes.uriList
		], N = this._languageFeaturesService.documentPasteEditProvider.ordered(O).filter((e) => {
			let O = this._pasteAsActionContext?.preferred;
			return O && e.providedPasteEditKinds && !this.providerMatchesPreference(e, O) ? !1 : e.pasteMimeTypes?.some((e) => matchesMimeType(e, M));
		});
		if (!N.length) {
			this._pasteAsActionContext?.preferred && this.showPasteAsNoEditMessage(k, this._pasteAsActionContext.preferred);
			return;
		}
		e.preventDefault(), e.stopImmediatePropagation(), this._pasteAsActionContext ? this.showPasteAsPick(this._pasteAsActionContext.preferred, N, k, j, A) : this.doPasteInline(N, k, j, A, e);
	}
	showPasteAsNoEditMessage(e, O) {
		MessageController.get(this._editor)?.showMessage(localize("pasteAsError", "No paste edits for '{0}' found", O instanceof HierarchicalKind ? O.value : O.providerId), e[0].getStartPosition());
	}
	doPasteInline(e, O, k, A, j) {
		let M = this._editor;
		if (!M.hasModel()) return;
		let N = new EditorStateCancellationTokenSource(M, 3, void 0), P = createCancelablePromise(async (M) => {
			let F = this._editor;
			if (!F.hasModel()) return;
			let I = F.getModel(), L = new DisposableStore(), R = L.add(new CancellationTokenSource(M));
			L.add(N.token.onCancellationRequested(() => R.cancel()));
			let z = R.token;
			try {
				if (await this.mergeInDataFromCopy(k, A, z), z.isCancellationRequested) return;
				let M = e.filter((e) => this.isSupportedPasteProvider(e, k));
				if (!M.length || M.length === 1 && M[0] instanceof DefaultTextPasteOrDropEditProvider) return this.applyDefaultPasteHandler(k, A, z, j);
				let N = { triggerKind: DocumentPasteTriggerKind.Automatic }, P = await this.getPasteEdits(M, k, I, O, N, z);
				if (L.add(P), z.isCancellationRequested) return;
				if (P.edits.length === 1 && P.edits[0].provider instanceof DefaultTextPasteOrDropEditProvider) return this.applyDefaultPasteHandler(k, A, z, j);
				if (P.edits.length) {
					let e = F.getOption(85).showPasteSelector === "afterPaste";
					return this._postPasteWidgetManager.applyEditAndShowIfNeeded(O, {
						activeEditIndex: 0,
						allEdits: P.edits
					}, e, (e, k) => new Promise((A, j) => {
						(async () => {
							try {
								let M = e.provider.resolveDocumentPasteEdit?.(e, k), N = new DeferredPromise(), P = M && await this._pasteProgressManager.showWhile(O[0].getEndPosition(), localize("resolveProcess", "Resolving paste edit. Click to cancel"), Promise.race([N.p, M]), { cancel: () => (N.cancel(), j(new CancellationError())) }, 0);
								return P && (e.additionalEdit = P.additionalEdit), A(e);
							} catch (e) {
								return j(e);
							}
						})();
					}), z);
				}
				await this.applyDefaultPasteHandler(k, A, z, j);
			} finally {
				L.dispose(), this._currentPasteOperation === P && (this._currentPasteOperation = void 0);
			}
		});
		this._pasteProgressManager.showWhile(O[0].getEndPosition(), localize("pasteIntoEditorProgress", "Running paste handlers. Click to cancel and do basic paste"), P, { cancel: async () => {
			try {
				if (P.cancel(), N.token.isCancellationRequested) return;
				await this.applyDefaultPasteHandler(k, A, N.token, j);
			} finally {
				N.dispose();
			}
		} }).then(() => {
			N.dispose();
		}), this._currentPasteOperation = P;
	}
	showPasteAsPick(e, O, k, A, j) {
		let M = createCancelablePromise(async (N) => {
			let P = this._editor;
			if (!P.hasModel()) return;
			let F = P.getModel(), I = new DisposableStore(), L = I.add(new EditorStateCancellationTokenSource(P, 3, void 0, N));
			try {
				if (await this.mergeInDataFromCopy(A, j, L.token), L.token.isCancellationRequested) return;
				let M = O.filter((O) => this.isSupportedPasteProvider(O, A, e));
				e && (M = M.filter((O) => this.providerMatchesPreference(O, e)));
				let N = {
					triggerKind: DocumentPasteTriggerKind.PasteAs,
					only: e && e instanceof HierarchicalKind ? e : void 0
				}, P = I.add(await this.getPasteEdits(M, A, F, k, N, L.token));
				if (L.token.isCancellationRequested) return;
				if (e && (P = {
					edits: P.edits.filter((O) => e instanceof HierarchicalKind ? e.contains(O.kind) : e.providerId === O.provider.id),
					dispose: P.dispose
				}), !P.edits.length) {
					N.only && this.showPasteAsNoEditMessage(k, N.only);
					return;
				}
				let R;
				if (R = e ? P.edits.at(0) : (await this._quickInputService.pick(P.edits.map((e) => ({
					label: e.title,
					description: e.kind?.value,
					edit: e
				})), { placeHolder: localize("pasteAsPickerPlaceholder", "Select Paste Action") }))?.edit, !R) return;
				let z = createCombinedWorkspaceEdit(F.uri, k, R);
				await this._bulkEditService.apply(z, { editor: this._editor });
			} finally {
				I.dispose(), this._currentPasteOperation === M && (this._currentPasteOperation = void 0);
			}
		});
		this._progressService.withProgress({
			location: 10,
			title: localize("pasteAsProgress", "Running paste handlers")
		}, () => M);
	}
	setCopyMetadata(e, O) {
		e.setData(vscodeClipboardMime, JSON.stringify(O));
	}
	fetchCopyMetadata(e) {
		if (!e.clipboardData) return;
		let O = e.clipboardData.getData(vscodeClipboardMime);
		if (O) try {
			return JSON.parse(O);
		} catch {
			return;
		}
		let [k, A] = ClipboardEventUtils.getTextData(e.clipboardData);
		if (A) return { defaultPastePayload: {
			mode: A.mode,
			multicursorText: A.multicursorText ?? null,
			pasteOnNewLine: !!A.isFromEmptySelection
		} };
	}
	async mergeInDataFromCopy(e, O, k) {
		if (O?.id && CopyPasteController_1._currentCopyOperation?.handle === O.id) {
			let O = await CopyPasteController_1._currentCopyOperation.dataTransferPromise;
			if (k.isCancellationRequested) return;
			for (let [k, A] of O) e.replace(k, A);
		}
		if (!e.has(Mimes.uriList)) {
			let O = await this._clipboardService.readResources();
			if (k.isCancellationRequested) return;
			O.length && e.append(Mimes.uriList, createStringDataTransferItem(UriList.create(O)));
		}
	}
	async getPasteEdits(e, O, k, A, j, M) {
		let N = new DisposableStore(), P = await raceCancellation(Promise.all(e.map(async (e) => {
			try {
				let P = await e.provideDocumentPasteEdits?.(k, A, O, j, M);
				return P && N.add(P), P?.edits?.map((O) => ({
					...O,
					provider: e
				}));
			} catch (e) {
				isCancellationError(e) || console.error(e);
				return;
			}
		})), M), F = coalesce(P ?? []).flat().filter((e) => !j.only || j.only.contains(e.kind));
		return {
			edits: sortEditsByYieldTo(F),
			dispose: () => N.dispose()
		};
	}
	async applyDefaultPasteHandler(e, O, k, A) {
		let j = await (e.get(Mimes.text) ?? e.get("text"))?.asString() ?? "";
		if (k.isCancellationRequested) return;
		let M = {
			clipboardEvent: A,
			text: j,
			pasteOnNewLine: O?.defaultPastePayload.pasteOnNewLine ?? !1,
			multicursorText: O?.defaultPastePayload.multicursorText ?? null,
			mode: null
		};
		this._editor.trigger("keyboard", "paste", M);
	}
	isSupportedPasteProvider(e, O, k) {
		return e.pasteMimeTypes?.some((e) => O.matches(e)) ? !k || this.providerMatchesPreference(e, k) : !1;
	}
	providerMatchesPreference(e, O) {
		return O instanceof HierarchicalKind ? e.providedPasteEditKinds ? e.providedPasteEditKinds.some((e) => O.contains(e)) : !0 : e.id === O.providerId;
	}
};
CopyPasteController = CopyPasteController_1 = __decorate$97([
	__param$97(1, IInstantiationService),
	__param$97(2, IBulkEditService),
	__param$97(3, IClipboardService),
	__param$97(4, ILanguageFeaturesService),
	__param$97(5, IQuickInputService),
	__param$97(6, IProgressService)
], CopyPasteController);
var CLIPBOARD_CONTEXT_MENU_GROUP = "9_cutcopypaste", supportsCut = isNative || document.queryCommandSupported("cut"), supportsCopy = isNative || document.queryCommandSupported("copy"), supportsPaste = navigator.clipboard === void 0 || isFirefox ? document.queryCommandSupported("paste") : !0;
function registerCommand(e) {
	return e.register(), e;
}
const CutAction = supportsCut ? registerCommand(new MultiCommand({
	id: "editor.action.clipboardCutAction",
	precondition: void 0,
	kbOpts: isNative ? {
		primary: 2102,
		win: {
			primary: 2102,
			secondary: [1044]
		},
		weight: 100
	} : void 0,
	menuOpts: [
		{
			menuId: MenuId.MenubarEditMenu,
			group: "2_ccp",
			title: localize({
				key: "miCut",
				comment: ["&& denotes a mnemonic"]
			}, "Cu&&t"),
			order: 1
		},
		{
			menuId: MenuId.EditorContext,
			group: CLIPBOARD_CONTEXT_MENU_GROUP,
			title: localize("actions.clipboard.cutLabel", "Cut"),
			when: EditorContextKeys.writable,
			order: 1
		},
		{
			menuId: MenuId.CommandPalette,
			group: "",
			title: localize("actions.clipboard.cutLabel", "Cut"),
			order: 1
		},
		{
			menuId: MenuId.SimpleEditorContext,
			group: CLIPBOARD_CONTEXT_MENU_GROUP,
			title: localize("actions.clipboard.cutLabel", "Cut"),
			when: EditorContextKeys.writable,
			order: 1
		}
	]
})) : void 0, CopyAction = supportsCopy ? registerCommand(new MultiCommand({
	id: "editor.action.clipboardCopyAction",
	precondition: void 0,
	kbOpts: isNative ? {
		primary: 2081,
		win: {
			primary: 2081,
			secondary: [2067]
		},
		weight: 100
	} : void 0,
	menuOpts: [
		{
			menuId: MenuId.MenubarEditMenu,
			group: "2_ccp",
			title: localize({
				key: "miCopy",
				comment: ["&& denotes a mnemonic"]
			}, "&&Copy"),
			order: 2
		},
		{
			menuId: MenuId.EditorContext,
			group: CLIPBOARD_CONTEXT_MENU_GROUP,
			title: localize("actions.clipboard.copyLabel", "Copy"),
			order: 2
		},
		{
			menuId: MenuId.CommandPalette,
			group: "",
			title: localize("actions.clipboard.copyLabel", "Copy"),
			order: 1
		},
		{
			menuId: MenuId.SimpleEditorContext,
			group: CLIPBOARD_CONTEXT_MENU_GROUP,
			title: localize("actions.clipboard.copyLabel", "Copy"),
			order: 2
		}
	]
})) : void 0;
MenuRegistry.appendMenuItem(MenuId.MenubarEditMenu, {
	submenu: MenuId.MenubarCopy,
	title: localize2("copy as", "Copy As"),
	group: "2_ccp",
	order: 3
}), MenuRegistry.appendMenuItem(MenuId.EditorContext, {
	submenu: MenuId.EditorContextCopy,
	title: localize2("copy as", "Copy As"),
	group: CLIPBOARD_CONTEXT_MENU_GROUP,
	order: 3
}), MenuRegistry.appendMenuItem(MenuId.EditorContext, {
	submenu: MenuId.EditorContextShare,
	title: localize2("share", "Share"),
	group: "11_share",
	order: -1,
	when: ContextKeyExpr.and(ContextKeyExpr.notEquals("resourceScheme", "output"), EditorContextKeys.editorTextFocus)
}), MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
	submenu: MenuId.ExplorerContextShare,
	title: localize2("share", "Share"),
	group: "11_share",
	order: -1
});
const PasteAction = supportsPaste ? registerCommand(new MultiCommand({
	id: "editor.action.clipboardPasteAction",
	precondition: void 0,
	kbOpts: isNative ? {
		primary: 2100,
		win: {
			primary: 2100,
			secondary: [1043]
		},
		linux: {
			primary: 2100,
			secondary: [1043]
		},
		weight: 100
	} : void 0,
	menuOpts: [
		{
			menuId: MenuId.MenubarEditMenu,
			group: "2_ccp",
			title: localize({
				key: "miPaste",
				comment: ["&& denotes a mnemonic"]
			}, "&&Paste"),
			order: 4
		},
		{
			menuId: MenuId.EditorContext,
			group: CLIPBOARD_CONTEXT_MENU_GROUP,
			title: localize("actions.clipboard.pasteLabel", "Paste"),
			when: EditorContextKeys.writable,
			order: 4
		},
		{
			menuId: MenuId.CommandPalette,
			group: "",
			title: localize("actions.clipboard.pasteLabel", "Paste"),
			order: 1
		},
		{
			menuId: MenuId.SimpleEditorContext,
			group: CLIPBOARD_CONTEXT_MENU_GROUP,
			title: localize("actions.clipboard.pasteLabel", "Paste"),
			when: EditorContextKeys.writable,
			order: 4
		}
	]
})) : void 0;
var ExecCommandCopyWithSyntaxHighlightingAction = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.clipboardCopyWithSyntaxHighlightingAction",
			label: localize("actions.clipboard.copyWithSyntaxHighlightingLabel", "Copy With Syntax Highlighting"),
			alias: "Copy With Syntax Highlighting",
			precondition: void 0,
			kbOpts: {
				kbExpr: EditorContextKeys.textInputFocus,
				primary: 0,
				weight: 100
			}
		});
	}
	run(e, O) {
		O.hasModel() && (!O.getOption(37) && O.getSelection().isEmpty() || (CopyOptions.forceCopyWithSyntaxHighlighting = !0, O.focus(), O.getContainerDomNode().ownerDocument.execCommand("copy"), CopyOptions.forceCopyWithSyntaxHighlighting = !1));
	}
};
function registerExecCommandImpl(e, O) {
	e && (e.addImplementation(1e4, "code-editor", (e, k) => {
		let A = e.get(ICodeEditorService).getFocusedCodeEditor();
		if (A && A.hasTextFocus()) {
			let e = A.getOption(37), k = A.getSelection();
			return k && k.isEmpty() && !e || A.getContainerDomNode().ownerDocument.execCommand(O), !0;
		}
		return !1;
	}), e.addImplementation(0, "generic-dom", (e, k) => (getActiveDocument().execCommand(O), !0)));
}
registerExecCommandImpl(CutAction, "cut"), registerExecCommandImpl(CopyAction, "copy"), PasteAction && (PasteAction.addImplementation(1e4, "code-editor", (e, O) => {
	let k = e.get(ICodeEditorService), A = e.get(IClipboardService), j = k.getFocusedCodeEditor();
	return j && j.hasTextFocus() ? j.getContainerDomNode().ownerDocument.execCommand("paste") ? CopyPasteController.get(j)?.finishedPaste() ?? Promise.resolve() : isWeb ? (async () => {
		let e = await A.readText();
		if (e !== "") {
			let O = InMemoryClipboardMetadataManager.INSTANCE.get(e), k = !1, A = null, M = null;
			O && (k = j.getOption(37) && !!O.isFromEmptySelection, A = O.multicursorText === void 0 ? null : O.multicursorText, M = O.mode), j.trigger("keyboard", "paste", {
				text: e,
				pasteOnNewLine: k,
				multicursorText: A,
				mode: M
			});
		}
	})() : !0 : !1;
}), PasteAction.addImplementation(0, "generic-dom", (e, O) => (getActiveDocument().execCommand("paste"), !0))), supportsCopy && registerEditorAction(ExecCommandCopyWithSyntaxHighlightingAction);
const CodeActionKind = new class {
	constructor() {
		this.QuickFix = new HierarchicalKind("quickfix"), this.Refactor = new HierarchicalKind("refactor"), this.RefactorExtract = this.Refactor.append("extract"), this.RefactorInline = this.Refactor.append("inline"), this.RefactorMove = this.Refactor.append("move"), this.RefactorRewrite = this.Refactor.append("rewrite"), this.Notebook = new HierarchicalKind("notebook"), this.Source = new HierarchicalKind("source"), this.SourceOrganizeImports = this.Source.append("organizeImports"), this.SourceFixAll = this.Source.append("fixAll"), this.SurroundWith = this.Refactor.append("surround");
	}
}();
var CodeActionTriggerSource;
(function(e) {
	e.Refactor = "refactor", e.RefactorPreview = "refactor preview", e.Lightbulb = "lightbulb", e.Default = "other (default)", e.SourceAction = "source action", e.QuickFix = "quick fix action", e.FixAll = "fix all", e.OrganizeImports = "organize imports", e.AutoFix = "auto fix", e.QuickFixHover = "quick fix hover window", e.OnSave = "save participants", e.ProblemsView = "problems view";
})(CodeActionTriggerSource ||= {});
function mayIncludeActionsOfKind(e, O) {
	return !(e.include && !e.include.intersects(O) || e.excludes && e.excludes.some((k) => excludesAction(O, k, e.include)) || !e.includeSourceActions && CodeActionKind.Source.contains(O));
}
function filtersAction(e, O) {
	let k = O.kind ? new HierarchicalKind(O.kind) : void 0;
	return !(e.include && (!k || !e.include.contains(k)) || e.excludes && k && e.excludes.some((O) => excludesAction(k, O, e.include)) || !e.includeSourceActions && k && CodeActionKind.Source.contains(k) || e.onlyIncludePreferredActions && !O.isPreferred);
}
function excludesAction(e, O, k) {
	return !(!O.contains(e) || k && O.contains(k));
}
var CodeActionCommandArgs = class e {
	static fromUser(O, k) {
		return !O || typeof O != "object" ? new e(k.kind, k.apply, !1) : new e(e.getKindFromUser(O, k.kind), e.getApplyFromUser(O, k.apply), e.getPreferredUser(O));
	}
	static getApplyFromUser(e, O) {
		switch (typeof e.apply == "string" ? e.apply.toLowerCase() : "") {
			case "first": return "first";
			case "never": return "never";
			case "ifsingle": return "ifSingle";
			default: return O;
		}
	}
	static getKindFromUser(e, O) {
		return typeof e.kind == "string" ? new HierarchicalKind(e.kind) : O;
	}
	static getPreferredUser(e) {
		return typeof e.preferred == "boolean" ? e.preferred : !1;
	}
	constructor(e, O, k) {
		this.kind = e, this.apply = O, this.preferred = k;
	}
}, CodeActionItem = class {
	constructor(e, O, k) {
		this.action = e, this.provider = O, this.highlightRange = k;
	}
	async resolve(e) {
		if (this.provider?.resolveCodeAction && !this.action.edit) {
			let O;
			try {
				O = await this.provider.resolveCodeAction(this.action, e);
			} catch (e) {
				onUnexpectedExternalError(e);
			}
			O && (this.action.edit = O.edit);
		}
		return this;
	}
};
const codeActionCommandId = "editor.action.codeAction", quickFixCommandId = "editor.action.quickFix", refactorCommandId = "editor.action.refactor", sourceActionCommandId = "editor.action.sourceAction", organizeImportsCommandId = "editor.action.organizeImports", fixAllCommandId = "editor.action.fixAll";
var ManagedCodeActionSet = class e extends Disposable {
	static codeActionsPreferredComparator(e, O) {
		return e.isPreferred && !O.isPreferred ? -1 : !e.isPreferred && O.isPreferred ? 1 : 0;
	}
	static codeActionsComparator({ action: O }, { action: k }) {
		return O.isAI && !k.isAI ? 1 : !O.isAI && k.isAI ? -1 : isNonEmptyArray(O.diagnostics) ? isNonEmptyArray(k.diagnostics) ? e.codeActionsPreferredComparator(O, k) : -1 : isNonEmptyArray(k.diagnostics) ? 1 : e.codeActionsPreferredComparator(O, k);
	}
	constructor(O, k, A) {
		super(), this.documentation = k, this._register(A), this.allActions = [...O].sort(e.codeActionsComparator), this.validActions = this.allActions.filter(({ action: e }) => !e.disabled);
	}
	get hasAutoFix() {
		return this.validActions.some(({ action: e }) => !!e.kind && CodeActionKind.QuickFix.contains(new HierarchicalKind(e.kind)) && !!e.isPreferred);
	}
	get hasAIFix() {
		return this.validActions.some(({ action: e }) => !!e.isAI);
	}
	get allAIFixes() {
		return this.validActions.every(({ action: e }) => !!e.isAI);
	}
}, emptyCodeActionsResponse = {
	actions: [],
	documentation: void 0
};
async function getCodeActions(e, O, k, A, j, M) {
	let N = A.filter || {}, P = {
		...N,
		excludes: [...N.excludes || [], CodeActionKind.Notebook]
	}, F = {
		only: N.include?.value,
		trigger: A.type
	}, I = new TextModelCancellationTokenSource(O, M), L = A.type === 2, R = getCodeActionProviders(e, O, L ? P : N), z = new DisposableStore(), B = R.map(async (e) => {
		try {
			j.report(e);
			let A = await e.provideCodeActions(O, k, F, I.token);
			if (A && z.add(A), I.token.isCancellationRequested) return emptyCodeActionsResponse;
			let M = (A?.actions || []).filter((e) => e && filtersAction(N, e)), P = getDocumentationFromProvider(e, M, N.include);
			return {
				actions: M.map((O) => new CodeActionItem(O, e)),
				documentation: P
			};
		} catch (e) {
			if (isCancellationError(e)) throw e;
			return onUnexpectedExternalError(e), emptyCodeActionsResponse;
		}
	}), V = e.onDidChange(() => {
		let k = e.all(O);
		equals(k, R) || I.cancel();
	});
	try {
		let k = await Promise.all(B), j = k.map((e) => e.actions).flat(), M = [...coalesce(k.map((e) => e.documentation)), ...getAdditionalDocumentationForShowingActions(e, O, A, j)];
		return new ManagedCodeActionSet(j, M, z);
	} finally {
		V.dispose(), I.dispose();
	}
}
function getCodeActionProviders(e, O, k) {
	return e.all(O).filter((e) => e.providedCodeActionKinds ? e.providedCodeActionKinds.some((e) => mayIncludeActionsOfKind(k, new HierarchicalKind(e))) : !0);
}
function* getAdditionalDocumentationForShowingActions(e, O, k, A) {
	if (O && A.length) for (let j of e.all(O)) j._getAdditionalMenuItems && (yield* j._getAdditionalMenuItems?.({
		trigger: k.type,
		only: k.filter?.include?.value
	}, A.map((e) => e.action)));
}
function getDocumentationFromProvider(e, O, k) {
	if (!e.documentation) return;
	let A = e.documentation.map((e) => ({
		kind: new HierarchicalKind(e.kind),
		command: e.command
	}));
	if (k) {
		let e;
		for (let O of A) O.kind.contains(k) && (e ? e.kind.contains(O.kind) && (e = O) : e = O);
		if (e) return e?.command;
	}
	for (let e of O) if (e.kind) {
		for (let O of A) if (O.kind.contains(new HierarchicalKind(e.kind))) return O.command;
	}
}
var ApplyCodeActionReason;
(function(e) {
	e.OnSave = "onSave", e.FromProblemsView = "fromProblemsView", e.FromCodeActions = "fromCodeActions", e.FromAILightbulb = "fromAILightbulb";
})(ApplyCodeActionReason ||= {});
async function applyCodeAction(e, O, k, A, j = CancellationToken.None) {
	let M = e.get(IBulkEditService), N = e.get(ICommandService), P = e.get(ITelemetryService), F = e.get(INotificationService);
	if (P.publicLog2("codeAction.applyCodeAction", {
		codeActionTitle: O.action.title,
		codeActionKind: O.action.kind,
		codeActionIsPreferred: !!O.action.isPreferred,
		reason: k
	}), await O.resolve(j), !j.isCancellationRequested && !(O.action.edit?.edits.length && !(await M.apply(O.action.edit, {
		editor: A?.editor,
		label: O.action.title,
		quotableLabel: O.action.title,
		code: "undoredo.codeAction",
		respectAutoSaveConfig: k !== ApplyCodeActionReason.OnSave,
		showPreview: A?.preview
	})).isApplied) && O.action.command) try {
		await N.executeCommand(O.action.command.id, ...O.action.command.arguments || []);
	} catch (e) {
		let O = asMessage(e);
		F.error(typeof O == "string" ? O : localize("applyCodeActionFailed", "An unknown error occurred while applying the code action"));
	}
}
function asMessage(e) {
	if (typeof e == "string") return e;
	if (e instanceof Error && typeof e.message == "string") return e.message;
}
CommandsRegistry.registerCommand("_executeCodeActionProvider", async function(e, O, k, A, M) {
	if (!(O instanceof URI)) throw illegalArgument();
	let { codeActionProvider: N } = e.get(ILanguageFeaturesService), P = e.get(IModelService).getModel(O);
	if (!P) throw illegalArgument();
	let F = Selection.isISelection(k) ? Selection.liftSelection(k) : Range.isIRange(k) ? P.validateRange(k) : void 0;
	if (!F) throw illegalArgument();
	let I = typeof A == "string" ? new HierarchicalKind(A) : void 0, L = await getCodeActions(N, P, F, {
		type: 1,
		triggerAction: CodeActionTriggerSource.Default,
		filter: {
			includeSourceActions: !0,
			include: I
		}
	}, Progress.None, CancellationToken.None), R = [], z = Math.min(L.validActions.length, typeof M == "number" ? M : 0);
	for (let e = 0; e < z; e++) R.push(L.validActions[e].resolve(CancellationToken.None));
	try {
		return await Promise.all(R), L.validActions.map((e) => e.action);
	} finally {
		setTimeout(() => L.dispose(), 100);
	}
});
var __decorate$96 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$96 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, CodeActionKeybindingResolver_1, CodeActionKeybindingResolver = class {
	static {
		CodeActionKeybindingResolver_1 = this;
	}
	static {
		this.codeActionCommands = [
			refactorCommandId,
			codeActionCommandId,
			sourceActionCommandId,
			organizeImportsCommandId,
			fixAllCommandId
		];
	}
	constructor(e) {
		this.keybindingService = e;
	}
	getResolver() {
		let e = new Lazy(() => this.keybindingService.getKeybindings().filter((e) => CodeActionKeybindingResolver_1.codeActionCommands.indexOf(e.command) >= 0).filter((e) => e.resolvedKeybinding).map((e) => {
			let O = e.commandArgs;
			return e.command === "editor.action.organizeImports" ? O = { kind: CodeActionKind.SourceOrganizeImports.value } : e.command === "editor.action.fixAll" && (O = { kind: CodeActionKind.SourceFixAll.value }), {
				resolvedKeybinding: e.resolvedKeybinding,
				...CodeActionCommandArgs.fromUser(O, {
					kind: HierarchicalKind.None,
					apply: "never"
				})
			};
		}));
		return (O) => {
			if (O.kind) return this.bestKeybindingForCodeAction(O, e.value)?.resolvedKeybinding;
		};
	}
	bestKeybindingForCodeAction(e, O) {
		if (!e.kind) return;
		let k = new HierarchicalKind(e.kind);
		return O.filter((e) => e.kind.contains(k)).filter((O) => O.preferred ? e.isPreferred : !0).reduceRight((e, O) => e ? e.kind.contains(O.kind) ? O : e : O, void 0);
	}
};
CodeActionKeybindingResolver = CodeActionKeybindingResolver_1 = __decorate$96([__param$96(0, IKeybindingService)], CodeActionKeybindingResolver), registerColor("symbolIcon.arrayForeground", foreground, localize("symbolIcon.arrayForeground", "The foreground color for array symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")), registerColor("symbolIcon.booleanForeground", foreground, localize("symbolIcon.booleanForeground", "The foreground color for boolean symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")), registerColor("symbolIcon.classForeground", {
	dark: "#EE9D28",
	light: "#D67E00",
	hcDark: "#EE9D28",
	hcLight: "#D67E00"
}, localize("symbolIcon.classForeground", "The foreground color for class symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")), registerColor("symbolIcon.colorForeground", foreground, localize("symbolIcon.colorForeground", "The foreground color for color symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")), registerColor("symbolIcon.constantForeground", foreground, localize("symbolIcon.constantForeground", "The foreground color for constant symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")), registerColor("symbolIcon.constructorForeground", {
	dark: "#B180D7",
	light: "#652D90",
	hcDark: "#B180D7",
	hcLight: "#652D90"
}, localize("symbolIcon.constructorForeground", "The foreground color for constructor symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")), registerColor("symbolIcon.enumeratorForeground", {
	dark: "#EE9D28",
	light: "#D67E00",
	hcDark: "#EE9D28",
	hcLight: "#D67E00"
}, localize("symbolIcon.enumeratorForeground", "The foreground color for enumerator symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")), registerColor("symbolIcon.enumeratorMemberForeground", {
	dark: "#75BEFF",
	light: "#007ACC",
	hcDark: "#75BEFF",
	hcLight: "#007ACC"
}, localize("symbolIcon.enumeratorMemberForeground", "The foreground color for enumerator member symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")), registerColor("symbolIcon.eventForeground", {
	dark: "#EE9D28",
	light: "#D67E00",
	hcDark: "#EE9D28",
	hcLight: "#D67E00"
}, localize("symbolIcon.eventForeground", "The foreground color for event symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")), registerColor("symbolIcon.fieldForeground", {
	dark: "#75BEFF",
	light: "#007ACC",
	hcDark: "#75BEFF",
	hcLight: "#007ACC"
}, localize("symbolIcon.fieldForeground", "The foreground color for field symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")), registerColor("symbolIcon.fileForeground", foreground, localize("symbolIcon.fileForeground", "The foreground color for file symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")), registerColor("symbolIcon.folderForeground", foreground, localize("symbolIcon.folderForeground", "The foreground color for folder symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")), registerColor("symbolIcon.functionForeground", {
	dark: "#B180D7",
	light: "#652D90",
	hcDark: "#B180D7",
	hcLight: "#652D90"
}, localize("symbolIcon.functionForeground", "The foreground color for function symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")), registerColor("symbolIcon.interfaceForeground", {
	dark: "#75BEFF",
	light: "#007ACC",
	hcDark: "#75BEFF",
	hcLight: "#007ACC"
}, localize("symbolIcon.interfaceForeground", "The foreground color for interface symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")), registerColor("symbolIcon.keyForeground", foreground, localize("symbolIcon.keyForeground", "The foreground color for key symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")), registerColor("symbolIcon.keywordForeground", foreground, localize("symbolIcon.keywordForeground", "The foreground color for keyword symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")), registerColor("symbolIcon.methodForeground", {
	dark: "#B180D7",
	light: "#652D90",
	hcDark: "#B180D7",
	hcLight: "#652D90"
}, localize("symbolIcon.methodForeground", "The foreground color for method symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")), registerColor("symbolIcon.moduleForeground", foreground, localize("symbolIcon.moduleForeground", "The foreground color for module symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")), registerColor("symbolIcon.namespaceForeground", foreground, localize("symbolIcon.namespaceForeground", "The foreground color for namespace symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")), registerColor("symbolIcon.nullForeground", foreground, localize("symbolIcon.nullForeground", "The foreground color for null symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")), registerColor("symbolIcon.numberForeground", foreground, localize("symbolIcon.numberForeground", "The foreground color for number symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")), registerColor("symbolIcon.objectForeground", foreground, localize("symbolIcon.objectForeground", "The foreground color for object symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")), registerColor("symbolIcon.operatorForeground", foreground, localize("symbolIcon.operatorForeground", "The foreground color for operator symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")), registerColor("symbolIcon.packageForeground", foreground, localize("symbolIcon.packageForeground", "The foreground color for package symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")), registerColor("symbolIcon.propertyForeground", foreground, localize("symbolIcon.propertyForeground", "The foreground color for property symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")), registerColor("symbolIcon.referenceForeground", foreground, localize("symbolIcon.referenceForeground", "The foreground color for reference symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")), registerColor("symbolIcon.snippetForeground", foreground, localize("symbolIcon.snippetForeground", "The foreground color for snippet symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")), registerColor("symbolIcon.stringForeground", foreground, localize("symbolIcon.stringForeground", "The foreground color for string symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")), registerColor("symbolIcon.structForeground", foreground, localize("symbolIcon.structForeground", "The foreground color for struct symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")), registerColor("symbolIcon.textForeground", foreground, localize("symbolIcon.textForeground", "The foreground color for text symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")), registerColor("symbolIcon.typeParameterForeground", foreground, localize("symbolIcon.typeParameterForeground", "The foreground color for type parameter symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")), registerColor("symbolIcon.unitForeground", foreground, localize("symbolIcon.unitForeground", "The foreground color for unit symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")), registerColor("symbolIcon.variableForeground", {
	dark: "#75BEFF",
	light: "#007ACC",
	hcDark: "#75BEFF",
	hcLight: "#007ACC"
}, localize("symbolIcon.variableForeground", "The foreground color for variable symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));
var uncategorizedCodeActionGroup = Object.freeze({
	kind: HierarchicalKind.Empty,
	title: localize("codeAction.widget.id.more", "More Actions...")
}), codeActionGroups = Object.freeze([
	{
		kind: CodeActionKind.QuickFix,
		title: localize("codeAction.widget.id.quickfix", "Quick Fix")
	},
	{
		kind: CodeActionKind.RefactorExtract,
		title: localize("codeAction.widget.id.extract", "Extract"),
		icon: Codicon.wrench
	},
	{
		kind: CodeActionKind.RefactorInline,
		title: localize("codeAction.widget.id.inline", "Inline"),
		icon: Codicon.wrench
	},
	{
		kind: CodeActionKind.RefactorRewrite,
		title: localize("codeAction.widget.id.convert", "Rewrite"),
		icon: Codicon.wrench
	},
	{
		kind: CodeActionKind.RefactorMove,
		title: localize("codeAction.widget.id.move", "Move"),
		icon: Codicon.wrench
	},
	{
		kind: CodeActionKind.SurroundWith,
		title: localize("codeAction.widget.id.surround", "Surround With"),
		icon: Codicon.surroundWith
	},
	{
		kind: CodeActionKind.Source,
		title: localize("codeAction.widget.id.source", "Source Action"),
		icon: Codicon.symbolFile
	},
	uncategorizedCodeActionGroup
]);
function toMenuItems(e, O, k) {
	if (!O) return e.map((e) => ({
		kind: "action",
		item: e,
		group: uncategorizedCodeActionGroup,
		disabled: !!e.action.disabled,
		label: e.action.disabled || e.action.title,
		canPreview: !!e.action.edit?.edits.length
	}));
	let A = codeActionGroups.map((e) => ({
		group: e,
		actions: []
	}));
	for (let O of e) {
		let e = O.action.kind ? new HierarchicalKind(O.action.kind) : HierarchicalKind.None;
		for (let k of A) if (k.group.kind.contains(e)) {
			k.actions.push(O);
			break;
		}
	}
	let j = [];
	for (let e of A) if (e.actions.length) {
		j.push({
			kind: "header",
			group: e.group
		});
		for (let O of e.actions) {
			let A = e.group;
			j.push({
				kind: "action",
				item: O,
				group: O.action.isAI ? {
					title: A.title,
					kind: A.kind,
					icon: Codicon.sparkle
				} : A,
				label: O.action.title,
				disabled: !!O.action.disabled,
				keybinding: k(O.action)
			});
		}
	}
	return j;
}
var __decorate$95 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$95 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, LightBulbWidget_1, GUTTER_LIGHTBULB_ICON = registerIcon("gutter-lightbulb", Codicon.lightBulb, localize("gutterLightbulbWidget", "Icon which spawns code actions menu from the gutter when there is no space in the editor.")), GUTTER_LIGHTBULB_AUTO_FIX_ICON = registerIcon("gutter-lightbulb-auto-fix", Codicon.lightbulbAutofix, localize("gutterLightbulbAutoFixWidget", "Icon which spawns code actions menu from the gutter when there is no space in the editor and a quick fix is available.")), GUTTER_LIGHTBULB_AIFIX_ICON = registerIcon("gutter-lightbulb-sparkle", Codicon.lightbulbSparkle, localize("gutterLightbulbAIFixWidget", "Icon which spawns code actions menu from the gutter when there is no space in the editor and an AI fix is available.")), GUTTER_LIGHTBULB_AIFIX_AUTO_FIX_ICON = registerIcon("gutter-lightbulb-aifix-auto-fix", Codicon.lightbulbSparkleAutofix, localize("gutterLightbulbAIFixAutoFixWidget", "Icon which spawns code actions menu from the gutter when there is no space in the editor and an AI fix and a quick fix is available.")), GUTTER_SPARKLE_FILLED_ICON = registerIcon("gutter-lightbulb-sparkle-filled", Codicon.sparkleFilled, localize("gutterLightbulbSparkleFilledWidget", "Icon which spawns code actions menu from the gutter when there is no space in the editor and an AI fix and a quick fix is available.")), LightBulbState;
(function(e) {
	e.Hidden = { type: 0 };
	class O {
		constructor(e, O, k, A) {
			this.actions = e, this.trigger = O, this.editorPosition = k, this.widgetPosition = A, this.type = 1;
		}
	}
	e.Showing = O;
})(LightBulbState ||= {});
var LightBulbWidget = class extends Disposable {
	static {
		LightBulbWidget_1 = this;
	}
	static {
		this.GUTTER_DECORATION = ModelDecorationOptions.register({
			description: "codicon-gutter-lightbulb-decoration",
			glyphMarginClassName: ThemeIcon.asClassName(Codicon.lightBulb),
			glyphMargin: { position: GlyphMarginLane.Left },
			stickiness: 1
		});
	}
	static {
		this.ID = "editor.contrib.lightbulbWidget";
	}
	static {
		this._posPref = [0];
	}
	constructor(e, O) {
		super(), this._editor = e, this._keybindingService = O, this._onClick = this._register(new Emitter()), this.onClick = this._onClick.event, this._state = LightBulbState.Hidden, this._gutterState = LightBulbState.Hidden, this._iconClasses = [], this.lightbulbClasses = [
			"codicon-" + GUTTER_LIGHTBULB_ICON.id,
			"codicon-" + GUTTER_LIGHTBULB_AIFIX_AUTO_FIX_ICON.id,
			"codicon-" + GUTTER_LIGHTBULB_AUTO_FIX_ICON.id,
			"codicon-" + GUTTER_LIGHTBULB_AIFIX_ICON.id,
			"codicon-" + GUTTER_SPARKLE_FILLED_ICON.id
		], this.gutterDecoration = LightBulbWidget_1.GUTTER_DECORATION, this._domNode = $("div.lightBulbWidget"), this._domNode.role = "listbox", this._register(Gesture.ignoreTarget(this._domNode)), this._editor.addContentWidget(this), this._register(this._editor.onDidChangeModelContent((e) => {
			let O = this._editor.getModel();
			(this.state.type !== 1 || !O || this.state.editorPosition.lineNumber >= O.getLineCount()) && this.hide(), (this.gutterState.type !== 1 || !O || this.gutterState.editorPosition.lineNumber >= O.getLineCount()) && this.gutterHide();
		})), this._register(addStandardDisposableGenericMouseDownListener(this._domNode, (e) => {
			if (this.state.type !== 1) return;
			this._editor.focus(), e.preventDefault();
			let { top: O, height: k } = getDomNodePagePosition(this._domNode), A = this._editor.getOption(67), j = Math.floor(A / 3);
			this.state.widgetPosition.position !== null && this.state.widgetPosition.position.lineNumber < this.state.editorPosition.lineNumber && (j += A), this._onClick.fire({
				x: e.posx,
				y: O + k + j,
				actions: this.state.actions,
				trigger: this.state.trigger
			});
		})), this._register(addDisposableListener(this._domNode, "mouseenter", (e) => {
			(e.buttons & 1) == 1 && this.hide();
		})), this._register(Event.runAndSubscribe(this._keybindingService.onDidUpdateKeybindings, () => {
			this._preferredKbLabel = this._keybindingService.lookupKeybinding("editor.action.autoFix")?.getLabel() ?? void 0, this._quickFixKbLabel = this._keybindingService.lookupKeybinding("editor.action.quickFix")?.getLabel() ?? void 0, this._updateLightBulbTitleAndIcon();
		})), this._register(this._editor.onMouseDown(async (e) => {
			if (!e.target.element || !this.lightbulbClasses.some((O) => e.target.element && e.target.element.classList.contains(O)) || this.gutterState.type !== 1) return;
			this._editor.focus();
			let { top: O, height: k } = getDomNodePagePosition(e.target.element), A = this._editor.getOption(67), j = Math.floor(A / 3);
			this.gutterState.widgetPosition.position !== null && this.gutterState.widgetPosition.position.lineNumber < this.gutterState.editorPosition.lineNumber && (j += A), this._onClick.fire({
				x: e.event.posx,
				y: O + k + j,
				actions: this.gutterState.actions,
				trigger: this.gutterState.trigger
			});
		}));
	}
	dispose() {
		super.dispose(), this._editor.removeContentWidget(this), this._gutterDecorationID && this._removeGutterDecoration(this._gutterDecorationID);
	}
	getId() {
		return "LightBulbWidget";
	}
	getDomNode() {
		return this._domNode;
	}
	getPosition() {
		return this._state.type === 1 ? this._state.widgetPosition : null;
	}
	update(e, O, k) {
		if (e.validActions.length <= 0 || !this._editor.hasTextFocus() || !this._editor.getOptions().get(65).enabled) return this.gutterHide(), this.hide();
		let A = this._editor.getModel();
		if (!A) return this.gutterHide(), this.hide();
		let { lineNumber: j, column: M } = A.validatePosition(k), N = A.getOptions().tabSize, P = this._editor.getOptions().get(50), F = A.getLineContent(j), I = computeIndentLevel(F, N), L = P.spaceWidth * I > 22, R = (e) => e > 2 && this._editor.getTopForLineNumber(e) === this._editor.getTopForLineNumber(e - 1), z = this._editor.getLineDecorations(j), B = !1;
		if (z) for (let e of z) {
			let O = e.options.glyphMarginClassName;
			if (O && !this.lightbulbClasses.some((e) => O.includes(e))) {
				B = !0;
				break;
			}
		}
		let V = j, H = 1;
		if (!L) {
			let N = (e) => {
				let O = A.getLineContent(e);
				return /^\s*$|^\s+/.test(O) || O.length <= H;
			};
			if (j > 1 && !R(j - 1)) {
				let M = A.getLineCount(), P = j === M, F = j > 1 && N(j - 1), I = !P && N(j + 1), L = N(j), R = !I && !F;
				if (!I && !F && !B) return this.gutterState = new LightBulbState.Showing(e, O, k, {
					position: {
						lineNumber: V,
						column: H
					},
					preference: LightBulbWidget_1._posPref
				}), this.renderGutterLightbub(), this.hide();
				F || P || F && !L ? --V : (I || R && L) && (V += 1);
			} else if (j === 1 && (j === A.getLineCount() || !N(j + 1) && !N(j))) if (this.gutterState = new LightBulbState.Showing(e, O, k, {
				position: {
					lineNumber: V,
					column: H
				},
				preference: LightBulbWidget_1._posPref
			}), B) this.gutterHide();
			else return this.renderGutterLightbub(), this.hide();
			else if (j < A.getLineCount() && !R(j + 1)) V += 1;
			else if (M * P.spaceWidth < 22) return this.hide();
			H = /^\S\s*$/.test(A.getLineContent(V)) ? 2 : 1;
		}
		this.state = new LightBulbState.Showing(e, O, k, {
			position: {
				lineNumber: V,
				column: H
			},
			preference: LightBulbWidget_1._posPref
		}), this._gutterDecorationID && (this._removeGutterDecoration(this._gutterDecorationID), this.gutterHide());
		let U = e.validActions, W = e.validActions[0].action.kind;
		if (U.length !== 1 || !W) {
			this._editor.layoutContentWidget(this);
			return;
		}
		this._editor.layoutContentWidget(this);
	}
	hide() {
		this.state !== LightBulbState.Hidden && (this.state = LightBulbState.Hidden, this._editor.layoutContentWidget(this));
	}
	gutterHide() {
		this.gutterState !== LightBulbState.Hidden && (this._gutterDecorationID && this._removeGutterDecoration(this._gutterDecorationID), this.gutterState = LightBulbState.Hidden);
	}
	get state() {
		return this._state;
	}
	set state(e) {
		this._state = e, this._updateLightBulbTitleAndIcon();
	}
	get gutterState() {
		return this._gutterState;
	}
	set gutterState(e) {
		this._gutterState = e, this._updateGutterLightBulbTitleAndIcon();
	}
	_updateLightBulbTitleAndIcon() {
		if (this._domNode.classList.remove(...this._iconClasses), this._iconClasses = [], this.state.type !== 1) return;
		let e, O = !1;
		this.state.actions.allAIFixes ? (e = Codicon.sparkleFilled, this.state.actions.validActions.length === 1 && (O = !0)) : e = this.state.actions.hasAutoFix ? this.state.actions.hasAIFix ? Codicon.lightbulbSparkleAutofix : Codicon.lightbulbAutofix : this.state.actions.hasAIFix ? Codicon.lightbulbSparkle : Codicon.lightBulb, this._updateLightbulbTitle(this.state.actions.hasAutoFix, O), this._iconClasses = ThemeIcon.asClassNameArray(e), this._domNode.classList.add(...this._iconClasses);
	}
	_updateGutterLightBulbTitleAndIcon() {
		if (this.gutterState.type !== 1) return;
		let e, O = !1;
		this.gutterState.actions.allAIFixes ? (e = GUTTER_SPARKLE_FILLED_ICON, this.gutterState.actions.validActions.length === 1 && (O = !0)) : e = this.gutterState.actions.hasAutoFix ? this.gutterState.actions.hasAIFix ? GUTTER_LIGHTBULB_AIFIX_AUTO_FIX_ICON : GUTTER_LIGHTBULB_AUTO_FIX_ICON : this.gutterState.actions.hasAIFix ? GUTTER_LIGHTBULB_AIFIX_ICON : GUTTER_LIGHTBULB_ICON, this._updateLightbulbTitle(this.gutterState.actions.hasAutoFix, O), this.gutterDecoration = ModelDecorationOptions.register({
			description: "codicon-gutter-lightbulb-decoration",
			glyphMarginClassName: ThemeIcon.asClassName(e),
			glyphMargin: { position: GlyphMarginLane.Left },
			stickiness: 1
		});
	}
	renderGutterLightbub() {
		let e = this._editor.getSelection();
		e && (this._gutterDecorationID === void 0 ? this._addGutterDecoration(e.startLineNumber) : this._updateGutterDecoration(this._gutterDecorationID, e.startLineNumber));
	}
	_addGutterDecoration(e) {
		this._editor.changeDecorations((O) => {
			this._gutterDecorationID = O.addDecoration(new Range(e, 0, e, 0), this.gutterDecoration);
		});
	}
	_removeGutterDecoration(e) {
		this._editor.changeDecorations((O) => {
			O.removeDecoration(e), this._gutterDecorationID = void 0;
		});
	}
	_updateGutterDecoration(e, O) {
		this._editor.changeDecorations((k) => {
			k.changeDecoration(e, new Range(O, 0, O, 0)), k.changeDecorationOptions(e, this.gutterDecoration);
		});
	}
	_updateLightbulbTitle(e, O) {
		this.state.type === 1 && (O ? this.title = localize("codeActionAutoRun", "Run: {0}", this.state.actions.validActions[0].action.title) : e && this._preferredKbLabel ? this.title = localize("preferredcodeActionWithKb", "Show Code Actions. Preferred Quick Fix Available ({0})", this._preferredKbLabel) : !e && this._quickFixKbLabel ? this.title = localize("codeActionWithKb", "Show Code Actions ({0})", this._quickFixKbLabel) : e || (this.title = localize("codeAction", "Show Code Actions")));
	}
	set title(e) {
		this._domNode.title = e;
	}
};
LightBulbWidget = LightBulbWidget_1 = __decorate$95([__param$95(1, IKeybindingService)], LightBulbWidget);
var __decorate$94 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$94 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
};
const acceptSelectedActionCommand = "acceptSelectedCodeAction", previewSelectedActionCommand = "previewSelectedCodeAction";
var HeaderRenderer = class {
	get templateId() {
		return "header";
	}
	renderTemplate(e) {
		e.classList.add("group-header");
		let O = document.createElement("span");
		return e.append(O), {
			container: e,
			text: O
		};
	}
	renderElement(e, O, k) {
		k.text.textContent = e.group?.title ?? "";
	}
	disposeTemplate(e) {}
}, ActionItemRenderer = class {
	get templateId() {
		return "action";
	}
	constructor(e, O) {
		this._supportsPreview = e, this._keybindingService = O;
	}
	renderTemplate(e) {
		e.classList.add(this.templateId);
		let O = document.createElement("div");
		O.className = "icon", e.append(O);
		let k = document.createElement("span");
		k.className = "title", e.append(k);
		let A = new KeybindingLabel(e, OS);
		return {
			container: e,
			icon: O,
			text: k,
			keybinding: A
		};
	}
	renderElement(e, O, k) {
		if (e.group?.icon ? (k.icon.className = ThemeIcon.asClassName(e.group.icon), e.group.icon.color && (k.icon.style.color = asCssVariable(e.group.icon.color.id))) : (k.icon.className = ThemeIcon.asClassName(Codicon.lightBulb), k.icon.style.color = "var(--vscode-editorLightBulb-foreground)"), !e.item || !e.label) return;
		k.text.textContent = stripNewlines(e.label), k.keybinding.set(e.keybinding), setVisibility(!!e.keybinding, k.keybinding.element);
		let A = this._keybindingService.lookupKeybinding(acceptSelectedActionCommand)?.getLabel(), j = this._keybindingService.lookupKeybinding(previewSelectedActionCommand)?.getLabel();
		k.container.classList.toggle("option-disabled", e.disabled), e.disabled ? k.container.title = e.label : A && j ? this._supportsPreview && e.canPreview ? k.container.title = localize({
			key: "label-preview",
			comment: ["placeholders are keybindings, e.g \"F2 to Apply, Shift+F2 to Preview\""]
		}, "{0} to Apply, {1} to Preview", A, j) : k.container.title = localize({
			key: "label",
			comment: ["placeholder is a keybinding, e.g \"F2 to Apply\""]
		}, "{0} to Apply", A) : k.container.title = "";
	}
	disposeTemplate(e) {
		e.keybinding.dispose();
	}
};
ActionItemRenderer = __decorate$94([__param$94(1, IKeybindingService)], ActionItemRenderer);
var AcceptSelectedEvent = class extends UIEvent {
	constructor() {
		super("acceptSelectedAction");
	}
}, PreviewSelectedEvent = class extends UIEvent {
	constructor() {
		super("previewSelectedAction");
	}
};
function getKeyboardNavigationLabel(e) {
	if (e.kind === "action") return e.label;
}
var ActionList = class extends Disposable {
	constructor(e, O, k, A, j, M) {
		super(), this._delegate = A, this._contextViewService = j, this._keybindingService = M, this._actionLineHeight = 24, this._headerLineHeight = 26, this.cts = this._register(new CancellationTokenSource()), this.domNode = document.createElement("div"), this.domNode.classList.add("actionList"), this._list = this._register(new List(e, this.domNode, {
			getHeight: (e) => e.kind === "header" ? this._headerLineHeight : this._actionLineHeight,
			getTemplateId: (e) => e.kind
		}, [new ActionItemRenderer(O, this._keybindingService), new HeaderRenderer()], {
			keyboardSupport: !1,
			typeNavigationEnabled: !0,
			keyboardNavigationLabelProvider: { getKeyboardNavigationLabel },
			accessibilityProvider: {
				getAriaLabel: (e) => {
					if (e.kind === "action") {
						let O = e.label ? stripNewlines(e?.label) : "";
						return e.disabled && (O = localize({
							key: "customQuickFixWidget.labels",
							comment: ["Action widget labels for accessibility."]
						}, "{0}, Disabled Reason: {1}", O, e.disabled)), O;
					}
					return null;
				},
				getWidgetAriaLabel: () => localize({
					key: "customQuickFixWidget",
					comment: ["An action widget option"]
				}, "Action Widget"),
				getRole: (e) => e.kind === "action" ? "option" : "separator",
				getWidgetRole: () => "listbox"
			}
		})), this._list.style(defaultListStyles), this._register(this._list.onMouseClick((e) => this.onListClick(e))), this._register(this._list.onMouseOver((e) => this.onListHover(e))), this._register(this._list.onDidChangeFocus(() => this.onFocus())), this._register(this._list.onDidChangeSelection((e) => this.onListSelection(e))), this._allMenuItems = k, this._list.splice(0, this._list.length, this._allMenuItems), this._list.length && this.focusNext();
	}
	focusCondition(e) {
		return !e.disabled && e.kind === "action";
	}
	hide(e) {
		this._delegate.onHide(e), this.cts.cancel(), this._contextViewService.hideContextView();
	}
	layout(e) {
		let O = this._allMenuItems.filter((e) => e.kind === "header").length, k = this._allMenuItems.length * this._actionLineHeight + O * this._headerLineHeight - O * this._actionLineHeight;
		this._list.layout(k);
		let A = e;
		if (this._allMenuItems.length >= 50) A = 380;
		else {
			let O = this._allMenuItems.map((e, O) => {
				let k = this.domNode.ownerDocument.getElementById(this._list.getElementID(O));
				if (k) {
					k.style.width = "auto";
					let e = k.getBoundingClientRect().width;
					return k.style.width = "", e;
				}
				return 0;
			});
			A = Math.max(...O, e);
		}
		let j = Math.min(k, this.domNode.ownerDocument.body.clientHeight * .7);
		return this._list.layout(j, A), this.domNode.style.height = `${j}px`, this._list.domFocus(), A;
	}
	focusPrevious() {
		this._list.focusPrevious(1, !0, void 0, this.focusCondition);
	}
	focusNext() {
		this._list.focusNext(1, !0, void 0, this.focusCondition);
	}
	acceptSelected(e) {
		let O = this._list.getFocus();
		if (O.length === 0) return;
		let k = O[0], A = this._list.element(k);
		if (!this.focusCondition(A)) return;
		let j = e ? new PreviewSelectedEvent() : new AcceptSelectedEvent();
		this._list.setSelection([k], j);
	}
	onListSelection(e) {
		if (!e.elements.length) return;
		let O = e.elements[0];
		O.item && this.focusCondition(O) ? this._delegate.onSelect(O.item, e.browserEvent instanceof PreviewSelectedEvent) : this._list.setSelection([]);
	}
	onFocus() {
		let e = this._list.getFocus();
		if (e.length === 0) return;
		let O = e[0], k = this._list.element(O);
		this._delegate.onFocus?.(k.item);
	}
	async onListHover(e) {
		let O = e.element;
		if (O && O.item && this.focusCondition(O)) {
			if (this._delegate.onHover && !O.disabled && O.kind === "action") {
				let e = await this._delegate.onHover(O.item, this.cts.token);
				O.canPreview = e ? e.canPreview : void 0;
			}
			e.index && this._list.splice(e.index, 1, [O]);
		}
		this._list.setFocus(typeof e.index == "number" ? [e.index] : []);
	}
	onListClick(e) {
		e.element && this.focusCondition(e.element) && this._list.setFocus([]);
	}
};
ActionList = __decorate$94([__param$94(4, IContextViewService), __param$94(5, IKeybindingService)], ActionList);
function stripNewlines(e) {
	return e.replace(/\r\n|\r|\n/g, " ");
}
var __decorate$93 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$93 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
};
registerColor("actionBar.toggledBackground", inputActiveOptionBackground, localize("actionBar.toggledBackground", "Background color for toggled action items in action bar."));
var ActionWidgetContextKeys = { Visible: new RawContextKey("codeActionMenuVisible", !1, localize("codeActionMenuVisible", "Whether the action widget list is visible")) };
const IActionWidgetService = createDecorator("actionWidgetService");
var ActionWidgetService = class extends Disposable {
	get isVisible() {
		return ActionWidgetContextKeys.Visible.getValue(this._contextKeyService) || !1;
	}
	constructor(e, O, k) {
		super(), this._contextViewService = e, this._contextKeyService = O, this._instantiationService = k, this._list = this._register(new MutableDisposable());
	}
	show(e, O, k, A, j, M, N) {
		let P = ActionWidgetContextKeys.Visible.bindTo(this._contextKeyService), F = this._instantiationService.createInstance(ActionList, e, O, k, A);
		this._contextViewService.showContextView({
			getAnchor: () => j,
			render: (e) => (P.set(!0), this._renderWidget(e, F, N ?? [])),
			onHide: (e) => {
				P.reset(), this._onWidgetClosed(e);
			}
		}, M, !1);
	}
	acceptSelected(e) {
		this._list.value?.acceptSelected(e);
	}
	focusPrevious() {
		this._list?.value?.focusPrevious();
	}
	focusNext() {
		this._list?.value?.focusNext();
	}
	hide(e) {
		this._list.value?.hide(e), this._list.clear();
	}
	_renderWidget(e, O, k) {
		let A = document.createElement("div");
		if (A.classList.add("action-widget"), e.appendChild(A), this._list.value = O, this._list.value) A.appendChild(this._list.value.domNode);
		else throw Error("List has no value");
		let j = new DisposableStore(), M = document.createElement("div"), N = e.appendChild(M);
		N.classList.add("context-view-block"), j.add(addDisposableListener(N, EventType$1.MOUSE_DOWN, (e) => e.stopPropagation()));
		let P = document.createElement("div"), F = e.appendChild(P);
		F.classList.add("context-view-pointerBlock"), j.add(addDisposableListener(F, EventType$1.POINTER_MOVE, () => F.remove())), j.add(addDisposableListener(F, EventType$1.MOUSE_DOWN, () => F.remove()));
		let I = 0;
		if (k.length) {
			let e = this._createActionBar(".action-widget-action-bar", k);
			e && (A.appendChild(e.getContainer().parentElement), j.add(e), I = e.getContainer().offsetWidth);
		}
		let L = this._list.value?.layout(I);
		A.style.width = `${L}px`;
		let R = j.add(trackFocus(e));
		return j.add(R.onDidBlur(() => this.hide(!0))), j;
	}
	_createActionBar(e, O) {
		if (!O.length) return;
		let k = $(e), A = new ActionBar(k);
		return A.push(O, {
			icon: !1,
			label: !0
		}), A;
	}
	_onWidgetClosed(e) {
		this._list.value?.hide(e);
	}
};
ActionWidgetService = __decorate$93([
	__param$93(0, IContextViewService),
	__param$93(1, IContextKeyService),
	__param$93(2, IInstantiationService)
], ActionWidgetService), registerSingleton(IActionWidgetService, ActionWidgetService, 1);
var weight$3 = 1100;
registerAction2(class extends Action2 {
	constructor() {
		super({
			id: "hideCodeActionWidget",
			title: localize2("hideCodeActionWidget.title", "Hide action widget"),
			precondition: ActionWidgetContextKeys.Visible,
			keybinding: {
				weight: weight$3,
				primary: 9,
				secondary: [1033]
			}
		});
	}
	run(e) {
		e.get(IActionWidgetService).hide(!0);
	}
}), registerAction2(class extends Action2 {
	constructor() {
		super({
			id: "selectPrevCodeAction",
			title: localize2("selectPrevCodeAction.title", "Select previous action"),
			precondition: ActionWidgetContextKeys.Visible,
			keybinding: {
				weight: weight$3,
				primary: 16,
				secondary: [2064],
				mac: {
					primary: 16,
					secondary: [2064, 302]
				}
			}
		});
	}
	run(e) {
		let O = e.get(IActionWidgetService);
		O instanceof ActionWidgetService && O.focusPrevious();
	}
}), registerAction2(class extends Action2 {
	constructor() {
		super({
			id: "selectNextCodeAction",
			title: localize2("selectNextCodeAction.title", "Select next action"),
			precondition: ActionWidgetContextKeys.Visible,
			keybinding: {
				weight: weight$3,
				primary: 18,
				secondary: [2066],
				mac: {
					primary: 18,
					secondary: [2066, 300]
				}
			}
		});
	}
	run(e) {
		let O = e.get(IActionWidgetService);
		O instanceof ActionWidgetService && O.focusNext();
	}
}), registerAction2(class extends Action2 {
	constructor() {
		super({
			id: acceptSelectedActionCommand,
			title: localize2("acceptSelected.title", "Accept selected action"),
			precondition: ActionWidgetContextKeys.Visible,
			keybinding: {
				weight: weight$3,
				primary: 3,
				secondary: [2137]
			}
		});
	}
	run(e) {
		let O = e.get(IActionWidgetService);
		O instanceof ActionWidgetService && O.acceptSelected();
	}
}), registerAction2(class extends Action2 {
	constructor() {
		super({
			id: previewSelectedActionCommand,
			title: localize2("previewSelected.title", "Preview selected action"),
			precondition: ActionWidgetContextKeys.Visible,
			keybinding: {
				weight: weight$3,
				primary: 2051
			}
		});
	}
	run(e) {
		let O = e.get(IActionWidgetService);
		O instanceof ActionWidgetService && O.acceptSelected(!0);
	}
});
const SUPPORTED_CODE_ACTIONS = new RawContextKey("supportedCodeAction", "");
var CodeActionOracle = class extends Disposable {
	constructor(e, O, k, A = 250) {
		super(), this._editor = e, this._markerService = O, this._signalChange = k, this._delay = A, this._autoTriggerTimer = this._register(new TimeoutTimer()), this._register(this._markerService.onMarkerChanged((e) => this._onMarkerChanges(e))), this._register(this._editor.onDidChangeCursorPosition(() => this._tryAutoTrigger()));
	}
	trigger(e) {
		let O = this._getRangeOfSelectionUnlessWhitespaceEnclosed(e);
		this._signalChange(O ? {
			trigger: e,
			selection: O
		} : void 0);
	}
	_onMarkerChanges(e) {
		let O = this._editor.getModel();
		O && e.some((e) => isEqual(e, O.uri)) && this._tryAutoTrigger();
	}
	_tryAutoTrigger() {
		this._autoTriggerTimer.cancelAndSet(() => {
			this.trigger({
				type: 2,
				triggerAction: CodeActionTriggerSource.Default
			});
		}, this._delay);
	}
	_getRangeOfSelectionUnlessWhitespaceEnclosed(e) {
		if (!this._editor.hasModel()) return;
		let O = this._editor.getSelection();
		if (e.type === 1) return O;
		let k = this._editor.getOption(65).enabled;
		if (k !== ShowLightbulbIconMode.Off) {
			if (k === ShowLightbulbIconMode.On) return O;
			if (k === ShowLightbulbIconMode.OnCode) {
				if (!O.isEmpty()) return O;
				let e = this._editor.getModel(), { lineNumber: k, column: A } = O.getPosition(), j = e.getLineContent(k);
				if (j.length === 0) return;
				if (A === 1) {
					if (/\s/.test(j[0])) return;
				} else if (A === e.getLineMaxColumn(k)) {
					if (/\s/.test(j[j.length - 1])) return;
				} else if (/\s/.test(j[A - 2]) && /\s/.test(j[A - 1])) return;
			}
			return O;
		}
	}
}, CodeActionsState;
(function(e) {
	e.Empty = { type: 0 };
	class O {
		constructor(e, O, k) {
			this.trigger = e, this.position = O, this._cancellablePromise = k, this.type = 1, this.actions = k.catch((e) => {
				if (isCancellationError(e)) return emptyCodeActionSet;
				throw e;
			});
		}
		cancel() {
			this._cancellablePromise.cancel();
		}
	}
	e.Triggered = O;
})(CodeActionsState ||= {});
var emptyCodeActionSet = Object.freeze({
	allActions: [],
	validActions: [],
	dispose: () => {},
	documentation: [],
	hasAutoFix: !1,
	hasAIFix: !1,
	allAIFixes: !1
}), CodeActionModel = class extends Disposable {
	constructor(e, O, k, A, j, M, N) {
		super(), this._editor = e, this._registry = O, this._markerService = k, this._progressService = j, this._configurationService = M, this._telemetryService = N, this._codeActionOracle = this._register(new MutableDisposable()), this._state = CodeActionsState.Empty, this._onDidChangeState = this._register(new Emitter()), this.onDidChangeState = this._onDidChangeState.event, this._disposed = !1, this._supportedCodeActions = SUPPORTED_CODE_ACTIONS.bindTo(A), this._register(this._editor.onDidChangeModel(() => this._update())), this._register(this._editor.onDidChangeModelLanguage(() => this._update())), this._register(this._registry.onDidChange(() => this._update())), this._register(this._editor.onDidChangeConfiguration((e) => {
			e.hasChanged(65) && this._update();
		})), this._update();
	}
	dispose() {
		this._disposed || (this._disposed = !0, super.dispose(), this.setState(CodeActionsState.Empty, !0));
	}
	_settingEnabledNearbyQuickfixes() {
		let e = this._editor?.getModel();
		return this._configurationService ? this._configurationService.getValue("editor.codeActionWidget.includeNearbyQuickFixes", { resource: e?.uri }) : !1;
	}
	_update() {
		if (this._disposed) return;
		this._codeActionOracle.value = void 0, this.setState(CodeActionsState.Empty);
		let e = this._editor.getModel();
		if (e && this._registry.has(e) && !this._editor.getOption(92)) {
			let O = this._registry.all(e).flatMap((e) => e.providedCodeActionKinds ?? []);
			this._supportedCodeActions.set(O.join(" ")), this._codeActionOracle.value = new CodeActionOracle(this._editor, this._markerService, (O) => {
				if (!O) {
					this.setState(CodeActionsState.Empty);
					return;
				}
				let k = O.selection.getStartPosition(), A = createCancelablePromise(async (k) => {
					if (this._settingEnabledNearbyQuickfixes() && O.trigger.type === 1 && (O.trigger.triggerAction === CodeActionTriggerSource.QuickFix || O.trigger.filter?.include?.contains(CodeActionKind.QuickFix))) {
						let A = await getCodeActions(this._registry, e, O.selection, O.trigger, Progress.None, k), j = [...A.allActions];
						if (k.isCancellationRequested) return emptyCodeActionSet;
						let M = A.validActions?.some((e) => e.action.kind ? CodeActionKind.QuickFix.contains(new HierarchicalKind(e.action.kind)) : !1), N = this._markerService.read({ resource: e.uri });
						if (M) {
							for (let e of A.validActions) e.action.command?.arguments?.some((e) => typeof e == "string" && e.includes("_typescript.applyFixAllCodeAction")) && (e.action.diagnostics = [...N.filter((e) => e.relatedInformation)]);
							return {
								validActions: A.validActions,
								allActions: j,
								documentation: A.documentation,
								hasAutoFix: A.hasAutoFix,
								hasAIFix: A.hasAIFix,
								allAIFixes: A.allAIFixes,
								dispose: () => {
									A.dispose();
								}
							};
						} else if (!M && N.length > 0) {
							let M = O.selection.getPosition(), P = M, F = Number.MAX_VALUE, I = [...A.validActions];
							for (let L of N) {
								let R = L.endColumn, z = L.endLineNumber, B = L.startLineNumber;
								if (z === M.lineNumber || B === M.lineNumber) {
									P = new Position(z, R);
									let L = {
										type: O.trigger.type,
										triggerAction: O.trigger.triggerAction,
										filter: { include: O.trigger.filter?.include ? O.trigger.filter?.include : CodeActionKind.QuickFix },
										autoApply: O.trigger.autoApply,
										context: {
											notAvailableMessage: O.trigger.context?.notAvailableMessage || "",
											position: P
										}
									}, B = new Selection(P.lineNumber, P.column, P.lineNumber, P.column), V = await getCodeActions(this._registry, e, B, L, Progress.None, k);
									if (V.validActions.length !== 0) {
										for (let e of V.validActions) e.action.command?.arguments?.some((e) => typeof e == "string" && e.includes("_typescript.applyFixAllCodeAction")) && (e.action.diagnostics = [...N.filter((e) => e.relatedInformation)]);
										A.allActions.length === 0 && j.push(...V.allActions), Math.abs(M.column - R) < F ? I.unshift(...V.validActions) : I.push(...V.validActions);
									}
									F = Math.abs(M.column - R);
								}
							}
							let L = I.filter((e, O, k) => k.findIndex((O) => O.action.title === e.action.title) === O);
							return L.sort((e, O) => e.action.isPreferred && !O.action.isPreferred ? -1 : !e.action.isPreferred && O.action.isPreferred || e.action.isAI && !O.action.isAI ? 1 : !e.action.isAI && O.action.isAI ? -1 : 0), {
								validActions: L,
								allActions: j,
								documentation: A.documentation,
								hasAutoFix: A.hasAutoFix,
								hasAIFix: A.hasAIFix,
								allAIFixes: A.allAIFixes,
								dispose: () => {
									A.dispose();
								}
							};
						}
					}
					if (O.trigger.type === 1) {
						let A = new StopWatch(), j = await getCodeActions(this._registry, e, O.selection, O.trigger, Progress.None, k);
						return this._telemetryService && this._telemetryService.publicLog2("codeAction.invokedDurations", {
							codeActions: j.validActions.length,
							duration: A.elapsed()
						}), j;
					}
					return getCodeActions(this._registry, e, O.selection, O.trigger, Progress.None, k);
				});
				O.trigger.type === 1 && this._progressService?.showWhile(A, 250);
				let j = new CodeActionsState.Triggered(O.trigger, k, A), M = !1;
				this._state.type === 1 && (M = this._state.trigger.type === 1 && j.type === 1 && j.trigger.type === 2 && this._state.position !== j.position), M ? setTimeout(() => {
					this.setState(j);
				}, 500) : this.setState(j);
			}, void 0), this._codeActionOracle.value.trigger({
				type: 2,
				triggerAction: CodeActionTriggerSource.Default
			});
		} else this._supportedCodeActions.reset();
	}
	trigger(e) {
		this._codeActionOracle.value?.trigger(e);
	}
	setState(e, O) {
		e !== this._state && (this._state.type === 1 && this._state.cancel(), this._state = e, !O && !this._disposed && this._onDidChangeState.fire(e));
	}
}, __decorate$92 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$92 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, CodeActionController_1, DECORATION_CLASS_NAME$1 = "quickfix-edit-highlight", CodeActionController = class extends Disposable {
	static {
		CodeActionController_1 = this;
	}
	static {
		this.ID = "editor.contrib.codeActionController";
	}
	static get(e) {
		return e.getContribution(CodeActionController_1.ID);
	}
	constructor(e, O, k, A, j, M, N, P, F, I, L) {
		super(), this._commandService = N, this._configurationService = P, this._actionWidgetService = F, this._instantiationService = I, this._telemetryService = L, this._activeCodeActions = this._register(new MutableDisposable()), this._showDisabled = !1, this._disposed = !1, this._editor = e, this._model = this._register(new CodeActionModel(this._editor, j.codeActionProvider, O, k, M, P, this._telemetryService)), this._register(this._model.onDidChangeState((e) => this.update(e))), this._lightBulbWidget = new Lazy(() => {
			let e = this._editor.getContribution(LightBulbWidget.ID);
			return e && this._register(e.onClick((e) => this.showCodeActionsFromLightbulb(e.actions, e))), e;
		}), this._resolver = A.createInstance(CodeActionKeybindingResolver), this._register(this._editor.onDidLayoutChange(() => this._actionWidgetService.hide()));
	}
	dispose() {
		this._disposed = !0, super.dispose();
	}
	async showCodeActionsFromLightbulb(e, O) {
		if (e.allAIFixes && e.validActions.length === 1) {
			let O = e.validActions[0], k = O.action.command;
			k && k.id === "inlineChat.start" && k.arguments && k.arguments.length >= 1 && (k.arguments[0] = {
				...k.arguments[0],
				autoSend: !1
			}), await this._applyCodeAction(O, !1, !1, ApplyCodeActionReason.FromAILightbulb);
			return;
		}
		await this.showCodeActionList(e, O, {
			includeDisabledActions: !1,
			fromLightbulb: !0
		});
	}
	showCodeActions(e, O, k) {
		return this.showCodeActionList(O, k, {
			includeDisabledActions: !1,
			fromLightbulb: !1
		});
	}
	manualTriggerAtCurrentPosition(e, O, k, A) {
		if (!this._editor.hasModel()) return;
		MessageController.get(this._editor)?.closeMessage();
		let j = this._editor.getPosition();
		this._trigger({
			type: 1,
			triggerAction: O,
			filter: k,
			autoApply: A,
			context: {
				notAvailableMessage: e,
				position: j
			}
		});
	}
	_trigger(e) {
		return this._model.trigger(e);
	}
	async _applyCodeAction(e, O, k, A) {
		try {
			await this._instantiationService.invokeFunction(applyCodeAction, e, A, {
				preview: k,
				editor: this._editor
			});
		} finally {
			O && this._trigger({
				type: 2,
				triggerAction: CodeActionTriggerSource.QuickFix,
				filter: {}
			});
		}
	}
	hideLightBulbWidget() {
		this._lightBulbWidget.rawValue?.hide(), this._lightBulbWidget.rawValue?.gutterHide();
	}
	async update(e) {
		if (e.type !== 1) {
			this.hideLightBulbWidget();
			return;
		}
		let O;
		try {
			O = await e.actions;
		} catch (e) {
			onUnexpectedError(e);
			return;
		}
		if (!this._disposed && this._editor.getSelection()?.startLineNumber === e.position.lineNumber) if (this._lightBulbWidget.value?.update(O, e.trigger, e.position), e.trigger.type === 1) {
			if (e.trigger.filter?.include) {
				let k = this.tryGetValidActionToApply(e.trigger, O);
				if (k) {
					try {
						this.hideLightBulbWidget(), await this._applyCodeAction(k, !1, !1, ApplyCodeActionReason.FromCodeActions);
					} finally {
						O.dispose();
					}
					return;
				}
				if (e.trigger.context) {
					let k = this.getInvalidActionThatWouldHaveBeenApplied(e.trigger, O);
					if (k && k.action.disabled) {
						MessageController.get(this._editor)?.showMessage(k.action.disabled, e.trigger.context.position), O.dispose();
						return;
					}
				}
			}
			let k = !!e.trigger.filter?.include;
			if (e.trigger.context && (!O.allActions.length || !k && !O.validActions.length)) {
				MessageController.get(this._editor)?.showMessage(e.trigger.context.notAvailableMessage, e.trigger.context.position), this._activeCodeActions.value = O, O.dispose();
				return;
			}
			this._activeCodeActions.value = O, this.showCodeActionList(O, this.toCoords(e.position), {
				includeDisabledActions: k,
				fromLightbulb: !1
			});
		} else this._actionWidgetService.isVisible ? O.dispose() : this._activeCodeActions.value = O;
	}
	getInvalidActionThatWouldHaveBeenApplied(e, O) {
		if (O.allActions.length && (e.autoApply === "first" && O.validActions.length === 0 || e.autoApply === "ifSingle" && O.allActions.length === 1)) return O.allActions.find(({ action: e }) => e.disabled);
	}
	tryGetValidActionToApply(e, O) {
		if (O.validActions.length && (e.autoApply === "first" && O.validActions.length > 0 || e.autoApply === "ifSingle" && O.validActions.length === 1)) return O.validActions[0];
	}
	static {
		this.DECORATION = ModelDecorationOptions.register({
			description: "quickfix-highlight",
			className: DECORATION_CLASS_NAME$1
		});
	}
	async showCodeActionList(e, O, k) {
		let A = this._editor.createDecorationsCollection(), j = this._editor.getDomNode();
		if (!j) return;
		let M = k.includeDisabledActions && (this._showDisabled || e.validActions.length === 0) ? e.allActions : e.validActions;
		if (!M.length) return;
		let N = Position.isIPosition(O) ? this.toCoords(O) : O;
		this._actionWidgetService.show("codeActionWidget", !0, toMenuItems(M, this._shouldShowHeaders(), this._resolver.getResolver()), {
			onSelect: async (e, O) => {
				this._applyCodeAction(e, !0, !!O, k.fromLightbulb ? ApplyCodeActionReason.FromAILightbulb : ApplyCodeActionReason.FromCodeActions), this._actionWidgetService.hide(!1), A.clear();
			},
			onHide: (e) => {
				this._editor?.focus(), A.clear();
			},
			onHover: async (e, O) => {
				if (O.isCancellationRequested) return;
				let k = !1, A = e.action.kind;
				if (A) {
					let e = new HierarchicalKind(A);
					k = [
						CodeActionKind.RefactorExtract,
						CodeActionKind.RefactorInline,
						CodeActionKind.RefactorRewrite,
						CodeActionKind.RefactorMove,
						CodeActionKind.Source
					].some((O) => O.contains(e));
				}
				return { canPreview: k || !!e.action.edit?.edits.length };
			},
			onFocus: (e) => {
				if (e && e.action) {
					let O = e.action.ranges, k = e.action.diagnostics;
					if (A.clear(), O && O.length > 0) {
						let e = k && k?.length > 1 ? k.map((e) => ({
							range: e,
							options: CodeActionController_1.DECORATION
						})) : O.map((e) => ({
							range: e,
							options: CodeActionController_1.DECORATION
						}));
						A.set(e);
					} else if (k && k.length > 0) {
						let e = k.map((e) => ({
							range: e,
							options: CodeActionController_1.DECORATION
						}));
						A.set(e);
						let O = k[0];
						if (O.startLineNumber && O.startColumn) {
							let e = this._editor.getModel()?.getWordAtPosition({
								lineNumber: O.startLineNumber,
								column: O.startColumn
							})?.word;
							status(localize("editingNewSelection", "Context: {0} at line {1} and column {2}.", e, O.startLineNumber, O.startColumn));
						}
					}
				} else A.clear();
			}
		}, N, j, this._getActionBarActions(e, O, k));
	}
	toCoords(e) {
		if (!this._editor.hasModel()) return {
			x: 0,
			y: 0
		};
		this._editor.revealPosition(e, 1), this._editor.render();
		let O = this._editor.getScrolledVisiblePosition(e), k = getDomNodePagePosition(this._editor.getDomNode()), A = k.left + O.left, j = k.top + O.top + O.height;
		return {
			x: A,
			y: j
		};
	}
	_shouldShowHeaders() {
		let e = this._editor?.getModel();
		return this._configurationService.getValue("editor.codeActionWidget.showHeaders", { resource: e?.uri });
	}
	_getActionBarActions(e, O, k) {
		if (k.fromLightbulb) return [];
		let A = e.documentation.map((e) => ({
			id: e.id,
			label: e.title,
			tooltip: e.tooltip ?? "",
			class: void 0,
			enabled: !0,
			run: () => this._commandService.executeCommand(e.id, ...e.arguments ?? [])
		}));
		return k.includeDisabledActions && e.validActions.length > 0 && e.allActions.length !== e.validActions.length && A.push(this._showDisabled ? {
			id: "hideMoreActions",
			label: localize("hideMoreActions", "Hide Disabled"),
			enabled: !0,
			tooltip: "",
			class: void 0,
			run: () => (this._showDisabled = !1, this.showCodeActionList(e, O, k))
		} : {
			id: "showMoreActions",
			label: localize("showMoreActions", "Show Disabled"),
			enabled: !0,
			tooltip: "",
			class: void 0,
			run: () => (this._showDisabled = !0, this.showCodeActionList(e, O, k))
		}), A;
	}
};
CodeActionController = CodeActionController_1 = __decorate$92([
	__param$92(1, IMarkerService),
	__param$92(2, IContextKeyService),
	__param$92(3, IInstantiationService),
	__param$92(4, ILanguageFeaturesService),
	__param$92(5, IEditorProgressService),
	__param$92(6, ICommandService),
	__param$92(7, IConfigurationService),
	__param$92(8, IActionWidgetService),
	__param$92(9, IInstantiationService),
	__param$92(10, ITelemetryService)
], CodeActionController), registerThemingParticipant((e, O) => {
	((e, k) => {
		k && O.addRule(`.monaco-editor ${e} { background-color: ${k}; }`);
	})(".quickfix-edit-highlight", e.getColor(editorFindMatchHighlight));
	let k = e.getColor(editorFindMatchHighlightBorder);
	k && O.addRule(`.monaco-editor .quickfix-edit-highlight { border: 1px ${isHighContrast(e.type) ? "dotted" : "solid"} ${k}; box-sizing: border-box; }`);
});
function contextKeyForSupportedActions(e) {
	return ContextKeyExpr.regex(SUPPORTED_CODE_ACTIONS.keys()[0], /* @__PURE__ */ RegExp("(\\s|^)" + escapeRegExpCharacters(e.value) + "\\b"));
}
var argsSchema = {
	type: "object",
	defaultSnippets: [{ body: { kind: "" } }],
	properties: {
		kind: {
			type: "string",
			description: localize("args.schema.kind", "Kind of the code action to run.")
		},
		apply: {
			type: "string",
			description: localize("args.schema.apply", "Controls when the returned actions are applied."),
			default: "ifSingle",
			enum: [
				"first",
				"ifSingle",
				"never"
			],
			enumDescriptions: [
				localize("args.schema.apply.first", "Always apply the first returned code action."),
				localize("args.schema.apply.ifSingle", "Apply the first returned code action if it is the only one."),
				localize("args.schema.apply.never", "Do not apply the returned code actions.")
			]
		},
		preferred: {
			type: "boolean",
			default: !1,
			description: localize("args.schema.preferred", "Controls if only preferred code actions should be returned.")
		}
	}
};
function triggerCodeActionsForEditorSelection(e, O, k, A, j = CodeActionTriggerSource.Default) {
	e.hasModel() && CodeActionController.get(e)?.manualTriggerAtCurrentPosition(O, j, k, A);
}
var QuickFixAction = class extends EditorAction {
	constructor() {
		super({
			id: quickFixCommandId,
			label: localize("quickfix.trigger.label", "Quick Fix..."),
			alias: "Quick Fix...",
			precondition: ContextKeyExpr.and(EditorContextKeys.writable, EditorContextKeys.hasCodeActionsProvider),
			kbOpts: {
				kbExpr: EditorContextKeys.textInputFocus,
				primary: 2137,
				weight: 100
			}
		});
	}
	run(e, O) {
		return triggerCodeActionsForEditorSelection(O, localize("editor.action.quickFix.noneMessage", "No code actions available"), void 0, void 0, CodeActionTriggerSource.QuickFix);
	}
}, CodeActionCommand = class extends EditorCommand {
	constructor() {
		super({
			id: codeActionCommandId,
			precondition: ContextKeyExpr.and(EditorContextKeys.writable, EditorContextKeys.hasCodeActionsProvider),
			metadata: {
				description: "Trigger a code action",
				args: [{
					name: "args",
					schema: argsSchema
				}]
			}
		});
	}
	runEditorCommand(e, O, k) {
		let A = CodeActionCommandArgs.fromUser(k, {
			kind: HierarchicalKind.Empty,
			apply: "ifSingle"
		});
		return triggerCodeActionsForEditorSelection(O, typeof k?.kind == "string" ? A.preferred ? localize("editor.action.codeAction.noneMessage.preferred.kind", "No preferred code actions for '{0}' available", k.kind) : localize("editor.action.codeAction.noneMessage.kind", "No code actions for '{0}' available", k.kind) : A.preferred ? localize("editor.action.codeAction.noneMessage.preferred", "No preferred code actions available") : localize("editor.action.codeAction.noneMessage", "No code actions available"), {
			include: A.kind,
			includeSourceActions: !0,
			onlyIncludePreferredActions: A.preferred
		}, A.apply);
	}
}, RefactorAction = class extends EditorAction {
	constructor() {
		super({
			id: refactorCommandId,
			label: localize("refactor.label", "Refactor..."),
			alias: "Refactor...",
			precondition: ContextKeyExpr.and(EditorContextKeys.writable, EditorContextKeys.hasCodeActionsProvider),
			kbOpts: {
				kbExpr: EditorContextKeys.textInputFocus,
				primary: 3120,
				mac: { primary: 1328 },
				weight: 100
			},
			contextMenuOpts: {
				group: "1_modification",
				order: 2,
				when: ContextKeyExpr.and(EditorContextKeys.writable, contextKeyForSupportedActions(CodeActionKind.Refactor))
			},
			metadata: {
				description: "Refactor...",
				args: [{
					name: "args",
					schema: argsSchema
				}]
			}
		});
	}
	run(e, O, k) {
		let A = CodeActionCommandArgs.fromUser(k, {
			kind: CodeActionKind.Refactor,
			apply: "never"
		});
		return triggerCodeActionsForEditorSelection(O, typeof k?.kind == "string" ? A.preferred ? localize("editor.action.refactor.noneMessage.preferred.kind", "No preferred refactorings for '{0}' available", k.kind) : localize("editor.action.refactor.noneMessage.kind", "No refactorings for '{0}' available", k.kind) : A.preferred ? localize("editor.action.refactor.noneMessage.preferred", "No preferred refactorings available") : localize("editor.action.refactor.noneMessage", "No refactorings available"), {
			include: CodeActionKind.Refactor.contains(A.kind) ? A.kind : HierarchicalKind.None,
			onlyIncludePreferredActions: A.preferred
		}, A.apply, CodeActionTriggerSource.Refactor);
	}
}, SourceAction = class extends EditorAction {
	constructor() {
		super({
			id: sourceActionCommandId,
			label: localize("source.label", "Source Action..."),
			alias: "Source Action...",
			precondition: ContextKeyExpr.and(EditorContextKeys.writable, EditorContextKeys.hasCodeActionsProvider),
			contextMenuOpts: {
				group: "1_modification",
				order: 2.1,
				when: ContextKeyExpr.and(EditorContextKeys.writable, contextKeyForSupportedActions(CodeActionKind.Source))
			},
			metadata: {
				description: "Source Action...",
				args: [{
					name: "args",
					schema: argsSchema
				}]
			}
		});
	}
	run(e, O, k) {
		let A = CodeActionCommandArgs.fromUser(k, {
			kind: CodeActionKind.Source,
			apply: "never"
		});
		return triggerCodeActionsForEditorSelection(O, typeof k?.kind == "string" ? A.preferred ? localize("editor.action.source.noneMessage.preferred.kind", "No preferred source actions for '{0}' available", k.kind) : localize("editor.action.source.noneMessage.kind", "No source actions for '{0}' available", k.kind) : A.preferred ? localize("editor.action.source.noneMessage.preferred", "No preferred source actions available") : localize("editor.action.source.noneMessage", "No source actions available"), {
			include: CodeActionKind.Source.contains(A.kind) ? A.kind : HierarchicalKind.None,
			includeSourceActions: !0,
			onlyIncludePreferredActions: A.preferred
		}, A.apply, CodeActionTriggerSource.SourceAction);
	}
}, OrganizeImportsAction = class extends EditorAction {
	constructor() {
		super({
			id: organizeImportsCommandId,
			label: localize("organizeImports.label", "Organize Imports"),
			alias: "Organize Imports",
			precondition: ContextKeyExpr.and(EditorContextKeys.writable, contextKeyForSupportedActions(CodeActionKind.SourceOrganizeImports)),
			kbOpts: {
				kbExpr: EditorContextKeys.textInputFocus,
				primary: 1581,
				weight: 100
			}
		});
	}
	run(e, O) {
		return triggerCodeActionsForEditorSelection(O, localize("editor.action.organize.noneMessage", "No organize imports action available"), {
			include: CodeActionKind.SourceOrganizeImports,
			includeSourceActions: !0
		}, "ifSingle", CodeActionTriggerSource.OrganizeImports);
	}
}, FixAllAction = class extends EditorAction {
	constructor() {
		super({
			id: fixAllCommandId,
			label: localize("fixAll.label", "Fix All"),
			alias: "Fix All",
			precondition: ContextKeyExpr.and(EditorContextKeys.writable, contextKeyForSupportedActions(CodeActionKind.SourceFixAll))
		});
	}
	run(e, O) {
		return triggerCodeActionsForEditorSelection(O, localize("fixAll.noneMessage", "No fix all action available"), {
			include: CodeActionKind.SourceFixAll,
			includeSourceActions: !0
		}, "ifSingle", CodeActionTriggerSource.FixAll);
	}
}, AutoFixAction = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.autoFix",
			label: localize("autoFix.label", "Auto Fix..."),
			alias: "Auto Fix...",
			precondition: ContextKeyExpr.and(EditorContextKeys.writable, contextKeyForSupportedActions(CodeActionKind.QuickFix)),
			kbOpts: {
				kbExpr: EditorContextKeys.textInputFocus,
				primary: 1625,
				mac: { primary: 2649 },
				weight: 100
			}
		});
	}
	run(e, O) {
		return triggerCodeActionsForEditorSelection(O, localize("editor.action.autoFix.noneMessage", "No auto fixes available"), {
			include: CodeActionKind.QuickFix,
			onlyIncludePreferredActions: !0
		}, "ifSingle", CodeActionTriggerSource.AutoFix);
	}
};
registerEditorContribution(CodeActionController.ID, CodeActionController, 3), registerEditorContribution(LightBulbWidget.ID, LightBulbWidget, 4), registerEditorAction(QuickFixAction), registerEditorAction(RefactorAction), registerEditorAction(SourceAction), registerEditorAction(OrganizeImportsAction), registerEditorAction(AutoFixAction), registerEditorAction(FixAllAction), registerEditorCommand(new CodeActionCommand()), Registry.as(Extensions$1.Configuration).registerConfiguration({
	...editorConfigurationBaseNode,
	properties: { "editor.codeActionWidget.showHeaders": {
		type: "boolean",
		scope: 5,
		description: localize("showCodeActionHeaders", "Enable/disable showing group headers in the Code Action menu."),
		default: !0
	} }
}), Registry.as(Extensions$1.Configuration).registerConfiguration({
	...editorConfigurationBaseNode,
	properties: { "editor.codeActionWidget.includeNearbyQuickFixes": {
		type: "boolean",
		scope: 5,
		description: localize("includeNearbyQuickFixes", "Enable/disable showing nearest Quick Fix within a line when not currently on a diagnostic."),
		default: !0
	} }
}), Registry.as(Extensions$1.Configuration).registerConfiguration({
	...editorConfigurationBaseNode,
	properties: { "editor.codeActions.triggerOnFocusChange": {
		type: "boolean",
		scope: 5,
		markdownDescription: localize("triggerOnFocusChange", "Enable triggering {0} when {1} is set to {2}. Code Actions must be set to {3} to be triggered for window and focus changes.", "`#editor.codeActionsOnSave#`", "`#files.autoSave#`", "`afterDelay`", "`always`"),
		default: !1
	} }
});
var CodeLensModel = class {
	constructor() {
		this.lenses = [], this._disposables = new DisposableStore();
	}
	dispose() {
		this._disposables.dispose();
	}
	get isDisposed() {
		return this._disposables.isDisposed;
	}
	add(e, O) {
		this._disposables.add(e);
		for (let k of e.lenses) this.lenses.push({
			symbol: k,
			provider: O
		});
	}
};
async function getCodeLensModel(e, O, k) {
	let A = e.ordered(O), j = /* @__PURE__ */ new Map(), M = new CodeLensModel(), N = A.map(async (e, A) => {
		j.set(e, A);
		try {
			let A = await Promise.resolve(e.provideCodeLenses(O, k));
			A && M.add(A, e);
		} catch (e) {
			onUnexpectedExternalError(e);
		}
	});
	return await Promise.all(N), M.lenses = M.lenses.sort((e, O) => e.symbol.range.startLineNumber < O.symbol.range.startLineNumber ? -1 : e.symbol.range.startLineNumber > O.symbol.range.startLineNumber ? 1 : j.get(e.provider) < j.get(O.provider) ? -1 : j.get(e.provider) > j.get(O.provider) ? 1 : e.symbol.range.startColumn < O.symbol.range.startColumn ? -1 : e.symbol.range.startColumn > O.symbol.range.startColumn ? 1 : 0), M;
}
CommandsRegistry.registerCommand("_executeCodeLensProvider", function(e, ...O) {
	let [k, A] = O;
	assertType(URI.isUri(k)), assertType(typeof A == "number" || !A);
	let { codeLensProvider: M } = e.get(ILanguageFeaturesService), N = e.get(IModelService).getModel(k);
	if (!N) throw illegalArgument();
	let P = [], F = new DisposableStore();
	return getCodeLensModel(M, N, CancellationToken.None).then((e) => {
		F.add(e);
		let O = [];
		for (let k of e.lenses) A == null || k.symbol.command ? P.push(k.symbol) : A-- > 0 && k.provider.resolveCodeLens && O.push(Promise.resolve(k.provider.resolveCodeLens(N, k.symbol, CancellationToken.None)).then((e) => P.push(e || k.symbol)));
		return Promise.all(O);
	}).then(() => P).finally(() => {
		setTimeout(() => F.dispose(), 100);
	});
});
var __decorate$91 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$91 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
};
const ICodeLensCache = createDecorator("ICodeLensCache");
var CacheItem = class {
	constructor(e, O) {
		this.lineCount = e, this.data = O;
	}
}, CodeLensCache = class {
	constructor(e) {
		this._fakeProvider = new class {
			provideCodeLenses() {
				throw Error("not supported");
			}
		}(), this._cache = new LRUCache(20, .75), runWhenWindowIdle(mainWindow, () => e.remove("codelens/cache", 1));
		let O = "codelens/cache2", k = e.get(O, 1, "{}");
		this._deserialize(k);
		let A = Event.filter(e.onWillSaveState, (e) => e.reason === WillSaveStateReason.SHUTDOWN);
		Event.once(A)((k) => {
			e.store(O, this._serialize(), 1, 1);
		});
	}
	put(e, O) {
		let k = O.lenses.map((e) => ({
			range: e.symbol.range,
			command: e.symbol.command && {
				id: "",
				title: e.symbol.command?.title
			}
		})), A = new CodeLensModel();
		A.add({
			lenses: k,
			dispose: () => {}
		}, this._fakeProvider);
		let j = new CacheItem(e.getLineCount(), A);
		this._cache.set(e.uri.toString(), j);
	}
	get(e) {
		let O = this._cache.get(e.uri.toString());
		return O && O.lineCount === e.getLineCount() ? O.data : void 0;
	}
	delete(e) {
		this._cache.delete(e.uri.toString());
	}
	_serialize() {
		let e = Object.create(null);
		for (let [O, k] of this._cache) {
			let A = /* @__PURE__ */ new Set();
			for (let e of k.data.lenses) A.add(e.symbol.range.startLineNumber);
			e[O] = {
				lineCount: k.lineCount,
				lines: [...A.values()]
			};
		}
		return JSON.stringify(e);
	}
	_deserialize(e) {
		try {
			let O = JSON.parse(e);
			for (let e in O) {
				let k = O[e], A = [];
				for (let e of k.lines) A.push({ range: new Range(e, 1, e, 11) });
				let j = new CodeLensModel();
				j.add({
					lenses: A,
					dispose() {}
				}, this._fakeProvider), this._cache.set(e, new CacheItem(k.lineCount, j));
			}
		} catch {}
	}
};
CodeLensCache = __decorate$91([__param$91(0, IStorageService)], CodeLensCache), registerSingleton(ICodeLensCache, CodeLensCache, 1);
var CodeLensViewZone = class {
	constructor(e, O, k) {
		this.afterColumn = 1073741824, this.afterLineNumber = e, this.heightInPx = O, this._onHeight = k, this.suppressMouseDown = !0, this.domNode = document.createElement("div");
	}
	onComputedHeight(e) {
		this._lastHeight === void 0 ? this._lastHeight = e : this._lastHeight !== e && (this._lastHeight = e, this._onHeight());
	}
	isVisible() {
		return this._lastHeight !== 0 && this.domNode.hasAttribute("monaco-visible-view-zone");
	}
}, CodeLensContentWidget = class e {
	static {
		this._idPool = 0;
	}
	constructor(O, k) {
		this.allowEditorOverflow = !1, this.suppressMouseDown = !0, this._commands = /* @__PURE__ */ new Map(), this._isEmpty = !0, this._editor = O, this._id = `codelens.widget-${e._idPool++}`, this.updatePosition(k), this._domNode = document.createElement("span"), this._domNode.className = "codelens-decoration";
	}
	withCommands(O, k) {
		this._commands.clear();
		let A = [], j = !1;
		for (let k = 0; k < O.length; k++) {
			let M = O[k];
			if (M && (j = !0, M.command)) {
				let j = renderLabelWithIcons(M.command.title.trim());
				if (M.command.id) {
					let O = `c${e._idPool++}`;
					A.push($("a", {
						id: O,
						title: M.command.tooltip,
						role: "button"
					}, ...j)), this._commands.set(O, M.command);
				} else A.push($("span", { title: M.command.tooltip }, ...j));
				k + 1 < O.length && A.push($("span", void 0, "\xA0|\xA0"));
			}
		}
		j ? (reset(this._domNode, ...A), this._isEmpty && k && this._domNode.classList.add("fadein"), this._isEmpty = !1) : reset(this._domNode, $("span", void 0, "no commands"));
	}
	getCommand(e) {
		return e.parentElement === this._domNode ? this._commands.get(e.id) : void 0;
	}
	getId() {
		return this._id;
	}
	getDomNode() {
		return this._domNode;
	}
	updatePosition(e) {
		let O = this._editor.getModel().getLineFirstNonWhitespaceColumn(e);
		this._widgetPosition = {
			position: {
				lineNumber: e,
				column: O
			},
			preference: [1]
		};
	}
	getPosition() {
		return this._widgetPosition || null;
	}
}, CodeLensHelper = class {
	constructor() {
		this._removeDecorations = [], this._addDecorations = [], this._addDecorationsCallbacks = [];
	}
	addDecoration(e, O) {
		this._addDecorations.push(e), this._addDecorationsCallbacks.push(O);
	}
	removeDecoration(e) {
		this._removeDecorations.push(e);
	}
	commit(e) {
		let O = e.deltaDecorations(this._removeDecorations, this._addDecorations);
		for (let e = 0, k = O.length; e < k; e++) this._addDecorationsCallbacks[e](O[e]);
	}
}, codeLensDecorationOptions = ModelDecorationOptions.register({
	collapseOnReplaceEdit: !0,
	description: "codelens"
}), CodeLensWidget = class {
	constructor(e, O, k, A, j, M) {
		this._isDisposed = !1, this._editor = O, this._data = e, this._decorationIds = [];
		let N, P = [];
		this._data.forEach((e, O) => {
			e.symbol.command && P.push(e.symbol), k.addDecoration({
				range: e.symbol.range,
				options: codeLensDecorationOptions
			}, (e) => this._decorationIds[O] = e), N = N ? Range.plusRange(N, e.symbol.range) : Range.lift(e.symbol.range);
		}), this._viewZone = new CodeLensViewZone(N.startLineNumber - 1, j, M), this._viewZoneId = A.addZone(this._viewZone), P.length > 0 && (this._createContentWidgetIfNecessary(), this._contentWidget.withCommands(P, !1));
	}
	_createContentWidgetIfNecessary() {
		this._contentWidget ? this._editor.layoutContentWidget(this._contentWidget) : (this._contentWidget = new CodeLensContentWidget(this._editor, this._viewZone.afterLineNumber + 1), this._editor.addContentWidget(this._contentWidget));
	}
	dispose(e, O) {
		this._decorationIds.forEach(e.removeDecoration, e), this._decorationIds = [], O?.removeZone(this._viewZoneId), this._contentWidget &&= (this._editor.removeContentWidget(this._contentWidget), void 0), this._isDisposed = !0;
	}
	isDisposed() {
		return this._isDisposed;
	}
	isValid() {
		return this._decorationIds.some((e, O) => {
			let k = this._editor.getModel().getDecorationRange(e), A = this._data[O].symbol;
			return !!(k && Range.isEmpty(A.range) === k.isEmpty());
		});
	}
	updateCodeLensSymbols(e, O) {
		this._decorationIds.forEach(O.removeDecoration, O), this._decorationIds = [], this._data = e, this._data.forEach((e, k) => {
			O.addDecoration({
				range: e.symbol.range,
				options: codeLensDecorationOptions
			}, (e) => this._decorationIds[k] = e);
		});
	}
	updateHeight(e, O) {
		this._viewZone.heightInPx = e, O.layoutZone(this._viewZoneId), this._contentWidget && this._editor.layoutContentWidget(this._contentWidget);
	}
	computeIfNecessary(e) {
		if (!this._viewZone.isVisible()) return null;
		for (let O = 0; O < this._decorationIds.length; O++) {
			let k = e.getDecorationRange(this._decorationIds[O]);
			k && (this._data[O].symbol.range = k);
		}
		return this._data;
	}
	updateCommands(e) {
		this._createContentWidgetIfNecessary(), this._contentWidget.withCommands(e, !0);
		for (let O = 0; O < this._data.length; O++) {
			let k = e[O];
			if (k) {
				let { symbol: e } = this._data[O];
				e.command = k.command || e.command;
			}
		}
	}
	getCommand(e) {
		return this._contentWidget?.getCommand(e);
	}
	getLineNumber() {
		let e = this._editor.getModel().getDecorationRange(this._decorationIds[0]);
		return e ? e.startLineNumber : -1;
	}
	update(e) {
		if (this.isValid()) {
			let O = this._editor.getModel().getDecorationRange(this._decorationIds[0]);
			O && (this._viewZone.afterLineNumber = O.startLineNumber - 1, e.layoutZone(this._viewZoneId), this._contentWidget && (this._contentWidget.updatePosition(O.startLineNumber), this._editor.layoutContentWidget(this._contentWidget)));
		}
	}
}, __decorate$90 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$90 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, CodeLensContribution = class {
	static {
		this.ID = "css.editor.codeLens";
	}
	constructor(e, O, k, A, j, M) {
		this._editor = e, this._languageFeaturesService = O, this._commandService = A, this._notificationService = j, this._codeLensCache = M, this._disposables = new DisposableStore(), this._localToDispose = new DisposableStore(), this._lenses = [], this._oldCodeLensModels = new DisposableStore(), this._provideCodeLensDebounce = k.for(O.codeLensProvider, "CodeLensProvide", { min: 250 }), this._resolveCodeLensesDebounce = k.for(O.codeLensProvider, "CodeLensResolve", {
			min: 250,
			salt: "resolve"
		}), this._resolveCodeLensesScheduler = new RunOnceScheduler(() => this._resolveCodeLensesInViewport(), this._resolveCodeLensesDebounce.default()), this._disposables.add(this._editor.onDidChangeModel(() => this._onModelChange())), this._disposables.add(this._editor.onDidChangeModelLanguage(() => this._onModelChange())), this._disposables.add(this._editor.onDidChangeConfiguration((e) => {
			(e.hasChanged(50) || e.hasChanged(19) || e.hasChanged(18)) && this._updateLensStyle(), e.hasChanged(17) && this._onModelChange();
		})), this._disposables.add(O.codeLensProvider.onDidChange(this._onModelChange, this)), this._onModelChange(), this._updateLensStyle();
	}
	dispose() {
		this._localDispose(), this._disposables.dispose(), this._oldCodeLensModels.dispose(), this._currentCodeLensModel?.dispose();
	}
	_getLayoutInfo() {
		let e = Math.max(1.3, this._editor.getOption(67) / this._editor.getOption(52)), O = this._editor.getOption(19);
		return (!O || O < 5) && (O = this._editor.getOption(52) * .9 | 0), {
			fontSize: O,
			codeLensHeight: O * e | 0
		};
	}
	_updateLensStyle() {
		let { codeLensHeight: e, fontSize: O } = this._getLayoutInfo(), k = this._editor.getOption(18), A = this._editor.getOption(50), { style: j } = this._editor.getContainerDomNode();
		j.setProperty("--vscode-editorCodeLens-lineHeight", `${e}px`), j.setProperty("--vscode-editorCodeLens-fontSize", `${O}px`), j.setProperty("--vscode-editorCodeLens-fontFeatureSettings", A.fontFeatureSettings), k && (j.setProperty("--vscode-editorCodeLens-fontFamily", k), j.setProperty("--vscode-editorCodeLens-fontFamilyDefault", EDITOR_FONT_DEFAULTS.fontFamily)), this._editor.changeViewZones((O) => {
			for (let k of this._lenses) k.updateHeight(e, O);
		});
	}
	_localDispose() {
		this._getCodeLensModelPromise?.cancel(), this._getCodeLensModelPromise = void 0, this._resolveCodeLensesPromise?.cancel(), this._resolveCodeLensesPromise = void 0, this._localToDispose.clear(), this._oldCodeLensModels.clear(), this._currentCodeLensModel?.dispose();
	}
	_onModelChange() {
		this._localDispose();
		let e = this._editor.getModel();
		if (!e || !this._editor.getOption(17) || e.isTooLargeForTokenization()) return;
		let O = this._codeLensCache.get(e);
		if (O && this._renderCodeLensSymbols(O), !this._languageFeaturesService.codeLensProvider.has(e)) {
			O && disposableTimeout(() => {
				let k = this._codeLensCache.get(e);
				O === k && (this._codeLensCache.delete(e), this._onModelChange());
			}, 30 * 1e3, this._localToDispose);
			return;
		}
		for (let O of this._languageFeaturesService.codeLensProvider.all(e)) if (typeof O.onDidChange == "function") {
			let e = O.onDidChange(() => k.schedule());
			this._localToDispose.add(e);
		}
		let k = new RunOnceScheduler(() => {
			let O = Date.now();
			this._getCodeLensModelPromise?.cancel(), this._getCodeLensModelPromise = createCancelablePromise((O) => getCodeLensModel(this._languageFeaturesService.codeLensProvider, e, O)), this._getCodeLensModelPromise.then((A) => {
				this._currentCodeLensModel && this._oldCodeLensModels.add(this._currentCodeLensModel), this._currentCodeLensModel = A, this._codeLensCache.put(e, A), k.delay = this._provideCodeLensDebounce.update(e, Date.now() - O), this._renderCodeLensSymbols(A), this._resolveCodeLensesInViewportSoon();
			}, onUnexpectedError);
		}, this._provideCodeLensDebounce.get(e));
		this._localToDispose.add(k), this._localToDispose.add(toDisposable(() => this._resolveCodeLensesScheduler.cancel())), this._localToDispose.add(this._editor.onDidChangeModelContent(() => {
			this._editor.changeDecorations((e) => {
				this._editor.changeViewZones((O) => {
					let k = [], A = -1;
					this._lenses.forEach((e) => {
						!e.isValid() || A === e.getLineNumber() ? k.push(e) : (e.update(O), A = e.getLineNumber());
					});
					let j = new CodeLensHelper();
					k.forEach((e) => {
						e.dispose(j, O), this._lenses.splice(this._lenses.indexOf(e), 1);
					}), j.commit(e);
				});
			}), k.schedule(), this._resolveCodeLensesScheduler.cancel(), this._resolveCodeLensesPromise?.cancel(), this._resolveCodeLensesPromise = void 0;
		})), this._localToDispose.add(this._editor.onDidFocusEditorText(() => {
			k.schedule();
		})), this._localToDispose.add(this._editor.onDidBlurEditorText(() => {
			k.cancel();
		})), this._localToDispose.add(this._editor.onDidScrollChange((e) => {
			e.scrollTopChanged && this._lenses.length > 0 && this._resolveCodeLensesInViewportSoon();
		})), this._localToDispose.add(this._editor.onDidLayoutChange(() => {
			this._resolveCodeLensesInViewportSoon();
		})), this._localToDispose.add(toDisposable(() => {
			if (this._editor.getModel()) {
				let e = StableEditorScrollState.capture(this._editor);
				this._editor.changeDecorations((e) => {
					this._editor.changeViewZones((O) => {
						this._disposeAllLenses(e, O);
					});
				}), e.restore(this._editor);
			} else this._disposeAllLenses(void 0, void 0);
		})), this._localToDispose.add(this._editor.onMouseDown((e) => {
			if (e.target.type !== 9) return;
			let O = e.target.element;
			if (O?.tagName === "SPAN" && (O = O.parentElement), O?.tagName === "A") for (let e of this._lenses) {
				let k = e.getCommand(O);
				if (k) {
					this._commandService.executeCommand(k.id, ...k.arguments || []).catch((e) => this._notificationService.error(e));
					break;
				}
			}
		})), k.schedule();
	}
	_disposeAllLenses(e, O) {
		let k = new CodeLensHelper();
		for (let e of this._lenses) e.dispose(k, O);
		e && k.commit(e), this._lenses.length = 0;
	}
	_renderCodeLensSymbols(e) {
		if (!this._editor.hasModel()) return;
		let O = this._editor.getModel().getLineCount(), k = [], A;
		for (let j of e.lenses) {
			let e = j.symbol.range.startLineNumber;
			e < 1 || e > O || (A && A[A.length - 1].symbol.range.startLineNumber === e ? A.push(j) : (A = [j], k.push(A)));
		}
		if (!k.length && !this._lenses.length) return;
		let j = StableEditorScrollState.capture(this._editor), M = this._getLayoutInfo();
		this._editor.changeDecorations((e) => {
			this._editor.changeViewZones((O) => {
				let A = new CodeLensHelper(), j = 0, N = 0;
				for (; N < k.length && j < this._lenses.length;) {
					let e = k[N][0].symbol.range.startLineNumber, P = this._lenses[j].getLineNumber();
					P < e ? (this._lenses[j].dispose(A, O), this._lenses.splice(j, 1)) : P === e ? (this._lenses[j].updateCodeLensSymbols(k[N], A), N++, j++) : (this._lenses.splice(j, 0, new CodeLensWidget(k[N], this._editor, A, O, M.codeLensHeight, () => this._resolveCodeLensesInViewportSoon())), j++, N++);
				}
				for (; j < this._lenses.length;) this._lenses[j].dispose(A, O), this._lenses.splice(j, 1);
				for (; N < k.length;) this._lenses.push(new CodeLensWidget(k[N], this._editor, A, O, M.codeLensHeight, () => this._resolveCodeLensesInViewportSoon())), N++;
				A.commit(e);
			});
		}), j.restore(this._editor);
	}
	_resolveCodeLensesInViewportSoon() {
		this._editor.getModel() && this._resolveCodeLensesScheduler.schedule();
	}
	_resolveCodeLensesInViewport() {
		this._resolveCodeLensesPromise?.cancel(), this._resolveCodeLensesPromise = void 0;
		let e = this._editor.getModel();
		if (!e) return;
		let O = [], k = [];
		if (this._lenses.forEach((A) => {
			let j = A.computeIfNecessary(e);
			j && (O.push(j), k.push(A));
		}), O.length === 0) return;
		let A = Date.now(), j = createCancelablePromise((A) => {
			let j = O.map((O, j) => {
				let M = Array(O.length), N = O.map((O, k) => !O.symbol.command && typeof O.provider.resolveCodeLens == "function" ? Promise.resolve(O.provider.resolveCodeLens(e, O.symbol, A)).then((e) => {
					M[k] = e;
				}, onUnexpectedExternalError) : (M[k] = O.symbol, Promise.resolve(void 0)));
				return Promise.all(N).then(() => {
					!A.isCancellationRequested && !k[j].isDisposed() && k[j].updateCommands(M);
				});
			});
			return Promise.all(j);
		});
		this._resolveCodeLensesPromise = j, this._resolveCodeLensesPromise.then(() => {
			let O = this._resolveCodeLensesDebounce.update(e, Date.now() - A);
			this._resolveCodeLensesScheduler.delay = O, this._currentCodeLensModel && this._codeLensCache.put(e, this._currentCodeLensModel), this._oldCodeLensModels.clear(), j === this._resolveCodeLensesPromise && (this._resolveCodeLensesPromise = void 0);
		}, (e) => {
			onUnexpectedError(e), j === this._resolveCodeLensesPromise && (this._resolveCodeLensesPromise = void 0);
		});
	}
	async getModel() {
		return await this._getCodeLensModelPromise, await this._resolveCodeLensesPromise, this._currentCodeLensModel?.isDisposed ? void 0 : this._currentCodeLensModel;
	}
};
CodeLensContribution = __decorate$90([
	__param$90(1, ILanguageFeaturesService),
	__param$90(2, ILanguageFeatureDebounceService),
	__param$90(3, ICommandService),
	__param$90(4, INotificationService),
	__param$90(5, ICodeLensCache)
], CodeLensContribution), registerEditorContribution(CodeLensContribution.ID, CodeLensContribution, 1), registerEditorAction(class extends EditorAction {
	constructor() {
		super({
			id: "codelens.showLensesInCurrentLine",
			precondition: EditorContextKeys.hasCodeLensProvider,
			label: localize("showLensOnLine", "Show CodeLens Commands For Current Line"),
			alias: "Show CodeLens Commands For Current Line"
		});
	}
	async run(e, O) {
		if (!O.hasModel()) return;
		let k = e.get(IQuickInputService), A = e.get(ICommandService), j = e.get(INotificationService), M = O.getSelection().positionLineNumber, N = O.getContribution(CodeLensContribution.ID);
		if (!N) return;
		let P = await N.getModel();
		if (!P) return;
		let F = [];
		for (let e of P.lenses) e.symbol.command && e.symbol.range.startLineNumber === M && F.push({
			label: e.symbol.command.title,
			command: e.symbol.command
		});
		if (F.length === 0) return;
		let I = await k.pick(F, {
			canPickMany: !1,
			placeHolder: localize("placeHolder", "Select a command")
		});
		if (!I) return;
		let L = I.command;
		if (P.isDisposed) {
			let e = (await N.getModel())?.lenses.find((e) => e.symbol.range.startLineNumber === M && e.symbol.command?.title === L.title);
			if (!e || !e.symbol.command) return;
			L = e.symbol.command;
		}
		try {
			await A.executeCommand(L.id, ...L.arguments || []);
		} catch (e) {
			j.error(e);
		}
	}
});
var __decorate$89 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$89 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, DefaultDocumentColorProvider = class {
	constructor(e) {
		this._editorWorkerService = e;
	}
	async provideDocumentColors(e, O) {
		return this._editorWorkerService.computeDefaultDocumentColors(e.uri);
	}
	provideColorPresentations(e, O, k) {
		let A = O.range, j = O.color, M = j.alpha, N = new Color(new RGBA(Math.round(255 * j.red), Math.round(255 * j.green), Math.round(255 * j.blue), M)), P = M ? Color.Format.CSS.formatRGB(N) : Color.Format.CSS.formatRGBA(N), F = M ? Color.Format.CSS.formatHSL(N) : Color.Format.CSS.formatHSLA(N), I = M ? Color.Format.CSS.formatHex(N) : Color.Format.CSS.formatHexA(N), L = [];
		return L.push({
			label: P,
			textEdit: {
				range: A,
				text: P
			}
		}), L.push({
			label: F,
			textEdit: {
				range: A,
				text: F
			}
		}), L.push({
			label: I,
			textEdit: {
				range: A,
				text: I
			}
		}), L;
	}
};
DefaultDocumentColorProvider = __decorate$89([__param$89(0, IEditorWorkerService)], DefaultDocumentColorProvider);
var DefaultDocumentColorProviderFeature = class extends Disposable {
	constructor(e, O) {
		super(), this._register(e.colorProvider.register("*", new DefaultDocumentColorProvider(O)));
	}
};
DefaultDocumentColorProviderFeature = __decorate$89([__param$89(0, ILanguageFeaturesService), __param$89(1, IEditorWorkerService)], DefaultDocumentColorProviderFeature), registerEditorFeature(DefaultDocumentColorProviderFeature);
async function getColors(e, O, k, A = !0) {
	return _findColorData(new ColorDataCollector(), e, O, k, A);
}
function getColorPresentations(e, O, k, A) {
	return Promise.resolve(k.provideColorPresentations(e, O, A));
}
var ColorDataCollector = class {
	constructor() {}
	async compute(e, O, k, A) {
		let j = await e.provideDocumentColors(O, k);
		if (Array.isArray(j)) for (let O of j) A.push({
			colorInfo: O,
			provider: e
		});
		return Array.isArray(j);
	}
}, ExtColorDataCollector = class {
	constructor() {}
	async compute(e, O, k, A) {
		let j = await e.provideDocumentColors(O, k);
		if (Array.isArray(j)) for (let e of j) A.push({
			range: e.range,
			color: [
				e.color.red,
				e.color.green,
				e.color.blue,
				e.color.alpha
			]
		});
		return Array.isArray(j);
	}
}, ColorPresentationsCollector = class {
	constructor(e) {
		this.colorInfo = e;
	}
	async compute(e, O, k, A) {
		let j = await e.provideColorPresentations(O, this.colorInfo, CancellationToken.None);
		return Array.isArray(j) && A.push(...j), Array.isArray(j);
	}
};
async function _findColorData(e, O, k, A, j) {
	let M = !1, N, P = [], F = O.ordered(k);
	for (let O = F.length - 1; O >= 0; O--) {
		let j = F[O];
		if (j instanceof DefaultDocumentColorProvider) N = j;
		else try {
			await e.compute(j, k, A, P) && (M = !0);
		} catch (e) {
			onUnexpectedExternalError(e);
		}
	}
	return M ? P : N && j ? (await e.compute(N, k, A, P), P) : [];
}
function _setupColorCommand(e, O) {
	let { colorProvider: k } = e.get(ILanguageFeaturesService), A = e.get(IModelService).getModel(O);
	if (!A) throw illegalArgument();
	let M = e.get(IConfigurationService).getValue("editor.defaultColorDecorators", { resource: O });
	return {
		model: A,
		colorProviderRegistry: k,
		isDefaultColorDecoratorsEnabled: M
	};
}
CommandsRegistry.registerCommand("_executeDocumentColorProvider", function(e, ...O) {
	let [k] = O;
	if (!(k instanceof URI)) throw illegalArgument();
	let { model: A, colorProviderRegistry: M, isDefaultColorDecoratorsEnabled: N } = _setupColorCommand(e, k);
	return _findColorData(new ExtColorDataCollector(), M, A, CancellationToken.None, N);
}), CommandsRegistry.registerCommand("_executeColorPresentationProvider", function(e, ...O) {
	let [k, A] = O, { uri: M, range: N } = A;
	if (!(M instanceof URI) || !Array.isArray(k) || k.length !== 4 || !Range.isIRange(N)) throw illegalArgument();
	let { model: P, colorProviderRegistry: F, isDefaultColorDecoratorsEnabled: I } = _setupColorCommand(e, M), [L, R, z, B] = k;
	return _findColorData(new ColorPresentationsCollector({
		range: N,
		color: {
			red: L,
			green: R,
			blue: z,
			alpha: B
		}
	}), F, P, CancellationToken.None, I);
});
var __decorate$88 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$88 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, ColorDetector_1;
const ColorDecorationInjectedTextMarker = Object.create({});
var ColorDetector = class extends Disposable {
	static {
		ColorDetector_1 = this;
	}
	static {
		this.ID = "editor.contrib.colorDetector";
	}
	static {
		this.RECOMPUTE_TIME = 1e3;
	}
	constructor(e, O, k, A) {
		super(), this._editor = e, this._configurationService = O, this._languageFeaturesService = k, this._localToDispose = this._register(new DisposableStore()), this._decorationsIds = [], this._colorDatas = /* @__PURE__ */ new Map(), this._colorDecoratorIds = this._editor.createDecorationsCollection(), this._ruleFactory = new DynamicCssRules(this._editor), this._decoratorLimitReporter = new DecoratorLimitReporter(), this._colorDecorationClassRefs = this._register(new DisposableStore()), this._debounceInformation = A.for(k.colorProvider, "Document Colors", { min: ColorDetector_1.RECOMPUTE_TIME }), this._register(e.onDidChangeModel(() => {
			this._isColorDecoratorsEnabled = this.isEnabled(), this.updateColors();
		})), this._register(e.onDidChangeModelLanguage(() => this.updateColors())), this._register(k.colorProvider.onDidChange(() => this.updateColors())), this._register(e.onDidChangeConfiguration((e) => {
			let O = this._isColorDecoratorsEnabled;
			this._isColorDecoratorsEnabled = this.isEnabled(), this._isDefaultColorDecoratorsEnabled = this._editor.getOption(148);
			let k = O !== this._isColorDecoratorsEnabled || e.hasChanged(21), A = e.hasChanged(148);
			(k || A) && (this._isColorDecoratorsEnabled ? this.updateColors() : this.removeAllDecorations());
		})), this._timeoutTimer = null, this._computePromise = null, this._isColorDecoratorsEnabled = this.isEnabled(), this._isDefaultColorDecoratorsEnabled = this._editor.getOption(148), this.updateColors();
	}
	isEnabled() {
		let e = this._editor.getModel();
		if (!e) return !1;
		let O = e.getLanguageId(), k = this._configurationService.getValue(O);
		if (k && typeof k == "object") {
			let e = k.colorDecorators;
			if (e && e.enable !== void 0 && !e.enable) return e.enable;
		}
		return this._editor.getOption(20);
	}
	static get(e) {
		return e.getContribution(this.ID);
	}
	dispose() {
		this.stop(), this.removeAllDecorations(), super.dispose();
	}
	updateColors() {
		if (this.stop(), !this._isColorDecoratorsEnabled) return;
		let e = this._editor.getModel();
		!e || !this._languageFeaturesService.colorProvider.has(e) || (this._localToDispose.add(this._editor.onDidChangeModelContent(() => {
			this._timeoutTimer || (this._timeoutTimer = new TimeoutTimer(), this._timeoutTimer.cancelAndSet(() => {
				this._timeoutTimer = null, this.beginCompute();
			}, this._debounceInformation.get(e)));
		})), this.beginCompute());
	}
	async beginCompute() {
		this._computePromise = createCancelablePromise(async (e) => {
			let O = this._editor.getModel();
			if (!O) return [];
			let k = new StopWatch(!1), A = await getColors(this._languageFeaturesService.colorProvider, O, e, this._isDefaultColorDecoratorsEnabled);
			return this._debounceInformation.update(O, k.elapsed()), A;
		});
		try {
			let e = await this._computePromise;
			this.updateDecorations(e), this.updateColorDecorators(e), this._computePromise = null;
		} catch (e) {
			onUnexpectedError(e);
		}
	}
	stop() {
		this._timeoutTimer &&= (this._timeoutTimer.cancel(), null), this._computePromise &&= (this._computePromise.cancel(), null), this._localToDispose.clear();
	}
	updateDecorations(e) {
		let O = e.map((e) => ({
			range: {
				startLineNumber: e.colorInfo.range.startLineNumber,
				startColumn: e.colorInfo.range.startColumn,
				endLineNumber: e.colorInfo.range.endLineNumber,
				endColumn: e.colorInfo.range.endColumn
			},
			options: ModelDecorationOptions.EMPTY
		}));
		this._editor.changeDecorations((k) => {
			this._decorationsIds = k.deltaDecorations(this._decorationsIds, O), this._colorDatas = /* @__PURE__ */ new Map(), this._decorationsIds.forEach((O, k) => this._colorDatas.set(O, e[k]));
		});
	}
	updateColorDecorators(e) {
		this._colorDecorationClassRefs.clear();
		let O = [], k = this._editor.getOption(21);
		for (let A = 0; A < e.length && O.length < k; A++) {
			let { red: k, green: j, blue: M, alpha: N } = e[A].colorInfo.color, P = new RGBA(Math.round(k * 255), Math.round(j * 255), Math.round(M * 255), N), F = `rgba(${P.r}, ${P.g}, ${P.b}, ${P.a})`, I = this._colorDecorationClassRefs.add(this._ruleFactory.createClassNameRef({ backgroundColor: F }));
			O.push({
				range: {
					startLineNumber: e[A].colorInfo.range.startLineNumber,
					startColumn: e[A].colorInfo.range.startColumn,
					endLineNumber: e[A].colorInfo.range.endLineNumber,
					endColumn: e[A].colorInfo.range.endColumn
				},
				options: {
					description: "colorDetector",
					before: {
						content: "\xA0",
						inlineClassName: `${I.className} colorpicker-color-decoration`,
						inlineClassNameAffectsLetterSpacing: !0,
						attachedData: ColorDecorationInjectedTextMarker
					}
				}
			});
		}
		let A = k < e.length ? k : !1;
		this._decoratorLimitReporter.update(e.length, A), this._colorDecoratorIds.set(O);
	}
	removeAllDecorations() {
		this._editor.removeDecorations(this._decorationsIds), this._decorationsIds = [], this._colorDecoratorIds.clear(), this._colorDecorationClassRefs.clear();
	}
	getColorData(e) {
		let O = this._editor.getModel();
		if (!O) return null;
		let k = O.getDecorationsInRange(Range.fromPositions(e, e)).filter((e) => this._colorDatas.has(e.id));
		return k.length === 0 ? null : this._colorDatas.get(k[0].id);
	}
	isColorDecoration(e) {
		return this._colorDecoratorIds.has(e);
	}
};
ColorDetector = ColorDetector_1 = __decorate$88([
	__param$88(1, IConfigurationService),
	__param$88(2, ILanguageFeaturesService),
	__param$88(3, ILanguageFeatureDebounceService)
], ColorDetector);
var DecoratorLimitReporter = class {
	constructor() {
		this._onDidChange = new Emitter(), this._computed = 0, this._limited = !1;
	}
	update(e, O) {
		(e !== this._computed || O !== this._limited) && (this._computed = e, this._limited = O, this._onDidChange.fire());
	}
};
registerEditorContribution(ColorDetector.ID, ColorDetector, 1);
var ColorPickerModel = class {
	get color() {
		return this._color;
	}
	set color(e) {
		this._color.equals(e) || (this._color = e, this._onDidChangeColor.fire(e));
	}
	get presentation() {
		return this.colorPresentations[this.presentationIndex];
	}
	get colorPresentations() {
		return this._colorPresentations;
	}
	set colorPresentations(e) {
		this._colorPresentations = e, this.presentationIndex > e.length - 1 && (this.presentationIndex = 0), this._onDidChangePresentation.fire(this.presentation);
	}
	constructor(e, O, k) {
		this.presentationIndex = k, this._onColorFlushed = new Emitter(), this.onColorFlushed = this._onColorFlushed.event, this._onDidChangeColor = new Emitter(), this.onDidChangeColor = this._onDidChangeColor.event, this._onDidChangePresentation = new Emitter(), this.onDidChangePresentation = this._onDidChangePresentation.event, this.originalColor = e, this._color = e, this._colorPresentations = O;
	}
	selectNextColorPresentation() {
		this.presentationIndex = (this.presentationIndex + 1) % this.colorPresentations.length, this.flushColor(), this._onDidChangePresentation.fire(this.presentation);
	}
	guessColorPresentation(e, O) {
		let k = -1;
		for (let e = 0; e < this.colorPresentations.length; e++) if (O.toLowerCase() === this.colorPresentations[e].label) {
			k = e;
			break;
		}
		if (k === -1) {
			let e = O.split("(")[0].toLowerCase();
			for (let O = 0; O < this.colorPresentations.length; O++) if (this.colorPresentations[O].label.toLowerCase().startsWith(e)) {
				k = O;
				break;
			}
		}
		k !== -1 && k !== this.presentationIndex && (this.presentationIndex = k, this._onDidChangePresentation.fire(this.presentation));
	}
	flushColor() {
		this._onColorFlushed.fire(this._color);
	}
}, $$6 = $, ColorPickerHeader = class extends Disposable {
	constructor(e, O, k, A = !1) {
		super(), this.model = O, this.showingStandaloneColorPicker = A, this._closeButton = null, this._domNode = $$6(".colorpicker-header"), append(e, this._domNode), this._pickedColorNode = append(this._domNode, $$6(".picked-color")), append(this._pickedColorNode, $$6("span.codicon.codicon-color-mode")), this._pickedColorPresentation = append(this._pickedColorNode, document.createElement("span")), this._pickedColorPresentation.classList.add("picked-color-presentation");
		let j = localize("clickToToggleColorOptions", "Click to toggle color options (rgb/hsl/hex)");
		this._pickedColorNode.setAttribute("title", j), this._originalColorNode = append(this._domNode, $$6(".original-color")), this._originalColorNode.style.backgroundColor = Color.Format.CSS.format(this.model.originalColor) || "", this.backgroundColor = k.getColorTheme().getColor(editorHoverBackground) || Color.white, this._register(k.onDidColorThemeChange((e) => {
			this.backgroundColor = e.getColor(editorHoverBackground) || Color.white;
		})), this._register(addDisposableListener(this._pickedColorNode, EventType$1.CLICK, () => this.model.selectNextColorPresentation())), this._register(addDisposableListener(this._originalColorNode, EventType$1.CLICK, () => {
			this.model.color = this.model.originalColor, this.model.flushColor();
		})), this._register(O.onDidChangeColor(this.onDidChangeColor, this)), this._register(O.onDidChangePresentation(this.onDidChangePresentation, this)), this._pickedColorNode.style.backgroundColor = Color.Format.CSS.format(O.color) || "", this._pickedColorNode.classList.toggle("light", O.color.rgba.a < .5 ? this.backgroundColor.isLighter() : O.color.isLighter()), this.onDidChangeColor(this.model.color), this.showingStandaloneColorPicker && (this._domNode.classList.add("standalone-colorpicker"), this._closeButton = this._register(new CloseButton(this._domNode)));
	}
	get closeButton() {
		return this._closeButton;
	}
	get pickedColorNode() {
		return this._pickedColorNode;
	}
	get originalColorNode() {
		return this._originalColorNode;
	}
	onDidChangeColor(e) {
		this._pickedColorNode.style.backgroundColor = Color.Format.CSS.format(e) || "", this._pickedColorNode.classList.toggle("light", e.rgba.a < .5 ? this.backgroundColor.isLighter() : e.isLighter()), this.onDidChangePresentation();
	}
	onDidChangePresentation() {
		this._pickedColorPresentation.textContent = this.model.presentation ? this.model.presentation.label : "";
	}
}, CloseButton = class extends Disposable {
	constructor(e) {
		super(), this._onClicked = this._register(new Emitter()), this.onClicked = this._onClicked.event, this._button = document.createElement("div"), this._button.classList.add("close-button"), append(e, this._button);
		let O = document.createElement("div");
		O.classList.add("close-button-inner-div"), append(this._button, O), append(O, $$6(".button" + ThemeIcon.asCSSSelector(registerIcon("color-picker-close", Codicon.close, localize("closeIcon", "Icon to close the color picker"))))).classList.add("close-icon"), this._register(addDisposableListener(this._button, EventType$1.CLICK, () => {
			this._onClicked.fire();
		}));
	}
}, ColorPickerBody = class extends Disposable {
	constructor(e, O, k, A = !1) {
		super(), this.model = O, this.pixelRatio = k, this._insertButton = null, this._domNode = $$6(".colorpicker-body"), append(e, this._domNode), this._saturationBox = new SaturationBox(this._domNode, this.model, this.pixelRatio), this._register(this._saturationBox), this._register(this._saturationBox.onDidChange(this.onDidSaturationValueChange, this)), this._register(this._saturationBox.onColorFlushed(this.flushColor, this)), this._opacityStrip = new OpacityStrip(this._domNode, this.model, A), this._register(this._opacityStrip), this._register(this._opacityStrip.onDidChange(this.onDidOpacityChange, this)), this._register(this._opacityStrip.onColorFlushed(this.flushColor, this)), this._hueStrip = new HueStrip(this._domNode, this.model, A), this._register(this._hueStrip), this._register(this._hueStrip.onDidChange(this.onDidHueChange, this)), this._register(this._hueStrip.onColorFlushed(this.flushColor, this)), A && (this._insertButton = this._register(new InsertButton(this._domNode)), this._domNode.classList.add("standalone-colorpicker"));
	}
	flushColor() {
		this.model.flushColor();
	}
	onDidSaturationValueChange({ s: e, v: O }) {
		let k = this.model.color.hsva;
		this.model.color = new Color(new HSVA(k.h, e, O, k.a));
	}
	onDidOpacityChange(e) {
		let O = this.model.color.hsva;
		this.model.color = new Color(new HSVA(O.h, O.s, O.v, e));
	}
	onDidHueChange(e) {
		let O = this.model.color.hsva, k = (1 - e) * 360;
		this.model.color = new Color(new HSVA(k === 360 ? 0 : k, O.s, O.v, O.a));
	}
	get domNode() {
		return this._domNode;
	}
	get saturationBox() {
		return this._saturationBox;
	}
	get enterButton() {
		return this._insertButton;
	}
	layout() {
		this._saturationBox.layout(), this._opacityStrip.layout(), this._hueStrip.layout();
	}
}, SaturationBox = class extends Disposable {
	constructor(e, O, k) {
		super(), this.model = O, this.pixelRatio = k, this._onDidChange = new Emitter(), this.onDidChange = this._onDidChange.event, this._onColorFlushed = new Emitter(), this.onColorFlushed = this._onColorFlushed.event, this._domNode = $$6(".saturation-wrap"), append(e, this._domNode), this._canvas = document.createElement("canvas"), this._canvas.className = "saturation-box", append(this._domNode, this._canvas), this.selection = $$6(".saturation-selection"), append(this._domNode, this.selection), this.layout(), this._register(addDisposableListener(this._domNode, EventType$1.POINTER_DOWN, (e) => this.onPointerDown(e))), this._register(this.model.onDidChangeColor(this.onDidChangeColor, this)), this.monitor = null;
	}
	get domNode() {
		return this._domNode;
	}
	onPointerDown(e) {
		if (!e.target || !(e.target instanceof Element)) return;
		this.monitor = this._register(new GlobalPointerMoveMonitor());
		let O = getDomNodePagePosition(this._domNode);
		e.target !== this.selection && this.onDidChangePosition(e.offsetX, e.offsetY), this.monitor.startMonitoring(e.target, e.pointerId, e.buttons, (e) => this.onDidChangePosition(e.pageX - O.left, e.pageY - O.top), () => null);
		let k = addDisposableListener(e.target.ownerDocument, EventType$1.POINTER_UP, () => {
			this._onColorFlushed.fire(), k.dispose(), this.monitor &&= (this.monitor.stopMonitoring(!0), null);
		}, !0);
	}
	onDidChangePosition(e, O) {
		let k = Math.max(0, Math.min(1, e / this.width)), A = Math.max(0, Math.min(1, 1 - O / this.height));
		this.paintSelection(k, A), this._onDidChange.fire({
			s: k,
			v: A
		});
	}
	layout() {
		this.width = this._domNode.offsetWidth, this.height = this._domNode.offsetHeight, this._canvas.width = this.width * this.pixelRatio, this._canvas.height = this.height * this.pixelRatio, this.paint();
		let e = this.model.color.hsva;
		this.paintSelection(e.s, e.v);
	}
	paint() {
		let e = this.model.color.hsva, O = new Color(new HSVA(e.h, 1, 1, 1)), k = this._canvas.getContext("2d"), A = k.createLinearGradient(0, 0, this._canvas.width, 0);
		A.addColorStop(0, "rgba(255, 255, 255, 1)"), A.addColorStop(.5, "rgba(255, 255, 255, 0.5)"), A.addColorStop(1, "rgba(255, 255, 255, 0)");
		let j = k.createLinearGradient(0, 0, 0, this._canvas.height);
		j.addColorStop(0, "rgba(0, 0, 0, 0)"), j.addColorStop(1, "rgba(0, 0, 0, 1)"), k.rect(0, 0, this._canvas.width, this._canvas.height), k.fillStyle = Color.Format.CSS.format(O), k.fill(), k.fillStyle = A, k.fill(), k.fillStyle = j, k.fill();
	}
	paintSelection(e, O) {
		this.selection.style.left = `${e * this.width}px`, this.selection.style.top = `${this.height - O * this.height}px`;
	}
	onDidChangeColor(e) {
		if (this.monitor && this.monitor.isMonitoring()) return;
		this.paint();
		let O = e.hsva;
		this.paintSelection(O.s, O.v);
	}
}, Strip = class extends Disposable {
	constructor(e, O, k = !1) {
		super(), this.model = O, this._onDidChange = new Emitter(), this.onDidChange = this._onDidChange.event, this._onColorFlushed = new Emitter(), this.onColorFlushed = this._onColorFlushed.event, k ? (this.domNode = append(e, $$6(".standalone-strip")), this.overlay = append(this.domNode, $$6(".standalone-overlay"))) : (this.domNode = append(e, $$6(".strip")), this.overlay = append(this.domNode, $$6(".overlay"))), this.slider = append(this.domNode, $$6(".slider")), this.slider.style.top = "0px", this._register(addDisposableListener(this.domNode, EventType$1.POINTER_DOWN, (e) => this.onPointerDown(e))), this._register(O.onDidChangeColor(this.onDidChangeColor, this)), this.layout();
	}
	layout() {
		this.height = this.domNode.offsetHeight - this.slider.offsetHeight;
		let e = this.getValue(this.model.color);
		this.updateSliderPosition(e);
	}
	onDidChangeColor(e) {
		let O = this.getValue(e);
		this.updateSliderPosition(O);
	}
	onPointerDown(e) {
		if (!e.target || !(e.target instanceof Element)) return;
		let O = this._register(new GlobalPointerMoveMonitor()), k = getDomNodePagePosition(this.domNode);
		this.domNode.classList.add("grabbing"), e.target !== this.slider && this.onDidChangeTop(e.offsetY), O.startMonitoring(e.target, e.pointerId, e.buttons, (e) => this.onDidChangeTop(e.pageY - k.top), () => null);
		let A = addDisposableListener(e.target.ownerDocument, EventType$1.POINTER_UP, () => {
			this._onColorFlushed.fire(), A.dispose(), O.stopMonitoring(!0), this.domNode.classList.remove("grabbing");
		}, !0);
	}
	onDidChangeTop(e) {
		let O = Math.max(0, Math.min(1, 1 - e / this.height));
		this.updateSliderPosition(O), this._onDidChange.fire(O);
	}
	updateSliderPosition(e) {
		this.slider.style.top = `${(1 - e) * this.height}px`;
	}
}, OpacityStrip = class extends Strip {
	constructor(e, O, k = !1) {
		super(e, O, k), this.domNode.classList.add("opacity-strip"), this.onDidChangeColor(this.model.color);
	}
	onDidChangeColor(e) {
		super.onDidChangeColor(e);
		let { r: O, g: k, b: A } = e.rgba, j = new Color(new RGBA(O, k, A, 1)), M = new Color(new RGBA(O, k, A, 0));
		this.overlay.style.background = `linear-gradient(to bottom, ${j} 0%, ${M} 100%)`;
	}
	getValue(e) {
		return e.hsva.a;
	}
}, HueStrip = class extends Strip {
	constructor(e, O, k = !1) {
		super(e, O, k), this.domNode.classList.add("hue-strip");
	}
	getValue(e) {
		return 1 - e.hsva.h / 360;
	}
}, InsertButton = class extends Disposable {
	constructor(e) {
		super(), this._onClicked = this._register(new Emitter()), this.onClicked = this._onClicked.event, this._button = append(e, document.createElement("button")), this._button.classList.add("insert-button"), this._button.textContent = "Insert", this._register(addDisposableListener(this._button, EventType$1.CLICK, () => {
			this._onClicked.fire();
		}));
	}
	get button() {
		return this._button;
	}
}, ColorPickerWidget = class extends Widget {
	constructor(e, O, k, A, j = !1) {
		super(), this.model = O, this.pixelRatio = k, this._register(PixelRatio.getInstance(getWindow(e)).onDidChange(() => this.layout())), this._domNode = $$6(".colorpicker-widget"), e.appendChild(this._domNode), this.header = this._register(new ColorPickerHeader(this._domNode, this.model, A, j)), this.body = this._register(new ColorPickerBody(this._domNode, this.model, this.pixelRatio, j));
	}
	layout() {
		this.body.layout();
	}
	get domNode() {
		return this._domNode;
	}
}, HoverRangeAnchor = class {
	constructor(e, O, k, A) {
		this.priority = e, this.range = O, this.initialMousePosX = k, this.initialMousePosY = A, this.type = 1;
	}
	equals(e) {
		return e.type === 1 && this.range.equalsRange(e.range);
	}
	canAdoptVisibleHover(e, O) {
		return e.type === 1 && O.lineNumber === this.range.startLineNumber;
	}
}, HoverForeignElementAnchor = class {
	constructor(e, O, k, A, j, M) {
		this.priority = e, this.owner = O, this.range = k, this.initialMousePosX = A, this.initialMousePosY = j, this.supportsMarkerHover = M, this.type = 2;
	}
	equals(e) {
		return e.type === 2 && this.owner === e.owner;
	}
	canAdoptVisibleHover(e, O) {
		return e.type === 2 && this.owner === e.owner;
	}
}, RenderedHoverParts = class {
	constructor(e) {
		this.renderedHoverParts = e;
	}
	dispose() {
		for (let e of this.renderedHoverParts) e.dispose();
	}
};
const HoverParticipantRegistry = new class {
	constructor() {
		this._participants = [];
	}
	register(e) {
		this._participants.push(e);
	}
	getAll() {
		return this._participants;
	}
}();
var __decorate$87 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$87 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, ColorHover = class {
	constructor(e, O, k, A) {
		this.owner = e, this.range = O, this.model = k, this.provider = A, this.forceShowAtRange = !0;
	}
	isValidForHoverAnchor(e) {
		return e.type === 1 && this.range.startColumn <= e.range.startColumn && this.range.endColumn >= e.range.endColumn;
	}
}, ColorHoverParticipant = class {
	constructor(e, O) {
		this._editor = e, this._themeService = O, this.hoverOrdinal = 2;
	}
	computeSync(e, O) {
		return [];
	}
	computeAsync(e, O, k) {
		return AsyncIterableObject.fromPromise(this._computeAsync(e, O, k));
	}
	async _computeAsync(e, O, k) {
		if (!this._editor.hasModel()) return [];
		let A = ColorDetector.get(this._editor);
		if (!A) return [];
		for (let e of O) {
			if (!A.isColorDecoration(e)) continue;
			let O = A.getColorData(e.range.getStartPosition());
			if (O) return [await _createColorHover(this, this._editor.getModel(), O.colorInfo, O.provider)];
		}
		return [];
	}
	renderHoverParts(e, O) {
		let k = renderHoverParts(this, this._editor, this._themeService, O, e);
		if (!k) return new RenderedHoverParts([]);
		this._colorPicker = k.colorPicker;
		let A = {
			hoverPart: k.hoverPart,
			hoverElement: this._colorPicker.domNode,
			dispose() {
				k.disposables.dispose();
			}
		};
		return new RenderedHoverParts([A]);
	}
	handleResize() {
		this._colorPicker?.layout();
	}
	isColorPickerVisible() {
		return !!this._colorPicker;
	}
};
ColorHoverParticipant = __decorate$87([__param$87(1, IThemeService)], ColorHoverParticipant);
var StandaloneColorPickerHover = class {
	constructor(e, O, k, A) {
		this.owner = e, this.range = O, this.model = k, this.provider = A;
	}
}, StandaloneColorPickerParticipant = class {
	constructor(e, O) {
		this._editor = e, this._themeService = O, this._color = null;
	}
	async createColorHover(e, O, k) {
		if (!this._editor.hasModel() || !ColorDetector.get(this._editor)) return null;
		let A = await getColors(k, this._editor.getModel(), CancellationToken.None), j = null, M = null;
		for (let O of A) {
			let k = O.colorInfo;
			Range.containsRange(k.range, e.range) && (j = k, M = O.provider);
		}
		let N = j ?? e, P = M ?? O, F = !!j;
		return {
			colorHover: await _createColorHover(this, this._editor.getModel(), N, P),
			foundInEditor: F
		};
	}
	async updateEditorModel(e) {
		if (!this._editor.hasModel()) return;
		let O = e.model, k = new Range(e.range.startLineNumber, e.range.startColumn, e.range.endLineNumber, e.range.endColumn);
		this._color && (await _updateColorPresentations(this._editor.getModel(), O, this._color, k, e), k = _updateEditorModel(this._editor, k, O));
	}
	renderHoverParts(e, O) {
		return renderHoverParts(this, this._editor, this._themeService, O, e);
	}
	set color(e) {
		this._color = e;
	}
	get color() {
		return this._color;
	}
};
StandaloneColorPickerParticipant = __decorate$87([__param$87(1, IThemeService)], StandaloneColorPickerParticipant);
async function _createColorHover(e, O, k, A) {
	let j = O.getValueInRange(k.range), { red: M, green: N, blue: P, alpha: F } = k.color, I = new RGBA(Math.round(M * 255), Math.round(N * 255), Math.round(P * 255), F), L = new Color(I), R = await getColorPresentations(O, k, A, CancellationToken.None), z = new ColorPickerModel(L, [], 0);
	return z.colorPresentations = R || [], z.guessColorPresentation(L, j), e instanceof ColorHoverParticipant ? new ColorHover(e, Range.lift(k.range), z, A) : new StandaloneColorPickerHover(e, Range.lift(k.range), z, A);
}
function renderHoverParts(e, O, k, A, j) {
	if (A.length === 0 || !O.hasModel()) return;
	if (j.setMinimumDimensions) {
		let e = O.getOption(67) + 8;
		j.setMinimumDimensions(new Dimension(302, e));
	}
	let M = new DisposableStore(), N = A[0], P = O.getModel(), F = N.model, I = M.add(new ColorPickerWidget(j.fragment, F, O.getOption(144), k, e instanceof StandaloneColorPickerParticipant)), L = !1, R = new Range(N.range.startLineNumber, N.range.startColumn, N.range.endLineNumber, N.range.endColumn);
	if (e instanceof StandaloneColorPickerParticipant) {
		let O = N.model.color;
		e.color = O, _updateColorPresentations(P, F, O, R, N), M.add(F.onColorFlushed((O) => {
			e.color = O;
		}));
	} else M.add(F.onColorFlushed(async (e) => {
		await _updateColorPresentations(P, F, e, R, N), L = !0, R = _updateEditorModel(O, R, F);
	}));
	return M.add(F.onDidChangeColor((e) => {
		_updateColorPresentations(P, F, e, R, N);
	})), M.add(O.onDidChangeModelContent((e) => {
		L ? L = !1 : (j.hide(), O.focus());
	})), {
		hoverPart: N,
		colorPicker: I,
		disposables: M
	};
}
function _updateEditorModel(e, O, k) {
	let A = [], j = k.presentation.textEdit ?? {
		range: O,
		text: k.presentation.label,
		forceMoveMarkers: !1
	};
	A.push(j), k.presentation.additionalTextEdits && A.push(...k.presentation.additionalTextEdits);
	let M = Range.lift(j.range), N = e.getModel()._setTrackedRange(null, M, 3);
	return e.executeEdits("colorpicker", A), e.pushUndoStop(), e.getModel()._getTrackedRange(N) ?? M;
}
async function _updateColorPresentations(e, O, k, A, j) {
	O.colorPresentations = await getColorPresentations(e, {
		range: A,
		color: {
			red: k.rgba.r / 255,
			green: k.rgba.g / 255,
			blue: k.rgba.b / 255,
			alpha: k.rgba.a
		}
	}, j.provider, CancellationToken.None) || [];
}
const INCREASE_HOVER_VERBOSITY_ACTION_ID = "editor.action.increaseHoverVerbosityLevel", INCREASE_HOVER_VERBOSITY_ACTION_LABEL = localize({
	key: "increaseHoverVerbosityLevel",
	comment: ["Label for action that will increase the hover verbosity level."]
}, "Increase Hover Verbosity Level"), DECREASE_HOVER_VERBOSITY_ACTION_ID = "editor.action.decreaseHoverVerbosityLevel", DECREASE_HOVER_VERBOSITY_ACTION_LABEL = localize({
	key: "decreaseHoverVerbosityLevel",
	comment: ["Label for action that will decrease the hover verbosity level."]
}, "Decrease Hover Verbosity Level"), showPreviousInlineSuggestionActionId = "editor.action.inlineSuggest.showPrevious", showNextInlineSuggestionActionId = "editor.action.inlineSuggest.showNext";
var __decorate$86 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$86 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, InlineSuggestionHintsContentWidget_1, InlineCompletionsHintsWidget = class extends Disposable {
	constructor(e, O, k) {
		super(), this.editor = e, this.model = O, this.instantiationService = k, this.alwaysShowToolbar = observableFromEvent(this, this.editor.onDidChangeConfiguration, () => this.editor.getOption(62).showToolbar === "always"), this.sessionPosition = void 0, this.position = derived(this, (e) => {
			let O = this.model.read(e)?.primaryGhostText.read(e);
			if (!this.alwaysShowToolbar.read(e) || !O || O.parts.length === 0) return this.sessionPosition = void 0, null;
			let k = O.parts[0].column;
			this.sessionPosition && this.sessionPosition.lineNumber !== O.lineNumber && (this.sessionPosition = void 0);
			let A = new Position(O.lineNumber, Math.min(k, this.sessionPosition?.column ?? 2 ** 53 - 1));
			return this.sessionPosition = A, A;
		}), this._register(autorunWithStore((O, k) => {
			let A = this.model.read(O);
			if (!A || !this.alwaysShowToolbar.read(O)) return;
			let j = derivedWithStore((O, k) => {
				let j = k.add(this.instantiationService.createInstance(InlineSuggestionHintsContentWidget, this.editor, !0, this.position, A.selectedInlineCompletionIndex, A.inlineCompletionsCount, A.activeCommands));
				return e.addContentWidget(j), k.add(toDisposable(() => e.removeContentWidget(j))), k.add(autorun((e) => {
					this.position.read(e) && A.lastTriggerKind.read(e) !== InlineCompletionTriggerKind.Explicit && A.triggerExplicitly();
				})), j;
			}), M = derivedObservableWithCache(this, (e, O) => !!this.position.read(e) || !!O);
			k.add(autorun((e) => {
				M.read(e) && j.read(e);
			}));
		}));
	}
};
InlineCompletionsHintsWidget = __decorate$86([__param$86(2, IInstantiationService)], InlineCompletionsHintsWidget);
var inlineSuggestionHintsNextIcon = registerIcon("inline-suggestion-hints-next", Codicon.chevronRight, localize("parameterHintsNextIcon", "Icon for show next parameter hint.")), inlineSuggestionHintsPreviousIcon = registerIcon("inline-suggestion-hints-previous", Codicon.chevronLeft, localize("parameterHintsPreviousIcon", "Icon for show previous parameter hint.")), InlineSuggestionHintsContentWidget = class extends Disposable {
	static {
		InlineSuggestionHintsContentWidget_1 = this;
	}
	static {
		this._dropDownVisible = !1;
	}
	static get dropDownVisible() {
		return this._dropDownVisible;
	}
	static {
		this.id = 0;
	}
	createCommandAction(e, O, k) {
		let A = new Action(e, O, k, !0, () => this._commandService.executeCommand(e)), j = this.keybindingService.lookupKeybinding(e, this._contextKeyService), M = O;
		return j && (M = localize({
			key: "content",
			comment: ["A label", "A keybinding"]
		}, "{0} ({1})", O, j.getLabel())), A.tooltip = M, A;
	}
	constructor(e, O, k, A, j, M, N, P, F, I, L) {
		super(), this.editor = e, this.withBorder = O, this._position = k, this._currentSuggestionIdx = A, this._suggestionCount = j, this._extraCommands = M, this._commandService = N, this.keybindingService = F, this._contextKeyService = I, this._menuService = L, this.id = `InlineSuggestionHintsContentWidget${InlineSuggestionHintsContentWidget_1.id++}`, this.allowEditorOverflow = !0, this.suppressMouseDown = !1, this.nodes = h("div.inlineSuggestionsHints", { className: this.withBorder ? ".withBorder" : "" }, [h("div@toolBar")]), this.previousAction = this.createCommandAction(showPreviousInlineSuggestionActionId, localize("previous", "Previous"), ThemeIcon.asClassName(inlineSuggestionHintsPreviousIcon)), this.availableSuggestionCountAction = new Action("inlineSuggestionHints.availableSuggestionCount", "", void 0, !1), this.nextAction = this.createCommandAction(showNextInlineSuggestionActionId, localize("next", "Next"), ThemeIcon.asClassName(inlineSuggestionHintsNextIcon)), this.inlineCompletionsActionsMenus = this._register(this._menuService.createMenu(MenuId.InlineCompletionsActions, this._contextKeyService)), this.clearAvailableSuggestionCountLabelDebounced = this._register(new RunOnceScheduler(() => {
			this.availableSuggestionCountAction.label = "";
		}, 100)), this.disableButtonsDebounced = this._register(new RunOnceScheduler(() => {
			this.previousAction.enabled = this.nextAction.enabled = !1;
		}, 100)), this.toolBar = this._register(P.createInstance(CustomizedMenuWorkbenchToolBar$1, this.nodes.toolBar, MenuId.InlineSuggestionToolbar, {
			menuOptions: { renderShortTitle: !0 },
			toolbarOptions: { primaryGroup: (e) => e.startsWith("primary") },
			actionViewItemProvider: (e, O) => {
				if (e instanceof MenuItemAction) return P.createInstance(StatusBarViewItem$1, e, void 0);
				if (e === this.availableSuggestionCountAction) {
					let O = new ActionViewItemWithClassName(void 0, e, {
						label: !0,
						icon: !1
					});
					return O.setClass("availableSuggestionCount"), O;
				}
			},
			telemetrySource: "InlineSuggestionToolbar"
		})), this.toolBar.setPrependedPrimaryActions([
			this.previousAction,
			this.availableSuggestionCountAction,
			this.nextAction
		]), this._register(this.toolBar.onDidChangeDropdownVisibility((e) => {
			InlineSuggestionHintsContentWidget_1._dropDownVisible = e;
		})), this._register(autorun((e) => {
			this._position.read(e), this.editor.layoutContentWidget(this);
		})), this._register(autorun((e) => {
			let O = this._suggestionCount.read(e), k = this._currentSuggestionIdx.read(e);
			O === void 0 ? this.clearAvailableSuggestionCountLabelDebounced.schedule() : (this.clearAvailableSuggestionCountLabelDebounced.cancel(), this.availableSuggestionCountAction.label = `${k + 1}/${O}`), O !== void 0 && O > 1 ? (this.disableButtonsDebounced.cancel(), this.previousAction.enabled = this.nextAction.enabled = !0) : this.disableButtonsDebounced.schedule();
		})), this._register(autorun((e) => {
			let O = this._extraCommands.read(e).map((e) => ({
				class: void 0,
				id: e.id,
				enabled: !0,
				tooltip: e.tooltip || "",
				label: e.title,
				run: (O) => this._commandService.executeCommand(e.id)
			}));
			for (let [e, k] of this.inlineCompletionsActionsMenus.getActions()) for (let e of k) e instanceof MenuItemAction && O.push(e);
			O.length > 0 && O.unshift(new Separator()), this.toolBar.setAdditionalSecondaryActions(O);
		}));
	}
	getId() {
		return this.id;
	}
	getDomNode() {
		return this.nodes.root;
	}
	getPosition() {
		return {
			position: this._position.get(),
			preference: [1, 2],
			positionAffinity: 3
		};
	}
};
InlineSuggestionHintsContentWidget = InlineSuggestionHintsContentWidget_1 = __decorate$86([
	__param$86(6, ICommandService),
	__param$86(7, IInstantiationService),
	__param$86(8, IKeybindingService),
	__param$86(9, IContextKeyService),
	__param$86(10, IMenuService)
], InlineSuggestionHintsContentWidget);
var ActionViewItemWithClassName = class extends ActionViewItem {
	constructor() {
		super(...arguments), this._className = void 0;
	}
	setClass(e) {
		this._className = e;
	}
	render(e) {
		super.render(e), this._className && e.classList.add(this._className);
	}
	updateTooltip() {}
}, StatusBarViewItem$1 = class extends MenuEntryActionViewItem {
	updateLabel() {
		let e = this._keybindingService.lookupKeybinding(this._action.id, this._contextKeyService);
		if (!e) return super.updateLabel();
		if (this.label) {
			let O = h("div.keybinding").root;
			this._register(new KeybindingLabel(O, OS, {
				disableTitle: !0,
				...unthemedKeybindingLabelOptions
			})).set(e), this.label.textContent = this._action.label, this.label.appendChild(O), this.label.classList.add("inlineSuggestionStatusBarItemLabel");
		}
	}
	updateTooltip() {}
}, CustomizedMenuWorkbenchToolBar$1 = class extends WorkbenchToolBar {
	constructor(e, O, k, A, j, M, N, P, F) {
		super(e, {
			resetMenu: O,
			...k
		}, A, j, M, N, P, F), this.menuId = O, this.options2 = k, this.menuService = A, this.contextKeyService = j, this.menu = this._store.add(this.menuService.createMenu(this.menuId, this.contextKeyService, { emitEventsForSubmenuChanges: !0 })), this.additionalActions = [], this.prependedPrimaryActions = [], this._store.add(this.menu.onDidChange(() => this.updateToolbar())), this.updateToolbar();
	}
	updateToolbar() {
		let e = [], O = [];
		createAndFillInActionBarActions(this.menu, this.options2?.menuOptions, {
			primary: e,
			secondary: O
		}, this.options2?.toolbarOptions?.primaryGroup, this.options2?.toolbarOptions?.shouldInlineSubmenu, this.options2?.toolbarOptions?.useSeparatorsInPrimaryActions), O.push(...this.additionalActions), e.unshift(...this.prependedPrimaryActions), this.setActions(e, O);
	}
	setPrependedPrimaryActions(e) {
		equals(this.prependedPrimaryActions, e, (e, O) => e === O) || (this.prependedPrimaryActions = e, this.updateToolbar());
	}
	setAdditionalSecondaryActions(e) {
		equals(this.additionalActions, e, (e, O) => e === O) || (this.additionalActions = e, this.updateToolbar());
	}
};
CustomizedMenuWorkbenchToolBar$1 = __decorate$86([
	__param$86(3, IMenuService),
	__param$86(4, IContextKeyService),
	__param$86(5, IContextMenuService),
	__param$86(6, IKeybindingService),
	__param$86(7, ICommandService),
	__param$86(8, ITelemetryService)
], CustomizedMenuWorkbenchToolBar$1);
function isMousePositionWithinElement(e, O, k) {
	let A = getDomNodePagePosition(e);
	return !(O < A.left || O > A.left + A.width || k < A.top || k > A.top + A.height);
}
var HoverResult$1 = class {
	constructor(e, O, k) {
		this.value = e, this.isComplete = O, this.hasLoadingMessage = k;
	}
}, HoverOperation = class extends Disposable {
	constructor(e, O) {
		super(), this._editor = e, this._computer = O, this._onResult = this._register(new Emitter()), this.onResult = this._onResult.event, this._firstWaitScheduler = this._register(new RunOnceScheduler(() => this._triggerAsyncComputation(), 0)), this._secondWaitScheduler = this._register(new RunOnceScheduler(() => this._triggerSyncComputation(), 0)), this._loadingMessageScheduler = this._register(new RunOnceScheduler(() => this._triggerLoadingMessage(), 0)), this._state = 0, this._asyncIterable = null, this._asyncIterableDone = !1, this._result = [];
	}
	dispose() {
		this._asyncIterable &&= (this._asyncIterable.cancel(), null), super.dispose();
	}
	get _hoverTime() {
		return this._editor.getOption(60).delay;
	}
	get _firstWaitTime() {
		return this._hoverTime / 2;
	}
	get _secondWaitTime() {
		return this._hoverTime - this._firstWaitTime;
	}
	get _loadingMessageTime() {
		return 3 * this._hoverTime;
	}
	_setState(e, O = !0) {
		this._state = e, O && this._fireResult();
	}
	_triggerAsyncComputation() {
		this._setState(2), this._secondWaitScheduler.schedule(this._secondWaitTime), this._computer.computeAsync ? (this._asyncIterableDone = !1, this._asyncIterable = createCancelableAsyncIterable((e) => this._computer.computeAsync(e)), (async () => {
			try {
				for await (let e of this._asyncIterable) e && (this._result.push(e), this._fireResult());
				this._asyncIterableDone = !0, (this._state === 3 || this._state === 4) && this._setState(0);
			} catch (e) {
				onUnexpectedError(e);
			}
		})()) : this._asyncIterableDone = !0;
	}
	_triggerSyncComputation() {
		this._computer.computeSync && (this._result = this._result.concat(this._computer.computeSync())), this._setState(this._asyncIterableDone ? 0 : 3);
	}
	_triggerLoadingMessage() {
		this._state === 3 && this._setState(4);
	}
	_fireResult() {
		if (this._state === 1 || this._state === 2) return;
		let e = this._state === 0, O = this._state === 4;
		this._onResult.fire(new HoverResult$1(this._result.slice(0), e, O));
	}
	start(e) {
		if (e === 0) this._state === 0 && (this._setState(1), this._firstWaitScheduler.schedule(this._firstWaitTime), this._loadingMessageScheduler.schedule(this._loadingMessageTime));
		else switch (this._state) {
			case 0:
				this._triggerAsyncComputation(), this._secondWaitScheduler.cancel(), this._triggerSyncComputation();
				break;
			case 2:
				this._secondWaitScheduler.cancel(), this._triggerSyncComputation();
				break;
		}
	}
	cancel() {
		this._firstWaitScheduler.cancel(), this._secondWaitScheduler.cancel(), this._loadingMessageScheduler.cancel(), this._asyncIterable &&= (this._asyncIterable.cancel(), null), this._result = [], this._setState(0, !1);
	}
}, ResizableHTMLElement = class {
	constructor() {
		this._onDidWillResize = new Emitter(), this.onDidWillResize = this._onDidWillResize.event, this._onDidResize = new Emitter(), this.onDidResize = this._onDidResize.event, this._sashListener = new DisposableStore(), this._size = new Dimension(0, 0), this._minSize = new Dimension(0, 0), this._maxSize = new Dimension(2 ** 53 - 1, 2 ** 53 - 1), this.domNode = document.createElement("div"), this._eastSash = new Sash(this.domNode, { getVerticalSashLeft: () => this._size.width }, { orientation: 0 }), this._westSash = new Sash(this.domNode, { getVerticalSashLeft: () => 0 }, { orientation: 0 }), this._northSash = new Sash(this.domNode, { getHorizontalSashTop: () => 0 }, {
			orientation: 1,
			orthogonalEdge: OrthogonalEdge.North
		}), this._southSash = new Sash(this.domNode, { getHorizontalSashTop: () => this._size.height }, {
			orientation: 1,
			orthogonalEdge: OrthogonalEdge.South
		}), this._northSash.orthogonalStartSash = this._westSash, this._northSash.orthogonalEndSash = this._eastSash, this._southSash.orthogonalStartSash = this._westSash, this._southSash.orthogonalEndSash = this._eastSash;
		let e, O = 0, k = 0;
		this._sashListener.add(Event.any(this._northSash.onDidStart, this._eastSash.onDidStart, this._southSash.onDidStart, this._westSash.onDidStart)(() => {
			e === void 0 && (this._onDidWillResize.fire(), e = this._size, O = 0, k = 0);
		})), this._sashListener.add(Event.any(this._northSash.onDidEnd, this._eastSash.onDidEnd, this._southSash.onDidEnd, this._westSash.onDidEnd)(() => {
			e !== void 0 && (e = void 0, O = 0, k = 0, this._onDidResize.fire({
				dimension: this._size,
				done: !0
			}));
		})), this._sashListener.add(this._eastSash.onDidChange((A) => {
			e && (k = A.currentX - A.startX, this.layout(e.height + O, e.width + k), this._onDidResize.fire({
				dimension: this._size,
				done: !1,
				east: !0
			}));
		})), this._sashListener.add(this._westSash.onDidChange((A) => {
			e && (k = -(A.currentX - A.startX), this.layout(e.height + O, e.width + k), this._onDidResize.fire({
				dimension: this._size,
				done: !1,
				west: !0
			}));
		})), this._sashListener.add(this._northSash.onDidChange((A) => {
			e && (O = -(A.currentY - A.startY), this.layout(e.height + O, e.width + k), this._onDidResize.fire({
				dimension: this._size,
				done: !1,
				north: !0
			}));
		})), this._sashListener.add(this._southSash.onDidChange((A) => {
			e && (O = A.currentY - A.startY, this.layout(e.height + O, e.width + k), this._onDidResize.fire({
				dimension: this._size,
				done: !1,
				south: !0
			}));
		})), this._sashListener.add(Event.any(this._eastSash.onDidReset, this._westSash.onDidReset)((e) => {
			this._preferredSize && (this.layout(this._size.height, this._preferredSize.width), this._onDidResize.fire({
				dimension: this._size,
				done: !0
			}));
		})), this._sashListener.add(Event.any(this._northSash.onDidReset, this._southSash.onDidReset)((e) => {
			this._preferredSize && (this.layout(this._preferredSize.height, this._size.width), this._onDidResize.fire({
				dimension: this._size,
				done: !0
			}));
		}));
	}
	dispose() {
		this._northSash.dispose(), this._southSash.dispose(), this._eastSash.dispose(), this._westSash.dispose(), this._sashListener.dispose(), this._onDidResize.dispose(), this._onDidWillResize.dispose(), this.domNode.remove();
	}
	enableSashes(e, O, k, A) {
		this._northSash.state = e ? 3 : 0, this._eastSash.state = O ? 3 : 0, this._southSash.state = k ? 3 : 0, this._westSash.state = A ? 3 : 0;
	}
	layout(e = this.size.height, O = this.size.width) {
		let { height: k, width: A } = this._minSize, { height: j, width: M } = this._maxSize;
		e = Math.max(k, Math.min(j, e)), O = Math.max(A, Math.min(M, O));
		let N = new Dimension(O, e);
		Dimension.equals(N, this._size) || (this.domNode.style.height = e + "px", this.domNode.style.width = O + "px", this._size = N, this._northSash.layout(), this._eastSash.layout(), this._southSash.layout(), this._westSash.layout());
	}
	clearSashHoverState() {
		this._eastSash.clearSashHoverState(), this._westSash.clearSashHoverState(), this._northSash.clearSashHoverState(), this._southSash.clearSashHoverState();
	}
	get size() {
		return this._size;
	}
	set maxSize(e) {
		this._maxSize = e;
	}
	get maxSize() {
		return this._maxSize;
	}
	set minSize(e) {
		this._minSize = e;
	}
	get minSize() {
		return this._minSize;
	}
	set preferredSize(e) {
		this._preferredSize = e;
	}
	get preferredSize() {
		return this._preferredSize;
	}
}, TOP_HEIGHT = 30, BOTTOM_HEIGHT = 24, ResizableContentWidget = class extends Disposable {
	constructor(e, O = new Dimension(10, 10)) {
		super(), this._editor = e, this.allowEditorOverflow = !0, this.suppressMouseDown = !1, this._resizableNode = this._register(new ResizableHTMLElement()), this._contentPosition = null, this._isResizing = !1, this._resizableNode.domNode.style.position = "absolute", this._resizableNode.minSize = Dimension.lift(O), this._resizableNode.layout(O.height, O.width), this._resizableNode.enableSashes(!0, !0, !0, !0), this._register(this._resizableNode.onDidResize((e) => {
			this._resize(new Dimension(e.dimension.width, e.dimension.height)), e.done && (this._isResizing = !1);
		})), this._register(this._resizableNode.onDidWillResize(() => {
			this._isResizing = !0;
		}));
	}
	get isResizing() {
		return this._isResizing;
	}
	getDomNode() {
		return this._resizableNode.domNode;
	}
	getPosition() {
		return this._contentPosition;
	}
	get position() {
		return this._contentPosition?.position ? Position.lift(this._contentPosition.position) : void 0;
	}
	_availableVerticalSpaceAbove(e) {
		let O = this._editor.getDomNode(), k = this._editor.getScrolledVisiblePosition(e);
		if (!(!O || !k)) return getDomNodePagePosition(O).top + k.top - TOP_HEIGHT;
	}
	_availableVerticalSpaceBelow(e) {
		let O = this._editor.getDomNode(), k = this._editor.getScrolledVisiblePosition(e);
		if (!O || !k) return;
		let A = getDomNodePagePosition(O), j = getClientArea(O.ownerDocument.body), M = A.top + k.top + k.height;
		return j.height - M - BOTTOM_HEIGHT;
	}
	_findPositionPreference(e, O) {
		let k = Math.min(this._availableVerticalSpaceBelow(O) ?? Infinity, e), A = Math.min(this._availableVerticalSpaceAbove(O) ?? Infinity, e), j = Math.min(Math.max(A, k), e), M = Math.min(e, j), N;
		return N = this._editor.getOption(60).above ? M <= A ? 1 : 2 : M <= k ? 2 : 1, N === 1 ? this._resizableNode.enableSashes(!0, !0, !1, !1) : this._resizableNode.enableSashes(!1, !0, !0, !1), N;
	}
	_resize(e) {
		this._resizableNode.layout(e.height, e.width);
	}
}, __decorate$85 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$85 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, ContentHoverWidget_1, HORIZONTAL_SCROLLING_BY = 30, CONTAINER_HEIGHT_PADDING = 6, ContentHoverWidget = class extends ResizableContentWidget {
	static {
		ContentHoverWidget_1 = this;
	}
	static {
		this.ID = "editor.contrib.resizableContentHoverWidget";
	}
	static {
		this._lastDimensions = new Dimension(0, 0);
	}
	get isVisibleFromKeyboard() {
		return this._renderedHover?.source === 1;
	}
	get isVisible() {
		return this._hoverVisibleKey.get() ?? !1;
	}
	get isFocused() {
		return this._hoverFocusedKey.get() ?? !1;
	}
	constructor(e, O, k, A, j) {
		let M = e.getOption(67) + 8, N = new Dimension(150, M);
		super(e, N), this._configurationService = k, this._accessibilityService = A, this._keybindingService = j, this._hover = this._register(new HoverWidget()), this._onDidResize = this._register(new Emitter()), this.onDidResize = this._onDidResize.event, this._minimumSize = N, this._hoverVisibleKey = EditorContextKeys.hoverVisible.bindTo(O), this._hoverFocusedKey = EditorContextKeys.hoverFocused.bindTo(O), append(this._resizableNode.domNode, this._hover.containerDomNode), this._resizableNode.domNode.style.zIndex = "50", this._register(this._editor.onDidLayoutChange(() => {
			this.isVisible && this._updateMaxDimensions();
		})), this._register(this._editor.onDidChangeConfiguration((e) => {
			e.hasChanged(50) && this._updateFont();
		}));
		let P = this._register(trackFocus(this._resizableNode.domNode));
		this._register(P.onDidFocus(() => {
			this._hoverFocusedKey.set(!0);
		})), this._register(P.onDidBlur(() => {
			this._hoverFocusedKey.set(!1);
		})), this._setRenderedHover(void 0), this._editor.addContentWidget(this);
	}
	dispose() {
		super.dispose(), this._renderedHover?.dispose(), this._editor.removeContentWidget(this);
	}
	getId() {
		return ContentHoverWidget_1.ID;
	}
	static _applyDimensions(e, O, k) {
		let A = typeof O == "number" ? `${O}px` : O, j = typeof k == "number" ? `${k}px` : k;
		e.style.width = A, e.style.height = j;
	}
	_setContentsDomNodeDimensions(e, O) {
		let k = this._hover.contentsDomNode;
		return ContentHoverWidget_1._applyDimensions(k, e, O);
	}
	_setContainerDomNodeDimensions(e, O) {
		let k = this._hover.containerDomNode;
		return ContentHoverWidget_1._applyDimensions(k, e, O);
	}
	_setHoverWidgetDimensions(e, O) {
		this._setContentsDomNodeDimensions(e, O), this._setContainerDomNodeDimensions(e, O), this._layoutContentWidget();
	}
	static _applyMaxDimensions(e, O, k) {
		let A = typeof O == "number" ? `${O}px` : O, j = typeof k == "number" ? `${k}px` : k;
		e.style.maxWidth = A, e.style.maxHeight = j;
	}
	_setHoverWidgetMaxDimensions(e, O) {
		ContentHoverWidget_1._applyMaxDimensions(this._hover.contentsDomNode, e, O), ContentHoverWidget_1._applyMaxDimensions(this._hover.containerDomNode, e, O), this._hover.containerDomNode.style.setProperty("--vscode-hover-maxWidth", typeof e == "number" ? `${e}px` : e), this._layoutContentWidget();
	}
	_setAdjustedHoverWidgetDimensions(e) {
		this._setHoverWidgetMaxDimensions("none", "none");
		let O = e.width, k = e.height;
		this._setHoverWidgetDimensions(O, k);
	}
	_updateResizableNodeMaxDimensions() {
		let e = this._findMaximumRenderingWidth() ?? Infinity, O = this._findMaximumRenderingHeight() ?? Infinity;
		this._resizableNode.maxSize = new Dimension(e, O), this._setHoverWidgetMaxDimensions(e, O);
	}
	_resize(e) {
		ContentHoverWidget_1._lastDimensions = new Dimension(e.width, e.height), this._setAdjustedHoverWidgetDimensions(e), this._resizableNode.layout(e.height, e.width), this._updateResizableNodeMaxDimensions(), this._hover.scrollbar.scanDomNode(), this._editor.layoutContentWidget(this), this._onDidResize.fire();
	}
	_findAvailableSpaceVertically() {
		let e = this._renderedHover?.showAtPosition;
		if (e) return this._positionPreference === 1 ? this._availableVerticalSpaceAbove(e) : this._availableVerticalSpaceBelow(e);
	}
	_findMaximumRenderingHeight() {
		let e = this._findAvailableSpaceVertically();
		if (!e) return;
		let O = CONTAINER_HEIGHT_PADDING;
		return Array.from(this._hover.contentsDomNode.children).forEach((e) => {
			O += e.clientHeight;
		}), Math.min(e, O);
	}
	_isHoverTextOverflowing() {
		this._hover.containerDomNode.style.setProperty("--vscode-hover-whiteSpace", "nowrap"), this._hover.containerDomNode.style.setProperty("--vscode-hover-sourceWhiteSpace", "nowrap");
		let e = Array.from(this._hover.contentsDomNode.children).some((e) => e.scrollWidth > e.clientWidth);
		return this._hover.containerDomNode.style.removeProperty("--vscode-hover-whiteSpace"), this._hover.containerDomNode.style.removeProperty("--vscode-hover-sourceWhiteSpace"), e;
	}
	_findMaximumRenderingWidth() {
		if (!this._editor || !this._editor.hasModel()) return;
		let e = this._isHoverTextOverflowing(), O = this._contentWidth === void 0 ? 0 : this._contentWidth - 2;
		return e || this._hover.containerDomNode.clientWidth < O ? getClientArea(this._hover.containerDomNode.ownerDocument.body).width - 14 : this._hover.containerDomNode.clientWidth + 2;
	}
	isMouseGettingCloser(e, O) {
		if (!this._renderedHover) return !1;
		if (this._renderedHover.initialMousePosX === void 0 || this._renderedHover.initialMousePosY === void 0) return this._renderedHover.initialMousePosX = e, this._renderedHover.initialMousePosY = O, !1;
		let k = getDomNodePagePosition(this.getDomNode());
		this._renderedHover.closestMouseDistance === void 0 && (this._renderedHover.closestMouseDistance = computeDistanceFromPointToRectangle(this._renderedHover.initialMousePosX, this._renderedHover.initialMousePosY, k.left, k.top, k.width, k.height));
		let A = computeDistanceFromPointToRectangle(e, O, k.left, k.top, k.width, k.height);
		return A > this._renderedHover.closestMouseDistance + 4 ? !1 : (this._renderedHover.closestMouseDistance = Math.min(this._renderedHover.closestMouseDistance, A), !0);
	}
	_setRenderedHover(e) {
		this._renderedHover?.dispose(), this._renderedHover = e, this._hoverVisibleKey.set(!!e), this._hover.containerDomNode.classList.toggle("hidden", !e);
	}
	_updateFont() {
		let { fontSize: e, lineHeight: O } = this._editor.getOption(50), k = this._hover.contentsDomNode;
		k.style.fontSize = `${e}px`, k.style.lineHeight = `${O / e}`, Array.prototype.slice.call(this._hover.contentsDomNode.getElementsByClassName("code")).forEach((e) => this._editor.applyFontInfo(e));
	}
	_updateContent(e) {
		let O = this._hover.contentsDomNode;
		O.style.paddingBottom = "", O.textContent = "", O.appendChild(e);
	}
	_layoutContentWidget() {
		this._editor.layoutContentWidget(this), this._hover.onContentsChanged();
	}
	_updateMaxDimensions() {
		let e = Math.max(this._editor.getLayoutInfo().height / 4, 250, ContentHoverWidget_1._lastDimensions.height), O = Math.max(this._editor.getLayoutInfo().width * .66, 500, ContentHoverWidget_1._lastDimensions.width);
		this._setHoverWidgetMaxDimensions(O, e);
	}
	_render(e) {
		this._setRenderedHover(e), this._updateFont(), this._updateContent(e.domNode), this._updateMaxDimensions(), this.onContentsChanged(), this._editor.render();
	}
	getPosition() {
		return this._renderedHover ? {
			position: this._renderedHover.showAtPosition,
			secondaryPosition: this._renderedHover.showAtSecondaryPosition,
			positionAffinity: this._renderedHover.shouldAppearBeforeContent ? 3 : void 0,
			preference: [this._positionPreference ?? 1]
		} : null;
	}
	show(e) {
		if (!this._editor || !this._editor.hasModel()) return;
		this._render(e);
		let O = getTotalHeight(this._hover.containerDomNode), k = e.showAtPosition;
		this._positionPreference = this._findPositionPreference(O, k) ?? 1, this.onContentsChanged(), e.shouldFocus && this._hover.containerDomNode.focus(), this._onDidResize.fire();
		let A = this._hover.containerDomNode.ownerDocument.activeElement === this._hover.containerDomNode && getHoverAccessibleViewHint(this._configurationService.getValue("accessibility.verbosity.hover") === !0 && this._accessibilityService.isScreenReaderOptimized(), this._keybindingService.lookupKeybinding("editor.action.accessibleView")?.getAriaLabel() ?? "");
		A && (this._hover.contentsDomNode.ariaLabel = this._hover.contentsDomNode.textContent + ", " + A);
	}
	hide() {
		if (!this._renderedHover) return;
		let e = this._renderedHover.shouldFocus || this._hoverFocusedKey.get();
		this._setRenderedHover(void 0), this._resizableNode.maxSize = new Dimension(Infinity, Infinity), this._resizableNode.clearSashHoverState(), this._hoverFocusedKey.set(!1), this._editor.layoutContentWidget(this), e && this._editor.focus();
	}
	_removeConstraintsRenderNormally() {
		let e = this._editor.getLayoutInfo();
		this._resizableNode.layout(e.height, e.width), this._setHoverWidgetDimensions("auto", "auto");
	}
	setMinimumDimensions(e) {
		this._minimumSize = new Dimension(Math.max(this._minimumSize.width, e.width), Math.max(this._minimumSize.height, e.height)), this._updateMinimumWidth();
	}
	_updateMinimumWidth() {
		let e = this._contentWidth === void 0 ? this._minimumSize.width : Math.min(this._contentWidth, this._minimumSize.width);
		this._resizableNode.minSize = new Dimension(e, this._minimumSize.height);
	}
	onContentsChanged() {
		this._removeConstraintsRenderNormally();
		let e = this._hover.containerDomNode, O = getTotalHeight(e), k = getTotalWidth(e);
		if (this._resizableNode.layout(O, k), this._setHoverWidgetDimensions(k, O), O = getTotalHeight(e), k = getTotalWidth(e), this._contentWidth = k, this._updateMinimumWidth(), this._resizableNode.layout(O, k), this._renderedHover?.showAtPosition) {
			let e = getTotalHeight(this._hover.containerDomNode);
			this._positionPreference = this._findPositionPreference(e, this._renderedHover.showAtPosition);
		}
		this._layoutContentWidget();
	}
	focus() {
		this._hover.containerDomNode.focus();
	}
	scrollUp() {
		let e = this._hover.scrollbar.getScrollPosition().scrollTop, O = this._editor.getOption(50);
		this._hover.scrollbar.setScrollPosition({ scrollTop: e - O.lineHeight });
	}
	scrollDown() {
		let e = this._hover.scrollbar.getScrollPosition().scrollTop, O = this._editor.getOption(50);
		this._hover.scrollbar.setScrollPosition({ scrollTop: e + O.lineHeight });
	}
	scrollLeft() {
		let e = this._hover.scrollbar.getScrollPosition().scrollLeft;
		this._hover.scrollbar.setScrollPosition({ scrollLeft: e - HORIZONTAL_SCROLLING_BY });
	}
	scrollRight() {
		let e = this._hover.scrollbar.getScrollPosition().scrollLeft;
		this._hover.scrollbar.setScrollPosition({ scrollLeft: e + HORIZONTAL_SCROLLING_BY });
	}
	pageUp() {
		let e = this._hover.scrollbar.getScrollPosition().scrollTop, O = this._hover.scrollbar.getScrollDimensions().height;
		this._hover.scrollbar.setScrollPosition({ scrollTop: e - O });
	}
	pageDown() {
		let e = this._hover.scrollbar.getScrollPosition().scrollTop, O = this._hover.scrollbar.getScrollDimensions().height;
		this._hover.scrollbar.setScrollPosition({ scrollTop: e + O });
	}
	goToTop() {
		this._hover.scrollbar.setScrollPosition({ scrollTop: 0 });
	}
	goToBottom() {
		this._hover.scrollbar.setScrollPosition({ scrollTop: this._hover.scrollbar.getScrollDimensions().scrollHeight });
	}
};
ContentHoverWidget = ContentHoverWidget_1 = __decorate$85([
	__param$85(1, IContextKeyService),
	__param$85(2, IConfigurationService),
	__param$85(3, IAccessibilityService),
	__param$85(4, IKeybindingService)
], ContentHoverWidget);
function computeDistanceFromPointToRectangle(e, O, k, A, j, M) {
	let N = k + j / 2, P = A + M / 2, F = Math.max(Math.abs(e - N) - j / 2, 0), I = Math.max(Math.abs(O - P) - M / 2, 0);
	return Math.sqrt(F * F + I * I);
}
var ContentHoverComputer = class e {
	get anchor() {
		return this._anchor;
	}
	set anchor(e) {
		this._anchor = e;
	}
	get shouldFocus() {
		return this._shouldFocus;
	}
	set shouldFocus(e) {
		this._shouldFocus = e;
	}
	get source() {
		return this._source;
	}
	set source(e) {
		this._source = e;
	}
	get insistOnKeepingHoverVisible() {
		return this._insistOnKeepingHoverVisible;
	}
	set insistOnKeepingHoverVisible(e) {
		this._insistOnKeepingHoverVisible = e;
	}
	constructor(e, O) {
		this._editor = e, this._participants = O, this._anchor = null, this._shouldFocus = !1, this._source = 0, this._insistOnKeepingHoverVisible = !1;
	}
	static _getLineDecorations(e, O) {
		if (O.type !== 1 && !O.supportsMarkerHover) return [];
		let k = e.getModel(), A = O.range.startLineNumber;
		if (A > k.getLineCount()) return [];
		let j = k.getLineMaxColumn(A);
		return e.getLineDecorations(A).filter((e) => {
			if (e.options.isWholeLine) return !0;
			let k = e.range.startLineNumber === A ? e.range.startColumn : 1, M = e.range.endLineNumber === A ? e.range.endColumn : j;
			if (e.options.showIfCollapsed) {
				if (k > O.range.startColumn + 1 || O.range.endColumn - 1 > M) return !1;
			} else if (k > O.range.startColumn || O.range.endColumn > M) return !1;
			return !0;
		});
	}
	computeAsync(O) {
		let k = this._anchor;
		if (!this._editor.hasModel() || !k) return AsyncIterableObject.EMPTY;
		let A = e._getLineDecorations(this._editor, k);
		return AsyncIterableObject.merge(this._participants.map((e) => e.computeAsync ? e.computeAsync(k, A, O) : AsyncIterableObject.EMPTY));
	}
	computeSync() {
		if (!this._editor.hasModel() || !this._anchor) return [];
		let O = e._getLineDecorations(this._editor, this._anchor), k = [];
		for (let e of this._participants) k = k.concat(e.computeSync(this._anchor, O));
		return coalesce(k);
	}
}, HoverResult = class {
	constructor(e, O, k) {
		this.anchor = e, this.hoverParts = O, this.isComplete = k;
	}
	filter(e) {
		let O = this.hoverParts.filter((O) => O.isValidForHoverAnchor(e));
		return O.length === this.hoverParts.length ? this : new FilteredHoverResult(this, this.anchor, O, this.isComplete);
	}
}, FilteredHoverResult = class extends HoverResult {
	constructor(e, O, k, A) {
		super(O, k, A), this.original = e;
	}
	filter(e) {
		return this.original.filter(e);
	}
}, __decorate$84 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$84 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, $$5 = $, EditorHoverStatusBar = class extends Disposable {
	get hasContent() {
		return this._hasContent;
	}
	constructor(e) {
		super(), this._keybindingService = e, this.actions = [], this._hasContent = !1, this.hoverElement = $$5("div.hover-row.status-bar"), this.hoverElement.tabIndex = 0, this.actionsElement = append(this.hoverElement, $$5("div.actions"));
	}
	addAction(e) {
		let O = this._keybindingService.lookupKeybinding(e.commandId), k = O ? O.getLabel() : null;
		this._hasContent = !0;
		let A = this._register(HoverAction.render(this.actionsElement, e, k));
		return this.actions.push(A), A;
	}
	append(e) {
		let O = append(this.actionsElement, e);
		return this._hasContent = !0, O;
	}
};
EditorHoverStatusBar = __decorate$84([__param$84(0, IKeybindingService)], EditorHoverStatusBar);
var HoverProviderResult = class {
	constructor(e, O, k) {
		this.provider = e, this.hover = O, this.ordinal = k;
	}
};
async function executeProvider(e, O, k, A, j) {
	let M = await Promise.resolve(e.provideHover(k, A, j)).catch(onUnexpectedExternalError);
	if (!(!M || !isValid(M))) return new HoverProviderResult(e, M, O);
}
function getHoverProviderResultsAsAsyncIterable(e, O, k, A, j = !1) {
	let M = e.ordered(O, j).map((e, j) => executeProvider(e, j, O, k, A));
	return AsyncIterableObject.fromPromises(M).coalesce();
}
function getHoversPromise(e, O, k, A, j = !1) {
	return getHoverProviderResultsAsAsyncIterable(e, O, k, A, j).map((e) => e.hover).toPromise();
}
registerModelAndPositionCommand("_executeHoverProvider", (e, O, k) => {
	let A = e.get(ILanguageFeaturesService);
	return getHoversPromise(A.hoverProvider, O, k, CancellationToken.None);
}), registerModelAndPositionCommand("_executeHoverProvider_recursive", (e, O, k) => {
	let A = e.get(ILanguageFeaturesService);
	return getHoversPromise(A.hoverProvider, O, k, CancellationToken.None, !0);
});
function isValid(e) {
	let O = e.range !== void 0, k = e.contents !== void 0 && e.contents && e.contents.length > 0;
	return O && k;
}
var __decorate$83 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$83 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, $$4 = $, increaseHoverVerbosityIcon = registerIcon("hover-increase-verbosity", Codicon.add, localize("increaseHoverVerbosity", "Icon for increaseing hover verbosity.")), decreaseHoverVerbosityIcon = registerIcon("hover-decrease-verbosity", Codicon.remove, localize("decreaseHoverVerbosity", "Icon for decreasing hover verbosity.")), MarkdownHover = class {
	constructor(e, O, k, A, j, M = void 0) {
		this.owner = e, this.range = O, this.contents = k, this.isBeforeContent = A, this.ordinal = j, this.source = M;
	}
	isValidForHoverAnchor(e) {
		return e.type === 1 && this.range.startColumn <= e.range.startColumn && this.range.endColumn >= e.range.endColumn;
	}
}, HoverSource = class {
	constructor(e, O, k) {
		this.hover = e, this.hoverProvider = O, this.hoverPosition = k;
	}
	supportsVerbosityAction(e) {
		switch (e) {
			case HoverVerbosityAction.Increase: return this.hover.canIncreaseVerbosity ?? !1;
			case HoverVerbosityAction.Decrease: return this.hover.canDecreaseVerbosity ?? !1;
		}
	}
}, MarkdownHoverParticipant = class {
	constructor(e, O, k, A, j, M, N, P) {
		this._editor = e, this._languageService = O, this._openerService = k, this._configurationService = A, this._languageFeaturesService = j, this._keybindingService = M, this._hoverService = N, this._commandService = P, this.hoverOrdinal = 3;
	}
	createLoadingMessage(e) {
		return new MarkdownHover(this, e.range, [new MarkdownString().appendText(localize("modesContentHover.loading", "Loading..."))], !1, 2e3);
	}
	computeSync(e, O) {
		if (!this._editor.hasModel() || e.type !== 1) return [];
		let k = this._editor.getModel(), A = e.range.startLineNumber, j = k.getLineMaxColumn(A), M = [], N = 1e3, P = k.getLineLength(A), F = k.getLanguageIdAtPosition(e.range.startLineNumber, e.range.startColumn), I = this._editor.getOption(118), L = this._configurationService.getValue("editor.maxTokenizationLineLength", { overrideIdentifier: F }), R = !1;
		I >= 0 && P > I && e.range.startColumn >= I && (R = !0, M.push(new MarkdownHover(this, e.range, [{ value: localize("stopped rendering", "Rendering paused for long line for performance reasons. This can be configured via `editor.stopRenderingLineAfter`.") }], !1, N++))), !R && typeof L == "number" && P >= L && M.push(new MarkdownHover(this, e.range, [{ value: localize("too many characters", "Tokenization is skipped for long lines for performance reasons. This can be configured via `editor.maxTokenizationLineLength`.") }], !1, N++));
		let z = !1;
		for (let k of O) {
			let O = k.range.startLineNumber === A ? k.range.startColumn : 1, P = k.range.endLineNumber === A ? k.range.endColumn : j, F = k.options.hoverMessage;
			if (!F || isEmptyMarkdownString(F)) continue;
			k.options.beforeContentClassName && (z = !0);
			let I = new Range(e.range.startLineNumber, O, e.range.startLineNumber, P);
			M.push(new MarkdownHover(this, I, asArray(F), z, N++));
		}
		return M;
	}
	computeAsync(e, O, k) {
		if (!this._editor.hasModel() || e.type !== 1) return AsyncIterableObject.EMPTY;
		let A = this._editor.getModel(), j = this._languageFeaturesService.hoverProvider;
		return j.has(A) ? this._getMarkdownHovers(j, A, e, k) : AsyncIterableObject.EMPTY;
	}
	_getMarkdownHovers(e, O, k, A) {
		let j = k.range.getStartPosition();
		return getHoverProviderResultsAsAsyncIterable(e, O, j, A).filter((e) => !isEmptyMarkdownString(e.hover.contents)).map((e) => {
			let O = e.hover.range ? Range.lift(e.hover.range) : k.range, A = new HoverSource(e.hover, e.provider, j);
			return new MarkdownHover(this, O, e.hover.contents, !1, e.ordinal, A);
		});
	}
	renderHoverParts(e, O) {
		return this._renderedHoverParts = new MarkdownRenderedHoverParts(O, e.fragment, this, this._editor, this._languageService, this._openerService, this._commandService, this._keybindingService, this._hoverService, this._configurationService, e.onContentsChanged), this._renderedHoverParts;
	}
	updateMarkdownHoverVerbosityLevel(e, O, k) {
		return Promise.resolve(this._renderedHoverParts?.updateMarkdownHoverPartVerbosityLevel(e, O, k));
	}
};
MarkdownHoverParticipant = __decorate$83([
	__param$83(1, ILanguageService),
	__param$83(2, IOpenerService),
	__param$83(3, IConfigurationService),
	__param$83(4, ILanguageFeaturesService),
	__param$83(5, IKeybindingService),
	__param$83(6, IHoverService),
	__param$83(7, ICommandService)
], MarkdownHoverParticipant);
var RenderedMarkdownHoverPart = class {
	constructor(e, O, k) {
		this.hoverPart = e, this.hoverElement = O, this.disposables = k;
	}
	dispose() {
		this.disposables.dispose();
	}
}, MarkdownRenderedHoverParts = class {
	constructor(e, O, k, A, j, M, N, P, F, I, L) {
		this._hoverParticipant = k, this._editor = A, this._languageService = j, this._openerService = M, this._commandService = N, this._keybindingService = P, this._hoverService = F, this._configurationService = I, this._onFinishedRendering = L, this._ongoingHoverOperations = /* @__PURE__ */ new Map(), this._disposables = new DisposableStore(), this.renderedHoverParts = this._renderHoverParts(e, O, this._onFinishedRendering), this._disposables.add(toDisposable(() => {
			this.renderedHoverParts.forEach((e) => {
				e.dispose();
			}), this._ongoingHoverOperations.forEach((e) => {
				e.tokenSource.dispose(!0);
			});
		}));
	}
	_renderHoverParts(e, O, k) {
		return e.sort(compareBy((e) => e.ordinal, numberComparator)), e.map((e) => {
			let A = this._renderHoverPart(e, k);
			return O.appendChild(A.hoverElement), A;
		});
	}
	_renderHoverPart(e, O) {
		let k = this._renderMarkdownHover(e, O), A = k.hoverElement, j = e.source, M = new DisposableStore();
		if (M.add(k), !j) return new RenderedMarkdownHoverPart(e, A, M);
		let N = j.supportsVerbosityAction(HoverVerbosityAction.Increase), P = j.supportsVerbosityAction(HoverVerbosityAction.Decrease);
		if (!N && !P) return new RenderedMarkdownHoverPart(e, A, M);
		let F = $$4("div.verbosity-actions");
		return A.prepend(F), M.add(this._renderHoverExpansionAction(F, HoverVerbosityAction.Increase, N)), M.add(this._renderHoverExpansionAction(F, HoverVerbosityAction.Decrease, P)), new RenderedMarkdownHoverPart(e, A, M);
	}
	_renderMarkdownHover(e, O) {
		return renderMarkdownInContainer(this._editor, e, this._languageService, this._openerService, O);
	}
	_renderHoverExpansionAction(e, O, k) {
		let A = new DisposableStore(), j = O === HoverVerbosityAction.Increase, M = append(e, $$4(ThemeIcon.asCSSSelector(j ? increaseHoverVerbosityIcon : decreaseHoverVerbosityIcon)));
		M.tabIndex = 0;
		let N = new WorkbenchHoverDelegate("mouse", !1, {
			target: e,
			position: { hoverPosition: 0 }
		}, this._configurationService, this._hoverService);
		if (A.add(this._hoverService.setupManagedHover(N, M, labelForHoverVerbosityAction(this._keybindingService, O))), !k) return M.classList.add("disabled"), A;
		M.classList.add("enabled");
		let P = () => this._commandService.executeCommand(O === HoverVerbosityAction.Increase ? INCREASE_HOVER_VERBOSITY_ACTION_ID : DECREASE_HOVER_VERBOSITY_ACTION_ID);
		return A.add(new ClickAction(M, P)), A.add(new KeyDownAction(M, P, [3, 10])), A;
	}
	async updateMarkdownHoverPartVerbosityLevel(e, O, k = !0) {
		let A = this._editor.getModel();
		if (!A) return;
		let j = this._getRenderedHoverPartAtIndex(O), M = j?.hoverPart.source;
		if (!j || !M?.supportsVerbosityAction(e)) return;
		let N = await this._fetchHover(M, A, e);
		if (!N) return;
		let P = new HoverSource(N, M.hoverProvider, M.hoverPosition), F = j.hoverPart, I = new MarkdownHover(this._hoverParticipant, F.range, N.contents, F.isBeforeContent, F.ordinal, P), L = this._renderHoverPart(I, this._onFinishedRendering);
		return this._replaceRenderedHoverPartAtIndex(O, L, I), k && this._focusOnHoverPartWithIndex(O), {
			hoverPart: I,
			hoverElement: L.hoverElement
		};
	}
	async _fetchHover(e, O, k) {
		let A = k === HoverVerbosityAction.Increase ? 1 : -1, j = e.hoverProvider, M = this._ongoingHoverOperations.get(j);
		M && (M.tokenSource.cancel(), A += M.verbosityDelta);
		let N = new CancellationTokenSource();
		this._ongoingHoverOperations.set(j, {
			verbosityDelta: A,
			tokenSource: N
		});
		let P = { verbosityRequest: {
			verbosityDelta: A,
			previousHover: e.hover
		} }, F;
		try {
			F = await Promise.resolve(j.provideHover(O, e.hoverPosition, N.token, P));
		} catch (e) {
			onUnexpectedExternalError(e);
		}
		return N.dispose(), this._ongoingHoverOperations.delete(j), F;
	}
	_replaceRenderedHoverPartAtIndex(e, O, k) {
		if (e >= this.renderedHoverParts.length || e < 0) return;
		let A = this.renderedHoverParts[e], j = A.hoverElement, M = O.hoverElement, N = Array.from(M.children);
		j.replaceChildren(...N);
		let P = new RenderedMarkdownHoverPart(k, j, O.disposables);
		j.focus(), A.dispose(), this.renderedHoverParts[e] = P;
	}
	_focusOnHoverPartWithIndex(e) {
		this.renderedHoverParts[e].hoverElement.focus();
	}
	_getRenderedHoverPartAtIndex(e) {
		return this.renderedHoverParts[e];
	}
	dispose() {
		this._disposables.dispose();
	}
};
function renderMarkdownHovers(e, O, k, A, j) {
	O.sort(compareBy((e) => e.ordinal, numberComparator));
	let M = [];
	for (let N of O) M.push(renderMarkdownInContainer(k, N, A, j, e.onContentsChanged));
	return new RenderedHoverParts(M);
}
function renderMarkdownInContainer(e, O, k, A, j) {
	let M = new DisposableStore(), N = $$4("div.hover-row"), P = $$4("div.hover-row-contents");
	N.appendChild(P);
	let F = O.contents;
	for (let O of F) {
		if (isEmptyMarkdownString(O)) continue;
		let N = $$4("div.markdown-hover"), F = append(N, $$4("div.hover-contents")), I = M.add(new MarkdownRenderer({ editor: e }, k, A));
		M.add(I.onDidRenderAsync(() => {
			F.className = "hover-contents code-hover-contents", j();
		}));
		let L = M.add(I.render(O));
		F.appendChild(L.element), P.appendChild(N);
	}
	return {
		hoverPart: O,
		hoverElement: N,
		dispose() {
			M.dispose();
		}
	};
}
function labelForHoverVerbosityAction(e, O) {
	switch (O) {
		case HoverVerbosityAction.Increase: {
			let O = e.lookupKeybinding(INCREASE_HOVER_VERBOSITY_ACTION_ID);
			return O ? localize("increaseVerbosityWithKb", "Increase Hover Verbosity ({0})", O.getLabel()) : localize("increaseVerbosity", "Increase Hover Verbosity");
		}
		case HoverVerbosityAction.Decrease: {
			let O = e.lookupKeybinding(DECREASE_HOVER_VERBOSITY_ACTION_ID);
			return O ? localize("decreaseVerbosityWithKb", "Decrease Hover Verbosity ({0})", O.getLabel()) : localize("decreaseVerbosity", "Decrease Hover Verbosity");
		}
	}
}
function hasModifier(e, O) {
	return !!e[O];
}
var ClickLinkMouseEvent = class {
	constructor(e, O) {
		this.target = e.target, this.isLeftClick = e.event.leftButton, this.isMiddleClick = e.event.middleButton, this.isRightClick = e.event.rightButton, this.hasTriggerModifier = hasModifier(e.event, O.triggerModifier), this.hasSideBySideModifier = hasModifier(e.event, O.triggerSideBySideModifier), this.isNoneOrSingleMouseDown = e.event.detail <= 1;
	}
}, ClickLinkKeyboardEvent = class {
	constructor(e, O) {
		this.keyCodeIsTriggerKey = e.keyCode === O.triggerKey, this.keyCodeIsSideBySideKey = e.keyCode === O.triggerSideBySideKey, this.hasTriggerModifier = hasModifier(e, O.triggerModifier);
	}
}, ClickLinkOptions = class {
	constructor(e, O, k, A) {
		this.triggerKey = e, this.triggerModifier = O, this.triggerSideBySideKey = k, this.triggerSideBySideModifier = A;
	}
	equals(e) {
		return this.triggerKey === e.triggerKey && this.triggerModifier === e.triggerModifier && this.triggerSideBySideKey === e.triggerSideBySideKey && this.triggerSideBySideModifier === e.triggerSideBySideModifier;
	}
};
function createOptions(e) {
	return e === "altKey" ? isMacintosh ? new ClickLinkOptions(57, "metaKey", 6, "altKey") : new ClickLinkOptions(5, "ctrlKey", 6, "altKey") : isMacintosh ? new ClickLinkOptions(6, "altKey", 57, "metaKey") : new ClickLinkOptions(6, "altKey", 5, "ctrlKey");
}
var ClickLinkGesture = class extends Disposable {
	constructor(e, O) {
		super(), this._onMouseMoveOrRelevantKeyDown = this._register(new Emitter()), this.onMouseMoveOrRelevantKeyDown = this._onMouseMoveOrRelevantKeyDown.event, this._onExecute = this._register(new Emitter()), this.onExecute = this._onExecute.event, this._onCancel = this._register(new Emitter()), this.onCancel = this._onCancel.event, this._editor = e, this._extractLineNumberFromMouseEvent = O?.extractLineNumberFromMouseEvent ?? ((e) => e.target.position ? e.target.position.lineNumber : 0), this._opts = createOptions(this._editor.getOption(78)), this._lastMouseMoveEvent = null, this._hasTriggerKeyOnMouseDown = !1, this._lineNumberOnMouseDown = 0, this._register(this._editor.onDidChangeConfiguration((e) => {
			if (e.hasChanged(78)) {
				let e = createOptions(this._editor.getOption(78));
				if (this._opts.equals(e)) return;
				this._opts = e, this._lastMouseMoveEvent = null, this._hasTriggerKeyOnMouseDown = !1, this._lineNumberOnMouseDown = 0, this._onCancel.fire();
			}
		})), this._register(this._editor.onMouseMove((e) => this._onEditorMouseMove(new ClickLinkMouseEvent(e, this._opts)))), this._register(this._editor.onMouseDown((e) => this._onEditorMouseDown(new ClickLinkMouseEvent(e, this._opts)))), this._register(this._editor.onMouseUp((e) => this._onEditorMouseUp(new ClickLinkMouseEvent(e, this._opts)))), this._register(this._editor.onKeyDown((e) => this._onEditorKeyDown(new ClickLinkKeyboardEvent(e, this._opts)))), this._register(this._editor.onKeyUp((e) => this._onEditorKeyUp(new ClickLinkKeyboardEvent(e, this._opts)))), this._register(this._editor.onMouseDrag(() => this._resetHandler())), this._register(this._editor.onDidChangeCursorSelection((e) => this._onDidChangeCursorSelection(e))), this._register(this._editor.onDidChangeModel((e) => this._resetHandler())), this._register(this._editor.onDidChangeModelContent(() => this._resetHandler())), this._register(this._editor.onDidScrollChange((e) => {
			(e.scrollTopChanged || e.scrollLeftChanged) && this._resetHandler();
		}));
	}
	_onDidChangeCursorSelection(e) {
		e.selection && e.selection.startColumn !== e.selection.endColumn && this._resetHandler();
	}
	_onEditorMouseMove(e) {
		this._lastMouseMoveEvent = e, this._onMouseMoveOrRelevantKeyDown.fire([e, null]);
	}
	_onEditorMouseDown(e) {
		this._hasTriggerKeyOnMouseDown = e.hasTriggerModifier, this._lineNumberOnMouseDown = this._extractLineNumberFromMouseEvent(e);
	}
	_onEditorMouseUp(e) {
		let O = this._extractLineNumberFromMouseEvent(e);
		this._hasTriggerKeyOnMouseDown && this._lineNumberOnMouseDown && this._lineNumberOnMouseDown === O && this._onExecute.fire(e);
	}
	_onEditorKeyDown(e) {
		this._lastMouseMoveEvent && (e.keyCodeIsTriggerKey || e.keyCodeIsSideBySideKey && e.hasTriggerModifier) ? this._onMouseMoveOrRelevantKeyDown.fire([this._lastMouseMoveEvent, e]) : e.hasTriggerModifier && this._onCancel.fire();
	}
	_onEditorKeyUp(e) {
		e.keyCodeIsTriggerKey && this._onCancel.fire();
	}
	_resetHandler() {
		this._lastMouseMoveEvent = null, this._hasTriggerKeyOnMouseDown = !1, this._onCancel.fire();
	}
}, InlayHintAnchor = class {
	constructor(e, O) {
		this.range = e, this.direction = O;
	}
}, InlayHintItem = class e {
	constructor(e, O, k) {
		this.hint = e, this.anchor = O, this.provider = k, this._isResolved = !1;
	}
	with(O) {
		let k = new e(this.hint, O.anchor, this.provider);
		return k._isResolved = this._isResolved, k._currentResolve = this._currentResolve, k;
	}
	async resolve(e) {
		if (typeof this.provider.resolveInlayHint == "function") {
			if (this._currentResolve) return await this._currentResolve, e.isCancellationRequested ? void 0 : this.resolve(e);
			this._isResolved || (this._currentResolve = this._doResolve(e).finally(() => this._currentResolve = void 0)), await this._currentResolve;
		}
	}
	async _doResolve(e) {
		try {
			let O = await Promise.resolve(this.provider.resolveInlayHint(this.hint, e));
			this.hint.tooltip = O?.tooltip ?? this.hint.tooltip, this.hint.label = O?.label ?? this.hint.label, this.hint.textEdits = O?.textEdits ?? this.hint.textEdits, this._isResolved = !0;
		} catch (e) {
			onUnexpectedExternalError(e), this._isResolved = !1;
		}
	}
}, InlayHintsFragments = class e {
	static {
		this._emptyInlayHintList = Object.freeze({
			dispose() {},
			hints: []
		});
	}
	static async create(O, k, A, j) {
		let M = [], N = O.ordered(k).reverse().map((O) => A.map(async (A) => {
			try {
				let N = await O.provideInlayHints(k, A, j);
				(N?.hints.length || O.onDidChangeInlayHints) && M.push([N ?? e._emptyInlayHintList, O]);
			} catch (e) {
				onUnexpectedExternalError(e);
			}
		}));
		if (await Promise.all(N.flat()), j.isCancellationRequested || k.isDisposed()) throw new CancellationError();
		return new e(A, M, k);
	}
	constructor(O, k, A) {
		this._disposables = new DisposableStore(), this.ranges = O, this.provider = /* @__PURE__ */ new Set();
		let j = [];
		for (let [O, M] of k) {
			this._disposables.add(O), this.provider.add(M);
			for (let k of O.hints) {
				let O = A.validatePosition(k.position), N = "before", P = e._getRangeAtPosition(A, O), F;
				P.getStartPosition().isBefore(O) ? (F = Range.fromPositions(P.getStartPosition(), O), N = "after") : (F = Range.fromPositions(O, P.getEndPosition()), N = "before"), j.push(new InlayHintItem(k, new InlayHintAnchor(F, N), M));
			}
		}
		this.items = j.sort((e, O) => Position.compare(e.hint.position, O.hint.position));
	}
	dispose() {
		this._disposables.dispose();
	}
	static _getRangeAtPosition(e, O) {
		let k = O.lineNumber, A = e.getWordAtPosition(O);
		if (A) return new Range(k, A.startColumn, k, A.endColumn);
		e.tokenization.tokenizeIfCheap(k);
		let j = e.tokenization.getLineTokens(k), M = O.column - 1, N = j.findTokenIndexAtOffset(M), P = j.getStartOffset(N), F = j.getEndOffset(N);
		return F - P === 1 && (P === M && N > 1 ? (P = j.getStartOffset(N - 1), F = j.getEndOffset(N - 1)) : F === M && N < j.getCount() - 1 && (P = j.getStartOffset(N + 1), F = j.getEndOffset(N + 1))), new Range(k, P + 1, k, F + 1);
	}
};
function asCommandLink(e) {
	return URI.from({
		scheme: Schemas.command,
		path: e.id,
		query: e.arguments && encodeURIComponent(JSON.stringify(e.arguments))
	}).toString();
}
var __decorate$82 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$82 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, EmbeddedCodeEditorWidget = class extends CodeEditorWidget {
	constructor(e, O, k, A, j, M, N, P, F, I, L, R, z) {
		super(e, {
			...A.getRawOptions(),
			overflowWidgetsDomNode: A.getOverflowWidgetsDomNode()
		}, k, j, M, N, P, F, I, L, R, z), this._parentEditor = A, this._overwriteOptions = O, super.updateOptions(this._overwriteOptions), this._register(A.onDidChangeConfiguration((e) => this._onParentConfigurationChanged(e)));
	}
	getParentEditor() {
		return this._parentEditor;
	}
	_onParentConfigurationChanged(e) {
		super.updateOptions(this._parentEditor.getRawOptions()), super.updateOptions(this._overwriteOptions);
	}
	updateOptions(e) {
		mixin(this._overwriteOptions, e, !0), super.updateOptions(this._overwriteOptions);
	}
};
EmbeddedCodeEditorWidget = __decorate$82([
	__param$82(4, IInstantiationService),
	__param$82(5, ICodeEditorService),
	__param$82(6, ICommandService),
	__param$82(7, IContextKeyService),
	__param$82(8, IThemeService),
	__param$82(9, INotificationService),
	__param$82(10, IAccessibilityService),
	__param$82(11, ILanguageConfigurationService),
	__param$82(12, ILanguageFeaturesService)
], EmbeddedCodeEditorWidget);
var defaultColor = new Color(new RGBA(0, 122, 204)), defaultOptions$1 = {
	showArrow: !0,
	showFrame: !0,
	className: "",
	frameColor: defaultColor,
	arrowColor: defaultColor,
	keepEditorSelection: !1
}, WIDGET_ID = "vs.editor.contrib.zoneWidget", ViewZoneDelegate = class {
	constructor(e, O, k, A, j, M, N, P) {
		this.id = "", this.domNode = e, this.afterLineNumber = O, this.afterColumn = k, this.heightInLines = A, this.showInHiddenAreas = N, this.ordinal = P, this._onDomNodeTop = j, this._onComputedHeight = M;
	}
	onDomNodeTop(e) {
		this._onDomNodeTop(e);
	}
	onComputedHeight(e) {
		this._onComputedHeight(e);
	}
}, OverlayWidgetDelegate = class {
	constructor(e, O) {
		this._id = e, this._domNode = O;
	}
	getId() {
		return this._id;
	}
	getDomNode() {
		return this._domNode;
	}
	getPosition() {
		return null;
	}
}, Arrow = class e {
	static {
		this._IdGenerator = new IdGenerator(".arrow-decoration-");
	}
	constructor(O) {
		this._editor = O, this._ruleName = e._IdGenerator.nextId(), this._decorations = this._editor.createDecorationsCollection(), this._color = null, this._height = -1;
	}
	dispose() {
		this.hide(), removeCSSRulesContainingSelector(this._ruleName);
	}
	set color(e) {
		this._color !== e && (this._color = e, this._updateStyle());
	}
	set height(e) {
		this._height !== e && (this._height = e, this._updateStyle());
	}
	_updateStyle() {
		removeCSSRulesContainingSelector(this._ruleName), createCSSRule(`.monaco-editor ${this._ruleName}`, `border-style: solid; border-color: transparent; border-bottom-color: ${this._color}; border-width: ${this._height}px; bottom: -${this._height}px !important; margin-left: -${this._height}px; `);
	}
	show(e) {
		e.column === 1 && (e = {
			lineNumber: e.lineNumber,
			column: 2
		}), this._decorations.set([{
			range: Range.fromPositions(e),
			options: {
				description: "zone-widget-arrow",
				className: this._ruleName,
				stickiness: 1
			}
		}]);
	}
	hide() {
		this._decorations.clear();
	}
}, ZoneWidget = class {
	constructor(e, O = {}) {
		this._arrow = null, this._overlayWidget = null, this._resizeSash = null, this._viewZone = null, this._disposables = new DisposableStore(), this.container = null, this._isShowing = !1, this.editor = e, this._positionMarkerId = this.editor.createDecorationsCollection(), this.options = deepClone(O), mixin(this.options, defaultOptions$1, !1), this.domNode = document.createElement("div"), this.options.isAccessible || (this.domNode.setAttribute("aria-hidden", "true"), this.domNode.setAttribute("role", "presentation")), this._disposables.add(this.editor.onDidLayoutChange((e) => {
			let O = this._getWidth(e);
			this.domNode.style.width = O + "px", this.domNode.style.left = this._getLeft(e) + "px", this._onWidth(O);
		}));
	}
	dispose() {
		this._overlayWidget &&= (this.editor.removeOverlayWidget(this._overlayWidget), null), this._viewZone && this.editor.changeViewZones((e) => {
			this._viewZone && e.removeZone(this._viewZone.id), this._viewZone = null;
		}), this._positionMarkerId.clear(), this._disposables.dispose();
	}
	create() {
		this.domNode.classList.add("zone-widget"), this.options.className && this.domNode.classList.add(this.options.className), this.container = document.createElement("div"), this.container.classList.add("zone-widget-container"), this.domNode.appendChild(this.container), this.options.showArrow && (this._arrow = new Arrow(this.editor), this._disposables.add(this._arrow)), this._fillContainer(this.container), this._initSash(), this._applyStyles();
	}
	style(e) {
		e.frameColor && (this.options.frameColor = e.frameColor), e.arrowColor && (this.options.arrowColor = e.arrowColor), this._applyStyles();
	}
	_applyStyles() {
		if (this.container && this.options.frameColor) {
			let e = this.options.frameColor.toString();
			this.container.style.borderTopColor = e, this.container.style.borderBottomColor = e;
		}
		if (this._arrow && this.options.arrowColor) {
			let e = this.options.arrowColor.toString();
			this._arrow.color = e;
		}
	}
	_getWidth(e) {
		return e.width - e.minimap.minimapWidth - e.verticalScrollbarWidth;
	}
	_getLeft(e) {
		return e.minimap.minimapWidth > 0 && e.minimap.minimapLeft === 0 ? e.minimap.minimapWidth : 0;
	}
	_onViewZoneTop(e) {
		this.domNode.style.top = e + "px";
	}
	_onViewZoneHeight(e) {
		if (this.domNode.style.height = `${e}px`, this.container) {
			let O = e - this._decoratingElementsHeight();
			this.container.style.height = `${O}px`;
			let k = this.editor.getLayoutInfo();
			this._doLayout(O, this._getWidth(k));
		}
		this._resizeSash?.layout();
	}
	get position() {
		let e = this._positionMarkerId.getRange(0);
		if (e) return e.getStartPosition();
	}
	show(e, O) {
		let k = Range.isIRange(e) ? Range.lift(e) : Range.fromPositions(e);
		this._isShowing = !0, this._showImpl(k, O), this._isShowing = !1, this._positionMarkerId.set([{
			range: k,
			options: ModelDecorationOptions.EMPTY
		}]);
	}
	hide() {
		this._viewZone &&= (this.editor.changeViewZones((e) => {
			this._viewZone && e.removeZone(this._viewZone.id);
		}), null), this._overlayWidget &&= (this.editor.removeOverlayWidget(this._overlayWidget), null), this._arrow?.hide(), this._positionMarkerId.clear();
	}
	_decoratingElementsHeight() {
		let e = this.editor.getOption(67), O = 0;
		if (this.options.showArrow) {
			let k = Math.round(e / 3);
			O += 2 * k;
		}
		if (this.options.showFrame) {
			let k = Math.round(e / 9);
			O += 2 * k;
		}
		return O;
	}
	_showImpl(e, O) {
		let k = e.getStartPosition(), A = this.editor.getLayoutInfo(), j = this._getWidth(A);
		this.domNode.style.width = `${j}px`, this.domNode.style.left = this._getLeft(A) + "px";
		let M = document.createElement("div");
		M.style.overflow = "hidden";
		let N = this.editor.getOption(67);
		if (!this.options.allowUnlimitedHeight) {
			let e = Math.max(12, this.editor.getLayoutInfo().height / N * .8);
			O = Math.min(O, e);
		}
		let P = 0, F = 0;
		if (this._arrow && this.options.showArrow && (P = Math.round(N / 3), this._arrow.height = P, this._arrow.show(k)), this.options.showFrame && (F = Math.round(N / 9)), this.editor.changeViewZones((e) => {
			this._viewZone && e.removeZone(this._viewZone.id), this._overlayWidget &&= (this.editor.removeOverlayWidget(this._overlayWidget), null), this.domNode.style.top = "-1000px", this._viewZone = new ViewZoneDelegate(M, k.lineNumber, k.column, O, (e) => this._onViewZoneTop(e), (e) => this._onViewZoneHeight(e), this.options.showInHiddenAreas, this.options.ordinal), this._viewZone.id = e.addZone(this._viewZone), this._overlayWidget = new OverlayWidgetDelegate(WIDGET_ID + this._viewZone.id, this.domNode), this.editor.addOverlayWidget(this._overlayWidget);
		}), this.container && this.options.showFrame) {
			let e = this.options.frameWidth ? this.options.frameWidth : F;
			this.container.style.borderTopWidth = e + "px", this.container.style.borderBottomWidth = e + "px";
		}
		let I = O * N - this._decoratingElementsHeight();
		this.container && (this.container.style.top = P + "px", this.container.style.height = I + "px", this.container.style.overflow = "hidden"), this._doLayout(I, j), this.options.keepEditorSelection || this.editor.setSelection(e);
		let L = this.editor.getModel();
		if (L) {
			let O = L.validateRange(new Range(e.startLineNumber, 1, e.endLineNumber + 1, 1));
			this.revealRange(O, O.startLineNumber === L.getLineCount());
		}
	}
	revealRange(e, O) {
		O ? this.editor.revealLineNearTop(e.endLineNumber, 0) : this.editor.revealRange(e, 0);
	}
	setCssClass(e, O) {
		this.container && (O && this.container.classList.remove(O), this.container.classList.add(e));
	}
	_onWidth(e) {}
	_doLayout(e, O) {}
	_relayout(e) {
		this._viewZone && this._viewZone.heightInLines !== e && this.editor.changeViewZones((O) => {
			this._viewZone && (this._viewZone.heightInLines = e, O.layoutZone(this._viewZone.id));
		});
	}
	_initSash() {
		if (this._resizeSash) return;
		this._resizeSash = this._disposables.add(new Sash(this.domNode, this, { orientation: 1 })), this.options.isResizeable || (this._resizeSash.state = 0);
		let e;
		this._disposables.add(this._resizeSash.onDidStart((O) => {
			this._viewZone && (e = {
				startY: O.startY,
				heightInLines: this._viewZone.heightInLines
			});
		})), this._disposables.add(this._resizeSash.onDidEnd(() => {
			e = void 0;
		})), this._disposables.add(this._resizeSash.onDidChange((O) => {
			if (e) {
				let k = (O.currentY - e.startY) / this.editor.getOption(67), A = k < 0 ? Math.ceil(k) : Math.floor(k), j = e.heightInLines + A;
				j > 5 && j < 35 && this._relayout(j);
			}
		}));
	}
	getHorizontalSashLeft() {
		return 0;
	}
	getHorizontalSashTop() {
		return (this.domNode.style.height === null ? 0 : parseInt(this.domNode.style.height)) - this._decoratingElementsHeight() / 2;
	}
	getHorizontalSashWidth() {
		let e = this.editor.getLayoutInfo();
		return e.width - e.minimap.minimapWidth;
	}
}, __decorate$81 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$81 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
};
const IPeekViewService = createDecorator("IPeekViewService");
registerSingleton(IPeekViewService, class {
	constructor() {
		this._widgets = /* @__PURE__ */ new Map();
	}
	addExclusiveWidget(e, O) {
		let k = this._widgets.get(e);
		k && (k.listener.dispose(), k.widget.dispose()), this._widgets.set(e, {
			widget: O,
			listener: O.onDidClose(() => {
				let k = this._widgets.get(e);
				k && k.widget === O && (k.listener.dispose(), this._widgets.delete(e));
			})
		});
	}
}, 1);
var PeekContext;
(function(e) {
	e.inPeekEditor = new RawContextKey("inReferenceSearchEditor", !0, localize("inReferenceSearchEditor", "Whether the current code editor is embedded inside peek")), e.notInPeekEditor = e.inPeekEditor.toNegated();
})(PeekContext ||= {});
var PeekContextController = class {
	static {
		this.ID = "editor.contrib.referenceController";
	}
	constructor(e, O) {
		e instanceof EmbeddedCodeEditorWidget && PeekContext.inPeekEditor.bindTo(O);
	}
	dispose() {}
};
PeekContextController = __decorate$81([__param$81(1, IContextKeyService)], PeekContextController), registerEditorContribution(PeekContextController.ID, PeekContextController, 0);
function getOuterEditor(e) {
	let O = e.get(ICodeEditorService).getFocusedCodeEditor();
	return O instanceof EmbeddedCodeEditorWidget ? O.getParentEditor() : O;
}
var defaultOptions = {
	headerBackgroundColor: Color.white,
	primaryHeadingColor: Color.fromHex("#333333"),
	secondaryHeadingColor: Color.fromHex("#6c6c6cb3")
}, PeekViewWidget = class extends ZoneWidget {
	constructor(e, O, k) {
		super(e, O), this.instantiationService = k, this._onDidClose = new Emitter(), this.onDidClose = this._onDidClose.event, mixin(this.options, defaultOptions, !1);
	}
	dispose() {
		this.disposed || (this.disposed = !0, super.dispose(), this._onDidClose.fire(this));
	}
	style(e) {
		let O = this.options;
		e.headerBackgroundColor && (O.headerBackgroundColor = e.headerBackgroundColor), e.primaryHeadingColor && (O.primaryHeadingColor = e.primaryHeadingColor), e.secondaryHeadingColor && (O.secondaryHeadingColor = e.secondaryHeadingColor), super.style(e);
	}
	_applyStyles() {
		super._applyStyles();
		let e = this.options;
		this._headElement && e.headerBackgroundColor && (this._headElement.style.backgroundColor = e.headerBackgroundColor.toString()), this._primaryHeading && e.primaryHeadingColor && (this._primaryHeading.style.color = e.primaryHeadingColor.toString()), this._secondaryHeading && e.secondaryHeadingColor && (this._secondaryHeading.style.color = e.secondaryHeadingColor.toString()), this._bodyElement && e.frameColor && (this._bodyElement.style.borderColor = e.frameColor.toString());
	}
	_fillContainer(e) {
		this.setCssClass("peekview-widget"), this._headElement = $(".head"), this._bodyElement = $(".body"), this._fillHead(this._headElement), this._fillBody(this._bodyElement), e.appendChild(this._headElement), e.appendChild(this._bodyElement);
	}
	_fillHead(e, O) {
		this._titleElement = $(".peekview-title"), this.options.supportOnTitleClick && (this._titleElement.classList.add("clickable"), addStandardDisposableListener(this._titleElement, "click", (e) => this._onTitleClick(e))), append(this._headElement, this._titleElement), this._fillTitleIcon(this._titleElement), this._primaryHeading = $("span.filename"), this._secondaryHeading = $("span.dirname"), this._metaHeading = $("span.meta"), append(this._titleElement, this._primaryHeading, this._secondaryHeading, this._metaHeading);
		let k = $(".peekview-actions");
		append(this._headElement, k);
		let A = this._getActionBarOptions();
		this._actionbarWidget = new ActionBar(k, A), this._disposables.add(this._actionbarWidget), O || this._actionbarWidget.push(new Action("peekview.close", localize("label.close", "Close"), ThemeIcon.asClassName(Codicon.close), !0, () => (this.dispose(), Promise.resolve())), {
			label: !1,
			icon: !0
		});
	}
	_fillTitleIcon(e) {}
	_getActionBarOptions() {
		return {
			actionViewItemProvider: createActionViewItem.bind(void 0, this.instantiationService),
			orientation: 0
		};
	}
	_onTitleClick(e) {}
	setTitle(e, O) {
		this._primaryHeading && this._secondaryHeading && (this._primaryHeading.innerText = e, this._primaryHeading.setAttribute("title", e), O ? this._secondaryHeading.innerText = O : clearNode(this._secondaryHeading));
	}
	setMetaTitle(e) {
		this._metaHeading && (e ? (this._metaHeading.innerText = e, show(this._metaHeading)) : hide(this._metaHeading));
	}
	_doLayout(e, O) {
		if (!this._isShowing && e < 0) {
			this.dispose();
			return;
		}
		let k = Math.ceil(this.editor.getOption(67) * 1.2), A = Math.round(e - (k + 2));
		this._doLayoutHead(k, O), this._doLayoutBody(A, O);
	}
	_doLayoutHead(e, O) {
		this._headElement && (this._headElement.style.height = `${e}px`, this._headElement.style.lineHeight = this._headElement.style.height);
	}
	_doLayoutBody(e, O) {
		this._bodyElement && (this._bodyElement.style.height = `${e}px`);
	}
};
PeekViewWidget = __decorate$81([__param$81(2, IInstantiationService)], PeekViewWidget);
const peekViewTitleBackground = registerColor("peekViewTitle.background", {
	dark: "#252526",
	light: "#F3F3F3",
	hcDark: Color.black,
	hcLight: Color.white
}, localize("peekViewTitleBackground", "Background color of the peek view title area.")), peekViewTitleForeground = registerColor("peekViewTitleLabel.foreground", {
	dark: Color.white,
	light: Color.black,
	hcDark: Color.white,
	hcLight: editorForeground
}, localize("peekViewTitleForeground", "Color of the peek view title.")), peekViewTitleInfoForeground = registerColor("peekViewTitleDescription.foreground", {
	dark: "#ccccccb3",
	light: "#616161",
	hcDark: "#FFFFFF99",
	hcLight: "#292929"
}, localize("peekViewTitleInfoForeground", "Color of the peek view title info.")), peekViewBorder = registerColor("peekView.border", {
	dark: editorInfoForeground,
	light: editorInfoForeground,
	hcDark: contrastBorder,
	hcLight: contrastBorder
}, localize("peekViewBorder", "Color of the peek view borders and arrow.")), peekViewResultsBackground = registerColor("peekViewResult.background", {
	dark: "#252526",
	light: "#F3F3F3",
	hcDark: Color.black,
	hcLight: Color.white
}, localize("peekViewResultsBackground", "Background color of the peek view result list."));
registerColor("peekViewResult.lineForeground", {
	dark: "#bbbbbb",
	light: "#646465",
	hcDark: Color.white,
	hcLight: editorForeground
}, localize("peekViewResultsMatchForeground", "Foreground color for line nodes in the peek view result list.")), registerColor("peekViewResult.fileForeground", {
	dark: Color.white,
	light: "#1E1E1E",
	hcDark: Color.white,
	hcLight: editorForeground
}, localize("peekViewResultsFileForeground", "Foreground color for file nodes in the peek view result list.")), registerColor("peekViewResult.selectionBackground", {
	dark: "#3399ff33",
	light: "#3399ff33",
	hcDark: null,
	hcLight: null
}, localize("peekViewResultsSelectionBackground", "Background color of the selected entry in the peek view result list.")), registerColor("peekViewResult.selectionForeground", {
	dark: Color.white,
	light: "#6C6C6C",
	hcDark: Color.white,
	hcLight: editorForeground
}, localize("peekViewResultsSelectionForeground", "Foreground color of the selected entry in the peek view result list."));
const peekViewEditorBackground = registerColor("peekViewEditor.background", {
	dark: "#001F33",
	light: "#F2F8FC",
	hcDark: Color.black,
	hcLight: Color.white
}, localize("peekViewEditorBackground", "Background color of the peek view editor."));
registerColor("peekViewEditorGutter.background", peekViewEditorBackground, localize("peekViewEditorGutterBackground", "Background color of the gutter in the peek view editor.")), registerColor("peekViewEditorStickyScroll.background", peekViewEditorBackground, localize("peekViewEditorStickScrollBackground", "Background color of sticky scroll in the peek view editor.")), registerColor("peekViewResult.matchHighlightBackground", {
	dark: "#ea5c004d",
	light: "#ea5c004d",
	hcDark: null,
	hcLight: null
}, localize("peekViewResultsMatchHighlight", "Match highlight color in the peek view result list.")), registerColor("peekViewEditor.matchHighlightBackground", {
	dark: "#ff8f0099",
	light: "#f5d802de",
	hcDark: null,
	hcLight: null
}, localize("peekViewEditorMatchHighlight", "Match highlight color in the peek view editor.")), registerColor("peekViewEditor.matchHighlightBorder", {
	dark: null,
	light: null,
	hcDark: activeContrastBorder,
	hcLight: activeContrastBorder
}, localize("peekViewEditorMatchHighlightBorder", "Match highlight border in the peek view editor."));
var OneReference = class {
	constructor(e, O, k, A) {
		this.isProviderFirst = e, this.parent = O, this.link = k, this._rangeCallback = A, this.id = defaultGenerator.nextId();
	}
	get uri() {
		return this.link.uri;
	}
	get range() {
		return this._range ?? this.link.targetSelectionRange ?? this.link.range;
	}
	set range(e) {
		this._range = e, this._rangeCallback(this);
	}
	get ariaMessage() {
		let e = this.parent.getPreview(this)?.preview(this.range);
		return e ? localize({
			key: "aria.oneReference.preview",
			comment: ["Placeholders are: 0: filename, 1:line number, 2: column number, 3: preview snippet of source code"]
		}, "{0} in {1} on line {2} at column {3}", e.value, basename(this.uri), this.range.startLineNumber, this.range.startColumn) : localize("aria.oneReference", "in {0} on line {1} at column {2}", basename(this.uri), this.range.startLineNumber, this.range.startColumn);
	}
}, FilePreview = class {
	constructor(e) {
		this._modelReference = e;
	}
	dispose() {
		this._modelReference.dispose();
	}
	preview(e, O = 8) {
		let k = this._modelReference.object.textEditorModel;
		if (!k) return;
		let { startLineNumber: A, startColumn: j, endLineNumber: M, endColumn: N } = e, P = k.getWordUntilPosition({
			lineNumber: A,
			column: j - O
		}), F = new Range(A, P.startColumn, A, j), I = new Range(M, N, M, 1073741824), L = k.getValueInRange(F).replace(/^\s+/, ""), R = k.getValueInRange(e), z = k.getValueInRange(I).replace(/\s+$/, "");
		return {
			value: L + R + z,
			highlight: {
				start: L.length,
				end: L.length + R.length
			}
		};
	}
}, FileReferences = class {
	constructor(e, O) {
		this.parent = e, this.uri = O, this.children = [], this._previews = new ResourceMap();
	}
	dispose() {
		dispose(this._previews.values()), this._previews.clear();
	}
	getPreview(e) {
		return this._previews.get(e.uri);
	}
	get ariaMessage() {
		let e = this.children.length;
		return e === 1 ? localize("aria.fileReferences.1", "1 symbol in {0}, full path {1}", basename(this.uri), this.uri.fsPath) : localize("aria.fileReferences.N", "{0} symbols in {1}, full path {2}", e, basename(this.uri), this.uri.fsPath);
	}
	async resolve(e) {
		if (this._previews.size !== 0) return this;
		for (let O of this.children) if (!this._previews.has(O.uri)) try {
			let k = await e.createModelReference(O.uri);
			this._previews.set(O.uri, new FilePreview(k));
		} catch (e) {
			onUnexpectedError(e);
		}
		return this;
	}
}, ReferencesModel = class e {
	constructor(O, k) {
		this.groups = [], this.references = [], this._onDidChangeReferenceRange = new Emitter(), this.onDidChangeReferenceRange = this._onDidChangeReferenceRange.event, this._links = O, this._title = k;
		let [A] = O;
		O.sort(e._compareReferences);
		let j;
		for (let k of O) if ((!j || !extUri.isEqual(j.uri, k.uri, !0)) && (j = new FileReferences(this, k.uri), this.groups.push(j)), j.children.length === 0 || e._compareReferences(k, j.children[j.children.length - 1]) !== 0) {
			let e = new OneReference(A === k, j, k, (e) => this._onDidChangeReferenceRange.fire(e));
			this.references.push(e), j.children.push(e);
		}
	}
	dispose() {
		dispose(this.groups), this._onDidChangeReferenceRange.dispose(), this.groups.length = 0;
	}
	clone() {
		return new e(this._links, this._title);
	}
	get title() {
		return this._title;
	}
	get isEmpty() {
		return this.groups.length === 0;
	}
	get ariaMessage() {
		return this.isEmpty ? localize("aria.result.0", "No results found") : this.references.length === 1 ? localize("aria.result.1", "Found 1 symbol in {0}", this.references[0].uri.fsPath) : this.groups.length === 1 ? localize("aria.result.n1", "Found {0} symbols in {1}", this.references.length, this.groups[0].uri.fsPath) : localize("aria.result.nm", "Found {0} symbols in {1} files", this.references.length, this.groups.length);
	}
	nextOrPreviousReference(e, O) {
		let { parent: k } = e, A = k.children.indexOf(e), j = k.children.length, M = k.parent.groups.length;
		return M === 1 || O && A + 1 < j || !O && A > 0 ? (A = O ? (A + 1) % j : (A + j - 1) % j, k.children[A]) : (A = k.parent.groups.indexOf(k), O ? (A = (A + 1) % M, k.parent.groups[A].children[0]) : (A = (A + M - 1) % M, k.parent.groups[A].children[k.parent.groups[A].children.length - 1]));
	}
	nearestReference(e, O) {
		let k = this.references.map((k, A) => ({
			idx: A,
			prefixLen: commonPrefixLength(k.uri.toString(), e.toString()),
			offsetDist: Math.abs(k.range.startLineNumber - O.lineNumber) * 100 + Math.abs(k.range.startColumn - O.column)
		})).sort((e, O) => e.prefixLen > O.prefixLen ? -1 : e.prefixLen < O.prefixLen ? 1 : e.offsetDist < O.offsetDist ? -1 : e.offsetDist > O.offsetDist ? 1 : 0)[0];
		if (k) return this.references[k.idx];
	}
	referenceAt(e, O) {
		for (let k of this.references) if (k.uri.toString() === e.toString() && Range.containsPosition(k.range, O)) return k;
	}
	firstReference() {
		for (let e of this.references) if (e.isProviderFirst) return e;
		return this.references[0];
	}
	static _compareReferences(e, O) {
		return extUri.compare(e.uri, O.uri) || Range.compareRangesUsingStarts(e.range, O.range);
	}
}, __decorate$80 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$80 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, FileReferencesRenderer_1, DataSource = class {
	constructor(e) {
		this._resolverService = e;
	}
	hasChildren(e) {
		return e instanceof ReferencesModel || e instanceof FileReferences;
	}
	getChildren(e) {
		if (e instanceof ReferencesModel) return e.groups;
		if (e instanceof FileReferences) return e.resolve(this._resolverService).then((e) => e.children);
		throw Error("bad tree");
	}
};
DataSource = __decorate$80([__param$80(0, ITextModelService)], DataSource);
var Delegate = class {
	getHeight() {
		return 23;
	}
	getTemplateId(e) {
		return e instanceof FileReferences ? FileReferencesRenderer.id : OneReferenceRenderer.id;
	}
}, StringRepresentationProvider = class {
	constructor(e) {
		this._keybindingService = e;
	}
	getKeyboardNavigationLabel(e) {
		if (e instanceof OneReference) {
			let O = e.parent.getPreview(e)?.preview(e.range);
			if (O) return O.value;
		}
		return basename(e.uri);
	}
};
StringRepresentationProvider = __decorate$80([__param$80(0, IKeybindingService)], StringRepresentationProvider);
var IdentityProvider = class {
	getId(e) {
		return e instanceof OneReference ? e.id : e.uri;
	}
}, FileReferencesTemplate = class extends Disposable {
	constructor(e, O) {
		super(), this._labelService = O;
		let k = document.createElement("div");
		k.classList.add("reference-file"), this.file = this._register(new IconLabel(k, { supportHighlights: !0 })), this.badge = new CountBadge(append(k, $(".count")), {}, defaultCountBadgeStyles), e.appendChild(k);
	}
	set(e, O) {
		let k = dirname(e.uri);
		this.file.setLabel(this._labelService.getUriBasenameLabel(e.uri), this._labelService.getUriLabel(k, { relative: !0 }), {
			title: this._labelService.getUriLabel(e.uri),
			matches: O
		});
		let A = e.children.length;
		this.badge.setCount(A), A > 1 ? this.badge.setTitleFormat(localize("referencesCount", "{0} references", A)) : this.badge.setTitleFormat(localize("referenceCount", "{0} reference", A));
	}
};
FileReferencesTemplate = __decorate$80([__param$80(1, ILabelService)], FileReferencesTemplate);
var FileReferencesRenderer = class {
	static {
		FileReferencesRenderer_1 = this;
	}
	static {
		this.id = "FileReferencesRenderer";
	}
	constructor(e) {
		this._instantiationService = e, this.templateId = FileReferencesRenderer_1.id;
	}
	renderTemplate(e) {
		return this._instantiationService.createInstance(FileReferencesTemplate, e);
	}
	renderElement(e, O, k) {
		k.set(e.element, createMatches(e.filterData));
	}
	disposeTemplate(e) {
		e.dispose();
	}
};
FileReferencesRenderer = FileReferencesRenderer_1 = __decorate$80([__param$80(0, IInstantiationService)], FileReferencesRenderer);
var OneReferenceTemplate = class extends Disposable {
	constructor(e) {
		super(), this.label = this._register(new HighlightedLabel(e));
	}
	set(e, O) {
		let k = e.parent.getPreview(e)?.preview(e.range);
		if (!k || !k.value) this.label.set(`${basename(e.uri)}:${e.range.startLineNumber + 1}:${e.range.startColumn + 1}`);
		else {
			let { value: e, highlight: A } = k;
			O && !FuzzyScore.isDefault(O) ? (this.label.element.classList.toggle("referenceMatch", !1), this.label.set(e, createMatches(O))) : (this.label.element.classList.toggle("referenceMatch", !0), this.label.set(e, [A]));
		}
	}
}, OneReferenceRenderer = class e {
	constructor() {
		this.templateId = e.id;
	}
	static {
		this.id = "OneReferenceRenderer";
	}
	renderTemplate(e) {
		return new OneReferenceTemplate(e);
	}
	renderElement(e, O, k) {
		k.set(e.element, e.filterData);
	}
	disposeTemplate(e) {
		e.dispose();
	}
}, AccessibilityProvider = class {
	getWidgetAriaLabel() {
		return localize("treeAriaLabel", "References");
	}
	getAriaLabel(e) {
		return e.ariaMessage;
	}
}, __decorate$79 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$79 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, DecorationsManager = class e {
	static {
		this.DecorationOptions = ModelDecorationOptions.register({
			description: "reference-decoration",
			stickiness: 1,
			className: "reference-decoration"
		});
	}
	constructor(e, O) {
		this._editor = e, this._model = O, this._decorations = /* @__PURE__ */ new Map(), this._decorationIgnoreSet = /* @__PURE__ */ new Set(), this._callOnDispose = new DisposableStore(), this._callOnModelChange = new DisposableStore(), this._callOnDispose.add(this._editor.onDidChangeModel(() => this._onModelChanged())), this._onModelChanged();
	}
	dispose() {
		this._callOnModelChange.dispose(), this._callOnDispose.dispose(), this.removeDecorations();
	}
	_onModelChanged() {
		this._callOnModelChange.clear();
		let e = this._editor.getModel();
		if (e) {
			for (let O of this._model.references) if (O.uri.toString() === e.uri.toString()) {
				this._addDecorations(O.parent);
				return;
			}
		}
	}
	_addDecorations(O) {
		if (!this._editor.hasModel()) return;
		this._callOnModelChange.add(this._editor.getModel().onDidChangeDecorations(() => this._onDecorationChanged()));
		let k = [], A = [];
		for (let j = 0, M = O.children.length; j < M; j++) {
			let M = O.children[j];
			this._decorationIgnoreSet.has(M.id) || M.uri.toString() === this._editor.getModel().uri.toString() && (k.push({
				range: M.range,
				options: e.DecorationOptions
			}), A.push(j));
		}
		this._editor.changeDecorations((e) => {
			let j = e.deltaDecorations([], k);
			for (let e = 0; e < j.length; e++) this._decorations.set(j[e], O.children[A[e]]);
		});
	}
	_onDecorationChanged() {
		let e = [], O = this._editor.getModel();
		if (O) {
			for (let [k, A] of this._decorations) {
				let j = O.getDecorationRange(k);
				if (!j) continue;
				let M = !1;
				if (!Range.equalsRange(j, A.range)) {
					if (Range.spansMultipleLines(j)) M = !0;
					else {
						let e = A.range.endColumn - A.range.startColumn, O = j.endColumn - j.startColumn;
						e !== O && (M = !0);
					}
					M ? (this._decorationIgnoreSet.add(A.id), e.push(k)) : A.range = j;
				}
			}
			for (let O = 0, k = e.length; O < k; O++) this._decorations.delete(e[O]);
			this._editor.removeDecorations(e);
		}
	}
	removeDecorations() {
		this._editor.removeDecorations([...this._decorations.keys()]), this._decorations.clear();
	}
}, LayoutData = class {
	constructor() {
		this.ratio = .7, this.heightInLines = 18;
	}
	static fromJSON(e) {
		let O, k;
		try {
			let A = JSON.parse(e);
			O = A.ratio, k = A.heightInLines;
		} catch {}
		return {
			ratio: O || .7,
			heightInLines: k || 18
		};
	}
}, ReferencesTree = class extends WorkbenchAsyncDataTree {}, ReferenceWidget = class extends PeekViewWidget {
	constructor(e, O, k, A, j, M, N, P, F) {
		super(e, {
			showFrame: !1,
			showArrow: !0,
			isResizeable: !0,
			isAccessible: !0,
			supportOnTitleClick: !0
		}, M), this._defaultTreeKeyboardSupport = O, this.layoutData = k, this._textModelResolverService = j, this._instantiationService = M, this._peekViewService = N, this._uriLabel = P, this._keybindingService = F, this._disposeOnNewModel = new DisposableStore(), this._callOnDispose = new DisposableStore(), this._onDidSelectReference = new Emitter(), this.onDidSelectReference = this._onDidSelectReference.event, this._dim = new Dimension(0, 0), this._isClosing = !1, this._applyTheme(A.getColorTheme()), this._callOnDispose.add(A.onDidColorThemeChange(this._applyTheme.bind(this))), this._peekViewService.addExclusiveWidget(e, this), this.create();
	}
	get isClosing() {
		return this._isClosing;
	}
	dispose() {
		this._isClosing = !0, this.setModel(void 0), this._callOnDispose.dispose(), this._disposeOnNewModel.dispose(), dispose(this._preview), dispose(this._previewNotAvailableMessage), dispose(this._tree), dispose(this._previewModelReference), this._splitView.dispose(), super.dispose();
	}
	_applyTheme(e) {
		let O = e.getColor(peekViewBorder) || Color.transparent;
		this.style({
			arrowColor: O,
			frameColor: O,
			headerBackgroundColor: e.getColor(peekViewTitleBackground) || Color.transparent,
			primaryHeadingColor: e.getColor(peekViewTitleForeground),
			secondaryHeadingColor: e.getColor(peekViewTitleInfoForeground)
		});
	}
	show(e) {
		super.show(e, this.layoutData.heightInLines || 18);
	}
	focusOnReferenceTree() {
		this._tree.domFocus();
	}
	focusOnPreviewEditor() {
		this._preview.focus();
	}
	isPreviewEditorFocused() {
		return this._preview.hasTextFocus();
	}
	_onTitleClick(e) {
		this._preview && this._preview.getModel() && this._onDidSelectReference.fire({
			element: this._getFocusedReference(),
			kind: e.ctrlKey || e.metaKey || e.altKey ? "side" : "open",
			source: "title"
		});
	}
	_fillBody(e) {
		this.setCssClass("reference-zone-widget"), this._messageContainer = append(e, $("div.messages")), hide(this._messageContainer), this._splitView = new SplitView(e, { orientation: 1 }), this._previewContainer = append(e, $("div.preview.inline")), this._preview = this._instantiationService.createInstance(EmbeddedCodeEditorWidget, this._previewContainer, {
			scrollBeyondLastLine: !1,
			scrollbar: {
				verticalScrollbarSize: 14,
				horizontal: "auto",
				useShadows: !0,
				verticalHasArrows: !1,
				horizontalHasArrows: !1,
				alwaysConsumeMouseWheel: !0
			},
			overviewRulerLanes: 2,
			fixedOverflowWidgets: !0,
			minimap: { enabled: !1 }
		}, {}, this.editor), hide(this._previewContainer), this._previewNotAvailableMessage = this._instantiationService.createInstance(TextModel, localize("missingPreviewMessage", "no preview available"), PLAINTEXT_LANGUAGE_ID, TextModel.DEFAULT_CREATION_OPTIONS, null), this._treeContainer = append(e, $("div.ref-tree.inline"));
		let O = {
			keyboardSupport: this._defaultTreeKeyboardSupport,
			accessibilityProvider: new AccessibilityProvider(),
			keyboardNavigationLabelProvider: this._instantiationService.createInstance(StringRepresentationProvider),
			identityProvider: new IdentityProvider(),
			openOnSingleClick: !0,
			selectionNavigation: !0,
			overrideStyles: { listBackground: peekViewResultsBackground }
		};
		this._defaultTreeKeyboardSupport && this._callOnDispose.add(addStandardDisposableListener(this._treeContainer, "keydown", (e) => {
			e.equals(9) && (this._keybindingService.dispatchEvent(e, e.target), e.stopPropagation());
		}, !0)), this._tree = this._instantiationService.createInstance(ReferencesTree, "ReferencesWidget", this._treeContainer, new Delegate(), [this._instantiationService.createInstance(FileReferencesRenderer), this._instantiationService.createInstance(OneReferenceRenderer)], this._instantiationService.createInstance(DataSource), O), this._splitView.addView({
			onDidChange: Event.None,
			element: this._previewContainer,
			minimumSize: 200,
			maximumSize: Number.MAX_VALUE,
			layout: (e) => {
				this._preview.layout({
					height: this._dim.height,
					width: e
				});
			}
		}, Sizing.Distribute), this._splitView.addView({
			onDidChange: Event.None,
			element: this._treeContainer,
			minimumSize: 100,
			maximumSize: Number.MAX_VALUE,
			layout: (e) => {
				this._treeContainer.style.height = `${this._dim.height}px`, this._treeContainer.style.width = `${e}px`, this._tree.layout(this._dim.height, e);
			}
		}, Sizing.Distribute), this._disposables.add(this._splitView.onDidSashChange(() => {
			this._dim.width && (this.layoutData.ratio = this._splitView.getViewSize(0) / this._dim.width);
		}, void 0));
		let k = (e, O) => {
			e instanceof OneReference && (O === "show" && this._revealReference(e, !1), this._onDidSelectReference.fire({
				element: e,
				kind: O,
				source: "tree"
			}));
		};
		this._disposables.add(this._tree.onDidOpen((e) => {
			e.sideBySide ? k(e.element, "side") : e.editorOptions.pinned ? k(e.element, "goto") : k(e.element, "show");
		})), hide(this._treeContainer);
	}
	_onWidth(e) {
		this._dim && this._doLayoutBody(this._dim.height, e);
	}
	_doLayoutBody(e, O) {
		super._doLayoutBody(e, O), this._dim = new Dimension(O, e), this.layoutData.heightInLines = this._viewZone ? this._viewZone.heightInLines : this.layoutData.heightInLines, this._splitView.layout(O), this._splitView.resizeView(0, O * this.layoutData.ratio);
	}
	setSelection(e) {
		return this._revealReference(e, !0).then(() => {
			this._model && (this._tree.setSelection([e]), this._tree.setFocus([e]));
		});
	}
	setModel(e) {
		return this._disposeOnNewModel.clear(), this._model = e, this._model ? this._onNewModel() : Promise.resolve();
	}
	_onNewModel() {
		return this._model ? this._model.isEmpty ? (this.setTitle(""), this._messageContainer.innerText = localize("noResults", "No results"), show(this._messageContainer), Promise.resolve(void 0)) : (hide(this._messageContainer), this._decorationsManager = new DecorationsManager(this._preview, this._model), this._disposeOnNewModel.add(this._decorationsManager), this._disposeOnNewModel.add(this._model.onDidChangeReferenceRange((e) => this._tree.rerender(e))), this._disposeOnNewModel.add(this._preview.onMouseDown((e) => {
			let { event: O, target: k } = e;
			if (O.detail !== 2) return;
			let A = this._getFocusedReference();
			A && this._onDidSelectReference.fire({
				element: {
					uri: A.uri,
					range: k.range
				},
				kind: O.ctrlKey || O.metaKey || O.altKey ? "side" : "open",
				source: "editor"
			});
		})), this.container.classList.add("results-loaded"), show(this._treeContainer), show(this._previewContainer), this._splitView.layout(this._dim.width), this.focusOnReferenceTree(), this._tree.setInput(this._model.groups.length === 1 ? this._model.groups[0] : this._model)) : Promise.resolve(void 0);
	}
	_getFocusedReference() {
		let [e] = this._tree.getFocus();
		if (e instanceof OneReference) return e;
		if (e instanceof FileReferences && e.children.length > 0) return e.children[0];
	}
	async revealReference(e) {
		await this._revealReference(e, !1), this._onDidSelectReference.fire({
			element: e,
			kind: "goto",
			source: "tree"
		});
	}
	async _revealReference(e, O) {
		if (this._revealedReference === e) return;
		this._revealedReference = e, e.uri.scheme === Schemas.inMemory ? this.setTitle(localize("peekView.alternateTitle", "References")) : this.setTitle(basenameOrAuthority(e.uri), this._uriLabel.getUriLabel(dirname(e.uri)));
		let k = this._textModelResolverService.createModelReference(e.uri);
		this._tree.getInput() === e.parent ? this._tree.reveal(e) : (O && this._tree.reveal(e.parent), await this._tree.expand(e.parent), this._tree.reveal(e));
		let A = await k;
		if (!this._model) {
			A.dispose();
			return;
		}
		dispose(this._previewModelReference);
		let j = A.object;
		if (j) {
			let O = this._preview.getModel() === j.textEditorModel ? 0 : 1, k = Range.lift(e.range).collapseToStart();
			this._previewModelReference = A, this._preview.setModel(j.textEditorModel), this._preview.setSelection(k), this._preview.revealRangeInCenter(k, O);
		} else this._preview.setModel(this._previewNotAvailableMessage), A.dispose();
	}
};
ReferenceWidget = __decorate$79([
	__param$79(3, IThemeService),
	__param$79(4, ITextModelService),
	__param$79(5, IInstantiationService),
	__param$79(6, IPeekViewService),
	__param$79(7, ILabelService),
	__param$79(8, IKeybindingService)
], ReferenceWidget);
var __decorate$78 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$78 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, ReferencesController_1;
const ctxReferenceSearchVisible = new RawContextKey("referenceSearchVisible", !1, localize("referenceSearchVisible", "Whether reference peek is visible, like 'Peek References' or 'Peek Definition'"));
var ReferencesController = class {
	static {
		ReferencesController_1 = this;
	}
	static {
		this.ID = "editor.contrib.referencesController";
	}
	static get(e) {
		return e.getContribution(ReferencesController_1.ID);
	}
	constructor(e, O, k, A, j, M, N, P) {
		this._defaultTreeKeyboardSupport = e, this._editor = O, this._editorService = A, this._notificationService = j, this._instantiationService = M, this._storageService = N, this._configurationService = P, this._disposables = new DisposableStore(), this._requestIdPool = 0, this._ignoreModelChangeEvent = !1, this._referenceSearchVisible = ctxReferenceSearchVisible.bindTo(k);
	}
	dispose() {
		this._referenceSearchVisible.reset(), this._disposables.dispose(), this._widget?.dispose(), this._model?.dispose(), this._widget = void 0, this._model = void 0;
	}
	toggleWidget(e, O, k) {
		let A;
		if (this._widget && (A = this._widget.position), this.closeWidget(), A && e.containsPosition(A)) return;
		this._peekMode = k, this._referenceSearchVisible.set(!0), this._disposables.add(this._editor.onDidChangeModelLanguage(() => {
			this.closeWidget();
		})), this._disposables.add(this._editor.onDidChangeModel(() => {
			this._ignoreModelChangeEvent || this.closeWidget();
		}));
		let j = "peekViewLayout", M = LayoutData.fromJSON(this._storageService.get(j, 0, "{}"));
		this._widget = this._instantiationService.createInstance(ReferenceWidget, this._editor, this._defaultTreeKeyboardSupport, M), this._widget.setTitle(localize("labelLoading", "Loading...")), this._widget.show(e), this._disposables.add(this._widget.onDidClose(() => {
			O.cancel(), this._widget ? (this._storageService.store(j, JSON.stringify(this._widget.layoutData), 0, 1), this._widget.isClosing || this.closeWidget(), this._widget = void 0) : this.closeWidget();
		})), this._disposables.add(this._widget.onDidSelectReference((e) => {
			let { element: O, kind: A } = e;
			if (O) switch (A) {
				case "open":
					(e.source !== "editor" || !this._configurationService.getValue("editor.stablePeek")) && this.openReference(O, !1, !1);
					break;
				case "side":
					this.openReference(O, !0, !1);
					break;
				case "goto":
					k ? this._gotoReference(O, !0) : this.openReference(O, !1, !0);
					break;
			}
		}));
		let N = ++this._requestIdPool;
		O.then((O) => {
			if (N !== this._requestIdPool || !this._widget) {
				O.dispose();
				return;
			}
			return this._model?.dispose(), this._model = O, this._widget.setModel(this._model).then(() => {
				if (this._widget && this._model && this._editor.hasModel()) {
					this._model.isEmpty ? this._widget.setMetaTitle("") : this._widget.setMetaTitle(localize("metaTitle.N", "{0} ({1})", this._model.title, this._model.references.length));
					let O = this._editor.getModel().uri, k = new Position(e.startLineNumber, e.startColumn), A = this._model.nearestReference(O, k);
					if (A) return this._widget.setSelection(A).then(() => {
						this._widget && this._editor.getOption(87) === "editor" && this._widget.focusOnPreviewEditor();
					});
				}
			});
		}, (e) => {
			this._notificationService.error(e);
		});
	}
	changeFocusBetweenPreviewAndReferences() {
		this._widget && (this._widget.isPreviewEditorFocused() ? this._widget.focusOnReferenceTree() : this._widget.focusOnPreviewEditor());
	}
	async goToNextOrPreviousReference(e) {
		if (!this._editor.hasModel() || !this._model || !this._widget) return;
		let O = this._widget.position;
		if (!O) return;
		let k = this._model.nearestReference(this._editor.getModel().uri, O);
		if (!k) return;
		let A = this._model.nextOrPreviousReference(k, e), j = this._editor.hasTextFocus(), M = this._widget.isPreviewEditorFocused();
		await this._widget.setSelection(A), await this._gotoReference(A, !1), j ? this._editor.focus() : this._widget && M && this._widget.focusOnPreviewEditor();
	}
	async revealReference(e) {
		!this._editor.hasModel() || !this._model || !this._widget || await this._widget.revealReference(e);
	}
	closeWidget(e = !0) {
		this._widget?.dispose(), this._model?.dispose(), this._referenceSearchVisible.reset(), this._disposables.clear(), this._widget = void 0, this._model = void 0, e && this._editor.focus(), this._requestIdPool += 1;
	}
	_gotoReference(e, O) {
		this._widget?.hide(), this._ignoreModelChangeEvent = !0;
		let k = Range.lift(e.range).collapseToStart();
		return this._editorService.openCodeEditor({
			resource: e.uri,
			options: {
				selection: k,
				selectionSource: "code.jump",
				pinned: O
			}
		}, this._editor).then((e) => {
			if (this._ignoreModelChangeEvent = !1, !e || !this._widget) {
				this.closeWidget();
				return;
			}
			if (this._editor === e) this._widget.show(k), this._widget.focusOnReferenceTree();
			else {
				let O = ReferencesController_1.get(e), A = this._model.clone();
				this.closeWidget(), e.focus(), O?.toggleWidget(k, createCancelablePromise((e) => Promise.resolve(A)), this._peekMode ?? !1);
			}
		}, (e) => {
			this._ignoreModelChangeEvent = !1, onUnexpectedError(e);
		});
	}
	openReference(e, O, k) {
		O || this.closeWidget();
		let { uri: A, range: j } = e;
		this._editorService.openCodeEditor({
			resource: A,
			options: {
				selection: j,
				selectionSource: "code.jump",
				pinned: k
			}
		}, this._editor, O);
	}
};
ReferencesController = ReferencesController_1 = __decorate$78([
	__param$78(2, IContextKeyService),
	__param$78(3, ICodeEditorService),
	__param$78(4, INotificationService),
	__param$78(5, IInstantiationService),
	__param$78(6, IStorageService),
	__param$78(7, IConfigurationService)
], ReferencesController);
function withController(e, O) {
	let k = getOuterEditor(e);
	if (!k) return;
	let A = ReferencesController.get(k);
	A && O(A);
}
KeybindingsRegistry.registerCommandAndKeybindingRule({
	id: "togglePeekWidgetFocus",
	weight: 100,
	primary: KeyChord(2089, 60),
	when: ContextKeyExpr.or(ctxReferenceSearchVisible, PeekContext.inPeekEditor),
	handler(e) {
		withController(e, (e) => {
			e.changeFocusBetweenPreviewAndReferences();
		});
	}
}), KeybindingsRegistry.registerCommandAndKeybindingRule({
	id: "goToNextReference",
	weight: 90,
	primary: 62,
	secondary: [70],
	when: ContextKeyExpr.or(ctxReferenceSearchVisible, PeekContext.inPeekEditor),
	handler(e) {
		withController(e, (e) => {
			e.goToNextOrPreviousReference(!0);
		});
	}
}), KeybindingsRegistry.registerCommandAndKeybindingRule({
	id: "goToPreviousReference",
	weight: 90,
	primary: 1086,
	secondary: [1094],
	when: ContextKeyExpr.or(ctxReferenceSearchVisible, PeekContext.inPeekEditor),
	handler(e) {
		withController(e, (e) => {
			e.goToNextOrPreviousReference(!1);
		});
	}
}), CommandsRegistry.registerCommandAlias("goToNextReferenceFromEmbeddedEditor", "goToNextReference"), CommandsRegistry.registerCommandAlias("goToPreviousReferenceFromEmbeddedEditor", "goToPreviousReference"), CommandsRegistry.registerCommandAlias("closeReferenceSearchEditor", "closeReferenceSearch"), CommandsRegistry.registerCommand("closeReferenceSearch", (e) => withController(e, (e) => e.closeWidget())), KeybindingsRegistry.registerKeybindingRule({
	id: "closeReferenceSearch",
	weight: -1,
	primary: 9,
	secondary: [1033],
	when: ContextKeyExpr.and(PeekContext.inPeekEditor, ContextKeyExpr.not("config.editor.stablePeek"))
}), KeybindingsRegistry.registerKeybindingRule({
	id: "closeReferenceSearch",
	weight: 250,
	primary: 9,
	secondary: [1033],
	when: ContextKeyExpr.and(ctxReferenceSearchVisible, ContextKeyExpr.not("config.editor.stablePeek"), ContextKeyExpr.or(EditorContextKeys.editorTextFocus, InputFocusedContext.negate()))
}), KeybindingsRegistry.registerCommandAndKeybindingRule({
	id: "revealReference",
	weight: 200,
	primary: 3,
	mac: {
		primary: 3,
		secondary: [2066]
	},
	when: ContextKeyExpr.and(ctxReferenceSearchVisible, WorkbenchListFocusContextKey, WorkbenchTreeElementCanCollapse.negate(), WorkbenchTreeElementCanExpand.negate()),
	handler(e) {
		let O = e.get(IListService).lastFocusedList?.getFocus();
		Array.isArray(O) && O[0] instanceof OneReference && withController(e, (e) => e.revealReference(O[0]));
	}
}), KeybindingsRegistry.registerCommandAndKeybindingRule({
	id: "openReferenceToSide",
	weight: 100,
	primary: 2051,
	mac: { primary: 259 },
	when: ContextKeyExpr.and(ctxReferenceSearchVisible, WorkbenchListFocusContextKey, WorkbenchTreeElementCanCollapse.negate(), WorkbenchTreeElementCanExpand.negate()),
	handler(e) {
		let O = e.get(IListService).lastFocusedList?.getFocus();
		Array.isArray(O) && O[0] instanceof OneReference && withController(e, (e) => e.openReference(O[0], !0, !0));
	}
}), CommandsRegistry.registerCommand("openReference", (e) => {
	let O = e.get(IListService).lastFocusedList?.getFocus();
	Array.isArray(O) && O[0] instanceof OneReference && withController(e, (e) => e.openReference(O[0], !1, !0));
});
var __decorate$77 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$77 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
};
const ctxHasSymbols = new RawContextKey("hasSymbols", !1, localize("hasSymbols", "Whether there are symbol locations that can be navigated via keyboard-only.")), ISymbolNavigationService = createDecorator("ISymbolNavigationService");
var SymbolNavigationService = class {
	constructor(e, O, k, A) {
		this._editorService = O, this._notificationService = k, this._keybindingService = A, this._currentModel = void 0, this._currentIdx = -1, this._ignoreEditorChange = !1, this._ctxHasSymbols = ctxHasSymbols.bindTo(e);
	}
	reset() {
		this._ctxHasSymbols.reset(), this._currentState?.dispose(), this._currentMessage?.dispose(), this._currentModel = void 0, this._currentIdx = -1;
	}
	put(e) {
		let O = e.parent.parent;
		if (O.references.length <= 1) {
			this.reset();
			return;
		}
		this._currentModel = O, this._currentIdx = O.references.indexOf(e), this._ctxHasSymbols.set(!0), this._showMessage();
		let k = new EditorState$1(this._editorService), A = k.onDidChange((e) => {
			if (this._ignoreEditorChange) return;
			let k = this._editorService.getActiveCodeEditor();
			if (!k) return;
			let A = k.getModel(), j = k.getPosition();
			if (!A || !j) return;
			let M = !1, N = !1;
			for (let e of O.references) if (isEqual(e.uri, A.uri)) M = !0, N ||= Range.containsPosition(e.range, j);
			else if (M) break;
			(!M || !N) && this.reset();
		});
		this._currentState = combinedDisposable(k, A);
	}
	revealNext(e) {
		if (!this._currentModel) return Promise.resolve();
		this._currentIdx += 1, this._currentIdx %= this._currentModel.references.length;
		let O = this._currentModel.references[this._currentIdx];
		return this._showMessage(), this._ignoreEditorChange = !0, this._editorService.openCodeEditor({
			resource: O.uri,
			options: {
				selection: Range.collapseToStart(O.range),
				selectionRevealType: 3
			}
		}, e).finally(() => {
			this._ignoreEditorChange = !1;
		});
	}
	_showMessage() {
		this._currentMessage?.dispose();
		let e = this._keybindingService.lookupKeybinding("editor.gotoNextSymbolFromResult"), O = e ? localize("location.kb", "Symbol {0} of {1}, {2} for next", this._currentIdx + 1, this._currentModel.references.length, e.getLabel()) : localize("location", "Symbol {0} of {1}", this._currentIdx + 1, this._currentModel.references.length);
		this._currentMessage = this._notificationService.status(O);
	}
};
SymbolNavigationService = __decorate$77([
	__param$77(0, IContextKeyService),
	__param$77(1, ICodeEditorService),
	__param$77(2, INotificationService),
	__param$77(3, IKeybindingService)
], SymbolNavigationService), registerSingleton(ISymbolNavigationService, SymbolNavigationService, 1), registerEditorCommand(new class extends EditorCommand {
	constructor() {
		super({
			id: "editor.gotoNextSymbolFromResult",
			precondition: ctxHasSymbols,
			kbOpts: {
				weight: 100,
				primary: 70
			}
		});
	}
	runEditorCommand(e, O) {
		return e.get(ISymbolNavigationService).revealNext(O);
	}
}()), KeybindingsRegistry.registerCommandAndKeybindingRule({
	id: "editor.gotoNextSymbolFromResult.cancel",
	weight: 100,
	when: ctxHasSymbols,
	primary: 9,
	handler(e) {
		e.get(ISymbolNavigationService).reset();
	}
});
var EditorState$1 = class {
	constructor(e) {
		this._listener = /* @__PURE__ */ new Map(), this._disposables = new DisposableStore(), this._onDidChange = new Emitter(), this.onDidChange = this._onDidChange.event, this._disposables.add(e.onCodeEditorRemove(this._onDidRemoveEditor, this)), this._disposables.add(e.onCodeEditorAdd(this._onDidAddEditor, this)), e.listCodeEditors().forEach(this._onDidAddEditor, this);
	}
	dispose() {
		this._disposables.dispose(), this._onDidChange.dispose(), dispose(this._listener.values());
	}
	_onDidAddEditor(e) {
		this._listener.set(e, combinedDisposable(e.onDidChangeCursorPosition((O) => this._onDidChange.fire({ editor: e })), e.onDidChangeModelContent((O) => this._onDidChange.fire({ editor: e }))));
	}
	_onDidRemoveEditor(e) {
		this._listener.get(e)?.dispose(), this._listener.delete(e);
	}
};
EditorState$1 = __decorate$77([__param$77(0, ICodeEditorService)], EditorState$1);
function shouldIncludeLocationLink(e, O) {
	return O.uri.scheme === e.uri.scheme ? !0 : !matchesSomeScheme(O.uri, Schemas.walkThroughSnippet, Schemas.vscodeChatCodeBlock, Schemas.vscodeChatCodeCompareBlock);
}
async function getLocationLinks(e, O, k, A, j) {
	let M = k.ordered(e, A).map((k) => Promise.resolve(j(k, e, O)).then(void 0, (e) => {
		onUnexpectedExternalError(e);
	})), N = await Promise.all(M);
	return coalesce(N.flat()).filter((O) => shouldIncludeLocationLink(e, O));
}
function getDefinitionsAtPosition(e, O, k, A, j) {
	return getLocationLinks(O, k, e, A, (e, O, k) => e.provideDefinition(O, k, j));
}
function getDeclarationsAtPosition(e, O, k, A, j) {
	return getLocationLinks(O, k, e, A, (e, O, k) => e.provideDeclaration(O, k, j));
}
function getImplementationsAtPosition(e, O, k, A, j) {
	return getLocationLinks(O, k, e, A, (e, O, k) => e.provideImplementation(O, k, j));
}
function getTypeDefinitionsAtPosition(e, O, k, A, j) {
	return getLocationLinks(O, k, e, A, (e, O, k) => e.provideTypeDefinition(O, k, j));
}
function getReferencesAtPosition(e, O, k, A, j, M) {
	return getLocationLinks(O, k, e, j, async (e, O, k) => {
		let j = (await e.provideReferences(O, k, { includeDeclaration: !0 }, M))?.filter((e) => shouldIncludeLocationLink(O, e));
		if (!A || !j || j.length !== 2) return j;
		let N = (await e.provideReferences(O, k, { includeDeclaration: !1 }, M))?.filter((e) => shouldIncludeLocationLink(O, e));
		return N && N.length === 1 ? N : j;
	});
}
async function _sortedAndDeduped(e) {
	let O = await e(), k = new ReferencesModel(O, ""), A = k.references.map((e) => e.link);
	return k.dispose(), A;
}
registerModelAndPositionCommand("_executeDefinitionProvider", (e, O, k) => {
	let A = e.get(ILanguageFeaturesService), j = getDefinitionsAtPosition(A.definitionProvider, O, k, !1, CancellationToken.None);
	return _sortedAndDeduped(() => j);
}), registerModelAndPositionCommand("_executeDefinitionProvider_recursive", (e, O, k) => {
	let A = e.get(ILanguageFeaturesService), j = getDefinitionsAtPosition(A.definitionProvider, O, k, !0, CancellationToken.None);
	return _sortedAndDeduped(() => j);
}), registerModelAndPositionCommand("_executeTypeDefinitionProvider", (e, O, k) => {
	let A = e.get(ILanguageFeaturesService), j = getTypeDefinitionsAtPosition(A.typeDefinitionProvider, O, k, !1, CancellationToken.None);
	return _sortedAndDeduped(() => j);
}), registerModelAndPositionCommand("_executeTypeDefinitionProvider_recursive", (e, O, k) => {
	let A = e.get(ILanguageFeaturesService), j = getTypeDefinitionsAtPosition(A.typeDefinitionProvider, O, k, !0, CancellationToken.None);
	return _sortedAndDeduped(() => j);
}), registerModelAndPositionCommand("_executeDeclarationProvider", (e, O, k) => {
	let A = e.get(ILanguageFeaturesService), j = getDeclarationsAtPosition(A.declarationProvider, O, k, !1, CancellationToken.None);
	return _sortedAndDeduped(() => j);
}), registerModelAndPositionCommand("_executeDeclarationProvider_recursive", (e, O, k) => {
	let A = e.get(ILanguageFeaturesService), j = getDeclarationsAtPosition(A.declarationProvider, O, k, !0, CancellationToken.None);
	return _sortedAndDeduped(() => j);
}), registerModelAndPositionCommand("_executeReferenceProvider", (e, O, k) => {
	let A = e.get(ILanguageFeaturesService), j = getReferencesAtPosition(A.referenceProvider, O, k, !1, !1, CancellationToken.None);
	return _sortedAndDeduped(() => j);
}), registerModelAndPositionCommand("_executeReferenceProvider_recursive", (e, O, k) => {
	let A = e.get(ILanguageFeaturesService), j = getReferencesAtPosition(A.referenceProvider, O, k, !1, !0, CancellationToken.None);
	return _sortedAndDeduped(() => j);
}), registerModelAndPositionCommand("_executeImplementationProvider", (e, O, k) => {
	let A = e.get(ILanguageFeaturesService), j = getImplementationsAtPosition(A.implementationProvider, O, k, !1, CancellationToken.None);
	return _sortedAndDeduped(() => j);
}), registerModelAndPositionCommand("_executeImplementationProvider_recursive", (e, O, k) => {
	let A = e.get(ILanguageFeaturesService), j = getImplementationsAtPosition(A.implementationProvider, O, k, !0, CancellationToken.None);
	return _sortedAndDeduped(() => j);
}), MenuRegistry.appendMenuItem(MenuId.EditorContext, {
	submenu: MenuId.EditorContextPeek,
	title: localize("peek.submenu", "Peek"),
	group: "navigation",
	order: 100
});
var SymbolNavigationAnchor = class e {
	static is(O) {
		return !O || typeof O != "object" ? !1 : !!(O instanceof e || Position.isIPosition(O.position) && O.model);
	}
	constructor(e, O) {
		this.model = e, this.position = O;
	}
}, SymbolNavigationAction = class e extends EditorAction2 {
	static {
		this._allSymbolNavigationCommands = /* @__PURE__ */ new Map();
	}
	static {
		this._activeAlternativeCommands = /* @__PURE__ */ new Set();
	}
	static all() {
		return e._allSymbolNavigationCommands.values();
	}
	static _patchConfig(e) {
		let O = {
			...e,
			f1: !0
		};
		if (O.menu) for (let k of Iterable.wrap(O.menu)) (k.id === MenuId.EditorContext || k.id === MenuId.EditorContextPeek) && (k.when = ContextKeyExpr.and(e.precondition, k.when));
		return O;
	}
	constructor(O, k) {
		super(e._patchConfig(k)), this.configuration = O, e._allSymbolNavigationCommands.set(k.id, this);
	}
	runEditorCommand(O, k, A, j) {
		if (!k.hasModel()) return Promise.resolve(void 0);
		let M = O.get(INotificationService), N = O.get(ICodeEditorService), P = O.get(IEditorProgressService), F = O.get(ISymbolNavigationService), I = O.get(ILanguageFeaturesService), L = O.get(IInstantiationService), R = k.getModel(), z = k.getPosition(), B = SymbolNavigationAnchor.is(A) ? A : new SymbolNavigationAnchor(R, z), V = new EditorStateCancellationTokenSource(k, 5), H = raceCancellation(this._getLocationModel(I, B.model, B.position, V.token), V.token).then(async (O) => {
			if (!O || V.token.isCancellationRequested) return;
			alert(O.ariaMessage);
			let M;
			if (O.referenceAt(R.uri, z)) {
				let O = this._getAlternativeCommand(k);
				!e._activeAlternativeCommands.has(O) && e._allSymbolNavigationCommands.has(O) && (M = e._allSymbolNavigationCommands.get(O));
			}
			let P = O.references.length;
			if (P === 0) {
				if (!this.configuration.muteMessage) {
					let e = R.getWordAtPosition(z);
					MessageController.get(k)?.showMessage(this._getNoResultFoundMessage(e), z);
				}
			} else if (P === 1 && M) e._activeAlternativeCommands.add(this.desc.id), L.invokeFunction((O) => M.runEditorCommand(O, k, A, j).finally(() => {
				e._activeAlternativeCommands.delete(this.desc.id);
			}));
			else return this._onResult(N, F, k, O, j);
		}, (e) => {
			M.error(e);
		}).finally(() => {
			V.dispose();
		});
		return P.showWhile(H, 250), H;
	}
	async _onResult(e, O, k, A, j) {
		let M = this._getGoToPreference(k);
		if (!(k instanceof EmbeddedCodeEditorWidget) && (this.configuration.openInPeek || M === "peek" && A.references.length > 1)) this._openInPeek(k, A, j);
		else {
			let N = A.firstReference(), P = A.references.length > 1 && M === "gotoAndPeek", F = await this._openReference(k, e, N, this.configuration.openToSide, !P);
			P && F ? this._openInPeek(F, A, j) : A.dispose(), M === "goto" && O.put(N);
		}
	}
	async _openReference(e, O, k, A, j) {
		let M;
		if (isLocationLink(k) && (M = k.targetSelectionRange), M ||= k.range, !M) return;
		let N = await O.openCodeEditor({
			resource: k.uri,
			options: {
				selection: Range.collapseToStart(M),
				selectionRevealType: 3,
				selectionSource: "code.jump"
			}
		}, e, A);
		if (N) {
			if (j) {
				let e = N.getModel(), O = N.createDecorationsCollection([{
					range: M,
					options: {
						description: "symbol-navigate-action-highlight",
						className: "symbolHighlight"
					}
				}]);
				setTimeout(() => {
					N.getModel() === e && O.clear();
				}, 350);
			}
			return N;
		}
	}
	_openInPeek(e, O, k) {
		let A = ReferencesController.get(e);
		A && e.hasModel() ? A.toggleWidget(k ?? e.getSelection(), createCancelablePromise((e) => Promise.resolve(O)), this.configuration.openInPeek) : O.dispose();
	}
}, DefinitionAction = class extends SymbolNavigationAction {
	async _getLocationModel(e, O, k, A) {
		return new ReferencesModel(await getDefinitionsAtPosition(e.definitionProvider, O, k, !1, A), localize("def.title", "Definitions"));
	}
	_getNoResultFoundMessage(e) {
		return e && e.word ? localize("noResultWord", "No definition found for '{0}'", e.word) : localize("generic.noResults", "No definition found");
	}
	_getAlternativeCommand(e) {
		return e.getOption(58).alternativeDefinitionCommand;
	}
	_getGoToPreference(e) {
		return e.getOption(58).multipleDefinitions;
	}
};
registerAction2(class e extends DefinitionAction {
	static {
		this.id = "editor.action.revealDefinition";
	}
	constructor() {
		super({
			openToSide: !1,
			openInPeek: !1,
			muteMessage: !1
		}, {
			id: e.id,
			title: {
				...localize2("actions.goToDecl.label", "Go to Definition"),
				mnemonicTitle: localize({
					key: "miGotoDefinition",
					comment: ["&& denotes a mnemonic"]
				}, "Go to &&Definition")
			},
			precondition: EditorContextKeys.hasDefinitionProvider,
			keybinding: [{
				when: EditorContextKeys.editorTextFocus,
				primary: 70,
				weight: 100
			}, {
				when: ContextKeyExpr.and(EditorContextKeys.editorTextFocus, IsWebContext),
				primary: 2118,
				weight: 100
			}],
			menu: [{
				id: MenuId.EditorContext,
				group: "navigation",
				order: 1.1
			}, {
				id: MenuId.MenubarGoMenu,
				precondition: null,
				group: "4_symbol_nav",
				order: 2
			}]
		}), CommandsRegistry.registerCommandAlias("editor.action.goToDeclaration", e.id);
	}
}), registerAction2(class e extends DefinitionAction {
	static {
		this.id = "editor.action.revealDefinitionAside";
	}
	constructor() {
		super({
			openToSide: !0,
			openInPeek: !1,
			muteMessage: !1
		}, {
			id: e.id,
			title: localize2("actions.goToDeclToSide.label", "Open Definition to the Side"),
			precondition: ContextKeyExpr.and(EditorContextKeys.hasDefinitionProvider, EditorContextKeys.isInEmbeddedEditor.toNegated()),
			keybinding: [{
				when: EditorContextKeys.editorTextFocus,
				primary: KeyChord(2089, 70),
				weight: 100
			}, {
				when: ContextKeyExpr.and(EditorContextKeys.editorTextFocus, IsWebContext),
				primary: KeyChord(2089, 2118),
				weight: 100
			}]
		}), CommandsRegistry.registerCommandAlias("editor.action.openDeclarationToTheSide", e.id);
	}
}), registerAction2(class e extends DefinitionAction {
	static {
		this.id = "editor.action.peekDefinition";
	}
	constructor() {
		super({
			openToSide: !1,
			openInPeek: !0,
			muteMessage: !1
		}, {
			id: e.id,
			title: localize2("actions.previewDecl.label", "Peek Definition"),
			precondition: ContextKeyExpr.and(EditorContextKeys.hasDefinitionProvider, PeekContext.notInPeekEditor, EditorContextKeys.isInEmbeddedEditor.toNegated()),
			keybinding: {
				when: EditorContextKeys.editorTextFocus,
				primary: 582,
				linux: { primary: 3140 },
				weight: 100
			},
			menu: {
				id: MenuId.EditorContextPeek,
				group: "peek",
				order: 2
			}
		}), CommandsRegistry.registerCommandAlias("editor.action.previewDeclaration", e.id);
	}
});
var DeclarationAction = class extends SymbolNavigationAction {
	async _getLocationModel(e, O, k, A) {
		return new ReferencesModel(await getDeclarationsAtPosition(e.declarationProvider, O, k, !1, A), localize("decl.title", "Declarations"));
	}
	_getNoResultFoundMessage(e) {
		return e && e.word ? localize("decl.noResultWord", "No declaration found for '{0}'", e.word) : localize("decl.generic.noResults", "No declaration found");
	}
	_getAlternativeCommand(e) {
		return e.getOption(58).alternativeDeclarationCommand;
	}
	_getGoToPreference(e) {
		return e.getOption(58).multipleDeclarations;
	}
};
registerAction2(class e extends DeclarationAction {
	static {
		this.id = "editor.action.revealDeclaration";
	}
	constructor() {
		super({
			openToSide: !1,
			openInPeek: !1,
			muteMessage: !1
		}, {
			id: e.id,
			title: {
				...localize2("actions.goToDeclaration.label", "Go to Declaration"),
				mnemonicTitle: localize({
					key: "miGotoDeclaration",
					comment: ["&& denotes a mnemonic"]
				}, "Go to &&Declaration")
			},
			precondition: ContextKeyExpr.and(EditorContextKeys.hasDeclarationProvider, EditorContextKeys.isInEmbeddedEditor.toNegated()),
			menu: [{
				id: MenuId.EditorContext,
				group: "navigation",
				order: 1.3
			}, {
				id: MenuId.MenubarGoMenu,
				precondition: null,
				group: "4_symbol_nav",
				order: 3
			}]
		});
	}
	_getNoResultFoundMessage(e) {
		return e && e.word ? localize("decl.noResultWord", "No declaration found for '{0}'", e.word) : localize("decl.generic.noResults", "No declaration found");
	}
}), registerAction2(class extends DeclarationAction {
	constructor() {
		super({
			openToSide: !1,
			openInPeek: !0,
			muteMessage: !1
		}, {
			id: "editor.action.peekDeclaration",
			title: localize2("actions.peekDecl.label", "Peek Declaration"),
			precondition: ContextKeyExpr.and(EditorContextKeys.hasDeclarationProvider, PeekContext.notInPeekEditor, EditorContextKeys.isInEmbeddedEditor.toNegated()),
			menu: {
				id: MenuId.EditorContextPeek,
				group: "peek",
				order: 3
			}
		});
	}
});
var TypeDefinitionAction = class extends SymbolNavigationAction {
	async _getLocationModel(e, O, k, A) {
		return new ReferencesModel(await getTypeDefinitionsAtPosition(e.typeDefinitionProvider, O, k, !1, A), localize("typedef.title", "Type Definitions"));
	}
	_getNoResultFoundMessage(e) {
		return e && e.word ? localize("goToTypeDefinition.noResultWord", "No type definition found for '{0}'", e.word) : localize("goToTypeDefinition.generic.noResults", "No type definition found");
	}
	_getAlternativeCommand(e) {
		return e.getOption(58).alternativeTypeDefinitionCommand;
	}
	_getGoToPreference(e) {
		return e.getOption(58).multipleTypeDefinitions;
	}
};
registerAction2(class e extends TypeDefinitionAction {
	static {
		this.ID = "editor.action.goToTypeDefinition";
	}
	constructor() {
		super({
			openToSide: !1,
			openInPeek: !1,
			muteMessage: !1
		}, {
			id: e.ID,
			title: {
				...localize2("actions.goToTypeDefinition.label", "Go to Type Definition"),
				mnemonicTitle: localize({
					key: "miGotoTypeDefinition",
					comment: ["&& denotes a mnemonic"]
				}, "Go to &&Type Definition")
			},
			precondition: EditorContextKeys.hasTypeDefinitionProvider,
			keybinding: {
				when: EditorContextKeys.editorTextFocus,
				primary: 0,
				weight: 100
			},
			menu: [{
				id: MenuId.EditorContext,
				group: "navigation",
				order: 1.4
			}, {
				id: MenuId.MenubarGoMenu,
				precondition: null,
				group: "4_symbol_nav",
				order: 3
			}]
		});
	}
}), registerAction2(class e extends TypeDefinitionAction {
	static {
		this.ID = "editor.action.peekTypeDefinition";
	}
	constructor() {
		super({
			openToSide: !1,
			openInPeek: !0,
			muteMessage: !1
		}, {
			id: e.ID,
			title: localize2("actions.peekTypeDefinition.label", "Peek Type Definition"),
			precondition: ContextKeyExpr.and(EditorContextKeys.hasTypeDefinitionProvider, PeekContext.notInPeekEditor, EditorContextKeys.isInEmbeddedEditor.toNegated()),
			menu: {
				id: MenuId.EditorContextPeek,
				group: "peek",
				order: 4
			}
		});
	}
});
var ImplementationAction = class extends SymbolNavigationAction {
	async _getLocationModel(e, O, k, A) {
		return new ReferencesModel(await getImplementationsAtPosition(e.implementationProvider, O, k, !1, A), localize("impl.title", "Implementations"));
	}
	_getNoResultFoundMessage(e) {
		return e && e.word ? localize("goToImplementation.noResultWord", "No implementation found for '{0}'", e.word) : localize("goToImplementation.generic.noResults", "No implementation found");
	}
	_getAlternativeCommand(e) {
		return e.getOption(58).alternativeImplementationCommand;
	}
	_getGoToPreference(e) {
		return e.getOption(58).multipleImplementations;
	}
};
registerAction2(class e extends ImplementationAction {
	static {
		this.ID = "editor.action.goToImplementation";
	}
	constructor() {
		super({
			openToSide: !1,
			openInPeek: !1,
			muteMessage: !1
		}, {
			id: e.ID,
			title: {
				...localize2("actions.goToImplementation.label", "Go to Implementations"),
				mnemonicTitle: localize({
					key: "miGotoImplementation",
					comment: ["&& denotes a mnemonic"]
				}, "Go to &&Implementations")
			},
			precondition: EditorContextKeys.hasImplementationProvider,
			keybinding: {
				when: EditorContextKeys.editorTextFocus,
				primary: 2118,
				weight: 100
			},
			menu: [{
				id: MenuId.EditorContext,
				group: "navigation",
				order: 1.45
			}, {
				id: MenuId.MenubarGoMenu,
				precondition: null,
				group: "4_symbol_nav",
				order: 4
			}]
		});
	}
}), registerAction2(class e extends ImplementationAction {
	static {
		this.ID = "editor.action.peekImplementation";
	}
	constructor() {
		super({
			openToSide: !1,
			openInPeek: !0,
			muteMessage: !1
		}, {
			id: e.ID,
			title: localize2("actions.peekImplementation.label", "Peek Implementations"),
			precondition: ContextKeyExpr.and(EditorContextKeys.hasImplementationProvider, PeekContext.notInPeekEditor, EditorContextKeys.isInEmbeddedEditor.toNegated()),
			keybinding: {
				when: EditorContextKeys.editorTextFocus,
				primary: 3142,
				weight: 100
			},
			menu: {
				id: MenuId.EditorContextPeek,
				group: "peek",
				order: 5
			}
		});
	}
});
var ReferencesAction = class extends SymbolNavigationAction {
	_getNoResultFoundMessage(e) {
		return e ? localize("references.no", "No references found for '{0}'", e.word) : localize("references.noGeneric", "No references found");
	}
	_getAlternativeCommand(e) {
		return e.getOption(58).alternativeReferenceCommand;
	}
	_getGoToPreference(e) {
		return e.getOption(58).multipleReferences;
	}
};
registerAction2(class extends ReferencesAction {
	constructor() {
		super({
			openToSide: !1,
			openInPeek: !1,
			muteMessage: !1
		}, {
			id: "editor.action.goToReferences",
			title: {
				...localize2("goToReferences.label", "Go to References"),
				mnemonicTitle: localize({
					key: "miGotoReference",
					comment: ["&& denotes a mnemonic"]
				}, "Go to &&References")
			},
			precondition: ContextKeyExpr.and(EditorContextKeys.hasReferenceProvider, PeekContext.notInPeekEditor, EditorContextKeys.isInEmbeddedEditor.toNegated()),
			keybinding: {
				when: EditorContextKeys.editorTextFocus,
				primary: 1094,
				weight: 100
			},
			menu: [{
				id: MenuId.EditorContext,
				group: "navigation",
				order: 1.45
			}, {
				id: MenuId.MenubarGoMenu,
				precondition: null,
				group: "4_symbol_nav",
				order: 5
			}]
		});
	}
	async _getLocationModel(e, O, k, A) {
		return new ReferencesModel(await getReferencesAtPosition(e.referenceProvider, O, k, !0, !1, A), localize("ref.title", "References"));
	}
}), registerAction2(class extends ReferencesAction {
	constructor() {
		super({
			openToSide: !1,
			openInPeek: !0,
			muteMessage: !1
		}, {
			id: "editor.action.referenceSearch.trigger",
			title: localize2("references.action.label", "Peek References"),
			precondition: ContextKeyExpr.and(EditorContextKeys.hasReferenceProvider, PeekContext.notInPeekEditor, EditorContextKeys.isInEmbeddedEditor.toNegated()),
			menu: {
				id: MenuId.EditorContextPeek,
				group: "peek",
				order: 6
			}
		});
	}
	async _getLocationModel(e, O, k, A) {
		return new ReferencesModel(await getReferencesAtPosition(e.referenceProvider, O, k, !1, !1, A), localize("ref.title", "References"));
	}
});
var GenericGoToLocationAction = class extends SymbolNavigationAction {
	constructor(e, O, k) {
		super(e, {
			id: "editor.action.goToLocation",
			title: localize2("label.generic", "Go to Any Symbol"),
			precondition: ContextKeyExpr.and(PeekContext.notInPeekEditor, EditorContextKeys.isInEmbeddedEditor.toNegated())
		}), this._references = O, this._gotoMultipleBehaviour = k;
	}
	async _getLocationModel(e, O, k, A) {
		return new ReferencesModel(this._references, localize("generic.title", "Locations"));
	}
	_getNoResultFoundMessage(e) {
		return e && localize("generic.noResult", "No results for '{0}'", e.word) || "";
	}
	_getGoToPreference(e) {
		return this._gotoMultipleBehaviour ?? e.getOption(58).multipleReferences;
	}
	_getAlternativeCommand() {
		return "";
	}
};
CommandsRegistry.registerCommand({
	id: "editor.action.goToLocations",
	metadata: {
		description: "Go to locations from a position in a file",
		args: [
			{
				name: "uri",
				description: "The text document in which to start",
				constraint: URI
			},
			{
				name: "position",
				description: "The position at which to start",
				constraint: Position.isIPosition
			},
			{
				name: "locations",
				description: "An array of locations.",
				constraint: Array
			},
			{
				name: "multiple",
				description: "Define what to do when having multiple results, either `peek`, `gotoAndPeek`, or `goto`"
			},
			{
				name: "noResultsMessage",
				description: "Human readable message that shows when locations is empty."
			}
		]
	},
	handler: async (e, O, k, A, j, M, N) => {
		assertType(URI.isUri(O)), assertType(Position.isIPosition(k)), assertType(Array.isArray(A)), assertType(j === void 0 || typeof j == "string"), assertType(N === void 0 || typeof N == "boolean");
		let P = e.get(ICodeEditorService), F = await P.openCodeEditor({ resource: O }, P.getFocusedCodeEditor());
		if (isCodeEditor(F)) return F.setPosition(k), F.revealPositionInCenterIfOutsideViewport(k, 0), F.invokeWithinContext((e) => {
			let O = new class extends GenericGoToLocationAction {
				_getNoResultFoundMessage(e) {
					return M || super._getNoResultFoundMessage(e);
				}
			}({
				muteMessage: !M,
				openInPeek: !!N,
				openToSide: !1
			}, A, j);
			e.get(IInstantiationService).invokeFunction(O.run.bind(O), F);
		});
	}
}), CommandsRegistry.registerCommand({
	id: "editor.action.peekLocations",
	metadata: {
		description: "Peek locations from a position in a file",
		args: [
			{
				name: "uri",
				description: "The text document in which to start",
				constraint: URI
			},
			{
				name: "position",
				description: "The position at which to start",
				constraint: Position.isIPosition
			},
			{
				name: "locations",
				description: "An array of locations.",
				constraint: Array
			},
			{
				name: "multiple",
				description: "Define what to do when having multiple results, either `peek`, `gotoAndPeek`, or `goto`"
			}
		]
	},
	handler: async (e, O, k, A, j) => {
		e.get(ICommandService).executeCommand("editor.action.goToLocations", O, k, A, j, void 0, !0);
	}
}), CommandsRegistry.registerCommand({
	id: "editor.action.findReferences",
	handler: (e, O, k) => {
		assertType(URI.isUri(O)), assertType(Position.isIPosition(k));
		let A = e.get(ILanguageFeaturesService), j = e.get(ICodeEditorService);
		return j.openCodeEditor({ resource: O }, j.getFocusedCodeEditor()).then((e) => {
			if (!isCodeEditor(e) || !e.hasModel()) return;
			let O = ReferencesController.get(e);
			if (!O) return;
			let j = createCancelablePromise((O) => getReferencesAtPosition(A.referenceProvider, e.getModel(), Position.lift(k), !1, !1, O).then((e) => new ReferencesModel(e, localize("ref.title", "References")))), M = new Range(k.lineNumber, k.column, k.lineNumber, k.column);
			return Promise.resolve(O.toggleWidget(M, j, !1));
		});
	}
}), CommandsRegistry.registerCommandAlias("editor.action.showReferences", "editor.action.peekLocations");
async function showGoToContextMenu(e, O, k, A) {
	let j = e.get(ITextModelService), M = e.get(IContextMenuService), N = e.get(ICommandService), P = e.get(IInstantiationService), I = e.get(INotificationService);
	if (await A.item.resolve(CancellationToken.None), !A.part.location) return;
	let L = A.part.location, R = [], z = new Set(MenuRegistry.getMenuItems(MenuId.EditorContext).map((e) => isIMenuItem(e) ? e.command.id : generateUuid()));
	for (let e of SymbolNavigationAction.all()) z.has(e.desc.id) && R.push(new Action(e.desc.id, MenuItemAction.label(e.desc, { renderShortTitle: !0 }), void 0, !0, async () => {
		let k = await j.createModelReference(L.uri);
		try {
			let j = new SymbolNavigationAnchor(k.object.textEditorModel, Range.getStartPosition(L.range)), M = A.item.anchor.range;
			await P.invokeFunction(e.runEditorCommand.bind(e), O, j, M);
		} finally {
			k.dispose();
		}
	}));
	if (A.part.command) {
		let { command: e } = A.part;
		R.push(new Separator()), R.push(new Action(e.id, e.title, void 0, !0, async () => {
			try {
				await N.executeCommand(e.id, ...e.arguments ?? []);
			} catch (e) {
				I.notify({
					severity: Severity.Error,
					source: A.item.provider.displayName,
					message: e
				});
			}
		}));
	}
	let B = O.getOption(128);
	M.showContextMenu({
		domForShadowRoot: B ? O.getDomNode() ?? void 0 : void 0,
		getAnchor: () => {
			let e = getDomNodePagePosition(k);
			return {
				x: e.left,
				y: e.top + e.height + 8
			};
		},
		getActions: () => R,
		onHide: () => {
			O.focus();
		},
		autoSelectFirstItem: !0
	});
}
async function goToDefinitionWithLocation(e, O, k, A) {
	let j = await e.get(ITextModelService).createModelReference(A.uri);
	await k.invokeWithinContext(async (e) => {
		let M = O.hasSideBySideModifier, N = e.get(IContextKeyService), P = PeekContext.inPeekEditor.getValue(N), F = !M && k.getOption(89) && !P;
		return new DefinitionAction({
			openToSide: M,
			openInPeek: F,
			muteMessage: !0
		}, {
			title: {
				value: "",
				original: ""
			},
			id: "",
			precondition: void 0
		}).run(e, new SymbolNavigationAnchor(j.object.textEditorModel, Range.getStartPosition(A.range)), Range.lift(A.range));
	}), j.dispose();
}
var __decorate$76 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$76 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, InlayHintsController_1, InlayHintsCache = class e {
	constructor() {
		this._entries = new LRUCache(50);
	}
	get(O) {
		let k = e._key(O);
		return this._entries.get(k);
	}
	set(O, k) {
		let A = e._key(O);
		this._entries.set(A, k);
	}
	static _key(e) {
		return `${e.uri.toString()}/${e.getVersionId()}`;
	}
}, IInlayHintsCache = createDecorator("IInlayHintsCache");
registerSingleton(IInlayHintsCache, InlayHintsCache, 1);
var RenderedInlayHintLabelPart = class {
	constructor(e, O) {
		this.item = e, this.index = O;
	}
	get part() {
		let e = this.item.hint.label;
		return typeof e == "string" ? { label: e } : e[this.index];
	}
}, ActiveInlayHintInfo = class {
	constructor(e, O) {
		this.part = e, this.hasTriggerModifier = O;
	}
}, InlayHintsController = class {
	static {
		InlayHintsController_1 = this;
	}
	static {
		this.ID = "editor.contrib.InlayHints";
	}
	static {
		this._MAX_DECORATORS = 1500;
	}
	static {
		this._MAX_LABEL_LEN = 43;
	}
	static get(e) {
		return e.getContribution(InlayHintsController_1.ID) ?? void 0;
	}
	constructor(e, O, k, A, j, M, N) {
		this._editor = e, this._languageFeaturesService = O, this._inlayHintsCache = A, this._commandService = j, this._notificationService = M, this._instaService = N, this._disposables = new DisposableStore(), this._sessionDisposables = new DisposableStore(), this._decorationsMetadata = /* @__PURE__ */ new Map(), this._ruleFactory = new DynamicCssRules(this._editor), this._activeRenderMode = 0, this._debounceInfo = k.for(O.inlayHintsProvider, "InlayHint", { min: 25 }), this._disposables.add(O.inlayHintsProvider.onDidChange(() => this._update())), this._disposables.add(e.onDidChangeModel(() => this._update())), this._disposables.add(e.onDidChangeModelLanguage(() => this._update())), this._disposables.add(e.onDidChangeConfiguration((e) => {
			e.hasChanged(142) && this._update();
		})), this._update();
	}
	dispose() {
		this._sessionDisposables.dispose(), this._removeAllDecorations(), this._disposables.dispose();
	}
	_update() {
		this._sessionDisposables.clear(), this._removeAllDecorations();
		let e = this._editor.getOption(142);
		if (e.enabled === "off") return;
		let O = this._editor.getModel();
		if (!O || !this._languageFeaturesService.inlayHintsProvider.has(O)) return;
		if (e.enabled === "on") this._activeRenderMode = 0;
		else {
			let O, k;
			e.enabled === "onUnlessPressed" ? (O = 0, k = 1) : (O = 1, k = 0), this._activeRenderMode = O, this._sessionDisposables.add(ModifierKeyEmitter.getInstance().event((e) => {
				if (!this._editor.hasModel()) return;
				let A = e.altKey && e.ctrlKey && !(e.shiftKey || e.metaKey) ? k : O;
				if (A !== this._activeRenderMode) {
					this._activeRenderMode = A;
					let e = this._editor.getModel(), O = this._copyInlayHintsWithCurrentAnchor(e);
					this._updateHintsDecorators([e.getFullModelRange()], O), M.schedule(0);
				}
			}));
		}
		let k = this._inlayHintsCache.get(O);
		k && this._updateHintsDecorators([O.getFullModelRange()], k), this._sessionDisposables.add(toDisposable(() => {
			O.isDisposed() || this._cacheHintsForFastRestore(O);
		}));
		let A, j = /* @__PURE__ */ new Set(), M = new RunOnceScheduler(async () => {
			let e = Date.now();
			A?.dispose(!0), A = new CancellationTokenSource();
			let k = O.onWillDispose(() => A?.cancel());
			try {
				let k = A.token, N = await InlayHintsFragments.create(this._languageFeaturesService.inlayHintsProvider, O, this._getHintsRanges(), k);
				if (M.delay = this._debounceInfo.update(O, Date.now() - e), k.isCancellationRequested) {
					N.dispose();
					return;
				}
				for (let e of N.provider) typeof e.onDidChangeInlayHints == "function" && !j.has(e) && (j.add(e), this._sessionDisposables.add(e.onDidChangeInlayHints(() => {
					M.isScheduled() || M.schedule();
				})));
				this._sessionDisposables.add(N), this._updateHintsDecorators(N.ranges, N.items), this._cacheHintsForFastRestore(O);
			} catch (e) {
				onUnexpectedError(e);
			} finally {
				A.dispose(), k.dispose();
			}
		}, this._debounceInfo.get(O));
		this._sessionDisposables.add(M), this._sessionDisposables.add(toDisposable(() => A?.dispose(!0))), M.schedule(0), this._sessionDisposables.add(this._editor.onDidScrollChange((e) => {
			(e.scrollTopChanged || !M.isScheduled()) && M.schedule();
		})), this._sessionDisposables.add(this._editor.onDidChangeModelContent((e) => {
			A?.cancel();
			let O = Math.max(M.delay, 1250);
			M.schedule(O);
		})), this._sessionDisposables.add(this._installDblClickGesture(() => M.schedule(0))), this._sessionDisposables.add(this._installLinkGesture()), this._sessionDisposables.add(this._installContextMenu());
	}
	_installLinkGesture() {
		let e = new DisposableStore(), O = e.add(new ClickLinkGesture(this._editor)), k = new DisposableStore();
		return e.add(k), e.add(O.onMouseMoveOrRelevantKeyDown((e) => {
			let [O] = e, A = this._getInlayHintLabelPart(O), j = this._editor.getModel();
			if (!A || !j) {
				k.clear();
				return;
			}
			let M = new CancellationTokenSource();
			k.add(toDisposable(() => M.dispose(!0))), A.item.resolve(M.token), this._activeInlayHintPart = A.part.command || A.part.location ? new ActiveInlayHintInfo(A, O.hasTriggerModifier) : void 0;
			let N = j.validatePosition(A.item.hint.position).lineNumber, P = new Range(N, 1, N, j.getLineMaxColumn(N)), F = this._getInlineHintsForRange(P);
			this._updateHintsDecorators([P], F), k.add(toDisposable(() => {
				this._activeInlayHintPart = void 0, this._updateHintsDecorators([P], F);
			}));
		})), e.add(O.onCancel(() => k.clear())), e.add(O.onExecute(async (e) => {
			let O = this._getInlayHintLabelPart(e);
			if (O) {
				let k = O.part;
				k.location ? this._instaService.invokeFunction(goToDefinitionWithLocation, e, this._editor, k.location) : Command.is(k.command) && await this._invokeCommand(k.command, O.item);
			}
		})), e;
	}
	_getInlineHintsForRange(e) {
		let O = /* @__PURE__ */ new Set();
		for (let k of this._decorationsMetadata.values()) e.containsRange(k.item.anchor.range) && O.add(k.item);
		return Array.from(O);
	}
	_installDblClickGesture(e) {
		return this._editor.onMouseUp(async (O) => {
			if (O.event.detail !== 2) return;
			let k = this._getInlayHintLabelPart(O);
			if (k && (O.event.preventDefault(), await k.item.resolve(CancellationToken.None), isNonEmptyArray(k.item.hint.textEdits))) {
				let O = k.item.hint.textEdits.map((e) => EditOperation.replace(Range.lift(e.range), e.text));
				this._editor.executeEdits("inlayHint.default", O), e();
			}
		});
	}
	_installContextMenu() {
		return this._editor.onContextMenu(async (e) => {
			if (!isHTMLElement(e.event.target)) return;
			let O = this._getInlayHintLabelPart(e);
			O && await this._instaService.invokeFunction(showGoToContextMenu, this._editor, e.event.target, O);
		});
	}
	_getInlayHintLabelPart(e) {
		if (e.target.type !== 6) return;
		let O = e.target.detail.injectedText?.options;
		if (O instanceof ModelDecorationInjectedTextOptions && O?.attachedData instanceof RenderedInlayHintLabelPart) return O.attachedData;
	}
	async _invokeCommand(e, O) {
		try {
			await this._commandService.executeCommand(e.id, ...e.arguments ?? []);
		} catch (e) {
			this._notificationService.notify({
				severity: Severity.Error,
				source: O.provider.displayName,
				message: e
			});
		}
	}
	_cacheHintsForFastRestore(e) {
		let O = this._copyInlayHintsWithCurrentAnchor(e);
		this._inlayHintsCache.set(e, O);
	}
	_copyInlayHintsWithCurrentAnchor(e) {
		let O = /* @__PURE__ */ new Map();
		for (let [k, A] of this._decorationsMetadata) {
			if (O.has(A.item)) continue;
			let j = e.getDecorationRange(k);
			if (j) {
				let e = new InlayHintAnchor(j, A.item.anchor.direction), k = A.item.with({ anchor: e });
				O.set(A.item, k);
			}
		}
		return Array.from(O.values());
	}
	_getHintsRanges() {
		let e = this._editor.getModel(), O = this._editor.getVisibleRangesPlusViewportAboveBelow(), k = [];
		for (let A of O.sort(Range.compareRangesUsingStarts)) {
			let O = e.validateRange(new Range(A.startLineNumber - 30, A.startColumn, A.endLineNumber + 30, A.endColumn));
			k.length === 0 || !Range.areIntersectingOrTouching(k[k.length - 1], O) ? k.push(O) : k[k.length - 1] = Range.plusRange(k[k.length - 1], O);
		}
		return k;
	}
	_updateHintsDecorators(e, O) {
		let k = [], A = (e, O, A, j, M) => {
			let N = {
				content: A,
				inlineClassNameAffectsLetterSpacing: !0,
				inlineClassName: O.className,
				cursorStops: j,
				attachedData: M
			};
			k.push({
				item: e,
				classNameRef: O,
				decoration: {
					range: e.anchor.range,
					options: {
						description: "InlayHint",
						showIfCollapsed: e.anchor.range.isEmpty(),
						collapseOnReplaceEdit: !e.anchor.range.isEmpty(),
						stickiness: 0,
						[e.anchor.direction]: this._activeRenderMode === 0 ? N : void 0
					}
				}
			});
		}, j = (e, O) => {
			let k = this._ruleFactory.createClassNameRef({
				width: `${M / 3 | 0}px`,
				display: "inline-block"
			});
			A(e, k, " ", O ? InjectedTextCursorStops.Right : InjectedTextCursorStops.None);
		}, { fontSize: M, fontFamily: N, padding: P, isUniform: F } = this._getLayoutInfo(), I = "--code-editorInlayHintsFontFamily";
		this._editor.getContainerDomNode().style.setProperty(I, N);
		let L = {
			line: 0,
			totalLen: 0
		};
		for (let e of O) {
			if (L.line !== e.anchor.range.startLineNumber && (L = {
				line: e.anchor.range.startLineNumber,
				totalLen: 0
			}), L.totalLen > InlayHintsController_1._MAX_LABEL_LEN) continue;
			e.hint.paddingLeft && j(e, !1);
			let O = typeof e.hint.label == "string" ? [{ label: e.hint.label }] : e.hint.label;
			for (let k = 0; k < O.length; k++) {
				let j = O[k], N = k === 0, R = k === O.length - 1, z = {
					fontSize: `${M}px`,
					fontFamily: `var(${I}), ${EDITOR_FONT_DEFAULTS.fontFamily}`,
					verticalAlign: F ? "baseline" : "middle",
					unicodeBidi: "isolate"
				};
				isNonEmptyArray(e.hint.textEdits) && (z.cursor = "default"), this._fillInColors(z, e.hint), (j.command || j.location) && this._activeInlayHintPart?.part.item === e && this._activeInlayHintPart.part.index === k && (z.textDecoration = "underline", this._activeInlayHintPart.hasTriggerModifier && (z.color = themeColorFromId(editorActiveLinkForeground), z.cursor = "pointer")), P && (N && R ? (z.padding = `1px ${Math.max(1, M / 4) | 0}px`, z.borderRadius = `${M / 4 | 0}px`) : N ? (z.padding = `1px 0 1px ${Math.max(1, M / 4) | 0}px`, z.borderRadius = `${M / 4 | 0}px 0 0 ${M / 4 | 0}px`) : R ? (z.padding = `1px ${Math.max(1, M / 4) | 0}px 1px 0`, z.borderRadius = `0 ${M / 4 | 0}px ${M / 4 | 0}px 0`) : z.padding = "1px 0 1px 0");
				let B = j.label;
				L.totalLen += B.length;
				let V = !1, H = L.totalLen - InlayHintsController_1._MAX_LABEL_LEN;
				if (H > 0 && (B = B.slice(0, -H) + "…", V = !0), A(e, this._ruleFactory.createClassNameRef(z), fixSpace(B), R && !e.hint.paddingRight ? InjectedTextCursorStops.Right : InjectedTextCursorStops.None, new RenderedInlayHintLabelPart(e, k)), V) break;
			}
			if (e.hint.paddingRight && j(e, !0), k.length > InlayHintsController_1._MAX_DECORATORS) break;
		}
		let R = [];
		for (let [O, k] of this._decorationsMetadata) {
			let A = this._editor.getModel()?.getDecorationRange(O);
			A && e.some((e) => e.containsRange(A)) && (R.push(O), k.classNameRef.dispose(), this._decorationsMetadata.delete(O));
		}
		let z = StableEditorScrollState.capture(this._editor);
		this._editor.changeDecorations((e) => {
			let O = e.deltaDecorations(R, k.map((e) => e.decoration));
			for (let e = 0; e < O.length; e++) {
				let A = k[e];
				this._decorationsMetadata.set(O[e], A);
			}
		}), z.restore(this._editor);
	}
	_fillInColors(e, O) {
		O.kind === InlayHintKind.Parameter ? (e.backgroundColor = themeColorFromId(editorInlayHintParameterBackground), e.color = themeColorFromId(editorInlayHintParameterForeground)) : O.kind === InlayHintKind.Type ? (e.backgroundColor = themeColorFromId(editorInlayHintTypeBackground), e.color = themeColorFromId(editorInlayHintTypeForeground)) : (e.backgroundColor = themeColorFromId(editorInlayHintBackground), e.color = themeColorFromId(editorInlayHintForeground));
	}
	_getLayoutInfo() {
		let e = this._editor.getOption(142), O = e.padding, k = this._editor.getOption(52), A = this._editor.getOption(49), j = e.fontSize;
		(!j || j < 5 || j > k) && (j = k);
		let M = e.fontFamily || A;
		return {
			fontSize: j,
			fontFamily: M,
			padding: O,
			isUniform: !O && M === A && j === k
		};
	}
	_removeAllDecorations() {
		this._editor.removeDecorations(Array.from(this._decorationsMetadata.keys()));
		for (let e of this._decorationsMetadata.values()) e.classNameRef.dispose();
		this._decorationsMetadata.clear();
	}
};
InlayHintsController = InlayHintsController_1 = __decorate$76([
	__param$76(1, ILanguageFeaturesService),
	__param$76(2, ILanguageFeatureDebounceService),
	__param$76(3, IInlayHintsCache),
	__param$76(4, ICommandService),
	__param$76(5, INotificationService),
	__param$76(6, IInstantiationService)
], InlayHintsController);
function fixSpace(e) {
	return e.replace(/[ \t]/g, "\xA0");
}
CommandsRegistry.registerCommand("_executeInlayHintProvider", async (e, ...O) => {
	let [k, A] = O;
	assertType(URI.isUri(k)), assertType(Range.isIRange(A));
	let { inlayHintsProvider: j } = e.get(ILanguageFeaturesService), M = await e.get(ITextModelService).createModelReference(k);
	try {
		let e = await InlayHintsFragments.create(j, M.object.textEditorModel, [Range.lift(A)], CancellationToken.None), O = e.items.map((e) => e.hint);
		return setTimeout(() => e.dispose(), 0), O;
	} finally {
		M.dispose();
	}
});
var __decorate$75 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$75 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, InlayHintsHoverAnchor = class extends HoverForeignElementAnchor {
	constructor(e, O, k, A) {
		super(10, O, e.item.anchor.range, k, A, !0), this.part = e;
	}
}, InlayHintsHover = class extends MarkdownHoverParticipant {
	constructor(e, O, k, A, j, M, N, P, F) {
		super(e, O, k, M, P, A, j, F), this._resolverService = N, this.hoverOrdinal = 6;
	}
	suggestHoverAnchor(e) {
		if (!InlayHintsController.get(this._editor) || e.target.type !== 6) return null;
		let O = e.target.detail.injectedText?.options;
		return O instanceof ModelDecorationInjectedTextOptions && O.attachedData instanceof RenderedInlayHintLabelPart ? new InlayHintsHoverAnchor(O.attachedData, this, e.event.posx, e.event.posy) : null;
	}
	computeSync() {
		return [];
	}
	computeAsync(e, O, k) {
		return e instanceof InlayHintsHoverAnchor ? new AsyncIterableObject(async (O) => {
			let { part: A } = e;
			if (await A.item.resolve(k), k.isCancellationRequested) return;
			let j;
			typeof A.item.hint.tooltip == "string" ? j = new MarkdownString().appendText(A.item.hint.tooltip) : A.item.hint.tooltip && (j = A.item.hint.tooltip), j && O.emitOne(new MarkdownHover(this, e.range, [j], !1, 0)), isNonEmptyArray(A.item.hint.textEdits) && O.emitOne(new MarkdownHover(this, e.range, [new MarkdownString().appendText(localize("hint.dbl", "Double-click to insert"))], !1, 10001));
			let M;
			if (typeof A.part.tooltip == "string" ? M = new MarkdownString().appendText(A.part.tooltip) : A.part.tooltip && (M = A.part.tooltip), M && O.emitOne(new MarkdownHover(this, e.range, [M], !1, 1)), A.part.location || A.part.command) {
				let k, j = this._editor.getOption(78) === "altKey" ? isMacintosh ? localize("links.navigate.kb.meta.mac", "cmd + click") : localize("links.navigate.kb.meta", "ctrl + click") : isMacintosh ? localize("links.navigate.kb.alt.mac", "option + click") : localize("links.navigate.kb.alt", "alt + click");
				A.part.location && A.part.command ? k = new MarkdownString().appendText(localize("hint.defAndCommand", "Go to Definition ({0}), right click for more", j)) : A.part.location ? k = new MarkdownString().appendText(localize("hint.def", "Go to Definition ({0})", j)) : A.part.command && (k = new MarkdownString(`[${localize("hint.cmd", "Execute Command")}](${asCommandLink(A.part.command)} "${A.part.command.title}") (${j})`, { isTrusted: !0 })), k && O.emitOne(new MarkdownHover(this, e.range, [k], !1, 1e4));
			}
			let N = await this._resolveInlayHintLabelPartHover(A, k);
			for await (let e of N) O.emitOne(e);
		}) : AsyncIterableObject.EMPTY;
	}
	async _resolveInlayHintLabelPartHover(e, O) {
		if (!e.part.location) return AsyncIterableObject.EMPTY;
		let { uri: k, range: A } = e.part.location, j = await this._resolverService.createModelReference(k);
		try {
			let k = j.object.textEditorModel;
			return this._languageFeaturesService.hoverProvider.has(k) ? getHoverProviderResultsAsAsyncIterable(this._languageFeaturesService.hoverProvider, k, new Position(A.startLineNumber, A.startColumn), O).filter((e) => !isEmptyMarkdownString(e.hover.contents)).map((O) => new MarkdownHover(this, e.item.anchor.range, O.hover.contents, !1, 2 + O.ordinal)) : AsyncIterableObject.EMPTY;
		} finally {
			j.dispose();
		}
	}
};
InlayHintsHover = __decorate$75([
	__param$75(1, ILanguageService),
	__param$75(2, IOpenerService),
	__param$75(3, IKeybindingService),
	__param$75(4, IHoverService),
	__param$75(5, IConfigurationService),
	__param$75(6, ITextModelService),
	__param$75(7, ILanguageFeaturesService),
	__param$75(8, ICommandService)
], InlayHintsHover);
var RenderedContentHover = class e extends Disposable {
	constructor(O, k, A, j, M, N) {
		super();
		let P = k.anchor, F = k.hoverParts;
		this._renderedHoverParts = this._register(new RenderedContentHoverParts(O, A, F, N, M));
		let { showAtPosition: I, showAtSecondaryPosition: L } = e.computeHoverPositions(O, P.range, F);
		this.shouldAppearBeforeContent = F.some((e) => e.isBeforeContent), this.showAtPosition = I, this.showAtSecondaryPosition = L, this.initialMousePosX = P.initialMousePosX, this.initialMousePosY = P.initialMousePosY, this.shouldFocus = j.shouldFocus, this.source = j.source;
	}
	get domNode() {
		return this._renderedHoverParts.domNode;
	}
	get domNodeHasChildren() {
		return this._renderedHoverParts.domNodeHasChildren;
	}
	get focusedHoverPartIndex() {
		return this._renderedHoverParts.focusedHoverPartIndex;
	}
	async updateHoverVerbosityLevel(e, O, k) {
		this._renderedHoverParts.updateHoverVerbosityLevel(e, O, k);
	}
	isColorPickerVisible() {
		return this._renderedHoverParts.isColorPickerVisible();
	}
	static computeHoverPositions(e, O, k) {
		let A = 1;
		if (e.hasModel()) {
			let k = e._getViewModel(), j = k.coordinatesConverter, M = j.convertModelRangeToViewRange(O), N = k.getLineMinColumn(M.startLineNumber), P = new Position(M.startLineNumber, N);
			A = j.convertViewPositionToModelPosition(P).column;
		}
		let j = O.startLineNumber, M = O.startColumn, N;
		for (let e of k) {
			let O = e.range, k = O.startLineNumber === j, P = O.endLineNumber === j;
			if (k && P) {
				let e = O.startColumn, k = Math.min(M, e);
				M = Math.max(k, A);
			}
			e.forceShowAtRange && (N = O);
		}
		let P, F;
		if (N) {
			let e = N.getStartPosition();
			P = e, F = e;
		} else P = O.getStartPosition(), F = new Position(j, M);
		return {
			showAtPosition: P,
			showAtSecondaryPosition: F
		};
	}
}, RenderedStatusBar = class {
	constructor(e, O) {
		this._statusBar = O, e.appendChild(this._statusBar.hoverElement);
	}
	get hoverElement() {
		return this._statusBar.hoverElement;
	}
	get actions() {
		return this._statusBar.actions;
	}
	dispose() {
		this._statusBar.dispose();
	}
}, RenderedContentHoverParts = class e extends Disposable {
	static {
		this._DECORATION_OPTIONS = ModelDecorationOptions.register({
			description: "content-hover-highlight",
			className: "hoverHighlight"
		});
	}
	constructor(e, O, k, A, j) {
		super(), this._renderedParts = [], this._focusedHoverPartIndex = -1, this._context = j, this._fragment = document.createDocumentFragment(), this._register(this._renderParts(O, k, j, A)), this._register(this._registerListenersOnRenderedParts()), this._register(this._createEditorDecorations(e, k)), this._updateMarkdownAndColorParticipantInfo(O);
	}
	_createEditorDecorations(O, k) {
		if (k.length === 0) return Disposable.None;
		let A = k[0].range;
		for (let e of k) {
			let O = e.range;
			A = Range.plusRange(A, O);
		}
		let j = O.createDecorationsCollection();
		return j.set([{
			range: A,
			options: e._DECORATION_OPTIONS
		}]), toDisposable(() => {
			j.clear();
		});
	}
	_renderParts(e, O, k, A) {
		let j = new EditorHoverStatusBar(A), M = {
			fragment: this._fragment,
			statusBar: j,
			...k
		}, N = new DisposableStore();
		for (let k of e) {
			let e = this._renderHoverPartsForParticipant(O, k, M);
			N.add(e);
			for (let O of e.renderedHoverParts) this._renderedParts.push({
				type: "hoverPart",
				participant: k,
				hoverPart: O.hoverPart,
				hoverElement: O.hoverElement
			});
		}
		let P = this._renderStatusBar(this._fragment, j);
		return P && (N.add(P), this._renderedParts.push({
			type: "statusBar",
			hoverElement: P.hoverElement,
			actions: P.actions
		})), toDisposable(() => {
			N.dispose();
		});
	}
	_renderHoverPartsForParticipant(e, O, k) {
		let A = e.filter((e) => e.owner === O);
		return A.length > 0 ? O.renderHoverParts(k, A) : new RenderedHoverParts([]);
	}
	_renderStatusBar(e, O) {
		if (O.hasContent) return new RenderedStatusBar(e, O);
	}
	_registerListenersOnRenderedParts() {
		let e = new DisposableStore();
		return this._renderedParts.forEach((O, k) => {
			let A = O.hoverElement;
			A.tabIndex = 0, e.add(addDisposableListener(A, EventType$1.FOCUS_IN, (e) => {
				e.stopPropagation(), this._focusedHoverPartIndex = k;
			})), e.add(addDisposableListener(A, EventType$1.FOCUS_OUT, (e) => {
				e.stopPropagation(), this._focusedHoverPartIndex = -1;
			}));
		}), e;
	}
	_updateMarkdownAndColorParticipantInfo(e) {
		let O = e.find((e) => e instanceof MarkdownHoverParticipant && !(e instanceof InlayHintsHover));
		O && (this._markdownHoverParticipant = O), this._colorHoverParticipant = e.find((e) => e instanceof ColorHoverParticipant);
	}
	async updateHoverVerbosityLevel(e, O, k) {
		if (!this._markdownHoverParticipant) return;
		let A = this._normalizedIndexToMarkdownHoverIndexRange(this._markdownHoverParticipant, O);
		if (A === void 0) return;
		let j = await this._markdownHoverParticipant.updateMarkdownHoverVerbosityLevel(e, A, k);
		j && (this._renderedParts[O] = {
			type: "hoverPart",
			participant: this._markdownHoverParticipant,
			hoverPart: j.hoverPart,
			hoverElement: j.hoverElement
		}, this._context.onContentsChanged());
	}
	isColorPickerVisible() {
		return this._colorHoverParticipant?.isColorPickerVisible() ?? !1;
	}
	_normalizedIndexToMarkdownHoverIndexRange(e, O) {
		let k = this._renderedParts[O];
		if (!k || k.type !== "hoverPart" || k.participant !== e) return;
		let A = this._renderedParts.findIndex((O) => O.type === "hoverPart" && O.participant === e);
		if (A === -1) throw new BugIndicatingError();
		return O - A;
	}
	get domNode() {
		return this._fragment;
	}
	get domNodeHasChildren() {
		return this._fragment.hasChildNodes();
	}
	get focusedHoverPartIndex() {
		return this._focusedHoverPartIndex;
	}
}, __decorate$74 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$74 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, ContentHoverWidgetWrapper = class extends Disposable {
	constructor(e, O, k) {
		super(), this._editor = e, this._instantiationService = O, this._keybindingService = k, this._currentResult = null, this._onContentsChanged = this._register(new Emitter()), this.onContentsChanged = this._onContentsChanged.event, this._contentHoverWidget = this._register(this._instantiationService.createInstance(ContentHoverWidget, this._editor)), this._participants = this._initializeHoverParticipants(), this._computer = new ContentHoverComputer(this._editor, this._participants), this._hoverOperation = this._register(new HoverOperation(this._editor, this._computer)), this._registerListeners();
	}
	_initializeHoverParticipants() {
		let e = [];
		for (let O of HoverParticipantRegistry.getAll()) {
			let k = this._instantiationService.createInstance(O, this._editor);
			e.push(k);
		}
		return e.sort((e, O) => e.hoverOrdinal - O.hoverOrdinal), this._register(this._contentHoverWidget.onDidResize(() => {
			this._participants.forEach((e) => e.handleResize?.());
		})), e;
	}
	_registerListeners() {
		this._register(this._hoverOperation.onResult((e) => {
			if (!this._computer.anchor) return;
			let O = e.hasLoadingMessage ? this._addLoadingMessage(e.value) : e.value;
			this._withResult(new HoverResult(this._computer.anchor, O, e.isComplete));
		}));
		let e = this._contentHoverWidget.getDomNode();
		this._register(addStandardDisposableListener(e, "keydown", (e) => {
			e.equals(9) && this.hide();
		})), this._register(addStandardDisposableListener(e, "mouseleave", (e) => {
			this._onMouseLeave(e);
		})), this._register(TokenizationRegistry.onDidChange(() => {
			this._contentHoverWidget.position && this._currentResult && this._setCurrentResult(this._currentResult);
		}));
	}
	_startShowingOrUpdateHover(e, O, k, A, j) {
		if (!(this._contentHoverWidget.position && this._currentResult)) return e ? (this._startHoverOperationIfNecessary(e, O, k, A, !1), !0) : !1;
		let M = this._editor.getOption(60).sticky, N = j && this._contentHoverWidget.isMouseGettingCloser(j.event.posx, j.event.posy);
		return M && N ? (e && this._startHoverOperationIfNecessary(e, O, k, A, !0), !0) : e ? this._currentResult.anchor.equals(e) ? !0 : e.canAdoptVisibleHover(this._currentResult.anchor, this._contentHoverWidget.position) ? (this._setCurrentResult(this._currentResult.filter(e)), this._startHoverOperationIfNecessary(e, O, k, A, !1), !0) : (this._setCurrentResult(null), this._startHoverOperationIfNecessary(e, O, k, A, !1), !0) : (this._setCurrentResult(null), !1);
	}
	_startHoverOperationIfNecessary(e, O, k, A, j) {
		this._computer.anchor && this._computer.anchor.equals(e) || (this._hoverOperation.cancel(), this._computer.anchor = e, this._computer.shouldFocus = A, this._computer.source = k, this._computer.insistOnKeepingHoverVisible = j, this._hoverOperation.start(O));
	}
	_setCurrentResult(e) {
		let O = e;
		this._currentResult !== O && (O && O.hoverParts.length === 0 && (O = null), this._currentResult = O, this._currentResult ? this._showHover(this._currentResult) : this._hideHover());
	}
	_addLoadingMessage(e) {
		if (!this._computer.anchor) return e;
		for (let O of this._participants) {
			if (!O.createLoadingMessage) continue;
			let k = O.createLoadingMessage(this._computer.anchor);
			if (k) return e.slice(0).concat([k]);
		}
		return e;
	}
	_withResult(e) {
		if (this._contentHoverWidget.position && this._currentResult && this._currentResult.isComplete || this._setCurrentResult(e), !e.isComplete) return;
		let O = e.hoverParts.length === 0, k = this._computer.insistOnKeepingHoverVisible;
		O && k || this._setCurrentResult(e);
	}
	_showHover(e) {
		let O = this._getHoverContext();
		this._renderedContentHover = new RenderedContentHover(this._editor, e, this._participants, this._computer, O, this._keybindingService), this._renderedContentHover.domNodeHasChildren ? this._contentHoverWidget.show(this._renderedContentHover) : this._renderedContentHover.dispose();
	}
	_hideHover() {
		this._contentHoverWidget.hide();
	}
	_getHoverContext() {
		return {
			hide: () => {
				this.hide();
			},
			onContentsChanged: () => {
				this._onContentsChanged.fire(), this._contentHoverWidget.onContentsChanged();
			},
			setMinimumDimensions: (e) => {
				this._contentHoverWidget.setMinimumDimensions(e);
			}
		};
	}
	showsOrWillShow(e) {
		if (this._contentHoverWidget.isResizing) return !0;
		let O = this._findHoverAnchorCandidates(e);
		if (!(O.length > 0)) return this._startShowingOrUpdateHover(null, 0, 0, !1, e);
		let k = O[0];
		return this._startShowingOrUpdateHover(k, 0, 0, !1, e);
	}
	_findHoverAnchorCandidates(e) {
		let O = [];
		for (let k of this._participants) {
			if (!k.suggestHoverAnchor) continue;
			let A = k.suggestHoverAnchor(e);
			A && O.push(A);
		}
		let k = e.target;
		switch (k.type) {
			case 6:
				O.push(new HoverRangeAnchor(0, k.range, e.event.posx, e.event.posy));
				break;
			case 7: {
				let A = this._editor.getOption(50).typicalHalfwidthCharacterWidth / 2;
				if (!(!k.detail.isAfterLines && typeof k.detail.horizontalDistanceToText == "number" && k.detail.horizontalDistanceToText < A)) break;
				O.push(new HoverRangeAnchor(0, k.range, e.event.posx, e.event.posy));
				break;
			}
		}
		return O.sort((e, O) => O.priority - e.priority), O;
	}
	_onMouseLeave(e) {
		let O = this._editor.getDomNode();
		(!O || !isMousePositionWithinElement(O, e.x, e.y)) && this.hide();
	}
	startShowingAtRange(e, O, k, A) {
		this._startShowingOrUpdateHover(new HoverRangeAnchor(0, e, void 0, void 0), O, k, A, null);
	}
	async updateHoverVerbosityLevel(e, O, k) {
		this._renderedContentHover?.updateHoverVerbosityLevel(e, O, k);
	}
	focusedHoverPartIndex() {
		return this._renderedContentHover?.focusedHoverPartIndex ?? -1;
	}
	containsNode(e) {
		return e ? this._contentHoverWidget.getDomNode().contains(e) : !1;
	}
	focus() {
		this._contentHoverWidget.focus();
	}
	scrollUp() {
		this._contentHoverWidget.scrollUp();
	}
	scrollDown() {
		this._contentHoverWidget.scrollDown();
	}
	scrollLeft() {
		this._contentHoverWidget.scrollLeft();
	}
	scrollRight() {
		this._contentHoverWidget.scrollRight();
	}
	pageUp() {
		this._contentHoverWidget.pageUp();
	}
	pageDown() {
		this._contentHoverWidget.pageDown();
	}
	goToTop() {
		this._contentHoverWidget.goToTop();
	}
	goToBottom() {
		this._contentHoverWidget.goToBottom();
	}
	hide() {
		this._computer.anchor = null, this._hoverOperation.cancel(), this._setCurrentResult(null);
	}
	getDomNode() {
		return this._contentHoverWidget.getDomNode();
	}
	get isColorPickerVisible() {
		return this._renderedContentHover?.isColorPickerVisible() ?? !1;
	}
	get isVisibleFromKeyboard() {
		return this._contentHoverWidget.isVisibleFromKeyboard;
	}
	get isVisible() {
		return this._contentHoverWidget.isVisible;
	}
	get isFocused() {
		return this._contentHoverWidget.isFocused;
	}
	get isResizing() {
		return this._contentHoverWidget.isResizing;
	}
	get widget() {
		return this._contentHoverWidget;
	}
};
ContentHoverWidgetWrapper = __decorate$74([__param$74(1, IInstantiationService), __param$74(2, IKeybindingService)], ContentHoverWidgetWrapper);
var __decorate$73 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$73 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, ContentHoverController_1, ContentHoverController = class extends Disposable {
	static {
		ContentHoverController_1 = this;
	}
	static {
		this.ID = "editor.contrib.contentHover";
	}
	constructor(e, O, k) {
		super(), this._editor = e, this._instantiationService = O, this._keybindingService = k, this._onHoverContentsChanged = this._register(new Emitter()), this.shouldKeepOpenOnEditorMouseMoveOrLeave = !1, this._listenersStore = new DisposableStore(), this._hoverState = {
			mouseDown: !1,
			activatedByDecoratorClick: !1
		}, this._reactToEditorMouseMoveRunner = this._register(new RunOnceScheduler(() => this._reactToEditorMouseMove(this._mouseMoveEvent), 0)), this._hookListeners(), this._register(this._editor.onDidChangeConfiguration((e) => {
			e.hasChanged(60) && (this._unhookListeners(), this._hookListeners());
		}));
	}
	static get(e) {
		return e.getContribution(ContentHoverController_1.ID);
	}
	_hookListeners() {
		let e = this._editor.getOption(60);
		this._hoverSettings = {
			enabled: e.enabled,
			sticky: e.sticky,
			hidingDelay: e.hidingDelay
		}, e.enabled ? (this._listenersStore.add(this._editor.onMouseDown((e) => this._onEditorMouseDown(e))), this._listenersStore.add(this._editor.onMouseUp(() => this._onEditorMouseUp())), this._listenersStore.add(this._editor.onMouseMove((e) => this._onEditorMouseMove(e))), this._listenersStore.add(this._editor.onKeyDown((e) => this._onKeyDown(e)))) : (this._listenersStore.add(this._editor.onMouseMove((e) => this._onEditorMouseMove(e))), this._listenersStore.add(this._editor.onKeyDown((e) => this._onKeyDown(e)))), this._listenersStore.add(this._editor.onMouseLeave((e) => this._onEditorMouseLeave(e))), this._listenersStore.add(this._editor.onDidChangeModel(() => {
			this._cancelScheduler(), this._hideWidgets();
		})), this._listenersStore.add(this._editor.onDidChangeModelContent(() => this._cancelScheduler())), this._listenersStore.add(this._editor.onDidScrollChange((e) => this._onEditorScrollChanged(e)));
	}
	_unhookListeners() {
		this._listenersStore.clear();
	}
	_cancelScheduler() {
		this._mouseMoveEvent = void 0, this._reactToEditorMouseMoveRunner.cancel();
	}
	_onEditorScrollChanged(e) {
		(e.scrollTopChanged || e.scrollLeftChanged) && this._hideWidgets();
	}
	_onEditorMouseDown(e) {
		this._hoverState.mouseDown = !0, !this._shouldNotHideCurrentHoverWidget(e) && this._hideWidgets();
	}
	_shouldNotHideCurrentHoverWidget(e) {
		return this._isMouseOnContentHoverWidget(e) || this._isContentWidgetResizing();
	}
	_isMouseOnContentHoverWidget(e) {
		let O = this._contentWidget?.getDomNode();
		return O ? isMousePositionWithinElement(O, e.event.posx, e.event.posy) : !1;
	}
	_onEditorMouseUp() {
		this._hoverState.mouseDown = !1;
	}
	_onEditorMouseLeave(e) {
		this.shouldKeepOpenOnEditorMouseMoveOrLeave || (this._cancelScheduler(), !this._shouldNotHideCurrentHoverWidget(e) && this._hideWidgets());
	}
	_shouldNotRecomputeCurrentHoverWidget(e) {
		let O = this._hoverSettings.sticky;
		return ((e, O) => {
			let k = this._isMouseOnContentHoverWidget(e);
			return O && k;
		})(e, O) || ((e) => {
			let O = this._isMouseOnContentHoverWidget(e), k = this._contentWidget?.isColorPickerVisible ?? !1;
			return O && k;
		})(e) || ((e, O) => (O && this._contentWidget?.containsNode(e.event.browserEvent.view?.document.activeElement) && !e.event.browserEvent.view?.getSelection()?.isCollapsed) ?? !1)(e, O);
	}
	_onEditorMouseMove(e) {
		if (this.shouldKeepOpenOnEditorMouseMoveOrLeave || (this._mouseMoveEvent = e, this._contentWidget?.isFocused || this._contentWidget?.isResizing)) return;
		let O = this._hoverSettings.sticky;
		if (O && this._contentWidget?.isVisibleFromKeyboard) return;
		if (this._shouldNotRecomputeCurrentHoverWidget(e)) {
			this._reactToEditorMouseMoveRunner.cancel();
			return;
		}
		let k = this._hoverSettings.hidingDelay;
		if (this._contentWidget?.isVisible && O && k > 0) {
			this._reactToEditorMouseMoveRunner.isScheduled() || this._reactToEditorMouseMoveRunner.schedule(k);
			return;
		}
		this._reactToEditorMouseMove(e);
	}
	_reactToEditorMouseMove(e) {
		if (!e) return;
		let O = e.target.element?.classList.contains("colorpicker-color-decoration"), k = this._editor.getOption(149), A = this._hoverSettings.enabled, j = this._hoverState.activatedByDecoratorClick;
		if (O && (k === "click" && !j || k === "hover" && !A || k === "clickAndHover" && !A && !j) || !O && !A && !j) {
			this._hideWidgets();
			return;
		}
		this._tryShowHoverWidget(e) || this._hideWidgets();
	}
	_tryShowHoverWidget(e) {
		return this._getOrCreateContentWidget().showsOrWillShow(e);
	}
	_onKeyDown(e) {
		if (!this._editor.hasModel()) return;
		let O = this._keybindingService.softDispatch(e, this._editor.getDomNode()), k = O.kind === 1 || O.kind === 2 && (O.commandId === "editor.action.showHover" || O.commandId === "editor.action.increaseHoverVerbosityLevel" || O.commandId === "editor.action.decreaseHoverVerbosityLevel") && this._contentWidget?.isVisible;
		e.keyCode === 5 || e.keyCode === 6 || e.keyCode === 57 || e.keyCode === 4 || k || this._hideWidgets();
	}
	_hideWidgets() {
		this._hoverState.mouseDown && this._contentWidget?.isColorPickerVisible || InlineSuggestionHintsContentWidget.dropDownVisible || (this._hoverState.activatedByDecoratorClick = !1, this._contentWidget?.hide());
	}
	_getOrCreateContentWidget() {
		return this._contentWidget || (this._contentWidget = this._instantiationService.createInstance(ContentHoverWidgetWrapper, this._editor), this._listenersStore.add(this._contentWidget.onContentsChanged(() => this._onHoverContentsChanged.fire()))), this._contentWidget;
	}
	showContentHover(e, O, k, A, j = !1) {
		this._hoverState.activatedByDecoratorClick = j, this._getOrCreateContentWidget().startShowingAtRange(e, O, k, A);
	}
	_isContentWidgetResizing() {
		return this._contentWidget?.widget.isResizing || !1;
	}
	focusedHoverPartIndex() {
		return this._getOrCreateContentWidget().focusedHoverPartIndex();
	}
	updateHoverVerbosityLevel(e, O, k) {
		this._getOrCreateContentWidget().updateHoverVerbosityLevel(e, O, k);
	}
	focus() {
		this._contentWidget?.focus();
	}
	scrollUp() {
		this._contentWidget?.scrollUp();
	}
	scrollDown() {
		this._contentWidget?.scrollDown();
	}
	scrollLeft() {
		this._contentWidget?.scrollLeft();
	}
	scrollRight() {
		this._contentWidget?.scrollRight();
	}
	pageUp() {
		this._contentWidget?.pageUp();
	}
	pageDown() {
		this._contentWidget?.pageDown();
	}
	goToTop() {
		this._contentWidget?.goToTop();
	}
	goToBottom() {
		this._contentWidget?.goToBottom();
	}
	get isColorPickerVisible() {
		return this._contentWidget?.isColorPickerVisible;
	}
	get isHoverVisible() {
		return this._contentWidget?.isVisible;
	}
	dispose() {
		super.dispose(), this._unhookListeners(), this._listenersStore.dispose(), this._contentWidget?.dispose();
	}
};
ContentHoverController = ContentHoverController_1 = __decorate$73([__param$73(1, IInstantiationService), __param$73(2, IKeybindingService)], ContentHoverController);
var ColorContribution = class extends Disposable {
	static {
		this.ID = "editor.contrib.colorContribution";
	}
	constructor(e) {
		super(), this._editor = e, this._register(e.onMouseDown((e) => this.onMouseDown(e)));
	}
	dispose() {
		super.dispose();
	}
	onMouseDown(e) {
		let O = this._editor.getOption(149);
		if (O !== "click" && O !== "clickAndHover") return;
		let k = e.target;
		if (k.type !== 6 || !k.detail.injectedText || k.detail.injectedText.options.attachedData !== ColorDecorationInjectedTextMarker || !k.range) return;
		let A = this._editor.getContribution(ContentHoverController.ID);
		if (A && !A.isColorPickerVisible) {
			let e = new Range(k.range.startLineNumber, k.range.startColumn + 1, k.range.endLineNumber, k.range.endColumn + 1);
			A.showContentHover(e, 1, 0, !1, !0);
		}
	}
};
registerEditorContribution(ColorContribution.ID, ColorContribution, 2), HoverParticipantRegistry.register(ColorHoverParticipant);
var __decorate$72 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$72 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, StandaloneColorPickerController_1, StandaloneColorPickerWidget_1, StandaloneColorPickerController = class extends Disposable {
	static {
		StandaloneColorPickerController_1 = this;
	}
	static {
		this.ID = "editor.contrib.standaloneColorPickerController";
	}
	constructor(e, O, k) {
		super(), this._editor = e, this._instantiationService = k, this._standaloneColorPickerWidget = null, this._standaloneColorPickerVisible = EditorContextKeys.standaloneColorPickerVisible.bindTo(O), this._standaloneColorPickerFocused = EditorContextKeys.standaloneColorPickerFocused.bindTo(O);
	}
	showOrFocus() {
		this._editor.hasModel() && (this._standaloneColorPickerVisible.get() ? this._standaloneColorPickerFocused.get() || this._standaloneColorPickerWidget?.focus() : this._standaloneColorPickerWidget = this._instantiationService.createInstance(StandaloneColorPickerWidget, this._editor, this._standaloneColorPickerVisible, this._standaloneColorPickerFocused));
	}
	hide() {
		this._standaloneColorPickerFocused.set(!1), this._standaloneColorPickerVisible.set(!1), this._standaloneColorPickerWidget?.hide(), this._editor.focus();
	}
	insertColor() {
		this._standaloneColorPickerWidget?.updateEditor(), this.hide();
	}
	static get(e) {
		return e.getContribution(StandaloneColorPickerController_1.ID);
	}
};
StandaloneColorPickerController = StandaloneColorPickerController_1 = __decorate$72([__param$72(1, IContextKeyService), __param$72(2, IInstantiationService)], StandaloneColorPickerController), registerEditorContribution(StandaloneColorPickerController.ID, StandaloneColorPickerController, 1);
var PADDING = 8, CLOSE_BUTTON_WIDTH = 22, StandaloneColorPickerWidget = class extends Disposable {
	static {
		StandaloneColorPickerWidget_1 = this;
	}
	static {
		this.ID = "editor.contrib.standaloneColorPickerWidget";
	}
	constructor(e, O, k, A, j, M, N) {
		super(), this._editor = e, this._standaloneColorPickerVisible = O, this._standaloneColorPickerFocused = k, this._keybindingService = j, this._languageFeaturesService = M, this._editorWorkerService = N, this.allowEditorOverflow = !0, this._position = void 0, this._body = document.createElement("div"), this._colorHover = null, this._selectionSetInEditor = !1, this._onResult = this._register(new Emitter()), this.onResult = this._onResult.event, this._standaloneColorPickerVisible.set(!0), this._standaloneColorPickerParticipant = A.createInstance(StandaloneColorPickerParticipant, this._editor), this._position = this._editor._getViewModel()?.getPrimaryCursorState().modelState.position;
		let P = this._editor.getSelection(), F = P ? {
			startLineNumber: P.startLineNumber,
			startColumn: P.startColumn,
			endLineNumber: P.endLineNumber,
			endColumn: P.endColumn
		} : {
			startLineNumber: 0,
			endLineNumber: 0,
			endColumn: 0,
			startColumn: 0
		}, I = this._register(trackFocus(this._body));
		this._register(I.onDidBlur((e) => {
			this.hide();
		})), this._register(I.onDidFocus((e) => {
			this.focus();
		})), this._register(this._editor.onDidChangeCursorPosition(() => {
			this._selectionSetInEditor ? this._selectionSetInEditor = !1 : this.hide();
		})), this._register(this._editor.onMouseMove((e) => {
			let O = e.target.element?.classList;
			O && O.contains("colorpicker-color-decoration") && this.hide();
		})), this._register(this.onResult((e) => {
			this._render(e.value, e.foundInEditor);
		})), this._start(F), this._body.style.zIndex = "50", this._editor.addContentWidget(this);
	}
	updateEditor() {
		this._colorHover && this._standaloneColorPickerParticipant.updateEditorModel(this._colorHover);
	}
	getId() {
		return StandaloneColorPickerWidget_1.ID;
	}
	getDomNode() {
		return this._body;
	}
	getPosition() {
		if (!this._position) return null;
		let e = this._editor.getOption(60).above;
		return {
			position: this._position,
			secondaryPosition: this._position,
			preference: e ? [1, 2] : [2, 1],
			positionAffinity: 2
		};
	}
	hide() {
		this.dispose(), this._standaloneColorPickerVisible.set(!1), this._standaloneColorPickerFocused.set(!1), this._editor.removeContentWidget(this), this._editor.focus();
	}
	focus() {
		this._standaloneColorPickerFocused.set(!0), this._body.focus();
	}
	async _start(e) {
		let O = await this._computeAsync(e);
		O && this._onResult.fire(new StandaloneColorPickerResult(O.result, O.foundInEditor));
	}
	async _computeAsync(e) {
		if (!this._editor.hasModel()) return null;
		let O = {
			range: e,
			color: {
				red: 0,
				green: 0,
				blue: 0,
				alpha: 1
			}
		}, k = await this._standaloneColorPickerParticipant.createColorHover(O, new DefaultDocumentColorProvider(this._editorWorkerService), this._languageFeaturesService.colorProvider);
		return k ? {
			result: k.colorHover,
			foundInEditor: k.foundInEditor
		} : null;
	}
	_render(e, O) {
		let k = document.createDocumentFragment(), A = this._register(new EditorHoverStatusBar(this._keybindingService)), j = {
			fragment: k,
			statusBar: A,
			onContentsChanged: () => {},
			hide: () => this.hide()
		};
		this._colorHover = e;
		let M = this._standaloneColorPickerParticipant.renderHoverParts(j, [e]);
		if (!M) return;
		this._register(M.disposables);
		let N = M.colorPicker;
		this._body.classList.add("standalone-colorpicker-body"), this._body.style.maxHeight = Math.max(this._editor.getLayoutInfo().height / 4, 250) + "px", this._body.style.maxWidth = Math.max(this._editor.getLayoutInfo().width * .66, 500) + "px", this._body.tabIndex = 0, this._body.appendChild(k), N.layout();
		let P = N.body, F = P.saturationBox.domNode.clientWidth, I = P.domNode.clientWidth - F - CLOSE_BUTTON_WIDTH - PADDING, L = N.body.enterButton;
		L?.onClicked(() => {
			this.updateEditor(), this.hide();
		});
		let R = N.header, z = R.pickedColorNode;
		z.style.width = F + PADDING + "px";
		let B = R.originalColorNode;
		B.style.width = I + "px", N.header.closeButton?.onClicked(() => {
			this.hide();
		}), O && (L && (L.button.textContent = "Replace"), this._selectionSetInEditor = !0, this._editor.setSelection(e.range)), this._editor.layoutContentWidget(this);
	}
};
StandaloneColorPickerWidget = StandaloneColorPickerWidget_1 = __decorate$72([
	__param$72(3, IInstantiationService),
	__param$72(4, IKeybindingService),
	__param$72(5, ILanguageFeaturesService),
	__param$72(6, IEditorWorkerService)
], StandaloneColorPickerWidget);
var StandaloneColorPickerResult = class {
	constructor(e, O) {
		this.value = e, this.foundInEditor = O;
	}
}, ShowOrFocusStandaloneColorPicker = class extends EditorAction2 {
	constructor() {
		super({
			id: "editor.action.showOrFocusStandaloneColorPicker",
			title: {
				...localize2("showOrFocusStandaloneColorPicker", "Show or Focus Standalone Color Picker"),
				mnemonicTitle: localize({
					key: "mishowOrFocusStandaloneColorPicker",
					comment: ["&& denotes a mnemonic"]
				}, "&&Show or Focus Standalone Color Picker")
			},
			precondition: void 0,
			menu: [{ id: MenuId.CommandPalette }],
			metadata: { description: localize2("showOrFocusStandaloneColorPickerDescription", "Show or focus a standalone color picker which uses the default color provider. It displays hex/rgb/hsl colors.") }
		});
	}
	runEditorCommand(e, O) {
		StandaloneColorPickerController.get(O)?.showOrFocus();
	}
}, HideStandaloneColorPicker = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.hideColorPicker",
			label: localize({
				key: "hideColorPicker",
				comment: ["Action that hides the color picker"]
			}, "Hide the Color Picker"),
			alias: "Hide the Color Picker",
			precondition: EditorContextKeys.standaloneColorPickerVisible.isEqualTo(!0),
			kbOpts: {
				primary: 9,
				weight: 100
			},
			metadata: { description: localize2("hideColorPickerDescription", "Hide the standalone color picker.") }
		});
	}
	run(e, O) {
		StandaloneColorPickerController.get(O)?.hide();
	}
}, InsertColorWithStandaloneColorPicker = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.insertColorWithStandaloneColorPicker",
			label: localize({
				key: "insertColorWithStandaloneColorPicker",
				comment: ["Action that inserts color with standalone color picker"]
			}, "Insert Color with Standalone Color Picker"),
			alias: "Insert Color with Standalone Color Picker",
			precondition: EditorContextKeys.standaloneColorPickerFocused.isEqualTo(!0),
			kbOpts: {
				primary: 3,
				weight: 100
			},
			metadata: { description: localize2("insertColorWithStandaloneColorPickerDescription", "Insert hex/rgb/hsl colors with the focused standalone color picker.") }
		});
	}
	run(e, O) {
		StandaloneColorPickerController.get(O)?.insertColor();
	}
};
registerEditorAction(HideStandaloneColorPicker), registerEditorAction(InsertColorWithStandaloneColorPicker), registerAction2(ShowOrFocusStandaloneColorPicker);
var BlockCommentCommand = class e {
	constructor(e, O, k) {
		this.languageConfigurationService = k, this._selection = e, this._insertSpace = O, this._usedEndToken = null;
	}
	static _haystackHasNeedleAtOffset(e, O, k) {
		if (k < 0) return !1;
		let A = O.length, j = e.length;
		if (k + A > j) return !1;
		for (let j = 0; j < A; j++) {
			let A = e.charCodeAt(k + j), M = O.charCodeAt(j);
			if (A !== M && !(A >= 65 && A <= 90 && A + 32 === M) && !(M >= 65 && M <= 90 && M + 32 === A)) return !1;
		}
		return !0;
	}
	_createOperationsForBlockComment(O, k, A, j, M, N) {
		let P = O.startLineNumber, F = O.startColumn, I = O.endLineNumber, L = O.endColumn, R = M.getLineContent(P), z = M.getLineContent(I), B = R.lastIndexOf(k, F - 1 + k.length), V = z.indexOf(A, L - 1 - A.length);
		if (B !== -1 && V !== -1) if (P === I) R.substring(B + k.length, V).indexOf(A) >= 0 && (B = -1, V = -1);
		else {
			let e = R.substring(B + k.length), O = z.substring(0, V);
			(e.indexOf(A) >= 0 || O.indexOf(A) >= 0) && (B = -1, V = -1);
		}
		let H;
		B !== -1 && V !== -1 ? (j && B + k.length < R.length && R.charCodeAt(B + k.length) === 32 && (k += " "), j && V > 0 && z.charCodeAt(V - 1) === 32 && (A = " " + A, --V), H = e._createRemoveBlockCommentOperations(new Range(P, B + k.length + 1, I, V + 1), k, A)) : (H = e._createAddBlockCommentOperations(O, k, A, this._insertSpace), this._usedEndToken = H.length === 1 ? A : null);
		for (let e of H) N.addTrackedEditOperation(e.range, e.text);
	}
	static _createRemoveBlockCommentOperations(e, O, k) {
		let A = [];
		return Range.isEmpty(e) ? A.push(EditOperation.delete(new Range(e.startLineNumber, e.startColumn - O.length, e.endLineNumber, e.endColumn + k.length))) : (A.push(EditOperation.delete(new Range(e.startLineNumber, e.startColumn - O.length, e.startLineNumber, e.startColumn))), A.push(EditOperation.delete(new Range(e.endLineNumber, e.endColumn, e.endLineNumber, e.endColumn + k.length)))), A;
	}
	static _createAddBlockCommentOperations(e, O, k, A) {
		let j = [];
		return Range.isEmpty(e) ? j.push(EditOperation.replace(new Range(e.startLineNumber, e.startColumn, e.endLineNumber, e.endColumn), O + "  " + k)) : (j.push(EditOperation.insert(new Position(e.startLineNumber, e.startColumn), O + (A ? " " : ""))), j.push(EditOperation.insert(new Position(e.endLineNumber, e.endColumn), (A ? " " : "") + k))), j;
	}
	getEditOperations(e, O) {
		let k = this._selection.startLineNumber, A = this._selection.startColumn;
		e.tokenization.tokenizeIfCheap(k);
		let j = e.getLanguageIdAtPosition(k, A), M = this.languageConfigurationService.getLanguageConfiguration(j).comments;
		!M || !M.blockCommentStartToken || !M.blockCommentEndToken || this._createOperationsForBlockComment(this._selection, M.blockCommentStartToken, M.blockCommentEndToken, this._insertSpace, e, O);
	}
	computeCursorState(e, O) {
		let k = O.getInverseEditOperations();
		if (k.length === 2) {
			let e = k[0], O = k[1];
			return new Selection(e.range.endLineNumber, e.range.endColumn, O.range.startLineNumber, O.range.startColumn);
		} else {
			let e = k[0].range, O = this._usedEndToken ? -this._usedEndToken.length - 1 : 0;
			return new Selection(e.endLineNumber, e.endColumn + O, e.endLineNumber, e.endColumn + O);
		}
	}
}, LineCommentCommand = class e {
	constructor(e, O, k, A, j, M, N) {
		this.languageConfigurationService = e, this._selection = O, this._indentSize = k, this._type = A, this._insertSpace = j, this._selectionId = null, this._deltaColumn = 0, this._moveEndPositionDown = !1, this._ignoreEmptyLines = M, this._ignoreFirstLine = N || !1;
	}
	static _gatherPreflightCommentStrings(e, O, k, A) {
		e.tokenization.tokenizeIfCheap(O);
		let j = e.getLanguageIdAtPosition(O, 1), M = A.getLanguageConfiguration(j).comments, N = M ? M.lineCommentToken : null;
		if (!N) return null;
		let P = [];
		for (let e = 0, A = k - O + 1; e < A; e++) P[e] = {
			ignore: !1,
			commentStr: N,
			commentStrOffset: 0,
			commentStrLength: N.length
		};
		return P;
	}
	static _analyzeLines(e, O, k, A, j, M, N, P) {
		let F = !0, I;
		I = e === 0 ? !0 : e !== 1;
		for (let P = 0, L = A.length; P < L; P++) {
			let L = A[P], R = j + P;
			if (R === j && N) {
				L.ignore = !0;
				continue;
			}
			let z = k.getLineContent(R), B = firstNonWhitespaceIndex(z);
			if (B === -1) {
				L.ignore = M, L.commentStrOffset = z.length;
				continue;
			}
			if (F = !1, L.ignore = !1, L.commentStrOffset = B, I && !BlockCommentCommand._haystackHasNeedleAtOffset(z, L.commentStr, B) && (e === 0 ? I = !1 : e === 1 || (L.ignore = !0)), I && O) {
				let e = B + L.commentStrLength;
				e < z.length && z.charCodeAt(e) === 32 && (L.commentStrLength += 1);
			}
		}
		if (e === 0 && F) {
			I = !1;
			for (let e = 0, O = A.length; e < O; e++) A[e].ignore = !1;
		}
		return {
			supported: !0,
			shouldRemoveComments: I,
			lines: A
		};
	}
	static _gatherPreflightData(O, k, A, j, M, N, P, F) {
		let I = e._gatherPreflightCommentStrings(A, j, M, F);
		return I === null ? { supported: !1 } : e._analyzeLines(O, k, A, I, j, N, P, F);
	}
	_executeLineComments(O, k, A, j) {
		let M;
		A.shouldRemoveComments ? M = e._createRemoveLineCommentsOperations(A.lines, j.startLineNumber) : (e._normalizeInsertionPoint(O, A.lines, j.startLineNumber, this._indentSize), M = this._createAddLineCommentsOperations(A.lines, j.startLineNumber));
		let N = new Position(j.positionLineNumber, j.positionColumn);
		for (let e = 0, A = M.length; e < A; e++) k.addEditOperation(M[e].range, M[e].text), Range.isEmpty(M[e].range) && Range.getStartPosition(M[e].range).equals(N) && O.getLineContent(N.lineNumber).length + 1 === N.column && (this._deltaColumn = (M[e].text || "").length);
		this._selectionId = k.trackSelection(j);
	}
	_attemptRemoveBlockComment(e, O, k, A) {
		let j = O.startLineNumber, M = O.endLineNumber, N = A.length + Math.max(e.getLineFirstNonWhitespaceColumn(O.startLineNumber), O.startColumn), P = e.getLineContent(j).lastIndexOf(k, N - 1), F = e.getLineContent(M).indexOf(A, O.endColumn - 1 - k.length);
		return P !== -1 && F === -1 && (F = e.getLineContent(j).indexOf(A, P + k.length), M = j), P === -1 && F !== -1 && (P = e.getLineContent(M).lastIndexOf(k, F), j = M), O.isEmpty() && (P === -1 || F === -1) && (P = e.getLineContent(j).indexOf(k), P !== -1 && (F = e.getLineContent(j).indexOf(A, P + k.length))), P !== -1 && e.getLineContent(j).charCodeAt(P + k.length) === 32 && (k += " "), F !== -1 && e.getLineContent(M).charCodeAt(F - 1) === 32 && (A = " " + A, --F), P !== -1 && F !== -1 ? BlockCommentCommand._createRemoveBlockCommentOperations(new Range(j, P + k.length + 1, M, F + 1), k, A) : null;
	}
	_executeBlockComment(e, O, k) {
		e.tokenization.tokenizeIfCheap(k.startLineNumber);
		let A = e.getLanguageIdAtPosition(k.startLineNumber, 1), j = this.languageConfigurationService.getLanguageConfiguration(A).comments;
		if (!j || !j.blockCommentStartToken || !j.blockCommentEndToken) return;
		let M = j.blockCommentStartToken, N = j.blockCommentEndToken, P = this._attemptRemoveBlockComment(e, k, M, N);
		if (!P) {
			if (k.isEmpty()) {
				let O = e.getLineContent(k.startLineNumber), A = firstNonWhitespaceIndex(O);
				A === -1 && (A = O.length), P = BlockCommentCommand._createAddBlockCommentOperations(new Range(k.startLineNumber, A + 1, k.startLineNumber, O.length + 1), M, N, this._insertSpace);
			} else P = BlockCommentCommand._createAddBlockCommentOperations(new Range(k.startLineNumber, e.getLineFirstNonWhitespaceColumn(k.startLineNumber), k.endLineNumber, e.getLineMaxColumn(k.endLineNumber)), M, N, this._insertSpace);
			P.length === 1 && (this._deltaColumn = M.length + 1);
		}
		this._selectionId = O.trackSelection(k);
		for (let e of P) O.addEditOperation(e.range, e.text);
	}
	getEditOperations(O, k) {
		let A = this._selection;
		if (this._moveEndPositionDown = !1, A.startLineNumber === A.endLineNumber && this._ignoreFirstLine) {
			k.addEditOperation(new Range(A.startLineNumber, O.getLineMaxColumn(A.startLineNumber), A.startLineNumber + 1, 1), A.startLineNumber === O.getLineCount() ? "" : "\n"), this._selectionId = k.trackSelection(A);
			return;
		}
		A.startLineNumber < A.endLineNumber && A.endColumn === 1 && (this._moveEndPositionDown = !0, A = A.setEndPosition(A.endLineNumber - 1, O.getLineMaxColumn(A.endLineNumber - 1)));
		let j = e._gatherPreflightData(this._type, this._insertSpace, O, A.startLineNumber, A.endLineNumber, this._ignoreEmptyLines, this._ignoreFirstLine, this.languageConfigurationService);
		return j.supported ? this._executeLineComments(O, k, j, A) : this._executeBlockComment(O, k, A);
	}
	computeCursorState(e, O) {
		let k = O.getTrackedSelection(this._selectionId);
		return this._moveEndPositionDown && (k = k.setEndPosition(k.endLineNumber + 1, 1)), new Selection(k.selectionStartLineNumber, k.selectionStartColumn + this._deltaColumn, k.positionLineNumber, k.positionColumn + this._deltaColumn);
	}
	static _createRemoveLineCommentsOperations(e, O) {
		let k = [];
		for (let A = 0, j = e.length; A < j; A++) {
			let j = e[A];
			j.ignore || k.push(EditOperation.delete(new Range(O + A, j.commentStrOffset + 1, O + A, j.commentStrOffset + j.commentStrLength + 1)));
		}
		return k;
	}
	_createAddLineCommentsOperations(e, O) {
		let k = [], A = this._insertSpace ? " " : "";
		for (let j = 0, M = e.length; j < M; j++) {
			let M = e[j];
			M.ignore || k.push(EditOperation.insert(new Position(O + j, M.commentStrOffset + 1), M.commentStr + A));
		}
		return k;
	}
	static nextVisibleColumn(e, O, k, A) {
		return k ? e + (O - e % O) : e + A;
	}
	static _normalizeInsertionPoint(O, k, A, j) {
		let M = 1073741824, N, P;
		for (let N = 0, P = k.length; N < P; N++) {
			if (k[N].ignore) continue;
			let P = O.getLineContent(A + N), F = 0;
			for (let O = 0, A = k[N].commentStrOffset; F < M && O < A; O++) F = e.nextVisibleColumn(F, j, P.charCodeAt(O) === 9, 1);
			F < M && (M = F);
		}
		M = Math.floor(M / j) * j;
		for (let F = 0, I = k.length; F < I; F++) {
			if (k[F].ignore) continue;
			let I = O.getLineContent(A + F), L = 0;
			for (N = 0, P = k[F].commentStrOffset; L < M && N < P; N++) L = e.nextVisibleColumn(L, j, I.charCodeAt(N) === 9, 1);
			L > M ? k[F].commentStrOffset = N - 1 : k[F].commentStrOffset = N;
		}
	}
}, CommentLineAction = class extends EditorAction {
	constructor(e, O) {
		super(O), this._type = e;
	}
	run(e, O) {
		let k = e.get(ILanguageConfigurationService);
		if (!O.hasModel()) return;
		let A = O.getModel(), j = [], M = A.getOptions(), N = O.getOption(23), P = O.getSelections().map((e, O) => ({
			selection: e,
			index: O,
			ignoreFirstLine: !1
		}));
		P.sort((e, O) => Range.compareRangesUsingStarts(e.selection, O.selection));
		let F = P[0];
		for (let e = 1; e < P.length; e++) {
			let O = P[e];
			F.selection.endLineNumber === O.selection.startLineNumber && (F.index < O.index ? O.ignoreFirstLine = !0 : (F.ignoreFirstLine = !0, F = O));
		}
		for (let e of P) j.push(new LineCommentCommand(k, e.selection, M.indentSize, this._type, N.insertSpace, N.ignoreEmptyLines, e.ignoreFirstLine));
		O.pushUndoStop(), O.executeCommands(this.id, j), O.pushUndoStop();
	}
}, ToggleCommentLineAction = class extends CommentLineAction {
	constructor() {
		super(0, {
			id: "editor.action.commentLine",
			label: localize("comment.line", "Toggle Line Comment"),
			alias: "Toggle Line Comment",
			precondition: EditorContextKeys.writable,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: 2138,
				weight: 100
			},
			menuOpts: {
				menuId: MenuId.MenubarEditMenu,
				group: "5_insert",
				title: localize({
					key: "miToggleLineComment",
					comment: ["&& denotes a mnemonic"]
				}, "&&Toggle Line Comment"),
				order: 1
			}
		});
	}
}, AddLineCommentAction = class extends CommentLineAction {
	constructor() {
		super(1, {
			id: "editor.action.addCommentLine",
			label: localize("comment.line.add", "Add Line Comment"),
			alias: "Add Line Comment",
			precondition: EditorContextKeys.writable,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: KeyChord(2089, 2081),
				weight: 100
			}
		});
	}
}, RemoveLineCommentAction = class extends CommentLineAction {
	constructor() {
		super(2, {
			id: "editor.action.removeCommentLine",
			label: localize("comment.line.remove", "Remove Line Comment"),
			alias: "Remove Line Comment",
			precondition: EditorContextKeys.writable,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: KeyChord(2089, 2099),
				weight: 100
			}
		});
	}
}, BlockCommentAction = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.blockComment",
			label: localize("comment.block", "Toggle Block Comment"),
			alias: "Toggle Block Comment",
			precondition: EditorContextKeys.writable,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: 1567,
				linux: { primary: 3103 },
				weight: 100
			},
			menuOpts: {
				menuId: MenuId.MenubarEditMenu,
				group: "5_insert",
				title: localize({
					key: "miToggleBlockComment",
					comment: ["&& denotes a mnemonic"]
				}, "Toggle &&Block Comment"),
				order: 2
			}
		});
	}
	run(e, O) {
		let k = e.get(ILanguageConfigurationService);
		if (!O.hasModel()) return;
		let A = O.getOption(23), j = [], M = O.getSelections();
		for (let e of M) j.push(new BlockCommentCommand(e, A.insertSpace, k));
		O.pushUndoStop(), O.executeCommands(this.id, j), O.pushUndoStop();
	}
};
registerEditorAction(ToggleCommentLineAction), registerEditorAction(AddLineCommentAction), registerEditorAction(RemoveLineCommentAction), registerEditorAction(BlockCommentAction);
var __decorate$71 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$71 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, ContextMenuController_1, ContextMenuController = class {
	static {
		ContextMenuController_1 = this;
	}
	static {
		this.ID = "editor.contrib.contextmenu";
	}
	static get(e) {
		return e.getContribution(ContextMenuController_1.ID);
	}
	constructor(e, O, k, A, j, M, N, P) {
		this._contextMenuService = O, this._contextViewService = k, this._contextKeyService = A, this._keybindingService = j, this._menuService = M, this._configurationService = N, this._workspaceContextService = P, this._toDispose = new DisposableStore(), this._contextMenuIsBeingShownCount = 0, this._editor = e, this._toDispose.add(this._editor.onContextMenu((e) => this._onContextMenu(e))), this._toDispose.add(this._editor.onMouseWheel((e) => {
			if (this._contextMenuIsBeingShownCount > 0) {
				let O = this._contextViewService.getContextViewElement(), k = e.srcElement;
				k.shadowRoot && getShadowRoot(O) === k.shadowRoot || this._contextViewService.hideContextView();
			}
		})), this._toDispose.add(this._editor.onKeyDown((e) => {
			this._editor.getOption(24) && e.keyCode === 58 && (e.preventDefault(), e.stopPropagation(), this.showContextMenu());
		}));
	}
	_onContextMenu(e) {
		if (!this._editor.hasModel()) return;
		if (!this._editor.getOption(24)) {
			this._editor.focus(), e.target.position && !this._editor.getSelection().containsPosition(e.target.position) && this._editor.setPosition(e.target.position);
			return;
		}
		if (e.target.type === 12 || e.target.type === 6 && e.target.detail.injectedText) return;
		if (e.event.preventDefault(), e.event.stopPropagation(), e.target.type === 11) return this._showScrollbarContextMenu(e.event);
		if (e.target.type !== 6 && e.target.type !== 7 && e.target.type !== 1) return;
		if (this._editor.focus(), e.target.position) {
			let O = !1;
			for (let k of this._editor.getSelections()) if (k.containsPosition(e.target.position)) {
				O = !0;
				break;
			}
			O || this._editor.setPosition(e.target.position);
		}
		let O = null;
		e.target.type !== 1 && (O = e.event), this.showContextMenu(O);
	}
	showContextMenu(e) {
		if (!this._editor.getOption(24) || !this._editor.hasModel()) return;
		let O = this._getMenuActions(this._editor.getModel(), this._editor.contextMenuId);
		O.length > 0 && this._doShowContextMenu(O, e);
	}
	_getMenuActions(e, O) {
		let k = [], A = this._menuService.getMenuActions(O, this._contextKeyService, { arg: e.uri });
		for (let O of A) {
			let [, A] = O, j = 0;
			for (let O of A) if (O instanceof SubmenuItemAction) {
				let A = this._getMenuActions(e, O.item.submenu);
				A.length > 0 && (k.push(new SubmenuAction(O.id, O.label, A)), j++);
			} else k.push(O), j++;
			j && k.push(new Separator());
		}
		return k.length && k.pop(), k;
	}
	_doShowContextMenu(e, O = null) {
		if (!this._editor.hasModel()) return;
		let k = this._editor.getOption(60);
		this._editor.updateOptions({ hover: { enabled: !1 } });
		let A = O;
		if (!A) {
			this._editor.revealPosition(this._editor.getPosition(), 1), this._editor.render();
			let e = this._editor.getScrolledVisiblePosition(this._editor.getPosition()), O = getDomNodePagePosition(this._editor.getDomNode()), k = O.left + e.left, j = O.top + e.top + e.height;
			A = {
				x: k,
				y: j
			};
		}
		let j = this._editor.getOption(128) && !isIOS;
		this._contextMenuIsBeingShownCount++, this._contextMenuService.showContextMenu({
			domForShadowRoot: j ? this._editor.getOverflowWidgetsDomNode() ?? this._editor.getDomNode() : void 0,
			getAnchor: () => A,
			getActions: () => e,
			getActionViewItem: (e) => {
				let O = this._keybindingFor(e);
				if (O) return new ActionViewItem(e, e, {
					label: !0,
					keybinding: O.getLabel(),
					isMenu: !0
				});
				let k = e;
				return typeof k.getActionViewItem == "function" ? k.getActionViewItem() : new ActionViewItem(e, e, {
					icon: !0,
					label: !0,
					isMenu: !0
				});
			},
			getKeyBinding: (e) => this._keybindingFor(e),
			onHide: (e) => {
				this._contextMenuIsBeingShownCount--, this._editor.updateOptions({ hover: k });
			}
		});
	}
	_showScrollbarContextMenu(e) {
		if (!this._editor.hasModel() || isStandaloneEditorWorkspace(this._workspaceContextService.getWorkspace())) return;
		let O = this._editor.getOption(73), k = 0, A = (e) => ({
			id: `menu-action-${++k}`,
			label: e.label,
			tooltip: "",
			class: void 0,
			enabled: e.enabled === void 0 ? !0 : e.enabled,
			checked: e.checked,
			run: e.run
		}), j = (e, O) => new SubmenuAction(`menu-action-${++k}`, e, O, void 0), M = (e, O, k, M, N) => {
			if (!O) return A({
				label: e,
				enabled: O,
				run: () => {}
			});
			let P = (e) => () => {
				this._configurationService.updateValue(k, e);
			}, F = [];
			for (let e of N) F.push(A({
				label: e.label,
				checked: M === e.value,
				run: P(e.value)
			}));
			return j(e, F);
		}, N = [];
		N.push(A({
			label: localize("context.minimap.minimap", "Minimap"),
			checked: O.enabled,
			run: () => {
				this._configurationService.updateValue("editor.minimap.enabled", !O.enabled);
			}
		})), N.push(new Separator()), N.push(A({
			label: localize("context.minimap.renderCharacters", "Render Characters"),
			enabled: O.enabled,
			checked: O.renderCharacters,
			run: () => {
				this._configurationService.updateValue("editor.minimap.renderCharacters", !O.renderCharacters);
			}
		})), N.push(M(localize("context.minimap.size", "Vertical size"), O.enabled, "editor.minimap.size", O.size, [
			{
				label: localize("context.minimap.size.proportional", "Proportional"),
				value: "proportional"
			},
			{
				label: localize("context.minimap.size.fill", "Fill"),
				value: "fill"
			},
			{
				label: localize("context.minimap.size.fit", "Fit"),
				value: "fit"
			}
		])), N.push(M(localize("context.minimap.slider", "Slider"), O.enabled, "editor.minimap.showSlider", O.showSlider, [{
			label: localize("context.minimap.slider.mouseover", "Mouse Over"),
			value: "mouseover"
		}, {
			label: localize("context.minimap.slider.always", "Always"),
			value: "always"
		}]));
		let P = this._editor.getOption(128) && !isIOS;
		this._contextMenuIsBeingShownCount++, this._contextMenuService.showContextMenu({
			domForShadowRoot: P ? this._editor.getDomNode() : void 0,
			getAnchor: () => e,
			getActions: () => N,
			onHide: (e) => {
				this._contextMenuIsBeingShownCount--, this._editor.focus();
			}
		});
	}
	_keybindingFor(e) {
		return this._keybindingService.lookupKeybinding(e.id);
	}
	dispose() {
		this._contextMenuIsBeingShownCount > 0 && this._contextViewService.hideContextView(), this._toDispose.dispose();
	}
};
ContextMenuController = ContextMenuController_1 = __decorate$71([
	__param$71(1, IContextMenuService),
	__param$71(2, IContextViewService),
	__param$71(3, IContextKeyService),
	__param$71(4, IKeybindingService),
	__param$71(5, IMenuService),
	__param$71(6, IConfigurationService),
	__param$71(7, IWorkspaceContextService)
], ContextMenuController);
var ShowContextMenu = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.showContextMenu",
			label: localize("action.showContextMenu.label", "Show Editor Context Menu"),
			alias: "Show Editor Context Menu",
			precondition: void 0,
			kbOpts: {
				kbExpr: EditorContextKeys.textInputFocus,
				primary: 1092,
				weight: 100
			}
		});
	}
	run(e, O) {
		ContextMenuController.get(O)?.showContextMenu();
	}
};
registerEditorContribution(ContextMenuController.ID, ContextMenuController, 2), registerEditorAction(ShowContextMenu);
var CursorState$1 = class {
	constructor(e) {
		this.selections = e;
	}
	equals(e) {
		let O = this.selections.length, k = e.selections.length;
		if (O !== k) return !1;
		for (let k = 0; k < O; k++) if (!this.selections[k].equalsSelection(e.selections[k])) return !1;
		return !0;
	}
}, StackElement = class {
	constructor(e, O, k) {
		this.cursorState = e, this.scrollTop = O, this.scrollLeft = k;
	}
}, CursorUndoRedoController = class e extends Disposable {
	static {
		this.ID = "editor.contrib.cursorUndoRedoController";
	}
	static get(O) {
		return O.getContribution(e.ID);
	}
	constructor(e) {
		super(), this._editor = e, this._isCursorUndoRedo = !1, this._undoStack = [], this._redoStack = [], this._register(e.onDidChangeModel((e) => {
			this._undoStack = [], this._redoStack = [];
		})), this._register(e.onDidChangeModelContent((e) => {
			this._undoStack = [], this._redoStack = [];
		})), this._register(e.onDidChangeCursorSelection((O) => {
			if (this._isCursorUndoRedo || !O.oldSelections || O.oldModelVersionId !== O.modelVersionId) return;
			let k = new CursorState$1(O.oldSelections);
			this._undoStack.length > 0 && this._undoStack[this._undoStack.length - 1].cursorState.equals(k) || (this._undoStack.push(new StackElement(k, e.getScrollTop(), e.getScrollLeft())), this._redoStack = [], this._undoStack.length > 50 && this._undoStack.shift());
		}));
	}
	cursorUndo() {
		!this._editor.hasModel() || this._undoStack.length === 0 || (this._redoStack.push(new StackElement(new CursorState$1(this._editor.getSelections()), this._editor.getScrollTop(), this._editor.getScrollLeft())), this._applyState(this._undoStack.pop()));
	}
	cursorRedo() {
		!this._editor.hasModel() || this._redoStack.length === 0 || (this._undoStack.push(new StackElement(new CursorState$1(this._editor.getSelections()), this._editor.getScrollTop(), this._editor.getScrollLeft())), this._applyState(this._redoStack.pop()));
	}
	_applyState(e) {
		this._isCursorUndoRedo = !0, this._editor.setSelections(e.cursorState.selections), this._editor.setScrollPosition({
			scrollTop: e.scrollTop,
			scrollLeft: e.scrollLeft
		}), this._isCursorUndoRedo = !1;
	}
}, CursorUndo = class extends EditorAction {
	constructor() {
		super({
			id: "cursorUndo",
			label: localize("cursor.undo", "Cursor Undo"),
			alias: "Cursor Undo",
			precondition: void 0,
			kbOpts: {
				kbExpr: EditorContextKeys.textInputFocus,
				primary: 2099,
				weight: 100
			}
		});
	}
	run(e, O, k) {
		CursorUndoRedoController.get(O)?.cursorUndo();
	}
}, CursorRedo = class extends EditorAction {
	constructor() {
		super({
			id: "cursorRedo",
			label: localize("cursor.redo", "Cursor Redo"),
			alias: "Cursor Redo",
			precondition: void 0
		});
	}
	run(e, O, k) {
		CursorUndoRedoController.get(O)?.cursorRedo();
	}
};
registerEditorContribution(CursorUndoRedoController.ID, CursorUndoRedoController, 0), registerEditorAction(CursorUndo), registerEditorAction(CursorRedo);
var DragAndDropCommand = class {
	constructor(e, O, k) {
		this.selection = e, this.targetPosition = O, this.copy = k, this.targetSelection = null;
	}
	getEditOperations(e, O) {
		let k = e.getValueInRange(this.selection);
		if (this.copy || O.addEditOperation(this.selection, null), O.addEditOperation(new Range(this.targetPosition.lineNumber, this.targetPosition.column, this.targetPosition.lineNumber, this.targetPosition.column), k), this.selection.containsPosition(this.targetPosition) && !(this.copy && (this.selection.getEndPosition().equals(this.targetPosition) || this.selection.getStartPosition().equals(this.targetPosition)))) {
			this.targetSelection = this.selection;
			return;
		}
		if (this.copy) {
			this.targetSelection = new Selection(this.targetPosition.lineNumber, this.targetPosition.column, this.selection.endLineNumber - this.selection.startLineNumber + this.targetPosition.lineNumber, this.selection.startLineNumber === this.selection.endLineNumber ? this.targetPosition.column + this.selection.endColumn - this.selection.startColumn : this.selection.endColumn);
			return;
		}
		if (this.targetPosition.lineNumber > this.selection.endLineNumber) {
			this.targetSelection = new Selection(this.targetPosition.lineNumber - this.selection.endLineNumber + this.selection.startLineNumber, this.targetPosition.column, this.targetPosition.lineNumber, this.selection.startLineNumber === this.selection.endLineNumber ? this.targetPosition.column + this.selection.endColumn - this.selection.startColumn : this.selection.endColumn);
			return;
		}
		if (this.targetPosition.lineNumber < this.selection.endLineNumber) {
			this.targetSelection = new Selection(this.targetPosition.lineNumber, this.targetPosition.column, this.targetPosition.lineNumber + this.selection.endLineNumber - this.selection.startLineNumber, this.selection.startLineNumber === this.selection.endLineNumber ? this.targetPosition.column + this.selection.endColumn - this.selection.startColumn : this.selection.endColumn);
			return;
		}
		this.selection.endColumn <= this.targetPosition.column ? this.targetSelection = new Selection(this.targetPosition.lineNumber - this.selection.endLineNumber + this.selection.startLineNumber, (this.selection.startLineNumber, this.selection.endLineNumber, this.targetPosition.column - this.selection.endColumn + this.selection.startColumn), this.targetPosition.lineNumber, this.selection.startLineNumber === this.selection.endLineNumber ? this.targetPosition.column : this.selection.endColumn) : this.targetSelection = new Selection(this.targetPosition.lineNumber - this.selection.endLineNumber + this.selection.startLineNumber, this.targetPosition.column, this.targetPosition.lineNumber, this.targetPosition.column + this.selection.endColumn - this.selection.startColumn);
	}
	computeCursorState(e, O) {
		return this.targetSelection;
	}
};
function hasTriggerModifier(e) {
	return isMacintosh ? e.altKey : e.ctrlKey;
}
var DragAndDropController = class e extends Disposable {
	static {
		this.ID = "editor.contrib.dragAndDrop";
	}
	static {
		this.TRIGGER_KEY_VALUE = isMacintosh ? 6 : 5;
	}
	constructor(e) {
		super(), this._editor = e, this._dndDecorationIds = this._editor.createDecorationsCollection(), this._register(this._editor.onMouseDown((e) => this._onEditorMouseDown(e))), this._register(this._editor.onMouseUp((e) => this._onEditorMouseUp(e))), this._register(this._editor.onMouseDrag((e) => this._onEditorMouseDrag(e))), this._register(this._editor.onMouseDrop((e) => this._onEditorMouseDrop(e))), this._register(this._editor.onMouseDropCanceled(() => this._onEditorMouseDropCanceled())), this._register(this._editor.onKeyDown((e) => this.onEditorKeyDown(e))), this._register(this._editor.onKeyUp((e) => this.onEditorKeyUp(e))), this._register(this._editor.onDidBlurEditorWidget(() => this.onEditorBlur())), this._register(this._editor.onDidBlurEditorText(() => this.onEditorBlur())), this._mouseDown = !1, this._modifierPressed = !1, this._dragSelection = null;
	}
	onEditorBlur() {
		this._removeDecoration(), this._dragSelection = null, this._mouseDown = !1, this._modifierPressed = !1;
	}
	onEditorKeyDown(e) {
		!this._editor.getOption(35) || this._editor.getOption(22) || (hasTriggerModifier(e) && (this._modifierPressed = !0), this._mouseDown && hasTriggerModifier(e) && this._editor.updateOptions({ mouseStyle: "copy" }));
	}
	onEditorKeyUp(O) {
		!this._editor.getOption(35) || this._editor.getOption(22) || (hasTriggerModifier(O) && (this._modifierPressed = !1), this._mouseDown && O.keyCode === e.TRIGGER_KEY_VALUE && this._editor.updateOptions({ mouseStyle: "default" }));
	}
	_onEditorMouseDown(e) {
		this._mouseDown = !0;
	}
	_onEditorMouseUp(e) {
		this._mouseDown = !1, this._editor.updateOptions({ mouseStyle: "text" });
	}
	_onEditorMouseDrag(e) {
		let O = e.target;
		if (this._dragSelection === null) {
			let e = (this._editor.getSelections() || []).filter((e) => O.position && e.containsPosition(O.position));
			if (e.length === 1) this._dragSelection = e[0];
			else return;
		}
		hasTriggerModifier(e.event) ? this._editor.updateOptions({ mouseStyle: "copy" }) : this._editor.updateOptions({ mouseStyle: "default" }), O.position && (this._dragSelection.containsPosition(O.position) ? this._removeDecoration() : this.showAt(O.position));
	}
	_onEditorMouseDropCanceled() {
		this._editor.updateOptions({ mouseStyle: "text" }), this._removeDecoration(), this._dragSelection = null, this._mouseDown = !1;
	}
	_onEditorMouseDrop(O) {
		if (O.target && (this._hitContent(O.target) || this._hitMargin(O.target)) && O.target.position) {
			let k = new Position(O.target.position.lineNumber, O.target.position.column);
			if (this._dragSelection === null) {
				let e = null;
				if (O.event.shiftKey) {
					let O = this._editor.getSelection();
					if (O) {
						let { selectionStartLineNumber: A, selectionStartColumn: j } = O;
						e = [new Selection(A, j, k.lineNumber, k.column)];
					}
				} else e = (this._editor.getSelections() || []).map((e) => e.containsPosition(k) ? new Selection(k.lineNumber, k.column, k.lineNumber, k.column) : e);
				this._editor.setSelections(e || [], "mouse", 3);
			} else (!this._dragSelection.containsPosition(k) || (hasTriggerModifier(O.event) || this._modifierPressed) && (this._dragSelection.getEndPosition().equals(k) || this._dragSelection.getStartPosition().equals(k))) && (this._editor.pushUndoStop(), this._editor.executeCommand(e.ID, new DragAndDropCommand(this._dragSelection, k, hasTriggerModifier(O.event) || this._modifierPressed)), this._editor.pushUndoStop());
		}
		this._editor.updateOptions({ mouseStyle: "text" }), this._removeDecoration(), this._dragSelection = null, this._mouseDown = !1;
	}
	static {
		this._DECORATION_OPTIONS = ModelDecorationOptions.register({
			description: "dnd-target",
			className: "dnd-target"
		});
	}
	showAt(O) {
		this._dndDecorationIds.set([{
			range: new Range(O.lineNumber, O.column, O.lineNumber, O.column),
			options: e._DECORATION_OPTIONS
		}]), this._editor.revealPosition(O, 1);
	}
	_removeDecoration() {
		this._dndDecorationIds.clear();
	}
	_hitContent(e) {
		return e.type === 6 || e.type === 7;
	}
	_hitMargin(e) {
		return e.type === 2 || e.type === 3 || e.type === 4;
	}
	dispose() {
		this._removeDecoration(), this._dragSelection = null, this._mouseDown = !1, this._modifierPressed = !1, super.dispose();
	}
};
registerEditorContribution(DragAndDropController.ID, DragAndDropController, 2), registerEditorContribution(CopyPasteController.ID, CopyPasteController, 0), registerEditorFeature(DefaultPasteProvidersFeature), registerEditorCommand(new class extends EditorCommand {
	constructor() {
		super({
			id: changePasteTypeCommandId,
			precondition: pasteWidgetVisibleCtx,
			kbOpts: {
				weight: 100,
				primary: 2137
			}
		});
	}
	runEditorCommand(e, O) {
		return CopyPasteController.get(O)?.changePasteType();
	}
}()), registerEditorCommand(new class extends EditorCommand {
	constructor() {
		super({
			id: "editor.hidePasteWidget",
			precondition: pasteWidgetVisibleCtx,
			kbOpts: {
				weight: 100,
				primary: 9
			}
		});
	}
	runEditorCommand(e, O) {
		CopyPasteController.get(O)?.clearWidgets();
	}
}()), registerEditorAction(class e extends EditorAction {
	static {
		this.argsSchema = {
			type: "object",
			properties: { kind: {
				type: "string",
				description: localize("pasteAs.kind", "The kind of the paste edit to try applying. If not provided or there are multiple edits for this kind, the editor will show a picker.")
			} }
		};
	}
	constructor() {
		super({
			id: "editor.action.pasteAs",
			label: localize("pasteAs", "Paste As..."),
			alias: "Paste As...",
			precondition: EditorContextKeys.writable,
			metadata: {
				description: "Paste as",
				args: [{
					name: "args",
					schema: e.argsSchema
				}]
			}
		});
	}
	run(e, O, k) {
		let A = typeof k?.kind == "string" ? k.kind : void 0;
		return !A && k && (A = typeof k.id == "string" ? k.id : void 0), CopyPasteController.get(O)?.pasteAs(A ? new HierarchicalKind(A) : void 0);
	}
}), registerEditorAction(class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.pasteAsText",
			label: localize("pasteAsText", "Paste as Text"),
			alias: "Paste as Text",
			precondition: EditorContextKeys.writable
		});
	}
	run(e, O) {
		return CopyPasteController.get(O)?.pasteAs({ providerId: DefaultTextPasteOrDropEditProvider.id });
	}
});
var TreeViewsDnDService = class {
	constructor() {
		this._dragOperations = /* @__PURE__ */ new Map();
	}
	removeDragOperationTransfer(e) {
		if (e && this._dragOperations.has(e)) {
			let O = this._dragOperations.get(e);
			return this._dragOperations.delete(e), O;
		}
	}
}, DraggedTreeItemsIdentifier = class {
	constructor(e) {
		this.identifier = e;
	}
};
const ITreeViewsDnDService = createDecorator("treeViewsDndService");
registerSingleton(ITreeViewsDnDService, TreeViewsDnDService, 1);
var __decorate$70 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$70 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, DropIntoEditorController_1;
const defaultProviderConfig = "editor.experimental.dropIntoEditor.defaultProvider", changeDropTypeCommandId = "editor.changeDropType", dropWidgetVisibleCtx = new RawContextKey("dropWidgetVisible", !1, localize("dropWidgetVisible", "Whether the drop widget is showing"));
var DropIntoEditorController = class extends Disposable {
	static {
		DropIntoEditorController_1 = this;
	}
	static {
		this.ID = "editor.contrib.dropIntoEditorController";
	}
	static get(e) {
		return e.getContribution(DropIntoEditorController_1.ID);
	}
	constructor(e, O, k, A, j) {
		super(), this._configService = k, this._languageFeaturesService = A, this._treeViewsDragAndDropService = j, this.treeItemsTransfer = LocalSelectionTransfer.getInstance(), this._dropProgressManager = this._register(O.createInstance(InlineProgressManager, "dropIntoEditor", e)), this._postDropWidgetManager = this._register(O.createInstance(PostEditWidgetManager, "dropIntoEditor", e, dropWidgetVisibleCtx, {
			id: changeDropTypeCommandId,
			label: localize("postDropWidgetTitle", "Show drop options...")
		})), this._register(e.onDropIntoEditor((O) => this.onDropIntoEditor(e, O.position, O.event)));
	}
	clearWidgets() {
		this._postDropWidgetManager.clear();
	}
	changeDropType() {
		this._postDropWidgetManager.tryShowSelector();
	}
	async onDropIntoEditor(e, O, k) {
		if (!k.dataTransfer || !e.hasModel()) return;
		this._currentOperation?.cancel(), e.focus(), e.setPosition(O);
		let A = createCancelablePromise(async (j) => {
			let M = new DisposableStore(), N = M.add(new EditorStateCancellationTokenSource(e, 1, void 0, j));
			try {
				let A = await this.extractDataTransferData(k);
				if (A.size === 0 || N.token.isCancellationRequested) return;
				let P = e.getModel();
				if (!P) return;
				let F = this._languageFeaturesService.documentDropEditProvider.ordered(P).filter((e) => e.dropMimeTypes ? e.dropMimeTypes.some((e) => A.matches(e)) : !0), I = M.add(await this.getDropEdits(F, P, O, A, N));
				if (N.token.isCancellationRequested) return;
				if (I.edits.length) {
					let k = this.getInitialActiveEditIndex(P, I.edits), A = e.getOption(36).showDropSelector === "afterDrop";
					await this._postDropWidgetManager.applyEditAndShowIfNeeded([Range.fromPositions(O)], {
						activeEditIndex: k,
						allEdits: I.edits
					}, A, async (e) => e, j);
				}
			} finally {
				M.dispose(), this._currentOperation === A && (this._currentOperation = void 0);
			}
		});
		this._dropProgressManager.showWhile(O, localize("dropIntoEditorProgress", "Running drop handlers. Click to cancel"), A, { cancel: () => A.cancel() }), this._currentOperation = A;
	}
	async getDropEdits(e, O, k, A, j) {
		let M = new DisposableStore(), N = await raceCancellation(Promise.all(e.map(async (e) => {
			try {
				let N = await e.provideDocumentDropEdits(O, k, A, j.token);
				return N && M.add(N), N?.edits.map((O) => ({
					...O,
					providerId: e.id
				}));
			} catch (e) {
				console.error(e);
			}
		})), j.token), P = coalesce(N ?? []).flat();
		return {
			edits: sortEditsByYieldTo(P),
			dispose: () => M.dispose()
		};
	}
	getInitialActiveEditIndex(e, O) {
		let k = this._configService.getValue(defaultProviderConfig, { resource: e.uri });
		for (let [e, A] of Object.entries(k)) {
			let k = new HierarchicalKind(A), j = O.findIndex((O) => k.value === O.providerId && O.handledMimeType && matchesMimeType(e, [O.handledMimeType]));
			if (j >= 0) return j;
		}
		return 0;
	}
	async extractDataTransferData(e) {
		if (!e.dataTransfer) return new VSDataTransfer();
		let O = toExternalVSDataTransfer(e.dataTransfer);
		if (this.treeItemsTransfer.hasData(DraggedTreeItemsIdentifier.prototype)) {
			let e = this.treeItemsTransfer.getData(DraggedTreeItemsIdentifier.prototype);
			if (Array.isArray(e)) for (let k of e) {
				let e = await this._treeViewsDragAndDropService.removeDragOperationTransfer(k.identifier);
				if (e) for (let [k, A] of e) O.replace(k, A);
			}
		}
		return O;
	}
};
DropIntoEditorController = DropIntoEditorController_1 = __decorate$70([
	__param$70(1, IInstantiationService),
	__param$70(2, IConfigurationService),
	__param$70(3, ILanguageFeaturesService),
	__param$70(4, ITreeViewsDnDService)
], DropIntoEditorController), registerEditorContribution(DropIntoEditorController.ID, DropIntoEditorController, 2), registerEditorFeature(DefaultDropProvidersFeature), registerEditorCommand(new class extends EditorCommand {
	constructor() {
		super({
			id: changeDropTypeCommandId,
			precondition: dropWidgetVisibleCtx,
			kbOpts: {
				weight: 100,
				primary: 2137
			}
		});
	}
	runEditorCommand(e, O, k) {
		DropIntoEditorController.get(O)?.changeDropType();
	}
}()), registerEditorCommand(new class extends EditorCommand {
	constructor() {
		super({
			id: "editor.hideDropWidget",
			precondition: dropWidgetVisibleCtx,
			kbOpts: {
				weight: 100,
				primary: 9
			}
		});
	}
	runEditorCommand(e, O, k) {
		DropIntoEditorController.get(O)?.clearWidgets();
	}
}()), Registry.as(Extensions$1.Configuration).registerConfiguration({
	...editorConfigurationBaseNode,
	properties: { [defaultProviderConfig]: {
		type: "object",
		scope: 5,
		description: localize("defaultProviderDescription", "Configures the default drop provider to use for content of a given mime type."),
		default: {},
		additionalProperties: { type: "string" }
	} }
});
var FindDecorations = class e {
	constructor(e) {
		this._editor = e, this._decorations = [], this._overviewRulerApproximateDecorations = [], this._findScopeDecorationIds = [], this._rangeHighlightDecorationId = null, this._highlightedDecorationId = null, this._startPosition = this._editor.getPosition();
	}
	dispose() {
		this._editor.removeDecorations(this._allDecorations()), this._decorations = [], this._overviewRulerApproximateDecorations = [], this._findScopeDecorationIds = [], this._rangeHighlightDecorationId = null, this._highlightedDecorationId = null;
	}
	reset() {
		this._decorations = [], this._overviewRulerApproximateDecorations = [], this._findScopeDecorationIds = [], this._rangeHighlightDecorationId = null, this._highlightedDecorationId = null;
	}
	getCount() {
		return this._decorations.length;
	}
	getFindScope() {
		return this._findScopeDecorationIds[0] ? this._editor.getModel().getDecorationRange(this._findScopeDecorationIds[0]) : null;
	}
	getFindScopes() {
		if (this._findScopeDecorationIds.length) {
			let e = this._findScopeDecorationIds.map((e) => this._editor.getModel().getDecorationRange(e)).filter((e) => !!e);
			if (e.length) return e;
		}
		return null;
	}
	getStartPosition() {
		return this._startPosition;
	}
	setStartPosition(e) {
		this._startPosition = e, this.setCurrentFindMatch(null);
	}
	_getDecorationIndex(e) {
		let O = this._decorations.indexOf(e);
		return O >= 0 ? O + 1 : 1;
	}
	getDecorationRangeAt(e) {
		let O = e < this._decorations.length ? this._decorations[e] : null;
		return O ? this._editor.getModel().getDecorationRange(O) : null;
	}
	getCurrentMatchesPosition(O) {
		let k = this._editor.getModel().getDecorationsInRange(O);
		for (let O of k) {
			let k = O.options;
			if (k === e._FIND_MATCH_DECORATION || k === e._CURRENT_FIND_MATCH_DECORATION) return this._getDecorationIndex(O.id);
		}
		return 0;
	}
	setCurrentFindMatch(O) {
		let k = null, A = 0;
		if (O) for (let e = 0, j = this._decorations.length; e < j; e++) {
			let j = this._editor.getModel().getDecorationRange(this._decorations[e]);
			if (O.equalsRange(j)) {
				k = this._decorations[e], A = e + 1;
				break;
			}
		}
		return (this._highlightedDecorationId !== null || k !== null) && this._editor.changeDecorations((O) => {
			if (this._highlightedDecorationId !== null && (O.changeDecorationOptions(this._highlightedDecorationId, e._FIND_MATCH_DECORATION), this._highlightedDecorationId = null), k !== null && (this._highlightedDecorationId = k, O.changeDecorationOptions(this._highlightedDecorationId, e._CURRENT_FIND_MATCH_DECORATION)), this._rangeHighlightDecorationId !== null && (O.removeDecoration(this._rangeHighlightDecorationId), this._rangeHighlightDecorationId = null), k !== null) {
				let A = this._editor.getModel().getDecorationRange(k);
				if (A.startLineNumber !== A.endLineNumber && A.endColumn === 1) {
					let e = A.endLineNumber - 1, O = this._editor.getModel().getLineMaxColumn(e);
					A = new Range(A.startLineNumber, A.startColumn, e, O);
				}
				this._rangeHighlightDecorationId = O.addDecoration(A, e._RANGE_HIGHLIGHT_DECORATION);
			}
		}), A;
	}
	set(O, k) {
		this._editor.changeDecorations((A) => {
			let j = e._FIND_MATCH_DECORATION, M = [];
			if (O.length > 1e3) {
				j = e._FIND_MATCH_NO_OVERVIEW_DECORATION;
				let k = this._editor.getModel().getLineCount(), A = this._editor.getLayoutInfo().height / k, N = Math.max(2, Math.ceil(3 / A)), P = O[0].range.startLineNumber, F = O[0].range.endLineNumber;
				for (let k = 1, A = O.length; k < A; k++) {
					let A = O[k].range;
					F + N >= A.startLineNumber ? A.endLineNumber > F && (F = A.endLineNumber) : (M.push({
						range: new Range(P, 1, F, 1),
						options: e._FIND_MATCH_ONLY_OVERVIEW_DECORATION
					}), P = A.startLineNumber, F = A.endLineNumber);
				}
				M.push({
					range: new Range(P, 1, F, 1),
					options: e._FIND_MATCH_ONLY_OVERVIEW_DECORATION
				});
			}
			let N = Array(O.length);
			for (let e = 0, k = O.length; e < k; e++) N[e] = {
				range: O[e].range,
				options: j
			};
			this._decorations = A.deltaDecorations(this._decorations, N), this._overviewRulerApproximateDecorations = A.deltaDecorations(this._overviewRulerApproximateDecorations, M), this._rangeHighlightDecorationId &&= (A.removeDecoration(this._rangeHighlightDecorationId), null), this._findScopeDecorationIds.length && (this._findScopeDecorationIds.forEach((e) => A.removeDecoration(e)), this._findScopeDecorationIds = []), k?.length && (this._findScopeDecorationIds = k.map((O) => A.addDecoration(O, e._FIND_SCOPE_DECORATION)));
		});
	}
	matchBeforePosition(e) {
		if (this._decorations.length === 0) return null;
		for (let O = this._decorations.length - 1; O >= 0; O--) {
			let k = this._decorations[O], A = this._editor.getModel().getDecorationRange(k);
			if (!(!A || A.endLineNumber > e.lineNumber) && (A.endLineNumber < e.lineNumber || !(A.endColumn > e.column))) return A;
		}
		return this._editor.getModel().getDecorationRange(this._decorations[this._decorations.length - 1]);
	}
	matchAfterPosition(e) {
		if (this._decorations.length === 0) return null;
		for (let O = 0, k = this._decorations.length; O < k; O++) {
			let k = this._decorations[O], A = this._editor.getModel().getDecorationRange(k);
			if (!(!A || A.startLineNumber < e.lineNumber) && (A.startLineNumber > e.lineNumber || !(A.startColumn < e.column))) return A;
		}
		return this._editor.getModel().getDecorationRange(this._decorations[0]);
	}
	_allDecorations() {
		let e = [];
		return e = e.concat(this._decorations), e = e.concat(this._overviewRulerApproximateDecorations), this._findScopeDecorationIds.length && e.push(...this._findScopeDecorationIds), this._rangeHighlightDecorationId && e.push(this._rangeHighlightDecorationId), e;
	}
	static {
		this._CURRENT_FIND_MATCH_DECORATION = ModelDecorationOptions.register({
			description: "current-find-match",
			stickiness: 1,
			zIndex: 13,
			className: "currentFindMatch",
			inlineClassName: "currentFindMatchInline",
			showIfCollapsed: !0,
			overviewRuler: {
				color: themeColorFromId(overviewRulerFindMatchForeground),
				position: OverviewRulerLane.Center
			},
			minimap: {
				color: themeColorFromId(minimapFindMatch),
				position: 1
			}
		});
	}
	static {
		this._FIND_MATCH_DECORATION = ModelDecorationOptions.register({
			description: "find-match",
			stickiness: 1,
			zIndex: 10,
			className: "findMatch",
			inlineClassName: "findMatchInline",
			showIfCollapsed: !0,
			overviewRuler: {
				color: themeColorFromId(overviewRulerFindMatchForeground),
				position: OverviewRulerLane.Center
			},
			minimap: {
				color: themeColorFromId(minimapFindMatch),
				position: 1
			}
		});
	}
	static {
		this._FIND_MATCH_NO_OVERVIEW_DECORATION = ModelDecorationOptions.register({
			description: "find-match-no-overview",
			stickiness: 1,
			className: "findMatch",
			showIfCollapsed: !0
		});
	}
	static {
		this._FIND_MATCH_ONLY_OVERVIEW_DECORATION = ModelDecorationOptions.register({
			description: "find-match-only-overview",
			stickiness: 1,
			overviewRuler: {
				color: themeColorFromId(overviewRulerFindMatchForeground),
				position: OverviewRulerLane.Center
			}
		});
	}
	static {
		this._RANGE_HIGHLIGHT_DECORATION = ModelDecorationOptions.register({
			description: "find-range-highlight",
			stickiness: 1,
			className: "rangeHighlight",
			isWholeLine: !0
		});
	}
	static {
		this._FIND_SCOPE_DECORATION = ModelDecorationOptions.register({
			description: "find-scope",
			className: "findScope",
			isWholeLine: !0
		});
	}
}, ReplaceAllCommand = class {
	constructor(e, O, k) {
		this._editorSelection = e, this._ranges = O, this._replaceStrings = k, this._trackedEditorSelectionId = null;
	}
	getEditOperations(e, O) {
		if (this._ranges.length > 0) {
			let e = [];
			for (let O = 0; O < this._ranges.length; O++) e.push({
				range: this._ranges[O],
				text: this._replaceStrings[O]
			});
			e.sort((e, O) => Range.compareRangesUsingStarts(e.range, O.range));
			let k = [], A = e[0];
			for (let O = 1; O < e.length; O++) A.range.endLineNumber === e[O].range.startLineNumber && A.range.endColumn === e[O].range.startColumn ? (A.range = A.range.plusRange(e[O].range), A.text += e[O].text) : (k.push(A), A = e[O]);
			k.push(A);
			for (let e of k) O.addEditOperation(e.range, e.text);
		}
		this._trackedEditorSelectionId = O.trackSelection(this._editorSelection);
	}
	computeCursorState(e, O) {
		return O.getTrackedSelection(this._trackedEditorSelectionId);
	}
};
function buildReplaceStringWithCasePreserved(e, O) {
	if (e && e[0] !== "") {
		let k = validateSpecificSpecialCharacter(e, O, "-"), A = validateSpecificSpecialCharacter(e, O, "_");
		return k && !A ? buildReplaceStringForSpecificSpecialCharacter(e, O, "-") : !k && A ? buildReplaceStringForSpecificSpecialCharacter(e, O, "_") : e[0].toUpperCase() === e[0] ? O.toUpperCase() : e[0].toLowerCase() === e[0] ? O.toLowerCase() : containsUppercaseCharacter(e[0][0]) && O.length > 0 ? O[0].toUpperCase() + O.substr(1) : e[0][0].toUpperCase() !== e[0][0] && O.length > 0 ? O[0].toLowerCase() + O.substr(1) : O;
	} else return O;
}
function validateSpecificSpecialCharacter(e, O, k) {
	return e[0].indexOf(k) !== -1 && O.indexOf(k) !== -1 && e[0].split(k).length === O.split(k).length;
}
function buildReplaceStringForSpecificSpecialCharacter(e, O, k) {
	let A = O.split(k), j = e[0].split(k), M = "";
	return A.forEach((e, O) => {
		M += buildReplaceStringWithCasePreserved([j[O]], e) + k;
	}), M.slice(0, -1);
}
var StaticValueReplacePattern = class {
	constructor(e) {
		this.staticValue = e, this.kind = 0;
	}
}, DynamicPiecesReplacePattern = class {
	constructor(e) {
		this.pieces = e, this.kind = 1;
	}
}, ReplacePattern = class e {
	static fromStaticValue(O) {
		return new e([ReplacePiece.staticValue(O)]);
	}
	get hasReplacementPatterns() {
		return this._state.kind === 1;
	}
	constructor(e) {
		!e || e.length === 0 ? this._state = new StaticValueReplacePattern("") : e.length === 1 && e[0].staticValue !== null ? this._state = new StaticValueReplacePattern(e[0].staticValue) : this._state = new DynamicPiecesReplacePattern(e);
	}
	buildReplaceString(O, k) {
		if (this._state.kind === 0) return k ? buildReplaceStringWithCasePreserved(O, this._state.staticValue) : this._state.staticValue;
		let A = "";
		for (let k = 0, j = this._state.pieces.length; k < j; k++) {
			let j = this._state.pieces[k];
			if (j.staticValue !== null) {
				A += j.staticValue;
				continue;
			}
			let M = e._substitute(j.matchIndex, O);
			if (j.caseOps !== null && j.caseOps.length > 0) {
				let e = [], O = j.caseOps.length, k = 0;
				for (let A = 0, N = M.length; A < N; A++) {
					if (k >= O) {
						e.push(M.slice(A));
						break;
					}
					switch (j.caseOps[k]) {
						case "U":
							e.push(M[A].toUpperCase());
							break;
						case "u":
							e.push(M[A].toUpperCase()), k++;
							break;
						case "L":
							e.push(M[A].toLowerCase());
							break;
						case "l":
							e.push(M[A].toLowerCase()), k++;
							break;
						default: e.push(M[A]);
					}
				}
				M = e.join("");
			}
			A += M;
		}
		return A;
	}
	static _substitute(e, O) {
		if (O === null) return "";
		if (e === 0) return O[0];
		let k = "";
		for (; e > 0;) {
			if (e < O.length) return (O[e] || "") + k;
			k = String(e % 10) + k, e = Math.floor(e / 10);
		}
		return "$" + k;
	}
}, ReplacePiece = class e {
	static staticValue(O) {
		return new e(O, -1, null);
	}
	static caseOps(O, k) {
		return new e(null, O, k);
	}
	constructor(e, O, k) {
		this.staticValue = e, this.matchIndex = O, !k || k.length === 0 ? this.caseOps = null : this.caseOps = k.slice(0);
	}
}, ReplacePieceBuilder = class {
	constructor(e) {
		this._source = e, this._lastCharIndex = 0, this._result = [], this._resultLen = 0, this._currentStaticPiece = "";
	}
	emitUnchanged(e) {
		this._emitStatic(this._source.substring(this._lastCharIndex, e)), this._lastCharIndex = e;
	}
	emitStatic(e, O) {
		this._emitStatic(e), this._lastCharIndex = O;
	}
	_emitStatic(e) {
		e.length !== 0 && (this._currentStaticPiece += e);
	}
	emitMatchIndex(e, O, k) {
		this._currentStaticPiece.length !== 0 && (this._result[this._resultLen++] = ReplacePiece.staticValue(this._currentStaticPiece), this._currentStaticPiece = ""), this._result[this._resultLen++] = ReplacePiece.caseOps(e, k), this._lastCharIndex = O;
	}
	finalize() {
		return this.emitUnchanged(this._source.length), this._currentStaticPiece.length !== 0 && (this._result[this._resultLen++] = ReplacePiece.staticValue(this._currentStaticPiece), this._currentStaticPiece = ""), new ReplacePattern(this._result);
	}
};
function parseReplaceString(e) {
	if (!e || e.length === 0) return new ReplacePattern(null);
	let O = [], k = new ReplacePieceBuilder(e);
	for (let A = 0, j = e.length; A < j; A++) {
		let M = e.charCodeAt(A);
		if (M === 92) {
			if (A++, A >= j) break;
			let M = e.charCodeAt(A);
			switch (M) {
				case 92:
					k.emitUnchanged(A - 1), k.emitStatic("\\", A + 1);
					break;
				case 110:
					k.emitUnchanged(A - 1), k.emitStatic("\n", A + 1);
					break;
				case 116:
					k.emitUnchanged(A - 1), k.emitStatic("	", A + 1);
					break;
				case 117:
				case 85:
				case 108:
				case 76:
					k.emitUnchanged(A - 1), k.emitStatic("", A + 1), O.push(String.fromCharCode(M));
					break;
			}
			continue;
		}
		if (M === 36) {
			if (A++, A >= j) break;
			let M = e.charCodeAt(A);
			if (M === 36) {
				k.emitUnchanged(A - 1), k.emitStatic("$", A + 1);
				continue;
			}
			if (M === 48 || M === 38) {
				k.emitUnchanged(A - 1), k.emitMatchIndex(0, A + 1, O), O.length = 0;
				continue;
			}
			if (49 <= M && M <= 57) {
				let N = M - 48;
				if (A + 1 < j) {
					let j = e.charCodeAt(A + 1);
					if (48 <= j && j <= 57) {
						A++, N = N * 10 + (j - 48), k.emitUnchanged(A - 2), k.emitMatchIndex(N, A + 1, O), O.length = 0;
						continue;
					}
				}
				k.emitUnchanged(A - 1), k.emitMatchIndex(N, A + 1, O), O.length = 0;
				continue;
			}
		}
	}
	return k.finalize();
}
const CONTEXT_FIND_WIDGET_VISIBLE = new RawContextKey("findWidgetVisible", !1);
CONTEXT_FIND_WIDGET_VISIBLE.toNegated();
const CONTEXT_FIND_INPUT_FOCUSED = new RawContextKey("findInputFocussed", !1), CONTEXT_REPLACE_INPUT_FOCUSED = new RawContextKey("replaceInputFocussed", !1), ToggleCaseSensitiveKeybinding = {
	primary: 545,
	mac: { primary: 2593 }
}, ToggleWholeWordKeybinding = {
	primary: 565,
	mac: { primary: 2613 }
}, ToggleRegexKeybinding = {
	primary: 560,
	mac: { primary: 2608 }
}, ToggleSearchScopeKeybinding = {
	primary: 554,
	mac: { primary: 2602 }
}, TogglePreserveCaseKeybinding = {
	primary: 558,
	mac: { primary: 2606 }
}, FIND_IDS = {
	StartFindAction: "actions.find",
	StartFindWithSelection: "actions.findWithSelection",
	StartFindWithArgs: "editor.actions.findWithArgs",
	NextMatchFindAction: "editor.action.nextMatchFindAction",
	PreviousMatchFindAction: "editor.action.previousMatchFindAction",
	GoToMatchFindAction: "editor.action.goToMatchFindAction",
	NextSelectionMatchFindAction: "editor.action.nextSelectionMatchFindAction",
	PreviousSelectionMatchFindAction: "editor.action.previousSelectionMatchFindAction",
	StartFindReplaceAction: "editor.action.startFindReplaceAction",
	CloseFindWidgetCommand: "closeFindWidget",
	ToggleCaseSensitiveCommand: "toggleFindCaseSensitive",
	ToggleWholeWordCommand: "toggleFindWholeWord",
	ToggleRegexCommand: "toggleFindRegex",
	ToggleSearchScopeCommand: "toggleFindInSelection",
	TogglePreserveCaseCommand: "togglePreserveCase",
	ReplaceOneAction: "editor.action.replaceOne",
	ReplaceAllAction: "editor.action.replaceAll",
	SelectAllMatchesAction: "editor.action.selectAllMatches"
}, MATCHES_LIMIT = 19999;
var RESEARCH_DELAY = 240, FindModelBoundToEditorModel = class e {
	constructor(e, O) {
		this._toDispose = new DisposableStore(), this._editor = e, this._state = O, this._isDisposed = !1, this._startSearchingTimer = new TimeoutTimer(), this._decorations = new FindDecorations(e), this._toDispose.add(this._decorations), this._updateDecorationsScheduler = new RunOnceScheduler(() => {
			if (this._editor.hasModel()) return this.research(!1);
		}, 100), this._toDispose.add(this._updateDecorationsScheduler), this._toDispose.add(this._editor.onDidChangeCursorPosition((e) => {
			(e.reason === 3 || e.reason === 5 || e.reason === 6) && this._decorations.setStartPosition(this._editor.getPosition());
		})), this._ignoreModelContentChanged = !1, this._toDispose.add(this._editor.onDidChangeModelContent((e) => {
			this._ignoreModelContentChanged || (e.isFlush && this._decorations.reset(), this._decorations.setStartPosition(this._editor.getPosition()), this._updateDecorationsScheduler.schedule());
		})), this._toDispose.add(this._state.onFindReplaceStateChange((e) => this._onStateChanged(e))), this.research(!1, this._state.searchScope);
	}
	dispose() {
		this._isDisposed = !0, dispose(this._startSearchingTimer), this._toDispose.dispose();
	}
	_onStateChanged(e) {
		this._isDisposed || this._editor.hasModel() && (e.searchString || e.isReplaceRevealed || e.isRegex || e.wholeWord || e.matchCase || e.searchScope) && (this._editor.getModel().isTooLargeForSyncing() ? (this._startSearchingTimer.cancel(), this._startSearchingTimer.setIfNotSet(() => {
			e.searchScope ? this.research(e.moveCursor, this._state.searchScope) : this.research(e.moveCursor);
		}, RESEARCH_DELAY)) : e.searchScope ? this.research(e.moveCursor, this._state.searchScope) : this.research(e.moveCursor));
	}
	static _getSearchRange(e, O) {
		return O || e.getFullModelRange();
	}
	research(e, O) {
		let k = null;
		O === void 0 ? k = this._decorations.getFindScopes() : O !== null && (k = Array.isArray(O) ? O : [O]), k !== null && (k = k.map((e) => {
			if (e.startLineNumber !== e.endLineNumber) {
				let O = e.endLineNumber;
				return e.endColumn === 1 && --O, new Range(e.startLineNumber, 1, O, this._editor.getModel().getLineMaxColumn(O));
			}
			return e;
		}));
		let A = this._findMatches(k, !1, MATCHES_LIMIT);
		this._decorations.set(A, k);
		let j = this._editor.getSelection(), M = this._decorations.getCurrentMatchesPosition(j);
		if (M === 0 && A.length > 0) {
			let e = findFirstIdxMonotonousOrArrLen(A.map((e) => e.range), (e) => Range.compareRangesUsingStarts(e, j) >= 0);
			M = e > 0 ? e - 1 + 1 : M;
		}
		this._state.changeMatchInfo(M, this._decorations.getCount(), void 0), e && this._editor.getOption(41).cursorMoveOnType && this._moveToNextMatch(this._decorations.getStartPosition());
	}
	_hasMatches() {
		return this._state.matchesCount > 0;
	}
	_cannotFind() {
		if (!this._hasMatches()) {
			let e = this._decorations.getFindScope();
			return e && this._editor.revealRangeInCenterIfOutsideViewport(e, 0), !0;
		}
		return !1;
	}
	_setCurrentFindMatch(e) {
		let O = this._decorations.setCurrentFindMatch(e);
		this._state.changeMatchInfo(O, this._decorations.getCount(), e), this._editor.setSelection(e), this._editor.revealRangeInCenterIfOutsideViewport(e, 0);
	}
	_prevSearchPosition(e) {
		let O = this._state.isRegex && (this._state.searchString.indexOf("^") >= 0 || this._state.searchString.indexOf("$") >= 0), { lineNumber: k, column: A } = e, j = this._editor.getModel();
		return O || A === 1 ? (k === 1 ? k = j.getLineCount() : k--, A = j.getLineMaxColumn(k)) : A--, new Position(k, A);
	}
	_moveToPrevMatch(O, k = !1) {
		if (!this._state.canNavigateBack()) {
			let e = this._decorations.matchAfterPosition(O);
			e && this._setCurrentFindMatch(e);
			return;
		}
		if (this._decorations.getCount() < 19999) {
			let e = this._decorations.matchBeforePosition(O);
			e && e.isEmpty() && e.getStartPosition().equals(O) && (O = this._prevSearchPosition(O), e = this._decorations.matchBeforePosition(O)), e && this._setCurrentFindMatch(e);
			return;
		}
		if (this._cannotFind()) return;
		let A = this._decorations.getFindScope(), j = e._getSearchRange(this._editor.getModel(), A);
		j.getEndPosition().isBefore(O) && (O = j.getEndPosition()), O.isBefore(j.getStartPosition()) && (O = j.getEndPosition());
		let { lineNumber: M, column: N } = O, P = this._editor.getModel(), F = new Position(M, N), I = P.findPreviousMatch(this._state.searchString, F, this._state.isRegex, this._state.matchCase, this._state.wholeWord ? this._editor.getOption(132) : null, !1);
		if (I && I.range.isEmpty() && I.range.getStartPosition().equals(F) && (F = this._prevSearchPosition(F), I = P.findPreviousMatch(this._state.searchString, F, this._state.isRegex, this._state.matchCase, this._state.wholeWord ? this._editor.getOption(132) : null, !1)), I) {
			if (!k && !j.containsRange(I.range)) return this._moveToPrevMatch(I.range.getStartPosition(), !0);
			this._setCurrentFindMatch(I.range);
		}
	}
	moveToPrevMatch() {
		this._moveToPrevMatch(this._editor.getSelection().getStartPosition());
	}
	_nextSearchPosition(e) {
		let O = this._state.isRegex && (this._state.searchString.indexOf("^") >= 0 || this._state.searchString.indexOf("$") >= 0), { lineNumber: k, column: A } = e, j = this._editor.getModel();
		return O || A === j.getLineMaxColumn(k) ? (k === j.getLineCount() ? k = 1 : k++, A = 1) : A++, new Position(k, A);
	}
	_moveToNextMatch(e) {
		if (!this._state.canNavigateForward()) {
			let O = this._decorations.matchBeforePosition(e);
			O && this._setCurrentFindMatch(O);
			return;
		}
		if (this._decorations.getCount() < 19999) {
			let O = this._decorations.matchAfterPosition(e);
			O && O.isEmpty() && O.getStartPosition().equals(e) && (e = this._nextSearchPosition(e), O = this._decorations.matchAfterPosition(e)), O && this._setCurrentFindMatch(O);
			return;
		}
		let O = this._getNextMatch(e, !1, !0);
		O && this._setCurrentFindMatch(O.range);
	}
	_getNextMatch(O, k, A, j = !1) {
		if (this._cannotFind()) return null;
		let M = this._decorations.getFindScope(), N = e._getSearchRange(this._editor.getModel(), M);
		N.getEndPosition().isBefore(O) && (O = N.getStartPosition()), O.isBefore(N.getStartPosition()) && (O = N.getStartPosition());
		let { lineNumber: P, column: F } = O, I = this._editor.getModel(), L = new Position(P, F), R = I.findNextMatch(this._state.searchString, L, this._state.isRegex, this._state.matchCase, this._state.wholeWord ? this._editor.getOption(132) : null, k);
		return A && R && R.range.isEmpty() && R.range.getStartPosition().equals(L) && (L = this._nextSearchPosition(L), R = I.findNextMatch(this._state.searchString, L, this._state.isRegex, this._state.matchCase, this._state.wholeWord ? this._editor.getOption(132) : null, k)), R ? !j && !N.containsRange(R.range) ? this._getNextMatch(R.range.getEndPosition(), k, A, !0) : R : null;
	}
	moveToNextMatch() {
		this._moveToNextMatch(this._editor.getSelection().getEndPosition());
	}
	_moveToMatch(e) {
		let O = this._decorations.getDecorationRangeAt(e);
		O && this._setCurrentFindMatch(O);
	}
	moveToMatch(e) {
		this._moveToMatch(e);
	}
	_getReplacePattern() {
		return this._state.isRegex ? parseReplaceString(this._state.replaceString) : ReplacePattern.fromStaticValue(this._state.replaceString);
	}
	replace() {
		if (!this._hasMatches()) return;
		let e = this._getReplacePattern(), O = this._editor.getSelection(), k = this._getNextMatch(O.getStartPosition(), !0, !1);
		if (k) if (O.equalsRange(k.range)) {
			let A = e.buildReplaceString(k.matches, this._state.preserveCase), j = new ReplaceCommand(O, A);
			this._executeEditorCommand("replace", j), this._decorations.setStartPosition(new Position(O.startLineNumber, O.startColumn + A.length)), this.research(!0);
		} else this._decorations.setStartPosition(this._editor.getPosition()), this._setCurrentFindMatch(k.range);
	}
	_findMatches(O, k, A) {
		let j = (O || [null]).map((O) => e._getSearchRange(this._editor.getModel(), O));
		return this._editor.getModel().findMatches(this._state.searchString, j, this._state.isRegex, this._state.matchCase, this._state.wholeWord ? this._editor.getOption(132) : null, k, A);
	}
	replaceAll() {
		if (!this._hasMatches()) return;
		let e = this._decorations.getFindScopes();
		e === null && this._state.matchesCount >= 19999 ? this._largeReplaceAll() : this._regularReplaceAll(e), this.research(!1);
	}
	_largeReplaceAll() {
		let e = new SearchParams(this._state.searchString, this._state.isRegex, this._state.matchCase, this._state.wholeWord ? this._editor.getOption(132) : null).parseSearchRequest();
		if (!e) return;
		let O = e.regex;
		if (!O.multiline) {
			let e = "mu";
			O.ignoreCase && (e += "i"), O.global && (e += "g"), O = new RegExp(O.source, e);
		}
		let k = this._editor.getModel(), A = k.getValue(1), j = k.getFullModelRange(), M = this._getReplacePattern(), N, P = this._state.preserveCase;
		N = M.hasReplacementPatterns || P ? A.replace(O, function() {
			return M.buildReplaceString(arguments, P);
		}) : A.replace(O, M.buildReplaceString(null, P));
		let F = new ReplaceCommandThatPreservesSelection(j, N, this._editor.getSelection());
		this._executeEditorCommand("replaceAll", F);
	}
	_regularReplaceAll(e) {
		let O = this._getReplacePattern(), k = this._findMatches(e, O.hasReplacementPatterns || this._state.preserveCase, 1073741824), A = [];
		for (let e = 0, j = k.length; e < j; e++) A[e] = O.buildReplaceString(k[e].matches, this._state.preserveCase);
		let j = new ReplaceAllCommand(this._editor.getSelection(), k.map((e) => e.range), A);
		this._executeEditorCommand("replaceAll", j);
	}
	selectAllMatches() {
		if (!this._hasMatches()) return;
		let e = this._decorations.getFindScopes(), O = this._findMatches(e, !1, 1073741824).map((e) => new Selection(e.range.startLineNumber, e.range.startColumn, e.range.endLineNumber, e.range.endColumn)), k = this._editor.getSelection();
		for (let e = 0, A = O.length; e < A; e++) if (O[e].equalsRange(k)) {
			O = [k].concat(O.slice(0, e), O.slice(e + 1));
			break;
		}
		this._editor.setSelections(O);
	}
	_executeEditorCommand(e, O) {
		try {
			this._ignoreModelContentChanged = !0, this._editor.pushUndoStop(), this._editor.executeCommand(e, O), this._editor.pushUndoStop();
		} finally {
			this._ignoreModelContentChanged = !1;
		}
	}
}, FindOptionsWidget = class e extends Widget {
	static {
		this.ID = "editor.contrib.findOptionsWidget";
	}
	constructor(e, O, k) {
		super(), this._hideSoon = this._register(new RunOnceScheduler(() => this._hide(), 2e3)), this._isVisible = !1, this._editor = e, this._state = O, this._keybindingService = k, this._domNode = document.createElement("div"), this._domNode.className = "findOptionsWidget", this._domNode.style.display = "none", this._domNode.style.top = "10px", this._domNode.style.zIndex = "12", this._domNode.setAttribute("role", "presentation"), this._domNode.setAttribute("aria-hidden", "true");
		let A = {
			inputActiveOptionBorder: asCssVariable(inputActiveOptionBorder),
			inputActiveOptionForeground: asCssVariable(inputActiveOptionForeground),
			inputActiveOptionBackground: asCssVariable(inputActiveOptionBackground)
		}, j = this._register(createInstantHoverDelegate());
		this.caseSensitive = this._register(new CaseSensitiveToggle({
			appendTitle: this._keybindingLabelFor(FIND_IDS.ToggleCaseSensitiveCommand),
			isChecked: this._state.matchCase,
			hoverDelegate: j,
			...A
		})), this._domNode.appendChild(this.caseSensitive.domNode), this._register(this.caseSensitive.onChange(() => {
			this._state.change({ matchCase: this.caseSensitive.checked }, !1);
		})), this.wholeWords = this._register(new WholeWordsToggle({
			appendTitle: this._keybindingLabelFor(FIND_IDS.ToggleWholeWordCommand),
			isChecked: this._state.wholeWord,
			hoverDelegate: j,
			...A
		})), this._domNode.appendChild(this.wholeWords.domNode), this._register(this.wholeWords.onChange(() => {
			this._state.change({ wholeWord: this.wholeWords.checked }, !1);
		})), this.regex = this._register(new RegexToggle({
			appendTitle: this._keybindingLabelFor(FIND_IDS.ToggleRegexCommand),
			isChecked: this._state.isRegex,
			hoverDelegate: j,
			...A
		})), this._domNode.appendChild(this.regex.domNode), this._register(this.regex.onChange(() => {
			this._state.change({ isRegex: this.regex.checked }, !1);
		})), this._editor.addOverlayWidget(this), this._register(this._state.onFindReplaceStateChange((e) => {
			let O = !1;
			e.isRegex && (this.regex.checked = this._state.isRegex, O = !0), e.wholeWord && (this.wholeWords.checked = this._state.wholeWord, O = !0), e.matchCase && (this.caseSensitive.checked = this._state.matchCase, O = !0), !this._state.isRevealed && O && this._revealTemporarily();
		})), this._register(addDisposableListener(this._domNode, EventType$1.MOUSE_LEAVE, (e) => this._onMouseLeave())), this._register(addDisposableListener(this._domNode, "mouseover", (e) => this._onMouseOver()));
	}
	_keybindingLabelFor(e) {
		let O = this._keybindingService.lookupKeybinding(e);
		return O ? ` (${O.getLabel()})` : "";
	}
	dispose() {
		this._editor.removeOverlayWidget(this), super.dispose();
	}
	getId() {
		return e.ID;
	}
	getDomNode() {
		return this._domNode;
	}
	getPosition() {
		return { preference: 0 };
	}
	highlightFindOptions() {
		this._revealTemporarily();
	}
	_revealTemporarily() {
		this._show(), this._hideSoon.schedule();
	}
	_onMouseLeave() {
		this._hideSoon.schedule();
	}
	_onMouseOver() {
		this._hideSoon.cancel();
	}
	_show() {
		this._isVisible || (this._isVisible = !0, this._domNode.style.display = "block");
	}
	_hide() {
		this._isVisible && (this._isVisible = !1, this._domNode.style.display = "none");
	}
};
function effectiveOptionValue(e, O) {
	return e === 1 ? !0 : e === 2 ? !1 : O;
}
var FindReplaceState = class extends Disposable {
	get searchString() {
		return this._searchString;
	}
	get replaceString() {
		return this._replaceString;
	}
	get isRevealed() {
		return this._isRevealed;
	}
	get isReplaceRevealed() {
		return this._isReplaceRevealed;
	}
	get isRegex() {
		return effectiveOptionValue(this._isRegexOverride, this._isRegex);
	}
	get wholeWord() {
		return effectiveOptionValue(this._wholeWordOverride, this._wholeWord);
	}
	get matchCase() {
		return effectiveOptionValue(this._matchCaseOverride, this._matchCase);
	}
	get preserveCase() {
		return effectiveOptionValue(this._preserveCaseOverride, this._preserveCase);
	}
	get actualIsRegex() {
		return this._isRegex;
	}
	get actualWholeWord() {
		return this._wholeWord;
	}
	get actualMatchCase() {
		return this._matchCase;
	}
	get actualPreserveCase() {
		return this._preserveCase;
	}
	get searchScope() {
		return this._searchScope;
	}
	get matchesPosition() {
		return this._matchesPosition;
	}
	get matchesCount() {
		return this._matchesCount;
	}
	get currentMatch() {
		return this._currentMatch;
	}
	constructor() {
		super(), this._onFindReplaceStateChange = this._register(new Emitter()), this.onFindReplaceStateChange = this._onFindReplaceStateChange.event, this._searchString = "", this._replaceString = "", this._isRevealed = !1, this._isReplaceRevealed = !1, this._isRegex = !1, this._isRegexOverride = 0, this._wholeWord = !1, this._wholeWordOverride = 0, this._matchCase = !1, this._matchCaseOverride = 0, this._preserveCase = !1, this._preserveCaseOverride = 0, this._searchScope = null, this._matchesPosition = 0, this._matchesCount = 0, this._currentMatch = null, this._loop = !0, this._isSearching = !1, this._filters = null;
	}
	changeMatchInfo(e, O, k) {
		let A = {
			moveCursor: !1,
			updateHistory: !1,
			searchString: !1,
			replaceString: !1,
			isRevealed: !1,
			isReplaceRevealed: !1,
			isRegex: !1,
			wholeWord: !1,
			matchCase: !1,
			preserveCase: !1,
			searchScope: !1,
			matchesPosition: !1,
			matchesCount: !1,
			currentMatch: !1,
			loop: !1,
			isSearching: !1,
			filters: !1
		}, j = !1;
		O === 0 && (e = 0), e > O && (e = O), this._matchesPosition !== e && (this._matchesPosition = e, A.matchesPosition = !0, j = !0), this._matchesCount !== O && (this._matchesCount = O, A.matchesCount = !0, j = !0), k !== void 0 && (Range.equalsRange(this._currentMatch, k) || (this._currentMatch = k, A.currentMatch = !0, j = !0)), j && this._onFindReplaceStateChange.fire(A);
	}
	change(e, O, k = !0) {
		let A = {
			moveCursor: O,
			updateHistory: k,
			searchString: !1,
			replaceString: !1,
			isRevealed: !1,
			isReplaceRevealed: !1,
			isRegex: !1,
			wholeWord: !1,
			matchCase: !1,
			preserveCase: !1,
			searchScope: !1,
			matchesPosition: !1,
			matchesCount: !1,
			currentMatch: !1,
			loop: !1,
			isSearching: !1,
			filters: !1
		}, j = !1, M = this.isRegex, N = this.wholeWord, P = this.matchCase, F = this.preserveCase;
		e.searchString !== void 0 && this._searchString !== e.searchString && (this._searchString = e.searchString, A.searchString = !0, j = !0), e.replaceString !== void 0 && this._replaceString !== e.replaceString && (this._replaceString = e.replaceString, A.replaceString = !0, j = !0), e.isRevealed !== void 0 && this._isRevealed !== e.isRevealed && (this._isRevealed = e.isRevealed, A.isRevealed = !0, j = !0), e.isReplaceRevealed !== void 0 && this._isReplaceRevealed !== e.isReplaceRevealed && (this._isReplaceRevealed = e.isReplaceRevealed, A.isReplaceRevealed = !0, j = !0), e.isRegex !== void 0 && (this._isRegex = e.isRegex), e.wholeWord !== void 0 && (this._wholeWord = e.wholeWord), e.matchCase !== void 0 && (this._matchCase = e.matchCase), e.preserveCase !== void 0 && (this._preserveCase = e.preserveCase), e.searchScope !== void 0 && (e.searchScope?.every((e) => this._searchScope?.some((O) => !Range.equalsRange(O, e))) || (this._searchScope = e.searchScope, A.searchScope = !0, j = !0)), e.loop !== void 0 && this._loop !== e.loop && (this._loop = e.loop, A.loop = !0, j = !0), e.isSearching !== void 0 && this._isSearching !== e.isSearching && (this._isSearching = e.isSearching, A.isSearching = !0, j = !0), e.filters !== void 0 && (this._filters ? this._filters.update(e.filters) : this._filters = e.filters, A.filters = !0, j = !0), this._isRegexOverride = e.isRegexOverride === void 0 ? 0 : e.isRegexOverride, this._wholeWordOverride = e.wholeWordOverride === void 0 ? 0 : e.wholeWordOverride, this._matchCaseOverride = e.matchCaseOverride === void 0 ? 0 : e.matchCaseOverride, this._preserveCaseOverride = e.preserveCaseOverride === void 0 ? 0 : e.preserveCaseOverride, M !== this.isRegex && (j = !0, A.isRegex = !0), N !== this.wholeWord && (j = !0, A.wholeWord = !0), P !== this.matchCase && (j = !0, A.matchCase = !0), F !== this.preserveCase && (j = !0, A.preserveCase = !0), j && this._onFindReplaceStateChange.fire(A);
	}
	canNavigateBack() {
		return this.canNavigateInLoop() || this.matchesPosition !== 1;
	}
	canNavigateForward() {
		return this.canNavigateInLoop() || this.matchesPosition < this.matchesCount;
	}
	canNavigateInLoop() {
		return this._loop || this.matchesCount >= 19999;
	}
}, NLS_DEFAULT_LABEL = localize("defaultLabel", "input"), NLS_PRESERVE_CASE_LABEL = localize("label.preserveCaseToggle", "Preserve Case"), PreserveCaseToggle = class extends Toggle {
	constructor(e) {
		super({
			icon: Codicon.preserveCase,
			title: NLS_PRESERVE_CASE_LABEL + e.appendTitle,
			isChecked: e.isChecked,
			hoverDelegate: e.hoverDelegate ?? getDefaultHoverDelegate("element"),
			inputActiveOptionBorder: e.inputActiveOptionBorder,
			inputActiveOptionForeground: e.inputActiveOptionForeground,
			inputActiveOptionBackground: e.inputActiveOptionBackground
		});
	}
}, ReplaceInput = class extends Widget {
	constructor(e, O, k, A) {
		super(), this._showOptionButtons = k, this.fixFocusOnOptionClickEnabled = !0, this.cachedOptionsWidth = 0, this._onDidOptionChange = this._register(new Emitter()), this.onDidOptionChange = this._onDidOptionChange.event, this._onKeyDown = this._register(new Emitter()), this.onKeyDown = this._onKeyDown.event, this._onMouseDown = this._register(new Emitter()), this._onInput = this._register(new Emitter()), this._onKeyUp = this._register(new Emitter()), this._onPreserveCaseKeyDown = this._register(new Emitter()), this.onPreserveCaseKeyDown = this._onPreserveCaseKeyDown.event, this.contextViewProvider = O, this.placeholder = A.placeholder || "", this.validation = A.validation, this.label = A.label || NLS_DEFAULT_LABEL;
		let j = A.appendPreserveCaseLabel || "", M = A.history || [], N = !!A.flexibleHeight, P = !!A.flexibleWidth, F = A.flexibleMaxHeight;
		this.domNode = document.createElement("div"), this.domNode.classList.add("monaco-findInput"), this.inputBox = this._register(new HistoryInputBox(this.domNode, this.contextViewProvider, {
			ariaLabel: this.label || "",
			placeholder: this.placeholder || "",
			validationOptions: { validation: this.validation },
			history: M,
			showHistoryHint: A.showHistoryHint,
			flexibleHeight: N,
			flexibleWidth: P,
			flexibleMaxHeight: F,
			inputBoxStyles: A.inputBoxStyles
		})), this.preserveCase = this._register(new PreserveCaseToggle({
			appendTitle: j,
			isChecked: !1,
			...A.toggleStyles
		})), this._register(this.preserveCase.onChange((e) => {
			this._onDidOptionChange.fire(e), !e && this.fixFocusOnOptionClickEnabled && this.inputBox.focus(), this.validate();
		})), this._register(this.preserveCase.onKeyDown((e) => {
			this._onPreserveCaseKeyDown.fire(e);
		})), this._showOptionButtons ? this.cachedOptionsWidth = this.preserveCase.width() : this.cachedOptionsWidth = 0;
		let I = [this.preserveCase.domNode];
		this.onkeydown(this.domNode, (e) => {
			if (e.equals(15) || e.equals(17) || e.equals(9)) {
				let O = I.indexOf(this.domNode.ownerDocument.activeElement);
				if (O >= 0) {
					let k = -1;
					e.equals(17) ? k = (O + 1) % I.length : e.equals(15) && (k = O === 0 ? I.length - 1 : O - 1), e.equals(9) ? (I[O].blur(), this.inputBox.focus()) : k >= 0 && I[k].focus(), EventHelper.stop(e, !0);
				}
			}
		});
		let L = document.createElement("div");
		L.className = "controls", L.style.display = this._showOptionButtons ? "block" : "none", L.appendChild(this.preserveCase.domNode), this.domNode.appendChild(L), e?.appendChild(this.domNode), this.onkeydown(this.inputBox.inputElement, (e) => this._onKeyDown.fire(e)), this.onkeyup(this.inputBox.inputElement, (e) => this._onKeyUp.fire(e)), this.oninput(this.inputBox.inputElement, (e) => this._onInput.fire()), this.onmousedown(this.inputBox.inputElement, (e) => this._onMouseDown.fire(e));
	}
	enable() {
		this.domNode.classList.remove("disabled"), this.inputBox.enable(), this.preserveCase.enable();
	}
	disable() {
		this.domNode.classList.add("disabled"), this.inputBox.disable(), this.preserveCase.disable();
	}
	setEnabled(e) {
		e ? this.enable() : this.disable();
	}
	select() {
		this.inputBox.select();
	}
	focus() {
		this.inputBox.focus();
	}
	getPreserveCase() {
		return this.preserveCase.checked;
	}
	setPreserveCase(e) {
		this.preserveCase.checked = e;
	}
	focusOnPreserve() {
		this.preserveCase.focus();
	}
	validate() {
		this.inputBox?.validate();
	}
	set width(e) {
		this.inputBox.paddingRight = this.cachedOptionsWidth, this.domNode.style.width = e + "px";
	}
	dispose() {
		super.dispose();
	}
}, __decorate$69 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$69 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
};
const historyNavigationVisible = new RawContextKey("suggestWidgetVisible", !1, localize("suggestWidgetVisible", "Whether suggestion are visible"));
var HistoryNavigationWidgetFocusContext = "historyNavigationWidgetFocus", HistoryNavigationForwardsEnablementContext = "historyNavigationForwardsEnabled", HistoryNavigationBackwardsEnablementContext = "historyNavigationBackwardsEnabled", lastFocusedWidget = void 0, widgets = [];
function registerAndCreateHistoryNavigationContext(e, O) {
	if (widgets.includes(O)) throw Error("Cannot register the same widget multiple times");
	widgets.push(O);
	let k = new DisposableStore(), A = new RawContextKey(HistoryNavigationWidgetFocusContext, !1).bindTo(e), j = new RawContextKey(HistoryNavigationForwardsEnablementContext, !0).bindTo(e), M = new RawContextKey(HistoryNavigationBackwardsEnablementContext, !0).bindTo(e), N = () => {
		A.set(!0), lastFocusedWidget = O;
	}, P = () => {
		A.set(!1), lastFocusedWidget === O && (lastFocusedWidget = void 0);
	};
	return isActiveElement(O.element) && N(), k.add(O.onDidFocus(() => N())), k.add(O.onDidBlur(() => P())), k.add(toDisposable(() => {
		widgets.splice(widgets.indexOf(O), 1), P();
	})), {
		historyNavigationForwardsEnablement: j,
		historyNavigationBackwardsEnablement: M,
		dispose() {
			k.dispose();
		}
	};
}
var ContextScopedFindInput = class extends FindInput {
	constructor(e, O, k, A) {
		super(e, O, k);
		let j = this._register(A.createScoped(this.inputBox.element));
		this._register(registerAndCreateHistoryNavigationContext(j, this.inputBox));
	}
};
ContextScopedFindInput = __decorate$69([__param$69(3, IContextKeyService)], ContextScopedFindInput);
var ContextScopedReplaceInput = class extends ReplaceInput {
	constructor(e, O, k, A, j = !1) {
		super(e, O, j, k);
		let M = this._register(A.createScoped(this.inputBox.element));
		this._register(registerAndCreateHistoryNavigationContext(M, this.inputBox));
	}
};
ContextScopedReplaceInput = __decorate$69([__param$69(3, IContextKeyService)], ContextScopedReplaceInput), KeybindingsRegistry.registerCommandAndKeybindingRule({
	id: "history.showPrevious",
	weight: 200,
	when: ContextKeyExpr.and(ContextKeyExpr.has(HistoryNavigationWidgetFocusContext), ContextKeyExpr.equals(HistoryNavigationBackwardsEnablementContext, !0), ContextKeyExpr.not("isComposing"), historyNavigationVisible.isEqualTo(!1)),
	primary: 16,
	secondary: [528],
	handler: (e) => {
		lastFocusedWidget?.showPreviousValue();
	}
}), KeybindingsRegistry.registerCommandAndKeybindingRule({
	id: "history.showNext",
	weight: 200,
	when: ContextKeyExpr.and(ContextKeyExpr.has(HistoryNavigationWidgetFocusContext), ContextKeyExpr.equals(HistoryNavigationForwardsEnablementContext, !0), ContextKeyExpr.not("isComposing"), historyNavigationVisible.isEqualTo(!1)),
	primary: 18,
	secondary: [530],
	handler: (e) => {
		lastFocusedWidget?.showNextValue();
	}
});
function showHistoryKeybindingHint(e) {
	return e.lookupKeybinding("history.showPrevious")?.getElectronAccelerator() === "Up" && e.lookupKeybinding("history.showNext")?.getElectronAccelerator() === "Down";
}
var findCollapsedIcon = registerIcon("find-collapsed", Codicon.chevronRight, localize("findCollapsedIcon", "Icon to indicate that the editor find widget is collapsed.")), findExpandedIcon = registerIcon("find-expanded", Codicon.chevronDown, localize("findExpandedIcon", "Icon to indicate that the editor find widget is expanded."));
const findSelectionIcon = registerIcon("find-selection", Codicon.selection, localize("findSelectionIcon", "Icon for 'Find in Selection' in the editor find widget.")), findReplaceIcon = registerIcon("find-replace", Codicon.replace, localize("findReplaceIcon", "Icon for 'Replace' in the editor find widget.")), findReplaceAllIcon = registerIcon("find-replace-all", Codicon.replaceAll, localize("findReplaceAllIcon", "Icon for 'Replace All' in the editor find widget.")), findPreviousMatchIcon = registerIcon("find-previous-match", Codicon.arrowUp, localize("findPreviousMatchIcon", "Icon for 'Find Previous' in the editor find widget.")), findNextMatchIcon = registerIcon("find-next-match", Codicon.arrowDown, localize("findNextMatchIcon", "Icon for 'Find Next' in the editor find widget."));
var NLS_FIND_DIALOG_LABEL = localize("label.findDialog", "Find / Replace"), NLS_FIND_INPUT_LABEL = localize("label.find", "Find"), NLS_FIND_INPUT_PLACEHOLDER = localize("placeholder.find", "Find"), NLS_PREVIOUS_MATCH_BTN_LABEL = localize("label.previousMatchButton", "Previous Match"), NLS_NEXT_MATCH_BTN_LABEL = localize("label.nextMatchButton", "Next Match"), NLS_TOGGLE_SELECTION_FIND_TITLE = localize("label.toggleSelectionFind", "Find in Selection"), NLS_CLOSE_BTN_LABEL = localize("label.closeButton", "Close"), NLS_REPLACE_INPUT_LABEL = localize("label.replace", "Replace"), NLS_REPLACE_INPUT_PLACEHOLDER = localize("placeholder.replace", "Replace"), NLS_REPLACE_BTN_LABEL = localize("label.replaceButton", "Replace"), NLS_REPLACE_ALL_BTN_LABEL = localize("label.replaceAllButton", "Replace All"), NLS_TOGGLE_REPLACE_MODE_BTN_LABEL = localize("label.toggleReplaceButton", "Toggle Replace"), NLS_MATCHES_COUNT_LIMIT_TITLE = localize("title.matchesCountLimit", "Only the first {0} results are highlighted, but all find operations work on the entire text.", MATCHES_LIMIT);
const NLS_MATCHES_LOCATION = localize("label.matchesLocation", "{0} of {1}"), NLS_NO_RESULTS = localize("label.noResults", "No results");
var FIND_WIDGET_INITIAL_WIDTH = 419, FIND_INPUT_AREA_WIDTH = 221, MAX_MATCHES_COUNT_WIDTH = 69, FIND_INPUT_AREA_HEIGHT = 33, ctrlEnterReplaceAllWarningPromptedKey = "ctrlEnterReplaceAll.windows.donotask", ctrlKeyMod = isMacintosh ? 256 : 2048, FindWidgetViewZone = class {
	constructor(e) {
		this.afterLineNumber = e, this.heightInPx = FIND_INPUT_AREA_HEIGHT, this.suppressMouseDown = !1, this.domNode = document.createElement("div"), this.domNode.className = "dock-find-viewzone";
	}
};
function stopPropagationForMultiLineUpwards(e, O, k) {
	let A = !!O.match(/\n/);
	if (k && A && k.selectionStart > 0) {
		e.stopPropagation();
		return;
	}
}
function stopPropagationForMultiLineDownwards(e, O, k) {
	let A = !!O.match(/\n/);
	if (k && A && k.selectionEnd < k.value.length) {
		e.stopPropagation();
		return;
	}
}
var FindWidget = class e extends Widget {
	static {
		this.ID = "editor.contrib.findWidget";
	}
	constructor(e, O, k, A, j, M, N, P, F, I) {
		super(), this._hoverService = I, this._cachedHeight = null, this._revealTimeouts = [], this._codeEditor = e, this._controller = O, this._state = k, this._contextViewProvider = A, this._keybindingService = j, this._contextKeyService = M, this._storageService = P, this._notificationService = F, this._ctrlEnterReplaceAllWarningPrompted = !!P.getBoolean(ctrlEnterReplaceAllWarningPromptedKey, 0), this._isVisible = !1, this._isReplaceVisible = !1, this._ignoreChangeEvent = !1, this._updateHistoryDelayer = new Delayer(500), this._register(toDisposable(() => this._updateHistoryDelayer.cancel())), this._register(this._state.onFindReplaceStateChange((e) => this._onStateChanged(e))), this._buildDomNode(), this._updateButtons(), this._tryUpdateWidgetWidth(), this._findInput.inputBox.layout(), this._register(this._codeEditor.onDidChangeConfiguration((e) => {
			if (e.hasChanged(92) && (this._codeEditor.getOption(92) && this._state.change({ isReplaceRevealed: !1 }, !1), this._updateButtons()), e.hasChanged(146) && this._tryUpdateWidgetWidth(), e.hasChanged(2) && this.updateAccessibilitySupport(), e.hasChanged(41)) {
				let e = this._codeEditor.getOption(41).loop;
				this._state.change({ loop: e }, !1);
				let O = this._codeEditor.getOption(41).addExtraSpaceOnTop;
				O && !this._viewZone && (this._viewZone = new FindWidgetViewZone(0), this._showViewZone()), !O && this._viewZone && this._removeViewZone();
			}
		})), this.updateAccessibilitySupport(), this._register(this._codeEditor.onDidChangeCursorSelection(() => {
			this._isVisible && this._updateToggleSelectionFindButton();
		})), this._register(this._codeEditor.onDidFocusEditorWidget(async () => {
			if (this._isVisible) {
				let e = await this._controller.getGlobalBufferTerm();
				e && e !== this._state.searchString && (this._state.change({ searchString: e }, !1), this._findInput.select());
			}
		})), this._findInputFocused = CONTEXT_FIND_INPUT_FOCUSED.bindTo(M), this._findFocusTracker = this._register(trackFocus(this._findInput.inputBox.inputElement)), this._register(this._findFocusTracker.onDidFocus(() => {
			this._findInputFocused.set(!0), this._updateSearchScope();
		})), this._register(this._findFocusTracker.onDidBlur(() => {
			this._findInputFocused.set(!1);
		})), this._replaceInputFocused = CONTEXT_REPLACE_INPUT_FOCUSED.bindTo(M), this._replaceFocusTracker = this._register(trackFocus(this._replaceInput.inputBox.inputElement)), this._register(this._replaceFocusTracker.onDidFocus(() => {
			this._replaceInputFocused.set(!0), this._updateSearchScope();
		})), this._register(this._replaceFocusTracker.onDidBlur(() => {
			this._replaceInputFocused.set(!1);
		})), this._codeEditor.addOverlayWidget(this), this._codeEditor.getOption(41).addExtraSpaceOnTop && (this._viewZone = new FindWidgetViewZone(0)), this._register(this._codeEditor.onDidChangeModel(() => {
			this._isVisible && (this._viewZoneId = void 0);
		})), this._register(this._codeEditor.onDidScrollChange((e) => {
			if (e.scrollTopChanged) {
				this._layoutViewZone();
				return;
			}
			setTimeout(() => {
				this._layoutViewZone();
			}, 0);
		}));
	}
	getId() {
		return e.ID;
	}
	getDomNode() {
		return this._domNode;
	}
	getPosition() {
		return this._isVisible ? { preference: 0 } : null;
	}
	_onStateChanged(e) {
		if (e.searchString) {
			try {
				this._ignoreChangeEvent = !0, this._findInput.setValue(this._state.searchString);
			} finally {
				this._ignoreChangeEvent = !1;
			}
			this._updateButtons();
		}
		if (e.replaceString && (this._replaceInput.inputBox.value = this._state.replaceString), e.isRevealed && (this._state.isRevealed ? this._reveal() : this._hide(!0)), e.isReplaceRevealed && (this._state.isReplaceRevealed ? !this._codeEditor.getOption(92) && !this._isReplaceVisible && (this._isReplaceVisible = !0, this._replaceInput.width = getTotalWidth(this._findInput.domNode), this._updateButtons(), this._replaceInput.inputBox.layout()) : this._isReplaceVisible && (this._isReplaceVisible = !1, this._updateButtons())), (e.isRevealed || e.isReplaceRevealed) && (this._state.isRevealed || this._state.isReplaceRevealed) && this._tryUpdateHeight() && this._showViewZone(), e.isRegex && this._findInput.setRegex(this._state.isRegex), e.wholeWord && this._findInput.setWholeWords(this._state.wholeWord), e.matchCase && this._findInput.setCaseSensitive(this._state.matchCase), e.preserveCase && this._replaceInput.setPreserveCase(this._state.preserveCase), e.searchScope && (this._state.searchScope ? this._toggleSelectionFind.checked = !0 : this._toggleSelectionFind.checked = !1, this._updateToggleSelectionFindButton()), e.searchString || e.matchesCount || e.matchesPosition) {
			let e = this._state.searchString.length > 0 && this._state.matchesCount === 0;
			this._domNode.classList.toggle("no-results", e), this._updateMatchesCount(), this._updateButtons();
		}
		(e.searchString || e.currentMatch) && this._layoutViewZone(), e.updateHistory && this._delayedUpdateHistory(), e.loop && this._updateButtons();
	}
	_delayedUpdateHistory() {
		this._updateHistoryDelayer.trigger(this._updateHistory.bind(this)).then(void 0, onUnexpectedError);
	}
	_updateHistory() {
		this._state.searchString && this._findInput.inputBox.addToHistory(), this._state.replaceString && this._replaceInput.inputBox.addToHistory();
	}
	_updateMatchesCount() {
		this._matchesCount.style.minWidth = MAX_MATCHES_COUNT_WIDTH + "px", this._state.matchesCount >= 19999 ? this._matchesCount.title = NLS_MATCHES_COUNT_LIMIT_TITLE : this._matchesCount.title = "", this._matchesCount.firstChild?.remove();
		let e;
		if (this._state.matchesCount > 0) {
			let O = String(this._state.matchesCount);
			this._state.matchesCount >= 19999 && (O += "+");
			let k = String(this._state.matchesPosition);
			k === "0" && (k = "?"), e = format(NLS_MATCHES_LOCATION, k, O);
		} else e = NLS_NO_RESULTS;
		this._matchesCount.appendChild(document.createTextNode(e)), alert(this._getAriaLabel(e, this._state.currentMatch, this._state.searchString)), MAX_MATCHES_COUNT_WIDTH = Math.max(MAX_MATCHES_COUNT_WIDTH, this._matchesCount.clientWidth);
	}
	_getAriaLabel(e, O, k) {
		if (e === NLS_NO_RESULTS) return k === "" ? localize("ariaSearchNoResultEmpty", "{0} found", e) : localize("ariaSearchNoResult", "{0} found for '{1}'", e, k);
		if (O) {
			let A = localize("ariaSearchNoResultWithLineNum", "{0} found for '{1}', at {2}", e, k, O.startLineNumber + ":" + O.startColumn), j = this._codeEditor.getModel();
			return j && O.startLineNumber <= j.getLineCount() && O.startLineNumber >= 1 ? `${j.getLineContent(O.startLineNumber)}, ${A}` : A;
		}
		return localize("ariaSearchNoResultWithLineNumNoCurrentMatch", "{0} found for '{1}'", e, k);
	}
	_updateToggleSelectionFindButton() {
		let e = this._codeEditor.getSelection(), O = e ? e.startLineNumber !== e.endLineNumber || e.startColumn !== e.endColumn : !1, k = this._toggleSelectionFind.checked;
		this._isVisible && (k || O) ? this._toggleSelectionFind.enable() : this._toggleSelectionFind.disable();
	}
	_updateButtons() {
		this._findInput.setEnabled(this._isVisible), this._replaceInput.setEnabled(this._isVisible && this._isReplaceVisible), this._updateToggleSelectionFindButton(), this._closeBtn.setEnabled(this._isVisible);
		let e = this._state.searchString.length > 0, O = !!this._state.matchesCount;
		this._prevBtn.setEnabled(this._isVisible && e && O && this._state.canNavigateBack()), this._nextBtn.setEnabled(this._isVisible && e && O && this._state.canNavigateForward()), this._replaceBtn.setEnabled(this._isVisible && this._isReplaceVisible && e), this._replaceAllBtn.setEnabled(this._isVisible && this._isReplaceVisible && e), this._domNode.classList.toggle("replaceToggled", this._isReplaceVisible), this._toggleReplaceBtn.setExpanded(this._isReplaceVisible);
		let k = !this._codeEditor.getOption(92);
		this._toggleReplaceBtn.setEnabled(this._isVisible && k);
	}
	_reveal() {
		if (this._revealTimeouts.forEach((e) => {
			clearTimeout(e);
		}), this._revealTimeouts = [], !this._isVisible) {
			this._isVisible = !0;
			let e = this._codeEditor.getSelection();
			switch (this._codeEditor.getOption(41).autoFindInSelection) {
				case "always":
					this._toggleSelectionFind.checked = !0;
					break;
				case "never":
					this._toggleSelectionFind.checked = !1;
					break;
				case "multiline": {
					let O = !!e && e.startLineNumber !== e.endLineNumber;
					this._toggleSelectionFind.checked = O;
					break;
				}
				default: break;
			}
			this._tryUpdateWidgetWidth(), this._updateButtons(), this._revealTimeouts.push(setTimeout(() => {
				this._domNode.classList.add("visible"), this._domNode.setAttribute("aria-hidden", "false");
			}, 0)), this._revealTimeouts.push(setTimeout(() => {
				this._findInput.validate();
			}, 200)), this._codeEditor.layoutOverlayWidget(this);
			let O = !0;
			if (this._codeEditor.getOption(41).seedSearchStringFromSelection && e) {
				let k = this._codeEditor.getDomNode();
				if (k) {
					let A = getDomNodePagePosition(k), j = this._codeEditor.getScrolledVisiblePosition(e.getStartPosition()), M = A.left + (j ? j.left : 0), N = j ? j.top : 0;
					if (this._viewZone && N < this._viewZone.heightInPx) {
						e.endLineNumber > e.startLineNumber && (O = !1);
						let k = getTopLeftOffset(this._domNode).left;
						M > k && (O = !1);
						let j = this._codeEditor.getScrolledVisiblePosition(e.getEndPosition());
						A.left + (j ? j.left : 0) > k && (O = !1);
					}
				}
			}
			this._showViewZone(O);
		}
	}
	_hide(e) {
		this._revealTimeouts.forEach((e) => {
			clearTimeout(e);
		}), this._revealTimeouts = [], this._isVisible && (this._isVisible = !1, this._updateButtons(), this._domNode.classList.remove("visible"), this._domNode.setAttribute("aria-hidden", "true"), this._findInput.clearMessage(), e && this._codeEditor.focus(), this._codeEditor.layoutOverlayWidget(this), this._removeViewZone());
	}
	_layoutViewZone(e) {
		if (!this._codeEditor.getOption(41).addExtraSpaceOnTop) {
			this._removeViewZone();
			return;
		}
		if (!this._isVisible) return;
		let O = this._viewZone;
		this._viewZoneId !== void 0 || !O || this._codeEditor.changeViewZones((k) => {
			O.heightInPx = this._getHeight(), this._viewZoneId = k.addZone(O), this._codeEditor.setScrollTop(e || this._codeEditor.getScrollTop() + O.heightInPx);
		});
	}
	_showViewZone(e = !0) {
		if (!this._isVisible || !this._codeEditor.getOption(41).addExtraSpaceOnTop) return;
		this._viewZone === void 0 && (this._viewZone = new FindWidgetViewZone(0));
		let O = this._viewZone;
		this._codeEditor.changeViewZones((k) => {
			if (this._viewZoneId !== void 0) {
				let A = this._getHeight();
				if (A === O.heightInPx) return;
				let j = A - O.heightInPx;
				O.heightInPx = A, k.layoutZone(this._viewZoneId), e && this._codeEditor.setScrollTop(this._codeEditor.getScrollTop() + j);
				return;
			} else {
				let A = this._getHeight();
				if (A -= this._codeEditor.getOption(84).top, A <= 0) return;
				O.heightInPx = A, this._viewZoneId = k.addZone(O), e && this._codeEditor.setScrollTop(this._codeEditor.getScrollTop() + A);
			}
		});
	}
	_removeViewZone() {
		this._codeEditor.changeViewZones((e) => {
			this._viewZoneId !== void 0 && (e.removeZone(this._viewZoneId), this._viewZoneId = void 0, this._viewZone &&= (this._codeEditor.setScrollTop(this._codeEditor.getScrollTop() - this._viewZone.heightInPx), void 0));
		});
	}
	_tryUpdateWidgetWidth() {
		if (!this._isVisible || !this._domNode.isConnected) return;
		let e = this._codeEditor.getLayoutInfo();
		if (e.contentWidth <= 0) {
			this._domNode.classList.add("hiddenEditor");
			return;
		} else this._domNode.classList.contains("hiddenEditor") && this._domNode.classList.remove("hiddenEditor");
		let O = e.width, k = e.minimap.minimapWidth, A = !1, j = !1, M = !1;
		if (this._resized && getTotalWidth(this._domNode) > FIND_WIDGET_INITIAL_WIDTH) {
			this._domNode.style.maxWidth = `${O - 28 - k - 15}px`, this._replaceInput.width = getTotalWidth(this._findInput.domNode);
			return;
		}
		if (FIND_WIDGET_INITIAL_WIDTH + 28 + k >= O && (j = !0), FIND_WIDGET_INITIAL_WIDTH + 28 + k - MAX_MATCHES_COUNT_WIDTH >= O && (M = !0), FIND_WIDGET_INITIAL_WIDTH + 28 + k - MAX_MATCHES_COUNT_WIDTH >= O + 50 && (A = !0), this._domNode.classList.toggle("collapsed-find-widget", A), this._domNode.classList.toggle("narrow-find-widget", M), this._domNode.classList.toggle("reduced-find-widget", j), !M && !A && (this._domNode.style.maxWidth = `${O - 28 - k - 15}px`), this._findInput.layout({
			collapsedFindWidget: A,
			narrowFindWidget: M,
			reducedFindWidget: j
		}), this._resized) {
			let e = this._findInput.inputBox.element.clientWidth;
			e > 0 && (this._replaceInput.width = e);
		} else this._isReplaceVisible && (this._replaceInput.width = getTotalWidth(this._findInput.domNode));
	}
	_getHeight() {
		let e = 0;
		return e += 4, e += this._findInput.inputBox.height + 2, this._isReplaceVisible && (e += 4, e += this._replaceInput.inputBox.height + 2), e += 4, e;
	}
	_tryUpdateHeight() {
		let e = this._getHeight();
		return this._cachedHeight !== null && this._cachedHeight === e ? !1 : (this._cachedHeight = e, this._domNode.style.height = `${e}px`, !0);
	}
	focusFindInput() {
		this._findInput.select(), this._findInput.focus();
	}
	focusReplaceInput() {
		this._replaceInput.select(), this._replaceInput.focus();
	}
	highlightFindOptions() {
		this._findInput.highlightFindOptions();
	}
	_updateSearchScope() {
		if (this._codeEditor.hasModel() && this._toggleSelectionFind.checked) {
			let e = this._codeEditor.getSelections();
			e.map((e) => {
				e.endColumn === 1 && e.endLineNumber > e.startLineNumber && (e = e.setEndPosition(e.endLineNumber - 1, this._codeEditor.getModel().getLineMaxColumn(e.endLineNumber - 1)));
				let O = this._state.currentMatch;
				return e.startLineNumber !== e.endLineNumber && !Range.equalsRange(e, O) ? e : null;
			}).filter((e) => !!e), e.length && this._state.change({ searchScope: e }, !0);
		}
	}
	_onFindInputMouseDown(e) {
		e.middleButton && e.stopPropagation();
	}
	_onFindInputKeyDown(e) {
		if (e.equals(ctrlKeyMod | 3)) if (this._keybindingService.dispatchEvent(e, e.target)) {
			e.preventDefault();
			return;
		} else {
			this._findInput.inputBox.insertAtCursor("\n"), e.preventDefault();
			return;
		}
		if (e.equals(2)) {
			this._isReplaceVisible ? this._replaceInput.focus() : this._findInput.focusOnCaseSensitive(), e.preventDefault();
			return;
		}
		if (e.equals(2066)) {
			this._codeEditor.focus(), e.preventDefault();
			return;
		}
		if (e.equals(16)) return stopPropagationForMultiLineUpwards(e, this._findInput.getValue(), this._findInput.domNode.querySelector("textarea"));
		if (e.equals(18)) return stopPropagationForMultiLineDownwards(e, this._findInput.getValue(), this._findInput.domNode.querySelector("textarea"));
	}
	_onReplaceInputKeyDown(e) {
		if (e.equals(ctrlKeyMod | 3)) if (this._keybindingService.dispatchEvent(e, e.target)) {
			e.preventDefault();
			return;
		} else {
			isWindows && isNative && !this._ctrlEnterReplaceAllWarningPrompted && (this._notificationService.info(localize("ctrlEnter.keybindingChanged", "Ctrl+Enter now inserts line break instead of replacing all. You can modify the keybinding for editor.action.replaceAll to override this behavior.")), this._ctrlEnterReplaceAllWarningPrompted = !0, this._storageService.store(ctrlEnterReplaceAllWarningPromptedKey, !0, 0, 0)), this._replaceInput.inputBox.insertAtCursor("\n"), e.preventDefault();
			return;
		}
		if (e.equals(2)) {
			this._findInput.focusOnCaseSensitive(), e.preventDefault();
			return;
		}
		if (e.equals(1026)) {
			this._findInput.focus(), e.preventDefault();
			return;
		}
		if (e.equals(2066)) {
			this._codeEditor.focus(), e.preventDefault();
			return;
		}
		if (e.equals(16)) return stopPropagationForMultiLineUpwards(e, this._replaceInput.inputBox.value, this._replaceInput.inputBox.element.querySelector("textarea"));
		if (e.equals(18)) return stopPropagationForMultiLineDownwards(e, this._replaceInput.inputBox.value, this._replaceInput.inputBox.element.querySelector("textarea"));
	}
	getVerticalSashLeft(e) {
		return 0;
	}
	_keybindingLabelFor(e) {
		let O = this._keybindingService.lookupKeybinding(e);
		return O ? ` (${O.getLabel()})` : "";
	}
	_buildDomNode() {
		this._findInput = this._register(new ContextScopedFindInput(null, this._contextViewProvider, {
			width: FIND_INPUT_AREA_WIDTH,
			label: NLS_FIND_INPUT_LABEL,
			placeholder: NLS_FIND_INPUT_PLACEHOLDER,
			appendCaseSensitiveLabel: this._keybindingLabelFor(FIND_IDS.ToggleCaseSensitiveCommand),
			appendWholeWordsLabel: this._keybindingLabelFor(FIND_IDS.ToggleWholeWordCommand),
			appendRegexLabel: this._keybindingLabelFor(FIND_IDS.ToggleRegexCommand),
			validation: (e) => {
				if (e.length === 0 || !this._findInput.getRegex()) return null;
				try {
					return new RegExp(e, "gu"), null;
				} catch (e) {
					return { content: e.message };
				}
			},
			flexibleHeight: !0,
			flexibleWidth: !0,
			flexibleMaxHeight: 118,
			showCommonFindToggles: !0,
			showHistoryHint: () => showHistoryKeybindingHint(this._keybindingService),
			inputBoxStyles: defaultInputBoxStyles,
			toggleStyles: defaultToggleStyles
		}, this._contextKeyService)), this._findInput.setRegex(!!this._state.isRegex), this._findInput.setCaseSensitive(!!this._state.matchCase), this._findInput.setWholeWords(!!this._state.wholeWord), this._register(this._findInput.onKeyDown((e) => this._onFindInputKeyDown(e))), this._register(this._findInput.inputBox.onDidChange(() => {
			this._ignoreChangeEvent || this._state.change({ searchString: this._findInput.getValue() }, !0);
		})), this._register(this._findInput.onDidOptionChange(() => {
			this._state.change({
				isRegex: this._findInput.getRegex(),
				wholeWord: this._findInput.getWholeWords(),
				matchCase: this._findInput.getCaseSensitive()
			}, !0);
		})), this._register(this._findInput.onCaseSensitiveKeyDown((e) => {
			e.equals(1026) && this._isReplaceVisible && (this._replaceInput.focus(), e.preventDefault());
		})), this._register(this._findInput.onRegexKeyDown((e) => {
			e.equals(2) && this._isReplaceVisible && (this._replaceInput.focusOnPreserve(), e.preventDefault());
		})), this._register(this._findInput.inputBox.onDidHeightChange((e) => {
			this._tryUpdateHeight() && this._showViewZone();
		})), isLinux && this._register(this._findInput.onMouseDown((e) => this._onFindInputMouseDown(e))), this._matchesCount = document.createElement("div"), this._matchesCount.className = "matchesCount", this._updateMatchesCount();
		let e = this._register(createInstantHoverDelegate());
		this._prevBtn = this._register(new SimpleButton({
			label: NLS_PREVIOUS_MATCH_BTN_LABEL + this._keybindingLabelFor(FIND_IDS.PreviousMatchFindAction),
			icon: findPreviousMatchIcon,
			hoverDelegate: e,
			onTrigger: () => {
				assertIsDefined(this._codeEditor.getAction(FIND_IDS.PreviousMatchFindAction)).run().then(void 0, onUnexpectedError);
			}
		}, this._hoverService)), this._nextBtn = this._register(new SimpleButton({
			label: NLS_NEXT_MATCH_BTN_LABEL + this._keybindingLabelFor(FIND_IDS.NextMatchFindAction),
			icon: findNextMatchIcon,
			hoverDelegate: e,
			onTrigger: () => {
				assertIsDefined(this._codeEditor.getAction(FIND_IDS.NextMatchFindAction)).run().then(void 0, onUnexpectedError);
			}
		}, this._hoverService));
		let O = document.createElement("div");
		O.className = "find-part", O.appendChild(this._findInput.domNode);
		let k = document.createElement("div");
		k.className = "find-actions", O.appendChild(k), k.appendChild(this._matchesCount), k.appendChild(this._prevBtn.domNode), k.appendChild(this._nextBtn.domNode), this._toggleSelectionFind = this._register(new Toggle({
			icon: findSelectionIcon,
			title: NLS_TOGGLE_SELECTION_FIND_TITLE + this._keybindingLabelFor(FIND_IDS.ToggleSearchScopeCommand),
			isChecked: !1,
			hoverDelegate: e,
			inputActiveOptionBackground: asCssVariable(inputActiveOptionBackground),
			inputActiveOptionBorder: asCssVariable(inputActiveOptionBorder),
			inputActiveOptionForeground: asCssVariable(inputActiveOptionForeground)
		})), this._register(this._toggleSelectionFind.onChange(() => {
			if (this._toggleSelectionFind.checked) {
				if (this._codeEditor.hasModel()) {
					let e = this._codeEditor.getSelections();
					e = e.map((e) => (e.endColumn === 1 && e.endLineNumber > e.startLineNumber && (e = e.setEndPosition(e.endLineNumber - 1, this._codeEditor.getModel().getLineMaxColumn(e.endLineNumber - 1))), e.isEmpty() ? null : e)).filter((e) => !!e), e.length && this._state.change({ searchScope: e }, !0);
				}
			} else this._state.change({ searchScope: null }, !0);
		})), k.appendChild(this._toggleSelectionFind.domNode), this._closeBtn = this._register(new SimpleButton({
			label: NLS_CLOSE_BTN_LABEL + this._keybindingLabelFor(FIND_IDS.CloseFindWidgetCommand),
			icon: widgetClose,
			hoverDelegate: e,
			onTrigger: () => {
				this._state.change({
					isRevealed: !1,
					searchScope: null
				}, !1);
			},
			onKeyDown: (e) => {
				e.equals(2) && this._isReplaceVisible && (this._replaceBtn.isEnabled() ? this._replaceBtn.focus() : this._codeEditor.focus(), e.preventDefault());
			}
		}, this._hoverService)), this._replaceInput = this._register(new ContextScopedReplaceInput(null, void 0, {
			label: NLS_REPLACE_INPUT_LABEL,
			placeholder: NLS_REPLACE_INPUT_PLACEHOLDER,
			appendPreserveCaseLabel: this._keybindingLabelFor(FIND_IDS.TogglePreserveCaseCommand),
			history: [],
			flexibleHeight: !0,
			flexibleWidth: !0,
			flexibleMaxHeight: 118,
			showHistoryHint: () => showHistoryKeybindingHint(this._keybindingService),
			inputBoxStyles: defaultInputBoxStyles,
			toggleStyles: defaultToggleStyles
		}, this._contextKeyService, !0)), this._replaceInput.setPreserveCase(!!this._state.preserveCase), this._register(this._replaceInput.onKeyDown((e) => this._onReplaceInputKeyDown(e))), this._register(this._replaceInput.inputBox.onDidChange(() => {
			this._state.change({ replaceString: this._replaceInput.inputBox.value }, !1);
		})), this._register(this._replaceInput.inputBox.onDidHeightChange((e) => {
			this._isReplaceVisible && this._tryUpdateHeight() && this._showViewZone();
		})), this._register(this._replaceInput.onDidOptionChange(() => {
			this._state.change({ preserveCase: this._replaceInput.getPreserveCase() }, !0);
		})), this._register(this._replaceInput.onPreserveCaseKeyDown((e) => {
			e.equals(2) && (this._prevBtn.isEnabled() ? this._prevBtn.focus() : this._nextBtn.isEnabled() ? this._nextBtn.focus() : this._toggleSelectionFind.enabled ? this._toggleSelectionFind.focus() : this._closeBtn.isEnabled() && this._closeBtn.focus(), e.preventDefault());
		}));
		let A = this._register(createInstantHoverDelegate());
		this._replaceBtn = this._register(new SimpleButton({
			label: NLS_REPLACE_BTN_LABEL + this._keybindingLabelFor(FIND_IDS.ReplaceOneAction),
			icon: findReplaceIcon,
			hoverDelegate: A,
			onTrigger: () => {
				this._controller.replace();
			},
			onKeyDown: (e) => {
				e.equals(1026) && (this._closeBtn.focus(), e.preventDefault());
			}
		}, this._hoverService)), this._replaceAllBtn = this._register(new SimpleButton({
			label: NLS_REPLACE_ALL_BTN_LABEL + this._keybindingLabelFor(FIND_IDS.ReplaceAllAction),
			icon: findReplaceAllIcon,
			hoverDelegate: A,
			onTrigger: () => {
				this._controller.replaceAll();
			}
		}, this._hoverService));
		let j = document.createElement("div");
		j.className = "replace-part", j.appendChild(this._replaceInput.domNode);
		let M = document.createElement("div");
		M.className = "replace-actions", j.appendChild(M), M.appendChild(this._replaceBtn.domNode), M.appendChild(this._replaceAllBtn.domNode), this._toggleReplaceBtn = this._register(new SimpleButton({
			label: NLS_TOGGLE_REPLACE_MODE_BTN_LABEL,
			className: "codicon toggle left",
			onTrigger: () => {
				this._state.change({ isReplaceRevealed: !this._isReplaceVisible }, !1), this._isReplaceVisible && (this._replaceInput.width = getTotalWidth(this._findInput.domNode), this._replaceInput.inputBox.layout()), this._showViewZone();
			}
		}, this._hoverService)), this._toggleReplaceBtn.setExpanded(this._isReplaceVisible), this._domNode = document.createElement("div"), this._domNode.className = "editor-widget find-widget", this._domNode.setAttribute("aria-hidden", "true"), this._domNode.ariaLabel = NLS_FIND_DIALOG_LABEL, this._domNode.role = "dialog", this._domNode.style.width = `${FIND_WIDGET_INITIAL_WIDTH}px`, this._domNode.appendChild(this._toggleReplaceBtn.domNode), this._domNode.appendChild(O), this._domNode.appendChild(this._closeBtn.domNode), this._domNode.appendChild(j), this._resizeSash = this._register(new Sash(this._domNode, this, {
			orientation: 0,
			size: 2
		})), this._resized = !1;
		let N = FIND_WIDGET_INITIAL_WIDTH;
		this._register(this._resizeSash.onDidStart(() => {
			N = getTotalWidth(this._domNode);
		})), this._register(this._resizeSash.onDidChange((e) => {
			this._resized = !0;
			let O = N + e.startX - e.currentX;
			if (O < FIND_WIDGET_INITIAL_WIDTH) return;
			let k = parseFloat(getComputedStyle(this._domNode).maxWidth) || 0;
			O > k || (this._domNode.style.width = `${O}px`, this._isReplaceVisible && (this._replaceInput.width = getTotalWidth(this._findInput.domNode)), this._findInput.inputBox.layout(), this._tryUpdateHeight());
		})), this._register(this._resizeSash.onDidReset(() => {
			let e = getTotalWidth(this._domNode);
			if (e < FIND_WIDGET_INITIAL_WIDTH) return;
			let O = FIND_WIDGET_INITIAL_WIDTH;
			if (!this._resized || e === FIND_WIDGET_INITIAL_WIDTH) {
				let e = this._codeEditor.getLayoutInfo();
				O = e.width - 28 - e.minimap.minimapWidth - 15, this._resized = !0;
			}
			this._domNode.style.width = `${O}px`, this._isReplaceVisible && (this._replaceInput.width = getTotalWidth(this._findInput.domNode)), this._findInput.inputBox.layout();
		}));
	}
	updateAccessibilitySupport() {
		let e = this._codeEditor.getOption(2);
		this._findInput.setFocusInputOnOptionClick(e !== 2);
	}
}, SimpleButton = class extends Widget {
	constructor(e, O) {
		super(), this._opts = e;
		let k = "button";
		this._opts.className && (k = k + " " + this._opts.className), this._opts.icon && (k = k + " " + ThemeIcon.asClassName(this._opts.icon)), this._domNode = document.createElement("div"), this._domNode.tabIndex = 0, this._domNode.className = k, this._domNode.setAttribute("role", "button"), this._domNode.setAttribute("aria-label", this._opts.label), this._register(O.setupManagedHover(e.hoverDelegate ?? getDefaultHoverDelegate("element"), this._domNode, this._opts.label)), this.onclick(this._domNode, (e) => {
			this._opts.onTrigger(), e.preventDefault();
		}), this.onkeydown(this._domNode, (e) => {
			if (e.equals(10) || e.equals(3)) {
				this._opts.onTrigger(), e.preventDefault();
				return;
			}
			this._opts.onKeyDown?.(e);
		});
	}
	get domNode() {
		return this._domNode;
	}
	isEnabled() {
		return this._domNode.tabIndex >= 0;
	}
	focus() {
		this._domNode.focus();
	}
	setEnabled(e) {
		this._domNode.classList.toggle("disabled", !e), this._domNode.setAttribute("aria-disabled", String(!e)), this._domNode.tabIndex = e ? 0 : -1;
	}
	setExpanded(e) {
		this._domNode.setAttribute("aria-expanded", String(!!e)), e ? (this._domNode.classList.remove(...ThemeIcon.asClassNameArray(findCollapsedIcon)), this._domNode.classList.add(...ThemeIcon.asClassNameArray(findExpandedIcon))) : (this._domNode.classList.remove(...ThemeIcon.asClassNameArray(findExpandedIcon)), this._domNode.classList.add(...ThemeIcon.asClassNameArray(findCollapsedIcon)));
	}
};
registerThemingParticipant((e, O) => {
	let k = e.getColor(editorFindMatchHighlightBorder);
	k && O.addRule(`.monaco-editor .findMatch { border: 1px ${isHighContrast(e.type) ? "dotted" : "solid"} ${k}; box-sizing: border-box; }`);
	let A = e.getColor(editorFindRangeHighlightBorder);
	A && O.addRule(`.monaco-editor .findScope { border: 1px ${isHighContrast(e.type) ? "dashed" : "solid"} ${A}; }`);
	let j = e.getColor(contrastBorder);
	j && O.addRule(`.monaco-editor .find-widget { border: 1px solid ${j}; }`);
	let M = e.getColor(editorFindMatchForeground);
	M && O.addRule(`.monaco-editor .findMatchInline { color: ${M}; }`);
	let N = e.getColor(editorFindMatchHighlightForeground);
	N && O.addRule(`.monaco-editor .currentFindMatchInline { color: ${N}; }`);
});
var __decorate$68 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$68 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, CommonFindController_1, SEARCH_STRING_MAX_LENGTH = 524288;
function getSelectionSearchString(e, O = "single", k = !1) {
	if (!e.hasModel()) return null;
	let A = e.getSelection();
	if (O === "single" && A.startLineNumber === A.endLineNumber || O === "multiple") {
		if (A.isEmpty()) {
			let O = e.getConfiguredWordAtPosition(A.getStartPosition());
			if (O && !1 === k) return O.word;
		} else if (e.getModel().getValueLengthInRange(A) < SEARCH_STRING_MAX_LENGTH) return e.getModel().getValueInRange(A);
	}
	return null;
}
var CommonFindController = class extends Disposable {
	static {
		CommonFindController_1 = this;
	}
	static {
		this.ID = "editor.contrib.findController";
	}
	get editor() {
		return this._editor;
	}
	static get(e) {
		return e.getContribution(CommonFindController_1.ID);
	}
	constructor(e, O, k, A, j, M) {
		super(), this._editor = e, this._findWidgetVisible = CONTEXT_FIND_WIDGET_VISIBLE.bindTo(O), this._contextKeyService = O, this._storageService = k, this._clipboardService = A, this._notificationService = j, this._hoverService = M, this._updateHistoryDelayer = new Delayer(500), this._state = this._register(new FindReplaceState()), this.loadQueryState(), this._register(this._state.onFindReplaceStateChange((e) => this._onStateChanged(e))), this._model = null, this._register(this._editor.onDidChangeModel(() => {
			let e = this._editor.getModel() && this._state.isRevealed;
			this.disposeModel(), this._state.change({
				searchScope: null,
				matchCase: this._storageService.getBoolean("editor.matchCase", 1, !1),
				wholeWord: this._storageService.getBoolean("editor.wholeWord", 1, !1),
				isRegex: this._storageService.getBoolean("editor.isRegex", 1, !1),
				preserveCase: this._storageService.getBoolean("editor.preserveCase", 1, !1)
			}, !1), e && this._start({
				forceRevealReplace: !1,
				seedSearchStringFromSelection: "none",
				seedSearchStringFromNonEmptySelection: !1,
				seedSearchStringFromGlobalClipboard: !1,
				shouldFocus: 0,
				shouldAnimate: !1,
				updateSearchScope: !1,
				loop: this._editor.getOption(41).loop
			});
		}));
	}
	dispose() {
		this.disposeModel(), super.dispose();
	}
	disposeModel() {
		this._model &&= (this._model.dispose(), null);
	}
	_onStateChanged(e) {
		this.saveQueryState(e), e.isRevealed && (this._state.isRevealed ? this._findWidgetVisible.set(!0) : (this._findWidgetVisible.reset(), this.disposeModel())), e.searchString && this.setGlobalBufferTerm(this._state.searchString);
	}
	saveQueryState(e) {
		e.isRegex && this._storageService.store("editor.isRegex", this._state.actualIsRegex, 1, 1), e.wholeWord && this._storageService.store("editor.wholeWord", this._state.actualWholeWord, 1, 1), e.matchCase && this._storageService.store("editor.matchCase", this._state.actualMatchCase, 1, 1), e.preserveCase && this._storageService.store("editor.preserveCase", this._state.actualPreserveCase, 1, 1);
	}
	loadQueryState() {
		this._state.change({
			matchCase: this._storageService.getBoolean("editor.matchCase", 1, this._state.matchCase),
			wholeWord: this._storageService.getBoolean("editor.wholeWord", 1, this._state.wholeWord),
			isRegex: this._storageService.getBoolean("editor.isRegex", 1, this._state.isRegex),
			preserveCase: this._storageService.getBoolean("editor.preserveCase", 1, this._state.preserveCase)
		}, !1);
	}
	isFindInputFocused() {
		return !!CONTEXT_FIND_INPUT_FOCUSED.getValue(this._contextKeyService);
	}
	getState() {
		return this._state;
	}
	closeFindWidget() {
		this._state.change({
			isRevealed: !1,
			searchScope: null
		}, !1), this._editor.focus();
	}
	toggleCaseSensitive() {
		this._state.change({ matchCase: !this._state.matchCase }, !1), this._state.isRevealed || this.highlightFindOptions();
	}
	toggleWholeWords() {
		this._state.change({ wholeWord: !this._state.wholeWord }, !1), this._state.isRevealed || this.highlightFindOptions();
	}
	toggleRegex() {
		this._state.change({ isRegex: !this._state.isRegex }, !1), this._state.isRevealed || this.highlightFindOptions();
	}
	togglePreserveCase() {
		this._state.change({ preserveCase: !this._state.preserveCase }, !1), this._state.isRevealed || this.highlightFindOptions();
	}
	toggleSearchScope() {
		if (this._state.searchScope) this._state.change({ searchScope: null }, !0);
		else if (this._editor.hasModel()) {
			let e = this._editor.getSelections();
			e = e.map((e) => (e.endColumn === 1 && e.endLineNumber > e.startLineNumber && (e = e.setEndPosition(e.endLineNumber - 1, this._editor.getModel().getLineMaxColumn(e.endLineNumber - 1))), e.isEmpty() ? null : e)).filter((e) => !!e), e.length && this._state.change({ searchScope: e }, !0);
		}
	}
	setSearchString(e) {
		this._state.isRegex && (e = escapeRegExpCharacters(e)), this._state.change({ searchString: e }, !1);
	}
	highlightFindOptions(e = !1) {}
	async _start(e, O) {
		if (this.disposeModel(), !this._editor.hasModel()) return;
		let k = {
			...O,
			isRevealed: !0
		};
		if (e.seedSearchStringFromSelection === "single") {
			let O = getSelectionSearchString(this._editor, e.seedSearchStringFromSelection, e.seedSearchStringFromNonEmptySelection);
			O && (this._state.isRegex ? k.searchString = escapeRegExpCharacters(O) : k.searchString = O);
		} else if (e.seedSearchStringFromSelection === "multiple" && !e.updateSearchScope) {
			let O = getSelectionSearchString(this._editor, e.seedSearchStringFromSelection);
			O && (k.searchString = O);
		}
		if (!k.searchString && e.seedSearchStringFromGlobalClipboard) {
			let e = await this.getGlobalBufferTerm();
			if (!this._editor.hasModel()) return;
			e && (k.searchString = e);
		}
		if (e.forceRevealReplace || k.isReplaceRevealed ? k.isReplaceRevealed = !0 : this._findWidgetVisible.get() || (k.isReplaceRevealed = !1), e.updateSearchScope) {
			let e = this._editor.getSelections();
			e.some((e) => !e.isEmpty()) && (k.searchScope = e);
		}
		k.loop = e.loop, this._state.change(k, !1), this._model ||= new FindModelBoundToEditorModel(this._editor, this._state);
	}
	start(e, O) {
		return this._start(e, O);
	}
	moveToNextMatch() {
		return this._model ? (this._model.moveToNextMatch(), !0) : !1;
	}
	moveToPrevMatch() {
		return this._model ? (this._model.moveToPrevMatch(), !0) : !1;
	}
	goToMatch(e) {
		return this._model ? (this._model.moveToMatch(e), !0) : !1;
	}
	replace() {
		return this._model ? (this._model.replace(), !0) : !1;
	}
	replaceAll() {
		return this._model ? this._editor.getModel()?.isTooLargeForHeapOperation() ? (this._notificationService.warn(localize("too.large.for.replaceall", "The file is too large to perform a replace all operation.")), !1) : (this._model.replaceAll(), !0) : !1;
	}
	selectAllMatches() {
		return this._model ? (this._model.selectAllMatches(), this._editor.focus(), !0) : !1;
	}
	async getGlobalBufferTerm() {
		return this._editor.getOption(41).globalFindClipboard && this._editor.hasModel() && !this._editor.getModel().isTooLargeForSyncing() ? this._clipboardService.readFindText() : "";
	}
	setGlobalBufferTerm(e) {
		this._editor.getOption(41).globalFindClipboard && this._editor.hasModel() && !this._editor.getModel().isTooLargeForSyncing() && this._clipboardService.writeFindText(e);
	}
};
CommonFindController = CommonFindController_1 = __decorate$68([
	__param$68(1, IContextKeyService),
	__param$68(2, IStorageService),
	__param$68(3, IClipboardService),
	__param$68(4, INotificationService),
	__param$68(5, IHoverService)
], CommonFindController);
var FindController = class extends CommonFindController {
	constructor(e, O, k, A, j, M, N, P, F) {
		super(e, k, N, P, M, F), this._contextViewService = O, this._keybindingService = A, this._themeService = j, this._widget = null, this._findOptionsWidget = null;
	}
	async _start(e, O) {
		this._widget || this._createFindWidget();
		let k = this._editor.getSelection(), A = !1;
		switch (this._editor.getOption(41).autoFindInSelection) {
			case "always":
				A = !0;
				break;
			case "never":
				A = !1;
				break;
			case "multiline":
				A = !!k && k.startLineNumber !== k.endLineNumber;
				break;
			default: break;
		}
		e.updateSearchScope = e.updateSearchScope || A, await super._start(e, O), this._widget && (e.shouldFocus === 2 ? this._widget.focusReplaceInput() : e.shouldFocus === 1 && this._widget.focusFindInput());
	}
	highlightFindOptions(e = !1) {
		this._widget || this._createFindWidget(), this._state.isRevealed && !e ? this._widget.highlightFindOptions() : this._findOptionsWidget.highlightFindOptions();
	}
	_createFindWidget() {
		this._widget = this._register(new FindWidget(this._editor, this, this._state, this._contextViewService, this._keybindingService, this._contextKeyService, this._themeService, this._storageService, this._notificationService, this._hoverService)), this._findOptionsWidget = this._register(new FindOptionsWidget(this._editor, this._state, this._keybindingService));
	}
};
FindController = __decorate$68([
	__param$68(1, IContextViewService),
	__param$68(2, IContextKeyService),
	__param$68(3, IKeybindingService),
	__param$68(4, IThemeService),
	__param$68(5, INotificationService),
	__param$68(6, IStorageService),
	__param$68(7, IClipboardService),
	__param$68(8, IHoverService)
], FindController), registerMultiEditorAction(new MultiEditorAction({
	id: FIND_IDS.StartFindAction,
	label: localize("startFindAction", "Find"),
	alias: "Find",
	precondition: ContextKeyExpr.or(EditorContextKeys.focus, ContextKeyExpr.has("editorIsOpen")),
	kbOpts: {
		kbExpr: null,
		primary: 2084,
		weight: 100
	},
	menuOpts: {
		menuId: MenuId.MenubarEditMenu,
		group: "3_find",
		title: localize({
			key: "miFind",
			comment: ["&& denotes a mnemonic"]
		}, "&&Find"),
		order: 1
	}
})).addImplementation(0, (e, O, k) => {
	let A = CommonFindController.get(O);
	return A ? A.start({
		forceRevealReplace: !1,
		seedSearchStringFromSelection: O.getOption(41).seedSearchStringFromSelection === "never" ? "none" : "single",
		seedSearchStringFromNonEmptySelection: O.getOption(41).seedSearchStringFromSelection === "selection",
		seedSearchStringFromGlobalClipboard: O.getOption(41).globalFindClipboard,
		shouldFocus: 1,
		shouldAnimate: !0,
		updateSearchScope: !1,
		loop: O.getOption(41).loop
	}) : !1;
});
var findArgDescription = {
	description: "Open a new In-Editor Find Widget.",
	args: [{
		name: "Open a new In-Editor Find Widget args",
		schema: { properties: {
			searchString: { type: "string" },
			replaceString: { type: "string" },
			isRegex: { type: "boolean" },
			matchWholeWord: { type: "boolean" },
			isCaseSensitive: { type: "boolean" },
			preserveCase: { type: "boolean" },
			findInSelection: { type: "boolean" }
		} }
	}]
}, StartFindWithArgsAction = class extends EditorAction {
	constructor() {
		super({
			id: FIND_IDS.StartFindWithArgs,
			label: localize("startFindWithArgsAction", "Find With Arguments"),
			alias: "Find With Arguments",
			precondition: void 0,
			kbOpts: {
				kbExpr: null,
				primary: 0,
				weight: 100
			},
			metadata: findArgDescription
		});
	}
	async run(e, O, k) {
		let A = CommonFindController.get(O);
		if (A) {
			let e = k ? {
				searchString: k.searchString,
				replaceString: k.replaceString,
				isReplaceRevealed: k.replaceString !== void 0,
				isRegex: k.isRegex,
				wholeWord: k.matchWholeWord,
				matchCase: k.isCaseSensitive,
				preserveCase: k.preserveCase
			} : {};
			await A.start({
				forceRevealReplace: !1,
				seedSearchStringFromSelection: A.getState().searchString.length === 0 && O.getOption(41).seedSearchStringFromSelection !== "never" ? "single" : "none",
				seedSearchStringFromNonEmptySelection: O.getOption(41).seedSearchStringFromSelection === "selection",
				seedSearchStringFromGlobalClipboard: !0,
				shouldFocus: 1,
				shouldAnimate: !0,
				updateSearchScope: k?.findInSelection || !1,
				loop: O.getOption(41).loop
			}, e), A.setGlobalBufferTerm(A.getState().searchString);
		}
	}
}, StartFindWithSelectionAction = class extends EditorAction {
	constructor() {
		super({
			id: FIND_IDS.StartFindWithSelection,
			label: localize("startFindWithSelectionAction", "Find With Selection"),
			alias: "Find With Selection",
			precondition: void 0,
			kbOpts: {
				kbExpr: null,
				primary: 0,
				mac: { primary: 2083 },
				weight: 100
			}
		});
	}
	async run(e, O) {
		let k = CommonFindController.get(O);
		k && (await k.start({
			forceRevealReplace: !1,
			seedSearchStringFromSelection: "multiple",
			seedSearchStringFromNonEmptySelection: !1,
			seedSearchStringFromGlobalClipboard: !1,
			shouldFocus: 0,
			shouldAnimate: !0,
			updateSearchScope: !1,
			loop: O.getOption(41).loop
		}), k.setGlobalBufferTerm(k.getState().searchString));
	}
}, MatchFindAction = class extends EditorAction {
	async run(e, O) {
		let k = CommonFindController.get(O);
		k && !this._run(k) && (await k.start({
			forceRevealReplace: !1,
			seedSearchStringFromSelection: k.getState().searchString.length === 0 && O.getOption(41).seedSearchStringFromSelection !== "never" ? "single" : "none",
			seedSearchStringFromNonEmptySelection: O.getOption(41).seedSearchStringFromSelection === "selection",
			seedSearchStringFromGlobalClipboard: !0,
			shouldFocus: 0,
			shouldAnimate: !0,
			updateSearchScope: !1,
			loop: O.getOption(41).loop
		}), this._run(k));
	}
}, NextMatchFindAction = class extends MatchFindAction {
	constructor() {
		super({
			id: FIND_IDS.NextMatchFindAction,
			label: localize("findNextMatchAction", "Find Next"),
			alias: "Find Next",
			precondition: void 0,
			kbOpts: [{
				kbExpr: EditorContextKeys.focus,
				primary: 61,
				mac: {
					primary: 2085,
					secondary: [61]
				},
				weight: 100
			}, {
				kbExpr: ContextKeyExpr.and(EditorContextKeys.focus, CONTEXT_FIND_INPUT_FOCUSED),
				primary: 3,
				weight: 100
			}]
		});
	}
	_run(e) {
		return e.moveToNextMatch() ? (e.editor.pushUndoStop(), !0) : !1;
	}
}, PreviousMatchFindAction = class extends MatchFindAction {
	constructor() {
		super({
			id: FIND_IDS.PreviousMatchFindAction,
			label: localize("findPreviousMatchAction", "Find Previous"),
			alias: "Find Previous",
			precondition: void 0,
			kbOpts: [{
				kbExpr: EditorContextKeys.focus,
				primary: 1085,
				mac: {
					primary: 3109,
					secondary: [1085]
				},
				weight: 100
			}, {
				kbExpr: ContextKeyExpr.and(EditorContextKeys.focus, CONTEXT_FIND_INPUT_FOCUSED),
				primary: 1027,
				weight: 100
			}]
		});
	}
	_run(e) {
		return e.moveToPrevMatch();
	}
}, MoveToMatchFindAction = class extends EditorAction {
	constructor() {
		super({
			id: FIND_IDS.GoToMatchFindAction,
			label: localize("findMatchAction.goToMatch", "Go to Match..."),
			alias: "Go to Match...",
			precondition: CONTEXT_FIND_WIDGET_VISIBLE
		}), this._highlightDecorations = [];
	}
	run(e, O, k) {
		let A = CommonFindController.get(O);
		if (!A) return;
		let j = A.getState().matchesCount;
		if (j < 1) {
			e.get(INotificationService).notify({
				severity: Severity.Warning,
				message: localize("findMatchAction.noResults", "No matches. Try searching for something else.")
			});
			return;
		}
		let M = e.get(IQuickInputService), N = new DisposableStore(), P = N.add(M.createInputBox());
		P.placeholder = localize("findMatchAction.inputPlaceHolder", "Type a number to go to a specific match (between 1 and {0})", j);
		let F = (e) => {
			let O = parseInt(e);
			if (isNaN(O)) return;
			let k = A.getState().matchesCount;
			if (O > 0 && O <= k) return O - 1;
			if (O < 0 && O >= -k) return k + O;
		}, I = (e) => {
			let k = F(e);
			if (typeof k == "number") {
				P.validationMessage = void 0, A.goToMatch(k);
				let e = A.getState().currentMatch;
				e && this.addDecorations(O, e);
			} else P.validationMessage = localize("findMatchAction.inputValidationMessage", "Please type a number between 1 and {0}", A.getState().matchesCount), this.clearDecorations(O);
		};
		N.add(P.onDidChangeValue((e) => {
			I(e);
		})), N.add(P.onDidAccept(() => {
			let e = F(P.value);
			typeof e == "number" ? (A.goToMatch(e), P.hide()) : P.validationMessage = localize("findMatchAction.inputValidationMessage", "Please type a number between 1 and {0}", A.getState().matchesCount);
		})), N.add(P.onDidHide(() => {
			this.clearDecorations(O), N.dispose();
		})), P.show();
	}
	clearDecorations(e) {
		e.changeDecorations((e) => {
			this._highlightDecorations = e.deltaDecorations(this._highlightDecorations, []);
		});
	}
	addDecorations(e, O) {
		e.changeDecorations((e) => {
			this._highlightDecorations = e.deltaDecorations(this._highlightDecorations, [{
				range: O,
				options: {
					description: "find-match-quick-access-range-highlight",
					className: "rangeHighlight",
					isWholeLine: !0
				}
			}, {
				range: O,
				options: {
					description: "find-match-quick-access-range-highlight-overview",
					overviewRuler: {
						color: themeColorFromId(overviewRulerRangeHighlight),
						position: OverviewRulerLane.Full
					}
				}
			}]);
		});
	}
}, SelectionMatchFindAction = class extends EditorAction {
	async run(e, O) {
		let k = CommonFindController.get(O);
		if (!k) return;
		let A = getSelectionSearchString(O, "single", !1);
		A && k.setSearchString(A), this._run(k) || (await k.start({
			forceRevealReplace: !1,
			seedSearchStringFromSelection: "none",
			seedSearchStringFromNonEmptySelection: !1,
			seedSearchStringFromGlobalClipboard: !1,
			shouldFocus: 0,
			shouldAnimate: !0,
			updateSearchScope: !1,
			loop: O.getOption(41).loop
		}), this._run(k));
	}
}, NextSelectionMatchFindAction = class extends SelectionMatchFindAction {
	constructor() {
		super({
			id: FIND_IDS.NextSelectionMatchFindAction,
			label: localize("nextSelectionMatchFindAction", "Find Next Selection"),
			alias: "Find Next Selection",
			precondition: void 0,
			kbOpts: {
				kbExpr: EditorContextKeys.focus,
				primary: 2109,
				weight: 100
			}
		});
	}
	_run(e) {
		return e.moveToNextMatch();
	}
}, PreviousSelectionMatchFindAction = class extends SelectionMatchFindAction {
	constructor() {
		super({
			id: FIND_IDS.PreviousSelectionMatchFindAction,
			label: localize("previousSelectionMatchFindAction", "Find Previous Selection"),
			alias: "Find Previous Selection",
			precondition: void 0,
			kbOpts: {
				kbExpr: EditorContextKeys.focus,
				primary: 3133,
				weight: 100
			}
		});
	}
	_run(e) {
		return e.moveToPrevMatch();
	}
};
registerMultiEditorAction(new MultiEditorAction({
	id: FIND_IDS.StartFindReplaceAction,
	label: localize("startReplace", "Replace"),
	alias: "Replace",
	precondition: ContextKeyExpr.or(EditorContextKeys.focus, ContextKeyExpr.has("editorIsOpen")),
	kbOpts: {
		kbExpr: null,
		primary: 2086,
		mac: { primary: 2596 },
		weight: 100
	},
	menuOpts: {
		menuId: MenuId.MenubarEditMenu,
		group: "3_find",
		title: localize({
			key: "miReplace",
			comment: ["&& denotes a mnemonic"]
		}, "&&Replace"),
		order: 2
	}
})).addImplementation(0, (e, O, k) => {
	if (!O.hasModel() || O.getOption(92)) return !1;
	let A = CommonFindController.get(O);
	if (!A) return !1;
	let j = O.getSelection(), M = A.isFindInputFocused(), N = !j.isEmpty() && j.startLineNumber === j.endLineNumber && O.getOption(41).seedSearchStringFromSelection !== "never" && !M, P = M || N ? 2 : 1;
	return A.start({
		forceRevealReplace: !0,
		seedSearchStringFromSelection: N ? "single" : "none",
		seedSearchStringFromNonEmptySelection: O.getOption(41).seedSearchStringFromSelection === "selection",
		seedSearchStringFromGlobalClipboard: O.getOption(41).seedSearchStringFromSelection !== "never",
		shouldFocus: P,
		shouldAnimate: !0,
		updateSearchScope: !1,
		loop: O.getOption(41).loop
	});
}), registerEditorContribution(CommonFindController.ID, FindController, 0), registerEditorAction(StartFindWithArgsAction), registerEditorAction(StartFindWithSelectionAction), registerEditorAction(NextMatchFindAction), registerEditorAction(PreviousMatchFindAction), registerEditorAction(MoveToMatchFindAction), registerEditorAction(NextSelectionMatchFindAction), registerEditorAction(PreviousSelectionMatchFindAction);
var FindCommand = EditorCommand.bindToContribution(CommonFindController.get);
registerEditorCommand(new FindCommand({
	id: FIND_IDS.CloseFindWidgetCommand,
	precondition: CONTEXT_FIND_WIDGET_VISIBLE,
	handler: (e) => e.closeFindWidget(),
	kbOpts: {
		weight: 105,
		kbExpr: ContextKeyExpr.and(EditorContextKeys.focus, ContextKeyExpr.not("isComposing")),
		primary: 9,
		secondary: [1033]
	}
})), registerEditorCommand(new FindCommand({
	id: FIND_IDS.ToggleCaseSensitiveCommand,
	precondition: void 0,
	handler: (e) => e.toggleCaseSensitive(),
	kbOpts: {
		weight: 105,
		kbExpr: EditorContextKeys.focus,
		primary: ToggleCaseSensitiveKeybinding.primary,
		mac: ToggleCaseSensitiveKeybinding.mac,
		win: ToggleCaseSensitiveKeybinding.win,
		linux: ToggleCaseSensitiveKeybinding.linux
	}
})), registerEditorCommand(new FindCommand({
	id: FIND_IDS.ToggleWholeWordCommand,
	precondition: void 0,
	handler: (e) => e.toggleWholeWords(),
	kbOpts: {
		weight: 105,
		kbExpr: EditorContextKeys.focus,
		primary: ToggleWholeWordKeybinding.primary,
		mac: ToggleWholeWordKeybinding.mac,
		win: ToggleWholeWordKeybinding.win,
		linux: ToggleWholeWordKeybinding.linux
	}
})), registerEditorCommand(new FindCommand({
	id: FIND_IDS.ToggleRegexCommand,
	precondition: void 0,
	handler: (e) => e.toggleRegex(),
	kbOpts: {
		weight: 105,
		kbExpr: EditorContextKeys.focus,
		primary: ToggleRegexKeybinding.primary,
		mac: ToggleRegexKeybinding.mac,
		win: ToggleRegexKeybinding.win,
		linux: ToggleRegexKeybinding.linux
	}
})), registerEditorCommand(new FindCommand({
	id: FIND_IDS.ToggleSearchScopeCommand,
	precondition: void 0,
	handler: (e) => e.toggleSearchScope(),
	kbOpts: {
		weight: 105,
		kbExpr: EditorContextKeys.focus,
		primary: ToggleSearchScopeKeybinding.primary,
		mac: ToggleSearchScopeKeybinding.mac,
		win: ToggleSearchScopeKeybinding.win,
		linux: ToggleSearchScopeKeybinding.linux
	}
})), registerEditorCommand(new FindCommand({
	id: FIND_IDS.TogglePreserveCaseCommand,
	precondition: void 0,
	handler: (e) => e.togglePreserveCase(),
	kbOpts: {
		weight: 105,
		kbExpr: EditorContextKeys.focus,
		primary: TogglePreserveCaseKeybinding.primary,
		mac: TogglePreserveCaseKeybinding.mac,
		win: TogglePreserveCaseKeybinding.win,
		linux: TogglePreserveCaseKeybinding.linux
	}
})), registerEditorCommand(new FindCommand({
	id: FIND_IDS.ReplaceOneAction,
	precondition: CONTEXT_FIND_WIDGET_VISIBLE,
	handler: (e) => e.replace(),
	kbOpts: {
		weight: 105,
		kbExpr: EditorContextKeys.focus,
		primary: 3094
	}
})), registerEditorCommand(new FindCommand({
	id: FIND_IDS.ReplaceOneAction,
	precondition: CONTEXT_FIND_WIDGET_VISIBLE,
	handler: (e) => e.replace(),
	kbOpts: {
		weight: 105,
		kbExpr: ContextKeyExpr.and(EditorContextKeys.focus, CONTEXT_REPLACE_INPUT_FOCUSED),
		primary: 3
	}
})), registerEditorCommand(new FindCommand({
	id: FIND_IDS.ReplaceAllAction,
	precondition: CONTEXT_FIND_WIDGET_VISIBLE,
	handler: (e) => e.replaceAll(),
	kbOpts: {
		weight: 105,
		kbExpr: EditorContextKeys.focus,
		primary: 2563
	}
})), registerEditorCommand(new FindCommand({
	id: FIND_IDS.ReplaceAllAction,
	precondition: CONTEXT_FIND_WIDGET_VISIBLE,
	handler: (e) => e.replaceAll(),
	kbOpts: {
		weight: 105,
		kbExpr: ContextKeyExpr.and(EditorContextKeys.focus, CONTEXT_REPLACE_INPUT_FOCUSED),
		primary: void 0,
		mac: { primary: 2051 }
	}
})), registerEditorCommand(new FindCommand({
	id: FIND_IDS.SelectAllMatchesAction,
	precondition: CONTEXT_FIND_WIDGET_VISIBLE,
	handler: (e) => e.selectAllMatches(),
	kbOpts: {
		weight: 105,
		kbExpr: EditorContextKeys.focus,
		primary: 515
	}
}));
const foldSourceAbbr = {
	0: " ",
	1: "u",
	2: "r"
}, MAX_LINE_NUMBER = 16777215;
var MASK_INDENT = 4278190080, BitField = class {
	constructor(e) {
		let O = Math.ceil(e / 32);
		this._states = new Uint32Array(O);
	}
	get(e) {
		let O = e / 32 | 0, k = e % 32;
		return (this._states[O] & 1 << k) != 0;
	}
	set(e, O) {
		let k = e / 32 | 0, A = e % 32, j = this._states[k];
		O ? this._states[k] = j | 1 << A : this._states[k] = j & ~(1 << A);
	}
}, FoldingRegions = class e {
	constructor(e, O, k) {
		if (e.length !== O.length || e.length > 65535) throw Error("invalid startIndexes or endIndexes size");
		this._startIndexes = e, this._endIndexes = O, this._collapseStates = new BitField(e.length), this._userDefinedStates = new BitField(e.length), this._recoveredStates = new BitField(e.length), this._types = k, this._parentsComputed = !1;
	}
	ensureParentIndices() {
		if (!this._parentsComputed) {
			this._parentsComputed = !0;
			let e = [], O = (O, k) => {
				let A = e[e.length - 1];
				return this.getStartLineNumber(A) <= O && this.getEndLineNumber(A) >= k;
			};
			for (let k = 0, A = this._startIndexes.length; k < A; k++) {
				let A = this._startIndexes[k], j = this._endIndexes[k];
				if (A > 16777215 || j > 16777215) throw Error("startLineNumber or endLineNumber must not exceed " + MAX_LINE_NUMBER);
				for (; e.length > 0 && !O(A, j);) e.pop();
				let M = e.length > 0 ? e[e.length - 1] : -1;
				e.push(k), this._startIndexes[k] = A + ((M & 255) << 24), this._endIndexes[k] = j + ((M & 65280) << 16);
			}
		}
	}
	get length() {
		return this._startIndexes.length;
	}
	getStartLineNumber(e) {
		return this._startIndexes[e] & MAX_LINE_NUMBER;
	}
	getEndLineNumber(e) {
		return this._endIndexes[e] & MAX_LINE_NUMBER;
	}
	getType(e) {
		return this._types ? this._types[e] : void 0;
	}
	hasTypes() {
		return !!this._types;
	}
	isCollapsed(e) {
		return this._collapseStates.get(e);
	}
	setCollapsed(e, O) {
		this._collapseStates.set(e, O);
	}
	isUserDefined(e) {
		return this._userDefinedStates.get(e);
	}
	setUserDefined(e, O) {
		return this._userDefinedStates.set(e, O);
	}
	isRecovered(e) {
		return this._recoveredStates.get(e);
	}
	setRecovered(e, O) {
		return this._recoveredStates.set(e, O);
	}
	getSource(e) {
		return this.isUserDefined(e) ? 1 : this.isRecovered(e) ? 2 : 0;
	}
	setSource(e, O) {
		O === 1 ? (this.setUserDefined(e, !0), this.setRecovered(e, !1)) : O === 2 ? (this.setUserDefined(e, !1), this.setRecovered(e, !0)) : (this.setUserDefined(e, !1), this.setRecovered(e, !1));
	}
	setCollapsedAllOfType(e, O) {
		let k = !1;
		if (this._types) for (let A = 0; A < this._types.length; A++) this._types[A] === e && (this.setCollapsed(A, O), k = !0);
		return k;
	}
	toRegion(e) {
		return new FoldingRegion(this, e);
	}
	getParentIndex(e) {
		this.ensureParentIndices();
		let O = ((this._startIndexes[e] & MASK_INDENT) >>> 24) + ((this._endIndexes[e] & MASK_INDENT) >>> 16);
		return O === 65535 ? -1 : O;
	}
	contains(e, O) {
		return this.getStartLineNumber(e) <= O && this.getEndLineNumber(e) >= O;
	}
	findIndex(e) {
		let O = 0, k = this._startIndexes.length;
		if (k === 0) return -1;
		for (; O < k;) {
			let A = Math.floor((O + k) / 2);
			e < this.getStartLineNumber(A) ? k = A : O = A + 1;
		}
		return O - 1;
	}
	findRange(e) {
		let O = this.findIndex(e);
		if (O >= 0) {
			if (this.getEndLineNumber(O) >= e) return O;
			for (O = this.getParentIndex(O); O !== -1;) {
				if (this.contains(O, e)) return O;
				O = this.getParentIndex(O);
			}
		}
		return -1;
	}
	toString() {
		let e = [];
		for (let O = 0; O < this.length; O++) e[O] = `[${foldSourceAbbr[this.getSource(O)]}${this.isCollapsed(O) ? "+" : "-"}] ${this.getStartLineNumber(O)}/${this.getEndLineNumber(O)}`;
		return e.join(", ");
	}
	toFoldRange(e) {
		return {
			startLineNumber: this._startIndexes[e] & MAX_LINE_NUMBER,
			endLineNumber: this._endIndexes[e] & MAX_LINE_NUMBER,
			type: this._types ? this._types[e] : void 0,
			isCollapsed: this.isCollapsed(e),
			source: this.getSource(e)
		};
	}
	static fromFoldRanges(O) {
		let k = O.length, A = new Uint32Array(k), j = new Uint32Array(k), M = [], N = !1;
		for (let e = 0; e < k; e++) {
			let k = O[e];
			A[e] = k.startLineNumber, j[e] = k.endLineNumber, M.push(k.type), k.type && (N = !0);
		}
		N || (M = void 0);
		let P = new e(A, j, M);
		for (let e = 0; e < k; e++) O[e].isCollapsed && P.setCollapsed(e, !0), P.setSource(e, O[e].source);
		return P;
	}
	static sanitizeAndMerge(e, O, k, A) {
		k ??= Number.MAX_VALUE;
		let j = (e, O) => Array.isArray(e) ? ((k) => k < O ? e[k] : void 0) : ((k) => k < O ? e.toFoldRange(k) : void 0), M = j(e, e.length), N = j(O, O.length), P = 0, F = 0, I = M(0), L = N(0), R = [], z, B = 0, V = [];
		for (; I || L;) {
			let e;
			if (L && (!I || I.startLineNumber >= L.startLineNumber)) I && I.startLineNumber === L.startLineNumber ? (L.source === 1 ? e = L : (e = I, e.isCollapsed = L.isCollapsed && (I.endLineNumber === L.endLineNumber || !A?.startsInside(I.startLineNumber + 1, I.endLineNumber + 1)), e.source = 0), I = M(++P)) : (e = L, L.isCollapsed && L.source === 0 && (e.source = 2)), L = N(++F);
			else {
				let O = F, k = L;
				for (;;) {
					if (!k || k.startLineNumber > I.endLineNumber) {
						e = I;
						break;
					}
					if (k.source === 1 && k.endLineNumber > I.endLineNumber) break;
					k = N(++O);
				}
				I = M(++P);
			}
			if (e) {
				for (; z && z.endLineNumber < e.startLineNumber;) z = R.pop();
				e.endLineNumber > e.startLineNumber && e.startLineNumber > B && e.endLineNumber <= k && (!z || z.endLineNumber >= e.endLineNumber) && (V.push(e), B = e.startLineNumber, z && R.push(z), z = e);
			}
		}
		return V;
	}
}, FoldingRegion = class {
	constructor(e, O) {
		this.ranges = e, this.index = O;
	}
	get startLineNumber() {
		return this.ranges.getStartLineNumber(this.index);
	}
	get endLineNumber() {
		return this.ranges.getEndLineNumber(this.index);
	}
	get regionIndex() {
		return this.index;
	}
	get parentIndex() {
		return this.ranges.getParentIndex(this.index);
	}
	get isCollapsed() {
		return this.ranges.isCollapsed(this.index);
	}
	containedBy(e) {
		return e.startLineNumber <= this.startLineNumber && e.endLineNumber >= this.endLineNumber;
	}
	containsLine(e) {
		return this.startLineNumber <= e && e <= this.endLineNumber;
	}
}, FoldingModel = class {
	get regions() {
		return this._regions;
	}
	get textModel() {
		return this._textModel;
	}
	constructor(e, O) {
		this._updateEventEmitter = new Emitter(), this.onDidChange = this._updateEventEmitter.event, this._textModel = e, this._decorationProvider = O, this._regions = new FoldingRegions(new Uint32Array(), new Uint32Array()), this._editorDecorationIds = [];
	}
	toggleCollapseState(e) {
		if (!e.length) return;
		e = e.sort((e, O) => e.regionIndex - O.regionIndex);
		let O = {};
		this._decorationProvider.changeDecorations((k) => {
			let A = 0, j = -1, M = -1, N = (e) => {
				for (; A < e;) {
					let e = this._regions.getEndLineNumber(A), O = this._regions.isCollapsed(A);
					if (e <= j) {
						let j = this.regions.getSource(A) !== 0;
						k.changeDecorationOptions(this._editorDecorationIds[A], this._decorationProvider.getDecorationOption(O, e <= M, j));
					}
					O && e > M && (M = e), A++;
				}
			};
			for (let k of e) {
				let e = k.regionIndex, A = this._editorDecorationIds[e];
				if (A && !O[A]) {
					O[A] = !0, N(e);
					let k = !this._regions.isCollapsed(e);
					this._regions.setCollapsed(e, k), j = Math.max(j, this._regions.getEndLineNumber(e));
				}
			}
			N(this._regions.length);
		}), this._updateEventEmitter.fire({
			model: this,
			collapseStateChanged: e
		});
	}
	removeManualRanges(e) {
		let O = [], k = (O) => {
			for (let k of e) if (!(k.startLineNumber > O.endLineNumber || O.startLineNumber > k.endLineNumber)) return !0;
			return !1;
		};
		for (let e = 0; e < this._regions.length; e++) {
			let A = this._regions.toFoldRange(e);
			(A.source === 0 || !k(A)) && O.push(A);
		}
		this.updatePost(FoldingRegions.fromFoldRanges(O));
	}
	update(e, O) {
		let k = this._currentFoldedOrManualRanges(O), A = FoldingRegions.sanitizeAndMerge(e, k, this._textModel.getLineCount(), O);
		this.updatePost(FoldingRegions.fromFoldRanges(A));
	}
	updatePost(e) {
		let O = [], k = -1;
		for (let A = 0, j = e.length; A < j; A++) {
			let j = e.getStartLineNumber(A), M = e.getEndLineNumber(A), N = e.isCollapsed(A), P = e.getSource(A) !== 0, F = {
				startLineNumber: j,
				startColumn: this._textModel.getLineMaxColumn(j),
				endLineNumber: M,
				endColumn: this._textModel.getLineMaxColumn(M) + 1
			};
			O.push({
				range: F,
				options: this._decorationProvider.getDecorationOption(N, M <= k, P)
			}), N && M > k && (k = M);
		}
		this._decorationProvider.changeDecorations((e) => this._editorDecorationIds = e.deltaDecorations(this._editorDecorationIds, O)), this._regions = e, this._updateEventEmitter.fire({ model: this });
	}
	_currentFoldedOrManualRanges(e) {
		let O = [];
		for (let k = 0, A = this._regions.length; k < A; k++) {
			let A = this.regions.isCollapsed(k), j = this.regions.getSource(k);
			if (A || j !== 0) {
				let M = this._regions.toFoldRange(k), N = this._textModel.getDecorationRange(this._editorDecorationIds[k]);
				N && (A && e?.startsInside(N.startLineNumber + 1, N.endLineNumber) && (A = !1), O.push({
					startLineNumber: N.startLineNumber,
					endLineNumber: N.endLineNumber,
					type: M.type,
					isCollapsed: A,
					source: j
				}));
			}
		}
		return O;
	}
	getMemento() {
		let e = this._currentFoldedOrManualRanges(), O = [], k = this._textModel.getLineCount();
		for (let A = 0, j = e.length; A < j; A++) {
			let j = e[A];
			if (j.startLineNumber >= j.endLineNumber || j.startLineNumber < 1 || j.endLineNumber > k) continue;
			let M = this._getLinesChecksum(j.startLineNumber + 1, j.endLineNumber);
			O.push({
				startLineNumber: j.startLineNumber,
				endLineNumber: j.endLineNumber,
				isCollapsed: j.isCollapsed,
				source: j.source,
				checksum: M
			});
		}
		return O.length > 0 ? O : void 0;
	}
	applyMemento(e) {
		if (!Array.isArray(e)) return;
		let O = [], k = this._textModel.getLineCount();
		for (let A of e) {
			if (A.startLineNumber >= A.endLineNumber || A.startLineNumber < 1 || A.endLineNumber > k) continue;
			let e = this._getLinesChecksum(A.startLineNumber + 1, A.endLineNumber);
			(!A.checksum || e === A.checksum) && O.push({
				startLineNumber: A.startLineNumber,
				endLineNumber: A.endLineNumber,
				type: void 0,
				isCollapsed: A.isCollapsed ?? !0,
				source: A.source ?? 0
			});
		}
		let A = FoldingRegions.sanitizeAndMerge(this._regions, O, k);
		this.updatePost(FoldingRegions.fromFoldRanges(A));
	}
	_getLinesChecksum(e, O) {
		return hash(this._textModel.getLineContent(e) + this._textModel.getLineContent(O)) % 1e6;
	}
	dispose() {
		this._decorationProvider.removeDecorations(this._editorDecorationIds);
	}
	getAllRegionsAtLine(e, O) {
		let k = [];
		if (this._regions) {
			let A = this._regions.findRange(e), j = 1;
			for (; A >= 0;) {
				let e = this._regions.toRegion(A);
				(!O || O(e, j)) && k.push(e), j++, A = e.parentIndex;
			}
		}
		return k;
	}
	getRegionAtLine(e) {
		if (this._regions) {
			let O = this._regions.findRange(e);
			if (O >= 0) return this._regions.toRegion(O);
		}
		return null;
	}
	getRegionsInside(e, O) {
		let k = [], A = e ? e.regionIndex + 1 : 0, j = e ? e.endLineNumber : Number.MAX_VALUE;
		if (O && O.length === 2) {
			let e = [];
			for (let M = A, N = this._regions.length; M < N; M++) {
				let A = this._regions.toRegion(M);
				if (this._regions.getStartLineNumber(M) < j) {
					for (; e.length > 0 && !A.containedBy(e[e.length - 1]);) e.pop();
					e.push(A), O(A, e.length) && k.push(A);
				} else break;
			}
		} else for (let e = A, M = this._regions.length; e < M; e++) {
			let A = this._regions.toRegion(e);
			if (this._regions.getStartLineNumber(e) < j) (!O || O(A)) && k.push(A);
			else break;
		}
		return k;
	}
};
function toggleCollapseState(e, O, k) {
	let A = [];
	for (let j of k) {
		let k = e.getRegionAtLine(j);
		if (k) {
			let j = !k.isCollapsed;
			if (A.push(k), O > 1) {
				let M = e.getRegionsInside(k, (e, k) => e.isCollapsed !== j && k < O);
				A.push(...M);
			}
		}
	}
	e.toggleCollapseState(A);
}
function setCollapseStateLevelsDown(e, O, k = Number.MAX_VALUE, A) {
	let j = [];
	if (A && A.length > 0) for (let M of A) {
		let A = e.getRegionAtLine(M);
		if (A && (A.isCollapsed !== O && j.push(A), k > 1)) {
			let M = e.getRegionsInside(A, (e, A) => e.isCollapsed !== O && A < k);
			j.push(...M);
		}
	}
	else {
		let A = e.getRegionsInside(null, (e, A) => e.isCollapsed !== O && A < k);
		j.push(...A);
	}
	e.toggleCollapseState(j);
}
function setCollapseStateLevelsUp(e, O, k, A) {
	let j = [];
	for (let M of A) {
		let A = e.getAllRegionsAtLine(M, (e, A) => e.isCollapsed !== O && A <= k);
		j.push(...A);
	}
	e.toggleCollapseState(j);
}
function setCollapseStateUp(e, O, k) {
	let A = [];
	for (let j of k) {
		let k = e.getAllRegionsAtLine(j, (e) => e.isCollapsed !== O);
		k.length > 0 && A.push(k[0]);
	}
	e.toggleCollapseState(A);
}
function setCollapseStateAtLevel(e, O, k, A) {
	let j = e.getRegionsInside(null, (e, j) => j === O && e.isCollapsed !== k && !A.some((O) => e.containsLine(O)));
	e.toggleCollapseState(j);
}
function setCollapseStateForRest(e, O, k) {
	let A = [];
	for (let O of k) {
		let k = e.getAllRegionsAtLine(O, void 0);
		k.length > 0 && A.push(k[0]);
	}
	let j = e.getRegionsInside(null, (e) => A.every((O) => !O.containedBy(e) && !e.containedBy(O)) && e.isCollapsed !== O);
	e.toggleCollapseState(j);
}
function setCollapseStateForMatchingLines(e, O, k) {
	let A = e.textModel, j = e.regions, M = [];
	for (let e = j.length - 1; e >= 0; e--) if (k !== j.isCollapsed(e)) {
		let k = j.getStartLineNumber(e);
		O.test(A.getLineContent(k)) && M.push(j.toRegion(e));
	}
	e.toggleCollapseState(M);
}
function setCollapseStateForType(e, O, k) {
	let A = e.regions, j = [];
	for (let e = A.length - 1; e >= 0; e--) k !== A.isCollapsed(e) && O === A.getType(e) && j.push(A.toRegion(e));
	e.toggleCollapseState(j);
}
function getParentFoldLine(e, O) {
	let k = null, A = O.getRegionAtLine(e);
	if (A !== null && (k = A.startLineNumber, e === k)) {
		let e = A.parentIndex;
		k = e === -1 ? null : O.regions.getStartLineNumber(e);
	}
	return k;
}
function getPreviousFoldLine(e, O) {
	let k = O.getRegionAtLine(e);
	if (k !== null && k.startLineNumber === e) {
		if (e !== k.startLineNumber) return k.startLineNumber;
		{
			let e = k.parentIndex, A = 0;
			for (e !== -1 && (A = O.regions.getStartLineNumber(k.parentIndex)); k !== null;) if (k.regionIndex > 0) {
				if (k = O.regions.toRegion(k.regionIndex - 1), k.startLineNumber <= A) return null;
				if (k.parentIndex === e) return k.startLineNumber;
			} else return null;
		}
	} else if (O.regions.length > 0) for (k = O.regions.toRegion(O.regions.length - 1); k !== null;) {
		if (k.startLineNumber < e) return k.startLineNumber;
		k = k.regionIndex > 0 ? O.regions.toRegion(k.regionIndex - 1) : null;
	}
	return null;
}
function getNextFoldLine(e, O) {
	let k = O.getRegionAtLine(e);
	if (k !== null && k.startLineNumber === e) {
		let e = k.parentIndex, A = 0;
		if (e !== -1) A = O.regions.getEndLineNumber(k.parentIndex);
		else if (O.regions.length === 0) return null;
		else A = O.regions.getEndLineNumber(O.regions.length - 1);
		for (; k !== null;) if (k.regionIndex < O.regions.length) {
			if (k = O.regions.toRegion(k.regionIndex + 1), k.startLineNumber >= A) return null;
			if (k.parentIndex === e) return k.startLineNumber;
		} else return null;
	} else if (O.regions.length > 0) for (k = O.regions.toRegion(0); k !== null;) {
		if (k.startLineNumber > e) return k.startLineNumber;
		k = k.regionIndex < O.regions.length ? O.regions.toRegion(k.regionIndex + 1) : null;
	}
	return null;
}
var HiddenRangeModel = class {
	get onDidChange() {
		return this._updateEventEmitter.event;
	}
	get hiddenRanges() {
		return this._hiddenRanges;
	}
	constructor(e) {
		this._updateEventEmitter = new Emitter(), this._hasLineChanges = !1, this._foldingModel = e, this._foldingModelListener = e.onDidChange((e) => this.updateHiddenRanges()), this._hiddenRanges = [], e.regions.length && this.updateHiddenRanges();
	}
	notifyChangeModelContent(e) {
		this._hiddenRanges.length && !this._hasLineChanges && (this._hasLineChanges = e.changes.some((e) => e.range.endLineNumber !== e.range.startLineNumber || countEOL(e.text)[0] !== 0));
	}
	updateHiddenRanges() {
		let e = !1, O = [], k = 0, A = 0, j = Number.MAX_VALUE, M = -1, N = this._foldingModel.regions;
		for (; k < N.length; k++) {
			if (!N.isCollapsed(k)) continue;
			let P = N.getStartLineNumber(k) + 1, F = N.getEndLineNumber(k);
			j <= P && F <= M || (!e && A < this._hiddenRanges.length && this._hiddenRanges[A].startLineNumber === P && this._hiddenRanges[A].endLineNumber === F ? (O.push(this._hiddenRanges[A]), A++) : (e = !0, O.push(new Range(P, 1, F, 1))), j = P, M = F);
		}
		(this._hasLineChanges || e || A < this._hiddenRanges.length) && this.applyHiddenRanges(O);
	}
	applyHiddenRanges(e) {
		this._hiddenRanges = e, this._hasLineChanges = !1, this._updateEventEmitter.fire(e);
	}
	hasRanges() {
		return this._hiddenRanges.length > 0;
	}
	isHidden(e) {
		return findRange(this._hiddenRanges, e) !== null;
	}
	adjustSelections(e) {
		let O = !1, k = this._foldingModel.textModel, A = null, j = (e) => ((!A || !isInside(e, A)) && (A = findRange(this._hiddenRanges, e)), A ? A.startLineNumber - 1 : null);
		for (let A = 0, M = e.length; A < M; A++) {
			let M = e[A], N = j(M.startLineNumber);
			N && (M = M.setStartPosition(N, k.getLineMaxColumn(N)), O = !0);
			let P = j(M.endLineNumber);
			P && (M = M.setEndPosition(P, k.getLineMaxColumn(P)), O = !0), e[A] = M;
		}
		return O;
	}
	dispose() {
		this.hiddenRanges.length > 0 && (this._hiddenRanges = [], this._updateEventEmitter.fire(this._hiddenRanges)), this._foldingModelListener &&= (this._foldingModelListener.dispose(), null);
	}
};
function isInside(e, O) {
	return e >= O.startLineNumber && e <= O.endLineNumber;
}
function findRange(e, O) {
	let k = findFirstIdxMonotonousOrArrLen(e, (e) => O < e.startLineNumber) - 1;
	return k >= 0 && e[k].endLineNumber >= O ? e[k] : null;
}
var MAX_FOLDING_REGIONS_FOR_INDENT_DEFAULT = 5e3, ID_INDENT_PROVIDER = "indent", IndentRangeProvider = class {
	constructor(e, O, k) {
		this.editorModel = e, this.languageConfigurationService = O, this.foldingRangesLimit = k, this.id = ID_INDENT_PROVIDER;
	}
	dispose() {}
	compute(e) {
		let O = this.languageConfigurationService.getLanguageConfiguration(this.editorModel.getLanguageId()).foldingRules, k = O && !!O.offSide, A = O && O.markers;
		return Promise.resolve(computeRanges(this.editorModel, k, A, this.foldingRangesLimit));
	}
}, RangesCollector$1 = class {
	constructor(e) {
		this._startIndexes = [], this._endIndexes = [], this._indentOccurrences = [], this._length = 0, this._foldingRangesLimit = e;
	}
	insertFirst(e, O, k) {
		if (e > 16777215 || O > 16777215) return;
		let A = this._length;
		this._startIndexes[A] = e, this._endIndexes[A] = O, this._length++, k < 1e3 && (this._indentOccurrences[k] = (this._indentOccurrences[k] || 0) + 1);
	}
	toIndentRanges(e) {
		let O = this._foldingRangesLimit.limit;
		if (this._length <= O) {
			this._foldingRangesLimit.update(this._length, !1);
			let e = new Uint32Array(this._length), O = new Uint32Array(this._length);
			for (let k = this._length - 1, A = 0; k >= 0; k--, A++) e[A] = this._startIndexes[k], O[A] = this._endIndexes[k];
			return new FoldingRegions(e, O);
		} else {
			this._foldingRangesLimit.update(this._length, O);
			let k = 0, A = this._indentOccurrences.length;
			for (let e = 0; e < this._indentOccurrences.length; e++) {
				let j = this._indentOccurrences[e];
				if (j) {
					if (j + k > O) {
						A = e;
						break;
					}
					k += j;
				}
			}
			let j = e.getOptions().tabSize, M = new Uint32Array(O), N = new Uint32Array(O);
			for (let P = this._length - 1, F = 0; P >= 0; P--) {
				let I = this._startIndexes[P], L = e.getLineContent(I), R = computeIndentLevel(L, j);
				(R < A || R === A && k++ < O) && (M[F] = I, N[F] = this._endIndexes[P], F++);
			}
			return new FoldingRegions(M, N);
		}
	}
}, foldingRangesLimitDefault = {
	limit: MAX_FOLDING_REGIONS_FOR_INDENT_DEFAULT,
	update: () => {}
};
function computeRanges(e, O, k, A = foldingRangesLimitDefault) {
	let j = e.getOptions().tabSize, M = new RangesCollector$1(A), N;
	k && (N = /* @__PURE__ */ RegExp(`(${k.start.source})|(?:${k.end.source})`));
	let P = [], F = e.getLineCount() + 1;
	P.push({
		indent: -1,
		endAbove: F,
		line: F
	});
	for (let k = e.getLineCount(); k > 0; k--) {
		let A = e.getLineContent(k), F = computeIndentLevel(A, j), I = P[P.length - 1];
		if (F === -1) {
			O && (I.endAbove = k);
			continue;
		}
		let L;
		if (N && (L = A.match(N))) if (L[1]) {
			let e = P.length - 1;
			for (; e > 0 && P[e].indent !== -2;) e--;
			if (e > 0) {
				P.length = e + 1, I = P[e], M.insertFirst(k, I.line, F), I.line = k, I.indent = F, I.endAbove = k;
				continue;
			}
		} else {
			P.push({
				indent: -2,
				endAbove: k,
				line: k
			});
			continue;
		}
		if (I.indent > F) {
			do
				P.pop(), I = P[P.length - 1];
			while (I.indent > F);
			let e = I.endAbove - 1;
			e - k >= 1 && M.insertFirst(k, e, F);
		}
		I.indent === F ? I.endAbove = k : P.push({
			indent: F,
			endAbove: k,
			line: k
		});
	}
	return M.toIndentRanges(e);
}
var foldBackground = registerColor("editor.foldBackground", {
	light: transparent(editorSelectionBackground, .3),
	dark: transparent(editorSelectionBackground, .3),
	hcDark: null,
	hcLight: null
}, localize("foldBackgroundBackground", "Background color behind folded ranges. The color must not be opaque so as not to hide underlying decorations."), !0);
registerColor("editor.foldPlaceholderForeground", {
	light: "#808080",
	dark: "#808080",
	hcDark: null,
	hcLight: null
}, localize("collapsedTextColor", "Color of the collapsed text after the first line of a folded range.")), registerColor("editorGutter.foldingControlForeground", iconForeground, localize("editorGutter.foldingControlForeground", "Color of the folding control in the editor gutter."));
const foldingExpandedIcon = registerIcon("folding-expanded", Codicon.chevronDown, localize("foldingExpandedIcon", "Icon for expanded ranges in the editor glyph margin.")), foldingCollapsedIcon = registerIcon("folding-collapsed", Codicon.chevronRight, localize("foldingCollapsedIcon", "Icon for collapsed ranges in the editor glyph margin.")), foldingManualCollapsedIcon = registerIcon("folding-manual-collapsed", foldingCollapsedIcon, localize("foldingManualCollapedIcon", "Icon for manually collapsed ranges in the editor glyph margin.")), foldingManualExpandedIcon = registerIcon("folding-manual-expanded", foldingExpandedIcon, localize("foldingManualExpandedIcon", "Icon for manually expanded ranges in the editor glyph margin."));
var foldedBackgroundMinimap = {
	color: themeColorFromId(foldBackground),
	position: 1
}, collapsed = localize("linesCollapsed", "Click to expand the range."), expanded = localize("linesExpanded", "Click to collapse the range."), FoldingDecorationProvider = class e {
	static {
		this.COLLAPSED_VISUAL_DECORATION = ModelDecorationOptions.register({
			description: "folding-collapsed-visual-decoration",
			stickiness: 0,
			afterContentClassName: "inline-folded",
			isWholeLine: !0,
			linesDecorationsTooltip: collapsed,
			firstLineDecorationClassName: ThemeIcon.asClassName(foldingCollapsedIcon)
		});
	}
	static {
		this.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION = ModelDecorationOptions.register({
			description: "folding-collapsed-highlighted-visual-decoration",
			stickiness: 0,
			afterContentClassName: "inline-folded",
			className: "folded-background",
			minimap: foldedBackgroundMinimap,
			isWholeLine: !0,
			linesDecorationsTooltip: collapsed,
			firstLineDecorationClassName: ThemeIcon.asClassName(foldingCollapsedIcon)
		});
	}
	static {
		this.MANUALLY_COLLAPSED_VISUAL_DECORATION = ModelDecorationOptions.register({
			description: "folding-manually-collapsed-visual-decoration",
			stickiness: 0,
			afterContentClassName: "inline-folded",
			isWholeLine: !0,
			linesDecorationsTooltip: collapsed,
			firstLineDecorationClassName: ThemeIcon.asClassName(foldingManualCollapsedIcon)
		});
	}
	static {
		this.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION = ModelDecorationOptions.register({
			description: "folding-manually-collapsed-highlighted-visual-decoration",
			stickiness: 0,
			afterContentClassName: "inline-folded",
			className: "folded-background",
			minimap: foldedBackgroundMinimap,
			isWholeLine: !0,
			linesDecorationsTooltip: collapsed,
			firstLineDecorationClassName: ThemeIcon.asClassName(foldingManualCollapsedIcon)
		});
	}
	static {
		this.NO_CONTROLS_COLLAPSED_RANGE_DECORATION = ModelDecorationOptions.register({
			description: "folding-no-controls-range-decoration",
			stickiness: 0,
			afterContentClassName: "inline-folded",
			isWholeLine: !0,
			linesDecorationsTooltip: collapsed
		});
	}
	static {
		this.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION = ModelDecorationOptions.register({
			description: "folding-no-controls-range-decoration",
			stickiness: 0,
			afterContentClassName: "inline-folded",
			className: "folded-background",
			minimap: foldedBackgroundMinimap,
			isWholeLine: !0,
			linesDecorationsTooltip: collapsed
		});
	}
	static {
		this.EXPANDED_VISUAL_DECORATION = ModelDecorationOptions.register({
			description: "folding-expanded-visual-decoration",
			stickiness: 1,
			isWholeLine: !0,
			firstLineDecorationClassName: "alwaysShowFoldIcons " + ThemeIcon.asClassName(foldingExpandedIcon),
			linesDecorationsTooltip: expanded
		});
	}
	static {
		this.EXPANDED_AUTO_HIDE_VISUAL_DECORATION = ModelDecorationOptions.register({
			description: "folding-expanded-auto-hide-visual-decoration",
			stickiness: 1,
			isWholeLine: !0,
			firstLineDecorationClassName: ThemeIcon.asClassName(foldingExpandedIcon),
			linesDecorationsTooltip: expanded
		});
	}
	static {
		this.MANUALLY_EXPANDED_VISUAL_DECORATION = ModelDecorationOptions.register({
			description: "folding-manually-expanded-visual-decoration",
			stickiness: 0,
			isWholeLine: !0,
			firstLineDecorationClassName: "alwaysShowFoldIcons " + ThemeIcon.asClassName(foldingManualExpandedIcon),
			linesDecorationsTooltip: expanded
		});
	}
	static {
		this.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION = ModelDecorationOptions.register({
			description: "folding-manually-expanded-auto-hide-visual-decoration",
			stickiness: 0,
			isWholeLine: !0,
			firstLineDecorationClassName: ThemeIcon.asClassName(foldingManualExpandedIcon),
			linesDecorationsTooltip: expanded
		});
	}
	static {
		this.NO_CONTROLS_EXPANDED_RANGE_DECORATION = ModelDecorationOptions.register({
			description: "folding-no-controls-range-decoration",
			stickiness: 0,
			isWholeLine: !0
		});
	}
	static {
		this.HIDDEN_RANGE_DECORATION = ModelDecorationOptions.register({
			description: "folding-hidden-range-decoration",
			stickiness: 1
		});
	}
	constructor(e) {
		this.editor = e, this.showFoldingControls = "mouseover", this.showFoldingHighlights = !0;
	}
	getDecorationOption(O, k, A) {
		return k ? e.HIDDEN_RANGE_DECORATION : this.showFoldingControls === "never" ? O ? this.showFoldingHighlights ? e.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION : e.NO_CONTROLS_COLLAPSED_RANGE_DECORATION : e.NO_CONTROLS_EXPANDED_RANGE_DECORATION : O ? A ? this.showFoldingHighlights ? e.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION : e.MANUALLY_COLLAPSED_VISUAL_DECORATION : this.showFoldingHighlights ? e.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION : e.COLLAPSED_VISUAL_DECORATION : this.showFoldingControls === "mouseover" ? A ? e.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION : e.EXPANDED_AUTO_HIDE_VISUAL_DECORATION : A ? e.MANUALLY_EXPANDED_VISUAL_DECORATION : e.EXPANDED_VISUAL_DECORATION;
	}
	changeDecorations(e) {
		return this.editor.changeDecorations(e);
	}
	removeDecorations(e) {
		this.editor.removeDecorations(e);
	}
}, foldingContext = {}, ID_SYNTAX_PROVIDER = "syntax", SyntaxRangeProvider = class {
	constructor(e, O, k, A, j) {
		this.editorModel = e, this.providers = O, this.handleFoldingRangesChange = k, this.foldingRangesLimit = A, this.fallbackRangeProvider = j, this.id = ID_SYNTAX_PROVIDER, this.disposables = new DisposableStore(), j && this.disposables.add(j);
		for (let e of O) typeof e.onDidChange == "function" && this.disposables.add(e.onDidChange(k));
	}
	compute(e) {
		return collectSyntaxRanges(this.providers, this.editorModel, e).then((O) => O ? sanitizeRanges(O, this.foldingRangesLimit) : this.fallbackRangeProvider?.compute(e) ?? null);
	}
	dispose() {
		this.disposables.dispose();
	}
};
function collectSyntaxRanges(e, O, k) {
	let A = null, j = e.map((e, j) => Promise.resolve(e.provideFoldingRanges(O, foldingContext, k)).then((e) => {
		if (!k.isCancellationRequested && Array.isArray(e)) {
			Array.isArray(A) || (A = []);
			let k = O.getLineCount();
			for (let O of e) O.start > 0 && O.end > O.start && O.end <= k && A.push({
				start: O.start,
				end: O.end,
				rank: j,
				kind: O.kind
			});
		}
	}, onUnexpectedExternalError));
	return Promise.all(j).then((e) => A);
}
var RangesCollector = class {
	constructor(e) {
		this._startIndexes = [], this._endIndexes = [], this._nestingLevels = [], this._nestingLevelCounts = [], this._types = [], this._length = 0, this._foldingRangesLimit = e;
	}
	add(e, O, k, A) {
		if (e > 16777215 || O > 16777215) return;
		let j = this._length;
		this._startIndexes[j] = e, this._endIndexes[j] = O, this._nestingLevels[j] = A, this._types[j] = k, this._length++, A < 30 && (this._nestingLevelCounts[A] = (this._nestingLevelCounts[A] || 0) + 1);
	}
	toIndentRanges() {
		let e = this._foldingRangesLimit.limit;
		if (this._length <= e) {
			this._foldingRangesLimit.update(this._length, !1);
			let e = new Uint32Array(this._length), O = new Uint32Array(this._length);
			for (let k = 0; k < this._length; k++) e[k] = this._startIndexes[k], O[k] = this._endIndexes[k];
			return new FoldingRegions(e, O, this._types);
		} else {
			this._foldingRangesLimit.update(this._length, e);
			let O = 0, k = this._nestingLevelCounts.length;
			for (let A = 0; A < this._nestingLevelCounts.length; A++) {
				let j = this._nestingLevelCounts[A];
				if (j) {
					if (j + O > e) {
						k = A;
						break;
					}
					O += j;
				}
			}
			let A = new Uint32Array(e), j = new Uint32Array(e), M = [];
			for (let N = 0, P = 0; N < this._length; N++) {
				let F = this._nestingLevels[N];
				(F < k || F === k && O++ < e) && (A[P] = this._startIndexes[N], j[P] = this._endIndexes[N], M[P] = this._types[N], P++);
			}
			return new FoldingRegions(A, j, M);
		}
	}
};
function sanitizeRanges(e, O) {
	let k = e.sort((e, O) => {
		let k = e.start - O.start;
		return k === 0 && (k = e.rank - O.rank), k;
	}), A = new RangesCollector(O), j, M = [];
	for (let e of k) if (!j) j = e, A.add(e.start, e.end, e.kind && e.kind.value, M.length);
	else if (e.start > j.start) if (e.end <= j.end) M.push(j), j = e, A.add(e.start, e.end, e.kind && e.kind.value, M.length);
	else {
		if (e.start > j.end) {
			do
				j = M.pop();
			while (j && e.start > j.end);
			j && M.push(j), j = e;
		}
		A.add(e.start, e.end, e.kind && e.kind.value, M.length);
	}
	return A.toIndentRanges();
}
var __decorate$67 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$67 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, FoldingController_1, CONTEXT_FOLDING_ENABLED = new RawContextKey("foldingEnabled", !1), FoldingController = class extends Disposable {
	static {
		FoldingController_1 = this;
	}
	static {
		this.ID = "editor.contrib.folding";
	}
	static get(e) {
		return e.getContribution(FoldingController_1.ID);
	}
	static getFoldingRangeProviders(e, O) {
		let k = e.foldingRangeProvider.ordered(O);
		return FoldingController_1._foldingRangeSelector?.(k, O) ?? k;
	}
	constructor(e, O, k, A, j, M) {
		super(), this.contextKeyService = O, this.languageConfigurationService = k, this.languageFeaturesService = M, this.localToDispose = this._register(new DisposableStore()), this.editor = e, this._foldingLimitReporter = new RangesLimitReporter(e);
		let N = this.editor.getOptions();
		this._isEnabled = N.get(43), this._useFoldingProviders = N.get(44) !== "indentation", this._unfoldOnClickAfterEndOfLine = N.get(48), this._restoringViewState = !1, this._currentModelHasFoldedImports = !1, this._foldingImportsByDefault = N.get(46), this.updateDebounceInfo = j.for(M.foldingRangeProvider, "Folding", { min: 200 }), this.foldingModel = null, this.hiddenRangeModel = null, this.rangeProvider = null, this.foldingRegionPromise = null, this.foldingModelPromise = null, this.updateScheduler = null, this.cursorChangedScheduler = null, this.mouseDownInfo = null, this.foldingDecorationProvider = new FoldingDecorationProvider(e), this.foldingDecorationProvider.showFoldingControls = N.get(111), this.foldingDecorationProvider.showFoldingHighlights = N.get(45), this.foldingEnabled = CONTEXT_FOLDING_ENABLED.bindTo(this.contextKeyService), this.foldingEnabled.set(this._isEnabled), this._register(this.editor.onDidChangeModel(() => this.onModelChanged())), this._register(this.editor.onDidChangeConfiguration((e) => {
			if (e.hasChanged(43) && (this._isEnabled = this.editor.getOptions().get(43), this.foldingEnabled.set(this._isEnabled), this.onModelChanged()), e.hasChanged(47) && this.onModelChanged(), e.hasChanged(111) || e.hasChanged(45)) {
				let e = this.editor.getOptions();
				this.foldingDecorationProvider.showFoldingControls = e.get(111), this.foldingDecorationProvider.showFoldingHighlights = e.get(45), this.triggerFoldingModelChanged();
			}
			e.hasChanged(44) && (this._useFoldingProviders = this.editor.getOptions().get(44) !== "indentation", this.onFoldingStrategyChanged()), e.hasChanged(48) && (this._unfoldOnClickAfterEndOfLine = this.editor.getOptions().get(48)), e.hasChanged(46) && (this._foldingImportsByDefault = this.editor.getOptions().get(46));
		})), this.onModelChanged();
	}
	saveViewState() {
		let e = this.editor.getModel();
		if (!e || !this._isEnabled || e.isTooLargeForTokenization()) return {};
		if (this.foldingModel) {
			let O = this.foldingModel.getMemento(), k = this.rangeProvider ? this.rangeProvider.id : void 0;
			return {
				collapsedRegions: O,
				lineCount: e.getLineCount(),
				provider: k,
				foldedImports: this._currentModelHasFoldedImports
			};
		}
	}
	restoreViewState(e) {
		let O = this.editor.getModel();
		if (!(!O || !this._isEnabled || O.isTooLargeForTokenization() || !this.hiddenRangeModel) && e && (this._currentModelHasFoldedImports = !!e.foldedImports, e.collapsedRegions && e.collapsedRegions.length > 0 && this.foldingModel)) {
			this._restoringViewState = !0;
			try {
				this.foldingModel.applyMemento(e.collapsedRegions);
			} finally {
				this._restoringViewState = !1;
			}
		}
	}
	onModelChanged() {
		this.localToDispose.clear();
		let e = this.editor.getModel();
		!this._isEnabled || !e || e.isTooLargeForTokenization() || (this._currentModelHasFoldedImports = !1, this.foldingModel = new FoldingModel(e, this.foldingDecorationProvider), this.localToDispose.add(this.foldingModel), this.hiddenRangeModel = new HiddenRangeModel(this.foldingModel), this.localToDispose.add(this.hiddenRangeModel), this.localToDispose.add(this.hiddenRangeModel.onDidChange((e) => this.onHiddenRangesChanges(e))), this.updateScheduler = new Delayer(this.updateDebounceInfo.get(e)), this.cursorChangedScheduler = new RunOnceScheduler(() => this.revealCursor(), 200), this.localToDispose.add(this.cursorChangedScheduler), this.localToDispose.add(this.languageFeaturesService.foldingRangeProvider.onDidChange(() => this.onFoldingStrategyChanged())), this.localToDispose.add(this.editor.onDidChangeModelLanguageConfiguration(() => this.onFoldingStrategyChanged())), this.localToDispose.add(this.editor.onDidChangeModelContent((e) => this.onDidChangeModelContent(e))), this.localToDispose.add(this.editor.onDidChangeCursorPosition(() => this.onCursorPositionChanged())), this.localToDispose.add(this.editor.onMouseDown((e) => this.onEditorMouseDown(e))), this.localToDispose.add(this.editor.onMouseUp((e) => this.onEditorMouseUp(e))), this.localToDispose.add({ dispose: () => {
			this.foldingRegionPromise &&= (this.foldingRegionPromise.cancel(), null), this.updateScheduler?.cancel(), this.updateScheduler = null, this.foldingModel = null, this.foldingModelPromise = null, this.hiddenRangeModel = null, this.cursorChangedScheduler = null, this.rangeProvider?.dispose(), this.rangeProvider = null;
		} }), this.triggerFoldingModelChanged());
	}
	onFoldingStrategyChanged() {
		this.rangeProvider?.dispose(), this.rangeProvider = null, this.triggerFoldingModelChanged();
	}
	getRangeProvider(e) {
		if (this.rangeProvider) return this.rangeProvider;
		let O = new IndentRangeProvider(e, this.languageConfigurationService, this._foldingLimitReporter);
		if (this.rangeProvider = O, this._useFoldingProviders && this.foldingModel) {
			let k = FoldingController_1.getFoldingRangeProviders(this.languageFeaturesService, e);
			k.length > 0 && (this.rangeProvider = new SyntaxRangeProvider(e, k, () => this.triggerFoldingModelChanged(), this._foldingLimitReporter, O));
		}
		return this.rangeProvider;
	}
	getFoldingModel() {
		return this.foldingModelPromise;
	}
	onDidChangeModelContent(e) {
		this.hiddenRangeModel?.notifyChangeModelContent(e), this.triggerFoldingModelChanged();
	}
	triggerFoldingModelChanged() {
		this.updateScheduler && (this.foldingRegionPromise &&= (this.foldingRegionPromise.cancel(), null), this.foldingModelPromise = this.updateScheduler.trigger(() => {
			let e = this.foldingModel;
			if (!e) return null;
			let O = new StopWatch(), k = this.getRangeProvider(e.textModel), A = this.foldingRegionPromise = createCancelablePromise((e) => k.compute(e));
			return A.then((k) => {
				if (k && A === this.foldingRegionPromise) {
					let A;
					if (this._foldingImportsByDefault && !this._currentModelHasFoldedImports) {
						let e = k.setCollapsedAllOfType(FoldingRangeKind.Imports.value, !0);
						e && (A = StableEditorScrollState.capture(this.editor), this._currentModelHasFoldedImports = e);
					}
					let j = this.editor.getSelections();
					e.update(k, toSelectedLines(j)), A?.restore(this.editor);
					let M = this.updateDebounceInfo.update(e.textModel, O.elapsed());
					this.updateScheduler && (this.updateScheduler.defaultDelay = M);
				}
				return e;
			});
		}).then(void 0, (e) => (onUnexpectedError(e), null)));
	}
	onHiddenRangesChanges(e) {
		if (this.hiddenRangeModel && e.length && !this._restoringViewState) {
			let e = this.editor.getSelections();
			e && this.hiddenRangeModel.adjustSelections(e) && this.editor.setSelections(e);
		}
		this.editor.setHiddenAreas(e, this);
	}
	onCursorPositionChanged() {
		this.hiddenRangeModel && this.hiddenRangeModel.hasRanges() && this.cursorChangedScheduler.schedule();
	}
	revealCursor() {
		let e = this.getFoldingModel();
		e && e.then((e) => {
			if (e) {
				let O = this.editor.getSelections();
				if (O && O.length > 0) {
					let k = [];
					for (let A of O) {
						let O = A.selectionStartLineNumber;
						this.hiddenRangeModel && this.hiddenRangeModel.isHidden(O) && k.push(...e.getAllRegionsAtLine(O, (e) => e.isCollapsed && O > e.startLineNumber));
					}
					k.length && (e.toggleCollapseState(k), this.reveal(O[0].getPosition()));
				}
			}
		}).then(void 0, onUnexpectedError);
	}
	onEditorMouseDown(e) {
		if (this.mouseDownInfo = null, !this.hiddenRangeModel || !e.target || !e.target.range || !e.event.leftButton && !e.event.middleButton) return;
		let O = e.target.range, k = !1;
		switch (e.target.type) {
			case 4: {
				let O = e.target.detail, A = e.target.element.offsetLeft;
				if (O.offsetX - A < 4) return;
				k = !0;
				break;
			}
			case 7:
				if (this._unfoldOnClickAfterEndOfLine && this.hiddenRangeModel.hasRanges() && !e.target.detail.isAfterLines) break;
				return;
			case 6:
				if (this.hiddenRangeModel.hasRanges()) {
					let e = this.editor.getModel();
					if (e && O.startColumn === e.getLineMaxColumn(O.startLineNumber)) break;
				}
				return;
			default: return;
		}
		this.mouseDownInfo = {
			lineNumber: O.startLineNumber,
			iconClicked: k
		};
	}
	onEditorMouseUp(e) {
		let O = this.foldingModel;
		if (!O || !this.mouseDownInfo || !e.target) return;
		let k = this.mouseDownInfo.lineNumber, A = this.mouseDownInfo.iconClicked, j = e.target.range;
		if (!j || j.startLineNumber !== k) return;
		if (A) {
			if (e.target.type !== 4) return;
		} else {
			let e = this.editor.getModel();
			if (!e || j.startColumn !== e.getLineMaxColumn(k)) return;
		}
		let M = O.getRegionAtLine(k);
		if (M && M.startLineNumber === k) {
			let j = M.isCollapsed;
			if (A || j) {
				let A = e.event.altKey, N = [];
				if (A) {
					let e = O.getRegionsInside(null, (e) => !e.containedBy(M) && !M.containedBy(e));
					for (let O of e) O.isCollapsed && N.push(O);
					N.length === 0 && (N = e);
				} else {
					let k = e.event.middleButton || e.event.shiftKey;
					if (k) for (let e of O.getRegionsInside(M)) e.isCollapsed === j && N.push(e);
					(j || !k || N.length === 0) && N.push(M);
				}
				O.toggleCollapseState(N), this.reveal({
					lineNumber: k,
					column: 1
				});
			}
		}
	}
	reveal(e) {
		this.editor.revealPositionInCenterIfOutsideViewport(e, 0);
	}
};
FoldingController = FoldingController_1 = __decorate$67([
	__param$67(1, IContextKeyService),
	__param$67(2, ILanguageConfigurationService),
	__param$67(3, INotificationService),
	__param$67(4, ILanguageFeatureDebounceService),
	__param$67(5, ILanguageFeaturesService)
], FoldingController);
var RangesLimitReporter = class {
	constructor(e) {
		this.editor = e, this._onDidChange = new Emitter(), this._computed = 0, this._limited = !1;
	}
	get limit() {
		return this.editor.getOptions().get(47);
	}
	update(e, O) {
		(e !== this._computed || O !== this._limited) && (this._computed = e, this._limited = O, this._onDidChange.fire());
	}
}, FoldingAction = class extends EditorAction {
	runEditorCommand(e, O, k) {
		let A = e.get(ILanguageConfigurationService), j = FoldingController.get(O);
		if (!j) return;
		let M = j.getFoldingModel();
		if (M) return this.reportTelemetry(e, O), M.then((e) => {
			if (e) {
				this.invoke(j, e, O, k, A);
				let M = O.getSelection();
				M && j.reveal(M.getStartPosition());
			}
		});
	}
	getSelectedLines(e) {
		let O = e.getSelections();
		return O ? O.map((e) => e.startLineNumber) : [];
	}
	getLineNumbers(e, O) {
		return e && e.selectionLines ? e.selectionLines.map((e) => e + 1) : this.getSelectedLines(O);
	}
	run(e, O) {}
};
function toSelectedLines(e) {
	return !e || e.length === 0 ? { startsInside: () => !1 } : { startsInside(O, k) {
		for (let A of e) {
			let e = A.startLineNumber;
			if (e >= O && e <= k) return !0;
		}
		return !1;
	} };
}
function foldingArgumentsConstraint(e) {
	if (!isUndefined(e)) {
		if (!isObject(e)) return !1;
		let O = e;
		if (!isUndefined(O.levels) && !isNumber(O.levels) || !isUndefined(O.direction) && !isString(O.direction) || !isUndefined(O.selectionLines) && (!Array.isArray(O.selectionLines) || !O.selectionLines.every(isNumber))) return !1;
	}
	return !0;
}
var UnfoldAction = class extends FoldingAction {
	constructor() {
		super({
			id: "editor.unfold",
			label: localize("unfoldAction.label", "Unfold"),
			alias: "Unfold",
			precondition: CONTEXT_FOLDING_ENABLED,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: 3166,
				mac: { primary: 2654 },
				weight: 100
			},
			metadata: {
				description: "Unfold the content in the editor",
				args: [{
					name: "Unfold editor argument",
					description: "Property-value pairs that can be passed through this argument:\n						* 'levels': Number of levels to unfold. If not set, defaults to 1.\n						* 'direction': If 'up', unfold given number of levels up otherwise unfolds down.\n						* 'selectionLines': Array of the start lines (0-based) of the editor selections to apply the unfold action to. If not set, the active selection(s) will be used.\n						",
					constraint: foldingArgumentsConstraint,
					schema: {
						type: "object",
						properties: {
							levels: {
								type: "number",
								default: 1
							},
							direction: {
								type: "string",
								enum: ["up", "down"],
								default: "down"
							},
							selectionLines: {
								type: "array",
								items: { type: "number" }
							}
						}
					}
				}]
			}
		});
	}
	invoke(e, O, k, A) {
		let j = A && A.levels || 1, M = this.getLineNumbers(A, k);
		A && A.direction === "up" ? setCollapseStateLevelsUp(O, !1, j, M) : setCollapseStateLevelsDown(O, !1, j, M);
	}
}, UnFoldRecursivelyAction = class extends FoldingAction {
	constructor() {
		super({
			id: "editor.unfoldRecursively",
			label: localize("unFoldRecursivelyAction.label", "Unfold Recursively"),
			alias: "Unfold Recursively",
			precondition: CONTEXT_FOLDING_ENABLED,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: KeyChord(2089, 2142),
				weight: 100
			}
		});
	}
	invoke(e, O, k, A) {
		setCollapseStateLevelsDown(O, !1, Number.MAX_VALUE, this.getSelectedLines(k));
	}
}, FoldAction = class extends FoldingAction {
	constructor() {
		super({
			id: "editor.fold",
			label: localize("foldAction.label", "Fold"),
			alias: "Fold",
			precondition: CONTEXT_FOLDING_ENABLED,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: 3164,
				mac: { primary: 2652 },
				weight: 100
			},
			metadata: {
				description: "Fold the content in the editor",
				args: [{
					name: "Fold editor argument",
					description: "Property-value pairs that can be passed through this argument:\n							* 'levels': Number of levels to fold.\n							* 'direction': If 'up', folds given number of levels up otherwise folds down.\n							* 'selectionLines': Array of the start lines (0-based) of the editor selections to apply the fold action to. If not set, the active selection(s) will be used.\n							If no levels or direction is set, folds the region at the locations or if already collapsed, the first uncollapsed parent instead.\n						",
					constraint: foldingArgumentsConstraint,
					schema: {
						type: "object",
						properties: {
							levels: { type: "number" },
							direction: {
								type: "string",
								enum: ["up", "down"]
							},
							selectionLines: {
								type: "array",
								items: { type: "number" }
							}
						}
					}
				}]
			}
		});
	}
	invoke(e, O, k, A) {
		let j = this.getLineNumbers(A, k), M = A && A.levels, N = A && A.direction;
		typeof M != "number" && typeof N != "string" ? setCollapseStateUp(O, !0, j) : N === "up" ? setCollapseStateLevelsUp(O, !0, M || 1, j) : setCollapseStateLevelsDown(O, !0, M || 1, j);
	}
}, ToggleFoldAction = class extends FoldingAction {
	constructor() {
		super({
			id: "editor.toggleFold",
			label: localize("toggleFoldAction.label", "Toggle Fold"),
			alias: "Toggle Fold",
			precondition: CONTEXT_FOLDING_ENABLED,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: KeyChord(2089, 2090),
				weight: 100
			}
		});
	}
	invoke(e, O, k) {
		let A = this.getSelectedLines(k);
		toggleCollapseState(O, 1, A);
	}
}, FoldRecursivelyAction = class extends FoldingAction {
	constructor() {
		super({
			id: "editor.foldRecursively",
			label: localize("foldRecursivelyAction.label", "Fold Recursively"),
			alias: "Fold Recursively",
			precondition: CONTEXT_FOLDING_ENABLED,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: KeyChord(2089, 2140),
				weight: 100
			}
		});
	}
	invoke(e, O, k) {
		let A = this.getSelectedLines(k);
		setCollapseStateLevelsDown(O, !0, Number.MAX_VALUE, A);
	}
}, ToggleFoldRecursivelyAction = class extends FoldingAction {
	constructor() {
		super({
			id: "editor.toggleFoldRecursively",
			label: localize("toggleFoldRecursivelyAction.label", "Toggle Fold Recursively"),
			alias: "Toggle Fold Recursively",
			precondition: CONTEXT_FOLDING_ENABLED,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: KeyChord(2089, 3114),
				weight: 100
			}
		});
	}
	invoke(e, O, k) {
		let A = this.getSelectedLines(k);
		toggleCollapseState(O, Number.MAX_VALUE, A);
	}
}, FoldAllBlockCommentsAction = class extends FoldingAction {
	constructor() {
		super({
			id: "editor.foldAllBlockComments",
			label: localize("foldAllBlockComments.label", "Fold All Block Comments"),
			alias: "Fold All Block Comments",
			precondition: CONTEXT_FOLDING_ENABLED,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: KeyChord(2089, 2138),
				weight: 100
			}
		});
	}
	invoke(e, O, k, A, j) {
		if (O.regions.hasTypes()) setCollapseStateForType(O, FoldingRangeKind.Comment.value, !0);
		else {
			let e = k.getModel();
			if (!e) return;
			let A = j.getLanguageConfiguration(e.getLanguageId()).comments;
			if (A && A.blockCommentStartToken) {
				let e = /* @__PURE__ */ RegExp("^\\s*" + escapeRegExpCharacters(A.blockCommentStartToken));
				setCollapseStateForMatchingLines(O, e, !0);
			}
		}
	}
}, FoldAllRegionsAction = class extends FoldingAction {
	constructor() {
		super({
			id: "editor.foldAllMarkerRegions",
			label: localize("foldAllMarkerRegions.label", "Fold All Regions"),
			alias: "Fold All Regions",
			precondition: CONTEXT_FOLDING_ENABLED,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: KeyChord(2089, 2077),
				weight: 100
			}
		});
	}
	invoke(e, O, k, A, j) {
		if (O.regions.hasTypes()) setCollapseStateForType(O, FoldingRangeKind.Region.value, !0);
		else {
			let e = k.getModel();
			if (!e) return;
			let A = j.getLanguageConfiguration(e.getLanguageId()).foldingRules;
			if (A && A.markers && A.markers.start) {
				let e = new RegExp(A.markers.start);
				setCollapseStateForMatchingLines(O, e, !0);
			}
		}
	}
}, UnfoldAllRegionsAction = class extends FoldingAction {
	constructor() {
		super({
			id: "editor.unfoldAllMarkerRegions",
			label: localize("unfoldAllMarkerRegions.label", "Unfold All Regions"),
			alias: "Unfold All Regions",
			precondition: CONTEXT_FOLDING_ENABLED,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: KeyChord(2089, 2078),
				weight: 100
			}
		});
	}
	invoke(e, O, k, A, j) {
		if (O.regions.hasTypes()) setCollapseStateForType(O, FoldingRangeKind.Region.value, !1);
		else {
			let e = k.getModel();
			if (!e) return;
			let A = j.getLanguageConfiguration(e.getLanguageId()).foldingRules;
			if (A && A.markers && A.markers.start) {
				let e = new RegExp(A.markers.start);
				setCollapseStateForMatchingLines(O, e, !1);
			}
		}
	}
}, FoldAllExceptAction = class extends FoldingAction {
	constructor() {
		super({
			id: "editor.foldAllExcept",
			label: localize("foldAllExcept.label", "Fold All Except Selected"),
			alias: "Fold All Except Selected",
			precondition: CONTEXT_FOLDING_ENABLED,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: KeyChord(2089, 2136),
				weight: 100
			}
		});
	}
	invoke(e, O, k) {
		let A = this.getSelectedLines(k);
		setCollapseStateForRest(O, !0, A);
	}
}, UnfoldAllExceptAction = class extends FoldingAction {
	constructor() {
		super({
			id: "editor.unfoldAllExcept",
			label: localize("unfoldAllExcept.label", "Unfold All Except Selected"),
			alias: "Unfold All Except Selected",
			precondition: CONTEXT_FOLDING_ENABLED,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: KeyChord(2089, 2134),
				weight: 100
			}
		});
	}
	invoke(e, O, k) {
		let A = this.getSelectedLines(k);
		setCollapseStateForRest(O, !1, A);
	}
}, FoldAllAction = class extends FoldingAction {
	constructor() {
		super({
			id: "editor.foldAll",
			label: localize("foldAllAction.label", "Fold All"),
			alias: "Fold All",
			precondition: CONTEXT_FOLDING_ENABLED,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: KeyChord(2089, 2069),
				weight: 100
			}
		});
	}
	invoke(e, O, k) {
		setCollapseStateLevelsDown(O, !0);
	}
}, UnfoldAllAction = class extends FoldingAction {
	constructor() {
		super({
			id: "editor.unfoldAll",
			label: localize("unfoldAllAction.label", "Unfold All"),
			alias: "Unfold All",
			precondition: CONTEXT_FOLDING_ENABLED,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: KeyChord(2089, 2088),
				weight: 100
			}
		});
	}
	invoke(e, O, k) {
		setCollapseStateLevelsDown(O, !1);
	}
}, FoldLevelAction = class e extends FoldingAction {
	static {
		this.ID_PREFIX = "editor.foldLevel";
	}
	static {
		this.ID = (O) => e.ID_PREFIX + O;
	}
	getFoldingLevel() {
		return parseInt(this.id.substr(e.ID_PREFIX.length));
	}
	invoke(e, O, k) {
		setCollapseStateAtLevel(O, this.getFoldingLevel(), !0, this.getSelectedLines(k));
	}
}, GotoParentFoldAction = class extends FoldingAction {
	constructor() {
		super({
			id: "editor.gotoParentFold",
			label: localize("gotoParentFold.label", "Go to Parent Fold"),
			alias: "Go to Parent Fold",
			precondition: CONTEXT_FOLDING_ENABLED,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				weight: 100
			}
		});
	}
	invoke(e, O, k) {
		let A = this.getSelectedLines(k);
		if (A.length > 0) {
			let e = getParentFoldLine(A[0], O);
			e !== null && k.setSelection({
				startLineNumber: e,
				startColumn: 1,
				endLineNumber: e,
				endColumn: 1
			});
		}
	}
}, GotoPreviousFoldAction = class extends FoldingAction {
	constructor() {
		super({
			id: "editor.gotoPreviousFold",
			label: localize("gotoPreviousFold.label", "Go to Previous Folding Range"),
			alias: "Go to Previous Folding Range",
			precondition: CONTEXT_FOLDING_ENABLED,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				weight: 100
			}
		});
	}
	invoke(e, O, k) {
		let A = this.getSelectedLines(k);
		if (A.length > 0) {
			let e = getPreviousFoldLine(A[0], O);
			e !== null && k.setSelection({
				startLineNumber: e,
				startColumn: 1,
				endLineNumber: e,
				endColumn: 1
			});
		}
	}
}, GotoNextFoldAction = class extends FoldingAction {
	constructor() {
		super({
			id: "editor.gotoNextFold",
			label: localize("gotoNextFold.label", "Go to Next Folding Range"),
			alias: "Go to Next Folding Range",
			precondition: CONTEXT_FOLDING_ENABLED,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				weight: 100
			}
		});
	}
	invoke(e, O, k) {
		let A = this.getSelectedLines(k);
		if (A.length > 0) {
			let e = getNextFoldLine(A[0], O);
			e !== null && k.setSelection({
				startLineNumber: e,
				startColumn: 1,
				endLineNumber: e,
				endColumn: 1
			});
		}
	}
}, FoldRangeFromSelectionAction = class extends FoldingAction {
	constructor() {
		super({
			id: "editor.createFoldingRangeFromSelection",
			label: localize("createManualFoldRange.label", "Create Folding Range from Selection"),
			alias: "Create Folding Range from Selection",
			precondition: CONTEXT_FOLDING_ENABLED,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: KeyChord(2089, 2135),
				weight: 100
			}
		});
	}
	invoke(e, O, k) {
		let A = [], j = k.getSelections();
		if (j) {
			for (let e of j) {
				let O = e.endLineNumber;
				e.endColumn === 1 && --O, O > e.startLineNumber && (A.push({
					startLineNumber: e.startLineNumber,
					endLineNumber: O,
					type: void 0,
					isCollapsed: !0,
					source: 1
				}), k.setSelection({
					startLineNumber: e.startLineNumber,
					startColumn: 1,
					endLineNumber: e.startLineNumber,
					endColumn: 1
				}));
			}
			if (A.length > 0) {
				A.sort((e, O) => e.startLineNumber - O.startLineNumber);
				let e = FoldingRegions.sanitizeAndMerge(O.regions, A, k.getModel()?.getLineCount());
				O.updatePost(FoldingRegions.fromFoldRanges(e));
			}
		}
	}
}, RemoveFoldRangeFromSelectionAction = class extends FoldingAction {
	constructor() {
		super({
			id: "editor.removeManualFoldingRanges",
			label: localize("removeManualFoldingRanges.label", "Remove Manual Folding Ranges"),
			alias: "Remove Manual Folding Ranges",
			precondition: CONTEXT_FOLDING_ENABLED,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: KeyChord(2089, 2137),
				weight: 100
			}
		});
	}
	invoke(e, O, k) {
		let A = k.getSelections();
		if (A) {
			let k = [];
			for (let e of A) {
				let { startLineNumber: O, endLineNumber: A } = e;
				k.push(A >= O ? {
					startLineNumber: O,
					endLineNumber: A
				} : {
					endLineNumber: A,
					startLineNumber: O
				});
			}
			O.removeManualRanges(k), e.triggerFoldingModelChanged();
		}
	}
};
registerEditorContribution(FoldingController.ID, FoldingController, 0), registerEditorAction(UnfoldAction), registerEditorAction(UnFoldRecursivelyAction), registerEditorAction(FoldAction), registerEditorAction(FoldRecursivelyAction), registerEditorAction(ToggleFoldRecursivelyAction), registerEditorAction(FoldAllAction), registerEditorAction(UnfoldAllAction), registerEditorAction(FoldAllBlockCommentsAction), registerEditorAction(FoldAllRegionsAction), registerEditorAction(UnfoldAllRegionsAction), registerEditorAction(FoldAllExceptAction), registerEditorAction(UnfoldAllExceptAction), registerEditorAction(ToggleFoldAction), registerEditorAction(GotoParentFoldAction), registerEditorAction(GotoPreviousFoldAction), registerEditorAction(GotoNextFoldAction), registerEditorAction(FoldRangeFromSelectionAction), registerEditorAction(RemoveFoldRangeFromSelectionAction);
for (let e = 1; e <= 7; e++) registerInstantiatedEditorAction(new FoldLevelAction({
	id: FoldLevelAction.ID(e),
	label: localize("foldLevelAction.label", "Fold Level {0}", e),
	alias: `Fold Level ${e}`,
	precondition: CONTEXT_FOLDING_ENABLED,
	kbOpts: {
		kbExpr: EditorContextKeys.editorTextFocus,
		primary: KeyChord(2089, 2048 | 21 + e),
		weight: 100
	}
}));
CommandsRegistry.registerCommand("_executeFoldingRangeProvider", async function(e, ...O) {
	let [k] = O;
	if (!(k instanceof URI)) throw illegalArgument();
	let A = e.get(ILanguageFeaturesService), M = e.get(IModelService).getModel(k);
	if (!M) throw illegalArgument();
	let N = e.get(IConfigurationService);
	if (!N.getValue("editor.folding", { resource: k })) return [];
	let P = e.get(ILanguageConfigurationService), F = N.getValue("editor.foldingStrategy", { resource: k }), I = {
		get limit() {
			return N.getValue("editor.foldingMaximumRegions", { resource: k });
		},
		update: (e, O) => {}
	}, L = new IndentRangeProvider(M, P, I), R = L;
	if (F !== "indentation") {
		let e = FoldingController.getFoldingRangeProviders(A, M);
		e.length && (R = new SyntaxRangeProvider(M, e, () => {}, I, L));
	}
	let z = await R.compute(CancellationToken.None), B = [];
	try {
		if (z) for (let e = 0; e < z.length; e++) {
			let O = z.getType(e);
			B.push({
				start: z.getStartLineNumber(e),
				end: z.getEndLineNumber(e),
				kind: O ? FoldingRangeKind.fromValue(O) : void 0
			});
		}
		return B;
	} finally {
		R.dispose();
	}
});
var EditorFontZoomIn = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.fontZoomIn",
			label: localize("EditorFontZoomIn.label", "Increase Editor Font Size"),
			alias: "Increase Editor Font Size",
			precondition: void 0
		});
	}
	run(e, O) {
		EditorZoom.setZoomLevel(EditorZoom.getZoomLevel() + 1);
	}
}, EditorFontZoomOut = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.fontZoomOut",
			label: localize("EditorFontZoomOut.label", "Decrease Editor Font Size"),
			alias: "Decrease Editor Font Size",
			precondition: void 0
		});
	}
	run(e, O) {
		EditorZoom.setZoomLevel(EditorZoom.getZoomLevel() - 1);
	}
}, EditorFontZoomReset = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.fontZoomReset",
			label: localize("EditorFontZoomReset.label", "Reset Editor Font Size"),
			alias: "Reset Editor Font Size",
			precondition: void 0
		});
	}
	run(e, O) {
		EditorZoom.setZoomLevel(0);
	}
};
registerEditorAction(EditorFontZoomIn), registerEditorAction(EditorFontZoomOut), registerEditorAction(EditorFontZoomReset);
var __decorate$66 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$66 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, FormatOnType = class {
	static {
		this.ID = "editor.contrib.autoFormat";
	}
	constructor(e, O, k, A) {
		this._editor = e, this._languageFeaturesService = O, this._workerService = k, this._accessibilitySignalService = A, this._disposables = new DisposableStore(), this._sessionDisposables = new DisposableStore(), this._disposables.add(O.onTypeFormattingEditProvider.onDidChange(this._update, this)), this._disposables.add(e.onDidChangeModel(() => this._update())), this._disposables.add(e.onDidChangeModelLanguage(() => this._update())), this._disposables.add(e.onDidChangeConfiguration((e) => {
			e.hasChanged(56) && this._update();
		})), this._update();
	}
	dispose() {
		this._disposables.dispose(), this._sessionDisposables.dispose();
	}
	_update() {
		if (this._sessionDisposables.clear(), !this._editor.getOption(56) || !this._editor.hasModel()) return;
		let e = this._editor.getModel(), [O] = this._languageFeaturesService.onTypeFormattingEditProvider.ordered(e);
		if (!O || !O.autoFormatTriggerCharacters) return;
		let k = new CharacterSet();
		for (let e of O.autoFormatTriggerCharacters) k.add(e.charCodeAt(0));
		this._sessionDisposables.add(this._editor.onDidType((e) => {
			let O = e.charCodeAt(e.length - 1);
			k.has(O) && this._trigger(String.fromCharCode(O));
		}));
	}
	_trigger(e) {
		if (!this._editor.hasModel() || this._editor.getSelections().length > 1 || !this._editor.getSelection().isEmpty()) return;
		let O = this._editor.getModel(), k = this._editor.getPosition(), A = new CancellationTokenSource(), j = this._editor.onDidChangeModelContent((e) => {
			if (e.isFlush) {
				A.cancel(), j.dispose();
				return;
			}
			for (let O = 0, M = e.changes.length; O < M; O++) if (e.changes[O].range.endLineNumber <= k.lineNumber) {
				A.cancel(), j.dispose();
				return;
			}
		});
		getOnTypeFormattingEdits(this._workerService, this._languageFeaturesService, O, k, e, O.getFormattingOptions(), A.token).then((e) => {
			A.token.isCancellationRequested || isNonEmptyArray(e) && (this._accessibilitySignalService.playSignal(AccessibilitySignal.format, { userGesture: !1 }), FormattingEdit.execute(this._editor, e, !0));
		}).finally(() => {
			j.dispose();
		});
	}
};
FormatOnType = __decorate$66([
	__param$66(1, ILanguageFeaturesService),
	__param$66(2, IEditorWorkerService),
	__param$66(3, IAccessibilitySignalService)
], FormatOnType);
var FormatOnPaste = class {
	static {
		this.ID = "editor.contrib.formatOnPaste";
	}
	constructor(e, O, k) {
		this.editor = e, this._languageFeaturesService = O, this._instantiationService = k, this._callOnDispose = new DisposableStore(), this._callOnModel = new DisposableStore(), this._callOnDispose.add(e.onDidChangeConfiguration(() => this._update())), this._callOnDispose.add(e.onDidChangeModel(() => this._update())), this._callOnDispose.add(e.onDidChangeModelLanguage(() => this._update())), this._callOnDispose.add(O.documentRangeFormattingEditProvider.onDidChange(this._update, this));
	}
	dispose() {
		this._callOnDispose.dispose(), this._callOnModel.dispose();
	}
	_update() {
		this._callOnModel.clear(), this.editor.getOption(55) && this.editor.hasModel() && this._languageFeaturesService.documentRangeFormattingEditProvider.has(this.editor.getModel()) && this._callOnModel.add(this.editor.onDidPaste(({ range: e }) => this._trigger(e)));
	}
	_trigger(e) {
		this.editor.hasModel() && (this.editor.getSelections().length > 1 || this._instantiationService.invokeFunction(formatDocumentRangesWithSelectedProvider, this.editor, e, 2, Progress.None, CancellationToken.None, !1).catch(onUnexpectedError));
	}
};
FormatOnPaste = __decorate$66([__param$66(1, ILanguageFeaturesService), __param$66(2, IInstantiationService)], FormatOnPaste);
var FormatDocumentAction = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.formatDocument",
			label: localize("formatDocument.label", "Format Document"),
			alias: "Format Document",
			precondition: ContextKeyExpr.and(EditorContextKeys.notInCompositeEditor, EditorContextKeys.writable, EditorContextKeys.hasDocumentFormattingProvider),
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: 1572,
				linux: { primary: 3111 },
				weight: 100
			},
			contextMenuOpts: {
				group: "1_modification",
				order: 1.3
			}
		});
	}
	async run(e, O) {
		if (O.hasModel()) {
			let k = e.get(IInstantiationService);
			await e.get(IEditorProgressService).showWhile(k.invokeFunction(formatDocumentWithSelectedProvider, O, 1, Progress.None, CancellationToken.None, !0), 250);
		}
	}
}, FormatSelectionAction = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.formatSelection",
			label: localize("formatSelection.label", "Format Selection"),
			alias: "Format Selection",
			precondition: ContextKeyExpr.and(EditorContextKeys.writable, EditorContextKeys.hasDocumentSelectionFormattingProvider),
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: KeyChord(2089, 2084),
				weight: 100
			},
			contextMenuOpts: {
				when: EditorContextKeys.hasNonEmptySelection,
				group: "1_modification",
				order: 1.31
			}
		});
	}
	async run(e, O) {
		if (!O.hasModel()) return;
		let k = e.get(IInstantiationService), A = O.getModel(), j = O.getSelections().map((e) => e.isEmpty() ? new Range(e.startLineNumber, 1, e.startLineNumber, A.getLineMaxColumn(e.startLineNumber)) : e);
		await e.get(IEditorProgressService).showWhile(k.invokeFunction(formatDocumentRangesWithSelectedProvider, O, j, 1, Progress.None, CancellationToken.None, !0), 250);
	}
};
registerEditorContribution(FormatOnType.ID, FormatOnType, 2), registerEditorContribution(FormatOnPaste.ID, FormatOnPaste, 2), registerEditorAction(FormatDocumentAction), registerEditorAction(FormatSelectionAction), CommandsRegistry.registerCommand("editor.action.format", async (e) => {
	let O = e.get(ICodeEditorService).getFocusedCodeEditor();
	if (!O || !O.hasModel()) return;
	let k = e.get(ICommandService);
	O.getSelection().isEmpty() ? await k.executeCommand("editor.action.formatDocument") : await k.executeCommand("editor.action.formatSelection");
});
var __decorate$65 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$65 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, TreeElement = class {
	remove() {
		this.parent?.children.delete(this.id);
	}
	static findId(e, O) {
		let k;
		typeof e == "string" ? k = `${O.id}/${e}` : (k = `${O.id}/${e.name}`, O.children.get(k) !== void 0 && (k = `${O.id}/${e.name}_${e.range.startLineNumber}_${e.range.startColumn}`));
		let A = k;
		for (let e = 0; O.children.get(A) !== void 0; e++) A = `${k}_${e}`;
		return A;
	}
	static empty(e) {
		return e.children.size === 0;
	}
}, OutlineElement = class extends TreeElement {
	constructor(e, O, k) {
		super(), this.id = e, this.parent = O, this.symbol = k, this.children = /* @__PURE__ */ new Map();
	}
}, OutlineGroup = class extends TreeElement {
	constructor(e, O, k, A) {
		super(), this.id = e, this.parent = O, this.label = k, this.order = A, this.children = /* @__PURE__ */ new Map();
	}
}, OutlineModel = class e extends TreeElement {
	static create(O, k, A) {
		let j = new CancellationTokenSource(A), M = new e(k.uri), N = O.ordered(k), P = N.map((O, A) => {
			let N = TreeElement.findId(`provider_${A}`, M), P = new OutlineGroup(N, M, O.displayName ?? "Unknown Outline Provider", A);
			return Promise.resolve(O.provideDocumentSymbols(k, j.token)).then((O) => {
				for (let k of O || []) e._makeOutlineElement(k, P);
				return P;
			}, (e) => (onUnexpectedExternalError(e), P)).then((e) => {
				TreeElement.empty(e) ? e.remove() : M._groups.set(N, e);
			});
		}), F = O.onDidChange(() => {
			let e = O.ordered(k);
			equals(e, N) || j.cancel();
		});
		return Promise.all(P).then(() => j.token.isCancellationRequested && !A.isCancellationRequested ? e.create(O, k, A) : M._compact()).finally(() => {
			j.dispose(), F.dispose(), j.dispose();
		});
	}
	static _makeOutlineElement(O, k) {
		let A = TreeElement.findId(O, k), j = new OutlineElement(A, k, O);
		if (O.children) for (let k of O.children) e._makeOutlineElement(k, j);
		k.children.set(j.id, j);
	}
	constructor(e) {
		super(), this.uri = e, this.id = "root", this.parent = void 0, this._groups = /* @__PURE__ */ new Map(), this.children = /* @__PURE__ */ new Map(), this.id = "root", this.parent = void 0;
	}
	_compact() {
		let e = 0;
		for (let [O, k] of this._groups) k.children.size === 0 ? this._groups.delete(O) : e += 1;
		if (e !== 1) this.children = this._groups;
		else {
			let e = Iterable.first(this._groups.values());
			for (let [, O] of e.children) O.parent = this, this.children.set(O.id, O);
		}
		return this;
	}
	getTopLevelSymbols() {
		let e = [];
		for (let O of this.children.values()) O instanceof OutlineElement ? e.push(O.symbol) : e.push(...Iterable.map(O.children.values(), (e) => e.symbol));
		return e.sort((e, O) => Range.compareRangesUsingStarts(e.range, O.range));
	}
	asListOfDocumentSymbols() {
		let O = this.getTopLevelSymbols(), k = [];
		return e._flattenDocumentSymbols(k, O, ""), k.sort((e, O) => Position.compare(Range.getStartPosition(e.range), Range.getStartPosition(O.range)) || Position.compare(Range.getEndPosition(O.range), Range.getEndPosition(e.range)));
	}
	static _flattenDocumentSymbols(O, k, A) {
		for (let j of k) O.push({
			kind: j.kind,
			tags: j.tags,
			name: j.name,
			detail: j.detail,
			containerName: j.containerName || A,
			range: j.range,
			selectionRange: j.selectionRange,
			children: void 0
		}), j.children && e._flattenDocumentSymbols(O, j.children, j.name);
	}
};
const IOutlineModelService = createDecorator("IOutlineModelService");
var OutlineModelService = class {
	constructor(e, O, k) {
		this._languageFeaturesService = e, this._disposables = new DisposableStore(), this._cache = new LRUCache(10, .7), this._debounceInformation = O.for(e.documentSymbolProvider, "DocumentSymbols", { min: 350 }), this._disposables.add(k.onModelRemoved((e) => {
			this._cache.delete(e.id);
		}));
	}
	dispose() {
		this._disposables.dispose();
	}
	async getOrCreate(e, O) {
		let k = this._languageFeaturesService.documentSymbolProvider, A = k.ordered(e), j = this._cache.get(e.id);
		if (!j || j.versionId !== e.getVersionId() || !equals(j.provider, A)) {
			let O = new CancellationTokenSource();
			j = {
				versionId: e.getVersionId(),
				provider: A,
				promiseCnt: 0,
				source: O,
				promise: OutlineModel.create(k, e, O.token),
				model: void 0
			}, this._cache.set(e.id, j);
			let M = Date.now();
			j.promise.then((O) => {
				j.model = O, this._debounceInformation.update(e, Date.now() - M);
			}).catch((O) => {
				this._cache.delete(e.id);
			});
		}
		if (j.model) return j.model;
		j.promiseCnt += 1;
		let M = O.onCancellationRequested(() => {
			--j.promiseCnt === 0 && (j.source.cancel(), this._cache.delete(e.id));
		});
		try {
			return await j.promise;
		} finally {
			M.dispose();
		}
	}
};
OutlineModelService = __decorate$65([
	__param$65(0, ILanguageFeaturesService),
	__param$65(1, ILanguageFeatureDebounceService),
	__param$65(2, IModelService)
], OutlineModelService), registerSingleton(IOutlineModelService, OutlineModelService, 1), CommandsRegistry.registerCommand("_executeDocumentSymbolProvider", async function(e, ...O) {
	let [k] = O;
	assertType(URI.isUri(k));
	let A = e.get(IOutlineModelService), j = await e.get(ITextModelService).createModelReference(k);
	try {
		return (await A.getOrCreate(j.object.textEditorModel, CancellationToken.None)).getTopLevelSymbols();
	} finally {
		j.dispose();
	}
});
var InlineCompletionContextKeys = class e extends Disposable {
	static {
		this.inlineSuggestionVisible = new RawContextKey("inlineSuggestionVisible", !1, localize("inlineSuggestionVisible", "Whether an inline suggestion is visible"));
	}
	static {
		this.inlineSuggestionHasIndentation = new RawContextKey("inlineSuggestionHasIndentation", !1, localize("inlineSuggestionHasIndentation", "Whether the inline suggestion starts with whitespace"));
	}
	static {
		this.inlineSuggestionHasIndentationLessThanTabSize = new RawContextKey("inlineSuggestionHasIndentationLessThanTabSize", !0, localize("inlineSuggestionHasIndentationLessThanTabSize", "Whether the inline suggestion starts with whitespace that is less than what would be inserted by tab"));
	}
	static {
		this.suppressSuggestions = new RawContextKey("inlineSuggestionSuppressSuggestions", void 0, localize("suppressSuggestions", "Whether suggestions should be suppressed for the current suggestion"));
	}
	constructor(O, k) {
		super(), this.contextKeyService = O, this.model = k, this.inlineCompletionVisible = e.inlineSuggestionVisible.bindTo(this.contextKeyService), this.inlineCompletionSuggestsIndentation = e.inlineSuggestionHasIndentation.bindTo(this.contextKeyService), this.inlineCompletionSuggestsIndentationLessThanTabSize = e.inlineSuggestionHasIndentationLessThanTabSize.bindTo(this.contextKeyService), this.suppressSuggestions = e.suppressSuggestions.bindTo(this.contextKeyService), this._register(autorun((e) => {
			let O = this.model.read(e)?.state.read(e), k = !!O?.inlineCompletion && O?.primaryGhostText !== void 0 && !O?.primaryGhostText.isEmpty();
			this.inlineCompletionVisible.set(k), O?.primaryGhostText && O?.inlineCompletion && this.suppressSuggestions.set(O.inlineCompletion.inlineCompletion.source.inlineCompletions.suppressSuggestions);
		})), this._register(autorun((e) => {
			let O = this.model.read(e), k = !1, A = !0, j = O?.primaryGhostText.read(e);
			if (O?.selectedSuggestItem && j && j.parts.length > 0) {
				let { column: e, lines: M } = j.parts[0], N = M[0], P = O.textModel.getLineIndentColumn(j.lineNumber);
				if (e <= P) {
					let e = firstNonWhitespaceIndex(N);
					e === -1 && (e = N.length - 1), k = e > 0;
					let j = O.textModel.getOptions().tabSize;
					A = CursorColumns.visibleColumnFromColumn(N, e + 1, j) < j;
				}
			}
			this.inlineCompletionSuggestsIndentation.set(k), this.inlineCompletionSuggestsIndentationLessThanTabSize.set(A);
		}));
	}
};
function createStyleSheetFromObservable(e) {
	let O = new DisposableStore(), k = O.add(createStyleSheet2());
	return O.add(autorun((O) => {
		k.setStyle(e.read(O));
	})), O;
}
var GhostText = class {
	constructor(e, O) {
		this.lineNumber = e, this.parts = O;
	}
	equals(e) {
		return this.lineNumber === e.lineNumber && this.parts.length === e.parts.length && this.parts.every((O, k) => O.equals(e.parts[k]));
	}
	renderForScreenReader(e) {
		if (this.parts.length === 0) return "";
		let O = this.parts[this.parts.length - 1], k = e.substr(0, O.column - 1);
		return new TextEdit([...this.parts.map((e) => new SingleTextEdit(Range.fromPositions(new Position(1, e.column)), e.lines.join("\n")))]).applyToString(k).substring(this.parts[0].column - 1);
	}
	isEmpty() {
		return this.parts.every((e) => e.lines.length === 0);
	}
	get lineCount() {
		return 1 + this.parts.reduce((e, O) => e + O.lines.length - 1, 0);
	}
}, GhostTextPart = class {
	constructor(e, O, k) {
		this.column = e, this.text = O, this.preview = k, this.lines = splitLines(this.text);
	}
	equals(e) {
		return this.column === e.column && this.lines.length === e.lines.length && this.lines.every((O, k) => O === e.lines[k]);
	}
}, GhostTextReplacement = class {
	constructor(e, O, k, A = 0) {
		this.lineNumber = e, this.columnRange = O, this.text = k, this.additionalReservedLineCount = A, this.parts = [new GhostTextPart(this.columnRange.endColumnExclusive, this.text, !1)], this.newLines = splitLines(this.text);
	}
	renderForScreenReader(e) {
		return this.newLines.join("\n");
	}
	get lineCount() {
		return this.newLines.length;
	}
	isEmpty() {
		return this.parts.every((e) => e.lines.length === 0);
	}
	equals(e) {
		return this.lineNumber === e.lineNumber && this.columnRange.equals(e.columnRange) && this.newLines.length === e.newLines.length && this.newLines.every((O, k) => O === e.newLines[k]) && this.additionalReservedLineCount === e.additionalReservedLineCount;
	}
};
function ghostTextsOrReplacementsEqual(e, O) {
	return equals(e, O, ghostTextOrReplacementEquals);
}
function ghostTextOrReplacementEquals(e, O) {
	return e === O ? !0 : !e || !O ? !1 : e instanceof GhostText && O instanceof GhostText || e instanceof GhostTextReplacement && O instanceof GhostTextReplacement ? e.equals(O) : !1;
}
var array = [];
function getReadonlyEmptyArray() {
	return array;
}
var ColumnRange = class {
	constructor(e, O) {
		if (this.startColumn = e, this.endColumnExclusive = O, e > O) throw new BugIndicatingError(`startColumn ${e} cannot be after endColumnExclusive ${O}`);
	}
	toRange(e) {
		return new Range(e, this.startColumn, e, this.endColumnExclusive);
	}
	equals(e) {
		return this.startColumn === e.startColumn && this.endColumnExclusive === e.endColumnExclusive;
	}
};
function applyObservableDecorations(e, O) {
	let k = new DisposableStore(), A = e.createDecorationsCollection();
	return k.add(autorunOpts({ debugName: () => `Apply decorations from ${O.debugName}` }, (e) => {
		let k = O.read(e);
		A.set(k);
	})), k.add({ dispose: () => {
		A.clear();
	} }), k;
}
function addPositions(e, O) {
	return new Position(e.lineNumber + O.lineNumber - 1, O.lineNumber === 1 ? e.column + O.column - 1 : O.column);
}
function subtractPositions(e, O) {
	return new Position(e.lineNumber - O.lineNumber + 1, e.lineNumber - O.lineNumber === 0 ? e.column - O.column + 1 : e.column);
}
var __decorate$64 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$64 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
};
const GHOST_TEXT_DESCRIPTION = "ghost-text";
var GhostTextView = class extends Disposable {
	constructor(e, O, k) {
		super(), this.editor = e, this.model = O, this.languageService = k, this.isDisposed = observableValue(this, !1), this.currentTextModel = observableFromEvent(this, this.editor.onDidChangeModel, () => this.editor.getModel()), this.uiState = derived(this, (e) => {
			if (this.isDisposed.read(e)) return;
			let O = this.currentTextModel.read(e);
			if (O !== this.model.targetTextModel.read(e)) return;
			let k = this.model.ghostText.read(e);
			if (!k) return;
			let A = k instanceof GhostTextReplacement ? k.columnRange : void 0, j = [], M = [];
			function N(e, O) {
				if (M.length > 0) {
					let k = M[M.length - 1];
					O && k.decorations.push(new LineDecoration(k.content.length + 1, k.content.length + 1 + e[0].length, O, 0)), k.content += e[0], e = e.slice(1);
				}
				for (let k of e) M.push({
					content: k,
					decorations: O ? [new LineDecoration(1, k.length + 1, O, 0)] : []
				});
			}
			let P = O.getLineContent(k.lineNumber), F, I = 0;
			for (let e of k.parts) {
				let O = e.lines;
				F === void 0 ? (j.push({
					column: e.column,
					text: O[0],
					preview: e.preview
				}), O = O.slice(1)) : N([P.substring(I, e.column - 1)], void 0), O.length > 0 && (N(O, GHOST_TEXT_DESCRIPTION), F === void 0 && e.column <= P.length && (F = e.column)), I = e.column - 1;
			}
			F !== void 0 && N([P.substring(I)], void 0);
			let L = F === void 0 ? void 0 : new ColumnRange(F, P.length + 1);
			return {
				replacedRange: A,
				inlineTexts: j,
				additionalLines: M,
				hiddenRange: L,
				lineNumber: k.lineNumber,
				additionalReservedLineCount: this.model.minReservedLineCount.read(e),
				targetTextModel: O
			};
		}), this.decorations = derived(this, (e) => {
			let O = this.uiState.read(e);
			if (!O) return [];
			let k = [];
			O.replacedRange && k.push({
				range: O.replacedRange.toRange(O.lineNumber),
				options: {
					inlineClassName: "inline-completion-text-to-replace",
					description: "GhostTextReplacement"
				}
			}), O.hiddenRange && k.push({
				range: O.hiddenRange.toRange(O.lineNumber),
				options: {
					inlineClassName: "ghost-text-hidden",
					description: "ghost-text-hidden"
				}
			});
			for (let e of O.inlineTexts) k.push({
				range: Range.fromPositions(new Position(O.lineNumber, e.column)),
				options: {
					description: GHOST_TEXT_DESCRIPTION,
					after: {
						content: e.text,
						inlineClassName: e.preview ? "ghost-text-decoration-preview" : "ghost-text-decoration",
						cursorStops: InjectedTextCursorStops.Left
					},
					showIfCollapsed: !0
				}
			});
			return k;
		}), this.additionalLinesWidget = this._register(new AdditionalLinesWidget(this.editor, this.languageService.languageIdCodec, derived((e) => {
			let O = this.uiState.read(e);
			return O ? {
				lineNumber: O.lineNumber,
				additionalLines: O.additionalLines,
				minReservedLineCount: O.additionalReservedLineCount,
				targetTextModel: O.targetTextModel
			} : void 0;
		}))), this._register(toDisposable(() => {
			this.isDisposed.set(!0, void 0);
		})), this._register(applyObservableDecorations(this.editor, this.decorations));
	}
	ownsViewZone(e) {
		return this.additionalLinesWidget.viewZoneId === e;
	}
};
GhostTextView = __decorate$64([__param$64(2, ILanguageService)], GhostTextView);
var AdditionalLinesWidget = class extends Disposable {
	get viewZoneId() {
		return this._viewZoneId;
	}
	constructor(e, O, k) {
		super(), this.editor = e, this.languageIdCodec = O, this.lines = k, this._viewZoneId = void 0, this.editorOptionsChanged = observableSignalFromEvent("editorOptionChanged", Event.filter(this.editor.onDidChangeConfiguration, (e) => e.hasChanged(33) || e.hasChanged(118) || e.hasChanged(100) || e.hasChanged(95) || e.hasChanged(51) || e.hasChanged(50) || e.hasChanged(67))), this._register(autorun((e) => {
			let O = this.lines.read(e);
			this.editorOptionsChanged.read(e), O ? this.updateLines(O.lineNumber, O.additionalLines, O.minReservedLineCount) : this.clear();
		}));
	}
	dispose() {
		super.dispose(), this.clear();
	}
	clear() {
		this.editor.changeViewZones((e) => {
			this._viewZoneId &&= (e.removeZone(this._viewZoneId), void 0);
		});
	}
	updateLines(e, O, k) {
		let A = this.editor.getModel();
		if (!A) return;
		let { tabSize: j } = A.getOptions();
		this.editor.changeViewZones((A) => {
			this._viewZoneId &&= (A.removeZone(this._viewZoneId), void 0);
			let M = Math.max(O.length, k);
			if (M > 0) {
				let k = document.createElement("div");
				renderLines(k, j, O, this.editor.getOptions(), this.languageIdCodec), this._viewZoneId = A.addZone({
					afterLineNumber: e,
					heightInLines: M,
					domNode: k,
					afterColumnAffinity: 1
				});
			}
		});
	}
};
function renderLines(e, O, k, A, j) {
	let M = A.get(33), N = A.get(118), F = A.get(95), I = A.get(51), L = A.get(50), R = A.get(67), z = new StringBuilder(1e4);
	z.appendString("<div class=\"suggest-preview-text\">");
	for (let e = 0, A = k.length; e < A; e++) {
		let A = k[e], B = A.content;
		z.appendString("<div class=\"view-line"), z.appendString("\" style=\"top:"), z.appendString(String(e * R)), z.appendString("px;width:1000000px;\">");
		let V = isBasicASCII(B), H = containsRTL(B), U = LineTokens.createEmpty(B, j);
		renderViewLine(new RenderLineInput(L.isMonospace && !M, L.canUseHalfwidthRightwardsArrow, B, !1, V, H, 0, U, A.decorations, O, 0, L.spaceWidth, L.middotWidth, L.wsmiddotWidth, N, "none", F, I !== EditorFontLigatures.OFF, null), z), z.appendString("</div>");
	}
	z.appendString("</div>"), applyFontInfo(e, L);
	let B = z.build();
	e.innerHTML = ttPolicy ? ttPolicy.createHTML(B) : B;
}
const ttPolicy = createTrustedTypesPolicy("editorGhostText", { createHTML: (e) => e });
function fixBracketsInLine(e, O) {
	let k = new DenseKeyProvider(), A = new LanguageAgnosticBracketTokens(k, (e) => O.getLanguageConfiguration(e)), j = new TextBufferTokenizer(new StaticTokenizerSource([e]), A), M = parseDocument(j, [], void 0, !0), N = "", P = e.getLineContent();
	function F(e, O) {
		if (e.kind === 2) if (F(e.openingBracket, O), O = lengthAdd(O, e.openingBracket.length), e.child && (F(e.child, O), O = lengthAdd(O, e.child.length)), e.closingBracket) F(e.closingBracket, O), O = lengthAdd(O, e.closingBracket.length);
		else {
			let O = A.getSingleLanguageBracketTokens(e.openingBracket.languageId).findClosingTokenText(e.openingBracket.bracketIds);
			N += O;
		}
		else if (e.kind !== 3) {
			if (e.kind === 0 || e.kind === 1) N += P.substring(lengthGetColumnCountIfZeroLineCount(O), lengthGetColumnCountIfZeroLineCount(lengthAdd(O, e.length)));
			else if (e.kind === 4) for (let k of e.children) F(k, O), O = lengthAdd(O, k.length);
		}
	}
	return F(M, 0), N;
}
var StaticTokenizerSource = class {
	constructor(e) {
		this.lines = e, this.tokenization = { getLineTokens: (e) => this.lines[e - 1] };
	}
	getLineCount() {
		return this.lines.length;
	}
	getLineLength(e) {
		return this.lines[e - 1].getLineContent().length;
	}
};
async function provideInlineCompletions(e, O, k, A, j = CancellationToken.None, M) {
	let N = O instanceof Position ? getDefaultRange(O, k) : O, P = e.all(k), F = new SetMap();
	for (let e of P) e.groupId && F.add(e.groupId, e);
	function I(e) {
		if (!e.yieldsToGroupIds) return [];
		let O = [];
		for (let k of e.yieldsToGroupIds || []) {
			let e = F.get(k);
			for (let k of e) O.push(k);
		}
		return O;
	}
	let L = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new Set();
	function z(e, O) {
		if (O = [...O, e], R.has(e)) return O;
		R.add(e);
		try {
			let k = I(e);
			for (let e of k) {
				let k = z(e, O);
				if (k) return k;
			}
		} finally {
			R.delete(e);
		}
	}
	function B(e) {
		let M = L.get(e);
		if (M) return M;
		let N = z(e, []);
		N && onUnexpectedExternalError(/* @__PURE__ */ Error(`Inline completions: cyclic yield-to dependency detected. Path: ${N.map((e) => e.toString ? e.toString() : "" + e).join(" -> ")}`));
		let P = new DeferredPromise();
		return L.set(e, P.p), (async () => {
			if (!N) {
				let O = I(e);
				for (let e of O) {
					let O = await B(e);
					if (O && O.items.length > 0) return;
				}
			}
			try {
				return O instanceof Position ? await e.provideInlineCompletions(k, O, A, j) : await e.provideInlineEdits?.(k, O, A, j);
			} catch (e) {
				onUnexpectedExternalError(e);
				return;
			}
		})().then((e) => P.complete(e), (e) => P.error(e)), P.p;
	}
	let V = await Promise.all(P.map(async (e) => ({
		provider: e,
		completions: await B(e)
	}))), H = /* @__PURE__ */ new Map(), U = [];
	for (let e of V) {
		let O = e.completions;
		if (!O) continue;
		let A = new InlineCompletionList(O, e.provider);
		U.push(A);
		for (let e of O.items) {
			let O = InlineCompletionItem.from(e, A, N, k, M);
			H.set(O.hash(), O);
		}
	}
	return new InlineCompletionProviderResult(Array.from(H.values()), new Set(H.keys()), U);
}
var InlineCompletionProviderResult = class {
	constructor(e, O, k) {
		this.completions = e, this.hashs = O, this.providerResults = k;
	}
	has(e) {
		return this.hashs.has(e.hash());
	}
	dispose() {
		for (let e of this.providerResults) e.removeRef();
	}
}, InlineCompletionList = class {
	constructor(e, O) {
		this.inlineCompletions = e, this.provider = O, this.refCount = 1;
	}
	addRef() {
		this.refCount++;
	}
	removeRef() {
		this.refCount--, this.refCount === 0 && this.provider.freeInlineCompletions(this.inlineCompletions);
	}
}, InlineCompletionItem = class e {
	static from(O, k, A, j, M) {
		let N, P, F = O.range ? Range.lift(O.range) : A;
		if (typeof O.insertText == "string") {
			if (N = O.insertText, M && O.completeBracketPairs) {
				N = closeBrackets(N, F.getStartPosition(), j, M);
				let e = N.length - O.insertText.length;
				e !== 0 && (F = new Range(F.startLineNumber, F.startColumn, F.endLineNumber, F.endColumn + e));
			}
			P = void 0;
		} else if ("snippet" in O.insertText) {
			let e = O.insertText.snippet.length;
			if (M && O.completeBracketPairs) {
				O.insertText.snippet = closeBrackets(O.insertText.snippet, F.getStartPosition(), j, M);
				let k = O.insertText.snippet.length - e;
				k !== 0 && (F = new Range(F.startLineNumber, F.startColumn, F.endLineNumber, F.endColumn + k));
			}
			let k = new SnippetParser().parse(O.insertText.snippet);
			k.children.length === 1 && k.children[0] instanceof Text ? (N = k.children[0].value, P = void 0) : (N = k.toString(), P = {
				snippet: O.insertText.snippet,
				range: F
			});
		} else assertNever(O.insertText);
		return new e(N, O.command, F, N, P, O.additionalTextEdits || getReadonlyEmptyArray(), O, k);
	}
	constructor(e, O, k, A, j, M, N, P) {
		this.filterText = e, this.command = O, this.range = k, this.insertText = A, this.snippetInfo = j, this.additionalTextEdits = M, this.sourceInlineCompletion = N, this.source = P, e = e.replace(/\r\n|\r/g, "\n"), A = e.replace(/\r\n|\r/g, "\n");
	}
	withRange(O) {
		return new e(this.filterText, this.command, O, this.insertText, this.snippetInfo, this.additionalTextEdits, this.sourceInlineCompletion, this.source);
	}
	hash() {
		return JSON.stringify({
			insertText: this.insertText,
			range: this.range.toString()
		});
	}
	toSingleTextEdit() {
		return new SingleTextEdit(this.range, this.insertText);
	}
};
function getDefaultRange(e, O) {
	let k = O.getWordAtPosition(e), A = O.getLineMaxColumn(e.lineNumber);
	return k ? new Range(e.lineNumber, k.startColumn, e.lineNumber, A) : Range.fromPositions(e, e.with(void 0, A));
}
function closeBrackets(e, O, k, A) {
	let j = k.getLineContent(O.lineNumber).substring(0, O.column - 1) + e, M = k.tokenization.tokenizeLineWithEdit(O, j.length - (O.column - 1), e)?.sliceAndInflate(O.column - 1, j.length, 0);
	return M ? fixBracketsInLine(M, A) : e;
}
function singleTextRemoveCommonPrefix(e, O, k) {
	let A = k ? e.range.intersectRanges(k) : e.range;
	if (!A) return e;
	let j = O.getValueInRange(A, 1), M = commonPrefixLength(j, e.text), N = TextLength.ofText(j.substring(0, M)).addToPosition(e.range.getStartPosition()), P = e.text.substring(M), F = Range.fromPositions(N, e.range.getEndPosition());
	return new SingleTextEdit(F, P);
}
function singleTextEditAugments(e, O) {
	return e.text.startsWith(O.text) && rangeExtends(e.range, O.range);
}
function computeGhostText(e, O, k, A, j = 0) {
	let M = singleTextRemoveCommonPrefix(e, O);
	if (M.range.endLineNumber !== M.range.startLineNumber) return;
	let N = O.getLineContent(M.range.startLineNumber), P = getLeadingWhitespace(N).length;
	if (M.range.startColumn - 1 <= P) {
		let e = getLeadingWhitespace(M.text).length, O = N.substring(M.range.startColumn - 1, P), [k, A] = [M.range.getStartPosition(), M.range.getEndPosition()], j = k.column + O.length <= A.column ? k.delta(0, O.length) : A, F = Range.fromPositions(j, A), I = M.text.startsWith(O) ? M.text.substring(O.length) : M.text.substring(e);
		M = new SingleTextEdit(F, I);
	}
	let F = O.getValueInRange(M.range), I = cachingDiff(F, M.text);
	if (!I) return;
	let L = M.range.startLineNumber, R = [];
	if (k === "prefix") {
		let e = I.filter((e) => e.originalLength === 0);
		if (e.length > 1 || e.length === 1 && e[0].originalStart !== F.length) return;
	}
	let z = M.text.length - j;
	for (let e of I) {
		let O = M.range.startColumn + e.originalStart + e.originalLength;
		if (k === "subwordSmart" && A && A.lineNumber === M.range.startLineNumber && O < A.column || e.originalLength > 0) return;
		if (e.modifiedLength === 0) continue;
		let j = e.modifiedStart + e.modifiedLength, N = Math.max(e.modifiedStart, Math.min(j, z)), P = M.text.substring(e.modifiedStart, N), F = M.text.substring(N, Math.max(e.modifiedStart, j));
		P.length > 0 && R.push(new GhostTextPart(O, P, !1)), F.length > 0 && R.push(new GhostTextPart(O, F, !0));
	}
	return new GhostText(L, R);
}
function rangeExtends(e, O) {
	return O.getStartPosition().equals(e.getStartPosition()) && O.getEndPosition().isBeforeOrEqual(e.getEndPosition());
}
var lastRequest = void 0;
function cachingDiff(e, O) {
	if (lastRequest?.originalValue === e && lastRequest?.newValue === O) return lastRequest?.changes;
	{
		let k = smartDiff(e, O, !0);
		if (k) {
			let A = deletedCharacters(k);
			if (A > 0) {
				let j = smartDiff(e, O, !1);
				j && deletedCharacters(j) < A && (k = j);
			}
		}
		return lastRequest = {
			originalValue: e,
			newValue: O,
			changes: k
		}, k;
	}
}
function deletedCharacters(e) {
	let O = 0;
	for (let k of e) O += k.originalLength;
	return O;
}
function smartDiff(e, O, k) {
	if (e.length > 5e3 || O.length > 5e3) return;
	function A(e) {
		let O = 0;
		for (let k = 0, A = e.length; k < A; k++) {
			let A = e.charCodeAt(k);
			A > O && (O = A);
		}
		return O;
	}
	let j = Math.max(A(e), A(O));
	function M(e) {
		if (e < 0) throw Error("unexpected");
		return j + e + 1;
	}
	function N(e) {
		let O = 0, A = 0, j = new Int32Array(e.length);
		for (let N = 0, P = e.length; N < P; N++) if (k && e[N] === "(") {
			let e = A * 100 + O;
			j[N] = M(2 * e), O++;
		} else if (k && e[N] === ")") {
			O = Math.max(O - 1, 0);
			let e = A * 100 + O;
			j[N] = M(2 * e + 1), O === 0 && A++;
		} else j[N] = e.charCodeAt(N);
		return j;
	}
	let P = N(e), F = N(O);
	return new LcsDiff({ getElements: () => P }, { getElements: () => F }).ComputeDiff(!1).changes;
}
var __decorate$63 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$63 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, InlineCompletionsSource = class extends Disposable {
	constructor(e, O, k, A, j) {
		super(), this.textModel = e, this.versionId = O, this._debounceValue = k, this.languageFeaturesService = A, this.languageConfigurationService = j, this._updateOperation = this._register(new MutableDisposable()), this.inlineCompletions = disposableObservableValue("inlineCompletions", void 0), this.suggestWidgetInlineCompletions = disposableObservableValue("suggestWidgetInlineCompletions", void 0), this._register(this.textModel.onDidChangeContent(() => {
			this._updateOperation.clear();
		}));
	}
	fetch(e, O, k) {
		let A = new UpdateRequest(e, O, this.textModel.getVersionId()), j = O.selectedSuggestionInfo ? this.suggestWidgetInlineCompletions : this.inlineCompletions;
		if (this._updateOperation.value?.request.satisfies(A)) return this._updateOperation.value.promise;
		if (j.get()?.request.satisfies(A)) return Promise.resolve(!0);
		let M = !!this._updateOperation.value;
		this._updateOperation.clear();
		let N = new CancellationTokenSource(), P = (async () => {
			if ((M || O.triggerKind === InlineCompletionTriggerKind.Automatic) && await wait$1(this._debounceValue.get(this.textModel), N.token), N.token.isCancellationRequested || this._store.isDisposed || this.textModel.getVersionId() !== A.versionId) return !1;
			let P = /* @__PURE__ */ new Date(), F = await provideInlineCompletions(this.languageFeaturesService.inlineCompletionsProvider, e, this.textModel, O, N.token, this.languageConfigurationService);
			if (N.token.isCancellationRequested || this._store.isDisposed || this.textModel.getVersionId() !== A.versionId) return !1;
			let I = /* @__PURE__ */ new Date();
			this._debounceValue.update(this.textModel, I.getTime() - P.getTime());
			let L = new UpToDateInlineCompletions(F, A, this.textModel, this.versionId);
			if (k) {
				let O = k.toInlineCompletion(void 0);
				k.canBeReused(this.textModel, e) && !F.has(O) && L.prepend(k.inlineCompletion, O.range, !0);
			}
			return this._updateOperation.clear(), transaction((e) => {
				j.set(L, e);
			}), !0;
		})(), F = new UpdateOperation(A, N, P);
		return this._updateOperation.value = F, P;
	}
	clear(e) {
		this._updateOperation.clear(), this.inlineCompletions.set(void 0, e), this.suggestWidgetInlineCompletions.set(void 0, e);
	}
	clearSuggestWidgetInlineCompletions(e) {
		this._updateOperation.value?.request.context.selectedSuggestionInfo && this._updateOperation.clear(), this.suggestWidgetInlineCompletions.set(void 0, e);
	}
	cancelUpdate() {
		this._updateOperation.clear();
	}
};
InlineCompletionsSource = __decorate$63([__param$63(3, ILanguageFeaturesService), __param$63(4, ILanguageConfigurationService)], InlineCompletionsSource);
function wait$1(e, O) {
	return new Promise((k) => {
		let A, j = setTimeout(() => {
			A && A.dispose(), k();
		}, e);
		O && (A = O.onCancellationRequested(() => {
			clearTimeout(j), A && A.dispose(), k();
		}));
	});
}
var UpdateRequest = class {
	constructor(e, O, k) {
		this.position = e, this.context = O, this.versionId = k;
	}
	satisfies(e) {
		return this.position.equals(e.position) && equalsIfDefined(this.context.selectedSuggestionInfo, e.context.selectedSuggestionInfo, itemEquals()) && (e.context.triggerKind === InlineCompletionTriggerKind.Automatic || this.context.triggerKind === InlineCompletionTriggerKind.Explicit) && this.versionId === e.versionId;
	}
}, UpdateOperation = class {
	constructor(e, O, k) {
		this.request = e, this.cancellationTokenSource = O, this.promise = k;
	}
	dispose() {
		this.cancellationTokenSource.cancel();
	}
}, UpToDateInlineCompletions = class {
	get inlineCompletions() {
		return this._inlineCompletions;
	}
	constructor(e, O, k, A) {
		this.inlineCompletionProviderResult = e, this.request = O, this._textModel = k, this._versionId = A, this._refCount = 1, this._prependedInlineCompletionItems = [];
		let j = k.deltaDecorations([], e.completions.map((e) => ({
			range: e.range,
			options: { description: "inline-completion-tracking-range" }
		})));
		this._inlineCompletions = e.completions.map((e, O) => new InlineCompletionWithUpdatedRange(e, j[O], this._textModel, this._versionId));
	}
	clone() {
		return this._refCount++, this;
	}
	dispose() {
		if (this._refCount--, this._refCount === 0) {
			setTimeout(() => {
				this._textModel.isDisposed() || this._textModel.deltaDecorations(this._inlineCompletions.map((e) => e.decorationId), []);
			}, 0), this.inlineCompletionProviderResult.dispose();
			for (let e of this._prependedInlineCompletionItems) e.source.removeRef();
		}
	}
	prepend(e, O, k) {
		k && e.source.addRef();
		let A = this._textModel.deltaDecorations([], [{
			range: O,
			options: { description: "inline-completion-tracking-range" }
		}])[0];
		this._inlineCompletions.unshift(new InlineCompletionWithUpdatedRange(e, A, this._textModel, this._versionId)), this._prependedInlineCompletionItems.push(e);
	}
}, InlineCompletionWithUpdatedRange = class {
	get forwardStable() {
		return this.inlineCompletion.source.inlineCompletions.enableForwardStability ?? !1;
	}
	constructor(e, O, k, A) {
		this.inlineCompletion = e, this.decorationId = O, this._textModel = k, this._modelVersion = A, this.semanticId = JSON.stringify([
			this.inlineCompletion.filterText,
			this.inlineCompletion.insertText,
			this.inlineCompletion.range.getStartPosition().toString()
		]), this._updatedRange = derivedOpts({
			owner: this,
			equalsFn: Range.equalsRange
		}, (e) => (this._modelVersion.read(e), this._textModel.getDecorationRange(this.decorationId)));
	}
	toInlineCompletion(e) {
		return this.inlineCompletion.withRange(this._updatedRange.read(e) ?? emptyRange);
	}
	toSingleTextEdit(e) {
		return new SingleTextEdit(this._updatedRange.read(e) ?? emptyRange, this.inlineCompletion.insertText);
	}
	isVisible(e, O, k) {
		let A = singleTextRemoveCommonPrefix(this._toFilterTextReplacement(k), e), j = this._updatedRange.read(k);
		if (!j || !this.inlineCompletion.range.getStartPosition().equals(j.getStartPosition()) || O.lineNumber !== A.range.startLineNumber) return !1;
		let M = e.getValueInRange(A.range, 1), N = A.text, P = Math.max(0, O.column - A.range.startColumn), F = N.substring(0, P), I = N.substring(P), L = M.substring(0, P), R = M.substring(P), z = e.getLineIndentColumn(A.range.startLineNumber);
		return A.range.startColumn <= z && (L = L.trimStart(), L.length === 0 && (R = R.trimStart()), F = F.trimStart(), F.length === 0 && (I = I.trimStart())), F.startsWith(L) && !!matchesSubString(R, I);
	}
	canBeReused(e, O) {
		let k = this._updatedRange.read(void 0);
		return !!k && k.containsPosition(O) && this.isVisible(e, O, void 0) && TextLength.ofRange(k).isGreaterThanOrEqualTo(TextLength.ofRange(this.inlineCompletion.range));
	}
	_toFilterTextReplacement(e) {
		return new SingleTextEdit(this._updatedRange.read(e) ?? emptyRange, this.inlineCompletion.filterText);
	}
}, emptyRange = new Range(1, 1, 1, 1);
const Context$1 = {
	Visible: historyNavigationVisible,
	HasFocusedSuggestion: new RawContextKey("suggestWidgetHasFocusedSuggestion", !1, localize("suggestWidgetHasSelection", "Whether any suggestion is focused")),
	DetailsVisible: new RawContextKey("suggestWidgetDetailsVisible", !1, localize("suggestWidgetDetailsVisible", "Whether suggestion details are visible")),
	MultipleSuggestions: new RawContextKey("suggestWidgetMultipleSuggestions", !1, localize("suggestWidgetMultipleSuggestions", "Whether there are multiple suggestions to pick from")),
	MakesTextEdit: new RawContextKey("suggestionMakesTextEdit", !0, localize("suggestionMakesTextEdit", "Whether inserting the current suggestion yields in a change or has everything already been typed")),
	AcceptSuggestionsOnEnter: new RawContextKey("acceptSuggestionOnEnter", !0, localize("acceptSuggestionOnEnter", "Whether suggestions are inserted when pressing Enter")),
	HasInsertAndReplaceRange: new RawContextKey("suggestionHasInsertAndReplaceRange", !1, localize("suggestionHasInsertAndReplaceRange", "Whether the current suggestion has insert and replace behaviour")),
	InsertMode: new RawContextKey("suggestionInsertMode", void 0, {
		type: "string",
		description: localize("suggestionInsertMode", "Whether the default behaviour is to insert or replace")
	}),
	CanResolve: new RawContextKey("suggestionCanResolve", !1, localize("suggestionCanResolve", "Whether the current suggestion supports to resolve further details"))
}, suggestWidgetStatusbarMenu = new MenuId("suggestWidgetStatusBar");
var CompletionItem = class {
	constructor(e, O, k, A) {
		this.position = e, this.completion = O, this.container = k, this.provider = A, this.isInvalid = !1, this.score = FuzzyScore.Default, this.distance = 0, this.textLabel = typeof O.label == "string" ? O.label : O.label?.label, this.labelLow = this.textLabel.toLowerCase(), this.isInvalid = !this.textLabel, this.sortTextLow = O.sortText && O.sortText.toLowerCase(), this.filterTextLow = O.filterText && O.filterText.toLowerCase(), this.extensionId = O.extensionId, Range.isIRange(O.range) ? (this.editStart = new Position(O.range.startLineNumber, O.range.startColumn), this.editInsertEnd = new Position(O.range.endLineNumber, O.range.endColumn), this.editReplaceEnd = new Position(O.range.endLineNumber, O.range.endColumn), this.isInvalid = this.isInvalid || Range.spansMultipleLines(O.range) || O.range.startLineNumber !== e.lineNumber) : (this.editStart = new Position(O.range.insert.startLineNumber, O.range.insert.startColumn), this.editInsertEnd = new Position(O.range.insert.endLineNumber, O.range.insert.endColumn), this.editReplaceEnd = new Position(O.range.replace.endLineNumber, O.range.replace.endColumn), this.isInvalid = this.isInvalid || Range.spansMultipleLines(O.range.insert) || Range.spansMultipleLines(O.range.replace) || O.range.insert.startLineNumber !== e.lineNumber || O.range.replace.startLineNumber !== e.lineNumber || O.range.insert.startColumn !== O.range.replace.startColumn), typeof A.resolveCompletionItem != "function" && (this._resolveCache = Promise.resolve(), this._resolveDuration = 0);
	}
	get isResolved() {
		return this._resolveDuration !== void 0;
	}
	get resolveDuration() {
		return this._resolveDuration === void 0 ? -1 : this._resolveDuration;
	}
	async resolve(e) {
		if (!this._resolveCache) {
			let O = e.onCancellationRequested(() => {
				this._resolveCache = void 0, this._resolveDuration = void 0;
			}), k = new StopWatch(!0);
			this._resolveCache = Promise.resolve(this.provider.resolveCompletionItem(this.completion, e)).then((e) => {
				Object.assign(this.completion, e), this._resolveDuration = k.elapsed();
			}, (e) => {
				isCancellationError(e) && (this._resolveCache = void 0, this._resolveDuration = void 0);
			}).finally(() => {
				O.dispose();
			});
		}
		return this._resolveCache;
	}
}, CompletionOptions = class e {
	static {
		this.default = new e();
	}
	constructor(e = 2, O = /* @__PURE__ */ new Set(), k = /* @__PURE__ */ new Set(), A = /* @__PURE__ */ new Map(), j = !0) {
		this.snippetSortOrder = e, this.kindFilter = O, this.providerFilter = k, this.providerItemsToReuse = A, this.showDeprecated = j;
	}
}, _snippetSuggestSupport;
function getSnippetSuggestSupport() {
	return _snippetSuggestSupport;
}
var CompletionItemModel = class {
	constructor(e, O, k, A) {
		this.items = e, this.needsClipboard = O, this.durations = k, this.disposable = A;
	}
};
async function provideSuggestionItems(e, O, k, A = CompletionOptions.default, j = { triggerKind: 0 }, M = CancellationToken.None) {
	let N = new StopWatch();
	k = k.clone();
	let P = O.getWordAtPosition(k), F = P ? new Range(k.lineNumber, P.startColumn, k.lineNumber, P.endColumn) : Range.fromPositions(k), I = {
		replace: F,
		insert: F.setEndPosition(k.lineNumber, k.column)
	}, L = [], R = new DisposableStore(), z = [], B = !1, V = (e, O, j) => {
		let M = !1;
		if (!O) return M;
		for (let j of O.suggestions) if (!A.kindFilter.has(j.kind)) {
			if (!A.showDeprecated && j?.tags?.includes(1)) continue;
			j.range ||= I, j.sortText ||= typeof j.label == "string" ? j.label : j.label.label, !B && j.insertTextRules && j.insertTextRules & 4 && (B = SnippetParser.guessNeedsClipboard(j.insertText)), L.push(new CompletionItem(k, j, O, e)), M = !0;
		}
		return isDisposable(O) && R.add(O), z.push({
			providerName: e._debugDisplayName ?? "unknown_provider",
			elapsedProvider: O.duration ?? -1,
			elapsedOverall: j.elapsed()
		}), M;
	}, H = (async () => {})();
	for (let N of e.orderedGroups(O)) {
		let e = !1;
		if (await Promise.all(N.map(async (N) => {
			if (A.providerItemsToReuse.has(N)) {
				let O = A.providerItemsToReuse.get(N);
				O.forEach((e) => L.push(e)), e ||= O.length > 0;
				return;
			}
			if (!(A.providerFilter.size > 0 && !A.providerFilter.has(N))) try {
				let A = new StopWatch(), P = await N.provideCompletionItems(O, k, j, M);
				e = V(N, P, A) || e;
			} catch (e) {
				onUnexpectedExternalError(e);
			}
		})), e || M.isCancellationRequested) break;
	}
	return await H, M.isCancellationRequested ? (R.dispose(), Promise.reject(new CancellationError())) : new CompletionItemModel(L.sort(getSuggestionComparator(A.snippetSortOrder)), B, {
		entries: z,
		elapsed: N.elapsed()
	}, R);
}
function defaultComparator(e, O) {
	if (e.sortTextLow && O.sortTextLow) {
		if (e.sortTextLow < O.sortTextLow) return -1;
		if (e.sortTextLow > O.sortTextLow) return 1;
	}
	return e.textLabel < O.textLabel ? -1 : e.textLabel > O.textLabel ? 1 : e.completion.kind - O.completion.kind;
}
function snippetUpComparator(e, O) {
	if (e.completion.kind !== O.completion.kind) {
		if (e.completion.kind === 27) return -1;
		if (O.completion.kind === 27) return 1;
	}
	return defaultComparator(e, O);
}
function snippetDownComparator(e, O) {
	if (e.completion.kind !== O.completion.kind) {
		if (e.completion.kind === 27) return 1;
		if (O.completion.kind === 27) return -1;
	}
	return defaultComparator(e, O);
}
var _snippetComparators = /* @__PURE__ */ new Map();
_snippetComparators.set(0, snippetUpComparator), _snippetComparators.set(2, snippetDownComparator), _snippetComparators.set(1, defaultComparator);
function getSuggestionComparator(e) {
	return _snippetComparators.get(e);
}
CommandsRegistry.registerCommand("_executeCompletionItemProvider", async (e, ...O) => {
	let [k, A, j, M] = O;
	assertType(URI.isUri(k)), assertType(Position.isIPosition(A)), assertType(typeof j == "string" || !j), assertType(typeof M == "number" || !M);
	let { completionProvider: N } = e.get(ILanguageFeaturesService), P = await e.get(ITextModelService).createModelReference(k);
	try {
		let e = {
			incomplete: !1,
			suggestions: []
		}, O = [], k = P.object.textEditorModel.validatePosition(A), F = await provideSuggestionItems(N, P.object.textEditorModel, k, void 0, {
			triggerCharacter: j ?? void 0,
			triggerKind: j ? 1 : 0
		});
		for (let k of F.items) O.length < (M ?? 0) && O.push(k.resolve(CancellationToken.None)), e.incomplete = e.incomplete || k.container.incomplete, e.suggestions.push(k.completion);
		try {
			return await Promise.all(O), e;
		} finally {
			setTimeout(() => F.disposable.dispose(), 100);
		}
	} finally {
		P.dispose();
	}
});
function showSimpleSuggestions(e, O) {
	e.getContribution("editor.contrib.suggestController")?.triggerSuggest((/* @__PURE__ */ new Set()).add(O), void 0, !0);
}
var QuickSuggestionsOptions = class {
	static isAllOff(e) {
		return e.other === "off" && e.comments === "off" && e.strings === "off";
	}
	static isAllOn(e) {
		return e.other === "on" && e.comments === "on" && e.strings === "on";
	}
	static valueFor(e, O) {
		switch (O) {
			case 1: return e.comments;
			case 2: return e.strings;
			default: return e.other;
		}
	}
};
function normalizeDriveLetter(e, O = isWindows) {
	return hasDriveLetter(e, O) ? e.charAt(0).toUpperCase() + e.slice(1) : e;
}
var __decorate$62 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$62 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
};
Object.freeze({
	CURRENT_YEAR: !0,
	CURRENT_YEAR_SHORT: !0,
	CURRENT_MONTH: !0,
	CURRENT_DATE: !0,
	CURRENT_HOUR: !0,
	CURRENT_MINUTE: !0,
	CURRENT_SECOND: !0,
	CURRENT_DAY_NAME: !0,
	CURRENT_DAY_NAME_SHORT: !0,
	CURRENT_MONTH_NAME: !0,
	CURRENT_MONTH_NAME_SHORT: !0,
	CURRENT_SECONDS_UNIX: !0,
	CURRENT_TIMEZONE_OFFSET: !0,
	SELECTION: !0,
	CLIPBOARD: !0,
	TM_SELECTED_TEXT: !0,
	TM_CURRENT_LINE: !0,
	TM_CURRENT_WORD: !0,
	TM_LINE_INDEX: !0,
	TM_LINE_NUMBER: !0,
	TM_FILENAME: !0,
	TM_FILENAME_BASE: !0,
	TM_DIRECTORY: !0,
	TM_FILEPATH: !0,
	CURSOR_INDEX: !0,
	CURSOR_NUMBER: !0,
	RELATIVE_FILEPATH: !0,
	BLOCK_COMMENT_START: !0,
	BLOCK_COMMENT_END: !0,
	LINE_COMMENT: !0,
	WORKSPACE_NAME: !0,
	WORKSPACE_FOLDER: !0,
	RANDOM: !0,
	RANDOM_HEX: !0,
	UUID: !0
});
var CompositeSnippetVariableResolver = class {
	constructor(e) {
		this._delegates = e;
	}
	resolve(e) {
		for (let O of this._delegates) {
			let k = O.resolve(e);
			if (k !== void 0) return k;
		}
	}
}, SelectionBasedVariableResolver = class {
	constructor(e, O, k, A) {
		this._model = e, this._selection = O, this._selectionIdx = k, this._overtypingCapturer = A;
	}
	resolve(e) {
		let { name: O } = e;
		if (O === "SELECTION" || O === "TM_SELECTED_TEXT") {
			let O = this._model.getValueInRange(this._selection) || void 0, k = this._selection.startLineNumber !== this._selection.endLineNumber;
			if (!O && this._overtypingCapturer) {
				let e = this._overtypingCapturer.getLastOvertypedInfo(this._selectionIdx);
				e && (O = e.value, k = e.multiline);
			}
			if (O && k && e.snippet) {
				let k = this._model.getLineContent(this._selection.startLineNumber), A = getLeadingWhitespace(k, 0, this._selection.startColumn - 1), j = A;
				e.snippet.walk((O) => O === e ? !1 : (O instanceof Text && (j = getLeadingWhitespace(splitLines(O.value).pop())), !0));
				let M = commonPrefixLength(j, A);
				O = O.replace(/(\r\n|\r|\n)(.*)/g, (e, O, k) => `${O}${j.substr(M)}${k}`);
			}
			return O;
		} else if (O === "TM_CURRENT_LINE") return this._model.getLineContent(this._selection.positionLineNumber);
		else if (O === "TM_CURRENT_WORD") {
			let e = this._model.getWordAtPosition({
				lineNumber: this._selection.positionLineNumber,
				column: this._selection.positionColumn
			});
			return e && e.word || void 0;
		} else if (O === "TM_LINE_INDEX") return String(this._selection.positionLineNumber - 1);
		else if (O === "TM_LINE_NUMBER") return String(this._selection.positionLineNumber);
		else if (O === "CURSOR_INDEX") return String(this._selectionIdx);
		else if (O === "CURSOR_NUMBER") return String(this._selectionIdx + 1);
	}
}, ModelBasedVariableResolver = class {
	constructor(e, O) {
		this._labelService = e, this._model = O;
	}
	resolve(e) {
		let { name: O } = e;
		if (O === "TM_FILENAME") return basename$1(this._model.uri.fsPath);
		if (O === "TM_FILENAME_BASE") {
			let e = basename$1(this._model.uri.fsPath), O = e.lastIndexOf(".");
			return O <= 0 ? e : e.slice(0, O);
		} else if (O === "TM_DIRECTORY") return dirname$1(this._model.uri.fsPath) === "." ? "" : this._labelService.getUriLabel(dirname(this._model.uri));
		else if (O === "TM_FILEPATH") return this._labelService.getUriLabel(this._model.uri);
		else if (O === "RELATIVE_FILEPATH") return this._labelService.getUriLabel(this._model.uri, {
			relative: !0,
			noPrefix: !0
		});
	}
}, ClipboardBasedVariableResolver = class {
	constructor(e, O, k, A) {
		this._readClipboardText = e, this._selectionIdx = O, this._selectionCount = k, this._spread = A;
	}
	resolve(e) {
		if (e.name !== "CLIPBOARD") return;
		let O = this._readClipboardText();
		if (O) {
			if (this._spread) {
				let e = O.split(/\r\n|\n|\r/).filter((e) => !isFalsyOrWhitespace(e));
				if (e.length === this._selectionCount) return e[this._selectionIdx];
			}
			return O;
		}
	}
}, CommentBasedVariableResolver = class {
	constructor(e, O, k) {
		this._model = e, this._selection = O, this._languageConfigurationService = k;
	}
	resolve(e) {
		let { name: O } = e, k = this._model.getLanguageIdAtPosition(this._selection.selectionStartLineNumber, this._selection.selectionStartColumn), A = this._languageConfigurationService.getLanguageConfiguration(k).comments;
		if (A) {
			if (O === "LINE_COMMENT") return A.lineCommentToken || void 0;
			if (O === "BLOCK_COMMENT_START") return A.blockCommentStartToken || void 0;
			if (O === "BLOCK_COMMENT_END") return A.blockCommentEndToken || void 0;
		}
	}
};
CommentBasedVariableResolver = __decorate$62([__param$62(2, ILanguageConfigurationService)], CommentBasedVariableResolver);
var TimeBasedVariableResolver = class e {
	constructor() {
		this._date = /* @__PURE__ */ new Date();
	}
	static {
		this.dayNames = [
			localize("Sunday", "Sunday"),
			localize("Monday", "Monday"),
			localize("Tuesday", "Tuesday"),
			localize("Wednesday", "Wednesday"),
			localize("Thursday", "Thursday"),
			localize("Friday", "Friday"),
			localize("Saturday", "Saturday")
		];
	}
	static {
		this.dayNamesShort = [
			localize("SundayShort", "Sun"),
			localize("MondayShort", "Mon"),
			localize("TuesdayShort", "Tue"),
			localize("WednesdayShort", "Wed"),
			localize("ThursdayShort", "Thu"),
			localize("FridayShort", "Fri"),
			localize("SaturdayShort", "Sat")
		];
	}
	static {
		this.monthNames = [
			localize("January", "January"),
			localize("February", "February"),
			localize("March", "March"),
			localize("April", "April"),
			localize("May", "May"),
			localize("June", "June"),
			localize("July", "July"),
			localize("August", "August"),
			localize("September", "September"),
			localize("October", "October"),
			localize("November", "November"),
			localize("December", "December")
		];
	}
	static {
		this.monthNamesShort = [
			localize("JanuaryShort", "Jan"),
			localize("FebruaryShort", "Feb"),
			localize("MarchShort", "Mar"),
			localize("AprilShort", "Apr"),
			localize("MayShort", "May"),
			localize("JuneShort", "Jun"),
			localize("JulyShort", "Jul"),
			localize("AugustShort", "Aug"),
			localize("SeptemberShort", "Sep"),
			localize("OctoberShort", "Oct"),
			localize("NovemberShort", "Nov"),
			localize("DecemberShort", "Dec")
		];
	}
	resolve(O) {
		let { name: k } = O;
		if (k === "CURRENT_YEAR") return String(this._date.getFullYear());
		if (k === "CURRENT_YEAR_SHORT") return String(this._date.getFullYear()).slice(-2);
		if (k === "CURRENT_MONTH") return String(this._date.getMonth().valueOf() + 1).padStart(2, "0");
		if (k === "CURRENT_DATE") return String(this._date.getDate().valueOf()).padStart(2, "0");
		if (k === "CURRENT_HOUR") return String(this._date.getHours().valueOf()).padStart(2, "0");
		if (k === "CURRENT_MINUTE") return String(this._date.getMinutes().valueOf()).padStart(2, "0");
		if (k === "CURRENT_SECOND") return String(this._date.getSeconds().valueOf()).padStart(2, "0");
		if (k === "CURRENT_DAY_NAME") return e.dayNames[this._date.getDay()];
		if (k === "CURRENT_DAY_NAME_SHORT") return e.dayNamesShort[this._date.getDay()];
		if (k === "CURRENT_MONTH_NAME") return e.monthNames[this._date.getMonth()];
		if (k === "CURRENT_MONTH_NAME_SHORT") return e.monthNamesShort[this._date.getMonth()];
		if (k === "CURRENT_SECONDS_UNIX") return String(Math.floor(this._date.getTime() / 1e3));
		if (k === "CURRENT_TIMEZONE_OFFSET") {
			let e = this._date.getTimezoneOffset(), O = e > 0 ? "-" : "+", k = Math.trunc(Math.abs(e / 60)), A = k < 10 ? "0" + k : k, j = Math.abs(e) - k * 60, M = j < 10 ? "0" + j : j;
			return O + A + ":" + M;
		}
	}
}, WorkspaceBasedVariableResolver = class {
	constructor(e) {
		this._workspaceService = e;
	}
	resolve(e) {
		if (!this._workspaceService) return;
		let O = toWorkspaceIdentifier(this._workspaceService.getWorkspace());
		if (!isEmptyWorkspaceIdentifier(O)) {
			if (e.name === "WORKSPACE_NAME") return this._resolveWorkspaceName(O);
			if (e.name === "WORKSPACE_FOLDER") return this._resoveWorkspacePath(O);
		}
	}
	_resolveWorkspaceName(e) {
		if (isSingleFolderWorkspaceIdentifier(e)) return basename$1(e.uri.path);
		let O = basename$1(e.configPath.path);
		return O.endsWith("code-workspace") && (O = O.substr(0, O.length - WORKSPACE_EXTENSION.length - 1)), O;
	}
	_resoveWorkspacePath(e) {
		if (isSingleFolderWorkspaceIdentifier(e)) return normalizeDriveLetter(e.uri.fsPath);
		let O = basename$1(e.configPath.path), k = e.configPath.fsPath;
		return k.endsWith(O) && (k = k.substr(0, k.length - O.length - 1)), k ? normalizeDriveLetter(k) : "/";
	}
}, RandomBasedVariableResolver = class {
	resolve(e) {
		let { name: O } = e;
		if (O === "RANDOM") return Math.random().toString().slice(-6);
		if (O === "RANDOM_HEX") return Math.random().toString(16).slice(-6);
		if (O === "UUID") return generateUuid();
	}
}, __decorate$61 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$61 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, SnippetSession_1, OneSnippet = class e {
	static {
		this._decor = {
			active: ModelDecorationOptions.register({
				description: "snippet-placeholder-1",
				stickiness: 0,
				className: "snippet-placeholder"
			}),
			inactive: ModelDecorationOptions.register({
				description: "snippet-placeholder-2",
				stickiness: 1,
				className: "snippet-placeholder"
			}),
			activeFinal: ModelDecorationOptions.register({
				description: "snippet-placeholder-3",
				stickiness: 1,
				className: "finish-snippet-placeholder"
			}),
			inactiveFinal: ModelDecorationOptions.register({
				description: "snippet-placeholder-4",
				stickiness: 1,
				className: "finish-snippet-placeholder"
			})
		};
	}
	constructor(e, O, k) {
		this._editor = e, this._snippet = O, this._snippetLineLeadingWhitespace = k, this._offset = -1, this._nestingLevel = 1, this._placeholderGroups = groupBy(O.placeholders, Placeholder.compareByIndex), this._placeholderGroupsIdx = -1;
	}
	initialize(e) {
		this._offset = e.newPosition;
	}
	dispose() {
		this._placeholderDecorations && this._editor.removeDecorations([...this._placeholderDecorations.values()]), this._placeholderGroups.length = 0;
	}
	_initDecorations() {
		if (this._offset === -1) throw Error("Snippet not initialized!");
		if (this._placeholderDecorations) return;
		this._placeholderDecorations = /* @__PURE__ */ new Map();
		let O = this._editor.getModel();
		this._editor.changeDecorations((k) => {
			for (let A of this._snippet.placeholders) {
				let j = this._snippet.offset(A), M = this._snippet.fullLen(A), N = Range.fromPositions(O.getPositionAt(this._offset + j), O.getPositionAt(this._offset + j + M)), P = A.isFinalTabstop ? e._decor.inactiveFinal : e._decor.inactive, F = k.addDecoration(N, P);
				this._placeholderDecorations.set(A, F);
			}
		});
	}
	move(O) {
		if (!this._editor.hasModel()) return [];
		if (this._initDecorations(), this._placeholderGroupsIdx >= 0) {
			let e = [];
			for (let O of this._placeholderGroups[this._placeholderGroupsIdx]) if (O.transform) {
				let k = this._placeholderDecorations.get(O), A = this._editor.getModel().getDecorationRange(k), j = this._editor.getModel().getValueInRange(A), M = O.transform.resolve(j).split(/\r\n|\r|\n/);
				for (let e = 1; e < M.length; e++) M[e] = this._editor.getModel().normalizeIndentation(this._snippetLineLeadingWhitespace + M[e]);
				e.push(EditOperation.replace(A, M.join(this._editor.getModel().getEOL())));
			}
			e.length > 0 && this._editor.executeEdits("snippet.placeholderTransform", e);
		}
		let k = !1;
		O === !0 && this._placeholderGroupsIdx < this._placeholderGroups.length - 1 ? (this._placeholderGroupsIdx += 1, k = !0) : O === !1 && this._placeholderGroupsIdx > 0 && (--this._placeholderGroupsIdx, k = !0);
		let A = this._editor.getModel().changeDecorations((O) => {
			let A = /* @__PURE__ */ new Set(), j = [];
			for (let M of this._placeholderGroups[this._placeholderGroupsIdx]) {
				let N = this._placeholderDecorations.get(M), P = this._editor.getModel().getDecorationRange(N);
				j.push(new Selection(P.startLineNumber, P.startColumn, P.endLineNumber, P.endColumn)), k &&= this._hasPlaceholderBeenCollapsed(M), O.changeDecorationOptions(N, M.isFinalTabstop ? e._decor.activeFinal : e._decor.active), A.add(M);
				for (let k of this._snippet.enclosingPlaceholders(M)) {
					let j = this._placeholderDecorations.get(k);
					O.changeDecorationOptions(j, k.isFinalTabstop ? e._decor.activeFinal : e._decor.active), A.add(k);
				}
			}
			for (let [k, j] of this._placeholderDecorations) A.has(k) || O.changeDecorationOptions(j, k.isFinalTabstop ? e._decor.inactiveFinal : e._decor.inactive);
			return j;
		});
		return k ? this.move(O) : A ?? [];
	}
	_hasPlaceholderBeenCollapsed(e) {
		let O = e;
		for (; O;) {
			if (O instanceof Placeholder) {
				let e = this._placeholderDecorations.get(O);
				if (this._editor.getModel().getDecorationRange(e).isEmpty() && O.toString().length > 0) return !0;
			}
			O = O.parent;
		}
		return !1;
	}
	get isAtFirstPlaceholder() {
		return this._placeholderGroupsIdx <= 0 || this._placeholderGroups.length === 0;
	}
	get isAtLastPlaceholder() {
		return this._placeholderGroupsIdx === this._placeholderGroups.length - 1;
	}
	get hasPlaceholder() {
		return this._snippet.placeholders.length > 0;
	}
	get isTrivialSnippet() {
		if (this._snippet.placeholders.length === 0) return !0;
		if (this._snippet.placeholders.length === 1) {
			let [e] = this._snippet.placeholders;
			if (e.isFinalTabstop && this._snippet.rightMostDescendant === e) return !0;
		}
		return !1;
	}
	computePossibleSelections() {
		let e = /* @__PURE__ */ new Map();
		for (let O of this._placeholderGroups) {
			let k;
			for (let A of O) {
				if (A.isFinalTabstop) break;
				k || (k = [], e.set(A.index, k));
				let O = this._placeholderDecorations.get(A), j = this._editor.getModel().getDecorationRange(O);
				if (!j) {
					e.delete(A.index);
					break;
				}
				k.push(j);
			}
		}
		return e;
	}
	get activeChoice() {
		if (!this._placeholderDecorations) return;
		let e = this._placeholderGroups[this._placeholderGroupsIdx][0];
		if (!e?.choice) return;
		let O = this._placeholderDecorations.get(e);
		if (!O) return;
		let k = this._editor.getModel().getDecorationRange(O);
		if (k) return {
			range: k,
			choice: e.choice
		};
	}
	get hasChoice() {
		let e = !1;
		return this._snippet.walk((O) => (e = O instanceof Choice, !e)), e;
	}
	merge(O) {
		let k = this._editor.getModel();
		this._nestingLevel *= 10, this._editor.changeDecorations((A) => {
			for (let j of this._placeholderGroups[this._placeholderGroupsIdx]) {
				let M = O.shift();
				console.assert(M._offset !== -1), console.assert(!M._placeholderDecorations);
				let N = M._snippet.placeholderInfo.last.index;
				for (let e of M._snippet.placeholderInfo.all) e.isFinalTabstop ? e.index = j.index + (N + 1) / this._nestingLevel : e.index = j.index + e.index / this._nestingLevel;
				this._snippet.replace(j, M._snippet.children);
				let P = this._placeholderDecorations.get(j);
				A.removeDecoration(P), this._placeholderDecorations.delete(j);
				for (let O of M._snippet.placeholders) {
					let j = M._snippet.offset(O), N = M._snippet.fullLen(O), P = Range.fromPositions(k.getPositionAt(M._offset + j), k.getPositionAt(M._offset + j + N)), F = A.addDecoration(P, e._decor.inactive);
					this._placeholderDecorations.set(O, F);
				}
			}
			this._placeholderGroups = groupBy(this._snippet.placeholders, Placeholder.compareByIndex);
		});
	}
}, _defaultOptions$1 = {
	overwriteBefore: 0,
	overwriteAfter: 0,
	adjustWhitespace: !0,
	clipboardText: void 0,
	overtypingCapturer: void 0
}, SnippetSession = SnippetSession_1 = class {
	static adjustWhitespace(e, O, k, A, j) {
		let M = e.getLineContent(O.lineNumber), N = getLeadingWhitespace(M, 0, O.column - 1), P;
		return A.walk((O) => {
			if (!(O instanceof Text) || O.parent instanceof Choice || j && !j.has(O)) return !0;
			let M = O.value.split(/\r\n|\r|\n/);
			if (k) {
				let k = A.offset(O);
				if (k === 0) M[0] = e.normalizeIndentation(M[0]);
				else {
					P ??= A.toString();
					let O = P.charCodeAt(k - 1);
					(O === 10 || O === 13) && (M[0] = e.normalizeIndentation(N + M[0]));
				}
				for (let O = 1; O < M.length; O++) M[O] = e.normalizeIndentation(N + M[O]);
			}
			let F = M.join(e.getEOL());
			return F !== O.value && (O.parent.replace(O, [new Text(F)]), P = void 0), !0;
		}), N;
	}
	static adjustSelection(e, O, k, A) {
		if (k !== 0 || A !== 0) {
			let { positionLineNumber: j, positionColumn: M } = O, N = M - k, P = M + A, F = e.validateRange({
				startLineNumber: j,
				startColumn: N,
				endLineNumber: j,
				endColumn: P
			});
			O = Selection.createWithDirection(F.startLineNumber, F.startColumn, F.endLineNumber, F.endColumn, O.getDirection());
		}
		return O;
	}
	static createEditsAndSnippetsFromSelections(e, O, k, A, j, M, N, P, F) {
		let I = [], L = [];
		if (!e.hasModel()) return {
			edits: I,
			snippets: L
		};
		let R = e.getModel(), z = e.invokeWithinContext((e) => e.get(IWorkspaceContextService)), B = e.invokeWithinContext((e) => new ModelBasedVariableResolver(e.get(ILabelService), R)), V = () => N, H = R.getValueInRange(SnippetSession_1.adjustSelection(R, e.getSelection(), k, 0)), U = R.getValueInRange(SnippetSession_1.adjustSelection(R, e.getSelection(), 0, A)), W = R.getLineFirstNonWhitespaceColumn(e.getSelection().positionLineNumber), G = e.getSelections().map((e, O) => ({
			selection: e,
			idx: O
		})).sort((e, O) => Range.compareRangesUsingStarts(e.selection, O.selection));
		for (let { selection: N, idx: K } of G) {
			let q = SnippetSession_1.adjustSelection(R, N, k, 0), J = SnippetSession_1.adjustSelection(R, N, 0, A);
			H !== R.getValueInRange(q) && (q = N), U !== R.getValueInRange(J) && (J = N);
			let Y = N.setStartPosition(q.startLineNumber, q.startColumn).setEndPosition(J.endLineNumber, J.endColumn), X = new SnippetParser().parse(O, !0, j), Z = Y.getStartPosition(), Q = SnippetSession_1.adjustWhitespace(R, Z, M || K > 0 && W !== R.getLineFirstNonWhitespaceColumn(N.positionLineNumber), X);
			X.resolveVariables(new CompositeSnippetVariableResolver([
				B,
				new ClipboardBasedVariableResolver(V, K, G.length, e.getOption(79) === "spread"),
				new SelectionBasedVariableResolver(R, N, K, P),
				new CommentBasedVariableResolver(R, N, F),
				new TimeBasedVariableResolver(),
				new WorkspaceBasedVariableResolver(z),
				new RandomBasedVariableResolver()
			])), I[K] = EditOperation.replace(Y, X.toString()), I[K].identifier = {
				major: K,
				minor: 0
			}, I[K]._isTracked = !0, L[K] = new OneSnippet(e, X, Q);
		}
		return {
			edits: I,
			snippets: L
		};
	}
	static createEditsAndSnippetsFromEdits(e, O, k, A, j, M, N) {
		if (!e.hasModel() || O.length === 0) return {
			edits: [],
			snippets: []
		};
		let P = [], F = e.getModel(), I = new SnippetParser(), L = new TextmateSnippet(), R = new CompositeSnippetVariableResolver([
			e.invokeWithinContext((e) => new ModelBasedVariableResolver(e.get(ILabelService), F)),
			new ClipboardBasedVariableResolver(() => j, 0, e.getSelections().length, e.getOption(79) === "spread"),
			new SelectionBasedVariableResolver(F, e.getSelection(), 0, M),
			new CommentBasedVariableResolver(F, e.getSelection(), N),
			new TimeBasedVariableResolver(),
			new WorkspaceBasedVariableResolver(e.invokeWithinContext((e) => e.get(IWorkspaceContextService))),
			new RandomBasedVariableResolver()
		]);
		O = O.sort((e, O) => Range.compareRangesUsingStarts(e.range, O.range));
		let z = 0;
		for (let e = 0; e < O.length; e++) {
			let { range: k, template: A } = O[e];
			if (e > 0) {
				let A = O[e - 1].range, j = Range.fromPositions(A.getEndPosition(), k.getStartPosition()), M = new Text(F.getValueInRange(j));
				L.appendChild(M), z += M.value.length;
			}
			let j = I.parseFragment(A, L);
			SnippetSession_1.adjustWhitespace(F, k.getStartPosition(), !0, L, new Set(j)), L.resolveVariables(R);
			let M = L.toString(), N = M.slice(z);
			z = M.length;
			let B = EditOperation.replace(k, N);
			B.identifier = {
				major: e,
				minor: 0
			}, B._isTracked = !0, P.push(B);
		}
		return I.ensureFinalTabstop(L, k, !0), {
			edits: P,
			snippets: [new OneSnippet(e, L, "")]
		};
	}
	constructor(e, O, k = _defaultOptions$1, A) {
		this._editor = e, this._template = O, this._options = k, this._languageConfigurationService = A, this._templateMerges = [], this._snippets = [];
	}
	dispose() {
		dispose(this._snippets);
	}
	_logInfo() {
		return `template="${this._template}", merged_templates="${this._templateMerges.join(" -> ")}"`;
	}
	insert() {
		if (!this._editor.hasModel()) return;
		let { edits: e, snippets: O } = typeof this._template == "string" ? SnippetSession_1.createEditsAndSnippetsFromSelections(this._editor, this._template, this._options.overwriteBefore, this._options.overwriteAfter, !1, this._options.adjustWhitespace, this._options.clipboardText, this._options.overtypingCapturer, this._languageConfigurationService) : SnippetSession_1.createEditsAndSnippetsFromEdits(this._editor, this._template, !1, this._options.adjustWhitespace, this._options.clipboardText, this._options.overtypingCapturer, this._languageConfigurationService);
		this._snippets = O, this._editor.executeEdits("snippet", e, (e) => {
			let k = e.filter((e) => !!e.identifier);
			for (let e = 0; e < O.length; e++) O[e].initialize(k[e].textChange);
			return this._snippets[0].hasPlaceholder ? this._move(!0) : k.map((e) => Selection.fromPositions(e.range.getEndPosition()));
		}), this._editor.revealRange(this._editor.getSelections()[0]);
	}
	merge(e, O = _defaultOptions$1) {
		if (!this._editor.hasModel()) return;
		this._templateMerges.push([
			this._snippets[0]._nestingLevel,
			this._snippets[0]._placeholderGroupsIdx,
			e
		]);
		let { edits: k, snippets: A } = SnippetSession_1.createEditsAndSnippetsFromSelections(this._editor, e, O.overwriteBefore, O.overwriteAfter, !0, O.adjustWhitespace, O.clipboardText, O.overtypingCapturer, this._languageConfigurationService);
		this._editor.executeEdits("snippet", k, (e) => {
			let O = e.filter((e) => !!e.identifier);
			for (let e = 0; e < A.length; e++) A[e].initialize(O[e].textChange);
			let k = A[0].isTrivialSnippet;
			if (!k) {
				for (let e of this._snippets) e.merge(A);
				console.assert(A.length === 0);
			}
			return this._snippets[0].hasPlaceholder && !k ? this._move(void 0) : O.map((e) => Selection.fromPositions(e.range.getEndPosition()));
		});
	}
	next() {
		let e = this._move(!0);
		this._editor.setSelections(e), this._editor.revealPositionInCenterIfOutsideViewport(e[0].getPosition());
	}
	prev() {
		let e = this._move(!1);
		this._editor.setSelections(e), this._editor.revealPositionInCenterIfOutsideViewport(e[0].getPosition());
	}
	_move(e) {
		let O = [];
		for (let k of this._snippets) {
			let A = k.move(e);
			O.push(...A);
		}
		return O;
	}
	get isAtFirstPlaceholder() {
		return this._snippets[0].isAtFirstPlaceholder;
	}
	get isAtLastPlaceholder() {
		return this._snippets[0].isAtLastPlaceholder;
	}
	get hasPlaceholder() {
		return this._snippets[0].hasPlaceholder;
	}
	get hasChoice() {
		return this._snippets[0].hasChoice;
	}
	get activeChoice() {
		return this._snippets[0].activeChoice;
	}
	isSelectionWithinPlaceholders() {
		if (!this.hasPlaceholder) return !1;
		let e = this._editor.getSelections();
		if (e.length < this._snippets.length) return !1;
		let O = /* @__PURE__ */ new Map();
		for (let k of this._snippets) {
			let A = k.computePossibleSelections();
			if (O.size === 0) for (let [k, j] of A) {
				j.sort(Range.compareRangesUsingStarts);
				for (let A of e) if (j[0].containsRange(A)) {
					O.set(k, []);
					break;
				}
			}
			if (O.size === 0) return !1;
			O.forEach((e, O) => {
				e.push(...A.get(O));
			});
		}
		e.sort(Range.compareRangesUsingStarts);
		for (let [k, A] of O) {
			if (A.length !== e.length) {
				O.delete(k);
				continue;
			}
			A.sort(Range.compareRangesUsingStarts);
			for (let j = 0; j < A.length; j++) if (!A[j].containsRange(e[j])) {
				O.delete(k);
				continue;
			}
		}
		return O.size > 0;
	}
};
SnippetSession = SnippetSession_1 = __decorate$61([__param$61(3, ILanguageConfigurationService)], SnippetSession);
var __decorate$60 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$60 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, SnippetController2_1, _defaultOptions = {
	overwriteBefore: 0,
	overwriteAfter: 0,
	undoStopBefore: !0,
	undoStopAfter: !0,
	adjustWhitespace: !0,
	clipboardText: void 0,
	overtypingCapturer: void 0
}, SnippetController2 = class {
	static {
		SnippetController2_1 = this;
	}
	static {
		this.ID = "snippetController2";
	}
	static get(e) {
		return e.getContribution(SnippetController2_1.ID);
	}
	static {
		this.InSnippetMode = new RawContextKey("inSnippetMode", !1, localize("inSnippetMode", "Whether the editor in current in snippet mode"));
	}
	static {
		this.HasNextTabstop = new RawContextKey("hasNextTabstop", !1, localize("hasNextTabstop", "Whether there is a next tab stop when in snippet mode"));
	}
	static {
		this.HasPrevTabstop = new RawContextKey("hasPrevTabstop", !1, localize("hasPrevTabstop", "Whether there is a previous tab stop when in snippet mode"));
	}
	constructor(e, O, k, A, j) {
		this._editor = e, this._logService = O, this._languageFeaturesService = k, this._languageConfigurationService = j, this._snippetListener = new DisposableStore(), this._modelVersionId = -1, this._inSnippet = SnippetController2_1.InSnippetMode.bindTo(A), this._hasNextTabstop = SnippetController2_1.HasNextTabstop.bindTo(A), this._hasPrevTabstop = SnippetController2_1.HasPrevTabstop.bindTo(A);
	}
	dispose() {
		this._inSnippet.reset(), this._hasPrevTabstop.reset(), this._hasNextTabstop.reset(), this._session?.dispose(), this._snippetListener.dispose();
	}
	insert(e, O) {
		try {
			this._doInsert(e, O === void 0 ? _defaultOptions : {
				..._defaultOptions,
				...O
			});
		} catch (O) {
			this.cancel(), this._logService.error(O), this._logService.error("snippet_error"), this._logService.error("insert_template=", e), this._logService.error("existing_template=", this._session ? this._session._logInfo() : "<no_session>");
		}
	}
	_doInsert(e, O) {
		if (this._editor.hasModel()) {
			if (this._snippetListener.clear(), O.undoStopBefore && this._editor.getModel().pushStackElement(), this._session && typeof e != "string" && this.cancel(), this._session ? (assertType(typeof e == "string"), this._session.merge(e, O)) : (this._modelVersionId = this._editor.getModel().getAlternativeVersionId(), this._session = new SnippetSession(this._editor, e, O, this._languageConfigurationService), this._session.insert()), O.undoStopAfter && this._editor.getModel().pushStackElement(), this._session?.hasChoice) {
				let e = {
					_debugDisplayName: "snippetChoiceCompletions",
					provideCompletionItems: (e, O) => {
						if (!this._session || e !== this._editor.getModel() || !Position.equals(this._editor.getPosition(), O)) return;
						let { activeChoice: k } = this._session;
						if (!k || k.choice.options.length === 0) return;
						let A = e.getValueInRange(k.range), j = !!k.choice.options.find((e) => e.value === A), M = [];
						for (let e = 0; e < k.choice.options.length; e++) {
							let O = k.choice.options[e];
							M.push({
								kind: 13,
								label: O.value,
								insertText: O.value,
								sortText: "a".repeat(e + 1),
								range: k.range,
								filterText: j ? `${A}_${O.value}` : void 0,
								command: {
									id: "jumpToNextSnippetPlaceholder",
									title: localize("next", "Go to next placeholder...")
								}
							});
						}
						return { suggestions: M };
					}
				}, O = this._editor.getModel(), k, A = !1;
				this._choiceCompletions = {
					provider: e,
					enable: () => {
						A ||= (k = this._languageFeaturesService.completionProvider.register({
							language: O.getLanguageId(),
							pattern: O.uri.fsPath,
							scheme: O.uri.scheme,
							exclusive: !0
						}, e), this._snippetListener.add(k), !0);
					},
					disable: () => {
						k?.dispose(), A = !1;
					}
				};
			}
			this._updateState(), this._snippetListener.add(this._editor.onDidChangeModelContent((e) => e.isFlush && this.cancel())), this._snippetListener.add(this._editor.onDidChangeModel(() => this.cancel())), this._snippetListener.add(this._editor.onDidChangeCursorSelection(() => this._updateState()));
		}
	}
	_updateState() {
		if (!(!this._session || !this._editor.hasModel())) {
			if (this._modelVersionId === this._editor.getModel().getAlternativeVersionId() || !this._session.hasPlaceholder) return this.cancel();
			if (this._session.isAtLastPlaceholder || !this._session.isSelectionWithinPlaceholders()) return this._editor.getModel().pushStackElement(), this.cancel();
			this._inSnippet.set(!0), this._hasPrevTabstop.set(!this._session.isAtFirstPlaceholder), this._hasNextTabstop.set(!this._session.isAtLastPlaceholder), this._handleChoice();
		}
	}
	_handleChoice() {
		if (!this._session || !this._editor.hasModel()) {
			this._currentChoice = void 0;
			return;
		}
		let { activeChoice: e } = this._session;
		if (!e || !this._choiceCompletions) {
			this._choiceCompletions?.disable(), this._currentChoice = void 0;
			return;
		}
		this._currentChoice !== e.choice && (this._currentChoice = e.choice, this._choiceCompletions.enable(), queueMicrotask(() => {
			showSimpleSuggestions(this._editor, this._choiceCompletions.provider);
		}));
	}
	finish() {
		for (; this._inSnippet.get();) this.next();
	}
	cancel(e = !1) {
		this._inSnippet.reset(), this._hasPrevTabstop.reset(), this._hasNextTabstop.reset(), this._snippetListener.clear(), this._currentChoice = void 0, this._session?.dispose(), this._session = void 0, this._modelVersionId = -1, e && this._editor.setSelections([this._editor.getSelection()]);
	}
	prev() {
		this._session?.prev(), this._updateState();
	}
	next() {
		this._session?.next(), this._updateState();
	}
	isInSnippet() {
		return !!this._inSnippet.get();
	}
};
SnippetController2 = SnippetController2_1 = __decorate$60([
	__param$60(1, ILogService),
	__param$60(2, ILanguageFeaturesService),
	__param$60(3, IContextKeyService),
	__param$60(4, ILanguageConfigurationService)
], SnippetController2), registerEditorContribution(SnippetController2.ID, SnippetController2, 4);
var CommandCtor = EditorCommand.bindToContribution(SnippetController2.get);
registerEditorCommand(new CommandCtor({
	id: "jumpToNextSnippetPlaceholder",
	precondition: ContextKeyExpr.and(SnippetController2.InSnippetMode, SnippetController2.HasNextTabstop),
	handler: (e) => e.next(),
	kbOpts: {
		weight: 130,
		kbExpr: EditorContextKeys.textInputFocus,
		primary: 2
	}
})), registerEditorCommand(new CommandCtor({
	id: "jumpToPrevSnippetPlaceholder",
	precondition: ContextKeyExpr.and(SnippetController2.InSnippetMode, SnippetController2.HasPrevTabstop),
	handler: (e) => e.prev(),
	kbOpts: {
		weight: 130,
		kbExpr: EditorContextKeys.textInputFocus,
		primary: 1026
	}
})), registerEditorCommand(new CommandCtor({
	id: "leaveSnippet",
	precondition: SnippetController2.InSnippetMode,
	handler: (e) => e.cancel(!0),
	kbOpts: {
		weight: 130,
		kbExpr: EditorContextKeys.textInputFocus,
		primary: 9,
		secondary: [1033]
	}
})), registerEditorCommand(new CommandCtor({
	id: "acceptSnippet",
	precondition: SnippetController2.InSnippetMode,
	handler: (e) => e.finish()
}));
var __decorate$59 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$59 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, InlineCompletionsModel = class extends Disposable {
	get isAcceptingPartially() {
		return this._isAcceptingPartially;
	}
	constructor(e, O, k, A, j, M, N, P, F, I, L, R) {
		super(), this.textModel = e, this.selectedSuggestItem = O, this._textModelVersionId = k, this._positions = A, this._debounceValue = j, this._suggestPreviewEnabled = M, this._suggestPreviewMode = N, this._inlineSuggestMode = P, this._enabled = F, this._instantiationService = I, this._commandService = L, this._languageConfigurationService = R, this._source = this._register(this._instantiationService.createInstance(InlineCompletionsSource, this.textModel, this._textModelVersionId, this._debounceValue)), this._isActive = observableValue(this, !1), this._forceUpdateExplicitlySignal = observableSignal(this), this._selectedInlineCompletionId = observableValue(this, void 0), this._primaryPosition = derived(this, (e) => this._positions.read(e)[0] ?? new Position(1, 1)), this._isAcceptingPartially = !1, this._preserveCurrentCompletionReasons = new Set([
			VersionIdChangeReason.Redo,
			VersionIdChangeReason.Undo,
			VersionIdChangeReason.AcceptWord
		]), this._fetchInlineCompletionsPromise = derivedHandleChanges({
			owner: this,
			createEmptyChangeSummary: () => ({
				preserveCurrentCompletion: !1,
				inlineCompletionTriggerKind: InlineCompletionTriggerKind.Automatic
			}),
			handleChange: (e, O) => (e.didChange(this._textModelVersionId) && this._preserveCurrentCompletionReasons.has(this._getReason(e.change)) ? O.preserveCurrentCompletion = !0 : e.didChange(this._forceUpdateExplicitlySignal) && (O.inlineCompletionTriggerKind = InlineCompletionTriggerKind.Explicit), !0)
		}, (e, O) => {
			if (this._forceUpdateExplicitlySignal.read(e), !(this._enabled.read(e) && this.selectedSuggestItem.read(e) || this._isActive.read(e))) {
				this._source.cancelUpdate();
				return;
			}
			this._textModelVersionId.read(e);
			let k = this._source.suggestWidgetInlineCompletions.get(), A = this.selectedSuggestItem.read(e);
			if (k && !A) {
				let e = this._source.inlineCompletions.get();
				transaction((O) => {
					(!e || k.request.versionId > e.request.versionId) && this._source.inlineCompletions.set(k.clone(), O), this._source.clearSuggestWidgetInlineCompletions(O);
				});
			}
			let j = this._primaryPosition.read(e), M = {
				triggerKind: O.inlineCompletionTriggerKind,
				selectedSuggestionInfo: A?.toSelectedSuggestionInfo()
			}, N = this.selectedInlineCompletion.get(), P = O.preserveCurrentCompletion || N?.forwardStable ? N : void 0;
			return this._source.fetch(j, M, P);
		}), this._filteredInlineCompletionItems = derivedOpts({
			owner: this,
			equalsFn: itemsEquals()
		}, (e) => {
			let O = this._source.inlineCompletions.read(e);
			if (!O) return [];
			let k = this._primaryPosition.read(e);
			return O.inlineCompletions.filter((O) => O.isVisible(this.textModel, k, e));
		}), this.selectedInlineCompletionIndex = derived(this, (e) => {
			let O = this._selectedInlineCompletionId.read(e), k = this._filteredInlineCompletionItems.read(e), A = this._selectedInlineCompletionId === void 0 ? -1 : k.findIndex((e) => e.semanticId === O);
			return A === -1 ? (this._selectedInlineCompletionId.set(void 0, void 0), 0) : A;
		}), this.selectedInlineCompletion = derived(this, (e) => {
			let O = this._filteredInlineCompletionItems.read(e), k = this.selectedInlineCompletionIndex.read(e);
			return O[k];
		}), this.activeCommands = derivedOpts({
			owner: this,
			equalsFn: itemsEquals()
		}, (e) => this.selectedInlineCompletion.read(e)?.inlineCompletion.source.inlineCompletions.commands ?? []), this.lastTriggerKind = this._source.inlineCompletions.map(this, (e) => e?.request.context.triggerKind), this.inlineCompletionsCount = derived(this, (e) => {
			if (this.lastTriggerKind.read(e) === InlineCompletionTriggerKind.Explicit) return this._filteredInlineCompletionItems.read(e).length;
		}), this.state = derivedOpts({
			owner: this,
			equalsFn: (e, O) => !e || !O ? e === O : ghostTextsOrReplacementsEqual(e.ghostTexts, O.ghostTexts) && e.inlineCompletion === O.inlineCompletion && e.suggestItem === O.suggestItem
		}, (e) => {
			let O = this.textModel, k = this.selectedSuggestItem.read(e);
			if (k) {
				let A = singleTextRemoveCommonPrefix(k.toSingleTextEdit(), O), j = this._computeAugmentation(A, e);
				if (!this._suggestPreviewEnabled.read(e) && !j) return;
				let M = j?.edit ?? A, N = j ? j.edit.text.length - A.text.length : 0, P = this._suggestPreviewMode.read(e), F = this._positions.read(e), I = [M, ...getSecondaryEdits(this.textModel, F, M)], L = I.map((e, k) => computeGhostText(e, O, P, F[k], N)).filter(isDefined), R = L[0] ?? new GhostText(M.range.endLineNumber, []);
				return {
					edits: I,
					primaryGhostText: R,
					ghostTexts: L,
					inlineCompletion: j?.completion,
					suggestItem: k
				};
			} else {
				if (!this._isActive.read(e)) return;
				let k = this.selectedInlineCompletion.read(e);
				if (!k) return;
				let A = k.toSingleTextEdit(e), j = this._inlineSuggestMode.read(e), M = this._positions.read(e), N = [A, ...getSecondaryEdits(this.textModel, M, A)], P = N.map((e, k) => computeGhostText(e, O, j, M[k], 0)).filter(isDefined);
				return P[0] ? {
					edits: N,
					primaryGhostText: P[0],
					ghostTexts: P,
					inlineCompletion: k,
					suggestItem: void 0
				} : void 0;
			}
		}), this.ghostTexts = derivedOpts({
			owner: this,
			equalsFn: ghostTextsOrReplacementsEqual
		}, (e) => {
			let O = this.state.read(e);
			if (O) return O.ghostTexts;
		}), this.primaryGhostText = derivedOpts({
			owner: this,
			equalsFn: ghostTextOrReplacementEquals
		}, (e) => {
			let O = this.state.read(e);
			if (O) return O?.primaryGhostText;
		}), this._register(recomputeInitiallyAndOnChange(this._fetchInlineCompletionsPromise));
		let z;
		this._register(autorun((e) => {
			let O = this.state.read(e)?.inlineCompletion;
			if (O?.semanticId !== z?.semanticId && (z = O, O)) {
				let e = O.inlineCompletion, k = e.source;
				k.provider.handleItemDidShow?.(k.inlineCompletions, e.sourceInlineCompletion, e.insertText);
			}
		}));
	}
	_getReason(e) {
		return e?.isUndoing ? VersionIdChangeReason.Undo : e?.isRedoing ? VersionIdChangeReason.Redo : this.isAcceptingPartially ? VersionIdChangeReason.AcceptWord : VersionIdChangeReason.Other;
	}
	async trigger(e) {
		this._isActive.set(!0, e), await this._fetchInlineCompletionsPromise.get();
	}
	async triggerExplicitly(e) {
		subtransaction(e, (e) => {
			this._isActive.set(!0, e), this._forceUpdateExplicitlySignal.trigger(e);
		}), await this._fetchInlineCompletionsPromise.get();
	}
	stop(e) {
		subtransaction(e, (e) => {
			this._isActive.set(!1, e), this._source.clear(e);
		});
	}
	_computeAugmentation(e, O) {
		let k = this.textModel, A = this._source.suggestWidgetInlineCompletions.read(O), j = A ? A.inlineCompletions : [this.selectedInlineCompletion.read(O)].filter(isDefined);
		return mapFindFirst(j, (A) => {
			let j = A.toSingleTextEdit(O);
			return j = singleTextRemoveCommonPrefix(j, k, Range.fromPositions(j.range.getStartPosition(), e.range.getEndPosition())), singleTextEditAugments(j, e) ? {
				completion: A,
				edit: j
			} : void 0;
		});
	}
	async _deltaSelectedInlineCompletionIndex(e) {
		await this.triggerExplicitly();
		let O = this._filteredInlineCompletionItems.get() || [];
		if (O.length > 0) {
			let k = (this.selectedInlineCompletionIndex.get() + e + O.length) % O.length;
			this._selectedInlineCompletionId.set(O[k].semanticId, void 0);
		} else this._selectedInlineCompletionId.set(void 0, void 0);
	}
	async next() {
		await this._deltaSelectedInlineCompletionIndex(1);
	}
	async previous() {
		await this._deltaSelectedInlineCompletionIndex(-1);
	}
	async accept(e) {
		if (e.getModel() !== this.textModel) throw new BugIndicatingError();
		let O = this.state.get();
		if (!O || O.primaryGhostText.isEmpty() || !O.inlineCompletion) return;
		let k = O.inlineCompletion.toInlineCompletion(void 0);
		if (k.command && k.source.addRef(), e.pushUndoStop(), k.snippetInfo) e.executeEdits("inlineSuggestion.accept", [EditOperation.replace(k.range, ""), ...k.additionalTextEdits]), e.setPosition(k.snippetInfo.range.getStartPosition(), "inlineCompletionAccept"), SnippetController2.get(e)?.insert(k.snippetInfo.snippet, { undoStopBefore: !1 });
		else {
			let A = O.edits, j = getEndPositionsAfterApplying(A).map((e) => Selection.fromPositions(e));
			e.executeEdits("inlineSuggestion.accept", [...A.map((e) => EditOperation.replace(e.range, e.text)), ...k.additionalTextEdits]), e.setSelections(j, "inlineCompletionAccept");
		}
		this.stop(), k.command && (await this._commandService.executeCommand(k.command.id, ...k.command.arguments || []).then(void 0, onUnexpectedExternalError), k.source.removeRef());
	}
	async acceptNextWord(e) {
		await this._acceptNext(e, (e, O) => {
			let k = this.textModel.getLanguageIdAtPosition(e.lineNumber, e.column), A = this._languageConfigurationService.getLanguageConfiguration(k), j = new RegExp(A.wordDefinition.source, A.wordDefinition.flags.replace("g", "")), M = O.match(j), N = 0;
			N = M && M.index !== void 0 ? M.index === 0 ? M[0].length : M.index : O.length;
			let P = /\s+/g.exec(O);
			return P && P.index !== void 0 && P.index + P[0].length < N && (N = P.index + P[0].length), N;
		}, 0);
	}
	async acceptNextLine(e) {
		await this._acceptNext(e, (e, O) => {
			let k = O.match(/\n/);
			return k && k.index !== void 0 ? k.index + 1 : O.length;
		}, 1);
	}
	async _acceptNext(e, O, k) {
		if (e.getModel() !== this.textModel) throw new BugIndicatingError();
		let A = this.state.get();
		if (!A || A.primaryGhostText.isEmpty() || !A.inlineCompletion) return;
		let j = A.primaryGhostText, M = A.inlineCompletion.toInlineCompletion(void 0);
		if (M.snippetInfo || M.filterText !== M.insertText) {
			await this.accept(e);
			return;
		}
		let N = j.parts[0], P = new Position(j.lineNumber, N.column), F = N.text, I = O(P, F);
		if (I === F.length && j.parts.length === 1) {
			this.accept(e);
			return;
		}
		let L = F.substring(0, I), R = this._positions.get(), z = R[0];
		M.source.addRef();
		try {
			this._isAcceptingPartially = !0;
			try {
				e.pushUndoStop();
				let O = Range.fromPositions(z, P), k = e.getModel().getValueInRange(O) + L, A = new SingleTextEdit(O, k), j = [A, ...getSecondaryEdits(this.textModel, R, A)], M = getEndPositionsAfterApplying(j).map((e) => Selection.fromPositions(e));
				e.executeEdits("inlineSuggestion.accept", j.map((e) => EditOperation.replace(e.range, e.text))), e.setSelections(M, "inlineCompletionPartialAccept"), e.revealPositionInCenterIfOutsideViewport(e.getPosition(), 1);
			} finally {
				this._isAcceptingPartially = !1;
			}
			if (M.source.provider.handlePartialAccept) {
				let O = Range.fromPositions(M.range.getStartPosition(), TextLength.ofText(L).addToPosition(P)), A = e.getModel().getValueInRange(O, 1);
				M.source.provider.handlePartialAccept(M.source.inlineCompletions, M.sourceInlineCompletion, A.length, { kind: k });
			}
		} finally {
			M.source.removeRef();
		}
	}
	handleSuggestAccepted(e) {
		let O = singleTextRemoveCommonPrefix(e.toSingleTextEdit(), this.textModel), k = this._computeAugmentation(O, void 0);
		if (!k) return;
		let A = k.completion.inlineCompletion;
		A.source.provider.handlePartialAccept?.(A.source.inlineCompletions, A.sourceInlineCompletion, O.text.length, { kind: 2 });
	}
};
InlineCompletionsModel = __decorate$59([
	__param$59(9, IInstantiationService),
	__param$59(10, ICommandService),
	__param$59(11, ILanguageConfigurationService)
], InlineCompletionsModel);
var VersionIdChangeReason;
(function(e) {
	e[e.Undo = 0] = "Undo", e[e.Redo = 1] = "Redo", e[e.AcceptWord = 2] = "AcceptWord", e[e.Other = 3] = "Other";
})(VersionIdChangeReason ||= {});
function getSecondaryEdits(e, O, k) {
	if (O.length === 1) return [];
	let A = O[0], j = O.slice(1), M = k.range.getStartPosition(), N = k.range.getEndPosition(), P = e.getValueInRange(Range.fromPositions(A, N)), F = subtractPositions(A, M);
	if (F.lineNumber < 1) return onUnexpectedError(new BugIndicatingError(`positionWithinTextEdit line number should be bigger than 0.
			Invalid subtraction between ${A.toString()} and ${M.toString()}`)), [];
	let I = substringPos(k.text, F);
	return j.map((O) => {
		let k = addPositions(subtractPositions(O, M), N), A = e.getValueInRange(Range.fromPositions(O, k)), j = commonPrefixLength(P, A), F = Range.fromPositions(O, O.delta(0, j));
		return new SingleTextEdit(F, I);
	});
}
function substringPos(e, O) {
	let k = "", A = splitLinesIncludeSeparators(e);
	for (let e = O.lineNumber - 1; e < A.length; e++) k += A[e].substring(e === O.lineNumber - 1 ? O.column - 1 : 0);
	return k;
}
function getEndPositionsAfterApplying(e) {
	let O = Permutation.createSortPermutation(e, compareBy((e) => e.range, Range.compareRangesUsingStarts)), k = new TextEdit(O.apply(e)).getNewRanges();
	return O.inverse().apply(k).map((e) => e.getEndPosition());
}
var __decorate$58 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$58 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, SuggestMemoryService_1, Memory = class {
	constructor(e) {
		this.name = e;
	}
	select(e, O, k) {
		if (k.length === 0) return 0;
		let A = k[0].score[0];
		for (let e = 0; e < k.length; e++) {
			let { score: O, completion: j } = k[e];
			if (O[0] !== A) break;
			if (j.preselect) return e;
		}
		return 0;
	}
}, NoMemory = class extends Memory {
	constructor() {
		super("first");
	}
	memorize(e, O, k) {}
	toJSON() {}
	fromJSON() {}
}, LRUMemory = class extends Memory {
	constructor() {
		super("recentlyUsed"), this._cache = new LRUCache(300, .66), this._seq = 0;
	}
	memorize(e, O, k) {
		let A = `${e.getLanguageId()}/${k.textLabel}`;
		this._cache.set(A, {
			touch: this._seq++,
			type: k.completion.kind,
			insertText: k.completion.insertText
		});
	}
	select(e, O, k) {
		if (k.length === 0) return 0;
		let A = e.getLineContent(O.lineNumber).substr(O.column - 10, O.column - 1);
		if (/\s$/.test(A)) return super.select(e, O, k);
		let j = k[0].score[0], M = -1, N = -1, P = -1;
		for (let O = 0; O < k.length && k[O].score[0] === j; O++) {
			let A = `${e.getLanguageId()}/${k[O].textLabel}`, j = this._cache.peek(A);
			if (j && j.touch > P && j.type === k[O].completion.kind && j.insertText === k[O].completion.insertText && (P = j.touch, N = O), k[O].completion.preselect && M === -1) return M = O;
		}
		return N === -1 ? M === -1 ? 0 : M : N;
	}
	toJSON() {
		return this._cache.toJSON();
	}
	fromJSON(e) {
		this._cache.clear();
		for (let [O, k] of e) k.touch = 0, k.type = typeof k.type == "number" ? k.type : CompletionItemKinds.fromString(k.type), this._cache.set(O, k);
		this._seq = this._cache.size;
	}
}, PrefixMemory = class extends Memory {
	constructor() {
		super("recentlyUsedByPrefix"), this._trie = TernarySearchTree.forStrings(), this._seq = 0;
	}
	memorize(e, O, k) {
		let { word: A } = e.getWordUntilPosition(O), j = `${e.getLanguageId()}/${A}`;
		this._trie.set(j, {
			type: k.completion.kind,
			insertText: k.completion.insertText,
			touch: this._seq++
		});
	}
	select(e, O, k) {
		let { word: A } = e.getWordUntilPosition(O);
		if (!A) return super.select(e, O, k);
		let j = `${e.getLanguageId()}/${A}`, M = this._trie.get(j);
		if (M ||= this._trie.findSubstr(j), M) for (let e = 0; e < k.length; e++) {
			let { kind: O, insertText: A } = k[e].completion;
			if (O === M.type && A === M.insertText) return e;
		}
		return super.select(e, O, k);
	}
	toJSON() {
		let e = [];
		return this._trie.forEach((O, k) => e.push([k, O])), e.sort((e, O) => -(e[1].touch - O[1].touch)).forEach((e, O) => e[1].touch = O), e.slice(0, 200);
	}
	fromJSON(e) {
		if (this._trie.clear(), e.length > 0) {
			this._seq = e[0][1].touch + 1;
			for (let [O, k] of e) k.type = typeof k.type == "number" ? k.type : CompletionItemKinds.fromString(k.type), this._trie.set(O, k);
		}
	}
}, SuggestMemoryService = class {
	static {
		SuggestMemoryService_1 = this;
	}
	static {
		this._strategyCtors = new Map([
			["recentlyUsedByPrefix", PrefixMemory],
			["recentlyUsed", LRUMemory],
			["first", NoMemory]
		]);
	}
	static {
		this._storagePrefix = "suggest/memories";
	}
	constructor(e, O) {
		this._storageService = e, this._configService = O, this._disposables = new DisposableStore(), this._persistSoon = new RunOnceScheduler(() => this._saveState(), 500), this._disposables.add(e.onWillSaveState((e) => {
			e.reason === WillSaveStateReason.SHUTDOWN && this._saveState();
		}));
	}
	dispose() {
		this._disposables.dispose(), this._persistSoon.dispose();
	}
	memorize(e, O, k) {
		this._withStrategy(e, O).memorize(e, O, k), this._persistSoon.schedule();
	}
	select(e, O, k) {
		return this._withStrategy(e, O).select(e, O, k);
	}
	_withStrategy(e, O) {
		let k = this._configService.getValue("editor.suggestSelection", {
			overrideIdentifier: e.getLanguageIdAtPosition(O.lineNumber, O.column),
			resource: e.uri
		});
		if (this._strategy?.name !== k) {
			this._saveState(), this._strategy = new ((SuggestMemoryService_1._strategyCtors.get(k)) || NoMemory)();
			try {
				let e = this._configService.getValue("editor.suggest.shareSuggestSelections") ? 0 : 1, O = this._storageService.get(`${SuggestMemoryService_1._storagePrefix}/${k}`, e);
				O && this._strategy.fromJSON(JSON.parse(O));
			} catch {}
		}
		return this._strategy;
	}
	_saveState() {
		if (this._strategy) {
			let e = this._configService.getValue("editor.suggest.shareSuggestSelections") ? 0 : 1, O = JSON.stringify(this._strategy);
			this._storageService.store(`${SuggestMemoryService_1._storagePrefix}/${this._strategy.name}`, O, e, 1);
		}
	}
};
SuggestMemoryService = SuggestMemoryService_1 = __decorate$58([__param$58(0, IStorageService), __param$58(1, IConfigurationService)], SuggestMemoryService);
const ISuggestMemoryService = createDecorator("ISuggestMemories");
registerSingleton(ISuggestMemoryService, SuggestMemoryService, 1);
var __decorate$57 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$57 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, WordContextKey_1, WordContextKey = class {
	static {
		WordContextKey_1 = this;
	}
	static {
		this.AtEnd = new RawContextKey("atEndOfWord", !1);
	}
	constructor(e, O) {
		this._editor = e, this._enabled = !1, this._ckAtEnd = WordContextKey_1.AtEnd.bindTo(O), this._configListener = this._editor.onDidChangeConfiguration((e) => e.hasChanged(124) && this._update()), this._update();
	}
	dispose() {
		this._configListener.dispose(), this._selectionListener?.dispose(), this._ckAtEnd.reset();
	}
	_update() {
		let e = this._editor.getOption(124) === "on";
		if (this._enabled !== e) if (this._enabled = e, this._enabled) {
			let e = () => {
				if (!this._editor.hasModel()) {
					this._ckAtEnd.set(!1);
					return;
				}
				let e = this._editor.getModel(), O = this._editor.getSelection(), k = e.getWordAtPosition(O.getStartPosition());
				if (!k) {
					this._ckAtEnd.set(!1);
					return;
				}
				this._ckAtEnd.set(k.endColumn === O.getStartPosition().column);
			};
			this._selectionListener = this._editor.onDidChangeCursorSelection(e), e();
		} else this._selectionListener &&= (this._ckAtEnd.reset(), this._selectionListener.dispose(), void 0);
	}
};
WordContextKey = WordContextKey_1 = __decorate$57([__param$57(1, IContextKeyService)], WordContextKey);
var __decorate$56 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$56 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, SuggestAlternatives_1, SuggestAlternatives = class {
	static {
		SuggestAlternatives_1 = this;
	}
	static {
		this.OtherSuggestions = new RawContextKey("hasOtherSuggestions", !1);
	}
	constructor(e, O) {
		this._editor = e, this._index = 0, this._ckOtherSuggestions = SuggestAlternatives_1.OtherSuggestions.bindTo(O);
	}
	dispose() {
		this.reset();
	}
	reset() {
		this._ckOtherSuggestions.reset(), this._listener?.dispose(), this._model = void 0, this._acceptNext = void 0, this._ignore = !1;
	}
	set({ model: e, index: O }, k) {
		if (e.items.length === 0) {
			this.reset();
			return;
		}
		if (SuggestAlternatives_1._moveIndex(!0, e, O) === O) {
			this.reset();
			return;
		}
		this._acceptNext = k, this._model = e, this._index = O, this._listener = this._editor.onDidChangeCursorPosition(() => {
			this._ignore || this.reset();
		}), this._ckOtherSuggestions.set(!0);
	}
	static _moveIndex(e, O, k) {
		let A = k;
		for (let j = O.items.length; j > 0 && (A = (A + O.items.length + (e ? 1 : -1)) % O.items.length, !(A === k || !O.items[A].completion.additionalTextEdits)); j--);
		return A;
	}
	next() {
		this._move(!0);
	}
	prev() {
		this._move(!1);
	}
	_move(e) {
		if (this._model) try {
			this._ignore = !0, this._index = SuggestAlternatives_1._moveIndex(e, this._model, this._index), this._acceptNext({
				index: this._index,
				item: this._model.items[this._index],
				model: this._model
			});
		} finally {
			this._ignore = !1;
		}
	}
};
SuggestAlternatives = SuggestAlternatives_1 = __decorate$56([__param$56(1, IContextKeyService)], SuggestAlternatives);
var CommitCharacterController = class {
	constructor(e, O, k, A) {
		this._disposables = new DisposableStore(), this._disposables.add(k.onDidSuggest((e) => {
			e.completionModel.items.length === 0 && this.reset();
		})), this._disposables.add(k.onDidCancel((e) => {
			this.reset();
		})), this._disposables.add(O.onDidShow(() => this._onItem(O.getFocusedItem()))), this._disposables.add(O.onDidFocus(this._onItem, this)), this._disposables.add(O.onDidHide(this.reset, this)), this._disposables.add(e.onWillType((j) => {
			if (this._active && !O.isFrozen() && k.state !== 0) {
				let O = j.charCodeAt(j.length - 1);
				this._active.acceptCharacters.has(O) && e.getOption(0) && A(this._active.item);
			}
		}));
	}
	_onItem(e) {
		if (!e || !isNonEmptyArray(e.item.completion.commitCharacters)) {
			this.reset();
			return;
		}
		if (this._active && this._active.item.item === e.item) return;
		let O = new CharacterSet();
		for (let k of e.item.completion.commitCharacters) k.length > 0 && O.add(k.charCodeAt(0));
		this._active = {
			acceptCharacters: O,
			item: e
		};
	}
	reset() {
		this._active = void 0;
	}
	dispose() {
		this._disposables.dispose();
	}
}, BracketSelectionRangeProvider = class e {
	async provideSelectionRanges(O, k) {
		let A = [];
		for (let j of k) {
			let k = [];
			A.push(k);
			let M = /* @__PURE__ */ new Map();
			await new Promise((k) => e._bracketsRightYield(k, 0, O, j, M)), await new Promise((A) => e._bracketsLeftYield(A, 0, O, j, M, k));
		}
		return A;
	}
	static {
		this._maxDuration = 30;
	}
	static {
		this._maxRounds = 2;
	}
	static _bracketsRightYield(O, k, A, j, M) {
		let N = /* @__PURE__ */ new Map(), P = Date.now();
		for (;;) {
			if (k >= e._maxRounds) {
				O();
				break;
			}
			if (!j) {
				O();
				break;
			}
			let F = A.bracketPairs.findNextBracket(j);
			if (!F) {
				O();
				break;
			}
			if (Date.now() - P > e._maxDuration) {
				setTimeout(() => e._bracketsRightYield(O, k + 1, A, j, M));
				break;
			}
			if (F.bracketInfo.isOpeningBracket) {
				let e = F.bracketInfo.bracketText, O = N.has(e) ? N.get(e) : 0;
				N.set(e, O + 1);
			} else {
				let e = F.bracketInfo.getOpeningBrackets()[0].bracketText, O = N.has(e) ? N.get(e) : 0;
				if (--O, N.set(e, Math.max(0, O)), O < 0) {
					let O = M.get(e);
					O || (O = new LinkedList(), M.set(e, O)), O.push(F.range);
				}
			}
			j = F.range.getEndPosition();
		}
	}
	static _bracketsLeftYield(O, k, A, j, M, N) {
		let P = /* @__PURE__ */ new Map(), F = Date.now();
		for (;;) {
			if (k >= e._maxRounds && M.size === 0) {
				O();
				break;
			}
			if (!j) {
				O();
				break;
			}
			let I = A.bracketPairs.findPrevBracket(j);
			if (!I) {
				O();
				break;
			}
			if (Date.now() - F > e._maxDuration) {
				setTimeout(() => e._bracketsLeftYield(O, k + 1, A, j, M, N));
				break;
			}
			if (I.bracketInfo.isOpeningBracket) {
				let O = I.bracketInfo.bracketText, k = P.has(O) ? P.get(O) : 0;
				if (--k, P.set(O, Math.max(0, k)), k < 0) {
					let k = M.get(O);
					if (k) {
						let j = k.shift();
						k.size === 0 && M.delete(O);
						let P = Range.fromPositions(I.range.getEndPosition(), j.getStartPosition()), F = Range.fromPositions(I.range.getStartPosition(), j.getEndPosition());
						N.push({ range: P }), N.push({ range: F }), e._addBracketLeading(A, F, N);
					}
				}
			} else {
				let e = I.bracketInfo.getOpeningBrackets()[0].bracketText, O = P.has(e) ? P.get(e) : 0;
				P.set(e, O + 1);
			}
			j = I.range.getStartPosition();
		}
	}
	static _addBracketLeading(e, O, k) {
		if (O.startLineNumber === O.endLineNumber) return;
		let A = O.startLineNumber, j = e.getLineFirstNonWhitespaceColumn(A);
		j !== 0 && j !== O.startColumn && (k.push({ range: Range.fromPositions(new Position(A, j), O.getEndPosition()) }), k.push({ range: Range.fromPositions(new Position(A, 1), O.getEndPosition()) }));
		let M = A - 1;
		if (M > 0) {
			let A = e.getLineFirstNonWhitespaceColumn(M);
			A === O.startColumn && A !== e.getLineLastNonWhitespaceColumn(M) && (k.push({ range: Range.fromPositions(new Position(M, A), O.getEndPosition()) }), k.push({ range: Range.fromPositions(new Position(M, 1), O.getEndPosition()) }));
		}
	}
}, WordDistance = class e {
	static {
		this.None = new class extends e {
			distance() {
				return 0;
			}
		}();
	}
	static async create(O, k) {
		if (!k.getOption(119).localityBonus || !k.hasModel()) return e.None;
		let A = k.getModel(), j = k.getPosition();
		if (!O.canComputeWordRanges(A.uri)) return e.None;
		let [M] = await new BracketSelectionRangeProvider().provideSelectionRanges(A, [j]);
		if (M.length === 0) return e.None;
		let N = await O.computeWordRanges(A.uri, M[0].range);
		if (!N) return e.None;
		let P = A.getWordUntilPosition(j);
		return delete N[P.word], new class extends e {
			distance(e, O) {
				if (!j.equals(k.getPosition())) return 0;
				if (O.kind === 17) return 2 << 20;
				let A = typeof O.label == "string" ? O.label : O.label.label, P = N[A];
				if (isFalsyOrEmpty(P)) return 2 << 20;
				let F = binarySearch(P, Range.fromPositions(e), Range.compareRangesUsingStarts), I = F >= 0 ? P[F] : P[Math.max(0, ~F - 1)], L = M.length;
				for (let e of M) {
					if (!Range.containsRange(e.range, I)) break;
					--L;
				}
				return L;
			}
		}();
	}
}, LineContext = class {
	constructor(e, O) {
		this.leadingLineContent = e, this.characterCountDelta = O;
	}
}, CompletionModel = class e {
	constructor(O, k, A, j, M, N, P = FuzzyScoreOptions.default, F = void 0) {
		this.clipboardText = F, this._snippetCompareFn = e._compareCompletionItems, this._items = O, this._column = k, this._wordDistance = j, this._options = M, this._refilterKind = 1, this._lineContext = A, this._fuzzyScoreOptions = P, N === "top" ? this._snippetCompareFn = e._compareCompletionItemsSnippetsUp : N === "bottom" && (this._snippetCompareFn = e._compareCompletionItemsSnippetsDown);
	}
	get lineContext() {
		return this._lineContext;
	}
	set lineContext(e) {
		(this._lineContext.leadingLineContent !== e.leadingLineContent || this._lineContext.characterCountDelta !== e.characterCountDelta) && (this._refilterKind = this._lineContext.characterCountDelta < e.characterCountDelta && this._filteredItems ? 2 : 1, this._lineContext = e);
	}
	get items() {
		return this._ensureCachedState(), this._filteredItems;
	}
	getItemsByProvider() {
		return this._ensureCachedState(), this._itemsByProvider;
	}
	getIncompleteProvider() {
		this._ensureCachedState();
		let e = /* @__PURE__ */ new Set();
		for (let [O, k] of this.getItemsByProvider()) k.length > 0 && k[0].container.incomplete && e.add(O);
		return e;
	}
	get stats() {
		return this._ensureCachedState(), this._stats;
	}
	_ensureCachedState() {
		this._refilterKind !== 0 && this._createCachedState();
	}
	_createCachedState() {
		this._itemsByProvider = /* @__PURE__ */ new Map();
		let e = [], { leadingLineContent: O, characterCountDelta: k } = this._lineContext, A = "", j = "", M = this._refilterKind === 1 ? this._items : this._filteredItems, N = [], P = !this._options.filterGraceful || M.length > 2e3 ? fuzzyScore : fuzzyScoreGracefulAggressive;
		for (let F = 0; F < M.length; F++) {
			let I = M[F];
			if (I.isInvalid) continue;
			let L = this._itemsByProvider.get(I.provider);
			L ? L.push(I) : this._itemsByProvider.set(I.provider, [I]);
			let R = I.position.column - I.editStart.column, z = R + k - (I.position.column - this._column);
			if (A.length !== z && (A = z === 0 ? "" : O.slice(-z), j = A.toLowerCase()), I.word = A, z === 0) I.score = FuzzyScore.Default;
			else {
				let e = 0;
				for (; e < R;) {
					let O = A.charCodeAt(e);
					if (O === 32 || O === 9) e += 1;
					else break;
				}
				if (e >= z) I.score = FuzzyScore.Default;
				else if (typeof I.completion.filterText == "string") {
					let O = P(A, j, e, I.completion.filterText, I.filterTextLow, 0, this._fuzzyScoreOptions);
					if (!O) continue;
					compareIgnoreCase(I.completion.filterText, I.textLabel) === 0 ? I.score = O : (I.score = anyScore(A, j, e, I.textLabel, I.labelLow, 0), I.score[0] = O[0]);
				} else {
					let O = P(A, j, e, I.textLabel, I.labelLow, 0, this._fuzzyScoreOptions);
					if (!O) continue;
					I.score = O;
				}
			}
			I.idx = F, I.distance = this._wordDistance.distance(I.position, I.completion), N.push(I), e.push(I.textLabel.length);
		}
		this._filteredItems = N.sort(this._snippetCompareFn), this._refilterKind = 0, this._stats = { pLabelLen: e.length ? quickSelect(e.length - .85, e, (e, O) => e - O) : 0 };
	}
	static _compareCompletionItems(e, O) {
		return e.score[0] > O.score[0] ? -1 : e.score[0] < O.score[0] ? 1 : e.distance < O.distance ? -1 : e.distance > O.distance ? 1 : e.idx < O.idx ? -1 : e.idx > O.idx ? 1 : 0;
	}
	static _compareCompletionItemsSnippetsDown(O, k) {
		if (O.completion.kind !== k.completion.kind) {
			if (O.completion.kind === 27) return 1;
			if (k.completion.kind === 27) return -1;
		}
		return e._compareCompletionItems(O, k);
	}
	static _compareCompletionItemsSnippetsUp(O, k) {
		if (O.completion.kind !== k.completion.kind) {
			if (O.completion.kind === 27) return -1;
			if (k.completion.kind === 27) return 1;
		}
		return e._compareCompletionItems(O, k);
	}
}, __decorate$55 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$55 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, SuggestModel_1, LineContext$1 = class {
	static shouldAutoTrigger(e) {
		if (!e.hasModel()) return !1;
		let O = e.getModel(), k = e.getPosition();
		O.tokenization.tokenizeIfCheap(k.lineNumber);
		let A = O.getWordAtPosition(k);
		return !(!A || A.endColumn !== k.column && A.startColumn + 1 !== k.column || !isNaN(Number(A.word)));
	}
	constructor(e, O, k) {
		this.leadingLineContent = e.getLineContent(O.lineNumber).substr(0, O.column - 1), this.leadingWord = e.getWordUntilPosition(O), this.lineNumber = O.lineNumber, this.column = O.column, this.triggerOptions = k;
	}
};
function canShowQuickSuggest(e, O, k) {
	if (!O.getContextKeyValue(InlineCompletionContextKeys.inlineSuggestionVisible.key)) return !0;
	let A = O.getContextKeyValue(InlineCompletionContextKeys.suppressSuggestions.key);
	return A === void 0 ? !e.getOption(62).suppressSuggestions : !A;
}
function canShowSuggestOnTriggerCharacters(e, O, k) {
	if (!O.getContextKeyValue("inlineSuggestionVisible")) return !0;
	let A = O.getContextKeyValue(InlineCompletionContextKeys.suppressSuggestions.key);
	return A === void 0 ? !e.getOption(62).suppressSuggestions : !A;
}
var SuggestModel = SuggestModel_1 = class {
	constructor(e, O, k, A, j, M, N, P, F) {
		this._editor = e, this._editorWorkerService = O, this._clipboardService = k, this._telemetryService = A, this._logService = j, this._contextKeyService = M, this._configurationService = N, this._languageFeaturesService = P, this._envService = F, this._toDispose = new DisposableStore(), this._triggerCharacterListener = new DisposableStore(), this._triggerQuickSuggest = new TimeoutTimer(), this._triggerState = void 0, this._completionDisposables = new DisposableStore(), this._onDidCancel = new Emitter(), this._onDidTrigger = new Emitter(), this._onDidSuggest = new Emitter(), this.onDidCancel = this._onDidCancel.event, this.onDidTrigger = this._onDidTrigger.event, this.onDidSuggest = this._onDidSuggest.event, this._telemetryGate = 0, this._currentSelection = this._editor.getSelection() || new Selection(1, 1, 1, 1), this._toDispose.add(this._editor.onDidChangeModel(() => {
			this._updateTriggerCharacters(), this.cancel();
		})), this._toDispose.add(this._editor.onDidChangeModelLanguage(() => {
			this._updateTriggerCharacters(), this.cancel();
		})), this._toDispose.add(this._editor.onDidChangeConfiguration(() => {
			this._updateTriggerCharacters();
		})), this._toDispose.add(this._languageFeaturesService.completionProvider.onDidChange(() => {
			this._updateTriggerCharacters(), this._updateActiveSuggestSession();
		}));
		let I = !1;
		this._toDispose.add(this._editor.onDidCompositionStart(() => {
			I = !0;
		})), this._toDispose.add(this._editor.onDidCompositionEnd(() => {
			I = !1, this._onCompositionEnd();
		})), this._toDispose.add(this._editor.onDidChangeCursorSelection((e) => {
			I || this._onCursorChange(e);
		})), this._toDispose.add(this._editor.onDidChangeModelContent(() => {
			!I && this._triggerState !== void 0 && this._refilterCompletionItems();
		})), this._updateTriggerCharacters();
	}
	dispose() {
		dispose(this._triggerCharacterListener), dispose([
			this._onDidCancel,
			this._onDidSuggest,
			this._onDidTrigger,
			this._triggerQuickSuggest
		]), this._toDispose.dispose(), this._completionDisposables.dispose(), this.cancel();
	}
	_updateTriggerCharacters() {
		if (this._triggerCharacterListener.clear(), this._editor.getOption(92) || !this._editor.hasModel() || !this._editor.getOption(122)) return;
		let e = /* @__PURE__ */ new Map();
		for (let O of this._languageFeaturesService.completionProvider.all(this._editor.getModel())) for (let k of O.triggerCharacters || []) {
			let A = e.get(k);
			if (!A) {
				A = /* @__PURE__ */ new Set();
				let O = getSnippetSuggestSupport();
				O && A.add(O), e.set(k, A);
			}
			A.add(O);
		}
		let O = (O) => {
			if (!canShowSuggestOnTriggerCharacters(this._editor, this._contextKeyService, this._configurationService) || LineContext$1.shouldAutoTrigger(this._editor)) return;
			if (!O) {
				let e = this._editor.getPosition();
				O = this._editor.getModel().getLineContent(e.lineNumber).substr(0, e.column - 1);
			}
			let k = "";
			isLowSurrogate(O.charCodeAt(O.length - 1)) ? isHighSurrogate(O.charCodeAt(O.length - 2)) && (k = O.substr(O.length - 2)) : k = O.charAt(O.length - 1);
			let A = e.get(k);
			if (A) {
				let e = /* @__PURE__ */ new Map();
				if (this._completionModel) for (let [O, k] of this._completionModel.getItemsByProvider()) A.has(O) || e.set(O, k);
				this.trigger({
					auto: !0,
					triggerKind: 1,
					triggerCharacter: k,
					retrigger: !!this._completionModel,
					clipboardText: this._completionModel?.clipboardText,
					completionOptions: {
						providerFilter: A,
						providerItemsToReuse: e
					}
				});
			}
		};
		this._triggerCharacterListener.add(this._editor.onDidType(O)), this._triggerCharacterListener.add(this._editor.onDidCompositionEnd(() => O()));
	}
	get state() {
		return this._triggerState ? this._triggerState.auto ? 2 : 1 : 0;
	}
	cancel(e = !1) {
		this._triggerState !== void 0 && (this._triggerQuickSuggest.cancel(), this._requestToken?.cancel(), this._requestToken = void 0, this._triggerState = void 0, this._completionModel = void 0, this._context = void 0, this._onDidCancel.fire({ retrigger: e }));
	}
	clear() {
		this._completionDisposables.clear();
	}
	_updateActiveSuggestSession() {
		this._triggerState !== void 0 && (!this._editor.hasModel() || !this._languageFeaturesService.completionProvider.has(this._editor.getModel()) ? this.cancel() : this.trigger({
			auto: this._triggerState.auto,
			retrigger: !0
		}));
	}
	_onCursorChange(e) {
		if (!this._editor.hasModel()) return;
		let O = this._currentSelection;
		if (this._currentSelection = this._editor.getSelection(), !e.selection.isEmpty() || e.reason !== 0 && e.reason !== 3 || e.source !== "keyboard" && e.source !== "deleteLeft") {
			this.cancel();
			return;
		}
		this._triggerState === void 0 && e.reason === 0 ? (O.containsRange(this._currentSelection) || O.getEndPosition().isBeforeOrEqual(this._currentSelection.getPosition())) && this._doTriggerQuickSuggest() : this._triggerState !== void 0 && e.reason === 3 && this._refilterCompletionItems();
	}
	_onCompositionEnd() {
		this._triggerState === void 0 ? this._doTriggerQuickSuggest() : this._refilterCompletionItems();
	}
	_doTriggerQuickSuggest() {
		QuickSuggestionsOptions.isAllOff(this._editor.getOption(90)) || this._editor.getOption(119).snippetsPreventQuickSuggestions && SnippetController2.get(this._editor)?.isInSnippet() || (this.cancel(), this._triggerQuickSuggest.cancelAndSet(() => {
			if (this._triggerState !== void 0 || !LineContext$1.shouldAutoTrigger(this._editor) || !this._editor.hasModel() || !this._editor.hasWidgetFocus()) return;
			let e = this._editor.getModel(), O = this._editor.getPosition(), k = this._editor.getOption(90);
			if (!QuickSuggestionsOptions.isAllOff(k)) {
				if (!QuickSuggestionsOptions.isAllOn(k)) {
					e.tokenization.tokenizeIfCheap(O.lineNumber);
					let A = e.tokenization.getLineTokens(O.lineNumber), j = A.getStandardTokenType(A.findTokenIndexAtOffset(Math.max(O.column - 1 - 1, 0)));
					if (QuickSuggestionsOptions.valueFor(k, j) !== "on") return;
				}
				canShowQuickSuggest(this._editor, this._contextKeyService, this._configurationService) && this._languageFeaturesService.completionProvider.has(e) && this.trigger({ auto: !0 });
			}
		}, this._editor.getOption(91)));
	}
	_refilterCompletionItems() {
		assertType(this._editor.hasModel()), assertType(this._triggerState !== void 0);
		let e = this._editor.getModel(), O = this._editor.getPosition(), k = new LineContext$1(e, O, {
			...this._triggerState,
			refilter: !0
		});
		this._onNewContext(k);
	}
	trigger(e) {
		if (!this._editor.hasModel()) return;
		let O = this._editor.getModel(), k = new LineContext$1(O, this._editor.getPosition(), e);
		this.cancel(e.retrigger), this._triggerState = e, this._onDidTrigger.fire({
			auto: e.auto,
			shy: e.shy ?? !1,
			position: this._editor.getPosition()
		}), this._context = k;
		let A = { triggerKind: e.triggerKind ?? 0 };
		e.triggerCharacter && (A = {
			triggerKind: 1,
			triggerCharacter: e.triggerCharacter
		}), this._requestToken = new CancellationTokenSource();
		let j = this._editor.getOption(113), M = 1;
		switch (j) {
			case "top":
				M = 0;
				break;
			case "bottom":
				M = 2;
				break;
		}
		let { itemKind: N, showDeprecated: P } = SuggestModel_1.createSuggestFilter(this._editor), F = new CompletionOptions(M, e.completionOptions?.kindFilter ?? N, e.completionOptions?.providerFilter, e.completionOptions?.providerItemsToReuse, P), I = WordDistance.create(this._editorWorkerService, this._editor), L = provideSuggestionItems(this._languageFeaturesService.completionProvider, O, this._editor.getPosition(), F, A, this._requestToken.token);
		Promise.all([L, I]).then(async ([O, k]) => {
			if (this._requestToken?.dispose(), !this._editor.hasModel()) return;
			let A = e?.clipboardText;
			if (!A && O.needsClipboard && (A = await this._clipboardService.readText()), this._triggerState === void 0) return;
			let j = this._editor.getModel(), M = new LineContext$1(j, this._editor.getPosition(), e), N = {
				...FuzzyScoreOptions.default,
				firstMatchCanBeWeak: !this._editor.getOption(119).matchOnWordStartOnly
			};
			if (this._completionModel = new CompletionModel(O.items, this._context.column, {
				leadingLineContent: M.leadingLineContent,
				characterCountDelta: M.column - this._context.column
			}, k, this._editor.getOption(119), this._editor.getOption(113), N, A), this._completionDisposables.add(O.disposable), this._onNewContext(M), this._reportDurationsTelemetry(O.durations), !this._envService.isBuilt || this._envService.isExtensionDevelopment) for (let e of O.items) e.isInvalid && this._logService.warn(`[suggest] did IGNORE invalid completion item from ${e.provider._debugDisplayName}`, e.completion);
		}).catch(onUnexpectedError);
	}
	_reportDurationsTelemetry(e) {
		this._telemetryGate++ % 230 == 0 && setTimeout(() => {
			this._telemetryService.publicLog2("suggest.durations.json", { data: JSON.stringify(e) }), this._logService.debug("suggest.durations.json", e);
		});
	}
	static createSuggestFilter(e) {
		let O = /* @__PURE__ */ new Set();
		e.getOption(113) === "none" && O.add(27);
		let k = e.getOption(119);
		return k.showMethods || O.add(0), k.showFunctions || O.add(1), k.showConstructors || O.add(2), k.showFields || O.add(3), k.showVariables || O.add(4), k.showClasses || O.add(5), k.showStructs || O.add(6), k.showInterfaces || O.add(7), k.showModules || O.add(8), k.showProperties || O.add(9), k.showEvents || O.add(10), k.showOperators || O.add(11), k.showUnits || O.add(12), k.showValues || O.add(13), k.showConstants || O.add(14), k.showEnums || O.add(15), k.showEnumMembers || O.add(16), k.showKeywords || O.add(17), k.showWords || O.add(18), k.showColors || O.add(19), k.showFiles || O.add(20), k.showReferences || O.add(21), k.showColors || O.add(22), k.showFolders || O.add(23), k.showTypeParameters || O.add(24), k.showSnippets || O.add(27), k.showUsers || O.add(25), k.showIssues || O.add(26), {
			itemKind: O,
			showDeprecated: k.showDeprecated
		};
	}
	_onNewContext(e) {
		if (this._context) {
			if (e.lineNumber !== this._context.lineNumber) {
				this.cancel();
				return;
			}
			if (getLeadingWhitespace(e.leadingLineContent) !== getLeadingWhitespace(this._context.leadingLineContent)) {
				this.cancel();
				return;
			}
			if (e.column < this._context.column) {
				e.leadingWord.word ? this.trigger({
					auto: this._context.triggerOptions.auto,
					retrigger: !0
				}) : this.cancel();
				return;
			}
			if (this._completionModel) {
				if (e.leadingWord.word.length !== 0 && e.leadingWord.startColumn > this._context.leadingWord.startColumn) {
					if (LineContext$1.shouldAutoTrigger(this._editor) && this._context) {
						let e = this._completionModel.getItemsByProvider();
						this.trigger({
							auto: this._context.triggerOptions.auto,
							retrigger: !0,
							clipboardText: this._completionModel.clipboardText,
							completionOptions: { providerItemsToReuse: e }
						});
					}
					return;
				}
				if (e.column > this._context.column && this._completionModel.getIncompleteProvider().size > 0 && e.leadingWord.word.length !== 0) {
					let e = /* @__PURE__ */ new Map(), O = /* @__PURE__ */ new Set();
					for (let [k, A] of this._completionModel.getItemsByProvider()) A.length > 0 && A[0].container.incomplete ? O.add(k) : e.set(k, A);
					this.trigger({
						auto: this._context.triggerOptions.auto,
						triggerKind: 2,
						retrigger: !0,
						clipboardText: this._completionModel.clipboardText,
						completionOptions: {
							providerFilter: O,
							providerItemsToReuse: e
						}
					});
				} else {
					let O = this._completionModel.lineContext, k = !1;
					if (this._completionModel.lineContext = {
						leadingLineContent: e.leadingLineContent,
						characterCountDelta: e.column - this._context.column
					}, this._completionModel.items.length === 0) {
						let A = LineContext$1.shouldAutoTrigger(this._editor);
						if (!this._context) {
							this.cancel();
							return;
						}
						if (A && this._context.leadingWord.endColumn < e.leadingWord.startColumn) {
							this.trigger({
								auto: this._context.triggerOptions.auto,
								retrigger: !0
							});
							return;
						}
						if (this._context.triggerOptions.auto) {
							this.cancel();
							return;
						} else if (this._completionModel.lineContext = O, k = this._completionModel.items.length > 0, k && e.leadingWord.word.length === 0) {
							this.cancel();
							return;
						}
					}
					this._onDidSuggest.fire({
						completionModel: this._completionModel,
						triggerOptions: e.triggerOptions,
						isFrozen: k
					});
				}
			}
		}
	}
};
SuggestModel = SuggestModel_1 = __decorate$55([
	__param$55(1, IEditorWorkerService),
	__param$55(2, IClipboardService),
	__param$55(3, ITelemetryService),
	__param$55(4, ILogService),
	__param$55(5, IContextKeyService),
	__param$55(6, IConfigurationService),
	__param$55(7, ILanguageFeaturesService),
	__param$55(8, IEnvironmentService)
], SuggestModel);
var OvertypingCapturer = class e {
	static {
		this._maxSelectionLength = 51200;
	}
	constructor(O, k) {
		this._disposables = new DisposableStore(), this._lastOvertyped = [], this._locked = !1, this._disposables.add(O.onWillType(() => {
			if (this._locked || !O.hasModel()) return;
			let k = O.getSelections(), A = k.length, j = !1;
			for (let e = 0; e < A; e++) if (!k[e].isEmpty()) {
				j = !0;
				break;
			}
			if (!j) {
				this._lastOvertyped.length !== 0 && (this._lastOvertyped.length = 0);
				return;
			}
			this._lastOvertyped = [];
			let M = O.getModel();
			for (let O = 0; O < A; O++) {
				let A = k[O];
				if (M.getValueLengthInRange(A) > e._maxSelectionLength) return;
				this._lastOvertyped[O] = {
					value: M.getValueInRange(A),
					multiline: A.startLineNumber !== A.endLineNumber
				};
			}
		})), this._disposables.add(k.onDidTrigger((e) => {
			this._locked = !0;
		})), this._disposables.add(k.onDidCancel((e) => {
			this._locked = !1;
		}));
	}
	getLastOvertypedInfo(e) {
		if (e >= 0 && e < this._lastOvertyped.length) return this._lastOvertyped[e];
	}
	dispose() {
		this._disposables.dispose();
	}
}, __decorate$54 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$54 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, SuggestWidgetStatus = class {
	constructor(e, O, k, A, j) {
		this._menuId = O, this._menuService = A, this._contextKeyService = j, this._menuDisposables = new DisposableStore(), this.element = append(e, $(".suggest-status-bar"));
		let M = ((e) => e instanceof MenuItemAction ? k.createInstance(TextOnlyMenuEntryActionViewItem, e, { useComma: !0 }) : void 0);
		this._leftActions = new ActionBar(this.element, { actionViewItemProvider: M }), this._rightActions = new ActionBar(this.element, { actionViewItemProvider: M }), this._leftActions.domNode.classList.add("left"), this._rightActions.domNode.classList.add("right");
	}
	dispose() {
		this._menuDisposables.dispose(), this._leftActions.dispose(), this._rightActions.dispose(), this.element.remove();
	}
	show() {
		let e = this._menuService.createMenu(this._menuId, this._contextKeyService), O = () => {
			let O = [], k = [];
			for (let [A, j] of e.getActions()) A === "left" ? O.push(...j) : k.push(...j);
			this._leftActions.clear(), this._leftActions.push(O), this._rightActions.clear(), this._rightActions.push(k);
		};
		this._menuDisposables.add(e.onDidChange(() => O())), this._menuDisposables.add(e);
	}
	hide() {
		this._menuDisposables.clear();
	}
};
SuggestWidgetStatus = __decorate$54([
	__param$54(2, IInstantiationService),
	__param$54(3, IMenuService),
	__param$54(4, IContextKeyService)
], SuggestWidgetStatus);
var __decorate$53 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$53 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
};
function canExpandCompletionItem(e) {
	return !!e && !!(e.completion.documentation || e.completion.detail && e.completion.detail !== e.completion.label);
}
var SuggestDetailsWidget = class {
	constructor(e, O) {
		this._editor = e, this._onDidClose = new Emitter(), this.onDidClose = this._onDidClose.event, this._onDidChangeContents = new Emitter(), this.onDidChangeContents = this._onDidChangeContents.event, this._disposables = new DisposableStore(), this._renderDisposeable = new DisposableStore(), this._borderWidth = 1, this._size = new Dimension(330, 0), this.domNode = $(".suggest-details"), this.domNode.classList.add("no-docs"), this._markdownRenderer = O.createInstance(MarkdownRenderer, { editor: e }), this._body = $(".body"), this._scrollbar = new DomScrollableElement(this._body, { alwaysConsumeMouseWheel: !0 }), append(this.domNode, this._scrollbar.getDomNode()), this._disposables.add(this._scrollbar), this._header = append(this._body, $(".header")), this._close = append(this._header, $("span" + ThemeIcon.asCSSSelector(Codicon.close))), this._close.title = localize("details.close", "Close"), this._type = append(this._header, $("p.type")), this._docs = append(this._body, $("p.docs")), this._configureFont(), this._disposables.add(this._editor.onDidChangeConfiguration((e) => {
			e.hasChanged(50) && this._configureFont();
		}));
	}
	dispose() {
		this._disposables.dispose(), this._renderDisposeable.dispose();
	}
	_configureFont() {
		let e = this._editor.getOptions(), O = e.get(50), k = O.getMassagedFontFamily(), A = e.get(120) || O.fontSize, j = e.get(121) || O.lineHeight, M = O.fontWeight, N = `${A}px`, P = `${j}px`;
		this.domNode.style.fontSize = N, this.domNode.style.lineHeight = `${j / A}`, this.domNode.style.fontWeight = M, this.domNode.style.fontFeatureSettings = O.fontFeatureSettings, this._type.style.fontFamily = k, this._close.style.height = P, this._close.style.width = P;
	}
	getLayoutInfo() {
		let e = this._editor.getOption(121) || this._editor.getOption(50).lineHeight, O = this._borderWidth, k = O * 2;
		return {
			lineHeight: e,
			borderWidth: O,
			borderHeight: k,
			verticalPadding: 22,
			horizontalPadding: 14
		};
	}
	renderLoading() {
		this._type.textContent = localize("loading", "Loading..."), this._docs.textContent = "", this.domNode.classList.remove("no-docs", "no-type"), this.layout(this.size.width, this.getLayoutInfo().lineHeight * 2), this._onDidChangeContents.fire(this);
	}
	renderItem(e, O) {
		this._renderDisposeable.clear();
		let { detail: k, documentation: A } = e.completion;
		if (O) {
			let O = "";
			O += `score: ${e.score[0]}\n`, O += `prefix: ${e.word ?? "(no prefix)"}\n`, O += `word: ${e.completion.filterText ? e.completion.filterText + " (filterText)" : e.textLabel}\n`, O += `distance: ${e.distance} (localityBonus-setting)\n`, O += `index: ${e.idx}, based on ${e.completion.sortText && `sortText: "${e.completion.sortText}"` || "label"}\n`, O += `commit_chars: ${e.completion.commitCharacters?.join("")}\n`, A = new MarkdownString().appendCodeblock("empty", O), k = `Provider: ${e.provider._debugDisplayName}`;
		}
		if (!O && !canExpandCompletionItem(e)) {
			this.clearContents();
			return;
		}
		if (this.domNode.classList.remove("no-docs", "no-type"), k) {
			let e = k.length > 1e5 ? `${k.substr(0, 1e5)}…` : k;
			this._type.textContent = e, this._type.title = e, show(this._type), this._type.classList.toggle("auto-wrap", !/\r?\n^\s+/gim.test(e));
		} else clearNode(this._type), this._type.title = "", hide(this._type), this.domNode.classList.add("no-type");
		if (clearNode(this._docs), typeof A == "string") this._docs.classList.remove("markdown-docs"), this._docs.textContent = A;
		else if (A) {
			this._docs.classList.add("markdown-docs"), clearNode(this._docs);
			let e = this._markdownRenderer.render(A);
			this._docs.appendChild(e.element), this._renderDisposeable.add(e), this._renderDisposeable.add(this._markdownRenderer.onDidRenderAsync(() => {
				this.layout(this._size.width, this._type.clientHeight + this._docs.clientHeight), this._onDidChangeContents.fire(this);
			}));
		}
		this.domNode.style.userSelect = "text", this.domNode.tabIndex = -1, this._close.onmousedown = (e) => {
			e.preventDefault(), e.stopPropagation();
		}, this._close.onclick = (e) => {
			e.preventDefault(), e.stopPropagation(), this._onDidClose.fire();
		}, this._body.scrollTop = 0, this.layout(this._size.width, this._type.clientHeight + this._docs.clientHeight), this._onDidChangeContents.fire(this);
	}
	clearContents() {
		this.domNode.classList.add("no-docs"), this._type.textContent = "", this._docs.textContent = "";
	}
	get isEmpty() {
		return this.domNode.classList.contains("no-docs");
	}
	get size() {
		return this._size;
	}
	layout(e, O) {
		let k = new Dimension(e, O);
		Dimension.equals(k, this._size) || (this._size = k, size(this.domNode, e, O)), this._scrollbar.scanDomNode();
	}
	scrollDown(e = 8) {
		this._body.scrollTop += e;
	}
	scrollUp(e = 8) {
		this._body.scrollTop -= e;
	}
	scrollTop() {
		this._body.scrollTop = 0;
	}
	scrollBottom() {
		this._body.scrollTop = this._body.scrollHeight;
	}
	pageDown() {
		this.scrollDown(80);
	}
	pageUp() {
		this.scrollUp(80);
	}
	set borderWidth(e) {
		this._borderWidth = e;
	}
	get borderWidth() {
		return this._borderWidth;
	}
};
SuggestDetailsWidget = __decorate$53([__param$53(1, IInstantiationService)], SuggestDetailsWidget);
var SuggestDetailsOverlay = class {
	constructor(e, O) {
		this.widget = e, this._editor = O, this.allowEditorOverflow = !0, this._disposables = new DisposableStore(), this._added = !1, this._preferAlignAtTop = !0, this._resizable = new ResizableHTMLElement(), this._resizable.domNode.classList.add("suggest-details-container"), this._resizable.domNode.appendChild(e.domNode), this._resizable.enableSashes(!1, !0, !0, !1);
		let k, A, j = 0, M = 0;
		this._disposables.add(this._resizable.onDidWillResize(() => {
			k = this._topLeft, A = this._resizable.size;
		})), this._disposables.add(this._resizable.onDidResize((e) => {
			if (k && A) {
				this.widget.layout(e.dimension.width, e.dimension.height);
				let O = !1;
				e.west && (M = A.width - e.dimension.width, O = !0), e.north && (j = A.height - e.dimension.height, O = !0), O && this._applyTopLeft({
					top: k.top + j,
					left: k.left + M
				});
			}
			e.done && (k = void 0, A = void 0, j = 0, M = 0, this._userSize = e.dimension);
		})), this._disposables.add(this.widget.onDidChangeContents(() => {
			this._anchorBox && this._placeAtAnchor(this._anchorBox, this._userSize ?? this.widget.size, this._preferAlignAtTop);
		}));
	}
	dispose() {
		this._resizable.dispose(), this._disposables.dispose(), this.hide();
	}
	getId() {
		return "suggest.details";
	}
	getDomNode() {
		return this._resizable.domNode;
	}
	getPosition() {
		return this._topLeft ? { preference: this._topLeft } : null;
	}
	show() {
		this._added ||= (this._editor.addOverlayWidget(this), !0);
	}
	hide(e = !1) {
		this._resizable.clearSashHoverState(), this._added && (this._editor.removeOverlayWidget(this), this._added = !1, this._anchorBox = void 0, this._topLeft = void 0), e && (this._userSize = void 0, this.widget.clearContents());
	}
	placeAtAnchor(e, O) {
		this._anchorBox = e.getBoundingClientRect(), this._preferAlignAtTop = O, this._placeAtAnchor(this._anchorBox, this._userSize ?? this.widget.size, O);
	}
	_placeAtAnchor(e, O, k) {
		let A = getClientArea(this.getDomNode().ownerDocument.body), j = this.widget.getLayoutInfo(), M = new Dimension(220, 2 * j.lineHeight), N = e.top, P = (function() {
			let k = A.width - (e.left + e.width + j.borderWidth + j.horizontalPadding), P = -j.borderWidth + e.left + e.width, F = new Dimension(k, A.height - e.top - j.borderHeight - j.verticalPadding), I = F.with(void 0, e.top + e.height - j.borderHeight - j.verticalPadding);
			return {
				top: N,
				left: P,
				fit: k - O.width,
				maxSizeTop: F,
				maxSizeBottom: I,
				minSize: M.with(Math.min(k, M.width))
			};
		})(), F = (function() {
			let k = e.left - j.borderWidth - j.horizontalPadding, P = Math.max(j.horizontalPadding, e.left - O.width - j.borderWidth), F = new Dimension(k, A.height - e.top - j.borderHeight - j.verticalPadding), I = F.with(void 0, e.top + e.height - j.borderHeight - j.verticalPadding);
			return {
				top: N,
				left: P,
				fit: k - O.width,
				maxSizeTop: F,
				maxSizeBottom: I,
				minSize: M.with(Math.min(k, M.width))
			};
		})(), I = (function() {
			let k = e.left, N = -j.borderWidth + e.top + e.height, P = new Dimension(e.width - j.borderHeight, A.height - e.top - e.height - j.verticalPadding);
			return {
				top: N,
				left: k,
				fit: P.height - O.height,
				maxSizeBottom: P,
				maxSizeTop: P,
				minSize: M.with(P.width)
			};
		})(), L = [
			P,
			F,
			I
		], R = L.find((e) => e.fit >= 0) ?? L.sort((e, O) => O.fit - e.fit)[0], z = e.top + e.height - j.borderHeight, B, V = O.height, H = Math.max(R.maxSizeTop.height, R.maxSizeBottom.height);
		V > H && (V = H);
		let U;
		k ? V <= R.maxSizeTop.height ? (B = !0, U = R.maxSizeTop) : (B = !1, U = R.maxSizeBottom) : V <= R.maxSizeBottom.height ? (B = !1, U = R.maxSizeBottom) : (B = !0, U = R.maxSizeTop);
		let { top: W, left: G } = R;
		!B && V > e.height && (W = z - V);
		let K = this._editor.getDomNode();
		if (K) {
			let e = K.getBoundingClientRect();
			W -= e.top, G -= e.left;
		}
		this._applyTopLeft({
			left: G,
			top: W
		}), this._resizable.enableSashes(!B, R === P, B, R !== P), this._resizable.minSize = R.minSize, this._resizable.maxSize = U, this._resizable.layout(V, Math.min(U.width, O.width)), this.widget.layout(this._resizable.size.width, this._resizable.size.height);
	}
	_applyTopLeft(e) {
		this._topLeft = e, this._editor.layoutOverlayWidget(this);
	}
}, FileKind;
(function(e) {
	e[e.FILE = 0] = "FILE", e[e.FOLDER = 1] = "FOLDER", e[e.ROOT_FOLDER = 2] = "ROOT_FOLDER";
})(FileKind ||= {});
var fileIconDirectoryRegex = /(?:\/|^)(?:([^\/]+)\/)?([^\/]+)$/;
function getIconClasses(e, O, k, A, j) {
	if (ThemeIcon.isThemeIcon(j)) return [`codicon-${j.id}`, "predefined-file-icon"];
	if (URI.isUri(j)) return [];
	let M = A === FileKind.ROOT_FOLDER ? ["rootfolder-icon"] : A === FileKind.FOLDER ? ["folder-icon"] : ["file-icon"];
	if (k) {
		let j;
		if (k.scheme === Schemas.data) j = DataUri.parseMetaData(k).get(DataUri.META_DATA_LABEL);
		else {
			let e = k.path.match(fileIconDirectoryRegex);
			e ? (j = cssEscape(e[2].toLowerCase()), e[1] && M.push(`${cssEscape(e[1].toLowerCase())}-name-dir-icon`)) : j = cssEscape(k.authority.toLowerCase());
		}
		if (A === FileKind.ROOT_FOLDER) M.push(`${j}-root-name-folder-icon`);
		else if (A === FileKind.FOLDER) M.push(`${j}-name-folder-icon`);
		else {
			if (j) {
				if (M.push(`${j}-name-file-icon`), M.push("name-file-icon"), j.length <= 255) {
					let e = j.split(".");
					for (let O = 1; O < e.length; O++) M.push(`${e.slice(O).join(".")}-ext-file-icon`);
				}
				M.push("ext-file-icon");
			}
			let A = detectLanguageId(e, O, k);
			A && M.push(`${cssEscape(A)}-lang-file-icon`);
		}
	}
	return M;
}
function detectLanguageId(e, O, k) {
	if (!k) return null;
	let A = null;
	if (k.scheme === Schemas.data) {
		let e = DataUri.parseMetaData(k).get(DataUri.META_DATA_MIME);
		e && (A = O.getLanguageIdByMimeType(e));
	} else {
		let O = e.getModel(k);
		O && (A = O.getLanguageId());
	}
	return A && A !== "plaintext" ? A : O.guessLanguageIdByFilepathOrFirstLine(k);
}
function cssEscape(e) {
	return e.replace(/[\s]/g, "/");
}
var __decorate$52 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$52 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
};
function getAriaId(e) {
	return `suggest-aria-id:${e}`;
}
var suggestMoreInfoIcon = registerIcon("suggest-more-info", Codicon.chevronRight, localize("suggestMoreInfoIcon", "Icon for more information in the suggest widget.")), _completionItemColor = new class e {
	static {
		this._regexRelaxed = /(#([\da-fA-F]{3}){1,2}|(rgb|hsl)a\(\s*(\d{1,3}%?\s*,\s*){3}(1|0?\.\d+)\)|(rgb|hsl)\(\s*\d{1,3}%?(\s*,\s*\d{1,3}%?){2}\s*\))/;
	}
	static {
		this._regexStrict = RegExp(`^${e._regexRelaxed.source}$`, "i");
	}
	extract(O, k) {
		if (O.textLabel.match(e._regexStrict)) return k[0] = O.textLabel, !0;
		if (O.completion.detail && O.completion.detail.match(e._regexStrict)) return k[0] = O.completion.detail, !0;
		if (O.completion.documentation) {
			let A = typeof O.completion.documentation == "string" ? O.completion.documentation : O.completion.documentation.value, j = e._regexRelaxed.exec(A);
			if (j && (j.index === 0 || j.index + j[0].length === A.length)) return k[0] = j[0], !0;
		}
		return !1;
	}
}(), ItemRenderer = class {
	constructor(e, O, k, A) {
		this._editor = e, this._modelService = O, this._languageService = k, this._themeService = A, this._onDidToggleDetails = new Emitter(), this.onDidToggleDetails = this._onDidToggleDetails.event, this.templateId = "suggestion";
	}
	dispose() {
		this._onDidToggleDetails.dispose();
	}
	renderTemplate(e) {
		let O = new DisposableStore(), k = e;
		k.classList.add("show-file-icons");
		let A = append(e, $(".icon")), j = append(A, $("span.colorspan")), M = append(e, $(".contents")), N = append(M, $(".main")), P = append(N, $(".icon-label.codicon")), F = append(N, $("span.left")), I = append(N, $("span.right")), L = new IconLabel(F, {
			supportHighlights: !0,
			supportIcons: !0
		});
		O.add(L);
		let R = append(F, $("span.signature-label")), z = append(F, $("span.qualifier-label")), B = append(I, $("span.details-label")), V = append(I, $("span.readMore" + ThemeIcon.asCSSSelector(suggestMoreInfoIcon)));
		return V.title = localize("readMore", "Read More"), {
			root: k,
			left: F,
			right: I,
			icon: A,
			colorspan: j,
			iconLabel: L,
			iconContainer: P,
			parametersLabel: R,
			qualifierLabel: z,
			detailsLabel: B,
			readMore: V,
			disposables: O,
			configureFont: () => {
				let e = this._editor.getOptions(), O = e.get(50), j = O.getMassagedFontFamily(), M = O.fontFeatureSettings, P = e.get(120) || O.fontSize, F = e.get(121) || O.lineHeight, I = O.fontWeight, L = O.letterSpacing, R = `${P}px`, z = `${F}px`, B = `${L}px`;
				k.style.fontSize = R, k.style.fontWeight = I, k.style.letterSpacing = B, N.style.fontFamily = j, N.style.fontFeatureSettings = M, N.style.lineHeight = z, A.style.height = z, A.style.width = z, V.style.height = z, V.style.width = z;
			}
		};
	}
	renderElement(e, O, k) {
		k.configureFont();
		let { completion: A } = e;
		k.root.id = getAriaId(O), k.colorspan.style.backgroundColor = "";
		let j = {
			labelEscapeNewLines: !0,
			matches: createMatches(e.score)
		}, M = [];
		if (A.kind === 19 && _completionItemColor.extract(e, M)) k.icon.className = "icon customcolor", k.iconContainer.className = "icon hide", k.colorspan.style.backgroundColor = M[0];
		else if (A.kind === 20 && this._themeService.getFileIconTheme().hasFileIcons) {
			k.icon.className = "icon hide", k.iconContainer.className = "icon hide";
			let O = getIconClasses(this._modelService, this._languageService, URI.from({
				scheme: "fake",
				path: e.textLabel
			}), FileKind.FILE), M = getIconClasses(this._modelService, this._languageService, URI.from({
				scheme: "fake",
				path: A.detail
			}), FileKind.FILE);
			j.extraClasses = O.length > M.length ? O : M;
		} else A.kind === 23 && this._themeService.getFileIconTheme().hasFolderIcons ? (k.icon.className = "icon hide", k.iconContainer.className = "icon hide", j.extraClasses = [getIconClasses(this._modelService, this._languageService, URI.from({
			scheme: "fake",
			path: e.textLabel
		}), FileKind.FOLDER), getIconClasses(this._modelService, this._languageService, URI.from({
			scheme: "fake",
			path: A.detail
		}), FileKind.FOLDER)].flat()) : (k.icon.className = "icon hide", k.iconContainer.className = "", k.iconContainer.classList.add("suggest-icon", ...ThemeIcon.asClassNameArray(CompletionItemKinds.toIcon(A.kind))));
		A.tags && A.tags.indexOf(1) >= 0 && (j.extraClasses = (j.extraClasses || []).concat(["deprecated"]), j.matches = []), k.iconLabel.setLabel(e.textLabel, void 0, j), typeof A.label == "string" ? (k.parametersLabel.textContent = "", k.detailsLabel.textContent = stripNewLines(A.detail || ""), k.root.classList.add("string-label")) : (k.parametersLabel.textContent = stripNewLines(A.label.detail || ""), k.detailsLabel.textContent = stripNewLines(A.label.description || ""), k.root.classList.remove("string-label")), this._editor.getOption(119).showInlineDetails ? show(k.detailsLabel) : hide(k.detailsLabel), canExpandCompletionItem(e) ? (k.right.classList.add("can-expand-details"), show(k.readMore), k.readMore.onmousedown = (e) => {
			e.stopPropagation(), e.preventDefault();
		}, k.readMore.onclick = (e) => {
			e.stopPropagation(), e.preventDefault(), this._onDidToggleDetails.fire();
		}) : (k.right.classList.remove("can-expand-details"), hide(k.readMore), k.readMore.onmousedown = null, k.readMore.onclick = null);
	}
	disposeTemplate(e) {
		e.disposables.dispose();
	}
};
ItemRenderer = __decorate$52([
	__param$52(1, IModelService),
	__param$52(2, ILanguageService),
	__param$52(3, IThemeService)
], ItemRenderer);
function stripNewLines(e) {
	return e.replace(/\r\n|\r|\n/g, "");
}
var __decorate$51 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$51 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, SuggestWidget_1;
registerColor("editorSuggestWidget.background", editorWidgetBackground, localize("editorSuggestWidgetBackground", "Background color of the suggest widget.")), registerColor("editorSuggestWidget.border", editorWidgetBorder, localize("editorSuggestWidgetBorder", "Border color of the suggest widget."));
var editorSuggestWidgetForeground = registerColor("editorSuggestWidget.foreground", editorForeground, localize("editorSuggestWidgetForeground", "Foreground color of the suggest widget."));
registerColor("editorSuggestWidget.selectedForeground", quickInputListFocusForeground, localize("editorSuggestWidgetSelectedForeground", "Foreground color of the selected entry in the suggest widget.")), registerColor("editorSuggestWidget.selectedIconForeground", quickInputListFocusIconForeground, localize("editorSuggestWidgetSelectedIconForeground", "Icon foreground color of the selected entry in the suggest widget."));
const editorSuggestWidgetSelectedBackground = registerColor("editorSuggestWidget.selectedBackground", quickInputListFocusBackground, localize("editorSuggestWidgetSelectedBackground", "Background color of the selected entry in the suggest widget."));
registerColor("editorSuggestWidget.highlightForeground", listHighlightForeground, localize("editorSuggestWidgetHighlightForeground", "Color of the match highlights in the suggest widget.")), registerColor("editorSuggestWidget.focusHighlightForeground", listFocusHighlightForeground, localize("editorSuggestWidgetFocusHighlightForeground", "Color of the match highlights in the suggest widget when an item is focused.")), registerColor("editorSuggestWidgetStatus.foreground", transparent(editorSuggestWidgetForeground, .5), localize("editorSuggestWidgetStatusForeground", "Foreground color of the suggest widget status."));
var PersistedWidgetSize = class {
	constructor(e, O) {
		this._service = e, this._key = `suggestWidget.size/${O.getEditorType()}/${O instanceof EmbeddedCodeEditorWidget}`;
	}
	restore() {
		let e = this._service.get(this._key, 0) ?? "";
		try {
			let O = JSON.parse(e);
			if (Dimension.is(O)) return Dimension.lift(O);
		} catch {}
	}
	store(e) {
		this._service.store(this._key, JSON.stringify(e), 0, 1);
	}
	reset() {
		this._service.remove(this._key, 0);
	}
}, SuggestWidget = class {
	static {
		SuggestWidget_1 = this;
	}
	static {
		this.LOADING_MESSAGE = localize("suggestWidget.loading", "Loading...");
	}
	static {
		this.NO_SUGGESTIONS_MESSAGE = localize("suggestWidget.noSuggestions", "No suggestions.");
	}
	constructor(e, O, k, A, j) {
		this.editor = e, this._storageService = O, this._state = 0, this._isAuto = !1, this._pendingLayout = new MutableDisposable(), this._pendingShowDetails = new MutableDisposable(), this._ignoreFocusEvents = !1, this._forceRenderingAbove = !1, this._explainMode = !1, this._showTimeout = new TimeoutTimer(), this._disposables = new DisposableStore(), this._onDidSelect = new PauseableEmitter(), this._onDidFocus = new PauseableEmitter(), this._onDidHide = new Emitter(), this._onDidShow = new Emitter(), this.onDidSelect = this._onDidSelect.event, this.onDidFocus = this._onDidFocus.event, this.onDidHide = this._onDidHide.event, this.onDidShow = this._onDidShow.event, this._onDetailsKeydown = new Emitter(), this.onDetailsKeyDown = this._onDetailsKeydown.event, this.element = new ResizableHTMLElement(), this.element.domNode.classList.add("editor-widget", "suggest-widget"), this._contentWidget = new SuggestContentWidget(this, e), this._persistedSize = new PersistedWidgetSize(O, e);
		class M {
			constructor(e, O, k = !1, A = !1) {
				this.persistedSize = e, this.currentSize = O, this.persistHeight = k, this.persistWidth = A;
			}
		}
		let N;
		this._disposables.add(this.element.onDidWillResize(() => {
			this._contentWidget.lockPreference(), N = new M(this._persistedSize.restore(), this.element.size);
		})), this._disposables.add(this.element.onDidResize((e) => {
			if (this._resize(e.dimension.width, e.dimension.height), N && (N.persistHeight = N.persistHeight || !!e.north || !!e.south, N.persistWidth = N.persistWidth || !!e.east || !!e.west), e.done) {
				if (N) {
					let { itemHeight: e, defaultSize: O } = this.getLayoutInfo(), k = Math.round(e / 2), { width: A, height: j } = this.element.size;
					(!N.persistHeight || Math.abs(N.currentSize.height - j) <= k) && (j = N.persistedSize?.height ?? O.height), (!N.persistWidth || Math.abs(N.currentSize.width - A) <= k) && (A = N.persistedSize?.width ?? O.width), this._persistedSize.store(new Dimension(A, j));
				}
				this._contentWidget.unlockPreference(), N = void 0;
			}
		})), this._messageElement = append(this.element.domNode, $(".message")), this._listElement = append(this.element.domNode, $(".tree"));
		let P = this._disposables.add(j.createInstance(SuggestDetailsWidget, this.editor));
		P.onDidClose(this.toggleDetails, this, this._disposables), this._details = new SuggestDetailsOverlay(P, this.editor);
		let F = () => this.element.domNode.classList.toggle("no-icons", !this.editor.getOption(119).showIcons);
		F();
		let I = j.createInstance(ItemRenderer, this.editor);
		this._disposables.add(I), this._disposables.add(I.onDidToggleDetails(() => this.toggleDetails())), this._list = new List("SuggestWidget", this._listElement, {
			getHeight: (e) => this.getLayoutInfo().itemHeight,
			getTemplateId: (e) => "suggestion"
		}, [I], {
			alwaysConsumeMouseWheel: !0,
			useShadows: !1,
			mouseSupport: !1,
			multipleSelectionSupport: !1,
			accessibilityProvider: {
				getRole: () => "option",
				getWidgetAriaLabel: () => localize("suggest", "Suggest"),
				getWidgetRole: () => "listbox",
				getAriaLabel: (e) => {
					let O = e.textLabel;
					if (typeof e.completion.label != "string") {
						let { detail: k, description: A } = e.completion.label;
						k && A ? O = localize("label.full", "{0} {1}, {2}", O, k, A) : k ? O = localize("label.detail", "{0} {1}", O, k) : A && (O = localize("label.desc", "{0}, {1}", O, A));
					}
					if (!e.isResolved || !this._isDetailsVisible()) return O;
					let { documentation: k, detail: A } = e.completion, j = format("{0}{1}", A || "", k ? typeof k == "string" ? k : k.value : "");
					return localize("ariaCurrenttSuggestionReadDetails", "{0}, docs: {1}", O, j);
				}
			}
		}), this._list.style(getListStyles({
			listInactiveFocusBackground: editorSuggestWidgetSelectedBackground,
			listInactiveFocusOutline: activeContrastBorder
		})), this._status = j.createInstance(SuggestWidgetStatus, this.element.domNode, suggestWidgetStatusbarMenu);
		let L = () => this.element.domNode.classList.toggle("with-status-bar", this.editor.getOption(119).showStatusBar);
		L(), this._disposables.add(A.onDidColorThemeChange((e) => this._onThemeChange(e))), this._onThemeChange(A.getColorTheme()), this._disposables.add(this._list.onMouseDown((e) => this._onListMouseDownOrTap(e))), this._disposables.add(this._list.onTap((e) => this._onListMouseDownOrTap(e))), this._disposables.add(this._list.onDidChangeSelection((e) => this._onListSelection(e))), this._disposables.add(this._list.onDidChangeFocus((e) => this._onListFocus(e))), this._disposables.add(this.editor.onDidChangeCursorSelection(() => this._onCursorSelectionChanged())), this._disposables.add(this.editor.onDidChangeConfiguration((e) => {
			e.hasChanged(119) && (L(), F()), this._completionModel && (e.hasChanged(50) || e.hasChanged(120) || e.hasChanged(121)) && this._list.splice(0, this._list.length, this._completionModel.items);
		})), this._ctxSuggestWidgetVisible = Context$1.Visible.bindTo(k), this._ctxSuggestWidgetDetailsVisible = Context$1.DetailsVisible.bindTo(k), this._ctxSuggestWidgetMultipleSuggestions = Context$1.MultipleSuggestions.bindTo(k), this._ctxSuggestWidgetHasFocusedSuggestion = Context$1.HasFocusedSuggestion.bindTo(k), this._disposables.add(addStandardDisposableListener(this._details.widget.domNode, "keydown", (e) => {
			this._onDetailsKeydown.fire(e);
		})), this._disposables.add(this.editor.onMouseDown((e) => this._onEditorMouseDown(e)));
	}
	dispose() {
		this._details.widget.dispose(), this._details.dispose(), this._list.dispose(), this._status.dispose(), this._disposables.dispose(), this._loadingTimeout?.dispose(), this._pendingLayout.dispose(), this._pendingShowDetails.dispose(), this._showTimeout.dispose(), this._contentWidget.dispose(), this.element.dispose();
	}
	_onEditorMouseDown(e) {
		this._details.widget.domNode.contains(e.target.element) ? this._details.widget.domNode.focus() : this.element.domNode.contains(e.target.element) && this.editor.focus();
	}
	_onCursorSelectionChanged() {
		this._state !== 0 && this._contentWidget.layout();
	}
	_onListMouseDownOrTap(e) {
		e.element === void 0 || e.index === void 0 || (e.browserEvent.preventDefault(), e.browserEvent.stopPropagation(), this._select(e.element, e.index));
	}
	_onListSelection(e) {
		e.elements.length && this._select(e.elements[0], e.indexes[0]);
	}
	_select(e, O) {
		let k = this._completionModel;
		k && (this._onDidSelect.fire({
			item: e,
			index: O,
			model: k
		}), this.editor.focus());
	}
	_onThemeChange(e) {
		this._details.widget.borderWidth = isHighContrast(e.type) ? 2 : 1;
	}
	_onListFocus(e) {
		if (this._ignoreFocusEvents) return;
		if (!e.elements.length) {
			this._currentSuggestionDetails && (this._currentSuggestionDetails.cancel(), this._currentSuggestionDetails = void 0, this._focusedItem = void 0), this.editor.setAriaOptions({ activeDescendant: void 0 }), this._ctxSuggestWidgetHasFocusedSuggestion.set(!1);
			return;
		}
		if (!this._completionModel) return;
		this._ctxSuggestWidgetHasFocusedSuggestion.set(!0);
		let O = e.elements[0], k = e.indexes[0];
		O !== this._focusedItem && (this._currentSuggestionDetails?.cancel(), this._currentSuggestionDetails = void 0, this._focusedItem = O, this._list.reveal(k), this._currentSuggestionDetails = createCancelablePromise(async (e) => {
			let k = disposableTimeout(() => {
				this._isDetailsVisible() && this.showDetails(!0);
			}, 250), A = e.onCancellationRequested(() => k.dispose());
			try {
				return await O.resolve(e);
			} finally {
				k.dispose(), A.dispose();
			}
		}), this._currentSuggestionDetails.then(() => {
			k >= this._list.length || O !== this._list.element(k) || (this._ignoreFocusEvents = !0, this._list.splice(k, 1, [O]), this._list.setFocus([k]), this._ignoreFocusEvents = !1, this._isDetailsVisible() ? this.showDetails(!1) : this.element.domNode.classList.remove("docs-side"), this.editor.setAriaOptions({ activeDescendant: getAriaId(k) }));
		}).catch(onUnexpectedError)), this._onDidFocus.fire({
			item: O,
			index: k,
			model: this._completionModel
		});
	}
	_setState(e) {
		if (this._state !== e) switch (this._state = e, this.element.domNode.classList.toggle("frozen", e === 4), this.element.domNode.classList.remove("message"), e) {
			case 0:
				hide(this._messageElement, this._listElement, this._status.element), this._details.hide(!0), this._status.hide(), this._contentWidget.hide(), this._ctxSuggestWidgetVisible.reset(), this._ctxSuggestWidgetMultipleSuggestions.reset(), this._ctxSuggestWidgetHasFocusedSuggestion.reset(), this._showTimeout.cancel(), this.element.domNode.classList.remove("visible"), this._list.splice(0, this._list.length), this._focusedItem = void 0, this._cappedHeight = void 0, this._explainMode = !1;
				break;
			case 1:
				this.element.domNode.classList.add("message"), this._messageElement.textContent = SuggestWidget_1.LOADING_MESSAGE, hide(this._listElement, this._status.element), show(this._messageElement), this._details.hide(), this._show(), this._focusedItem = void 0, status(SuggestWidget_1.LOADING_MESSAGE);
				break;
			case 2:
				this.element.domNode.classList.add("message"), this._messageElement.textContent = SuggestWidget_1.NO_SUGGESTIONS_MESSAGE, hide(this._listElement, this._status.element), show(this._messageElement), this._details.hide(), this._show(), this._focusedItem = void 0, status(SuggestWidget_1.NO_SUGGESTIONS_MESSAGE);
				break;
			case 3:
				hide(this._messageElement), show(this._listElement, this._status.element), this._show();
				break;
			case 4:
				hide(this._messageElement), show(this._listElement, this._status.element), this._show();
				break;
			case 5:
				hide(this._messageElement), show(this._listElement, this._status.element), this._details.show(), this._show();
				break;
		}
	}
	_show() {
		this._status.show(), this._contentWidget.show(), this._layout(this._persistedSize.restore()), this._ctxSuggestWidgetVisible.set(!0), this._showTimeout.cancelAndSet(() => {
			this.element.domNode.classList.add("visible"), this._onDidShow.fire(this);
		}, 100);
	}
	showTriggered(e, O) {
		this._state === 0 && (this._contentWidget.setPosition(this.editor.getPosition()), this._isAuto = !!e, this._isAuto || (this._loadingTimeout = disposableTimeout(() => this._setState(1), O)));
	}
	showSuggestions(e, O, k, A, j) {
		if (this._contentWidget.setPosition(this.editor.getPosition()), this._loadingTimeout?.dispose(), this._currentSuggestionDetails?.cancel(), this._currentSuggestionDetails = void 0, this._completionModel !== e && (this._completionModel = e), k && this._state !== 2 && this._state !== 0) {
			this._setState(4);
			return;
		}
		let M = this._completionModel.items.length, N = M === 0;
		if (this._ctxSuggestWidgetMultipleSuggestions.set(M > 1), N) {
			this._setState(A ? 0 : 2), this._completionModel = void 0;
			return;
		}
		this._focusedItem = void 0, this._onDidFocus.pause(), this._onDidSelect.pause();
		try {
			this._list.splice(0, this._list.length, this._completionModel.items), this._setState(k ? 4 : 3), this._list.reveal(O, 0), this._list.setFocus(j ? [] : [O]);
		} finally {
			this._onDidFocus.resume(), this._onDidSelect.resume();
		}
		this._pendingLayout.value = runAtThisOrScheduleAtNextAnimationFrame(getWindow(this.element.domNode), () => {
			this._pendingLayout.clear(), this._layout(this.element.size), this._details.widget.domNode.classList.remove("focused");
		});
	}
	focusSelected() {
		this._list.length > 0 && this._list.setFocus([0]);
	}
	selectNextPage() {
		switch (this._state) {
			case 0: return !1;
			case 5: return this._details.widget.pageDown(), !0;
			case 1: return !this._isAuto;
			default: return this._list.focusNextPage(), !0;
		}
	}
	selectNext() {
		switch (this._state) {
			case 0: return !1;
			case 1: return !this._isAuto;
			default: return this._list.focusNext(1, !0), !0;
		}
	}
	selectLast() {
		switch (this._state) {
			case 0: return !1;
			case 5: return this._details.widget.scrollBottom(), !0;
			case 1: return !this._isAuto;
			default: return this._list.focusLast(), !0;
		}
	}
	selectPreviousPage() {
		switch (this._state) {
			case 0: return !1;
			case 5: return this._details.widget.pageUp(), !0;
			case 1: return !this._isAuto;
			default: return this._list.focusPreviousPage(), !0;
		}
	}
	selectPrevious() {
		switch (this._state) {
			case 0: return !1;
			case 1: return !this._isAuto;
			default: return this._list.focusPrevious(1, !0), !1;
		}
	}
	selectFirst() {
		switch (this._state) {
			case 0: return !1;
			case 5: return this._details.widget.scrollTop(), !0;
			case 1: return !this._isAuto;
			default: return this._list.focusFirst(), !0;
		}
	}
	getFocusedItem() {
		if (this._state !== 0 && this._state !== 2 && this._state !== 1 && this._completionModel && this._list.getFocus().length > 0) return {
			item: this._list.getFocusedElements()[0],
			index: this._list.getFocus()[0],
			model: this._completionModel
		};
	}
	toggleDetailsFocus() {
		this._state === 5 ? (this._setState(3), this._details.widget.domNode.classList.remove("focused")) : this._state === 3 && this._isDetailsVisible() && (this._setState(5), this._details.widget.domNode.classList.add("focused"));
	}
	toggleDetails() {
		this._isDetailsVisible() ? (this._pendingShowDetails.clear(), this._ctxSuggestWidgetDetailsVisible.set(!1), this._setDetailsVisible(!1), this._details.hide(), this.element.domNode.classList.remove("shows-details")) : (canExpandCompletionItem(this._list.getFocusedElements()[0]) || this._explainMode) && (this._state === 3 || this._state === 5 || this._state === 4) && (this._ctxSuggestWidgetDetailsVisible.set(!0), this._setDetailsVisible(!0), this.showDetails(!1));
	}
	showDetails(e) {
		this._pendingShowDetails.value = runAtThisOrScheduleAtNextAnimationFrame(getWindow(this.element.domNode), () => {
			this._pendingShowDetails.clear(), this._details.show(), e ? this._details.widget.renderLoading() : this._details.widget.renderItem(this._list.getFocusedElements()[0], this._explainMode), this._details.widget.isEmpty ? this._details.hide() : (this._positionDetails(), this.element.domNode.classList.add("shows-details")), this.editor.focus();
		});
	}
	toggleExplainMode() {
		this._list.getFocusedElements()[0] && (this._explainMode = !this._explainMode, this._isDetailsVisible() ? this.showDetails(!1) : this.toggleDetails());
	}
	resetPersistedSize() {
		this._persistedSize.reset();
	}
	hideWidget() {
		this._pendingLayout.clear(), this._pendingShowDetails.clear(), this._loadingTimeout?.dispose(), this._setState(0), this._onDidHide.fire(this), this.element.clearSashHoverState();
		let e = this._persistedSize.restore(), O = Math.ceil(this.getLayoutInfo().itemHeight * 4.3);
		e && e.height < O && this._persistedSize.store(e.with(void 0, O));
	}
	isFrozen() {
		return this._state === 4;
	}
	_afterRender(e) {
		if (e === null) {
			this._isDetailsVisible() && this._details.hide();
			return;
		}
		this._state === 2 || this._state === 1 || (this._isDetailsVisible() && !this._details.widget.isEmpty && this._details.show(), this._positionDetails());
	}
	_layout(e) {
		if (!this.editor.hasModel() || !this.editor.getDomNode()) return;
		let O = getClientArea(this.element.domNode.ownerDocument.body), k = this.getLayoutInfo();
		e ||= k.defaultSize;
		let A = e.height, j = e.width;
		if (this._status.element.style.height = `${k.itemHeight}px`, this._state === 2 || this._state === 1) A = k.itemHeight + k.borderHeight, j = k.defaultSize.width / 2, this.element.enableSashes(!1, !1, !1, !1), this.element.minSize = this.element.maxSize = new Dimension(j, A), this._contentWidget.setPreference(2);
		else {
			let M = O.width - k.borderHeight - 2 * k.horizontalPadding;
			j > M && (j = M);
			let N = this._completionModel ? this._completionModel.stats.pLabelLen * k.typicalHalfwidthCharacterWidth : j, P = k.statusBarHeight + this._list.contentHeight + k.borderHeight, I = k.itemHeight + k.statusBarHeight, L = getDomNodePagePosition(this.editor.getDomNode()), R = this.editor.getScrolledVisiblePosition(this.editor.getPosition()), z = L.top + R.top + R.height, B = Math.min(O.height - z - k.verticalPadding, P), V = L.top + R.top - k.verticalPadding, H = Math.min(V, P), U = Math.min(Math.max(H, B) + k.borderHeight, P);
			A === this._cappedHeight?.capped && (A = this._cappedHeight.wanted), A < I && (A = I), A > U && (A = U), A > B || this._forceRenderingAbove && V > 150 ? (this._contentWidget.setPreference(1), this.element.enableSashes(!0, !0, !1, !1), U = H) : (this._contentWidget.setPreference(2), this.element.enableSashes(!1, !0, !0, !1), U = B), this.element.preferredSize = new Dimension(N, k.defaultSize.height), this.element.maxSize = new Dimension(M, U), this.element.minSize = new Dimension(220, I), this._cappedHeight = A === P ? {
				wanted: this._cappedHeight?.wanted ?? e.height,
				capped: A
			} : void 0;
		}
		this._resize(j, A);
	}
	_resize(e, O) {
		let { width: k, height: A } = this.element.maxSize;
		e = Math.min(k, e), O = Math.min(A, O);
		let { statusBarHeight: j } = this.getLayoutInfo();
		this._list.layout(O - j, e), this._listElement.style.height = `${O - j}px`, this.element.layout(O, e), this._contentWidget.layout(), this._positionDetails();
	}
	_positionDetails() {
		this._isDetailsVisible() && this._details.placeAtAnchor(this.element.domNode, this._contentWidget.getPosition()?.preference[0] === 2);
	}
	getLayoutInfo() {
		let e = this.editor.getOption(50), O = clamp(this.editor.getOption(121) || e.lineHeight, 8, 1e3), k = !this.editor.getOption(119).showStatusBar || this._state === 2 || this._state === 1 ? 0 : O, A = this._details.widget.borderWidth, j = 2 * A;
		return {
			itemHeight: O,
			statusBarHeight: k,
			borderWidth: A,
			borderHeight: j,
			typicalHalfwidthCharacterWidth: e.typicalHalfwidthCharacterWidth,
			verticalPadding: 22,
			horizontalPadding: 14,
			defaultSize: new Dimension(430, k + 12 * O + j)
		};
	}
	_isDetailsVisible() {
		return this._storageService.getBoolean("expandSuggestionDocs", 0, !1);
	}
	_setDetailsVisible(e) {
		this._storageService.store("expandSuggestionDocs", e, 0, 0);
	}
	forceRenderingAbove() {
		this._forceRenderingAbove || (this._forceRenderingAbove = !0, this._layout(this._persistedSize.restore()));
	}
	stopForceRenderingAbove() {
		this._forceRenderingAbove = !1;
	}
};
SuggestWidget = SuggestWidget_1 = __decorate$51([
	__param$51(1, IStorageService),
	__param$51(2, IContextKeyService),
	__param$51(3, IThemeService),
	__param$51(4, IInstantiationService)
], SuggestWidget);
var SuggestContentWidget = class {
	constructor(e, O) {
		this._widget = e, this._editor = O, this.allowEditorOverflow = !0, this.suppressMouseDown = !1, this._preferenceLocked = !1, this._added = !1, this._hidden = !1;
	}
	dispose() {
		this._added && (this._added = !1, this._editor.removeContentWidget(this));
	}
	getId() {
		return "editor.widget.suggestWidget";
	}
	getDomNode() {
		return this._widget.element.domNode;
	}
	show() {
		this._hidden = !1, this._added || (this._added = !0, this._editor.addContentWidget(this));
	}
	hide() {
		this._hidden || (this._hidden = !0, this.layout());
	}
	layout() {
		this._editor.layoutContentWidget(this);
	}
	getPosition() {
		return this._hidden || !this._position || !this._preference ? null : {
			position: this._position,
			preference: [this._preference]
		};
	}
	beforeRender() {
		let { height: e, width: O } = this._widget.element.size, { borderWidth: k, horizontalPadding: A } = this._widget.getLayoutInfo();
		return new Dimension(O + 2 * k + A, e + 2 * k);
	}
	afterRender(e) {
		this._widget._afterRender(e);
	}
	setPreference(e) {
		this._preferenceLocked || (this._preference = e);
	}
	lockPreference() {
		this._preferenceLocked = !0;
	}
	unlockPreference() {
		this._preferenceLocked = !1;
	}
	setPosition(e) {
		this._position = e;
	}
}, __decorate$50 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$50 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, SuggestController_1, LineSuffix = class {
	constructor(e, O) {
		if (this._model = e, this._position = O, this._decorationOptions = ModelDecorationOptions.register({
			description: "suggest-line-suffix",
			stickiness: 1
		}), e.getLineMaxColumn(O.lineNumber) !== O.column) {
			let k = e.getOffsetAt(O), A = e.getPositionAt(k + 1);
			e.changeDecorations((e) => {
				this._marker && e.removeDecoration(this._marker), this._marker = e.addDecoration(Range.fromPositions(O, A), this._decorationOptions);
			});
		}
	}
	dispose() {
		this._marker && !this._model.isDisposed() && this._model.changeDecorations((e) => {
			e.removeDecoration(this._marker), this._marker = void 0;
		});
	}
	delta(e) {
		if (this._model.isDisposed() || this._position.lineNumber !== e.lineNumber) return 0;
		if (this._marker) {
			let O = this._model.getDecorationRange(this._marker);
			return this._model.getOffsetAt(O.getStartPosition()) - this._model.getOffsetAt(e);
		} else return this._model.getLineMaxColumn(e.lineNumber) - e.column;
	}
}, SuggestController = class {
	static {
		SuggestController_1 = this;
	}
	static {
		this.ID = "editor.contrib.suggestController";
	}
	static get(e) {
		return e.getContribution(SuggestController_1.ID);
	}
	constructor(e, O, k, A, j, M, N) {
		this._memoryService = O, this._commandService = k, this._contextKeyService = A, this._instantiationService = j, this._logService = M, this._telemetryService = N, this._lineSuffix = new MutableDisposable(), this._toDispose = new DisposableStore(), this._selectors = new PriorityRegistry((e) => e.priority), this._onWillInsertSuggestItem = new Emitter(), this.onWillInsertSuggestItem = this._onWillInsertSuggestItem.event, this.editor = e, this.model = j.createInstance(SuggestModel, this.editor), this._selectors.register({
			priority: 0,
			select: (e, O, k) => this._memoryService.select(e, O, k)
		});
		let P = Context$1.InsertMode.bindTo(A);
		P.set(e.getOption(119).insertMode), this._toDispose.add(this.model.onDidTrigger(() => P.set(e.getOption(119).insertMode))), this.widget = this._toDispose.add(new WindowIdleValue(getWindow(e.getDomNode()), () => {
			let e = this._instantiationService.createInstance(SuggestWidget, this.editor);
			this._toDispose.add(e), this._toDispose.add(e.onDidSelect((e) => this._insertSuggestion(e, 0), this));
			let O = new CommitCharacterController(this.editor, e, this.model, (e) => this._insertSuggestion(e, 2));
			this._toDispose.add(O);
			let k = Context$1.MakesTextEdit.bindTo(this._contextKeyService), A = Context$1.HasInsertAndReplaceRange.bindTo(this._contextKeyService), j = Context$1.CanResolve.bindTo(this._contextKeyService);
			return this._toDispose.add(toDisposable(() => {
				k.reset(), A.reset(), j.reset();
			})), this._toDispose.add(e.onDidFocus(({ item: e }) => {
				let O = this.editor.getPosition(), M = e.editStart.column, N = O.column, P = !0;
				this.editor.getOption(1) === "smart" && this.model.state === 2 && !e.completion.additionalTextEdits && !(e.completion.insertTextRules & 4) && N - M === e.completion.insertText.length && (P = this.editor.getModel().getValueInRange({
					startLineNumber: O.lineNumber,
					startColumn: M,
					endLineNumber: O.lineNumber,
					endColumn: N
				}) !== e.completion.insertText), k.set(P), A.set(!Position.equals(e.editInsertEnd, e.editReplaceEnd)), j.set(!!e.provider.resolveCompletionItem || !!e.completion.documentation || e.completion.detail !== e.completion.label);
			})), this._toDispose.add(e.onDetailsKeyDown((e) => {
				if (e.toKeyCodeChord().equals(new KeyCodeChord(!0, !1, !1, !1, 33)) || isMacintosh && e.toKeyCodeChord().equals(new KeyCodeChord(!1, !1, !1, !0, 33))) {
					e.stopPropagation();
					return;
				}
				e.toKeyCodeChord().isModifierKey() || this.editor.focus();
			})), e;
		})), this._overtypingCapturer = this._toDispose.add(new WindowIdleValue(getWindow(e.getDomNode()), () => this._toDispose.add(new OvertypingCapturer(this.editor, this.model)))), this._alternatives = this._toDispose.add(new WindowIdleValue(getWindow(e.getDomNode()), () => this._toDispose.add(new SuggestAlternatives(this.editor, this._contextKeyService)))), this._toDispose.add(j.createInstance(WordContextKey, e)), this._toDispose.add(this.model.onDidTrigger((e) => {
			this.widget.value.showTriggered(e.auto, e.shy ? 250 : 50), this._lineSuffix.value = new LineSuffix(this.editor.getModel(), e.position);
		})), this._toDispose.add(this.model.onDidSuggest((e) => {
			if (e.triggerOptions.shy) return;
			let O = -1;
			for (let k of this._selectors.itemsOrderedByPriorityDesc) if (O = k.select(this.editor.getModel(), this.editor.getPosition(), e.completionModel.items), O !== -1) break;
			if (O === -1 && (O = 0), this.model.state === 0) return;
			let k = !1;
			if (e.triggerOptions.auto) {
				let O = this.editor.getOption(119);
				O.selectionMode === "never" || O.selectionMode === "always" ? k = O.selectionMode === "never" : O.selectionMode === "whenTriggerCharacter" ? k = e.triggerOptions.triggerKind !== 1 : O.selectionMode === "whenQuickSuggestion" && (k = e.triggerOptions.triggerKind === 1 && !e.triggerOptions.refilter);
			}
			this.widget.value.showSuggestions(e.completionModel, O, e.isFrozen, e.triggerOptions.auto, k);
		})), this._toDispose.add(this.model.onDidCancel((e) => {
			e.retrigger || this.widget.value.hideWidget();
		})), this._toDispose.add(this.editor.onDidBlurEditorWidget(() => {
			this.model.cancel(), this.model.clear();
		}));
		let F = Context$1.AcceptSuggestionsOnEnter.bindTo(A), I = () => {
			let e = this.editor.getOption(1);
			F.set(e === "on" || e === "smart");
		};
		this._toDispose.add(this.editor.onDidChangeConfiguration(() => I())), I();
	}
	dispose() {
		this._alternatives.dispose(), this._toDispose.dispose(), this.widget.dispose(), this.model.dispose(), this._lineSuffix.dispose(), this._onWillInsertSuggestItem.dispose();
	}
	_insertSuggestion(e, O) {
		if (!e || !e.item) {
			this._alternatives.value.reset(), this.model.cancel(), this.model.clear();
			return;
		}
		if (!this.editor.hasModel()) return;
		let k = SnippetController2.get(this.editor);
		if (!k) return;
		this._onWillInsertSuggestItem.fire({ item: e.item });
		let A = this.editor.getModel(), j = A.getAlternativeVersionId(), { item: M } = e, N = [], P = new CancellationTokenSource();
		O & 1 || this.editor.pushUndoStop();
		let F = this.getOverwriteInfo(M, !!(O & 8));
		this._memoryService.memorize(A, this.editor.getPosition(), M);
		let I = M.isResolved, L = -1, R = -1;
		if (Array.isArray(M.completion.additionalTextEdits)) {
			this.model.cancel();
			let e = StableEditorScrollState.capture(this.editor);
			this.editor.executeEdits("suggestController.additionalTextEdits.sync", M.completion.additionalTextEdits.map((e) => {
				let O = Range.lift(e.range);
				if (O.startLineNumber === M.position.lineNumber && O.startColumn > M.position.column) {
					let e = this.editor.getPosition().column - M.position.column, k = e, A = Range.spansMultipleLines(O) ? 0 : e;
					O = new Range(O.startLineNumber, O.startColumn + k, O.endLineNumber, O.endColumn + A);
				}
				return EditOperation.replaceMove(O, e.text);
			})), e.restoreRelativeVerticalPositionOfCursor(this.editor);
		} else if (!I) {
			let e = new StopWatch(), k, j = A.onDidChangeContent((e) => {
				if (e.isFlush) {
					P.cancel(), j.dispose();
					return;
				}
				for (let O of e.changes) {
					let e = Range.getEndPosition(O.range);
					(!k || Position.isBefore(e, k)) && (k = e);
				}
			}), F = O;
			O |= 2;
			let I = !1, L = this.editor.onWillType(() => {
				L.dispose(), I = !0, F & 2 || this.editor.pushUndoStop();
			});
			N.push(M.resolve(P.token).then(() => {
				if (!M.completion.additionalTextEdits || P.token.isCancellationRequested) return;
				if (k && M.completion.additionalTextEdits.some((e) => Position.isBefore(k, Range.getStartPosition(e.range)))) return !1;
				I && this.editor.pushUndoStop();
				let e = StableEditorScrollState.capture(this.editor);
				return this.editor.executeEdits("suggestController.additionalTextEdits.async", M.completion.additionalTextEdits.map((e) => EditOperation.replaceMove(Range.lift(e.range), e.text))), e.restoreRelativeVerticalPositionOfCursor(this.editor), (I || !(F & 2)) && this.editor.pushUndoStop(), !0;
			}).then((O) => {
				this._logService.trace("[suggest] async resolving of edits DONE (ms, applied?)", e.elapsed(), O), R = O === !0 ? 1 : O === !1 ? 0 : -2;
			}).finally(() => {
				j.dispose(), L.dispose();
			}));
		}
		let { insertText: z } = M.completion;
		if (M.completion.insertTextRules & 4 || (z = SnippetParser.escape(z)), this.model.cancel(), k.insert(z, {
			overwriteBefore: F.overwriteBefore,
			overwriteAfter: F.overwriteAfter,
			undoStopBefore: !1,
			undoStopAfter: !1,
			adjustWhitespace: !(M.completion.insertTextRules & 1),
			clipboardText: e.model.clipboardText,
			overtypingCapturer: this._overtypingCapturer.value
		}), O & 2 || this.editor.pushUndoStop(), M.completion.command) if (M.completion.command.id === TriggerSuggestAction.id) this.model.trigger({
			auto: !0,
			retrigger: !0
		});
		else {
			let e = new StopWatch();
			N.push(this._commandService.executeCommand(M.completion.command.id, ...M.completion.command.arguments ? [...M.completion.command.arguments] : []).catch((e) => {
				M.completion.extensionId ? onUnexpectedExternalError(e) : onUnexpectedError(e);
			}).finally(() => {
				L = e.elapsed();
			}));
		}
		O & 4 && this._alternatives.value.set(e, (e) => {
			for (P.cancel(); A.canUndo();) {
				j !== A.getAlternativeVersionId() && A.undo(), this._insertSuggestion(e, 3 | (O & 8 ? 8 : 0));
				break;
			}
		}), this._alertCompletionItem(M), Promise.all(N).finally(() => {
			this._reportSuggestionAcceptedTelemetry(M, A, I, L, R, e.index, e.model.items), this.model.clear(), P.dispose();
		});
	}
	_reportSuggestionAcceptedTelemetry(e, O, k, A, j, M, N) {
		if (Math.floor(Math.random() * 100) === 0) return;
		let P = /* @__PURE__ */ new Map();
		for (let e = 0; e < Math.min(30, N.length); e++) {
			let O = N[e].textLabel;
			P.has(O) ? P.get(O).push(e) : P.set(O, [e]);
		}
		let F = P.get(e.textLabel), I = F && F.length > 1 ? F[0] : -1;
		this._telemetryService.publicLog2("suggest.acceptedSuggestion", {
			extensionId: e.extensionId?.value ?? "unknown",
			providerId: e.provider._debugDisplayName ?? "unknown",
			kind: e.completion.kind,
			basenameHash: hash(basename(O.uri)).toString(16),
			languageId: O.getLanguageId(),
			fileExtension: extname(O.uri),
			resolveInfo: e.provider.resolveCompletionItem ? k ? 1 : 0 : -1,
			resolveDuration: e.resolveDuration,
			commandDuration: A,
			additionalEditsAsync: j,
			index: M,
			firstIndex: I
		});
	}
	getOverwriteInfo(e, O) {
		assertType(this.editor.hasModel());
		let k = this.editor.getOption(119).insertMode === "replace";
		O && (k = !k);
		let A = e.position.column - e.editStart.column, j = (k ? e.editReplaceEnd.column : e.editInsertEnd.column) - e.position.column, M = this.editor.getPosition().column - e.position.column, N = this._lineSuffix.value ? this._lineSuffix.value.delta(this.editor.getPosition()) : 0;
		return {
			overwriteBefore: A + M,
			overwriteAfter: j + N
		};
	}
	_alertCompletionItem(e) {
		if (isNonEmptyArray(e.completion.additionalTextEdits)) {
			let O = localize("aria.alert.snippet", "Accepting '{0}' made {1} additional edits", e.textLabel, e.completion.additionalTextEdits.length);
			alert(O);
		}
	}
	triggerSuggest(e, O, k) {
		this.editor.hasModel() && (this.model.trigger({
			auto: O ?? !1,
			completionOptions: {
				providerFilter: e,
				kindFilter: k ? /* @__PURE__ */ new Set() : void 0
			}
		}), this.editor.revealPosition(this.editor.getPosition(), 0), this.editor.focus());
	}
	triggerSuggestAndAcceptBest(e) {
		if (!this.editor.hasModel()) return;
		let O = this.editor.getPosition(), k = () => {
			O.equals(this.editor.getPosition()) && this._commandService.executeCommand(e.fallback);
		}, A = (e) => {
			if (e.completion.insertTextRules & 4 || e.completion.additionalTextEdits) return !0;
			let O = this.editor.getPosition(), k = e.editStart.column, A = O.column;
			return A - k === e.completion.insertText.length ? this.editor.getModel().getValueInRange({
				startLineNumber: O.lineNumber,
				startColumn: k,
				endLineNumber: O.lineNumber,
				endColumn: A
			}) !== e.completion.insertText : !0;
		};
		Event.once(this.model.onDidTrigger)((e) => {
			let O = [];
			Event.any(this.model.onDidTrigger, this.model.onDidCancel)(() => {
				dispose(O), k();
			}, void 0, O), this.model.onDidSuggest(({ completionModel: e }) => {
				if (dispose(O), e.items.length === 0) {
					k();
					return;
				}
				let j = this._memoryService.select(this.editor.getModel(), this.editor.getPosition(), e.items), M = e.items[j];
				if (!A(M)) {
					k();
					return;
				}
				this.editor.pushUndoStop(), this._insertSuggestion({
					index: j,
					item: M,
					model: e
				}, 7);
			}, void 0, O);
		}), this.model.trigger({
			auto: !1,
			shy: !0
		}), this.editor.revealPosition(O, 0), this.editor.focus();
	}
	acceptSelectedSuggestion(e, O) {
		let k = this.widget.value.getFocusedItem(), A = 0;
		e && (A |= 4), O && (A |= 8), this._insertSuggestion(k, A);
	}
	acceptNextSuggestion() {
		this._alternatives.value.next();
	}
	acceptPrevSuggestion() {
		this._alternatives.value.prev();
	}
	cancelSuggestWidget() {
		this.model.cancel(), this.model.clear(), this.widget.value.hideWidget();
	}
	focusSuggestion() {
		this.widget.value.focusSelected();
	}
	selectNextSuggestion() {
		this.widget.value.selectNext();
	}
	selectNextPageSuggestion() {
		this.widget.value.selectNextPage();
	}
	selectLastSuggestion() {
		this.widget.value.selectLast();
	}
	selectPrevSuggestion() {
		this.widget.value.selectPrevious();
	}
	selectPrevPageSuggestion() {
		this.widget.value.selectPreviousPage();
	}
	selectFirstSuggestion() {
		this.widget.value.selectFirst();
	}
	toggleSuggestionDetails() {
		this.widget.value.toggleDetails();
	}
	toggleExplainMode() {
		this.widget.value.toggleExplainMode();
	}
	toggleSuggestionFocus() {
		this.widget.value.toggleDetailsFocus();
	}
	resetWidgetSize() {
		this.widget.value.resetPersistedSize();
	}
	forceRenderingAbove() {
		this.widget.value.forceRenderingAbove();
	}
	stopForceRenderingAbove() {
		this.widget.isInitialized && this.widget.value.stopForceRenderingAbove();
	}
	registerSelector(e) {
		return this._selectors.register(e);
	}
};
SuggestController = SuggestController_1 = __decorate$50([
	__param$50(1, ISuggestMemoryService),
	__param$50(2, ICommandService),
	__param$50(3, IContextKeyService),
	__param$50(4, IInstantiationService),
	__param$50(5, ILogService),
	__param$50(6, ITelemetryService)
], SuggestController);
var PriorityRegistry = class {
	constructor(e) {
		this.prioritySelector = e, this._items = [];
	}
	register(e) {
		if (this._items.indexOf(e) !== -1) throw Error("Value is already registered");
		return this._items.push(e), this._items.sort((e, O) => this.prioritySelector(O) - this.prioritySelector(e)), { dispose: () => {
			let O = this._items.indexOf(e);
			O >= 0 && this._items.splice(O, 1);
		} };
	}
	get itemsOrderedByPriorityDesc() {
		return this._items;
	}
}, TriggerSuggestAction = class e extends EditorAction {
	static {
		this.id = "editor.action.triggerSuggest";
	}
	constructor() {
		super({
			id: e.id,
			label: localize("suggest.trigger.label", "Trigger Suggest"),
			alias: "Trigger Suggest",
			precondition: ContextKeyExpr.and(EditorContextKeys.writable, EditorContextKeys.hasCompletionItemProvider, Context$1.Visible.toNegated()),
			kbOpts: {
				kbExpr: EditorContextKeys.textInputFocus,
				primary: 2058,
				secondary: [2087],
				mac: {
					primary: 266,
					secondary: [521, 2087]
				},
				weight: 100
			}
		});
	}
	run(e, O, k) {
		let A = SuggestController.get(O);
		if (!A) return;
		let j;
		k && typeof k == "object" && k.auto === !0 && (j = !0), A.triggerSuggest(void 0, j, void 0);
	}
};
registerEditorContribution(SuggestController.ID, SuggestController, 2), registerEditorAction(TriggerSuggestAction);
var weight$2 = 190, SuggestCommand = EditorCommand.bindToContribution(SuggestController.get);
registerEditorCommand(new SuggestCommand({
	id: "acceptSelectedSuggestion",
	precondition: ContextKeyExpr.and(Context$1.Visible, Context$1.HasFocusedSuggestion),
	handler(e) {
		e.acceptSelectedSuggestion(!0, !1);
	},
	kbOpts: [{
		primary: 2,
		kbExpr: ContextKeyExpr.and(Context$1.Visible, EditorContextKeys.textInputFocus),
		weight: weight$2
	}, {
		primary: 3,
		kbExpr: ContextKeyExpr.and(Context$1.Visible, EditorContextKeys.textInputFocus, Context$1.AcceptSuggestionsOnEnter, Context$1.MakesTextEdit),
		weight: weight$2
	}],
	menuOpts: [
		{
			menuId: suggestWidgetStatusbarMenu,
			title: localize("accept.insert", "Insert"),
			group: "left",
			order: 1,
			when: Context$1.HasInsertAndReplaceRange.toNegated()
		},
		{
			menuId: suggestWidgetStatusbarMenu,
			title: localize("accept.insert", "Insert"),
			group: "left",
			order: 1,
			when: ContextKeyExpr.and(Context$1.HasInsertAndReplaceRange, Context$1.InsertMode.isEqualTo("insert"))
		},
		{
			menuId: suggestWidgetStatusbarMenu,
			title: localize("accept.replace", "Replace"),
			group: "left",
			order: 1,
			when: ContextKeyExpr.and(Context$1.HasInsertAndReplaceRange, Context$1.InsertMode.isEqualTo("replace"))
		}
	]
})), registerEditorCommand(new SuggestCommand({
	id: "acceptAlternativeSelectedSuggestion",
	precondition: ContextKeyExpr.and(Context$1.Visible, EditorContextKeys.textInputFocus, Context$1.HasFocusedSuggestion),
	kbOpts: {
		weight: weight$2,
		kbExpr: EditorContextKeys.textInputFocus,
		primary: 1027,
		secondary: [1026]
	},
	handler(e) {
		e.acceptSelectedSuggestion(!1, !0);
	},
	menuOpts: [{
		menuId: suggestWidgetStatusbarMenu,
		group: "left",
		order: 2,
		when: ContextKeyExpr.and(Context$1.HasInsertAndReplaceRange, Context$1.InsertMode.isEqualTo("insert")),
		title: localize("accept.replace", "Replace")
	}, {
		menuId: suggestWidgetStatusbarMenu,
		group: "left",
		order: 2,
		when: ContextKeyExpr.and(Context$1.HasInsertAndReplaceRange, Context$1.InsertMode.isEqualTo("replace")),
		title: localize("accept.insert", "Insert")
	}]
})), CommandsRegistry.registerCommandAlias("acceptSelectedSuggestionOnEnter", "acceptSelectedSuggestion"), registerEditorCommand(new SuggestCommand({
	id: "hideSuggestWidget",
	precondition: Context$1.Visible,
	handler: (e) => e.cancelSuggestWidget(),
	kbOpts: {
		weight: weight$2,
		kbExpr: EditorContextKeys.textInputFocus,
		primary: 9,
		secondary: [1033]
	}
})), registerEditorCommand(new SuggestCommand({
	id: "selectNextSuggestion",
	precondition: ContextKeyExpr.and(Context$1.Visible, ContextKeyExpr.or(Context$1.MultipleSuggestions, Context$1.HasFocusedSuggestion.negate())),
	handler: (e) => e.selectNextSuggestion(),
	kbOpts: {
		weight: weight$2,
		kbExpr: EditorContextKeys.textInputFocus,
		primary: 18,
		secondary: [2066],
		mac: {
			primary: 18,
			secondary: [2066, 300]
		}
	}
})), registerEditorCommand(new SuggestCommand({
	id: "selectNextPageSuggestion",
	precondition: ContextKeyExpr.and(Context$1.Visible, ContextKeyExpr.or(Context$1.MultipleSuggestions, Context$1.HasFocusedSuggestion.negate())),
	handler: (e) => e.selectNextPageSuggestion(),
	kbOpts: {
		weight: weight$2,
		kbExpr: EditorContextKeys.textInputFocus,
		primary: 12,
		secondary: [2060]
	}
})), registerEditorCommand(new SuggestCommand({
	id: "selectLastSuggestion",
	precondition: ContextKeyExpr.and(Context$1.Visible, ContextKeyExpr.or(Context$1.MultipleSuggestions, Context$1.HasFocusedSuggestion.negate())),
	handler: (e) => e.selectLastSuggestion()
})), registerEditorCommand(new SuggestCommand({
	id: "selectPrevSuggestion",
	precondition: ContextKeyExpr.and(Context$1.Visible, ContextKeyExpr.or(Context$1.MultipleSuggestions, Context$1.HasFocusedSuggestion.negate())),
	handler: (e) => e.selectPrevSuggestion(),
	kbOpts: {
		weight: weight$2,
		kbExpr: EditorContextKeys.textInputFocus,
		primary: 16,
		secondary: [2064],
		mac: {
			primary: 16,
			secondary: [2064, 302]
		}
	}
})), registerEditorCommand(new SuggestCommand({
	id: "selectPrevPageSuggestion",
	precondition: ContextKeyExpr.and(Context$1.Visible, ContextKeyExpr.or(Context$1.MultipleSuggestions, Context$1.HasFocusedSuggestion.negate())),
	handler: (e) => e.selectPrevPageSuggestion(),
	kbOpts: {
		weight: weight$2,
		kbExpr: EditorContextKeys.textInputFocus,
		primary: 11,
		secondary: [2059]
	}
})), registerEditorCommand(new SuggestCommand({
	id: "selectFirstSuggestion",
	precondition: ContextKeyExpr.and(Context$1.Visible, ContextKeyExpr.or(Context$1.MultipleSuggestions, Context$1.HasFocusedSuggestion.negate())),
	handler: (e) => e.selectFirstSuggestion()
})), registerEditorCommand(new SuggestCommand({
	id: "focusSuggestion",
	precondition: ContextKeyExpr.and(Context$1.Visible, Context$1.HasFocusedSuggestion.negate()),
	handler: (e) => e.focusSuggestion(),
	kbOpts: {
		weight: weight$2,
		kbExpr: EditorContextKeys.textInputFocus,
		primary: 2058,
		secondary: [2087],
		mac: {
			primary: 266,
			secondary: [2087]
		}
	}
})), registerEditorCommand(new SuggestCommand({
	id: "focusAndAcceptSuggestion",
	precondition: ContextKeyExpr.and(Context$1.Visible, Context$1.HasFocusedSuggestion.negate()),
	handler: (e) => {
		e.focusSuggestion(), e.acceptSelectedSuggestion(!0, !1);
	}
})), registerEditorCommand(new SuggestCommand({
	id: "toggleSuggestionDetails",
	precondition: ContextKeyExpr.and(Context$1.Visible, Context$1.HasFocusedSuggestion),
	handler: (e) => e.toggleSuggestionDetails(),
	kbOpts: {
		weight: weight$2,
		kbExpr: EditorContextKeys.textInputFocus,
		primary: 2058,
		secondary: [2087],
		mac: {
			primary: 266,
			secondary: [2087]
		}
	},
	menuOpts: [{
		menuId: suggestWidgetStatusbarMenu,
		group: "right",
		order: 1,
		when: ContextKeyExpr.and(Context$1.DetailsVisible, Context$1.CanResolve),
		title: localize("detail.more", "Show Less")
	}, {
		menuId: suggestWidgetStatusbarMenu,
		group: "right",
		order: 1,
		when: ContextKeyExpr.and(Context$1.DetailsVisible.toNegated(), Context$1.CanResolve),
		title: localize("detail.less", "Show More")
	}]
})), registerEditorCommand(new SuggestCommand({
	id: "toggleExplainMode",
	precondition: Context$1.Visible,
	handler: (e) => e.toggleExplainMode(),
	kbOpts: {
		weight: 100,
		primary: 2138
	}
})), registerEditorCommand(new SuggestCommand({
	id: "toggleSuggestionFocus",
	precondition: Context$1.Visible,
	handler: (e) => e.toggleSuggestionFocus(),
	kbOpts: {
		weight: weight$2,
		kbExpr: EditorContextKeys.textInputFocus,
		primary: 2570,
		mac: { primary: 778 }
	}
})), registerEditorCommand(new SuggestCommand({
	id: "insertBestCompletion",
	precondition: ContextKeyExpr.and(EditorContextKeys.textInputFocus, ContextKeyExpr.equals("config.editor.tabCompletion", "on"), WordContextKey.AtEnd, Context$1.Visible.toNegated(), SuggestAlternatives.OtherSuggestions.toNegated(), SnippetController2.InSnippetMode.toNegated()),
	handler: (e, O) => {
		e.triggerSuggestAndAcceptBest(isObject(O) ? {
			fallback: "tab",
			...O
		} : { fallback: "tab" });
	},
	kbOpts: {
		weight: weight$2,
		primary: 2
	}
})), registerEditorCommand(new SuggestCommand({
	id: "insertNextSuggestion",
	precondition: ContextKeyExpr.and(EditorContextKeys.textInputFocus, ContextKeyExpr.equals("config.editor.tabCompletion", "on"), SuggestAlternatives.OtherSuggestions, Context$1.Visible.toNegated(), SnippetController2.InSnippetMode.toNegated()),
	handler: (e) => e.acceptNextSuggestion(),
	kbOpts: {
		weight: weight$2,
		kbExpr: EditorContextKeys.textInputFocus,
		primary: 2
	}
})), registerEditorCommand(new SuggestCommand({
	id: "insertPrevSuggestion",
	precondition: ContextKeyExpr.and(EditorContextKeys.textInputFocus, ContextKeyExpr.equals("config.editor.tabCompletion", "on"), SuggestAlternatives.OtherSuggestions, Context$1.Visible.toNegated(), SnippetController2.InSnippetMode.toNegated()),
	handler: (e) => e.acceptPrevSuggestion(),
	kbOpts: {
		weight: weight$2,
		kbExpr: EditorContextKeys.textInputFocus,
		primary: 1026
	}
})), registerEditorAction(class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.resetSuggestSize",
			label: localize("suggest.reset.label", "Reset Suggest Widget Size"),
			alias: "Reset Suggest Widget Size",
			precondition: void 0
		});
	}
	run(e, O) {
		SuggestController.get(O)?.resetWidgetSize();
	}
});
var SuggestWidgetAdaptor = class extends Disposable {
	get selectedItem() {
		return this._currentSuggestItemInfo;
	}
	constructor(e, O, k) {
		super(), this.editor = e, this.suggestControllerPreselector = O, this.onWillAccept = k, this.isSuggestWidgetVisible = !1, this.isShiftKeyPressed = !1, this._isActive = !1, this._currentSuggestItemInfo = void 0, this._onDidSelectedItemChange = this._register(new Emitter()), this.onDidSelectedItemChange = this._onDidSelectedItemChange.event, this._register(e.onKeyDown((e) => {
			e.shiftKey && !this.isShiftKeyPressed && (this.isShiftKeyPressed = !0, this.update(this._isActive));
		})), this._register(e.onKeyUp((e) => {
			e.shiftKey && this.isShiftKeyPressed && (this.isShiftKeyPressed = !1, this.update(this._isActive));
		}));
		let A = SuggestController.get(this.editor);
		if (A) {
			this._register(A.registerSelector({
				priority: 100,
				select: (e, O, k) => {
					let j = this.editor.getModel();
					if (!j) return -1;
					let M = this.suggestControllerPreselector(), N = M ? singleTextRemoveCommonPrefix(M, j) : void 0;
					if (!N) return -1;
					let P = Position.lift(O), F = k.map((e, O) => {
						let k = SuggestItemInfo.fromSuggestion(A, j, P, e, this.isShiftKeyPressed), M = singleTextRemoveCommonPrefix(k.toSingleTextEdit(), j), F = singleTextEditAugments(N, M);
						return {
							index: O,
							valid: F,
							prefixLength: M.text.length,
							suggestItem: e
						};
					}).filter((e) => e && e.valid && e.prefixLength > 0), I = findFirstMax(F, compareBy((e) => e.prefixLength, numberComparator));
					return I ? I.index : -1;
				}
			}));
			let e = !1, O = () => {
				e || (e = !0, this._register(A.widget.value.onDidShow(() => {
					this.isSuggestWidgetVisible = !0, this.update(!0);
				})), this._register(A.widget.value.onDidHide(() => {
					this.isSuggestWidgetVisible = !1, this.update(!1);
				})), this._register(A.widget.value.onDidFocus(() => {
					this.isSuggestWidgetVisible = !0, this.update(!0);
				})));
			};
			this._register(Event.once(A.model.onDidTrigger)((e) => {
				O();
			})), this._register(A.onWillInsertSuggestItem((e) => {
				let O = this.editor.getPosition(), k = this.editor.getModel();
				if (!O || !k) return;
				let j = SuggestItemInfo.fromSuggestion(A, k, O, e.item, this.isShiftKeyPressed);
				this.onWillAccept(j);
			}));
		}
		this.update(this._isActive);
	}
	update(e) {
		let O = this.getSuggestItemInfo();
		(this._isActive !== e || !suggestItemInfoEquals(this._currentSuggestItemInfo, O)) && (this._isActive = e, this._currentSuggestItemInfo = O, this._onDidSelectedItemChange.fire());
	}
	getSuggestItemInfo() {
		let e = SuggestController.get(this.editor);
		if (!e || !this.isSuggestWidgetVisible) return;
		let O = e.widget.value.getFocusedItem(), k = this.editor.getPosition(), A = this.editor.getModel();
		if (!(!O || !k || !A)) return SuggestItemInfo.fromSuggestion(e, A, k, O.item, this.isShiftKeyPressed);
	}
	stopForceRenderingAbove() {
		SuggestController.get(this.editor)?.stopForceRenderingAbove();
	}
	forceRenderingAbove() {
		SuggestController.get(this.editor)?.forceRenderingAbove();
	}
}, SuggestItemInfo = class e {
	static fromSuggestion(O, k, A, j, M) {
		let { insertText: N } = j.completion, P = !1;
		if (j.completion.insertTextRules & 4) {
			let e = new SnippetParser().parse(N);
			e.children.length < 100 && SnippetSession.adjustWhitespace(k, A, !0, e), N = e.toString(), P = !0;
		}
		let F = O.getOverwriteInfo(j, M);
		return new e(Range.fromPositions(A.delta(0, -F.overwriteBefore), A.delta(0, Math.max(F.overwriteAfter, 0))), N, j.completion.kind, P);
	}
	constructor(e, O, k, A) {
		this.range = e, this.insertText = O, this.completionItemKind = k, this.isSnippetText = A;
	}
	equals(e) {
		return this.range.equalsRange(e.range) && this.insertText === e.insertText && this.completionItemKind === e.completionItemKind && this.isSnippetText === e.isSnippetText;
	}
	toSelectedSuggestionInfo() {
		return new SelectedSuggestionInfo(this.range, this.insertText, this.completionItemKind, this.isSnippetText);
	}
	toSingleTextEdit() {
		return new SingleTextEdit(this.range, this.insertText);
	}
};
function suggestItemInfoEquals(e, O) {
	return e === O ? !0 : !e || !O ? !1 : e.equals(O);
}
var __decorate$49 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$49 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, InlineCompletionsController_1, InlineCompletionsController = class extends Disposable {
	static {
		InlineCompletionsController_1 = this;
	}
	static {
		this.ID = "editor.contrib.inlineCompletionsController";
	}
	static get(e) {
		return e.getContribution(InlineCompletionsController_1.ID);
	}
	constructor(e, O, k, A, j, N, P, F, I, R) {
		super(), this.editor = e, this._instantiationService = O, this._contextKeyService = k, this._configurationService = A, this._commandService = j, this._debounceService = N, this._languageFeaturesService = P, this._accessibilitySignalService = F, this._keybindingService = I, this._accessibilityService = R, this._editorObs = observableCodeEditor(this.editor), this._positions = derived(this, (e) => this._editorObs.selections.read(e)?.map((e) => e.getEndPosition()) ?? [new Position(1, 1)]), this._suggestWidgetAdaptor = this._register(new SuggestWidgetAdaptor(this.editor, () => (this._editorObs.forceUpdate(), this.model.get()?.selectedInlineCompletion.get()?.toSingleTextEdit(void 0)), (e) => this._editorObs.forceUpdate((O) => {
			this.model.get()?.handleSuggestAccepted(e);
		}))), this._suggestWidgetSelectedItem = observableFromEvent(this, (e) => this._suggestWidgetAdaptor.onDidSelectedItemChange(() => {
			this._editorObs.forceUpdate((O) => e(void 0));
		}), () => this._suggestWidgetAdaptor.selectedItem), this._enabledInConfig = observableFromEvent(this, this.editor.onDidChangeConfiguration, () => this.editor.getOption(62).enabled), this._isScreenReaderEnabled = observableFromEvent(this, this._accessibilityService.onDidChangeScreenReaderOptimized, () => this._accessibilityService.isScreenReaderOptimized()), this._editorDictationInProgress = observableFromEvent(this, this._contextKeyService.onDidChangeContext, () => this._contextKeyService.getContext(this.editor.getDomNode()).getValue("editorDictation.inProgress") === !0), this._enabled = derived(this, (e) => this._enabledInConfig.read(e) && (!this._isScreenReaderEnabled.read(e) || !this._editorDictationInProgress.read(e))), this._debounceValue = this._debounceService.for(this._languageFeaturesService.inlineCompletionsProvider, "InlineCompletionsDebounce", {
			min: 50,
			max: 50
		}), this.model = derivedDisposable(this, (e) => {
			if (this._editorObs.isReadonly.read(e)) return;
			let O = this._editorObs.model.read(e);
			if (O) return this._instantiationService.createInstance(InlineCompletionsModel, O, this._suggestWidgetSelectedItem, this._editorObs.versionId, this._positions, this._debounceValue, observableFromEvent(this.editor.onDidChangeConfiguration, () => this.editor.getOption(119).preview), observableFromEvent(this.editor.onDidChangeConfiguration, () => this.editor.getOption(119).previewMode), observableFromEvent(this.editor.onDidChangeConfiguration, () => this.editor.getOption(62).mode), this._enabled);
		}).recomputeInitiallyAndOnChange(this._store), this._ghostTexts = derived(this, (e) => this.model.read(e)?.ghostTexts.read(e) ?? []), this._stablizedGhostTexts = convertItemsToStableObservables(this._ghostTexts, this._store), this._ghostTextWidgets = mapObservableArrayCached(this, this._stablizedGhostTexts, (e, O) => O.add(this._instantiationService.createInstance(GhostTextView, this.editor, {
			ghostText: e,
			minReservedLineCount: constObservable(0),
			targetTextModel: this.model.map((e) => e?.textModel)
		}))).recomputeInitiallyAndOnChange(this._store), this._playAccessibilitySignal = observableSignal(this), this._fontFamily = observableFromEvent(this, this.editor.onDidChangeConfiguration, () => this.editor.getOption(62).fontFamily), this._register(new InlineCompletionContextKeys(this._contextKeyService, this.model)), this._register(reactToChange(this._editorObs.onDidType, (e, O) => {
			this._enabled.get() && this.model.get()?.trigger();
		})), this._register(this._commandService.onDidExecuteCommand((O) => {
			new Set([
				CoreEditingCommands.Tab.id,
				CoreEditingCommands.DeleteLeft.id,
				CoreEditingCommands.DeleteRight.id,
				"editor.action.inlineSuggest.commit",
				"acceptSelectedSuggestion"
			]).has(O.commandId) && e.hasTextFocus() && this._enabled.get() && this._editorObs.forceUpdate((e) => {
				this.model.get()?.trigger(e);
			});
		})), this._register(reactToChange(this._editorObs.selections, (e, O) => {
			O.some((e) => e.reason === 3 || e.source === "api") && this.model.get()?.stop();
		})), this._register(this.editor.onDidBlurEditorWidget(() => {
			this._contextKeyService.getContextKeyValue("accessibleViewIsShown") || this._configurationService.getValue("editor.inlineSuggest.keepOnBlur") || e.getOption(62).keepOnBlur || InlineSuggestionHintsContentWidget.dropDownVisible || transaction((e) => {
				this.model.get()?.stop(e);
			});
		})), this._register(autorun((e) => {
			let O = this.model.read(e)?.state.read(e);
			O?.suggestItem ? O.primaryGhostText.lineCount >= 2 && this._suggestWidgetAdaptor.forceRenderingAbove() : this._suggestWidgetAdaptor.stopForceRenderingAbove();
		})), this._register(toDisposable(() => {
			this._suggestWidgetAdaptor.stopForceRenderingAbove();
		}));
		let z = derivedObservableWithCache(this, (e, O) => {
			let k = this.model.read(e)?.state.read(e);
			return this._suggestWidgetSelectedItem.get() ? O : k?.inlineCompletion?.semanticId;
		});
		this._register(reactToChangeWithStore(derived((e) => (this._playAccessibilitySignal.read(e), z.read(e), {})), async (e, O, k) => {
			let A = this.model.get(), j = A?.state.get();
			if (!j || !A) return;
			let M = A.textModel.getLineContent(j.primaryGhostText.lineNumber);
			await timeout(50, cancelOnDispose(k)), await waitForState(this._suggestWidgetSelectedItem, isUndefined, () => !1, cancelOnDispose(k)), await this._accessibilitySignalService.playSignal(AccessibilitySignal.inlineSuggestion), this.editor.getOption(8) && this._provideScreenReaderUpdate(j.primaryGhostText.renderForScreenReader(M));
		})), this._register(new InlineCompletionsHintsWidget(this.editor, this.model, this._instantiationService)), this._register(createStyleSheetFromObservable(derived((e) => {
			let O = this._fontFamily.read(e);
			return O === "" || O === "default" ? "" : `
.monaco-editor .ghost-text-decoration,
.monaco-editor .ghost-text-decoration-preview,
.monaco-editor .ghost-text {
	font-family: ${O};
}`;
		}))), this._register(this._configurationService.onDidChangeConfiguration((e) => {
			e.affectsConfiguration("accessibility.verbosity.inlineCompletions") && this.editor.updateOptions({ inlineCompletionsAccessibilityVerbose: this._configurationService.getValue("accessibility.verbosity.inlineCompletions") });
		})), this.editor.updateOptions({ inlineCompletionsAccessibilityVerbose: this._configurationService.getValue("accessibility.verbosity.inlineCompletions") });
	}
	playAccessibilitySignal(e) {
		this._playAccessibilitySignal.trigger(e);
	}
	_provideScreenReaderUpdate(e) {
		let O = this._contextKeyService.getContextKeyValue("accessibleViewIsShown"), k = this._keybindingService.lookupKeybinding("editor.action.accessibleView"), A;
		!O && k && this.editor.getOption(150) && (A = localize("showAccessibleViewHint", "Inspect this in the accessible view ({0})", k.getAriaLabel())), alert(A ? e + ", " + A : e);
	}
	shouldShowHoverAt(e) {
		let O = this.model.get()?.primaryGhostText.get();
		return O ? O.parts.some((k) => e.containsPosition(new Position(O.lineNumber, k.column))) : !1;
	}
	shouldShowHoverAtViewZone(e) {
		return this._ghostTextWidgets.get()[0]?.ownsViewZone(e) ?? !1;
	}
};
InlineCompletionsController = InlineCompletionsController_1 = __decorate$49([
	__param$49(1, IInstantiationService),
	__param$49(2, IContextKeyService),
	__param$49(3, IConfigurationService),
	__param$49(4, ICommandService),
	__param$49(5, ILanguageFeatureDebounceService),
	__param$49(6, ILanguageFeaturesService),
	__param$49(7, IAccessibilitySignalService),
	__param$49(8, IKeybindingService),
	__param$49(9, IAccessibilityService)
], InlineCompletionsController);
function convertItemsToStableObservables(e, O) {
	let k = observableValue("result", []), A = [];
	return O.add(autorun((O) => {
		let j = e.read(O);
		transaction((e) => {
			if (j.length !== A.length) {
				A.length = j.length;
				for (let e = 0; e < A.length; e++) A[e] || (A[e] = observableValue("item", j[e]));
				k.set([...A], e);
			}
			A.forEach((O, k) => O.set(j[k], e));
		});
	})), k;
}
var ShowNextInlineSuggestionAction = class e extends EditorAction {
	static {
		this.ID = showNextInlineSuggestionActionId;
	}
	constructor() {
		super({
			id: e.ID,
			label: localize("action.inlineSuggest.showNext", "Show Next Inline Suggestion"),
			alias: "Show Next Inline Suggestion",
			precondition: ContextKeyExpr.and(EditorContextKeys.writable, InlineCompletionContextKeys.inlineSuggestionVisible),
			kbOpts: {
				weight: 100,
				primary: 606
			}
		});
	}
	async run(e, O) {
		InlineCompletionsController.get(O)?.model.get()?.next();
	}
}, ShowPreviousInlineSuggestionAction = class e extends EditorAction {
	static {
		this.ID = showPreviousInlineSuggestionActionId;
	}
	constructor() {
		super({
			id: e.ID,
			label: localize("action.inlineSuggest.showPrevious", "Show Previous Inline Suggestion"),
			alias: "Show Previous Inline Suggestion",
			precondition: ContextKeyExpr.and(EditorContextKeys.writable, InlineCompletionContextKeys.inlineSuggestionVisible),
			kbOpts: {
				weight: 100,
				primary: 604
			}
		});
	}
	async run(e, O) {
		InlineCompletionsController.get(O)?.model.get()?.previous();
	}
}, TriggerInlineSuggestionAction = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.inlineSuggest.trigger",
			label: localize("action.inlineSuggest.trigger", "Trigger Inline Suggestion"),
			alias: "Trigger Inline Suggestion",
			precondition: EditorContextKeys.writable
		});
	}
	async run(e, O) {
		let k = InlineCompletionsController.get(O);
		await asyncTransaction(async (e) => {
			await k?.model.get()?.triggerExplicitly(e), k?.playAccessibilitySignal(e);
		});
	}
}, AcceptNextWordOfInlineCompletion = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.inlineSuggest.acceptNextWord",
			label: localize("action.inlineSuggest.acceptNextWord", "Accept Next Word Of Inline Suggestion"),
			alias: "Accept Next Word Of Inline Suggestion",
			precondition: ContextKeyExpr.and(EditorContextKeys.writable, InlineCompletionContextKeys.inlineSuggestionVisible),
			kbOpts: {
				weight: 101,
				primary: 2065,
				kbExpr: ContextKeyExpr.and(EditorContextKeys.writable, InlineCompletionContextKeys.inlineSuggestionVisible)
			},
			menuOpts: [{
				menuId: MenuId.InlineSuggestionToolbar,
				title: localize("acceptWord", "Accept Word"),
				group: "primary",
				order: 2
			}]
		});
	}
	async run(e, O) {
		let k = InlineCompletionsController.get(O);
		await k?.model.get()?.acceptNextWord(k.editor);
	}
}, AcceptNextLineOfInlineCompletion = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.inlineSuggest.acceptNextLine",
			label: localize("action.inlineSuggest.acceptNextLine", "Accept Next Line Of Inline Suggestion"),
			alias: "Accept Next Line Of Inline Suggestion",
			precondition: ContextKeyExpr.and(EditorContextKeys.writable, InlineCompletionContextKeys.inlineSuggestionVisible),
			kbOpts: { weight: 101 },
			menuOpts: [{
				menuId: MenuId.InlineSuggestionToolbar,
				title: localize("acceptLine", "Accept Line"),
				group: "secondary",
				order: 2
			}]
		});
	}
	async run(e, O) {
		let k = InlineCompletionsController.get(O);
		await k?.model.get()?.acceptNextLine(k.editor);
	}
}, AcceptInlineCompletion = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.inlineSuggest.commit",
			label: localize("action.inlineSuggest.accept", "Accept Inline Suggestion"),
			alias: "Accept Inline Suggestion",
			precondition: InlineCompletionContextKeys.inlineSuggestionVisible,
			menuOpts: [{
				menuId: MenuId.InlineSuggestionToolbar,
				title: localize("accept", "Accept"),
				group: "primary",
				order: 1
			}],
			kbOpts: {
				primary: 2,
				weight: 200,
				kbExpr: ContextKeyExpr.and(InlineCompletionContextKeys.inlineSuggestionVisible, EditorContextKeys.tabMovesFocus.toNegated(), InlineCompletionContextKeys.inlineSuggestionHasIndentationLessThanTabSize, Context$1.Visible.toNegated(), EditorContextKeys.hoverFocused.toNegated())
			}
		});
	}
	async run(e, O) {
		let k = InlineCompletionsController.get(O);
		k && (k.model.get()?.accept(k.editor), k.editor.focus());
	}
}, HideInlineCompletion = class e extends EditorAction {
	static {
		this.ID = "editor.action.inlineSuggest.hide";
	}
	constructor() {
		super({
			id: e.ID,
			label: localize("action.inlineSuggest.hide", "Hide Inline Suggestion"),
			alias: "Hide Inline Suggestion",
			precondition: InlineCompletionContextKeys.inlineSuggestionVisible,
			kbOpts: {
				weight: 100,
				primary: 9
			}
		});
	}
	async run(e, O) {
		let k = InlineCompletionsController.get(O);
		transaction((e) => {
			k?.model.get()?.stop(e);
		});
	}
}, ToggleAlwaysShowInlineSuggestionToolbar = class e extends Action2 {
	static {
		this.ID = "editor.action.inlineSuggest.toggleAlwaysShowToolbar";
	}
	constructor() {
		super({
			id: e.ID,
			title: localize("action.inlineSuggest.alwaysShowToolbar", "Always Show Toolbar"),
			f1: !1,
			precondition: void 0,
			menu: [{
				id: MenuId.InlineSuggestionToolbar,
				group: "secondary",
				order: 10
			}],
			toggled: ContextKeyExpr.equals("config.editor.inlineSuggest.showToolbar", "always")
		});
	}
	async run(e, O) {
		let k = e.get(IConfigurationService), A = k.getValue("editor.inlineSuggest.showToolbar") === "always" ? "onHover" : "always";
		k.updateValue("editor.inlineSuggest.showToolbar", A);
	}
}, __decorate$48 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$48 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, InlineCompletionsHover = class {
	constructor(e, O, k) {
		this.owner = e, this.range = O, this.controller = k;
	}
	isValidForHoverAnchor(e) {
		return e.type === 1 && this.range.startColumn <= e.range.startColumn && this.range.endColumn >= e.range.endColumn;
	}
}, InlineCompletionsHoverParticipant = class {
	constructor(e, O, k, A, j, M) {
		this._editor = e, this._languageService = O, this._openerService = k, this.accessibilityService = A, this._instantiationService = j, this._telemetryService = M, this.hoverOrdinal = 4;
	}
	suggestHoverAnchor(e) {
		let O = InlineCompletionsController.get(this._editor);
		if (!O) return null;
		let k = e.target;
		if (k.type === 8) {
			let A = k.detail;
			if (O.shouldShowHoverAtViewZone(A.viewZoneId)) return new HoverForeignElementAnchor(1e3, this, Range.fromPositions(this._editor.getModel().validatePosition(A.positionBefore || A.position)), e.event.posx, e.event.posy, !1);
		}
		return k.type === 7 && O.shouldShowHoverAt(k.range) || k.type === 6 && k.detail.mightBeForeignElement && O.shouldShowHoverAt(k.range) ? new HoverForeignElementAnchor(1e3, this, k.range, e.event.posx, e.event.posy, !1) : null;
	}
	computeSync(e, O) {
		if (this._editor.getOption(62).showToolbar !== "onHover") return [];
		let k = InlineCompletionsController.get(this._editor);
		return k && k.shouldShowHoverAt(e.range) ? [new InlineCompletionsHover(this, e.range, k)] : [];
	}
	renderHoverParts(e, O) {
		let k = new DisposableStore(), A = O[0];
		this._telemetryService.publicLog2("inlineCompletionHover.shown"), this.accessibilityService.isScreenReaderOptimized() && !this._editor.getOption(8) && k.add(this.renderScreenReaderText(e, A));
		let j = A.controller.model.get(), M = this._instantiationService.createInstance(InlineSuggestionHintsContentWidget, this._editor, !1, constObservable(null), j.selectedInlineCompletionIndex, j.inlineCompletionsCount, j.activeCommands), N = M.getDomNode();
		return e.fragment.appendChild(N), j.triggerExplicitly(), k.add(M), new RenderedHoverParts([{
			hoverPart: A,
			hoverElement: N,
			dispose() {
				k.dispose();
			}
		}]);
	}
	renderScreenReaderText(e, O) {
		let k = new DisposableStore(), A = $, j = A("div.hover-row.markdown-hover"), M = append(j, A("div.hover-contents", { "aria-live": "assertive" })), N = k.add(new MarkdownRenderer({ editor: this._editor }, this._languageService, this._openerService)), P = (O) => {
			k.add(N.onDidRenderAsync(() => {
				M.className = "hover-contents code-hover-contents", e.onContentsChanged();
			}));
			let A = localize("inlineSuggestionFollows", "Suggestion:"), j = k.add(N.render(new MarkdownString().appendText(A).appendCodeblock("text", O)));
			M.replaceChildren(j.element);
		};
		return k.add(autorun((e) => {
			let k = O.controller.model.read(e)?.primaryGhostText.read(e);
			if (k) {
				let e = this._editor.getModel().getLineContent(k.lineNumber);
				P(k.renderForScreenReader(e));
			} else reset(M);
		})), e.fragment.appendChild(j), k;
	}
};
InlineCompletionsHoverParticipant = __decorate$48([
	__param$48(1, ILanguageService),
	__param$48(2, IOpenerService),
	__param$48(3, IAccessibilityService),
	__param$48(4, IInstantiationService),
	__param$48(5, ITelemetryService)
], InlineCompletionsHoverParticipant);
var InlineCompletionsAccessibleView = class {};
const AccessibleViewRegistry = new class {
	constructor() {
		this._implementations = [];
	}
	register(e) {
		return this._implementations.push(e), { dispose: () => {
			let O = this._implementations.indexOf(e);
			O !== -1 && this._implementations.splice(O, 1);
		} };
	}
	getImplementations() {
		return this._implementations;
	}
}();
registerEditorContribution(InlineCompletionsController.ID, InlineCompletionsController, 3), registerEditorAction(TriggerInlineSuggestionAction), registerEditorAction(ShowNextInlineSuggestionAction), registerEditorAction(ShowPreviousInlineSuggestionAction), registerEditorAction(AcceptNextWordOfInlineCompletion), registerEditorAction(AcceptNextLineOfInlineCompletion), registerEditorAction(AcceptInlineCompletion), registerEditorAction(HideInlineCompletion), registerAction2(ToggleAlwaysShowInlineSuggestionToolbar), HoverParticipantRegistry.register(InlineCompletionsHoverParticipant), AccessibleViewRegistry.register(new InlineCompletionsAccessibleView());
var __decorate$47 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$47 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, GotoDefinitionAtPositionEditorContribution_1, GotoDefinitionAtPositionEditorContribution = class {
	static {
		GotoDefinitionAtPositionEditorContribution_1 = this;
	}
	static {
		this.ID = "editor.contrib.gotodefinitionatposition";
	}
	static {
		this.MAX_SOURCE_PREVIEW_LINES = 8;
	}
	constructor(e, O, k, A) {
		this.textModelResolverService = O, this.languageService = k, this.languageFeaturesService = A, this.toUnhook = new DisposableStore(), this.toUnhookForKeyboard = new DisposableStore(), this.currentWordAtPosition = null, this.previousPromise = null, this.editor = e, this.linkDecorations = this.editor.createDecorationsCollection();
		let j = new ClickLinkGesture(e);
		this.toUnhook.add(j), this.toUnhook.add(j.onMouseMoveOrRelevantKeyDown(([e, O]) => {
			this.startFindDefinitionFromMouse(e, O ?? void 0);
		})), this.toUnhook.add(j.onExecute((e) => {
			this.isEnabled(e) && this.gotoDefinition(e.target.position, e.hasSideBySideModifier).catch((e) => {
				onUnexpectedError(e);
			}).finally(() => {
				this.removeLinkDecorations();
			});
		})), this.toUnhook.add(j.onCancel(() => {
			this.removeLinkDecorations(), this.currentWordAtPosition = null;
		}));
	}
	static get(e) {
		return e.getContribution(GotoDefinitionAtPositionEditorContribution_1.ID);
	}
	async startFindDefinitionFromCursor(e) {
		await this.startFindDefinition(e), this.toUnhookForKeyboard.add(this.editor.onDidChangeCursorPosition(() => {
			this.currentWordAtPosition = null, this.removeLinkDecorations(), this.toUnhookForKeyboard.clear();
		})), this.toUnhookForKeyboard.add(this.editor.onKeyDown((e) => {
			e && (this.currentWordAtPosition = null, this.removeLinkDecorations(), this.toUnhookForKeyboard.clear());
		}));
	}
	startFindDefinitionFromMouse(e, O) {
		if (e.target.type === 9 && this.linkDecorations.length > 0) return;
		if (!this.editor.hasModel() || !this.isEnabled(e, O)) {
			this.currentWordAtPosition = null, this.removeLinkDecorations();
			return;
		}
		let k = e.target.position;
		this.startFindDefinition(k);
	}
	async startFindDefinition(e) {
		this.toUnhookForKeyboard.clear();
		let O = e ? this.editor.getModel()?.getWordAtPosition(e) : null;
		if (!O) {
			this.currentWordAtPosition = null, this.removeLinkDecorations();
			return;
		}
		if (this.currentWordAtPosition && this.currentWordAtPosition.startColumn === O.startColumn && this.currentWordAtPosition.endColumn === O.endColumn && this.currentWordAtPosition.word === O.word) return;
		this.currentWordAtPosition = O;
		let k = new EditorState(this.editor, 15);
		this.previousPromise &&= (this.previousPromise.cancel(), null), this.previousPromise = createCancelablePromise((O) => this.findDefinition(e, O));
		let A;
		try {
			A = await this.previousPromise;
		} catch (e) {
			onUnexpectedError(e);
			return;
		}
		if (!A || !A.length || !k.validate(this.editor)) {
			this.removeLinkDecorations();
			return;
		}
		let j = A[0].originSelectionRange ? Range.lift(A[0].originSelectionRange) : new Range(e.lineNumber, O.startColumn, e.lineNumber, O.endColumn);
		if (A.length > 1) {
			let e = j;
			for (let { originSelectionRange: O } of A) O && (e = Range.plusRange(e, O));
			this.addDecoration(e, new MarkdownString().appendText(localize("multipleResults", "Click to show {0} definitions.", A.length)));
		} else {
			let e = A[0];
			if (!e.uri) return;
			this.textModelResolverService.createModelReference(e.uri).then((O) => {
				if (!O.object || !O.object.textEditorModel) {
					O.dispose();
					return;
				}
				let { object: { textEditorModel: k } } = O, { startLineNumber: A } = e.range;
				if (A < 1 || A > k.getLineCount()) {
					O.dispose();
					return;
				}
				let M = this.getPreviewValue(k, A, e), N = this.languageService.guessLanguageIdByFilepathOrFirstLine(k.uri);
				this.addDecoration(j, M ? new MarkdownString().appendCodeblock(N || "", M) : void 0), O.dispose();
			});
		}
	}
	getPreviewValue(e, O, k) {
		let A = k.range;
		return A.endLineNumber - A.startLineNumber >= GotoDefinitionAtPositionEditorContribution_1.MAX_SOURCE_PREVIEW_LINES && (A = this.getPreviewRangeBasedOnIndentation(e, O)), this.stripIndentationFromPreviewRange(e, O, A);
	}
	stripIndentationFromPreviewRange(e, O, k) {
		let A = e.getLineFirstNonWhitespaceColumn(O);
		for (let j = O + 1; j < k.endLineNumber; j++) {
			let O = e.getLineFirstNonWhitespaceColumn(j);
			A = Math.min(A, O);
		}
		return e.getValueInRange(k).replace(RegExp(`^\\s{${A - 1}}`, "gm"), "").trim();
	}
	getPreviewRangeBasedOnIndentation(e, O) {
		let k = e.getLineFirstNonWhitespaceColumn(O), A = Math.min(e.getLineCount(), O + GotoDefinitionAtPositionEditorContribution_1.MAX_SOURCE_PREVIEW_LINES), j = O + 1;
		for (; j < A; j++) {
			let O = e.getLineFirstNonWhitespaceColumn(j);
			if (k === O) break;
		}
		return new Range(O, 1, j + 1, 1);
	}
	addDecoration(e, O) {
		let k = {
			range: e,
			options: {
				description: "goto-definition-link",
				inlineClassName: "goto-definition-link",
				hoverMessage: O
			}
		};
		this.linkDecorations.set([k]);
	}
	removeLinkDecorations() {
		this.linkDecorations.clear();
	}
	isEnabled(e, O) {
		return this.editor.hasModel() && e.isLeftClick && e.isNoneOrSingleMouseDown && e.target.type === 6 && !(e.target.detail.injectedText?.options instanceof ModelDecorationInjectedTextOptions) && (e.hasTriggerModifier || (O ? O.keyCodeIsTriggerKey : !1)) && this.languageFeaturesService.definitionProvider.has(this.editor.getModel());
	}
	findDefinition(e, O) {
		let k = this.editor.getModel();
		return k ? getDefinitionsAtPosition(this.languageFeaturesService.definitionProvider, k, e, !1, O) : Promise.resolve(null);
	}
	gotoDefinition(e, O) {
		return this.editor.setPosition(e), this.editor.invokeWithinContext((e) => {
			let k = !O && this.editor.getOption(89) && !this.isInPeekEditor(e);
			return new DefinitionAction({
				openToSide: O,
				openInPeek: k,
				muteMessage: !0
			}, {
				title: {
					value: "",
					original: ""
				},
				id: "",
				precondition: void 0
			}).run(e);
		});
	}
	isInPeekEditor(e) {
		let O = e.get(IContextKeyService);
		return PeekContext.inPeekEditor.getValue(O);
	}
	dispose() {
		this.toUnhook.dispose(), this.toUnhookForKeyboard.dispose();
	}
};
GotoDefinitionAtPositionEditorContribution = GotoDefinitionAtPositionEditorContribution_1 = __decorate$47([
	__param$47(1, ITextModelService),
	__param$47(2, ILanguageService),
	__param$47(3, ILanguageFeaturesService)
], GotoDefinitionAtPositionEditorContribution), registerEditorContribution(GotoDefinitionAtPositionEditorContribution.ID, GotoDefinitionAtPositionEditorContribution, 2);
var __decorate$46 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$46 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, MarkerCoordinate = class {
	constructor(e, O, k) {
		this.marker = e, this.index = O, this.total = k;
	}
}, MarkerList = class {
	constructor(e, O, k) {
		this._markerService = O, this._configService = k, this._onDidChange = new Emitter(), this.onDidChange = this._onDidChange.event, this._dispoables = new DisposableStore(), this._markers = [], this._nextIdx = -1, URI.isUri(e) ? this._resourceFilter = (O) => O.toString() === e.toString() : e && (this._resourceFilter = e);
		let A = this._configService.getValue("problems.sortOrder"), j = (e, O) => {
			let k = compare(e.resource.toString(), O.resource.toString());
			return k === 0 && (k = A === "position" ? Range.compareRangesUsingStarts(e, O) || MarkerSeverity.compare(e.severity, O.severity) : MarkerSeverity.compare(e.severity, O.severity) || Range.compareRangesUsingStarts(e, O)), k;
		}, M = () => {
			this._markers = this._markerService.read({
				resource: URI.isUri(e) ? e : void 0,
				severities: MarkerSeverity.Error | MarkerSeverity.Warning | MarkerSeverity.Info
			}), typeof e == "function" && (this._markers = this._markers.filter((e) => this._resourceFilter(e.resource))), this._markers.sort(j);
		};
		M(), this._dispoables.add(O.onMarkerChanged((e) => {
			(!this._resourceFilter || e.some((e) => this._resourceFilter(e))) && (M(), this._nextIdx = -1, this._onDidChange.fire());
		}));
	}
	dispose() {
		this._dispoables.dispose(), this._onDidChange.dispose();
	}
	matches(e) {
		return !this._resourceFilter && !e ? !0 : !this._resourceFilter || !e ? !1 : this._resourceFilter(e);
	}
	get selected() {
		let e = this._markers[this._nextIdx];
		return e && new MarkerCoordinate(e, this._nextIdx + 1, this._markers.length);
	}
	_initIdx(e, O, k) {
		let A = !1, j = this._markers.findIndex((O) => O.resource.toString() === e.uri.toString());
		j < 0 && (j = binarySearch(this._markers, { resource: e.uri }, (e, O) => compare(e.resource.toString(), O.resource.toString())), j < 0 && (j = ~j));
		for (let k = j; k < this._markers.length; k++) {
			let j = Range.lift(this._markers[k]);
			if (j.isEmpty()) {
				let O = e.getWordAtPosition(j.getStartPosition());
				O && (j = new Range(j.startLineNumber, O.startColumn, j.startLineNumber, O.endColumn));
			}
			if (O && (j.containsPosition(O) || O.isBeforeOrEqual(j.getStartPosition()))) {
				this._nextIdx = k, A = !0;
				break;
			}
			if (this._markers[k].resource.toString() !== e.uri.toString()) break;
		}
		A || (this._nextIdx = k ? 0 : this._markers.length - 1), this._nextIdx < 0 && (this._nextIdx = this._markers.length - 1);
	}
	resetIndex() {
		this._nextIdx = -1;
	}
	move(e, O, k) {
		if (this._markers.length === 0) return !1;
		let A = this._nextIdx;
		return this._nextIdx === -1 ? this._initIdx(O, k, e) : e ? this._nextIdx = (this._nextIdx + 1) % this._markers.length : e || (this._nextIdx = (this._nextIdx - 1 + this._markers.length) % this._markers.length), A !== this._nextIdx;
	}
	find(e, O) {
		let k = this._markers.findIndex((O) => O.resource.toString() === e.toString());
		if (!(k < 0)) {
			for (; k < this._markers.length; k++) if (Range.containsPosition(this._markers[k], O)) return new MarkerCoordinate(this._markers[k], k + 1, this._markers.length);
		}
	}
};
MarkerList = __decorate$46([__param$46(1, IMarkerService), __param$46(2, IConfigurationService)], MarkerList);
const IMarkerNavigationService = createDecorator("IMarkerNavigationService");
var MarkerNavigationService = class {
	constructor(e, O) {
		this._markerService = e, this._configService = O, this._provider = new LinkedList();
	}
	getMarkerList(e) {
		for (let O of this._provider) {
			let k = O.getMarkerList(e);
			if (k) return k;
		}
		return new MarkerList(e, this._markerService, this._configService);
	}
};
MarkerNavigationService = __decorate$46([__param$46(0, IMarkerService), __param$46(1, IConfigurationService)], MarkerNavigationService), registerSingleton(IMarkerNavigationService, MarkerNavigationService, 1);
var SeverityIcon;
(function(e) {
	function O(e) {
		switch (e) {
			case severity_default.Ignore: return "severity-ignore " + ThemeIcon.asClassName(Codicon.info);
			case severity_default.Info: return ThemeIcon.asClassName(Codicon.info);
			case severity_default.Warning: return ThemeIcon.asClassName(Codicon.warning);
			case severity_default.Error: return ThemeIcon.asClassName(Codicon.error);
			default: return "";
		}
	}
	e.className = O;
})(SeverityIcon ||= {});
var __decorate$45 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$45 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, MarkerNavigationWidget_1, MessageWidget = class {
	constructor(e, O, k, A, j) {
		this._openerService = A, this._labelService = j, this._lines = 0, this._longestLineLength = 0, this._relatedDiagnostics = /* @__PURE__ */ new WeakMap(), this._disposables = new DisposableStore(), this._editor = O;
		let M = document.createElement("div");
		M.className = "descriptioncontainer", this._messageBlock = document.createElement("div"), this._messageBlock.classList.add("message"), this._messageBlock.setAttribute("aria-live", "assertive"), this._messageBlock.setAttribute("role", "alert"), M.appendChild(this._messageBlock), this._relatedBlock = document.createElement("div"), M.appendChild(this._relatedBlock), this._disposables.add(addStandardDisposableListener(this._relatedBlock, "click", (e) => {
			e.preventDefault();
			let O = this._relatedDiagnostics.get(e.target);
			O && k(O);
		})), this._scrollable = new ScrollableElement(M, {
			horizontal: 1,
			vertical: 1,
			useShadows: !1,
			horizontalScrollbarSize: 6,
			verticalScrollbarSize: 6
		}), e.appendChild(this._scrollable.getDomNode()), this._disposables.add(this._scrollable.onScroll((e) => {
			M.style.left = `-${e.scrollLeft}px`, M.style.top = `-${e.scrollTop}px`;
		})), this._disposables.add(this._scrollable);
	}
	dispose() {
		dispose(this._disposables);
	}
	update(e) {
		let { source: O, message: k, relatedInformation: A, code: j } = e, M = (O?.length || 0) + 2;
		j && (typeof j == "string" ? M += j.length : M += j.value.length);
		let N = splitLines(k);
		this._lines = N.length, this._longestLineLength = 0;
		for (let e of N) this._longestLineLength = Math.max(e.length + M, this._longestLineLength);
		clearNode(this._messageBlock), this._messageBlock.setAttribute("aria-label", this.getAriaLabel(e)), this._editor.applyFontInfo(this._messageBlock);
		let P = this._messageBlock;
		for (let e of N) P = document.createElement("div"), P.innerText = e, e === "" && (P.style.height = this._messageBlock.style.lineHeight), this._messageBlock.appendChild(P);
		if (O || j) {
			let e = document.createElement("span");
			if (e.classList.add("details"), P.appendChild(e), O) {
				let k = document.createElement("span");
				k.innerText = O, k.classList.add("source"), e.appendChild(k);
			}
			if (j) if (typeof j == "string") {
				let O = document.createElement("span");
				O.innerText = `(${j})`, O.classList.add("code"), e.appendChild(O);
			} else {
				this._codeLink = $("a.code-link"), this._codeLink.setAttribute("href", `${j.target.toString()}`), this._codeLink.onclick = (e) => {
					this._openerService.open(j.target, { allowCommands: !0 }), e.preventDefault(), e.stopPropagation();
				};
				let O = append(this._codeLink, $("span"));
				O.innerText = j.value, e.appendChild(this._codeLink);
			}
		}
		if (clearNode(this._relatedBlock), this._editor.applyFontInfo(this._relatedBlock), isNonEmptyArray(A)) {
			let e = this._relatedBlock.appendChild(document.createElement("div"));
			e.style.paddingTop = `${Math.floor(this._editor.getOption(67) * .66)}px`, this._lines += 1;
			for (let O of A) {
				let k = document.createElement("div"), A = document.createElement("a");
				A.classList.add("filename"), A.innerText = `${this._labelService.getUriBasenameLabel(O.resource)}(${O.startLineNumber}, ${O.startColumn}): `, A.title = this._labelService.getUriLabel(O.resource), this._relatedDiagnostics.set(A, O);
				let j = document.createElement("span");
				j.innerText = O.message, k.appendChild(A), k.appendChild(j), this._lines += 1, e.appendChild(k);
			}
		}
		let F = this._editor.getOption(50), I = Math.ceil(F.typicalFullwidthCharacterWidth * this._longestLineLength * .75), L = F.lineHeight * this._lines;
		this._scrollable.setScrollDimensions({
			scrollWidth: I,
			scrollHeight: L
		});
	}
	layout(e, O) {
		this._scrollable.getDomNode().style.height = `${e}px`, this._scrollable.getDomNode().style.width = `${O}px`, this._scrollable.setScrollDimensions({
			width: O,
			height: e
		});
	}
	getHeightInLines() {
		return Math.min(17, this._lines);
	}
	getAriaLabel(e) {
		let O = "";
		switch (e.severity) {
			case MarkerSeverity.Error:
				O = localize("Error", "Error");
				break;
			case MarkerSeverity.Warning:
				O = localize("Warning", "Warning");
				break;
			case MarkerSeverity.Info:
				O = localize("Info", "Info");
				break;
			case MarkerSeverity.Hint:
				O = localize("Hint", "Hint");
				break;
		}
		let k = localize("marker aria", "{0} at {1}. ", O, e.startLineNumber + ":" + e.startColumn), A = this._editor.getModel();
		return A && e.startLineNumber <= A.getLineCount() && e.startLineNumber >= 1 && (k = `${A.getLineContent(e.startLineNumber)}, ${k}`), k;
	}
}, MarkerNavigationWidget = class extends PeekViewWidget {
	static {
		MarkerNavigationWidget_1 = this;
	}
	static {
		this.TitleMenu = new MenuId("gotoErrorTitleMenu");
	}
	constructor(e, O, k, A, j, M, N) {
		super(e, {
			showArrow: !0,
			showFrame: !0,
			isAccessible: !0,
			frameWidth: 1
		}, j), this._themeService = O, this._openerService = k, this._menuService = A, this._contextKeyService = M, this._labelService = N, this._callOnDispose = new DisposableStore(), this._onDidSelectRelatedInformation = new Emitter(), this.onDidSelectRelatedInformation = this._onDidSelectRelatedInformation.event, this._severity = MarkerSeverity.Warning, this._backgroundColor = Color.white, this._applyTheme(O.getColorTheme()), this._callOnDispose.add(O.onDidColorThemeChange(this._applyTheme.bind(this))), this.create();
	}
	_applyTheme(e) {
		this._backgroundColor = e.getColor(editorMarkerNavigationBackground);
		let O = editorMarkerNavigationError, k = editorMarkerNavigationErrorHeader;
		this._severity === MarkerSeverity.Warning ? (O = editorMarkerNavigationWarning, k = editorMarkerNavigationWarningHeader) : this._severity === MarkerSeverity.Info && (O = editorMarkerNavigationInfo, k = editorMarkerNavigationInfoHeader);
		let A = e.getColor(O), j = e.getColor(k);
		this.style({
			arrowColor: A,
			frameColor: A,
			headerBackgroundColor: j,
			primaryHeadingColor: e.getColor(peekViewTitleForeground),
			secondaryHeadingColor: e.getColor(peekViewTitleInfoForeground)
		});
	}
	_applyStyles() {
		this._parentContainer && (this._parentContainer.style.backgroundColor = this._backgroundColor ? this._backgroundColor.toString() : ""), super._applyStyles();
	}
	dispose() {
		this._callOnDispose.dispose(), super.dispose();
	}
	_fillHead(e) {
		super._fillHead(e), this._disposables.add(this._actionbarWidget.actionRunner.onWillRun((e) => this.editor.focus()));
		let O = [], k = this._menuService.getMenuActions(MarkerNavigationWidget_1.TitleMenu, this._contextKeyService);
		createAndFillInActionBarActions(k, O), this._actionbarWidget.push(O, {
			label: !1,
			icon: !0,
			index: 0
		});
	}
	_fillTitleIcon(e) {
		this._icon = append(e, $(""));
	}
	_fillBody(e) {
		this._parentContainer = e, e.classList.add("marker-widget"), this._parentContainer.tabIndex = 0, this._parentContainer.setAttribute("role", "tooltip"), this._container = document.createElement("div"), e.appendChild(this._container), this._message = new MessageWidget(this._container, this.editor, (e) => this._onDidSelectRelatedInformation.fire(e), this._openerService, this._labelService), this._disposables.add(this._message);
	}
	show() {
		throw Error("call showAtMarker");
	}
	showAtMarker(e, O, k) {
		this._container.classList.remove("stale"), this._message.update(e), this._severity = e.severity, this._applyTheme(this._themeService.getColorTheme());
		let A = Range.lift(e), j = this.editor.getPosition(), M = j && A.containsPosition(j) ? j : A.getStartPosition();
		super.show(M, this.computeRequiredHeight());
		let N = this.editor.getModel();
		if (N) {
			let e = k > 1 ? localize("problems", "{0} of {1} problems", O, k) : localize("change", "{0} of {1} problem", O, k);
			this.setTitle(basename(N.uri), e);
		}
		this._icon.className = `codicon ${SeverityIcon.className(MarkerSeverity.toSeverity(this._severity))}`, this.editor.revealPositionNearTop(M, 0), this.editor.focus();
	}
	updateMarker(e) {
		this._container.classList.remove("stale"), this._message.update(e);
	}
	showStale() {
		this._container.classList.add("stale"), this._relayout();
	}
	_doLayoutBody(e, O) {
		super._doLayoutBody(e, O), this._heightInPixel = e, this._message.layout(e, O), this._container.style.height = `${e}px`;
	}
	_onWidth(e) {
		this._message.layout(this._heightInPixel, e);
	}
	_relayout() {
		super._relayout(this.computeRequiredHeight());
	}
	computeRequiredHeight() {
		return 3 + this._message.getHeightInLines();
	}
};
MarkerNavigationWidget = MarkerNavigationWidget_1 = __decorate$45([
	__param$45(1, IThemeService),
	__param$45(2, IOpenerService),
	__param$45(3, IMenuService),
	__param$45(4, IInstantiationService),
	__param$45(5, IContextKeyService),
	__param$45(6, ILabelService)
], MarkerNavigationWidget);
var errorDefault = oneOf(editorErrorForeground, editorErrorBorder), warningDefault = oneOf(editorWarningForeground, editorWarningBorder), infoDefault = oneOf(editorInfoForeground, editorInfoBorder), editorMarkerNavigationError = registerColor("editorMarkerNavigationError.background", {
	dark: errorDefault,
	light: errorDefault,
	hcDark: contrastBorder,
	hcLight: contrastBorder
}, localize("editorMarkerNavigationError", "Editor marker navigation widget error color.")), editorMarkerNavigationErrorHeader = registerColor("editorMarkerNavigationError.headerBackground", {
	dark: transparent(editorMarkerNavigationError, .1),
	light: transparent(editorMarkerNavigationError, .1),
	hcDark: null,
	hcLight: null
}, localize("editorMarkerNavigationErrorHeaderBackground", "Editor marker navigation widget error heading background.")), editorMarkerNavigationWarning = registerColor("editorMarkerNavigationWarning.background", {
	dark: warningDefault,
	light: warningDefault,
	hcDark: contrastBorder,
	hcLight: contrastBorder
}, localize("editorMarkerNavigationWarning", "Editor marker navigation widget warning color.")), editorMarkerNavigationWarningHeader = registerColor("editorMarkerNavigationWarning.headerBackground", {
	dark: transparent(editorMarkerNavigationWarning, .1),
	light: transparent(editorMarkerNavigationWarning, .1),
	hcDark: "#0C141F",
	hcLight: transparent(editorMarkerNavigationWarning, .2)
}, localize("editorMarkerNavigationWarningBackground", "Editor marker navigation widget warning heading background.")), editorMarkerNavigationInfo = registerColor("editorMarkerNavigationInfo.background", {
	dark: infoDefault,
	light: infoDefault,
	hcDark: contrastBorder,
	hcLight: contrastBorder
}, localize("editorMarkerNavigationInfo", "Editor marker navigation widget info color.")), editorMarkerNavigationInfoHeader = registerColor("editorMarkerNavigationInfo.headerBackground", {
	dark: transparent(editorMarkerNavigationInfo, .1),
	light: transparent(editorMarkerNavigationInfo, .1),
	hcDark: null,
	hcLight: null
}, localize("editorMarkerNavigationInfoHeaderBackground", "Editor marker navigation widget info heading background.")), editorMarkerNavigationBackground = registerColor("editorMarkerNavigation.background", editorBackground, localize("editorMarkerNavigationBackground", "Editor marker navigation widget background.")), __decorate$44 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$44 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, MarkerController_1, MarkerController = class {
	static {
		MarkerController_1 = this;
	}
	static {
		this.ID = "editor.contrib.markerController";
	}
	static get(e) {
		return e.getContribution(MarkerController_1.ID);
	}
	constructor(e, O, k, A, j) {
		this._markerNavigationService = O, this._contextKeyService = k, this._editorService = A, this._instantiationService = j, this._sessionDispoables = new DisposableStore(), this._editor = e, this._widgetVisible = CONTEXT_MARKERS_NAVIGATION_VISIBLE.bindTo(this._contextKeyService);
	}
	dispose() {
		this._cleanUp(), this._sessionDispoables.dispose();
	}
	_cleanUp() {
		this._widgetVisible.reset(), this._sessionDispoables.clear(), this._widget = void 0, this._model = void 0;
	}
	_getOrCreateModel(e) {
		if (this._model && this._model.matches(e)) return this._model;
		let O = !1;
		return this._model && (O = !0, this._cleanUp()), this._model = this._markerNavigationService.getMarkerList(e), O && this._model.move(!0, this._editor.getModel(), this._editor.getPosition()), this._widget = this._instantiationService.createInstance(MarkerNavigationWidget, this._editor), this._widget.onDidClose(() => this.close(), this, this._sessionDispoables), this._widgetVisible.set(!0), this._sessionDispoables.add(this._model), this._sessionDispoables.add(this._widget), this._sessionDispoables.add(this._editor.onDidChangeCursorPosition((e) => {
			(!this._model?.selected || !Range.containsPosition(this._model?.selected.marker, e.position)) && this._model?.resetIndex();
		})), this._sessionDispoables.add(this._model.onDidChange(() => {
			if (!this._widget || !this._widget.position || !this._model) return;
			let e = this._model.find(this._editor.getModel().uri, this._widget.position);
			e ? this._widget.updateMarker(e.marker) : this._widget.showStale();
		})), this._sessionDispoables.add(this._widget.onDidSelectRelatedInformation((e) => {
			this._editorService.openCodeEditor({
				resource: e.resource,
				options: {
					pinned: !0,
					revealIfOpened: !0,
					selection: Range.lift(e).collapseToStart()
				}
			}, this._editor), this.close(!1);
		})), this._sessionDispoables.add(this._editor.onDidChangeModel(() => this._cleanUp())), this._model;
	}
	close(e = !0) {
		this._cleanUp(), e && this._editor.focus();
	}
	showAtMarker(e) {
		if (this._editor.hasModel()) {
			let O = this._getOrCreateModel(this._editor.getModel().uri);
			O.resetIndex(), O.move(!0, this._editor.getModel(), new Position(e.startLineNumber, e.startColumn)), O.selected && this._widget.showAtMarker(O.selected.marker, O.selected.index, O.selected.total);
		}
	}
	async nagivate(e, O) {
		if (this._editor.hasModel()) {
			let k = this._getOrCreateModel(O ? void 0 : this._editor.getModel().uri);
			if (k.move(e, this._editor.getModel(), this._editor.getPosition()), !k.selected) return;
			if (k.selected.marker.resource.toString() !== this._editor.getModel().uri.toString()) {
				this._cleanUp();
				let A = await this._editorService.openCodeEditor({
					resource: k.selected.marker.resource,
					options: {
						pinned: !1,
						revealIfOpened: !0,
						selectionRevealType: 2,
						selection: k.selected.marker
					}
				}, this._editor);
				A && (MarkerController_1.get(A)?.close(), MarkerController_1.get(A)?.nagivate(e, O));
			} else this._widget.showAtMarker(k.selected.marker, k.selected.index, k.selected.total);
		}
	}
};
MarkerController = MarkerController_1 = __decorate$44([
	__param$44(1, IMarkerNavigationService),
	__param$44(2, IContextKeyService),
	__param$44(3, ICodeEditorService),
	__param$44(4, IInstantiationService)
], MarkerController);
var MarkerNavigationAction = class extends EditorAction {
	constructor(e, O, k) {
		super(k), this._next = e, this._multiFile = O;
	}
	async run(e, O) {
		O.hasModel() && MarkerController.get(O)?.nagivate(this._next, this._multiFile);
	}
}, NextMarkerAction = class e extends MarkerNavigationAction {
	static {
		this.ID = "editor.action.marker.next";
	}
	static {
		this.LABEL = localize("markerAction.next.label", "Go to Next Problem (Error, Warning, Info)");
	}
	constructor() {
		super(!0, !1, {
			id: e.ID,
			label: e.LABEL,
			alias: "Go to Next Problem (Error, Warning, Info)",
			precondition: void 0,
			kbOpts: {
				kbExpr: EditorContextKeys.focus,
				primary: 578,
				weight: 100
			},
			menuOpts: {
				menuId: MarkerNavigationWidget.TitleMenu,
				title: e.LABEL,
				icon: registerIcon("marker-navigation-next", Codicon.arrowDown, localize("nextMarkerIcon", "Icon for goto next marker.")),
				group: "navigation",
				order: 1
			}
		});
	}
}, PrevMarkerAction = class e extends MarkerNavigationAction {
	static {
		this.ID = "editor.action.marker.prev";
	}
	static {
		this.LABEL = localize("markerAction.previous.label", "Go to Previous Problem (Error, Warning, Info)");
	}
	constructor() {
		super(!1, !1, {
			id: e.ID,
			label: e.LABEL,
			alias: "Go to Previous Problem (Error, Warning, Info)",
			precondition: void 0,
			kbOpts: {
				kbExpr: EditorContextKeys.focus,
				primary: 1602,
				weight: 100
			},
			menuOpts: {
				menuId: MarkerNavigationWidget.TitleMenu,
				title: e.LABEL,
				icon: registerIcon("marker-navigation-previous", Codicon.arrowUp, localize("previousMarkerIcon", "Icon for goto previous marker.")),
				group: "navigation",
				order: 2
			}
		});
	}
}, NextMarkerInFilesAction = class extends MarkerNavigationAction {
	constructor() {
		super(!0, !0, {
			id: "editor.action.marker.nextInFiles",
			label: localize("markerAction.nextInFiles.label", "Go to Next Problem in Files (Error, Warning, Info)"),
			alias: "Go to Next Problem in Files (Error, Warning, Info)",
			precondition: void 0,
			kbOpts: {
				kbExpr: EditorContextKeys.focus,
				primary: 66,
				weight: 100
			},
			menuOpts: {
				menuId: MenuId.MenubarGoMenu,
				title: localize({
					key: "miGotoNextProblem",
					comment: ["&& denotes a mnemonic"]
				}, "Next &&Problem"),
				group: "6_problem_nav",
				order: 1
			}
		});
	}
}, PrevMarkerInFilesAction = class extends MarkerNavigationAction {
	constructor() {
		super(!1, !0, {
			id: "editor.action.marker.prevInFiles",
			label: localize("markerAction.previousInFiles.label", "Go to Previous Problem in Files (Error, Warning, Info)"),
			alias: "Go to Previous Problem in Files (Error, Warning, Info)",
			precondition: void 0,
			kbOpts: {
				kbExpr: EditorContextKeys.focus,
				primary: 1090,
				weight: 100
			},
			menuOpts: {
				menuId: MenuId.MenubarGoMenu,
				title: localize({
					key: "miGotoPreviousProblem",
					comment: ["&& denotes a mnemonic"]
				}, "Previous &&Problem"),
				group: "6_problem_nav",
				order: 2
			}
		});
	}
};
registerEditorContribution(MarkerController.ID, MarkerController, 4), registerEditorAction(NextMarkerAction), registerEditorAction(PrevMarkerAction), registerEditorAction(NextMarkerInFilesAction), registerEditorAction(PrevMarkerInFilesAction);
var CONTEXT_MARKERS_NAVIGATION_VISIBLE = new RawContextKey("markersNavigationVisible", !1), MarkerCommand = EditorCommand.bindToContribution(MarkerController.get);
registerEditorCommand(new MarkerCommand({
	id: "closeMarkersNavigation",
	precondition: CONTEXT_MARKERS_NAVIGATION_VISIBLE,
	handler: (e) => e.close(),
	kbOpts: {
		weight: 150,
		kbExpr: EditorContextKeys.focus,
		primary: 9,
		secondary: [1033]
	}
}));
var HoverFocusBehavior;
(function(e) {
	e.NoAutoFocus = "noAutoFocus", e.FocusIfVisible = "focusIfVisible", e.AutoFocusImmediately = "autoFocusImmediately";
})(HoverFocusBehavior ||= {});
var ShowOrFocusHoverAction = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.showHover",
			label: localize({
				key: "showOrFocusHover",
				comment: [
					"Label for action that will trigger the showing/focusing of a hover in the editor.",
					"If the hover is not visible, it will show the hover.",
					"This allows for users to show the hover without using the mouse."
				]
			}, "Show or Focus Hover"),
			metadata: {
				description: localize2("showOrFocusHoverDescription", "Show or focus the editor hover which shows documentation, references, and other content for a symbol at the current cursor position."),
				args: [{
					name: "args",
					schema: {
						type: "object",
						properties: { focus: {
							description: "Controls if and when the hover should take focus upon being triggered by this action.",
							enum: [
								HoverFocusBehavior.NoAutoFocus,
								HoverFocusBehavior.FocusIfVisible,
								HoverFocusBehavior.AutoFocusImmediately
							],
							enumDescriptions: [
								localize("showOrFocusHover.focus.noAutoFocus", "The hover will not automatically take focus."),
								localize("showOrFocusHover.focus.focusIfVisible", "The hover will take focus only if it is already visible."),
								localize("showOrFocusHover.focus.autoFocusImmediately", "The hover will automatically take focus when it appears.")
							],
							default: HoverFocusBehavior.FocusIfVisible
						} }
					}
				}]
			},
			alias: "Show or Focus Hover",
			precondition: void 0,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: KeyChord(2089, 2087),
				weight: 100
			}
		});
	}
	run(e, O, k) {
		if (!O.hasModel()) return;
		let A = ContentHoverController.get(O);
		if (!A) return;
		let j = k?.focus, M = HoverFocusBehavior.FocusIfVisible;
		Object.values(HoverFocusBehavior).includes(j) ? M = j : typeof j == "boolean" && j && (M = HoverFocusBehavior.AutoFocusImmediately);
		let N = (e) => {
			let k = O.getPosition(), j = new Range(k.lineNumber, k.column, k.lineNumber, k.column);
			A.showContentHover(j, 1, 1, e);
		}, P = O.getOption(2) === 2;
		A.isHoverVisible ? M === HoverFocusBehavior.NoAutoFocus ? N(P) : A.focus() : N(P || M === HoverFocusBehavior.AutoFocusImmediately);
	}
}, ShowDefinitionPreviewHoverAction = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.showDefinitionPreviewHover",
			label: localize({
				key: "showDefinitionPreviewHover",
				comment: ["Label for action that will trigger the showing of definition preview hover in the editor.", "This allows for users to show the definition preview hover without using the mouse."]
			}, "Show Definition Preview Hover"),
			alias: "Show Definition Preview Hover",
			precondition: void 0,
			metadata: { description: localize2("showDefinitionPreviewHoverDescription", "Show the definition preview hover in the editor.") }
		});
	}
	run(e, O) {
		let k = ContentHoverController.get(O);
		if (!k) return;
		let A = O.getPosition();
		if (!A) return;
		let j = new Range(A.lineNumber, A.column, A.lineNumber, A.column), M = GotoDefinitionAtPositionEditorContribution.get(O);
		M && M.startFindDefinitionFromCursor(A).then(() => {
			k.showContentHover(j, 1, 1, !0);
		});
	}
}, ScrollUpHoverAction = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.scrollUpHover",
			label: localize({
				key: "scrollUpHover",
				comment: ["Action that allows to scroll up in the hover widget with the up arrow when the hover widget is focused."]
			}, "Scroll Up Hover"),
			alias: "Scroll Up Hover",
			precondition: EditorContextKeys.hoverFocused,
			kbOpts: {
				kbExpr: EditorContextKeys.hoverFocused,
				primary: 16,
				weight: 100
			},
			metadata: { description: localize2("scrollUpHoverDescription", "Scroll up the editor hover.") }
		});
	}
	run(e, O) {
		let k = ContentHoverController.get(O);
		k && k.scrollUp();
	}
}, ScrollDownHoverAction = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.scrollDownHover",
			label: localize({
				key: "scrollDownHover",
				comment: ["Action that allows to scroll down in the hover widget with the up arrow when the hover widget is focused."]
			}, "Scroll Down Hover"),
			alias: "Scroll Down Hover",
			precondition: EditorContextKeys.hoverFocused,
			kbOpts: {
				kbExpr: EditorContextKeys.hoverFocused,
				primary: 18,
				weight: 100
			},
			metadata: { description: localize2("scrollDownHoverDescription", "Scroll down the editor hover.") }
		});
	}
	run(e, O) {
		let k = ContentHoverController.get(O);
		k && k.scrollDown();
	}
}, ScrollLeftHoverAction = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.scrollLeftHover",
			label: localize({
				key: "scrollLeftHover",
				comment: ["Action that allows to scroll left in the hover widget with the left arrow when the hover widget is focused."]
			}, "Scroll Left Hover"),
			alias: "Scroll Left Hover",
			precondition: EditorContextKeys.hoverFocused,
			kbOpts: {
				kbExpr: EditorContextKeys.hoverFocused,
				primary: 15,
				weight: 100
			},
			metadata: { description: localize2("scrollLeftHoverDescription", "Scroll left the editor hover.") }
		});
	}
	run(e, O) {
		let k = ContentHoverController.get(O);
		k && k.scrollLeft();
	}
}, ScrollRightHoverAction = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.scrollRightHover",
			label: localize({
				key: "scrollRightHover",
				comment: ["Action that allows to scroll right in the hover widget with the right arrow when the hover widget is focused."]
			}, "Scroll Right Hover"),
			alias: "Scroll Right Hover",
			precondition: EditorContextKeys.hoverFocused,
			kbOpts: {
				kbExpr: EditorContextKeys.hoverFocused,
				primary: 17,
				weight: 100
			},
			metadata: { description: localize2("scrollRightHoverDescription", "Scroll right the editor hover.") }
		});
	}
	run(e, O) {
		let k = ContentHoverController.get(O);
		k && k.scrollRight();
	}
}, PageUpHoverAction = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.pageUpHover",
			label: localize({
				key: "pageUpHover",
				comment: ["Action that allows to page up in the hover widget with the page up command when the hover widget is focused."]
			}, "Page Up Hover"),
			alias: "Page Up Hover",
			precondition: EditorContextKeys.hoverFocused,
			kbOpts: {
				kbExpr: EditorContextKeys.hoverFocused,
				primary: 11,
				secondary: [528],
				weight: 100
			},
			metadata: { description: localize2("pageUpHoverDescription", "Page up the editor hover.") }
		});
	}
	run(e, O) {
		let k = ContentHoverController.get(O);
		k && k.pageUp();
	}
}, PageDownHoverAction = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.pageDownHover",
			label: localize({
				key: "pageDownHover",
				comment: ["Action that allows to page down in the hover widget with the page down command when the hover widget is focused."]
			}, "Page Down Hover"),
			alias: "Page Down Hover",
			precondition: EditorContextKeys.hoverFocused,
			kbOpts: {
				kbExpr: EditorContextKeys.hoverFocused,
				primary: 12,
				secondary: [530],
				weight: 100
			},
			metadata: { description: localize2("pageDownHoverDescription", "Page down the editor hover.") }
		});
	}
	run(e, O) {
		let k = ContentHoverController.get(O);
		k && k.pageDown();
	}
}, GoToTopHoverAction = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.goToTopHover",
			label: localize({
				key: "goToTopHover",
				comment: ["Action that allows to go to the top of the hover widget with the home command when the hover widget is focused."]
			}, "Go To Top Hover"),
			alias: "Go To Bottom Hover",
			precondition: EditorContextKeys.hoverFocused,
			kbOpts: {
				kbExpr: EditorContextKeys.hoverFocused,
				primary: 14,
				secondary: [2064],
				weight: 100
			},
			metadata: { description: localize2("goToTopHoverDescription", "Go to the top of the editor hover.") }
		});
	}
	run(e, O) {
		let k = ContentHoverController.get(O);
		k && k.goToTop();
	}
}, GoToBottomHoverAction = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.goToBottomHover",
			label: localize({
				key: "goToBottomHover",
				comment: ["Action that allows to go to the bottom in the hover widget with the end command when the hover widget is focused."]
			}, "Go To Bottom Hover"),
			alias: "Go To Bottom Hover",
			precondition: EditorContextKeys.hoverFocused,
			kbOpts: {
				kbExpr: EditorContextKeys.hoverFocused,
				primary: 13,
				secondary: [2066],
				weight: 100
			},
			metadata: { description: localize2("goToBottomHoverDescription", "Go to the bottom of the editor hover.") }
		});
	}
	run(e, O) {
		let k = ContentHoverController.get(O);
		k && k.goToBottom();
	}
}, IncreaseHoverVerbosityLevel = class extends EditorAction {
	constructor() {
		super({
			id: INCREASE_HOVER_VERBOSITY_ACTION_ID,
			label: INCREASE_HOVER_VERBOSITY_ACTION_LABEL,
			alias: "Increase Hover Verbosity Level",
			precondition: EditorContextKeys.hoverVisible
		});
	}
	run(e, O, k) {
		let A = ContentHoverController.get(O);
		if (!A) return;
		let j = k?.index === void 0 ? A.focusedHoverPartIndex() : k.index;
		A.updateHoverVerbosityLevel(HoverVerbosityAction.Increase, j, k?.focus);
	}
}, DecreaseHoverVerbosityLevel = class extends EditorAction {
	constructor() {
		super({
			id: DECREASE_HOVER_VERBOSITY_ACTION_ID,
			label: DECREASE_HOVER_VERBOSITY_ACTION_LABEL,
			alias: "Decrease Hover Verbosity Level",
			precondition: EditorContextKeys.hoverVisible
		});
	}
	run(e, O, k) {
		let A = ContentHoverController.get(O);
		if (!A) return;
		let j = k?.index === void 0 ? A.focusedHoverPartIndex() : k.index;
		ContentHoverController.get(O)?.updateHoverVerbosityLevel(HoverVerbosityAction.Decrease, j, k?.focus);
	}
}, __decorate$43 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$43 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, $$3 = $, MarkerHover = class {
	constructor(e, O, k) {
		this.owner = e, this.range = O, this.marker = k;
	}
	isValidForHoverAnchor(e) {
		return e.type === 1 && this.range.startColumn <= e.range.startColumn && this.range.endColumn >= e.range.endColumn;
	}
}, markerCodeActionTrigger = {
	type: 1,
	filter: { include: CodeActionKind.QuickFix },
	triggerAction: CodeActionTriggerSource.QuickFixHover
}, MarkerHoverParticipant = class {
	constructor(e, O, k, A) {
		this._editor = e, this._markerDecorationsService = O, this._openerService = k, this._languageFeaturesService = A, this.hoverOrdinal = 1, this.recentMarkerCodeActionsInfo = void 0;
	}
	computeSync(e, O) {
		if (!this._editor.hasModel() || e.type !== 1 && !e.supportsMarkerHover) return [];
		let k = this._editor.getModel(), A = e.range.startLineNumber, j = k.getLineMaxColumn(A), M = [];
		for (let N of O) {
			let O = N.range.startLineNumber === A ? N.range.startColumn : 1, P = N.range.endLineNumber === A ? N.range.endColumn : j, F = this._markerDecorationsService.getMarker(k.uri, N);
			if (!F) continue;
			let I = new Range(e.range.startLineNumber, O, e.range.startLineNumber, P);
			M.push(new MarkerHover(this, I, F));
		}
		return M;
	}
	renderHoverParts(e, O) {
		if (!O.length) return new RenderedHoverParts([]);
		let k = new DisposableStore(), A = [];
		O.forEach((O) => {
			let k = this._renderMarkerHover(O);
			e.fragment.appendChild(k.hoverElement), A.push(k);
		});
		let j = O.length === 1 ? O[0] : O.sort((e, O) => MarkerSeverity.compare(e.marker.severity, O.marker.severity))[0];
		return this.renderMarkerStatusbar(e, j, k), new RenderedHoverParts(A);
	}
	_renderMarkerHover(e) {
		let O = new DisposableStore(), k = $$3("div.hover-row"), A = append(k, $$3("div.marker.hover-contents")), { source: j, message: M, code: N, relatedInformation: P } = e.marker;
		this._editor.applyFontInfo(A);
		let F = append(A, $$3("span"));
		if (F.style.whiteSpace = "pre-wrap", F.innerText = M, j || N) if (N && typeof N != "string") {
			let e = $$3("span");
			if (j) {
				let O = append(e, $$3("span"));
				O.innerText = j;
			}
			let k = append(e, $$3("a.code-link"));
			k.setAttribute("href", N.target.toString()), O.add(addDisposableListener(k, "click", (e) => {
				this._openerService.open(N.target, { allowCommands: !0 }), e.preventDefault(), e.stopPropagation();
			}));
			let M = append(k, $$3("span"));
			M.innerText = N.value;
			let P = append(A, e);
			P.style.opacity = "0.6", P.style.paddingLeft = "6px";
		} else {
			let e = append(A, $$3("span"));
			e.style.opacity = "0.6", e.style.paddingLeft = "6px", e.innerText = j && N ? `${j}(${N})` : j || `(${N})`;
		}
		if (isNonEmptyArray(P)) for (let { message: e, resource: k, startLineNumber: j, startColumn: M } of P) {
			let N = append(A, $$3("div"));
			N.style.marginTop = "8px";
			let P = append(N, $$3("a"));
			P.innerText = `${basename(k)}(${j}, ${M}): `, P.style.cursor = "pointer", O.add(addDisposableListener(P, "click", (e) => {
				if (e.stopPropagation(), e.preventDefault(), this._openerService) {
					let e = { selection: {
						startLineNumber: j,
						startColumn: M
					} };
					this._openerService.open(k, {
						fromUserGesture: !0,
						editorOptions: e
					}).catch(onUnexpectedError);
				}
			}));
			let F = append(N, $$3("span"));
			F.innerText = e, this._editor.applyFontInfo(F);
		}
		return {
			hoverPart: e,
			hoverElement: k,
			dispose: () => O.dispose()
		};
	}
	renderMarkerStatusbar(e, O, k) {
		if (O.marker.severity === MarkerSeverity.Error || O.marker.severity === MarkerSeverity.Warning || O.marker.severity === MarkerSeverity.Info) {
			let k = MarkerController.get(this._editor);
			k && e.statusBar.addAction({
				label: localize("view problem", "View Problem"),
				commandId: NextMarkerAction.ID,
				run: () => {
					e.hide(), k.showAtMarker(O.marker), this._editor.focus();
				}
			});
		}
		if (!this._editor.getOption(92)) {
			let A = e.statusBar.append($$3("div"));
			this.recentMarkerCodeActionsInfo && (IMarkerData.makeKey(this.recentMarkerCodeActionsInfo.marker) === IMarkerData.makeKey(O.marker) ? this.recentMarkerCodeActionsInfo.hasCodeActions || (A.textContent = localize("noQuickFixes", "No quick fixes available")) : this.recentMarkerCodeActionsInfo = void 0);
			let j = this.recentMarkerCodeActionsInfo && !this.recentMarkerCodeActionsInfo.hasCodeActions ? Disposable.None : disposableTimeout(() => A.textContent = localize("checkingForQuickFixes", "Checking for quick fixes..."), 200, k);
			A.textContent ||= "\xA0";
			let M = this.getCodeActions(O.marker);
			k.add(toDisposable(() => M.cancel())), M.then((M) => {
				if (j.dispose(), this.recentMarkerCodeActionsInfo = {
					marker: O.marker,
					hasCodeActions: M.validActions.length > 0
				}, !this.recentMarkerCodeActionsInfo.hasCodeActions) {
					M.dispose(), A.textContent = localize("noQuickFixes", "No quick fixes available");
					return;
				}
				A.style.display = "none";
				let N = !1;
				k.add(toDisposable(() => {
					N || M.dispose();
				})), e.statusBar.addAction({
					label: localize("quick fixes", "Quick Fix..."),
					commandId: quickFixCommandId,
					run: (O) => {
						N = !0;
						let k = CodeActionController.get(this._editor), A = getDomNodePagePosition(O);
						e.hide(), k?.showCodeActions(markerCodeActionTrigger, M, {
							x: A.left,
							y: A.top,
							width: A.width,
							height: A.height
						});
					}
				});
			}, onUnexpectedError);
		}
	}
	getCodeActions(e) {
		return createCancelablePromise((O) => getCodeActions(this._languageFeaturesService.codeActionProvider, this._editor.getModel(), new Range(e.startLineNumber, e.startColumn, e.endLineNumber, e.endColumn), markerCodeActionTrigger, Progress.None, O));
	}
};
MarkerHoverParticipant = __decorate$43([
	__param$43(1, IMarkerDecorationsService),
	__param$43(2, IOpenerService),
	__param$43(3, ILanguageFeaturesService)
], MarkerHoverParticipant);
var MarginHoverComputer = class {
	get lineNumber() {
		return this._lineNumber;
	}
	set lineNumber(e) {
		this._lineNumber = e;
	}
	get lane() {
		return this._laneOrLine;
	}
	set lane(e) {
		this._laneOrLine = e;
	}
	constructor(e) {
		this._editor = e, this._lineNumber = -1, this._laneOrLine = GlyphMarginLane.Center;
	}
	computeSync() {
		let e = (e) => ({ value: e }), O = this._editor.getLineDecorations(this._lineNumber), k = [], A = this._laneOrLine === "lineNo";
		if (!O) return k;
		for (let j of O) {
			let O = j.options.glyphMargin?.position ?? GlyphMarginLane.Center;
			if (!A && O !== this._laneOrLine) continue;
			let M = A ? j.options.lineNumberHoverMessage : j.options.glyphMarginHoverMessage;
			!M || isEmptyMarkdownString(M) || k.push(...asArray(M).map(e));
		}
		return k;
	}
}, __decorate$42 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$42 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, MarginHoverWidget_1, $$2 = $, MarginHoverWidget = class extends Disposable {
	static {
		MarginHoverWidget_1 = this;
	}
	static {
		this.ID = "editor.contrib.modesGlyphHoverWidget";
	}
	constructor(e, O, k) {
		super(), this._renderDisposeables = this._register(new DisposableStore()), this._editor = e, this._isVisible = !1, this._messages = [], this._hover = this._register(new HoverWidget()), this._hover.containerDomNode.classList.toggle("hidden", !this._isVisible), this._markdownRenderer = this._register(new MarkdownRenderer({ editor: this._editor }, O, k)), this._computer = new MarginHoverComputer(this._editor), this._hoverOperation = this._register(new HoverOperation(this._editor, this._computer)), this._register(this._hoverOperation.onResult((e) => {
			this._withResult(e.value);
		})), this._register(this._editor.onDidChangeModelDecorations(() => this._onModelDecorationsChanged())), this._register(this._editor.onDidChangeConfiguration((e) => {
			e.hasChanged(50) && this._updateFont();
		})), this._register(addStandardDisposableListener(this._hover.containerDomNode, "mouseleave", (e) => {
			this._onMouseLeave(e);
		})), this._editor.addOverlayWidget(this);
	}
	dispose() {
		this._editor.removeOverlayWidget(this), super.dispose();
	}
	getId() {
		return MarginHoverWidget_1.ID;
	}
	getDomNode() {
		return this._hover.containerDomNode;
	}
	getPosition() {
		return null;
	}
	_updateFont() {
		Array.prototype.slice.call(this._hover.contentsDomNode.getElementsByClassName("code")).forEach((e) => this._editor.applyFontInfo(e));
	}
	_onModelDecorationsChanged() {
		this._isVisible && (this._hoverOperation.cancel(), this._hoverOperation.start(0));
	}
	showsOrWillShow(e) {
		let O = e.target;
		return O.type === 2 && O.detail.glyphMarginLane ? (this._startShowingAt(O.position.lineNumber, O.detail.glyphMarginLane), !0) : O.type === 3 ? (this._startShowingAt(O.position.lineNumber, "lineNo"), !0) : !1;
	}
	_startShowingAt(e, O) {
		this._computer.lineNumber === e && this._computer.lane === O || (this._hoverOperation.cancel(), this.hide(), this._computer.lineNumber = e, this._computer.lane = O, this._hoverOperation.start(0));
	}
	hide() {
		this._computer.lineNumber = -1, this._hoverOperation.cancel(), this._isVisible && (this._isVisible = !1, this._hover.containerDomNode.classList.toggle("hidden", !this._isVisible));
	}
	_withResult(e) {
		this._messages = e, this._messages.length > 0 ? this._renderMessages(this._computer.lineNumber, this._messages) : this.hide();
	}
	_renderMessages(e, O) {
		this._renderDisposeables.clear();
		let k = document.createDocumentFragment();
		for (let e of O) {
			let O = $$2("div.hover-row.markdown-hover"), A = append(O, $$2("div.hover-contents")), j = this._renderDisposeables.add(this._markdownRenderer.render(e.value));
			A.appendChild(j.element), k.appendChild(O);
		}
		this._updateContents(k), this._showAt(e);
	}
	_updateContents(e) {
		this._hover.contentsDomNode.textContent = "", this._hover.contentsDomNode.appendChild(e), this._updateFont();
	}
	_showAt(e) {
		this._isVisible || (this._isVisible = !0, this._hover.containerDomNode.classList.toggle("hidden", !this._isVisible));
		let O = this._editor.getLayoutInfo(), k = this._editor.getTopForLineNumber(e), A = this._editor.getScrollTop(), j = this._editor.getOption(67), M = this._hover.containerDomNode.clientHeight, N = k - A - (M - j) / 2, P = O.glyphMarginLeft + O.glyphMarginWidth + (this._computer.lane === "lineNo" ? O.lineNumbersWidth : 0);
		this._hover.containerDomNode.style.left = `${P}px`, this._hover.containerDomNode.style.top = `${Math.max(Math.round(N), 0)}px`;
	}
	_onMouseLeave(e) {
		let O = this._editor.getDomNode();
		(!O || !isMousePositionWithinElement(O, e.x, e.y)) && this.hide();
	}
};
MarginHoverWidget = MarginHoverWidget_1 = __decorate$42([__param$42(1, ILanguageService), __param$42(2, IOpenerService)], MarginHoverWidget);
var __decorate$41 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$41 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, MarginHoverController = class extends Disposable {
	static {
		this.ID = "editor.contrib.marginHover";
	}
	constructor(e, O) {
		super(), this._editor = e, this._instantiationService = O, this.shouldKeepOpenOnEditorMouseMoveOrLeave = !1, this._listenersStore = new DisposableStore(), this._hoverState = { mouseDown: !1 }, this._reactToEditorMouseMoveRunner = this._register(new RunOnceScheduler(() => this._reactToEditorMouseMove(this._mouseMoveEvent), 0)), this._hookListeners(), this._register(this._editor.onDidChangeConfiguration((e) => {
			e.hasChanged(60) && (this._unhookListeners(), this._hookListeners());
		}));
	}
	_hookListeners() {
		let e = this._editor.getOption(60);
		this._hoverSettings = {
			enabled: e.enabled,
			sticky: e.sticky,
			hidingDelay: e.hidingDelay
		}, e.enabled ? (this._listenersStore.add(this._editor.onMouseDown((e) => this._onEditorMouseDown(e))), this._listenersStore.add(this._editor.onMouseUp(() => this._onEditorMouseUp())), this._listenersStore.add(this._editor.onMouseMove((e) => this._onEditorMouseMove(e))), this._listenersStore.add(this._editor.onKeyDown((e) => this._onKeyDown(e)))) : (this._listenersStore.add(this._editor.onMouseMove((e) => this._onEditorMouseMove(e))), this._listenersStore.add(this._editor.onKeyDown((e) => this._onKeyDown(e)))), this._listenersStore.add(this._editor.onMouseLeave((e) => this._onEditorMouseLeave(e))), this._listenersStore.add(this._editor.onDidChangeModel(() => {
			this._cancelScheduler(), this._hideWidgets();
		})), this._listenersStore.add(this._editor.onDidChangeModelContent(() => this._cancelScheduler())), this._listenersStore.add(this._editor.onDidScrollChange((e) => this._onEditorScrollChanged(e)));
	}
	_unhookListeners() {
		this._listenersStore.clear();
	}
	_cancelScheduler() {
		this._mouseMoveEvent = void 0, this._reactToEditorMouseMoveRunner.cancel();
	}
	_onEditorScrollChanged(e) {
		(e.scrollTopChanged || e.scrollLeftChanged) && this._hideWidgets();
	}
	_onEditorMouseDown(e) {
		this._hoverState.mouseDown = !0, !this._isMouseOnMarginHoverWidget(e) && this._hideWidgets();
	}
	_isMouseOnMarginHoverWidget(e) {
		let O = this._glyphWidget?.getDomNode();
		return O ? isMousePositionWithinElement(O, e.event.posx, e.event.posy) : !1;
	}
	_onEditorMouseUp() {
		this._hoverState.mouseDown = !1;
	}
	_onEditorMouseLeave(e) {
		this.shouldKeepOpenOnEditorMouseMoveOrLeave || (this._cancelScheduler(), !this._isMouseOnMarginHoverWidget(e) && this._hideWidgets());
	}
	_shouldNotRecomputeCurrentHoverWidget(e) {
		let O = this._hoverSettings.sticky, k = this._isMouseOnMarginHoverWidget(e);
		return O && k;
	}
	_onEditorMouseMove(e) {
		if (!this.shouldKeepOpenOnEditorMouseMoveOrLeave) {
			if (this._mouseMoveEvent = e, this._shouldNotRecomputeCurrentHoverWidget(e)) {
				this._reactToEditorMouseMoveRunner.cancel();
				return;
			}
			this._reactToEditorMouseMove(e);
		}
	}
	_reactToEditorMouseMove(e) {
		e && (this._tryShowHoverWidget(e) || this._hideWidgets());
	}
	_tryShowHoverWidget(e) {
		return this._getOrCreateGlyphWidget().showsOrWillShow(e);
	}
	_onKeyDown(e) {
		this._editor.hasModel() && (e.keyCode === 5 || e.keyCode === 6 || e.keyCode === 57 || e.keyCode === 4 || this._hideWidgets());
	}
	_hideWidgets() {
		this._glyphWidget?.hide();
	}
	_getOrCreateGlyphWidget() {
		return this._glyphWidget ||= this._instantiationService.createInstance(MarginHoverWidget, this._editor), this._glyphWidget;
	}
	dispose() {
		super.dispose(), this._unhookListeners(), this._listenersStore.dispose(), this._glyphWidget?.dispose();
	}
};
MarginHoverController = __decorate$41([__param$41(1, IInstantiationService)], MarginHoverController);
var HoverAccessibleView = class {}, HoverAccessibilityHelp = class {}, ExtHoverAccessibleView = class {};
registerEditorContribution(ContentHoverController.ID, ContentHoverController, 2), registerEditorContribution(MarginHoverController.ID, MarginHoverController, 2), registerEditorAction(ShowOrFocusHoverAction), registerEditorAction(ShowDefinitionPreviewHoverAction), registerEditorAction(ScrollUpHoverAction), registerEditorAction(ScrollDownHoverAction), registerEditorAction(ScrollLeftHoverAction), registerEditorAction(ScrollRightHoverAction), registerEditorAction(PageUpHoverAction), registerEditorAction(PageDownHoverAction), registerEditorAction(GoToTopHoverAction), registerEditorAction(GoToBottomHoverAction), registerEditorAction(IncreaseHoverVerbosityLevel), registerEditorAction(DecreaseHoverVerbosityLevel), HoverParticipantRegistry.register(MarkdownHoverParticipant), HoverParticipantRegistry.register(MarkerHoverParticipant), registerThemingParticipant((e, O) => {
	let k = e.getColor(editorHoverBorder);
	k && (O.addRule(`.monaco-editor .monaco-hover .hover-row:not(:first-child):not(:empty) { border-top: 1px solid ${k.transparent(.5)}; }`), O.addRule(`.monaco-editor .monaco-hover hr { border-top: 1px solid ${k.transparent(.5)}; }`), O.addRule(`.monaco-editor .monaco-hover hr { border-bottom: 0px solid ${k.transparent(.5)}; }`));
}), AccessibleViewRegistry.register(new HoverAccessibleView()), AccessibleViewRegistry.register(new HoverAccessibilityHelp()), AccessibleViewRegistry.register(new ExtHoverAccessibleView());
function getSpaceCnt(e, O) {
	let k = 0;
	for (let A = 0; A < e.length; A++) e.charAt(A) === "	" ? k += O : k++;
	return k;
}
function generateIndent(e, O, k) {
	e = e < 0 ? 0 : e;
	let A = "";
	if (!k) {
		let k = Math.floor(e / O);
		e %= O;
		for (let e = 0; e < k; e++) A += "	";
	}
	for (let O = 0; O < e; O++) A += " ";
	return A;
}
function getReindentEditOperations(e, O, k, A) {
	if (e.getLineCount() === 1 && e.getLineMaxColumn(1) === 1) return [];
	let j = O.getLanguageConfiguration(e.getLanguageId()).indentRulesSupport;
	if (!j) return [];
	let M = new ProcessedIndentRulesSupport(e, j, O);
	for (A = Math.min(A, e.getLineCount()); k <= A && M.shouldIgnore(k);) k++;
	if (k > A - 1) return [];
	let { tabSize: N, indentSize: P, insertSpaces: F } = e.getOptions(), I = (e, O) => (O ||= 1, ShiftCommand.shiftIndent(e, e.length + O, N, P, F)), L = (e, O) => (O ||= 1, ShiftCommand.unshiftIndent(e, e.length + O, N, P, F)), R = [], z = e.getLineContent(k), B = getLeadingWhitespace(z), V = B;
	M.shouldIncrease(k) ? (V = I(V), B = I(B)) : M.shouldIndentNextLine(k) && (V = I(V)), k++;
	for (let O = k; O <= A; O++) {
		if (doesLineStartWithString(e, O)) continue;
		let k = e.getLineContent(O), A = getLeadingWhitespace(k), j = V;
		M.shouldDecrease(O, j) && (V = L(V), B = L(B)), A !== V && R.push(EditOperation.replaceMove(new Selection(O, 1, O, A.length + 1), normalizeIndentation(V, P, F))), !M.shouldIgnore(O) && (M.shouldIncrease(O, j) ? (B = I(B), V = B) : V = M.shouldIndentNextLine(O, j) ? I(V) : B);
	}
	return R;
}
function doesLineStartWithString(e, O) {
	return e.tokenization.isCheapToTokenize(O) ? e.tokenization.getLineTokens(O).getStandardTokenType(0) === 2 : !1;
}
var __decorate$40 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$40 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, IndentationToSpacesAction = class e extends EditorAction {
	static {
		this.ID = "editor.action.indentationToSpaces";
	}
	constructor() {
		super({
			id: e.ID,
			label: localize("indentationToSpaces", "Convert Indentation to Spaces"),
			alias: "Convert Indentation to Spaces",
			precondition: EditorContextKeys.writable,
			metadata: { description: localize2("indentationToSpacesDescription", "Convert the tab indentation to spaces.") }
		});
	}
	run(e, O) {
		let k = O.getModel();
		if (!k) return;
		let A = k.getOptions(), j = O.getSelection();
		if (!j) return;
		let M = new IndentationToSpacesCommand(j, A.tabSize);
		O.pushUndoStop(), O.executeCommands(this.id, [M]), O.pushUndoStop(), k.updateOptions({ insertSpaces: !0 });
	}
}, IndentationToTabsAction = class e extends EditorAction {
	static {
		this.ID = "editor.action.indentationToTabs";
	}
	constructor() {
		super({
			id: e.ID,
			label: localize("indentationToTabs", "Convert Indentation to Tabs"),
			alias: "Convert Indentation to Tabs",
			precondition: EditorContextKeys.writable,
			metadata: { description: localize2("indentationToTabsDescription", "Convert the spaces indentation to tabs.") }
		});
	}
	run(e, O) {
		let k = O.getModel();
		if (!k) return;
		let A = k.getOptions(), j = O.getSelection();
		if (!j) return;
		let M = new IndentationToTabsCommand(j, A.tabSize);
		O.pushUndoStop(), O.executeCommands(this.id, [M]), O.pushUndoStop(), k.updateOptions({ insertSpaces: !1 });
	}
}, ChangeIndentationSizeAction = class extends EditorAction {
	constructor(e, O, k) {
		super(k), this.insertSpaces = e, this.displaySizeOnly = O;
	}
	run(e, O) {
		let k = e.get(IQuickInputService), A = e.get(IModelService), j = O.getModel();
		if (!j) return;
		let M = A.getCreationOptions(j.getLanguageId(), j.uri, j.isForSimpleWidget), N = j.getOptions(), P = [
			1,
			2,
			3,
			4,
			5,
			6,
			7,
			8
		].map((e) => ({
			id: e.toString(),
			label: e.toString(),
			description: e === M.tabSize && e === N.tabSize ? localize("configuredTabSize", "Configured Tab Size") : e === M.tabSize ? localize("defaultTabSize", "Default Tab Size") : e === N.tabSize ? localize("currentTabSize", "Current Tab Size") : void 0
		})), F = Math.min(j.getOptions().tabSize - 1, 7);
		setTimeout(() => {
			k.pick(P, {
				placeHolder: localize({
					key: "selectTabWidth",
					comment: ["Tab corresponds to the tab key"]
				}, "Select Tab Size for Current File"),
				activeItem: P[F]
			}).then((e) => {
				if (e && j && !j.isDisposed()) {
					let O = parseInt(e.label, 10);
					this.displaySizeOnly ? j.updateOptions({ tabSize: O }) : j.updateOptions({
						tabSize: O,
						indentSize: O,
						insertSpaces: this.insertSpaces
					});
				}
			});
		}, 50);
	}
}, IndentUsingTabs = class e extends ChangeIndentationSizeAction {
	static {
		this.ID = "editor.action.indentUsingTabs";
	}
	constructor() {
		super(!1, !1, {
			id: e.ID,
			label: localize("indentUsingTabs", "Indent Using Tabs"),
			alias: "Indent Using Tabs",
			precondition: void 0,
			metadata: { description: localize2("indentUsingTabsDescription", "Use indentation with tabs.") }
		});
	}
}, IndentUsingSpaces = class e extends ChangeIndentationSizeAction {
	static {
		this.ID = "editor.action.indentUsingSpaces";
	}
	constructor() {
		super(!0, !1, {
			id: e.ID,
			label: localize("indentUsingSpaces", "Indent Using Spaces"),
			alias: "Indent Using Spaces",
			precondition: void 0,
			metadata: { description: localize2("indentUsingSpacesDescription", "Use indentation with spaces.") }
		});
	}
}, ChangeTabDisplaySize = class e extends ChangeIndentationSizeAction {
	static {
		this.ID = "editor.action.changeTabDisplaySize";
	}
	constructor() {
		super(!0, !0, {
			id: e.ID,
			label: localize("changeTabDisplaySize", "Change Tab Display Size"),
			alias: "Change Tab Display Size",
			precondition: void 0,
			metadata: { description: localize2("changeTabDisplaySizeDescription", "Change the space size equivalent of the tab.") }
		});
	}
}, DetectIndentation = class e extends EditorAction {
	static {
		this.ID = "editor.action.detectIndentation";
	}
	constructor() {
		super({
			id: e.ID,
			label: localize("detectIndentation", "Detect Indentation from Content"),
			alias: "Detect Indentation from Content",
			precondition: void 0,
			metadata: { description: localize2("detectIndentationDescription", "Detect the indentation from content.") }
		});
	}
	run(e, O) {
		let k = e.get(IModelService), A = O.getModel();
		if (!A) return;
		let j = k.getCreationOptions(A.getLanguageId(), A.uri, A.isForSimpleWidget);
		A.detectIndentation(j.insertSpaces, j.tabSize);
	}
}, ReindentLinesAction = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.reindentlines",
			label: localize("editor.reindentlines", "Reindent Lines"),
			alias: "Reindent Lines",
			precondition: EditorContextKeys.writable,
			metadata: { description: localize2("editor.reindentlinesDescription", "Reindent the lines of the editor.") }
		});
	}
	run(e, O) {
		let k = e.get(ILanguageConfigurationService), A = O.getModel();
		if (!A) return;
		let j = getReindentEditOperations(A, k, 1, A.getLineCount());
		j.length > 0 && (O.pushUndoStop(), O.executeEdits(this.id, j), O.pushUndoStop());
	}
}, ReindentSelectedLinesAction = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.reindentselectedlines",
			label: localize("editor.reindentselectedlines", "Reindent Selected Lines"),
			alias: "Reindent Selected Lines",
			precondition: EditorContextKeys.writable,
			metadata: { description: localize2("editor.reindentselectedlinesDescription", "Reindent the selected lines of the editor.") }
		});
	}
	run(e, O) {
		let k = e.get(ILanguageConfigurationService), A = O.getModel();
		if (!A) return;
		let j = O.getSelections();
		if (j === null) return;
		let M = [];
		for (let e of j) {
			let O = e.startLineNumber, j = e.endLineNumber;
			if (O !== j && e.endColumn === 1 && j--, O === 1) {
				if (O === j) continue;
			} else O--;
			let N = getReindentEditOperations(A, k, O, j);
			M.push(...N);
		}
		M.length > 0 && (O.pushUndoStop(), O.executeEdits(this.id, M), O.pushUndoStop());
	}
}, AutoIndentOnPasteCommand = class {
	constructor(e, O) {
		this._initialSelection = O, this._edits = [], this._selectionId = null;
		for (let O of e) O.range && typeof O.text == "string" && this._edits.push(O);
	}
	getEditOperations(e, O) {
		for (let e of this._edits) O.addEditOperation(Range.lift(e.range), e.text);
		let k = !1;
		Array.isArray(this._edits) && this._edits.length === 1 && this._initialSelection.isEmpty() && (this._edits[0].range.startColumn === this._initialSelection.endColumn && this._edits[0].range.startLineNumber === this._initialSelection.endLineNumber ? (k = !0, this._selectionId = O.trackSelection(this._initialSelection, !0)) : this._edits[0].range.endColumn === this._initialSelection.startColumn && this._edits[0].range.endLineNumber === this._initialSelection.startLineNumber && (k = !0, this._selectionId = O.trackSelection(this._initialSelection, !1))), k || (this._selectionId = O.trackSelection(this._initialSelection));
	}
	computeCursorState(e, O) {
		return O.getTrackedSelection(this._selectionId);
	}
}, AutoIndentOnPaste = class {
	static {
		this.ID = "editor.contrib.autoIndentOnPaste";
	}
	constructor(e, O) {
		this.editor = e, this._languageConfigurationService = O, this.callOnDispose = new DisposableStore(), this.callOnModel = new DisposableStore(), this.callOnDispose.add(e.onDidChangeConfiguration(() => this.update())), this.callOnDispose.add(e.onDidChangeModel(() => this.update())), this.callOnDispose.add(e.onDidChangeModelLanguage(() => this.update()));
	}
	update() {
		this.callOnModel.clear(), !(this.editor.getOption(12) < 4 || this.editor.getOption(55)) && this.editor.hasModel() && this.callOnModel.add(this.editor.onDidPaste(({ range: e }) => {
			this.trigger(e);
		}));
	}
	trigger(e) {
		let O = this.editor.getSelections();
		if (O === null || O.length > 1) return;
		let k = this.editor.getModel();
		if (!k || this.rangeContainsOnlyWhitespaceCharacters(k, e) || isStartOrEndInString(k, e) || !k.tokenization.isCheapToTokenize(e.getStartPosition().lineNumber)) return;
		let A = this.editor.getOption(12), { tabSize: j, indentSize: M, insertSpaces: N } = k.getOptions(), P = [], F = {
			shiftIndent: (e) => ShiftCommand.shiftIndent(e, e.length + 1, j, M, N),
			unshiftIndent: (e) => ShiftCommand.unshiftIndent(e, e.length + 1, j, M, N)
		}, I = e.startLineNumber;
		for (; I <= e.endLineNumber;) {
			if (this.shouldIgnoreLine(k, I)) {
				I++;
				continue;
			}
			break;
		}
		if (I > e.endLineNumber) return;
		let L = k.getLineContent(I);
		if (!/\S/.test(L.substring(0, e.startColumn - 1))) {
			let e = getGoodIndentForLine(A, k, k.getLanguageId(), I, F, this._languageConfigurationService);
			if (e !== null) {
				let O = getLeadingWhitespace(L), A = getSpaceCnt(e, j), M = getSpaceCnt(O, j);
				if (A !== M) {
					let e = generateIndent(A, j, N);
					P.push({
						range: new Range(I, 1, I, O.length + 1),
						text: e
					}), L = e + L.substring(O.length);
				} else {
					let e = getIndentMetadata(k, I, this._languageConfigurationService);
					if (e === 0 || e === 8) return;
				}
			}
		}
		let R = I;
		for (; I < e.endLineNumber;) {
			if (!/\S/.test(k.getLineContent(I + 1))) {
				I++;
				continue;
			}
			break;
		}
		if (I !== e.endLineNumber) {
			let O = getGoodIndentForLine(A, {
				tokenization: {
					getLineTokens: (e) => k.tokenization.getLineTokens(e),
					getLanguageId: () => k.getLanguageId(),
					getLanguageIdAtPosition: (e, O) => k.getLanguageIdAtPosition(e, O)
				},
				getLineContent: (e) => e === R ? L : k.getLineContent(e)
			}, k.getLanguageId(), I + 1, F, this._languageConfigurationService);
			if (O !== null) {
				let A = getSpaceCnt(O, j), M = getSpaceCnt(getLeadingWhitespace(k.getLineContent(I + 1)), j);
				if (A !== M) {
					let O = A - M;
					for (let A = I + 1; A <= e.endLineNumber; A++) {
						let e = k.getLineContent(A), M = getLeadingWhitespace(e), F = getSpaceCnt(M, j) + O, I = generateIndent(F, j, N);
						I !== M && P.push({
							range: new Range(A, 1, A, M.length + 1),
							text: I
						});
					}
				}
			}
		}
		if (P.length > 0) {
			this.editor.pushUndoStop();
			let e = new AutoIndentOnPasteCommand(P, this.editor.getSelection());
			this.editor.executeCommand("autoIndentOnPaste", e), this.editor.pushUndoStop();
		}
	}
	rangeContainsOnlyWhitespaceCharacters(e, O) {
		let k = (e) => e.trim().length === 0, A = !0;
		if (O.startLineNumber === O.endLineNumber) {
			let j = e.getLineContent(O.startLineNumber).substring(O.startColumn - 1, O.endColumn - 1);
			A = k(j);
		} else for (let j = O.startLineNumber; j <= O.endLineNumber; j++) {
			let M = e.getLineContent(j);
			if (j === O.startLineNumber) {
				let e = M.substring(O.startColumn - 1);
				A = k(e);
			} else if (j === O.endLineNumber) {
				let e = M.substring(0, O.endColumn - 1);
				A = k(e);
			} else A = e.getLineFirstNonWhitespaceColumn(j) === 0;
			if (!A) break;
		}
		return A;
	}
	shouldIgnoreLine(e, O) {
		e.tokenization.forceTokenization(O);
		let k = e.getLineFirstNonWhitespaceColumn(O);
		if (k === 0) return !0;
		let A = e.tokenization.getLineTokens(O);
		if (A.getCount() > 0) {
			let e = A.findTokenIndexAtOffset(k);
			if (e >= 0 && A.getStandardTokenType(e) === 1) return !0;
		}
		return !1;
	}
	dispose() {
		this.callOnDispose.dispose(), this.callOnModel.dispose();
	}
};
AutoIndentOnPaste = __decorate$40([__param$40(1, ILanguageConfigurationService)], AutoIndentOnPaste);
function isStartOrEndInString(e, O) {
	let k = (O) => getStandardTokenTypeAtPosition(e, O) === 2;
	return k(O.getStartPosition()) || k(O.getEndPosition());
}
function getIndentationEditOperations(e, O, k, A) {
	if (e.getLineCount() === 1 && e.getLineMaxColumn(1) === 1) return;
	let j = "";
	for (let e = 0; e < k; e++) j += " ";
	let M = new RegExp(j, "gi");
	for (let k = 1, N = e.getLineCount(); k <= N; k++) {
		let N = e.getLineFirstNonWhitespaceColumn(k);
		if (N === 0 && (N = e.getLineMaxColumn(k)), N === 1) continue;
		let P = new Range(k, 1, k, N), F = e.getValueInRange(P), I = A ? F.replace(/\t/gi, j) : F.replace(M, "	");
		O.addEditOperation(P, I);
	}
}
var IndentationToSpacesCommand = class {
	constructor(e, O) {
		this.selection = e, this.tabSize = O, this.selectionId = null;
	}
	getEditOperations(e, O) {
		this.selectionId = O.trackSelection(this.selection), getIndentationEditOperations(e, O, this.tabSize, !0);
	}
	computeCursorState(e, O) {
		return O.getTrackedSelection(this.selectionId);
	}
}, IndentationToTabsCommand = class {
	constructor(e, O) {
		this.selection = e, this.tabSize = O, this.selectionId = null;
	}
	getEditOperations(e, O) {
		this.selectionId = O.trackSelection(this.selection), getIndentationEditOperations(e, O, this.tabSize, !1);
	}
	computeCursorState(e, O) {
		return O.getTrackedSelection(this.selectionId);
	}
};
registerEditorContribution(AutoIndentOnPaste.ID, AutoIndentOnPaste, 2), registerEditorAction(IndentationToSpacesAction), registerEditorAction(IndentationToTabsAction), registerEditorAction(IndentUsingTabs), registerEditorAction(IndentUsingSpaces), registerEditorAction(ChangeTabDisplaySize), registerEditorAction(DetectIndentation), registerEditorAction(ReindentLinesAction), registerEditorAction(ReindentSelectedLinesAction), registerEditorContribution(InlayHintsController.ID, InlayHintsController, 1), HoverParticipantRegistry.register(InlayHintsHover);
var InPlaceReplaceCommand = class {
	constructor(e, O, k) {
		this._editRange = e, this._originalSelection = O, this._text = k;
	}
	getEditOperations(e, O) {
		O.addTrackedEditOperation(this._editRange, this._text);
	}
	computeCursorState(e, O) {
		let k = O.getInverseEditOperations()[0].range;
		return this._originalSelection.isEmpty() ? new Selection(k.endLineNumber, Math.min(this._originalSelection.positionColumn, k.endColumn), k.endLineNumber, Math.min(this._originalSelection.positionColumn, k.endColumn)) : new Selection(k.endLineNumber, k.endColumn - this._text.length, k.endLineNumber, k.endColumn);
	}
}, __decorate$39 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$39 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, InPlaceReplaceController_1, InPlaceReplaceController = class {
	static {
		InPlaceReplaceController_1 = this;
	}
	static {
		this.ID = "editor.contrib.inPlaceReplaceController";
	}
	static get(e) {
		return e.getContribution(InPlaceReplaceController_1.ID);
	}
	static {
		this.DECORATION = ModelDecorationOptions.register({
			description: "in-place-replace",
			className: "valueSetReplacement"
		});
	}
	constructor(e, O) {
		this.editor = e, this.editorWorkerService = O, this.decorations = this.editor.createDecorationsCollection();
	}
	dispose() {}
	run(e, O) {
		this.currentRequest?.cancel();
		let k = this.editor.getSelection(), A = this.editor.getModel();
		if (!A || !k) return;
		let j = k;
		if (j.startLineNumber !== j.endLineNumber) return;
		let M = new EditorState(this.editor, 5), N = A.uri;
		return this.editorWorkerService.canNavigateValueSet(N) ? (this.currentRequest = createCancelablePromise((e) => this.editorWorkerService.navigateValueSet(N, j, O)), this.currentRequest.then((O) => {
			if (!O || !O.range || !O.value || !M.validate(this.editor)) return;
			let k = Range.lift(O.range), A = O.range, N = O.value.length - (j.endColumn - j.startColumn);
			A = {
				startLineNumber: A.startLineNumber,
				startColumn: A.startColumn,
				endLineNumber: A.endLineNumber,
				endColumn: A.startColumn + O.value.length
			}, N > 1 && (j = new Selection(j.startLineNumber, j.startColumn, j.endLineNumber, j.endColumn + N - 1));
			let P = new InPlaceReplaceCommand(k, j, O.value);
			this.editor.pushUndoStop(), this.editor.executeCommand(e, P), this.editor.pushUndoStop(), this.decorations.set([{
				range: A,
				options: InPlaceReplaceController_1.DECORATION
			}]), this.decorationRemover?.cancel(), this.decorationRemover = timeout(350), this.decorationRemover.then(() => this.decorations.clear()).catch(onUnexpectedError);
		}).catch(onUnexpectedError)) : Promise.resolve(void 0);
	}
};
InPlaceReplaceController = InPlaceReplaceController_1 = __decorate$39([__param$39(1, IEditorWorkerService)], InPlaceReplaceController);
var InPlaceReplaceUp = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.inPlaceReplace.up",
			label: localize("InPlaceReplaceAction.previous.label", "Replace with Previous Value"),
			alias: "Replace with Previous Value",
			precondition: EditorContextKeys.writable,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: 3159,
				weight: 100
			}
		});
	}
	run(e, O) {
		let k = InPlaceReplaceController.get(O);
		return k ? k.run(this.id, !1) : Promise.resolve(void 0);
	}
}, InPlaceReplaceDown = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.inPlaceReplace.down",
			label: localize("InPlaceReplaceAction.next.label", "Replace with Next Value"),
			alias: "Replace with Next Value",
			precondition: EditorContextKeys.writable,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: 3161,
				weight: 100
			}
		});
	}
	run(e, O) {
		let k = InPlaceReplaceController.get(O);
		return k ? k.run(this.id, !0) : Promise.resolve(void 0);
	}
};
registerEditorContribution(InPlaceReplaceController.ID, InPlaceReplaceController, 4), registerEditorAction(InPlaceReplaceUp), registerEditorAction(InPlaceReplaceDown), registerEditorAction(class extends EditorAction {
	constructor() {
		super({
			id: "expandLineSelection",
			label: localize("expandLineSelection", "Expand Line Selection"),
			alias: "Expand Line Selection",
			precondition: void 0,
			kbOpts: {
				weight: 0,
				kbExpr: EditorContextKeys.textInputFocus,
				primary: 2090
			}
		});
	}
	run(e, O, k) {
		if (k ||= {}, !O.hasModel()) return;
		let A = O._getViewModel();
		A.model.pushStackElement(), A.setCursorStates(k.source, 3, CursorMoveCommands.expandLineSelection(A, A.getCursorStates())), A.revealAllCursors(k.source, !0);
	}
});
var TrimTrailingWhitespaceCommand = class {
	constructor(e, O, k) {
		this._selection = e, this._cursors = O, this._selectionId = null, this._trimInRegexesAndStrings = k;
	}
	getEditOperations(e, O) {
		let k = trimTrailingWhitespace(e, this._cursors, this._trimInRegexesAndStrings);
		for (let e = 0, A = k.length; e < A; e++) {
			let A = k[e];
			O.addEditOperation(A.range, A.text);
		}
		this._selectionId = O.trackSelection(this._selection);
	}
	computeCursorState(e, O) {
		return O.getTrackedSelection(this._selectionId);
	}
};
function trimTrailingWhitespace(e, O, k) {
	O.sort((e, O) => e.lineNumber === O.lineNumber ? e.column - O.column : e.lineNumber - O.lineNumber);
	for (let e = O.length - 2; e >= 0; e--) O[e].lineNumber === O[e + 1].lineNumber && O.splice(e, 1);
	let A = [], j = 0, M = 0, N = O.length;
	for (let P = 1, F = e.getLineCount(); P <= F; P++) {
		let F = e.getLineContent(P), I = F.length + 1, L = 0;
		if (M < N && O[M].lineNumber === P && (L = O[M].column, M++, L === I) || F.length === 0) continue;
		let R = lastNonWhitespaceIndex(F), z = 0;
		if (R === -1) z = 1;
		else if (R !== F.length - 1) z = R + 2;
		else continue;
		if (!k) {
			if (!e.tokenization.hasAccurateTokensForLine(P)) continue;
			let O = e.tokenization.getLineTokens(P), k = O.getStandardTokenType(O.findTokenIndexAtOffset(z));
			if (k === 2 || k === 3) continue;
		}
		z = Math.max(L, z), A[j++] = EditOperation.delete(new Range(P, z, P, I));
	}
	return A;
}
var CopyLinesCommand = class {
	constructor(e, O, k) {
		this._selection = e, this._isCopyingDown = O, this._noop = k || !1, this._selectionDirection = 0, this._selectionId = null, this._startLineNumberDelta = 0, this._endLineNumberDelta = 0;
	}
	getEditOperations(e, O) {
		let k = this._selection;
		this._startLineNumberDelta = 0, this._endLineNumberDelta = 0, k.startLineNumber < k.endLineNumber && k.endColumn === 1 && (this._endLineNumberDelta = 1, k = k.setEndPosition(k.endLineNumber - 1, e.getLineMaxColumn(k.endLineNumber - 1)));
		let A = [];
		for (let O = k.startLineNumber; O <= k.endLineNumber; O++) A.push(e.getLineContent(O));
		let j = A.join("\n");
		j === "" && this._isCopyingDown && (this._startLineNumberDelta++, this._endLineNumberDelta++), this._noop ? O.addEditOperation(new Range(k.endLineNumber, e.getLineMaxColumn(k.endLineNumber), k.endLineNumber + 1, 1), k.endLineNumber === e.getLineCount() ? "" : "\n") : this._isCopyingDown ? O.addEditOperation(new Range(k.startLineNumber, 1, k.startLineNumber, 1), j + "\n") : O.addEditOperation(new Range(k.endLineNumber, e.getLineMaxColumn(k.endLineNumber), k.endLineNumber, e.getLineMaxColumn(k.endLineNumber)), "\n" + j), this._selectionId = O.trackSelection(k), this._selectionDirection = this._selection.getDirection();
	}
	computeCursorState(e, O) {
		let k = O.getTrackedSelection(this._selectionId);
		if (this._startLineNumberDelta !== 0 || this._endLineNumberDelta !== 0) {
			let e = k.startLineNumber, O = k.startColumn, A = k.endLineNumber, j = k.endColumn;
			this._startLineNumberDelta !== 0 && (e += this._startLineNumberDelta, O = 1), this._endLineNumberDelta !== 0 && (A += this._endLineNumberDelta, j = 1), k = Selection.createWithDirection(e, O, A, j, this._selectionDirection);
		}
		return k;
	}
}, __decorate$38 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$38 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, MoveLinesCommand = class {
	constructor(e, O, k, A) {
		this._languageConfigurationService = A, this._selection = e, this._isMovingDown = O, this._autoIndent = k, this._selectionId = null, this._moveEndLineSelectionShrink = !1;
	}
	getEditOperations(e, O) {
		let k = () => e.getLanguageId(), A = (O, k) => e.getLanguageIdAtPosition(O, k), j = e.getLineCount();
		if (this._isMovingDown && this._selection.endLineNumber === j) {
			this._selectionId = O.trackSelection(this._selection);
			return;
		}
		if (!this._isMovingDown && this._selection.startLineNumber === 1) {
			this._selectionId = O.trackSelection(this._selection);
			return;
		}
		this._moveEndPositionDown = !1;
		let M = this._selection;
		M.startLineNumber < M.endLineNumber && M.endColumn === 1 && (this._moveEndPositionDown = !0, M = M.setEndPosition(M.endLineNumber - 1, e.getLineMaxColumn(M.endLineNumber - 1)));
		let { tabSize: N, indentSize: P, insertSpaces: F } = e.getOptions(), I = this.buildIndentConverter(N, P, F);
		if (M.startLineNumber === M.endLineNumber && e.getLineMaxColumn(M.startLineNumber) === 1) {
			let k = M.startLineNumber, A = this._isMovingDown ? k + 1 : k - 1;
			e.getLineMaxColumn(A) === 1 ? O.addEditOperation(new Range(1, 1, 1, 1), null) : (O.addEditOperation(new Range(k, 1, k, 1), e.getLineContent(A)), O.addEditOperation(new Range(A, 1, A, e.getLineMaxColumn(A)), null)), M = new Selection(A, 1, A, 1);
		} else {
			let j, P;
			if (this._isMovingDown) {
				j = M.endLineNumber + 1, P = e.getLineContent(j), O.addEditOperation(new Range(j - 1, e.getLineMaxColumn(j - 1), j, e.getLineMaxColumn(j)), null);
				let L = P;
				if (this.shouldAutoIndent(e, M)) {
					let R = this.matchEnterRule(e, I, N, j, M.startLineNumber - 1);
					if (R !== null) {
						let O = getLeadingWhitespace(e.getLineContent(j)), k = R + getSpaceCnt(O, N);
						L = generateIndent(k, N, F) + this.trimStart(P);
					} else {
						let O = {
							tokenization: {
								getLineTokens: (O) => O === M.startLineNumber ? e.tokenization.getLineTokens(j) : e.tokenization.getLineTokens(O),
								getLanguageId: k,
								getLanguageIdAtPosition: A
							},
							getLineContent: (O) => O === M.startLineNumber ? e.getLineContent(j) : e.getLineContent(O)
						}, R = getGoodIndentForLine(this._autoIndent, O, e.getLanguageIdAtPosition(j, 1), M.startLineNumber, I, this._languageConfigurationService);
						if (R !== null) {
							let O = getLeadingWhitespace(e.getLineContent(j)), k = getSpaceCnt(R, N), A = getSpaceCnt(O, N);
							k !== A && (L = generateIndent(k, N, F) + this.trimStart(P));
						}
					}
					O.addEditOperation(new Range(M.startLineNumber, 1, M.startLineNumber, 1), L + "\n");
					let z = this.matchEnterRuleMovingDown(e, I, N, M.startLineNumber, j, L);
					if (z !== null) z !== 0 && this.getIndentEditsOfMovingBlock(e, O, M, N, F, z);
					else {
						let P = {
							tokenization: {
								getLineTokens: (O) => O === M.startLineNumber ? e.tokenization.getLineTokens(j) : O >= M.startLineNumber + 1 && O <= M.endLineNumber + 1 ? e.tokenization.getLineTokens(O - 1) : e.tokenization.getLineTokens(O),
								getLanguageId: k,
								getLanguageIdAtPosition: A
							},
							getLineContent: (O) => O === M.startLineNumber ? L : O >= M.startLineNumber + 1 && O <= M.endLineNumber + 1 ? e.getLineContent(O - 1) : e.getLineContent(O)
						}, R = getGoodIndentForLine(this._autoIndent, P, e.getLanguageIdAtPosition(j, 1), M.startLineNumber + 1, I, this._languageConfigurationService);
						if (R !== null) {
							let k = getLeadingWhitespace(e.getLineContent(M.startLineNumber)), A = getSpaceCnt(R, N), j = getSpaceCnt(k, N);
							if (A !== j) {
								let k = A - j;
								this.getIndentEditsOfMovingBlock(e, O, M, N, F, k);
							}
						}
					}
				} else O.addEditOperation(new Range(M.startLineNumber, 1, M.startLineNumber, 1), L + "\n");
			} else if (j = M.startLineNumber - 1, P = e.getLineContent(j), O.addEditOperation(new Range(j, 1, j + 1, 1), null), O.addEditOperation(new Range(M.endLineNumber, e.getLineMaxColumn(M.endLineNumber), M.endLineNumber, e.getLineMaxColumn(M.endLineNumber)), "\n" + P), this.shouldAutoIndent(e, M)) {
				let P = {
					tokenization: {
						getLineTokens: (O) => O === j ? e.tokenization.getLineTokens(M.startLineNumber) : e.tokenization.getLineTokens(O),
						getLanguageId: k,
						getLanguageIdAtPosition: A
					},
					getLineContent: (O) => O === j ? e.getLineContent(M.startLineNumber) : e.getLineContent(O)
				}, L = this.matchEnterRule(e, I, N, M.startLineNumber, M.startLineNumber - 2);
				if (L !== null) L !== 0 && this.getIndentEditsOfMovingBlock(e, O, M, N, F, L);
				else {
					let k = getGoodIndentForLine(this._autoIndent, P, e.getLanguageIdAtPosition(M.startLineNumber, 1), j, I, this._languageConfigurationService);
					if (k !== null) {
						let A = getLeadingWhitespace(e.getLineContent(M.startLineNumber)), j = getSpaceCnt(k, N), P = getSpaceCnt(A, N);
						if (j !== P) {
							let k = j - P;
							this.getIndentEditsOfMovingBlock(e, O, M, N, F, k);
						}
					}
				}
			}
		}
		this._selectionId = O.trackSelection(M);
	}
	buildIndentConverter(e, O, k) {
		return {
			shiftIndent: (A) => ShiftCommand.shiftIndent(A, A.length + 1, e, O, k),
			unshiftIndent: (A) => ShiftCommand.unshiftIndent(A, A.length + 1, e, O, k)
		};
	}
	parseEnterResult(e, O, k, A, j) {
		if (j) {
			let M = j.indentation;
			j.indentAction === IndentAction.None || j.indentAction === IndentAction.Indent ? M = j.indentation + j.appendText : j.indentAction === IndentAction.IndentOutdent ? M = j.indentation : j.indentAction === IndentAction.Outdent && (M = O.unshiftIndent(j.indentation) + j.appendText);
			let N = e.getLineContent(A);
			if (this.trimStart(N).indexOf(this.trimStart(M)) >= 0) {
				let j = getLeadingWhitespace(e.getLineContent(A)), N = getLeadingWhitespace(M), P = getIndentMetadata(e, A, this._languageConfigurationService);
				P !== null && P & 2 && (N = O.unshiftIndent(N));
				let F = getSpaceCnt(N, k), I = getSpaceCnt(j, k);
				return F - I;
			}
		}
		return null;
	}
	matchEnterRuleMovingDown(e, O, k, A, j, M) {
		if (lastNonWhitespaceIndex(M) >= 0) {
			let M = e.getLineMaxColumn(j), N = getEnterAction(this._autoIndent, e, new Range(j, M, j, M), this._languageConfigurationService);
			return this.parseEnterResult(e, O, k, A, N);
		} else {
			let j = A - 1;
			for (; j >= 1;) {
				let O = e.getLineContent(j);
				if (lastNonWhitespaceIndex(O) >= 0) break;
				j--;
			}
			if (j < 1 || A > e.getLineCount()) return null;
			let M = e.getLineMaxColumn(j), N = getEnterAction(this._autoIndent, e, new Range(j, M, j, M), this._languageConfigurationService);
			return this.parseEnterResult(e, O, k, A, N);
		}
	}
	matchEnterRule(e, O, k, A, j, M) {
		let N = j;
		for (; N >= 1;) {
			let O;
			if (O = N === j && M !== void 0 ? M : e.getLineContent(N), lastNonWhitespaceIndex(O) >= 0) break;
			N--;
		}
		if (N < 1 || A > e.getLineCount()) return null;
		let P = e.getLineMaxColumn(N), F = getEnterAction(this._autoIndent, e, new Range(N, P, N, P), this._languageConfigurationService);
		return this.parseEnterResult(e, O, k, A, F);
	}
	trimStart(e) {
		return e.replace(/^\s+/, "");
	}
	shouldAutoIndent(e, O) {
		if (this._autoIndent < 4 || !e.tokenization.isCheapToTokenize(O.startLineNumber)) return !1;
		let k = e.getLanguageIdAtPosition(O.startLineNumber, 1), A = e.getLanguageIdAtPosition(O.endLineNumber, 1);
		return !(k !== A || this._languageConfigurationService.getLanguageConfiguration(k).indentRulesSupport === null);
	}
	getIndentEditsOfMovingBlock(e, O, k, A, j, M) {
		for (let N = k.startLineNumber; N <= k.endLineNumber; N++) {
			let P = e.getLineContent(N), F = getLeadingWhitespace(P), I = getSpaceCnt(F, A) + M, L = generateIndent(I, A, j);
			L !== F && (O.addEditOperation(new Range(N, 1, N, F.length + 1), L), N === k.endLineNumber && k.endColumn <= F.length + 1 && L === "" && (this._moveEndLineSelectionShrink = !0));
		}
	}
	computeCursorState(e, O) {
		let k = O.getTrackedSelection(this._selectionId);
		return this._moveEndPositionDown && (k = k.setEndPosition(k.endLineNumber + 1, 1)), this._moveEndLineSelectionShrink && k.startLineNumber < k.endLineNumber && (k = k.setEndPosition(k.endLineNumber, 2)), k;
	}
};
MoveLinesCommand = __decorate$38([__param$38(3, ILanguageConfigurationService)], MoveLinesCommand);
var SortLinesCommand = class e {
	static {
		this._COLLATOR = null;
	}
	static getCollator() {
		return e._COLLATOR ||= new Intl.Collator(), e._COLLATOR;
	}
	constructor(e, O) {
		this.selection = e, this.descending = O, this.selectionId = null;
	}
	getEditOperations(e, O) {
		let k = sortLines(e, this.selection, this.descending);
		k && O.addEditOperation(k.range, k.text), this.selectionId = O.trackSelection(this.selection);
	}
	computeCursorState(e, O) {
		return O.getTrackedSelection(this.selectionId);
	}
	static canRun(e, O, k) {
		if (e === null) return !1;
		let A = getSortData(e, O, k);
		if (!A) return !1;
		for (let e = 0, O = A.before.length; e < O; e++) if (A.before[e] !== A.after[e]) return !0;
		return !1;
	}
};
function getSortData(e, O, k) {
	let A = O.startLineNumber, j = O.endLineNumber;
	if (O.endColumn === 1 && j--, A >= j) return null;
	let M = [];
	for (let O = A; O <= j; O++) M.push(e.getLineContent(O));
	let N = M.slice(0);
	return N.sort(SortLinesCommand.getCollator().compare), k === !0 && (N = N.reverse()), {
		startLineNumber: A,
		endLineNumber: j,
		before: M,
		after: N
	};
}
function sortLines(e, O, k) {
	let A = getSortData(e, O, k);
	return A ? EditOperation.replace(new Range(A.startLineNumber, 1, A.endLineNumber, e.getLineMaxColumn(A.endLineNumber)), A.after.join("\n")) : null;
}
var AbstractCopyLinesAction = class extends EditorAction {
	constructor(e, O) {
		super(O), this.down = e;
	}
	run(e, O) {
		if (!O.hasModel()) return;
		let k = O.getSelections().map((e, O) => ({
			selection: e,
			index: O,
			ignore: !1
		}));
		k.sort((e, O) => Range.compareRangesUsingStarts(e.selection, O.selection));
		let A = k[0];
		for (let e = 1; e < k.length; e++) {
			let O = k[e];
			A.selection.endLineNumber === O.selection.startLineNumber && (A.index < O.index ? O.ignore = !0 : (A.ignore = !0, A = O));
		}
		let j = [];
		for (let e of k) j.push(new CopyLinesCommand(e.selection, this.down, e.ignore));
		O.pushUndoStop(), O.executeCommands(this.id, j), O.pushUndoStop();
	}
}, CopyLinesUpAction = class extends AbstractCopyLinesAction {
	constructor() {
		super(!1, {
			id: "editor.action.copyLinesUpAction",
			label: localize("lines.copyUp", "Copy Line Up"),
			alias: "Copy Line Up",
			precondition: EditorContextKeys.writable,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: 1552,
				linux: { primary: 3600 },
				weight: 100
			},
			menuOpts: {
				menuId: MenuId.MenubarSelectionMenu,
				group: "2_line",
				title: localize({
					key: "miCopyLinesUp",
					comment: ["&& denotes a mnemonic"]
				}, "&&Copy Line Up"),
				order: 1
			}
		});
	}
}, CopyLinesDownAction = class extends AbstractCopyLinesAction {
	constructor() {
		super(!0, {
			id: "editor.action.copyLinesDownAction",
			label: localize("lines.copyDown", "Copy Line Down"),
			alias: "Copy Line Down",
			precondition: EditorContextKeys.writable,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: 1554,
				linux: { primary: 3602 },
				weight: 100
			},
			menuOpts: {
				menuId: MenuId.MenubarSelectionMenu,
				group: "2_line",
				title: localize({
					key: "miCopyLinesDown",
					comment: ["&& denotes a mnemonic"]
				}, "Co&&py Line Down"),
				order: 2
			}
		});
	}
}, DuplicateSelectionAction = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.duplicateSelection",
			label: localize("duplicateSelection", "Duplicate Selection"),
			alias: "Duplicate Selection",
			precondition: EditorContextKeys.writable,
			menuOpts: {
				menuId: MenuId.MenubarSelectionMenu,
				group: "2_line",
				title: localize({
					key: "miDuplicateSelection",
					comment: ["&& denotes a mnemonic"]
				}, "&&Duplicate Selection"),
				order: 5
			}
		});
	}
	run(e, O, k) {
		if (!O.hasModel()) return;
		let A = [], j = O.getSelections(), M = O.getModel();
		for (let e of j) if (e.isEmpty()) A.push(new CopyLinesCommand(e, !0));
		else {
			let O = new Selection(e.endLineNumber, e.endColumn, e.endLineNumber, e.endColumn);
			A.push(new ReplaceCommandThatSelectsText(O, M.getValueInRange(e)));
		}
		O.pushUndoStop(), O.executeCommands(this.id, A), O.pushUndoStop();
	}
}, AbstractMoveLinesAction = class extends EditorAction {
	constructor(e, O) {
		super(O), this.down = e;
	}
	run(e, O) {
		let k = e.get(ILanguageConfigurationService), A = [], j = O.getSelections() || [], M = O.getOption(12);
		for (let e of j) A.push(new MoveLinesCommand(e, this.down, M, k));
		O.pushUndoStop(), O.executeCommands(this.id, A), O.pushUndoStop();
	}
}, MoveLinesUpAction = class extends AbstractMoveLinesAction {
	constructor() {
		super(!1, {
			id: "editor.action.moveLinesUpAction",
			label: localize("lines.moveUp", "Move Line Up"),
			alias: "Move Line Up",
			precondition: EditorContextKeys.writable,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: 528,
				linux: { primary: 528 },
				weight: 100
			},
			menuOpts: {
				menuId: MenuId.MenubarSelectionMenu,
				group: "2_line",
				title: localize({
					key: "miMoveLinesUp",
					comment: ["&& denotes a mnemonic"]
				}, "Mo&&ve Line Up"),
				order: 3
			}
		});
	}
}, MoveLinesDownAction = class extends AbstractMoveLinesAction {
	constructor() {
		super(!0, {
			id: "editor.action.moveLinesDownAction",
			label: localize("lines.moveDown", "Move Line Down"),
			alias: "Move Line Down",
			precondition: EditorContextKeys.writable,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: 530,
				linux: { primary: 530 },
				weight: 100
			},
			menuOpts: {
				menuId: MenuId.MenubarSelectionMenu,
				group: "2_line",
				title: localize({
					key: "miMoveLinesDown",
					comment: ["&& denotes a mnemonic"]
				}, "Move &&Line Down"),
				order: 4
			}
		});
	}
}, AbstractSortLinesAction = class extends EditorAction {
	constructor(e, O) {
		super(O), this.descending = e;
	}
	run(e, O) {
		if (!O.hasModel()) return;
		let k = O.getModel(), A = O.getSelections();
		A.length === 1 && A[0].isEmpty() && (A = [new Selection(1, 1, k.getLineCount(), k.getLineMaxColumn(k.getLineCount()))]);
		for (let e of A) if (!SortLinesCommand.canRun(O.getModel(), e, this.descending)) return;
		let j = [];
		for (let e = 0, O = A.length; e < O; e++) j[e] = new SortLinesCommand(A[e], this.descending);
		O.pushUndoStop(), O.executeCommands(this.id, j), O.pushUndoStop();
	}
}, SortLinesAscendingAction = class extends AbstractSortLinesAction {
	constructor() {
		super(!1, {
			id: "editor.action.sortLinesAscending",
			label: localize("lines.sortAscending", "Sort Lines Ascending"),
			alias: "Sort Lines Ascending",
			precondition: EditorContextKeys.writable
		});
	}
}, SortLinesDescendingAction = class extends AbstractSortLinesAction {
	constructor() {
		super(!0, {
			id: "editor.action.sortLinesDescending",
			label: localize("lines.sortDescending", "Sort Lines Descending"),
			alias: "Sort Lines Descending",
			precondition: EditorContextKeys.writable
		});
	}
}, DeleteDuplicateLinesAction = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.removeDuplicateLines",
			label: localize("lines.deleteDuplicates", "Delete Duplicate Lines"),
			alias: "Delete Duplicate Lines",
			precondition: EditorContextKeys.writable
		});
	}
	run(e, O) {
		if (!O.hasModel()) return;
		let k = O.getModel();
		if (k.getLineCount() === 1 && k.getLineMaxColumn(1) === 1) return;
		let A = [], j = [], M = 0, N = !0, P = O.getSelections();
		P.length === 1 && P[0].isEmpty() && (P = [new Selection(1, 1, k.getLineCount(), k.getLineMaxColumn(k.getLineCount()))], N = !1);
		for (let e of P) {
			let O = /* @__PURE__ */ new Set(), N = [];
			for (let A = e.startLineNumber; A <= e.endLineNumber; A++) {
				let e = k.getLineContent(A);
				O.has(e) || (N.push(e), O.add(e));
			}
			let P = new Selection(e.startLineNumber, 1, e.endLineNumber, k.getLineMaxColumn(e.endLineNumber)), F = e.startLineNumber - M, I = new Selection(F, 1, F + N.length - 1, N[N.length - 1].length);
			A.push(EditOperation.replace(P, N.join("\n"))), j.push(I), M += e.endLineNumber - e.startLineNumber + 1 - N.length;
		}
		O.pushUndoStop(), O.executeEdits(this.id, A, N ? j : void 0), O.pushUndoStop();
	}
}, TrimTrailingWhitespaceAction = class e extends EditorAction {
	static {
		this.ID = "editor.action.trimTrailingWhitespace";
	}
	constructor() {
		super({
			id: e.ID,
			label: localize("lines.trimTrailingWhitespace", "Trim Trailing Whitespace"),
			alias: "Trim Trailing Whitespace",
			precondition: EditorContextKeys.writable,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: KeyChord(2089, 2102),
				weight: 100
			}
		});
	}
	run(e, O, k) {
		let A = [];
		k.reason === "auto-save" && (A = (O.getSelections() || []).map((e) => new Position(e.positionLineNumber, e.positionColumn)));
		let j = O.getSelection();
		if (j === null) return;
		let M = e.get(IConfigurationService), N = O.getModel(), P = M.getValue("files.trimTrailingWhitespaceInRegexAndStrings", {
			overrideIdentifier: N?.getLanguageId(),
			resource: N?.uri
		}), F = new TrimTrailingWhitespaceCommand(j, A, P);
		O.pushUndoStop(), O.executeCommands(this.id, [F]), O.pushUndoStop();
	}
}, DeleteLinesAction = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.deleteLines",
			label: localize("lines.delete", "Delete Line"),
			alias: "Delete Line",
			precondition: EditorContextKeys.writable,
			kbOpts: {
				kbExpr: EditorContextKeys.textInputFocus,
				primary: 3113,
				weight: 100
			}
		});
	}
	run(e, O) {
		if (!O.hasModel()) return;
		let k = this._getLinesToRemove(O), A = O.getModel();
		if (A.getLineCount() === 1 && A.getLineMaxColumn(1) === 1) return;
		let j = 0, M = [], N = [];
		for (let e = 0, O = k.length; e < O; e++) {
			let O = k[e], P = O.startLineNumber, F = O.endLineNumber, I = 1, L = A.getLineMaxColumn(F);
			F < A.getLineCount() ? (F += 1, L = 1) : P > 1 && (--P, I = A.getLineMaxColumn(P)), M.push(EditOperation.replace(new Selection(P, I, F, L), "")), N.push(new Selection(P - j, O.positionColumn, P - j, O.positionColumn)), j += O.endLineNumber - O.startLineNumber + 1;
		}
		O.pushUndoStop(), O.executeEdits(this.id, M, N), O.pushUndoStop();
	}
	_getLinesToRemove(e) {
		let O = e.getSelections().map((e) => {
			let O = e.endLineNumber;
			return e.startLineNumber < e.endLineNumber && e.endColumn === 1 && --O, {
				startLineNumber: e.startLineNumber,
				selectionStartColumn: e.selectionStartColumn,
				endLineNumber: O,
				positionColumn: e.positionColumn
			};
		});
		O.sort((e, O) => e.startLineNumber === O.startLineNumber ? e.endLineNumber - O.endLineNumber : e.startLineNumber - O.startLineNumber);
		let k = [], A = O[0];
		for (let e = 1; e < O.length; e++) A.endLineNumber + 1 >= O[e].startLineNumber ? A.endLineNumber = O[e].endLineNumber : (k.push(A), A = O[e]);
		return k.push(A), k;
	}
}, IndentLinesAction = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.indentLines",
			label: localize("lines.indent", "Indent Line"),
			alias: "Indent Line",
			precondition: EditorContextKeys.writable,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: 2142,
				weight: 100
			}
		});
	}
	run(e, O) {
		let k = O._getViewModel();
		k && (O.pushUndoStop(), O.executeCommands(this.id, TypeOperations.indent(k.cursorConfig, O.getModel(), O.getSelections())), O.pushUndoStop());
	}
}, OutdentLinesAction = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.outdentLines",
			label: localize("lines.outdent", "Outdent Line"),
			alias: "Outdent Line",
			precondition: EditorContextKeys.writable,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: 2140,
				weight: 100
			}
		});
	}
	run(e, O) {
		CoreEditingCommands.Outdent.runEditorCommand(e, O, null);
	}
}, InsertLineBeforeAction = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.insertLineBefore",
			label: localize("lines.insertBefore", "Insert Line Above"),
			alias: "Insert Line Above",
			precondition: EditorContextKeys.writable,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: 3075,
				weight: 100
			}
		});
	}
	run(e, O) {
		let k = O._getViewModel();
		k && (O.pushUndoStop(), O.executeCommands(this.id, EnterOperation.lineInsertBefore(k.cursorConfig, O.getModel(), O.getSelections())));
	}
}, InsertLineAfterAction = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.insertLineAfter",
			label: localize("lines.insertAfter", "Insert Line Below"),
			alias: "Insert Line Below",
			precondition: EditorContextKeys.writable,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: 2051,
				weight: 100
			}
		});
	}
	run(e, O) {
		let k = O._getViewModel();
		k && (O.pushUndoStop(), O.executeCommands(this.id, EnterOperation.lineInsertAfter(k.cursorConfig, O.getModel(), O.getSelections())));
	}
}, AbstractDeleteAllToBoundaryAction = class extends EditorAction {
	run(e, O) {
		if (!O.hasModel()) return;
		let k = O.getSelection(), A = this._getRangesToDelete(O), j = [];
		for (let e = 0, O = A.length - 1; e < O; e++) {
			let O = A[e], k = A[e + 1];
			Range.intersectRanges(O, k) === null ? j.push(O) : A[e + 1] = Range.plusRange(O, k);
		}
		j.push(A[A.length - 1]);
		let M = this._getEndCursorState(k, j), N = j.map((e) => EditOperation.replace(e, ""));
		O.pushUndoStop(), O.executeEdits(this.id, N, M), O.pushUndoStop();
	}
}, DeleteAllLeftAction = class extends AbstractDeleteAllToBoundaryAction {
	constructor() {
		super({
			id: "deleteAllLeft",
			label: localize("lines.deleteAllLeft", "Delete All Left"),
			alias: "Delete All Left",
			precondition: EditorContextKeys.writable,
			kbOpts: {
				kbExpr: EditorContextKeys.textInputFocus,
				primary: 0,
				mac: { primary: 2049 },
				weight: 100
			}
		});
	}
	_getEndCursorState(e, O) {
		let k = null, A = [], j = 0;
		return O.forEach((O) => {
			let M;
			if (O.endColumn === 1 && j > 0) {
				let e = O.startLineNumber - j;
				M = new Selection(e, O.startColumn, e, O.startColumn);
			} else M = new Selection(O.startLineNumber, O.startColumn, O.startLineNumber, O.startColumn);
			j += O.endLineNumber - O.startLineNumber, O.intersectRanges(e) ? k = M : A.push(M);
		}), k && A.unshift(k), A;
	}
	_getRangesToDelete(e) {
		let O = e.getSelections();
		if (O === null) return [];
		let k = O, A = e.getModel();
		return A === null ? [] : (k.sort(Range.compareRangesUsingStarts), k = k.map((e) => {
			if (e.isEmpty()) if (e.startColumn === 1) {
				let O = Math.max(1, e.startLineNumber - 1), k = e.startLineNumber === 1 ? 1 : A.getLineLength(O) + 1;
				return new Range(O, k, e.startLineNumber, 1);
			} else return new Range(e.startLineNumber, 1, e.startLineNumber, e.startColumn);
			else return new Range(e.startLineNumber, 1, e.endLineNumber, e.endColumn);
		}), k);
	}
}, DeleteAllRightAction = class extends AbstractDeleteAllToBoundaryAction {
	constructor() {
		super({
			id: "deleteAllRight",
			label: localize("lines.deleteAllRight", "Delete All Right"),
			alias: "Delete All Right",
			precondition: EditorContextKeys.writable,
			kbOpts: {
				kbExpr: EditorContextKeys.textInputFocus,
				primary: 0,
				mac: {
					primary: 297,
					secondary: [2068]
				},
				weight: 100
			}
		});
	}
	_getEndCursorState(e, O) {
		let k = null, A = [];
		for (let j = 0, M = O.length; j < M; j++) {
			let M = O[j], N = new Selection(M.startLineNumber - 0, M.startColumn, M.startLineNumber - 0, M.startColumn);
			M.intersectRanges(e) ? k = N : A.push(N);
		}
		return k && A.unshift(k), A;
	}
	_getRangesToDelete(e) {
		let O = e.getModel();
		if (O === null) return [];
		let k = e.getSelections();
		if (k === null) return [];
		let A = k.map((e) => {
			if (e.isEmpty()) {
				let k = O.getLineMaxColumn(e.startLineNumber);
				return e.startColumn === k ? new Range(e.startLineNumber, e.startColumn, e.startLineNumber + 1, 1) : new Range(e.startLineNumber, e.startColumn, e.startLineNumber, k);
			}
			return e;
		});
		return A.sort(Range.compareRangesUsingStarts), A;
	}
}, JoinLinesAction = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.joinLines",
			label: localize("lines.joinLines", "Join Lines"),
			alias: "Join Lines",
			precondition: EditorContextKeys.writable,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: 0,
				mac: { primary: 296 },
				weight: 100
			}
		});
	}
	run(e, O) {
		let k = O.getSelections();
		if (k === null) return;
		let A = O.getSelection();
		if (A === null) return;
		k.sort(Range.compareRangesUsingStarts);
		let j = [], M = k.reduce((e, O) => e.isEmpty() ? e.endLineNumber === O.startLineNumber ? (A.equalsSelection(e) && (A = O), O) : O.startLineNumber > e.endLineNumber + 1 ? (j.push(e), O) : new Selection(e.startLineNumber, e.startColumn, O.endLineNumber, O.endColumn) : O.startLineNumber > e.endLineNumber ? (j.push(e), O) : new Selection(e.startLineNumber, e.startColumn, O.endLineNumber, O.endColumn));
		j.push(M);
		let N = O.getModel();
		if (N === null) return;
		let P = [], F = [], I = A, L = 0;
		for (let e = 0, O = j.length; e < O; e++) {
			let O = j[e], k = O.startLineNumber, M = 0, R, z, B = N.getLineLength(O.endLineNumber) - O.endColumn;
			if (O.isEmpty() || O.startLineNumber === O.endLineNumber) {
				let e = O.getStartPosition();
				e.lineNumber < N.getLineCount() ? (R = k + 1, z = N.getLineMaxColumn(R)) : (R = e.lineNumber, z = N.getLineMaxColumn(e.lineNumber));
			} else R = O.endLineNumber, z = N.getLineMaxColumn(R);
			let V = N.getLineContent(k);
			for (let e = k + 1; e <= R; e++) {
				let O = N.getLineContent(e), k = N.getLineFirstNonWhitespaceColumn(e);
				if (k >= 1) {
					let e = !0;
					V === "" && (e = !1), e && (V.charAt(V.length - 1) === " " || V.charAt(V.length - 1) === "	") && (e = !1, V = V.replace(/[\s\uFEFF\xA0]+$/g, " "));
					let A = O.substr(k - 1);
					V += (e ? " " : "") + A, M = e ? A.length + 1 : A.length;
				} else M = 0;
			}
			let H = new Range(k, 1, R, z);
			if (!H.isEmpty()) {
				let e;
				O.isEmpty() ? (P.push(EditOperation.replace(H, V)), e = new Selection(H.startLineNumber - L, V.length - M + 1, k - L, V.length - M + 1)) : O.startLineNumber === O.endLineNumber ? (P.push(EditOperation.replace(H, V)), e = new Selection(O.startLineNumber - L, O.startColumn, O.endLineNumber - L, O.endColumn)) : (P.push(EditOperation.replace(H, V)), e = new Selection(O.startLineNumber - L, O.startColumn, O.startLineNumber - L, V.length - B)), Range.intersectRanges(H, A) === null ? F.push(e) : I = e;
			}
			L += H.endLineNumber - H.startLineNumber;
		}
		F.unshift(I), O.pushUndoStop(), O.executeEdits(this.id, P, F), O.pushUndoStop();
	}
}, TransposeAction = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.transpose",
			label: localize("editor.transpose", "Transpose Characters around the Cursor"),
			alias: "Transpose Characters around the Cursor",
			precondition: EditorContextKeys.writable
		});
	}
	run(e, O) {
		let k = O.getSelections();
		if (k === null) return;
		let A = O.getModel();
		if (A === null) return;
		let j = [];
		for (let e = 0, O = k.length; e < O; e++) {
			let O = k[e];
			if (!O.isEmpty()) continue;
			let M = O.getStartPosition(), N = A.getLineMaxColumn(M.lineNumber);
			if (M.column >= N) {
				if (M.lineNumber === A.getLineCount()) continue;
				let e = new Range(M.lineNumber, Math.max(1, M.column - 1), M.lineNumber + 1, 1), O = A.getValueInRange(e).split("").reverse().join("");
				j.push(new ReplaceCommand(new Selection(M.lineNumber, Math.max(1, M.column - 1), M.lineNumber + 1, 1), O));
			} else {
				let e = new Range(M.lineNumber, Math.max(1, M.column - 1), M.lineNumber, M.column + 1), O = A.getValueInRange(e).split("").reverse().join("");
				j.push(new ReplaceCommandThatPreservesSelection(e, O, new Selection(M.lineNumber, M.column + 1, M.lineNumber, M.column + 1)));
			}
		}
		O.pushUndoStop(), O.executeCommands(this.id, j), O.pushUndoStop();
	}
}, AbstractCaseAction = class extends EditorAction {
	run(e, O) {
		let k = O.getSelections();
		if (k === null) return;
		let A = O.getModel();
		if (A === null) return;
		let j = O.getOption(132), M = [];
		for (let e of k) if (e.isEmpty()) {
			let k = e.getStartPosition(), N = O.getConfiguredWordAtPosition(k);
			if (!N) continue;
			let P = new Range(k.lineNumber, N.startColumn, k.lineNumber, N.endColumn), F = A.getValueInRange(P);
			M.push(EditOperation.replace(P, this._modifyText(F, j)));
		} else {
			let O = A.getValueInRange(e);
			M.push(EditOperation.replace(e, this._modifyText(O, j)));
		}
		O.pushUndoStop(), O.executeEdits(this.id, M), O.pushUndoStop();
	}
}, UpperCaseAction = class extends AbstractCaseAction {
	constructor() {
		super({
			id: "editor.action.transformToUppercase",
			label: localize("editor.transformToUppercase", "Transform to Uppercase"),
			alias: "Transform to Uppercase",
			precondition: EditorContextKeys.writable
		});
	}
	_modifyText(e, O) {
		return e.toLocaleUpperCase();
	}
}, LowerCaseAction = class extends AbstractCaseAction {
	constructor() {
		super({
			id: "editor.action.transformToLowercase",
			label: localize("editor.transformToLowercase", "Transform to Lowercase"),
			alias: "Transform to Lowercase",
			precondition: EditorContextKeys.writable
		});
	}
	_modifyText(e, O) {
		return e.toLocaleLowerCase();
	}
}, BackwardsCompatibleRegExp = class {
	constructor(e, O) {
		this._pattern = e, this._flags = O, this._actual = null, this._evaluated = !1;
	}
	get() {
		if (!this._evaluated) {
			this._evaluated = !0;
			try {
				this._actual = new RegExp(this._pattern, this._flags);
			} catch {}
		}
		return this._actual;
	}
	isSupported() {
		return this.get() !== null;
	}
}, TitleCaseAction = class e extends AbstractCaseAction {
	static {
		this.titleBoundary = new BackwardsCompatibleRegExp("(^|[^\\p{L}\\p{N}']|((^|\\P{L})'))\\p{L}", "gmu");
	}
	constructor() {
		super({
			id: "editor.action.transformToTitlecase",
			label: localize("editor.transformToTitlecase", "Transform to Title Case"),
			alias: "Transform to Title Case",
			precondition: EditorContextKeys.writable
		});
	}
	_modifyText(O, k) {
		let A = e.titleBoundary.get();
		return A ? O.toLocaleLowerCase().replace(A, (e) => e.toLocaleUpperCase()) : O;
	}
}, SnakeCaseAction = class e extends AbstractCaseAction {
	static {
		this.caseBoundary = new BackwardsCompatibleRegExp("(\\p{Ll})(\\p{Lu})", "gmu");
	}
	static {
		this.singleLetters = new BackwardsCompatibleRegExp("(\\p{Lu}|\\p{N})(\\p{Lu})(\\p{Ll})", "gmu");
	}
	constructor() {
		super({
			id: "editor.action.transformToSnakecase",
			label: localize("editor.transformToSnakecase", "Transform to Snake Case"),
			alias: "Transform to Snake Case",
			precondition: EditorContextKeys.writable
		});
	}
	_modifyText(O, k) {
		let A = e.caseBoundary.get(), j = e.singleLetters.get();
		return !A || !j ? O : O.replace(A, "$1_$2").replace(j, "$1_$2$3").toLocaleLowerCase();
	}
}, CamelCaseAction = class e extends AbstractCaseAction {
	static {
		this.wordBoundary = new BackwardsCompatibleRegExp("[_\\s-]", "gm");
	}
	constructor() {
		super({
			id: "editor.action.transformToCamelcase",
			label: localize("editor.transformToCamelcase", "Transform to Camel Case"),
			alias: "Transform to Camel Case",
			precondition: EditorContextKeys.writable
		});
	}
	_modifyText(O, k) {
		let A = e.wordBoundary.get();
		if (!A) return O;
		let j = O.split(A);
		return j.shift() + j.map((e) => e.substring(0, 1).toLocaleUpperCase() + e.substring(1)).join("");
	}
}, PascalCaseAction = class e extends AbstractCaseAction {
	static {
		this.wordBoundary = new BackwardsCompatibleRegExp("[_\\s-]", "gm");
	}
	static {
		this.wordBoundaryToMaintain = new BackwardsCompatibleRegExp("(?<=\\.)", "gm");
	}
	constructor() {
		super({
			id: "editor.action.transformToPascalcase",
			label: localize("editor.transformToPascalcase", "Transform to Pascal Case"),
			alias: "Transform to Pascal Case",
			precondition: EditorContextKeys.writable
		});
	}
	_modifyText(O, k) {
		let A = e.wordBoundary.get(), j = e.wordBoundaryToMaintain.get();
		return !A || !j ? O : O.split(j).map((e) => e.split(A)).flat().map((e) => e.substring(0, 1).toLocaleUpperCase() + e.substring(1)).join("");
	}
}, KebabCaseAction = class e extends AbstractCaseAction {
	static isSupported() {
		return [
			this.caseBoundary,
			this.singleLetters,
			this.underscoreBoundary
		].every((e) => e.isSupported());
	}
	static {
		this.caseBoundary = new BackwardsCompatibleRegExp("(\\p{Ll})(\\p{Lu})", "gmu");
	}
	static {
		this.singleLetters = new BackwardsCompatibleRegExp("(\\p{Lu}|\\p{N})(\\p{Lu}\\p{Ll})", "gmu");
	}
	static {
		this.underscoreBoundary = new BackwardsCompatibleRegExp("(\\S)(_)(\\S)", "gm");
	}
	constructor() {
		super({
			id: "editor.action.transformToKebabcase",
			label: localize("editor.transformToKebabcase", "Transform to Kebab Case"),
			alias: "Transform to Kebab Case",
			precondition: EditorContextKeys.writable
		});
	}
	_modifyText(O, k) {
		let A = e.caseBoundary.get(), j = e.singleLetters.get(), M = e.underscoreBoundary.get();
		return !A || !j || !M ? O : O.replace(M, "$1-$3").replace(A, "$1-$2").replace(j, "$1-$2").toLocaleLowerCase();
	}
};
registerEditorAction(CopyLinesUpAction), registerEditorAction(CopyLinesDownAction), registerEditorAction(DuplicateSelectionAction), registerEditorAction(MoveLinesUpAction), registerEditorAction(MoveLinesDownAction), registerEditorAction(SortLinesAscendingAction), registerEditorAction(SortLinesDescendingAction), registerEditorAction(DeleteDuplicateLinesAction), registerEditorAction(TrimTrailingWhitespaceAction), registerEditorAction(DeleteLinesAction), registerEditorAction(IndentLinesAction), registerEditorAction(OutdentLinesAction), registerEditorAction(InsertLineBeforeAction), registerEditorAction(InsertLineAfterAction), registerEditorAction(DeleteAllLeftAction), registerEditorAction(DeleteAllRightAction), registerEditorAction(JoinLinesAction), registerEditorAction(TransposeAction), registerEditorAction(UpperCaseAction), registerEditorAction(LowerCaseAction), SnakeCaseAction.caseBoundary.isSupported() && SnakeCaseAction.singleLetters.isSupported() && registerEditorAction(SnakeCaseAction), CamelCaseAction.wordBoundary.isSupported() && registerEditorAction(CamelCaseAction), PascalCaseAction.wordBoundary.isSupported() && registerEditorAction(PascalCaseAction), TitleCaseAction.titleBoundary.isSupported() && registerEditorAction(TitleCaseAction), KebabCaseAction.isSupported() && registerEditorAction(KebabCaseAction);
var __decorate$37 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$37 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, LinkedEditingContribution_1;
const CONTEXT_ONTYPE_RENAME_INPUT_VISIBLE = new RawContextKey("LinkedEditingInputVisible", !1);
var DECORATION_CLASS_NAME = "linked-editing-decoration", LinkedEditingContribution = class extends Disposable {
	static {
		LinkedEditingContribution_1 = this;
	}
	static {
		this.ID = "editor.contrib.linkedEditing";
	}
	static {
		this.DECORATION = ModelDecorationOptions.register({
			description: "linked-editing",
			stickiness: 0,
			className: DECORATION_CLASS_NAME
		});
	}
	static get(e) {
		return e.getContribution(LinkedEditingContribution_1.ID);
	}
	constructor(e, O, k, A, j) {
		super(), this.languageConfigurationService = A, this._syncRangesToken = 0, this._localToDispose = this._register(new DisposableStore()), this._editor = e, this._providers = k.linkedEditingRangeProvider, this._enabled = !1, this._visibleContextKey = CONTEXT_ONTYPE_RENAME_INPUT_VISIBLE.bindTo(O), this._debounceInformation = j.for(this._providers, "Linked Editing", { max: 200 }), this._currentDecorations = this._editor.createDecorationsCollection(), this._languageWordPattern = null, this._currentWordPattern = null, this._ignoreChangeEvent = !1, this._localToDispose = this._register(new DisposableStore()), this._rangeUpdateTriggerPromise = null, this._rangeSyncTriggerPromise = null, this._currentRequestCts = null, this._currentRequestPosition = null, this._currentRequestModelVersion = null, this._register(this._editor.onDidChangeModel(() => this.reinitialize(!0))), this._register(this._editor.onDidChangeConfiguration((e) => {
			(e.hasChanged(70) || e.hasChanged(94)) && this.reinitialize(!1);
		})), this._register(this._providers.onDidChange(() => this.reinitialize(!1))), this._register(this._editor.onDidChangeModelLanguage(() => this.reinitialize(!0))), this.reinitialize(!0);
	}
	reinitialize(e) {
		let O = this._editor.getModel(), k = O !== null && (this._editor.getOption(70) || this._editor.getOption(94)) && this._providers.has(O);
		if (k === this._enabled && !e || (this._enabled = k, this.clearRanges(), this._localToDispose.clear(), !k || O === null)) return;
		this._localToDispose.add(Event.runAndSubscribe(O.onDidChangeLanguageConfiguration, () => {
			this._languageWordPattern = this.languageConfigurationService.getLanguageConfiguration(O.getLanguageId()).getWordDefinition();
		}));
		let A = new Delayer(this._debounceInformation.get(O)), j = () => {
			this._rangeUpdateTriggerPromise = A.trigger(() => this.updateRanges(), this._debounceDuration ?? this._debounceInformation.get(O));
		}, M = new Delayer(0), N = (e) => {
			this._rangeSyncTriggerPromise = M.trigger(() => this._syncRanges(e));
		};
		this._localToDispose.add(this._editor.onDidChangeCursorPosition(() => {
			j();
		})), this._localToDispose.add(this._editor.onDidChangeModelContent((e) => {
			if (!this._ignoreChangeEvent && this._currentDecorations.length > 0) {
				let O = this._currentDecorations.getRange(0);
				if (O && e.changes.every((e) => O.intersectRanges(e.range))) {
					N(this._syncRangesToken);
					return;
				}
			}
			j();
		})), this._localToDispose.add({ dispose: () => {
			A.dispose(), M.dispose();
		} }), this.updateRanges();
	}
	_syncRanges(e) {
		if (!this._editor.hasModel() || e !== this._syncRangesToken || this._currentDecorations.length === 0) return;
		let O = this._editor.getModel(), k = this._currentDecorations.getRange(0);
		if (!k || k.startLineNumber !== k.endLineNumber) return this.clearRanges();
		let A = O.getValueInRange(k);
		if (this._currentWordPattern) {
			let e = A.match(this._currentWordPattern);
			if ((e ? e[0].length : 0) !== A.length) return this.clearRanges();
		}
		let j = [];
		for (let e = 1, k = this._currentDecorations.length; e < k; e++) {
			let k = this._currentDecorations.getRange(e);
			if (k) if (k.startLineNumber !== k.endLineNumber) j.push({
				range: k,
				text: A
			});
			else {
				let e = O.getValueInRange(k), M = A, N = k.startColumn, P = k.endColumn, F = commonPrefixLength(e, M);
				N += F, e = e.substr(F), M = M.substr(F);
				let I = commonSuffixLength(e, M);
				P -= I, e = e.substr(0, e.length - I), M = M.substr(0, M.length - I), (N !== P || M.length !== 0) && j.push({
					range: new Range(k.startLineNumber, N, k.endLineNumber, P),
					text: M
				});
			}
		}
		if (j.length !== 0) try {
			this._editor.popUndoStop(), this._ignoreChangeEvent = !0;
			let e = this._editor._getViewModel().getPrevEditOperationType();
			this._editor.executeEdits("linkedEditing", j), this._editor._getViewModel().setPrevEditOperationType(e);
		} finally {
			this._ignoreChangeEvent = !1;
		}
	}
	dispose() {
		this.clearRanges(), super.dispose();
	}
	clearRanges() {
		this._visibleContextKey.set(!1), this._currentDecorations.clear(), this._currentRequestCts && (this._currentRequestCts.cancel(), this._currentRequestCts = null, this._currentRequestPosition = null);
	}
	async updateRanges(e = !1) {
		if (!this._editor.hasModel()) {
			this.clearRanges();
			return;
		}
		let O = this._editor.getPosition();
		if (!this._enabled && !e || this._editor.getSelections().length > 1) {
			this.clearRanges();
			return;
		}
		let k = this._editor.getModel(), A = k.getVersionId();
		if (this._currentRequestPosition && this._currentRequestModelVersion === A) {
			if (O.equals(this._currentRequestPosition)) return;
			if (this._currentDecorations.length > 0) {
				let e = this._currentDecorations.getRange(0);
				if (e && e.containsPosition(O)) return;
			}
		}
		this.clearRanges(), this._currentRequestPosition = O, this._currentRequestModelVersion = A;
		let j = this._currentRequestCts = new CancellationTokenSource();
		try {
			let e = new StopWatch(!1), M = await getLinkedEditingRanges(this._providers, k, O, j.token);
			if (this._debounceInformation.update(k, e.elapsed()), j !== this._currentRequestCts || (this._currentRequestCts = null, A !== k.getVersionId())) return;
			let N = [];
			M?.ranges && (N = M.ranges), this._currentWordPattern = M?.wordPattern || this._languageWordPattern;
			let P = !1;
			for (let e = 0, k = N.length; e < k; e++) if (Range.containsPosition(N[e], O)) {
				if (P = !0, e !== 0) {
					let O = N[e];
					N.splice(e, 1), N.unshift(O);
				}
				break;
			}
			if (!P) {
				this.clearRanges();
				return;
			}
			let F = N.map((e) => ({
				range: e,
				options: LinkedEditingContribution_1.DECORATION
			}));
			this._visibleContextKey.set(!0), this._currentDecorations.set(F), this._syncRangesToken++;
		} catch (e) {
			isCancellationError(e) || onUnexpectedError(e), (this._currentRequestCts === j || !this._currentRequestCts) && this.clearRanges();
		}
	}
};
LinkedEditingContribution = LinkedEditingContribution_1 = __decorate$37([
	__param$37(1, IContextKeyService),
	__param$37(2, ILanguageFeaturesService),
	__param$37(3, ILanguageConfigurationService),
	__param$37(4, ILanguageFeatureDebounceService)
], LinkedEditingContribution);
var LinkedEditingAction = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.linkedEditing",
			label: localize("linkedEditing.label", "Start Linked Editing"),
			alias: "Start Linked Editing",
			precondition: ContextKeyExpr.and(EditorContextKeys.writable, EditorContextKeys.hasRenameProvider),
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: 3132,
				weight: 100
			}
		});
	}
	runCommand(e, O) {
		let k = e.get(ICodeEditorService), [A, j] = Array.isArray(O) && O || [void 0, void 0];
		return URI.isUri(A) && Position.isIPosition(j) ? k.openCodeEditor({ resource: A }, k.getActiveCodeEditor()).then((e) => {
			e && (e.setPosition(j), e.invokeWithinContext((O) => (this.reportTelemetry(O, e), this.run(O, e))));
		}, onUnexpectedError) : super.runCommand(e, O);
	}
	run(e, O) {
		let k = LinkedEditingContribution.get(O);
		return k ? Promise.resolve(k.updateRanges(!0)) : Promise.resolve();
	}
}, LinkedEditingCommand = EditorCommand.bindToContribution(LinkedEditingContribution.get);
registerEditorCommand(new LinkedEditingCommand({
	id: "cancelLinkedEditingInput",
	precondition: CONTEXT_ONTYPE_RENAME_INPUT_VISIBLE,
	handler: (e) => e.clearRanges(),
	kbOpts: {
		kbExpr: EditorContextKeys.editorTextFocus,
		weight: 199,
		primary: 9,
		secondary: [1033]
	}
}));
function getLinkedEditingRanges(e, O, k, A) {
	let j = e.ordered(O);
	return first(j.map((e) => async () => {
		try {
			return await e.provideLinkedEditingRanges(O, k, A);
		} catch (e) {
			onUnexpectedExternalError(e);
			return;
		}
	}), (e) => !!e && isNonEmptyArray(e?.ranges));
}
registerColor("editor.linkedEditingBackground", {
	dark: Color.fromHex("#f00").transparent(.3),
	light: Color.fromHex("#f00").transparent(.3),
	hcDark: Color.fromHex("#f00").transparent(.3),
	hcLight: Color.white
}, localize("editorLinkedEditingBackground", "Background color when the editor auto renames on type.")), registerModelAndPositionCommand("_executeLinkedEditingProvider", (e, O, k) => {
	let { linkedEditingRangeProvider: A } = e.get(ILanguageFeaturesService);
	return getLinkedEditingRanges(A, O, k, CancellationToken.None);
}), registerEditorContribution(LinkedEditingContribution.ID, LinkedEditingContribution, 1), registerEditorAction(LinkedEditingAction);
var Link$1 = class {
	constructor(e, O) {
		this._link = e, this._provider = O;
	}
	toJSON() {
		return {
			range: this.range,
			url: this.url,
			tooltip: this.tooltip
		};
	}
	get range() {
		return this._link.range;
	}
	get url() {
		return this._link.url;
	}
	get tooltip() {
		return this._link.tooltip;
	}
	async resolve(e) {
		return this._link.url ? this._link.url : typeof this._provider.resolveLink == "function" ? Promise.resolve(this._provider.resolveLink(this._link, e)).then((O) => (this._link = O || this._link, this._link.url ? this.resolve(e) : Promise.reject(/* @__PURE__ */ Error("missing")))) : Promise.reject(/* @__PURE__ */ Error("missing"));
	}
}, LinksList = class e {
	constructor(O) {
		this._disposables = new DisposableStore();
		let k = [];
		for (let [A, j] of O) {
			let O = A.links.map((e) => new Link$1(e, j));
			k = e._union(k, O), isDisposable(A) && this._disposables.add(A);
		}
		this.links = k;
	}
	dispose() {
		this._disposables.dispose(), this.links.length = 0;
	}
	static _union(e, O) {
		let k = [], A, j, M, N;
		for (A = 0, M = 0, j = e.length, N = O.length; A < j && M < N;) {
			let j = e[A], N = O[M];
			if (Range.areIntersectingOrTouching(j.range, N.range)) {
				A++;
				continue;
			}
			Range.compareRangesUsingStarts(j.range, N.range) < 0 ? (k.push(j), A++) : (k.push(N), M++);
		}
		for (; A < j; A++) k.push(e[A]);
		for (; M < N; M++) k.push(O[M]);
		return k;
	}
};
function getLinks(e, O, k) {
	let A = [], j = e.ordered(O).reverse().map((e, j) => Promise.resolve(e.provideLinks(O, k)).then((O) => {
		O && (A[j] = [O, e]);
	}, onUnexpectedExternalError));
	return Promise.all(j).then(() => {
		let e = new LinksList(coalesce(A));
		return k.isCancellationRequested ? (e.dispose(), new LinksList([])) : e;
	});
}
CommandsRegistry.registerCommand("_executeLinkProvider", async (e, ...O) => {
	let [k, A] = O;
	assertType(k instanceof URI), typeof A != "number" && (A = 0);
	let { linkProvider: j } = e.get(ILanguageFeaturesService), M = e.get(IModelService).getModel(k);
	if (!M) return [];
	let N = await getLinks(j, M, CancellationToken.None);
	if (!N) return [];
	for (let e = 0; e < Math.min(A, N.links.length); e++) await N.links[e].resolve(CancellationToken.None);
	let P = N.links.slice(0);
	return N.dispose(), P;
});
var __decorate$36 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$36 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, LinkDetector_1, LinkDetector = class extends Disposable {
	static {
		LinkDetector_1 = this;
	}
	static {
		this.ID = "editor.linkDetector";
	}
	static get(e) {
		return e.getContribution(LinkDetector_1.ID);
	}
	constructor(e, O, k, A, j) {
		super(), this.editor = e, this.openerService = O, this.notificationService = k, this.languageFeaturesService = A, this.providers = this.languageFeaturesService.linkProvider, this.debounceInformation = j.for(this.providers, "Links", {
			min: 1e3,
			max: 4e3
		}), this.computeLinks = this._register(new RunOnceScheduler(() => this.computeLinksNow(), 1e3)), this.computePromise = null, this.activeLinksList = null, this.currentOccurrences = {}, this.activeLinkDecorationId = null;
		let M = this._register(new ClickLinkGesture(e));
		this._register(M.onMouseMoveOrRelevantKeyDown(([e, O]) => {
			this._onEditorMouseMove(e, O);
		})), this._register(M.onExecute((e) => {
			this.onEditorMouseUp(e);
		})), this._register(M.onCancel((e) => {
			this.cleanUpActiveLinkDecoration();
		})), this._register(e.onDidChangeConfiguration((e) => {
			e.hasChanged(71) && (this.updateDecorations([]), this.stop(), this.computeLinks.schedule(0));
		})), this._register(e.onDidChangeModelContent((e) => {
			this.editor.hasModel() && this.computeLinks.schedule(this.debounceInformation.get(this.editor.getModel()));
		})), this._register(e.onDidChangeModel((e) => {
			this.currentOccurrences = {}, this.activeLinkDecorationId = null, this.stop(), this.computeLinks.schedule(0);
		})), this._register(e.onDidChangeModelLanguage((e) => {
			this.stop(), this.computeLinks.schedule(0);
		})), this._register(this.providers.onDidChange((e) => {
			this.stop(), this.computeLinks.schedule(0);
		})), this.computeLinks.schedule(0);
	}
	async computeLinksNow() {
		if (!this.editor.hasModel() || !this.editor.getOption(71)) return;
		let e = this.editor.getModel();
		if (!e.isTooLargeForSyncing() && this.providers.has(e)) {
			this.activeLinksList &&= (this.activeLinksList.dispose(), null), this.computePromise = createCancelablePromise((O) => getLinks(this.providers, e, O));
			try {
				let O = new StopWatch(!1);
				if (this.activeLinksList = await this.computePromise, this.debounceInformation.update(e, O.elapsed()), e.isDisposed()) return;
				this.updateDecorations(this.activeLinksList.links);
			} catch (e) {
				onUnexpectedError(e);
			} finally {
				this.computePromise = null;
			}
		}
	}
	updateDecorations(e) {
		let O = this.editor.getOption(78) === "altKey", k = [], A = Object.keys(this.currentOccurrences);
		for (let e of A) {
			let O = this.currentOccurrences[e];
			k.push(O.decorationId);
		}
		let j = [];
		if (e) for (let k of e) j.push(LinkOccurrence.decoration(k, O));
		this.editor.changeDecorations((O) => {
			let A = O.deltaDecorations(k, j);
			this.currentOccurrences = {}, this.activeLinkDecorationId = null;
			for (let O = 0, k = A.length; O < k; O++) {
				let k = new LinkOccurrence(e[O], A[O]);
				this.currentOccurrences[k.decorationId] = k;
			}
		});
	}
	_onEditorMouseMove(e, O) {
		let k = this.editor.getOption(78) === "altKey";
		if (this.isEnabled(e, O)) {
			this.cleanUpActiveLinkDecoration();
			let O = this.getLinkOccurrence(e.target.position);
			O && this.editor.changeDecorations((e) => {
				O.activate(e, k), this.activeLinkDecorationId = O.decorationId;
			});
		} else this.cleanUpActiveLinkDecoration();
	}
	cleanUpActiveLinkDecoration() {
		let e = this.editor.getOption(78) === "altKey";
		if (this.activeLinkDecorationId) {
			let O = this.currentOccurrences[this.activeLinkDecorationId];
			O && this.editor.changeDecorations((k) => {
				O.deactivate(k, e);
			}), this.activeLinkDecorationId = null;
		}
	}
	onEditorMouseUp(e) {
		if (!this.isEnabled(e)) return;
		let O = this.getLinkOccurrence(e.target.position);
		O && this.openLinkOccurrence(O, e.hasSideBySideModifier, !0);
	}
	openLinkOccurrence(e, O, k = !1) {
		if (!this.openerService) return;
		let { link: A } = e;
		A.resolve(CancellationToken.None).then((e) => {
			if (typeof e == "string" && this.editor.hasModel()) {
				let O = this.editor.getModel().uri;
				if (O.scheme === Schemas.file && e.startsWith(`${Schemas.file}:`)) {
					let k = URI.parse(e);
					if (k.scheme === Schemas.file) {
						let A = originalFSPath(k), j = null;
						A.startsWith("/./") || A.startsWith("\\.\\") ? j = `.${A.substr(1)}` : (A.startsWith("//./") || A.startsWith("\\\\.\\")) && (j = `.${A.substr(2)}`), j && (e = joinPath(O, j));
					}
				}
			}
			return this.openerService.open(e, {
				openToSide: O,
				fromUserGesture: k,
				allowContributedOpeners: !0,
				allowCommands: !0,
				fromWorkspace: !0
			});
		}, (e) => {
			let O = e instanceof Error ? e.message : e;
			O === "invalid" ? this.notificationService.warn(localize("invalid.url", "Failed to open this link because it is not well-formed: {0}", A.url.toString())) : O === "missing" ? this.notificationService.warn(localize("missing.url", "Failed to open this link because its target is missing.")) : onUnexpectedError(e);
		});
	}
	getLinkOccurrence(e) {
		if (!this.editor.hasModel() || !e) return null;
		let O = this.editor.getModel().getDecorationsInRange({
			startLineNumber: e.lineNumber,
			startColumn: e.column,
			endLineNumber: e.lineNumber,
			endColumn: e.column
		}, 0, !0);
		for (let e of O) {
			let O = this.currentOccurrences[e.id];
			if (O) return O;
		}
		return null;
	}
	isEnabled(e, O) {
		return !!(e.target.type === 6 && (e.hasTriggerModifier || O && O.keyCodeIsTriggerKey));
	}
	stop() {
		this.computeLinks.cancel(), this.activeLinksList &&= (this.activeLinksList?.dispose(), null), this.computePromise &&= (this.computePromise.cancel(), null);
	}
	dispose() {
		super.dispose(), this.stop();
	}
};
LinkDetector = LinkDetector_1 = __decorate$36([
	__param$36(1, IOpenerService),
	__param$36(2, INotificationService),
	__param$36(3, ILanguageFeaturesService),
	__param$36(4, ILanguageFeatureDebounceService)
], LinkDetector);
var decoration$1 = {
	general: ModelDecorationOptions.register({
		description: "detected-link",
		stickiness: 1,
		collapseOnReplaceEdit: !0,
		inlineClassName: "detected-link"
	}),
	active: ModelDecorationOptions.register({
		description: "detected-link-active",
		stickiness: 1,
		collapseOnReplaceEdit: !0,
		inlineClassName: "detected-link-active"
	})
}, LinkOccurrence = class e {
	static decoration(O, k) {
		return {
			range: O.range,
			options: e._getOptions(O, k, !1)
		};
	}
	static _getOptions(e, O, k) {
		let A = { ...k ? decoration$1.active : decoration$1.general };
		return A.hoverMessage = getHoverMessage(e, O), A;
	}
	constructor(e, O) {
		this.link = e, this.decorationId = O;
	}
	activate(O, k) {
		O.changeDecorationOptions(this.decorationId, e._getOptions(this.link, k, !0));
	}
	deactivate(O, k) {
		O.changeDecorationOptions(this.decorationId, e._getOptions(this.link, k, !1));
	}
};
function getHoverMessage(e, O) {
	let k = e.url && /^command:/i.test(e.url.toString()), A = e.tooltip ? e.tooltip : k ? localize("links.navigate.executeCmd", "Execute command") : localize("links.navigate.follow", "Follow link"), j = O ? isMacintosh ? localize("links.navigate.kb.meta.mac", "cmd + click") : localize("links.navigate.kb.meta", "ctrl + click") : isMacintosh ? localize("links.navigate.kb.alt.mac", "option + click") : localize("links.navigate.kb.alt", "alt + click");
	if (e.url) {
		let O = "";
		if (/^command:/i.test(e.url.toString())) {
			let k = e.url.toString().match(/^command:([^?#]+)/);
			if (k) {
				let e = k[1];
				O = localize("tooltip.explanation", "Execute command {0}", e);
			}
		}
		return new MarkdownString("", !0).appendLink(e.url.toString(!0).replace(/ /g, "%20"), A, O).appendMarkdown(` (${j})`);
	} else return new MarkdownString().appendText(`${A} (${j})`);
}
var OpenLinkAction = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.openLink",
			label: localize("label", "Open Link"),
			alias: "Open Link",
			precondition: void 0
		});
	}
	run(e, O) {
		let k = LinkDetector.get(O);
		if (!k || !O.hasModel()) return;
		let A = O.getSelections();
		for (let e of A) {
			let O = k.getLinkOccurrence(e.getEndPosition());
			O && k.openLinkOccurrence(O, !1);
		}
	}
};
registerEditorContribution(LinkDetector.ID, LinkDetector, 1), registerEditorAction(OpenLinkAction);
var LongLinesHelper = class extends Disposable {
	static {
		this.ID = "editor.contrib.longLinesHelper";
	}
	constructor(e) {
		super(), this._editor = e, this._register(this._editor.onMouseDown((e) => {
			let O = this._editor.getOption(118);
			O >= 0 && e.target.type === 6 && e.target.position.column >= O && this._editor.updateOptions({ stopRenderingLineAfter: -1 });
		}));
	}
};
registerEditorContribution(LongLinesHelper.ID, LongLinesHelper, 2);
var wordHighlightBackground = registerColor("editor.wordHighlightBackground", {
	dark: "#575757B8",
	light: "#57575740",
	hcDark: null,
	hcLight: null
}, localize("wordHighlight", "Background color of a symbol during read-access, like reading a variable. The color must not be opaque so as not to hide underlying decorations."), !0);
registerColor("editor.wordHighlightStrongBackground", {
	dark: "#004972B8",
	light: "#0e639c40",
	hcDark: null,
	hcLight: null
}, localize("wordHighlightStrong", "Background color of a symbol during write-access, like writing to a variable. The color must not be opaque so as not to hide underlying decorations."), !0), registerColor("editor.wordHighlightTextBackground", wordHighlightBackground, localize("wordHighlightText", "Background color of a textual occurrence for a symbol. The color must not be opaque so as not to hide underlying decorations."), !0);
var wordHighlightBorder = registerColor("editor.wordHighlightBorder", {
	light: null,
	dark: null,
	hcDark: activeContrastBorder,
	hcLight: activeContrastBorder
}, localize("wordHighlightBorder", "Border color of a symbol during read-access, like reading a variable."));
registerColor("editor.wordHighlightStrongBorder", {
	light: null,
	dark: null,
	hcDark: activeContrastBorder,
	hcLight: activeContrastBorder
}, localize("wordHighlightStrongBorder", "Border color of a symbol during write-access, like writing to a variable.")), registerColor("editor.wordHighlightTextBorder", wordHighlightBorder, localize("wordHighlightTextBorder", "Border color of a textual occurrence for a symbol."));
var overviewRulerWordHighlightForeground = registerColor("editorOverviewRuler.wordHighlightForeground", "#A0A0A0CC", localize("overviewRulerWordHighlightForeground", "Overview ruler marker color for symbol highlights. The color must not be opaque so as not to hide underlying decorations."), !0), overviewRulerWordHighlightStrongForeground = registerColor("editorOverviewRuler.wordHighlightStrongForeground", "#C0A0C0CC", localize("overviewRulerWordHighlightStrongForeground", "Overview ruler marker color for write-access symbol highlights. The color must not be opaque so as not to hide underlying decorations."), !0), overviewRulerWordHighlightTextForeground = registerColor("editorOverviewRuler.wordHighlightTextForeground", overviewRulerSelectionHighlightForeground, localize("overviewRulerWordHighlightTextForeground", "Overview ruler marker color of a textual occurrence for a symbol. The color must not be opaque so as not to hide underlying decorations."), !0), _WRITE_OPTIONS = ModelDecorationOptions.register({
	description: "word-highlight-strong",
	stickiness: 1,
	className: "wordHighlightStrong",
	overviewRuler: {
		color: themeColorFromId(overviewRulerWordHighlightStrongForeground),
		position: OverviewRulerLane.Center
	},
	minimap: {
		color: themeColorFromId(minimapSelectionOccurrenceHighlight),
		position: 1
	}
}), _TEXT_OPTIONS = ModelDecorationOptions.register({
	description: "word-highlight-text",
	stickiness: 1,
	className: "wordHighlightText",
	overviewRuler: {
		color: themeColorFromId(overviewRulerWordHighlightTextForeground),
		position: OverviewRulerLane.Center
	},
	minimap: {
		color: themeColorFromId(minimapSelectionOccurrenceHighlight),
		position: 1
	}
}), _SELECTION_HIGHLIGHT_OPTIONS = ModelDecorationOptions.register({
	description: "selection-highlight-overview",
	stickiness: 1,
	className: "selectionHighlight",
	overviewRuler: {
		color: themeColorFromId(overviewRulerSelectionHighlightForeground),
		position: OverviewRulerLane.Center
	},
	minimap: {
		color: themeColorFromId(minimapSelectionOccurrenceHighlight),
		position: 1
	}
}), _SELECTION_HIGHLIGHT_OPTIONS_NO_OVERVIEW = ModelDecorationOptions.register({
	description: "selection-highlight",
	stickiness: 1,
	className: "selectionHighlight"
}), _REGULAR_OPTIONS = ModelDecorationOptions.register({
	description: "word-highlight",
	stickiness: 1,
	className: "wordHighlight",
	overviewRuler: {
		color: themeColorFromId(overviewRulerWordHighlightForeground),
		position: OverviewRulerLane.Center
	},
	minimap: {
		color: themeColorFromId(minimapSelectionOccurrenceHighlight),
		position: 1
	}
});
function getHighlightDecorationOptions(e) {
	return e === DocumentHighlightKind.Write ? _WRITE_OPTIONS : e === DocumentHighlightKind.Text ? _TEXT_OPTIONS : _REGULAR_OPTIONS;
}
function getSelectionHighlightDecorationOptions(e) {
	return e ? _SELECTION_HIGHLIGHT_OPTIONS_NO_OVERVIEW : _SELECTION_HIGHLIGHT_OPTIONS;
}
registerThemingParticipant((e, O) => {
	let k = e.getColor(editorSelectionHighlight);
	k && O.addRule(`.monaco-editor .selectionHighlight { background-color: ${k.transparent(.5)}; }`);
});
var __decorate$35 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$35 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, SelectionHighlighter_1;
function announceCursorChange(e, O) {
	let k = O.filter((O) => !e.find((e) => e.equals(O)));
	if (k.length >= 1) {
		let e = k.map((e) => `line ${e.viewState.position.lineNumber} column ${e.viewState.position.column}`).join(", "), O = k.length === 1 ? localize("cursorAdded", "Cursor added: {0}", e) : localize("cursorsAdded", "Cursors added: {0}", e);
		status(O);
	}
}
var InsertCursorAbove = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.insertCursorAbove",
			label: localize("mutlicursor.insertAbove", "Add Cursor Above"),
			alias: "Add Cursor Above",
			precondition: void 0,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: 2576,
				linux: {
					primary: 1552,
					secondary: [3088]
				},
				weight: 100
			},
			menuOpts: {
				menuId: MenuId.MenubarSelectionMenu,
				group: "3_multi",
				title: localize({
					key: "miInsertCursorAbove",
					comment: ["&& denotes a mnemonic"]
				}, "&&Add Cursor Above"),
				order: 2
			}
		});
	}
	run(e, O, k) {
		if (!O.hasModel()) return;
		let A = !0;
		k && k.logicalLine === !1 && (A = !1);
		let j = O._getViewModel();
		if (j.cursorConfig.readOnly) return;
		j.model.pushStackElement();
		let M = j.getCursorStates();
		j.setCursorStates(k.source, 3, CursorMoveCommands.addCursorUp(j, M, A)), j.revealTopMostCursor(k.source), announceCursorChange(M, j.getCursorStates());
	}
}, InsertCursorBelow = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.insertCursorBelow",
			label: localize("mutlicursor.insertBelow", "Add Cursor Below"),
			alias: "Add Cursor Below",
			precondition: void 0,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: 2578,
				linux: {
					primary: 1554,
					secondary: [3090]
				},
				weight: 100
			},
			menuOpts: {
				menuId: MenuId.MenubarSelectionMenu,
				group: "3_multi",
				title: localize({
					key: "miInsertCursorBelow",
					comment: ["&& denotes a mnemonic"]
				}, "A&&dd Cursor Below"),
				order: 3
			}
		});
	}
	run(e, O, k) {
		if (!O.hasModel()) return;
		let A = !0;
		k && k.logicalLine === !1 && (A = !1);
		let j = O._getViewModel();
		if (j.cursorConfig.readOnly) return;
		j.model.pushStackElement();
		let M = j.getCursorStates();
		j.setCursorStates(k.source, 3, CursorMoveCommands.addCursorDown(j, M, A)), j.revealBottomMostCursor(k.source), announceCursorChange(M, j.getCursorStates());
	}
}, InsertCursorAtEndOfEachLineSelected = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.insertCursorAtEndOfEachLineSelected",
			label: localize("mutlicursor.insertAtEndOfEachLineSelected", "Add Cursors to Line Ends"),
			alias: "Add Cursors to Line Ends",
			precondition: void 0,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: 1575,
				weight: 100
			},
			menuOpts: {
				menuId: MenuId.MenubarSelectionMenu,
				group: "3_multi",
				title: localize({
					key: "miInsertCursorAtEndOfEachLineSelected",
					comment: ["&& denotes a mnemonic"]
				}, "Add C&&ursors to Line Ends"),
				order: 4
			}
		});
	}
	getCursorsForSelection(e, O, k) {
		if (!e.isEmpty()) {
			for (let A = e.startLineNumber; A < e.endLineNumber; A++) {
				let e = O.getLineMaxColumn(A);
				k.push(new Selection(A, e, A, e));
			}
			e.endColumn > 1 && k.push(new Selection(e.endLineNumber, e.endColumn, e.endLineNumber, e.endColumn));
		}
	}
	run(e, O) {
		if (!O.hasModel()) return;
		let k = O.getModel(), A = O.getSelections(), j = O._getViewModel(), M = j.getCursorStates(), N = [];
		A.forEach((e) => this.getCursorsForSelection(e, k, N)), N.length > 0 && O.setSelections(N), announceCursorChange(M, j.getCursorStates());
	}
}, InsertCursorAtEndOfLineSelected = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.addCursorsToBottom",
			label: localize("mutlicursor.addCursorsToBottom", "Add Cursors To Bottom"),
			alias: "Add Cursors To Bottom",
			precondition: void 0
		});
	}
	run(e, O) {
		if (!O.hasModel()) return;
		let k = O.getSelections(), A = O.getModel().getLineCount(), j = [];
		for (let e = k[0].startLineNumber; e <= A; e++) j.push(new Selection(e, k[0].startColumn, e, k[0].endColumn));
		let M = O._getViewModel(), N = M.getCursorStates();
		j.length > 0 && O.setSelections(j), announceCursorChange(N, M.getCursorStates());
	}
}, InsertCursorAtTopOfLineSelected = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.addCursorsToTop",
			label: localize("mutlicursor.addCursorsToTop", "Add Cursors To Top"),
			alias: "Add Cursors To Top",
			precondition: void 0
		});
	}
	run(e, O) {
		if (!O.hasModel()) return;
		let k = O.getSelections(), A = [];
		for (let e = k[0].startLineNumber; e >= 1; e--) A.push(new Selection(e, k[0].startColumn, e, k[0].endColumn));
		let j = O._getViewModel(), M = j.getCursorStates();
		A.length > 0 && O.setSelections(A), announceCursorChange(M, j.getCursorStates());
	}
}, MultiCursorSessionResult = class {
	constructor(e, O, k) {
		this.selections = e, this.revealRange = O, this.revealScrollType = k;
	}
}, MultiCursorSession = class e {
	static create(O, k) {
		if (!O.hasModel()) return null;
		let A = k.getState();
		if (!O.hasTextFocus() && A.isRevealed && A.searchString.length > 0) return new e(O, k, !1, A.searchString, A.wholeWord, A.matchCase, null);
		let j = !1, M, N, P = O.getSelections();
		P.length === 1 && P[0].isEmpty() ? (j = !0, M = !0, N = !0) : (M = A.wholeWord, N = A.matchCase);
		let F = O.getSelection(), I, L = null;
		if (F.isEmpty()) {
			let e = O.getConfiguredWordAtPosition(F.getStartPosition());
			if (!e) return null;
			I = e.word, L = new Selection(F.startLineNumber, e.startColumn, F.startLineNumber, e.endColumn);
		} else I = O.getModel().getValueInRange(F).replace(/\r\n/g, "\n");
		return new e(O, k, j, I, M, N, L);
	}
	constructor(e, O, k, A, j, M, N) {
		this._editor = e, this.findController = O, this.isDisconnectedFromFindController = k, this.searchText = A, this.wholeWord = j, this.matchCase = M, this.currentMatch = N;
	}
	addSelectionToNextFindMatch() {
		if (!this._editor.hasModel()) return null;
		let e = this._getNextMatch();
		if (!e) return null;
		let O = this._editor.getSelections();
		return new MultiCursorSessionResult(O.concat(e), e, 0);
	}
	moveSelectionToNextFindMatch() {
		if (!this._editor.hasModel()) return null;
		let e = this._getNextMatch();
		if (!e) return null;
		let O = this._editor.getSelections();
		return new MultiCursorSessionResult(O.slice(0, O.length - 1).concat(e), e, 0);
	}
	_getNextMatch() {
		if (!this._editor.hasModel()) return null;
		if (this.currentMatch) {
			let e = this.currentMatch;
			return this.currentMatch = null, e;
		}
		this.findController.highlightFindOptions();
		let e = this._editor.getSelections(), O = e[e.length - 1], k = this._editor.getModel().findNextMatch(this.searchText, O.getEndPosition(), !1, this.matchCase, this.wholeWord ? this._editor.getOption(132) : null, !1);
		return k ? new Selection(k.range.startLineNumber, k.range.startColumn, k.range.endLineNumber, k.range.endColumn) : null;
	}
	addSelectionToPreviousFindMatch() {
		if (!this._editor.hasModel()) return null;
		let e = this._getPreviousMatch();
		if (!e) return null;
		let O = this._editor.getSelections();
		return new MultiCursorSessionResult(O.concat(e), e, 0);
	}
	moveSelectionToPreviousFindMatch() {
		if (!this._editor.hasModel()) return null;
		let e = this._getPreviousMatch();
		if (!e) return null;
		let O = this._editor.getSelections();
		return new MultiCursorSessionResult(O.slice(0, O.length - 1).concat(e), e, 0);
	}
	_getPreviousMatch() {
		if (!this._editor.hasModel()) return null;
		if (this.currentMatch) {
			let e = this.currentMatch;
			return this.currentMatch = null, e;
		}
		this.findController.highlightFindOptions();
		let e = this._editor.getSelections(), O = e[e.length - 1], k = this._editor.getModel().findPreviousMatch(this.searchText, O.getStartPosition(), !1, this.matchCase, this.wholeWord ? this._editor.getOption(132) : null, !1);
		return k ? new Selection(k.range.startLineNumber, k.range.startColumn, k.range.endLineNumber, k.range.endColumn) : null;
	}
	selectAll(e) {
		if (!this._editor.hasModel()) return [];
		this.findController.highlightFindOptions();
		let O = this._editor.getModel();
		return e ? O.findMatches(this.searchText, e, !1, this.matchCase, this.wholeWord ? this._editor.getOption(132) : null, !1, 1073741824) : O.findMatches(this.searchText, !0, !1, this.matchCase, this.wholeWord ? this._editor.getOption(132) : null, !1, 1073741824);
	}
}, MultiCursorSelectionController = class e extends Disposable {
	static {
		this.ID = "editor.contrib.multiCursorController";
	}
	static get(O) {
		return O.getContribution(e.ID);
	}
	constructor(e) {
		super(), this._sessionDispose = this._register(new DisposableStore()), this._editor = e, this._ignoreSelectionChange = !1, this._session = null;
	}
	dispose() {
		this._endSession(), super.dispose();
	}
	_beginSessionIfNeeded(e) {
		if (!this._session) {
			let O = MultiCursorSession.create(this._editor, e);
			if (!O) return;
			this._session = O;
			let k = { searchString: this._session.searchText };
			this._session.isDisconnectedFromFindController && (k.wholeWordOverride = 1, k.matchCaseOverride = 1, k.isRegexOverride = 2), e.getState().change(k, !1), this._sessionDispose.add(this._editor.onDidChangeCursorSelection((e) => {
				this._ignoreSelectionChange || this._endSession();
			})), this._sessionDispose.add(this._editor.onDidBlurEditorText(() => {
				this._endSession();
			})), this._sessionDispose.add(e.getState().onFindReplaceStateChange((e) => {
				(e.matchCase || e.wholeWord) && this._endSession();
			}));
		}
	}
	_endSession() {
		this._sessionDispose.clear(), this._session && this._session.isDisconnectedFromFindController && this._session.findController.getState().change({
			wholeWordOverride: 0,
			matchCaseOverride: 0,
			isRegexOverride: 0
		}, !1), this._session = null;
	}
	_setSelections(e) {
		this._ignoreSelectionChange = !0, this._editor.setSelections(e), this._ignoreSelectionChange = !1;
	}
	_expandEmptyToWord(e, O) {
		if (!O.isEmpty()) return O;
		let k = this._editor.getConfiguredWordAtPosition(O.getStartPosition());
		return k ? new Selection(O.startLineNumber, k.startColumn, O.startLineNumber, k.endColumn) : O;
	}
	_applySessionResult(e) {
		e && (this._setSelections(e.selections), e.revealRange && this._editor.revealRangeInCenterIfOutsideViewport(e.revealRange, e.revealScrollType));
	}
	getSession(e) {
		return this._session;
	}
	addSelectionToNextFindMatch(e) {
		if (this._editor.hasModel()) {
			if (!this._session) {
				let O = this._editor.getSelections();
				if (O.length > 1) {
					let k = e.getState().matchCase;
					if (!modelRangesContainSameText(this._editor.getModel(), O, k)) {
						let e = this._editor.getModel(), k = [];
						for (let A = 0, j = O.length; A < j; A++) k[A] = this._expandEmptyToWord(e, O[A]);
						this._editor.setSelections(k);
						return;
					}
				}
			}
			this._beginSessionIfNeeded(e), this._session && this._applySessionResult(this._session.addSelectionToNextFindMatch());
		}
	}
	addSelectionToPreviousFindMatch(e) {
		this._beginSessionIfNeeded(e), this._session && this._applySessionResult(this._session.addSelectionToPreviousFindMatch());
	}
	moveSelectionToNextFindMatch(e) {
		this._beginSessionIfNeeded(e), this._session && this._applySessionResult(this._session.moveSelectionToNextFindMatch());
	}
	moveSelectionToPreviousFindMatch(e) {
		this._beginSessionIfNeeded(e), this._session && this._applySessionResult(this._session.moveSelectionToPreviousFindMatch());
	}
	selectAll(e) {
		if (!this._editor.hasModel()) return;
		let O = null, k = e.getState();
		if (k.isRevealed && k.searchString.length > 0 && k.isRegex) {
			let e = this._editor.getModel();
			O = k.searchScope ? e.findMatches(k.searchString, k.searchScope, k.isRegex, k.matchCase, k.wholeWord ? this._editor.getOption(132) : null, !1, 1073741824) : e.findMatches(k.searchString, !0, k.isRegex, k.matchCase, k.wholeWord ? this._editor.getOption(132) : null, !1, 1073741824);
		} else {
			if (this._beginSessionIfNeeded(e), !this._session) return;
			O = this._session.selectAll(k.searchScope);
		}
		if (O.length > 0) {
			let e = this._editor.getSelection();
			for (let k = 0, A = O.length; k < A; k++) {
				let A = O[k];
				if (A.range.intersectRanges(e)) {
					O[k] = O[0], O[0] = A;
					break;
				}
			}
			this._setSelections(O.map((e) => new Selection(e.range.startLineNumber, e.range.startColumn, e.range.endLineNumber, e.range.endColumn)));
		}
	}
}, MultiCursorSelectionControllerAction = class extends EditorAction {
	run(e, O) {
		let k = MultiCursorSelectionController.get(O);
		if (!k) return;
		let A = O._getViewModel();
		if (A) {
			let j = A.getCursorStates(), M = CommonFindController.get(O);
			if (M) this._run(k, M);
			else {
				let A = e.get(IInstantiationService).createInstance(CommonFindController, O);
				this._run(k, A), A.dispose();
			}
			announceCursorChange(j, A.getCursorStates());
		}
	}
}, AddSelectionToNextFindMatchAction = class extends MultiCursorSelectionControllerAction {
	constructor() {
		super({
			id: "editor.action.addSelectionToNextFindMatch",
			label: localize("addSelectionToNextFindMatch", "Add Selection To Next Find Match"),
			alias: "Add Selection To Next Find Match",
			precondition: void 0,
			kbOpts: {
				kbExpr: EditorContextKeys.focus,
				primary: 2082,
				weight: 100
			},
			menuOpts: {
				menuId: MenuId.MenubarSelectionMenu,
				group: "3_multi",
				title: localize({
					key: "miAddSelectionToNextFindMatch",
					comment: ["&& denotes a mnemonic"]
				}, "Add &&Next Occurrence"),
				order: 5
			}
		});
	}
	_run(e, O) {
		e.addSelectionToNextFindMatch(O);
	}
}, AddSelectionToPreviousFindMatchAction = class extends MultiCursorSelectionControllerAction {
	constructor() {
		super({
			id: "editor.action.addSelectionToPreviousFindMatch",
			label: localize("addSelectionToPreviousFindMatch", "Add Selection To Previous Find Match"),
			alias: "Add Selection To Previous Find Match",
			precondition: void 0,
			menuOpts: {
				menuId: MenuId.MenubarSelectionMenu,
				group: "3_multi",
				title: localize({
					key: "miAddSelectionToPreviousFindMatch",
					comment: ["&& denotes a mnemonic"]
				}, "Add P&&revious Occurrence"),
				order: 6
			}
		});
	}
	_run(e, O) {
		e.addSelectionToPreviousFindMatch(O);
	}
}, MoveSelectionToNextFindMatchAction = class extends MultiCursorSelectionControllerAction {
	constructor() {
		super({
			id: "editor.action.moveSelectionToNextFindMatch",
			label: localize("moveSelectionToNextFindMatch", "Move Last Selection To Next Find Match"),
			alias: "Move Last Selection To Next Find Match",
			precondition: void 0,
			kbOpts: {
				kbExpr: EditorContextKeys.focus,
				primary: KeyChord(2089, 2082),
				weight: 100
			}
		});
	}
	_run(e, O) {
		e.moveSelectionToNextFindMatch(O);
	}
}, MoveSelectionToPreviousFindMatchAction = class extends MultiCursorSelectionControllerAction {
	constructor() {
		super({
			id: "editor.action.moveSelectionToPreviousFindMatch",
			label: localize("moveSelectionToPreviousFindMatch", "Move Last Selection To Previous Find Match"),
			alias: "Move Last Selection To Previous Find Match",
			precondition: void 0
		});
	}
	_run(e, O) {
		e.moveSelectionToPreviousFindMatch(O);
	}
}, SelectHighlightsAction = class extends MultiCursorSelectionControllerAction {
	constructor() {
		super({
			id: "editor.action.selectHighlights",
			label: localize("selectAllOccurrencesOfFindMatch", "Select All Occurrences of Find Match"),
			alias: "Select All Occurrences of Find Match",
			precondition: void 0,
			kbOpts: {
				kbExpr: EditorContextKeys.focus,
				primary: 3114,
				weight: 100
			},
			menuOpts: {
				menuId: MenuId.MenubarSelectionMenu,
				group: "3_multi",
				title: localize({
					key: "miSelectHighlights",
					comment: ["&& denotes a mnemonic"]
				}, "Select All &&Occurrences"),
				order: 7
			}
		});
	}
	_run(e, O) {
		e.selectAll(O);
	}
}, CompatChangeAll = class extends MultiCursorSelectionControllerAction {
	constructor() {
		super({
			id: "editor.action.changeAll",
			label: localize("changeAll.label", "Change All Occurrences"),
			alias: "Change All Occurrences",
			precondition: ContextKeyExpr.and(EditorContextKeys.writable, EditorContextKeys.editorTextFocus),
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: 2108,
				weight: 100
			},
			contextMenuOpts: {
				group: "1_modification",
				order: 1.2
			}
		});
	}
	_run(e, O) {
		e.selectAll(O);
	}
}, SelectionHighlighterState = class {
	constructor(e, O, k, A, j) {
		this._model = e, this._searchText = O, this._matchCase = k, this._wordSeparators = A, this._modelVersionId = this._model.getVersionId(), this._cachedFindMatches = null, j && this._model === j._model && this._searchText === j._searchText && this._matchCase === j._matchCase && this._wordSeparators === j._wordSeparators && this._modelVersionId === j._modelVersionId && (this._cachedFindMatches = j._cachedFindMatches);
	}
	findMatches() {
		return this._cachedFindMatches === null && (this._cachedFindMatches = this._model.findMatches(this._searchText, !0, !1, this._matchCase, this._wordSeparators, !1).map((e) => e.range), this._cachedFindMatches.sort(Range.compareRangesUsingStarts)), this._cachedFindMatches;
	}
}, SelectionHighlighter = class extends Disposable {
	static {
		SelectionHighlighter_1 = this;
	}
	static {
		this.ID = "editor.contrib.selectionHighlighter";
	}
	constructor(e, O) {
		super(), this._languageFeaturesService = O, this.editor = e, this._isEnabled = e.getOption(109), this._decorations = e.createDecorationsCollection(), this.updateSoon = this._register(new RunOnceScheduler(() => this._update(), 300)), this.state = null, this._register(e.onDidChangeConfiguration((O) => {
			this._isEnabled = e.getOption(109);
		})), this._register(e.onDidChangeCursorSelection((e) => {
			this._isEnabled && (e.selection.isEmpty() ? e.reason === 3 ? (this.state && this._setState(null), this.updateSoon.schedule()) : this._setState(null) : this._update());
		})), this._register(e.onDidChangeModel((e) => {
			this._setState(null);
		})), this._register(e.onDidChangeModelContent((e) => {
			this._isEnabled && this.updateSoon.schedule();
		}));
		let k = CommonFindController.get(e);
		k && this._register(k.getState().onFindReplaceStateChange((e) => {
			this._update();
		})), this.updateSoon.schedule();
	}
	_update() {
		this._setState(SelectionHighlighter_1._createState(this.state, this._isEnabled, this.editor));
	}
	static _createState(e, O, k) {
		if (!O || !k.hasModel()) return null;
		let A = k.getSelection();
		if (A.startLineNumber !== A.endLineNumber) return null;
		let j = MultiCursorSelectionController.get(k);
		if (!j) return null;
		let M = CommonFindController.get(k);
		if (!M) return null;
		let N = j.getSession(M);
		if (!N) {
			let e = k.getSelections();
			if (e.length > 1) {
				let O = M.getState().matchCase;
				if (!modelRangesContainSameText(k.getModel(), e, O)) return null;
			}
			N = MultiCursorSession.create(k, M);
		}
		if (!N || N.currentMatch || /^[ \t]+$/.test(N.searchText) || N.searchText.length > 200) return null;
		let P = M.getState(), F = P.matchCase;
		if (P.isRevealed) {
			let e = P.searchString;
			F || (e = e.toLowerCase());
			let O = N.searchText;
			if (F || (O = O.toLowerCase()), e === O && N.matchCase === P.matchCase && N.wholeWord === P.wholeWord && !P.isRegex) return null;
		}
		return new SelectionHighlighterState(k.getModel(), N.searchText, N.matchCase, N.wholeWord ? k.getOption(132) : null, e);
	}
	_setState(e) {
		if (this.state = e, !this.state) {
			this._decorations.clear();
			return;
		}
		if (!this.editor.hasModel()) return;
		let O = this.editor.getModel();
		if (O.isTooLargeForTokenization()) return;
		let k = this.state.findMatches(), A = this.editor.getSelections();
		A.sort(Range.compareRangesUsingStarts);
		let j = [];
		for (let e = 0, O = 0, M = k.length, N = A.length; e < M;) {
			let M = k[e];
			if (O >= N) j.push(M), e++;
			else {
				let k = Range.compareRangesUsingStarts(M, A[O]);
				k < 0 ? ((A[O].isEmpty() || !Range.areIntersecting(M, A[O])) && j.push(M), e++) : (k > 0 || e++, O++);
			}
		}
		let M = this.editor.getOption(81) !== "off", N = this._languageFeaturesService.documentHighlightProvider.has(O) && M, P = j.map((e) => ({
			range: e,
			options: getSelectionHighlightDecorationOptions(N)
		}));
		this._decorations.set(P);
	}
	dispose() {
		this._setState(null), super.dispose();
	}
};
SelectionHighlighter = SelectionHighlighter_1 = __decorate$35([__param$35(1, ILanguageFeaturesService)], SelectionHighlighter);
function modelRangesContainSameText(e, O, k) {
	let A = getValueInRange(e, O[0], !k);
	for (let j = 1, M = O.length; j < M; j++) {
		let M = O[j];
		if (M.isEmpty()) return !1;
		let N = getValueInRange(e, M, !k);
		if (A !== N) return !1;
	}
	return !0;
}
function getValueInRange(e, O, k) {
	let A = e.getValueInRange(O);
	return k ? A.toLowerCase() : A;
}
var FocusNextCursor = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.focusNextCursor",
			label: localize("mutlicursor.focusNextCursor", "Focus Next Cursor"),
			metadata: {
				description: localize("mutlicursor.focusNextCursor.description", "Focuses the next cursor"),
				args: []
			},
			alias: "Focus Next Cursor",
			precondition: void 0
		});
	}
	run(e, O, k) {
		if (!O.hasModel()) return;
		let A = O._getViewModel();
		if (A.cursorConfig.readOnly) return;
		A.model.pushStackElement();
		let j = Array.from(A.getCursorStates()), M = j.shift();
		M && (j.push(M), A.setCursorStates(k.source, 3, j), A.revealPrimaryCursor(k.source, !0), announceCursorChange(j, A.getCursorStates()));
	}
}, FocusPreviousCursor = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.focusPreviousCursor",
			label: localize("mutlicursor.focusPreviousCursor", "Focus Previous Cursor"),
			metadata: {
				description: localize("mutlicursor.focusPreviousCursor.description", "Focuses the previous cursor"),
				args: []
			},
			alias: "Focus Previous Cursor",
			precondition: void 0
		});
	}
	run(e, O, k) {
		if (!O.hasModel()) return;
		let A = O._getViewModel();
		if (A.cursorConfig.readOnly) return;
		A.model.pushStackElement();
		let j = Array.from(A.getCursorStates()), M = j.pop();
		M && (j.unshift(M), A.setCursorStates(k.source, 3, j), A.revealPrimaryCursor(k.source, !0), announceCursorChange(j, A.getCursorStates()));
	}
};
registerEditorContribution(MultiCursorSelectionController.ID, MultiCursorSelectionController, 4), registerEditorContribution(SelectionHighlighter.ID, SelectionHighlighter, 1), registerEditorAction(InsertCursorAbove), registerEditorAction(InsertCursorBelow), registerEditorAction(InsertCursorAtEndOfEachLineSelected), registerEditorAction(AddSelectionToNextFindMatchAction), registerEditorAction(AddSelectionToPreviousFindMatchAction), registerEditorAction(MoveSelectionToNextFindMatchAction), registerEditorAction(MoveSelectionToPreviousFindMatchAction), registerEditorAction(SelectHighlightsAction), registerEditorAction(CompatChangeAll), registerEditorAction(InsertCursorAtEndOfLineSelected), registerEditorAction(InsertCursorAtTopOfLineSelected), registerEditorAction(FocusNextCursor), registerEditorAction(FocusPreviousCursor);
var __decorate$34 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$34 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
};
const INLINE_EDIT_DESCRIPTION = "inline-edit";
var GhostTextWidget = class extends Disposable {
	constructor(e, O, k) {
		super(), this.editor = e, this.model = O, this.languageService = k, this.isDisposed = observableValue(this, !1), this.currentTextModel = observableFromEvent(this, this.editor.onDidChangeModel, () => this.editor.getModel()), this.uiState = derived(this, (e) => {
			if (this.isDisposed.read(e)) return;
			let O = this.currentTextModel.read(e);
			if (O !== this.model.targetTextModel.read(e)) return;
			let k = this.model.ghostText.read(e);
			if (!k) return;
			let A = this.model.range?.read(e);
			A && A.startLineNumber === A.endLineNumber && A.startColumn === A.endColumn && (A = void 0);
			let j = (A ? A.startLineNumber === A.endLineNumber : !0) && k.parts.length === 1 && k.parts[0].lines.length === 1, M = k.parts.length === 1 && k.parts[0].lines.every((e) => e.length === 0), N = [], P = [];
			function F(e, O) {
				if (P.length > 0) {
					let k = P[P.length - 1];
					O && k.decorations.push(new LineDecoration(k.content.length + 1, k.content.length + 1 + e[0].length, O, 0)), k.content += e[0], e = e.slice(1);
				}
				for (let k of e) P.push({
					content: k,
					decorations: O ? [new LineDecoration(1, k.length + 1, O, 0)] : []
				});
			}
			let I = O.getLineContent(k.lineNumber), L, R = 0;
			if (!M && (j || !A)) {
				for (let e of k.parts) {
					let O = e.lines;
					A && !j && (F(O, INLINE_EDIT_DESCRIPTION), O = []), L === void 0 ? (N.push({
						column: e.column,
						text: O[0],
						preview: e.preview
					}), O = O.slice(1)) : F([I.substring(R, e.column - 1)], void 0), O.length > 0 && (F(O, INLINE_EDIT_DESCRIPTION), L === void 0 && e.column <= I.length && (L = e.column)), R = e.column - 1;
				}
				L !== void 0 && F([I.substring(R)], void 0);
			}
			let z = L === void 0 ? void 0 : new ColumnRange(L, I.length + 1), B = j || !A ? k.lineNumber : A.endLineNumber - 1;
			return {
				inlineTexts: N,
				additionalLines: P,
				hiddenRange: z,
				lineNumber: B,
				additionalReservedLineCount: this.model.minReservedLineCount.read(e),
				targetTextModel: O,
				range: A,
				isSingleLine: j,
				isPureRemove: M
			};
		}), this.decorations = derived(this, (e) => {
			let O = this.uiState.read(e);
			if (!O) return [];
			let k = [];
			if (O.hiddenRange && k.push({
				range: O.hiddenRange.toRange(O.lineNumber),
				options: {
					inlineClassName: "inline-edit-hidden",
					description: "inline-edit-hidden"
				}
			}), O.range) {
				let e = [];
				if (O.isSingleLine) e.push(O.range);
				else if (!O.isPureRemove) {
					let k = O.range.endLineNumber - O.range.startLineNumber;
					for (let A = 0; A < k; A++) {
						let k = O.range.startLineNumber + A, j = O.targetTextModel.getLineFirstNonWhitespaceColumn(k), M = O.targetTextModel.getLineLastNonWhitespaceColumn(k), N = new Range(k, j, k, M);
						e.push(N);
					}
				}
				for (let O of e) k.push({
					range: O,
					options: diffDeleteDecoration
				});
			}
			if (O.range && !O.isSingleLine && O.isPureRemove) {
				let e = new Range(O.range.startLineNumber, 1, O.range.endLineNumber - 1, 1);
				k.push({
					range: e,
					options: diffLineDeleteDecorationBackgroundWithIndicator
				});
			}
			for (let e of O.inlineTexts) k.push({
				range: Range.fromPositions(new Position(O.lineNumber, e.column)),
				options: {
					description: INLINE_EDIT_DESCRIPTION,
					after: {
						content: e.text,
						inlineClassName: e.preview ? "inline-edit-decoration-preview" : "inline-edit-decoration",
						cursorStops: InjectedTextCursorStops.Left
					},
					showIfCollapsed: !0
				}
			});
			return k;
		}), this._register(toDisposable(() => {
			this.isDisposed.set(!0, void 0);
		})), this._register(applyObservableDecorations(this.editor, this.decorations));
	}
};
GhostTextWidget = __decorate$34([__param$34(2, ILanguageService)], GhostTextWidget);
var __decorate$33 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$33 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, InlineEditHintsContentWidget_1, InlineEditHintsWidget = class extends Disposable {
	constructor(e, O, k) {
		super(), this.editor = e, this.model = O, this.instantiationService = k, this.alwaysShowToolbar = observableFromEvent(this, this.editor.onDidChangeConfiguration, () => this.editor.getOption(63).showToolbar === "always"), this.sessionPosition = void 0, this.position = derived(this, (e) => {
			let O = this.model.read(e)?.model.ghostText.read(e);
			if (!this.alwaysShowToolbar.read(e) || !O || O.parts.length === 0) return this.sessionPosition = void 0, null;
			let k = O.parts[0].column;
			this.sessionPosition && this.sessionPosition.lineNumber !== O.lineNumber && (this.sessionPosition = void 0);
			let A = new Position(O.lineNumber, Math.min(k, this.sessionPosition?.column ?? 2 ** 53 - 1));
			return this.sessionPosition = A, A;
		}), this._register(autorunWithStore((O, k) => {
			if (!this.model.read(O) || !this.alwaysShowToolbar.read(O)) return;
			let A = k.add(this.instantiationService.createInstance(InlineEditHintsContentWidget, this.editor, !0, this.position));
			e.addContentWidget(A), k.add(toDisposable(() => e.removeContentWidget(A)));
		}));
	}
};
InlineEditHintsWidget = __decorate$33([__param$33(2, IInstantiationService)], InlineEditHintsWidget);
var InlineEditHintsContentWidget = class extends Disposable {
	static {
		InlineEditHintsContentWidget_1 = this;
	}
	static {
		this._dropDownVisible = !1;
	}
	static {
		this.id = 0;
	}
	constructor(e, O, k, A, j, M) {
		super(), this.editor = e, this.withBorder = O, this._position = k, this._contextKeyService = j, this._menuService = M, this.id = `InlineEditHintsContentWidget${InlineEditHintsContentWidget_1.id++}`, this.allowEditorOverflow = !0, this.suppressMouseDown = !1, this.nodes = h("div.inlineEditHints", { className: this.withBorder ? ".withBorder" : "" }, [h("div@toolBar")]), this.inlineCompletionsActionsMenus = this._register(this._menuService.createMenu(MenuId.InlineEditActions, this._contextKeyService)), this.toolBar = this._register(A.createInstance(CustomizedMenuWorkbenchToolBar, this.nodes.toolBar, this.editor, MenuId.InlineEditToolbar, {
			menuOptions: { renderShortTitle: !0 },
			toolbarOptions: { primaryGroup: (e) => e.startsWith("primary") },
			actionViewItemProvider: (e, O) => {
				if (e instanceof MenuItemAction) return A.createInstance(StatusBarViewItem, e, void 0);
			},
			telemetrySource: "InlineEditToolbar"
		})), this._register(this.toolBar.onDidChangeDropdownVisibility((e) => {
			InlineEditHintsContentWidget_1._dropDownVisible = e;
		})), this._register(autorun((e) => {
			this._position.read(e), this.editor.layoutContentWidget(this);
		})), this._register(autorun((e) => {
			let O = [];
			for (let [e, k] of this.inlineCompletionsActionsMenus.getActions()) for (let e of k) e instanceof MenuItemAction && O.push(e);
			O.length > 0 && O.unshift(new Separator()), this.toolBar.setAdditionalSecondaryActions(O);
		}));
	}
	getId() {
		return this.id;
	}
	getDomNode() {
		return this.nodes.root;
	}
	getPosition() {
		return {
			position: this._position.get(),
			preference: [1, 2],
			positionAffinity: 3
		};
	}
};
InlineEditHintsContentWidget = InlineEditHintsContentWidget_1 = __decorate$33([
	__param$33(3, IInstantiationService),
	__param$33(4, IContextKeyService),
	__param$33(5, IMenuService)
], InlineEditHintsContentWidget);
var StatusBarViewItem = class extends MenuEntryActionViewItem {
	updateLabel() {
		let e = this._keybindingService.lookupKeybinding(this._action.id, this._contextKeyService);
		if (!e) return super.updateLabel();
		if (this.label) {
			let O = h("div.keybinding").root;
			this._register(new KeybindingLabel(O, OS, {
				disableTitle: !0,
				...unthemedKeybindingLabelOptions
			})).set(e), this.label.textContent = this._action.label, this.label.appendChild(O), this.label.classList.add("inlineEditStatusBarItemLabel");
		}
	}
	updateTooltip() {}
}, CustomizedMenuWorkbenchToolBar = class extends WorkbenchToolBar {
	constructor(e, O, k, A, j, M, N, P, F, I) {
		super(e, {
			resetMenu: k,
			...A
		}, j, M, N, P, F, I), this.editor = O, this.menuId = k, this.options2 = A, this.menuService = j, this.contextKeyService = M, this.menu = this._store.add(this.menuService.createMenu(this.menuId, this.contextKeyService, { emitEventsForSubmenuChanges: !0 })), this.additionalActions = [], this.prependedPrimaryActions = [], this._store.add(this.menu.onDidChange(() => this.updateToolbar())), this._store.add(this.editor.onDidChangeCursorPosition(() => this.updateToolbar())), this.updateToolbar();
	}
	updateToolbar() {
		let e = [], O = [];
		createAndFillInActionBarActions(this.menu, this.options2?.menuOptions, {
			primary: e,
			secondary: O
		}, this.options2?.toolbarOptions?.primaryGroup, this.options2?.toolbarOptions?.shouldInlineSubmenu, this.options2?.toolbarOptions?.useSeparatorsInPrimaryActions), O.push(...this.additionalActions), e.unshift(...this.prependedPrimaryActions), this.setActions(e, O);
	}
	setAdditionalSecondaryActions(e) {
		equals(this.additionalActions, e, (e, O) => e === O) || (this.additionalActions = e, this.updateToolbar());
	}
};
CustomizedMenuWorkbenchToolBar = __decorate$33([
	__param$33(4, IMenuService),
	__param$33(5, IContextKeyService),
	__param$33(6, IContextMenuService),
	__param$33(7, IKeybindingService),
	__param$33(8, ICommandService),
	__param$33(9, ITelemetryService)
], CustomizedMenuWorkbenchToolBar);
var __decorate$32 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$32 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, InlineEditSideBySideWidget_1, InlineEditSideBySideContentWidget_1;
function* range(e, O, k = 1) {
	O === void 0 && ([O, e] = [e, 0]);
	for (let A = e; A < O; A += k) yield A;
}
function removeIndentation(e) {
	let O = e[0].match(/^\s*/)?.[0] ?? "", k = O.length;
	return {
		text: e.map((e) => e.replace(/* @__PURE__ */ RegExp("^" + O), "")),
		shift: k
	};
}
var InlineEditSideBySideWidget = class extends Disposable {
	static {
		InlineEditSideBySideWidget_1 = this;
	}
	static {
		this._modelId = 0;
	}
	static _createUniqueUri() {
		return URI.from({
			scheme: "inline-edit-widget",
			path: (/* @__PURE__ */ new Date()).toString() + String(InlineEditSideBySideWidget_1._modelId++)
		});
	}
	constructor(e, O, k, A, j) {
		super(), this._editor = e, this._model = O, this._instantiationService = k, this._diffProviderFactoryService = A, this._modelService = j, this._position = derived(this, (e) => {
			let O = this._model.read(e);
			if (!O || O.text.length === 0 || O.range.startLineNumber === O.range.endLineNumber && !(O.range.startColumn === O.range.endColumn && O.range.startColumn === 1)) return null;
			let k = this._editor.getModel();
			if (!k) return null;
			let A = Array.from(range(O.range.startLineNumber, O.range.endLineNumber + 1)), j = A.map((e) => k.getLineLastNonWhitespaceColumn(e)), M = Math.max(...j), N = A[j.indexOf(M)], P = new Position(N, M);
			return {
				top: O.range.startLineNumber,
				left: P
			};
		}), this._text = derived(this, (e) => {
			let O = this._model.read(e);
			if (!O) return {
				text: "",
				shift: 0
			};
			let k = removeIndentation(O.text.split("\n"));
			return {
				text: k.text.join("\n"),
				shift: k.shift
			};
		}), this._originalModel = derivedDisposable(() => this._modelService.createModel("", null, InlineEditSideBySideWidget_1._createUniqueUri())).keepObserved(this._store), this._modifiedModel = derivedDisposable(() => this._modelService.createModel("", null, InlineEditSideBySideWidget_1._createUniqueUri())).keepObserved(this._store), this._diff = derived(this, (e) => this._diffPromise.read(e)?.promiseResult.read(e)?.data), this._diffPromise = derived(this, (e) => {
			let O = this._model.read(e);
			if (!O) return;
			let k = this._editor.getModel();
			if (!k) return;
			let A = removeIndentation(k.getValueInRange(O.range).split("\n")).text.join("\n"), j = removeIndentation(O.text.split("\n")).text.join("\n");
			this._originalModel.get().setValue(A), this._modifiedModel.get().setValue(j);
			let M = this._diffProviderFactoryService.createDiffProvider({ diffAlgorithm: "advanced" });
			return ObservablePromise.fromFn(async () => {
				let e = await M.computeDiff(this._originalModel.get(), this._modifiedModel.get(), {
					computeMoves: !1,
					ignoreTrimWhitespace: !1,
					maxComputationTimeMs: 1e3
				}, CancellationToken.None);
				if (!e.identical) return e.changes;
			});
		}), this._register(autorunWithStore((O, k) => {
			if (!this._model.read(O) || this._position.get() === null) return;
			let A = k.add(this._instantiationService.createInstance(InlineEditSideBySideContentWidget, this._editor, this._position, this._text.map((e) => e.text), this._text.map((e) => e.shift), this._diff));
			e.addOverlayWidget(A), k.add(toDisposable(() => e.removeOverlayWidget(A)));
		}));
	}
};
InlineEditSideBySideWidget = InlineEditSideBySideWidget_1 = __decorate$32([
	__param$32(2, IInstantiationService),
	__param$32(3, IDiffProviderFactoryService),
	__param$32(4, IModelService)
], InlineEditSideBySideWidget);
var InlineEditSideBySideContentWidget = class extends Disposable {
	static {
		InlineEditSideBySideContentWidget_1 = this;
	}
	static {
		this.id = 0;
	}
	constructor(e, O, k, A, j, M) {
		super(), this._editor = e, this._position = O, this._text = k, this._shift = A, this._diff = j, this._instantiationService = M, this.id = `InlineEditSideBySideContentWidget${InlineEditSideBySideContentWidget_1.id++}`, this.allowEditorOverflow = !1, this._nodes = $("div.inlineEditSideBySide", void 0), this._scrollChanged = observableSignalFromEvent("editor.onDidScrollChange", this._editor.onDidScrollChange), this._previewEditor = this._register(this._instantiationService.createInstance(EmbeddedCodeEditorWidget, this._nodes, {
			glyphMargin: !1,
			lineNumbers: "off",
			minimap: { enabled: !1 },
			guides: {
				indentation: !1,
				bracketPairs: !1,
				bracketPairsHorizontal: !1,
				highlightActiveIndentation: !1
			},
			folding: !1,
			selectOnLineNumbers: !1,
			selectionHighlight: !1,
			columnSelection: !1,
			overviewRulerBorder: !1,
			overviewRulerLanes: 0,
			lineDecorationsWidth: 0,
			lineNumbersMinChars: 0,
			scrollbar: {
				vertical: "hidden",
				horizontal: "hidden",
				alwaysConsumeMouseWheel: !1,
				handleMouseWheel: !1
			},
			readOnly: !0,
			wordWrap: "off",
			wordWrapOverride1: "off",
			wordWrapOverride2: "off",
			wrappingIndent: "none",
			wrappingStrategy: void 0
		}, {
			contributions: [],
			isSimpleWidget: !0
		}, this._editor)), this._previewEditorObs = observableCodeEditor(this._previewEditor), this._editorObs = observableCodeEditor(this._editor), this._previewTextModel = this._register(this._instantiationService.createInstance(TextModel, "", this._editor.getModel()?.getLanguageId() ?? "plaintext", TextModel.DEFAULT_CREATION_OPTIONS, null)), this._setText = derived((e) => {
			let O = this._text.read(e);
			O && this._previewTextModel.setValue(O);
		}).recomputeInitiallyAndOnChange(this._store), this._decorations = derived(this, (e) => {
			this._setText.read(e);
			let O = this._position.read(e);
			if (!O) return {
				org: [],
				mod: []
			};
			let k = this._diff.read(e);
			if (!k) return {
				org: [],
				mod: []
			};
			let A = [], j = [];
			if (k.length === 1 && k[0].innerChanges[0].modifiedRange.equalsRange(this._previewTextModel.getFullModelRange())) return {
				org: [],
				mod: []
			};
			let M = this._shift.get(), N = (e) => new Range(e.startLineNumber + O.top - 1, e.startColumn + M, e.endLineNumber + O.top - 1, e.endColumn + M);
			for (let e of k) if (e.original.isEmpty || A.push({
				range: N(e.original.toInclusiveRange()),
				options: diffLineDeleteDecorationBackgroundWithIndicator
			}), e.modified.isEmpty || j.push({
				range: e.modified.toInclusiveRange(),
				options: diffLineAddDecorationBackgroundWithIndicator
			}), e.modified.isEmpty || e.original.isEmpty) e.original.isEmpty || A.push({
				range: N(e.original.toInclusiveRange()),
				options: diffWholeLineDeleteDecoration
			}), e.modified.isEmpty || j.push({
				range: e.modified.toInclusiveRange(),
				options: diffWholeLineAddDecoration
			});
			else for (let O of e.innerChanges || []) e.original.contains(O.originalRange.startLineNumber) && A.push({
				range: N(O.originalRange),
				options: O.originalRange.isEmpty() ? diffDeleteDecorationEmpty : diffDeleteDecoration
			}), e.modified.contains(O.modifiedRange.startLineNumber) && j.push({
				range: O.modifiedRange,
				options: O.modifiedRange.isEmpty() ? diffAddDecorationEmpty : diffAddDecoration
			});
			return {
				org: A,
				mod: j
			};
		}), this._originalDecorations = derived(this, (e) => this._decorations.read(e).org), this._modifiedDecorations = derived(this, (e) => this._decorations.read(e).mod), this._previewEditor.setModel(this._previewTextModel), this._register(this._editorObs.setDecorations(this._originalDecorations)), this._register(this._previewEditorObs.setDecorations(this._modifiedDecorations)), this._register(autorun((e) => {
			let O = this._previewEditorObs.contentWidth.read(e), k = this._text.read(e).split("\n").length - 1, A = this._editor.getOption(67) * k;
			O <= 0 || this._previewEditor.layout({
				height: A,
				width: O
			});
		})), this._register(autorun((e) => {
			this._position.read(e), this._editor.layoutOverlayWidget(this);
		})), this._register(autorun((e) => {
			this._scrollChanged.read(e), this._position.read(e) && this._editor.layoutOverlayWidget(this);
		}));
	}
	getId() {
		return this.id;
	}
	getDomNode() {
		return this._nodes;
	}
	getPosition() {
		let e = this._position.get();
		if (!e) return null;
		let O = this._editor.getLayoutInfo(), k = this._editor.getScrolledVisiblePosition(new Position(e.top, 1));
		if (!k) return null;
		let A = k.top - 1, j = this._editor.getOffsetForColumn(e.left.lineNumber, e.left.column);
		return { preference: {
			left: O.contentLeft + j + 10,
			top: A
		} };
	}
};
InlineEditSideBySideContentWidget = InlineEditSideBySideContentWidget_1 = __decorate$32([__param$32(5, IInstantiationService)], InlineEditSideBySideContentWidget);
var __decorate$31 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$31 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, InlineEditController_1, InlineEditController = class extends Disposable {
	static {
		InlineEditController_1 = this;
	}
	static {
		this.ID = "editor.contrib.inlineEditController";
	}
	static {
		this.inlineEditVisibleKey = "inlineEditVisible";
	}
	static {
		this.inlineEditVisibleContext = new RawContextKey(this.inlineEditVisibleKey, !1);
	}
	static {
		this.cursorAtInlineEditKey = "cursorAtInlineEdit";
	}
	static {
		this.cursorAtInlineEditContext = new RawContextKey(this.cursorAtInlineEditKey, !1);
	}
	static get(e) {
		return e.getContribution(InlineEditController_1.ID);
	}
	constructor(e, O, k, A, j, M, N, P) {
		super(), this.editor = e, this.instantiationService = O, this.contextKeyService = k, this.languageFeaturesService = A, this._commandService = j, this._configurationService = M, this._diffProviderFactoryService = N, this._modelService = P, this._isVisibleContext = InlineEditController_1.inlineEditVisibleContext.bindTo(this.contextKeyService), this._isCursorAtInlineEditContext = InlineEditController_1.cursorAtInlineEditContext.bindTo(this.contextKeyService), this._currentEdit = observableValue(this, void 0), this._currentWidget = derivedDisposable(this._currentEdit, (e) => {
			let O = this._currentEdit.read(e);
			if (!O) return;
			let k = O.range.endLineNumber, A = O.range.endColumn, j = O.text.endsWith("\n") && !(O.range.startLineNumber === O.range.endLineNumber && O.range.startColumn === O.range.endColumn) ? O.text.slice(0, -1) : O.text, M = new GhostText(k, [new GhostTextPart(A, j, !1)]), N = O.range.startLineNumber === O.range.endLineNumber && M.parts.length === 1 && M.parts[0].lines.length === 1, P = O.text === "";
			if (!(!N && !P)) return this.instantiationService.createInstance(GhostTextWidget, this.editor, {
				ghostText: constObservable(M),
				minReservedLineCount: constObservable(0),
				targetTextModel: constObservable(this.editor.getModel() ?? void 0),
				range: constObservable(O.range)
			});
		}), this._isAccepting = observableValue(this, !1), this._enabled = observableFromEvent(this, this.editor.onDidChangeConfiguration, () => this.editor.getOption(63).enabled), this._fontFamily = observableFromEvent(this, this.editor.onDidChangeConfiguration, () => this.editor.getOption(63).fontFamily);
		let F = observableSignalFromEvent("InlineEditController.modelContentChangedSignal", e.onDidChangeModelContent);
		this._register(autorun((O) => {
			this._enabled.read(O) && (F.read(O), !this._isAccepting.read(O) && this.getInlineEdit(e, !0));
		}));
		let I = observableFromEvent(this, e.onDidChangeCursorPosition, () => e.getPosition());
		this._register(autorun((e) => {
			if (!this._enabled.read(e)) return;
			let O = I.read(e);
			O && this.checkCursorPosition(O);
		})), this._register(autorun((O) => {
			let k = this._currentEdit.read(O);
			if (this._isCursorAtInlineEditContext.set(!1), !k) {
				this._isVisibleContext.set(!1);
				return;
			}
			this._isVisibleContext.set(!0);
			let A = e.getPosition();
			A && this.checkCursorPosition(A);
		}));
		let L = observableSignalFromEvent("InlineEditController.editorBlurSignal", e.onDidBlurEditorWidget);
		this._register(autorun(async (O) => {
			this._enabled.read(O) && (L.read(O), !(this._configurationService.getValue("editor.experimentalInlineEdit.keepOnBlur") || e.getOption(63).keepOnBlur) && (this._currentRequestCts?.dispose(!0), this._currentRequestCts = void 0, await this.clear(!1)));
		}));
		let R = observableSignalFromEvent("InlineEditController.editorFocusSignal", e.onDidFocusEditorText);
		this._register(autorun((O) => {
			this._enabled.read(O) && (R.read(O), this.getInlineEdit(e, !0));
		}));
		let z = this._register(createStyleSheet2());
		this._register(autorun((e) => {
			let O = this._fontFamily.read(e);
			z.setStyle(O === "" || O === "default" ? "" : `
.monaco-editor .inline-edit-decoration,
.monaco-editor .inline-edit-decoration-preview,
.monaco-editor .inline-edit {
	font-family: ${O};
}`);
		})), this._register(new InlineEditHintsWidget(this.editor, this._currentWidget, this.instantiationService)), this._register(new InlineEditSideBySideWidget(this.editor, this._currentEdit, this.instantiationService, this._diffProviderFactoryService, this._modelService));
	}
	checkCursorPosition(e) {
		if (!this._currentEdit) {
			this._isCursorAtInlineEditContext.set(!1);
			return;
		}
		let O = this._currentEdit.get();
		if (!O) {
			this._isCursorAtInlineEditContext.set(!1);
			return;
		}
		this._isCursorAtInlineEditContext.set(Range.containsPosition(O.range, e));
	}
	validateInlineEdit(e, O) {
		if (O.text.includes("\n") && O.range.startLineNumber !== O.range.endLineNumber && O.range.startColumn !== O.range.endColumn) {
			if (O.range.startColumn !== 1) return !1;
			let k = O.range.endLineNumber, A = O.range.endColumn, j = e.getModel()?.getLineLength(k) ?? 0;
			if (A !== j + 1) return !1;
		}
		return !0;
	}
	async fetchInlineEdit(e, O) {
		this._currentRequestCts && this._currentRequestCts.dispose(!0);
		let k = e.getModel();
		if (!k) return;
		let A = k.getVersionId(), j = this.languageFeaturesService.inlineEditProvider.all(k);
		if (j.length === 0) return;
		let M = j[0];
		this._currentRequestCts = new CancellationTokenSource();
		let N = this._currentRequestCts.token, P = O ? InlineEditTriggerKind.Automatic : InlineEditTriggerKind.Invoke;
		if (O && await wait(50, N), N.isCancellationRequested || k.isDisposed() || k.getVersionId() !== A) return;
		let F = await M.provideInlineEdit(k, { triggerKind: P }, N);
		if (F && !(N.isCancellationRequested || k.isDisposed() || k.getVersionId() !== A) && this.validateInlineEdit(e, F)) return F;
	}
	async getInlineEdit(e, O) {
		this._isCursorAtInlineEditContext.set(!1), await this.clear();
		let k = await this.fetchInlineEdit(e, O);
		k && this._currentEdit.set(k, void 0);
	}
	async trigger() {
		await this.getInlineEdit(this.editor, !1);
	}
	async jumpBack() {
		this._jumpBackPosition && (this.editor.setPosition(this._jumpBackPosition), this.editor.revealPositionInCenterIfOutsideViewport(this._jumpBackPosition));
	}
	async accept() {
		this._isAccepting.set(!0, void 0);
		let e = this._currentEdit.get();
		if (!e) return;
		let O = e.text;
		e.text.startsWith("\n") && (O = e.text.substring(1)), this.editor.pushUndoStop(), this.editor.executeEdits("acceptCurrent", [EditOperation.replace(Range.lift(e.range), O)]), e.accepted && await this._commandService.executeCommand(e.accepted.id, ...e.accepted.arguments || []).then(void 0, onUnexpectedExternalError), this.freeEdit(e), transaction((e) => {
			this._currentEdit.set(void 0, e), this._isAccepting.set(!1, e);
		});
	}
	jumpToCurrent() {
		this._jumpBackPosition = this.editor.getSelection()?.getStartPosition();
		let e = this._currentEdit.get();
		if (!e) return;
		let O = Position.lift({
			lineNumber: e.range.startLineNumber,
			column: e.range.startColumn
		});
		this.editor.setPosition(O), this.editor.revealPositionInCenterIfOutsideViewport(O);
	}
	async clear(e = !0) {
		let O = this._currentEdit.get();
		O && O?.rejected && e && await this._commandService.executeCommand(O.rejected.id, ...O.rejected.arguments || []).then(void 0, onUnexpectedExternalError), O && this.freeEdit(O), this._currentEdit.set(void 0, void 0);
	}
	freeEdit(e) {
		let O = this.editor.getModel();
		if (!O) return;
		let k = this.languageFeaturesService.inlineEditProvider.all(O);
		k.length !== 0 && k[0].freeInlineEdit(e);
	}
};
InlineEditController = InlineEditController_1 = __decorate$31([
	__param$31(1, IInstantiationService),
	__param$31(2, IContextKeyService),
	__param$31(3, ILanguageFeaturesService),
	__param$31(4, ICommandService),
	__param$31(5, IConfigurationService),
	__param$31(6, IDiffProviderFactoryService),
	__param$31(7, IModelService)
], InlineEditController);
function wait(e, O) {
	return new Promise((k) => {
		let A, j = setTimeout(() => {
			A && A.dispose(), k();
		}, e);
		O && (A = O.onCancellationRequested(() => {
			clearTimeout(j), A && A.dispose(), k();
		}));
	});
}
var AcceptInlineEdit$1 = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.inlineEdit.accept",
			label: "Accept Inline Edit",
			alias: "Accept Inline Edit",
			precondition: ContextKeyExpr.and(EditorContextKeys.writable, InlineEditController.inlineEditVisibleContext),
			kbOpts: [{
				weight: 101,
				primary: 2,
				kbExpr: ContextKeyExpr.and(EditorContextKeys.writable, InlineEditController.inlineEditVisibleContext, InlineEditController.cursorAtInlineEditContext)
			}],
			menuOpts: [{
				menuId: MenuId.InlineEditToolbar,
				title: "Accept",
				group: "primary",
				order: 1
			}]
		});
	}
	async run(e, O) {
		await InlineEditController.get(O)?.accept();
	}
}, TriggerInlineEdit = class extends EditorAction {
	constructor() {
		let e = ContextKeyExpr.and(EditorContextKeys.writable, ContextKeyExpr.not(InlineEditController.inlineEditVisibleKey));
		super({
			id: "editor.action.inlineEdit.trigger",
			label: "Trigger Inline Edit",
			alias: "Trigger Inline Edit",
			precondition: e,
			kbOpts: {
				weight: 101,
				primary: 2646,
				kbExpr: e
			}
		});
	}
	async run(e, O) {
		InlineEditController.get(O)?.trigger();
	}
}, JumpToInlineEdit = class extends EditorAction {
	constructor() {
		let e = ContextKeyExpr.and(EditorContextKeys.writable, InlineEditController.inlineEditVisibleContext, ContextKeyExpr.not(InlineEditController.cursorAtInlineEditKey));
		super({
			id: "editor.action.inlineEdit.jumpTo",
			label: "Jump to Inline Edit",
			alias: "Jump to Inline Edit",
			precondition: e,
			kbOpts: {
				weight: 101,
				primary: 2646,
				kbExpr: e
			},
			menuOpts: [{
				menuId: MenuId.InlineEditToolbar,
				title: "Jump To Edit",
				group: "primary",
				order: 3,
				when: e
			}]
		});
	}
	async run(e, O) {
		InlineEditController.get(O)?.jumpToCurrent();
	}
}, JumpBackInlineEdit = class extends EditorAction {
	constructor() {
		let e = ContextKeyExpr.and(EditorContextKeys.writable, InlineEditController.cursorAtInlineEditContext);
		super({
			id: "editor.action.inlineEdit.jumpBack",
			label: "Jump Back from Inline Edit",
			alias: "Jump Back from Inline Edit",
			precondition: e,
			kbOpts: {
				weight: 110,
				primary: 2646,
				kbExpr: e
			},
			menuOpts: [{
				menuId: MenuId.InlineEditToolbar,
				title: "Jump Back",
				group: "primary",
				order: 3,
				when: e
			}]
		});
	}
	async run(e, O) {
		InlineEditController.get(O)?.jumpBack();
	}
}, RejectInlineEdit = class extends EditorAction {
	constructor() {
		let e = ContextKeyExpr.and(EditorContextKeys.writable, InlineEditController.inlineEditVisibleContext);
		super({
			id: "editor.action.inlineEdit.reject",
			label: "Reject Inline Edit",
			alias: "Reject Inline Edit",
			precondition: e,
			kbOpts: {
				weight: 100,
				primary: 9,
				kbExpr: e
			},
			menuOpts: [{
				menuId: MenuId.InlineEditToolbar,
				title: "Reject",
				group: "secondary",
				order: 2
			}]
		});
	}
	async run(e, O) {
		await InlineEditController.get(O)?.clear();
	}
};
registerEditorAction(AcceptInlineEdit$1), registerEditorAction(RejectInlineEdit), registerEditorAction(JumpToInlineEdit), registerEditorAction(JumpBackInlineEdit), registerEditorAction(TriggerInlineEdit), registerEditorContribution(InlineEditController.ID, InlineEditController, 3);
const inlineEditVisible = new RawContextKey("inlineEditsVisible", !1, localize("inlineEditsVisible", "Whether an inline edit is visible")), isPinnedContextKey = new RawContextKey("inlineEditsIsPinned", !1, localize("isPinned", "Whether an inline edit is visible"));
var PlaceholderTextContribution = class extends Disposable {
	static {
		this.ID = "editor.contrib.placeholderText";
	}
	constructor(e) {
		super(), this._editor = e, this._editorObs = observableCodeEditor(this._editor), this._placeholderText = this._editorObs.getOption(88), this._state = derivedOpts({
			owner: this,
			equalsFn: structuralEquals
		}, (e) => {
			let O = this._placeholderText.read(e);
			if (O && this._editorObs.valueIsEmpty.read(e)) return { placeholder: O };
		}), this._shouldViewBeAlive = isOrWasTrue(this, (e) => this._state.read(e)?.placeholder !== void 0), this._view = derivedWithStore((e, O) => {
			if (!this._shouldViewBeAlive.read(e)) return;
			let k = h("div.editorPlaceholder");
			O.add(autorun((e) => {
				let O = this._state.read(e), A = O?.placeholder !== void 0;
				k.root.style.display = A ? "block" : "none", k.root.innerText = O?.placeholder ?? "";
			})), O.add(autorun((e) => {
				let O = this._editorObs.layoutInfo.read(e);
				k.root.style.left = `${O.contentLeft}px`, k.root.style.width = O.contentWidth - O.verticalScrollbarWidth + "px", k.root.style.top = `${this._editor.getTopForLineNumber(0)}px`;
			})), O.add(autorun((e) => {
				k.root.style.fontFamily = this._editorObs.getOption(49).read(e), k.root.style.fontSize = this._editorObs.getOption(52).read(e) + "px", k.root.style.lineHeight = this._editorObs.getOption(67).read(e) + "px";
			})), O.add(this._editorObs.createOverlayWidget({
				allowEditorOverflow: !1,
				minContentWidthInPx: constObservable(0),
				position: constObservable(null),
				domNode: k.root
			}));
		}), this._view.recomputeInitiallyAndOnChange(this._store);
	}
};
function isOrWasTrue(e, O) {
	return derivedObservableWithCache(e, (e, k) => k === !0 ? !0 : O(e));
}
var __decorate$30 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$30 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, InlineEdit = class {
	constructor(e, O, k) {
		this.range = e, this.newLines = O, this.changes = k;
	}
}, InlineEditsWidget = class extends Disposable {
	constructor(O, k, A, j) {
		super(), this._editor = O, this._edit = k, this._userPrompt = A, this._instantiationService = j, this._editorObs = observableCodeEditor(this._editor), this._elements = h("div.inline-edits-widget", { style: {
			position: "absolute",
			overflow: "visible",
			top: "0px",
			left: "0px"
		} }, [h("div@editorContainer", { style: {
			position: "absolute",
			top: "0px",
			left: "0px",
			width: "500px",
			height: "500px"
		} }, [
			h("div.toolbar@toolbar", { style: {
				position: "absolute",
				top: "-25px",
				left: "0px"
			} }),
			h("div.promptEditor@promptEditor", { style: {
				position: "absolute",
				top: "-25px",
				left: "80px",
				width: "300px",
				height: "22px"
			} }),
			h("div.preview@editor", { style: {
				position: "absolute",
				top: "0px",
				left: "0px"
			} })
		]), svgElem("svg", { style: {
			overflow: "visible",
			pointerEvents: "none"
		} }, [svgElem("defs", [svgElem("linearGradient", {
			id: "Gradient2",
			x1: "0",
			y1: "0",
			x2: "1",
			y2: "0"
		}, [svgElem("stop", {
			offset: "0%",
			class: "gradient-stop"
		}), svgElem("stop", {
			offset: "100%",
			class: "gradient-stop"
		})])]), svgElem("path@path", {
			d: "",
			fill: "url(#Gradient2)"
		})])]), this._previewTextModel = this._register(this._instantiationService.createInstance(TextModel, "", PLAINTEXT_LANGUAGE_ID, TextModel.DEFAULT_CREATION_OPTIONS, null)), this._setText = derived((e) => {
			let O = this._edit.read(e);
			O && this._previewTextModel.setValue(O.newLines.join("\n"));
		}).recomputeInitiallyAndOnChange(this._store), this._promptTextModel = this._register(this._instantiationService.createInstance(TextModel, "", PLAINTEXT_LANGUAGE_ID, TextModel.DEFAULT_CREATION_OPTIONS, null)), this._promptEditor = this._register(this._instantiationService.createInstance(EmbeddedCodeEditorWidget, this._elements.promptEditor, {
			glyphMargin: !1,
			lineNumbers: "off",
			minimap: { enabled: !1 },
			guides: {
				indentation: !1,
				bracketPairs: !1,
				bracketPairsHorizontal: !1,
				highlightActiveIndentation: !1
			},
			folding: !1,
			selectOnLineNumbers: !1,
			selectionHighlight: !1,
			columnSelection: !1,
			overviewRulerBorder: !1,
			overviewRulerLanes: 0,
			lineDecorationsWidth: 0,
			lineNumbersMinChars: 0,
			placeholder: "Describe the change you want...",
			fontFamily: DEFAULT_FONT_FAMILY
		}, {
			contributions: EditorExtensionsRegistry.getSomeEditorContributions([
				SuggestController.ID,
				PlaceholderTextContribution.ID,
				ContextMenuController.ID
			]),
			isSimpleWidget: !0
		}, this._editor)), this._previewEditor = this._register(this._instantiationService.createInstance(EmbeddedCodeEditorWidget, this._elements.editor, {
			glyphMargin: !1,
			lineNumbers: "off",
			minimap: { enabled: !1 },
			guides: {
				indentation: !1,
				bracketPairs: !1,
				bracketPairsHorizontal: !1,
				highlightActiveIndentation: !1
			},
			folding: !1,
			selectOnLineNumbers: !1,
			selectionHighlight: !1,
			columnSelection: !1,
			overviewRulerBorder: !1,
			overviewRulerLanes: 0,
			lineDecorationsWidth: 0,
			lineNumbersMinChars: 0
		}, { contributions: [] }, this._editor)), this._previewEditorObs = observableCodeEditor(this._previewEditor), this._decorations = derived(this, (e) => {
			this._setText.read(e);
			let O = this._edit.read(e)?.changes;
			if (!O) return [];
			let k = [], A = [];
			if (O.length === 1 && O[0].innerChanges[0].modifiedRange.equalsRange(this._previewTextModel.getFullModelRange())) return [];
			for (let e of O) if (e.original.isEmpty || k.push({
				range: e.original.toInclusiveRange(),
				options: diffLineDeleteDecorationBackgroundWithIndicator
			}), e.modified.isEmpty || A.push({
				range: e.modified.toInclusiveRange(),
				options: diffLineAddDecorationBackgroundWithIndicator
			}), e.modified.isEmpty || e.original.isEmpty) e.original.isEmpty || k.push({
				range: e.original.toInclusiveRange(),
				options: diffWholeLineDeleteDecoration
			}), e.modified.isEmpty || A.push({
				range: e.modified.toInclusiveRange(),
				options: diffWholeLineAddDecoration
			});
			else for (let O of e.innerChanges || []) e.original.contains(O.originalRange.startLineNumber) && k.push({
				range: O.originalRange,
				options: O.originalRange.isEmpty() ? diffDeleteDecorationEmpty : diffDeleteDecoration
			}), e.modified.contains(O.modifiedRange.startLineNumber) && A.push({
				range: O.modifiedRange,
				options: O.modifiedRange.isEmpty() ? diffAddDecorationEmpty : diffAddDecoration
			});
			return A;
		}), this._layout1 = derived(this, (e) => {
			let O = this._editor.getModel(), k = this._edit.read(e);
			if (!k) return null;
			let A = k.range, j = 0;
			for (let e = A.startLineNumber; e < A.endLineNumberExclusive; e++) {
				let k = O.getLineMaxColumn(e), A = this._editor.getOffsetForColumn(e, k);
				j = Math.max(j, A);
			}
			return { left: this._editor.getLayoutInfo().contentLeft + j };
		}), this._layout = derived(this, (e) => {
			let O = this._edit.read(e);
			if (!O) return null;
			let k = O.range, A = this._editorObs.scrollLeft.read(e), j = this._layout1.read(e).left + 20 - A, M = this._editor.getTopForLineNumber(k.startLineNumber) - this._editorObs.scrollTop.read(e), N = this._editor.getTopForLineNumber(k.endLineNumberExclusive) - this._editorObs.scrollTop.read(e), P = new Point(j, M), F = new Point(j, N), I = N - M, L = this._editor.getOption(67) * O.newLines.length, R = I - L, z = new Point(j + 50, M + R / 2), B = new Point(j + 50, N - R / 2);
			return {
				topCode: P,
				bottomCode: F,
				codeHeight: I,
				topEdit: z,
				bottomEdit: B,
				editHeight: L
			};
		});
		let M = derived(this, (e) => this._edit.read(e) !== void 0 || this._userPrompt.read(e) !== void 0);
		this._register(applyStyle(this._elements.root, { display: derived(this, (e) => M.read(e) ? "block" : "none") })), this._register(appendRemoveOnDispose(this._editor.getDomNode(), this._elements.root)), this._register(observableCodeEditor(O).createOverlayWidget({
			domNode: this._elements.root,
			position: constObservable(null),
			allowEditorOverflow: !1,
			minContentWidthInPx: derived((e) => {
				let O = this._layout1.read(e)?.left;
				if (O === void 0) return 0;
				let k = this._previewEditorObs.contentWidth.read(e);
				return O + k;
			})
		})), this._previewEditor.setModel(this._previewTextModel), this._register(this._previewEditorObs.setDecorations(this._decorations)), this._register(autorun((e) => {
			let O = this._layout.read(e);
			if (!O) return;
			let { topCode: k, bottomCode: A, topEdit: j, bottomEdit: M, editHeight: N } = O, P = new PathBuilder().moveTo(k).lineTo(k.deltaX(10)).curveTo(k.deltaX(50), j.deltaX(-40), j.deltaX(-0)).lineTo(j).lineTo(M).lineTo(M.deltaX(-0)).curveTo(M.deltaX(-40), A.deltaX(50), A.deltaX(10)).lineTo(A).build();
			this._elements.path.setAttribute("d", P), this._elements.editorContainer.style.top = `${j.y}px`, this._elements.editorContainer.style.left = `${j.x}px`, this._elements.editorContainer.style.height = `${N}px`;
			let F = this._previewEditorObs.contentWidth.read(e);
			this._previewEditor.layout({
				height: N,
				width: F
			});
		})), this._promptEditor.setModel(this._promptTextModel), this._promptEditor.layout(), this._register(createTwoWaySync(mapSettableObservable(this._userPrompt, (e) => e ?? "", (e) => e), observableCodeEditor(this._promptEditor).value)), this._register(autorun((e) => {
			let O = observableCodeEditor(this._promptEditor).isFocused.read(e);
			this._elements.root.classList.toggle("focused", O);
		}));
	}
};
InlineEditsWidget = __decorate$30([__param$30(3, IInstantiationService)], InlineEditsWidget);
function mapSettableObservable(e, O, k) {
	return derivedWithSetter(void 0, (k) => O(e.read(k)), (O, A) => e.set(k(O), A));
}
var Point = class e {
	constructor(e, O) {
		this.x = e, this.y = O;
	}
	deltaX(O) {
		return new e(this.x + O, this.y);
	}
}, PathBuilder = class {
	constructor() {
		this._data = "";
	}
	moveTo(e) {
		return this._data += `M ${e.x} ${e.y} `, this;
	}
	lineTo(e) {
		return this._data += `L ${e.x} ${e.y} `, this;
	}
	curveTo(e, O, k) {
		return this._data += `C ${e.x} ${e.y} ${O.x} ${O.y} ${k.x} ${k.y} `, this;
	}
	build() {
		return this._data;
	}
};
function createTwoWaySync(e, O) {
	let k = new DisposableStore();
	return k.add(autorun((k) => {
		let A = e.read(k);
		O.set(A, void 0);
	})), k.add(autorun((k) => {
		let A = O.read(k);
		e.set(A, void 0);
	})), k;
}
var __decorate$29 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$29 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, InlineEditsModel_1, InlineEditsModel = class extends Disposable {
	static {
		InlineEditsModel_1 = this;
	}
	static {
		this._modelId = 0;
	}
	static _createUniqueUri() {
		return URI.from({
			scheme: "inline-edits",
			path: (/* @__PURE__ */ new Date()).toString() + String(InlineEditsModel_1._modelId++)
		});
	}
	constructor(e, O, k, A, j, M, N) {
		super(), this.textModel = e, this._textModelVersionId = O, this._selection = k, this._debounceValue = A, this.languageFeaturesService = j, this._diffProviderFactoryService = M, this._modelService = N, this._forceUpdateExplicitlySignal = observableSignal(this), this._selectedInlineCompletionId = observableValue(this, void 0), this._isActive = observableValue(this, !1), this._originalModel = derivedDisposable(() => this._modelService.createModel("", null, InlineEditsModel_1._createUniqueUri())).keepObserved(this._store), this._modifiedModel = derivedDisposable(() => this._modelService.createModel("", null, InlineEditsModel_1._createUniqueUri())).keepObserved(this._store), this._pinnedRange = new TrackedRange(this.textModel, this._textModelVersionId), this.isPinned = this._pinnedRange.range.map((e) => !!e), this.userPrompt = observableValue(this, void 0), this.inlineEdit = derived(this, (e) => this._inlineEdit.read(e)?.promiseResult.read(e)?.data), this._inlineEdit = derived(this, (e) => {
			let O = this.selectedInlineEdit.read(e);
			if (!O) return;
			let k = O.inlineCompletion.range;
			if (O.inlineCompletion.insertText.trim() === "") return;
			let A = O.inlineCompletion.insertText.split(/\r\n|\r|\n/);
			function j(e) {
				let O = e[0].match(/^\s*/)?.[0] ?? "";
				return e.map((e) => e.replace(/* @__PURE__ */ RegExp("^" + O), ""));
			}
			A = j(A);
			let M = this.textModel.getValueInRange(k).split(/\r\n|\r|\n/);
			M = j(M), this._originalModel.get().setValue(M.join("\n")), this._modifiedModel.get().setValue(A.join("\n"));
			let N = this._diffProviderFactoryService.createDiffProvider({ diffAlgorithm: "advanced" });
			return ObservablePromise.fromFn(async () => {
				let e = await N.computeDiff(this._originalModel.get(), this._modifiedModel.get(), {
					computeMoves: !1,
					ignoreTrimWhitespace: !1,
					maxComputationTimeMs: 1e3
				}, CancellationToken.None);
				if (!e.identical) return new InlineEdit(LineRange.fromRangeInclusive(k), j(A), e.changes);
			});
		}), this._fetchStore = this._register(new DisposableStore()), this._inlineEditsFetchResult = disposableObservableValue(this, void 0), this._inlineEdits = derivedOpts({
			owner: this,
			equalsFn: structuralEquals
		}, (e) => this._inlineEditsFetchResult.read(e)?.completions.map((e) => new InlineEditData(e)) ?? []), this._fetchInlineEditsPromise = derivedHandleChanges({
			owner: this,
			createEmptyChangeSummary: () => ({ inlineCompletionTriggerKind: InlineCompletionTriggerKind.Automatic }),
			handleChange: (e, O) => (e.didChange(this._forceUpdateExplicitlySignal) && (O.inlineCompletionTriggerKind = InlineCompletionTriggerKind.Explicit), !0)
		}, async (e, O) => {
			this._fetchStore.clear(), this._forceUpdateExplicitlySignal.read(e), this._textModelVersionId.read(e);
			function k(e, O) {
				return O(e);
			}
			let A = this._pinnedRange.range.read(e) ?? k(this._selection.read(e), (e) => e.isEmpty() ? void 0 : e);
			if (!A) {
				this._inlineEditsFetchResult.set(void 0, void 0), this.userPrompt.set(void 0, void 0);
				return;
			}
			let j = {
				triggerKind: O.inlineCompletionTriggerKind,
				selectedSuggestionInfo: void 0,
				userPrompt: this.userPrompt.read(e)
			}, M = cancelOnDispose(this._fetchStore);
			await timeout(200, M);
			let N = await provideInlineCompletions(this.languageFeaturesService.inlineCompletionsProvider, A, this.textModel, j, M);
			M.isCancellationRequested || this._inlineEditsFetchResult.set(N, void 0);
		}), this._filteredInlineEditItems = derivedOpts({
			owner: this,
			equalsFn: itemsEquals()
		}, (e) => this._inlineEdits.read(e)), this.selectedInlineCompletionIndex = derived(this, (e) => {
			let O = this._selectedInlineCompletionId.read(e), k = this._filteredInlineEditItems.read(e), A = this._selectedInlineCompletionId === void 0 ? -1 : k.findIndex((e) => e.semanticId === O);
			return A === -1 ? (this._selectedInlineCompletionId.set(void 0, void 0), 0) : A;
		}), this.selectedInlineEdit = derived(this, (e) => {
			let O = this._filteredInlineEditItems.read(e), k = this.selectedInlineCompletionIndex.read(e);
			return O[k];
		}), this._register(recomputeInitiallyAndOnChange(this._fetchInlineEditsPromise));
	}
	async triggerExplicitly(e) {
		subtransaction(e, (e) => {
			this._isActive.set(!0, e), this._forceUpdateExplicitlySignal.trigger(e);
		}), await this._fetchInlineEditsPromise.get();
	}
	stop(e) {
		subtransaction(e, (e) => {
			this.userPrompt.set(void 0, e), this._isActive.set(!1, e), this._inlineEditsFetchResult.set(void 0, e), this._pinnedRange.setRange(void 0, e);
		});
	}
	async _deltaSelectedInlineCompletionIndex(e) {
		await this.triggerExplicitly();
		let O = this._filteredInlineEditItems.get() || [];
		if (O.length > 0) {
			let k = (this.selectedInlineCompletionIndex.get() + e + O.length) % O.length;
			this._selectedInlineCompletionId.set(O[k].semanticId, void 0);
		} else this._selectedInlineCompletionId.set(void 0, void 0);
	}
	async next() {
		await this._deltaSelectedInlineCompletionIndex(1);
	}
	async previous() {
		await this._deltaSelectedInlineCompletionIndex(-1);
	}
	async accept(e) {
		if (e.getModel() !== this.textModel) throw new BugIndicatingError();
		let O = this.selectedInlineEdit.get();
		O && (e.pushUndoStop(), e.executeEdits("inlineSuggestion.accept", [O.inlineCompletion.toSingleTextEdit().toSingleEditOperation()]), this.stop());
	}
};
InlineEditsModel = InlineEditsModel_1 = __decorate$29([
	__param$29(4, ILanguageFeaturesService),
	__param$29(5, IDiffProviderFactoryService),
	__param$29(6, IModelService)
], InlineEditsModel);
var InlineEditData = class {
	constructor(e) {
		this.inlineCompletion = e, this.semanticId = this.inlineCompletion.hash();
	}
}, TrackedRange = class extends Disposable {
	constructor(e, O) {
		super(), this._textModel = e, this._versionId = O, this._decorations = observableValue(this, []), this.range = derived(this, (e) => {
			this._versionId.read(e);
			let O = this._decorations.read(e)[0];
			return O ? this._textModel.getDecorationRange(O) ?? null : null;
		}), this._register(toDisposable(() => {
			this._textModel.deltaDecorations(this._decorations.get(), []);
		}));
	}
	setRange(e, O) {
		this._decorations.set(this._textModel.deltaDecorations(this._decorations.get(), e ? [{
			range: e,
			options: { description: "trackedRange" }
		}] : []), O);
	}
}, __decorate$28 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$28 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, InlineEditsController_1, InlineEditsController = class extends Disposable {
	static {
		InlineEditsController_1 = this;
	}
	static {
		this.ID = "editor.contrib.inlineEditsController";
	}
	static get(e) {
		return e.getContribution(InlineEditsController_1.ID);
	}
	constructor(e, O, k, A, j, M) {
		super(), this.editor = e, this._instantiationService = O, this._contextKeyService = k, this._debounceService = A, this._languageFeaturesService = j, this._configurationService = M, this._enabled = observableConfigValue("editor.inlineEdits.enabled", !1, this._configurationService), this._editorObs = observableCodeEditor(this.editor), this._selection = derived(this, (e) => this._editorObs.cursorSelection.read(e) ?? new Selection(1, 1, 1, 1)), this._debounceValue = this._debounceService.for(this._languageFeaturesService.inlineCompletionsProvider, "InlineEditsDebounce", {
			min: 50,
			max: 50
		}), this.model = derivedDisposable(this, (e) => {
			if (!this._enabled.read(e) || this._editorObs.isReadonly.read(e)) return;
			let O = this._editorObs.model.read(e);
			if (O) return this._instantiationService.createInstance(readHotReloadableExport(InlineEditsModel, e), O, this._editorObs.versionId, this._selection, this._debounceValue);
		}), this._hadInlineEdit = derivedObservableWithCache(this, (e, O) => O || this.model.read(e)?.inlineEdit.read(e) !== void 0), this._widget = derivedDisposable(this, (e) => {
			if (this._hadInlineEdit.read(e)) return this._instantiationService.createInstance(readHotReloadableExport(InlineEditsWidget, e), this.editor, this.model.map((e, O) => e?.inlineEdit.read(O)), flattenSettableObservable((e) => this.model.read(e)?.userPrompt ?? observableValue("empty", "")));
		}), this._register(bindContextKey(inlineEditVisible, this._contextKeyService, (e) => !!this.model.read(e)?.inlineEdit.read(e))), this._register(bindContextKey(isPinnedContextKey, this._contextKeyService, (e) => !!this.model.read(e)?.isPinned.read(e))), this.model.recomputeInitiallyAndOnChange(this._store), this._widget.recomputeInitiallyAndOnChange(this._store);
	}
};
InlineEditsController = InlineEditsController_1 = __decorate$28([
	__param$28(1, IInstantiationService),
	__param$28(2, IContextKeyService),
	__param$28(3, ILanguageFeatureDebounceService),
	__param$28(4, ILanguageFeaturesService),
	__param$28(5, IConfigurationService)
], InlineEditsController);
function flattenSettableObservable(e) {
	return derivedWithSetter(void 0, (O) => e(O).read(O), (O, k) => {
		e(void 0).set(O, k);
	});
}
function labelAndAlias(e) {
	return {
		label: e.value,
		alias: e.original
	};
}
var ShowNextInlineEditAction = class e extends EditorAction {
	static {
		this.ID = "editor.action.inlineEdits.showNext";
	}
	constructor() {
		super({
			id: e.ID,
			...labelAndAlias(localize2("action.inlineEdits.showNext", "Show Next Inline Edit")),
			precondition: ContextKeyExpr.and(EditorContextKeys.writable, inlineEditVisible),
			kbOpts: {
				weight: 100,
				primary: 606
			}
		});
	}
	async run(e, O) {
		InlineEditsController.get(O)?.model.get()?.next();
	}
}, ShowPreviousInlineEditAction = class e extends EditorAction {
	static {
		this.ID = "editor.action.inlineEdits.showPrevious";
	}
	constructor() {
		super({
			id: e.ID,
			...labelAndAlias(localize2("action.inlineEdits.showPrevious", "Show Previous Inline Edit")),
			precondition: ContextKeyExpr.and(EditorContextKeys.writable, inlineEditVisible),
			kbOpts: {
				weight: 100,
				primary: 604
			}
		});
	}
	async run(e, O) {
		InlineEditsController.get(O)?.model.get()?.previous();
	}
}, TriggerInlineEditAction = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.inlineEdits.trigger",
			...labelAndAlias(localize2("action.inlineEdits.trigger", "Trigger Inline Edit")),
			precondition: EditorContextKeys.writable
		});
	}
	async run(e, O) {
		let k = InlineEditsController.get(O);
		await asyncTransaction(async (e) => {
			await k?.model.get()?.triggerExplicitly(e);
		});
	}
}, AcceptInlineEdit = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.inlineEdits.accept",
			...labelAndAlias(localize2("action.inlineEdits.accept", "Accept Inline Edit")),
			precondition: inlineEditVisible,
			menuOpts: {
				menuId: MenuId.InlineEditsActions,
				title: localize("inlineEditsActions", "Accept Inline Edit"),
				group: "primary",
				order: 1,
				icon: Codicon.check
			},
			kbOpts: {
				primary: 2058,
				weight: 2e4,
				kbExpr: inlineEditVisible
			}
		});
	}
	async run(e, O) {
		O instanceof EmbeddedCodeEditorWidget && (O = O.getParentEditor());
		let k = InlineEditsController.get(O);
		k && (k.model.get()?.accept(k.editor), k.editor.focus());
	}
}, HideInlineEdit = class e extends EditorAction {
	static {
		this.ID = "editor.action.inlineEdits.hide";
	}
	constructor() {
		super({
			id: e.ID,
			...labelAndAlias(localize2("action.inlineEdits.hide", "Hide Inline Edit")),
			precondition: inlineEditVisible,
			kbOpts: {
				weight: 100,
				primary: 9
			}
		});
	}
	async run(e, O) {
		let k = InlineEditsController.get(O);
		transaction((e) => {
			k?.model.get()?.stop(e);
		});
	}
};
registerEditorContribution(InlineEditsController.ID, InlineEditsController, 3), registerEditorAction(TriggerInlineEditAction), registerEditorAction(ShowNextInlineEditAction), registerEditorAction(ShowPreviousInlineEditAction), registerEditorAction(AcceptInlineEdit), registerEditorAction(HideInlineEdit);
const Context = {
	Visible: new RawContextKey("parameterHintsVisible", !1),
	MultipleSignatures: new RawContextKey("parameterHintsMultipleSignatures", !1)
};
async function provideSignatureHelp(e, O, k, A, j) {
	let M = e.ordered(O);
	for (let e of M) try {
		let M = await e.provideSignatureHelp(O, k, j, A);
		if (M) return M;
	} catch (e) {
		onUnexpectedExternalError(e);
	}
}
CommandsRegistry.registerCommand("_executeSignatureHelpProvider", async (e, ...O) => {
	let [k, A, j] = O;
	assertType(URI.isUri(k)), assertType(Position.isIPosition(A)), assertType(typeof j == "string" || !j);
	let M = e.get(ILanguageFeaturesService), N = await e.get(ITextModelService).createModelReference(k);
	try {
		let e = await provideSignatureHelp(M.signatureHelpProvider, N.object.textEditorModel, Position.lift(A), {
			triggerKind: SignatureHelpTriggerKind.Invoke,
			isRetrigger: !1,
			triggerCharacter: j
		}, CancellationToken.None);
		return e ? (setTimeout(() => e.dispose(), 0), e.value) : void 0;
	} finally {
		N.dispose();
	}
});
var ParameterHintState;
(function(e) {
	e.Default = { type: 0 };
	class O {
		constructor(e, O) {
			this.request = e, this.previouslyActiveHints = O, this.type = 2;
		}
	}
	e.Pending = O;
	class k {
		constructor(e) {
			this.hints = e, this.type = 1;
		}
	}
	e.Active = k;
})(ParameterHintState ||= {});
var ParameterHintsModel = class e extends Disposable {
	static {
		this.DEFAULT_DELAY = 120;
	}
	constructor(O, k, A = e.DEFAULT_DELAY) {
		super(), this._onChangedHints = this._register(new Emitter()), this.onChangedHints = this._onChangedHints.event, this.triggerOnType = !1, this._state = ParameterHintState.Default, this._pendingTriggers = [], this._lastSignatureHelpResult = this._register(new MutableDisposable()), this.triggerChars = new CharacterSet(), this.retriggerChars = new CharacterSet(), this.triggerId = 0, this.editor = O, this.providers = k, this.throttledDelayer = new Delayer(A), this._register(this.editor.onDidBlurEditorWidget(() => this.cancel())), this._register(this.editor.onDidChangeConfiguration(() => this.onEditorConfigurationChange())), this._register(this.editor.onDidChangeModel((e) => this.onModelChanged())), this._register(this.editor.onDidChangeModelLanguage((e) => this.onModelChanged())), this._register(this.editor.onDidChangeCursorSelection((e) => this.onCursorChange(e))), this._register(this.editor.onDidChangeModelContent((e) => this.onModelContentChange())), this._register(this.providers.onDidChange(this.onModelChanged, this)), this._register(this.editor.onDidType((e) => this.onDidType(e))), this.onEditorConfigurationChange(), this.onModelChanged();
	}
	get state() {
		return this._state;
	}
	set state(e) {
		this._state.type === 2 && this._state.request.cancel(), this._state = e;
	}
	cancel(e = !1) {
		this.state = ParameterHintState.Default, this.throttledDelayer.cancel(), e || this._onChangedHints.fire(void 0);
	}
	trigger(e, O) {
		let k = this.editor.getModel();
		if (!k || !this.providers.has(k)) return;
		let A = ++this.triggerId;
		this._pendingTriggers.push(e), this.throttledDelayer.trigger(() => this.doTrigger(A), O).catch(onUnexpectedError);
	}
	next() {
		if (this.state.type !== 1) return;
		let e = this.state.hints.signatures.length, O = this.state.hints.activeSignature, k = O % e === e - 1, A = this.editor.getOption(86).cycle;
		if ((e < 2 || k) && !A) {
			this.cancel();
			return;
		}
		this.updateActiveSignature(k && A ? 0 : O + 1);
	}
	previous() {
		if (this.state.type !== 1) return;
		let e = this.state.hints.signatures.length, O = this.state.hints.activeSignature, k = O === 0, A = this.editor.getOption(86).cycle;
		if ((e < 2 || k) && !A) {
			this.cancel();
			return;
		}
		this.updateActiveSignature(k && A ? e - 1 : O - 1);
	}
	updateActiveSignature(e) {
		this.state.type === 1 && (this.state = new ParameterHintState.Active({
			...this.state.hints,
			activeSignature: e
		}), this._onChangedHints.fire(this.state.hints));
	}
	async doTrigger(e) {
		let O = this.state.type === 1 || this.state.type === 2, k = this.getLastActiveHints();
		if (this.cancel(!0), this._pendingTriggers.length === 0) return !1;
		let A = this._pendingTriggers.reduce(mergeTriggerContexts);
		this._pendingTriggers = [];
		let j = {
			triggerKind: A.triggerKind,
			triggerCharacter: A.triggerCharacter,
			isRetrigger: O,
			activeSignatureHelp: k
		};
		if (!this.editor.hasModel()) return !1;
		let M = this.editor.getModel(), N = this.editor.getPosition();
		this.state = new ParameterHintState.Pending(createCancelablePromise((e) => provideSignatureHelp(this.providers, M, N, j, e)), k);
		try {
			let O = await this.state.request;
			return e === this.triggerId ? !O || !O.value.signatures || O.value.signatures.length === 0 ? (O?.dispose(), this._lastSignatureHelpResult.clear(), this.cancel(), !1) : (this.state = new ParameterHintState.Active(O.value), this._lastSignatureHelpResult.value = O, this._onChangedHints.fire(this.state.hints), !0) : (O?.dispose(), !1);
		} catch (O) {
			return e === this.triggerId && (this.state = ParameterHintState.Default), onUnexpectedError(O), !1;
		}
	}
	getLastActiveHints() {
		switch (this.state.type) {
			case 1: return this.state.hints;
			case 2: return this.state.previouslyActiveHints;
			default: return;
		}
	}
	get isTriggered() {
		return this.state.type === 1 || this.state.type === 2 || this.throttledDelayer.isTriggered();
	}
	onModelChanged() {
		this.cancel(), this.triggerChars.clear(), this.retriggerChars.clear();
		let e = this.editor.getModel();
		if (e) for (let O of this.providers.ordered(e)) {
			for (let e of O.signatureHelpTriggerCharacters || []) if (e.length) {
				let O = e.charCodeAt(0);
				this.triggerChars.add(O), this.retriggerChars.add(O);
			}
			for (let e of O.signatureHelpRetriggerCharacters || []) e.length && this.retriggerChars.add(e.charCodeAt(0));
		}
	}
	onDidType(e) {
		if (!this.triggerOnType) return;
		let O = e.length - 1, k = e.charCodeAt(O);
		(this.triggerChars.has(k) || this.isTriggered && this.retriggerChars.has(k)) && this.trigger({
			triggerKind: SignatureHelpTriggerKind.TriggerCharacter,
			triggerCharacter: e.charAt(O)
		});
	}
	onCursorChange(e) {
		e.source === "mouse" ? this.cancel() : this.isTriggered && this.trigger({ triggerKind: SignatureHelpTriggerKind.ContentChange });
	}
	onModelContentChange() {
		this.isTriggered && this.trigger({ triggerKind: SignatureHelpTriggerKind.ContentChange });
	}
	onEditorConfigurationChange() {
		this.triggerOnType = this.editor.getOption(86).enabled, this.triggerOnType || this.cancel();
	}
	dispose() {
		this.cancel(!0), super.dispose();
	}
};
function mergeTriggerContexts(e, O) {
	switch (O.triggerKind) {
		case SignatureHelpTriggerKind.Invoke: return O;
		case SignatureHelpTriggerKind.ContentChange: return e;
		case SignatureHelpTriggerKind.TriggerCharacter:
		default: return O;
	}
}
var __decorate$27 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$27 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, ParameterHintsWidget_1, $$1 = $, parameterHintsNextIcon = registerIcon("parameter-hints-next", Codicon.chevronDown, localize("parameterHintsNextIcon", "Icon for show next parameter hint.")), parameterHintsPreviousIcon = registerIcon("parameter-hints-previous", Codicon.chevronUp, localize("parameterHintsPreviousIcon", "Icon for show previous parameter hint.")), ParameterHintsWidget = class extends Disposable {
	static {
		ParameterHintsWidget_1 = this;
	}
	static {
		this.ID = "editor.widget.parameterHintsWidget";
	}
	constructor(e, O, k, A, j, M) {
		super(), this.editor = e, this.model = O, this.telemetryService = M, this.renderDisposeables = this._register(new DisposableStore()), this.visible = !1, this.announcedLabel = null, this.allowEditorOverflow = !0, this.markdownRenderer = this._register(new MarkdownRenderer({ editor: e }, j, A)), this.keyVisible = Context.Visible.bindTo(k), this.keyMultipleSignatures = Context.MultipleSignatures.bindTo(k);
	}
	createParameterHintDOMNodes() {
		let e = $$1(".editor-widget.parameter-hints-widget"), O = append(e, $$1(".phwrapper"));
		O.tabIndex = -1;
		let k = append(O, $$1(".controls")), A = append(k, $$1(".button" + ThemeIcon.asCSSSelector(parameterHintsPreviousIcon))), j = append(k, $$1(".overloads")), M = append(k, $$1(".button" + ThemeIcon.asCSSSelector(parameterHintsNextIcon)));
		this._register(addDisposableListener(A, "click", (e) => {
			EventHelper.stop(e), this.previous();
		})), this._register(addDisposableListener(M, "click", (e) => {
			EventHelper.stop(e), this.next();
		}));
		let N = $$1(".body"), P = new DomScrollableElement(N, { alwaysConsumeMouseWheel: !0 });
		this._register(P), O.appendChild(P.getDomNode());
		let F = append(N, $$1(".signature")), I = append(N, $$1(".docs"));
		e.style.userSelect = "text", this.domNodes = {
			element: e,
			signature: F,
			overloads: j,
			docs: I,
			scrollbar: P
		}, this.editor.addContentWidget(this), this.hide(), this._register(this.editor.onDidChangeCursorSelection((e) => {
			this.visible && this.editor.layoutContentWidget(this);
		}));
		let L = () => {
			if (!this.domNodes) return;
			let e = this.editor.getOption(50), O = this.domNodes.element;
			O.style.fontSize = `${e.fontSize}px`, O.style.lineHeight = `${e.lineHeight / e.fontSize}`, O.style.setProperty("--vscode-parameterHintsWidget-editorFontFamily", e.fontFamily), O.style.setProperty("--vscode-parameterHintsWidget-editorFontFamilyDefault", EDITOR_FONT_DEFAULTS.fontFamily);
		};
		L(), this._register(Event.chain(this.editor.onDidChangeConfiguration.bind(this.editor), (e) => e.filter((e) => e.hasChanged(50)))(L)), this._register(this.editor.onDidLayoutChange((e) => this.updateMaxHeight())), this.updateMaxHeight();
	}
	show() {
		this.visible || (this.domNodes || this.createParameterHintDOMNodes(), this.keyVisible.set(!0), this.visible = !0, setTimeout(() => {
			this.domNodes?.element.classList.add("visible");
		}, 100), this.editor.layoutContentWidget(this));
	}
	hide() {
		this.renderDisposeables.clear(), this.visible && (this.keyVisible.reset(), this.visible = !1, this.announcedLabel = null, this.domNodes?.element.classList.remove("visible"), this.editor.layoutContentWidget(this));
	}
	getPosition() {
		return this.visible ? {
			position: this.editor.getPosition(),
			preference: [1, 2]
		} : null;
	}
	render(e) {
		if (this.renderDisposeables.clear(), !this.domNodes) return;
		let O = e.signatures.length > 1;
		this.domNodes.element.classList.toggle("multiple", O), this.keyMultipleSignatures.set(O), this.domNodes.signature.innerText = "", this.domNodes.docs.innerText = "";
		let k = e.signatures[e.activeSignature];
		if (!k) return;
		let A = append(this.domNodes.signature, $$1(".code")), j = k.parameters.length > 0, M = k.activeParameter ?? e.activeParameter;
		if (j) this.renderParameters(A, k, M);
		else {
			let e = append(A, $$1("span"));
			e.textContent = k.label;
		}
		let N = k.parameters[M];
		if (N?.documentation) {
			let e = $$1("span.documentation");
			if (typeof N.documentation == "string") e.textContent = N.documentation;
			else {
				let O = this.renderMarkdownDocs(N.documentation);
				e.appendChild(O.element);
			}
			append(this.domNodes.docs, $$1("p", {}, e));
		}
		if (k.documentation !== void 0) if (typeof k.documentation == "string") append(this.domNodes.docs, $$1("p", {}, k.documentation));
		else {
			let e = this.renderMarkdownDocs(k.documentation);
			append(this.domNodes.docs, e.element);
		}
		let P = this.hasDocs(k, N);
		if (this.domNodes.signature.classList.toggle("has-docs", P), this.domNodes.docs.classList.toggle("empty", !P), this.domNodes.overloads.textContent = String(e.activeSignature + 1).padStart(e.signatures.length.toString().length, "0") + "/" + e.signatures.length, N) {
			let e = "", O = k.parameters[M];
			e = Array.isArray(O.label) ? k.label.substring(O.label[0], O.label[1]) : O.label, O.documentation && (e += typeof O.documentation == "string" ? `, ${O.documentation}` : `, ${O.documentation.value}`), k.documentation && (e += typeof k.documentation == "string" ? `, ${k.documentation}` : `, ${k.documentation.value}`), this.announcedLabel !== e && (alert(localize("hint", "{0}, hint", e)), this.announcedLabel = e);
		}
		this.editor.layoutContentWidget(this), this.domNodes.scrollbar.scanDomNode();
	}
	renderMarkdownDocs(e) {
		let O = new StopWatch(), k = this.renderDisposeables.add(this.markdownRenderer.render(e, { asyncRenderCallback: () => {
			this.domNodes?.scrollbar.scanDomNode();
		} }));
		k.element.classList.add("markdown-docs");
		let A = O.elapsed();
		return A > 300 && this.telemetryService.publicLog2("parameterHints.parseMarkdown", { renderDuration: A }), k;
	}
	hasDocs(e, O) {
		return !!(O && typeof O.documentation == "string" && assertIsDefined(O.documentation).length > 0 || O && typeof O.documentation == "object" && assertIsDefined(O.documentation).value.length > 0 || e.documentation && typeof e.documentation == "string" && assertIsDefined(e.documentation).length > 0 || e.documentation && typeof e.documentation == "object" && assertIsDefined(e.documentation.value).length > 0);
	}
	renderParameters(e, O, k) {
		let [A, j] = this.getParameterLabelOffsets(O, k), M = document.createElement("span");
		M.textContent = O.label.substring(0, A);
		let N = document.createElement("span");
		N.textContent = O.label.substring(A, j), N.className = "parameter active";
		let P = document.createElement("span");
		P.textContent = O.label.substring(j), append(e, M, N, P);
	}
	getParameterLabelOffsets(e, O) {
		let k = e.parameters[O];
		if (k) {
			if (Array.isArray(k.label)) return k.label;
			if (k.label.length) {
				let O = RegExp(`(\\W|^)${escapeRegExpCharacters(k.label)}(?=\\W|$)`, "g");
				O.test(e.label);
				let A = O.lastIndex - k.label.length;
				return A >= 0 ? [A, O.lastIndex] : [0, 0];
			} else return [0, 0];
		} else return [0, 0];
	}
	next() {
		this.editor.focus(), this.model.next();
	}
	previous() {
		this.editor.focus(), this.model.previous();
	}
	getDomNode() {
		return this.domNodes || this.createParameterHintDOMNodes(), this.domNodes.element;
	}
	getId() {
		return ParameterHintsWidget_1.ID;
	}
	updateMaxHeight() {
		if (!this.domNodes) return;
		let e = `${Math.max(this.editor.getLayoutInfo().height / 4, 250)}px`;
		this.domNodes.element.style.maxHeight = e;
		let O = this.domNodes.element.getElementsByClassName("phwrapper");
		O.length && (O[0].style.maxHeight = e);
	}
};
ParameterHintsWidget = ParameterHintsWidget_1 = __decorate$27([
	__param$27(2, IContextKeyService),
	__param$27(3, IOpenerService),
	__param$27(4, ILanguageService),
	__param$27(5, ITelemetryService)
], ParameterHintsWidget), registerColor("editorHoverWidget.highlightForeground", listHighlightForeground, localize("editorHoverWidgetHighlightForeground", "Foreground color of the active item in the parameter hint."));
var __decorate$26 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$26 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, ParameterHintsController_1, ParameterHintsController = class extends Disposable {
	static {
		ParameterHintsController_1 = this;
	}
	static {
		this.ID = "editor.controller.parameterHints";
	}
	static get(e) {
		return e.getContribution(ParameterHintsController_1.ID);
	}
	constructor(e, O, k) {
		super(), this.editor = e, this.model = this._register(new ParameterHintsModel(e, k.signatureHelpProvider)), this._register(this.model.onChangedHints((e) => {
			e ? (this.widget.value.show(), this.widget.value.render(e)) : this.widget.rawValue?.hide();
		})), this.widget = new Lazy(() => this._register(O.createInstance(ParameterHintsWidget, this.editor, this.model)));
	}
	cancel() {
		this.model.cancel();
	}
	previous() {
		this.widget.rawValue?.previous();
	}
	next() {
		this.widget.rawValue?.next();
	}
	trigger(e) {
		this.model.trigger(e, 0);
	}
};
ParameterHintsController = ParameterHintsController_1 = __decorate$26([__param$26(1, IInstantiationService), __param$26(2, ILanguageFeaturesService)], ParameterHintsController);
var TriggerParameterHintsAction = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.triggerParameterHints",
			label: localize("parameterHints.trigger.label", "Trigger Parameter Hints"),
			alias: "Trigger Parameter Hints",
			precondition: EditorContextKeys.hasSignatureHelpProvider,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: 3082,
				weight: 100
			}
		});
	}
	run(e, O) {
		ParameterHintsController.get(O)?.trigger({ triggerKind: SignatureHelpTriggerKind.Invoke });
	}
};
registerEditorContribution(ParameterHintsController.ID, ParameterHintsController, 2), registerEditorAction(TriggerParameterHintsAction);
var weight$1 = 175, ParameterHintsCommand = EditorCommand.bindToContribution(ParameterHintsController.get);
registerEditorCommand(new ParameterHintsCommand({
	id: "closeParameterHints",
	precondition: Context.Visible,
	handler: (e) => e.cancel(),
	kbOpts: {
		weight: weight$1,
		kbExpr: EditorContextKeys.focus,
		primary: 9,
		secondary: [1033]
	}
})), registerEditorCommand(new ParameterHintsCommand({
	id: "showPrevParameterHint",
	precondition: ContextKeyExpr.and(Context.Visible, Context.MultipleSignatures),
	handler: (e) => e.previous(),
	kbOpts: {
		weight: weight$1,
		kbExpr: EditorContextKeys.focus,
		primary: 16,
		secondary: [528],
		mac: {
			primary: 16,
			secondary: [528, 302]
		}
	}
})), registerEditorCommand(new ParameterHintsCommand({
	id: "showNextParameterHint",
	precondition: ContextKeyExpr.and(Context.Visible, Context.MultipleSignatures),
	handler: (e) => e.next(),
	kbOpts: {
		weight: weight$1,
		kbExpr: EditorContextKeys.focus,
		primary: 18,
		secondary: [530],
		mac: {
			primary: 18,
			secondary: [530, 300]
		}
	}
}));
var __decorate$25 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$25 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, BaseClass = class {
	constructor(e) {
		this.instantiationService = e;
	}
	init(...e) {}
};
function createWrapper(e, O) {
	return class extends O {
		constructor() {
			super(...arguments), this._autorun = void 0;
		}
		init(...O) {
			this._autorun = autorunWithStore((k, A) => {
				let j = readHotReloadableExport(e(), k);
				A.add(this.instantiationService.createInstance(j, ...O));
			});
		}
		dispose() {
			this._autorun?.dispose();
		}
	};
}
function wrapInReloadableClass1(e) {
	return isHotReloadEnabled() ? createWrapper(e, BaseClass1) : e();
}
var BaseClass1 = class extends BaseClass {
	constructor(e, O) {
		super(O), this.init(e);
	}
};
BaseClass1 = __decorate$25([__param$25(1, IInstantiationService)], BaseClass1), registerEditorContribution(PlaceholderTextContribution.ID, wrapInReloadableClass1(() => PlaceholderTextContribution), 0), registerColor("editor.placeholder.foreground", ghostTextForeground, localize("placeholderForeground", "Foreground color of the placeholder text in the editor."));
var __decorate$24 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$24 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
};
const CONTEXT_RENAME_INPUT_VISIBLE = new RawContextKey("renameInputVisible", !1, localize("renameInputVisible", "Whether the rename input widget is visible"));
new RawContextKey("renameInputFocused", !1, localize("renameInputFocused", "Whether the rename input widget is focused"));
var RenameWidget = class {
	constructor(e, O, k, A, j, M) {
		this._editor = e, this._acceptKeybindings = O, this._themeService = k, this._keybindingService = A, this._logService = M, this.allowEditorOverflow = !0, this._disposables = new DisposableStore(), this._visibleContextKey = CONTEXT_RENAME_INPUT_VISIBLE.bindTo(j), this._isEditingRenameCandidate = !1, this._nRenameSuggestionsInvocations = 0, this._hadAutomaticRenameSuggestionsInvocation = !1, this._candidates = /* @__PURE__ */ new Set(), this._beforeFirstInputFieldEditSW = new StopWatch(), this._inputWithButton = new InputWithButton(), this._disposables.add(this._inputWithButton), this._editor.addContentWidget(this), this._disposables.add(this._editor.onDidChangeConfiguration((e) => {
			e.hasChanged(50) && this._updateFont();
		})), this._disposables.add(k.onDidColorThemeChange(this._updateStyles, this));
	}
	dispose() {
		this._disposables.dispose(), this._editor.removeContentWidget(this);
	}
	getId() {
		return "__renameInputWidget";
	}
	getDomNode() {
		return this._domNode || (this._domNode = document.createElement("div"), this._domNode.className = "monaco-editor rename-box", this._domNode.appendChild(this._inputWithButton.domNode), this._renameCandidateListView = this._disposables.add(new RenameCandidateListView(this._domNode, {
			fontInfo: this._editor.getOption(50),
			onFocusChange: (e) => {
				this._inputWithButton.input.value = e, this._isEditingRenameCandidate = !1;
			},
			onSelectionChange: () => {
				this._isEditingRenameCandidate = !1, this.acceptInput(!1);
			}
		})), this._disposables.add(this._inputWithButton.onDidInputChange(() => {
			this._renameCandidateListView?.focusedCandidate !== void 0 && (this._isEditingRenameCandidate = !0), this._timeBeforeFirstInputFieldEdit ??= this._beforeFirstInputFieldEditSW.elapsed(), this._renameCandidateProvidersCts?.token.isCancellationRequested === !1 && this._renameCandidateProvidersCts.cancel(), this._renameCandidateListView?.clearFocus();
		})), this._label = document.createElement("div"), this._label.className = "rename-label", this._domNode.appendChild(this._label), this._updateFont(), this._updateStyles(this._themeService.getColorTheme())), this._domNode;
	}
	_updateStyles(e) {
		if (!this._domNode) return;
		let O = e.getColor(widgetShadow), k = e.getColor(widgetBorder);
		this._domNode.style.backgroundColor = String(e.getColor(editorWidgetBackground) ?? ""), this._domNode.style.boxShadow = O ? ` 0 0 8px 2px ${O}` : "", this._domNode.style.border = k ? `1px solid ${k}` : "", this._domNode.style.color = String(e.getColor(inputForeground) ?? "");
		let A = e.getColor(inputBorder);
		this._inputWithButton.domNode.style.backgroundColor = String(e.getColor(inputBackground) ?? ""), this._inputWithButton.input.style.backgroundColor = String(e.getColor(inputBackground) ?? ""), this._inputWithButton.domNode.style.borderWidth = A ? "1px" : "0px", this._inputWithButton.domNode.style.borderStyle = A ? "solid" : "none", this._inputWithButton.domNode.style.borderColor = A?.toString() ?? "none";
	}
	_updateFont() {
		if (this._domNode === void 0) return;
		assertType(this._label !== void 0, "RenameWidget#_updateFont: _label must not be undefined given _domNode is defined"), this._editor.applyFontInfo(this._inputWithButton.input);
		let e = this._editor.getOption(50);
		this._label.style.fontSize = `${this._computeLabelFontSize(e.fontSize)}px`;
	}
	_computeLabelFontSize(e) {
		return e * .8;
	}
	getPosition() {
		if (!this._visible || !this._editor.hasModel() || !this._editor.getDomNode()) return null;
		let e = getClientArea(this.getDomNode().ownerDocument.body), O = getDomNodePagePosition(this._editor.getDomNode());
		this._nPxAvailableAbove = this._getTopForPosition() + O.top, this._nPxAvailableBelow = e.height - this._nPxAvailableAbove;
		let k = this._editor.getOption(67), { totalHeight: A } = RenameCandidateView.getLayoutInfo({ lineHeight: k }), j = this._nPxAvailableBelow > A * 6 ? [2, 1] : [1, 2];
		return {
			position: this._position,
			preference: j
		};
	}
	beforeRender() {
		let [e, O] = this._acceptKeybindings;
		return this._label.innerText = localize({
			key: "label",
			comment: ["placeholders are keybindings, e.g \"F2 to Rename, Shift+F2 to Preview\""]
		}, "{0} to Rename, {1} to Preview", this._keybindingService.lookupKeybinding(e)?.getLabel(), this._keybindingService.lookupKeybinding(O)?.getLabel()), this._domNode.style.minWidth = "200px", null;
	}
	afterRender(e) {
		if (e === null) {
			this.cancelInput(!0, "afterRender (because position is null)");
			return;
		}
		if (!this._editor.hasModel() || !this._editor.getDomNode()) return;
		assertType(this._renameCandidateListView), assertType(this._nPxAvailableAbove !== void 0), assertType(this._nPxAvailableBelow !== void 0);
		let O = getTotalHeight(this._inputWithButton.domNode), k = getTotalHeight(this._label), A;
		A = e === 2 ? this._nPxAvailableBelow : this._nPxAvailableAbove, this._renameCandidateListView.layout({
			height: A - k - O,
			width: getTotalWidth(this._inputWithButton.domNode)
		});
	}
	acceptInput(e) {
		this._trace("invoking acceptInput"), this._currentAcceptInput?.(e);
	}
	cancelInput(e, O) {
		this._currentCancelInput?.(e);
	}
	focusNextRenameSuggestion() {
		this._renameCandidateListView?.focusNext() || (this._inputWithButton.input.value = this._currentName);
	}
	focusPreviousRenameSuggestion() {
		this._renameCandidateListView?.focusPrevious() || (this._inputWithButton.input.value = this._currentName);
	}
	getInput(e, O, k, A, j) {
		let { start: M, end: N } = this._getSelection(e, O);
		this._renameCts = j;
		let P = new DisposableStore();
		this._nRenameSuggestionsInvocations = 0, this._hadAutomaticRenameSuggestionsInvocation = !1, A === void 0 ? this._inputWithButton.button.style.display = "none" : (this._inputWithButton.button.style.display = "flex", this._requestRenameCandidatesOnce = A, this._requestRenameCandidates(O, !1), P.add(addDisposableListener(this._inputWithButton.button, "click", () => this._requestRenameCandidates(O, !0))), P.add(addDisposableListener(this._inputWithButton.button, EventType$1.KEY_DOWN, (e) => {
			let k = new StandardKeyboardEvent(e);
			(k.equals(3) || k.equals(10)) && (k.stopPropagation(), k.preventDefault(), this._requestRenameCandidates(O, !0));
		}))), this._isEditingRenameCandidate = !1, this._domNode.classList.toggle("preview", k), this._position = new Position(e.startLineNumber, e.startColumn), this._currentName = O, this._inputWithButton.input.value = O, this._inputWithButton.input.setAttribute("selectionStart", M.toString()), this._inputWithButton.input.setAttribute("selectionEnd", N.toString()), this._inputWithButton.input.size = Math.max((e.endColumn - e.startColumn) * 1.1, 20), this._beforeFirstInputFieldEditSW.reset(), P.add(toDisposable(() => {
			this._renameCts = void 0, j.dispose(!0);
		})), P.add(toDisposable(() => {
			this._renameCandidateProvidersCts !== void 0 && (this._renameCandidateProvidersCts.dispose(!0), this._renameCandidateProvidersCts = void 0);
		})), P.add(toDisposable(() => this._candidates.clear()));
		let F = new DeferredPromise();
		return F.p.finally(() => {
			P.dispose(), this._hide();
		}), this._currentCancelInput = (e) => (this._trace("invoking _currentCancelInput"), this._currentAcceptInput = void 0, this._currentCancelInput = void 0, this._renameCandidateListView?.clearCandidates(), F.complete(e), !0), this._currentAcceptInput = (e) => {
			this._trace("invoking _currentAcceptInput"), assertType(this._renameCandidateListView !== void 0);
			let A = this._renameCandidateListView.nCandidates, j, M, N = this._renameCandidateListView.focusedCandidate;
			if (N === void 0 ? (this._trace("using new name from inputField"), j = this._inputWithButton.input.value, M = this._isEditingRenameCandidate ? { k: "userEditedRenameSuggestion" } : { k: "inputField" }) : (this._trace("using new name from renameSuggestion"), j = N, M = { k: "renameSuggestion" }), j === O || j.trim().length === 0) {
				this.cancelInput(!0, "_currentAcceptInput (because newName === value || newName.trim().length === 0)");
				return;
			}
			this._currentAcceptInput = void 0, this._currentCancelInput = void 0, this._renameCandidateListView.clearCandidates(), F.complete({
				newName: j,
				wantsPreview: k && e,
				stats: {
					source: M,
					nRenameSuggestions: A,
					timeBeforeFirstInputFieldEdit: this._timeBeforeFirstInputFieldEdit,
					nRenameSuggestionsInvocations: this._nRenameSuggestionsInvocations,
					hadAutomaticRenameSuggestionsInvocation: this._hadAutomaticRenameSuggestionsInvocation
				}
			});
		}, P.add(j.token.onCancellationRequested(() => this.cancelInput(!0, "cts.token.onCancellationRequested"))), P.add(this._editor.onDidBlurEditorWidget(() => this.cancelInput(!this._domNode?.ownerDocument.hasFocus(), "editor.onDidBlurEditorWidget"))), this._show(), F.p;
	}
	_requestRenameCandidates(e, O) {
		if (this._requestRenameCandidatesOnce !== void 0 && (this._renameCandidateProvidersCts !== void 0 && this._renameCandidateProvidersCts.dispose(!0), assertType(this._renameCts), this._inputWithButton.buttonState !== "stop")) {
			this._renameCandidateProvidersCts = new CancellationTokenSource();
			let k = O ? NewSymbolNameTriggerKind.Invoke : NewSymbolNameTriggerKind.Automatic, A = this._requestRenameCandidatesOnce(k, this._renameCandidateProvidersCts.token);
			if (A.length === 0) {
				this._inputWithButton.setSparkleButton();
				return;
			}
			O || (this._hadAutomaticRenameSuggestionsInvocation = !0), this._nRenameSuggestionsInvocations += 1, this._inputWithButton.setStopButton(), this._updateRenameCandidates(A, e, this._renameCts.token);
		}
	}
	_getSelection(e, O) {
		assertType(this._editor.hasModel());
		let k = this._editor.getSelection(), A = 0, j = O.length;
		return !Range.isEmpty(k) && !Range.spansMultipleLines(k) && Range.containsRange(e, k) && (A = Math.max(0, k.startColumn - e.startColumn), j = Math.min(e.endColumn, k.endColumn) - e.startColumn), {
			start: A,
			end: j
		};
	}
	_show() {
		this._trace("invoking _show"), this._editor.revealLineInCenterIfOutsideViewport(this._position.lineNumber, 0), this._visible = !0, this._visibleContextKey.set(!0), this._editor.layoutContentWidget(this), setTimeout(() => {
			this._inputWithButton.input.focus(), this._inputWithButton.input.setSelectionRange(parseInt(this._inputWithButton.input.getAttribute("selectionStart")), parseInt(this._inputWithButton.input.getAttribute("selectionEnd")));
		}, 100);
	}
	async _updateRenameCandidates(e, O, k) {
		let A = (...e) => this._trace("_updateRenameCandidates", ...e);
		A("start");
		let j = await raceCancellation(Promise.allSettled(e), k);
		if (this._inputWithButton.setSparkleButton(), j === void 0) {
			A("returning early - received updateRenameCandidates results - undefined");
			return;
		}
		let M = j.flatMap((e) => e.status === "fulfilled" && isDefined(e.value) ? e.value : []);
		A(`received updateRenameCandidates results - total (unfiltered) ${M.length} candidates.`);
		let N = distinct(M, (e) => e.newSymbolName);
		A(`distinct candidates - ${N.length} candidates.`);
		let P = N.filter(({ newSymbolName: e }) => e.trim().length > 0 && e !== this._inputWithButton.input.value && e !== O && !this._candidates.has(e));
		if (A(`valid distinct candidates - ${M.length} candidates.`), P.forEach((e) => this._candidates.add(e.newSymbolName)), P.length < 1) {
			A("returning early - no valid distinct candidates");
			return;
		}
		A("setting candidates"), this._renameCandidateListView.setCandidates(P), A("asking editor to re-layout"), this._editor.layoutContentWidget(this);
	}
	_hide() {
		this._trace("invoked _hide"), this._visible = !1, this._visibleContextKey.reset(), this._editor.layoutContentWidget(this);
	}
	_getTopForPosition() {
		let e = this._editor.getVisibleRanges(), O;
		return e.length > 0 ? O = e[0].startLineNumber : (this._logService.warn("RenameWidget#_getTopForPosition: this should not happen - visibleRanges is empty"), O = Math.max(1, this._position.lineNumber - 5)), this._editor.getTopForLineNumber(this._position.lineNumber) - this._editor.getTopForLineNumber(O);
	}
	_trace(...e) {
		this._logService.trace("RenameWidget", ...e);
	}
};
RenameWidget = __decorate$24([
	__param$24(2, IThemeService),
	__param$24(3, IKeybindingService),
	__param$24(4, IContextKeyService),
	__param$24(5, ILogService)
], RenameWidget);
var RenameCandidateListView = class e {
	constructor(O, k) {
		this._disposables = new DisposableStore(), this._availableHeight = 0, this._minimumWidth = 0, this._lineHeight = k.fontInfo.lineHeight, this._typicalHalfwidthCharacterWidth = k.fontInfo.typicalHalfwidthCharacterWidth, this._listContainer = document.createElement("div"), this._listContainer.className = "rename-box rename-candidate-list-container", O.appendChild(this._listContainer), this._listWidget = e._createListWidget(this._listContainer, this._candidateViewHeight, k.fontInfo), this._listWidget.onDidChangeFocus((e) => {
			e.elements.length === 1 && k.onFocusChange(e.elements[0].newSymbolName);
		}, this._disposables), this._listWidget.onDidChangeSelection((e) => {
			e.elements.length === 1 && k.onSelectionChange();
		}, this._disposables), this._disposables.add(this._listWidget.onDidBlur((e) => {
			this._listWidget.setFocus([]);
		})), this._listWidget.style(getListStyles({
			listInactiveFocusForeground: quickInputListFocusForeground,
			listInactiveFocusBackground: quickInputListFocusBackground
		}));
	}
	dispose() {
		this._listWidget.dispose(), this._disposables.dispose();
	}
	layout({ height: e, width: O }) {
		this._availableHeight = e, this._minimumWidth = O;
	}
	setCandidates(e) {
		this._listWidget.splice(0, 0, e);
		let O = this._pickListHeight(this._listWidget.length), k = this._pickListWidth(e);
		this._listWidget.layout(O, k), this._listContainer.style.height = `${O}px`, this._listContainer.style.width = `${k}px`, status(localize("renameSuggestionsReceivedAria", "Received {0} rename suggestions", e.length));
	}
	clearCandidates() {
		this._listContainer.style.height = "0px", this._listContainer.style.width = "0px", this._listWidget.splice(0, this._listWidget.length, []);
	}
	get nCandidates() {
		return this._listWidget.length;
	}
	get focusedCandidate() {
		if (this._listWidget.length === 0) return;
		let e = this._listWidget.getSelectedElements()[0];
		if (e !== void 0) return e.newSymbolName;
		let O = this._listWidget.getFocusedElements()[0];
		if (O !== void 0) return O.newSymbolName;
	}
	focusNext() {
		if (this._listWidget.length === 0) return !1;
		let e = this._listWidget.getFocus();
		if (e.length === 0) return this._listWidget.focusFirst(), this._listWidget.reveal(0), !0;
		if (e[0] === this._listWidget.length - 1) return this._listWidget.setFocus([]), this._listWidget.reveal(0), !1;
		{
			this._listWidget.focusNext();
			let e = this._listWidget.getFocus()[0];
			return this._listWidget.reveal(e), !0;
		}
	}
	focusPrevious() {
		if (this._listWidget.length === 0) return !1;
		let e = this._listWidget.getFocus();
		if (e.length === 0) {
			this._listWidget.focusLast();
			let e = this._listWidget.getFocus()[0];
			return this._listWidget.reveal(e), !0;
		} else if (e[0] === 0) return this._listWidget.setFocus([]), !1;
		else {
			this._listWidget.focusPrevious();
			let e = this._listWidget.getFocus()[0];
			return this._listWidget.reveal(e), !0;
		}
	}
	clearFocus() {
		this._listWidget.setFocus([]);
	}
	get _candidateViewHeight() {
		let { totalHeight: e } = RenameCandidateView.getLayoutInfo({ lineHeight: this._lineHeight });
		return e;
	}
	_pickListHeight(e) {
		let O = this._candidateViewHeight * e;
		return Math.min(O, this._availableHeight, this._candidateViewHeight * 7);
	}
	_pickListWidth(e) {
		let O = Math.ceil(Math.max(...e.map((e) => e.newSymbolName.length)) * this._typicalHalfwidthCharacterWidth);
		return Math.max(this._minimumWidth, 25 + O + 10);
	}
	static _createListWidget(e, O, k) {
		let A = new class {
			getTemplateId(e) {
				return "candidate";
			}
			getHeight(e) {
				return O;
			}
		}(), j = new class {
			constructor() {
				this.templateId = "candidate";
			}
			renderTemplate(e) {
				return new RenameCandidateView(e, k);
			}
			renderElement(e, O, k) {
				k.populate(e);
			}
			disposeTemplate(e) {
				e.dispose();
			}
		}();
		return new List("NewSymbolNameCandidates", e, A, [j], {
			keyboardSupport: !1,
			mouseSupport: !0,
			multipleSelectionSupport: !1
		});
	}
}, InputWithButton = class {
	constructor() {
		this._onDidInputChange = new Emitter(), this.onDidInputChange = this._onDidInputChange.event, this._disposables = new DisposableStore();
	}
	get domNode() {
		return this._domNode || (this._domNode = document.createElement("div"), this._domNode.className = "rename-input-with-button", this._domNode.style.display = "flex", this._domNode.style.flexDirection = "row", this._domNode.style.alignItems = "center", this._inputNode = document.createElement("input"), this._inputNode.className = "rename-input", this._inputNode.type = "text", this._inputNode.style.border = "none", this._inputNode.setAttribute("aria-label", localize("renameAriaLabel", "Rename input. Type new name and press Enter to commit.")), this._domNode.appendChild(this._inputNode), this._buttonNode = document.createElement("div"), this._buttonNode.className = "rename-suggestions-button", this._buttonNode.setAttribute("tabindex", "0"), this._buttonGenHoverText = localize("generateRenameSuggestionsButton", "Generate new name suggestions"), this._buttonCancelHoverText = localize("cancelRenameSuggestionsButton", "Cancel"), this._buttonHover = getBaseLayerHoverDelegate().setupManagedHover(getDefaultHoverDelegate("element"), this._buttonNode, this._buttonGenHoverText), this._disposables.add(this._buttonHover), this._domNode.appendChild(this._buttonNode), this._disposables.add(addDisposableListener(this.input, EventType$1.INPUT, () => this._onDidInputChange.fire())), this._disposables.add(addDisposableListener(this.input, EventType$1.KEY_DOWN, (e) => {
			let O = new StandardKeyboardEvent(e);
			(O.keyCode === 15 || O.keyCode === 17) && this._onDidInputChange.fire();
		})), this._disposables.add(addDisposableListener(this.input, EventType$1.CLICK, () => this._onDidInputChange.fire())), this._disposables.add(addDisposableListener(this.input, EventType$1.FOCUS, () => {
			this.domNode.style.outlineWidth = "1px", this.domNode.style.outlineStyle = "solid", this.domNode.style.outlineOffset = "-1px", this.domNode.style.outlineColor = "var(--vscode-focusBorder)";
		})), this._disposables.add(addDisposableListener(this.input, EventType$1.BLUR, () => {
			this.domNode.style.outline = "none";
		}))), this._domNode;
	}
	get input() {
		return assertType(this._inputNode), this._inputNode;
	}
	get button() {
		return assertType(this._buttonNode), this._buttonNode;
	}
	get buttonState() {
		return this._buttonState;
	}
	setSparkleButton() {
		this._buttonState = "sparkle", this._sparkleIcon ??= renderIcon(Codicon.sparkle), clearNode(this.button), this.button.appendChild(this._sparkleIcon), this.button.setAttribute("aria-label", "Generating new name suggestions"), this._buttonHover?.update(this._buttonGenHoverText), this.input.focus();
	}
	setStopButton() {
		this._buttonState = "stop", this._stopIcon ??= renderIcon(Codicon.primitiveSquare), clearNode(this.button), this.button.appendChild(this._stopIcon), this.button.setAttribute("aria-label", "Cancel generating new name suggestions"), this._buttonHover?.update(this._buttonCancelHoverText), this.input.focus();
	}
	dispose() {
		this._disposables.dispose();
	}
}, RenameCandidateView = class e {
	static {
		this._PADDING = 2;
	}
	constructor(O, k) {
		this._domNode = document.createElement("div"), this._domNode.className = "rename-box rename-candidate", this._domNode.style.display = "flex", this._domNode.style.columnGap = "5px", this._domNode.style.alignItems = "center", this._domNode.style.height = `${k.lineHeight}px`, this._domNode.style.padding = `${e._PADDING}px`;
		let A = document.createElement("div");
		A.style.display = "flex", A.style.alignItems = "center", A.style.width = A.style.height = `${k.lineHeight * .8}px`, this._domNode.appendChild(A), this._icon = renderIcon(Codicon.sparkle), this._icon.style.display = "none", A.appendChild(this._icon), this._label = document.createElement("div"), applyFontInfo(this._label, k), this._domNode.appendChild(this._label), O.appendChild(this._domNode);
	}
	populate(e) {
		this._updateIcon(e), this._updateLabel(e);
	}
	_updateIcon(e) {
		let O = !!e.tags?.includes(NewSymbolNameTag.AIGenerated);
		this._icon.style.display = O ? "inherit" : "none";
	}
	_updateLabel(e) {
		this._label.innerText = e.newSymbolName;
	}
	static getLayoutInfo({ lineHeight: O }) {
		return { totalHeight: O + e._PADDING * 2 };
	}
	dispose() {}
}, __decorate$23 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$23 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, RenameController_1, RenameSkeleton = class {
	constructor(e, O, k) {
		this.model = e, this.position = O, this._providerRenameIdx = 0, this._providers = k.ordered(e);
	}
	hasProvider() {
		return this._providers.length > 0;
	}
	async resolveRenameLocation(e) {
		let O = [];
		for (this._providerRenameIdx = 0; this._providerRenameIdx < this._providers.length; this._providerRenameIdx++) {
			let k = this._providers[this._providerRenameIdx];
			if (!k.resolveRenameLocation) break;
			let A = await k.resolveRenameLocation(this.model, this.position, e);
			if (A) {
				if (A.rejectReason) {
					O.push(A.rejectReason);
					continue;
				}
				return A;
			}
		}
		this._providerRenameIdx = 0;
		let k = this.model.getWordAtPosition(this.position);
		return k ? {
			range: new Range(this.position.lineNumber, k.startColumn, this.position.lineNumber, k.endColumn),
			text: k.word,
			rejectReason: O.length > 0 ? O.join("\n") : void 0
		} : {
			range: Range.fromPositions(this.position),
			text: "",
			rejectReason: O.length > 0 ? O.join("\n") : void 0
		};
	}
	async provideRenameEdits(e, O) {
		return this._provideRenameEdits(e, this._providerRenameIdx, [], O);
	}
	async _provideRenameEdits(e, O, k, A) {
		let j = this._providers[O];
		if (!j) return {
			edits: [],
			rejectReason: k.join("\n")
		};
		let M = await j.provideRenameEdits(this.model, this.position, e, A);
		if (M) {
			if (M.rejectReason) return this._provideRenameEdits(e, O + 1, k.concat(M.rejectReason), A);
		} else return this._provideRenameEdits(e, O + 1, k.concat(localize("no result", "No result.")), A);
		return M;
	}
};
async function rename(e, O, k, A) {
	let j = new RenameSkeleton(O, k, e), M = await j.resolveRenameLocation(CancellationToken.None);
	return M?.rejectReason ? {
		edits: [],
		rejectReason: M.rejectReason
	} : j.provideRenameEdits(A, CancellationToken.None);
}
var RenameController = class {
	static {
		RenameController_1 = this;
	}
	static {
		this.ID = "editor.contrib.renameController";
	}
	static get(e) {
		return e.getContribution(RenameController_1.ID);
	}
	constructor(e, O, k, A, j, M, N, P, F) {
		this.editor = e, this._instaService = O, this._notificationService = k, this._bulkEditService = A, this._progressService = j, this._logService = M, this._configService = N, this._languageFeaturesService = P, this._telemetryService = F, this._disposableStore = new DisposableStore(), this._cts = new CancellationTokenSource(), this._renameWidget = this._disposableStore.add(this._instaService.createInstance(RenameWidget, this.editor, ["acceptRenameInput", "acceptRenameInputWithPreview"]));
	}
	dispose() {
		this._disposableStore.dispose(), this._cts.dispose(!0);
	}
	async run() {
		let e = this._logService.trace.bind(this._logService, "[rename]");
		if (this._cts.dispose(!0), this._cts = new CancellationTokenSource(), !this.editor.hasModel()) {
			e("editor has no model");
			return;
		}
		let O = this.editor.getPosition(), k = new RenameSkeleton(this.editor.getModel(), O, this._languageFeaturesService.renameProvider);
		if (!k.hasProvider()) {
			e("skeleton has no provider");
			return;
		}
		let A = new EditorStateCancellationTokenSource(this.editor, 5, void 0, this._cts.token), j;
		try {
			e("resolving rename location");
			let O = k.resolveRenameLocation(A.token);
			this._progressService.showWhile(O, 250), j = await O, e("resolved rename location");
		} catch (k) {
			k instanceof CancellationError ? e("resolve rename location cancelled", JSON.stringify(k, null, "	")) : (e("resolve rename location failed", k instanceof Error ? k : JSON.stringify(k, null, "	")), (typeof k == "string" || isMarkdownString(k)) && MessageController.get(this.editor)?.showMessage(k || localize("resolveRenameLocationFailed", "An unknown error occurred while resolving rename location"), O));
			return;
		} finally {
			A.dispose();
		}
		if (!j) {
			e("returning early - no loc");
			return;
		}
		if (j.rejectReason) {
			e(`returning early - rejected with reason: ${j.rejectReason}`, j.rejectReason), MessageController.get(this.editor)?.showMessage(j.rejectReason, O);
			return;
		}
		if (A.token.isCancellationRequested) {
			e("returning early - cts1 cancelled");
			return;
		}
		let M = new EditorStateCancellationTokenSource(this.editor, 5, j.range, this._cts.token), N = this.editor.getModel(), P = this._languageFeaturesService.newSymbolNamesProvider.all(N), F = await Promise.all(P.map(async (e) => [e, await e.supportsAutomaticNewSymbolNamesTriggerKind ?? !1])), I = (e, O) => {
			let k = F.slice();
			return e === NewSymbolNameTriggerKind.Automatic && (k = k.filter(([e, O]) => O)), k.map(([k]) => k.provideNewSymbolNames(N, j.range, e, O));
		};
		e("creating rename input field and awaiting its result");
		let L = this._bulkEditService.hasPreviewHandler() && this._configService.getValue(this.editor.getModel().uri, "editor.rename.enablePreview"), R = await this._renameWidget.getInput(j.range, j.text, L, P.length > 0 ? I : void 0, M);
		if (e("received response from rename input field"), P.length > 0 && this._reportTelemetry(P.length, N.getLanguageId(), R), typeof R == "boolean") {
			e(`returning early - rename input field response - ${R}`), R && this.editor.focus(), M.dispose();
			return;
		}
		this.editor.focus(), e("requesting rename edits");
		let z = raceCancellation(k.provideRenameEdits(R.newName, M.token), M.token).then(async (O) => {
			if (!O) {
				e("returning early - no rename edits result");
				return;
			}
			if (!this.editor.hasModel()) {
				e("returning early - no model after rename edits are provided");
				return;
			}
			if (O.rejectReason) {
				e(`returning early - rejected with reason: ${O.rejectReason}`), this._notificationService.info(O.rejectReason);
				return;
			}
			this.editor.setSelection(Range.fromPositions(this.editor.getSelection().getPosition())), e("applying edits"), this._bulkEditService.apply(O, {
				editor: this.editor,
				showPreview: R.wantsPreview,
				label: localize("label", "Renaming '{0}' to '{1}'", j?.text, R.newName),
				code: "undoredo.rename",
				quotableLabel: localize("quotableLabel", "Renaming {0} to {1}", j?.text, R.newName),
				respectAutoSaveConfig: !0
			}).then((O) => {
				e("edits applied"), O.ariaSummary && alert(localize("aria", "Successfully renamed '{0}' to '{1}'. Summary: {2}", j.text, R.newName, O.ariaSummary));
			}).catch((O) => {
				e(`error when applying edits ${JSON.stringify(O, null, "	")}`), this._notificationService.error(localize("rename.failedApply", "Rename failed to apply edits")), this._logService.error(O);
			});
		}, (O) => {
			e("error when providing rename edits", JSON.stringify(O, null, "	")), this._notificationService.error(localize("rename.failed", "Rename failed to compute edits")), this._logService.error(O);
		}).finally(() => {
			M.dispose();
		});
		return e("returning rename operation"), this._progressService.showWhile(z, 250), z;
	}
	acceptRenameInput(e) {
		this._renameWidget.acceptInput(e);
	}
	cancelRenameInput() {
		this._renameWidget.cancelInput(!0, "cancelRenameInput command");
	}
	focusNextRenameSuggestion() {
		this._renameWidget.focusNextRenameSuggestion();
	}
	focusPreviousRenameSuggestion() {
		this._renameWidget.focusPreviousRenameSuggestion();
	}
	_reportTelemetry(e, O, k) {
		let A = typeof k == "boolean" ? {
			kind: "cancelled",
			languageId: O,
			nRenameSuggestionProviders: e
		} : {
			kind: "accepted",
			languageId: O,
			nRenameSuggestionProviders: e,
			source: k.stats.source.k,
			nRenameSuggestions: k.stats.nRenameSuggestions,
			timeBeforeFirstInputFieldEdit: k.stats.timeBeforeFirstInputFieldEdit,
			wantsPreview: k.wantsPreview,
			nRenameSuggestionsInvocations: k.stats.nRenameSuggestionsInvocations,
			hadAutomaticRenameSuggestionsInvocation: k.stats.hadAutomaticRenameSuggestionsInvocation
		};
		this._telemetryService.publicLog2("renameInvokedEvent", A);
	}
};
RenameController = RenameController_1 = __decorate$23([
	__param$23(1, IInstantiationService),
	__param$23(2, INotificationService),
	__param$23(3, IBulkEditService),
	__param$23(4, IEditorProgressService),
	__param$23(5, ILogService),
	__param$23(6, ITextResourceConfigurationService),
	__param$23(7, ILanguageFeaturesService),
	__param$23(8, ITelemetryService)
], RenameController);
var RenameAction = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.rename",
			label: localize("rename.label", "Rename Symbol"),
			alias: "Rename Symbol",
			precondition: ContextKeyExpr.and(EditorContextKeys.writable, EditorContextKeys.hasRenameProvider),
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: 60,
				weight: 100
			},
			contextMenuOpts: {
				group: "1_modification",
				order: 1.1
			}
		});
	}
	runCommand(e, O) {
		let k = e.get(ICodeEditorService), [A, j] = Array.isArray(O) && O || [void 0, void 0];
		return URI.isUri(A) && Position.isIPosition(j) ? k.openCodeEditor({ resource: A }, k.getActiveCodeEditor()).then((e) => {
			e && (e.setPosition(j), e.invokeWithinContext((O) => (this.reportTelemetry(O, e), this.run(O, e))));
		}, onUnexpectedError) : super.runCommand(e, O);
	}
	run(e, O) {
		let k = e.get(ILogService), A = RenameController.get(O);
		return A ? (k.trace("[RenameAction] got controller, running..."), A.run()) : (k.trace("[RenameAction] returning early - controller missing"), Promise.resolve());
	}
};
registerEditorContribution(RenameController.ID, RenameController, 4), registerEditorAction(RenameAction);
var RenameCommand = EditorCommand.bindToContribution(RenameController.get);
registerEditorCommand(new RenameCommand({
	id: "acceptRenameInput",
	precondition: CONTEXT_RENAME_INPUT_VISIBLE,
	handler: (e) => e.acceptRenameInput(!1),
	kbOpts: {
		weight: 199,
		kbExpr: ContextKeyExpr.and(EditorContextKeys.focus, ContextKeyExpr.not("isComposing")),
		primary: 3
	}
})), registerEditorCommand(new RenameCommand({
	id: "acceptRenameInputWithPreview",
	precondition: ContextKeyExpr.and(CONTEXT_RENAME_INPUT_VISIBLE, ContextKeyExpr.has("config.editor.rename.enablePreview")),
	handler: (e) => e.acceptRenameInput(!0),
	kbOpts: {
		weight: 199,
		kbExpr: ContextKeyExpr.and(EditorContextKeys.focus, ContextKeyExpr.not("isComposing")),
		primary: 2051
	}
})), registerEditorCommand(new RenameCommand({
	id: "cancelRenameInput",
	precondition: CONTEXT_RENAME_INPUT_VISIBLE,
	handler: (e) => e.cancelRenameInput(),
	kbOpts: {
		weight: 199,
		kbExpr: EditorContextKeys.focus,
		primary: 9,
		secondary: [1033]
	}
})), registerAction2(class extends Action2 {
	constructor() {
		super({
			id: "focusNextRenameSuggestion",
			title: { ...localize2("focusNextRenameSuggestion", "Focus Next Rename Suggestion") },
			precondition: CONTEXT_RENAME_INPUT_VISIBLE,
			keybinding: [{
				primary: 18,
				weight: 199
			}]
		});
	}
	run(e) {
		let O = e.get(ICodeEditorService).getFocusedCodeEditor();
		if (!O) return;
		let k = RenameController.get(O);
		k && k.focusNextRenameSuggestion();
	}
}), registerAction2(class extends Action2 {
	constructor() {
		super({
			id: "focusPreviousRenameSuggestion",
			title: { ...localize2("focusPreviousRenameSuggestion", "Focus Previous Rename Suggestion") },
			precondition: CONTEXT_RENAME_INPUT_VISIBLE,
			keybinding: [{
				primary: 16,
				weight: 199
			}]
		});
	}
	run(e) {
		let O = e.get(ICodeEditorService).getFocusedCodeEditor();
		if (!O) return;
		let k = RenameController.get(O);
		k && k.focusPreviousRenameSuggestion();
	}
}), registerModelAndPositionCommand("_executeDocumentRenameProvider", function(e, O, k, ...A) {
	let [j] = A;
	assertType(typeof j == "string");
	let { renameProvider: M } = e.get(ILanguageFeaturesService);
	return rename(M, O, k, j);
}), registerModelAndPositionCommand("_executePrepareRename", async function(e, O, k) {
	let { renameProvider: A } = e.get(ILanguageFeaturesService), j = await new RenameSkeleton(O, k, A).resolveRenameLocation(CancellationToken.None);
	if (j?.rejectReason) throw Error(j.rejectReason);
	return j;
}), Registry.as(Extensions$1.Configuration).registerConfiguration({
	id: "editor",
	properties: { "editor.rename.enablePreview": {
		scope: 5,
		description: localize("enablePreview", "Enable/disable the ability to preview changes before renaming"),
		default: !0,
		type: "boolean"
	} }
});
var __decorate$22 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$22 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, SectionHeaderDetector = class extends Disposable {
	static {
		this.ID = "editor.sectionHeaderDetector";
	}
	constructor(e, O, k) {
		super(), this.editor = e, this.languageConfigurationService = O, this.editorWorkerService = k, this.decorations = this.editor.createDecorationsCollection(), this.options = this.createOptions(e.getOption(73)), this.computePromise = null, this.currentOccurrences = {}, this._register(e.onDidChangeModel((O) => {
			this.currentOccurrences = {}, this.options = this.createOptions(e.getOption(73)), this.stop(), this.computeSectionHeaders.schedule(0);
		})), this._register(e.onDidChangeModelLanguage((O) => {
			this.currentOccurrences = {}, this.options = this.createOptions(e.getOption(73)), this.stop(), this.computeSectionHeaders.schedule(0);
		})), this._register(O.onDidChange((O) => {
			let k = this.editor.getModel()?.getLanguageId();
			k && O.affects(k) && (this.currentOccurrences = {}, this.options = this.createOptions(e.getOption(73)), this.stop(), this.computeSectionHeaders.schedule(0));
		})), this._register(e.onDidChangeConfiguration((O) => {
			this.options && !O.hasChanged(73) || (this.options = this.createOptions(e.getOption(73)), this.updateDecorations([]), this.stop(), this.computeSectionHeaders.schedule(0));
		})), this._register(this.editor.onDidChangeModelContent((e) => {
			this.computeSectionHeaders.schedule();
		})), this._register(e.onDidChangeModelTokens((e) => {
			this.computeSectionHeaders.isScheduled() || this.computeSectionHeaders.schedule(1e3);
		})), this.computeSectionHeaders = this._register(new RunOnceScheduler(() => {
			this.findSectionHeaders();
		}, 250)), this.computeSectionHeaders.schedule(0);
	}
	createOptions(e) {
		if (!e || !this.editor.hasModel()) return;
		let O = this.editor.getModel().getLanguageId();
		if (!O) return;
		let k = this.languageConfigurationService.getLanguageConfiguration(O).comments, A = this.languageConfigurationService.getLanguageConfiguration(O).foldingRules;
		if (!(!k && !A?.markers)) return {
			foldingRules: A,
			findMarkSectionHeaders: e.showMarkSectionHeaders,
			findRegionSectionHeaders: e.showRegionSectionHeaders
		};
	}
	findSectionHeaders() {
		if (!this.editor.hasModel() || !this.options?.findMarkSectionHeaders && !this.options?.findRegionSectionHeaders) return;
		let e = this.editor.getModel();
		if (e.isDisposed() || e.isTooLargeForSyncing()) return;
		let O = e.getVersionId();
		this.editorWorkerService.findSectionHeaders(e.uri, this.options).then((k) => {
			e.isDisposed() || e.getVersionId() !== O || this.updateDecorations(k);
		});
	}
	updateDecorations(e) {
		let O = this.editor.getModel();
		O && (e = e.filter((e) => {
			if (!e.shouldBeInComments) return !0;
			let k = O.validateRange(e.range), A = O.tokenization.getLineTokens(k.startLineNumber), j = A.findTokenIndexAtOffset(k.startColumn - 1), M = A.getStandardTokenType(j);
			return A.getLanguageId(j) === O.getLanguageId() && M === 1;
		}));
		let k = Object.values(this.currentOccurrences).map((e) => e.decorationId), A = e.map((e) => decoration(e));
		this.editor.changeDecorations((O) => {
			let j = O.deltaDecorations(k, A);
			this.currentOccurrences = {};
			for (let O = 0, k = j.length; O < k; O++) {
				let k = {
					sectionHeader: e[O],
					decorationId: j[O]
				};
				this.currentOccurrences[k.decorationId] = k;
			}
		});
	}
	stop() {
		this.computeSectionHeaders.cancel(), this.computePromise &&= (this.computePromise.cancel(), null);
	}
	dispose() {
		super.dispose(), this.stop(), this.decorations.clear();
	}
};
SectionHeaderDetector = __decorate$22([__param$22(1, ILanguageConfigurationService), __param$22(2, IEditorWorkerService)], SectionHeaderDetector);
function decoration(e) {
	return {
		range: e.range,
		options: ModelDecorationOptions.createDynamic({
			description: "section-header",
			stickiness: 3,
			collapseOnReplaceEdit: !0,
			minimap: {
				color: void 0,
				position: 1,
				sectionHeaderStyle: e.hasSeparatorLine ? 2 : 1,
				sectionHeaderText: e.text
			}
		})
	};
}
registerEditorContribution(SectionHeaderDetector.ID, SectionHeaderDetector, 1);
function reverseEndianness(e) {
	for (let O = 0, k = e.length; O < k; O += 4) {
		let k = e[O + 0], A = e[O + 1], j = e[O + 2], M = e[O + 3];
		e[O + 0] = M, e[O + 1] = j, e[O + 2] = A, e[O + 3] = k;
	}
}
function toLittleEndianBuffer(e) {
	let O = new Uint8Array(e.buffer, e.byteOffset, e.length * 4);
	return isLittleEndian() || reverseEndianness(O), VSBuffer.wrap(O);
}
function encodeSemanticTokensDto(e) {
	let O = new Uint32Array(encodeSemanticTokensDtoSize(e)), k = 0;
	if (O[k++] = e.id, e.type === "full") O[k++] = 1, O[k++] = e.data.length, O.set(e.data, k), k += e.data.length;
	else {
		O[k++] = 2, O[k++] = e.deltas.length;
		for (let A of e.deltas) O[k++] = A.start, O[k++] = A.deleteCount, A.data ? (O[k++] = A.data.length, O.set(A.data, k), k += A.data.length) : O[k++] = 0;
	}
	return toLittleEndianBuffer(O);
}
function encodeSemanticTokensDtoSize(e) {
	let O = 0;
	if (O += 2, e.type === "full") O += 1 + e.data.length;
	else {
		O += 1, O += 3 * e.deltas.length;
		for (let k of e.deltas) k.data && (O += k.data.length);
	}
	return O;
}
function isSemanticTokens(e) {
	return e && !!e.data;
}
function isSemanticTokensEdits(e) {
	return e && Array.isArray(e.edits);
}
var DocumentSemanticTokensResult = class {
	constructor(e, O, k) {
		this.provider = e, this.tokens = O, this.error = k;
	}
};
function hasDocumentSemanticTokensProvider(e, O) {
	return e.has(O);
}
function getDocumentSemanticTokensProviders(e, O) {
	let k = e.orderedGroups(O);
	return k.length > 0 ? k[0] : [];
}
async function getDocumentSemanticTokens(e, O, k, A, j) {
	let M = getDocumentSemanticTokensProviders(e, O), N = await Promise.all(M.map(async (e) => {
		let M, N = null;
		try {
			M = await e.provideDocumentSemanticTokens(O, e === k ? A : null, j);
		} catch (e) {
			N = e, M = null;
		}
		return (!M || !isSemanticTokens(M) && !isSemanticTokensEdits(M)) && (M = null), new DocumentSemanticTokensResult(e, M, N);
	}));
	for (let e of N) {
		if (e.error) throw e.error;
		if (e.tokens) return e;
	}
	return N.length > 0 ? N[0] : null;
}
function _getDocumentSemanticTokensProviderHighestGroup(e, O) {
	let k = e.orderedGroups(O);
	return k.length > 0 ? k[0] : null;
}
var DocumentRangeSemanticTokensResult = class {
	constructor(e, O) {
		this.provider = e, this.tokens = O;
	}
};
function hasDocumentRangeSemanticTokensProvider(e, O) {
	return e.has(O);
}
function getDocumentRangeSemanticTokensProviders(e, O) {
	let k = e.orderedGroups(O);
	return k.length > 0 ? k[0] : [];
}
async function getDocumentRangeSemanticTokens(e, O, k, A) {
	let j = getDocumentRangeSemanticTokensProviders(e, O), M = await Promise.all(j.map(async (e) => {
		let j;
		try {
			j = await e.provideDocumentRangeSemanticTokens(O, k, A);
		} catch (e) {
			onUnexpectedExternalError(e), j = null;
		}
		return (!j || !isSemanticTokens(j)) && (j = null), new DocumentRangeSemanticTokensResult(e, j);
	}));
	for (let e of M) if (e.tokens) return e;
	return M.length > 0 ? M[0] : null;
}
CommandsRegistry.registerCommand("_provideDocumentSemanticTokensLegend", async (e, ...O) => {
	let [k] = O;
	assertType(k instanceof URI);
	let A = e.get(IModelService).getModel(k);
	if (!A) return;
	let { documentSemanticTokensProvider: j } = e.get(ILanguageFeaturesService), M = _getDocumentSemanticTokensProviderHighestGroup(j, A);
	return M ? M[0].getLegend() : e.get(ICommandService).executeCommand("_provideDocumentRangeSemanticTokensLegend", k);
}), CommandsRegistry.registerCommand("_provideDocumentSemanticTokens", async (e, ...O) => {
	let [k] = O;
	assertType(k instanceof URI);
	let A = e.get(IModelService).getModel(k);
	if (!A) return;
	let { documentSemanticTokensProvider: j } = e.get(ILanguageFeaturesService);
	if (!hasDocumentSemanticTokensProvider(j, A)) return e.get(ICommandService).executeCommand("_provideDocumentRangeSemanticTokens", k, A.getFullModelRange());
	let M = await getDocumentSemanticTokens(j, A, null, null, CancellationToken.None);
	if (!M) return;
	let { provider: N, tokens: P } = M;
	if (!P || !isSemanticTokens(P)) return;
	let F = encodeSemanticTokensDto({
		id: 0,
		type: "full",
		data: P.data
	});
	return P.resultId && N.releaseDocumentSemanticTokens(P.resultId), F;
}), CommandsRegistry.registerCommand("_provideDocumentRangeSemanticTokensLegend", async (e, ...O) => {
	let [k, A] = O;
	assertType(k instanceof URI);
	let j = e.get(IModelService).getModel(k);
	if (!j) return;
	let { documentRangeSemanticTokensProvider: M } = e.get(ILanguageFeaturesService), N = getDocumentRangeSemanticTokensProviders(M, j);
	if (N.length === 0) return;
	if (N.length === 1) return N[0].getLegend();
	if (!A || !Range.isIRange(A)) return console.warn("provideDocumentRangeSemanticTokensLegend might be out-of-sync with provideDocumentRangeSemanticTokens unless a range argument is passed in"), N[0].getLegend();
	let P = await getDocumentRangeSemanticTokens(M, j, Range.lift(A), CancellationToken.None);
	if (P) return P.provider.getLegend();
}), CommandsRegistry.registerCommand("_provideDocumentRangeSemanticTokens", async (e, ...O) => {
	let [k, A] = O;
	assertType(k instanceof URI), assertType(Range.isIRange(A));
	let j = e.get(IModelService).getModel(k);
	if (!j) return;
	let { documentRangeSemanticTokensProvider: M } = e.get(ILanguageFeaturesService), N = await getDocumentRangeSemanticTokens(M, j, Range.lift(A), CancellationToken.None);
	if (!(!N || !N.tokens)) return encodeSemanticTokensDto({
		id: 0,
		type: "full",
		data: N.tokens.data
	});
});
function isSemanticColoringEnabled(e, O, k) {
	let A = k.getValue("editor.semanticHighlighting", {
		overrideIdentifier: e.getLanguageId(),
		resource: e.uri
	})?.enabled;
	return typeof A == "boolean" ? A : O.getColorTheme().semanticHighlighting;
}
var __decorate$21 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$21 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, ModelSemanticColoring_1, DocumentSemanticTokensFeature = class extends Disposable {
	constructor(e, O, k, A, j, M) {
		super(), this._watchers = Object.create(null);
		let N = (O) => {
			this._watchers[O.uri.toString()] = new ModelSemanticColoring(O, e, k, j, M);
		}, P = (e, O) => {
			O.dispose(), delete this._watchers[e.uri.toString()];
		}, F = () => {
			for (let e of O.getModels()) {
				let O = this._watchers[e.uri.toString()];
				isSemanticColoringEnabled(e, k, A) ? O || N(e) : O && P(e, O);
			}
		};
		O.getModels().forEach((e) => {
			isSemanticColoringEnabled(e, k, A) && N(e);
		}), this._register(O.onModelAdded((e) => {
			isSemanticColoringEnabled(e, k, A) && N(e);
		})), this._register(O.onModelRemoved((e) => {
			let O = this._watchers[e.uri.toString()];
			O && P(e, O);
		})), this._register(A.onDidChangeConfiguration((e) => {
			e.affectsConfiguration("editor.semanticHighlighting") && F();
		})), this._register(k.onDidColorThemeChange(F));
	}
	dispose() {
		for (let e of Object.values(this._watchers)) e.dispose();
		super.dispose();
	}
};
DocumentSemanticTokensFeature = __decorate$21([
	__param$21(0, ISemanticTokensStylingService),
	__param$21(1, IModelService),
	__param$21(2, IThemeService),
	__param$21(3, IConfigurationService),
	__param$21(4, ILanguageFeatureDebounceService),
	__param$21(5, ILanguageFeaturesService)
], DocumentSemanticTokensFeature);
var ModelSemanticColoring = class extends Disposable {
	static {
		ModelSemanticColoring_1 = this;
	}
	static {
		this.REQUEST_MIN_DELAY = 300;
	}
	static {
		this.REQUEST_MAX_DELAY = 2e3;
	}
	constructor(e, O, k, A, j) {
		super(), this._semanticTokensStylingService = O, this._isDisposed = !1, this._model = e, this._provider = j.documentSemanticTokensProvider, this._debounceInformation = A.for(this._provider, "DocumentSemanticTokens", {
			min: ModelSemanticColoring_1.REQUEST_MIN_DELAY,
			max: ModelSemanticColoring_1.REQUEST_MAX_DELAY
		}), this._fetchDocumentSemanticTokens = this._register(new RunOnceScheduler(() => this._fetchDocumentSemanticTokensNow(), ModelSemanticColoring_1.REQUEST_MIN_DELAY)), this._currentDocumentResponse = null, this._currentDocumentRequestCancellationTokenSource = null, this._documentProvidersChangeListeners = [], this._providersChangedDuringRequest = !1, this._register(this._model.onDidChangeContent(() => {
			this._fetchDocumentSemanticTokens.isScheduled() || this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model));
		})), this._register(this._model.onDidChangeAttached(() => {
			this._fetchDocumentSemanticTokens.isScheduled() || this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model));
		})), this._register(this._model.onDidChangeLanguage(() => {
			this._currentDocumentResponse &&= (this._currentDocumentResponse.dispose(), null), this._currentDocumentRequestCancellationTokenSource &&= (this._currentDocumentRequestCancellationTokenSource.cancel(), null), this._setDocumentSemanticTokens(null, null, null, []), this._fetchDocumentSemanticTokens.schedule(0);
		}));
		let M = () => {
			dispose(this._documentProvidersChangeListeners), this._documentProvidersChangeListeners = [];
			for (let O of this._provider.all(e)) typeof O.onDidChange == "function" && this._documentProvidersChangeListeners.push(O.onDidChange(() => {
				if (this._currentDocumentRequestCancellationTokenSource) {
					this._providersChangedDuringRequest = !0;
					return;
				}
				this._fetchDocumentSemanticTokens.schedule(0);
			}));
		};
		M(), this._register(this._provider.onDidChange(() => {
			M(), this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model));
		})), this._register(k.onDidColorThemeChange((e) => {
			this._setDocumentSemanticTokens(null, null, null, []), this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model));
		})), this._fetchDocumentSemanticTokens.schedule(0);
	}
	dispose() {
		this._currentDocumentResponse &&= (this._currentDocumentResponse.dispose(), null), this._currentDocumentRequestCancellationTokenSource &&= (this._currentDocumentRequestCancellationTokenSource.cancel(), null), dispose(this._documentProvidersChangeListeners), this._documentProvidersChangeListeners = [], this._setDocumentSemanticTokens(null, null, null, []), this._isDisposed = !0, super.dispose();
	}
	_fetchDocumentSemanticTokensNow() {
		if (this._currentDocumentRequestCancellationTokenSource) return;
		if (!hasDocumentSemanticTokensProvider(this._provider, this._model)) {
			this._currentDocumentResponse && this._model.tokenization.setSemanticTokens(null, !1);
			return;
		}
		if (!this._model.isAttachedToEditor()) return;
		let e = new CancellationTokenSource(), O = this._currentDocumentResponse ? this._currentDocumentResponse.provider : null, k = this._currentDocumentResponse && this._currentDocumentResponse.resultId || null, A = getDocumentSemanticTokens(this._provider, this._model, O, k, e.token);
		this._currentDocumentRequestCancellationTokenSource = e, this._providersChangedDuringRequest = !1;
		let j = [], M = this._model.onDidChangeContent((e) => {
			j.push(e);
		}), N = new StopWatch(!1);
		A.then((e) => {
			if (this._debounceInformation.update(this._model, N.elapsed()), this._currentDocumentRequestCancellationTokenSource = null, M.dispose(), !e) this._setDocumentSemanticTokens(null, null, null, j);
			else {
				let { provider: O, tokens: k } = e, A = this._semanticTokensStylingService.getStyling(O);
				this._setDocumentSemanticTokens(O, k || null, A, j);
			}
		}, (e) => {
			e && (isCancellationError(e) || typeof e.message == "string" && e.message.indexOf("busy") !== -1) || onUnexpectedError(e), this._currentDocumentRequestCancellationTokenSource = null, M.dispose(), (j.length > 0 || this._providersChangedDuringRequest) && (this._fetchDocumentSemanticTokens.isScheduled() || this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model)));
		});
	}
	static _copy(e, O, k, A, j) {
		j = Math.min(j, k.length - A, e.length - O);
		for (let M = 0; M < j; M++) k[A + M] = e[O + M];
	}
	_setDocumentSemanticTokens(e, O, k, A) {
		let j = this._currentDocumentResponse, M = () => {
			(A.length > 0 || this._providersChangedDuringRequest) && !this._fetchDocumentSemanticTokens.isScheduled() && this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model));
		};
		if (this._currentDocumentResponse &&= (this._currentDocumentResponse.dispose(), null), this._isDisposed) {
			e && O && e.releaseDocumentSemanticTokens(O.resultId);
			return;
		}
		if (!e || !k) {
			this._model.tokenization.setSemanticTokens(null, !1);
			return;
		}
		if (!O) {
			this._model.tokenization.setSemanticTokens(null, !0), M();
			return;
		}
		if (isSemanticTokensEdits(O)) {
			if (!j) {
				this._model.tokenization.setSemanticTokens(null, !0);
				return;
			}
			if (O.edits.length === 0) O = {
				resultId: O.resultId,
				data: j.data
			};
			else {
				let e = 0;
				for (let k of O.edits) e += (k.data ? k.data.length : 0) - k.deleteCount;
				let A = j.data, M = new Uint32Array(A.length + e), N = A.length, P = M.length;
				for (let e = O.edits.length - 1; e >= 0; e--) {
					let F = O.edits[e];
					if (F.start > A.length) {
						k.warnInvalidEditStart(j.resultId, O.resultId, e, F.start, A.length), this._model.tokenization.setSemanticTokens(null, !0);
						return;
					}
					let I = N - (F.start + F.deleteCount);
					I > 0 && (ModelSemanticColoring_1._copy(A, N - I, M, P - I, I), P -= I), F.data && (ModelSemanticColoring_1._copy(F.data, 0, M, P - F.data.length, F.data.length), P -= F.data.length), N = F.start;
				}
				N > 0 && ModelSemanticColoring_1._copy(A, 0, M, 0, N), O = {
					resultId: O.resultId,
					data: M
				};
			}
		}
		if (isSemanticTokens(O)) {
			this._currentDocumentResponse = new SemanticTokensResponse(e, O.resultId, O.data);
			let j = toMultilineTokens2(O, k, this._model.getLanguageId());
			if (A.length > 0) for (let e of A) for (let O of j) for (let k of e.changes) O.applyEdit(k.range, k.text);
			this._model.tokenization.setSemanticTokens(j, !0);
		} else this._model.tokenization.setSemanticTokens(null, !0);
		M();
	}
};
ModelSemanticColoring = ModelSemanticColoring_1 = __decorate$21([
	__param$21(1, ISemanticTokensStylingService),
	__param$21(2, IThemeService),
	__param$21(3, ILanguageFeatureDebounceService),
	__param$21(4, ILanguageFeaturesService)
], ModelSemanticColoring);
var SemanticTokensResponse = class {
	constructor(e, O, k) {
		this.provider = e, this.resultId = O, this.data = k;
	}
	dispose() {
		this.provider.releaseDocumentSemanticTokens(this.resultId);
	}
};
registerEditorFeature(DocumentSemanticTokensFeature);
var __decorate$20 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$20 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, ViewportSemanticTokensContribution = class extends Disposable {
	static {
		this.ID = "editor.contrib.viewportSemanticTokens";
	}
	constructor(e, O, k, A, j, M) {
		super(), this._semanticTokensStylingService = O, this._themeService = k, this._configurationService = A, this._editor = e, this._provider = M.documentRangeSemanticTokensProvider, this._debounceInformation = j.for(this._provider, "DocumentRangeSemanticTokens", {
			min: 100,
			max: 500
		}), this._tokenizeViewport = this._register(new RunOnceScheduler(() => this._tokenizeViewportNow(), 100)), this._outstandingRequests = [];
		let N = () => {
			this._editor.hasModel() && this._tokenizeViewport.schedule(this._debounceInformation.get(this._editor.getModel()));
		};
		this._register(this._editor.onDidScrollChange(() => {
			N();
		})), this._register(this._editor.onDidChangeModel(() => {
			this._cancelAll(), N();
		})), this._register(this._editor.onDidChangeModelContent((e) => {
			this._cancelAll(), N();
		})), this._register(this._provider.onDidChange(() => {
			this._cancelAll(), N();
		})), this._register(this._configurationService.onDidChangeConfiguration((e) => {
			e.affectsConfiguration("editor.semanticHighlighting") && (this._cancelAll(), N());
		})), this._register(this._themeService.onDidColorThemeChange(() => {
			this._cancelAll(), N();
		})), N();
	}
	_cancelAll() {
		for (let e of this._outstandingRequests) e.cancel();
		this._outstandingRequests = [];
	}
	_removeOutstandingRequest(e) {
		for (let O = 0, k = this._outstandingRequests.length; O < k; O++) if (this._outstandingRequests[O] === e) {
			this._outstandingRequests.splice(O, 1);
			return;
		}
	}
	_tokenizeViewportNow() {
		if (!this._editor.hasModel()) return;
		let e = this._editor.getModel();
		if (e.tokenization.hasCompleteSemanticTokens()) return;
		if (!isSemanticColoringEnabled(e, this._themeService, this._configurationService)) {
			e.tokenization.hasSomeSemanticTokens() && e.tokenization.setSemanticTokens(null, !1);
			return;
		}
		if (!hasDocumentRangeSemanticTokensProvider(this._provider, e)) {
			e.tokenization.hasSomeSemanticTokens() && e.tokenization.setSemanticTokens(null, !1);
			return;
		}
		let O = this._editor.getVisibleRangesPlusViewportAboveBelow();
		this._outstandingRequests = this._outstandingRequests.concat(O.map((O) => this._requestRange(e, O)));
	}
	_requestRange(e, O) {
		let k = e.getVersionId(), A = createCancelablePromise((k) => Promise.resolve(getDocumentRangeSemanticTokens(this._provider, e, O, k))), j = new StopWatch(!1);
		return A.then((A) => {
			if (this._debounceInformation.update(e, j.elapsed()), !A || !A.tokens || e.isDisposed() || e.getVersionId() !== k) return;
			let { provider: M, tokens: N } = A, P = this._semanticTokensStylingService.getStyling(M);
			e.tokenization.setPartialSemanticTokens(O, toMultilineTokens2(N, P, e.getLanguageId()));
		}).then(() => this._removeOutstandingRequest(A), () => this._removeOutstandingRequest(A)), A;
	}
};
ViewportSemanticTokensContribution = __decorate$20([
	__param$20(1, ISemanticTokensStylingService),
	__param$20(2, IThemeService),
	__param$20(3, IConfigurationService),
	__param$20(4, ILanguageFeatureDebounceService),
	__param$20(5, ILanguageFeaturesService)
], ViewportSemanticTokensContribution), registerEditorContribution(ViewportSemanticTokensContribution.ID, ViewportSemanticTokensContribution, 1);
var WordSelectionRangeProvider = class {
	constructor(e = !0) {
		this.selectSubwords = e;
	}
	provideSelectionRanges(e, O) {
		let k = [];
		for (let A of O) {
			let O = [];
			k.push(O), this.selectSubwords && this._addInWordRanges(O, e, A), this._addWordRanges(O, e, A), this._addWhitespaceLine(O, e, A), O.push({ range: e.getFullModelRange() });
		}
		return k;
	}
	_addInWordRanges(e, O, A) {
		let j = O.getWordAtPosition(A);
		if (!j) return;
		let { word: M, startColumn: N } = j, P = A.column - N, F = P, I = P, L = 0;
		for (; F >= 0; F--) {
			let e = M.charCodeAt(F);
			if (F !== P && (e === 95 || e === 45) || isLowerAsciiLetter(e) && isUpperAsciiLetter(L)) break;
			L = e;
		}
		for (F += 1; I < M.length; I++) {
			let e = M.charCodeAt(I);
			if (isUpperAsciiLetter(e) && isLowerAsciiLetter(L) || e === 95 || e === 45) break;
			L = e;
		}
		F < I && e.push({ range: new Range(A.lineNumber, N + F, A.lineNumber, N + I) });
	}
	_addWordRanges(e, O, k) {
		let A = O.getWordAtPosition(k);
		A && e.push({ range: new Range(k.lineNumber, A.startColumn, k.lineNumber, A.endColumn) });
	}
	_addWhitespaceLine(e, O, k) {
		O.getLineLength(k.lineNumber) > 0 && O.getLineFirstNonWhitespaceColumn(k.lineNumber) === 0 && O.getLineLastNonWhitespaceColumn(k.lineNumber) === 0 && e.push({ range: new Range(k.lineNumber, 1, k.lineNumber, O.getLineMaxColumn(k.lineNumber)) });
	}
}, __decorate$19 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$19 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, SmartSelectController_1, SelectionRanges = class e {
	constructor(e, O) {
		this.index = e, this.ranges = O;
	}
	mov(O) {
		let k = this.index + (O ? 1 : -1);
		if (k < 0 || k >= this.ranges.length) return this;
		let A = new e(k, this.ranges);
		return A.ranges[k].equalsRange(this.ranges[this.index]) ? A.mov(O) : A;
	}
}, SmartSelectController = class {
	static {
		SmartSelectController_1 = this;
	}
	static {
		this.ID = "editor.contrib.smartSelectController";
	}
	static get(e) {
		return e.getContribution(SmartSelectController_1.ID);
	}
	constructor(e, O) {
		this._editor = e, this._languageFeaturesService = O, this._ignoreSelection = !1;
	}
	dispose() {
		this._selectionListener?.dispose();
	}
	async run(e) {
		if (!this._editor.hasModel()) return;
		let O = this._editor.getSelections(), k = this._editor.getModel();
		if (this._state || await provideSelectionRanges(this._languageFeaturesService.selectionRangeProvider, k, O.map((e) => e.getPosition()), this._editor.getOption(114), CancellationToken.None).then((e) => {
			if (!(!isNonEmptyArray(e) || e.length !== O.length) && !(!this._editor.hasModel() || !equals(this._editor.getSelections(), O, (e, O) => e.equalsSelection(O)))) {
				for (let k = 0; k < e.length; k++) e[k] = e[k].filter((e) => e.containsPosition(O[k].getStartPosition()) && e.containsPosition(O[k].getEndPosition())), e[k].unshift(O[k]);
				this._state = e.map((e) => new SelectionRanges(0, e)), this._selectionListener?.dispose(), this._selectionListener = this._editor.onDidChangeCursorPosition(() => {
					this._ignoreSelection || (this._selectionListener?.dispose(), this._state = void 0);
				});
			}
		}), !this._state) return;
		this._state = this._state.map((O) => O.mov(e));
		let A = this._state.map((e) => Selection.fromPositions(e.ranges[e.index].getStartPosition(), e.ranges[e.index].getEndPosition()));
		this._ignoreSelection = !0;
		try {
			this._editor.setSelections(A);
		} finally {
			this._ignoreSelection = !1;
		}
	}
};
SmartSelectController = SmartSelectController_1 = __decorate$19([__param$19(1, ILanguageFeaturesService)], SmartSelectController);
var AbstractSmartSelect = class extends EditorAction {
	constructor(e, O) {
		super(O), this._forward = e;
	}
	async run(e, O) {
		let k = SmartSelectController.get(O);
		k && await k.run(this._forward);
	}
}, GrowSelectionAction = class extends AbstractSmartSelect {
	constructor() {
		super(!0, {
			id: "editor.action.smartSelect.expand",
			label: localize("smartSelect.expand", "Expand Selection"),
			alias: "Expand Selection",
			precondition: void 0,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: 1553,
				mac: {
					primary: 3345,
					secondary: [1297]
				},
				weight: 100
			},
			menuOpts: {
				menuId: MenuId.MenubarSelectionMenu,
				group: "1_basic",
				title: localize({
					key: "miSmartSelectGrow",
					comment: ["&& denotes a mnemonic"]
				}, "&&Expand Selection"),
				order: 2
			}
		});
	}
};
CommandsRegistry.registerCommandAlias("editor.action.smartSelect.grow", "editor.action.smartSelect.expand");
var ShrinkSelectionAction = class extends AbstractSmartSelect {
	constructor() {
		super(!1, {
			id: "editor.action.smartSelect.shrink",
			label: localize("smartSelect.shrink", "Shrink Selection"),
			alias: "Shrink Selection",
			precondition: void 0,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: 1551,
				mac: {
					primary: 3343,
					secondary: [1295]
				},
				weight: 100
			},
			menuOpts: {
				menuId: MenuId.MenubarSelectionMenu,
				group: "1_basic",
				title: localize({
					key: "miSmartSelectShrink",
					comment: ["&& denotes a mnemonic"]
				}, "&&Shrink Selection"),
				order: 3
			}
		});
	}
};
registerEditorContribution(SmartSelectController.ID, SmartSelectController, 4), registerEditorAction(GrowSelectionAction), registerEditorAction(ShrinkSelectionAction);
async function provideSelectionRanges(e, O, k, A, j) {
	let M = e.all(O).concat(new WordSelectionRangeProvider(A.selectSubwords));
	M.length === 1 && M.unshift(new BracketSelectionRangeProvider());
	let N = [], P = [];
	for (let e of M) N.push(Promise.resolve(e.provideSelectionRanges(O, k, j)).then((e) => {
		if (isNonEmptyArray(e) && e.length === k.length) for (let O = 0; O < k.length; O++) {
			P[O] || (P[O] = []);
			for (let A of e[O]) Range.isIRange(A.range) && Range.containsPosition(A.range, k[O]) && P[O].push(Range.lift(A.range));
		}
	}, onUnexpectedExternalError));
	return await Promise.all(N), P.map((e) => {
		if (e.length === 0) return [];
		e.sort((e, O) => Position.isBefore(e.getStartPosition(), O.getStartPosition()) ? 1 : Position.isBefore(O.getStartPosition(), e.getStartPosition()) || Position.isBefore(e.getEndPosition(), O.getEndPosition()) ? -1 : Position.isBefore(O.getEndPosition(), e.getEndPosition()) ? 1 : 0);
		let k = [], j;
		for (let O of e) (!j || Range.containsRange(O, j) && !Range.equalsRange(O, j)) && (k.push(O), j = O);
		if (!A.selectLeadingAndTrailingWhitespace) return k;
		let M = [k[0]];
		for (let e = 1; e < k.length; e++) {
			let A = k[e - 1], j = k[e];
			if (j.startLineNumber !== A.startLineNumber || j.endLineNumber !== A.endLineNumber) {
				let e = new Range(A.startLineNumber, O.getLineFirstNonWhitespaceColumn(A.startLineNumber), A.endLineNumber, O.getLineLastNonWhitespaceColumn(A.endLineNumber));
				e.containsRange(A) && !e.equalsRange(A) && j.containsRange(e) && !j.equalsRange(e) && M.push(e);
				let k = new Range(A.startLineNumber, 1, A.endLineNumber, O.getLineMaxColumn(A.endLineNumber));
				k.containsRange(A) && !k.equalsRange(e) && j.containsRange(k) && !j.equalsRange(k) && M.push(k);
			}
			M.push(j);
		}
		return M;
	});
}
CommandsRegistry.registerCommand("_executeSelectionRangeProvider", async function(e, ...O) {
	let [k, A] = O;
	assertType(URI.isUri(k));
	let j = e.get(ILanguageFeaturesService).selectionRangeProvider, M = await e.get(ITextModelService).createModelReference(k);
	try {
		return provideSelectionRanges(j, M.object.textEditorModel, A, {
			selectLeadingAndTrailingWhitespace: !0,
			selectSubwords: !0
		}, CancellationToken.None);
	} finally {
		M.dispose();
	}
});
const Categories = Object.freeze({
	View: localize2("view", "View"),
	Help: localize2("help", "Help"),
	Test: localize2("test", "Test"),
	File: localize2("file", "File"),
	Preferences: localize2("preferences", "Preferences"),
	Developer: localize2({
		key: "developer",
		comment: ["A developer on Code itself or someone diagnosing issues in Code"]
	}, "Developer")
});
var StickyScrollWidgetState = class e {
	constructor(e, O, k, A = null) {
		this.startLineNumbers = e, this.endLineNumbers = O, this.lastLineRelativePosition = k, this.showEndForLine = A;
	}
	equals(e) {
		return !!e && this.lastLineRelativePosition === e.lastLineRelativePosition && this.showEndForLine === e.showEndForLine && equals(this.startLineNumbers, e.startLineNumbers) && equals(this.endLineNumbers, e.endLineNumbers);
	}
	static get Empty() {
		return new e([], [], 0);
	}
}, _ttPolicy = createTrustedTypesPolicy("stickyScrollViewLayer", { createHTML: (e) => e }), STICKY_INDEX_ATTR = "data-sticky-line-index", STICKY_IS_LINE_ATTR = "data-sticky-is-line", STICKY_IS_LINE_NUMBER_ATTR = "data-sticky-is-line-number", STICKY_IS_FOLDING_ICON_ATTR = "data-sticky-is-folding-icon", StickyScrollWidget = class extends Disposable {
	constructor(e) {
		super(), this._editor = e, this._foldingIconStore = new DisposableStore(), this._rootDomNode = document.createElement("div"), this._lineNumbersDomNode = document.createElement("div"), this._linesDomNodeScrollable = document.createElement("div"), this._linesDomNode = document.createElement("div"), this._lineHeight = this._editor.getOption(67), this._renderedStickyLines = [], this._lineNumbers = [], this._lastLineRelativePosition = 0, this._minContentWidthInPx = 0, this._isOnGlyphMargin = !1, this._lineNumbersDomNode.className = "sticky-widget-line-numbers", this._lineNumbersDomNode.setAttribute("role", "none"), this._linesDomNode.className = "sticky-widget-lines", this._linesDomNode.setAttribute("role", "list"), this._linesDomNodeScrollable.className = "sticky-widget-lines-scrollable", this._linesDomNodeScrollable.appendChild(this._linesDomNode), this._rootDomNode.className = "sticky-widget", this._rootDomNode.classList.toggle("peek", e instanceof EmbeddedCodeEditorWidget), this._rootDomNode.appendChild(this._lineNumbersDomNode), this._rootDomNode.appendChild(this._linesDomNodeScrollable);
		let O = () => {
			this._linesDomNode.style.left = this._editor.getOption(116).scrollWithEditor ? `-${this._editor.getScrollLeft()}px` : "0px";
		};
		this._register(this._editor.onDidChangeConfiguration((e) => {
			e.hasChanged(116) && O(), e.hasChanged(67) && (this._lineHeight = this._editor.getOption(67));
		})), this._register(this._editor.onDidScrollChange((e) => {
			e.scrollLeftChanged && O(), e.scrollWidthChanged && this._updateWidgetWidth();
		})), this._register(this._editor.onDidChangeModel(() => {
			O(), this._updateWidgetWidth();
		})), this._register(this._foldingIconStore), O(), this._register(this._editor.onDidLayoutChange((e) => {
			this._updateWidgetWidth();
		})), this._updateWidgetWidth();
	}
	get lineNumbers() {
		return this._lineNumbers;
	}
	get lineNumberCount() {
		return this._lineNumbers.length;
	}
	getRenderedStickyLine(e) {
		return this._renderedStickyLines.find((O) => O.lineNumber === e);
	}
	getCurrentLines() {
		return this._lineNumbers;
	}
	setState(e, O, k) {
		if (k === void 0 && (!this._previousState && !e || this._previousState && this._previousState.equals(e))) return;
		let A = this._isWidgetHeightZero(e), j = A ? void 0 : e, M = A ? 0 : this._findLineToRebuildWidgetFrom(e, k);
		this._renderRootNode(j, O, M), this._previousState = e;
	}
	_isWidgetHeightZero(e) {
		if (!e) return !0;
		let O = e.startLineNumbers.length * this._lineHeight + e.lastLineRelativePosition;
		if (O > 0) {
			this._lastLineRelativePosition = e.lastLineRelativePosition;
			let O = [...e.startLineNumbers];
			e.showEndForLine !== null && (O[e.showEndForLine] = e.endLineNumbers[e.showEndForLine]), this._lineNumbers = O;
		} else this._lastLineRelativePosition = 0, this._lineNumbers = [];
		return O === 0;
	}
	_findLineToRebuildWidgetFrom(e, O) {
		if (!e || !this._previousState) return 0;
		if (O !== void 0) return O;
		let k = this._previousState, A = e.startLineNumbers.findIndex((e) => !k.startLineNumbers.includes(e));
		return A === -1 ? 0 : A;
	}
	_updateWidgetWidth() {
		let e = this._editor.getLayoutInfo(), O = e.contentLeft;
		this._lineNumbersDomNode.style.width = `${O}px`, this._linesDomNodeScrollable.style.setProperty("--vscode-editorStickyScroll-scrollableWidth", `${this._editor.getScrollWidth() - e.verticalScrollbarWidth}px`), this._rootDomNode.style.width = `${e.width - e.verticalScrollbarWidth}px`;
	}
	_clearStickyLinesFromLine(e) {
		this._foldingIconStore.clear();
		for (let O = e; O < this._renderedStickyLines.length; O++) {
			let e = this._renderedStickyLines[O];
			e.lineNumberDomNode.remove(), e.lineDomNode.remove();
		}
		this._renderedStickyLines = this._renderedStickyLines.slice(0, e), this._rootDomNode.style.display = "none";
	}
	_useFoldingOpacityTransition(e) {
		this._lineNumbersDomNode.style.setProperty("--vscode-editorStickyScroll-foldingOpacityTransition", `opacity ${e ? .5 : 0}s`);
	}
	_setFoldingIconsVisibility(e) {
		for (let O of this._renderedStickyLines) {
			let k = O.foldingIcon;
			k && k.setVisible(e ? !0 : k.isCollapsed);
		}
	}
	async _renderRootNode(e, O, k) {
		if (this._clearStickyLinesFromLine(k), !e) return;
		for (let e of this._renderedStickyLines) this._updateTopAndZIndexOfStickyLine(e);
		let A = this._editor.getLayoutInfo(), j = this._lineNumbers.slice(k);
		for (let [e, M] of j.entries()) {
			let j = this._renderChildNode(e + k, M, O, A);
			j && (this._linesDomNode.appendChild(j.lineDomNode), this._lineNumbersDomNode.appendChild(j.lineNumberDomNode), this._renderedStickyLines.push(j));
		}
		O && (this._setFoldingHoverListeners(), this._useFoldingOpacityTransition(!this._isOnGlyphMargin));
		let M = this._lineNumbers.length * this._lineHeight + this._lastLineRelativePosition;
		this._rootDomNode.style.display = "block", this._lineNumbersDomNode.style.height = `${M}px`, this._linesDomNodeScrollable.style.height = `${M}px`, this._rootDomNode.style.height = `${M}px`, this._rootDomNode.style.marginLeft = "0px", this._minContentWidthInPx = Math.max(...this._renderedStickyLines.map((e) => e.scrollWidth)) + A.verticalScrollbarWidth, this._editor.layoutOverlayWidget(this);
	}
	_setFoldingHoverListeners() {
		this._editor.getOption(111) === "mouseover" && (this._foldingIconStore.add(addDisposableListener(this._lineNumbersDomNode, EventType$1.MOUSE_ENTER, () => {
			this._isOnGlyphMargin = !0, this._setFoldingIconsVisibility(!0);
		})), this._foldingIconStore.add(addDisposableListener(this._lineNumbersDomNode, EventType$1.MOUSE_LEAVE, () => {
			this._isOnGlyphMargin = !1, this._useFoldingOpacityTransition(!0), this._setFoldingIconsVisibility(!1);
		})));
	}
	_renderChildNode(e, O, k, A) {
		let j = this._editor._getViewModel();
		if (!j) return;
		let M = j.coordinatesConverter.convertModelPositionToViewPosition(new Position(O, 1)).lineNumber, N = j.getViewLineRenderingData(M), P = this._editor.getOption(68), F;
		try {
			F = LineDecoration.filter(N.inlineDecorations, M, N.minColumn, N.maxColumn);
		} catch {
			F = [];
		}
		let I = new RenderLineInput(!0, !0, N.content, N.continuesWithWrappedLine, N.isBasicASCII, N.containsRTL, 0, N.tokens, F, N.tabSize, N.startVisibleColumn, 1, 1, 1, 500, "none", !0, !0, null), L = new StringBuilder(2e3), R = renderViewLine(I, L), z;
		z = _ttPolicy ? _ttPolicy.createHTML(L.build()) : L.build();
		let B = document.createElement("span");
		B.setAttribute(STICKY_INDEX_ATTR, String(e)), B.setAttribute(STICKY_IS_LINE_ATTR, ""), B.setAttribute("role", "listitem"), B.tabIndex = 0, B.className = "sticky-line-content", B.classList.add(`stickyLine${O}`), B.style.lineHeight = `${this._lineHeight}px`, B.innerHTML = z;
		let V = document.createElement("span");
		V.setAttribute(STICKY_INDEX_ATTR, String(e)), V.setAttribute(STICKY_IS_LINE_NUMBER_ATTR, ""), V.className = "sticky-line-number", V.style.lineHeight = `${this._lineHeight}px`;
		let H = A.contentLeft;
		V.style.width = `${H}px`;
		let U = document.createElement("span");
		P.renderType === 1 || P.renderType === 3 && O % 10 == 0 ? U.innerText = O.toString() : P.renderType === 2 && (U.innerText = Math.abs(O - this._editor.getPosition().lineNumber).toString()), U.className = "sticky-line-number-inner", U.style.lineHeight = `${this._lineHeight}px`, U.style.width = `${A.lineNumbersWidth}px`, U.style.paddingLeft = `${A.lineNumbersLeft}px`, V.appendChild(U);
		let W = this._renderFoldingIconForLine(k, O);
		W && V.appendChild(W.domNode), this._editor.applyFontInfo(B), this._editor.applyFontInfo(U), V.style.lineHeight = `${this._lineHeight}px`, B.style.lineHeight = `${this._lineHeight}px`, V.style.height = `${this._lineHeight}px`, B.style.height = `${this._lineHeight}px`;
		let G = new RenderedStickyLine(e, O, B, V, W, R.characterMapping, B.scrollWidth);
		return this._updateTopAndZIndexOfStickyLine(G);
	}
	_updateTopAndZIndexOfStickyLine(e) {
		let O = e.index, k = e.lineDomNode, A = e.lineNumberDomNode, j = O === this._lineNumbers.length - 1;
		k.style.zIndex = j ? "0" : "1", A.style.zIndex = j ? "0" : "1";
		let M = `${O * this._lineHeight + this._lastLineRelativePosition + (e.foldingIcon?.isCollapsed ? 1 : 0)}px`, N = `${O * this._lineHeight}px`;
		return k.style.top = j ? M : N, A.style.top = j ? M : N, e;
	}
	_renderFoldingIconForLine(e, O) {
		let k = this._editor.getOption(111);
		if (!e || k === "never") return;
		let A = e.regions, j = A.findRange(O), M = A.getStartLineNumber(j);
		if (O !== M) return;
		let N = A.isCollapsed(j), P = new StickyFoldingIcon(N, M, A.getEndLineNumber(j), this._lineHeight);
		return P.setVisible(this._isOnGlyphMargin ? !0 : N || k === "always"), P.domNode.setAttribute(STICKY_IS_FOLDING_ICON_ATTR, ""), P;
	}
	getId() {
		return "editor.contrib.stickyScrollWidget";
	}
	getDomNode() {
		return this._rootDomNode;
	}
	getPosition() {
		return {
			preference: 2,
			stackOridinal: 10
		};
	}
	getMinContentWidthInPx() {
		return this._minContentWidthInPx;
	}
	focusLineWithIndex(e) {
		0 <= e && e < this._renderedStickyLines.length && this._renderedStickyLines[e].lineDomNode.focus();
	}
	getEditorPositionFromNode(e) {
		if (!e || e.children.length > 0) return null;
		let O = this._getRenderedStickyLineFromChildDomNode(e);
		if (!O) return null;
		let k = getColumnOfNodeOffset(O.characterMapping, e, 0);
		return new Position(O.lineNumber, k);
	}
	getLineNumberFromChildDomNode(e) {
		return this._getRenderedStickyLineFromChildDomNode(e)?.lineNumber ?? null;
	}
	_getRenderedStickyLineFromChildDomNode(e) {
		let O = this.getLineIndexFromChildDomNode(e);
		return O === null || O < 0 || O >= this._renderedStickyLines.length ? null : this._renderedStickyLines[O];
	}
	getLineIndexFromChildDomNode(e) {
		let O = this._getAttributeValue(e, STICKY_INDEX_ATTR);
		return O ? parseInt(O, 10) : null;
	}
	isInStickyLine(e) {
		return this._getAttributeValue(e, STICKY_IS_LINE_ATTR) !== void 0;
	}
	isInFoldingIconDomNode(e) {
		return this._getAttributeValue(e, STICKY_IS_FOLDING_ICON_ATTR) !== void 0;
	}
	_getAttributeValue(e, O) {
		for (; e && e !== this._rootDomNode;) {
			let k = e.getAttribute(O);
			if (k !== null) return k;
			e = e.parentElement;
		}
	}
}, RenderedStickyLine = class {
	constructor(e, O, k, A, j, M, N) {
		this.index = e, this.lineNumber = O, this.lineDomNode = k, this.lineNumberDomNode = A, this.foldingIcon = j, this.characterMapping = M, this.scrollWidth = N;
	}
}, StickyFoldingIcon = class {
	constructor(e, O, k, A) {
		this.isCollapsed = e, this.foldingStartLine = O, this.foldingEndLine = k, this.dimension = A, this.domNode = document.createElement("div"), this.domNode.style.width = `${A}px`, this.domNode.style.height = `${A}px`, this.domNode.className = ThemeIcon.asClassName(e ? foldingCollapsedIcon : foldingExpandedIcon);
	}
	setVisible(e) {
		this.domNode.style.cursor = e ? "pointer" : "default", this.domNode.style.opacity = e ? "1" : "0";
	}
}, StickyRange = class {
	constructor(e, O) {
		this.startLineNumber = e, this.endLineNumber = O;
	}
}, StickyElement = class {
	constructor(e, O, k) {
		this.range = e, this.children = O, this.parent = k;
	}
}, StickyModel = class {
	constructor(e, O, k, A) {
		this.uri = e, this.version = O, this.element = k, this.outlineProviderId = A;
	}
}, __decorate$18 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$18 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, ModelProvider;
(function(e) {
	e.OUTLINE_MODEL = "outlineModel", e.FOLDING_PROVIDER_MODEL = "foldingProviderModel", e.INDENTATION_MODEL = "indentationModel";
})(ModelProvider ||= {});
var Status;
(function(e) {
	e[e.VALID = 0] = "VALID", e[e.INVALID = 1] = "INVALID", e[e.CANCELED = 2] = "CANCELED";
})(Status ||= {});
var StickyModelProvider = class extends Disposable {
	constructor(e, O, k, A) {
		switch (super(), this._editor = e, this._modelProviders = [], this._modelPromise = null, this._updateScheduler = this._register(new Delayer(300)), this._updateOperation = this._register(new DisposableStore()), this._editor.getOption(116).defaultModel) {
			case ModelProvider.OUTLINE_MODEL: this._modelProviders.push(new StickyModelFromCandidateOutlineProvider(this._editor, A));
			case ModelProvider.FOLDING_PROVIDER_MODEL: this._modelProviders.push(new StickyModelFromCandidateSyntaxFoldingProvider(this._editor, O, A));
			case ModelProvider.INDENTATION_MODEL:
				this._modelProviders.push(new StickyModelFromCandidateIndentationFoldingProvider(this._editor, k));
				break;
		}
	}
	dispose() {
		this._modelProviders.forEach((e) => e.dispose()), this._updateOperation.clear(), this._cancelModelPromise(), super.dispose();
	}
	_cancelModelPromise() {
		this._modelPromise &&= (this._modelPromise.cancel(), null);
	}
	async update(e) {
		return this._updateOperation.clear(), this._updateOperation.add({ dispose: () => {
			this._cancelModelPromise(), this._updateScheduler.cancel();
		} }), this._cancelModelPromise(), await this._updateScheduler.trigger(async () => {
			for (let O of this._modelProviders) {
				let { statusPromise: k, modelPromise: A } = O.computeStickyModel(e);
				this._modelPromise = A;
				let j = await k;
				if (this._modelPromise !== A) return null;
				switch (j) {
					case Status.CANCELED: return this._updateOperation.clear(), null;
					case Status.VALID: return O.stickyModel;
				}
			}
			return null;
		}).catch((e) => (onUnexpectedError(e), null));
	}
};
StickyModelProvider = __decorate$18([__param$18(2, IInstantiationService), __param$18(3, ILanguageFeaturesService)], StickyModelProvider);
var StickyModelCandidateProvider = class extends Disposable {
	constructor(e) {
		super(), this._editor = e, this._stickyModel = null;
	}
	get stickyModel() {
		return this._stickyModel;
	}
	_invalid() {
		return this._stickyModel = null, Status.INVALID;
	}
	computeStickyModel(e) {
		if (e.isCancellationRequested || !this.isProviderValid()) return {
			statusPromise: this._invalid(),
			modelPromise: null
		};
		let O = createCancelablePromise((e) => this.createModelFromProvider(e));
		return {
			statusPromise: O.then((O) => this.isModelValid(O) ? e.isCancellationRequested ? Status.CANCELED : (this._stickyModel = this.createStickyModel(e, O), Status.VALID) : this._invalid()).then(void 0, (e) => (onUnexpectedError(e), Status.CANCELED)),
			modelPromise: O
		};
	}
	isModelValid(e) {
		return !0;
	}
	isProviderValid() {
		return !0;
	}
}, StickyModelFromCandidateOutlineProvider = class extends StickyModelCandidateProvider {
	constructor(e, O) {
		super(e), this._languageFeaturesService = O;
	}
	createModelFromProvider(e) {
		return OutlineModel.create(this._languageFeaturesService.documentSymbolProvider, this._editor.getModel(), e);
	}
	createStickyModel(e, O) {
		let { stickyOutlineElement: k, providerID: A } = this._stickyModelFromOutlineModel(O, this._stickyModel?.outlineProviderId), j = this._editor.getModel();
		return new StickyModel(j.uri, j.getVersionId(), k, A);
	}
	isModelValid(e) {
		return e && e.children.size > 0;
	}
	_stickyModelFromOutlineModel(e, O) {
		let k;
		if (Iterable.first(e.children.values()) instanceof OutlineGroup) {
			let A = Iterable.find(e.children.values(), (e) => e.id === O);
			if (A) k = A.children;
			else {
				let A = "", j = -1, M;
				for (let [O, k] of e.children.entries()) {
					let e = this._findSumOfRangesOfGroup(k);
					e > j && (M = k, j = e, A = k.id);
				}
				O = A, k = M.children;
			}
		} else k = e.children;
		let A = [], j = Array.from(k.values()).sort((e, O) => {
			let k = new StickyRange(e.symbol.range.startLineNumber, e.symbol.range.endLineNumber), A = new StickyRange(O.symbol.range.startLineNumber, O.symbol.range.endLineNumber);
			return this._comparator(k, A);
		});
		for (let e of j) A.push(this._stickyModelFromOutlineElement(e, e.symbol.selectionRange.startLineNumber));
		return {
			stickyOutlineElement: new StickyElement(void 0, A, void 0),
			providerID: O
		};
	}
	_stickyModelFromOutlineElement(e, O) {
		let k = [];
		for (let A of e.children.values()) if (A.symbol.selectionRange.startLineNumber !== A.symbol.range.endLineNumber) if (A.symbol.selectionRange.startLineNumber !== O) k.push(this._stickyModelFromOutlineElement(A, A.symbol.selectionRange.startLineNumber));
		else for (let e of A.children.values()) k.push(this._stickyModelFromOutlineElement(e, A.symbol.selectionRange.startLineNumber));
		k.sort((e, O) => this._comparator(e.range, O.range));
		let A = new StickyRange(e.symbol.selectionRange.startLineNumber, e.symbol.range.endLineNumber);
		return new StickyElement(A, k, void 0);
	}
	_comparator(e, O) {
		return e.startLineNumber === O.startLineNumber ? O.endLineNumber - e.endLineNumber : e.startLineNumber - O.startLineNumber;
	}
	_findSumOfRangesOfGroup(e) {
		let O = 0;
		for (let k of e.children.values()) O += this._findSumOfRangesOfGroup(k);
		return e instanceof OutlineElement ? O + e.symbol.range.endLineNumber - e.symbol.selectionRange.startLineNumber : O;
	}
};
StickyModelFromCandidateOutlineProvider = __decorate$18([__param$18(1, ILanguageFeaturesService)], StickyModelFromCandidateOutlineProvider);
var StickyModelFromCandidateFoldingProvider = class extends StickyModelCandidateProvider {
	constructor(e) {
		super(e), this._foldingLimitReporter = new RangesLimitReporter(e);
	}
	createStickyModel(e, O) {
		let k = this._fromFoldingRegions(O), A = this._editor.getModel();
		return new StickyModel(A.uri, A.getVersionId(), k, void 0);
	}
	isModelValid(e) {
		return e !== null;
	}
	_fromFoldingRegions(e) {
		let O = e.length, k = [], A = new StickyElement(void 0, [], void 0);
		for (let j = 0; j < O; j++) {
			let O = e.getParentIndex(j), M;
			M = O === -1 ? A : k[O];
			let N = new StickyElement(new StickyRange(e.getStartLineNumber(j), e.getEndLineNumber(j) + 1), [], M);
			M.children.push(N), k.push(N);
		}
		return A;
	}
}, StickyModelFromCandidateIndentationFoldingProvider = class extends StickyModelFromCandidateFoldingProvider {
	constructor(e, O) {
		super(e), this._languageConfigurationService = O, this.provider = this._register(new IndentRangeProvider(e.getModel(), this._languageConfigurationService, this._foldingLimitReporter));
	}
	async createModelFromProvider(e) {
		return this.provider.compute(e);
	}
};
StickyModelFromCandidateIndentationFoldingProvider = __decorate$18([__param$18(1, ILanguageConfigurationService)], StickyModelFromCandidateIndentationFoldingProvider);
var StickyModelFromCandidateSyntaxFoldingProvider = class extends StickyModelFromCandidateFoldingProvider {
	constructor(e, O, k) {
		super(e), this._languageFeaturesService = k;
		let A = FoldingController.getFoldingRangeProviders(this._languageFeaturesService, e.getModel());
		A.length > 0 && (this.provider = this._register(new SyntaxRangeProvider(e.getModel(), A, O, this._foldingLimitReporter, void 0)));
	}
	isProviderValid() {
		return this.provider !== void 0;
	}
	async createModelFromProvider(e) {
		return this.provider?.compute(e) ?? null;
	}
};
StickyModelFromCandidateSyntaxFoldingProvider = __decorate$18([__param$18(2, ILanguageFeaturesService)], StickyModelFromCandidateSyntaxFoldingProvider);
var __decorate$17 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$17 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, StickyLineCandidate = class {
	constructor(e, O, k) {
		this.startLineNumber = e, this.endLineNumber = O, this.nestingDepth = k;
	}
}, StickyLineCandidateProvider = class extends Disposable {
	constructor(e, O, k) {
		super(), this._languageFeaturesService = O, this._languageConfigurationService = k, this._onDidChangeStickyScroll = this._register(new Emitter()), this.onDidChangeStickyScroll = this._onDidChangeStickyScroll.event, this._model = null, this._cts = null, this._stickyModelProvider = null, this._editor = e, this._sessionStore = this._register(new DisposableStore()), this._updateSoon = this._register(new RunOnceScheduler(() => this.update(), 50)), this._register(this._editor.onDidChangeConfiguration((e) => {
			e.hasChanged(116) && this.readConfiguration();
		})), this.readConfiguration();
	}
	readConfiguration() {
		this._sessionStore.clear(), this._editor.getOption(116).enabled && (this._sessionStore.add(this._editor.onDidChangeModel(() => {
			this._model = null, this.updateStickyModelProvider(), this._onDidChangeStickyScroll.fire(), this.update();
		})), this._sessionStore.add(this._editor.onDidChangeHiddenAreas(() => this.update())), this._sessionStore.add(this._editor.onDidChangeModelContent(() => this._updateSoon.schedule())), this._sessionStore.add(this._languageFeaturesService.documentSymbolProvider.onDidChange(() => this.update())), this._sessionStore.add(toDisposable(() => {
			this._stickyModelProvider?.dispose(), this._stickyModelProvider = null;
		})), this.updateStickyModelProvider(), this.update());
	}
	getVersionId() {
		return this._model?.version;
	}
	updateStickyModelProvider() {
		this._stickyModelProvider?.dispose(), this._stickyModelProvider = null;
		let e = this._editor;
		e.hasModel() && (this._stickyModelProvider = new StickyModelProvider(e, () => this._updateSoon.schedule(), this._languageConfigurationService, this._languageFeaturesService));
	}
	async update() {
		this._cts?.dispose(!0), this._cts = new CancellationTokenSource(), await this.updateStickyModel(this._cts.token), this._onDidChangeStickyScroll.fire();
	}
	async updateStickyModel(e) {
		if (!this._editor.hasModel() || !this._stickyModelProvider || this._editor.getModel().isTooLargeForTokenization()) {
			this._model = null;
			return;
		}
		let O = await this._stickyModelProvider.update(e);
		e.isCancellationRequested || (this._model = O);
	}
	updateIndex(e) {
		return e === -1 ? e = 0 : e < 0 && (e = -e - 2), e;
	}
	getCandidateStickyLinesIntersectingFromStickyModel(e, O, k, A, j) {
		if (O.children.length === 0) return;
		let M = j, N = [];
		for (let e = 0; e < O.children.length; e++) {
			let k = O.children[e];
			k.range && N.push(k.range.startLineNumber);
		}
		let P = this.updateIndex(binarySearch(N, e.startLineNumber, (e, O) => e - O)), F = this.updateIndex(binarySearch(N, e.startLineNumber + A, (e, O) => e - O));
		for (let N = P; N <= F; N++) {
			let P = O.children[N];
			if (!P) return;
			if (P.range) {
				let O = P.range.startLineNumber, j = P.range.endLineNumber;
				e.startLineNumber <= j + 1 && O - 1 <= e.endLineNumber && O !== M && (M = O, k.push(new StickyLineCandidate(O, j - 1, A + 1)), this.getCandidateStickyLinesIntersectingFromStickyModel(e, P, k, A + 1, O));
			} else this.getCandidateStickyLinesIntersectingFromStickyModel(e, P, k, A, j);
		}
	}
	getCandidateStickyLinesIntersecting(e) {
		if (!this._model?.element) return [];
		let O = [];
		this.getCandidateStickyLinesIntersectingFromStickyModel(e, this._model.element, O, 0, -1);
		let k = this._editor._getViewModel()?.getHiddenAreas();
		if (k) for (let e of k) O = O.filter((O) => !(O.startLineNumber >= e.startLineNumber && O.endLineNumber <= e.endLineNumber + 1));
		return O;
	}
};
StickyLineCandidateProvider = __decorate$17([__param$17(1, ILanguageFeaturesService), __param$17(2, ILanguageConfigurationService)], StickyLineCandidateProvider);
var __decorate$16 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$16 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, StickyScrollController_1, StickyScrollController = class extends Disposable {
	static {
		StickyScrollController_1 = this;
	}
	static {
		this.ID = "store.contrib.stickyScrollController";
	}
	constructor(e, O, k, A, j, M, N) {
		super(), this._editor = e, this._contextMenuService = O, this._languageFeaturesService = k, this._instaService = A, this._contextKeyService = N, this._sessionStore = new DisposableStore(), this._maxStickyLines = 2 ** 53 - 1, this._candidateDefinitionsLength = -1, this._focusedStickyElementIndex = -1, this._enabled = !1, this._focused = !1, this._positionRevealed = !1, this._onMouseDown = !1, this._endLineNumbers = [], this._stickyScrollWidget = new StickyScrollWidget(this._editor), this._stickyLineCandidateProvider = new StickyLineCandidateProvider(this._editor, k, j), this._register(this._stickyScrollWidget), this._register(this._stickyLineCandidateProvider), this._widgetState = StickyScrollWidgetState.Empty, this._onDidResize(), this._readConfiguration();
		let P = this._stickyScrollWidget.getDomNode();
		this._register(this._editor.onDidChangeConfiguration((e) => {
			this._readConfigurationChange(e);
		})), this._register(addDisposableListener(P, EventType$1.CONTEXT_MENU, async (e) => {
			this._onContextMenu(getWindow(P), e);
		})), this._stickyScrollFocusedContextKey = EditorContextKeys.stickyScrollFocused.bindTo(this._contextKeyService), this._stickyScrollVisibleContextKey = EditorContextKeys.stickyScrollVisible.bindTo(this._contextKeyService);
		let F = this._register(trackFocus(P));
		this._register(F.onDidBlur((e) => {
			this._positionRevealed === !1 && P.clientHeight === 0 ? (this._focusedStickyElementIndex = -1, this.focus()) : this._disposeFocusStickyScrollStore();
		})), this._register(F.onDidFocus((e) => {
			this.focus();
		})), this._registerMouseListeners(), this._register(addDisposableListener(P, EventType$1.MOUSE_DOWN, (e) => {
			this._onMouseDown = !0;
		}));
	}
	static get(e) {
		return e.getContribution(StickyScrollController_1.ID);
	}
	_disposeFocusStickyScrollStore() {
		this._stickyScrollFocusedContextKey.set(!1), this._focusDisposableStore?.dispose(), this._focused = !1, this._positionRevealed = !1, this._onMouseDown = !1;
	}
	focus() {
		if (this._onMouseDown) {
			this._onMouseDown = !1, this._editor.focus();
			return;
		}
		this._stickyScrollFocusedContextKey.get() !== !0 && (this._focused = !0, this._focusDisposableStore = new DisposableStore(), this._stickyScrollFocusedContextKey.set(!0), this._focusedStickyElementIndex = this._stickyScrollWidget.lineNumbers.length - 1, this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex));
	}
	focusNext() {
		this._focusedStickyElementIndex < this._stickyScrollWidget.lineNumberCount - 1 && this._focusNav(!0);
	}
	focusPrevious() {
		this._focusedStickyElementIndex > 0 && this._focusNav(!1);
	}
	selectEditor() {
		this._editor.focus();
	}
	_focusNav(e) {
		this._focusedStickyElementIndex = e ? this._focusedStickyElementIndex + 1 : this._focusedStickyElementIndex - 1, this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex);
	}
	goToFocused() {
		let e = this._stickyScrollWidget.lineNumbers;
		this._disposeFocusStickyScrollStore(), this._revealPosition({
			lineNumber: e[this._focusedStickyElementIndex],
			column: 1
		});
	}
	_revealPosition(e) {
		this._reveaInEditor(e, () => this._editor.revealPosition(e));
	}
	_revealLineInCenterIfOutsideViewport(e) {
		this._reveaInEditor(e, () => this._editor.revealLineInCenterIfOutsideViewport(e.lineNumber, 0));
	}
	_reveaInEditor(e, O) {
		this._focused && this._disposeFocusStickyScrollStore(), this._positionRevealed = !0, O(), this._editor.setSelection(Range.fromPositions(e)), this._editor.focus();
	}
	_registerMouseListeners() {
		let e = this._register(new DisposableStore()), O = this._register(new ClickLinkGesture(this._editor, { extractLineNumberFromMouseEvent: (e) => {
			let O = this._stickyScrollWidget.getEditorPositionFromNode(e.target.element);
			return O ? O.lineNumber : 0;
		} })), k = (e) => {
			if (!this._editor.hasModel() || e.target.type !== 12 || e.target.detail !== this._stickyScrollWidget.getId()) return null;
			let O = e.target.element;
			if (!O || O.innerText !== O.innerHTML) return null;
			let k = this._stickyScrollWidget.getEditorPositionFromNode(O);
			return k ? {
				range: new Range(k.lineNumber, k.column, k.lineNumber, k.column + O.innerText.length),
				textElement: O
			} : null;
		}, A = this._stickyScrollWidget.getDomNode();
		this._register(addStandardDisposableListener(A, EventType$1.CLICK, (e) => {
			if (e.ctrlKey || e.altKey || e.metaKey || !e.leftButton) return;
			if (e.shiftKey) {
				let O = this._stickyScrollWidget.getLineIndexFromChildDomNode(e.target);
				if (O === null) return;
				let k = new Position(this._endLineNumbers[O], 1);
				this._revealLineInCenterIfOutsideViewport(k);
				return;
			}
			if (this._stickyScrollWidget.isInFoldingIconDomNode(e.target)) {
				let O = this._stickyScrollWidget.getLineNumberFromChildDomNode(e.target);
				this._toggleFoldingRegionForLine(O);
				return;
			}
			if (!this._stickyScrollWidget.isInStickyLine(e.target)) return;
			let O = this._stickyScrollWidget.getEditorPositionFromNode(e.target);
			if (!O) {
				let k = this._stickyScrollWidget.getLineNumberFromChildDomNode(e.target);
				if (k === null) return;
				O = new Position(k, 1);
			}
			this._revealPosition(O);
		})), this._register(addStandardDisposableListener(A, EventType$1.MOUSE_MOVE, (e) => {
			if (e.shiftKey) {
				let O = this._stickyScrollWidget.getLineIndexFromChildDomNode(e.target);
				if (O === null || this._showEndForLine !== null && this._showEndForLine === O) return;
				this._showEndForLine = O, this._renderStickyScroll();
				return;
			}
			this._showEndForLine !== void 0 && (this._showEndForLine = void 0, this._renderStickyScroll());
		})), this._register(addDisposableListener(A, EventType$1.MOUSE_LEAVE, (e) => {
			this._showEndForLine !== void 0 && (this._showEndForLine = void 0, this._renderStickyScroll());
		})), this._register(O.onMouseMoveOrRelevantKeyDown(([O, A]) => {
			let j = k(O);
			if (!j || !O.hasTriggerModifier || !this._editor.hasModel()) {
				e.clear();
				return;
			}
			let { range: M, textElement: N } = j;
			if (!M.equalsRange(this._stickyRangeProjectedOnEditor)) this._stickyRangeProjectedOnEditor = M, e.clear();
			else if (N.style.textDecoration === "underline") return;
			let P = new CancellationTokenSource();
			e.add(toDisposable(() => P.dispose(!0)));
			let F;
			getDefinitionsAtPosition(this._languageFeaturesService.definitionProvider, this._editor.getModel(), new Position(M.startLineNumber, M.startColumn + 1), !1, P.token).then(((O) => {
				if (!P.token.isCancellationRequested) if (O.length !== 0) {
					this._candidateDefinitionsLength = O.length;
					let k = N;
					F === k ? F || (F = k, F.style.textDecoration = "underline", e.add(toDisposable(() => {
						F.style.textDecoration = "none";
					}))) : (e.clear(), F = k, F.style.textDecoration = "underline", e.add(toDisposable(() => {
						F.style.textDecoration = "none";
					})));
				} else e.clear();
			}));
		})), this._register(O.onCancel(() => {
			e.clear();
		})), this._register(O.onExecute(async (e) => {
			if (e.target.type !== 12 || e.target.detail !== this._stickyScrollWidget.getId()) return;
			let O = this._stickyScrollWidget.getEditorPositionFromNode(e.target.element);
			O && (!this._editor.hasModel() || !this._stickyRangeProjectedOnEditor || (this._candidateDefinitionsLength > 1 && (this._focused && this._disposeFocusStickyScrollStore(), this._revealPosition({
				lineNumber: O.lineNumber,
				column: 1
			})), this._instaService.invokeFunction(goToDefinitionWithLocation, e, this._editor, {
				uri: this._editor.getModel().uri,
				range: this._stickyRangeProjectedOnEditor
			})));
		}));
	}
	_onContextMenu(e, O) {
		let k = new StandardMouseEvent(e, O);
		this._contextMenuService.showContextMenu({
			menuId: MenuId.StickyScrollContext,
			getAnchor: () => k
		});
	}
	_toggleFoldingRegionForLine(e) {
		if (!this._foldingModel || e === null) return;
		let O = this._stickyScrollWidget.getRenderedStickyLine(e), k = O?.foldingIcon;
		if (!k) return;
		toggleCollapseState(this._foldingModel, Number.MAX_VALUE, [e]), k.isCollapsed = !k.isCollapsed;
		let A = (k.isCollapsed ? this._editor.getTopForLineNumber(k.foldingEndLine) : this._editor.getTopForLineNumber(k.foldingStartLine)) - this._editor.getOption(67) * O.index + 1;
		this._editor.setScrollTop(A), this._renderStickyScroll(e);
	}
	_readConfiguration() {
		let e = this._editor.getOption(116);
		if (e.enabled === !1) {
			this._editor.removeOverlayWidget(this._stickyScrollWidget), this._sessionStore.clear(), this._enabled = !1;
			return;
		} else e.enabled && !this._enabled && (this._editor.addOverlayWidget(this._stickyScrollWidget), this._sessionStore.add(this._editor.onDidScrollChange((e) => {
			e.scrollTopChanged && (this._showEndForLine = void 0, this._renderStickyScroll());
		})), this._sessionStore.add(this._editor.onDidLayoutChange(() => this._onDidResize())), this._sessionStore.add(this._editor.onDidChangeModelTokens((e) => this._onTokensChange(e))), this._sessionStore.add(this._stickyLineCandidateProvider.onDidChangeStickyScroll(() => {
			this._showEndForLine = void 0, this._renderStickyScroll();
		})), this._enabled = !0);
		this._editor.getOption(68).renderType === 2 && this._sessionStore.add(this._editor.onDidChangeCursorPosition(() => {
			this._showEndForLine = void 0, this._renderStickyScroll(0);
		}));
	}
	_readConfigurationChange(e) {
		(e.hasChanged(116) || e.hasChanged(73) || e.hasChanged(67) || e.hasChanged(111) || e.hasChanged(68)) && this._readConfiguration(), e.hasChanged(68) && this._renderStickyScroll(0);
	}
	_needsUpdate(e) {
		let O = this._stickyScrollWidget.getCurrentLines();
		for (let k of O) for (let O of e.ranges) if (k >= O.fromLineNumber && k <= O.toLineNumber) return !0;
		return !1;
	}
	_onTokensChange(e) {
		this._needsUpdate(e) && this._renderStickyScroll(0);
	}
	_onDidResize() {
		let e = this._editor.getLayoutInfo().height / this._editor.getOption(67);
		this._maxStickyLines = Math.round(e * .25);
	}
	async _renderStickyScroll(e) {
		let O = this._editor.getModel();
		if (!O || O.isTooLargeForTokenization()) {
			this._resetState();
			return;
		}
		let k = this._updateAndGetMinRebuildFromLine(e), A = this._stickyLineCandidateProvider.getVersionId();
		if (A === void 0 || A === O.getVersionId()) if (!this._focused) await this._updateState(k);
		else if (this._focusedStickyElementIndex === -1) await this._updateState(k), this._focusedStickyElementIndex = this._stickyScrollWidget.lineNumberCount - 1, this._focusedStickyElementIndex !== -1 && this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex);
		else {
			let e = this._stickyScrollWidget.lineNumbers[this._focusedStickyElementIndex];
			await this._updateState(k), this._stickyScrollWidget.lineNumberCount === 0 ? this._focusedStickyElementIndex = -1 : (this._stickyScrollWidget.lineNumbers.includes(e) || (this._focusedStickyElementIndex = this._stickyScrollWidget.lineNumberCount - 1), this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex));
		}
	}
	_updateAndGetMinRebuildFromLine(e) {
		if (e !== void 0) {
			let O = this._minRebuildFromLine === void 0 ? Infinity : this._minRebuildFromLine;
			this._minRebuildFromLine = Math.min(e, O);
		}
		return this._minRebuildFromLine;
	}
	async _updateState(e) {
		this._minRebuildFromLine = void 0, this._foldingModel = await FoldingController.get(this._editor)?.getFoldingModel() ?? void 0, this._widgetState = this.findScrollWidgetState();
		let O = this._widgetState.startLineNumbers.length > 0;
		this._stickyScrollVisibleContextKey.set(O), this._stickyScrollWidget.setState(this._widgetState, this._foldingModel, e);
	}
	async _resetState() {
		this._minRebuildFromLine = void 0, this._foldingModel = void 0, this._widgetState = StickyScrollWidgetState.Empty, this._stickyScrollVisibleContextKey.set(!1), this._stickyScrollWidget.setState(void 0, void 0);
	}
	findScrollWidgetState() {
		let e = this._editor.getOption(67), O = Math.min(this._maxStickyLines, this._editor.getOption(116).maxLineCount), k = this._editor.getScrollTop(), A = 0, j = [], M = [], N = this._editor.getVisibleRanges();
		if (N.length !== 0) {
			let P = new StickyRange(N[0].startLineNumber, N[N.length - 1].endLineNumber), F = this._stickyLineCandidateProvider.getCandidateStickyLinesIntersecting(P);
			for (let N of F) {
				let P = N.startLineNumber, F = N.endLineNumber, I = N.nestingDepth;
				if (F - P > 0) {
					let N = (I - 1) * e, L = I * e, R = this._editor.getBottomForLineNumber(P) - k, z = this._editor.getTopForLineNumber(F) - k, B = this._editor.getBottomForLineNumber(F) - k;
					if (N > z && N <= B) {
						j.push(P), M.push(F + 1), A = B - L;
						break;
					} else L > R && L <= B && (j.push(P), M.push(F + 1));
					if (j.length === O) break;
				}
			}
		}
		return this._endLineNumbers = M, new StickyScrollWidgetState(j, M, A, this._showEndForLine);
	}
	dispose() {
		super.dispose(), this._sessionStore.dispose();
	}
};
StickyScrollController = StickyScrollController_1 = __decorate$16([
	__param$16(1, IContextMenuService),
	__param$16(2, ILanguageFeaturesService),
	__param$16(3, IInstantiationService),
	__param$16(4, ILanguageConfigurationService),
	__param$16(5, ILanguageFeatureDebounceService),
	__param$16(6, IContextKeyService)
], StickyScrollController);
var ToggleStickyScroll = class extends Action2 {
	constructor() {
		super({
			id: "editor.action.toggleStickyScroll",
			title: {
				...localize2("toggleEditorStickyScroll", "Toggle Editor Sticky Scroll"),
				mnemonicTitle: localize({
					key: "mitoggleStickyScroll",
					comment: ["&& denotes a mnemonic"]
				}, "&&Toggle Editor Sticky Scroll")
			},
			metadata: { description: localize2("toggleEditorStickyScroll.description", "Toggle/enable the editor sticky scroll which shows the nested scopes at the top of the viewport") },
			category: Categories.View,
			toggled: {
				condition: ContextKeyExpr.equals("config.editor.stickyScroll.enabled", !0),
				title: localize("stickyScroll", "Sticky Scroll"),
				mnemonicTitle: localize({
					key: "miStickyScroll",
					comment: ["&& denotes a mnemonic"]
				}, "&&Sticky Scroll")
			},
			menu: [
				{ id: MenuId.CommandPalette },
				{
					id: MenuId.MenubarAppearanceMenu,
					group: "4_editor",
					order: 3
				},
				{ id: MenuId.StickyScrollContext }
			]
		});
	}
	async run(e) {
		let O = e.get(IConfigurationService), k = !O.getValue("editor.stickyScroll.enabled");
		return O.updateValue("editor.stickyScroll.enabled", k);
	}
}, weight = 100, FocusStickyScroll = class extends EditorAction2 {
	constructor() {
		super({
			id: "editor.action.focusStickyScroll",
			title: {
				...localize2("focusStickyScroll", "Focus on the editor sticky scroll"),
				mnemonicTitle: localize({
					key: "mifocusStickyScroll",
					comment: ["&& denotes a mnemonic"]
				}, "&&Focus Sticky Scroll")
			},
			precondition: ContextKeyExpr.and(ContextKeyExpr.has("config.editor.stickyScroll.enabled"), EditorContextKeys.stickyScrollVisible),
			menu: [{ id: MenuId.CommandPalette }]
		});
	}
	runEditorCommand(e, O) {
		StickyScrollController.get(O)?.focus();
	}
}, SelectNextStickyScrollLine = class extends EditorAction2 {
	constructor() {
		super({
			id: "editor.action.selectNextStickyScrollLine",
			title: localize2("selectNextStickyScrollLine.title", "Select the next editor sticky scroll line"),
			precondition: EditorContextKeys.stickyScrollFocused.isEqualTo(!0),
			keybinding: {
				weight,
				primary: 18
			}
		});
	}
	runEditorCommand(e, O) {
		StickyScrollController.get(O)?.focusNext();
	}
}, SelectPreviousStickyScrollLine = class extends EditorAction2 {
	constructor() {
		super({
			id: "editor.action.selectPreviousStickyScrollLine",
			title: localize2("selectPreviousStickyScrollLine.title", "Select the previous sticky scroll line"),
			precondition: EditorContextKeys.stickyScrollFocused.isEqualTo(!0),
			keybinding: {
				weight,
				primary: 16
			}
		});
	}
	runEditorCommand(e, O) {
		StickyScrollController.get(O)?.focusPrevious();
	}
}, GoToStickyScrollLine = class extends EditorAction2 {
	constructor() {
		super({
			id: "editor.action.goToFocusedStickyScrollLine",
			title: localize2("goToFocusedStickyScrollLine.title", "Go to the focused sticky scroll line"),
			precondition: EditorContextKeys.stickyScrollFocused.isEqualTo(!0),
			keybinding: {
				weight,
				primary: 3
			}
		});
	}
	runEditorCommand(e, O) {
		StickyScrollController.get(O)?.goToFocused();
	}
}, SelectEditor = class extends EditorAction2 {
	constructor() {
		super({
			id: "editor.action.selectEditor",
			title: localize2("selectEditor.title", "Select Editor"),
			precondition: EditorContextKeys.stickyScrollFocused.isEqualTo(!0),
			keybinding: {
				weight,
				primary: 9
			}
		});
	}
	runEditorCommand(e, O) {
		StickyScrollController.get(O)?.selectEditor();
	}
};
registerEditorContribution(StickyScrollController.ID, StickyScrollController, 1), registerAction2(ToggleStickyScroll), registerAction2(FocusStickyScroll), registerAction2(SelectPreviousStickyScrollLine), registerAction2(SelectNextStickyScrollLine), registerAction2(GoToStickyScrollLine), registerAction2(SelectEditor);
var __decorate$15 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$15 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, SuggestInlineCompletion = class {
	constructor(e, O, k, A, j, M) {
		this.range = e, this.insertText = O, this.filterText = k, this.additionalTextEdits = A, this.command = j, this.completion = M;
	}
}, InlineCompletionResults = class extends RefCountedDisposable {
	constructor(e, O, k, A, j, M) {
		super(j.disposable), this.model = e, this.line = O, this.word = k, this.completionModel = A, this._suggestMemoryService = M;
	}
	canBeReused(e, O, k) {
		return this.model === e && this.line === O && this.word.word.length > 0 && this.word.startColumn === k.startColumn && this.word.endColumn < k.endColumn && this.completionModel.getIncompleteProvider().size === 0;
	}
	get items() {
		let e = [], { items: O } = this.completionModel, k = this._suggestMemoryService.select(this.model, {
			lineNumber: this.line,
			column: this.word.endColumn + this.completionModel.lineContext.characterCountDelta
		}, O), A = Iterable.slice(O, k), j = Iterable.slice(O, 0, k), M = 5;
		for (let O of Iterable.concat(A, j)) {
			if (O.score === FuzzyScore.Default) continue;
			let k = new Range(O.editStart.lineNumber, O.editStart.column, O.editInsertEnd.lineNumber, O.editInsertEnd.column + this.completionModel.lineContext.characterCountDelta), A = O.completion.insertTextRules && O.completion.insertTextRules & 4 ? { snippet: O.completion.insertText } : O.completion.insertText;
			e.push(new SuggestInlineCompletion(k, A, O.filterTextLow ?? O.labelLow, O.completion.additionalTextEdits, O.completion.command, O)), M-- >= 0 && O.resolve(CancellationToken.None);
		}
		return e;
	}
};
InlineCompletionResults = __decorate$15([__param$15(5, ISuggestMemoryService)], InlineCompletionResults);
var SuggestInlineCompletions = class extends Disposable {
	constructor(e, O, k, A) {
		super(), this._languageFeatureService = e, this._clipboardService = O, this._suggestMemoryService = k, this._editorService = A, this._store.add(e.inlineCompletionsProvider.register("*", this));
	}
	async provideInlineCompletions(e, O, k, A) {
		if (k.selectedSuggestionInfo) return;
		let j;
		for (let O of this._editorService.listCodeEditors()) if (O.getModel() === e) {
			j = O;
			break;
		}
		if (!j) return;
		let M = j.getOption(90);
		if (QuickSuggestionsOptions.isAllOff(M)) return;
		e.tokenization.tokenizeIfCheap(O.lineNumber);
		let N = e.tokenization.getLineTokens(O.lineNumber), P = N.getStandardTokenType(N.findTokenIndexAtOffset(Math.max(O.column - 1 - 1, 0)));
		if (QuickSuggestionsOptions.valueFor(M, P) !== "inline") return;
		let F = e.getWordAtPosition(O), I;
		if (F?.word || (I = this._getTriggerCharacterInfo(e, O)), !F?.word && !I || (F ||= e.getWordUntilPosition(O), F.endColumn !== O.column)) return;
		let L, R = e.getValueInRange(new Range(O.lineNumber, 1, O.lineNumber, O.column));
		if (!I && this._lastResult?.canBeReused(e, O.lineNumber, F)) {
			let e = new LineContext(R, O.column - this._lastResult.word.endColumn);
			this._lastResult.completionModel.lineContext = e, this._lastResult.acquire(), L = this._lastResult;
		} else {
			let k = await provideSuggestionItems(this._languageFeatureService.completionProvider, e, O, new CompletionOptions(void 0, SuggestModel.createSuggestFilter(j).itemKind, I?.providers), I && {
				triggerKind: 1,
				triggerCharacter: I.ch
			}, A), M;
			k.needsClipboard && (M = await this._clipboardService.readText());
			let N = new CompletionModel(k.items, O.column, new LineContext(R, 0), WordDistance.None, j.getOption(119), j.getOption(113), {
				boostFullMatch: !1,
				firstMatchCanBeWeak: !1
			}, M);
			L = new InlineCompletionResults(e, O.lineNumber, F, N, k, this._suggestMemoryService);
		}
		return this._lastResult = L, L;
	}
	handleItemDidShow(e, O) {
		O.completion.resolve(CancellationToken.None);
	}
	freeInlineCompletions(e) {
		e.release();
	}
	_getTriggerCharacterInfo(e, O) {
		let k = e.getValueInRange(Range.fromPositions({
			lineNumber: O.lineNumber,
			column: O.column - 1
		}, O)), A = /* @__PURE__ */ new Set();
		for (let O of this._languageFeatureService.completionProvider.all(e)) O.triggerCharacters?.includes(k) && A.add(O);
		if (A.size !== 0) return {
			providers: A,
			ch: k
		};
	}
};
SuggestInlineCompletions = __decorate$15([
	__param$15(0, ILanguageFeaturesService),
	__param$15(1, IClipboardService),
	__param$15(2, ISuggestMemoryService),
	__param$15(3, ICodeEditorService)
], SuggestInlineCompletions), registerEditorFeature(SuggestInlineCompletions), registerEditorAction(class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.forceRetokenize",
			label: localize("forceRetokenize", "Developer: Force Retokenize"),
			alias: "Developer: Force Retokenize",
			precondition: void 0
		});
	}
	run(e, O) {
		if (!O.hasModel()) return;
		let k = O.getModel();
		k.tokenization.resetTokenization();
		let A = new StopWatch();
		k.tokenization.forceTokenization(k.getLineCount()), A.stop(), console.log(`tokenization took ${A.elapsed()}`);
	}
});
var ToggleTabFocusModeAction = class e extends Action2 {
	static {
		this.ID = "editor.action.toggleTabFocusMode";
	}
	constructor() {
		super({
			id: e.ID,
			title: localize2({
				key: "toggle.tabMovesFocus",
				comment: ["Turn on/off use of tab key for moving focus around VS Code"]
			}, "Toggle Tab Key Moves Focus"),
			precondition: void 0,
			keybinding: {
				primary: 2091,
				mac: { primary: 1323 },
				weight: 100
			},
			metadata: { description: localize2("tabMovesFocusDescriptions", "Determines whether the tab key moves focus around the workbench or inserts the tab character in the current editor. This is also called tab trapping, tab navigation, or tab focus mode.") },
			f1: !0
		});
	}
	run() {
		let e = !TabFocus.getTabFocusMode();
		TabFocus.setTabFocusMode(e), alert(e ? localize("toggle.tabMovesFocus.on", "Pressing Tab will now move focus to the next focusable element") : localize("toggle.tabMovesFocus.off", "Pressing Tab will now insert the tab character"));
	}
};
registerAction2(ToggleTabFocusModeAction);
var __decorate$14 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$14 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, Link = class extends Disposable {
	get enabled() {
		return this._enabled;
	}
	set enabled(e) {
		e ? (this.el.setAttribute("aria-disabled", "false"), this.el.tabIndex = 0, this.el.style.pointerEvents = "auto", this.el.style.opacity = "1", this.el.style.cursor = "pointer", this._enabled = !1) : (this.el.setAttribute("aria-disabled", "true"), this.el.tabIndex = -1, this.el.style.pointerEvents = "none", this.el.style.opacity = "0.4", this.el.style.cursor = "default", this._enabled = !0), this._enabled = e;
	}
	constructor(e, O, k = {}, A, j) {
		super(), this._link = O, this._hoverService = A, this._enabled = !0, this.el = append(e, $("a.monaco-link", {
			tabIndex: O.tabIndex ?? 0,
			href: O.href
		}, O.label)), this.hoverDelegate = k.hoverDelegate ?? getDefaultHoverDelegate("mouse"), this.setTooltip(O.title), this.el.setAttribute("role", "button");
		let M = this._register(new DomEmitter(this.el, "click")), N = this._register(new DomEmitter(this.el, "keypress")), P = Event.chain(N.event, (e) => e.map((e) => new StandardKeyboardEvent(e)).filter((e) => e.keyCode === 3)), F = this._register(new DomEmitter(this.el, EventType.Tap)).event;
		this._register(Gesture.addTarget(this.el));
		let I = Event.any(M.event, P, F);
		this._register(I((e) => {
			this.enabled && (EventHelper.stop(e, !0), k?.opener ? k.opener(this._link.href) : j.open(this._link.href, { allowCommands: !0 }));
		})), this.enabled = !0;
	}
	setTooltip(e) {
		this.hoverDelegate.showNativeHover ? this.el.title = e ?? "" : !this.hover && e ? this.hover = this._register(this._hoverService.setupManagedHover(this.hoverDelegate, this.el, e)) : this.hover && this.hover.update(e);
	}
};
Link = __decorate$14([__param$14(3, IHoverService), __param$14(4, IOpenerService)], Link);
var __decorate$13 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$13 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, BANNER_ELEMENT_HEIGHT = 26, BannerController = class extends Disposable {
	constructor(e, O) {
		super(), this._editor = e, this.instantiationService = O, this.banner = this._register(this.instantiationService.createInstance(Banner));
	}
	hide() {
		this._editor.setBanner(null, 0), this.banner.clear();
	}
	show(e) {
		this.banner.show({
			...e,
			onClose: () => {
				this.hide(), e.onClose?.();
			}
		}), this._editor.setBanner(this.banner.element, BANNER_ELEMENT_HEIGHT);
	}
};
BannerController = __decorate$13([__param$13(1, IInstantiationService)], BannerController);
var Banner = class extends Disposable {
	constructor(e) {
		super(), this.instantiationService = e, this.markdownRenderer = this.instantiationService.createInstance(MarkdownRenderer, {}), this.element = $("div.editor-banner"), this.element.tabIndex = 0;
	}
	getAriaLabel(e) {
		if (e.ariaLabel) return e.ariaLabel;
		if (typeof e.message == "string") return e.message;
	}
	getBannerMessage(e) {
		if (typeof e == "string") {
			let O = $("span");
			return O.innerText = e, O;
		}
		return this.markdownRenderer.render(e).element;
	}
	clear() {
		clearNode(this.element);
	}
	show(e) {
		clearNode(this.element);
		let O = this.getAriaLabel(e);
		O && this.element.setAttribute("aria-label", O);
		let k = append(this.element, $("div.icon-container"));
		k.setAttribute("aria-hidden", "true"), e.icon && k.appendChild($(`div${ThemeIcon.asCSSSelector(e.icon)}`));
		let A = append(this.element, $("div.message-container"));
		if (A.setAttribute("aria-hidden", "true"), A.appendChild(this.getBannerMessage(e.message)), this.messageActionsContainer = append(this.element, $("div.message-actions-container")), e.actions) for (let O of e.actions) this._register(this.instantiationService.createInstance(Link, this.messageActionsContainer, {
			...O,
			tabIndex: -1
		}, {}));
		let j = append(this.element, $("div.action-container"));
		this.actionBar = this._register(new ActionBar(j)), this.actionBar.push(this._register(new Action("banner.close", "Close Banner", ThemeIcon.asClassName(widgetClose), !0, () => {
			typeof e.onClose == "function" && e.onClose();
		})), {
			icon: !0,
			label: !1
		}), this.actionBar.setFocusable(!1);
	}
};
Banner = __decorate$13([__param$13(0, IInstantiationService)], Banner);
var __decorate$12 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$12 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
};
const warningIcon = registerIcon("extensions-warning-message", Codicon.warning, localize("warningIcon", "Icon shown with a warning message in the extensions editor."));
var UnicodeHighlighter = class extends Disposable {
	static {
		this.ID = "editor.contrib.unicodeHighlighter";
	}
	constructor(e, O, k, A) {
		super(), this._editor = e, this._editorWorkerService = O, this._workspaceTrustService = k, this._highlighter = null, this._bannerClosed = !1, this._updateState = (e) => {
			if (e && e.hasMore) {
				if (this._bannerClosed) return;
				let O = Math.max(e.ambiguousCharacterCount, e.nonBasicAsciiCharacterCount, e.invisibleCharacterCount), k;
				if (e.nonBasicAsciiCharacterCount >= O) k = {
					message: localize("unicodeHighlighting.thisDocumentHasManyNonBasicAsciiUnicodeCharacters", "This document contains many non-basic ASCII unicode characters"),
					command: new DisableHighlightingOfNonBasicAsciiCharactersAction()
				};
				else if (e.ambiguousCharacterCount >= O) k = {
					message: localize("unicodeHighlighting.thisDocumentHasManyAmbiguousUnicodeCharacters", "This document contains many ambiguous unicode characters"),
					command: new DisableHighlightingOfAmbiguousCharactersAction()
				};
				else if (e.invisibleCharacterCount >= O) k = {
					message: localize("unicodeHighlighting.thisDocumentHasManyInvisibleUnicodeCharacters", "This document contains many invisible unicode characters"),
					command: new DisableHighlightingOfInvisibleCharactersAction()
				};
				else throw Error("Unreachable");
				this._bannerController.show({
					id: "unicodeHighlightBanner",
					message: k.message,
					icon: warningIcon,
					actions: [{
						label: k.command.shortLabel,
						href: `command:${k.command.id}`
					}],
					onClose: () => {
						this._bannerClosed = !0;
					}
				});
			} else this._bannerController.hide();
		}, this._bannerController = this._register(A.createInstance(BannerController, e)), this._register(this._editor.onDidChangeModel(() => {
			this._bannerClosed = !1, this._updateHighlighter();
		})), this._options = e.getOption(126), this._register(k.onDidChangeTrust((e) => {
			this._updateHighlighter();
		})), this._register(e.onDidChangeConfiguration((O) => {
			O.hasChanged(126) && (this._options = e.getOption(126), this._updateHighlighter());
		})), this._updateHighlighter();
	}
	dispose() {
		this._highlighter &&= (this._highlighter.dispose(), null), super.dispose();
	}
	_updateHighlighter() {
		if (this._updateState(null), this._highlighter &&= (this._highlighter.dispose(), null), !this._editor.hasModel()) return;
		let e = resolveOptions(this._workspaceTrustService.isWorkspaceTrusted(), this._options);
		if ([
			e.nonBasicASCII,
			e.ambiguousCharacters,
			e.invisibleCharacters
		].every((e) => e === !1)) return;
		let O = {
			nonBasicASCII: e.nonBasicASCII,
			ambiguousCharacters: e.ambiguousCharacters,
			invisibleCharacters: e.invisibleCharacters,
			includeComments: e.includeComments,
			includeStrings: e.includeStrings,
			allowedCodePoints: Object.keys(e.allowedCharacters).map((e) => e.codePointAt(0)),
			allowedLocales: Object.keys(e.allowedLocales).map((e) => e === "_os" ? new Intl.NumberFormat().resolvedOptions().locale : e === "_vscode" ? language : e)
		};
		this._editorWorkerService.canComputeUnicodeHighlights(this._editor.getModel().uri) ? this._highlighter = new DocumentUnicodeHighlighter(this._editor, O, this._updateState, this._editorWorkerService) : this._highlighter = new ViewportUnicodeHighlighter(this._editor, O, this._updateState);
	}
	getDecorationInfo(e) {
		return this._highlighter ? this._highlighter.getDecorationInfo(e) : null;
	}
};
UnicodeHighlighter = __decorate$12([
	__param$12(1, IEditorWorkerService),
	__param$12(2, IWorkspaceTrustManagementService),
	__param$12(3, IInstantiationService)
], UnicodeHighlighter);
function resolveOptions(e, O) {
	return {
		nonBasicASCII: O.nonBasicASCII === "inUntrustedWorkspace" ? !e : O.nonBasicASCII,
		ambiguousCharacters: O.ambiguousCharacters,
		invisibleCharacters: O.invisibleCharacters,
		includeComments: O.includeComments === "inUntrustedWorkspace" ? !e : O.includeComments,
		includeStrings: O.includeStrings === "inUntrustedWorkspace" ? !e : O.includeStrings,
		allowedCharacters: O.allowedCharacters,
		allowedLocales: O.allowedLocales
	};
}
var DocumentUnicodeHighlighter = class extends Disposable {
	constructor(e, O, k, A) {
		super(), this._editor = e, this._options = O, this._updateState = k, this._editorWorkerService = A, this._model = this._editor.getModel(), this._decorations = this._editor.createDecorationsCollection(), this._updateSoon = this._register(new RunOnceScheduler(() => this._update(), 250)), this._register(this._editor.onDidChangeModelContent(() => {
			this._updateSoon.schedule();
		})), this._updateSoon.schedule();
	}
	dispose() {
		this._decorations.clear(), super.dispose();
	}
	_update() {
		if (this._model.isDisposed()) return;
		if (!this._model.mightContainNonBasicASCII()) {
			this._decorations.clear();
			return;
		}
		let e = this._model.getVersionId();
		this._editorWorkerService.computedUnicodeHighlights(this._model.uri, this._options).then((O) => {
			if (this._model.isDisposed() || this._model.getVersionId() !== e) return;
			this._updateState(O);
			let k = [];
			if (!O.hasMore) for (let e of O.ranges) k.push({
				range: e,
				options: Decorations.instance.getDecorationFromOptions(this._options)
			});
			this._decorations.set(k);
		});
	}
	getDecorationInfo(e) {
		if (!this._decorations.has(e)) return null;
		let O = this._editor.getModel();
		if (!isModelDecorationVisible(O, e)) return null;
		let k = O.getValueInRange(e.range);
		return {
			reason: computeReason(k, this._options),
			inComment: isModelDecorationInComment(O, e),
			inString: isModelDecorationInString(O, e)
		};
	}
};
DocumentUnicodeHighlighter = __decorate$12([__param$12(3, IEditorWorkerService)], DocumentUnicodeHighlighter);
var ViewportUnicodeHighlighter = class extends Disposable {
	constructor(e, O, k) {
		super(), this._editor = e, this._options = O, this._updateState = k, this._model = this._editor.getModel(), this._decorations = this._editor.createDecorationsCollection(), this._updateSoon = this._register(new RunOnceScheduler(() => this._update(), 250)), this._register(this._editor.onDidLayoutChange(() => {
			this._updateSoon.schedule();
		})), this._register(this._editor.onDidScrollChange(() => {
			this._updateSoon.schedule();
		})), this._register(this._editor.onDidChangeHiddenAreas(() => {
			this._updateSoon.schedule();
		})), this._register(this._editor.onDidChangeModelContent(() => {
			this._updateSoon.schedule();
		})), this._updateSoon.schedule();
	}
	dispose() {
		this._decorations.clear(), super.dispose();
	}
	_update() {
		if (this._model.isDisposed()) return;
		if (!this._model.mightContainNonBasicASCII()) {
			this._decorations.clear();
			return;
		}
		let e = this._editor.getVisibleRanges(), O = [], k = {
			ranges: [],
			ambiguousCharacterCount: 0,
			invisibleCharacterCount: 0,
			nonBasicAsciiCharacterCount: 0,
			hasMore: !1
		};
		for (let O of e) {
			let e = UnicodeTextModelHighlighter.computeUnicodeHighlights(this._model, this._options, O);
			for (let O of e.ranges) k.ranges.push(O);
			k.ambiguousCharacterCount += k.ambiguousCharacterCount, k.invisibleCharacterCount += k.invisibleCharacterCount, k.nonBasicAsciiCharacterCount += k.nonBasicAsciiCharacterCount, k.hasMore = k.hasMore || e.hasMore;
		}
		if (!k.hasMore) for (let e of k.ranges) O.push({
			range: e,
			options: Decorations.instance.getDecorationFromOptions(this._options)
		});
		this._updateState(k), this._decorations.set(O);
	}
	getDecorationInfo(e) {
		if (!this._decorations.has(e)) return null;
		let O = this._editor.getModel(), k = O.getValueInRange(e.range);
		return isModelDecorationVisible(O, e) ? {
			reason: computeReason(k, this._options),
			inComment: isModelDecorationInComment(O, e),
			inString: isModelDecorationInString(O, e)
		} : null;
	}
}, configureUnicodeHighlightOptionsStr = localize("unicodeHighlight.configureUnicodeHighlightOptions", "Configure Unicode Highlight Options"), UnicodeHighlighterHoverParticipant = class {
	constructor(e, O, k) {
		this._editor = e, this._languageService = O, this._openerService = k, this.hoverOrdinal = 5;
	}
	computeSync(e, O) {
		if (!this._editor.hasModel() || e.type !== 1) return [];
		let k = this._editor.getModel(), A = this._editor.getContribution(UnicodeHighlighter.ID);
		if (!A) return [];
		let j = [], M = /* @__PURE__ */ new Set(), N = 300;
		for (let e of O) {
			let O = A.getDecorationInfo(e);
			if (!O) continue;
			let P = k.getValueInRange(e.range).codePointAt(0), F = formatCodePointMarkdown(P), I;
			switch (O.reason.kind) {
				case 0:
					I = isBasicASCII(O.reason.confusableWith) ? localize("unicodeHighlight.characterIsAmbiguousASCII", "The character {0} could be confused with the ASCII character {1}, which is more common in source code.", F, formatCodePointMarkdown(O.reason.confusableWith.codePointAt(0))) : localize("unicodeHighlight.characterIsAmbiguous", "The character {0} could be confused with the character {1}, which is more common in source code.", F, formatCodePointMarkdown(O.reason.confusableWith.codePointAt(0)));
					break;
				case 1:
					I = localize("unicodeHighlight.characterIsInvisible", "The character {0} is invisible.", F);
					break;
				case 2:
					I = localize("unicodeHighlight.characterIsNonBasicAscii", "The character {0} is not a basic ASCII character.", F);
					break;
			}
			if (M.has(I)) continue;
			M.add(I);
			let L = {
				codePoint: P,
				reason: O.reason,
				inComment: O.inComment,
				inString: O.inString
			}, R = localize("unicodeHighlight.adjustSettings", "Adjust settings"), z = `command:${ShowExcludeOptions.ID}?${encodeURIComponent(JSON.stringify(L))}`, B = new MarkdownString("", !0).appendMarkdown(I).appendText(" ").appendLink(z, R, configureUnicodeHighlightOptionsStr);
			j.push(new MarkdownHover(this, e.range, [B], !1, N++));
		}
		return j;
	}
	renderHoverParts(e, O) {
		return renderMarkdownHovers(e, O, this._editor, this._languageService, this._openerService);
	}
};
UnicodeHighlighterHoverParticipant = __decorate$12([__param$12(1, ILanguageService), __param$12(2, IOpenerService)], UnicodeHighlighterHoverParticipant);
function codePointToHex(e) {
	return `U+${e.toString(16).padStart(4, "0")}`;
}
function formatCodePointMarkdown(e) {
	let O = `\`${codePointToHex(e)}\``;
	return InvisibleCharacters.isInvisibleCharacter(e) || (O += ` "${`${renderCodePointAsInlineCode(e)}`}"`), O;
}
function renderCodePointAsInlineCode(e) {
	return e === 96 ? "`` ` ``" : "`" + String.fromCodePoint(e) + "`";
}
function computeReason(e, O) {
	return UnicodeTextModelHighlighter.computeUnicodeHighlightReason(e, O);
}
var Decorations = class e {
	constructor() {
		this.map = /* @__PURE__ */ new Map();
	}
	static {
		this.instance = new e();
	}
	getDecorationFromOptions(e) {
		return this.getDecoration(!e.includeComments, !e.includeStrings);
	}
	getDecoration(e, O) {
		let k = `${e}${O}`, A = this.map.get(k);
		return A || (A = ModelDecorationOptions.createDynamic({
			description: "unicode-highlight",
			stickiness: 1,
			className: "unicode-highlight",
			showIfCollapsed: !0,
			overviewRuler: null,
			minimap: null,
			hideInCommentTokens: e,
			hideInStringTokens: O
		}), this.map.set(k, A)), A;
	}
}, DisableHighlightingInCommentsAction = class extends EditorAction {
	constructor() {
		super({
			id: DisableHighlightingOfAmbiguousCharactersAction.ID,
			label: localize("action.unicodeHighlight.disableHighlightingInComments", "Disable highlighting of characters in comments"),
			alias: "Disable highlighting of characters in comments",
			precondition: void 0
		}), this.shortLabel = localize("unicodeHighlight.disableHighlightingInComments.shortLabel", "Disable Highlight In Comments");
	}
	async run(e, O, k) {
		let A = e?.get(IConfigurationService);
		A && this.runAction(A);
	}
	async runAction(e) {
		await e.updateValue(unicodeHighlightConfigKeys.includeComments, !1, 2);
	}
}, DisableHighlightingInStringsAction = class extends EditorAction {
	constructor() {
		super({
			id: DisableHighlightingOfAmbiguousCharactersAction.ID,
			label: localize("action.unicodeHighlight.disableHighlightingInStrings", "Disable highlighting of characters in strings"),
			alias: "Disable highlighting of characters in strings",
			precondition: void 0
		}), this.shortLabel = localize("unicodeHighlight.disableHighlightingInStrings.shortLabel", "Disable Highlight In Strings");
	}
	async run(e, O, k) {
		let A = e?.get(IConfigurationService);
		A && this.runAction(A);
	}
	async runAction(e) {
		await e.updateValue(unicodeHighlightConfigKeys.includeStrings, !1, 2);
	}
}, DisableHighlightingOfAmbiguousCharactersAction = class e extends EditorAction {
	static {
		this.ID = "editor.action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters";
	}
	constructor() {
		super({
			id: e.ID,
			label: localize("action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters", "Disable highlighting of ambiguous characters"),
			alias: "Disable highlighting of ambiguous characters",
			precondition: void 0
		}), this.shortLabel = localize("unicodeHighlight.disableHighlightingOfAmbiguousCharacters.shortLabel", "Disable Ambiguous Highlight");
	}
	async run(e, O, k) {
		let A = e?.get(IConfigurationService);
		A && this.runAction(A);
	}
	async runAction(e) {
		await e.updateValue(unicodeHighlightConfigKeys.ambiguousCharacters, !1, 2);
	}
}, DisableHighlightingOfInvisibleCharactersAction = class e extends EditorAction {
	static {
		this.ID = "editor.action.unicodeHighlight.disableHighlightingOfInvisibleCharacters";
	}
	constructor() {
		super({
			id: e.ID,
			label: localize("action.unicodeHighlight.disableHighlightingOfInvisibleCharacters", "Disable highlighting of invisible characters"),
			alias: "Disable highlighting of invisible characters",
			precondition: void 0
		}), this.shortLabel = localize("unicodeHighlight.disableHighlightingOfInvisibleCharacters.shortLabel", "Disable Invisible Highlight");
	}
	async run(e, O, k) {
		let A = e?.get(IConfigurationService);
		A && this.runAction(A);
	}
	async runAction(e) {
		await e.updateValue(unicodeHighlightConfigKeys.invisibleCharacters, !1, 2);
	}
}, DisableHighlightingOfNonBasicAsciiCharactersAction = class e extends EditorAction {
	static {
		this.ID = "editor.action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters";
	}
	constructor() {
		super({
			id: e.ID,
			label: localize("action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters", "Disable highlighting of non basic ASCII characters"),
			alias: "Disable highlighting of non basic ASCII characters",
			precondition: void 0
		}), this.shortLabel = localize("unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters.shortLabel", "Disable Non ASCII Highlight");
	}
	async run(e, O, k) {
		let A = e?.get(IConfigurationService);
		A && this.runAction(A);
	}
	async runAction(e) {
		await e.updateValue(unicodeHighlightConfigKeys.nonBasicASCII, !1, 2);
	}
}, ShowExcludeOptions = class e extends EditorAction {
	static {
		this.ID = "editor.action.unicodeHighlight.showExcludeOptions";
	}
	constructor() {
		super({
			id: e.ID,
			label: localize("action.unicodeHighlight.showExcludeOptions", "Show Exclude Options"),
			alias: "Show Exclude Options",
			precondition: void 0
		});
	}
	async run(e, O, k) {
		let { codePoint: A, reason: j, inString: M, inComment: N } = k, P = String.fromCodePoint(A), F = e.get(IQuickInputService), I = e.get(IConfigurationService);
		function L(e) {
			return InvisibleCharacters.isInvisibleCharacter(e) ? localize("unicodeHighlight.excludeInvisibleCharFromBeingHighlighted", "Exclude {0} (invisible character) from being highlighted", codePointToHex(e)) : localize("unicodeHighlight.excludeCharFromBeingHighlighted", "Exclude {0} from being highlighted", `${codePointToHex(e)} "${P}"`);
		}
		let R = [];
		if (j.kind === 0) for (let e of j.notAmbiguousInLocales) R.push({
			label: localize("unicodeHighlight.allowCommonCharactersInLanguage", "Allow unicode characters that are more common in the language \"{0}\".", e),
			run: async () => {
				excludeLocaleFromBeingHighlighted(I, [e]);
			}
		});
		if (R.push({
			label: L(A),
			run: () => excludeCharFromBeingHighlighted(I, [A])
		}), N) {
			let e = new DisableHighlightingInCommentsAction();
			R.push({
				label: e.label,
				run: async () => e.runAction(I)
			});
		} else if (M) {
			let e = new DisableHighlightingInStringsAction();
			R.push({
				label: e.label,
				run: async () => e.runAction(I)
			});
		}
		if (j.kind === 0) {
			let e = new DisableHighlightingOfAmbiguousCharactersAction();
			R.push({
				label: e.label,
				run: async () => e.runAction(I)
			});
		} else if (j.kind === 1) {
			let e = new DisableHighlightingOfInvisibleCharactersAction();
			R.push({
				label: e.label,
				run: async () => e.runAction(I)
			});
		} else if (j.kind === 2) {
			let e = new DisableHighlightingOfNonBasicAsciiCharactersAction();
			R.push({
				label: e.label,
				run: async () => e.runAction(I)
			});
		} else expectNever(j);
		let z = await F.pick(R, { title: configureUnicodeHighlightOptionsStr });
		z && await z.run();
	}
};
async function excludeCharFromBeingHighlighted(e, O) {
	let k = e.getValue(unicodeHighlightConfigKeys.allowedCharacters), A;
	A = typeof k == "object" && k ? k : {};
	for (let e of O) A[String.fromCodePoint(e)] = !0;
	await e.updateValue(unicodeHighlightConfigKeys.allowedCharacters, A, 2);
}
async function excludeLocaleFromBeingHighlighted(e, O) {
	let k = e.inspect(unicodeHighlightConfigKeys.allowedLocales).user?.value, A;
	A = typeof k == "object" && k ? Object.assign({}, k) : {};
	for (let e of O) A[e] = !0;
	await e.updateValue(unicodeHighlightConfigKeys.allowedLocales, A, 2);
}
function expectNever(e) {
	throw Error(`Unexpected value: ${e}`);
}
registerEditorAction(DisableHighlightingOfAmbiguousCharactersAction), registerEditorAction(DisableHighlightingOfInvisibleCharactersAction), registerEditorAction(DisableHighlightingOfNonBasicAsciiCharactersAction), registerEditorAction(ShowExcludeOptions), registerEditorContribution(UnicodeHighlighter.ID, UnicodeHighlighter, 1), HoverParticipantRegistry.register(UnicodeHighlighterHoverParticipant);
var __decorate$11 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$11 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, ignoreUnusualLineTerminators = "ignoreUnusualLineTerminators";
function writeIgnoreState(e, O, k) {
	e.setModelProperty(O.uri, ignoreUnusualLineTerminators, k);
}
function readIgnoreState(e, O) {
	return e.getModelProperty(O.uri, ignoreUnusualLineTerminators);
}
var UnusualLineTerminatorsDetector = class extends Disposable {
	static {
		this.ID = "editor.contrib.unusualLineTerminatorsDetector";
	}
	constructor(e, O, k) {
		super(), this._editor = e, this._dialogService = O, this._codeEditorService = k, this._isPresentingDialog = !1, this._config = this._editor.getOption(127), this._register(this._editor.onDidChangeConfiguration((e) => {
			e.hasChanged(127) && (this._config = this._editor.getOption(127), this._checkForUnusualLineTerminators());
		})), this._register(this._editor.onDidChangeModel(() => {
			this._checkForUnusualLineTerminators();
		})), this._register(this._editor.onDidChangeModelContent((e) => {
			e.isUndoing || this._checkForUnusualLineTerminators();
		})), this._checkForUnusualLineTerminators();
	}
	async _checkForUnusualLineTerminators() {
		if (this._config === "off" || !this._editor.hasModel()) return;
		let e = this._editor.getModel();
		if (!e.mightContainUnusualLineTerminators() || readIgnoreState(this._codeEditorService, e) === !0 || this._editor.getOption(92)) return;
		if (this._config === "auto") {
			e.removeUnusualLineTerminators(this._editor.getSelections());
			return;
		}
		if (this._isPresentingDialog) return;
		let O;
		try {
			this._isPresentingDialog = !0, O = await this._dialogService.confirm({
				title: localize("unusualLineTerminators.title", "Unusual Line Terminators"),
				message: localize("unusualLineTerminators.message", "Detected unusual line terminators"),
				detail: localize("unusualLineTerminators.detail", "The file '{0}' contains one or more unusual line terminator characters, like Line Separator (LS) or Paragraph Separator (PS).\n\nIt is recommended to remove them from the file. This can be configured via `editor.unusualLineTerminators`.", basename(e.uri)),
				primaryButton: localize({
					key: "unusualLineTerminators.fix",
					comment: ["&& denotes a mnemonic"]
				}, "&&Remove Unusual Line Terminators"),
				cancelButton: localize("unusualLineTerminators.ignore", "Ignore")
			});
		} finally {
			this._isPresentingDialog = !1;
		}
		if (!O.confirmed) {
			writeIgnoreState(this._codeEditorService, e, !0);
			return;
		}
		e.removeUnusualLineTerminators(this._editor.getSelections());
	}
};
UnusualLineTerminatorsDetector = __decorate$11([__param$11(1, IDialogService), __param$11(2, ICodeEditorService)], UnusualLineTerminatorsDetector), registerEditorContribution(UnusualLineTerminatorsDetector.ID, UnusualLineTerminatorsDetector, 1);
var __decorate$10 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$10 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, TextualDocumentHighlightProvider = class {
	constructor() {
		this.selector = { language: "*" };
	}
	provideDocumentHighlights(e, O, k) {
		let A = [], j = e.getWordAtPosition({
			lineNumber: O.lineNumber,
			column: O.column
		});
		if (!j) return Promise.resolve(A);
		if (!e.isDisposed()) return e.findMatches(j.word, !0, !1, !0, USUAL_WORD_SEPARATORS, !1).map((e) => ({
			range: e.range,
			kind: DocumentHighlightKind.Text
		}));
	}
	provideMultiDocumentHighlights(e, O, k, A) {
		let j = new ResourceMap(), M = e.getWordAtPosition({
			lineNumber: O.lineNumber,
			column: O.column
		});
		if (!M) return Promise.resolve(j);
		for (let O of [e, ...k]) {
			if (O.isDisposed()) continue;
			let e = O.findMatches(M.word, !0, !1, !0, USUAL_WORD_SEPARATORS, !1).map((e) => ({
				range: e.range,
				kind: DocumentHighlightKind.Text
			}));
			e && j.set(O.uri, e);
		}
		return j;
	}
}, TextualMultiDocumentHighlightFeature = class extends Disposable {
	constructor(e) {
		super(), this._register(e.documentHighlightProvider.register("*", new TextualDocumentHighlightProvider())), this._register(e.multiDocumentHighlightProvider.register("*", new TextualDocumentHighlightProvider()));
	}
};
TextualMultiDocumentHighlightFeature = __decorate$10([__param$10(0, ILanguageFeaturesService)], TextualMultiDocumentHighlightFeature);
var __decorate$9 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$9 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, WordHighlighter_1, WordHighlighterContribution_1, ctxHasWordHighlights = new RawContextKey("hasWordHighlights", !1);
function getOccurrencesAtPosition(e, O, k, A) {
	let j = e.ordered(O);
	return first(j.map((e) => () => Promise.resolve(e.provideDocumentHighlights(O, k, A)).then(void 0, onUnexpectedExternalError)), (e) => e != null).then((e) => {
		if (e) {
			let k = new ResourceMap();
			return k.set(O.uri, e), k;
		}
		return new ResourceMap();
	});
}
function getOccurrencesAcrossMultipleModels(e, O, k, A, j, M) {
	let N = e.ordered(O);
	return first(N.map((e) => () => {
		let A = M.filter((e) => shouldSynchronizeModel(e)).filter((O) => score(e.selector, O.uri, O.getLanguageId(), !0, void 0, void 0) > 0);
		return Promise.resolve(e.provideMultiDocumentHighlights(O, k, A, j)).then(void 0, onUnexpectedExternalError);
	}), (e) => e != null);
}
var OccurenceAtPositionRequest = class {
	constructor(e, O, k) {
		this._model = e, this._selection = O, this._wordSeparators = k, this._wordRange = this._getCurrentWordRange(e, O), this._result = null;
	}
	get result() {
		return this._result ||= createCancelablePromise((e) => this._compute(this._model, this._selection, this._wordSeparators, e)), this._result;
	}
	_getCurrentWordRange(e, O) {
		let k = e.getWordAtPosition(O.getPosition());
		return k ? new Range(O.startLineNumber, k.startColumn, O.startLineNumber, k.endColumn) : null;
	}
	isValid(e, O, k) {
		let A = O.startLineNumber, j = O.startColumn, M = O.endColumn, N = this._getCurrentWordRange(e, O), P = !!(this._wordRange && this._wordRange.equalsRange(N));
		for (let e = 0, O = k.length; !P && e < O; e++) {
			let O = k.getRange(e);
			O && O.startLineNumber === A && O.startColumn <= j && O.endColumn >= M && (P = !0);
		}
		return P;
	}
	cancel() {
		this.result.cancel();
	}
}, SemanticOccurenceAtPositionRequest = class extends OccurenceAtPositionRequest {
	constructor(e, O, k, A) {
		super(e, O, k), this._providers = A;
	}
	_compute(e, O, k, A) {
		return getOccurrencesAtPosition(this._providers, e, O.getPosition(), A).then((e) => e || new ResourceMap());
	}
}, MultiModelOccurenceRequest = class extends OccurenceAtPositionRequest {
	constructor(e, O, k, A, j) {
		super(e, O, k), this._providers = A, this._otherModels = j;
	}
	_compute(e, O, k, A) {
		return getOccurrencesAcrossMultipleModels(this._providers, e, O.getPosition(), k, A, this._otherModels).then((e) => e || new ResourceMap());
	}
};
function computeOccurencesAtPosition(e, O, k, A, j) {
	return new SemanticOccurenceAtPositionRequest(O, k, j, e);
}
function computeOccurencesMultiModel(e, O, k, A, j, M) {
	return new MultiModelOccurenceRequest(O, k, j, e, M);
}
registerModelAndPositionCommand("_executeDocumentHighlights", async (e, O, k) => {
	let A = e.get(ILanguageFeaturesService);
	return (await getOccurrencesAtPosition(A.documentHighlightProvider, O, k, CancellationToken.None))?.get(O.uri);
});
var WordHighlighter = class {
	static {
		WordHighlighter_1 = this;
	}
	static {
		this.storedDecorationIDs = new ResourceMap();
	}
	static {
		this.query = null;
	}
	constructor(e, O, k, A, j) {
		this.toUnhook = new DisposableStore(), this.workerRequestTokenId = 0, this.workerRequestCompleted = !1, this.workerRequestValue = new ResourceMap(), this.lastCursorPositionChangeTime = 0, this.renderDecorationsTimer = -1, this.runDelayer = this.toUnhook.add(new Delayer(50)), this.editor = e, this.providers = O, this.multiDocumentProviders = k, this.codeEditorService = j, this._hasWordHighlights = ctxHasWordHighlights.bindTo(A), this._ignorePositionChangeEvent = !1, this.occurrencesHighlight = this.editor.getOption(81), this.model = this.editor.getModel(), this.toUnhook.add(e.onDidChangeCursorPosition((e) => {
			this._ignorePositionChangeEvent || this.occurrencesHighlight !== "off" && this.runDelayer.trigger(() => {
				this._onPositionChanged(e);
			});
		})), this.toUnhook.add(e.onDidFocusEditorText((e) => {
			this.occurrencesHighlight !== "off" && (this.workerRequest || this.runDelayer.trigger(() => {
				this._run();
			}));
		})), this.toUnhook.add(e.onDidChangeModelContent((e) => {
			matchesScheme(this.model.uri, "output") || this._stopAll();
		})), this.toUnhook.add(e.onDidChangeModel((e) => {
			!e.newModelUrl && e.oldModelUrl ? this._stopSingular() : WordHighlighter_1.query && this._run();
		})), this.toUnhook.add(e.onDidChangeConfiguration((e) => {
			let O = this.editor.getOption(81);
			if (this.occurrencesHighlight !== O) switch (this.occurrencesHighlight = O, O) {
				case "off":
					this._stopAll();
					break;
				case "singleFile":
					this._stopAll(WordHighlighter_1.query?.modelInfo?.model);
					break;
				case "multiFile":
					WordHighlighter_1.query && this._run(!0);
					break;
				default:
					console.warn("Unknown occurrencesHighlight setting value:", O);
					break;
			}
		})), this.decorations = this.editor.createDecorationsCollection(), this.workerRequestTokenId = 0, this.workerRequest = null, this.workerRequestCompleted = !1, this.lastCursorPositionChangeTime = 0, this.renderDecorationsTimer = -1, WordHighlighter_1.query && this._run();
	}
	hasDecorations() {
		return this.decorations.length > 0;
	}
	restore() {
		this.occurrencesHighlight !== "off" && (this.runDelayer.cancel(), this._run());
	}
	_getSortedHighlights() {
		return this.decorations.getRanges().sort(Range.compareRangesUsingStarts);
	}
	moveNext() {
		let e = this._getSortedHighlights(), O = (e.findIndex((e) => e.containsPosition(this.editor.getPosition())) + 1) % e.length, k = e[O];
		try {
			this._ignorePositionChangeEvent = !0, this.editor.setPosition(k.getStartPosition()), this.editor.revealRangeInCenterIfOutsideViewport(k);
			let A = this._getWord();
			if (A) {
				let j = this.editor.getModel().getLineContent(k.startLineNumber);
				alert(`${j}, ${O + 1} of ${e.length} for '${A.word}'`);
			}
		} finally {
			this._ignorePositionChangeEvent = !1;
		}
	}
	moveBack() {
		let e = this._getSortedHighlights(), O = (e.findIndex((e) => e.containsPosition(this.editor.getPosition())) - 1 + e.length) % e.length, k = e[O];
		try {
			this._ignorePositionChangeEvent = !0, this.editor.setPosition(k.getStartPosition()), this.editor.revealRangeInCenterIfOutsideViewport(k);
			let A = this._getWord();
			if (A) {
				let j = this.editor.getModel().getLineContent(k.startLineNumber);
				alert(`${j}, ${O + 1} of ${e.length} for '${A.word}'`);
			}
		} finally {
			this._ignorePositionChangeEvent = !1;
		}
	}
	_removeSingleDecorations() {
		if (!this.editor.hasModel()) return;
		let e = WordHighlighter_1.storedDecorationIDs.get(this.editor.getModel().uri);
		e && (this.editor.removeDecorations(e), WordHighlighter_1.storedDecorationIDs.delete(this.editor.getModel().uri), this.decorations.length > 0 && (this.decorations.clear(), this._hasWordHighlights.set(!1)));
	}
	_removeAllDecorations(e) {
		let O = this.codeEditorService.listCodeEditors(), k = [];
		for (let A of O) {
			if (!A.hasModel() || isEqual(A.getModel().uri, e?.uri)) continue;
			let O = WordHighlighter_1.storedDecorationIDs.get(A.getModel().uri);
			if (!O) continue;
			A.removeDecorations(O), k.push(A.getModel().uri);
			let j = WordHighlighterContribution.get(A);
			j?.wordHighlighter && j.wordHighlighter.decorations.length > 0 && (j.wordHighlighter.decorations.clear(), j.wordHighlighter.workerRequest = null, j.wordHighlighter._hasWordHighlights.set(!1));
		}
		for (let e of k) WordHighlighter_1.storedDecorationIDs.delete(e);
	}
	_stopSingular() {
		this._removeSingleDecorations(), this.editor.hasTextFocus() && (this.editor.getModel()?.uri.scheme !== Schemas.vscodeNotebookCell && WordHighlighter_1.query?.modelInfo?.model.uri.scheme !== Schemas.vscodeNotebookCell ? (WordHighlighter_1.query = null, this._run()) : WordHighlighter_1.query?.modelInfo && (WordHighlighter_1.query.modelInfo = null)), this.renderDecorationsTimer !== -1 && (clearTimeout(this.renderDecorationsTimer), this.renderDecorationsTimer = -1), this.workerRequest !== null && (this.workerRequest.cancel(), this.workerRequest = null), this.workerRequestCompleted ||= (this.workerRequestTokenId++, !0);
	}
	_stopAll(e) {
		this._removeAllDecorations(e), this.renderDecorationsTimer !== -1 && (clearTimeout(this.renderDecorationsTimer), this.renderDecorationsTimer = -1), this.workerRequest !== null && (this.workerRequest.cancel(), this.workerRequest = null), this.workerRequestCompleted ||= (this.workerRequestTokenId++, !0);
	}
	_onPositionChanged(e) {
		if (this.occurrencesHighlight === "off") {
			this._stopAll();
			return;
		}
		if (e.reason !== 3 && this.editor.getModel()?.uri.scheme !== Schemas.vscodeNotebookCell) {
			this._stopAll();
			return;
		}
		this._run();
	}
	_getWord() {
		let e = this.editor.getSelection(), O = e.startLineNumber, k = e.startColumn;
		return this.model.isDisposed() ? null : this.model.getWordAtPosition({
			lineNumber: O,
			column: k
		});
	}
	getOtherModelsToHighlight(e) {
		if (!e) return [];
		if (e.uri.scheme === Schemas.vscodeNotebookCell) {
			let O = [], k = this.codeEditorService.listCodeEditors();
			for (let A of k) {
				let k = A.getModel();
				k && k !== e && k.uri.scheme === Schemas.vscodeNotebookCell && O.push(k);
			}
			return O;
		}
		let O = [], k = this.codeEditorService.listCodeEditors();
		for (let A of k) {
			if (!isDiffEditor(A)) continue;
			let k = A.getModel();
			k && e === k.modified && O.push(k.modified);
		}
		if (O.length) return O;
		if (this.occurrencesHighlight === "singleFile") return [];
		for (let A of k) {
			let k = A.getModel();
			k && k !== e && O.push(k);
		}
		return O;
	}
	_run(e) {
		let O;
		if (this.editor.hasTextFocus()) {
			let e = this.editor.getSelection();
			if (!e || e.startLineNumber !== e.endLineNumber) {
				WordHighlighter_1.query = null, this._stopAll();
				return;
			}
			let k = e.startColumn, A = e.endColumn, j = this._getWord();
			if (!j || j.startColumn > k || j.endColumn < A) {
				WordHighlighter_1.query = null, this._stopAll();
				return;
			}
			O = this.workerRequest && this.workerRequest.isValid(this.model, e, this.decorations), WordHighlighter_1.query = {
				modelInfo: {
					model: this.model,
					selection: e
				},
				word: j
			};
		} else if (!WordHighlighter_1.query) {
			this._stopAll();
			return;
		}
		if (this.lastCursorPositionChangeTime = (/* @__PURE__ */ new Date()).getTime(), O) this.workerRequestCompleted && this.renderDecorationsTimer !== -1 && (clearTimeout(this.renderDecorationsTimer), this.renderDecorationsTimer = -1, this._beginRenderDecorations());
		else if (isEqual(this.editor.getModel().uri, WordHighlighter_1.query.modelInfo?.model.uri)) {
			if (!e) {
				let e = this.decorations.getRanges();
				for (let O of e) if (O.containsPosition(this.editor.getPosition())) return;
			}
			this._stopAll(e ? this.model : void 0);
			let O = ++this.workerRequestTokenId;
			this.workerRequestCompleted = !1;
			let k = this.getOtherModelsToHighlight(this.editor.getModel());
			if (!WordHighlighter_1.query || !WordHighlighter_1.query.modelInfo || WordHighlighter_1.query.modelInfo.model.isDisposed()) return;
			this.workerRequest = this.computeWithModel(WordHighlighter_1.query.modelInfo.model, WordHighlighter_1.query.modelInfo.selection, WordHighlighter_1.query.word, k), this.workerRequest?.result.then((e) => {
				O === this.workerRequestTokenId && (this.workerRequestCompleted = !0, this.workerRequestValue = e || [], this._beginRenderDecorations());
			}, onUnexpectedError);
		}
	}
	computeWithModel(e, O, k, A) {
		return A.length ? computeOccurencesMultiModel(this.multiDocumentProviders, e, O, k, this.editor.getOption(132), A) : computeOccurencesAtPosition(this.providers, e, O, k, this.editor.getOption(132));
	}
	_beginRenderDecorations() {
		let e = (/* @__PURE__ */ new Date()).getTime(), O = this.lastCursorPositionChangeTime + 250;
		e >= O ? (this.renderDecorationsTimer = -1, this.renderDecorations()) : this.renderDecorationsTimer = setTimeout(() => {
			this.renderDecorations();
		}, O - e);
	}
	renderDecorations() {
		this.renderDecorationsTimer = -1;
		let e = this.codeEditorService.listCodeEditors();
		for (let O of e) {
			let e = WordHighlighterContribution.get(O);
			if (!e) continue;
			let k = [], A = O.getModel()?.uri;
			if (A && this.workerRequestValue.has(A)) {
				let j = WordHighlighter_1.storedDecorationIDs.get(A), M = this.workerRequestValue.get(A);
				if (M) for (let e of M) e.range && k.push({
					range: e.range,
					options: getHighlightDecorationOptions(e.kind)
				});
				let N = [];
				O.changeDecorations((e) => {
					N = e.deltaDecorations(j ?? [], k);
				}), WordHighlighter_1.storedDecorationIDs = WordHighlighter_1.storedDecorationIDs.set(A, N), k.length > 0 && (e.wordHighlighter?.decorations.set(k), e.wordHighlighter?._hasWordHighlights.set(!0));
			}
		}
	}
	dispose() {
		this._stopSingular(), this.toUnhook.dispose();
	}
};
WordHighlighter = WordHighlighter_1 = __decorate$9([__param$9(4, ICodeEditorService)], WordHighlighter);
var WordHighlighterContribution = class extends Disposable {
	static {
		WordHighlighterContribution_1 = this;
	}
	static {
		this.ID = "editor.contrib.wordHighlighter";
	}
	static get(e) {
		return e.getContribution(WordHighlighterContribution_1.ID);
	}
	constructor(e, O, k, A) {
		super(), this._wordHighlighter = null;
		let j = () => {
			e.hasModel() && !e.getModel().isTooLargeForTokenization() && (this._wordHighlighter = new WordHighlighter(e, k.documentHighlightProvider, k.multiDocumentHighlightProvider, O, A));
		};
		this._register(e.onDidChangeModel((e) => {
			this._wordHighlighter &&= (this._wordHighlighter.dispose(), null), j();
		})), j();
	}
	get wordHighlighter() {
		return this._wordHighlighter;
	}
	saveViewState() {
		return !!(this._wordHighlighter && this._wordHighlighter.hasDecorations());
	}
	moveNext() {
		this._wordHighlighter?.moveNext();
	}
	moveBack() {
		this._wordHighlighter?.moveBack();
	}
	restoreViewState(e) {
		this._wordHighlighter && e && this._wordHighlighter.restore();
	}
	dispose() {
		this._wordHighlighter &&= (this._wordHighlighter.dispose(), null), super.dispose();
	}
};
WordHighlighterContribution = WordHighlighterContribution_1 = __decorate$9([
	__param$9(1, IContextKeyService),
	__param$9(2, ILanguageFeaturesService),
	__param$9(3, ICodeEditorService)
], WordHighlighterContribution);
var WordHighlightNavigationAction = class extends EditorAction {
	constructor(e, O) {
		super(O), this._isNext = e;
	}
	run(e, O) {
		let k = WordHighlighterContribution.get(O);
		k && (this._isNext ? k.moveNext() : k.moveBack());
	}
}, NextWordHighlightAction = class extends WordHighlightNavigationAction {
	constructor() {
		super(!0, {
			id: "editor.action.wordHighlight.next",
			label: localize("wordHighlight.next.label", "Go to Next Symbol Highlight"),
			alias: "Go to Next Symbol Highlight",
			precondition: ctxHasWordHighlights,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: 65,
				weight: 100
			}
		});
	}
}, PrevWordHighlightAction = class extends WordHighlightNavigationAction {
	constructor() {
		super(!1, {
			id: "editor.action.wordHighlight.prev",
			label: localize("wordHighlight.previous.label", "Go to Previous Symbol Highlight"),
			alias: "Go to Previous Symbol Highlight",
			precondition: ctxHasWordHighlights,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: 1089,
				weight: 100
			}
		});
	}
}, TriggerWordHighlightAction = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.wordHighlight.trigger",
			label: localize("wordHighlight.trigger.label", "Trigger Symbol Highlight"),
			alias: "Trigger Symbol Highlight",
			precondition: void 0,
			kbOpts: {
				kbExpr: EditorContextKeys.editorTextFocus,
				primary: 0,
				weight: 100
			}
		});
	}
	run(e, O, k) {
		let A = WordHighlighterContribution.get(O);
		A && A.restoreViewState(!0);
	}
};
registerEditorContribution(WordHighlighterContribution.ID, WordHighlighterContribution, 0), registerEditorAction(NextWordHighlightAction), registerEditorAction(PrevWordHighlightAction), registerEditorAction(TriggerWordHighlightAction), registerEditorFeature(TextualMultiDocumentHighlightFeature);
var MoveWordCommand = class extends EditorCommand {
	constructor(e) {
		super(e), this._inSelectionMode = e.inSelectionMode, this._wordNavigationType = e.wordNavigationType;
	}
	runEditorCommand(e, O, k) {
		if (!O.hasModel()) return;
		let A = getMapForWordSeparators(O.getOption(132), O.getOption(131)), j = O.getModel(), M = O.getSelections(), N = M.length > 1, P = M.map((e) => {
			let O = new Position(e.positionLineNumber, e.positionColumn), k = this._move(A, j, O, this._wordNavigationType, N);
			return this._moveTo(e, k, this._inSelectionMode);
		});
		if (j.pushStackElement(), O._getViewModel().setCursorStates("moveWordCommand", 3, P.map((e) => CursorState.fromModelSelection(e))), P.length === 1) {
			let e = new Position(P[0].positionLineNumber, P[0].positionColumn);
			O.revealPosition(e, 0);
		}
	}
	_moveTo(e, O, k) {
		return k ? new Selection(e.selectionStartLineNumber, e.selectionStartColumn, O.lineNumber, O.column) : new Selection(O.lineNumber, O.column, O.lineNumber, O.column);
	}
}, WordLeftCommand = class extends MoveWordCommand {
	_move(e, O, k, A, j) {
		return WordOperations.moveWordLeft(e, O, k, A, j);
	}
}, WordRightCommand = class extends MoveWordCommand {
	_move(e, O, k, A, j) {
		return WordOperations.moveWordRight(e, O, k, A);
	}
}, CursorWordStartLeft = class extends WordLeftCommand {
	constructor() {
		super({
			inSelectionMode: !1,
			wordNavigationType: 0,
			id: "cursorWordStartLeft",
			precondition: void 0
		});
	}
}, CursorWordEndLeft = class extends WordLeftCommand {
	constructor() {
		super({
			inSelectionMode: !1,
			wordNavigationType: 2,
			id: "cursorWordEndLeft",
			precondition: void 0
		});
	}
}, CursorWordLeft = class extends WordLeftCommand {
	constructor() {
		super({
			inSelectionMode: !1,
			wordNavigationType: 1,
			id: "cursorWordLeft",
			precondition: void 0,
			kbOpts: {
				kbExpr: ContextKeyExpr.and(EditorContextKeys.textInputFocus, ContextKeyExpr.and(CONTEXT_ACCESSIBILITY_MODE_ENABLED, IsWindowsContext)?.negate()),
				primary: 2063,
				mac: { primary: 527 },
				weight: 100
			}
		});
	}
}, CursorWordStartLeftSelect = class extends WordLeftCommand {
	constructor() {
		super({
			inSelectionMode: !0,
			wordNavigationType: 0,
			id: "cursorWordStartLeftSelect",
			precondition: void 0
		});
	}
}, CursorWordEndLeftSelect = class extends WordLeftCommand {
	constructor() {
		super({
			inSelectionMode: !0,
			wordNavigationType: 2,
			id: "cursorWordEndLeftSelect",
			precondition: void 0
		});
	}
}, CursorWordLeftSelect = class extends WordLeftCommand {
	constructor() {
		super({
			inSelectionMode: !0,
			wordNavigationType: 1,
			id: "cursorWordLeftSelect",
			precondition: void 0,
			kbOpts: {
				kbExpr: ContextKeyExpr.and(EditorContextKeys.textInputFocus, ContextKeyExpr.and(CONTEXT_ACCESSIBILITY_MODE_ENABLED, IsWindowsContext)?.negate()),
				primary: 3087,
				mac: { primary: 1551 },
				weight: 100
			}
		});
	}
}, CursorWordAccessibilityLeft = class extends WordLeftCommand {
	constructor() {
		super({
			inSelectionMode: !1,
			wordNavigationType: 3,
			id: "cursorWordAccessibilityLeft",
			precondition: void 0
		});
	}
	_move(e, O, k, A, j) {
		return super._move(getMapForWordSeparators(EditorOptions.wordSeparators.defaultValue, e.intlSegmenterLocales), O, k, A, j);
	}
}, CursorWordAccessibilityLeftSelect = class extends WordLeftCommand {
	constructor() {
		super({
			inSelectionMode: !0,
			wordNavigationType: 3,
			id: "cursorWordAccessibilityLeftSelect",
			precondition: void 0
		});
	}
	_move(e, O, k, A, j) {
		return super._move(getMapForWordSeparators(EditorOptions.wordSeparators.defaultValue, e.intlSegmenterLocales), O, k, A, j);
	}
}, CursorWordStartRight = class extends WordRightCommand {
	constructor() {
		super({
			inSelectionMode: !1,
			wordNavigationType: 0,
			id: "cursorWordStartRight",
			precondition: void 0
		});
	}
}, CursorWordEndRight = class extends WordRightCommand {
	constructor() {
		super({
			inSelectionMode: !1,
			wordNavigationType: 2,
			id: "cursorWordEndRight",
			precondition: void 0,
			kbOpts: {
				kbExpr: ContextKeyExpr.and(EditorContextKeys.textInputFocus, ContextKeyExpr.and(CONTEXT_ACCESSIBILITY_MODE_ENABLED, IsWindowsContext)?.negate()),
				primary: 2065,
				mac: { primary: 529 },
				weight: 100
			}
		});
	}
}, CursorWordRight = class extends WordRightCommand {
	constructor() {
		super({
			inSelectionMode: !1,
			wordNavigationType: 2,
			id: "cursorWordRight",
			precondition: void 0
		});
	}
}, CursorWordStartRightSelect = class extends WordRightCommand {
	constructor() {
		super({
			inSelectionMode: !0,
			wordNavigationType: 0,
			id: "cursorWordStartRightSelect",
			precondition: void 0
		});
	}
}, CursorWordEndRightSelect = class extends WordRightCommand {
	constructor() {
		super({
			inSelectionMode: !0,
			wordNavigationType: 2,
			id: "cursorWordEndRightSelect",
			precondition: void 0,
			kbOpts: {
				kbExpr: ContextKeyExpr.and(EditorContextKeys.textInputFocus, ContextKeyExpr.and(CONTEXT_ACCESSIBILITY_MODE_ENABLED, IsWindowsContext)?.negate()),
				primary: 3089,
				mac: { primary: 1553 },
				weight: 100
			}
		});
	}
}, CursorWordRightSelect = class extends WordRightCommand {
	constructor() {
		super({
			inSelectionMode: !0,
			wordNavigationType: 2,
			id: "cursorWordRightSelect",
			precondition: void 0
		});
	}
}, CursorWordAccessibilityRight = class extends WordRightCommand {
	constructor() {
		super({
			inSelectionMode: !1,
			wordNavigationType: 3,
			id: "cursorWordAccessibilityRight",
			precondition: void 0
		});
	}
	_move(e, O, k, A, j) {
		return super._move(getMapForWordSeparators(EditorOptions.wordSeparators.defaultValue, e.intlSegmenterLocales), O, k, A, j);
	}
}, CursorWordAccessibilityRightSelect = class extends WordRightCommand {
	constructor() {
		super({
			inSelectionMode: !0,
			wordNavigationType: 3,
			id: "cursorWordAccessibilityRightSelect",
			precondition: void 0
		});
	}
	_move(e, O, k, A, j) {
		return super._move(getMapForWordSeparators(EditorOptions.wordSeparators.defaultValue, e.intlSegmenterLocales), O, k, A, j);
	}
}, DeleteWordCommand = class extends EditorCommand {
	constructor(e) {
		super(e), this._whitespaceHeuristics = e.whitespaceHeuristics, this._wordNavigationType = e.wordNavigationType;
	}
	runEditorCommand(e, O, k) {
		let A = e.get(ILanguageConfigurationService);
		if (!O.hasModel()) return;
		let j = getMapForWordSeparators(O.getOption(132), O.getOption(131)), M = O.getModel(), N = O.getSelections(), P = O.getOption(6), F = O.getOption(11), I = A.getLanguageConfiguration(M.getLanguageId()).getAutoClosingPairs(), L = O._getViewModel(), R = N.map((e) => {
			let k = this._delete({
				wordSeparators: j,
				model: M,
				selection: e,
				whitespaceHeuristics: this._whitespaceHeuristics,
				autoClosingDelete: O.getOption(9),
				autoClosingBrackets: P,
				autoClosingQuotes: F,
				autoClosingPairs: I,
				autoClosedCharacters: L.getCursorAutoClosedCharacters()
			}, this._wordNavigationType);
			return new ReplaceCommand(k, "");
		});
		O.pushUndoStop(), O.executeCommands(this.id, R), O.pushUndoStop();
	}
}, DeleteWordLeftCommand = class extends DeleteWordCommand {
	_delete(e, O) {
		return WordOperations.deleteWordLeft(e, O) || new Range(1, 1, 1, 1);
	}
}, DeleteWordRightCommand = class extends DeleteWordCommand {
	_delete(e, O) {
		let k = WordOperations.deleteWordRight(e, O);
		if (k) return k;
		let A = e.model.getLineCount(), j = e.model.getLineMaxColumn(A);
		return new Range(A, j, A, j);
	}
}, DeleteWordStartLeft = class extends DeleteWordLeftCommand {
	constructor() {
		super({
			whitespaceHeuristics: !1,
			wordNavigationType: 0,
			id: "deleteWordStartLeft",
			precondition: EditorContextKeys.writable
		});
	}
}, DeleteWordEndLeft = class extends DeleteWordLeftCommand {
	constructor() {
		super({
			whitespaceHeuristics: !1,
			wordNavigationType: 2,
			id: "deleteWordEndLeft",
			precondition: EditorContextKeys.writable
		});
	}
}, DeleteWordLeft = class extends DeleteWordLeftCommand {
	constructor() {
		super({
			whitespaceHeuristics: !0,
			wordNavigationType: 0,
			id: "deleteWordLeft",
			precondition: EditorContextKeys.writable,
			kbOpts: {
				kbExpr: EditorContextKeys.textInputFocus,
				primary: 2049,
				mac: { primary: 513 },
				weight: 100
			}
		});
	}
}, DeleteWordStartRight = class extends DeleteWordRightCommand {
	constructor() {
		super({
			whitespaceHeuristics: !1,
			wordNavigationType: 0,
			id: "deleteWordStartRight",
			precondition: EditorContextKeys.writable
		});
	}
}, DeleteWordEndRight = class extends DeleteWordRightCommand {
	constructor() {
		super({
			whitespaceHeuristics: !1,
			wordNavigationType: 2,
			id: "deleteWordEndRight",
			precondition: EditorContextKeys.writable
		});
	}
}, DeleteWordRight = class extends DeleteWordRightCommand {
	constructor() {
		super({
			whitespaceHeuristics: !0,
			wordNavigationType: 2,
			id: "deleteWordRight",
			precondition: EditorContextKeys.writable,
			kbOpts: {
				kbExpr: EditorContextKeys.textInputFocus,
				primary: 2068,
				mac: { primary: 532 },
				weight: 100
			}
		});
	}
}, DeleteInsideWord = class extends EditorAction {
	constructor() {
		super({
			id: "deleteInsideWord",
			precondition: EditorContextKeys.writable,
			label: localize("deleteInsideWord", "Delete Word"),
			alias: "Delete Word"
		});
	}
	run(e, O, k) {
		if (!O.hasModel()) return;
		let A = getMapForWordSeparators(O.getOption(132), O.getOption(131)), j = O.getModel(), M = O.getSelections().map((e) => {
			let O = WordOperations.deleteInsideWord(A, j, e);
			return new ReplaceCommand(O, "");
		});
		O.pushUndoStop(), O.executeCommands(this.id, M), O.pushUndoStop();
	}
};
registerEditorCommand(new CursorWordStartLeft()), registerEditorCommand(new CursorWordEndLeft()), registerEditorCommand(new CursorWordLeft()), registerEditorCommand(new CursorWordStartLeftSelect()), registerEditorCommand(new CursorWordEndLeftSelect()), registerEditorCommand(new CursorWordLeftSelect()), registerEditorCommand(new CursorWordStartRight()), registerEditorCommand(new CursorWordEndRight()), registerEditorCommand(new CursorWordRight()), registerEditorCommand(new CursorWordStartRightSelect()), registerEditorCommand(new CursorWordEndRightSelect()), registerEditorCommand(new CursorWordRightSelect()), registerEditorCommand(new CursorWordAccessibilityLeft()), registerEditorCommand(new CursorWordAccessibilityLeftSelect()), registerEditorCommand(new CursorWordAccessibilityRight()), registerEditorCommand(new CursorWordAccessibilityRightSelect()), registerEditorCommand(new DeleteWordStartLeft()), registerEditorCommand(new DeleteWordEndLeft()), registerEditorCommand(new DeleteWordLeft()), registerEditorCommand(new DeleteWordStartRight()), registerEditorCommand(new DeleteWordEndRight()), registerEditorCommand(new DeleteWordRight()), registerEditorAction(DeleteInsideWord);
var DeleteWordPartLeft = class extends DeleteWordCommand {
	constructor() {
		super({
			whitespaceHeuristics: !0,
			wordNavigationType: 0,
			id: "deleteWordPartLeft",
			precondition: EditorContextKeys.writable,
			kbOpts: {
				kbExpr: EditorContextKeys.textInputFocus,
				primary: 0,
				mac: { primary: 769 },
				weight: 100
			}
		});
	}
	_delete(e, O) {
		return WordPartOperations.deleteWordPartLeft(e) || new Range(1, 1, 1, 1);
	}
}, DeleteWordPartRight = class extends DeleteWordCommand {
	constructor() {
		super({
			whitespaceHeuristics: !0,
			wordNavigationType: 2,
			id: "deleteWordPartRight",
			precondition: EditorContextKeys.writable,
			kbOpts: {
				kbExpr: EditorContextKeys.textInputFocus,
				primary: 0,
				mac: { primary: 788 },
				weight: 100
			}
		});
	}
	_delete(e, O) {
		let k = WordPartOperations.deleteWordPartRight(e);
		if (k) return k;
		let A = e.model.getLineCount(), j = e.model.getLineMaxColumn(A);
		return new Range(A, j, A, j);
	}
}, WordPartLeftCommand = class extends MoveWordCommand {
	_move(e, O, k, A, j) {
		return WordPartOperations.moveWordPartLeft(e, O, k, j);
	}
}, CursorWordPartLeft = class extends WordPartLeftCommand {
	constructor() {
		super({
			inSelectionMode: !1,
			wordNavigationType: 0,
			id: "cursorWordPartLeft",
			precondition: void 0,
			kbOpts: {
				kbExpr: EditorContextKeys.textInputFocus,
				primary: 0,
				mac: { primary: 783 },
				weight: 100
			}
		});
	}
};
CommandsRegistry.registerCommandAlias("cursorWordPartStartLeft", "cursorWordPartLeft");
var CursorWordPartLeftSelect = class extends WordPartLeftCommand {
	constructor() {
		super({
			inSelectionMode: !0,
			wordNavigationType: 0,
			id: "cursorWordPartLeftSelect",
			precondition: void 0,
			kbOpts: {
				kbExpr: EditorContextKeys.textInputFocus,
				primary: 0,
				mac: { primary: 1807 },
				weight: 100
			}
		});
	}
};
CommandsRegistry.registerCommandAlias("cursorWordPartStartLeftSelect", "cursorWordPartLeftSelect");
var WordPartRightCommand = class extends MoveWordCommand {
	_move(e, O, k, A, j) {
		return WordPartOperations.moveWordPartRight(e, O, k);
	}
}, CursorWordPartRight = class extends WordPartRightCommand {
	constructor() {
		super({
			inSelectionMode: !1,
			wordNavigationType: 2,
			id: "cursorWordPartRight",
			precondition: void 0,
			kbOpts: {
				kbExpr: EditorContextKeys.textInputFocus,
				primary: 0,
				mac: { primary: 785 },
				weight: 100
			}
		});
	}
}, CursorWordPartRightSelect = class extends WordPartRightCommand {
	constructor() {
		super({
			inSelectionMode: !0,
			wordNavigationType: 2,
			id: "cursorWordPartRightSelect",
			precondition: void 0,
			kbOpts: {
				kbExpr: EditorContextKeys.textInputFocus,
				primary: 0,
				mac: { primary: 1809 },
				weight: 100
			}
		});
	}
};
registerEditorCommand(new DeleteWordPartLeft()), registerEditorCommand(new DeleteWordPartRight()), registerEditorCommand(new CursorWordPartLeft()), registerEditorCommand(new CursorWordPartLeftSelect()), registerEditorCommand(new CursorWordPartRight()), registerEditorCommand(new CursorWordPartRightSelect());
var ReadOnlyMessageController = class extends Disposable {
	static {
		this.ID = "editor.contrib.readOnlyMessageController";
	}
	constructor(e) {
		super(), this.editor = e, this._register(this.editor.onDidAttemptReadOnlyEdit(() => this._onDidAttemptReadOnlyEdit()));
	}
	_onDidAttemptReadOnlyEdit() {
		let e = MessageController.get(this.editor);
		if (e && this.editor.hasModel()) {
			let O = this.editor.getOptions().get(93);
			O ||= this.editor.isSimpleWidget ? new MarkdownString(localize("editor.simple.readonly", "Cannot edit in read-only input")) : new MarkdownString(localize("editor.readonly", "Cannot edit in read-only editor")), e.showMessage(O, this.editor.getPosition());
		}
	}
};
registerEditorContribution(ReadOnlyMessageController.ID, ReadOnlyMessageController, 2);
var __decorate$8 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$8 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, DiffEditorBreadcrumbsSource = class extends Disposable {
	constructor(e, O, k) {
		super(), this._textModel = e, this._languageFeaturesService = O, this._outlineModelService = k, this._currentModel = observableValue(this, void 0);
		let A = observableSignalFromEvent("documentSymbolProvider.onDidChange", this._languageFeaturesService.documentSymbolProvider.onDidChange), j = observableSignalFromEvent("_textModel.onDidChangeContent", Event.debounce((e) => this._textModel.onDidChangeContent(e), () => void 0, 100));
		this._register(autorunWithStore(async (e, O) => {
			A.read(e), j.read(e);
			let k = O.add(new DisposableCancellationTokenSource()), M = await this._outlineModelService.getOrCreate(this._textModel, k.token);
			O.isDisposed || this._currentModel.set(M, void 0);
		}));
	}
	getBreadcrumbItems(e, O) {
		let k = this._currentModel.read(O);
		if (!k) return [];
		let A = k.asListOfDocumentSymbols().filter((O) => e.contains(O.range.startLineNumber) && !e.contains(O.range.endLineNumber));
		return A.sort(reverseOrder(compareBy((e) => e.range.endLineNumber - e.range.startLineNumber, numberComparator))), A.map((e) => ({
			name: e.name,
			kind: e.kind,
			startLineNumber: e.range.startLineNumber
		}));
	}
};
DiffEditorBreadcrumbsSource = __decorate$8([__param$8(1, ILanguageFeaturesService), __param$8(2, IOutlineModelService)], DiffEditorBreadcrumbsSource), HideUnchangedRegionsFeature.setBreadcrumbsSourceFactory((e, O) => O.createInstance(DiffEditorBreadcrumbsSource, e));
var IPadShowKeyboard = class extends Disposable {
	static {
		this.ID = "editor.contrib.iPadShowKeyboard";
	}
	constructor(e) {
		super(), this.editor = e, this.widget = null, isIOS && (this._register(e.onDidChangeConfiguration(() => this.update())), this.update());
	}
	update() {
		let e = !this.editor.getOption(92);
		!this.widget && e ? this.widget = new ShowKeyboardWidget(this.editor) : this.widget && !e && (this.widget.dispose(), this.widget = null);
	}
	dispose() {
		super.dispose(), this.widget &&= (this.widget.dispose(), null);
	}
}, ShowKeyboardWidget = class e extends Disposable {
	static {
		this.ID = "editor.contrib.ShowKeyboardWidget";
	}
	constructor(e) {
		super(), this.editor = e, this._domNode = document.createElement("textarea"), this._domNode.className = "iPadShowKeyboard", this._register(addDisposableListener(this._domNode, "touchstart", (e) => {
			this.editor.focus();
		})), this._register(addDisposableListener(this._domNode, "focus", (e) => {
			this.editor.focus();
		})), this.editor.addOverlayWidget(this);
	}
	dispose() {
		this.editor.removeOverlayWidget(this), super.dispose();
	}
	getId() {
		return e.ID;
	}
	getDomNode() {
		return this._domNode;
	}
	getPosition() {
		return { preference: 1 };
	}
};
registerEditorContribution(IPadShowKeyboard.ID, IPadShowKeyboard, 3);
var __decorate$7 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$7 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, InspectTokensController_1, InspectTokensController = class extends Disposable {
	static {
		InspectTokensController_1 = this;
	}
	static {
		this.ID = "editor.contrib.inspectTokens";
	}
	static get(e) {
		return e.getContribution(InspectTokensController_1.ID);
	}
	constructor(e, O, k) {
		super(), this._editor = e, this._languageService = k, this._widget = null, this._register(this._editor.onDidChangeModel((e) => this.stop())), this._register(this._editor.onDidChangeModelLanguage((e) => this.stop())), this._register(TokenizationRegistry.onDidChange((e) => this.stop())), this._register(this._editor.onKeyUp((e) => e.keyCode === 9 && this.stop()));
	}
	dispose() {
		this.stop(), super.dispose();
	}
	launch() {
		this._widget || this._editor.hasModel() && (this._widget = new InspectTokensWidget(this._editor, this._languageService));
	}
	stop() {
		this._widget &&= (this._widget.dispose(), null);
	}
};
InspectTokensController = InspectTokensController_1 = __decorate$7([__param$7(1, IStandaloneThemeService), __param$7(2, ILanguageService)], InspectTokensController);
var InspectTokens = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.inspectTokens",
			label: InspectTokensNLS.inspectTokensAction,
			alias: "Developer: Inspect Tokens",
			precondition: void 0
		});
	}
	run(e, O) {
		InspectTokensController.get(O)?.launch();
	}
};
function renderTokenText(e) {
	let O = "";
	for (let k = 0, A = e.length; k < A; k++) {
		let A = e.charCodeAt(k);
		switch (A) {
			case 9:
				O += "→";
				break;
			case 32:
				O += "·";
				break;
			default: O += String.fromCharCode(A);
		}
	}
	return O;
}
function getSafeTokenizationSupport(e, O) {
	let k = TokenizationRegistry.get(O);
	if (k) return k;
	let A = e.encodeLanguageId(O);
	return {
		getInitialState: () => NullState,
		tokenize: (e, k, A) => nullTokenize(O, A),
		tokenizeEncoded: (e, O, k) => nullTokenizeEncoded(A, k)
	};
}
var InspectTokensWidget = class e extends Disposable {
	static {
		this._ID = "editor.contrib.inspectTokensWidget";
	}
	constructor(e, O) {
		super(), this.allowEditorOverflow = !0, this._editor = e, this._languageService = O, this._model = this._editor.getModel(), this._domNode = document.createElement("div"), this._domNode.className = "tokens-inspect-widget", this._tokenizationSupport = getSafeTokenizationSupport(this._languageService.languageIdCodec, this._model.getLanguageId()), this._compute(this._editor.getPosition()), this._register(this._editor.onDidChangeCursorPosition((e) => this._compute(this._editor.getPosition()))), this._editor.addContentWidget(this);
	}
	dispose() {
		this._editor.removeContentWidget(this), super.dispose();
	}
	getId() {
		return e._ID;
	}
	_compute(e) {
		let O = this._getTokensAtLine(e.lineNumber), k = 0;
		for (let A = O.tokens1.length - 1; A >= 0; A--) {
			let j = O.tokens1[A];
			if (e.column - 1 >= j.offset) {
				k = A;
				break;
			}
		}
		let A = 0;
		for (let k = O.tokens2.length >>> 1; k >= 0; k--) if (e.column - 1 >= O.tokens2[k << 1]) {
			A = k;
			break;
		}
		let j = this._model.getLineContent(e.lineNumber), M = "";
		if (k < O.tokens1.length) {
			let e = O.tokens1[k].offset, A = k + 1 < O.tokens1.length ? O.tokens1[k + 1].offset : j.length;
			M = j.substring(e, A);
		}
		reset(this._domNode, $("h2.tm-token", void 0, renderTokenText(M), $("span.tm-token-length", void 0, `${M.length} ${M.length === 1 ? "char" : "chars"}`))), append(this._domNode, $("hr.tokens-inspect-separator", { style: "clear:both" }));
		let N = (A << 1) + 1 < O.tokens2.length ? this._decodeMetadata(O.tokens2[(A << 1) + 1]) : null;
		append(this._domNode, $("table.tm-metadata-table", void 0, $("tbody", void 0, $("tr", void 0, $("td.tm-metadata-key", void 0, "language"), $("td.tm-metadata-value", void 0, `${N ? N.languageId : "-?-"}`)), $("tr", void 0, $("td.tm-metadata-key", void 0, "token type"), $("td.tm-metadata-value", void 0, `${N ? this._tokenTypeToString(N.tokenType) : "-?-"}`)), $("tr", void 0, $("td.tm-metadata-key", void 0, "font style"), $("td.tm-metadata-value", void 0, `${N ? this._fontStyleToString(N.fontStyle) : "-?-"}`)), $("tr", void 0, $("td.tm-metadata-key", void 0, "foreground"), $("td.tm-metadata-value", void 0, `${N ? Color.Format.CSS.formatHex(N.foreground) : "-?-"}`)), $("tr", void 0, $("td.tm-metadata-key", void 0, "background"), $("td.tm-metadata-value", void 0, `${N ? Color.Format.CSS.formatHex(N.background) : "-?-"}`))))), append(this._domNode, $("hr.tokens-inspect-separator")), k < O.tokens1.length && append(this._domNode, $("span.tm-token-type", void 0, O.tokens1[k].type)), this._editor.layoutContentWidget(this);
	}
	_decodeMetadata(e) {
		let O = TokenizationRegistry.getColorMap(), k = TokenMetadata.getLanguageId(e), A = TokenMetadata.getTokenType(e), j = TokenMetadata.getFontStyle(e), M = TokenMetadata.getForeground(e), N = TokenMetadata.getBackground(e);
		return {
			languageId: this._languageService.languageIdCodec.decodeLanguageId(k),
			tokenType: A,
			fontStyle: j,
			foreground: O[M],
			background: O[N]
		};
	}
	_tokenTypeToString(e) {
		switch (e) {
			case 0: return "Other";
			case 1: return "Comment";
			case 2: return "String";
			case 3: return "RegEx";
			default: return "??";
		}
	}
	_fontStyleToString(e) {
		let O = "";
		return e & 1 && (O += "italic "), e & 2 && (O += "bold "), e & 4 && (O += "underline "), e & 8 && (O += "strikethrough "), O.length === 0 && (O = "---"), O;
	}
	_getTokensAtLine(e) {
		let O = this._getStateBeforeLine(e), k = this._tokenizationSupport.tokenize(this._model.getLineContent(e), !0, O), A = this._tokenizationSupport.tokenizeEncoded(this._model.getLineContent(e), !0, O);
		return {
			startState: O,
			tokens1: k.tokens,
			tokens2: A.tokens,
			endState: k.endState
		};
	}
	_getStateBeforeLine(e) {
		let O = this._tokenizationSupport.getInitialState();
		for (let k = 1; k < e; k++) O = this._tokenizationSupport.tokenize(this._model.getLineContent(k), !0, O).endState;
		return O;
	}
	getDomNode() {
		return this._domNode;
	}
	getPosition() {
		return {
			position: this._editor.getPosition(),
			preference: [2, 1]
		};
	}
};
registerEditorContribution(InspectTokensController.ID, InspectTokensController, 4), registerEditorAction(InspectTokens);
var __decorate$6 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$6 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, HelpQuickAccessProvider_1, HelpQuickAccessProvider = class {
	static {
		HelpQuickAccessProvider_1 = this;
	}
	static {
		this.PREFIX = "?";
	}
	constructor(e, O) {
		this.quickInputService = e, this.keybindingService = O, this.registry = Registry.as(Extensions.Quickaccess);
	}
	provide(e) {
		let O = new DisposableStore();
		return O.add(e.onDidAccept(() => {
			let [O] = e.selectedItems;
			O && this.quickInputService.quickAccess.show(O.prefix, { preserveValue: !0 });
		})), O.add(e.onDidChangeValue((e) => {
			let O = this.registry.getQuickAccessProvider(e.substr(HelpQuickAccessProvider_1.PREFIX.length));
			O && O.prefix && O.prefix !== HelpQuickAccessProvider_1.PREFIX && this.quickInputService.quickAccess.show(O.prefix, { preserveValue: !0 });
		})), e.items = this.getQuickAccessProviders().filter((e) => e.prefix !== HelpQuickAccessProvider_1.PREFIX), O;
	}
	getQuickAccessProviders() {
		return this.registry.getQuickAccessProviders().sort((e, O) => e.prefix.localeCompare(O.prefix)).flatMap((e) => this.createPicks(e));
	}
	createPicks(e) {
		return e.helpEntries.map((O) => {
			let k = O.prefix || e.prefix, A = k || "…";
			return {
				prefix: k,
				label: A,
				keybinding: O.commandId ? this.keybindingService.lookupKeybinding(O.commandId) : void 0,
				ariaLabel: localize("helpPickAriaLabel", "{0}, {1}", A, O.description),
				description: O.description
			};
		});
	}
};
HelpQuickAccessProvider = HelpQuickAccessProvider_1 = __decorate$6([__param$6(0, IQuickInputService), __param$6(1, IKeybindingService)], HelpQuickAccessProvider), Registry.as(Extensions.Quickaccess).registerQuickAccessProvider({
	ctor: HelpQuickAccessProvider,
	prefix: "",
	helpEntries: [{ description: QuickHelpNLS.helpQuickAccessActionLabel }]
});
var AbstractEditorNavigationQuickAccessProvider = class {
	constructor(e) {
		this.options = e, this.rangeHighlightDecorationId = void 0;
	}
	provide(e, O, k) {
		let A = new DisposableStore();
		e.canAcceptInBackground = !!this.options?.canAcceptInBackground, e.matchOnLabel = e.matchOnDescription = e.matchOnDetail = e.sortByLabel = !1;
		let j = A.add(new MutableDisposable());
		return j.value = this.doProvide(e, O, k), A.add(this.onDidActiveTextEditorControlChange(() => {
			j.value = void 0, j.value = this.doProvide(e, O);
		})), A;
	}
	doProvide(e, O, k) {
		let A = new DisposableStore(), j = this.activeTextEditorControl;
		if (j && this.canProvideWithTextEditor(j)) {
			let M = { editor: j }, N = getCodeEditor(j);
			if (N) {
				let e = j.saveViewState() ?? void 0;
				A.add(N.onDidChangeCursorPosition(() => {
					e = j.saveViewState() ?? void 0;
				})), M.restoreViewState = () => {
					e && j === this.activeTextEditorControl && j.restoreViewState(e);
				}, A.add(createSingleCallFunction(O.onCancellationRequested)(() => M.restoreViewState?.()));
			}
			A.add(toDisposable(() => this.clearDecorations(j))), A.add(this.provideWithTextEditor(M, e, O, k));
		} else A.add(this.provideWithoutTextEditor(e, O));
		return A;
	}
	canProvideWithTextEditor(e) {
		return !0;
	}
	gotoLocation({ editor: e }, O) {
		e.setSelection(O.range, "code.jump"), e.revealRangeInCenter(O.range, 0), O.preserveFocus || e.focus();
		let k = e.getModel();
		k && "getLineContent" in k && status(`${k.getLineContent(O.range.startLineNumber)}`);
	}
	getModel(e) {
		return isDiffEditor(e) ? e.getModel()?.modified : e.getModel();
	}
	addDecorations(e, O) {
		e.changeDecorations((e) => {
			let k = [];
			this.rangeHighlightDecorationId &&= (k.push(this.rangeHighlightDecorationId.overviewRulerDecorationId), k.push(this.rangeHighlightDecorationId.rangeHighlightId), void 0);
			let A = [{
				range: O,
				options: {
					description: "quick-access-range-highlight",
					className: "rangeHighlight",
					isWholeLine: !0
				}
			}, {
				range: O,
				options: {
					description: "quick-access-range-highlight-overview",
					overviewRuler: {
						color: themeColorFromId(overviewRulerRangeHighlight),
						position: OverviewRulerLane.Full
					}
				}
			}], [j, M] = e.deltaDecorations(k, A);
			this.rangeHighlightDecorationId = {
				rangeHighlightId: j,
				overviewRulerDecorationId: M
			};
		});
	}
	clearDecorations(e) {
		let O = this.rangeHighlightDecorationId;
		O && (e.changeDecorations((e) => {
			e.deltaDecorations([O.overviewRulerDecorationId, O.rangeHighlightId], []);
		}), this.rangeHighlightDecorationId = void 0);
	}
}, AbstractGotoLineQuickAccessProvider = class e extends AbstractEditorNavigationQuickAccessProvider {
	static {
		this.PREFIX = ":";
	}
	constructor() {
		super({ canAcceptInBackground: !0 });
	}
	provideWithoutTextEditor(e) {
		let O = localize("cannotRunGotoLine", "Open a text editor first to go to a line.");
		return e.items = [{ label: O }], e.ariaLabel = O, Disposable.None;
	}
	provideWithTextEditor(O, k, A) {
		let j = O.editor, M = new DisposableStore();
		M.add(k.onDidAccept((e) => {
			let [A] = k.selectedItems;
			if (A) {
				if (!this.isValidLineNumber(j, A.lineNumber)) return;
				this.gotoLocation(O, {
					range: this.toRange(A.lineNumber, A.column),
					keyMods: k.keyMods,
					preserveFocus: e.inBackground
				}), e.inBackground || k.hide();
			}
		}));
		let N = () => {
			let O = this.parsePosition(j, k.value.trim().substr(e.PREFIX.length)), A = this.getPickLabel(j, O.lineNumber, O.column);
			if (k.items = [{
				lineNumber: O.lineNumber,
				column: O.column,
				label: A
			}], k.ariaLabel = A, !this.isValidLineNumber(j, O.lineNumber)) {
				this.clearDecorations(j);
				return;
			}
			let M = this.toRange(O.lineNumber, O.column);
			j.revealRangeInCenter(M, 0), this.addDecorations(j, M);
		};
		N(), M.add(k.onDidChangeValue(() => N()));
		let P = getCodeEditor(j);
		return P && P.getOptions().get(68).renderType === 2 && (P.updateOptions({ lineNumbers: "on" }), M.add(toDisposable(() => P.updateOptions({ lineNumbers: "relative" })))), M;
	}
	toRange(e = 1, O = 1) {
		return {
			startLineNumber: e,
			startColumn: O,
			endLineNumber: e,
			endColumn: O
		};
	}
	parsePosition(e, O) {
		let k = O.split(/,|:|#/).map((e) => parseInt(e, 10)).filter((e) => !isNaN(e)), A = this.lineCount(e) + 1;
		return {
			lineNumber: k[0] > 0 ? k[0] : A + k[0],
			column: k[1]
		};
	}
	getPickLabel(e, O, k) {
		if (this.isValidLineNumber(e, O)) return this.isValidColumn(e, O, k) ? localize("gotoLineColumnLabel", "Go to line {0} and character {1}.", O, k) : localize("gotoLineLabel", "Go to line {0}.", O);
		let A = e.getPosition() || {
			lineNumber: 1,
			column: 1
		}, j = this.lineCount(e);
		return j > 1 ? localize("gotoLineLabelEmptyWithLimit", "Current Line: {0}, Character: {1}. Type a line number between 1 and {2} to navigate to.", A.lineNumber, A.column, j) : localize("gotoLineLabelEmpty", "Current Line: {0}, Character: {1}. Type a line number to navigate to.", A.lineNumber, A.column);
	}
	isValidLineNumber(e, O) {
		return !O || typeof O != "number" ? !1 : O > 0 && O <= this.lineCount(e);
	}
	isValidColumn(e, O, k) {
		if (!k || typeof k != "number") return !1;
		let A = this.getModel(e);
		if (!A) return !1;
		let j = {
			lineNumber: O,
			column: k
		};
		return A.validatePosition(j).equals(j);
	}
	lineCount(e) {
		return this.getModel(e)?.getLineCount() ?? 0;
	}
}, __decorate$5 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$5 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, StandaloneGotoLineQuickAccessProvider = class extends AbstractGotoLineQuickAccessProvider {
	constructor(e) {
		super(), this.editorService = e, this.onDidActiveTextEditorControlChange = Event.None;
	}
	get activeTextEditorControl() {
		return this.editorService.getFocusedCodeEditor() ?? void 0;
	}
};
StandaloneGotoLineQuickAccessProvider = __decorate$5([__param$5(0, ICodeEditorService)], StandaloneGotoLineQuickAccessProvider);
var GotoLineAction$1 = class e extends EditorAction {
	static {
		this.ID = "editor.action.gotoLine";
	}
	constructor() {
		super({
			id: e.ID,
			label: GoToLineNLS.gotoLineActionLabel,
			alias: "Go to Line/Column...",
			precondition: void 0,
			kbOpts: {
				kbExpr: EditorContextKeys.focus,
				primary: 2085,
				mac: { primary: 293 },
				weight: 100
			}
		});
	}
	run(e) {
		e.get(IQuickInputService).quickAccess.show(StandaloneGotoLineQuickAccessProvider.PREFIX);
	}
};
registerEditorAction(GotoLineAction$1), Registry.as(Extensions.Quickaccess).registerQuickAccessProvider({
	ctor: StandaloneGotoLineQuickAccessProvider,
	prefix: StandaloneGotoLineQuickAccessProvider.PREFIX,
	helpEntries: [{
		description: GoToLineNLS.gotoLineActionLabel,
		commandId: GotoLineAction$1.ID
	}]
});
var NO_SCORE2 = [void 0, []];
function scoreFuzzy2(e, O, k = 0, A = 0) {
	let j = O;
	return j.values && j.values.length > 1 ? doScoreFuzzy2Multiple(e, j.values, k, A) : doScoreFuzzy2Single(e, O, k, A);
}
function doScoreFuzzy2Multiple(e, O, k, A) {
	let j = 0, M = [];
	for (let N of O) {
		let [O, P] = doScoreFuzzy2Single(e, N, k, A);
		if (typeof O != "number") return NO_SCORE2;
		j += O, M.push(...P);
	}
	return [j, normalizeMatches(M)];
}
function doScoreFuzzy2Single(e, O, k, A) {
	let j = fuzzyScore(O.original, O.originalLowercase, k, e, e.toLowerCase(), A, {
		firstMatchCanBeWeak: !0,
		boostFullMatch: !0
	});
	return j ? [j[0], createMatches(j)] : NO_SCORE2;
}
Object.freeze({ score: 0 });
function normalizeMatches(e) {
	let O = e.sort((e, O) => e.start - O.start), k = [], A;
	for (let e of O) !A || !matchOverlaps(A, e) ? (A = e, k.push(e)) : (A.start = Math.min(A.start, e.start), A.end = Math.max(A.end, e.end));
	return k;
}
function matchOverlaps(e, O) {
	return !(e.end < O.start || O.end < e.start);
}
function queryExpectsExactMatch(e) {
	return e.startsWith("\"") && e.endsWith("\"");
}
var MULTIPLE_QUERY_VALUES_SEPARATOR = " ";
function prepareQuery(e) {
	typeof e != "string" && (e = "");
	let O = e.toLowerCase(), { pathNormalized: k, normalized: A, normalizedLowercase: j } = normalizeQuery(e), M = k.indexOf(sep) >= 0, N = queryExpectsExactMatch(e), P, F = e.split(MULTIPLE_QUERY_VALUES_SEPARATOR);
	if (F.length > 1) for (let e of F) {
		let O = queryExpectsExactMatch(e), { pathNormalized: k, normalized: A, normalizedLowercase: j } = normalizeQuery(e);
		A && (P ||= [], P.push({
			original: e,
			originalLowercase: e.toLowerCase(),
			pathNormalized: k,
			normalized: A,
			normalizedLowercase: j,
			expectContiguousMatch: O
		}));
	}
	return {
		original: e,
		originalLowercase: O,
		pathNormalized: k,
		normalized: A,
		normalizedLowercase: j,
		values: P,
		containsPathSeparator: M,
		expectContiguousMatch: N
	};
}
function normalizeQuery(e) {
	let O;
	O = isWindows ? e.replace(/\//g, sep) : e.replace(/\\/g, sep);
	let k = stripWildcards(O).replace(/\s|"/g, "");
	return {
		pathNormalized: O,
		normalized: k,
		normalizedLowercase: k.toLowerCase()
	};
}
function pieceToQuery(e) {
	return prepareQuery(Array.isArray(e) ? e.map((e) => e.original).join(MULTIPLE_QUERY_VALUES_SEPARATOR) : e.original);
}
var __decorate$4 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$4 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, AbstractGotoSymbolQuickAccessProvider_1, AbstractGotoSymbolQuickAccessProvider = class extends AbstractEditorNavigationQuickAccessProvider {
	static {
		AbstractGotoSymbolQuickAccessProvider_1 = this;
	}
	static {
		this.PREFIX = "@";
	}
	static {
		this.SCOPE_PREFIX = ":";
	}
	static {
		this.PREFIX_BY_CATEGORY = `${this.PREFIX}${this.SCOPE_PREFIX}`;
	}
	constructor(e, O, k = Object.create(null)) {
		super(k), this._languageFeaturesService = e, this._outlineModelService = O, this.options = k, this.options.canAcceptInBackground = !0;
	}
	provideWithoutTextEditor(e) {
		return this.provideLabelPick(e, localize("cannotRunGotoSymbolWithoutEditor", "To go to a symbol, first open a text editor with symbol information.")), Disposable.None;
	}
	provideWithTextEditor(e, O, k, A) {
		let j = e.editor, M = this.getModel(j);
		return M ? this._languageFeaturesService.documentSymbolProvider.has(M) ? this.doProvideWithEditorSymbols(e, M, O, k, A) : this.doProvideWithoutEditorSymbols(e, M, O, k) : Disposable.None;
	}
	doProvideWithoutEditorSymbols(e, O, k, A) {
		let j = new DisposableStore();
		return this.provideLabelPick(k, localize("cannotRunGotoSymbolWithoutSymbolProvider", "The active text editor does not provide symbol information.")), (async () => {
			!await this.waitForLanguageSymbolRegistry(O, j) || A.isCancellationRequested || j.add(this.doProvideWithEditorSymbols(e, O, k, A));
		})(), j;
	}
	provideLabelPick(e, O) {
		e.items = [{
			label: O,
			index: 0,
			kind: 14
		}], e.ariaLabel = O;
	}
	async waitForLanguageSymbolRegistry(e, O) {
		if (this._languageFeaturesService.documentSymbolProvider.has(e)) return !0;
		let k = new DeferredPromise(), A = O.add(this._languageFeaturesService.documentSymbolProvider.onDidChange(() => {
			this._languageFeaturesService.documentSymbolProvider.has(e) && (A.dispose(), k.complete(!0));
		}));
		return O.add(toDisposable(() => k.complete(!1))), k.p;
	}
	doProvideWithEditorSymbols(e, O, k, A, j) {
		let M = e.editor, N = new DisposableStore();
		N.add(k.onDidAccept((O) => {
			let [A] = k.selectedItems;
			A && A.range && (this.gotoLocation(e, {
				range: A.range.selection,
				keyMods: k.keyMods,
				preserveFocus: O.inBackground
			}), j?.handleAccept?.(A), O.inBackground || k.hide());
		})), N.add(k.onDidTriggerItemButton(({ item: O }) => {
			O && O.range && (this.gotoLocation(e, {
				range: O.range.selection,
				keyMods: k.keyMods,
				forceSideBySide: !0
			}), k.hide());
		}));
		let P = this.getDocumentSymbols(O, A), F, I = async (e) => {
			F?.dispose(!0), k.busy = !1, F = new CancellationTokenSource(A), k.busy = !0;
			try {
				let j = prepareQuery(k.value.substr(AbstractGotoSymbolQuickAccessProvider_1.PREFIX.length).trim()), M = await this.doGetSymbolPicks(P, j, void 0, F.token, O);
				if (A.isCancellationRequested) return;
				if (M.length > 0) {
					if (k.items = M, e && j.original.length === 0) {
						let O = findLast(M, (O) => !!(O.type !== "separator" && O.range && Range.containsPosition(O.range.decoration, e)));
						O && (k.activeItems = [O]);
					}
				} else j.original.length > 0 ? this.provideLabelPick(k, localize("noMatchingSymbolResults", "No matching editor symbols")) : this.provideLabelPick(k, localize("noSymbolResults", "No editor symbols"));
			} finally {
				A.isCancellationRequested || (k.busy = !1);
			}
		};
		return N.add(k.onDidChangeValue(() => I(void 0))), I(M.getSelection()?.getPosition()), N.add(k.onDidChangeActive(() => {
			let [e] = k.activeItems;
			e && e.range && (M.revealRangeInCenter(e.range.selection, 0), this.addDecorations(M, e.range.decoration));
		})), N;
	}
	async doGetSymbolPicks(e, O, k, A, j) {
		let M = await e;
		if (A.isCancellationRequested) return [];
		let N = O.original.indexOf(AbstractGotoSymbolQuickAccessProvider_1.SCOPE_PREFIX) === 0, P = N ? 1 : 0, F, I;
		O.values && O.values.length > 1 ? (F = pieceToQuery(O.values[0]), I = pieceToQuery(O.values.slice(1))) : F = O;
		let L, R = this.options?.openSideBySideDirection?.();
		R && (L = [{
			iconClass: R === "right" ? ThemeIcon.asClassName(Codicon.splitHorizontal) : ThemeIcon.asClassName(Codicon.splitVertical),
			tooltip: R === "right" ? localize("openToSide", "Open to the Side") : localize("openToBottom", "Open to the Bottom")
		}]);
		let z = [];
		for (let e = 0; e < M.length; e++) {
			let A = M[e], N = trim(A.name), R = `$(${SymbolKinds.toIcon(A.kind).id}) ${N}`, B = R.length - N.length, V = A.containerName;
			k?.extraContainerLabel && (V = V ? `${k.extraContainerLabel} • ${V}` : k.extraContainerLabel);
			let H, U, W, G;
			if (O.original.length > P) {
				let e = !1;
				if (F !== O && ([H, U] = scoreFuzzy2(R, {
					...O,
					values: void 0
				}, P, B), typeof H == "number" && (e = !0)), typeof H != "number" && ([H, U] = scoreFuzzy2(R, F, P, B), typeof H != "number")) continue;
				if (!e && I) {
					if (V && I.original.length > 0 && ([W, G] = scoreFuzzy2(V, I)), typeof W != "number") continue;
					typeof H == "number" && (H += W);
				}
			}
			let K = A.tags && A.tags.indexOf(1) >= 0;
			z.push({
				index: e,
				kind: A.kind,
				score: H,
				label: R,
				ariaLabel: getAriaLabelForSymbol(A.name, A.kind),
				description: V,
				highlights: K ? void 0 : {
					label: U,
					description: G
				},
				range: {
					selection: Range.collapseToStart(A.selectionRange),
					decoration: A.range
				},
				uri: j.uri,
				symbolName: N,
				strikethrough: K,
				buttons: L
			});
		}
		let B = z.sort((e, O) => N ? this.compareByKindAndScore(e, O) : this.compareByScore(e, O)), V = [];
		if (N) {
			let e, O, k = 0;
			function A() {
				O && typeof e == "number" && k > 0 && (O.label = format(NLS_SYMBOL_KIND_CACHE[e] || FALLBACK_NLS_SYMBOL_KIND, k));
			}
			for (let j of B) e === j.kind ? k++ : (A(), e = j.kind, k = 1, O = { type: "separator" }, V.push(O)), V.push(j);
			A();
		} else B.length > 0 && (V = [{
			label: localize("symbols", "symbols ({0})", z.length),
			type: "separator"
		}, ...B]);
		return V;
	}
	compareByScore(e, O) {
		if (typeof e.score != "number" && typeof O.score == "number") return 1;
		if (typeof e.score == "number" && typeof O.score != "number") return -1;
		if (typeof e.score == "number" && typeof O.score == "number") {
			if (e.score > O.score) return -1;
			if (e.score < O.score) return 1;
		}
		return e.index < O.index ? -1 : e.index > O.index ? 1 : 0;
	}
	compareByKindAndScore(e, O) {
		let k = NLS_SYMBOL_KIND_CACHE[e.kind] || FALLBACK_NLS_SYMBOL_KIND, A = NLS_SYMBOL_KIND_CACHE[O.kind] || FALLBACK_NLS_SYMBOL_KIND, j = k.localeCompare(A);
		return j === 0 ? this.compareByScore(e, O) : j;
	}
	async getDocumentSymbols(e, O) {
		let k = await this._outlineModelService.getOrCreate(e, O);
		return O.isCancellationRequested ? [] : k.asListOfDocumentSymbols();
	}
};
AbstractGotoSymbolQuickAccessProvider = AbstractGotoSymbolQuickAccessProvider_1 = __decorate$4([__param$4(0, ILanguageFeaturesService), __param$4(1, IOutlineModelService)], AbstractGotoSymbolQuickAccessProvider);
var FALLBACK_NLS_SYMBOL_KIND = localize("property", "properties ({0})"), NLS_SYMBOL_KIND_CACHE = {
	5: localize("method", "methods ({0})"),
	11: localize("function", "functions ({0})"),
	8: localize("_constructor", "constructors ({0})"),
	12: localize("variable", "variables ({0})"),
	4: localize("class", "classes ({0})"),
	22: localize("struct", "structs ({0})"),
	23: localize("event", "events ({0})"),
	24: localize("operator", "operators ({0})"),
	10: localize("interface", "interfaces ({0})"),
	2: localize("namespace", "namespaces ({0})"),
	3: localize("package", "packages ({0})"),
	25: localize("typeParameter", "type parameters ({0})"),
	1: localize("modules", "modules ({0})"),
	6: localize("property", "properties ({0})"),
	9: localize("enum", "enumerations ({0})"),
	21: localize("enumMember", "enumeration members ({0})"),
	14: localize("string", "strings ({0})"),
	0: localize("file", "files ({0})"),
	17: localize("array", "arrays ({0})"),
	15: localize("number", "numbers ({0})"),
	16: localize("boolean", "booleans ({0})"),
	18: localize("object", "objects ({0})"),
	19: localize("key", "keys ({0})"),
	7: localize("field", "fields ({0})"),
	13: localize("constant", "constants ({0})")
}, __decorate$3 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$3 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, StandaloneGotoSymbolQuickAccessProvider = class extends AbstractGotoSymbolQuickAccessProvider {
	constructor(e, O, k) {
		super(O, k), this.editorService = e, this.onDidActiveTextEditorControlChange = Event.None;
	}
	get activeTextEditorControl() {
		return this.editorService.getFocusedCodeEditor() ?? void 0;
	}
};
StandaloneGotoSymbolQuickAccessProvider = __decorate$3([
	__param$3(0, ICodeEditorService),
	__param$3(1, ILanguageFeaturesService),
	__param$3(2, IOutlineModelService)
], StandaloneGotoSymbolQuickAccessProvider);
var GotoSymbolAction = class e extends EditorAction {
	static {
		this.ID = "editor.action.quickOutline";
	}
	constructor() {
		super({
			id: e.ID,
			label: QuickOutlineNLS.quickOutlineActionLabel,
			alias: "Go to Symbol...",
			precondition: EditorContextKeys.hasDocumentSymbolProvider,
			kbOpts: {
				kbExpr: EditorContextKeys.focus,
				primary: 3117,
				weight: 100
			},
			contextMenuOpts: {
				group: "navigation",
				order: 3
			}
		});
	}
	run(e) {
		e.get(IQuickInputService).quickAccess.show(AbstractGotoSymbolQuickAccessProvider.PREFIX, { itemActivation: ItemActivation.NONE });
	}
};
registerEditorAction(GotoSymbolAction), Registry.as(Extensions.Quickaccess).registerQuickAccessProvider({
	ctor: StandaloneGotoSymbolQuickAccessProvider,
	prefix: AbstractGotoSymbolQuickAccessProvider.PREFIX,
	helpEntries: [{
		description: QuickOutlineNLS.quickOutlineActionLabel,
		prefix: AbstractGotoSymbolQuickAccessProvider.PREFIX,
		commandId: GotoSymbolAction.ID
	}, {
		description: QuickOutlineNLS.quickOutlineByCategoryActionLabel,
		prefix: AbstractGotoSymbolQuickAccessProvider.PREFIX_BY_CATEGORY
	}]
});
function countMapFrom(e) {
	let O = /* @__PURE__ */ new Map();
	for (let k of e) O.set(k, (O.get(k) ?? 0) + 1);
	return O;
}
var TfIdfCalculator = class e {
	constructor() {
		this.chunkCount = 0, this.chunkOccurrences = /* @__PURE__ */ new Map(), this.documents = /* @__PURE__ */ new Map();
	}
	calculateScores(e, O) {
		let k = this.computeEmbedding(e), A = /* @__PURE__ */ new Map(), j = [];
		for (let [e, M] of this.documents) {
			if (O.isCancellationRequested) return [];
			for (let O of M.chunks) {
				let M = this.computeSimilarityScore(O, k, A);
				M > 0 && j.push({
					key: e,
					score: M
				});
			}
		}
		return j;
	}
	static termFrequencies(O) {
		return countMapFrom(e.splitTerms(O));
	}
	static *splitTerms(e) {
		let O = (e) => e.toLowerCase();
		for (let [k] of e.matchAll(/\b\p{Letter}[\p{Letter}\d]{2,}\b/gu)) {
			yield O(k);
			let e = k.replace(/([a-z])([A-Z])/g, "$1 $2").split(/\s+/g);
			if (e.length > 1) for (let k of e) k.length > 2 && /\p{Letter}{3,}/gu.test(k) && (yield O(k));
		}
	}
	updateDocuments(O) {
		for (let { key: e } of O) this.deleteDocument(e);
		for (let k of O) {
			let O = [];
			for (let A of k.textChunks) {
				let k = e.termFrequencies(A);
				for (let e of k.keys()) this.chunkOccurrences.set(e, (this.chunkOccurrences.get(e) ?? 0) + 1);
				O.push({
					text: A,
					tf: k
				});
			}
			this.chunkCount += O.length, this.documents.set(k.key, { chunks: O });
		}
		return this;
	}
	deleteDocument(e) {
		let O = this.documents.get(e);
		if (O) {
			this.documents.delete(e), this.chunkCount -= O.chunks.length;
			for (let e of O.chunks) for (let O of e.tf.keys()) {
				let e = this.chunkOccurrences.get(O);
				if (typeof e == "number") {
					let k = e - 1;
					k <= 0 ? this.chunkOccurrences.delete(O) : this.chunkOccurrences.set(O, k);
				}
			}
		}
	}
	computeSimilarityScore(e, O, k) {
		let A = 0;
		for (let [j, M] of Object.entries(O)) {
			let O = e.tf.get(j);
			if (!O) continue;
			let N = k.get(j);
			typeof N != "number" && (N = this.computeIdf(j), k.set(j, N));
			let P = O * N;
			A += P * M;
		}
		return A;
	}
	computeEmbedding(O) {
		let k = e.termFrequencies(O);
		return this.computeTfidf(k);
	}
	computeIdf(e) {
		let O = this.chunkOccurrences.get(e) ?? 0;
		return O > 0 ? Math.log((this.chunkCount + 1) / O) : 0;
	}
	computeTfidf(e) {
		let O = Object.create(null);
		for (let [k, A] of e) {
			let e = this.computeIdf(k);
			e > 0 && (O[k] = A * e);
		}
		return O;
	}
};
function normalizeTfIdfScores(e) {
	let O = e.slice(0);
	O.sort((e, O) => O.score - e.score);
	let k = O[0]?.score ?? 0;
	if (k > 0) for (let e of O) e.score /= k;
	return O;
}
var TriggerAction;
(function(e) {
	e[e.NO_ACTION = 0] = "NO_ACTION", e[e.CLOSE_PICKER = 1] = "CLOSE_PICKER", e[e.REFRESH_PICKER = 2] = "REFRESH_PICKER", e[e.REMOVE_ITEM = 3] = "REMOVE_ITEM";
})(TriggerAction ||= {});
function isPicksWithActive(e) {
	let O = e;
	return Array.isArray(O.items);
}
function isFastAndSlowPicks(e) {
	let O = e;
	return !!O.picks && O.additionalPicks instanceof Promise;
}
var PickerQuickAccessProvider = class extends Disposable {
	constructor(e, O) {
		super(), this.prefix = e, this.options = O;
	}
	provide(e, O, k) {
		let A = new DisposableStore();
		e.canAcceptInBackground = !!this.options?.canAcceptInBackground, e.matchOnLabel = e.matchOnDescription = e.matchOnDetail = e.sortByLabel = !1;
		let j, M = A.add(new MutableDisposable()), N = async () => {
			let A = M.value = new DisposableStore();
			j?.dispose(!0), e.busy = !1, j = new CancellationTokenSource(O);
			let N = j.token, P = e.value.substring(this.prefix.length);
			this.options?.shouldSkipTrimPickFilter || (P = P.trim());
			let F = this._getPicks(P, A, N, k), I = (O, k) => {
				let A, j;
				if (isPicksWithActive(O) ? (A = O.items, j = O.active) : A = O, A.length === 0) {
					if (k) return !1;
					(P.length > 0 || e.hideInput) && this.options?.noResultsPick && (A = isFunction(this.options.noResultsPick) ? [this.options.noResultsPick(P)] : [this.options.noResultsPick]);
				}
				return e.items = A, j && (e.activeItems = [j]), !0;
			}, L = async (O) => {
				let k = !1, A = !1;
				await Promise.all([(async () => {
					typeof O.mergeDelay == "number" && (await timeout(O.mergeDelay), N.isCancellationRequested) || A || (k = I(O.picks, !0));
				})(), (async () => {
					e.busy = !0;
					try {
						let A = await O.additionalPicks;
						if (N.isCancellationRequested) return;
						let j, M;
						isPicksWithActive(O.picks) ? (j = O.picks.items, M = O.picks.active) : j = O.picks;
						let P, F;
						if (isPicksWithActive(A) ? (P = A.items, F = A.active) : P = A, P.length > 0 || !k) {
							let O;
							if (!M && !F) {
								let k = e.activeItems[0];
								k && j.indexOf(k) !== -1 && (O = k);
							}
							I({
								items: [...j, ...P],
								active: M || F || O
							});
						}
					} finally {
						N.isCancellationRequested || (e.busy = !1), A = !0;
					}
				})()]);
			};
			if (F !== null) if (isFastAndSlowPicks(F)) await L(F);
			else if (!(F instanceof Promise)) I(F);
			else {
				e.busy = !0;
				try {
					let e = await F;
					if (N.isCancellationRequested) return;
					isFastAndSlowPicks(e) ? await L(e) : I(e);
				} finally {
					N.isCancellationRequested || (e.busy = !1);
				}
			}
		};
		A.add(e.onDidChangeValue(() => N())), N(), A.add(e.onDidAccept((O) => {
			if (k?.handleAccept) {
				O.inBackground || e.hide(), k.handleAccept?.(e.activeItems[0]);
				return;
			}
			let [A] = e.selectedItems;
			typeof A?.accept == "function" && (O.inBackground || e.hide(), A.accept(e.keyMods, O));
		}));
		let P = async (k, A) => {
			if (typeof A.trigger != "function") return;
			let j = A.buttons?.indexOf(k) ?? -1;
			if (j >= 0) {
				let k = A.trigger(j, e.keyMods), M = typeof k == "number" ? k : await k;
				if (O.isCancellationRequested) return;
				switch (M) {
					case TriggerAction.NO_ACTION: break;
					case TriggerAction.CLOSE_PICKER:
						e.hide();
						break;
					case TriggerAction.REFRESH_PICKER:
						N();
						break;
					case TriggerAction.REMOVE_ITEM: {
						let O = e.items.indexOf(A);
						if (O !== -1) {
							let k = e.items.slice(), A = k.splice(O, 1), j = e.activeItems.filter((e) => e !== A[0]), M = e.keepScrollPosition;
							e.keepScrollPosition = !0, e.items = k, j && (e.activeItems = j), e.keepScrollPosition = M;
						}
						break;
					}
				}
			}
		};
		return A.add(e.onDidTriggerItemButton(({ button: e, item: O }) => P(e, O))), A.add(e.onDidTriggerSeparatorButton(({ button: e, separator: O }) => P(e, O))), A;
	}
}, __decorate$2 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$2 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, AbstractCommandsQuickAccessProvider_1, CommandsHistory_1, AbstractCommandsQuickAccessProvider = class extends PickerQuickAccessProvider {
	static {
		AbstractCommandsQuickAccessProvider_1 = this;
	}
	static {
		this.PREFIX = ">";
	}
	static {
		this.TFIDF_THRESHOLD = .5;
	}
	static {
		this.TFIDF_MAX_RESULTS = 5;
	}
	static {
		this.WORD_FILTER = or(matchesPrefix, matchesWords, matchesContiguousSubString);
	}
	constructor(e, O, k, A, j, M) {
		super(AbstractCommandsQuickAccessProvider_1.PREFIX, e), this.instantiationService = O, this.keybindingService = k, this.commandService = A, this.telemetryService = j, this.dialogService = M, this.commandsHistory = this._register(this.instantiationService.createInstance(CommandsHistory)), this.options = e;
	}
	async _getPicks(e, O, k, A) {
		let j = await this.getCommandPicks(k);
		if (k.isCancellationRequested) return [];
		let M = createSingleCallFunction(() => {
			let O = new TfIdfCalculator();
			O.updateDocuments(j.map((e) => ({
				key: e.commandId,
				textChunks: [this.getTfIdfChunk(e)]
			})));
			let A = O.calculateScores(e, k);
			return normalizeTfIdfScores(A).filter((e) => e.score > AbstractCommandsQuickAccessProvider_1.TFIDF_THRESHOLD).slice(0, AbstractCommandsQuickAccessProvider_1.TFIDF_MAX_RESULTS);
		}), N = [];
		for (let O of j) {
			let A = AbstractCommandsQuickAccessProvider_1.WORD_FILTER(e, O.label) ?? void 0, j = O.commandAlias ? AbstractCommandsQuickAccessProvider_1.WORD_FILTER(e, O.commandAlias) ?? void 0 : void 0;
			if (A || j) O.highlights = {
				label: A,
				detail: this.options.showAlias ? j : void 0
			}, N.push(O);
			else if (e === O.commandId) N.push(O);
			else if (e.length >= 3) {
				let e = M();
				if (k.isCancellationRequested) return [];
				let A = e.find((e) => e.key === O.commandId);
				A && (O.tfIdfScore = A.score, N.push(O));
			}
		}
		let P = /* @__PURE__ */ new Map();
		for (let e of N) {
			let O = P.get(e.label);
			O ? (e.description = e.commandId, O.description = O.commandId) : P.set(e.label, e);
		}
		N.sort((e, O) => {
			if (e.tfIdfScore && O.tfIdfScore) return e.tfIdfScore === O.tfIdfScore ? e.label.localeCompare(O.label) : O.tfIdfScore - e.tfIdfScore;
			if (e.tfIdfScore) return 1;
			if (O.tfIdfScore) return -1;
			let k = this.commandsHistory.peek(e.commandId), A = this.commandsHistory.peek(O.commandId);
			if (k && A) return k > A ? -1 : 1;
			if (k) return -1;
			if (A) return 1;
			if (this.options.suggestedCommandIds) {
				let k = this.options.suggestedCommandIds.has(e.commandId), A = this.options.suggestedCommandIds.has(O.commandId);
				if (k && A) return 0;
				if (k) return -1;
				if (A) return 1;
			}
			return e.label.localeCompare(O.label);
		});
		let F = [], I = !1, L = !0, R = !!this.options.suggestedCommandIds;
		for (let e = 0; e < N.length; e++) {
			let O = N[e];
			e === 0 && this.commandsHistory.peek(O.commandId) && (F.push({
				type: "separator",
				label: localize("recentlyUsed", "recently used")
			}), I = !0), L && O.tfIdfScore !== void 0 && (F.push({
				type: "separator",
				label: localize("suggested", "similar commands")
			}), L = !1), R && O.tfIdfScore === void 0 && !this.commandsHistory.peek(O.commandId) && this.options.suggestedCommandIds?.has(O.commandId) && (F.push({
				type: "separator",
				label: localize("commonlyUsed", "commonly used")
			}), I = !0, R = !1), I && O.tfIdfScore === void 0 && !this.commandsHistory.peek(O.commandId) && !this.options.suggestedCommandIds?.has(O.commandId) && (F.push({
				type: "separator",
				label: localize("morecCommands", "other commands")
			}), I = !1), F.push(this.toCommandPick(O, A));
		}
		return this.hasAdditionalCommandPicks(e, k) ? {
			picks: F,
			additionalPicks: (async () => {
				let O = await this.getAdditionalCommandPicks(j, N, e, k);
				if (k.isCancellationRequested) return [];
				let M = O.map((e) => this.toCommandPick(e, A));
				return L && M[0]?.type !== "separator" && M.unshift({
					type: "separator",
					label: localize("suggested", "similar commands")
				}), M;
			})()
		} : F;
	}
	toCommandPick(e, O) {
		if (e.type === "separator") return e;
		let k = this.keybindingService.lookupKeybinding(e.commandId), A = k ? localize("commandPickAriaLabelWithKeybinding", "{0}, {1}", e.label, k.getAriaLabel()) : e.label;
		return {
			...e,
			ariaLabel: A,
			detail: this.options.showAlias && e.commandAlias !== e.label ? e.commandAlias : void 0,
			keybinding: k,
			accept: async () => {
				this.commandsHistory.push(e.commandId), this.telemetryService.publicLog2("workbenchActionExecuted", {
					id: e.commandId,
					from: O?.from ?? "quick open"
				});
				try {
					e.args?.length ? await this.commandService.executeCommand(e.commandId, ...e.args) : await this.commandService.executeCommand(e.commandId);
				} catch (O) {
					isCancellationError(O) || this.dialogService.error(localize("canNotRun", "Command '{0}' resulted in an error", e.label), toErrorMessage(O));
				}
			}
		};
	}
	getTfIdfChunk({ label: e, commandAlias: O, commandDescription: k }) {
		let A = e;
		return O && O !== e && (A += ` - ${O}`), k && k.value !== e && (A += ` - ${k.value === k.original ? k.value : `${k.value} (${k.original})`}`), A;
	}
};
AbstractCommandsQuickAccessProvider = AbstractCommandsQuickAccessProvider_1 = __decorate$2([
	__param$2(1, IInstantiationService),
	__param$2(2, IKeybindingService),
	__param$2(3, ICommandService),
	__param$2(4, ITelemetryService),
	__param$2(5, IDialogService)
], AbstractCommandsQuickAccessProvider);
var CommandsHistory = class extends Disposable {
	static {
		CommandsHistory_1 = this;
	}
	static {
		this.DEFAULT_COMMANDS_HISTORY_LENGTH = 50;
	}
	static {
		this.PREF_KEY_CACHE = "commandPalette.mru.cache";
	}
	static {
		this.PREF_KEY_COUNTER = "commandPalette.mru.counter";
	}
	static {
		this.counter = 1;
	}
	static {
		this.hasChanges = !1;
	}
	constructor(e, O, k) {
		super(), this.storageService = e, this.configurationService = O, this.logService = k, this.configuredCommandsHistoryLength = 0, this.updateConfiguration(), this.load(), this.registerListeners();
	}
	registerListeners() {
		this._register(this.configurationService.onDidChangeConfiguration((e) => this.updateConfiguration(e))), this._register(this.storageService.onWillSaveState((e) => {
			e.reason === WillSaveStateReason.SHUTDOWN && this.saveState();
		}));
	}
	updateConfiguration(e) {
		e && !e.affectsConfiguration("workbench.commandPalette.history") || (this.configuredCommandsHistoryLength = CommandsHistory_1.getConfiguredCommandHistoryLength(this.configurationService), CommandsHistory_1.cache && CommandsHistory_1.cache.limit !== this.configuredCommandsHistoryLength && (CommandsHistory_1.cache.limit = this.configuredCommandsHistoryLength, CommandsHistory_1.hasChanges = !0));
	}
	load() {
		let e = this.storageService.get(CommandsHistory_1.PREF_KEY_CACHE, 0), O;
		if (e) try {
			O = JSON.parse(e);
		} catch (e) {
			this.logService.error(`[CommandsHistory] invalid data: ${e}`);
		}
		let k = CommandsHistory_1.cache = new LRUCache(this.configuredCommandsHistoryLength, 1);
		if (O) {
			let e;
			e = O.usesLRU ? O.entries : O.entries.sort((e, O) => e.value - O.value), e.forEach((e) => k.set(e.key, e.value));
		}
		CommandsHistory_1.counter = this.storageService.getNumber(CommandsHistory_1.PREF_KEY_COUNTER, 0, CommandsHistory_1.counter);
	}
	push(e) {
		CommandsHistory_1.cache && (CommandsHistory_1.cache.set(e, CommandsHistory_1.counter++), CommandsHistory_1.hasChanges = !0);
	}
	peek(e) {
		return CommandsHistory_1.cache?.peek(e);
	}
	saveState() {
		if (!CommandsHistory_1.cache || !CommandsHistory_1.hasChanges) return;
		let e = {
			usesLRU: !0,
			entries: []
		};
		CommandsHistory_1.cache.forEach((O, k) => e.entries.push({
			key: k,
			value: O
		})), this.storageService.store(CommandsHistory_1.PREF_KEY_CACHE, JSON.stringify(e), 0, 0), this.storageService.store(CommandsHistory_1.PREF_KEY_COUNTER, CommandsHistory_1.counter, 0, 0), CommandsHistory_1.hasChanges = !1;
	}
	static getConfiguredCommandHistoryLength(e) {
		let O = e.getValue().workbench?.commandPalette?.history;
		return typeof O == "number" ? O : CommandsHistory_1.DEFAULT_COMMANDS_HISTORY_LENGTH;
	}
};
CommandsHistory = CommandsHistory_1 = __decorate$2([
	__param$2(0, IStorageService),
	__param$2(1, IConfigurationService),
	__param$2(2, ILogService)
], CommandsHistory);
var AbstractEditorCommandsQuickAccessProvider = class extends AbstractCommandsQuickAccessProvider {
	constructor(e, O, k, A, j, M) {
		super(e, O, k, A, j, M);
	}
	getCodeEditorCommandPicks() {
		let e = this.activeTextEditorControl;
		if (!e) return [];
		let O = [];
		for (let k of e.getSupportedActions()) {
			let e;
			k.metadata?.description && (e = isLocalizedString(k.metadata.description) ? k.metadata.description : {
				original: k.metadata.description,
				value: k.metadata.description
			}), O.push({
				commandId: k.id,
				commandAlias: k.alias,
				commandDescription: e,
				label: stripIcons(k.label) || k.id
			});
		}
		return O;
	}
}, __decorate$1 = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param$1 = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, StandaloneCommandsQuickAccessProvider = class extends AbstractEditorCommandsQuickAccessProvider {
	get activeTextEditorControl() {
		return this.codeEditorService.getFocusedCodeEditor() ?? void 0;
	}
	constructor(e, O, k, A, j, M) {
		super({ showAlias: !1 }, e, k, A, j, M), this.codeEditorService = O;
	}
	async getCommandPicks() {
		return this.getCodeEditorCommandPicks();
	}
	hasAdditionalCommandPicks() {
		return !1;
	}
	async getAdditionalCommandPicks() {
		return [];
	}
};
StandaloneCommandsQuickAccessProvider = __decorate$1([
	__param$1(0, IInstantiationService),
	__param$1(1, ICodeEditorService),
	__param$1(2, IKeybindingService),
	__param$1(3, ICommandService),
	__param$1(4, ITelemetryService),
	__param$1(5, IDialogService)
], StandaloneCommandsQuickAccessProvider);
var GotoLineAction = class e extends EditorAction {
	static {
		this.ID = "editor.action.quickCommand";
	}
	constructor() {
		super({
			id: e.ID,
			label: QuickCommandNLS.quickCommandActionLabel,
			alias: "Command Palette",
			precondition: void 0,
			kbOpts: {
				kbExpr: EditorContextKeys.focus,
				primary: 59,
				weight: 100
			},
			contextMenuOpts: {
				group: "z_commands",
				order: 1
			}
		});
	}
	run(e) {
		e.get(IQuickInputService).quickAccess.show(StandaloneCommandsQuickAccessProvider.PREFIX);
	}
};
registerEditorAction(GotoLineAction), Registry.as(Extensions.Quickaccess).registerQuickAccessProvider({
	ctor: StandaloneCommandsQuickAccessProvider,
	prefix: StandaloneCommandsQuickAccessProvider.PREFIX,
	helpEntries: [{
		description: QuickCommandNLS.quickCommandHelp,
		commandId: GotoLineAction.ID
	}]
});
var __decorate = function(e, O, k, A) {
	var j = arguments.length, M = j < 3 ? O : A === null ? A = Object.getOwnPropertyDescriptor(O, k) : A, N;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") M = Reflect.decorate(e, O, k, A);
	else for (var P = e.length - 1; P >= 0; P--) (N = e[P]) && (M = (j < 3 ? N(M) : j > 3 ? N(O, k, M) : N(O, k)) || M);
	return j > 3 && M && Object.defineProperty(O, k, M), M;
}, __param = function(e, O) {
	return function(k, A) {
		O(k, A, e);
	};
}, StandaloneReferencesController = class extends ReferencesController {
	constructor(e, O, k, A, j, M, N) {
		super(!0, e, O, k, A, j, M, N);
	}
};
StandaloneReferencesController = __decorate([
	__param(1, IContextKeyService),
	__param(2, ICodeEditorService),
	__param(3, INotificationService),
	__param(4, IInstantiationService),
	__param(5, IStorageService),
	__param(6, IConfigurationService)
], StandaloneReferencesController), registerEditorContribution(ReferencesController.ID, StandaloneReferencesController, 4), registerEditorAction(class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.toggleHighContrast",
			label: ToggleHighContrastNLS.toggleHighContrast,
			alias: "Toggle High Contrast Theme",
			precondition: void 0
		}), this._originalThemeName = null;
	}
	run(e, O) {
		let k = e.get(IStandaloneThemeService), A = k.getColorTheme();
		isHighContrast(A.type) ? (k.setTheme(this._originalThemeName || (isDark(A.type) ? "vs-dark" : "vs")), this._originalThemeName = null) : (k.setTheme(isDark(A.type) ? HC_BLACK_THEME_NAME : HC_LIGHT_THEME_NAME), this._originalThemeName = A.themeName);
	}
});
export { getEnterLeaveForKind as $, assertInterfaceType as A, isInterfaceType as B, GraphQLInputObjectType as C, GraphQLObjectType as D, GraphQLNonNull as E, isAbstractType as F, isObjectType as G, isListType as H, isCompositeType as I, isRequiredInputField as J, isOutputType as K, isEnumType as L, assertObjectType as M, getNamedType as N, GraphQLScalarType as O, getNullableType as P, print as Q, isInputObjectType as R, GraphQLEnumType as S, GraphQLList as T, isNonNullType as U, isLeafType as V, isNullableType as W, isType as X, isScalarType as Y, isUnionType as Z, GraphQLSpecifiedByDirective as _, invariant as _t, TypeKind as a, keyValMap as at, isSpecifiedScalarType as b, introspectionTypes as c, parse as ct, DEFAULT_DEPRECATION_REASON as d, isPrintableAsBlockString as dt, visit as et, GraphQLDeprecatedDirective as f, Kind as ft, GraphQLSkipDirective as g, GraphQLError as gt, GraphQLOneOfDirective as h, isNode as ht, SchemaMetaFieldDef as i, mapValue as it, assertNullableType as j, GraphQLUnionType as k, isIntrospectionType as l, parseValue as lt, GraphQLIncludeDirective as m, OperationTypeNode as mt, valueFromAST as n, suggestionList as nt, TypeMetaFieldDef as o, keyMap as ot, GraphQLDirective as p, DirectiveLocation as pt, isRequiredArgument as q, GraphQLSchema as r, naturalCompare as rt, TypeNameMetaFieldDef as s, didYouMean as st, registerLanguage as t, visitInParallel as tt, astFromValue as u, inspect as ut, isSpecifiedDirective as v, isObjectLike as vt, GraphQLInterfaceType as w, specifiedScalarTypes as x, specifiedDirectives as y, devAssert as yt, isInputType as z };