UNPKG

@graphql-hive/laboratory

Version:

1,481 lines (1,480 loc) • 44.2 kB
import { Ku as __commonJSMin, Yu as __toESM, f as Uri, h as languages, p as editor } from "./editor.api-DPgI1LYm.js"; import { At as isPrintableAsBlockString, D as astFromValue, E as isIntrospectionType, Et as inspect, It as invariant, Mt as Kind, P as isSpecifiedDirective, V as isSpecifiedScalarType, _t as isUnionType, at as isEnumType, ct as isInterfaceType, gt as isScalarType, k as DEFAULT_DEPRECATION_REASON, mt as isObjectType, n as buildASTSchema, ot as isInputObjectType, yt as print } from "./monaco-editor-CXHJEBOf.js"; import "./monaco.contribution-BUcZa-0g.js"; function printSchema(p) { return printFilteredSchema(p, (p) => !isSpecifiedDirective(p), isDefinedType); } function isDefinedType(p) { return !isSpecifiedScalarType(p) && !isIntrospectionType(p); } function printFilteredSchema(p, H, U) { let W = p.getDirectives().filter(H), G = Object.values(p.getTypeMap()).filter(U); return [ printSchemaDefinition(p), ...W.map((p) => printDirective(p)), ...G.map((p) => printType(p)) ].filter(Boolean).join("\n\n"); } function printSchemaDefinition(p) { if (p.description == null && isSchemaOfCommonNames(p)) return; let H = [], U = p.getQueryType(); U && H.push(` query: ${U.name}`); let W = p.getMutationType(); W && H.push(` mutation: ${W.name}`); let G = p.getSubscriptionType(); return G && H.push(` subscription: ${G.name}`), printDescription(p) + `schema {\n${H.join("\n")}\n}`; } function isSchemaOfCommonNames(p) { let H = p.getQueryType(); if (H && H.name !== "Query") return !1; let U = p.getMutationType(); if (U && U.name !== "Mutation") return !1; let W = p.getSubscriptionType(); return !(W && W.name !== "Subscription"); } function printType(p) { if (isScalarType(p)) return printScalar(p); if (isObjectType(p)) return printObject(p); if (isInterfaceType(p)) return printInterface(p); if (isUnionType(p)) return printUnion(p); if (isEnumType(p)) return printEnum(p); if (isInputObjectType(p)) return printInputObject(p); /* c8 ignore next 3 */ invariant(!1, "Unexpected type: " + inspect(p)); } function printScalar(p) { return printDescription(p) + `scalar ${p.name}` + printSpecifiedByURL(p); } function printImplementedInterfaces(p) { let H = p.getInterfaces(); return H.length ? " implements " + H.map((p) => p.name).join(" & ") : ""; } function printObject(p) { return printDescription(p) + `type ${p.name}` + printImplementedInterfaces(p) + printFields(p); } function printInterface(p) { return printDescription(p) + `interface ${p.name}` + printImplementedInterfaces(p) + printFields(p); } function printUnion(p) { let H = p.getTypes(), U = H.length ? " = " + H.join(" | ") : ""; return printDescription(p) + "union " + p.name + U; } function printEnum(p) { let H = p.getValues().map((p, H) => printDescription(p, " ", !H) + " " + p.name + printDeprecated(p.deprecationReason)); return printDescription(p) + `enum ${p.name}` + printBlock(H); } function printInputObject(p) { let H = Object.values(p.getFields()).map((p, H) => printDescription(p, " ", !H) + " " + printInputValue(p)); return printDescription(p) + `input ${p.name}` + (p.isOneOf ? " @oneOf" : "") + printBlock(H); } function printFields(p) { let H = Object.values(p.getFields()).map((p, H) => printDescription(p, " ", !H) + " " + p.name + printArgs(p.args, " ") + ": " + String(p.type) + printDeprecated(p.deprecationReason)); return printBlock(H); } function printBlock(p) { return p.length === 0 ? "" : " {\n" + p.join("\n") + "\n}"; } function printArgs(p, H = "") { return p.length === 0 ? "" : p.every((p) => !p.description) ? "(" + p.map(printInputValue).join(", ") + ")" : "(\n" + p.map((p, U) => printDescription(p, " " + H, !U) + " " + H + printInputValue(p)).join("\n") + "\n" + H + ")"; } function printInputValue(p) { let H = astFromValue(p.defaultValue, p.type), U = p.name + ": " + String(p.type); return H && (U += ` = ${print(H)}`), U + printDeprecated(p.deprecationReason); } function printDirective(p) { return printDescription(p) + "directive @" + p.name + printArgs(p.args) + (p.isRepeatable ? " repeatable" : "") + " on " + p.locations.join(" | "); } function printDeprecated(p) { return p == null ? "" : p === "No longer supported" ? " @deprecated" : ` @deprecated(reason: ${print({ kind: Kind.STRING, value: p })})`; } function printSpecifiedByURL(p) { return p.specifiedByURL == null ? "" : ` @specifiedBy(url: ${print({ kind: Kind.STRING, value: p.specifiedByURL })})`; } function printDescription(p, H = "", U = !0) { let { description: W } = p; if (W == null) return ""; let G = print({ kind: Kind.STRING, value: W, block: isPrintableAsBlockString(W) }); return (H && !U ? "\n" + H : H) + G.replace(/\n/g, "\n" + H) + "\n"; } var DocumentUri; (function(p) { function H(p) { return typeof p == "string"; } p.is = H; })(DocumentUri ||= {}); var URI; (function(p) { function H(p) { return typeof p == "string"; } p.is = H; })(URI ||= {}); var integer; (function(p) { p.MIN_VALUE = -2147483648, p.MAX_VALUE = 2147483647; function H(H) { return typeof H == "number" && p.MIN_VALUE <= H && H <= p.MAX_VALUE; } p.is = H; })(integer ||= {}); var uinteger; (function(p) { p.MIN_VALUE = 0, p.MAX_VALUE = 2147483647; function H(H) { return typeof H == "number" && p.MIN_VALUE <= H && H <= p.MAX_VALUE; } p.is = H; })(uinteger ||= {}); var Position; (function(p) { function H(p, H) { return p === Number.MAX_VALUE && (p = uinteger.MAX_VALUE), H === Number.MAX_VALUE && (H = uinteger.MAX_VALUE), { line: p, character: H }; } p.create = H; function U(p) { let H = p; return Is.objectLiteral(H) && Is.uinteger(H.line) && Is.uinteger(H.character); } p.is = U; })(Position ||= {}); var Range; (function(p) { function H(p, H, U, W) { if (Is.uinteger(p) && Is.uinteger(H) && Is.uinteger(U) && Is.uinteger(W)) return { start: Position.create(p, H), end: Position.create(U, W) }; if (Position.is(p) && Position.is(H)) return { start: p, end: H }; throw Error(`Range#create called with invalid arguments[${p}, ${H}, ${U}, ${W}]`); } p.create = H; function U(p) { let H = p; return Is.objectLiteral(H) && Position.is(H.start) && Position.is(H.end); } p.is = U; })(Range ||= {}); var Location; (function(p) { function H(p, H) { return { uri: p, range: H }; } p.create = H; function U(p) { let H = p; return Is.objectLiteral(H) && Range.is(H.range) && (Is.string(H.uri) || Is.undefined(H.uri)); } p.is = U; })(Location ||= {}); var LocationLink; (function(p) { function H(p, H, U, W) { return { targetUri: p, targetRange: H, targetSelectionRange: U, originSelectionRange: W }; } p.create = H; function U(p) { let H = p; return Is.objectLiteral(H) && Range.is(H.targetRange) && Is.string(H.targetUri) && Range.is(H.targetSelectionRange) && (Range.is(H.originSelectionRange) || Is.undefined(H.originSelectionRange)); } p.is = U; })(LocationLink ||= {}); var Color; (function(p) { function H(p, H, U, W) { return { red: p, green: H, blue: U, alpha: W }; } p.create = H; function U(p) { let H = p; return Is.objectLiteral(H) && Is.numberRange(H.red, 0, 1) && Is.numberRange(H.green, 0, 1) && Is.numberRange(H.blue, 0, 1) && Is.numberRange(H.alpha, 0, 1); } p.is = U; })(Color ||= {}); var ColorInformation; (function(p) { function H(p, H) { return { range: p, color: H }; } p.create = H; function U(p) { let H = p; return Is.objectLiteral(H) && Range.is(H.range) && Color.is(H.color); } p.is = U; })(ColorInformation ||= {}); var ColorPresentation; (function(p) { function H(p, H, U) { return { label: p, textEdit: H, additionalTextEdits: U }; } p.create = H; function U(p) { let H = p; return Is.objectLiteral(H) && Is.string(H.label) && (Is.undefined(H.textEdit) || TextEdit.is(H)) && (Is.undefined(H.additionalTextEdits) || Is.typedArray(H.additionalTextEdits, TextEdit.is)); } p.is = U; })(ColorPresentation ||= {}); var FoldingRangeKind; (function(p) { p.Comment = "comment", p.Imports = "imports", p.Region = "region"; })(FoldingRangeKind ||= {}); var FoldingRange; (function(p) { function H(p, H, U, W, G, K) { let q = { startLine: p, endLine: H }; return Is.defined(U) && (q.startCharacter = U), Is.defined(W) && (q.endCharacter = W), Is.defined(G) && (q.kind = G), Is.defined(K) && (q.collapsedText = K), q; } p.create = H; function U(p) { let H = p; return Is.objectLiteral(H) && Is.uinteger(H.startLine) && Is.uinteger(H.startLine) && (Is.undefined(H.startCharacter) || Is.uinteger(H.startCharacter)) && (Is.undefined(H.endCharacter) || Is.uinteger(H.endCharacter)) && (Is.undefined(H.kind) || Is.string(H.kind)); } p.is = U; })(FoldingRange ||= {}); var DiagnosticRelatedInformation; (function(p) { function H(p, H) { return { location: p, message: H }; } p.create = H; function U(p) { let H = p; return Is.defined(H) && Location.is(H.location) && Is.string(H.message); } p.is = U; })(DiagnosticRelatedInformation ||= {}); var DiagnosticSeverity; (function(p) { p.Error = 1, p.Warning = 2, p.Information = 3, p.Hint = 4; })(DiagnosticSeverity ||= {}); var DiagnosticTag; (function(p) { p.Unnecessary = 1, p.Deprecated = 2; })(DiagnosticTag ||= {}); var CodeDescription; (function(p) { function H(p) { let H = p; return Is.objectLiteral(H) && Is.string(H.href); } p.is = H; })(CodeDescription ||= {}); var Diagnostic; (function(p) { function H(p, H, U, W, G, K) { let q = { range: p, message: H }; return Is.defined(U) && (q.severity = U), Is.defined(W) && (q.code = W), Is.defined(G) && (q.source = G), Is.defined(K) && (q.relatedInformation = K), q; } p.create = H; function U(p) { let H = p; return Is.defined(H) && Range.is(H.range) && Is.string(H.message) && (Is.number(H.severity) || Is.undefined(H.severity)) && (Is.integer(H.code) || Is.string(H.code) || Is.undefined(H.code)) && (Is.undefined(H.codeDescription) || Is.string(H.codeDescription?.href)) && (Is.string(H.source) || Is.undefined(H.source)) && (Is.undefined(H.relatedInformation) || Is.typedArray(H.relatedInformation, DiagnosticRelatedInformation.is)); } p.is = U; })(Diagnostic ||= {}); var Command; (function(p) { function H(p, H, ...U) { let W = { title: p, command: H }; return Is.defined(U) && U.length > 0 && (W.arguments = U), W; } p.create = H; function U(p) { let H = p; return Is.defined(H) && Is.string(H.title) && Is.string(H.command); } p.is = U; })(Command ||= {}); var TextEdit; (function(p) { function H(p, H) { return { range: p, newText: H }; } p.replace = H; function U(p, H) { return { range: { start: p, end: p }, newText: H }; } p.insert = U; function W(p) { return { range: p, newText: "" }; } p.del = W; function G(p) { let H = p; return Is.objectLiteral(H) && Is.string(H.newText) && Range.is(H.range); } p.is = G; })(TextEdit ||= {}); var ChangeAnnotation; (function(p) { function H(p, H, U) { let W = { label: p }; return H !== void 0 && (W.needsConfirmation = H), U !== void 0 && (W.description = U), W; } p.create = H; function U(p) { let H = p; return Is.objectLiteral(H) && Is.string(H.label) && (Is.boolean(H.needsConfirmation) || H.needsConfirmation === void 0) && (Is.string(H.description) || H.description === void 0); } p.is = U; })(ChangeAnnotation ||= {}); var ChangeAnnotationIdentifier; (function(p) { function H(p) { let H = p; return Is.string(H); } p.is = H; })(ChangeAnnotationIdentifier ||= {}); var AnnotatedTextEdit; (function(p) { function H(p, H, U) { return { range: p, newText: H, annotationId: U }; } p.replace = H; function U(p, H, U) { return { range: { start: p, end: p }, newText: H, annotationId: U }; } p.insert = U; function W(p, H) { return { range: p, newText: "", annotationId: H }; } p.del = W; function G(p) { let H = p; return TextEdit.is(H) && (ChangeAnnotation.is(H.annotationId) || ChangeAnnotationIdentifier.is(H.annotationId)); } p.is = G; })(AnnotatedTextEdit ||= {}); var TextDocumentEdit; (function(p) { function H(p, H) { return { textDocument: p, edits: H }; } p.create = H; function U(p) { let H = p; return Is.defined(H) && OptionalVersionedTextDocumentIdentifier.is(H.textDocument) && Array.isArray(H.edits); } p.is = U; })(TextDocumentEdit ||= {}); var CreateFile; (function(p) { function H(p, H, U) { let W = { kind: "create", uri: p }; return H !== void 0 && (H.overwrite !== void 0 || H.ignoreIfExists !== void 0) && (W.options = H), U !== void 0 && (W.annotationId = U), W; } p.create = H; function U(p) { let H = p; return H && H.kind === "create" && Is.string(H.uri) && (H.options === void 0 || (H.options.overwrite === void 0 || Is.boolean(H.options.overwrite)) && (H.options.ignoreIfExists === void 0 || Is.boolean(H.options.ignoreIfExists))) && (H.annotationId === void 0 || ChangeAnnotationIdentifier.is(H.annotationId)); } p.is = U; })(CreateFile ||= {}); var RenameFile; (function(p) { function H(p, H, U, W) { let G = { kind: "rename", oldUri: p, newUri: H }; return U !== void 0 && (U.overwrite !== void 0 || U.ignoreIfExists !== void 0) && (G.options = U), W !== void 0 && (G.annotationId = W), G; } p.create = H; function U(p) { let H = p; return H && H.kind === "rename" && Is.string(H.oldUri) && Is.string(H.newUri) && (H.options === void 0 || (H.options.overwrite === void 0 || Is.boolean(H.options.overwrite)) && (H.options.ignoreIfExists === void 0 || Is.boolean(H.options.ignoreIfExists))) && (H.annotationId === void 0 || ChangeAnnotationIdentifier.is(H.annotationId)); } p.is = U; })(RenameFile ||= {}); var DeleteFile; (function(p) { function H(p, H, U) { let W = { kind: "delete", uri: p }; return H !== void 0 && (H.recursive !== void 0 || H.ignoreIfNotExists !== void 0) && (W.options = H), U !== void 0 && (W.annotationId = U), W; } p.create = H; function U(p) { let H = p; return H && H.kind === "delete" && Is.string(H.uri) && (H.options === void 0 || (H.options.recursive === void 0 || Is.boolean(H.options.recursive)) && (H.options.ignoreIfNotExists === void 0 || Is.boolean(H.options.ignoreIfNotExists))) && (H.annotationId === void 0 || ChangeAnnotationIdentifier.is(H.annotationId)); } p.is = U; })(DeleteFile ||= {}); var WorkspaceEdit; (function(p) { function H(p) { let H = p; return H && (H.changes !== void 0 || H.documentChanges !== void 0) && (H.documentChanges === void 0 || H.documentChanges.every((p) => Is.string(p.kind) ? CreateFile.is(p) || RenameFile.is(p) || DeleteFile.is(p) : TextDocumentEdit.is(p))); } p.is = H; })(WorkspaceEdit ||= {}); var TextDocumentIdentifier; (function(p) { function H(p) { return { uri: p }; } p.create = H; function U(p) { let H = p; return Is.defined(H) && Is.string(H.uri); } p.is = U; })(TextDocumentIdentifier ||= {}); var VersionedTextDocumentIdentifier; (function(p) { function H(p, H) { return { uri: p, version: H }; } p.create = H; function U(p) { let H = p; return Is.defined(H) && Is.string(H.uri) && Is.integer(H.version); } p.is = U; })(VersionedTextDocumentIdentifier ||= {}); var OptionalVersionedTextDocumentIdentifier; (function(p) { function H(p, H) { return { uri: p, version: H }; } p.create = H; function U(p) { let H = p; return Is.defined(H) && Is.string(H.uri) && (H.version === null || Is.integer(H.version)); } p.is = U; })(OptionalVersionedTextDocumentIdentifier ||= {}); var TextDocumentItem; (function(p) { function H(p, H, U, W) { return { uri: p, languageId: H, version: U, text: W }; } p.create = H; function U(p) { let H = p; return Is.defined(H) && Is.string(H.uri) && Is.string(H.languageId) && Is.integer(H.version) && Is.string(H.text); } p.is = U; })(TextDocumentItem ||= {}); var MarkupKind; (function(p) { p.PlainText = "plaintext", p.Markdown = "markdown"; function H(H) { let U = H; return U === p.PlainText || U === p.Markdown; } p.is = H; })(MarkupKind ||= {}); var MarkupContent; (function(p) { function H(p) { let H = p; return Is.objectLiteral(p) && MarkupKind.is(H.kind) && Is.string(H.value); } p.is = H; })(MarkupContent ||= {}); var CompletionItemKind$1; (function(p) { p.Text = 1, p.Method = 2, p.Function = 3, p.Constructor = 4, p.Field = 5, p.Variable = 6, p.Class = 7, p.Interface = 8, p.Module = 9, p.Property = 10, p.Unit = 11, p.Value = 12, p.Enum = 13, p.Keyword = 14, p.Snippet = 15, p.Color = 16, p.File = 17, p.Reference = 18, p.Folder = 19, p.EnumMember = 20, p.Constant = 21, p.Struct = 22, p.Event = 23, p.Operator = 24, p.TypeParameter = 25; })(CompletionItemKind$1 ||= {}); var InsertTextFormat; (function(p) { p.PlainText = 1, p.Snippet = 2; })(InsertTextFormat ||= {}); var CompletionItemTag; (function(p) { p.Deprecated = 1; })(CompletionItemTag ||= {}); var InsertReplaceEdit; (function(p) { function H(p, H, U) { return { newText: p, insert: H, replace: U }; } p.create = H; function U(p) { let H = p; return H && Is.string(H.newText) && Range.is(H.insert) && Range.is(H.replace); } p.is = U; })(InsertReplaceEdit ||= {}); var InsertTextMode; (function(p) { p.asIs = 1, p.adjustIndentation = 2; })(InsertTextMode ||= {}); var CompletionItemLabelDetails; (function(p) { function H(p) { let H = p; return H && (Is.string(H.detail) || H.detail === void 0) && (Is.string(H.description) || H.description === void 0); } p.is = H; })(CompletionItemLabelDetails ||= {}); var CompletionItem; (function(p) { function H(p) { return { label: p }; } p.create = H; })(CompletionItem ||= {}); var CompletionList; (function(p) { function H(p, H) { return { items: p || [], isIncomplete: !!H }; } p.create = H; })(CompletionList ||= {}); var MarkedString; (function(p) { function H(p) { return p.replace(/[\\`*_{}[\]()#+\-.!]/g, "\\$&"); } p.fromPlainText = H; function U(p) { let H = p; return Is.string(H) || Is.objectLiteral(H) && Is.string(H.language) && Is.string(H.value); } p.is = U; })(MarkedString ||= {}); var Hover; (function(p) { function H(p) { let H = p; return !!H && Is.objectLiteral(H) && (MarkupContent.is(H.contents) || MarkedString.is(H.contents) || Is.typedArray(H.contents, MarkedString.is)) && (p.range === void 0 || Range.is(p.range)); } p.is = H; })(Hover ||= {}); var ParameterInformation; (function(p) { function H(p, H) { return H ? { label: p, documentation: H } : { label: p }; } p.create = H; })(ParameterInformation ||= {}); var SignatureInformation; (function(p) { function H(p, H, ...U) { let W = { label: p }; return Is.defined(H) && (W.documentation = H), Is.defined(U) ? W.parameters = U : W.parameters = [], W; } p.create = H; })(SignatureInformation ||= {}); var DocumentHighlightKind; (function(p) { p.Text = 1, p.Read = 2, p.Write = 3; })(DocumentHighlightKind ||= {}); var DocumentHighlight; (function(p) { function H(p, H) { let U = { range: p }; return Is.number(H) && (U.kind = H), U; } p.create = H; })(DocumentHighlight ||= {}); var SymbolKind; (function(p) { p.File = 1, p.Module = 2, p.Namespace = 3, p.Package = 4, p.Class = 5, p.Method = 6, p.Property = 7, p.Field = 8, p.Constructor = 9, p.Enum = 10, p.Interface = 11, p.Function = 12, p.Variable = 13, p.Constant = 14, p.String = 15, p.Number = 16, p.Boolean = 17, p.Array = 18, p.Object = 19, p.Key = 20, p.Null = 21, p.EnumMember = 22, p.Struct = 23, p.Event = 24, p.Operator = 25, p.TypeParameter = 26; })(SymbolKind ||= {}); var SymbolTag; (function(p) { p.Deprecated = 1; })(SymbolTag ||= {}); var SymbolInformation; (function(p) { function H(p, H, U, W, G) { let K = { name: p, kind: H, location: { uri: W, range: U } }; return G && (K.containerName = G), K; } p.create = H; })(SymbolInformation ||= {}); var WorkspaceSymbol; (function(p) { function H(p, H, U, W) { return W === void 0 ? { name: p, kind: H, location: { uri: U } } : { name: p, kind: H, location: { uri: U, range: W } }; } p.create = H; })(WorkspaceSymbol ||= {}); var DocumentSymbol; (function(p) { function H(p, H, U, W, G, K) { let q = { name: p, detail: H, kind: U, range: W, selectionRange: G }; return K !== void 0 && (q.children = K), q; } p.create = H; function U(p) { let H = p; return H && Is.string(H.name) && Is.number(H.kind) && Range.is(H.range) && Range.is(H.selectionRange) && (H.detail === void 0 || Is.string(H.detail)) && (H.deprecated === void 0 || Is.boolean(H.deprecated)) && (H.children === void 0 || Array.isArray(H.children)) && (H.tags === void 0 || Array.isArray(H.tags)); } p.is = U; })(DocumentSymbol ||= {}); var CodeActionKind; (function(p) { p.Empty = "", p.QuickFix = "quickfix", p.Refactor = "refactor", p.RefactorExtract = "refactor.extract", p.RefactorInline = "refactor.inline", p.RefactorRewrite = "refactor.rewrite", p.Source = "source", p.SourceOrganizeImports = "source.organizeImports", p.SourceFixAll = "source.fixAll"; })(CodeActionKind ||= {}); var CodeActionTriggerKind; (function(p) { p.Invoked = 1, p.Automatic = 2; })(CodeActionTriggerKind ||= {}); var CodeActionContext; (function(p) { function H(p, H, U) { let W = { diagnostics: p }; return H != null && (W.only = H), U != null && (W.triggerKind = U), W; } p.create = H; function U(p) { let H = p; return Is.defined(H) && Is.typedArray(H.diagnostics, Diagnostic.is) && (H.only === void 0 || Is.typedArray(H.only, Is.string)) && (H.triggerKind === void 0 || H.triggerKind === CodeActionTriggerKind.Invoked || H.triggerKind === CodeActionTriggerKind.Automatic); } p.is = U; })(CodeActionContext ||= {}); var CodeAction; (function(p) { function H(p, H, U) { let W = { title: p }, G = !0; return typeof H == "string" ? (G = !1, W.kind = H) : Command.is(H) ? W.command = H : W.edit = H, G && U !== void 0 && (W.kind = U), W; } p.create = H; function U(p) { let H = p; return H && Is.string(H.title) && (H.diagnostics === void 0 || Is.typedArray(H.diagnostics, Diagnostic.is)) && (H.kind === void 0 || Is.string(H.kind)) && (H.edit !== void 0 || H.command !== void 0) && (H.command === void 0 || Command.is(H.command)) && (H.isPreferred === void 0 || Is.boolean(H.isPreferred)) && (H.edit === void 0 || WorkspaceEdit.is(H.edit)); } p.is = U; })(CodeAction ||= {}); var CodeLens; (function(p) { function H(p, H) { let U = { range: p }; return Is.defined(H) && (U.data = H), U; } p.create = H; function U(p) { let H = p; return Is.defined(H) && Range.is(H.range) && (Is.undefined(H.command) || Command.is(H.command)); } p.is = U; })(CodeLens ||= {}); var FormattingOptions; (function(p) { function H(p, H) { return { tabSize: p, insertSpaces: H }; } p.create = H; function U(p) { let H = p; return Is.defined(H) && Is.uinteger(H.tabSize) && Is.boolean(H.insertSpaces); } p.is = U; })(FormattingOptions ||= {}); var DocumentLink; (function(p) { function H(p, H, U) { return { range: p, target: H, data: U }; } p.create = H; function U(p) { let H = p; return Is.defined(H) && Range.is(H.range) && (Is.undefined(H.target) || Is.string(H.target)); } p.is = U; })(DocumentLink ||= {}); var SelectionRange; (function(p) { function H(p, H) { return { range: p, parent: H }; } p.create = H; function U(H) { let U = H; return Is.objectLiteral(U) && Range.is(U.range) && (U.parent === void 0 || p.is(U.parent)); } p.is = U; })(SelectionRange ||= {}); var SemanticTokenTypes; (function(p) { p.namespace = "namespace", p.type = "type", p.class = "class", p.enum = "enum", p.interface = "interface", p.struct = "struct", p.typeParameter = "typeParameter", p.parameter = "parameter", p.variable = "variable", p.property = "property", p.enumMember = "enumMember", p.event = "event", p.function = "function", p.method = "method", p.macro = "macro", p.keyword = "keyword", p.modifier = "modifier", p.comment = "comment", p.string = "string", p.number = "number", p.regexp = "regexp", p.operator = "operator", p.decorator = "decorator"; })(SemanticTokenTypes ||= {}); var SemanticTokenModifiers; (function(p) { p.declaration = "declaration", p.definition = "definition", p.readonly = "readonly", p.static = "static", p.deprecated = "deprecated", p.abstract = "abstract", p.async = "async", p.modification = "modification", p.documentation = "documentation", p.defaultLibrary = "defaultLibrary"; })(SemanticTokenModifiers ||= {}); var SemanticTokens; (function(p) { function H(p) { let H = p; return Is.objectLiteral(H) && (H.resultId === void 0 || typeof H.resultId == "string") && Array.isArray(H.data) && (H.data.length === 0 || typeof H.data[0] == "number"); } p.is = H; })(SemanticTokens ||= {}); var InlineValueText; (function(p) { function H(p, H) { return { range: p, text: H }; } p.create = H; function U(p) { let H = p; return H != null && Range.is(H.range) && Is.string(H.text); } p.is = U; })(InlineValueText ||= {}); var InlineValueVariableLookup; (function(p) { function H(p, H, U) { return { range: p, variableName: H, caseSensitiveLookup: U }; } p.create = H; function U(p) { let H = p; return H != null && Range.is(H.range) && Is.boolean(H.caseSensitiveLookup) && (Is.string(H.variableName) || H.variableName === void 0); } p.is = U; })(InlineValueVariableLookup ||= {}); var InlineValueEvaluatableExpression; (function(p) { function H(p, H) { return { range: p, expression: H }; } p.create = H; function U(p) { let H = p; return H != null && Range.is(H.range) && (Is.string(H.expression) || H.expression === void 0); } p.is = U; })(InlineValueEvaluatableExpression ||= {}); var InlineValueContext; (function(p) { function H(p, H) { return { frameId: p, stoppedLocation: H }; } p.create = H; function U(p) { let H = p; return Is.defined(H) && Range.is(p.stoppedLocation); } p.is = U; })(InlineValueContext ||= {}); var InlayHintKind; (function(p) { p.Type = 1, p.Parameter = 2; function H(p) { return p === 1 || p === 2; } p.is = H; })(InlayHintKind ||= {}); var InlayHintLabelPart; (function(p) { function H(p) { return { value: p }; } p.create = H; function U(p) { let H = p; return Is.objectLiteral(H) && (H.tooltip === void 0 || Is.string(H.tooltip) || MarkupContent.is(H.tooltip)) && (H.location === void 0 || Location.is(H.location)) && (H.command === void 0 || Command.is(H.command)); } p.is = U; })(InlayHintLabelPart ||= {}); var InlayHint; (function(p) { function H(p, H, U) { let W = { position: p, label: H }; return U !== void 0 && (W.kind = U), W; } p.create = H; function U(p) { let H = p; return Is.objectLiteral(H) && Position.is(H.position) && (Is.string(H.label) || Is.typedArray(H.label, InlayHintLabelPart.is)) && (H.kind === void 0 || InlayHintKind.is(H.kind)) && H.textEdits === void 0 || Is.typedArray(H.textEdits, TextEdit.is) && (H.tooltip === void 0 || Is.string(H.tooltip) || MarkupContent.is(H.tooltip)) && (H.paddingLeft === void 0 || Is.boolean(H.paddingLeft)) && (H.paddingRight === void 0 || Is.boolean(H.paddingRight)); } p.is = U; })(InlayHint ||= {}); var StringValue; (function(p) { function H(p) { return { kind: "snippet", value: p }; } p.createSnippet = H; })(StringValue ||= {}); var InlineCompletionItem; (function(p) { function H(p, H, U, W) { return { insertText: p, filterText: H, range: U, command: W }; } p.create = H; })(InlineCompletionItem ||= {}); var InlineCompletionList; (function(p) { function H(p) { return { items: p }; } p.create = H; })(InlineCompletionList ||= {}); var InlineCompletionTriggerKind; (function(p) { p.Invoked = 0, p.Automatic = 1; })(InlineCompletionTriggerKind ||= {}); var SelectedCompletionInfo; (function(p) { function H(p, H) { return { range: p, text: H }; } p.create = H; })(SelectedCompletionInfo ||= {}); var InlineCompletionContext; (function(p) { function H(p, H) { return { triggerKind: p, selectedCompletionInfo: H }; } p.create = H; })(InlineCompletionContext ||= {}); var WorkspaceFolder; (function(p) { function H(p) { let H = p; return Is.objectLiteral(H) && URI.is(H.uri) && Is.string(H.name); } p.is = H; })(WorkspaceFolder ||= {}); var TextDocument; (function(p) { function H(p, H, U, W) { return new FullTextDocument(p, H, U, W); } p.create = H; function U(p) { let H = p; return !!(Is.defined(H) && Is.string(H.uri) && (Is.undefined(H.languageId) || Is.string(H.languageId)) && Is.uinteger(H.lineCount) && Is.func(H.getText) && Is.func(H.positionAt) && Is.func(H.offsetAt)); } p.is = U; function W(p, H) { let U = p.getText(), W = G(H, (p, H) => { let U = p.range.start.line - H.range.start.line; return U === 0 ? p.range.start.character - H.range.start.character : U; }), K = U.length; for (let H = W.length - 1; H >= 0; H--) { let G = W[H], q = p.offsetAt(G.range.start), J = p.offsetAt(G.range.end); if (J <= K) U = U.substring(0, q) + G.newText + U.substring(J, U.length); else throw Error("Overlapping edit"); K = q; } return U; } p.applyEdits = W; function G(p, H) { if (p.length <= 1) return p; let U = p.length / 2 | 0, W = p.slice(0, U), K = p.slice(U); G(W, H), G(K, H); let q = 0, J = 0, Y = 0; for (; q < W.length && J < K.length;) H(W[q], K[J]) <= 0 ? p[Y++] = W[q++] : p[Y++] = K[J++]; for (; q < W.length;) p[Y++] = W[q++]; for (; J < K.length;) p[Y++] = K[J++]; return p; } })(TextDocument ||= {}); var FullTextDocument = class { constructor(p, H, U, W) { this._uri = p, this._languageId = H, this._version = U, this._content = W, this._lineOffsets = void 0; } get uri() { return this._uri; } get languageId() { return this._languageId; } get version() { return this._version; } getText(p) { if (p) { let H = this.offsetAt(p.start), U = this.offsetAt(p.end); return this._content.substring(H, U); } return this._content; } update(p, H) { this._content = p.text, this._version = H, this._lineOffsets = void 0; } getLineOffsets() { if (this._lineOffsets === void 0) { let p = [], H = this._content, U = !0; for (let W = 0; W < H.length; W++) { U &&= (p.push(W), !1); let G = H.charAt(W); U = G === "\r" || G === "\n", G === "\r" && W + 1 < H.length && H.charAt(W + 1) === "\n" && W++; } U && H.length > 0 && p.push(H.length), this._lineOffsets = p; } return this._lineOffsets; } positionAt(p) { p = Math.max(Math.min(p, this._content.length), 0); let H = this.getLineOffsets(), U = 0, W = H.length; if (W === 0) return Position.create(0, p); for (; U < W;) { let G = Math.floor((U + W) / 2); H[G] > p ? W = G : U = G + 1; } let G = U - 1; return Position.create(G, p - H[G]); } offsetAt(p) { let H = this.getLineOffsets(); if (p.line >= H.length) return this._content.length; if (p.line < 0) return 0; let U = H[p.line], W = p.line + 1 < H.length ? H[p.line + 1] : this._content.length; return Math.max(Math.min(U + p.character, W), U); } get lineCount() { return this.getLineOffsets().length; } }, Is; (function(p) { let H = Object.prototype.toString; function U(p) { return p !== void 0; } p.defined = U; function W(p) { return p === void 0; } p.undefined = W; function G(p) { return p === !0 || p === !1; } p.boolean = G; function K(p) { return H.call(p) === "[object String]"; } p.string = K; function q(p) { return H.call(p) === "[object Number]"; } p.number = q; function J(p, U, W) { return H.call(p) === "[object Number]" && U <= p && p <= W; } p.numberRange = J; function Y(p) { return H.call(p) === "[object Number]" && -2147483648 <= p && p <= 2147483647; } p.integer = Y; function X(p) { return H.call(p) === "[object Number]" && 0 <= p && p <= 2147483647; } p.uinteger = X; function Z(p) { return H.call(p) === "[object Function]"; } p.func = Z; function Q(p) { return typeof p == "object" && !!p; } p.objectLiteral = Q; function $(p, H) { return Array.isArray(p) && p.every(H); } p.typedArray = $; })(Is ||= {}); function butNot(p, H) { let U = p.match; return p.match = (p) => { let W = !1; return U && (W = U(p)), W && H.every((H) => H.match && !H.match(p)); }, p; } 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(p) { return { style: "keyword", match: (H) => H.kind === "Name" && H.value === p }; } function name(p) { return { style: p, match: (p) => p.kind === "Name", update(p, H) { p.name = H.value; } }; } var GraphQLDocumentMode; (function(p) { p.TYPE_SYSTEM = "TYPE_SYSTEM", p.EXECUTABLE = "EXECUTABLE", p.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(p) { p.Text = 1, p.Method = 2, p.Function = 3, p.Constructor = 4, p.Field = 5, p.Variable = 6, p.Class = 7, p.Interface = 8, p.Module = 9, p.Property = 10, p.Unit = 11, p.Value = 12, p.Enum = 13, p.Keyword = 14, p.Snippet = 15, p.Color = 16, p.File = 17, p.Reference = 18, p.Folder = 19, p.EnumMember = 20, p.Constant = 21, p.Struct = 22, p.Event = 23, p.Operator = 24, p.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(((p, H) => { function U(p, H) { if (p != null) return p; var U = Error(H === void 0 ? "Got unexpected " + p : H); throw U.framesToPop = 1, U; } H.exports = U, H.exports.default = U, Object.defineProperty(H.exports, "__esModule", { value: !0 }); })))(); const SEVERITY = { Error: "Error", Warning: "Warning", Information: "Information", Hint: "Hint" }; SEVERITY.Error, SEVERITY.Warning, SEVERITY.Information, SEVERITY.Hint; const getModelLanguageId = (p) => "getModeId" in p ? p.getModeId() : p.getLanguageId(), getStringSchema = (p) => { let { schema: H, documentAST: U, introspectionJSON: W, introspectionJSONString: G, documentString: K,...q } = p; if (H) return { ...q, documentString: printSchema(H) }; if (G) return { ...q, introspectionJSONString: G }; if (K) return { ...q, documentString: K }; if (W) return { ...q, introspectionJSONString: JSON.stringify(W) }; if (U) { let p = buildASTSchema(U, q.buildSchemaOptions); return { ...q, documentString: printSchema(p) }; } throw Error("No schema supplied"); }; var STOP_WHEN_IDLE_FOR = 120 * 1e3, WorkerManager = class { _defaults; _idleCheckInterval; _lastUsedTime = 0; _configChangeListener; _worker = null; _client = null; constructor(p) { this._defaults = p, 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: p, formattingOptions: H, schemas: U, externalFragmentDefinitions: W, completionSettings: K } = this._defaults; this._worker = editor.createWebWorker({ moduleId: "monaco-graphql/esm/GraphQLWorker.js", label: p, createData: { languageId: p, formattingOptions: H, languageConfig: { schemas: U?.map(getStringSchema), externalFragmentDefinitions: W, fillLeafsOnComplete: K.__experimental__fillLeafsOnComplete } } }), this._client = this._worker.getProxy(); } catch (p) { console.error("error loading worker", p); } return this._client; } async getLanguageServiceWorker(...p) { let H = await this._getClient(); return await this._worker.withSyncedResources(p), H; } }, DiagnosticsAdapter = class { defaults; _worker; _disposables = []; _listener = Object.create(null); constructor(p, H) { this.defaults = p, this._worker = H, this._worker = H; let U, W = (H) => { let W = getModelLanguageId(H); if (W !== this.defaults.languageId) return; let G = H.uri.toString(), K = p.diagnosticSettings.validateVariablesJSON?.[G]; U = setTimeout(() => { this._doValidate(H.uri, W, K); }, 400), this._listener[G] = H.onDidChangeContent(() => { clearTimeout(U), U = setTimeout(() => { this._doValidate(H.uri, W, K); }, 400); }); }, K = (p) => { editor.setModelMarkers(p, this.defaults.languageId, []); let H = p.uri.toString(), U = this._listener[H]; U && (U.dispose(), delete this._listener[H]); }; this._disposables.push(editor.onDidCreateModel(W), { dispose() { clearTimeout(U); } }, editor.onWillDisposeModel((p) => { K(p); }), editor.onDidChangeModelLanguage((p) => { K(p.model), W(p.model); }), { dispose: () => { for (let p of Object.values(this._listener)) p.dispose(); } }, p.onDidChange(() => { for (let p of editor.getModels()) getModelLanguageId(p) === this.defaults.languageId && (K(p), W(p)); })); for (let p of editor.getModels()) getModelLanguageId(p) === this.defaults.languageId && W(p); } dispose() { for (let p of this._disposables) p.dispose(); this._disposables = []; } async _doValidate(p, H, K) { let q = await this._worker(p); if (!q) return; let J = await q.doValidation(p.toString()); if (editor.setModelMarkers(editor.getModel(p), H, J), K) { if (await import("./monaco.contribution-pnEHc2s_.js"), !K.length) throw Error("No variables URI strings provided to validate"); let H = await q.doGetVariablesJSONSchema(p.toString()); if (!H) return; let G = Uri.file(K[0].replace(".json", "-schema.json")).toString(), J = { uri: G, schema: H, fileMatch: K }, Y = languages.json.jsonDefaults.diagnosticsOptions.schemas?.filter((p) => p.uri !== G) || []; languages.json.jsonDefaults.setDiagnosticsOptions({ schemaValidation: "error", validate: !0, ...this.defaults.diagnosticSettings.jsonDiagnosticSettings, schemas: [...Y, J], 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(p) { return p in kindMap ? kindMap[p] : mKind.Text; } function toCompletion(p) { return { range: p.range, kind: toCompletionItemKind(p.kind), label: p.label, insertText: p.insertText ?? p.label, insertTextRules: p.insertText ? languages.CompletionItemInsertTextRule.InsertAsSnippet : void 0, sortText: p.sortText, filterText: p.filterText, documentation: p.documentation, detail: p.detail, command: p.command }; } var CompletionAdapter = class { _worker; constructor(p) { this._worker = p, this._worker = p; } get triggerCharacters() { return [ ":", "$", " ", "(", "@" ]; } async provideCompletionItems(p, H, U, W) { try { return { incomplete: !0, suggestions: (await (await this._worker(p.uri)).doComplete(p.uri.toString(), H)).map(toCompletion) }; } catch (p) { return console.error("Error fetching completion items", p), { suggestions: [] }; } } }, DocumentFormattingAdapter = class { _worker; constructor(p) { this._worker = p, this._worker = p; } async provideDocumentFormattingEdits(p, H, U) { let W = await (await this._worker(p.uri)).doFormat(p.uri.toString()); return W ? [{ range: p.getFullModelRange(), text: W }] : []; } }, HoverAdapter = class { _worker; constructor(p) { this._worker = p; } async provideHover(p, H, U) { let W = p.uri, G = await (await this._worker(p.uri)).doHover(W.toString(), H); return G ? { range: G.range, contents: [{ value: G.content }] } : { contents: [] }; } dispose() {} }; function setupMode(p) { let H = [], U = [], G = new WorkerManager(p); H.push(G); let K = (...p) => { try { return G.getLanguageServiceWorker(...p); } catch { throw Error("Error fetching graphql language service worker"); } }; function q() { let { modeConfiguration: H, languageId: G } = p; H.documentFormattingEdits && U.push(languages.registerDocumentFormattingEditProvider(G, new DocumentFormattingAdapter(K))); } function J(H) { let { modeConfiguration: G, languageId: J } = p; disposeAll(U), G.completionItems && U.push(languages.registerCompletionItemProvider(J, new CompletionAdapter(K))), G.diagnostics && U.push(new DiagnosticsAdapter(H, K)), G.hovers && U.push(languages.registerHoverProvider(J, new HoverAdapter(K))), q(); } let { modeConfiguration: Y, formattingOptions: X, diagnosticSettings: Z, externalFragmentDefinitions: Q, schemas: $ } = p; return J(p), p.onDidChange((p) => { p.modeConfiguration !== Y && (Y = p.modeConfiguration, J(p)), p.formattingOptions !== X && (X = p.formattingOptions, q()), p.externalFragmentDefinitions !== Q && (Q = p.externalFragmentDefinitions, J(p)), p.diagnosticSettings !== Z && (Z = p.diagnosticSettings, J(p)), p.schemas !== $ && ($ = p.schemas, J(p)); }), H.push(asDisposable(U)), asDisposable(H); } function asDisposable(p) { return { dispose: () => disposeAll(p) }; } function disposeAll(p) { for (; p.length;) p.pop().dispose(); } export { setupMode };