import { Ju as __toESM, Ku as __commonJSMin, f as Uri, h as languages, p as editor } from "./editor.api-erJ7GEVs.js";
import { $ as getEnterLeaveForKind, B as isInterfaceType, C as GraphQLInputObjectType, D as GraphQLObjectType, E as GraphQLNonNull, F as isAbstractType, G as isObjectType, H as isListType, I as isCompositeType, J as isRequiredInputField, K as isOutputType, L as isEnumType, N as getNamedType, O as GraphQLScalarType, P as getNullableType, Q as print, R as isInputObjectType, S as GraphQLEnumType, T as GraphQLList, U as isNonNullType, V as isLeafType, W as isNullableType, X as isType, Y as isScalarType, Z as isUnionType, _ as GraphQLSpecifiedByDirective, _t as invariant, b as isSpecifiedScalarType, c as introspectionTypes, d as DEFAULT_DEPRECATION_REASON, dt as isPrintableAsBlockString, et as visit, f as GraphQLDeprecatedDirective, ft as Kind, g as GraphQLSkipDirective, gt as GraphQLError, h as GraphQLOneOfDirective, ht as isNode, i as SchemaMetaFieldDef, it as mapValue, k as GraphQLUnionType, l as isIntrospectionType, m as GraphQLIncludeDirective, mt as OperationTypeNode, n as valueFromAST, nt as suggestionList, o as TypeMetaFieldDef, ot as keyMap, p as GraphQLDirective, pt as DirectiveLocation, q as isRequiredArgument, r as GraphQLSchema, rt as naturalCompare, s as TypeNameMetaFieldDef, st as didYouMean, tt as visitInParallel, u as astFromValue, ut as inspect, v as isSpecifiedDirective, w as GraphQLInterfaceType, x as specifiedScalarTypes, y as specifiedDirectives, yt as devAssert, z as isInputType } from "./monaco-editor-PHzrpXpJ.js";
import "./monaco.contribution-fOs10zIq.js";
function isTypeSubTypeOf(e, m, h) {
	return m === h ? !0 : isNonNullType(h) ? isNonNullType(m) ? isTypeSubTypeOf(e, m.ofType, h.ofType) : !1 : isNonNullType(m) ? isTypeSubTypeOf(e, m.ofType, h) : isListType(h) ? isListType(m) ? isTypeSubTypeOf(e, m.ofType, h.ofType) : !1 : isListType(m) ? !1 : isAbstractType(h) && (isInterfaceType(m) || isObjectType(m)) && e.isSubType(h, m);
}
function doTypesOverlap(e, m, h) {
	return m === h ? !0 : isAbstractType(m) ? isAbstractType(h) ? e.getPossibleTypes(m).some((m) => e.isSubType(h, m)) : e.isSubType(m, h) : isAbstractType(h) ? e.isSubType(h, m) : !1;
}
function typeFromAST(e, m) {
	switch (m.kind) {
		case Kind.LIST_TYPE: {
			let h = typeFromAST(e, m.type);
			return h && new GraphQLList(h);
		}
		case Kind.NON_NULL_TYPE: {
			let h = typeFromAST(e, m.type);
			return h && new GraphQLNonNull(h);
		}
		case Kind.NAMED_TYPE: return e.getType(m.name.value);
	}
}
Symbol.toStringTag;
function isExecutableDefinitionNode(e) {
	return e.kind === Kind.OPERATION_DEFINITION || e.kind === Kind.FRAGMENT_DEFINITION;
}
function isTypeSystemDefinitionNode(e) {
	return e.kind === Kind.SCHEMA_DEFINITION || isTypeDefinitionNode(e) || e.kind === Kind.DIRECTIVE_DEFINITION;
}
function isTypeDefinitionNode(e) {
	return e.kind === Kind.SCALAR_TYPE_DEFINITION || e.kind === Kind.OBJECT_TYPE_DEFINITION || e.kind === Kind.INTERFACE_TYPE_DEFINITION || e.kind === Kind.UNION_TYPE_DEFINITION || e.kind === Kind.ENUM_TYPE_DEFINITION || e.kind === Kind.INPUT_OBJECT_TYPE_DEFINITION;
}
function isTypeSystemExtensionNode(e) {
	return e.kind === Kind.SCHEMA_EXTENSION || isTypeExtensionNode(e);
}
function isTypeExtensionNode(e) {
	return e.kind === Kind.SCALAR_TYPE_EXTENSION || e.kind === Kind.OBJECT_TYPE_EXTENSION || e.kind === Kind.INTERFACE_TYPE_EXTENSION || e.kind === Kind.UNION_TYPE_EXTENSION || e.kind === Kind.ENUM_TYPE_EXTENSION || e.kind === Kind.INPUT_OBJECT_TYPE_EXTENSION;
}
function ExecutableDefinitionsRule(e) {
	return { Document(m) {
		for (let h of m.definitions) if (!isExecutableDefinitionNode(h)) {
			let m = h.kind === Kind.SCHEMA_DEFINITION || h.kind === Kind.SCHEMA_EXTENSION ? "schema" : "\"" + h.name.value + "\"";
			e.reportError(new GraphQLError(`The ${m} definition is not executable.`, { nodes: h }));
		}
		return !1;
	} };
}
function FieldsOnCorrectTypeRule(e) {
	return { Field(m) {
		let h = e.getParentType();
		if (h && !e.getFieldDef()) {
			let g = e.getSchema(), _ = m.name.value, v = didYouMean("to use an inline fragment on", getSuggestedTypeNames(g, h, _));
			v === "" && (v = didYouMean(getSuggestedFieldNames(h, _))), e.reportError(new GraphQLError(`Cannot query field "${_}" on type "${h.name}".` + v, { nodes: m }));
		}
	} };
}
function getSuggestedTypeNames(e, m, h) {
	if (!isAbstractType(m)) return [];
	let g = /* @__PURE__ */ new Set(), _ = Object.create(null);
	for (let v of e.getPossibleTypes(m)) if (v.getFields()[h]) {
		g.add(v), _[v.name] = 1;
		for (let e of v.getInterfaces()) e.getFields()[h] && (g.add(e), _[e.name] = (_[e.name] ?? 0) + 1);
	}
	return [...g].sort((m, h) => {
		let g = _[h.name] - _[m.name];
		return g === 0 ? isInterfaceType(m) && e.isSubType(m, h) ? -1 : isInterfaceType(h) && e.isSubType(h, m) ? 1 : naturalCompare(m.name, h.name) : g;
	}).map((e) => e.name);
}
function getSuggestedFieldNames(e, m) {
	if (isObjectType(e) || isInterfaceType(e)) {
		let h = Object.keys(e.getFields());
		return suggestionList(m, h);
	}
	return [];
}
function FragmentsOnCompositeTypesRule(e) {
	return {
		InlineFragment(m) {
			let h = m.typeCondition;
			if (h) {
				let m = typeFromAST(e.getSchema(), h);
				if (m && !isCompositeType(m)) {
					let m = print(h);
					e.reportError(new GraphQLError(`Fragment cannot condition on non composite type "${m}".`, { nodes: h }));
				}
			}
		},
		FragmentDefinition(m) {
			let h = typeFromAST(e.getSchema(), m.typeCondition);
			if (h && !isCompositeType(h)) {
				let h = print(m.typeCondition);
				e.reportError(new GraphQLError(`Fragment "${m.name.value}" cannot condition on non composite type "${h}".`, { nodes: m.typeCondition }));
			}
		}
	};
}
function KnownArgumentNamesRule(e) {
	return {
		...KnownArgumentNamesOnDirectivesRule(e),
		Argument(m) {
			let h = e.getArgument(), g = e.getFieldDef(), _ = e.getParentType();
			if (!h && g && _) {
				let h = m.name.value, v = g.args.map((e) => e.name), y = suggestionList(h, v);
				e.reportError(new GraphQLError(`Unknown argument "${h}" on field "${_.name}.${g.name}".` + didYouMean(y), { nodes: m }));
			}
		}
	};
}
function KnownArgumentNamesOnDirectivesRule(e) {
	let m = Object.create(null), h = e.getSchema(), g = h ? h.getDirectives() : specifiedDirectives;
	for (let e of g) m[e.name] = e.args.map((e) => e.name);
	let _ = e.getDocument().definitions;
	for (let e of _) if (e.kind === Kind.DIRECTIVE_DEFINITION) {
		/* c8 ignore next */
		let h = e.arguments ?? [];
		m[e.name.value] = h.map((e) => e.name.value);
	}
	return { Directive(h) {
		let g = h.name.value, _ = m[g];
		if (h.arguments && _) for (let m of h.arguments) {
			let h = m.name.value;
			if (!_.includes(h)) {
				let v = suggestionList(h, _);
				e.reportError(new GraphQLError(`Unknown argument "${h}" on directive "@${g}".` + didYouMean(v), { nodes: m }));
			}
		}
		return !1;
	} };
}
function KnownDirectivesRule(e) {
	let m = Object.create(null), h = e.getSchema(), g = h ? h.getDirectives() : specifiedDirectives;
	for (let e of g) m[e.name] = e.locations;
	let _ = e.getDocument().definitions;
	for (let e of _) e.kind === Kind.DIRECTIVE_DEFINITION && (m[e.name.value] = e.locations.map((e) => e.value));
	return { Directive(h, g, _, v, y) {
		let b = h.name.value, x = m[b];
		if (!x) {
			e.reportError(new GraphQLError(`Unknown directive "@${b}".`, { nodes: h }));
			return;
		}
		let S = getDirectiveLocationForASTPath(y);
		S && !x.includes(S) && e.reportError(new GraphQLError(`Directive "@${b}" may not be used on ${S}.`, { nodes: h }));
	} };
}
function getDirectiveLocationForASTPath(e) {
	let m = e[e.length - 1];
	switch ("kind" in m || invariant(!1), m.kind) {
		case Kind.OPERATION_DEFINITION: return getDirectiveLocationForOperation(m.operation);
		case Kind.FIELD: return DirectiveLocation.FIELD;
		case Kind.FRAGMENT_SPREAD: return DirectiveLocation.FRAGMENT_SPREAD;
		case Kind.INLINE_FRAGMENT: return DirectiveLocation.INLINE_FRAGMENT;
		case Kind.FRAGMENT_DEFINITION: return DirectiveLocation.FRAGMENT_DEFINITION;
		case Kind.VARIABLE_DEFINITION: return DirectiveLocation.VARIABLE_DEFINITION;
		case Kind.SCHEMA_DEFINITION:
		case Kind.SCHEMA_EXTENSION: return DirectiveLocation.SCHEMA;
		case Kind.SCALAR_TYPE_DEFINITION:
		case Kind.SCALAR_TYPE_EXTENSION: return DirectiveLocation.SCALAR;
		case Kind.OBJECT_TYPE_DEFINITION:
		case Kind.OBJECT_TYPE_EXTENSION: return DirectiveLocation.OBJECT;
		case Kind.FIELD_DEFINITION: return DirectiveLocation.FIELD_DEFINITION;
		case Kind.INTERFACE_TYPE_DEFINITION:
		case Kind.INTERFACE_TYPE_EXTENSION: return DirectiveLocation.INTERFACE;
		case Kind.UNION_TYPE_DEFINITION:
		case Kind.UNION_TYPE_EXTENSION: return DirectiveLocation.UNION;
		case Kind.ENUM_TYPE_DEFINITION:
		case Kind.ENUM_TYPE_EXTENSION: return DirectiveLocation.ENUM;
		case Kind.ENUM_VALUE_DEFINITION: return DirectiveLocation.ENUM_VALUE;
		case Kind.INPUT_OBJECT_TYPE_DEFINITION:
		case Kind.INPUT_OBJECT_TYPE_EXTENSION: return DirectiveLocation.INPUT_OBJECT;
		case Kind.INPUT_VALUE_DEFINITION: {
			let m = e[e.length - 3];
			return "kind" in m || invariant(!1), m.kind === Kind.INPUT_OBJECT_TYPE_DEFINITION ? DirectiveLocation.INPUT_FIELD_DEFINITION : DirectiveLocation.ARGUMENT_DEFINITION;
		}
		default: invariant(!1, "Unexpected kind: " + inspect(m.kind));
	}
}
function getDirectiveLocationForOperation(e) {
	switch (e) {
		case OperationTypeNode.QUERY: return DirectiveLocation.QUERY;
		case OperationTypeNode.MUTATION: return DirectiveLocation.MUTATION;
		case OperationTypeNode.SUBSCRIPTION: return DirectiveLocation.SUBSCRIPTION;
	}
}
function KnownFragmentNamesRule(e) {
	return { FragmentSpread(m) {
		let h = m.name.value;
		e.getFragment(h) || e.reportError(new GraphQLError(`Unknown fragment "${h}".`, { nodes: m.name }));
	} };
}
function KnownTypeNamesRule(e) {
	let m = e.getSchema(), h = m ? m.getTypeMap() : Object.create(null), g = Object.create(null);
	for (let m of e.getDocument().definitions) isTypeDefinitionNode(m) && (g[m.name.value] = !0);
	let _ = [...Object.keys(h), ...Object.keys(g)];
	return { NamedType(m, v, y, b, x) {
		let S = m.name.value;
		if (!h[S] && !g[S]) {
			let h = x[2] ?? y, g = h != null && isSDLNode(h);
			if (g && standardTypeNames.includes(S)) return;
			let v = suggestionList(S, g ? standardTypeNames.concat(_) : _);
			e.reportError(new GraphQLError(`Unknown type "${S}".` + didYouMean(v), { nodes: m }));
		}
	} };
}
var standardTypeNames = [...specifiedScalarTypes, ...introspectionTypes].map((e) => e.name);
function isSDLNode(e) {
	return "kind" in e && (isTypeSystemDefinitionNode(e) || isTypeSystemExtensionNode(e));
}
function LoneAnonymousOperationRule(e) {
	let m = 0;
	return {
		Document(e) {
			m = e.definitions.filter((e) => e.kind === Kind.OPERATION_DEFINITION).length;
		},
		OperationDefinition(h) {
			!h.name && m > 1 && e.reportError(new GraphQLError("This anonymous operation must be the only defined operation.", { nodes: h }));
		}
	};
}
function LoneSchemaDefinitionRule(e) {
	let m = e.getSchema(), h = m?.astNode ?? m?.getQueryType() ?? m?.getMutationType() ?? m?.getSubscriptionType(), g = 0;
	return { SchemaDefinition(m) {
		if (h) {
			e.reportError(new GraphQLError("Cannot define a new schema within a schema extension.", { nodes: m }));
			return;
		}
		g > 0 && e.reportError(new GraphQLError("Must provide only one schema definition.", { nodes: m })), ++g;
	} };
}
var MAX_LISTS_DEPTH = 3;
function MaxIntrospectionDepthRule(e) {
	function m(h, g = Object.create(null), _ = 0) {
		if (h.kind === Kind.FRAGMENT_SPREAD) {
			let v = h.name.value;
			if (g[v] === !0) return !1;
			let y = e.getFragment(v);
			if (!y) return !1;
			try {
				return g[v] = !0, m(y, g, _);
			} finally {
				g[v] = void 0;
			}
		}
		if (h.kind === Kind.FIELD && (h.name.value === "fields" || h.name.value === "interfaces" || h.name.value === "possibleTypes" || h.name.value === "inputFields") && (_++, _ >= MAX_LISTS_DEPTH)) return !0;
		if ("selectionSet" in h && h.selectionSet) {
			for (let e of h.selectionSet.selections) if (m(e, g, _)) return !0;
		}
		return !1;
	}
	return { Field(h) {
		if ((h.name.value === "__schema" || h.name.value === "__type") && m(h)) return e.reportError(new GraphQLError("Maximum introspection depth exceeded", { nodes: [h] })), !1;
	} };
}
function NoFragmentCyclesRule(e) {
	let m = Object.create(null), h = [], g = Object.create(null);
	return {
		OperationDefinition: () => !1,
		FragmentDefinition(e) {
			return _(e), !1;
		}
	};
	function _(v) {
		if (m[v.name.value]) return;
		let y = v.name.value;
		m[y] = !0;
		let b = e.getFragmentSpreads(v.selectionSet);
		if (b.length !== 0) {
			g[y] = h.length;
			for (let m of b) {
				let v = m.name.value, y = g[v];
				if (h.push(m), y === void 0) {
					let m = e.getFragment(v);
					m && _(m);
				} else {
					let m = h.slice(y), g = m.slice(0, -1).map((e) => "\"" + e.name.value + "\"").join(", ");
					e.reportError(new GraphQLError(`Cannot spread fragment "${v}" within itself` + (g === "" ? "." : ` via ${g}.`), { nodes: m }));
				}
				h.pop();
			}
			g[y] = void 0;
		}
	}
}
function NoUndefinedVariablesRule(e) {
	let m = Object.create(null);
	return {
		OperationDefinition: {
			enter() {
				m = Object.create(null);
			},
			leave(h) {
				let g = e.getRecursiveVariableUsages(h);
				for (let { node: _ } of g) {
					let g = _.name.value;
					m[g] !== !0 && e.reportError(new GraphQLError(h.name ? `Variable "$${g}" is not defined by operation "${h.name.value}".` : `Variable "$${g}" is not defined.`, { nodes: [_, h] }));
				}
			}
		},
		VariableDefinition(e) {
			m[e.variable.name.value] = !0;
		}
	};
}
function NoUnusedFragmentsRule(e) {
	let m = [], h = [];
	return {
		OperationDefinition(e) {
			return m.push(e), !1;
		},
		FragmentDefinition(e) {
			return h.push(e), !1;
		},
		Document: { leave() {
			let g = Object.create(null);
			for (let h of m) for (let m of e.getRecursivelyReferencedFragments(h)) g[m.name.value] = !0;
			for (let m of h) {
				let h = m.name.value;
				g[h] !== !0 && e.reportError(new GraphQLError(`Fragment "${h}" is never used.`, { nodes: m }));
			}
		} }
	};
}
function NoUnusedVariablesRule(e) {
	let m = [];
	return {
		OperationDefinition: {
			enter() {
				m = [];
			},
			leave(h) {
				let g = Object.create(null), _ = e.getRecursiveVariableUsages(h);
				for (let { node: e } of _) g[e.name.value] = !0;
				for (let _ of m) {
					let m = _.variable.name.value;
					g[m] !== !0 && e.reportError(new GraphQLError(h.name ? `Variable "$${m}" is never used in operation "${h.name.value}".` : `Variable "$${m}" is never used.`, { nodes: _ }));
				}
			}
		},
		VariableDefinition(e) {
			m.push(e);
		}
	};
}
function sortValueNode(e) {
	switch (e.kind) {
		case Kind.OBJECT: return {
			...e,
			fields: sortFields(e.fields)
		};
		case Kind.LIST: return {
			...e,
			values: e.values.map(sortValueNode)
		};
		case Kind.INT:
		case Kind.FLOAT:
		case Kind.STRING:
		case Kind.BOOLEAN:
		case Kind.NULL:
		case Kind.ENUM:
		case Kind.VARIABLE: return e;
	}
}
function sortFields(e) {
	return e.map((e) => ({
		...e,
		value: sortValueNode(e.value)
	})).sort((e, m) => naturalCompare(e.name.value, m.name.value));
}
function reasonMessage(e) {
	return Array.isArray(e) ? e.map(([e, m]) => `subfields "${e}" conflict because ` + reasonMessage(m)).join(" and ") : e;
}
function OverlappingFieldsCanBeMergedRule(e) {
	let m = new OrderedPairSet(), h = new PairSet(), g = /* @__PURE__ */ new Map();
	return { SelectionSet(_) {
		let v = findConflictsWithinSelectionSet(e, g, m, h, e.getParentType(), _);
		for (let [[m, h], g, _] of v) {
			let v = reasonMessage(h);
			e.reportError(new GraphQLError(`Fields "${m}" conflict because ${v}. Use different aliases on the fields to fetch both if this was intentional.`, { nodes: g.concat(_) }));
		}
	} };
}
function findConflictsWithinSelectionSet(e, m, h, g, _, v) {
	let y = [], [b, x] = getFieldsAndFragmentNames(e, m, _, v);
	if (collectConflictsWithin(e, y, m, h, g, b), x.length !== 0) for (let _ = 0; _ < x.length; _++) {
		collectConflictsBetweenFieldsAndFragment(e, y, m, h, g, !1, b, x[_]);
		for (let v = _ + 1; v < x.length; v++) collectConflictsBetweenFragments(e, y, m, h, g, !1, x[_], x[v]);
	}
	return y;
}
function collectConflictsBetweenFieldsAndFragment(e, m, h, g, _, v, y, b) {
	if (g.has(y, b, v)) return;
	g.add(y, b, v);
	let x = e.getFragment(b);
	if (!x) return;
	let [S, C] = getReferencedFieldsAndFragmentNames(e, h, x);
	if (y !== S) {
		collectConflictsBetween(e, m, h, g, _, v, y, S);
		for (let b of C) collectConflictsBetweenFieldsAndFragment(e, m, h, g, _, v, y, b);
	}
}
function collectConflictsBetweenFragments(e, m, h, g, _, v, y, b) {
	if (y === b || _.has(y, b, v)) return;
	_.add(y, b, v);
	let x = e.getFragment(y), S = e.getFragment(b);
	if (!x || !S) return;
	let [C, w] = getReferencedFieldsAndFragmentNames(e, h, x), [T, E] = getReferencedFieldsAndFragmentNames(e, h, S);
	collectConflictsBetween(e, m, h, g, _, v, C, T);
	for (let b of E) collectConflictsBetweenFragments(e, m, h, g, _, v, y, b);
	for (let y of w) collectConflictsBetweenFragments(e, m, h, g, _, v, y, b);
}
function findConflictsBetweenSubSelectionSets(e, m, h, g, _, v, y, b, x) {
	let S = [], [C, w] = getFieldsAndFragmentNames(e, m, v, y), [T, E] = getFieldsAndFragmentNames(e, m, b, x);
	collectConflictsBetween(e, S, m, h, g, _, C, T);
	for (let v of E) collectConflictsBetweenFieldsAndFragment(e, S, m, h, g, _, C, v);
	for (let v of w) collectConflictsBetweenFieldsAndFragment(e, S, m, h, g, _, T, v);
	for (let v of w) for (let y of E) collectConflictsBetweenFragments(e, S, m, h, g, _, v, y);
	return S;
}
function collectConflictsWithin(e, m, h, g, _, v) {
	for (let [y, b] of Object.entries(v)) if (b.length > 1) for (let v = 0; v < b.length; v++) for (let x = v + 1; x < b.length; x++) {
		let S = findConflict(e, h, g, _, !1, y, b[v], b[x]);
		S && m.push(S);
	}
}
function collectConflictsBetween(e, m, h, g, _, v, y, b) {
	for (let [x, S] of Object.entries(y)) {
		let y = b[x];
		if (y) for (let b of S) for (let S of y) {
			let y = findConflict(e, h, g, _, v, x, b, S);
			y && m.push(y);
		}
	}
}
function findConflict(e, m, h, g, _, v, y, b) {
	let [x, S, C] = y, [T, E, D] = b, O = _ || x !== T && isObjectType(x) && isObjectType(T);
	if (!O) {
		let e = S.name.value, m = E.name.value;
		if (e !== m) return [
			[v, `"${e}" and "${m}" are different fields`],
			[S],
			[E]
		];
		if (!sameArguments(S, E)) return [
			[v, "they have differing arguments"],
			[S],
			[E]
		];
	}
	let k = C?.type, j = D?.type;
	if (k && j && doTypesConflict(k, j)) return [
		[v, `they return conflicting types "${inspect(k)}" and "${inspect(j)}"`],
		[S],
		[E]
	];
	let M = S.selectionSet, N = E.selectionSet;
	if (M && N) {
		let _ = findConflictsBetweenSubSelectionSets(e, m, h, g, O, getNamedType(k), M, getNamedType(j), N);
		return subfieldConflicts(_, v, S, E);
	}
}
function sameArguments(e, m) {
	let h = e.arguments, g = m.arguments;
	if (h === void 0 || h.length === 0) return g === void 0 || g.length === 0;
	/* c8 ignore next */
	if (g === void 0 || g.length === 0 || h.length !== g.length)
 /* c8 ignore next */
	return !1;
	let _ = new Map(g.map(({ name: e, value: m }) => [e.value, m]));
	return h.every((e) => {
		let m = e.value, h = _.get(e.name.value);
		return h === void 0 ? !1 : stringifyValue(m) === stringifyValue(h);
	});
}
function stringifyValue(e) {
	return print(sortValueNode(e));
}
function doTypesConflict(e, m) {
	return isListType(e) ? isListType(m) ? doTypesConflict(e.ofType, m.ofType) : !0 : isListType(m) ? !0 : isNonNullType(e) ? isNonNullType(m) ? doTypesConflict(e.ofType, m.ofType) : !0 : isNonNullType(m) ? !0 : isLeafType(e) || isLeafType(m) ? e !== m : !1;
}
function getFieldsAndFragmentNames(e, m, h, g) {
	let _ = m.get(g);
	if (_) return _;
	let v = Object.create(null), y = Object.create(null);
	_collectFieldsAndFragmentNames(e, h, g, v, y);
	let b = [v, Object.keys(y)];
	return m.set(g, b), b;
}
function getReferencedFieldsAndFragmentNames(e, m, h) {
	let g = m.get(h.selectionSet);
	if (g) return g;
	let _ = typeFromAST(e.getSchema(), h.typeCondition);
	return getFieldsAndFragmentNames(e, m, _, h.selectionSet);
}
function _collectFieldsAndFragmentNames(e, m, h, g, _) {
	for (let v of h.selections) switch (v.kind) {
		case Kind.FIELD: {
			let e = v.name.value, h;
			(isObjectType(m) || isInterfaceType(m)) && (h = m.getFields()[e]);
			let _ = v.alias ? v.alias.value : e;
			g[_] || (g[_] = []), g[_].push([
				m,
				v,
				h
			]);
			break;
		}
		case Kind.FRAGMENT_SPREAD:
			_[v.name.value] = !0;
			break;
		case Kind.INLINE_FRAGMENT: {
			let h = v.typeCondition, y = h ? typeFromAST(e.getSchema(), h) : m;
			_collectFieldsAndFragmentNames(e, y, v.selectionSet, g, _);
			break;
		}
	}
}
function subfieldConflicts(e, m, h, g) {
	if (e.length > 0) return [
		[m, e.map(([e]) => e)],
		[h, ...e.map(([, e]) => e).flat()],
		[g, ...e.map(([, , e]) => e).flat()]
	];
}
var OrderedPairSet = class {
	constructor() {
		this._data = /* @__PURE__ */ new Map();
	}
	has(e, m, h) {
		let g = this._data.get(e)?.get(m);
		return g === void 0 ? !1 : h ? !0 : h === g;
	}
	add(e, m, h) {
		let g = this._data.get(e);
		g === void 0 ? this._data.set(e, new Map([[m, h]])) : g.set(m, h);
	}
}, PairSet = class {
	constructor() {
		this._orderedPairSet = new OrderedPairSet();
	}
	has(e, m, h) {
		return e < m ? this._orderedPairSet.has(e, m, h) : this._orderedPairSet.has(m, e, h);
	}
	add(e, m, h) {
		e < m ? this._orderedPairSet.add(e, m, h) : this._orderedPairSet.add(m, e, h);
	}
};
function PossibleFragmentSpreadsRule(e) {
	return {
		InlineFragment(m) {
			let h = e.getType(), g = e.getParentType();
			if (isCompositeType(h) && isCompositeType(g) && !doTypesOverlap(e.getSchema(), h, g)) {
				let _ = inspect(g), v = inspect(h);
				e.reportError(new GraphQLError(`Fragment cannot be spread here as objects of type "${_}" can never be of type "${v}".`, { nodes: m }));
			}
		},
		FragmentSpread(m) {
			let h = m.name.value, g = getFragmentType(e, h), _ = e.getParentType();
			if (g && _ && !doTypesOverlap(e.getSchema(), g, _)) {
				let v = inspect(_), y = inspect(g);
				e.reportError(new GraphQLError(`Fragment "${h}" cannot be spread here as objects of type "${v}" can never be of type "${y}".`, { nodes: m }));
			}
		}
	};
}
function getFragmentType(e, m) {
	let h = e.getFragment(m);
	if (h) {
		let m = typeFromAST(e.getSchema(), h.typeCondition);
		if (isCompositeType(m)) return m;
	}
}
function PossibleTypeExtensionsRule(e) {
	let m = e.getSchema(), h = Object.create(null);
	for (let m of e.getDocument().definitions) isTypeDefinitionNode(m) && (h[m.name.value] = m);
	return {
		ScalarTypeExtension: g,
		ObjectTypeExtension: g,
		InterfaceTypeExtension: g,
		UnionTypeExtension: g,
		EnumTypeExtension: g,
		InputObjectTypeExtension: g
	};
	function g(g) {
		let _ = g.name.value, v = h[_], y = m?.getType(_), b;
		if (v ? b = defKindToExtKind[v.kind] : y && (b = typeToExtKind(y)), b) {
			if (b !== g.kind) {
				let m = extensionKindToTypeName(g.kind);
				e.reportError(new GraphQLError(`Cannot extend non-${m} type "${_}".`, { nodes: v ? [v, g] : g }));
			}
		} else {
			let v = Object.keys({
				...h,
				...m?.getTypeMap()
			}), y = suggestionList(_, v);
			e.reportError(new GraphQLError(`Cannot extend type "${_}" because it is not defined.` + didYouMean(y), { nodes: g.name }));
		}
	}
}
var defKindToExtKind = {
	[Kind.SCALAR_TYPE_DEFINITION]: Kind.SCALAR_TYPE_EXTENSION,
	[Kind.OBJECT_TYPE_DEFINITION]: Kind.OBJECT_TYPE_EXTENSION,
	[Kind.INTERFACE_TYPE_DEFINITION]: Kind.INTERFACE_TYPE_EXTENSION,
	[Kind.UNION_TYPE_DEFINITION]: Kind.UNION_TYPE_EXTENSION,
	[Kind.ENUM_TYPE_DEFINITION]: Kind.ENUM_TYPE_EXTENSION,
	[Kind.INPUT_OBJECT_TYPE_DEFINITION]: Kind.INPUT_OBJECT_TYPE_EXTENSION
};
function typeToExtKind(e) {
	if (isScalarType(e)) return Kind.SCALAR_TYPE_EXTENSION;
	if (isObjectType(e)) return Kind.OBJECT_TYPE_EXTENSION;
	if (isInterfaceType(e)) return Kind.INTERFACE_TYPE_EXTENSION;
	if (isUnionType(e)) return Kind.UNION_TYPE_EXTENSION;
	if (isEnumType(e)) return Kind.ENUM_TYPE_EXTENSION;
	if (isInputObjectType(e)) return Kind.INPUT_OBJECT_TYPE_EXTENSION;
	/* c8 ignore next 3 */
	invariant(!1, "Unexpected type: " + inspect(e));
}
function extensionKindToTypeName(e) {
	switch (e) {
		case Kind.SCALAR_TYPE_EXTENSION: return "scalar";
		case Kind.OBJECT_TYPE_EXTENSION: return "object";
		case Kind.INTERFACE_TYPE_EXTENSION: return "interface";
		case Kind.UNION_TYPE_EXTENSION: return "union";
		case Kind.ENUM_TYPE_EXTENSION: return "enum";
		case Kind.INPUT_OBJECT_TYPE_EXTENSION: return "input object";
		default: invariant(!1, "Unexpected kind: " + inspect(e));
	}
}
function ProvidedRequiredArgumentsRule(e) {
	return {
		...ProvidedRequiredArgumentsOnDirectivesRule(e),
		Field: { leave(m) {
			let h = e.getFieldDef();
			if (!h) return !1;
			let g = new Set(m.arguments?.map((e) => e.name.value));
			for (let _ of h.args) if (!g.has(_.name) && isRequiredArgument(_)) {
				let g = inspect(_.type);
				e.reportError(new GraphQLError(`Field "${h.name}" argument "${_.name}" of type "${g}" is required, but it was not provided.`, { nodes: m }));
			}
		} }
	};
}
function ProvidedRequiredArgumentsOnDirectivesRule(e) {
	let m = Object.create(null), h = e.getSchema()?.getDirectives() ?? specifiedDirectives;
	for (let e of h) m[e.name] = keyMap(e.args.filter(isRequiredArgument), (e) => e.name);
	let g = e.getDocument().definitions;
	for (let e of g) if (e.kind === Kind.DIRECTIVE_DEFINITION) {
		/* c8 ignore next */
		let h = e.arguments ?? [];
		m[e.name.value] = keyMap(h.filter(isRequiredArgumentNode), (e) => e.name.value);
	}
	return { Directive: { leave(h) {
		let g = h.name.value, _ = m[g];
		if (_) {
			/* c8 ignore next */
			let m = h.arguments ?? [], v = new Set(m.map((e) => e.name.value));
			for (let [m, y] of Object.entries(_)) if (!v.has(m)) {
				let _ = isType(y.type) ? inspect(y.type) : print(y.type);
				e.reportError(new GraphQLError(`Directive "@${g}" argument "${m}" of type "${_}" is required, but it was not provided.`, { nodes: h }));
			}
		}
	} } };
}
function isRequiredArgumentNode(e) {
	return e.type.kind === Kind.NON_NULL_TYPE && e.defaultValue == null;
}
function ScalarLeafsRule(e) {
	return { Field(m) {
		let h = e.getType(), g = m.selectionSet;
		if (h) if (isLeafType(getNamedType(h))) {
			if (g) {
				let _ = m.name.value, v = inspect(h);
				e.reportError(new GraphQLError(`Field "${_}" must not have a selection since type "${v}" has no subfields.`, { nodes: g }));
			}
		} else if (g) {
			if (g.selections.length === 0) {
				let g = m.name.value, _ = inspect(h);
				e.reportError(new GraphQLError(`Field "${g}" of type "${_}" must have at least one field selected.`, { nodes: m }));
			}
		} else {
			let g = m.name.value, _ = inspect(h);
			e.reportError(new GraphQLError(`Field "${g}" of type "${_}" must have a selection of subfields. Did you mean "${g} { ... }"?`, { nodes: m }));
		}
	} };
}
function getArgumentValues(e, m, h) {
	let g = {}, _ = m.arguments ?? [], v = keyMap(_, (e) => e.name.value);
	for (let _ of e.args) {
		let e = _.name, y = _.type, b = v[e];
		if (!b) {
			if (_.defaultValue !== void 0) g[e] = _.defaultValue;
			else if (isNonNullType(y)) throw new GraphQLError(`Argument "${e}" of required type "${inspect(y)}" was not provided.`, { nodes: m });
			continue;
		}
		let x = b.value, S = x.kind === Kind.NULL;
		if (x.kind === Kind.VARIABLE) {
			let m = x.name.value;
			if (h == null || !hasOwnProperty(h, m)) {
				if (_.defaultValue !== void 0) g[e] = _.defaultValue;
				else if (isNonNullType(y)) throw new GraphQLError(`Argument "${e}" of required type "${inspect(y)}" was provided the variable "$${m}" which was not provided a runtime value.`, { nodes: x });
				continue;
			}
			S = h[m] == null;
		}
		if (S && isNonNullType(y)) throw new GraphQLError(`Argument "${e}" of non-null type "${inspect(y)}" must not be null.`, { nodes: x });
		let C = valueFromAST(x, y, h);
		if (C === void 0) throw new GraphQLError(`Argument "${e}" has invalid value ${print(x)}.`, { nodes: x });
		g[e] = C;
	}
	return g;
}
function getDirectiveValues(e, m, h) {
	let g = m.directives?.find((m) => m.name.value === e.name);
	if (g) return getArgumentValues(e, g, h);
}
function hasOwnProperty(e, m) {
	return Object.prototype.hasOwnProperty.call(e, m);
}
function collectFields(e, m, h, g, _) {
	let v = /* @__PURE__ */ new Map();
	return collectFieldsImpl(e, m, h, g, _, v, /* @__PURE__ */ new Set()), v;
}
function collectFieldsImpl(e, m, h, g, _, v, y) {
	for (let b of _.selections) switch (b.kind) {
		case Kind.FIELD: {
			if (!shouldIncludeNode(h, b)) continue;
			let e = getFieldEntryKey(b), m = v.get(e);
			m === void 0 ? v.set(e, [b]) : m.push(b);
			break;
		}
		case Kind.INLINE_FRAGMENT:
			if (!shouldIncludeNode(h, b) || !doesFragmentConditionMatch(e, b, g)) continue;
			collectFieldsImpl(e, m, h, g, b.selectionSet, v, y);
			break;
		case Kind.FRAGMENT_SPREAD: {
			let _ = b.name.value;
			if (y.has(_) || !shouldIncludeNode(h, b)) continue;
			y.add(_);
			let x = m[_];
			if (!x || !doesFragmentConditionMatch(e, x, g)) continue;
			collectFieldsImpl(e, m, h, g, x.selectionSet, v, y);
			break;
		}
	}
}
function shouldIncludeNode(e, m) {
	return getDirectiveValues(GraphQLSkipDirective, m, e)?.if === !0 ? !1 : getDirectiveValues(GraphQLIncludeDirective, m, e)?.if !== !1;
}
function doesFragmentConditionMatch(e, m, h) {
	let g = m.typeCondition;
	if (!g) return !0;
	let _ = typeFromAST(e, g);
	return _ === h ? !0 : isAbstractType(_) ? e.isSubType(_, h) : !1;
}
function getFieldEntryKey(e) {
	return e.alias ? e.alias.value : e.name.value;
}
function SingleFieldSubscriptionsRule(e) {
	return { OperationDefinition(m) {
		if (m.operation === "subscription") {
			let h = e.getSchema(), g = h.getSubscriptionType();
			if (g) {
				let _ = m.name ? m.name.value : null, v = Object.create(null), y = e.getDocument(), b = Object.create(null);
				for (let e of y.definitions) e.kind === Kind.FRAGMENT_DEFINITION && (b[e.name.value] = e);
				let x = collectFields(h, b, v, g, m.selectionSet);
				if (x.size > 1) {
					let m = [...x.values()].slice(1).flat();
					e.reportError(new GraphQLError(_ == null ? "Anonymous Subscription must select only one top level field." : `Subscription "${_}" must select only one top level field.`, { nodes: m }));
				}
				for (let m of x.values()) m[0].name.value.startsWith("__") && e.reportError(new GraphQLError(_ == null ? "Anonymous Subscription must not select an introspection top level field." : `Subscription "${_}" must not select an introspection top level field.`, { nodes: m }));
			}
		}
	} };
}
function groupBy(e, m) {
	let h = /* @__PURE__ */ new Map();
	for (let g of e) {
		let e = m(g), _ = h.get(e);
		_ === void 0 ? h.set(e, [g]) : _.push(g);
	}
	return h;
}
function UniqueArgumentDefinitionNamesRule(e) {
	return {
		DirectiveDefinition(e) {
			/* c8 ignore next */
			let m = e.arguments ?? [];
			return h(`@${e.name.value}`, m);
		},
		InterfaceTypeDefinition: m,
		InterfaceTypeExtension: m,
		ObjectTypeDefinition: m,
		ObjectTypeExtension: m
	};
	function m(e) {
		let m = e.name.value, g = e.fields ?? [];
		for (let e of g) {
			let g = e.name.value, _ = e.arguments ?? [];
			h(`${m}.${g}`, _);
		}
		return !1;
	}
	function h(m, h) {
		let g = groupBy(h, (e) => e.name.value);
		for (let [h, _] of g) _.length > 1 && e.reportError(new GraphQLError(`Argument "${m}(${h}:)" can only be defined once.`, { nodes: _.map((e) => e.name) }));
		return !1;
	}
}
function UniqueArgumentNamesRule(e) {
	return {
		Field: m,
		Directive: m
	};
	function m(m) {
		/* c8 ignore next */
		let h = m.arguments ?? [], g = groupBy(h, (e) => e.name.value);
		for (let [m, h] of g) h.length > 1 && e.reportError(new GraphQLError(`There can be only one argument named "${m}".`, { nodes: h.map((e) => e.name) }));
	}
}
function UniqueDirectiveNamesRule(e) {
	let m = Object.create(null), h = e.getSchema();
	return { DirectiveDefinition(g) {
		let _ = g.name.value;
		if (h != null && h.getDirective(_)) {
			e.reportError(new GraphQLError(`Directive "@${_}" already exists in the schema. It cannot be redefined.`, { nodes: g.name }));
			return;
		}
		return m[_] ? e.reportError(new GraphQLError(`There can be only one directive named "@${_}".`, { nodes: [m[_], g.name] })) : m[_] = g.name, !1;
	} };
}
function UniqueDirectivesPerLocationRule(e) {
	let m = Object.create(null), h = e.getSchema(), g = h ? h.getDirectives() : specifiedDirectives;
	for (let e of g) m[e.name] = !e.isRepeatable;
	let _ = e.getDocument().definitions;
	for (let e of _) e.kind === Kind.DIRECTIVE_DEFINITION && (m[e.name.value] = !e.repeatable);
	let v = Object.create(null), y = Object.create(null);
	return { enter(h) {
		if (!("directives" in h) || !h.directives) return;
		let g;
		if (h.kind === Kind.SCHEMA_DEFINITION || h.kind === Kind.SCHEMA_EXTENSION) g = v;
		else if (isTypeDefinitionNode(h) || isTypeExtensionNode(h)) {
			let e = h.name.value;
			g = y[e], g === void 0 && (y[e] = g = Object.create(null));
		} else g = Object.create(null);
		for (let _ of h.directives) {
			let h = _.name.value;
			m[h] && (g[h] ? e.reportError(new GraphQLError(`The directive "@${h}" can only be used once at this location.`, { nodes: [g[h], _] })) : g[h] = _);
		}
	} };
}
function UniqueEnumValueNamesRule(e) {
	let m = e.getSchema(), h = m ? m.getTypeMap() : Object.create(null), g = Object.create(null);
	return {
		EnumTypeDefinition: _,
		EnumTypeExtension: _
	};
	function _(m) {
		let _ = m.name.value;
		g[_] || (g[_] = Object.create(null));
		/* c8 ignore next */
		let v = m.values ?? [], y = g[_];
		for (let m of v) {
			let g = m.name.value, v = h[_];
			isEnumType(v) && v.getValue(g) ? e.reportError(new GraphQLError(`Enum value "${_}.${g}" already exists in the schema. It cannot also be defined in this type extension.`, { nodes: m.name })) : y[g] ? e.reportError(new GraphQLError(`Enum value "${_}.${g}" can only be defined once.`, { nodes: [y[g], m.name] })) : y[g] = m.name;
		}
		return !1;
	}
}
function UniqueFieldDefinitionNamesRule(e) {
	let m = e.getSchema(), h = m ? m.getTypeMap() : Object.create(null), g = Object.create(null);
	return {
		InputObjectTypeDefinition: _,
		InputObjectTypeExtension: _,
		InterfaceTypeDefinition: _,
		InterfaceTypeExtension: _,
		ObjectTypeDefinition: _,
		ObjectTypeExtension: _
	};
	function _(m) {
		let _ = m.name.value;
		g[_] || (g[_] = Object.create(null));
		/* c8 ignore next */
		let v = m.fields ?? [], y = g[_];
		for (let m of v) {
			let g = m.name.value;
			hasField(h[_], g) ? e.reportError(new GraphQLError(`Field "${_}.${g}" already exists in the schema. It cannot also be defined in this type extension.`, { nodes: m.name })) : y[g] ? e.reportError(new GraphQLError(`Field "${_}.${g}" can only be defined once.`, { nodes: [y[g], m.name] })) : y[g] = m.name;
		}
		return !1;
	}
}
function hasField(e, m) {
	return isObjectType(e) || isInterfaceType(e) || isInputObjectType(e) ? e.getFields()[m] != null : !1;
}
function UniqueFragmentNamesRule(e) {
	let m = Object.create(null);
	return {
		OperationDefinition: () => !1,
		FragmentDefinition(h) {
			let g = h.name.value;
			return m[g] ? e.reportError(new GraphQLError(`There can be only one fragment named "${g}".`, { nodes: [m[g], h.name] })) : m[g] = h.name, !1;
		}
	};
}
function UniqueInputFieldNamesRule(e) {
	let m = [], h = Object.create(null);
	return {
		ObjectValue: {
			enter() {
				m.push(h), h = Object.create(null);
			},
			leave() {
				let e = m.pop();
				e || invariant(!1), h = e;
			}
		},
		ObjectField(m) {
			let g = m.name.value;
			h[g] ? e.reportError(new GraphQLError(`There can be only one input field named "${g}".`, { nodes: [h[g], m.name] })) : h[g] = m.name;
		}
	};
}
function UniqueOperationNamesRule(e) {
	let m = Object.create(null);
	return {
		OperationDefinition(h) {
			let g = h.name;
			return g && (m[g.value] ? e.reportError(new GraphQLError(`There can be only one operation named "${g.value}".`, { nodes: [m[g.value], g] })) : m[g.value] = g), !1;
		},
		FragmentDefinition: () => !1
	};
}
function UniqueOperationTypesRule(e) {
	let m = e.getSchema(), h = Object.create(null), g = m ? {
		query: m.getQueryType(),
		mutation: m.getMutationType(),
		subscription: m.getSubscriptionType()
	} : {};
	return {
		SchemaDefinition: _,
		SchemaExtension: _
	};
	function _(m) {
		/* c8 ignore next */
		let _ = m.operationTypes ?? [];
		for (let m of _) {
			let _ = m.operation, v = h[_];
			g[_] ? e.reportError(new GraphQLError(`Type for ${_} already defined in the schema. It cannot be redefined.`, { nodes: m })) : v ? e.reportError(new GraphQLError(`There can be only one ${_} type in schema.`, { nodes: [v, m] })) : h[_] = m;
		}
		return !1;
	}
}
function UniqueTypeNamesRule(e) {
	let m = Object.create(null), h = e.getSchema();
	return {
		ScalarTypeDefinition: g,
		ObjectTypeDefinition: g,
		InterfaceTypeDefinition: g,
		UnionTypeDefinition: g,
		EnumTypeDefinition: g,
		InputObjectTypeDefinition: g
	};
	function g(g) {
		let _ = g.name.value;
		if (h != null && h.getType(_)) {
			e.reportError(new GraphQLError(`Type "${_}" already exists in the schema. It cannot also be defined in this type definition.`, { nodes: g.name }));
			return;
		}
		return m[_] ? e.reportError(new GraphQLError(`There can be only one type named "${_}".`, { nodes: [m[_], g.name] })) : m[_] = g.name, !1;
	}
}
function UniqueVariableNamesRule(e) {
	return { OperationDefinition(m) {
		/* c8 ignore next */
		let h = m.variableDefinitions ?? [], g = groupBy(h, (e) => e.variable.name.value);
		for (let [m, h] of g) h.length > 1 && e.reportError(new GraphQLError(`There can be only one variable named "$${m}".`, { nodes: h.map((e) => e.variable.name) }));
	} };
}
function ValuesOfCorrectTypeRule(e) {
	let m = {};
	return {
		OperationDefinition: { enter() {
			m = {};
		} },
		VariableDefinition(e) {
			m[e.variable.name.value] = e;
		},
		ListValue(m) {
			let h = getNullableType(e.getParentInputType());
			if (!isListType(h)) return isValidValueNode(e, m), !1;
		},
		ObjectValue(m) {
			let h = getNamedType(e.getInputType());
			if (!isInputObjectType(h)) return isValidValueNode(e, m), !1;
			let g = keyMap(m.fields, (e) => e.name.value);
			for (let _ of Object.values(h.getFields())) if (!g[_.name] && isRequiredInputField(_)) {
				let g = inspect(_.type);
				e.reportError(new GraphQLError(`Field "${h.name}.${_.name}" of required type "${g}" was not provided.`, { nodes: m }));
			}
			h.isOneOf && validateOneOfInputObject(e, m, h, g);
		},
		ObjectField(m) {
			let h = getNamedType(e.getParentInputType());
			if (!e.getInputType() && isInputObjectType(h)) {
				let g = suggestionList(m.name.value, Object.keys(h.getFields()));
				e.reportError(new GraphQLError(`Field "${m.name.value}" is not defined by type "${h.name}".` + didYouMean(g), { nodes: m }));
			}
		},
		NullValue(m) {
			let h = e.getInputType();
			isNonNullType(h) && e.reportError(new GraphQLError(`Expected value of type "${inspect(h)}", found ${print(m)}.`, { nodes: m }));
		},
		EnumValue: (m) => isValidValueNode(e, m),
		IntValue: (m) => isValidValueNode(e, m),
		FloatValue: (m) => isValidValueNode(e, m),
		StringValue: (m) => isValidValueNode(e, m),
		BooleanValue: (m) => isValidValueNode(e, m)
	};
}
function isValidValueNode(e, m) {
	let h = e.getInputType();
	if (!h) return;
	let g = getNamedType(h);
	if (!isLeafType(g)) {
		let g = inspect(h);
		e.reportError(new GraphQLError(`Expected value of type "${g}", found ${print(m)}.`, { nodes: m }));
		return;
	}
	try {
		if (g.parseLiteral(m, void 0) === void 0) {
			let g = inspect(h);
			e.reportError(new GraphQLError(`Expected value of type "${g}", found ${print(m)}.`, { nodes: m }));
		}
	} catch (g) {
		let _ = inspect(h);
		g instanceof GraphQLError ? e.reportError(g) : e.reportError(new GraphQLError(`Expected value of type "${_}", found ${print(m)}; ` + g.message, {
			nodes: m,
			originalError: g
		}));
	}
}
function validateOneOfInputObject(e, m, h, g) {
	let _ = Object.keys(g);
	if (_.length !== 1) {
		e.reportError(new GraphQLError(`OneOf Input Object "${h.name}" must specify exactly one key.`, { nodes: [m] }));
		return;
	}
	let v = g[_[0]]?.value;
	(!v || v.kind === Kind.NULL) && e.reportError(new GraphQLError(`Field "${h.name}.${_[0]}" must be non-null.`, { nodes: [m] }));
}
function VariablesAreInputTypesRule(e) {
	return { VariableDefinition(m) {
		let h = typeFromAST(e.getSchema(), m.type);
		if (h !== void 0 && !isInputType(h)) {
			let h = m.variable.name.value, g = print(m.type);
			e.reportError(new GraphQLError(`Variable "$${h}" cannot be non-input type "${g}".`, { nodes: m.type }));
		}
	} };
}
function VariablesInAllowedPositionRule(e) {
	let m = Object.create(null);
	return {
		OperationDefinition: {
			enter() {
				m = Object.create(null);
			},
			leave(h) {
				let g = e.getRecursiveVariableUsages(h);
				for (let { node: h, type: _, defaultValue: v, parentType: y } of g) {
					let g = h.name.value, b = m[g];
					if (b && _) {
						let m = e.getSchema(), x = typeFromAST(m, b.type);
						if (x && !allowedVariableUsage(m, x, b.defaultValue, _, v)) {
							let m = inspect(x), v = inspect(_);
							e.reportError(new GraphQLError(`Variable "$${g}" of type "${m}" used in position expecting type "${v}".`, { nodes: [b, h] }));
						}
						isInputObjectType(y) && y.isOneOf && isNullableType(x) && e.reportError(new GraphQLError(`Variable "$${g}" is of type "${x}" but must be non-nullable to be used for OneOf Input Object "${y}".`, { nodes: [b, h] }));
					}
				}
			}
		},
		VariableDefinition(e) {
			m[e.variable.name.value] = e;
		}
	};
}
function allowedVariableUsage(e, m, h, g, _) {
	if (isNonNullType(g) && !isNonNullType(m)) {
		if (!(h != null && h.kind !== Kind.NULL) && _ === void 0) return !1;
		let v = g.ofType;
		return isTypeSubTypeOf(e, m, v);
	}
	return isTypeSubTypeOf(e, m, g);
}
const recommendedRules = Object.freeze([MaxIntrospectionDepthRule]);
Object.freeze([
	ExecutableDefinitionsRule,
	UniqueOperationNamesRule,
	LoneAnonymousOperationRule,
	SingleFieldSubscriptionsRule,
	KnownTypeNamesRule,
	FragmentsOnCompositeTypesRule,
	VariablesAreInputTypesRule,
	ScalarLeafsRule,
	FieldsOnCorrectTypeRule,
	UniqueFragmentNamesRule,
	KnownFragmentNamesRule,
	NoUnusedFragmentsRule,
	PossibleFragmentSpreadsRule,
	NoFragmentCyclesRule,
	UniqueVariableNamesRule,
	NoUndefinedVariablesRule,
	NoUnusedVariablesRule,
	KnownDirectivesRule,
	UniqueDirectivesPerLocationRule,
	KnownArgumentNamesRule,
	UniqueArgumentNamesRule,
	ValuesOfCorrectTypeRule,
	ProvidedRequiredArgumentsRule,
	VariablesInAllowedPositionRule,
	OverlappingFieldsCanBeMergedRule,
	UniqueInputFieldNamesRule,
	...recommendedRules
]);
const specifiedSDLRules = Object.freeze([
	LoneSchemaDefinitionRule,
	UniqueOperationTypesRule,
	UniqueTypeNamesRule,
	UniqueEnumValueNamesRule,
	UniqueFieldDefinitionNamesRule,
	UniqueArgumentDefinitionNamesRule,
	UniqueDirectiveNamesRule,
	KnownTypeNamesRule,
	KnownDirectivesRule,
	UniqueDirectivesPerLocationRule,
	PossibleTypeExtensionsRule,
	KnownArgumentNamesOnDirectivesRule,
	UniqueArgumentNamesRule,
	UniqueInputFieldNamesRule,
	ProvidedRequiredArgumentsOnDirectivesRule
]);
var ASTValidationContext = class {
	constructor(e, m) {
		this._ast = e, this._fragments = void 0, this._fragmentSpreads = /* @__PURE__ */ new Map(), this._recursivelyReferencedFragments = /* @__PURE__ */ new Map(), this._onError = m;
	}
	get [Symbol.toStringTag]() {
		return "ASTValidationContext";
	}
	reportError(e) {
		this._onError(e);
	}
	getDocument() {
		return this._ast;
	}
	getFragment(e) {
		let m;
		if (this._fragments) m = this._fragments;
		else {
			m = Object.create(null);
			for (let e of this.getDocument().definitions) e.kind === Kind.FRAGMENT_DEFINITION && (m[e.name.value] = e);
			this._fragments = m;
		}
		return m[e];
	}
	getFragmentSpreads(e) {
		let m = this._fragmentSpreads.get(e);
		if (!m) {
			m = [];
			let h = [e], g;
			for (; g = h.pop();) for (let e of g.selections) e.kind === Kind.FRAGMENT_SPREAD ? m.push(e) : e.selectionSet && h.push(e.selectionSet);
			this._fragmentSpreads.set(e, m);
		}
		return m;
	}
	getRecursivelyReferencedFragments(e) {
		let m = this._recursivelyReferencedFragments.get(e);
		if (!m) {
			m = [];
			let h = Object.create(null), g = [e.selectionSet], _;
			for (; _ = g.pop();) for (let e of this.getFragmentSpreads(_)) {
				let _ = e.name.value;
				if (h[_] !== !0) {
					h[_] = !0;
					let e = this.getFragment(_);
					e && (m.push(e), g.push(e.selectionSet));
				}
			}
			this._recursivelyReferencedFragments.set(e, m);
		}
		return m;
	}
}, SDLValidationContext = class extends ASTValidationContext {
	constructor(e, m, h) {
		super(e, h), this._schema = m;
	}
	get [Symbol.toStringTag]() {
		return "SDLValidationContext";
	}
	getSchema() {
		return this._schema;
	}
};
Symbol.toStringTag;
function validateSDL(e, m, h = specifiedSDLRules) {
	let g = [], _ = new SDLValidationContext(e, m, (e) => {
		g.push(e);
	}), v = h.map((e) => e(_));
	return visit(e, visitInParallel(v)), g;
}
function assertValidSDL(e) {
	let m = validateSDL(e);
	if (m.length !== 0) throw Error(m.map((e) => e.message).join("\n\n"));
}
function extendSchemaImpl(e, m, h) {
	let g = [], _ = Object.create(null), v = [], C, E = [];
	for (let e of m.definitions) if (e.kind === Kind.SCHEMA_DEFINITION) C = e;
	else if (e.kind === Kind.SCHEMA_EXTENSION) E.push(e);
	else if (isTypeDefinitionNode(e)) g.push(e);
	else if (isTypeExtensionNode(e)) {
		let m = e.name.value, h = _[m];
		_[m] = h ? h.concat([e]) : [e];
	} else e.kind === Kind.DIRECTIVE_DEFINITION && v.push(e);
	if (Object.keys(_).length === 0 && g.length === 0 && v.length === 0 && E.length === 0 && C == null) return e;
	let D = Object.create(null);
	for (let m of e.types) D[m.name] = P(m);
	for (let e of g) {
		let m = e.name.value;
		D[m] = stdTypeMap[m] ?? $(e);
	}
	let O = {
		query: e.query && M(e.query),
		mutation: e.mutation && M(e.mutation),
		subscription: e.subscription && M(e.subscription),
		...C && U([C]),
		...U(E)
	};
	return {
		description: C?.description?.value,
		...O,
		types: Object.values(D),
		directives: [...e.directives.map(N), ...v.map(K)],
		extensions: Object.create(null),
		astNode: C ?? e.astNode,
		extensionASTNodes: e.extensionASTNodes.concat(E),
		assumeValid: h?.assumeValid ?? !1
	};
	function A(e) {
		return isListType(e) ? new GraphQLList(A(e.ofType)) : isNonNullType(e) ? new GraphQLNonNull(A(e.ofType)) : M(e);
	}
	function M(e) {
		return D[e.name];
	}
	function N(e) {
		let m = e.toConfig();
		return new GraphQLDirective({
			...m,
			args: mapValue(m.args, H)
		});
	}
	function P(e) {
		if (isIntrospectionType(e) || isSpecifiedScalarType(e)) return e;
		if (isScalarType(e)) return L(e);
		if (isObjectType(e)) return R(e);
		if (isInterfaceType(e)) return z(e);
		if (isUnionType(e)) return B(e);
		if (isEnumType(e)) return I(e);
		if (isInputObjectType(e)) return F(e);
		/* c8 ignore next 3 */
		invariant(!1, "Unexpected type: " + inspect(e));
	}
	function F(e) {
		let m = e.toConfig(), h = _[m.name] ?? [];
		return new GraphQLInputObjectType({
			...m,
			fields: () => ({
				...mapValue(m.fields, (e) => ({
					...e,
					type: A(e.type)
				})),
				...Y(h)
			}),
			extensionASTNodes: m.extensionASTNodes.concat(h)
		});
	}
	function I(e) {
		let m = e.toConfig(), h = _[e.name] ?? [];
		return new GraphQLEnumType({
			...m,
			values: {
				...m.values,
				...X(h)
			},
			extensionASTNodes: m.extensionASTNodes.concat(h)
		});
	}
	function L(e) {
		let m = e.toConfig(), h = _[m.name] ?? [], g = m.specifiedByURL;
		for (let e of h) g = getSpecifiedByURL(e) ?? g;
		return new GraphQLScalarType({
			...m,
			specifiedByURL: g,
			extensionASTNodes: m.extensionASTNodes.concat(h)
		});
	}
	function R(e) {
		let m = e.toConfig(), h = _[m.name] ?? [];
		return new GraphQLObjectType({
			...m,
			interfaces: () => [...e.getInterfaces().map(M), ...Z(h)],
			fields: () => ({
				...mapValue(m.fields, V),
				...q(h)
			}),
			extensionASTNodes: m.extensionASTNodes.concat(h)
		});
	}
	function z(e) {
		let m = e.toConfig(), h = _[m.name] ?? [];
		return new GraphQLInterfaceType({
			...m,
			interfaces: () => [...e.getInterfaces().map(M), ...Z(h)],
			fields: () => ({
				...mapValue(m.fields, V),
				...q(h)
			}),
			extensionASTNodes: m.extensionASTNodes.concat(h)
		});
	}
	function B(e) {
		let m = e.toConfig(), h = _[m.name] ?? [];
		return new GraphQLUnionType({
			...m,
			types: () => [...e.getTypes().map(M), ...Q(h)],
			extensionASTNodes: m.extensionASTNodes.concat(h)
		});
	}
	function V(e) {
		return {
			...e,
			type: A(e.type),
			args: e.args && mapValue(e.args, H)
		};
	}
	function H(e) {
		return {
			...e,
			type: A(e.type)
		};
	}
	function U(e) {
		let m = {};
		for (let h of e) {
			let e = h.operationTypes ?? [];
			for (let h of e) m[h.operation] = W(h.type);
		}
		return m;
	}
	function W(e) {
		let m = e.name.value, h = stdTypeMap[m] ?? D[m];
		if (h === void 0) throw Error(`Unknown type: "${m}".`);
		return h;
	}
	function G(e) {
		return e.kind === Kind.LIST_TYPE ? new GraphQLList(G(e.type)) : e.kind === Kind.NON_NULL_TYPE ? new GraphQLNonNull(G(e.type)) : W(e);
	}
	function K(e) {
		return new GraphQLDirective({
			name: e.name.value,
			description: e.description?.value,
			locations: e.locations.map(({ value: e }) => e),
			isRepeatable: e.repeatable,
			args: J(e.arguments),
			astNode: e
		});
	}
	function q(e) {
		let m = Object.create(null);
		for (let h of e) {
			let e = h.fields ?? [];
			for (let h of e) m[h.name.value] = {
				type: G(h.type),
				description: h.description?.value,
				args: J(h.arguments),
				deprecationReason: getDeprecationReason(h),
				astNode: h
			};
		}
		return m;
	}
	function J(e) {
		let m = e ?? [], h = Object.create(null);
		for (let e of m) {
			let m = G(e.type);
			h[e.name.value] = {
				type: m,
				description: e.description?.value,
				defaultValue: valueFromAST(e.defaultValue, m),
				deprecationReason: getDeprecationReason(e),
				astNode: e
			};
		}
		return h;
	}
	function Y(e) {
		let m = Object.create(null);
		for (let h of e) {
			let e = h.fields ?? [];
			for (let h of e) {
				let e = G(h.type);
				m[h.name.value] = {
					type: e,
					description: h.description?.value,
					defaultValue: valueFromAST(h.defaultValue, e),
					deprecationReason: getDeprecationReason(h),
					astNode: h
				};
			}
		}
		return m;
	}
	function X(e) {
		let m = Object.create(null);
		for (let h of e) {
			let e = h.values ?? [];
			for (let h of e) m[h.name.value] = {
				description: h.description?.value,
				deprecationReason: getDeprecationReason(h),
				astNode: h
			};
		}
		return m;
	}
	function Z(e) {
		return e.flatMap((e) => e.interfaces?.map(W) ?? []);
	}
	function Q(e) {
		return e.flatMap((e) => e.types?.map(W) ?? []);
	}
	function $(e) {
		let m = e.name.value, h = _[m] ?? [];
		switch (e.kind) {
			case Kind.OBJECT_TYPE_DEFINITION: {
				let g = [e, ...h];
				return new GraphQLObjectType({
					name: m,
					description: e.description?.value,
					interfaces: () => Z(g),
					fields: () => q(g),
					astNode: e,
					extensionASTNodes: h
				});
			}
			case Kind.INTERFACE_TYPE_DEFINITION: {
				let g = [e, ...h];
				return new GraphQLInterfaceType({
					name: m,
					description: e.description?.value,
					interfaces: () => Z(g),
					fields: () => q(g),
					astNode: e,
					extensionASTNodes: h
				});
			}
			case Kind.ENUM_TYPE_DEFINITION: {
				let g = [e, ...h];
				return new GraphQLEnumType({
					name: m,
					description: e.description?.value,
					values: X(g),
					astNode: e,
					extensionASTNodes: h
				});
			}
			case Kind.UNION_TYPE_DEFINITION: {
				let g = [e, ...h];
				return new GraphQLUnionType({
					name: m,
					description: e.description?.value,
					types: () => Q(g),
					astNode: e,
					extensionASTNodes: h
				});
			}
			case Kind.SCALAR_TYPE_DEFINITION: return new GraphQLScalarType({
				name: m,
				description: e.description?.value,
				specifiedByURL: getSpecifiedByURL(e),
				astNode: e,
				extensionASTNodes: h
			});
			case Kind.INPUT_OBJECT_TYPE_DEFINITION: {
				let g = [e, ...h];
				return new GraphQLInputObjectType({
					name: m,
					description: e.description?.value,
					fields: () => Y(g),
					astNode: e,
					extensionASTNodes: h,
					isOneOf: isOneOf(e)
				});
			}
		}
	}
}
var stdTypeMap = keyMap([...specifiedScalarTypes, ...introspectionTypes], (e) => e.name);
function getDeprecationReason(e) {
	return getDirectiveValues(GraphQLDeprecatedDirective, e)?.reason;
}
function getSpecifiedByURL(e) {
	return getDirectiveValues(GraphQLSpecifiedByDirective, e)?.url;
}
function isOneOf(e) {
	return !!getDirectiveValues(GraphQLOneOfDirective, e);
}
function buildASTSchema(e, m) {
	e != null && e.kind === Kind.DOCUMENT || devAssert(!1, "Must provide valid Document AST."), m?.assumeValid !== !0 && m?.assumeValidSDL !== !0 && assertValidSDL(e);
	let h = extendSchemaImpl({
		description: void 0,
		types: [],
		directives: [],
		extensions: Object.create(null),
		extensionASTNodes: [],
		assumeValid: !1
	}, e, m);
	if (h.astNode == null) for (let e of h.types) switch (e.name) {
		case "Query":
			h.query = e;
			break;
		case "Mutation":
			h.mutation = e;
			break;
		case "Subscription":
			h.subscription = e;
			break;
	}
	let g = [...h.directives, ...specifiedDirectives.filter((e) => h.directives.every((m) => m.name !== e.name))];
	return new GraphQLSchema({
		...h,
		directives: g
	});
}
function printSchema(e) {
	return printFilteredSchema(e, (e) => !isSpecifiedDirective(e), isDefinedType);
}
function isDefinedType(e) {
	return !isSpecifiedScalarType(e) && !isIntrospectionType(e);
}
function printFilteredSchema(e, m, h) {
	let g = e.getDirectives().filter(m), _ = Object.values(e.getTypeMap()).filter(h);
	return [
		printSchemaDefinition(e),
		...g.map((e) => printDirective(e)),
		..._.map((e) => printType(e))
	].filter(Boolean).join("\n\n");
}
function printSchemaDefinition(e) {
	if (e.description == null && isSchemaOfCommonNames(e)) return;
	let m = [], h = e.getQueryType();
	h && m.push(`  query: ${h.name}`);
	let g = e.getMutationType();
	g && m.push(`  mutation: ${g.name}`);
	let _ = e.getSubscriptionType();
	return _ && m.push(`  subscription: ${_.name}`), printDescription(e) + `schema {\n${m.join("\n")}\n}`;
}
function isSchemaOfCommonNames(e) {
	let m = e.getQueryType();
	if (m && m.name !== "Query") return !1;
	let h = e.getMutationType();
	if (h && h.name !== "Mutation") return !1;
	let g = e.getSubscriptionType();
	return !(g && g.name !== "Subscription");
}
function printType(e) {
	if (isScalarType(e)) return printScalar(e);
	if (isObjectType(e)) return printObject(e);
	if (isInterfaceType(e)) return printInterface(e);
	if (isUnionType(e)) return printUnion(e);
	if (isEnumType(e)) return printEnum(e);
	if (isInputObjectType(e)) return printInputObject(e);
	/* c8 ignore next 3 */
	invariant(!1, "Unexpected type: " + inspect(e));
}
function printScalar(e) {
	return printDescription(e) + `scalar ${e.name}` + printSpecifiedByURL(e);
}
function printImplementedInterfaces(e) {
	let m = e.getInterfaces();
	return m.length ? " implements " + m.map((e) => e.name).join(" & ") : "";
}
function printObject(e) {
	return printDescription(e) + `type ${e.name}` + printImplementedInterfaces(e) + printFields(e);
}
function printInterface(e) {
	return printDescription(e) + `interface ${e.name}` + printImplementedInterfaces(e) + printFields(e);
}
function printUnion(e) {
	let m = e.getTypes(), h = m.length ? " = " + m.join(" | ") : "";
	return printDescription(e) + "union " + e.name + h;
}
function printEnum(e) {
	let m = e.getValues().map((e, m) => printDescription(e, "  ", !m) + "  " + e.name + printDeprecated(e.deprecationReason));
	return printDescription(e) + `enum ${e.name}` + printBlock(m);
}
function printInputObject(e) {
	let m = Object.values(e.getFields()).map((e, m) => printDescription(e, "  ", !m) + "  " + printInputValue(e));
	return printDescription(e) + `input ${e.name}` + (e.isOneOf ? " @oneOf" : "") + printBlock(m);
}
function printFields(e) {
	let m = Object.values(e.getFields()).map((e, m) => printDescription(e, "  ", !m) + "  " + e.name + printArgs(e.args, "  ") + ": " + String(e.type) + printDeprecated(e.deprecationReason));
	return printBlock(m);
}
function printBlock(e) {
	return e.length === 0 ? "" : " {\n" + e.join("\n") + "\n}";
}
function printArgs(e, m = "") {
	return e.length === 0 ? "" : e.every((e) => !e.description) ? "(" + e.map(printInputValue).join(", ") + ")" : "(\n" + e.map((e, h) => printDescription(e, "  " + m, !h) + "  " + m + printInputValue(e)).join("\n") + "\n" + m + ")";
}
function printInputValue(e) {
	let m = astFromValue(e.defaultValue, e.type), h = e.name + ": " + String(e.type);
	return m && (h += ` = ${print(m)}`), h + printDeprecated(e.deprecationReason);
}
function printDirective(e) {
	return printDescription(e) + "directive @" + e.name + printArgs(e.args) + (e.isRepeatable ? " repeatable" : "") + " on " + e.locations.join(" | ");
}
function printDeprecated(e) {
	return e == null ? "" : e === "No longer supported" ? " @deprecated" : ` @deprecated(reason: ${print({
		kind: Kind.STRING,
		value: e
	})})`;
}
function printSpecifiedByURL(e) {
	return e.specifiedByURL == null ? "" : ` @specifiedBy(url: ${print({
		kind: Kind.STRING,
		value: e.specifiedByURL
	})})`;
}
function printDescription(e, m = "", h = !0) {
	let { description: g } = e;
	if (g == null) return "";
	let _ = print({
		kind: Kind.STRING,
		value: g,
		block: isPrintableAsBlockString(g)
	});
	return (m && !h ? "\n" + m : m) + _.replace(/\n/g, "\n" + m) + "\n";
}
var DocumentUri;
(function(e) {
	function m(e) {
		return typeof e == "string";
	}
	e.is = m;
})(DocumentUri ||= {});
var URI;
(function(e) {
	function m(e) {
		return typeof e == "string";
	}
	e.is = m;
})(URI ||= {});
var integer;
(function(e) {
	e.MIN_VALUE = -2147483648, e.MAX_VALUE = 2147483647;
	function m(m) {
		return typeof m == "number" && e.MIN_VALUE <= m && m <= e.MAX_VALUE;
	}
	e.is = m;
})(integer ||= {});
var uinteger;
(function(e) {
	e.MIN_VALUE = 0, e.MAX_VALUE = 2147483647;
	function m(m) {
		return typeof m == "number" && e.MIN_VALUE <= m && m <= e.MAX_VALUE;
	}
	e.is = m;
})(uinteger ||= {});
var Position;
(function(e) {
	function m(e, m) {
		return e === Number.MAX_VALUE && (e = uinteger.MAX_VALUE), m === Number.MAX_VALUE && (m = uinteger.MAX_VALUE), {
			line: e,
			character: m
		};
	}
	e.create = m;
	function h(e) {
		let m = e;
		return Is.objectLiteral(m) && Is.uinteger(m.line) && Is.uinteger(m.character);
	}
	e.is = h;
})(Position ||= {});
var Range;
(function(e) {
	function m(e, m, h, g) {
		if (Is.uinteger(e) && Is.uinteger(m) && Is.uinteger(h) && Is.uinteger(g)) return {
			start: Position.create(e, m),
			end: Position.create(h, g)
		};
		if (Position.is(e) && Position.is(m)) return {
			start: e,
			end: m
		};
		throw Error(`Range#create called with invalid arguments[${e}, ${m}, ${h}, ${g}]`);
	}
	e.create = m;
	function h(e) {
		let m = e;
		return Is.objectLiteral(m) && Position.is(m.start) && Position.is(m.end);
	}
	e.is = h;
})(Range ||= {});
var Location;
(function(e) {
	function m(e, m) {
		return {
			uri: e,
			range: m
		};
	}
	e.create = m;
	function h(e) {
		let m = e;
		return Is.objectLiteral(m) && Range.is(m.range) && (Is.string(m.uri) || Is.undefined(m.uri));
	}
	e.is = h;
})(Location ||= {});
var LocationLink;
(function(e) {
	function m(e, m, h, g) {
		return {
			targetUri: e,
			targetRange: m,
			targetSelectionRange: h,
			originSelectionRange: g
		};
	}
	e.create = m;
	function h(e) {
		let m = e;
		return Is.objectLiteral(m) && Range.is(m.targetRange) && Is.string(m.targetUri) && Range.is(m.targetSelectionRange) && (Range.is(m.originSelectionRange) || Is.undefined(m.originSelectionRange));
	}
	e.is = h;
})(LocationLink ||= {});
var Color;
(function(e) {
	function m(e, m, h, g) {
		return {
			red: e,
			green: m,
			blue: h,
			alpha: g
		};
	}
	e.create = m;
	function h(e) {
		let m = e;
		return Is.objectLiteral(m) && Is.numberRange(m.red, 0, 1) && Is.numberRange(m.green, 0, 1) && Is.numberRange(m.blue, 0, 1) && Is.numberRange(m.alpha, 0, 1);
	}
	e.is = h;
})(Color ||= {});
var ColorInformation;
(function(e) {
	function m(e, m) {
		return {
			range: e,
			color: m
		};
	}
	e.create = m;
	function h(e) {
		let m = e;
		return Is.objectLiteral(m) && Range.is(m.range) && Color.is(m.color);
	}
	e.is = h;
})(ColorInformation ||= {});
var ColorPresentation;
(function(e) {
	function m(e, m, h) {
		return {
			label: e,
			textEdit: m,
			additionalTextEdits: h
		};
	}
	e.create = m;
	function h(e) {
		let m = e;
		return Is.objectLiteral(m) && Is.string(m.label) && (Is.undefined(m.textEdit) || TextEdit.is(m)) && (Is.undefined(m.additionalTextEdits) || Is.typedArray(m.additionalTextEdits, TextEdit.is));
	}
	e.is = h;
})(ColorPresentation ||= {});
var FoldingRangeKind;
(function(e) {
	e.Comment = "comment", e.Imports = "imports", e.Region = "region";
})(FoldingRangeKind ||= {});
var FoldingRange;
(function(e) {
	function m(e, m, h, g, _, v) {
		let y = {
			startLine: e,
			endLine: m
		};
		return Is.defined(h) && (y.startCharacter = h), Is.defined(g) && (y.endCharacter = g), Is.defined(_) && (y.kind = _), Is.defined(v) && (y.collapsedText = v), y;
	}
	e.create = m;
	function h(e) {
		let m = e;
		return Is.objectLiteral(m) && Is.uinteger(m.startLine) && Is.uinteger(m.startLine) && (Is.undefined(m.startCharacter) || Is.uinteger(m.startCharacter)) && (Is.undefined(m.endCharacter) || Is.uinteger(m.endCharacter)) && (Is.undefined(m.kind) || Is.string(m.kind));
	}
	e.is = h;
})(FoldingRange ||= {});
var DiagnosticRelatedInformation;
(function(e) {
	function m(e, m) {
		return {
			location: e,
			message: m
		};
	}
	e.create = m;
	function h(e) {
		let m = e;
		return Is.defined(m) && Location.is(m.location) && Is.string(m.message);
	}
	e.is = h;
})(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 m(e) {
		let m = e;
		return Is.objectLiteral(m) && Is.string(m.href);
	}
	e.is = m;
})(CodeDescription ||= {});
var Diagnostic;
(function(e) {
	function m(e, m, h, g, _, v) {
		let y = {
			range: e,
			message: m
		};
		return Is.defined(h) && (y.severity = h), Is.defined(g) && (y.code = g), Is.defined(_) && (y.source = _), Is.defined(v) && (y.relatedInformation = v), y;
	}
	e.create = m;
	function h(e) {
		let m = e;
		return Is.defined(m) && Range.is(m.range) && Is.string(m.message) && (Is.number(m.severity) || Is.undefined(m.severity)) && (Is.integer(m.code) || Is.string(m.code) || Is.undefined(m.code)) && (Is.undefined(m.codeDescription) || Is.string(m.codeDescription?.href)) && (Is.string(m.source) || Is.undefined(m.source)) && (Is.undefined(m.relatedInformation) || Is.typedArray(m.relatedInformation, DiagnosticRelatedInformation.is));
	}
	e.is = h;
})(Diagnostic ||= {});
var Command;
(function(e) {
	function m(e, m, ...h) {
		let g = {
			title: e,
			command: m
		};
		return Is.defined(h) && h.length > 0 && (g.arguments = h), g;
	}
	e.create = m;
	function h(e) {
		let m = e;
		return Is.defined(m) && Is.string(m.title) && Is.string(m.command);
	}
	e.is = h;
})(Command ||= {});
var TextEdit;
(function(e) {
	function m(e, m) {
		return {
			range: e,
			newText: m
		};
	}
	e.replace = m;
	function h(e, m) {
		return {
			range: {
				start: e,
				end: e
			},
			newText: m
		};
	}
	e.insert = h;
	function g(e) {
		return {
			range: e,
			newText: ""
		};
	}
	e.del = g;
	function _(e) {
		let m = e;
		return Is.objectLiteral(m) && Is.string(m.newText) && Range.is(m.range);
	}
	e.is = _;
})(TextEdit ||= {});
var ChangeAnnotation;
(function(e) {
	function m(e, m, h) {
		let g = { label: e };
		return m !== void 0 && (g.needsConfirmation = m), h !== void 0 && (g.description = h), g;
	}
	e.create = m;
	function h(e) {
		let m = e;
		return Is.objectLiteral(m) && Is.string(m.label) && (Is.boolean(m.needsConfirmation) || m.needsConfirmation === void 0) && (Is.string(m.description) || m.description === void 0);
	}
	e.is = h;
})(ChangeAnnotation ||= {});
var ChangeAnnotationIdentifier;
(function(e) {
	function m(e) {
		let m = e;
		return Is.string(m);
	}
	e.is = m;
})(ChangeAnnotationIdentifier ||= {});
var AnnotatedTextEdit;
(function(e) {
	function m(e, m, h) {
		return {
			range: e,
			newText: m,
			annotationId: h
		};
	}
	e.replace = m;
	function h(e, m, h) {
		return {
			range: {
				start: e,
				end: e
			},
			newText: m,
			annotationId: h
		};
	}
	e.insert = h;
	function g(e, m) {
		return {
			range: e,
			newText: "",
			annotationId: m
		};
	}
	e.del = g;
	function _(e) {
		let m = e;
		return TextEdit.is(m) && (ChangeAnnotation.is(m.annotationId) || ChangeAnnotationIdentifier.is(m.annotationId));
	}
	e.is = _;
})(AnnotatedTextEdit ||= {});
var TextDocumentEdit;
(function(e) {
	function m(e, m) {
		return {
			textDocument: e,
			edits: m
		};
	}
	e.create = m;
	function h(e) {
		let m = e;
		return Is.defined(m) && OptionalVersionedTextDocumentIdentifier.is(m.textDocument) && Array.isArray(m.edits);
	}
	e.is = h;
})(TextDocumentEdit ||= {});
var CreateFile;
(function(e) {
	function m(e, m, h) {
		let g = {
			kind: "create",
			uri: e
		};
		return m !== void 0 && (m.overwrite !== void 0 || m.ignoreIfExists !== void 0) && (g.options = m), h !== void 0 && (g.annotationId = h), g;
	}
	e.create = m;
	function h(e) {
		let m = e;
		return m && m.kind === "create" && Is.string(m.uri) && (m.options === void 0 || (m.options.overwrite === void 0 || Is.boolean(m.options.overwrite)) && (m.options.ignoreIfExists === void 0 || Is.boolean(m.options.ignoreIfExists))) && (m.annotationId === void 0 || ChangeAnnotationIdentifier.is(m.annotationId));
	}
	e.is = h;
})(CreateFile ||= {});
var RenameFile;
(function(e) {
	function m(e, m, h, g) {
		let _ = {
			kind: "rename",
			oldUri: e,
			newUri: m
		};
		return h !== void 0 && (h.overwrite !== void 0 || h.ignoreIfExists !== void 0) && (_.options = h), g !== void 0 && (_.annotationId = g), _;
	}
	e.create = m;
	function h(e) {
		let m = e;
		return m && m.kind === "rename" && Is.string(m.oldUri) && Is.string(m.newUri) && (m.options === void 0 || (m.options.overwrite === void 0 || Is.boolean(m.options.overwrite)) && (m.options.ignoreIfExists === void 0 || Is.boolean(m.options.ignoreIfExists))) && (m.annotationId === void 0 || ChangeAnnotationIdentifier.is(m.annotationId));
	}
	e.is = h;
})(RenameFile ||= {});
var DeleteFile;
(function(e) {
	function m(e, m, h) {
		let g = {
			kind: "delete",
			uri: e
		};
		return m !== void 0 && (m.recursive !== void 0 || m.ignoreIfNotExists !== void 0) && (g.options = m), h !== void 0 && (g.annotationId = h), g;
	}
	e.create = m;
	function h(e) {
		let m = e;
		return m && m.kind === "delete" && Is.string(m.uri) && (m.options === void 0 || (m.options.recursive === void 0 || Is.boolean(m.options.recursive)) && (m.options.ignoreIfNotExists === void 0 || Is.boolean(m.options.ignoreIfNotExists))) && (m.annotationId === void 0 || ChangeAnnotationIdentifier.is(m.annotationId));
	}
	e.is = h;
})(DeleteFile ||= {});
var WorkspaceEdit;
(function(e) {
	function m(e) {
		let m = e;
		return m && (m.changes !== void 0 || m.documentChanges !== void 0) && (m.documentChanges === void 0 || m.documentChanges.every((e) => Is.string(e.kind) ? CreateFile.is(e) || RenameFile.is(e) || DeleteFile.is(e) : TextDocumentEdit.is(e)));
	}
	e.is = m;
})(WorkspaceEdit ||= {});
var TextDocumentIdentifier;
(function(e) {
	function m(e) {
		return { uri: e };
	}
	e.create = m;
	function h(e) {
		let m = e;
		return Is.defined(m) && Is.string(m.uri);
	}
	e.is = h;
})(TextDocumentIdentifier ||= {});
var VersionedTextDocumentIdentifier;
(function(e) {
	function m(e, m) {
		return {
			uri: e,
			version: m
		};
	}
	e.create = m;
	function h(e) {
		let m = e;
		return Is.defined(m) && Is.string(m.uri) && Is.integer(m.version);
	}
	e.is = h;
})(VersionedTextDocumentIdentifier ||= {});
var OptionalVersionedTextDocumentIdentifier;
(function(e) {
	function m(e, m) {
		return {
			uri: e,
			version: m
		};
	}
	e.create = m;
	function h(e) {
		let m = e;
		return Is.defined(m) && Is.string(m.uri) && (m.version === null || Is.integer(m.version));
	}
	e.is = h;
})(OptionalVersionedTextDocumentIdentifier ||= {});
var TextDocumentItem;
(function(e) {
	function m(e, m, h, g) {
		return {
			uri: e,
			languageId: m,
			version: h,
			text: g
		};
	}
	e.create = m;
	function h(e) {
		let m = e;
		return Is.defined(m) && Is.string(m.uri) && Is.string(m.languageId) && Is.integer(m.version) && Is.string(m.text);
	}
	e.is = h;
})(TextDocumentItem ||= {});
var MarkupKind;
(function(e) {
	e.PlainText = "plaintext", e.Markdown = "markdown";
	function m(m) {
		let h = m;
		return h === e.PlainText || h === e.Markdown;
	}
	e.is = m;
})(MarkupKind ||= {});
var MarkupContent;
(function(e) {
	function m(e) {
		let m = e;
		return Is.objectLiteral(e) && MarkupKind.is(m.kind) && Is.string(m.value);
	}
	e.is = m;
})(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 m(e, m, h) {
		return {
			newText: e,
			insert: m,
			replace: h
		};
	}
	e.create = m;
	function h(e) {
		let m = e;
		return m && Is.string(m.newText) && Range.is(m.insert) && Range.is(m.replace);
	}
	e.is = h;
})(InsertReplaceEdit ||= {});
var InsertTextMode;
(function(e) {
	e.asIs = 1, e.adjustIndentation = 2;
})(InsertTextMode ||= {});
var CompletionItemLabelDetails;
(function(e) {
	function m(e) {
		let m = e;
		return m && (Is.string(m.detail) || m.detail === void 0) && (Is.string(m.description) || m.description === void 0);
	}
	e.is = m;
})(CompletionItemLabelDetails ||= {});
var CompletionItem;
(function(e) {
	function m(e) {
		return { label: e };
	}
	e.create = m;
})(CompletionItem ||= {});
var CompletionList;
(function(e) {
	function m(e, m) {
		return {
			items: e || [],
			isIncomplete: !!m
		};
	}
	e.create = m;
})(CompletionList ||= {});
var MarkedString;
(function(e) {
	function m(e) {
		return e.replace(/[\\`*_{}[\]()#+\-.!]/g, "\\$&");
	}
	e.fromPlainText = m;
	function h(e) {
		let m = e;
		return Is.string(m) || Is.objectLiteral(m) && Is.string(m.language) && Is.string(m.value);
	}
	e.is = h;
})(MarkedString ||= {});
var Hover;
(function(e) {
	function m(e) {
		let m = e;
		return !!m && Is.objectLiteral(m) && (MarkupContent.is(m.contents) || MarkedString.is(m.contents) || Is.typedArray(m.contents, MarkedString.is)) && (e.range === void 0 || Range.is(e.range));
	}
	e.is = m;
})(Hover ||= {});
var ParameterInformation;
(function(e) {
	function m(e, m) {
		return m ? {
			label: e,
			documentation: m
		} : { label: e };
	}
	e.create = m;
})(ParameterInformation ||= {});
var SignatureInformation;
(function(e) {
	function m(e, m, ...h) {
		let g = { label: e };
		return Is.defined(m) && (g.documentation = m), Is.defined(h) ? g.parameters = h : g.parameters = [], g;
	}
	e.create = m;
})(SignatureInformation ||= {});
var DocumentHighlightKind;
(function(e) {
	e.Text = 1, e.Read = 2, e.Write = 3;
})(DocumentHighlightKind ||= {});
var DocumentHighlight;
(function(e) {
	function m(e, m) {
		let h = { range: e };
		return Is.number(m) && (h.kind = m), h;
	}
	e.create = m;
})(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 m(e, m, h, g, _) {
		let v = {
			name: e,
			kind: m,
			location: {
				uri: g,
				range: h
			}
		};
		return _ && (v.containerName = _), v;
	}
	e.create = m;
})(SymbolInformation ||= {});
var WorkspaceSymbol;
(function(e) {
	function m(e, m, h, g) {
		return g === void 0 ? {
			name: e,
			kind: m,
			location: { uri: h }
		} : {
			name: e,
			kind: m,
			location: {
				uri: h,
				range: g
			}
		};
	}
	e.create = m;
})(WorkspaceSymbol ||= {});
var DocumentSymbol;
(function(e) {
	function m(e, m, h, g, _, v) {
		let y = {
			name: e,
			detail: m,
			kind: h,
			range: g,
			selectionRange: _
		};
		return v !== void 0 && (y.children = v), y;
	}
	e.create = m;
	function h(e) {
		let m = e;
		return m && Is.string(m.name) && Is.number(m.kind) && Range.is(m.range) && Range.is(m.selectionRange) && (m.detail === void 0 || Is.string(m.detail)) && (m.deprecated === void 0 || Is.boolean(m.deprecated)) && (m.children === void 0 || Array.isArray(m.children)) && (m.tags === void 0 || Array.isArray(m.tags));
	}
	e.is = h;
})(DocumentSymbol ||= {});
var CodeActionKind;
(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 ||= {});
var CodeActionTriggerKind;
(function(e) {
	e.Invoked = 1, e.Automatic = 2;
})(CodeActionTriggerKind ||= {});
var CodeActionContext;
(function(e) {
	function m(e, m, h) {
		let g = { diagnostics: e };
		return m != null && (g.only = m), h != null && (g.triggerKind = h), g;
	}
	e.create = m;
	function h(e) {
		let m = e;
		return Is.defined(m) && Is.typedArray(m.diagnostics, Diagnostic.is) && (m.only === void 0 || Is.typedArray(m.only, Is.string)) && (m.triggerKind === void 0 || m.triggerKind === CodeActionTriggerKind.Invoked || m.triggerKind === CodeActionTriggerKind.Automatic);
	}
	e.is = h;
})(CodeActionContext ||= {});
var CodeAction;
(function(e) {
	function m(e, m, h) {
		let g = { title: e }, _ = !0;
		return typeof m == "string" ? (_ = !1, g.kind = m) : Command.is(m) ? g.command = m : g.edit = m, _ && h !== void 0 && (g.kind = h), g;
	}
	e.create = m;
	function h(e) {
		let m = e;
		return m && Is.string(m.title) && (m.diagnostics === void 0 || Is.typedArray(m.diagnostics, Diagnostic.is)) && (m.kind === void 0 || Is.string(m.kind)) && (m.edit !== void 0 || m.command !== void 0) && (m.command === void 0 || Command.is(m.command)) && (m.isPreferred === void 0 || Is.boolean(m.isPreferred)) && (m.edit === void 0 || WorkspaceEdit.is(m.edit));
	}
	e.is = h;
})(CodeAction ||= {});
var CodeLens;
(function(e) {
	function m(e, m) {
		let h = { range: e };
		return Is.defined(m) && (h.data = m), h;
	}
	e.create = m;
	function h(e) {
		let m = e;
		return Is.defined(m) && Range.is(m.range) && (Is.undefined(m.command) || Command.is(m.command));
	}
	e.is = h;
})(CodeLens ||= {});
var FormattingOptions;
(function(e) {
	function m(e, m) {
		return {
			tabSize: e,
			insertSpaces: m
		};
	}
	e.create = m;
	function h(e) {
		let m = e;
		return Is.defined(m) && Is.uinteger(m.tabSize) && Is.boolean(m.insertSpaces);
	}
	e.is = h;
})(FormattingOptions ||= {});
var DocumentLink;
(function(e) {
	function m(e, m, h) {
		return {
			range: e,
			target: m,
			data: h
		};
	}
	e.create = m;
	function h(e) {
		let m = e;
		return Is.defined(m) && Range.is(m.range) && (Is.undefined(m.target) || Is.string(m.target));
	}
	e.is = h;
})(DocumentLink ||= {});
var SelectionRange;
(function(e) {
	function m(e, m) {
		return {
			range: e,
			parent: m
		};
	}
	e.create = m;
	function h(m) {
		let h = m;
		return Is.objectLiteral(h) && Range.is(h.range) && (h.parent === void 0 || e.is(h.parent));
	}
	e.is = h;
})(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 m(e) {
		let m = e;
		return Is.objectLiteral(m) && (m.resultId === void 0 || typeof m.resultId == "string") && Array.isArray(m.data) && (m.data.length === 0 || typeof m.data[0] == "number");
	}
	e.is = m;
})(SemanticTokens ||= {});
var InlineValueText;
(function(e) {
	function m(e, m) {
		return {
			range: e,
			text: m
		};
	}
	e.create = m;
	function h(e) {
		let m = e;
		return m != null && Range.is(m.range) && Is.string(m.text);
	}
	e.is = h;
})(InlineValueText ||= {});
var InlineValueVariableLookup;
(function(e) {
	function m(e, m, h) {
		return {
			range: e,
			variableName: m,
			caseSensitiveLookup: h
		};
	}
	e.create = m;
	function h(e) {
		let m = e;
		return m != null && Range.is(m.range) && Is.boolean(m.caseSensitiveLookup) && (Is.string(m.variableName) || m.variableName === void 0);
	}
	e.is = h;
})(InlineValueVariableLookup ||= {});
var InlineValueEvaluatableExpression;
(function(e) {
	function m(e, m) {
		return {
			range: e,
			expression: m
		};
	}
	e.create = m;
	function h(e) {
		let m = e;
		return m != null && Range.is(m.range) && (Is.string(m.expression) || m.expression === void 0);
	}
	e.is = h;
})(InlineValueEvaluatableExpression ||= {});
var InlineValueContext;
(function(e) {
	function m(e, m) {
		return {
			frameId: e,
			stoppedLocation: m
		};
	}
	e.create = m;
	function h(e) {
		let m = e;
		return Is.defined(m) && Range.is(e.stoppedLocation);
	}
	e.is = h;
})(InlineValueContext ||= {});
var InlayHintKind;
(function(e) {
	e.Type = 1, e.Parameter = 2;
	function m(e) {
		return e === 1 || e === 2;
	}
	e.is = m;
})(InlayHintKind ||= {});
var InlayHintLabelPart;
(function(e) {
	function m(e) {
		return { value: e };
	}
	e.create = m;
	function h(e) {
		let m = e;
		return Is.objectLiteral(m) && (m.tooltip === void 0 || Is.string(m.tooltip) || MarkupContent.is(m.tooltip)) && (m.location === void 0 || Location.is(m.location)) && (m.command === void 0 || Command.is(m.command));
	}
	e.is = h;
})(InlayHintLabelPart ||= {});
var InlayHint;
(function(e) {
	function m(e, m, h) {
		let g = {
			position: e,
			label: m
		};
		return h !== void 0 && (g.kind = h), g;
	}
	e.create = m;
	function h(e) {
		let m = e;
		return Is.objectLiteral(m) && Position.is(m.position) && (Is.string(m.label) || Is.typedArray(m.label, InlayHintLabelPart.is)) && (m.kind === void 0 || InlayHintKind.is(m.kind)) && m.textEdits === void 0 || Is.typedArray(m.textEdits, TextEdit.is) && (m.tooltip === void 0 || Is.string(m.tooltip) || MarkupContent.is(m.tooltip)) && (m.paddingLeft === void 0 || Is.boolean(m.paddingLeft)) && (m.paddingRight === void 0 || Is.boolean(m.paddingRight));
	}
	e.is = h;
})(InlayHint ||= {});
var StringValue;
(function(e) {
	function m(e) {
		return {
			kind: "snippet",
			value: e
		};
	}
	e.createSnippet = m;
})(StringValue ||= {});
var InlineCompletionItem;
(function(e) {
	function m(e, m, h, g) {
		return {
			insertText: e,
			filterText: m,
			range: h,
			command: g
		};
	}
	e.create = m;
})(InlineCompletionItem ||= {});
var InlineCompletionList;
(function(e) {
	function m(e) {
		return { items: e };
	}
	e.create = m;
})(InlineCompletionList ||= {});
var InlineCompletionTriggerKind;
(function(e) {
	e.Invoked = 0, e.Automatic = 1;
})(InlineCompletionTriggerKind ||= {});
var SelectedCompletionInfo;
(function(e) {
	function m(e, m) {
		return {
			range: e,
			text: m
		};
	}
	e.create = m;
})(SelectedCompletionInfo ||= {});
var InlineCompletionContext;
(function(e) {
	function m(e, m) {
		return {
			triggerKind: e,
			selectedCompletionInfo: m
		};
	}
	e.create = m;
})(InlineCompletionContext ||= {});
var WorkspaceFolder;
(function(e) {
	function m(e) {
		let m = e;
		return Is.objectLiteral(m) && URI.is(m.uri) && Is.string(m.name);
	}
	e.is = m;
})(WorkspaceFolder ||= {});
var TextDocument;
(function(e) {
	function m(e, m, h, g) {
		return new FullTextDocument(e, m, h, g);
	}
	e.create = m;
	function h(e) {
		let m = e;
		return !!(Is.defined(m) && Is.string(m.uri) && (Is.undefined(m.languageId) || Is.string(m.languageId)) && Is.uinteger(m.lineCount) && Is.func(m.getText) && Is.func(m.positionAt) && Is.func(m.offsetAt));
	}
	e.is = h;
	function g(e, m) {
		let h = e.getText(), g = _(m, (e, m) => {
			let h = e.range.start.line - m.range.start.line;
			return h === 0 ? e.range.start.character - m.range.start.character : h;
		}), v = h.length;
		for (let m = g.length - 1; m >= 0; m--) {
			let _ = g[m], y = e.offsetAt(_.range.start), b = e.offsetAt(_.range.end);
			if (b <= v) h = h.substring(0, y) + _.newText + h.substring(b, h.length);
			else throw Error("Overlapping edit");
			v = y;
		}
		return h;
	}
	e.applyEdits = g;
	function _(e, m) {
		if (e.length <= 1) return e;
		let h = e.length / 2 | 0, g = e.slice(0, h), v = e.slice(h);
		_(g, m), _(v, m);
		let y = 0, b = 0, x = 0;
		for (; y < g.length && b < v.length;) m(g[y], v[b]) <= 0 ? e[x++] = g[y++] : e[x++] = v[b++];
		for (; y < g.length;) e[x++] = g[y++];
		for (; b < v.length;) e[x++] = v[b++];
		return e;
	}
})(TextDocument ||= {});
var FullTextDocument = class {
	constructor(e, m, h, g) {
		this._uri = e, this._languageId = m, this._version = h, this._content = g, this._lineOffsets = void 0;
	}
	get uri() {
		return this._uri;
	}
	get languageId() {
		return this._languageId;
	}
	get version() {
		return this._version;
	}
	getText(e) {
		if (e) {
			let m = this.offsetAt(e.start), h = this.offsetAt(e.end);
			return this._content.substring(m, h);
		}
		return this._content;
	}
	update(e, m) {
		this._content = e.text, this._version = m, this._lineOffsets = void 0;
	}
	getLineOffsets() {
		if (this._lineOffsets === void 0) {
			let e = [], m = this._content, h = !0;
			for (let g = 0; g < m.length; g++) {
				h &&= (e.push(g), !1);
				let _ = m.charAt(g);
				h = _ === "\r" || _ === "\n", _ === "\r" && g + 1 < m.length && m.charAt(g + 1) === "\n" && g++;
			}
			h && m.length > 0 && e.push(m.length), this._lineOffsets = e;
		}
		return this._lineOffsets;
	}
	positionAt(e) {
		e = Math.max(Math.min(e, this._content.length), 0);
		let m = this.getLineOffsets(), h = 0, g = m.length;
		if (g === 0) return Position.create(0, e);
		for (; h < g;) {
			let _ = Math.floor((h + g) / 2);
			m[_] > e ? g = _ : h = _ + 1;
		}
		let _ = h - 1;
		return Position.create(_, e - m[_]);
	}
	offsetAt(e) {
		let m = this.getLineOffsets();
		if (e.line >= m.length) return this._content.length;
		if (e.line < 0) return 0;
		let h = m[e.line], g = e.line + 1 < m.length ? m[e.line + 1] : this._content.length;
		return Math.max(Math.min(h + e.character, g), h);
	}
	get lineCount() {
		return this.getLineOffsets().length;
	}
}, Is;
(function(e) {
	let m = Object.prototype.toString;
	function h(e) {
		return e !== void 0;
	}
	e.defined = h;
	function g(e) {
		return e === void 0;
	}
	e.undefined = g;
	function _(e) {
		return e === !0 || e === !1;
	}
	e.boolean = _;
	function v(e) {
		return m.call(e) === "[object String]";
	}
	e.string = v;
	function y(e) {
		return m.call(e) === "[object Number]";
	}
	e.number = y;
	function b(e, h, g) {
		return m.call(e) === "[object Number]" && h <= e && e <= g;
	}
	e.numberRange = b;
	function x(e) {
		return m.call(e) === "[object Number]" && -2147483648 <= e && e <= 2147483647;
	}
	e.integer = x;
	function S(e) {
		return m.call(e) === "[object Number]" && 0 <= e && e <= 2147483647;
	}
	e.uinteger = S;
	function C(e) {
		return m.call(e) === "[object Function]";
	}
	e.func = C;
	function w(e) {
		return typeof e == "object" && !!e;
	}
	e.objectLiteral = w;
	function T(e, m) {
		return Array.isArray(e) && e.every(m);
	}
	e.typedArray = T;
})(Is ||= {});
function butNot(e, m) {
	let h = e.match;
	return e.match = (e) => {
		let g = !1;
		return h && (g = h(e)), g && m.every((m) => m.match && !m.match(e));
	}, e;
}
butNot(name("def"), [word("on")]), Kind.SCHEMA_EXTENSION, Kind.SCALAR_TYPE_EXTENSION, Kind.OBJECT_TYPE_EXTENSION, Kind.INTERFACE_TYPE_EXTENSION, Kind.UNION_TYPE_EXTENSION, Kind.ENUM_TYPE_EXTENSION, Kind.INPUT_OBJECT_TYPE_EXTENSION;
function word(e) {
	return {
		style: "keyword",
		match: (m) => m.kind === "Name" && m.value === e
	};
}
function name(e) {
	return {
		style: e,
		match: (e) => e.kind === "Name",
		update(e, m) {
			e.name = m.value;
		}
	};
}
var GraphQLDocumentMode;
(function(e) {
	e.TYPE_SYSTEM = "TYPE_SYSTEM", e.EXECUTABLE = "EXECUTABLE", e.UNKNOWN = "UNKNOWN";
})(GraphQLDocumentMode ||= {}), Kind.SCHEMA_DEFINITION, Kind.OPERATION_TYPE_DEFINITION, Kind.SCALAR_TYPE_DEFINITION, Kind.OBJECT_TYPE_DEFINITION, Kind.INTERFACE_TYPE_DEFINITION, Kind.UNION_TYPE_DEFINITION, Kind.ENUM_TYPE_DEFINITION, Kind.INPUT_OBJECT_TYPE_DEFINITION, Kind.DIRECTIVE_DEFINITION, Kind.SCHEMA_EXTENSION, Kind.SCALAR_TYPE_EXTENSION, Kind.OBJECT_TYPE_EXTENSION, Kind.INTERFACE_TYPE_EXTENSION, Kind.UNION_TYPE_EXTENSION, Kind.ENUM_TYPE_EXTENSION, Kind.INPUT_OBJECT_TYPE_EXTENSION, Object.assign(Object.assign({}, 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, m) => {
	function h(e, m) {
		if (e != null) return e;
		var h = Error(m === void 0 ? "Got unexpected " + e : m);
		throw h.framesToPop = 1, h;
	}
	m.exports = h, m.exports.default = h, Object.defineProperty(m.exports, "__esModule", { value: !0 });
})))();
const SEVERITY = {
	Error: "Error",
	Warning: "Warning",
	Information: "Information",
	Hint: "Hint"
};
SEVERITY.Error, SEVERITY.Warning, SEVERITY.Information, SEVERITY.Hint;
const getModelLanguageId = (e) => "getModeId" in e ? e.getModeId() : e.getLanguageId(), getStringSchema = (e) => {
	let { schema: m, documentAST: h, introspectionJSON: g, introspectionJSONString: _, documentString: v,...y } = e;
	if (m) return {
		...y,
		documentString: printSchema(m)
	};
	if (_) return {
		...y,
		introspectionJSONString: _
	};
	if (v) return {
		...y,
		documentString: v
	};
	if (g) return {
		...y,
		introspectionJSONString: JSON.stringify(g)
	};
	if (h) {
		let e = buildASTSchema(h, y.buildSchemaOptions);
		return {
			...y,
			documentString: printSchema(e)
		};
	}
	throw Error("No schema supplied");
};
var STOP_WHEN_IDLE_FOR = 120 * 1e3, WorkerManager = class {
	_defaults;
	_idleCheckInterval;
	_lastUsedTime = 0;
	_configChangeListener;
	_worker = null;
	_client = null;
	constructor(e) {
		this._defaults = e, this._idleCheckInterval = window.setInterval(() => this._checkIfIdle(), 30 * 1e3), this._configChangeListener = this._defaults.onDidChange(() => {
			this._stopWorker();
		});
	}
	_stopWorker() {
		this._worker &&= (this._worker.dispose(), null), this._client = null;
	}
	dispose() {
		clearInterval(this._idleCheckInterval), this._configChangeListener.dispose(), this._stopWorker();
	}
	_checkIfIdle() {
		this._worker && Date.now() - this._lastUsedTime > STOP_WHEN_IDLE_FOR && this._stopWorker();
	}
	async _getClient() {
		if (this._lastUsedTime = Date.now(), !this._client && !this._worker) try {
			let { languageId: e, formattingOptions: m, schemas: h, externalFragmentDefinitions: g, completionSettings: v } = this._defaults;
			this._worker = editor.createWebWorker({
				moduleId: "monaco-graphql/esm/GraphQLWorker.js",
				label: e,
				createData: {
					languageId: e,
					formattingOptions: m,
					languageConfig: {
						schemas: h?.map(getStringSchema),
						externalFragmentDefinitions: g,
						fillLeafsOnComplete: v.__experimental__fillLeafsOnComplete
					}
				}
			}), this._client = this._worker.getProxy();
		} catch (e) {
			console.error("error loading worker", e);
		}
		return this._client;
	}
	async getLanguageServiceWorker(...e) {
		let m = await this._getClient();
		return await this._worker.withSyncedResources(e), m;
	}
}, DiagnosticsAdapter = class {
	defaults;
	_worker;
	_disposables = [];
	_listener = Object.create(null);
	constructor(e, m) {
		this.defaults = e, this._worker = m, this._worker = m;
		let h, g = (m) => {
			let g = getModelLanguageId(m);
			if (g !== this.defaults.languageId) return;
			let _ = m.uri.toString(), v = e.diagnosticSettings.validateVariablesJSON?.[_];
			h = setTimeout(() => {
				this._doValidate(m.uri, g, v);
			}, 400), this._listener[_] = m.onDidChangeContent(() => {
				clearTimeout(h), h = setTimeout(() => {
					this._doValidate(m.uri, g, v);
				}, 400);
			});
		}, v = (e) => {
			editor.setModelMarkers(e, this.defaults.languageId, []);
			let m = e.uri.toString(), h = this._listener[m];
			h && (h.dispose(), delete this._listener[m]);
		};
		this._disposables.push(editor.onDidCreateModel(g), { dispose() {
			clearTimeout(h);
		} }, editor.onWillDisposeModel((e) => {
			v(e);
		}), editor.onDidChangeModelLanguage((e) => {
			v(e.model), g(e.model);
		}), { dispose: () => {
			for (let e of Object.values(this._listener)) e.dispose();
		} }, e.onDidChange(() => {
			for (let e of editor.getModels()) getModelLanguageId(e) === this.defaults.languageId && (v(e), g(e));
		}));
		for (let e of editor.getModels()) getModelLanguageId(e) === this.defaults.languageId && g(e);
	}
	dispose() {
		for (let e of this._disposables) e.dispose();
		this._disposables = [];
	}
	async _doValidate(e, m, v) {
		let y = await this._worker(e);
		if (!y) return;
		let b = await y.doValidation(e.toString());
		if (editor.setModelMarkers(editor.getModel(e), m, b), v) {
			if (await import("./monaco.contribution-CvfO2vsA.js"), !v.length) throw Error("No variables URI strings provided to validate");
			let m = await y.doGetVariablesJSONSchema(e.toString());
			if (!m) return;
			let _ = Uri.file(v[0].replace(".json", "-schema.json")).toString(), b = {
				uri: _,
				schema: m,
				fileMatch: v
			}, x = languages.json.jsonDefaults.diagnosticsOptions.schemas?.filter((e) => e.uri !== _) || [];
			languages.json.jsonDefaults.setDiagnosticsOptions({
				schemaValidation: "error",
				validate: !0,
				...this.defaults.diagnosticSettings.jsonDiagnosticSettings,
				schemas: [...x, b],
				enableSchemaRequest: !1
			});
		}
	}
}, mKind = languages.CompletionItemKind, kindMap = {
	[CompletionItemKind.Text]: mKind.Text,
	[CompletionItemKind.Method]: mKind.Method,
	[CompletionItemKind.Function]: mKind.Function,
	[CompletionItemKind.Constructor]: mKind.Constructor,
	[CompletionItemKind.Field]: mKind.Field,
	[CompletionItemKind.Variable]: mKind.Variable,
	[CompletionItemKind.Class]: mKind.Class,
	[CompletionItemKind.Interface]: mKind.Interface,
	[CompletionItemKind.Module]: mKind.Module,
	[CompletionItemKind.Property]: mKind.Property,
	[CompletionItemKind.Unit]: mKind.Unit,
	[CompletionItemKind.Value]: mKind.Value,
	[CompletionItemKind.Enum]: mKind.Enum,
	[CompletionItemKind.Keyword]: mKind.Keyword,
	[CompletionItemKind.Snippet]: mKind.Snippet,
	[CompletionItemKind.Color]: mKind.Color,
	[CompletionItemKind.File]: mKind.File,
	[CompletionItemKind.Reference]: mKind.Reference,
	[CompletionItemKind.Folder]: mKind.Folder,
	[CompletionItemKind.EnumMember]: mKind.EnumMember,
	[CompletionItemKind.Constant]: mKind.Constant,
	[CompletionItemKind.Struct]: mKind.Struct,
	[CompletionItemKind.Event]: mKind.Event,
	[CompletionItemKind.Operator]: mKind.Operator,
	[CompletionItemKind.TypeParameter]: mKind.TypeParameter
};
function toCompletionItemKind(e) {
	return e in kindMap ? kindMap[e] : mKind.Text;
}
function toCompletion(e) {
	return {
		range: e.range,
		kind: toCompletionItemKind(e.kind),
		label: e.label,
		insertText: e.insertText ?? e.label,
		insertTextRules: e.insertText ? languages.CompletionItemInsertTextRule.InsertAsSnippet : void 0,
		sortText: e.sortText,
		filterText: e.filterText,
		documentation: e.documentation,
		detail: e.detail,
		command: e.command
	};
}
var CompletionAdapter = class {
	_worker;
	constructor(e) {
		this._worker = e, this._worker = e;
	}
	get triggerCharacters() {
		return [
			":",
			"$",
			" ",
			"(",
			"@"
		];
	}
	async provideCompletionItems(e, m, h, g) {
		try {
			return {
				incomplete: !0,
				suggestions: (await (await this._worker(e.uri)).doComplete(e.uri.toString(), m)).map(toCompletion)
			};
		} catch (e) {
			return console.error("Error fetching completion items", e), { suggestions: [] };
		}
	}
}, DocumentFormattingAdapter = class {
	_worker;
	constructor(e) {
		this._worker = e, this._worker = e;
	}
	async provideDocumentFormattingEdits(e, m, h) {
		let g = await (await this._worker(e.uri)).doFormat(e.uri.toString());
		return g ? [{
			range: e.getFullModelRange(),
			text: g
		}] : [];
	}
}, HoverAdapter = class {
	_worker;
	constructor(e) {
		this._worker = e;
	}
	async provideHover(e, m, h) {
		let g = e.uri, _ = await (await this._worker(e.uri)).doHover(g.toString(), m);
		return _ ? {
			range: _.range,
			contents: [{ value: _.content }]
		} : { contents: [] };
	}
	dispose() {}
};
function setupMode(e) {
	let m = [], h = [], _ = new WorkerManager(e);
	m.push(_);
	let v = (...e) => {
		try {
			return _.getLanguageServiceWorker(...e);
		} catch {
			throw Error("Error fetching graphql language service worker");
		}
	};
	function y() {
		let { modeConfiguration: m, languageId: _ } = e;
		m.documentFormattingEdits && h.push(languages.registerDocumentFormattingEditProvider(_, new DocumentFormattingAdapter(v)));
	}
	function b(m) {
		let { modeConfiguration: _, languageId: b } = e;
		disposeAll(h), _.completionItems && h.push(languages.registerCompletionItemProvider(b, new CompletionAdapter(v))), _.diagnostics && h.push(new DiagnosticsAdapter(m, v)), _.hovers && h.push(languages.registerHoverProvider(b, new HoverAdapter(v))), y();
	}
	let { modeConfiguration: x, formattingOptions: S, diagnosticSettings: C, externalFragmentDefinitions: w, schemas: T } = e;
	return b(e), e.onDidChange((e) => {
		e.modeConfiguration !== x && (x = e.modeConfiguration, b(e)), e.formattingOptions !== S && (S = e.formattingOptions, y()), e.externalFragmentDefinitions !== w && (w = e.externalFragmentDefinitions, b(e)), e.diagnosticSettings !== C && (C = e.diagnosticSettings, b(e)), e.schemas !== T && (T = e.schemas, b(e));
	}), m.push(asDisposable(h)), asDisposable(m);
}
function asDisposable(e) {
	return { dispose: () => disposeAll(e) };
}
function disposeAll(e) {
	for (; e.length;) e.pop().dispose();
}
export { setupMode };
