@builder.io/fusion 0.0.1

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.
@@ -0,0 +1,1869 @@
1
+ import { n as e } from "./chunk-hvVJRdgc.js";
2
+ //#region ../../node_modules/prettier/plugins/graphql.mjs
3
+ function t(e) {
4
+ return M(e), {
5
+ type: $e,
6
+ contents: e
7
+ };
8
+ }
9
+ function n(e, t = {}) {
10
+ return M(e), N(t.expandedStates, !0), {
11
+ type: et,
12
+ id: t.id,
13
+ contents: e,
14
+ break: !!t.shouldBreak,
15
+ expandedStates: t.expandedStates
16
+ };
17
+ }
18
+ function r(e, t = "", n = {}) {
19
+ return M(e), t !== "" && M(t), {
20
+ type: tt,
21
+ breakContents: e,
22
+ flatContents: t,
23
+ groupId: n.groupId
24
+ };
25
+ }
26
+ function i(e, t) {
27
+ M(e), N(t);
28
+ let n = [];
29
+ for (let r = 0; r < t.length; r++) r !== 0 && n.push(e), n.push(t[r]);
30
+ return n;
31
+ }
32
+ function a(e) {
33
+ return (t, n, r) => {
34
+ let i = !!r?.backwards;
35
+ if (n === !1) return !1;
36
+ let { length: a } = t, o = n;
37
+ for (; o >= 0 && o < a;) {
38
+ let n = t.charAt(o);
39
+ if (e instanceof RegExp) {
40
+ if (!e.test(n)) return o;
41
+ } else if (!e.includes(n)) return o;
42
+ i ? o-- : o++;
43
+ }
44
+ return o === -1 || o === a ? o : !1;
45
+ };
46
+ }
47
+ function o(e, t, n) {
48
+ let r = !!n?.backwards;
49
+ if (t === !1) return !1;
50
+ let i = e.charAt(t);
51
+ if (r) {
52
+ if (e.charAt(t - 1) === "\r" && i === "\n") return t - 2;
53
+ if (R(i)) return t - 1;
54
+ } else {
55
+ if (i === "\r" && e.charAt(t + 1) === "\n") return t + 2;
56
+ if (R(i)) return t + 1;
57
+ }
58
+ return t;
59
+ }
60
+ function s(e, t, n = {}) {
61
+ let r = L(e, n.backwards ? t - 1 : t, n);
62
+ return r !== z(e, r, n);
63
+ }
64
+ function c(e, t) {
65
+ if (t === !1) return !1;
66
+ if (e.charAt(t) === "/" && e.charAt(t + 1) === "*") {
67
+ for (let n = t + 2; n < e.length; ++n) if (e.charAt(n) === "*" && e.charAt(n + 1) === "/") return n + 2;
68
+ }
69
+ return t;
70
+ }
71
+ function l(e, t) {
72
+ return t === !1 ? !1 : e.charAt(t) === "/" && e.charAt(t + 1) === "/" ? at(e, t) : t;
73
+ }
74
+ function u(e, t) {
75
+ let n = null, r = t;
76
+ for (; r !== n;) n = r, r = it(e, r), r = st(e, r), r = L(e, r);
77
+ return r = ct(e, r), r = z(e, r), r !== !1 && ot(e, r);
78
+ }
79
+ function d(e) {
80
+ return Array.isArray(e) && e.length > 0;
81
+ }
82
+ function f(e) {
83
+ if (V !== null && typeof V.property) {
84
+ let e = V;
85
+ return V = f.prototype = null, e;
86
+ }
87
+ return V = f.prototype = e ?? Object.create(null), new f();
88
+ }
89
+ function ee(e) {
90
+ return f(e);
91
+ }
92
+ function te(e, t = "type") {
93
+ ee(e);
94
+ function n(n) {
95
+ let r = n[t], i = e[r];
96
+ if (!Array.isArray(i)) throw Object.assign(/* @__PURE__ */ Error(`Missing visitor keys for '${r}'.`), { node: n });
97
+ return i;
98
+ }
99
+ return n;
100
+ }
101
+ function ne(e, t, n) {
102
+ let { node: r } = e;
103
+ if (!r.description) return "";
104
+ let i = [n("description")];
105
+ return r.kind === "InputValueDefinition" && !r.description.block ? i.push(P) : i.push(I), i;
106
+ }
107
+ function re(e, a, o) {
108
+ let { node: s } = e;
109
+ switch (s.kind) {
110
+ case "Document": return [...i(I, m(e, a, o, "definitions")), I];
111
+ case "OperationDefinition": {
112
+ let t = a.originalText[K(s)] !== "{", n = !!s.name;
113
+ return [
114
+ q(e, a, o),
115
+ t ? s.operation : "",
116
+ t && n ? [" ", o("name")] : "",
117
+ t && !n && B(s.variableDefinitions) ? " " : "",
118
+ se(e, o),
119
+ p(e, o, s),
120
+ !t && !n ? "" : " ",
121
+ o("selectionSet")
122
+ ];
123
+ }
124
+ case "FragmentDefinition": return [
125
+ q(e, a, o),
126
+ "fragment ",
127
+ o("name"),
128
+ se(e, o),
129
+ " on ",
130
+ o("typeCondition"),
131
+ p(e, o, s),
132
+ " ",
133
+ o("selectionSet")
134
+ ];
135
+ case "SelectionSet": return [
136
+ "{",
137
+ t([I, i(I, m(e, a, o, "selections"))]),
138
+ I,
139
+ "}"
140
+ ];
141
+ case "Field": return n([
142
+ s.alias ? [o("alias"), ": "] : "",
143
+ o("name"),
144
+ s.arguments.length > 0 ? n([
145
+ "(",
146
+ t([F, i([r("", ", "), F], m(e, a, o, "arguments"))]),
147
+ F,
148
+ ")"
149
+ ]) : "",
150
+ p(e, o, s),
151
+ s.selectionSet ? " " : "",
152
+ o("selectionSet")
153
+ ]);
154
+ case "Name": return s.value;
155
+ case "StringValue":
156
+ if (s.block) {
157
+ let e = k(0, s.value, "\"\"\"", "\\\"\"\"").split("\n");
158
+ return e.length === 1 && (e[0] = e[0].trim()), e.every((e) => e === "") && (e.length = 0), i(I, [
159
+ "\"\"\"",
160
+ ...e,
161
+ "\"\"\""
162
+ ]);
163
+ }
164
+ return [
165
+ "\"",
166
+ k(0, k(0, s.value, /["\\]/gu, "\\$&"), "\n", "\\n"),
167
+ "\""
168
+ ];
169
+ case "IntValue":
170
+ case "FloatValue":
171
+ case "EnumValue": return s.value;
172
+ case "BooleanValue": return s.value ? "true" : "false";
173
+ case "NullValue": return "null";
174
+ case "Variable": return ["$", o("name")];
175
+ case "ListValue": return n([
176
+ "[",
177
+ t([F, i([r("", ", "), F], e.map(o, "values"))]),
178
+ F,
179
+ "]"
180
+ ]);
181
+ case "ObjectValue": {
182
+ let c = a.bracketSpacing && s.fields.length > 0 ? " " : "";
183
+ return n([
184
+ "{",
185
+ c,
186
+ t([F, i([r("", ", "), F], e.map(o, "fields"))]),
187
+ F,
188
+ r("", c),
189
+ "}"
190
+ ]);
191
+ }
192
+ case "ObjectField":
193
+ case "Argument": return [
194
+ o("name"),
195
+ ": ",
196
+ o("value")
197
+ ];
198
+ case "Directive": return [
199
+ "@",
200
+ o("name"),
201
+ s.arguments.length > 0 ? n([
202
+ "(",
203
+ t([F, i([r("", ", "), F], m(e, a, o, "arguments"))]),
204
+ F,
205
+ ")"
206
+ ]) : ""
207
+ ];
208
+ case "NamedType": return o("name");
209
+ case "VariableDefinition": return [
210
+ q(e, a, o),
211
+ o("variable"),
212
+ ": ",
213
+ o("type"),
214
+ s.defaultValue ? [" = ", o("defaultValue")] : "",
215
+ p(e, o, s)
216
+ ];
217
+ case "ObjectTypeExtension":
218
+ case "ObjectTypeDefinition":
219
+ case "InputObjectTypeExtension":
220
+ case "InputObjectTypeDefinition":
221
+ case "InterfaceTypeExtension":
222
+ case "InterfaceTypeDefinition": {
223
+ let { kind: n } = s, r = [];
224
+ return n.endsWith("TypeDefinition") ? r.push(q(e, a, o)) : r.push("extend "), n.startsWith("ObjectType") ? r.push("type") : n.startsWith("InputObjectType") ? r.push("input") : r.push("interface"), r.push(" ", o("name")), !n.startsWith("InputObjectType") && s.interfaces.length > 0 && r.push(" implements ", ...oe(e, a, o)), r.push(p(e, o, s)), s.fields.length > 0 && r.push([
225
+ " {",
226
+ t([I, i(I, m(e, a, o, "fields"))]),
227
+ I,
228
+ "}"
229
+ ]), r;
230
+ }
231
+ case "FieldDefinition": return [
232
+ q(e, a, o),
233
+ o("name"),
234
+ s.arguments.length > 0 ? n([
235
+ "(",
236
+ t([F, i([r("", ", "), F], m(e, a, o, "arguments"))]),
237
+ F,
238
+ ")"
239
+ ]) : "",
240
+ ": ",
241
+ o("type"),
242
+ p(e, o, s)
243
+ ];
244
+ case "DirectiveDefinition": return [
245
+ q(e, a, o),
246
+ "directive ",
247
+ "@",
248
+ o("name"),
249
+ s.arguments.length > 0 ? n([
250
+ "(",
251
+ t([F, i([r("", ", "), F], m(e, a, o, "arguments"))]),
252
+ F,
253
+ ")"
254
+ ]) : "",
255
+ s.repeatable ? " repeatable" : "",
256
+ " on ",
257
+ ...i(" | ", e.map(o, "locations"))
258
+ ];
259
+ case "EnumTypeExtension":
260
+ case "EnumTypeDefinition": return [
261
+ q(e, a, o),
262
+ s.kind === "EnumTypeExtension" ? "extend " : "",
263
+ "enum ",
264
+ o("name"),
265
+ p(e, o, s),
266
+ s.values.length > 0 ? [
267
+ " {",
268
+ t([I, i(I, m(e, a, o, "values"))]),
269
+ I,
270
+ "}"
271
+ ] : ""
272
+ ];
273
+ case "EnumValueDefinition": return [
274
+ q(e, a, o),
275
+ o("name"),
276
+ p(e, o, s)
277
+ ];
278
+ case "InputValueDefinition": return [
279
+ q(e, a, o),
280
+ o("name"),
281
+ ": ",
282
+ o("type"),
283
+ s.defaultValue ? [" = ", o("defaultValue")] : "",
284
+ p(e, o, s)
285
+ ];
286
+ case "SchemaExtension": return [
287
+ "extend schema",
288
+ p(e, o, s),
289
+ ...s.operationTypes.length > 0 ? [
290
+ " {",
291
+ t([I, i(I, m(e, a, o, "operationTypes"))]),
292
+ I,
293
+ "}"
294
+ ] : []
295
+ ];
296
+ case "SchemaDefinition": return [
297
+ q(e, a, o),
298
+ "schema",
299
+ p(e, o, s),
300
+ " {",
301
+ s.operationTypes.length > 0 ? t([I, i(I, m(e, a, o, "operationTypes"))]) : "",
302
+ I,
303
+ "}"
304
+ ];
305
+ case "OperationTypeDefinition": return [
306
+ s.operation,
307
+ ": ",
308
+ o("type")
309
+ ];
310
+ case "FragmentSpread": return [
311
+ "...",
312
+ o("name"),
313
+ p(e, o, s)
314
+ ];
315
+ case "InlineFragment": return [
316
+ "...",
317
+ s.typeCondition ? [" on ", o("typeCondition")] : "",
318
+ p(e, o, s),
319
+ " ",
320
+ o("selectionSet")
321
+ ];
322
+ case "UnionTypeExtension":
323
+ case "UnionTypeDefinition": return n([q(e, a, o), n([
324
+ s.kind === "UnionTypeExtension" ? "extend " : "",
325
+ "union ",
326
+ o("name"),
327
+ p(e, o, s),
328
+ s.types.length > 0 ? [
329
+ " =",
330
+ r("", " "),
331
+ t([r([P, "| "]), i([P, "| "], e.map(o, "types"))])
332
+ ] : ""
333
+ ])]);
334
+ case "ScalarTypeExtension":
335
+ case "ScalarTypeDefinition": return [
336
+ q(e, a, o),
337
+ s.kind === "ScalarTypeExtension" ? "extend " : "",
338
+ "scalar ",
339
+ o("name"),
340
+ p(e, o, s)
341
+ ];
342
+ case "NonNullType": return [o("type"), "!"];
343
+ case "ListType": return [
344
+ "[",
345
+ o("type"),
346
+ "]"
347
+ ];
348
+ default: throw new dt(s, "Graphql", "kind");
349
+ }
350
+ }
351
+ function p(e, r, a) {
352
+ if (a.directives.length === 0) return "";
353
+ let o = i(P, e.map(r, "directives"));
354
+ return a.kind === "FragmentDefinition" || a.kind === "OperationDefinition" ? n([P, o]) : [" ", n(t([F, o]))];
355
+ }
356
+ function m(e, t, n, r) {
357
+ return e.map(({ isLast: e, node: r }) => {
358
+ let i = n();
359
+ return !e && lt(t.originalText, gt(r)) ? [i, I] : i;
360
+ }, r);
361
+ }
362
+ function ie(e) {
363
+ return e.kind !== "Comment";
364
+ }
365
+ function ae({ node: e }) {
366
+ if (e.kind === "Comment") return "#" + e.value.trimEnd();
367
+ throw Error("Not a comment: " + JSON.stringify(e));
368
+ }
369
+ function oe(e, t, n) {
370
+ let { node: r } = e, i = [], { interfaces: a } = r, o = e.map(n, "interfaces");
371
+ for (let e = 0; e < a.length; e++) {
372
+ let n = a[e];
373
+ i.push(o[e]);
374
+ let r = a[e + 1];
375
+ if (r) {
376
+ let e = t.originalText.slice(n.loc.end, r.loc.start).includes("#");
377
+ i.push(" &", e ? P : " ");
378
+ }
379
+ }
380
+ return i;
381
+ }
382
+ function se(e, a) {
383
+ let { node: o } = e;
384
+ return B(o.variableDefinitions) ? n([
385
+ "(",
386
+ t([F, i([r("", ", "), F], e.map(a, "variableDefinitions"))]),
387
+ F,
388
+ ")"
389
+ ]) : "";
390
+ }
391
+ function ce(e, t) {
392
+ e.kind === "StringValue" && e.block && !e.value.includes("\n") && (t.value = e.value.trim());
393
+ }
394
+ function le(e) {
395
+ let { node: t } = e;
396
+ return t?.comments?.some((e) => e.value.trim() === "prettier-ignore");
397
+ }
398
+ function ue(e) {
399
+ return typeof e == "object" && !!e;
400
+ }
401
+ function de(e, t) {
402
+ if (!e) throw Error(t ?? "Unexpected invariant triggered.");
403
+ }
404
+ function h(e, t) {
405
+ let n = 0, r = 1;
406
+ for (let i of e.body.matchAll(Tt)) {
407
+ if (typeof i.index == "number" || de(!1), i.index >= t) break;
408
+ n = i.index + i[0].length, r += 1;
409
+ }
410
+ return {
411
+ line: r,
412
+ column: t + 1 - n
413
+ };
414
+ }
415
+ function fe(e) {
416
+ return pe(e.source, h(e.source, e.start));
417
+ }
418
+ function pe(e, t) {
419
+ let n = e.locationOffset.column - 1, r = "".padStart(n) + e.body, i = t.line - 1, a = e.locationOffset.line - 1, o = t.line + a, s = t.line === 1 ? n : 0, c = t.column + s, l = `${e.name}:${o}:${c}
420
+ `, u = r.split(/\r\n|[\n\r]/g), d = u[i];
421
+ if (d.length > 120) {
422
+ let e = Math.floor(c / 80), t = c % 80, n = [];
423
+ for (let e = 0; e < d.length; e += 80) n.push(d.slice(e, e + 80));
424
+ return l + me([
425
+ [`${o} |`, n[0]],
426
+ ...n.slice(1, e + 1).map((e) => ["|", e]),
427
+ ["|", "^".padStart(t)],
428
+ ["|", n[e + 1]]
429
+ ]);
430
+ }
431
+ return l + me([
432
+ [`${o - 1} |`, u[i - 1]],
433
+ [`${o} |`, d],
434
+ ["|", "^".padStart(c)],
435
+ [`${o + 1} |`, u[i + 1]]
436
+ ]);
437
+ }
438
+ function me(e) {
439
+ let t = e.filter(([e, t]) => t !== void 0), n = Math.max(...t.map(([e]) => e.length));
440
+ return t.map(([e, t]) => e.padStart(n) + (t ? " " + t : "")).join("\n");
441
+ }
442
+ function he(e) {
443
+ let t = e[0];
444
+ return t == null || "kind" in t || "length" in t ? {
445
+ nodes: t,
446
+ source: e[1],
447
+ positions: e[2],
448
+ path: e[3],
449
+ originalError: e[4],
450
+ extensions: e[5]
451
+ } : t;
452
+ }
453
+ function ge(e) {
454
+ return e === void 0 || e.length === 0 ? void 0 : e;
455
+ }
456
+ function g(e, t, n) {
457
+ return new Et(`Syntax Error: ${n}`, {
458
+ source: e,
459
+ positions: [t]
460
+ });
461
+ }
462
+ function _e(e) {
463
+ return e === 9 || e === 32;
464
+ }
465
+ function _(e) {
466
+ return e >= 48 && e <= 57;
467
+ }
468
+ function ve(e) {
469
+ return e >= 97 && e <= 122 || e >= 65 && e <= 90;
470
+ }
471
+ function ye(e) {
472
+ return ve(e) || e === 95;
473
+ }
474
+ function be(e) {
475
+ return ve(e) || _(e) || e === 95;
476
+ }
477
+ function xe(e) {
478
+ let t = 2 ** 53 - 1, n = null, r = -1;
479
+ for (let i = 0; i < e.length; ++i) {
480
+ let a = e[i], o = Se(a);
481
+ o !== a.length && (n ??= i, r = i, i !== 0 && o < t && (t = o));
482
+ }
483
+ return e.map((e, n) => n === 0 ? e : e.slice(t)).slice(n ?? 0, r + 1);
484
+ }
485
+ function Se(e) {
486
+ let t = 0;
487
+ for (; t < e.length && _e(e.charCodeAt(t));) ++t;
488
+ return t;
489
+ }
490
+ function Ce(e) {
491
+ return e === Z.BANG || e === Z.DOLLAR || e === Z.AMP || e === Z.PAREN_L || e === Z.PAREN_R || e === Z.DOT || e === Z.SPREAD || e === Z.COLON || e === Z.EQUALS || e === Z.AT || e === Z.BRACKET_L || e === Z.BRACKET_R || e === Z.BRACE_L || e === Z.PIPE || e === Z.BRACE_R;
492
+ }
493
+ function v(e) {
494
+ return e >= 0 && e <= 55295 || e >= 57344 && e <= 1114111;
495
+ }
496
+ function y(e, t) {
497
+ return we(e.charCodeAt(t)) && Te(e.charCodeAt(t + 1));
498
+ }
499
+ function we(e) {
500
+ return e >= 55296 && e <= 56319;
501
+ }
502
+ function Te(e) {
503
+ return e >= 56320 && e <= 57343;
504
+ }
505
+ function b(e, t) {
506
+ let n = e.source.body.codePointAt(t);
507
+ if (n === void 0) return Z.EOF;
508
+ if (n >= 32 && n <= 126) {
509
+ let e = String.fromCodePoint(n);
510
+ return e === "\"" ? "'\"'" : `"${e}"`;
511
+ }
512
+ return "U+" + n.toString(16).toUpperCase().padStart(4, "0");
513
+ }
514
+ function x(e, t, n, r, i) {
515
+ let a = e.line;
516
+ return new H(t, n, r, a, 1 + n - e.lineStart, i);
517
+ }
518
+ function Ee(e, t) {
519
+ let n = e.source.body, r = n.length, i = t;
520
+ for (; i < r;) {
521
+ let t = n.charCodeAt(i);
522
+ switch (t) {
523
+ case 65279:
524
+ case 9:
525
+ case 32:
526
+ case 44:
527
+ ++i;
528
+ continue;
529
+ case 10:
530
+ ++i, ++e.line, e.lineStart = i;
531
+ continue;
532
+ case 13:
533
+ n.charCodeAt(i + 1) === 10 ? i += 2 : ++i, ++e.line, e.lineStart = i;
534
+ continue;
535
+ case 35: return De(e, i);
536
+ case 33: return x(e, Z.BANG, i, i + 1);
537
+ case 36: return x(e, Z.DOLLAR, i, i + 1);
538
+ case 38: return x(e, Z.AMP, i, i + 1);
539
+ case 40: return x(e, Z.PAREN_L, i, i + 1);
540
+ case 41: return x(e, Z.PAREN_R, i, i + 1);
541
+ case 46:
542
+ if (n.charCodeAt(i + 1) === 46 && n.charCodeAt(i + 2) === 46) return x(e, Z.SPREAD, i, i + 3);
543
+ break;
544
+ case 58: return x(e, Z.COLON, i, i + 1);
545
+ case 61: return x(e, Z.EQUALS, i, i + 1);
546
+ case 64: return x(e, Z.AT, i, i + 1);
547
+ case 91: return x(e, Z.BRACKET_L, i, i + 1);
548
+ case 93: return x(e, Z.BRACKET_R, i, i + 1);
549
+ case 123: return x(e, Z.BRACE_L, i, i + 1);
550
+ case 124: return x(e, Z.PIPE, i, i + 1);
551
+ case 125: return x(e, Z.BRACE_R, i, i + 1);
552
+ case 34: return n.charCodeAt(i + 1) === 34 && n.charCodeAt(i + 2) === 34 ? Pe(e, i) : ke(e, i);
553
+ }
554
+ if (_(t) || t === 45) return Oe(e, i, t);
555
+ if (ye(t)) return Fe(e, i);
556
+ throw g(e.source, i, t === 39 ? "Unexpected single quote character ('), did you mean to use a double quote (\")?" : v(t) || y(n, i) ? `Unexpected character: ${b(e, i)}.` : `Invalid character: ${b(e, i)}.`);
557
+ }
558
+ return x(e, Z.EOF, r, r);
559
+ }
560
+ function De(e, t) {
561
+ let n = e.source.body, r = n.length, i = t + 1;
562
+ for (; i < r;) {
563
+ let e = n.charCodeAt(i);
564
+ if (e === 10 || e === 13) break;
565
+ if (v(e)) ++i;
566
+ else if (y(n, i)) i += 2;
567
+ else break;
568
+ }
569
+ return x(e, Z.COMMENT, t, i, n.slice(t + 1, i));
570
+ }
571
+ function Oe(e, t, n) {
572
+ let r = e.source.body, i = t, a = n, o = !1;
573
+ if (a === 45 && (a = r.charCodeAt(++i)), a === 48) {
574
+ if (a = r.charCodeAt(++i), _(a)) throw g(e.source, i, `Invalid number, unexpected digit after 0: ${b(e, i)}.`);
575
+ } else i = S(e, i, a), a = r.charCodeAt(i);
576
+ if (a === 46 && (o = !0, a = r.charCodeAt(++i), i = S(e, i, a), a = r.charCodeAt(i)), (a === 69 || a === 101) && (o = !0, a = r.charCodeAt(++i), (a === 43 || a === 45) && (a = r.charCodeAt(++i)), i = S(e, i, a), a = r.charCodeAt(i)), a === 46 || ye(a)) throw g(e.source, i, `Invalid number, expected digit but got: ${b(e, i)}.`);
577
+ return x(e, o ? Z.FLOAT : Z.INT, t, i, r.slice(t, i));
578
+ }
579
+ function S(e, t, n) {
580
+ if (!_(n)) throw g(e.source, t, `Invalid number, expected digit but got: ${b(e, t)}.`);
581
+ let r = e.source.body, i = t + 1;
582
+ for (; _(r.charCodeAt(i));) ++i;
583
+ return i;
584
+ }
585
+ function ke(e, t) {
586
+ let n = e.source.body, r = n.length, i = t + 1, a = i, o = "";
587
+ for (; i < r;) {
588
+ let r = n.charCodeAt(i);
589
+ if (r === 34) return o += n.slice(a, i), x(e, Z.STRING, t, i + 1, o);
590
+ if (r === 92) {
591
+ o += n.slice(a, i);
592
+ let t = n.charCodeAt(i + 1) === 117 ? n.charCodeAt(i + 2) === 123 ? Ae(e, i) : je(e, i) : Ne(e, i);
593
+ o += t.value, i += t.size, a = i;
594
+ continue;
595
+ }
596
+ if (r === 10 || r === 13) break;
597
+ if (v(r)) ++i;
598
+ else if (y(n, i)) i += 2;
599
+ else throw g(e.source, i, `Invalid character within String: ${b(e, i)}.`);
600
+ }
601
+ throw g(e.source, i, "Unterminated string.");
602
+ }
603
+ function Ae(e, t) {
604
+ let n = e.source.body, r = 0, i = 3;
605
+ for (; i < 12;) {
606
+ let e = n.charCodeAt(t + i++);
607
+ if (e === 125) {
608
+ if (i < 5 || !v(r)) break;
609
+ return {
610
+ value: String.fromCodePoint(r),
611
+ size: i
612
+ };
613
+ }
614
+ if (r = r << 4 | C(e), r < 0) break;
615
+ }
616
+ throw g(e.source, t, `Invalid Unicode escape sequence: "${n.slice(t, t + i)}".`);
617
+ }
618
+ function je(e, t) {
619
+ let n = e.source.body, r = Me(n, t + 2);
620
+ if (v(r)) return {
621
+ value: String.fromCodePoint(r),
622
+ size: 6
623
+ };
624
+ if (we(r) && n.charCodeAt(t + 6) === 92 && n.charCodeAt(t + 7) === 117) {
625
+ let e = Me(n, t + 8);
626
+ if (Te(e)) return {
627
+ value: String.fromCodePoint(r, e),
628
+ size: 12
629
+ };
630
+ }
631
+ throw g(e.source, t, `Invalid Unicode escape sequence: "${n.slice(t, t + 6)}".`);
632
+ }
633
+ function Me(e, t) {
634
+ return C(e.charCodeAt(t)) << 12 | C(e.charCodeAt(t + 1)) << 8 | C(e.charCodeAt(t + 2)) << 4 | C(e.charCodeAt(t + 3));
635
+ }
636
+ function C(e) {
637
+ return e >= 48 && e <= 57 ? e - 48 : e >= 65 && e <= 70 ? e - 55 : e >= 97 && e <= 102 ? e - 87 : -1;
638
+ }
639
+ function Ne(e, t) {
640
+ let n = e.source.body;
641
+ switch (n.charCodeAt(t + 1)) {
642
+ case 34: return {
643
+ value: "\"",
644
+ size: 2
645
+ };
646
+ case 92: return {
647
+ value: "\\",
648
+ size: 2
649
+ };
650
+ case 47: return {
651
+ value: "/",
652
+ size: 2
653
+ };
654
+ case 98: return {
655
+ value: "\b",
656
+ size: 2
657
+ };
658
+ case 102: return {
659
+ value: "\f",
660
+ size: 2
661
+ };
662
+ case 110: return {
663
+ value: "\n",
664
+ size: 2
665
+ };
666
+ case 114: return {
667
+ value: "\r",
668
+ size: 2
669
+ };
670
+ case 116: return {
671
+ value: " ",
672
+ size: 2
673
+ };
674
+ }
675
+ throw g(e.source, t, `Invalid character escape sequence: "${n.slice(t, t + 2)}".`);
676
+ }
677
+ function Pe(e, t) {
678
+ let n = e.source.body, r = n.length, i = e.lineStart, a = t + 3, o = a, s = "", c = [];
679
+ for (; a < r;) {
680
+ let r = n.charCodeAt(a);
681
+ if (r === 34 && n.charCodeAt(a + 1) === 34 && n.charCodeAt(a + 2) === 34) {
682
+ s += n.slice(o, a), c.push(s);
683
+ let r = x(e, Z.BLOCK_STRING, t, a + 3, xe(c).join("\n"));
684
+ return e.line += c.length - 1, e.lineStart = i, r;
685
+ }
686
+ if (r === 92 && n.charCodeAt(a + 1) === 34 && n.charCodeAt(a + 2) === 34 && n.charCodeAt(a + 3) === 34) {
687
+ s += n.slice(o, a), o = a + 1, a += 4;
688
+ continue;
689
+ }
690
+ if (r === 10 || r === 13) {
691
+ s += n.slice(o, a), c.push(s), r === 13 && n.charCodeAt(a + 1) === 10 ? a += 2 : ++a, s = "", o = a, i = a;
692
+ continue;
693
+ }
694
+ if (v(r)) ++a;
695
+ else if (y(n, a)) a += 2;
696
+ else throw g(e.source, a, `Invalid character within String: ${b(e, a)}.`);
697
+ }
698
+ throw g(e.source, a, "Unterminated string.");
699
+ }
700
+ function Fe(e, t) {
701
+ let n = e.source.body, r = n.length, i = t + 1;
702
+ for (; i < r && be(n.charCodeAt(i));) ++i;
703
+ return x(e, Z.NAME, t, i, n.slice(t, i));
704
+ }
705
+ function w(e, t) {
706
+ if (!e) throw Error(t);
707
+ }
708
+ function Ie(e) {
709
+ return T(e, []);
710
+ }
711
+ function T(e, t) {
712
+ switch (typeof e) {
713
+ case "string": return JSON.stringify(e);
714
+ case "function": return e.name ? `[function ${e.name}]` : "[function]";
715
+ case "object": return Le(e, t);
716
+ default: return String(e);
717
+ }
718
+ }
719
+ function Le(e, t) {
720
+ if (e === null) return "null";
721
+ if (t.includes(e)) return "[Circular]";
722
+ let n = [...t, e];
723
+ if (Re(e)) {
724
+ let t = e.toJSON();
725
+ if (t !== e) return typeof t == "string" ? t : T(t, n);
726
+ } else if (Array.isArray(e)) return Be(e, n);
727
+ return ze(e, n);
728
+ }
729
+ function Re(e) {
730
+ return typeof e.toJSON == "function";
731
+ }
732
+ function ze(e, t) {
733
+ let n = Object.entries(e);
734
+ return n.length === 0 ? "{}" : t.length > 2 ? "[" + Ve(e) + "]" : "{ " + n.map(([e, n]) => e + ": " + T(n, t)).join(", ") + " }";
735
+ }
736
+ function Be(e, t) {
737
+ if (e.length === 0) return "[]";
738
+ if (t.length > 2) return "[Array]";
739
+ let n = Math.min(10, e.length), r = e.length - n, i = [];
740
+ for (let r = 0; r < n; ++r) i.push(T(e[r], t));
741
+ return r === 1 ? i.push("... 1 more item") : r > 1 && i.push(`... ${r} more items`), "[" + i.join(", ") + "]";
742
+ }
743
+ function Ve(e) {
744
+ let t = Object.prototype.toString.call(e).replace(/^\[object /, "").replace(/]$/, "");
745
+ if (t === "Object" && typeof e.constructor == "function") {
746
+ let t = e.constructor.name;
747
+ if (typeof t == "string" && t !== "") return t;
748
+ }
749
+ return t;
750
+ }
751
+ function He(e) {
752
+ return kt(e, Q);
753
+ }
754
+ function Ue(e, t) {
755
+ let n = new At(e, t), r = n.parseDocument();
756
+ return Object.defineProperty(r, "tokenCount", {
757
+ enumerable: !1,
758
+ value: n.tokenCount
759
+ }), r;
760
+ }
761
+ function E(e) {
762
+ let t = e.value;
763
+ return We(e.kind) + (t == null ? "" : ` "${t}"`);
764
+ }
765
+ function We(e) {
766
+ return Ce(e) ? `"${e}"` : e;
767
+ }
768
+ function Ge(e, t) {
769
+ let n = /* @__PURE__ */ SyntaxError(e + " (" + t.loc.start.line + ":" + t.loc.start.column + ")");
770
+ return Object.assign(n, t);
771
+ }
772
+ function Ke(e) {
773
+ let t = [], { startToken: n, endToken: r } = e.loc;
774
+ for (let e = n; e !== r; e = e.next) e.kind === "Comment" && t.push({
775
+ ...e,
776
+ loc: {
777
+ start: e.start,
778
+ end: e.end
779
+ }
780
+ });
781
+ return t;
782
+ }
783
+ function qe(e) {
784
+ if (e?.name === "GraphQLError") {
785
+ let { message: t, locations: [n] } = e;
786
+ return jt(t, {
787
+ loc: { start: n },
788
+ cause: e
789
+ });
790
+ }
791
+ return e;
792
+ }
793
+ function Je(e) {
794
+ let t;
795
+ try {
796
+ t = Ue(e, Mt);
797
+ } catch (e) {
798
+ throw qe(e);
799
+ }
800
+ return t.comments = Ke(t), t;
801
+ }
802
+ var Ye, D, O, Xe, Ze, k, Qe, A, $e, et, tt, j, nt, M, N, rt, P, F, I, L, it, at, R, z, ot, st, ct, lt, B, ut, dt, V, ft, pt, mt, H, U, W, G, ht, K, gt, _t, vt, yt, bt, xt, St, q, Ct, wt, J, Y, Tt, Et, Dt, X, Z, Ot, kt, Q, At, jt, Mt, Nt, $;
803
+ //#endregion
804
+ e((() => {
805
+ Ye = Object.defineProperty, D = (e, t) => {
806
+ for (var n in t) Ye(e, n, {
807
+ get: t[n],
808
+ enumerable: !0
809
+ });
810
+ }, O = {}, D(O, {
811
+ languages: () => wt,
812
+ options: () => J,
813
+ parsers: () => Y,
814
+ printers: () => $
815
+ }), Xe = (e, t) => (n, r, ...i) => n | 1 && r == null ? void 0 : (t.call(r) ?? r[e]).apply(r, i), Ze = String.prototype.replaceAll ?? function(e, t) {
816
+ return e.global ? this.replace(e, t) : this.split(e).join(t);
817
+ }, k = Xe("replaceAll", function() {
818
+ if (typeof this == "string") return Ze;
819
+ }), Qe = () => {}, A = Qe, $e = "indent", et = "group", tt = "if-break", j = "line", nt = "break-parent", M = A, N = A, rt = { type: nt }, P = { type: j }, F = {
820
+ type: j,
821
+ soft: !0
822
+ }, I = [{
823
+ type: j,
824
+ hard: !0
825
+ }, rt], L = a(" "), it = a(",; "), at = a(/[^\n\r]/u), R = (e) => e === "\n" || e === "\r" || e === "\u2028" || e === "\u2029", z = o, ot = s, st = c, ct = l, lt = u, B = d, ut = class extends Error {
826
+ name = "UnexpectedNodeError";
827
+ constructor(e, t, n = "type") {
828
+ super(`Unexpected ${t} node ${n}: ${JSON.stringify(e[n])}.`), this.node = e;
829
+ }
830
+ }, dt = ut, V = null, ft = 10;
831
+ for (let e = 0; e <= ft; e++) f();
832
+ pt = te, mt = class {
833
+ constructor(e, t, n) {
834
+ this.start = e.start, this.end = t.end, this.startToken = e, this.endToken = t, this.source = n;
835
+ }
836
+ get [Symbol.toStringTag]() {
837
+ return "Location";
838
+ }
839
+ toJSON() {
840
+ return {
841
+ start: this.start,
842
+ end: this.end
843
+ };
844
+ }
845
+ }, H = class {
846
+ constructor(e, t, n, r, i, a) {
847
+ this.kind = e, this.start = t, this.end = n, this.line = r, this.column = i, this.value = a, this.prev = null, this.next = null;
848
+ }
849
+ get [Symbol.toStringTag]() {
850
+ return "Token";
851
+ }
852
+ toJSON() {
853
+ return {
854
+ kind: this.kind,
855
+ value: this.value,
856
+ line: this.line,
857
+ column: this.column
858
+ };
859
+ }
860
+ }, U = {
861
+ Name: [],
862
+ Document: ["definitions"],
863
+ OperationDefinition: [
864
+ "description",
865
+ "name",
866
+ "variableDefinitions",
867
+ "directives",
868
+ "selectionSet"
869
+ ],
870
+ VariableDefinition: [
871
+ "description",
872
+ "variable",
873
+ "type",
874
+ "defaultValue",
875
+ "directives"
876
+ ],
877
+ Variable: ["name"],
878
+ SelectionSet: ["selections"],
879
+ Field: [
880
+ "alias",
881
+ "name",
882
+ "arguments",
883
+ "directives",
884
+ "selectionSet"
885
+ ],
886
+ Argument: ["name", "value"],
887
+ FragmentSpread: ["name", "directives"],
888
+ InlineFragment: [
889
+ "typeCondition",
890
+ "directives",
891
+ "selectionSet"
892
+ ],
893
+ FragmentDefinition: [
894
+ "description",
895
+ "name",
896
+ "variableDefinitions",
897
+ "typeCondition",
898
+ "directives",
899
+ "selectionSet"
900
+ ],
901
+ IntValue: [],
902
+ FloatValue: [],
903
+ StringValue: [],
904
+ BooleanValue: [],
905
+ NullValue: [],
906
+ EnumValue: [],
907
+ ListValue: ["values"],
908
+ ObjectValue: ["fields"],
909
+ ObjectField: ["name", "value"],
910
+ Directive: ["name", "arguments"],
911
+ NamedType: ["name"],
912
+ ListType: ["type"],
913
+ NonNullType: ["type"],
914
+ SchemaDefinition: [
915
+ "description",
916
+ "directives",
917
+ "operationTypes"
918
+ ],
919
+ OperationTypeDefinition: ["type"],
920
+ ScalarTypeDefinition: [
921
+ "description",
922
+ "name",
923
+ "directives"
924
+ ],
925
+ ObjectTypeDefinition: [
926
+ "description",
927
+ "name",
928
+ "interfaces",
929
+ "directives",
930
+ "fields"
931
+ ],
932
+ FieldDefinition: [
933
+ "description",
934
+ "name",
935
+ "arguments",
936
+ "type",
937
+ "directives"
938
+ ],
939
+ InputValueDefinition: [
940
+ "description",
941
+ "name",
942
+ "type",
943
+ "defaultValue",
944
+ "directives"
945
+ ],
946
+ InterfaceTypeDefinition: [
947
+ "description",
948
+ "name",
949
+ "interfaces",
950
+ "directives",
951
+ "fields"
952
+ ],
953
+ UnionTypeDefinition: [
954
+ "description",
955
+ "name",
956
+ "directives",
957
+ "types"
958
+ ],
959
+ EnumTypeDefinition: [
960
+ "description",
961
+ "name",
962
+ "directives",
963
+ "values"
964
+ ],
965
+ EnumValueDefinition: [
966
+ "description",
967
+ "name",
968
+ "directives"
969
+ ],
970
+ InputObjectTypeDefinition: [
971
+ "description",
972
+ "name",
973
+ "directives",
974
+ "fields"
975
+ ],
976
+ DirectiveDefinition: [
977
+ "description",
978
+ "name",
979
+ "arguments",
980
+ "locations"
981
+ ],
982
+ SchemaExtension: ["directives", "operationTypes"],
983
+ ScalarTypeExtension: ["name", "directives"],
984
+ ObjectTypeExtension: [
985
+ "name",
986
+ "interfaces",
987
+ "directives",
988
+ "fields"
989
+ ],
990
+ InterfaceTypeExtension: [
991
+ "name",
992
+ "interfaces",
993
+ "directives",
994
+ "fields"
995
+ ],
996
+ UnionTypeExtension: [
997
+ "name",
998
+ "directives",
999
+ "types"
1000
+ ],
1001
+ EnumTypeExtension: [
1002
+ "name",
1003
+ "directives",
1004
+ "values"
1005
+ ],
1006
+ InputObjectTypeExtension: [
1007
+ "name",
1008
+ "directives",
1009
+ "fields"
1010
+ ],
1011
+ TypeCoordinate: ["name"],
1012
+ MemberCoordinate: ["name", "memberName"],
1013
+ ArgumentCoordinate: [
1014
+ "name",
1015
+ "fieldName",
1016
+ "argumentName"
1017
+ ],
1018
+ DirectiveCoordinate: ["name"],
1019
+ DirectiveArgumentCoordinate: ["name", "argumentName"]
1020
+ }, new Set(Object.keys(U)), (function(e) {
1021
+ e.QUERY = "query", e.MUTATION = "mutation", e.SUBSCRIPTION = "subscription";
1022
+ })(W ||= {}), G = { ...U };
1023
+ for (let e of [
1024
+ "ArgumentCoordinate",
1025
+ "DirectiveArgumentCoordinate",
1026
+ "DirectiveCoordinate",
1027
+ "MemberCoordinate",
1028
+ "TypeCoordinate"
1029
+ ]) delete G[e];
1030
+ ht = pt(G, "kind"), K = (e) => e.loc.start, gt = (e) => e.loc.end, _t = "format", vt = /^\s*#[^\S\n]*@(?:noformat|noprettier)\s*(?:\n|$)/u, yt = /^\s*#[^\S\n]*@(?:format|prettier)\s*(?:\n|$)/u, bt = (e) => yt.test(e), xt = (e) => vt.test(e), St = (e) => `# @${_t}
1031
+
1032
+ ${e}`, q = ne, ce.ignoredProperties = new Set(["loc", "comments"]), Ct = {
1033
+ print: re,
1034
+ massageAstNode: ce,
1035
+ hasPrettierIgnore: le,
1036
+ insertPragma: St,
1037
+ printComment: ae,
1038
+ canAttachComment: ie,
1039
+ getVisitorKeys: ht
1040
+ }, wt = [{
1041
+ name: "GraphQL",
1042
+ type: "data",
1043
+ aceMode: "graphqlschema",
1044
+ extensions: [
1045
+ ".graphql",
1046
+ ".gql",
1047
+ ".graphqls"
1048
+ ],
1049
+ tmScope: "source.graphql",
1050
+ parsers: ["graphql"],
1051
+ vscodeLanguageIds: ["graphql"],
1052
+ linguistLanguageId: 139
1053
+ }], J = { bracketSpacing: {
1054
+ bracketSpacing: {
1055
+ category: "Common",
1056
+ type: "boolean",
1057
+ default: !0,
1058
+ description: "Print spaces between brackets.",
1059
+ oppositeDescription: "Do not print spaces between brackets."
1060
+ },
1061
+ objectWrap: {
1062
+ category: "Common",
1063
+ type: "choice",
1064
+ default: "preserve",
1065
+ description: "How to wrap object literals.",
1066
+ choices: [{
1067
+ value: "preserve",
1068
+ description: "Keep as multi-line, if there is a newline between the opening brace and first property."
1069
+ }, {
1070
+ value: "collapse",
1071
+ description: "Fit to a single line when possible."
1072
+ }]
1073
+ },
1074
+ singleQuote: {
1075
+ category: "Common",
1076
+ type: "boolean",
1077
+ default: !1,
1078
+ description: "Use single quotes instead of double quotes."
1079
+ },
1080
+ proseWrap: {
1081
+ category: "Common",
1082
+ type: "choice",
1083
+ default: "preserve",
1084
+ description: "How to wrap prose.",
1085
+ choices: [
1086
+ {
1087
+ value: "always",
1088
+ description: "Wrap prose if it exceeds the print width."
1089
+ },
1090
+ {
1091
+ value: "never",
1092
+ description: "Do not wrap prose."
1093
+ },
1094
+ {
1095
+ value: "preserve",
1096
+ description: "Wrap prose as-is."
1097
+ }
1098
+ ]
1099
+ },
1100
+ bracketSameLine: {
1101
+ category: "Common",
1102
+ type: "boolean",
1103
+ default: !1,
1104
+ description: "Put > of opening tags on the last line instead of on a new line."
1105
+ },
1106
+ singleAttributePerLine: {
1107
+ category: "Common",
1108
+ type: "boolean",
1109
+ default: !1,
1110
+ description: "Enforce single attribute per line in HTML, Vue and JSX."
1111
+ }
1112
+ }.bracketSpacing }, Y = {}, D(Y, { graphql: () => Nt }), Tt = /\r\n|[\n\r]/g, Et = class e extends Error {
1113
+ constructor(t, ...n) {
1114
+ var r;
1115
+ let { nodes: i, source: a, positions: o, path: s, originalError: c, extensions: l } = he(n);
1116
+ super(t), this.name = "GraphQLError", this.path = s ?? void 0, this.originalError = c ?? void 0, this.nodes = ge(Array.isArray(i) ? i : i ? [i] : void 0);
1117
+ let u = ge(this.nodes?.map((e) => e.loc).filter((e) => e != null));
1118
+ this.source = a ?? (u == null || (r = u[0]) == null ? void 0 : r.source), this.positions = o ?? u?.map((e) => e.start), this.locations = o && a ? o.map((e) => h(a, e)) : u?.map((e) => h(e.source, e.start));
1119
+ let d = ue(c?.extensions) ? c?.extensions : void 0;
1120
+ this.extensions = l ?? d ?? Object.create(null), Object.defineProperties(this, {
1121
+ message: {
1122
+ writable: !0,
1123
+ enumerable: !0
1124
+ },
1125
+ name: { enumerable: !1 },
1126
+ nodes: { enumerable: !1 },
1127
+ source: { enumerable: !1 },
1128
+ positions: { enumerable: !1 },
1129
+ originalError: { enumerable: !1 }
1130
+ }), c != null && c.stack ? Object.defineProperty(this, "stack", {
1131
+ value: c.stack,
1132
+ writable: !0,
1133
+ configurable: !0
1134
+ }) : Error.captureStackTrace ? Error.captureStackTrace(this, e) : Object.defineProperty(this, "stack", {
1135
+ value: Error().stack,
1136
+ writable: !0,
1137
+ configurable: !0
1138
+ });
1139
+ }
1140
+ get [Symbol.toStringTag]() {
1141
+ return "GraphQLError";
1142
+ }
1143
+ toString() {
1144
+ let e = this.message;
1145
+ if (this.nodes) for (let t of this.nodes) t.loc && (e += "\n\n" + fe(t.loc));
1146
+ else if (this.source && this.locations) for (let t of this.locations) e += "\n\n" + pe(this.source, t);
1147
+ return e;
1148
+ }
1149
+ toJSON() {
1150
+ let e = { message: this.message };
1151
+ return this.locations != null && (e.locations = this.locations), this.path != null && (e.path = this.path), this.extensions != null && Object.keys(this.extensions).length > 0 && (e.extensions = this.extensions), e;
1152
+ }
1153
+ }, (function(e) {
1154
+ e.QUERY = "QUERY", e.MUTATION = "MUTATION", e.SUBSCRIPTION = "SUBSCRIPTION", e.FIELD = "FIELD", e.FRAGMENT_DEFINITION = "FRAGMENT_DEFINITION", e.FRAGMENT_SPREAD = "FRAGMENT_SPREAD", e.INLINE_FRAGMENT = "INLINE_FRAGMENT", e.VARIABLE_DEFINITION = "VARIABLE_DEFINITION", e.SCHEMA = "SCHEMA", e.SCALAR = "SCALAR", e.OBJECT = "OBJECT", e.FIELD_DEFINITION = "FIELD_DEFINITION", e.ARGUMENT_DEFINITION = "ARGUMENT_DEFINITION", e.INTERFACE = "INTERFACE", e.UNION = "UNION", e.ENUM = "ENUM", e.ENUM_VALUE = "ENUM_VALUE", e.INPUT_OBJECT = "INPUT_OBJECT", e.INPUT_FIELD_DEFINITION = "INPUT_FIELD_DEFINITION";
1155
+ })(Dt ||= {}), (function(e) {
1156
+ e.NAME = "Name", e.DOCUMENT = "Document", e.OPERATION_DEFINITION = "OperationDefinition", e.VARIABLE_DEFINITION = "VariableDefinition", e.SELECTION_SET = "SelectionSet", e.FIELD = "Field", e.ARGUMENT = "Argument", e.FRAGMENT_SPREAD = "FragmentSpread", e.INLINE_FRAGMENT = "InlineFragment", e.FRAGMENT_DEFINITION = "FragmentDefinition", e.VARIABLE = "Variable", e.INT = "IntValue", e.FLOAT = "FloatValue", e.STRING = "StringValue", e.BOOLEAN = "BooleanValue", e.NULL = "NullValue", e.ENUM = "EnumValue", e.LIST = "ListValue", e.OBJECT = "ObjectValue", e.OBJECT_FIELD = "ObjectField", e.DIRECTIVE = "Directive", e.NAMED_TYPE = "NamedType", e.LIST_TYPE = "ListType", e.NON_NULL_TYPE = "NonNullType", e.SCHEMA_DEFINITION = "SchemaDefinition", e.OPERATION_TYPE_DEFINITION = "OperationTypeDefinition", e.SCALAR_TYPE_DEFINITION = "ScalarTypeDefinition", e.OBJECT_TYPE_DEFINITION = "ObjectTypeDefinition", e.FIELD_DEFINITION = "FieldDefinition", e.INPUT_VALUE_DEFINITION = "InputValueDefinition", e.INTERFACE_TYPE_DEFINITION = "InterfaceTypeDefinition", e.UNION_TYPE_DEFINITION = "UnionTypeDefinition", e.ENUM_TYPE_DEFINITION = "EnumTypeDefinition", e.ENUM_VALUE_DEFINITION = "EnumValueDefinition", e.INPUT_OBJECT_TYPE_DEFINITION = "InputObjectTypeDefinition", e.DIRECTIVE_DEFINITION = "DirectiveDefinition", e.SCHEMA_EXTENSION = "SchemaExtension", e.SCALAR_TYPE_EXTENSION = "ScalarTypeExtension", e.OBJECT_TYPE_EXTENSION = "ObjectTypeExtension", e.INTERFACE_TYPE_EXTENSION = "InterfaceTypeExtension", e.UNION_TYPE_EXTENSION = "UnionTypeExtension", e.ENUM_TYPE_EXTENSION = "EnumTypeExtension", e.INPUT_OBJECT_TYPE_EXTENSION = "InputObjectTypeExtension", e.TYPE_COORDINATE = "TypeCoordinate", e.MEMBER_COORDINATE = "MemberCoordinate", e.ARGUMENT_COORDINATE = "ArgumentCoordinate", e.DIRECTIVE_COORDINATE = "DirectiveCoordinate", e.DIRECTIVE_ARGUMENT_COORDINATE = "DirectiveArgumentCoordinate";
1157
+ })(X ||= {}), (function(e) {
1158
+ e.SOF = "<SOF>", e.EOF = "<EOF>", e.BANG = "!", e.DOLLAR = "$", e.AMP = "&", e.PAREN_L = "(", e.PAREN_R = ")", e.DOT = ".", e.SPREAD = "...", e.COLON = ":", e.EQUALS = "=", e.AT = "@", e.BRACKET_L = "[", e.BRACKET_R = "]", e.BRACE_L = "{", e.PIPE = "|", e.BRACE_R = "}", e.NAME = "Name", e.INT = "Int", e.FLOAT = "Float", e.STRING = "String", e.BLOCK_STRING = "BlockString", e.COMMENT = "Comment";
1159
+ })(Z ||= {}), Ot = class {
1160
+ constructor(e) {
1161
+ let t = new H(Z.SOF, 0, 0, 0, 0);
1162
+ this.source = e, this.lastToken = t, this.token = t, this.line = 1, this.lineStart = 0;
1163
+ }
1164
+ get [Symbol.toStringTag]() {
1165
+ return "Lexer";
1166
+ }
1167
+ advance() {
1168
+ return this.lastToken = this.token, this.token = this.lookahead();
1169
+ }
1170
+ lookahead() {
1171
+ let e = this.token;
1172
+ if (e.kind !== Z.EOF) do
1173
+ if (e.next) e = e.next;
1174
+ else {
1175
+ let t = Ee(this, e.end);
1176
+ e.next = t, t.prev = e, e = t;
1177
+ }
1178
+ while (e.kind === Z.COMMENT);
1179
+ return e;
1180
+ }
1181
+ }, kt = globalThis.process ? function(e, t) {
1182
+ return e instanceof t;
1183
+ } : function(e, t) {
1184
+ if (e instanceof t) return !0;
1185
+ if (typeof e == "object" && e) {
1186
+ let n = t.prototype[Symbol.toStringTag];
1187
+ if (n === (Symbol.toStringTag in e ? e[Symbol.toStringTag] : e.constructor?.name)) {
1188
+ let t = Ie(e);
1189
+ throw Error(`Cannot use ${n} "${t}" from another module or realm.
1190
+
1191
+ Ensure that there is only one instance of "graphql" in the node_modules
1192
+ directory. If different versions of "graphql" are the dependencies of other
1193
+ relied on modules, use "resolutions" to ensure only one version is installed.
1194
+
1195
+ https://yarnpkg.com/en/docs/selective-version-resolutions
1196
+
1197
+ Duplicate "graphql" modules cannot be used at the same time since different
1198
+ versions may have different capabilities and behavior. The data from one
1199
+ version used in the function from another could produce confusing and
1200
+ spurious results.`);
1201
+ }
1202
+ }
1203
+ return !1;
1204
+ }, Q = class {
1205
+ constructor(e, t = "GraphQL request", n = {
1206
+ line: 1,
1207
+ column: 1
1208
+ }) {
1209
+ typeof e == "string" || w(!1, `Body must be a string. Received: ${Ie(e)}.`), this.body = e, this.name = t, this.locationOffset = n, this.locationOffset.line > 0 || w(!1, "line in locationOffset is 1-indexed and must be positive."), this.locationOffset.column > 0 || w(!1, "column in locationOffset is 1-indexed and must be positive.");
1210
+ }
1211
+ get [Symbol.toStringTag]() {
1212
+ return "Source";
1213
+ }
1214
+ }, At = class {
1215
+ constructor(e, t = {}) {
1216
+ let { lexer: n, ...r } = t;
1217
+ n ? this._lexer = n : this._lexer = new Ot(He(e) ? e : new Q(e)), this._options = r, this._tokenCounter = 0;
1218
+ }
1219
+ get tokenCount() {
1220
+ return this._tokenCounter;
1221
+ }
1222
+ parseName() {
1223
+ let e = this.expectToken(Z.NAME);
1224
+ return this.node(e, {
1225
+ kind: X.NAME,
1226
+ value: e.value
1227
+ });
1228
+ }
1229
+ parseDocument() {
1230
+ return this.node(this._lexer.token, {
1231
+ kind: X.DOCUMENT,
1232
+ definitions: this.many(Z.SOF, this.parseDefinition, Z.EOF)
1233
+ });
1234
+ }
1235
+ parseDefinition() {
1236
+ if (this.peek(Z.BRACE_L)) return this.parseOperationDefinition();
1237
+ let e = this.peekDescription(), t = e ? this._lexer.lookahead() : this._lexer.token;
1238
+ if (e && t.kind === Z.BRACE_L) throw g(this._lexer.source, this._lexer.token.start, "Unexpected description, descriptions are not supported on shorthand queries.");
1239
+ if (t.kind === Z.NAME) {
1240
+ switch (t.value) {
1241
+ case "schema": return this.parseSchemaDefinition();
1242
+ case "scalar": return this.parseScalarTypeDefinition();
1243
+ case "type": return this.parseObjectTypeDefinition();
1244
+ case "interface": return this.parseInterfaceTypeDefinition();
1245
+ case "union": return this.parseUnionTypeDefinition();
1246
+ case "enum": return this.parseEnumTypeDefinition();
1247
+ case "input": return this.parseInputObjectTypeDefinition();
1248
+ case "directive": return this.parseDirectiveDefinition();
1249
+ }
1250
+ switch (t.value) {
1251
+ case "query":
1252
+ case "mutation":
1253
+ case "subscription": return this.parseOperationDefinition();
1254
+ case "fragment": return this.parseFragmentDefinition();
1255
+ }
1256
+ if (e) throw g(this._lexer.source, this._lexer.token.start, "Unexpected description, only GraphQL definitions support descriptions.");
1257
+ switch (t.value) {
1258
+ case "extend": return this.parseTypeSystemExtension();
1259
+ }
1260
+ }
1261
+ throw this.unexpected(t);
1262
+ }
1263
+ parseOperationDefinition() {
1264
+ let e = this._lexer.token;
1265
+ if (this.peek(Z.BRACE_L)) return this.node(e, {
1266
+ kind: X.OPERATION_DEFINITION,
1267
+ operation: W.QUERY,
1268
+ description: void 0,
1269
+ name: void 0,
1270
+ variableDefinitions: [],
1271
+ directives: [],
1272
+ selectionSet: this.parseSelectionSet()
1273
+ });
1274
+ let t = this.parseDescription(), n = this.parseOperationType(), r;
1275
+ return this.peek(Z.NAME) && (r = this.parseName()), this.node(e, {
1276
+ kind: X.OPERATION_DEFINITION,
1277
+ operation: n,
1278
+ description: t,
1279
+ name: r,
1280
+ variableDefinitions: this.parseVariableDefinitions(),
1281
+ directives: this.parseDirectives(!1),
1282
+ selectionSet: this.parseSelectionSet()
1283
+ });
1284
+ }
1285
+ parseOperationType() {
1286
+ let e = this.expectToken(Z.NAME);
1287
+ switch (e.value) {
1288
+ case "query": return W.QUERY;
1289
+ case "mutation": return W.MUTATION;
1290
+ case "subscription": return W.SUBSCRIPTION;
1291
+ }
1292
+ throw this.unexpected(e);
1293
+ }
1294
+ parseVariableDefinitions() {
1295
+ return this.optionalMany(Z.PAREN_L, this.parseVariableDefinition, Z.PAREN_R);
1296
+ }
1297
+ parseVariableDefinition() {
1298
+ return this.node(this._lexer.token, {
1299
+ kind: X.VARIABLE_DEFINITION,
1300
+ description: this.parseDescription(),
1301
+ variable: this.parseVariable(),
1302
+ type: (this.expectToken(Z.COLON), this.parseTypeReference()),
1303
+ defaultValue: this.expectOptionalToken(Z.EQUALS) ? this.parseConstValueLiteral() : void 0,
1304
+ directives: this.parseConstDirectives()
1305
+ });
1306
+ }
1307
+ parseVariable() {
1308
+ let e = this._lexer.token;
1309
+ return this.expectToken(Z.DOLLAR), this.node(e, {
1310
+ kind: X.VARIABLE,
1311
+ name: this.parseName()
1312
+ });
1313
+ }
1314
+ parseSelectionSet() {
1315
+ return this.node(this._lexer.token, {
1316
+ kind: X.SELECTION_SET,
1317
+ selections: this.many(Z.BRACE_L, this.parseSelection, Z.BRACE_R)
1318
+ });
1319
+ }
1320
+ parseSelection() {
1321
+ return this.peek(Z.SPREAD) ? this.parseFragment() : this.parseField();
1322
+ }
1323
+ parseField() {
1324
+ let e = this._lexer.token, t = this.parseName(), n, r;
1325
+ return this.expectOptionalToken(Z.COLON) ? (n = t, r = this.parseName()) : r = t, this.node(e, {
1326
+ kind: X.FIELD,
1327
+ alias: n,
1328
+ name: r,
1329
+ arguments: this.parseArguments(!1),
1330
+ directives: this.parseDirectives(!1),
1331
+ selectionSet: this.peek(Z.BRACE_L) ? this.parseSelectionSet() : void 0
1332
+ });
1333
+ }
1334
+ parseArguments(e) {
1335
+ let t = e ? this.parseConstArgument : this.parseArgument;
1336
+ return this.optionalMany(Z.PAREN_L, t, Z.PAREN_R);
1337
+ }
1338
+ parseArgument(e = !1) {
1339
+ let t = this._lexer.token, n = this.parseName();
1340
+ return this.expectToken(Z.COLON), this.node(t, {
1341
+ kind: X.ARGUMENT,
1342
+ name: n,
1343
+ value: this.parseValueLiteral(e)
1344
+ });
1345
+ }
1346
+ parseConstArgument() {
1347
+ return this.parseArgument(!0);
1348
+ }
1349
+ parseFragment() {
1350
+ let e = this._lexer.token;
1351
+ this.expectToken(Z.SPREAD);
1352
+ let t = this.expectOptionalKeyword("on");
1353
+ return !t && this.peek(Z.NAME) ? this.node(e, {
1354
+ kind: X.FRAGMENT_SPREAD,
1355
+ name: this.parseFragmentName(),
1356
+ directives: this.parseDirectives(!1)
1357
+ }) : this.node(e, {
1358
+ kind: X.INLINE_FRAGMENT,
1359
+ typeCondition: t ? this.parseNamedType() : void 0,
1360
+ directives: this.parseDirectives(!1),
1361
+ selectionSet: this.parseSelectionSet()
1362
+ });
1363
+ }
1364
+ parseFragmentDefinition() {
1365
+ let e = this._lexer.token, t = this.parseDescription();
1366
+ return this.expectKeyword("fragment"), this._options.allowLegacyFragmentVariables === !0 ? this.node(e, {
1367
+ kind: X.FRAGMENT_DEFINITION,
1368
+ description: t,
1369
+ name: this.parseFragmentName(),
1370
+ variableDefinitions: this.parseVariableDefinitions(),
1371
+ typeCondition: (this.expectKeyword("on"), this.parseNamedType()),
1372
+ directives: this.parseDirectives(!1),
1373
+ selectionSet: this.parseSelectionSet()
1374
+ }) : this.node(e, {
1375
+ kind: X.FRAGMENT_DEFINITION,
1376
+ description: t,
1377
+ name: this.parseFragmentName(),
1378
+ typeCondition: (this.expectKeyword("on"), this.parseNamedType()),
1379
+ directives: this.parseDirectives(!1),
1380
+ selectionSet: this.parseSelectionSet()
1381
+ });
1382
+ }
1383
+ parseFragmentName() {
1384
+ if (this._lexer.token.value === "on") throw this.unexpected();
1385
+ return this.parseName();
1386
+ }
1387
+ parseValueLiteral(e) {
1388
+ let t = this._lexer.token;
1389
+ switch (t.kind) {
1390
+ case Z.BRACKET_L: return this.parseList(e);
1391
+ case Z.BRACE_L: return this.parseObject(e);
1392
+ case Z.INT: return this.advanceLexer(), this.node(t, {
1393
+ kind: X.INT,
1394
+ value: t.value
1395
+ });
1396
+ case Z.FLOAT: return this.advanceLexer(), this.node(t, {
1397
+ kind: X.FLOAT,
1398
+ value: t.value
1399
+ });
1400
+ case Z.STRING:
1401
+ case Z.BLOCK_STRING: return this.parseStringLiteral();
1402
+ case Z.NAME: switch (this.advanceLexer(), t.value) {
1403
+ case "true": return this.node(t, {
1404
+ kind: X.BOOLEAN,
1405
+ value: !0
1406
+ });
1407
+ case "false": return this.node(t, {
1408
+ kind: X.BOOLEAN,
1409
+ value: !1
1410
+ });
1411
+ case "null": return this.node(t, { kind: X.NULL });
1412
+ default: return this.node(t, {
1413
+ kind: X.ENUM,
1414
+ value: t.value
1415
+ });
1416
+ }
1417
+ case Z.DOLLAR:
1418
+ if (e) if (this.expectToken(Z.DOLLAR), this._lexer.token.kind === Z.NAME) {
1419
+ let e = this._lexer.token.value;
1420
+ throw g(this._lexer.source, t.start, `Unexpected variable "$${e}" in constant value.`);
1421
+ } else throw this.unexpected(t);
1422
+ return this.parseVariable();
1423
+ default: throw this.unexpected();
1424
+ }
1425
+ }
1426
+ parseConstValueLiteral() {
1427
+ return this.parseValueLiteral(!0);
1428
+ }
1429
+ parseStringLiteral() {
1430
+ let e = this._lexer.token;
1431
+ return this.advanceLexer(), this.node(e, {
1432
+ kind: X.STRING,
1433
+ value: e.value,
1434
+ block: e.kind === Z.BLOCK_STRING
1435
+ });
1436
+ }
1437
+ parseList(e) {
1438
+ return this.node(this._lexer.token, {
1439
+ kind: X.LIST,
1440
+ values: this.any(Z.BRACKET_L, () => this.parseValueLiteral(e), Z.BRACKET_R)
1441
+ });
1442
+ }
1443
+ parseObject(e) {
1444
+ return this.node(this._lexer.token, {
1445
+ kind: X.OBJECT,
1446
+ fields: this.any(Z.BRACE_L, () => this.parseObjectField(e), Z.BRACE_R)
1447
+ });
1448
+ }
1449
+ parseObjectField(e) {
1450
+ let t = this._lexer.token, n = this.parseName();
1451
+ return this.expectToken(Z.COLON), this.node(t, {
1452
+ kind: X.OBJECT_FIELD,
1453
+ name: n,
1454
+ value: this.parseValueLiteral(e)
1455
+ });
1456
+ }
1457
+ parseDirectives(e) {
1458
+ let t = [];
1459
+ for (; this.peek(Z.AT);) t.push(this.parseDirective(e));
1460
+ return t;
1461
+ }
1462
+ parseConstDirectives() {
1463
+ return this.parseDirectives(!0);
1464
+ }
1465
+ parseDirective(e) {
1466
+ let t = this._lexer.token;
1467
+ return this.expectToken(Z.AT), this.node(t, {
1468
+ kind: X.DIRECTIVE,
1469
+ name: this.parseName(),
1470
+ arguments: this.parseArguments(e)
1471
+ });
1472
+ }
1473
+ parseTypeReference() {
1474
+ let e = this._lexer.token, t;
1475
+ if (this.expectOptionalToken(Z.BRACKET_L)) {
1476
+ let n = this.parseTypeReference();
1477
+ this.expectToken(Z.BRACKET_R), t = this.node(e, {
1478
+ kind: X.LIST_TYPE,
1479
+ type: n
1480
+ });
1481
+ } else t = this.parseNamedType();
1482
+ return this.expectOptionalToken(Z.BANG) ? this.node(e, {
1483
+ kind: X.NON_NULL_TYPE,
1484
+ type: t
1485
+ }) : t;
1486
+ }
1487
+ parseNamedType() {
1488
+ return this.node(this._lexer.token, {
1489
+ kind: X.NAMED_TYPE,
1490
+ name: this.parseName()
1491
+ });
1492
+ }
1493
+ peekDescription() {
1494
+ return this.peek(Z.STRING) || this.peek(Z.BLOCK_STRING);
1495
+ }
1496
+ parseDescription() {
1497
+ if (this.peekDescription()) return this.parseStringLiteral();
1498
+ }
1499
+ parseSchemaDefinition() {
1500
+ let e = this._lexer.token, t = this.parseDescription();
1501
+ this.expectKeyword("schema");
1502
+ let n = this.parseConstDirectives(), r = this.many(Z.BRACE_L, this.parseOperationTypeDefinition, Z.BRACE_R);
1503
+ return this.node(e, {
1504
+ kind: X.SCHEMA_DEFINITION,
1505
+ description: t,
1506
+ directives: n,
1507
+ operationTypes: r
1508
+ });
1509
+ }
1510
+ parseOperationTypeDefinition() {
1511
+ let e = this._lexer.token, t = this.parseOperationType();
1512
+ this.expectToken(Z.COLON);
1513
+ let n = this.parseNamedType();
1514
+ return this.node(e, {
1515
+ kind: X.OPERATION_TYPE_DEFINITION,
1516
+ operation: t,
1517
+ type: n
1518
+ });
1519
+ }
1520
+ parseScalarTypeDefinition() {
1521
+ let e = this._lexer.token, t = this.parseDescription();
1522
+ this.expectKeyword("scalar");
1523
+ let n = this.parseName(), r = this.parseConstDirectives();
1524
+ return this.node(e, {
1525
+ kind: X.SCALAR_TYPE_DEFINITION,
1526
+ description: t,
1527
+ name: n,
1528
+ directives: r
1529
+ });
1530
+ }
1531
+ parseObjectTypeDefinition() {
1532
+ let e = this._lexer.token, t = this.parseDescription();
1533
+ this.expectKeyword("type");
1534
+ let n = this.parseName(), r = this.parseImplementsInterfaces(), i = this.parseConstDirectives(), a = this.parseFieldsDefinition();
1535
+ return this.node(e, {
1536
+ kind: X.OBJECT_TYPE_DEFINITION,
1537
+ description: t,
1538
+ name: n,
1539
+ interfaces: r,
1540
+ directives: i,
1541
+ fields: a
1542
+ });
1543
+ }
1544
+ parseImplementsInterfaces() {
1545
+ return this.expectOptionalKeyword("implements") ? this.delimitedMany(Z.AMP, this.parseNamedType) : [];
1546
+ }
1547
+ parseFieldsDefinition() {
1548
+ return this.optionalMany(Z.BRACE_L, this.parseFieldDefinition, Z.BRACE_R);
1549
+ }
1550
+ parseFieldDefinition() {
1551
+ let e = this._lexer.token, t = this.parseDescription(), n = this.parseName(), r = this.parseArgumentDefs();
1552
+ this.expectToken(Z.COLON);
1553
+ let i = this.parseTypeReference(), a = this.parseConstDirectives();
1554
+ return this.node(e, {
1555
+ kind: X.FIELD_DEFINITION,
1556
+ description: t,
1557
+ name: n,
1558
+ arguments: r,
1559
+ type: i,
1560
+ directives: a
1561
+ });
1562
+ }
1563
+ parseArgumentDefs() {
1564
+ return this.optionalMany(Z.PAREN_L, this.parseInputValueDef, Z.PAREN_R);
1565
+ }
1566
+ parseInputValueDef() {
1567
+ let e = this._lexer.token, t = this.parseDescription(), n = this.parseName();
1568
+ this.expectToken(Z.COLON);
1569
+ let r = this.parseTypeReference(), i;
1570
+ this.expectOptionalToken(Z.EQUALS) && (i = this.parseConstValueLiteral());
1571
+ let a = this.parseConstDirectives();
1572
+ return this.node(e, {
1573
+ kind: X.INPUT_VALUE_DEFINITION,
1574
+ description: t,
1575
+ name: n,
1576
+ type: r,
1577
+ defaultValue: i,
1578
+ directives: a
1579
+ });
1580
+ }
1581
+ parseInterfaceTypeDefinition() {
1582
+ let e = this._lexer.token, t = this.parseDescription();
1583
+ this.expectKeyword("interface");
1584
+ let n = this.parseName(), r = this.parseImplementsInterfaces(), i = this.parseConstDirectives(), a = this.parseFieldsDefinition();
1585
+ return this.node(e, {
1586
+ kind: X.INTERFACE_TYPE_DEFINITION,
1587
+ description: t,
1588
+ name: n,
1589
+ interfaces: r,
1590
+ directives: i,
1591
+ fields: a
1592
+ });
1593
+ }
1594
+ parseUnionTypeDefinition() {
1595
+ let e = this._lexer.token, t = this.parseDescription();
1596
+ this.expectKeyword("union");
1597
+ let n = this.parseName(), r = this.parseConstDirectives(), i = this.parseUnionMemberTypes();
1598
+ return this.node(e, {
1599
+ kind: X.UNION_TYPE_DEFINITION,
1600
+ description: t,
1601
+ name: n,
1602
+ directives: r,
1603
+ types: i
1604
+ });
1605
+ }
1606
+ parseUnionMemberTypes() {
1607
+ return this.expectOptionalToken(Z.EQUALS) ? this.delimitedMany(Z.PIPE, this.parseNamedType) : [];
1608
+ }
1609
+ parseEnumTypeDefinition() {
1610
+ let e = this._lexer.token, t = this.parseDescription();
1611
+ this.expectKeyword("enum");
1612
+ let n = this.parseName(), r = this.parseConstDirectives(), i = this.parseEnumValuesDefinition();
1613
+ return this.node(e, {
1614
+ kind: X.ENUM_TYPE_DEFINITION,
1615
+ description: t,
1616
+ name: n,
1617
+ directives: r,
1618
+ values: i
1619
+ });
1620
+ }
1621
+ parseEnumValuesDefinition() {
1622
+ return this.optionalMany(Z.BRACE_L, this.parseEnumValueDefinition, Z.BRACE_R);
1623
+ }
1624
+ parseEnumValueDefinition() {
1625
+ let e = this._lexer.token, t = this.parseDescription(), n = this.parseEnumValueName(), r = this.parseConstDirectives();
1626
+ return this.node(e, {
1627
+ kind: X.ENUM_VALUE_DEFINITION,
1628
+ description: t,
1629
+ name: n,
1630
+ directives: r
1631
+ });
1632
+ }
1633
+ parseEnumValueName() {
1634
+ if (this._lexer.token.value === "true" || this._lexer.token.value === "false" || this._lexer.token.value === "null") throw g(this._lexer.source, this._lexer.token.start, `${E(this._lexer.token)} is reserved and cannot be used for an enum value.`);
1635
+ return this.parseName();
1636
+ }
1637
+ parseInputObjectTypeDefinition() {
1638
+ let e = this._lexer.token, t = this.parseDescription();
1639
+ this.expectKeyword("input");
1640
+ let n = this.parseName(), r = this.parseConstDirectives(), i = this.parseInputFieldsDefinition();
1641
+ return this.node(e, {
1642
+ kind: X.INPUT_OBJECT_TYPE_DEFINITION,
1643
+ description: t,
1644
+ name: n,
1645
+ directives: r,
1646
+ fields: i
1647
+ });
1648
+ }
1649
+ parseInputFieldsDefinition() {
1650
+ return this.optionalMany(Z.BRACE_L, this.parseInputValueDef, Z.BRACE_R);
1651
+ }
1652
+ parseTypeSystemExtension() {
1653
+ let e = this._lexer.lookahead();
1654
+ if (e.kind === Z.NAME) switch (e.value) {
1655
+ case "schema": return this.parseSchemaExtension();
1656
+ case "scalar": return this.parseScalarTypeExtension();
1657
+ case "type": return this.parseObjectTypeExtension();
1658
+ case "interface": return this.parseInterfaceTypeExtension();
1659
+ case "union": return this.parseUnionTypeExtension();
1660
+ case "enum": return this.parseEnumTypeExtension();
1661
+ case "input": return this.parseInputObjectTypeExtension();
1662
+ }
1663
+ throw this.unexpected(e);
1664
+ }
1665
+ parseSchemaExtension() {
1666
+ let e = this._lexer.token;
1667
+ this.expectKeyword("extend"), this.expectKeyword("schema");
1668
+ let t = this.parseConstDirectives(), n = this.optionalMany(Z.BRACE_L, this.parseOperationTypeDefinition, Z.BRACE_R);
1669
+ if (t.length === 0 && n.length === 0) throw this.unexpected();
1670
+ return this.node(e, {
1671
+ kind: X.SCHEMA_EXTENSION,
1672
+ directives: t,
1673
+ operationTypes: n
1674
+ });
1675
+ }
1676
+ parseScalarTypeExtension() {
1677
+ let e = this._lexer.token;
1678
+ this.expectKeyword("extend"), this.expectKeyword("scalar");
1679
+ let t = this.parseName(), n = this.parseConstDirectives();
1680
+ if (n.length === 0) throw this.unexpected();
1681
+ return this.node(e, {
1682
+ kind: X.SCALAR_TYPE_EXTENSION,
1683
+ name: t,
1684
+ directives: n
1685
+ });
1686
+ }
1687
+ parseObjectTypeExtension() {
1688
+ let e = this._lexer.token;
1689
+ this.expectKeyword("extend"), this.expectKeyword("type");
1690
+ let t = this.parseName(), n = this.parseImplementsInterfaces(), r = this.parseConstDirectives(), i = this.parseFieldsDefinition();
1691
+ if (n.length === 0 && r.length === 0 && i.length === 0) throw this.unexpected();
1692
+ return this.node(e, {
1693
+ kind: X.OBJECT_TYPE_EXTENSION,
1694
+ name: t,
1695
+ interfaces: n,
1696
+ directives: r,
1697
+ fields: i
1698
+ });
1699
+ }
1700
+ parseInterfaceTypeExtension() {
1701
+ let e = this._lexer.token;
1702
+ this.expectKeyword("extend"), this.expectKeyword("interface");
1703
+ let t = this.parseName(), n = this.parseImplementsInterfaces(), r = this.parseConstDirectives(), i = this.parseFieldsDefinition();
1704
+ if (n.length === 0 && r.length === 0 && i.length === 0) throw this.unexpected();
1705
+ return this.node(e, {
1706
+ kind: X.INTERFACE_TYPE_EXTENSION,
1707
+ name: t,
1708
+ interfaces: n,
1709
+ directives: r,
1710
+ fields: i
1711
+ });
1712
+ }
1713
+ parseUnionTypeExtension() {
1714
+ let e = this._lexer.token;
1715
+ this.expectKeyword("extend"), this.expectKeyword("union");
1716
+ let t = this.parseName(), n = this.parseConstDirectives(), r = this.parseUnionMemberTypes();
1717
+ if (n.length === 0 && r.length === 0) throw this.unexpected();
1718
+ return this.node(e, {
1719
+ kind: X.UNION_TYPE_EXTENSION,
1720
+ name: t,
1721
+ directives: n,
1722
+ types: r
1723
+ });
1724
+ }
1725
+ parseEnumTypeExtension() {
1726
+ let e = this._lexer.token;
1727
+ this.expectKeyword("extend"), this.expectKeyword("enum");
1728
+ let t = this.parseName(), n = this.parseConstDirectives(), r = this.parseEnumValuesDefinition();
1729
+ if (n.length === 0 && r.length === 0) throw this.unexpected();
1730
+ return this.node(e, {
1731
+ kind: X.ENUM_TYPE_EXTENSION,
1732
+ name: t,
1733
+ directives: n,
1734
+ values: r
1735
+ });
1736
+ }
1737
+ parseInputObjectTypeExtension() {
1738
+ let e = this._lexer.token;
1739
+ this.expectKeyword("extend"), this.expectKeyword("input");
1740
+ let t = this.parseName(), n = this.parseConstDirectives(), r = this.parseInputFieldsDefinition();
1741
+ if (n.length === 0 && r.length === 0) throw this.unexpected();
1742
+ return this.node(e, {
1743
+ kind: X.INPUT_OBJECT_TYPE_EXTENSION,
1744
+ name: t,
1745
+ directives: n,
1746
+ fields: r
1747
+ });
1748
+ }
1749
+ parseDirectiveDefinition() {
1750
+ let e = this._lexer.token, t = this.parseDescription();
1751
+ this.expectKeyword("directive"), this.expectToken(Z.AT);
1752
+ let n = this.parseName(), r = this.parseArgumentDefs(), i = this.expectOptionalKeyword("repeatable");
1753
+ this.expectKeyword("on");
1754
+ let a = this.parseDirectiveLocations();
1755
+ return this.node(e, {
1756
+ kind: X.DIRECTIVE_DEFINITION,
1757
+ description: t,
1758
+ name: n,
1759
+ arguments: r,
1760
+ repeatable: i,
1761
+ locations: a
1762
+ });
1763
+ }
1764
+ parseDirectiveLocations() {
1765
+ return this.delimitedMany(Z.PIPE, this.parseDirectiveLocation);
1766
+ }
1767
+ parseDirectiveLocation() {
1768
+ let e = this._lexer.token, t = this.parseName();
1769
+ if (Object.prototype.hasOwnProperty.call(Dt, t.value)) return t;
1770
+ throw this.unexpected(e);
1771
+ }
1772
+ parseSchemaCoordinate() {
1773
+ let e = this._lexer.token, t = this.expectOptionalToken(Z.AT), n = this.parseName(), r;
1774
+ !t && this.expectOptionalToken(Z.DOT) && (r = this.parseName());
1775
+ let i;
1776
+ return (t || r) && this.expectOptionalToken(Z.PAREN_L) && (i = this.parseName(), this.expectToken(Z.COLON), this.expectToken(Z.PAREN_R)), t ? i ? this.node(e, {
1777
+ kind: X.DIRECTIVE_ARGUMENT_COORDINATE,
1778
+ name: n,
1779
+ argumentName: i
1780
+ }) : this.node(e, {
1781
+ kind: X.DIRECTIVE_COORDINATE,
1782
+ name: n
1783
+ }) : r ? i ? this.node(e, {
1784
+ kind: X.ARGUMENT_COORDINATE,
1785
+ name: n,
1786
+ fieldName: r,
1787
+ argumentName: i
1788
+ }) : this.node(e, {
1789
+ kind: X.MEMBER_COORDINATE,
1790
+ name: n,
1791
+ memberName: r
1792
+ }) : this.node(e, {
1793
+ kind: X.TYPE_COORDINATE,
1794
+ name: n
1795
+ });
1796
+ }
1797
+ node(e, t) {
1798
+ return this._options.noLocation !== !0 && (t.loc = new mt(e, this._lexer.lastToken, this._lexer.source)), t;
1799
+ }
1800
+ peek(e) {
1801
+ return this._lexer.token.kind === e;
1802
+ }
1803
+ expectToken(e) {
1804
+ let t = this._lexer.token;
1805
+ if (t.kind === e) return this.advanceLexer(), t;
1806
+ throw g(this._lexer.source, t.start, `Expected ${We(e)}, found ${E(t)}.`);
1807
+ }
1808
+ expectOptionalToken(e) {
1809
+ return this._lexer.token.kind === e ? (this.advanceLexer(), !0) : !1;
1810
+ }
1811
+ expectKeyword(e) {
1812
+ let t = this._lexer.token;
1813
+ if (t.kind === Z.NAME && t.value === e) this.advanceLexer();
1814
+ else throw g(this._lexer.source, t.start, `Expected "${e}", found ${E(t)}.`);
1815
+ }
1816
+ expectOptionalKeyword(e) {
1817
+ let t = this._lexer.token;
1818
+ return t.kind === Z.NAME && t.value === e ? (this.advanceLexer(), !0) : !1;
1819
+ }
1820
+ unexpected(e) {
1821
+ let t = e ?? this._lexer.token;
1822
+ return g(this._lexer.source, t.start, `Unexpected ${E(t)}.`);
1823
+ }
1824
+ any(e, t, n) {
1825
+ this.expectToken(e);
1826
+ let r = [];
1827
+ for (; !this.expectOptionalToken(n);) r.push(t.call(this));
1828
+ return r;
1829
+ }
1830
+ optionalMany(e, t, n) {
1831
+ if (this.expectOptionalToken(e)) {
1832
+ let e = [];
1833
+ do
1834
+ e.push(t.call(this));
1835
+ while (!this.expectOptionalToken(n));
1836
+ return e;
1837
+ }
1838
+ return [];
1839
+ }
1840
+ many(e, t, n) {
1841
+ this.expectToken(e);
1842
+ let r = [];
1843
+ do
1844
+ r.push(t.call(this));
1845
+ while (!this.expectOptionalToken(n));
1846
+ return r;
1847
+ }
1848
+ delimitedMany(e, t) {
1849
+ this.expectOptionalToken(e);
1850
+ let n = [];
1851
+ do
1852
+ n.push(t.call(this));
1853
+ while (this.expectOptionalToken(e));
1854
+ return n;
1855
+ }
1856
+ advanceLexer() {
1857
+ let { maxTokens: e } = this._options, t = this._lexer.advance();
1858
+ if (t.kind !== Z.EOF && (++this._tokenCounter, e !== void 0 && this._tokenCounter > e)) throw g(this._lexer.source, t.start, `Document contains more that ${e} tokens. Parsing aborted.`);
1859
+ }
1860
+ }, jt = Ge, Mt = { allowLegacyFragmentVariables: !0 }, Nt = {
1861
+ parse: Je,
1862
+ astFormat: "graphql",
1863
+ hasPragma: bt,
1864
+ hasIgnorePragma: xt,
1865
+ locStart: K,
1866
+ locEnd: gt
1867
+ }, $ = { graphql: Ct };
1868
+ }))();
1869
+ export { O as default, wt as languages, J as options, Y as parsers, $ as printers };