UNPKG

@graphql-hive/laboratory

Version:

[Hive](https://the-guild.dev/graphql/hive) is a fully open-source schema registry, analytics, metrics and gateway for [GraphQL federation](https://the-guild.dev/graphql/hive/federation) and other GraphQL APIs.

40,497 lines • 1.68 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, Ku as __commonJSMin, 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, Yu as __toESM, 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$1, 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$1, 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-DPgI1LYm.js";
var require_version = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.version = "16.14.2", e.versionInfo = Object.freeze({
		major: 16,
		minor: 14,
		patch: 2,
		preReleaseTag: null
	});
})), require_devAssert = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.devAssert = n;
	function n(e, n) {
		if (!e) throw Error(n);
	}
})), require_isPromise = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.isPromise = n;
	function n(e) {
		return typeof e?.then == "function";
	}
})), require_isObjectLike = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.isObjectLike = n;
	function n(e) {
		return typeof e == "object" && !!e;
	}
})), require_invariant = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.invariant = n;
	function n(e, n) {
		if (!e) throw Error(n ?? "Unexpected invariant triggered.");
	}
})), require_location = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.getLocation = i;
	var n = require_invariant(), r = /\r\n|[\n\r]/g;
	function i(e, i) {
		let a = 0, o = 1;
		for (let s of e.body.matchAll(r)) {
			if (typeof s.index == "number" || (0, n.invariant)(!1), s.index >= i) break;
			a = s.index + s[0].length, o += 1;
		}
		return {
			line: o,
			column: i + 1 - a
		};
	}
})), require_printLocation = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.printLocation = r, e.printSourceLocation = i;
	var n = require_location();
	function r(e) {
		return i(e.source, (0, n.getLocation)(e.source, e.start));
	}
	function i(e, n) {
		let r = e.locationOffset.column - 1, i = "".padStart(r) + e.body, o = n.line - 1, s = e.locationOffset.line - 1, c = n.line + s, l = n.line === 1 ? r : 0, u = n.column + l, d = `${e.name}:${c}:${u}\n`, f = i.split(/\r\n|[\n\r]/g), m = f[o];
		if (m.length > 120) {
			let e = Math.floor(u / 80), n = u % 80, r = [];
			for (let e = 0; e < m.length; e += 80) r.push(m.slice(e, e + 80));
			return d + a([
				[`${c} |`, r[0]],
				...r.slice(1, e + 1).map((e) => ["|", e]),
				["|", "^".padStart(n)],
				["|", r[e + 1]]
			]);
		}
		return d + a([
			[`${c - 1} |`, f[o - 1]],
			[`${c} |`, m],
			["|", "^".padStart(u)],
			[`${c + 1} |`, f[o + 1]]
		]);
	}
	function a(e) {
		let n = e.filter(([e, n]) => n !== void 0), r = Math.max(...n.map(([e]) => e.length));
		return n.map(([e, n]) => e.padStart(r) + (n ? " " + n : "")).join("\n");
	}
})), require_GraphQLError = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.formatError = c, e.printError = s;
	var n = require_isObjectLike(), r = require_location(), i = require_printLocation();
	function a(e) {
		let n = e[0];
		return n == null || "kind" in n || "length" in n ? {
			nodes: n,
			source: e[1],
			positions: e[2],
			path: e[3],
			originalError: e[4],
			extensions: e[5]
		} : n;
	}
	e.GraphQLError = class e extends Error {
		constructor(i, ...s) {
			let { nodes: c, source: l, positions: u, path: d, originalError: f, extensions: m } = a(s);
			super(i), this.name = "GraphQLError", this.path = d ?? void 0, this.originalError = f ?? void 0, this.nodes = o(Array.isArray(c) ? c : c ? [c] : void 0);
			let g = o(this.nodes?.map((e) => e.loc).filter((e) => e != null));
			this.source = l ?? g?.[0]?.source, this.positions = u ?? g?.map((e) => e.start), this.locations = u && l ? u.map((e) => (0, r.getLocation)(l, e)) : g?.map((e) => (0, r.getLocation)(e.source, e.start));
			let _ = (0, n.isObjectLike)(f?.extensions) ? f?.extensions : void 0;
			/* c8 ignore start */
			this.extensions = m ?? _ ?? 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 }
			}), f != null && f.stack ? Object.defineProperty(this, "stack", {
				value: f.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 n of this.nodes) n.loc && (e += "\n\n" + (0, i.printLocation)(n.loc));
			else if (this.source && this.locations) for (let n of this.locations) e += "\n\n" + (0, i.printSourceLocation)(this.source, n);
			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 o(e) {
		return e === void 0 || e.length === 0 ? void 0 : e;
	}
	function s(e) {
		return e.toString();
	}
	function c(e) {
		return e.toJSON();
	}
})), require_syntaxError = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.syntaxError = r;
	var n = require_GraphQLError();
	function r(e, r, i) {
		return new n.GraphQLError(`Syntax Error: ${i}`, {
			source: e,
			positions: [r]
		});
	}
})), require_ast = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.isNode = i, e.Location = class {
		constructor(e, n, r) {
			this.start = e.start, this.end = n.end, this.startToken = e, this.endToken = n, this.source = r;
		}
		get [Symbol.toStringTag]() {
			return "Location";
		}
		toJSON() {
			return {
				start: this.start,
				end: this.end
			};
		}
	}, e.Token = class {
		constructor(e, n, r, i, a, o) {
			this.kind = e, this.start = n, this.end = r, this.line = i, this.column = a, this.value = o, 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
			};
		}
	};
	var n = {
		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",
			"directives",
			"locations"
		],
		SchemaExtension: ["directives", "operationTypes"],
		DirectiveExtension: ["name", "directives"],
		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"]
	};
	e.QueryDocumentKeys = n;
	var r = new Set(Object.keys(n));
	function i(e) {
		let n = e?.kind;
		return typeof n == "string" && r.has(n);
	}
	var a;
	(function(e) {
		e.QUERY = "query", e.MUTATION = "mutation", e.SUBSCRIPTION = "subscription";
	})(a || (e.OperationTypeNode = a = {}));
})), require_directiveLocation = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 });
	var n;
	(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", e.DIRECTIVE_DEFINITION = "DIRECTIVE_DEFINITION";
	})(n || (e.DirectiveLocation = n = {}));
})), require_kinds = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 });
	var n;
	(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.DIRECTIVE_EXTENSION = "DirectiveExtension", 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";
	})(n || (e.Kind = n = {}));
})), require_characterClasses = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.isDigit = r, e.isLetter = i, e.isNameContinue = o, e.isNameStart = a, e.isWhiteSpace = n;
	function n(e) {
		return e === 9 || e === 32;
	}
	function r(e) {
		return e >= 48 && e <= 57;
	}
	function i(e) {
		return e >= 97 && e <= 122 || e >= 65 && e <= 90;
	}
	function a(e) {
		return i(e) || e === 95;
	}
	function o(e) {
		return i(e) || r(e) || e === 95;
	}
})), require_blockString = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.dedentBlockStringLines = r, e.isPrintableAsBlockString = a, e.printBlockString = o;
	var n = require_characterClasses();
	function r(e) {
		let n = 2 ** 53 - 1, r = null, a = -1;
		for (let o = 0; o < e.length; ++o) {
			let s = e[o], c = i(s);
			c !== s.length && (r ??= o, a = o, o !== 0 && c < n && (n = c));
		}
		return e.map((e, r) => r === 0 ? e : e.slice(n)).slice(r ?? 0, a + 1);
	}
	function i(e) {
		let r = 0;
		for (; r < e.length && (0, n.isWhiteSpace)(e.charCodeAt(r));) ++r;
		return r;
	}
	function a(e) {
		if (e === "") return !0;
		let n = !0, r = !1, i = !0, a = !1;
		for (let o = 0; o < e.length; ++o) switch (e.codePointAt(o)) {
			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 (n && !a) return !1;
				a = !0, n = !0, r = !1;
				break;
			case 9:
			case 32:
				r ||= n;
				break;
			default: i &&= r, n = !1;
		}
		return !(n || i && a);
	}
	function o(e, r) {
		let i = e.replace(/"""/g, "\\\"\"\""), a = i.split(/\r\n|[\n\r]/g), o = a.length === 1, s = a.length > 1 && a.slice(1).every((e) => e.length === 0 || (0, n.isWhiteSpace)(e.charCodeAt(0))), c = i.endsWith("\\\"\"\""), l = e.endsWith("\"") && !c, u = e.endsWith("\\"), d = l || u, f = !(r != null && r.minimize) && (!o || e.length > 70 || d || s || c), m = "", g = o && (0, n.isWhiteSpace)(e.charCodeAt(0));
		return (f && !g || s) && (m += "\n"), m += i, (f || d) && (m += "\n"), "\"\"\"" + m + "\"\"\"";
	}
})), require_tokenKind = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 });
	var n;
	(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";
	})(n || (e.TokenKind = n = {}));
})), require_lexer = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.createToken = m, e.isPunctuatorTokenKind = s, e.printCodePointAt = f, e.readName = D;
	var n = require_syntaxError(), r = require_ast(), i = require_blockString(), a = require_characterClasses(), o = require_tokenKind();
	e.Lexer = class {
		constructor(e) {
			let n = new r.Token(o.TokenKind.SOF, 0, 0, 0, 0);
			this.source = e, this.lastToken = n, this.token = n, 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 !== o.TokenKind.EOF) do
				if (e.next) e = e.next;
				else {
					let n = g(this, e.end);
					e.next = n, n.prev = e, e = n;
				}
			while (e.kind === o.TokenKind.COMMENT);
			return e;
		}
	};
	function s(e) {
		return e === o.TokenKind.BANG || e === o.TokenKind.DOLLAR || e === o.TokenKind.AMP || e === o.TokenKind.PAREN_L || e === o.TokenKind.PAREN_R || e === o.TokenKind.DOT || e === o.TokenKind.SPREAD || e === o.TokenKind.COLON || e === o.TokenKind.EQUALS || e === o.TokenKind.AT || e === o.TokenKind.BRACKET_L || e === o.TokenKind.BRACKET_R || e === o.TokenKind.BRACE_L || e === o.TokenKind.PIPE || e === o.TokenKind.BRACE_R;
	}
	function c(e) {
		return e >= 0 && e <= 55295 || e >= 57344 && e <= 1114111;
	}
	function l(e, n) {
		return u(e.charCodeAt(n)) && d(e.charCodeAt(n + 1));
	}
	function u(e) {
		return e >= 55296 && e <= 56319;
	}
	function d(e) {
		return e >= 56320 && e <= 57343;
	}
	function f(e, n) {
		let r = e.source.body.codePointAt(n);
		if (r === void 0) return o.TokenKind.EOF;
		if (r >= 32 && r <= 126) {
			let e = String.fromCodePoint(r);
			return e === "\"" ? "'\"'" : `"${e}"`;
		}
		return "U+" + r.toString(16).toUpperCase().padStart(4, "0");
	}
	function m(e, n, i, a, o) {
		let s = e.line, c = 1 + i - e.lineStart;
		return new r.Token(n, i, a, s, c, o);
	}
	function g(e, r) {
		let i = e.source.body, s = i.length, u = r;
		for (; u < s;) {
			let r = i.charCodeAt(u);
			switch (r) {
				case 65279:
				case 9:
				case 32:
				case 44:
					++u;
					continue;
				case 10:
					++u, ++e.line, e.lineStart = u;
					continue;
				case 13:
					i.charCodeAt(u + 1) === 10 ? u += 2 : ++u, ++e.line, e.lineStart = u;
					continue;
				case 35: return _(e, u);
				case 33: return m(e, o.TokenKind.BANG, u, u + 1);
				case 36: return m(e, o.TokenKind.DOLLAR, u, u + 1);
				case 38: return m(e, o.TokenKind.AMP, u, u + 1);
				case 40: return m(e, o.TokenKind.PAREN_L, u, u + 1);
				case 41: return m(e, o.TokenKind.PAREN_R, u, u + 1);
				case 46:
					if (i.charCodeAt(u + 1) === 46 && i.charCodeAt(u + 2) === 46) return m(e, o.TokenKind.SPREAD, u, u + 3);
					break;
				case 58: return m(e, o.TokenKind.COLON, u, u + 1);
				case 61: return m(e, o.TokenKind.EQUALS, u, u + 1);
				case 64: return m(e, o.TokenKind.AT, u, u + 1);
				case 91: return m(e, o.TokenKind.BRACKET_L, u, u + 1);
				case 93: return m(e, o.TokenKind.BRACKET_R, u, u + 1);
				case 123: return m(e, o.TokenKind.BRACE_L, u, u + 1);
				case 124: return m(e, o.TokenKind.PIPE, u, u + 1);
				case 125: return m(e, o.TokenKind.BRACE_R, u, u + 1);
				case 34: return i.charCodeAt(u + 1) === 34 && i.charCodeAt(u + 2) === 34 ? E(e, u) : b(e, u);
			}
			if ((0, a.isDigit)(r) || r === 45) return v(e, u, r);
			if ((0, a.isNameStart)(r)) return D(e, u);
			throw (0, n.syntaxError)(e.source, u, r === 39 ? "Unexpected single quote character ('), did you mean to use a double quote (\")?" : c(r) || l(i, u) ? `Unexpected character: ${f(e, u)}.` : `Invalid character: ${f(e, u)}.`);
		}
		return m(e, o.TokenKind.EOF, s, s);
	}
	function _(e, n) {
		let r = e.source.body, i = r.length, a = n + 1;
		for (; a < i;) {
			let e = r.charCodeAt(a);
			if (e === 10 || e === 13) break;
			if (c(e)) ++a;
			else if (l(r, a)) a += 2;
			else break;
		}
		return m(e, o.TokenKind.COMMENT, n, a, r.slice(n + 1, a));
	}
	function v(e, r, i) {
		let s = e.source.body, c = r, l = i, u = !1;
		if (l === 45 && (l = s.charCodeAt(++c)), l === 48) {
			if (l = s.charCodeAt(++c), (0, a.isDigit)(l)) throw (0, n.syntaxError)(e.source, c, `Invalid number, unexpected digit after 0: ${f(e, c)}.`);
		} else c = y(e, c, l), l = s.charCodeAt(c);
		if (l === 46 && (u = !0, l = s.charCodeAt(++c), c = y(e, c, l), l = s.charCodeAt(c)), (l === 69 || l === 101) && (u = !0, l = s.charCodeAt(++c), (l === 43 || l === 45) && (l = s.charCodeAt(++c)), c = y(e, c, l), l = s.charCodeAt(c)), l === 46 || (0, a.isNameStart)(l)) throw (0, n.syntaxError)(e.source, c, `Invalid number, expected digit but got: ${f(e, c)}.`);
		return m(e, u ? o.TokenKind.FLOAT : o.TokenKind.INT, r, c, s.slice(r, c));
	}
	function y(e, r, i) {
		if (!(0, a.isDigit)(i)) throw (0, n.syntaxError)(e.source, r, `Invalid number, expected digit but got: ${f(e, r)}.`);
		let o = e.source.body, s = r + 1;
		for (; (0, a.isDigit)(o.charCodeAt(s));) ++s;
		return s;
	}
	function b(e, r) {
		let i = e.source.body, a = i.length, s = r + 1, u = s, d = "";
		for (; s < a;) {
			let a = i.charCodeAt(s);
			if (a === 34) return d += i.slice(u, s), m(e, o.TokenKind.STRING, r, s + 1, d);
			if (a === 92) {
				d += i.slice(u, s);
				let n = i.charCodeAt(s + 1) === 117 ? i.charCodeAt(s + 2) === 123 ? x(e, s) : S(e, s) : T(e, s);
				d += n.value, s += n.size, u = s;
				continue;
			}
			if (a === 10 || a === 13) break;
			if (c(a)) ++s;
			else if (l(i, s)) s += 2;
			else throw (0, n.syntaxError)(e.source, s, `Invalid character within String: ${f(e, s)}.`);
		}
		throw (0, n.syntaxError)(e.source, s, "Unterminated string.");
	}
	function x(e, r) {
		let i = e.source.body, a = 0, o = 3;
		for (; o < 12;) {
			let e = i.charCodeAt(r + o++);
			if (e === 125) {
				if (o < 5 || !c(a)) break;
				return {
					value: String.fromCodePoint(a),
					size: o
				};
			}
			if (a = a << 4 | w(e), a < 0) break;
		}
		throw (0, n.syntaxError)(e.source, r, `Invalid Unicode escape sequence: "${i.slice(r, r + o)}".`);
	}
	function S(e, r) {
		let i = e.source.body, a = C(i, r + 2);
		if (c(a)) return {
			value: String.fromCodePoint(a),
			size: 6
		};
		if (u(a) && i.charCodeAt(r + 6) === 92 && i.charCodeAt(r + 7) === 117) {
			let e = C(i, r + 8);
			if (d(e)) return {
				value: String.fromCodePoint(a, e),
				size: 12
			};
		}
		throw (0, n.syntaxError)(e.source, r, `Invalid Unicode escape sequence: "${i.slice(r, r + 6)}".`);
	}
	function C(e, n) {
		return w(e.charCodeAt(n)) << 12 | w(e.charCodeAt(n + 1)) << 8 | w(e.charCodeAt(n + 2)) << 4 | w(e.charCodeAt(n + 3));
	}
	function w(e) {
		return e >= 48 && e <= 57 ? e - 48 : e >= 65 && e <= 70 ? e - 55 : e >= 97 && e <= 102 ? e - 87 : -1;
	}
	function T(e, r) {
		let i = e.source.body;
		switch (i.charCodeAt(r + 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 (0, n.syntaxError)(e.source, r, `Invalid character escape sequence: "${i.slice(r, r + 2)}".`);
	}
	function E(e, r) {
		let a = e.source.body, s = a.length, u = e.lineStart, d = r + 3, g = d, _ = "", v = [];
		for (; d < s;) {
			let s = a.charCodeAt(d);
			if (s === 34 && a.charCodeAt(d + 1) === 34 && a.charCodeAt(d + 2) === 34) {
				_ += a.slice(g, d), v.push(_);
				let n = m(e, o.TokenKind.BLOCK_STRING, r, d + 3, (0, i.dedentBlockStringLines)(v).join("\n"));
				return e.line += v.length - 1, e.lineStart = u, n;
			}
			if (s === 92 && a.charCodeAt(d + 1) === 34 && a.charCodeAt(d + 2) === 34 && a.charCodeAt(d + 3) === 34) {
				_ += a.slice(g, d), g = d + 1, d += 4;
				continue;
			}
			if (s === 10 || s === 13) {
				_ += a.slice(g, d), v.push(_), s === 13 && a.charCodeAt(d + 1) === 10 ? d += 2 : ++d, _ = "", g = d, u = d;
				continue;
			}
			if (c(s)) ++d;
			else if (l(a, d)) d += 2;
			else throw (0, n.syntaxError)(e.source, d, `Invalid character within String: ${f(e, d)}.`);
		}
		throw (0, n.syntaxError)(e.source, d, "Unterminated string.");
	}
	function D(e, n) {
		let r = e.source.body, i = r.length, s = n + 1;
		for (; s < i;) {
			let e = r.charCodeAt(s);
			if ((0, a.isNameContinue)(e)) ++s;
			else break;
		}
		return m(e, o.TokenKind.NAME, n, s, r.slice(n, s));
	}
})), require_schemaCoordinateLexer = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 });
	var n = require_syntaxError(), r = require_ast(), i = require_characterClasses(), a = require_lexer(), o = require_tokenKind();
	e.SchemaCoordinateLexer = class {
		line = 1;
		lineStart = 0;
		constructor(e) {
			let n = new r.Token(o.TokenKind.SOF, 0, 0, 0, 0);
			this.source = e, this.lastToken = n, this.token = n;
		}
		get [Symbol.toStringTag]() {
			return "SchemaCoordinateLexer";
		}
		advance() {
			return this.lastToken = this.token, this.token = this.lookahead();
		}
		lookahead() {
			let e = this.token;
			if (e.kind !== o.TokenKind.EOF) {
				let n = s(this, e.end);
				e.next = n, n.prev = e, e = n;
			}
			return e;
		}
	};
	function s(e, r) {
		let s = e.source.body, c = s.length, l = r;
		if (l < c) {
			let r = s.charCodeAt(l);
			switch (r) {
				case 46: return (0, a.createToken)(e, o.TokenKind.DOT, l, l + 1);
				case 40: return (0, a.createToken)(e, o.TokenKind.PAREN_L, l, l + 1);
				case 41: return (0, a.createToken)(e, o.TokenKind.PAREN_R, l, l + 1);
				case 58: return (0, a.createToken)(e, o.TokenKind.COLON, l, l + 1);
				case 64: return (0, a.createToken)(e, o.TokenKind.AT, l, l + 1);
			}
			if ((0, i.isNameStart)(r)) return (0, a.readName)(e, l);
			throw (0, n.syntaxError)(e.source, l, `Invalid character: ${(0, a.printCodePointAt)(e, l)}.`);
		}
		return (0, a.createToken)(e, o.TokenKind.EOF, c, c);
	}
})), require_inspect = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.inspect = i;
	var n = 10, r = 2;
	function i(e) {
		return a(e, []);
	}
	function a(e, n) {
		switch (typeof e) {
			case "string": return JSON.stringify(e);
			case "function": return e.name ? `[function ${e.name}]` : "[function]";
			case "object": return o(e, n);
			default: return String(e);
		}
	}
	function o(e, n) {
		if (e === null) return "null";
		if (n.includes(e)) return "[Circular]";
		let r = [...n, e];
		if (s(e)) {
			let n = e.toJSON();
			if (n !== e) return typeof n == "string" ? n : a(n, r);
		} else if (Array.isArray(e)) return l(e, r);
		return c(e, r);
	}
	function s(e) {
		return typeof e.toJSON == "function";
	}
	function c(e, n) {
		let i = Object.entries(e);
		return i.length === 0 ? "{}" : n.length > r ? "[" + u(e) + "]" : "{ " + i.map(([e, r]) => e + ": " + a(r, n)).join(", ") + " }";
	}
	function l(e, i) {
		if (e.length === 0) return "[]";
		if (i.length > r) return "[Array]";
		let o = Math.min(n, e.length), s = e.length - o, c = [];
		for (let n = 0; n < o; ++n) c.push(a(e[n], i));
		return s === 1 ? c.push("... 1 more item") : s > 1 && c.push(`... ${s} more items`), "[" + c.join(", ") + "]";
	}
	function u(e) {
		let n = Object.prototype.toString.call(e).replace(/^\[object /, "").replace(/]$/, "");
		if (n === "Object" && typeof e.constructor == "function") {
			let n = e.constructor.name;
			if (typeof n == "string" && n !== "") return n;
		}
		return n;
	}
})), require_instanceOf = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 });
	var n = require_inspect();
	e.instanceOf = globalThis.process && process.env.NODE_ENV === "production" ? function(e, n) {
		return e instanceof n;
	} : function(e, r) {
		if (e instanceof r) return !0;
		if (typeof e == "object" && e) {
			let i = r.prototype[Symbol.toStringTag], a = Symbol.toStringTag in e ? e[Symbol.toStringTag] : e.constructor?.name;
			if (i === a) {
				let r = (0, n.inspect)(e);
				throw Error(`Cannot use ${i} "${r}" 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;
	};
})), require_source = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.isSource = o;
	var n = require_devAssert(), r = require_inspect(), i = require_instanceOf(), a = class {
		constructor(e, i = "GraphQL request", a = {
			line: 1,
			column: 1
		}) {
			typeof e == "string" || (0, n.devAssert)(!1, `Body must be a string. Received: ${(0, r.inspect)(e)}.`), this.body = e, this.name = i, this.locationOffset = a, this.locationOffset.line > 0 || (0, n.devAssert)(!1, "line in locationOffset is 1-indexed and must be positive."), this.locationOffset.column > 0 || (0, n.devAssert)(!1, "column in locationOffset is 1-indexed and must be positive.");
		}
		get [Symbol.toStringTag]() {
			return "Source";
		}
	};
	e.Source = a;
	function o(e) {
		return (0, i.instanceOf)(e, a);
	}
})), require_parser = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.parse = u, e.parseConstValue = f, e.parseSchemaCoordinate = g, e.parseType = m, e.parseValue = d;
	var n = require_syntaxError(), r = require_ast(), i = require_directiveLocation(), a = require_kinds(), o = require_lexer(), s = require_schemaCoordinateLexer(), c = require_source(), l = require_tokenKind();
	function u(e, n) {
		let r = new _(e, n), i = r.parseDocument();
		return Object.defineProperty(i, "tokenCount", {
			enumerable: !1,
			value: r.tokenCount
		}), i;
	}
	function d(e, n) {
		let r = new _(e, n);
		r.expectToken(l.TokenKind.SOF);
		let i = r.parseValueLiteral(!1);
		return r.expectToken(l.TokenKind.EOF), i;
	}
	function f(e, n) {
		let r = new _(e, n);
		r.expectToken(l.TokenKind.SOF);
		let i = r.parseConstValueLiteral();
		return r.expectToken(l.TokenKind.EOF), i;
	}
	function m(e, n) {
		let r = new _(e, n);
		r.expectToken(l.TokenKind.SOF);
		let i = r.parseTypeReference();
		return r.expectToken(l.TokenKind.EOF), i;
	}
	function g(e) {
		let n = (0, c.isSource)(e) ? e : new c.Source(e), r = new s.SchemaCoordinateLexer(n), i = new _(e, { lexer: r });
		i.expectToken(l.TokenKind.SOF);
		let a = i.parseSchemaCoordinate();
		return i.expectToken(l.TokenKind.EOF), a;
	}
	var _ = class {
		constructor(e, n = {}) {
			let { lexer: r,...i } = n;
			if (r) this._lexer = r;
			else {
				let n = (0, c.isSource)(e) ? e : new c.Source(e);
				this._lexer = new o.Lexer(n);
			}
			this._options = i, this._tokenCounter = 0;
		}
		get tokenCount() {
			return this._tokenCounter;
		}
		parseName() {
			let e = this.expectToken(l.TokenKind.NAME);
			return this.node(e, {
				kind: a.Kind.NAME,
				value: e.value
			});
		}
		parseDocument() {
			return this.node(this._lexer.token, {
				kind: a.Kind.DOCUMENT,
				definitions: this.many(l.TokenKind.SOF, this.parseDefinition, l.TokenKind.EOF)
			});
		}
		parseDefinition() {
			if (this.peek(l.TokenKind.BRACE_L)) return this.parseOperationDefinition();
			let e = this.peekDescription(), r = e ? this._lexer.lookahead() : this._lexer.token;
			if (e && r.kind === l.TokenKind.BRACE_L) throw (0, n.syntaxError)(this._lexer.source, this._lexer.token.start, "Unexpected description, descriptions are not supported on shorthand queries.");
			if (r.kind === l.TokenKind.NAME) {
				switch (r.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 (r.value) {
					case "query":
					case "mutation":
					case "subscription": return this.parseOperationDefinition();
					case "fragment": return this.parseFragmentDefinition();
				}
				if (e) throw (0, n.syntaxError)(this._lexer.source, this._lexer.token.start, "Unexpected description, only GraphQL definitions support descriptions.");
				switch (r.value) {
					case "extend": return this.parseTypeSystemExtension();
				}
			}
			throw this.unexpected(r);
		}
		parseOperationDefinition() {
			let e = this._lexer.token;
			if (this.peek(l.TokenKind.BRACE_L)) return this.node(e, {
				kind: a.Kind.OPERATION_DEFINITION,
				operation: r.OperationTypeNode.QUERY,
				description: void 0,
				name: void 0,
				variableDefinitions: [],
				directives: [],
				selectionSet: this.parseSelectionSet()
			});
			let n = this.parseDescription(), i = this.parseOperationType(), o;
			return this.peek(l.TokenKind.NAME) && (o = this.parseName()), this.node(e, {
				kind: a.Kind.OPERATION_DEFINITION,
				operation: i,
				description: n,
				name: o,
				variableDefinitions: this.parseVariableDefinitions(),
				directives: this.parseDirectives(!1),
				selectionSet: this.parseSelectionSet()
			});
		}
		parseOperationType() {
			let e = this.expectToken(l.TokenKind.NAME);
			switch (e.value) {
				case "query": return r.OperationTypeNode.QUERY;
				case "mutation": return r.OperationTypeNode.MUTATION;
				case "subscription": return r.OperationTypeNode.SUBSCRIPTION;
			}
			throw this.unexpected(e);
		}
		parseVariableDefinitions() {
			return this.optionalMany(l.TokenKind.PAREN_L, this.parseVariableDefinition, l.TokenKind.PAREN_R);
		}
		parseVariableDefinition() {
			return this.node(this._lexer.token, {
				kind: a.Kind.VARIABLE_DEFINITION,
				description: this.parseDescription(),
				variable: this.parseVariable(),
				type: (this.expectToken(l.TokenKind.COLON), this.parseTypeReference()),
				defaultValue: this.expectOptionalToken(l.TokenKind.EQUALS) ? this.parseConstValueLiteral() : void 0,
				directives: this.parseConstDirectives()
			});
		}
		parseVariable() {
			let e = this._lexer.token;
			return this.expectToken(l.TokenKind.DOLLAR), this.node(e, {
				kind: a.Kind.VARIABLE,
				name: this.parseName()
			});
		}
		parseSelectionSet() {
			return this.node(this._lexer.token, {
				kind: a.Kind.SELECTION_SET,
				selections: this.many(l.TokenKind.BRACE_L, this.parseSelection, l.TokenKind.BRACE_R)
			});
		}
		parseSelection() {
			return this.peek(l.TokenKind.SPREAD) ? this.parseFragment() : this.parseField();
		}
		parseField() {
			let e = this._lexer.token, n = this.parseName(), r, i;
			return this.expectOptionalToken(l.TokenKind.COLON) ? (r = n, i = this.parseName()) : i = n, this.node(e, {
				kind: a.Kind.FIELD,
				alias: r,
				name: i,
				arguments: this.parseArguments(!1),
				directives: this.parseDirectives(!1),
				selectionSet: this.peek(l.TokenKind.BRACE_L) ? this.parseSelectionSet() : void 0
			});
		}
		parseArguments(e) {
			let n = e ? this.parseConstArgument : this.parseArgument;
			return this.optionalMany(l.TokenKind.PAREN_L, n, l.TokenKind.PAREN_R);
		}
		parseArgument(e = !1) {
			let n = this._lexer.token, r = this.parseName();
			return this.expectToken(l.TokenKind.COLON), this.node(n, {
				kind: a.Kind.ARGUMENT,
				name: r,
				value: this.parseValueLiteral(e)
			});
		}
		parseConstArgument() {
			return this.parseArgument(!0);
		}
		parseFragment() {
			let e = this._lexer.token;
			this.expectToken(l.TokenKind.SPREAD);
			let n = this.expectOptionalKeyword("on");
			return !n && this.peek(l.TokenKind.NAME) ? this.node(e, {
				kind: a.Kind.FRAGMENT_SPREAD,
				name: this.parseFragmentName(),
				directives: this.parseDirectives(!1)
			}) : this.node(e, {
				kind: a.Kind.INLINE_FRAGMENT,
				typeCondition: n ? this.parseNamedType() : void 0,
				directives: this.parseDirectives(!1),
				selectionSet: this.parseSelectionSet()
			});
		}
		parseFragmentDefinition() {
			let e = this._lexer.token, n = this.parseDescription();
			return this.expectKeyword("fragment"), this._options.allowLegacyFragmentVariables === !0 ? this.node(e, {
				kind: a.Kind.FRAGMENT_DEFINITION,
				description: n,
				name: this.parseFragmentName(),
				variableDefinitions: this.parseVariableDefinitions(),
				typeCondition: (this.expectKeyword("on"), this.parseNamedType()),
				directives: this.parseDirectives(!1),
				selectionSet: this.parseSelectionSet()
			}) : this.node(e, {
				kind: a.Kind.FRAGMENT_DEFINITION,
				description: n,
				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 r = this._lexer.token;
			switch (r.kind) {
				case l.TokenKind.BRACKET_L: return this.parseList(e);
				case l.TokenKind.BRACE_L: return this.parseObject(e);
				case l.TokenKind.INT: return this.advanceLexer(), this.node(r, {
					kind: a.Kind.INT,
					value: r.value
				});
				case l.TokenKind.FLOAT: return this.advanceLexer(), this.node(r, {
					kind: a.Kind.FLOAT,
					value: r.value
				});
				case l.TokenKind.STRING:
				case l.TokenKind.BLOCK_STRING: return this.parseStringLiteral();
				case l.TokenKind.NAME: switch (this.advanceLexer(), r.value) {
					case "true": return this.node(r, {
						kind: a.Kind.BOOLEAN,
						value: !0
					});
					case "false": return this.node(r, {
						kind: a.Kind.BOOLEAN,
						value: !1
					});
					case "null": return this.node(r, { kind: a.Kind.NULL });
					default: return this.node(r, {
						kind: a.Kind.ENUM,
						value: r.value
					});
				}
				case l.TokenKind.DOLLAR:
					if (e) if (this.expectToken(l.TokenKind.DOLLAR), this._lexer.token.kind === l.TokenKind.NAME) {
						let e = this._lexer.token.value;
						throw (0, n.syntaxError)(this._lexer.source, r.start, `Unexpected variable "$${e}" in constant value.`);
					} else throw this.unexpected(r);
					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: a.Kind.STRING,
				value: e.value,
				block: e.kind === l.TokenKind.BLOCK_STRING
			});
		}
		parseList(e) {
			return this.node(this._lexer.token, {
				kind: a.Kind.LIST,
				values: this.any(l.TokenKind.BRACKET_L, () => this.parseValueLiteral(e), l.TokenKind.BRACKET_R)
			});
		}
		parseObject(e) {
			return this.node(this._lexer.token, {
				kind: a.Kind.OBJECT,
				fields: this.any(l.TokenKind.BRACE_L, () => this.parseObjectField(e), l.TokenKind.BRACE_R)
			});
		}
		parseObjectField(e) {
			let n = this._lexer.token, r = this.parseName();
			return this.expectToken(l.TokenKind.COLON), this.node(n, {
				kind: a.Kind.OBJECT_FIELD,
				name: r,
				value: this.parseValueLiteral(e)
			});
		}
		parseDirectives(e) {
			let n = [];
			for (; this.peek(l.TokenKind.AT);) n.push(this.parseDirective(e));
			return n;
		}
		parseConstDirectives() {
			return this.parseDirectives(!0);
		}
		parseDirective(e) {
			let n = this._lexer.token;
			return this.expectToken(l.TokenKind.AT), this.node(n, {
				kind: a.Kind.DIRECTIVE,
				name: this.parseName(),
				arguments: this.parseArguments(e)
			});
		}
		parseTypeReference() {
			let e = this._lexer.token, n;
			if (this.expectOptionalToken(l.TokenKind.BRACKET_L)) {
				let r = this.parseTypeReference();
				this.expectToken(l.TokenKind.BRACKET_R), n = this.node(e, {
					kind: a.Kind.LIST_TYPE,
					type: r
				});
			} else n = this.parseNamedType();
			return this.expectOptionalToken(l.TokenKind.BANG) ? this.node(e, {
				kind: a.Kind.NON_NULL_TYPE,
				type: n
			}) : n;
		}
		parseNamedType() {
			return this.node(this._lexer.token, {
				kind: a.Kind.NAMED_TYPE,
				name: this.parseName()
			});
		}
		peekDescription() {
			return this.peek(l.TokenKind.STRING) || this.peek(l.TokenKind.BLOCK_STRING);
		}
		parseDescription() {
			if (this.peekDescription()) return this.parseStringLiteral();
		}
		parseSchemaDefinition() {
			let e = this._lexer.token, n = this.parseDescription();
			this.expectKeyword("schema");
			let r = this.parseConstDirectives(), i = this.many(l.TokenKind.BRACE_L, this.parseOperationTypeDefinition, l.TokenKind.BRACE_R);
			return this.node(e, {
				kind: a.Kind.SCHEMA_DEFINITION,
				description: n,
				directives: r,
				operationTypes: i
			});
		}
		parseOperationTypeDefinition() {
			let e = this._lexer.token, n = this.parseOperationType();
			this.expectToken(l.TokenKind.COLON);
			let r = this.parseNamedType();
			return this.node(e, {
				kind: a.Kind.OPERATION_TYPE_DEFINITION,
				operation: n,
				type: r
			});
		}
		parseScalarTypeDefinition() {
			let e = this._lexer.token, n = this.parseDescription();
			this.expectKeyword("scalar");
			let r = this.parseName(), i = this.parseConstDirectives();
			return this.node(e, {
				kind: a.Kind.SCALAR_TYPE_DEFINITION,
				description: n,
				name: r,
				directives: i
			});
		}
		parseObjectTypeDefinition() {
			let e = this._lexer.token, n = this.parseDescription();
			this.expectKeyword("type");
			let r = this.parseName(), i = this.parseImplementsInterfaces(), o = this.parseConstDirectives(), s = this.parseFieldsDefinition();
			return this.node(e, {
				kind: a.Kind.OBJECT_TYPE_DEFINITION,
				description: n,
				name: r,
				interfaces: i,
				directives: o,
				fields: s
			});
		}
		parseImplementsInterfaces() {
			return this.expectOptionalKeyword("implements") ? this.delimitedMany(l.TokenKind.AMP, this.parseNamedType) : [];
		}
		parseFieldsDefinition() {
			return this.optionalMany(l.TokenKind.BRACE_L, this.parseFieldDefinition, l.TokenKind.BRACE_R);
		}
		parseFieldDefinition() {
			let e = this._lexer.token, n = this.parseDescription(), r = this.parseName(), i = this.parseArgumentDefs();
			this.expectToken(l.TokenKind.COLON);
			let o = this.parseTypeReference(), s = this.parseConstDirectives();
			return this.node(e, {
				kind: a.Kind.FIELD_DEFINITION,
				description: n,
				name: r,
				arguments: i,
				type: o,
				directives: s
			});
		}
		parseArgumentDefs() {
			return this.optionalMany(l.TokenKind.PAREN_L, this.parseInputValueDef, l.TokenKind.PAREN_R);
		}
		parseInputValueDef() {
			let e = this._lexer.token, n = this.parseDescription(), r = this.parseName();
			this.expectToken(l.TokenKind.COLON);
			let i = this.parseTypeReference(), o;
			this.expectOptionalToken(l.TokenKind.EQUALS) && (o = this.parseConstValueLiteral());
			let s = this.parseConstDirectives();
			return this.node(e, {
				kind: a.Kind.INPUT_VALUE_DEFINITION,
				description: n,
				name: r,
				type: i,
				defaultValue: o,
				directives: s
			});
		}
		parseInterfaceTypeDefinition() {
			let e = this._lexer.token, n = this.parseDescription();
			this.expectKeyword("interface");
			let r = this.parseName(), i = this.parseImplementsInterfaces(), o = this.parseConstDirectives(), s = this.parseFieldsDefinition();
			return this.node(e, {
				kind: a.Kind.INTERFACE_TYPE_DEFINITION,
				description: n,
				name: r,
				interfaces: i,
				directives: o,
				fields: s
			});
		}
		parseUnionTypeDefinition() {
			let e = this._lexer.token, n = this.parseDescription();
			this.expectKeyword("union");
			let r = this.parseName(), i = this.parseConstDirectives(), o = this.parseUnionMemberTypes();
			return this.node(e, {
				kind: a.Kind.UNION_TYPE_DEFINITION,
				description: n,
				name: r,
				directives: i,
				types: o
			});
		}
		parseUnionMemberTypes() {
			return this.expectOptionalToken(l.TokenKind.EQUALS) ? this.delimitedMany(l.TokenKind.PIPE, this.parseNamedType) : [];
		}
		parseEnumTypeDefinition() {
			let e = this._lexer.token, n = this.parseDescription();
			this.expectKeyword("enum");
			let r = this.parseName(), i = this.parseConstDirectives(), o = this.parseEnumValuesDefinition();
			return this.node(e, {
				kind: a.Kind.ENUM_TYPE_DEFINITION,
				description: n,
				name: r,
				directives: i,
				values: o
			});
		}
		parseEnumValuesDefinition() {
			return this.optionalMany(l.TokenKind.BRACE_L, this.parseEnumValueDefinition, l.TokenKind.BRACE_R);
		}
		parseEnumValueDefinition() {
			let e = this._lexer.token, n = this.parseDescription(), r = this.parseEnumValueName(), i = this.parseConstDirectives();
			return this.node(e, {
				kind: a.Kind.ENUM_VALUE_DEFINITION,
				description: n,
				name: r,
				directives: i
			});
		}
		parseEnumValueName() {
			if (this._lexer.token.value === "true" || this._lexer.token.value === "false" || this._lexer.token.value === "null") throw (0, n.syntaxError)(this._lexer.source, this._lexer.token.start, `${v(this._lexer.token)} is reserved and cannot be used for an enum value.`);
			return this.parseName();
		}
		parseInputObjectTypeDefinition() {
			let e = this._lexer.token, n = this.parseDescription();
			this.expectKeyword("input");
			let r = this.parseName(), i = this.parseConstDirectives(), o = this.parseInputFieldsDefinition();
			return this.node(e, {
				kind: a.Kind.INPUT_OBJECT_TYPE_DEFINITION,
				description: n,
				name: r,
				directives: i,
				fields: o
			});
		}
		parseInputFieldsDefinition() {
			return this.optionalMany(l.TokenKind.BRACE_L, this.parseInputValueDef, l.TokenKind.BRACE_R);
		}
		parseTypeSystemExtension() {
			let e = this._lexer.lookahead();
			if (e.kind === l.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();
				case "directive":
					if (this._options.experimentalDirectivesOnDirectiveDefinitions) return this.parseDirectiveDefinitionExtension();
					break;
			}
			throw this.unexpected(e);
		}
		parseSchemaExtension() {
			let e = this._lexer.token;
			this.expectKeyword("extend"), this.expectKeyword("schema");
			let n = this.parseConstDirectives(), r = this.optionalMany(l.TokenKind.BRACE_L, this.parseOperationTypeDefinition, l.TokenKind.BRACE_R);
			if (n.length === 0 && r.length === 0) throw this.unexpected();
			return this.node(e, {
				kind: a.Kind.SCHEMA_EXTENSION,
				directives: n,
				operationTypes: r
			});
		}
		parseScalarTypeExtension() {
			let e = this._lexer.token;
			this.expectKeyword("extend"), this.expectKeyword("scalar");
			let n = this.parseName(), r = this.parseConstDirectives();
			if (r.length === 0) throw this.unexpected();
			return this.node(e, {
				kind: a.Kind.SCALAR_TYPE_EXTENSION,
				name: n,
				directives: r
			});
		}
		parseObjectTypeExtension() {
			let e = this._lexer.token;
			this.expectKeyword("extend"), this.expectKeyword("type");
			let n = this.parseName(), r = this.parseImplementsInterfaces(), i = this.parseConstDirectives(), o = this.parseFieldsDefinition();
			if (r.length === 0 && i.length === 0 && o.length === 0) throw this.unexpected();
			return this.node(e, {
				kind: a.Kind.OBJECT_TYPE_EXTENSION,
				name: n,
				interfaces: r,
				directives: i,
				fields: o
			});
		}
		parseInterfaceTypeExtension() {
			let e = this._lexer.token;
			this.expectKeyword("extend"), this.expectKeyword("interface");
			let n = this.parseName(), r = this.parseImplementsInterfaces(), i = this.parseConstDirectives(), o = this.parseFieldsDefinition();
			if (r.length === 0 && i.length === 0 && o.length === 0) throw this.unexpected();
			return this.node(e, {
				kind: a.Kind.INTERFACE_TYPE_EXTENSION,
				name: n,
				interfaces: r,
				directives: i,
				fields: o
			});
		}
		parseUnionTypeExtension() {
			let e = this._lexer.token;
			this.expectKeyword("extend"), this.expectKeyword("union");
			let n = this.parseName(), r = this.parseConstDirectives(), i = this.parseUnionMemberTypes();
			if (r.length === 0 && i.length === 0) throw this.unexpected();
			return this.node(e, {
				kind: a.Kind.UNION_TYPE_EXTENSION,
				name: n,
				directives: r,
				types: i
			});
		}
		parseEnumTypeExtension() {
			let e = this._lexer.token;
			this.expectKeyword("extend"), this.expectKeyword("enum");
			let n = this.parseName(), r = this.parseConstDirectives(), i = this.parseEnumValuesDefinition();
			if (r.length === 0 && i.length === 0) throw this.unexpected();
			return this.node(e, {
				kind: a.Kind.ENUM_TYPE_EXTENSION,
				name: n,
				directives: r,
				values: i
			});
		}
		parseInputObjectTypeExtension() {
			let e = this._lexer.token;
			this.expectKeyword("extend"), this.expectKeyword("input");
			let n = this.parseName(), r = this.parseConstDirectives(), i = this.parseInputFieldsDefinition();
			if (r.length === 0 && i.length === 0) throw this.unexpected();
			return this.node(e, {
				kind: a.Kind.INPUT_OBJECT_TYPE_EXTENSION,
				name: n,
				directives: r,
				fields: i
			});
		}
		parseDirectiveDefinitionExtension() {
			let e = this._lexer.token;
			this.expectKeyword("extend"), this.expectKeyword("directive"), this.expectToken(l.TokenKind.AT);
			let n = this.parseName(), r = this.parseConstDirectives();
			if (r.length === 0) throw this.unexpected();
			return this.node(e, {
				kind: a.Kind.DIRECTIVE_EXTENSION,
				name: n,
				directives: r
			});
		}
		parseDirectiveDefinition() {
			let e = this._lexer.token, n = this.parseDescription();
			this.expectKeyword("directive"), this.expectToken(l.TokenKind.AT);
			let r = this.parseName(), i = this.parseArgumentDefs(), o = this._options.experimentalDirectivesOnDirectiveDefinitions ? this.parseConstDirectives() : [], s = this.expectOptionalKeyword("repeatable");
			this.expectKeyword("on");
			let c = this.parseDirectiveLocations();
			return this.node(e, {
				kind: a.Kind.DIRECTIVE_DEFINITION,
				description: n,
				name: r,
				arguments: i,
				directives: o,
				repeatable: s,
				locations: c
			});
		}
		parseDirectiveLocations() {
			return this.delimitedMany(l.TokenKind.PIPE, this.parseDirectiveLocation);
		}
		parseDirectiveLocation() {
			let e = this._lexer.token, n = this.parseName();
			if (Object.prototype.hasOwnProperty.call(i.DirectiveLocation, n.value)) return n;
			throw this.unexpected(e);
		}
		parseSchemaCoordinate() {
			let e = this._lexer.token, n = this.expectOptionalToken(l.TokenKind.AT), r = this.parseName(), i;
			!n && this.expectOptionalToken(l.TokenKind.DOT) && (i = this.parseName());
			let o;
			return (n || i) && this.expectOptionalToken(l.TokenKind.PAREN_L) && (o = this.parseName(), this.expectToken(l.TokenKind.COLON), this.expectToken(l.TokenKind.PAREN_R)), n ? o ? this.node(e, {
				kind: a.Kind.DIRECTIVE_ARGUMENT_COORDINATE,
				name: r,
				argumentName: o
			}) : this.node(e, {
				kind: a.Kind.DIRECTIVE_COORDINATE,
				name: r
			}) : i ? o ? this.node(e, {
				kind: a.Kind.ARGUMENT_COORDINATE,
				name: r,
				fieldName: i,
				argumentName: o
			}) : this.node(e, {
				kind: a.Kind.MEMBER_COORDINATE,
				name: r,
				memberName: i
			}) : this.node(e, {
				kind: a.Kind.TYPE_COORDINATE,
				name: r
			});
		}
		node(e, n) {
			return this._options.noLocation !== !0 && (n.loc = new r.Location(e, this._lexer.lastToken, this._lexer.source)), n;
		}
		peek(e) {
			return this._lexer.token.kind === e;
		}
		expectToken(e) {
			let r = this._lexer.token;
			if (r.kind === e) return this.advanceLexer(), r;
			throw (0, n.syntaxError)(this._lexer.source, r.start, `Expected ${y(e)}, found ${v(r)}.`);
		}
		expectOptionalToken(e) {
			return this._lexer.token.kind === e ? (this.advanceLexer(), !0) : !1;
		}
		expectKeyword(e) {
			let r = this._lexer.token;
			if (r.kind === l.TokenKind.NAME && r.value === e) this.advanceLexer();
			else throw (0, n.syntaxError)(this._lexer.source, r.start, `Expected "${e}", found ${v(r)}.`);
		}
		expectOptionalKeyword(e) {
			let n = this._lexer.token;
			return n.kind === l.TokenKind.NAME && n.value === e ? (this.advanceLexer(), !0) : !1;
		}
		unexpected(e) {
			let r = e ?? this._lexer.token;
			return (0, n.syntaxError)(this._lexer.source, r.start, `Unexpected ${v(r)}.`);
		}
		any(e, n, r) {
			this.expectToken(e);
			let i = [];
			for (; !this.expectOptionalToken(r);) i.push(n.call(this));
			return i;
		}
		optionalMany(e, n, r) {
			if (this.expectOptionalToken(e)) {
				let e = [];
				do
					e.push(n.call(this));
				while (!this.expectOptionalToken(r));
				return e;
			}
			return [];
		}
		many(e, n, r) {
			this.expectToken(e);
			let i = [];
			do
				i.push(n.call(this));
			while (!this.expectOptionalToken(r));
			return i;
		}
		delimitedMany(e, n) {
			this.expectOptionalToken(e);
			let r = [];
			do
				r.push(n.call(this));
			while (this.expectOptionalToken(e));
			return r;
		}
		advanceLexer() {
			let { maxTokens: e } = this._options, r = this._lexer.advance();
			if (r.kind !== l.TokenKind.EOF && (++this._tokenCounter, e !== void 0 && this._tokenCounter > e)) throw (0, n.syntaxError)(this._lexer.source, r.start, `Document contains more that ${e} tokens. Parsing aborted.`);
		}
	};
	e.Parser = _;
	function v(e) {
		let n = e.value;
		return y(e.kind) + (n == null ? "" : ` "${n}"`);
	}
	function y(e) {
		return (0, o.isPunctuatorTokenKind)(e) ? `"${e}"` : e;
	}
})), require_didYouMean = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.didYouMean = r;
	var n = 5;
	function r(e, r) {
		let [i, a] = r ? [e, r] : [void 0, e], o = " Did you mean ";
		i && (o += i + " ");
		let s = a.map((e) => `"${e}"`);
		switch (s.length) {
			case 0: return "";
			case 1: return o + s[0] + "?";
			case 2: return o + s[0] + " or " + s[1] + "?";
		}
		let c = s.slice(0, n), l = c.pop();
		return o + c.join(", ") + ", or " + l + "?";
	}
})), require_identityFunc = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.identityFunc = n;
	function n(e) {
		return e;
	}
})), require_keyMap = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.keyMap = n;
	function n(e, n) {
		let r = Object.create(null);
		for (let i of e) r[n(i)] = i;
		return r;
	}
})), require_keyValMap = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.keyValMap = n;
	function n(e, n, r) {
		let i = Object.create(null);
		for (let a of e) i[n(a)] = r(a);
		return i;
	}
})), require_mapValue = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.mapValue = n;
	function n(e, n) {
		let r = Object.create(null);
		for (let i of Object.keys(e)) r[i] = n(e[i], i);
		return r;
	}
})), require_naturalCompare = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.naturalCompare = n;
	function n(e, n) {
		let i = 0, o = 0;
		for (; i < e.length && o < n.length;) {
			let s = e.charCodeAt(i), c = n.charCodeAt(o);
			if (a(s) && a(c)) {
				let l = 0;
				do
					++i, l = l * 10 + s - r, s = e.charCodeAt(i);
				while (a(s) && l > 0);
				let u = 0;
				do
					++o, u = u * 10 + c - r, c = n.charCodeAt(o);
				while (a(c) && u > 0);
				if (l < u) return -1;
				if (l > u) return 1;
			} else {
				if (s < c) return -1;
				if (s > c) return 1;
				++i, ++o;
			}
		}
		return e.length - n.length;
	}
	var r = 48, i = 57;
	function a(e) {
		return !isNaN(e) && r <= e && e <= i;
	}
})), require_suggestionList = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.suggestionList = r;
	var n = require_naturalCompare();
	function r(e, r) {
		let a = Object.create(null), o = new i(e), s = Math.floor(e.length * .4) + 1;
		for (let e of r) {
			let n = o.measure(e, s);
			n !== void 0 && (a[e] = n);
		}
		return Object.keys(a).sort((e, r) => {
			let i = a[e] - a[r];
			return i === 0 ? (0, n.naturalCompare)(e, r) : i;
		});
	}
	var i = class {
		constructor(e) {
			this._input = e, this._inputLowerCase = e.toLowerCase(), this._inputArray = a(this._inputLowerCase), this._rows = [
				Array(e.length + 1).fill(0),
				Array(e.length + 1).fill(0),
				Array(e.length + 1).fill(0)
			];
		}
		measure(e, n) {
			if (this._input === e) return 0;
			let r = e.toLowerCase();
			if (this._inputLowerCase === r) return 1;
			let i = a(r), o = this._inputArray;
			if (i.length < o.length) {
				let e = i;
				i = o, o = e;
			}
			let s = i.length, c = o.length;
			if (s - c > n) return;
			let l = this._rows;
			for (let e = 0; e <= c; e++) l[0][e] = e;
			for (let e = 1; e <= s; e++) {
				let r = l[(e - 1) % 3], a = l[e % 3], s = a[0] = e;
				for (let n = 1; n <= c; n++) {
					let c = i[e - 1] === o[n - 1] ? 0 : 1, u = Math.min(r[n] + 1, a[n - 1] + 1, r[n - 1] + c);
					if (e > 1 && n > 1 && i[e - 1] === o[n - 2] && i[e - 2] === o[n - 1]) {
						let r = l[(e - 2) % 3][n - 2];
						u = Math.min(u, r + 1);
					}
					u < s && (s = u), a[n] = u;
				}
				if (s > n) return;
			}
			let u = l[s % 3][c];
			return u <= n ? u : void 0;
		}
	};
	function a(e) {
		let n = e.length, r = Array(n);
		for (let i = 0; i < n; ++i) r[i] = e.charCodeAt(i);
		return r;
	}
})), require_toObjMap = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.toObjMap = n;
	function n(e) {
		if (e == null) return Object.create(null);
		if (Object.getPrototypeOf(e) === null) return e;
		let n = Object.create(null);
		for (let [r, i] of Object.entries(e)) n[r] = i;
		return n;
	}
})), require_printString = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.printString = n;
	function n(e) {
		return `"${e.replace(r, i)}"`;
	}
	var r = /[\x00-\x1f\x22\x5c\x7f-\x9f]/g;
	function i(e) {
		return a[e.charCodeAt(0)];
	}
	var a = /* @__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(".");
})), require_visitor = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.getEnterLeaveForKind = l, e.getVisitFn = u, e.visit = s, e.visitInParallel = c;
	var n = require_devAssert(), r = require_inspect(), i = require_ast(), a = require_kinds(), o = Object.freeze({});
	e.BREAK = o;
	function s(e, s, c = i.QueryDocumentKeys) {
		let u = /* @__PURE__ */ new Map();
		for (let e of Object.values(a.Kind)) u.set(e, l(s, e));
		let d, f = Array.isArray(e), m = [e], g = -1, _ = [], v = e, y, b, x = [], S = [];
		do {
			g++;
			let e = g === m.length, a = e && _.length !== 0;
			if (e) {
				if (y = S.length === 0 ? void 0 : x[x.length - 1], v = b, b = S.pop(), a) if (f) {
					v = v.slice();
					let e = 0;
					for (let [n, r] of _) {
						let i = n - e;
						r === null ? (v.splice(i, 1), e++) : v[i] = r;
					}
				} else {
					v = { ...v };
					for (let [e, n] of _) v[e] = n;
				}
				g = d.index, m = d.keys, _ = d.edits, f = d.inArray, d = d.prev;
			} else if (b) {
				if (y = f ? g : m[g], v = b[y], v == null) continue;
				x.push(y);
			}
			let l;
			if (!Array.isArray(v)) {
				if ((0, i.isNode)(v) || (0, n.devAssert)(!1, `Invalid AST Node: ${(0, r.inspect)(v)}.`), l = (e ? u.get(v.kind)?.leave : u.get(v.kind)?.enter)?.call(s, v, y, b, x, S), l === o) break;
				if (l === !1) {
					if (!e) {
						x.pop();
						continue;
					}
				} else if (l !== void 0 && (_.push([y, l]), !e)) if ((0, i.isNode)(l)) v = l;
				else {
					x.pop();
					continue;
				}
			}
			l === void 0 && a && _.push([y, v]), e ? x.pop() : (d = {
				inArray: f,
				index: g,
				keys: m,
				edits: _,
				prev: d
			}, f = Array.isArray(v), m = f ? v : c[v.kind] ?? [], g = -1, _ = [], b && S.push(b), b = v);
		} while (d !== void 0);
		return _.length === 0 ? e : _[_.length - 1][1];
	}
	function c(e) {
		let n = Array(e.length).fill(null), r = Object.create(null);
		for (let i of Object.values(a.Kind)) {
			let a = !1, s = Array(e.length).fill(void 0), c = Array(e.length).fill(void 0);
			for (let n = 0; n < e.length; ++n) {
				let { enter: r, leave: o } = l(e[n], i);
				a ||= r != null || o != null, s[n] = r, c[n] = o;
			}
			a && (r[i] = {
				enter(...r) {
					let i = r[0];
					for (let a = 0; a < e.length; a++) if (n[a] === null) {
						let c = s[a]?.apply(e[a], r);
						if (c === !1) n[a] = i;
						else if (c === o) n[a] = o;
						else if (c !== void 0) return c;
					}
				},
				leave(...r) {
					let i = r[0];
					for (let a = 0; a < e.length; a++) if (n[a] === null) {
						let i = c[a]?.apply(e[a], r);
						if (i === o) n[a] = o;
						else if (i !== void 0 && i !== !1) return i;
					} else n[a] === i && (n[a] = null);
				}
			});
		}
		return r;
	}
	function l(e, n) {
		let r = e[n];
		return typeof r == "object" ? r : typeof r == "function" ? {
			enter: r,
			leave: void 0
		} : {
			enter: e.enter,
			leave: e.leave
		};
	}
	/* c8 ignore next 8 */
	function u(e, n, r) {
		let { enter: i, leave: a } = l(e, n);
		return r ? a : i;
	}
})), require_printer = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.print = a;
	var n = require_blockString(), r = require_printString(), i = require_visitor();
	function a(e) {
		return (0, i.visit)(e, s);
	}
	var o = 80, s = {
		Name: { leave: (e) => e.value },
		Variable: { leave: (e) => "$" + e.name },
		Document: { leave: (e) => c(e.definitions, "\n\n") },
		OperationDefinition: { leave(e) {
			let n = f(e.variableDefinitions) ? u("(\n", c(e.variableDefinitions, "\n"), "\n)") : u("(", c(e.variableDefinitions, ", "), ")"), r = u("", e.description, "\n") + c([
				e.operation,
				c([e.name, n]),
				c(e.directives, " ")
			], " ");
			return (r === "query" ? "" : r + " ") + e.selectionSet;
		} },
		VariableDefinition: { leave: ({ variable: e, type: n, defaultValue: r, directives: i, description: a }) => u("", a, "\n") + e + ": " + n + u(" = ", r) + u(" ", c(i, " ")) },
		SelectionSet: { leave: ({ selections: e }) => l(e) },
		Field: { leave({ alias: e, name: n, arguments: r, directives: i, selectionSet: a }) {
			let s = u("", e, ": ") + n, l = s + u("(", c(r, ", "), ")");
			return l.length > o && (l = s + u("(\n", d(c(r, "\n")), "\n)")), c([
				l,
				c(i, " "),
				a
			], " ");
		} },
		Argument: { leave: ({ name: e, value: n }) => e + ": " + n },
		FragmentSpread: { leave: ({ name: e, directives: n }) => "..." + e + u(" ", c(n, " ")) },
		InlineFragment: { leave: ({ typeCondition: e, directives: n, selectionSet: r }) => c([
			"...",
			u("on ", e),
			c(n, " "),
			r
		], " ") },
		FragmentDefinition: { leave: ({ name: e, typeCondition: n, variableDefinitions: r, directives: i, selectionSet: a, description: o }) => u("", o, "\n") + `fragment ${e}${u("(", c(r, ", "), ")")} on ${n} ${u("", c(i, " "), " ")}` + a },
		IntValue: { leave: ({ value: e }) => e },
		FloatValue: { leave: ({ value: e }) => e },
		StringValue: { leave: ({ value: e, block: i }) => i ? (0, n.printBlockString)(e) : (0, r.printString)(e) },
		BooleanValue: { leave: ({ value: e }) => e ? "true" : "false" },
		NullValue: { leave: () => "null" },
		EnumValue: { leave: ({ value: e }) => e },
		ListValue: { leave: ({ values: e }) => "[" + c(e, ", ") + "]" },
		ObjectValue: { leave: ({ fields: e }) => "{" + c(e, ", ") + "}" },
		ObjectField: { leave: ({ name: e, value: n }) => e + ": " + n },
		Directive: { leave: ({ name: e, arguments: n }) => "@" + e + u("(", c(n, ", "), ")") },
		NamedType: { leave: ({ name: e }) => e },
		ListType: { leave: ({ type: e }) => "[" + e + "]" },
		NonNullType: { leave: ({ type: e }) => e + "!" },
		SchemaDefinition: { leave: ({ description: e, directives: n, operationTypes: r }) => u("", e, "\n") + c([
			"schema",
			c(n, " "),
			l(r)
		], " ") },
		OperationTypeDefinition: { leave: ({ operation: e, type: n }) => e + ": " + n },
		ScalarTypeDefinition: { leave: ({ description: e, name: n, directives: r }) => u("", e, "\n") + c([
			"scalar",
			n,
			c(r, " ")
		], " ") },
		ObjectTypeDefinition: { leave: ({ description: e, name: n, interfaces: r, directives: i, fields: a }) => u("", e, "\n") + c([
			"type",
			n,
			u("implements ", c(r, " & ")),
			c(i, " "),
			l(a)
		], " ") },
		FieldDefinition: { leave: ({ description: e, name: n, arguments: r, type: i, directives: a }) => u("", e, "\n") + n + (f(r) ? u("(\n", d(c(r, "\n")), "\n)") : u("(", c(r, ", "), ")")) + ": " + i + u(" ", c(a, " ")) },
		InputValueDefinition: { leave: ({ description: e, name: n, type: r, defaultValue: i, directives: a }) => u("", e, "\n") + c([
			n + ": " + r,
			u("= ", i),
			c(a, " ")
		], " ") },
		InterfaceTypeDefinition: { leave: ({ description: e, name: n, interfaces: r, directives: i, fields: a }) => u("", e, "\n") + c([
			"interface",
			n,
			u("implements ", c(r, " & ")),
			c(i, " "),
			l(a)
		], " ") },
		UnionTypeDefinition: { leave: ({ description: e, name: n, directives: r, types: i }) => u("", e, "\n") + c([
			"union",
			n,
			c(r, " "),
			u("= ", c(i, " | "))
		], " ") },
		EnumTypeDefinition: { leave: ({ description: e, name: n, directives: r, values: i }) => u("", e, "\n") + c([
			"enum",
			n,
			c(r, " "),
			l(i)
		], " ") },
		EnumValueDefinition: { leave: ({ description: e, name: n, directives: r }) => u("", e, "\n") + c([n, c(r, " ")], " ") },
		InputObjectTypeDefinition: { leave: ({ description: e, name: n, directives: r, fields: i }) => u("", e, "\n") + c([
			"input",
			n,
			c(r, " "),
			l(i)
		], " ") },
		DirectiveDefinition: { leave: ({ description: e, name: n, arguments: r, directives: i, repeatable: a, locations: o }) => u("", e, "\n") + "directive @" + n + (f(r) ? u("(\n", d(c(r, "\n")), "\n)") : u("(", c(r, ", "), ")")) + u(" ", c(i, " ")) + (a ? " repeatable" : "") + " on " + c(o, " | ") },
		SchemaExtension: { leave: ({ directives: e, operationTypes: n }) => c([
			"extend schema",
			c(e, " "),
			l(n)
		], " ") },
		ScalarTypeExtension: { leave: ({ name: e, directives: n }) => c([
			"extend scalar",
			e,
			c(n, " ")
		], " ") },
		ObjectTypeExtension: { leave: ({ name: e, interfaces: n, directives: r, fields: i }) => c([
			"extend type",
			e,
			u("implements ", c(n, " & ")),
			c(r, " "),
			l(i)
		], " ") },
		InterfaceTypeExtension: { leave: ({ name: e, interfaces: n, directives: r, fields: i }) => c([
			"extend interface",
			e,
			u("implements ", c(n, " & ")),
			c(r, " "),
			l(i)
		], " ") },
		UnionTypeExtension: { leave: ({ name: e, directives: n, types: r }) => c([
			"extend union",
			e,
			c(n, " "),
			u("= ", c(r, " | "))
		], " ") },
		EnumTypeExtension: { leave: ({ name: e, directives: n, values: r }) => c([
			"extend enum",
			e,
			c(n, " "),
			l(r)
		], " ") },
		InputObjectTypeExtension: { leave: ({ name: e, directives: n, fields: r }) => c([
			"extend input",
			e,
			c(n, " "),
			l(r)
		], " ") },
		DirectiveExtension: { leave: ({ name: e, directives: n }) => c(["extend directive @" + e, c(n, " ")], " ") },
		TypeCoordinate: { leave: ({ name: e }) => e },
		MemberCoordinate: { leave: ({ name: e, memberName: n }) => c([e, u(".", n)]) },
		ArgumentCoordinate: { leave: ({ name: e, fieldName: n, argumentName: r }) => c([
			e,
			u(".", n),
			u("(", r, ":)")
		]) },
		DirectiveCoordinate: { leave: ({ name: e }) => c(["@", e]) },
		DirectiveArgumentCoordinate: { leave: ({ name: e, argumentName: n }) => c([
			"@",
			e,
			u("(", n, ":)")
		]) }
	};
	function c(e, n = "") {
		return e?.filter((e) => e).join(n) ?? "";
	}
	function l(e) {
		return u("{\n", d(c(e, "\n")), "\n}");
	}
	function u(e, n, r = "") {
		return n != null && n !== "" ? e + n + r : "";
	}
	function d(e) {
		return u("  ", e.replace(/\n/g, "\n  "));
	}
	function f(e) {
		/* c8 ignore next */
		return e?.some((e) => e.includes("\n")) ?? !1;
	}
})), require_valueFromASTUntyped = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.valueFromASTUntyped = i;
	var n = require_keyValMap(), r = require_kinds();
	function i(e, a) {
		switch (e.kind) {
			case r.Kind.NULL: return null;
			case r.Kind.INT: return parseInt(e.value, 10);
			case r.Kind.FLOAT: return parseFloat(e.value);
			case r.Kind.STRING:
			case r.Kind.ENUM:
			case r.Kind.BOOLEAN: return e.value;
			case r.Kind.LIST: return e.values.map((e) => i(e, a));
			case r.Kind.OBJECT: return (0, n.keyValMap)(e.fields, (e) => e.name.value, (e) => i(e.value, a));
			case r.Kind.VARIABLE: return a?.[e.name.value];
		}
	}
})), require_assertName = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.assertEnumValueName = o, e.assertName = a;
	var n = require_devAssert(), r = require_GraphQLError(), i = require_characterClasses();
	function a(e) {
		if (e ?? (0, n.devAssert)(!1, "Must provide name."), typeof e == "string" || (0, n.devAssert)(!1, "Expected name to be a string."), e.length === 0) throw new r.GraphQLError("Expected name to be a non-empty string.");
		for (let n = 1; n < e.length; ++n) if (!(0, i.isNameContinue)(e.charCodeAt(n))) throw new r.GraphQLError(`Names must only contain [_a-zA-Z0-9] but "${e}" does not.`);
		if (!(0, i.isNameStart)(e.charCodeAt(0))) throw new r.GraphQLError(`Names must start with [_a-zA-Z] but "${e}" does not.`);
		return e;
	}
	function o(e) {
		if (e === "true" || e === "false" || e === "null") throw new r.GraphQLError(`Enum values cannot be named: ${e}`);
		return a(e);
	}
})), require_definition = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.argsToArgsConfig = Fz, e.assertAbstractType = K, e.assertCompositeType = G, e.assertEnumType = j, e.assertInputObjectType = N, e.assertInputType = z, e.assertInterfaceType = D, e.assertLeafType = U, e.assertListType = F, e.assertNamedType = Tz, e.assertNonNullType = L, e.assertNullableType = Sz, e.assertObjectType = T, e.assertOutputType = V, e.assertScalarType = C, e.assertType = x, e.assertUnionType = k, e.assertWrappingType = X, e.defineArguments = Nz, e.getNamedType = Ez, e.getNullableType = Cz, e.isAbstractType = xz, e.isCompositeType = W, e.isEnumType = A, e.isInputObjectType = M, e.isInputType = R, e.isInterfaceType = E, e.isLeafType = H, e.isListType = P, e.isNamedType = wz, e.isNonNullType = I, e.isNullableType = Z, e.isObjectType = w, e.isOutputType = B, e.isRequiredArgument = Iz, e.isRequiredInputField = Gz, e.isScalarType = S, e.isType = b, e.isUnionType = O, e.isWrappingType = Y, e.resolveObjMapThunk = Oz, e.resolveReadonlyArrayThunk = Dz;
	var n = require_devAssert(), r = require_didYouMean(), i = require_identityFunc(), a = require_inspect(), o = require_instanceOf(), s = require_isObjectLike(), c = require_keyMap(), l = require_keyValMap(), u = require_mapValue(), d = require_suggestionList(), f = require_toObjMap(), m = require_GraphQLError(), g = require_kinds(), _ = require_printer(), v = require_valueFromASTUntyped(), y = require_assertName();
	function b(e) {
		return S(e) || w(e) || E(e) || O(e) || A(e) || M(e) || P(e) || I(e);
	}
	function x(e) {
		if (!b(e)) throw Error(`Expected ${(0, a.inspect)(e)} to be a GraphQL type.`);
		return e;
	}
	function S(e) {
		return (0, o.instanceOf)(e, kz);
	}
	function C(e) {
		if (!S(e)) throw Error(`Expected ${(0, a.inspect)(e)} to be a GraphQL Scalar type.`);
		return e;
	}
	function w(e) {
		return (0, o.instanceOf)(e, Az);
	}
	function T(e) {
		if (!w(e)) throw Error(`Expected ${(0, a.inspect)(e)} to be a GraphQL Object type.`);
		return e;
	}
	function E(e) {
		return (0, o.instanceOf)(e, Lz);
	}
	function D(e) {
		if (!E(e)) throw Error(`Expected ${(0, a.inspect)(e)} to be a GraphQL Interface type.`);
		return e;
	}
	function O(e) {
		return (0, o.instanceOf)(e, Rz);
	}
	function k(e) {
		if (!O(e)) throw Error(`Expected ${(0, a.inspect)(e)} to be a GraphQL Union type.`);
		return e;
	}
	function A(e) {
		return (0, o.instanceOf)(e, Bz);
	}
	function j(e) {
		if (!A(e)) throw Error(`Expected ${(0, a.inspect)(e)} to be a GraphQL Enum type.`);
		return e;
	}
	function M(e) {
		return (0, o.instanceOf)(e, Uz);
	}
	function N(e) {
		if (!M(e)) throw Error(`Expected ${(0, a.inspect)(e)} to be a GraphQL Input Object type.`);
		return e;
	}
	function P(e) {
		return (0, o.instanceOf)(e, q);
	}
	function F(e) {
		if (!P(e)) throw Error(`Expected ${(0, a.inspect)(e)} to be a GraphQL List type.`);
		return e;
	}
	function I(e) {
		return (0, o.instanceOf)(e, J);
	}
	function L(e) {
		if (!I(e)) throw Error(`Expected ${(0, a.inspect)(e)} to be a GraphQL Non-Null type.`);
		return e;
	}
	function R(e) {
		return S(e) || A(e) || M(e) || Y(e) && R(e.ofType);
	}
	function z(e) {
		if (!R(e)) throw Error(`Expected ${(0, a.inspect)(e)} to be a GraphQL input type.`);
		return e;
	}
	function B(e) {
		return S(e) || w(e) || E(e) || O(e) || A(e) || Y(e) && B(e.ofType);
	}
	function V(e) {
		if (!B(e)) throw Error(`Expected ${(0, a.inspect)(e)} to be a GraphQL output type.`);
		return e;
	}
	function H(e) {
		return S(e) || A(e);
	}
	function U(e) {
		if (!H(e)) throw Error(`Expected ${(0, a.inspect)(e)} to be a GraphQL leaf type.`);
		return e;
	}
	function W(e) {
		return w(e) || E(e) || O(e);
	}
	function G(e) {
		if (!W(e)) throw Error(`Expected ${(0, a.inspect)(e)} to be a GraphQL composite type.`);
		return e;
	}
	function xz(e) {
		return E(e) || O(e);
	}
	function K(e) {
		if (!xz(e)) throw Error(`Expected ${(0, a.inspect)(e)} to be a GraphQL abstract type.`);
		return e;
	}
	var q = class {
		constructor(e) {
			b(e) || (0, n.devAssert)(!1, `Expected ${(0, a.inspect)(e)} to be a GraphQL type.`), this.ofType = e;
		}
		get [Symbol.toStringTag]() {
			return "GraphQLList";
		}
		toString() {
			return "[" + String(this.ofType) + "]";
		}
		toJSON() {
			return this.toString();
		}
	};
	e.GraphQLList = q;
	var J = class {
		constructor(e) {
			Z(e) || (0, n.devAssert)(!1, `Expected ${(0, a.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();
		}
	};
	e.GraphQLNonNull = J;
	function Y(e) {
		return P(e) || I(e);
	}
	function X(e) {
		if (!Y(e)) throw Error(`Expected ${(0, a.inspect)(e)} to be a GraphQL wrapping type.`);
		return e;
	}
	function Z(e) {
		return b(e) && !I(e);
	}
	function Sz(e) {
		if (!Z(e)) throw Error(`Expected ${(0, a.inspect)(e)} to be a GraphQL nullable type.`);
		return e;
	}
	function Cz(e) {
		if (e) return I(e) ? e.ofType : e;
	}
	function wz(e) {
		return S(e) || w(e) || E(e) || O(e) || A(e) || M(e);
	}
	function Tz(e) {
		if (!wz(e)) throw Error(`Expected ${(0, a.inspect)(e)} to be a GraphQL named type.`);
		return e;
	}
	function Ez(e) {
		if (e) {
			let n = e;
			for (; Y(n);) n = n.ofType;
			return n;
		}
	}
	function Dz(e) {
		return typeof e == "function" ? e() : e;
	}
	function Oz(e) {
		return typeof e == "function" ? e() : e;
	}
	var kz = class {
		constructor(e) {
			let r = e.parseValue ?? i.identityFunc;
			this.name = (0, y.assertName)(e.name), this.description = e.description, this.specifiedByURL = e.specifiedByURL, this.serialize = e.serialize ?? i.identityFunc, this.parseValue = r, this.parseLiteral = e.parseLiteral ?? ((e, n) => r((0, v.valueFromASTUntyped)(e, n))), this.extensions = (0, f.toObjMap)(e.extensions), this.astNode = e.astNode, this.extensionASTNodes = e.extensionASTNodes ?? [], e.specifiedByURL == null || typeof e.specifiedByURL == "string" || (0, n.devAssert)(!1, `${this.name} must provide "specifiedByURL" as a string, but got: ${(0, a.inspect)(e.specifiedByURL)}.`), e.serialize == null || typeof e.serialize == "function" || (0, n.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" || (0, n.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();
		}
	};
	e.GraphQLScalarType = kz;
	var Az = class {
		constructor(e) {
			this.name = (0, y.assertName)(e.name), this.description = e.description, this.isTypeOf = e.isTypeOf, this.extensions = (0, f.toObjMap)(e.extensions), this.astNode = e.astNode, this.extensionASTNodes = e.extensionASTNodes ?? [], this._fields = () => Mz(e), this._interfaces = () => jz(e), e.isTypeOf == null || typeof e.isTypeOf == "function" || (0, n.devAssert)(!1, `${this.name} must provide "isTypeOf" as a function, but got: ${(0, a.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: Pz(this.getFields()),
				isTypeOf: this.isTypeOf,
				extensions: this.extensions,
				astNode: this.astNode,
				extensionASTNodes: this.extensionASTNodes
			};
		}
		toString() {
			return this.name;
		}
		toJSON() {
			return this.toString();
		}
	};
	e.GraphQLObjectType = Az;
	function jz(e) {
		let r = Dz(e.interfaces ?? []);
		return Array.isArray(r) || (0, n.devAssert)(!1, `${e.name} interfaces must be an Array or a function which returns an Array.`), r;
	}
	function Mz(e) {
		let r = Oz(e.fields);
		return Q(r) || (0, n.devAssert)(!1, `${e.name} fields must be an object with field names as keys or a function which returns such an object.`), (0, u.mapValue)(r, (r, i) => {
			Q(r) || (0, n.devAssert)(!1, `${e.name}.${i} field config must be an object.`), r.resolve == null || typeof r.resolve == "function" || (0, n.devAssert)(!1, `${e.name}.${i} field resolver must be a function if provided, but got: ${(0, a.inspect)(r.resolve)}.`);
			let o = r.args ?? {};
			return Q(o) || (0, n.devAssert)(!1, `${e.name}.${i} args must be an object with argument names as keys.`), {
				name: (0, y.assertName)(i),
				description: r.description,
				type: r.type,
				args: Nz(o),
				resolve: r.resolve,
				subscribe: r.subscribe,
				deprecationReason: r.deprecationReason,
				extensions: (0, f.toObjMap)(r.extensions),
				astNode: r.astNode
			};
		});
	}
	function Nz(e) {
		return Object.entries(e).map(([e, n]) => ({
			name: (0, y.assertName)(e),
			description: n.description,
			type: n.type,
			defaultValue: n.defaultValue,
			deprecationReason: n.deprecationReason,
			extensions: (0, f.toObjMap)(n.extensions),
			astNode: n.astNode
		}));
	}
	function Q(e) {
		return (0, s.isObjectLike)(e) && !Array.isArray(e);
	}
	function Pz(e) {
		return (0, u.mapValue)(e, (e) => ({
			description: e.description,
			type: e.type,
			args: Fz(e.args),
			resolve: e.resolve,
			subscribe: e.subscribe,
			deprecationReason: e.deprecationReason,
			extensions: e.extensions,
			astNode: e.astNode
		}));
	}
	function Fz(e) {
		return (0, l.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 Iz(e) {
		return I(e.type) && e.defaultValue === void 0;
	}
	var Lz = class {
		constructor(e) {
			this.name = (0, y.assertName)(e.name), this.description = e.description, this.resolveType = e.resolveType, this.extensions = (0, f.toObjMap)(e.extensions), this.astNode = e.astNode, this.extensionASTNodes = e.extensionASTNodes ?? [], this._fields = Mz.bind(void 0, e), this._interfaces = jz.bind(void 0, e), e.resolveType == null || typeof e.resolveType == "function" || (0, n.devAssert)(!1, `${this.name} must provide "resolveType" as a function, but got: ${(0, a.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: Pz(this.getFields()),
				resolveType: this.resolveType,
				extensions: this.extensions,
				astNode: this.astNode,
				extensionASTNodes: this.extensionASTNodes
			};
		}
		toString() {
			return this.name;
		}
		toJSON() {
			return this.toString();
		}
	};
	e.GraphQLInterfaceType = Lz;
	var Rz = class {
		constructor(e) {
			this.name = (0, y.assertName)(e.name), this.description = e.description, this.resolveType = e.resolveType, this.extensions = (0, f.toObjMap)(e.extensions), this.astNode = e.astNode, this.extensionASTNodes = e.extensionASTNodes ?? [], this._types = zz.bind(void 0, e), e.resolveType == null || typeof e.resolveType == "function" || (0, n.devAssert)(!1, `${this.name} must provide "resolveType" as a function, but got: ${(0, a.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();
		}
	};
	e.GraphQLUnionType = Rz;
	function zz(e) {
		let r = Dz(e.types);
		return Array.isArray(r) || (0, n.devAssert)(!1, `Must provide Array of types or a function which returns such an array for Union ${e.name}.`), r;
	}
	var Bz = class {
		constructor(e) {
			this.name = (0, y.assertName)(e.name), this.description = e.description, this.extensions = (0, f.toObjMap)(e.extensions), this.astNode = e.astNode, this.extensionASTNodes = e.extensionASTNodes ?? [], this._values = typeof e.values == "function" ? e.values : Hz(this.name, e.values), this._valueLookup = null, this._nameLookup = null;
		}
		get [Symbol.toStringTag]() {
			return "GraphQLEnumType";
		}
		getValues() {
			return typeof this._values == "function" && (this._values = Hz(this.name, this._values())), this._values;
		}
		getValue(e) {
			return this._nameLookup === null && (this._nameLookup = (0, c.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 n = this._valueLookup.get(e);
			if (n === void 0) throw new m.GraphQLError(`Enum "${this.name}" cannot represent value: ${(0, a.inspect)(e)}`);
			return n.name;
		}
		parseValue(e) {
			if (typeof e != "string") {
				let n = (0, a.inspect)(e);
				throw new m.GraphQLError(`Enum "${this.name}" cannot represent non-string value: ${n}.` + Vz(this, n));
			}
			let n = this.getValue(e);
			if (n == null) throw new m.GraphQLError(`Value "${e}" does not exist in "${this.name}" enum.` + Vz(this, e));
			return n.value;
		}
		parseLiteral(e, n) {
			if (e.kind !== g.Kind.ENUM) {
				let n = (0, _.print)(e);
				throw new m.GraphQLError(`Enum "${this.name}" cannot represent non-enum value: ${n}.` + Vz(this, n), { nodes: e });
			}
			let r = this.getValue(e.value);
			if (r == null) {
				let n = (0, _.print)(e);
				throw new m.GraphQLError(`Value "${n}" does not exist in "${this.name}" enum.` + Vz(this, n), { nodes: e });
			}
			return r.value;
		}
		toConfig() {
			let e = (0, l.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();
		}
	};
	e.GraphQLEnumType = Bz;
	function Vz(e, n) {
		let i = e.getValues().map((e) => e.name), a = (0, d.suggestionList)(n, i);
		return (0, r.didYouMean)("the enum value", a);
	}
	function Hz(e, r) {
		return Q(r) || (0, n.devAssert)(!1, `${e} values must be an object with value names as keys.`), Object.entries(r).map(([r, i]) => (Q(i) || (0, n.devAssert)(!1, `${e}.${r} must refer to an object with a "value" key representing an internal value but got: ${(0, a.inspect)(i)}.`), {
			name: (0, y.assertEnumValueName)(r),
			description: i.description,
			value: i.value === void 0 ? r : i.value,
			deprecationReason: i.deprecationReason,
			extensions: (0, f.toObjMap)(i.extensions),
			astNode: i.astNode
		}));
	}
	var Uz = class {
		constructor(e) {
			this.name = (0, y.assertName)(e.name), this.description = e.description, this.extensions = (0, f.toObjMap)(e.extensions), this.astNode = e.astNode, this.extensionASTNodes = e.extensionASTNodes ?? [], this.isOneOf = e.isOneOf ?? !1, this._fields = Wz.bind(void 0, e);
		}
		get [Symbol.toStringTag]() {
			return "GraphQLInputObjectType";
		}
		getFields() {
			return typeof this._fields == "function" && (this._fields = this._fields()), this._fields;
		}
		toConfig() {
			let e = (0, u.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();
		}
	};
	e.GraphQLInputObjectType = Uz;
	function Wz(e) {
		let r = Oz(e.fields);
		return Q(r) || (0, n.devAssert)(!1, `${e.name} fields must be an object with field names as keys or a function which returns such an object.`), (0, u.mapValue)(r, (r, i) => (!("resolve" in r) || (0, n.devAssert)(!1, `${e.name}.${i} field has a resolve property, but Input Types cannot define resolvers.`), {
			name: (0, y.assertName)(i),
			description: r.description,
			type: r.type,
			defaultValue: r.defaultValue,
			deprecationReason: r.deprecationReason,
			extensions: (0, f.toObjMap)(r.extensions),
			astNode: r.astNode
		}));
	}
	function Gz(e) {
		return I(e.type) && e.defaultValue === void 0;
	}
})), require_typeComparators = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.doTypesOverlap = a, e.isEqualType = r, e.isTypeSubTypeOf = i;
	var n = require_definition();
	function r(e, i) {
		return e === i ? !0 : (0, n.isNonNullType)(e) && (0, n.isNonNullType)(i) || (0, n.isListType)(e) && (0, n.isListType)(i) ? r(e.ofType, i.ofType) : !1;
	}
	function i(e, r, a) {
		return r === a ? !0 : (0, n.isNonNullType)(a) ? (0, n.isNonNullType)(r) ? i(e, r.ofType, a.ofType) : !1 : (0, n.isNonNullType)(r) ? i(e, r.ofType, a) : (0, n.isListType)(a) ? (0, n.isListType)(r) ? i(e, r.ofType, a.ofType) : !1 : (0, n.isListType)(r) ? !1 : (0, n.isAbstractType)(a) && ((0, n.isInterfaceType)(r) || (0, n.isObjectType)(r)) && e.isSubType(a, r);
	}
	function a(e, r, i) {
		return r === i ? !0 : (0, n.isAbstractType)(r) ? (0, n.isAbstractType)(i) ? e.getPossibleTypes(r).some((n) => e.isSubType(i, n)) : e.isSubType(r, i) : (0, n.isAbstractType)(i) ? e.isSubType(i, r) : !1;
	}
})), require_scalars = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.isSpecifiedScalarType = v;
	var n = require_inspect(), r = require_isObjectLike(), i = require_GraphQLError(), a = require_kinds(), o = require_printer(), s = require_definition(), c = 2147483647;
	e.GRAPHQL_MAX_INT = c;
	var l = -2147483648;
	e.GRAPHQL_MIN_INT = l;
	var u = new s.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 r = y(e);
			if (typeof r == "boolean") return r ? 1 : 0;
			let a = r;
			if (typeof r == "string" && r !== "" && (a = Number(r)), typeof a != "number" || !Number.isInteger(a)) throw new i.GraphQLError(`Int cannot represent non-integer value: ${(0, n.inspect)(r)}`);
			if (a > c || a < l) throw new i.GraphQLError("Int cannot represent non 32-bit signed integer value: " + (0, n.inspect)(r));
			return a;
		},
		parseValue(e) {
			if (typeof e != "number" || !Number.isInteger(e)) throw new i.GraphQLError(`Int cannot represent non-integer value: ${(0, n.inspect)(e)}`);
			if (e > c || e < l) throw new i.GraphQLError(`Int cannot represent non 32-bit signed integer value: ${e}`);
			return e;
		},
		parseLiteral(e) {
			if (e.kind !== a.Kind.INT) throw new i.GraphQLError(`Int cannot represent non-integer value: ${(0, o.print)(e)}`, { nodes: e });
			let n = parseInt(e.value, 10);
			if (n > c || n < l) throw new i.GraphQLError(`Int cannot represent non 32-bit signed integer value: ${e.value}`, { nodes: e });
			return n;
		}
	});
	e.GraphQLInt = u;
	var d = new s.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 r = y(e);
			if (typeof r == "boolean") return r ? 1 : 0;
			let a = r;
			if (typeof r == "string" && r !== "" && (a = Number(r)), typeof a != "number" || !Number.isFinite(a)) throw new i.GraphQLError(`Float cannot represent non numeric value: ${(0, n.inspect)(r)}`);
			return a;
		},
		parseValue(e) {
			if (typeof e != "number" || !Number.isFinite(e)) throw new i.GraphQLError(`Float cannot represent non numeric value: ${(0, n.inspect)(e)}`);
			return e;
		},
		parseLiteral(e) {
			if (e.kind !== a.Kind.FLOAT && e.kind !== a.Kind.INT) throw new i.GraphQLError(`Float cannot represent non numeric value: ${(0, o.print)(e)}`, e);
			return parseFloat(e.value);
		}
	});
	e.GraphQLFloat = d;
	var f = new s.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 r = y(e);
			if (typeof r == "string") return r;
			if (typeof r == "boolean") return r ? "true" : "false";
			if (typeof r == "number" && Number.isFinite(r)) return r.toString();
			throw new i.GraphQLError(`String cannot represent value: ${(0, n.inspect)(e)}`);
		},
		parseValue(e) {
			if (typeof e != "string") throw new i.GraphQLError(`String cannot represent a non string value: ${(0, n.inspect)(e)}`);
			return e;
		},
		parseLiteral(e) {
			if (e.kind !== a.Kind.STRING) throw new i.GraphQLError(`String cannot represent a non string value: ${(0, o.print)(e)}`, { nodes: e });
			return e.value;
		}
	});
	e.GraphQLString = f;
	var m = new s.GraphQLScalarType({
		name: "Boolean",
		description: "The `Boolean` scalar type represents `true` or `false`.",
		serialize(e) {
			let r = y(e);
			if (typeof r == "boolean") return r;
			if (Number.isFinite(r)) return r !== 0;
			throw new i.GraphQLError(`Boolean cannot represent a non boolean value: ${(0, n.inspect)(r)}`);
		},
		parseValue(e) {
			if (typeof e != "boolean") throw new i.GraphQLError(`Boolean cannot represent a non boolean value: ${(0, n.inspect)(e)}`);
			return e;
		},
		parseLiteral(e) {
			if (e.kind !== a.Kind.BOOLEAN) throw new i.GraphQLError(`Boolean cannot represent a non boolean value: ${(0, o.print)(e)}`, { nodes: e });
			return e.value;
		}
	});
	e.GraphQLBoolean = m;
	var g = new s.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 r = y(e);
			if (typeof r == "string") return r;
			if (Number.isInteger(r)) return String(r);
			throw new i.GraphQLError(`ID cannot represent value: ${(0, n.inspect)(e)}`);
		},
		parseValue(e) {
			if (typeof e == "string") return e;
			if (typeof e == "number" && Number.isInteger(e)) return e.toString();
			throw new i.GraphQLError(`ID cannot represent value: ${(0, n.inspect)(e)}`);
		},
		parseLiteral(e) {
			if (e.kind !== a.Kind.STRING && e.kind !== a.Kind.INT) throw new i.GraphQLError("ID cannot represent a non-string and non-integer value: " + (0, o.print)(e), { nodes: e });
			return e.value;
		}
	});
	e.GraphQLID = g;
	var _ = Object.freeze([
		f,
		u,
		d,
		m,
		g
	]);
	e.specifiedScalarTypes = _;
	function v(e) {
		return _.some(({ name: n }) => e.name === n);
	}
	function y(e) {
		if ((0, r.isObjectLike)(e)) {
			if (typeof e.valueOf == "function") {
				let n = e.valueOf();
				if (!(0, r.isObjectLike)(n)) return n;
			}
			if (typeof e.toJSON == "function") return e.toJSON();
		}
		return e;
	}
})), require_directives = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.assertDirective = f, e.isDirective = d, e.isSpecifiedDirective = C;
	var n = require_devAssert(), r = require_inspect(), i = require_instanceOf(), a = require_isObjectLike(), o = require_toObjMap(), s = require_directiveLocation(), c = require_assertName(), l = require_definition(), u = require_scalars();
	function d(e) {
		return (0, i.instanceOf)(e, m);
	}
	function f(e) {
		if (!d(e)) throw Error(`Expected ${(0, r.inspect)(e)} to be a GraphQL directive.`);
		return e;
	}
	var m = class {
		constructor(e) {
			this.name = (0, c.assertName)(e.name), this.description = e.description, this.locations = e.locations, this.isRepeatable = e.isRepeatable ?? !1, this.deprecationReason = e.deprecationReason, this.extensions = (0, o.toObjMap)(e.extensions), this.astNode = e.astNode, this.extensionASTNodes = e.extensionASTNodes ?? [], Array.isArray(e.locations) || (0, n.devAssert)(!1, `@${e.name} locations must be an Array.`);
			let r = e.args ?? {};
			(0, a.isObjectLike)(r) && !Array.isArray(r) || (0, n.devAssert)(!1, `@${e.name} args must be an object with argument names as keys.`), this.args = (0, l.defineArguments)(r);
		}
		get [Symbol.toStringTag]() {
			return "GraphQLDirective";
		}
		toConfig() {
			return {
				name: this.name,
				description: this.description,
				locations: this.locations,
				args: (0, l.argsToArgsConfig)(this.args),
				isRepeatable: this.isRepeatable,
				deprecationReason: this.deprecationReason,
				extensions: this.extensions,
				astNode: this.astNode,
				extensionASTNodes: this.extensionASTNodes
			};
		}
		toString() {
			return "@" + this.name;
		}
		toJSON() {
			return this.toString();
		}
	};
	e.GraphQLDirective = m;
	var g = new m({
		name: "include",
		description: "Directs the executor to include this field or fragment only when the `if` argument is true.",
		locations: [
			s.DirectiveLocation.FIELD,
			s.DirectiveLocation.FRAGMENT_SPREAD,
			s.DirectiveLocation.INLINE_FRAGMENT
		],
		args: { if: {
			type: new l.GraphQLNonNull(u.GraphQLBoolean),
			description: "Included when true."
		} }
	});
	e.GraphQLIncludeDirective = g;
	var _ = new m({
		name: "skip",
		description: "Directs the executor to skip this field or fragment when the `if` argument is true.",
		locations: [
			s.DirectiveLocation.FIELD,
			s.DirectiveLocation.FRAGMENT_SPREAD,
			s.DirectiveLocation.INLINE_FRAGMENT
		],
		args: { if: {
			type: new l.GraphQLNonNull(u.GraphQLBoolean),
			description: "Skipped when true."
		} }
	});
	e.GraphQLSkipDirective = _;
	var v = "No longer supported";
	e.DEFAULT_DEPRECATION_REASON = v;
	var y = new m({
		name: "deprecated",
		description: "Marks an element of a GraphQL schema as no longer supported.",
		locations: [
			s.DirectiveLocation.FIELD_DEFINITION,
			s.DirectiveLocation.ARGUMENT_DEFINITION,
			s.DirectiveLocation.INPUT_FIELD_DEFINITION,
			s.DirectiveLocation.ENUM_VALUE,
			s.DirectiveLocation.DIRECTIVE_DEFINITION
		],
		args: { reason: {
			type: u.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: v
		} }
	});
	e.GraphQLDeprecatedDirective = y;
	var b = new m({
		name: "specifiedBy",
		description: "Exposes a URL that specifies the behavior of this scalar.",
		locations: [s.DirectiveLocation.SCALAR],
		args: { url: {
			type: new l.GraphQLNonNull(u.GraphQLString),
			description: "The URL that specifies the behavior of this scalar."
		} }
	});
	e.GraphQLSpecifiedByDirective = b;
	var x = new m({
		name: "oneOf",
		description: "Indicates exactly one field must be supplied and this field must not be `null`.",
		locations: [s.DirectiveLocation.INPUT_OBJECT],
		args: {}
	});
	e.GraphQLOneOfDirective = x;
	var S = Object.freeze([
		g,
		_,
		y,
		b,
		x
	]);
	e.specifiedDirectives = S;
	function C(e) {
		return S.some(({ name: n }) => n === e.name);
	}
})), require_isIterableObject = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.isIterableObject = n;
	function n(e) {
		return typeof e == "object" && typeof e?.[Symbol.iterator] == "function";
	}
})), require_astFromValue = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.astFromValue = l;
	var n = require_inspect(), r = require_invariant(), i = require_isIterableObject(), a = require_isObjectLike(), o = require_kinds(), s = require_definition(), c = require_scalars();
	function l(e, d) {
		if ((0, s.isNonNullType)(d)) {
			let n = l(e, d.ofType);
			return n?.kind === o.Kind.NULL ? null : n;
		}
		if (e === null) return { kind: o.Kind.NULL };
		if (e === void 0) return null;
		if ((0, s.isListType)(d)) {
			let n = d.ofType;
			if ((0, i.isIterableObject)(e)) {
				let r = [];
				for (let i of e) {
					let e = l(i, n);
					e != null && r.push(e);
				}
				return {
					kind: o.Kind.LIST,
					values: r
				};
			}
			return l(e, n);
		}
		if ((0, s.isInputObjectType)(d)) {
			if (!(0, a.isObjectLike)(e)) return null;
			let n = [];
			for (let r of Object.values(d.getFields())) {
				let i = l(e[r.name], r.type);
				i && n.push({
					kind: o.Kind.OBJECT_FIELD,
					name: {
						kind: o.Kind.NAME,
						value: r.name
					},
					value: i
				});
			}
			return {
				kind: o.Kind.OBJECT,
				fields: n
			};
		}
		if ((0, s.isLeafType)(d)) {
			let r = d.serialize(e);
			if (r == null) return null;
			if (typeof r == "boolean") return {
				kind: o.Kind.BOOLEAN,
				value: r
			};
			if (typeof r == "number" && Number.isFinite(r)) {
				let e = String(r);
				return u.test(e) ? {
					kind: o.Kind.INT,
					value: e
				} : {
					kind: o.Kind.FLOAT,
					value: e
				};
			}
			if (typeof r == "string") return (0, s.isEnumType)(d) ? {
				kind: o.Kind.ENUM,
				value: r
			} : d === c.GraphQLID && u.test(r) ? {
				kind: o.Kind.INT,
				value: r
			} : {
				kind: o.Kind.STRING,
				value: r
			};
			throw TypeError(`Cannot convert value to AST: ${(0, n.inspect)(r)}.`);
		}
		/* c8 ignore next 3 */
		(0, r.invariant)(!1, "Unexpected input type: " + (0, n.inspect)(d));
	}
	var u = /^-?(?:0|[1-9][0-9]*)$/;
})), require_introspection = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.isIntrospectionType = x;
	var n = require_inspect(), r = require_invariant(), i = require_directiveLocation(), a = require_printer(), o = require_astFromValue(), s = require_definition(), c = require_scalars(), l = new s.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: c.GraphQLString,
				resolve: (e) => e.description
			},
			types: {
				description: "A list of all types supported by this server.",
				type: new s.GraphQLNonNull(new s.GraphQLList(new s.GraphQLNonNull(f))),
				resolve(e) {
					return Object.values(e.getTypeMap());
				}
			},
			queryType: {
				description: "The type that query operations will be rooted at.",
				type: new s.GraphQLNonNull(f),
				resolve: (e) => e.getQueryType()
			},
			mutationType: {
				description: "If this server supports mutation, the type that mutation operations will be rooted at.",
				type: f,
				resolve: (e) => e.getMutationType()
			},
			subscriptionType: {
				description: "If this server support subscription, the type that subscription operations will be rooted at.",
				type: f,
				resolve: (e) => e.getSubscriptionType()
			},
			directives: {
				description: "A list of all directives supported by this server.",
				type: new s.GraphQLNonNull(new s.GraphQLList(new s.GraphQLNonNull(u))),
				args: { includeDeprecated: {
					type: new s.GraphQLNonNull(c.GraphQLBoolean),
					defaultValue: !1
				} },
				resolve: (e, { includeDeprecated: n }) => n ? e.getDirectives() : e.getDirectives().filter((e) => e.deprecationReason == null)
			}
		})
	});
	e.__Schema = l;
	var u = new s.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 s.GraphQLNonNull(c.GraphQLString),
				resolve: (e) => e.name
			},
			description: {
				type: c.GraphQLString,
				resolve: (e) => e.description
			},
			isRepeatable: {
				type: new s.GraphQLNonNull(c.GraphQLBoolean),
				resolve: (e) => e.isRepeatable
			},
			locations: {
				type: new s.GraphQLNonNull(new s.GraphQLList(new s.GraphQLNonNull(d))),
				resolve: (e) => e.locations
			},
			args: {
				type: new s.GraphQLNonNull(new s.GraphQLList(new s.GraphQLNonNull(g))),
				args: { includeDeprecated: {
					type: c.GraphQLBoolean,
					defaultValue: !1
				} },
				resolve(e, { includeDeprecated: n }) {
					return n ? e.args : e.args.filter((e) => e.deprecationReason == null);
				}
			},
			isDeprecated: {
				type: new s.GraphQLNonNull(c.GraphQLBoolean),
				resolve: (e) => e.deprecationReason != null
			},
			deprecationReason: {
				type: c.GraphQLString,
				resolve: (e) => e.deprecationReason
			}
		})
	});
	e.__Directive = u;
	var d = new s.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: i.DirectiveLocation.QUERY,
				description: "Location adjacent to a query operation."
			},
			MUTATION: {
				value: i.DirectiveLocation.MUTATION,
				description: "Location adjacent to a mutation operation."
			},
			SUBSCRIPTION: {
				value: i.DirectiveLocation.SUBSCRIPTION,
				description: "Location adjacent to a subscription operation."
			},
			FIELD: {
				value: i.DirectiveLocation.FIELD,
				description: "Location adjacent to a field."
			},
			FRAGMENT_DEFINITION: {
				value: i.DirectiveLocation.FRAGMENT_DEFINITION,
				description: "Location adjacent to a fragment definition."
			},
			FRAGMENT_SPREAD: {
				value: i.DirectiveLocation.FRAGMENT_SPREAD,
				description: "Location adjacent to a fragment spread."
			},
			INLINE_FRAGMENT: {
				value: i.DirectiveLocation.INLINE_FRAGMENT,
				description: "Location adjacent to an inline fragment."
			},
			VARIABLE_DEFINITION: {
				value: i.DirectiveLocation.VARIABLE_DEFINITION,
				description: "Location adjacent to a variable definition."
			},
			SCHEMA: {
				value: i.DirectiveLocation.SCHEMA,
				description: "Location adjacent to a schema definition."
			},
			SCALAR: {
				value: i.DirectiveLocation.SCALAR,
				description: "Location adjacent to a scalar definition."
			},
			OBJECT: {
				value: i.DirectiveLocation.OBJECT,
				description: "Location adjacent to an object type definition."
			},
			FIELD_DEFINITION: {
				value: i.DirectiveLocation.FIELD_DEFINITION,
				description: "Location adjacent to a field definition."
			},
			ARGUMENT_DEFINITION: {
				value: i.DirectiveLocation.ARGUMENT_DEFINITION,
				description: "Location adjacent to an argument definition."
			},
			INTERFACE: {
				value: i.DirectiveLocation.INTERFACE,
				description: "Location adjacent to an interface definition."
			},
			UNION: {
				value: i.DirectiveLocation.UNION,
				description: "Location adjacent to a union definition."
			},
			ENUM: {
				value: i.DirectiveLocation.ENUM,
				description: "Location adjacent to an enum definition."
			},
			ENUM_VALUE: {
				value: i.DirectiveLocation.ENUM_VALUE,
				description: "Location adjacent to an enum value definition."
			},
			INPUT_OBJECT: {
				value: i.DirectiveLocation.INPUT_OBJECT,
				description: "Location adjacent to an input object type definition."
			},
			INPUT_FIELD_DEFINITION: {
				value: i.DirectiveLocation.INPUT_FIELD_DEFINITION,
				description: "Location adjacent to an input object field definition."
			},
			DIRECTIVE_DEFINITION: {
				value: i.DirectiveLocation.DIRECTIVE_DEFINITION,
				description: "Location adjacent to a directive definition."
			}
		}
	});
	e.__DirectiveLocation = d;
	var f = new s.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 s.GraphQLNonNull(y),
				resolve(e) {
					if ((0, s.isScalarType)(e)) return v.SCALAR;
					if ((0, s.isObjectType)(e)) return v.OBJECT;
					if ((0, s.isInterfaceType)(e)) return v.INTERFACE;
					if ((0, s.isUnionType)(e)) return v.UNION;
					if ((0, s.isEnumType)(e)) return v.ENUM;
					if ((0, s.isInputObjectType)(e)) return v.INPUT_OBJECT;
					if ((0, s.isListType)(e)) return v.LIST;
					if ((0, s.isNonNullType)(e)) return v.NON_NULL;
					/* c8 ignore next 3 */
					(0, r.invariant)(!1, `Unexpected type: "${(0, n.inspect)(e)}".`);
				}
			},
			name: {
				type: c.GraphQLString,
				resolve: (e) => "name" in e ? e.name : void 0
			},
			description: {
				type: c.GraphQLString,
				resolve: (e) => "description" in e ? e.description : void 0
			},
			specifiedByURL: {
				type: c.GraphQLString,
				resolve: (e) => "specifiedByURL" in e ? e.specifiedByURL : void 0
			},
			fields: {
				type: new s.GraphQLList(new s.GraphQLNonNull(m)),
				args: { includeDeprecated: {
					type: c.GraphQLBoolean,
					defaultValue: !1
				} },
				resolve(e, { includeDeprecated: n }) {
					if ((0, s.isObjectType)(e) || (0, s.isInterfaceType)(e)) {
						let r = Object.values(e.getFields());
						return n ? r : r.filter((e) => e.deprecationReason == null);
					}
				}
			},
			interfaces: {
				type: new s.GraphQLList(new s.GraphQLNonNull(f)),
				resolve(e) {
					if ((0, s.isObjectType)(e) || (0, s.isInterfaceType)(e)) return e.getInterfaces();
				}
			},
			possibleTypes: {
				type: new s.GraphQLList(new s.GraphQLNonNull(f)),
				resolve(e, n, r, { schema: i }) {
					if ((0, s.isAbstractType)(e)) return i.getPossibleTypes(e);
				}
			},
			enumValues: {
				type: new s.GraphQLList(new s.GraphQLNonNull(_)),
				args: { includeDeprecated: {
					type: c.GraphQLBoolean,
					defaultValue: !1
				} },
				resolve(e, { includeDeprecated: n }) {
					if ((0, s.isEnumType)(e)) {
						let r = e.getValues();
						return n ? r : r.filter((e) => e.deprecationReason == null);
					}
				}
			},
			inputFields: {
				type: new s.GraphQLList(new s.GraphQLNonNull(g)),
				args: { includeDeprecated: {
					type: c.GraphQLBoolean,
					defaultValue: !1
				} },
				resolve(e, { includeDeprecated: n }) {
					if ((0, s.isInputObjectType)(e)) {
						let r = Object.values(e.getFields());
						return n ? r : r.filter((e) => e.deprecationReason == null);
					}
				}
			},
			ofType: {
				type: f,
				resolve: (e) => "ofType" in e ? e.ofType : void 0
			},
			isOneOf: {
				type: c.GraphQLBoolean,
				resolve: (e) => {
					if ((0, s.isInputObjectType)(e)) return e.isOneOf;
				}
			}
		})
	});
	e.__Type = f;
	var m = new s.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 s.GraphQLNonNull(c.GraphQLString),
				resolve: (e) => e.name
			},
			description: {
				type: c.GraphQLString,
				resolve: (e) => e.description
			},
			args: {
				type: new s.GraphQLNonNull(new s.GraphQLList(new s.GraphQLNonNull(g))),
				args: { includeDeprecated: {
					type: c.GraphQLBoolean,
					defaultValue: !1
				} },
				resolve(e, { includeDeprecated: n }) {
					return n ? e.args : e.args.filter((e) => e.deprecationReason == null);
				}
			},
			type: {
				type: new s.GraphQLNonNull(f),
				resolve: (e) => e.type
			},
			isDeprecated: {
				type: new s.GraphQLNonNull(c.GraphQLBoolean),
				resolve: (e) => e.deprecationReason != null
			},
			deprecationReason: {
				type: c.GraphQLString,
				resolve: (e) => e.deprecationReason
			}
		})
	});
	e.__Field = m;
	var g = new s.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 s.GraphQLNonNull(c.GraphQLString),
				resolve: (e) => e.name
			},
			description: {
				type: c.GraphQLString,
				resolve: (e) => e.description
			},
			type: {
				type: new s.GraphQLNonNull(f),
				resolve: (e) => e.type
			},
			defaultValue: {
				type: c.GraphQLString,
				description: "A GraphQL-formatted string representing the default value for this input value.",
				resolve(e) {
					let { type: n, defaultValue: r } = e, i = (0, o.astFromValue)(r, n);
					return i ? (0, a.print)(i) : null;
				}
			},
			isDeprecated: {
				type: new s.GraphQLNonNull(c.GraphQLBoolean),
				resolve: (e) => e.deprecationReason != null
			},
			deprecationReason: {
				type: c.GraphQLString,
				resolve: (e) => e.deprecationReason
			}
		})
	});
	e.__InputValue = g;
	var _ = new s.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 s.GraphQLNonNull(c.GraphQLString),
				resolve: (e) => e.name
			},
			description: {
				type: c.GraphQLString,
				resolve: (e) => e.description
			},
			isDeprecated: {
				type: new s.GraphQLNonNull(c.GraphQLBoolean),
				resolve: (e) => e.deprecationReason != null
			},
			deprecationReason: {
				type: c.GraphQLString,
				resolve: (e) => e.deprecationReason
			}
		})
	});
	e.__EnumValue = _;
	var v;
	(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";
	})(v || (e.TypeKind = v = {}));
	var y = new s.GraphQLEnumType({
		name: "__TypeKind",
		description: "An enum describing what kind of type a given `__Type` is.",
		values: {
			SCALAR: {
				value: v.SCALAR,
				description: "Indicates this type is a scalar."
			},
			OBJECT: {
				value: v.OBJECT,
				description: "Indicates this type is an object. `fields` and `interfaces` are valid fields."
			},
			INTERFACE: {
				value: v.INTERFACE,
				description: "Indicates this type is an interface. `fields`, `interfaces`, and `possibleTypes` are valid fields."
			},
			UNION: {
				value: v.UNION,
				description: "Indicates this type is a union. `possibleTypes` is a valid field."
			},
			ENUM: {
				value: v.ENUM,
				description: "Indicates this type is an enum. `enumValues` is a valid field."
			},
			INPUT_OBJECT: {
				value: v.INPUT_OBJECT,
				description: "Indicates this type is an input object. `inputFields` is a valid field."
			},
			LIST: {
				value: v.LIST,
				description: "Indicates this type is a list. `ofType` is a valid field."
			},
			NON_NULL: {
				value: v.NON_NULL,
				description: "Indicates this type is a non-null. `ofType` is a valid field."
			}
		}
	});
	e.__TypeKind = y, e.SchemaMetaFieldDef = {
		name: "__schema",
		type: new s.GraphQLNonNull(l),
		description: "Access the current type schema of this server.",
		args: [],
		resolve: (e, n, r, { schema: i }) => i,
		deprecationReason: void 0,
		extensions: Object.create(null),
		astNode: void 0
	}, e.TypeMetaFieldDef = {
		name: "__type",
		type: f,
		description: "Request the type information of a single type.",
		args: [{
			name: "name",
			description: void 0,
			type: new s.GraphQLNonNull(c.GraphQLString),
			defaultValue: void 0,
			deprecationReason: void 0,
			extensions: Object.create(null),
			astNode: void 0
		}],
		resolve: (e, { name: n }, r, { schema: i }) => i.getType(n),
		deprecationReason: void 0,
		extensions: Object.create(null),
		astNode: void 0
	}, e.TypeNameMetaFieldDef = {
		name: "__typename",
		type: new s.GraphQLNonNull(c.GraphQLString),
		description: "The name of the current Object type at runtime.",
		args: [],
		resolve: (e, n, r, { parentType: i }) => i.name,
		deprecationReason: void 0,
		extensions: Object.create(null),
		astNode: void 0
	};
	var b = Object.freeze([
		l,
		u,
		d,
		f,
		m,
		g,
		_,
		y
	]);
	e.introspectionTypes = b;
	function x(e) {
		return b.some(({ name: n }) => e.name === n);
	}
})), require_schema = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.assertSchema = f, e.isSchema = d;
	var n = require_devAssert(), r = require_inspect(), i = require_instanceOf(), a = require_isObjectLike(), o = require_toObjMap(), s = require_ast(), c = require_definition(), l = require_directives(), u = require_introspection();
	function d(e) {
		return (0, i.instanceOf)(e, m);
	}
	function f(e) {
		if (!d(e)) throw Error(`Expected ${(0, r.inspect)(e)} to be a GraphQL schema.`);
		return e;
	}
	var m = class {
		constructor(e) {
			this.__validationErrors = e.assumeValid === !0 ? [] : void 0, (0, a.isObjectLike)(e) || (0, n.devAssert)(!1, "Must provide configuration object."), !e.types || Array.isArray(e.types) || (0, n.devAssert)(!1, `"types" must be Array if provided but got: ${(0, r.inspect)(e.types)}.`), !e.directives || Array.isArray(e.directives) || (0, n.devAssert)(!1, `"directives" must be Array if provided but got: ${(0, r.inspect)(e.directives)}.`), this.description = e.description, this.extensions = (0, o.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 ?? l.specifiedDirectives;
			let i = new Set(e.types);
			if (e.types != null) for (let n of e.types) i.delete(n), g(n, i);
			this._queryType != null && g(this._queryType, i), this._mutationType != null && g(this._mutationType, i), this._subscriptionType != null && g(this._subscriptionType, i);
			for (let e of this._directives) if ((0, l.isDirective)(e)) for (let n of e.args) g(n.type, i);
			g(u.__Schema, i), this._typeMap = Object.create(null), this._subTypeMap = Object.create(null), this._implementationsMap = Object.create(null);
			for (let e of i) {
				if (e == null) continue;
				let r = e.name;
				if (r || (0, n.devAssert)(!1, "One of the provided types for building the Schema is missing a name."), this._typeMap[r] !== void 0) throw Error(`Schema must contain uniquely named types but contains multiple types named "${r}".`);
				if (this._typeMap[r] = e, (0, c.isInterfaceType)(e)) {
					for (let n of e.getInterfaces()) if ((0, c.isInterfaceType)(n)) {
						let r = this._implementationsMap[n.name];
						r === void 0 && (r = this._implementationsMap[n.name] = {
							objects: [],
							interfaces: []
						}), r.interfaces.push(e);
					}
				} else if ((0, c.isObjectType)(e)) {
					for (let n of e.getInterfaces()) if ((0, c.isInterfaceType)(n)) {
						let r = this._implementationsMap[n.name];
						r === void 0 && (r = this._implementationsMap[n.name] = {
							objects: [],
							interfaces: []
						}), r.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 s.OperationTypeNode.QUERY: return this.getQueryType();
				case s.OperationTypeNode.MUTATION: return this.getMutationType();
				case s.OperationTypeNode.SUBSCRIPTION: return this.getSubscriptionType();
			}
		}
		getTypeMap() {
			return this._typeMap;
		}
		getType(e) {
			return this.getTypeMap()[e];
		}
		getPossibleTypes(e) {
			return (0, c.isUnionType)(e) ? e.getTypes() : this.getImplementations(e).objects;
		}
		getImplementations(e) {
			return this._implementationsMap[e.name] ?? {
				objects: [],
				interfaces: []
			};
		}
		isSubType(e, n) {
			let r = this._subTypeMap[e.name];
			if (r === void 0) {
				if (r = Object.create(null), (0, c.isUnionType)(e)) for (let n of e.getTypes()) r[n.name] = !0;
				else {
					let n = this.getImplementations(e);
					for (let e of n.objects) r[e.name] = !0;
					for (let e of n.interfaces) r[e.name] = !0;
				}
				this._subTypeMap[e.name] = r;
			}
			return r[n.name] !== void 0;
		}
		getDirectives() {
			return this._directives;
		}
		getDirective(e) {
			return this.getDirectives().find((n) => n.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
			};
		}
	};
	e.GraphQLSchema = m;
	function g(e, n) {
		let r = (0, c.getNamedType)(e);
		if (!n.has(r)) {
			if (n.add(r), (0, c.isUnionType)(r)) for (let e of r.getTypes()) g(e, n);
			else if ((0, c.isObjectType)(r) || (0, c.isInterfaceType)(r)) {
				for (let e of r.getInterfaces()) g(e, n);
				for (let e of Object.values(r.getFields())) {
					g(e.type, n);
					for (let r of e.args) g(r.type, n);
				}
			} else if ((0, c.isInputObjectType)(r)) for (let e of Object.values(r.getFields())) g(e.type, n);
		}
		return n;
	}
})), require_validate$1 = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.assertValidSchema = d, e.validateSchema = u;
	var n = require_inspect(), r = require_GraphQLError(), i = require_ast(), a = require_typeComparators(), o = require_definition(), s = require_directives(), c = require_introspection(), l = require_schema();
	function u(e) {
		if ((0, l.assertSchema)(e), e.__validationErrors) return e.__validationErrors;
		let n = new f(e);
		m(n), _(n), y(n);
		let r = n.getErrors();
		return e.__validationErrors = r, r;
	}
	function d(e) {
		let n = u(e);
		if (n.length !== 0) throw Error(n.map((e) => e.message).join("\n\n"));
	}
	var f = class {
		constructor(e) {
			this._errors = [], this.schema = e;
		}
		reportError(e, n) {
			let i = Array.isArray(n) ? n.filter(Boolean) : n;
			this._errors.push(new r.GraphQLError(e, { nodes: i }));
		}
		getErrors() {
			return this._errors;
		}
	};
	function m(e) {
		let r = e.schema, a = r.getQueryType();
		a ? (0, o.isObjectType)(a) || e.reportError(`Query root type must be Object type, it cannot be ${(0, n.inspect)(a)}.`, g(r, i.OperationTypeNode.QUERY) ?? a.astNode) : e.reportError("Query root type must be provided.", r.astNode);
		let s = r.getMutationType();
		s && !(0, o.isObjectType)(s) && e.reportError(`Mutation root type must be Object type if provided, it cannot be ${(0, n.inspect)(s)}.`, g(r, i.OperationTypeNode.MUTATION) ?? s.astNode);
		let c = r.getSubscriptionType();
		c && !(0, o.isObjectType)(c) && e.reportError(`Subscription root type must be Object type if provided, it cannot be ${(0, n.inspect)(c)}.`, g(r, i.OperationTypeNode.SUBSCRIPTION) ?? c.astNode);
	}
	function g(e, n) {
		return [e.astNode, ...e.extensionASTNodes].flatMap((e) => e?.operationTypes ?? []).find((e) => e.operation === n)?.type;
	}
	function _(e) {
		for (let r of e.schema.getDirectives()) {
			if (!(0, s.isDirective)(r)) {
				e.reportError(`Expected directive but got: ${(0, n.inspect)(r)}.`, r?.astNode);
				continue;
			}
			v(e, r), r.locations.length === 0 && e.reportError(`Directive @${r.name} must include 1 or more locations.`, r.astNode);
			for (let i of r.args) v(e, i), (0, o.isInputType)(i.type) || e.reportError(`The type of @${r.name}(${i.name}:) must be Input Type but got: ${(0, n.inspect)(i.type)}.`, i.astNode), (0, o.isRequiredArgument)(i) && i.deprecationReason != null && e.reportError(`Required argument @${r.name}(${i.name}:) cannot be deprecated.`, [j(i.astNode), i.astNode?.type]);
		}
	}
	function v(e, n) {
		n.name.startsWith("__") && e.reportError(`Name "${n.name}" must not begin with "__", which is reserved by GraphQL introspection.`, n.astNode);
	}
	function y(e) {
		let r = O(e), i = e.schema.getTypeMap();
		for (let a of Object.values(i)) {
			if (!(0, o.isNamedType)(a)) {
				e.reportError(`Expected GraphQL named type but got: ${(0, n.inspect)(a)}.`, a.astNode);
				continue;
			}
			(0, c.isIntrospectionType)(a) || v(e, a), (0, o.isObjectType)(a) || (0, o.isInterfaceType)(a) ? (b(e, a), x(e, a)) : (0, o.isUnionType)(a) ? w(e, a) : (0, o.isEnumType)(a) ? T(e, a) : (0, o.isInputObjectType)(a) && (E(e, a), r(a));
		}
	}
	function b(e, r) {
		let i = Object.values(r.getFields());
		i.length === 0 && e.reportError(`Type ${r.name} must define one or more fields.`, [r.astNode, ...r.extensionASTNodes]);
		for (let a of i) {
			v(e, a), !(0, o.isOutputType)(a.type) && e.reportError(`The type of ${r.name}.${a.name} must be Output Type but got: ${(0, n.inspect)(a.type)}.`, a.astNode?.type);
			for (let i of a.args) {
				let s = i.name;
				v(e, i), !(0, o.isInputType)(i.type) && e.reportError(`The type of ${r.name}.${a.name}(${s}:) must be Input Type but got: ${(0, n.inspect)(i.type)}.`, i.astNode?.type), (0, o.isRequiredArgument)(i) && i.deprecationReason != null && e.reportError(`Required argument ${r.name}.${a.name}(${s}:) cannot be deprecated.`, [j(i.astNode), i.astNode?.type]);
			}
		}
	}
	function x(e, r) {
		let i = Object.create(null);
		for (let a of r.getInterfaces()) {
			if (!(0, o.isInterfaceType)(a)) {
				e.reportError(`Type ${(0, n.inspect)(r)} must only implement Interface types, it cannot implement ${(0, n.inspect)(a)}.`, k(r, a));
				continue;
			}
			if (r === a) {
				e.reportError(`Type ${r.name} cannot implement itself because it would create a circular reference.`, k(r, a));
				continue;
			}
			if (i[a.name]) {
				e.reportError(`Type ${r.name} can only implement ${a.name} once.`, k(r, a));
				continue;
			}
			i[a.name] = !0, C(e, r, a), S(e, r, a);
		}
	}
	function S(e, r, i) {
		let s = r.getFields();
		for (let c of Object.values(i.getFields())) {
			let l = c.name, u = s[l];
			if (!u) {
				e.reportError(`Interface field ${i.name}.${l} expected but ${r.name} does not provide it.`, [
					c.astNode,
					r.astNode,
					...r.extensionASTNodes
				]);
				continue;
			}
			(0, a.isTypeSubTypeOf)(e.schema, u.type, c.type) || e.reportError(`Interface field ${i.name}.${l} expects type ${(0, n.inspect)(c.type)} but ${r.name}.${l} is type ${(0, n.inspect)(u.type)}.`, [c.astNode?.type, u.astNode?.type]);
			for (let o of c.args) {
				let s = o.name, c = u.args.find((e) => e.name === s);
				if (!c) {
					e.reportError(`Interface field argument ${i.name}.${l}(${s}:) expected but ${r.name}.${l} does not provide it.`, [o.astNode, u.astNode]);
					continue;
				}
				(0, a.isEqualType)(o.type, c.type) || e.reportError(`Interface field argument ${i.name}.${l}(${s}:) expects type ${(0, n.inspect)(o.type)} but ${r.name}.${l}(${s}:) is type ${(0, n.inspect)(c.type)}.`, [o.astNode?.type, c.astNode?.type]);
			}
			for (let n of u.args) {
				let a = n.name;
				!c.args.find((e) => e.name === a) && (0, o.isRequiredArgument)(n) && e.reportError(`Object field ${r.name}.${l} includes required argument ${a} that is missing from the Interface field ${i.name}.${l}.`, [n.astNode, c.astNode]);
			}
		}
	}
	function C(e, n, r) {
		let i = n.getInterfaces();
		for (let a of r.getInterfaces()) i.includes(a) || e.reportError(a === n ? `Type ${n.name} cannot implement ${r.name} because it would create a circular reference.` : `Type ${n.name} must implement ${a.name} because it is implemented by ${r.name}.`, [...k(r, a), ...k(n, r)]);
	}
	function w(e, r) {
		let i = r.getTypes();
		i.length === 0 && e.reportError(`Union type ${r.name} must define one or more member types.`, [r.astNode, ...r.extensionASTNodes]);
		let a = Object.create(null);
		for (let s of i) {
			if (a[s.name]) {
				e.reportError(`Union type ${r.name} can only include type ${s.name} once.`, A(r, s.name));
				continue;
			}
			a[s.name] = !0, (0, o.isObjectType)(s) || e.reportError(`Union type ${r.name} can only include Object types, it cannot include ${(0, n.inspect)(s)}.`, A(r, String(s)));
		}
	}
	function T(e, n) {
		let r = n.getValues();
		r.length === 0 && e.reportError(`Enum type ${n.name} must define one or more values.`, [n.astNode, ...n.extensionASTNodes]);
		for (let n of r) v(e, n);
	}
	function E(e, r) {
		let i = Object.values(r.getFields());
		i.length === 0 && e.reportError(`Input Object type ${r.name} must define one or more fields.`, [r.astNode, ...r.extensionASTNodes]);
		for (let a of i) v(e, a), !(0, o.isInputType)(a.type) && e.reportError(`The type of ${r.name}.${a.name} must be Input Type but got: ${(0, n.inspect)(a.type)}.`, a.astNode?.type), (0, o.isRequiredInputField)(a) && a.deprecationReason != null && e.reportError(`Required input field ${r.name}.${a.name} cannot be deprecated.`, [j(a.astNode), a.astNode?.type]), r.isOneOf && D(r, a, e);
	}
	function D(e, n, r) {
		(0, o.isNonNullType)(n.type) && r.reportError(`OneOf input field ${e.name}.${n.name} must be nullable.`, n.astNode?.type), n.defaultValue !== void 0 && r.reportError(`OneOf input field ${e.name}.${n.name} cannot have a default value.`, n.astNode);
	}
	function O(e) {
		let n = Object.create(null), r = [], i = Object.create(null);
		return a;
		function a(s) {
			if (n[s.name]) return;
			n[s.name] = !0, i[s.name] = r.length;
			let c = Object.values(s.getFields());
			for (let n of c) if ((0, o.isNonNullType)(n.type) && (0, o.isInputObjectType)(n.type.ofType)) {
				let o = n.type.ofType, s = i[o.name];
				if (r.push(n), s === void 0) a(o);
				else {
					let n = r.slice(s), i = n.map((e) => e.name).join(".");
					e.reportError(`Cannot reference Input Object "${o.name}" within itself through a series of non-null fields: "${i}".`, n.map((e) => e.astNode));
				}
				r.pop();
			}
			i[s.name] = void 0;
		}
	}
	function k(e, n) {
		let { astNode: r, extensionASTNodes: i } = e;
		return (r == null ? i : [r, ...i]).flatMap((e) => e.interfaces ?? []).filter((e) => e.name.value === n.name);
	}
	function A(e, n) {
		let { astNode: r, extensionASTNodes: i } = e;
		return (r == null ? i : [r, ...i]).flatMap((e) => e.types ?? []).filter((e) => e.name.value === n);
	}
	function j(e) {
		return e?.directives?.find((e) => e.name.value === s.GraphQLDeprecatedDirective.name);
	}
})), require_typeFromAST = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.typeFromAST = i;
	var n = require_kinds(), r = require_definition();
	function i(e, a) {
		switch (a.kind) {
			case n.Kind.LIST_TYPE: {
				let n = i(e, a.type);
				return n && new r.GraphQLList(n);
			}
			case n.Kind.NON_NULL_TYPE: {
				let n = i(e, a.type);
				return n && new r.GraphQLNonNull(n);
			}
			case n.Kind.NAMED_TYPE: return e.getType(a.name.value);
		}
	}
})), require_TypeInfo = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.visitWithTypeInfo = l;
	var n = require_ast(), r = require_kinds(), i = require_visitor(), a = require_definition(), o = require_introspection(), s = require_typeFromAST();
	e.TypeInfo = class {
		constructor(e, n, r) {
			this._schema = e, this._typeStack = [], this._parentTypeStack = [], this._inputTypeStack = [], this._fieldDefStack = [], this._defaultValueStack = [], this._directive = null, this._argument = null, this._enumValue = null, this._getFieldDef = r ?? c, n && ((0, a.isInputType)(n) && this._inputTypeStack.push(n), (0, a.isCompositeType)(n) && this._parentTypeStack.push(n), (0, a.isOutputType)(n) && this._typeStack.push(n));
		}
		get [Symbol.toStringTag]() {
			return "TypeInfo";
		}
		getType() {
			if (this._typeStack.length > 0) return this._typeStack[this._typeStack.length - 1];
		}
		getParentType() {
			if (this._parentTypeStack.length > 0) return this._parentTypeStack[this._parentTypeStack.length - 1];
		}
		getInputType() {
			if (this._inputTypeStack.length > 0) return this._inputTypeStack[this._inputTypeStack.length - 1];
		}
		getParentInputType() {
			if (this._inputTypeStack.length > 1) return this._inputTypeStack[this._inputTypeStack.length - 2];
		}
		getFieldDef() {
			if (this._fieldDefStack.length > 0) return this._fieldDefStack[this._fieldDefStack.length - 1];
		}
		getDefaultValue() {
			if (this._defaultValueStack.length > 0) return this._defaultValueStack[this._defaultValueStack.length - 1];
		}
		getDirective() {
			return this._directive;
		}
		getArgument() {
			return this._argument;
		}
		getEnumValue() {
			return this._enumValue;
		}
		enter(e) {
			let n = this._schema;
			switch (e.kind) {
				case r.Kind.SELECTION_SET: {
					let e = (0, a.getNamedType)(this.getType());
					this._parentTypeStack.push((0, a.isCompositeType)(e) ? e : void 0);
					break;
				}
				case r.Kind.FIELD: {
					let r = this.getParentType(), i, o;
					r && (i = this._getFieldDef(n, r, e), i && (o = i.type)), this._fieldDefStack.push(i), this._typeStack.push((0, a.isOutputType)(o) ? o : void 0);
					break;
				}
				case r.Kind.DIRECTIVE:
					this._directive = n.getDirective(e.name.value);
					break;
				case r.Kind.OPERATION_DEFINITION: {
					let r = n.getRootType(e.operation);
					this._typeStack.push((0, a.isObjectType)(r) ? r : void 0);
					break;
				}
				case r.Kind.INLINE_FRAGMENT:
				case r.Kind.FRAGMENT_DEFINITION: {
					let r = e.typeCondition, i = r ? (0, s.typeFromAST)(n, r) : (0, a.getNamedType)(this.getType());
					this._typeStack.push((0, a.isOutputType)(i) ? i : void 0);
					break;
				}
				case r.Kind.VARIABLE_DEFINITION: {
					let r = (0, s.typeFromAST)(n, e.type);
					this._inputTypeStack.push((0, a.isInputType)(r) ? r : void 0);
					break;
				}
				case r.Kind.ARGUMENT: {
					let n, r, i = this.getDirective() ?? this.getFieldDef();
					i && (n = i.args.find((n) => n.name === e.name.value), n && (r = n.type)), this._argument = n, this._defaultValueStack.push(n ? n.defaultValue : void 0), this._inputTypeStack.push((0, a.isInputType)(r) ? r : void 0);
					break;
				}
				case r.Kind.LIST: {
					let e = (0, a.getNullableType)(this.getInputType()), n = (0, a.isListType)(e) ? e.ofType : e;
					this._defaultValueStack.push(void 0), this._inputTypeStack.push((0, a.isInputType)(n) ? n : void 0);
					break;
				}
				case r.Kind.OBJECT_FIELD: {
					let n = (0, a.getNamedType)(this.getInputType()), r, i;
					(0, a.isInputObjectType)(n) && (i = n.getFields()[e.name.value], i && (r = i.type)), this._defaultValueStack.push(i ? i.defaultValue : void 0), this._inputTypeStack.push((0, a.isInputType)(r) ? r : void 0);
					break;
				}
				case r.Kind.ENUM: {
					let n = (0, a.getNamedType)(this.getInputType()), r;
					(0, a.isEnumType)(n) && (r = n.getValue(e.value)), this._enumValue = r;
					break;
				}
				default:
			}
		}
		leave(e) {
			switch (e.kind) {
				case r.Kind.SELECTION_SET:
					this._parentTypeStack.pop();
					break;
				case r.Kind.FIELD:
					this._fieldDefStack.pop(), this._typeStack.pop();
					break;
				case r.Kind.DIRECTIVE:
					this._directive = null;
					break;
				case r.Kind.OPERATION_DEFINITION:
				case r.Kind.INLINE_FRAGMENT:
				case r.Kind.FRAGMENT_DEFINITION:
					this._typeStack.pop();
					break;
				case r.Kind.VARIABLE_DEFINITION:
					this._inputTypeStack.pop();
					break;
				case r.Kind.ARGUMENT:
					this._argument = null, this._defaultValueStack.pop(), this._inputTypeStack.pop();
					break;
				case r.Kind.LIST:
				case r.Kind.OBJECT_FIELD:
					this._defaultValueStack.pop(), this._inputTypeStack.pop();
					break;
				case r.Kind.ENUM:
					this._enumValue = null;
					break;
				default:
			}
		}
	};
	function c(e, n, r) {
		let i = r.name.value;
		if (i === o.SchemaMetaFieldDef.name && e.getQueryType() === n) return o.SchemaMetaFieldDef;
		if (i === o.TypeMetaFieldDef.name && e.getQueryType() === n) return o.TypeMetaFieldDef;
		if (i === o.TypeNameMetaFieldDef.name && (0, a.isCompositeType)(n)) return o.TypeNameMetaFieldDef;
		if ((0, a.isObjectType)(n) || (0, a.isInterfaceType)(n)) return n.getFields()[i];
	}
	function l(e, r) {
		return {
			enter(...a) {
				let o = a[0];
				e.enter(o);
				let s = (0, i.getEnterLeaveForKind)(r, o.kind).enter;
				if (s) {
					let i = s.apply(r, a);
					return i !== void 0 && (e.leave(o), (0, n.isNode)(i) && e.enter(i)), i;
				}
			},
			leave(...n) {
				let a = n[0], o = (0, i.getEnterLeaveForKind)(r, a.kind).leave, s;
				return o && (s = o.apply(r, n)), e.leave(a), s;
			}
		};
	}
})), require_predicates = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.isConstValueNode = s, e.isDefinitionNode = r, e.isExecutableDefinitionNode = i, e.isSchemaCoordinateNode = m, e.isSelectionNode = a, e.isTypeDefinitionNode = u, e.isTypeExtensionNode = f, e.isTypeNode = c, e.isTypeSystemDefinitionNode = l, e.isTypeSystemExtensionNode = d, e.isValueNode = o;
	var n = require_kinds();
	function r(e) {
		return i(e) || l(e) || d(e);
	}
	function i(e) {
		return e.kind === n.Kind.OPERATION_DEFINITION || e.kind === n.Kind.FRAGMENT_DEFINITION;
	}
	function a(e) {
		return e.kind === n.Kind.FIELD || e.kind === n.Kind.FRAGMENT_SPREAD || e.kind === n.Kind.INLINE_FRAGMENT;
	}
	function o(e) {
		return e.kind === n.Kind.VARIABLE || e.kind === n.Kind.INT || e.kind === n.Kind.FLOAT || e.kind === n.Kind.STRING || e.kind === n.Kind.BOOLEAN || e.kind === n.Kind.NULL || e.kind === n.Kind.ENUM || e.kind === n.Kind.LIST || e.kind === n.Kind.OBJECT;
	}
	function s(e) {
		return o(e) && (e.kind === n.Kind.LIST ? e.values.some(s) : e.kind === n.Kind.OBJECT ? e.fields.some((e) => s(e.value)) : e.kind !== n.Kind.VARIABLE);
	}
	function c(e) {
		return e.kind === n.Kind.NAMED_TYPE || e.kind === n.Kind.LIST_TYPE || e.kind === n.Kind.NON_NULL_TYPE;
	}
	function l(e) {
		return e.kind === n.Kind.SCHEMA_DEFINITION || u(e) || e.kind === n.Kind.DIRECTIVE_DEFINITION;
	}
	function u(e) {
		return e.kind === n.Kind.SCALAR_TYPE_DEFINITION || e.kind === n.Kind.OBJECT_TYPE_DEFINITION || e.kind === n.Kind.INTERFACE_TYPE_DEFINITION || e.kind === n.Kind.UNION_TYPE_DEFINITION || e.kind === n.Kind.ENUM_TYPE_DEFINITION || e.kind === n.Kind.INPUT_OBJECT_TYPE_DEFINITION;
	}
	function d(e) {
		return e.kind === n.Kind.SCHEMA_EXTENSION || e.kind === n.Kind.DIRECTIVE_EXTENSION || f(e);
	}
	function f(e) {
		return e.kind === n.Kind.SCALAR_TYPE_EXTENSION || e.kind === n.Kind.OBJECT_TYPE_EXTENSION || e.kind === n.Kind.INTERFACE_TYPE_EXTENSION || e.kind === n.Kind.UNION_TYPE_EXTENSION || e.kind === n.Kind.ENUM_TYPE_EXTENSION || e.kind === n.Kind.INPUT_OBJECT_TYPE_EXTENSION;
	}
	function m(e) {
		return e.kind === n.Kind.TYPE_COORDINATE || e.kind === n.Kind.MEMBER_COORDINATE || e.kind === n.Kind.ARGUMENT_COORDINATE || e.kind === n.Kind.DIRECTIVE_COORDINATE || e.kind === n.Kind.DIRECTIVE_ARGUMENT_COORDINATE;
	}
})), require_ExecutableDefinitionsRule = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.ExecutableDefinitionsRule = a;
	var n = require_GraphQLError(), r = require_kinds(), i = require_predicates();
	function a(e) {
		return { Document(a) {
			for (let o of a.definitions) if (!(0, i.isExecutableDefinitionNode)(o)) {
				let i = o.kind === r.Kind.SCHEMA_DEFINITION || o.kind === r.Kind.SCHEMA_EXTENSION ? "schema" : "\"" + o.name.value + "\"";
				e.reportError(new n.GraphQLError(`The ${i} definition is not executable.`, { nodes: o }));
			}
			return !1;
		} };
	}
})), require_FieldsOnCorrectTypeRule = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.FieldsOnCorrectTypeRule = s;
	var n = require_didYouMean(), r = require_naturalCompare(), i = require_suggestionList(), a = require_GraphQLError(), o = require_definition();
	function s(e) {
		return { Field(r) {
			let i = e.getParentType();
			if (i && !e.getFieldDef()) {
				let o = e.getSchema(), s = r.name.value, u = (0, n.didYouMean)("to use an inline fragment on", c(o, i, s));
				u === "" && (u = (0, n.didYouMean)(l(i, s))), e.reportError(new a.GraphQLError(`Cannot query field "${s}" on type "${i.name}".` + u, { nodes: r }));
			}
		} };
	}
	function c(e, n, i) {
		if (!(0, o.isAbstractType)(n)) return [];
		let a = /* @__PURE__ */ new Set(), s = Object.create(null);
		for (let r of e.getPossibleTypes(n)) if (r.getFields()[i]) {
			a.add(r), s[r.name] = 1;
			for (let e of r.getInterfaces()) e.getFields()[i] && (a.add(e), s[e.name] = (s[e.name] ?? 0) + 1);
		}
		return [...a].sort((n, i) => {
			let a = s[i.name] - s[n.name];
			return a === 0 ? (0, o.isInterfaceType)(n) && e.isSubType(n, i) ? -1 : (0, o.isInterfaceType)(i) && e.isSubType(i, n) ? 1 : (0, r.naturalCompare)(n.name, i.name) : a;
		}).map((e) => e.name);
	}
	function l(e, n) {
		if ((0, o.isObjectType)(e) || (0, o.isInterfaceType)(e)) {
			let r = Object.keys(e.getFields());
			return (0, i.suggestionList)(n, r);
		}
		return [];
	}
})), require_FragmentsOnCompositeTypesRule = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.FragmentsOnCompositeTypesRule = o;
	var n = require_GraphQLError(), r = require_printer(), i = require_definition(), a = require_typeFromAST();
	function o(e) {
		return {
			InlineFragment(o) {
				let s = o.typeCondition;
				if (s) {
					let o = (0, a.typeFromAST)(e.getSchema(), s);
					if (o && !(0, i.isCompositeType)(o)) {
						let i = (0, r.print)(s);
						e.reportError(new n.GraphQLError(`Fragment cannot condition on non composite type "${i}".`, { nodes: s }));
					}
				}
			},
			FragmentDefinition(o) {
				let s = (0, a.typeFromAST)(e.getSchema(), o.typeCondition);
				if (s && !(0, i.isCompositeType)(s)) {
					let i = (0, r.print)(o.typeCondition);
					e.reportError(new n.GraphQLError(`Fragment "${o.name.value}" cannot condition on non composite type "${i}".`, { nodes: o.typeCondition }));
				}
			}
		};
	}
})), require_KnownArgumentNamesRule = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.KnownArgumentNamesOnDirectivesRule = c, e.KnownArgumentNamesRule = s;
	var n = require_didYouMean(), r = require_suggestionList(), i = require_GraphQLError(), a = require_kinds(), o = require_directives();
	function s(e) {
		return {
			...c(e),
			Argument(a) {
				let o = e.getArgument(), s = e.getFieldDef(), c = e.getParentType();
				if (!o && s && c) {
					let o = a.name.value, l = s.args.map((e) => e.name), u = (0, r.suggestionList)(o, l);
					e.reportError(new i.GraphQLError(`Unknown argument "${o}" on field "${c.name}.${s.name}".` + (0, n.didYouMean)(u), { nodes: a }));
				}
			}
		};
	}
	function c(e) {
		let s = Object.create(null), c = e.getSchema(), l = c ? c.getDirectives() : o.specifiedDirectives;
		for (let e of l) s[e.name] = e.args.map((e) => e.name);
		let u = e.getDocument().definitions;
		for (let e of u) if (e.kind === a.Kind.DIRECTIVE_DEFINITION) {
			/* c8 ignore next */
			let n = e.arguments ?? [];
			s[e.name.value] = n.map((e) => e.name.value);
		}
		return { Directive(a) {
			let o = a.name.value, c = s[o];
			if (a.arguments && c) for (let s of a.arguments) {
				let a = s.name.value;
				if (!c.includes(a)) {
					let l = (0, r.suggestionList)(a, c);
					e.reportError(new i.GraphQLError(`Unknown argument "${a}" on directive "@${o}".` + (0, n.didYouMean)(l), { nodes: s }));
				}
			}
			return !1;
		} };
	}
})), require_KnownDirectivesRule = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.KnownDirectivesRule = l;
	var n = require_inspect(), r = require_invariant(), i = require_GraphQLError(), a = require_ast(), o = require_directiveLocation(), s = require_kinds(), c = require_directives();
	function l(e) {
		let n = Object.create(null), r = e.getSchema(), a = r ? r.getDirectives() : c.specifiedDirectives;
		for (let e of a) n[e.name] = e.locations;
		let o = e.getDocument().definitions;
		for (let e of o) e.kind === s.Kind.DIRECTIVE_DEFINITION && (n[e.name.value] = e.locations.map((e) => e.value));
		return { Directive(r, a, o, s, c) {
			let l = r.name.value, d = n[l];
			if (!d) {
				e.reportError(new i.GraphQLError(`Unknown directive "@${l}".`, { nodes: r }));
				return;
			}
			let f = u(c);
			f && !d.includes(f) && e.reportError(new i.GraphQLError(`Directive "@${l}" may not be used on ${f}.`, { nodes: r }));
		} };
	}
	function u(e) {
		let i = e[e.length - 1];
		switch ("kind" in i || (0, r.invariant)(!1), i.kind) {
			case s.Kind.OPERATION_DEFINITION: return d(i.operation);
			case s.Kind.FIELD: return o.DirectiveLocation.FIELD;
			case s.Kind.FRAGMENT_SPREAD: return o.DirectiveLocation.FRAGMENT_SPREAD;
			case s.Kind.INLINE_FRAGMENT: return o.DirectiveLocation.INLINE_FRAGMENT;
			case s.Kind.FRAGMENT_DEFINITION: return o.DirectiveLocation.FRAGMENT_DEFINITION;
			case s.Kind.VARIABLE_DEFINITION: return o.DirectiveLocation.VARIABLE_DEFINITION;
			case s.Kind.SCHEMA_DEFINITION:
			case s.Kind.SCHEMA_EXTENSION: return o.DirectiveLocation.SCHEMA;
			case s.Kind.SCALAR_TYPE_DEFINITION:
			case s.Kind.SCALAR_TYPE_EXTENSION: return o.DirectiveLocation.SCALAR;
			case s.Kind.OBJECT_TYPE_DEFINITION:
			case s.Kind.OBJECT_TYPE_EXTENSION: return o.DirectiveLocation.OBJECT;
			case s.Kind.FIELD_DEFINITION: return o.DirectiveLocation.FIELD_DEFINITION;
			case s.Kind.INTERFACE_TYPE_DEFINITION:
			case s.Kind.INTERFACE_TYPE_EXTENSION: return o.DirectiveLocation.INTERFACE;
			case s.Kind.UNION_TYPE_DEFINITION:
			case s.Kind.UNION_TYPE_EXTENSION: return o.DirectiveLocation.UNION;
			case s.Kind.ENUM_TYPE_DEFINITION:
			case s.Kind.ENUM_TYPE_EXTENSION: return o.DirectiveLocation.ENUM;
			case s.Kind.ENUM_VALUE_DEFINITION: return o.DirectiveLocation.ENUM_VALUE;
			case s.Kind.INPUT_OBJECT_TYPE_DEFINITION:
			case s.Kind.INPUT_OBJECT_TYPE_EXTENSION: return o.DirectiveLocation.INPUT_OBJECT;
			case s.Kind.INPUT_VALUE_DEFINITION: {
				let n = e[e.length - 3];
				return "kind" in n || (0, r.invariant)(!1), n.kind === s.Kind.INPUT_OBJECT_TYPE_DEFINITION ? o.DirectiveLocation.INPUT_FIELD_DEFINITION : o.DirectiveLocation.ARGUMENT_DEFINITION;
			}
			case s.Kind.DIRECTIVE_DEFINITION:
			case s.Kind.DIRECTIVE_EXTENSION: return o.DirectiveLocation.DIRECTIVE_DEFINITION;
			default: (0, r.invariant)(!1, "Unexpected kind: " + (0, n.inspect)(i.kind));
		}
	}
	function d(e) {
		switch (e) {
			case a.OperationTypeNode.QUERY: return o.DirectiveLocation.QUERY;
			case a.OperationTypeNode.MUTATION: return o.DirectiveLocation.MUTATION;
			case a.OperationTypeNode.SUBSCRIPTION: return o.DirectiveLocation.SUBSCRIPTION;
		}
	}
})), require_KnownFragmentNamesRule = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.KnownFragmentNamesRule = r;
	var n = require_GraphQLError();
	function r(e) {
		return { FragmentSpread(r) {
			let i = r.name.value;
			e.getFragment(i) || e.reportError(new n.GraphQLError(`Unknown fragment "${i}".`, { nodes: r.name }));
		} };
	}
})), require_KnownTypeNamesRule = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.KnownTypeNamesRule = c;
	var n = require_didYouMean(), r = require_suggestionList(), i = require_GraphQLError(), a = require_predicates(), o = require_introspection(), s = require_scalars();
	function c(e) {
		let o = e.getSchema(), s = o ? o.getTypeMap() : Object.create(null), c = Object.create(null);
		for (let n of e.getDocument().definitions) (0, a.isTypeDefinitionNode)(n) && (c[n.name.value] = !0);
		let d = [...Object.keys(s), ...Object.keys(c)];
		return { NamedType(a, o, f, m, g) {
			let _ = a.name.value;
			if (!s[_] && !c[_]) {
				let o = g[2] ?? f, s = o != null && u(o);
				if (s && l.includes(_)) return;
				let c = (0, r.suggestionList)(_, s ? l.concat(d) : d);
				e.reportError(new i.GraphQLError(`Unknown type "${_}".` + (0, n.didYouMean)(c), { nodes: a }));
			}
		} };
	}
	var l = [...s.specifiedScalarTypes, ...o.introspectionTypes].map((e) => e.name);
	function u(e) {
		return "kind" in e && ((0, a.isTypeSystemDefinitionNode)(e) || (0, a.isTypeSystemExtensionNode)(e));
	}
})), require_LoneAnonymousOperationRule = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.LoneAnonymousOperationRule = i;
	var n = require_GraphQLError(), r = require_kinds();
	function i(e) {
		let i = 0;
		return {
			Document(e) {
				i = e.definitions.filter((e) => e.kind === r.Kind.OPERATION_DEFINITION).length;
			},
			OperationDefinition(r) {
				!r.name && i > 1 && e.reportError(new n.GraphQLError("This anonymous operation must be the only defined operation.", { nodes: r }));
			}
		};
	}
})), require_LoneSchemaDefinitionRule = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.LoneSchemaDefinitionRule = r;
	var n = require_GraphQLError();
	function r(e) {
		let r = e.getSchema(), i = r?.astNode ?? r?.getQueryType() ?? r?.getMutationType() ?? r?.getSubscriptionType(), a = 0;
		return { SchemaDefinition(r) {
			if (i) {
				e.reportError(new n.GraphQLError("Cannot define a new schema within a schema extension.", { nodes: r }));
				return;
			}
			a > 0 && e.reportError(new n.GraphQLError("Must provide only one schema definition.", { nodes: r })), ++a;
		} };
	}
})), require_MaxIntrospectionDepthRule = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.MaxIntrospectionDepthRule = a;
	var n = require_GraphQLError(), r = require_kinds(), i = 3;
	function a(e) {
		function a(n, o = Object.create(null), s = 0) {
			if (n.kind === r.Kind.FRAGMENT_SPREAD) {
				let r = n.name.value;
				if (o[r] === !0) return !1;
				let i = e.getFragment(r);
				if (!i) return !1;
				try {
					return o[r] = !0, a(i, o, s);
				} finally {
					o[r] = void 0;
				}
			}
			if (n.kind === r.Kind.FIELD && (n.name.value === "fields" || n.name.value === "interfaces" || n.name.value === "possibleTypes" || n.name.value === "inputFields") && (s++, s >= i)) return !0;
			if ("selectionSet" in n && n.selectionSet) {
				for (let e of n.selectionSet.selections) if (a(e, o, s)) return !0;
			}
			return !1;
		}
		return { Field(r) {
			if ((r.name.value === "__schema" || r.name.value === "__type") && a(r)) return e.reportError(new n.GraphQLError("Maximum introspection depth exceeded", { nodes: [r] })), !1;
		} };
	}
})), require_NoFragmentCyclesRule = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.NoFragmentCyclesRule = r;
	var n = require_GraphQLError();
	function r(e) {
		let r = Object.create(null), i = [], a = Object.create(null);
		return {
			OperationDefinition: () => !1,
			FragmentDefinition(e) {
				return o(e), !1;
			}
		};
		function o(s) {
			if (r[s.name.value]) return;
			let c = s.name.value;
			r[c] = !0;
			let l = e.getFragmentSpreads(s.selectionSet);
			if (l.length !== 0) {
				a[c] = i.length;
				for (let r of l) {
					let s = r.name.value, c = a[s];
					if (i.push(r), c === void 0) {
						let n = e.getFragment(s);
						n && o(n);
					} else {
						let r = i.slice(c), a = r.slice(0, -1).map((e) => "\"" + e.name.value + "\"").join(", ");
						e.reportError(new n.GraphQLError(`Cannot spread fragment "${s}" within itself` + (a === "" ? "." : ` via ${a}.`), { nodes: r }));
					}
					i.pop();
				}
				a[c] = void 0;
			}
		}
	}
})), require_NoUndefinedVariablesRule = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.NoUndefinedVariablesRule = r;
	var n = require_GraphQLError();
	function r(e) {
		let r = Object.create(null);
		return {
			OperationDefinition: {
				enter() {
					r = Object.create(null);
				},
				leave(i) {
					let a = e.getRecursiveVariableUsages(i);
					for (let { node: o } of a) {
						let a = o.name.value;
						r[a] !== !0 && e.reportError(new n.GraphQLError(i.name ? `Variable "$${a}" is not defined by operation "${i.name.value}".` : `Variable "$${a}" is not defined.`, { nodes: [o, i] }));
					}
				}
			},
			VariableDefinition(e) {
				r[e.variable.name.value] = !0;
			}
		};
	}
})), require_NoUnusedFragmentsRule = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.NoUnusedFragmentsRule = r;
	var n = require_GraphQLError();
	function r(e) {
		let r = [], i = [];
		return {
			OperationDefinition(e) {
				return r.push(e), !1;
			},
			FragmentDefinition(e) {
				return i.push(e), !1;
			},
			Document: { leave() {
				let a = Object.create(null);
				for (let n of r) for (let r of e.getRecursivelyReferencedFragments(n)) a[r.name.value] = !0;
				for (let r of i) {
					let i = r.name.value;
					a[i] !== !0 && e.reportError(new n.GraphQLError(`Fragment "${i}" is never used.`, { nodes: r }));
				}
			} }
		};
	}
})), require_NoUnusedVariablesRule = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.NoUnusedVariablesRule = r;
	var n = require_GraphQLError();
	function r(e) {
		let r = [];
		return {
			OperationDefinition: {
				enter() {
					r = [];
				},
				leave(i) {
					let a = Object.create(null), o = e.getRecursiveVariableUsages(i);
					for (let { node: e } of o) a[e.name.value] = !0;
					for (let o of r) {
						let r = o.variable.name.value;
						a[r] !== !0 && e.reportError(new n.GraphQLError(i.name ? `Variable "$${r}" is never used in operation "${i.name.value}".` : `Variable "$${r}" is never used.`, { nodes: o }));
					}
				}
			},
			VariableDefinition(e) {
				r.push(e);
			}
		};
	}
})), require_sortValueNode = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.sortValueNode = i;
	var n = require_naturalCompare(), r = require_kinds();
	function i(e) {
		switch (e.kind) {
			case r.Kind.OBJECT: return {
				...e,
				fields: a(e.fields)
			};
			case r.Kind.LIST: return {
				...e,
				values: e.values.map(i)
			};
			case r.Kind.INT:
			case r.Kind.FLOAT:
			case r.Kind.STRING:
			case r.Kind.BOOLEAN:
			case r.Kind.NULL:
			case r.Kind.ENUM:
			case r.Kind.VARIABLE: return e;
		}
	}
	function a(e) {
		return e.map((e) => ({
			...e,
			value: i(e.value)
		})).sort((e, r) => (0, n.naturalCompare)(e.name.value, r.name.value));
	}
})), require_OverlappingFieldsCanBeMergedRule = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.OverlappingFieldsCanBeMergedRule = u;
	var n = require_inspect(), r = require_GraphQLError(), i = require_kinds(), a = require_printer(), o = require_definition(), s = require_sortValueNode(), c = require_typeFromAST();
	function l(e) {
		return Array.isArray(e) ? e.map(([e, n]) => `subfields "${e}" conflict because ` + l(n)).join(" and ") : e;
	}
	function u(e) {
		let n = new D(), i = new O(), a = /* @__PURE__ */ new Map();
		return { SelectionSet(o) {
			let s = d(e, a, n, i, e.getParentType(), o);
			for (let [[n, i], a, o] of s) {
				let s = l(i);
				e.reportError(new r.GraphQLError(`Fields "${n}" conflict because ${s}. Use different aliases on the fields to fetch both if this was intentional.`, { nodes: a.concat(o) }));
			}
		} };
	}
	function d(e, n, r, i, a, o) {
		let s = [], [c, l] = C(e, n, a, o);
		if (_(e, s, n, r, i, c), l.length !== 0) for (let a = 0; a < l.length; a++) {
			f(e, s, n, r, i, !1, c, l[a]);
			for (let o = a + 1; o < l.length; o++) m(e, s, n, r, i, !1, l[a], l[o]);
		}
		return s;
	}
	function f(e, n, r, i, a, o, s, c) {
		if (i.has(s, c, o)) return;
		i.add(s, c, o);
		let l = e.getFragment(c);
		if (!l) return;
		let [u, d] = w(e, r, l);
		if (s !== u) {
			v(e, n, r, i, a, o, s, u);
			for (let c of d) f(e, n, r, i, a, o, s, c);
		}
	}
	function m(e, n, r, i, a, o, s, c) {
		if (s === c || a.has(s, c, o)) return;
		a.add(s, c, o);
		let l = e.getFragment(s), u = e.getFragment(c);
		if (!l || !u) return;
		let [d, f] = w(e, r, l), [g, _] = w(e, r, u);
		v(e, n, r, i, a, o, d, g);
		for (let c of _) m(e, n, r, i, a, o, s, c);
		for (let s of f) m(e, n, r, i, a, o, s, c);
	}
	function g(e, n, r, i, a, o, s, c, l) {
		let u = [], [d, g] = C(e, n, o, s), [_, y] = C(e, n, c, l);
		v(e, u, n, r, i, a, d, _);
		for (let o of y) f(e, u, n, r, i, a, d, o);
		for (let o of g) f(e, u, n, r, i, a, _, o);
		for (let o of g) for (let s of y) m(e, u, n, r, i, a, o, s);
		return u;
	}
	function _(e, n, r, i, a, o) {
		for (let [s, c] of Object.entries(o)) if (c.length > 1) for (let o = 0; o < c.length; o++) for (let l = o + 1; l < c.length; l++) {
			let u = y(e, r, i, a, !1, s, c[o], c[l]);
			u && n.push(u);
		}
	}
	function v(e, n, r, i, a, o, s, c) {
		for (let [l, u] of Object.entries(s)) {
			let s = c[l];
			if (s) for (let c of u) for (let u of s) {
				let s = y(e, r, i, a, o, l, c, u);
				s && n.push(s);
			}
		}
	}
	function y(e, r, i, a, s, c, l, u) {
		let [d, f, m] = l, [_, v, y] = u, x = s || d !== _ && (0, o.isObjectType)(d) && (0, o.isObjectType)(_);
		if (!x) {
			let e = f.name.value, n = v.name.value;
			if (e !== n) return [
				[c, `"${e}" and "${n}" are different fields`],
				[f],
				[v]
			];
			if (!b(f, v)) return [
				[c, "they have differing arguments"],
				[f],
				[v]
			];
		}
		let C = m?.type, w = y?.type;
		if (C && w && S(C, w)) return [
			[c, `they return conflicting types "${(0, n.inspect)(C)}" and "${(0, n.inspect)(w)}"`],
			[f],
			[v]
		];
		let T = f.selectionSet, D = v.selectionSet;
		if (T && D) {
			let n = g(e, r, i, a, x, (0, o.getNamedType)(C), T, (0, o.getNamedType)(w), D);
			return E(n, c, f, v);
		}
	}
	function b(e, n) {
		let r = e.arguments, i = n.arguments;
		if (r === void 0 || r.length === 0) return i === void 0 || i.length === 0;
		/* c8 ignore next */
		if (i === void 0 || i.length === 0 || r.length !== i.length)
 /* c8 ignore next */
		return !1;
		let a = new Map(i.map(({ name: e, value: n }) => [e.value, n]));
		return r.every((e) => {
			let n = e.value, r = a.get(e.name.value);
			return r === void 0 ? !1 : x(n) === x(r);
		});
	}
	function x(e) {
		return (0, a.print)((0, s.sortValueNode)(e));
	}
	function S(e, n) {
		return (0, o.isListType)(e) ? (0, o.isListType)(n) ? S(e.ofType, n.ofType) : !0 : (0, o.isListType)(n) ? !0 : (0, o.isNonNullType)(e) ? (0, o.isNonNullType)(n) ? S(e.ofType, n.ofType) : !0 : (0, o.isNonNullType)(n) ? !0 : (0, o.isLeafType)(e) || (0, o.isLeafType)(n) ? e !== n : !1;
	}
	function C(e, n, r, i) {
		let a = n.get(i);
		if (a) return a;
		let o = Object.create(null), s = Object.create(null);
		T(e, r, i, o, s);
		let c = [o, Object.keys(s)];
		return n.set(i, c), c;
	}
	function w(e, n, r) {
		let i = n.get(r.selectionSet);
		if (i) return i;
		let a = (0, c.typeFromAST)(e.getSchema(), r.typeCondition);
		return C(e, n, a, r.selectionSet);
	}
	function T(e, n, r, a, s) {
		for (let l of r.selections) switch (l.kind) {
			case i.Kind.FIELD: {
				let e = l.name.value, r;
				((0, o.isObjectType)(n) || (0, o.isInterfaceType)(n)) && (r = n.getFields()[e]);
				let i = l.alias ? l.alias.value : e;
				a[i] || (a[i] = []), a[i].push([
					n,
					l,
					r
				]);
				break;
			}
			case i.Kind.FRAGMENT_SPREAD:
				s[l.name.value] = !0;
				break;
			case i.Kind.INLINE_FRAGMENT: {
				let r = l.typeCondition, i = r ? (0, c.typeFromAST)(e.getSchema(), r) : n;
				T(e, i, l.selectionSet, a, s);
				break;
			}
		}
	}
	function E(e, n, r, i) {
		if (e.length > 0) return [
			[n, e.map(([e]) => e)],
			[r, ...e.map(([, e]) => e).flat()],
			[i, ...e.map(([, , e]) => e).flat()]
		];
	}
	var D = class {
		constructor() {
			this._data = /* @__PURE__ */ new Map();
		}
		has(e, n, r) {
			let i = this._data.get(e)?.get(n);
			return i === void 0 ? !1 : r ? !0 : r === i;
		}
		add(e, n, r) {
			let i = this._data.get(e);
			i === void 0 ? this._data.set(e, new Map([[n, r]])) : i.set(n, r);
		}
	}, O = class {
		constructor() {
			this._orderedPairSet = new D();
		}
		has(e, n, r) {
			return e < n ? this._orderedPairSet.has(e, n, r) : this._orderedPairSet.has(n, e, r);
		}
		add(e, n, r) {
			e < n ? this._orderedPairSet.add(e, n, r) : this._orderedPairSet.add(n, e, r);
		}
	};
})), require_PossibleFragmentSpreadsRule = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.PossibleFragmentSpreadsRule = s;
	var n = require_inspect(), r = require_GraphQLError(), i = require_definition(), a = require_typeComparators(), o = require_typeFromAST();
	function s(e) {
		return {
			InlineFragment(o) {
				let s = e.getType(), c = e.getParentType();
				if ((0, i.isCompositeType)(s) && (0, i.isCompositeType)(c) && !(0, a.doTypesOverlap)(e.getSchema(), s, c)) {
					let i = (0, n.inspect)(c), a = (0, n.inspect)(s);
					e.reportError(new r.GraphQLError(`Fragment cannot be spread here as objects of type "${i}" can never be of type "${a}".`, { nodes: o }));
				}
			},
			FragmentSpread(i) {
				let o = i.name.value, s = c(e, o), l = e.getParentType();
				if (s && l && !(0, a.doTypesOverlap)(e.getSchema(), s, l)) {
					let a = (0, n.inspect)(l), c = (0, n.inspect)(s);
					e.reportError(new r.GraphQLError(`Fragment "${o}" cannot be spread here as objects of type "${a}" can never be of type "${c}".`, { nodes: i }));
				}
			}
		};
	}
	function c(e, n) {
		let r = e.getFragment(n);
		if (r) {
			let n = (0, o.typeFromAST)(e.getSchema(), r.typeCondition);
			if ((0, i.isCompositeType)(n)) return n;
		}
	}
})), require_PossibleTypeExtensionsRule = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.PossibleTypeExtensionsRule = u;
	var n = require_didYouMean(), r = require_inspect(), i = require_invariant(), a = require_suggestionList(), o = require_GraphQLError(), s = require_kinds(), c = require_predicates(), l = require_definition();
	function u(e) {
		let r = e.getSchema(), i = Object.create(null);
		for (let n of e.getDocument().definitions) (0, c.isTypeDefinitionNode)(n) && (i[n.name.value] = n);
		return {
			ScalarTypeExtension: s,
			ObjectTypeExtension: s,
			InterfaceTypeExtension: s,
			UnionTypeExtension: s,
			EnumTypeExtension: s,
			InputObjectTypeExtension: s
		};
		function s(s) {
			let c = s.name.value, l = i[c], u = r?.getType(c), g;
			if (l ? g = d[l.kind] : u && (g = f(u)), g) {
				if (g !== s.kind) {
					let n = m(s.kind);
					e.reportError(new o.GraphQLError(`Cannot extend non-${n} type "${c}".`, { nodes: l ? [l, s] : s }));
				}
			} else {
				let l = Object.keys({
					...i,
					...r?.getTypeMap()
				}), u = (0, a.suggestionList)(c, l);
				e.reportError(new o.GraphQLError(`Cannot extend type "${c}" because it is not defined.` + (0, n.didYouMean)(u), { nodes: s.name }));
			}
		}
	}
	var d = {
		[s.Kind.SCALAR_TYPE_DEFINITION]: s.Kind.SCALAR_TYPE_EXTENSION,
		[s.Kind.OBJECT_TYPE_DEFINITION]: s.Kind.OBJECT_TYPE_EXTENSION,
		[s.Kind.INTERFACE_TYPE_DEFINITION]: s.Kind.INTERFACE_TYPE_EXTENSION,
		[s.Kind.UNION_TYPE_DEFINITION]: s.Kind.UNION_TYPE_EXTENSION,
		[s.Kind.ENUM_TYPE_DEFINITION]: s.Kind.ENUM_TYPE_EXTENSION,
		[s.Kind.INPUT_OBJECT_TYPE_DEFINITION]: s.Kind.INPUT_OBJECT_TYPE_EXTENSION
	};
	function f(e) {
		if ((0, l.isScalarType)(e)) return s.Kind.SCALAR_TYPE_EXTENSION;
		if ((0, l.isObjectType)(e)) return s.Kind.OBJECT_TYPE_EXTENSION;
		if ((0, l.isInterfaceType)(e)) return s.Kind.INTERFACE_TYPE_EXTENSION;
		if ((0, l.isUnionType)(e)) return s.Kind.UNION_TYPE_EXTENSION;
		if ((0, l.isEnumType)(e)) return s.Kind.ENUM_TYPE_EXTENSION;
		if ((0, l.isInputObjectType)(e)) return s.Kind.INPUT_OBJECT_TYPE_EXTENSION;
		/* c8 ignore next 3 */
		(0, i.invariant)(!1, "Unexpected type: " + (0, r.inspect)(e));
	}
	function m(e) {
		switch (e) {
			case s.Kind.SCALAR_TYPE_EXTENSION: return "scalar";
			case s.Kind.OBJECT_TYPE_EXTENSION: return "object";
			case s.Kind.INTERFACE_TYPE_EXTENSION: return "interface";
			case s.Kind.UNION_TYPE_EXTENSION: return "union";
			case s.Kind.ENUM_TYPE_EXTENSION: return "enum";
			case s.Kind.INPUT_OBJECT_TYPE_EXTENSION: return "input object";
			default: (0, i.invariant)(!1, "Unexpected kind: " + (0, r.inspect)(e));
		}
	}
})), require_ProvidedRequiredArgumentsRule = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.ProvidedRequiredArgumentsOnDirectivesRule = u, e.ProvidedRequiredArgumentsRule = l;
	var n = require_inspect(), r = require_keyMap(), i = require_GraphQLError(), a = require_kinds(), o = require_printer(), s = require_definition(), c = require_directives();
	function l(e) {
		return {
			...u(e),
			Field: { leave(r) {
				let a = e.getFieldDef();
				if (!a) return !1;
				let o = new Set(r.arguments?.map((e) => e.name.value));
				for (let c of a.args) if (!o.has(c.name) && (0, s.isRequiredArgument)(c)) {
					let o = (0, n.inspect)(c.type);
					e.reportError(new i.GraphQLError(`Field "${a.name}" argument "${c.name}" of type "${o}" is required, but it was not provided.`, { nodes: r }));
				}
			} }
		};
	}
	function u(e) {
		let l = Object.create(null), u = e.getSchema()?.getDirectives() ?? c.specifiedDirectives;
		for (let e of u) l[e.name] = (0, r.keyMap)(e.args.filter(s.isRequiredArgument), (e) => e.name);
		let f = e.getDocument().definitions;
		for (let e of f) if (e.kind === a.Kind.DIRECTIVE_DEFINITION) {
			/* c8 ignore next */
			let n = e.arguments ?? [];
			l[e.name.value] = (0, r.keyMap)(n.filter(d), (e) => e.name.value);
		}
		return { Directive: { leave(r) {
			let a = r.name.value, c = l[a];
			if (c) {
				/* c8 ignore next */
				let l = r.arguments ?? [], u = new Set(l.map((e) => e.name.value));
				for (let [l, d] of Object.entries(c)) if (!u.has(l)) {
					let c = (0, s.isType)(d.type) ? (0, n.inspect)(d.type) : (0, o.print)(d.type);
					e.reportError(new i.GraphQLError(`Directive "@${a}" argument "${l}" of type "${c}" is required, but it was not provided.`, { nodes: r }));
				}
			}
		} } };
	}
	function d(e) {
		return e.type.kind === a.Kind.NON_NULL_TYPE && e.defaultValue == null;
	}
})), require_ScalarLeafsRule = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.ScalarLeafsRule = a;
	var n = require_inspect(), r = require_GraphQLError(), i = require_definition();
	function a(e) {
		return { Field(a) {
			let o = e.getType(), s = a.selectionSet;
			if (o) if ((0, i.isLeafType)((0, i.getNamedType)(o))) {
				if (s) {
					let i = a.name.value, c = (0, n.inspect)(o);
					e.reportError(new r.GraphQLError(`Field "${i}" must not have a selection since type "${c}" has no subfields.`, { nodes: s }));
				}
			} else if (s) {
				if (s.selections.length === 0) {
					let i = a.name.value, s = (0, n.inspect)(o);
					e.reportError(new r.GraphQLError(`Field "${i}" of type "${s}" must have at least one field selected.`, { nodes: a }));
				}
			} else {
				let i = a.name.value, s = (0, n.inspect)(o);
				e.reportError(new r.GraphQLError(`Field "${i}" of type "${s}" must have a selection of subfields. Did you mean "${i} { ... }"?`, { nodes: a }));
			}
		} };
	}
})), require_printPathArray = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.printPathArray = n;
	function n(e) {
		return e.map((e) => typeof e == "number" ? "[" + e.toString() + "]" : "." + e).join("");
	}
})), require_Path = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.addPath = n, e.pathToArray = r;
	function n(e, n, r) {
		return {
			prev: e,
			key: n,
			typename: r
		};
	}
	function r(e) {
		let n = [], r = e;
		for (; r;) n.push(r.key), r = r.prev;
		return n.reverse();
	}
})), require_coerceInputValue = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.coerceInputValue = f;
	var n = require_didYouMean(), r = require_inspect(), i = require_invariant(), a = require_isIterableObject(), o = require_isObjectLike(), s = require_Path(), c = require_printPathArray(), l = require_suggestionList(), u = require_GraphQLError(), d = require_definition();
	function f(e, n, r = m) {
		return g(e, n, r, void 0);
	}
	function m(e, n, i) {
		let a = "Invalid value " + (0, r.inspect)(n);
		throw e.length > 0 && (a += ` at "value${(0, c.printPathArray)(e)}"`), i.message = a + ": " + i.message, i;
	}
	function g(e, c, f, m) {
		if ((0, d.isNonNullType)(c)) {
			if (e != null) return g(e, c.ofType, f, m);
			f((0, s.pathToArray)(m), e, new u.GraphQLError(`Expected non-nullable type "${(0, r.inspect)(c)}" not to be null.`));
			return;
		}
		if (e == null) return null;
		if ((0, d.isListType)(c)) {
			let n = c.ofType;
			return (0, a.isIterableObject)(e) ? Array.from(e, (e, r) => {
				let i = (0, s.addPath)(m, r, void 0);
				return g(e, n, f, i);
			}) : [g(e, n, f, m)];
		}
		if ((0, d.isInputObjectType)(c)) {
			if (!(0, o.isObjectLike)(e) || Array.isArray(e)) {
				f((0, s.pathToArray)(m), e, new u.GraphQLError(`Expected type "${c.name}" to be an object.`));
				return;
			}
			let i = Object.create(null), a = c.getFields();
			for (let n of Object.values(a)) {
				let a = e[n.name];
				if (a === void 0) {
					if (n.defaultValue !== void 0) i[n.name] = n.defaultValue;
					else if ((0, d.isNonNullType)(n.type)) {
						let i = (0, r.inspect)(n.type);
						f((0, s.pathToArray)(m), e, new u.GraphQLError(`Field "${n.name}" of required type "${i}" was not provided.`));
					}
					continue;
				}
				i[n.name] = g(a, n.type, f, (0, s.addPath)(m, n.name, c.name));
			}
			for (let r of Object.keys(e)) if (!a[r]) {
				let i = (0, l.suggestionList)(r, Object.keys(c.getFields()));
				f((0, s.pathToArray)(m), e, new u.GraphQLError(`Field "${r}" is not defined by type "${c.name}".` + (0, n.didYouMean)(i)));
			}
			if (c.isOneOf) {
				let n = Object.keys(i);
				n.length !== 1 && f((0, s.pathToArray)(m), e, new u.GraphQLError(`Exactly one key must be specified for OneOf type "${c.name}".`));
				let r = n[0], a = i[r];
				a === null && f((0, s.pathToArray)(m).concat(r), a, new u.GraphQLError(`Field "${r}" must be non-null.`));
			}
			return { ...i };
		}
		if ((0, d.isLeafType)(c)) {
			let n;
			try {
				n = c.parseValue(e);
			} catch (n) {
				n instanceof u.GraphQLError ? f((0, s.pathToArray)(m), e, n) : f((0, s.pathToArray)(m), e, new u.GraphQLError(`Expected type "${c.name}". ` + n.message, { originalError: n }));
				return;
			}
			return n === void 0 && f((0, s.pathToArray)(m), e, new u.GraphQLError(`Expected type "${c.name}".`)), n;
		}
		/* c8 ignore next 3 */
		(0, i.invariant)(!1, "Unexpected input type: " + (0, r.inspect)(c));
	}
})), require_valueFromAST = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.valueFromAST = s;
	var n = require_inspect(), r = require_invariant(), i = require_keyMap(), a = require_kinds(), o = require_definition();
	function s(e, u, d) {
		if (e) {
			if (e.kind === a.Kind.VARIABLE) {
				let n = e.name.value;
				if (d == null || d[n] === void 0 || !l(d, n)) return;
				let r = d[n];
				return r === null && (0, o.isNonNullType)(u) ? void 0 : r;
			}
			if ((0, o.isNonNullType)(u)) return e.kind === a.Kind.NULL ? void 0 : s(e, u.ofType, d);
			if (e.kind === a.Kind.NULL) return null;
			if ((0, o.isListType)(u)) {
				let n = u.ofType;
				if (e.kind === a.Kind.LIST) {
					let r = [];
					for (let i of e.values) if (c(i, d)) {
						if ((0, o.isNonNullType)(n)) return;
						r.push(null);
					} else {
						let e = s(i, n, d);
						if (e === void 0) return;
						r.push(e);
					}
					return r;
				}
				let r = s(e, n, d);
				return r === void 0 ? void 0 : [r];
			}
			if ((0, o.isInputObjectType)(u)) {
				if (e.kind !== a.Kind.OBJECT) return;
				let n = Object.create(null), r = (0, i.keyMap)(e.fields, (e) => e.name.value);
				for (let e of Object.values(u.getFields())) {
					let i = r[e.name];
					if (!i || c(i.value, d)) {
						if (e.defaultValue !== void 0) n[e.name] = e.defaultValue;
						else if ((0, o.isNonNullType)(e.type)) return;
						continue;
					}
					let a = s(i.value, e.type, d);
					if (a === void 0) return;
					n[e.name] = a;
				}
				if (u.isOneOf) {
					let e = Object.keys(n);
					if (e.length !== 1 || n[e[0]] === null) return;
				}
				return n;
			}
			if ((0, o.isLeafType)(u)) {
				let n;
				try {
					n = u.parseLiteral(e, d);
				} catch {
					return;
				}
				return n === void 0 ? void 0 : n;
			}
			/* c8 ignore next 3 */
			(0, r.invariant)(!1, "Unexpected input type: " + (0, n.inspect)(u));
		}
	}
	function c(e, n) {
		return e.kind === a.Kind.VARIABLE && (n == null || n[e.name.value] === void 0 || !l(n, e.name.value));
	}
	function l(e, n) {
		return Object.prototype.hasOwnProperty.call(e, n);
	}
})), require_values = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.getArgumentValues = g, e.getDirectiveValues = _, e.getVariableValues = f;
	var n = require_inspect(), r = require_keyMap(), i = require_printPathArray(), a = require_GraphQLError(), o = require_kinds(), s = require_printer(), c = require_definition(), l = require_coerceInputValue(), u = require_typeFromAST(), d = require_valueFromAST();
	function f(e, n, r, i) {
		let o = [], s = i?.maxErrors;
		try {
			let i = m(e, n, r, (e) => {
				if (s != null && o.length >= s) throw new a.GraphQLError("Too many errors processing variables, error limit reached. Execution aborted.");
				o.push(e);
			});
			if (o.length === 0) return { coerced: i };
		} catch (e) {
			o.push(e);
		}
		return { errors: o };
	}
	function m(e, r, o, f) {
		let m = Object.create(null);
		for (let g of r) {
			let r = g.variable.name.value, _ = (0, u.typeFromAST)(e, g.type);
			if (!(0, c.isInputType)(_)) {
				let e = (0, s.print)(g.type);
				f(new a.GraphQLError(`Variable "$${r}" expected value of type "${e}" which cannot be used as an input type.`, { nodes: g.type }));
				continue;
			}
			if (!v(o, r)) {
				if (g.defaultValue) m[r] = (0, d.valueFromAST)(g.defaultValue, _);
				else if ((0, c.isNonNullType)(_)) {
					let e = (0, n.inspect)(_);
					f(new a.GraphQLError(`Variable "$${r}" of required type "${e}" was not provided.`, { nodes: g }));
				}
				continue;
			}
			let y = o[r];
			if (y === null && (0, c.isNonNullType)(_)) {
				let e = (0, n.inspect)(_);
				f(new a.GraphQLError(`Variable "$${r}" of non-null type "${e}" must not be null.`, { nodes: g }));
				continue;
			}
			m[r] = (0, l.coerceInputValue)(y, _, (e, o, s) => {
				let c = `Variable "$${r}" got invalid value ` + (0, n.inspect)(o);
				e.length > 0 && (c += ` at "${r}${(0, i.printPathArray)(e)}"`), f(new a.GraphQLError(c + "; " + s.message, {
					nodes: g,
					originalError: s
				}));
			});
		}
		return { ...m };
	}
	function g(e, i, l) {
		let u = Object.create(null), f = i.arguments ?? [], m = (0, r.keyMap)(f, (e) => e.name.value);
		for (let r of e.args) {
			let e = r.name, f = r.type, g = m[e];
			if (!g) {
				if (r.defaultValue !== void 0) u[e] = r.defaultValue;
				else if ((0, c.isNonNullType)(f)) throw new a.GraphQLError(`Argument "${e}" of required type "${(0, n.inspect)(f)}" was not provided.`, { nodes: i });
				continue;
			}
			let _ = g.value, y = _.kind === o.Kind.NULL;
			if (_.kind === o.Kind.VARIABLE) {
				let i = _.name.value;
				if (l == null || !v(l, i)) {
					if (r.defaultValue !== void 0) u[e] = r.defaultValue;
					else if ((0, c.isNonNullType)(f)) throw new a.GraphQLError(`Argument "${e}" of required type "${(0, n.inspect)(f)}" was provided the variable "$${i}" which was not provided a runtime value.`, { nodes: _ });
					continue;
				}
				y = l[i] == null;
			}
			if (y && (0, c.isNonNullType)(f)) throw new a.GraphQLError(`Argument "${e}" of non-null type "${(0, n.inspect)(f)}" must not be null.`, { nodes: _ });
			let b = (0, d.valueFromAST)(_, f, l);
			if (b === void 0) throw new a.GraphQLError(`Argument "${e}" has invalid value ${(0, s.print)(_)}.`, { nodes: _ });
			u[e] = b;
		}
		return { ...u };
	}
	function _(e, n, r) {
		let i = n.directives?.find((n) => n.name.value === e.name);
		if (i) return g(e, i, r);
	}
	function v(e, n) {
		return Object.prototype.hasOwnProperty.call(e, n);
	}
})), require_collectFields = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.collectFields = s, e.collectSubfields = c;
	var n = require_kinds(), r = require_definition(), i = require_directives(), a = require_typeFromAST(), o = require_values();
	function s(e, n, r, i, a) {
		let o = /* @__PURE__ */ new Map();
		return l(e, n, r, i, a, o, /* @__PURE__ */ new Set()), o;
	}
	function c(e, n, r, i, a) {
		let o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set();
		for (let c of a) c.selectionSet && l(e, n, r, i, c.selectionSet, o, s);
		return o;
	}
	function l(e, r, i, a, o, s, c) {
		for (let m of o.selections) switch (m.kind) {
			case n.Kind.FIELD: {
				if (!u(i, m)) continue;
				let e = f(m), n = s.get(e);
				n === void 0 ? s.set(e, [m]) : n.push(m);
				break;
			}
			case n.Kind.INLINE_FRAGMENT:
				if (!u(i, m) || !d(e, m, a)) continue;
				l(e, r, i, a, m.selectionSet, s, c);
				break;
			case n.Kind.FRAGMENT_SPREAD: {
				let n = m.name.value;
				if (c.has(n) || !u(i, m)) continue;
				c.add(n);
				let o = r[n];
				if (!o || !d(e, o, a)) continue;
				l(e, r, i, a, o.selectionSet, s, c);
				break;
			}
		}
	}
	function u(e, n) {
		return (0, o.getDirectiveValues)(i.GraphQLSkipDirective, n, e)?.if === !0 ? !1 : (0, o.getDirectiveValues)(i.GraphQLIncludeDirective, n, e)?.if !== !1;
	}
	function d(e, n, i) {
		let o = n.typeCondition;
		if (!o) return !0;
		let s = (0, a.typeFromAST)(e, o);
		return s === i ? !0 : (0, r.isAbstractType)(s) ? e.isSubType(s, i) : !1;
	}
	function f(e) {
		return e.alias ? e.alias.value : e.name.value;
	}
})), require_SingleFieldSubscriptionsRule = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.SingleFieldSubscriptionsRule = a;
	var n = require_GraphQLError(), r = require_kinds(), i = require_collectFields();
	function a(e) {
		return { OperationDefinition(a) {
			if (a.operation === "subscription") {
				let o = e.getSchema(), s = o.getSubscriptionType();
				if (s) {
					let c = a.name ? a.name.value : null, l = Object.create(null), u = e.getDocument(), d = Object.create(null);
					for (let e of u.definitions) e.kind === r.Kind.FRAGMENT_DEFINITION && (d[e.name.value] = e);
					let f = (0, i.collectFields)(o, d, l, s, a.selectionSet);
					if (f.size > 1) {
						let r = [...f.values()].slice(1).flat();
						e.reportError(new n.GraphQLError(c == null ? "Anonymous Subscription must select only one top level field." : `Subscription "${c}" must select only one top level field.`, { nodes: r }));
					}
					for (let r of f.values()) r[0].name.value.startsWith("__") && e.reportError(new n.GraphQLError(c == null ? "Anonymous Subscription must not select an introspection top level field." : `Subscription "${c}" must not select an introspection top level field.`, { nodes: r }));
				}
			}
		} };
	}
})), require_groupBy = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.groupBy = n;
	function n(e, n) {
		let r = /* @__PURE__ */ new Map();
		for (let i of e) {
			let e = n(i), a = r.get(e);
			a === void 0 ? r.set(e, [i]) : a.push(i);
		}
		return r;
	}
})), require_UniqueArgumentDefinitionNamesRule = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.UniqueArgumentDefinitionNamesRule = i;
	var n = require_groupBy(), r = require_GraphQLError();
	function i(e) {
		return {
			DirectiveDefinition(e) {
				/* c8 ignore next */
				let n = e.arguments ?? [];
				return a(`@${e.name.value}`, n);
			},
			InterfaceTypeDefinition: i,
			InterfaceTypeExtension: i,
			ObjectTypeDefinition: i,
			ObjectTypeExtension: i
		};
		function i(e) {
			let n = e.name.value, r = e.fields ?? [];
			for (let e of r) {
				let r = e.name.value, i = e.arguments ?? [];
				a(`${n}.${r}`, i);
			}
			return !1;
		}
		function a(i, a) {
			let o = (0, n.groupBy)(a, (e) => e.name.value);
			for (let [n, a] of o) a.length > 1 && e.reportError(new r.GraphQLError(`Argument "${i}(${n}:)" can only be defined once.`, { nodes: a.map((e) => e.name) }));
			return !1;
		}
	}
})), require_UniqueArgumentNamesRule = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.UniqueArgumentNamesRule = i;
	var n = require_groupBy(), r = require_GraphQLError();
	function i(e) {
		return {
			Field: i,
			Directive: i
		};
		function i(i) {
			/* c8 ignore next */
			let a = i.arguments ?? [], o = (0, n.groupBy)(a, (e) => e.name.value);
			for (let [n, i] of o) i.length > 1 && e.reportError(new r.GraphQLError(`There can be only one argument named "${n}".`, { nodes: i.map((e) => e.name) }));
		}
	}
})), require_UniqueDirectiveNamesRule = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.UniqueDirectiveNamesRule = r;
	var n = require_GraphQLError();
	function r(e) {
		let r = Object.create(null), i = e.getSchema();
		return { DirectiveDefinition(a) {
			let o = a.name.value;
			if (i != null && i.getDirective(o)) {
				e.reportError(new n.GraphQLError(`Directive "@${o}" already exists in the schema. It cannot be redefined.`, { nodes: a.name }));
				return;
			}
			return r[o] ? e.reportError(new n.GraphQLError(`There can be only one directive named "@${o}".`, { nodes: [r[o], a.name] })) : r[o] = a.name, !1;
		} };
	}
})), require_UniqueDirectivesPerLocationRule = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.UniqueDirectivesPerLocationRule = o;
	var n = require_GraphQLError(), r = require_kinds(), i = require_predicates(), a = require_directives();
	function o(e) {
		let o = Object.create(null), s = e.getSchema(), c = s ? s.getDirectives() : a.specifiedDirectives;
		for (let e of c) o[e.name] = !e.isRepeatable;
		let l = e.getDocument().definitions;
		for (let e of l) e.kind === r.Kind.DIRECTIVE_DEFINITION && (o[e.name.value] = !e.repeatable);
		let u = Object.create(null), d = Object.create(null), f = Object.create(null);
		return { enter(a) {
			if (!("directives" in a) || !a.directives) return;
			let s;
			if (a.kind === r.Kind.SCHEMA_DEFINITION || a.kind === r.Kind.SCHEMA_EXTENSION) s = u;
			else if ((0, i.isTypeDefinitionNode)(a) || (0, i.isTypeExtensionNode)(a)) {
				let e = a.name.value;
				s = d[e], s === void 0 && (d[e] = s = Object.create(null));
			} else if (a.kind === r.Kind.DIRECTIVE_DEFINITION || a.kind === r.Kind.DIRECTIVE_EXTENSION) {
				let e = a.name.value;
				s = f[e], s === void 0 && (f[e] = s = Object.create(null));
			} else s = Object.create(null);
			for (let r of a.directives) {
				let i = r.name.value;
				o[i] && (s[i] ? e.reportError(new n.GraphQLError(`The directive "@${i}" can only be used once at this location.`, { nodes: [s[i], r] })) : s[i] = r);
			}
		} };
	}
})), require_UniqueEnumValueNamesRule = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.UniqueEnumValueNamesRule = i;
	var n = require_GraphQLError(), r = require_definition();
	function i(e) {
		let i = e.getSchema(), a = i ? i.getTypeMap() : Object.create(null), o = Object.create(null);
		return {
			EnumTypeDefinition: s,
			EnumTypeExtension: s
		};
		function s(i) {
			let s = i.name.value;
			o[s] || (o[s] = Object.create(null));
			/* c8 ignore next */
			let c = i.values ?? [], l = o[s];
			for (let i of c) {
				let o = i.name.value, c = a[s];
				(0, r.isEnumType)(c) && c.getValue(o) ? e.reportError(new n.GraphQLError(`Enum value "${s}.${o}" already exists in the schema. It cannot also be defined in this type extension.`, { nodes: i.name })) : l[o] ? e.reportError(new n.GraphQLError(`Enum value "${s}.${o}" can only be defined once.`, { nodes: [l[o], i.name] })) : l[o] = i.name;
			}
			return !1;
		}
	}
})), require_UniqueFieldDefinitionNamesRule = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.UniqueFieldDefinitionNamesRule = i;
	var n = require_GraphQLError(), r = require_definition();
	function i(e) {
		let r = e.getSchema(), i = r ? r.getTypeMap() : Object.create(null), o = Object.create(null);
		return {
			InputObjectTypeDefinition: s,
			InputObjectTypeExtension: s,
			InterfaceTypeDefinition: s,
			InterfaceTypeExtension: s,
			ObjectTypeDefinition: s,
			ObjectTypeExtension: s
		};
		function s(r) {
			let s = r.name.value;
			o[s] || (o[s] = Object.create(null));
			/* c8 ignore next */
			let c = r.fields ?? [], l = o[s];
			for (let r of c) {
				let o = r.name.value;
				a(i[s], o) ? e.reportError(new n.GraphQLError(`Field "${s}.${o}" already exists in the schema. It cannot also be defined in this type extension.`, { nodes: r.name })) : l[o] ? e.reportError(new n.GraphQLError(`Field "${s}.${o}" can only be defined once.`, { nodes: [l[o], r.name] })) : l[o] = r.name;
			}
			return !1;
		}
	}
	function a(e, n) {
		return (0, r.isObjectType)(e) || (0, r.isInterfaceType)(e) || (0, r.isInputObjectType)(e) ? e.getFields()[n] != null : !1;
	}
})), require_UniqueFragmentNamesRule = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.UniqueFragmentNamesRule = r;
	var n = require_GraphQLError();
	function r(e) {
		let r = Object.create(null);
		return {
			OperationDefinition: () => !1,
			FragmentDefinition(i) {
				let a = i.name.value;
				return r[a] ? e.reportError(new n.GraphQLError(`There can be only one fragment named "${a}".`, { nodes: [r[a], i.name] })) : r[a] = i.name, !1;
			}
		};
	}
})), require_UniqueInputFieldNamesRule = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.UniqueInputFieldNamesRule = i;
	var n = require_invariant(), r = require_GraphQLError();
	function i(e) {
		let i = [], a = Object.create(null);
		return {
			ObjectValue: {
				enter() {
					i.push(a), a = Object.create(null);
				},
				leave() {
					let e = i.pop();
					e || (0, n.invariant)(!1), a = e;
				}
			},
			ObjectField(n) {
				let i = n.name.value;
				a[i] ? e.reportError(new r.GraphQLError(`There can be only one input field named "${i}".`, { nodes: [a[i], n.name] })) : a[i] = n.name;
			}
		};
	}
})), require_UniqueOperationNamesRule = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.UniqueOperationNamesRule = r;
	var n = require_GraphQLError();
	function r(e) {
		let r = Object.create(null);
		return {
			OperationDefinition(i) {
				let a = i.name;
				return a && (r[a.value] ? e.reportError(new n.GraphQLError(`There can be only one operation named "${a.value}".`, { nodes: [r[a.value], a] })) : r[a.value] = a), !1;
			},
			FragmentDefinition: () => !1
		};
	}
})), require_UniqueOperationTypesRule = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.UniqueOperationTypesRule = r;
	var n = require_GraphQLError();
	function r(e) {
		let r = e.getSchema(), i = Object.create(null), a = r ? {
			query: r.getQueryType(),
			mutation: r.getMutationType(),
			subscription: r.getSubscriptionType()
		} : {};
		return {
			SchemaDefinition: o,
			SchemaExtension: o
		};
		function o(r) {
			/* c8 ignore next */
			let o = r.operationTypes ?? [];
			for (let r of o) {
				let o = r.operation, s = i[o];
				a[o] ? e.reportError(new n.GraphQLError(`Type for ${o} already defined in the schema. It cannot be redefined.`, { nodes: r })) : s ? e.reportError(new n.GraphQLError(`There can be only one ${o} type in schema.`, { nodes: [s, r] })) : i[o] = r;
			}
			return !1;
		}
	}
})), require_UniqueTypeNamesRule = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.UniqueTypeNamesRule = r;
	var n = require_GraphQLError();
	function r(e) {
		let r = Object.create(null), i = e.getSchema();
		return {
			ScalarTypeDefinition: a,
			ObjectTypeDefinition: a,
			InterfaceTypeDefinition: a,
			UnionTypeDefinition: a,
			EnumTypeDefinition: a,
			InputObjectTypeDefinition: a
		};
		function a(a) {
			let o = a.name.value;
			if (i != null && i.getType(o)) {
				e.reportError(new n.GraphQLError(`Type "${o}" already exists in the schema. It cannot also be defined in this type definition.`, { nodes: a.name }));
				return;
			}
			return r[o] ? e.reportError(new n.GraphQLError(`There can be only one type named "${o}".`, { nodes: [r[o], a.name] })) : r[o] = a.name, !1;
		}
	}
})), require_UniqueVariableNamesRule = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.UniqueVariableNamesRule = i;
	var n = require_groupBy(), r = require_GraphQLError();
	function i(e) {
		return { OperationDefinition(i) {
			/* c8 ignore next */
			let a = i.variableDefinitions ?? [], o = (0, n.groupBy)(a, (e) => e.variable.name.value);
			for (let [n, i] of o) i.length > 1 && e.reportError(new r.GraphQLError(`There can be only one variable named "$${n}".`, { nodes: i.map((e) => e.variable.name) }));
		} };
	}
})), require_ValuesOfCorrectTypeRule = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.ValuesOfCorrectTypeRule = u;
	var n = require_didYouMean(), r = require_inspect(), i = require_keyMap(), a = require_suggestionList(), o = require_GraphQLError(), s = require_kinds(), c = require_printer(), l = require_definition();
	function u(e) {
		return {
			ListValue(n) {
				let r = (0, l.getNullableType)(e.getParentInputType());
				if (!(0, l.isListType)(r)) return d(e, n), !1;
			},
			ObjectValue(n) {
				let a = (0, l.getNamedType)(e.getInputType());
				if (!(0, l.isInputObjectType)(a)) return d(e, n), !1;
				let s = (0, i.keyMap)(n.fields, (e) => e.name.value);
				for (let i of Object.values(a.getFields())) if (!s[i.name] && (0, l.isRequiredInputField)(i)) {
					let s = (0, r.inspect)(i.type);
					e.reportError(new o.GraphQLError(`Field "${a.name}.${i.name}" of required type "${s}" was not provided.`, { nodes: n }));
				}
				a.isOneOf && f(e, n, a, s);
			},
			ObjectField(r) {
				let i = (0, l.getNamedType)(e.getParentInputType());
				if (!e.getInputType() && (0, l.isInputObjectType)(i)) {
					let s = (0, a.suggestionList)(r.name.value, Object.keys(i.getFields()));
					e.reportError(new o.GraphQLError(`Field "${r.name.value}" is not defined by type "${i.name}".` + (0, n.didYouMean)(s), { nodes: r }));
				}
			},
			NullValue(n) {
				let i = e.getInputType();
				(0, l.isNonNullType)(i) && e.reportError(new o.GraphQLError(`Expected value of type "${(0, r.inspect)(i)}", found ${(0, c.print)(n)}.`, { nodes: n }));
			},
			EnumValue: (n) => d(e, n),
			IntValue: (n) => d(e, n),
			FloatValue: (n) => d(e, n),
			StringValue: (n) => d(e, n),
			BooleanValue: (n) => d(e, n)
		};
	}
	function d(e, n) {
		let i = e.getInputType();
		if (!i) return;
		let a = (0, l.getNamedType)(i);
		if (!(0, l.isLeafType)(a)) {
			let a = (0, r.inspect)(i);
			e.reportError(new o.GraphQLError(`Expected value of type "${a}", found ${(0, c.print)(n)}.`, { nodes: n }));
			return;
		}
		try {
			if (a.parseLiteral(n, void 0) === void 0) {
				let a = (0, r.inspect)(i);
				e.reportError(new o.GraphQLError(`Expected value of type "${a}", found ${(0, c.print)(n)}.`, { nodes: n }));
			}
		} catch (a) {
			let s = (0, r.inspect)(i);
			a instanceof o.GraphQLError ? e.reportError(a) : e.reportError(new o.GraphQLError(`Expected value of type "${s}", found ${(0, c.print)(n)}; ` + a.message, {
				nodes: n,
				originalError: a
			}));
		}
	}
	function f(e, n, r, i) {
		let a = Object.keys(i);
		if (a.length !== 1) {
			e.reportError(new o.GraphQLError(`OneOf Input Object "${r.name}" must specify exactly one key.`, { nodes: [n] }));
			return;
		}
		let c = i[a[0]]?.value;
		(!c || c.kind === s.Kind.NULL) && e.reportError(new o.GraphQLError(`Field "${r.name}.${a[0]}" must be non-null.`, { nodes: [n] }));
	}
})), require_VariablesAreInputTypesRule = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.VariablesAreInputTypesRule = o;
	var n = require_GraphQLError(), r = require_printer(), i = require_definition(), a = require_typeFromAST();
	function o(e) {
		return { VariableDefinition(o) {
			let s = (0, a.typeFromAST)(e.getSchema(), o.type);
			if (s !== void 0 && !(0, i.isInputType)(s)) {
				let i = o.variable.name.value, a = (0, r.print)(o.type);
				e.reportError(new n.GraphQLError(`Variable "$${i}" cannot be non-input type "${a}".`, { nodes: o.type }));
			}
		} };
	}
})), require_VariablesInAllowedPositionRule = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.VariablesInAllowedPositionRule = c;
	var n = require_inspect(), r = require_GraphQLError(), i = require_kinds(), a = require_definition(), o = require_typeComparators(), s = require_typeFromAST();
	function c(e) {
		let i = Object.create(null);
		return {
			OperationDefinition: {
				enter() {
					i = Object.create(null);
				},
				leave(o) {
					let c = e.getRecursiveVariableUsages(o);
					for (let { node: o, type: u, defaultValue: d, parentType: f } of c) {
						let c = o.name.value, m = i[c];
						if (m && u) {
							let i = e.getSchema(), g = (0, s.typeFromAST)(i, m.type);
							if (g && !l(i, g, m.defaultValue, u, d)) {
								let i = (0, n.inspect)(g), a = (0, n.inspect)(u);
								e.reportError(new r.GraphQLError(`Variable "$${c}" of type "${i}" used in position expecting type "${a}".`, { nodes: [m, o] }));
							}
							(0, a.isInputObjectType)(f) && f.isOneOf && (0, a.isNullableType)(g) && e.reportError(new r.GraphQLError(`Variable "$${c}" is of type "${g}" but must be non-nullable to be used for OneOf Input Object "${f}".`, { nodes: [m, o] }));
						}
					}
				}
			},
			VariableDefinition(e) {
				i[e.variable.name.value] = e;
			}
		};
	}
	function l(e, n, r, s, c) {
		if ((0, a.isNonNullType)(s) && !(0, a.isNonNullType)(n)) {
			if (!(r != null && r.kind !== i.Kind.NULL) && c === void 0) return !1;
			let a = s.ofType;
			return (0, o.isTypeSubTypeOf)(e, n, a);
		}
		return (0, o.isTypeSubTypeOf)(e, n, s);
	}
})), require_specifiedRules = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 });
	var n = require_ExecutableDefinitionsRule(), r = require_FieldsOnCorrectTypeRule(), i = require_FragmentsOnCompositeTypesRule(), a = require_KnownArgumentNamesRule(), o = require_KnownDirectivesRule(), s = require_KnownFragmentNamesRule(), c = require_KnownTypeNamesRule(), l = require_LoneAnonymousOperationRule(), u = require_LoneSchemaDefinitionRule(), d = require_MaxIntrospectionDepthRule(), f = require_NoFragmentCyclesRule(), m = require_NoUndefinedVariablesRule(), g = require_NoUnusedFragmentsRule(), _ = require_NoUnusedVariablesRule(), v = require_OverlappingFieldsCanBeMergedRule(), y = require_PossibleFragmentSpreadsRule(), b = require_PossibleTypeExtensionsRule(), x = require_ProvidedRequiredArgumentsRule(), S = require_ScalarLeafsRule(), C = require_SingleFieldSubscriptionsRule(), w = require_UniqueArgumentDefinitionNamesRule(), T = require_UniqueArgumentNamesRule(), E = require_UniqueDirectiveNamesRule(), D = require_UniqueDirectivesPerLocationRule(), O = require_UniqueEnumValueNamesRule(), k = require_UniqueFieldDefinitionNamesRule(), A = require_UniqueFragmentNamesRule(), j = require_UniqueInputFieldNamesRule(), M = require_UniqueOperationNamesRule(), N = require_UniqueOperationTypesRule(), P = require_UniqueTypeNamesRule(), F = require_UniqueVariableNamesRule(), I = require_ValuesOfCorrectTypeRule(), L = require_VariablesAreInputTypesRule(), R = require_VariablesInAllowedPositionRule(), z = Object.freeze([d.MaxIntrospectionDepthRule]);
	e.recommendedRules = z, e.specifiedRules = Object.freeze([
		n.ExecutableDefinitionsRule,
		M.UniqueOperationNamesRule,
		l.LoneAnonymousOperationRule,
		C.SingleFieldSubscriptionsRule,
		c.KnownTypeNamesRule,
		i.FragmentsOnCompositeTypesRule,
		L.VariablesAreInputTypesRule,
		S.ScalarLeafsRule,
		r.FieldsOnCorrectTypeRule,
		A.UniqueFragmentNamesRule,
		s.KnownFragmentNamesRule,
		g.NoUnusedFragmentsRule,
		y.PossibleFragmentSpreadsRule,
		f.NoFragmentCyclesRule,
		F.UniqueVariableNamesRule,
		m.NoUndefinedVariablesRule,
		_.NoUnusedVariablesRule,
		o.KnownDirectivesRule,
		D.UniqueDirectivesPerLocationRule,
		a.KnownArgumentNamesRule,
		T.UniqueArgumentNamesRule,
		I.ValuesOfCorrectTypeRule,
		x.ProvidedRequiredArgumentsRule,
		R.VariablesInAllowedPositionRule,
		v.OverlappingFieldsCanBeMergedRule,
		j.UniqueInputFieldNamesRule,
		...z
	]), e.specifiedSDLRules = Object.freeze([
		u.LoneSchemaDefinitionRule,
		N.UniqueOperationTypesRule,
		P.UniqueTypeNamesRule,
		O.UniqueEnumValueNamesRule,
		k.UniqueFieldDefinitionNamesRule,
		w.UniqueArgumentDefinitionNamesRule,
		E.UniqueDirectiveNamesRule,
		c.KnownTypeNamesRule,
		o.KnownDirectivesRule,
		D.UniqueDirectivesPerLocationRule,
		b.PossibleTypeExtensionsRule,
		a.KnownArgumentNamesOnDirectivesRule,
		T.UniqueArgumentNamesRule,
		j.UniqueInputFieldNamesRule,
		x.ProvidedRequiredArgumentsOnDirectivesRule
	]);
})), require_ValidationContext = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 });
	var n = require_kinds(), r = require_visitor(), i = require_TypeInfo(), a = class {
		constructor(e, n) {
			this._ast = e, this._fragments = void 0, this._fragmentSpreads = /* @__PURE__ */ new Map(), this._recursivelyReferencedFragments = /* @__PURE__ */ new Map(), this._onError = n;
		}
		get [Symbol.toStringTag]() {
			return "ASTValidationContext";
		}
		reportError(e) {
			this._onError(e);
		}
		getDocument() {
			return this._ast;
		}
		getFragment(e) {
			let r;
			if (this._fragments) r = this._fragments;
			else {
				r = Object.create(null);
				for (let e of this.getDocument().definitions) e.kind === n.Kind.FRAGMENT_DEFINITION && (r[e.name.value] = e);
				this._fragments = r;
			}
			return r[e];
		}
		getFragmentSpreads(e) {
			let r = this._fragmentSpreads.get(e);
			if (!r) {
				r = [];
				let i = [e], a;
				for (; a = i.pop();) for (let e of a.selections) e.kind === n.Kind.FRAGMENT_SPREAD ? r.push(e) : e.selectionSet && i.push(e.selectionSet);
				this._fragmentSpreads.set(e, r);
			}
			return r;
		}
		getRecursivelyReferencedFragments(e) {
			let n = this._recursivelyReferencedFragments.get(e);
			if (!n) {
				n = [];
				let r = Object.create(null), i = [e.selectionSet], a;
				for (; a = i.pop();) for (let e of this.getFragmentSpreads(a)) {
					let a = e.name.value;
					if (r[a] !== !0) {
						r[a] = !0;
						let e = this.getFragment(a);
						e && (n.push(e), i.push(e.selectionSet));
					}
				}
				this._recursivelyReferencedFragments.set(e, n);
			}
			return n;
		}
	};
	e.ASTValidationContext = a, e.SDLValidationContext = class extends a {
		constructor(e, n, r) {
			super(e, r), this._schema = n;
		}
		get [Symbol.toStringTag]() {
			return "SDLValidationContext";
		}
		getSchema() {
			return this._schema;
		}
	}, e.ValidationContext = class extends a {
		constructor(e, n, r, i) {
			super(n, i), this._schema = e, this._typeInfo = r, this._variableUsages = /* @__PURE__ */ new Map(), this._recursiveVariableUsages = /* @__PURE__ */ new Map();
		}
		get [Symbol.toStringTag]() {
			return "ValidationContext";
		}
		getSchema() {
			return this._schema;
		}
		getVariableUsages(e) {
			let n = this._variableUsages.get(e);
			if (!n) {
				let a = [], o = new i.TypeInfo(this._schema);
				(0, r.visit)(e, (0, i.visitWithTypeInfo)(o, {
					VariableDefinition: () => !1,
					Variable(e) {
						a.push({
							node: e,
							type: o.getInputType(),
							defaultValue: o.getDefaultValue(),
							parentType: o.getParentInputType()
						});
					}
				})), n = a, this._variableUsages.set(e, n);
			}
			return n;
		}
		getRecursiveVariableUsages(e) {
			let n = this._recursiveVariableUsages.get(e);
			if (!n) {
				n = this.getVariableUsages(e);
				for (let r of this.getRecursivelyReferencedFragments(e)) n = n.concat(this.getVariableUsages(r));
				this._recursiveVariableUsages.set(e, n);
			}
			return n;
		}
		getType() {
			return this._typeInfo.getType();
		}
		getParentType() {
			return this._typeInfo.getParentType();
		}
		getInputType() {
			return this._typeInfo.getInputType();
		}
		getParentInputType() {
			return this._typeInfo.getParentInputType();
		}
		getFieldDef() {
			return this._typeInfo.getFieldDef();
		}
		getDirective() {
			return this._typeInfo.getDirective();
		}
		getArgument() {
			return this._typeInfo.getArgument();
		}
		getEnumValue() {
			return this._typeInfo.getEnumValue();
		}
	};
})), require_validate = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.assertValidSDL = g, e.assertValidSDLExtension = _, e.validate = f, e.validateSDL = m;
	var n = require_devAssert(), r = require_mapValue(), i = require_GraphQLError(), a = require_ast(), o = require_visitor(), s = require_validate$1(), c = require_TypeInfo(), l = require_specifiedRules(), u = require_ValidationContext(), d = (0, r.mapValue)(a.QueryDocumentKeys, (e) => e.filter((e) => e !== "description"));
	function f(e, r, a = l.specifiedRules, f, m = new c.TypeInfo(e)) {
		let g = f?.maxErrors ?? 100;
		r || (0, n.devAssert)(!1, "Must provide document."), (0, s.assertValidSchema)(e);
		let _ = Object.freeze({}), v = [], y = new u.ValidationContext(e, r, m, (e) => {
			if (v.length >= g) throw v.push(new i.GraphQLError("Too many validation errors, error limit reached. Validation aborted.")), _;
			v.push(e);
		}), b = (0, o.visitInParallel)(a.map((e) => e(y)));
		try {
			(0, o.visit)(r, (0, c.visitWithTypeInfo)(m, b), d);
		} catch (e) {
			if (e !== _) throw e;
		}
		return v;
	}
	function m(e, n, r = l.specifiedSDLRules) {
		let i = [], a = new u.SDLValidationContext(e, n, (e) => {
			i.push(e);
		}), s = r.map((e) => e(a));
		return (0, o.visit)(e, (0, o.visitInParallel)(s)), i;
	}
	function g(e) {
		let n = m(e);
		if (n.length !== 0) throw Error(n.map((e) => e.message).join("\n\n"));
	}
	function _(e, n) {
		let r = m(e, n);
		if (r.length !== 0) throw Error(r.map((e) => e.message).join("\n\n"));
	}
})), require_memoize3 = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.memoize3 = n;
	function n(e) {
		let n;
		return function(r, i, a) {
			n === void 0 && (n = /* @__PURE__ */ new WeakMap());
			let o = n.get(r);
			o === void 0 && (o = /* @__PURE__ */ new WeakMap(), n.set(r, o));
			let s = o.get(i);
			s === void 0 && (s = /* @__PURE__ */ new WeakMap(), o.set(i, s));
			let c = s.get(a);
			return c === void 0 && (c = e(r, i, a), s.set(a, c)), c;
		};
	}
})), require_promiseForObject = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.promiseForObject = n;
	function n(e) {
		return Promise.all(Object.values(e)).then((n) => {
			let r = Object.create(null);
			for (let [i, a] of Object.keys(e).entries()) r[a] = n[i];
			return r;
		});
	}
})), require_promiseReduce = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.promiseReduce = r;
	var n = require_isPromise();
	function r(e, r, i) {
		let a = i;
		for (let i of e) a = (0, n.isPromise)(a) ? a.then((e) => r(e, i)) : r(a, i);
		return a;
	}
})), require_toError = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.toError = r;
	var n = require_inspect();
	function r(e) {
		return e instanceof Error ? e : new i(e);
	}
	var i = class extends Error {
		constructor(e) {
			super("Unexpected error value: " + (0, n.inspect)(e)), this.name = "NonErrorThrown", this.thrownValue = e;
		}
	};
})), require_locatedError = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.locatedError = i;
	var n = require_toError(), r = require_GraphQLError();
	function i(e, i, o) {
		let s = (0, n.toError)(e);
		return a(s) ? s : new r.GraphQLError(s.message, {
			nodes: s.nodes ?? i,
			source: s.source,
			positions: s.positions,
			path: o,
			originalError: s
		});
	}
	function a(e) {
		return Array.isArray(e.path);
	}
})), require_execute = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.assertValidExecutionArguments = O, e.buildExecutionContext = k, e.buildResolveInfo = P, e.execute = T, e.executeSync = E, e.getFieldDef = G;
	var n = require_devAssert(), r = require_inspect(), i = require_invariant(), a = require_isIterableObject(), o = require_isObjectLike(), s = require_isPromise(), c = require_memoize3(), l = require_Path(), u = require_promiseForObject(), d = require_promiseReduce(), f = require_GraphQLError(), m = require_locatedError(), g = require_ast(), _ = require_kinds(), v = require_definition(), y = require_introspection(), b = require_validate$1(), x = require_collectFields(), S = require_values(), C = (0, c.memoize3)((e, n, r) => (0, x.collectSubfields)(e.schema, e.fragments, e.variableValues, n, r)), w = class {
		constructor() {
			this._errorPositions = /* @__PURE__ */ new Set(), this._errors = [];
		}
		get errors() {
			return this._errors;
		}
		add(e, n) {
			this._hasNulledPosition(n) || (this._errorPositions.add(n), this._errors.push(e));
		}
		_hasNulledPosition(e) {
			let n = e;
			for (; n !== void 0;) {
				if (this._errorPositions.has(n)) return !0;
				n = n.prev;
			}
			return this._errorPositions.has(void 0);
		}
	};
	function T(e) {
		arguments.length < 2 || (0, n.devAssert)(!1, "graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.");
		let { schema: r, document: i, variableValues: a, rootValue: o } = e;
		O(r, i, a);
		let c = k(e);
		if (!("schema" in c)) return { errors: c };
		try {
			let { operation: e } = c, n = A(c, e, o);
			return (0, s.isPromise)(n) ? n.then((e) => D(e, c.collectedErrors.errors), (e) => (c.collectedErrors.add(e, void 0), D(null, c.collectedErrors.errors))) : D(n, c.collectedErrors.errors);
		} catch (e) {
			return c.collectedErrors.add(e, void 0), D(null, c.collectedErrors.errors);
		}
	}
	function E(e) {
		let n = T(e);
		if ((0, s.isPromise)(n)) throw Error("GraphQL execution failed to complete synchronously.");
		return n;
	}
	function D(e, n) {
		return n.length === 0 ? { data: e } : {
			errors: n,
			data: e
		};
	}
	function O(e, r, i) {
		r || (0, n.devAssert)(!1, "Must provide document."), (0, b.assertValidSchema)(e), i == null || (0, o.isObjectLike)(i) || (0, n.devAssert)(!1, "Variables must be provided as an Object where each property is a variable value. Perhaps look to see if an unparsed JSON string was provided.");
	}
	function k(e) {
		let { schema: n, document: r, rootValue: i, contextValue: a, variableValues: o, operationName: s, fieldResolver: c, typeResolver: l, subscribeFieldResolver: u, options: d } = e, m, g = Object.create(null);
		for (let e of r.definitions) switch (e.kind) {
			case _.Kind.OPERATION_DEFINITION:
				if (s == null) {
					if (m !== void 0) return [new f.GraphQLError("Must provide operation name if query contains multiple operations.")];
					m = e;
				} else e.name?.value === s && (m = e);
				break;
			case _.Kind.FRAGMENT_DEFINITION:
				g[e.name.value] = e;
				break;
			default:
		}
		if (!m) return s == null ? [new f.GraphQLError("Must provide an operation.")] : [new f.GraphQLError(`Unknown operation named "${s}".`)];
		/* c8 ignore next */
		let v = m.variableDefinitions ?? [], y = (0, S.getVariableValues)(n, v, o ?? {}, { maxErrors: d?.maxCoercionErrors ?? 50 });
		return y.errors ? y.errors : {
			schema: n,
			fragments: g,
			rootValue: i,
			contextValue: a,
			operation: m,
			variableValues: y.coerced,
			fieldResolver: c ?? W,
			typeResolver: l ?? U,
			subscribeFieldResolver: u ?? W,
			collectedErrors: new w()
		};
	}
	function A(e, n, r) {
		let i = e.schema.getRootType(n.operation);
		if (i == null) throw new f.GraphQLError(`Schema is not configured to execute ${n.operation} operation.`, { nodes: n });
		let a = (0, x.collectFields)(e.schema, e.fragments, e.variableValues, i, n.selectionSet);
		switch (n.operation) {
			case g.OperationTypeNode.QUERY: return M(e, i, r, void 0, a);
			case g.OperationTypeNode.MUTATION: return j(e, i, r, void 0, a);
			case g.OperationTypeNode.SUBSCRIPTION: return M(e, i, r, void 0, a);
		}
	}
	function j(e, n, r, i, a) {
		return (0, d.promiseReduce)(a.entries(), (a, [o, c]) => {
			let u = (0, l.addPath)(i, o, n.name), d = N(e, n, r, c, u);
			return d === void 0 ? a : (0, s.isPromise)(d) ? d.then((e) => (a[o] = e, a)) : (a[o] = d, a);
		}, Object.create(null));
	}
	function M(e, n, r, i, a) {
		let o = Object.create(null), c = !1;
		try {
			for (let [u, d] of a.entries()) {
				let a = (0, l.addPath)(i, u, n.name), f = N(e, n, r, d, a);
				f !== void 0 && (o[u] = f, (0, s.isPromise)(f) && (c = !0));
			}
		} catch (e) {
			if (c) return (0, u.promiseForObject)(o).finally(() => {
				throw e;
			});
			throw e;
		}
		return c ? (0, u.promiseForObject)(o) : o;
	}
	function N(e, n, r, i, a) {
		let o = G(e.schema, n, i[0]);
		if (!o) return;
		let c = o.type, u = o.resolve ?? e.fieldResolver, d = P(e, o, i, n, a);
		try {
			let n = (0, S.getArgumentValues)(o, i[0], e.variableValues), f = e.contextValue, g = u(r, n, f, d), _;
			return _ = (0, s.isPromise)(g) ? g.then((n) => I(e, c, i, d, a, n)) : I(e, c, i, d, a, g), (0, s.isPromise)(_) ? _.then(void 0, (n) => {
				let r = (0, m.locatedError)(n, i, (0, l.pathToArray)(a));
				return F(r, c, a, e);
			}) : _;
		} catch (n) {
			let r = (0, m.locatedError)(n, i, (0, l.pathToArray)(a));
			return F(r, c, a, e);
		}
	}
	function P(e, n, r, i, a) {
		return {
			fieldName: n.name,
			fieldNodes: r,
			returnType: n.type,
			parentType: i,
			path: a,
			schema: e.schema,
			fragments: e.fragments,
			rootValue: e.rootValue,
			operation: e.operation,
			variableValues: e.variableValues
		};
	}
	function F(e, n, r, i) {
		if ((0, v.isNonNullType)(n)) throw e;
		return i.collectedErrors.add(e, r), null;
	}
	function I(e, n, a, o, s, c) {
		if (c instanceof Error) throw c;
		if ((0, v.isNonNullType)(n)) {
			let r = I(e, n.ofType, a, o, s, c);
			if (r === null) throw Error(`Cannot return null for non-nullable field ${o.parentType.name}.${o.fieldName}.`);
			return r;
		}
		if (c == null) return null;
		if ((0, v.isListType)(n)) return L(e, n, a, o, s, c);
		if ((0, v.isLeafType)(n)) return R(n, c);
		if ((0, v.isAbstractType)(n)) return z(e, n, a, o, s, c);
		if ((0, v.isObjectType)(n)) return V(e, n, a, o, s, c);
		/* c8 ignore next 6 */
		(0, i.invariant)(!1, "Cannot complete value of unexpected output type: " + (0, r.inspect)(n));
	}
	function L(e, n, r, i, o, c) {
		if (!(0, a.isIterableObject)(c)) throw new f.GraphQLError(`Expected Iterable, but did not find one for field "${i.parentType.name}.${i.fieldName}".`);
		let u = n.ofType, d = !1, g = Array.from(c, (n, a) => {
			let c = (0, l.addPath)(o, a, void 0);
			try {
				let a;
				return a = (0, s.isPromise)(n) ? n.then((n) => I(e, u, r, i, c, n)) : I(e, u, r, i, c, n), (0, s.isPromise)(a) ? (d = !0, a.then(void 0, (n) => {
					let i = (0, m.locatedError)(n, r, (0, l.pathToArray)(c));
					return F(i, u, c, e);
				})) : a;
			} catch (n) {
				let i = (0, m.locatedError)(n, r, (0, l.pathToArray)(c));
				return F(i, u, c, e);
			}
		});
		return d ? Promise.all(g) : g;
	}
	function R(e, n) {
		let i = e.serialize(n);
		if (i == null) throw Error(`Expected \`${(0, r.inspect)(e)}.serialize(${(0, r.inspect)(n)})\` to return non-nullable value, returned: ${(0, r.inspect)(i)}`);
		return i;
	}
	function z(e, n, r, i, a, o) {
		let c = n.resolveType ?? e.typeResolver, l = e.contextValue, u = c(o, l, i, n);
		return (0, s.isPromise)(u) ? u.then((s) => V(e, B(s, e, n, r, i, o), r, i, a, o)) : V(e, B(u, e, n, r, i, o), r, i, a, o);
	}
	function B(e, n, i, a, o, s) {
		if (e == null) throw new f.GraphQLError(`Abstract type "${i.name}" must resolve to an Object type at runtime for field "${o.parentType.name}.${o.fieldName}". Either the "${i.name}" type should provide a "resolveType" function or each possible type should provide an "isTypeOf" function.`, a);
		if ((0, v.isObjectType)(e)) throw new f.GraphQLError("Support for returning GraphQLObjectType from resolveType was removed in graphql-js@16.0.0 please return type name instead.");
		if (typeof e != "string") throw new f.GraphQLError(`Abstract type "${i.name}" must resolve to an Object type at runtime for field "${o.parentType.name}.${o.fieldName}" with value ${(0, r.inspect)(s)}, received "${(0, r.inspect)(e)}".`);
		let c = n.schema.getType(e);
		if (c == null) throw new f.GraphQLError(`Abstract type "${i.name}" was resolved to a type "${e}" that does not exist inside the schema.`, { nodes: a });
		if (!(0, v.isObjectType)(c)) throw new f.GraphQLError(`Abstract type "${i.name}" was resolved to a non-object type "${e}".`, { nodes: a });
		if (!n.schema.isSubType(i, c)) throw new f.GraphQLError(`Runtime Object type "${c.name}" is not a possible type for "${i.name}".`, { nodes: a });
		return c;
	}
	function V(e, n, r, i, a, o) {
		let c = C(e, n, r);
		if (n.isTypeOf) {
			let l = n.isTypeOf(o, e.contextValue, i);
			if ((0, s.isPromise)(l)) return l.then((i) => {
				if (!i) throw H(n, o, r);
				return M(e, n, o, a, c);
			});
			if (!l) throw H(n, o, r);
		}
		return M(e, n, o, a, c);
	}
	function H(e, n, i) {
		return new f.GraphQLError(`Expected value of type "${e.name}" but got: ${(0, r.inspect)(n)}.`, { nodes: i });
	}
	var U = function(e, n, r, i) {
		if ((0, o.isObjectLike)(e) && typeof e.__typename == "string") return e.__typename;
		let a = r.schema.getPossibleTypes(i), c = [];
		for (let i = 0; i < a.length; i++) {
			let o = a[i];
			if (o.isTypeOf) {
				let a = o.isTypeOf(e, n, r);
				if ((0, s.isPromise)(a)) c[i] = a;
				else if (a) return c.length && Promise.allSettled(c).catch(() => {}), o.name;
			}
		}
		if (c.length) return Promise.all(c).then((e) => {
			for (let n = 0; n < e.length; n++) if (e[n]) return a[n].name;
		});
	};
	e.defaultTypeResolver = U;
	var W = function(e, n, r, i) {
		if ((0, o.isObjectLike)(e) || typeof e == "function") {
			let a = e[i.fieldName];
			return typeof a == "function" ? e[i.fieldName](n, r, i) : a;
		}
	};
	e.defaultFieldResolver = W;
	function G(e, n, r) {
		let i = r.name.value;
		return i === y.SchemaMetaFieldDef.name && e.getQueryType() === n ? y.SchemaMetaFieldDef : i === y.TypeMetaFieldDef.name && e.getQueryType() === n ? y.TypeMetaFieldDef : i === y.TypeNameMetaFieldDef.name ? y.TypeNameMetaFieldDef : n.getFields()[i];
	}
})), require_graphql$1 = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.graphql = c, e.graphqlSync = l;
	var n = require_devAssert(), r = require_isPromise(), i = require_parser(), a = require_validate$1(), o = require_validate(), s = require_execute();
	function c(e) {
		return new Promise((n) => n(u(e)));
	}
	function l(e) {
		let n = u(e);
		if ((0, r.isPromise)(n)) throw Error("GraphQL execution failed to complete synchronously.");
		return n;
	}
	function u(e) {
		arguments.length < 2 || (0, n.devAssert)(!1, "graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.");
		let { schema: r, source: c, rootValue: l, contextValue: u, variableValues: d, operationName: f, fieldResolver: m, typeResolver: g } = e, _ = (0, a.validateSchema)(r);
		if (_.length > 0) return { errors: _ };
		let v;
		try {
			v = (0, i.parse)(c);
		} catch (e) {
			return { errors: [e] };
		}
		let y = (0, o.validate)(r, v);
		return y.length > 0 ? { errors: y } : (0, s.execute)({
			schema: r,
			document: v,
			rootValue: l,
			contextValue: u,
			variableValues: d,
			operationName: f,
			fieldResolver: m,
			typeResolver: g
		});
	}
})), require_type = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), Object.defineProperty(e, "DEFAULT_DEPRECATION_REASON", {
		enumerable: !0,
		get: function() {
			return i.DEFAULT_DEPRECATION_REASON;
		}
	}), Object.defineProperty(e, "GRAPHQL_MAX_INT", {
		enumerable: !0,
		get: function() {
			return a.GRAPHQL_MAX_INT;
		}
	}), Object.defineProperty(e, "GRAPHQL_MIN_INT", {
		enumerable: !0,
		get: function() {
			return a.GRAPHQL_MIN_INT;
		}
	}), Object.defineProperty(e, "GraphQLBoolean", {
		enumerable: !0,
		get: function() {
			return a.GraphQLBoolean;
		}
	}), Object.defineProperty(e, "GraphQLDeprecatedDirective", {
		enumerable: !0,
		get: function() {
			return i.GraphQLDeprecatedDirective;
		}
	}), Object.defineProperty(e, "GraphQLDirective", {
		enumerable: !0,
		get: function() {
			return i.GraphQLDirective;
		}
	}), Object.defineProperty(e, "GraphQLEnumType", {
		enumerable: !0,
		get: function() {
			return r.GraphQLEnumType;
		}
	}), Object.defineProperty(e, "GraphQLFloat", {
		enumerable: !0,
		get: function() {
			return a.GraphQLFloat;
		}
	}), Object.defineProperty(e, "GraphQLID", {
		enumerable: !0,
		get: function() {
			return a.GraphQLID;
		}
	}), Object.defineProperty(e, "GraphQLIncludeDirective", {
		enumerable: !0,
		get: function() {
			return i.GraphQLIncludeDirective;
		}
	}), Object.defineProperty(e, "GraphQLInputObjectType", {
		enumerable: !0,
		get: function() {
			return r.GraphQLInputObjectType;
		}
	}), Object.defineProperty(e, "GraphQLInt", {
		enumerable: !0,
		get: function() {
			return a.GraphQLInt;
		}
	}), Object.defineProperty(e, "GraphQLInterfaceType", {
		enumerable: !0,
		get: function() {
			return r.GraphQLInterfaceType;
		}
	}), Object.defineProperty(e, "GraphQLList", {
		enumerable: !0,
		get: function() {
			return r.GraphQLList;
		}
	}), Object.defineProperty(e, "GraphQLNonNull", {
		enumerable: !0,
		get: function() {
			return r.GraphQLNonNull;
		}
	}), Object.defineProperty(e, "GraphQLObjectType", {
		enumerable: !0,
		get: function() {
			return r.GraphQLObjectType;
		}
	}), Object.defineProperty(e, "GraphQLOneOfDirective", {
		enumerable: !0,
		get: function() {
			return i.GraphQLOneOfDirective;
		}
	}), Object.defineProperty(e, "GraphQLScalarType", {
		enumerable: !0,
		get: function() {
			return r.GraphQLScalarType;
		}
	}), Object.defineProperty(e, "GraphQLSchema", {
		enumerable: !0,
		get: function() {
			return n.GraphQLSchema;
		}
	}), Object.defineProperty(e, "GraphQLSkipDirective", {
		enumerable: !0,
		get: function() {
			return i.GraphQLSkipDirective;
		}
	}), Object.defineProperty(e, "GraphQLSpecifiedByDirective", {
		enumerable: !0,
		get: function() {
			return i.GraphQLSpecifiedByDirective;
		}
	}), Object.defineProperty(e, "GraphQLString", {
		enumerable: !0,
		get: function() {
			return a.GraphQLString;
		}
	}), Object.defineProperty(e, "GraphQLUnionType", {
		enumerable: !0,
		get: function() {
			return r.GraphQLUnionType;
		}
	}), Object.defineProperty(e, "SchemaMetaFieldDef", {
		enumerable: !0,
		get: function() {
			return o.SchemaMetaFieldDef;
		}
	}), Object.defineProperty(e, "TypeKind", {
		enumerable: !0,
		get: function() {
			return o.TypeKind;
		}
	}), Object.defineProperty(e, "TypeMetaFieldDef", {
		enumerable: !0,
		get: function() {
			return o.TypeMetaFieldDef;
		}
	}), Object.defineProperty(e, "TypeNameMetaFieldDef", {
		enumerable: !0,
		get: function() {
			return o.TypeNameMetaFieldDef;
		}
	}), Object.defineProperty(e, "__Directive", {
		enumerable: !0,
		get: function() {
			return o.__Directive;
		}
	}), Object.defineProperty(e, "__DirectiveLocation", {
		enumerable: !0,
		get: function() {
			return o.__DirectiveLocation;
		}
	}), Object.defineProperty(e, "__EnumValue", {
		enumerable: !0,
		get: function() {
			return o.__EnumValue;
		}
	}), Object.defineProperty(e, "__Field", {
		enumerable: !0,
		get: function() {
			return o.__Field;
		}
	}), Object.defineProperty(e, "__InputValue", {
		enumerable: !0,
		get: function() {
			return o.__InputValue;
		}
	}), Object.defineProperty(e, "__Schema", {
		enumerable: !0,
		get: function() {
			return o.__Schema;
		}
	}), Object.defineProperty(e, "__Type", {
		enumerable: !0,
		get: function() {
			return o.__Type;
		}
	}), Object.defineProperty(e, "__TypeKind", {
		enumerable: !0,
		get: function() {
			return o.__TypeKind;
		}
	}), Object.defineProperty(e, "assertAbstractType", {
		enumerable: !0,
		get: function() {
			return r.assertAbstractType;
		}
	}), Object.defineProperty(e, "assertCompositeType", {
		enumerable: !0,
		get: function() {
			return r.assertCompositeType;
		}
	}), Object.defineProperty(e, "assertDirective", {
		enumerable: !0,
		get: function() {
			return i.assertDirective;
		}
	}), Object.defineProperty(e, "assertEnumType", {
		enumerable: !0,
		get: function() {
			return r.assertEnumType;
		}
	}), Object.defineProperty(e, "assertEnumValueName", {
		enumerable: !0,
		get: function() {
			return c.assertEnumValueName;
		}
	}), Object.defineProperty(e, "assertInputObjectType", {
		enumerable: !0,
		get: function() {
			return r.assertInputObjectType;
		}
	}), Object.defineProperty(e, "assertInputType", {
		enumerable: !0,
		get: function() {
			return r.assertInputType;
		}
	}), Object.defineProperty(e, "assertInterfaceType", {
		enumerable: !0,
		get: function() {
			return r.assertInterfaceType;
		}
	}), Object.defineProperty(e, "assertLeafType", {
		enumerable: !0,
		get: function() {
			return r.assertLeafType;
		}
	}), Object.defineProperty(e, "assertListType", {
		enumerable: !0,
		get: function() {
			return r.assertListType;
		}
	}), Object.defineProperty(e, "assertName", {
		enumerable: !0,
		get: function() {
			return c.assertName;
		}
	}), Object.defineProperty(e, "assertNamedType", {
		enumerable: !0,
		get: function() {
			return r.assertNamedType;
		}
	}), Object.defineProperty(e, "assertNonNullType", {
		enumerable: !0,
		get: function() {
			return r.assertNonNullType;
		}
	}), Object.defineProperty(e, "assertNullableType", {
		enumerable: !0,
		get: function() {
			return r.assertNullableType;
		}
	}), Object.defineProperty(e, "assertObjectType", {
		enumerable: !0,
		get: function() {
			return r.assertObjectType;
		}
	}), Object.defineProperty(e, "assertOutputType", {
		enumerable: !0,
		get: function() {
			return r.assertOutputType;
		}
	}), Object.defineProperty(e, "assertScalarType", {
		enumerable: !0,
		get: function() {
			return r.assertScalarType;
		}
	}), Object.defineProperty(e, "assertSchema", {
		enumerable: !0,
		get: function() {
			return n.assertSchema;
		}
	}), Object.defineProperty(e, "assertType", {
		enumerable: !0,
		get: function() {
			return r.assertType;
		}
	}), Object.defineProperty(e, "assertUnionType", {
		enumerable: !0,
		get: function() {
			return r.assertUnionType;
		}
	}), Object.defineProperty(e, "assertValidSchema", {
		enumerable: !0,
		get: function() {
			return s.assertValidSchema;
		}
	}), Object.defineProperty(e, "assertWrappingType", {
		enumerable: !0,
		get: function() {
			return r.assertWrappingType;
		}
	}), Object.defineProperty(e, "getNamedType", {
		enumerable: !0,
		get: function() {
			return r.getNamedType;
		}
	}), Object.defineProperty(e, "getNullableType", {
		enumerable: !0,
		get: function() {
			return r.getNullableType;
		}
	}), Object.defineProperty(e, "introspectionTypes", {
		enumerable: !0,
		get: function() {
			return o.introspectionTypes;
		}
	}), Object.defineProperty(e, "isAbstractType", {
		enumerable: !0,
		get: function() {
			return r.isAbstractType;
		}
	}), Object.defineProperty(e, "isCompositeType", {
		enumerable: !0,
		get: function() {
			return r.isCompositeType;
		}
	}), Object.defineProperty(e, "isDirective", {
		enumerable: !0,
		get: function() {
			return i.isDirective;
		}
	}), Object.defineProperty(e, "isEnumType", {
		enumerable: !0,
		get: function() {
			return r.isEnumType;
		}
	}), Object.defineProperty(e, "isInputObjectType", {
		enumerable: !0,
		get: function() {
			return r.isInputObjectType;
		}
	}), Object.defineProperty(e, "isInputType", {
		enumerable: !0,
		get: function() {
			return r.isInputType;
		}
	}), Object.defineProperty(e, "isInterfaceType", {
		enumerable: !0,
		get: function() {
			return r.isInterfaceType;
		}
	}), Object.defineProperty(e, "isIntrospectionType", {
		enumerable: !0,
		get: function() {
			return o.isIntrospectionType;
		}
	}), Object.defineProperty(e, "isLeafType", {
		enumerable: !0,
		get: function() {
			return r.isLeafType;
		}
	}), Object.defineProperty(e, "isListType", {
		enumerable: !0,
		get: function() {
			return r.isListType;
		}
	}), Object.defineProperty(e, "isNamedType", {
		enumerable: !0,
		get: function() {
			return r.isNamedType;
		}
	}), Object.defineProperty(e, "isNonNullType", {
		enumerable: !0,
		get: function() {
			return r.isNonNullType;
		}
	}), Object.defineProperty(e, "isNullableType", {
		enumerable: !0,
		get: function() {
			return r.isNullableType;
		}
	}), Object.defineProperty(e, "isObjectType", {
		enumerable: !0,
		get: function() {
			return r.isObjectType;
		}
	}), Object.defineProperty(e, "isOutputType", {
		enumerable: !0,
		get: function() {
			return r.isOutputType;
		}
	}), Object.defineProperty(e, "isRequiredArgument", {
		enumerable: !0,
		get: function() {
			return r.isRequiredArgument;
		}
	}), Object.defineProperty(e, "isRequiredInputField", {
		enumerable: !0,
		get: function() {
			return r.isRequiredInputField;
		}
	}), Object.defineProperty(e, "isScalarType", {
		enumerable: !0,
		get: function() {
			return r.isScalarType;
		}
	}), Object.defineProperty(e, "isSchema", {
		enumerable: !0,
		get: function() {
			return n.isSchema;
		}
	}), Object.defineProperty(e, "isSpecifiedDirective", {
		enumerable: !0,
		get: function() {
			return i.isSpecifiedDirective;
		}
	}), Object.defineProperty(e, "isSpecifiedScalarType", {
		enumerable: !0,
		get: function() {
			return a.isSpecifiedScalarType;
		}
	}), Object.defineProperty(e, "isType", {
		enumerable: !0,
		get: function() {
			return r.isType;
		}
	}), Object.defineProperty(e, "isUnionType", {
		enumerable: !0,
		get: function() {
			return r.isUnionType;
		}
	}), Object.defineProperty(e, "isWrappingType", {
		enumerable: !0,
		get: function() {
			return r.isWrappingType;
		}
	}), Object.defineProperty(e, "resolveObjMapThunk", {
		enumerable: !0,
		get: function() {
			return r.resolveObjMapThunk;
		}
	}), Object.defineProperty(e, "resolveReadonlyArrayThunk", {
		enumerable: !0,
		get: function() {
			return r.resolveReadonlyArrayThunk;
		}
	}), Object.defineProperty(e, "specifiedDirectives", {
		enumerable: !0,
		get: function() {
			return i.specifiedDirectives;
		}
	}), Object.defineProperty(e, "specifiedScalarTypes", {
		enumerable: !0,
		get: function() {
			return a.specifiedScalarTypes;
		}
	}), Object.defineProperty(e, "validateSchema", {
		enumerable: !0,
		get: function() {
			return s.validateSchema;
		}
	});
	var n = require_schema(), r = require_definition(), i = require_directives(), a = require_scalars(), o = require_introspection(), s = require_validate$1(), c = require_assertName();
})), require_language = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), Object.defineProperty(e, "BREAK", {
		enumerable: !0,
		get: function() {
			return u.BREAK;
		}
	}), Object.defineProperty(e, "DirectiveLocation", {
		enumerable: !0,
		get: function() {
			return m.DirectiveLocation;
		}
	}), Object.defineProperty(e, "Kind", {
		enumerable: !0,
		get: function() {
			return a.Kind;
		}
	}), Object.defineProperty(e, "Lexer", {
		enumerable: !0,
		get: function() {
			return s.Lexer;
		}
	}), Object.defineProperty(e, "Location", {
		enumerable: !0,
		get: function() {
			return d.Location;
		}
	}), Object.defineProperty(e, "OperationTypeNode", {
		enumerable: !0,
		get: function() {
			return d.OperationTypeNode;
		}
	}), Object.defineProperty(e, "Source", {
		enumerable: !0,
		get: function() {
			return n.Source;
		}
	}), Object.defineProperty(e, "Token", {
		enumerable: !0,
		get: function() {
			return d.Token;
		}
	}), Object.defineProperty(e, "TokenKind", {
		enumerable: !0,
		get: function() {
			return o.TokenKind;
		}
	}), Object.defineProperty(e, "getEnterLeaveForKind", {
		enumerable: !0,
		get: function() {
			return u.getEnterLeaveForKind;
		}
	}), Object.defineProperty(e, "getLocation", {
		enumerable: !0,
		get: function() {
			return r.getLocation;
		}
	}), Object.defineProperty(e, "getVisitFn", {
		enumerable: !0,
		get: function() {
			return u.getVisitFn;
		}
	}), Object.defineProperty(e, "isConstValueNode", {
		enumerable: !0,
		get: function() {
			return f.isConstValueNode;
		}
	}), Object.defineProperty(e, "isDefinitionNode", {
		enumerable: !0,
		get: function() {
			return f.isDefinitionNode;
		}
	}), Object.defineProperty(e, "isExecutableDefinitionNode", {
		enumerable: !0,
		get: function() {
			return f.isExecutableDefinitionNode;
		}
	}), Object.defineProperty(e, "isSchemaCoordinateNode", {
		enumerable: !0,
		get: function() {
			return f.isSchemaCoordinateNode;
		}
	}), Object.defineProperty(e, "isSelectionNode", {
		enumerable: !0,
		get: function() {
			return f.isSelectionNode;
		}
	}), Object.defineProperty(e, "isTypeDefinitionNode", {
		enumerable: !0,
		get: function() {
			return f.isTypeDefinitionNode;
		}
	}), Object.defineProperty(e, "isTypeExtensionNode", {
		enumerable: !0,
		get: function() {
			return f.isTypeExtensionNode;
		}
	}), Object.defineProperty(e, "isTypeNode", {
		enumerable: !0,
		get: function() {
			return f.isTypeNode;
		}
	}), Object.defineProperty(e, "isTypeSystemDefinitionNode", {
		enumerable: !0,
		get: function() {
			return f.isTypeSystemDefinitionNode;
		}
	}), Object.defineProperty(e, "isTypeSystemExtensionNode", {
		enumerable: !0,
		get: function() {
			return f.isTypeSystemExtensionNode;
		}
	}), Object.defineProperty(e, "isValueNode", {
		enumerable: !0,
		get: function() {
			return f.isValueNode;
		}
	}), Object.defineProperty(e, "parse", {
		enumerable: !0,
		get: function() {
			return c.parse;
		}
	}), Object.defineProperty(e, "parseConstValue", {
		enumerable: !0,
		get: function() {
			return c.parseConstValue;
		}
	}), Object.defineProperty(e, "parseSchemaCoordinate", {
		enumerable: !0,
		get: function() {
			return c.parseSchemaCoordinate;
		}
	}), Object.defineProperty(e, "parseType", {
		enumerable: !0,
		get: function() {
			return c.parseType;
		}
	}), Object.defineProperty(e, "parseValue", {
		enumerable: !0,
		get: function() {
			return c.parseValue;
		}
	}), Object.defineProperty(e, "print", {
		enumerable: !0,
		get: function() {
			return l.print;
		}
	}), Object.defineProperty(e, "printLocation", {
		enumerable: !0,
		get: function() {
			return i.printLocation;
		}
	}), Object.defineProperty(e, "printSourceLocation", {
		enumerable: !0,
		get: function() {
			return i.printSourceLocation;
		}
	}), Object.defineProperty(e, "visit", {
		enumerable: !0,
		get: function() {
			return u.visit;
		}
	}), Object.defineProperty(e, "visitInParallel", {
		enumerable: !0,
		get: function() {
			return u.visitInParallel;
		}
	});
	var n = require_source(), r = require_location(), i = require_printLocation(), a = require_kinds(), o = require_tokenKind(), s = require_lexer(), c = require_parser(), l = require_printer(), u = require_visitor(), d = require_ast(), f = require_predicates(), m = require_directiveLocation();
})), require_isAsyncIterable = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.isAsyncIterable = n;
	function n(e) {
		return typeof e?.[Symbol.asyncIterator] == "function";
	}
})), require_mapAsyncIterator = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.mapAsyncIterator = n;
	function n(e, n) {
		let r = e[Symbol.asyncIterator]();
		async function i(e) {
			if (e.done) return e;
			try {
				return {
					value: await n(e.value),
					done: !1
				};
			} catch (e) {
				/* c8 ignore start */
				if (typeof r.return == "function") try {
					await r.return();
				} catch {}
				throw e;
			}
		}
		return {
			async next() {
				return i(await r.next());
			},
			async return() {
				return typeof r.return == "function" ? i(await r.return()) : {
					value: void 0,
					done: !0
				};
			},
			async throw(e) {
				if (typeof r.throw == "function") return i(await r.throw(e));
				throw e;
			},
			[Symbol.asyncIterator]() {
				return this;
			}
		};
	}
})), require_subscribe = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.createSourceEventStream = g, e.subscribe = f;
	var n = require_devAssert(), r = require_inspect(), i = require_isAsyncIterable(), a = require_Path(), o = require_GraphQLError(), s = require_locatedError(), c = require_collectFields(), l = require_execute(), u = require_mapAsyncIterator(), d = require_values();
	async function f(e) {
		arguments.length < 2 || (0, n.devAssert)(!1, "graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.");
		let r = await g(e);
		return (0, i.isAsyncIterable)(r) ? (0, u.mapAsyncIterator)(r, (n) => (0, l.execute)({
			...e,
			rootValue: n
		})) : r;
	}
	function m(e) {
		let n = e[0];
		return n && "document" in n ? n : {
			schema: n,
			document: e[1],
			rootValue: e[2],
			contextValue: e[3],
			variableValues: e[4],
			operationName: e[5],
			subscribeFieldResolver: e[6]
		};
	}
	async function g(...e) {
		let n = m(e), { schema: a, document: s, variableValues: c } = n;
		(0, l.assertValidExecutionArguments)(a, s, c);
		let u = (0, l.buildExecutionContext)(n);
		if (!("schema" in u)) return { errors: u };
		try {
			let e = await _(u);
			if (!(0, i.isAsyncIterable)(e)) throw Error(`Subscription field must return Async Iterable. Received: ${(0, r.inspect)(e)}.`);
			return e;
		} catch (e) {
			if (e instanceof o.GraphQLError) return { errors: [e] };
			throw e;
		}
	}
	async function _(e) {
		let { schema: n, fragments: r, operation: i, variableValues: u, rootValue: f } = e, m = n.getSubscriptionType();
		if (m == null) throw new o.GraphQLError("Schema is not configured to execute subscription operation.", { nodes: i });
		let [g, _] = [...(0, c.collectFields)(n, r, u, m, i.selectionSet).entries()][0], v = (0, l.getFieldDef)(n, m, _[0]);
		if (!v) {
			let e = _[0].name.value;
			throw new o.GraphQLError(`The subscription field "${e}" is not defined.`, { nodes: _ });
		}
		let y = (0, a.addPath)(void 0, g, m.name), b = (0, l.buildResolveInfo)(e, v, _, m, y);
		try {
			let n = (0, d.getArgumentValues)(v, _[0], u), r = e.contextValue, i = await (v.subscribe ?? e.subscribeFieldResolver)(f, n, r, b);
			if (i instanceof Error) throw i;
			return i;
		} catch (e) {
			throw (0, s.locatedError)(e, _, (0, a.pathToArray)(y));
		}
	}
})), require_execution = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), Object.defineProperty(e, "createSourceEventStream", {
		enumerable: !0,
		get: function() {
			return i.createSourceEventStream;
		}
	}), Object.defineProperty(e, "defaultFieldResolver", {
		enumerable: !0,
		get: function() {
			return r.defaultFieldResolver;
		}
	}), Object.defineProperty(e, "defaultTypeResolver", {
		enumerable: !0,
		get: function() {
			return r.defaultTypeResolver;
		}
	}), Object.defineProperty(e, "execute", {
		enumerable: !0,
		get: function() {
			return r.execute;
		}
	}), Object.defineProperty(e, "executeSync", {
		enumerable: !0,
		get: function() {
			return r.executeSync;
		}
	}), Object.defineProperty(e, "getArgumentValues", {
		enumerable: !0,
		get: function() {
			return a.getArgumentValues;
		}
	}), Object.defineProperty(e, "getDirectiveValues", {
		enumerable: !0,
		get: function() {
			return a.getDirectiveValues;
		}
	}), Object.defineProperty(e, "getVariableValues", {
		enumerable: !0,
		get: function() {
			return a.getVariableValues;
		}
	}), Object.defineProperty(e, "responsePathAsArray", {
		enumerable: !0,
		get: function() {
			return n.pathToArray;
		}
	}), Object.defineProperty(e, "subscribe", {
		enumerable: !0,
		get: function() {
			return i.subscribe;
		}
	});
	var n = require_Path(), r = require_execute(), i = require_subscribe(), a = require_values();
})), require_NoDeprecatedCustomRule = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.NoDeprecatedCustomRule = a;
	var n = require_invariant(), r = require_GraphQLError(), i = require_definition();
	function a(e) {
		return {
			Field(i) {
				let a = e.getFieldDef(), o = a?.deprecationReason;
				if (a && o != null) {
					let s = e.getParentType();
					s ?? (0, n.invariant)(!1), e.reportError(new r.GraphQLError(`The field ${s.name}.${a.name} is deprecated. ${o}`, { nodes: i }));
				}
			},
			Argument(i) {
				let a = e.getArgument(), o = a?.deprecationReason;
				if (a && o != null) {
					let s = e.getDirective();
					if (s != null) e.reportError(new r.GraphQLError(`Directive "@${s.name}" argument "${a.name}" is deprecated. ${o}`, { nodes: i }));
					else {
						let s = e.getParentType(), c = e.getFieldDef();
						s != null && c != null || (0, n.invariant)(!1), e.reportError(new r.GraphQLError(`Field "${s.name}.${c.name}" argument "${a.name}" is deprecated. ${o}`, { nodes: i }));
					}
				}
			},
			ObjectField(n) {
				let a = (0, i.getNamedType)(e.getParentInputType());
				if ((0, i.isInputObjectType)(a)) {
					let i = a.getFields()[n.name.value], o = i?.deprecationReason;
					o != null && e.reportError(new r.GraphQLError(`The input field ${a.name}.${i.name} is deprecated. ${o}`, { nodes: n }));
				}
			},
			EnumValue(a) {
				let o = e.getEnumValue(), s = o?.deprecationReason;
				if (o && s != null) {
					let c = (0, i.getNamedType)(e.getInputType());
					c ?? (0, n.invariant)(!1), e.reportError(new r.GraphQLError(`The enum value "${c.name}.${o.name}" is deprecated. ${s}`, { nodes: a }));
				}
			}
		};
	}
})), require_NoSchemaIntrospectionCustomRule = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.NoSchemaIntrospectionCustomRule = a;
	var n = require_GraphQLError(), r = require_definition(), i = require_introspection();
	function a(e) {
		return { Field(a) {
			let o = (0, r.getNamedType)(e.getType());
			o && (0, i.isIntrospectionType)(o) && e.reportError(new n.GraphQLError(`GraphQL introspection has been disabled, but the requested query contained the field "${a.name.value}".`, { nodes: a }));
		} };
	}
})), require_validation = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), Object.defineProperty(e, "ExecutableDefinitionsRule", {
		enumerable: !0,
		get: function() {
			return a.ExecutableDefinitionsRule;
		}
	}), Object.defineProperty(e, "FieldsOnCorrectTypeRule", {
		enumerable: !0,
		get: function() {
			return o.FieldsOnCorrectTypeRule;
		}
	}), Object.defineProperty(e, "FragmentsOnCompositeTypesRule", {
		enumerable: !0,
		get: function() {
			return s.FragmentsOnCompositeTypesRule;
		}
	}), Object.defineProperty(e, "KnownArgumentNamesRule", {
		enumerable: !0,
		get: function() {
			return c.KnownArgumentNamesRule;
		}
	}), Object.defineProperty(e, "KnownDirectivesRule", {
		enumerable: !0,
		get: function() {
			return l.KnownDirectivesRule;
		}
	}), Object.defineProperty(e, "KnownFragmentNamesRule", {
		enumerable: !0,
		get: function() {
			return u.KnownFragmentNamesRule;
		}
	}), Object.defineProperty(e, "KnownTypeNamesRule", {
		enumerable: !0,
		get: function() {
			return d.KnownTypeNamesRule;
		}
	}), Object.defineProperty(e, "LoneAnonymousOperationRule", {
		enumerable: !0,
		get: function() {
			return f.LoneAnonymousOperationRule;
		}
	}), Object.defineProperty(e, "LoneSchemaDefinitionRule", {
		enumerable: !0,
		get: function() {
			return P.LoneSchemaDefinitionRule;
		}
	}), Object.defineProperty(e, "MaxIntrospectionDepthRule", {
		enumerable: !0,
		get: function() {
			return N.MaxIntrospectionDepthRule;
		}
	}), Object.defineProperty(e, "NoDeprecatedCustomRule", {
		enumerable: !0,
		get: function() {
			return H.NoDeprecatedCustomRule;
		}
	}), Object.defineProperty(e, "NoFragmentCyclesRule", {
		enumerable: !0,
		get: function() {
			return m.NoFragmentCyclesRule;
		}
	}), Object.defineProperty(e, "NoSchemaIntrospectionCustomRule", {
		enumerable: !0,
		get: function() {
			return U.NoSchemaIntrospectionCustomRule;
		}
	}), Object.defineProperty(e, "NoUndefinedVariablesRule", {
		enumerable: !0,
		get: function() {
			return g.NoUndefinedVariablesRule;
		}
	}), Object.defineProperty(e, "NoUnusedFragmentsRule", {
		enumerable: !0,
		get: function() {
			return _.NoUnusedFragmentsRule;
		}
	}), Object.defineProperty(e, "NoUnusedVariablesRule", {
		enumerable: !0,
		get: function() {
			return v.NoUnusedVariablesRule;
		}
	}), Object.defineProperty(e, "OverlappingFieldsCanBeMergedRule", {
		enumerable: !0,
		get: function() {
			return y.OverlappingFieldsCanBeMergedRule;
		}
	}), Object.defineProperty(e, "PossibleFragmentSpreadsRule", {
		enumerable: !0,
		get: function() {
			return b.PossibleFragmentSpreadsRule;
		}
	}), Object.defineProperty(e, "PossibleTypeExtensionsRule", {
		enumerable: !0,
		get: function() {
			return V.PossibleTypeExtensionsRule;
		}
	}), Object.defineProperty(e, "ProvidedRequiredArgumentsRule", {
		enumerable: !0,
		get: function() {
			return x.ProvidedRequiredArgumentsRule;
		}
	}), Object.defineProperty(e, "ScalarLeafsRule", {
		enumerable: !0,
		get: function() {
			return S.ScalarLeafsRule;
		}
	}), Object.defineProperty(e, "SingleFieldSubscriptionsRule", {
		enumerable: !0,
		get: function() {
			return C.SingleFieldSubscriptionsRule;
		}
	}), Object.defineProperty(e, "UniqueArgumentDefinitionNamesRule", {
		enumerable: !0,
		get: function() {
			return z.UniqueArgumentDefinitionNamesRule;
		}
	}), Object.defineProperty(e, "UniqueArgumentNamesRule", {
		enumerable: !0,
		get: function() {
			return w.UniqueArgumentNamesRule;
		}
	}), Object.defineProperty(e, "UniqueDirectiveNamesRule", {
		enumerable: !0,
		get: function() {
			return B.UniqueDirectiveNamesRule;
		}
	}), Object.defineProperty(e, "UniqueDirectivesPerLocationRule", {
		enumerable: !0,
		get: function() {
			return T.UniqueDirectivesPerLocationRule;
		}
	}), Object.defineProperty(e, "UniqueEnumValueNamesRule", {
		enumerable: !0,
		get: function() {
			return L.UniqueEnumValueNamesRule;
		}
	}), Object.defineProperty(e, "UniqueFieldDefinitionNamesRule", {
		enumerable: !0,
		get: function() {
			return R.UniqueFieldDefinitionNamesRule;
		}
	}), Object.defineProperty(e, "UniqueFragmentNamesRule", {
		enumerable: !0,
		get: function() {
			return E.UniqueFragmentNamesRule;
		}
	}), Object.defineProperty(e, "UniqueInputFieldNamesRule", {
		enumerable: !0,
		get: function() {
			return D.UniqueInputFieldNamesRule;
		}
	}), Object.defineProperty(e, "UniqueOperationNamesRule", {
		enumerable: !0,
		get: function() {
			return O.UniqueOperationNamesRule;
		}
	}), Object.defineProperty(e, "UniqueOperationTypesRule", {
		enumerable: !0,
		get: function() {
			return F.UniqueOperationTypesRule;
		}
	}), Object.defineProperty(e, "UniqueTypeNamesRule", {
		enumerable: !0,
		get: function() {
			return I.UniqueTypeNamesRule;
		}
	}), Object.defineProperty(e, "UniqueVariableNamesRule", {
		enumerable: !0,
		get: function() {
			return k.UniqueVariableNamesRule;
		}
	}), Object.defineProperty(e, "ValidationContext", {
		enumerable: !0,
		get: function() {
			return r.ValidationContext;
		}
	}), Object.defineProperty(e, "ValuesOfCorrectTypeRule", {
		enumerable: !0,
		get: function() {
			return A.ValuesOfCorrectTypeRule;
		}
	}), Object.defineProperty(e, "VariablesAreInputTypesRule", {
		enumerable: !0,
		get: function() {
			return j.VariablesAreInputTypesRule;
		}
	}), Object.defineProperty(e, "VariablesInAllowedPositionRule", {
		enumerable: !0,
		get: function() {
			return M.VariablesInAllowedPositionRule;
		}
	}), Object.defineProperty(e, "recommendedRules", {
		enumerable: !0,
		get: function() {
			return i.recommendedRules;
		}
	}), Object.defineProperty(e, "specifiedRules", {
		enumerable: !0,
		get: function() {
			return i.specifiedRules;
		}
	}), Object.defineProperty(e, "validate", {
		enumerable: !0,
		get: function() {
			return n.validate;
		}
	});
	var n = require_validate(), r = require_ValidationContext(), i = require_specifiedRules(), a = require_ExecutableDefinitionsRule(), o = require_FieldsOnCorrectTypeRule(), s = require_FragmentsOnCompositeTypesRule(), c = require_KnownArgumentNamesRule(), l = require_KnownDirectivesRule(), u = require_KnownFragmentNamesRule(), d = require_KnownTypeNamesRule(), f = require_LoneAnonymousOperationRule(), m = require_NoFragmentCyclesRule(), g = require_NoUndefinedVariablesRule(), _ = require_NoUnusedFragmentsRule(), v = require_NoUnusedVariablesRule(), y = require_OverlappingFieldsCanBeMergedRule(), b = require_PossibleFragmentSpreadsRule(), x = require_ProvidedRequiredArgumentsRule(), S = require_ScalarLeafsRule(), C = require_SingleFieldSubscriptionsRule(), w = require_UniqueArgumentNamesRule(), T = require_UniqueDirectivesPerLocationRule(), E = require_UniqueFragmentNamesRule(), D = require_UniqueInputFieldNamesRule(), O = require_UniqueOperationNamesRule(), k = require_UniqueVariableNamesRule(), A = require_ValuesOfCorrectTypeRule(), j = require_VariablesAreInputTypesRule(), M = require_VariablesInAllowedPositionRule(), N = require_MaxIntrospectionDepthRule(), P = require_LoneSchemaDefinitionRule(), F = require_UniqueOperationTypesRule(), I = require_UniqueTypeNamesRule(), L = require_UniqueEnumValueNamesRule(), R = require_UniqueFieldDefinitionNamesRule(), z = require_UniqueArgumentDefinitionNamesRule(), B = require_UniqueDirectiveNamesRule(), V = require_PossibleTypeExtensionsRule(), H = require_NoDeprecatedCustomRule(), U = require_NoSchemaIntrospectionCustomRule();
})), require_error = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), Object.defineProperty(e, "GraphQLError", {
		enumerable: !0,
		get: function() {
			return n.GraphQLError;
		}
	}), Object.defineProperty(e, "formatError", {
		enumerable: !0,
		get: function() {
			return n.formatError;
		}
	}), Object.defineProperty(e, "locatedError", {
		enumerable: !0,
		get: function() {
			return i.locatedError;
		}
	}), Object.defineProperty(e, "printError", {
		enumerable: !0,
		get: function() {
			return n.printError;
		}
	}), Object.defineProperty(e, "syntaxError", {
		enumerable: !0,
		get: function() {
			return r.syntaxError;
		}
	});
	var n = require_GraphQLError(), r = require_syntaxError(), i = require_locatedError();
})), require_getIntrospectionQuery = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.getIntrospectionQuery = n;
	function n(e) {
		let n = {
			descriptions: !0,
			specifiedByUrl: !1,
			directiveIsRepeatable: !1,
			schemaDescription: !1,
			inputValueDeprecation: !1,
			experimentalDirectiveDeprecation: !1,
			oneOf: !1,
			typeDepth: 9,
			...e
		}, r = n.descriptions ? "description" : "", i = n.specifiedByUrl ? "specifiedByURL" : "", a = n.directiveIsRepeatable ? "isRepeatable" : "", o = n.schemaDescription ? r : "";
		function s(e) {
			return n.inputValueDeprecation ? e : "";
		}
		function c(e) {
			return n.experimentalDirectiveDeprecation ? e : "";
		}
		let l = n.oneOf ? "isOneOf" : "";
		function u(e, n) {
			if (e <= 0) return "";
			if (e > 100) throw Error("Please set typeDepth to a reasonable value between 0 and 100; the default is 9.");
			return `
${n}ofType {
${n}  name
${n}  kind${u(e - 1, n + "  ")}
${n}}`;
		}
		return `
    query IntrospectionQuery {
      __schema {
        ${o}
        queryType { name kind }
        mutationType { name kind }
        subscriptionType { name kind }
        types {
          ...FullType
        }
        directives${c("(includeDeprecated: true)")} {
          name
          ${r}
          ${a}
          ${c("isDeprecated")}
          ${c("deprecationReason")}
          locations
          args${s("(includeDeprecated: true)")} {
            ...InputValue
          }
        }
      }
    }

    fragment FullType on __Type {
      kind
      name
      ${r}
      ${i}
      ${l}
      fields(includeDeprecated: true) {
        name
        ${r}
        args${s("(includeDeprecated: true)")} {
          ...InputValue
        }
        type {
          ...TypeRef
        }
        isDeprecated
        deprecationReason
      }
      inputFields${s("(includeDeprecated: true)")} {
        ...InputValue
      }
      interfaces {
        ...TypeRef
      }
      enumValues(includeDeprecated: true) {
        name
        ${r}
        isDeprecated
        deprecationReason
      }
      possibleTypes {
        ...TypeRef
      }
    }

    fragment InputValue on __InputValue {
      name
      ${r}
      type { ...TypeRef }
      defaultValue
      ${s("isDeprecated")}
      ${s("deprecationReason")}
    }

    fragment TypeRef on __Type {
      kind
      name${u(n.typeDepth, "      ")}
    }
  `;
	}
})), require_getOperationAST = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.getOperationAST = r;
	var n = require_kinds();
	function r(e, r) {
		let i = null;
		for (let a of e.definitions) if (a.kind === n.Kind.OPERATION_DEFINITION) {
			if (r == null) {
				if (i) return null;
				i = a;
			} else if (a.name?.value === r) return a;
		}
		return i;
	}
})), require_getOperationRootType = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.getOperationRootType = r;
	var n = require_GraphQLError();
	function r(e, r) {
		if (r.operation === "query") {
			let i = e.getQueryType();
			if (!i) throw new n.GraphQLError("Schema does not define the required query root type.", { nodes: r });
			return i;
		}
		if (r.operation === "mutation") {
			let i = e.getMutationType();
			if (!i) throw new n.GraphQLError("Schema is not configured for mutations.", { nodes: r });
			return i;
		}
		if (r.operation === "subscription") {
			let i = e.getSubscriptionType();
			if (!i) throw new n.GraphQLError("Schema is not configured for subscriptions.", { nodes: r });
			return i;
		}
		throw new n.GraphQLError("Can only have query, mutation and subscription operations.", { nodes: r });
	}
})), require_introspectionFromSchema = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.introspectionFromSchema = o;
	var n = require_invariant(), r = require_parser(), i = require_execute(), a = require_getIntrospectionQuery();
	function o(e, o) {
		let s = {
			specifiedByUrl: !0,
			directiveIsRepeatable: !0,
			schemaDescription: !0,
			inputValueDeprecation: !0,
			experimentalDirectiveDeprecation: !0,
			oneOf: !0,
			...o
		}, c = (0, r.parse)((0, a.getIntrospectionQuery)(s)), l = (0, i.executeSync)({
			schema: e,
			document: c
		});
		return !l.errors && l.data || (0, n.invariant)(!1), l.data;
	}
})), require_buildClientSchema = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.buildClientSchema = m;
	var n = require_devAssert(), r = require_inspect(), i = require_isObjectLike(), a = require_keyValMap(), o = require_parser(), s = require_definition(), c = require_directives(), l = require_introspection(), u = require_scalars(), d = require_schema(), f = require_valueFromAST();
	function m(e, m) {
		(0, i.isObjectLike)(e) && (0, i.isObjectLike)(e.__schema) || (0, n.devAssert)(!1, `Invalid or incomplete introspection result. Ensure that you are passing "data" property of introspection response and no "errors" was returned alongside: ${(0, r.inspect)(e)}.`);
		let g = e.__schema, _ = (0, a.keyValMap)(g.types, (e) => e.name, (e) => E(e));
		for (let e of [...u.specifiedScalarTypes, ...l.introspectionTypes]) _[e.name] && (_[e.name] = e);
		let v = g.queryType ? w(g.queryType) : null, y = g.mutationType ? w(g.mutationType) : null, b = g.subscriptionType ? w(g.subscriptionType) : null, x = g.directives ? g.directives.map(R) : [];
		return new d.GraphQLSchema({
			description: g.description,
			query: v,
			mutation: y,
			subscription: b,
			types: Object.values(_),
			directives: x,
			assumeValid: m?.assumeValid
		});
		function S(e) {
			if (e.kind === l.TypeKind.LIST) {
				let n = e.ofType;
				if (!n) throw Error("Decorated type deeper than introspection query.");
				return new s.GraphQLList(S(n));
			}
			if (e.kind === l.TypeKind.NON_NULL) {
				let n = e.ofType;
				if (!n) throw Error("Decorated type deeper than introspection query.");
				let r = S(n);
				return new s.GraphQLNonNull((0, s.assertNullableType)(r));
			}
			return C(e);
		}
		function C(e) {
			let n = e.name;
			if (!n) throw Error(`Unknown type reference: ${(0, r.inspect)(e)}.`);
			let i = _[n];
			if (!i) throw Error(`Invalid or incomplete schema, unknown type: ${n}. Ensure that a full introspection query is used in order to build a client schema.`);
			return i;
		}
		function w(e) {
			return (0, s.assertObjectType)(C(e));
		}
		function T(e) {
			return (0, s.assertInterfaceType)(C(e));
		}
		function E(e) {
			if (e != null && e.name != null && e.kind != null) switch (e.kind) {
				case l.TypeKind.SCALAR: return D(e);
				case l.TypeKind.OBJECT: return k(e);
				case l.TypeKind.INTERFACE: return A(e);
				case l.TypeKind.UNION: return j(e);
				case l.TypeKind.ENUM: return M(e);
				case l.TypeKind.INPUT_OBJECT: return N(e);
			}
			let n = (0, r.inspect)(e);
			throw Error(`Invalid or incomplete introspection result. Ensure that a full introspection query is used in order to build a client schema: ${n}.`);
		}
		function D(e) {
			return new s.GraphQLScalarType({
				name: e.name,
				description: e.description,
				specifiedByURL: e.specifiedByURL
			});
		}
		function O(e) {
			if (e.interfaces === null && e.kind === l.TypeKind.INTERFACE) return [];
			if (!e.interfaces) {
				let n = (0, r.inspect)(e);
				throw Error(`Introspection result missing interfaces: ${n}.`);
			}
			return e.interfaces.map(T);
		}
		function k(e) {
			return new s.GraphQLObjectType({
				name: e.name,
				description: e.description,
				interfaces: () => O(e),
				fields: () => P(e)
			});
		}
		function A(e) {
			return new s.GraphQLInterfaceType({
				name: e.name,
				description: e.description,
				interfaces: () => O(e),
				fields: () => P(e)
			});
		}
		function j(e) {
			if (!e.possibleTypes) {
				let n = (0, r.inspect)(e);
				throw Error(`Introspection result missing possibleTypes: ${n}.`);
			}
			return new s.GraphQLUnionType({
				name: e.name,
				description: e.description,
				types: () => e.possibleTypes.map(w)
			});
		}
		function M(e) {
			if (!e.enumValues) {
				let n = (0, r.inspect)(e);
				throw Error(`Introspection result missing enumValues: ${n}.`);
			}
			return new s.GraphQLEnumType({
				name: e.name,
				description: e.description,
				values: (0, a.keyValMap)(e.enumValues, (e) => e.name, (e) => ({
					description: e.description,
					deprecationReason: e.deprecationReason
				}))
			});
		}
		function N(e) {
			if (!e.inputFields) {
				let n = (0, r.inspect)(e);
				throw Error(`Introspection result missing inputFields: ${n}.`);
			}
			return new s.GraphQLInputObjectType({
				name: e.name,
				description: e.description,
				fields: () => I(e.inputFields),
				isOneOf: e.isOneOf
			});
		}
		function P(e) {
			if (!e.fields) throw Error(`Introspection result missing fields: ${(0, r.inspect)(e)}.`);
			return (0, a.keyValMap)(e.fields, (e) => e.name, F);
		}
		function F(e) {
			let n = S(e.type);
			if (!(0, s.isOutputType)(n)) {
				let e = (0, r.inspect)(n);
				throw Error(`Introspection must provide output type for fields, but received: ${e}.`);
			}
			if (!e.args) {
				let n = (0, r.inspect)(e);
				throw Error(`Introspection result missing field args: ${n}.`);
			}
			return {
				description: e.description,
				deprecationReason: e.deprecationReason,
				type: n,
				args: I(e.args)
			};
		}
		function I(e) {
			return (0, a.keyValMap)(e, (e) => e.name, L);
		}
		function L(e) {
			let n = S(e.type);
			if (!(0, s.isInputType)(n)) {
				let e = (0, r.inspect)(n);
				throw Error(`Introspection must provide input type for arguments, but received: ${e}.`);
			}
			let i = e.defaultValue == null ? void 0 : (0, f.valueFromAST)((0, o.parseValue)(e.defaultValue), n);
			return {
				description: e.description,
				type: n,
				defaultValue: i,
				deprecationReason: e.deprecationReason
			};
		}
		function R(e) {
			if (!e.args) {
				let n = (0, r.inspect)(e);
				throw Error(`Introspection result missing directive args: ${n}.`);
			}
			if (!e.locations) {
				let n = (0, r.inspect)(e);
				throw Error(`Introspection result missing directive locations: ${n}.`);
			}
			return new c.GraphQLDirective({
				name: e.name,
				description: e.description,
				isRepeatable: e.isRepeatable,
				deprecationReason: e.deprecationReason,
				locations: e.locations.slice(),
				args: I(e.args)
			});
		}
	}
})), require_extendSchema = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.extendSchema = y, e.extendSchemaImpl = b;
	var n = require_devAssert(), r = require_inspect(), i = require_invariant(), a = require_keyMap(), o = require_mapValue(), s = require_kinds(), c = require_predicates(), l = require_definition(), u = require_directives(), d = require_introspection(), f = require_scalars(), m = require_schema(), g = require_validate(), _ = require_values(), v = require_valueFromAST();
	function y(e, r, i) {
		(0, m.assertSchema)(e), r != null && r.kind === s.Kind.DOCUMENT || (0, n.devAssert)(!1, "Must provide valid Document AST."), i?.assumeValid !== !0 && i?.assumeValidSDL !== !0 && (0, g.assertValidSDLExtension)(r, e);
		let a = e.toConfig(), o = b(a, r, i);
		return a === o ? e : new m.GraphQLSchema(o);
	}
	function b(e, n, a) {
		let m = [], g = Object.create(null), _ = Object.create(null), y = [], b, T = [];
		for (let e of n.definitions) if (e.kind === s.Kind.SCHEMA_DEFINITION) b = e;
		else if (e.kind === s.Kind.SCHEMA_EXTENSION) T.push(e);
		else if ((0, c.isTypeDefinitionNode)(e)) m.push(e);
		else if ((0, c.isTypeExtensionNode)(e)) {
			let n = e.name.value, r = g[n];
			g[n] = r ? r.concat([e]) : [e];
		} else if (e.kind === s.Kind.DIRECTIVE_DEFINITION) y.push(e);
		else if (e.kind === s.Kind.DIRECTIVE_EXTENSION) {
			let n = e.name.value, r = _[n];
			_[n] = r ? r.concat([e]) : [e];
		}
		if (Object.keys(g).length === 0 && m.length === 0 && Object.keys(_).length === 0 && y.length === 0 && T.length === 0 && b == null) return e;
		let E = Object.create(null);
		for (let n of e.types) E[n.name] = N(n);
		for (let e of m) {
			let n = e.name.value;
			E[n] = x[n] ?? Sz(e);
		}
		let D = Object.create(null);
		for (let n of e.directives) D[n.name] = U(n);
		let O = {
			query: e.query && j(e.query),
			mutation: e.mutation && j(e.mutation),
			subscription: e.subscription && j(e.subscription),
			...b && H([b]),
			...H(T)
		}, k = Object.values(D);
		return {
			description: b?.description?.value,
			...O,
			types: Object.values(E),
			directives: [...k.map(M), ...y.map(xz)],
			extensions: Object.create(null),
			astNode: b ?? e.astNode,
			extensionASTNodes: e.extensionASTNodes.concat(T),
			assumeValid: a?.assumeValid ?? !1
		};
		function A(e) {
			return (0, l.isListType)(e) ? new l.GraphQLList(A(e.ofType)) : (0, l.isNonNullType)(e) ? new l.GraphQLNonNull(A(e.ofType)) : j(e);
		}
		function j(e) {
			return E[e.name];
		}
		function M(e) {
			let n = e.toConfig();
			return new u.GraphQLDirective({
				...n,
				args: (0, o.mapValue)(n.args, V)
			});
		}
		function N(e) {
			if ((0, d.isIntrospectionType)(e) || (0, f.isSpecifiedScalarType)(e)) return e;
			if ((0, l.isScalarType)(e)) return I(e);
			if ((0, l.isObjectType)(e)) return L(e);
			if ((0, l.isInterfaceType)(e)) return R(e);
			if ((0, l.isUnionType)(e)) return z(e);
			if ((0, l.isEnumType)(e)) return F(e);
			if ((0, l.isInputObjectType)(e)) return P(e);
			/* c8 ignore next 3 */
			(0, i.invariant)(!1, "Unexpected type: " + (0, r.inspect)(e));
		}
		function P(e) {
			let n = e.toConfig(), r = g[n.name] ?? [];
			return new l.GraphQLInputObjectType({
				...n,
				fields: () => ({
					...(0, o.mapValue)(n.fields, (e) => ({
						...e,
						type: A(e.type)
					})),
					...J(r)
				}),
				extensionASTNodes: n.extensionASTNodes.concat(r)
			});
		}
		function F(e) {
			let n = e.toConfig(), r = g[e.name] ?? [];
			return new l.GraphQLEnumType({
				...n,
				values: {
					...n.values,
					...Y(r)
				},
				extensionASTNodes: n.extensionASTNodes.concat(r)
			});
		}
		function I(e) {
			let n = e.toConfig(), r = g[n.name] ?? [], i = n.specifiedByURL;
			for (let e of r) i = C(e) ?? i;
			return new l.GraphQLScalarType({
				...n,
				specifiedByURL: i,
				extensionASTNodes: n.extensionASTNodes.concat(r)
			});
		}
		function L(e) {
			let n = e.toConfig(), r = g[n.name] ?? [];
			return new l.GraphQLObjectType({
				...n,
				interfaces: () => [...e.getInterfaces().map(j), ...X(r)],
				fields: () => ({
					...(0, o.mapValue)(n.fields, B),
					...K(r)
				}),
				extensionASTNodes: n.extensionASTNodes.concat(r)
			});
		}
		function R(e) {
			let n = e.toConfig(), r = g[n.name] ?? [];
			return new l.GraphQLInterfaceType({
				...n,
				interfaces: () => [...e.getInterfaces().map(j), ...X(r)],
				fields: () => ({
					...(0, o.mapValue)(n.fields, B),
					...K(r)
				}),
				extensionASTNodes: n.extensionASTNodes.concat(r)
			});
		}
		function z(e) {
			let n = e.toConfig(), r = g[n.name] ?? [];
			return new l.GraphQLUnionType({
				...n,
				types: () => [...e.getTypes().map(j), ...Z(r)],
				extensionASTNodes: n.extensionASTNodes.concat(r)
			});
		}
		function B(e) {
			return {
				...e,
				type: A(e.type),
				args: e.args && (0, o.mapValue)(e.args, V)
			};
		}
		function V(e) {
			return {
				...e,
				type: A(e.type)
			};
		}
		function H(e) {
			let n = {};
			for (let r of e) {
				let e = r.operationTypes ?? [];
				for (let r of e) n[r.operation] = W(r.type);
			}
			return n;
		}
		function U(e) {
			let n = e.toConfig(), r = _[n.name] ?? [], i = n.deprecationReason ?? r.map((e) => S(e)).find((e) => e != null);
			return new u.GraphQLDirective({
				...n,
				deprecationReason: i,
				extensionASTNodes: n.extensionASTNodes.concat(r)
			});
		}
		function W(e) {
			let n = e.name.value, r = x[n] ?? E[n];
			if (r === void 0) throw Error(`Unknown type: "${n}".`);
			return r;
		}
		function G(e) {
			return e.kind === s.Kind.LIST_TYPE ? new l.GraphQLList(G(e.type)) : e.kind === s.Kind.NON_NULL_TYPE ? new l.GraphQLNonNull(G(e.type)) : W(e);
		}
		function xz(e) {
			let n = _[e.name.value] ?? [], r = S(e) ?? n.map((e) => S(e)).find((e) => e != null);
			return new u.GraphQLDirective({
				name: e.name.value,
				description: e.description?.value,
				locations: e.locations.map(({ value: e }) => e),
				isRepeatable: e.repeatable,
				args: q(e.arguments),
				deprecationReason: r,
				astNode: e,
				extensionASTNodes: n
			});
		}
		function K(e) {
			let n = Object.create(null);
			for (let r of e) {
				let e = r.fields ?? [];
				for (let r of e) n[r.name.value] = {
					type: G(r.type),
					description: r.description?.value,
					args: q(r.arguments),
					deprecationReason: S(r),
					astNode: r
				};
			}
			return n;
		}
		function q(e) {
			let n = e ?? [], r = Object.create(null);
			for (let e of n) {
				let n = G(e.type);
				r[e.name.value] = {
					type: n,
					description: e.description?.value,
					defaultValue: (0, v.valueFromAST)(e.defaultValue, n),
					deprecationReason: S(e),
					astNode: e
				};
			}
			return r;
		}
		function J(e) {
			let n = Object.create(null);
			for (let r of e) {
				let e = r.fields ?? [];
				for (let r of e) {
					let e = G(r.type);
					n[r.name.value] = {
						type: e,
						description: r.description?.value,
						defaultValue: (0, v.valueFromAST)(r.defaultValue, e),
						deprecationReason: S(r),
						astNode: r
					};
				}
			}
			return n;
		}
		function Y(e) {
			let n = Object.create(null);
			for (let r of e) {
				let e = r.values ?? [];
				for (let r of e) n[r.name.value] = {
					description: r.description?.value,
					deprecationReason: S(r),
					astNode: r
				};
			}
			return n;
		}
		function X(e) {
			return e.flatMap((e) => e.interfaces?.map(W) ?? []);
		}
		function Z(e) {
			return e.flatMap((e) => e.types?.map(W) ?? []);
		}
		function Sz(e) {
			let n = e.name.value, r = g[n] ?? [];
			switch (e.kind) {
				case s.Kind.OBJECT_TYPE_DEFINITION: {
					let i = [e, ...r];
					return new l.GraphQLObjectType({
						name: n,
						description: e.description?.value,
						interfaces: () => X(i),
						fields: () => K(i),
						astNode: e,
						extensionASTNodes: r
					});
				}
				case s.Kind.INTERFACE_TYPE_DEFINITION: {
					let i = [e, ...r];
					return new l.GraphQLInterfaceType({
						name: n,
						description: e.description?.value,
						interfaces: () => X(i),
						fields: () => K(i),
						astNode: e,
						extensionASTNodes: r
					});
				}
				case s.Kind.ENUM_TYPE_DEFINITION: {
					let i = [e, ...r];
					return new l.GraphQLEnumType({
						name: n,
						description: e.description?.value,
						values: Y(i),
						astNode: e,
						extensionASTNodes: r
					});
				}
				case s.Kind.UNION_TYPE_DEFINITION: {
					let i = [e, ...r];
					return new l.GraphQLUnionType({
						name: n,
						description: e.description?.value,
						types: () => Z(i),
						astNode: e,
						extensionASTNodes: r
					});
				}
				case s.Kind.SCALAR_TYPE_DEFINITION: return new l.GraphQLScalarType({
					name: n,
					description: e.description?.value,
					specifiedByURL: C(e),
					astNode: e,
					extensionASTNodes: r
				});
				case s.Kind.INPUT_OBJECT_TYPE_DEFINITION: {
					let i = [e, ...r];
					return new l.GraphQLInputObjectType({
						name: n,
						description: e.description?.value,
						fields: () => J(i),
						astNode: e,
						extensionASTNodes: r,
						isOneOf: w(e)
					});
				}
			}
		}
	}
	var x = (0, a.keyMap)([...f.specifiedScalarTypes, ...d.introspectionTypes], (e) => e.name);
	function S(e) {
		return (0, _.getDirectiveValues)(u.GraphQLDeprecatedDirective, e)?.reason;
	}
	function C(e) {
		return (0, _.getDirectiveValues)(u.GraphQLSpecifiedByDirective, e)?.url;
	}
	function w(e) {
		return !!(0, _.getDirectiveValues)(u.GraphQLOneOfDirective, e);
	}
})), require_buildASTSchema = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.buildASTSchema = l, e.buildSchema = u;
	var n = require_devAssert(), r = require_kinds(), i = require_parser(), a = require_directives(), o = require_schema(), s = require_validate(), c = require_extendSchema();
	function l(e, i) {
		e != null && e.kind === r.Kind.DOCUMENT || (0, n.devAssert)(!1, "Must provide valid Document AST."), i?.assumeValid !== !0 && i?.assumeValidSDL !== !0 && (0, s.assertValidSDL)(e);
		let l = {
			description: void 0,
			types: [],
			directives: [],
			extensions: Object.create(null),
			extensionASTNodes: [],
			assumeValid: !1
		}, u = (0, c.extendSchemaImpl)(l, e, i);
		if (u.astNode == null) for (let e of u.types) switch (e.name) {
			case "Query":
				u.query = e;
				break;
			case "Mutation":
				u.mutation = e;
				break;
			case "Subscription":
				u.subscription = e;
				break;
		}
		let d = [...u.directives, ...a.specifiedDirectives.filter((e) => u.directives.every((n) => n.name !== e.name))];
		return new o.GraphQLSchema({
			...u,
			directives: d
		});
	}
	function u(e, n) {
		let r = (0, i.parse)(e, {
			noLocation: n?.noLocation,
			allowLegacyFragmentVariables: n?.allowLegacyFragmentVariables,
			experimentalDirectivesOnDirectiveDefinitions: n?.experimentalDirectivesOnDirectiveDefinitions
		});
		return l(r, {
			assumeValidSDL: n?.assumeValidSDL,
			assumeValid: n?.assumeValid
		});
	}
})), require_lexicographicSortSchema = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.lexicographicSortSchema = u;
	var n = require_inspect(), r = require_invariant(), i = require_keyValMap(), a = require_naturalCompare(), o = require_definition(), s = require_directives(), c = require_introspection(), l = require_schema();
	function u(e) {
		let a = e.toConfig(), u = (0, i.keyValMap)(f(a.types), (e) => e.name, w);
		return new l.GraphQLSchema({
			...a,
			types: Object.values(u),
			directives: f(a.directives).map(y),
			query: v(a.query),
			mutation: v(a.mutation),
			subscription: v(a.subscription)
		});
		function g(e) {
			return (0, o.isListType)(e) ? new o.GraphQLList(g(e.ofType)) : (0, o.isNonNullType)(e) ? new o.GraphQLNonNull(g(e.ofType)) : _(e);
		}
		function _(e) {
			return u[e.name];
		}
		function v(e) {
			return e && _(e);
		}
		function y(e) {
			let n = e.toConfig();
			return new s.GraphQLDirective({
				...n,
				locations: m(n.locations, (e) => e),
				args: b(n.args)
			});
		}
		function b(e) {
			return d(e, (e) => ({
				...e,
				type: g(e.type)
			}));
		}
		function x(e) {
			return d(e, (e) => ({
				...e,
				type: g(e.type),
				args: e.args && b(e.args)
			}));
		}
		function S(e) {
			return d(e, (e) => ({
				...e,
				type: g(e.type)
			}));
		}
		function C(e) {
			return f(e).map(_);
		}
		function w(e) {
			if ((0, o.isScalarType)(e) || (0, c.isIntrospectionType)(e)) return e;
			if ((0, o.isObjectType)(e)) {
				let n = e.toConfig();
				return new o.GraphQLObjectType({
					...n,
					interfaces: () => C(n.interfaces),
					fields: () => x(n.fields)
				});
			}
			if ((0, o.isInterfaceType)(e)) {
				let n = e.toConfig();
				return new o.GraphQLInterfaceType({
					...n,
					interfaces: () => C(n.interfaces),
					fields: () => x(n.fields)
				});
			}
			if ((0, o.isUnionType)(e)) {
				let n = e.toConfig();
				return new o.GraphQLUnionType({
					...n,
					types: () => C(n.types)
				});
			}
			if ((0, o.isEnumType)(e)) {
				let n = e.toConfig();
				return new o.GraphQLEnumType({
					...n,
					values: d(n.values, (e) => e)
				});
			}
			if ((0, o.isInputObjectType)(e)) {
				let n = e.toConfig();
				return new o.GraphQLInputObjectType({
					...n,
					fields: () => S(n.fields)
				});
			}
			/* c8 ignore next 3 */
			(0, r.invariant)(!1, "Unexpected type: " + (0, n.inspect)(e));
		}
	}
	function d(e, n) {
		let r = Object.create(null);
		for (let i of Object.keys(e).sort(a.naturalCompare)) r[i] = n(e[i]);
		return r;
	}
	function f(e) {
		return m(e, (e) => e.name);
	}
	function m(e, n) {
		return e.slice().sort((e, r) => {
			let i = n(e), o = n(r);
			return (0, a.naturalCompare)(i, o);
		});
	}
})), require_printSchema = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.printIntrospectionSchema = m, e.printSchema = f, e.printType = b;
	var n = require_inspect(), r = require_invariant(), i = require_blockString(), a = require_kinds(), o = require_printer(), s = require_definition(), c = require_directives(), l = require_introspection(), u = require_scalars(), d = require_astFromValue();
	function f(e) {
		return _(e, (e) => !(0, c.isSpecifiedDirective)(e), g);
	}
	function m(e) {
		return _(e, c.isSpecifiedDirective, l.isIntrospectionType);
	}
	function g(e) {
		return !(0, u.isSpecifiedScalarType)(e) && !(0, l.isIntrospectionType)(e);
	}
	function _(e, n, r) {
		let i = e.getDirectives().filter(n), a = Object.values(e.getTypeMap()).filter(r);
		return [
			v(e),
			...i.map((e) => M(e)),
			...a.map((e) => b(e))
		].filter(Boolean).join("\n\n");
	}
	function v(e) {
		if (e.description == null && y(e)) return;
		let n = [], r = e.getQueryType();
		r && n.push(`  query: ${r.name}`);
		let i = e.getMutationType();
		i && n.push(`  mutation: ${i.name}`);
		let a = e.getSubscriptionType();
		return a && n.push(`  subscription: ${a.name}`), F(e) + `schema {\n${n.join("\n")}\n}`;
	}
	function y(e) {
		let n = e.getQueryType();
		if (n && n.name !== "Query") return !1;
		let r = e.getMutationType();
		if (r && r.name !== "Mutation") return !1;
		let i = e.getSubscriptionType();
		return !(i && i.name !== "Subscription");
	}
	function b(e) {
		if ((0, s.isScalarType)(e)) return x(e);
		if ((0, s.isObjectType)(e)) return C(e);
		if ((0, s.isInterfaceType)(e)) return w(e);
		if ((0, s.isUnionType)(e)) return T(e);
		if ((0, s.isEnumType)(e)) return E(e);
		if ((0, s.isInputObjectType)(e)) return D(e);
		/* c8 ignore next 3 */
		(0, r.invariant)(!1, "Unexpected type: " + (0, n.inspect)(e));
	}
	function x(e) {
		return F(e) + `scalar ${e.name}` + P(e);
	}
	function S(e) {
		let n = e.getInterfaces();
		return n.length ? " implements " + n.map((e) => e.name).join(" & ") : "";
	}
	function C(e) {
		return F(e) + `type ${e.name}` + S(e) + O(e);
	}
	function w(e) {
		return F(e) + `interface ${e.name}` + S(e) + O(e);
	}
	function T(e) {
		let n = e.getTypes(), r = n.length ? " = " + n.join(" | ") : "";
		return F(e) + "union " + e.name + r;
	}
	function E(e) {
		let n = e.getValues().map((e, n) => F(e, "  ", !n) + "  " + e.name + N(e.deprecationReason));
		return F(e) + `enum ${e.name}` + k(n);
	}
	function D(e) {
		let n = Object.values(e.getFields()).map((e, n) => F(e, "  ", !n) + "  " + j(e));
		return F(e) + `input ${e.name}` + (e.isOneOf ? " @oneOf" : "") + k(n);
	}
	function O(e) {
		let n = Object.values(e.getFields()).map((e, n) => F(e, "  ", !n) + "  " + e.name + A(e.args, "  ") + ": " + String(e.type) + N(e.deprecationReason));
		return k(n);
	}
	function k(e) {
		return e.length === 0 ? "" : " {\n" + e.join("\n") + "\n}";
	}
	function A(e, n = "") {
		return e.length === 0 ? "" : e.every((e) => !e.description) ? "(" + e.map(j).join(", ") + ")" : "(\n" + e.map((e, r) => F(e, "  " + n, !r) + "  " + n + j(e)).join("\n") + "\n" + n + ")";
	}
	function j(e) {
		let n = (0, d.astFromValue)(e.defaultValue, e.type), r = e.name + ": " + String(e.type);
		return n && (r += ` = ${(0, o.print)(n)}`), r + N(e.deprecationReason);
	}
	function M(e) {
		return F(e) + "directive @" + e.name + A(e.args) + N(e.deprecationReason) + (e.isRepeatable ? " repeatable" : "") + " on " + e.locations.join(" | ");
	}
	function N(e) {
		return e == null ? "" : e === c.DEFAULT_DEPRECATION_REASON ? " @deprecated" : ` @deprecated(reason: ${(0, o.print)({
			kind: a.Kind.STRING,
			value: e
		})})`;
	}
	function P(e) {
		return e.specifiedByURL == null ? "" : ` @specifiedBy(url: ${(0, o.print)({
			kind: a.Kind.STRING,
			value: e.specifiedByURL
		})})`;
	}
	function F(e, n = "", r = !0) {
		let { description: s } = e;
		if (s == null) return "";
		let c = (0, o.print)({
			kind: a.Kind.STRING,
			value: s,
			block: (0, i.isPrintableAsBlockString)(s)
		});
		return (n && !r ? "\n" + n : n) + c.replace(/\n/g, "\n" + n) + "\n";
	}
})), require_concatAST = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.concatAST = r;
	var n = require_kinds();
	function r(e) {
		let r = [];
		for (let n of e) r.push(...n.definitions);
		return {
			kind: n.Kind.DOCUMENT,
			definitions: r
		};
	}
})), require_separateOperations = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.separateOperations = i;
	var n = require_kinds(), r = require_visitor();
	function i(e) {
		let r = [], i = Object.create(null);
		for (let a of e.definitions) switch (a.kind) {
			case n.Kind.OPERATION_DEFINITION:
				r.push(a);
				break;
			case n.Kind.FRAGMENT_DEFINITION:
				i[a.name.value] = o(a.selectionSet);
				break;
			default:
		}
		let s = Object.create(null);
		for (let c of r) {
			let r = /* @__PURE__ */ new Set();
			for (let e of o(c.selectionSet)) a(r, i, e);
			let l = c.name ? c.name.value : "";
			s[l] = {
				kind: n.Kind.DOCUMENT,
				definitions: e.definitions.filter((e) => e === c || e.kind === n.Kind.FRAGMENT_DEFINITION && r.has(e.name.value))
			};
		}
		return s;
	}
	function a(e, n, r) {
		if (!e.has(r)) {
			e.add(r);
			let i = n[r];
			if (i !== void 0) for (let r of i) a(e, n, r);
		}
	}
	function o(e) {
		let n = [];
		return (0, r.visit)(e, { FragmentSpread(e) {
			n.push(e.name.value);
		} }), n;
	}
})), require_stripIgnoredCharacters = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.stripIgnoredCharacters = o;
	var n = require_blockString(), r = require_lexer(), i = require_source(), a = require_tokenKind();
	function o(e) {
		let o = (0, i.isSource)(e) ? e : new i.Source(e), s = o.body, c = new r.Lexer(o), l = "", u = !1;
		for (; c.advance().kind !== a.TokenKind.EOF;) {
			let e = c.token, i = e.kind, o = !(0, r.isPunctuatorTokenKind)(e.kind);
			u && (o || e.kind === a.TokenKind.SPREAD) && (l += " ");
			let d = s.slice(e.start, e.end);
			i === a.TokenKind.BLOCK_STRING ? l += (0, n.printBlockString)(e.value, { minimize: !0 }) : l += d, u = o;
		}
		return l;
	}
})), require_assertValidName = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.assertValidName = a, e.isValidNameError = o;
	var n = require_devAssert(), r = require_GraphQLError(), i = require_assertName();
	/* c8 ignore start */
	function a(e) {
		let n = o(e);
		if (n) throw n;
		return e;
	}
	function o(e) {
		if (typeof e == "string" || (0, n.devAssert)(!1, "Expected name to be a string."), e.startsWith("__")) return new r.GraphQLError(`Name "${e}" must not begin with "__", which is reserved by GraphQL introspection.`);
		try {
			(0, i.assertName)(e);
		} catch (e) {
			return e;
		}
	}
})), require_findBreakingChanges = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.findBreakingChanges = f, e.findDangerousChanges = m;
	var n = require_inspect(), r = require_invariant(), i = require_keyMap(), a = require_printer(), o = require_definition(), s = require_scalars(), c = require_astFromValue(), l = require_sortValueNode(), u;
	(function(e) {
		e.TYPE_REMOVED = "TYPE_REMOVED", e.TYPE_CHANGED_KIND = "TYPE_CHANGED_KIND", e.TYPE_REMOVED_FROM_UNION = "TYPE_REMOVED_FROM_UNION", e.VALUE_REMOVED_FROM_ENUM = "VALUE_REMOVED_FROM_ENUM", e.REQUIRED_INPUT_FIELD_ADDED = "REQUIRED_INPUT_FIELD_ADDED", e.IMPLEMENTED_INTERFACE_REMOVED = "IMPLEMENTED_INTERFACE_REMOVED", e.FIELD_REMOVED = "FIELD_REMOVED", e.FIELD_CHANGED_KIND = "FIELD_CHANGED_KIND", e.REQUIRED_ARG_ADDED = "REQUIRED_ARG_ADDED", e.ARG_REMOVED = "ARG_REMOVED", e.ARG_CHANGED_KIND = "ARG_CHANGED_KIND", e.DIRECTIVE_REMOVED = "DIRECTIVE_REMOVED", e.DIRECTIVE_ARG_REMOVED = "DIRECTIVE_ARG_REMOVED", e.REQUIRED_DIRECTIVE_ARG_ADDED = "REQUIRED_DIRECTIVE_ARG_ADDED", e.DIRECTIVE_REPEATABLE_REMOVED = "DIRECTIVE_REPEATABLE_REMOVED", e.DIRECTIVE_LOCATION_REMOVED = "DIRECTIVE_LOCATION_REMOVED";
	})(u || (e.BreakingChangeType = u = {}));
	var d;
	(function(e) {
		e.VALUE_ADDED_TO_ENUM = "VALUE_ADDED_TO_ENUM", e.TYPE_ADDED_TO_UNION = "TYPE_ADDED_TO_UNION", e.OPTIONAL_INPUT_FIELD_ADDED = "OPTIONAL_INPUT_FIELD_ADDED", e.OPTIONAL_ARG_ADDED = "OPTIONAL_ARG_ADDED", e.IMPLEMENTED_INTERFACE_ADDED = "IMPLEMENTED_INTERFACE_ADDED", e.ARG_DEFAULT_VALUE_CHANGE = "ARG_DEFAULT_VALUE_CHANGE";
	})(d || (e.DangerousChangeType = d = {}));
	function f(e, n) {
		return g(e, n).filter((e) => e.type in u);
	}
	function m(e, n) {
		return g(e, n).filter((e) => e.type in d);
	}
	function g(e, n) {
		return [...v(e, n), ..._(e, n)];
	}
	function _(e, n) {
		let r = [], i = k(e.getDirectives(), n.getDirectives());
		for (let e of i.removed) r.push({
			type: u.DIRECTIVE_REMOVED,
			description: `${e.name} was removed.`
		});
		for (let [e, n] of i.persisted) {
			let i = k(e.args, n.args);
			for (let n of i.added) (0, o.isRequiredArgument)(n) && r.push({
				type: u.REQUIRED_DIRECTIVE_ARG_ADDED,
				description: `A required arg ${n.name} on directive ${e.name} was added.`
			});
			for (let n of i.removed) r.push({
				type: u.DIRECTIVE_ARG_REMOVED,
				description: `${n.name} was removed from ${e.name}.`
			});
			e.isRepeatable && !n.isRepeatable && r.push({
				type: u.DIRECTIVE_REPEATABLE_REMOVED,
				description: `Repeatable flag was removed from ${e.name}.`
			});
			for (let i of e.locations) n.locations.includes(i) || r.push({
				type: u.DIRECTIVE_LOCATION_REMOVED,
				description: `${i} was removed from ${e.name}.`
			});
		}
		return r;
	}
	function v(e, n) {
		let r = [], i = k(Object.values(e.getTypeMap()), Object.values(n.getTypeMap()));
		for (let e of i.removed) r.push({
			type: u.TYPE_REMOVED,
			description: (0, s.isSpecifiedScalarType)(e) ? `Standard scalar ${e.name} was removed because it is not referenced anymore.` : `${e.name} was removed.`
		});
		for (let [e, n] of i.persisted) (0, o.isEnumType)(e) && (0, o.isEnumType)(n) ? r.push(...x(e, n)) : (0, o.isUnionType)(e) && (0, o.isUnionType)(n) ? r.push(...b(e, n)) : (0, o.isInputObjectType)(e) && (0, o.isInputObjectType)(n) ? r.push(...y(e, n)) : (0, o.isObjectType)(e) && (0, o.isObjectType)(n) || (0, o.isInterfaceType)(e) && (0, o.isInterfaceType)(n) ? r.push(...C(e, n), ...S(e, n)) : e.constructor !== n.constructor && r.push({
			type: u.TYPE_CHANGED_KIND,
			description: `${e.name} changed from ${D(e)} to ${D(n)}.`
		});
		return r;
	}
	function y(e, n) {
		let r = [], i = k(Object.values(e.getFields()), Object.values(n.getFields()));
		for (let n of i.added) (0, o.isRequiredInputField)(n) ? r.push({
			type: u.REQUIRED_INPUT_FIELD_ADDED,
			description: `A required field ${n.name} on input type ${e.name} was added.`
		}) : r.push({
			type: d.OPTIONAL_INPUT_FIELD_ADDED,
			description: `An optional field ${n.name} on input type ${e.name} was added.`
		});
		for (let n of i.removed) r.push({
			type: u.FIELD_REMOVED,
			description: `${e.name}.${n.name} was removed.`
		});
		for (let [n, a] of i.persisted) E(n.type, a.type) || r.push({
			type: u.FIELD_CHANGED_KIND,
			description: `${e.name}.${n.name} changed type from ${String(n.type)} to ${String(a.type)}.`
		});
		return r;
	}
	function b(e, n) {
		let r = [], i = k(e.getTypes(), n.getTypes());
		for (let n of i.added) r.push({
			type: d.TYPE_ADDED_TO_UNION,
			description: `${n.name} was added to union type ${e.name}.`
		});
		for (let n of i.removed) r.push({
			type: u.TYPE_REMOVED_FROM_UNION,
			description: `${n.name} was removed from union type ${e.name}.`
		});
		return r;
	}
	function x(e, n) {
		let r = [], i = k(e.getValues(), n.getValues());
		for (let n of i.added) r.push({
			type: d.VALUE_ADDED_TO_ENUM,
			description: `${n.name} was added to enum type ${e.name}.`
		});
		for (let n of i.removed) r.push({
			type: u.VALUE_REMOVED_FROM_ENUM,
			description: `${n.name} was removed from enum type ${e.name}.`
		});
		return r;
	}
	function S(e, n) {
		let r = [], i = k(e.getInterfaces(), n.getInterfaces());
		for (let n of i.added) r.push({
			type: d.IMPLEMENTED_INTERFACE_ADDED,
			description: `${n.name} added to interfaces implemented by ${e.name}.`
		});
		for (let n of i.removed) r.push({
			type: u.IMPLEMENTED_INTERFACE_REMOVED,
			description: `${e.name} no longer implements interface ${n.name}.`
		});
		return r;
	}
	function C(e, n) {
		let r = [], i = k(Object.values(e.getFields()), Object.values(n.getFields()));
		for (let n of i.removed) r.push({
			type: u.FIELD_REMOVED,
			description: `${e.name}.${n.name} was removed.`
		});
		for (let [n, a] of i.persisted) r.push(...w(e, n, a)), T(n.type, a.type) || r.push({
			type: u.FIELD_CHANGED_KIND,
			description: `${e.name}.${n.name} changed type from ${String(n.type)} to ${String(a.type)}.`
		});
		return r;
	}
	function w(e, n, r) {
		let i = [], a = k(n.args, r.args);
		for (let r of a.removed) i.push({
			type: u.ARG_REMOVED,
			description: `${e.name}.${n.name} arg ${r.name} was removed.`
		});
		for (let [r, o] of a.persisted) if (!E(r.type, o.type)) i.push({
			type: u.ARG_CHANGED_KIND,
			description: `${e.name}.${n.name} arg ${r.name} has changed type from ${String(r.type)} to ${String(o.type)}.`
		});
		else if (r.defaultValue !== void 0) if (o.defaultValue === void 0) i.push({
			type: d.ARG_DEFAULT_VALUE_CHANGE,
			description: `${e.name}.${n.name} arg ${r.name} defaultValue was removed.`
		});
		else {
			let a = O(r.defaultValue, r.type), s = O(o.defaultValue, o.type);
			a !== s && i.push({
				type: d.ARG_DEFAULT_VALUE_CHANGE,
				description: `${e.name}.${n.name} arg ${r.name} has changed defaultValue from ${a} to ${s}.`
			});
		}
		for (let r of a.added) (0, o.isRequiredArgument)(r) ? i.push({
			type: u.REQUIRED_ARG_ADDED,
			description: `A required arg ${r.name} on ${e.name}.${n.name} was added.`
		}) : i.push({
			type: d.OPTIONAL_ARG_ADDED,
			description: `An optional arg ${r.name} on ${e.name}.${n.name} was added.`
		});
		return i;
	}
	function T(e, n) {
		return (0, o.isListType)(e) ? (0, o.isListType)(n) && T(e.ofType, n.ofType) || (0, o.isNonNullType)(n) && T(e, n.ofType) : (0, o.isNonNullType)(e) ? (0, o.isNonNullType)(n) && T(e.ofType, n.ofType) : (0, o.isNamedType)(n) && e.name === n.name || (0, o.isNonNullType)(n) && T(e, n.ofType);
	}
	function E(e, n) {
		return (0, o.isListType)(e) ? (0, o.isListType)(n) && E(e.ofType, n.ofType) : (0, o.isNonNullType)(e) ? (0, o.isNonNullType)(n) && E(e.ofType, n.ofType) || !(0, o.isNonNullType)(n) && E(e.ofType, n) : (0, o.isNamedType)(n) && e.name === n.name;
	}
	function D(e) {
		if ((0, o.isScalarType)(e)) return "a Scalar type";
		if ((0, o.isObjectType)(e)) return "an Object type";
		if ((0, o.isInterfaceType)(e)) return "an Interface type";
		if ((0, o.isUnionType)(e)) return "a Union type";
		if ((0, o.isEnumType)(e)) return "an Enum type";
		if ((0, o.isInputObjectType)(e)) return "an Input type";
		/* c8 ignore next 3 */
		(0, r.invariant)(!1, "Unexpected type: " + (0, n.inspect)(e));
	}
	function O(e, n) {
		let i = (0, c.astFromValue)(e, n);
		return i ?? (0, r.invariant)(!1), (0, a.print)((0, l.sortValueNode)(i));
	}
	function k(e, n) {
		let r = [], a = [], o = [], s = (0, i.keyMap)(e, ({ name: e }) => e), c = (0, i.keyMap)(n, ({ name: e }) => e);
		for (let n of e) {
			let e = c[n.name];
			e === void 0 ? a.push(n) : o.push([n, e]);
		}
		for (let e of n) s[e.name] === void 0 && r.push(e);
		return {
			added: r,
			persisted: o,
			removed: a
		};
	}
})), require_resolveSchemaCoordinate = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), e.resolveASTSchemaCoordinate = f, e.resolveSchemaCoordinate = o;
	var n = require_inspect(), r = require_kinds(), i = require_parser(), a = require_definition();
	function o(e, n) {
		return f(e, (0, i.parseSchemaCoordinate)(n));
	}
	function s(e, n) {
		let r = n.name.value, i = e.getType(r);
		if (i != null) return {
			kind: "NamedType",
			type: i
		};
	}
	function c(e, r) {
		let i = r.name.value, o = e.getType(i);
		if (!o) throw Error(`Expected ${(0, n.inspect)(i)} to be defined as a type in the schema.`);
		if (!(0, a.isEnumType)(o) && !(0, a.isInputObjectType)(o) && !(0, a.isObjectType)(o) && !(0, a.isInterfaceType)(o)) throw Error(`Expected ${(0, n.inspect)(i)} to be an Enum, Input Object, Object or Interface type.`);
		if ((0, a.isEnumType)(o)) {
			let e = r.memberName.value, n = o.getValue(e);
			return n == null ? void 0 : {
				kind: "EnumValue",
				type: o,
				enumValue: n
			};
		}
		if ((0, a.isInputObjectType)(o)) {
			let e = r.memberName.value, n = o.getFields()[e];
			return n == null ? void 0 : {
				kind: "InputField",
				type: o,
				inputField: n
			};
		}
		let s = r.memberName.value, c = o.getFields()[s];
		if (c != null) return {
			kind: "Field",
			type: o,
			field: c
		};
	}
	function l(e, r) {
		let i = r.name.value, o = e.getType(i);
		if (o == null) throw Error(`Expected ${(0, n.inspect)(i)} to be defined as a type in the schema.`);
		if (!(0, a.isObjectType)(o) && !(0, a.isInterfaceType)(o)) throw Error(`Expected ${(0, n.inspect)(i)} to be an object type or interface type.`);
		let s = r.fieldName.value, c = o.getFields()[s];
		if (c == null) throw Error(`Expected ${(0, n.inspect)(s)} to exist as a field of type ${(0, n.inspect)(i)} in the schema.`);
		let l = r.argumentName.value, u = c.args.find((e) => e.name === l);
		if (u != null) return {
			kind: "FieldArgument",
			type: o,
			field: c,
			fieldArgument: u
		};
	}
	function u(e, n) {
		let r = n.name.value, i = e.getDirective(r);
		if (i) return {
			kind: "Directive",
			directive: i
		};
	}
	function d(e, r) {
		let i = r.name.value, a = e.getDirective(i);
		if (!a) throw Error(`Expected ${(0, n.inspect)(i)} to be defined as a directive in the schema.`);
		let { argumentName: { value: o } } = r, s = a.args.find((e) => e.name === o);
		if (s) return {
			kind: "DirectiveArgument",
			directive: a,
			directiveArgument: s
		};
	}
	function f(e, n) {
		switch (n.kind) {
			case r.Kind.TYPE_COORDINATE: return s(e, n);
			case r.Kind.MEMBER_COORDINATE: return c(e, n);
			case r.Kind.ARGUMENT_COORDINATE: return l(e, n);
			case r.Kind.DIRECTIVE_COORDINATE: return u(e, n);
			case r.Kind.DIRECTIVE_ARGUMENT_COORDINATE: return d(e, n);
		}
	}
})), require_utilities = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), Object.defineProperty(e, "BreakingChangeType", {
		enumerable: !0,
		get: function() {
			return w.BreakingChangeType;
		}
	}), Object.defineProperty(e, "DangerousChangeType", {
		enumerable: !0,
		get: function() {
			return w.DangerousChangeType;
		}
	}), Object.defineProperty(e, "TypeInfo", {
		enumerable: !0,
		get: function() {
			return _.TypeInfo;
		}
	}), Object.defineProperty(e, "assertValidName", {
		enumerable: !0,
		get: function() {
			return C.assertValidName;
		}
	}), Object.defineProperty(e, "astFromValue", {
		enumerable: !0,
		get: function() {
			return g.astFromValue;
		}
	}), Object.defineProperty(e, "buildASTSchema", {
		enumerable: !0,
		get: function() {
			return s.buildASTSchema;
		}
	}), Object.defineProperty(e, "buildClientSchema", {
		enumerable: !0,
		get: function() {
			return o.buildClientSchema;
		}
	}), Object.defineProperty(e, "buildSchema", {
		enumerable: !0,
		get: function() {
			return s.buildSchema;
		}
	}), Object.defineProperty(e, "coerceInputValue", {
		enumerable: !0,
		get: function() {
			return v.coerceInputValue;
		}
	}), Object.defineProperty(e, "concatAST", {
		enumerable: !0,
		get: function() {
			return y.concatAST;
		}
	}), Object.defineProperty(e, "doTypesOverlap", {
		enumerable: !0,
		get: function() {
			return S.doTypesOverlap;
		}
	}), Object.defineProperty(e, "extendSchema", {
		enumerable: !0,
		get: function() {
			return c.extendSchema;
		}
	}), Object.defineProperty(e, "findBreakingChanges", {
		enumerable: !0,
		get: function() {
			return w.findBreakingChanges;
		}
	}), Object.defineProperty(e, "findDangerousChanges", {
		enumerable: !0,
		get: function() {
			return w.findDangerousChanges;
		}
	}), Object.defineProperty(e, "getIntrospectionQuery", {
		enumerable: !0,
		get: function() {
			return n.getIntrospectionQuery;
		}
	}), Object.defineProperty(e, "getOperationAST", {
		enumerable: !0,
		get: function() {
			return r.getOperationAST;
		}
	}), Object.defineProperty(e, "getOperationRootType", {
		enumerable: !0,
		get: function() {
			return i.getOperationRootType;
		}
	}), Object.defineProperty(e, "introspectionFromSchema", {
		enumerable: !0,
		get: function() {
			return a.introspectionFromSchema;
		}
	}), Object.defineProperty(e, "isEqualType", {
		enumerable: !0,
		get: function() {
			return S.isEqualType;
		}
	}), Object.defineProperty(e, "isTypeSubTypeOf", {
		enumerable: !0,
		get: function() {
			return S.isTypeSubTypeOf;
		}
	}), Object.defineProperty(e, "isValidNameError", {
		enumerable: !0,
		get: function() {
			return C.isValidNameError;
		}
	}), Object.defineProperty(e, "lexicographicSortSchema", {
		enumerable: !0,
		get: function() {
			return l.lexicographicSortSchema;
		}
	}), Object.defineProperty(e, "printIntrospectionSchema", {
		enumerable: !0,
		get: function() {
			return u.printIntrospectionSchema;
		}
	}), Object.defineProperty(e, "printSchema", {
		enumerable: !0,
		get: function() {
			return u.printSchema;
		}
	}), Object.defineProperty(e, "printType", {
		enumerable: !0,
		get: function() {
			return u.printType;
		}
	}), Object.defineProperty(e, "resolveASTSchemaCoordinate", {
		enumerable: !0,
		get: function() {
			return T.resolveASTSchemaCoordinate;
		}
	}), Object.defineProperty(e, "resolveSchemaCoordinate", {
		enumerable: !0,
		get: function() {
			return T.resolveSchemaCoordinate;
		}
	}), Object.defineProperty(e, "separateOperations", {
		enumerable: !0,
		get: function() {
			return b.separateOperations;
		}
	}), Object.defineProperty(e, "stripIgnoredCharacters", {
		enumerable: !0,
		get: function() {
			return x.stripIgnoredCharacters;
		}
	}), Object.defineProperty(e, "typeFromAST", {
		enumerable: !0,
		get: function() {
			return d.typeFromAST;
		}
	}), Object.defineProperty(e, "valueFromAST", {
		enumerable: !0,
		get: function() {
			return f.valueFromAST;
		}
	}), Object.defineProperty(e, "valueFromASTUntyped", {
		enumerable: !0,
		get: function() {
			return m.valueFromASTUntyped;
		}
	}), Object.defineProperty(e, "visitWithTypeInfo", {
		enumerable: !0,
		get: function() {
			return _.visitWithTypeInfo;
		}
	});
	var n = require_getIntrospectionQuery(), r = require_getOperationAST(), i = require_getOperationRootType(), a = require_introspectionFromSchema(), o = require_buildClientSchema(), s = require_buildASTSchema(), c = require_extendSchema(), l = require_lexicographicSortSchema(), u = require_printSchema(), d = require_typeFromAST(), f = require_valueFromAST(), m = require_valueFromASTUntyped(), g = require_astFromValue(), _ = require_TypeInfo(), v = require_coerceInputValue(), y = require_concatAST(), b = require_separateOperations(), x = require_stripIgnoredCharacters(), S = require_typeComparators(), C = require_assertValidName(), w = require_findBreakingChanges(), T = require_resolveSchemaCoordinate();
})), require_graphql = /* @__PURE__ */ __commonJSMin(((e) => {
	Object.defineProperty(e, "__esModule", { value: !0 }), Object.defineProperty(e, "BREAK", {
		enumerable: !0,
		get: function() {
			return a.BREAK;
		}
	}), Object.defineProperty(e, "BreakingChangeType", {
		enumerable: !0,
		get: function() {
			return l.BreakingChangeType;
		}
	}), Object.defineProperty(e, "DEFAULT_DEPRECATION_REASON", {
		enumerable: !0,
		get: function() {
			return i.DEFAULT_DEPRECATION_REASON;
		}
	}), Object.defineProperty(e, "DangerousChangeType", {
		enumerable: !0,
		get: function() {
			return l.DangerousChangeType;
		}
	}), Object.defineProperty(e, "DirectiveLocation", {
		enumerable: !0,
		get: function() {
			return a.DirectiveLocation;
		}
	}), Object.defineProperty(e, "ExecutableDefinitionsRule", {
		enumerable: !0,
		get: function() {
			return s.ExecutableDefinitionsRule;
		}
	}), Object.defineProperty(e, "FieldsOnCorrectTypeRule", {
		enumerable: !0,
		get: function() {
			return s.FieldsOnCorrectTypeRule;
		}
	}), Object.defineProperty(e, "FragmentsOnCompositeTypesRule", {
		enumerable: !0,
		get: function() {
			return s.FragmentsOnCompositeTypesRule;
		}
	}), Object.defineProperty(e, "GRAPHQL_MAX_INT", {
		enumerable: !0,
		get: function() {
			return i.GRAPHQL_MAX_INT;
		}
	}), Object.defineProperty(e, "GRAPHQL_MIN_INT", {
		enumerable: !0,
		get: function() {
			return i.GRAPHQL_MIN_INT;
		}
	}), Object.defineProperty(e, "GraphQLBoolean", {
		enumerable: !0,
		get: function() {
			return i.GraphQLBoolean;
		}
	}), Object.defineProperty(e, "GraphQLDeprecatedDirective", {
		enumerable: !0,
		get: function() {
			return i.GraphQLDeprecatedDirective;
		}
	}), Object.defineProperty(e, "GraphQLDirective", {
		enumerable: !0,
		get: function() {
			return i.GraphQLDirective;
		}
	}), Object.defineProperty(e, "GraphQLEnumType", {
		enumerable: !0,
		get: function() {
			return i.GraphQLEnumType;
		}
	}), Object.defineProperty(e, "GraphQLError", {
		enumerable: !0,
		get: function() {
			return c.GraphQLError;
		}
	}), Object.defineProperty(e, "GraphQLFloat", {
		enumerable: !0,
		get: function() {
			return i.GraphQLFloat;
		}
	}), Object.defineProperty(e, "GraphQLID", {
		enumerable: !0,
		get: function() {
			return i.GraphQLID;
		}
	}), Object.defineProperty(e, "GraphQLIncludeDirective", {
		enumerable: !0,
		get: function() {
			return i.GraphQLIncludeDirective;
		}
	}), Object.defineProperty(e, "GraphQLInputObjectType", {
		enumerable: !0,
		get: function() {
			return i.GraphQLInputObjectType;
		}
	}), Object.defineProperty(e, "GraphQLInt", {
		enumerable: !0,
		get: function() {
			return i.GraphQLInt;
		}
	}), Object.defineProperty(e, "GraphQLInterfaceType", {
		enumerable: !0,
		get: function() {
			return i.GraphQLInterfaceType;
		}
	}), Object.defineProperty(e, "GraphQLList", {
		enumerable: !0,
		get: function() {
			return i.GraphQLList;
		}
	}), Object.defineProperty(e, "GraphQLNonNull", {
		enumerable: !0,
		get: function() {
			return i.GraphQLNonNull;
		}
	}), Object.defineProperty(e, "GraphQLObjectType", {
		enumerable: !0,
		get: function() {
			return i.GraphQLObjectType;
		}
	}), Object.defineProperty(e, "GraphQLOneOfDirective", {
		enumerable: !0,
		get: function() {
			return i.GraphQLOneOfDirective;
		}
	}), Object.defineProperty(e, "GraphQLScalarType", {
		enumerable: !0,
		get: function() {
			return i.GraphQLScalarType;
		}
	}), Object.defineProperty(e, "GraphQLSchema", {
		enumerable: !0,
		get: function() {
			return i.GraphQLSchema;
		}
	}), Object.defineProperty(e, "GraphQLSkipDirective", {
		enumerable: !0,
		get: function() {
			return i.GraphQLSkipDirective;
		}
	}), Object.defineProperty(e, "GraphQLSpecifiedByDirective", {
		enumerable: !0,
		get: function() {
			return i.GraphQLSpecifiedByDirective;
		}
	}), Object.defineProperty(e, "GraphQLString", {
		enumerable: !0,
		get: function() {
			return i.GraphQLString;
		}
	}), Object.defineProperty(e, "GraphQLUnionType", {
		enumerable: !0,
		get: function() {
			return i.GraphQLUnionType;
		}
	}), Object.defineProperty(e, "Kind", {
		enumerable: !0,
		get: function() {
			return a.Kind;
		}
	}), Object.defineProperty(e, "KnownArgumentNamesRule", {
		enumerable: !0,
		get: function() {
			return s.KnownArgumentNamesRule;
		}
	}), Object.defineProperty(e, "KnownDirectivesRule", {
		enumerable: !0,
		get: function() {
			return s.KnownDirectivesRule;
		}
	}), Object.defineProperty(e, "KnownFragmentNamesRule", {
		enumerable: !0,
		get: function() {
			return s.KnownFragmentNamesRule;
		}
	}), Object.defineProperty(e, "KnownTypeNamesRule", {
		enumerable: !0,
		get: function() {
			return s.KnownTypeNamesRule;
		}
	}), Object.defineProperty(e, "Lexer", {
		enumerable: !0,
		get: function() {
			return a.Lexer;
		}
	}), Object.defineProperty(e, "Location", {
		enumerable: !0,
		get: function() {
			return a.Location;
		}
	}), Object.defineProperty(e, "LoneAnonymousOperationRule", {
		enumerable: !0,
		get: function() {
			return s.LoneAnonymousOperationRule;
		}
	}), Object.defineProperty(e, "LoneSchemaDefinitionRule", {
		enumerable: !0,
		get: function() {
			return s.LoneSchemaDefinitionRule;
		}
	}), Object.defineProperty(e, "MaxIntrospectionDepthRule", {
		enumerable: !0,
		get: function() {
			return s.MaxIntrospectionDepthRule;
		}
	}), Object.defineProperty(e, "NoDeprecatedCustomRule", {
		enumerable: !0,
		get: function() {
			return s.NoDeprecatedCustomRule;
		}
	}), Object.defineProperty(e, "NoFragmentCyclesRule", {
		enumerable: !0,
		get: function() {
			return s.NoFragmentCyclesRule;
		}
	}), Object.defineProperty(e, "NoSchemaIntrospectionCustomRule", {
		enumerable: !0,
		get: function() {
			return s.NoSchemaIntrospectionCustomRule;
		}
	}), Object.defineProperty(e, "NoUndefinedVariablesRule", {
		enumerable: !0,
		get: function() {
			return s.NoUndefinedVariablesRule;
		}
	}), Object.defineProperty(e, "NoUnusedFragmentsRule", {
		enumerable: !0,
		get: function() {
			return s.NoUnusedFragmentsRule;
		}
	}), Object.defineProperty(e, "NoUnusedVariablesRule", {
		enumerable: !0,
		get: function() {
			return s.NoUnusedVariablesRule;
		}
	}), Object.defineProperty(e, "OperationTypeNode", {
		enumerable: !0,
		get: function() {
			return a.OperationTypeNode;
		}
	}), Object.defineProperty(e, "OverlappingFieldsCanBeMergedRule", {
		enumerable: !0,
		get: function() {
			return s.OverlappingFieldsCanBeMergedRule;
		}
	}), Object.defineProperty(e, "PossibleFragmentSpreadsRule", {
		enumerable: !0,
		get: function() {
			return s.PossibleFragmentSpreadsRule;
		}
	}), Object.defineProperty(e, "PossibleTypeExtensionsRule", {
		enumerable: !0,
		get: function() {
			return s.PossibleTypeExtensionsRule;
		}
	}), Object.defineProperty(e, "ProvidedRequiredArgumentsRule", {
		enumerable: !0,
		get: function() {
			return s.ProvidedRequiredArgumentsRule;
		}
	}), Object.defineProperty(e, "ScalarLeafsRule", {
		enumerable: !0,
		get: function() {
			return s.ScalarLeafsRule;
		}
	}), Object.defineProperty(e, "SchemaMetaFieldDef", {
		enumerable: !0,
		get: function() {
			return i.SchemaMetaFieldDef;
		}
	}), Object.defineProperty(e, "SingleFieldSubscriptionsRule", {
		enumerable: !0,
		get: function() {
			return s.SingleFieldSubscriptionsRule;
		}
	}), Object.defineProperty(e, "Source", {
		enumerable: !0,
		get: function() {
			return a.Source;
		}
	}), Object.defineProperty(e, "Token", {
		enumerable: !0,
		get: function() {
			return a.Token;
		}
	}), Object.defineProperty(e, "TokenKind", {
		enumerable: !0,
		get: function() {
			return a.TokenKind;
		}
	}), Object.defineProperty(e, "TypeInfo", {
		enumerable: !0,
		get: function() {
			return l.TypeInfo;
		}
	}), Object.defineProperty(e, "TypeKind", {
		enumerable: !0,
		get: function() {
			return i.TypeKind;
		}
	}), Object.defineProperty(e, "TypeMetaFieldDef", {
		enumerable: !0,
		get: function() {
			return i.TypeMetaFieldDef;
		}
	}), Object.defineProperty(e, "TypeNameMetaFieldDef", {
		enumerable: !0,
		get: function() {
			return i.TypeNameMetaFieldDef;
		}
	}), Object.defineProperty(e, "UniqueArgumentDefinitionNamesRule", {
		enumerable: !0,
		get: function() {
			return s.UniqueArgumentDefinitionNamesRule;
		}
	}), Object.defineProperty(e, "UniqueArgumentNamesRule", {
		enumerable: !0,
		get: function() {
			return s.UniqueArgumentNamesRule;
		}
	}), Object.defineProperty(e, "UniqueDirectiveNamesRule", {
		enumerable: !0,
		get: function() {
			return s.UniqueDirectiveNamesRule;
		}
	}), Object.defineProperty(e, "UniqueDirectivesPerLocationRule", {
		enumerable: !0,
		get: function() {
			return s.UniqueDirectivesPerLocationRule;
		}
	}), Object.defineProperty(e, "UniqueEnumValueNamesRule", {
		enumerable: !0,
		get: function() {
			return s.UniqueEnumValueNamesRule;
		}
	}), Object.defineProperty(e, "UniqueFieldDefinitionNamesRule", {
		enumerable: !0,
		get: function() {
			return s.UniqueFieldDefinitionNamesRule;
		}
	}), Object.defineProperty(e, "UniqueFragmentNamesRule", {
		enumerable: !0,
		get: function() {
			return s.UniqueFragmentNamesRule;
		}
	}), Object.defineProperty(e, "UniqueInputFieldNamesRule", {
		enumerable: !0,
		get: function() {
			return s.UniqueInputFieldNamesRule;
		}
	}), Object.defineProperty(e, "UniqueOperationNamesRule", {
		enumerable: !0,
		get: function() {
			return s.UniqueOperationNamesRule;
		}
	}), Object.defineProperty(e, "UniqueOperationTypesRule", {
		enumerable: !0,
		get: function() {
			return s.UniqueOperationTypesRule;
		}
	}), Object.defineProperty(e, "UniqueTypeNamesRule", {
		enumerable: !0,
		get: function() {
			return s.UniqueTypeNamesRule;
		}
	}), Object.defineProperty(e, "UniqueVariableNamesRule", {
		enumerable: !0,
		get: function() {
			return s.UniqueVariableNamesRule;
		}
	}), Object.defineProperty(e, "ValidationContext", {
		enumerable: !0,
		get: function() {
			return s.ValidationContext;
		}
	}), Object.defineProperty(e, "ValuesOfCorrectTypeRule", {
		enumerable: !0,
		get: function() {
			return s.ValuesOfCorrectTypeRule;
		}
	}), Object.defineProperty(e, "VariablesAreInputTypesRule", {
		enumerable: !0,
		get: function() {
			return s.VariablesAreInputTypesRule;
		}
	}), Object.defineProperty(e, "VariablesInAllowedPositionRule", {
		enumerable: !0,
		get: function() {
			return s.VariablesInAllowedPositionRule;
		}
	}), Object.defineProperty(e, "__Directive", {
		enumerable: !0,
		get: function() {
			return i.__Directive;
		}
	}), Object.defineProperty(e, "__DirectiveLocation", {
		enumerable: !0,
		get: function() {
			return i.__DirectiveLocation;
		}
	}), Object.defineProperty(e, "__EnumValue", {
		enumerable: !0,
		get: function() {
			return i.__EnumValue;
		}
	}), Object.defineProperty(e, "__Field", {
		enumerable: !0,
		get: function() {
			return i.__Field;
		}
	}), Object.defineProperty(e, "__InputValue", {
		enumerable: !0,
		get: function() {
			return i.__InputValue;
		}
	}), Object.defineProperty(e, "__Schema", {
		enumerable: !0,
		get: function() {
			return i.__Schema;
		}
	}), Object.defineProperty(e, "__Type", {
		enumerable: !0,
		get: function() {
			return i.__Type;
		}
	}), Object.defineProperty(e, "__TypeKind", {
		enumerable: !0,
		get: function() {
			return i.__TypeKind;
		}
	}), Object.defineProperty(e, "assertAbstractType", {
		enumerable: !0,
		get: function() {
			return i.assertAbstractType;
		}
	}), Object.defineProperty(e, "assertCompositeType", {
		enumerable: !0,
		get: function() {
			return i.assertCompositeType;
		}
	}), Object.defineProperty(e, "assertDirective", {
		enumerable: !0,
		get: function() {
			return i.assertDirective;
		}
	}), Object.defineProperty(e, "assertEnumType", {
		enumerable: !0,
		get: function() {
			return i.assertEnumType;
		}
	}), Object.defineProperty(e, "assertEnumValueName", {
		enumerable: !0,
		get: function() {
			return i.assertEnumValueName;
		}
	}), Object.defineProperty(e, "assertInputObjectType", {
		enumerable: !0,
		get: function() {
			return i.assertInputObjectType;
		}
	}), Object.defineProperty(e, "assertInputType", {
		enumerable: !0,
		get: function() {
			return i.assertInputType;
		}
	}), Object.defineProperty(e, "assertInterfaceType", {
		enumerable: !0,
		get: function() {
			return i.assertInterfaceType;
		}
	}), Object.defineProperty(e, "assertLeafType", {
		enumerable: !0,
		get: function() {
			return i.assertLeafType;
		}
	}), Object.defineProperty(e, "assertListType", {
		enumerable: !0,
		get: function() {
			return i.assertListType;
		}
	}), Object.defineProperty(e, "assertName", {
		enumerable: !0,
		get: function() {
			return i.assertName;
		}
	}), Object.defineProperty(e, "assertNamedType", {
		enumerable: !0,
		get: function() {
			return i.assertNamedType;
		}
	}), Object.defineProperty(e, "assertNonNullType", {
		enumerable: !0,
		get: function() {
			return i.assertNonNullType;
		}
	}), Object.defineProperty(e, "assertNullableType", {
		enumerable: !0,
		get: function() {
			return i.assertNullableType;
		}
	}), Object.defineProperty(e, "assertObjectType", {
		enumerable: !0,
		get: function() {
			return i.assertObjectType;
		}
	}), Object.defineProperty(e, "assertOutputType", {
		enumerable: !0,
		get: function() {
			return i.assertOutputType;
		}
	}), Object.defineProperty(e, "assertScalarType", {
		enumerable: !0,
		get: function() {
			return i.assertScalarType;
		}
	}), Object.defineProperty(e, "assertSchema", {
		enumerable: !0,
		get: function() {
			return i.assertSchema;
		}
	}), Object.defineProperty(e, "assertType", {
		enumerable: !0,
		get: function() {
			return i.assertType;
		}
	}), Object.defineProperty(e, "assertUnionType", {
		enumerable: !0,
		get: function() {
			return i.assertUnionType;
		}
	}), Object.defineProperty(e, "assertValidName", {
		enumerable: !0,
		get: function() {
			return l.assertValidName;
		}
	}), Object.defineProperty(e, "assertValidSchema", {
		enumerable: !0,
		get: function() {
			return i.assertValidSchema;
		}
	}), Object.defineProperty(e, "assertWrappingType", {
		enumerable: !0,
		get: function() {
			return i.assertWrappingType;
		}
	}), Object.defineProperty(e, "astFromValue", {
		enumerable: !0,
		get: function() {
			return l.astFromValue;
		}
	}), Object.defineProperty(e, "buildASTSchema", {
		enumerable: !0,
		get: function() {
			return l.buildASTSchema;
		}
	}), Object.defineProperty(e, "buildClientSchema", {
		enumerable: !0,
		get: function() {
			return l.buildClientSchema;
		}
	}), Object.defineProperty(e, "buildSchema", {
		enumerable: !0,
		get: function() {
			return l.buildSchema;
		}
	}), Object.defineProperty(e, "coerceInputValue", {
		enumerable: !0,
		get: function() {
			return l.coerceInputValue;
		}
	}), Object.defineProperty(e, "concatAST", {
		enumerable: !0,
		get: function() {
			return l.concatAST;
		}
	}), Object.defineProperty(e, "createSourceEventStream", {
		enumerable: !0,
		get: function() {
			return o.createSourceEventStream;
		}
	}), Object.defineProperty(e, "defaultFieldResolver", {
		enumerable: !0,
		get: function() {
			return o.defaultFieldResolver;
		}
	}), Object.defineProperty(e, "defaultTypeResolver", {
		enumerable: !0,
		get: function() {
			return o.defaultTypeResolver;
		}
	}), Object.defineProperty(e, "doTypesOverlap", {
		enumerable: !0,
		get: function() {
			return l.doTypesOverlap;
		}
	}), Object.defineProperty(e, "execute", {
		enumerable: !0,
		get: function() {
			return o.execute;
		}
	}), Object.defineProperty(e, "executeSync", {
		enumerable: !0,
		get: function() {
			return o.executeSync;
		}
	}), Object.defineProperty(e, "extendSchema", {
		enumerable: !0,
		get: function() {
			return l.extendSchema;
		}
	}), Object.defineProperty(e, "findBreakingChanges", {
		enumerable: !0,
		get: function() {
			return l.findBreakingChanges;
		}
	}), Object.defineProperty(e, "findDangerousChanges", {
		enumerable: !0,
		get: function() {
			return l.findDangerousChanges;
		}
	}), Object.defineProperty(e, "formatError", {
		enumerable: !0,
		get: function() {
			return c.formatError;
		}
	}), Object.defineProperty(e, "getArgumentValues", {
		enumerable: !0,
		get: function() {
			return o.getArgumentValues;
		}
	}), Object.defineProperty(e, "getDirectiveValues", {
		enumerable: !0,
		get: function() {
			return o.getDirectiveValues;
		}
	}), Object.defineProperty(e, "getEnterLeaveForKind", {
		enumerable: !0,
		get: function() {
			return a.getEnterLeaveForKind;
		}
	}), Object.defineProperty(e, "getIntrospectionQuery", {
		enumerable: !0,
		get: function() {
			return l.getIntrospectionQuery;
		}
	}), Object.defineProperty(e, "getLocation", {
		enumerable: !0,
		get: function() {
			return a.getLocation;
		}
	}), Object.defineProperty(e, "getNamedType", {
		enumerable: !0,
		get: function() {
			return i.getNamedType;
		}
	}), Object.defineProperty(e, "getNullableType", {
		enumerable: !0,
		get: function() {
			return i.getNullableType;
		}
	}), Object.defineProperty(e, "getOperationAST", {
		enumerable: !0,
		get: function() {
			return l.getOperationAST;
		}
	}), Object.defineProperty(e, "getOperationRootType", {
		enumerable: !0,
		get: function() {
			return l.getOperationRootType;
		}
	}), Object.defineProperty(e, "getVariableValues", {
		enumerable: !0,
		get: function() {
			return o.getVariableValues;
		}
	}), Object.defineProperty(e, "getVisitFn", {
		enumerable: !0,
		get: function() {
			return a.getVisitFn;
		}
	}), Object.defineProperty(e, "graphql", {
		enumerable: !0,
		get: function() {
			return r.graphql;
		}
	}), Object.defineProperty(e, "graphqlSync", {
		enumerable: !0,
		get: function() {
			return r.graphqlSync;
		}
	}), Object.defineProperty(e, "introspectionFromSchema", {
		enumerable: !0,
		get: function() {
			return l.introspectionFromSchema;
		}
	}), Object.defineProperty(e, "introspectionTypes", {
		enumerable: !0,
		get: function() {
			return i.introspectionTypes;
		}
	}), Object.defineProperty(e, "isAbstractType", {
		enumerable: !0,
		get: function() {
			return i.isAbstractType;
		}
	}), Object.defineProperty(e, "isCompositeType", {
		enumerable: !0,
		get: function() {
			return i.isCompositeType;
		}
	}), Object.defineProperty(e, "isConstValueNode", {
		enumerable: !0,
		get: function() {
			return a.isConstValueNode;
		}
	}), Object.defineProperty(e, "isDefinitionNode", {
		enumerable: !0,
		get: function() {
			return a.isDefinitionNode;
		}
	}), Object.defineProperty(e, "isDirective", {
		enumerable: !0,
		get: function() {
			return i.isDirective;
		}
	}), Object.defineProperty(e, "isEnumType", {
		enumerable: !0,
		get: function() {
			return i.isEnumType;
		}
	}), Object.defineProperty(e, "isEqualType", {
		enumerable: !0,
		get: function() {
			return l.isEqualType;
		}
	}), Object.defineProperty(e, "isExecutableDefinitionNode", {
		enumerable: !0,
		get: function() {
			return a.isExecutableDefinitionNode;
		}
	}), Object.defineProperty(e, "isInputObjectType", {
		enumerable: !0,
		get: function() {
			return i.isInputObjectType;
		}
	}), Object.defineProperty(e, "isInputType", {
		enumerable: !0,
		get: function() {
			return i.isInputType;
		}
	}), Object.defineProperty(e, "isInterfaceType", {
		enumerable: !0,
		get: function() {
			return i.isInterfaceType;
		}
	}), Object.defineProperty(e, "isIntrospectionType", {
		enumerable: !0,
		get: function() {
			return i.isIntrospectionType;
		}
	}), Object.defineProperty(e, "isLeafType", {
		enumerable: !0,
		get: function() {
			return i.isLeafType;
		}
	}), Object.defineProperty(e, "isListType", {
		enumerable: !0,
		get: function() {
			return i.isListType;
		}
	}), Object.defineProperty(e, "isNamedType", {
		enumerable: !0,
		get: function() {
			return i.isNamedType;
		}
	}), Object.defineProperty(e, "isNonNullType", {
		enumerable: !0,
		get: function() {
			return i.isNonNullType;
		}
	}), Object.defineProperty(e, "isNullableType", {
		enumerable: !0,
		get: function() {
			return i.isNullableType;
		}
	}), Object.defineProperty(e, "isObjectType", {
		enumerable: !0,
		get: function() {
			return i.isObjectType;
		}
	}), Object.defineProperty(e, "isOutputType", {
		enumerable: !0,
		get: function() {
			return i.isOutputType;
		}
	}), Object.defineProperty(e, "isRequiredArgument", {
		enumerable: !0,
		get: function() {
			return i.isRequiredArgument;
		}
	}), Object.defineProperty(e, "isRequiredInputField", {
		enumerable: !0,
		get: function() {
			return i.isRequiredInputField;
		}
	}), Object.defineProperty(e, "isScalarType", {
		enumerable: !0,
		get: function() {
			return i.isScalarType;
		}
	}), Object.defineProperty(e, "isSchema", {
		enumerable: !0,
		get: function() {
			return i.isSchema;
		}
	}), Object.defineProperty(e, "isSchemaCoordinateNode", {
		enumerable: !0,
		get: function() {
			return a.isSchemaCoordinateNode;
		}
	}), Object.defineProperty(e, "isSelectionNode", {
		enumerable: !0,
		get: function() {
			return a.isSelectionNode;
		}
	}), Object.defineProperty(e, "isSpecifiedDirective", {
		enumerable: !0,
		get: function() {
			return i.isSpecifiedDirective;
		}
	}), Object.defineProperty(e, "isSpecifiedScalarType", {
		enumerable: !0,
		get: function() {
			return i.isSpecifiedScalarType;
		}
	}), Object.defineProperty(e, "isType", {
		enumerable: !0,
		get: function() {
			return i.isType;
		}
	}), Object.defineProperty(e, "isTypeDefinitionNode", {
		enumerable: !0,
		get: function() {
			return a.isTypeDefinitionNode;
		}
	}), Object.defineProperty(e, "isTypeExtensionNode", {
		enumerable: !0,
		get: function() {
			return a.isTypeExtensionNode;
		}
	}), Object.defineProperty(e, "isTypeNode", {
		enumerable: !0,
		get: function() {
			return a.isTypeNode;
		}
	}), Object.defineProperty(e, "isTypeSubTypeOf", {
		enumerable: !0,
		get: function() {
			return l.isTypeSubTypeOf;
		}
	}), Object.defineProperty(e, "isTypeSystemDefinitionNode", {
		enumerable: !0,
		get: function() {
			return a.isTypeSystemDefinitionNode;
		}
	}), Object.defineProperty(e, "isTypeSystemExtensionNode", {
		enumerable: !0,
		get: function() {
			return a.isTypeSystemExtensionNode;
		}
	}), Object.defineProperty(e, "isUnionType", {
		enumerable: !0,
		get: function() {
			return i.isUnionType;
		}
	}), Object.defineProperty(e, "isValidNameError", {
		enumerable: !0,
		get: function() {
			return l.isValidNameError;
		}
	}), Object.defineProperty(e, "isValueNode", {
		enumerable: !0,
		get: function() {
			return a.isValueNode;
		}
	}), Object.defineProperty(e, "isWrappingType", {
		enumerable: !0,
		get: function() {
			return i.isWrappingType;
		}
	}), Object.defineProperty(e, "lexicographicSortSchema", {
		enumerable: !0,
		get: function() {
			return l.lexicographicSortSchema;
		}
	}), Object.defineProperty(e, "locatedError", {
		enumerable: !0,
		get: function() {
			return c.locatedError;
		}
	}), Object.defineProperty(e, "parse", {
		enumerable: !0,
		get: function() {
			return a.parse;
		}
	}), Object.defineProperty(e, "parseConstValue", {
		enumerable: !0,
		get: function() {
			return a.parseConstValue;
		}
	}), Object.defineProperty(e, "parseSchemaCoordinate", {
		enumerable: !0,
		get: function() {
			return a.parseSchemaCoordinate;
		}
	}), Object.defineProperty(e, "parseType", {
		enumerable: !0,
		get: function() {
			return a.parseType;
		}
	}), Object.defineProperty(e, "parseValue", {
		enumerable: !0,
		get: function() {
			return a.parseValue;
		}
	}), Object.defineProperty(e, "print", {
		enumerable: !0,
		get: function() {
			return a.print;
		}
	}), Object.defineProperty(e, "printError", {
		enumerable: !0,
		get: function() {
			return c.printError;
		}
	}), Object.defineProperty(e, "printIntrospectionSchema", {
		enumerable: !0,
		get: function() {
			return l.printIntrospectionSchema;
		}
	}), Object.defineProperty(e, "printLocation", {
		enumerable: !0,
		get: function() {
			return a.printLocation;
		}
	}), Object.defineProperty(e, "printSchema", {
		enumerable: !0,
		get: function() {
			return l.printSchema;
		}
	}), Object.defineProperty(e, "printSourceLocation", {
		enumerable: !0,
		get: function() {
			return a.printSourceLocation;
		}
	}), Object.defineProperty(e, "printType", {
		enumerable: !0,
		get: function() {
			return l.printType;
		}
	}), Object.defineProperty(e, "recommendedRules", {
		enumerable: !0,
		get: function() {
			return s.recommendedRules;
		}
	}), Object.defineProperty(e, "resolveASTSchemaCoordinate", {
		enumerable: !0,
		get: function() {
			return l.resolveASTSchemaCoordinate;
		}
	}), Object.defineProperty(e, "resolveObjMapThunk", {
		enumerable: !0,
		get: function() {
			return i.resolveObjMapThunk;
		}
	}), Object.defineProperty(e, "resolveReadonlyArrayThunk", {
		enumerable: !0,
		get: function() {
			return i.resolveReadonlyArrayThunk;
		}
	}), Object.defineProperty(e, "resolveSchemaCoordinate", {
		enumerable: !0,
		get: function() {
			return l.resolveSchemaCoordinate;
		}
	}), Object.defineProperty(e, "responsePathAsArray", {
		enumerable: !0,
		get: function() {
			return o.responsePathAsArray;
		}
	}), Object.defineProperty(e, "separateOperations", {
		enumerable: !0,
		get: function() {
			return l.separateOperations;
		}
	}), Object.defineProperty(e, "specifiedDirectives", {
		enumerable: !0,
		get: function() {
			return i.specifiedDirectives;
		}
	}), Object.defineProperty(e, "specifiedRules", {
		enumerable: !0,
		get: function() {
			return s.specifiedRules;
		}
	}), Object.defineProperty(e, "specifiedScalarTypes", {
		enumerable: !0,
		get: function() {
			return i.specifiedScalarTypes;
		}
	}), Object.defineProperty(e, "stripIgnoredCharacters", {
		enumerable: !0,
		get: function() {
			return l.stripIgnoredCharacters;
		}
	}), Object.defineProperty(e, "subscribe", {
		enumerable: !0,
		get: function() {
			return o.subscribe;
		}
	}), Object.defineProperty(e, "syntaxError", {
		enumerable: !0,
		get: function() {
			return c.syntaxError;
		}
	}), Object.defineProperty(e, "typeFromAST", {
		enumerable: !0,
		get: function() {
			return l.typeFromAST;
		}
	}), Object.defineProperty(e, "validate", {
		enumerable: !0,
		get: function() {
			return s.validate;
		}
	}), Object.defineProperty(e, "validateSchema", {
		enumerable: !0,
		get: function() {
			return i.validateSchema;
		}
	}), Object.defineProperty(e, "valueFromAST", {
		enumerable: !0,
		get: function() {
			return l.valueFromAST;
		}
	}), Object.defineProperty(e, "valueFromASTUntyped", {
		enumerable: !0,
		get: function() {
			return l.valueFromASTUntyped;
		}
	}), Object.defineProperty(e, "version", {
		enumerable: !0,
		get: function() {
			return n.version;
		}
	}), Object.defineProperty(e, "versionInfo", {
		enumerable: !0,
		get: function() {
			return n.versionInfo;
		}
	}), Object.defineProperty(e, "visit", {
		enumerable: !0,
		get: function() {
			return a.visit;
		}
	}), Object.defineProperty(e, "visitInParallel", {
		enumerable: !0,
		get: function() {
			return a.visitInParallel;
		}
	}), Object.defineProperty(e, "visitWithTypeInfo", {
		enumerable: !0,
		get: function() {
			return l.visitWithTypeInfo;
		}
	});
	var n = require_version(), r = require_graphql$1(), i = require_type(), a = require_language(), o = require_execution(), s = require_validation(), c = require_error(), l = require_utilities();
})), DocumentUri;
(function(e) {
	function n(e) {
		return typeof e == "string";
	}
	e.is = n;
})(DocumentUri ||= {});
var URI$1;
(function(e) {
	function n(e) {
		return typeof e == "string";
	}
	e.is = n;
})(URI$1 ||= {});
var integer;
(function(e) {
	e.MIN_VALUE = -2147483648, e.MAX_VALUE = 2147483647;
	function n(n) {
		return typeof n == "number" && e.MIN_VALUE <= n && n <= e.MAX_VALUE;
	}
	e.is = n;
})(integer ||= {});
var uinteger;
(function(e) {
	e.MIN_VALUE = 0, e.MAX_VALUE = 2147483647;
	function n(n) {
		return typeof n == "number" && e.MIN_VALUE <= n && n <= e.MAX_VALUE;
	}
	e.is = n;
})(uinteger ||= {});
var Position$2;
(function(e) {
	function n(e, n) {
		return e === Number.MAX_VALUE && (e = uinteger.MAX_VALUE), n === Number.MAX_VALUE && (n = uinteger.MAX_VALUE), {
			line: e,
			character: n
		};
	}
	e.create = n;
	function r(e) {
		let n = e;
		return Is.objectLiteral(n) && Is.uinteger(n.line) && Is.uinteger(n.character);
	}
	e.is = r;
})(Position$2 ||= {});
var Range$2;
(function(e) {
	function n(e, n, r, i) {
		if (Is.uinteger(e) && Is.uinteger(n) && Is.uinteger(r) && Is.uinteger(i)) return {
			start: Position$2.create(e, n),
			end: Position$2.create(r, i)
		};
		if (Position$2.is(e) && Position$2.is(n)) return {
			start: e,
			end: n
		};
		throw Error(`Range#create called with invalid arguments[${e}, ${n}, ${r}, ${i}]`);
	}
	e.create = n;
	function r(e) {
		let n = e;
		return Is.objectLiteral(n) && Position$2.is(n.start) && Position$2.is(n.end);
	}
	e.is = r;
})(Range$2 ||= {});
var Location;
(function(e) {
	function n(e, n) {
		return {
			uri: e,
			range: n
		};
	}
	e.create = n;
	function r(e) {
		let n = e;
		return Is.objectLiteral(n) && Range$2.is(n.range) && (Is.string(n.uri) || Is.undefined(n.uri));
	}
	e.is = r;
})(Location ||= {});
var LocationLink;
(function(e) {
	function n(e, n, r, i) {
		return {
			targetUri: e,
			targetRange: n,
			targetSelectionRange: r,
			originSelectionRange: i
		};
	}
	e.create = n;
	function r(e) {
		let n = e;
		return Is.objectLiteral(n) && Range$2.is(n.targetRange) && Is.string(n.targetUri) && Range$2.is(n.targetSelectionRange) && (Range$2.is(n.originSelectionRange) || Is.undefined(n.originSelectionRange));
	}
	e.is = r;
})(LocationLink ||= {});
var Color$1;
(function(e) {
	function n(e, n, r, i) {
		return {
			red: e,
			green: n,
			blue: r,
			alpha: i
		};
	}
	e.create = n;
	function r(e) {
		let n = e;
		return Is.objectLiteral(n) && Is.numberRange(n.red, 0, 1) && Is.numberRange(n.green, 0, 1) && Is.numberRange(n.blue, 0, 1) && Is.numberRange(n.alpha, 0, 1);
	}
	e.is = r;
})(Color$1 ||= {});
var ColorInformation;
(function(e) {
	function n(e, n) {
		return {
			range: e,
			color: n
		};
	}
	e.create = n;
	function r(e) {
		let n = e;
		return Is.objectLiteral(n) && Range$2.is(n.range) && Color$1.is(n.color);
	}
	e.is = r;
})(ColorInformation ||= {});
var ColorPresentation;
(function(e) {
	function n(e, n, r) {
		return {
			label: e,
			textEdit: n,
			additionalTextEdits: r
		};
	}
	e.create = n;
	function r(e) {
		let n = e;
		return Is.objectLiteral(n) && Is.string(n.label) && (Is.undefined(n.textEdit) || TextEdit$1.is(n)) && (Is.undefined(n.additionalTextEdits) || Is.typedArray(n.additionalTextEdits, TextEdit$1.is));
	}
	e.is = r;
})(ColorPresentation ||= {});
var FoldingRangeKind$1;
(function(e) {
	e.Comment = "comment", e.Imports = "imports", e.Region = "region";
})(FoldingRangeKind$1 ||= {});
var FoldingRange;
(function(e) {
	function n(e, n, r, i, a, o) {
		let s = {
			startLine: e,
			endLine: n
		};
		return Is.defined(r) && (s.startCharacter = r), Is.defined(i) && (s.endCharacter = i), Is.defined(a) && (s.kind = a), Is.defined(o) && (s.collapsedText = o), s;
	}
	e.create = n;
	function r(e) {
		let n = e;
		return Is.objectLiteral(n) && Is.uinteger(n.startLine) && Is.uinteger(n.startLine) && (Is.undefined(n.startCharacter) || Is.uinteger(n.startCharacter)) && (Is.undefined(n.endCharacter) || Is.uinteger(n.endCharacter)) && (Is.undefined(n.kind) || Is.string(n.kind));
	}
	e.is = r;
})(FoldingRange ||= {});
var DiagnosticRelatedInformation;
(function(e) {
	function n(e, n) {
		return {
			location: e,
			message: n
		};
	}
	e.create = n;
	function r(e) {
		let n = e;
		return Is.defined(n) && Location.is(n.location) && Is.string(n.message);
	}
	e.is = r;
})(DiagnosticRelatedInformation ||= {});
var DiagnosticSeverity;
(function(e) {
	e.Error = 1, e.Warning = 2, e.Information = 3, e.Hint = 4;
})(DiagnosticSeverity ||= {});
var DiagnosticTag;
(function(e) {
	e.Unnecessary = 1, e.Deprecated = 2;
})(DiagnosticTag ||= {});
var CodeDescription;
(function(e) {
	function n(e) {
		let n = e;
		return Is.objectLiteral(n) && Is.string(n.href);
	}
	e.is = n;
})(CodeDescription ||= {});
var Diagnostic;
(function(e) {
	function n(e, n, r, i, a, o) {
		let s = {
			range: e,
			message: n
		};
		return Is.defined(r) && (s.severity = r), Is.defined(i) && (s.code = i), Is.defined(a) && (s.source = a), Is.defined(o) && (s.relatedInformation = o), s;
	}
	e.create = n;
	function r(e) {
		let n = e;
		return Is.defined(n) && Range$2.is(n.range) && Is.string(n.message) && (Is.number(n.severity) || Is.undefined(n.severity)) && (Is.integer(n.code) || Is.string(n.code) || Is.undefined(n.code)) && (Is.undefined(n.codeDescription) || Is.string(n.codeDescription?.href)) && (Is.string(n.source) || Is.undefined(n.source)) && (Is.undefined(n.relatedInformation) || Is.typedArray(n.relatedInformation, DiagnosticRelatedInformation.is));
	}
	e.is = r;
})(Diagnostic ||= {});
var Command;
(function(e) {
	function n(e, n, ...r) {
		let i = {
			title: e,
			command: n
		};
		return Is.defined(r) && r.length > 0 && (i.arguments = r), i;
	}
	e.create = n;
	function r(e) {
		let n = e;
		return Is.defined(n) && Is.string(n.title) && Is.string(n.command);
	}
	e.is = r;
})(Command ||= {});
var TextEdit$1;
(function(e) {
	function n(e, n) {
		return {
			range: e,
			newText: n
		};
	}
	e.replace = n;
	function r(e, n) {
		return {
			range: {
				start: e,
				end: e
			},
			newText: n
		};
	}
	e.insert = r;
	function i(e) {
		return {
			range: e,
			newText: ""
		};
	}
	e.del = i;
	function a(e) {
		let n = e;
		return Is.objectLiteral(n) && Is.string(n.newText) && Range$2.is(n.range);
	}
	e.is = a;
})(TextEdit$1 ||= {});
var ChangeAnnotation;
(function(e) {
	function n(e, n, r) {
		let i = { label: e };
		return n !== void 0 && (i.needsConfirmation = n), r !== void 0 && (i.description = r), i;
	}
	e.create = n;
	function r(e) {
		let n = e;
		return Is.objectLiteral(n) && Is.string(n.label) && (Is.boolean(n.needsConfirmation) || n.needsConfirmation === void 0) && (Is.string(n.description) || n.description === void 0);
	}
	e.is = r;
})(ChangeAnnotation ||= {});
var ChangeAnnotationIdentifier;
(function(e) {
	function n(e) {
		let n = e;
		return Is.string(n);
	}
	e.is = n;
})(ChangeAnnotationIdentifier ||= {});
var AnnotatedTextEdit;
(function(e) {
	function n(e, n, r) {
		return {
			range: e,
			newText: n,
			annotationId: r
		};
	}
	e.replace = n;
	function r(e, n, r) {
		return {
			range: {
				start: e,
				end: e
			},
			newText: n,
			annotationId: r
		};
	}
	e.insert = r;
	function i(e, n) {
		return {
			range: e,
			newText: "",
			annotationId: n
		};
	}
	e.del = i;
	function a(e) {
		let n = e;
		return TextEdit$1.is(n) && (ChangeAnnotation.is(n.annotationId) || ChangeAnnotationIdentifier.is(n.annotationId));
	}
	e.is = a;
})(AnnotatedTextEdit ||= {});
var TextDocumentEdit;
(function(e) {
	function n(e, n) {
		return {
			textDocument: e,
			edits: n
		};
	}
	e.create = n;
	function r(e) {
		let n = e;
		return Is.defined(n) && OptionalVersionedTextDocumentIdentifier.is(n.textDocument) && Array.isArray(n.edits);
	}
	e.is = r;
})(TextDocumentEdit ||= {});
var CreateFile;
(function(e) {
	function n(e, n, r) {
		let i = {
			kind: "create",
			uri: e
		};
		return n !== void 0 && (n.overwrite !== void 0 || n.ignoreIfExists !== void 0) && (i.options = n), r !== void 0 && (i.annotationId = r), i;
	}
	e.create = n;
	function r(e) {
		let n = e;
		return n && n.kind === "create" && Is.string(n.uri) && (n.options === void 0 || (n.options.overwrite === void 0 || Is.boolean(n.options.overwrite)) && (n.options.ignoreIfExists === void 0 || Is.boolean(n.options.ignoreIfExists))) && (n.annotationId === void 0 || ChangeAnnotationIdentifier.is(n.annotationId));
	}
	e.is = r;
})(CreateFile ||= {});
var RenameFile;
(function(e) {
	function n(e, n, r, i) {
		let a = {
			kind: "rename",
			oldUri: e,
			newUri: n
		};
		return r !== void 0 && (r.overwrite !== void 0 || r.ignoreIfExists !== void 0) && (a.options = r), i !== void 0 && (a.annotationId = i), a;
	}
	e.create = n;
	function r(e) {
		let n = e;
		return n && n.kind === "rename" && Is.string(n.oldUri) && Is.string(n.newUri) && (n.options === void 0 || (n.options.overwrite === void 0 || Is.boolean(n.options.overwrite)) && (n.options.ignoreIfExists === void 0 || Is.boolean(n.options.ignoreIfExists))) && (n.annotationId === void 0 || ChangeAnnotationIdentifier.is(n.annotationId));
	}
	e.is = r;
})(RenameFile ||= {});
var DeleteFile;
(function(e) {
	function n(e, n, r) {
		let i = {
			kind: "delete",
			uri: e
		};
		return n !== void 0 && (n.recursive !== void 0 || n.ignoreIfNotExists !== void 0) && (i.options = n), r !== void 0 && (i.annotationId = r), i;
	}
	e.create = n;
	function r(e) {
		let n = e;
		return n && n.kind === "delete" && Is.string(n.uri) && (n.options === void 0 || (n.options.recursive === void 0 || Is.boolean(n.options.recursive)) && (n.options.ignoreIfNotExists === void 0 || Is.boolean(n.options.ignoreIfNotExists))) && (n.annotationId === void 0 || ChangeAnnotationIdentifier.is(n.annotationId));
	}
	e.is = r;
})(DeleteFile ||= {});
var WorkspaceEdit;
(function(e) {
	function n(e) {
		let n = e;
		return n && (n.changes !== void 0 || n.documentChanges !== void 0) && (n.documentChanges === void 0 || n.documentChanges.every((e) => Is.string(e.kind) ? CreateFile.is(e) || RenameFile.is(e) || DeleteFile.is(e) : TextDocumentEdit.is(e)));
	}
	e.is = n;
})(WorkspaceEdit ||= {});
var TextDocumentIdentifier;
(function(e) {
	function n(e) {
		return { uri: e };
	}
	e.create = n;
	function r(e) {
		let n = e;
		return Is.defined(n) && Is.string(n.uri);
	}
	e.is = r;
})(TextDocumentIdentifier ||= {});
var VersionedTextDocumentIdentifier;
(function(e) {
	function n(e, n) {
		return {
			uri: e,
			version: n
		};
	}
	e.create = n;
	function r(e) {
		let n = e;
		return Is.defined(n) && Is.string(n.uri) && Is.integer(n.version);
	}
	e.is = r;
})(VersionedTextDocumentIdentifier ||= {});
var OptionalVersionedTextDocumentIdentifier;
(function(e) {
	function n(e, n) {
		return {
			uri: e,
			version: n
		};
	}
	e.create = n;
	function r(e) {
		let n = e;
		return Is.defined(n) && Is.string(n.uri) && (n.version === null || Is.integer(n.version));
	}
	e.is = r;
})(OptionalVersionedTextDocumentIdentifier ||= {});
var TextDocumentItem;
(function(e) {
	function n(e, n, r, i) {
		return {
			uri: e,
			languageId: n,
			version: r,
			text: i
		};
	}
	e.create = n;
	function r(e) {
		let n = e;
		return Is.defined(n) && Is.string(n.uri) && Is.string(n.languageId) && Is.integer(n.version) && Is.string(n.text);
	}
	e.is = r;
})(TextDocumentItem ||= {});
var MarkupKind;
(function(e) {
	e.PlainText = "plaintext", e.Markdown = "markdown";
	function n(n) {
		let r = n;
		return r === e.PlainText || r === e.Markdown;
	}
	e.is = n;
})(MarkupKind ||= {});
var MarkupContent;
(function(e) {
	function n(e) {
		let n = e;
		return Is.objectLiteral(e) && MarkupKind.is(n.kind) && Is.string(n.value);
	}
	e.is = n;
})(MarkupContent ||= {});
var CompletionItemKind$1;
(function(e) {
	e.Text = 1, e.Method = 2, e.Function = 3, e.Constructor = 4, e.Field = 5, e.Variable = 6, e.Class = 7, e.Interface = 8, e.Module = 9, e.Property = 10, e.Unit = 11, e.Value = 12, e.Enum = 13, e.Keyword = 14, e.Snippet = 15, e.Color = 16, e.File = 17, e.Reference = 18, e.Folder = 19, e.EnumMember = 20, e.Constant = 21, e.Struct = 22, e.Event = 23, e.Operator = 24, e.TypeParameter = 25;
})(CompletionItemKind$1 ||= {});
var InsertTextFormat;
(function(e) {
	e.PlainText = 1, e.Snippet = 2;
})(InsertTextFormat ||= {});
var CompletionItemTag;
(function(e) {
	e.Deprecated = 1;
})(CompletionItemTag ||= {});
var InsertReplaceEdit;
(function(e) {
	function n(e, n, r) {
		return {
			newText: e,
			insert: n,
			replace: r
		};
	}
	e.create = n;
	function r(e) {
		let n = e;
		return n && Is.string(n.newText) && Range$2.is(n.insert) && Range$2.is(n.replace);
	}
	e.is = r;
})(InsertReplaceEdit ||= {});
var InsertTextMode;
(function(e) {
	e.asIs = 1, e.adjustIndentation = 2;
})(InsertTextMode ||= {});
var CompletionItemLabelDetails;
(function(e) {
	function n(e) {
		let n = e;
		return n && (Is.string(n.detail) || n.detail === void 0) && (Is.string(n.description) || n.description === void 0);
	}
	e.is = n;
})(CompletionItemLabelDetails ||= {});
var CompletionItem$1;
(function(e) {
	function n(e) {
		return { label: e };
	}
	e.create = n;
})(CompletionItem$1 ||= {});
var CompletionList;
(function(e) {
	function n(e, n) {
		return {
			items: e || [],
			isIncomplete: !!n
		};
	}
	e.create = n;
})(CompletionList ||= {});
var MarkedString;
(function(e) {
	function n(e) {
		return e.replace(/[\\`*_{}[\]()#+\-.!]/g, "\\$&");
	}
	e.fromPlainText = n;
	function r(e) {
		let n = e;
		return Is.string(n) || Is.objectLiteral(n) && Is.string(n.language) && Is.string(n.value);
	}
	e.is = r;
})(MarkedString ||= {});
var Hover;
(function(e) {
	function n(e) {
		let n = e;
		return !!n && Is.objectLiteral(n) && (MarkupContent.is(n.contents) || MarkedString.is(n.contents) || Is.typedArray(n.contents, MarkedString.is)) && (e.range === void 0 || Range$2.is(e.range));
	}
	e.is = n;
})(Hover ||= {});
var ParameterInformation;
(function(e) {
	function n(e, n) {
		return n ? {
			label: e,
			documentation: n
		} : { label: e };
	}
	e.create = n;
})(ParameterInformation ||= {});
var SignatureInformation;
(function(e) {
	function n(e, n, ...r) {
		let i = { label: e };
		return Is.defined(n) && (i.documentation = n), Is.defined(r) ? i.parameters = r : i.parameters = [], i;
	}
	e.create = n;
})(SignatureInformation ||= {});
var DocumentHighlightKind$1;
(function(e) {
	e.Text = 1, e.Read = 2, e.Write = 3;
})(DocumentHighlightKind$1 ||= {});
var DocumentHighlight;
(function(e) {
	function n(e, n) {
		let r = { range: e };
		return Is.number(n) && (r.kind = n), r;
	}
	e.create = n;
})(DocumentHighlight ||= {});
var SymbolKind;
(function(e) {
	e.File = 1, e.Module = 2, e.Namespace = 3, e.Package = 4, e.Class = 5, e.Method = 6, e.Property = 7, e.Field = 8, e.Constructor = 9, e.Enum = 10, e.Interface = 11, e.Function = 12, e.Variable = 13, e.Constant = 14, e.String = 15, e.Number = 16, e.Boolean = 17, e.Array = 18, e.Object = 19, e.Key = 20, e.Null = 21, e.EnumMember = 22, e.Struct = 23, e.Event = 24, e.Operator = 25, e.TypeParameter = 26;
})(SymbolKind ||= {});
var SymbolTag;
(function(e) {
	e.Deprecated = 1;
})(SymbolTag ||= {});
var SymbolInformation;
(function(e) {
	function n(e, n, r, i, a) {
		let o = {
			name: e,
			kind: n,
			location: {
				uri: i,
				range: r
			}
		};
		return a && (o.containerName = a), o;
	}
	e.create = n;
})(SymbolInformation ||= {});
var WorkspaceSymbol;
(function(e) {
	function n(e, n, r, i) {
		return i === void 0 ? {
			name: e,
			kind: n,
			location: { uri: r }
		} : {
			name: e,
			kind: n,
			location: {
				uri: r,
				range: i
			}
		};
	}
	e.create = n;
})(WorkspaceSymbol ||= {});
var DocumentSymbol;
(function(e) {
	function n(e, n, r, i, a, o) {
		let s = {
			name: e,
			detail: n,
			kind: r,
			range: i,
			selectionRange: a
		};
		return o !== void 0 && (s.children = o), s;
	}
	e.create = n;
	function r(e) {
		let n = e;
		return n && Is.string(n.name) && Is.number(n.kind) && Range$2.is(n.range) && Range$2.is(n.selectionRange) && (n.detail === void 0 || Is.string(n.detail)) && (n.deprecated === void 0 || Is.boolean(n.deprecated)) && (n.children === void 0 || Array.isArray(n.children)) && (n.tags === void 0 || Array.isArray(n.tags));
	}
	e.is = r;
})(DocumentSymbol ||= {});
var CodeActionKind$1;
(function(e) {
	e.Empty = "", e.QuickFix = "quickfix", e.Refactor = "refactor", e.RefactorExtract = "refactor.extract", e.RefactorInline = "refactor.inline", e.RefactorRewrite = "refactor.rewrite", e.Source = "source", e.SourceOrganizeImports = "source.organizeImports", e.SourceFixAll = "source.fixAll";
})(CodeActionKind$1 ||= {});
var CodeActionTriggerKind;
(function(e) {
	e.Invoked = 1, e.Automatic = 2;
})(CodeActionTriggerKind ||= {});
var CodeActionContext;
(function(e) {
	function n(e, n, r) {
		let i = { diagnostics: e };
		return n != null && (i.only = n), r != null && (i.triggerKind = r), i;
	}
	e.create = n;
	function r(e) {
		let n = e;
		return Is.defined(n) && Is.typedArray(n.diagnostics, Diagnostic.is) && (n.only === void 0 || Is.typedArray(n.only, Is.string)) && (n.triggerKind === void 0 || n.triggerKind === CodeActionTriggerKind.Invoked || n.triggerKind === CodeActionTriggerKind.Automatic);
	}
	e.is = r;
})(CodeActionContext ||= {});
var CodeAction;
(function(e) {
	function n(e, n, r) {
		let i = { title: e }, a = !0;
		return typeof n == "string" ? (a = !1, i.kind = n) : Command.is(n) ? i.command = n : i.edit = n, a && r !== void 0 && (i.kind = r), i;
	}
	e.create = n;
	function r(e) {
		let n = e;
		return n && Is.string(n.title) && (n.diagnostics === void 0 || Is.typedArray(n.diagnostics, Diagnostic.is)) && (n.kind === void 0 || Is.string(n.kind)) && (n.edit !== void 0 || n.command !== void 0) && (n.command === void 0 || Command.is(n.command)) && (n.isPreferred === void 0 || Is.boolean(n.isPreferred)) && (n.edit === void 0 || WorkspaceEdit.is(n.edit));
	}
	e.is = r;
})(CodeAction ||= {});
var CodeLens;
(function(e) {
	function n(e, n) {
		let r = { range: e };
		return Is.defined(n) && (r.data = n), r;
	}
	e.create = n;
	function r(e) {
		let n = e;
		return Is.defined(n) && Range$2.is(n.range) && (Is.undefined(n.command) || Command.is(n.command));
	}
	e.is = r;
})(CodeLens ||= {});
var FormattingOptions;
(function(e) {
	function n(e, n) {
		return {
			tabSize: e,
			insertSpaces: n
		};
	}
	e.create = n;
	function r(e) {
		let n = e;
		return Is.defined(n) && Is.uinteger(n.tabSize) && Is.boolean(n.insertSpaces);
	}
	e.is = r;
})(FormattingOptions ||= {});
var DocumentLink;
(function(e) {
	function n(e, n, r) {
		return {
			range: e,
			target: n,
			data: r
		};
	}
	e.create = n;
	function r(e) {
		let n = e;
		return Is.defined(n) && Range$2.is(n.range) && (Is.undefined(n.target) || Is.string(n.target));
	}
	e.is = r;
})(DocumentLink ||= {});
var SelectionRange;
(function(e) {
	function n(e, n) {
		return {
			range: e,
			parent: n
		};
	}
	e.create = n;
	function r(n) {
		let r = n;
		return Is.objectLiteral(r) && Range$2.is(r.range) && (r.parent === void 0 || e.is(r.parent));
	}
	e.is = r;
})(SelectionRange ||= {});
var SemanticTokenTypes;
(function(e) {
	e.namespace = "namespace", e.type = "type", e.class = "class", e.enum = "enum", e.interface = "interface", e.struct = "struct", e.typeParameter = "typeParameter", e.parameter = "parameter", e.variable = "variable", e.property = "property", e.enumMember = "enumMember", e.event = "event", e.function = "function", e.method = "method", e.macro = "macro", e.keyword = "keyword", e.modifier = "modifier", e.comment = "comment", e.string = "string", e.number = "number", e.regexp = "regexp", e.operator = "operator", e.decorator = "decorator";
})(SemanticTokenTypes ||= {});
var SemanticTokenModifiers;
(function(e) {
	e.declaration = "declaration", e.definition = "definition", e.readonly = "readonly", e.static = "static", e.deprecated = "deprecated", e.abstract = "abstract", e.async = "async", e.modification = "modification", e.documentation = "documentation", e.defaultLibrary = "defaultLibrary";
})(SemanticTokenModifiers ||= {});
var SemanticTokens;
(function(e) {
	function n(e) {
		let n = e;
		return Is.objectLiteral(n) && (n.resultId === void 0 || typeof n.resultId == "string") && Array.isArray(n.data) && (n.data.length === 0 || typeof n.data[0] == "number");
	}
	e.is = n;
})(SemanticTokens ||= {});
var InlineValueText;
(function(e) {
	function n(e, n) {
		return {
			range: e,
			text: n
		};
	}
	e.create = n;
	function r(e) {
		let n = e;
		return n != null && Range$2.is(n.range) && Is.string(n.text);
	}
	e.is = r;
})(InlineValueText ||= {});
var InlineValueVariableLookup;
(function(e) {
	function n(e, n, r) {
		return {
			range: e,
			variableName: n,
			caseSensitiveLookup: r
		};
	}
	e.create = n;
	function r(e) {
		let n = e;
		return n != null && Range$2.is(n.range) && Is.boolean(n.caseSensitiveLookup) && (Is.string(n.variableName) || n.variableName === void 0);
	}
	e.is = r;
})(InlineValueVariableLookup ||= {});
var InlineValueEvaluatableExpression;
(function(e) {
	function n(e, n) {
		return {
			range: e,
			expression: n
		};
	}
	e.create = n;
	function r(e) {
		let n = e;
		return n != null && Range$2.is(n.range) && (Is.string(n.expression) || n.expression === void 0);
	}
	e.is = r;
})(InlineValueEvaluatableExpression ||= {});
var InlineValueContext;
(function(e) {
	function n(e, n) {
		return {
			frameId: e,
			stoppedLocation: n
		};
	}
	e.create = n;
	function r(e) {
		let n = e;
		return Is.defined(n) && Range$2.is(e.stoppedLocation);
	}
	e.is = r;
})(InlineValueContext ||= {});
var InlayHintKind;
(function(e) {
	e.Type = 1, e.Parameter = 2;
	function n(e) {
		return e === 1 || e === 2;
	}
	e.is = n;
})(InlayHintKind ||= {});
var InlayHintLabelPart;
(function(e) {
	function n(e) {
		return { value: e };
	}
	e.create = n;
	function r(e) {
		let n = e;
		return Is.objectLiteral(n) && (n.tooltip === void 0 || Is.string(n.tooltip) || MarkupContent.is(n.tooltip)) && (n.location === void 0 || Location.is(n.location)) && (n.command === void 0 || Command.is(n.command));
	}
	e.is = r;
})(InlayHintLabelPart ||= {});
var InlayHint;
(function(e) {
	function n(e, n, r) {
		let i = {
			position: e,
			label: n
		};
		return r !== void 0 && (i.kind = r), i;
	}
	e.create = n;
	function r(e) {
		let n = e;
		return Is.objectLiteral(n) && Position$2.is(n.position) && (Is.string(n.label) || Is.typedArray(n.label, InlayHintLabelPart.is)) && (n.kind === void 0 || InlayHintKind.is(n.kind)) && n.textEdits === void 0 || Is.typedArray(n.textEdits, TextEdit$1.is) && (n.tooltip === void 0 || Is.string(n.tooltip) || MarkupContent.is(n.tooltip)) && (n.paddingLeft === void 0 || Is.boolean(n.paddingLeft)) && (n.paddingRight === void 0 || Is.boolean(n.paddingRight));
	}
	e.is = r;
})(InlayHint ||= {});
var StringValue;
(function(e) {
	function n(e) {
		return {
			kind: "snippet",
			value: e
		};
	}
	e.createSnippet = n;
})(StringValue ||= {});
var InlineCompletionItem$1;
(function(e) {
	function n(e, n, r, i) {
		return {
			insertText: e,
			filterText: n,
			range: r,
			command: i
		};
	}
	e.create = n;
})(InlineCompletionItem$1 ||= {});
var InlineCompletionList$1;
(function(e) {
	function n(e) {
		return { items: e };
	}
	e.create = n;
})(InlineCompletionList$1 ||= {});
var InlineCompletionTriggerKind$1;
(function(e) {
	e.Invoked = 0, e.Automatic = 1;
})(InlineCompletionTriggerKind$1 ||= {});
var SelectedCompletionInfo;
(function(e) {
	function n(e, n) {
		return {
			range: e,
			text: n
		};
	}
	e.create = n;
})(SelectedCompletionInfo ||= {});
var InlineCompletionContext;
(function(e) {
	function n(e, n) {
		return {
			triggerKind: e,
			selectedCompletionInfo: n
		};
	}
	e.create = n;
})(InlineCompletionContext ||= {});
var WorkspaceFolder;
(function(e) {
	function n(e) {
		let n = e;
		return Is.objectLiteral(n) && URI$1.is(n.uri) && Is.string(n.name);
	}
	e.is = n;
})(WorkspaceFolder ||= {});
var TextDocument;
(function(e) {
	function n(e, n, r, i) {
		return new FullTextDocument(e, n, r, i);
	}
	e.create = n;
	function r(e) {
		let n = e;
		return !!(Is.defined(n) && Is.string(n.uri) && (Is.undefined(n.languageId) || Is.string(n.languageId)) && Is.uinteger(n.lineCount) && Is.func(n.getText) && Is.func(n.positionAt) && Is.func(n.offsetAt));
	}
	e.is = r;
	function i(e, n) {
		let r = e.getText(), i = a(n, (e, n) => {
			let r = e.range.start.line - n.range.start.line;
			return r === 0 ? e.range.start.character - n.range.start.character : r;
		}), o = r.length;
		for (let n = i.length - 1; n >= 0; n--) {
			let a = i[n], s = e.offsetAt(a.range.start), c = e.offsetAt(a.range.end);
			if (c <= o) r = r.substring(0, s) + a.newText + r.substring(c, r.length);
			else throw Error("Overlapping edit");
			o = s;
		}
		return r;
	}
	e.applyEdits = i;
	function a(e, n) {
		if (e.length <= 1) return e;
		let r = e.length / 2 | 0, i = e.slice(0, r), o = e.slice(r);
		a(i, n), a(o, n);
		let s = 0, c = 0, l = 0;
		for (; s < i.length && c < o.length;) n(i[s], o[c]) <= 0 ? e[l++] = i[s++] : e[l++] = o[c++];
		for (; s < i.length;) e[l++] = i[s++];
		for (; c < o.length;) e[l++] = o[c++];
		return e;
	}
})(TextDocument ||= {});
var FullTextDocument = class {
	constructor(e, n, r, i) {
		this._uri = e, this._languageId = n, this._version = r, this._content = i, this._lineOffsets = void 0;
	}
	get uri() {
		return this._uri;
	}
	get languageId() {
		return this._languageId;
	}
	get version() {
		return this._version;
	}
	getText(e) {
		if (e) {
			let n = this.offsetAt(e.start), r = this.offsetAt(e.end);
			return this._content.substring(n, r);
		}
		return this._content;
	}
	update(e, n) {
		this._content = e.text, this._version = n, this._lineOffsets = void 0;
	}
	getLineOffsets() {
		if (this._lineOffsets === void 0) {
			let e = [], n = this._content, r = !0;
			for (let i = 0; i < n.length; i++) {
				r &&= (e.push(i), !1);
				let a = n.charAt(i);
				r = a === "\r" || a === "\n", a === "\r" && i + 1 < n.length && n.charAt(i + 1) === "\n" && i++;
			}
			r && n.length > 0 && e.push(n.length), this._lineOffsets = e;
		}
		return this._lineOffsets;
	}
	positionAt(e) {
		e = Math.max(Math.min(e, this._content.length), 0);
		let n = this.getLineOffsets(), r = 0, i = n.length;
		if (i === 0) return Position$2.create(0, e);
		for (; r < i;) {
			let a = Math.floor((r + i) / 2);
			n[a] > e ? i = a : r = a + 1;
		}
		let a = r - 1;
		return Position$2.create(a, e - n[a]);
	}
	offsetAt(e) {
		let n = this.getLineOffsets();
		if (e.line >= n.length) return this._content.length;
		if (e.line < 0) return 0;
		let r = n[e.line], i = e.line + 1 < n.length ? n[e.line + 1] : this._content.length;
		return Math.max(Math.min(r + e.character, i), r);
	}
	get lineCount() {
		return this.getLineOffsets().length;
	}
}, Is;
(function(e) {
	let n = Object.prototype.toString;
	function r(e) {
		return e !== void 0;
	}
	e.defined = r;
	function i(e) {
		return e === void 0;
	}
	e.undefined = i;
	function a(e) {
		return e === !0 || e === !1;
	}
	e.boolean = a;
	function o(e) {
		return n.call(e) === "[object String]";
	}
	e.string = o;
	function s(e) {
		return n.call(e) === "[object Number]";
	}
	e.number = s;
	function c(e, r, i) {
		return n.call(e) === "[object Number]" && r <= e && e <= i;
	}
	e.numberRange = c;
	function l(e) {
		return n.call(e) === "[object Number]" && -2147483648 <= e && e <= 2147483647;
	}
	e.integer = l;
	function u(e) {
		return n.call(e) === "[object Number]" && 0 <= e && e <= 2147483647;
	}
	e.uinteger = u;
	function d(e) {
		return n.call(e) === "[object Function]";
	}
	e.func = d;
	function f(e) {
		return typeof e == "object" && !!e;
	}
	e.objectLiteral = f;
	function m(e, n) {
		return Array.isArray(e) && e.every(n);
	}
	e.typedArray = m;
})(Is ||= {});
var CharacterStream = class {
	constructor(e) {
		this._start = 0, this._pos = 0, this.getStartOfToken = () => this._start, this.getCurrentPosition = () => this._pos, this.eol = () => this._sourceText.length === this._pos, this.sol = () => this._pos === 0, this.peek = () => this._sourceText.charAt(this._pos) || null, this.next = () => {
			let e = this._sourceText.charAt(this._pos);
			return this._pos++, e;
		}, this.eat = (e) => {
			if (this._testNextCharacter(e)) return this._start = this._pos, this._pos++, this._sourceText.charAt(this._pos - 1);
		}, this.eatWhile = (e) => {
			let n = this._testNextCharacter(e), r = !1;
			for (n && (r = n, this._start = this._pos); n;) this._pos++, n = this._testNextCharacter(e), r = !0;
			return r;
		}, this.eatSpace = () => this.eatWhile(/[\s\u00a0]/), this.skipToEnd = () => {
			this._pos = this._sourceText.length;
		}, this.skipTo = (e) => {
			this._pos = e;
		}, this.match = (e, n = !0, r = !1) => {
			let i = null, a = null;
			return typeof e == "string" ? (a = new RegExp(e, r ? "i" : "g").test(this._sourceText.slice(this._pos, this._pos + e.length)), i = e) : e instanceof RegExp && (a = this._sourceText.slice(this._pos).match(e), i = a?.[0]), a != null && (typeof e == "string" || a instanceof Array && this._sourceText.startsWith(a[0], this._pos)) ? (n && (this._start = this._pos, i && i.length && (this._pos += i.length)), a) : !1;
		}, this.backUp = (e) => {
			this._pos -= e;
		}, this.column = () => this._pos, this.indentation = () => {
			let e = this._sourceText.match(/\s*/), n = 0;
			if (e && e.length !== 0) {
				let r = e[0], i = 0;
				for (; r.length > i;) r.charCodeAt(i) === 9 ? n += 2 : n++, i++;
			}
			return n;
		}, this.current = () => this._sourceText.slice(this._start, this._pos), this._sourceText = e;
	}
	_testNextCharacter(e) {
		let n = this._sourceText.charAt(this._pos), r = !1;
		return r = typeof e == "string" ? n === e : e instanceof RegExp ? e.test(n) : e(n), r;
	}
};
function opt(e) {
	return { ofRule: e };
}
function list(e, n) {
	return {
		ofRule: e,
		isList: !0,
		separator: n
	};
}
function butNot(e, n) {
	let r = e.match;
	return e.match = (e) => {
		let i = !1;
		return r && (i = r(e)), i && n.every((n) => n.match && !n.match(e));
	}, e;
}
function t(e, n) {
	return {
		style: n,
		match: (n) => n.kind === e
	};
}
function p(e, n) {
	return {
		style: n || "punctuation",
		match: (n) => n.kind === "Punctuation" && n.value === e
	};
}
var import_graphql$5 = /* @__PURE__ */ __toESM(require_graphql());
const isIgnored = (e) => e === " " || e === "	" || e === "," || e === "\n" || e === "\r" || e === "" || e === "\xA0", LexRules = {
	Name: /^[_A-Za-z][_0-9A-Za-z]*/,
	Punctuation: /^(?:!|\$|\(|\)|\.\.\.|:|=|&|@|\[|]|\{|\||\})/,
	Number: /^-?(?:0|(?:[1-9][0-9]*))(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?/,
	String: /^(?:"""(?:\\"""|[^"]|"[^"]|""[^"])*(?:""")?|"(?:[^"\\]|\\(?:"|\/|\\|b|f|n|r|t|u[0-9a-fA-F]{4}))*"?)/,
	Comment: /^#.*/
}, ParseRules = {
	Document: [list("Definition")],
	Definition(e) {
		switch (e.value) {
			case "{": return "ShortQuery";
			case "query": return "Query";
			case "mutation": return "Mutation";
			case "subscription": return "Subscription";
			case "fragment": return import_graphql$5.Kind.FRAGMENT_DEFINITION;
			case "schema": return "SchemaDef";
			case "scalar": return "ScalarDef";
			case "type": return "ObjectTypeDef";
			case "interface": return "InterfaceDef";
			case "union": return "UnionDef";
			case "enum": return "EnumDef";
			case "input": return "InputDef";
			case "extend": return "ExtendDef";
			case "directive": return "DirectiveDef";
		}
	},
	ShortQuery: ["SelectionSet"],
	Query: [
		word("query"),
		opt(name("def")),
		opt("VariableDefinitions"),
		list("Directive"),
		"SelectionSet"
	],
	Mutation: [
		word("mutation"),
		opt(name("def")),
		opt("VariableDefinitions"),
		list("Directive"),
		"SelectionSet"
	],
	Subscription: [
		word("subscription"),
		opt(name("def")),
		opt("VariableDefinitions"),
		list("Directive"),
		"SelectionSet"
	],
	VariableDefinitions: [
		p("("),
		list("VariableDefinition"),
		p(")")
	],
	VariableDefinition: [
		"Variable",
		p(":"),
		"Type",
		opt("DefaultValue")
	],
	Variable: [p("$", "variable"), name("variable")],
	DefaultValue: [p("="), "Value"],
	SelectionSet: [
		p("{"),
		list("Selection"),
		p("}")
	],
	Selection(e, n) {
		return e.value === "..." ? n.match(/[\s\u00a0,]*(on\b|@|{)/, !1) ? "InlineFragment" : "FragmentSpread" : n.match(/[\s\u00a0,]*:/, !1) ? "AliasedField" : "Field";
	},
	AliasedField: [
		name("property"),
		p(":"),
		name("qualifier"),
		opt("Arguments"),
		list("Directive"),
		opt("SelectionSet")
	],
	Field: [
		name("property"),
		opt("Arguments"),
		list("Directive"),
		opt("SelectionSet")
	],
	Arguments: [
		p("("),
		list("Argument"),
		p(")")
	],
	Argument: [
		name("attribute"),
		p(":"),
		"Value"
	],
	FragmentSpread: [
		p("..."),
		name("def"),
		list("Directive")
	],
	InlineFragment: [
		p("..."),
		opt("TypeCondition"),
		list("Directive"),
		"SelectionSet"
	],
	FragmentDefinition: [
		word("fragment"),
		opt(butNot(name("def"), [word("on")])),
		"TypeCondition",
		list("Directive"),
		"SelectionSet"
	],
	TypeCondition: [word("on"), "NamedType"],
	Value(e) {
		switch (e.kind) {
			case "Number": return "NumberValue";
			case "String": return "StringValue";
			case "Punctuation":
				switch (e.value) {
					case "[": return "ListValue";
					case "{": return "ObjectValue";
					case "$": return "Variable";
					case "&": return "NamedType";
				}
				return null;
			case "Name":
				switch (e.value) {
					case "true":
					case "false": return "BooleanValue";
				}
				return e.value === "null" ? "NullValue" : "EnumValue";
		}
	},
	NumberValue: [t("Number", "number")],
	StringValue: [{
		style: "string",
		match: (e) => e.kind === "String",
		update(e, n) {
			n.value.startsWith("\"\"\"") && (e.inBlockstring = !n.value.slice(3).endsWith("\"\"\""));
		}
	}],
	BooleanValue: [t("Name", "builtin")],
	NullValue: [t("Name", "keyword")],
	EnumValue: [name("string-2")],
	ListValue: [
		p("["),
		list("Value"),
		p("]")
	],
	ObjectValue: [
		p("{"),
		list("ObjectField"),
		p("}")
	],
	ObjectField: [
		name("attribute"),
		p(":"),
		"Value"
	],
	Type(e) {
		return e.value === "[" ? "ListType" : "NonNullType";
	},
	ListType: [
		p("["),
		"Type",
		p("]"),
		opt(p("!"))
	],
	NonNullType: ["NamedType", opt(p("!"))],
	NamedType: [type("atom")],
	Directive: [
		p("@", "meta"),
		name("meta"),
		opt("Arguments")
	],
	DirectiveDef: [
		word("directive"),
		p("@", "meta"),
		name("meta"),
		opt("ArgumentsDef"),
		word("on"),
		list("DirectiveLocation", p("|"))
	],
	InterfaceDef: [
		word("interface"),
		name("atom"),
		opt("Implements"),
		list("Directive"),
		p("{"),
		list("FieldDef"),
		p("}")
	],
	Implements: [word("implements"), list("NamedType", p("&"))],
	DirectiveLocation: [name("string-2")],
	SchemaDef: [
		word("schema"),
		list("Directive"),
		p("{"),
		list("OperationTypeDef"),
		p("}")
	],
	OperationTypeDef: [
		name("keyword"),
		p(":"),
		name("atom")
	],
	ScalarDef: [
		word("scalar"),
		name("atom"),
		list("Directive")
	],
	ObjectTypeDef: [
		word("type"),
		name("atom"),
		opt("Implements"),
		list("Directive"),
		p("{"),
		list("FieldDef"),
		p("}")
	],
	FieldDef: [
		name("property"),
		opt("ArgumentsDef"),
		p(":"),
		"Type",
		list("Directive")
	],
	ArgumentsDef: [
		p("("),
		list("InputValueDef"),
		p(")")
	],
	InputValueDef: [
		name("attribute"),
		p(":"),
		"Type",
		opt("DefaultValue"),
		list("Directive")
	],
	UnionDef: [
		word("union"),
		name("atom"),
		list("Directive"),
		p("="),
		list("UnionMember", p("|"))
	],
	UnionMember: ["NamedType"],
	EnumDef: [
		word("enum"),
		name("atom"),
		list("Directive"),
		p("{"),
		list("EnumValueDef"),
		p("}")
	],
	EnumValueDef: [name("string-2"), list("Directive")],
	InputDef: [
		word("input"),
		name("atom"),
		list("Directive"),
		p("{"),
		list("InputValueDef"),
		p("}")
	],
	ExtendDef: [word("extend"), "ExtensionDefinition"],
	ExtensionDefinition(e) {
		switch (e.value) {
			case "schema": return import_graphql$5.Kind.SCHEMA_EXTENSION;
			case "scalar": return import_graphql$5.Kind.SCALAR_TYPE_EXTENSION;
			case "type": return import_graphql$5.Kind.OBJECT_TYPE_EXTENSION;
			case "interface": return import_graphql$5.Kind.INTERFACE_TYPE_EXTENSION;
			case "union": return import_graphql$5.Kind.UNION_TYPE_EXTENSION;
			case "enum": return import_graphql$5.Kind.ENUM_TYPE_EXTENSION;
			case "input": return import_graphql$5.Kind.INPUT_OBJECT_TYPE_EXTENSION;
		}
	},
	[import_graphql$5.Kind.SCHEMA_EXTENSION]: ["SchemaDef"],
	[import_graphql$5.Kind.SCALAR_TYPE_EXTENSION]: ["ScalarDef"],
	[import_graphql$5.Kind.OBJECT_TYPE_EXTENSION]: ["ObjectTypeDef"],
	[import_graphql$5.Kind.INTERFACE_TYPE_EXTENSION]: ["InterfaceDef"],
	[import_graphql$5.Kind.UNION_TYPE_EXTENSION]: ["UnionDef"],
	[import_graphql$5.Kind.ENUM_TYPE_EXTENSION]: ["EnumDef"],
	[import_graphql$5.Kind.INPUT_OBJECT_TYPE_EXTENSION]: ["InputDef"]
};
function word(e) {
	return {
		style: "keyword",
		match: (n) => n.kind === "Name" && n.value === e
	};
}
function name(e) {
	return {
		style: e,
		match: (e) => e.kind === "Name",
		update(e, n) {
			e.name = n.value;
		}
	};
}
function type(e) {
	return {
		style: e,
		match: (e) => e.kind === "Name",
		update(e, n) {
			e.prevState?.prevState && (e.name = n.value, e.prevState.prevState.type = n.value);
		}
	};
}
var import_graphql$4 = /* @__PURE__ */ __toESM(require_graphql());
function onlineParser(e = {
	eatWhitespace: (e) => e.eatWhile(isIgnored),
	lexRules: LexRules,
	parseRules: ParseRules,
	editorConfig: {}
}) {
	return {
		startState() {
			let n = {
				level: 0,
				step: 0,
				name: null,
				kind: null,
				type: null,
				rule: null,
				needsSeparator: !1,
				prevState: null
			};
			return pushRule(e.parseRules, n, import_graphql$4.Kind.DOCUMENT), n;
		},
		token(n, r) {
			return getToken(n, r, e);
		}
	};
}
function getToken(e, n, r) {
	if (n.inBlockstring) return e.match(/.*"""/) ? (n.inBlockstring = !1, "string") : (e.skipToEnd(), "string");
	let { lexRules: i, parseRules: a, eatWhitespace: o, editorConfig: s } = r;
	if (n.rule && n.rule.length === 0 ? popRule(n) : n.needsAdvance && (n.needsAdvance = !1, advanceRule(n, !0)), e.sol()) {
		let r = s?.tabSize || 2;
		n.indentLevel = Math.floor(e.indentation() / r);
	}
	if (o(e)) return "ws";
	let c = lex(i, e);
	if (!c) return e.match(/\S+/) || e.match(/\s/), pushRule(SpecialParseRules, n, "Invalid"), "invalidchar";
	if (c.kind === "Comment") return pushRule(SpecialParseRules, n, "Comment"), "comment";
	let l = assign({}, n);
	if (c.kind === "Punctuation") {
		if (/^[{([]/.test(c.value)) n.indentLevel !== void 0 && (n.levels = (n.levels || []).concat(n.indentLevel + 1));
		else if (/^[})\]]/.test(c.value)) {
			let e = n.levels = (n.levels || []).slice(0, -1);
			n.indentLevel && e.length > 0 && e.at(-1) < n.indentLevel && (n.indentLevel = e.at(-1));
		}
	}
	for (; n.rule;) {
		let r = typeof n.rule == "function" ? n.step === 0 ? n.rule(c, e) : null : n.rule[n.step];
		if (n.needsSeparator && (r = r?.separator), r) {
			if (r.ofRule && (r = r.ofRule), typeof r == "string") {
				pushRule(a, n, r);
				continue;
			}
			if (r.match?.call(r, c)) return r.update && r.update(n, c), c.kind === "Punctuation" ? advanceRule(n, !0) : n.needsAdvance = !0, r.style;
		}
		unsuccessful(n);
	}
	return assign(n, l), pushRule(SpecialParseRules, n, "Invalid"), "invalidchar";
}
function assign(e, n) {
	let r = Object.keys(n);
	for (let i = 0; i < r.length; i++) e[r[i]] = n[r[i]];
	return e;
}
var SpecialParseRules = {
	Invalid: [],
	Comment: []
};
function pushRule(e, n, r) {
	if (!e[r]) throw TypeError("Unknown rule: " + r);
	n.prevState = Object.assign({}, n), n.kind = r, n.name = null, n.type = null, n.rule = e[r], n.step = 0, n.needsSeparator = !1;
}
function popRule(e) {
	e.prevState &&= (e.kind = e.prevState.kind, e.name = e.prevState.name, e.type = e.prevState.type, e.rule = e.prevState.rule, e.step = e.prevState.step, e.needsSeparator = e.prevState.needsSeparator, e.prevState.prevState);
}
function advanceRule(e, n) {
	if (isList(e) && e.rule) {
		let r = e.rule[e.step];
		if (r.separator) {
			let { separator: n } = r;
			if (e.needsSeparator = !e.needsSeparator, !e.needsSeparator && n.ofRule) return;
		}
		if (n) return;
	}
	for (e.needsSeparator = !1, e.step++; e.rule && !(Array.isArray(e.rule) && e.step < e.rule.length);) popRule(e), e.rule && (isList(e) ? e.rule?.[e.step].separator && (e.needsSeparator = !e.needsSeparator) : (e.needsSeparator = !1, e.step++));
}
function isList(e) {
	let n = Array.isArray(e.rule) && typeof e.rule[e.step] != "string" && e.rule[e.step];
	return n && n.isList;
}
function unsuccessful(e) {
	for (; e.rule && !(Array.isArray(e.rule) && e.rule[e.step].ofRule);) popRule(e);
	e.rule && advanceRule(e, !1);
}
function lex(e, n) {
	let r = Object.keys(e);
	for (let i = 0; i < r.length; i++) {
		let a = n.match(e[r[i]]);
		if (a && a instanceof Array) return {
			kind: r[i],
			value: a[0]
		};
	}
}
var import_graphql$3 = /* @__PURE__ */ __toESM(require_graphql());
function runOnlineParser(e, n) {
	let r = e.split("\n"), i = onlineParser(), a = i.startState(), o = "", s = new CharacterStream("");
	for (let e = 0; e < r.length; e++) {
		for (s = new CharacterStream(r[e]); !s.eol() && (o = i.token(s, a), n(s, a, o, e) !== "BREAK"););
		n(s, a, o, e), a.kind || (a = i.startState());
	}
	return {
		start: s.getStartOfToken(),
		end: s.getCurrentPosition(),
		string: s.current(),
		state: a,
		style: o
	};
}
var GraphQLDocumentMode;
(function(e) {
	e.TYPE_SYSTEM = "TYPE_SYSTEM", e.EXECUTABLE = "EXECUTABLE", e.UNKNOWN = "UNKNOWN";
})(GraphQLDocumentMode ||= {});
const TYPE_SYSTEM_KINDS = [
	import_graphql$3.Kind.SCHEMA_DEFINITION,
	import_graphql$3.Kind.OPERATION_TYPE_DEFINITION,
	import_graphql$3.Kind.SCALAR_TYPE_DEFINITION,
	import_graphql$3.Kind.OBJECT_TYPE_DEFINITION,
	import_graphql$3.Kind.INTERFACE_TYPE_DEFINITION,
	import_graphql$3.Kind.UNION_TYPE_DEFINITION,
	import_graphql$3.Kind.ENUM_TYPE_DEFINITION,
	import_graphql$3.Kind.INPUT_OBJECT_TYPE_DEFINITION,
	import_graphql$3.Kind.DIRECTIVE_DEFINITION,
	import_graphql$3.Kind.SCHEMA_EXTENSION,
	import_graphql$3.Kind.SCALAR_TYPE_EXTENSION,
	import_graphql$3.Kind.OBJECT_TYPE_EXTENSION,
	import_graphql$3.Kind.INTERFACE_TYPE_EXTENSION,
	import_graphql$3.Kind.UNION_TYPE_EXTENSION,
	import_graphql$3.Kind.ENUM_TYPE_EXTENSION,
	import_graphql$3.Kind.INPUT_OBJECT_TYPE_EXTENSION
];
var getParsedMode = (e) => {
	let n = GraphQLDocumentMode.UNKNOWN;
	if (e) try {
		(0, import_graphql$3.visit)((0, import_graphql$3.parse)(e), { enter(e) {
			if (e.kind === "Document") {
				n = GraphQLDocumentMode.EXECUTABLE;
				return;
			}
			return TYPE_SYSTEM_KINDS.includes(e.kind) ? (n = GraphQLDocumentMode.TYPE_SYSTEM, import_graphql$3.BREAK) : !1;
		} });
	} catch {
		return n;
	}
	return n;
};
function getDocumentMode(e, n) {
	return n?.endsWith(".graphqls") ? GraphQLDocumentMode.TYPE_SYSTEM : getParsedMode(e);
}
function getTokenAtPosition(e, n, r = 0) {
	let i = null, a = null, o = null, s = runOnlineParser(e, (e, s, c, l) => {
		if (!(l !== n.line || e.getCurrentPosition() + r < n.character + 1)) return i = c, a = Object.assign({}, s), o = e.current(), "BREAK";
	});
	return {
		start: s.start,
		end: s.end,
		string: o || s.string,
		state: a || s.state,
		style: i || s.style
	};
}
function getContextAtPosition(e, n, r, i, a) {
	let o = i || getTokenAtPosition(e, n, 1);
	if (!o) return null;
	let s = o.state.kind === "Invalid" ? o.state.prevState : o.state;
	if (!s) return null;
	let c = getTypeInfo(r, o.state), l = a?.mode || getDocumentMode(e, a?.uri);
	return {
		token: o,
		state: s,
		typeInfo: c,
		mode: l
	};
}
var import_graphql$2 = /* @__PURE__ */ __toESM(require_graphql());
function getFieldDef(e, n, r) {
	return r === import_graphql$2.SchemaMetaFieldDef.name && e.getQueryType() === n ? import_graphql$2.SchemaMetaFieldDef : r === import_graphql$2.TypeMetaFieldDef.name && e.getQueryType() === n ? import_graphql$2.TypeMetaFieldDef : r === import_graphql$2.TypeNameMetaFieldDef.name && (0, import_graphql$2.isCompositeType)(n) ? import_graphql$2.TypeNameMetaFieldDef : "getFields" in n ? n.getFields()[r] : null;
}
function forEachState(e, n) {
	let r = [], i = e;
	for (; i?.kind;) r.push(i), i = i.prevState;
	for (let e = r.length - 1; e >= 0; e--) n(r[e]);
}
function getTypeInfo(e, n) {
	let r, i, a, o, s, c, l, u, d, f, m;
	return forEachState(n, (n) => {
		switch (n.kind) {
			case RuleKinds.QUERY:
			case "ShortQuery":
				f = e.getQueryType();
				break;
			case RuleKinds.MUTATION:
				f = e.getMutationType();
				break;
			case RuleKinds.SUBSCRIPTION:
				f = e.getSubscriptionType();
				break;
			case RuleKinds.INLINE_FRAGMENT:
			case RuleKinds.FRAGMENT_DEFINITION:
				n.type && (f = e.getType(n.type));
				break;
			case RuleKinds.FIELD:
			case RuleKinds.ALIASED_FIELD:
				!f || !n.name ? s = null : (s = d ? getFieldDef(e, d, n.name) : null, f = s ? s.type : null);
				break;
			case RuleKinds.SELECTION_SET:
				d = (0, import_graphql$2.getNamedType)(f);
				break;
			case RuleKinds.DIRECTIVE:
				a = n.name ? e.getDirective(n.name) : null;
				break;
			case RuleKinds.INTERFACE_DEF:
				n.name && (l = null, m = new import_graphql$2.GraphQLInterfaceType({
					name: n.name,
					interfaces: [],
					fields: {}
				}));
				break;
			case RuleKinds.OBJECT_TYPE_DEF:
				n.name && (m = null, l = new import_graphql$2.GraphQLObjectType({
					name: n.name,
					interfaces: [],
					fields: {}
				}));
				break;
			case RuleKinds.ARGUMENTS:
				if (n.prevState) switch (n.prevState.kind) {
					case RuleKinds.FIELD:
						i = s && s.args;
						break;
					case RuleKinds.DIRECTIVE:
						i = a && a.args;
						break;
					case RuleKinds.ALIASED_FIELD: {
						let r = n.prevState?.name;
						if (!r) {
							i = null;
							break;
						}
						let a = d ? getFieldDef(e, d, r) : null;
						if (!a) {
							i = null;
							break;
						}
						i = a.args;
						break;
					}
					default:
						i = null;
						break;
				}
				else i = null;
				break;
			case RuleKinds.ARGUMENT:
				if (i) {
					for (let e = 0; e < i.length; e++) if (i[e].name === n.name) {
						r = i[e];
						break;
					}
				}
				c = r?.type;
				break;
			case RuleKinds.VARIABLE_DEFINITION:
			case RuleKinds.VARIABLE:
				f = c;
				break;
			case RuleKinds.ENUM_VALUE:
				let g = (0, import_graphql$2.getNamedType)(c);
				o = g instanceof import_graphql$2.GraphQLEnumType ? g.getValues().find((e) => e.value === n.name) : null;
				break;
			case RuleKinds.LIST_VALUE:
				let _ = (0, import_graphql$2.getNullableType)(c);
				c = _ instanceof import_graphql$2.GraphQLList ? _.ofType : null;
				break;
			case RuleKinds.OBJECT_VALUE:
				let v = (0, import_graphql$2.getNamedType)(c);
				u = v instanceof import_graphql$2.GraphQLInputObjectType ? v.getFields() : null;
				break;
			case RuleKinds.OBJECT_FIELD:
				let y = n.name && u ? u[n.name] : null;
				c = y?.type, s = y, f = s ? s.type : null;
				break;
			case RuleKinds.NAMED_TYPE:
				n.name && (f = e.getType(n.name));
				break;
		}
	}), {
		argDef: r,
		argDefs: i,
		directiveDef: a,
		enumValue: o,
		fieldDef: s,
		inputType: c,
		objectFieldDefs: u,
		parentType: d,
		type: f,
		interfaceDef: m,
		objectTypeDef: l
	};
}
var import_graphql$1 = /* @__PURE__ */ __toESM(require_graphql());
const RuleKinds = Object.assign(Object.assign({}, import_graphql$1.Kind), {
	ALIASED_FIELD: "AliasedField",
	ARGUMENTS: "Arguments",
	SHORT_QUERY: "ShortQuery",
	QUERY: "Query",
	MUTATION: "Mutation",
	SUBSCRIPTION: "Subscription",
	TYPE_CONDITION: "TypeCondition",
	INVALID: "Invalid",
	COMMENT: "Comment",
	SCHEMA_DEF: "SchemaDef",
	SCALAR_DEF: "ScalarDef",
	OBJECT_TYPE_DEF: "ObjectTypeDef",
	OBJECT_VALUE: "ObjectValue",
	LIST_VALUE: "ListValue",
	INTERFACE_DEF: "InterfaceDef",
	UNION_DEF: "UnionDef",
	ENUM_DEF: "EnumDef",
	ENUM_VALUE: "EnumValue",
	FIELD_DEF: "FieldDef",
	INPUT_DEF: "InputDef",
	INPUT_VALUE_DEF: "InputValueDef",
	ARGUMENTS_DEF: "ArgumentsDef",
	EXTEND_DEF: "ExtendDef",
	EXTENSION_DEFINITION: "ExtensionDefinition",
	DIRECTIVE_DEF: "DirectiveDef",
	IMPLEMENTS: "Implements",
	VARIABLE_DEFINITIONS: "VariableDefinitions",
	TYPE: "Type",
	VARIABLE: "Variable"
});
var CompletionItemKind;
(function(e) {
	e.Text = 1, e.Method = 2, e.Function = 3, e.Constructor = 4, e.Field = 5, e.Variable = 6, e.Class = 7, e.Interface = 8, e.Module = 9, e.Property = 10, e.Unit = 11, e.Value = 12, e.Enum = 13, e.Keyword = 14, e.Snippet = 15, e.Color = 16, e.File = 17, e.Reference = 18, e.Folder = 19, e.EnumMember = 20, e.Constant = 21, e.Struct = 22, e.Event = 23, e.Operator = 24, e.TypeParameter = 25;
})(CompletionItemKind ||= {}), CompletionItemKind.Function, CompletionItemKind.Function, CompletionItemKind.Function, CompletionItemKind.Function, CompletionItemKind.Function, CompletionItemKind.Function, CompletionItemKind.Function, CompletionItemKind.Function, CompletionItemKind.Function, CompletionItemKind.Function, CompletionItemKind.Constructor, (/* @__PURE__ */ __commonJSMin(((e, n) => {
	function r(e, n) {
		if (e != null) return e;
		var r = Error(n === void 0 ? "Got unexpected " + e : n);
		throw r.framesToPop = 1, r;
	}
	n.exports = r, n.exports.default = r, Object.defineProperty(n.exports, "__esModule", { value: !0 });
})))();
var Position$1 = class {
	constructor(e, n) {
		this.lessThanOrEqualTo = (e) => this.line < e.line || this.line === e.line && this.character <= e.character, this.line = e, this.character = n;
	}
	setLine(e) {
		this.line = e;
	}
	setCharacter(e) {
		this.character = e;
	}
};
const SEVERITY = {
	Error: "Error",
	Warning: "Warning",
	Information: "Information",
	Hint: "Hint"
};
SEVERITY.Error, SEVERITY.Warning, SEVERITY.Information, SEVERITY.Hint;
var import_graphql = /* @__PURE__ */ __toESM(require_graphql());
function getHoverInformation(e, n, r, i, a) {
	let o = Object.assign(Object.assign({}, a), { schema: e }), s = getContextAtPosition(n, r, e, i);
	if (!s) return "";
	let { typeInfo: c, token: l } = s, { kind: u, step: d } = l.state;
	if (u === "Field" && d === 0 && c.fieldDef || u === "AliasedField" && d === 2 && c.fieldDef || u === "ObjectField" && d === 0 && c.fieldDef) {
		let e = [];
		return renderMdCodeStart(e, o), renderField(e, c, o), renderMdCodeEnd(e, o), renderDescription(e, o, c.fieldDef), e.join("").trim();
	}
	if (u === "Directive" && d === 1 && c.directiveDef) {
		let e = [];
		return renderMdCodeStart(e, o), renderDirective(e, c, o), renderMdCodeEnd(e, o), renderDescription(e, o, c.directiveDef), e.join("").trim();
	}
	if (u === "Variable" && c.type) {
		let e = [];
		return renderMdCodeStart(e, o), renderType(e, c, o, c.type), renderMdCodeEnd(e, o), renderDescription(e, o, c.type), e.join("").trim();
	}
	if (u === "Argument" && d === 0 && c.argDef) {
		let e = [];
		return renderMdCodeStart(e, o), renderArg(e, c, o), renderMdCodeEnd(e, o), renderDescription(e, o, c.argDef), e.join("").trim();
	}
	if (u === "EnumValue" && c.enumValue && "description" in c.enumValue) {
		let e = [];
		return renderMdCodeStart(e, o), renderEnumValue(e, c, o), renderMdCodeEnd(e, o), renderDescription(e, o, c.enumValue), e.join("").trim();
	}
	if (u === "NamedType" && c.type && "description" in c.type) {
		let e = [];
		return renderMdCodeStart(e, o), renderType(e, c, o, c.type), renderMdCodeEnd(e, o), renderDescription(e, o, c.type), e.join("").trim();
	}
	return "";
}
function renderMdCodeStart(e, n) {
	n.useMarkdown && text(e, "```graphql\n");
}
function renderMdCodeEnd(e, n) {
	n.useMarkdown && text(e, "\n```");
}
function renderField(e, n, r) {
	renderQualifiedField(e, n, r), renderTypeAnnotation(e, n, r, n.type);
}
function renderQualifiedField(e, n, r) {
	if (!n.fieldDef) return;
	let i = n.fieldDef.name;
	i.slice(0, 2) !== "__" && (renderType(e, n, r, n.parentType), text(e, ".")), text(e, i);
}
function renderDirective(e, n, r) {
	if (!n.directiveDef) return;
	let i = "@" + n.directiveDef.name;
	text(e, i);
}
function renderArg(e, n, r) {
	if (n.directiveDef ? renderDirective(e, n, r) : n.fieldDef && renderQualifiedField(e, n, r), !n.argDef) return;
	let { name: i } = n.argDef;
	text(e, "("), text(e, i), renderTypeAnnotation(e, n, r, n.inputType), text(e, ")");
}
function renderTypeAnnotation(e, n, r, i) {
	text(e, ": "), renderType(e, n, r, i);
}
function renderEnumValue(e, n, r) {
	if (!n.enumValue) return;
	let { name: i } = n.enumValue;
	renderType(e, n, r, n.inputType), text(e, "."), text(e, i);
}
function renderType(e, n, r, i) {
	i && (i instanceof import_graphql.GraphQLNonNull ? (renderType(e, n, r, i.ofType), text(e, "!")) : i instanceof import_graphql.GraphQLList ? (text(e, "["), renderType(e, n, r, i.ofType), text(e, "]")) : text(e, i.name));
}
function renderDescription(e, n, r) {
	if (!r) return;
	let i = typeof r.description == "string" ? r.description : null;
	i && (text(e, "\n\n"), text(e, i)), renderDeprecation(e, n, r);
}
function renderDeprecation(e, n, r) {
	if (!r) return;
	let i = r.deprecationReason;
	i && (text(e, "\n\n"), text(e, "Deprecated: "), text(e, i));
}
function text(e, n) {
	e.push(n);
}
/*!-----------------------------------------------------------------------------
* 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, n, r, i) => {
	if (n && typeof n == "object" || typeof n == "function") for (let a of __getOwnPropNames(n)) !__hasOwnProp.call(e, a) && a !== r && __defProp(e, a, {
		get: () => n[a],
		enumerable: !(i = __getOwnPropDesc(n, a)) || i.enumerable
	});
	return e;
}, __reExport = (e, n, r) => (__copyProps(e, n, "default"), r && __copyProps(r, n, "default")), monaco_editor_core_exports = {};
__reExport(monaco_editor_core_exports, editor_api_exports);
var languageDefinitions = {}, lazyLanguageLoaders = {}, LazyLanguageLoader = class e {
	static getOrCreate(n) {
		return lazyLanguageLoaders[n] || (lazyLanguageLoaders[n] = new e(n)), lazyLanguageLoaders[n];
	}
	constructor(e) {
		this._languageId = e, this._loadingTriggered = !1, this._lazyLoadPromise = new Promise((e, n) => {
			this._lazyLoadPromiseResolve = e, this._lazyLoadPromiseReject = n;
		});
	}
	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 n = e.id;
	languageDefinitions[n] = e, monaco_editor_core_exports.languages.register(e);
	let r = LazyLanguageLoader.getOrCreate(n);
	monaco_editor_core_exports.languages.registerTokensProviderFactory(n, { create: async () => (await r.load()).language }), monaco_editor_core_exports.languages.onLanguageEncountered(n, async () => {
		let e = await r.load();
		monaco_editor_core_exports.languages.setLanguageConfiguration(n, 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, ...n) {
		let r = e.get(IConfigurationService), i = !r.getValue("diffEditor.hideUnchangedRegions.enabled");
		r.updateValue("diffEditor.hideUnchangedRegions.enabled", i);
	}
}, ToggleShowMovedCodeBlocks = class extends Action2 {
	constructor() {
		super({
			id: "diffEditor.toggleShowMovedCodeBlocks",
			title: localize2("toggleShowMovedCodeBlocks", "Toggle Show Moved Code Blocks"),
			precondition: ContextKeyExpr.has("isInDiffEditor")
		});
	}
	run(e, ...n) {
		let r = e.get(IConfigurationService), i = !r.getValue("diffEditor.experimental.showMoves");
		r.updateValue("diffEditor.experimental.showMoves", i);
	}
}, 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, ...n) {
		let r = e.get(IConfigurationService), i = !r.getValue("diffEditor.useInlineViewWhenSpaceIsLimited");
		r.updateValue("diffEditor.useInlineViewWhenSpaceIsLimited", i);
	}
}, 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, n, r) {
		let i = findFocusedDiffEditor(e);
		if (i instanceof DiffEditorWidget) {
			if (r && r.dryRun) return { destinationSelection: i.mapToOtherSide().destinationSelection };
			i.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, n, ...r) {
		let i = findFocusedDiffEditor(e);
		i instanceof DiffEditorWidget && i.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, n, ...r) {
		let i = findFocusedDiffEditor(e);
		i instanceof DiffEditorWidget && i.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, n, ...r) {
		let i = findFocusedDiffEditor(e);
		i instanceof DiffEditorWidget && i.showAllUnchangedRegions();
	}
}, RevertHunkOrSelection = class extends Action2 {
	constructor() {
		super({
			id: "diffEditor.revert",
			title: localize2("revert", "Revert"),
			f1: !1,
			category: diffEditorCategory
		});
	}
	run(e, n) {
		let r = findDiffEditor(e, n.originalUri, n.modifiedUri);
		r instanceof DiffEditorWidget && r.revertRangeMappings(n.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, n, r) {
	return e.get(ICodeEditorService).listDiffEditors().find((e) => {
		let i = e.getModifiedEditor(), a = e.getOriginalEditor();
		return i && i.getModel()?.uri.toString() === r.toString() && a && a.getModel()?.uri.toString() === n.toString();
	}) || null;
}
function findFocusedDiffEditor(e) {
	let n = e.get(ICodeEditorService).listDiffEditors(), r = getActiveElement();
	if (r) for (let e of n) {
		let n = e.getContainerDomNode();
		if (isElementOrParentOf(n, r)) return e;
	}
	return null;
}
function isElementOrParentOf(e, n) {
	let r = n;
	for (; r;) {
		if (r === e) return !0;
		r = r.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, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$102 = function(e, n) {
	return function(r, i) {
		n(r, i, 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, n) {
		this.editor = e, this.selectionAnchorSetContextKey = SelectionAnchorSet.bindTo(n), this.modelChangeListener = e.onDidChangeModel(() => this.selectionAnchorSetContextKey.reset());
	}
	setSelectionAnchor() {
		if (this.editor.hasModel()) {
			let e = this.editor.getPosition();
			this.editor.changeDecorations((n) => {
				this.decorationId && n.removeDecoration(this.decorationId), this.decorationId = n.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 n = this.editor.getPosition();
				this.editor.setSelection(Selection.fromPositions(e.getStartPosition(), n)), this.cancelSelectionAnchor();
			}
		}
	}
	cancelSelectionAnchor() {
		if (this.decorationId) {
			let e = this.decorationId;
			this.editor.changeDecorations((n) => {
				n.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, n) {
		SelectionAnchorController.get(n)?.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, n) {
		SelectionAnchorController.get(n)?.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, n) {
		SelectionAnchorController.get(n)?.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, n) {
		SelectionAnchorController.get(n)?.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, n) {
		BracketMatchingController.get(n)?.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, n, r) {
		let i = !0;
		r && r.selectBrackets === !1 && (i = !1), BracketMatchingController.get(n)?.selectToBracket(i);
	}
}, 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, n) {
		BracketMatchingController.get(n)?.removeBrackets(this.id);
	}
}, BracketsData = class {
	constructor(e, n, r) {
		this.position = e, this.brackets = n, this.options = r;
	}
}, BracketMatchingController = class e extends Disposable {
	static {
		this.ID = "editor.contrib.bracketMatchingController";
	}
	static get(n) {
		return n.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(), n = this._editor.getSelections().map((n) => {
			let r = n.getStartPosition(), i = e.bracketPairs.matchBracket(r), a = null;
			if (i) i[0].containsPosition(r) && !i[1].containsPosition(r) ? a = i[1].getStartPosition() : i[1].containsPosition(r) && (a = i[0].getStartPosition());
			else {
				let n = e.bracketPairs.findEnclosingBrackets(r);
				if (n) a = n[1].getStartPosition();
				else {
					let n = e.bracketPairs.findNextBracket(r);
					n && n.range && (a = n.range.getStartPosition());
				}
			}
			return a ? new Selection(a.lineNumber, a.column, a.lineNumber, a.column) : new Selection(r.lineNumber, r.column, r.lineNumber, r.column);
		});
		this._editor.setSelections(n), this._editor.revealRange(n[0]);
	}
	selectToBracket(e) {
		if (!this._editor.hasModel()) return;
		let n = this._editor.getModel(), r = [];
		this._editor.getSelections().forEach((i) => {
			let a = i.getStartPosition(), o = n.bracketPairs.matchBracket(a);
			if (!o && (o = n.bracketPairs.findEnclosingBrackets(a), !o)) {
				let e = n.bracketPairs.findNextBracket(a);
				e && e.range && (o = n.bracketPairs.matchBracket(e.range.getStartPosition()));
			}
			let s = null, c = null;
			if (o) {
				o.sort(Range.compareRangesUsingStarts);
				let [n, r] = o;
				if (s = e ? n.getStartPosition() : n.getEndPosition(), c = e ? r.getEndPosition() : r.getStartPosition(), r.containsPosition(a)) {
					let e = s;
					s = c, c = e;
				}
			}
			s && c && r.push(new Selection(s.lineNumber, s.column, c.lineNumber, c.column));
		}), r.length > 0 && (this._editor.setSelections(r), this._editor.revealRange(r[0]));
	}
	removeBrackets(e) {
		if (!this._editor.hasModel()) return;
		let n = this._editor.getModel();
		this._editor.getSelections().forEach((r) => {
			let i = r.getPosition(), a = n.bracketPairs.matchBracket(i);
			a ||= n.bracketPairs.findEnclosingBrackets(i), a && (this._editor.pushUndoStop(), this._editor.executeEdits(e, [{
				range: a[0],
				text: ""
			}, {
				range: a[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 = [], n = 0;
		for (let r of this._lastBracketsData) {
			let i = r.brackets;
			i && (e[n++] = {
				range: i[0],
				options: r.options
			}, e[n++] = {
				range: i[1],
				options: r.options
			});
		}
		this._decorations.set(e);
	}
	_recomputeBrackets() {
		if (!this._editor.hasModel() || !this._editor.hasWidgetFocus()) {
			this._lastBracketsData = [], this._lastVersionId = 0;
			return;
		}
		let n = this._editor.getSelections();
		if (n.length > 100) {
			this._lastBracketsData = [], this._lastVersionId = 0;
			return;
		}
		let r = this._editor.getModel(), i = r.getVersionId(), a = [];
		this._lastVersionId === i && (a = this._lastBracketsData);
		let o = [], s = 0;
		for (let e = 0, r = n.length; e < r; e++) {
			let r = n[e];
			r.isEmpty() && (o[s++] = r.getStartPosition());
		}
		o.length > 1 && o.sort(Position.compare);
		let c = [], l = 0, u = 0, d = a.length;
		for (let n = 0, i = o.length; n < i; n++) {
			let i = o[n];
			for (; u < d && a[u].position.isBefore(i);) u++;
			if (u < d && a[u].position.equals(i)) c[l++] = a[u];
			else {
				let n = r.bracketPairs.matchBracket(i, 20), a = e._DECORATION_OPTIONS_WITH_OVERVIEW_RULER;
				!n && this._matchBrackets === "always" && (n = r.bracketPairs.findEnclosingBrackets(i, 20), a = e._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER), c[l++] = new BracketsData(i, n, a);
			}
		}
		this._lastBracketsData = c, this._lastVersionId = i;
	}
};
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, n) {
		this._selection = e, this._isMovingLeft = n;
	}
	getEditOperations(e, n) {
		if (this._selection.startLineNumber !== this._selection.endLineNumber || this._selection.isEmpty()) return;
		let r = this._selection.startLineNumber, i = this._selection.startColumn, a = this._selection.endColumn;
		if (!(this._isMovingLeft && i === 1) && !(!this._isMovingLeft && a === e.getLineMaxColumn(r))) if (this._isMovingLeft) {
			let o = new Range(r, i - 1, r, i), s = e.getValueInRange(o);
			n.addEditOperation(o, null), n.addEditOperation(new Range(r, a, r, a), s);
		} else {
			let o = new Range(r, a, r, a + 1), s = e.getValueInRange(o);
			n.addEditOperation(o, null), n.addEditOperation(new Range(r, i, r, i), s);
		}
	}
	computeCursorState(e, n) {
		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, n) {
		super(n), this.left = e;
	}
	run(e, n) {
		if (!n.hasModel()) return;
		let r = [], i = n.getSelections();
		for (let e of i) r.push(new MoveCaretCommand(e, this.left));
		n.pushUndoStop(), n.executeCommands(this.id, r), n.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, n) {
		if (!n.hasModel()) return;
		let r = n.getModel(), i = [], a = n.getSelections();
		for (let e of a) {
			if (!e.isEmpty()) continue;
			let n = e.startLineNumber, a = e.startColumn, o = r.getLineMaxColumn(n);
			if (n === 1 && (a === 1 || a === 2 && o === 2)) continue;
			let s = a === o ? e.getPosition() : MoveOperations.rightPosition(r, e.getPosition().lineNumber, e.getPosition().column), c = MoveOperations.leftPosition(r, s), l = MoveOperations.leftPosition(r, c), u = r.getValueInRange(Range.fromPositions(l, c)), d = r.getValueInRange(Range.fromPositions(c, s)), f = Range.fromPositions(l, s);
			i.push(new ReplaceCommand(f, d + u));
		}
		i.length > 0 && (n.pushUndoStop(), n.executeCommands(this.id, i), n.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 n = 0; n < e.length; n++) e[n] = Math.floor(Math.random() * 256);
		return e;
	};
	let n = new Uint8Array(16), r = [];
	for (let e = 0; e < 256; e++) r.push(e.toString(16).padStart(2, "0"));
	return function() {
		e(n), n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128;
		let i = 0, a = "";
		return a += r[n[i++]], a += r[n[i++]], a += r[n[i++]], a += r[n[i++]], a += "-", a += r[n[i++]], a += r[n[i++]], a += "-", a += r[n[i++]], a += r[n[i++]], a += "-", a += r[n[i++]], a += r[n[i++]], a += "-", a += r[n[i++]], a += r[n[i++]], a += r[n[i++]], a += r[n[i++]], a += r[n[i++]], a += r[n[i++]], a;
	};
})();
function createStringDataTransferItem(e) {
	return {
		asString: async () => e,
		asFile: () => void 0,
		value: typeof e == "string" ? e : void 0
	};
}
function createFileDataTransferItem(e, n, r) {
	let i = {
		id: generateUuid(),
		name: e,
		uri: n,
		data: r
	};
	return {
		asString: async () => "",
		asFile: () => i,
		value: void 0
	};
}
var VSDataTransfer = class {
	constructor() {
		this._entries = /* @__PURE__ */ new Map();
	}
	get size() {
		let e = 0;
		for (let n of this._entries) e++;
		return e;
	}
	has(e) {
		return this._entries.has(this.toKey(e));
	}
	matches(e) {
		let n = [...this._entries.keys()];
		return Iterable.some(this, ([e, n]) => n.asFile()) && n.push("files"), matchesMimeType_normalized(normalizeMimeType(e), n);
	}
	get(e) {
		return this._entries.get(this.toKey(e))?.[0];
	}
	append(e, n) {
		let r = this._entries.get(e);
		r ? r.push(n) : this._entries.set(this.toKey(e), [n]);
	}
	replace(e, n) {
		this._entries.set(this.toKey(e), [n]);
	}
	delete(e) {
		this._entries.delete(this.toKey(e));
	}
	*[Symbol.iterator]() {
		for (let [e, n] of this._entries) for (let r of n) yield [e, r];
	}
	toKey(e) {
		return normalizeMimeType(e);
	}
};
function normalizeMimeType(e) {
	return e.toLowerCase();
}
function matchesMimeType(e, n) {
	return matchesMimeType_normalized(normalizeMimeType(e), n.map(normalizeMimeType));
}
function matchesMimeType_normalized(e, n) {
	if (e === "*/*") return n.length > 0;
	if (n.includes(e)) return !0;
	let r = e.match(/^([a-z]+)\/([a-z]+|\*)$/i);
	if (!r) return !1;
	let [i, a, o] = r;
	return o === "*" ? n.some((e) => e.startsWith(a + "/")) : !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(n) {
		return this.equals(n) || this.value === "" || n.value.startsWith(this.value + e.sep);
	}
	intersects(e) {
		return this.contains(e) || e.contains(this);
	}
	append(...n) {
		return new e((this.value ? [this.value, ...n] : n).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 n = new VSDataTransfer();
	for (let r of e.items) {
		let e = r.type;
		if (r.kind === "string") {
			let i = new Promise((e) => r.getAsString(e));
			n.append(e, createStringDataTransferItem(i));
		} else if (r.kind === "file") {
			let i = r.getAsFile();
			i && n.append(e, createFileDataTransferItemFromFile(i));
		}
	}
	return n;
}
function createFileDataTransferItemFromFile(e) {
	let n = e.path ? URI.parse(e.path) : void 0;
	return createFileDataTransferItem(e.name, n, 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, n = !1) {
	let r = toVSDataTransfer(e), i = r.get(DataTransfers.INTERNAL_URI_LIST);
	if (i) r.replace(Mimes.uriList, i);
	else if (n || !r.has(Mimes.uriList)) {
		let n = [];
		for (let r of e.items) {
			let e = r.getAsFile();
			if (e) {
				let r = e.path;
				try {
					r ? n.push(URI.file(r).toString()) : n.push(URI.parse(e.name, !0).toString());
				} catch {}
			}
		}
		n.length && r.replace(Mimes.uriList, createStringDataTransferItem(UriList.create(n)));
	}
	for (let e of INTERNAL_DND_MIME_TYPES) r.delete(e);
	return r;
}
var __decorate$101 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$101 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, SimplePasteAndDropProvider = class {
	async provideDocumentPasteEdits(e, n, r, i, a) {
		let o = await this.getEdit(r, a);
		if (o) return {
			edits: [{
				insertText: o.insertText,
				title: o.title,
				kind: o.kind,
				handledMimeType: o.handledMimeType,
				yieldTo: o.yieldTo
			}],
			dispose() {}
		};
	}
	async provideDocumentDropEdits(e, n, r, i) {
		let a = await this.getEdit(r, i);
		if (a) return {
			edits: [{
				insertText: a.insertText,
				title: a.title,
				kind: a.kind,
				handledMimeType: a.handledMimeType,
				yieldTo: a.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, n) {
		let r = e.get(Mimes.text);
		if (!r || e.has(Mimes.uriList)) return;
		let i = await r.asString();
		return {
			handledMimeType: Mimes.text,
			title: localize("text.label", "Insert Plain Text"),
			insertText: i,
			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, n) {
		let r = await extractUriList(e);
		if (!r.length || n.isCancellationRequested) return;
		let i = 0, a = r.map(({ uri: e, originalText: n }) => e.scheme === Schemas.file ? e.fsPath : (i++, n)).join(" "), o;
		return o = i > 0 ? r.length > 1 ? localize("defaultDropProvider.uriList.uris", "Insert Uris") : localize("defaultDropProvider.uriList.uri", "Insert Uri") : r.length > 1 ? localize("defaultDropProvider.uriList.paths", "Insert Paths") : localize("defaultDropProvider.uriList.path", "Insert Path"), {
			handledMimeType: Mimes.uriList,
			insertText: a,
			title: o,
			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, n) {
		let r = await extractUriList(e);
		if (!r.length || n.isCancellationRequested) return;
		let i = coalesce(r.map(({ uri: e }) => {
			let n = this._workspaceContextService.getWorkspaceFolder(e);
			return n ? relativePath(n.uri, e) : void 0;
		}));
		if (i.length) return {
			handledMimeType: Mimes.uriList,
			insertText: i.join(" "),
			title: r.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, n, r, i, a) {
		if (i.triggerKind !== DocumentPasteTriggerKind.PasteAs && !i.only?.contains(this.kind)) return;
		let o = await r.get("text/html")?.asString();
		if (!(!o || a.isCancellationRequested)) return {
			dispose() {},
			edits: [{
				insertText: o,
				yieldTo: this._yieldTo,
				title: localize("pasteHtmlLabel", "Insert HTML"),
				kind: this.kind
			}]
		};
	}
};
async function extractUriList(e) {
	let n = e.get(Mimes.uriList);
	if (!n) return [];
	let r = await n.asString(), i = [];
	for (let e of UriList.parse(r)) try {
		i.push({
			uri: URI.parse(e),
			originalText: e
		});
	} catch {}
	return i;
}
var DefaultDropProvidersFeature = class extends Disposable {
	constructor(e, n) {
		super(), this._register(e.documentDropEditProvider.register("*", new DefaultTextPasteOrDropEditProvider())), this._register(e.documentDropEditProvider.register("*", new PathProvider())), this._register(e.documentDropEditProvider.register("*", new RelativePathProvider(n)));
	}
};
DefaultDropProvidersFeature = __decorate$101([__param$101(0, ILanguageFeaturesService), __param$101(1, IWorkspaceContextService)], DefaultDropProvidersFeature);
var DefaultPasteProvidersFeature = class extends Disposable {
	constructor(e, n) {
		super(), this._register(e.documentPasteEditProvider.register("*", new DefaultTextPasteOrDropEditProvider())), this._register(e.documentPasteEditProvider.register("*", new PathProvider())), this._register(e.documentPasteEditProvider.register("*", new RelativePathProvider(n))), 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 n = this.pos, r = 0, i = this.value.charCodeAt(n), a;
		if (a = e._table[i], typeof a == "number") return this.pos += 1, {
			type: a,
			pos: n,
			len: 1
		};
		if (e.isDigitCharacter(i)) {
			a = 8;
			do
				r += 1, i = this.value.charCodeAt(n + r);
			while (e.isDigitCharacter(i));
			return this.pos += r, {
				type: a,
				pos: n,
				len: r
			};
		}
		if (e.isVariableCharacter(i)) {
			a = 9;
			do
				i = this.value.charCodeAt(n + ++r);
			while (e.isVariableCharacter(i) || e.isDigitCharacter(i));
			return this.pos += r, {
				type: a,
				pos: n,
				len: r
			};
		}
		a = 10;
		do
			r += 1, i = this.value.charCodeAt(n + r);
		while (!isNaN(i) && e._table[i] === void 0 && !e.isDigitCharacter(i) && !e.isVariableCharacter(i));
		return this.pos += r, {
			type: a,
			pos: n,
			len: r
		};
	}
}, 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, n) {
		let { parent: r } = e, i = r.children.indexOf(e), a = r.children.slice(0);
		a.splice(i, 1, ...n), r._children = a, (function e(n, r) {
			for (let i of n) i.parent = r, e(i.children, i);
		})(n, r);
	}
	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, n) => e + n.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, n) {
		return e.index === n.index ? 0 : e.isFinalTabstop ? 1 : n.isFinalTabstop || e.index < n.index ? -1 : e.index > n.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 n = new e(this.index);
		return this.transform && (n.transform = this.transform.clone()), n._children = this.children.map((e) => e.clone()), n;
	}
}, 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 n = new e();
		return this.options.forEach(n.appendChild, n), n;
	}
}, Transform = class e extends Marker {
	constructor() {
		super(...arguments), this.regexp = /* @__PURE__ */ RegExp("");
	}
	resolve(e) {
		let n = this, r = !1, i = e.replace(this.regexp, function() {
			return r = !0, n._replace(Array.prototype.slice.call(arguments, 0, -2));
		});
		return !r && this._children.some((e) => e instanceof FormatString && !!e.elseValue) && (i = this._replace([])), i;
	}
	_replace(e) {
		let n = "";
		for (let r of this._children) if (r instanceof FormatString) {
			let i = e[r.index] || "";
			i = r.resolve(i), n += i;
		} else n += r.toString();
		return n;
	}
	toString() {
		return "";
	}
	clone() {
		let n = new e();
		return n.regexp = new RegExp(this.regexp.source, (this.regexp.ignoreCase ? "i" : "") + (this.regexp.global ? "g" : "")), n._children = this.children.map((e) => e.clone()), n;
	}
}, FormatString = class e extends Marker {
	constructor(e, n, r, i) {
		super(), this.index = e, this.shorthandName = n, this.ifValue = r, this.elseValue = i;
	}
	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 n = e.match(/[a-z0-9]+/gi);
		return n ? n.map((e) => e.charAt(0).toUpperCase() + e.substr(1)).join("") : e;
	}
	_toCamelCase(e) {
		let n = e.match(/[a-z0-9]+/gi);
		return n ? n.map((e, n) => n === 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 n = e.resolve(this);
		return this.transform && (n = this.transform.resolve(n || "")), n === void 0 ? !1 : (this._children = [new Text(n)], !0);
	}
	clone() {
		let n = new e(this.name);
		return this.transform && (n.transform = this.transform.clone()), n._children = this.children.map((e) => e.clone()), n;
	}
};
function walk(e, n) {
	let r = [...e];
	for (; r.length > 0;) {
		let e = r.shift();
		if (!n(e)) break;
		r.unshift(...e.children);
	}
}
var TextmateSnippet = class e extends Marker {
	get placeholderInfo() {
		if (!this._placeholders) {
			let e = [], n;
			this.walk(function(r) {
				return r instanceof Placeholder && (e.push(r), n = !n || n.index < r.index ? r : n), !0;
			}), this._placeholders = {
				all: e,
				last: n
			};
		}
		return this._placeholders;
	}
	get placeholders() {
		let { all: e } = this.placeholderInfo;
		return e;
	}
	offset(e) {
		let n = 0, r = !1;
		return this.walk((i) => i === e ? (r = !0, !1) : (n += i.len(), !0)), r ? n : -1;
	}
	fullLen(e) {
		let n = 0;
		return walk([e], (e) => (n += e.len(), !0)), n;
	}
	enclosingPlaceholders(e) {
		let n = [], { parent: r } = e;
		for (; r;) r instanceof Placeholder && n.push(r), r = r.parent;
		return n;
	}
	resolveVariables(e) {
		return this.walk((n) => (n instanceof Variable && n.resolve(e) && (this._placeholders = void 0), !0)), this;
	}
	appendChild(e) {
		return this._placeholders = void 0, super.appendChild(e);
	}
	replace(e, n) {
		return this._placeholders = void 0, super.replace(e, n);
	}
	clone() {
		let n = new e();
		return this._children = this.children.map((e) => e.clone()), n;
	}
	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, n, r) {
		let i = new TextmateSnippet();
		return this.parseFragment(e, i), this.ensureFinalTabstop(i, r ?? !1, n ?? !1), i;
	}
	parseFragment(e, n) {
		let r = n.children.length;
		for (this._scanner.text(e), this._token = this._scanner.next(); this._parse(n););
		let i = /* @__PURE__ */ new Map(), a = [];
		n.walk((e) => (e instanceof Placeholder && (e.isFinalTabstop ? i.set(0, void 0) : !i.has(e.index) && e.children.length > 0 ? i.set(e.index, e.children) : a.push(e)), !0));
		let o = (e, r) => {
			let a = i.get(e.index);
			if (!a) return;
			let s = new Placeholder(e.index);
			s.transform = e.transform;
			for (let e of a) {
				let n = e.clone();
				s.appendChild(n), n instanceof Placeholder && i.has(n.index) && !r.has(n.index) && (r.add(n.index), o(n, r), r.delete(n.index));
			}
			n.replace(e, [s]);
		}, s = /* @__PURE__ */ new Set();
		for (let e of a) o(e, s);
		return n.children.slice(r);
	}
	ensureFinalTabstop(e, n, r) {
		(n || r && e.placeholders.length > 0) && (e.placeholders.find((e) => e.index === 0) || e.appendChild(new Placeholder(0)));
	}
	_accept(e, n) {
		if (e === void 0 || this._token.type === e) {
			let e = n ? 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 n = 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 r = this._scanner.value.substring(n.pos, this._token.pos).replace(/\\(\$|}|\\)/g, "$1");
		return this._token = this._scanner.next(), r;
	}
	_parse(e) {
		return this._parseEscaped(e) || this._parseTabstopOrVariableName(e) || this._parseComplexPlaceholder(e) || this._parseComplexVariable(e) || this._parseAnything(e);
	}
	_parseEscaped(e) {
		let n;
		return (n = this._accept(5, !0)) ? (n = this._accept(0, !0) || this._accept(4, !0) || this._accept(5, !0) || n, e.appendChild(new Text(n)), !0) : !1;
	}
	_parseTabstopOrVariableName(e) {
		let n, r = this._token;
		return this._accept(0) && (n = this._accept(9, !0) || this._accept(8, !0)) ? (e.appendChild(/^\d+$/.test(n) ? new Placeholder(Number(n)) : new Variable(n)), !0) : this._backTo(r);
	}
	_parseComplexPlaceholder(e) {
		let n, r = this._token;
		if (!(this._accept(0) && this._accept(3) && (n = this._accept(8, !0)))) return this._backTo(r);
		let i = new Placeholder(Number(n));
		if (this._accept(1)) for (;;) {
			if (this._accept(4)) return e.appendChild(i), !0;
			if (!this._parse(i)) return e.appendChild(new Text("${" + n + ":")), i.children.forEach(e.appendChild, e), !0;
		}
		else if (i.index > 0 && this._accept(7)) {
			let n = new Choice();
			for (;;) {
				if (this._parseChoiceElement(n)) {
					if (this._accept(2)) continue;
					if (this._accept(7) && (i.appendChild(n), this._accept(4))) return e.appendChild(i), !0;
				}
				return this._backTo(r), !1;
			}
		} else if (this._accept(6)) return this._parseTransform(i) ? (e.appendChild(i), !0) : (this._backTo(r), !1);
		else if (this._accept(4)) return e.appendChild(i), !0;
		else return this._backTo(r);
	}
	_parseChoiceElement(e) {
		let n = this._token, r = [];
		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(n), !1;
			r.push(e);
		}
		return r.length === 0 ? (this._backTo(n), !1) : (e.appendChild(new Text(r.join(""))), !0);
	}
	_parseComplexVariable(e) {
		let n, r = this._token;
		if (!(this._accept(0) && this._accept(3) && (n = this._accept(9, !0)))) return this._backTo(r);
		let i = new Variable(n);
		if (this._accept(1)) for (;;) {
			if (this._accept(4)) return e.appendChild(i), !0;
			if (!this._parse(i)) return e.appendChild(new Text("${" + n + ":")), i.children.forEach(e.appendChild, e), !0;
		}
		else if (this._accept(6)) return this._parseTransform(i) ? (e.appendChild(i), !0) : (this._backTo(r), !1);
		else if (this._accept(4)) return e.appendChild(i), !0;
		else return this._backTo(r);
	}
	_parseTransform(e) {
		let n = new Transform(), r = "", i = "";
		for (; !this._accept(6);) {
			let e;
			if (e = this._accept(5, !0)) {
				e = this._accept(6, !0) || e, r += e;
				continue;
			}
			if (this._token.type !== 14) {
				r += 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, n.appendChild(new Text(e));
				continue;
			}
			if (!(this._parseFormatString(n) || this._parseAnything(n))) return !1;
		}
		for (; !this._accept(4);) {
			if (this._token.type !== 14) {
				i += this._accept(void 0, !0);
				continue;
			}
			return !1;
		}
		try {
			n.regexp = new RegExp(r, i);
		} catch {
			return !1;
		}
		return e.transform = n, !0;
	}
	_parseFormatString(e) {
		let n = this._token;
		if (!this._accept(0)) return !1;
		let r = !1;
		this._accept(3) && (r = !0);
		let i = this._accept(8, !0);
		if (i) if (r) {
			if (this._accept(4)) return e.appendChild(new FormatString(Number(i))), !0;
			if (!this._accept(1)) return this._backTo(n), !1;
		} else return e.appendChild(new FormatString(Number(i))), !0;
		else return this._backTo(n), !1;
		if (this._accept(6)) {
			let r = this._accept(9, !0);
			return !r || !this._accept(4) ? (this._backTo(n), !1) : (e.appendChild(new FormatString(Number(i), r)), !0);
		} else if (this._accept(11)) {
			let n = this._until(4);
			if (n) return e.appendChild(new FormatString(Number(i), void 0, n, void 0)), !0;
		} else if (this._accept(12)) {
			let n = this._until(4);
			if (n) return e.appendChild(new FormatString(Number(i), void 0, void 0, n)), !0;
		} else if (this._accept(13)) {
			let n = this._until(1);
			if (n) {
				let r = this._until(4);
				if (r) return e.appendChild(new FormatString(Number(i), void 0, n, r)), !0;
			}
		} else {
			let n = this._until(4);
			if (n) return e.appendChild(new FormatString(Number(i), void 0, void 0, n)), !0;
		}
		return this._backTo(n), !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, n, r) {
	return (typeof r.insertText == "string" ? r.insertText === "" : r.insertText.snippet === "") ? { edits: r.additionalEdit?.edits ?? [] } : { edits: [...n.map((n) => new ResourceTextEdit(e, {
		range: n,
		text: typeof r.insertText == "string" ? SnippetParser.escape(r.insertText) + "$0" : r.insertText.snippet,
		insertAsSnippet: !0
	})), ...r.additionalEdit?.edits ?? []] };
}
function sortEditsByYieldTo(e) {
	function n(e, n) {
		return "mimeType" in e ? e.mimeType === n.handledMimeType : !!n.kind && e.kind.contains(n.kind);
	}
	let r = /* @__PURE__ */ new Map();
	for (let i of e) for (let a of i.yieldTo ?? []) for (let o of e) if (o !== i && n(a, o)) {
		let e = r.get(i);
		e || (e = [], r.set(i, e)), e.push(o);
	}
	if (!r.size) return Array.from(e);
	let i = /* @__PURE__ */ new Set(), a = [];
	function o(e) {
		if (!e.length) return [];
		let n = e[0];
		if (a.includes(n)) return console.warn("Yield to cycle detected", n), e;
		if (i.has(n)) return o(e.slice(1));
		let s = [], c = r.get(n);
		return c && (a.push(n), s = o(c), a.pop()), i.add(n), [
			...s,
			n,
			...o(e.slice(1))
		];
	}
	return o(Array.from(e));
}
var __decorate$100 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$100 = function(e, n) {
	return function(r, i) {
		n(r, i, 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, n, r, i, a) {
		super(), this.typeId = e, this.editor = n, this.range = r, this.delegate = a, this.allowEditorOverflow = !1, this.suppressMouseDown = !0, this.create(i), this.editor.addContentWidget(this), this.editor.layoutContentWidget(this);
	}
	create(e) {
		this.domNode = $(".inline-progress-widget"), this.domNode.role = "button", this.domNode.title = e;
		let n = $("span.icon");
		this.domNode.append(n), n.classList.add(...ThemeIcon.asClassNameArray(Codicon.loading), "codicon-modifier-spin");
		let r = () => {
			let e = this.editor.getOption(67);
			this.domNode.style.height = `${e}px`, this.domNode.style.width = `${Math.ceil(.8 * e)}px`;
		};
		r(), this._register(this.editor.onDidChangeConfiguration((e) => {
			(e.hasChanged(52) || e.hasChanged(67)) && r();
		})), 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, n, r) {
		super(), this.id = e, this._editor = n, this._instantiationService = r, this._showDelay = 500, this._showPromise = this._register(new MutableDisposable()), this._currentWidget = this._register(new MutableDisposable()), this._operationIdPool = 0, this._currentDecorations = n.createDecorationsCollection();
	}
	dispose() {
		super.dispose(), this._currentDecorations.clear();
	}
	async showWhile(e, n, r, i, a) {
		let o = this._operationIdPool++;
		this._currentOperation = o, this.clear(), this._showPromise.value = disposableTimeout(() => {
			let r = Range.fromPositions(e);
			this._currentDecorations.set([{
				range: r,
				options: inlineProgressDecoration
			}]).length > 0 && (this._currentWidget.value = this._instantiationService.createInstance(InlineProgressWidget, this.id, this._editor, r, n, i));
		}, a ?? this._showDelay);
		try {
			return await r;
		} finally {
			this._currentOperation === o && (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, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$99 = function(e, n) {
	return function(r, i) {
		n(r, i, 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, n, r) {
		this._openerService = r, this._messageWidget = new MutableDisposable(), this._messageListeners = new DisposableStore(), this._mouseOverMessage = !1, this._editor = e, this._visible = MessageController_1.MESSAGE_VISIBLE.bindTo(n);
	}
	dispose() {
		this._message?.dispose(), this._messageListeners.dispose(), this._messageWidget.dispose(), this._visible.reset();
	}
	showMessage(e, n) {
		alert(isMarkdownString(e) ? e.value : e), this._visible.set(!0), this._messageWidget.clear(), this._messageListeners.clear(), this._message = isMarkdownString(e) ? renderMarkdown(e, { actionHandler: {
			callback: (n) => {
				this.closeMessage(), openLinkFromMarkdown(this._openerService, n, isMarkdownString(e) ? e.isTrusted : void 0);
			},
			disposables: this._messageListeners
		} }) : void 0, this._messageWidget.value = new MessageWidget$1(this._editor, n, typeof e == "string" ? e : this._message.element), this._messageListeners.add(Event.debounce(this._editor.onDidBlurEditorText, (e, n) => n, 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 r;
		this._messageListeners.add(this._editor.onMouseMove((e) => {
			e.target.position && (r ? r.containsPosition(e.target.position) || this.closeMessage() : r = new Range(n.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 n = () => {
			e.dispose(), clearTimeout(r), e.getDomNode().removeEventListener("animationend", n);
		}, r = setTimeout(n, 110);
		return e.getDomNode().addEventListener("animationend", n), e.getDomNode().classList.add("fadeOut"), { dispose: n };
	}
	constructor(e, { lineNumber: n, column: r }, i) {
		this.allowEditorOverflow = !0, this.suppressMouseDown = !1, this._editor = e, this._editor.revealLinesInCenterIfOutsideViewport(n, n, 0), this._position = {
			lineNumber: n,
			column: r
		}, this._domNode = document.createElement("div"), this._domNode.classList.add("monaco-editor-overlaymessage"), this._domNode.style.marginLeft = "-6px";
		let a = document.createElement("div");
		a.classList.add("anchor", "top"), this._domNode.appendChild(a);
		let o = document.createElement("div");
		typeof i == "string" ? (o.classList.add("message"), o.textContent = i) : (i.classList.add("message"), o.appendChild(i)), this._domNode.appendChild(o);
		let s = document.createElement("div");
		s.classList.add("anchor", "below"), this._domNode.appendChild(s), 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, n) {
	return n && (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, n = !1) {
	if (!e) return localize("error.defaultMessage", "An unknown error occurred. Please consult the log for more details.");
	if (Array.isArray(e)) {
		let r = coalesce(e), i = toErrorMessage(r[0], n);
		return r.length > 1 ? localize("error.moreErrors", "{0} ({1} errors in total)", i, r.length) : i;
	}
	if (isString(e)) return e;
	if (e.detail) {
		let r = e.detail;
		if (r.error) return exceptionToErrorMessage(r.error, n);
		if (r.exception) return exceptionToErrorMessage(r.exception, n);
	}
	return e.stack ? exceptionToErrorMessage(e, n) : e.message ? e.message : localize("error.defaultMessage", "An unknown error occurred. Please consult the log for more details.");
}
var __decorate$98 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$98 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, PostEditWidget_1, PostEditWidget = class extends Disposable {
	static {
		PostEditWidget_1 = this;
	}
	static {
		this.baseId = "editor.widget.postEditWidget";
	}
	constructor(e, n, r, i, a, o, s, c, l, u) {
		super(), this.typeId = e, this.editor = n, this.showCommand = i, this.range = a, this.edits = o, this.onSelectNewEdit = s, this._contextMenuService = c, this._keybindingService = u, this.allowEditorOverflow = !0, this.suppressMouseDown = !0, this.create(), this.visibleContext = r.bindTo(l), 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) => {
			a.containsPosition(e.position) || this.dispose();
		})), this._register(Event.runAndSubscribe(u.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, n) => toAction({
				id: "",
				label: e.title,
				checked: n === this.edits.activeEditIndex,
				run: () => {
					if (n !== this.edits.activeEditIndex) return this.onSelectNewEdit(n);
				}
			}))
		});
	}
};
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, n, r, i, a, o, s) {
		super(), this._id = e, this._editor = n, this._visibleContext = r, this._showCommand = i, this._instantiationService = a, this._bulkEditService = o, this._notificationService = s, this._currentWidget = this._register(new MutableDisposable()), this._register(Event.any(n.onDidChangeModel, n.onDidChangeModelContent)(() => this.clear()));
	}
	async applyEditAndShowIfNeeded(e, n, r, i, a) {
		let o = this._editor.getModel();
		if (!o || !e.length) return;
		let s = n.allEdits.at(n.activeEditIndex);
		if (!s) return;
		let c = async (o) => {
			let s = this._editor.getModel();
			s && (await s.undo(), this.applyEditAndShowIfNeeded(e, {
				activeEditIndex: o,
				allEdits: n.allEdits
			}, r, i, a));
		}, l = (i, a) => {
			isCancellationError(i) || (this._notificationService.error(a), r && this.show(e[0], n, c));
		}, u;
		try {
			u = await i(s, a);
		} catch (e) {
			return l(e, localize("resolveError", "Error resolving edit '{0}':\n{1}", s.title, toErrorMessage(e)));
		}
		if (a.isCancellationRequested) return;
		let d = createCombinedWorkspaceEdit(o.uri, e, u), f = e[0], m = o.deltaDecorations([], [{
			range: f,
			options: {
				description: "paste-line-suffix",
				stickiness: 0
			}
		}]);
		this._editor.focus();
		let g, _;
		try {
			g = await this._bulkEditService.apply(d, {
				editor: this._editor,
				token: a
			}), _ = o.getDecorationRange(m[0]);
		} catch (e) {
			return l(e, localize("applyError", "Error applying edit '{0}':\n{1}", s.title, toErrorMessage(e)));
		} finally {
			o.deltaDecorations(m, []);
		}
		a.isCancellationRequested || r && g.isApplied && n.allEdits.length > 1 && this.show(_ ?? f, n, c);
	}
	show(e, n, r) {
		this.clear(), this._editor.hasModel() && (this._currentWidget.value = this._instantiationService.createInstance(PostEditWidget, this._id, this._editor, this._visibleContext, this._showCommand, e, n, r));
	}
	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, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$97 = function(e, n) {
	return function(r, i) {
		n(r, i, 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, n, r, i, a, o, s) {
		super(), this._bulkEditService = r, this._clipboardService = i, this._languageFeaturesService = a, this._quickInputService = o, this._progressService = s, this._editor = e;
		let c = e.getContainerDomNode();
		this._register(addDisposableListener(c, "copy", (e) => this.handleCopy(e))), this._register(addDisposableListener(c, "cut", (e) => this.handleCopy(e))), this._register(addDisposableListener(c, "paste", (e) => this.handlePaste(e), !0)), this._pasteProgressManager = this._register(new InlineProgressManager("pasteIntoEditor", e, n)), this._postPasteWidgetManager = this._register(n.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 n = this._editor.getModel(), r = this._editor.getSelections();
		if (!n || !r?.length) return;
		let i = this._editor.getOption(37), a = r, o = r.length === 1 && r[0].isEmpty();
		if (o) {
			if (!i) return;
			a = [new Range(a[0].startLineNumber, 1, a[0].startLineNumber, 1 + n.getLineLength(a[0].startLineNumber))];
		}
		let s = this._editor._getViewModel()?.getPlainTextToCopy(r, i, isWindows), c = {
			multicursorText: Array.isArray(s) ? s : null,
			pasteOnNewLine: o,
			mode: null
		}, l = this._languageFeaturesService.documentPasteEditProvider.ordered(n).filter((e) => !!e.prepareDocumentPaste);
		if (!l.length) {
			this.setCopyMetadata(e.clipboardData, { defaultPastePayload: c });
			return;
		}
		let u = toVSDataTransfer(e.clipboardData), d = l.flatMap((e) => e.copyMimeTypes ?? []), f = generateUuid();
		this.setCopyMetadata(e.clipboardData, {
			id: f,
			providerCopyMimeTypes: d,
			defaultPastePayload: c
		});
		let m = createCancelablePromise(async (e) => {
			let r = coalesce(await Promise.all(l.map(async (r) => {
				try {
					return await r.prepareDocumentPaste(n, a, u, e);
				} catch (e) {
					console.error(e);
					return;
				}
			})));
			r.reverse();
			for (let e of r) for (let [n, r] of e) u.replace(n, r);
			return u;
		});
		CopyPasteController_1._currentCopyOperation?.dataTransferPromise.cancel(), CopyPasteController_1._currentCopyOperation = {
			handle: f,
			dataTransferPromise: m
		};
	}
	async handlePaste(e) {
		if (!e.clipboardData || !this._editor.hasTextFocus()) return;
		MessageController.get(this._editor)?.closeMessage(), this._currentPasteOperation?.cancel(), this._currentPasteOperation = void 0;
		let n = this._editor.getModel(), r = this._editor.getSelections();
		if (!r?.length || !n || this._editor.getOption(92) || !this.isPasteAsEnabled() && !this._pasteAsActionContext) return;
		let i = this.fetchCopyMetadata(e), a = toExternalVSDataTransfer(e.clipboardData);
		a.delete(vscodeClipboardMime);
		let o = [
			...e.clipboardData.types,
			...i?.providerCopyMimeTypes ?? [],
			Mimes.uriList
		], s = this._languageFeaturesService.documentPasteEditProvider.ordered(n).filter((e) => {
			let n = this._pasteAsActionContext?.preferred;
			return n && e.providedPasteEditKinds && !this.providerMatchesPreference(e, n) ? !1 : e.pasteMimeTypes?.some((e) => matchesMimeType(e, o));
		});
		if (!s.length) {
			this._pasteAsActionContext?.preferred && this.showPasteAsNoEditMessage(r, this._pasteAsActionContext.preferred);
			return;
		}
		e.preventDefault(), e.stopImmediatePropagation(), this._pasteAsActionContext ? this.showPasteAsPick(this._pasteAsActionContext.preferred, s, r, a, i) : this.doPasteInline(s, r, a, i, e);
	}
	showPasteAsNoEditMessage(e, n) {
		MessageController.get(this._editor)?.showMessage(localize("pasteAsError", "No paste edits for '{0}' found", n instanceof HierarchicalKind ? n.value : n.providerId), e[0].getStartPosition());
	}
	doPasteInline(e, n, r, i, a) {
		let o = this._editor;
		if (!o.hasModel()) return;
		let s = new EditorStateCancellationTokenSource(o, 3, void 0), c = createCancelablePromise(async (o) => {
			let l = this._editor;
			if (!l.hasModel()) return;
			let u = l.getModel(), d = new DisposableStore(), f = d.add(new CancellationTokenSource(o));
			d.add(s.token.onCancellationRequested(() => f.cancel()));
			let m = f.token;
			try {
				if (await this.mergeInDataFromCopy(r, i, m), m.isCancellationRequested) return;
				let o = e.filter((e) => this.isSupportedPasteProvider(e, r));
				if (!o.length || o.length === 1 && o[0] instanceof DefaultTextPasteOrDropEditProvider) return this.applyDefaultPasteHandler(r, i, m, a);
				let s = { triggerKind: DocumentPasteTriggerKind.Automatic }, c = await this.getPasteEdits(o, r, u, n, s, m);
				if (d.add(c), m.isCancellationRequested) return;
				if (c.edits.length === 1 && c.edits[0].provider instanceof DefaultTextPasteOrDropEditProvider) return this.applyDefaultPasteHandler(r, i, m, a);
				if (c.edits.length) {
					let e = l.getOption(85).showPasteSelector === "afterPaste";
					return this._postPasteWidgetManager.applyEditAndShowIfNeeded(n, {
						activeEditIndex: 0,
						allEdits: c.edits
					}, e, (e, r) => new Promise((i, a) => {
						(async () => {
							try {
								let o = e.provider.resolveDocumentPasteEdit?.(e, r), s = new DeferredPromise(), c = o && await this._pasteProgressManager.showWhile(n[0].getEndPosition(), localize("resolveProcess", "Resolving paste edit. Click to cancel"), Promise.race([s.p, o]), { cancel: () => (s.cancel(), a(new CancellationError())) }, 0);
								return c && (e.additionalEdit = c.additionalEdit), i(e);
							} catch (e) {
								return a(e);
							}
						})();
					}), m);
				}
				await this.applyDefaultPasteHandler(r, i, m, a);
			} finally {
				d.dispose(), this._currentPasteOperation === c && (this._currentPasteOperation = void 0);
			}
		});
		this._pasteProgressManager.showWhile(n[0].getEndPosition(), localize("pasteIntoEditorProgress", "Running paste handlers. Click to cancel and do basic paste"), c, { cancel: async () => {
			try {
				if (c.cancel(), s.token.isCancellationRequested) return;
				await this.applyDefaultPasteHandler(r, i, s.token, a);
			} finally {
				s.dispose();
			}
		} }).then(() => {
			s.dispose();
		}), this._currentPasteOperation = c;
	}
	showPasteAsPick(e, n, r, i, a) {
		let o = createCancelablePromise(async (s) => {
			let c = this._editor;
			if (!c.hasModel()) return;
			let l = c.getModel(), u = new DisposableStore(), d = u.add(new EditorStateCancellationTokenSource(c, 3, void 0, s));
			try {
				if (await this.mergeInDataFromCopy(i, a, d.token), d.token.isCancellationRequested) return;
				let o = n.filter((n) => this.isSupportedPasteProvider(n, i, e));
				e && (o = o.filter((n) => this.providerMatchesPreference(n, e)));
				let s = {
					triggerKind: DocumentPasteTriggerKind.PasteAs,
					only: e && e instanceof HierarchicalKind ? e : void 0
				}, c = u.add(await this.getPasteEdits(o, i, l, r, s, d.token));
				if (d.token.isCancellationRequested) return;
				if (e && (c = {
					edits: c.edits.filter((n) => e instanceof HierarchicalKind ? e.contains(n.kind) : e.providerId === n.provider.id),
					dispose: c.dispose
				}), !c.edits.length) {
					s.only && this.showPasteAsNoEditMessage(r, s.only);
					return;
				}
				let f;
				if (f = e ? c.edits.at(0) : (await this._quickInputService.pick(c.edits.map((e) => ({
					label: e.title,
					description: e.kind?.value,
					edit: e
				})), { placeHolder: localize("pasteAsPickerPlaceholder", "Select Paste Action") }))?.edit, !f) return;
				let m = createCombinedWorkspaceEdit(l.uri, r, f);
				await this._bulkEditService.apply(m, { editor: this._editor });
			} finally {
				u.dispose(), this._currentPasteOperation === o && (this._currentPasteOperation = void 0);
			}
		});
		this._progressService.withProgress({
			location: 10,
			title: localize("pasteAsProgress", "Running paste handlers")
		}, () => o);
	}
	setCopyMetadata(e, n) {
		e.setData(vscodeClipboardMime, JSON.stringify(n));
	}
	fetchCopyMetadata(e) {
		if (!e.clipboardData) return;
		let n = e.clipboardData.getData(vscodeClipboardMime);
		if (n) try {
			return JSON.parse(n);
		} catch {
			return;
		}
		let [r, i] = ClipboardEventUtils.getTextData(e.clipboardData);
		if (i) return { defaultPastePayload: {
			mode: i.mode,
			multicursorText: i.multicursorText ?? null,
			pasteOnNewLine: !!i.isFromEmptySelection
		} };
	}
	async mergeInDataFromCopy(e, n, r) {
		if (n?.id && CopyPasteController_1._currentCopyOperation?.handle === n.id) {
			let n = await CopyPasteController_1._currentCopyOperation.dataTransferPromise;
			if (r.isCancellationRequested) return;
			for (let [r, i] of n) e.replace(r, i);
		}
		if (!e.has(Mimes.uriList)) {
			let n = await this._clipboardService.readResources();
			if (r.isCancellationRequested) return;
			n.length && e.append(Mimes.uriList, createStringDataTransferItem(UriList.create(n)));
		}
	}
	async getPasteEdits(e, n, r, i, a, o) {
		let s = new DisposableStore(), c = await raceCancellation(Promise.all(e.map(async (e) => {
			try {
				let c = await e.provideDocumentPasteEdits?.(r, i, n, a, o);
				return c && s.add(c), c?.edits?.map((n) => ({
					...n,
					provider: e
				}));
			} catch (e) {
				isCancellationError(e) || console.error(e);
				return;
			}
		})), o), l = coalesce(c ?? []).flat().filter((e) => !a.only || a.only.contains(e.kind));
		return {
			edits: sortEditsByYieldTo(l),
			dispose: () => s.dispose()
		};
	}
	async applyDefaultPasteHandler(e, n, r, i) {
		let a = await (e.get(Mimes.text) ?? e.get("text"))?.asString() ?? "";
		if (r.isCancellationRequested) return;
		let o = {
			clipboardEvent: i,
			text: a,
			pasteOnNewLine: n?.defaultPastePayload.pasteOnNewLine ?? !1,
			multicursorText: n?.defaultPastePayload.multicursorText ?? null,
			mode: null
		};
		this._editor.trigger("keyboard", "paste", o);
	}
	isSupportedPasteProvider(e, n, r) {
		return e.pasteMimeTypes?.some((e) => n.matches(e)) ? !r || this.providerMatchesPreference(e, r) : !1;
	}
	providerMatchesPreference(e, n) {
		return n instanceof HierarchicalKind ? e.providedPasteEditKinds ? e.providedPasteEditKinds.some((e) => n.contains(e)) : !0 : e.id === n.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, n) {
		n.hasModel() && (!n.getOption(37) && n.getSelection().isEmpty() || (CopyOptions.forceCopyWithSyntaxHighlighting = !0, n.focus(), n.getContainerDomNode().ownerDocument.execCommand("copy"), CopyOptions.forceCopyWithSyntaxHighlighting = !1));
	}
};
function registerExecCommandImpl(e, n) {
	e && (e.addImplementation(1e4, "code-editor", (e, r) => {
		let i = e.get(ICodeEditorService).getFocusedCodeEditor();
		if (i && i.hasTextFocus()) {
			let e = i.getOption(37), r = i.getSelection();
			return r && r.isEmpty() && !e || i.getContainerDomNode().ownerDocument.execCommand(n), !0;
		}
		return !1;
	}), e.addImplementation(0, "generic-dom", (e, r) => (getActiveDocument().execCommand(n), !0)));
}
registerExecCommandImpl(CutAction, "cut"), registerExecCommandImpl(CopyAction, "copy"), PasteAction && (PasteAction.addImplementation(1e4, "code-editor", (e, n) => {
	let r = e.get(ICodeEditorService), i = e.get(IClipboardService), a = r.getFocusedCodeEditor();
	return a && a.hasTextFocus() ? a.getContainerDomNode().ownerDocument.execCommand("paste") ? CopyPasteController.get(a)?.finishedPaste() ?? Promise.resolve() : isWeb ? (async () => {
		let e = await i.readText();
		if (e !== "") {
			let n = InMemoryClipboardMetadataManager.INSTANCE.get(e), r = !1, i = null, o = null;
			n && (r = a.getOption(37) && !!n.isFromEmptySelection, i = n.multicursorText === void 0 ? null : n.multicursorText, o = n.mode), a.trigger("keyboard", "paste", {
				text: e,
				pasteOnNewLine: r,
				multicursorText: i,
				mode: o
			});
		}
	})() : !0 : !1;
}), PasteAction.addImplementation(0, "generic-dom", (e, n) => (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, n) {
	return !(e.include && !e.include.intersects(n) || e.excludes && e.excludes.some((r) => excludesAction(n, r, e.include)) || !e.includeSourceActions && CodeActionKind.Source.contains(n));
}
function filtersAction(e, n) {
	let r = n.kind ? new HierarchicalKind(n.kind) : void 0;
	return !(e.include && (!r || !e.include.contains(r)) || e.excludes && r && e.excludes.some((n) => excludesAction(r, n, e.include)) || !e.includeSourceActions && r && CodeActionKind.Source.contains(r) || e.onlyIncludePreferredActions && !n.isPreferred);
}
function excludesAction(e, n, r) {
	return !(!n.contains(e) || r && n.contains(r));
}
var CodeActionCommandArgs = class e {
	static fromUser(n, r) {
		return !n || typeof n != "object" ? new e(r.kind, r.apply, !1) : new e(e.getKindFromUser(n, r.kind), e.getApplyFromUser(n, r.apply), e.getPreferredUser(n));
	}
	static getApplyFromUser(e, n) {
		switch (typeof e.apply == "string" ? e.apply.toLowerCase() : "") {
			case "first": return "first";
			case "never": return "never";
			case "ifsingle": return "ifSingle";
			default: return n;
		}
	}
	static getKindFromUser(e, n) {
		return typeof e.kind == "string" ? new HierarchicalKind(e.kind) : n;
	}
	static getPreferredUser(e) {
		return typeof e.preferred == "boolean" ? e.preferred : !1;
	}
	constructor(e, n, r) {
		this.kind = e, this.apply = n, this.preferred = r;
	}
}, CodeActionItem = class {
	constructor(e, n, r) {
		this.action = e, this.provider = n, this.highlightRange = r;
	}
	async resolve(e) {
		if (this.provider?.resolveCodeAction && !this.action.edit) {
			let n;
			try {
				n = await this.provider.resolveCodeAction(this.action, e);
			} catch (e) {
				onUnexpectedExternalError(e);
			}
			n && (this.action.edit = n.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, n) {
		return e.isPreferred && !n.isPreferred ? -1 : !e.isPreferred && n.isPreferred ? 1 : 0;
	}
	static codeActionsComparator({ action: n }, { action: r }) {
		return n.isAI && !r.isAI ? 1 : !n.isAI && r.isAI ? -1 : isNonEmptyArray(n.diagnostics) ? isNonEmptyArray(r.diagnostics) ? e.codeActionsPreferredComparator(n, r) : -1 : isNonEmptyArray(r.diagnostics) ? 1 : e.codeActionsPreferredComparator(n, r);
	}
	constructor(n, r, i) {
		super(), this.documentation = r, this._register(i), this.allActions = [...n].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, n, r, i, a, o) {
	let s = i.filter || {}, c = {
		...s,
		excludes: [...s.excludes || [], CodeActionKind.Notebook]
	}, l = {
		only: s.include?.value,
		trigger: i.type
	}, u = new TextModelCancellationTokenSource(n, o), d = i.type === 2, f = getCodeActionProviders(e, n, d ? c : s), m = new DisposableStore(), g = f.map(async (e) => {
		try {
			a.report(e);
			let i = await e.provideCodeActions(n, r, l, u.token);
			if (i && m.add(i), u.token.isCancellationRequested) return emptyCodeActionsResponse;
			let o = (i?.actions || []).filter((e) => e && filtersAction(s, e)), c = getDocumentationFromProvider(e, o, s.include);
			return {
				actions: o.map((n) => new CodeActionItem(n, e)),
				documentation: c
			};
		} catch (e) {
			if (isCancellationError(e)) throw e;
			return onUnexpectedExternalError(e), emptyCodeActionsResponse;
		}
	}), _ = e.onDidChange(() => {
		let r = e.all(n);
		equals(r, f) || u.cancel();
	});
	try {
		let r = await Promise.all(g), a = r.map((e) => e.actions).flat(), o = [...coalesce(r.map((e) => e.documentation)), ...getAdditionalDocumentationForShowingActions(e, n, i, a)];
		return new ManagedCodeActionSet(a, o, m);
	} finally {
		_.dispose(), u.dispose();
	}
}
function getCodeActionProviders(e, n, r) {
	return e.all(n).filter((e) => e.providedCodeActionKinds ? e.providedCodeActionKinds.some((e) => mayIncludeActionsOfKind(r, new HierarchicalKind(e))) : !0);
}
function* getAdditionalDocumentationForShowingActions(e, n, r, i) {
	if (n && i.length) for (let a of e.all(n)) a._getAdditionalMenuItems && (yield* a._getAdditionalMenuItems?.({
		trigger: r.type,
		only: r.filter?.include?.value
	}, i.map((e) => e.action)));
}
function getDocumentationFromProvider(e, n, r) {
	if (!e.documentation) return;
	let i = e.documentation.map((e) => ({
		kind: new HierarchicalKind(e.kind),
		command: e.command
	}));
	if (r) {
		let e;
		for (let n of i) n.kind.contains(r) && (e ? e.kind.contains(n.kind) && (e = n) : e = n);
		if (e) return e?.command;
	}
	for (let e of n) if (e.kind) {
		for (let n of i) if (n.kind.contains(new HierarchicalKind(e.kind))) return n.command;
	}
}
var ApplyCodeActionReason;
(function(e) {
	e.OnSave = "onSave", e.FromProblemsView = "fromProblemsView", e.FromCodeActions = "fromCodeActions", e.FromAILightbulb = "fromAILightbulb";
})(ApplyCodeActionReason ||= {});
async function applyCodeAction(e, n, r, i, a = CancellationToken.None) {
	let o = e.get(IBulkEditService), s = e.get(ICommandService), c = e.get(ITelemetryService), l = e.get(INotificationService);
	if (c.publicLog2("codeAction.applyCodeAction", {
		codeActionTitle: n.action.title,
		codeActionKind: n.action.kind,
		codeActionIsPreferred: !!n.action.isPreferred,
		reason: r
	}), await n.resolve(a), !a.isCancellationRequested && !(n.action.edit?.edits.length && !(await o.apply(n.action.edit, {
		editor: i?.editor,
		label: n.action.title,
		quotableLabel: n.action.title,
		code: "undoredo.codeAction",
		respectAutoSaveConfig: r !== ApplyCodeActionReason.OnSave,
		showPreview: i?.preview
	})).isApplied) && n.action.command) try {
		await s.executeCommand(n.action.command.id, ...n.action.command.arguments || []);
	} catch (e) {
		let n = asMessage(e);
		l.error(typeof n == "string" ? n : 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, n, r, i, o) {
	if (!(n instanceof URI)) throw illegalArgument();
	let { codeActionProvider: s } = e.get(ILanguageFeaturesService), c = e.get(IModelService).getModel(n);
	if (!c) throw illegalArgument();
	let l = Selection.isISelection(r) ? Selection.liftSelection(r) : Range.isIRange(r) ? c.validateRange(r) : void 0;
	if (!l) throw illegalArgument();
	let u = typeof i == "string" ? new HierarchicalKind(i) : void 0, d = await getCodeActions(s, c, l, {
		type: 1,
		triggerAction: CodeActionTriggerSource.Default,
		filter: {
			includeSourceActions: !0,
			include: u
		}
	}, Progress.None, CancellationToken.None), f = [], m = Math.min(d.validActions.length, typeof o == "number" ? o : 0);
	for (let e = 0; e < m; e++) f.push(d.validActions[e].resolve(CancellationToken.None));
	try {
		return await Promise.all(f), d.validActions.map((e) => e.action);
	} finally {
		setTimeout(() => d.dispose(), 100);
	}
});
var __decorate$96 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$96 = function(e, n) {
	return function(r, i) {
		n(r, i, 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 n = e.commandArgs;
			return e.command === "editor.action.organizeImports" ? n = { kind: CodeActionKind.SourceOrganizeImports.value } : e.command === "editor.action.fixAll" && (n = { kind: CodeActionKind.SourceFixAll.value }), {
				resolvedKeybinding: e.resolvedKeybinding,
				...CodeActionCommandArgs.fromUser(n, {
					kind: HierarchicalKind.None,
					apply: "never"
				})
			};
		}));
		return (n) => {
			if (n.kind) return this.bestKeybindingForCodeAction(n, e.value)?.resolvedKeybinding;
		};
	}
	bestKeybindingForCodeAction(e, n) {
		if (!e.kind) return;
		let r = new HierarchicalKind(e.kind);
		return n.filter((e) => e.kind.contains(r)).filter((n) => n.preferred ? e.isPreferred : !0).reduceRight((e, n) => e ? e.kind.contains(n.kind) ? n : e : n, 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, n, r) {
	if (!n) 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 i = codeActionGroups.map((e) => ({
		group: e,
		actions: []
	}));
	for (let n of e) {
		let e = n.action.kind ? new HierarchicalKind(n.action.kind) : HierarchicalKind.None;
		for (let r of i) if (r.group.kind.contains(e)) {
			r.actions.push(n);
			break;
		}
	}
	let a = [];
	for (let e of i) if (e.actions.length) {
		a.push({
			kind: "header",
			group: e.group
		});
		for (let n of e.actions) {
			let i = e.group;
			a.push({
				kind: "action",
				item: n,
				group: n.action.isAI ? {
					title: i.title,
					kind: i.kind,
					icon: Codicon.sparkle
				} : i,
				label: n.action.title,
				disabled: !!n.action.disabled,
				keybinding: r(n.action)
			});
		}
	}
	return a;
}
var __decorate$95 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$95 = function(e, n) {
	return function(r, i) {
		n(r, i, 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 n {
		constructor(e, n, r, i) {
			this.actions = e, this.trigger = n, this.editorPosition = r, this.widgetPosition = i, this.type = 1;
		}
	}
	e.Showing = n;
})(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, n) {
		super(), this._editor = e, this._keybindingService = n, 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 n = this._editor.getModel();
			(this.state.type !== 1 || !n || this.state.editorPosition.lineNumber >= n.getLineCount()) && this.hide(), (this.gutterState.type !== 1 || !n || this.gutterState.editorPosition.lineNumber >= n.getLineCount()) && this.gutterHide();
		})), this._register(addStandardDisposableGenericMouseDownListener(this._domNode, (e) => {
			if (this.state.type !== 1) return;
			this._editor.focus(), e.preventDefault();
			let { top: n, height: r } = getDomNodePagePosition(this._domNode), i = this._editor.getOption(67), a = Math.floor(i / 3);
			this.state.widgetPosition.position !== null && this.state.widgetPosition.position.lineNumber < this.state.editorPosition.lineNumber && (a += i), this._onClick.fire({
				x: e.posx,
				y: n + r + a,
				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((n) => e.target.element && e.target.element.classList.contains(n)) || this.gutterState.type !== 1) return;
			this._editor.focus();
			let { top: n, height: r } = getDomNodePagePosition(e.target.element), i = this._editor.getOption(67), a = Math.floor(i / 3);
			this.gutterState.widgetPosition.position !== null && this.gutterState.widgetPosition.position.lineNumber < this.gutterState.editorPosition.lineNumber && (a += i), this._onClick.fire({
				x: e.event.posx,
				y: n + r + a,
				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, n, r) {
		if (e.validActions.length <= 0 || !this._editor.hasTextFocus() || !this._editor.getOptions().get(65).enabled) return this.gutterHide(), this.hide();
		let i = this._editor.getModel();
		if (!i) return this.gutterHide(), this.hide();
		let { lineNumber: a, column: o } = i.validatePosition(r), s = i.getOptions().tabSize, c = this._editor.getOptions().get(50), l = i.getLineContent(a), u = computeIndentLevel(l, s), d = c.spaceWidth * u > 22, f = (e) => e > 2 && this._editor.getTopForLineNumber(e) === this._editor.getTopForLineNumber(e - 1), m = this._editor.getLineDecorations(a), g = !1;
		if (m) for (let e of m) {
			let n = e.options.glyphMarginClassName;
			if (n && !this.lightbulbClasses.some((e) => n.includes(e))) {
				g = !0;
				break;
			}
		}
		let _ = a, v = 1;
		if (!d) {
			let s = (e) => {
				let n = i.getLineContent(e);
				return /^\s*$|^\s+/.test(n) || n.length <= v;
			};
			if (a > 1 && !f(a - 1)) {
				let o = i.getLineCount(), c = a === o, l = a > 1 && s(a - 1), u = !c && s(a + 1), d = s(a), f = !u && !l;
				if (!u && !l && !g) return this.gutterState = new LightBulbState.Showing(e, n, r, {
					position: {
						lineNumber: _,
						column: v
					},
					preference: LightBulbWidget_1._posPref
				}), this.renderGutterLightbub(), this.hide();
				l || c || l && !d ? --_ : (u || f && d) && (_ += 1);
			} else if (a === 1 && (a === i.getLineCount() || !s(a + 1) && !s(a))) if (this.gutterState = new LightBulbState.Showing(e, n, r, {
				position: {
					lineNumber: _,
					column: v
				},
				preference: LightBulbWidget_1._posPref
			}), g) this.gutterHide();
			else return this.renderGutterLightbub(), this.hide();
			else if (a < i.getLineCount() && !f(a + 1)) _ += 1;
			else if (o * c.spaceWidth < 22) return this.hide();
			v = /^\S\s*$/.test(i.getLineContent(_)) ? 2 : 1;
		}
		this.state = new LightBulbState.Showing(e, n, r, {
			position: {
				lineNumber: _,
				column: v
			},
			preference: LightBulbWidget_1._posPref
		}), this._gutterDecorationID && (this._removeGutterDecoration(this._gutterDecorationID), this.gutterHide());
		let y = e.validActions, b = e.validActions[0].action.kind;
		if (y.length !== 1 || !b) {
			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, n = !1;
		this.state.actions.allAIFixes ? (e = Codicon.sparkleFilled, this.state.actions.validActions.length === 1 && (n = !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, n), this._iconClasses = ThemeIcon.asClassNameArray(e), this._domNode.classList.add(...this._iconClasses);
	}
	_updateGutterLightBulbTitleAndIcon() {
		if (this.gutterState.type !== 1) return;
		let e, n = !1;
		this.gutterState.actions.allAIFixes ? (e = GUTTER_SPARKLE_FILLED_ICON, this.gutterState.actions.validActions.length === 1 && (n = !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, n), 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((n) => {
			this._gutterDecorationID = n.addDecoration(new Range(e, 0, e, 0), this.gutterDecoration);
		});
	}
	_removeGutterDecoration(e) {
		this._editor.changeDecorations((n) => {
			n.removeDecoration(e), this._gutterDecorationID = void 0;
		});
	}
	_updateGutterDecoration(e, n) {
		this._editor.changeDecorations((r) => {
			r.changeDecoration(e, new Range(n, 0, n, 0)), r.changeDecorationOptions(e, this.gutterDecoration);
		});
	}
	_updateLightbulbTitle(e, n) {
		this.state.type === 1 && (n ? 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, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$94 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
};
const acceptSelectedActionCommand = "acceptSelectedCodeAction", previewSelectedActionCommand = "previewSelectedCodeAction";
var HeaderRenderer = class {
	get templateId() {
		return "header";
	}
	renderTemplate(e) {
		e.classList.add("group-header");
		let n = document.createElement("span");
		return e.append(n), {
			container: e,
			text: n
		};
	}
	renderElement(e, n, r) {
		r.text.textContent = e.group?.title ?? "";
	}
	disposeTemplate(e) {}
}, ActionItemRenderer = class {
	get templateId() {
		return "action";
	}
	constructor(e, n) {
		this._supportsPreview = e, this._keybindingService = n;
	}
	renderTemplate(e) {
		e.classList.add(this.templateId);
		let n = document.createElement("div");
		n.className = "icon", e.append(n);
		let r = document.createElement("span");
		r.className = "title", e.append(r);
		let i = new KeybindingLabel(e, OS);
		return {
			container: e,
			icon: n,
			text: r,
			keybinding: i
		};
	}
	renderElement(e, n, r) {
		if (e.group?.icon ? (r.icon.className = ThemeIcon.asClassName(e.group.icon), e.group.icon.color && (r.icon.style.color = asCssVariable(e.group.icon.color.id))) : (r.icon.className = ThemeIcon.asClassName(Codicon.lightBulb), r.icon.style.color = "var(--vscode-editorLightBulb-foreground)"), !e.item || !e.label) return;
		r.text.textContent = stripNewlines(e.label), r.keybinding.set(e.keybinding), setVisibility(!!e.keybinding, r.keybinding.element);
		let i = this._keybindingService.lookupKeybinding(acceptSelectedActionCommand)?.getLabel(), a = this._keybindingService.lookupKeybinding(previewSelectedActionCommand)?.getLabel();
		r.container.classList.toggle("option-disabled", e.disabled), e.disabled ? r.container.title = e.label : i && a ? this._supportsPreview && e.canPreview ? r.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", i, a) : r.container.title = localize({
			key: "label",
			comment: ["placeholder is a keybinding, e.g \"F2 to Apply\""]
		}, "{0} to Apply", i) : r.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, n, r, i, a, o) {
		super(), this._delegate = i, this._contextViewService = a, this._keybindingService = o, 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(n, this._keybindingService), new HeaderRenderer()], {
			keyboardSupport: !1,
			typeNavigationEnabled: !0,
			keyboardNavigationLabelProvider: { getKeyboardNavigationLabel },
			accessibilityProvider: {
				getAriaLabel: (e) => {
					if (e.kind === "action") {
						let n = e.label ? stripNewlines(e?.label) : "";
						return e.disabled && (n = localize({
							key: "customQuickFixWidget.labels",
							comment: ["Action widget labels for accessibility."]
						}, "{0}, Disabled Reason: {1}", n, e.disabled)), n;
					}
					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 = r, 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 n = this._allMenuItems.filter((e) => e.kind === "header").length, r = this._allMenuItems.length * this._actionLineHeight + n * this._headerLineHeight - n * this._actionLineHeight;
		this._list.layout(r);
		let i = e;
		if (this._allMenuItems.length >= 50) i = 380;
		else {
			let n = this._allMenuItems.map((e, n) => {
				let r = this.domNode.ownerDocument.getElementById(this._list.getElementID(n));
				if (r) {
					r.style.width = "auto";
					let e = r.getBoundingClientRect().width;
					return r.style.width = "", e;
				}
				return 0;
			});
			i = Math.max(...n, e);
		}
		let a = Math.min(r, this.domNode.ownerDocument.body.clientHeight * .7);
		return this._list.layout(a, i), this.domNode.style.height = `${a}px`, this._list.domFocus(), i;
	}
	focusPrevious() {
		this._list.focusPrevious(1, !0, void 0, this.focusCondition);
	}
	focusNext() {
		this._list.focusNext(1, !0, void 0, this.focusCondition);
	}
	acceptSelected(e) {
		let n = this._list.getFocus();
		if (n.length === 0) return;
		let r = n[0], i = this._list.element(r);
		if (!this.focusCondition(i)) return;
		let a = e ? new PreviewSelectedEvent() : new AcceptSelectedEvent();
		this._list.setSelection([r], a);
	}
	onListSelection(e) {
		if (!e.elements.length) return;
		let n = e.elements[0];
		n.item && this.focusCondition(n) ? this._delegate.onSelect(n.item, e.browserEvent instanceof PreviewSelectedEvent) : this._list.setSelection([]);
	}
	onFocus() {
		let e = this._list.getFocus();
		if (e.length === 0) return;
		let n = e[0], r = this._list.element(n);
		this._delegate.onFocus?.(r.item);
	}
	async onListHover(e) {
		let n = e.element;
		if (n && n.item && this.focusCondition(n)) {
			if (this._delegate.onHover && !n.disabled && n.kind === "action") {
				let e = await this._delegate.onHover(n.item, this.cts.token);
				n.canPreview = e ? e.canPreview : void 0;
			}
			e.index && this._list.splice(e.index, 1, [n]);
		}
		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, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$93 = function(e, n) {
	return function(r, i) {
		n(r, i, 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, n, r) {
		super(), this._contextViewService = e, this._contextKeyService = n, this._instantiationService = r, this._list = this._register(new MutableDisposable());
	}
	show(e, n, r, i, a, o, s) {
		let c = ActionWidgetContextKeys.Visible.bindTo(this._contextKeyService), l = this._instantiationService.createInstance(ActionList, e, n, r, i);
		this._contextViewService.showContextView({
			getAnchor: () => a,
			render: (e) => (c.set(!0), this._renderWidget(e, l, s ?? [])),
			onHide: (e) => {
				c.reset(), this._onWidgetClosed(e);
			}
		}, o, !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, n, r) {
		let i = document.createElement("div");
		if (i.classList.add("action-widget"), e.appendChild(i), this._list.value = n, this._list.value) i.appendChild(this._list.value.domNode);
		else throw Error("List has no value");
		let a = new DisposableStore(), o = document.createElement("div"), s = e.appendChild(o);
		s.classList.add("context-view-block"), a.add(addDisposableListener(s, EventType$1.MOUSE_DOWN, (e) => e.stopPropagation()));
		let c = document.createElement("div"), l = e.appendChild(c);
		l.classList.add("context-view-pointerBlock"), a.add(addDisposableListener(l, EventType$1.POINTER_MOVE, () => l.remove())), a.add(addDisposableListener(l, EventType$1.MOUSE_DOWN, () => l.remove()));
		let u = 0;
		if (r.length) {
			let e = this._createActionBar(".action-widget-action-bar", r);
			e && (i.appendChild(e.getContainer().parentElement), a.add(e), u = e.getContainer().offsetWidth);
		}
		let d = this._list.value?.layout(u);
		i.style.width = `${d}px`;
		let f = a.add(trackFocus(e));
		return a.add(f.onDidBlur(() => this.hide(!0))), a;
	}
	_createActionBar(e, n) {
		if (!n.length) return;
		let r = $(e), i = new ActionBar(r);
		return i.push(n, {
			icon: !1,
			label: !0
		}), i;
	}
	_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 n = e.get(IActionWidgetService);
		n instanceof ActionWidgetService && n.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 n = e.get(IActionWidgetService);
		n instanceof ActionWidgetService && n.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 n = e.get(IActionWidgetService);
		n instanceof ActionWidgetService && n.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 n = e.get(IActionWidgetService);
		n instanceof ActionWidgetService && n.acceptSelected(!0);
	}
});
const SUPPORTED_CODE_ACTIONS = new RawContextKey("supportedCodeAction", "");
var CodeActionOracle = class extends Disposable {
	constructor(e, n, r, i = 250) {
		super(), this._editor = e, this._markerService = n, this._signalChange = r, this._delay = i, 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 n = this._getRangeOfSelectionUnlessWhitespaceEnclosed(e);
		this._signalChange(n ? {
			trigger: e,
			selection: n
		} : void 0);
	}
	_onMarkerChanges(e) {
		let n = this._editor.getModel();
		n && e.some((e) => isEqual(e, n.uri)) && this._tryAutoTrigger();
	}
	_tryAutoTrigger() {
		this._autoTriggerTimer.cancelAndSet(() => {
			this.trigger({
				type: 2,
				triggerAction: CodeActionTriggerSource.Default
			});
		}, this._delay);
	}
	_getRangeOfSelectionUnlessWhitespaceEnclosed(e) {
		if (!this._editor.hasModel()) return;
		let n = this._editor.getSelection();
		if (e.type === 1) return n;
		let r = this._editor.getOption(65).enabled;
		if (r !== ShowLightbulbIconMode.Off) {
			if (r === ShowLightbulbIconMode.On) return n;
			if (r === ShowLightbulbIconMode.OnCode) {
				if (!n.isEmpty()) return n;
				let e = this._editor.getModel(), { lineNumber: r, column: i } = n.getPosition(), a = e.getLineContent(r);
				if (a.length === 0) return;
				if (i === 1) {
					if (/\s/.test(a[0])) return;
				} else if (i === e.getLineMaxColumn(r)) {
					if (/\s/.test(a[a.length - 1])) return;
				} else if (/\s/.test(a[i - 2]) && /\s/.test(a[i - 1])) return;
			}
			return n;
		}
	}
}, CodeActionsState;
(function(e) {
	e.Empty = { type: 0 };
	class n {
		constructor(e, n, r) {
			this.trigger = e, this.position = n, this._cancellablePromise = r, this.type = 1, this.actions = r.catch((e) => {
				if (isCancellationError(e)) return emptyCodeActionSet;
				throw e;
			});
		}
		cancel() {
			this._cancellablePromise.cancel();
		}
	}
	e.Triggered = n;
})(CodeActionsState ||= {});
var emptyCodeActionSet = Object.freeze({
	allActions: [],
	validActions: [],
	dispose: () => {},
	documentation: [],
	hasAutoFix: !1,
	hasAIFix: !1,
	allAIFixes: !1
}), CodeActionModel = class extends Disposable {
	constructor(e, n, r, i, a, o, s) {
		super(), this._editor = e, this._registry = n, this._markerService = r, this._progressService = a, this._configurationService = o, this._telemetryService = s, 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(i), 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 n = this._registry.all(e).flatMap((e) => e.providedCodeActionKinds ?? []);
			this._supportedCodeActions.set(n.join(" ")), this._codeActionOracle.value = new CodeActionOracle(this._editor, this._markerService, (n) => {
				if (!n) {
					this.setState(CodeActionsState.Empty);
					return;
				}
				let r = n.selection.getStartPosition(), i = createCancelablePromise(async (r) => {
					if (this._settingEnabledNearbyQuickfixes() && n.trigger.type === 1 && (n.trigger.triggerAction === CodeActionTriggerSource.QuickFix || n.trigger.filter?.include?.contains(CodeActionKind.QuickFix))) {
						let i = await getCodeActions(this._registry, e, n.selection, n.trigger, Progress.None, r), a = [...i.allActions];
						if (r.isCancellationRequested) return emptyCodeActionSet;
						let o = i.validActions?.some((e) => e.action.kind ? CodeActionKind.QuickFix.contains(new HierarchicalKind(e.action.kind)) : !1), s = this._markerService.read({ resource: e.uri });
						if (o) {
							for (let e of i.validActions) e.action.command?.arguments?.some((e) => typeof e == "string" && e.includes("_typescript.applyFixAllCodeAction")) && (e.action.diagnostics = [...s.filter((e) => e.relatedInformation)]);
							return {
								validActions: i.validActions,
								allActions: a,
								documentation: i.documentation,
								hasAutoFix: i.hasAutoFix,
								hasAIFix: i.hasAIFix,
								allAIFixes: i.allAIFixes,
								dispose: () => {
									i.dispose();
								}
							};
						} else if (!o && s.length > 0) {
							let o = n.selection.getPosition(), c = o, l = Number.MAX_VALUE, u = [...i.validActions];
							for (let d of s) {
								let f = d.endColumn, m = d.endLineNumber, g = d.startLineNumber;
								if (m === o.lineNumber || g === o.lineNumber) {
									c = new Position(m, f);
									let d = {
										type: n.trigger.type,
										triggerAction: n.trigger.triggerAction,
										filter: { include: n.trigger.filter?.include ? n.trigger.filter?.include : CodeActionKind.QuickFix },
										autoApply: n.trigger.autoApply,
										context: {
											notAvailableMessage: n.trigger.context?.notAvailableMessage || "",
											position: c
										}
									}, g = new Selection(c.lineNumber, c.column, c.lineNumber, c.column), _ = await getCodeActions(this._registry, e, g, d, Progress.None, r);
									if (_.validActions.length !== 0) {
										for (let e of _.validActions) e.action.command?.arguments?.some((e) => typeof e == "string" && e.includes("_typescript.applyFixAllCodeAction")) && (e.action.diagnostics = [...s.filter((e) => e.relatedInformation)]);
										i.allActions.length === 0 && a.push(..._.allActions), Math.abs(o.column - f) < l ? u.unshift(..._.validActions) : u.push(..._.validActions);
									}
									l = Math.abs(o.column - f);
								}
							}
							let d = u.filter((e, n, r) => r.findIndex((n) => n.action.title === e.action.title) === n);
							return d.sort((e, n) => e.action.isPreferred && !n.action.isPreferred ? -1 : !e.action.isPreferred && n.action.isPreferred || e.action.isAI && !n.action.isAI ? 1 : !e.action.isAI && n.action.isAI ? -1 : 0), {
								validActions: d,
								allActions: a,
								documentation: i.documentation,
								hasAutoFix: i.hasAutoFix,
								hasAIFix: i.hasAIFix,
								allAIFixes: i.allAIFixes,
								dispose: () => {
									i.dispose();
								}
							};
						}
					}
					if (n.trigger.type === 1) {
						let i = new StopWatch(), a = await getCodeActions(this._registry, e, n.selection, n.trigger, Progress.None, r);
						return this._telemetryService && this._telemetryService.publicLog2("codeAction.invokedDurations", {
							codeActions: a.validActions.length,
							duration: i.elapsed()
						}), a;
					}
					return getCodeActions(this._registry, e, n.selection, n.trigger, Progress.None, r);
				});
				n.trigger.type === 1 && this._progressService?.showWhile(i, 250);
				let a = new CodeActionsState.Triggered(n.trigger, r, i), o = !1;
				this._state.type === 1 && (o = this._state.trigger.type === 1 && a.type === 1 && a.trigger.type === 2 && this._state.position !== a.position), o ? setTimeout(() => {
					this.setState(a);
				}, 500) : this.setState(a);
			}, void 0), this._codeActionOracle.value.trigger({
				type: 2,
				triggerAction: CodeActionTriggerSource.Default
			});
		} else this._supportedCodeActions.reset();
	}
	trigger(e) {
		this._codeActionOracle.value?.trigger(e);
	}
	setState(e, n) {
		e !== this._state && (this._state.type === 1 && this._state.cancel(), this._state = e, !n && !this._disposed && this._onDidChangeState.fire(e));
	}
}, __decorate$92 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$92 = function(e, n) {
	return function(r, i) {
		n(r, i, 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, n, r, i, a, o, s, c, l, u, d) {
		super(), this._commandService = s, this._configurationService = c, this._actionWidgetService = l, this._instantiationService = u, this._telemetryService = d, this._activeCodeActions = this._register(new MutableDisposable()), this._showDisabled = !1, this._disposed = !1, this._editor = e, this._model = this._register(new CodeActionModel(this._editor, a.codeActionProvider, n, r, o, c, 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 = i.createInstance(CodeActionKeybindingResolver), this._register(this._editor.onDidLayoutChange(() => this._actionWidgetService.hide()));
	}
	dispose() {
		this._disposed = !0, super.dispose();
	}
	async showCodeActionsFromLightbulb(e, n) {
		if (e.allAIFixes && e.validActions.length === 1) {
			let n = e.validActions[0], r = n.action.command;
			r && r.id === "inlineChat.start" && r.arguments && r.arguments.length >= 1 && (r.arguments[0] = {
				...r.arguments[0],
				autoSend: !1
			}), await this._applyCodeAction(n, !1, !1, ApplyCodeActionReason.FromAILightbulb);
			return;
		}
		await this.showCodeActionList(e, n, {
			includeDisabledActions: !1,
			fromLightbulb: !0
		});
	}
	showCodeActions(e, n, r) {
		return this.showCodeActionList(n, r, {
			includeDisabledActions: !1,
			fromLightbulb: !1
		});
	}
	manualTriggerAtCurrentPosition(e, n, r, i) {
		if (!this._editor.hasModel()) return;
		MessageController.get(this._editor)?.closeMessage();
		let a = this._editor.getPosition();
		this._trigger({
			type: 1,
			triggerAction: n,
			filter: r,
			autoApply: i,
			context: {
				notAvailableMessage: e,
				position: a
			}
		});
	}
	_trigger(e) {
		return this._model.trigger(e);
	}
	async _applyCodeAction(e, n, r, i) {
		try {
			await this._instantiationService.invokeFunction(applyCodeAction, e, i, {
				preview: r,
				editor: this._editor
			});
		} finally {
			n && 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 n;
		try {
			n = await e.actions;
		} catch (e) {
			onUnexpectedError(e);
			return;
		}
		if (!this._disposed && this._editor.getSelection()?.startLineNumber === e.position.lineNumber) if (this._lightBulbWidget.value?.update(n, e.trigger, e.position), e.trigger.type === 1) {
			if (e.trigger.filter?.include) {
				let r = this.tryGetValidActionToApply(e.trigger, n);
				if (r) {
					try {
						this.hideLightBulbWidget(), await this._applyCodeAction(r, !1, !1, ApplyCodeActionReason.FromCodeActions);
					} finally {
						n.dispose();
					}
					return;
				}
				if (e.trigger.context) {
					let r = this.getInvalidActionThatWouldHaveBeenApplied(e.trigger, n);
					if (r && r.action.disabled) {
						MessageController.get(this._editor)?.showMessage(r.action.disabled, e.trigger.context.position), n.dispose();
						return;
					}
				}
			}
			let r = !!e.trigger.filter?.include;
			if (e.trigger.context && (!n.allActions.length || !r && !n.validActions.length)) {
				MessageController.get(this._editor)?.showMessage(e.trigger.context.notAvailableMessage, e.trigger.context.position), this._activeCodeActions.value = n, n.dispose();
				return;
			}
			this._activeCodeActions.value = n, this.showCodeActionList(n, this.toCoords(e.position), {
				includeDisabledActions: r,
				fromLightbulb: !1
			});
		} else this._actionWidgetService.isVisible ? n.dispose() : this._activeCodeActions.value = n;
	}
	getInvalidActionThatWouldHaveBeenApplied(e, n) {
		if (n.allActions.length && (e.autoApply === "first" && n.validActions.length === 0 || e.autoApply === "ifSingle" && n.allActions.length === 1)) return n.allActions.find(({ action: e }) => e.disabled);
	}
	tryGetValidActionToApply(e, n) {
		if (n.validActions.length && (e.autoApply === "first" && n.validActions.length > 0 || e.autoApply === "ifSingle" && n.validActions.length === 1)) return n.validActions[0];
	}
	static {
		this.DECORATION = ModelDecorationOptions.register({
			description: "quickfix-highlight",
			className: DECORATION_CLASS_NAME$1
		});
	}
	async showCodeActionList(e, n, r) {
		let i = this._editor.createDecorationsCollection(), a = this._editor.getDomNode();
		if (!a) return;
		let o = r.includeDisabledActions && (this._showDisabled || e.validActions.length === 0) ? e.allActions : e.validActions;
		if (!o.length) return;
		let s = Position.isIPosition(n) ? this.toCoords(n) : n;
		this._actionWidgetService.show("codeActionWidget", !0, toMenuItems(o, this._shouldShowHeaders(), this._resolver.getResolver()), {
			onSelect: async (e, n) => {
				this._applyCodeAction(e, !0, !!n, r.fromLightbulb ? ApplyCodeActionReason.FromAILightbulb : ApplyCodeActionReason.FromCodeActions), this._actionWidgetService.hide(!1), i.clear();
			},
			onHide: (e) => {
				this._editor?.focus(), i.clear();
			},
			onHover: async (e, n) => {
				if (n.isCancellationRequested) return;
				let r = !1, i = e.action.kind;
				if (i) {
					let e = new HierarchicalKind(i);
					r = [
						CodeActionKind.RefactorExtract,
						CodeActionKind.RefactorInline,
						CodeActionKind.RefactorRewrite,
						CodeActionKind.RefactorMove,
						CodeActionKind.Source
					].some((n) => n.contains(e));
				}
				return { canPreview: r || !!e.action.edit?.edits.length };
			},
			onFocus: (e) => {
				if (e && e.action) {
					let n = e.action.ranges, r = e.action.diagnostics;
					if (i.clear(), n && n.length > 0) {
						let e = r && r?.length > 1 ? r.map((e) => ({
							range: e,
							options: CodeActionController_1.DECORATION
						})) : n.map((e) => ({
							range: e,
							options: CodeActionController_1.DECORATION
						}));
						i.set(e);
					} else if (r && r.length > 0) {
						let e = r.map((e) => ({
							range: e,
							options: CodeActionController_1.DECORATION
						}));
						i.set(e);
						let n = r[0];
						if (n.startLineNumber && n.startColumn) {
							let e = this._editor.getModel()?.getWordAtPosition({
								lineNumber: n.startLineNumber,
								column: n.startColumn
							})?.word;
							status(localize("editingNewSelection", "Context: {0} at line {1} and column {2}.", e, n.startLineNumber, n.startColumn));
						}
					}
				} else i.clear();
			}
		}, s, a, this._getActionBarActions(e, n, r));
	}
	toCoords(e) {
		if (!this._editor.hasModel()) return {
			x: 0,
			y: 0
		};
		this._editor.revealPosition(e, 1), this._editor.render();
		let n = this._editor.getScrolledVisiblePosition(e), r = getDomNodePagePosition(this._editor.getDomNode()), i = r.left + n.left, a = r.top + n.top + n.height;
		return {
			x: i,
			y: a
		};
	}
	_shouldShowHeaders() {
		let e = this._editor?.getModel();
		return this._configurationService.getValue("editor.codeActionWidget.showHeaders", { resource: e?.uri });
	}
	_getActionBarActions(e, n, r) {
		if (r.fromLightbulb) return [];
		let i = 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 r.includeDisabledActions && e.validActions.length > 0 && e.allActions.length !== e.validActions.length && i.push(this._showDisabled ? {
			id: "hideMoreActions",
			label: localize("hideMoreActions", "Hide Disabled"),
			enabled: !0,
			tooltip: "",
			class: void 0,
			run: () => (this._showDisabled = !1, this.showCodeActionList(e, n, r))
		} : {
			id: "showMoreActions",
			label: localize("showMoreActions", "Show Disabled"),
			enabled: !0,
			tooltip: "",
			class: void 0,
			run: () => (this._showDisabled = !0, this.showCodeActionList(e, n, r))
		}), i;
	}
};
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, n) => {
	((e, r) => {
		r && n.addRule(`.monaco-editor ${e} { background-color: ${r}; }`);
	})(".quickfix-edit-highlight", e.getColor(editorFindMatchHighlight));
	let r = e.getColor(editorFindMatchHighlightBorder);
	r && n.addRule(`.monaco-editor .quickfix-edit-highlight { border: 1px ${isHighContrast(e.type) ? "dotted" : "solid"} ${r}; 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, n, r, i, a = CodeActionTriggerSource.Default) {
	e.hasModel() && CodeActionController.get(e)?.manualTriggerAtCurrentPosition(n, a, r, i);
}
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, n) {
		return triggerCodeActionsForEditorSelection(n, 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, n, r) {
		let i = CodeActionCommandArgs.fromUser(r, {
			kind: HierarchicalKind.Empty,
			apply: "ifSingle"
		});
		return triggerCodeActionsForEditorSelection(n, typeof r?.kind == "string" ? i.preferred ? localize("editor.action.codeAction.noneMessage.preferred.kind", "No preferred code actions for '{0}' available", r.kind) : localize("editor.action.codeAction.noneMessage.kind", "No code actions for '{0}' available", r.kind) : i.preferred ? localize("editor.action.codeAction.noneMessage.preferred", "No preferred code actions available") : localize("editor.action.codeAction.noneMessage", "No code actions available"), {
			include: i.kind,
			includeSourceActions: !0,
			onlyIncludePreferredActions: i.preferred
		}, i.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, n, r) {
		let i = CodeActionCommandArgs.fromUser(r, {
			kind: CodeActionKind.Refactor,
			apply: "never"
		});
		return triggerCodeActionsForEditorSelection(n, typeof r?.kind == "string" ? i.preferred ? localize("editor.action.refactor.noneMessage.preferred.kind", "No preferred refactorings for '{0}' available", r.kind) : localize("editor.action.refactor.noneMessage.kind", "No refactorings for '{0}' available", r.kind) : i.preferred ? localize("editor.action.refactor.noneMessage.preferred", "No preferred refactorings available") : localize("editor.action.refactor.noneMessage", "No refactorings available"), {
			include: CodeActionKind.Refactor.contains(i.kind) ? i.kind : HierarchicalKind.None,
			onlyIncludePreferredActions: i.preferred
		}, i.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, n, r) {
		let i = CodeActionCommandArgs.fromUser(r, {
			kind: CodeActionKind.Source,
			apply: "never"
		});
		return triggerCodeActionsForEditorSelection(n, typeof r?.kind == "string" ? i.preferred ? localize("editor.action.source.noneMessage.preferred.kind", "No preferred source actions for '{0}' available", r.kind) : localize("editor.action.source.noneMessage.kind", "No source actions for '{0}' available", r.kind) : i.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(i.kind) ? i.kind : HierarchicalKind.None,
			includeSourceActions: !0,
			onlyIncludePreferredActions: i.preferred
		}, i.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, n) {
		return triggerCodeActionsForEditorSelection(n, 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, n) {
		return triggerCodeActionsForEditorSelection(n, 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, n) {
		return triggerCodeActionsForEditorSelection(n, 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, n) {
		this._disposables.add(e);
		for (let r of e.lenses) this.lenses.push({
			symbol: r,
			provider: n
		});
	}
};
async function getCodeLensModel(e, n, r) {
	let i = e.ordered(n), a = /* @__PURE__ */ new Map(), o = new CodeLensModel(), s = i.map(async (e, i) => {
		a.set(e, i);
		try {
			let i = await Promise.resolve(e.provideCodeLenses(n, r));
			i && o.add(i, e);
		} catch (e) {
			onUnexpectedExternalError(e);
		}
	});
	return await Promise.all(s), o.lenses = o.lenses.sort((e, n) => e.symbol.range.startLineNumber < n.symbol.range.startLineNumber ? -1 : e.symbol.range.startLineNumber > n.symbol.range.startLineNumber ? 1 : a.get(e.provider) < a.get(n.provider) ? -1 : a.get(e.provider) > a.get(n.provider) ? 1 : e.symbol.range.startColumn < n.symbol.range.startColumn ? -1 : e.symbol.range.startColumn > n.symbol.range.startColumn ? 1 : 0), o;
}
CommandsRegistry.registerCommand("_executeCodeLensProvider", function(e, ...n) {
	let [r, i] = n;
	assertType(URI.isUri(r)), assertType(typeof i == "number" || !i);
	let { codeLensProvider: o } = e.get(ILanguageFeaturesService), s = e.get(IModelService).getModel(r);
	if (!s) throw illegalArgument();
	let c = [], l = new DisposableStore();
	return getCodeLensModel(o, s, CancellationToken.None).then((e) => {
		l.add(e);
		let n = [];
		for (let r of e.lenses) i == null || r.symbol.command ? c.push(r.symbol) : i-- > 0 && r.provider.resolveCodeLens && n.push(Promise.resolve(r.provider.resolveCodeLens(s, r.symbol, CancellationToken.None)).then((e) => c.push(e || r.symbol)));
		return Promise.all(n);
	}).then(() => c).finally(() => {
		setTimeout(() => l.dispose(), 100);
	});
});
var __decorate$91 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$91 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
};
const ICodeLensCache = createDecorator("ICodeLensCache");
var CacheItem = class {
	constructor(e, n) {
		this.lineCount = e, this.data = n;
	}
}, 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 n = "codelens/cache2", r = e.get(n, 1, "{}");
		this._deserialize(r);
		let i = Event.filter(e.onWillSaveState, (e) => e.reason === WillSaveStateReason.SHUTDOWN);
		Event.once(i)((r) => {
			e.store(n, this._serialize(), 1, 1);
		});
	}
	put(e, n) {
		let r = n.lenses.map((e) => ({
			range: e.symbol.range,
			command: e.symbol.command && {
				id: "",
				title: e.symbol.command?.title
			}
		})), i = new CodeLensModel();
		i.add({
			lenses: r,
			dispose: () => {}
		}, this._fakeProvider);
		let a = new CacheItem(e.getLineCount(), i);
		this._cache.set(e.uri.toString(), a);
	}
	get(e) {
		let n = this._cache.get(e.uri.toString());
		return n && n.lineCount === e.getLineCount() ? n.data : void 0;
	}
	delete(e) {
		this._cache.delete(e.uri.toString());
	}
	_serialize() {
		let e = Object.create(null);
		for (let [n, r] of this._cache) {
			let i = /* @__PURE__ */ new Set();
			for (let e of r.data.lenses) i.add(e.symbol.range.startLineNumber);
			e[n] = {
				lineCount: r.lineCount,
				lines: [...i.values()]
			};
		}
		return JSON.stringify(e);
	}
	_deserialize(e) {
		try {
			let n = JSON.parse(e);
			for (let e in n) {
				let r = n[e], i = [];
				for (let e of r.lines) i.push({ range: new Range(e, 1, e, 11) });
				let a = new CodeLensModel();
				a.add({
					lenses: i,
					dispose() {}
				}, this._fakeProvider), this._cache.set(e, new CacheItem(r.lineCount, a));
			}
		} catch {}
	}
};
CodeLensCache = __decorate$91([__param$91(0, IStorageService)], CodeLensCache), registerSingleton(ICodeLensCache, CodeLensCache, 1);
var CodeLensViewZone = class {
	constructor(e, n, r) {
		this.afterColumn = 1073741824, this.afterLineNumber = e, this.heightInPx = n, this._onHeight = r, 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(n, r) {
		this.allowEditorOverflow = !1, this.suppressMouseDown = !0, this._commands = /* @__PURE__ */ new Map(), this._isEmpty = !0, this._editor = n, this._id = `codelens.widget-${e._idPool++}`, this.updatePosition(r), this._domNode = document.createElement("span"), this._domNode.className = "codelens-decoration";
	}
	withCommands(n, r) {
		this._commands.clear();
		let i = [], a = !1;
		for (let r = 0; r < n.length; r++) {
			let o = n[r];
			if (o && (a = !0, o.command)) {
				let a = renderLabelWithIcons(o.command.title.trim());
				if (o.command.id) {
					let n = `c${e._idPool++}`;
					i.push($("a", {
						id: n,
						title: o.command.tooltip,
						role: "button"
					}, ...a)), this._commands.set(n, o.command);
				} else i.push($("span", { title: o.command.tooltip }, ...a));
				r + 1 < n.length && i.push($("span", void 0, "\xA0|\xA0"));
			}
		}
		a ? (reset(this._domNode, ...i), this._isEmpty && r && 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 n = this._editor.getModel().getLineFirstNonWhitespaceColumn(e);
		this._widgetPosition = {
			position: {
				lineNumber: e,
				column: n
			},
			preference: [1]
		};
	}
	getPosition() {
		return this._widgetPosition || null;
	}
}, CodeLensHelper = class {
	constructor() {
		this._removeDecorations = [], this._addDecorations = [], this._addDecorationsCallbacks = [];
	}
	addDecoration(e, n) {
		this._addDecorations.push(e), this._addDecorationsCallbacks.push(n);
	}
	removeDecoration(e) {
		this._removeDecorations.push(e);
	}
	commit(e) {
		let n = e.deltaDecorations(this._removeDecorations, this._addDecorations);
		for (let e = 0, r = n.length; e < r; e++) this._addDecorationsCallbacks[e](n[e]);
	}
}, codeLensDecorationOptions = ModelDecorationOptions.register({
	collapseOnReplaceEdit: !0,
	description: "codelens"
}), CodeLensWidget = class {
	constructor(e, n, r, i, a, o) {
		this._isDisposed = !1, this._editor = n, this._data = e, this._decorationIds = [];
		let s, c = [];
		this._data.forEach((e, n) => {
			e.symbol.command && c.push(e.symbol), r.addDecoration({
				range: e.symbol.range,
				options: codeLensDecorationOptions
			}, (e) => this._decorationIds[n] = e), s = s ? Range.plusRange(s, e.symbol.range) : Range.lift(e.symbol.range);
		}), this._viewZone = new CodeLensViewZone(s.startLineNumber - 1, a, o), this._viewZoneId = i.addZone(this._viewZone), c.length > 0 && (this._createContentWidgetIfNecessary(), this._contentWidget.withCommands(c, !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, n) {
		this._decorationIds.forEach(e.removeDecoration, e), this._decorationIds = [], n?.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, n) => {
			let r = this._editor.getModel().getDecorationRange(e), i = this._data[n].symbol;
			return !!(r && Range.isEmpty(i.range) === r.isEmpty());
		});
	}
	updateCodeLensSymbols(e, n) {
		this._decorationIds.forEach(n.removeDecoration, n), this._decorationIds = [], this._data = e, this._data.forEach((e, r) => {
			n.addDecoration({
				range: e.symbol.range,
				options: codeLensDecorationOptions
			}, (e) => this._decorationIds[r] = e);
		});
	}
	updateHeight(e, n) {
		this._viewZone.heightInPx = e, n.layoutZone(this._viewZoneId), this._contentWidget && this._editor.layoutContentWidget(this._contentWidget);
	}
	computeIfNecessary(e) {
		if (!this._viewZone.isVisible()) return null;
		for (let n = 0; n < this._decorationIds.length; n++) {
			let r = e.getDecorationRange(this._decorationIds[n]);
			r && (this._data[n].symbol.range = r);
		}
		return this._data;
	}
	updateCommands(e) {
		this._createContentWidgetIfNecessary(), this._contentWidget.withCommands(e, !0);
		for (let n = 0; n < this._data.length; n++) {
			let r = e[n];
			if (r) {
				let { symbol: e } = this._data[n];
				e.command = r.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 n = this._editor.getModel().getDecorationRange(this._decorationIds[0]);
			n && (this._viewZone.afterLineNumber = n.startLineNumber - 1, e.layoutZone(this._viewZoneId), this._contentWidget && (this._contentWidget.updatePosition(n.startLineNumber), this._editor.layoutContentWidget(this._contentWidget)));
		}
	}
}, __decorate$90 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$90 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, CodeLensContribution = class {
	static {
		this.ID = "css.editor.codeLens";
	}
	constructor(e, n, r, i, a, o) {
		this._editor = e, this._languageFeaturesService = n, this._commandService = i, this._notificationService = a, this._codeLensCache = o, this._disposables = new DisposableStore(), this._localToDispose = new DisposableStore(), this._lenses = [], this._oldCodeLensModels = new DisposableStore(), this._provideCodeLensDebounce = r.for(n.codeLensProvider, "CodeLensProvide", { min: 250 }), this._resolveCodeLensesDebounce = r.for(n.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(n.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)), n = this._editor.getOption(19);
		return (!n || n < 5) && (n = this._editor.getOption(52) * .9 | 0), {
			fontSize: n,
			codeLensHeight: n * e | 0
		};
	}
	_updateLensStyle() {
		let { codeLensHeight: e, fontSize: n } = this._getLayoutInfo(), r = this._editor.getOption(18), i = this._editor.getOption(50), { style: a } = this._editor.getContainerDomNode();
		a.setProperty("--vscode-editorCodeLens-lineHeight", `${e}px`), a.setProperty("--vscode-editorCodeLens-fontSize", `${n}px`), a.setProperty("--vscode-editorCodeLens-fontFeatureSettings", i.fontFeatureSettings), r && (a.setProperty("--vscode-editorCodeLens-fontFamily", r), a.setProperty("--vscode-editorCodeLens-fontFamilyDefault", EDITOR_FONT_DEFAULTS.fontFamily)), this._editor.changeViewZones((n) => {
			for (let r of this._lenses) r.updateHeight(e, n);
		});
	}
	_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 n = this._codeLensCache.get(e);
		if (n && this._renderCodeLensSymbols(n), !this._languageFeaturesService.codeLensProvider.has(e)) {
			n && disposableTimeout(() => {
				let r = this._codeLensCache.get(e);
				n === r && (this._codeLensCache.delete(e), this._onModelChange());
			}, 30 * 1e3, this._localToDispose);
			return;
		}
		for (let n of this._languageFeaturesService.codeLensProvider.all(e)) if (typeof n.onDidChange == "function") {
			let e = n.onDidChange(() => r.schedule());
			this._localToDispose.add(e);
		}
		let r = new RunOnceScheduler(() => {
			let n = Date.now();
			this._getCodeLensModelPromise?.cancel(), this._getCodeLensModelPromise = createCancelablePromise((n) => getCodeLensModel(this._languageFeaturesService.codeLensProvider, e, n)), this._getCodeLensModelPromise.then((i) => {
				this._currentCodeLensModel && this._oldCodeLensModels.add(this._currentCodeLensModel), this._currentCodeLensModel = i, this._codeLensCache.put(e, i), r.delay = this._provideCodeLensDebounce.update(e, Date.now() - n), this._renderCodeLensSymbols(i), this._resolveCodeLensesInViewportSoon();
			}, onUnexpectedError);
		}, this._provideCodeLensDebounce.get(e));
		this._localToDispose.add(r), this._localToDispose.add(toDisposable(() => this._resolveCodeLensesScheduler.cancel())), this._localToDispose.add(this._editor.onDidChangeModelContent(() => {
			this._editor.changeDecorations((e) => {
				this._editor.changeViewZones((n) => {
					let r = [], i = -1;
					this._lenses.forEach((e) => {
						!e.isValid() || i === e.getLineNumber() ? r.push(e) : (e.update(n), i = e.getLineNumber());
					});
					let a = new CodeLensHelper();
					r.forEach((e) => {
						e.dispose(a, n), this._lenses.splice(this._lenses.indexOf(e), 1);
					}), a.commit(e);
				});
			}), r.schedule(), this._resolveCodeLensesScheduler.cancel(), this._resolveCodeLensesPromise?.cancel(), this._resolveCodeLensesPromise = void 0;
		})), this._localToDispose.add(this._editor.onDidFocusEditorText(() => {
			r.schedule();
		})), this._localToDispose.add(this._editor.onDidBlurEditorText(() => {
			r.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((n) => {
						this._disposeAllLenses(e, n);
					});
				}), 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 n = e.target.element;
			if (n?.tagName === "SPAN" && (n = n.parentElement), n?.tagName === "A") for (let e of this._lenses) {
				let r = e.getCommand(n);
				if (r) {
					this._commandService.executeCommand(r.id, ...r.arguments || []).catch((e) => this._notificationService.error(e));
					break;
				}
			}
		})), r.schedule();
	}
	_disposeAllLenses(e, n) {
		let r = new CodeLensHelper();
		for (let e of this._lenses) e.dispose(r, n);
		e && r.commit(e), this._lenses.length = 0;
	}
	_renderCodeLensSymbols(e) {
		if (!this._editor.hasModel()) return;
		let n = this._editor.getModel().getLineCount(), r = [], i;
		for (let a of e.lenses) {
			let e = a.symbol.range.startLineNumber;
			e < 1 || e > n || (i && i[i.length - 1].symbol.range.startLineNumber === e ? i.push(a) : (i = [a], r.push(i)));
		}
		if (!r.length && !this._lenses.length) return;
		let a = StableEditorScrollState.capture(this._editor), o = this._getLayoutInfo();
		this._editor.changeDecorations((e) => {
			this._editor.changeViewZones((n) => {
				let i = new CodeLensHelper(), a = 0, s = 0;
				for (; s < r.length && a < this._lenses.length;) {
					let e = r[s][0].symbol.range.startLineNumber, c = this._lenses[a].getLineNumber();
					c < e ? (this._lenses[a].dispose(i, n), this._lenses.splice(a, 1)) : c === e ? (this._lenses[a].updateCodeLensSymbols(r[s], i), s++, a++) : (this._lenses.splice(a, 0, new CodeLensWidget(r[s], this._editor, i, n, o.codeLensHeight, () => this._resolveCodeLensesInViewportSoon())), a++, s++);
				}
				for (; a < this._lenses.length;) this._lenses[a].dispose(i, n), this._lenses.splice(a, 1);
				for (; s < r.length;) this._lenses.push(new CodeLensWidget(r[s], this._editor, i, n, o.codeLensHeight, () => this._resolveCodeLensesInViewportSoon())), s++;
				i.commit(e);
			});
		}), a.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 n = [], r = [];
		if (this._lenses.forEach((i) => {
			let a = i.computeIfNecessary(e);
			a && (n.push(a), r.push(i));
		}), n.length === 0) return;
		let i = Date.now(), a = createCancelablePromise((i) => {
			let a = n.map((n, a) => {
				let o = Array(n.length), s = n.map((n, r) => !n.symbol.command && typeof n.provider.resolveCodeLens == "function" ? Promise.resolve(n.provider.resolveCodeLens(e, n.symbol, i)).then((e) => {
					o[r] = e;
				}, onUnexpectedExternalError) : (o[r] = n.symbol, Promise.resolve(void 0)));
				return Promise.all(s).then(() => {
					!i.isCancellationRequested && !r[a].isDisposed() && r[a].updateCommands(o);
				});
			});
			return Promise.all(a);
		});
		this._resolveCodeLensesPromise = a, this._resolveCodeLensesPromise.then(() => {
			let n = this._resolveCodeLensesDebounce.update(e, Date.now() - i);
			this._resolveCodeLensesScheduler.delay = n, this._currentCodeLensModel && this._codeLensCache.put(e, this._currentCodeLensModel), this._oldCodeLensModels.clear(), a === this._resolveCodeLensesPromise && (this._resolveCodeLensesPromise = void 0);
		}, (e) => {
			onUnexpectedError(e), a === 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, n) {
		if (!n.hasModel()) return;
		let r = e.get(IQuickInputService), i = e.get(ICommandService), a = e.get(INotificationService), o = n.getSelection().positionLineNumber, s = n.getContribution(CodeLensContribution.ID);
		if (!s) return;
		let c = await s.getModel();
		if (!c) return;
		let l = [];
		for (let e of c.lenses) e.symbol.command && e.symbol.range.startLineNumber === o && l.push({
			label: e.symbol.command.title,
			command: e.symbol.command
		});
		if (l.length === 0) return;
		let u = await r.pick(l, {
			canPickMany: !1,
			placeHolder: localize("placeHolder", "Select a command")
		});
		if (!u) return;
		let d = u.command;
		if (c.isDisposed) {
			let e = (await s.getModel())?.lenses.find((e) => e.symbol.range.startLineNumber === o && e.symbol.command?.title === d.title);
			if (!e || !e.symbol.command) return;
			d = e.symbol.command;
		}
		try {
			await i.executeCommand(d.id, ...d.arguments || []);
		} catch (e) {
			a.error(e);
		}
	}
});
var __decorate$89 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$89 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, DefaultDocumentColorProvider = class {
	constructor(e) {
		this._editorWorkerService = e;
	}
	async provideDocumentColors(e, n) {
		return this._editorWorkerService.computeDefaultDocumentColors(e.uri);
	}
	provideColorPresentations(e, n, r) {
		let i = n.range, a = n.color, o = a.alpha, s = new Color(new RGBA(Math.round(255 * a.red), Math.round(255 * a.green), Math.round(255 * a.blue), o)), c = o ? Color.Format.CSS.formatRGB(s) : Color.Format.CSS.formatRGBA(s), l = o ? Color.Format.CSS.formatHSL(s) : Color.Format.CSS.formatHSLA(s), u = o ? Color.Format.CSS.formatHex(s) : Color.Format.CSS.formatHexA(s), d = [];
		return d.push({
			label: c,
			textEdit: {
				range: i,
				text: c
			}
		}), d.push({
			label: l,
			textEdit: {
				range: i,
				text: l
			}
		}), d.push({
			label: u,
			textEdit: {
				range: i,
				text: u
			}
		}), d;
	}
};
DefaultDocumentColorProvider = __decorate$89([__param$89(0, IEditorWorkerService)], DefaultDocumentColorProvider);
var DefaultDocumentColorProviderFeature = class extends Disposable {
	constructor(e, n) {
		super(), this._register(e.colorProvider.register("*", new DefaultDocumentColorProvider(n)));
	}
};
DefaultDocumentColorProviderFeature = __decorate$89([__param$89(0, ILanguageFeaturesService), __param$89(1, IEditorWorkerService)], DefaultDocumentColorProviderFeature), registerEditorFeature(DefaultDocumentColorProviderFeature);
async function getColors(e, n, r, i = !0) {
	return _findColorData(new ColorDataCollector(), e, n, r, i);
}
function getColorPresentations(e, n, r, i) {
	return Promise.resolve(r.provideColorPresentations(e, n, i));
}
var ColorDataCollector = class {
	constructor() {}
	async compute(e, n, r, i) {
		let a = await e.provideDocumentColors(n, r);
		if (Array.isArray(a)) for (let n of a) i.push({
			colorInfo: n,
			provider: e
		});
		return Array.isArray(a);
	}
}, ExtColorDataCollector = class {
	constructor() {}
	async compute(e, n, r, i) {
		let a = await e.provideDocumentColors(n, r);
		if (Array.isArray(a)) for (let e of a) i.push({
			range: e.range,
			color: [
				e.color.red,
				e.color.green,
				e.color.blue,
				e.color.alpha
			]
		});
		return Array.isArray(a);
	}
}, ColorPresentationsCollector = class {
	constructor(e) {
		this.colorInfo = e;
	}
	async compute(e, n, r, i) {
		let a = await e.provideColorPresentations(n, this.colorInfo, CancellationToken.None);
		return Array.isArray(a) && i.push(...a), Array.isArray(a);
	}
};
async function _findColorData(e, n, r, i, a) {
	let o = !1, s, c = [], l = n.ordered(r);
	for (let n = l.length - 1; n >= 0; n--) {
		let a = l[n];
		if (a instanceof DefaultDocumentColorProvider) s = a;
		else try {
			await e.compute(a, r, i, c) && (o = !0);
		} catch (e) {
			onUnexpectedExternalError(e);
		}
	}
	return o ? c : s && a ? (await e.compute(s, r, i, c), c) : [];
}
function _setupColorCommand(e, n) {
	let { colorProvider: r } = e.get(ILanguageFeaturesService), i = e.get(IModelService).getModel(n);
	if (!i) throw illegalArgument();
	let o = e.get(IConfigurationService).getValue("editor.defaultColorDecorators", { resource: n });
	return {
		model: i,
		colorProviderRegistry: r,
		isDefaultColorDecoratorsEnabled: o
	};
}
CommandsRegistry.registerCommand("_executeDocumentColorProvider", function(e, ...n) {
	let [r] = n;
	if (!(r instanceof URI)) throw illegalArgument();
	let { model: i, colorProviderRegistry: o, isDefaultColorDecoratorsEnabled: s } = _setupColorCommand(e, r);
	return _findColorData(new ExtColorDataCollector(), o, i, CancellationToken.None, s);
}), CommandsRegistry.registerCommand("_executeColorPresentationProvider", function(e, ...n) {
	let [r, i] = n, { uri: o, range: s } = i;
	if (!(o instanceof URI) || !Array.isArray(r) || r.length !== 4 || !Range.isIRange(s)) throw illegalArgument();
	let { model: c, colorProviderRegistry: l, isDefaultColorDecoratorsEnabled: u } = _setupColorCommand(e, o), [d, f, m, g] = r;
	return _findColorData(new ColorPresentationsCollector({
		range: s,
		color: {
			red: d,
			green: f,
			blue: m,
			alpha: g
		}
	}), l, c, CancellationToken.None, u);
});
var __decorate$88 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$88 = function(e, n) {
	return function(r, i) {
		n(r, i, 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, n, r, i) {
		super(), this._editor = e, this._configurationService = n, this._languageFeaturesService = r, 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 = i.for(r.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(r.colorProvider.onDidChange(() => this.updateColors())), this._register(e.onDidChangeConfiguration((e) => {
			let n = this._isColorDecoratorsEnabled;
			this._isColorDecoratorsEnabled = this.isEnabled(), this._isDefaultColorDecoratorsEnabled = this._editor.getOption(148);
			let r = n !== this._isColorDecoratorsEnabled || e.hasChanged(21), i = e.hasChanged(148);
			(r || i) && (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 n = e.getLanguageId(), r = this._configurationService.getValue(n);
		if (r && typeof r == "object") {
			let e = r.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 n = this._editor.getModel();
			if (!n) return [];
			let r = new StopWatch(!1), i = await getColors(this._languageFeaturesService.colorProvider, n, e, this._isDefaultColorDecoratorsEnabled);
			return this._debounceInformation.update(n, r.elapsed()), i;
		});
		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 n = 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((r) => {
			this._decorationsIds = r.deltaDecorations(this._decorationsIds, n), this._colorDatas = /* @__PURE__ */ new Map(), this._decorationsIds.forEach((n, r) => this._colorDatas.set(n, e[r]));
		});
	}
	updateColorDecorators(e) {
		this._colorDecorationClassRefs.clear();
		let n = [], r = this._editor.getOption(21);
		for (let i = 0; i < e.length && n.length < r; i++) {
			let { red: r, green: a, blue: o, alpha: s } = e[i].colorInfo.color, c = new RGBA(Math.round(r * 255), Math.round(a * 255), Math.round(o * 255), s), l = `rgba(${c.r}, ${c.g}, ${c.b}, ${c.a})`, u = this._colorDecorationClassRefs.add(this._ruleFactory.createClassNameRef({ backgroundColor: l }));
			n.push({
				range: {
					startLineNumber: e[i].colorInfo.range.startLineNumber,
					startColumn: e[i].colorInfo.range.startColumn,
					endLineNumber: e[i].colorInfo.range.endLineNumber,
					endColumn: e[i].colorInfo.range.endColumn
				},
				options: {
					description: "colorDetector",
					before: {
						content: "\xA0",
						inlineClassName: `${u.className} colorpicker-color-decoration`,
						inlineClassNameAffectsLetterSpacing: !0,
						attachedData: ColorDecorationInjectedTextMarker
					}
				}
			});
		}
		let i = r < e.length ? r : !1;
		this._decoratorLimitReporter.update(e.length, i), this._colorDecoratorIds.set(n);
	}
	removeAllDecorations() {
		this._editor.removeDecorations(this._decorationsIds), this._decorationsIds = [], this._colorDecoratorIds.clear(), this._colorDecorationClassRefs.clear();
	}
	getColorData(e) {
		let n = this._editor.getModel();
		if (!n) return null;
		let r = n.getDecorationsInRange(Range.fromPositions(e, e)).filter((e) => this._colorDatas.has(e.id));
		return r.length === 0 ? null : this._colorDatas.get(r[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, n) {
		(e !== this._computed || n !== this._limited) && (this._computed = e, this._limited = n, 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, n, r) {
		this.presentationIndex = r, 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 = n;
	}
	selectNextColorPresentation() {
		this.presentationIndex = (this.presentationIndex + 1) % this.colorPresentations.length, this.flushColor(), this._onDidChangePresentation.fire(this.presentation);
	}
	guessColorPresentation(e, n) {
		let r = -1;
		for (let e = 0; e < this.colorPresentations.length; e++) if (n.toLowerCase() === this.colorPresentations[e].label) {
			r = e;
			break;
		}
		if (r === -1) {
			let e = n.split("(")[0].toLowerCase();
			for (let n = 0; n < this.colorPresentations.length; n++) if (this.colorPresentations[n].label.toLowerCase().startsWith(e)) {
				r = n;
				break;
			}
		}
		r !== -1 && r !== this.presentationIndex && (this.presentationIndex = r, this._onDidChangePresentation.fire(this.presentation));
	}
	flushColor() {
		this._onColorFlushed.fire(this._color);
	}
}, $$6 = $, ColorPickerHeader = class extends Disposable {
	constructor(e, n, r, i = !1) {
		super(), this.model = n, this.showingStandaloneColorPicker = i, 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 a = localize("clickToToggleColorOptions", "Click to toggle color options (rgb/hsl/hex)");
		this._pickedColorNode.setAttribute("title", a), this._originalColorNode = append(this._domNode, $$6(".original-color")), this._originalColorNode.style.backgroundColor = Color.Format.CSS.format(this.model.originalColor) || "", this.backgroundColor = r.getColorTheme().getColor(editorHoverBackground) || Color.white, this._register(r.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(n.onDidChangeColor(this.onDidChangeColor, this)), this._register(n.onDidChangePresentation(this.onDidChangePresentation, this)), this._pickedColorNode.style.backgroundColor = Color.Format.CSS.format(n.color) || "", this._pickedColorNode.classList.toggle("light", n.color.rgba.a < .5 ? this.backgroundColor.isLighter() : n.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 n = document.createElement("div");
		n.classList.add("close-button-inner-div"), append(this._button, n), append(n, $$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, n, r, i = !1) {
		super(), this.model = n, this.pixelRatio = r, 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, i), 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, i), this._register(this._hueStrip), this._register(this._hueStrip.onDidChange(this.onDidHueChange, this)), this._register(this._hueStrip.onColorFlushed(this.flushColor, this)), i && (this._insertButton = this._register(new InsertButton(this._domNode)), this._domNode.classList.add("standalone-colorpicker"));
	}
	flushColor() {
		this.model.flushColor();
	}
	onDidSaturationValueChange({ s: e, v: n }) {
		let r = this.model.color.hsva;
		this.model.color = new Color(new HSVA(r.h, e, n, r.a));
	}
	onDidOpacityChange(e) {
		let n = this.model.color.hsva;
		this.model.color = new Color(new HSVA(n.h, n.s, n.v, e));
	}
	onDidHueChange(e) {
		let n = this.model.color.hsva, r = (1 - e) * 360;
		this.model.color = new Color(new HSVA(r === 360 ? 0 : r, n.s, n.v, n.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, n, r) {
		super(), this.model = n, this.pixelRatio = r, 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 n = 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 - n.left, e.pageY - n.top), () => null);
		let r = addDisposableListener(e.target.ownerDocument, EventType$1.POINTER_UP, () => {
			this._onColorFlushed.fire(), r.dispose(), this.monitor &&= (this.monitor.stopMonitoring(!0), null);
		}, !0);
	}
	onDidChangePosition(e, n) {
		let r = Math.max(0, Math.min(1, e / this.width)), i = Math.max(0, Math.min(1, 1 - n / this.height));
		this.paintSelection(r, i), this._onDidChange.fire({
			s: r,
			v: i
		});
	}
	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, n = new Color(new HSVA(e.h, 1, 1, 1)), r = this._canvas.getContext("2d"), i = r.createLinearGradient(0, 0, this._canvas.width, 0);
		i.addColorStop(0, "rgba(255, 255, 255, 1)"), i.addColorStop(.5, "rgba(255, 255, 255, 0.5)"), i.addColorStop(1, "rgba(255, 255, 255, 0)");
		let a = r.createLinearGradient(0, 0, 0, this._canvas.height);
		a.addColorStop(0, "rgba(0, 0, 0, 0)"), a.addColorStop(1, "rgba(0, 0, 0, 1)"), r.rect(0, 0, this._canvas.width, this._canvas.height), r.fillStyle = Color.Format.CSS.format(n), r.fill(), r.fillStyle = i, r.fill(), r.fillStyle = a, r.fill();
	}
	paintSelection(e, n) {
		this.selection.style.left = `${e * this.width}px`, this.selection.style.top = `${this.height - n * this.height}px`;
	}
	onDidChangeColor(e) {
		if (this.monitor && this.monitor.isMonitoring()) return;
		this.paint();
		let n = e.hsva;
		this.paintSelection(n.s, n.v);
	}
}, Strip = class extends Disposable {
	constructor(e, n, r = !1) {
		super(), this.model = n, this._onDidChange = new Emitter(), this.onDidChange = this._onDidChange.event, this._onColorFlushed = new Emitter(), this.onColorFlushed = this._onColorFlushed.event, r ? (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(n.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 n = this.getValue(e);
		this.updateSliderPosition(n);
	}
	onPointerDown(e) {
		if (!e.target || !(e.target instanceof Element)) return;
		let n = this._register(new GlobalPointerMoveMonitor()), r = getDomNodePagePosition(this.domNode);
		this.domNode.classList.add("grabbing"), e.target !== this.slider && this.onDidChangeTop(e.offsetY), n.startMonitoring(e.target, e.pointerId, e.buttons, (e) => this.onDidChangeTop(e.pageY - r.top), () => null);
		let i = addDisposableListener(e.target.ownerDocument, EventType$1.POINTER_UP, () => {
			this._onColorFlushed.fire(), i.dispose(), n.stopMonitoring(!0), this.domNode.classList.remove("grabbing");
		}, !0);
	}
	onDidChangeTop(e) {
		let n = Math.max(0, Math.min(1, 1 - e / this.height));
		this.updateSliderPosition(n), this._onDidChange.fire(n);
	}
	updateSliderPosition(e) {
		this.slider.style.top = `${(1 - e) * this.height}px`;
	}
}, OpacityStrip = class extends Strip {
	constructor(e, n, r = !1) {
		super(e, n, r), this.domNode.classList.add("opacity-strip"), this.onDidChangeColor(this.model.color);
	}
	onDidChangeColor(e) {
		super.onDidChangeColor(e);
		let { r: n, g: r, b: i } = e.rgba, a = new Color(new RGBA(n, r, i, 1)), o = new Color(new RGBA(n, r, i, 0));
		this.overlay.style.background = `linear-gradient(to bottom, ${a} 0%, ${o} 100%)`;
	}
	getValue(e) {
		return e.hsva.a;
	}
}, HueStrip = class extends Strip {
	constructor(e, n, r = !1) {
		super(e, n, r), 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, n, r, i, a = !1) {
		super(), this.model = n, this.pixelRatio = r, 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, i, a)), this.body = this._register(new ColorPickerBody(this._domNode, this.model, this.pixelRatio, a));
	}
	layout() {
		this.body.layout();
	}
	get domNode() {
		return this._domNode;
	}
}, HoverRangeAnchor = class {
	constructor(e, n, r, i) {
		this.priority = e, this.range = n, this.initialMousePosX = r, this.initialMousePosY = i, this.type = 1;
	}
	equals(e) {
		return e.type === 1 && this.range.equalsRange(e.range);
	}
	canAdoptVisibleHover(e, n) {
		return e.type === 1 && n.lineNumber === this.range.startLineNumber;
	}
}, HoverForeignElementAnchor = class {
	constructor(e, n, r, i, a, o) {
		this.priority = e, this.owner = n, this.range = r, this.initialMousePosX = i, this.initialMousePosY = a, this.supportsMarkerHover = o, this.type = 2;
	}
	equals(e) {
		return e.type === 2 && this.owner === e.owner;
	}
	canAdoptVisibleHover(e, n) {
		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, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$87 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, ColorHover = class {
	constructor(e, n, r, i) {
		this.owner = e, this.range = n, this.model = r, this.provider = i, 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, n) {
		this._editor = e, this._themeService = n, this.hoverOrdinal = 2;
	}
	computeSync(e, n) {
		return [];
	}
	computeAsync(e, n, r) {
		return AsyncIterableObject.fromPromise(this._computeAsync(e, n, r));
	}
	async _computeAsync(e, n, r) {
		if (!this._editor.hasModel()) return [];
		let i = ColorDetector.get(this._editor);
		if (!i) return [];
		for (let e of n) {
			if (!i.isColorDecoration(e)) continue;
			let n = i.getColorData(e.range.getStartPosition());
			if (n) return [await _createColorHover(this, this._editor.getModel(), n.colorInfo, n.provider)];
		}
		return [];
	}
	renderHoverParts(e, n) {
		let r = renderHoverParts(this, this._editor, this._themeService, n, e);
		if (!r) return new RenderedHoverParts([]);
		this._colorPicker = r.colorPicker;
		let i = {
			hoverPart: r.hoverPart,
			hoverElement: this._colorPicker.domNode,
			dispose() {
				r.disposables.dispose();
			}
		};
		return new RenderedHoverParts([i]);
	}
	handleResize() {
		this._colorPicker?.layout();
	}
	isColorPickerVisible() {
		return !!this._colorPicker;
	}
};
ColorHoverParticipant = __decorate$87([__param$87(1, IThemeService)], ColorHoverParticipant);
var StandaloneColorPickerHover = class {
	constructor(e, n, r, i) {
		this.owner = e, this.range = n, this.model = r, this.provider = i;
	}
}, StandaloneColorPickerParticipant = class {
	constructor(e, n) {
		this._editor = e, this._themeService = n, this._color = null;
	}
	async createColorHover(e, n, r) {
		if (!this._editor.hasModel() || !ColorDetector.get(this._editor)) return null;
		let i = await getColors(r, this._editor.getModel(), CancellationToken.None), a = null, o = null;
		for (let n of i) {
			let r = n.colorInfo;
			Range.containsRange(r.range, e.range) && (a = r, o = n.provider);
		}
		let s = a ?? e, c = o ?? n, l = !!a;
		return {
			colorHover: await _createColorHover(this, this._editor.getModel(), s, c),
			foundInEditor: l
		};
	}
	async updateEditorModel(e) {
		if (!this._editor.hasModel()) return;
		let n = e.model, r = new Range(e.range.startLineNumber, e.range.startColumn, e.range.endLineNumber, e.range.endColumn);
		this._color && (await _updateColorPresentations(this._editor.getModel(), n, this._color, r, e), r = _updateEditorModel(this._editor, r, n));
	}
	renderHoverParts(e, n) {
		return renderHoverParts(this, this._editor, this._themeService, n, e);
	}
	set color(e) {
		this._color = e;
	}
	get color() {
		return this._color;
	}
};
StandaloneColorPickerParticipant = __decorate$87([__param$87(1, IThemeService)], StandaloneColorPickerParticipant);
async function _createColorHover(e, n, r, i) {
	let a = n.getValueInRange(r.range), { red: o, green: s, blue: c, alpha: l } = r.color, u = new RGBA(Math.round(o * 255), Math.round(s * 255), Math.round(c * 255), l), d = new Color(u), f = await getColorPresentations(n, r, i, CancellationToken.None), m = new ColorPickerModel(d, [], 0);
	return m.colorPresentations = f || [], m.guessColorPresentation(d, a), e instanceof ColorHoverParticipant ? new ColorHover(e, Range.lift(r.range), m, i) : new StandaloneColorPickerHover(e, Range.lift(r.range), m, i);
}
function renderHoverParts(e, n, r, i, a) {
	if (i.length === 0 || !n.hasModel()) return;
	if (a.setMinimumDimensions) {
		let e = n.getOption(67) + 8;
		a.setMinimumDimensions(new Dimension(302, e));
	}
	let o = new DisposableStore(), s = i[0], c = n.getModel(), l = s.model, u = o.add(new ColorPickerWidget(a.fragment, l, n.getOption(144), r, e instanceof StandaloneColorPickerParticipant)), d = !1, f = new Range(s.range.startLineNumber, s.range.startColumn, s.range.endLineNumber, s.range.endColumn);
	if (e instanceof StandaloneColorPickerParticipant) {
		let n = s.model.color;
		e.color = n, _updateColorPresentations(c, l, n, f, s), o.add(l.onColorFlushed((n) => {
			e.color = n;
		}));
	} else o.add(l.onColorFlushed(async (e) => {
		await _updateColorPresentations(c, l, e, f, s), d = !0, f = _updateEditorModel(n, f, l);
	}));
	return o.add(l.onDidChangeColor((e) => {
		_updateColorPresentations(c, l, e, f, s);
	})), o.add(n.onDidChangeModelContent((e) => {
		d ? d = !1 : (a.hide(), n.focus());
	})), {
		hoverPart: s,
		colorPicker: u,
		disposables: o
	};
}
function _updateEditorModel(e, n, r) {
	let i = [], a = r.presentation.textEdit ?? {
		range: n,
		text: r.presentation.label,
		forceMoveMarkers: !1
	};
	i.push(a), r.presentation.additionalTextEdits && i.push(...r.presentation.additionalTextEdits);
	let o = Range.lift(a.range), s = e.getModel()._setTrackedRange(null, o, 3);
	return e.executeEdits("colorpicker", i), e.pushUndoStop(), e.getModel()._getTrackedRange(s) ?? o;
}
async function _updateColorPresentations(e, n, r, i, a) {
	n.colorPresentations = await getColorPresentations(e, {
		range: i,
		color: {
			red: r.rgba.r / 255,
			green: r.rgba.g / 255,
			blue: r.rgba.b / 255,
			alpha: r.rgba.a
		}
	}, a.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, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$86 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, InlineSuggestionHintsContentWidget_1, InlineCompletionsHintsWidget = class extends Disposable {
	constructor(e, n, r) {
		super(), this.editor = e, this.model = n, this.instantiationService = r, this.alwaysShowToolbar = observableFromEvent(this, this.editor.onDidChangeConfiguration, () => this.editor.getOption(62).showToolbar === "always"), this.sessionPosition = void 0, this.position = derived(this, (e) => {
			let n = this.model.read(e)?.primaryGhostText.read(e);
			if (!this.alwaysShowToolbar.read(e) || !n || n.parts.length === 0) return this.sessionPosition = void 0, null;
			let r = n.parts[0].column;
			this.sessionPosition && this.sessionPosition.lineNumber !== n.lineNumber && (this.sessionPosition = void 0);
			let i = new Position(n.lineNumber, Math.min(r, this.sessionPosition?.column ?? 2 ** 53 - 1));
			return this.sessionPosition = i, i;
		}), this._register(autorunWithStore((n, r) => {
			let i = this.model.read(n);
			if (!i || !this.alwaysShowToolbar.read(n)) return;
			let a = derivedWithStore((n, r) => {
				let a = r.add(this.instantiationService.createInstance(InlineSuggestionHintsContentWidget, this.editor, !0, this.position, i.selectedInlineCompletionIndex, i.inlineCompletionsCount, i.activeCommands));
				return e.addContentWidget(a), r.add(toDisposable(() => e.removeContentWidget(a))), r.add(autorun((e) => {
					this.position.read(e) && i.lastTriggerKind.read(e) !== InlineCompletionTriggerKind.Explicit && i.triggerExplicitly();
				})), a;
			}), o = derivedObservableWithCache(this, (e, n) => !!this.position.read(e) || !!n);
			r.add(autorun((e) => {
				o.read(e) && a.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, n, r) {
		let i = new Action(e, n, r, !0, () => this._commandService.executeCommand(e)), a = this.keybindingService.lookupKeybinding(e, this._contextKeyService), o = n;
		return a && (o = localize({
			key: "content",
			comment: ["A label", "A keybinding"]
		}, "{0} ({1})", n, a.getLabel())), i.tooltip = o, i;
	}
	constructor(e, n, r, i, a, o, s, c, l, u, d) {
		super(), this.editor = e, this.withBorder = n, this._position = r, this._currentSuggestionIdx = i, this._suggestionCount = a, this._extraCommands = o, this._commandService = s, this.keybindingService = l, this._contextKeyService = u, this._menuService = d, 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(c.createInstance(CustomizedMenuWorkbenchToolBar$1, this.nodes.toolBar, MenuId.InlineSuggestionToolbar, {
			menuOptions: { renderShortTitle: !0 },
			toolbarOptions: { primaryGroup: (e) => e.startsWith("primary") },
			actionViewItemProvider: (e, n) => {
				if (e instanceof MenuItemAction) return c.createInstance(StatusBarViewItem$1, e, void 0);
				if (e === this.availableSuggestionCountAction) {
					let n = new ActionViewItemWithClassName(void 0, e, {
						label: !0,
						icon: !1
					});
					return n.setClass("availableSuggestionCount"), n;
				}
			},
			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 n = this._suggestionCount.read(e), r = this._currentSuggestionIdx.read(e);
			n === void 0 ? this.clearAvailableSuggestionCountLabelDebounced.schedule() : (this.clearAvailableSuggestionCountLabelDebounced.cancel(), this.availableSuggestionCountAction.label = `${r + 1}/${n}`), n !== void 0 && n > 1 ? (this.disableButtonsDebounced.cancel(), this.previousAction.enabled = this.nextAction.enabled = !0) : this.disableButtonsDebounced.schedule();
		})), this._register(autorun((e) => {
			let n = this._extraCommands.read(e).map((e) => ({
				class: void 0,
				id: e.id,
				enabled: !0,
				tooltip: e.tooltip || "",
				label: e.title,
				run: (n) => this._commandService.executeCommand(e.id)
			}));
			for (let [e, r] of this.inlineCompletionsActionsMenus.getActions()) for (let e of r) e instanceof MenuItemAction && n.push(e);
			n.length > 0 && n.unshift(new Separator()), this.toolBar.setAdditionalSecondaryActions(n);
		}));
	}
	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 n = h("div.keybinding").root;
			this._register(new KeybindingLabel(n, OS, {
				disableTitle: !0,
				...unthemedKeybindingLabelOptions
			})).set(e), this.label.textContent = this._action.label, this.label.appendChild(n), this.label.classList.add("inlineSuggestionStatusBarItemLabel");
		}
	}
	updateTooltip() {}
}, CustomizedMenuWorkbenchToolBar$1 = class extends WorkbenchToolBar {
	constructor(e, n, r, i, a, o, s, c, l) {
		super(e, {
			resetMenu: n,
			...r
		}, i, a, o, s, c, l), this.menuId = n, this.options2 = r, this.menuService = i, this.contextKeyService = a, 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 = [], n = [];
		createAndFillInActionBarActions(this.menu, this.options2?.menuOptions, {
			primary: e,
			secondary: n
		}, this.options2?.toolbarOptions?.primaryGroup, this.options2?.toolbarOptions?.shouldInlineSubmenu, this.options2?.toolbarOptions?.useSeparatorsInPrimaryActions), n.push(...this.additionalActions), e.unshift(...this.prependedPrimaryActions), this.setActions(e, n);
	}
	setPrependedPrimaryActions(e) {
		equals(this.prependedPrimaryActions, e, (e, n) => e === n) || (this.prependedPrimaryActions = e, this.updateToolbar());
	}
	setAdditionalSecondaryActions(e) {
		equals(this.additionalActions, e, (e, n) => e === n) || (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, n, r) {
	let i = getDomNodePagePosition(e);
	return !(n < i.left || n > i.left + i.width || r < i.top || r > i.top + i.height);
}
var HoverResult$1 = class {
	constructor(e, n, r) {
		this.value = e, this.isComplete = n, this.hasLoadingMessage = r;
	}
}, HoverOperation = class extends Disposable {
	constructor(e, n) {
		super(), this._editor = e, this._computer = n, 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, n = !0) {
		this._state = e, n && 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, n = this._state === 4;
		this._onResult.fire(new HoverResult$1(this._result.slice(0), e, n));
	}
	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, n = 0, r = 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, n = 0, r = 0);
		})), this._sashListener.add(Event.any(this._northSash.onDidEnd, this._eastSash.onDidEnd, this._southSash.onDidEnd, this._westSash.onDidEnd)(() => {
			e !== void 0 && (e = void 0, n = 0, r = 0, this._onDidResize.fire({
				dimension: this._size,
				done: !0
			}));
		})), this._sashListener.add(this._eastSash.onDidChange((i) => {
			e && (r = i.currentX - i.startX, this.layout(e.height + n, e.width + r), this._onDidResize.fire({
				dimension: this._size,
				done: !1,
				east: !0
			}));
		})), this._sashListener.add(this._westSash.onDidChange((i) => {
			e && (r = -(i.currentX - i.startX), this.layout(e.height + n, e.width + r), this._onDidResize.fire({
				dimension: this._size,
				done: !1,
				west: !0
			}));
		})), this._sashListener.add(this._northSash.onDidChange((i) => {
			e && (n = -(i.currentY - i.startY), this.layout(e.height + n, e.width + r), this._onDidResize.fire({
				dimension: this._size,
				done: !1,
				north: !0
			}));
		})), this._sashListener.add(this._southSash.onDidChange((i) => {
			e && (n = i.currentY - i.startY, this.layout(e.height + n, e.width + r), 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, n, r, i) {
		this._northSash.state = e ? 3 : 0, this._eastSash.state = n ? 3 : 0, this._southSash.state = r ? 3 : 0, this._westSash.state = i ? 3 : 0;
	}
	layout(e = this.size.height, n = this.size.width) {
		let { height: r, width: i } = this._minSize, { height: a, width: o } = this._maxSize;
		e = Math.max(r, Math.min(a, e)), n = Math.max(i, Math.min(o, n));
		let s = new Dimension(n, e);
		Dimension.equals(s, this._size) || (this.domNode.style.height = e + "px", this.domNode.style.width = n + "px", this._size = s, 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, n = 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(n), this._resizableNode.layout(n.height, n.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 n = this._editor.getDomNode(), r = this._editor.getScrolledVisiblePosition(e);
		if (!(!n || !r)) return getDomNodePagePosition(n).top + r.top - TOP_HEIGHT;
	}
	_availableVerticalSpaceBelow(e) {
		let n = this._editor.getDomNode(), r = this._editor.getScrolledVisiblePosition(e);
		if (!n || !r) return;
		let i = getDomNodePagePosition(n), a = getClientArea(n.ownerDocument.body), o = i.top + r.top + r.height;
		return a.height - o - BOTTOM_HEIGHT;
	}
	_findPositionPreference(e, n) {
		let r = Math.min(this._availableVerticalSpaceBelow(n) ?? Infinity, e), i = Math.min(this._availableVerticalSpaceAbove(n) ?? Infinity, e), a = Math.min(Math.max(i, r), e), o = Math.min(e, a), s;
		return s = this._editor.getOption(60).above ? o <= i ? 1 : 2 : o <= r ? 2 : 1, s === 1 ? this._resizableNode.enableSashes(!0, !0, !1, !1) : this._resizableNode.enableSashes(!1, !0, !0, !1), s;
	}
	_resize(e) {
		this._resizableNode.layout(e.height, e.width);
	}
}, __decorate$85 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$85 = function(e, n) {
	return function(r, i) {
		n(r, i, 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, n, r, i, a) {
		let o = e.getOption(67) + 8, s = new Dimension(150, o);
		super(e, s), this._configurationService = r, this._accessibilityService = i, this._keybindingService = a, this._hover = this._register(new HoverWidget()), this._onDidResize = this._register(new Emitter()), this.onDidResize = this._onDidResize.event, this._minimumSize = s, this._hoverVisibleKey = EditorContextKeys.hoverVisible.bindTo(n), this._hoverFocusedKey = EditorContextKeys.hoverFocused.bindTo(n), 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 c = this._register(trackFocus(this._resizableNode.domNode));
		this._register(c.onDidFocus(() => {
			this._hoverFocusedKey.set(!0);
		})), this._register(c.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, n, r) {
		let i = typeof n == "number" ? `${n}px` : n, a = typeof r == "number" ? `${r}px` : r;
		e.style.width = i, e.style.height = a;
	}
	_setContentsDomNodeDimensions(e, n) {
		let r = this._hover.contentsDomNode;
		return ContentHoverWidget_1._applyDimensions(r, e, n);
	}
	_setContainerDomNodeDimensions(e, n) {
		let r = this._hover.containerDomNode;
		return ContentHoverWidget_1._applyDimensions(r, e, n);
	}
	_setHoverWidgetDimensions(e, n) {
		this._setContentsDomNodeDimensions(e, n), this._setContainerDomNodeDimensions(e, n), this._layoutContentWidget();
	}
	static _applyMaxDimensions(e, n, r) {
		let i = typeof n == "number" ? `${n}px` : n, a = typeof r == "number" ? `${r}px` : r;
		e.style.maxWidth = i, e.style.maxHeight = a;
	}
	_setHoverWidgetMaxDimensions(e, n) {
		ContentHoverWidget_1._applyMaxDimensions(this._hover.contentsDomNode, e, n), ContentHoverWidget_1._applyMaxDimensions(this._hover.containerDomNode, e, n), this._hover.containerDomNode.style.setProperty("--vscode-hover-maxWidth", typeof e == "number" ? `${e}px` : e), this._layoutContentWidget();
	}
	_setAdjustedHoverWidgetDimensions(e) {
		this._setHoverWidgetMaxDimensions("none", "none");
		let n = e.width, r = e.height;
		this._setHoverWidgetDimensions(n, r);
	}
	_updateResizableNodeMaxDimensions() {
		let e = this._findMaximumRenderingWidth() ?? Infinity, n = this._findMaximumRenderingHeight() ?? Infinity;
		this._resizableNode.maxSize = new Dimension(e, n), this._setHoverWidgetMaxDimensions(e, n);
	}
	_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 n = CONTAINER_HEIGHT_PADDING;
		return Array.from(this._hover.contentsDomNode.children).forEach((e) => {
			n += e.clientHeight;
		}), Math.min(e, n);
	}
	_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(), n = this._contentWidth === void 0 ? 0 : this._contentWidth - 2;
		return e || this._hover.containerDomNode.clientWidth < n ? getClientArea(this._hover.containerDomNode.ownerDocument.body).width - 14 : this._hover.containerDomNode.clientWidth + 2;
	}
	isMouseGettingCloser(e, n) {
		if (!this._renderedHover) return !1;
		if (this._renderedHover.initialMousePosX === void 0 || this._renderedHover.initialMousePosY === void 0) return this._renderedHover.initialMousePosX = e, this._renderedHover.initialMousePosY = n, !1;
		let r = getDomNodePagePosition(this.getDomNode());
		this._renderedHover.closestMouseDistance === void 0 && (this._renderedHover.closestMouseDistance = computeDistanceFromPointToRectangle(this._renderedHover.initialMousePosX, this._renderedHover.initialMousePosY, r.left, r.top, r.width, r.height));
		let i = computeDistanceFromPointToRectangle(e, n, r.left, r.top, r.width, r.height);
		return i > this._renderedHover.closestMouseDistance + 4 ? !1 : (this._renderedHover.closestMouseDistance = Math.min(this._renderedHover.closestMouseDistance, i), !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: n } = this._editor.getOption(50), r = this._hover.contentsDomNode;
		r.style.fontSize = `${e}px`, r.style.lineHeight = `${n / e}`, Array.prototype.slice.call(this._hover.contentsDomNode.getElementsByClassName("code")).forEach((e) => this._editor.applyFontInfo(e));
	}
	_updateContent(e) {
		let n = this._hover.contentsDomNode;
		n.style.paddingBottom = "", n.textContent = "", n.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), n = Math.max(this._editor.getLayoutInfo().width * .66, 500, ContentHoverWidget_1._lastDimensions.width);
		this._setHoverWidgetMaxDimensions(n, 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 n = getTotalHeight(this._hover.containerDomNode), r = e.showAtPosition;
		this._positionPreference = this._findPositionPreference(n, r) ?? 1, this.onContentsChanged(), e.shouldFocus && this._hover.containerDomNode.focus(), this._onDidResize.fire();
		let i = 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() ?? "");
		i && (this._hover.contentsDomNode.ariaLabel = this._hover.contentsDomNode.textContent + ", " + i);
	}
	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, n = getTotalHeight(e), r = getTotalWidth(e);
		if (this._resizableNode.layout(n, r), this._setHoverWidgetDimensions(r, n), n = getTotalHeight(e), r = getTotalWidth(e), this._contentWidth = r, this._updateMinimumWidth(), this._resizableNode.layout(n, r), 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, n = this._editor.getOption(50);
		this._hover.scrollbar.setScrollPosition({ scrollTop: e - n.lineHeight });
	}
	scrollDown() {
		let e = this._hover.scrollbar.getScrollPosition().scrollTop, n = this._editor.getOption(50);
		this._hover.scrollbar.setScrollPosition({ scrollTop: e + n.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, n = this._hover.scrollbar.getScrollDimensions().height;
		this._hover.scrollbar.setScrollPosition({ scrollTop: e - n });
	}
	pageDown() {
		let e = this._hover.scrollbar.getScrollPosition().scrollTop, n = this._hover.scrollbar.getScrollDimensions().height;
		this._hover.scrollbar.setScrollPosition({ scrollTop: e + n });
	}
	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, n, r, i, a, o) {
	let s = r + a / 2, c = i + o / 2, l = Math.max(Math.abs(e - s) - a / 2, 0), u = Math.max(Math.abs(n - c) - o / 2, 0);
	return Math.sqrt(l * l + u * u);
}
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, n) {
		this._editor = e, this._participants = n, this._anchor = null, this._shouldFocus = !1, this._source = 0, this._insistOnKeepingHoverVisible = !1;
	}
	static _getLineDecorations(e, n) {
		if (n.type !== 1 && !n.supportsMarkerHover) return [];
		let r = e.getModel(), i = n.range.startLineNumber;
		if (i > r.getLineCount()) return [];
		let a = r.getLineMaxColumn(i);
		return e.getLineDecorations(i).filter((e) => {
			if (e.options.isWholeLine) return !0;
			let r = e.range.startLineNumber === i ? e.range.startColumn : 1, o = e.range.endLineNumber === i ? e.range.endColumn : a;
			if (e.options.showIfCollapsed) {
				if (r > n.range.startColumn + 1 || n.range.endColumn - 1 > o) return !1;
			} else if (r > n.range.startColumn || n.range.endColumn > o) return !1;
			return !0;
		});
	}
	computeAsync(n) {
		let r = this._anchor;
		if (!this._editor.hasModel() || !r) return AsyncIterableObject.EMPTY;
		let i = e._getLineDecorations(this._editor, r);
		return AsyncIterableObject.merge(this._participants.map((e) => e.computeAsync ? e.computeAsync(r, i, n) : AsyncIterableObject.EMPTY));
	}
	computeSync() {
		if (!this._editor.hasModel() || !this._anchor) return [];
		let n = e._getLineDecorations(this._editor, this._anchor), r = [];
		for (let e of this._participants) r = r.concat(e.computeSync(this._anchor, n));
		return coalesce(r);
	}
}, HoverResult = class {
	constructor(e, n, r) {
		this.anchor = e, this.hoverParts = n, this.isComplete = r;
	}
	filter(e) {
		let n = this.hoverParts.filter((n) => n.isValidForHoverAnchor(e));
		return n.length === this.hoverParts.length ? this : new FilteredHoverResult(this, this.anchor, n, this.isComplete);
	}
}, FilteredHoverResult = class extends HoverResult {
	constructor(e, n, r, i) {
		super(n, r, i), this.original = e;
	}
	filter(e) {
		return this.original.filter(e);
	}
}, __decorate$84 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$84 = function(e, n) {
	return function(r, i) {
		n(r, i, 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 n = this._keybindingService.lookupKeybinding(e.commandId), r = n ? n.getLabel() : null;
		this._hasContent = !0;
		let i = this._register(HoverAction.render(this.actionsElement, e, r));
		return this.actions.push(i), i;
	}
	append(e) {
		let n = append(this.actionsElement, e);
		return this._hasContent = !0, n;
	}
};
EditorHoverStatusBar = __decorate$84([__param$84(0, IKeybindingService)], EditorHoverStatusBar);
var HoverProviderResult = class {
	constructor(e, n, r) {
		this.provider = e, this.hover = n, this.ordinal = r;
	}
};
async function executeProvider(e, n, r, i, a) {
	let o = await Promise.resolve(e.provideHover(r, i, a)).catch(onUnexpectedExternalError);
	if (!(!o || !isValid(o))) return new HoverProviderResult(e, o, n);
}
function getHoverProviderResultsAsAsyncIterable(e, n, r, i, a = !1) {
	let o = e.ordered(n, a).map((e, a) => executeProvider(e, a, n, r, i));
	return AsyncIterableObject.fromPromises(o).coalesce();
}
function getHoversPromise(e, n, r, i, a = !1) {
	return getHoverProviderResultsAsAsyncIterable(e, n, r, i, a).map((e) => e.hover).toPromise();
}
registerModelAndPositionCommand("_executeHoverProvider", (e, n, r) => {
	let i = e.get(ILanguageFeaturesService);
	return getHoversPromise(i.hoverProvider, n, r, CancellationToken.None);
}), registerModelAndPositionCommand("_executeHoverProvider_recursive", (e, n, r) => {
	let i = e.get(ILanguageFeaturesService);
	return getHoversPromise(i.hoverProvider, n, r, CancellationToken.None, !0);
});
function isValid(e) {
	let n = e.range !== void 0, r = e.contents !== void 0 && e.contents && e.contents.length > 0;
	return n && r;
}
var __decorate$83 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$83 = function(e, n) {
	return function(r, i) {
		n(r, i, 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, n, r, i, a, o = void 0) {
		this.owner = e, this.range = n, this.contents = r, this.isBeforeContent = i, this.ordinal = a, this.source = o;
	}
	isValidForHoverAnchor(e) {
		return e.type === 1 && this.range.startColumn <= e.range.startColumn && this.range.endColumn >= e.range.endColumn;
	}
}, HoverSource = class {
	constructor(e, n, r) {
		this.hover = e, this.hoverProvider = n, this.hoverPosition = r;
	}
	supportsVerbosityAction(e) {
		switch (e) {
			case HoverVerbosityAction.Increase: return this.hover.canIncreaseVerbosity ?? !1;
			case HoverVerbosityAction.Decrease: return this.hover.canDecreaseVerbosity ?? !1;
		}
	}
}, MarkdownHoverParticipant = class {
	constructor(e, n, r, i, a, o, s, c) {
		this._editor = e, this._languageService = n, this._openerService = r, this._configurationService = i, this._languageFeaturesService = a, this._keybindingService = o, this._hoverService = s, this._commandService = c, this.hoverOrdinal = 3;
	}
	createLoadingMessage(e) {
		return new MarkdownHover(this, e.range, [new MarkdownString().appendText(localize("modesContentHover.loading", "Loading..."))], !1, 2e3);
	}
	computeSync(e, n) {
		if (!this._editor.hasModel() || e.type !== 1) return [];
		let r = this._editor.getModel(), i = e.range.startLineNumber, a = r.getLineMaxColumn(i), o = [], s = 1e3, c = r.getLineLength(i), l = r.getLanguageIdAtPosition(e.range.startLineNumber, e.range.startColumn), u = this._editor.getOption(118), d = this._configurationService.getValue("editor.maxTokenizationLineLength", { overrideIdentifier: l }), f = !1;
		u >= 0 && c > u && e.range.startColumn >= u && (f = !0, o.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, s++))), !f && typeof d == "number" && c >= d && o.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, s++));
		let m = !1;
		for (let r of n) {
			let n = r.range.startLineNumber === i ? r.range.startColumn : 1, c = r.range.endLineNumber === i ? r.range.endColumn : a, l = r.options.hoverMessage;
			if (!l || isEmptyMarkdownString(l)) continue;
			r.options.beforeContentClassName && (m = !0);
			let u = new Range(e.range.startLineNumber, n, e.range.startLineNumber, c);
			o.push(new MarkdownHover(this, u, asArray(l), m, s++));
		}
		return o;
	}
	computeAsync(e, n, r) {
		if (!this._editor.hasModel() || e.type !== 1) return AsyncIterableObject.EMPTY;
		let i = this._editor.getModel(), a = this._languageFeaturesService.hoverProvider;
		return a.has(i) ? this._getMarkdownHovers(a, i, e, r) : AsyncIterableObject.EMPTY;
	}
	_getMarkdownHovers(e, n, r, i) {
		let a = r.range.getStartPosition();
		return getHoverProviderResultsAsAsyncIterable(e, n, a, i).filter((e) => !isEmptyMarkdownString(e.hover.contents)).map((e) => {
			let n = e.hover.range ? Range.lift(e.hover.range) : r.range, i = new HoverSource(e.hover, e.provider, a);
			return new MarkdownHover(this, n, e.hover.contents, !1, e.ordinal, i);
		});
	}
	renderHoverParts(e, n) {
		return this._renderedHoverParts = new MarkdownRenderedHoverParts(n, e.fragment, this, this._editor, this._languageService, this._openerService, this._commandService, this._keybindingService, this._hoverService, this._configurationService, e.onContentsChanged), this._renderedHoverParts;
	}
	updateMarkdownHoverVerbosityLevel(e, n, r) {
		return Promise.resolve(this._renderedHoverParts?.updateMarkdownHoverPartVerbosityLevel(e, n, r));
	}
};
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, n, r) {
		this.hoverPart = e, this.hoverElement = n, this.disposables = r;
	}
	dispose() {
		this.disposables.dispose();
	}
}, MarkdownRenderedHoverParts = class {
	constructor(e, n, r, i, a, o, s, c, l, u, d) {
		this._hoverParticipant = r, this._editor = i, this._languageService = a, this._openerService = o, this._commandService = s, this._keybindingService = c, this._hoverService = l, this._configurationService = u, this._onFinishedRendering = d, this._ongoingHoverOperations = /* @__PURE__ */ new Map(), this._disposables = new DisposableStore(), this.renderedHoverParts = this._renderHoverParts(e, n, this._onFinishedRendering), this._disposables.add(toDisposable(() => {
			this.renderedHoverParts.forEach((e) => {
				e.dispose();
			}), this._ongoingHoverOperations.forEach((e) => {
				e.tokenSource.dispose(!0);
			});
		}));
	}
	_renderHoverParts(e, n, r) {
		return e.sort(compareBy((e) => e.ordinal, numberComparator)), e.map((e) => {
			let i = this._renderHoverPart(e, r);
			return n.appendChild(i.hoverElement), i;
		});
	}
	_renderHoverPart(e, n) {
		let r = this._renderMarkdownHover(e, n), i = r.hoverElement, a = e.source, o = new DisposableStore();
		if (o.add(r), !a) return new RenderedMarkdownHoverPart(e, i, o);
		let s = a.supportsVerbosityAction(HoverVerbosityAction.Increase), c = a.supportsVerbosityAction(HoverVerbosityAction.Decrease);
		if (!s && !c) return new RenderedMarkdownHoverPart(e, i, o);
		let l = $$4("div.verbosity-actions");
		return i.prepend(l), o.add(this._renderHoverExpansionAction(l, HoverVerbosityAction.Increase, s)), o.add(this._renderHoverExpansionAction(l, HoverVerbosityAction.Decrease, c)), new RenderedMarkdownHoverPart(e, i, o);
	}
	_renderMarkdownHover(e, n) {
		return renderMarkdownInContainer(this._editor, e, this._languageService, this._openerService, n);
	}
	_renderHoverExpansionAction(e, n, r) {
		let i = new DisposableStore(), a = n === HoverVerbosityAction.Increase, o = append(e, $$4(ThemeIcon.asCSSSelector(a ? increaseHoverVerbosityIcon : decreaseHoverVerbosityIcon)));
		o.tabIndex = 0;
		let s = new WorkbenchHoverDelegate("mouse", !1, {
			target: e,
			position: { hoverPosition: 0 }
		}, this._configurationService, this._hoverService);
		if (i.add(this._hoverService.setupManagedHover(s, o, labelForHoverVerbosityAction(this._keybindingService, n))), !r) return o.classList.add("disabled"), i;
		o.classList.add("enabled");
		let c = () => this._commandService.executeCommand(n === HoverVerbosityAction.Increase ? INCREASE_HOVER_VERBOSITY_ACTION_ID : DECREASE_HOVER_VERBOSITY_ACTION_ID);
		return i.add(new ClickAction(o, c)), i.add(new KeyDownAction(o, c, [3, 10])), i;
	}
	async updateMarkdownHoverPartVerbosityLevel(e, n, r = !0) {
		let i = this._editor.getModel();
		if (!i) return;
		let a = this._getRenderedHoverPartAtIndex(n), o = a?.hoverPart.source;
		if (!a || !o?.supportsVerbosityAction(e)) return;
		let s = await this._fetchHover(o, i, e);
		if (!s) return;
		let c = new HoverSource(s, o.hoverProvider, o.hoverPosition), l = a.hoverPart, u = new MarkdownHover(this._hoverParticipant, l.range, s.contents, l.isBeforeContent, l.ordinal, c), d = this._renderHoverPart(u, this._onFinishedRendering);
		return this._replaceRenderedHoverPartAtIndex(n, d, u), r && this._focusOnHoverPartWithIndex(n), {
			hoverPart: u,
			hoverElement: d.hoverElement
		};
	}
	async _fetchHover(e, n, r) {
		let i = r === HoverVerbosityAction.Increase ? 1 : -1, a = e.hoverProvider, o = this._ongoingHoverOperations.get(a);
		o && (o.tokenSource.cancel(), i += o.verbosityDelta);
		let s = new CancellationTokenSource();
		this._ongoingHoverOperations.set(a, {
			verbosityDelta: i,
			tokenSource: s
		});
		let c = { verbosityRequest: {
			verbosityDelta: i,
			previousHover: e.hover
		} }, l;
		try {
			l = await Promise.resolve(a.provideHover(n, e.hoverPosition, s.token, c));
		} catch (e) {
			onUnexpectedExternalError(e);
		}
		return s.dispose(), this._ongoingHoverOperations.delete(a), l;
	}
	_replaceRenderedHoverPartAtIndex(e, n, r) {
		if (e >= this.renderedHoverParts.length || e < 0) return;
		let i = this.renderedHoverParts[e], a = i.hoverElement, o = n.hoverElement, s = Array.from(o.children);
		a.replaceChildren(...s);
		let c = new RenderedMarkdownHoverPart(r, a, n.disposables);
		a.focus(), i.dispose(), this.renderedHoverParts[e] = c;
	}
	_focusOnHoverPartWithIndex(e) {
		this.renderedHoverParts[e].hoverElement.focus();
	}
	_getRenderedHoverPartAtIndex(e) {
		return this.renderedHoverParts[e];
	}
	dispose() {
		this._disposables.dispose();
	}
};
function renderMarkdownHovers(e, n, r, i, a) {
	n.sort(compareBy((e) => e.ordinal, numberComparator));
	let o = [];
	for (let s of n) o.push(renderMarkdownInContainer(r, s, i, a, e.onContentsChanged));
	return new RenderedHoverParts(o);
}
function renderMarkdownInContainer(e, n, r, i, a) {
	let o = new DisposableStore(), s = $$4("div.hover-row"), c = $$4("div.hover-row-contents");
	s.appendChild(c);
	let l = n.contents;
	for (let n of l) {
		if (isEmptyMarkdownString(n)) continue;
		let s = $$4("div.markdown-hover"), l = append(s, $$4("div.hover-contents")), u = o.add(new MarkdownRenderer({ editor: e }, r, i));
		o.add(u.onDidRenderAsync(() => {
			l.className = "hover-contents code-hover-contents", a();
		}));
		let d = o.add(u.render(n));
		l.appendChild(d.element), c.appendChild(s);
	}
	return {
		hoverPart: n,
		hoverElement: s,
		dispose() {
			o.dispose();
		}
	};
}
function labelForHoverVerbosityAction(e, n) {
	switch (n) {
		case HoverVerbosityAction.Increase: {
			let n = e.lookupKeybinding(INCREASE_HOVER_VERBOSITY_ACTION_ID);
			return n ? localize("increaseVerbosityWithKb", "Increase Hover Verbosity ({0})", n.getLabel()) : localize("increaseVerbosity", "Increase Hover Verbosity");
		}
		case HoverVerbosityAction.Decrease: {
			let n = e.lookupKeybinding(DECREASE_HOVER_VERBOSITY_ACTION_ID);
			return n ? localize("decreaseVerbosityWithKb", "Decrease Hover Verbosity ({0})", n.getLabel()) : localize("decreaseVerbosity", "Decrease Hover Verbosity");
		}
	}
}
function hasModifier(e, n) {
	return !!e[n];
}
var ClickLinkMouseEvent = class {
	constructor(e, n) {
		this.target = e.target, this.isLeftClick = e.event.leftButton, this.isMiddleClick = e.event.middleButton, this.isRightClick = e.event.rightButton, this.hasTriggerModifier = hasModifier(e.event, n.triggerModifier), this.hasSideBySideModifier = hasModifier(e.event, n.triggerSideBySideModifier), this.isNoneOrSingleMouseDown = e.event.detail <= 1;
	}
}, ClickLinkKeyboardEvent = class {
	constructor(e, n) {
		this.keyCodeIsTriggerKey = e.keyCode === n.triggerKey, this.keyCodeIsSideBySideKey = e.keyCode === n.triggerSideBySideKey, this.hasTriggerModifier = hasModifier(e, n.triggerModifier);
	}
}, ClickLinkOptions = class {
	constructor(e, n, r, i) {
		this.triggerKey = e, this.triggerModifier = n, this.triggerSideBySideKey = r, this.triggerSideBySideModifier = i;
	}
	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, n) {
		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 = n?.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 n = this._extractLineNumberFromMouseEvent(e);
		this._hasTriggerKeyOnMouseDown && this._lineNumberOnMouseDown && this._lineNumberOnMouseDown === n && 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, n) {
		this.range = e, this.direction = n;
	}
}, InlayHintItem = class e {
	constructor(e, n, r) {
		this.hint = e, this.anchor = n, this.provider = r, this._isResolved = !1;
	}
	with(n) {
		let r = new e(this.hint, n.anchor, this.provider);
		return r._isResolved = this._isResolved, r._currentResolve = this._currentResolve, r;
	}
	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 n = await Promise.resolve(this.provider.resolveInlayHint(this.hint, e));
			this.hint.tooltip = n?.tooltip ?? this.hint.tooltip, this.hint.label = n?.label ?? this.hint.label, this.hint.textEdits = n?.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(n, r, i, a) {
		let o = [], s = n.ordered(r).reverse().map((n) => i.map(async (i) => {
			try {
				let s = await n.provideInlayHints(r, i, a);
				(s?.hints.length || n.onDidChangeInlayHints) && o.push([s ?? e._emptyInlayHintList, n]);
			} catch (e) {
				onUnexpectedExternalError(e);
			}
		}));
		if (await Promise.all(s.flat()), a.isCancellationRequested || r.isDisposed()) throw new CancellationError();
		return new e(i, o, r);
	}
	constructor(n, r, i) {
		this._disposables = new DisposableStore(), this.ranges = n, this.provider = /* @__PURE__ */ new Set();
		let a = [];
		for (let [n, o] of r) {
			this._disposables.add(n), this.provider.add(o);
			for (let r of n.hints) {
				let n = i.validatePosition(r.position), s = "before", c = e._getRangeAtPosition(i, n), l;
				c.getStartPosition().isBefore(n) ? (l = Range.fromPositions(c.getStartPosition(), n), s = "after") : (l = Range.fromPositions(n, c.getEndPosition()), s = "before"), a.push(new InlayHintItem(r, new InlayHintAnchor(l, s), o));
			}
		}
		this.items = a.sort((e, n) => Position.compare(e.hint.position, n.hint.position));
	}
	dispose() {
		this._disposables.dispose();
	}
	static _getRangeAtPosition(e, n) {
		let r = n.lineNumber, i = e.getWordAtPosition(n);
		if (i) return new Range(r, i.startColumn, r, i.endColumn);
		e.tokenization.tokenizeIfCheap(r);
		let a = e.tokenization.getLineTokens(r), o = n.column - 1, s = a.findTokenIndexAtOffset(o), c = a.getStartOffset(s), l = a.getEndOffset(s);
		return l - c === 1 && (c === o && s > 1 ? (c = a.getStartOffset(s - 1), l = a.getEndOffset(s - 1)) : l === o && s < a.getCount() - 1 && (c = a.getStartOffset(s + 1), l = a.getEndOffset(s + 1))), new Range(r, c + 1, r, l + 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, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$82 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, EmbeddedCodeEditorWidget = class extends CodeEditorWidget {
	constructor(e, n, r, i, a, o, s, c, l, u, d, f, m) {
		super(e, {
			...i.getRawOptions(),
			overflowWidgetsDomNode: i.getOverflowWidgetsDomNode()
		}, r, a, o, s, c, l, u, d, f, m), this._parentEditor = i, this._overwriteOptions = n, super.updateOptions(this._overwriteOptions), this._register(i.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, n, r, i, a, o, s, c) {
		this.id = "", this.domNode = e, this.afterLineNumber = n, this.afterColumn = r, this.heightInLines = i, this.showInHiddenAreas = s, this.ordinal = c, this._onDomNodeTop = a, this._onComputedHeight = o;
	}
	onDomNodeTop(e) {
		this._onDomNodeTop(e);
	}
	onComputedHeight(e) {
		this._onComputedHeight(e);
	}
}, OverlayWidgetDelegate = class {
	constructor(e, n) {
		this._id = e, this._domNode = n;
	}
	getId() {
		return this._id;
	}
	getDomNode() {
		return this._domNode;
	}
	getPosition() {
		return null;
	}
}, Arrow = class e {
	static {
		this._IdGenerator = new IdGenerator(".arrow-decoration-");
	}
	constructor(n) {
		this._editor = n, 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, n = {}) {
		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(n), 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 n = this._getWidth(e);
			this.domNode.style.width = n + "px", this.domNode.style.left = this._getLeft(e) + "px", this._onWidth(n);
		}));
	}
	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 n = e - this._decoratingElementsHeight();
			this.container.style.height = `${n}px`;
			let r = this.editor.getLayoutInfo();
			this._doLayout(n, this._getWidth(r));
		}
		this._resizeSash?.layout();
	}
	get position() {
		let e = this._positionMarkerId.getRange(0);
		if (e) return e.getStartPosition();
	}
	show(e, n) {
		let r = Range.isIRange(e) ? Range.lift(e) : Range.fromPositions(e);
		this._isShowing = !0, this._showImpl(r, n), this._isShowing = !1, this._positionMarkerId.set([{
			range: r,
			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), n = 0;
		if (this.options.showArrow) {
			let r = Math.round(e / 3);
			n += 2 * r;
		}
		if (this.options.showFrame) {
			let r = Math.round(e / 9);
			n += 2 * r;
		}
		return n;
	}
	_showImpl(e, n) {
		let r = e.getStartPosition(), i = this.editor.getLayoutInfo(), a = this._getWidth(i);
		this.domNode.style.width = `${a}px`, this.domNode.style.left = this._getLeft(i) + "px";
		let o = document.createElement("div");
		o.style.overflow = "hidden";
		let s = this.editor.getOption(67);
		if (!this.options.allowUnlimitedHeight) {
			let e = Math.max(12, this.editor.getLayoutInfo().height / s * .8);
			n = Math.min(n, e);
		}
		let c = 0, l = 0;
		if (this._arrow && this.options.showArrow && (c = Math.round(s / 3), this._arrow.height = c, this._arrow.show(r)), this.options.showFrame && (l = Math.round(s / 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(o, r.lineNumber, r.column, n, (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 : l;
			this.container.style.borderTopWidth = e + "px", this.container.style.borderBottomWidth = e + "px";
		}
		let u = n * s - this._decoratingElementsHeight();
		this.container && (this.container.style.top = c + "px", this.container.style.height = u + "px", this.container.style.overflow = "hidden"), this._doLayout(u, a), this.options.keepEditorSelection || this.editor.setSelection(e);
		let d = this.editor.getModel();
		if (d) {
			let n = d.validateRange(new Range(e.startLineNumber, 1, e.endLineNumber + 1, 1));
			this.revealRange(n, n.startLineNumber === d.getLineCount());
		}
	}
	revealRange(e, n) {
		n ? this.editor.revealLineNearTop(e.endLineNumber, 0) : this.editor.revealRange(e, 0);
	}
	setCssClass(e, n) {
		this.container && (n && this.container.classList.remove(n), this.container.classList.add(e));
	}
	_onWidth(e) {}
	_doLayout(e, n) {}
	_relayout(e) {
		this._viewZone && this._viewZone.heightInLines !== e && this.editor.changeViewZones((n) => {
			this._viewZone && (this._viewZone.heightInLines = e, n.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((n) => {
			this._viewZone && (e = {
				startY: n.startY,
				heightInLines: this._viewZone.heightInLines
			});
		})), this._disposables.add(this._resizeSash.onDidEnd(() => {
			e = void 0;
		})), this._disposables.add(this._resizeSash.onDidChange((n) => {
			if (e) {
				let r = (n.currentY - e.startY) / this.editor.getOption(67), i = r < 0 ? Math.ceil(r) : Math.floor(r), a = e.heightInLines + i;
				a > 5 && a < 35 && this._relayout(a);
			}
		}));
	}
	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, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$81 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
};
const IPeekViewService = createDecorator("IPeekViewService");
registerSingleton(IPeekViewService, class {
	constructor() {
		this._widgets = /* @__PURE__ */ new Map();
	}
	addExclusiveWidget(e, n) {
		let r = this._widgets.get(e);
		r && (r.listener.dispose(), r.widget.dispose()), this._widgets.set(e, {
			widget: n,
			listener: n.onDidClose(() => {
				let r = this._widgets.get(e);
				r && r.widget === n && (r.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, n) {
		e instanceof EmbeddedCodeEditorWidget && PeekContext.inPeekEditor.bindTo(n);
	}
	dispose() {}
};
PeekContextController = __decorate$81([__param$81(1, IContextKeyService)], PeekContextController), registerEditorContribution(PeekContextController.ID, PeekContextController, 0);
function getOuterEditor(e) {
	let n = e.get(ICodeEditorService).getFocusedCodeEditor();
	return n instanceof EmbeddedCodeEditorWidget ? n.getParentEditor() : n;
}
var defaultOptions = {
	headerBackgroundColor: Color.white,
	primaryHeadingColor: Color.fromHex("#333333"),
	secondaryHeadingColor: Color.fromHex("#6c6c6cb3")
}, PeekViewWidget = class extends ZoneWidget {
	constructor(e, n, r) {
		super(e, n), this.instantiationService = r, 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 n = this.options;
		e.headerBackgroundColor && (n.headerBackgroundColor = e.headerBackgroundColor), e.primaryHeadingColor && (n.primaryHeadingColor = e.primaryHeadingColor), e.secondaryHeadingColor && (n.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, n) {
		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 r = $(".peekview-actions");
		append(this._headElement, r);
		let i = this._getActionBarOptions();
		this._actionbarWidget = new ActionBar(r, i), this._disposables.add(this._actionbarWidget), n || 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, n) {
		this._primaryHeading && this._secondaryHeading && (this._primaryHeading.innerText = e, this._primaryHeading.setAttribute("title", e), n ? this._secondaryHeading.innerText = n : clearNode(this._secondaryHeading));
	}
	setMetaTitle(e) {
		this._metaHeading && (e ? (this._metaHeading.innerText = e, show(this._metaHeading)) : hide(this._metaHeading));
	}
	_doLayout(e, n) {
		if (!this._isShowing && e < 0) {
			this.dispose();
			return;
		}
		let r = Math.ceil(this.editor.getOption(67) * 1.2), i = Math.round(e - (r + 2));
		this._doLayoutHead(r, n), this._doLayoutBody(i, n);
	}
	_doLayoutHead(e, n) {
		this._headElement && (this._headElement.style.height = `${e}px`, this._headElement.style.lineHeight = this._headElement.style.height);
	}
	_doLayoutBody(e, n) {
		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, n, r, i) {
		this.isProviderFirst = e, this.parent = n, this.link = r, this._rangeCallback = i, 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, n = 8) {
		let r = this._modelReference.object.textEditorModel;
		if (!r) return;
		let { startLineNumber: i, startColumn: a, endLineNumber: o, endColumn: s } = e, c = r.getWordUntilPosition({
			lineNumber: i,
			column: a - n
		}), l = new Range(i, c.startColumn, i, a), u = new Range(o, s, o, 1073741824), d = r.getValueInRange(l).replace(/^\s+/, ""), f = r.getValueInRange(e), m = r.getValueInRange(u).replace(/\s+$/, "");
		return {
			value: d + f + m,
			highlight: {
				start: d.length,
				end: d.length + f.length
			}
		};
	}
}, FileReferences = class {
	constructor(e, n) {
		this.parent = e, this.uri = n, 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 n of this.children) if (!this._previews.has(n.uri)) try {
			let r = await e.createModelReference(n.uri);
			this._previews.set(n.uri, new FilePreview(r));
		} catch (e) {
			onUnexpectedError(e);
		}
		return this;
	}
}, ReferencesModel = class e {
	constructor(n, r) {
		this.groups = [], this.references = [], this._onDidChangeReferenceRange = new Emitter(), this.onDidChangeReferenceRange = this._onDidChangeReferenceRange.event, this._links = n, this._title = r;
		let [i] = n;
		n.sort(e._compareReferences);
		let a;
		for (let r of n) if ((!a || !extUri.isEqual(a.uri, r.uri, !0)) && (a = new FileReferences(this, r.uri), this.groups.push(a)), a.children.length === 0 || e._compareReferences(r, a.children[a.children.length - 1]) !== 0) {
			let e = new OneReference(i === r, a, r, (e) => this._onDidChangeReferenceRange.fire(e));
			this.references.push(e), a.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, n) {
		let { parent: r } = e, i = r.children.indexOf(e), a = r.children.length, o = r.parent.groups.length;
		return o === 1 || n && i + 1 < a || !n && i > 0 ? (i = n ? (i + 1) % a : (i + a - 1) % a, r.children[i]) : (i = r.parent.groups.indexOf(r), n ? (i = (i + 1) % o, r.parent.groups[i].children[0]) : (i = (i + o - 1) % o, r.parent.groups[i].children[r.parent.groups[i].children.length - 1]));
	}
	nearestReference(e, n) {
		let r = this.references.map((r, i) => ({
			idx: i,
			prefixLen: commonPrefixLength(r.uri.toString(), e.toString()),
			offsetDist: Math.abs(r.range.startLineNumber - n.lineNumber) * 100 + Math.abs(r.range.startColumn - n.column)
		})).sort((e, n) => e.prefixLen > n.prefixLen ? -1 : e.prefixLen < n.prefixLen ? 1 : e.offsetDist < n.offsetDist ? -1 : e.offsetDist > n.offsetDist ? 1 : 0)[0];
		if (r) return this.references[r.idx];
	}
	referenceAt(e, n) {
		for (let r of this.references) if (r.uri.toString() === e.toString() && Range.containsPosition(r.range, n)) return r;
	}
	firstReference() {
		for (let e of this.references) if (e.isProviderFirst) return e;
		return this.references[0];
	}
	static _compareReferences(e, n) {
		return extUri.compare(e.uri, n.uri) || Range.compareRangesUsingStarts(e.range, n.range);
	}
}, __decorate$80 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$80 = function(e, n) {
	return function(r, i) {
		n(r, i, 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 n = e.parent.getPreview(e)?.preview(e.range);
			if (n) return n.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, n) {
		super(), this._labelService = n;
		let r = document.createElement("div");
		r.classList.add("reference-file"), this.file = this._register(new IconLabel(r, { supportHighlights: !0 })), this.badge = new CountBadge(append(r, $(".count")), {}, defaultCountBadgeStyles), e.appendChild(r);
	}
	set(e, n) {
		let r = dirname(e.uri);
		this.file.setLabel(this._labelService.getUriBasenameLabel(e.uri), this._labelService.getUriLabel(r, { relative: !0 }), {
			title: this._labelService.getUriLabel(e.uri),
			matches: n
		});
		let i = e.children.length;
		this.badge.setCount(i), i > 1 ? this.badge.setTitleFormat(localize("referencesCount", "{0} references", i)) : this.badge.setTitleFormat(localize("referenceCount", "{0} reference", i));
	}
};
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, n, r) {
		r.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, n) {
		let r = e.parent.getPreview(e)?.preview(e.range);
		if (!r || !r.value) this.label.set(`${basename(e.uri)}:${e.range.startLineNumber + 1}:${e.range.startColumn + 1}`);
		else {
			let { value: e, highlight: i } = r;
			n && !FuzzyScore.isDefault(n) ? (this.label.element.classList.toggle("referenceMatch", !1), this.label.set(e, createMatches(n))) : (this.label.element.classList.toggle("referenceMatch", !0), this.label.set(e, [i]));
		}
	}
}, OneReferenceRenderer = class e {
	constructor() {
		this.templateId = e.id;
	}
	static {
		this.id = "OneReferenceRenderer";
	}
	renderTemplate(e) {
		return new OneReferenceTemplate(e);
	}
	renderElement(e, n, r) {
		r.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, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$79 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, DecorationsManager = class e {
	static {
		this.DecorationOptions = ModelDecorationOptions.register({
			description: "reference-decoration",
			stickiness: 1,
			className: "reference-decoration"
		});
	}
	constructor(e, n) {
		this._editor = e, this._model = n, 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 n of this._model.references) if (n.uri.toString() === e.uri.toString()) {
				this._addDecorations(n.parent);
				return;
			}
		}
	}
	_addDecorations(n) {
		if (!this._editor.hasModel()) return;
		this._callOnModelChange.add(this._editor.getModel().onDidChangeDecorations(() => this._onDecorationChanged()));
		let r = [], i = [];
		for (let a = 0, o = n.children.length; a < o; a++) {
			let o = n.children[a];
			this._decorationIgnoreSet.has(o.id) || o.uri.toString() === this._editor.getModel().uri.toString() && (r.push({
				range: o.range,
				options: e.DecorationOptions
			}), i.push(a));
		}
		this._editor.changeDecorations((e) => {
			let a = e.deltaDecorations([], r);
			for (let e = 0; e < a.length; e++) this._decorations.set(a[e], n.children[i[e]]);
		});
	}
	_onDecorationChanged() {
		let e = [], n = this._editor.getModel();
		if (n) {
			for (let [r, i] of this._decorations) {
				let a = n.getDecorationRange(r);
				if (!a) continue;
				let o = !1;
				if (!Range.equalsRange(a, i.range)) {
					if (Range.spansMultipleLines(a)) o = !0;
					else {
						let e = i.range.endColumn - i.range.startColumn, n = a.endColumn - a.startColumn;
						e !== n && (o = !0);
					}
					o ? (this._decorationIgnoreSet.add(i.id), e.push(r)) : i.range = a;
				}
			}
			for (let n = 0, r = e.length; n < r; n++) this._decorations.delete(e[n]);
			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 n, r;
		try {
			let i = JSON.parse(e);
			n = i.ratio, r = i.heightInLines;
		} catch {}
		return {
			ratio: n || .7,
			heightInLines: r || 18
		};
	}
}, ReferencesTree = class extends WorkbenchAsyncDataTree {}, ReferenceWidget = class extends PeekViewWidget {
	constructor(e, n, r, i, a, o, s, c, l) {
		super(e, {
			showFrame: !1,
			showArrow: !0,
			isResizeable: !0,
			isAccessible: !0,
			supportOnTitleClick: !0
		}, o), this._defaultTreeKeyboardSupport = n, this.layoutData = r, this._textModelResolverService = a, this._instantiationService = o, this._peekViewService = s, this._uriLabel = c, this._keybindingService = l, 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(i.getColorTheme()), this._callOnDispose.add(i.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 n = e.getColor(peekViewBorder) || Color.transparent;
		this.style({
			arrowColor: n,
			frameColor: n,
			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 n = {
			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), n), 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 r = (e, n) => {
			e instanceof OneReference && (n === "show" && this._revealReference(e, !1), this._onDidSelectReference.fire({
				element: e,
				kind: n,
				source: "tree"
			}));
		};
		this._disposables.add(this._tree.onDidOpen((e) => {
			e.sideBySide ? r(e.element, "side") : e.editorOptions.pinned ? r(e.element, "goto") : r(e.element, "show");
		})), hide(this._treeContainer);
	}
	_onWidth(e) {
		this._dim && this._doLayoutBody(this._dim.height, e);
	}
	_doLayoutBody(e, n) {
		super._doLayoutBody(e, n), this._dim = new Dimension(n, e), this.layoutData.heightInLines = this._viewZone ? this._viewZone.heightInLines : this.layoutData.heightInLines, this._splitView.layout(n), this._splitView.resizeView(0, n * 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: n, target: r } = e;
			if (n.detail !== 2) return;
			let i = this._getFocusedReference();
			i && this._onDidSelectReference.fire({
				element: {
					uri: i.uri,
					range: r.range
				},
				kind: n.ctrlKey || n.metaKey || n.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, n) {
		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 r = this._textModelResolverService.createModelReference(e.uri);
		this._tree.getInput() === e.parent ? this._tree.reveal(e) : (n && this._tree.reveal(e.parent), await this._tree.expand(e.parent), this._tree.reveal(e));
		let i = await r;
		if (!this._model) {
			i.dispose();
			return;
		}
		dispose(this._previewModelReference);
		let a = i.object;
		if (a) {
			let n = this._preview.getModel() === a.textEditorModel ? 0 : 1, r = Range.lift(e.range).collapseToStart();
			this._previewModelReference = i, this._preview.setModel(a.textEditorModel), this._preview.setSelection(r), this._preview.revealRangeInCenter(r, n);
		} else this._preview.setModel(this._previewNotAvailableMessage), i.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, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$78 = function(e, n) {
	return function(r, i) {
		n(r, i, 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, n, r, i, a, o, s, c) {
		this._defaultTreeKeyboardSupport = e, this._editor = n, this._editorService = i, this._notificationService = a, this._instantiationService = o, this._storageService = s, this._configurationService = c, this._disposables = new DisposableStore(), this._requestIdPool = 0, this._ignoreModelChangeEvent = !1, this._referenceSearchVisible = ctxReferenceSearchVisible.bindTo(r);
	}
	dispose() {
		this._referenceSearchVisible.reset(), this._disposables.dispose(), this._widget?.dispose(), this._model?.dispose(), this._widget = void 0, this._model = void 0;
	}
	toggleWidget(e, n, r) {
		let i;
		if (this._widget && (i = this._widget.position), this.closeWidget(), i && e.containsPosition(i)) return;
		this._peekMode = r, this._referenceSearchVisible.set(!0), this._disposables.add(this._editor.onDidChangeModelLanguage(() => {
			this.closeWidget();
		})), this._disposables.add(this._editor.onDidChangeModel(() => {
			this._ignoreModelChangeEvent || this.closeWidget();
		}));
		let a = "peekViewLayout", o = LayoutData.fromJSON(this._storageService.get(a, 0, "{}"));
		this._widget = this._instantiationService.createInstance(ReferenceWidget, this._editor, this._defaultTreeKeyboardSupport, o), this._widget.setTitle(localize("labelLoading", "Loading...")), this._widget.show(e), this._disposables.add(this._widget.onDidClose(() => {
			n.cancel(), this._widget ? (this._storageService.store(a, 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: n, kind: i } = e;
			if (n) switch (i) {
				case "open":
					(e.source !== "editor" || !this._configurationService.getValue("editor.stablePeek")) && this.openReference(n, !1, !1);
					break;
				case "side":
					this.openReference(n, !0, !1);
					break;
				case "goto":
					r ? this._gotoReference(n, !0) : this.openReference(n, !1, !0);
					break;
			}
		}));
		let s = ++this._requestIdPool;
		n.then((n) => {
			if (s !== this._requestIdPool || !this._widget) {
				n.dispose();
				return;
			}
			return this._model?.dispose(), this._model = n, 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 n = this._editor.getModel().uri, r = new Position(e.startLineNumber, e.startColumn), i = this._model.nearestReference(n, r);
					if (i) return this._widget.setSelection(i).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 n = this._widget.position;
		if (!n) return;
		let r = this._model.nearestReference(this._editor.getModel().uri, n);
		if (!r) return;
		let i = this._model.nextOrPreviousReference(r, e), a = this._editor.hasTextFocus(), o = this._widget.isPreviewEditorFocused();
		await this._widget.setSelection(i), await this._gotoReference(i, !1), a ? this._editor.focus() : this._widget && o && 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, n) {
		this._widget?.hide(), this._ignoreModelChangeEvent = !0;
		let r = Range.lift(e.range).collapseToStart();
		return this._editorService.openCodeEditor({
			resource: e.uri,
			options: {
				selection: r,
				selectionSource: "code.jump",
				pinned: n
			}
		}, this._editor).then((e) => {
			if (this._ignoreModelChangeEvent = !1, !e || !this._widget) {
				this.closeWidget();
				return;
			}
			if (this._editor === e) this._widget.show(r), this._widget.focusOnReferenceTree();
			else {
				let n = ReferencesController_1.get(e), i = this._model.clone();
				this.closeWidget(), e.focus(), n?.toggleWidget(r, createCancelablePromise((e) => Promise.resolve(i)), this._peekMode ?? !1);
			}
		}, (e) => {
			this._ignoreModelChangeEvent = !1, onUnexpectedError(e);
		});
	}
	openReference(e, n, r) {
		n || this.closeWidget();
		let { uri: i, range: a } = e;
		this._editorService.openCodeEditor({
			resource: i,
			options: {
				selection: a,
				selectionSource: "code.jump",
				pinned: r
			}
		}, this._editor, n);
	}
};
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, n) {
	let r = getOuterEditor(e);
	if (!r) return;
	let i = ReferencesController.get(r);
	i && n(i);
}
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 n = e.get(IListService).lastFocusedList?.getFocus();
		Array.isArray(n) && n[0] instanceof OneReference && withController(e, (e) => e.revealReference(n[0]));
	}
}), KeybindingsRegistry.registerCommandAndKeybindingRule({
	id: "openReferenceToSide",
	weight: 100,
	primary: 2051,
	mac: { primary: 259 },
	when: ContextKeyExpr.and(ctxReferenceSearchVisible, WorkbenchListFocusContextKey, WorkbenchTreeElementCanCollapse.negate(), WorkbenchTreeElementCanExpand.negate()),
	handler(e) {
		let n = e.get(IListService).lastFocusedList?.getFocus();
		Array.isArray(n) && n[0] instanceof OneReference && withController(e, (e) => e.openReference(n[0], !0, !0));
	}
}), CommandsRegistry.registerCommand("openReference", (e) => {
	let n = e.get(IListService).lastFocusedList?.getFocus();
	Array.isArray(n) && n[0] instanceof OneReference && withController(e, (e) => e.openReference(n[0], !1, !0));
});
var __decorate$77 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$77 = function(e, n) {
	return function(r, i) {
		n(r, i, 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, n, r, i) {
		this._editorService = n, this._notificationService = r, this._keybindingService = i, 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 n = e.parent.parent;
		if (n.references.length <= 1) {
			this.reset();
			return;
		}
		this._currentModel = n, this._currentIdx = n.references.indexOf(e), this._ctxHasSymbols.set(!0), this._showMessage();
		let r = new EditorState$1(this._editorService), i = r.onDidChange((e) => {
			if (this._ignoreEditorChange) return;
			let r = this._editorService.getActiveCodeEditor();
			if (!r) return;
			let i = r.getModel(), a = r.getPosition();
			if (!i || !a) return;
			let o = !1, s = !1;
			for (let e of n.references) if (isEqual(e.uri, i.uri)) o = !0, s ||= Range.containsPosition(e.range, a);
			else if (o) break;
			(!o || !s) && this.reset();
		});
		this._currentState = combinedDisposable(r, i);
	}
	revealNext(e) {
		if (!this._currentModel) return Promise.resolve();
		this._currentIdx += 1, this._currentIdx %= this._currentModel.references.length;
		let n = this._currentModel.references[this._currentIdx];
		return this._showMessage(), this._ignoreEditorChange = !0, this._editorService.openCodeEditor({
			resource: n.uri,
			options: {
				selection: Range.collapseToStart(n.range),
				selectionRevealType: 3
			}
		}, e).finally(() => {
			this._ignoreEditorChange = !1;
		});
	}
	_showMessage() {
		this._currentMessage?.dispose();
		let e = this._keybindingService.lookupKeybinding("editor.gotoNextSymbolFromResult"), n = 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(n);
	}
};
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, n) {
		return e.get(ISymbolNavigationService).revealNext(n);
	}
}()), 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((n) => this._onDidChange.fire({ editor: e })), e.onDidChangeModelContent((n) => 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, n) {
	return n.uri.scheme === e.uri.scheme ? !0 : !matchesSomeScheme(n.uri, Schemas.walkThroughSnippet, Schemas.vscodeChatCodeBlock, Schemas.vscodeChatCodeCompareBlock);
}
async function getLocationLinks(e, n, r, i, a) {
	let o = r.ordered(e, i).map((r) => Promise.resolve(a(r, e, n)).then(void 0, (e) => {
		onUnexpectedExternalError(e);
	})), s = await Promise.all(o);
	return coalesce(s.flat()).filter((n) => shouldIncludeLocationLink(e, n));
}
function getDefinitionsAtPosition(e, n, r, i, a) {
	return getLocationLinks(n, r, e, i, (e, n, r) => e.provideDefinition(n, r, a));
}
function getDeclarationsAtPosition(e, n, r, i, a) {
	return getLocationLinks(n, r, e, i, (e, n, r) => e.provideDeclaration(n, r, a));
}
function getImplementationsAtPosition(e, n, r, i, a) {
	return getLocationLinks(n, r, e, i, (e, n, r) => e.provideImplementation(n, r, a));
}
function getTypeDefinitionsAtPosition(e, n, r, i, a) {
	return getLocationLinks(n, r, e, i, (e, n, r) => e.provideTypeDefinition(n, r, a));
}
function getReferencesAtPosition(e, n, r, i, a, o) {
	return getLocationLinks(n, r, e, a, async (e, n, r) => {
		let a = (await e.provideReferences(n, r, { includeDeclaration: !0 }, o))?.filter((e) => shouldIncludeLocationLink(n, e));
		if (!i || !a || a.length !== 2) return a;
		let s = (await e.provideReferences(n, r, { includeDeclaration: !1 }, o))?.filter((e) => shouldIncludeLocationLink(n, e));
		return s && s.length === 1 ? s : a;
	});
}
async function _sortedAndDeduped(e) {
	let n = await e(), r = new ReferencesModel(n, ""), i = r.references.map((e) => e.link);
	return r.dispose(), i;
}
registerModelAndPositionCommand("_executeDefinitionProvider", (e, n, r) => {
	let i = e.get(ILanguageFeaturesService), a = getDefinitionsAtPosition(i.definitionProvider, n, r, !1, CancellationToken.None);
	return _sortedAndDeduped(() => a);
}), registerModelAndPositionCommand("_executeDefinitionProvider_recursive", (e, n, r) => {
	let i = e.get(ILanguageFeaturesService), a = getDefinitionsAtPosition(i.definitionProvider, n, r, !0, CancellationToken.None);
	return _sortedAndDeduped(() => a);
}), registerModelAndPositionCommand("_executeTypeDefinitionProvider", (e, n, r) => {
	let i = e.get(ILanguageFeaturesService), a = getTypeDefinitionsAtPosition(i.typeDefinitionProvider, n, r, !1, CancellationToken.None);
	return _sortedAndDeduped(() => a);
}), registerModelAndPositionCommand("_executeTypeDefinitionProvider_recursive", (e, n, r) => {
	let i = e.get(ILanguageFeaturesService), a = getTypeDefinitionsAtPosition(i.typeDefinitionProvider, n, r, !0, CancellationToken.None);
	return _sortedAndDeduped(() => a);
}), registerModelAndPositionCommand("_executeDeclarationProvider", (e, n, r) => {
	let i = e.get(ILanguageFeaturesService), a = getDeclarationsAtPosition(i.declarationProvider, n, r, !1, CancellationToken.None);
	return _sortedAndDeduped(() => a);
}), registerModelAndPositionCommand("_executeDeclarationProvider_recursive", (e, n, r) => {
	let i = e.get(ILanguageFeaturesService), a = getDeclarationsAtPosition(i.declarationProvider, n, r, !0, CancellationToken.None);
	return _sortedAndDeduped(() => a);
}), registerModelAndPositionCommand("_executeReferenceProvider", (e, n, r) => {
	let i = e.get(ILanguageFeaturesService), a = getReferencesAtPosition(i.referenceProvider, n, r, !1, !1, CancellationToken.None);
	return _sortedAndDeduped(() => a);
}), registerModelAndPositionCommand("_executeReferenceProvider_recursive", (e, n, r) => {
	let i = e.get(ILanguageFeaturesService), a = getReferencesAtPosition(i.referenceProvider, n, r, !1, !0, CancellationToken.None);
	return _sortedAndDeduped(() => a);
}), registerModelAndPositionCommand("_executeImplementationProvider", (e, n, r) => {
	let i = e.get(ILanguageFeaturesService), a = getImplementationsAtPosition(i.implementationProvider, n, r, !1, CancellationToken.None);
	return _sortedAndDeduped(() => a);
}), registerModelAndPositionCommand("_executeImplementationProvider_recursive", (e, n, r) => {
	let i = e.get(ILanguageFeaturesService), a = getImplementationsAtPosition(i.implementationProvider, n, r, !0, CancellationToken.None);
	return _sortedAndDeduped(() => a);
}), MenuRegistry.appendMenuItem(MenuId.EditorContext, {
	submenu: MenuId.EditorContextPeek,
	title: localize("peek.submenu", "Peek"),
	group: "navigation",
	order: 100
});
var SymbolNavigationAnchor = class e {
	static is(n) {
		return !n || typeof n != "object" ? !1 : !!(n instanceof e || Position.isIPosition(n.position) && n.model);
	}
	constructor(e, n) {
		this.model = e, this.position = n;
	}
}, 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 n = {
			...e,
			f1: !0
		};
		if (n.menu) for (let r of Iterable.wrap(n.menu)) (r.id === MenuId.EditorContext || r.id === MenuId.EditorContextPeek) && (r.when = ContextKeyExpr.and(e.precondition, r.when));
		return n;
	}
	constructor(n, r) {
		super(e._patchConfig(r)), this.configuration = n, e._allSymbolNavigationCommands.set(r.id, this);
	}
	runEditorCommand(n, r, i, a) {
		if (!r.hasModel()) return Promise.resolve(void 0);
		let o = n.get(INotificationService), s = n.get(ICodeEditorService), c = n.get(IEditorProgressService), l = n.get(ISymbolNavigationService), u = n.get(ILanguageFeaturesService), d = n.get(IInstantiationService), f = r.getModel(), m = r.getPosition(), g = SymbolNavigationAnchor.is(i) ? i : new SymbolNavigationAnchor(f, m), _ = new EditorStateCancellationTokenSource(r, 5), v = raceCancellation(this._getLocationModel(u, g.model, g.position, _.token), _.token).then(async (n) => {
			if (!n || _.token.isCancellationRequested) return;
			alert(n.ariaMessage);
			let o;
			if (n.referenceAt(f.uri, m)) {
				let n = this._getAlternativeCommand(r);
				!e._activeAlternativeCommands.has(n) && e._allSymbolNavigationCommands.has(n) && (o = e._allSymbolNavigationCommands.get(n));
			}
			let c = n.references.length;
			if (c === 0) {
				if (!this.configuration.muteMessage) {
					let e = f.getWordAtPosition(m);
					MessageController.get(r)?.showMessage(this._getNoResultFoundMessage(e), m);
				}
			} else if (c === 1 && o) e._activeAlternativeCommands.add(this.desc.id), d.invokeFunction((n) => o.runEditorCommand(n, r, i, a).finally(() => {
				e._activeAlternativeCommands.delete(this.desc.id);
			}));
			else return this._onResult(s, l, r, n, a);
		}, (e) => {
			o.error(e);
		}).finally(() => {
			_.dispose();
		});
		return c.showWhile(v, 250), v;
	}
	async _onResult(e, n, r, i, a) {
		let o = this._getGoToPreference(r);
		if (!(r instanceof EmbeddedCodeEditorWidget) && (this.configuration.openInPeek || o === "peek" && i.references.length > 1)) this._openInPeek(r, i, a);
		else {
			let s = i.firstReference(), c = i.references.length > 1 && o === "gotoAndPeek", l = await this._openReference(r, e, s, this.configuration.openToSide, !c);
			c && l ? this._openInPeek(l, i, a) : i.dispose(), o === "goto" && n.put(s);
		}
	}
	async _openReference(e, n, r, i, a) {
		let o;
		if (isLocationLink(r) && (o = r.targetSelectionRange), o ||= r.range, !o) return;
		let s = await n.openCodeEditor({
			resource: r.uri,
			options: {
				selection: Range.collapseToStart(o),
				selectionRevealType: 3,
				selectionSource: "code.jump"
			}
		}, e, i);
		if (s) {
			if (a) {
				let e = s.getModel(), n = s.createDecorationsCollection([{
					range: o,
					options: {
						description: "symbol-navigate-action-highlight",
						className: "symbolHighlight"
					}
				}]);
				setTimeout(() => {
					s.getModel() === e && n.clear();
				}, 350);
			}
			return s;
		}
	}
	_openInPeek(e, n, r) {
		let i = ReferencesController.get(e);
		i && e.hasModel() ? i.toggleWidget(r ?? e.getSelection(), createCancelablePromise((e) => Promise.resolve(n)), this.configuration.openInPeek) : n.dispose();
	}
}, DefinitionAction = class extends SymbolNavigationAction {
	async _getLocationModel(e, n, r, i) {
		return new ReferencesModel(await getDefinitionsAtPosition(e.definitionProvider, n, r, !1, i), 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, n, r, i) {
		return new ReferencesModel(await getDeclarationsAtPosition(e.declarationProvider, n, r, !1, i), 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, n, r, i) {
		return new ReferencesModel(await getTypeDefinitionsAtPosition(e.typeDefinitionProvider, n, r, !1, i), 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, n, r, i) {
		return new ReferencesModel(await getImplementationsAtPosition(e.implementationProvider, n, r, !1, i), 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, n, r, i) {
		return new ReferencesModel(await getReferencesAtPosition(e.referenceProvider, n, r, !0, !1, i), 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, n, r, i) {
		return new ReferencesModel(await getReferencesAtPosition(e.referenceProvider, n, r, !1, !1, i), localize("ref.title", "References"));
	}
});
var GenericGoToLocationAction = class extends SymbolNavigationAction {
	constructor(e, n, r) {
		super(e, {
			id: "editor.action.goToLocation",
			title: localize2("label.generic", "Go to Any Symbol"),
			precondition: ContextKeyExpr.and(PeekContext.notInPeekEditor, EditorContextKeys.isInEmbeddedEditor.toNegated())
		}), this._references = n, this._gotoMultipleBehaviour = r;
	}
	async _getLocationModel(e, n, r, i) {
		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, n, r, i, a, o, s) => {
		assertType(URI.isUri(n)), assertType(Position.isIPosition(r)), assertType(Array.isArray(i)), assertType(a === void 0 || typeof a == "string"), assertType(s === void 0 || typeof s == "boolean");
		let c = e.get(ICodeEditorService), l = await c.openCodeEditor({ resource: n }, c.getFocusedCodeEditor());
		if (isCodeEditor(l)) return l.setPosition(r), l.revealPositionInCenterIfOutsideViewport(r, 0), l.invokeWithinContext((e) => {
			let n = new class extends GenericGoToLocationAction {
				_getNoResultFoundMessage(e) {
					return o || super._getNoResultFoundMessage(e);
				}
			}({
				muteMessage: !o,
				openInPeek: !!s,
				openToSide: !1
			}, i, a);
			e.get(IInstantiationService).invokeFunction(n.run.bind(n), l);
		});
	}
}), 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, n, r, i, a) => {
		e.get(ICommandService).executeCommand("editor.action.goToLocations", n, r, i, a, void 0, !0);
	}
}), CommandsRegistry.registerCommand({
	id: "editor.action.findReferences",
	handler: (e, n, r) => {
		assertType(URI.isUri(n)), assertType(Position.isIPosition(r));
		let i = e.get(ILanguageFeaturesService), a = e.get(ICodeEditorService);
		return a.openCodeEditor({ resource: n }, a.getFocusedCodeEditor()).then((e) => {
			if (!isCodeEditor(e) || !e.hasModel()) return;
			let n = ReferencesController.get(e);
			if (!n) return;
			let a = createCancelablePromise((n) => getReferencesAtPosition(i.referenceProvider, e.getModel(), Position.lift(r), !1, !1, n).then((e) => new ReferencesModel(e, localize("ref.title", "References")))), o = new Range(r.lineNumber, r.column, r.lineNumber, r.column);
			return Promise.resolve(n.toggleWidget(o, a, !1));
		});
	}
}), CommandsRegistry.registerCommandAlias("editor.action.showReferences", "editor.action.peekLocations");
async function showGoToContextMenu(e, n, r, i) {
	let a = e.get(ITextModelService), o = e.get(IContextMenuService), s = e.get(ICommandService), c = e.get(IInstantiationService), u = e.get(INotificationService);
	if (await i.item.resolve(CancellationToken.None), !i.part.location) return;
	let d = i.part.location, f = [], m = new Set(MenuRegistry.getMenuItems(MenuId.EditorContext).map((e) => isIMenuItem(e) ? e.command.id : generateUuid()));
	for (let e of SymbolNavigationAction.all()) m.has(e.desc.id) && f.push(new Action(e.desc.id, MenuItemAction.label(e.desc, { renderShortTitle: !0 }), void 0, !0, async () => {
		let r = await a.createModelReference(d.uri);
		try {
			let a = new SymbolNavigationAnchor(r.object.textEditorModel, Range.getStartPosition(d.range)), o = i.item.anchor.range;
			await c.invokeFunction(e.runEditorCommand.bind(e), n, a, o);
		} finally {
			r.dispose();
		}
	}));
	if (i.part.command) {
		let { command: e } = i.part;
		f.push(new Separator()), f.push(new Action(e.id, e.title, void 0, !0, async () => {
			try {
				await s.executeCommand(e.id, ...e.arguments ?? []);
			} catch (e) {
				u.notify({
					severity: Severity.Error,
					source: i.item.provider.displayName,
					message: e
				});
			}
		}));
	}
	let g = n.getOption(128);
	o.showContextMenu({
		domForShadowRoot: g ? n.getDomNode() ?? void 0 : void 0,
		getAnchor: () => {
			let e = getDomNodePagePosition(r);
			return {
				x: e.left,
				y: e.top + e.height + 8
			};
		},
		getActions: () => f,
		onHide: () => {
			n.focus();
		},
		autoSelectFirstItem: !0
	});
}
async function goToDefinitionWithLocation(e, n, r, i) {
	let a = await e.get(ITextModelService).createModelReference(i.uri);
	await r.invokeWithinContext(async (e) => {
		let o = n.hasSideBySideModifier, s = e.get(IContextKeyService), c = PeekContext.inPeekEditor.getValue(s), l = !o && r.getOption(89) && !c;
		return new DefinitionAction({
			openToSide: o,
			openInPeek: l,
			muteMessage: !0
		}, {
			title: {
				value: "",
				original: ""
			},
			id: "",
			precondition: void 0
		}).run(e, new SymbolNavigationAnchor(a.object.textEditorModel, Range.getStartPosition(i.range)), Range.lift(i.range));
	}), a.dispose();
}
var __decorate$76 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$76 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, InlayHintsController_1, InlayHintsCache = class e {
	constructor() {
		this._entries = new LRUCache(50);
	}
	get(n) {
		let r = e._key(n);
		return this._entries.get(r);
	}
	set(n, r) {
		let i = e._key(n);
		this._entries.set(i, r);
	}
	static _key(e) {
		return `${e.uri.toString()}/${e.getVersionId()}`;
	}
}, IInlayHintsCache = createDecorator("IInlayHintsCache");
registerSingleton(IInlayHintsCache, InlayHintsCache, 1);
var RenderedInlayHintLabelPart = class {
	constructor(e, n) {
		this.item = e, this.index = n;
	}
	get part() {
		let e = this.item.hint.label;
		return typeof e == "string" ? { label: e } : e[this.index];
	}
}, ActiveInlayHintInfo = class {
	constructor(e, n) {
		this.part = e, this.hasTriggerModifier = n;
	}
}, 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, n, r, i, a, o, s) {
		this._editor = e, this._languageFeaturesService = n, this._inlayHintsCache = i, this._commandService = a, this._notificationService = o, this._instaService = s, this._disposables = new DisposableStore(), this._sessionDisposables = new DisposableStore(), this._decorationsMetadata = /* @__PURE__ */ new Map(), this._ruleFactory = new DynamicCssRules(this._editor), this._activeRenderMode = 0, this._debounceInfo = r.for(n.inlayHintsProvider, "InlayHint", { min: 25 }), this._disposables.add(n.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 n = this._editor.getModel();
		if (!n || !this._languageFeaturesService.inlayHintsProvider.has(n)) return;
		if (e.enabled === "on") this._activeRenderMode = 0;
		else {
			let n, r;
			e.enabled === "onUnlessPressed" ? (n = 0, r = 1) : (n = 1, r = 0), this._activeRenderMode = n, this._sessionDisposables.add(ModifierKeyEmitter.getInstance().event((e) => {
				if (!this._editor.hasModel()) return;
				let i = e.altKey && e.ctrlKey && !(e.shiftKey || e.metaKey) ? r : n;
				if (i !== this._activeRenderMode) {
					this._activeRenderMode = i;
					let e = this._editor.getModel(), n = this._copyInlayHintsWithCurrentAnchor(e);
					this._updateHintsDecorators([e.getFullModelRange()], n), o.schedule(0);
				}
			}));
		}
		let r = this._inlayHintsCache.get(n);
		r && this._updateHintsDecorators([n.getFullModelRange()], r), this._sessionDisposables.add(toDisposable(() => {
			n.isDisposed() || this._cacheHintsForFastRestore(n);
		}));
		let i, a = /* @__PURE__ */ new Set(), o = new RunOnceScheduler(async () => {
			let e = Date.now();
			i?.dispose(!0), i = new CancellationTokenSource();
			let r = n.onWillDispose(() => i?.cancel());
			try {
				let r = i.token, s = await InlayHintsFragments.create(this._languageFeaturesService.inlayHintsProvider, n, this._getHintsRanges(), r);
				if (o.delay = this._debounceInfo.update(n, Date.now() - e), r.isCancellationRequested) {
					s.dispose();
					return;
				}
				for (let e of s.provider) typeof e.onDidChangeInlayHints == "function" && !a.has(e) && (a.add(e), this._sessionDisposables.add(e.onDidChangeInlayHints(() => {
					o.isScheduled() || o.schedule();
				})));
				this._sessionDisposables.add(s), this._updateHintsDecorators(s.ranges, s.items), this._cacheHintsForFastRestore(n);
			} catch (e) {
				onUnexpectedError(e);
			} finally {
				i.dispose(), r.dispose();
			}
		}, this._debounceInfo.get(n));
		this._sessionDisposables.add(o), this._sessionDisposables.add(toDisposable(() => i?.dispose(!0))), o.schedule(0), this._sessionDisposables.add(this._editor.onDidScrollChange((e) => {
			(e.scrollTopChanged || !o.isScheduled()) && o.schedule();
		})), this._sessionDisposables.add(this._editor.onDidChangeModelContent((e) => {
			i?.cancel();
			let n = Math.max(o.delay, 1250);
			o.schedule(n);
		})), this._sessionDisposables.add(this._installDblClickGesture(() => o.schedule(0))), this._sessionDisposables.add(this._installLinkGesture()), this._sessionDisposables.add(this._installContextMenu());
	}
	_installLinkGesture() {
		let e = new DisposableStore(), n = e.add(new ClickLinkGesture(this._editor)), r = new DisposableStore();
		return e.add(r), e.add(n.onMouseMoveOrRelevantKeyDown((e) => {
			let [n] = e, i = this._getInlayHintLabelPart(n), a = this._editor.getModel();
			if (!i || !a) {
				r.clear();
				return;
			}
			let o = new CancellationTokenSource();
			r.add(toDisposable(() => o.dispose(!0))), i.item.resolve(o.token), this._activeInlayHintPart = i.part.command || i.part.location ? new ActiveInlayHintInfo(i, n.hasTriggerModifier) : void 0;
			let s = a.validatePosition(i.item.hint.position).lineNumber, c = new Range(s, 1, s, a.getLineMaxColumn(s)), l = this._getInlineHintsForRange(c);
			this._updateHintsDecorators([c], l), r.add(toDisposable(() => {
				this._activeInlayHintPart = void 0, this._updateHintsDecorators([c], l);
			}));
		})), e.add(n.onCancel(() => r.clear())), e.add(n.onExecute(async (e) => {
			let n = this._getInlayHintLabelPart(e);
			if (n) {
				let r = n.part;
				r.location ? this._instaService.invokeFunction(goToDefinitionWithLocation, e, this._editor, r.location) : Command$1.is(r.command) && await this._invokeCommand(r.command, n.item);
			}
		})), e;
	}
	_getInlineHintsForRange(e) {
		let n = /* @__PURE__ */ new Set();
		for (let r of this._decorationsMetadata.values()) e.containsRange(r.item.anchor.range) && n.add(r.item);
		return Array.from(n);
	}
	_installDblClickGesture(e) {
		return this._editor.onMouseUp(async (n) => {
			if (n.event.detail !== 2) return;
			let r = this._getInlayHintLabelPart(n);
			if (r && (n.event.preventDefault(), await r.item.resolve(CancellationToken.None), isNonEmptyArray(r.item.hint.textEdits))) {
				let n = r.item.hint.textEdits.map((e) => EditOperation.replace(Range.lift(e.range), e.text));
				this._editor.executeEdits("inlayHint.default", n), e();
			}
		});
	}
	_installContextMenu() {
		return this._editor.onContextMenu(async (e) => {
			if (!isHTMLElement(e.event.target)) return;
			let n = this._getInlayHintLabelPart(e);
			n && await this._instaService.invokeFunction(showGoToContextMenu, this._editor, e.event.target, n);
		});
	}
	_getInlayHintLabelPart(e) {
		if (e.target.type !== 6) return;
		let n = e.target.detail.injectedText?.options;
		if (n instanceof ModelDecorationInjectedTextOptions && n?.attachedData instanceof RenderedInlayHintLabelPart) return n.attachedData;
	}
	async _invokeCommand(e, n) {
		try {
			await this._commandService.executeCommand(e.id, ...e.arguments ?? []);
		} catch (e) {
			this._notificationService.notify({
				severity: Severity.Error,
				source: n.provider.displayName,
				message: e
			});
		}
	}
	_cacheHintsForFastRestore(e) {
		let n = this._copyInlayHintsWithCurrentAnchor(e);
		this._inlayHintsCache.set(e, n);
	}
	_copyInlayHintsWithCurrentAnchor(e) {
		let n = /* @__PURE__ */ new Map();
		for (let [r, i] of this._decorationsMetadata) {
			if (n.has(i.item)) continue;
			let a = e.getDecorationRange(r);
			if (a) {
				let e = new InlayHintAnchor(a, i.item.anchor.direction), r = i.item.with({ anchor: e });
				n.set(i.item, r);
			}
		}
		return Array.from(n.values());
	}
	_getHintsRanges() {
		let e = this._editor.getModel(), n = this._editor.getVisibleRangesPlusViewportAboveBelow(), r = [];
		for (let i of n.sort(Range.compareRangesUsingStarts)) {
			let n = e.validateRange(new Range(i.startLineNumber - 30, i.startColumn, i.endLineNumber + 30, i.endColumn));
			r.length === 0 || !Range.areIntersectingOrTouching(r[r.length - 1], n) ? r.push(n) : r[r.length - 1] = Range.plusRange(r[r.length - 1], n);
		}
		return r;
	}
	_updateHintsDecorators(e, n) {
		let r = [], i = (e, n, i, a, o) => {
			let s = {
				content: i,
				inlineClassNameAffectsLetterSpacing: !0,
				inlineClassName: n.className,
				cursorStops: a,
				attachedData: o
			};
			r.push({
				item: e,
				classNameRef: n,
				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 ? s : void 0
					}
				}
			});
		}, a = (e, n) => {
			let r = this._ruleFactory.createClassNameRef({
				width: `${o / 3 | 0}px`,
				display: "inline-block"
			});
			i(e, r, " ", n ? InjectedTextCursorStops.Right : InjectedTextCursorStops.None);
		}, { fontSize: o, fontFamily: s, padding: c, isUniform: l } = this._getLayoutInfo(), u = "--code-editorInlayHintsFontFamily";
		this._editor.getContainerDomNode().style.setProperty(u, s);
		let d = {
			line: 0,
			totalLen: 0
		};
		for (let e of n) {
			if (d.line !== e.anchor.range.startLineNumber && (d = {
				line: e.anchor.range.startLineNumber,
				totalLen: 0
			}), d.totalLen > InlayHintsController_1._MAX_LABEL_LEN) continue;
			e.hint.paddingLeft && a(e, !1);
			let n = typeof e.hint.label == "string" ? [{ label: e.hint.label }] : e.hint.label;
			for (let r = 0; r < n.length; r++) {
				let a = n[r], s = r === 0, f = r === n.length - 1, m = {
					fontSize: `${o}px`,
					fontFamily: `var(${u}), ${EDITOR_FONT_DEFAULTS.fontFamily}`,
					verticalAlign: l ? "baseline" : "middle",
					unicodeBidi: "isolate"
				};
				isNonEmptyArray(e.hint.textEdits) && (m.cursor = "default"), this._fillInColors(m, e.hint), (a.command || a.location) && this._activeInlayHintPart?.part.item === e && this._activeInlayHintPart.part.index === r && (m.textDecoration = "underline", this._activeInlayHintPart.hasTriggerModifier && (m.color = themeColorFromId(editorActiveLinkForeground), m.cursor = "pointer")), c && (s && f ? (m.padding = `1px ${Math.max(1, o / 4) | 0}px`, m.borderRadius = `${o / 4 | 0}px`) : s ? (m.padding = `1px 0 1px ${Math.max(1, o / 4) | 0}px`, m.borderRadius = `${o / 4 | 0}px 0 0 ${o / 4 | 0}px`) : f ? (m.padding = `1px ${Math.max(1, o / 4) | 0}px 1px 0`, m.borderRadius = `0 ${o / 4 | 0}px ${o / 4 | 0}px 0`) : m.padding = "1px 0 1px 0");
				let g = a.label;
				d.totalLen += g.length;
				let _ = !1, v = d.totalLen - InlayHintsController_1._MAX_LABEL_LEN;
				if (v > 0 && (g = g.slice(0, -v) + "…", _ = !0), i(e, this._ruleFactory.createClassNameRef(m), fixSpace(g), f && !e.hint.paddingRight ? InjectedTextCursorStops.Right : InjectedTextCursorStops.None, new RenderedInlayHintLabelPart(e, r)), _) break;
			}
			if (e.hint.paddingRight && a(e, !0), r.length > InlayHintsController_1._MAX_DECORATORS) break;
		}
		let f = [];
		for (let [n, r] of this._decorationsMetadata) {
			let i = this._editor.getModel()?.getDecorationRange(n);
			i && e.some((e) => e.containsRange(i)) && (f.push(n), r.classNameRef.dispose(), this._decorationsMetadata.delete(n));
		}
		let m = StableEditorScrollState.capture(this._editor);
		this._editor.changeDecorations((e) => {
			let n = e.deltaDecorations(f, r.map((e) => e.decoration));
			for (let e = 0; e < n.length; e++) {
				let i = r[e];
				this._decorationsMetadata.set(n[e], i);
			}
		}), m.restore(this._editor);
	}
	_fillInColors(e, n) {
		n.kind === InlayHintKind$1.Parameter ? (e.backgroundColor = themeColorFromId(editorInlayHintParameterBackground), e.color = themeColorFromId(editorInlayHintParameterForeground)) : n.kind === InlayHintKind$1.Type ? (e.backgroundColor = themeColorFromId(editorInlayHintTypeBackground), e.color = themeColorFromId(editorInlayHintTypeForeground)) : (e.backgroundColor = themeColorFromId(editorInlayHintBackground), e.color = themeColorFromId(editorInlayHintForeground));
	}
	_getLayoutInfo() {
		let e = this._editor.getOption(142), n = e.padding, r = this._editor.getOption(52), i = this._editor.getOption(49), a = e.fontSize;
		(!a || a < 5 || a > r) && (a = r);
		let o = e.fontFamily || i;
		return {
			fontSize: a,
			fontFamily: o,
			padding: n,
			isUniform: !n && o === i && a === r
		};
	}
	_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, ...n) => {
	let [r, i] = n;
	assertType(URI.isUri(r)), assertType(Range.isIRange(i));
	let { inlayHintsProvider: a } = e.get(ILanguageFeaturesService), o = await e.get(ITextModelService).createModelReference(r);
	try {
		let e = await InlayHintsFragments.create(a, o.object.textEditorModel, [Range.lift(i)], CancellationToken.None), n = e.items.map((e) => e.hint);
		return setTimeout(() => e.dispose(), 0), n;
	} finally {
		o.dispose();
	}
});
var __decorate$75 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$75 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, InlayHintsHoverAnchor = class extends HoverForeignElementAnchor {
	constructor(e, n, r, i) {
		super(10, n, e.item.anchor.range, r, i, !0), this.part = e;
	}
}, InlayHintsHover = class extends MarkdownHoverParticipant {
	constructor(e, n, r, i, a, o, s, c, l) {
		super(e, n, r, o, c, i, a, l), this._resolverService = s, this.hoverOrdinal = 6;
	}
	suggestHoverAnchor(e) {
		if (!InlayHintsController.get(this._editor) || e.target.type !== 6) return null;
		let n = e.target.detail.injectedText?.options;
		return n instanceof ModelDecorationInjectedTextOptions && n.attachedData instanceof RenderedInlayHintLabelPart ? new InlayHintsHoverAnchor(n.attachedData, this, e.event.posx, e.event.posy) : null;
	}
	computeSync() {
		return [];
	}
	computeAsync(e, n, r) {
		return e instanceof InlayHintsHoverAnchor ? new AsyncIterableObject(async (n) => {
			let { part: i } = e;
			if (await i.item.resolve(r), r.isCancellationRequested) return;
			let a;
			typeof i.item.hint.tooltip == "string" ? a = new MarkdownString().appendText(i.item.hint.tooltip) : i.item.hint.tooltip && (a = i.item.hint.tooltip), a && n.emitOne(new MarkdownHover(this, e.range, [a], !1, 0)), isNonEmptyArray(i.item.hint.textEdits) && n.emitOne(new MarkdownHover(this, e.range, [new MarkdownString().appendText(localize("hint.dbl", "Double-click to insert"))], !1, 10001));
			let o;
			if (typeof i.part.tooltip == "string" ? o = new MarkdownString().appendText(i.part.tooltip) : i.part.tooltip && (o = i.part.tooltip), o && n.emitOne(new MarkdownHover(this, e.range, [o], !1, 1)), i.part.location || i.part.command) {
				let r, a = 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");
				i.part.location && i.part.command ? r = new MarkdownString().appendText(localize("hint.defAndCommand", "Go to Definition ({0}), right click for more", a)) : i.part.location ? r = new MarkdownString().appendText(localize("hint.def", "Go to Definition ({0})", a)) : i.part.command && (r = new MarkdownString(`[${localize("hint.cmd", "Execute Command")}](${asCommandLink(i.part.command)} "${i.part.command.title}") (${a})`, { isTrusted: !0 })), r && n.emitOne(new MarkdownHover(this, e.range, [r], !1, 1e4));
			}
			let s = await this._resolveInlayHintLabelPartHover(i, r);
			for await (let e of s) n.emitOne(e);
		}) : AsyncIterableObject.EMPTY;
	}
	async _resolveInlayHintLabelPartHover(e, n) {
		if (!e.part.location) return AsyncIterableObject.EMPTY;
		let { uri: r, range: i } = e.part.location, a = await this._resolverService.createModelReference(r);
		try {
			let r = a.object.textEditorModel;
			return this._languageFeaturesService.hoverProvider.has(r) ? getHoverProviderResultsAsAsyncIterable(this._languageFeaturesService.hoverProvider, r, new Position(i.startLineNumber, i.startColumn), n).filter((e) => !isEmptyMarkdownString(e.hover.contents)).map((n) => new MarkdownHover(this, e.item.anchor.range, n.hover.contents, !1, 2 + n.ordinal)) : AsyncIterableObject.EMPTY;
		} finally {
			a.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(n, r, i, a, o, s) {
		super();
		let c = r.anchor, l = r.hoverParts;
		this._renderedHoverParts = this._register(new RenderedContentHoverParts(n, i, l, s, o));
		let { showAtPosition: u, showAtSecondaryPosition: d } = e.computeHoverPositions(n, c.range, l);
		this.shouldAppearBeforeContent = l.some((e) => e.isBeforeContent), this.showAtPosition = u, this.showAtSecondaryPosition = d, this.initialMousePosX = c.initialMousePosX, this.initialMousePosY = c.initialMousePosY, this.shouldFocus = a.shouldFocus, this.source = a.source;
	}
	get domNode() {
		return this._renderedHoverParts.domNode;
	}
	get domNodeHasChildren() {
		return this._renderedHoverParts.domNodeHasChildren;
	}
	get focusedHoverPartIndex() {
		return this._renderedHoverParts.focusedHoverPartIndex;
	}
	async updateHoverVerbosityLevel(e, n, r) {
		this._renderedHoverParts.updateHoverVerbosityLevel(e, n, r);
	}
	isColorPickerVisible() {
		return this._renderedHoverParts.isColorPickerVisible();
	}
	static computeHoverPositions(e, n, r) {
		let i = 1;
		if (e.hasModel()) {
			let r = e._getViewModel(), a = r.coordinatesConverter, o = a.convertModelRangeToViewRange(n), s = r.getLineMinColumn(o.startLineNumber), c = new Position(o.startLineNumber, s);
			i = a.convertViewPositionToModelPosition(c).column;
		}
		let a = n.startLineNumber, o = n.startColumn, s;
		for (let e of r) {
			let n = e.range, r = n.startLineNumber === a, c = n.endLineNumber === a;
			if (r && c) {
				let e = n.startColumn, r = Math.min(o, e);
				o = Math.max(r, i);
			}
			e.forceShowAtRange && (s = n);
		}
		let c, l;
		if (s) {
			let e = s.getStartPosition();
			c = e, l = e;
		} else c = n.getStartPosition(), l = new Position(a, o);
		return {
			showAtPosition: c,
			showAtSecondaryPosition: l
		};
	}
}, RenderedStatusBar = class {
	constructor(e, n) {
		this._statusBar = n, 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, n, r, i, a) {
		super(), this._renderedParts = [], this._focusedHoverPartIndex = -1, this._context = a, this._fragment = document.createDocumentFragment(), this._register(this._renderParts(n, r, a, i)), this._register(this._registerListenersOnRenderedParts()), this._register(this._createEditorDecorations(e, r)), this._updateMarkdownAndColorParticipantInfo(n);
	}
	_createEditorDecorations(n, r) {
		if (r.length === 0) return Disposable.None;
		let i = r[0].range;
		for (let e of r) {
			let n = e.range;
			i = Range.plusRange(i, n);
		}
		let a = n.createDecorationsCollection();
		return a.set([{
			range: i,
			options: e._DECORATION_OPTIONS
		}]), toDisposable(() => {
			a.clear();
		});
	}
	_renderParts(e, n, r, i) {
		let a = new EditorHoverStatusBar(i), o = {
			fragment: this._fragment,
			statusBar: a,
			...r
		}, s = new DisposableStore();
		for (let r of e) {
			let e = this._renderHoverPartsForParticipant(n, r, o);
			s.add(e);
			for (let n of e.renderedHoverParts) this._renderedParts.push({
				type: "hoverPart",
				participant: r,
				hoverPart: n.hoverPart,
				hoverElement: n.hoverElement
			});
		}
		let c = this._renderStatusBar(this._fragment, a);
		return c && (s.add(c), this._renderedParts.push({
			type: "statusBar",
			hoverElement: c.hoverElement,
			actions: c.actions
		})), toDisposable(() => {
			s.dispose();
		});
	}
	_renderHoverPartsForParticipant(e, n, r) {
		let i = e.filter((e) => e.owner === n);
		return i.length > 0 ? n.renderHoverParts(r, i) : new RenderedHoverParts([]);
	}
	_renderStatusBar(e, n) {
		if (n.hasContent) return new RenderedStatusBar(e, n);
	}
	_registerListenersOnRenderedParts() {
		let e = new DisposableStore();
		return this._renderedParts.forEach((n, r) => {
			let i = n.hoverElement;
			i.tabIndex = 0, e.add(addDisposableListener(i, EventType$1.FOCUS_IN, (e) => {
				e.stopPropagation(), this._focusedHoverPartIndex = r;
			})), e.add(addDisposableListener(i, EventType$1.FOCUS_OUT, (e) => {
				e.stopPropagation(), this._focusedHoverPartIndex = -1;
			}));
		}), e;
	}
	_updateMarkdownAndColorParticipantInfo(e) {
		let n = e.find((e) => e instanceof MarkdownHoverParticipant && !(e instanceof InlayHintsHover));
		n && (this._markdownHoverParticipant = n), this._colorHoverParticipant = e.find((e) => e instanceof ColorHoverParticipant);
	}
	async updateHoverVerbosityLevel(e, n, r) {
		if (!this._markdownHoverParticipant) return;
		let i = this._normalizedIndexToMarkdownHoverIndexRange(this._markdownHoverParticipant, n);
		if (i === void 0) return;
		let a = await this._markdownHoverParticipant.updateMarkdownHoverVerbosityLevel(e, i, r);
		a && (this._renderedParts[n] = {
			type: "hoverPart",
			participant: this._markdownHoverParticipant,
			hoverPart: a.hoverPart,
			hoverElement: a.hoverElement
		}, this._context.onContentsChanged());
	}
	isColorPickerVisible() {
		return this._colorHoverParticipant?.isColorPickerVisible() ?? !1;
	}
	_normalizedIndexToMarkdownHoverIndexRange(e, n) {
		let r = this._renderedParts[n];
		if (!r || r.type !== "hoverPart" || r.participant !== e) return;
		let i = this._renderedParts.findIndex((n) => n.type === "hoverPart" && n.participant === e);
		if (i === -1) throw new BugIndicatingError();
		return n - i;
	}
	get domNode() {
		return this._fragment;
	}
	get domNodeHasChildren() {
		return this._fragment.hasChildNodes();
	}
	get focusedHoverPartIndex() {
		return this._focusedHoverPartIndex;
	}
}, __decorate$74 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$74 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, ContentHoverWidgetWrapper = class extends Disposable {
	constructor(e, n, r) {
		super(), this._editor = e, this._instantiationService = n, this._keybindingService = r, 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 n of HoverParticipantRegistry.getAll()) {
			let r = this._instantiationService.createInstance(n, this._editor);
			e.push(r);
		}
		return e.sort((e, n) => e.hoverOrdinal - n.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 n = e.hasLoadingMessage ? this._addLoadingMessage(e.value) : e.value;
			this._withResult(new HoverResult(this._computer.anchor, n, 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, n, r, i, a) {
		if (!(this._contentHoverWidget.position && this._currentResult)) return e ? (this._startHoverOperationIfNecessary(e, n, r, i, !1), !0) : !1;
		let o = this._editor.getOption(60).sticky, s = a && this._contentHoverWidget.isMouseGettingCloser(a.event.posx, a.event.posy);
		return o && s ? (e && this._startHoverOperationIfNecessary(e, n, r, i, !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, n, r, i, !1), !0) : (this._setCurrentResult(null), this._startHoverOperationIfNecessary(e, n, r, i, !1), !0) : (this._setCurrentResult(null), !1);
	}
	_startHoverOperationIfNecessary(e, n, r, i, a) {
		this._computer.anchor && this._computer.anchor.equals(e) || (this._hoverOperation.cancel(), this._computer.anchor = e, this._computer.shouldFocus = i, this._computer.source = r, this._computer.insistOnKeepingHoverVisible = a, this._hoverOperation.start(n));
	}
	_setCurrentResult(e) {
		let n = e;
		this._currentResult !== n && (n && n.hoverParts.length === 0 && (n = null), this._currentResult = n, this._currentResult ? this._showHover(this._currentResult) : this._hideHover());
	}
	_addLoadingMessage(e) {
		if (!this._computer.anchor) return e;
		for (let n of this._participants) {
			if (!n.createLoadingMessage) continue;
			let r = n.createLoadingMessage(this._computer.anchor);
			if (r) return e.slice(0).concat([r]);
		}
		return e;
	}
	_withResult(e) {
		if (this._contentHoverWidget.position && this._currentResult && this._currentResult.isComplete || this._setCurrentResult(e), !e.isComplete) return;
		let n = e.hoverParts.length === 0, r = this._computer.insistOnKeepingHoverVisible;
		n && r || this._setCurrentResult(e);
	}
	_showHover(e) {
		let n = this._getHoverContext();
		this._renderedContentHover = new RenderedContentHover(this._editor, e, this._participants, this._computer, n, 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 n = this._findHoverAnchorCandidates(e);
		if (!(n.length > 0)) return this._startShowingOrUpdateHover(null, 0, 0, !1, e);
		let r = n[0];
		return this._startShowingOrUpdateHover(r, 0, 0, !1, e);
	}
	_findHoverAnchorCandidates(e) {
		let n = [];
		for (let r of this._participants) {
			if (!r.suggestHoverAnchor) continue;
			let i = r.suggestHoverAnchor(e);
			i && n.push(i);
		}
		let r = e.target;
		switch (r.type) {
			case 6:
				n.push(new HoverRangeAnchor(0, r.range, e.event.posx, e.event.posy));
				break;
			case 7: {
				let i = this._editor.getOption(50).typicalHalfwidthCharacterWidth / 2;
				if (!(!r.detail.isAfterLines && typeof r.detail.horizontalDistanceToText == "number" && r.detail.horizontalDistanceToText < i)) break;
				n.push(new HoverRangeAnchor(0, r.range, e.event.posx, e.event.posy));
				break;
			}
		}
		return n.sort((e, n) => n.priority - e.priority), n;
	}
	_onMouseLeave(e) {
		let n = this._editor.getDomNode();
		(!n || !isMousePositionWithinElement(n, e.x, e.y)) && this.hide();
	}
	startShowingAtRange(e, n, r, i) {
		this._startShowingOrUpdateHover(new HoverRangeAnchor(0, e, void 0, void 0), n, r, i, null);
	}
	async updateHoverVerbosityLevel(e, n, r) {
		this._renderedContentHover?.updateHoverVerbosityLevel(e, n, r);
	}
	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, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$73 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, ContentHoverController_1, ContentHoverController = class extends Disposable {
	static {
		ContentHoverController_1 = this;
	}
	static {
		this.ID = "editor.contrib.contentHover";
	}
	constructor(e, n, r) {
		super(), this._editor = e, this._instantiationService = n, this._keybindingService = r, 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 n = this._contentWidget?.getDomNode();
		return n ? isMousePositionWithinElement(n, 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 n = this._hoverSettings.sticky;
		return ((e, n) => {
			let r = this._isMouseOnContentHoverWidget(e);
			return n && r;
		})(e, n) || ((e) => {
			let n = this._isMouseOnContentHoverWidget(e), r = this._contentWidget?.isColorPickerVisible ?? !1;
			return n && r;
		})(e) || ((e, n) => (n && this._contentWidget?.containsNode(e.event.browserEvent.view?.document.activeElement) && !e.event.browserEvent.view?.getSelection()?.isCollapsed) ?? !1)(e, n);
	}
	_onEditorMouseMove(e) {
		if (this.shouldKeepOpenOnEditorMouseMoveOrLeave || (this._mouseMoveEvent = e, this._contentWidget?.isFocused || this._contentWidget?.isResizing)) return;
		let n = this._hoverSettings.sticky;
		if (n && this._contentWidget?.isVisibleFromKeyboard) return;
		if (this._shouldNotRecomputeCurrentHoverWidget(e)) {
			this._reactToEditorMouseMoveRunner.cancel();
			return;
		}
		let r = this._hoverSettings.hidingDelay;
		if (this._contentWidget?.isVisible && n && r > 0) {
			this._reactToEditorMouseMoveRunner.isScheduled() || this._reactToEditorMouseMoveRunner.schedule(r);
			return;
		}
		this._reactToEditorMouseMove(e);
	}
	_reactToEditorMouseMove(e) {
		if (!e) return;
		let n = e.target.element?.classList.contains("colorpicker-color-decoration"), r = this._editor.getOption(149), i = this._hoverSettings.enabled, a = this._hoverState.activatedByDecoratorClick;
		if (n && (r === "click" && !a || r === "hover" && !i || r === "clickAndHover" && !i && !a) || !n && !i && !a) {
			this._hideWidgets();
			return;
		}
		this._tryShowHoverWidget(e) || this._hideWidgets();
	}
	_tryShowHoverWidget(e) {
		return this._getOrCreateContentWidget().showsOrWillShow(e);
	}
	_onKeyDown(e) {
		if (!this._editor.hasModel()) return;
		let n = this._keybindingService.softDispatch(e, this._editor.getDomNode()), r = n.kind === 1 || n.kind === 2 && (n.commandId === "editor.action.showHover" || n.commandId === "editor.action.increaseHoverVerbosityLevel" || n.commandId === "editor.action.decreaseHoverVerbosityLevel") && this._contentWidget?.isVisible;
		e.keyCode === 5 || e.keyCode === 6 || e.keyCode === 57 || e.keyCode === 4 || r || 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, n, r, i, a = !1) {
		this._hoverState.activatedByDecoratorClick = a, this._getOrCreateContentWidget().startShowingAtRange(e, n, r, i);
	}
	_isContentWidgetResizing() {
		return this._contentWidget?.widget.isResizing || !1;
	}
	focusedHoverPartIndex() {
		return this._getOrCreateContentWidget().focusedHoverPartIndex();
	}
	updateHoverVerbosityLevel(e, n, r) {
		this._getOrCreateContentWidget().updateHoverVerbosityLevel(e, n, r);
	}
	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 n = this._editor.getOption(149);
		if (n !== "click" && n !== "clickAndHover") return;
		let r = e.target;
		if (r.type !== 6 || !r.detail.injectedText || r.detail.injectedText.options.attachedData !== ColorDecorationInjectedTextMarker || !r.range) return;
		let i = this._editor.getContribution(ContentHoverController.ID);
		if (i && !i.isColorPickerVisible) {
			let e = new Range(r.range.startLineNumber, r.range.startColumn + 1, r.range.endLineNumber, r.range.endColumn + 1);
			i.showContentHover(e, 1, 0, !1, !0);
		}
	}
};
registerEditorContribution(ColorContribution.ID, ColorContribution, 2), HoverParticipantRegistry.register(ColorHoverParticipant);
var __decorate$72 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$72 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, StandaloneColorPickerController_1, StandaloneColorPickerWidget_1, StandaloneColorPickerController = class extends Disposable {
	static {
		StandaloneColorPickerController_1 = this;
	}
	static {
		this.ID = "editor.contrib.standaloneColorPickerController";
	}
	constructor(e, n, r) {
		super(), this._editor = e, this._instantiationService = r, this._standaloneColorPickerWidget = null, this._standaloneColorPickerVisible = EditorContextKeys.standaloneColorPickerVisible.bindTo(n), this._standaloneColorPickerFocused = EditorContextKeys.standaloneColorPickerFocused.bindTo(n);
	}
	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, n, r, i, a, o, s) {
		super(), this._editor = e, this._standaloneColorPickerVisible = n, this._standaloneColorPickerFocused = r, this._keybindingService = a, this._languageFeaturesService = o, this._editorWorkerService = s, 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 = i.createInstance(StandaloneColorPickerParticipant, this._editor), this._position = this._editor._getViewModel()?.getPrimaryCursorState().modelState.position;
		let c = this._editor.getSelection(), l = c ? {
			startLineNumber: c.startLineNumber,
			startColumn: c.startColumn,
			endLineNumber: c.endLineNumber,
			endColumn: c.endColumn
		} : {
			startLineNumber: 0,
			endLineNumber: 0,
			endColumn: 0,
			startColumn: 0
		}, u = this._register(trackFocus(this._body));
		this._register(u.onDidBlur((e) => {
			this.hide();
		})), this._register(u.onDidFocus((e) => {
			this.focus();
		})), this._register(this._editor.onDidChangeCursorPosition(() => {
			this._selectionSetInEditor ? this._selectionSetInEditor = !1 : this.hide();
		})), this._register(this._editor.onMouseMove((e) => {
			let n = e.target.element?.classList;
			n && n.contains("colorpicker-color-decoration") && this.hide();
		})), this._register(this.onResult((e) => {
			this._render(e.value, e.foundInEditor);
		})), this._start(l), 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 n = await this._computeAsync(e);
		n && this._onResult.fire(new StandaloneColorPickerResult(n.result, n.foundInEditor));
	}
	async _computeAsync(e) {
		if (!this._editor.hasModel()) return null;
		let n = {
			range: e,
			color: {
				red: 0,
				green: 0,
				blue: 0,
				alpha: 1
			}
		}, r = await this._standaloneColorPickerParticipant.createColorHover(n, new DefaultDocumentColorProvider(this._editorWorkerService), this._languageFeaturesService.colorProvider);
		return r ? {
			result: r.colorHover,
			foundInEditor: r.foundInEditor
		} : null;
	}
	_render(e, n) {
		let r = document.createDocumentFragment(), i = this._register(new EditorHoverStatusBar(this._keybindingService)), a = {
			fragment: r,
			statusBar: i,
			onContentsChanged: () => {},
			hide: () => this.hide()
		};
		this._colorHover = e;
		let o = this._standaloneColorPickerParticipant.renderHoverParts(a, [e]);
		if (!o) return;
		this._register(o.disposables);
		let s = o.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(r), s.layout();
		let c = s.body, l = c.saturationBox.domNode.clientWidth, u = c.domNode.clientWidth - l - CLOSE_BUTTON_WIDTH - PADDING, d = s.body.enterButton;
		d?.onClicked(() => {
			this.updateEditor(), this.hide();
		});
		let f = s.header, m = f.pickedColorNode;
		m.style.width = l + PADDING + "px";
		let g = f.originalColorNode;
		g.style.width = u + "px", s.header.closeButton?.onClicked(() => {
			this.hide();
		}), n && (d && (d.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, n) {
		this.value = e, this.foundInEditor = n;
	}
}, 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, n) {
		StandaloneColorPickerController.get(n)?.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, n) {
		StandaloneColorPickerController.get(n)?.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, n) {
		StandaloneColorPickerController.get(n)?.insertColor();
	}
};
registerEditorAction(HideStandaloneColorPicker), registerEditorAction(InsertColorWithStandaloneColorPicker), registerAction2(ShowOrFocusStandaloneColorPicker);
var BlockCommentCommand = class e {
	constructor(e, n, r) {
		this.languageConfigurationService = r, this._selection = e, this._insertSpace = n, this._usedEndToken = null;
	}
	static _haystackHasNeedleAtOffset(e, n, r) {
		if (r < 0) return !1;
		let i = n.length, a = e.length;
		if (r + i > a) return !1;
		for (let a = 0; a < i; a++) {
			let i = e.charCodeAt(r + a), o = n.charCodeAt(a);
			if (i !== o && !(i >= 65 && i <= 90 && i + 32 === o) && !(o >= 65 && o <= 90 && o + 32 === i)) return !1;
		}
		return !0;
	}
	_createOperationsForBlockComment(n, r, i, a, o, s) {
		let c = n.startLineNumber, l = n.startColumn, u = n.endLineNumber, d = n.endColumn, f = o.getLineContent(c), m = o.getLineContent(u), g = f.lastIndexOf(r, l - 1 + r.length), _ = m.indexOf(i, d - 1 - i.length);
		if (g !== -1 && _ !== -1) if (c === u) f.substring(g + r.length, _).indexOf(i) >= 0 && (g = -1, _ = -1);
		else {
			let e = f.substring(g + r.length), n = m.substring(0, _);
			(e.indexOf(i) >= 0 || n.indexOf(i) >= 0) && (g = -1, _ = -1);
		}
		let v;
		g !== -1 && _ !== -1 ? (a && g + r.length < f.length && f.charCodeAt(g + r.length) === 32 && (r += " "), a && _ > 0 && m.charCodeAt(_ - 1) === 32 && (i = " " + i, --_), v = e._createRemoveBlockCommentOperations(new Range(c, g + r.length + 1, u, _ + 1), r, i)) : (v = e._createAddBlockCommentOperations(n, r, i, this._insertSpace), this._usedEndToken = v.length === 1 ? i : null);
		for (let e of v) s.addTrackedEditOperation(e.range, e.text);
	}
	static _createRemoveBlockCommentOperations(e, n, r) {
		let i = [];
		return Range.isEmpty(e) ? i.push(EditOperation.delete(new Range(e.startLineNumber, e.startColumn - n.length, e.endLineNumber, e.endColumn + r.length))) : (i.push(EditOperation.delete(new Range(e.startLineNumber, e.startColumn - n.length, e.startLineNumber, e.startColumn))), i.push(EditOperation.delete(new Range(e.endLineNumber, e.endColumn, e.endLineNumber, e.endColumn + r.length)))), i;
	}
	static _createAddBlockCommentOperations(e, n, r, i) {
		let a = [];
		return Range.isEmpty(e) ? a.push(EditOperation.replace(new Range(e.startLineNumber, e.startColumn, e.endLineNumber, e.endColumn), n + "  " + r)) : (a.push(EditOperation.insert(new Position(e.startLineNumber, e.startColumn), n + (i ? " " : ""))), a.push(EditOperation.insert(new Position(e.endLineNumber, e.endColumn), (i ? " " : "") + r))), a;
	}
	getEditOperations(e, n) {
		let r = this._selection.startLineNumber, i = this._selection.startColumn;
		e.tokenization.tokenizeIfCheap(r);
		let a = e.getLanguageIdAtPosition(r, i), o = this.languageConfigurationService.getLanguageConfiguration(a).comments;
		!o || !o.blockCommentStartToken || !o.blockCommentEndToken || this._createOperationsForBlockComment(this._selection, o.blockCommentStartToken, o.blockCommentEndToken, this._insertSpace, e, n);
	}
	computeCursorState(e, n) {
		let r = n.getInverseEditOperations();
		if (r.length === 2) {
			let e = r[0], n = r[1];
			return new Selection(e.range.endLineNumber, e.range.endColumn, n.range.startLineNumber, n.range.startColumn);
		} else {
			let e = r[0].range, n = this._usedEndToken ? -this._usedEndToken.length - 1 : 0;
			return new Selection(e.endLineNumber, e.endColumn + n, e.endLineNumber, e.endColumn + n);
		}
	}
}, LineCommentCommand = class e {
	constructor(e, n, r, i, a, o, s) {
		this.languageConfigurationService = e, this._selection = n, this._indentSize = r, this._type = i, this._insertSpace = a, this._selectionId = null, this._deltaColumn = 0, this._moveEndPositionDown = !1, this._ignoreEmptyLines = o, this._ignoreFirstLine = s || !1;
	}
	static _gatherPreflightCommentStrings(e, n, r, i) {
		e.tokenization.tokenizeIfCheap(n);
		let a = e.getLanguageIdAtPosition(n, 1), o = i.getLanguageConfiguration(a).comments, s = o ? o.lineCommentToken : null;
		if (!s) return null;
		let c = [];
		for (let e = 0, i = r - n + 1; e < i; e++) c[e] = {
			ignore: !1,
			commentStr: s,
			commentStrOffset: 0,
			commentStrLength: s.length
		};
		return c;
	}
	static _analyzeLines(e, n, r, i, a, o, s, c) {
		let l = !0, u;
		u = e === 0 ? !0 : e !== 1;
		for (let c = 0, d = i.length; c < d; c++) {
			let d = i[c], f = a + c;
			if (f === a && s) {
				d.ignore = !0;
				continue;
			}
			let m = r.getLineContent(f), g = firstNonWhitespaceIndex(m);
			if (g === -1) {
				d.ignore = o, d.commentStrOffset = m.length;
				continue;
			}
			if (l = !1, d.ignore = !1, d.commentStrOffset = g, u && !BlockCommentCommand._haystackHasNeedleAtOffset(m, d.commentStr, g) && (e === 0 ? u = !1 : e === 1 || (d.ignore = !0)), u && n) {
				let e = g + d.commentStrLength;
				e < m.length && m.charCodeAt(e) === 32 && (d.commentStrLength += 1);
			}
		}
		if (e === 0 && l) {
			u = !1;
			for (let e = 0, n = i.length; e < n; e++) i[e].ignore = !1;
		}
		return {
			supported: !0,
			shouldRemoveComments: u,
			lines: i
		};
	}
	static _gatherPreflightData(n, r, i, a, o, s, c, l) {
		let u = e._gatherPreflightCommentStrings(i, a, o, l);
		return u === null ? { supported: !1 } : e._analyzeLines(n, r, i, u, a, s, c, l);
	}
	_executeLineComments(n, r, i, a) {
		let o;
		i.shouldRemoveComments ? o = e._createRemoveLineCommentsOperations(i.lines, a.startLineNumber) : (e._normalizeInsertionPoint(n, i.lines, a.startLineNumber, this._indentSize), o = this._createAddLineCommentsOperations(i.lines, a.startLineNumber));
		let s = new Position(a.positionLineNumber, a.positionColumn);
		for (let e = 0, i = o.length; e < i; e++) r.addEditOperation(o[e].range, o[e].text), Range.isEmpty(o[e].range) && Range.getStartPosition(o[e].range).equals(s) && n.getLineContent(s.lineNumber).length + 1 === s.column && (this._deltaColumn = (o[e].text || "").length);
		this._selectionId = r.trackSelection(a);
	}
	_attemptRemoveBlockComment(e, n, r, i) {
		let a = n.startLineNumber, o = n.endLineNumber, s = i.length + Math.max(e.getLineFirstNonWhitespaceColumn(n.startLineNumber), n.startColumn), c = e.getLineContent(a).lastIndexOf(r, s - 1), l = e.getLineContent(o).indexOf(i, n.endColumn - 1 - r.length);
		return c !== -1 && l === -1 && (l = e.getLineContent(a).indexOf(i, c + r.length), o = a), c === -1 && l !== -1 && (c = e.getLineContent(o).lastIndexOf(r, l), a = o), n.isEmpty() && (c === -1 || l === -1) && (c = e.getLineContent(a).indexOf(r), c !== -1 && (l = e.getLineContent(a).indexOf(i, c + r.length))), c !== -1 && e.getLineContent(a).charCodeAt(c + r.length) === 32 && (r += " "), l !== -1 && e.getLineContent(o).charCodeAt(l - 1) === 32 && (i = " " + i, --l), c !== -1 && l !== -1 ? BlockCommentCommand._createRemoveBlockCommentOperations(new Range(a, c + r.length + 1, o, l + 1), r, i) : null;
	}
	_executeBlockComment(e, n, r) {
		e.tokenization.tokenizeIfCheap(r.startLineNumber);
		let i = e.getLanguageIdAtPosition(r.startLineNumber, 1), a = this.languageConfigurationService.getLanguageConfiguration(i).comments;
		if (!a || !a.blockCommentStartToken || !a.blockCommentEndToken) return;
		let o = a.blockCommentStartToken, s = a.blockCommentEndToken, c = this._attemptRemoveBlockComment(e, r, o, s);
		if (!c) {
			if (r.isEmpty()) {
				let n = e.getLineContent(r.startLineNumber), i = firstNonWhitespaceIndex(n);
				i === -1 && (i = n.length), c = BlockCommentCommand._createAddBlockCommentOperations(new Range(r.startLineNumber, i + 1, r.startLineNumber, n.length + 1), o, s, this._insertSpace);
			} else c = BlockCommentCommand._createAddBlockCommentOperations(new Range(r.startLineNumber, e.getLineFirstNonWhitespaceColumn(r.startLineNumber), r.endLineNumber, e.getLineMaxColumn(r.endLineNumber)), o, s, this._insertSpace);
			c.length === 1 && (this._deltaColumn = o.length + 1);
		}
		this._selectionId = n.trackSelection(r);
		for (let e of c) n.addEditOperation(e.range, e.text);
	}
	getEditOperations(n, r) {
		let i = this._selection;
		if (this._moveEndPositionDown = !1, i.startLineNumber === i.endLineNumber && this._ignoreFirstLine) {
			r.addEditOperation(new Range(i.startLineNumber, n.getLineMaxColumn(i.startLineNumber), i.startLineNumber + 1, 1), i.startLineNumber === n.getLineCount() ? "" : "\n"), this._selectionId = r.trackSelection(i);
			return;
		}
		i.startLineNumber < i.endLineNumber && i.endColumn === 1 && (this._moveEndPositionDown = !0, i = i.setEndPosition(i.endLineNumber - 1, n.getLineMaxColumn(i.endLineNumber - 1)));
		let a = e._gatherPreflightData(this._type, this._insertSpace, n, i.startLineNumber, i.endLineNumber, this._ignoreEmptyLines, this._ignoreFirstLine, this.languageConfigurationService);
		return a.supported ? this._executeLineComments(n, r, a, i) : this._executeBlockComment(n, r, i);
	}
	computeCursorState(e, n) {
		let r = n.getTrackedSelection(this._selectionId);
		return this._moveEndPositionDown && (r = r.setEndPosition(r.endLineNumber + 1, 1)), new Selection(r.selectionStartLineNumber, r.selectionStartColumn + this._deltaColumn, r.positionLineNumber, r.positionColumn + this._deltaColumn);
	}
	static _createRemoveLineCommentsOperations(e, n) {
		let r = [];
		for (let i = 0, a = e.length; i < a; i++) {
			let a = e[i];
			a.ignore || r.push(EditOperation.delete(new Range(n + i, a.commentStrOffset + 1, n + i, a.commentStrOffset + a.commentStrLength + 1)));
		}
		return r;
	}
	_createAddLineCommentsOperations(e, n) {
		let r = [], i = this._insertSpace ? " " : "";
		for (let a = 0, o = e.length; a < o; a++) {
			let o = e[a];
			o.ignore || r.push(EditOperation.insert(new Position(n + a, o.commentStrOffset + 1), o.commentStr + i));
		}
		return r;
	}
	static nextVisibleColumn(e, n, r, i) {
		return r ? e + (n - e % n) : e + i;
	}
	static _normalizeInsertionPoint(n, r, i, a) {
		let o = 1073741824, s, c;
		for (let s = 0, c = r.length; s < c; s++) {
			if (r[s].ignore) continue;
			let c = n.getLineContent(i + s), l = 0;
			for (let n = 0, i = r[s].commentStrOffset; l < o && n < i; n++) l = e.nextVisibleColumn(l, a, c.charCodeAt(n) === 9, 1);
			l < o && (o = l);
		}
		o = Math.floor(o / a) * a;
		for (let l = 0, u = r.length; l < u; l++) {
			if (r[l].ignore) continue;
			let u = n.getLineContent(i + l), d = 0;
			for (s = 0, c = r[l].commentStrOffset; d < o && s < c; s++) d = e.nextVisibleColumn(d, a, u.charCodeAt(s) === 9, 1);
			d > o ? r[l].commentStrOffset = s - 1 : r[l].commentStrOffset = s;
		}
	}
}, CommentLineAction = class extends EditorAction {
	constructor(e, n) {
		super(n), this._type = e;
	}
	run(e, n) {
		let r = e.get(ILanguageConfigurationService);
		if (!n.hasModel()) return;
		let i = n.getModel(), a = [], o = i.getOptions(), s = n.getOption(23), c = n.getSelections().map((e, n) => ({
			selection: e,
			index: n,
			ignoreFirstLine: !1
		}));
		c.sort((e, n) => Range.compareRangesUsingStarts(e.selection, n.selection));
		let l = c[0];
		for (let e = 1; e < c.length; e++) {
			let n = c[e];
			l.selection.endLineNumber === n.selection.startLineNumber && (l.index < n.index ? n.ignoreFirstLine = !0 : (l.ignoreFirstLine = !0, l = n));
		}
		for (let e of c) a.push(new LineCommentCommand(r, e.selection, o.indentSize, this._type, s.insertSpace, s.ignoreEmptyLines, e.ignoreFirstLine));
		n.pushUndoStop(), n.executeCommands(this.id, a), n.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, n) {
		let r = e.get(ILanguageConfigurationService);
		if (!n.hasModel()) return;
		let i = n.getOption(23), a = [], o = n.getSelections();
		for (let e of o) a.push(new BlockCommentCommand(e, i.insertSpace, r));
		n.pushUndoStop(), n.executeCommands(this.id, a), n.pushUndoStop();
	}
};
registerEditorAction(ToggleCommentLineAction), registerEditorAction(AddLineCommentAction), registerEditorAction(RemoveLineCommentAction), registerEditorAction(BlockCommentAction);
var __decorate$71 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$71 = function(e, n) {
	return function(r, i) {
		n(r, i, 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, n, r, i, a, o, s, c) {
		this._contextMenuService = n, this._contextViewService = r, this._contextKeyService = i, this._keybindingService = a, this._menuService = o, this._configurationService = s, this._workspaceContextService = c, 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 n = this._contextViewService.getContextViewElement(), r = e.srcElement;
				r.shadowRoot && getShadowRoot(n) === r.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 n = !1;
			for (let r of this._editor.getSelections()) if (r.containsPosition(e.target.position)) {
				n = !0;
				break;
			}
			n || this._editor.setPosition(e.target.position);
		}
		let n = null;
		e.target.type !== 1 && (n = e.event), this.showContextMenu(n);
	}
	showContextMenu(e) {
		if (!this._editor.getOption(24) || !this._editor.hasModel()) return;
		let n = this._getMenuActions(this._editor.getModel(), this._editor.contextMenuId);
		n.length > 0 && this._doShowContextMenu(n, e);
	}
	_getMenuActions(e, n) {
		let r = [], i = this._menuService.getMenuActions(n, this._contextKeyService, { arg: e.uri });
		for (let n of i) {
			let [, i] = n, a = 0;
			for (let n of i) if (n instanceof SubmenuItemAction) {
				let i = this._getMenuActions(e, n.item.submenu);
				i.length > 0 && (r.push(new SubmenuAction(n.id, n.label, i)), a++);
			} else r.push(n), a++;
			a && r.push(new Separator());
		}
		return r.length && r.pop(), r;
	}
	_doShowContextMenu(e, n = null) {
		if (!this._editor.hasModel()) return;
		let r = this._editor.getOption(60);
		this._editor.updateOptions({ hover: { enabled: !1 } });
		let i = n;
		if (!i) {
			this._editor.revealPosition(this._editor.getPosition(), 1), this._editor.render();
			let e = this._editor.getScrolledVisiblePosition(this._editor.getPosition()), n = getDomNodePagePosition(this._editor.getDomNode()), r = n.left + e.left, a = n.top + e.top + e.height;
			i = {
				x: r,
				y: a
			};
		}
		let a = this._editor.getOption(128) && !isIOS;
		this._contextMenuIsBeingShownCount++, this._contextMenuService.showContextMenu({
			domForShadowRoot: a ? this._editor.getOverflowWidgetsDomNode() ?? this._editor.getDomNode() : void 0,
			getAnchor: () => i,
			getActions: () => e,
			getActionViewItem: (e) => {
				let n = this._keybindingFor(e);
				if (n) return new ActionViewItem(e, e, {
					label: !0,
					keybinding: n.getLabel(),
					isMenu: !0
				});
				let r = e;
				return typeof r.getActionViewItem == "function" ? r.getActionViewItem() : new ActionViewItem(e, e, {
					icon: !0,
					label: !0,
					isMenu: !0
				});
			},
			getKeyBinding: (e) => this._keybindingFor(e),
			onHide: (e) => {
				this._contextMenuIsBeingShownCount--, this._editor.updateOptions({ hover: r });
			}
		});
	}
	_showScrollbarContextMenu(e) {
		if (!this._editor.hasModel() || isStandaloneEditorWorkspace(this._workspaceContextService.getWorkspace())) return;
		let n = this._editor.getOption(73), r = 0, i = (e) => ({
			id: `menu-action-${++r}`,
			label: e.label,
			tooltip: "",
			class: void 0,
			enabled: e.enabled === void 0 ? !0 : e.enabled,
			checked: e.checked,
			run: e.run
		}), a = (e, n) => new SubmenuAction(`menu-action-${++r}`, e, n, void 0), o = (e, n, r, o, s) => {
			if (!n) return i({
				label: e,
				enabled: n,
				run: () => {}
			});
			let c = (e) => () => {
				this._configurationService.updateValue(r, e);
			}, l = [];
			for (let e of s) l.push(i({
				label: e.label,
				checked: o === e.value,
				run: c(e.value)
			}));
			return a(e, l);
		}, s = [];
		s.push(i({
			label: localize("context.minimap.minimap", "Minimap"),
			checked: n.enabled,
			run: () => {
				this._configurationService.updateValue("editor.minimap.enabled", !n.enabled);
			}
		})), s.push(new Separator()), s.push(i({
			label: localize("context.minimap.renderCharacters", "Render Characters"),
			enabled: n.enabled,
			checked: n.renderCharacters,
			run: () => {
				this._configurationService.updateValue("editor.minimap.renderCharacters", !n.renderCharacters);
			}
		})), s.push(o(localize("context.minimap.size", "Vertical size"), n.enabled, "editor.minimap.size", n.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"
			}
		])), s.push(o(localize("context.minimap.slider", "Slider"), n.enabled, "editor.minimap.showSlider", n.showSlider, [{
			label: localize("context.minimap.slider.mouseover", "Mouse Over"),
			value: "mouseover"
		}, {
			label: localize("context.minimap.slider.always", "Always"),
			value: "always"
		}]));
		let c = this._editor.getOption(128) && !isIOS;
		this._contextMenuIsBeingShownCount++, this._contextMenuService.showContextMenu({
			domForShadowRoot: c ? this._editor.getDomNode() : void 0,
			getAnchor: () => e,
			getActions: () => s,
			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, n) {
		ContextMenuController.get(n)?.showContextMenu();
	}
};
registerEditorContribution(ContextMenuController.ID, ContextMenuController, 2), registerEditorAction(ShowContextMenu);
var CursorState$1 = class {
	constructor(e) {
		this.selections = e;
	}
	equals(e) {
		let n = this.selections.length, r = e.selections.length;
		if (n !== r) return !1;
		for (let r = 0; r < n; r++) if (!this.selections[r].equalsSelection(e.selections[r])) return !1;
		return !0;
	}
}, StackElement = class {
	constructor(e, n, r) {
		this.cursorState = e, this.scrollTop = n, this.scrollLeft = r;
	}
}, CursorUndoRedoController = class e extends Disposable {
	static {
		this.ID = "editor.contrib.cursorUndoRedoController";
	}
	static get(n) {
		return n.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((n) => {
			if (this._isCursorUndoRedo || !n.oldSelections || n.oldModelVersionId !== n.modelVersionId) return;
			let r = new CursorState$1(n.oldSelections);
			this._undoStack.length > 0 && this._undoStack[this._undoStack.length - 1].cursorState.equals(r) || (this._undoStack.push(new StackElement(r, 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, n, r) {
		CursorUndoRedoController.get(n)?.cursorUndo();
	}
}, CursorRedo = class extends EditorAction {
	constructor() {
		super({
			id: "cursorRedo",
			label: localize("cursor.redo", "Cursor Redo"),
			alias: "Cursor Redo",
			precondition: void 0
		});
	}
	run(e, n, r) {
		CursorUndoRedoController.get(n)?.cursorRedo();
	}
};
registerEditorContribution(CursorUndoRedoController.ID, CursorUndoRedoController, 0), registerEditorAction(CursorUndo), registerEditorAction(CursorRedo);
var DragAndDropCommand = class {
	constructor(e, n, r) {
		this.selection = e, this.targetPosition = n, this.copy = r, this.targetSelection = null;
	}
	getEditOperations(e, n) {
		let r = e.getValueInRange(this.selection);
		if (this.copy || n.addEditOperation(this.selection, null), n.addEditOperation(new Range(this.targetPosition.lineNumber, this.targetPosition.column, this.targetPosition.lineNumber, this.targetPosition.column), r), 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, n) {
		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(n) {
		!this._editor.getOption(35) || this._editor.getOption(22) || (hasTriggerModifier(n) && (this._modifierPressed = !1), this._mouseDown && n.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 n = e.target;
		if (this._dragSelection === null) {
			let e = (this._editor.getSelections() || []).filter((e) => n.position && e.containsPosition(n.position));
			if (e.length === 1) this._dragSelection = e[0];
			else return;
		}
		hasTriggerModifier(e.event) ? this._editor.updateOptions({ mouseStyle: "copy" }) : this._editor.updateOptions({ mouseStyle: "default" }), n.position && (this._dragSelection.containsPosition(n.position) ? this._removeDecoration() : this.showAt(n.position));
	}
	_onEditorMouseDropCanceled() {
		this._editor.updateOptions({ mouseStyle: "text" }), this._removeDecoration(), this._dragSelection = null, this._mouseDown = !1;
	}
	_onEditorMouseDrop(n) {
		if (n.target && (this._hitContent(n.target) || this._hitMargin(n.target)) && n.target.position) {
			let r = new Position(n.target.position.lineNumber, n.target.position.column);
			if (this._dragSelection === null) {
				let e = null;
				if (n.event.shiftKey) {
					let n = this._editor.getSelection();
					if (n) {
						let { selectionStartLineNumber: i, selectionStartColumn: a } = n;
						e = [new Selection(i, a, r.lineNumber, r.column)];
					}
				} else e = (this._editor.getSelections() || []).map((e) => e.containsPosition(r) ? new Selection(r.lineNumber, r.column, r.lineNumber, r.column) : e);
				this._editor.setSelections(e || [], "mouse", 3);
			} else (!this._dragSelection.containsPosition(r) || (hasTriggerModifier(n.event) || this._modifierPressed) && (this._dragSelection.getEndPosition().equals(r) || this._dragSelection.getStartPosition().equals(r))) && (this._editor.pushUndoStop(), this._editor.executeCommand(e.ID, new DragAndDropCommand(this._dragSelection, r, hasTriggerModifier(n.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(n) {
		this._dndDecorationIds.set([{
			range: new Range(n.lineNumber, n.column, n.lineNumber, n.column),
			options: e._DECORATION_OPTIONS
		}]), this._editor.revealPosition(n, 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, n) {
		return CopyPasteController.get(n)?.changePasteType();
	}
}()), registerEditorCommand(new class extends EditorCommand {
	constructor() {
		super({
			id: "editor.hidePasteWidget",
			precondition: pasteWidgetVisibleCtx,
			kbOpts: {
				weight: 100,
				primary: 9
			}
		});
	}
	runEditorCommand(e, n) {
		CopyPasteController.get(n)?.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, n, r) {
		let i = typeof r?.kind == "string" ? r.kind : void 0;
		return !i && r && (i = typeof r.id == "string" ? r.id : void 0), CopyPasteController.get(n)?.pasteAs(i ? new HierarchicalKind(i) : 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, n) {
		return CopyPasteController.get(n)?.pasteAs({ providerId: DefaultTextPasteOrDropEditProvider.id });
	}
});
var TreeViewsDnDService = class {
	constructor() {
		this._dragOperations = /* @__PURE__ */ new Map();
	}
	removeDragOperationTransfer(e) {
		if (e && this._dragOperations.has(e)) {
			let n = this._dragOperations.get(e);
			return this._dragOperations.delete(e), n;
		}
	}
}, DraggedTreeItemsIdentifier = class {
	constructor(e) {
		this.identifier = e;
	}
};
const ITreeViewsDnDService = createDecorator("treeViewsDndService");
registerSingleton(ITreeViewsDnDService, TreeViewsDnDService, 1);
var __decorate$70 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$70 = function(e, n) {
	return function(r, i) {
		n(r, i, 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, n, r, i, a) {
		super(), this._configService = r, this._languageFeaturesService = i, this._treeViewsDragAndDropService = a, this.treeItemsTransfer = LocalSelectionTransfer.getInstance(), this._dropProgressManager = this._register(n.createInstance(InlineProgressManager, "dropIntoEditor", e)), this._postDropWidgetManager = this._register(n.createInstance(PostEditWidgetManager, "dropIntoEditor", e, dropWidgetVisibleCtx, {
			id: changeDropTypeCommandId,
			label: localize("postDropWidgetTitle", "Show drop options...")
		})), this._register(e.onDropIntoEditor((n) => this.onDropIntoEditor(e, n.position, n.event)));
	}
	clearWidgets() {
		this._postDropWidgetManager.clear();
	}
	changeDropType() {
		this._postDropWidgetManager.tryShowSelector();
	}
	async onDropIntoEditor(e, n, r) {
		if (!r.dataTransfer || !e.hasModel()) return;
		this._currentOperation?.cancel(), e.focus(), e.setPosition(n);
		let i = createCancelablePromise(async (a) => {
			let o = new DisposableStore(), s = o.add(new EditorStateCancellationTokenSource(e, 1, void 0, a));
			try {
				let i = await this.extractDataTransferData(r);
				if (i.size === 0 || s.token.isCancellationRequested) return;
				let c = e.getModel();
				if (!c) return;
				let l = this._languageFeaturesService.documentDropEditProvider.ordered(c).filter((e) => e.dropMimeTypes ? e.dropMimeTypes.some((e) => i.matches(e)) : !0), u = o.add(await this.getDropEdits(l, c, n, i, s));
				if (s.token.isCancellationRequested) return;
				if (u.edits.length) {
					let r = this.getInitialActiveEditIndex(c, u.edits), i = e.getOption(36).showDropSelector === "afterDrop";
					await this._postDropWidgetManager.applyEditAndShowIfNeeded([Range.fromPositions(n)], {
						activeEditIndex: r,
						allEdits: u.edits
					}, i, async (e) => e, a);
				}
			} finally {
				o.dispose(), this._currentOperation === i && (this._currentOperation = void 0);
			}
		});
		this._dropProgressManager.showWhile(n, localize("dropIntoEditorProgress", "Running drop handlers. Click to cancel"), i, { cancel: () => i.cancel() }), this._currentOperation = i;
	}
	async getDropEdits(e, n, r, i, a) {
		let o = new DisposableStore(), s = await raceCancellation(Promise.all(e.map(async (e) => {
			try {
				let s = await e.provideDocumentDropEdits(n, r, i, a.token);
				return s && o.add(s), s?.edits.map((n) => ({
					...n,
					providerId: e.id
				}));
			} catch (e) {
				console.error(e);
			}
		})), a.token), c = coalesce(s ?? []).flat();
		return {
			edits: sortEditsByYieldTo(c),
			dispose: () => o.dispose()
		};
	}
	getInitialActiveEditIndex(e, n) {
		let r = this._configService.getValue(defaultProviderConfig, { resource: e.uri });
		for (let [e, i] of Object.entries(r)) {
			let r = new HierarchicalKind(i), a = n.findIndex((n) => r.value === n.providerId && n.handledMimeType && matchesMimeType(e, [n.handledMimeType]));
			if (a >= 0) return a;
		}
		return 0;
	}
	async extractDataTransferData(e) {
		if (!e.dataTransfer) return new VSDataTransfer();
		let n = toExternalVSDataTransfer(e.dataTransfer);
		if (this.treeItemsTransfer.hasData(DraggedTreeItemsIdentifier.prototype)) {
			let e = this.treeItemsTransfer.getData(DraggedTreeItemsIdentifier.prototype);
			if (Array.isArray(e)) for (let r of e) {
				let e = await this._treeViewsDragAndDropService.removeDragOperationTransfer(r.identifier);
				if (e) for (let [r, i] of e) n.replace(r, i);
			}
		}
		return n;
	}
};
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, n, r) {
		DropIntoEditorController.get(n)?.changeDropType();
	}
}()), registerEditorCommand(new class extends EditorCommand {
	constructor() {
		super({
			id: "editor.hideDropWidget",
			precondition: dropWidgetVisibleCtx,
			kbOpts: {
				weight: 100,
				primary: 9
			}
		});
	}
	runEditorCommand(e, n, r) {
		DropIntoEditorController.get(n)?.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 n = this._decorations.indexOf(e);
		return n >= 0 ? n + 1 : 1;
	}
	getDecorationRangeAt(e) {
		let n = e < this._decorations.length ? this._decorations[e] : null;
		return n ? this._editor.getModel().getDecorationRange(n) : null;
	}
	getCurrentMatchesPosition(n) {
		let r = this._editor.getModel().getDecorationsInRange(n);
		for (let n of r) {
			let r = n.options;
			if (r === e._FIND_MATCH_DECORATION || r === e._CURRENT_FIND_MATCH_DECORATION) return this._getDecorationIndex(n.id);
		}
		return 0;
	}
	setCurrentFindMatch(n) {
		let r = null, i = 0;
		if (n) for (let e = 0, a = this._decorations.length; e < a; e++) {
			let a = this._editor.getModel().getDecorationRange(this._decorations[e]);
			if (n.equalsRange(a)) {
				r = this._decorations[e], i = e + 1;
				break;
			}
		}
		return (this._highlightedDecorationId !== null || r !== null) && this._editor.changeDecorations((n) => {
			if (this._highlightedDecorationId !== null && (n.changeDecorationOptions(this._highlightedDecorationId, e._FIND_MATCH_DECORATION), this._highlightedDecorationId = null), r !== null && (this._highlightedDecorationId = r, n.changeDecorationOptions(this._highlightedDecorationId, e._CURRENT_FIND_MATCH_DECORATION)), this._rangeHighlightDecorationId !== null && (n.removeDecoration(this._rangeHighlightDecorationId), this._rangeHighlightDecorationId = null), r !== null) {
				let i = this._editor.getModel().getDecorationRange(r);
				if (i.startLineNumber !== i.endLineNumber && i.endColumn === 1) {
					let e = i.endLineNumber - 1, n = this._editor.getModel().getLineMaxColumn(e);
					i = new Range(i.startLineNumber, i.startColumn, e, n);
				}
				this._rangeHighlightDecorationId = n.addDecoration(i, e._RANGE_HIGHLIGHT_DECORATION);
			}
		}), i;
	}
	set(n, r) {
		this._editor.changeDecorations((i) => {
			let a = e._FIND_MATCH_DECORATION, o = [];
			if (n.length > 1e3) {
				a = e._FIND_MATCH_NO_OVERVIEW_DECORATION;
				let r = this._editor.getModel().getLineCount(), i = this._editor.getLayoutInfo().height / r, s = Math.max(2, Math.ceil(3 / i)), c = n[0].range.startLineNumber, l = n[0].range.endLineNumber;
				for (let r = 1, i = n.length; r < i; r++) {
					let i = n[r].range;
					l + s >= i.startLineNumber ? i.endLineNumber > l && (l = i.endLineNumber) : (o.push({
						range: new Range(c, 1, l, 1),
						options: e._FIND_MATCH_ONLY_OVERVIEW_DECORATION
					}), c = i.startLineNumber, l = i.endLineNumber);
				}
				o.push({
					range: new Range(c, 1, l, 1),
					options: e._FIND_MATCH_ONLY_OVERVIEW_DECORATION
				});
			}
			let s = Array(n.length);
			for (let e = 0, r = n.length; e < r; e++) s[e] = {
				range: n[e].range,
				options: a
			};
			this._decorations = i.deltaDecorations(this._decorations, s), this._overviewRulerApproximateDecorations = i.deltaDecorations(this._overviewRulerApproximateDecorations, o), this._rangeHighlightDecorationId &&= (i.removeDecoration(this._rangeHighlightDecorationId), null), this._findScopeDecorationIds.length && (this._findScopeDecorationIds.forEach((e) => i.removeDecoration(e)), this._findScopeDecorationIds = []), r?.length && (this._findScopeDecorationIds = r.map((n) => i.addDecoration(n, e._FIND_SCOPE_DECORATION)));
		});
	}
	matchBeforePosition(e) {
		if (this._decorations.length === 0) return null;
		for (let n = this._decorations.length - 1; n >= 0; n--) {
			let r = this._decorations[n], i = this._editor.getModel().getDecorationRange(r);
			if (!(!i || i.endLineNumber > e.lineNumber) && (i.endLineNumber < e.lineNumber || !(i.endColumn > e.column))) return i;
		}
		return this._editor.getModel().getDecorationRange(this._decorations[this._decorations.length - 1]);
	}
	matchAfterPosition(e) {
		if (this._decorations.length === 0) return null;
		for (let n = 0, r = this._decorations.length; n < r; n++) {
			let r = this._decorations[n], i = this._editor.getModel().getDecorationRange(r);
			if (!(!i || i.startLineNumber < e.lineNumber) && (i.startLineNumber > e.lineNumber || !(i.startColumn < e.column))) return i;
		}
		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, n, r) {
		this._editorSelection = e, this._ranges = n, this._replaceStrings = r, this._trackedEditorSelectionId = null;
	}
	getEditOperations(e, n) {
		if (this._ranges.length > 0) {
			let e = [];
			for (let n = 0; n < this._ranges.length; n++) e.push({
				range: this._ranges[n],
				text: this._replaceStrings[n]
			});
			e.sort((e, n) => Range.compareRangesUsingStarts(e.range, n.range));
			let r = [], i = e[0];
			for (let n = 1; n < e.length; n++) i.range.endLineNumber === e[n].range.startLineNumber && i.range.endColumn === e[n].range.startColumn ? (i.range = i.range.plusRange(e[n].range), i.text += e[n].text) : (r.push(i), i = e[n]);
			r.push(i);
			for (let e of r) n.addEditOperation(e.range, e.text);
		}
		this._trackedEditorSelectionId = n.trackSelection(this._editorSelection);
	}
	computeCursorState(e, n) {
		return n.getTrackedSelection(this._trackedEditorSelectionId);
	}
};
function buildReplaceStringWithCasePreserved(e, n) {
	if (e && e[0] !== "") {
		let r = validateSpecificSpecialCharacter(e, n, "-"), i = validateSpecificSpecialCharacter(e, n, "_");
		return r && !i ? buildReplaceStringForSpecificSpecialCharacter(e, n, "-") : !r && i ? buildReplaceStringForSpecificSpecialCharacter(e, n, "_") : e[0].toUpperCase() === e[0] ? n.toUpperCase() : e[0].toLowerCase() === e[0] ? n.toLowerCase() : containsUppercaseCharacter(e[0][0]) && n.length > 0 ? n[0].toUpperCase() + n.substr(1) : e[0][0].toUpperCase() !== e[0][0] && n.length > 0 ? n[0].toLowerCase() + n.substr(1) : n;
	} else return n;
}
function validateSpecificSpecialCharacter(e, n, r) {
	return e[0].indexOf(r) !== -1 && n.indexOf(r) !== -1 && e[0].split(r).length === n.split(r).length;
}
function buildReplaceStringForSpecificSpecialCharacter(e, n, r) {
	let i = n.split(r), a = e[0].split(r), o = "";
	return i.forEach((e, n) => {
		o += buildReplaceStringWithCasePreserved([a[n]], e) + r;
	}), o.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(n) {
		return new e([ReplacePiece.staticValue(n)]);
	}
	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(n, r) {
		if (this._state.kind === 0) return r ? buildReplaceStringWithCasePreserved(n, this._state.staticValue) : this._state.staticValue;
		let i = "";
		for (let r = 0, a = this._state.pieces.length; r < a; r++) {
			let a = this._state.pieces[r];
			if (a.staticValue !== null) {
				i += a.staticValue;
				continue;
			}
			let o = e._substitute(a.matchIndex, n);
			if (a.caseOps !== null && a.caseOps.length > 0) {
				let e = [], n = a.caseOps.length, r = 0;
				for (let i = 0, s = o.length; i < s; i++) {
					if (r >= n) {
						e.push(o.slice(i));
						break;
					}
					switch (a.caseOps[r]) {
						case "U":
							e.push(o[i].toUpperCase());
							break;
						case "u":
							e.push(o[i].toUpperCase()), r++;
							break;
						case "L":
							e.push(o[i].toLowerCase());
							break;
						case "l":
							e.push(o[i].toLowerCase()), r++;
							break;
						default: e.push(o[i]);
					}
				}
				o = e.join("");
			}
			i += o;
		}
		return i;
	}
	static _substitute(e, n) {
		if (n === null) return "";
		if (e === 0) return n[0];
		let r = "";
		for (; e > 0;) {
			if (e < n.length) return (n[e] || "") + r;
			r = String(e % 10) + r, e = Math.floor(e / 10);
		}
		return "$" + r;
	}
}, ReplacePiece = class e {
	static staticValue(n) {
		return new e(n, -1, null);
	}
	static caseOps(n, r) {
		return new e(null, n, r);
	}
	constructor(e, n, r) {
		this.staticValue = e, this.matchIndex = n, !r || r.length === 0 ? this.caseOps = null : this.caseOps = r.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, n) {
		this._emitStatic(e), this._lastCharIndex = n;
	}
	_emitStatic(e) {
		e.length !== 0 && (this._currentStaticPiece += e);
	}
	emitMatchIndex(e, n, r) {
		this._currentStaticPiece.length !== 0 && (this._result[this._resultLen++] = ReplacePiece.staticValue(this._currentStaticPiece), this._currentStaticPiece = ""), this._result[this._resultLen++] = ReplacePiece.caseOps(e, r), this._lastCharIndex = n;
	}
	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 n = [], r = new ReplacePieceBuilder(e);
	for (let i = 0, a = e.length; i < a; i++) {
		let o = e.charCodeAt(i);
		if (o === 92) {
			if (i++, i >= a) break;
			let o = e.charCodeAt(i);
			switch (o) {
				case 92:
					r.emitUnchanged(i - 1), r.emitStatic("\\", i + 1);
					break;
				case 110:
					r.emitUnchanged(i - 1), r.emitStatic("\n", i + 1);
					break;
				case 116:
					r.emitUnchanged(i - 1), r.emitStatic("	", i + 1);
					break;
				case 117:
				case 85:
				case 108:
				case 76:
					r.emitUnchanged(i - 1), r.emitStatic("", i + 1), n.push(String.fromCharCode(o));
					break;
			}
			continue;
		}
		if (o === 36) {
			if (i++, i >= a) break;
			let o = e.charCodeAt(i);
			if (o === 36) {
				r.emitUnchanged(i - 1), r.emitStatic("$", i + 1);
				continue;
			}
			if (o === 48 || o === 38) {
				r.emitUnchanged(i - 1), r.emitMatchIndex(0, i + 1, n), n.length = 0;
				continue;
			}
			if (49 <= o && o <= 57) {
				let s = o - 48;
				if (i + 1 < a) {
					let a = e.charCodeAt(i + 1);
					if (48 <= a && a <= 57) {
						i++, s = s * 10 + (a - 48), r.emitUnchanged(i - 2), r.emitMatchIndex(s, i + 1, n), n.length = 0;
						continue;
					}
				}
				r.emitUnchanged(i - 1), r.emitMatchIndex(s, i + 1, n), n.length = 0;
				continue;
			}
		}
	}
	return r.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, n) {
		this._toDispose = new DisposableStore(), this._editor = e, this._state = n, 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, n) {
		return n || e.getFullModelRange();
	}
	research(e, n) {
		let r = null;
		n === void 0 ? r = this._decorations.getFindScopes() : n !== null && (r = Array.isArray(n) ? n : [n]), r !== null && (r = r.map((e) => {
			if (e.startLineNumber !== e.endLineNumber) {
				let n = e.endLineNumber;
				return e.endColumn === 1 && --n, new Range(e.startLineNumber, 1, n, this._editor.getModel().getLineMaxColumn(n));
			}
			return e;
		}));
		let i = this._findMatches(r, !1, MATCHES_LIMIT);
		this._decorations.set(i, r);
		let a = this._editor.getSelection(), o = this._decorations.getCurrentMatchesPosition(a);
		if (o === 0 && i.length > 0) {
			let e = findFirstIdxMonotonousOrArrLen(i.map((e) => e.range), (e) => Range.compareRangesUsingStarts(e, a) >= 0);
			o = e > 0 ? e - 1 + 1 : o;
		}
		this._state.changeMatchInfo(o, 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 n = this._decorations.setCurrentFindMatch(e);
		this._state.changeMatchInfo(n, this._decorations.getCount(), e), this._editor.setSelection(e), this._editor.revealRangeInCenterIfOutsideViewport(e, 0);
	}
	_prevSearchPosition(e) {
		let n = this._state.isRegex && (this._state.searchString.indexOf("^") >= 0 || this._state.searchString.indexOf("$") >= 0), { lineNumber: r, column: i } = e, a = this._editor.getModel();
		return n || i === 1 ? (r === 1 ? r = a.getLineCount() : r--, i = a.getLineMaxColumn(r)) : i--, new Position(r, i);
	}
	_moveToPrevMatch(n, r = !1) {
		if (!this._state.canNavigateBack()) {
			let e = this._decorations.matchAfterPosition(n);
			e && this._setCurrentFindMatch(e);
			return;
		}
		if (this._decorations.getCount() < 19999) {
			let e = this._decorations.matchBeforePosition(n);
			e && e.isEmpty() && e.getStartPosition().equals(n) && (n = this._prevSearchPosition(n), e = this._decorations.matchBeforePosition(n)), e && this._setCurrentFindMatch(e);
			return;
		}
		if (this._cannotFind()) return;
		let i = this._decorations.getFindScope(), a = e._getSearchRange(this._editor.getModel(), i);
		a.getEndPosition().isBefore(n) && (n = a.getEndPosition()), n.isBefore(a.getStartPosition()) && (n = a.getEndPosition());
		let { lineNumber: o, column: s } = n, c = this._editor.getModel(), l = new Position(o, s), u = c.findPreviousMatch(this._state.searchString, l, this._state.isRegex, this._state.matchCase, this._state.wholeWord ? this._editor.getOption(132) : null, !1);
		if (u && u.range.isEmpty() && u.range.getStartPosition().equals(l) && (l = this._prevSearchPosition(l), u = c.findPreviousMatch(this._state.searchString, l, this._state.isRegex, this._state.matchCase, this._state.wholeWord ? this._editor.getOption(132) : null, !1)), u) {
			if (!r && !a.containsRange(u.range)) return this._moveToPrevMatch(u.range.getStartPosition(), !0);
			this._setCurrentFindMatch(u.range);
		}
	}
	moveToPrevMatch() {
		this._moveToPrevMatch(this._editor.getSelection().getStartPosition());
	}
	_nextSearchPosition(e) {
		let n = this._state.isRegex && (this._state.searchString.indexOf("^") >= 0 || this._state.searchString.indexOf("$") >= 0), { lineNumber: r, column: i } = e, a = this._editor.getModel();
		return n || i === a.getLineMaxColumn(r) ? (r === a.getLineCount() ? r = 1 : r++, i = 1) : i++, new Position(r, i);
	}
	_moveToNextMatch(e) {
		if (!this._state.canNavigateForward()) {
			let n = this._decorations.matchBeforePosition(e);
			n && this._setCurrentFindMatch(n);
			return;
		}
		if (this._decorations.getCount() < 19999) {
			let n = this._decorations.matchAfterPosition(e);
			n && n.isEmpty() && n.getStartPosition().equals(e) && (e = this._nextSearchPosition(e), n = this._decorations.matchAfterPosition(e)), n && this._setCurrentFindMatch(n);
			return;
		}
		let n = this._getNextMatch(e, !1, !0);
		n && this._setCurrentFindMatch(n.range);
	}
	_getNextMatch(n, r, i, a = !1) {
		if (this._cannotFind()) return null;
		let o = this._decorations.getFindScope(), s = e._getSearchRange(this._editor.getModel(), o);
		s.getEndPosition().isBefore(n) && (n = s.getStartPosition()), n.isBefore(s.getStartPosition()) && (n = s.getStartPosition());
		let { lineNumber: c, column: l } = n, u = this._editor.getModel(), d = new Position(c, l), f = u.findNextMatch(this._state.searchString, d, this._state.isRegex, this._state.matchCase, this._state.wholeWord ? this._editor.getOption(132) : null, r);
		return i && f && f.range.isEmpty() && f.range.getStartPosition().equals(d) && (d = this._nextSearchPosition(d), f = u.findNextMatch(this._state.searchString, d, this._state.isRegex, this._state.matchCase, this._state.wholeWord ? this._editor.getOption(132) : null, r)), f ? !a && !s.containsRange(f.range) ? this._getNextMatch(f.range.getEndPosition(), r, i, !0) : f : null;
	}
	moveToNextMatch() {
		this._moveToNextMatch(this._editor.getSelection().getEndPosition());
	}
	_moveToMatch(e) {
		let n = this._decorations.getDecorationRangeAt(e);
		n && this._setCurrentFindMatch(n);
	}
	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(), n = this._editor.getSelection(), r = this._getNextMatch(n.getStartPosition(), !0, !1);
		if (r) if (n.equalsRange(r.range)) {
			let i = e.buildReplaceString(r.matches, this._state.preserveCase), a = new ReplaceCommand(n, i);
			this._executeEditorCommand("replace", a), this._decorations.setStartPosition(new Position(n.startLineNumber, n.startColumn + i.length)), this.research(!0);
		} else this._decorations.setStartPosition(this._editor.getPosition()), this._setCurrentFindMatch(r.range);
	}
	_findMatches(n, r, i) {
		let a = (n || [null]).map((n) => e._getSearchRange(this._editor.getModel(), n));
		return this._editor.getModel().findMatches(this._state.searchString, a, this._state.isRegex, this._state.matchCase, this._state.wholeWord ? this._editor.getOption(132) : null, r, i);
	}
	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 n = e.regex;
		if (!n.multiline) {
			let e = "mu";
			n.ignoreCase && (e += "i"), n.global && (e += "g"), n = new RegExp(n.source, e);
		}
		let r = this._editor.getModel(), i = r.getValue(1), a = r.getFullModelRange(), o = this._getReplacePattern(), s, c = this._state.preserveCase;
		s = o.hasReplacementPatterns || c ? i.replace(n, function() {
			return o.buildReplaceString(arguments, c);
		}) : i.replace(n, o.buildReplaceString(null, c));
		let l = new ReplaceCommandThatPreservesSelection(a, s, this._editor.getSelection());
		this._executeEditorCommand("replaceAll", l);
	}
	_regularReplaceAll(e) {
		let n = this._getReplacePattern(), r = this._findMatches(e, n.hasReplacementPatterns || this._state.preserveCase, 1073741824), i = [];
		for (let e = 0, a = r.length; e < a; e++) i[e] = n.buildReplaceString(r[e].matches, this._state.preserveCase);
		let a = new ReplaceAllCommand(this._editor.getSelection(), r.map((e) => e.range), i);
		this._executeEditorCommand("replaceAll", a);
	}
	selectAllMatches() {
		if (!this._hasMatches()) return;
		let e = this._decorations.getFindScopes(), n = this._findMatches(e, !1, 1073741824).map((e) => new Selection(e.range.startLineNumber, e.range.startColumn, e.range.endLineNumber, e.range.endColumn)), r = this._editor.getSelection();
		for (let e = 0, i = n.length; e < i; e++) if (n[e].equalsRange(r)) {
			n = [r].concat(n.slice(0, e), n.slice(e + 1));
			break;
		}
		this._editor.setSelections(n);
	}
	_executeEditorCommand(e, n) {
		try {
			this._ignoreModelContentChanged = !0, this._editor.pushUndoStop(), this._editor.executeCommand(e, n), this._editor.pushUndoStop();
		} finally {
			this._ignoreModelContentChanged = !1;
		}
	}
}, FindOptionsWidget = class e extends Widget {
	static {
		this.ID = "editor.contrib.findOptionsWidget";
	}
	constructor(e, n, r) {
		super(), this._hideSoon = this._register(new RunOnceScheduler(() => this._hide(), 2e3)), this._isVisible = !1, this._editor = e, this._state = n, this._keybindingService = r, 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 i = {
			inputActiveOptionBorder: asCssVariable(inputActiveOptionBorder),
			inputActiveOptionForeground: asCssVariable(inputActiveOptionForeground),
			inputActiveOptionBackground: asCssVariable(inputActiveOptionBackground)
		}, a = this._register(createInstantHoverDelegate());
		this.caseSensitive = this._register(new CaseSensitiveToggle({
			appendTitle: this._keybindingLabelFor(FIND_IDS.ToggleCaseSensitiveCommand),
			isChecked: this._state.matchCase,
			hoverDelegate: a,
			...i
		})), 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: a,
			...i
		})), 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: a,
			...i
		})), 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 n = !1;
			e.isRegex && (this.regex.checked = this._state.isRegex, n = !0), e.wholeWord && (this.wholeWords.checked = this._state.wholeWord, n = !0), e.matchCase && (this.caseSensitive.checked = this._state.matchCase, n = !0), !this._state.isRevealed && n && 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 n = this._keybindingService.lookupKeybinding(e);
		return n ? ` (${n.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, n) {
	return e === 1 ? !0 : e === 2 ? !1 : n;
}
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, n, r) {
		let i = {
			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
		}, a = !1;
		n === 0 && (e = 0), e > n && (e = n), this._matchesPosition !== e && (this._matchesPosition = e, i.matchesPosition = !0, a = !0), this._matchesCount !== n && (this._matchesCount = n, i.matchesCount = !0, a = !0), r !== void 0 && (Range.equalsRange(this._currentMatch, r) || (this._currentMatch = r, i.currentMatch = !0, a = !0)), a && this._onFindReplaceStateChange.fire(i);
	}
	change(e, n, r = !0) {
		let i = {
			moveCursor: n,
			updateHistory: r,
			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
		}, a = !1, o = this.isRegex, s = this.wholeWord, c = this.matchCase, l = this.preserveCase;
		e.searchString !== void 0 && this._searchString !== e.searchString && (this._searchString = e.searchString, i.searchString = !0, a = !0), e.replaceString !== void 0 && this._replaceString !== e.replaceString && (this._replaceString = e.replaceString, i.replaceString = !0, a = !0), e.isRevealed !== void 0 && this._isRevealed !== e.isRevealed && (this._isRevealed = e.isRevealed, i.isRevealed = !0, a = !0), e.isReplaceRevealed !== void 0 && this._isReplaceRevealed !== e.isReplaceRevealed && (this._isReplaceRevealed = e.isReplaceRevealed, i.isReplaceRevealed = !0, a = !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((n) => !Range.equalsRange(n, e))) || (this._searchScope = e.searchScope, i.searchScope = !0, a = !0)), e.loop !== void 0 && this._loop !== e.loop && (this._loop = e.loop, i.loop = !0, a = !0), e.isSearching !== void 0 && this._isSearching !== e.isSearching && (this._isSearching = e.isSearching, i.isSearching = !0, a = !0), e.filters !== void 0 && (this._filters ? this._filters.update(e.filters) : this._filters = e.filters, i.filters = !0, a = !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, o !== this.isRegex && (a = !0, i.isRegex = !0), s !== this.wholeWord && (a = !0, i.wholeWord = !0), c !== this.matchCase && (a = !0, i.matchCase = !0), l !== this.preserveCase && (a = !0, i.preserveCase = !0), a && this._onFindReplaceStateChange.fire(i);
	}
	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, n, r, i) {
		super(), this._showOptionButtons = r, 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 = n, this.placeholder = i.placeholder || "", this.validation = i.validation, this.label = i.label || NLS_DEFAULT_LABEL;
		let a = i.appendPreserveCaseLabel || "", o = i.history || [], s = !!i.flexibleHeight, c = !!i.flexibleWidth, l = i.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: o,
			showHistoryHint: i.showHistoryHint,
			flexibleHeight: s,
			flexibleWidth: c,
			flexibleMaxHeight: l,
			inputBoxStyles: i.inputBoxStyles
		})), this.preserveCase = this._register(new PreserveCaseToggle({
			appendTitle: a,
			isChecked: !1,
			...i.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 u = [this.preserveCase.domNode];
		this.onkeydown(this.domNode, (e) => {
			if (e.equals(15) || e.equals(17) || e.equals(9)) {
				let n = u.indexOf(this.domNode.ownerDocument.activeElement);
				if (n >= 0) {
					let r = -1;
					e.equals(17) ? r = (n + 1) % u.length : e.equals(15) && (r = n === 0 ? u.length - 1 : n - 1), e.equals(9) ? (u[n].blur(), this.inputBox.focus()) : r >= 0 && u[r].focus(), EventHelper.stop(e, !0);
				}
			}
		});
		let d = document.createElement("div");
		d.className = "controls", d.style.display = this._showOptionButtons ? "block" : "none", d.appendChild(this.preserveCase.domNode), this.domNode.appendChild(d), 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, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$69 = function(e, n) {
	return function(r, i) {
		n(r, i, 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, n) {
	if (widgets.includes(n)) throw Error("Cannot register the same widget multiple times");
	widgets.push(n);
	let r = new DisposableStore(), i = new RawContextKey(HistoryNavigationWidgetFocusContext, !1).bindTo(e), a = new RawContextKey(HistoryNavigationForwardsEnablementContext, !0).bindTo(e), o = new RawContextKey(HistoryNavigationBackwardsEnablementContext, !0).bindTo(e), s = () => {
		i.set(!0), lastFocusedWidget = n;
	}, c = () => {
		i.set(!1), lastFocusedWidget === n && (lastFocusedWidget = void 0);
	};
	return isActiveElement(n.element) && s(), r.add(n.onDidFocus(() => s())), r.add(n.onDidBlur(() => c())), r.add(toDisposable(() => {
		widgets.splice(widgets.indexOf(n), 1), c();
	})), {
		historyNavigationForwardsEnablement: a,
		historyNavigationBackwardsEnablement: o,
		dispose() {
			r.dispose();
		}
	};
}
var ContextScopedFindInput = class extends FindInput {
	constructor(e, n, r, i) {
		super(e, n, r);
		let a = this._register(i.createScoped(this.inputBox.element));
		this._register(registerAndCreateHistoryNavigationContext(a, this.inputBox));
	}
};
ContextScopedFindInput = __decorate$69([__param$69(3, IContextKeyService)], ContextScopedFindInput);
var ContextScopedReplaceInput = class extends ReplaceInput {
	constructor(e, n, r, i, a = !1) {
		super(e, n, a, r);
		let o = this._register(i.createScoped(this.inputBox.element));
		this._register(registerAndCreateHistoryNavigationContext(o, 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, n, r) {
	let i = !!n.match(/\n/);
	if (r && i && r.selectionStart > 0) {
		e.stopPropagation();
		return;
	}
}
function stopPropagationForMultiLineDownwards(e, n, r) {
	let i = !!n.match(/\n/);
	if (r && i && r.selectionEnd < r.value.length) {
		e.stopPropagation();
		return;
	}
}
var FindWidget = class e extends Widget {
	static {
		this.ID = "editor.contrib.findWidget";
	}
	constructor(e, n, r, i, a, o, s, c, l, u) {
		super(), this._hoverService = u, this._cachedHeight = null, this._revealTimeouts = [], this._codeEditor = e, this._controller = n, this._state = r, this._contextViewProvider = i, this._keybindingService = a, this._contextKeyService = o, this._storageService = c, this._notificationService = l, this._ctrlEnterReplaceAllWarningPrompted = !!c.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 n = this._codeEditor.getOption(41).addExtraSpaceOnTop;
				n && !this._viewZone && (this._viewZone = new FindWidgetViewZone(0), this._showViewZone()), !n && 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(o), 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(o), 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 n = String(this._state.matchesCount);
			this._state.matchesCount >= 19999 && (n += "+");
			let r = String(this._state.matchesPosition);
			r === "0" && (r = "?"), e = format(NLS_MATCHES_LOCATION, r, n);
		} 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, n, r) {
		if (e === NLS_NO_RESULTS) return r === "" ? localize("ariaSearchNoResultEmpty", "{0} found", e) : localize("ariaSearchNoResult", "{0} found for '{1}'", e, r);
		if (n) {
			let i = localize("ariaSearchNoResultWithLineNum", "{0} found for '{1}', at {2}", e, r, n.startLineNumber + ":" + n.startColumn), a = this._codeEditor.getModel();
			return a && n.startLineNumber <= a.getLineCount() && n.startLineNumber >= 1 ? `${a.getLineContent(n.startLineNumber)}, ${i}` : i;
		}
		return localize("ariaSearchNoResultWithLineNumNoCurrentMatch", "{0} found for '{1}'", e, r);
	}
	_updateToggleSelectionFindButton() {
		let e = this._codeEditor.getSelection(), n = e ? e.startLineNumber !== e.endLineNumber || e.startColumn !== e.endColumn : !1, r = this._toggleSelectionFind.checked;
		this._isVisible && (r || n) ? 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, n = !!this._state.matchesCount;
		this._prevBtn.setEnabled(this._isVisible && e && n && this._state.canNavigateBack()), this._nextBtn.setEnabled(this._isVisible && e && n && 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 r = !this._codeEditor.getOption(92);
		this._toggleReplaceBtn.setEnabled(this._isVisible && r);
	}
	_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 n = !!e && e.startLineNumber !== e.endLineNumber;
					this._toggleSelectionFind.checked = n;
					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 n = !0;
			if (this._codeEditor.getOption(41).seedSearchStringFromSelection && e) {
				let r = this._codeEditor.getDomNode();
				if (r) {
					let i = getDomNodePagePosition(r), a = this._codeEditor.getScrolledVisiblePosition(e.getStartPosition()), o = i.left + (a ? a.left : 0), s = a ? a.top : 0;
					if (this._viewZone && s < this._viewZone.heightInPx) {
						e.endLineNumber > e.startLineNumber && (n = !1);
						let r = getTopLeftOffset(this._domNode).left;
						o > r && (n = !1);
						let a = this._codeEditor.getScrolledVisiblePosition(e.getEndPosition());
						i.left + (a ? a.left : 0) > r && (n = !1);
					}
				}
			}
			this._showViewZone(n);
		}
	}
	_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 n = this._viewZone;
		this._viewZoneId !== void 0 || !n || this._codeEditor.changeViewZones((r) => {
			n.heightInPx = this._getHeight(), this._viewZoneId = r.addZone(n), this._codeEditor.setScrollTop(e || this._codeEditor.getScrollTop() + n.heightInPx);
		});
	}
	_showViewZone(e = !0) {
		if (!this._isVisible || !this._codeEditor.getOption(41).addExtraSpaceOnTop) return;
		this._viewZone === void 0 && (this._viewZone = new FindWidgetViewZone(0));
		let n = this._viewZone;
		this._codeEditor.changeViewZones((r) => {
			if (this._viewZoneId !== void 0) {
				let i = this._getHeight();
				if (i === n.heightInPx) return;
				let a = i - n.heightInPx;
				n.heightInPx = i, r.layoutZone(this._viewZoneId), e && this._codeEditor.setScrollTop(this._codeEditor.getScrollTop() + a);
				return;
			} else {
				let i = this._getHeight();
				if (i -= this._codeEditor.getOption(84).top, i <= 0) return;
				n.heightInPx = i, this._viewZoneId = r.addZone(n), e && this._codeEditor.setScrollTop(this._codeEditor.getScrollTop() + i);
			}
		});
	}
	_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 n = e.width, r = e.minimap.minimapWidth, i = !1, a = !1, o = !1;
		if (this._resized && getTotalWidth(this._domNode) > FIND_WIDGET_INITIAL_WIDTH) {
			this._domNode.style.maxWidth = `${n - 28 - r - 15}px`, this._replaceInput.width = getTotalWidth(this._findInput.domNode);
			return;
		}
		if (FIND_WIDGET_INITIAL_WIDTH + 28 + r >= n && (a = !0), FIND_WIDGET_INITIAL_WIDTH + 28 + r - MAX_MATCHES_COUNT_WIDTH >= n && (o = !0), FIND_WIDGET_INITIAL_WIDTH + 28 + r - MAX_MATCHES_COUNT_WIDTH >= n + 50 && (i = !0), this._domNode.classList.toggle("collapsed-find-widget", i), this._domNode.classList.toggle("narrow-find-widget", o), this._domNode.classList.toggle("reduced-find-widget", a), !o && !i && (this._domNode.style.maxWidth = `${n - 28 - r - 15}px`), this._findInput.layout({
			collapsedFindWidget: i,
			narrowFindWidget: o,
			reducedFindWidget: a
		}), 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 n = this._state.currentMatch;
				return e.startLineNumber !== e.endLineNumber && !Range.equalsRange(e, n) ? 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 n = this._keybindingService.lookupKeybinding(e);
		return n ? ` (${n.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 n = document.createElement("div");
		n.className = "find-part", n.appendChild(this._findInput.domNode);
		let r = document.createElement("div");
		r.className = "find-actions", n.appendChild(r), r.appendChild(this._matchesCount), r.appendChild(this._prevBtn.domNode), r.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);
		})), r.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 i = this._register(createInstantHoverDelegate());
		this._replaceBtn = this._register(new SimpleButton({
			label: NLS_REPLACE_BTN_LABEL + this._keybindingLabelFor(FIND_IDS.ReplaceOneAction),
			icon: findReplaceIcon,
			hoverDelegate: i,
			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: i,
			onTrigger: () => {
				this._controller.replaceAll();
			}
		}, this._hoverService));
		let a = document.createElement("div");
		a.className = "replace-part", a.appendChild(this._replaceInput.domNode);
		let o = document.createElement("div");
		o.className = "replace-actions", a.appendChild(o), o.appendChild(this._replaceBtn.domNode), o.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(n), this._domNode.appendChild(this._closeBtn.domNode), this._domNode.appendChild(a), this._resizeSash = this._register(new Sash(this._domNode, this, {
			orientation: 0,
			size: 2
		})), this._resized = !1;
		let s = FIND_WIDGET_INITIAL_WIDTH;
		this._register(this._resizeSash.onDidStart(() => {
			s = getTotalWidth(this._domNode);
		})), this._register(this._resizeSash.onDidChange((e) => {
			this._resized = !0;
			let n = s + e.startX - e.currentX;
			if (n < FIND_WIDGET_INITIAL_WIDTH) return;
			let r = parseFloat(getComputedStyle(this._domNode).maxWidth) || 0;
			n > r || (this._domNode.style.width = `${n}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 n = FIND_WIDGET_INITIAL_WIDTH;
			if (!this._resized || e === FIND_WIDGET_INITIAL_WIDTH) {
				let e = this._codeEditor.getLayoutInfo();
				n = e.width - 28 - e.minimap.minimapWidth - 15, this._resized = !0;
			}
			this._domNode.style.width = `${n}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, n) {
		super(), this._opts = e;
		let r = "button";
		this._opts.className && (r = r + " " + this._opts.className), this._opts.icon && (r = r + " " + ThemeIcon.asClassName(this._opts.icon)), this._domNode = document.createElement("div"), this._domNode.tabIndex = 0, this._domNode.className = r, this._domNode.setAttribute("role", "button"), this._domNode.setAttribute("aria-label", this._opts.label), this._register(n.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, n) => {
	let r = e.getColor(editorFindMatchHighlightBorder);
	r && n.addRule(`.monaco-editor .findMatch { border: 1px ${isHighContrast(e.type) ? "dotted" : "solid"} ${r}; box-sizing: border-box; }`);
	let i = e.getColor(editorFindRangeHighlightBorder);
	i && n.addRule(`.monaco-editor .findScope { border: 1px ${isHighContrast(e.type) ? "dashed" : "solid"} ${i}; }`);
	let a = e.getColor(contrastBorder);
	a && n.addRule(`.monaco-editor .find-widget { border: 1px solid ${a}; }`);
	let o = e.getColor(editorFindMatchForeground);
	o && n.addRule(`.monaco-editor .findMatchInline { color: ${o}; }`);
	let s = e.getColor(editorFindMatchHighlightForeground);
	s && n.addRule(`.monaco-editor .currentFindMatchInline { color: ${s}; }`);
});
var __decorate$68 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$68 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, CommonFindController_1, SEARCH_STRING_MAX_LENGTH = 524288;
function getSelectionSearchString(e, n = "single", r = !1) {
	if (!e.hasModel()) return null;
	let i = e.getSelection();
	if (n === "single" && i.startLineNumber === i.endLineNumber || n === "multiple") {
		if (i.isEmpty()) {
			let n = e.getConfiguredWordAtPosition(i.getStartPosition());
			if (n && !1 === r) return n.word;
		} else if (e.getModel().getValueLengthInRange(i) < SEARCH_STRING_MAX_LENGTH) return e.getModel().getValueInRange(i);
	}
	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, n, r, i, a, o) {
		super(), this._editor = e, this._findWidgetVisible = CONTEXT_FIND_WIDGET_VISIBLE.bindTo(n), this._contextKeyService = n, this._storageService = r, this._clipboardService = i, this._notificationService = a, this._hoverService = o, 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, n) {
		if (this.disposeModel(), !this._editor.hasModel()) return;
		let r = {
			...n,
			isRevealed: !0
		};
		if (e.seedSearchStringFromSelection === "single") {
			let n = getSelectionSearchString(this._editor, e.seedSearchStringFromSelection, e.seedSearchStringFromNonEmptySelection);
			n && (this._state.isRegex ? r.searchString = escapeRegExpCharacters(n) : r.searchString = n);
		} else if (e.seedSearchStringFromSelection === "multiple" && !e.updateSearchScope) {
			let n = getSelectionSearchString(this._editor, e.seedSearchStringFromSelection);
			n && (r.searchString = n);
		}
		if (!r.searchString && e.seedSearchStringFromGlobalClipboard) {
			let e = await this.getGlobalBufferTerm();
			if (!this._editor.hasModel()) return;
			e && (r.searchString = e);
		}
		if (e.forceRevealReplace || r.isReplaceRevealed ? r.isReplaceRevealed = !0 : this._findWidgetVisible.get() || (r.isReplaceRevealed = !1), e.updateSearchScope) {
			let e = this._editor.getSelections();
			e.some((e) => !e.isEmpty()) && (r.searchScope = e);
		}
		r.loop = e.loop, this._state.change(r, !1), this._model ||= new FindModelBoundToEditorModel(this._editor, this._state);
	}
	start(e, n) {
		return this._start(e, n);
	}
	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, n, r, i, a, o, s, c, l) {
		super(e, r, s, c, o, l), this._contextViewService = n, this._keybindingService = i, this._themeService = a, this._widget = null, this._findOptionsWidget = null;
	}
	async _start(e, n) {
		this._widget || this._createFindWidget();
		let r = this._editor.getSelection(), i = !1;
		switch (this._editor.getOption(41).autoFindInSelection) {
			case "always":
				i = !0;
				break;
			case "never":
				i = !1;
				break;
			case "multiline":
				i = !!r && r.startLineNumber !== r.endLineNumber;
				break;
			default: break;
		}
		e.updateSearchScope = e.updateSearchScope || i, await super._start(e, n), 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, n, r) => {
	let i = CommonFindController.get(n);
	return i ? i.start({
		forceRevealReplace: !1,
		seedSearchStringFromSelection: n.getOption(41).seedSearchStringFromSelection === "never" ? "none" : "single",
		seedSearchStringFromNonEmptySelection: n.getOption(41).seedSearchStringFromSelection === "selection",
		seedSearchStringFromGlobalClipboard: n.getOption(41).globalFindClipboard,
		shouldFocus: 1,
		shouldAnimate: !0,
		updateSearchScope: !1,
		loop: n.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, n, r) {
		let i = CommonFindController.get(n);
		if (i) {
			let e = r ? {
				searchString: r.searchString,
				replaceString: r.replaceString,
				isReplaceRevealed: r.replaceString !== void 0,
				isRegex: r.isRegex,
				wholeWord: r.matchWholeWord,
				matchCase: r.isCaseSensitive,
				preserveCase: r.preserveCase
			} : {};
			await i.start({
				forceRevealReplace: !1,
				seedSearchStringFromSelection: i.getState().searchString.length === 0 && n.getOption(41).seedSearchStringFromSelection !== "never" ? "single" : "none",
				seedSearchStringFromNonEmptySelection: n.getOption(41).seedSearchStringFromSelection === "selection",
				seedSearchStringFromGlobalClipboard: !0,
				shouldFocus: 1,
				shouldAnimate: !0,
				updateSearchScope: r?.findInSelection || !1,
				loop: n.getOption(41).loop
			}, e), i.setGlobalBufferTerm(i.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, n) {
		let r = CommonFindController.get(n);
		r && (await r.start({
			forceRevealReplace: !1,
			seedSearchStringFromSelection: "multiple",
			seedSearchStringFromNonEmptySelection: !1,
			seedSearchStringFromGlobalClipboard: !1,
			shouldFocus: 0,
			shouldAnimate: !0,
			updateSearchScope: !1,
			loop: n.getOption(41).loop
		}), r.setGlobalBufferTerm(r.getState().searchString));
	}
}, MatchFindAction = class extends EditorAction {
	async run(e, n) {
		let r = CommonFindController.get(n);
		r && !this._run(r) && (await r.start({
			forceRevealReplace: !1,
			seedSearchStringFromSelection: r.getState().searchString.length === 0 && n.getOption(41).seedSearchStringFromSelection !== "never" ? "single" : "none",
			seedSearchStringFromNonEmptySelection: n.getOption(41).seedSearchStringFromSelection === "selection",
			seedSearchStringFromGlobalClipboard: !0,
			shouldFocus: 0,
			shouldAnimate: !0,
			updateSearchScope: !1,
			loop: n.getOption(41).loop
		}), this._run(r));
	}
}, 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, n, r) {
		let i = CommonFindController.get(n);
		if (!i) return;
		let a = i.getState().matchesCount;
		if (a < 1) {
			e.get(INotificationService).notify({
				severity: Severity.Warning,
				message: localize("findMatchAction.noResults", "No matches. Try searching for something else.")
			});
			return;
		}
		let o = e.get(IQuickInputService), s = new DisposableStore(), c = s.add(o.createInputBox());
		c.placeholder = localize("findMatchAction.inputPlaceHolder", "Type a number to go to a specific match (between 1 and {0})", a);
		let l = (e) => {
			let n = parseInt(e);
			if (isNaN(n)) return;
			let r = i.getState().matchesCount;
			if (n > 0 && n <= r) return n - 1;
			if (n < 0 && n >= -r) return r + n;
		}, u = (e) => {
			let r = l(e);
			if (typeof r == "number") {
				c.validationMessage = void 0, i.goToMatch(r);
				let e = i.getState().currentMatch;
				e && this.addDecorations(n, e);
			} else c.validationMessage = localize("findMatchAction.inputValidationMessage", "Please type a number between 1 and {0}", i.getState().matchesCount), this.clearDecorations(n);
		};
		s.add(c.onDidChangeValue((e) => {
			u(e);
		})), s.add(c.onDidAccept(() => {
			let e = l(c.value);
			typeof e == "number" ? (i.goToMatch(e), c.hide()) : c.validationMessage = localize("findMatchAction.inputValidationMessage", "Please type a number between 1 and {0}", i.getState().matchesCount);
		})), s.add(c.onDidHide(() => {
			this.clearDecorations(n), s.dispose();
		})), c.show();
	}
	clearDecorations(e) {
		e.changeDecorations((e) => {
			this._highlightDecorations = e.deltaDecorations(this._highlightDecorations, []);
		});
	}
	addDecorations(e, n) {
		e.changeDecorations((e) => {
			this._highlightDecorations = e.deltaDecorations(this._highlightDecorations, [{
				range: n,
				options: {
					description: "find-match-quick-access-range-highlight",
					className: "rangeHighlight",
					isWholeLine: !0
				}
			}, {
				range: n,
				options: {
					description: "find-match-quick-access-range-highlight-overview",
					overviewRuler: {
						color: themeColorFromId(overviewRulerRangeHighlight),
						position: OverviewRulerLane.Full
					}
				}
			}]);
		});
	}
}, SelectionMatchFindAction = class extends EditorAction {
	async run(e, n) {
		let r = CommonFindController.get(n);
		if (!r) return;
		let i = getSelectionSearchString(n, "single", !1);
		i && r.setSearchString(i), this._run(r) || (await r.start({
			forceRevealReplace: !1,
			seedSearchStringFromSelection: "none",
			seedSearchStringFromNonEmptySelection: !1,
			seedSearchStringFromGlobalClipboard: !1,
			shouldFocus: 0,
			shouldAnimate: !0,
			updateSearchScope: !1,
			loop: n.getOption(41).loop
		}), this._run(r));
	}
}, 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, n, r) => {
	if (!n.hasModel() || n.getOption(92)) return !1;
	let i = CommonFindController.get(n);
	if (!i) return !1;
	let a = n.getSelection(), o = i.isFindInputFocused(), s = !a.isEmpty() && a.startLineNumber === a.endLineNumber && n.getOption(41).seedSearchStringFromSelection !== "never" && !o, c = o || s ? 2 : 1;
	return i.start({
		forceRevealReplace: !0,
		seedSearchStringFromSelection: s ? "single" : "none",
		seedSearchStringFromNonEmptySelection: n.getOption(41).seedSearchStringFromSelection === "selection",
		seedSearchStringFromGlobalClipboard: n.getOption(41).seedSearchStringFromSelection !== "never",
		shouldFocus: c,
		shouldAnimate: !0,
		updateSearchScope: !1,
		loop: n.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 n = Math.ceil(e / 32);
		this._states = new Uint32Array(n);
	}
	get(e) {
		let n = e / 32 | 0, r = e % 32;
		return (this._states[n] & 1 << r) != 0;
	}
	set(e, n) {
		let r = e / 32 | 0, i = e % 32, a = this._states[r];
		n ? this._states[r] = a | 1 << i : this._states[r] = a & ~(1 << i);
	}
}, FoldingRegions = class e {
	constructor(e, n, r) {
		if (e.length !== n.length || e.length > 65535) throw Error("invalid startIndexes or endIndexes size");
		this._startIndexes = e, this._endIndexes = n, this._collapseStates = new BitField(e.length), this._userDefinedStates = new BitField(e.length), this._recoveredStates = new BitField(e.length), this._types = r, this._parentsComputed = !1;
	}
	ensureParentIndices() {
		if (!this._parentsComputed) {
			this._parentsComputed = !0;
			let e = [], n = (n, r) => {
				let i = e[e.length - 1];
				return this.getStartLineNumber(i) <= n && this.getEndLineNumber(i) >= r;
			};
			for (let r = 0, i = this._startIndexes.length; r < i; r++) {
				let i = this._startIndexes[r], a = this._endIndexes[r];
				if (i > 16777215 || a > 16777215) throw Error("startLineNumber or endLineNumber must not exceed " + MAX_LINE_NUMBER);
				for (; e.length > 0 && !n(i, a);) e.pop();
				let o = e.length > 0 ? e[e.length - 1] : -1;
				e.push(r), this._startIndexes[r] = i + ((o & 255) << 24), this._endIndexes[r] = a + ((o & 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, n) {
		this._collapseStates.set(e, n);
	}
	isUserDefined(e) {
		return this._userDefinedStates.get(e);
	}
	setUserDefined(e, n) {
		return this._userDefinedStates.set(e, n);
	}
	isRecovered(e) {
		return this._recoveredStates.get(e);
	}
	setRecovered(e, n) {
		return this._recoveredStates.set(e, n);
	}
	getSource(e) {
		return this.isUserDefined(e) ? 1 : this.isRecovered(e) ? 2 : 0;
	}
	setSource(e, n) {
		n === 1 ? (this.setUserDefined(e, !0), this.setRecovered(e, !1)) : n === 2 ? (this.setUserDefined(e, !1), this.setRecovered(e, !0)) : (this.setUserDefined(e, !1), this.setRecovered(e, !1));
	}
	setCollapsedAllOfType(e, n) {
		let r = !1;
		if (this._types) for (let i = 0; i < this._types.length; i++) this._types[i] === e && (this.setCollapsed(i, n), r = !0);
		return r;
	}
	toRegion(e) {
		return new FoldingRegion(this, e);
	}
	getParentIndex(e) {
		this.ensureParentIndices();
		let n = ((this._startIndexes[e] & MASK_INDENT) >>> 24) + ((this._endIndexes[e] & MASK_INDENT) >>> 16);
		return n === 65535 ? -1 : n;
	}
	contains(e, n) {
		return this.getStartLineNumber(e) <= n && this.getEndLineNumber(e) >= n;
	}
	findIndex(e) {
		let n = 0, r = this._startIndexes.length;
		if (r === 0) return -1;
		for (; n < r;) {
			let i = Math.floor((n + r) / 2);
			e < this.getStartLineNumber(i) ? r = i : n = i + 1;
		}
		return n - 1;
	}
	findRange(e) {
		let n = this.findIndex(e);
		if (n >= 0) {
			if (this.getEndLineNumber(n) >= e) return n;
			for (n = this.getParentIndex(n); n !== -1;) {
				if (this.contains(n, e)) return n;
				n = this.getParentIndex(n);
			}
		}
		return -1;
	}
	toString() {
		let e = [];
		for (let n = 0; n < this.length; n++) e[n] = `[${foldSourceAbbr[this.getSource(n)]}${this.isCollapsed(n) ? "+" : "-"}] ${this.getStartLineNumber(n)}/${this.getEndLineNumber(n)}`;
		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(n) {
		let r = n.length, i = new Uint32Array(r), a = new Uint32Array(r), o = [], s = !1;
		for (let e = 0; e < r; e++) {
			let r = n[e];
			i[e] = r.startLineNumber, a[e] = r.endLineNumber, o.push(r.type), r.type && (s = !0);
		}
		s || (o = void 0);
		let c = new e(i, a, o);
		for (let e = 0; e < r; e++) n[e].isCollapsed && c.setCollapsed(e, !0), c.setSource(e, n[e].source);
		return c;
	}
	static sanitizeAndMerge(e, n, r, i) {
		r ??= Number.MAX_VALUE;
		let a = (e, n) => Array.isArray(e) ? ((r) => r < n ? e[r] : void 0) : ((r) => r < n ? e.toFoldRange(r) : void 0), o = a(e, e.length), s = a(n, n.length), c = 0, l = 0, u = o(0), d = s(0), f = [], m, g = 0, _ = [];
		for (; u || d;) {
			let e;
			if (d && (!u || u.startLineNumber >= d.startLineNumber)) u && u.startLineNumber === d.startLineNumber ? (d.source === 1 ? e = d : (e = u, e.isCollapsed = d.isCollapsed && (u.endLineNumber === d.endLineNumber || !i?.startsInside(u.startLineNumber + 1, u.endLineNumber + 1)), e.source = 0), u = o(++c)) : (e = d, d.isCollapsed && d.source === 0 && (e.source = 2)), d = s(++l);
			else {
				let n = l, r = d;
				for (;;) {
					if (!r || r.startLineNumber > u.endLineNumber) {
						e = u;
						break;
					}
					if (r.source === 1 && r.endLineNumber > u.endLineNumber) break;
					r = s(++n);
				}
				u = o(++c);
			}
			if (e) {
				for (; m && m.endLineNumber < e.startLineNumber;) m = f.pop();
				e.endLineNumber > e.startLineNumber && e.startLineNumber > g && e.endLineNumber <= r && (!m || m.endLineNumber >= e.endLineNumber) && (_.push(e), g = e.startLineNumber, m && f.push(m), m = e);
			}
		}
		return _;
	}
}, FoldingRegion = class {
	constructor(e, n) {
		this.ranges = e, this.index = n;
	}
	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, n) {
		this._updateEventEmitter = new Emitter(), this.onDidChange = this._updateEventEmitter.event, this._textModel = e, this._decorationProvider = n, this._regions = new FoldingRegions(new Uint32Array(), new Uint32Array()), this._editorDecorationIds = [];
	}
	toggleCollapseState(e) {
		if (!e.length) return;
		e = e.sort((e, n) => e.regionIndex - n.regionIndex);
		let n = {};
		this._decorationProvider.changeDecorations((r) => {
			let i = 0, a = -1, o = -1, s = (e) => {
				for (; i < e;) {
					let e = this._regions.getEndLineNumber(i), n = this._regions.isCollapsed(i);
					if (e <= a) {
						let a = this.regions.getSource(i) !== 0;
						r.changeDecorationOptions(this._editorDecorationIds[i], this._decorationProvider.getDecorationOption(n, e <= o, a));
					}
					n && e > o && (o = e), i++;
				}
			};
			for (let r of e) {
				let e = r.regionIndex, i = this._editorDecorationIds[e];
				if (i && !n[i]) {
					n[i] = !0, s(e);
					let r = !this._regions.isCollapsed(e);
					this._regions.setCollapsed(e, r), a = Math.max(a, this._regions.getEndLineNumber(e));
				}
			}
			s(this._regions.length);
		}), this._updateEventEmitter.fire({
			model: this,
			collapseStateChanged: e
		});
	}
	removeManualRanges(e) {
		let n = [], r = (n) => {
			for (let r of e) if (!(r.startLineNumber > n.endLineNumber || n.startLineNumber > r.endLineNumber)) return !0;
			return !1;
		};
		for (let e = 0; e < this._regions.length; e++) {
			let i = this._regions.toFoldRange(e);
			(i.source === 0 || !r(i)) && n.push(i);
		}
		this.updatePost(FoldingRegions.fromFoldRanges(n));
	}
	update(e, n) {
		let r = this._currentFoldedOrManualRanges(n), i = FoldingRegions.sanitizeAndMerge(e, r, this._textModel.getLineCount(), n);
		this.updatePost(FoldingRegions.fromFoldRanges(i));
	}
	updatePost(e) {
		let n = [], r = -1;
		for (let i = 0, a = e.length; i < a; i++) {
			let a = e.getStartLineNumber(i), o = e.getEndLineNumber(i), s = e.isCollapsed(i), c = e.getSource(i) !== 0, l = {
				startLineNumber: a,
				startColumn: this._textModel.getLineMaxColumn(a),
				endLineNumber: o,
				endColumn: this._textModel.getLineMaxColumn(o) + 1
			};
			n.push({
				range: l,
				options: this._decorationProvider.getDecorationOption(s, o <= r, c)
			}), s && o > r && (r = o);
		}
		this._decorationProvider.changeDecorations((e) => this._editorDecorationIds = e.deltaDecorations(this._editorDecorationIds, n)), this._regions = e, this._updateEventEmitter.fire({ model: this });
	}
	_currentFoldedOrManualRanges(e) {
		let n = [];
		for (let r = 0, i = this._regions.length; r < i; r++) {
			let i = this.regions.isCollapsed(r), a = this.regions.getSource(r);
			if (i || a !== 0) {
				let o = this._regions.toFoldRange(r), s = this._textModel.getDecorationRange(this._editorDecorationIds[r]);
				s && (i && e?.startsInside(s.startLineNumber + 1, s.endLineNumber) && (i = !1), n.push({
					startLineNumber: s.startLineNumber,
					endLineNumber: s.endLineNumber,
					type: o.type,
					isCollapsed: i,
					source: a
				}));
			}
		}
		return n;
	}
	getMemento() {
		let e = this._currentFoldedOrManualRanges(), n = [], r = this._textModel.getLineCount();
		for (let i = 0, a = e.length; i < a; i++) {
			let a = e[i];
			if (a.startLineNumber >= a.endLineNumber || a.startLineNumber < 1 || a.endLineNumber > r) continue;
			let o = this._getLinesChecksum(a.startLineNumber + 1, a.endLineNumber);
			n.push({
				startLineNumber: a.startLineNumber,
				endLineNumber: a.endLineNumber,
				isCollapsed: a.isCollapsed,
				source: a.source,
				checksum: o
			});
		}
		return n.length > 0 ? n : void 0;
	}
	applyMemento(e) {
		if (!Array.isArray(e)) return;
		let n = [], r = this._textModel.getLineCount();
		for (let i of e) {
			if (i.startLineNumber >= i.endLineNumber || i.startLineNumber < 1 || i.endLineNumber > r) continue;
			let e = this._getLinesChecksum(i.startLineNumber + 1, i.endLineNumber);
			(!i.checksum || e === i.checksum) && n.push({
				startLineNumber: i.startLineNumber,
				endLineNumber: i.endLineNumber,
				type: void 0,
				isCollapsed: i.isCollapsed ?? !0,
				source: i.source ?? 0
			});
		}
		let i = FoldingRegions.sanitizeAndMerge(this._regions, n, r);
		this.updatePost(FoldingRegions.fromFoldRanges(i));
	}
	_getLinesChecksum(e, n) {
		return hash(this._textModel.getLineContent(e) + this._textModel.getLineContent(n)) % 1e6;
	}
	dispose() {
		this._decorationProvider.removeDecorations(this._editorDecorationIds);
	}
	getAllRegionsAtLine(e, n) {
		let r = [];
		if (this._regions) {
			let i = this._regions.findRange(e), a = 1;
			for (; i >= 0;) {
				let e = this._regions.toRegion(i);
				(!n || n(e, a)) && r.push(e), a++, i = e.parentIndex;
			}
		}
		return r;
	}
	getRegionAtLine(e) {
		if (this._regions) {
			let n = this._regions.findRange(e);
			if (n >= 0) return this._regions.toRegion(n);
		}
		return null;
	}
	getRegionsInside(e, n) {
		let r = [], i = e ? e.regionIndex + 1 : 0, a = e ? e.endLineNumber : Number.MAX_VALUE;
		if (n && n.length === 2) {
			let e = [];
			for (let o = i, s = this._regions.length; o < s; o++) {
				let i = this._regions.toRegion(o);
				if (this._regions.getStartLineNumber(o) < a) {
					for (; e.length > 0 && !i.containedBy(e[e.length - 1]);) e.pop();
					e.push(i), n(i, e.length) && r.push(i);
				} else break;
			}
		} else for (let e = i, o = this._regions.length; e < o; e++) {
			let i = this._regions.toRegion(e);
			if (this._regions.getStartLineNumber(e) < a) (!n || n(i)) && r.push(i);
			else break;
		}
		return r;
	}
};
function toggleCollapseState(e, n, r) {
	let i = [];
	for (let a of r) {
		let r = e.getRegionAtLine(a);
		if (r) {
			let a = !r.isCollapsed;
			if (i.push(r), n > 1) {
				let o = e.getRegionsInside(r, (e, r) => e.isCollapsed !== a && r < n);
				i.push(...o);
			}
		}
	}
	e.toggleCollapseState(i);
}
function setCollapseStateLevelsDown(e, n, r = Number.MAX_VALUE, i) {
	let a = [];
	if (i && i.length > 0) for (let o of i) {
		let i = e.getRegionAtLine(o);
		if (i && (i.isCollapsed !== n && a.push(i), r > 1)) {
			let o = e.getRegionsInside(i, (e, i) => e.isCollapsed !== n && i < r);
			a.push(...o);
		}
	}
	else {
		let i = e.getRegionsInside(null, (e, i) => e.isCollapsed !== n && i < r);
		a.push(...i);
	}
	e.toggleCollapseState(a);
}
function setCollapseStateLevelsUp(e, n, r, i) {
	let a = [];
	for (let o of i) {
		let i = e.getAllRegionsAtLine(o, (e, i) => e.isCollapsed !== n && i <= r);
		a.push(...i);
	}
	e.toggleCollapseState(a);
}
function setCollapseStateUp(e, n, r) {
	let i = [];
	for (let a of r) {
		let r = e.getAllRegionsAtLine(a, (e) => e.isCollapsed !== n);
		r.length > 0 && i.push(r[0]);
	}
	e.toggleCollapseState(i);
}
function setCollapseStateAtLevel(e, n, r, i) {
	let a = e.getRegionsInside(null, (e, a) => a === n && e.isCollapsed !== r && !i.some((n) => e.containsLine(n)));
	e.toggleCollapseState(a);
}
function setCollapseStateForRest(e, n, r) {
	let i = [];
	for (let n of r) {
		let r = e.getAllRegionsAtLine(n, void 0);
		r.length > 0 && i.push(r[0]);
	}
	let a = e.getRegionsInside(null, (e) => i.every((n) => !n.containedBy(e) && !e.containedBy(n)) && e.isCollapsed !== n);
	e.toggleCollapseState(a);
}
function setCollapseStateForMatchingLines(e, n, r) {
	let i = e.textModel, a = e.regions, o = [];
	for (let e = a.length - 1; e >= 0; e--) if (r !== a.isCollapsed(e)) {
		let r = a.getStartLineNumber(e);
		n.test(i.getLineContent(r)) && o.push(a.toRegion(e));
	}
	e.toggleCollapseState(o);
}
function setCollapseStateForType(e, n, r) {
	let i = e.regions, a = [];
	for (let e = i.length - 1; e >= 0; e--) r !== i.isCollapsed(e) && n === i.getType(e) && a.push(i.toRegion(e));
	e.toggleCollapseState(a);
}
function getParentFoldLine(e, n) {
	let r = null, i = n.getRegionAtLine(e);
	if (i !== null && (r = i.startLineNumber, e === r)) {
		let e = i.parentIndex;
		r = e === -1 ? null : n.regions.getStartLineNumber(e);
	}
	return r;
}
function getPreviousFoldLine(e, n) {
	let r = n.getRegionAtLine(e);
	if (r !== null && r.startLineNumber === e) {
		if (e !== r.startLineNumber) return r.startLineNumber;
		{
			let e = r.parentIndex, i = 0;
			for (e !== -1 && (i = n.regions.getStartLineNumber(r.parentIndex)); r !== null;) if (r.regionIndex > 0) {
				if (r = n.regions.toRegion(r.regionIndex - 1), r.startLineNumber <= i) return null;
				if (r.parentIndex === e) return r.startLineNumber;
			} else return null;
		}
	} else if (n.regions.length > 0) for (r = n.regions.toRegion(n.regions.length - 1); r !== null;) {
		if (r.startLineNumber < e) return r.startLineNumber;
		r = r.regionIndex > 0 ? n.regions.toRegion(r.regionIndex - 1) : null;
	}
	return null;
}
function getNextFoldLine(e, n) {
	let r = n.getRegionAtLine(e);
	if (r !== null && r.startLineNumber === e) {
		let e = r.parentIndex, i = 0;
		if (e !== -1) i = n.regions.getEndLineNumber(r.parentIndex);
		else if (n.regions.length === 0) return null;
		else i = n.regions.getEndLineNumber(n.regions.length - 1);
		for (; r !== null;) if (r.regionIndex < n.regions.length) {
			if (r = n.regions.toRegion(r.regionIndex + 1), r.startLineNumber >= i) return null;
			if (r.parentIndex === e) return r.startLineNumber;
		} else return null;
	} else if (n.regions.length > 0) for (r = n.regions.toRegion(0); r !== null;) {
		if (r.startLineNumber > e) return r.startLineNumber;
		r = r.regionIndex < n.regions.length ? n.regions.toRegion(r.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, n = [], r = 0, i = 0, a = Number.MAX_VALUE, o = -1, s = this._foldingModel.regions;
		for (; r < s.length; r++) {
			if (!s.isCollapsed(r)) continue;
			let c = s.getStartLineNumber(r) + 1, l = s.getEndLineNumber(r);
			a <= c && l <= o || (!e && i < this._hiddenRanges.length && this._hiddenRanges[i].startLineNumber === c && this._hiddenRanges[i].endLineNumber === l ? (n.push(this._hiddenRanges[i]), i++) : (e = !0, n.push(new Range(c, 1, l, 1))), a = c, o = l);
		}
		(this._hasLineChanges || e || i < this._hiddenRanges.length) && this.applyHiddenRanges(n);
	}
	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 n = !1, r = this._foldingModel.textModel, i = null, a = (e) => ((!i || !isInside(e, i)) && (i = findRange(this._hiddenRanges, e)), i ? i.startLineNumber - 1 : null);
		for (let i = 0, o = e.length; i < o; i++) {
			let o = e[i], s = a(o.startLineNumber);
			s && (o = o.setStartPosition(s, r.getLineMaxColumn(s)), n = !0);
			let c = a(o.endLineNumber);
			c && (o = o.setEndPosition(c, r.getLineMaxColumn(c)), n = !0), e[i] = o;
		}
		return n;
	}
	dispose() {
		this.hiddenRanges.length > 0 && (this._hiddenRanges = [], this._updateEventEmitter.fire(this._hiddenRanges)), this._foldingModelListener &&= (this._foldingModelListener.dispose(), null);
	}
};
function isInside(e, n) {
	return e >= n.startLineNumber && e <= n.endLineNumber;
}
function findRange(e, n) {
	let r = findFirstIdxMonotonousOrArrLen(e, (e) => n < e.startLineNumber) - 1;
	return r >= 0 && e[r].endLineNumber >= n ? e[r] : null;
}
var MAX_FOLDING_REGIONS_FOR_INDENT_DEFAULT = 5e3, ID_INDENT_PROVIDER = "indent", IndentRangeProvider = class {
	constructor(e, n, r) {
		this.editorModel = e, this.languageConfigurationService = n, this.foldingRangesLimit = r, this.id = ID_INDENT_PROVIDER;
	}
	dispose() {}
	compute(e) {
		let n = this.languageConfigurationService.getLanguageConfiguration(this.editorModel.getLanguageId()).foldingRules, r = n && !!n.offSide, i = n && n.markers;
		return Promise.resolve(computeRanges(this.editorModel, r, i, this.foldingRangesLimit));
	}
}, RangesCollector$1 = class {
	constructor(e) {
		this._startIndexes = [], this._endIndexes = [], this._indentOccurrences = [], this._length = 0, this._foldingRangesLimit = e;
	}
	insertFirst(e, n, r) {
		if (e > 16777215 || n > 16777215) return;
		let i = this._length;
		this._startIndexes[i] = e, this._endIndexes[i] = n, this._length++, r < 1e3 && (this._indentOccurrences[r] = (this._indentOccurrences[r] || 0) + 1);
	}
	toIndentRanges(e) {
		let n = this._foldingRangesLimit.limit;
		if (this._length <= n) {
			this._foldingRangesLimit.update(this._length, !1);
			let e = new Uint32Array(this._length), n = new Uint32Array(this._length);
			for (let r = this._length - 1, i = 0; r >= 0; r--, i++) e[i] = this._startIndexes[r], n[i] = this._endIndexes[r];
			return new FoldingRegions(e, n);
		} else {
			this._foldingRangesLimit.update(this._length, n);
			let r = 0, i = this._indentOccurrences.length;
			for (let e = 0; e < this._indentOccurrences.length; e++) {
				let a = this._indentOccurrences[e];
				if (a) {
					if (a + r > n) {
						i = e;
						break;
					}
					r += a;
				}
			}
			let a = e.getOptions().tabSize, o = new Uint32Array(n), s = new Uint32Array(n);
			for (let c = this._length - 1, l = 0; c >= 0; c--) {
				let u = this._startIndexes[c], d = e.getLineContent(u), f = computeIndentLevel(d, a);
				(f < i || f === i && r++ < n) && (o[l] = u, s[l] = this._endIndexes[c], l++);
			}
			return new FoldingRegions(o, s);
		}
	}
}, foldingRangesLimitDefault = {
	limit: MAX_FOLDING_REGIONS_FOR_INDENT_DEFAULT,
	update: () => {}
};
function computeRanges(e, n, r, i = foldingRangesLimitDefault) {
	let a = e.getOptions().tabSize, o = new RangesCollector$1(i), s;
	r && (s = /* @__PURE__ */ RegExp(`(${r.start.source})|(?:${r.end.source})`));
	let c = [], l = e.getLineCount() + 1;
	c.push({
		indent: -1,
		endAbove: l,
		line: l
	});
	for (let r = e.getLineCount(); r > 0; r--) {
		let i = e.getLineContent(r), l = computeIndentLevel(i, a), u = c[c.length - 1];
		if (l === -1) {
			n && (u.endAbove = r);
			continue;
		}
		let d;
		if (s && (d = i.match(s))) if (d[1]) {
			let e = c.length - 1;
			for (; e > 0 && c[e].indent !== -2;) e--;
			if (e > 0) {
				c.length = e + 1, u = c[e], o.insertFirst(r, u.line, l), u.line = r, u.indent = l, u.endAbove = r;
				continue;
			}
		} else {
			c.push({
				indent: -2,
				endAbove: r,
				line: r
			});
			continue;
		}
		if (u.indent > l) {
			do
				c.pop(), u = c[c.length - 1];
			while (u.indent > l);
			let e = u.endAbove - 1;
			e - r >= 1 && o.insertFirst(r, e, l);
		}
		u.indent === l ? u.endAbove = r : c.push({
			indent: l,
			endAbove: r,
			line: r
		});
	}
	return o.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(n, r, i) {
		return r ? e.HIDDEN_RANGE_DECORATION : this.showFoldingControls === "never" ? n ? this.showFoldingHighlights ? e.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION : e.NO_CONTROLS_COLLAPSED_RANGE_DECORATION : e.NO_CONTROLS_EXPANDED_RANGE_DECORATION : n ? i ? 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" ? i ? e.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION : e.EXPANDED_AUTO_HIDE_VISUAL_DECORATION : i ? 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, n, r, i, a) {
		this.editorModel = e, this.providers = n, this.handleFoldingRangesChange = r, this.foldingRangesLimit = i, this.fallbackRangeProvider = a, this.id = ID_SYNTAX_PROVIDER, this.disposables = new DisposableStore(), a && this.disposables.add(a);
		for (let e of n) typeof e.onDidChange == "function" && this.disposables.add(e.onDidChange(r));
	}
	compute(e) {
		return collectSyntaxRanges(this.providers, this.editorModel, e).then((n) => n ? sanitizeRanges(n, this.foldingRangesLimit) : this.fallbackRangeProvider?.compute(e) ?? null);
	}
	dispose() {
		this.disposables.dispose();
	}
};
function collectSyntaxRanges(e, n, r) {
	let i = null, a = e.map((e, a) => Promise.resolve(e.provideFoldingRanges(n, foldingContext, r)).then((e) => {
		if (!r.isCancellationRequested && Array.isArray(e)) {
			Array.isArray(i) || (i = []);
			let r = n.getLineCount();
			for (let n of e) n.start > 0 && n.end > n.start && n.end <= r && i.push({
				start: n.start,
				end: n.end,
				rank: a,
				kind: n.kind
			});
		}
	}, onUnexpectedExternalError));
	return Promise.all(a).then((e) => i);
}
var RangesCollector = class {
	constructor(e) {
		this._startIndexes = [], this._endIndexes = [], this._nestingLevels = [], this._nestingLevelCounts = [], this._types = [], this._length = 0, this._foldingRangesLimit = e;
	}
	add(e, n, r, i) {
		if (e > 16777215 || n > 16777215) return;
		let a = this._length;
		this._startIndexes[a] = e, this._endIndexes[a] = n, this._nestingLevels[a] = i, this._types[a] = r, this._length++, i < 30 && (this._nestingLevelCounts[i] = (this._nestingLevelCounts[i] || 0) + 1);
	}
	toIndentRanges() {
		let e = this._foldingRangesLimit.limit;
		if (this._length <= e) {
			this._foldingRangesLimit.update(this._length, !1);
			let e = new Uint32Array(this._length), n = new Uint32Array(this._length);
			for (let r = 0; r < this._length; r++) e[r] = this._startIndexes[r], n[r] = this._endIndexes[r];
			return new FoldingRegions(e, n, this._types);
		} else {
			this._foldingRangesLimit.update(this._length, e);
			let n = 0, r = this._nestingLevelCounts.length;
			for (let i = 0; i < this._nestingLevelCounts.length; i++) {
				let a = this._nestingLevelCounts[i];
				if (a) {
					if (a + n > e) {
						r = i;
						break;
					}
					n += a;
				}
			}
			let i = new Uint32Array(e), a = new Uint32Array(e), o = [];
			for (let s = 0, c = 0; s < this._length; s++) {
				let l = this._nestingLevels[s];
				(l < r || l === r && n++ < e) && (i[c] = this._startIndexes[s], a[c] = this._endIndexes[s], o[c] = this._types[s], c++);
			}
			return new FoldingRegions(i, a, o);
		}
	}
};
function sanitizeRanges(e, n) {
	let r = e.sort((e, n) => {
		let r = e.start - n.start;
		return r === 0 && (r = e.rank - n.rank), r;
	}), i = new RangesCollector(n), a, o = [];
	for (let e of r) if (!a) a = e, i.add(e.start, e.end, e.kind && e.kind.value, o.length);
	else if (e.start > a.start) if (e.end <= a.end) o.push(a), a = e, i.add(e.start, e.end, e.kind && e.kind.value, o.length);
	else {
		if (e.start > a.end) {
			do
				a = o.pop();
			while (a && e.start > a.end);
			a && o.push(a), a = e;
		}
		i.add(e.start, e.end, e.kind && e.kind.value, o.length);
	}
	return i.toIndentRanges();
}
var __decorate$67 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$67 = function(e, n) {
	return function(r, i) {
		n(r, i, 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, n) {
		let r = e.foldingRangeProvider.ordered(n);
		return FoldingController_1._foldingRangeSelector?.(r, n) ?? r;
	}
	constructor(e, n, r, i, a, o) {
		super(), this.contextKeyService = n, this.languageConfigurationService = r, this.languageFeaturesService = o, this.localToDispose = this._register(new DisposableStore()), this.editor = e, this._foldingLimitReporter = new RangesLimitReporter(e);
		let s = this.editor.getOptions();
		this._isEnabled = s.get(43), this._useFoldingProviders = s.get(44) !== "indentation", this._unfoldOnClickAfterEndOfLine = s.get(48), this._restoringViewState = !1, this._currentModelHasFoldedImports = !1, this._foldingImportsByDefault = s.get(46), this.updateDebounceInfo = a.for(o.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 = s.get(111), this.foldingDecorationProvider.showFoldingHighlights = s.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 n = this.foldingModel.getMemento(), r = this.rangeProvider ? this.rangeProvider.id : void 0;
			return {
				collapsedRegions: n,
				lineCount: e.getLineCount(),
				provider: r,
				foldedImports: this._currentModelHasFoldedImports
			};
		}
	}
	restoreViewState(e) {
		let n = this.editor.getModel();
		if (!(!n || !this._isEnabled || n.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 n = new IndentRangeProvider(e, this.languageConfigurationService, this._foldingLimitReporter);
		if (this.rangeProvider = n, this._useFoldingProviders && this.foldingModel) {
			let r = FoldingController_1.getFoldingRangeProviders(this.languageFeaturesService, e);
			r.length > 0 && (this.rangeProvider = new SyntaxRangeProvider(e, r, () => this.triggerFoldingModelChanged(), this._foldingLimitReporter, n));
		}
		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 n = new StopWatch(), r = this.getRangeProvider(e.textModel), i = this.foldingRegionPromise = createCancelablePromise((e) => r.compute(e));
			return i.then((r) => {
				if (r && i === this.foldingRegionPromise) {
					let i;
					if (this._foldingImportsByDefault && !this._currentModelHasFoldedImports) {
						let e = r.setCollapsedAllOfType(FoldingRangeKind.Imports.value, !0);
						e && (i = StableEditorScrollState.capture(this.editor), this._currentModelHasFoldedImports = e);
					}
					let a = this.editor.getSelections();
					e.update(r, toSelectedLines(a)), i?.restore(this.editor);
					let o = this.updateDebounceInfo.update(e.textModel, n.elapsed());
					this.updateScheduler && (this.updateScheduler.defaultDelay = o);
				}
				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 n = this.editor.getSelections();
				if (n && n.length > 0) {
					let r = [];
					for (let i of n) {
						let n = i.selectionStartLineNumber;
						this.hiddenRangeModel && this.hiddenRangeModel.isHidden(n) && r.push(...e.getAllRegionsAtLine(n, (e) => e.isCollapsed && n > e.startLineNumber));
					}
					r.length && (e.toggleCollapseState(r), this.reveal(n[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 n = e.target.range, r = !1;
		switch (e.target.type) {
			case 4: {
				let n = e.target.detail, i = e.target.element.offsetLeft;
				if (n.offsetX - i < 4) return;
				r = !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 && n.startColumn === e.getLineMaxColumn(n.startLineNumber)) break;
				}
				return;
			default: return;
		}
		this.mouseDownInfo = {
			lineNumber: n.startLineNumber,
			iconClicked: r
		};
	}
	onEditorMouseUp(e) {
		let n = this.foldingModel;
		if (!n || !this.mouseDownInfo || !e.target) return;
		let r = this.mouseDownInfo.lineNumber, i = this.mouseDownInfo.iconClicked, a = e.target.range;
		if (!a || a.startLineNumber !== r) return;
		if (i) {
			if (e.target.type !== 4) return;
		} else {
			let e = this.editor.getModel();
			if (!e || a.startColumn !== e.getLineMaxColumn(r)) return;
		}
		let o = n.getRegionAtLine(r);
		if (o && o.startLineNumber === r) {
			let a = o.isCollapsed;
			if (i || a) {
				let i = e.event.altKey, s = [];
				if (i) {
					let e = n.getRegionsInside(null, (e) => !e.containedBy(o) && !o.containedBy(e));
					for (let n of e) n.isCollapsed && s.push(n);
					s.length === 0 && (s = e);
				} else {
					let r = e.event.middleButton || e.event.shiftKey;
					if (r) for (let e of n.getRegionsInside(o)) e.isCollapsed === a && s.push(e);
					(a || !r || s.length === 0) && s.push(o);
				}
				n.toggleCollapseState(s), this.reveal({
					lineNumber: r,
					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, n) {
		(e !== this._computed || n !== this._limited) && (this._computed = e, this._limited = n, this._onDidChange.fire());
	}
}, FoldingAction = class extends EditorAction {
	runEditorCommand(e, n, r) {
		let i = e.get(ILanguageConfigurationService), a = FoldingController.get(n);
		if (!a) return;
		let o = a.getFoldingModel();
		if (o) return this.reportTelemetry(e, n), o.then((e) => {
			if (e) {
				this.invoke(a, e, n, r, i);
				let o = n.getSelection();
				o && a.reveal(o.getStartPosition());
			}
		});
	}
	getSelectedLines(e) {
		let n = e.getSelections();
		return n ? n.map((e) => e.startLineNumber) : [];
	}
	getLineNumbers(e, n) {
		return e && e.selectionLines ? e.selectionLines.map((e) => e + 1) : this.getSelectedLines(n);
	}
	run(e, n) {}
};
function toSelectedLines(e) {
	return !e || e.length === 0 ? { startsInside: () => !1 } : { startsInside(n, r) {
		for (let i of e) {
			let e = i.startLineNumber;
			if (e >= n && e <= r) return !0;
		}
		return !1;
	} };
}
function foldingArgumentsConstraint(e) {
	if (!isUndefined(e)) {
		if (!isObject(e)) return !1;
		let n = e;
		if (!isUndefined(n.levels) && !isNumber(n.levels) || !isUndefined(n.direction) && !isString(n.direction) || !isUndefined(n.selectionLines) && (!Array.isArray(n.selectionLines) || !n.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, n, r, i) {
		let a = i && i.levels || 1, o = this.getLineNumbers(i, r);
		i && i.direction === "up" ? setCollapseStateLevelsUp(n, !1, a, o) : setCollapseStateLevelsDown(n, !1, a, o);
	}
}, 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, n, r, i) {
		setCollapseStateLevelsDown(n, !1, Number.MAX_VALUE, this.getSelectedLines(r));
	}
}, 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, n, r, i) {
		let a = this.getLineNumbers(i, r), o = i && i.levels, s = i && i.direction;
		typeof o != "number" && typeof s != "string" ? setCollapseStateUp(n, !0, a) : s === "up" ? setCollapseStateLevelsUp(n, !0, o || 1, a) : setCollapseStateLevelsDown(n, !0, o || 1, a);
	}
}, 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, n, r) {
		let i = this.getSelectedLines(r);
		toggleCollapseState(n, 1, i);
	}
}, 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, n, r) {
		let i = this.getSelectedLines(r);
		setCollapseStateLevelsDown(n, !0, Number.MAX_VALUE, i);
	}
}, 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, n, r) {
		let i = this.getSelectedLines(r);
		toggleCollapseState(n, Number.MAX_VALUE, i);
	}
}, 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, n, r, i, a) {
		if (n.regions.hasTypes()) setCollapseStateForType(n, FoldingRangeKind.Comment.value, !0);
		else {
			let e = r.getModel();
			if (!e) return;
			let i = a.getLanguageConfiguration(e.getLanguageId()).comments;
			if (i && i.blockCommentStartToken) {
				let e = /* @__PURE__ */ RegExp("^\\s*" + escapeRegExpCharacters(i.blockCommentStartToken));
				setCollapseStateForMatchingLines(n, 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, n, r, i, a) {
		if (n.regions.hasTypes()) setCollapseStateForType(n, FoldingRangeKind.Region.value, !0);
		else {
			let e = r.getModel();
			if (!e) return;
			let i = a.getLanguageConfiguration(e.getLanguageId()).foldingRules;
			if (i && i.markers && i.markers.start) {
				let e = new RegExp(i.markers.start);
				setCollapseStateForMatchingLines(n, 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, n, r, i, a) {
		if (n.regions.hasTypes()) setCollapseStateForType(n, FoldingRangeKind.Region.value, !1);
		else {
			let e = r.getModel();
			if (!e) return;
			let i = a.getLanguageConfiguration(e.getLanguageId()).foldingRules;
			if (i && i.markers && i.markers.start) {
				let e = new RegExp(i.markers.start);
				setCollapseStateForMatchingLines(n, 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, n, r) {
		let i = this.getSelectedLines(r);
		setCollapseStateForRest(n, !0, i);
	}
}, 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, n, r) {
		let i = this.getSelectedLines(r);
		setCollapseStateForRest(n, !1, i);
	}
}, 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, n, r) {
		setCollapseStateLevelsDown(n, !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, n, r) {
		setCollapseStateLevelsDown(n, !1);
	}
}, FoldLevelAction = class e extends FoldingAction {
	static {
		this.ID_PREFIX = "editor.foldLevel";
	}
	static {
		this.ID = (n) => e.ID_PREFIX + n;
	}
	getFoldingLevel() {
		return parseInt(this.id.substr(e.ID_PREFIX.length));
	}
	invoke(e, n, r) {
		setCollapseStateAtLevel(n, this.getFoldingLevel(), !0, this.getSelectedLines(r));
	}
}, 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, n, r) {
		let i = this.getSelectedLines(r);
		if (i.length > 0) {
			let e = getParentFoldLine(i[0], n);
			e !== null && r.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, n, r) {
		let i = this.getSelectedLines(r);
		if (i.length > 0) {
			let e = getPreviousFoldLine(i[0], n);
			e !== null && r.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, n, r) {
		let i = this.getSelectedLines(r);
		if (i.length > 0) {
			let e = getNextFoldLine(i[0], n);
			e !== null && r.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, n, r) {
		let i = [], a = r.getSelections();
		if (a) {
			for (let e of a) {
				let n = e.endLineNumber;
				e.endColumn === 1 && --n, n > e.startLineNumber && (i.push({
					startLineNumber: e.startLineNumber,
					endLineNumber: n,
					type: void 0,
					isCollapsed: !0,
					source: 1
				}), r.setSelection({
					startLineNumber: e.startLineNumber,
					startColumn: 1,
					endLineNumber: e.startLineNumber,
					endColumn: 1
				}));
			}
			if (i.length > 0) {
				i.sort((e, n) => e.startLineNumber - n.startLineNumber);
				let e = FoldingRegions.sanitizeAndMerge(n.regions, i, r.getModel()?.getLineCount());
				n.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, n, r) {
		let i = r.getSelections();
		if (i) {
			let r = [];
			for (let e of i) {
				let { startLineNumber: n, endLineNumber: i } = e;
				r.push(i >= n ? {
					startLineNumber: n,
					endLineNumber: i
				} : {
					endLineNumber: i,
					startLineNumber: n
				});
			}
			n.removeManualRanges(r), 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, ...n) {
	let [r] = n;
	if (!(r instanceof URI)) throw illegalArgument();
	let i = e.get(ILanguageFeaturesService), o = e.get(IModelService).getModel(r);
	if (!o) throw illegalArgument();
	let s = e.get(IConfigurationService);
	if (!s.getValue("editor.folding", { resource: r })) return [];
	let c = e.get(ILanguageConfigurationService), l = s.getValue("editor.foldingStrategy", { resource: r }), u = {
		get limit() {
			return s.getValue("editor.foldingMaximumRegions", { resource: r });
		},
		update: (e, n) => {}
	}, d = new IndentRangeProvider(o, c, u), f = d;
	if (l !== "indentation") {
		let e = FoldingController.getFoldingRangeProviders(i, o);
		e.length && (f = new SyntaxRangeProvider(o, e, () => {}, u, d));
	}
	let m = await f.compute(CancellationToken.None), g = [];
	try {
		if (m) for (let e = 0; e < m.length; e++) {
			let n = m.getType(e);
			g.push({
				start: m.getStartLineNumber(e),
				end: m.getEndLineNumber(e),
				kind: n ? FoldingRangeKind.fromValue(n) : void 0
			});
		}
		return g;
	} finally {
		f.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, n) {
		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, n) {
		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, n) {
		EditorZoom.setZoomLevel(0);
	}
};
registerEditorAction(EditorFontZoomIn), registerEditorAction(EditorFontZoomOut), registerEditorAction(EditorFontZoomReset);
var __decorate$66 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$66 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, FormatOnType = class {
	static {
		this.ID = "editor.contrib.autoFormat";
	}
	constructor(e, n, r, i) {
		this._editor = e, this._languageFeaturesService = n, this._workerService = r, this._accessibilitySignalService = i, this._disposables = new DisposableStore(), this._sessionDisposables = new DisposableStore(), this._disposables.add(n.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(), [n] = this._languageFeaturesService.onTypeFormattingEditProvider.ordered(e);
		if (!n || !n.autoFormatTriggerCharacters) return;
		let r = new CharacterSet();
		for (let e of n.autoFormatTriggerCharacters) r.add(e.charCodeAt(0));
		this._sessionDisposables.add(this._editor.onDidType((e) => {
			let n = e.charCodeAt(e.length - 1);
			r.has(n) && this._trigger(String.fromCharCode(n));
		}));
	}
	_trigger(e) {
		if (!this._editor.hasModel() || this._editor.getSelections().length > 1 || !this._editor.getSelection().isEmpty()) return;
		let n = this._editor.getModel(), r = this._editor.getPosition(), i = new CancellationTokenSource(), a = this._editor.onDidChangeModelContent((e) => {
			if (e.isFlush) {
				i.cancel(), a.dispose();
				return;
			}
			for (let n = 0, o = e.changes.length; n < o; n++) if (e.changes[n].range.endLineNumber <= r.lineNumber) {
				i.cancel(), a.dispose();
				return;
			}
		});
		getOnTypeFormattingEdits(this._workerService, this._languageFeaturesService, n, r, e, n.getFormattingOptions(), i.token).then((e) => {
			i.token.isCancellationRequested || isNonEmptyArray(e) && (this._accessibilitySignalService.playSignal(AccessibilitySignal.format, { userGesture: !1 }), FormattingEdit.execute(this._editor, e, !0));
		}).finally(() => {
			a.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, n, r) {
		this.editor = e, this._languageFeaturesService = n, this._instantiationService = r, 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(n.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, n) {
		if (n.hasModel()) {
			let r = e.get(IInstantiationService);
			await e.get(IEditorProgressService).showWhile(r.invokeFunction(formatDocumentWithSelectedProvider, n, 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, n) {
		if (!n.hasModel()) return;
		let r = e.get(IInstantiationService), i = n.getModel(), a = n.getSelections().map((e) => e.isEmpty() ? new Range(e.startLineNumber, 1, e.startLineNumber, i.getLineMaxColumn(e.startLineNumber)) : e);
		await e.get(IEditorProgressService).showWhile(r.invokeFunction(formatDocumentRangesWithSelectedProvider, n, a, 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 n = e.get(ICodeEditorService).getFocusedCodeEditor();
	if (!n || !n.hasModel()) return;
	let r = e.get(ICommandService);
	n.getSelection().isEmpty() ? await r.executeCommand("editor.action.formatDocument") : await r.executeCommand("editor.action.formatSelection");
});
var __decorate$65 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$65 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, TreeElement = class {
	remove() {
		this.parent?.children.delete(this.id);
	}
	static findId(e, n) {
		let r;
		typeof e == "string" ? r = `${n.id}/${e}` : (r = `${n.id}/${e.name}`, n.children.get(r) !== void 0 && (r = `${n.id}/${e.name}_${e.range.startLineNumber}_${e.range.startColumn}`));
		let i = r;
		for (let e = 0; n.children.get(i) !== void 0; e++) i = `${r}_${e}`;
		return i;
	}
	static empty(e) {
		return e.children.size === 0;
	}
}, OutlineElement = class extends TreeElement {
	constructor(e, n, r) {
		super(), this.id = e, this.parent = n, this.symbol = r, this.children = /* @__PURE__ */ new Map();
	}
}, OutlineGroup = class extends TreeElement {
	constructor(e, n, r, i) {
		super(), this.id = e, this.parent = n, this.label = r, this.order = i, this.children = /* @__PURE__ */ new Map();
	}
}, OutlineModel = class e extends TreeElement {
	static create(n, r, i) {
		let a = new CancellationTokenSource(i), o = new e(r.uri), s = n.ordered(r), c = s.map((n, i) => {
			let s = TreeElement.findId(`provider_${i}`, o), c = new OutlineGroup(s, o, n.displayName ?? "Unknown Outline Provider", i);
			return Promise.resolve(n.provideDocumentSymbols(r, a.token)).then((n) => {
				for (let r of n || []) e._makeOutlineElement(r, c);
				return c;
			}, (e) => (onUnexpectedExternalError(e), c)).then((e) => {
				TreeElement.empty(e) ? e.remove() : o._groups.set(s, e);
			});
		}), l = n.onDidChange(() => {
			let e = n.ordered(r);
			equals(e, s) || a.cancel();
		});
		return Promise.all(c).then(() => a.token.isCancellationRequested && !i.isCancellationRequested ? e.create(n, r, i) : o._compact()).finally(() => {
			a.dispose(), l.dispose(), a.dispose();
		});
	}
	static _makeOutlineElement(n, r) {
		let i = TreeElement.findId(n, r), a = new OutlineElement(i, r, n);
		if (n.children) for (let r of n.children) e._makeOutlineElement(r, a);
		r.children.set(a.id, a);
	}
	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 [n, r] of this._groups) r.children.size === 0 ? this._groups.delete(n) : e += 1;
		if (e !== 1) this.children = this._groups;
		else {
			let e = Iterable.first(this._groups.values());
			for (let [, n] of e.children) n.parent = this, this.children.set(n.id, n);
		}
		return this;
	}
	getTopLevelSymbols() {
		let e = [];
		for (let n of this.children.values()) n instanceof OutlineElement ? e.push(n.symbol) : e.push(...Iterable.map(n.children.values(), (e) => e.symbol));
		return e.sort((e, n) => Range.compareRangesUsingStarts(e.range, n.range));
	}
	asListOfDocumentSymbols() {
		let n = this.getTopLevelSymbols(), r = [];
		return e._flattenDocumentSymbols(r, n, ""), r.sort((e, n) => Position.compare(Range.getStartPosition(e.range), Range.getStartPosition(n.range)) || Position.compare(Range.getEndPosition(n.range), Range.getEndPosition(e.range)));
	}
	static _flattenDocumentSymbols(n, r, i) {
		for (let a of r) n.push({
			kind: a.kind,
			tags: a.tags,
			name: a.name,
			detail: a.detail,
			containerName: a.containerName || i,
			range: a.range,
			selectionRange: a.selectionRange,
			children: void 0
		}), a.children && e._flattenDocumentSymbols(n, a.children, a.name);
	}
};
const IOutlineModelService = createDecorator("IOutlineModelService");
var OutlineModelService = class {
	constructor(e, n, r) {
		this._languageFeaturesService = e, this._disposables = new DisposableStore(), this._cache = new LRUCache(10, .7), this._debounceInformation = n.for(e.documentSymbolProvider, "DocumentSymbols", { min: 350 }), this._disposables.add(r.onModelRemoved((e) => {
			this._cache.delete(e.id);
		}));
	}
	dispose() {
		this._disposables.dispose();
	}
	async getOrCreate(e, n) {
		let r = this._languageFeaturesService.documentSymbolProvider, i = r.ordered(e), a = this._cache.get(e.id);
		if (!a || a.versionId !== e.getVersionId() || !equals(a.provider, i)) {
			let n = new CancellationTokenSource();
			a = {
				versionId: e.getVersionId(),
				provider: i,
				promiseCnt: 0,
				source: n,
				promise: OutlineModel.create(r, e, n.token),
				model: void 0
			}, this._cache.set(e.id, a);
			let o = Date.now();
			a.promise.then((n) => {
				a.model = n, this._debounceInformation.update(e, Date.now() - o);
			}).catch((n) => {
				this._cache.delete(e.id);
			});
		}
		if (a.model) return a.model;
		a.promiseCnt += 1;
		let o = n.onCancellationRequested(() => {
			--a.promiseCnt === 0 && (a.source.cancel(), this._cache.delete(e.id));
		});
		try {
			return await a.promise;
		} finally {
			o.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, ...n) {
	let [r] = n;
	assertType(URI.isUri(r));
	let i = e.get(IOutlineModelService), a = await e.get(ITextModelService).createModelReference(r);
	try {
		return (await i.getOrCreate(a.object.textEditorModel, CancellationToken.None)).getTopLevelSymbols();
	} finally {
		a.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(n, r) {
		super(), this.contextKeyService = n, this.model = r, 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 n = this.model.read(e)?.state.read(e), r = !!n?.inlineCompletion && n?.primaryGhostText !== void 0 && !n?.primaryGhostText.isEmpty();
			this.inlineCompletionVisible.set(r), n?.primaryGhostText && n?.inlineCompletion && this.suppressSuggestions.set(n.inlineCompletion.inlineCompletion.source.inlineCompletions.suppressSuggestions);
		})), this._register(autorun((e) => {
			let n = this.model.read(e), r = !1, i = !0, a = n?.primaryGhostText.read(e);
			if (n?.selectedSuggestItem && a && a.parts.length > 0) {
				let { column: e, lines: o } = a.parts[0], s = o[0], c = n.textModel.getLineIndentColumn(a.lineNumber);
				if (e <= c) {
					let e = firstNonWhitespaceIndex(s);
					e === -1 && (e = s.length - 1), r = e > 0;
					let a = n.textModel.getOptions().tabSize;
					i = CursorColumns.visibleColumnFromColumn(s, e + 1, a) < a;
				}
			}
			this.inlineCompletionSuggestsIndentation.set(r), this.inlineCompletionSuggestsIndentationLessThanTabSize.set(i);
		}));
	}
};
function createStyleSheetFromObservable(e) {
	let n = new DisposableStore(), r = n.add(createStyleSheet2());
	return n.add(autorun((n) => {
		r.setStyle(e.read(n));
	})), n;
}
var GhostText = class {
	constructor(e, n) {
		this.lineNumber = e, this.parts = n;
	}
	equals(e) {
		return this.lineNumber === e.lineNumber && this.parts.length === e.parts.length && this.parts.every((n, r) => n.equals(e.parts[r]));
	}
	renderForScreenReader(e) {
		if (this.parts.length === 0) return "";
		let n = this.parts[this.parts.length - 1], r = e.substr(0, n.column - 1);
		return new TextEdit([...this.parts.map((e) => new SingleTextEdit(Range.fromPositions(new Position(1, e.column)), e.lines.join("\n")))]).applyToString(r).substring(this.parts[0].column - 1);
	}
	isEmpty() {
		return this.parts.every((e) => e.lines.length === 0);
	}
	get lineCount() {
		return 1 + this.parts.reduce((e, n) => e + n.lines.length - 1, 0);
	}
}, GhostTextPart = class {
	constructor(e, n, r) {
		this.column = e, this.text = n, this.preview = r, this.lines = splitLines(this.text);
	}
	equals(e) {
		return this.column === e.column && this.lines.length === e.lines.length && this.lines.every((n, r) => n === e.lines[r]);
	}
}, GhostTextReplacement = class {
	constructor(e, n, r, i = 0) {
		this.lineNumber = e, this.columnRange = n, this.text = r, this.additionalReservedLineCount = i, 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((n, r) => n === e.newLines[r]) && this.additionalReservedLineCount === e.additionalReservedLineCount;
	}
};
function ghostTextsOrReplacementsEqual(e, n) {
	return equals(e, n, ghostTextOrReplacementEquals);
}
function ghostTextOrReplacementEquals(e, n) {
	return e === n ? !0 : !e || !n ? !1 : e instanceof GhostText && n instanceof GhostText || e instanceof GhostTextReplacement && n instanceof GhostTextReplacement ? e.equals(n) : !1;
}
var array = [];
function getReadonlyEmptyArray() {
	return array;
}
var ColumnRange = class {
	constructor(e, n) {
		if (this.startColumn = e, this.endColumnExclusive = n, e > n) throw new BugIndicatingError(`startColumn ${e} cannot be after endColumnExclusive ${n}`);
	}
	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, n) {
	let r = new DisposableStore(), i = e.createDecorationsCollection();
	return r.add(autorunOpts({ debugName: () => `Apply decorations from ${n.debugName}` }, (e) => {
		let r = n.read(e);
		i.set(r);
	})), r.add({ dispose: () => {
		i.clear();
	} }), r;
}
function addPositions(e, n) {
	return new Position(e.lineNumber + n.lineNumber - 1, n.lineNumber === 1 ? e.column + n.column - 1 : n.column);
}
function subtractPositions(e, n) {
	return new Position(e.lineNumber - n.lineNumber + 1, e.lineNumber - n.lineNumber === 0 ? e.column - n.column + 1 : e.column);
}
var __decorate$64 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$64 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
};
const GHOST_TEXT_DESCRIPTION = "ghost-text";
var GhostTextView = class extends Disposable {
	constructor(e, n, r) {
		super(), this.editor = e, this.model = n, this.languageService = r, 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 n = this.currentTextModel.read(e);
			if (n !== this.model.targetTextModel.read(e)) return;
			let r = this.model.ghostText.read(e);
			if (!r) return;
			let i = r instanceof GhostTextReplacement ? r.columnRange : void 0, a = [], o = [];
			function s(e, n) {
				if (o.length > 0) {
					let r = o[o.length - 1];
					n && r.decorations.push(new LineDecoration(r.content.length + 1, r.content.length + 1 + e[0].length, n, 0)), r.content += e[0], e = e.slice(1);
				}
				for (let r of e) o.push({
					content: r,
					decorations: n ? [new LineDecoration(1, r.length + 1, n, 0)] : []
				});
			}
			let c = n.getLineContent(r.lineNumber), l, u = 0;
			for (let e of r.parts) {
				let n = e.lines;
				l === void 0 ? (a.push({
					column: e.column,
					text: n[0],
					preview: e.preview
				}), n = n.slice(1)) : s([c.substring(u, e.column - 1)], void 0), n.length > 0 && (s(n, GHOST_TEXT_DESCRIPTION), l === void 0 && e.column <= c.length && (l = e.column)), u = e.column - 1;
			}
			l !== void 0 && s([c.substring(u)], void 0);
			let d = l === void 0 ? void 0 : new ColumnRange(l, c.length + 1);
			return {
				replacedRange: i,
				inlineTexts: a,
				additionalLines: o,
				hiddenRange: d,
				lineNumber: r.lineNumber,
				additionalReservedLineCount: this.model.minReservedLineCount.read(e),
				targetTextModel: n
			};
		}), this.decorations = derived(this, (e) => {
			let n = this.uiState.read(e);
			if (!n) return [];
			let r = [];
			n.replacedRange && r.push({
				range: n.replacedRange.toRange(n.lineNumber),
				options: {
					inlineClassName: "inline-completion-text-to-replace",
					description: "GhostTextReplacement"
				}
			}), n.hiddenRange && r.push({
				range: n.hiddenRange.toRange(n.lineNumber),
				options: {
					inlineClassName: "ghost-text-hidden",
					description: "ghost-text-hidden"
				}
			});
			for (let e of n.inlineTexts) r.push({
				range: Range.fromPositions(new Position(n.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 r;
		}), this.additionalLinesWidget = this._register(new AdditionalLinesWidget(this.editor, this.languageService.languageIdCodec, derived((e) => {
			let n = this.uiState.read(e);
			return n ? {
				lineNumber: n.lineNumber,
				additionalLines: n.additionalLines,
				minReservedLineCount: n.additionalReservedLineCount,
				targetTextModel: n.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, n, r) {
		super(), this.editor = e, this.languageIdCodec = n, this.lines = r, 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 n = this.lines.read(e);
			this.editorOptionsChanged.read(e), n ? this.updateLines(n.lineNumber, n.additionalLines, n.minReservedLineCount) : this.clear();
		}));
	}
	dispose() {
		super.dispose(), this.clear();
	}
	clear() {
		this.editor.changeViewZones((e) => {
			this._viewZoneId &&= (e.removeZone(this._viewZoneId), void 0);
		});
	}
	updateLines(e, n, r) {
		let i = this.editor.getModel();
		if (!i) return;
		let { tabSize: a } = i.getOptions();
		this.editor.changeViewZones((i) => {
			this._viewZoneId &&= (i.removeZone(this._viewZoneId), void 0);
			let o = Math.max(n.length, r);
			if (o > 0) {
				let r = document.createElement("div");
				renderLines(r, a, n, this.editor.getOptions(), this.languageIdCodec), this._viewZoneId = i.addZone({
					afterLineNumber: e,
					heightInLines: o,
					domNode: r,
					afterColumnAffinity: 1
				});
			}
		});
	}
};
function renderLines(e, n, r, i, a) {
	let o = i.get(33), s = i.get(118), l = i.get(95), u = i.get(51), d = i.get(50), f = i.get(67), m = new StringBuilder(1e4);
	m.appendString("<div class=\"suggest-preview-text\">");
	for (let e = 0, i = r.length; e < i; e++) {
		let i = r[e], g = i.content;
		m.appendString("<div class=\"view-line"), m.appendString("\" style=\"top:"), m.appendString(String(e * f)), m.appendString("px;width:1000000px;\">");
		let _ = isBasicASCII(g), v = containsRTL(g), y = LineTokens.createEmpty(g, a);
		renderViewLine(new RenderLineInput(d.isMonospace && !o, d.canUseHalfwidthRightwardsArrow, g, !1, _, v, 0, y, i.decorations, n, 0, d.spaceWidth, d.middotWidth, d.wsmiddotWidth, s, "none", l, u !== EditorFontLigatures.OFF, null), m), m.appendString("</div>");
	}
	m.appendString("</div>"), applyFontInfo(e, d);
	let g = m.build();
	e.innerHTML = ttPolicy ? ttPolicy.createHTML(g) : g;
}
const ttPolicy = createTrustedTypesPolicy("editorGhostText", { createHTML: (e) => e });
function fixBracketsInLine(e, n) {
	let r = new DenseKeyProvider(), i = new LanguageAgnosticBracketTokens(r, (e) => n.getLanguageConfiguration(e)), a = new TextBufferTokenizer(new StaticTokenizerSource([e]), i), o = parseDocument(a, [], void 0, !0), s = "", c = e.getLineContent();
	function l(e, n) {
		if (e.kind === 2) if (l(e.openingBracket, n), n = lengthAdd(n, e.openingBracket.length), e.child && (l(e.child, n), n = lengthAdd(n, e.child.length)), e.closingBracket) l(e.closingBracket, n), n = lengthAdd(n, e.closingBracket.length);
		else {
			let n = i.getSingleLanguageBracketTokens(e.openingBracket.languageId).findClosingTokenText(e.openingBracket.bracketIds);
			s += n;
		}
		else if (e.kind !== 3) {
			if (e.kind === 0 || e.kind === 1) s += c.substring(lengthGetColumnCountIfZeroLineCount(n), lengthGetColumnCountIfZeroLineCount(lengthAdd(n, e.length)));
			else if (e.kind === 4) for (let r of e.children) l(r, n), n = lengthAdd(n, r.length);
		}
	}
	return l(o, 0), s;
}
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, n, r, i, a = CancellationToken.None, o) {
	let s = n instanceof Position ? getDefaultRange(n, r) : n, c = e.all(r), l = new SetMap();
	for (let e of c) e.groupId && l.add(e.groupId, e);
	function u(e) {
		if (!e.yieldsToGroupIds) return [];
		let n = [];
		for (let r of e.yieldsToGroupIds || []) {
			let e = l.get(r);
			for (let r of e) n.push(r);
		}
		return n;
	}
	let d = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Set();
	function m(e, n) {
		if (n = [...n, e], f.has(e)) return n;
		f.add(e);
		try {
			let r = u(e);
			for (let e of r) {
				let r = m(e, n);
				if (r) return r;
			}
		} finally {
			f.delete(e);
		}
	}
	function g(e) {
		let o = d.get(e);
		if (o) return o;
		let s = m(e, []);
		s && onUnexpectedExternalError(/* @__PURE__ */ Error(`Inline completions: cyclic yield-to dependency detected. Path: ${s.map((e) => e.toString ? e.toString() : "" + e).join(" -> ")}`));
		let c = new DeferredPromise();
		return d.set(e, c.p), (async () => {
			if (!s) {
				let n = u(e);
				for (let e of n) {
					let n = await g(e);
					if (n && n.items.length > 0) return;
				}
			}
			try {
				return n instanceof Position ? await e.provideInlineCompletions(r, n, i, a) : await e.provideInlineEdits?.(r, n, i, a);
			} catch (e) {
				onUnexpectedExternalError(e);
				return;
			}
		})().then((e) => c.complete(e), (e) => c.error(e)), c.p;
	}
	let _ = await Promise.all(c.map(async (e) => ({
		provider: e,
		completions: await g(e)
	}))), v = /* @__PURE__ */ new Map(), y = [];
	for (let e of _) {
		let n = e.completions;
		if (!n) continue;
		let i = new InlineCompletionList(n, e.provider);
		y.push(i);
		for (let e of n.items) {
			let n = InlineCompletionItem.from(e, i, s, r, o);
			v.set(n.hash(), n);
		}
	}
	return new InlineCompletionProviderResult(Array.from(v.values()), new Set(v.keys()), y);
}
var InlineCompletionProviderResult = class {
	constructor(e, n, r) {
		this.completions = e, this.hashs = n, this.providerResults = r;
	}
	has(e) {
		return this.hashs.has(e.hash());
	}
	dispose() {
		for (let e of this.providerResults) e.removeRef();
	}
}, InlineCompletionList = class {
	constructor(e, n) {
		this.inlineCompletions = e, this.provider = n, this.refCount = 1;
	}
	addRef() {
		this.refCount++;
	}
	removeRef() {
		this.refCount--, this.refCount === 0 && this.provider.freeInlineCompletions(this.inlineCompletions);
	}
}, InlineCompletionItem = class e {
	static from(n, r, i, a, o) {
		let s, c, l = n.range ? Range.lift(n.range) : i;
		if (typeof n.insertText == "string") {
			if (s = n.insertText, o && n.completeBracketPairs) {
				s = closeBrackets(s, l.getStartPosition(), a, o);
				let e = s.length - n.insertText.length;
				e !== 0 && (l = new Range(l.startLineNumber, l.startColumn, l.endLineNumber, l.endColumn + e));
			}
			c = void 0;
		} else if ("snippet" in n.insertText) {
			let e = n.insertText.snippet.length;
			if (o && n.completeBracketPairs) {
				n.insertText.snippet = closeBrackets(n.insertText.snippet, l.getStartPosition(), a, o);
				let r = n.insertText.snippet.length - e;
				r !== 0 && (l = new Range(l.startLineNumber, l.startColumn, l.endLineNumber, l.endColumn + r));
			}
			let r = new SnippetParser().parse(n.insertText.snippet);
			r.children.length === 1 && r.children[0] instanceof Text ? (s = r.children[0].value, c = void 0) : (s = r.toString(), c = {
				snippet: n.insertText.snippet,
				range: l
			});
		} else assertNever(n.insertText);
		return new e(s, n.command, l, s, c, n.additionalTextEdits || getReadonlyEmptyArray(), n, r);
	}
	constructor(e, n, r, i, a, o, s, c) {
		this.filterText = e, this.command = n, this.range = r, this.insertText = i, this.snippetInfo = a, this.additionalTextEdits = o, this.sourceInlineCompletion = s, this.source = c, e = e.replace(/\r\n|\r/g, "\n"), i = e.replace(/\r\n|\r/g, "\n");
	}
	withRange(n) {
		return new e(this.filterText, this.command, n, 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, n) {
	let r = n.getWordAtPosition(e), i = n.getLineMaxColumn(e.lineNumber);
	return r ? new Range(e.lineNumber, r.startColumn, e.lineNumber, i) : Range.fromPositions(e, e.with(void 0, i));
}
function closeBrackets(e, n, r, i) {
	let a = r.getLineContent(n.lineNumber).substring(0, n.column - 1) + e, o = r.tokenization.tokenizeLineWithEdit(n, a.length - (n.column - 1), e)?.sliceAndInflate(n.column - 1, a.length, 0);
	return o ? fixBracketsInLine(o, i) : e;
}
function singleTextRemoveCommonPrefix(e, n, r) {
	let i = r ? e.range.intersectRanges(r) : e.range;
	if (!i) return e;
	let a = n.getValueInRange(i, 1), o = commonPrefixLength(a, e.text), s = TextLength.ofText(a.substring(0, o)).addToPosition(e.range.getStartPosition()), c = e.text.substring(o), l = Range.fromPositions(s, e.range.getEndPosition());
	return new SingleTextEdit(l, c);
}
function singleTextEditAugments(e, n) {
	return e.text.startsWith(n.text) && rangeExtends(e.range, n.range);
}
function computeGhostText(e, n, r, i, a = 0) {
	let o = singleTextRemoveCommonPrefix(e, n);
	if (o.range.endLineNumber !== o.range.startLineNumber) return;
	let s = n.getLineContent(o.range.startLineNumber), c = getLeadingWhitespace(s).length;
	if (o.range.startColumn - 1 <= c) {
		let e = getLeadingWhitespace(o.text).length, n = s.substring(o.range.startColumn - 1, c), [r, i] = [o.range.getStartPosition(), o.range.getEndPosition()], a = r.column + n.length <= i.column ? r.delta(0, n.length) : i, l = Range.fromPositions(a, i), u = o.text.startsWith(n) ? o.text.substring(n.length) : o.text.substring(e);
		o = new SingleTextEdit(l, u);
	}
	let l = n.getValueInRange(o.range), u = cachingDiff(l, o.text);
	if (!u) return;
	let d = o.range.startLineNumber, f = [];
	if (r === "prefix") {
		let e = u.filter((e) => e.originalLength === 0);
		if (e.length > 1 || e.length === 1 && e[0].originalStart !== l.length) return;
	}
	let m = o.text.length - a;
	for (let e of u) {
		let n = o.range.startColumn + e.originalStart + e.originalLength;
		if (r === "subwordSmart" && i && i.lineNumber === o.range.startLineNumber && n < i.column || e.originalLength > 0) return;
		if (e.modifiedLength === 0) continue;
		let a = e.modifiedStart + e.modifiedLength, s = Math.max(e.modifiedStart, Math.min(a, m)), c = o.text.substring(e.modifiedStart, s), l = o.text.substring(s, Math.max(e.modifiedStart, a));
		c.length > 0 && f.push(new GhostTextPart(n, c, !1)), l.length > 0 && f.push(new GhostTextPart(n, l, !0));
	}
	return new GhostText(d, f);
}
function rangeExtends(e, n) {
	return n.getStartPosition().equals(e.getStartPosition()) && n.getEndPosition().isBeforeOrEqual(e.getEndPosition());
}
var lastRequest = void 0;
function cachingDiff(e, n) {
	if (lastRequest?.originalValue === e && lastRequest?.newValue === n) return lastRequest?.changes;
	{
		let r = smartDiff(e, n, !0);
		if (r) {
			let i = deletedCharacters(r);
			if (i > 0) {
				let a = smartDiff(e, n, !1);
				a && deletedCharacters(a) < i && (r = a);
			}
		}
		return lastRequest = {
			originalValue: e,
			newValue: n,
			changes: r
		}, r;
	}
}
function deletedCharacters(e) {
	let n = 0;
	for (let r of e) n += r.originalLength;
	return n;
}
function smartDiff(e, n, r) {
	if (e.length > 5e3 || n.length > 5e3) return;
	function i(e) {
		let n = 0;
		for (let r = 0, i = e.length; r < i; r++) {
			let i = e.charCodeAt(r);
			i > n && (n = i);
		}
		return n;
	}
	let a = Math.max(i(e), i(n));
	function o(e) {
		if (e < 0) throw Error("unexpected");
		return a + e + 1;
	}
	function s(e) {
		let n = 0, i = 0, a = new Int32Array(e.length);
		for (let s = 0, c = e.length; s < c; s++) if (r && e[s] === "(") {
			let e = i * 100 + n;
			a[s] = o(2 * e), n++;
		} else if (r && e[s] === ")") {
			n = Math.max(n - 1, 0);
			let e = i * 100 + n;
			a[s] = o(2 * e + 1), n === 0 && i++;
		} else a[s] = e.charCodeAt(s);
		return a;
	}
	let c = s(e), l = s(n);
	return new LcsDiff({ getElements: () => c }, { getElements: () => l }).ComputeDiff(!1).changes;
}
var __decorate$63 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$63 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, InlineCompletionsSource = class extends Disposable {
	constructor(e, n, r, i, a) {
		super(), this.textModel = e, this.versionId = n, this._debounceValue = r, this.languageFeaturesService = i, this.languageConfigurationService = a, 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, n, r) {
		let i = new UpdateRequest(e, n, this.textModel.getVersionId()), a = n.selectedSuggestionInfo ? this.suggestWidgetInlineCompletions : this.inlineCompletions;
		if (this._updateOperation.value?.request.satisfies(i)) return this._updateOperation.value.promise;
		if (a.get()?.request.satisfies(i)) return Promise.resolve(!0);
		let o = !!this._updateOperation.value;
		this._updateOperation.clear();
		let s = new CancellationTokenSource(), c = (async () => {
			if ((o || n.triggerKind === InlineCompletionTriggerKind.Automatic) && await wait$1(this._debounceValue.get(this.textModel), s.token), s.token.isCancellationRequested || this._store.isDisposed || this.textModel.getVersionId() !== i.versionId) return !1;
			let c = /* @__PURE__ */ new Date(), l = await provideInlineCompletions(this.languageFeaturesService.inlineCompletionsProvider, e, this.textModel, n, s.token, this.languageConfigurationService);
			if (s.token.isCancellationRequested || this._store.isDisposed || this.textModel.getVersionId() !== i.versionId) return !1;
			let u = /* @__PURE__ */ new Date();
			this._debounceValue.update(this.textModel, u.getTime() - c.getTime());
			let d = new UpToDateInlineCompletions(l, i, this.textModel, this.versionId);
			if (r) {
				let n = r.toInlineCompletion(void 0);
				r.canBeReused(this.textModel, e) && !l.has(n) && d.prepend(r.inlineCompletion, n.range, !0);
			}
			return this._updateOperation.clear(), transaction((e) => {
				a.set(d, e);
			}), !0;
		})(), l = new UpdateOperation(i, s, c);
		return this._updateOperation.value = l, c;
	}
	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, n) {
	return new Promise((r) => {
		let i, a = setTimeout(() => {
			i && i.dispose(), r();
		}, e);
		n && (i = n.onCancellationRequested(() => {
			clearTimeout(a), i && i.dispose(), r();
		}));
	});
}
var UpdateRequest = class {
	constructor(e, n, r) {
		this.position = e, this.context = n, this.versionId = r;
	}
	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, n, r) {
		this.request = e, this.cancellationTokenSource = n, this.promise = r;
	}
	dispose() {
		this.cancellationTokenSource.cancel();
	}
}, UpToDateInlineCompletions = class {
	get inlineCompletions() {
		return this._inlineCompletions;
	}
	constructor(e, n, r, i) {
		this.inlineCompletionProviderResult = e, this.request = n, this._textModel = r, this._versionId = i, this._refCount = 1, this._prependedInlineCompletionItems = [];
		let a = r.deltaDecorations([], e.completions.map((e) => ({
			range: e.range,
			options: { description: "inline-completion-tracking-range" }
		})));
		this._inlineCompletions = e.completions.map((e, n) => new InlineCompletionWithUpdatedRange(e, a[n], 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, n, r) {
		r && e.source.addRef();
		let i = this._textModel.deltaDecorations([], [{
			range: n,
			options: { description: "inline-completion-tracking-range" }
		}])[0];
		this._inlineCompletions.unshift(new InlineCompletionWithUpdatedRange(e, i, this._textModel, this._versionId)), this._prependedInlineCompletionItems.push(e);
	}
}, InlineCompletionWithUpdatedRange = class {
	get forwardStable() {
		return this.inlineCompletion.source.inlineCompletions.enableForwardStability ?? !1;
	}
	constructor(e, n, r, i) {
		this.inlineCompletion = e, this.decorationId = n, this._textModel = r, this._modelVersion = i, 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, n, r) {
		let i = singleTextRemoveCommonPrefix(this._toFilterTextReplacement(r), e), a = this._updatedRange.read(r);
		if (!a || !this.inlineCompletion.range.getStartPosition().equals(a.getStartPosition()) || n.lineNumber !== i.range.startLineNumber) return !1;
		let o = e.getValueInRange(i.range, 1), s = i.text, c = Math.max(0, n.column - i.range.startColumn), l = s.substring(0, c), u = s.substring(c), d = o.substring(0, c), f = o.substring(c), m = e.getLineIndentColumn(i.range.startLineNumber);
		return i.range.startColumn <= m && (d = d.trimStart(), d.length === 0 && (f = f.trimStart()), l = l.trimStart(), l.length === 0 && (u = u.trimStart())), l.startsWith(d) && !!matchesSubString(f, u);
	}
	canBeReused(e, n) {
		let r = this._updatedRange.read(void 0);
		return !!r && r.containsPosition(n) && this.isVisible(e, n, void 0) && TextLength.ofRange(r).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, n, r, i) {
		this.position = e, this.completion = n, this.container = r, this.provider = i, this.isInvalid = !1, this.score = FuzzyScore.Default, this.distance = 0, this.textLabel = typeof n.label == "string" ? n.label : n.label?.label, this.labelLow = this.textLabel.toLowerCase(), this.isInvalid = !this.textLabel, this.sortTextLow = n.sortText && n.sortText.toLowerCase(), this.filterTextLow = n.filterText && n.filterText.toLowerCase(), this.extensionId = n.extensionId, Range.isIRange(n.range) ? (this.editStart = new Position(n.range.startLineNumber, n.range.startColumn), this.editInsertEnd = new Position(n.range.endLineNumber, n.range.endColumn), this.editReplaceEnd = new Position(n.range.endLineNumber, n.range.endColumn), this.isInvalid = this.isInvalid || Range.spansMultipleLines(n.range) || n.range.startLineNumber !== e.lineNumber) : (this.editStart = new Position(n.range.insert.startLineNumber, n.range.insert.startColumn), this.editInsertEnd = new Position(n.range.insert.endLineNumber, n.range.insert.endColumn), this.editReplaceEnd = new Position(n.range.replace.endLineNumber, n.range.replace.endColumn), this.isInvalid = this.isInvalid || Range.spansMultipleLines(n.range.insert) || Range.spansMultipleLines(n.range.replace) || n.range.insert.startLineNumber !== e.lineNumber || n.range.replace.startLineNumber !== e.lineNumber || n.range.insert.startColumn !== n.range.replace.startColumn), typeof i.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 n = e.onCancellationRequested(() => {
				this._resolveCache = void 0, this._resolveDuration = void 0;
			}), r = new StopWatch(!0);
			this._resolveCache = Promise.resolve(this.provider.resolveCompletionItem(this.completion, e)).then((e) => {
				Object.assign(this.completion, e), this._resolveDuration = r.elapsed();
			}, (e) => {
				isCancellationError(e) && (this._resolveCache = void 0, this._resolveDuration = void 0);
			}).finally(() => {
				n.dispose();
			});
		}
		return this._resolveCache;
	}
}, CompletionOptions = class e {
	static {
		this.default = new e();
	}
	constructor(e = 2, n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Map(), a = !0) {
		this.snippetSortOrder = e, this.kindFilter = n, this.providerFilter = r, this.providerItemsToReuse = i, this.showDeprecated = a;
	}
}, _snippetSuggestSupport;
function getSnippetSuggestSupport() {
	return _snippetSuggestSupport;
}
var CompletionItemModel = class {
	constructor(e, n, r, i) {
		this.items = e, this.needsClipboard = n, this.durations = r, this.disposable = i;
	}
};
async function provideSuggestionItems(e, n, r, i = CompletionOptions.default, a = { triggerKind: 0 }, o = CancellationToken.None) {
	let s = new StopWatch();
	r = r.clone();
	let c = n.getWordAtPosition(r), l = c ? new Range(r.lineNumber, c.startColumn, r.lineNumber, c.endColumn) : Range.fromPositions(r), u = {
		replace: l,
		insert: l.setEndPosition(r.lineNumber, r.column)
	}, d = [], f = new DisposableStore(), m = [], g = !1, _ = (e, n, a) => {
		let o = !1;
		if (!n) return o;
		for (let a of n.suggestions) if (!i.kindFilter.has(a.kind)) {
			if (!i.showDeprecated && a?.tags?.includes(1)) continue;
			a.range ||= u, a.sortText ||= typeof a.label == "string" ? a.label : a.label.label, !g && a.insertTextRules && a.insertTextRules & 4 && (g = SnippetParser.guessNeedsClipboard(a.insertText)), d.push(new CompletionItem(r, a, n, e)), o = !0;
		}
		return isDisposable(n) && f.add(n), m.push({
			providerName: e._debugDisplayName ?? "unknown_provider",
			elapsedProvider: n.duration ?? -1,
			elapsedOverall: a.elapsed()
		}), o;
	}, v = (async () => {})();
	for (let s of e.orderedGroups(n)) {
		let e = !1;
		if (await Promise.all(s.map(async (s) => {
			if (i.providerItemsToReuse.has(s)) {
				let n = i.providerItemsToReuse.get(s);
				n.forEach((e) => d.push(e)), e ||= n.length > 0;
				return;
			}
			if (!(i.providerFilter.size > 0 && !i.providerFilter.has(s))) try {
				let i = new StopWatch(), c = await s.provideCompletionItems(n, r, a, o);
				e = _(s, c, i) || e;
			} catch (e) {
				onUnexpectedExternalError(e);
			}
		})), e || o.isCancellationRequested) break;
	}
	return await v, o.isCancellationRequested ? (f.dispose(), Promise.reject(new CancellationError())) : new CompletionItemModel(d.sort(getSuggestionComparator(i.snippetSortOrder)), g, {
		entries: m,
		elapsed: s.elapsed()
	}, f);
}
function defaultComparator(e, n) {
	if (e.sortTextLow && n.sortTextLow) {
		if (e.sortTextLow < n.sortTextLow) return -1;
		if (e.sortTextLow > n.sortTextLow) return 1;
	}
	return e.textLabel < n.textLabel ? -1 : e.textLabel > n.textLabel ? 1 : e.completion.kind - n.completion.kind;
}
function snippetUpComparator(e, n) {
	if (e.completion.kind !== n.completion.kind) {
		if (e.completion.kind === 27) return -1;
		if (n.completion.kind === 27) return 1;
	}
	return defaultComparator(e, n);
}
function snippetDownComparator(e, n) {
	if (e.completion.kind !== n.completion.kind) {
		if (e.completion.kind === 27) return 1;
		if (n.completion.kind === 27) return -1;
	}
	return defaultComparator(e, n);
}
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, ...n) => {
	let [r, i, a, o] = n;
	assertType(URI.isUri(r)), assertType(Position.isIPosition(i)), assertType(typeof a == "string" || !a), assertType(typeof o == "number" || !o);
	let { completionProvider: s } = e.get(ILanguageFeaturesService), c = await e.get(ITextModelService).createModelReference(r);
	try {
		let e = {
			incomplete: !1,
			suggestions: []
		}, n = [], r = c.object.textEditorModel.validatePosition(i), l = await provideSuggestionItems(s, c.object.textEditorModel, r, void 0, {
			triggerCharacter: a ?? void 0,
			triggerKind: a ? 1 : 0
		});
		for (let r of l.items) n.length < (o ?? 0) && n.push(r.resolve(CancellationToken.None)), e.incomplete = e.incomplete || r.container.incomplete, e.suggestions.push(r.completion);
		try {
			return await Promise.all(n), e;
		} finally {
			setTimeout(() => l.disposable.dispose(), 100);
		}
	} finally {
		c.dispose();
	}
});
function showSimpleSuggestions(e, n) {
	e.getContribution("editor.contrib.suggestController")?.triggerSuggest((/* @__PURE__ */ new Set()).add(n), 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, n) {
		switch (n) {
			case 1: return e.comments;
			case 2: return e.strings;
			default: return e.other;
		}
	}
};
function normalizeDriveLetter(e, n = isWindows) {
	return hasDriveLetter(e, n) ? e.charAt(0).toUpperCase() + e.slice(1) : e;
}
var __decorate$62 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$62 = function(e, n) {
	return function(r, i) {
		n(r, i, 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 n of this._delegates) {
			let r = n.resolve(e);
			if (r !== void 0) return r;
		}
	}
}, SelectionBasedVariableResolver = class {
	constructor(e, n, r, i) {
		this._model = e, this._selection = n, this._selectionIdx = r, this._overtypingCapturer = i;
	}
	resolve(e) {
		let { name: n } = e;
		if (n === "SELECTION" || n === "TM_SELECTED_TEXT") {
			let n = this._model.getValueInRange(this._selection) || void 0, r = this._selection.startLineNumber !== this._selection.endLineNumber;
			if (!n && this._overtypingCapturer) {
				let e = this._overtypingCapturer.getLastOvertypedInfo(this._selectionIdx);
				e && (n = e.value, r = e.multiline);
			}
			if (n && r && e.snippet) {
				let r = this._model.getLineContent(this._selection.startLineNumber), i = getLeadingWhitespace(r, 0, this._selection.startColumn - 1), a = i;
				e.snippet.walk((n) => n === e ? !1 : (n instanceof Text && (a = getLeadingWhitespace(splitLines(n.value).pop())), !0));
				let o = commonPrefixLength(a, i);
				n = n.replace(/(\r\n|\r|\n)(.*)/g, (e, n, r) => `${n}${a.substr(o)}${r}`);
			}
			return n;
		} else if (n === "TM_CURRENT_LINE") return this._model.getLineContent(this._selection.positionLineNumber);
		else if (n === "TM_CURRENT_WORD") {
			let e = this._model.getWordAtPosition({
				lineNumber: this._selection.positionLineNumber,
				column: this._selection.positionColumn
			});
			return e && e.word || void 0;
		} else if (n === "TM_LINE_INDEX") return String(this._selection.positionLineNumber - 1);
		else if (n === "TM_LINE_NUMBER") return String(this._selection.positionLineNumber);
		else if (n === "CURSOR_INDEX") return String(this._selectionIdx);
		else if (n === "CURSOR_NUMBER") return String(this._selectionIdx + 1);
	}
}, ModelBasedVariableResolver = class {
	constructor(e, n) {
		this._labelService = e, this._model = n;
	}
	resolve(e) {
		let { name: n } = e;
		if (n === "TM_FILENAME") return basename$1(this._model.uri.fsPath);
		if (n === "TM_FILENAME_BASE") {
			let e = basename$1(this._model.uri.fsPath), n = e.lastIndexOf(".");
			return n <= 0 ? e : e.slice(0, n);
		} else if (n === "TM_DIRECTORY") return dirname$1(this._model.uri.fsPath) === "." ? "" : this._labelService.getUriLabel(dirname(this._model.uri));
		else if (n === "TM_FILEPATH") return this._labelService.getUriLabel(this._model.uri);
		else if (n === "RELATIVE_FILEPATH") return this._labelService.getUriLabel(this._model.uri, {
			relative: !0,
			noPrefix: !0
		});
	}
}, ClipboardBasedVariableResolver = class {
	constructor(e, n, r, i) {
		this._readClipboardText = e, this._selectionIdx = n, this._selectionCount = r, this._spread = i;
	}
	resolve(e) {
		if (e.name !== "CLIPBOARD") return;
		let n = this._readClipboardText();
		if (n) {
			if (this._spread) {
				let e = n.split(/\r\n|\n|\r/).filter((e) => !isFalsyOrWhitespace(e));
				if (e.length === this._selectionCount) return e[this._selectionIdx];
			}
			return n;
		}
	}
}, CommentBasedVariableResolver = class {
	constructor(e, n, r) {
		this._model = e, this._selection = n, this._languageConfigurationService = r;
	}
	resolve(e) {
		let { name: n } = e, r = this._model.getLanguageIdAtPosition(this._selection.selectionStartLineNumber, this._selection.selectionStartColumn), i = this._languageConfigurationService.getLanguageConfiguration(r).comments;
		if (i) {
			if (n === "LINE_COMMENT") return i.lineCommentToken || void 0;
			if (n === "BLOCK_COMMENT_START") return i.blockCommentStartToken || void 0;
			if (n === "BLOCK_COMMENT_END") return i.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(n) {
		let { name: r } = n;
		if (r === "CURRENT_YEAR") return String(this._date.getFullYear());
		if (r === "CURRENT_YEAR_SHORT") return String(this._date.getFullYear()).slice(-2);
		if (r === "CURRENT_MONTH") return String(this._date.getMonth().valueOf() + 1).padStart(2, "0");
		if (r === "CURRENT_DATE") return String(this._date.getDate().valueOf()).padStart(2, "0");
		if (r === "CURRENT_HOUR") return String(this._date.getHours().valueOf()).padStart(2, "0");
		if (r === "CURRENT_MINUTE") return String(this._date.getMinutes().valueOf()).padStart(2, "0");
		if (r === "CURRENT_SECOND") return String(this._date.getSeconds().valueOf()).padStart(2, "0");
		if (r === "CURRENT_DAY_NAME") return e.dayNames[this._date.getDay()];
		if (r === "CURRENT_DAY_NAME_SHORT") return e.dayNamesShort[this._date.getDay()];
		if (r === "CURRENT_MONTH_NAME") return e.monthNames[this._date.getMonth()];
		if (r === "CURRENT_MONTH_NAME_SHORT") return e.monthNamesShort[this._date.getMonth()];
		if (r === "CURRENT_SECONDS_UNIX") return String(Math.floor(this._date.getTime() / 1e3));
		if (r === "CURRENT_TIMEZONE_OFFSET") {
			let e = this._date.getTimezoneOffset(), n = e > 0 ? "-" : "+", r = Math.trunc(Math.abs(e / 60)), i = r < 10 ? "0" + r : r, a = Math.abs(e) - r * 60, o = a < 10 ? "0" + a : a;
			return n + i + ":" + o;
		}
	}
}, WorkspaceBasedVariableResolver = class {
	constructor(e) {
		this._workspaceService = e;
	}
	resolve(e) {
		if (!this._workspaceService) return;
		let n = toWorkspaceIdentifier(this._workspaceService.getWorkspace());
		if (!isEmptyWorkspaceIdentifier(n)) {
			if (e.name === "WORKSPACE_NAME") return this._resolveWorkspaceName(n);
			if (e.name === "WORKSPACE_FOLDER") return this._resoveWorkspacePath(n);
		}
	}
	_resolveWorkspaceName(e) {
		if (isSingleFolderWorkspaceIdentifier(e)) return basename$1(e.uri.path);
		let n = basename$1(e.configPath.path);
		return n.endsWith("code-workspace") && (n = n.substr(0, n.length - WORKSPACE_EXTENSION.length - 1)), n;
	}
	_resoveWorkspacePath(e) {
		if (isSingleFolderWorkspaceIdentifier(e)) return normalizeDriveLetter(e.uri.fsPath);
		let n = basename$1(e.configPath.path), r = e.configPath.fsPath;
		return r.endsWith(n) && (r = r.substr(0, r.length - n.length - 1)), r ? normalizeDriveLetter(r) : "/";
	}
}, RandomBasedVariableResolver = class {
	resolve(e) {
		let { name: n } = e;
		if (n === "RANDOM") return Math.random().toString().slice(-6);
		if (n === "RANDOM_HEX") return Math.random().toString(16).slice(-6);
		if (n === "UUID") return generateUuid();
	}
}, __decorate$61 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$61 = function(e, n) {
	return function(r, i) {
		n(r, i, 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, n, r) {
		this._editor = e, this._snippet = n, this._snippetLineLeadingWhitespace = r, this._offset = -1, this._nestingLevel = 1, this._placeholderGroups = groupBy(n.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 n = this._editor.getModel();
		this._editor.changeDecorations((r) => {
			for (let i of this._snippet.placeholders) {
				let a = this._snippet.offset(i), o = this._snippet.fullLen(i), s = Range.fromPositions(n.getPositionAt(this._offset + a), n.getPositionAt(this._offset + a + o)), c = i.isFinalTabstop ? e._decor.inactiveFinal : e._decor.inactive, l = r.addDecoration(s, c);
				this._placeholderDecorations.set(i, l);
			}
		});
	}
	move(n) {
		if (!this._editor.hasModel()) return [];
		if (this._initDecorations(), this._placeholderGroupsIdx >= 0) {
			let e = [];
			for (let n of this._placeholderGroups[this._placeholderGroupsIdx]) if (n.transform) {
				let r = this._placeholderDecorations.get(n), i = this._editor.getModel().getDecorationRange(r), a = this._editor.getModel().getValueInRange(i), o = n.transform.resolve(a).split(/\r\n|\r|\n/);
				for (let e = 1; e < o.length; e++) o[e] = this._editor.getModel().normalizeIndentation(this._snippetLineLeadingWhitespace + o[e]);
				e.push(EditOperation.replace(i, o.join(this._editor.getModel().getEOL())));
			}
			e.length > 0 && this._editor.executeEdits("snippet.placeholderTransform", e);
		}
		let r = !1;
		n === !0 && this._placeholderGroupsIdx < this._placeholderGroups.length - 1 ? (this._placeholderGroupsIdx += 1, r = !0) : n === !1 && this._placeholderGroupsIdx > 0 && (--this._placeholderGroupsIdx, r = !0);
		let i = this._editor.getModel().changeDecorations((n) => {
			let i = /* @__PURE__ */ new Set(), a = [];
			for (let o of this._placeholderGroups[this._placeholderGroupsIdx]) {
				let s = this._placeholderDecorations.get(o), c = this._editor.getModel().getDecorationRange(s);
				a.push(new Selection(c.startLineNumber, c.startColumn, c.endLineNumber, c.endColumn)), r &&= this._hasPlaceholderBeenCollapsed(o), n.changeDecorationOptions(s, o.isFinalTabstop ? e._decor.activeFinal : e._decor.active), i.add(o);
				for (let r of this._snippet.enclosingPlaceholders(o)) {
					let a = this._placeholderDecorations.get(r);
					n.changeDecorationOptions(a, r.isFinalTabstop ? e._decor.activeFinal : e._decor.active), i.add(r);
				}
			}
			for (let [r, a] of this._placeholderDecorations) i.has(r) || n.changeDecorationOptions(a, r.isFinalTabstop ? e._decor.inactiveFinal : e._decor.inactive);
			return a;
		});
		return r ? this.move(n) : i ?? [];
	}
	_hasPlaceholderBeenCollapsed(e) {
		let n = e;
		for (; n;) {
			if (n instanceof Placeholder) {
				let e = this._placeholderDecorations.get(n);
				if (this._editor.getModel().getDecorationRange(e).isEmpty() && n.toString().length > 0) return !0;
			}
			n = n.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 n of this._placeholderGroups) {
			let r;
			for (let i of n) {
				if (i.isFinalTabstop) break;
				r || (r = [], e.set(i.index, r));
				let n = this._placeholderDecorations.get(i), a = this._editor.getModel().getDecorationRange(n);
				if (!a) {
					e.delete(i.index);
					break;
				}
				r.push(a);
			}
		}
		return e;
	}
	get activeChoice() {
		if (!this._placeholderDecorations) return;
		let e = this._placeholderGroups[this._placeholderGroupsIdx][0];
		if (!e?.choice) return;
		let n = this._placeholderDecorations.get(e);
		if (!n) return;
		let r = this._editor.getModel().getDecorationRange(n);
		if (r) return {
			range: r,
			choice: e.choice
		};
	}
	get hasChoice() {
		let e = !1;
		return this._snippet.walk((n) => (e = n instanceof Choice, !e)), e;
	}
	merge(n) {
		let r = this._editor.getModel();
		this._nestingLevel *= 10, this._editor.changeDecorations((i) => {
			for (let a of this._placeholderGroups[this._placeholderGroupsIdx]) {
				let o = n.shift();
				console.assert(o._offset !== -1), console.assert(!o._placeholderDecorations);
				let s = o._snippet.placeholderInfo.last.index;
				for (let e of o._snippet.placeholderInfo.all) e.isFinalTabstop ? e.index = a.index + (s + 1) / this._nestingLevel : e.index = a.index + e.index / this._nestingLevel;
				this._snippet.replace(a, o._snippet.children);
				let c = this._placeholderDecorations.get(a);
				i.removeDecoration(c), this._placeholderDecorations.delete(a);
				for (let n of o._snippet.placeholders) {
					let a = o._snippet.offset(n), s = o._snippet.fullLen(n), c = Range.fromPositions(r.getPositionAt(o._offset + a), r.getPositionAt(o._offset + a + s)), l = i.addDecoration(c, e._decor.inactive);
					this._placeholderDecorations.set(n, l);
				}
			}
			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, n, r, i, a) {
		let o = e.getLineContent(n.lineNumber), s = getLeadingWhitespace(o, 0, n.column - 1), c;
		return i.walk((n) => {
			if (!(n instanceof Text) || n.parent instanceof Choice || a && !a.has(n)) return !0;
			let o = n.value.split(/\r\n|\r|\n/);
			if (r) {
				let r = i.offset(n);
				if (r === 0) o[0] = e.normalizeIndentation(o[0]);
				else {
					c ??= i.toString();
					let n = c.charCodeAt(r - 1);
					(n === 10 || n === 13) && (o[0] = e.normalizeIndentation(s + o[0]));
				}
				for (let n = 1; n < o.length; n++) o[n] = e.normalizeIndentation(s + o[n]);
			}
			let l = o.join(e.getEOL());
			return l !== n.value && (n.parent.replace(n, [new Text(l)]), c = void 0), !0;
		}), s;
	}
	static adjustSelection(e, n, r, i) {
		if (r !== 0 || i !== 0) {
			let { positionLineNumber: a, positionColumn: o } = n, s = o - r, c = o + i, l = e.validateRange({
				startLineNumber: a,
				startColumn: s,
				endLineNumber: a,
				endColumn: c
			});
			n = Selection.createWithDirection(l.startLineNumber, l.startColumn, l.endLineNumber, l.endColumn, n.getDirection());
		}
		return n;
	}
	static createEditsAndSnippetsFromSelections(e, n, r, i, a, o, s, c, l) {
		let u = [], d = [];
		if (!e.hasModel()) return {
			edits: u,
			snippets: d
		};
		let f = e.getModel(), m = e.invokeWithinContext((e) => e.get(IWorkspaceContextService)), g = e.invokeWithinContext((e) => new ModelBasedVariableResolver(e.get(ILabelService), f)), _ = () => s, v = f.getValueInRange(SnippetSession_1.adjustSelection(f, e.getSelection(), r, 0)), y = f.getValueInRange(SnippetSession_1.adjustSelection(f, e.getSelection(), 0, i)), b = f.getLineFirstNonWhitespaceColumn(e.getSelection().positionLineNumber), x = e.getSelections().map((e, n) => ({
			selection: e,
			idx: n
		})).sort((e, n) => Range.compareRangesUsingStarts(e.selection, n.selection));
		for (let { selection: s, idx: S } of x) {
			let C = SnippetSession_1.adjustSelection(f, s, r, 0), w = SnippetSession_1.adjustSelection(f, s, 0, i);
			v !== f.getValueInRange(C) && (C = s), y !== f.getValueInRange(w) && (w = s);
			let T = s.setStartPosition(C.startLineNumber, C.startColumn).setEndPosition(w.endLineNumber, w.endColumn), E = new SnippetParser().parse(n, !0, a), D = T.getStartPosition(), O = SnippetSession_1.adjustWhitespace(f, D, o || S > 0 && b !== f.getLineFirstNonWhitespaceColumn(s.positionLineNumber), E);
			E.resolveVariables(new CompositeSnippetVariableResolver([
				g,
				new ClipboardBasedVariableResolver(_, S, x.length, e.getOption(79) === "spread"),
				new SelectionBasedVariableResolver(f, s, S, c),
				new CommentBasedVariableResolver(f, s, l),
				new TimeBasedVariableResolver(),
				new WorkspaceBasedVariableResolver(m),
				new RandomBasedVariableResolver()
			])), u[S] = EditOperation.replace(T, E.toString()), u[S].identifier = {
				major: S,
				minor: 0
			}, u[S]._isTracked = !0, d[S] = new OneSnippet(e, E, O);
		}
		return {
			edits: u,
			snippets: d
		};
	}
	static createEditsAndSnippetsFromEdits(e, n, r, i, a, o, s) {
		if (!e.hasModel() || n.length === 0) return {
			edits: [],
			snippets: []
		};
		let c = [], l = e.getModel(), u = new SnippetParser(), d = new TextmateSnippet(), f = new CompositeSnippetVariableResolver([
			e.invokeWithinContext((e) => new ModelBasedVariableResolver(e.get(ILabelService), l)),
			new ClipboardBasedVariableResolver(() => a, 0, e.getSelections().length, e.getOption(79) === "spread"),
			new SelectionBasedVariableResolver(l, e.getSelection(), 0, o),
			new CommentBasedVariableResolver(l, e.getSelection(), s),
			new TimeBasedVariableResolver(),
			new WorkspaceBasedVariableResolver(e.invokeWithinContext((e) => e.get(IWorkspaceContextService))),
			new RandomBasedVariableResolver()
		]);
		n = n.sort((e, n) => Range.compareRangesUsingStarts(e.range, n.range));
		let m = 0;
		for (let e = 0; e < n.length; e++) {
			let { range: r, template: i } = n[e];
			if (e > 0) {
				let i = n[e - 1].range, a = Range.fromPositions(i.getEndPosition(), r.getStartPosition()), o = new Text(l.getValueInRange(a));
				d.appendChild(o), m += o.value.length;
			}
			let a = u.parseFragment(i, d);
			SnippetSession_1.adjustWhitespace(l, r.getStartPosition(), !0, d, new Set(a)), d.resolveVariables(f);
			let o = d.toString(), s = o.slice(m);
			m = o.length;
			let g = EditOperation.replace(r, s);
			g.identifier = {
				major: e,
				minor: 0
			}, g._isTracked = !0, c.push(g);
		}
		return u.ensureFinalTabstop(d, r, !0), {
			edits: c,
			snippets: [new OneSnippet(e, d, "")]
		};
	}
	constructor(e, n, r = _defaultOptions$1, i) {
		this._editor = e, this._template = n, this._options = r, this._languageConfigurationService = i, 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: n } = 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 = n, this._editor.executeEdits("snippet", e, (e) => {
			let r = e.filter((e) => !!e.identifier);
			for (let e = 0; e < n.length; e++) n[e].initialize(r[e].textChange);
			return this._snippets[0].hasPlaceholder ? this._move(!0) : r.map((e) => Selection.fromPositions(e.range.getEndPosition()));
		}), this._editor.revealRange(this._editor.getSelections()[0]);
	}
	merge(e, n = _defaultOptions$1) {
		if (!this._editor.hasModel()) return;
		this._templateMerges.push([
			this._snippets[0]._nestingLevel,
			this._snippets[0]._placeholderGroupsIdx,
			e
		]);
		let { edits: r, snippets: i } = SnippetSession_1.createEditsAndSnippetsFromSelections(this._editor, e, n.overwriteBefore, n.overwriteAfter, !0, n.adjustWhitespace, n.clipboardText, n.overtypingCapturer, this._languageConfigurationService);
		this._editor.executeEdits("snippet", r, (e) => {
			let n = e.filter((e) => !!e.identifier);
			for (let e = 0; e < i.length; e++) i[e].initialize(n[e].textChange);
			let r = i[0].isTrivialSnippet;
			if (!r) {
				for (let e of this._snippets) e.merge(i);
				console.assert(i.length === 0);
			}
			return this._snippets[0].hasPlaceholder && !r ? this._move(void 0) : n.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 n = [];
		for (let r of this._snippets) {
			let i = r.move(e);
			n.push(...i);
		}
		return n;
	}
	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 n = /* @__PURE__ */ new Map();
		for (let r of this._snippets) {
			let i = r.computePossibleSelections();
			if (n.size === 0) for (let [r, a] of i) {
				a.sort(Range.compareRangesUsingStarts);
				for (let i of e) if (a[0].containsRange(i)) {
					n.set(r, []);
					break;
				}
			}
			if (n.size === 0) return !1;
			n.forEach((e, n) => {
				e.push(...i.get(n));
			});
		}
		e.sort(Range.compareRangesUsingStarts);
		for (let [r, i] of n) {
			if (i.length !== e.length) {
				n.delete(r);
				continue;
			}
			i.sort(Range.compareRangesUsingStarts);
			for (let a = 0; a < i.length; a++) if (!i[a].containsRange(e[a])) {
				n.delete(r);
				continue;
			}
		}
		return n.size > 0;
	}
};
SnippetSession = SnippetSession_1 = __decorate$61([__param$61(3, ILanguageConfigurationService)], SnippetSession);
var __decorate$60 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$60 = function(e, n) {
	return function(r, i) {
		n(r, i, 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, n, r, i, a) {
		this._editor = e, this._logService = n, this._languageFeaturesService = r, this._languageConfigurationService = a, this._snippetListener = new DisposableStore(), this._modelVersionId = -1, this._inSnippet = SnippetController2_1.InSnippetMode.bindTo(i), this._hasNextTabstop = SnippetController2_1.HasNextTabstop.bindTo(i), this._hasPrevTabstop = SnippetController2_1.HasPrevTabstop.bindTo(i);
	}
	dispose() {
		this._inSnippet.reset(), this._hasPrevTabstop.reset(), this._hasNextTabstop.reset(), this._session?.dispose(), this._snippetListener.dispose();
	}
	insert(e, n) {
		try {
			this._doInsert(e, n === void 0 ? _defaultOptions : {
				..._defaultOptions,
				...n
			});
		} catch (n) {
			this.cancel(), this._logService.error(n), 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, n) {
		if (this._editor.hasModel()) {
			if (this._snippetListener.clear(), n.undoStopBefore && this._editor.getModel().pushStackElement(), this._session && typeof e != "string" && this.cancel(), this._session ? (assertType(typeof e == "string"), this._session.merge(e, n)) : (this._modelVersionId = this._editor.getModel().getAlternativeVersionId(), this._session = new SnippetSession(this._editor, e, n, this._languageConfigurationService), this._session.insert()), n.undoStopAfter && this._editor.getModel().pushStackElement(), this._session?.hasChoice) {
				let e = {
					_debugDisplayName: "snippetChoiceCompletions",
					provideCompletionItems: (e, n) => {
						if (!this._session || e !== this._editor.getModel() || !Position.equals(this._editor.getPosition(), n)) return;
						let { activeChoice: r } = this._session;
						if (!r || r.choice.options.length === 0) return;
						let i = e.getValueInRange(r.range), a = !!r.choice.options.find((e) => e.value === i), o = [];
						for (let e = 0; e < r.choice.options.length; e++) {
							let n = r.choice.options[e];
							o.push({
								kind: 13,
								label: n.value,
								insertText: n.value,
								sortText: "a".repeat(e + 1),
								range: r.range,
								filterText: a ? `${i}_${n.value}` : void 0,
								command: {
									id: "jumpToNextSnippetPlaceholder",
									title: localize("next", "Go to next placeholder...")
								}
							});
						}
						return { suggestions: o };
					}
				}, n = this._editor.getModel(), r, i = !1;
				this._choiceCompletions = {
					provider: e,
					enable: () => {
						i ||= (r = this._languageFeaturesService.completionProvider.register({
							language: n.getLanguageId(),
							pattern: n.uri.fsPath,
							scheme: n.uri.scheme,
							exclusive: !0
						}, e), this._snippetListener.add(r), !0);
					},
					disable: () => {
						r?.dispose(), i = !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, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$59 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, InlineCompletionsModel = class extends Disposable {
	get isAcceptingPartially() {
		return this._isAcceptingPartially;
	}
	constructor(e, n, r, i, a, o, s, c, l, u, d, f) {
		super(), this.textModel = e, this.selectedSuggestItem = n, this._textModelVersionId = r, this._positions = i, this._debounceValue = a, this._suggestPreviewEnabled = o, this._suggestPreviewMode = s, this._inlineSuggestMode = c, this._enabled = l, this._instantiationService = u, this._commandService = d, this._languageConfigurationService = f, 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, n) => (e.didChange(this._textModelVersionId) && this._preserveCurrentCompletionReasons.has(this._getReason(e.change)) ? n.preserveCurrentCompletion = !0 : e.didChange(this._forceUpdateExplicitlySignal) && (n.inlineCompletionTriggerKind = InlineCompletionTriggerKind.Explicit), !0)
		}, (e, n) => {
			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 r = this._source.suggestWidgetInlineCompletions.get(), i = this.selectedSuggestItem.read(e);
			if (r && !i) {
				let e = this._source.inlineCompletions.get();
				transaction((n) => {
					(!e || r.request.versionId > e.request.versionId) && this._source.inlineCompletions.set(r.clone(), n), this._source.clearSuggestWidgetInlineCompletions(n);
				});
			}
			let a = this._primaryPosition.read(e), o = {
				triggerKind: n.inlineCompletionTriggerKind,
				selectedSuggestionInfo: i?.toSelectedSuggestionInfo()
			}, s = this.selectedInlineCompletion.get(), c = n.preserveCurrentCompletion || s?.forwardStable ? s : void 0;
			return this._source.fetch(a, o, c);
		}), this._filteredInlineCompletionItems = derivedOpts({
			owner: this,
			equalsFn: itemsEquals()
		}, (e) => {
			let n = this._source.inlineCompletions.read(e);
			if (!n) return [];
			let r = this._primaryPosition.read(e);
			return n.inlineCompletions.filter((n) => n.isVisible(this.textModel, r, e));
		}), this.selectedInlineCompletionIndex = derived(this, (e) => {
			let n = this._selectedInlineCompletionId.read(e), r = this._filteredInlineCompletionItems.read(e), i = this._selectedInlineCompletionId === void 0 ? -1 : r.findIndex((e) => e.semanticId === n);
			return i === -1 ? (this._selectedInlineCompletionId.set(void 0, void 0), 0) : i;
		}), this.selectedInlineCompletion = derived(this, (e) => {
			let n = this._filteredInlineCompletionItems.read(e), r = this.selectedInlineCompletionIndex.read(e);
			return n[r];
		}), 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, n) => !e || !n ? e === n : ghostTextsOrReplacementsEqual(e.ghostTexts, n.ghostTexts) && e.inlineCompletion === n.inlineCompletion && e.suggestItem === n.suggestItem
		}, (e) => {
			let n = this.textModel, r = this.selectedSuggestItem.read(e);
			if (r) {
				let i = singleTextRemoveCommonPrefix(r.toSingleTextEdit(), n), a = this._computeAugmentation(i, e);
				if (!this._suggestPreviewEnabled.read(e) && !a) return;
				let o = a?.edit ?? i, s = a ? a.edit.text.length - i.text.length : 0, c = this._suggestPreviewMode.read(e), l = this._positions.read(e), u = [o, ...getSecondaryEdits(this.textModel, l, o)], d = u.map((e, r) => computeGhostText(e, n, c, l[r], s)).filter(isDefined), f = d[0] ?? new GhostText(o.range.endLineNumber, []);
				return {
					edits: u,
					primaryGhostText: f,
					ghostTexts: d,
					inlineCompletion: a?.completion,
					suggestItem: r
				};
			} else {
				if (!this._isActive.read(e)) return;
				let r = this.selectedInlineCompletion.read(e);
				if (!r) return;
				let i = r.toSingleTextEdit(e), a = this._inlineSuggestMode.read(e), o = this._positions.read(e), s = [i, ...getSecondaryEdits(this.textModel, o, i)], c = s.map((e, r) => computeGhostText(e, n, a, o[r], 0)).filter(isDefined);
				return c[0] ? {
					edits: s,
					primaryGhostText: c[0],
					ghostTexts: c,
					inlineCompletion: r,
					suggestItem: void 0
				} : void 0;
			}
		}), this.ghostTexts = derivedOpts({
			owner: this,
			equalsFn: ghostTextsOrReplacementsEqual
		}, (e) => {
			let n = this.state.read(e);
			if (n) return n.ghostTexts;
		}), this.primaryGhostText = derivedOpts({
			owner: this,
			equalsFn: ghostTextOrReplacementEquals
		}, (e) => {
			let n = this.state.read(e);
			if (n) return n?.primaryGhostText;
		}), this._register(recomputeInitiallyAndOnChange(this._fetchInlineCompletionsPromise));
		let m;
		this._register(autorun((e) => {
			let n = this.state.read(e)?.inlineCompletion;
			if (n?.semanticId !== m?.semanticId && (m = n, n)) {
				let e = n.inlineCompletion, r = e.source;
				r.provider.handleItemDidShow?.(r.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, n) {
		let r = this.textModel, i = this._source.suggestWidgetInlineCompletions.read(n), a = i ? i.inlineCompletions : [this.selectedInlineCompletion.read(n)].filter(isDefined);
		return mapFindFirst(a, (i) => {
			let a = i.toSingleTextEdit(n);
			return a = singleTextRemoveCommonPrefix(a, r, Range.fromPositions(a.range.getStartPosition(), e.range.getEndPosition())), singleTextEditAugments(a, e) ? {
				completion: i,
				edit: a
			} : void 0;
		});
	}
	async _deltaSelectedInlineCompletionIndex(e) {
		await this.triggerExplicitly();
		let n = this._filteredInlineCompletionItems.get() || [];
		if (n.length > 0) {
			let r = (this.selectedInlineCompletionIndex.get() + e + n.length) % n.length;
			this._selectedInlineCompletionId.set(n[r].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 n = this.state.get();
		if (!n || n.primaryGhostText.isEmpty() || !n.inlineCompletion) return;
		let r = n.inlineCompletion.toInlineCompletion(void 0);
		if (r.command && r.source.addRef(), e.pushUndoStop(), r.snippetInfo) e.executeEdits("inlineSuggestion.accept", [EditOperation.replace(r.range, ""), ...r.additionalTextEdits]), e.setPosition(r.snippetInfo.range.getStartPosition(), "inlineCompletionAccept"), SnippetController2.get(e)?.insert(r.snippetInfo.snippet, { undoStopBefore: !1 });
		else {
			let i = n.edits, a = getEndPositionsAfterApplying(i).map((e) => Selection.fromPositions(e));
			e.executeEdits("inlineSuggestion.accept", [...i.map((e) => EditOperation.replace(e.range, e.text)), ...r.additionalTextEdits]), e.setSelections(a, "inlineCompletionAccept");
		}
		this.stop(), r.command && (await this._commandService.executeCommand(r.command.id, ...r.command.arguments || []).then(void 0, onUnexpectedExternalError), r.source.removeRef());
	}
	async acceptNextWord(e) {
		await this._acceptNext(e, (e, n) => {
			let r = this.textModel.getLanguageIdAtPosition(e.lineNumber, e.column), i = this._languageConfigurationService.getLanguageConfiguration(r), a = new RegExp(i.wordDefinition.source, i.wordDefinition.flags.replace("g", "")), o = n.match(a), s = 0;
			s = o && o.index !== void 0 ? o.index === 0 ? o[0].length : o.index : n.length;
			let c = /\s+/g.exec(n);
			return c && c.index !== void 0 && c.index + c[0].length < s && (s = c.index + c[0].length), s;
		}, 0);
	}
	async acceptNextLine(e) {
		await this._acceptNext(e, (e, n) => {
			let r = n.match(/\n/);
			return r && r.index !== void 0 ? r.index + 1 : n.length;
		}, 1);
	}
	async _acceptNext(e, n, r) {
		if (e.getModel() !== this.textModel) throw new BugIndicatingError();
		let i = this.state.get();
		if (!i || i.primaryGhostText.isEmpty() || !i.inlineCompletion) return;
		let a = i.primaryGhostText, o = i.inlineCompletion.toInlineCompletion(void 0);
		if (o.snippetInfo || o.filterText !== o.insertText) {
			await this.accept(e);
			return;
		}
		let s = a.parts[0], c = new Position(a.lineNumber, s.column), l = s.text, u = n(c, l);
		if (u === l.length && a.parts.length === 1) {
			this.accept(e);
			return;
		}
		let d = l.substring(0, u), f = this._positions.get(), m = f[0];
		o.source.addRef();
		try {
			this._isAcceptingPartially = !0;
			try {
				e.pushUndoStop();
				let n = Range.fromPositions(m, c), r = e.getModel().getValueInRange(n) + d, i = new SingleTextEdit(n, r), a = [i, ...getSecondaryEdits(this.textModel, f, i)], o = getEndPositionsAfterApplying(a).map((e) => Selection.fromPositions(e));
				e.executeEdits("inlineSuggestion.accept", a.map((e) => EditOperation.replace(e.range, e.text))), e.setSelections(o, "inlineCompletionPartialAccept"), e.revealPositionInCenterIfOutsideViewport(e.getPosition(), 1);
			} finally {
				this._isAcceptingPartially = !1;
			}
			if (o.source.provider.handlePartialAccept) {
				let n = Range.fromPositions(o.range.getStartPosition(), TextLength.ofText(d).addToPosition(c)), i = e.getModel().getValueInRange(n, 1);
				o.source.provider.handlePartialAccept(o.source.inlineCompletions, o.sourceInlineCompletion, i.length, { kind: r });
			}
		} finally {
			o.source.removeRef();
		}
	}
	handleSuggestAccepted(e) {
		let n = singleTextRemoveCommonPrefix(e.toSingleTextEdit(), this.textModel), r = this._computeAugmentation(n, void 0);
		if (!r) return;
		let i = r.completion.inlineCompletion;
		i.source.provider.handlePartialAccept?.(i.source.inlineCompletions, i.sourceInlineCompletion, n.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, n, r) {
	if (n.length === 1) return [];
	let i = n[0], a = n.slice(1), o = r.range.getStartPosition(), s = r.range.getEndPosition(), c = e.getValueInRange(Range.fromPositions(i, s)), l = subtractPositions(i, o);
	if (l.lineNumber < 1) return onUnexpectedError(new BugIndicatingError(`positionWithinTextEdit line number should be bigger than 0.
			Invalid subtraction between ${i.toString()} and ${o.toString()}`)), [];
	let u = substringPos(r.text, l);
	return a.map((n) => {
		let r = addPositions(subtractPositions(n, o), s), i = e.getValueInRange(Range.fromPositions(n, r)), a = commonPrefixLength(c, i), l = Range.fromPositions(n, n.delta(0, a));
		return new SingleTextEdit(l, u);
	});
}
function substringPos(e, n) {
	let r = "", i = splitLinesIncludeSeparators(e);
	for (let e = n.lineNumber - 1; e < i.length; e++) r += i[e].substring(e === n.lineNumber - 1 ? n.column - 1 : 0);
	return r;
}
function getEndPositionsAfterApplying(e) {
	let n = Permutation.createSortPermutation(e, compareBy((e) => e.range, Range.compareRangesUsingStarts)), r = new TextEdit(n.apply(e)).getNewRanges();
	return n.inverse().apply(r).map((e) => e.getEndPosition());
}
var __decorate$58 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$58 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, SuggestMemoryService_1, Memory = class {
	constructor(e) {
		this.name = e;
	}
	select(e, n, r) {
		if (r.length === 0) return 0;
		let i = r[0].score[0];
		for (let e = 0; e < r.length; e++) {
			let { score: n, completion: a } = r[e];
			if (n[0] !== i) break;
			if (a.preselect) return e;
		}
		return 0;
	}
}, NoMemory = class extends Memory {
	constructor() {
		super("first");
	}
	memorize(e, n, r) {}
	toJSON() {}
	fromJSON() {}
}, LRUMemory = class extends Memory {
	constructor() {
		super("recentlyUsed"), this._cache = new LRUCache(300, .66), this._seq = 0;
	}
	memorize(e, n, r) {
		let i = `${e.getLanguageId()}/${r.textLabel}`;
		this._cache.set(i, {
			touch: this._seq++,
			type: r.completion.kind,
			insertText: r.completion.insertText
		});
	}
	select(e, n, r) {
		if (r.length === 0) return 0;
		let i = e.getLineContent(n.lineNumber).substr(n.column - 10, n.column - 1);
		if (/\s$/.test(i)) return super.select(e, n, r);
		let a = r[0].score[0], o = -1, s = -1, c = -1;
		for (let n = 0; n < r.length && r[n].score[0] === a; n++) {
			let i = `${e.getLanguageId()}/${r[n].textLabel}`, a = this._cache.peek(i);
			if (a && a.touch > c && a.type === r[n].completion.kind && a.insertText === r[n].completion.insertText && (c = a.touch, s = n), r[n].completion.preselect && o === -1) return o = n;
		}
		return s === -1 ? o === -1 ? 0 : o : s;
	}
	toJSON() {
		return this._cache.toJSON();
	}
	fromJSON(e) {
		this._cache.clear();
		for (let [n, r] of e) r.touch = 0, r.type = typeof r.type == "number" ? r.type : CompletionItemKinds.fromString(r.type), this._cache.set(n, r);
		this._seq = this._cache.size;
	}
}, PrefixMemory = class extends Memory {
	constructor() {
		super("recentlyUsedByPrefix"), this._trie = TernarySearchTree.forStrings(), this._seq = 0;
	}
	memorize(e, n, r) {
		let { word: i } = e.getWordUntilPosition(n), a = `${e.getLanguageId()}/${i}`;
		this._trie.set(a, {
			type: r.completion.kind,
			insertText: r.completion.insertText,
			touch: this._seq++
		});
	}
	select(e, n, r) {
		let { word: i } = e.getWordUntilPosition(n);
		if (!i) return super.select(e, n, r);
		let a = `${e.getLanguageId()}/${i}`, o = this._trie.get(a);
		if (o ||= this._trie.findSubstr(a), o) for (let e = 0; e < r.length; e++) {
			let { kind: n, insertText: i } = r[e].completion;
			if (n === o.type && i === o.insertText) return e;
		}
		return super.select(e, n, r);
	}
	toJSON() {
		let e = [];
		return this._trie.forEach((n, r) => e.push([r, n])), e.sort((e, n) => -(e[1].touch - n[1].touch)).forEach((e, n) => e[1].touch = n), e.slice(0, 200);
	}
	fromJSON(e) {
		if (this._trie.clear(), e.length > 0) {
			this._seq = e[0][1].touch + 1;
			for (let [n, r] of e) r.type = typeof r.type == "number" ? r.type : CompletionItemKinds.fromString(r.type), this._trie.set(n, r);
		}
	}
}, SuggestMemoryService = class {
	static {
		SuggestMemoryService_1 = this;
	}
	static {
		this._strategyCtors = new Map([
			["recentlyUsedByPrefix", PrefixMemory],
			["recentlyUsed", LRUMemory],
			["first", NoMemory]
		]);
	}
	static {
		this._storagePrefix = "suggest/memories";
	}
	constructor(e, n) {
		this._storageService = e, this._configService = n, 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, n, r) {
		this._withStrategy(e, n).memorize(e, n, r), this._persistSoon.schedule();
	}
	select(e, n, r) {
		return this._withStrategy(e, n).select(e, n, r);
	}
	_withStrategy(e, n) {
		let r = this._configService.getValue("editor.suggestSelection", {
			overrideIdentifier: e.getLanguageIdAtPosition(n.lineNumber, n.column),
			resource: e.uri
		});
		if (this._strategy?.name !== r) {
			this._saveState(), this._strategy = new ((SuggestMemoryService_1._strategyCtors.get(r)) || NoMemory)();
			try {
				let e = this._configService.getValue("editor.suggest.shareSuggestSelections") ? 0 : 1, n = this._storageService.get(`${SuggestMemoryService_1._storagePrefix}/${r}`, e);
				n && this._strategy.fromJSON(JSON.parse(n));
			} catch {}
		}
		return this._strategy;
	}
	_saveState() {
		if (this._strategy) {
			let e = this._configService.getValue("editor.suggest.shareSuggestSelections") ? 0 : 1, n = JSON.stringify(this._strategy);
			this._storageService.store(`${SuggestMemoryService_1._storagePrefix}/${this._strategy.name}`, n, 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, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$57 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, WordContextKey_1, WordContextKey = class {
	static {
		WordContextKey_1 = this;
	}
	static {
		this.AtEnd = new RawContextKey("atEndOfWord", !1);
	}
	constructor(e, n) {
		this._editor = e, this._enabled = !1, this._ckAtEnd = WordContextKey_1.AtEnd.bindTo(n), 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(), n = this._editor.getSelection(), r = e.getWordAtPosition(n.getStartPosition());
				if (!r) {
					this._ckAtEnd.set(!1);
					return;
				}
				this._ckAtEnd.set(r.endColumn === n.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, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$56 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, SuggestAlternatives_1, SuggestAlternatives = class {
	static {
		SuggestAlternatives_1 = this;
	}
	static {
		this.OtherSuggestions = new RawContextKey("hasOtherSuggestions", !1);
	}
	constructor(e, n) {
		this._editor = e, this._index = 0, this._ckOtherSuggestions = SuggestAlternatives_1.OtherSuggestions.bindTo(n);
	}
	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: n }, r) {
		if (e.items.length === 0) {
			this.reset();
			return;
		}
		if (SuggestAlternatives_1._moveIndex(!0, e, n) === n) {
			this.reset();
			return;
		}
		this._acceptNext = r, this._model = e, this._index = n, this._listener = this._editor.onDidChangeCursorPosition(() => {
			this._ignore || this.reset();
		}), this._ckOtherSuggestions.set(!0);
	}
	static _moveIndex(e, n, r) {
		let i = r;
		for (let a = n.items.length; a > 0 && (i = (i + n.items.length + (e ? 1 : -1)) % n.items.length, !(i === r || !n.items[i].completion.additionalTextEdits)); a--);
		return i;
	}
	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, n, r, i) {
		this._disposables = new DisposableStore(), this._disposables.add(r.onDidSuggest((e) => {
			e.completionModel.items.length === 0 && this.reset();
		})), this._disposables.add(r.onDidCancel((e) => {
			this.reset();
		})), this._disposables.add(n.onDidShow(() => this._onItem(n.getFocusedItem()))), this._disposables.add(n.onDidFocus(this._onItem, this)), this._disposables.add(n.onDidHide(this.reset, this)), this._disposables.add(e.onWillType((a) => {
			if (this._active && !n.isFrozen() && r.state !== 0) {
				let n = a.charCodeAt(a.length - 1);
				this._active.acceptCharacters.has(n) && e.getOption(0) && i(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 n = new CharacterSet();
		for (let r of e.item.completion.commitCharacters) r.length > 0 && n.add(r.charCodeAt(0));
		this._active = {
			acceptCharacters: n,
			item: e
		};
	}
	reset() {
		this._active = void 0;
	}
	dispose() {
		this._disposables.dispose();
	}
}, BracketSelectionRangeProvider = class e {
	async provideSelectionRanges(n, r) {
		let i = [];
		for (let a of r) {
			let r = [];
			i.push(r);
			let o = /* @__PURE__ */ new Map();
			await new Promise((r) => e._bracketsRightYield(r, 0, n, a, o)), await new Promise((i) => e._bracketsLeftYield(i, 0, n, a, o, r));
		}
		return i;
	}
	static {
		this._maxDuration = 30;
	}
	static {
		this._maxRounds = 2;
	}
	static _bracketsRightYield(n, r, i, a, o) {
		let s = /* @__PURE__ */ new Map(), c = Date.now();
		for (;;) {
			if (r >= e._maxRounds) {
				n();
				break;
			}
			if (!a) {
				n();
				break;
			}
			let l = i.bracketPairs.findNextBracket(a);
			if (!l) {
				n();
				break;
			}
			if (Date.now() - c > e._maxDuration) {
				setTimeout(() => e._bracketsRightYield(n, r + 1, i, a, o));
				break;
			}
			if (l.bracketInfo.isOpeningBracket) {
				let e = l.bracketInfo.bracketText, n = s.has(e) ? s.get(e) : 0;
				s.set(e, n + 1);
			} else {
				let e = l.bracketInfo.getOpeningBrackets()[0].bracketText, n = s.has(e) ? s.get(e) : 0;
				if (--n, s.set(e, Math.max(0, n)), n < 0) {
					let n = o.get(e);
					n || (n = new LinkedList(), o.set(e, n)), n.push(l.range);
				}
			}
			a = l.range.getEndPosition();
		}
	}
	static _bracketsLeftYield(n, r, i, a, o, s) {
		let c = /* @__PURE__ */ new Map(), l = Date.now();
		for (;;) {
			if (r >= e._maxRounds && o.size === 0) {
				n();
				break;
			}
			if (!a) {
				n();
				break;
			}
			let u = i.bracketPairs.findPrevBracket(a);
			if (!u) {
				n();
				break;
			}
			if (Date.now() - l > e._maxDuration) {
				setTimeout(() => e._bracketsLeftYield(n, r + 1, i, a, o, s));
				break;
			}
			if (u.bracketInfo.isOpeningBracket) {
				let n = u.bracketInfo.bracketText, r = c.has(n) ? c.get(n) : 0;
				if (--r, c.set(n, Math.max(0, r)), r < 0) {
					let r = o.get(n);
					if (r) {
						let a = r.shift();
						r.size === 0 && o.delete(n);
						let c = Range.fromPositions(u.range.getEndPosition(), a.getStartPosition()), l = Range.fromPositions(u.range.getStartPosition(), a.getEndPosition());
						s.push({ range: c }), s.push({ range: l }), e._addBracketLeading(i, l, s);
					}
				}
			} else {
				let e = u.bracketInfo.getOpeningBrackets()[0].bracketText, n = c.has(e) ? c.get(e) : 0;
				c.set(e, n + 1);
			}
			a = u.range.getStartPosition();
		}
	}
	static _addBracketLeading(e, n, r) {
		if (n.startLineNumber === n.endLineNumber) return;
		let i = n.startLineNumber, a = e.getLineFirstNonWhitespaceColumn(i);
		a !== 0 && a !== n.startColumn && (r.push({ range: Range.fromPositions(new Position(i, a), n.getEndPosition()) }), r.push({ range: Range.fromPositions(new Position(i, 1), n.getEndPosition()) }));
		let o = i - 1;
		if (o > 0) {
			let i = e.getLineFirstNonWhitespaceColumn(o);
			i === n.startColumn && i !== e.getLineLastNonWhitespaceColumn(o) && (r.push({ range: Range.fromPositions(new Position(o, i), n.getEndPosition()) }), r.push({ range: Range.fromPositions(new Position(o, 1), n.getEndPosition()) }));
		}
	}
}, WordDistance = class e {
	static {
		this.None = new class extends e {
			distance() {
				return 0;
			}
		}();
	}
	static async create(n, r) {
		if (!r.getOption(119).localityBonus || !r.hasModel()) return e.None;
		let i = r.getModel(), a = r.getPosition();
		if (!n.canComputeWordRanges(i.uri)) return e.None;
		let [o] = await new BracketSelectionRangeProvider().provideSelectionRanges(i, [a]);
		if (o.length === 0) return e.None;
		let s = await n.computeWordRanges(i.uri, o[0].range);
		if (!s) return e.None;
		let c = i.getWordUntilPosition(a);
		return delete s[c.word], new class extends e {
			distance(e, n) {
				if (!a.equals(r.getPosition())) return 0;
				if (n.kind === 17) return 2 << 20;
				let i = typeof n.label == "string" ? n.label : n.label.label, c = s[i];
				if (isFalsyOrEmpty(c)) return 2 << 20;
				let l = binarySearch(c, Range.fromPositions(e), Range.compareRangesUsingStarts), u = l >= 0 ? c[l] : c[Math.max(0, ~l - 1)], d = o.length;
				for (let e of o) {
					if (!Range.containsRange(e.range, u)) break;
					--d;
				}
				return d;
			}
		}();
	}
}, LineContext = class {
	constructor(e, n) {
		this.leadingLineContent = e, this.characterCountDelta = n;
	}
}, CompletionModel = class e {
	constructor(n, r, i, a, o, s, c = FuzzyScoreOptions.default, l = void 0) {
		this.clipboardText = l, this._snippetCompareFn = e._compareCompletionItems, this._items = n, this._column = r, this._wordDistance = a, this._options = o, this._refilterKind = 1, this._lineContext = i, this._fuzzyScoreOptions = c, s === "top" ? this._snippetCompareFn = e._compareCompletionItemsSnippetsUp : s === "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 [n, r] of this.getItemsByProvider()) r.length > 0 && r[0].container.incomplete && e.add(n);
		return e;
	}
	get stats() {
		return this._ensureCachedState(), this._stats;
	}
	_ensureCachedState() {
		this._refilterKind !== 0 && this._createCachedState();
	}
	_createCachedState() {
		this._itemsByProvider = /* @__PURE__ */ new Map();
		let e = [], { leadingLineContent: n, characterCountDelta: r } = this._lineContext, i = "", a = "", o = this._refilterKind === 1 ? this._items : this._filteredItems, s = [], c = !this._options.filterGraceful || o.length > 2e3 ? fuzzyScore : fuzzyScoreGracefulAggressive;
		for (let l = 0; l < o.length; l++) {
			let u = o[l];
			if (u.isInvalid) continue;
			let d = this._itemsByProvider.get(u.provider);
			d ? d.push(u) : this._itemsByProvider.set(u.provider, [u]);
			let f = u.position.column - u.editStart.column, m = f + r - (u.position.column - this._column);
			if (i.length !== m && (i = m === 0 ? "" : n.slice(-m), a = i.toLowerCase()), u.word = i, m === 0) u.score = FuzzyScore.Default;
			else {
				let e = 0;
				for (; e < f;) {
					let n = i.charCodeAt(e);
					if (n === 32 || n === 9) e += 1;
					else break;
				}
				if (e >= m) u.score = FuzzyScore.Default;
				else if (typeof u.completion.filterText == "string") {
					let n = c(i, a, e, u.completion.filterText, u.filterTextLow, 0, this._fuzzyScoreOptions);
					if (!n) continue;
					compareIgnoreCase(u.completion.filterText, u.textLabel) === 0 ? u.score = n : (u.score = anyScore(i, a, e, u.textLabel, u.labelLow, 0), u.score[0] = n[0]);
				} else {
					let n = c(i, a, e, u.textLabel, u.labelLow, 0, this._fuzzyScoreOptions);
					if (!n) continue;
					u.score = n;
				}
			}
			u.idx = l, u.distance = this._wordDistance.distance(u.position, u.completion), s.push(u), e.push(u.textLabel.length);
		}
		this._filteredItems = s.sort(this._snippetCompareFn), this._refilterKind = 0, this._stats = { pLabelLen: e.length ? quickSelect(e.length - .85, e, (e, n) => e - n) : 0 };
	}
	static _compareCompletionItems(e, n) {
		return e.score[0] > n.score[0] ? -1 : e.score[0] < n.score[0] ? 1 : e.distance < n.distance ? -1 : e.distance > n.distance ? 1 : e.idx < n.idx ? -1 : e.idx > n.idx ? 1 : 0;
	}
	static _compareCompletionItemsSnippetsDown(n, r) {
		if (n.completion.kind !== r.completion.kind) {
			if (n.completion.kind === 27) return 1;
			if (r.completion.kind === 27) return -1;
		}
		return e._compareCompletionItems(n, r);
	}
	static _compareCompletionItemsSnippetsUp(n, r) {
		if (n.completion.kind !== r.completion.kind) {
			if (n.completion.kind === 27) return -1;
			if (r.completion.kind === 27) return 1;
		}
		return e._compareCompletionItems(n, r);
	}
}, __decorate$55 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$55 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, SuggestModel_1, LineContext$1 = class {
	static shouldAutoTrigger(e) {
		if (!e.hasModel()) return !1;
		let n = e.getModel(), r = e.getPosition();
		n.tokenization.tokenizeIfCheap(r.lineNumber);
		let i = n.getWordAtPosition(r);
		return !(!i || i.endColumn !== r.column && i.startColumn + 1 !== r.column || !isNaN(Number(i.word)));
	}
	constructor(e, n, r) {
		this.leadingLineContent = e.getLineContent(n.lineNumber).substr(0, n.column - 1), this.leadingWord = e.getWordUntilPosition(n), this.lineNumber = n.lineNumber, this.column = n.column, this.triggerOptions = r;
	}
};
function canShowQuickSuggest(e, n, r) {
	if (!n.getContextKeyValue(InlineCompletionContextKeys.inlineSuggestionVisible.key)) return !0;
	let i = n.getContextKeyValue(InlineCompletionContextKeys.suppressSuggestions.key);
	return i === void 0 ? !e.getOption(62).suppressSuggestions : !i;
}
function canShowSuggestOnTriggerCharacters(e, n, r) {
	if (!n.getContextKeyValue("inlineSuggestionVisible")) return !0;
	let i = n.getContextKeyValue(InlineCompletionContextKeys.suppressSuggestions.key);
	return i === void 0 ? !e.getOption(62).suppressSuggestions : !i;
}
var SuggestModel = SuggestModel_1 = class {
	constructor(e, n, r, i, a, o, s, c, l) {
		this._editor = e, this._editorWorkerService = n, this._clipboardService = r, this._telemetryService = i, this._logService = a, this._contextKeyService = o, this._configurationService = s, this._languageFeaturesService = c, this._envService = l, 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 u = !1;
		this._toDispose.add(this._editor.onDidCompositionStart(() => {
			u = !0;
		})), this._toDispose.add(this._editor.onDidCompositionEnd(() => {
			u = !1, this._onCompositionEnd();
		})), this._toDispose.add(this._editor.onDidChangeCursorSelection((e) => {
			u || this._onCursorChange(e);
		})), this._toDispose.add(this._editor.onDidChangeModelContent(() => {
			!u && 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 n of this._languageFeaturesService.completionProvider.all(this._editor.getModel())) for (let r of n.triggerCharacters || []) {
			let i = e.get(r);
			if (!i) {
				i = /* @__PURE__ */ new Set();
				let n = getSnippetSuggestSupport();
				n && i.add(n), e.set(r, i);
			}
			i.add(n);
		}
		let n = (n) => {
			if (!canShowSuggestOnTriggerCharacters(this._editor, this._contextKeyService, this._configurationService) || LineContext$1.shouldAutoTrigger(this._editor)) return;
			if (!n) {
				let e = this._editor.getPosition();
				n = this._editor.getModel().getLineContent(e.lineNumber).substr(0, e.column - 1);
			}
			let r = "";
			isLowSurrogate(n.charCodeAt(n.length - 1)) ? isHighSurrogate(n.charCodeAt(n.length - 2)) && (r = n.substr(n.length - 2)) : r = n.charAt(n.length - 1);
			let i = e.get(r);
			if (i) {
				let e = /* @__PURE__ */ new Map();
				if (this._completionModel) for (let [n, r] of this._completionModel.getItemsByProvider()) i.has(n) || e.set(n, r);
				this.trigger({
					auto: !0,
					triggerKind: 1,
					triggerCharacter: r,
					retrigger: !!this._completionModel,
					clipboardText: this._completionModel?.clipboardText,
					completionOptions: {
						providerFilter: i,
						providerItemsToReuse: e
					}
				});
			}
		};
		this._triggerCharacterListener.add(this._editor.onDidType(n)), this._triggerCharacterListener.add(this._editor.onDidCompositionEnd(() => n()));
	}
	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 n = 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 ? (n.containsRange(this._currentSelection) || n.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(), n = this._editor.getPosition(), r = this._editor.getOption(90);
			if (!QuickSuggestionsOptions.isAllOff(r)) {
				if (!QuickSuggestionsOptions.isAllOn(r)) {
					e.tokenization.tokenizeIfCheap(n.lineNumber);
					let i = e.tokenization.getLineTokens(n.lineNumber), a = i.getStandardTokenType(i.findTokenIndexAtOffset(Math.max(n.column - 1 - 1, 0)));
					if (QuickSuggestionsOptions.valueFor(r, a) !== "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(), n = this._editor.getPosition(), r = new LineContext$1(e, n, {
			...this._triggerState,
			refilter: !0
		});
		this._onNewContext(r);
	}
	trigger(e) {
		if (!this._editor.hasModel()) return;
		let n = this._editor.getModel(), r = new LineContext$1(n, 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 = r;
		let i = { triggerKind: e.triggerKind ?? 0 };
		e.triggerCharacter && (i = {
			triggerKind: 1,
			triggerCharacter: e.triggerCharacter
		}), this._requestToken = new CancellationTokenSource();
		let a = this._editor.getOption(113), o = 1;
		switch (a) {
			case "top":
				o = 0;
				break;
			case "bottom":
				o = 2;
				break;
		}
		let { itemKind: s, showDeprecated: c } = SuggestModel_1.createSuggestFilter(this._editor), l = new CompletionOptions(o, e.completionOptions?.kindFilter ?? s, e.completionOptions?.providerFilter, e.completionOptions?.providerItemsToReuse, c), u = WordDistance.create(this._editorWorkerService, this._editor), d = provideSuggestionItems(this._languageFeaturesService.completionProvider, n, this._editor.getPosition(), l, i, this._requestToken.token);
		Promise.all([d, u]).then(async ([n, r]) => {
			if (this._requestToken?.dispose(), !this._editor.hasModel()) return;
			let i = e?.clipboardText;
			if (!i && n.needsClipboard && (i = await this._clipboardService.readText()), this._triggerState === void 0) return;
			let a = this._editor.getModel(), o = new LineContext$1(a, this._editor.getPosition(), e), s = {
				...FuzzyScoreOptions.default,
				firstMatchCanBeWeak: !this._editor.getOption(119).matchOnWordStartOnly
			};
			if (this._completionModel = new CompletionModel(n.items, this._context.column, {
				leadingLineContent: o.leadingLineContent,
				characterCountDelta: o.column - this._context.column
			}, r, this._editor.getOption(119), this._editor.getOption(113), s, i), this._completionDisposables.add(n.disposable), this._onNewContext(o), this._reportDurationsTelemetry(n.durations), !this._envService.isBuilt || this._envService.isExtensionDevelopment) for (let e of n.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 n = /* @__PURE__ */ new Set();
		e.getOption(113) === "none" && n.add(27);
		let r = e.getOption(119);
		return r.showMethods || n.add(0), r.showFunctions || n.add(1), r.showConstructors || n.add(2), r.showFields || n.add(3), r.showVariables || n.add(4), r.showClasses || n.add(5), r.showStructs || n.add(6), r.showInterfaces || n.add(7), r.showModules || n.add(8), r.showProperties || n.add(9), r.showEvents || n.add(10), r.showOperators || n.add(11), r.showUnits || n.add(12), r.showValues || n.add(13), r.showConstants || n.add(14), r.showEnums || n.add(15), r.showEnumMembers || n.add(16), r.showKeywords || n.add(17), r.showWords || n.add(18), r.showColors || n.add(19), r.showFiles || n.add(20), r.showReferences || n.add(21), r.showColors || n.add(22), r.showFolders || n.add(23), r.showTypeParameters || n.add(24), r.showSnippets || n.add(27), r.showUsers || n.add(25), r.showIssues || n.add(26), {
			itemKind: n,
			showDeprecated: r.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(), n = /* @__PURE__ */ new Set();
					for (let [r, i] of this._completionModel.getItemsByProvider()) i.length > 0 && i[0].container.incomplete ? n.add(r) : e.set(r, i);
					this.trigger({
						auto: this._context.triggerOptions.auto,
						triggerKind: 2,
						retrigger: !0,
						clipboardText: this._completionModel.clipboardText,
						completionOptions: {
							providerFilter: n,
							providerItemsToReuse: e
						}
					});
				} else {
					let n = this._completionModel.lineContext, r = !1;
					if (this._completionModel.lineContext = {
						leadingLineContent: e.leadingLineContent,
						characterCountDelta: e.column - this._context.column
					}, this._completionModel.items.length === 0) {
						let i = LineContext$1.shouldAutoTrigger(this._editor);
						if (!this._context) {
							this.cancel();
							return;
						}
						if (i && 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 = n, r = this._completionModel.items.length > 0, r && e.leadingWord.word.length === 0) {
							this.cancel();
							return;
						}
					}
					this._onDidSuggest.fire({
						completionModel: this._completionModel,
						triggerOptions: e.triggerOptions,
						isFrozen: r
					});
				}
			}
		}
	}
};
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(n, r) {
		this._disposables = new DisposableStore(), this._lastOvertyped = [], this._locked = !1, this._disposables.add(n.onWillType(() => {
			if (this._locked || !n.hasModel()) return;
			let r = n.getSelections(), i = r.length, a = !1;
			for (let e = 0; e < i; e++) if (!r[e].isEmpty()) {
				a = !0;
				break;
			}
			if (!a) {
				this._lastOvertyped.length !== 0 && (this._lastOvertyped.length = 0);
				return;
			}
			this._lastOvertyped = [];
			let o = n.getModel();
			for (let n = 0; n < i; n++) {
				let i = r[n];
				if (o.getValueLengthInRange(i) > e._maxSelectionLength) return;
				this._lastOvertyped[n] = {
					value: o.getValueInRange(i),
					multiline: i.startLineNumber !== i.endLineNumber
				};
			}
		})), this._disposables.add(r.onDidTrigger((e) => {
			this._locked = !0;
		})), this._disposables.add(r.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, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$54 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, SuggestWidgetStatus = class {
	constructor(e, n, r, i, a) {
		this._menuId = n, this._menuService = i, this._contextKeyService = a, this._menuDisposables = new DisposableStore(), this.element = append(e, $(".suggest-status-bar"));
		let o = ((e) => e instanceof MenuItemAction ? r.createInstance(TextOnlyMenuEntryActionViewItem, e, { useComma: !0 }) : void 0);
		this._leftActions = new ActionBar(this.element, { actionViewItemProvider: o }), this._rightActions = new ActionBar(this.element, { actionViewItemProvider: o }), 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), n = () => {
			let n = [], r = [];
			for (let [i, a] of e.getActions()) i === "left" ? n.push(...a) : r.push(...a);
			this._leftActions.clear(), this._leftActions.push(n), this._rightActions.clear(), this._rightActions.push(r);
		};
		this._menuDisposables.add(e.onDidChange(() => n())), 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, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$53 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
};
function canExpandCompletionItem(e) {
	return !!e && !!(e.completion.documentation || e.completion.detail && e.completion.detail !== e.completion.label);
}
var SuggestDetailsWidget = class {
	constructor(e, n) {
		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 = n.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(), n = e.get(50), r = n.getMassagedFontFamily(), i = e.get(120) || n.fontSize, a = e.get(121) || n.lineHeight, o = n.fontWeight, s = `${i}px`, c = `${a}px`;
		this.domNode.style.fontSize = s, this.domNode.style.lineHeight = `${a / i}`, this.domNode.style.fontWeight = o, this.domNode.style.fontFeatureSettings = n.fontFeatureSettings, this._type.style.fontFamily = r, this._close.style.height = c, this._close.style.width = c;
	}
	getLayoutInfo() {
		let e = this._editor.getOption(121) || this._editor.getOption(50).lineHeight, n = this._borderWidth, r = n * 2;
		return {
			lineHeight: e,
			borderWidth: n,
			borderHeight: r,
			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, n) {
		this._renderDisposeable.clear();
		let { detail: r, documentation: i } = e.completion;
		if (n) {
			let n = "";
			n += `score: ${e.score[0]}\n`, n += `prefix: ${e.word ?? "(no prefix)"}\n`, n += `word: ${e.completion.filterText ? e.completion.filterText + " (filterText)" : e.textLabel}\n`, n += `distance: ${e.distance} (localityBonus-setting)\n`, n += `index: ${e.idx}, based on ${e.completion.sortText && `sortText: "${e.completion.sortText}"` || "label"}\n`, n += `commit_chars: ${e.completion.commitCharacters?.join("")}\n`, i = new MarkdownString().appendCodeblock("empty", n), r = `Provider: ${e.provider._debugDisplayName}`;
		}
		if (!n && !canExpandCompletionItem(e)) {
			this.clearContents();
			return;
		}
		if (this.domNode.classList.remove("no-docs", "no-type"), r) {
			let e = r.length > 1e5 ? `${r.substr(0, 1e5)}…` : r;
			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 i == "string") this._docs.classList.remove("markdown-docs"), this._docs.textContent = i;
		else if (i) {
			this._docs.classList.add("markdown-docs"), clearNode(this._docs);
			let e = this._markdownRenderer.render(i);
			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, n) {
		let r = new Dimension(e, n);
		Dimension.equals(r, this._size) || (this._size = r, size(this.domNode, e, n)), 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, n) {
		this.widget = e, this._editor = n, 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 r, i, a = 0, o = 0;
		this._disposables.add(this._resizable.onDidWillResize(() => {
			r = this._topLeft, i = this._resizable.size;
		})), this._disposables.add(this._resizable.onDidResize((e) => {
			if (r && i) {
				this.widget.layout(e.dimension.width, e.dimension.height);
				let n = !1;
				e.west && (o = i.width - e.dimension.width, n = !0), e.north && (a = i.height - e.dimension.height, n = !0), n && this._applyTopLeft({
					top: r.top + a,
					left: r.left + o
				});
			}
			e.done && (r = void 0, i = void 0, a = 0, o = 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, n) {
		this._anchorBox = e.getBoundingClientRect(), this._preferAlignAtTop = n, this._placeAtAnchor(this._anchorBox, this._userSize ?? this.widget.size, n);
	}
	_placeAtAnchor(e, n, r) {
		let i = getClientArea(this.getDomNode().ownerDocument.body), a = this.widget.getLayoutInfo(), o = new Dimension(220, 2 * a.lineHeight), s = e.top, c = (function() {
			let r = i.width - (e.left + e.width + a.borderWidth + a.horizontalPadding), c = -a.borderWidth + e.left + e.width, l = new Dimension(r, i.height - e.top - a.borderHeight - a.verticalPadding), u = l.with(void 0, e.top + e.height - a.borderHeight - a.verticalPadding);
			return {
				top: s,
				left: c,
				fit: r - n.width,
				maxSizeTop: l,
				maxSizeBottom: u,
				minSize: o.with(Math.min(r, o.width))
			};
		})(), l = (function() {
			let r = e.left - a.borderWidth - a.horizontalPadding, c = Math.max(a.horizontalPadding, e.left - n.width - a.borderWidth), l = new Dimension(r, i.height - e.top - a.borderHeight - a.verticalPadding), u = l.with(void 0, e.top + e.height - a.borderHeight - a.verticalPadding);
			return {
				top: s,
				left: c,
				fit: r - n.width,
				maxSizeTop: l,
				maxSizeBottom: u,
				minSize: o.with(Math.min(r, o.width))
			};
		})(), u = (function() {
			let r = e.left, s = -a.borderWidth + e.top + e.height, c = new Dimension(e.width - a.borderHeight, i.height - e.top - e.height - a.verticalPadding);
			return {
				top: s,
				left: r,
				fit: c.height - n.height,
				maxSizeBottom: c,
				maxSizeTop: c,
				minSize: o.with(c.width)
			};
		})(), d = [
			c,
			l,
			u
		], f = d.find((e) => e.fit >= 0) ?? d.sort((e, n) => n.fit - e.fit)[0], m = e.top + e.height - a.borderHeight, g, _ = n.height, v = Math.max(f.maxSizeTop.height, f.maxSizeBottom.height);
		_ > v && (_ = v);
		let y;
		r ? _ <= f.maxSizeTop.height ? (g = !0, y = f.maxSizeTop) : (g = !1, y = f.maxSizeBottom) : _ <= f.maxSizeBottom.height ? (g = !1, y = f.maxSizeBottom) : (g = !0, y = f.maxSizeTop);
		let { top: b, left: x } = f;
		!g && _ > e.height && (b = m - _);
		let S = this._editor.getDomNode();
		if (S) {
			let e = S.getBoundingClientRect();
			b -= e.top, x -= e.left;
		}
		this._applyTopLeft({
			left: x,
			top: b
		}), this._resizable.enableSashes(!g, f === c, g, f !== c), this._resizable.minSize = f.minSize, this._resizable.maxSize = y, this._resizable.layout(_, Math.min(y.width, n.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, n, r, i, a) {
	if (ThemeIcon.isThemeIcon(a)) return [`codicon-${a.id}`, "predefined-file-icon"];
	if (URI.isUri(a)) return [];
	let o = i === FileKind.ROOT_FOLDER ? ["rootfolder-icon"] : i === FileKind.FOLDER ? ["folder-icon"] : ["file-icon"];
	if (r) {
		let a;
		if (r.scheme === Schemas.data) a = DataUri.parseMetaData(r).get(DataUri.META_DATA_LABEL);
		else {
			let e = r.path.match(fileIconDirectoryRegex);
			e ? (a = cssEscape(e[2].toLowerCase()), e[1] && o.push(`${cssEscape(e[1].toLowerCase())}-name-dir-icon`)) : a = cssEscape(r.authority.toLowerCase());
		}
		if (i === FileKind.ROOT_FOLDER) o.push(`${a}-root-name-folder-icon`);
		else if (i === FileKind.FOLDER) o.push(`${a}-name-folder-icon`);
		else {
			if (a) {
				if (o.push(`${a}-name-file-icon`), o.push("name-file-icon"), a.length <= 255) {
					let e = a.split(".");
					for (let n = 1; n < e.length; n++) o.push(`${e.slice(n).join(".")}-ext-file-icon`);
				}
				o.push("ext-file-icon");
			}
			let i = detectLanguageId(e, n, r);
			i && o.push(`${cssEscape(i)}-lang-file-icon`);
		}
	}
	return o;
}
function detectLanguageId(e, n, r) {
	if (!r) return null;
	let i = null;
	if (r.scheme === Schemas.data) {
		let e = DataUri.parseMetaData(r).get(DataUri.META_DATA_MIME);
		e && (i = n.getLanguageIdByMimeType(e));
	} else {
		let n = e.getModel(r);
		n && (i = n.getLanguageId());
	}
	return i && i !== "plaintext" ? i : n.guessLanguageIdByFilepathOrFirstLine(r);
}
function cssEscape(e) {
	return e.replace(/[\s]/g, "/");
}
var __decorate$52 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$52 = function(e, n) {
	return function(r, i) {
		n(r, i, 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(n, r) {
		if (n.textLabel.match(e._regexStrict)) return r[0] = n.textLabel, !0;
		if (n.completion.detail && n.completion.detail.match(e._regexStrict)) return r[0] = n.completion.detail, !0;
		if (n.completion.documentation) {
			let i = typeof n.completion.documentation == "string" ? n.completion.documentation : n.completion.documentation.value, a = e._regexRelaxed.exec(i);
			if (a && (a.index === 0 || a.index + a[0].length === i.length)) return r[0] = a[0], !0;
		}
		return !1;
	}
}(), ItemRenderer = class {
	constructor(e, n, r, i) {
		this._editor = e, this._modelService = n, this._languageService = r, this._themeService = i, this._onDidToggleDetails = new Emitter(), this.onDidToggleDetails = this._onDidToggleDetails.event, this.templateId = "suggestion";
	}
	dispose() {
		this._onDidToggleDetails.dispose();
	}
	renderTemplate(e) {
		let n = new DisposableStore(), r = e;
		r.classList.add("show-file-icons");
		let i = append(e, $(".icon")), a = append(i, $("span.colorspan")), o = append(e, $(".contents")), s = append(o, $(".main")), c = append(s, $(".icon-label.codicon")), l = append(s, $("span.left")), u = append(s, $("span.right")), d = new IconLabel(l, {
			supportHighlights: !0,
			supportIcons: !0
		});
		n.add(d);
		let f = append(l, $("span.signature-label")), m = append(l, $("span.qualifier-label")), g = append(u, $("span.details-label")), _ = append(u, $("span.readMore" + ThemeIcon.asCSSSelector(suggestMoreInfoIcon)));
		return _.title = localize("readMore", "Read More"), {
			root: r,
			left: l,
			right: u,
			icon: i,
			colorspan: a,
			iconLabel: d,
			iconContainer: c,
			parametersLabel: f,
			qualifierLabel: m,
			detailsLabel: g,
			readMore: _,
			disposables: n,
			configureFont: () => {
				let e = this._editor.getOptions(), n = e.get(50), a = n.getMassagedFontFamily(), o = n.fontFeatureSettings, c = e.get(120) || n.fontSize, l = e.get(121) || n.lineHeight, u = n.fontWeight, d = n.letterSpacing, f = `${c}px`, m = `${l}px`, g = `${d}px`;
				r.style.fontSize = f, r.style.fontWeight = u, r.style.letterSpacing = g, s.style.fontFamily = a, s.style.fontFeatureSettings = o, s.style.lineHeight = m, i.style.height = m, i.style.width = m, _.style.height = m, _.style.width = m;
			}
		};
	}
	renderElement(e, n, r) {
		r.configureFont();
		let { completion: i } = e;
		r.root.id = getAriaId(n), r.colorspan.style.backgroundColor = "";
		let a = {
			labelEscapeNewLines: !0,
			matches: createMatches(e.score)
		}, o = [];
		if (i.kind === 19 && _completionItemColor.extract(e, o)) r.icon.className = "icon customcolor", r.iconContainer.className = "icon hide", r.colorspan.style.backgroundColor = o[0];
		else if (i.kind === 20 && this._themeService.getFileIconTheme().hasFileIcons) {
			r.icon.className = "icon hide", r.iconContainer.className = "icon hide";
			let n = getIconClasses(this._modelService, this._languageService, URI.from({
				scheme: "fake",
				path: e.textLabel
			}), FileKind.FILE), o = getIconClasses(this._modelService, this._languageService, URI.from({
				scheme: "fake",
				path: i.detail
			}), FileKind.FILE);
			a.extraClasses = n.length > o.length ? n : o;
		} else i.kind === 23 && this._themeService.getFileIconTheme().hasFolderIcons ? (r.icon.className = "icon hide", r.iconContainer.className = "icon hide", a.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: i.detail
		}), FileKind.FOLDER)].flat()) : (r.icon.className = "icon hide", r.iconContainer.className = "", r.iconContainer.classList.add("suggest-icon", ...ThemeIcon.asClassNameArray(CompletionItemKinds.toIcon(i.kind))));
		i.tags && i.tags.indexOf(1) >= 0 && (a.extraClasses = (a.extraClasses || []).concat(["deprecated"]), a.matches = []), r.iconLabel.setLabel(e.textLabel, void 0, a), typeof i.label == "string" ? (r.parametersLabel.textContent = "", r.detailsLabel.textContent = stripNewLines(i.detail || ""), r.root.classList.add("string-label")) : (r.parametersLabel.textContent = stripNewLines(i.label.detail || ""), r.detailsLabel.textContent = stripNewLines(i.label.description || ""), r.root.classList.remove("string-label")), this._editor.getOption(119).showInlineDetails ? show(r.detailsLabel) : hide(r.detailsLabel), canExpandCompletionItem(e) ? (r.right.classList.add("can-expand-details"), show(r.readMore), r.readMore.onmousedown = (e) => {
			e.stopPropagation(), e.preventDefault();
		}, r.readMore.onclick = (e) => {
			e.stopPropagation(), e.preventDefault(), this._onDidToggleDetails.fire();
		}) : (r.right.classList.remove("can-expand-details"), hide(r.readMore), r.readMore.onmousedown = null, r.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, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$51 = function(e, n) {
	return function(r, i) {
		n(r, i, 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, n) {
		this._service = e, this._key = `suggestWidget.size/${n.getEditorType()}/${n instanceof EmbeddedCodeEditorWidget}`;
	}
	restore() {
		let e = this._service.get(this._key, 0) ?? "";
		try {
			let n = JSON.parse(e);
			if (Dimension.is(n)) return Dimension.lift(n);
		} 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, n, r, i, a) {
		this.editor = e, this._storageService = n, 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(n, e);
		class o {
			constructor(e, n, r = !1, i = !1) {
				this.persistedSize = e, this.currentSize = n, this.persistHeight = r, this.persistWidth = i;
			}
		}
		let s;
		this._disposables.add(this.element.onDidWillResize(() => {
			this._contentWidget.lockPreference(), s = new o(this._persistedSize.restore(), this.element.size);
		})), this._disposables.add(this.element.onDidResize((e) => {
			if (this._resize(e.dimension.width, e.dimension.height), s && (s.persistHeight = s.persistHeight || !!e.north || !!e.south, s.persistWidth = s.persistWidth || !!e.east || !!e.west), e.done) {
				if (s) {
					let { itemHeight: e, defaultSize: n } = this.getLayoutInfo(), r = Math.round(e / 2), { width: i, height: a } = this.element.size;
					(!s.persistHeight || Math.abs(s.currentSize.height - a) <= r) && (a = s.persistedSize?.height ?? n.height), (!s.persistWidth || Math.abs(s.currentSize.width - i) <= r) && (i = s.persistedSize?.width ?? n.width), this._persistedSize.store(new Dimension(i, a));
				}
				this._contentWidget.unlockPreference(), s = void 0;
			}
		})), this._messageElement = append(this.element.domNode, $(".message")), this._listElement = append(this.element.domNode, $(".tree"));
		let c = this._disposables.add(a.createInstance(SuggestDetailsWidget, this.editor));
		c.onDidClose(this.toggleDetails, this, this._disposables), this._details = new SuggestDetailsOverlay(c, this.editor);
		let l = () => this.element.domNode.classList.toggle("no-icons", !this.editor.getOption(119).showIcons);
		l();
		let u = a.createInstance(ItemRenderer, this.editor);
		this._disposables.add(u), this._disposables.add(u.onDidToggleDetails(() => this.toggleDetails())), this._list = new List("SuggestWidget", this._listElement, {
			getHeight: (e) => this.getLayoutInfo().itemHeight,
			getTemplateId: (e) => "suggestion"
		}, [u], {
			alwaysConsumeMouseWheel: !0,
			useShadows: !1,
			mouseSupport: !1,
			multipleSelectionSupport: !1,
			accessibilityProvider: {
				getRole: () => "option",
				getWidgetAriaLabel: () => localize("suggest", "Suggest"),
				getWidgetRole: () => "listbox",
				getAriaLabel: (e) => {
					let n = e.textLabel;
					if (typeof e.completion.label != "string") {
						let { detail: r, description: i } = e.completion.label;
						r && i ? n = localize("label.full", "{0} {1}, {2}", n, r, i) : r ? n = localize("label.detail", "{0} {1}", n, r) : i && (n = localize("label.desc", "{0}, {1}", n, i));
					}
					if (!e.isResolved || !this._isDetailsVisible()) return n;
					let { documentation: r, detail: i } = e.completion, a = format("{0}{1}", i || "", r ? typeof r == "string" ? r : r.value : "");
					return localize("ariaCurrenttSuggestionReadDetails", "{0}, docs: {1}", n, a);
				}
			}
		}), this._list.style(getListStyles({
			listInactiveFocusBackground: editorSuggestWidgetSelectedBackground,
			listInactiveFocusOutline: activeContrastBorder
		})), this._status = a.createInstance(SuggestWidgetStatus, this.element.domNode, suggestWidgetStatusbarMenu);
		let d = () => this.element.domNode.classList.toggle("with-status-bar", this.editor.getOption(119).showStatusBar);
		d(), this._disposables.add(i.onDidColorThemeChange((e) => this._onThemeChange(e))), this._onThemeChange(i.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) && (d(), l()), 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(r), this._ctxSuggestWidgetDetailsVisible = Context$1.DetailsVisible.bindTo(r), this._ctxSuggestWidgetMultipleSuggestions = Context$1.MultipleSuggestions.bindTo(r), this._ctxSuggestWidgetHasFocusedSuggestion = Context$1.HasFocusedSuggestion.bindTo(r), 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, n) {
		let r = this._completionModel;
		r && (this._onDidSelect.fire({
			item: e,
			index: n,
			model: r
		}), 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 n = e.elements[0], r = e.indexes[0];
		n !== this._focusedItem && (this._currentSuggestionDetails?.cancel(), this._currentSuggestionDetails = void 0, this._focusedItem = n, this._list.reveal(r), this._currentSuggestionDetails = createCancelablePromise(async (e) => {
			let r = disposableTimeout(() => {
				this._isDetailsVisible() && this.showDetails(!0);
			}, 250), i = e.onCancellationRequested(() => r.dispose());
			try {
				return await n.resolve(e);
			} finally {
				r.dispose(), i.dispose();
			}
		}), this._currentSuggestionDetails.then(() => {
			r >= this._list.length || n !== this._list.element(r) || (this._ignoreFocusEvents = !0, this._list.splice(r, 1, [n]), this._list.setFocus([r]), this._ignoreFocusEvents = !1, this._isDetailsVisible() ? this.showDetails(!1) : this.element.domNode.classList.remove("docs-side"), this.editor.setAriaOptions({ activeDescendant: getAriaId(r) }));
		}).catch(onUnexpectedError)), this._onDidFocus.fire({
			item: n,
			index: r,
			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, n) {
		this._state === 0 && (this._contentWidget.setPosition(this.editor.getPosition()), this._isAuto = !!e, this._isAuto || (this._loadingTimeout = disposableTimeout(() => this._setState(1), n)));
	}
	showSuggestions(e, n, r, i, a) {
		if (this._contentWidget.setPosition(this.editor.getPosition()), this._loadingTimeout?.dispose(), this._currentSuggestionDetails?.cancel(), this._currentSuggestionDetails = void 0, this._completionModel !== e && (this._completionModel = e), r && this._state !== 2 && this._state !== 0) {
			this._setState(4);
			return;
		}
		let o = this._completionModel.items.length, s = o === 0;
		if (this._ctxSuggestWidgetMultipleSuggestions.set(o > 1), s) {
			this._setState(i ? 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(r ? 4 : 3), this._list.reveal(n, 0), this._list.setFocus(a ? [] : [n]);
		} 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(), n = Math.ceil(this.getLayoutInfo().itemHeight * 4.3);
		e && e.height < n && this._persistedSize.store(e.with(void 0, n));
	}
	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 n = getClientArea(this.element.domNode.ownerDocument.body), r = this.getLayoutInfo();
		e ||= r.defaultSize;
		let i = e.height, a = e.width;
		if (this._status.element.style.height = `${r.itemHeight}px`, this._state === 2 || this._state === 1) i = r.itemHeight + r.borderHeight, a = r.defaultSize.width / 2, this.element.enableSashes(!1, !1, !1, !1), this.element.minSize = this.element.maxSize = new Dimension(a, i), this._contentWidget.setPreference(2);
		else {
			let o = n.width - r.borderHeight - 2 * r.horizontalPadding;
			a > o && (a = o);
			let s = this._completionModel ? this._completionModel.stats.pLabelLen * r.typicalHalfwidthCharacterWidth : a, c = r.statusBarHeight + this._list.contentHeight + r.borderHeight, u = r.itemHeight + r.statusBarHeight, d = getDomNodePagePosition(this.editor.getDomNode()), f = this.editor.getScrolledVisiblePosition(this.editor.getPosition()), m = d.top + f.top + f.height, g = Math.min(n.height - m - r.verticalPadding, c), _ = d.top + f.top - r.verticalPadding, v = Math.min(_, c), y = Math.min(Math.max(v, g) + r.borderHeight, c);
			i === this._cappedHeight?.capped && (i = this._cappedHeight.wanted), i < u && (i = u), i > y && (i = y), i > g || this._forceRenderingAbove && _ > 150 ? (this._contentWidget.setPreference(1), this.element.enableSashes(!0, !0, !1, !1), y = v) : (this._contentWidget.setPreference(2), this.element.enableSashes(!1, !0, !0, !1), y = g), this.element.preferredSize = new Dimension(s, r.defaultSize.height), this.element.maxSize = new Dimension(o, y), this.element.minSize = new Dimension(220, u), this._cappedHeight = i === c ? {
				wanted: this._cappedHeight?.wanted ?? e.height,
				capped: i
			} : void 0;
		}
		this._resize(a, i);
	}
	_resize(e, n) {
		let { width: r, height: i } = this.element.maxSize;
		e = Math.min(r, e), n = Math.min(i, n);
		let { statusBarHeight: a } = this.getLayoutInfo();
		this._list.layout(n - a, e), this._listElement.style.height = `${n - a}px`, this.element.layout(n, 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), n = clamp(this.editor.getOption(121) || e.lineHeight, 8, 1e3), r = !this.editor.getOption(119).showStatusBar || this._state === 2 || this._state === 1 ? 0 : n, i = this._details.widget.borderWidth, a = 2 * i;
		return {
			itemHeight: n,
			statusBarHeight: r,
			borderWidth: i,
			borderHeight: a,
			typicalHalfwidthCharacterWidth: e.typicalHalfwidthCharacterWidth,
			verticalPadding: 22,
			horizontalPadding: 14,
			defaultSize: new Dimension(430, r + 12 * n + a)
		};
	}
	_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, n) {
		this._widget = e, this._editor = n, 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: n } = this._widget.element.size, { borderWidth: r, horizontalPadding: i } = this._widget.getLayoutInfo();
		return new Dimension(n + 2 * r + i, e + 2 * r);
	}
	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, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$50 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, SuggestController_1, LineSuffix = class {
	constructor(e, n) {
		if (this._model = e, this._position = n, this._decorationOptions = ModelDecorationOptions.register({
			description: "suggest-line-suffix",
			stickiness: 1
		}), e.getLineMaxColumn(n.lineNumber) !== n.column) {
			let r = e.getOffsetAt(n), i = e.getPositionAt(r + 1);
			e.changeDecorations((e) => {
				this._marker && e.removeDecoration(this._marker), this._marker = e.addDecoration(Range.fromPositions(n, i), 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 n = this._model.getDecorationRange(this._marker);
			return this._model.getOffsetAt(n.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, n, r, i, a, o, s) {
		this._memoryService = n, this._commandService = r, this._contextKeyService = i, this._instantiationService = a, this._logService = o, this._telemetryService = s, 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 = a.createInstance(SuggestModel, this.editor), this._selectors.register({
			priority: 0,
			select: (e, n, r) => this._memoryService.select(e, n, r)
		});
		let c = Context$1.InsertMode.bindTo(i);
		c.set(e.getOption(119).insertMode), this._toDispose.add(this.model.onDidTrigger(() => c.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 n = new CommitCharacterController(this.editor, e, this.model, (e) => this._insertSuggestion(e, 2));
			this._toDispose.add(n);
			let r = Context$1.MakesTextEdit.bindTo(this._contextKeyService), i = Context$1.HasInsertAndReplaceRange.bindTo(this._contextKeyService), a = Context$1.CanResolve.bindTo(this._contextKeyService);
			return this._toDispose.add(toDisposable(() => {
				r.reset(), i.reset(), a.reset();
			})), this._toDispose.add(e.onDidFocus(({ item: e }) => {
				let n = this.editor.getPosition(), o = e.editStart.column, s = n.column, c = !0;
				this.editor.getOption(1) === "smart" && this.model.state === 2 && !e.completion.additionalTextEdits && !(e.completion.insertTextRules & 4) && s - o === e.completion.insertText.length && (c = this.editor.getModel().getValueInRange({
					startLineNumber: n.lineNumber,
					startColumn: o,
					endLineNumber: n.lineNumber,
					endColumn: s
				}) !== e.completion.insertText), r.set(c), i.set(!Position.equals(e.editInsertEnd, e.editReplaceEnd)), a.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(a.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 n = -1;
			for (let r of this._selectors.itemsOrderedByPriorityDesc) if (n = r.select(this.editor.getModel(), this.editor.getPosition(), e.completionModel.items), n !== -1) break;
			if (n === -1 && (n = 0), this.model.state === 0) return;
			let r = !1;
			if (e.triggerOptions.auto) {
				let n = this.editor.getOption(119);
				n.selectionMode === "never" || n.selectionMode === "always" ? r = n.selectionMode === "never" : n.selectionMode === "whenTriggerCharacter" ? r = e.triggerOptions.triggerKind !== 1 : n.selectionMode === "whenQuickSuggestion" && (r = e.triggerOptions.triggerKind === 1 && !e.triggerOptions.refilter);
			}
			this.widget.value.showSuggestions(e.completionModel, n, e.isFrozen, e.triggerOptions.auto, r);
		})), 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 l = Context$1.AcceptSuggestionsOnEnter.bindTo(i), u = () => {
			let e = this.editor.getOption(1);
			l.set(e === "on" || e === "smart");
		};
		this._toDispose.add(this.editor.onDidChangeConfiguration(() => u())), u();
	}
	dispose() {
		this._alternatives.dispose(), this._toDispose.dispose(), this.widget.dispose(), this.model.dispose(), this._lineSuffix.dispose(), this._onWillInsertSuggestItem.dispose();
	}
	_insertSuggestion(e, n) {
		if (!e || !e.item) {
			this._alternatives.value.reset(), this.model.cancel(), this.model.clear();
			return;
		}
		if (!this.editor.hasModel()) return;
		let r = SnippetController2.get(this.editor);
		if (!r) return;
		this._onWillInsertSuggestItem.fire({ item: e.item });
		let i = this.editor.getModel(), a = i.getAlternativeVersionId(), { item: o } = e, s = [], c = new CancellationTokenSource();
		n & 1 || this.editor.pushUndoStop();
		let l = this.getOverwriteInfo(o, !!(n & 8));
		this._memoryService.memorize(i, this.editor.getPosition(), o);
		let u = o.isResolved, d = -1, f = -1;
		if (Array.isArray(o.completion.additionalTextEdits)) {
			this.model.cancel();
			let e = StableEditorScrollState.capture(this.editor);
			this.editor.executeEdits("suggestController.additionalTextEdits.sync", o.completion.additionalTextEdits.map((e) => {
				let n = Range.lift(e.range);
				if (n.startLineNumber === o.position.lineNumber && n.startColumn > o.position.column) {
					let e = this.editor.getPosition().column - o.position.column, r = e, i = Range.spansMultipleLines(n) ? 0 : e;
					n = new Range(n.startLineNumber, n.startColumn + r, n.endLineNumber, n.endColumn + i);
				}
				return EditOperation.replaceMove(n, e.text);
			})), e.restoreRelativeVerticalPositionOfCursor(this.editor);
		} else if (!u) {
			let e = new StopWatch(), r, a = i.onDidChangeContent((e) => {
				if (e.isFlush) {
					c.cancel(), a.dispose();
					return;
				}
				for (let n of e.changes) {
					let e = Range.getEndPosition(n.range);
					(!r || Position.isBefore(e, r)) && (r = e);
				}
			}), l = n;
			n |= 2;
			let u = !1, d = this.editor.onWillType(() => {
				d.dispose(), u = !0, l & 2 || this.editor.pushUndoStop();
			});
			s.push(o.resolve(c.token).then(() => {
				if (!o.completion.additionalTextEdits || c.token.isCancellationRequested) return;
				if (r && o.completion.additionalTextEdits.some((e) => Position.isBefore(r, Range.getStartPosition(e.range)))) return !1;
				u && this.editor.pushUndoStop();
				let e = StableEditorScrollState.capture(this.editor);
				return this.editor.executeEdits("suggestController.additionalTextEdits.async", o.completion.additionalTextEdits.map((e) => EditOperation.replaceMove(Range.lift(e.range), e.text))), e.restoreRelativeVerticalPositionOfCursor(this.editor), (u || !(l & 2)) && this.editor.pushUndoStop(), !0;
			}).then((n) => {
				this._logService.trace("[suggest] async resolving of edits DONE (ms, applied?)", e.elapsed(), n), f = n === !0 ? 1 : n === !1 ? 0 : -2;
			}).finally(() => {
				a.dispose(), d.dispose();
			}));
		}
		let { insertText: m } = o.completion;
		if (o.completion.insertTextRules & 4 || (m = SnippetParser.escape(m)), this.model.cancel(), r.insert(m, {
			overwriteBefore: l.overwriteBefore,
			overwriteAfter: l.overwriteAfter,
			undoStopBefore: !1,
			undoStopAfter: !1,
			adjustWhitespace: !(o.completion.insertTextRules & 1),
			clipboardText: e.model.clipboardText,
			overtypingCapturer: this._overtypingCapturer.value
		}), n & 2 || this.editor.pushUndoStop(), o.completion.command) if (o.completion.command.id === TriggerSuggestAction.id) this.model.trigger({
			auto: !0,
			retrigger: !0
		});
		else {
			let e = new StopWatch();
			s.push(this._commandService.executeCommand(o.completion.command.id, ...o.completion.command.arguments ? [...o.completion.command.arguments] : []).catch((e) => {
				o.completion.extensionId ? onUnexpectedExternalError(e) : onUnexpectedError(e);
			}).finally(() => {
				d = e.elapsed();
			}));
		}
		n & 4 && this._alternatives.value.set(e, (e) => {
			for (c.cancel(); i.canUndo();) {
				a !== i.getAlternativeVersionId() && i.undo(), this._insertSuggestion(e, 3 | (n & 8 ? 8 : 0));
				break;
			}
		}), this._alertCompletionItem(o), Promise.all(s).finally(() => {
			this._reportSuggestionAcceptedTelemetry(o, i, u, d, f, e.index, e.model.items), this.model.clear(), c.dispose();
		});
	}
	_reportSuggestionAcceptedTelemetry(e, n, r, i, a, o, s) {
		if (Math.floor(Math.random() * 100) === 0) return;
		let c = /* @__PURE__ */ new Map();
		for (let e = 0; e < Math.min(30, s.length); e++) {
			let n = s[e].textLabel;
			c.has(n) ? c.get(n).push(e) : c.set(n, [e]);
		}
		let l = c.get(e.textLabel), u = l && l.length > 1 ? l[0] : -1;
		this._telemetryService.publicLog2("suggest.acceptedSuggestion", {
			extensionId: e.extensionId?.value ?? "unknown",
			providerId: e.provider._debugDisplayName ?? "unknown",
			kind: e.completion.kind,
			basenameHash: hash(basename(n.uri)).toString(16),
			languageId: n.getLanguageId(),
			fileExtension: extname(n.uri),
			resolveInfo: e.provider.resolveCompletionItem ? r ? 1 : 0 : -1,
			resolveDuration: e.resolveDuration,
			commandDuration: i,
			additionalEditsAsync: a,
			index: o,
			firstIndex: u
		});
	}
	getOverwriteInfo(e, n) {
		assertType(this.editor.hasModel());
		let r = this.editor.getOption(119).insertMode === "replace";
		n && (r = !r);
		let i = e.position.column - e.editStart.column, a = (r ? e.editReplaceEnd.column : e.editInsertEnd.column) - e.position.column, o = this.editor.getPosition().column - e.position.column, s = this._lineSuffix.value ? this._lineSuffix.value.delta(this.editor.getPosition()) : 0;
		return {
			overwriteBefore: i + o,
			overwriteAfter: a + s
		};
	}
	_alertCompletionItem(e) {
		if (isNonEmptyArray(e.completion.additionalTextEdits)) {
			let n = localize("aria.alert.snippet", "Accepting '{0}' made {1} additional edits", e.textLabel, e.completion.additionalTextEdits.length);
			alert(n);
		}
	}
	triggerSuggest(e, n, r) {
		this.editor.hasModel() && (this.model.trigger({
			auto: n ?? !1,
			completionOptions: {
				providerFilter: e,
				kindFilter: r ? /* @__PURE__ */ new Set() : void 0
			}
		}), this.editor.revealPosition(this.editor.getPosition(), 0), this.editor.focus());
	}
	triggerSuggestAndAcceptBest(e) {
		if (!this.editor.hasModel()) return;
		let n = this.editor.getPosition(), r = () => {
			n.equals(this.editor.getPosition()) && this._commandService.executeCommand(e.fallback);
		}, i = (e) => {
			if (e.completion.insertTextRules & 4 || e.completion.additionalTextEdits) return !0;
			let n = this.editor.getPosition(), r = e.editStart.column, i = n.column;
			return i - r === e.completion.insertText.length ? this.editor.getModel().getValueInRange({
				startLineNumber: n.lineNumber,
				startColumn: r,
				endLineNumber: n.lineNumber,
				endColumn: i
			}) !== e.completion.insertText : !0;
		};
		Event.once(this.model.onDidTrigger)((e) => {
			let n = [];
			Event.any(this.model.onDidTrigger, this.model.onDidCancel)(() => {
				dispose(n), r();
			}, void 0, n), this.model.onDidSuggest(({ completionModel: e }) => {
				if (dispose(n), e.items.length === 0) {
					r();
					return;
				}
				let a = this._memoryService.select(this.editor.getModel(), this.editor.getPosition(), e.items), o = e.items[a];
				if (!i(o)) {
					r();
					return;
				}
				this.editor.pushUndoStop(), this._insertSuggestion({
					index: a,
					item: o,
					model: e
				}, 7);
			}, void 0, n);
		}), this.model.trigger({
			auto: !1,
			shy: !0
		}), this.editor.revealPosition(n, 0), this.editor.focus();
	}
	acceptSelectedSuggestion(e, n) {
		let r = this.widget.value.getFocusedItem(), i = 0;
		e && (i |= 4), n && (i |= 8), this._insertSuggestion(r, i);
	}
	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, n) => this.prioritySelector(n) - this.prioritySelector(e)), { dispose: () => {
			let n = this._items.indexOf(e);
			n >= 0 && this._items.splice(n, 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, n, r) {
		let i = SuggestController.get(n);
		if (!i) return;
		let a;
		r && typeof r == "object" && r.auto === !0 && (a = !0), i.triggerSuggest(void 0, a, 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, n) => {
		e.triggerSuggestAndAcceptBest(isObject(n) ? {
			fallback: "tab",
			...n
		} : { 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, n) {
		SuggestController.get(n)?.resetWidgetSize();
	}
});
var SuggestWidgetAdaptor = class extends Disposable {
	get selectedItem() {
		return this._currentSuggestItemInfo;
	}
	constructor(e, n, r) {
		super(), this.editor = e, this.suggestControllerPreselector = n, this.onWillAccept = r, 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 i = SuggestController.get(this.editor);
		if (i) {
			this._register(i.registerSelector({
				priority: 100,
				select: (e, n, r) => {
					let a = this.editor.getModel();
					if (!a) return -1;
					let o = this.suggestControllerPreselector(), s = o ? singleTextRemoveCommonPrefix(o, a) : void 0;
					if (!s) return -1;
					let c = Position.lift(n), l = r.map((e, n) => {
						let r = SuggestItemInfo.fromSuggestion(i, a, c, e, this.isShiftKeyPressed), o = singleTextRemoveCommonPrefix(r.toSingleTextEdit(), a), l = singleTextEditAugments(s, o);
						return {
							index: n,
							valid: l,
							prefixLength: o.text.length,
							suggestItem: e
						};
					}).filter((e) => e && e.valid && e.prefixLength > 0), u = findFirstMax(l, compareBy((e) => e.prefixLength, numberComparator));
					return u ? u.index : -1;
				}
			}));
			let e = !1, n = () => {
				e || (e = !0, this._register(i.widget.value.onDidShow(() => {
					this.isSuggestWidgetVisible = !0, this.update(!0);
				})), this._register(i.widget.value.onDidHide(() => {
					this.isSuggestWidgetVisible = !1, this.update(!1);
				})), this._register(i.widget.value.onDidFocus(() => {
					this.isSuggestWidgetVisible = !0, this.update(!0);
				})));
			};
			this._register(Event.once(i.model.onDidTrigger)((e) => {
				n();
			})), this._register(i.onWillInsertSuggestItem((e) => {
				let n = this.editor.getPosition(), r = this.editor.getModel();
				if (!n || !r) return;
				let a = SuggestItemInfo.fromSuggestion(i, r, n, e.item, this.isShiftKeyPressed);
				this.onWillAccept(a);
			}));
		}
		this.update(this._isActive);
	}
	update(e) {
		let n = this.getSuggestItemInfo();
		(this._isActive !== e || !suggestItemInfoEquals(this._currentSuggestItemInfo, n)) && (this._isActive = e, this._currentSuggestItemInfo = n, this._onDidSelectedItemChange.fire());
	}
	getSuggestItemInfo() {
		let e = SuggestController.get(this.editor);
		if (!e || !this.isSuggestWidgetVisible) return;
		let n = e.widget.value.getFocusedItem(), r = this.editor.getPosition(), i = this.editor.getModel();
		if (!(!n || !r || !i)) return SuggestItemInfo.fromSuggestion(e, i, r, n.item, this.isShiftKeyPressed);
	}
	stopForceRenderingAbove() {
		SuggestController.get(this.editor)?.stopForceRenderingAbove();
	}
	forceRenderingAbove() {
		SuggestController.get(this.editor)?.forceRenderingAbove();
	}
}, SuggestItemInfo = class e {
	static fromSuggestion(n, r, i, a, o) {
		let { insertText: s } = a.completion, c = !1;
		if (a.completion.insertTextRules & 4) {
			let e = new SnippetParser().parse(s);
			e.children.length < 100 && SnippetSession.adjustWhitespace(r, i, !0, e), s = e.toString(), c = !0;
		}
		let l = n.getOverwriteInfo(a, o);
		return new e(Range.fromPositions(i.delta(0, -l.overwriteBefore), i.delta(0, Math.max(l.overwriteAfter, 0))), s, a.completion.kind, c);
	}
	constructor(e, n, r, i) {
		this.range = e, this.insertText = n, this.completionItemKind = r, this.isSnippetText = i;
	}
	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, n) {
	return e === n ? !0 : !e || !n ? !1 : e.equals(n);
}
var __decorate$49 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$49 = function(e, n) {
	return function(r, i) {
		n(r, i, 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, n, r, i, a, s, c, l, u, f) {
		super(), this.editor = e, this._instantiationService = n, this._contextKeyService = r, this._configurationService = i, this._commandService = a, this._debounceService = s, this._languageFeaturesService = c, this._accessibilitySignalService = l, this._keybindingService = u, this._accessibilityService = f, 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((n) => {
			this.model.get()?.handleSuggestAccepted(e);
		}))), this._suggestWidgetSelectedItem = observableFromEvent(this, (e) => this._suggestWidgetAdaptor.onDidSelectedItemChange(() => {
			this._editorObs.forceUpdate((n) => 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 n = this._editorObs.model.read(e);
			if (n) return this._instantiationService.createInstance(InlineCompletionsModel, n, 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, n) => n.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, n) => {
			this._enabled.get() && this.model.get()?.trigger();
		})), this._register(this._commandService.onDidExecuteCommand((n) => {
			new Set([
				CoreEditingCommands.Tab.id,
				CoreEditingCommands.DeleteLeft.id,
				CoreEditingCommands.DeleteRight.id,
				"editor.action.inlineSuggest.commit",
				"acceptSelectedSuggestion"
			]).has(n.commandId) && e.hasTextFocus() && this._enabled.get() && this._editorObs.forceUpdate((e) => {
				this.model.get()?.trigger(e);
			});
		})), this._register(reactToChange(this._editorObs.selections, (e, n) => {
			n.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 n = this.model.read(e)?.state.read(e);
			n?.suggestItem ? n.primaryGhostText.lineCount >= 2 && this._suggestWidgetAdaptor.forceRenderingAbove() : this._suggestWidgetAdaptor.stopForceRenderingAbove();
		})), this._register(toDisposable(() => {
			this._suggestWidgetAdaptor.stopForceRenderingAbove();
		}));
		let m = derivedObservableWithCache(this, (e, n) => {
			let r = this.model.read(e)?.state.read(e);
			return this._suggestWidgetSelectedItem.get() ? n : r?.inlineCompletion?.semanticId;
		});
		this._register(reactToChangeWithStore(derived((e) => (this._playAccessibilitySignal.read(e), m.read(e), {})), async (e, n, r) => {
			let i = this.model.get(), a = i?.state.get();
			if (!a || !i) return;
			let o = i.textModel.getLineContent(a.primaryGhostText.lineNumber);
			await timeout(50, cancelOnDispose(r)), await waitForState(this._suggestWidgetSelectedItem, isUndefined, () => !1, cancelOnDispose(r)), await this._accessibilitySignalService.playSignal(AccessibilitySignal.inlineSuggestion), this.editor.getOption(8) && this._provideScreenReaderUpdate(a.primaryGhostText.renderForScreenReader(o));
		})), this._register(new InlineCompletionsHintsWidget(this.editor, this.model, this._instantiationService)), this._register(createStyleSheetFromObservable(derived((e) => {
			let n = this._fontFamily.read(e);
			return n === "" || n === "default" ? "" : `
.monaco-editor .ghost-text-decoration,
.monaco-editor .ghost-text-decoration-preview,
.monaco-editor .ghost-text {
	font-family: ${n};
}`;
		}))), 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 n = this._contextKeyService.getContextKeyValue("accessibleViewIsShown"), r = this._keybindingService.lookupKeybinding("editor.action.accessibleView"), i;
		!n && r && this.editor.getOption(150) && (i = localize("showAccessibleViewHint", "Inspect this in the accessible view ({0})", r.getAriaLabel())), alert(i ? e + ", " + i : e);
	}
	shouldShowHoverAt(e) {
		let n = this.model.get()?.primaryGhostText.get();
		return n ? n.parts.some((r) => e.containsPosition(new Position(n.lineNumber, r.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, n) {
	let r = observableValue("result", []), i = [];
	return n.add(autorun((n) => {
		let a = e.read(n);
		transaction((e) => {
			if (a.length !== i.length) {
				i.length = a.length;
				for (let e = 0; e < i.length; e++) i[e] || (i[e] = observableValue("item", a[e]));
				r.set([...i], e);
			}
			i.forEach((n, r) => n.set(a[r], e));
		});
	})), r;
}
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, n) {
		InlineCompletionsController.get(n)?.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, n) {
		InlineCompletionsController.get(n)?.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, n) {
		let r = InlineCompletionsController.get(n);
		await asyncTransaction(async (e) => {
			await r?.model.get()?.triggerExplicitly(e), r?.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, n) {
		let r = InlineCompletionsController.get(n);
		await r?.model.get()?.acceptNextWord(r.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, n) {
		let r = InlineCompletionsController.get(n);
		await r?.model.get()?.acceptNextLine(r.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, n) {
		let r = InlineCompletionsController.get(n);
		r && (r.model.get()?.accept(r.editor), r.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, n) {
		let r = InlineCompletionsController.get(n);
		transaction((e) => {
			r?.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, n) {
		let r = e.get(IConfigurationService), i = r.getValue("editor.inlineSuggest.showToolbar") === "always" ? "onHover" : "always";
		r.updateValue("editor.inlineSuggest.showToolbar", i);
	}
}, __decorate$48 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$48 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, InlineCompletionsHover = class {
	constructor(e, n, r) {
		this.owner = e, this.range = n, this.controller = r;
	}
	isValidForHoverAnchor(e) {
		return e.type === 1 && this.range.startColumn <= e.range.startColumn && this.range.endColumn >= e.range.endColumn;
	}
}, InlineCompletionsHoverParticipant = class {
	constructor(e, n, r, i, a, o) {
		this._editor = e, this._languageService = n, this._openerService = r, this.accessibilityService = i, this._instantiationService = a, this._telemetryService = o, this.hoverOrdinal = 4;
	}
	suggestHoverAnchor(e) {
		let n = InlineCompletionsController.get(this._editor);
		if (!n) return null;
		let r = e.target;
		if (r.type === 8) {
			let i = r.detail;
			if (n.shouldShowHoverAtViewZone(i.viewZoneId)) return new HoverForeignElementAnchor(1e3, this, Range.fromPositions(this._editor.getModel().validatePosition(i.positionBefore || i.position)), e.event.posx, e.event.posy, !1);
		}
		return r.type === 7 && n.shouldShowHoverAt(r.range) || r.type === 6 && r.detail.mightBeForeignElement && n.shouldShowHoverAt(r.range) ? new HoverForeignElementAnchor(1e3, this, r.range, e.event.posx, e.event.posy, !1) : null;
	}
	computeSync(e, n) {
		if (this._editor.getOption(62).showToolbar !== "onHover") return [];
		let r = InlineCompletionsController.get(this._editor);
		return r && r.shouldShowHoverAt(e.range) ? [new InlineCompletionsHover(this, e.range, r)] : [];
	}
	renderHoverParts(e, n) {
		let r = new DisposableStore(), i = n[0];
		this._telemetryService.publicLog2("inlineCompletionHover.shown"), this.accessibilityService.isScreenReaderOptimized() && !this._editor.getOption(8) && r.add(this.renderScreenReaderText(e, i));
		let a = i.controller.model.get(), o = this._instantiationService.createInstance(InlineSuggestionHintsContentWidget, this._editor, !1, constObservable(null), a.selectedInlineCompletionIndex, a.inlineCompletionsCount, a.activeCommands), s = o.getDomNode();
		return e.fragment.appendChild(s), a.triggerExplicitly(), r.add(o), new RenderedHoverParts([{
			hoverPart: i,
			hoverElement: s,
			dispose() {
				r.dispose();
			}
		}]);
	}
	renderScreenReaderText(e, n) {
		let r = new DisposableStore(), i = $, a = i("div.hover-row.markdown-hover"), o = append(a, i("div.hover-contents", { "aria-live": "assertive" })), s = r.add(new MarkdownRenderer({ editor: this._editor }, this._languageService, this._openerService)), c = (n) => {
			r.add(s.onDidRenderAsync(() => {
				o.className = "hover-contents code-hover-contents", e.onContentsChanged();
			}));
			let i = localize("inlineSuggestionFollows", "Suggestion:"), a = r.add(s.render(new MarkdownString().appendText(i).appendCodeblock("text", n)));
			o.replaceChildren(a.element);
		};
		return r.add(autorun((e) => {
			let r = n.controller.model.read(e)?.primaryGhostText.read(e);
			if (r) {
				let e = this._editor.getModel().getLineContent(r.lineNumber);
				c(r.renderForScreenReader(e));
			} else reset(o);
		})), e.fragment.appendChild(a), r;
	}
};
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 n = this._implementations.indexOf(e);
			n !== -1 && this._implementations.splice(n, 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, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$47 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, GotoDefinitionAtPositionEditorContribution_1, GotoDefinitionAtPositionEditorContribution = class {
	static {
		GotoDefinitionAtPositionEditorContribution_1 = this;
	}
	static {
		this.ID = "editor.contrib.gotodefinitionatposition";
	}
	static {
		this.MAX_SOURCE_PREVIEW_LINES = 8;
	}
	constructor(e, n, r, i) {
		this.textModelResolverService = n, this.languageService = r, this.languageFeaturesService = i, this.toUnhook = new DisposableStore(), this.toUnhookForKeyboard = new DisposableStore(), this.currentWordAtPosition = null, this.previousPromise = null, this.editor = e, this.linkDecorations = this.editor.createDecorationsCollection();
		let a = new ClickLinkGesture(e);
		this.toUnhook.add(a), this.toUnhook.add(a.onMouseMoveOrRelevantKeyDown(([e, n]) => {
			this.startFindDefinitionFromMouse(e, n ?? void 0);
		})), this.toUnhook.add(a.onExecute((e) => {
			this.isEnabled(e) && this.gotoDefinition(e.target.position, e.hasSideBySideModifier).catch((e) => {
				onUnexpectedError(e);
			}).finally(() => {
				this.removeLinkDecorations();
			});
		})), this.toUnhook.add(a.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, n) {
		if (e.target.type === 9 && this.linkDecorations.length > 0) return;
		if (!this.editor.hasModel() || !this.isEnabled(e, n)) {
			this.currentWordAtPosition = null, this.removeLinkDecorations();
			return;
		}
		let r = e.target.position;
		this.startFindDefinition(r);
	}
	async startFindDefinition(e) {
		this.toUnhookForKeyboard.clear();
		let n = e ? this.editor.getModel()?.getWordAtPosition(e) : null;
		if (!n) {
			this.currentWordAtPosition = null, this.removeLinkDecorations();
			return;
		}
		if (this.currentWordAtPosition && this.currentWordAtPosition.startColumn === n.startColumn && this.currentWordAtPosition.endColumn === n.endColumn && this.currentWordAtPosition.word === n.word) return;
		this.currentWordAtPosition = n;
		let r = new EditorState(this.editor, 15);
		this.previousPromise &&= (this.previousPromise.cancel(), null), this.previousPromise = createCancelablePromise((n) => this.findDefinition(e, n));
		let i;
		try {
			i = await this.previousPromise;
		} catch (e) {
			onUnexpectedError(e);
			return;
		}
		if (!i || !i.length || !r.validate(this.editor)) {
			this.removeLinkDecorations();
			return;
		}
		let a = i[0].originSelectionRange ? Range.lift(i[0].originSelectionRange) : new Range(e.lineNumber, n.startColumn, e.lineNumber, n.endColumn);
		if (i.length > 1) {
			let e = a;
			for (let { originSelectionRange: n } of i) n && (e = Range.plusRange(e, n));
			this.addDecoration(e, new MarkdownString().appendText(localize("multipleResults", "Click to show {0} definitions.", i.length)));
		} else {
			let e = i[0];
			if (!e.uri) return;
			this.textModelResolverService.createModelReference(e.uri).then((n) => {
				if (!n.object || !n.object.textEditorModel) {
					n.dispose();
					return;
				}
				let { object: { textEditorModel: r } } = n, { startLineNumber: i } = e.range;
				if (i < 1 || i > r.getLineCount()) {
					n.dispose();
					return;
				}
				let o = this.getPreviewValue(r, i, e), s = this.languageService.guessLanguageIdByFilepathOrFirstLine(r.uri);
				this.addDecoration(a, o ? new MarkdownString().appendCodeblock(s || "", o) : void 0), n.dispose();
			});
		}
	}
	getPreviewValue(e, n, r) {
		let i = r.range;
		return i.endLineNumber - i.startLineNumber >= GotoDefinitionAtPositionEditorContribution_1.MAX_SOURCE_PREVIEW_LINES && (i = this.getPreviewRangeBasedOnIndentation(e, n)), this.stripIndentationFromPreviewRange(e, n, i);
	}
	stripIndentationFromPreviewRange(e, n, r) {
		let i = e.getLineFirstNonWhitespaceColumn(n);
		for (let a = n + 1; a < r.endLineNumber; a++) {
			let n = e.getLineFirstNonWhitespaceColumn(a);
			i = Math.min(i, n);
		}
		return e.getValueInRange(r).replace(RegExp(`^\\s{${i - 1}}`, "gm"), "").trim();
	}
	getPreviewRangeBasedOnIndentation(e, n) {
		let r = e.getLineFirstNonWhitespaceColumn(n), i = Math.min(e.getLineCount(), n + GotoDefinitionAtPositionEditorContribution_1.MAX_SOURCE_PREVIEW_LINES), a = n + 1;
		for (; a < i; a++) {
			let n = e.getLineFirstNonWhitespaceColumn(a);
			if (r === n) break;
		}
		return new Range(n, 1, a + 1, 1);
	}
	addDecoration(e, n) {
		let r = {
			range: e,
			options: {
				description: "goto-definition-link",
				inlineClassName: "goto-definition-link",
				hoverMessage: n
			}
		};
		this.linkDecorations.set([r]);
	}
	removeLinkDecorations() {
		this.linkDecorations.clear();
	}
	isEnabled(e, n) {
		return this.editor.hasModel() && e.isLeftClick && e.isNoneOrSingleMouseDown && e.target.type === 6 && !(e.target.detail.injectedText?.options instanceof ModelDecorationInjectedTextOptions) && (e.hasTriggerModifier || (n ? n.keyCodeIsTriggerKey : !1)) && this.languageFeaturesService.definitionProvider.has(this.editor.getModel());
	}
	findDefinition(e, n) {
		let r = this.editor.getModel();
		return r ? getDefinitionsAtPosition(this.languageFeaturesService.definitionProvider, r, e, !1, n) : Promise.resolve(null);
	}
	gotoDefinition(e, n) {
		return this.editor.setPosition(e), this.editor.invokeWithinContext((e) => {
			let r = !n && this.editor.getOption(89) && !this.isInPeekEditor(e);
			return new DefinitionAction({
				openToSide: n,
				openInPeek: r,
				muteMessage: !0
			}, {
				title: {
					value: "",
					original: ""
				},
				id: "",
				precondition: void 0
			}).run(e);
		});
	}
	isInPeekEditor(e) {
		let n = e.get(IContextKeyService);
		return PeekContext.inPeekEditor.getValue(n);
	}
	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, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$46 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, MarkerCoordinate = class {
	constructor(e, n, r) {
		this.marker = e, this.index = n, this.total = r;
	}
}, MarkerList = class {
	constructor(e, n, r) {
		this._markerService = n, this._configService = r, this._onDidChange = new Emitter(), this.onDidChange = this._onDidChange.event, this._dispoables = new DisposableStore(), this._markers = [], this._nextIdx = -1, URI.isUri(e) ? this._resourceFilter = (n) => n.toString() === e.toString() : e && (this._resourceFilter = e);
		let i = this._configService.getValue("problems.sortOrder"), a = (e, n) => {
			let r = compare(e.resource.toString(), n.resource.toString());
			return r === 0 && (r = i === "position" ? Range.compareRangesUsingStarts(e, n) || MarkerSeverity.compare(e.severity, n.severity) : MarkerSeverity.compare(e.severity, n.severity) || Range.compareRangesUsingStarts(e, n)), r;
		}, o = () => {
			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(a);
		};
		o(), this._dispoables.add(n.onMarkerChanged((e) => {
			(!this._resourceFilter || e.some((e) => this._resourceFilter(e))) && (o(), 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, n, r) {
		let i = !1, a = this._markers.findIndex((n) => n.resource.toString() === e.uri.toString());
		a < 0 && (a = binarySearch(this._markers, { resource: e.uri }, (e, n) => compare(e.resource.toString(), n.resource.toString())), a < 0 && (a = ~a));
		for (let r = a; r < this._markers.length; r++) {
			let a = Range.lift(this._markers[r]);
			if (a.isEmpty()) {
				let n = e.getWordAtPosition(a.getStartPosition());
				n && (a = new Range(a.startLineNumber, n.startColumn, a.startLineNumber, n.endColumn));
			}
			if (n && (a.containsPosition(n) || n.isBeforeOrEqual(a.getStartPosition()))) {
				this._nextIdx = r, i = !0;
				break;
			}
			if (this._markers[r].resource.toString() !== e.uri.toString()) break;
		}
		i || (this._nextIdx = r ? 0 : this._markers.length - 1), this._nextIdx < 0 && (this._nextIdx = this._markers.length - 1);
	}
	resetIndex() {
		this._nextIdx = -1;
	}
	move(e, n, r) {
		if (this._markers.length === 0) return !1;
		let i = this._nextIdx;
		return this._nextIdx === -1 ? this._initIdx(n, r, e) : e ? this._nextIdx = (this._nextIdx + 1) % this._markers.length : e || (this._nextIdx = (this._nextIdx - 1 + this._markers.length) % this._markers.length), i !== this._nextIdx;
	}
	find(e, n) {
		let r = this._markers.findIndex((n) => n.resource.toString() === e.toString());
		if (!(r < 0)) {
			for (; r < this._markers.length; r++) if (Range.containsPosition(this._markers[r], n)) return new MarkerCoordinate(this._markers[r], r + 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, n) {
		this._markerService = e, this._configService = n, this._provider = new LinkedList();
	}
	getMarkerList(e) {
		for (let n of this._provider) {
			let r = n.getMarkerList(e);
			if (r) return r;
		}
		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 n(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 = n;
})(SeverityIcon ||= {});
var __decorate$45 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$45 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, MarkerNavigationWidget_1, MessageWidget = class {
	constructor(e, n, r, i, a) {
		this._openerService = i, this._labelService = a, this._lines = 0, this._longestLineLength = 0, this._relatedDiagnostics = /* @__PURE__ */ new WeakMap(), this._disposables = new DisposableStore(), this._editor = n;
		let o = document.createElement("div");
		o.className = "descriptioncontainer", this._messageBlock = document.createElement("div"), this._messageBlock.classList.add("message"), this._messageBlock.setAttribute("aria-live", "assertive"), this._messageBlock.setAttribute("role", "alert"), o.appendChild(this._messageBlock), this._relatedBlock = document.createElement("div"), o.appendChild(this._relatedBlock), this._disposables.add(addStandardDisposableListener(this._relatedBlock, "click", (e) => {
			e.preventDefault();
			let n = this._relatedDiagnostics.get(e.target);
			n && r(n);
		})), this._scrollable = new ScrollableElement(o, {
			horizontal: 1,
			vertical: 1,
			useShadows: !1,
			horizontalScrollbarSize: 6,
			verticalScrollbarSize: 6
		}), e.appendChild(this._scrollable.getDomNode()), this._disposables.add(this._scrollable.onScroll((e) => {
			o.style.left = `-${e.scrollLeft}px`, o.style.top = `-${e.scrollTop}px`;
		})), this._disposables.add(this._scrollable);
	}
	dispose() {
		dispose(this._disposables);
	}
	update(e) {
		let { source: n, message: r, relatedInformation: i, code: a } = e, o = (n?.length || 0) + 2;
		a && (typeof a == "string" ? o += a.length : o += a.value.length);
		let s = splitLines(r);
		this._lines = s.length, this._longestLineLength = 0;
		for (let e of s) this._longestLineLength = Math.max(e.length + o, this._longestLineLength);
		clearNode(this._messageBlock), this._messageBlock.setAttribute("aria-label", this.getAriaLabel(e)), this._editor.applyFontInfo(this._messageBlock);
		let c = this._messageBlock;
		for (let e of s) c = document.createElement("div"), c.innerText = e, e === "" && (c.style.height = this._messageBlock.style.lineHeight), this._messageBlock.appendChild(c);
		if (n || a) {
			let e = document.createElement("span");
			if (e.classList.add("details"), c.appendChild(e), n) {
				let r = document.createElement("span");
				r.innerText = n, r.classList.add("source"), e.appendChild(r);
			}
			if (a) if (typeof a == "string") {
				let n = document.createElement("span");
				n.innerText = `(${a})`, n.classList.add("code"), e.appendChild(n);
			} else {
				this._codeLink = $("a.code-link"), this._codeLink.setAttribute("href", `${a.target.toString()}`), this._codeLink.onclick = (e) => {
					this._openerService.open(a.target, { allowCommands: !0 }), e.preventDefault(), e.stopPropagation();
				};
				let n = append(this._codeLink, $("span"));
				n.innerText = a.value, e.appendChild(this._codeLink);
			}
		}
		if (clearNode(this._relatedBlock), this._editor.applyFontInfo(this._relatedBlock), isNonEmptyArray(i)) {
			let e = this._relatedBlock.appendChild(document.createElement("div"));
			e.style.paddingTop = `${Math.floor(this._editor.getOption(67) * .66)}px`, this._lines += 1;
			for (let n of i) {
				let r = document.createElement("div"), i = document.createElement("a");
				i.classList.add("filename"), i.innerText = `${this._labelService.getUriBasenameLabel(n.resource)}(${n.startLineNumber}, ${n.startColumn}): `, i.title = this._labelService.getUriLabel(n.resource), this._relatedDiagnostics.set(i, n);
				let a = document.createElement("span");
				a.innerText = n.message, r.appendChild(i), r.appendChild(a), this._lines += 1, e.appendChild(r);
			}
		}
		let l = this._editor.getOption(50), u = Math.ceil(l.typicalFullwidthCharacterWidth * this._longestLineLength * .75), d = l.lineHeight * this._lines;
		this._scrollable.setScrollDimensions({
			scrollWidth: u,
			scrollHeight: d
		});
	}
	layout(e, n) {
		this._scrollable.getDomNode().style.height = `${e}px`, this._scrollable.getDomNode().style.width = `${n}px`, this._scrollable.setScrollDimensions({
			width: n,
			height: e
		});
	}
	getHeightInLines() {
		return Math.min(17, this._lines);
	}
	getAriaLabel(e) {
		let n = "";
		switch (e.severity) {
			case MarkerSeverity.Error:
				n = localize("Error", "Error");
				break;
			case MarkerSeverity.Warning:
				n = localize("Warning", "Warning");
				break;
			case MarkerSeverity.Info:
				n = localize("Info", "Info");
				break;
			case MarkerSeverity.Hint:
				n = localize("Hint", "Hint");
				break;
		}
		let r = localize("marker aria", "{0} at {1}. ", n, e.startLineNumber + ":" + e.startColumn), i = this._editor.getModel();
		return i && e.startLineNumber <= i.getLineCount() && e.startLineNumber >= 1 && (r = `${i.getLineContent(e.startLineNumber)}, ${r}`), r;
	}
}, MarkerNavigationWidget = class extends PeekViewWidget {
	static {
		MarkerNavigationWidget_1 = this;
	}
	static {
		this.TitleMenu = new MenuId("gotoErrorTitleMenu");
	}
	constructor(e, n, r, i, a, o, s) {
		super(e, {
			showArrow: !0,
			showFrame: !0,
			isAccessible: !0,
			frameWidth: 1
		}, a), this._themeService = n, this._openerService = r, this._menuService = i, this._contextKeyService = o, this._labelService = s, this._callOnDispose = new DisposableStore(), this._onDidSelectRelatedInformation = new Emitter(), this.onDidSelectRelatedInformation = this._onDidSelectRelatedInformation.event, this._severity = MarkerSeverity.Warning, this._backgroundColor = Color.white, this._applyTheme(n.getColorTheme()), this._callOnDispose.add(n.onDidColorThemeChange(this._applyTheme.bind(this))), this.create();
	}
	_applyTheme(e) {
		this._backgroundColor = e.getColor(editorMarkerNavigationBackground);
		let n = editorMarkerNavigationError, r = editorMarkerNavigationErrorHeader;
		this._severity === MarkerSeverity.Warning ? (n = editorMarkerNavigationWarning, r = editorMarkerNavigationWarningHeader) : this._severity === MarkerSeverity.Info && (n = editorMarkerNavigationInfo, r = editorMarkerNavigationInfoHeader);
		let i = e.getColor(n), a = e.getColor(r);
		this.style({
			arrowColor: i,
			frameColor: i,
			headerBackgroundColor: a,
			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 n = [], r = this._menuService.getMenuActions(MarkerNavigationWidget_1.TitleMenu, this._contextKeyService);
		createAndFillInActionBarActions(r, n), this._actionbarWidget.push(n, {
			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, n, r) {
		this._container.classList.remove("stale"), this._message.update(e), this._severity = e.severity, this._applyTheme(this._themeService.getColorTheme());
		let i = Range.lift(e), a = this.editor.getPosition(), o = a && i.containsPosition(a) ? a : i.getStartPosition();
		super.show(o, this.computeRequiredHeight());
		let s = this.editor.getModel();
		if (s) {
			let e = r > 1 ? localize("problems", "{0} of {1} problems", n, r) : localize("change", "{0} of {1} problem", n, r);
			this.setTitle(basename(s.uri), e);
		}
		this._icon.className = `codicon ${SeverityIcon.className(MarkerSeverity.toSeverity(this._severity))}`, this.editor.revealPositionNearTop(o, 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, n) {
		super._doLayoutBody(e, n), this._heightInPixel = e, this._message.layout(e, n), 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, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$44 = function(e, n) {
	return function(r, i) {
		n(r, i, 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, n, r, i, a) {
		this._markerNavigationService = n, this._contextKeyService = r, this._editorService = i, this._instantiationService = a, 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 n = !1;
		return this._model && (n = !0, this._cleanUp()), this._model = this._markerNavigationService.getMarkerList(e), n && 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 n = this._getOrCreateModel(this._editor.getModel().uri);
			n.resetIndex(), n.move(!0, this._editor.getModel(), new Position(e.startLineNumber, e.startColumn)), n.selected && this._widget.showAtMarker(n.selected.marker, n.selected.index, n.selected.total);
		}
	}
	async nagivate(e, n) {
		if (this._editor.hasModel()) {
			let r = this._getOrCreateModel(n ? void 0 : this._editor.getModel().uri);
			if (r.move(e, this._editor.getModel(), this._editor.getPosition()), !r.selected) return;
			if (r.selected.marker.resource.toString() !== this._editor.getModel().uri.toString()) {
				this._cleanUp();
				let i = await this._editorService.openCodeEditor({
					resource: r.selected.marker.resource,
					options: {
						pinned: !1,
						revealIfOpened: !0,
						selectionRevealType: 2,
						selection: r.selected.marker
					}
				}, this._editor);
				i && (MarkerController_1.get(i)?.close(), MarkerController_1.get(i)?.nagivate(e, n));
			} else this._widget.showAtMarker(r.selected.marker, r.selected.index, r.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, n, r) {
		super(r), this._next = e, this._multiFile = n;
	}
	async run(e, n) {
		n.hasModel() && MarkerController.get(n)?.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, n, r) {
		if (!n.hasModel()) return;
		let i = ContentHoverController.get(n);
		if (!i) return;
		let a = r?.focus, o = HoverFocusBehavior.FocusIfVisible;
		Object.values(HoverFocusBehavior).includes(a) ? o = a : typeof a == "boolean" && a && (o = HoverFocusBehavior.AutoFocusImmediately);
		let s = (e) => {
			let r = n.getPosition(), a = new Range(r.lineNumber, r.column, r.lineNumber, r.column);
			i.showContentHover(a, 1, 1, e);
		}, c = n.getOption(2) === 2;
		i.isHoverVisible ? o === HoverFocusBehavior.NoAutoFocus ? s(c) : i.focus() : s(c || o === 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, n) {
		let r = ContentHoverController.get(n);
		if (!r) return;
		let i = n.getPosition();
		if (!i) return;
		let a = new Range(i.lineNumber, i.column, i.lineNumber, i.column), o = GotoDefinitionAtPositionEditorContribution.get(n);
		o && o.startFindDefinitionFromCursor(i).then(() => {
			r.showContentHover(a, 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, n) {
		let r = ContentHoverController.get(n);
		r && r.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, n) {
		let r = ContentHoverController.get(n);
		r && r.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, n) {
		let r = ContentHoverController.get(n);
		r && r.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, n) {
		let r = ContentHoverController.get(n);
		r && r.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, n) {
		let r = ContentHoverController.get(n);
		r && r.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, n) {
		let r = ContentHoverController.get(n);
		r && r.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, n) {
		let r = ContentHoverController.get(n);
		r && r.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, n) {
		let r = ContentHoverController.get(n);
		r && r.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, n, r) {
		let i = ContentHoverController.get(n);
		if (!i) return;
		let a = r?.index === void 0 ? i.focusedHoverPartIndex() : r.index;
		i.updateHoverVerbosityLevel(HoverVerbosityAction.Increase, a, r?.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, n, r) {
		let i = ContentHoverController.get(n);
		if (!i) return;
		let a = r?.index === void 0 ? i.focusedHoverPartIndex() : r.index;
		ContentHoverController.get(n)?.updateHoverVerbosityLevel(HoverVerbosityAction.Decrease, a, r?.focus);
	}
}, __decorate$43 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$43 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, $$3 = $, MarkerHover = class {
	constructor(e, n, r) {
		this.owner = e, this.range = n, this.marker = r;
	}
	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, n, r, i) {
		this._editor = e, this._markerDecorationsService = n, this._openerService = r, this._languageFeaturesService = i, this.hoverOrdinal = 1, this.recentMarkerCodeActionsInfo = void 0;
	}
	computeSync(e, n) {
		if (!this._editor.hasModel() || e.type !== 1 && !e.supportsMarkerHover) return [];
		let r = this._editor.getModel(), i = e.range.startLineNumber, a = r.getLineMaxColumn(i), o = [];
		for (let s of n) {
			let n = s.range.startLineNumber === i ? s.range.startColumn : 1, c = s.range.endLineNumber === i ? s.range.endColumn : a, l = this._markerDecorationsService.getMarker(r.uri, s);
			if (!l) continue;
			let u = new Range(e.range.startLineNumber, n, e.range.startLineNumber, c);
			o.push(new MarkerHover(this, u, l));
		}
		return o;
	}
	renderHoverParts(e, n) {
		if (!n.length) return new RenderedHoverParts([]);
		let r = new DisposableStore(), i = [];
		n.forEach((n) => {
			let r = this._renderMarkerHover(n);
			e.fragment.appendChild(r.hoverElement), i.push(r);
		});
		let a = n.length === 1 ? n[0] : n.sort((e, n) => MarkerSeverity.compare(e.marker.severity, n.marker.severity))[0];
		return this.renderMarkerStatusbar(e, a, r), new RenderedHoverParts(i);
	}
	_renderMarkerHover(e) {
		let n = new DisposableStore(), r = $$3("div.hover-row"), i = append(r, $$3("div.marker.hover-contents")), { source: a, message: o, code: s, relatedInformation: c } = e.marker;
		this._editor.applyFontInfo(i);
		let l = append(i, $$3("span"));
		if (l.style.whiteSpace = "pre-wrap", l.innerText = o, a || s) if (s && typeof s != "string") {
			let e = $$3("span");
			if (a) {
				let n = append(e, $$3("span"));
				n.innerText = a;
			}
			let r = append(e, $$3("a.code-link"));
			r.setAttribute("href", s.target.toString()), n.add(addDisposableListener(r, "click", (e) => {
				this._openerService.open(s.target, { allowCommands: !0 }), e.preventDefault(), e.stopPropagation();
			}));
			let o = append(r, $$3("span"));
			o.innerText = s.value;
			let c = append(i, e);
			c.style.opacity = "0.6", c.style.paddingLeft = "6px";
		} else {
			let e = append(i, $$3("span"));
			e.style.opacity = "0.6", e.style.paddingLeft = "6px", e.innerText = a && s ? `${a}(${s})` : a || `(${s})`;
		}
		if (isNonEmptyArray(c)) for (let { message: e, resource: r, startLineNumber: a, startColumn: o } of c) {
			let s = append(i, $$3("div"));
			s.style.marginTop = "8px";
			let c = append(s, $$3("a"));
			c.innerText = `${basename(r)}(${a}, ${o}): `, c.style.cursor = "pointer", n.add(addDisposableListener(c, "click", (e) => {
				if (e.stopPropagation(), e.preventDefault(), this._openerService) {
					let e = { selection: {
						startLineNumber: a,
						startColumn: o
					} };
					this._openerService.open(r, {
						fromUserGesture: !0,
						editorOptions: e
					}).catch(onUnexpectedError);
				}
			}));
			let l = append(s, $$3("span"));
			l.innerText = e, this._editor.applyFontInfo(l);
		}
		return {
			hoverPart: e,
			hoverElement: r,
			dispose: () => n.dispose()
		};
	}
	renderMarkerStatusbar(e, n, r) {
		if (n.marker.severity === MarkerSeverity.Error || n.marker.severity === MarkerSeverity.Warning || n.marker.severity === MarkerSeverity.Info) {
			let r = MarkerController.get(this._editor);
			r && e.statusBar.addAction({
				label: localize("view problem", "View Problem"),
				commandId: NextMarkerAction.ID,
				run: () => {
					e.hide(), r.showAtMarker(n.marker), this._editor.focus();
				}
			});
		}
		if (!this._editor.getOption(92)) {
			let i = e.statusBar.append($$3("div"));
			this.recentMarkerCodeActionsInfo && (IMarkerData.makeKey(this.recentMarkerCodeActionsInfo.marker) === IMarkerData.makeKey(n.marker) ? this.recentMarkerCodeActionsInfo.hasCodeActions || (i.textContent = localize("noQuickFixes", "No quick fixes available")) : this.recentMarkerCodeActionsInfo = void 0);
			let a = this.recentMarkerCodeActionsInfo && !this.recentMarkerCodeActionsInfo.hasCodeActions ? Disposable.None : disposableTimeout(() => i.textContent = localize("checkingForQuickFixes", "Checking for quick fixes..."), 200, r);
			i.textContent ||= "\xA0";
			let o = this.getCodeActions(n.marker);
			r.add(toDisposable(() => o.cancel())), o.then((o) => {
				if (a.dispose(), this.recentMarkerCodeActionsInfo = {
					marker: n.marker,
					hasCodeActions: o.validActions.length > 0
				}, !this.recentMarkerCodeActionsInfo.hasCodeActions) {
					o.dispose(), i.textContent = localize("noQuickFixes", "No quick fixes available");
					return;
				}
				i.style.display = "none";
				let s = !1;
				r.add(toDisposable(() => {
					s || o.dispose();
				})), e.statusBar.addAction({
					label: localize("quick fixes", "Quick Fix..."),
					commandId: quickFixCommandId,
					run: (n) => {
						s = !0;
						let r = CodeActionController.get(this._editor), i = getDomNodePagePosition(n);
						e.hide(), r?.showCodeActions(markerCodeActionTrigger, o, {
							x: i.left,
							y: i.top,
							width: i.width,
							height: i.height
						});
					}
				});
			}, onUnexpectedError);
		}
	}
	getCodeActions(e) {
		return createCancelablePromise((n) => getCodeActions(this._languageFeaturesService.codeActionProvider, this._editor.getModel(), new Range(e.startLineNumber, e.startColumn, e.endLineNumber, e.endColumn), markerCodeActionTrigger, Progress.None, n));
	}
};
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 }), n = this._editor.getLineDecorations(this._lineNumber), r = [], i = this._laneOrLine === "lineNo";
		if (!n) return r;
		for (let a of n) {
			let n = a.options.glyphMargin?.position ?? GlyphMarginLane.Center;
			if (!i && n !== this._laneOrLine) continue;
			let o = i ? a.options.lineNumberHoverMessage : a.options.glyphMarginHoverMessage;
			!o || isEmptyMarkdownString(o) || r.push(...asArray(o).map(e));
		}
		return r;
	}
}, __decorate$42 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$42 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, MarginHoverWidget_1, $$2 = $, MarginHoverWidget = class extends Disposable {
	static {
		MarginHoverWidget_1 = this;
	}
	static {
		this.ID = "editor.contrib.modesGlyphHoverWidget";
	}
	constructor(e, n, r) {
		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 }, n, r)), 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 n = e.target;
		return n.type === 2 && n.detail.glyphMarginLane ? (this._startShowingAt(n.position.lineNumber, n.detail.glyphMarginLane), !0) : n.type === 3 ? (this._startShowingAt(n.position.lineNumber, "lineNo"), !0) : !1;
	}
	_startShowingAt(e, n) {
		this._computer.lineNumber === e && this._computer.lane === n || (this._hoverOperation.cancel(), this.hide(), this._computer.lineNumber = e, this._computer.lane = n, 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, n) {
		this._renderDisposeables.clear();
		let r = document.createDocumentFragment();
		for (let e of n) {
			let n = $$2("div.hover-row.markdown-hover"), i = append(n, $$2("div.hover-contents")), a = this._renderDisposeables.add(this._markdownRenderer.render(e.value));
			i.appendChild(a.element), r.appendChild(n);
		}
		this._updateContents(r), 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 n = this._editor.getLayoutInfo(), r = this._editor.getTopForLineNumber(e), i = this._editor.getScrollTop(), a = this._editor.getOption(67), o = this._hover.containerDomNode.clientHeight, s = r - i - (o - a) / 2, c = n.glyphMarginLeft + n.glyphMarginWidth + (this._computer.lane === "lineNo" ? n.lineNumbersWidth : 0);
		this._hover.containerDomNode.style.left = `${c}px`, this._hover.containerDomNode.style.top = `${Math.max(Math.round(s), 0)}px`;
	}
	_onMouseLeave(e) {
		let n = this._editor.getDomNode();
		(!n || !isMousePositionWithinElement(n, 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, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$41 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, MarginHoverController = class extends Disposable {
	static {
		this.ID = "editor.contrib.marginHover";
	}
	constructor(e, n) {
		super(), this._editor = e, this._instantiationService = n, 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 n = this._glyphWidget?.getDomNode();
		return n ? isMousePositionWithinElement(n, 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 n = this._hoverSettings.sticky, r = this._isMouseOnMarginHoverWidget(e);
		return n && r;
	}
	_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, n) => {
	let r = e.getColor(editorHoverBorder);
	r && (n.addRule(`.monaco-editor .monaco-hover .hover-row:not(:first-child):not(:empty) { border-top: 1px solid ${r.transparent(.5)}; }`), n.addRule(`.monaco-editor .monaco-hover hr { border-top: 1px solid ${r.transparent(.5)}; }`), n.addRule(`.monaco-editor .monaco-hover hr { border-bottom: 0px solid ${r.transparent(.5)}; }`));
}), AccessibleViewRegistry.register(new HoverAccessibleView()), AccessibleViewRegistry.register(new HoverAccessibilityHelp()), AccessibleViewRegistry.register(new ExtHoverAccessibleView());
function getSpaceCnt(e, n) {
	let r = 0;
	for (let i = 0; i < e.length; i++) e.charAt(i) === "	" ? r += n : r++;
	return r;
}
function generateIndent(e, n, r) {
	e = e < 0 ? 0 : e;
	let i = "";
	if (!r) {
		let r = Math.floor(e / n);
		e %= n;
		for (let e = 0; e < r; e++) i += "	";
	}
	for (let n = 0; n < e; n++) i += " ";
	return i;
}
function getReindentEditOperations(e, n, r, i) {
	if (e.getLineCount() === 1 && e.getLineMaxColumn(1) === 1) return [];
	let a = n.getLanguageConfiguration(e.getLanguageId()).indentRulesSupport;
	if (!a) return [];
	let o = new ProcessedIndentRulesSupport(e, a, n);
	for (i = Math.min(i, e.getLineCount()); r <= i && o.shouldIgnore(r);) r++;
	if (r > i - 1) return [];
	let { tabSize: s, indentSize: c, insertSpaces: l } = e.getOptions(), u = (e, n) => (n ||= 1, ShiftCommand.shiftIndent(e, e.length + n, s, c, l)), d = (e, n) => (n ||= 1, ShiftCommand.unshiftIndent(e, e.length + n, s, c, l)), f = [], m = e.getLineContent(r), g = getLeadingWhitespace(m), _ = g;
	o.shouldIncrease(r) ? (_ = u(_), g = u(g)) : o.shouldIndentNextLine(r) && (_ = u(_)), r++;
	for (let n = r; n <= i; n++) {
		if (doesLineStartWithString(e, n)) continue;
		let r = e.getLineContent(n), i = getLeadingWhitespace(r), a = _;
		o.shouldDecrease(n, a) && (_ = d(_), g = d(g)), i !== _ && f.push(EditOperation.replaceMove(new Selection(n, 1, n, i.length + 1), normalizeIndentation(_, c, l))), !o.shouldIgnore(n) && (o.shouldIncrease(n, a) ? (g = u(g), _ = g) : _ = o.shouldIndentNextLine(n, a) ? u(_) : g);
	}
	return f;
}
function doesLineStartWithString(e, n) {
	return e.tokenization.isCheapToTokenize(n) ? e.tokenization.getLineTokens(n).getStandardTokenType(0) === 2 : !1;
}
var __decorate$40 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$40 = function(e, n) {
	return function(r, i) {
		n(r, i, 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, n) {
		let r = n.getModel();
		if (!r) return;
		let i = r.getOptions(), a = n.getSelection();
		if (!a) return;
		let o = new IndentationToSpacesCommand(a, i.tabSize);
		n.pushUndoStop(), n.executeCommands(this.id, [o]), n.pushUndoStop(), r.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, n) {
		let r = n.getModel();
		if (!r) return;
		let i = r.getOptions(), a = n.getSelection();
		if (!a) return;
		let o = new IndentationToTabsCommand(a, i.tabSize);
		n.pushUndoStop(), n.executeCommands(this.id, [o]), n.pushUndoStop(), r.updateOptions({ insertSpaces: !1 });
	}
}, ChangeIndentationSizeAction = class extends EditorAction {
	constructor(e, n, r) {
		super(r), this.insertSpaces = e, this.displaySizeOnly = n;
	}
	run(e, n) {
		let r = e.get(IQuickInputService), i = e.get(IModelService), a = n.getModel();
		if (!a) return;
		let o = i.getCreationOptions(a.getLanguageId(), a.uri, a.isForSimpleWidget), s = a.getOptions(), c = [
			1,
			2,
			3,
			4,
			5,
			6,
			7,
			8
		].map((e) => ({
			id: e.toString(),
			label: e.toString(),
			description: e === o.tabSize && e === s.tabSize ? localize("configuredTabSize", "Configured Tab Size") : e === o.tabSize ? localize("defaultTabSize", "Default Tab Size") : e === s.tabSize ? localize("currentTabSize", "Current Tab Size") : void 0
		})), l = Math.min(a.getOptions().tabSize - 1, 7);
		setTimeout(() => {
			r.pick(c, {
				placeHolder: localize({
					key: "selectTabWidth",
					comment: ["Tab corresponds to the tab key"]
				}, "Select Tab Size for Current File"),
				activeItem: c[l]
			}).then((e) => {
				if (e && a && !a.isDisposed()) {
					let n = parseInt(e.label, 10);
					this.displaySizeOnly ? a.updateOptions({ tabSize: n }) : a.updateOptions({
						tabSize: n,
						indentSize: n,
						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, n) {
		let r = e.get(IModelService), i = n.getModel();
		if (!i) return;
		let a = r.getCreationOptions(i.getLanguageId(), i.uri, i.isForSimpleWidget);
		i.detectIndentation(a.insertSpaces, a.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, n) {
		let r = e.get(ILanguageConfigurationService), i = n.getModel();
		if (!i) return;
		let a = getReindentEditOperations(i, r, 1, i.getLineCount());
		a.length > 0 && (n.pushUndoStop(), n.executeEdits(this.id, a), n.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, n) {
		let r = e.get(ILanguageConfigurationService), i = n.getModel();
		if (!i) return;
		let a = n.getSelections();
		if (a === null) return;
		let o = [];
		for (let e of a) {
			let n = e.startLineNumber, a = e.endLineNumber;
			if (n !== a && e.endColumn === 1 && a--, n === 1) {
				if (n === a) continue;
			} else n--;
			let s = getReindentEditOperations(i, r, n, a);
			o.push(...s);
		}
		o.length > 0 && (n.pushUndoStop(), n.executeEdits(this.id, o), n.pushUndoStop());
	}
}, AutoIndentOnPasteCommand = class {
	constructor(e, n) {
		this._initialSelection = n, this._edits = [], this._selectionId = null;
		for (let n of e) n.range && typeof n.text == "string" && this._edits.push(n);
	}
	getEditOperations(e, n) {
		for (let e of this._edits) n.addEditOperation(Range.lift(e.range), e.text);
		let r = !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 ? (r = !0, this._selectionId = n.trackSelection(this._initialSelection, !0)) : this._edits[0].range.endColumn === this._initialSelection.startColumn && this._edits[0].range.endLineNumber === this._initialSelection.startLineNumber && (r = !0, this._selectionId = n.trackSelection(this._initialSelection, !1))), r || (this._selectionId = n.trackSelection(this._initialSelection));
	}
	computeCursorState(e, n) {
		return n.getTrackedSelection(this._selectionId);
	}
}, AutoIndentOnPaste = class {
	static {
		this.ID = "editor.contrib.autoIndentOnPaste";
	}
	constructor(e, n) {
		this.editor = e, this._languageConfigurationService = n, 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 n = this.editor.getSelections();
		if (n === null || n.length > 1) return;
		let r = this.editor.getModel();
		if (!r || this.rangeContainsOnlyWhitespaceCharacters(r, e) || isStartOrEndInString(r, e) || !r.tokenization.isCheapToTokenize(e.getStartPosition().lineNumber)) return;
		let i = this.editor.getOption(12), { tabSize: a, indentSize: o, insertSpaces: s } = r.getOptions(), c = [], l = {
			shiftIndent: (e) => ShiftCommand.shiftIndent(e, e.length + 1, a, o, s),
			unshiftIndent: (e) => ShiftCommand.unshiftIndent(e, e.length + 1, a, o, s)
		}, u = e.startLineNumber;
		for (; u <= e.endLineNumber;) {
			if (this.shouldIgnoreLine(r, u)) {
				u++;
				continue;
			}
			break;
		}
		if (u > e.endLineNumber) return;
		let d = r.getLineContent(u);
		if (!/\S/.test(d.substring(0, e.startColumn - 1))) {
			let e = getGoodIndentForLine(i, r, r.getLanguageId(), u, l, this._languageConfigurationService);
			if (e !== null) {
				let n = getLeadingWhitespace(d), i = getSpaceCnt(e, a), o = getSpaceCnt(n, a);
				if (i !== o) {
					let e = generateIndent(i, a, s);
					c.push({
						range: new Range(u, 1, u, n.length + 1),
						text: e
					}), d = e + d.substring(n.length);
				} else {
					let e = getIndentMetadata(r, u, this._languageConfigurationService);
					if (e === 0 || e === 8) return;
				}
			}
		}
		let f = u;
		for (; u < e.endLineNumber;) {
			if (!/\S/.test(r.getLineContent(u + 1))) {
				u++;
				continue;
			}
			break;
		}
		if (u !== e.endLineNumber) {
			let n = getGoodIndentForLine(i, {
				tokenization: {
					getLineTokens: (e) => r.tokenization.getLineTokens(e),
					getLanguageId: () => r.getLanguageId(),
					getLanguageIdAtPosition: (e, n) => r.getLanguageIdAtPosition(e, n)
				},
				getLineContent: (e) => e === f ? d : r.getLineContent(e)
			}, r.getLanguageId(), u + 1, l, this._languageConfigurationService);
			if (n !== null) {
				let i = getSpaceCnt(n, a), o = getSpaceCnt(getLeadingWhitespace(r.getLineContent(u + 1)), a);
				if (i !== o) {
					let n = i - o;
					for (let i = u + 1; i <= e.endLineNumber; i++) {
						let e = r.getLineContent(i), o = getLeadingWhitespace(e), l = getSpaceCnt(o, a) + n, u = generateIndent(l, a, s);
						u !== o && c.push({
							range: new Range(i, 1, i, o.length + 1),
							text: u
						});
					}
				}
			}
		}
		if (c.length > 0) {
			this.editor.pushUndoStop();
			let e = new AutoIndentOnPasteCommand(c, this.editor.getSelection());
			this.editor.executeCommand("autoIndentOnPaste", e), this.editor.pushUndoStop();
		}
	}
	rangeContainsOnlyWhitespaceCharacters(e, n) {
		let r = (e) => e.trim().length === 0, i = !0;
		if (n.startLineNumber === n.endLineNumber) {
			let a = e.getLineContent(n.startLineNumber).substring(n.startColumn - 1, n.endColumn - 1);
			i = r(a);
		} else for (let a = n.startLineNumber; a <= n.endLineNumber; a++) {
			let o = e.getLineContent(a);
			if (a === n.startLineNumber) {
				let e = o.substring(n.startColumn - 1);
				i = r(e);
			} else if (a === n.endLineNumber) {
				let e = o.substring(0, n.endColumn - 1);
				i = r(e);
			} else i = e.getLineFirstNonWhitespaceColumn(a) === 0;
			if (!i) break;
		}
		return i;
	}
	shouldIgnoreLine(e, n) {
		e.tokenization.forceTokenization(n);
		let r = e.getLineFirstNonWhitespaceColumn(n);
		if (r === 0) return !0;
		let i = e.tokenization.getLineTokens(n);
		if (i.getCount() > 0) {
			let e = i.findTokenIndexAtOffset(r);
			if (e >= 0 && i.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, n) {
	let r = (n) => getStandardTokenTypeAtPosition(e, n) === 2;
	return r(n.getStartPosition()) || r(n.getEndPosition());
}
function getIndentationEditOperations(e, n, r, i) {
	if (e.getLineCount() === 1 && e.getLineMaxColumn(1) === 1) return;
	let a = "";
	for (let e = 0; e < r; e++) a += " ";
	let o = new RegExp(a, "gi");
	for (let r = 1, s = e.getLineCount(); r <= s; r++) {
		let s = e.getLineFirstNonWhitespaceColumn(r);
		if (s === 0 && (s = e.getLineMaxColumn(r)), s === 1) continue;
		let c = new Range(r, 1, r, s), l = e.getValueInRange(c), u = i ? l.replace(/\t/gi, a) : l.replace(o, "	");
		n.addEditOperation(c, u);
	}
}
var IndentationToSpacesCommand = class {
	constructor(e, n) {
		this.selection = e, this.tabSize = n, this.selectionId = null;
	}
	getEditOperations(e, n) {
		this.selectionId = n.trackSelection(this.selection), getIndentationEditOperations(e, n, this.tabSize, !0);
	}
	computeCursorState(e, n) {
		return n.getTrackedSelection(this.selectionId);
	}
}, IndentationToTabsCommand = class {
	constructor(e, n) {
		this.selection = e, this.tabSize = n, this.selectionId = null;
	}
	getEditOperations(e, n) {
		this.selectionId = n.trackSelection(this.selection), getIndentationEditOperations(e, n, this.tabSize, !1);
	}
	computeCursorState(e, n) {
		return n.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, n, r) {
		this._editRange = e, this._originalSelection = n, this._text = r;
	}
	getEditOperations(e, n) {
		n.addTrackedEditOperation(this._editRange, this._text);
	}
	computeCursorState(e, n) {
		let r = n.getInverseEditOperations()[0].range;
		return this._originalSelection.isEmpty() ? new Selection(r.endLineNumber, Math.min(this._originalSelection.positionColumn, r.endColumn), r.endLineNumber, Math.min(this._originalSelection.positionColumn, r.endColumn)) : new Selection(r.endLineNumber, r.endColumn - this._text.length, r.endLineNumber, r.endColumn);
	}
}, __decorate$39 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$39 = function(e, n) {
	return function(r, i) {
		n(r, i, 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, n) {
		this.editor = e, this.editorWorkerService = n, this.decorations = this.editor.createDecorationsCollection();
	}
	dispose() {}
	run(e, n) {
		this.currentRequest?.cancel();
		let r = this.editor.getSelection(), i = this.editor.getModel();
		if (!i || !r) return;
		let a = r;
		if (a.startLineNumber !== a.endLineNumber) return;
		let o = new EditorState(this.editor, 5), s = i.uri;
		return this.editorWorkerService.canNavigateValueSet(s) ? (this.currentRequest = createCancelablePromise((e) => this.editorWorkerService.navigateValueSet(s, a, n)), this.currentRequest.then((n) => {
			if (!n || !n.range || !n.value || !o.validate(this.editor)) return;
			let r = Range.lift(n.range), i = n.range, s = n.value.length - (a.endColumn - a.startColumn);
			i = {
				startLineNumber: i.startLineNumber,
				startColumn: i.startColumn,
				endLineNumber: i.endLineNumber,
				endColumn: i.startColumn + n.value.length
			}, s > 1 && (a = new Selection(a.startLineNumber, a.startColumn, a.endLineNumber, a.endColumn + s - 1));
			let c = new InPlaceReplaceCommand(r, a, n.value);
			this.editor.pushUndoStop(), this.editor.executeCommand(e, c), this.editor.pushUndoStop(), this.decorations.set([{
				range: i,
				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, n) {
		let r = InPlaceReplaceController.get(n);
		return r ? r.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, n) {
		let r = InPlaceReplaceController.get(n);
		return r ? r.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, n, r) {
		if (r ||= {}, !n.hasModel()) return;
		let i = n._getViewModel();
		i.model.pushStackElement(), i.setCursorStates(r.source, 3, CursorMoveCommands.expandLineSelection(i, i.getCursorStates())), i.revealAllCursors(r.source, !0);
	}
});
var TrimTrailingWhitespaceCommand = class {
	constructor(e, n, r) {
		this._selection = e, this._cursors = n, this._selectionId = null, this._trimInRegexesAndStrings = r;
	}
	getEditOperations(e, n) {
		let r = trimTrailingWhitespace(e, this._cursors, this._trimInRegexesAndStrings);
		for (let e = 0, i = r.length; e < i; e++) {
			let i = r[e];
			n.addEditOperation(i.range, i.text);
		}
		this._selectionId = n.trackSelection(this._selection);
	}
	computeCursorState(e, n) {
		return n.getTrackedSelection(this._selectionId);
	}
};
function trimTrailingWhitespace(e, n, r) {
	n.sort((e, n) => e.lineNumber === n.lineNumber ? e.column - n.column : e.lineNumber - n.lineNumber);
	for (let e = n.length - 2; e >= 0; e--) n[e].lineNumber === n[e + 1].lineNumber && n.splice(e, 1);
	let i = [], a = 0, o = 0, s = n.length;
	for (let c = 1, l = e.getLineCount(); c <= l; c++) {
		let l = e.getLineContent(c), u = l.length + 1, d = 0;
		if (o < s && n[o].lineNumber === c && (d = n[o].column, o++, d === u) || l.length === 0) continue;
		let f = lastNonWhitespaceIndex(l), m = 0;
		if (f === -1) m = 1;
		else if (f !== l.length - 1) m = f + 2;
		else continue;
		if (!r) {
			if (!e.tokenization.hasAccurateTokensForLine(c)) continue;
			let n = e.tokenization.getLineTokens(c), r = n.getStandardTokenType(n.findTokenIndexAtOffset(m));
			if (r === 2 || r === 3) continue;
		}
		m = Math.max(d, m), i[a++] = EditOperation.delete(new Range(c, m, c, u));
	}
	return i;
}
var CopyLinesCommand = class {
	constructor(e, n, r) {
		this._selection = e, this._isCopyingDown = n, this._noop = r || !1, this._selectionDirection = 0, this._selectionId = null, this._startLineNumberDelta = 0, this._endLineNumberDelta = 0;
	}
	getEditOperations(e, n) {
		let r = this._selection;
		this._startLineNumberDelta = 0, this._endLineNumberDelta = 0, r.startLineNumber < r.endLineNumber && r.endColumn === 1 && (this._endLineNumberDelta = 1, r = r.setEndPosition(r.endLineNumber - 1, e.getLineMaxColumn(r.endLineNumber - 1)));
		let i = [];
		for (let n = r.startLineNumber; n <= r.endLineNumber; n++) i.push(e.getLineContent(n));
		let a = i.join("\n");
		a === "" && this._isCopyingDown && (this._startLineNumberDelta++, this._endLineNumberDelta++), this._noop ? n.addEditOperation(new Range(r.endLineNumber, e.getLineMaxColumn(r.endLineNumber), r.endLineNumber + 1, 1), r.endLineNumber === e.getLineCount() ? "" : "\n") : this._isCopyingDown ? n.addEditOperation(new Range(r.startLineNumber, 1, r.startLineNumber, 1), a + "\n") : n.addEditOperation(new Range(r.endLineNumber, e.getLineMaxColumn(r.endLineNumber), r.endLineNumber, e.getLineMaxColumn(r.endLineNumber)), "\n" + a), this._selectionId = n.trackSelection(r), this._selectionDirection = this._selection.getDirection();
	}
	computeCursorState(e, n) {
		let r = n.getTrackedSelection(this._selectionId);
		if (this._startLineNumberDelta !== 0 || this._endLineNumberDelta !== 0) {
			let e = r.startLineNumber, n = r.startColumn, i = r.endLineNumber, a = r.endColumn;
			this._startLineNumberDelta !== 0 && (e += this._startLineNumberDelta, n = 1), this._endLineNumberDelta !== 0 && (i += this._endLineNumberDelta, a = 1), r = Selection.createWithDirection(e, n, i, a, this._selectionDirection);
		}
		return r;
	}
}, __decorate$38 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$38 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, MoveLinesCommand = class {
	constructor(e, n, r, i) {
		this._languageConfigurationService = i, this._selection = e, this._isMovingDown = n, this._autoIndent = r, this._selectionId = null, this._moveEndLineSelectionShrink = !1;
	}
	getEditOperations(e, n) {
		let r = () => e.getLanguageId(), i = (n, r) => e.getLanguageIdAtPosition(n, r), a = e.getLineCount();
		if (this._isMovingDown && this._selection.endLineNumber === a) {
			this._selectionId = n.trackSelection(this._selection);
			return;
		}
		if (!this._isMovingDown && this._selection.startLineNumber === 1) {
			this._selectionId = n.trackSelection(this._selection);
			return;
		}
		this._moveEndPositionDown = !1;
		let o = this._selection;
		o.startLineNumber < o.endLineNumber && o.endColumn === 1 && (this._moveEndPositionDown = !0, o = o.setEndPosition(o.endLineNumber - 1, e.getLineMaxColumn(o.endLineNumber - 1)));
		let { tabSize: s, indentSize: c, insertSpaces: l } = e.getOptions(), u = this.buildIndentConverter(s, c, l);
		if (o.startLineNumber === o.endLineNumber && e.getLineMaxColumn(o.startLineNumber) === 1) {
			let r = o.startLineNumber, i = this._isMovingDown ? r + 1 : r - 1;
			e.getLineMaxColumn(i) === 1 ? n.addEditOperation(new Range(1, 1, 1, 1), null) : (n.addEditOperation(new Range(r, 1, r, 1), e.getLineContent(i)), n.addEditOperation(new Range(i, 1, i, e.getLineMaxColumn(i)), null)), o = new Selection(i, 1, i, 1);
		} else {
			let a, c;
			if (this._isMovingDown) {
				a = o.endLineNumber + 1, c = e.getLineContent(a), n.addEditOperation(new Range(a - 1, e.getLineMaxColumn(a - 1), a, e.getLineMaxColumn(a)), null);
				let d = c;
				if (this.shouldAutoIndent(e, o)) {
					let f = this.matchEnterRule(e, u, s, a, o.startLineNumber - 1);
					if (f !== null) {
						let n = getLeadingWhitespace(e.getLineContent(a)), r = f + getSpaceCnt(n, s);
						d = generateIndent(r, s, l) + this.trimStart(c);
					} else {
						let n = {
							tokenization: {
								getLineTokens: (n) => n === o.startLineNumber ? e.tokenization.getLineTokens(a) : e.tokenization.getLineTokens(n),
								getLanguageId: r,
								getLanguageIdAtPosition: i
							},
							getLineContent: (n) => n === o.startLineNumber ? e.getLineContent(a) : e.getLineContent(n)
						}, f = getGoodIndentForLine(this._autoIndent, n, e.getLanguageIdAtPosition(a, 1), o.startLineNumber, u, this._languageConfigurationService);
						if (f !== null) {
							let n = getLeadingWhitespace(e.getLineContent(a)), r = getSpaceCnt(f, s), i = getSpaceCnt(n, s);
							r !== i && (d = generateIndent(r, s, l) + this.trimStart(c));
						}
					}
					n.addEditOperation(new Range(o.startLineNumber, 1, o.startLineNumber, 1), d + "\n");
					let m = this.matchEnterRuleMovingDown(e, u, s, o.startLineNumber, a, d);
					if (m !== null) m !== 0 && this.getIndentEditsOfMovingBlock(e, n, o, s, l, m);
					else {
						let c = {
							tokenization: {
								getLineTokens: (n) => n === o.startLineNumber ? e.tokenization.getLineTokens(a) : n >= o.startLineNumber + 1 && n <= o.endLineNumber + 1 ? e.tokenization.getLineTokens(n - 1) : e.tokenization.getLineTokens(n),
								getLanguageId: r,
								getLanguageIdAtPosition: i
							},
							getLineContent: (n) => n === o.startLineNumber ? d : n >= o.startLineNumber + 1 && n <= o.endLineNumber + 1 ? e.getLineContent(n - 1) : e.getLineContent(n)
						}, f = getGoodIndentForLine(this._autoIndent, c, e.getLanguageIdAtPosition(a, 1), o.startLineNumber + 1, u, this._languageConfigurationService);
						if (f !== null) {
							let r = getLeadingWhitespace(e.getLineContent(o.startLineNumber)), i = getSpaceCnt(f, s), a = getSpaceCnt(r, s);
							if (i !== a) {
								let r = i - a;
								this.getIndentEditsOfMovingBlock(e, n, o, s, l, r);
							}
						}
					}
				} else n.addEditOperation(new Range(o.startLineNumber, 1, o.startLineNumber, 1), d + "\n");
			} else if (a = o.startLineNumber - 1, c = e.getLineContent(a), n.addEditOperation(new Range(a, 1, a + 1, 1), null), n.addEditOperation(new Range(o.endLineNumber, e.getLineMaxColumn(o.endLineNumber), o.endLineNumber, e.getLineMaxColumn(o.endLineNumber)), "\n" + c), this.shouldAutoIndent(e, o)) {
				let c = {
					tokenization: {
						getLineTokens: (n) => n === a ? e.tokenization.getLineTokens(o.startLineNumber) : e.tokenization.getLineTokens(n),
						getLanguageId: r,
						getLanguageIdAtPosition: i
					},
					getLineContent: (n) => n === a ? e.getLineContent(o.startLineNumber) : e.getLineContent(n)
				}, d = this.matchEnterRule(e, u, s, o.startLineNumber, o.startLineNumber - 2);
				if (d !== null) d !== 0 && this.getIndentEditsOfMovingBlock(e, n, o, s, l, d);
				else {
					let r = getGoodIndentForLine(this._autoIndent, c, e.getLanguageIdAtPosition(o.startLineNumber, 1), a, u, this._languageConfigurationService);
					if (r !== null) {
						let i = getLeadingWhitespace(e.getLineContent(o.startLineNumber)), a = getSpaceCnt(r, s), c = getSpaceCnt(i, s);
						if (a !== c) {
							let r = a - c;
							this.getIndentEditsOfMovingBlock(e, n, o, s, l, r);
						}
					}
				}
			}
		}
		this._selectionId = n.trackSelection(o);
	}
	buildIndentConverter(e, n, r) {
		return {
			shiftIndent: (i) => ShiftCommand.shiftIndent(i, i.length + 1, e, n, r),
			unshiftIndent: (i) => ShiftCommand.unshiftIndent(i, i.length + 1, e, n, r)
		};
	}
	parseEnterResult(e, n, r, i, a) {
		if (a) {
			let o = a.indentation;
			a.indentAction === IndentAction.None || a.indentAction === IndentAction.Indent ? o = a.indentation + a.appendText : a.indentAction === IndentAction.IndentOutdent ? o = a.indentation : a.indentAction === IndentAction.Outdent && (o = n.unshiftIndent(a.indentation) + a.appendText);
			let s = e.getLineContent(i);
			if (this.trimStart(s).indexOf(this.trimStart(o)) >= 0) {
				let a = getLeadingWhitespace(e.getLineContent(i)), s = getLeadingWhitespace(o), c = getIndentMetadata(e, i, this._languageConfigurationService);
				c !== null && c & 2 && (s = n.unshiftIndent(s));
				let l = getSpaceCnt(s, r), u = getSpaceCnt(a, r);
				return l - u;
			}
		}
		return null;
	}
	matchEnterRuleMovingDown(e, n, r, i, a, o) {
		if (lastNonWhitespaceIndex(o) >= 0) {
			let o = e.getLineMaxColumn(a), s = getEnterAction(this._autoIndent, e, new Range(a, o, a, o), this._languageConfigurationService);
			return this.parseEnterResult(e, n, r, i, s);
		} else {
			let a = i - 1;
			for (; a >= 1;) {
				let n = e.getLineContent(a);
				if (lastNonWhitespaceIndex(n) >= 0) break;
				a--;
			}
			if (a < 1 || i > e.getLineCount()) return null;
			let o = e.getLineMaxColumn(a), s = getEnterAction(this._autoIndent, e, new Range(a, o, a, o), this._languageConfigurationService);
			return this.parseEnterResult(e, n, r, i, s);
		}
	}
	matchEnterRule(e, n, r, i, a, o) {
		let s = a;
		for (; s >= 1;) {
			let n;
			if (n = s === a && o !== void 0 ? o : e.getLineContent(s), lastNonWhitespaceIndex(n) >= 0) break;
			s--;
		}
		if (s < 1 || i > e.getLineCount()) return null;
		let c = e.getLineMaxColumn(s), l = getEnterAction(this._autoIndent, e, new Range(s, c, s, c), this._languageConfigurationService);
		return this.parseEnterResult(e, n, r, i, l);
	}
	trimStart(e) {
		return e.replace(/^\s+/, "");
	}
	shouldAutoIndent(e, n) {
		if (this._autoIndent < 4 || !e.tokenization.isCheapToTokenize(n.startLineNumber)) return !1;
		let r = e.getLanguageIdAtPosition(n.startLineNumber, 1), i = e.getLanguageIdAtPosition(n.endLineNumber, 1);
		return !(r !== i || this._languageConfigurationService.getLanguageConfiguration(r).indentRulesSupport === null);
	}
	getIndentEditsOfMovingBlock(e, n, r, i, a, o) {
		for (let s = r.startLineNumber; s <= r.endLineNumber; s++) {
			let c = e.getLineContent(s), l = getLeadingWhitespace(c), u = getSpaceCnt(l, i) + o, d = generateIndent(u, i, a);
			d !== l && (n.addEditOperation(new Range(s, 1, s, l.length + 1), d), s === r.endLineNumber && r.endColumn <= l.length + 1 && d === "" && (this._moveEndLineSelectionShrink = !0));
		}
	}
	computeCursorState(e, n) {
		let r = n.getTrackedSelection(this._selectionId);
		return this._moveEndPositionDown && (r = r.setEndPosition(r.endLineNumber + 1, 1)), this._moveEndLineSelectionShrink && r.startLineNumber < r.endLineNumber && (r = r.setEndPosition(r.endLineNumber, 2)), r;
	}
};
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, n) {
		this.selection = e, this.descending = n, this.selectionId = null;
	}
	getEditOperations(e, n) {
		let r = sortLines(e, this.selection, this.descending);
		r && n.addEditOperation(r.range, r.text), this.selectionId = n.trackSelection(this.selection);
	}
	computeCursorState(e, n) {
		return n.getTrackedSelection(this.selectionId);
	}
	static canRun(e, n, r) {
		if (e === null) return !1;
		let i = getSortData(e, n, r);
		if (!i) return !1;
		for (let e = 0, n = i.before.length; e < n; e++) if (i.before[e] !== i.after[e]) return !0;
		return !1;
	}
};
function getSortData(e, n, r) {
	let i = n.startLineNumber, a = n.endLineNumber;
	if (n.endColumn === 1 && a--, i >= a) return null;
	let o = [];
	for (let n = i; n <= a; n++) o.push(e.getLineContent(n));
	let s = o.slice(0);
	return s.sort(SortLinesCommand.getCollator().compare), r === !0 && (s = s.reverse()), {
		startLineNumber: i,
		endLineNumber: a,
		before: o,
		after: s
	};
}
function sortLines(e, n, r) {
	let i = getSortData(e, n, r);
	return i ? EditOperation.replace(new Range(i.startLineNumber, 1, i.endLineNumber, e.getLineMaxColumn(i.endLineNumber)), i.after.join("\n")) : null;
}
var AbstractCopyLinesAction = class extends EditorAction {
	constructor(e, n) {
		super(n), this.down = e;
	}
	run(e, n) {
		if (!n.hasModel()) return;
		let r = n.getSelections().map((e, n) => ({
			selection: e,
			index: n,
			ignore: !1
		}));
		r.sort((e, n) => Range.compareRangesUsingStarts(e.selection, n.selection));
		let i = r[0];
		for (let e = 1; e < r.length; e++) {
			let n = r[e];
			i.selection.endLineNumber === n.selection.startLineNumber && (i.index < n.index ? n.ignore = !0 : (i.ignore = !0, i = n));
		}
		let a = [];
		for (let e of r) a.push(new CopyLinesCommand(e.selection, this.down, e.ignore));
		n.pushUndoStop(), n.executeCommands(this.id, a), n.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, n, r) {
		if (!n.hasModel()) return;
		let i = [], a = n.getSelections(), o = n.getModel();
		for (let e of a) if (e.isEmpty()) i.push(new CopyLinesCommand(e, !0));
		else {
			let n = new Selection(e.endLineNumber, e.endColumn, e.endLineNumber, e.endColumn);
			i.push(new ReplaceCommandThatSelectsText(n, o.getValueInRange(e)));
		}
		n.pushUndoStop(), n.executeCommands(this.id, i), n.pushUndoStop();
	}
}, AbstractMoveLinesAction = class extends EditorAction {
	constructor(e, n) {
		super(n), this.down = e;
	}
	run(e, n) {
		let r = e.get(ILanguageConfigurationService), i = [], a = n.getSelections() || [], o = n.getOption(12);
		for (let e of a) i.push(new MoveLinesCommand(e, this.down, o, r));
		n.pushUndoStop(), n.executeCommands(this.id, i), n.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, n) {
		super(n), this.descending = e;
	}
	run(e, n) {
		if (!n.hasModel()) return;
		let r = n.getModel(), i = n.getSelections();
		i.length === 1 && i[0].isEmpty() && (i = [new Selection(1, 1, r.getLineCount(), r.getLineMaxColumn(r.getLineCount()))]);
		for (let e of i) if (!SortLinesCommand.canRun(n.getModel(), e, this.descending)) return;
		let a = [];
		for (let e = 0, n = i.length; e < n; e++) a[e] = new SortLinesCommand(i[e], this.descending);
		n.pushUndoStop(), n.executeCommands(this.id, a), n.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, n) {
		if (!n.hasModel()) return;
		let r = n.getModel();
		if (r.getLineCount() === 1 && r.getLineMaxColumn(1) === 1) return;
		let i = [], a = [], o = 0, s = !0, c = n.getSelections();
		c.length === 1 && c[0].isEmpty() && (c = [new Selection(1, 1, r.getLineCount(), r.getLineMaxColumn(r.getLineCount()))], s = !1);
		for (let e of c) {
			let n = /* @__PURE__ */ new Set(), s = [];
			for (let i = e.startLineNumber; i <= e.endLineNumber; i++) {
				let e = r.getLineContent(i);
				n.has(e) || (s.push(e), n.add(e));
			}
			let c = new Selection(e.startLineNumber, 1, e.endLineNumber, r.getLineMaxColumn(e.endLineNumber)), l = e.startLineNumber - o, u = new Selection(l, 1, l + s.length - 1, s[s.length - 1].length);
			i.push(EditOperation.replace(c, s.join("\n"))), a.push(u), o += e.endLineNumber - e.startLineNumber + 1 - s.length;
		}
		n.pushUndoStop(), n.executeEdits(this.id, i, s ? a : void 0), n.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, n, r) {
		let i = [];
		r.reason === "auto-save" && (i = (n.getSelections() || []).map((e) => new Position(e.positionLineNumber, e.positionColumn)));
		let a = n.getSelection();
		if (a === null) return;
		let o = e.get(IConfigurationService), s = n.getModel(), c = o.getValue("files.trimTrailingWhitespaceInRegexAndStrings", {
			overrideIdentifier: s?.getLanguageId(),
			resource: s?.uri
		}), l = new TrimTrailingWhitespaceCommand(a, i, c);
		n.pushUndoStop(), n.executeCommands(this.id, [l]), n.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, n) {
		if (!n.hasModel()) return;
		let r = this._getLinesToRemove(n), i = n.getModel();
		if (i.getLineCount() === 1 && i.getLineMaxColumn(1) === 1) return;
		let a = 0, o = [], s = [];
		for (let e = 0, n = r.length; e < n; e++) {
			let n = r[e], c = n.startLineNumber, l = n.endLineNumber, u = 1, d = i.getLineMaxColumn(l);
			l < i.getLineCount() ? (l += 1, d = 1) : c > 1 && (--c, u = i.getLineMaxColumn(c)), o.push(EditOperation.replace(new Selection(c, u, l, d), "")), s.push(new Selection(c - a, n.positionColumn, c - a, n.positionColumn)), a += n.endLineNumber - n.startLineNumber + 1;
		}
		n.pushUndoStop(), n.executeEdits(this.id, o, s), n.pushUndoStop();
	}
	_getLinesToRemove(e) {
		let n = e.getSelections().map((e) => {
			let n = e.endLineNumber;
			return e.startLineNumber < e.endLineNumber && e.endColumn === 1 && --n, {
				startLineNumber: e.startLineNumber,
				selectionStartColumn: e.selectionStartColumn,
				endLineNumber: n,
				positionColumn: e.positionColumn
			};
		});
		n.sort((e, n) => e.startLineNumber === n.startLineNumber ? e.endLineNumber - n.endLineNumber : e.startLineNumber - n.startLineNumber);
		let r = [], i = n[0];
		for (let e = 1; e < n.length; e++) i.endLineNumber + 1 >= n[e].startLineNumber ? i.endLineNumber = n[e].endLineNumber : (r.push(i), i = n[e]);
		return r.push(i), r;
	}
}, 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, n) {
		let r = n._getViewModel();
		r && (n.pushUndoStop(), n.executeCommands(this.id, TypeOperations.indent(r.cursorConfig, n.getModel(), n.getSelections())), n.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, n) {
		CoreEditingCommands.Outdent.runEditorCommand(e, n, 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, n) {
		let r = n._getViewModel();
		r && (n.pushUndoStop(), n.executeCommands(this.id, EnterOperation.lineInsertBefore(r.cursorConfig, n.getModel(), n.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, n) {
		let r = n._getViewModel();
		r && (n.pushUndoStop(), n.executeCommands(this.id, EnterOperation.lineInsertAfter(r.cursorConfig, n.getModel(), n.getSelections())));
	}
}, AbstractDeleteAllToBoundaryAction = class extends EditorAction {
	run(e, n) {
		if (!n.hasModel()) return;
		let r = n.getSelection(), i = this._getRangesToDelete(n), a = [];
		for (let e = 0, n = i.length - 1; e < n; e++) {
			let n = i[e], r = i[e + 1];
			Range.intersectRanges(n, r) === null ? a.push(n) : i[e + 1] = Range.plusRange(n, r);
		}
		a.push(i[i.length - 1]);
		let o = this._getEndCursorState(r, a), s = a.map((e) => EditOperation.replace(e, ""));
		n.pushUndoStop(), n.executeEdits(this.id, s, o), n.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, n) {
		let r = null, i = [], a = 0;
		return n.forEach((n) => {
			let o;
			if (n.endColumn === 1 && a > 0) {
				let e = n.startLineNumber - a;
				o = new Selection(e, n.startColumn, e, n.startColumn);
			} else o = new Selection(n.startLineNumber, n.startColumn, n.startLineNumber, n.startColumn);
			a += n.endLineNumber - n.startLineNumber, n.intersectRanges(e) ? r = o : i.push(o);
		}), r && i.unshift(r), i;
	}
	_getRangesToDelete(e) {
		let n = e.getSelections();
		if (n === null) return [];
		let r = n, i = e.getModel();
		return i === null ? [] : (r.sort(Range.compareRangesUsingStarts), r = r.map((e) => {
			if (e.isEmpty()) if (e.startColumn === 1) {
				let n = Math.max(1, e.startLineNumber - 1), r = e.startLineNumber === 1 ? 1 : i.getLineLength(n) + 1;
				return new Range(n, r, 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);
		}), r);
	}
}, 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, n) {
		let r = null, i = [];
		for (let a = 0, o = n.length; a < o; a++) {
			let o = n[a], s = new Selection(o.startLineNumber - 0, o.startColumn, o.startLineNumber - 0, o.startColumn);
			o.intersectRanges(e) ? r = s : i.push(s);
		}
		return r && i.unshift(r), i;
	}
	_getRangesToDelete(e) {
		let n = e.getModel();
		if (n === null) return [];
		let r = e.getSelections();
		if (r === null) return [];
		let i = r.map((e) => {
			if (e.isEmpty()) {
				let r = n.getLineMaxColumn(e.startLineNumber);
				return e.startColumn === r ? new Range(e.startLineNumber, e.startColumn, e.startLineNumber + 1, 1) : new Range(e.startLineNumber, e.startColumn, e.startLineNumber, r);
			}
			return e;
		});
		return i.sort(Range.compareRangesUsingStarts), i;
	}
}, 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, n) {
		let r = n.getSelections();
		if (r === null) return;
		let i = n.getSelection();
		if (i === null) return;
		r.sort(Range.compareRangesUsingStarts);
		let a = [], o = r.reduce((e, n) => e.isEmpty() ? e.endLineNumber === n.startLineNumber ? (i.equalsSelection(e) && (i = n), n) : n.startLineNumber > e.endLineNumber + 1 ? (a.push(e), n) : new Selection(e.startLineNumber, e.startColumn, n.endLineNumber, n.endColumn) : n.startLineNumber > e.endLineNumber ? (a.push(e), n) : new Selection(e.startLineNumber, e.startColumn, n.endLineNumber, n.endColumn));
		a.push(o);
		let s = n.getModel();
		if (s === null) return;
		let c = [], l = [], u = i, d = 0;
		for (let e = 0, n = a.length; e < n; e++) {
			let n = a[e], r = n.startLineNumber, o = 0, f, m, g = s.getLineLength(n.endLineNumber) - n.endColumn;
			if (n.isEmpty() || n.startLineNumber === n.endLineNumber) {
				let e = n.getStartPosition();
				e.lineNumber < s.getLineCount() ? (f = r + 1, m = s.getLineMaxColumn(f)) : (f = e.lineNumber, m = s.getLineMaxColumn(e.lineNumber));
			} else f = n.endLineNumber, m = s.getLineMaxColumn(f);
			let _ = s.getLineContent(r);
			for (let e = r + 1; e <= f; e++) {
				let n = s.getLineContent(e), r = s.getLineFirstNonWhitespaceColumn(e);
				if (r >= 1) {
					let e = !0;
					_ === "" && (e = !1), e && (_.charAt(_.length - 1) === " " || _.charAt(_.length - 1) === "	") && (e = !1, _ = _.replace(/[\s\uFEFF\xA0]+$/g, " "));
					let i = n.substr(r - 1);
					_ += (e ? " " : "") + i, o = e ? i.length + 1 : i.length;
				} else o = 0;
			}
			let v = new Range(r, 1, f, m);
			if (!v.isEmpty()) {
				let e;
				n.isEmpty() ? (c.push(EditOperation.replace(v, _)), e = new Selection(v.startLineNumber - d, _.length - o + 1, r - d, _.length - o + 1)) : n.startLineNumber === n.endLineNumber ? (c.push(EditOperation.replace(v, _)), e = new Selection(n.startLineNumber - d, n.startColumn, n.endLineNumber - d, n.endColumn)) : (c.push(EditOperation.replace(v, _)), e = new Selection(n.startLineNumber - d, n.startColumn, n.startLineNumber - d, _.length - g)), Range.intersectRanges(v, i) === null ? l.push(e) : u = e;
			}
			d += v.endLineNumber - v.startLineNumber;
		}
		l.unshift(u), n.pushUndoStop(), n.executeEdits(this.id, c, l), n.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, n) {
		let r = n.getSelections();
		if (r === null) return;
		let i = n.getModel();
		if (i === null) return;
		let a = [];
		for (let e = 0, n = r.length; e < n; e++) {
			let n = r[e];
			if (!n.isEmpty()) continue;
			let o = n.getStartPosition(), s = i.getLineMaxColumn(o.lineNumber);
			if (o.column >= s) {
				if (o.lineNumber === i.getLineCount()) continue;
				let e = new Range(o.lineNumber, Math.max(1, o.column - 1), o.lineNumber + 1, 1), n = i.getValueInRange(e).split("").reverse().join("");
				a.push(new ReplaceCommand(new Selection(o.lineNumber, Math.max(1, o.column - 1), o.lineNumber + 1, 1), n));
			} else {
				let e = new Range(o.lineNumber, Math.max(1, o.column - 1), o.lineNumber, o.column + 1), n = i.getValueInRange(e).split("").reverse().join("");
				a.push(new ReplaceCommandThatPreservesSelection(e, n, new Selection(o.lineNumber, o.column + 1, o.lineNumber, o.column + 1)));
			}
		}
		n.pushUndoStop(), n.executeCommands(this.id, a), n.pushUndoStop();
	}
}, AbstractCaseAction = class extends EditorAction {
	run(e, n) {
		let r = n.getSelections();
		if (r === null) return;
		let i = n.getModel();
		if (i === null) return;
		let a = n.getOption(132), o = [];
		for (let e of r) if (e.isEmpty()) {
			let r = e.getStartPosition(), s = n.getConfiguredWordAtPosition(r);
			if (!s) continue;
			let c = new Range(r.lineNumber, s.startColumn, r.lineNumber, s.endColumn), l = i.getValueInRange(c);
			o.push(EditOperation.replace(c, this._modifyText(l, a)));
		} else {
			let n = i.getValueInRange(e);
			o.push(EditOperation.replace(e, this._modifyText(n, a)));
		}
		n.pushUndoStop(), n.executeEdits(this.id, o), n.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, n) {
		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, n) {
		return e.toLocaleLowerCase();
	}
}, BackwardsCompatibleRegExp = class {
	constructor(e, n) {
		this._pattern = e, this._flags = n, 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(n, r) {
		let i = e.titleBoundary.get();
		return i ? n.toLocaleLowerCase().replace(i, (e) => e.toLocaleUpperCase()) : n;
	}
}, 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(n, r) {
		let i = e.caseBoundary.get(), a = e.singleLetters.get();
		return !i || !a ? n : n.replace(i, "$1_$2").replace(a, "$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(n, r) {
		let i = e.wordBoundary.get();
		if (!i) return n;
		let a = n.split(i);
		return a.shift() + a.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(n, r) {
		let i = e.wordBoundary.get(), a = e.wordBoundaryToMaintain.get();
		return !i || !a ? n : n.split(a).map((e) => e.split(i)).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(n, r) {
		let i = e.caseBoundary.get(), a = e.singleLetters.get(), o = e.underscoreBoundary.get();
		return !i || !a || !o ? n : n.replace(o, "$1-$3").replace(i, "$1-$2").replace(a, "$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, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$37 = function(e, n) {
	return function(r, i) {
		n(r, i, 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, n, r, i, a) {
		super(), this.languageConfigurationService = i, this._syncRangesToken = 0, this._localToDispose = this._register(new DisposableStore()), this._editor = e, this._providers = r.linkedEditingRangeProvider, this._enabled = !1, this._visibleContextKey = CONTEXT_ONTYPE_RENAME_INPUT_VISIBLE.bindTo(n), this._debounceInformation = a.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 n = this._editor.getModel(), r = n !== null && (this._editor.getOption(70) || this._editor.getOption(94)) && this._providers.has(n);
		if (r === this._enabled && !e || (this._enabled = r, this.clearRanges(), this._localToDispose.clear(), !r || n === null)) return;
		this._localToDispose.add(Event.runAndSubscribe(n.onDidChangeLanguageConfiguration, () => {
			this._languageWordPattern = this.languageConfigurationService.getLanguageConfiguration(n.getLanguageId()).getWordDefinition();
		}));
		let i = new Delayer(this._debounceInformation.get(n)), a = () => {
			this._rangeUpdateTriggerPromise = i.trigger(() => this.updateRanges(), this._debounceDuration ?? this._debounceInformation.get(n));
		}, o = new Delayer(0), s = (e) => {
			this._rangeSyncTriggerPromise = o.trigger(() => this._syncRanges(e));
		};
		this._localToDispose.add(this._editor.onDidChangeCursorPosition(() => {
			a();
		})), this._localToDispose.add(this._editor.onDidChangeModelContent((e) => {
			if (!this._ignoreChangeEvent && this._currentDecorations.length > 0) {
				let n = this._currentDecorations.getRange(0);
				if (n && e.changes.every((e) => n.intersectRanges(e.range))) {
					s(this._syncRangesToken);
					return;
				}
			}
			a();
		})), this._localToDispose.add({ dispose: () => {
			i.dispose(), o.dispose();
		} }), this.updateRanges();
	}
	_syncRanges(e) {
		if (!this._editor.hasModel() || e !== this._syncRangesToken || this._currentDecorations.length === 0) return;
		let n = this._editor.getModel(), r = this._currentDecorations.getRange(0);
		if (!r || r.startLineNumber !== r.endLineNumber) return this.clearRanges();
		let i = n.getValueInRange(r);
		if (this._currentWordPattern) {
			let e = i.match(this._currentWordPattern);
			if ((e ? e[0].length : 0) !== i.length) return this.clearRanges();
		}
		let a = [];
		for (let e = 1, r = this._currentDecorations.length; e < r; e++) {
			let r = this._currentDecorations.getRange(e);
			if (r) if (r.startLineNumber !== r.endLineNumber) a.push({
				range: r,
				text: i
			});
			else {
				let e = n.getValueInRange(r), o = i, s = r.startColumn, c = r.endColumn, l = commonPrefixLength(e, o);
				s += l, e = e.substr(l), o = o.substr(l);
				let u = commonSuffixLength(e, o);
				c -= u, e = e.substr(0, e.length - u), o = o.substr(0, o.length - u), (s !== c || o.length !== 0) && a.push({
					range: new Range(r.startLineNumber, s, r.endLineNumber, c),
					text: o
				});
			}
		}
		if (a.length !== 0) try {
			this._editor.popUndoStop(), this._ignoreChangeEvent = !0;
			let e = this._editor._getViewModel().getPrevEditOperationType();
			this._editor.executeEdits("linkedEditing", a), 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 n = this._editor.getPosition();
		if (!this._enabled && !e || this._editor.getSelections().length > 1) {
			this.clearRanges();
			return;
		}
		let r = this._editor.getModel(), i = r.getVersionId();
		if (this._currentRequestPosition && this._currentRequestModelVersion === i) {
			if (n.equals(this._currentRequestPosition)) return;
			if (this._currentDecorations.length > 0) {
				let e = this._currentDecorations.getRange(0);
				if (e && e.containsPosition(n)) return;
			}
		}
		this.clearRanges(), this._currentRequestPosition = n, this._currentRequestModelVersion = i;
		let a = this._currentRequestCts = new CancellationTokenSource();
		try {
			let e = new StopWatch(!1), o = await getLinkedEditingRanges(this._providers, r, n, a.token);
			if (this._debounceInformation.update(r, e.elapsed()), a !== this._currentRequestCts || (this._currentRequestCts = null, i !== r.getVersionId())) return;
			let s = [];
			o?.ranges && (s = o.ranges), this._currentWordPattern = o?.wordPattern || this._languageWordPattern;
			let c = !1;
			for (let e = 0, r = s.length; e < r; e++) if (Range.containsPosition(s[e], n)) {
				if (c = !0, e !== 0) {
					let n = s[e];
					s.splice(e, 1), s.unshift(n);
				}
				break;
			}
			if (!c) {
				this.clearRanges();
				return;
			}
			let l = s.map((e) => ({
				range: e,
				options: LinkedEditingContribution_1.DECORATION
			}));
			this._visibleContextKey.set(!0), this._currentDecorations.set(l), this._syncRangesToken++;
		} catch (e) {
			isCancellationError(e) || onUnexpectedError(e), (this._currentRequestCts === a || !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, n) {
		let r = e.get(ICodeEditorService), [i, a] = Array.isArray(n) && n || [void 0, void 0];
		return URI.isUri(i) && Position.isIPosition(a) ? r.openCodeEditor({ resource: i }, r.getActiveCodeEditor()).then((e) => {
			e && (e.setPosition(a), e.invokeWithinContext((n) => (this.reportTelemetry(n, e), this.run(n, e))));
		}, onUnexpectedError) : super.runCommand(e, n);
	}
	run(e, n) {
		let r = LinkedEditingContribution.get(n);
		return r ? Promise.resolve(r.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, n, r, i) {
	let a = e.ordered(n);
	return first(a.map((e) => async () => {
		try {
			return await e.provideLinkedEditingRanges(n, r, i);
		} 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, n, r) => {
	let { linkedEditingRangeProvider: i } = e.get(ILanguageFeaturesService);
	return getLinkedEditingRanges(i, n, r, CancellationToken.None);
}), registerEditorContribution(LinkedEditingContribution.ID, LinkedEditingContribution, 1), registerEditorAction(LinkedEditingAction);
var Link$1 = class {
	constructor(e, n) {
		this._link = e, this._provider = n;
	}
	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((n) => (this._link = n || this._link, this._link.url ? this.resolve(e) : Promise.reject(/* @__PURE__ */ Error("missing")))) : Promise.reject(/* @__PURE__ */ Error("missing"));
	}
}, LinksList = class e {
	constructor(n) {
		this._disposables = new DisposableStore();
		let r = [];
		for (let [i, a] of n) {
			let n = i.links.map((e) => new Link$1(e, a));
			r = e._union(r, n), isDisposable(i) && this._disposables.add(i);
		}
		this.links = r;
	}
	dispose() {
		this._disposables.dispose(), this.links.length = 0;
	}
	static _union(e, n) {
		let r = [], i, a, o, s;
		for (i = 0, o = 0, a = e.length, s = n.length; i < a && o < s;) {
			let a = e[i], s = n[o];
			if (Range.areIntersectingOrTouching(a.range, s.range)) {
				i++;
				continue;
			}
			Range.compareRangesUsingStarts(a.range, s.range) < 0 ? (r.push(a), i++) : (r.push(s), o++);
		}
		for (; i < a; i++) r.push(e[i]);
		for (; o < s; o++) r.push(n[o]);
		return r;
	}
};
function getLinks(e, n, r) {
	let i = [], a = e.ordered(n).reverse().map((e, a) => Promise.resolve(e.provideLinks(n, r)).then((n) => {
		n && (i[a] = [n, e]);
	}, onUnexpectedExternalError));
	return Promise.all(a).then(() => {
		let e = new LinksList(coalesce(i));
		return r.isCancellationRequested ? (e.dispose(), new LinksList([])) : e;
	});
}
CommandsRegistry.registerCommand("_executeLinkProvider", async (e, ...n) => {
	let [r, i] = n;
	assertType(r instanceof URI), typeof i != "number" && (i = 0);
	let { linkProvider: a } = e.get(ILanguageFeaturesService), o = e.get(IModelService).getModel(r);
	if (!o) return [];
	let s = await getLinks(a, o, CancellationToken.None);
	if (!s) return [];
	for (let e = 0; e < Math.min(i, s.links.length); e++) await s.links[e].resolve(CancellationToken.None);
	let c = s.links.slice(0);
	return s.dispose(), c;
});
var __decorate$36 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$36 = function(e, n) {
	return function(r, i) {
		n(r, i, 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, n, r, i, a) {
		super(), this.editor = e, this.openerService = n, this.notificationService = r, this.languageFeaturesService = i, this.providers = this.languageFeaturesService.linkProvider, this.debounceInformation = a.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 o = this._register(new ClickLinkGesture(e));
		this._register(o.onMouseMoveOrRelevantKeyDown(([e, n]) => {
			this._onEditorMouseMove(e, n);
		})), this._register(o.onExecute((e) => {
			this.onEditorMouseUp(e);
		})), this._register(o.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((n) => getLinks(this.providers, e, n));
			try {
				let n = new StopWatch(!1);
				if (this.activeLinksList = await this.computePromise, this.debounceInformation.update(e, n.elapsed()), e.isDisposed()) return;
				this.updateDecorations(this.activeLinksList.links);
			} catch (e) {
				onUnexpectedError(e);
			} finally {
				this.computePromise = null;
			}
		}
	}
	updateDecorations(e) {
		let n = this.editor.getOption(78) === "altKey", r = [], i = Object.keys(this.currentOccurrences);
		for (let e of i) {
			let n = this.currentOccurrences[e];
			r.push(n.decorationId);
		}
		let a = [];
		if (e) for (let r of e) a.push(LinkOccurrence.decoration(r, n));
		this.editor.changeDecorations((n) => {
			let i = n.deltaDecorations(r, a);
			this.currentOccurrences = {}, this.activeLinkDecorationId = null;
			for (let n = 0, r = i.length; n < r; n++) {
				let r = new LinkOccurrence(e[n], i[n]);
				this.currentOccurrences[r.decorationId] = r;
			}
		});
	}
	_onEditorMouseMove(e, n) {
		let r = this.editor.getOption(78) === "altKey";
		if (this.isEnabled(e, n)) {
			this.cleanUpActiveLinkDecoration();
			let n = this.getLinkOccurrence(e.target.position);
			n && this.editor.changeDecorations((e) => {
				n.activate(e, r), this.activeLinkDecorationId = n.decorationId;
			});
		} else this.cleanUpActiveLinkDecoration();
	}
	cleanUpActiveLinkDecoration() {
		let e = this.editor.getOption(78) === "altKey";
		if (this.activeLinkDecorationId) {
			let n = this.currentOccurrences[this.activeLinkDecorationId];
			n && this.editor.changeDecorations((r) => {
				n.deactivate(r, e);
			}), this.activeLinkDecorationId = null;
		}
	}
	onEditorMouseUp(e) {
		if (!this.isEnabled(e)) return;
		let n = this.getLinkOccurrence(e.target.position);
		n && this.openLinkOccurrence(n, e.hasSideBySideModifier, !0);
	}
	openLinkOccurrence(e, n, r = !1) {
		if (!this.openerService) return;
		let { link: i } = e;
		i.resolve(CancellationToken.None).then((e) => {
			if (typeof e == "string" && this.editor.hasModel()) {
				let n = this.editor.getModel().uri;
				if (n.scheme === Schemas.file && e.startsWith(`${Schemas.file}:`)) {
					let r = URI.parse(e);
					if (r.scheme === Schemas.file) {
						let i = originalFSPath(r), a = null;
						i.startsWith("/./") || i.startsWith("\\.\\") ? a = `.${i.substr(1)}` : (i.startsWith("//./") || i.startsWith("\\\\.\\")) && (a = `.${i.substr(2)}`), a && (e = joinPath(n, a));
					}
				}
			}
			return this.openerService.open(e, {
				openToSide: n,
				fromUserGesture: r,
				allowContributedOpeners: !0,
				allowCommands: !0,
				fromWorkspace: !0
			});
		}, (e) => {
			let n = e instanceof Error ? e.message : e;
			n === "invalid" ? this.notificationService.warn(localize("invalid.url", "Failed to open this link because it is not well-formed: {0}", i.url.toString())) : n === "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 n = this.editor.getModel().getDecorationsInRange({
			startLineNumber: e.lineNumber,
			startColumn: e.column,
			endLineNumber: e.lineNumber,
			endColumn: e.column
		}, 0, !0);
		for (let e of n) {
			let n = this.currentOccurrences[e.id];
			if (n) return n;
		}
		return null;
	}
	isEnabled(e, n) {
		return !!(e.target.type === 6 && (e.hasTriggerModifier || n && n.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(n, r) {
		return {
			range: n.range,
			options: e._getOptions(n, r, !1)
		};
	}
	static _getOptions(e, n, r) {
		let i = { ...r ? decoration$1.active : decoration$1.general };
		return i.hoverMessage = getHoverMessage(e, n), i;
	}
	constructor(e, n) {
		this.link = e, this.decorationId = n;
	}
	activate(n, r) {
		n.changeDecorationOptions(this.decorationId, e._getOptions(this.link, r, !0));
	}
	deactivate(n, r) {
		n.changeDecorationOptions(this.decorationId, e._getOptions(this.link, r, !1));
	}
};
function getHoverMessage(e, n) {
	let r = e.url && /^command:/i.test(e.url.toString()), i = e.tooltip ? e.tooltip : r ? localize("links.navigate.executeCmd", "Execute command") : localize("links.navigate.follow", "Follow link"), a = n ? 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 n = "";
		if (/^command:/i.test(e.url.toString())) {
			let r = e.url.toString().match(/^command:([^?#]+)/);
			if (r) {
				let e = r[1];
				n = localize("tooltip.explanation", "Execute command {0}", e);
			}
		}
		return new MarkdownString("", !0).appendLink(e.url.toString(!0).replace(/ /g, "%20"), i, n).appendMarkdown(` (${a})`);
	} else return new MarkdownString().appendText(`${i} (${a})`);
}
var OpenLinkAction = class extends EditorAction {
	constructor() {
		super({
			id: "editor.action.openLink",
			label: localize("label", "Open Link"),
			alias: "Open Link",
			precondition: void 0
		});
	}
	run(e, n) {
		let r = LinkDetector.get(n);
		if (!r || !n.hasModel()) return;
		let i = n.getSelections();
		for (let e of i) {
			let n = r.getLinkOccurrence(e.getEndPosition());
			n && r.openLinkOccurrence(n, !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 n = this._editor.getOption(118);
			n >= 0 && e.target.type === 6 && e.target.position.column >= n && 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, n) => {
	let r = e.getColor(editorSelectionHighlight);
	r && n.addRule(`.monaco-editor .selectionHighlight { background-color: ${r.transparent(.5)}; }`);
});
var __decorate$35 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$35 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, SelectionHighlighter_1;
function announceCursorChange(e, n) {
	let r = n.filter((n) => !e.find((e) => e.equals(n)));
	if (r.length >= 1) {
		let e = r.map((e) => `line ${e.viewState.position.lineNumber} column ${e.viewState.position.column}`).join(", "), n = r.length === 1 ? localize("cursorAdded", "Cursor added: {0}", e) : localize("cursorsAdded", "Cursors added: {0}", e);
		status(n);
	}
}
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, n, r) {
		if (!n.hasModel()) return;
		let i = !0;
		r && r.logicalLine === !1 && (i = !1);
		let a = n._getViewModel();
		if (a.cursorConfig.readOnly) return;
		a.model.pushStackElement();
		let o = a.getCursorStates();
		a.setCursorStates(r.source, 3, CursorMoveCommands.addCursorUp(a, o, i)), a.revealTopMostCursor(r.source), announceCursorChange(o, a.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, n, r) {
		if (!n.hasModel()) return;
		let i = !0;
		r && r.logicalLine === !1 && (i = !1);
		let a = n._getViewModel();
		if (a.cursorConfig.readOnly) return;
		a.model.pushStackElement();
		let o = a.getCursorStates();
		a.setCursorStates(r.source, 3, CursorMoveCommands.addCursorDown(a, o, i)), a.revealBottomMostCursor(r.source), announceCursorChange(o, a.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, n, r) {
		if (!e.isEmpty()) {
			for (let i = e.startLineNumber; i < e.endLineNumber; i++) {
				let e = n.getLineMaxColumn(i);
				r.push(new Selection(i, e, i, e));
			}
			e.endColumn > 1 && r.push(new Selection(e.endLineNumber, e.endColumn, e.endLineNumber, e.endColumn));
		}
	}
	run(e, n) {
		if (!n.hasModel()) return;
		let r = n.getModel(), i = n.getSelections(), a = n._getViewModel(), o = a.getCursorStates(), s = [];
		i.forEach((e) => this.getCursorsForSelection(e, r, s)), s.length > 0 && n.setSelections(s), announceCursorChange(o, a.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, n) {
		if (!n.hasModel()) return;
		let r = n.getSelections(), i = n.getModel().getLineCount(), a = [];
		for (let e = r[0].startLineNumber; e <= i; e++) a.push(new Selection(e, r[0].startColumn, e, r[0].endColumn));
		let o = n._getViewModel(), s = o.getCursorStates();
		a.length > 0 && n.setSelections(a), announceCursorChange(s, o.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, n) {
		if (!n.hasModel()) return;
		let r = n.getSelections(), i = [];
		for (let e = r[0].startLineNumber; e >= 1; e--) i.push(new Selection(e, r[0].startColumn, e, r[0].endColumn));
		let a = n._getViewModel(), o = a.getCursorStates();
		i.length > 0 && n.setSelections(i), announceCursorChange(o, a.getCursorStates());
	}
}, MultiCursorSessionResult = class {
	constructor(e, n, r) {
		this.selections = e, this.revealRange = n, this.revealScrollType = r;
	}
}, MultiCursorSession = class e {
	static create(n, r) {
		if (!n.hasModel()) return null;
		let i = r.getState();
		if (!n.hasTextFocus() && i.isRevealed && i.searchString.length > 0) return new e(n, r, !1, i.searchString, i.wholeWord, i.matchCase, null);
		let a = !1, o, s, c = n.getSelections();
		c.length === 1 && c[0].isEmpty() ? (a = !0, o = !0, s = !0) : (o = i.wholeWord, s = i.matchCase);
		let l = n.getSelection(), u, d = null;
		if (l.isEmpty()) {
			let e = n.getConfiguredWordAtPosition(l.getStartPosition());
			if (!e) return null;
			u = e.word, d = new Selection(l.startLineNumber, e.startColumn, l.startLineNumber, e.endColumn);
		} else u = n.getModel().getValueInRange(l).replace(/\r\n/g, "\n");
		return new e(n, r, a, u, o, s, d);
	}
	constructor(e, n, r, i, a, o, s) {
		this._editor = e, this.findController = n, this.isDisconnectedFromFindController = r, this.searchText = i, this.wholeWord = a, this.matchCase = o, this.currentMatch = s;
	}
	addSelectionToNextFindMatch() {
		if (!this._editor.hasModel()) return null;
		let e = this._getNextMatch();
		if (!e) return null;
		let n = this._editor.getSelections();
		return new MultiCursorSessionResult(n.concat(e), e, 0);
	}
	moveSelectionToNextFindMatch() {
		if (!this._editor.hasModel()) return null;
		let e = this._getNextMatch();
		if (!e) return null;
		let n = this._editor.getSelections();
		return new MultiCursorSessionResult(n.slice(0, n.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(), n = e[e.length - 1], r = this._editor.getModel().findNextMatch(this.searchText, n.getEndPosition(), !1, this.matchCase, this.wholeWord ? this._editor.getOption(132) : null, !1);
		return r ? new Selection(r.range.startLineNumber, r.range.startColumn, r.range.endLineNumber, r.range.endColumn) : null;
	}
	addSelectionToPreviousFindMatch() {
		if (!this._editor.hasModel()) return null;
		let e = this._getPreviousMatch();
		if (!e) return null;
		let n = this._editor.getSelections();
		return new MultiCursorSessionResult(n.concat(e), e, 0);
	}
	moveSelectionToPreviousFindMatch() {
		if (!this._editor.hasModel()) return null;
		let e = this._getPreviousMatch();
		if (!e) return null;
		let n = this._editor.getSelections();
		return new MultiCursorSessionResult(n.slice(0, n.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(), n = e[e.length - 1], r = this._editor.getModel().findPreviousMatch(this.searchText, n.getStartPosition(), !1, this.matchCase, this.wholeWord ? this._editor.getOption(132) : null, !1);
		return r ? new Selection(r.range.startLineNumber, r.range.startColumn, r.range.endLineNumber, r.range.endColumn) : null;
	}
	selectAll(e) {
		if (!this._editor.hasModel()) return [];
		this.findController.highlightFindOptions();
		let n = this._editor.getModel();
		return e ? n.findMatches(this.searchText, e, !1, this.matchCase, this.wholeWord ? this._editor.getOption(132) : null, !1, 1073741824) : n.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(n) {
		return n.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 n = MultiCursorSession.create(this._editor, e);
			if (!n) return;
			this._session = n;
			let r = { searchString: this._session.searchText };
			this._session.isDisconnectedFromFindController && (r.wholeWordOverride = 1, r.matchCaseOverride = 1, r.isRegexOverride = 2), e.getState().change(r, !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, n) {
		if (!n.isEmpty()) return n;
		let r = this._editor.getConfiguredWordAtPosition(n.getStartPosition());
		return r ? new Selection(n.startLineNumber, r.startColumn, n.startLineNumber, r.endColumn) : n;
	}
	_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 n = this._editor.getSelections();
				if (n.length > 1) {
					let r = e.getState().matchCase;
					if (!modelRangesContainSameText(this._editor.getModel(), n, r)) {
						let e = this._editor.getModel(), r = [];
						for (let i = 0, a = n.length; i < a; i++) r[i] = this._expandEmptyToWord(e, n[i]);
						this._editor.setSelections(r);
						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 n = null, r = e.getState();
		if (r.isRevealed && r.searchString.length > 0 && r.isRegex) {
			let e = this._editor.getModel();
			n = r.searchScope ? e.findMatches(r.searchString, r.searchScope, r.isRegex, r.matchCase, r.wholeWord ? this._editor.getOption(132) : null, !1, 1073741824) : e.findMatches(r.searchString, !0, r.isRegex, r.matchCase, r.wholeWord ? this._editor.getOption(132) : null, !1, 1073741824);
		} else {
			if (this._beginSessionIfNeeded(e), !this._session) return;
			n = this._session.selectAll(r.searchScope);
		}
		if (n.length > 0) {
			let e = this._editor.getSelection();
			for (let r = 0, i = n.length; r < i; r++) {
				let i = n[r];
				if (i.range.intersectRanges(e)) {
					n[r] = n[0], n[0] = i;
					break;
				}
			}
			this._setSelections(n.map((e) => new Selection(e.range.startLineNumber, e.range.startColumn, e.range.endLineNumber, e.range.endColumn)));
		}
	}
}, MultiCursorSelectionControllerAction = class extends EditorAction {
	run(e, n) {
		let r = MultiCursorSelectionController.get(n);
		if (!r) return;
		let i = n._getViewModel();
		if (i) {
			let a = i.getCursorStates(), o = CommonFindController.get(n);
			if (o) this._run(r, o);
			else {
				let i = e.get(IInstantiationService).createInstance(CommonFindController, n);
				this._run(r, i), i.dispose();
			}
			announceCursorChange(a, i.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, n) {
		e.addSelectionToNextFindMatch(n);
	}
}, 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, n) {
		e.addSelectionToPreviousFindMatch(n);
	}
}, 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, n) {
		e.moveSelectionToNextFindMatch(n);
	}
}, 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, n) {
		e.moveSelectionToPreviousFindMatch(n);
	}
}, 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, n) {
		e.selectAll(n);
	}
}, 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, n) {
		e.selectAll(n);
	}
}, SelectionHighlighterState = class {
	constructor(e, n, r, i, a) {
		this._model = e, this._searchText = n, this._matchCase = r, this._wordSeparators = i, this._modelVersionId = this._model.getVersionId(), this._cachedFindMatches = null, a && this._model === a._model && this._searchText === a._searchText && this._matchCase === a._matchCase && this._wordSeparators === a._wordSeparators && this._modelVersionId === a._modelVersionId && (this._cachedFindMatches = a._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, n) {
		super(), this._languageFeaturesService = n, 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((n) => {
			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 r = CommonFindController.get(e);
		r && this._register(r.getState().onFindReplaceStateChange((e) => {
			this._update();
		})), this.updateSoon.schedule();
	}
	_update() {
		this._setState(SelectionHighlighter_1._createState(this.state, this._isEnabled, this.editor));
	}
	static _createState(e, n, r) {
		if (!n || !r.hasModel()) return null;
		let i = r.getSelection();
		if (i.startLineNumber !== i.endLineNumber) return null;
		let a = MultiCursorSelectionController.get(r);
		if (!a) return null;
		let o = CommonFindController.get(r);
		if (!o) return null;
		let s = a.getSession(o);
		if (!s) {
			let e = r.getSelections();
			if (e.length > 1) {
				let n = o.getState().matchCase;
				if (!modelRangesContainSameText(r.getModel(), e, n)) return null;
			}
			s = MultiCursorSession.create(r, o);
		}
		if (!s || s.currentMatch || /^[ \t]+$/.test(s.searchText) || s.searchText.length > 200) return null;
		let c = o.getState(), l = c.matchCase;
		if (c.isRevealed) {
			let e = c.searchString;
			l || (e = e.toLowerCase());
			let n = s.searchText;
			if (l || (n = n.toLowerCase()), e === n && s.matchCase === c.matchCase && s.wholeWord === c.wholeWord && !c.isRegex) return null;
		}
		return new SelectionHighlighterState(r.getModel(), s.searchText, s.matchCase, s.wholeWord ? r.getOption(132) : null, e);
	}
	_setState(e) {
		if (this.state = e, !this.state) {
			this._decorations.clear();
			return;
		}
		if (!this.editor.hasModel()) return;
		let n = this.editor.getModel();
		if (n.isTooLargeForTokenization()) return;
		let r = this.state.findMatches(), i = this.editor.getSelections();
		i.sort(Range.compareRangesUsingStarts);
		let a = [];
		for (let e = 0, n = 0, o = r.length, s = i.length; e < o;) {
			let o = r[e];
			if (n >= s) a.push(o), e++;
			else {
				let r = Range.compareRangesUsingStarts(o, i[n]);
				r < 0 ? ((i[n].isEmpty() || !Range.areIntersecting(o, i[n])) && a.push(o), e++) : (r > 0 || e++, n++);
			}
		}
		let o = this.editor.getOption(81) !== "off", s = this._languageFeaturesService.documentHighlightProvider.has(n) && o, c = a.map((e) => ({
			range: e,
			options: getSelectionHighlightDecorationOptions(s)
		}));
		this._decorations.set(c);
	}
	dispose() {
		this._setState(null), super.dispose();
	}
};
SelectionHighlighter = SelectionHighlighter_1 = __decorate$35([__param$35(1, ILanguageFeaturesService)], SelectionHighlighter);
function modelRangesContainSameText(e, n, r) {
	let i = getValueInRange(e, n[0], !r);
	for (let a = 1, o = n.length; a < o; a++) {
		let o = n[a];
		if (o.isEmpty()) return !1;
		let s = getValueInRange(e, o, !r);
		if (i !== s) return !1;
	}
	return !0;
}
function getValueInRange(e, n, r) {
	let i = e.getValueInRange(n);
	return r ? i.toLowerCase() : i;
}
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, n, r) {
		if (!n.hasModel()) return;
		let i = n._getViewModel();
		if (i.cursorConfig.readOnly) return;
		i.model.pushStackElement();
		let a = Array.from(i.getCursorStates()), o = a.shift();
		o && (a.push(o), i.setCursorStates(r.source, 3, a), i.revealPrimaryCursor(r.source, !0), announceCursorChange(a, i.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, n, r) {
		if (!n.hasModel()) return;
		let i = n._getViewModel();
		if (i.cursorConfig.readOnly) return;
		i.model.pushStackElement();
		let a = Array.from(i.getCursorStates()), o = a.pop();
		o && (a.unshift(o), i.setCursorStates(r.source, 3, a), i.revealPrimaryCursor(r.source, !0), announceCursorChange(a, i.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, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$34 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
};
const INLINE_EDIT_DESCRIPTION = "inline-edit";
var GhostTextWidget = class extends Disposable {
	constructor(e, n, r) {
		super(), this.editor = e, this.model = n, this.languageService = r, 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 n = this.currentTextModel.read(e);
			if (n !== this.model.targetTextModel.read(e)) return;
			let r = this.model.ghostText.read(e);
			if (!r) return;
			let i = this.model.range?.read(e);
			i && i.startLineNumber === i.endLineNumber && i.startColumn === i.endColumn && (i = void 0);
			let a = (i ? i.startLineNumber === i.endLineNumber : !0) && r.parts.length === 1 && r.parts[0].lines.length === 1, o = r.parts.length === 1 && r.parts[0].lines.every((e) => e.length === 0), s = [], c = [];
			function l(e, n) {
				if (c.length > 0) {
					let r = c[c.length - 1];
					n && r.decorations.push(new LineDecoration(r.content.length + 1, r.content.length + 1 + e[0].length, n, 0)), r.content += e[0], e = e.slice(1);
				}
				for (let r of e) c.push({
					content: r,
					decorations: n ? [new LineDecoration(1, r.length + 1, n, 0)] : []
				});
			}
			let u = n.getLineContent(r.lineNumber), d, f = 0;
			if (!o && (a || !i)) {
				for (let e of r.parts) {
					let n = e.lines;
					i && !a && (l(n, INLINE_EDIT_DESCRIPTION), n = []), d === void 0 ? (s.push({
						column: e.column,
						text: n[0],
						preview: e.preview
					}), n = n.slice(1)) : l([u.substring(f, e.column - 1)], void 0), n.length > 0 && (l(n, INLINE_EDIT_DESCRIPTION), d === void 0 && e.column <= u.length && (d = e.column)), f = e.column - 1;
				}
				d !== void 0 && l([u.substring(f)], void 0);
			}
			let m = d === void 0 ? void 0 : new ColumnRange(d, u.length + 1), g = a || !i ? r.lineNumber : i.endLineNumber - 1;
			return {
				inlineTexts: s,
				additionalLines: c,
				hiddenRange: m,
				lineNumber: g,
				additionalReservedLineCount: this.model.minReservedLineCount.read(e),
				targetTextModel: n,
				range: i,
				isSingleLine: a,
				isPureRemove: o
			};
		}), this.decorations = derived(this, (e) => {
			let n = this.uiState.read(e);
			if (!n) return [];
			let r = [];
			if (n.hiddenRange && r.push({
				range: n.hiddenRange.toRange(n.lineNumber),
				options: {
					inlineClassName: "inline-edit-hidden",
					description: "inline-edit-hidden"
				}
			}), n.range) {
				let e = [];
				if (n.isSingleLine) e.push(n.range);
				else if (!n.isPureRemove) {
					let r = n.range.endLineNumber - n.range.startLineNumber;
					for (let i = 0; i < r; i++) {
						let r = n.range.startLineNumber + i, a = n.targetTextModel.getLineFirstNonWhitespaceColumn(r), o = n.targetTextModel.getLineLastNonWhitespaceColumn(r), s = new Range(r, a, r, o);
						e.push(s);
					}
				}
				for (let n of e) r.push({
					range: n,
					options: diffDeleteDecoration
				});
			}
			if (n.range && !n.isSingleLine && n.isPureRemove) {
				let e = new Range(n.range.startLineNumber, 1, n.range.endLineNumber - 1, 1);
				r.push({
					range: e,
					options: diffLineDeleteDecorationBackgroundWithIndicator
				});
			}
			for (let e of n.inlineTexts) r.push({
				range: Range.fromPositions(new Position(n.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 r;
		}), 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, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$33 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, InlineEditHintsContentWidget_1, InlineEditHintsWidget = class extends Disposable {
	constructor(e, n, r) {
		super(), this.editor = e, this.model = n, this.instantiationService = r, this.alwaysShowToolbar = observableFromEvent(this, this.editor.onDidChangeConfiguration, () => this.editor.getOption(63).showToolbar === "always"), this.sessionPosition = void 0, this.position = derived(this, (e) => {
			let n = this.model.read(e)?.model.ghostText.read(e);
			if (!this.alwaysShowToolbar.read(e) || !n || n.parts.length === 0) return this.sessionPosition = void 0, null;
			let r = n.parts[0].column;
			this.sessionPosition && this.sessionPosition.lineNumber !== n.lineNumber && (this.sessionPosition = void 0);
			let i = new Position(n.lineNumber, Math.min(r, this.sessionPosition?.column ?? 2 ** 53 - 1));
			return this.sessionPosition = i, i;
		}), this._register(autorunWithStore((n, r) => {
			if (!this.model.read(n) || !this.alwaysShowToolbar.read(n)) return;
			let i = r.add(this.instantiationService.createInstance(InlineEditHintsContentWidget, this.editor, !0, this.position));
			e.addContentWidget(i), r.add(toDisposable(() => e.removeContentWidget(i)));
		}));
	}
};
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, n, r, i, a, o) {
		super(), this.editor = e, this.withBorder = n, this._position = r, this._contextKeyService = a, this._menuService = o, 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(i.createInstance(CustomizedMenuWorkbenchToolBar, this.nodes.toolBar, this.editor, MenuId.InlineEditToolbar, {
			menuOptions: { renderShortTitle: !0 },
			toolbarOptions: { primaryGroup: (e) => e.startsWith("primary") },
			actionViewItemProvider: (e, n) => {
				if (e instanceof MenuItemAction) return i.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 n = [];
			for (let [e, r] of this.inlineCompletionsActionsMenus.getActions()) for (let e of r) e instanceof MenuItemAction && n.push(e);
			n.length > 0 && n.unshift(new Separator()), this.toolBar.setAdditionalSecondaryActions(n);
		}));
	}
	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 n = h("div.keybinding").root;
			this._register(new KeybindingLabel(n, OS, {
				disableTitle: !0,
				...unthemedKeybindingLabelOptions
			})).set(e), this.label.textContent = this._action.label, this.label.appendChild(n), this.label.classList.add("inlineEditStatusBarItemLabel");
		}
	}
	updateTooltip() {}
}, CustomizedMenuWorkbenchToolBar = class extends WorkbenchToolBar {
	constructor(e, n, r, i, a, o, s, c, l, u) {
		super(e, {
			resetMenu: r,
			...i
		}, a, o, s, c, l, u), this.editor = n, this.menuId = r, this.options2 = i, this.menuService = a, this.contextKeyService = o, 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 = [], n = [];
		createAndFillInActionBarActions(this.menu, this.options2?.menuOptions, {
			primary: e,
			secondary: n
		}, this.options2?.toolbarOptions?.primaryGroup, this.options2?.toolbarOptions?.shouldInlineSubmenu, this.options2?.toolbarOptions?.useSeparatorsInPrimaryActions), n.push(...this.additionalActions), e.unshift(...this.prependedPrimaryActions), this.setActions(e, n);
	}
	setAdditionalSecondaryActions(e) {
		equals(this.additionalActions, e, (e, n) => e === n) || (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, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$32 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, InlineEditSideBySideWidget_1, InlineEditSideBySideContentWidget_1;
function* range(e, n, r = 1) {
	n === void 0 && ([n, e] = [e, 0]);
	for (let i = e; i < n; i += r) yield i;
}
function removeIndentation(e) {
	let n = e[0].match(/^\s*/)?.[0] ?? "", r = n.length;
	return {
		text: e.map((e) => e.replace(/* @__PURE__ */ RegExp("^" + n), "")),
		shift: r
	};
}
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, n, r, i, a) {
		super(), this._editor = e, this._model = n, this._instantiationService = r, this._diffProviderFactoryService = i, this._modelService = a, this._position = derived(this, (e) => {
			let n = this._model.read(e);
			if (!n || n.text.length === 0 || n.range.startLineNumber === n.range.endLineNumber && !(n.range.startColumn === n.range.endColumn && n.range.startColumn === 1)) return null;
			let r = this._editor.getModel();
			if (!r) return null;
			let i = Array.from(range(n.range.startLineNumber, n.range.endLineNumber + 1)), a = i.map((e) => r.getLineLastNonWhitespaceColumn(e)), o = Math.max(...a), s = i[a.indexOf(o)], c = new Position(s, o);
			return {
				top: n.range.startLineNumber,
				left: c
			};
		}), this._text = derived(this, (e) => {
			let n = this._model.read(e);
			if (!n) return {
				text: "",
				shift: 0
			};
			let r = removeIndentation(n.text.split("\n"));
			return {
				text: r.text.join("\n"),
				shift: r.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 n = this._model.read(e);
			if (!n) return;
			let r = this._editor.getModel();
			if (!r) return;
			let i = removeIndentation(r.getValueInRange(n.range).split("\n")).text.join("\n"), a = removeIndentation(n.text.split("\n")).text.join("\n");
			this._originalModel.get().setValue(i), this._modifiedModel.get().setValue(a);
			let o = this._diffProviderFactoryService.createDiffProvider({ diffAlgorithm: "advanced" });
			return ObservablePromise.fromFn(async () => {
				let e = await o.computeDiff(this._originalModel.get(), this._modifiedModel.get(), {
					computeMoves: !1,
					ignoreTrimWhitespace: !1,
					maxComputationTimeMs: 1e3
				}, CancellationToken.None);
				if (!e.identical) return e.changes;
			});
		}), this._register(autorunWithStore((n, r) => {
			if (!this._model.read(n) || this._position.get() === null) return;
			let i = r.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(i), r.add(toDisposable(() => e.removeOverlayWidget(i)));
		}));
	}
};
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, n, r, i, a, o) {
		super(), this._editor = e, this._position = n, this._text = r, this._shift = i, this._diff = a, this._instantiationService = o, 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 n = this._text.read(e);
			n && this._previewTextModel.setValue(n);
		}).recomputeInitiallyAndOnChange(this._store), this._decorations = derived(this, (e) => {
			this._setText.read(e);
			let n = this._position.read(e);
			if (!n) return {
				org: [],
				mod: []
			};
			let r = this._diff.read(e);
			if (!r) return {
				org: [],
				mod: []
			};
			let i = [], a = [];
			if (r.length === 1 && r[0].innerChanges[0].modifiedRange.equalsRange(this._previewTextModel.getFullModelRange())) return {
				org: [],
				mod: []
			};
			let o = this._shift.get(), s = (e) => new Range(e.startLineNumber + n.top - 1, e.startColumn + o, e.endLineNumber + n.top - 1, e.endColumn + o);
			for (let e of r) if (e.original.isEmpty || i.push({
				range: s(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 || i.push({
				range: s(e.original.toInclusiveRange()),
				options: diffWholeLineDeleteDecoration
			}), e.modified.isEmpty || a.push({
				range: e.modified.toInclusiveRange(),
				options: diffWholeLineAddDecoration
			});
			else for (let n of e.innerChanges || []) e.original.contains(n.originalRange.startLineNumber) && i.push({
				range: s(n.originalRange),
				options: n.originalRange.isEmpty() ? diffDeleteDecorationEmpty : diffDeleteDecoration
			}), e.modified.contains(n.modifiedRange.startLineNumber) && a.push({
				range: n.modifiedRange,
				options: n.modifiedRange.isEmpty() ? diffAddDecorationEmpty : diffAddDecoration
			});
			return {
				org: i,
				mod: a
			};
		}), 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 n = this._previewEditorObs.contentWidth.read(e), r = this._text.read(e).split("\n").length - 1, i = this._editor.getOption(67) * r;
			n <= 0 || this._previewEditor.layout({
				height: i,
				width: n
			});
		})), 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 n = this._editor.getLayoutInfo(), r = this._editor.getScrolledVisiblePosition(new Position(e.top, 1));
		if (!r) return null;
		let i = r.top - 1, a = this._editor.getOffsetForColumn(e.left.lineNumber, e.left.column);
		return { preference: {
			left: n.contentLeft + a + 10,
			top: i
		} };
	}
};
InlineEditSideBySideContentWidget = InlineEditSideBySideContentWidget_1 = __decorate$32([__param$32(5, IInstantiationService)], InlineEditSideBySideContentWidget);
var __decorate$31 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$31 = function(e, n) {
	return function(r, i) {
		n(r, i, 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, n, r, i, a, o, s, c) {
		super(), this.editor = e, this.instantiationService = n, this.contextKeyService = r, this.languageFeaturesService = i, this._commandService = a, this._configurationService = o, this._diffProviderFactoryService = s, this._modelService = c, 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 n = this._currentEdit.read(e);
			if (!n) return;
			let r = n.range.endLineNumber, i = n.range.endColumn, a = n.text.endsWith("\n") && !(n.range.startLineNumber === n.range.endLineNumber && n.range.startColumn === n.range.endColumn) ? n.text.slice(0, -1) : n.text, o = new GhostText(r, [new GhostTextPart(i, a, !1)]), s = n.range.startLineNumber === n.range.endLineNumber && o.parts.length === 1 && o.parts[0].lines.length === 1, c = n.text === "";
			if (!(!s && !c)) return this.instantiationService.createInstance(GhostTextWidget, this.editor, {
				ghostText: constObservable(o),
				minReservedLineCount: constObservable(0),
				targetTextModel: constObservable(this.editor.getModel() ?? void 0),
				range: constObservable(n.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 l = observableSignalFromEvent("InlineEditController.modelContentChangedSignal", e.onDidChangeModelContent);
		this._register(autorun((n) => {
			this._enabled.read(n) && (l.read(n), !this._isAccepting.read(n) && this.getInlineEdit(e, !0));
		}));
		let u = observableFromEvent(this, e.onDidChangeCursorPosition, () => e.getPosition());
		this._register(autorun((e) => {
			if (!this._enabled.read(e)) return;
			let n = u.read(e);
			n && this.checkCursorPosition(n);
		})), this._register(autorun((n) => {
			let r = this._currentEdit.read(n);
			if (this._isCursorAtInlineEditContext.set(!1), !r) {
				this._isVisibleContext.set(!1);
				return;
			}
			this._isVisibleContext.set(!0);
			let i = e.getPosition();
			i && this.checkCursorPosition(i);
		}));
		let d = observableSignalFromEvent("InlineEditController.editorBlurSignal", e.onDidBlurEditorWidget);
		this._register(autorun(async (n) => {
			this._enabled.read(n) && (d.read(n), !(this._configurationService.getValue("editor.experimentalInlineEdit.keepOnBlur") || e.getOption(63).keepOnBlur) && (this._currentRequestCts?.dispose(!0), this._currentRequestCts = void 0, await this.clear(!1)));
		}));
		let f = observableSignalFromEvent("InlineEditController.editorFocusSignal", e.onDidFocusEditorText);
		this._register(autorun((n) => {
			this._enabled.read(n) && (f.read(n), this.getInlineEdit(e, !0));
		}));
		let m = this._register(createStyleSheet2());
		this._register(autorun((e) => {
			let n = this._fontFamily.read(e);
			m.setStyle(n === "" || n === "default" ? "" : `
.monaco-editor .inline-edit-decoration,
.monaco-editor .inline-edit-decoration-preview,
.monaco-editor .inline-edit {
	font-family: ${n};
}`);
		})), 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 n = this._currentEdit.get();
		if (!n) {
			this._isCursorAtInlineEditContext.set(!1);
			return;
		}
		this._isCursorAtInlineEditContext.set(Range.containsPosition(n.range, e));
	}
	validateInlineEdit(e, n) {
		if (n.text.includes("\n") && n.range.startLineNumber !== n.range.endLineNumber && n.range.startColumn !== n.range.endColumn) {
			if (n.range.startColumn !== 1) return !1;
			let r = n.range.endLineNumber, i = n.range.endColumn, a = e.getModel()?.getLineLength(r) ?? 0;
			if (i !== a + 1) return !1;
		}
		return !0;
	}
	async fetchInlineEdit(e, n) {
		this._currentRequestCts && this._currentRequestCts.dispose(!0);
		let r = e.getModel();
		if (!r) return;
		let i = r.getVersionId(), a = this.languageFeaturesService.inlineEditProvider.all(r);
		if (a.length === 0) return;
		let o = a[0];
		this._currentRequestCts = new CancellationTokenSource();
		let s = this._currentRequestCts.token, c = n ? InlineEditTriggerKind.Automatic : InlineEditTriggerKind.Invoke;
		if (n && await wait(50, s), s.isCancellationRequested || r.isDisposed() || r.getVersionId() !== i) return;
		let l = await o.provideInlineEdit(r, { triggerKind: c }, s);
		if (l && !(s.isCancellationRequested || r.isDisposed() || r.getVersionId() !== i) && this.validateInlineEdit(e, l)) return l;
	}
	async getInlineEdit(e, n) {
		this._isCursorAtInlineEditContext.set(!1), await this.clear();
		let r = await this.fetchInlineEdit(e, n);
		r && this._currentEdit.set(r, 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 n = e.text;
		e.text.startsWith("\n") && (n = e.text.substring(1)), this.editor.pushUndoStop(), this.editor.executeEdits("acceptCurrent", [EditOperation.replace(Range.lift(e.range), n)]), 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 n = Position.lift({
			lineNumber: e.range.startLineNumber,
			column: e.range.startColumn
		});
		this.editor.setPosition(n), this.editor.revealPositionInCenterIfOutsideViewport(n);
	}
	async clear(e = !0) {
		let n = this._currentEdit.get();
		n && n?.rejected && e && await this._commandService.executeCommand(n.rejected.id, ...n.rejected.arguments || []).then(void 0, onUnexpectedExternalError), n && this.freeEdit(n), this._currentEdit.set(void 0, void 0);
	}
	freeEdit(e) {
		let n = this.editor.getModel();
		if (!n) return;
		let r = this.languageFeaturesService.inlineEditProvider.all(n);
		r.length !== 0 && r[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, n) {
	return new Promise((r) => {
		let i, a = setTimeout(() => {
			i && i.dispose(), r();
		}, e);
		n && (i = n.onCancellationRequested(() => {
			clearTimeout(a), i && i.dispose(), r();
		}));
	});
}
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, n) {
		await InlineEditController.get(n)?.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, n) {
		InlineEditController.get(n)?.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, n) {
		InlineEditController.get(n)?.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, n) {
		InlineEditController.get(n)?.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, n) {
		await InlineEditController.get(n)?.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 n = this._placeholderText.read(e);
			if (n && this._editorObs.valueIsEmpty.read(e)) return { placeholder: n };
		}), this._shouldViewBeAlive = isOrWasTrue(this, (e) => this._state.read(e)?.placeholder !== void 0), this._view = derivedWithStore((e, n) => {
			if (!this._shouldViewBeAlive.read(e)) return;
			let r = h("div.editorPlaceholder");
			n.add(autorun((e) => {
				let n = this._state.read(e), i = n?.placeholder !== void 0;
				r.root.style.display = i ? "block" : "none", r.root.innerText = n?.placeholder ?? "";
			})), n.add(autorun((e) => {
				let n = this._editorObs.layoutInfo.read(e);
				r.root.style.left = `${n.contentLeft}px`, r.root.style.width = n.contentWidth - n.verticalScrollbarWidth + "px", r.root.style.top = `${this._editor.getTopForLineNumber(0)}px`;
			})), n.add(autorun((e) => {
				r.root.style.fontFamily = this._editorObs.getOption(49).read(e), r.root.style.fontSize = this._editorObs.getOption(52).read(e) + "px", r.root.style.lineHeight = this._editorObs.getOption(67).read(e) + "px";
			})), n.add(this._editorObs.createOverlayWidget({
				allowEditorOverflow: !1,
				minContentWidthInPx: constObservable(0),
				position: constObservable(null),
				domNode: r.root
			}));
		}), this._view.recomputeInitiallyAndOnChange(this._store);
	}
};
function isOrWasTrue(e, n) {
	return derivedObservableWithCache(e, (e, r) => r === !0 ? !0 : n(e));
}
var __decorate$30 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$30 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, InlineEdit = class {
	constructor(e, n, r) {
		this.range = e, this.newLines = n, this.changes = r;
	}
}, InlineEditsWidget = class extends Disposable {
	constructor(n, r, i, a) {
		super(), this._editor = n, this._edit = r, this._userPrompt = i, this._instantiationService = a, 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 n = this._edit.read(e);
			n && this._previewTextModel.setValue(n.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 n = this._edit.read(e)?.changes;
			if (!n) return [];
			let r = [], i = [];
			if (n.length === 1 && n[0].innerChanges[0].modifiedRange.equalsRange(this._previewTextModel.getFullModelRange())) return [];
			for (let e of n) if (e.original.isEmpty || r.push({
				range: e.original.toInclusiveRange(),
				options: diffLineDeleteDecorationBackgroundWithIndicator
			}), e.modified.isEmpty || i.push({
				range: e.modified.toInclusiveRange(),
				options: diffLineAddDecorationBackgroundWithIndicator
			}), e.modified.isEmpty || e.original.isEmpty) e.original.isEmpty || r.push({
				range: e.original.toInclusiveRange(),
				options: diffWholeLineDeleteDecoration
			}), e.modified.isEmpty || i.push({
				range: e.modified.toInclusiveRange(),
				options: diffWholeLineAddDecoration
			});
			else for (let n of e.innerChanges || []) e.original.contains(n.originalRange.startLineNumber) && r.push({
				range: n.originalRange,
				options: n.originalRange.isEmpty() ? diffDeleteDecorationEmpty : diffDeleteDecoration
			}), e.modified.contains(n.modifiedRange.startLineNumber) && i.push({
				range: n.modifiedRange,
				options: n.modifiedRange.isEmpty() ? diffAddDecorationEmpty : diffAddDecoration
			});
			return i;
		}), this._layout1 = derived(this, (e) => {
			let n = this._editor.getModel(), r = this._edit.read(e);
			if (!r) return null;
			let i = r.range, a = 0;
			for (let e = i.startLineNumber; e < i.endLineNumberExclusive; e++) {
				let r = n.getLineMaxColumn(e), i = this._editor.getOffsetForColumn(e, r);
				a = Math.max(a, i);
			}
			return { left: this._editor.getLayoutInfo().contentLeft + a };
		}), this._layout = derived(this, (e) => {
			let n = this._edit.read(e);
			if (!n) return null;
			let r = n.range, i = this._editorObs.scrollLeft.read(e), a = this._layout1.read(e).left + 20 - i, o = this._editor.getTopForLineNumber(r.startLineNumber) - this._editorObs.scrollTop.read(e), s = this._editor.getTopForLineNumber(r.endLineNumberExclusive) - this._editorObs.scrollTop.read(e), c = new Point(a, o), l = new Point(a, s), u = s - o, d = this._editor.getOption(67) * n.newLines.length, f = u - d, m = new Point(a + 50, o + f / 2), g = new Point(a + 50, s - f / 2);
			return {
				topCode: c,
				bottomCode: l,
				codeHeight: u,
				topEdit: m,
				bottomEdit: g,
				editHeight: d
			};
		});
		let o = 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) => o.read(e) ? "block" : "none") })), this._register(appendRemoveOnDispose(this._editor.getDomNode(), this._elements.root)), this._register(observableCodeEditor(n).createOverlayWidget({
			domNode: this._elements.root,
			position: constObservable(null),
			allowEditorOverflow: !1,
			minContentWidthInPx: derived((e) => {
				let n = this._layout1.read(e)?.left;
				if (n === void 0) return 0;
				let r = this._previewEditorObs.contentWidth.read(e);
				return n + r;
			})
		})), this._previewEditor.setModel(this._previewTextModel), this._register(this._previewEditorObs.setDecorations(this._decorations)), this._register(autorun((e) => {
			let n = this._layout.read(e);
			if (!n) return;
			let { topCode: r, bottomCode: i, topEdit: a, bottomEdit: o, editHeight: s } = n, c = new PathBuilder().moveTo(r).lineTo(r.deltaX(10)).curveTo(r.deltaX(50), a.deltaX(-40), a.deltaX(-0)).lineTo(a).lineTo(o).lineTo(o.deltaX(-0)).curveTo(o.deltaX(-40), i.deltaX(50), i.deltaX(10)).lineTo(i).build();
			this._elements.path.setAttribute("d", c), this._elements.editorContainer.style.top = `${a.y}px`, this._elements.editorContainer.style.left = `${a.x}px`, this._elements.editorContainer.style.height = `${s}px`;
			let l = this._previewEditorObs.contentWidth.read(e);
			this._previewEditor.layout({
				height: s,
				width: l
			});
		})), 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 n = observableCodeEditor(this._promptEditor).isFocused.read(e);
			this._elements.root.classList.toggle("focused", n);
		}));
	}
};
InlineEditsWidget = __decorate$30([__param$30(3, IInstantiationService)], InlineEditsWidget);
function mapSettableObservable(e, n, r) {
	return derivedWithSetter(void 0, (r) => n(e.read(r)), (n, i) => e.set(r(n), i));
}
var Point = class e {
	constructor(e, n) {
		this.x = e, this.y = n;
	}
	deltaX(n) {
		return new e(this.x + n, 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, n, r) {
		return this._data += `C ${e.x} ${e.y} ${n.x} ${n.y} ${r.x} ${r.y} `, this;
	}
	build() {
		return this._data;
	}
};
function createTwoWaySync(e, n) {
	let r = new DisposableStore();
	return r.add(autorun((r) => {
		let i = e.read(r);
		n.set(i, void 0);
	})), r.add(autorun((r) => {
		let i = n.read(r);
		e.set(i, void 0);
	})), r;
}
var __decorate$29 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$29 = function(e, n) {
	return function(r, i) {
		n(r, i, 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, n, r, i, a, o, s) {
		super(), this.textModel = e, this._textModelVersionId = n, this._selection = r, this._debounceValue = i, this.languageFeaturesService = a, this._diffProviderFactoryService = o, this._modelService = s, 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 n = this.selectedInlineEdit.read(e);
			if (!n) return;
			let r = n.inlineCompletion.range;
			if (n.inlineCompletion.insertText.trim() === "") return;
			let i = n.inlineCompletion.insertText.split(/\r\n|\r|\n/);
			function a(e) {
				let n = e[0].match(/^\s*/)?.[0] ?? "";
				return e.map((e) => e.replace(/* @__PURE__ */ RegExp("^" + n), ""));
			}
			i = a(i);
			let o = this.textModel.getValueInRange(r).split(/\r\n|\r|\n/);
			o = a(o), this._originalModel.get().setValue(o.join("\n")), this._modifiedModel.get().setValue(i.join("\n"));
			let s = this._diffProviderFactoryService.createDiffProvider({ diffAlgorithm: "advanced" });
			return ObservablePromise.fromFn(async () => {
				let e = await s.computeDiff(this._originalModel.get(), this._modifiedModel.get(), {
					computeMoves: !1,
					ignoreTrimWhitespace: !1,
					maxComputationTimeMs: 1e3
				}, CancellationToken.None);
				if (!e.identical) return new InlineEdit(LineRange.fromRangeInclusive(r), a(i), 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, n) => (e.didChange(this._forceUpdateExplicitlySignal) && (n.inlineCompletionTriggerKind = InlineCompletionTriggerKind.Explicit), !0)
		}, async (e, n) => {
			this._fetchStore.clear(), this._forceUpdateExplicitlySignal.read(e), this._textModelVersionId.read(e);
			function r(e, n) {
				return n(e);
			}
			let i = this._pinnedRange.range.read(e) ?? r(this._selection.read(e), (e) => e.isEmpty() ? void 0 : e);
			if (!i) {
				this._inlineEditsFetchResult.set(void 0, void 0), this.userPrompt.set(void 0, void 0);
				return;
			}
			let a = {
				triggerKind: n.inlineCompletionTriggerKind,
				selectedSuggestionInfo: void 0,
				userPrompt: this.userPrompt.read(e)
			}, o = cancelOnDispose(this._fetchStore);
			await timeout(200, o);
			let s = await provideInlineCompletions(this.languageFeaturesService.inlineCompletionsProvider, i, this.textModel, a, o);
			o.isCancellationRequested || this._inlineEditsFetchResult.set(s, void 0);
		}), this._filteredInlineEditItems = derivedOpts({
			owner: this,
			equalsFn: itemsEquals()
		}, (e) => this._inlineEdits.read(e)), this.selectedInlineCompletionIndex = derived(this, (e) => {
			let n = this._selectedInlineCompletionId.read(e), r = this._filteredInlineEditItems.read(e), i = this._selectedInlineCompletionId === void 0 ? -1 : r.findIndex((e) => e.semanticId === n);
			return i === -1 ? (this._selectedInlineCompletionId.set(void 0, void 0), 0) : i;
		}), this.selectedInlineEdit = derived(this, (e) => {
			let n = this._filteredInlineEditItems.read(e), r = this.selectedInlineCompletionIndex.read(e);
			return n[r];
		}), 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 n = this._filteredInlineEditItems.get() || [];
		if (n.length > 0) {
			let r = (this.selectedInlineCompletionIndex.get() + e + n.length) % n.length;
			this._selectedInlineCompletionId.set(n[r].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 n = this.selectedInlineEdit.get();
		n && (e.pushUndoStop(), e.executeEdits("inlineSuggestion.accept", [n.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, n) {
		super(), this._textModel = e, this._versionId = n, this._decorations = observableValue(this, []), this.range = derived(this, (e) => {
			this._versionId.read(e);
			let n = this._decorations.read(e)[0];
			return n ? this._textModel.getDecorationRange(n) ?? null : null;
		}), this._register(toDisposable(() => {
			this._textModel.deltaDecorations(this._decorations.get(), []);
		}));
	}
	setRange(e, n) {
		this._decorations.set(this._textModel.deltaDecorations(this._decorations.get(), e ? [{
			range: e,
			options: { description: "trackedRange" }
		}] : []), n);
	}
}, __decorate$28 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$28 = function(e, n) {
	return function(r, i) {
		n(r, i, 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, n, r, i, a, o) {
		super(), this.editor = e, this._instantiationService = n, this._contextKeyService = r, this._debounceService = i, this._languageFeaturesService = a, this._configurationService = o, 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 n = this._editorObs.model.read(e);
			if (n) return this._instantiationService.createInstance(readHotReloadableExport(InlineEditsModel, e), n, this._editorObs.versionId, this._selection, this._debounceValue);
		}), this._hadInlineEdit = derivedObservableWithCache(this, (e, n) => n || 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, n) => e?.inlineEdit.read(n)), 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, (n) => e(n).read(n), (n, r) => {
		e(void 0).set(n, r);
	});
}
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, n) {
		InlineEditsController.get(n)?.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, n) {
		InlineEditsController.get(n)?.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, n) {
		let r = InlineEditsController.get(n);
		await asyncTransaction(async (e) => {
			await r?.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, n) {
		n instanceof EmbeddedCodeEditorWidget && (n = n.getParentEditor());
		let r = InlineEditsController.get(n);
		r && (r.model.get()?.accept(r.editor), r.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, n) {
		let r = InlineEditsController.get(n);
		transaction((e) => {
			r?.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, n, r, i, a) {
	let o = e.ordered(n);
	for (let e of o) try {
		let o = await e.provideSignatureHelp(n, r, a, i);
		if (o) return o;
	} catch (e) {
		onUnexpectedExternalError(e);
	}
}
CommandsRegistry.registerCommand("_executeSignatureHelpProvider", async (e, ...n) => {
	let [r, i, a] = n;
	assertType(URI.isUri(r)), assertType(Position.isIPosition(i)), assertType(typeof a == "string" || !a);
	let o = e.get(ILanguageFeaturesService), s = await e.get(ITextModelService).createModelReference(r);
	try {
		let e = await provideSignatureHelp(o.signatureHelpProvider, s.object.textEditorModel, Position.lift(i), {
			triggerKind: SignatureHelpTriggerKind.Invoke,
			isRetrigger: !1,
			triggerCharacter: a
		}, CancellationToken.None);
		return e ? (setTimeout(() => e.dispose(), 0), e.value) : void 0;
	} finally {
		s.dispose();
	}
});
var ParameterHintState;
(function(e) {
	e.Default = { type: 0 };
	class n {
		constructor(e, n) {
			this.request = e, this.previouslyActiveHints = n, this.type = 2;
		}
	}
	e.Pending = n;
	class r {
		constructor(e) {
			this.hints = e, this.type = 1;
		}
	}
	e.Active = r;
})(ParameterHintState ||= {});
var ParameterHintsModel = class e extends Disposable {
	static {
		this.DEFAULT_DELAY = 120;
	}
	constructor(n, r, i = 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 = n, this.providers = r, this.throttledDelayer = new Delayer(i), 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, n) {
		let r = this.editor.getModel();
		if (!r || !this.providers.has(r)) return;
		let i = ++this.triggerId;
		this._pendingTriggers.push(e), this.throttledDelayer.trigger(() => this.doTrigger(i), n).catch(onUnexpectedError);
	}
	next() {
		if (this.state.type !== 1) return;
		let e = this.state.hints.signatures.length, n = this.state.hints.activeSignature, r = n % e === e - 1, i = this.editor.getOption(86).cycle;
		if ((e < 2 || r) && !i) {
			this.cancel();
			return;
		}
		this.updateActiveSignature(r && i ? 0 : n + 1);
	}
	previous() {
		if (this.state.type !== 1) return;
		let e = this.state.hints.signatures.length, n = this.state.hints.activeSignature, r = n === 0, i = this.editor.getOption(86).cycle;
		if ((e < 2 || r) && !i) {
			this.cancel();
			return;
		}
		this.updateActiveSignature(r && i ? e - 1 : n - 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 n = this.state.type === 1 || this.state.type === 2, r = this.getLastActiveHints();
		if (this.cancel(!0), this._pendingTriggers.length === 0) return !1;
		let i = this._pendingTriggers.reduce(mergeTriggerContexts);
		this._pendingTriggers = [];
		let a = {
			triggerKind: i.triggerKind,
			triggerCharacter: i.triggerCharacter,
			isRetrigger: n,
			activeSignatureHelp: r
		};
		if (!this.editor.hasModel()) return !1;
		let o = this.editor.getModel(), s = this.editor.getPosition();
		this.state = new ParameterHintState.Pending(createCancelablePromise((e) => provideSignatureHelp(this.providers, o, s, a, e)), r);
		try {
			let n = await this.state.request;
			return e === this.triggerId ? !n || !n.value.signatures || n.value.signatures.length === 0 ? (n?.dispose(), this._lastSignatureHelpResult.clear(), this.cancel(), !1) : (this.state = new ParameterHintState.Active(n.value), this._lastSignatureHelpResult.value = n, this._onChangedHints.fire(this.state.hints), !0) : (n?.dispose(), !1);
		} catch (n) {
			return e === this.triggerId && (this.state = ParameterHintState.Default), onUnexpectedError(n), !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 n of this.providers.ordered(e)) {
			for (let e of n.signatureHelpTriggerCharacters || []) if (e.length) {
				let n = e.charCodeAt(0);
				this.triggerChars.add(n), this.retriggerChars.add(n);
			}
			for (let e of n.signatureHelpRetriggerCharacters || []) e.length && this.retriggerChars.add(e.charCodeAt(0));
		}
	}
	onDidType(e) {
		if (!this.triggerOnType) return;
		let n = e.length - 1, r = e.charCodeAt(n);
		(this.triggerChars.has(r) || this.isTriggered && this.retriggerChars.has(r)) && this.trigger({
			triggerKind: SignatureHelpTriggerKind.TriggerCharacter,
			triggerCharacter: e.charAt(n)
		});
	}
	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, n) {
	switch (n.triggerKind) {
		case SignatureHelpTriggerKind.Invoke: return n;
		case SignatureHelpTriggerKind.ContentChange: return e;
		case SignatureHelpTriggerKind.TriggerCharacter:
		default: return n;
	}
}
var __decorate$27 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$27 = function(e, n) {
	return function(r, i) {
		n(r, i, 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, n, r, i, a, o) {
		super(), this.editor = e, this.model = n, this.telemetryService = o, this.renderDisposeables = this._register(new DisposableStore()), this.visible = !1, this.announcedLabel = null, this.allowEditorOverflow = !0, this.markdownRenderer = this._register(new MarkdownRenderer({ editor: e }, a, i)), this.keyVisible = Context.Visible.bindTo(r), this.keyMultipleSignatures = Context.MultipleSignatures.bindTo(r);
	}
	createParameterHintDOMNodes() {
		let e = $$1(".editor-widget.parameter-hints-widget"), n = append(e, $$1(".phwrapper"));
		n.tabIndex = -1;
		let r = append(n, $$1(".controls")), i = append(r, $$1(".button" + ThemeIcon.asCSSSelector(parameterHintsPreviousIcon))), a = append(r, $$1(".overloads")), o = append(r, $$1(".button" + ThemeIcon.asCSSSelector(parameterHintsNextIcon)));
		this._register(addDisposableListener(i, "click", (e) => {
			EventHelper.stop(e), this.previous();
		})), this._register(addDisposableListener(o, "click", (e) => {
			EventHelper.stop(e), this.next();
		}));
		let s = $$1(".body"), c = new DomScrollableElement(s, { alwaysConsumeMouseWheel: !0 });
		this._register(c), n.appendChild(c.getDomNode());
		let l = append(s, $$1(".signature")), u = append(s, $$1(".docs"));
		e.style.userSelect = "text", this.domNodes = {
			element: e,
			signature: l,
			overloads: a,
			docs: u,
			scrollbar: c
		}, this.editor.addContentWidget(this), this.hide(), this._register(this.editor.onDidChangeCursorSelection((e) => {
			this.visible && this.editor.layoutContentWidget(this);
		}));
		let d = () => {
			if (!this.domNodes) return;
			let e = this.editor.getOption(50), n = this.domNodes.element;
			n.style.fontSize = `${e.fontSize}px`, n.style.lineHeight = `${e.lineHeight / e.fontSize}`, n.style.setProperty("--vscode-parameterHintsWidget-editorFontFamily", e.fontFamily), n.style.setProperty("--vscode-parameterHintsWidget-editorFontFamilyDefault", EDITOR_FONT_DEFAULTS.fontFamily);
		};
		d(), this._register(Event.chain(this.editor.onDidChangeConfiguration.bind(this.editor), (e) => e.filter((e) => e.hasChanged(50)))(d)), 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 n = e.signatures.length > 1;
		this.domNodes.element.classList.toggle("multiple", n), this.keyMultipleSignatures.set(n), this.domNodes.signature.innerText = "", this.domNodes.docs.innerText = "";
		let r = e.signatures[e.activeSignature];
		if (!r) return;
		let i = append(this.domNodes.signature, $$1(".code")), a = r.parameters.length > 0, o = r.activeParameter ?? e.activeParameter;
		if (a) this.renderParameters(i, r, o);
		else {
			let e = append(i, $$1("span"));
			e.textContent = r.label;
		}
		let s = r.parameters[o];
		if (s?.documentation) {
			let e = $$1("span.documentation");
			if (typeof s.documentation == "string") e.textContent = s.documentation;
			else {
				let n = this.renderMarkdownDocs(s.documentation);
				e.appendChild(n.element);
			}
			append(this.domNodes.docs, $$1("p", {}, e));
		}
		if (r.documentation !== void 0) if (typeof r.documentation == "string") append(this.domNodes.docs, $$1("p", {}, r.documentation));
		else {
			let e = this.renderMarkdownDocs(r.documentation);
			append(this.domNodes.docs, e.element);
		}
		let c = this.hasDocs(r, s);
		if (this.domNodes.signature.classList.toggle("has-docs", c), this.domNodes.docs.classList.toggle("empty", !c), this.domNodes.overloads.textContent = String(e.activeSignature + 1).padStart(e.signatures.length.toString().length, "0") + "/" + e.signatures.length, s) {
			let e = "", n = r.parameters[o];
			e = Array.isArray(n.label) ? r.label.substring(n.label[0], n.label[1]) : n.label, n.documentation && (e += typeof n.documentation == "string" ? `, ${n.documentation}` : `, ${n.documentation.value}`), r.documentation && (e += typeof r.documentation == "string" ? `, ${r.documentation}` : `, ${r.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 n = new StopWatch(), r = this.renderDisposeables.add(this.markdownRenderer.render(e, { asyncRenderCallback: () => {
			this.domNodes?.scrollbar.scanDomNode();
		} }));
		r.element.classList.add("markdown-docs");
		let i = n.elapsed();
		return i > 300 && this.telemetryService.publicLog2("parameterHints.parseMarkdown", { renderDuration: i }), r;
	}
	hasDocs(e, n) {
		return !!(n && typeof n.documentation == "string" && assertIsDefined(n.documentation).length > 0 || n && typeof n.documentation == "object" && assertIsDefined(n.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, n, r) {
		let [i, a] = this.getParameterLabelOffsets(n, r), o = document.createElement("span");
		o.textContent = n.label.substring(0, i);
		let s = document.createElement("span");
		s.textContent = n.label.substring(i, a), s.className = "parameter active";
		let c = document.createElement("span");
		c.textContent = n.label.substring(a), append(e, o, s, c);
	}
	getParameterLabelOffsets(e, n) {
		let r = e.parameters[n];
		if (r) {
			if (Array.isArray(r.label)) return r.label;
			if (r.label.length) {
				let n = RegExp(`(\\W|^)${escapeRegExpCharacters(r.label)}(?=\\W|$)`, "g");
				n.test(e.label);
				let i = n.lastIndex - r.label.length;
				return i >= 0 ? [i, n.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 n = this.domNodes.element.getElementsByClassName("phwrapper");
		n.length && (n[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, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$26 = function(e, n) {
	return function(r, i) {
		n(r, i, 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, n, r) {
		super(), this.editor = e, this.model = this._register(new ParameterHintsModel(e, r.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(n.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, n) {
		ParameterHintsController.get(n)?.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, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$25 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, BaseClass = class {
	constructor(e) {
		this.instantiationService = e;
	}
	init(...e) {}
};
function createWrapper(e, n) {
	return class extends n {
		constructor() {
			super(...arguments), this._autorun = void 0;
		}
		init(...n) {
			this._autorun = autorunWithStore((r, i) => {
				let a = readHotReloadableExport(e(), r);
				i.add(this.instantiationService.createInstance(a, ...n));
			});
		}
		dispose() {
			this._autorun?.dispose();
		}
	};
}
function wrapInReloadableClass1(e) {
	return isHotReloadEnabled() ? createWrapper(e, BaseClass1) : e();
}
var BaseClass1 = class extends BaseClass {
	constructor(e, n) {
		super(n), 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, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$24 = function(e, n) {
	return function(r, i) {
		n(r, i, 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, n, r, i, a, o) {
		this._editor = e, this._acceptKeybindings = n, this._themeService = r, this._keybindingService = i, this._logService = o, this.allowEditorOverflow = !0, this._disposables = new DisposableStore(), this._visibleContextKey = CONTEXT_RENAME_INPUT_VISIBLE.bindTo(a), 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(r.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 n = e.getColor(widgetShadow), r = e.getColor(widgetBorder);
		this._domNode.style.backgroundColor = String(e.getColor(editorWidgetBackground) ?? ""), this._domNode.style.boxShadow = n ? ` 0 0 8px 2px ${n}` : "", this._domNode.style.border = r ? `1px solid ${r}` : "", this._domNode.style.color = String(e.getColor(inputForeground) ?? "");
		let i = 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 = i ? "1px" : "0px", this._inputWithButton.domNode.style.borderStyle = i ? "solid" : "none", this._inputWithButton.domNode.style.borderColor = i?.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), n = getDomNodePagePosition(this._editor.getDomNode());
		this._nPxAvailableAbove = this._getTopForPosition() + n.top, this._nPxAvailableBelow = e.height - this._nPxAvailableAbove;
		let r = this._editor.getOption(67), { totalHeight: i } = RenameCandidateView.getLayoutInfo({ lineHeight: r }), a = this._nPxAvailableBelow > i * 6 ? [2, 1] : [1, 2];
		return {
			position: this._position,
			preference: a
		};
	}
	beforeRender() {
		let [e, n] = 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(n)?.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 n = getTotalHeight(this._inputWithButton.domNode), r = getTotalHeight(this._label), i;
		i = e === 2 ? this._nPxAvailableBelow : this._nPxAvailableAbove, this._renameCandidateListView.layout({
			height: i - r - n,
			width: getTotalWidth(this._inputWithButton.domNode)
		});
	}
	acceptInput(e) {
		this._trace("invoking acceptInput"), this._currentAcceptInput?.(e);
	}
	cancelInput(e, n) {
		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, n, r, i, a) {
		let { start: o, end: s } = this._getSelection(e, n);
		this._renameCts = a;
		let c = new DisposableStore();
		this._nRenameSuggestionsInvocations = 0, this._hadAutomaticRenameSuggestionsInvocation = !1, i === void 0 ? this._inputWithButton.button.style.display = "none" : (this._inputWithButton.button.style.display = "flex", this._requestRenameCandidatesOnce = i, this._requestRenameCandidates(n, !1), c.add(addDisposableListener(this._inputWithButton.button, "click", () => this._requestRenameCandidates(n, !0))), c.add(addDisposableListener(this._inputWithButton.button, EventType$1.KEY_DOWN, (e) => {
			let r = new StandardKeyboardEvent(e);
			(r.equals(3) || r.equals(10)) && (r.stopPropagation(), r.preventDefault(), this._requestRenameCandidates(n, !0));
		}))), this._isEditingRenameCandidate = !1, this._domNode.classList.toggle("preview", r), this._position = new Position(e.startLineNumber, e.startColumn), this._currentName = n, this._inputWithButton.input.value = n, this._inputWithButton.input.setAttribute("selectionStart", o.toString()), this._inputWithButton.input.setAttribute("selectionEnd", s.toString()), this._inputWithButton.input.size = Math.max((e.endColumn - e.startColumn) * 1.1, 20), this._beforeFirstInputFieldEditSW.reset(), c.add(toDisposable(() => {
			this._renameCts = void 0, a.dispose(!0);
		})), c.add(toDisposable(() => {
			this._renameCandidateProvidersCts !== void 0 && (this._renameCandidateProvidersCts.dispose(!0), this._renameCandidateProvidersCts = void 0);
		})), c.add(toDisposable(() => this._candidates.clear()));
		let l = new DeferredPromise();
		return l.p.finally(() => {
			c.dispose(), this._hide();
		}), this._currentCancelInput = (e) => (this._trace("invoking _currentCancelInput"), this._currentAcceptInput = void 0, this._currentCancelInput = void 0, this._renameCandidateListView?.clearCandidates(), l.complete(e), !0), this._currentAcceptInput = (e) => {
			this._trace("invoking _currentAcceptInput"), assertType(this._renameCandidateListView !== void 0);
			let i = this._renameCandidateListView.nCandidates, a, o, s = this._renameCandidateListView.focusedCandidate;
			if (s === void 0 ? (this._trace("using new name from inputField"), a = this._inputWithButton.input.value, o = this._isEditingRenameCandidate ? { k: "userEditedRenameSuggestion" } : { k: "inputField" }) : (this._trace("using new name from renameSuggestion"), a = s, o = { k: "renameSuggestion" }), a === n || a.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(), l.complete({
				newName: a,
				wantsPreview: r && e,
				stats: {
					source: o,
					nRenameSuggestions: i,
					timeBeforeFirstInputFieldEdit: this._timeBeforeFirstInputFieldEdit,
					nRenameSuggestionsInvocations: this._nRenameSuggestionsInvocations,
					hadAutomaticRenameSuggestionsInvocation: this._hadAutomaticRenameSuggestionsInvocation
				}
			});
		}, c.add(a.token.onCancellationRequested(() => this.cancelInput(!0, "cts.token.onCancellationRequested"))), c.add(this._editor.onDidBlurEditorWidget(() => this.cancelInput(!this._domNode?.ownerDocument.hasFocus(), "editor.onDidBlurEditorWidget"))), this._show(), l.p;
	}
	_requestRenameCandidates(e, n) {
		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 r = n ? NewSymbolNameTriggerKind.Invoke : NewSymbolNameTriggerKind.Automatic, i = this._requestRenameCandidatesOnce(r, this._renameCandidateProvidersCts.token);
			if (i.length === 0) {
				this._inputWithButton.setSparkleButton();
				return;
			}
			n || (this._hadAutomaticRenameSuggestionsInvocation = !0), this._nRenameSuggestionsInvocations += 1, this._inputWithButton.setStopButton(), this._updateRenameCandidates(i, e, this._renameCts.token);
		}
	}
	_getSelection(e, n) {
		assertType(this._editor.hasModel());
		let r = this._editor.getSelection(), i = 0, a = n.length;
		return !Range.isEmpty(r) && !Range.spansMultipleLines(r) && Range.containsRange(e, r) && (i = Math.max(0, r.startColumn - e.startColumn), a = Math.min(e.endColumn, r.endColumn) - e.startColumn), {
			start: i,
			end: a
		};
	}
	_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, n, r) {
		let i = (...e) => this._trace("_updateRenameCandidates", ...e);
		i("start");
		let a = await raceCancellation(Promise.allSettled(e), r);
		if (this._inputWithButton.setSparkleButton(), a === void 0) {
			i("returning early - received updateRenameCandidates results - undefined");
			return;
		}
		let o = a.flatMap((e) => e.status === "fulfilled" && isDefined(e.value) ? e.value : []);
		i(`received updateRenameCandidates results - total (unfiltered) ${o.length} candidates.`);
		let s = distinct(o, (e) => e.newSymbolName);
		i(`distinct candidates - ${s.length} candidates.`);
		let c = s.filter(({ newSymbolName: e }) => e.trim().length > 0 && e !== this._inputWithButton.input.value && e !== n && !this._candidates.has(e));
		if (i(`valid distinct candidates - ${o.length} candidates.`), c.forEach((e) => this._candidates.add(e.newSymbolName)), c.length < 1) {
			i("returning early - no valid distinct candidates");
			return;
		}
		i("setting candidates"), this._renameCandidateListView.setCandidates(c), i("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(), n;
		return e.length > 0 ? n = e[0].startLineNumber : (this._logService.warn("RenameWidget#_getTopForPosition: this should not happen - visibleRanges is empty"), n = Math.max(1, this._position.lineNumber - 5)), this._editor.getTopForLineNumber(this._position.lineNumber) - this._editor.getTopForLineNumber(n);
	}
	_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(n, r) {
		this._disposables = new DisposableStore(), this._availableHeight = 0, this._minimumWidth = 0, this._lineHeight = r.fontInfo.lineHeight, this._typicalHalfwidthCharacterWidth = r.fontInfo.typicalHalfwidthCharacterWidth, this._listContainer = document.createElement("div"), this._listContainer.className = "rename-box rename-candidate-list-container", n.appendChild(this._listContainer), this._listWidget = e._createListWidget(this._listContainer, this._candidateViewHeight, r.fontInfo), this._listWidget.onDidChangeFocus((e) => {
			e.elements.length === 1 && r.onFocusChange(e.elements[0].newSymbolName);
		}, this._disposables), this._listWidget.onDidChangeSelection((e) => {
			e.elements.length === 1 && r.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: n }) {
		this._availableHeight = e, this._minimumWidth = n;
	}
	setCandidates(e) {
		this._listWidget.splice(0, 0, e);
		let n = this._pickListHeight(this._listWidget.length), r = this._pickListWidth(e);
		this._listWidget.layout(n, r), this._listContainer.style.height = `${n}px`, this._listContainer.style.width = `${r}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 n = this._listWidget.getFocusedElements()[0];
		if (n !== void 0) return n.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 n = this._candidateViewHeight * e;
		return Math.min(n, this._availableHeight, this._candidateViewHeight * 7);
	}
	_pickListWidth(e) {
		let n = Math.ceil(Math.max(...e.map((e) => e.newSymbolName.length)) * this._typicalHalfwidthCharacterWidth);
		return Math.max(this._minimumWidth, 25 + n + 10);
	}
	static _createListWidget(e, n, r) {
		let i = new class {
			getTemplateId(e) {
				return "candidate";
			}
			getHeight(e) {
				return n;
			}
		}(), a = new class {
			constructor() {
				this.templateId = "candidate";
			}
			renderTemplate(e) {
				return new RenameCandidateView(e, r);
			}
			renderElement(e, n, r) {
				r.populate(e);
			}
			disposeTemplate(e) {
				e.dispose();
			}
		}();
		return new List("NewSymbolNameCandidates", e, i, [a], {
			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 n = new StandardKeyboardEvent(e);
			(n.keyCode === 15 || n.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(n, r) {
		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 = `${r.lineHeight}px`, this._domNode.style.padding = `${e._PADDING}px`;
		let i = document.createElement("div");
		i.style.display = "flex", i.style.alignItems = "center", i.style.width = i.style.height = `${r.lineHeight * .8}px`, this._domNode.appendChild(i), this._icon = renderIcon(Codicon.sparkle), this._icon.style.display = "none", i.appendChild(this._icon), this._label = document.createElement("div"), applyFontInfo(this._label, r), this._domNode.appendChild(this._label), n.appendChild(this._domNode);
	}
	populate(e) {
		this._updateIcon(e), this._updateLabel(e);
	}
	_updateIcon(e) {
		let n = !!e.tags?.includes(NewSymbolNameTag.AIGenerated);
		this._icon.style.display = n ? "inherit" : "none";
	}
	_updateLabel(e) {
		this._label.innerText = e.newSymbolName;
	}
	static getLayoutInfo({ lineHeight: n }) {
		return { totalHeight: n + e._PADDING * 2 };
	}
	dispose() {}
}, __decorate$23 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$23 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, RenameController_1, RenameSkeleton = class {
	constructor(e, n, r) {
		this.model = e, this.position = n, this._providerRenameIdx = 0, this._providers = r.ordered(e);
	}
	hasProvider() {
		return this._providers.length > 0;
	}
	async resolveRenameLocation(e) {
		let n = [];
		for (this._providerRenameIdx = 0; this._providerRenameIdx < this._providers.length; this._providerRenameIdx++) {
			let r = this._providers[this._providerRenameIdx];
			if (!r.resolveRenameLocation) break;
			let i = await r.resolveRenameLocation(this.model, this.position, e);
			if (i) {
				if (i.rejectReason) {
					n.push(i.rejectReason);
					continue;
				}
				return i;
			}
		}
		this._providerRenameIdx = 0;
		let r = this.model.getWordAtPosition(this.position);
		return r ? {
			range: new Range(this.position.lineNumber, r.startColumn, this.position.lineNumber, r.endColumn),
			text: r.word,
			rejectReason: n.length > 0 ? n.join("\n") : void 0
		} : {
			range: Range.fromPositions(this.position),
			text: "",
			rejectReason: n.length > 0 ? n.join("\n") : void 0
		};
	}
	async provideRenameEdits(e, n) {
		return this._provideRenameEdits(e, this._providerRenameIdx, [], n);
	}
	async _provideRenameEdits(e, n, r, i) {
		let a = this._providers[n];
		if (!a) return {
			edits: [],
			rejectReason: r.join("\n")
		};
		let o = await a.provideRenameEdits(this.model, this.position, e, i);
		if (o) {
			if (o.rejectReason) return this._provideRenameEdits(e, n + 1, r.concat(o.rejectReason), i);
		} else return this._provideRenameEdits(e, n + 1, r.concat(localize("no result", "No result.")), i);
		return o;
	}
};
async function rename(e, n, r, i) {
	let a = new RenameSkeleton(n, r, e), o = await a.resolveRenameLocation(CancellationToken.None);
	return o?.rejectReason ? {
		edits: [],
		rejectReason: o.rejectReason
	} : a.provideRenameEdits(i, 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, n, r, i, a, o, s, c, l) {
		this.editor = e, this._instaService = n, this._notificationService = r, this._bulkEditService = i, this._progressService = a, this._logService = o, this._configService = s, this._languageFeaturesService = c, this._telemetryService = l, 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 n = this.editor.getPosition(), r = new RenameSkeleton(this.editor.getModel(), n, this._languageFeaturesService.renameProvider);
		if (!r.hasProvider()) {
			e("skeleton has no provider");
			return;
		}
		let i = new EditorStateCancellationTokenSource(this.editor, 5, void 0, this._cts.token), a;
		try {
			e("resolving rename location");
			let n = r.resolveRenameLocation(i.token);
			this._progressService.showWhile(n, 250), a = await n, e("resolved rename location");
		} catch (r) {
			r instanceof CancellationError ? e("resolve rename location cancelled", JSON.stringify(r, null, "	")) : (e("resolve rename location failed", r instanceof Error ? r : JSON.stringify(r, null, "	")), (typeof r == "string" || isMarkdownString(r)) && MessageController.get(this.editor)?.showMessage(r || localize("resolveRenameLocationFailed", "An unknown error occurred while resolving rename location"), n));
			return;
		} finally {
			i.dispose();
		}
		if (!a) {
			e("returning early - no loc");
			return;
		}
		if (a.rejectReason) {
			e(`returning early - rejected with reason: ${a.rejectReason}`, a.rejectReason), MessageController.get(this.editor)?.showMessage(a.rejectReason, n);
			return;
		}
		if (i.token.isCancellationRequested) {
			e("returning early - cts1 cancelled");
			return;
		}
		let o = new EditorStateCancellationTokenSource(this.editor, 5, a.range, this._cts.token), s = this.editor.getModel(), c = this._languageFeaturesService.newSymbolNamesProvider.all(s), l = await Promise.all(c.map(async (e) => [e, await e.supportsAutomaticNewSymbolNamesTriggerKind ?? !1])), u = (e, n) => {
			let r = l.slice();
			return e === NewSymbolNameTriggerKind.Automatic && (r = r.filter(([e, n]) => n)), r.map(([r]) => r.provideNewSymbolNames(s, a.range, e, n));
		};
		e("creating rename input field and awaiting its result");
		let d = this._bulkEditService.hasPreviewHandler() && this._configService.getValue(this.editor.getModel().uri, "editor.rename.enablePreview"), f = await this._renameWidget.getInput(a.range, a.text, d, c.length > 0 ? u : void 0, o);
		if (e("received response from rename input field"), c.length > 0 && this._reportTelemetry(c.length, s.getLanguageId(), f), typeof f == "boolean") {
			e(`returning early - rename input field response - ${f}`), f && this.editor.focus(), o.dispose();
			return;
		}
		this.editor.focus(), e("requesting rename edits");
		let m = raceCancellation(r.provideRenameEdits(f.newName, o.token), o.token).then(async (n) => {
			if (!n) {
				e("returning early - no rename edits result");
				return;
			}
			if (!this.editor.hasModel()) {
				e("returning early - no model after rename edits are provided");
				return;
			}
			if (n.rejectReason) {
				e(`returning early - rejected with reason: ${n.rejectReason}`), this._notificationService.info(n.rejectReason);
				return;
			}
			this.editor.setSelection(Range.fromPositions(this.editor.getSelection().getPosition())), e("applying edits"), this._bulkEditService.apply(n, {
				editor: this.editor,
				showPreview: f.wantsPreview,
				label: localize("label", "Renaming '{0}' to '{1}'", a?.text, f.newName),
				code: "undoredo.rename",
				quotableLabel: localize("quotableLabel", "Renaming {0} to {1}", a?.text, f.newName),
				respectAutoSaveConfig: !0
			}).then((n) => {
				e("edits applied"), n.ariaSummary && alert(localize("aria", "Successfully renamed '{0}' to '{1}'. Summary: {2}", a.text, f.newName, n.ariaSummary));
			}).catch((n) => {
				e(`error when applying edits ${JSON.stringify(n, null, "	")}`), this._notificationService.error(localize("rename.failedApply", "Rename failed to apply edits")), this._logService.error(n);
			});
		}, (n) => {
			e("error when providing rename edits", JSON.stringify(n, null, "	")), this._notificationService.error(localize("rename.failed", "Rename failed to compute edits")), this._logService.error(n);
		}).finally(() => {
			o.dispose();
		});
		return e("returning rename operation"), this._progressService.showWhile(m, 250), m;
	}
	acceptRenameInput(e) {
		this._renameWidget.acceptInput(e);
	}
	cancelRenameInput() {
		this._renameWidget.cancelInput(!0, "cancelRenameInput command");
	}
	focusNextRenameSuggestion() {
		this._renameWidget.focusNextRenameSuggestion();
	}
	focusPreviousRenameSuggestion() {
		this._renameWidget.focusPreviousRenameSuggestion();
	}
	_reportTelemetry(e, n, r) {
		let i = typeof r == "boolean" ? {
			kind: "cancelled",
			languageId: n,
			nRenameSuggestionProviders: e
		} : {
			kind: "accepted",
			languageId: n,
			nRenameSuggestionProviders: e,
			source: r.stats.source.k,
			nRenameSuggestions: r.stats.nRenameSuggestions,
			timeBeforeFirstInputFieldEdit: r.stats.timeBeforeFirstInputFieldEdit,
			wantsPreview: r.wantsPreview,
			nRenameSuggestionsInvocations: r.stats.nRenameSuggestionsInvocations,
			hadAutomaticRenameSuggestionsInvocation: r.stats.hadAutomaticRenameSuggestionsInvocation
		};
		this._telemetryService.publicLog2("renameInvokedEvent", i);
	}
};
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, n) {
		let r = e.get(ICodeEditorService), [i, a] = Array.isArray(n) && n || [void 0, void 0];
		return URI.isUri(i) && Position.isIPosition(a) ? r.openCodeEditor({ resource: i }, r.getActiveCodeEditor()).then((e) => {
			e && (e.setPosition(a), e.invokeWithinContext((n) => (this.reportTelemetry(n, e), this.run(n, e))));
		}, onUnexpectedError) : super.runCommand(e, n);
	}
	run(e, n) {
		let r = e.get(ILogService), i = RenameController.get(n);
		return i ? (r.trace("[RenameAction] got controller, running..."), i.run()) : (r.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 n = e.get(ICodeEditorService).getFocusedCodeEditor();
		if (!n) return;
		let r = RenameController.get(n);
		r && r.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 n = e.get(ICodeEditorService).getFocusedCodeEditor();
		if (!n) return;
		let r = RenameController.get(n);
		r && r.focusPreviousRenameSuggestion();
	}
}), registerModelAndPositionCommand("_executeDocumentRenameProvider", function(e, n, r, ...i) {
	let [a] = i;
	assertType(typeof a == "string");
	let { renameProvider: o } = e.get(ILanguageFeaturesService);
	return rename(o, n, r, a);
}), registerModelAndPositionCommand("_executePrepareRename", async function(e, n, r) {
	let { renameProvider: i } = e.get(ILanguageFeaturesService), a = await new RenameSkeleton(n, r, i).resolveRenameLocation(CancellationToken.None);
	if (a?.rejectReason) throw Error(a.rejectReason);
	return a;
}), 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, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$22 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, SectionHeaderDetector = class extends Disposable {
	static {
		this.ID = "editor.sectionHeaderDetector";
	}
	constructor(e, n, r) {
		super(), this.editor = e, this.languageConfigurationService = n, this.editorWorkerService = r, this.decorations = this.editor.createDecorationsCollection(), this.options = this.createOptions(e.getOption(73)), this.computePromise = null, this.currentOccurrences = {}, this._register(e.onDidChangeModel((n) => {
			this.currentOccurrences = {}, this.options = this.createOptions(e.getOption(73)), this.stop(), this.computeSectionHeaders.schedule(0);
		})), this._register(e.onDidChangeModelLanguage((n) => {
			this.currentOccurrences = {}, this.options = this.createOptions(e.getOption(73)), this.stop(), this.computeSectionHeaders.schedule(0);
		})), this._register(n.onDidChange((n) => {
			let r = this.editor.getModel()?.getLanguageId();
			r && n.affects(r) && (this.currentOccurrences = {}, this.options = this.createOptions(e.getOption(73)), this.stop(), this.computeSectionHeaders.schedule(0));
		})), this._register(e.onDidChangeConfiguration((n) => {
			this.options && !n.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 n = this.editor.getModel().getLanguageId();
		if (!n) return;
		let r = this.languageConfigurationService.getLanguageConfiguration(n).comments, i = this.languageConfigurationService.getLanguageConfiguration(n).foldingRules;
		if (!(!r && !i?.markers)) return {
			foldingRules: i,
			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 n = e.getVersionId();
		this.editorWorkerService.findSectionHeaders(e.uri, this.options).then((r) => {
			e.isDisposed() || e.getVersionId() !== n || this.updateDecorations(r);
		});
	}
	updateDecorations(e) {
		let n = this.editor.getModel();
		n && (e = e.filter((e) => {
			if (!e.shouldBeInComments) return !0;
			let r = n.validateRange(e.range), i = n.tokenization.getLineTokens(r.startLineNumber), a = i.findTokenIndexAtOffset(r.startColumn - 1), o = i.getStandardTokenType(a);
			return i.getLanguageId(a) === n.getLanguageId() && o === 1;
		}));
		let r = Object.values(this.currentOccurrences).map((e) => e.decorationId), i = e.map((e) => decoration(e));
		this.editor.changeDecorations((n) => {
			let a = n.deltaDecorations(r, i);
			this.currentOccurrences = {};
			for (let n = 0, r = a.length; n < r; n++) {
				let r = {
					sectionHeader: e[n],
					decorationId: a[n]
				};
				this.currentOccurrences[r.decorationId] = r;
			}
		});
	}
	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 n = 0, r = e.length; n < r; n += 4) {
		let r = e[n + 0], i = e[n + 1], a = e[n + 2], o = e[n + 3];
		e[n + 0] = o, e[n + 1] = a, e[n + 2] = i, e[n + 3] = r;
	}
}
function toLittleEndianBuffer(e) {
	let n = new Uint8Array(e.buffer, e.byteOffset, e.length * 4);
	return isLittleEndian() || reverseEndianness(n), VSBuffer.wrap(n);
}
function encodeSemanticTokensDto(e) {
	let n = new Uint32Array(encodeSemanticTokensDtoSize(e)), r = 0;
	if (n[r++] = e.id, e.type === "full") n[r++] = 1, n[r++] = e.data.length, n.set(e.data, r), r += e.data.length;
	else {
		n[r++] = 2, n[r++] = e.deltas.length;
		for (let i of e.deltas) n[r++] = i.start, n[r++] = i.deleteCount, i.data ? (n[r++] = i.data.length, n.set(i.data, r), r += i.data.length) : n[r++] = 0;
	}
	return toLittleEndianBuffer(n);
}
function encodeSemanticTokensDtoSize(e) {
	let n = 0;
	if (n += 2, e.type === "full") n += 1 + e.data.length;
	else {
		n += 1, n += 3 * e.deltas.length;
		for (let r of e.deltas) r.data && (n += r.data.length);
	}
	return n;
}
function isSemanticTokens(e) {
	return e && !!e.data;
}
function isSemanticTokensEdits(e) {
	return e && Array.isArray(e.edits);
}
var DocumentSemanticTokensResult = class {
	constructor(e, n, r) {
		this.provider = e, this.tokens = n, this.error = r;
	}
};
function hasDocumentSemanticTokensProvider(e, n) {
	return e.has(n);
}
function getDocumentSemanticTokensProviders(e, n) {
	let r = e.orderedGroups(n);
	return r.length > 0 ? r[0] : [];
}
async function getDocumentSemanticTokens(e, n, r, i, a) {
	let o = getDocumentSemanticTokensProviders(e, n), s = await Promise.all(o.map(async (e) => {
		let o, s = null;
		try {
			o = await e.provideDocumentSemanticTokens(n, e === r ? i : null, a);
		} catch (e) {
			s = e, o = null;
		}
		return (!o || !isSemanticTokens(o) && !isSemanticTokensEdits(o)) && (o = null), new DocumentSemanticTokensResult(e, o, s);
	}));
	for (let e of s) {
		if (e.error) throw e.error;
		if (e.tokens) return e;
	}
	return s.length > 0 ? s[0] : null;
}
function _getDocumentSemanticTokensProviderHighestGroup(e, n) {
	let r = e.orderedGroups(n);
	return r.length > 0 ? r[0] : null;
}
var DocumentRangeSemanticTokensResult = class {
	constructor(e, n) {
		this.provider = e, this.tokens = n;
	}
};
function hasDocumentRangeSemanticTokensProvider(e, n) {
	return e.has(n);
}
function getDocumentRangeSemanticTokensProviders(e, n) {
	let r = e.orderedGroups(n);
	return r.length > 0 ? r[0] : [];
}
async function getDocumentRangeSemanticTokens(e, n, r, i) {
	let a = getDocumentRangeSemanticTokensProviders(e, n), o = await Promise.all(a.map(async (e) => {
		let a;
		try {
			a = await e.provideDocumentRangeSemanticTokens(n, r, i);
		} catch (e) {
			onUnexpectedExternalError(e), a = null;
		}
		return (!a || !isSemanticTokens(a)) && (a = null), new DocumentRangeSemanticTokensResult(e, a);
	}));
	for (let e of o) if (e.tokens) return e;
	return o.length > 0 ? o[0] : null;
}
CommandsRegistry.registerCommand("_provideDocumentSemanticTokensLegend", async (e, ...n) => {
	let [r] = n;
	assertType(r instanceof URI);
	let i = e.get(IModelService).getModel(r);
	if (!i) return;
	let { documentSemanticTokensProvider: a } = e.get(ILanguageFeaturesService), o = _getDocumentSemanticTokensProviderHighestGroup(a, i);
	return o ? o[0].getLegend() : e.get(ICommandService).executeCommand("_provideDocumentRangeSemanticTokensLegend", r);
}), CommandsRegistry.registerCommand("_provideDocumentSemanticTokens", async (e, ...n) => {
	let [r] = n;
	assertType(r instanceof URI);
	let i = e.get(IModelService).getModel(r);
	if (!i) return;
	let { documentSemanticTokensProvider: a } = e.get(ILanguageFeaturesService);
	if (!hasDocumentSemanticTokensProvider(a, i)) return e.get(ICommandService).executeCommand("_provideDocumentRangeSemanticTokens", r, i.getFullModelRange());
	let o = await getDocumentSemanticTokens(a, i, null, null, CancellationToken.None);
	if (!o) return;
	let { provider: s, tokens: c } = o;
	if (!c || !isSemanticTokens(c)) return;
	let l = encodeSemanticTokensDto({
		id: 0,
		type: "full",
		data: c.data
	});
	return c.resultId && s.releaseDocumentSemanticTokens(c.resultId), l;
}), CommandsRegistry.registerCommand("_provideDocumentRangeSemanticTokensLegend", async (e, ...n) => {
	let [r, i] = n;
	assertType(r instanceof URI);
	let a = e.get(IModelService).getModel(r);
	if (!a) return;
	let { documentRangeSemanticTokensProvider: o } = e.get(ILanguageFeaturesService), s = getDocumentRangeSemanticTokensProviders(o, a);
	if (s.length === 0) return;
	if (s.length === 1) return s[0].getLegend();
	if (!i || !Range.isIRange(i)) return console.warn("provideDocumentRangeSemanticTokensLegend might be out-of-sync with provideDocumentRangeSemanticTokens unless a range argument is passed in"), s[0].getLegend();
	let c = await getDocumentRangeSemanticTokens(o, a, Range.lift(i), CancellationToken.None);
	if (c) return c.provider.getLegend();
}), CommandsRegistry.registerCommand("_provideDocumentRangeSemanticTokens", async (e, ...n) => {
	let [r, i] = n;
	assertType(r instanceof URI), assertType(Range.isIRange(i));
	let a = e.get(IModelService).getModel(r);
	if (!a) return;
	let { documentRangeSemanticTokensProvider: o } = e.get(ILanguageFeaturesService), s = await getDocumentRangeSemanticTokens(o, a, Range.lift(i), CancellationToken.None);
	if (!(!s || !s.tokens)) return encodeSemanticTokensDto({
		id: 0,
		type: "full",
		data: s.tokens.data
	});
});
function isSemanticColoringEnabled(e, n, r) {
	let i = r.getValue("editor.semanticHighlighting", {
		overrideIdentifier: e.getLanguageId(),
		resource: e.uri
	})?.enabled;
	return typeof i == "boolean" ? i : n.getColorTheme().semanticHighlighting;
}
var __decorate$21 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$21 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, ModelSemanticColoring_1, DocumentSemanticTokensFeature = class extends Disposable {
	constructor(e, n, r, i, a, o) {
		super(), this._watchers = Object.create(null);
		let s = (n) => {
			this._watchers[n.uri.toString()] = new ModelSemanticColoring(n, e, r, a, o);
		}, c = (e, n) => {
			n.dispose(), delete this._watchers[e.uri.toString()];
		}, l = () => {
			for (let e of n.getModels()) {
				let n = this._watchers[e.uri.toString()];
				isSemanticColoringEnabled(e, r, i) ? n || s(e) : n && c(e, n);
			}
		};
		n.getModels().forEach((e) => {
			isSemanticColoringEnabled(e, r, i) && s(e);
		}), this._register(n.onModelAdded((e) => {
			isSemanticColoringEnabled(e, r, i) && s(e);
		})), this._register(n.onModelRemoved((e) => {
			let n = this._watchers[e.uri.toString()];
			n && c(e, n);
		})), this._register(i.onDidChangeConfiguration((e) => {
			e.affectsConfiguration("editor.semanticHighlighting") && l();
		})), this._register(r.onDidColorThemeChange(l));
	}
	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, n, r, i, a) {
		super(), this._semanticTokensStylingService = n, this._isDisposed = !1, this._model = e, this._provider = a.documentSemanticTokensProvider, this._debounceInformation = i.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 o = () => {
			dispose(this._documentProvidersChangeListeners), this._documentProvidersChangeListeners = [];
			for (let n of this._provider.all(e)) typeof n.onDidChange == "function" && this._documentProvidersChangeListeners.push(n.onDidChange(() => {
				if (this._currentDocumentRequestCancellationTokenSource) {
					this._providersChangedDuringRequest = !0;
					return;
				}
				this._fetchDocumentSemanticTokens.schedule(0);
			}));
		};
		o(), this._register(this._provider.onDidChange(() => {
			o(), this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model));
		})), this._register(r.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(), n = this._currentDocumentResponse ? this._currentDocumentResponse.provider : null, r = this._currentDocumentResponse && this._currentDocumentResponse.resultId || null, i = getDocumentSemanticTokens(this._provider, this._model, n, r, e.token);
		this._currentDocumentRequestCancellationTokenSource = e, this._providersChangedDuringRequest = !1;
		let a = [], o = this._model.onDidChangeContent((e) => {
			a.push(e);
		}), s = new StopWatch(!1);
		i.then((e) => {
			if (this._debounceInformation.update(this._model, s.elapsed()), this._currentDocumentRequestCancellationTokenSource = null, o.dispose(), !e) this._setDocumentSemanticTokens(null, null, null, a);
			else {
				let { provider: n, tokens: r } = e, i = this._semanticTokensStylingService.getStyling(n);
				this._setDocumentSemanticTokens(n, r || null, i, a);
			}
		}, (e) => {
			e && (isCancellationError(e) || typeof e.message == "string" && e.message.indexOf("busy") !== -1) || onUnexpectedError(e), this._currentDocumentRequestCancellationTokenSource = null, o.dispose(), (a.length > 0 || this._providersChangedDuringRequest) && (this._fetchDocumentSemanticTokens.isScheduled() || this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model)));
		});
	}
	static _copy(e, n, r, i, a) {
		a = Math.min(a, r.length - i, e.length - n);
		for (let o = 0; o < a; o++) r[i + o] = e[n + o];
	}
	_setDocumentSemanticTokens(e, n, r, i) {
		let a = this._currentDocumentResponse, o = () => {
			(i.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 && n && e.releaseDocumentSemanticTokens(n.resultId);
			return;
		}
		if (!e || !r) {
			this._model.tokenization.setSemanticTokens(null, !1);
			return;
		}
		if (!n) {
			this._model.tokenization.setSemanticTokens(null, !0), o();
			return;
		}
		if (isSemanticTokensEdits(n)) {
			if (!a) {
				this._model.tokenization.setSemanticTokens(null, !0);
				return;
			}
			if (n.edits.length === 0) n = {
				resultId: n.resultId,
				data: a.data
			};
			else {
				let e = 0;
				for (let r of n.edits) e += (r.data ? r.data.length : 0) - r.deleteCount;
				let i = a.data, o = new Uint32Array(i.length + e), s = i.length, c = o.length;
				for (let e = n.edits.length - 1; e >= 0; e--) {
					let l = n.edits[e];
					if (l.start > i.length) {
						r.warnInvalidEditStart(a.resultId, n.resultId, e, l.start, i.length), this._model.tokenization.setSemanticTokens(null, !0);
						return;
					}
					let u = s - (l.start + l.deleteCount);
					u > 0 && (ModelSemanticColoring_1._copy(i, s - u, o, c - u, u), c -= u), l.data && (ModelSemanticColoring_1._copy(l.data, 0, o, c - l.data.length, l.data.length), c -= l.data.length), s = l.start;
				}
				s > 0 && ModelSemanticColoring_1._copy(i, 0, o, 0, s), n = {
					resultId: n.resultId,
					data: o
				};
			}
		}
		if (isSemanticTokens(n)) {
			this._currentDocumentResponse = new SemanticTokensResponse(e, n.resultId, n.data);
			let a = toMultilineTokens2(n, r, this._model.getLanguageId());
			if (i.length > 0) for (let e of i) for (let n of a) for (let r of e.changes) n.applyEdit(r.range, r.text);
			this._model.tokenization.setSemanticTokens(a, !0);
		} else this._model.tokenization.setSemanticTokens(null, !0);
		o();
	}
};
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, n, r) {
		this.provider = e, this.resultId = n, this.data = r;
	}
	dispose() {
		this.provider.releaseDocumentSemanticTokens(this.resultId);
	}
};
registerEditorFeature(DocumentSemanticTokensFeature);
var __decorate$20 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$20 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, ViewportSemanticTokensContribution = class extends Disposable {
	static {
		this.ID = "editor.contrib.viewportSemanticTokens";
	}
	constructor(e, n, r, i, a, o) {
		super(), this._semanticTokensStylingService = n, this._themeService = r, this._configurationService = i, this._editor = e, this._provider = o.documentRangeSemanticTokensProvider, this._debounceInformation = a.for(this._provider, "DocumentRangeSemanticTokens", {
			min: 100,
			max: 500
		}), this._tokenizeViewport = this._register(new RunOnceScheduler(() => this._tokenizeViewportNow(), 100)), this._outstandingRequests = [];
		let s = () => {
			this._editor.hasModel() && this._tokenizeViewport.schedule(this._debounceInformation.get(this._editor.getModel()));
		};
		this._register(this._editor.onDidScrollChange(() => {
			s();
		})), this._register(this._editor.onDidChangeModel(() => {
			this._cancelAll(), s();
		})), this._register(this._editor.onDidChangeModelContent((e) => {
			this._cancelAll(), s();
		})), this._register(this._provider.onDidChange(() => {
			this._cancelAll(), s();
		})), this._register(this._configurationService.onDidChangeConfiguration((e) => {
			e.affectsConfiguration("editor.semanticHighlighting") && (this._cancelAll(), s());
		})), this._register(this._themeService.onDidColorThemeChange(() => {
			this._cancelAll(), s();
		})), s();
	}
	_cancelAll() {
		for (let e of this._outstandingRequests) e.cancel();
		this._outstandingRequests = [];
	}
	_removeOutstandingRequest(e) {
		for (let n = 0, r = this._outstandingRequests.length; n < r; n++) if (this._outstandingRequests[n] === e) {
			this._outstandingRequests.splice(n, 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 n = this._editor.getVisibleRangesPlusViewportAboveBelow();
		this._outstandingRequests = this._outstandingRequests.concat(n.map((n) => this._requestRange(e, n)));
	}
	_requestRange(e, n) {
		let r = e.getVersionId(), i = createCancelablePromise((r) => Promise.resolve(getDocumentRangeSemanticTokens(this._provider, e, n, r))), a = new StopWatch(!1);
		return i.then((i) => {
			if (this._debounceInformation.update(e, a.elapsed()), !i || !i.tokens || e.isDisposed() || e.getVersionId() !== r) return;
			let { provider: o, tokens: s } = i, c = this._semanticTokensStylingService.getStyling(o);
			e.tokenization.setPartialSemanticTokens(n, toMultilineTokens2(s, c, e.getLanguageId()));
		}).then(() => this._removeOutstandingRequest(i), () => this._removeOutstandingRequest(i)), i;
	}
};
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, n) {
		let r = [];
		for (let i of n) {
			let n = [];
			r.push(n), this.selectSubwords && this._addInWordRanges(n, e, i), this._addWordRanges(n, e, i), this._addWhitespaceLine(n, e, i), n.push({ range: e.getFullModelRange() });
		}
		return r;
	}
	_addInWordRanges(e, n, i) {
		let a = n.getWordAtPosition(i);
		if (!a) return;
		let { word: o, startColumn: s } = a, c = i.column - s, l = c, u = c, d = 0;
		for (; l >= 0; l--) {
			let e = o.charCodeAt(l);
			if (l !== c && (e === 95 || e === 45) || isLowerAsciiLetter(e) && isUpperAsciiLetter(d)) break;
			d = e;
		}
		for (l += 1; u < o.length; u++) {
			let e = o.charCodeAt(u);
			if (isUpperAsciiLetter(e) && isLowerAsciiLetter(d) || e === 95 || e === 45) break;
			d = e;
		}
		l < u && e.push({ range: new Range(i.lineNumber, s + l, i.lineNumber, s + u) });
	}
	_addWordRanges(e, n, r) {
		let i = n.getWordAtPosition(r);
		i && e.push({ range: new Range(r.lineNumber, i.startColumn, r.lineNumber, i.endColumn) });
	}
	_addWhitespaceLine(e, n, r) {
		n.getLineLength(r.lineNumber) > 0 && n.getLineFirstNonWhitespaceColumn(r.lineNumber) === 0 && n.getLineLastNonWhitespaceColumn(r.lineNumber) === 0 && e.push({ range: new Range(r.lineNumber, 1, r.lineNumber, n.getLineMaxColumn(r.lineNumber)) });
	}
}, __decorate$19 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$19 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, SmartSelectController_1, SelectionRanges = class e {
	constructor(e, n) {
		this.index = e, this.ranges = n;
	}
	mov(n) {
		let r = this.index + (n ? 1 : -1);
		if (r < 0 || r >= this.ranges.length) return this;
		let i = new e(r, this.ranges);
		return i.ranges[r].equalsRange(this.ranges[this.index]) ? i.mov(n) : i;
	}
}, SmartSelectController = class {
	static {
		SmartSelectController_1 = this;
	}
	static {
		this.ID = "editor.contrib.smartSelectController";
	}
	static get(e) {
		return e.getContribution(SmartSelectController_1.ID);
	}
	constructor(e, n) {
		this._editor = e, this._languageFeaturesService = n, this._ignoreSelection = !1;
	}
	dispose() {
		this._selectionListener?.dispose();
	}
	async run(e) {
		if (!this._editor.hasModel()) return;
		let n = this._editor.getSelections(), r = this._editor.getModel();
		if (this._state || await provideSelectionRanges(this._languageFeaturesService.selectionRangeProvider, r, n.map((e) => e.getPosition()), this._editor.getOption(114), CancellationToken.None).then((e) => {
			if (!(!isNonEmptyArray(e) || e.length !== n.length) && !(!this._editor.hasModel() || !equals(this._editor.getSelections(), n, (e, n) => e.equalsSelection(n)))) {
				for (let r = 0; r < e.length; r++) e[r] = e[r].filter((e) => e.containsPosition(n[r].getStartPosition()) && e.containsPosition(n[r].getEndPosition())), e[r].unshift(n[r]);
				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((n) => n.mov(e));
		let i = this._state.map((e) => Selection.fromPositions(e.ranges[e.index].getStartPosition(), e.ranges[e.index].getEndPosition()));
		this._ignoreSelection = !0;
		try {
			this._editor.setSelections(i);
		} finally {
			this._ignoreSelection = !1;
		}
	}
};
SmartSelectController = SmartSelectController_1 = __decorate$19([__param$19(1, ILanguageFeaturesService)], SmartSelectController);
var AbstractSmartSelect = class extends EditorAction {
	constructor(e, n) {
		super(n), this._forward = e;
	}
	async run(e, n) {
		let r = SmartSelectController.get(n);
		r && await r.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, n, r, i, a) {
	let o = e.all(n).concat(new WordSelectionRangeProvider(i.selectSubwords));
	o.length === 1 && o.unshift(new BracketSelectionRangeProvider());
	let s = [], c = [];
	for (let e of o) s.push(Promise.resolve(e.provideSelectionRanges(n, r, a)).then((e) => {
		if (isNonEmptyArray(e) && e.length === r.length) for (let n = 0; n < r.length; n++) {
			c[n] || (c[n] = []);
			for (let i of e[n]) Range.isIRange(i.range) && Range.containsPosition(i.range, r[n]) && c[n].push(Range.lift(i.range));
		}
	}, onUnexpectedExternalError));
	return await Promise.all(s), c.map((e) => {
		if (e.length === 0) return [];
		e.sort((e, n) => Position.isBefore(e.getStartPosition(), n.getStartPosition()) ? 1 : Position.isBefore(n.getStartPosition(), e.getStartPosition()) || Position.isBefore(e.getEndPosition(), n.getEndPosition()) ? -1 : Position.isBefore(n.getEndPosition(), e.getEndPosition()) ? 1 : 0);
		let r = [], a;
		for (let n of e) (!a || Range.containsRange(n, a) && !Range.equalsRange(n, a)) && (r.push(n), a = n);
		if (!i.selectLeadingAndTrailingWhitespace) return r;
		let o = [r[0]];
		for (let e = 1; e < r.length; e++) {
			let i = r[e - 1], a = r[e];
			if (a.startLineNumber !== i.startLineNumber || a.endLineNumber !== i.endLineNumber) {
				let e = new Range(i.startLineNumber, n.getLineFirstNonWhitespaceColumn(i.startLineNumber), i.endLineNumber, n.getLineLastNonWhitespaceColumn(i.endLineNumber));
				e.containsRange(i) && !e.equalsRange(i) && a.containsRange(e) && !a.equalsRange(e) && o.push(e);
				let r = new Range(i.startLineNumber, 1, i.endLineNumber, n.getLineMaxColumn(i.endLineNumber));
				r.containsRange(i) && !r.equalsRange(e) && a.containsRange(r) && !a.equalsRange(r) && o.push(r);
			}
			o.push(a);
		}
		return o;
	});
}
CommandsRegistry.registerCommand("_executeSelectionRangeProvider", async function(e, ...n) {
	let [r, i] = n;
	assertType(URI.isUri(r));
	let a = e.get(ILanguageFeaturesService).selectionRangeProvider, o = await e.get(ITextModelService).createModelReference(r);
	try {
		return provideSelectionRanges(a, o.object.textEditorModel, i, {
			selectLeadingAndTrailingWhitespace: !0,
			selectSubwords: !0
		}, CancellationToken.None);
	} finally {
		o.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, n, r, i = null) {
		this.startLineNumbers = e, this.endLineNumbers = n, this.lastLineRelativePosition = r, this.showEndForLine = i;
	}
	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 n = () => {
			this._linesDomNode.style.left = this._editor.getOption(116).scrollWithEditor ? `-${this._editor.getScrollLeft()}px` : "0px";
		};
		this._register(this._editor.onDidChangeConfiguration((e) => {
			e.hasChanged(116) && n(), e.hasChanged(67) && (this._lineHeight = this._editor.getOption(67));
		})), this._register(this._editor.onDidScrollChange((e) => {
			e.scrollLeftChanged && n(), e.scrollWidthChanged && this._updateWidgetWidth();
		})), this._register(this._editor.onDidChangeModel(() => {
			n(), this._updateWidgetWidth();
		})), this._register(this._foldingIconStore), n(), 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((n) => n.lineNumber === e);
	}
	getCurrentLines() {
		return this._lineNumbers;
	}
	setState(e, n, r) {
		if (r === void 0 && (!this._previousState && !e || this._previousState && this._previousState.equals(e))) return;
		let i = this._isWidgetHeightZero(e), a = i ? void 0 : e, o = i ? 0 : this._findLineToRebuildWidgetFrom(e, r);
		this._renderRootNode(a, n, o), this._previousState = e;
	}
	_isWidgetHeightZero(e) {
		if (!e) return !0;
		let n = e.startLineNumbers.length * this._lineHeight + e.lastLineRelativePosition;
		if (n > 0) {
			this._lastLineRelativePosition = e.lastLineRelativePosition;
			let n = [...e.startLineNumbers];
			e.showEndForLine !== null && (n[e.showEndForLine] = e.endLineNumbers[e.showEndForLine]), this._lineNumbers = n;
		} else this._lastLineRelativePosition = 0, this._lineNumbers = [];
		return n === 0;
	}
	_findLineToRebuildWidgetFrom(e, n) {
		if (!e || !this._previousState) return 0;
		if (n !== void 0) return n;
		let r = this._previousState, i = e.startLineNumbers.findIndex((e) => !r.startLineNumbers.includes(e));
		return i === -1 ? 0 : i;
	}
	_updateWidgetWidth() {
		let e = this._editor.getLayoutInfo(), n = e.contentLeft;
		this._lineNumbersDomNode.style.width = `${n}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 n = e; n < this._renderedStickyLines.length; n++) {
			let e = this._renderedStickyLines[n];
			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 n of this._renderedStickyLines) {
			let r = n.foldingIcon;
			r && r.setVisible(e ? !0 : r.isCollapsed);
		}
	}
	async _renderRootNode(e, n, r) {
		if (this._clearStickyLinesFromLine(r), !e) return;
		for (let e of this._renderedStickyLines) this._updateTopAndZIndexOfStickyLine(e);
		let i = this._editor.getLayoutInfo(), a = this._lineNumbers.slice(r);
		for (let [e, o] of a.entries()) {
			let a = this._renderChildNode(e + r, o, n, i);
			a && (this._linesDomNode.appendChild(a.lineDomNode), this._lineNumbersDomNode.appendChild(a.lineNumberDomNode), this._renderedStickyLines.push(a));
		}
		n && (this._setFoldingHoverListeners(), this._useFoldingOpacityTransition(!this._isOnGlyphMargin));
		let o = this._lineNumbers.length * this._lineHeight + this._lastLineRelativePosition;
		this._rootDomNode.style.display = "block", this._lineNumbersDomNode.style.height = `${o}px`, this._linesDomNodeScrollable.style.height = `${o}px`, this._rootDomNode.style.height = `${o}px`, this._rootDomNode.style.marginLeft = "0px", this._minContentWidthInPx = Math.max(...this._renderedStickyLines.map((e) => e.scrollWidth)) + i.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, n, r, i) {
		let a = this._editor._getViewModel();
		if (!a) return;
		let o = a.coordinatesConverter.convertModelPositionToViewPosition(new Position(n, 1)).lineNumber, s = a.getViewLineRenderingData(o), c = this._editor.getOption(68), l;
		try {
			l = LineDecoration.filter(s.inlineDecorations, o, s.minColumn, s.maxColumn);
		} catch {
			l = [];
		}
		let u = new RenderLineInput(!0, !0, s.content, s.continuesWithWrappedLine, s.isBasicASCII, s.containsRTL, 0, s.tokens, l, s.tabSize, s.startVisibleColumn, 1, 1, 1, 500, "none", !0, !0, null), d = new StringBuilder(2e3), f = renderViewLine(u, d), m;
		m = _ttPolicy ? _ttPolicy.createHTML(d.build()) : d.build();
		let g = document.createElement("span");
		g.setAttribute(STICKY_INDEX_ATTR, String(e)), g.setAttribute(STICKY_IS_LINE_ATTR, ""), g.setAttribute("role", "listitem"), g.tabIndex = 0, g.className = "sticky-line-content", g.classList.add(`stickyLine${n}`), g.style.lineHeight = `${this._lineHeight}px`, g.innerHTML = m;
		let _ = document.createElement("span");
		_.setAttribute(STICKY_INDEX_ATTR, String(e)), _.setAttribute(STICKY_IS_LINE_NUMBER_ATTR, ""), _.className = "sticky-line-number", _.style.lineHeight = `${this._lineHeight}px`;
		let v = i.contentLeft;
		_.style.width = `${v}px`;
		let y = document.createElement("span");
		c.renderType === 1 || c.renderType === 3 && n % 10 == 0 ? y.innerText = n.toString() : c.renderType === 2 && (y.innerText = Math.abs(n - this._editor.getPosition().lineNumber).toString()), y.className = "sticky-line-number-inner", y.style.lineHeight = `${this._lineHeight}px`, y.style.width = `${i.lineNumbersWidth}px`, y.style.paddingLeft = `${i.lineNumbersLeft}px`, _.appendChild(y);
		let b = this._renderFoldingIconForLine(r, n);
		b && _.appendChild(b.domNode), this._editor.applyFontInfo(g), this._editor.applyFontInfo(y), _.style.lineHeight = `${this._lineHeight}px`, g.style.lineHeight = `${this._lineHeight}px`, _.style.height = `${this._lineHeight}px`, g.style.height = `${this._lineHeight}px`;
		let x = new RenderedStickyLine(e, n, g, _, b, f.characterMapping, g.scrollWidth);
		return this._updateTopAndZIndexOfStickyLine(x);
	}
	_updateTopAndZIndexOfStickyLine(e) {
		let n = e.index, r = e.lineDomNode, i = e.lineNumberDomNode, a = n === this._lineNumbers.length - 1;
		r.style.zIndex = a ? "0" : "1", i.style.zIndex = a ? "0" : "1";
		let o = `${n * this._lineHeight + this._lastLineRelativePosition + (e.foldingIcon?.isCollapsed ? 1 : 0)}px`, s = `${n * this._lineHeight}px`;
		return r.style.top = a ? o : s, i.style.top = a ? o : s, e;
	}
	_renderFoldingIconForLine(e, n) {
		let r = this._editor.getOption(111);
		if (!e || r === "never") return;
		let i = e.regions, a = i.findRange(n), o = i.getStartLineNumber(a);
		if (n !== o) return;
		let s = i.isCollapsed(a), c = new StickyFoldingIcon(s, o, i.getEndLineNumber(a), this._lineHeight);
		return c.setVisible(this._isOnGlyphMargin ? !0 : s || r === "always"), c.domNode.setAttribute(STICKY_IS_FOLDING_ICON_ATTR, ""), c;
	}
	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 n = this._getRenderedStickyLineFromChildDomNode(e);
		if (!n) return null;
		let r = getColumnOfNodeOffset(n.characterMapping, e, 0);
		return new Position(n.lineNumber, r);
	}
	getLineNumberFromChildDomNode(e) {
		return this._getRenderedStickyLineFromChildDomNode(e)?.lineNumber ?? null;
	}
	_getRenderedStickyLineFromChildDomNode(e) {
		let n = this.getLineIndexFromChildDomNode(e);
		return n === null || n < 0 || n >= this._renderedStickyLines.length ? null : this._renderedStickyLines[n];
	}
	getLineIndexFromChildDomNode(e) {
		let n = this._getAttributeValue(e, STICKY_INDEX_ATTR);
		return n ? parseInt(n, 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, n) {
		for (; e && e !== this._rootDomNode;) {
			let r = e.getAttribute(n);
			if (r !== null) return r;
			e = e.parentElement;
		}
	}
}, RenderedStickyLine = class {
	constructor(e, n, r, i, a, o, s) {
		this.index = e, this.lineNumber = n, this.lineDomNode = r, this.lineNumberDomNode = i, this.foldingIcon = a, this.characterMapping = o, this.scrollWidth = s;
	}
}, StickyFoldingIcon = class {
	constructor(e, n, r, i) {
		this.isCollapsed = e, this.foldingStartLine = n, this.foldingEndLine = r, this.dimension = i, this.domNode = document.createElement("div"), this.domNode.style.width = `${i}px`, this.domNode.style.height = `${i}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, n) {
		this.startLineNumber = e, this.endLineNumber = n;
	}
}, StickyElement = class {
	constructor(e, n, r) {
		this.range = e, this.children = n, this.parent = r;
	}
}, StickyModel = class {
	constructor(e, n, r, i) {
		this.uri = e, this.version = n, this.element = r, this.outlineProviderId = i;
	}
}, __decorate$18 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$18 = function(e, n) {
	return function(r, i) {
		n(r, i, 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, n, r, i) {
		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, i));
			case ModelProvider.FOLDING_PROVIDER_MODEL: this._modelProviders.push(new StickyModelFromCandidateSyntaxFoldingProvider(this._editor, n, i));
			case ModelProvider.INDENTATION_MODEL:
				this._modelProviders.push(new StickyModelFromCandidateIndentationFoldingProvider(this._editor, r));
				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 n of this._modelProviders) {
				let { statusPromise: r, modelPromise: i } = n.computeStickyModel(e);
				this._modelPromise = i;
				let a = await r;
				if (this._modelPromise !== i) return null;
				switch (a) {
					case Status.CANCELED: return this._updateOperation.clear(), null;
					case Status.VALID: return n.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 n = createCancelablePromise((e) => this.createModelFromProvider(e));
		return {
			statusPromise: n.then((n) => this.isModelValid(n) ? e.isCancellationRequested ? Status.CANCELED : (this._stickyModel = this.createStickyModel(e, n), Status.VALID) : this._invalid()).then(void 0, (e) => (onUnexpectedError(e), Status.CANCELED)),
			modelPromise: n
		};
	}
	isModelValid(e) {
		return !0;
	}
	isProviderValid() {
		return !0;
	}
}, StickyModelFromCandidateOutlineProvider = class extends StickyModelCandidateProvider {
	constructor(e, n) {
		super(e), this._languageFeaturesService = n;
	}
	createModelFromProvider(e) {
		return OutlineModel.create(this._languageFeaturesService.documentSymbolProvider, this._editor.getModel(), e);
	}
	createStickyModel(e, n) {
		let { stickyOutlineElement: r, providerID: i } = this._stickyModelFromOutlineModel(n, this._stickyModel?.outlineProviderId), a = this._editor.getModel();
		return new StickyModel(a.uri, a.getVersionId(), r, i);
	}
	isModelValid(e) {
		return e && e.children.size > 0;
	}
	_stickyModelFromOutlineModel(e, n) {
		let r;
		if (Iterable.first(e.children.values()) instanceof OutlineGroup) {
			let i = Iterable.find(e.children.values(), (e) => e.id === n);
			if (i) r = i.children;
			else {
				let i = "", a = -1, o;
				for (let [n, r] of e.children.entries()) {
					let e = this._findSumOfRangesOfGroup(r);
					e > a && (o = r, a = e, i = r.id);
				}
				n = i, r = o.children;
			}
		} else r = e.children;
		let i = [], a = Array.from(r.values()).sort((e, n) => {
			let r = new StickyRange(e.symbol.range.startLineNumber, e.symbol.range.endLineNumber), i = new StickyRange(n.symbol.range.startLineNumber, n.symbol.range.endLineNumber);
			return this._comparator(r, i);
		});
		for (let e of a) i.push(this._stickyModelFromOutlineElement(e, e.symbol.selectionRange.startLineNumber));
		return {
			stickyOutlineElement: new StickyElement(void 0, i, void 0),
			providerID: n
		};
	}
	_stickyModelFromOutlineElement(e, n) {
		let r = [];
		for (let i of e.children.values()) if (i.symbol.selectionRange.startLineNumber !== i.symbol.range.endLineNumber) if (i.symbol.selectionRange.startLineNumber !== n) r.push(this._stickyModelFromOutlineElement(i, i.symbol.selectionRange.startLineNumber));
		else for (let e of i.children.values()) r.push(this._stickyModelFromOutlineElement(e, i.symbol.selectionRange.startLineNumber));
		r.sort((e, n) => this._comparator(e.range, n.range));
		let i = new StickyRange(e.symbol.selectionRange.startLineNumber, e.symbol.range.endLineNumber);
		return new StickyElement(i, r, void 0);
	}
	_comparator(e, n) {
		return e.startLineNumber === n.startLineNumber ? n.endLineNumber - e.endLineNumber : e.startLineNumber - n.startLineNumber;
	}
	_findSumOfRangesOfGroup(e) {
		let n = 0;
		for (let r of e.children.values()) n += this._findSumOfRangesOfGroup(r);
		return e instanceof OutlineElement ? n + e.symbol.range.endLineNumber - e.symbol.selectionRange.startLineNumber : n;
	}
};
StickyModelFromCandidateOutlineProvider = __decorate$18([__param$18(1, ILanguageFeaturesService)], StickyModelFromCandidateOutlineProvider);
var StickyModelFromCandidateFoldingProvider = class extends StickyModelCandidateProvider {
	constructor(e) {
		super(e), this._foldingLimitReporter = new RangesLimitReporter(e);
	}
	createStickyModel(e, n) {
		let r = this._fromFoldingRegions(n), i = this._editor.getModel();
		return new StickyModel(i.uri, i.getVersionId(), r, void 0);
	}
	isModelValid(e) {
		return e !== null;
	}
	_fromFoldingRegions(e) {
		let n = e.length, r = [], i = new StickyElement(void 0, [], void 0);
		for (let a = 0; a < n; a++) {
			let n = e.getParentIndex(a), o;
			o = n === -1 ? i : r[n];
			let s = new StickyElement(new StickyRange(e.getStartLineNumber(a), e.getEndLineNumber(a) + 1), [], o);
			o.children.push(s), r.push(s);
		}
		return i;
	}
}, StickyModelFromCandidateIndentationFoldingProvider = class extends StickyModelFromCandidateFoldingProvider {
	constructor(e, n) {
		super(e), this._languageConfigurationService = n, 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, n, r) {
		super(e), this._languageFeaturesService = r;
		let i = FoldingController.getFoldingRangeProviders(this._languageFeaturesService, e.getModel());
		i.length > 0 && (this.provider = this._register(new SyntaxRangeProvider(e.getModel(), i, n, 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, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$17 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, StickyLineCandidate = class {
	constructor(e, n, r) {
		this.startLineNumber = e, this.endLineNumber = n, this.nestingDepth = r;
	}
}, StickyLineCandidateProvider = class extends Disposable {
	constructor(e, n, r) {
		super(), this._languageFeaturesService = n, this._languageConfigurationService = r, 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 n = await this._stickyModelProvider.update(e);
		e.isCancellationRequested || (this._model = n);
	}
	updateIndex(e) {
		return e === -1 ? e = 0 : e < 0 && (e = -e - 2), e;
	}
	getCandidateStickyLinesIntersectingFromStickyModel(e, n, r, i, a) {
		if (n.children.length === 0) return;
		let o = a, s = [];
		for (let e = 0; e < n.children.length; e++) {
			let r = n.children[e];
			r.range && s.push(r.range.startLineNumber);
		}
		let c = this.updateIndex(binarySearch(s, e.startLineNumber, (e, n) => e - n)), l = this.updateIndex(binarySearch(s, e.startLineNumber + i, (e, n) => e - n));
		for (let s = c; s <= l; s++) {
			let c = n.children[s];
			if (!c) return;
			if (c.range) {
				let n = c.range.startLineNumber, a = c.range.endLineNumber;
				e.startLineNumber <= a + 1 && n - 1 <= e.endLineNumber && n !== o && (o = n, r.push(new StickyLineCandidate(n, a - 1, i + 1)), this.getCandidateStickyLinesIntersectingFromStickyModel(e, c, r, i + 1, n));
			} else this.getCandidateStickyLinesIntersectingFromStickyModel(e, c, r, i, a);
		}
	}
	getCandidateStickyLinesIntersecting(e) {
		if (!this._model?.element) return [];
		let n = [];
		this.getCandidateStickyLinesIntersectingFromStickyModel(e, this._model.element, n, 0, -1);
		let r = this._editor._getViewModel()?.getHiddenAreas();
		if (r) for (let e of r) n = n.filter((n) => !(n.startLineNumber >= e.startLineNumber && n.endLineNumber <= e.endLineNumber + 1));
		return n;
	}
};
StickyLineCandidateProvider = __decorate$17([__param$17(1, ILanguageFeaturesService), __param$17(2, ILanguageConfigurationService)], StickyLineCandidateProvider);
var __decorate$16 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$16 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, StickyScrollController_1, StickyScrollController = class extends Disposable {
	static {
		StickyScrollController_1 = this;
	}
	static {
		this.ID = "store.contrib.stickyScrollController";
	}
	constructor(e, n, r, i, a, o, s) {
		super(), this._editor = e, this._contextMenuService = n, this._languageFeaturesService = r, this._instaService = i, this._contextKeyService = s, 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, r, a), this._register(this._stickyScrollWidget), this._register(this._stickyLineCandidateProvider), this._widgetState = StickyScrollWidgetState.Empty, this._onDidResize(), this._readConfiguration();
		let c = this._stickyScrollWidget.getDomNode();
		this._register(this._editor.onDidChangeConfiguration((e) => {
			this._readConfigurationChange(e);
		})), this._register(addDisposableListener(c, EventType$1.CONTEXT_MENU, async (e) => {
			this._onContextMenu(getWindow(c), e);
		})), this._stickyScrollFocusedContextKey = EditorContextKeys.stickyScrollFocused.bindTo(this._contextKeyService), this._stickyScrollVisibleContextKey = EditorContextKeys.stickyScrollVisible.bindTo(this._contextKeyService);
		let l = this._register(trackFocus(c));
		this._register(l.onDidBlur((e) => {
			this._positionRevealed === !1 && c.clientHeight === 0 ? (this._focusedStickyElementIndex = -1, this.focus()) : this._disposeFocusStickyScrollStore();
		})), this._register(l.onDidFocus((e) => {
			this.focus();
		})), this._registerMouseListeners(), this._register(addDisposableListener(c, 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, n) {
		this._focused && this._disposeFocusStickyScrollStore(), this._positionRevealed = !0, n(), this._editor.setSelection(Range.fromPositions(e)), this._editor.focus();
	}
	_registerMouseListeners() {
		let e = this._register(new DisposableStore()), n = this._register(new ClickLinkGesture(this._editor, { extractLineNumberFromMouseEvent: (e) => {
			let n = this._stickyScrollWidget.getEditorPositionFromNode(e.target.element);
			return n ? n.lineNumber : 0;
		} })), r = (e) => {
			if (!this._editor.hasModel() || e.target.type !== 12 || e.target.detail !== this._stickyScrollWidget.getId()) return null;
			let n = e.target.element;
			if (!n || n.innerText !== n.innerHTML) return null;
			let r = this._stickyScrollWidget.getEditorPositionFromNode(n);
			return r ? {
				range: new Range(r.lineNumber, r.column, r.lineNumber, r.column + n.innerText.length),
				textElement: n
			} : null;
		}, i = this._stickyScrollWidget.getDomNode();
		this._register(addStandardDisposableListener(i, EventType$1.CLICK, (e) => {
			if (e.ctrlKey || e.altKey || e.metaKey || !e.leftButton) return;
			if (e.shiftKey) {
				let n = this._stickyScrollWidget.getLineIndexFromChildDomNode(e.target);
				if (n === null) return;
				let r = new Position(this._endLineNumbers[n], 1);
				this._revealLineInCenterIfOutsideViewport(r);
				return;
			}
			if (this._stickyScrollWidget.isInFoldingIconDomNode(e.target)) {
				let n = this._stickyScrollWidget.getLineNumberFromChildDomNode(e.target);
				this._toggleFoldingRegionForLine(n);
				return;
			}
			if (!this._stickyScrollWidget.isInStickyLine(e.target)) return;
			let n = this._stickyScrollWidget.getEditorPositionFromNode(e.target);
			if (!n) {
				let r = this._stickyScrollWidget.getLineNumberFromChildDomNode(e.target);
				if (r === null) return;
				n = new Position(r, 1);
			}
			this._revealPosition(n);
		})), this._register(addStandardDisposableListener(i, EventType$1.MOUSE_MOVE, (e) => {
			if (e.shiftKey) {
				let n = this._stickyScrollWidget.getLineIndexFromChildDomNode(e.target);
				if (n === null || this._showEndForLine !== null && this._showEndForLine === n) return;
				this._showEndForLine = n, this._renderStickyScroll();
				return;
			}
			this._showEndForLine !== void 0 && (this._showEndForLine = void 0, this._renderStickyScroll());
		})), this._register(addDisposableListener(i, EventType$1.MOUSE_LEAVE, (e) => {
			this._showEndForLine !== void 0 && (this._showEndForLine = void 0, this._renderStickyScroll());
		})), this._register(n.onMouseMoveOrRelevantKeyDown(([n, i]) => {
			let a = r(n);
			if (!a || !n.hasTriggerModifier || !this._editor.hasModel()) {
				e.clear();
				return;
			}
			let { range: o, textElement: s } = a;
			if (!o.equalsRange(this._stickyRangeProjectedOnEditor)) this._stickyRangeProjectedOnEditor = o, e.clear();
			else if (s.style.textDecoration === "underline") return;
			let c = new CancellationTokenSource();
			e.add(toDisposable(() => c.dispose(!0)));
			let l;
			getDefinitionsAtPosition(this._languageFeaturesService.definitionProvider, this._editor.getModel(), new Position(o.startLineNumber, o.startColumn + 1), !1, c.token).then(((n) => {
				if (!c.token.isCancellationRequested) if (n.length !== 0) {
					this._candidateDefinitionsLength = n.length;
					let r = s;
					l === r ? l || (l = r, l.style.textDecoration = "underline", e.add(toDisposable(() => {
						l.style.textDecoration = "none";
					}))) : (e.clear(), l = r, l.style.textDecoration = "underline", e.add(toDisposable(() => {
						l.style.textDecoration = "none";
					})));
				} else e.clear();
			}));
		})), this._register(n.onCancel(() => {
			e.clear();
		})), this._register(n.onExecute(async (e) => {
			if (e.target.type !== 12 || e.target.detail !== this._stickyScrollWidget.getId()) return;
			let n = this._stickyScrollWidget.getEditorPositionFromNode(e.target.element);
			n && (!this._editor.hasModel() || !this._stickyRangeProjectedOnEditor || (this._candidateDefinitionsLength > 1 && (this._focused && this._disposeFocusStickyScrollStore(), this._revealPosition({
				lineNumber: n.lineNumber,
				column: 1
			})), this._instaService.invokeFunction(goToDefinitionWithLocation, e, this._editor, {
				uri: this._editor.getModel().uri,
				range: this._stickyRangeProjectedOnEditor
			})));
		}));
	}
	_onContextMenu(e, n) {
		let r = new StandardMouseEvent(e, n);
		this._contextMenuService.showContextMenu({
			menuId: MenuId.StickyScrollContext,
			getAnchor: () => r
		});
	}
	_toggleFoldingRegionForLine(e) {
		if (!this._foldingModel || e === null) return;
		let n = this._stickyScrollWidget.getRenderedStickyLine(e), r = n?.foldingIcon;
		if (!r) return;
		toggleCollapseState(this._foldingModel, Number.MAX_VALUE, [e]), r.isCollapsed = !r.isCollapsed;
		let i = (r.isCollapsed ? this._editor.getTopForLineNumber(r.foldingEndLine) : this._editor.getTopForLineNumber(r.foldingStartLine)) - this._editor.getOption(67) * n.index + 1;
		this._editor.setScrollTop(i), 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 n = this._stickyScrollWidget.getCurrentLines();
		for (let r of n) for (let n of e.ranges) if (r >= n.fromLineNumber && r <= n.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 n = this._editor.getModel();
		if (!n || n.isTooLargeForTokenization()) {
			this._resetState();
			return;
		}
		let r = this._updateAndGetMinRebuildFromLine(e), i = this._stickyLineCandidateProvider.getVersionId();
		if (i === void 0 || i === n.getVersionId()) if (!this._focused) await this._updateState(r);
		else if (this._focusedStickyElementIndex === -1) await this._updateState(r), 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(r), 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 n = this._minRebuildFromLine === void 0 ? Infinity : this._minRebuildFromLine;
			this._minRebuildFromLine = Math.min(e, n);
		}
		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 n = this._widgetState.startLineNumbers.length > 0;
		this._stickyScrollVisibleContextKey.set(n), 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), n = Math.min(this._maxStickyLines, this._editor.getOption(116).maxLineCount), r = this._editor.getScrollTop(), i = 0, a = [], o = [], s = this._editor.getVisibleRanges();
		if (s.length !== 0) {
			let c = new StickyRange(s[0].startLineNumber, s[s.length - 1].endLineNumber), l = this._stickyLineCandidateProvider.getCandidateStickyLinesIntersecting(c);
			for (let s of l) {
				let c = s.startLineNumber, l = s.endLineNumber, u = s.nestingDepth;
				if (l - c > 0) {
					let s = (u - 1) * e, d = u * e, f = this._editor.getBottomForLineNumber(c) - r, m = this._editor.getTopForLineNumber(l) - r, g = this._editor.getBottomForLineNumber(l) - r;
					if (s > m && s <= g) {
						a.push(c), o.push(l + 1), i = g - d;
						break;
					} else d > f && d <= g && (a.push(c), o.push(l + 1));
					if (a.length === n) break;
				}
			}
		}
		return this._endLineNumbers = o, new StickyScrollWidgetState(a, o, i, 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 n = e.get(IConfigurationService), r = !n.getValue("editor.stickyScroll.enabled");
		return n.updateValue("editor.stickyScroll.enabled", r);
	}
}, 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, n) {
		StickyScrollController.get(n)?.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, n) {
		StickyScrollController.get(n)?.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, n) {
		StickyScrollController.get(n)?.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, n) {
		StickyScrollController.get(n)?.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, n) {
		StickyScrollController.get(n)?.selectEditor();
	}
};
registerEditorContribution(StickyScrollController.ID, StickyScrollController, 1), registerAction2(ToggleStickyScroll), registerAction2(FocusStickyScroll), registerAction2(SelectPreviousStickyScrollLine), registerAction2(SelectNextStickyScrollLine), registerAction2(GoToStickyScrollLine), registerAction2(SelectEditor);
var __decorate$15 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$15 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, SuggestInlineCompletion = class {
	constructor(e, n, r, i, a, o) {
		this.range = e, this.insertText = n, this.filterText = r, this.additionalTextEdits = i, this.command = a, this.completion = o;
	}
}, InlineCompletionResults = class extends RefCountedDisposable {
	constructor(e, n, r, i, a, o) {
		super(a.disposable), this.model = e, this.line = n, this.word = r, this.completionModel = i, this._suggestMemoryService = o;
	}
	canBeReused(e, n, r) {
		return this.model === e && this.line === n && this.word.word.length > 0 && this.word.startColumn === r.startColumn && this.word.endColumn < r.endColumn && this.completionModel.getIncompleteProvider().size === 0;
	}
	get items() {
		let e = [], { items: n } = this.completionModel, r = this._suggestMemoryService.select(this.model, {
			lineNumber: this.line,
			column: this.word.endColumn + this.completionModel.lineContext.characterCountDelta
		}, n), i = Iterable.slice(n, r), a = Iterable.slice(n, 0, r), o = 5;
		for (let n of Iterable.concat(i, a)) {
			if (n.score === FuzzyScore.Default) continue;
			let r = new Range(n.editStart.lineNumber, n.editStart.column, n.editInsertEnd.lineNumber, n.editInsertEnd.column + this.completionModel.lineContext.characterCountDelta), i = n.completion.insertTextRules && n.completion.insertTextRules & 4 ? { snippet: n.completion.insertText } : n.completion.insertText;
			e.push(new SuggestInlineCompletion(r, i, n.filterTextLow ?? n.labelLow, n.completion.additionalTextEdits, n.completion.command, n)), o-- >= 0 && n.resolve(CancellationToken.None);
		}
		return e;
	}
};
InlineCompletionResults = __decorate$15([__param$15(5, ISuggestMemoryService)], InlineCompletionResults);
var SuggestInlineCompletions = class extends Disposable {
	constructor(e, n, r, i) {
		super(), this._languageFeatureService = e, this._clipboardService = n, this._suggestMemoryService = r, this._editorService = i, this._store.add(e.inlineCompletionsProvider.register("*", this));
	}
	async provideInlineCompletions(e, n, r, i) {
		if (r.selectedSuggestionInfo) return;
		let a;
		for (let n of this._editorService.listCodeEditors()) if (n.getModel() === e) {
			a = n;
			break;
		}
		if (!a) return;
		let o = a.getOption(90);
		if (QuickSuggestionsOptions.isAllOff(o)) return;
		e.tokenization.tokenizeIfCheap(n.lineNumber);
		let s = e.tokenization.getLineTokens(n.lineNumber), c = s.getStandardTokenType(s.findTokenIndexAtOffset(Math.max(n.column - 1 - 1, 0)));
		if (QuickSuggestionsOptions.valueFor(o, c) !== "inline") return;
		let l = e.getWordAtPosition(n), u;
		if (l?.word || (u = this._getTriggerCharacterInfo(e, n)), !l?.word && !u || (l ||= e.getWordUntilPosition(n), l.endColumn !== n.column)) return;
		let d, f = e.getValueInRange(new Range(n.lineNumber, 1, n.lineNumber, n.column));
		if (!u && this._lastResult?.canBeReused(e, n.lineNumber, l)) {
			let e = new LineContext(f, n.column - this._lastResult.word.endColumn);
			this._lastResult.completionModel.lineContext = e, this._lastResult.acquire(), d = this._lastResult;
		} else {
			let r = await provideSuggestionItems(this._languageFeatureService.completionProvider, e, n, new CompletionOptions(void 0, SuggestModel.createSuggestFilter(a).itemKind, u?.providers), u && {
				triggerKind: 1,
				triggerCharacter: u.ch
			}, i), o;
			r.needsClipboard && (o = await this._clipboardService.readText());
			let s = new CompletionModel(r.items, n.column, new LineContext(f, 0), WordDistance.None, a.getOption(119), a.getOption(113), {
				boostFullMatch: !1,
				firstMatchCanBeWeak: !1
			}, o);
			d = new InlineCompletionResults(e, n.lineNumber, l, s, r, this._suggestMemoryService);
		}
		return this._lastResult = d, d;
	}
	handleItemDidShow(e, n) {
		n.completion.resolve(CancellationToken.None);
	}
	freeInlineCompletions(e) {
		e.release();
	}
	_getTriggerCharacterInfo(e, n) {
		let r = e.getValueInRange(Range.fromPositions({
			lineNumber: n.lineNumber,
			column: n.column - 1
		}, n)), i = /* @__PURE__ */ new Set();
		for (let n of this._languageFeatureService.completionProvider.all(e)) n.triggerCharacters?.includes(r) && i.add(n);
		if (i.size !== 0) return {
			providers: i,
			ch: r
		};
	}
};
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, n) {
		if (!n.hasModel()) return;
		let r = n.getModel();
		r.tokenization.resetTokenization();
		let i = new StopWatch();
		r.tokenization.forceTokenization(r.getLineCount()), i.stop(), console.log(`tokenization took ${i.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, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$14 = function(e, n) {
	return function(r, i) {
		n(r, i, 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, n, r = {}, i, a) {
		super(), this._link = n, this._hoverService = i, this._enabled = !0, this.el = append(e, $("a.monaco-link", {
			tabIndex: n.tabIndex ?? 0,
			href: n.href
		}, n.label)), this.hoverDelegate = r.hoverDelegate ?? getDefaultHoverDelegate("mouse"), this.setTooltip(n.title), this.el.setAttribute("role", "button");
		let o = this._register(new DomEmitter(this.el, "click")), s = this._register(new DomEmitter(this.el, "keypress")), c = Event.chain(s.event, (e) => e.map((e) => new StandardKeyboardEvent(e)).filter((e) => e.keyCode === 3)), l = this._register(new DomEmitter(this.el, EventType.Tap)).event;
		this._register(Gesture.addTarget(this.el));
		let u = Event.any(o.event, c, l);
		this._register(u((e) => {
			this.enabled && (EventHelper.stop(e, !0), r?.opener ? r.opener(this._link.href) : a.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, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$13 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, BANNER_ELEMENT_HEIGHT = 26, BannerController = class extends Disposable {
	constructor(e, n) {
		super(), this._editor = e, this.instantiationService = n, 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 n = $("span");
			return n.innerText = e, n;
		}
		return this.markdownRenderer.render(e).element;
	}
	clear() {
		clearNode(this.element);
	}
	show(e) {
		clearNode(this.element);
		let n = this.getAriaLabel(e);
		n && this.element.setAttribute("aria-label", n);
		let r = append(this.element, $("div.icon-container"));
		r.setAttribute("aria-hidden", "true"), e.icon && r.appendChild($(`div${ThemeIcon.asCSSSelector(e.icon)}`));
		let i = append(this.element, $("div.message-container"));
		if (i.setAttribute("aria-hidden", "true"), i.appendChild(this.getBannerMessage(e.message)), this.messageActionsContainer = append(this.element, $("div.message-actions-container")), e.actions) for (let n of e.actions) this._register(this.instantiationService.createInstance(Link, this.messageActionsContainer, {
			...n,
			tabIndex: -1
		}, {}));
		let a = append(this.element, $("div.action-container"));
		this.actionBar = this._register(new ActionBar(a)), 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, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$12 = function(e, n) {
	return function(r, i) {
		n(r, i, 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, n, r, i) {
		super(), this._editor = e, this._editorWorkerService = n, this._workspaceTrustService = r, this._highlighter = null, this._bannerClosed = !1, this._updateState = (e) => {
			if (e && e.hasMore) {
				if (this._bannerClosed) return;
				let n = Math.max(e.ambiguousCharacterCount, e.nonBasicAsciiCharacterCount, e.invisibleCharacterCount), r;
				if (e.nonBasicAsciiCharacterCount >= n) r = {
					message: localize("unicodeHighlighting.thisDocumentHasManyNonBasicAsciiUnicodeCharacters", "This document contains many non-basic ASCII unicode characters"),
					command: new DisableHighlightingOfNonBasicAsciiCharactersAction()
				};
				else if (e.ambiguousCharacterCount >= n) r = {
					message: localize("unicodeHighlighting.thisDocumentHasManyAmbiguousUnicodeCharacters", "This document contains many ambiguous unicode characters"),
					command: new DisableHighlightingOfAmbiguousCharactersAction()
				};
				else if (e.invisibleCharacterCount >= n) r = {
					message: localize("unicodeHighlighting.thisDocumentHasManyInvisibleUnicodeCharacters", "This document contains many invisible unicode characters"),
					command: new DisableHighlightingOfInvisibleCharactersAction()
				};
				else throw Error("Unreachable");
				this._bannerController.show({
					id: "unicodeHighlightBanner",
					message: r.message,
					icon: warningIcon,
					actions: [{
						label: r.command.shortLabel,
						href: `command:${r.command.id}`
					}],
					onClose: () => {
						this._bannerClosed = !0;
					}
				});
			} else this._bannerController.hide();
		}, this._bannerController = this._register(i.createInstance(BannerController, e)), this._register(this._editor.onDidChangeModel(() => {
			this._bannerClosed = !1, this._updateHighlighter();
		})), this._options = e.getOption(126), this._register(r.onDidChangeTrust((e) => {
			this._updateHighlighter();
		})), this._register(e.onDidChangeConfiguration((n) => {
			n.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 n = {
			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, n, this._updateState, this._editorWorkerService) : this._highlighter = new ViewportUnicodeHighlighter(this._editor, n, 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, n) {
	return {
		nonBasicASCII: n.nonBasicASCII === "inUntrustedWorkspace" ? !e : n.nonBasicASCII,
		ambiguousCharacters: n.ambiguousCharacters,
		invisibleCharacters: n.invisibleCharacters,
		includeComments: n.includeComments === "inUntrustedWorkspace" ? !e : n.includeComments,
		includeStrings: n.includeStrings === "inUntrustedWorkspace" ? !e : n.includeStrings,
		allowedCharacters: n.allowedCharacters,
		allowedLocales: n.allowedLocales
	};
}
var DocumentUnicodeHighlighter = class extends Disposable {
	constructor(e, n, r, i) {
		super(), this._editor = e, this._options = n, this._updateState = r, this._editorWorkerService = i, 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((n) => {
			if (this._model.isDisposed() || this._model.getVersionId() !== e) return;
			this._updateState(n);
			let r = [];
			if (!n.hasMore) for (let e of n.ranges) r.push({
				range: e,
				options: Decorations.instance.getDecorationFromOptions(this._options)
			});
			this._decorations.set(r);
		});
	}
	getDecorationInfo(e) {
		if (!this._decorations.has(e)) return null;
		let n = this._editor.getModel();
		if (!isModelDecorationVisible(n, e)) return null;
		let r = n.getValueInRange(e.range);
		return {
			reason: computeReason(r, this._options),
			inComment: isModelDecorationInComment(n, e),
			inString: isModelDecorationInString(n, e)
		};
	}
};
DocumentUnicodeHighlighter = __decorate$12([__param$12(3, IEditorWorkerService)], DocumentUnicodeHighlighter);
var ViewportUnicodeHighlighter = class extends Disposable {
	constructor(e, n, r) {
		super(), this._editor = e, this._options = n, this._updateState = r, 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(), n = [], r = {
			ranges: [],
			ambiguousCharacterCount: 0,
			invisibleCharacterCount: 0,
			nonBasicAsciiCharacterCount: 0,
			hasMore: !1
		};
		for (let n of e) {
			let e = UnicodeTextModelHighlighter.computeUnicodeHighlights(this._model, this._options, n);
			for (let n of e.ranges) r.ranges.push(n);
			r.ambiguousCharacterCount += r.ambiguousCharacterCount, r.invisibleCharacterCount += r.invisibleCharacterCount, r.nonBasicAsciiCharacterCount += r.nonBasicAsciiCharacterCount, r.hasMore = r.hasMore || e.hasMore;
		}
		if (!r.hasMore) for (let e of r.ranges) n.push({
			range: e,
			options: Decorations.instance.getDecorationFromOptions(this._options)
		});
		this._updateState(r), this._decorations.set(n);
	}
	getDecorationInfo(e) {
		if (!this._decorations.has(e)) return null;
		let n = this._editor.getModel(), r = n.getValueInRange(e.range);
		return isModelDecorationVisible(n, e) ? {
			reason: computeReason(r, this._options),
			inComment: isModelDecorationInComment(n, e),
			inString: isModelDecorationInString(n, e)
		} : null;
	}
}, configureUnicodeHighlightOptionsStr = localize("unicodeHighlight.configureUnicodeHighlightOptions", "Configure Unicode Highlight Options"), UnicodeHighlighterHoverParticipant = class {
	constructor(e, n, r) {
		this._editor = e, this._languageService = n, this._openerService = r, this.hoverOrdinal = 5;
	}
	computeSync(e, n) {
		if (!this._editor.hasModel() || e.type !== 1) return [];
		let r = this._editor.getModel(), i = this._editor.getContribution(UnicodeHighlighter.ID);
		if (!i) return [];
		let a = [], o = /* @__PURE__ */ new Set(), s = 300;
		for (let e of n) {
			let n = i.getDecorationInfo(e);
			if (!n) continue;
			let c = r.getValueInRange(e.range).codePointAt(0), l = formatCodePointMarkdown(c), u;
			switch (n.reason.kind) {
				case 0:
					u = isBasicASCII(n.reason.confusableWith) ? localize("unicodeHighlight.characterIsAmbiguousASCII", "The character {0} could be confused with the ASCII character {1}, which is more common in source code.", l, formatCodePointMarkdown(n.reason.confusableWith.codePointAt(0))) : localize("unicodeHighlight.characterIsAmbiguous", "The character {0} could be confused with the character {1}, which is more common in source code.", l, formatCodePointMarkdown(n.reason.confusableWith.codePointAt(0)));
					break;
				case 1:
					u = localize("unicodeHighlight.characterIsInvisible", "The character {0} is invisible.", l);
					break;
				case 2:
					u = localize("unicodeHighlight.characterIsNonBasicAscii", "The character {0} is not a basic ASCII character.", l);
					break;
			}
			if (o.has(u)) continue;
			o.add(u);
			let d = {
				codePoint: c,
				reason: n.reason,
				inComment: n.inComment,
				inString: n.inString
			}, f = localize("unicodeHighlight.adjustSettings", "Adjust settings"), m = `command:${ShowExcludeOptions.ID}?${encodeURIComponent(JSON.stringify(d))}`, g = new MarkdownString("", !0).appendMarkdown(u).appendText(" ").appendLink(m, f, configureUnicodeHighlightOptionsStr);
			a.push(new MarkdownHover(this, e.range, [g], !1, s++));
		}
		return a;
	}
	renderHoverParts(e, n) {
		return renderMarkdownHovers(e, n, 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 n = `\`${codePointToHex(e)}\``;
	return InvisibleCharacters.isInvisibleCharacter(e) || (n += ` "${`${renderCodePointAsInlineCode(e)}`}"`), n;
}
function renderCodePointAsInlineCode(e) {
	return e === 96 ? "`` ` ``" : "`" + String.fromCodePoint(e) + "`";
}
function computeReason(e, n) {
	return UnicodeTextModelHighlighter.computeUnicodeHighlightReason(e, n);
}
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, n) {
		let r = `${e}${n}`, i = this.map.get(r);
		return i || (i = ModelDecorationOptions.createDynamic({
			description: "unicode-highlight",
			stickiness: 1,
			className: "unicode-highlight",
			showIfCollapsed: !0,
			overviewRuler: null,
			minimap: null,
			hideInCommentTokens: e,
			hideInStringTokens: n
		}), this.map.set(r, i)), i;
	}
}, 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, n, r) {
		let i = e?.get(IConfigurationService);
		i && this.runAction(i);
	}
	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, n, r) {
		let i = e?.get(IConfigurationService);
		i && this.runAction(i);
	}
	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, n, r) {
		let i = e?.get(IConfigurationService);
		i && this.runAction(i);
	}
	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, n, r) {
		let i = e?.get(IConfigurationService);
		i && this.runAction(i);
	}
	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, n, r) {
		let i = e?.get(IConfigurationService);
		i && this.runAction(i);
	}
	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, n, r) {
		let { codePoint: i, reason: a, inString: o, inComment: s } = r, c = String.fromCodePoint(i), l = e.get(IQuickInputService), u = e.get(IConfigurationService);
		function d(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)} "${c}"`);
		}
		let f = [];
		if (a.kind === 0) for (let e of a.notAmbiguousInLocales) f.push({
			label: localize("unicodeHighlight.allowCommonCharactersInLanguage", "Allow unicode characters that are more common in the language \"{0}\".", e),
			run: async () => {
				excludeLocaleFromBeingHighlighted(u, [e]);
			}
		});
		if (f.push({
			label: d(i),
			run: () => excludeCharFromBeingHighlighted(u, [i])
		}), s) {
			let e = new DisableHighlightingInCommentsAction();
			f.push({
				label: e.label,
				run: async () => e.runAction(u)
			});
		} else if (o) {
			let e = new DisableHighlightingInStringsAction();
			f.push({
				label: e.label,
				run: async () => e.runAction(u)
			});
		}
		if (a.kind === 0) {
			let e = new DisableHighlightingOfAmbiguousCharactersAction();
			f.push({
				label: e.label,
				run: async () => e.runAction(u)
			});
		} else if (a.kind === 1) {
			let e = new DisableHighlightingOfInvisibleCharactersAction();
			f.push({
				label: e.label,
				run: async () => e.runAction(u)
			});
		} else if (a.kind === 2) {
			let e = new DisableHighlightingOfNonBasicAsciiCharactersAction();
			f.push({
				label: e.label,
				run: async () => e.runAction(u)
			});
		} else expectNever(a);
		let m = await l.pick(f, { title: configureUnicodeHighlightOptionsStr });
		m && await m.run();
	}
};
async function excludeCharFromBeingHighlighted(e, n) {
	let r = e.getValue(unicodeHighlightConfigKeys.allowedCharacters), i;
	i = typeof r == "object" && r ? r : {};
	for (let e of n) i[String.fromCodePoint(e)] = !0;
	await e.updateValue(unicodeHighlightConfigKeys.allowedCharacters, i, 2);
}
async function excludeLocaleFromBeingHighlighted(e, n) {
	let r = e.inspect(unicodeHighlightConfigKeys.allowedLocales).user?.value, i;
	i = typeof r == "object" && r ? Object.assign({}, r) : {};
	for (let e of n) i[e] = !0;
	await e.updateValue(unicodeHighlightConfigKeys.allowedLocales, i, 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, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$11 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, ignoreUnusualLineTerminators = "ignoreUnusualLineTerminators";
function writeIgnoreState(e, n, r) {
	e.setModelProperty(n.uri, ignoreUnusualLineTerminators, r);
}
function readIgnoreState(e, n) {
	return e.getModelProperty(n.uri, ignoreUnusualLineTerminators);
}
var UnusualLineTerminatorsDetector = class extends Disposable {
	static {
		this.ID = "editor.contrib.unusualLineTerminatorsDetector";
	}
	constructor(e, n, r) {
		super(), this._editor = e, this._dialogService = n, this._codeEditorService = r, 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 n;
		try {
			this._isPresentingDialog = !0, n = 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 (!n.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, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$10 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, TextualDocumentHighlightProvider = class {
	constructor() {
		this.selector = { language: "*" };
	}
	provideDocumentHighlights(e, n, r) {
		let i = [], a = e.getWordAtPosition({
			lineNumber: n.lineNumber,
			column: n.column
		});
		if (!a) return Promise.resolve(i);
		if (!e.isDisposed()) return e.findMatches(a.word, !0, !1, !0, USUAL_WORD_SEPARATORS, !1).map((e) => ({
			range: e.range,
			kind: DocumentHighlightKind.Text
		}));
	}
	provideMultiDocumentHighlights(e, n, r, i) {
		let a = new ResourceMap(), o = e.getWordAtPosition({
			lineNumber: n.lineNumber,
			column: n.column
		});
		if (!o) return Promise.resolve(a);
		for (let n of [e, ...r]) {
			if (n.isDisposed()) continue;
			let e = n.findMatches(o.word, !0, !1, !0, USUAL_WORD_SEPARATORS, !1).map((e) => ({
				range: e.range,
				kind: DocumentHighlightKind.Text
			}));
			e && a.set(n.uri, e);
		}
		return a;
	}
}, 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, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$9 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, WordHighlighter_1, WordHighlighterContribution_1, ctxHasWordHighlights = new RawContextKey("hasWordHighlights", !1);
function getOccurrencesAtPosition(e, n, r, i) {
	let a = e.ordered(n);
	return first(a.map((e) => () => Promise.resolve(e.provideDocumentHighlights(n, r, i)).then(void 0, onUnexpectedExternalError)), (e) => e != null).then((e) => {
		if (e) {
			let r = new ResourceMap();
			return r.set(n.uri, e), r;
		}
		return new ResourceMap();
	});
}
function getOccurrencesAcrossMultipleModels(e, n, r, i, a, o) {
	let s = e.ordered(n);
	return first(s.map((e) => () => {
		let i = o.filter((e) => shouldSynchronizeModel(e)).filter((n) => score(e.selector, n.uri, n.getLanguageId(), !0, void 0, void 0) > 0);
		return Promise.resolve(e.provideMultiDocumentHighlights(n, r, i, a)).then(void 0, onUnexpectedExternalError);
	}), (e) => e != null);
}
var OccurenceAtPositionRequest = class {
	constructor(e, n, r) {
		this._model = e, this._selection = n, this._wordSeparators = r, this._wordRange = this._getCurrentWordRange(e, n), this._result = null;
	}
	get result() {
		return this._result ||= createCancelablePromise((e) => this._compute(this._model, this._selection, this._wordSeparators, e)), this._result;
	}
	_getCurrentWordRange(e, n) {
		let r = e.getWordAtPosition(n.getPosition());
		return r ? new Range(n.startLineNumber, r.startColumn, n.startLineNumber, r.endColumn) : null;
	}
	isValid(e, n, r) {
		let i = n.startLineNumber, a = n.startColumn, o = n.endColumn, s = this._getCurrentWordRange(e, n), c = !!(this._wordRange && this._wordRange.equalsRange(s));
		for (let e = 0, n = r.length; !c && e < n; e++) {
			let n = r.getRange(e);
			n && n.startLineNumber === i && n.startColumn <= a && n.endColumn >= o && (c = !0);
		}
		return c;
	}
	cancel() {
		this.result.cancel();
	}
}, SemanticOccurenceAtPositionRequest = class extends OccurenceAtPositionRequest {
	constructor(e, n, r, i) {
		super(e, n, r), this._providers = i;
	}
	_compute(e, n, r, i) {
		return getOccurrencesAtPosition(this._providers, e, n.getPosition(), i).then((e) => e || new ResourceMap());
	}
}, MultiModelOccurenceRequest = class extends OccurenceAtPositionRequest {
	constructor(e, n, r, i, a) {
		super(e, n, r), this._providers = i, this._otherModels = a;
	}
	_compute(e, n, r, i) {
		return getOccurrencesAcrossMultipleModels(this._providers, e, n.getPosition(), r, i, this._otherModels).then((e) => e || new ResourceMap());
	}
};
function computeOccurencesAtPosition(e, n, r, i, a) {
	return new SemanticOccurenceAtPositionRequest(n, r, a, e);
}
function computeOccurencesMultiModel(e, n, r, i, a, o) {
	return new MultiModelOccurenceRequest(n, r, a, e, o);
}
registerModelAndPositionCommand("_executeDocumentHighlights", async (e, n, r) => {
	let i = e.get(ILanguageFeaturesService);
	return (await getOccurrencesAtPosition(i.documentHighlightProvider, n, r, CancellationToken.None))?.get(n.uri);
});
var WordHighlighter = class {
	static {
		WordHighlighter_1 = this;
	}
	static {
		this.storedDecorationIDs = new ResourceMap();
	}
	static {
		this.query = null;
	}
	constructor(e, n, r, i, a) {
		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 = n, this.multiDocumentProviders = r, this.codeEditorService = a, this._hasWordHighlights = ctxHasWordHighlights.bindTo(i), 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 n = this.editor.getOption(81);
			if (this.occurrencesHighlight !== n) switch (this.occurrencesHighlight = n, n) {
				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:", n);
					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(), n = (e.findIndex((e) => e.containsPosition(this.editor.getPosition())) + 1) % e.length, r = e[n];
		try {
			this._ignorePositionChangeEvent = !0, this.editor.setPosition(r.getStartPosition()), this.editor.revealRangeInCenterIfOutsideViewport(r);
			let i = this._getWord();
			if (i) {
				let a = this.editor.getModel().getLineContent(r.startLineNumber);
				alert(`${a}, ${n + 1} of ${e.length} for '${i.word}'`);
			}
		} finally {
			this._ignorePositionChangeEvent = !1;
		}
	}
	moveBack() {
		let e = this._getSortedHighlights(), n = (e.findIndex((e) => e.containsPosition(this.editor.getPosition())) - 1 + e.length) % e.length, r = e[n];
		try {
			this._ignorePositionChangeEvent = !0, this.editor.setPosition(r.getStartPosition()), this.editor.revealRangeInCenterIfOutsideViewport(r);
			let i = this._getWord();
			if (i) {
				let a = this.editor.getModel().getLineContent(r.startLineNumber);
				alert(`${a}, ${n + 1} of ${e.length} for '${i.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 n = this.codeEditorService.listCodeEditors(), r = [];
		for (let i of n) {
			if (!i.hasModel() || isEqual(i.getModel().uri, e?.uri)) continue;
			let n = WordHighlighter_1.storedDecorationIDs.get(i.getModel().uri);
			if (!n) continue;
			i.removeDecorations(n), r.push(i.getModel().uri);
			let a = WordHighlighterContribution.get(i);
			a?.wordHighlighter && a.wordHighlighter.decorations.length > 0 && (a.wordHighlighter.decorations.clear(), a.wordHighlighter.workerRequest = null, a.wordHighlighter._hasWordHighlights.set(!1));
		}
		for (let e of r) 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(), n = e.startLineNumber, r = e.startColumn;
		return this.model.isDisposed() ? null : this.model.getWordAtPosition({
			lineNumber: n,
			column: r
		});
	}
	getOtherModelsToHighlight(e) {
		if (!e) return [];
		if (e.uri.scheme === Schemas.vscodeNotebookCell) {
			let n = [], r = this.codeEditorService.listCodeEditors();
			for (let i of r) {
				let r = i.getModel();
				r && r !== e && r.uri.scheme === Schemas.vscodeNotebookCell && n.push(r);
			}
			return n;
		}
		let n = [], r = this.codeEditorService.listCodeEditors();
		for (let i of r) {
			if (!isDiffEditor(i)) continue;
			let r = i.getModel();
			r && e === r.modified && n.push(r.modified);
		}
		if (n.length) return n;
		if (this.occurrencesHighlight === "singleFile") return [];
		for (let i of r) {
			let r = i.getModel();
			r && r !== e && n.push(r);
		}
		return n;
	}
	_run(e) {
		let n;
		if (this.editor.hasTextFocus()) {
			let e = this.editor.getSelection();
			if (!e || e.startLineNumber !== e.endLineNumber) {
				WordHighlighter_1.query = null, this._stopAll();
				return;
			}
			let r = e.startColumn, i = e.endColumn, a = this._getWord();
			if (!a || a.startColumn > r || a.endColumn < i) {
				WordHighlighter_1.query = null, this._stopAll();
				return;
			}
			n = this.workerRequest && this.workerRequest.isValid(this.model, e, this.decorations), WordHighlighter_1.query = {
				modelInfo: {
					model: this.model,
					selection: e
				},
				word: a
			};
		} else if (!WordHighlighter_1.query) {
			this._stopAll();
			return;
		}
		if (this.lastCursorPositionChangeTime = (/* @__PURE__ */ new Date()).getTime(), n) 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 n of e) if (n.containsPosition(this.editor.getPosition())) return;
			}
			this._stopAll(e ? this.model : void 0);
			let n = ++this.workerRequestTokenId;
			this.workerRequestCompleted = !1;
			let r = 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, r), this.workerRequest?.result.then((e) => {
				n === this.workerRequestTokenId && (this.workerRequestCompleted = !0, this.workerRequestValue = e || [], this._beginRenderDecorations());
			}, onUnexpectedError);
		}
	}
	computeWithModel(e, n, r, i) {
		return i.length ? computeOccurencesMultiModel(this.multiDocumentProviders, e, n, r, this.editor.getOption(132), i) : computeOccurencesAtPosition(this.providers, e, n, r, this.editor.getOption(132));
	}
	_beginRenderDecorations() {
		let e = (/* @__PURE__ */ new Date()).getTime(), n = this.lastCursorPositionChangeTime + 250;
		e >= n ? (this.renderDecorationsTimer = -1, this.renderDecorations()) : this.renderDecorationsTimer = setTimeout(() => {
			this.renderDecorations();
		}, n - e);
	}
	renderDecorations() {
		this.renderDecorationsTimer = -1;
		let e = this.codeEditorService.listCodeEditors();
		for (let n of e) {
			let e = WordHighlighterContribution.get(n);
			if (!e) continue;
			let r = [], i = n.getModel()?.uri;
			if (i && this.workerRequestValue.has(i)) {
				let a = WordHighlighter_1.storedDecorationIDs.get(i), o = this.workerRequestValue.get(i);
				if (o) for (let e of o) e.range && r.push({
					range: e.range,
					options: getHighlightDecorationOptions(e.kind)
				});
				let s = [];
				n.changeDecorations((e) => {
					s = e.deltaDecorations(a ?? [], r);
				}), WordHighlighter_1.storedDecorationIDs = WordHighlighter_1.storedDecorationIDs.set(i, s), r.length > 0 && (e.wordHighlighter?.decorations.set(r), 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, n, r, i) {
		super(), this._wordHighlighter = null;
		let a = () => {
			e.hasModel() && !e.getModel().isTooLargeForTokenization() && (this._wordHighlighter = new WordHighlighter(e, r.documentHighlightProvider, r.multiDocumentHighlightProvider, n, i));
		};
		this._register(e.onDidChangeModel((e) => {
			this._wordHighlighter &&= (this._wordHighlighter.dispose(), null), a();
		})), a();
	}
	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, n) {
		super(n), this._isNext = e;
	}
	run(e, n) {
		let r = WordHighlighterContribution.get(n);
		r && (this._isNext ? r.moveNext() : r.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, n, r) {
		let i = WordHighlighterContribution.get(n);
		i && i.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, n, r) {
		if (!n.hasModel()) return;
		let i = getMapForWordSeparators(n.getOption(132), n.getOption(131)), a = n.getModel(), o = n.getSelections(), s = o.length > 1, c = o.map((e) => {
			let n = new Position(e.positionLineNumber, e.positionColumn), r = this._move(i, a, n, this._wordNavigationType, s);
			return this._moveTo(e, r, this._inSelectionMode);
		});
		if (a.pushStackElement(), n._getViewModel().setCursorStates("moveWordCommand", 3, c.map((e) => CursorState.fromModelSelection(e))), c.length === 1) {
			let e = new Position(c[0].positionLineNumber, c[0].positionColumn);
			n.revealPosition(e, 0);
		}
	}
	_moveTo(e, n, r) {
		return r ? new Selection(e.selectionStartLineNumber, e.selectionStartColumn, n.lineNumber, n.column) : new Selection(n.lineNumber, n.column, n.lineNumber, n.column);
	}
}, WordLeftCommand = class extends MoveWordCommand {
	_move(e, n, r, i, a) {
		return WordOperations.moveWordLeft(e, n, r, i, a);
	}
}, WordRightCommand = class extends MoveWordCommand {
	_move(e, n, r, i, a) {
		return WordOperations.moveWordRight(e, n, r, i);
	}
}, 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, n, r, i, a) {
		return super._move(getMapForWordSeparators(EditorOptions.wordSeparators.defaultValue, e.intlSegmenterLocales), n, r, i, a);
	}
}, CursorWordAccessibilityLeftSelect = class extends WordLeftCommand {
	constructor() {
		super({
			inSelectionMode: !0,
			wordNavigationType: 3,
			id: "cursorWordAccessibilityLeftSelect",
			precondition: void 0
		});
	}
	_move(e, n, r, i, a) {
		return super._move(getMapForWordSeparators(EditorOptions.wordSeparators.defaultValue, e.intlSegmenterLocales), n, r, i, a);
	}
}, 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, n, r, i, a) {
		return super._move(getMapForWordSeparators(EditorOptions.wordSeparators.defaultValue, e.intlSegmenterLocales), n, r, i, a);
	}
}, CursorWordAccessibilityRightSelect = class extends WordRightCommand {
	constructor() {
		super({
			inSelectionMode: !0,
			wordNavigationType: 3,
			id: "cursorWordAccessibilityRightSelect",
			precondition: void 0
		});
	}
	_move(e, n, r, i, a) {
		return super._move(getMapForWordSeparators(EditorOptions.wordSeparators.defaultValue, e.intlSegmenterLocales), n, r, i, a);
	}
}, DeleteWordCommand = class extends EditorCommand {
	constructor(e) {
		super(e), this._whitespaceHeuristics = e.whitespaceHeuristics, this._wordNavigationType = e.wordNavigationType;
	}
	runEditorCommand(e, n, r) {
		let i = e.get(ILanguageConfigurationService);
		if (!n.hasModel()) return;
		let a = getMapForWordSeparators(n.getOption(132), n.getOption(131)), o = n.getModel(), s = n.getSelections(), c = n.getOption(6), l = n.getOption(11), u = i.getLanguageConfiguration(o.getLanguageId()).getAutoClosingPairs(), d = n._getViewModel(), f = s.map((e) => {
			let r = this._delete({
				wordSeparators: a,
				model: o,
				selection: e,
				whitespaceHeuristics: this._whitespaceHeuristics,
				autoClosingDelete: n.getOption(9),
				autoClosingBrackets: c,
				autoClosingQuotes: l,
				autoClosingPairs: u,
				autoClosedCharacters: d.getCursorAutoClosedCharacters()
			}, this._wordNavigationType);
			return new ReplaceCommand(r, "");
		});
		n.pushUndoStop(), n.executeCommands(this.id, f), n.pushUndoStop();
	}
}, DeleteWordLeftCommand = class extends DeleteWordCommand {
	_delete(e, n) {
		return WordOperations.deleteWordLeft(e, n) || new Range(1, 1, 1, 1);
	}
}, DeleteWordRightCommand = class extends DeleteWordCommand {
	_delete(e, n) {
		let r = WordOperations.deleteWordRight(e, n);
		if (r) return r;
		let i = e.model.getLineCount(), a = e.model.getLineMaxColumn(i);
		return new Range(i, a, i, a);
	}
}, 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, n, r) {
		if (!n.hasModel()) return;
		let i = getMapForWordSeparators(n.getOption(132), n.getOption(131)), a = n.getModel(), o = n.getSelections().map((e) => {
			let n = WordOperations.deleteInsideWord(i, a, e);
			return new ReplaceCommand(n, "");
		});
		n.pushUndoStop(), n.executeCommands(this.id, o), n.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, n) {
		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, n) {
		let r = WordPartOperations.deleteWordPartRight(e);
		if (r) return r;
		let i = e.model.getLineCount(), a = e.model.getLineMaxColumn(i);
		return new Range(i, a, i, a);
	}
}, WordPartLeftCommand = class extends MoveWordCommand {
	_move(e, n, r, i, a) {
		return WordPartOperations.moveWordPartLeft(e, n, r, a);
	}
}, 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, n, r, i, a) {
		return WordPartOperations.moveWordPartRight(e, n, r);
	}
}, 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 n = this.editor.getOptions().get(93);
			n ||= 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(n, this.editor.getPosition());
		}
	}
};
registerEditorContribution(ReadOnlyMessageController.ID, ReadOnlyMessageController, 2);
var __decorate$8 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$8 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, DiffEditorBreadcrumbsSource = class extends Disposable {
	constructor(e, n, r) {
		super(), this._textModel = e, this._languageFeaturesService = n, this._outlineModelService = r, this._currentModel = observableValue(this, void 0);
		let i = observableSignalFromEvent("documentSymbolProvider.onDidChange", this._languageFeaturesService.documentSymbolProvider.onDidChange), a = observableSignalFromEvent("_textModel.onDidChangeContent", Event.debounce((e) => this._textModel.onDidChangeContent(e), () => void 0, 100));
		this._register(autorunWithStore(async (e, n) => {
			i.read(e), a.read(e);
			let r = n.add(new DisposableCancellationTokenSource()), o = await this._outlineModelService.getOrCreate(this._textModel, r.token);
			n.isDisposed || this._currentModel.set(o, void 0);
		}));
	}
	getBreadcrumbItems(e, n) {
		let r = this._currentModel.read(n);
		if (!r) return [];
		let i = r.asListOfDocumentSymbols().filter((n) => e.contains(n.range.startLineNumber) && !e.contains(n.range.endLineNumber));
		return i.sort(reverseOrder(compareBy((e) => e.range.endLineNumber - e.range.startLineNumber, numberComparator))), i.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, n) => n.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, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$7 = function(e, n) {
	return function(r, i) {
		n(r, i, 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, n, r) {
		super(), this._editor = e, this._languageService = r, 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, n) {
		InspectTokensController.get(n)?.launch();
	}
};
function renderTokenText(e) {
	let n = "";
	for (let r = 0, i = e.length; r < i; r++) {
		let i = e.charCodeAt(r);
		switch (i) {
			case 9:
				n += "→";
				break;
			case 32:
				n += "·";
				break;
			default: n += String.fromCharCode(i);
		}
	}
	return n;
}
function getSafeTokenizationSupport(e, n) {
	let r = TokenizationRegistry.get(n);
	if (r) return r;
	let i = e.encodeLanguageId(n);
	return {
		getInitialState: () => NullState,
		tokenize: (e, r, i) => nullTokenize(n, i),
		tokenizeEncoded: (e, n, r) => nullTokenizeEncoded(i, r)
	};
}
var InspectTokensWidget = class e extends Disposable {
	static {
		this._ID = "editor.contrib.inspectTokensWidget";
	}
	constructor(e, n) {
		super(), this.allowEditorOverflow = !0, this._editor = e, this._languageService = n, 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 n = this._getTokensAtLine(e.lineNumber), r = 0;
		for (let i = n.tokens1.length - 1; i >= 0; i--) {
			let a = n.tokens1[i];
			if (e.column - 1 >= a.offset) {
				r = i;
				break;
			}
		}
		let i = 0;
		for (let r = n.tokens2.length >>> 1; r >= 0; r--) if (e.column - 1 >= n.tokens2[r << 1]) {
			i = r;
			break;
		}
		let a = this._model.getLineContent(e.lineNumber), o = "";
		if (r < n.tokens1.length) {
			let e = n.tokens1[r].offset, i = r + 1 < n.tokens1.length ? n.tokens1[r + 1].offset : a.length;
			o = a.substring(e, i);
		}
		reset(this._domNode, $("h2.tm-token", void 0, renderTokenText(o), $("span.tm-token-length", void 0, `${o.length} ${o.length === 1 ? "char" : "chars"}`))), append(this._domNode, $("hr.tokens-inspect-separator", { style: "clear:both" }));
		let s = (i << 1) + 1 < n.tokens2.length ? this._decodeMetadata(n.tokens2[(i << 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, `${s ? s.languageId : "-?-"}`)), $("tr", void 0, $("td.tm-metadata-key", void 0, "token type"), $("td.tm-metadata-value", void 0, `${s ? this._tokenTypeToString(s.tokenType) : "-?-"}`)), $("tr", void 0, $("td.tm-metadata-key", void 0, "font style"), $("td.tm-metadata-value", void 0, `${s ? this._fontStyleToString(s.fontStyle) : "-?-"}`)), $("tr", void 0, $("td.tm-metadata-key", void 0, "foreground"), $("td.tm-metadata-value", void 0, `${s ? Color.Format.CSS.formatHex(s.foreground) : "-?-"}`)), $("tr", void 0, $("td.tm-metadata-key", void 0, "background"), $("td.tm-metadata-value", void 0, `${s ? Color.Format.CSS.formatHex(s.background) : "-?-"}`))))), append(this._domNode, $("hr.tokens-inspect-separator")), r < n.tokens1.length && append(this._domNode, $("span.tm-token-type", void 0, n.tokens1[r].type)), this._editor.layoutContentWidget(this);
	}
	_decodeMetadata(e) {
		let n = TokenizationRegistry.getColorMap(), r = TokenMetadata.getLanguageId(e), i = TokenMetadata.getTokenType(e), a = TokenMetadata.getFontStyle(e), o = TokenMetadata.getForeground(e), s = TokenMetadata.getBackground(e);
		return {
			languageId: this._languageService.languageIdCodec.decodeLanguageId(r),
			tokenType: i,
			fontStyle: a,
			foreground: n[o],
			background: n[s]
		};
	}
	_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 n = "";
		return e & 1 && (n += "italic "), e & 2 && (n += "bold "), e & 4 && (n += "underline "), e & 8 && (n += "strikethrough "), n.length === 0 && (n = "---"), n;
	}
	_getTokensAtLine(e) {
		let n = this._getStateBeforeLine(e), r = this._tokenizationSupport.tokenize(this._model.getLineContent(e), !0, n), i = this._tokenizationSupport.tokenizeEncoded(this._model.getLineContent(e), !0, n);
		return {
			startState: n,
			tokens1: r.tokens,
			tokens2: i.tokens,
			endState: r.endState
		};
	}
	_getStateBeforeLine(e) {
		let n = this._tokenizationSupport.getInitialState();
		for (let r = 1; r < e; r++) n = this._tokenizationSupport.tokenize(this._model.getLineContent(r), !0, n).endState;
		return n;
	}
	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, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$6 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, HelpQuickAccessProvider_1, HelpQuickAccessProvider = class {
	static {
		HelpQuickAccessProvider_1 = this;
	}
	static {
		this.PREFIX = "?";
	}
	constructor(e, n) {
		this.quickInputService = e, this.keybindingService = n, this.registry = Registry.as(Extensions.Quickaccess);
	}
	provide(e) {
		let n = new DisposableStore();
		return n.add(e.onDidAccept(() => {
			let [n] = e.selectedItems;
			n && this.quickInputService.quickAccess.show(n.prefix, { preserveValue: !0 });
		})), n.add(e.onDidChangeValue((e) => {
			let n = this.registry.getQuickAccessProvider(e.substr(HelpQuickAccessProvider_1.PREFIX.length));
			n && n.prefix && n.prefix !== HelpQuickAccessProvider_1.PREFIX && this.quickInputService.quickAccess.show(n.prefix, { preserveValue: !0 });
		})), e.items = this.getQuickAccessProviders().filter((e) => e.prefix !== HelpQuickAccessProvider_1.PREFIX), n;
	}
	getQuickAccessProviders() {
		return this.registry.getQuickAccessProviders().sort((e, n) => e.prefix.localeCompare(n.prefix)).flatMap((e) => this.createPicks(e));
	}
	createPicks(e) {
		return e.helpEntries.map((n) => {
			let r = n.prefix || e.prefix, i = r || "…";
			return {
				prefix: r,
				label: i,
				keybinding: n.commandId ? this.keybindingService.lookupKeybinding(n.commandId) : void 0,
				ariaLabel: localize("helpPickAriaLabel", "{0}, {1}", i, n.description),
				description: n.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, n, r) {
		let i = new DisposableStore();
		e.canAcceptInBackground = !!this.options?.canAcceptInBackground, e.matchOnLabel = e.matchOnDescription = e.matchOnDetail = e.sortByLabel = !1;
		let a = i.add(new MutableDisposable());
		return a.value = this.doProvide(e, n, r), i.add(this.onDidActiveTextEditorControlChange(() => {
			a.value = void 0, a.value = this.doProvide(e, n);
		})), i;
	}
	doProvide(e, n, r) {
		let i = new DisposableStore(), a = this.activeTextEditorControl;
		if (a && this.canProvideWithTextEditor(a)) {
			let o = { editor: a }, s = getCodeEditor(a);
			if (s) {
				let e = a.saveViewState() ?? void 0;
				i.add(s.onDidChangeCursorPosition(() => {
					e = a.saveViewState() ?? void 0;
				})), o.restoreViewState = () => {
					e && a === this.activeTextEditorControl && a.restoreViewState(e);
				}, i.add(createSingleCallFunction(n.onCancellationRequested)(() => o.restoreViewState?.()));
			}
			i.add(toDisposable(() => this.clearDecorations(a))), i.add(this.provideWithTextEditor(o, e, n, r));
		} else i.add(this.provideWithoutTextEditor(e, n));
		return i;
	}
	canProvideWithTextEditor(e) {
		return !0;
	}
	gotoLocation({ editor: e }, n) {
		e.setSelection(n.range, "code.jump"), e.revealRangeInCenter(n.range, 0), n.preserveFocus || e.focus();
		let r = e.getModel();
		r && "getLineContent" in r && status(`${r.getLineContent(n.range.startLineNumber)}`);
	}
	getModel(e) {
		return isDiffEditor(e) ? e.getModel()?.modified : e.getModel();
	}
	addDecorations(e, n) {
		e.changeDecorations((e) => {
			let r = [];
			this.rangeHighlightDecorationId &&= (r.push(this.rangeHighlightDecorationId.overviewRulerDecorationId), r.push(this.rangeHighlightDecorationId.rangeHighlightId), void 0);
			let i = [{
				range: n,
				options: {
					description: "quick-access-range-highlight",
					className: "rangeHighlight",
					isWholeLine: !0
				}
			}, {
				range: n,
				options: {
					description: "quick-access-range-highlight-overview",
					overviewRuler: {
						color: themeColorFromId(overviewRulerRangeHighlight),
						position: OverviewRulerLane.Full
					}
				}
			}], [a, o] = e.deltaDecorations(r, i);
			this.rangeHighlightDecorationId = {
				rangeHighlightId: a,
				overviewRulerDecorationId: o
			};
		});
	}
	clearDecorations(e) {
		let n = this.rangeHighlightDecorationId;
		n && (e.changeDecorations((e) => {
			e.deltaDecorations([n.overviewRulerDecorationId, n.rangeHighlightId], []);
		}), this.rangeHighlightDecorationId = void 0);
	}
}, AbstractGotoLineQuickAccessProvider = class e extends AbstractEditorNavigationQuickAccessProvider {
	static {
		this.PREFIX = ":";
	}
	constructor() {
		super({ canAcceptInBackground: !0 });
	}
	provideWithoutTextEditor(e) {
		let n = localize("cannotRunGotoLine", "Open a text editor first to go to a line.");
		return e.items = [{ label: n }], e.ariaLabel = n, Disposable.None;
	}
	provideWithTextEditor(n, r, i) {
		let a = n.editor, o = new DisposableStore();
		o.add(r.onDidAccept((e) => {
			let [i] = r.selectedItems;
			if (i) {
				if (!this.isValidLineNumber(a, i.lineNumber)) return;
				this.gotoLocation(n, {
					range: this.toRange(i.lineNumber, i.column),
					keyMods: r.keyMods,
					preserveFocus: e.inBackground
				}), e.inBackground || r.hide();
			}
		}));
		let s = () => {
			let n = this.parsePosition(a, r.value.trim().substr(e.PREFIX.length)), i = this.getPickLabel(a, n.lineNumber, n.column);
			if (r.items = [{
				lineNumber: n.lineNumber,
				column: n.column,
				label: i
			}], r.ariaLabel = i, !this.isValidLineNumber(a, n.lineNumber)) {
				this.clearDecorations(a);
				return;
			}
			let o = this.toRange(n.lineNumber, n.column);
			a.revealRangeInCenter(o, 0), this.addDecorations(a, o);
		};
		s(), o.add(r.onDidChangeValue(() => s()));
		let c = getCodeEditor(a);
		return c && c.getOptions().get(68).renderType === 2 && (c.updateOptions({ lineNumbers: "on" }), o.add(toDisposable(() => c.updateOptions({ lineNumbers: "relative" })))), o;
	}
	toRange(e = 1, n = 1) {
		return {
			startLineNumber: e,
			startColumn: n,
			endLineNumber: e,
			endColumn: n
		};
	}
	parsePosition(e, n) {
		let r = n.split(/,|:|#/).map((e) => parseInt(e, 10)).filter((e) => !isNaN(e)), i = this.lineCount(e) + 1;
		return {
			lineNumber: r[0] > 0 ? r[0] : i + r[0],
			column: r[1]
		};
	}
	getPickLabel(e, n, r) {
		if (this.isValidLineNumber(e, n)) return this.isValidColumn(e, n, r) ? localize("gotoLineColumnLabel", "Go to line {0} and character {1}.", n, r) : localize("gotoLineLabel", "Go to line {0}.", n);
		let i = e.getPosition() || {
			lineNumber: 1,
			column: 1
		}, a = this.lineCount(e);
		return a > 1 ? localize("gotoLineLabelEmptyWithLimit", "Current Line: {0}, Character: {1}. Type a line number between 1 and {2} to navigate to.", i.lineNumber, i.column, a) : localize("gotoLineLabelEmpty", "Current Line: {0}, Character: {1}. Type a line number to navigate to.", i.lineNumber, i.column);
	}
	isValidLineNumber(e, n) {
		return !n || typeof n != "number" ? !1 : n > 0 && n <= this.lineCount(e);
	}
	isValidColumn(e, n, r) {
		if (!r || typeof r != "number") return !1;
		let i = this.getModel(e);
		if (!i) return !1;
		let a = {
			lineNumber: n,
			column: r
		};
		return i.validatePosition(a).equals(a);
	}
	lineCount(e) {
		return this.getModel(e)?.getLineCount() ?? 0;
	}
}, __decorate$5 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$5 = function(e, n) {
	return function(r, i) {
		n(r, i, 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, n, r = 0, i = 0) {
	let a = n;
	return a.values && a.values.length > 1 ? doScoreFuzzy2Multiple(e, a.values, r, i) : doScoreFuzzy2Single(e, n, r, i);
}
function doScoreFuzzy2Multiple(e, n, r, i) {
	let a = 0, o = [];
	for (let s of n) {
		let [n, c] = doScoreFuzzy2Single(e, s, r, i);
		if (typeof n != "number") return NO_SCORE2;
		a += n, o.push(...c);
	}
	return [a, normalizeMatches(o)];
}
function doScoreFuzzy2Single(e, n, r, i) {
	let a = fuzzyScore(n.original, n.originalLowercase, r, e, e.toLowerCase(), i, {
		firstMatchCanBeWeak: !0,
		boostFullMatch: !0
	});
	return a ? [a[0], createMatches(a)] : NO_SCORE2;
}
Object.freeze({ score: 0 });
function normalizeMatches(e) {
	let n = e.sort((e, n) => e.start - n.start), r = [], i;
	for (let e of n) !i || !matchOverlaps(i, e) ? (i = e, r.push(e)) : (i.start = Math.min(i.start, e.start), i.end = Math.max(i.end, e.end));
	return r;
}
function matchOverlaps(e, n) {
	return !(e.end < n.start || n.end < e.start);
}
function queryExpectsExactMatch(e) {
	return e.startsWith("\"") && e.endsWith("\"");
}
var MULTIPLE_QUERY_VALUES_SEPARATOR = " ";
function prepareQuery(e) {
	typeof e != "string" && (e = "");
	let n = e.toLowerCase(), { pathNormalized: r, normalized: i, normalizedLowercase: a } = normalizeQuery(e), o = r.indexOf(sep) >= 0, s = queryExpectsExactMatch(e), c, l = e.split(MULTIPLE_QUERY_VALUES_SEPARATOR);
	if (l.length > 1) for (let e of l) {
		let n = queryExpectsExactMatch(e), { pathNormalized: r, normalized: i, normalizedLowercase: a } = normalizeQuery(e);
		i && (c ||= [], c.push({
			original: e,
			originalLowercase: e.toLowerCase(),
			pathNormalized: r,
			normalized: i,
			normalizedLowercase: a,
			expectContiguousMatch: n
		}));
	}
	return {
		original: e,
		originalLowercase: n,
		pathNormalized: r,
		normalized: i,
		normalizedLowercase: a,
		values: c,
		containsPathSeparator: o,
		expectContiguousMatch: s
	};
}
function normalizeQuery(e) {
	let n;
	n = isWindows ? e.replace(/\//g, sep) : e.replace(/\\/g, sep);
	let r = stripWildcards(n).replace(/\s|"/g, "");
	return {
		pathNormalized: n,
		normalized: r,
		normalizedLowercase: r.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, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$4 = function(e, n) {
	return function(r, i) {
		n(r, i, 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, n, r = Object.create(null)) {
		super(r), this._languageFeaturesService = e, this._outlineModelService = n, this.options = r, 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, n, r, i) {
		let a = e.editor, o = this.getModel(a);
		return o ? this._languageFeaturesService.documentSymbolProvider.has(o) ? this.doProvideWithEditorSymbols(e, o, n, r, i) : this.doProvideWithoutEditorSymbols(e, o, n, r) : Disposable.None;
	}
	doProvideWithoutEditorSymbols(e, n, r, i) {
		let a = new DisposableStore();
		return this.provideLabelPick(r, localize("cannotRunGotoSymbolWithoutSymbolProvider", "The active text editor does not provide symbol information.")), (async () => {
			!await this.waitForLanguageSymbolRegistry(n, a) || i.isCancellationRequested || a.add(this.doProvideWithEditorSymbols(e, n, r, i));
		})(), a;
	}
	provideLabelPick(e, n) {
		e.items = [{
			label: n,
			index: 0,
			kind: 14
		}], e.ariaLabel = n;
	}
	async waitForLanguageSymbolRegistry(e, n) {
		if (this._languageFeaturesService.documentSymbolProvider.has(e)) return !0;
		let r = new DeferredPromise(), i = n.add(this._languageFeaturesService.documentSymbolProvider.onDidChange(() => {
			this._languageFeaturesService.documentSymbolProvider.has(e) && (i.dispose(), r.complete(!0));
		}));
		return n.add(toDisposable(() => r.complete(!1))), r.p;
	}
	doProvideWithEditorSymbols(e, n, r, i, a) {
		let o = e.editor, s = new DisposableStore();
		s.add(r.onDidAccept((n) => {
			let [i] = r.selectedItems;
			i && i.range && (this.gotoLocation(e, {
				range: i.range.selection,
				keyMods: r.keyMods,
				preserveFocus: n.inBackground
			}), a?.handleAccept?.(i), n.inBackground || r.hide());
		})), s.add(r.onDidTriggerItemButton(({ item: n }) => {
			n && n.range && (this.gotoLocation(e, {
				range: n.range.selection,
				keyMods: r.keyMods,
				forceSideBySide: !0
			}), r.hide());
		}));
		let c = this.getDocumentSymbols(n, i), l, u = async (e) => {
			l?.dispose(!0), r.busy = !1, l = new CancellationTokenSource(i), r.busy = !0;
			try {
				let a = prepareQuery(r.value.substr(AbstractGotoSymbolQuickAccessProvider_1.PREFIX.length).trim()), o = await this.doGetSymbolPicks(c, a, void 0, l.token, n);
				if (i.isCancellationRequested) return;
				if (o.length > 0) {
					if (r.items = o, e && a.original.length === 0) {
						let n = findLast(o, (n) => !!(n.type !== "separator" && n.range && Range.containsPosition(n.range.decoration, e)));
						n && (r.activeItems = [n]);
					}
				} else a.original.length > 0 ? this.provideLabelPick(r, localize("noMatchingSymbolResults", "No matching editor symbols")) : this.provideLabelPick(r, localize("noSymbolResults", "No editor symbols"));
			} finally {
				i.isCancellationRequested || (r.busy = !1);
			}
		};
		return s.add(r.onDidChangeValue(() => u(void 0))), u(o.getSelection()?.getPosition()), s.add(r.onDidChangeActive(() => {
			let [e] = r.activeItems;
			e && e.range && (o.revealRangeInCenter(e.range.selection, 0), this.addDecorations(o, e.range.decoration));
		})), s;
	}
	async doGetSymbolPicks(e, n, r, i, a) {
		let o = await e;
		if (i.isCancellationRequested) return [];
		let s = n.original.indexOf(AbstractGotoSymbolQuickAccessProvider_1.SCOPE_PREFIX) === 0, c = s ? 1 : 0, l, u;
		n.values && n.values.length > 1 ? (l = pieceToQuery(n.values[0]), u = pieceToQuery(n.values.slice(1))) : l = n;
		let d, f = this.options?.openSideBySideDirection?.();
		f && (d = [{
			iconClass: f === "right" ? ThemeIcon.asClassName(Codicon.splitHorizontal) : ThemeIcon.asClassName(Codicon.splitVertical),
			tooltip: f === "right" ? localize("openToSide", "Open to the Side") : localize("openToBottom", "Open to the Bottom")
		}]);
		let m = [];
		for (let e = 0; e < o.length; e++) {
			let i = o[e], s = trim(i.name), f = `$(${SymbolKinds.toIcon(i.kind).id}) ${s}`, g = f.length - s.length, _ = i.containerName;
			r?.extraContainerLabel && (_ = _ ? `${r.extraContainerLabel} • ${_}` : r.extraContainerLabel);
			let v, y, b, x;
			if (n.original.length > c) {
				let e = !1;
				if (l !== n && ([v, y] = scoreFuzzy2(f, {
					...n,
					values: void 0
				}, c, g), typeof v == "number" && (e = !0)), typeof v != "number" && ([v, y] = scoreFuzzy2(f, l, c, g), typeof v != "number")) continue;
				if (!e && u) {
					if (_ && u.original.length > 0 && ([b, x] = scoreFuzzy2(_, u)), typeof b != "number") continue;
					typeof v == "number" && (v += b);
				}
			}
			let S = i.tags && i.tags.indexOf(1) >= 0;
			m.push({
				index: e,
				kind: i.kind,
				score: v,
				label: f,
				ariaLabel: getAriaLabelForSymbol(i.name, i.kind),
				description: _,
				highlights: S ? void 0 : {
					label: y,
					description: x
				},
				range: {
					selection: Range.collapseToStart(i.selectionRange),
					decoration: i.range
				},
				uri: a.uri,
				symbolName: s,
				strikethrough: S,
				buttons: d
			});
		}
		let g = m.sort((e, n) => s ? this.compareByKindAndScore(e, n) : this.compareByScore(e, n)), _ = [];
		if (s) {
			let e, n, r = 0;
			function i() {
				n && typeof e == "number" && r > 0 && (n.label = format(NLS_SYMBOL_KIND_CACHE[e] || FALLBACK_NLS_SYMBOL_KIND, r));
			}
			for (let a of g) e === a.kind ? r++ : (i(), e = a.kind, r = 1, n = { type: "separator" }, _.push(n)), _.push(a);
			i();
		} else g.length > 0 && (_ = [{
			label: localize("symbols", "symbols ({0})", m.length),
			type: "separator"
		}, ...g]);
		return _;
	}
	compareByScore(e, n) {
		if (typeof e.score != "number" && typeof n.score == "number") return 1;
		if (typeof e.score == "number" && typeof n.score != "number") return -1;
		if (typeof e.score == "number" && typeof n.score == "number") {
			if (e.score > n.score) return -1;
			if (e.score < n.score) return 1;
		}
		return e.index < n.index ? -1 : e.index > n.index ? 1 : 0;
	}
	compareByKindAndScore(e, n) {
		let r = NLS_SYMBOL_KIND_CACHE[e.kind] || FALLBACK_NLS_SYMBOL_KIND, i = NLS_SYMBOL_KIND_CACHE[n.kind] || FALLBACK_NLS_SYMBOL_KIND, a = r.localeCompare(i);
		return a === 0 ? this.compareByScore(e, n) : a;
	}
	async getDocumentSymbols(e, n) {
		let r = await this._outlineModelService.getOrCreate(e, n);
		return n.isCancellationRequested ? [] : r.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, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$3 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, StandaloneGotoSymbolQuickAccessProvider = class extends AbstractGotoSymbolQuickAccessProvider {
	constructor(e, n, r) {
		super(n, r), 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 n = /* @__PURE__ */ new Map();
	for (let r of e) n.set(r, (n.get(r) ?? 0) + 1);
	return n;
}
var TfIdfCalculator = class e {
	constructor() {
		this.chunkCount = 0, this.chunkOccurrences = /* @__PURE__ */ new Map(), this.documents = /* @__PURE__ */ new Map();
	}
	calculateScores(e, n) {
		let r = this.computeEmbedding(e), i = /* @__PURE__ */ new Map(), a = [];
		for (let [e, o] of this.documents) {
			if (n.isCancellationRequested) return [];
			for (let n of o.chunks) {
				let o = this.computeSimilarityScore(n, r, i);
				o > 0 && a.push({
					key: e,
					score: o
				});
			}
		}
		return a;
	}
	static termFrequencies(n) {
		return countMapFrom(e.splitTerms(n));
	}
	static *splitTerms(e) {
		let n = (e) => e.toLowerCase();
		for (let [r] of e.matchAll(/\b\p{Letter}[\p{Letter}\d]{2,}\b/gu)) {
			yield n(r);
			let e = r.replace(/([a-z])([A-Z])/g, "$1 $2").split(/\s+/g);
			if (e.length > 1) for (let r of e) r.length > 2 && /\p{Letter}{3,}/gu.test(r) && (yield n(r));
		}
	}
	updateDocuments(n) {
		for (let { key: e } of n) this.deleteDocument(e);
		for (let r of n) {
			let n = [];
			for (let i of r.textChunks) {
				let r = e.termFrequencies(i);
				for (let e of r.keys()) this.chunkOccurrences.set(e, (this.chunkOccurrences.get(e) ?? 0) + 1);
				n.push({
					text: i,
					tf: r
				});
			}
			this.chunkCount += n.length, this.documents.set(r.key, { chunks: n });
		}
		return this;
	}
	deleteDocument(e) {
		let n = this.documents.get(e);
		if (n) {
			this.documents.delete(e), this.chunkCount -= n.chunks.length;
			for (let e of n.chunks) for (let n of e.tf.keys()) {
				let e = this.chunkOccurrences.get(n);
				if (typeof e == "number") {
					let r = e - 1;
					r <= 0 ? this.chunkOccurrences.delete(n) : this.chunkOccurrences.set(n, r);
				}
			}
		}
	}
	computeSimilarityScore(e, n, r) {
		let i = 0;
		for (let [a, o] of Object.entries(n)) {
			let n = e.tf.get(a);
			if (!n) continue;
			let s = r.get(a);
			typeof s != "number" && (s = this.computeIdf(a), r.set(a, s));
			let c = n * s;
			i += c * o;
		}
		return i;
	}
	computeEmbedding(n) {
		let r = e.termFrequencies(n);
		return this.computeTfidf(r);
	}
	computeIdf(e) {
		let n = this.chunkOccurrences.get(e) ?? 0;
		return n > 0 ? Math.log((this.chunkCount + 1) / n) : 0;
	}
	computeTfidf(e) {
		let n = Object.create(null);
		for (let [r, i] of e) {
			let e = this.computeIdf(r);
			e > 0 && (n[r] = i * e);
		}
		return n;
	}
};
function normalizeTfIdfScores(e) {
	let n = e.slice(0);
	n.sort((e, n) => n.score - e.score);
	let r = n[0]?.score ?? 0;
	if (r > 0) for (let e of n) e.score /= r;
	return n;
}
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 n = e;
	return Array.isArray(n.items);
}
function isFastAndSlowPicks(e) {
	let n = e;
	return !!n.picks && n.additionalPicks instanceof Promise;
}
var PickerQuickAccessProvider = class extends Disposable {
	constructor(e, n) {
		super(), this.prefix = e, this.options = n;
	}
	provide(e, n, r) {
		let i = new DisposableStore();
		e.canAcceptInBackground = !!this.options?.canAcceptInBackground, e.matchOnLabel = e.matchOnDescription = e.matchOnDetail = e.sortByLabel = !1;
		let a, o = i.add(new MutableDisposable()), s = async () => {
			let i = o.value = new DisposableStore();
			a?.dispose(!0), e.busy = !1, a = new CancellationTokenSource(n);
			let s = a.token, c = e.value.substring(this.prefix.length);
			this.options?.shouldSkipTrimPickFilter || (c = c.trim());
			let l = this._getPicks(c, i, s, r), u = (n, r) => {
				let i, a;
				if (isPicksWithActive(n) ? (i = n.items, a = n.active) : i = n, i.length === 0) {
					if (r) return !1;
					(c.length > 0 || e.hideInput) && this.options?.noResultsPick && (i = isFunction(this.options.noResultsPick) ? [this.options.noResultsPick(c)] : [this.options.noResultsPick]);
				}
				return e.items = i, a && (e.activeItems = [a]), !0;
			}, d = async (n) => {
				let r = !1, i = !1;
				await Promise.all([(async () => {
					typeof n.mergeDelay == "number" && (await timeout(n.mergeDelay), s.isCancellationRequested) || i || (r = u(n.picks, !0));
				})(), (async () => {
					e.busy = !0;
					try {
						let i = await n.additionalPicks;
						if (s.isCancellationRequested) return;
						let a, o;
						isPicksWithActive(n.picks) ? (a = n.picks.items, o = n.picks.active) : a = n.picks;
						let c, l;
						if (isPicksWithActive(i) ? (c = i.items, l = i.active) : c = i, c.length > 0 || !r) {
							let n;
							if (!o && !l) {
								let r = e.activeItems[0];
								r && a.indexOf(r) !== -1 && (n = r);
							}
							u({
								items: [...a, ...c],
								active: o || l || n
							});
						}
					} finally {
						s.isCancellationRequested || (e.busy = !1), i = !0;
					}
				})()]);
			};
			if (l !== null) if (isFastAndSlowPicks(l)) await d(l);
			else if (!(l instanceof Promise)) u(l);
			else {
				e.busy = !0;
				try {
					let e = await l;
					if (s.isCancellationRequested) return;
					isFastAndSlowPicks(e) ? await d(e) : u(e);
				} finally {
					s.isCancellationRequested || (e.busy = !1);
				}
			}
		};
		i.add(e.onDidChangeValue(() => s())), s(), i.add(e.onDidAccept((n) => {
			if (r?.handleAccept) {
				n.inBackground || e.hide(), r.handleAccept?.(e.activeItems[0]);
				return;
			}
			let [i] = e.selectedItems;
			typeof i?.accept == "function" && (n.inBackground || e.hide(), i.accept(e.keyMods, n));
		}));
		let c = async (r, i) => {
			if (typeof i.trigger != "function") return;
			let a = i.buttons?.indexOf(r) ?? -1;
			if (a >= 0) {
				let r = i.trigger(a, e.keyMods), o = typeof r == "number" ? r : await r;
				if (n.isCancellationRequested) return;
				switch (o) {
					case TriggerAction.NO_ACTION: break;
					case TriggerAction.CLOSE_PICKER:
						e.hide();
						break;
					case TriggerAction.REFRESH_PICKER:
						s();
						break;
					case TriggerAction.REMOVE_ITEM: {
						let n = e.items.indexOf(i);
						if (n !== -1) {
							let r = e.items.slice(), i = r.splice(n, 1), a = e.activeItems.filter((e) => e !== i[0]), o = e.keepScrollPosition;
							e.keepScrollPosition = !0, e.items = r, a && (e.activeItems = a), e.keepScrollPosition = o;
						}
						break;
					}
				}
			}
		};
		return i.add(e.onDidTriggerItemButton(({ button: e, item: n }) => c(e, n))), i.add(e.onDidTriggerSeparatorButton(({ button: e, separator: n }) => c(e, n))), i;
	}
}, __decorate$2 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$2 = function(e, n) {
	return function(r, i) {
		n(r, i, 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, n, r, i, a, o) {
		super(AbstractCommandsQuickAccessProvider_1.PREFIX, e), this.instantiationService = n, this.keybindingService = r, this.commandService = i, this.telemetryService = a, this.dialogService = o, this.commandsHistory = this._register(this.instantiationService.createInstance(CommandsHistory)), this.options = e;
	}
	async _getPicks(e, n, r, i) {
		let a = await this.getCommandPicks(r);
		if (r.isCancellationRequested) return [];
		let o = createSingleCallFunction(() => {
			let n = new TfIdfCalculator();
			n.updateDocuments(a.map((e) => ({
				key: e.commandId,
				textChunks: [this.getTfIdfChunk(e)]
			})));
			let i = n.calculateScores(e, r);
			return normalizeTfIdfScores(i).filter((e) => e.score > AbstractCommandsQuickAccessProvider_1.TFIDF_THRESHOLD).slice(0, AbstractCommandsQuickAccessProvider_1.TFIDF_MAX_RESULTS);
		}), s = [];
		for (let n of a) {
			let i = AbstractCommandsQuickAccessProvider_1.WORD_FILTER(e, n.label) ?? void 0, a = n.commandAlias ? AbstractCommandsQuickAccessProvider_1.WORD_FILTER(e, n.commandAlias) ?? void 0 : void 0;
			if (i || a) n.highlights = {
				label: i,
				detail: this.options.showAlias ? a : void 0
			}, s.push(n);
			else if (e === n.commandId) s.push(n);
			else if (e.length >= 3) {
				let e = o();
				if (r.isCancellationRequested) return [];
				let i = e.find((e) => e.key === n.commandId);
				i && (n.tfIdfScore = i.score, s.push(n));
			}
		}
		let c = /* @__PURE__ */ new Map();
		for (let e of s) {
			let n = c.get(e.label);
			n ? (e.description = e.commandId, n.description = n.commandId) : c.set(e.label, e);
		}
		s.sort((e, n) => {
			if (e.tfIdfScore && n.tfIdfScore) return e.tfIdfScore === n.tfIdfScore ? e.label.localeCompare(n.label) : n.tfIdfScore - e.tfIdfScore;
			if (e.tfIdfScore) return 1;
			if (n.tfIdfScore) return -1;
			let r = this.commandsHistory.peek(e.commandId), i = this.commandsHistory.peek(n.commandId);
			if (r && i) return r > i ? -1 : 1;
			if (r) return -1;
			if (i) return 1;
			if (this.options.suggestedCommandIds) {
				let r = this.options.suggestedCommandIds.has(e.commandId), i = this.options.suggestedCommandIds.has(n.commandId);
				if (r && i) return 0;
				if (r) return -1;
				if (i) return 1;
			}
			return e.label.localeCompare(n.label);
		});
		let l = [], u = !1, d = !0, f = !!this.options.suggestedCommandIds;
		for (let e = 0; e < s.length; e++) {
			let n = s[e];
			e === 0 && this.commandsHistory.peek(n.commandId) && (l.push({
				type: "separator",
				label: localize("recentlyUsed", "recently used")
			}), u = !0), d && n.tfIdfScore !== void 0 && (l.push({
				type: "separator",
				label: localize("suggested", "similar commands")
			}), d = !1), f && n.tfIdfScore === void 0 && !this.commandsHistory.peek(n.commandId) && this.options.suggestedCommandIds?.has(n.commandId) && (l.push({
				type: "separator",
				label: localize("commonlyUsed", "commonly used")
			}), u = !0, f = !1), u && n.tfIdfScore === void 0 && !this.commandsHistory.peek(n.commandId) && !this.options.suggestedCommandIds?.has(n.commandId) && (l.push({
				type: "separator",
				label: localize("morecCommands", "other commands")
			}), u = !1), l.push(this.toCommandPick(n, i));
		}
		return this.hasAdditionalCommandPicks(e, r) ? {
			picks: l,
			additionalPicks: (async () => {
				let n = await this.getAdditionalCommandPicks(a, s, e, r);
				if (r.isCancellationRequested) return [];
				let o = n.map((e) => this.toCommandPick(e, i));
				return d && o[0]?.type !== "separator" && o.unshift({
					type: "separator",
					label: localize("suggested", "similar commands")
				}), o;
			})()
		} : l;
	}
	toCommandPick(e, n) {
		if (e.type === "separator") return e;
		let r = this.keybindingService.lookupKeybinding(e.commandId), i = r ? localize("commandPickAriaLabelWithKeybinding", "{0}, {1}", e.label, r.getAriaLabel()) : e.label;
		return {
			...e,
			ariaLabel: i,
			detail: this.options.showAlias && e.commandAlias !== e.label ? e.commandAlias : void 0,
			keybinding: r,
			accept: async () => {
				this.commandsHistory.push(e.commandId), this.telemetryService.publicLog2("workbenchActionExecuted", {
					id: e.commandId,
					from: n?.from ?? "quick open"
				});
				try {
					e.args?.length ? await this.commandService.executeCommand(e.commandId, ...e.args) : await this.commandService.executeCommand(e.commandId);
				} catch (n) {
					isCancellationError(n) || this.dialogService.error(localize("canNotRun", "Command '{0}' resulted in an error", e.label), toErrorMessage(n));
				}
			}
		};
	}
	getTfIdfChunk({ label: e, commandAlias: n, commandDescription: r }) {
		let i = e;
		return n && n !== e && (i += ` - ${n}`), r && r.value !== e && (i += ` - ${r.value === r.original ? r.value : `${r.value} (${r.original})`}`), i;
	}
};
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, n, r) {
		super(), this.storageService = e, this.configurationService = n, this.logService = r, 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), n;
		if (e) try {
			n = JSON.parse(e);
		} catch (e) {
			this.logService.error(`[CommandsHistory] invalid data: ${e}`);
		}
		let r = CommandsHistory_1.cache = new LRUCache(this.configuredCommandsHistoryLength, 1);
		if (n) {
			let e;
			e = n.usesLRU ? n.entries : n.entries.sort((e, n) => e.value - n.value), e.forEach((e) => r.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((n, r) => e.entries.push({
			key: r,
			value: n
		})), 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 n = e.getValue().workbench?.commandPalette?.history;
		return typeof n == "number" ? n : 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, n, r, i, a, o) {
		super(e, n, r, i, a, o);
	}
	getCodeEditorCommandPicks() {
		let e = this.activeTextEditorControl;
		if (!e) return [];
		let n = [];
		for (let r of e.getSupportedActions()) {
			let e;
			r.metadata?.description && (e = isLocalizedString(r.metadata.description) ? r.metadata.description : {
				original: r.metadata.description,
				value: r.metadata.description
			}), n.push({
				commandId: r.id,
				commandAlias: r.alias,
				commandDescription: e,
				label: stripIcons(r.label) || r.id
			});
		}
		return n;
	}
}, __decorate$1 = function(e, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param$1 = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, StandaloneCommandsQuickAccessProvider = class extends AbstractEditorCommandsQuickAccessProvider {
	get activeTextEditorControl() {
		return this.codeEditorService.getFocusedCodeEditor() ?? void 0;
	}
	constructor(e, n, r, i, a, o) {
		super({ showAlias: !1 }, e, r, i, a, o), this.codeEditorService = n;
	}
	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, n, r, i) {
	var a = arguments.length, o = a < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, r) : i, s;
	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, n, r, i);
	else for (var c = e.length - 1; c >= 0; c--) (s = e[c]) && (o = (a < 3 ? s(o) : a > 3 ? s(n, r, o) : s(n, r)) || o);
	return a > 3 && o && Object.defineProperty(n, r, o), o;
}, __param = function(e, n) {
	return function(r, i) {
		n(r, i, e);
	};
}, StandaloneReferencesController = class extends ReferencesController {
	constructor(e, n, r, i, a, o, s) {
		super(!0, e, n, r, i, a, o, s);
	}
};
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, n) {
		let r = e.get(IStandaloneThemeService), i = r.getColorTheme();
		isHighContrast(i.type) ? (r.setTheme(this._originalThemeName || (isDark(i.type) ? "vs-dark" : "vs")), this._originalThemeName = null) : (r.setTheme(isDark(i.type) ? HC_BLACK_THEME_NAME : HC_LIGHT_THEME_NAME), this._originalThemeName = i.themeName);
	}
});
export { getContextAtPosition as a, CompletionItemKind as i, getHoverInformation as n, require_graphql as o, Position$1 as r, registerLanguage as t };