@rexeus/typeweaver 0.3.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/chunk-AYKTAXMI.js +14954 -0
  2. package/dist/chunk-K3NQKI34.js +1 -3
  3. package/dist/cli-Q5T6SL57.js +14951 -0
  4. package/dist/cli.cjs +1045 -102301
  5. package/dist/cli.js +1 -2
  6. package/dist/entry.js +3 -3
  7. package/dist/index.cjs +1 -116227
  8. package/dist/index.js +1 -2
  9. package/dist/metafile-cjs.json +1 -0
  10. package/dist/metafile-esm.json +1 -0
  11. package/dist/tsx-loader-3QUDYASH.js +1 -3
  12. package/package.json +18 -8
  13. package/dist/acorn-TNAGPKCR.js +0 -3130
  14. package/dist/acorn-ZFAHQIG7.js +0 -3131
  15. package/dist/angular-3KXBV3WD.js +0 -3030
  16. package/dist/angular-WMVKTHFF.js +0 -3031
  17. package/dist/babel-5QZSVJOE.js +0 -7297
  18. package/dist/babel-V7SGJWS6.js +0 -7296
  19. package/dist/chunk-4ST7XK4F.js +0 -34641
  20. package/dist/chunk-MLKGABMK.js +0 -9
  21. package/dist/cli-GOSMI5D3.js +0 -34642
  22. package/dist/estree-QSPT5I7I.js +0 -4612
  23. package/dist/estree-Y36AM62I.js +0 -4613
  24. package/dist/flow-7LH7X5GA.js +0 -27547
  25. package/dist/flow-WHVBWPDR.js +0 -27546
  26. package/dist/glimmer-BHRIPYOK.js +0 -2894
  27. package/dist/glimmer-CBYXJR5M.js +0 -2895
  28. package/dist/graphql-7EJJJFHU.js +0 -1266
  29. package/dist/graphql-KKVSZXX7.js +0 -1267
  30. package/dist/html-M3WOAMIJ.js +0 -2927
  31. package/dist/html-YM5TKPVB.js +0 -2926
  32. package/dist/markdown-FIK6SNTF.js +0 -3551
  33. package/dist/markdown-X6DQGEVV.js +0 -3552
  34. package/dist/meriyah-FBUICA5T.js +0 -2684
  35. package/dist/meriyah-GWPOVAHY.js +0 -2685
  36. package/dist/postcss-N2W7KQ6Q.js +0 -5081
  37. package/dist/postcss-ODV7XV5T.js +0 -5080
  38. package/dist/typescript-BG63TNYD.js +0 -13203
  39. package/dist/typescript-IYJMK2NE.js +0 -13204
  40. package/dist/yaml-5FEMTYXO.js +0 -4225
  41. package/dist/yaml-DV3ZI4ZT.js +0 -4224
@@ -1,1267 +0,0 @@
1
- #!/usr/bin/env node
2
- import "./chunk-K3NQKI34.js";
3
-
4
- // ../../node_modules/.pnpm/prettier@3.7.4/node_modules/prettier/plugins/graphql.mjs
5
- var pt = Object.defineProperty;
6
- var de = (e2, t) => {
7
- for (var n in t) pt(e2, n, { get: t[n], enumerable: true });
8
- };
9
- var ut = {};
10
- de(ut, { languages: () => Ye, options: () => $e, parsers: () => he, printers: () => nn });
11
- var me = (e2, t) => (n, i, ...r) => n | 1 && i == null ? void 0 : (t.call(i) ?? i[e2]).apply(i, r);
12
- var lt = String.prototype.replaceAll ?? function(e2, t) {
13
- return e2.global ? this.replace(e2, t) : this.split(e2).join(t);
14
- };
15
- var ft = me("replaceAll", function() {
16
- if (typeof this == "string") return lt;
17
- });
18
- var U = ft;
19
- var ht = () => {
20
- };
21
- var ie = ht;
22
- var Ee = "indent";
23
- var Te = "group";
24
- var Ne = "if-break";
25
- var G = "line";
26
- var xe = "break-parent";
27
- var S = ie;
28
- var Y = ie;
29
- function x(e2) {
30
- return S(e2), { type: Ee, contents: e2 };
31
- }
32
- var _e = { type: xe };
33
- function y(e2, t = {}) {
34
- return S(e2), Y(t.expandedStates, true), { type: Te, id: t.id, contents: e2, break: !!t.shouldBreak, expandedStates: t.expandedStates };
35
- }
36
- function I(e2, t = "", n = {}) {
37
- return S(e2), t !== "" && S(t), { type: Ne, breakContents: e2, flatContents: t, groupId: n.groupId };
38
- }
39
- function E(e2, t) {
40
- S(e2), Y(t);
41
- let n = [];
42
- for (let i = 0; i < t.length; i++) i !== 0 && n.push(e2), n.push(t[i]);
43
- return n;
44
- }
45
- var k = { type: G };
46
- var l = { type: G, soft: true };
47
- var dt = { type: G, hard: true };
48
- var f = [dt, _e];
49
- function j(e2) {
50
- return (t, n, i) => {
51
- let r = !!i?.backwards;
52
- if (n === false) return false;
53
- let { length: s } = t, a = n;
54
- for (; a >= 0 && a < s; ) {
55
- let u = t.charAt(a);
56
- if (e2 instanceof RegExp) {
57
- if (!e2.test(u)) return a;
58
- } else if (!e2.includes(u)) return a;
59
- r ? a-- : a++;
60
- }
61
- return a === -1 || a === s ? a : false;
62
- };
63
- }
64
- var kn = j(/\s/u);
65
- var $ = j(" ");
66
- var ye = j(",; ");
67
- var Ae = j(/[^\n\r]/u);
68
- var Oe = (e2) => e2 === `
69
- ` || e2 === "\r" || e2 === "\u2028" || e2 === "\u2029";
70
- function mt(e2, t, n) {
71
- let i = !!n?.backwards;
72
- if (t === false) return false;
73
- let r = e2.charAt(t);
74
- if (i) {
75
- if (e2.charAt(t - 1) === "\r" && r === `
76
- `) return t - 2;
77
- if (Oe(r)) return t - 1;
78
- } else {
79
- if (r === "\r" && e2.charAt(t + 1) === `
80
- `) return t + 2;
81
- if (Oe(r)) return t + 1;
82
- }
83
- return t;
84
- }
85
- var X = mt;
86
- function Et(e2, t, n = {}) {
87
- let i = $(e2, n.backwards ? t - 1 : t, n), r = X(e2, i, n);
88
- return i !== r;
89
- }
90
- var Ie = Et;
91
- function Tt(e2, t) {
92
- if (t === false) return false;
93
- if (e2.charAt(t) === "/" && e2.charAt(t + 1) === "*") {
94
- for (let n = t + 2; n < e2.length; ++n) if (e2.charAt(n) === "*" && e2.charAt(n + 1) === "/") return n + 2;
95
- }
96
- return t;
97
- }
98
- var De = Tt;
99
- function Nt(e2, t) {
100
- return t === false ? false : e2.charAt(t) === "/" && e2.charAt(t + 1) === "/" ? Ae(e2, t) : t;
101
- }
102
- var ge = Nt;
103
- function xt(e2, t) {
104
- let n = null, i = t;
105
- for (; i !== n; ) n = i, i = ye(e2, i), i = De(e2, i), i = $(e2, i);
106
- return i = ge(e2, i), i = X(e2, i), i !== false && Ie(e2, i);
107
- }
108
- var Se = xt;
109
- function _t(e2) {
110
- return Array.isArray(e2) && e2.length > 0;
111
- }
112
- var se = _t;
113
- var oe = class extends Error {
114
- name = "UnexpectedNodeError";
115
- constructor(t, n, i = "type") {
116
- super(`Unexpected ${n} node ${i}: ${JSON.stringify(t[i])}.`), this.node = t;
117
- }
118
- };
119
- var ke = oe;
120
- var P = null;
121
- function w(e2) {
122
- if (P !== null && typeof P.property) {
123
- let t = P;
124
- return P = w.prototype = null, t;
125
- }
126
- return P = w.prototype = e2 ?? /* @__PURE__ */ Object.create(null), new w();
127
- }
128
- var yt = 10;
129
- for (let e2 = 0; e2 <= yt; e2++) w();
130
- function ae(e2) {
131
- return w(e2);
132
- }
133
- function At(e2, t = "type") {
134
- ae(e2);
135
- function n(i) {
136
- let r = i[t], s = e2[r];
137
- if (!Array.isArray(s)) throw Object.assign(new Error(`Missing visitor keys for '${r}'.`), { node: i });
138
- return s;
139
- }
140
- return n;
141
- }
142
- var Ce = At;
143
- var H = class {
144
- constructor(t, n, i) {
145
- this.start = t.start, this.end = n.end, this.startToken = t, this.endToken = n, this.source = i;
146
- }
147
- get [Symbol.toStringTag]() {
148
- return "Location";
149
- }
150
- toJSON() {
151
- return { start: this.start, end: this.end };
152
- }
153
- };
154
- var F = class {
155
- constructor(t, n, i, r, s, a) {
156
- this.kind = t, this.start = n, this.end = i, this.line = r, this.column = s, this.value = a, this.prev = null, this.next = null;
157
- }
158
- get [Symbol.toStringTag]() {
159
- return "Token";
160
- }
161
- toJSON() {
162
- return { kind: this.kind, value: this.value, line: this.line, column: this.column };
163
- }
164
- };
165
- var ce = { Name: [], Document: ["definitions"], OperationDefinition: ["description", "name", "variableDefinitions", "directives", "selectionSet"], VariableDefinition: ["description", "variable", "type", "defaultValue", "directives"], Variable: ["name"], SelectionSet: ["selections"], Field: ["alias", "name", "arguments", "directives", "selectionSet"], Argument: ["name", "value"], FragmentSpread: ["name", "directives"], InlineFragment: ["typeCondition", "directives", "selectionSet"], FragmentDefinition: ["description", "name", "variableDefinitions", "typeCondition", "directives", "selectionSet"], IntValue: [], FloatValue: [], StringValue: [], BooleanValue: [], NullValue: [], EnumValue: [], ListValue: ["values"], ObjectValue: ["fields"], ObjectField: ["name", "value"], Directive: ["name", "arguments"], NamedType: ["name"], ListType: ["type"], NonNullType: ["type"], SchemaDefinition: ["description", "directives", "operationTypes"], OperationTypeDefinition: ["type"], ScalarTypeDefinition: ["description", "name", "directives"], ObjectTypeDefinition: ["description", "name", "interfaces", "directives", "fields"], FieldDefinition: ["description", "name", "arguments", "type", "directives"], InputValueDefinition: ["description", "name", "type", "defaultValue", "directives"], InterfaceTypeDefinition: ["description", "name", "interfaces", "directives", "fields"], UnionTypeDefinition: ["description", "name", "directives", "types"], EnumTypeDefinition: ["description", "name", "directives", "values"], EnumValueDefinition: ["description", "name", "directives"], InputObjectTypeDefinition: ["description", "name", "directives", "fields"], DirectiveDefinition: ["description", "name", "arguments", "locations"], SchemaExtension: ["directives", "operationTypes"], ScalarTypeExtension: ["name", "directives"], ObjectTypeExtension: ["name", "interfaces", "directives", "fields"], InterfaceTypeExtension: ["name", "interfaces", "directives", "fields"], UnionTypeExtension: ["name", "directives", "types"], EnumTypeExtension: ["name", "directives", "values"], InputObjectTypeExtension: ["name", "directives", "fields"], TypeCoordinate: ["name"], MemberCoordinate: ["name", "memberName"], ArgumentCoordinate: ["name", "fieldName", "argumentName"], DirectiveCoordinate: ["name"], DirectiveArgumentCoordinate: ["name", "argumentName"] };
166
- var qn = new Set(Object.keys(ce));
167
- var C;
168
- (function(e2) {
169
- e2.QUERY = "query", e2.MUTATION = "mutation", e2.SUBSCRIPTION = "subscription";
170
- })(C || (C = {}));
171
- var Re = { ...ce };
172
- for (let e2 of ["ArgumentCoordinate", "DirectiveArgumentCoordinate", "DirectiveCoordinate", "MemberCoordinate", "TypeCoordinate"]) delete Re[e2];
173
- var ve = Re;
174
- var Ot = Ce(ve, "kind");
175
- var be = Ot;
176
- var J = (e2) => e2.loc.start;
177
- var q = (e2) => e2.loc.end;
178
- var Le = "format";
179
- var Pe = /^\s*#[^\S\n]*@(?:noformat|noprettier)\s*(?:\n|$)/u;
180
- var we = /^\s*#[^\S\n]*@(?:format|prettier)\s*(?:\n|$)/u;
181
- var Fe = (e2) => we.test(e2);
182
- var Me = (e2) => Pe.test(e2);
183
- var Ve = (e2) => `# @${Le}
184
-
185
- ${e2}`;
186
- function It(e2, t, n) {
187
- let { node: i } = e2;
188
- if (!i.description) return "";
189
- let r = [n("description")];
190
- return i.kind === "InputValueDefinition" && !i.description.block ? r.push(k) : r.push(f), r;
191
- }
192
- var A = It;
193
- function Dt(e2, t, n) {
194
- let { node: i } = e2;
195
- switch (i.kind) {
196
- case "Document":
197
- return [...E(f, g(e2, t, n, "definitions")), f];
198
- case "OperationDefinition": {
199
- let r = t.originalText[J(i)] !== "{", s = !!i.name;
200
- return [A(e2, t, n), r ? i.operation : "", r && s ? [" ", n("name")] : "", r && !s && se(i.variableDefinitions) ? " " : "", Be(e2, n), _(e2, n, i), !r && !s ? "" : " ", n("selectionSet")];
201
- }
202
- case "FragmentDefinition":
203
- return [A(e2, t, n), "fragment ", n("name"), Be(e2, n), " on ", n("typeCondition"), _(e2, n, i), " ", n("selectionSet")];
204
- case "SelectionSet":
205
- return ["{", x([f, E(f, g(e2, t, n, "selections"))]), f, "}"];
206
- case "Field":
207
- return y([i.alias ? [n("alias"), ": "] : "", n("name"), i.arguments.length > 0 ? y(["(", x([l, E([I("", ", "), l], g(e2, t, n, "arguments"))]), l, ")"]) : "", _(e2, n, i), i.selectionSet ? " " : "", n("selectionSet")]);
208
- case "Name":
209
- return i.value;
210
- case "StringValue":
211
- if (i.block) {
212
- let r = U(0, i.value, '"""', '\\"""').split(`
213
- `);
214
- return r.length === 1 && (r[0] = r[0].trim()), r.every((s) => s === "") && (r.length = 0), E(f, ['"""', ...r, '"""']);
215
- }
216
- return ['"', U(0, U(0, i.value, /["\\]/gu, "\\$&"), `
217
- `, "\\n"), '"'];
218
- case "IntValue":
219
- case "FloatValue":
220
- case "EnumValue":
221
- return i.value;
222
- case "BooleanValue":
223
- return i.value ? "true" : "false";
224
- case "NullValue":
225
- return "null";
226
- case "Variable":
227
- return ["$", n("name")];
228
- case "ListValue":
229
- return y(["[", x([l, E([I("", ", "), l], e2.map(n, "values"))]), l, "]"]);
230
- case "ObjectValue": {
231
- let r = t.bracketSpacing && i.fields.length > 0 ? " " : "";
232
- return y(["{", r, x([l, E([I("", ", "), l], e2.map(n, "fields"))]), l, I("", r), "}"]);
233
- }
234
- case "ObjectField":
235
- case "Argument":
236
- return [n("name"), ": ", n("value")];
237
- case "Directive":
238
- return ["@", n("name"), i.arguments.length > 0 ? y(["(", x([l, E([I("", ", "), l], g(e2, t, n, "arguments"))]), l, ")"]) : ""];
239
- case "NamedType":
240
- return n("name");
241
- case "VariableDefinition":
242
- return [A(e2, t, n), n("variable"), ": ", n("type"), i.defaultValue ? [" = ", n("defaultValue")] : "", _(e2, n, i)];
243
- case "ObjectTypeExtension":
244
- case "ObjectTypeDefinition":
245
- case "InputObjectTypeExtension":
246
- case "InputObjectTypeDefinition":
247
- case "InterfaceTypeExtension":
248
- case "InterfaceTypeDefinition": {
249
- let { kind: r } = i, s = [];
250
- return r.endsWith("TypeDefinition") ? s.push(A(e2, t, n)) : s.push("extend "), r.startsWith("ObjectType") ? s.push("type") : r.startsWith("InputObjectType") ? s.push("input") : s.push("interface"), s.push(" ", n("name")), !r.startsWith("InputObjectType") && i.interfaces.length > 0 && s.push(" implements ", ...kt(e2, t, n)), s.push(_(e2, n, i)), i.fields.length > 0 && s.push([" {", x([f, E(f, g(e2, t, n, "fields"))]), f, "}"]), s;
251
- }
252
- case "FieldDefinition":
253
- return [A(e2, t, n), n("name"), i.arguments.length > 0 ? y(["(", x([l, E([I("", ", "), l], g(e2, t, n, "arguments"))]), l, ")"]) : "", ": ", n("type"), _(e2, n, i)];
254
- case "DirectiveDefinition":
255
- return [A(e2, t, n), "directive ", "@", n("name"), i.arguments.length > 0 ? y(["(", x([l, E([I("", ", "), l], g(e2, t, n, "arguments"))]), l, ")"]) : "", i.repeatable ? " repeatable" : "", " on ", ...E(" | ", e2.map(n, "locations"))];
256
- case "EnumTypeExtension":
257
- case "EnumTypeDefinition":
258
- return [A(e2, t, n), i.kind === "EnumTypeExtension" ? "extend " : "", "enum ", n("name"), _(e2, n, i), i.values.length > 0 ? [" {", x([f, E(f, g(e2, t, n, "values"))]), f, "}"] : ""];
259
- case "EnumValueDefinition":
260
- return [A(e2, t, n), n("name"), _(e2, n, i)];
261
- case "InputValueDefinition":
262
- return [A(e2, t, n), n("name"), ": ", n("type"), i.defaultValue ? [" = ", n("defaultValue")] : "", _(e2, n, i)];
263
- case "SchemaExtension":
264
- return ["extend schema", _(e2, n, i), ...i.operationTypes.length > 0 ? [" {", x([f, E(f, g(e2, t, n, "operationTypes"))]), f, "}"] : []];
265
- case "SchemaDefinition":
266
- return [A(e2, t, n), "schema", _(e2, n, i), " {", i.operationTypes.length > 0 ? x([f, E(f, g(e2, t, n, "operationTypes"))]) : "", f, "}"];
267
- case "OperationTypeDefinition":
268
- return [i.operation, ": ", n("type")];
269
- case "FragmentSpread":
270
- return ["...", n("name"), _(e2, n, i)];
271
- case "InlineFragment":
272
- return ["...", i.typeCondition ? [" on ", n("typeCondition")] : "", _(e2, n, i), " ", n("selectionSet")];
273
- case "UnionTypeExtension":
274
- case "UnionTypeDefinition":
275
- return y([A(e2, t, n), y([i.kind === "UnionTypeExtension" ? "extend " : "", "union ", n("name"), _(e2, n, i), i.types.length > 0 ? [" =", I("", " "), x([I([k, "| "]), E([k, "| "], e2.map(n, "types"))])] : ""])]);
276
- case "ScalarTypeExtension":
277
- case "ScalarTypeDefinition":
278
- return [A(e2, t, n), i.kind === "ScalarTypeExtension" ? "extend " : "", "scalar ", n("name"), _(e2, n, i)];
279
- case "NonNullType":
280
- return [n("type"), "!"];
281
- case "ListType":
282
- return ["[", n("type"), "]"];
283
- default:
284
- throw new ke(i, "Graphql", "kind");
285
- }
286
- }
287
- function _(e2, t, n) {
288
- if (n.directives.length === 0) return "";
289
- let i = E(k, e2.map(t, "directives"));
290
- return n.kind === "FragmentDefinition" || n.kind === "OperationDefinition" ? y([k, i]) : [" ", y(x([l, i]))];
291
- }
292
- function g(e2, t, n, i) {
293
- return e2.map(({ isLast: r, node: s }) => {
294
- let a = n();
295
- return !r && Se(t.originalText, q(s)) ? [a, f] : a;
296
- }, i);
297
- }
298
- function gt(e2) {
299
- return e2.kind !== "Comment";
300
- }
301
- function St({ node: e2 }) {
302
- if (e2.kind === "Comment") return "#" + e2.value.trimEnd();
303
- throw new Error("Not a comment: " + JSON.stringify(e2));
304
- }
305
- function kt(e2, t, n) {
306
- let { node: i } = e2, r = [], { interfaces: s } = i, a = e2.map(n, "interfaces");
307
- for (let u = 0; u < s.length; u++) {
308
- let p = s[u];
309
- r.push(a[u]);
310
- let T = s[u + 1];
311
- if (T) {
312
- let D = t.originalText.slice(p.loc.end, T.loc.start).includes("#");
313
- r.push(" &", D ? k : " ");
314
- }
315
- }
316
- return r;
317
- }
318
- function Be(e2, t) {
319
- let { node: n } = e2;
320
- return se(n.variableDefinitions) ? y(["(", x([l, E([I("", ", "), l], e2.map(t, "variableDefinitions"))]), l, ")"]) : "";
321
- }
322
- function Ue(e2, t) {
323
- e2.kind === "StringValue" && e2.block && !e2.value.includes(`
324
- `) && (t.value = e2.value.trim());
325
- }
326
- Ue.ignoredProperties = /* @__PURE__ */ new Set(["loc", "comments"]);
327
- function Ct(e2) {
328
- let { node: t } = e2;
329
- return t?.comments?.some((n) => n.value.trim() === "prettier-ignore");
330
- }
331
- var Rt = { print: Dt, massageAstNode: Ue, hasPrettierIgnore: Ct, insertPragma: Ve, printComment: St, canAttachComment: gt, getVisitorKeys: be };
332
- var Ge = Rt;
333
- var Ye = [{ name: "GraphQL", type: "data", aceMode: "graphqlschema", extensions: [".graphql", ".gql", ".graphqls"], tmScope: "source.graphql", parsers: ["graphql"], vscodeLanguageIds: ["graphql"], linguistLanguageId: 139 }];
334
- var je = { bracketSpacing: { category: "Common", type: "boolean", default: true, description: "Print spaces between brackets.", oppositeDescription: "Do not print spaces between brackets." }, objectWrap: { category: "Common", type: "choice", default: "preserve", description: "How to wrap object literals.", choices: [{ value: "preserve", description: "Keep as multi-line, if there is a newline between the opening brace and first property." }, { value: "collapse", description: "Fit to a single line when possible." }] }, singleQuote: { category: "Common", type: "boolean", default: false, description: "Use single quotes instead of double quotes." }, proseWrap: { category: "Common", type: "choice", default: "preserve", description: "How to wrap prose.", choices: [{ value: "always", description: "Wrap prose if it exceeds the print width." }, { value: "never", description: "Do not wrap prose." }, { value: "preserve", description: "Wrap prose as-is." }] }, bracketSameLine: { category: "Common", type: "boolean", default: false, description: "Put > of opening tags on the last line instead of on a new line." }, singleAttributePerLine: { category: "Common", type: "boolean", default: false, description: "Enforce single attribute per line in HTML, Vue and JSX." } };
335
- var vt = { bracketSpacing: je.bracketSpacing };
336
- var $e = vt;
337
- var he = {};
338
- de(he, { graphql: () => tn });
339
- function Xe(e2) {
340
- return typeof e2 == "object" && e2 !== null;
341
- }
342
- function He(e2, t) {
343
- if (!!!e2) throw new Error(t ?? "Unexpected invariant triggered.");
344
- }
345
- var bt = /\r\n|[\n\r]/g;
346
- function M(e2, t) {
347
- let n = 0, i = 1;
348
- for (let r of e2.body.matchAll(bt)) {
349
- if (typeof r.index == "number" || He(false), r.index >= t) break;
350
- n = r.index + r[0].length, i += 1;
351
- }
352
- return { line: i, column: t + 1 - n };
353
- }
354
- function qe(e2) {
355
- return ue(e2.source, M(e2.source, e2.start));
356
- }
357
- function ue(e2, t) {
358
- let n = e2.locationOffset.column - 1, i = "".padStart(n) + e2.body, r = t.line - 1, s = e2.locationOffset.line - 1, a = t.line + s, u = t.line === 1 ? n : 0, p = t.column + u, T = `${e2.name}:${a}:${p}
359
- `, d = i.split(/\r\n|[\n\r]/g), D = d[r];
360
- if (D.length > 120) {
361
- let O = Math.floor(p / 80), re = p % 80, N = [];
362
- for (let v = 0; v < D.length; v += 80) N.push(D.slice(v, v + 80));
363
- return T + Je([[`${a} |`, N[0]], ...N.slice(1, O + 1).map((v) => ["|", v]), ["|", "^".padStart(re)], ["|", N[O + 1]]]);
364
- }
365
- return T + Je([[`${a - 1} |`, d[r - 1]], [`${a} |`, D], ["|", "^".padStart(p)], [`${a + 1} |`, d[r + 1]]]);
366
- }
367
- function Je(e2) {
368
- let t = e2.filter(([i, r]) => r !== void 0), n = Math.max(...t.map(([i]) => i.length));
369
- return t.map(([i, r]) => i.padStart(n) + (r ? " " + r : "")).join(`
370
- `);
371
- }
372
- function Lt(e2) {
373
- let t = e2[0];
374
- return t == null || "kind" in t || "length" in t ? { nodes: t, source: e2[1], positions: e2[2], path: e2[3], originalError: e2[4], extensions: e2[5] } : t;
375
- }
376
- var Q = class e extends Error {
377
- constructor(t, ...n) {
378
- var i, r, s;
379
- let { nodes: a, source: u, positions: p, path: T, originalError: d, extensions: D } = Lt(n);
380
- super(t), this.name = "GraphQLError", this.path = T ?? void 0, this.originalError = d ?? void 0, this.nodes = Qe(Array.isArray(a) ? a : a ? [a] : void 0);
381
- let O = Qe((i = this.nodes) === null || i === void 0 ? void 0 : i.map((N) => N.loc).filter((N) => N != null));
382
- this.source = u ?? (O == null || (r = O[0]) === null || r === void 0 ? void 0 : r.source), this.positions = p ?? O?.map((N) => N.start), this.locations = p && u ? p.map((N) => M(u, N)) : O?.map((N) => M(N.source, N.start));
383
- let re = Xe(d?.extensions) ? d?.extensions : void 0;
384
- this.extensions = (s = D ?? re) !== null && s !== void 0 ? s : /* @__PURE__ */ Object.create(null), Object.defineProperties(this, { message: { writable: true, enumerable: true }, name: { enumerable: false }, nodes: { enumerable: false }, source: { enumerable: false }, positions: { enumerable: false }, originalError: { enumerable: false } }), d != null && d.stack ? Object.defineProperty(this, "stack", { value: d.stack, writable: true, configurable: true }) : Error.captureStackTrace ? Error.captureStackTrace(this, e) : Object.defineProperty(this, "stack", { value: Error().stack, writable: true, configurable: true });
385
- }
386
- get [Symbol.toStringTag]() {
387
- return "GraphQLError";
388
- }
389
- toString() {
390
- let t = this.message;
391
- if (this.nodes) for (let n of this.nodes) n.loc && (t += `
392
-
393
- ` + qe(n.loc));
394
- else if (this.source && this.locations) for (let n of this.locations) t += `
395
-
396
- ` + ue(this.source, n);
397
- return t;
398
- }
399
- toJSON() {
400
- let t = { message: this.message };
401
- return this.locations != null && (t.locations = this.locations), this.path != null && (t.path = this.path), this.extensions != null && Object.keys(this.extensions).length > 0 && (t.extensions = this.extensions), t;
402
- }
403
- };
404
- function Qe(e2) {
405
- return e2 === void 0 || e2.length === 0 ? void 0 : e2;
406
- }
407
- function h(e2, t, n) {
408
- return new Q(`Syntax Error: ${n}`, { source: e2, positions: [t] });
409
- }
410
- var W;
411
- (function(e2) {
412
- e2.QUERY = "QUERY", e2.MUTATION = "MUTATION", e2.SUBSCRIPTION = "SUBSCRIPTION", e2.FIELD = "FIELD", e2.FRAGMENT_DEFINITION = "FRAGMENT_DEFINITION", e2.FRAGMENT_SPREAD = "FRAGMENT_SPREAD", e2.INLINE_FRAGMENT = "INLINE_FRAGMENT", e2.VARIABLE_DEFINITION = "VARIABLE_DEFINITION", e2.SCHEMA = "SCHEMA", e2.SCALAR = "SCALAR", e2.OBJECT = "OBJECT", e2.FIELD_DEFINITION = "FIELD_DEFINITION", e2.ARGUMENT_DEFINITION = "ARGUMENT_DEFINITION", e2.INTERFACE = "INTERFACE", e2.UNION = "UNION", e2.ENUM = "ENUM", e2.ENUM_VALUE = "ENUM_VALUE", e2.INPUT_OBJECT = "INPUT_OBJECT", e2.INPUT_FIELD_DEFINITION = "INPUT_FIELD_DEFINITION";
413
- })(W || (W = {}));
414
- var c;
415
- (function(e2) {
416
- e2.NAME = "Name", e2.DOCUMENT = "Document", e2.OPERATION_DEFINITION = "OperationDefinition", e2.VARIABLE_DEFINITION = "VariableDefinition", e2.SELECTION_SET = "SelectionSet", e2.FIELD = "Field", e2.ARGUMENT = "Argument", e2.FRAGMENT_SPREAD = "FragmentSpread", e2.INLINE_FRAGMENT = "InlineFragment", e2.FRAGMENT_DEFINITION = "FragmentDefinition", e2.VARIABLE = "Variable", e2.INT = "IntValue", e2.FLOAT = "FloatValue", e2.STRING = "StringValue", e2.BOOLEAN = "BooleanValue", e2.NULL = "NullValue", e2.ENUM = "EnumValue", e2.LIST = "ListValue", e2.OBJECT = "ObjectValue", e2.OBJECT_FIELD = "ObjectField", e2.DIRECTIVE = "Directive", e2.NAMED_TYPE = "NamedType", e2.LIST_TYPE = "ListType", e2.NON_NULL_TYPE = "NonNullType", e2.SCHEMA_DEFINITION = "SchemaDefinition", e2.OPERATION_TYPE_DEFINITION = "OperationTypeDefinition", e2.SCALAR_TYPE_DEFINITION = "ScalarTypeDefinition", e2.OBJECT_TYPE_DEFINITION = "ObjectTypeDefinition", e2.FIELD_DEFINITION = "FieldDefinition", e2.INPUT_VALUE_DEFINITION = "InputValueDefinition", e2.INTERFACE_TYPE_DEFINITION = "InterfaceTypeDefinition", e2.UNION_TYPE_DEFINITION = "UnionTypeDefinition", e2.ENUM_TYPE_DEFINITION = "EnumTypeDefinition", e2.ENUM_VALUE_DEFINITION = "EnumValueDefinition", e2.INPUT_OBJECT_TYPE_DEFINITION = "InputObjectTypeDefinition", e2.DIRECTIVE_DEFINITION = "DirectiveDefinition", e2.SCHEMA_EXTENSION = "SchemaExtension", e2.SCALAR_TYPE_EXTENSION = "ScalarTypeExtension", e2.OBJECT_TYPE_EXTENSION = "ObjectTypeExtension", e2.INTERFACE_TYPE_EXTENSION = "InterfaceTypeExtension", e2.UNION_TYPE_EXTENSION = "UnionTypeExtension", e2.ENUM_TYPE_EXTENSION = "EnumTypeExtension", e2.INPUT_OBJECT_TYPE_EXTENSION = "InputObjectTypeExtension", e2.TYPE_COORDINATE = "TypeCoordinate", e2.MEMBER_COORDINATE = "MemberCoordinate", e2.ARGUMENT_COORDINATE = "ArgumentCoordinate", e2.DIRECTIVE_COORDINATE = "DirectiveCoordinate", e2.DIRECTIVE_ARGUMENT_COORDINATE = "DirectiveArgumentCoordinate";
417
- })(c || (c = {}));
418
- function We(e2) {
419
- return e2 === 9 || e2 === 32;
420
- }
421
- function b(e2) {
422
- return e2 >= 48 && e2 <= 57;
423
- }
424
- function ze(e2) {
425
- return e2 >= 97 && e2 <= 122 || e2 >= 65 && e2 <= 90;
426
- }
427
- function pe(e2) {
428
- return ze(e2) || e2 === 95;
429
- }
430
- function Ke(e2) {
431
- return ze(e2) || b(e2) || e2 === 95;
432
- }
433
- function Ze(e2) {
434
- var t;
435
- let n = Number.MAX_SAFE_INTEGER, i = null, r = -1;
436
- for (let a = 0; a < e2.length; ++a) {
437
- var s;
438
- let u = e2[a], p = Pt(u);
439
- p !== u.length && (i = (s = i) !== null && s !== void 0 ? s : a, r = a, a !== 0 && p < n && (n = p));
440
- }
441
- return e2.map((a, u) => u === 0 ? a : a.slice(n)).slice((t = i) !== null && t !== void 0 ? t : 0, r + 1);
442
- }
443
- function Pt(e2) {
444
- let t = 0;
445
- for (; t < e2.length && We(e2.charCodeAt(t)); ) ++t;
446
- return t;
447
- }
448
- var o;
449
- (function(e2) {
450
- e2.SOF = "<SOF>", e2.EOF = "<EOF>", e2.BANG = "!", e2.DOLLAR = "$", e2.AMP = "&", e2.PAREN_L = "(", e2.PAREN_R = ")", e2.DOT = ".", e2.SPREAD = "...", e2.COLON = ":", e2.EQUALS = "=", e2.AT = "@", e2.BRACKET_L = "[", e2.BRACKET_R = "]", e2.BRACE_L = "{", e2.PIPE = "|", e2.BRACE_R = "}", e2.NAME = "Name", e2.INT = "Int", e2.FLOAT = "Float", e2.STRING = "String", e2.BLOCK_STRING = "BlockString", e2.COMMENT = "Comment";
451
- })(o || (o = {}));
452
- var z = class {
453
- constructor(t) {
454
- let n = new F(o.SOF, 0, 0, 0, 0);
455
- this.source = t, this.lastToken = n, this.token = n, this.line = 1, this.lineStart = 0;
456
- }
457
- get [Symbol.toStringTag]() {
458
- return "Lexer";
459
- }
460
- advance() {
461
- return this.lastToken = this.token, this.token = this.lookahead();
462
- }
463
- lookahead() {
464
- let t = this.token;
465
- if (t.kind !== o.EOF) do
466
- if (t.next) t = t.next;
467
- else {
468
- let n = wt(this, t.end);
469
- t.next = n, n.prev = t, t = n;
470
- }
471
- while (t.kind === o.COMMENT);
472
- return t;
473
- }
474
- };
475
- function tt(e2) {
476
- return e2 === o.BANG || e2 === o.DOLLAR || e2 === o.AMP || e2 === o.PAREN_L || e2 === o.PAREN_R || e2 === o.DOT || e2 === o.SPREAD || e2 === o.COLON || e2 === o.EQUALS || e2 === o.AT || e2 === o.BRACKET_L || e2 === o.BRACKET_R || e2 === o.BRACE_L || e2 === o.PIPE || e2 === o.BRACE_R;
477
- }
478
- function L(e2) {
479
- return e2 >= 0 && e2 <= 55295 || e2 >= 57344 && e2 <= 1114111;
480
- }
481
- function K(e2, t) {
482
- return nt(e2.charCodeAt(t)) && rt(e2.charCodeAt(t + 1));
483
- }
484
- function nt(e2) {
485
- return e2 >= 55296 && e2 <= 56319;
486
- }
487
- function rt(e2) {
488
- return e2 >= 56320 && e2 <= 57343;
489
- }
490
- function R(e2, t) {
491
- let n = e2.source.body.codePointAt(t);
492
- if (n === void 0) return o.EOF;
493
- if (n >= 32 && n <= 126) {
494
- let i = String.fromCodePoint(n);
495
- return i === '"' ? `'"'` : `"${i}"`;
496
- }
497
- return "U+" + n.toString(16).toUpperCase().padStart(4, "0");
498
- }
499
- function m(e2, t, n, i, r) {
500
- let s = e2.line, a = 1 + n - e2.lineStart;
501
- return new F(t, n, i, s, a, r);
502
- }
503
- function wt(e2, t) {
504
- let n = e2.source.body, i = n.length, r = t;
505
- for (; r < i; ) {
506
- let s = n.charCodeAt(r);
507
- switch (s) {
508
- case 65279:
509
- case 9:
510
- case 32:
511
- case 44:
512
- ++r;
513
- continue;
514
- case 10:
515
- ++r, ++e2.line, e2.lineStart = r;
516
- continue;
517
- case 13:
518
- n.charCodeAt(r + 1) === 10 ? r += 2 : ++r, ++e2.line, e2.lineStart = r;
519
- continue;
520
- case 35:
521
- return Ft(e2, r);
522
- case 33:
523
- return m(e2, o.BANG, r, r + 1);
524
- case 36:
525
- return m(e2, o.DOLLAR, r, r + 1);
526
- case 38:
527
- return m(e2, o.AMP, r, r + 1);
528
- case 40:
529
- return m(e2, o.PAREN_L, r, r + 1);
530
- case 41:
531
- return m(e2, o.PAREN_R, r, r + 1);
532
- case 46:
533
- if (n.charCodeAt(r + 1) === 46 && n.charCodeAt(r + 2) === 46) return m(e2, o.SPREAD, r, r + 3);
534
- break;
535
- case 58:
536
- return m(e2, o.COLON, r, r + 1);
537
- case 61:
538
- return m(e2, o.EQUALS, r, r + 1);
539
- case 64:
540
- return m(e2, o.AT, r, r + 1);
541
- case 91:
542
- return m(e2, o.BRACKET_L, r, r + 1);
543
- case 93:
544
- return m(e2, o.BRACKET_R, r, r + 1);
545
- case 123:
546
- return m(e2, o.BRACE_L, r, r + 1);
547
- case 124:
548
- return m(e2, o.PIPE, r, r + 1);
549
- case 125:
550
- return m(e2, o.BRACE_R, r, r + 1);
551
- case 34:
552
- return n.charCodeAt(r + 1) === 34 && n.charCodeAt(r + 2) === 34 ? Yt(e2, r) : Vt(e2, r);
553
- }
554
- if (b(s) || s === 45) return Mt(e2, r, s);
555
- if (pe(s)) return jt(e2, r);
556
- throw h(e2.source, r, s === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : L(s) || K(n, r) ? `Unexpected character: ${R(e2, r)}.` : `Invalid character: ${R(e2, r)}.`);
557
- }
558
- return m(e2, o.EOF, i, i);
559
- }
560
- function Ft(e2, t) {
561
- let n = e2.source.body, i = n.length, r = t + 1;
562
- for (; r < i; ) {
563
- let s = n.charCodeAt(r);
564
- if (s === 10 || s === 13) break;
565
- if (L(s)) ++r;
566
- else if (K(n, r)) r += 2;
567
- else break;
568
- }
569
- return m(e2, o.COMMENT, t, r, n.slice(t + 1, r));
570
- }
571
- function Mt(e2, t, n) {
572
- let i = e2.source.body, r = t, s = n, a = false;
573
- if (s === 45 && (s = i.charCodeAt(++r)), s === 48) {
574
- if (s = i.charCodeAt(++r), b(s)) throw h(e2.source, r, `Invalid number, unexpected digit after 0: ${R(e2, r)}.`);
575
- } else r = le(e2, r, s), s = i.charCodeAt(r);
576
- if (s === 46 && (a = true, s = i.charCodeAt(++r), r = le(e2, r, s), s = i.charCodeAt(r)), (s === 69 || s === 101) && (a = true, s = i.charCodeAt(++r), (s === 43 || s === 45) && (s = i.charCodeAt(++r)), r = le(e2, r, s), s = i.charCodeAt(r)), s === 46 || pe(s)) throw h(e2.source, r, `Invalid number, expected digit but got: ${R(e2, r)}.`);
577
- return m(e2, a ? o.FLOAT : o.INT, t, r, i.slice(t, r));
578
- }
579
- function le(e2, t, n) {
580
- if (!b(n)) throw h(e2.source, t, `Invalid number, expected digit but got: ${R(e2, t)}.`);
581
- let i = e2.source.body, r = t + 1;
582
- for (; b(i.charCodeAt(r)); ) ++r;
583
- return r;
584
- }
585
- function Vt(e2, t) {
586
- let n = e2.source.body, i = n.length, r = t + 1, s = r, a = "";
587
- for (; r < i; ) {
588
- let u = n.charCodeAt(r);
589
- if (u === 34) return a += n.slice(s, r), m(e2, o.STRING, t, r + 1, a);
590
- if (u === 92) {
591
- a += n.slice(s, r);
592
- let p = n.charCodeAt(r + 1) === 117 ? n.charCodeAt(r + 2) === 123 ? Bt(e2, r) : Ut(e2, r) : Gt(e2, r);
593
- a += p.value, r += p.size, s = r;
594
- continue;
595
- }
596
- if (u === 10 || u === 13) break;
597
- if (L(u)) ++r;
598
- else if (K(n, r)) r += 2;
599
- else throw h(e2.source, r, `Invalid character within String: ${R(e2, r)}.`);
600
- }
601
- throw h(e2.source, r, "Unterminated string.");
602
- }
603
- function Bt(e2, t) {
604
- let n = e2.source.body, i = 0, r = 3;
605
- for (; r < 12; ) {
606
- let s = n.charCodeAt(t + r++);
607
- if (s === 125) {
608
- if (r < 5 || !L(i)) break;
609
- return { value: String.fromCodePoint(i), size: r };
610
- }
611
- if (i = i << 4 | V(s), i < 0) break;
612
- }
613
- throw h(e2.source, t, `Invalid Unicode escape sequence: "${n.slice(t, t + r)}".`);
614
- }
615
- function Ut(e2, t) {
616
- let n = e2.source.body, i = et(n, t + 2);
617
- if (L(i)) return { value: String.fromCodePoint(i), size: 6 };
618
- if (nt(i) && n.charCodeAt(t + 6) === 92 && n.charCodeAt(t + 7) === 117) {
619
- let r = et(n, t + 8);
620
- if (rt(r)) return { value: String.fromCodePoint(i, r), size: 12 };
621
- }
622
- throw h(e2.source, t, `Invalid Unicode escape sequence: "${n.slice(t, t + 6)}".`);
623
- }
624
- function et(e2, t) {
625
- return V(e2.charCodeAt(t)) << 12 | V(e2.charCodeAt(t + 1)) << 8 | V(e2.charCodeAt(t + 2)) << 4 | V(e2.charCodeAt(t + 3));
626
- }
627
- function V(e2) {
628
- return e2 >= 48 && e2 <= 57 ? e2 - 48 : e2 >= 65 && e2 <= 70 ? e2 - 55 : e2 >= 97 && e2 <= 102 ? e2 - 87 : -1;
629
- }
630
- function Gt(e2, t) {
631
- let n = e2.source.body;
632
- switch (n.charCodeAt(t + 1)) {
633
- case 34:
634
- return { value: '"', size: 2 };
635
- case 92:
636
- return { value: "\\", size: 2 };
637
- case 47:
638
- return { value: "/", size: 2 };
639
- case 98:
640
- return { value: "\b", size: 2 };
641
- case 102:
642
- return { value: "\f", size: 2 };
643
- case 110:
644
- return { value: `
645
- `, size: 2 };
646
- case 114:
647
- return { value: "\r", size: 2 };
648
- case 116:
649
- return { value: " ", size: 2 };
650
- }
651
- throw h(e2.source, t, `Invalid character escape sequence: "${n.slice(t, t + 2)}".`);
652
- }
653
- function Yt(e2, t) {
654
- let n = e2.source.body, i = n.length, r = e2.lineStart, s = t + 3, a = s, u = "", p = [];
655
- for (; s < i; ) {
656
- let T = n.charCodeAt(s);
657
- if (T === 34 && n.charCodeAt(s + 1) === 34 && n.charCodeAt(s + 2) === 34) {
658
- u += n.slice(a, s), p.push(u);
659
- let d = m(e2, o.BLOCK_STRING, t, s + 3, Ze(p).join(`
660
- `));
661
- return e2.line += p.length - 1, e2.lineStart = r, d;
662
- }
663
- if (T === 92 && n.charCodeAt(s + 1) === 34 && n.charCodeAt(s + 2) === 34 && n.charCodeAt(s + 3) === 34) {
664
- u += n.slice(a, s), a = s + 1, s += 4;
665
- continue;
666
- }
667
- if (T === 10 || T === 13) {
668
- u += n.slice(a, s), p.push(u), T === 13 && n.charCodeAt(s + 1) === 10 ? s += 2 : ++s, u = "", a = s, r = s;
669
- continue;
670
- }
671
- if (L(T)) ++s;
672
- else if (K(n, s)) s += 2;
673
- else throw h(e2.source, s, `Invalid character within String: ${R(e2, s)}.`);
674
- }
675
- throw h(e2.source, s, "Unterminated string.");
676
- }
677
- function jt(e2, t) {
678
- let n = e2.source.body, i = n.length, r = t + 1;
679
- for (; r < i; ) {
680
- let s = n.charCodeAt(r);
681
- if (Ke(s)) ++r;
682
- else break;
683
- }
684
- return m(e2, o.NAME, t, r, n.slice(t, r));
685
- }
686
- function Z(e2, t) {
687
- if (!!!e2) throw new Error(t);
688
- }
689
- function ee(e2) {
690
- return te(e2, []);
691
- }
692
- function te(e2, t) {
693
- switch (typeof e2) {
694
- case "string":
695
- return JSON.stringify(e2);
696
- case "function":
697
- return e2.name ? `[function ${e2.name}]` : "[function]";
698
- case "object":
699
- return $t(e2, t);
700
- default:
701
- return String(e2);
702
- }
703
- }
704
- function $t(e2, t) {
705
- if (e2 === null) return "null";
706
- if (t.includes(e2)) return "[Circular]";
707
- let n = [...t, e2];
708
- if (Xt(e2)) {
709
- let i = e2.toJSON();
710
- if (i !== e2) return typeof i == "string" ? i : te(i, n);
711
- } else if (Array.isArray(e2)) return Jt(e2, n);
712
- return Ht(e2, n);
713
- }
714
- function Xt(e2) {
715
- return typeof e2.toJSON == "function";
716
- }
717
- function Ht(e2, t) {
718
- let n = Object.entries(e2);
719
- return n.length === 0 ? "{}" : t.length > 2 ? "[" + qt(e2) + "]" : "{ " + n.map(([r, s]) => r + ": " + te(s, t)).join(", ") + " }";
720
- }
721
- function Jt(e2, t) {
722
- if (e2.length === 0) return "[]";
723
- if (t.length > 2) return "[Array]";
724
- let n = Math.min(10, e2.length), i = e2.length - n, r = [];
725
- for (let s = 0; s < n; ++s) r.push(te(e2[s], t));
726
- return i === 1 ? r.push("... 1 more item") : i > 1 && r.push(`... ${i} more items`), "[" + r.join(", ") + "]";
727
- }
728
- function qt(e2) {
729
- let t = Object.prototype.toString.call(e2).replace(/^\[object /, "").replace(/]$/, "");
730
- if (t === "Object" && typeof e2.constructor == "function") {
731
- let n = e2.constructor.name;
732
- if (typeof n == "string" && n !== "") return n;
733
- }
734
- return t;
735
- }
736
- var Qt = globalThis.process && true;
737
- var it = Qt ? function(t, n) {
738
- return t instanceof n;
739
- } : function(t, n) {
740
- if (t instanceof n) return true;
741
- if (typeof t == "object" && t !== null) {
742
- var i;
743
- let r = n.prototype[Symbol.toStringTag], s = Symbol.toStringTag in t ? t[Symbol.toStringTag] : (i = t.constructor) === null || i === void 0 ? void 0 : i.name;
744
- if (r === s) {
745
- let a = ee(t);
746
- throw new Error(`Cannot use ${r} "${a}" from another module or realm.
747
-
748
- Ensure that there is only one instance of "graphql" in the node_modules
749
- directory. If different versions of "graphql" are the dependencies of other
750
- relied on modules, use "resolutions" to ensure only one version is installed.
751
-
752
- https://yarnpkg.com/en/docs/selective-version-resolutions
753
-
754
- Duplicate "graphql" modules cannot be used at the same time since different
755
- versions may have different capabilities and behavior. The data from one
756
- version used in the function from another could produce confusing and
757
- spurious results.`);
758
- }
759
- }
760
- return false;
761
- };
762
- var B = class {
763
- constructor(t, n = "GraphQL request", i = { line: 1, column: 1 }) {
764
- typeof t == "string" || Z(false, `Body must be a string. Received: ${ee(t)}.`), this.body = t, this.name = n, this.locationOffset = i, this.locationOffset.line > 0 || Z(false, "line in locationOffset is 1-indexed and must be positive."), this.locationOffset.column > 0 || Z(false, "column in locationOffset is 1-indexed and must be positive.");
765
- }
766
- get [Symbol.toStringTag]() {
767
- return "Source";
768
- }
769
- };
770
- function st(e2) {
771
- return it(e2, B);
772
- }
773
- function ot(e2, t) {
774
- let n = new fe(e2, t), i = n.parseDocument();
775
- return Object.defineProperty(i, "tokenCount", { enumerable: false, value: n.tokenCount }), i;
776
- }
777
- var fe = class {
778
- constructor(t, n = {}) {
779
- let { lexer: i, ...r } = n;
780
- if (i) this._lexer = i;
781
- else {
782
- let s = st(t) ? t : new B(t);
783
- this._lexer = new z(s);
784
- }
785
- this._options = r, this._tokenCounter = 0;
786
- }
787
- get tokenCount() {
788
- return this._tokenCounter;
789
- }
790
- parseName() {
791
- let t = this.expectToken(o.NAME);
792
- return this.node(t, { kind: c.NAME, value: t.value });
793
- }
794
- parseDocument() {
795
- return this.node(this._lexer.token, { kind: c.DOCUMENT, definitions: this.many(o.SOF, this.parseDefinition, o.EOF) });
796
- }
797
- parseDefinition() {
798
- if (this.peek(o.BRACE_L)) return this.parseOperationDefinition();
799
- let t = this.peekDescription(), n = t ? this._lexer.lookahead() : this._lexer.token;
800
- if (t && n.kind === o.BRACE_L) throw h(this._lexer.source, this._lexer.token.start, "Unexpected description, descriptions are not supported on shorthand queries.");
801
- if (n.kind === o.NAME) {
802
- switch (n.value) {
803
- case "schema":
804
- return this.parseSchemaDefinition();
805
- case "scalar":
806
- return this.parseScalarTypeDefinition();
807
- case "type":
808
- return this.parseObjectTypeDefinition();
809
- case "interface":
810
- return this.parseInterfaceTypeDefinition();
811
- case "union":
812
- return this.parseUnionTypeDefinition();
813
- case "enum":
814
- return this.parseEnumTypeDefinition();
815
- case "input":
816
- return this.parseInputObjectTypeDefinition();
817
- case "directive":
818
- return this.parseDirectiveDefinition();
819
- }
820
- switch (n.value) {
821
- case "query":
822
- case "mutation":
823
- case "subscription":
824
- return this.parseOperationDefinition();
825
- case "fragment":
826
- return this.parseFragmentDefinition();
827
- }
828
- if (t) throw h(this._lexer.source, this._lexer.token.start, "Unexpected description, only GraphQL definitions support descriptions.");
829
- switch (n.value) {
830
- case "extend":
831
- return this.parseTypeSystemExtension();
832
- }
833
- }
834
- throw this.unexpected(n);
835
- }
836
- parseOperationDefinition() {
837
- let t = this._lexer.token;
838
- if (this.peek(o.BRACE_L)) return this.node(t, { kind: c.OPERATION_DEFINITION, operation: C.QUERY, description: void 0, name: void 0, variableDefinitions: [], directives: [], selectionSet: this.parseSelectionSet() });
839
- let n = this.parseDescription(), i = this.parseOperationType(), r;
840
- return this.peek(o.NAME) && (r = this.parseName()), this.node(t, { kind: c.OPERATION_DEFINITION, operation: i, description: n, name: r, variableDefinitions: this.parseVariableDefinitions(), directives: this.parseDirectives(false), selectionSet: this.parseSelectionSet() });
841
- }
842
- parseOperationType() {
843
- let t = this.expectToken(o.NAME);
844
- switch (t.value) {
845
- case "query":
846
- return C.QUERY;
847
- case "mutation":
848
- return C.MUTATION;
849
- case "subscription":
850
- return C.SUBSCRIPTION;
851
- }
852
- throw this.unexpected(t);
853
- }
854
- parseVariableDefinitions() {
855
- return this.optionalMany(o.PAREN_L, this.parseVariableDefinition, o.PAREN_R);
856
- }
857
- parseVariableDefinition() {
858
- return this.node(this._lexer.token, { kind: c.VARIABLE_DEFINITION, description: this.parseDescription(), variable: this.parseVariable(), type: (this.expectToken(o.COLON), this.parseTypeReference()), defaultValue: this.expectOptionalToken(o.EQUALS) ? this.parseConstValueLiteral() : void 0, directives: this.parseConstDirectives() });
859
- }
860
- parseVariable() {
861
- let t = this._lexer.token;
862
- return this.expectToken(o.DOLLAR), this.node(t, { kind: c.VARIABLE, name: this.parseName() });
863
- }
864
- parseSelectionSet() {
865
- return this.node(this._lexer.token, { kind: c.SELECTION_SET, selections: this.many(o.BRACE_L, this.parseSelection, o.BRACE_R) });
866
- }
867
- parseSelection() {
868
- return this.peek(o.SPREAD) ? this.parseFragment() : this.parseField();
869
- }
870
- parseField() {
871
- let t = this._lexer.token, n = this.parseName(), i, r;
872
- return this.expectOptionalToken(o.COLON) ? (i = n, r = this.parseName()) : r = n, this.node(t, { kind: c.FIELD, alias: i, name: r, arguments: this.parseArguments(false), directives: this.parseDirectives(false), selectionSet: this.peek(o.BRACE_L) ? this.parseSelectionSet() : void 0 });
873
- }
874
- parseArguments(t) {
875
- let n = t ? this.parseConstArgument : this.parseArgument;
876
- return this.optionalMany(o.PAREN_L, n, o.PAREN_R);
877
- }
878
- parseArgument(t = false) {
879
- let n = this._lexer.token, i = this.parseName();
880
- return this.expectToken(o.COLON), this.node(n, { kind: c.ARGUMENT, name: i, value: this.parseValueLiteral(t) });
881
- }
882
- parseConstArgument() {
883
- return this.parseArgument(true);
884
- }
885
- parseFragment() {
886
- let t = this._lexer.token;
887
- this.expectToken(o.SPREAD);
888
- let n = this.expectOptionalKeyword("on");
889
- return !n && this.peek(o.NAME) ? this.node(t, { kind: c.FRAGMENT_SPREAD, name: this.parseFragmentName(), directives: this.parseDirectives(false) }) : this.node(t, { kind: c.INLINE_FRAGMENT, typeCondition: n ? this.parseNamedType() : void 0, directives: this.parseDirectives(false), selectionSet: this.parseSelectionSet() });
890
- }
891
- parseFragmentDefinition() {
892
- let t = this._lexer.token, n = this.parseDescription();
893
- return this.expectKeyword("fragment"), this._options.allowLegacyFragmentVariables === true ? this.node(t, { kind: c.FRAGMENT_DEFINITION, description: n, name: this.parseFragmentName(), variableDefinitions: this.parseVariableDefinitions(), typeCondition: (this.expectKeyword("on"), this.parseNamedType()), directives: this.parseDirectives(false), selectionSet: this.parseSelectionSet() }) : this.node(t, { kind: c.FRAGMENT_DEFINITION, description: n, name: this.parseFragmentName(), typeCondition: (this.expectKeyword("on"), this.parseNamedType()), directives: this.parseDirectives(false), selectionSet: this.parseSelectionSet() });
894
- }
895
- parseFragmentName() {
896
- if (this._lexer.token.value === "on") throw this.unexpected();
897
- return this.parseName();
898
- }
899
- parseValueLiteral(t) {
900
- let n = this._lexer.token;
901
- switch (n.kind) {
902
- case o.BRACKET_L:
903
- return this.parseList(t);
904
- case o.BRACE_L:
905
- return this.parseObject(t);
906
- case o.INT:
907
- return this.advanceLexer(), this.node(n, { kind: c.INT, value: n.value });
908
- case o.FLOAT:
909
- return this.advanceLexer(), this.node(n, { kind: c.FLOAT, value: n.value });
910
- case o.STRING:
911
- case o.BLOCK_STRING:
912
- return this.parseStringLiteral();
913
- case o.NAME:
914
- switch (this.advanceLexer(), n.value) {
915
- case "true":
916
- return this.node(n, { kind: c.BOOLEAN, value: true });
917
- case "false":
918
- return this.node(n, { kind: c.BOOLEAN, value: false });
919
- case "null":
920
- return this.node(n, { kind: c.NULL });
921
- default:
922
- return this.node(n, { kind: c.ENUM, value: n.value });
923
- }
924
- case o.DOLLAR:
925
- if (t) if (this.expectToken(o.DOLLAR), this._lexer.token.kind === o.NAME) {
926
- let i = this._lexer.token.value;
927
- throw h(this._lexer.source, n.start, `Unexpected variable "$${i}" in constant value.`);
928
- } else throw this.unexpected(n);
929
- return this.parseVariable();
930
- default:
931
- throw this.unexpected();
932
- }
933
- }
934
- parseConstValueLiteral() {
935
- return this.parseValueLiteral(true);
936
- }
937
- parseStringLiteral() {
938
- let t = this._lexer.token;
939
- return this.advanceLexer(), this.node(t, { kind: c.STRING, value: t.value, block: t.kind === o.BLOCK_STRING });
940
- }
941
- parseList(t) {
942
- let n = () => this.parseValueLiteral(t);
943
- return this.node(this._lexer.token, { kind: c.LIST, values: this.any(o.BRACKET_L, n, o.BRACKET_R) });
944
- }
945
- parseObject(t) {
946
- let n = () => this.parseObjectField(t);
947
- return this.node(this._lexer.token, { kind: c.OBJECT, fields: this.any(o.BRACE_L, n, o.BRACE_R) });
948
- }
949
- parseObjectField(t) {
950
- let n = this._lexer.token, i = this.parseName();
951
- return this.expectToken(o.COLON), this.node(n, { kind: c.OBJECT_FIELD, name: i, value: this.parseValueLiteral(t) });
952
- }
953
- parseDirectives(t) {
954
- let n = [];
955
- for (; this.peek(o.AT); ) n.push(this.parseDirective(t));
956
- return n;
957
- }
958
- parseConstDirectives() {
959
- return this.parseDirectives(true);
960
- }
961
- parseDirective(t) {
962
- let n = this._lexer.token;
963
- return this.expectToken(o.AT), this.node(n, { kind: c.DIRECTIVE, name: this.parseName(), arguments: this.parseArguments(t) });
964
- }
965
- parseTypeReference() {
966
- let t = this._lexer.token, n;
967
- if (this.expectOptionalToken(o.BRACKET_L)) {
968
- let i = this.parseTypeReference();
969
- this.expectToken(o.BRACKET_R), n = this.node(t, { kind: c.LIST_TYPE, type: i });
970
- } else n = this.parseNamedType();
971
- return this.expectOptionalToken(o.BANG) ? this.node(t, { kind: c.NON_NULL_TYPE, type: n }) : n;
972
- }
973
- parseNamedType() {
974
- return this.node(this._lexer.token, { kind: c.NAMED_TYPE, name: this.parseName() });
975
- }
976
- peekDescription() {
977
- return this.peek(o.STRING) || this.peek(o.BLOCK_STRING);
978
- }
979
- parseDescription() {
980
- if (this.peekDescription()) return this.parseStringLiteral();
981
- }
982
- parseSchemaDefinition() {
983
- let t = this._lexer.token, n = this.parseDescription();
984
- this.expectKeyword("schema");
985
- let i = this.parseConstDirectives(), r = this.many(o.BRACE_L, this.parseOperationTypeDefinition, o.BRACE_R);
986
- return this.node(t, { kind: c.SCHEMA_DEFINITION, description: n, directives: i, operationTypes: r });
987
- }
988
- parseOperationTypeDefinition() {
989
- let t = this._lexer.token, n = this.parseOperationType();
990
- this.expectToken(o.COLON);
991
- let i = this.parseNamedType();
992
- return this.node(t, { kind: c.OPERATION_TYPE_DEFINITION, operation: n, type: i });
993
- }
994
- parseScalarTypeDefinition() {
995
- let t = this._lexer.token, n = this.parseDescription();
996
- this.expectKeyword("scalar");
997
- let i = this.parseName(), r = this.parseConstDirectives();
998
- return this.node(t, { kind: c.SCALAR_TYPE_DEFINITION, description: n, name: i, directives: r });
999
- }
1000
- parseObjectTypeDefinition() {
1001
- let t = this._lexer.token, n = this.parseDescription();
1002
- this.expectKeyword("type");
1003
- let i = this.parseName(), r = this.parseImplementsInterfaces(), s = this.parseConstDirectives(), a = this.parseFieldsDefinition();
1004
- return this.node(t, { kind: c.OBJECT_TYPE_DEFINITION, description: n, name: i, interfaces: r, directives: s, fields: a });
1005
- }
1006
- parseImplementsInterfaces() {
1007
- return this.expectOptionalKeyword("implements") ? this.delimitedMany(o.AMP, this.parseNamedType) : [];
1008
- }
1009
- parseFieldsDefinition() {
1010
- return this.optionalMany(o.BRACE_L, this.parseFieldDefinition, o.BRACE_R);
1011
- }
1012
- parseFieldDefinition() {
1013
- let t = this._lexer.token, n = this.parseDescription(), i = this.parseName(), r = this.parseArgumentDefs();
1014
- this.expectToken(o.COLON);
1015
- let s = this.parseTypeReference(), a = this.parseConstDirectives();
1016
- return this.node(t, { kind: c.FIELD_DEFINITION, description: n, name: i, arguments: r, type: s, directives: a });
1017
- }
1018
- parseArgumentDefs() {
1019
- return this.optionalMany(o.PAREN_L, this.parseInputValueDef, o.PAREN_R);
1020
- }
1021
- parseInputValueDef() {
1022
- let t = this._lexer.token, n = this.parseDescription(), i = this.parseName();
1023
- this.expectToken(o.COLON);
1024
- let r = this.parseTypeReference(), s;
1025
- this.expectOptionalToken(o.EQUALS) && (s = this.parseConstValueLiteral());
1026
- let a = this.parseConstDirectives();
1027
- return this.node(t, { kind: c.INPUT_VALUE_DEFINITION, description: n, name: i, type: r, defaultValue: s, directives: a });
1028
- }
1029
- parseInterfaceTypeDefinition() {
1030
- let t = this._lexer.token, n = this.parseDescription();
1031
- this.expectKeyword("interface");
1032
- let i = this.parseName(), r = this.parseImplementsInterfaces(), s = this.parseConstDirectives(), a = this.parseFieldsDefinition();
1033
- return this.node(t, { kind: c.INTERFACE_TYPE_DEFINITION, description: n, name: i, interfaces: r, directives: s, fields: a });
1034
- }
1035
- parseUnionTypeDefinition() {
1036
- let t = this._lexer.token, n = this.parseDescription();
1037
- this.expectKeyword("union");
1038
- let i = this.parseName(), r = this.parseConstDirectives(), s = this.parseUnionMemberTypes();
1039
- return this.node(t, { kind: c.UNION_TYPE_DEFINITION, description: n, name: i, directives: r, types: s });
1040
- }
1041
- parseUnionMemberTypes() {
1042
- return this.expectOptionalToken(o.EQUALS) ? this.delimitedMany(o.PIPE, this.parseNamedType) : [];
1043
- }
1044
- parseEnumTypeDefinition() {
1045
- let t = this._lexer.token, n = this.parseDescription();
1046
- this.expectKeyword("enum");
1047
- let i = this.parseName(), r = this.parseConstDirectives(), s = this.parseEnumValuesDefinition();
1048
- return this.node(t, { kind: c.ENUM_TYPE_DEFINITION, description: n, name: i, directives: r, values: s });
1049
- }
1050
- parseEnumValuesDefinition() {
1051
- return this.optionalMany(o.BRACE_L, this.parseEnumValueDefinition, o.BRACE_R);
1052
- }
1053
- parseEnumValueDefinition() {
1054
- let t = this._lexer.token, n = this.parseDescription(), i = this.parseEnumValueName(), r = this.parseConstDirectives();
1055
- return this.node(t, { kind: c.ENUM_VALUE_DEFINITION, description: n, name: i, directives: r });
1056
- }
1057
- parseEnumValueName() {
1058
- if (this._lexer.token.value === "true" || this._lexer.token.value === "false" || this._lexer.token.value === "null") throw h(this._lexer.source, this._lexer.token.start, `${ne(this._lexer.token)} is reserved and cannot be used for an enum value.`);
1059
- return this.parseName();
1060
- }
1061
- parseInputObjectTypeDefinition() {
1062
- let t = this._lexer.token, n = this.parseDescription();
1063
- this.expectKeyword("input");
1064
- let i = this.parseName(), r = this.parseConstDirectives(), s = this.parseInputFieldsDefinition();
1065
- return this.node(t, { kind: c.INPUT_OBJECT_TYPE_DEFINITION, description: n, name: i, directives: r, fields: s });
1066
- }
1067
- parseInputFieldsDefinition() {
1068
- return this.optionalMany(o.BRACE_L, this.parseInputValueDef, o.BRACE_R);
1069
- }
1070
- parseTypeSystemExtension() {
1071
- let t = this._lexer.lookahead();
1072
- if (t.kind === o.NAME) switch (t.value) {
1073
- case "schema":
1074
- return this.parseSchemaExtension();
1075
- case "scalar":
1076
- return this.parseScalarTypeExtension();
1077
- case "type":
1078
- return this.parseObjectTypeExtension();
1079
- case "interface":
1080
- return this.parseInterfaceTypeExtension();
1081
- case "union":
1082
- return this.parseUnionTypeExtension();
1083
- case "enum":
1084
- return this.parseEnumTypeExtension();
1085
- case "input":
1086
- return this.parseInputObjectTypeExtension();
1087
- }
1088
- throw this.unexpected(t);
1089
- }
1090
- parseSchemaExtension() {
1091
- let t = this._lexer.token;
1092
- this.expectKeyword("extend"), this.expectKeyword("schema");
1093
- let n = this.parseConstDirectives(), i = this.optionalMany(o.BRACE_L, this.parseOperationTypeDefinition, o.BRACE_R);
1094
- if (n.length === 0 && i.length === 0) throw this.unexpected();
1095
- return this.node(t, { kind: c.SCHEMA_EXTENSION, directives: n, operationTypes: i });
1096
- }
1097
- parseScalarTypeExtension() {
1098
- let t = this._lexer.token;
1099
- this.expectKeyword("extend"), this.expectKeyword("scalar");
1100
- let n = this.parseName(), i = this.parseConstDirectives();
1101
- if (i.length === 0) throw this.unexpected();
1102
- return this.node(t, { kind: c.SCALAR_TYPE_EXTENSION, name: n, directives: i });
1103
- }
1104
- parseObjectTypeExtension() {
1105
- let t = this._lexer.token;
1106
- this.expectKeyword("extend"), this.expectKeyword("type");
1107
- let n = this.parseName(), i = this.parseImplementsInterfaces(), r = this.parseConstDirectives(), s = this.parseFieldsDefinition();
1108
- if (i.length === 0 && r.length === 0 && s.length === 0) throw this.unexpected();
1109
- return this.node(t, { kind: c.OBJECT_TYPE_EXTENSION, name: n, interfaces: i, directives: r, fields: s });
1110
- }
1111
- parseInterfaceTypeExtension() {
1112
- let t = this._lexer.token;
1113
- this.expectKeyword("extend"), this.expectKeyword("interface");
1114
- let n = this.parseName(), i = this.parseImplementsInterfaces(), r = this.parseConstDirectives(), s = this.parseFieldsDefinition();
1115
- if (i.length === 0 && r.length === 0 && s.length === 0) throw this.unexpected();
1116
- return this.node(t, { kind: c.INTERFACE_TYPE_EXTENSION, name: n, interfaces: i, directives: r, fields: s });
1117
- }
1118
- parseUnionTypeExtension() {
1119
- let t = this._lexer.token;
1120
- this.expectKeyword("extend"), this.expectKeyword("union");
1121
- let n = this.parseName(), i = this.parseConstDirectives(), r = this.parseUnionMemberTypes();
1122
- if (i.length === 0 && r.length === 0) throw this.unexpected();
1123
- return this.node(t, { kind: c.UNION_TYPE_EXTENSION, name: n, directives: i, types: r });
1124
- }
1125
- parseEnumTypeExtension() {
1126
- let t = this._lexer.token;
1127
- this.expectKeyword("extend"), this.expectKeyword("enum");
1128
- let n = this.parseName(), i = this.parseConstDirectives(), r = this.parseEnumValuesDefinition();
1129
- if (i.length === 0 && r.length === 0) throw this.unexpected();
1130
- return this.node(t, { kind: c.ENUM_TYPE_EXTENSION, name: n, directives: i, values: r });
1131
- }
1132
- parseInputObjectTypeExtension() {
1133
- let t = this._lexer.token;
1134
- this.expectKeyword("extend"), this.expectKeyword("input");
1135
- let n = this.parseName(), i = this.parseConstDirectives(), r = this.parseInputFieldsDefinition();
1136
- if (i.length === 0 && r.length === 0) throw this.unexpected();
1137
- return this.node(t, { kind: c.INPUT_OBJECT_TYPE_EXTENSION, name: n, directives: i, fields: r });
1138
- }
1139
- parseDirectiveDefinition() {
1140
- let t = this._lexer.token, n = this.parseDescription();
1141
- this.expectKeyword("directive"), this.expectToken(o.AT);
1142
- let i = this.parseName(), r = this.parseArgumentDefs(), s = this.expectOptionalKeyword("repeatable");
1143
- this.expectKeyword("on");
1144
- let a = this.parseDirectiveLocations();
1145
- return this.node(t, { kind: c.DIRECTIVE_DEFINITION, description: n, name: i, arguments: r, repeatable: s, locations: a });
1146
- }
1147
- parseDirectiveLocations() {
1148
- return this.delimitedMany(o.PIPE, this.parseDirectiveLocation);
1149
- }
1150
- parseDirectiveLocation() {
1151
- let t = this._lexer.token, n = this.parseName();
1152
- if (Object.prototype.hasOwnProperty.call(W, n.value)) return n;
1153
- throw this.unexpected(t);
1154
- }
1155
- parseSchemaCoordinate() {
1156
- let t = this._lexer.token, n = this.expectOptionalToken(o.AT), i = this.parseName(), r;
1157
- !n && this.expectOptionalToken(o.DOT) && (r = this.parseName());
1158
- let s;
1159
- return (n || r) && this.expectOptionalToken(o.PAREN_L) && (s = this.parseName(), this.expectToken(o.COLON), this.expectToken(o.PAREN_R)), n ? s ? this.node(t, { kind: c.DIRECTIVE_ARGUMENT_COORDINATE, name: i, argumentName: s }) : this.node(t, { kind: c.DIRECTIVE_COORDINATE, name: i }) : r ? s ? this.node(t, { kind: c.ARGUMENT_COORDINATE, name: i, fieldName: r, argumentName: s }) : this.node(t, { kind: c.MEMBER_COORDINATE, name: i, memberName: r }) : this.node(t, { kind: c.TYPE_COORDINATE, name: i });
1160
- }
1161
- node(t, n) {
1162
- return this._options.noLocation !== true && (n.loc = new H(t, this._lexer.lastToken, this._lexer.source)), n;
1163
- }
1164
- peek(t) {
1165
- return this._lexer.token.kind === t;
1166
- }
1167
- expectToken(t) {
1168
- let n = this._lexer.token;
1169
- if (n.kind === t) return this.advanceLexer(), n;
1170
- throw h(this._lexer.source, n.start, `Expected ${at(t)}, found ${ne(n)}.`);
1171
- }
1172
- expectOptionalToken(t) {
1173
- return this._lexer.token.kind === t ? (this.advanceLexer(), true) : false;
1174
- }
1175
- expectKeyword(t) {
1176
- let n = this._lexer.token;
1177
- if (n.kind === o.NAME && n.value === t) this.advanceLexer();
1178
- else throw h(this._lexer.source, n.start, `Expected "${t}", found ${ne(n)}.`);
1179
- }
1180
- expectOptionalKeyword(t) {
1181
- let n = this._lexer.token;
1182
- return n.kind === o.NAME && n.value === t ? (this.advanceLexer(), true) : false;
1183
- }
1184
- unexpected(t) {
1185
- let n = t ?? this._lexer.token;
1186
- return h(this._lexer.source, n.start, `Unexpected ${ne(n)}.`);
1187
- }
1188
- any(t, n, i) {
1189
- this.expectToken(t);
1190
- let r = [];
1191
- for (; !this.expectOptionalToken(i); ) r.push(n.call(this));
1192
- return r;
1193
- }
1194
- optionalMany(t, n, i) {
1195
- if (this.expectOptionalToken(t)) {
1196
- let r = [];
1197
- do
1198
- r.push(n.call(this));
1199
- while (!this.expectOptionalToken(i));
1200
- return r;
1201
- }
1202
- return [];
1203
- }
1204
- many(t, n, i) {
1205
- this.expectToken(t);
1206
- let r = [];
1207
- do
1208
- r.push(n.call(this));
1209
- while (!this.expectOptionalToken(i));
1210
- return r;
1211
- }
1212
- delimitedMany(t, n) {
1213
- this.expectOptionalToken(t);
1214
- let i = [];
1215
- do
1216
- i.push(n.call(this));
1217
- while (this.expectOptionalToken(t));
1218
- return i;
1219
- }
1220
- advanceLexer() {
1221
- let { maxTokens: t } = this._options, n = this._lexer.advance();
1222
- if (n.kind !== o.EOF && (++this._tokenCounter, t !== void 0 && this._tokenCounter > t)) throw h(this._lexer.source, n.start, `Document contains more that ${t} tokens. Parsing aborted.`);
1223
- }
1224
- };
1225
- function ne(e2) {
1226
- let t = e2.value;
1227
- return at(e2.kind) + (t != null ? ` "${t}"` : "");
1228
- }
1229
- function at(e2) {
1230
- return tt(e2) ? `"${e2}"` : e2;
1231
- }
1232
- function Wt(e2, t) {
1233
- let n = new SyntaxError(e2 + " (" + t.loc.start.line + ":" + t.loc.start.column + ")");
1234
- return Object.assign(n, t);
1235
- }
1236
- var ct = Wt;
1237
- function zt(e2) {
1238
- let t = [], { startToken: n, endToken: i } = e2.loc;
1239
- for (let r = n; r !== i; r = r.next) r.kind === "Comment" && t.push({ ...r, loc: { start: r.start, end: r.end } });
1240
- return t;
1241
- }
1242
- var Kt = { allowLegacyFragmentVariables: true };
1243
- function Zt(e2) {
1244
- if (e2?.name === "GraphQLError") {
1245
- let { message: t, locations: [n] } = e2;
1246
- return ct(t, { loc: { start: n }, cause: e2 });
1247
- }
1248
- return e2;
1249
- }
1250
- function en(e2) {
1251
- let t;
1252
- try {
1253
- t = ot(e2, Kt);
1254
- } catch (n) {
1255
- throw Zt(n);
1256
- }
1257
- return t.comments = zt(t), t;
1258
- }
1259
- var tn = { parse: en, astFormat: "graphql", hasPragma: Fe, hasIgnorePragma: Me, locStart: J, locEnd: q };
1260
- var nn = { graphql: Ge };
1261
- export {
1262
- ut as default,
1263
- Ye as languages,
1264
- $e as options,
1265
- he as parsers,
1266
- nn as printers
1267
- };