@stonecrop/graphql-client 0.6.2 → 0.7.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.
@@ -1,27 +1,4 @@
1
- function Lt(e, t) {
2
- for (var n = 0; n < t.length; n++) {
3
- const i = t[n];
4
- if (typeof i != "string" && !Array.isArray(i)) {
5
- for (const r in i)
6
- if (r !== "default" && !(r in e)) {
7
- const s = Object.getOwnPropertyDescriptor(i, r);
8
- s && Object.defineProperty(e, r, s.get ? s : {
9
- enumerable: !0,
10
- get: () => i[r]
11
- });
12
- }
13
- }
14
- }
15
- return Object.freeze(Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }));
16
- }
17
- /*!
18
- * decimal.js v10.4.3
19
- * An arbitrary-precision Decimal type for JavaScript.
20
- * https://github.com/MikeMcl/decimal.js
21
- * Copyright (c) 2022 Michael Mclaughlin <M8ch88l@gmail.com>
22
- * MIT Licence
23
- */
24
- var le = 9e15, ie = 1e9, je = "0123456789abcdef", De = "2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058", Se = "3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789", $e = {
1
+ var ee = 9e15, z = 1e9, be = "0123456789abcdef", Ne = "2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058", Te = "3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789", Le = {
25
2
  // These values must be integers within the stated ranges (inclusive).
26
3
  // Most of these values can be changed at run-time using the `Decimal.config` method.
27
4
  // The maximum number of significant digits of the result of a calculation or base conversion.
@@ -70,30 +47,30 @@ var le = 9e15, ie = 1e9, je = "0123456789abcdef", De = "2.3025850929940456840179
70
47
  // 0 to EXP_LIMIT
71
48
  // The minimum exponent value, beneath which underflow to zero occurs.
72
49
  // JavaScript numbers: -324 (5e-324)
73
- minE: -le,
50
+ minE: -ee,
74
51
  // -1 to -EXP_LIMIT
75
52
  // The maximum exponent value, above which overflow to Infinity occurs.
76
53
  // JavaScript numbers: 308 (1.7976931348623157e+308)
77
- maxE: le,
54
+ maxE: ee,
78
55
  // 1 to EXP_LIMIT
79
56
  // Whether to use cryptographically-secure random number generation, if available.
80
57
  crypto: !1
81
58
  // true/false
82
- }, ht, W, I = !0, ke = "[DecimalError] ", ne = ke + "Invalid argument: ", dt = ke + "Precision limit exceeded", pt = ke + "crypto unavailable", mt = "[object Decimal]", j = Math.floor, P = Math.pow, Ft = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i, Pt = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i, Mt = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i, gt = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i, Q = 1e7, T = 7, Bt = 9007199254740991, Ut = De.length - 1, He = Se.length - 1, g = { toStringTag: mt };
83
- g.absoluteValue = g.abs = function() {
59
+ }, ct, G, I = !0, ve = "[DecimalError] ", Q = ve + "Invalid argument: ", ut = ve + "Precision limit exceeded", lt = ve + "crypto unavailable", ft = "[object Decimal]", F = Math.floor, k = Math.pow, bt = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i, Lt = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i, Ft = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i, ht = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i, V = 1e7, v = 7, Mt = 9007199254740991, Pt = Ne.length - 1, Fe = Te.length - 1, p = { toStringTag: ft };
60
+ p.absoluteValue = p.abs = function() {
84
61
  var e = new this.constructor(this);
85
- return e.s < 0 && (e.s = 1), v(e);
62
+ return e.s < 0 && (e.s = 1), T(e);
86
63
  };
87
- g.ceil = function() {
88
- return v(new this.constructor(this), this.e + 1, 2);
64
+ p.ceil = function() {
65
+ return T(new this.constructor(this), this.e + 1, 2);
89
66
  };
90
- g.clampedTo = g.clamp = function(e, t) {
67
+ p.clampedTo = p.clamp = function(e, t) {
91
68
  var n, i = this, r = i.constructor;
92
69
  if (e = new r(e), t = new r(t), !e.s || !t.s) return new r(NaN);
93
- if (e.gt(t)) throw Error(ne + t);
70
+ if (e.gt(t)) throw Error(Q + t);
94
71
  return n = i.cmp(e), n < 0 ? e : i.cmp(t) > 0 ? t : new r(i);
95
72
  };
96
- g.comparedTo = g.cmp = function(e) {
73
+ p.comparedTo = p.cmp = function(e) {
97
74
  var t, n, i, r, s = this, o = s.d, a = (e = new s.constructor(e)).d, u = s.s, c = e.s;
98
75
  if (!o || !a)
99
76
  return !u || !c ? NaN : u !== c ? u : o === a ? 0 : !o ^ u < 0 ? 1 : -1;
@@ -104,143 +81,143 @@ g.comparedTo = g.cmp = function(e) {
104
81
  if (o[t] !== a[t]) return o[t] > a[t] ^ u < 0 ? 1 : -1;
105
82
  return i === r ? 0 : i > r ^ u < 0 ? 1 : -1;
106
83
  };
107
- g.cosine = g.cos = function() {
84
+ p.cosine = p.cos = function() {
108
85
  var e, t, n = this, i = n.constructor;
109
- return n.d ? n.d[0] ? (e = i.precision, t = i.rounding, i.precision = e + Math.max(n.e, n.sd()) + T, i.rounding = 1, n = qt(i, vt(i, n)), i.precision = e, i.rounding = t, v(W == 2 || W == 3 ? n.neg() : n, e, t, !0)) : new i(1) : new i(NaN);
86
+ return n.d ? n.d[0] ? (e = i.precision, t = i.rounding, i.precision = e + Math.max(n.e, n.sd()) + v, i.rounding = 1, n = qt(i, Et(i, n)), i.precision = e, i.rounding = t, T(G == 2 || G == 3 ? n.neg() : n, e, t, !0)) : new i(1) : new i(NaN);
110
87
  };
111
- g.cubeRoot = g.cbrt = function() {
88
+ p.cubeRoot = p.cbrt = function() {
112
89
  var e, t, n, i, r, s, o, a, u, c, l = this, f = l.constructor;
113
90
  if (!l.isFinite() || l.isZero()) return new f(l);
114
- for (I = !1, s = l.s * P(l.s * l, 1 / 3), !s || Math.abs(s) == 1 / 0 ? (n = U(l.d), e = l.e, (s = (e - n.length + 1) % 3) && (n += s == 1 || s == -2 ? "0" : "00"), s = P(n, 1 / 3), e = j((e + 1) / 3) - (e % 3 == (e < 0 ? -1 : 2)), s == 1 / 0 ? n = "5e" + e : (n = s.toExponential(), n = n.slice(0, n.indexOf("e") + 1) + e), i = new f(n), i.s = l.s) : i = new f(s.toString()), o = (e = f.precision) + 3; ; )
115
- if (a = i, u = a.times(a).times(a), c = u.plus(l), i = R(c.plus(l).times(a), c.plus(u), o + 2, 1), U(a.d).slice(0, o) === (n = U(i.d)).slice(0, o))
91
+ for (I = !1, s = l.s * k(l.s * l, 1 / 3), !s || Math.abs(s) == 1 / 0 ? (n = b(l.d), e = l.e, (s = (e - n.length + 1) % 3) && (n += s == 1 || s == -2 ? "0" : "00"), s = k(n, 1 / 3), e = F((e + 1) / 3) - (e % 3 == (e < 0 ? -1 : 2)), s == 1 / 0 ? n = "5e" + e : (n = s.toExponential(), n = n.slice(0, n.indexOf("e") + 1) + e), i = new f(n), i.s = l.s) : i = new f(s.toString()), o = (e = f.precision) + 3; ; )
92
+ if (a = i, u = a.times(a).times(a), c = u.plus(l), i = x(c.plus(l).times(a), c.plus(u), o + 2, 1), b(a.d).slice(0, o) === (n = b(i.d)).slice(0, o))
116
93
  if (n = n.slice(o - 3, o + 1), n == "9999" || !r && n == "4999") {
117
- if (!r && (v(a, e + 1, 0), a.times(a).times(a).eq(l))) {
94
+ if (!r && (T(a, e + 1, 0), a.times(a).times(a).eq(l))) {
118
95
  i = a;
119
96
  break;
120
97
  }
121
98
  o += 4, r = 1;
122
99
  } else {
123
- (!+n || !+n.slice(1) && n.charAt(0) == "5") && (v(i, e + 1, 1), t = !i.times(i).times(i).eq(l));
100
+ (!+n || !+n.slice(1) && n.charAt(0) == "5") && (T(i, e + 1, 1), t = !i.times(i).times(i).eq(l));
124
101
  break;
125
102
  }
126
- return I = !0, v(i, e, f.rounding, t);
103
+ return I = !0, T(i, e, f.rounding, t);
127
104
  };
128
- g.decimalPlaces = g.dp = function() {
105
+ p.decimalPlaces = p.dp = function() {
129
106
  var e, t = this.d, n = NaN;
130
107
  if (t) {
131
- if (e = t.length - 1, n = (e - j(this.e / T)) * T, e = t[e], e) for (; e % 10 == 0; e /= 10) n--;
108
+ if (e = t.length - 1, n = (e - F(this.e / v)) * v, e = t[e], e) for (; e % 10 == 0; e /= 10) n--;
132
109
  n < 0 && (n = 0);
133
110
  }
134
111
  return n;
135
112
  };
136
- g.dividedBy = g.div = function(e) {
137
- return R(this, new this.constructor(e));
113
+ p.dividedBy = p.div = function(e) {
114
+ return x(this, new this.constructor(e));
138
115
  };
139
- g.dividedToIntegerBy = g.divToInt = function(e) {
116
+ p.dividedToIntegerBy = p.divToInt = function(e) {
140
117
  var t = this, n = t.constructor;
141
- return v(R(t, new n(e), 0, 1, 1), n.precision, n.rounding);
118
+ return T(x(t, new n(e), 0, 1, 1), n.precision, n.rounding);
142
119
  };
143
- g.equals = g.eq = function(e) {
120
+ p.equals = p.eq = function(e) {
144
121
  return this.cmp(e) === 0;
145
122
  };
146
- g.floor = function() {
147
- return v(new this.constructor(this), this.e + 1, 3);
123
+ p.floor = function() {
124
+ return T(new this.constructor(this), this.e + 1, 3);
148
125
  };
149
- g.greaterThan = g.gt = function(e) {
126
+ p.greaterThan = p.gt = function(e) {
150
127
  return this.cmp(e) > 0;
151
128
  };
152
- g.greaterThanOrEqualTo = g.gte = function(e) {
129
+ p.greaterThanOrEqualTo = p.gte = function(e) {
153
130
  var t = this.cmp(e);
154
131
  return t == 1 || t === 0;
155
132
  };
156
- g.hyperbolicCosine = g.cosh = function() {
133
+ p.hyperbolicCosine = p.cosh = function() {
157
134
  var e, t, n, i, r, s = this, o = s.constructor, a = new o(1);
158
135
  if (!s.isFinite()) return new o(s.s ? 1 / 0 : NaN);
159
136
  if (s.isZero()) return a;
160
- n = o.precision, i = o.rounding, o.precision = n + Math.max(s.e, s.sd()) + 4, o.rounding = 1, r = s.d.length, r < 32 ? (e = Math.ceil(r / 3), t = (1 / Le(4, e)).toString()) : (e = 16, t = "2.3283064365386962890625e-10"), s = he(o, 1, s.times(t), new o(1), !0);
137
+ n = o.precision, i = o.rounding, o.precision = n + Math.max(s.e, s.sd()) + 4, o.rounding = 1, r = s.d.length, r < 32 ? (e = Math.ceil(r / 3), t = (1 / Oe(4, e)).toString()) : (e = 16, t = "2.3283064365386962890625e-10"), s = ne(o, 1, s.times(t), new o(1), !0);
161
138
  for (var u, c = e, l = new o(8); c--; )
162
139
  u = s.times(s), s = a.minus(u.times(l.minus(u.times(l))));
163
- return v(s, o.precision = n, o.rounding = i, !0);
140
+ return T(s, o.precision = n, o.rounding = i, !0);
164
141
  };
165
- g.hyperbolicSine = g.sinh = function() {
142
+ p.hyperbolicSine = p.sinh = function() {
166
143
  var e, t, n, i, r = this, s = r.constructor;
167
144
  if (!r.isFinite() || r.isZero()) return new s(r);
168
145
  if (t = s.precision, n = s.rounding, s.precision = t + Math.max(r.e, r.sd()) + 4, s.rounding = 1, i = r.d.length, i < 3)
169
- r = he(s, 2, r, r, !0);
146
+ r = ne(s, 2, r, r, !0);
170
147
  else {
171
- e = 1.4 * Math.sqrt(i), e = e > 16 ? 16 : e | 0, r = r.times(1 / Le(5, e)), r = he(s, 2, r, r, !0);
148
+ e = 1.4 * Math.sqrt(i), e = e > 16 ? 16 : e | 0, r = r.times(1 / Oe(5, e)), r = ne(s, 2, r, r, !0);
172
149
  for (var o, a = new s(5), u = new s(16), c = new s(20); e--; )
173
150
  o = r.times(r), r = r.times(a.plus(o.times(u.times(o).plus(c))));
174
151
  }
175
- return s.precision = t, s.rounding = n, v(r, t, n, !0);
152
+ return s.precision = t, s.rounding = n, T(r, t, n, !0);
176
153
  };
177
- g.hyperbolicTangent = g.tanh = function() {
154
+ p.hyperbolicTangent = p.tanh = function() {
178
155
  var e, t, n = this, i = n.constructor;
179
- return n.isFinite() ? n.isZero() ? new i(n) : (e = i.precision, t = i.rounding, i.precision = e + 7, i.rounding = 1, R(n.sinh(), n.cosh(), i.precision = e, i.rounding = t)) : new i(n.s);
156
+ return n.isFinite() ? n.isZero() ? new i(n) : (e = i.precision, t = i.rounding, i.precision = e + 7, i.rounding = 1, x(n.sinh(), n.cosh(), i.precision = e, i.rounding = t)) : new i(n.s);
180
157
  };
181
- g.inverseCosine = g.acos = function() {
182
- var e, t = this, n = t.constructor, i = t.abs().cmp(1), r = n.precision, s = n.rounding;
183
- return i !== -1 ? i === 0 ? t.isNeg() ? X(n, r, s) : new n(0) : new n(NaN) : t.isZero() ? X(n, r + 4, s).times(0.5) : (n.precision = r + 6, n.rounding = 1, t = t.asin(), e = X(n, r + 4, s).times(0.5), n.precision = r, n.rounding = s, e.minus(t));
158
+ p.inverseCosine = p.acos = function() {
159
+ var e = this, t = e.constructor, n = e.abs().cmp(1), i = t.precision, r = t.rounding;
160
+ return n !== -1 ? n === 0 ? e.isNeg() ? j(t, i, r) : new t(0) : new t(NaN) : e.isZero() ? j(t, i + 4, r).times(0.5) : (t.precision = i + 6, t.rounding = 1, e = new t(1).minus(e).div(e.plus(1)).sqrt().atan(), t.precision = i, t.rounding = r, e.times(2));
184
161
  };
185
- g.inverseHyperbolicCosine = g.acosh = function() {
162
+ p.inverseHyperbolicCosine = p.acosh = function() {
186
163
  var e, t, n = this, i = n.constructor;
187
164
  return n.lte(1) ? new i(n.eq(1) ? 0 : NaN) : n.isFinite() ? (e = i.precision, t = i.rounding, i.precision = e + Math.max(Math.abs(n.e), n.sd()) + 4, i.rounding = 1, I = !1, n = n.times(n).minus(1).sqrt().plus(n), I = !0, i.precision = e, i.rounding = t, n.ln()) : new i(n);
188
165
  };
189
- g.inverseHyperbolicSine = g.asinh = function() {
166
+ p.inverseHyperbolicSine = p.asinh = function() {
190
167
  var e, t, n = this, i = n.constructor;
191
168
  return !n.isFinite() || n.isZero() ? new i(n) : (e = i.precision, t = i.rounding, i.precision = e + 2 * Math.max(Math.abs(n.e), n.sd()) + 6, i.rounding = 1, I = !1, n = n.times(n).plus(1).sqrt().plus(n), I = !0, i.precision = e, i.rounding = t, n.ln());
192
169
  };
193
- g.inverseHyperbolicTangent = g.atanh = function() {
170
+ p.inverseHyperbolicTangent = p.atanh = function() {
194
171
  var e, t, n, i, r = this, s = r.constructor;
195
- return r.isFinite() ? r.e >= 0 ? new s(r.abs().eq(1) ? r.s / 0 : r.isZero() ? r : NaN) : (e = s.precision, t = s.rounding, i = r.sd(), Math.max(i, e) < 2 * -r.e - 1 ? v(new s(r), e, t, !0) : (s.precision = n = i - r.e, r = R(r.plus(1), new s(1).minus(r), n + e, 1), s.precision = e + 4, s.rounding = 1, r = r.ln(), s.precision = e, s.rounding = t, r.times(0.5))) : new s(NaN);
172
+ return r.isFinite() ? r.e >= 0 ? new s(r.abs().eq(1) ? r.s / 0 : r.isZero() ? r : NaN) : (e = s.precision, t = s.rounding, i = r.sd(), Math.max(i, e) < 2 * -r.e - 1 ? T(new s(r), e, t, !0) : (s.precision = n = i - r.e, r = x(r.plus(1), new s(1).minus(r), n + e, 1), s.precision = e + 4, s.rounding = 1, r = r.ln(), s.precision = e, s.rounding = t, r.times(0.5))) : new s(NaN);
196
173
  };
197
- g.inverseSine = g.asin = function() {
174
+ p.inverseSine = p.asin = function() {
198
175
  var e, t, n, i, r = this, s = r.constructor;
199
- return r.isZero() ? new s(r) : (t = r.abs().cmp(1), n = s.precision, i = s.rounding, t !== -1 ? t === 0 ? (e = X(s, n + 4, i).times(0.5), e.s = r.s, e) : new s(NaN) : (s.precision = n + 6, s.rounding = 1, r = r.div(new s(1).minus(r.times(r)).sqrt().plus(1)).atan(), s.precision = n, s.rounding = i, r.times(2)));
176
+ return r.isZero() ? new s(r) : (t = r.abs().cmp(1), n = s.precision, i = s.rounding, t !== -1 ? t === 0 ? (e = j(s, n + 4, i).times(0.5), e.s = r.s, e) : new s(NaN) : (s.precision = n + 6, s.rounding = 1, r = r.div(new s(1).minus(r.times(r)).sqrt().plus(1)).atan(), s.precision = n, s.rounding = i, r.times(2)));
200
177
  };
201
- g.inverseTangent = g.atan = function() {
202
- var e, t, n, i, r, s, o, a, u, c = this, l = c.constructor, f = l.precision, d = l.rounding;
178
+ p.inverseTangent = p.atan = function() {
179
+ var e, t, n, i, r, s, o, a, u, c = this, l = c.constructor, f = l.precision, h = l.rounding;
203
180
  if (c.isFinite()) {
204
181
  if (c.isZero())
205
182
  return new l(c);
206
- if (c.abs().eq(1) && f + 4 <= He)
207
- return o = X(l, f + 4, d).times(0.25), o.s = c.s, o;
183
+ if (c.abs().eq(1) && f + 4 <= Fe)
184
+ return o = j(l, f + 4, h).times(0.25), o.s = c.s, o;
208
185
  } else {
209
186
  if (!c.s) return new l(NaN);
210
- if (f + 4 <= He)
211
- return o = X(l, f + 4, d).times(0.5), o.s = c.s, o;
187
+ if (f + 4 <= Fe)
188
+ return o = j(l, f + 4, h).times(0.5), o.s = c.s, o;
212
189
  }
213
- for (l.precision = a = f + 10, l.rounding = 1, n = Math.min(28, a / T + 2 | 0), e = n; e; --e) c = c.div(c.times(c).plus(1).sqrt().plus(1));
214
- for (I = !1, t = Math.ceil(a / T), i = 1, u = c.times(c), o = new l(c), r = c; e !== -1; )
190
+ for (l.precision = a = f + 10, l.rounding = 1, n = Math.min(28, a / v + 2 | 0), e = n; e; --e) c = c.div(c.times(c).plus(1).sqrt().plus(1));
191
+ for (I = !1, t = Math.ceil(a / v), i = 1, u = c.times(c), o = new l(c), r = c; e !== -1; )
215
192
  if (r = r.times(u), s = o.minus(r.div(i += 2)), r = r.times(u), o = s.plus(r.div(i += 2)), o.d[t] !== void 0) for (e = t; o.d[e] === s.d[e] && e--; ) ;
216
- return n && (o = o.times(2 << n - 1)), I = !0, v(o, l.precision = f, l.rounding = d, !0);
193
+ return n && (o = o.times(2 << n - 1)), I = !0, T(o, l.precision = f, l.rounding = h, !0);
217
194
  };
218
- g.isFinite = function() {
195
+ p.isFinite = function() {
219
196
  return !!this.d;
220
197
  };
221
- g.isInteger = g.isInt = function() {
222
- return !!this.d && j(this.e / T) > this.d.length - 2;
198
+ p.isInteger = p.isInt = function() {
199
+ return !!this.d && F(this.e / v) > this.d.length - 2;
223
200
  };
224
- g.isNaN = function() {
201
+ p.isNaN = function() {
225
202
  return !this.s;
226
203
  };
227
- g.isNegative = g.isNeg = function() {
204
+ p.isNegative = p.isNeg = function() {
228
205
  return this.s < 0;
229
206
  };
230
- g.isPositive = g.isPos = function() {
207
+ p.isPositive = p.isPos = function() {
231
208
  return this.s > 0;
232
209
  };
233
- g.isZero = function() {
210
+ p.isZero = function() {
234
211
  return !!this.d && this.d[0] === 0;
235
212
  };
236
- g.lessThan = g.lt = function(e) {
213
+ p.lessThan = p.lt = function(e) {
237
214
  return this.cmp(e) < 0;
238
215
  };
239
- g.lessThanOrEqualTo = g.lte = function(e) {
216
+ p.lessThanOrEqualTo = p.lte = function(e) {
240
217
  return this.cmp(e) < 1;
241
218
  };
242
- g.logarithm = g.log = function(e) {
243
- var t, n, i, r, s, o, a, u, c = this, l = c.constructor, f = l.precision, d = l.rounding, y = 5;
219
+ p.logarithm = p.log = function(e) {
220
+ var t, n, i, r, s, o, a, u, c = this, l = c.constructor, f = l.precision, h = l.rounding, m = 5;
244
221
  if (e == null)
245
222
  e = new l(10), t = !0;
246
223
  else {
@@ -256,235 +233,235 @@ g.logarithm = g.log = function(e) {
256
233
  for (r = n[0]; r % 10 === 0; ) r /= 10;
257
234
  s = r !== 1;
258
235
  }
259
- if (I = !1, a = f + y, o = te(c, a), i = t ? xe(l, a + 10) : te(e, a), u = R(o, i, a, 1), ye(u.d, r = f, d))
236
+ if (I = !1, a = f + m, o = J(c, a), i = t ? we(l, a + 10) : J(e, a), u = x(o, i, a, 1), ae(u.d, r = f, h))
260
237
  do
261
- if (a += 10, o = te(c, a), i = t ? xe(l, a + 10) : te(e, a), u = R(o, i, a, 1), !s) {
262
- +U(u.d).slice(r + 1, r + 15) + 1 == 1e14 && (u = v(u, f + 1, 0));
238
+ if (a += 10, o = J(c, a), i = t ? we(l, a + 10) : J(e, a), u = x(o, i, a, 1), !s) {
239
+ +b(u.d).slice(r + 1, r + 15) + 1 == 1e14 && (u = T(u, f + 1, 0));
263
240
  break;
264
241
  }
265
- while (ye(u.d, r += 10, d));
266
- return I = !0, v(u, f, d);
242
+ while (ae(u.d, r += 10, h));
243
+ return I = !0, T(u, f, h);
267
244
  };
268
- g.minus = g.sub = function(e) {
269
- var t, n, i, r, s, o, a, u, c, l, f, d, y = this, N = y.constructor;
270
- if (e = new N(e), !y.d || !e.d)
271
- return !y.s || !e.s ? e = new N(NaN) : y.d ? e.s = -e.s : e = new N(e.d || y.s !== e.s ? y : NaN), e;
272
- if (y.s != e.s)
273
- return e.s = -e.s, y.plus(e);
274
- if (c = y.d, d = e.d, a = N.precision, u = N.rounding, !c[0] || !d[0]) {
275
- if (d[0]) e.s = -e.s;
276
- else if (c[0]) e = new N(y);
245
+ p.minus = p.sub = function(e) {
246
+ var t, n, i, r, s, o, a, u, c, l, f, h, m = this, N = m.constructor;
247
+ if (e = new N(e), !m.d || !e.d)
248
+ return !m.s || !e.s ? e = new N(NaN) : m.d ? e.s = -e.s : e = new N(e.d || m.s !== e.s ? m : NaN), e;
249
+ if (m.s != e.s)
250
+ return e.s = -e.s, m.plus(e);
251
+ if (c = m.d, h = e.d, a = N.precision, u = N.rounding, !c[0] || !h[0]) {
252
+ if (h[0]) e.s = -e.s;
253
+ else if (c[0]) e = new N(m);
277
254
  else return new N(u === 3 ? -0 : 0);
278
- return I ? v(e, a, u) : e;
255
+ return I ? T(e, a, u) : e;
279
256
  }
280
- if (n = j(e.e / T), l = j(y.e / T), c = c.slice(), s = l - n, s) {
281
- for (f = s < 0, f ? (t = c, s = -s, o = d.length) : (t = d, n = l, o = c.length), i = Math.max(Math.ceil(a / T), o) + 2, s > i && (s = i, t.length = 1), t.reverse(), i = s; i--; ) t.push(0);
257
+ if (n = F(e.e / v), l = F(m.e / v), c = c.slice(), s = l - n, s) {
258
+ for (f = s < 0, f ? (t = c, s = -s, o = h.length) : (t = h, n = l, o = c.length), i = Math.max(Math.ceil(a / v), o) + 2, s > i && (s = i, t.length = 1), t.reverse(), i = s; i--; ) t.push(0);
282
259
  t.reverse();
283
260
  } else {
284
- for (i = c.length, o = d.length, f = i < o, f && (o = i), i = 0; i < o; i++)
285
- if (c[i] != d[i]) {
286
- f = c[i] < d[i];
261
+ for (i = c.length, o = h.length, f = i < o, f && (o = i), i = 0; i < o; i++)
262
+ if (c[i] != h[i]) {
263
+ f = c[i] < h[i];
287
264
  break;
288
265
  }
289
266
  s = 0;
290
267
  }
291
- for (f && (t = c, c = d, d = t, e.s = -e.s), o = c.length, i = d.length - o; i > 0; --i) c[o++] = 0;
292
- for (i = d.length; i > s; ) {
293
- if (c[--i] < d[i]) {
294
- for (r = i; r && c[--r] === 0; ) c[r] = Q - 1;
295
- --c[r], c[i] += Q;
268
+ for (f && (t = c, c = h, h = t, e.s = -e.s), o = c.length, i = h.length - o; i > 0; --i) c[o++] = 0;
269
+ for (i = h.length; i > s; ) {
270
+ if (c[--i] < h[i]) {
271
+ for (r = i; r && c[--r] === 0; ) c[r] = V - 1;
272
+ --c[r], c[i] += V;
296
273
  }
297
- c[i] -= d[i];
274
+ c[i] -= h[i];
298
275
  }
299
276
  for (; c[--o] === 0; ) c.pop();
300
277
  for (; c[0] === 0; c.shift()) --n;
301
- return c[0] ? (e.d = c, e.e = Re(c, n), I ? v(e, a, u) : e) : new N(u === 3 ? -0 : 0);
278
+ return c[0] ? (e.d = c, e.e = Ie(c, n), I ? T(e, a, u) : e) : new N(u === 3 ? -0 : 0);
302
279
  };
303
- g.modulo = g.mod = function(e) {
280
+ p.modulo = p.mod = function(e) {
304
281
  var t, n = this, i = n.constructor;
305
- return e = new i(e), !n.d || !e.s || e.d && !e.d[0] ? new i(NaN) : !e.d || n.d && !n.d[0] ? v(new i(n), i.precision, i.rounding) : (I = !1, i.modulo == 9 ? (t = R(n, e.abs(), 0, 3, 1), t.s *= e.s) : t = R(n, e, 0, i.modulo, 1), t = t.times(e), I = !0, n.minus(t));
282
+ return e = new i(e), !n.d || !e.s || e.d && !e.d[0] ? new i(NaN) : !e.d || n.d && !n.d[0] ? T(new i(n), i.precision, i.rounding) : (I = !1, i.modulo == 9 ? (t = x(n, e.abs(), 0, 3, 1), t.s *= e.s) : t = x(n, e, 0, i.modulo, 1), t = t.times(e), I = !0, n.minus(t));
306
283
  };
307
- g.naturalExponential = g.exp = function() {
308
- return Ge(this);
284
+ p.naturalExponential = p.exp = function() {
285
+ return Me(this);
309
286
  };
310
- g.naturalLogarithm = g.ln = function() {
311
- return te(this);
287
+ p.naturalLogarithm = p.ln = function() {
288
+ return J(this);
312
289
  };
313
- g.negated = g.neg = function() {
290
+ p.negated = p.neg = function() {
314
291
  var e = new this.constructor(this);
315
- return e.s = -e.s, v(e);
292
+ return e.s = -e.s, T(e);
316
293
  };
317
- g.plus = g.add = function(e) {
318
- var t, n, i, r, s, o, a, u, c, l, f = this, d = f.constructor;
319
- if (e = new d(e), !f.d || !e.d)
320
- return !f.s || !e.s ? e = new d(NaN) : f.d || (e = new d(e.d || f.s === e.s ? f : NaN)), e;
294
+ p.plus = p.add = function(e) {
295
+ var t, n, i, r, s, o, a, u, c, l, f = this, h = f.constructor;
296
+ if (e = new h(e), !f.d || !e.d)
297
+ return !f.s || !e.s ? e = new h(NaN) : f.d || (e = new h(e.d || f.s === e.s ? f : NaN)), e;
321
298
  if (f.s != e.s)
322
299
  return e.s = -e.s, f.minus(e);
323
- if (c = f.d, l = e.d, a = d.precision, u = d.rounding, !c[0] || !l[0])
324
- return l[0] || (e = new d(f)), I ? v(e, a, u) : e;
325
- if (s = j(f.e / T), i = j(e.e / T), c = c.slice(), r = s - i, r) {
326
- for (r < 0 ? (n = c, r = -r, o = l.length) : (n = l, i = s, o = c.length), s = Math.ceil(a / T), o = s > o ? s + 1 : o + 1, r > o && (r = o, n.length = 1), n.reverse(); r--; ) n.push(0);
300
+ if (c = f.d, l = e.d, a = h.precision, u = h.rounding, !c[0] || !l[0])
301
+ return l[0] || (e = new h(f)), I ? T(e, a, u) : e;
302
+ if (s = F(f.e / v), i = F(e.e / v), c = c.slice(), r = s - i, r) {
303
+ for (r < 0 ? (n = c, r = -r, o = l.length) : (n = l, i = s, o = c.length), s = Math.ceil(a / v), o = s > o ? s + 1 : o + 1, r > o && (r = o, n.length = 1), n.reverse(); r--; ) n.push(0);
327
304
  n.reverse();
328
305
  }
329
306
  for (o = c.length, r = l.length, o - r < 0 && (r = o, n = l, l = c, c = n), t = 0; r; )
330
- t = (c[--r] = c[r] + l[r] + t) / Q | 0, c[r] %= Q;
307
+ t = (c[--r] = c[r] + l[r] + t) / V | 0, c[r] %= V;
331
308
  for (t && (c.unshift(t), ++i), o = c.length; c[--o] == 0; ) c.pop();
332
- return e.d = c, e.e = Re(c, i), I ? v(e, a, u) : e;
309
+ return e.d = c, e.e = Ie(c, i), I ? T(e, a, u) : e;
333
310
  };
334
- g.precision = g.sd = function(e) {
311
+ p.precision = p.sd = function(e) {
335
312
  var t, n = this;
336
- if (e !== void 0 && e !== !!e && e !== 1 && e !== 0) throw Error(ne + e);
337
- return n.d ? (t = Et(n.d), e && n.e + 1 > t && (t = n.e + 1)) : t = NaN, t;
313
+ if (e !== void 0 && e !== !!e && e !== 1 && e !== 0) throw Error(Q + e);
314
+ return n.d ? (t = dt(n.d), e && n.e + 1 > t && (t = n.e + 1)) : t = NaN, t;
338
315
  };
339
- g.round = function() {
316
+ p.round = function() {
340
317
  var e = this, t = e.constructor;
341
- return v(new t(e), e.e + 1, t.rounding);
318
+ return T(new t(e), e.e + 1, t.rounding);
342
319
  };
343
- g.sine = g.sin = function() {
320
+ p.sine = p.sin = function() {
344
321
  var e, t, n = this, i = n.constructor;
345
- return n.isFinite() ? n.isZero() ? new i(n) : (e = i.precision, t = i.rounding, i.precision = e + Math.max(n.e, n.sd()) + T, i.rounding = 1, n = jt(i, vt(i, n)), i.precision = e, i.rounding = t, v(W > 2 ? n.neg() : n, e, t, !0)) : new i(NaN);
322
+ return n.isFinite() ? n.isZero() ? new i(n) : (e = i.precision, t = i.rounding, i.precision = e + Math.max(n.e, n.sd()) + v, i.rounding = 1, n = Ut(i, Et(i, n)), i.precision = e, i.rounding = t, T(G > 2 ? n.neg() : n, e, t, !0)) : new i(NaN);
346
323
  };
347
- g.squareRoot = g.sqrt = function() {
324
+ p.squareRoot = p.sqrt = function() {
348
325
  var e, t, n, i, r, s, o = this, a = o.d, u = o.e, c = o.s, l = o.constructor;
349
326
  if (c !== 1 || !a || !a[0])
350
327
  return new l(!c || c < 0 && (!a || a[0]) ? NaN : a ? o : 1 / 0);
351
- for (I = !1, c = Math.sqrt(+o), c == 0 || c == 1 / 0 ? (t = U(a), (t.length + u) % 2 == 0 && (t += "0"), c = Math.sqrt(t), u = j((u + 1) / 2) - (u < 0 || u % 2), c == 1 / 0 ? t = "5e" + u : (t = c.toExponential(), t = t.slice(0, t.indexOf("e") + 1) + u), i = new l(t)) : i = new l(c.toString()), n = (u = l.precision) + 3; ; )
352
- if (s = i, i = s.plus(R(o, s, n + 2, 1)).times(0.5), U(s.d).slice(0, n) === (t = U(i.d)).slice(0, n))
328
+ for (I = !1, c = Math.sqrt(+o), c == 0 || c == 1 / 0 ? (t = b(a), (t.length + u) % 2 == 0 && (t += "0"), c = Math.sqrt(t), u = F((u + 1) / 2) - (u < 0 || u % 2), c == 1 / 0 ? t = "5e" + u : (t = c.toExponential(), t = t.slice(0, t.indexOf("e") + 1) + u), i = new l(t)) : i = new l(c.toString()), n = (u = l.precision) + 3; ; )
329
+ if (s = i, i = s.plus(x(o, s, n + 2, 1)).times(0.5), b(s.d).slice(0, n) === (t = b(i.d)).slice(0, n))
353
330
  if (t = t.slice(n - 3, n + 1), t == "9999" || !r && t == "4999") {
354
- if (!r && (v(s, u + 1, 0), s.times(s).eq(o))) {
331
+ if (!r && (T(s, u + 1, 0), s.times(s).eq(o))) {
355
332
  i = s;
356
333
  break;
357
334
  }
358
335
  n += 4, r = 1;
359
336
  } else {
360
- (!+t || !+t.slice(1) && t.charAt(0) == "5") && (v(i, u + 1, 1), e = !i.times(i).eq(o));
337
+ (!+t || !+t.slice(1) && t.charAt(0) == "5") && (T(i, u + 1, 1), e = !i.times(i).eq(o));
361
338
  break;
362
339
  }
363
- return I = !0, v(i, u, l.rounding, e);
340
+ return I = !0, T(i, u, l.rounding, e);
364
341
  };
365
- g.tangent = g.tan = function() {
342
+ p.tangent = p.tan = function() {
366
343
  var e, t, n = this, i = n.constructor;
367
- return n.isFinite() ? n.isZero() ? new i(n) : (e = i.precision, t = i.rounding, i.precision = e + 10, i.rounding = 1, n = n.sin(), n.s = 1, n = R(n, new i(1).minus(n.times(n)).sqrt(), e + 10, 0), i.precision = e, i.rounding = t, v(W == 2 || W == 4 ? n.neg() : n, e, t, !0)) : new i(NaN);
344
+ return n.isFinite() ? n.isZero() ? new i(n) : (e = i.precision, t = i.rounding, i.precision = e + 10, i.rounding = 1, n = n.sin(), n.s = 1, n = x(n, new i(1).minus(n.times(n)).sqrt(), e + 10, 0), i.precision = e, i.rounding = t, T(G == 2 || G == 4 ? n.neg() : n, e, t, !0)) : new i(NaN);
368
345
  };
369
- g.times = g.mul = function(e) {
370
- var t, n, i, r, s, o, a, u, c, l = this, f = l.constructor, d = l.d, y = (e = new f(e)).d;
371
- if (e.s *= l.s, !d || !d[0] || !y || !y[0])
372
- return new f(!e.s || d && !d[0] && !y || y && !y[0] && !d ? NaN : !d || !y ? e.s / 0 : e.s * 0);
373
- for (n = j(l.e / T) + j(e.e / T), u = d.length, c = y.length, u < c && (s = d, d = y, y = s, o = u, u = c, c = o), s = [], o = u + c, i = o; i--; ) s.push(0);
346
+ p.times = p.mul = function(e) {
347
+ var t, n, i, r, s, o, a, u, c, l = this, f = l.constructor, h = l.d, m = (e = new f(e)).d;
348
+ if (e.s *= l.s, !h || !h[0] || !m || !m[0])
349
+ return new f(!e.s || h && !h[0] && !m || m && !m[0] && !h ? NaN : !h || !m ? e.s / 0 : e.s * 0);
350
+ for (n = F(l.e / v) + F(e.e / v), u = h.length, c = m.length, u < c && (s = h, h = m, m = s, o = u, u = c, c = o), s = [], o = u + c, i = o; i--; ) s.push(0);
374
351
  for (i = c; --i >= 0; ) {
375
352
  for (t = 0, r = u + i; r > i; )
376
- a = s[r] + y[i] * d[r - i - 1] + t, s[r--] = a % Q | 0, t = a / Q | 0;
377
- s[r] = (s[r] + t) % Q | 0;
353
+ a = s[r] + m[i] * h[r - i - 1] + t, s[r--] = a % V | 0, t = a / V | 0;
354
+ s[r] = (s[r] + t) % V | 0;
378
355
  }
379
356
  for (; !s[--o]; ) s.pop();
380
- return t ? ++n : s.shift(), e.d = s, e.e = Re(s, n), I ? v(e, f.precision, f.rounding) : e;
357
+ return t ? ++n : s.shift(), e.d = s, e.e = Ie(s, n), I ? T(e, f.precision, f.rounding) : e;
381
358
  };
382
- g.toBinary = function(e, t) {
383
- return Qe(this, 2, e, t);
359
+ p.toBinary = function(e, t) {
360
+ return je(this, 2, e, t);
384
361
  };
385
- g.toDecimalPlaces = g.toDP = function(e, t) {
362
+ p.toDecimalPlaces = p.toDP = function(e, t) {
386
363
  var n = this, i = n.constructor;
387
- return n = new i(n), e === void 0 ? n : (G(e, 0, ie), t === void 0 ? t = i.rounding : G(t, 0, 8), v(n, e + n.e + 1, t));
364
+ return n = new i(n), e === void 0 ? n : (P(e, 0, z), t === void 0 ? t = i.rounding : P(t, 0, 8), T(n, e + n.e + 1, t));
388
365
  };
389
- g.toExponential = function(e, t) {
366
+ p.toExponential = function(e, t) {
390
367
  var n, i = this, r = i.constructor;
391
- return e === void 0 ? n = Z(i, !0) : (G(e, 0, ie), t === void 0 ? t = r.rounding : G(t, 0, 8), i = v(new r(i), e + 1, t), n = Z(i, !0, e + 1)), i.isNeg() && !i.isZero() ? "-" + n : n;
368
+ return e === void 0 ? n = $(i, !0) : (P(e, 0, z), t === void 0 ? t = r.rounding : P(t, 0, 8), i = T(new r(i), e + 1, t), n = $(i, !0, e + 1)), i.isNeg() && !i.isZero() ? "-" + n : n;
392
369
  };
393
- g.toFixed = function(e, t) {
370
+ p.toFixed = function(e, t) {
394
371
  var n, i, r = this, s = r.constructor;
395
- return e === void 0 ? n = Z(r) : (G(e, 0, ie), t === void 0 ? t = s.rounding : G(t, 0, 8), i = v(new s(r), e + r.e + 1, t), n = Z(i, !1, e + i.e + 1)), r.isNeg() && !r.isZero() ? "-" + n : n;
372
+ return e === void 0 ? n = $(r) : (P(e, 0, z), t === void 0 ? t = s.rounding : P(t, 0, 8), i = T(new s(r), e + r.e + 1, t), n = $(i, !1, e + i.e + 1)), r.isNeg() && !r.isZero() ? "-" + n : n;
396
373
  };
397
- g.toFraction = function(e) {
398
- var t, n, i, r, s, o, a, u, c, l, f, d, y = this, N = y.d, E = y.constructor;
399
- if (!N) return new E(y);
400
- if (c = n = new E(1), i = u = new E(0), t = new E(i), s = t.e = Et(N) - y.e - 1, o = s % T, t.d[0] = P(10, o < 0 ? T + o : o), e == null)
374
+ p.toFraction = function(e) {
375
+ var t, n, i, r, s, o, a, u, c, l, f, h, m = this, N = m.d, E = m.constructor;
376
+ if (!N) return new E(m);
377
+ if (c = n = new E(1), i = u = new E(0), t = new E(i), s = t.e = dt(N) - m.e - 1, o = s % v, t.d[0] = k(10, o < 0 ? v + o : o), e == null)
401
378
  e = s > 0 ? t : c;
402
379
  else {
403
- if (a = new E(e), !a.isInt() || a.lt(c)) throw Error(ne + a);
380
+ if (a = new E(e), !a.isInt() || a.lt(c)) throw Error(Q + a);
404
381
  e = a.gt(t) ? s > 0 ? t : c : a;
405
382
  }
406
- for (I = !1, a = new E(U(N)), l = E.precision, E.precision = s = N.length * T * 2; f = R(a, t, 0, 1, 1), r = n.plus(f.times(i)), r.cmp(e) != 1; )
383
+ for (I = !1, a = new E(b(N)), l = E.precision, E.precision = s = N.length * v * 2; f = x(a, t, 0, 1, 1), r = n.plus(f.times(i)), r.cmp(e) != 1; )
407
384
  n = i, i = r, r = c, c = u.plus(f.times(r)), u = r, r = t, t = a.minus(f.times(r)), a = r;
408
- return r = R(e.minus(n), i, 0, 1, 1), u = u.plus(r.times(c)), n = n.plus(r.times(i)), u.s = c.s = y.s, d = R(c, i, s, 1).minus(y).abs().cmp(R(u, n, s, 1).minus(y).abs()) < 1 ? [c, i] : [u, n], E.precision = l, I = !0, d;
385
+ return r = x(e.minus(n), i, 0, 1, 1), u = u.plus(r.times(c)), n = n.plus(r.times(i)), u.s = c.s = m.s, h = x(c, i, s, 1).minus(m).abs().cmp(x(u, n, s, 1).minus(m).abs()) < 1 ? [c, i] : [u, n], E.precision = l, I = !0, h;
409
386
  };
410
- g.toHexadecimal = g.toHex = function(e, t) {
411
- return Qe(this, 16, e, t);
387
+ p.toHexadecimal = p.toHex = function(e, t) {
388
+ return je(this, 16, e, t);
412
389
  };
413
- g.toNearest = function(e, t) {
390
+ p.toNearest = function(e, t) {
414
391
  var n = this, i = n.constructor;
415
392
  if (n = new i(n), e == null) {
416
393
  if (!n.d) return n;
417
394
  e = new i(1), t = i.rounding;
418
395
  } else {
419
- if (e = new i(e), t === void 0 ? t = i.rounding : G(t, 0, 8), !n.d) return e.s ? n : e;
396
+ if (e = new i(e), t === void 0 ? t = i.rounding : P(t, 0, 8), !n.d) return e.s ? n : e;
420
397
  if (!e.d)
421
398
  return e.s && (e.s = n.s), e;
422
399
  }
423
- return e.d[0] ? (I = !1, n = R(n, e, 0, t, 1).times(e), I = !0, v(n)) : (e.s = n.s, n = e), n;
400
+ return e.d[0] ? (I = !1, n = x(n, e, 0, t, 1).times(e), I = !0, T(n)) : (e.s = n.s, n = e), n;
424
401
  };
425
- g.toNumber = function() {
402
+ p.toNumber = function() {
426
403
  return +this;
427
404
  };
428
- g.toOctal = function(e, t) {
429
- return Qe(this, 8, e, t);
405
+ p.toOctal = function(e, t) {
406
+ return je(this, 8, e, t);
430
407
  };
431
- g.toPower = g.pow = function(e) {
408
+ p.toPower = p.pow = function(e) {
432
409
  var t, n, i, r, s, o, a = this, u = a.constructor, c = +(e = new u(e));
433
- if (!a.d || !e.d || !a.d[0] || !e.d[0]) return new u(P(+a, c));
410
+ if (!a.d || !e.d || !a.d[0] || !e.d[0]) return new u(k(+a, c));
434
411
  if (a = new u(a), a.eq(1)) return a;
435
- if (i = u.precision, s = u.rounding, e.eq(1)) return v(a, i, s);
436
- if (t = j(e.e / T), t >= e.d.length - 1 && (n = c < 0 ? -c : c) <= Bt)
437
- return r = yt(u, a, n, i), e.s < 0 ? new u(1).div(r) : v(r, i, s);
412
+ if (i = u.precision, s = u.rounding, e.eq(1)) return T(a, i, s);
413
+ if (t = F(e.e / v), t >= e.d.length - 1 && (n = c < 0 ? -c : c) <= Mt)
414
+ return r = pt(u, a, n, i), e.s < 0 ? new u(1).div(r) : T(r, i, s);
438
415
  if (o = a.s, o < 0) {
439
416
  if (t < e.d.length - 1) return new u(NaN);
440
417
  if ((e.d[t] & 1) == 0 && (o = 1), a.e == 0 && a.d[0] == 1 && a.d.length == 1)
441
418
  return a.s = o, a;
442
419
  }
443
- return n = P(+a, c), t = n == 0 || !isFinite(n) ? j(c * (Math.log("0." + U(a.d)) / Math.LN10 + a.e + 1)) : new u(n + "").e, t > u.maxE + 1 || t < u.minE - 1 ? new u(t > 0 ? o / 0 : 0) : (I = !1, u.rounding = a.s = 1, n = Math.min(12, (t + "").length), r = Ge(e.times(te(a, i + n)), i), r.d && (r = v(r, i + 5, 1), ye(r.d, i, s) && (t = i + 10, r = v(Ge(e.times(te(a, t + n)), t), t + 5, 1), +U(r.d).slice(i + 1, i + 15) + 1 == 1e14 && (r = v(r, i + 1, 0)))), r.s = o, I = !0, u.rounding = s, v(r, i, s));
420
+ return n = k(+a, c), t = n == 0 || !isFinite(n) ? F(c * (Math.log("0." + b(a.d)) / Math.LN10 + a.e + 1)) : new u(n + "").e, t > u.maxE + 1 || t < u.minE - 1 ? new u(t > 0 ? o / 0 : 0) : (I = !1, u.rounding = a.s = 1, n = Math.min(12, (t + "").length), r = Me(e.times(J(a, i + n)), i), r.d && (r = T(r, i + 5, 1), ae(r.d, i, s) && (t = i + 10, r = T(Me(e.times(J(a, t + n)), t), t + 5, 1), +b(r.d).slice(i + 1, i + 15) + 1 == 1e14 && (r = T(r, i + 1, 0)))), r.s = o, I = !0, u.rounding = s, T(r, i, s));
444
421
  };
445
- g.toPrecision = function(e, t) {
422
+ p.toPrecision = function(e, t) {
446
423
  var n, i = this, r = i.constructor;
447
- return e === void 0 ? n = Z(i, i.e <= r.toExpNeg || i.e >= r.toExpPos) : (G(e, 1, ie), t === void 0 ? t = r.rounding : G(t, 0, 8), i = v(new r(i), e, t), n = Z(i, e <= i.e || i.e <= r.toExpNeg, e)), i.isNeg() && !i.isZero() ? "-" + n : n;
424
+ return e === void 0 ? n = $(i, i.e <= r.toExpNeg || i.e >= r.toExpPos) : (P(e, 1, z), t === void 0 ? t = r.rounding : P(t, 0, 8), i = T(new r(i), e, t), n = $(i, e <= i.e || i.e <= r.toExpNeg, e)), i.isNeg() && !i.isZero() ? "-" + n : n;
448
425
  };
449
- g.toSignificantDigits = g.toSD = function(e, t) {
426
+ p.toSignificantDigits = p.toSD = function(e, t) {
450
427
  var n = this, i = n.constructor;
451
- return e === void 0 ? (e = i.precision, t = i.rounding) : (G(e, 1, ie), t === void 0 ? t = i.rounding : G(t, 0, 8)), v(new i(n), e, t);
428
+ return e === void 0 ? (e = i.precision, t = i.rounding) : (P(e, 1, z), t === void 0 ? t = i.rounding : P(t, 0, 8)), T(new i(n), e, t);
452
429
  };
453
- g.toString = function() {
454
- var e = this, t = e.constructor, n = Z(e, e.e <= t.toExpNeg || e.e >= t.toExpPos);
430
+ p.toString = function() {
431
+ var e = this, t = e.constructor, n = $(e, e.e <= t.toExpNeg || e.e >= t.toExpPos);
455
432
  return e.isNeg() && !e.isZero() ? "-" + n : n;
456
433
  };
457
- g.truncated = g.trunc = function() {
458
- return v(new this.constructor(this), this.e + 1, 1);
434
+ p.truncated = p.trunc = function() {
435
+ return T(new this.constructor(this), this.e + 1, 1);
459
436
  };
460
- g.valueOf = g.toJSON = function() {
461
- var e = this, t = e.constructor, n = Z(e, e.e <= t.toExpNeg || e.e >= t.toExpPos);
437
+ p.valueOf = p.toJSON = function() {
438
+ var e = this, t = e.constructor, n = $(e, e.e <= t.toExpNeg || e.e >= t.toExpPos);
462
439
  return e.isNeg() ? "-" + n : n;
463
440
  };
464
- function U(e) {
441
+ function b(e) {
465
442
  var t, n, i, r = e.length - 1, s = "", o = e[0];
466
443
  if (r > 0) {
467
444
  for (s += o, t = 1; t < r; t++)
468
- i = e[t] + "", n = T - i.length, n && (s += ee(n)), s += i;
469
- o = e[t], i = o + "", n = T - i.length, n && (s += ee(n));
445
+ i = e[t] + "", n = v - i.length, n && (s += H(n)), s += i;
446
+ o = e[t], i = o + "", n = v - i.length, n && (s += H(n));
470
447
  } else if (o === 0)
471
448
  return "0";
472
449
  for (; o % 10 === 0; ) o /= 10;
473
450
  return s + o;
474
451
  }
475
- function G(e, t, n) {
452
+ function P(e, t, n) {
476
453
  if (e !== ~~e || e < t || e > n)
477
- throw Error(ne + e);
454
+ throw Error(Q + e);
478
455
  }
479
- function ye(e, t, n, i) {
456
+ function ae(e, t, n, i) {
480
457
  var r, s, o, a;
481
458
  for (s = e[0]; s >= 10; s /= 10) --t;
482
- return --t < 0 ? (t += T, r = 0) : (r = Math.ceil((t + 1) / T), t %= T), s = P(10, T - t), a = e[r] % s | 0, i == null ? t < 3 ? (t == 0 ? a = a / 100 | 0 : t == 1 && (a = a / 10 | 0), o = n < 4 && a == 99999 || n > 3 && a == 49999 || a == 5e4 || a == 0) : o = (n < 4 && a + 1 == s || n > 3 && a + 1 == s / 2) && (e[r + 1] / s / 100 | 0) == P(10, t - 2) - 1 || (a == s / 2 || a == 0) && (e[r + 1] / s / 100 | 0) == 0 : t < 4 ? (t == 0 ? a = a / 1e3 | 0 : t == 1 ? a = a / 100 | 0 : t == 2 && (a = a / 10 | 0), o = (i || n < 4) && a == 9999 || !i && n > 3 && a == 4999) : o = ((i || n < 4) && a + 1 == s || !i && n > 3 && a + 1 == s / 2) && (e[r + 1] / s / 1e3 | 0) == P(10, t - 3) - 1, o;
459
+ return --t < 0 ? (t += v, r = 0) : (r = Math.ceil((t + 1) / v), t %= v), s = k(10, v - t), a = e[r] % s | 0, i == null ? t < 3 ? (t == 0 ? a = a / 100 | 0 : t == 1 && (a = a / 10 | 0), o = n < 4 && a == 99999 || n > 3 && a == 49999 || a == 5e4 || a == 0) : o = (n < 4 && a + 1 == s || n > 3 && a + 1 == s / 2) && (e[r + 1] / s / 100 | 0) == k(10, t - 2) - 1 || (a == s / 2 || a == 0) && (e[r + 1] / s / 100 | 0) == 0 : t < 4 ? (t == 0 ? a = a / 1e3 | 0 : t == 1 ? a = a / 100 | 0 : t == 2 && (a = a / 10 | 0), o = (i || n < 4) && a == 9999 || !i && n > 3 && a == 4999) : o = ((i || n < 4) && a + 1 == s || !i && n > 3 && a + 1 == s / 2) && (e[r + 1] / s / 1e3 | 0) == k(10, t - 3) - 1, o;
483
460
  }
484
- function Ie(e, t, n) {
461
+ function de(e, t, n) {
485
462
  for (var i, r = [0], s, o = 0, a = e.length; o < a; ) {
486
463
  for (s = r.length; s--; ) r[s] *= t;
487
- for (r[0] += je.indexOf(e.charAt(o++)), i = 0; i < r.length; i++)
464
+ for (r[0] += be.indexOf(e.charAt(o++)), i = 0; i < r.length; i++)
488
465
  r[i] > n - 1 && (r[i + 1] === void 0 && (r[i + 1] = 0), r[i + 1] += r[i] / n | 0, r[i] %= n);
489
466
  }
490
467
  return r.reverse();
@@ -492,14 +469,14 @@ function Ie(e, t, n) {
492
469
  function qt(e, t) {
493
470
  var n, i, r;
494
471
  if (t.isZero()) return t;
495
- i = t.d.length, i < 32 ? (n = Math.ceil(i / 3), r = (1 / Le(4, n)).toString()) : (n = 16, r = "2.3283064365386962890625e-10"), e.precision += n, t = he(e, 1, t.times(r), new e(1));
472
+ i = t.d.length, i < 32 ? (n = Math.ceil(i / 3), r = (1 / Oe(4, n)).toString()) : (n = 16, r = "2.3283064365386962890625e-10"), e.precision += n, t = ne(e, 1, t.times(r), new e(1));
496
473
  for (var s = n; s--; ) {
497
474
  var o = t.times(t);
498
475
  t = o.times(o).minus(o).times(8).plus(1);
499
476
  }
500
477
  return e.precision -= n, t;
501
478
  }
502
- var R = /* @__PURE__ */ (function() {
479
+ var x = /* @__PURE__ */ (function() {
503
480
  function e(i, r, s) {
504
481
  var o, a = 0, u = i.length;
505
482
  for (i = i.slice(); u--; )
@@ -524,185 +501,185 @@ var R = /* @__PURE__ */ (function() {
524
501
  for (; !i[0] && i.length > 1; ) i.shift();
525
502
  }
526
503
  return function(i, r, s, o, a, u) {
527
- var c, l, f, d, y, N, E, x, O, q, b, C, J, $, K, ae, H, me, Y, V, ce = i.constructor, re = i.s == r.s ? 1 : -1, h = i.d, p = r.d;
528
- if (!h || !h[0] || !p || !p[0])
529
- return new ce(
504
+ var c, l, f, h, m, N, E, C, y, M, A, _, Y, q, W, ue, se, xe, B, le, fe = i.constructor, De = i.s == r.s ? 1 : -1, L = i.d, D = r.d;
505
+ if (!L || !L[0] || !D || !D[0])
506
+ return new fe(
530
507
  // Return NaN if either NaN, or both Infinity or 0.
531
- !i.s || !r.s || (h ? p && h[0] == p[0] : !p) ? NaN : (
508
+ !i.s || !r.s || (L ? D && L[0] == D[0] : !D) ? NaN : (
532
509
  // Return ±0 if x is 0 or y is ±Infinity, or return ±Infinity as y is 0.
533
- h && h[0] == 0 || !p ? re * 0 : re / 0
510
+ L && L[0] == 0 || !D ? De * 0 : De / 0
534
511
  )
535
512
  );
536
- for (u ? (y = 1, l = i.e - r.e) : (u = Q, y = T, l = j(i.e / y) - j(r.e / y)), Y = p.length, H = h.length, O = new ce(re), q = O.d = [], f = 0; p[f] == (h[f] || 0); f++) ;
537
- if (p[f] > (h[f] || 0) && l--, s == null ? ($ = s = ce.precision, o = ce.rounding) : a ? $ = s + (i.e - r.e) + 1 : $ = s, $ < 0)
538
- q.push(1), N = !0;
513
+ for (u ? (m = 1, l = i.e - r.e) : (u = V, m = v, l = F(i.e / m) - F(r.e / m)), B = D.length, se = L.length, y = new fe(De), M = y.d = [], f = 0; D[f] == (L[f] || 0); f++) ;
514
+ if (D[f] > (L[f] || 0) && l--, s == null ? (q = s = fe.precision, o = fe.rounding) : a ? q = s + (i.e - r.e) + 1 : q = s, q < 0)
515
+ M.push(1), N = !0;
539
516
  else {
540
- if ($ = $ / y + 2 | 0, f = 0, Y == 1) {
541
- for (d = 0, p = p[0], $++; (f < H || d) && $--; f++)
542
- K = d * u + (h[f] || 0), q[f] = K / p | 0, d = K % p | 0;
543
- N = d || f < H;
517
+ if (q = q / m + 2 | 0, f = 0, B == 1) {
518
+ for (h = 0, D = D[0], q++; (f < se || h) && q--; f++)
519
+ W = h * u + (L[f] || 0), M[f] = W / D | 0, h = W % D | 0;
520
+ N = h || f < se;
544
521
  } else {
545
- for (d = u / (p[0] + 1) | 0, d > 1 && (p = e(p, d, u), h = e(h, d, u), Y = p.length, H = h.length), ae = Y, b = h.slice(0, Y), C = b.length; C < Y; ) b[C++] = 0;
546
- V = p.slice(), V.unshift(0), me = p[0], p[1] >= u / 2 && ++me;
522
+ for (h = u / (D[0] + 1) | 0, h > 1 && (D = e(D, h, u), L = e(L, h, u), B = D.length, se = L.length), ue = B, A = L.slice(0, B), _ = A.length; _ < B; ) A[_++] = 0;
523
+ le = D.slice(), le.unshift(0), xe = D[0], D[1] >= u / 2 && ++xe;
547
524
  do
548
- d = 0, c = t(p, b, Y, C), c < 0 ? (J = b[0], Y != C && (J = J * u + (b[1] || 0)), d = J / me | 0, d > 1 ? (d >= u && (d = u - 1), E = e(p, d, u), x = E.length, C = b.length, c = t(E, b, x, C), c == 1 && (d--, n(E, Y < x ? V : p, x, u))) : (d == 0 && (c = d = 1), E = p.slice()), x = E.length, x < C && E.unshift(0), n(b, E, C, u), c == -1 && (C = b.length, c = t(p, b, Y, C), c < 1 && (d++, n(b, Y < C ? V : p, C, u))), C = b.length) : c === 0 && (d++, b = [0]), q[f++] = d, c && b[0] ? b[C++] = h[ae] || 0 : (b = [h[ae]], C = 1);
549
- while ((ae++ < H || b[0] !== void 0) && $--);
550
- N = b[0] !== void 0;
525
+ h = 0, c = t(D, A, B, _), c < 0 ? (Y = A[0], B != _ && (Y = Y * u + (A[1] || 0)), h = Y / xe | 0, h > 1 ? (h >= u && (h = u - 1), E = e(D, h, u), C = E.length, _ = A.length, c = t(E, A, C, _), c == 1 && (h--, n(E, B < C ? le : D, C, u))) : (h == 0 && (c = h = 1), E = D.slice()), C = E.length, C < _ && E.unshift(0), n(A, E, _, u), c == -1 && (_ = A.length, c = t(D, A, B, _), c < 1 && (h++, n(A, B < _ ? le : D, _, u))), _ = A.length) : c === 0 && (h++, A = [0]), M[f++] = h, c && A[0] ? A[_++] = L[ue] || 0 : (A = [L[ue]], _ = 1);
526
+ while ((ue++ < se || A[0] !== void 0) && q--);
527
+ N = A[0] !== void 0;
551
528
  }
552
- q[0] || q.shift();
529
+ M[0] || M.shift();
553
530
  }
554
- if (y == 1)
555
- O.e = l, ht = N;
531
+ if (m == 1)
532
+ y.e = l, ct = N;
556
533
  else {
557
- for (f = 1, d = q[0]; d >= 10; d /= 10) f++;
558
- O.e = f + l * y - 1, v(O, a ? s + O.e + 1 : s, o, N);
534
+ for (f = 1, h = M[0]; h >= 10; h /= 10) f++;
535
+ y.e = f + l * m - 1, T(y, a ? s + y.e + 1 : s, o, N);
559
536
  }
560
- return O;
537
+ return y;
561
538
  };
562
539
  })();
563
- function v(e, t, n, i) {
564
- var r, s, o, a, u, c, l, f, d, y = e.constructor;
540
+ function T(e, t, n, i) {
541
+ var r, s, o, a, u, c, l, f, h, m = e.constructor;
565
542
  e: if (t != null) {
566
543
  if (f = e.d, !f) return e;
567
544
  for (r = 1, a = f[0]; a >= 10; a /= 10) r++;
568
545
  if (s = t - r, s < 0)
569
- s += T, o = t, l = f[d = 0], u = l / P(10, r - o - 1) % 10 | 0;
570
- else if (d = Math.ceil((s + 1) / T), a = f.length, d >= a)
546
+ s += v, o = t, l = f[h = 0], u = l / k(10, r - o - 1) % 10 | 0;
547
+ else if (h = Math.ceil((s + 1) / v), a = f.length, h >= a)
571
548
  if (i) {
572
- for (; a++ <= d; ) f.push(0);
573
- l = u = 0, r = 1, s %= T, o = s - T + 1;
549
+ for (; a++ <= h; ) f.push(0);
550
+ l = u = 0, r = 1, s %= v, o = s - v + 1;
574
551
  } else
575
552
  break e;
576
553
  else {
577
- for (l = a = f[d], r = 1; a >= 10; a /= 10) r++;
578
- s %= T, o = s - T + r, u = o < 0 ? 0 : l / P(10, r - o - 1) % 10 | 0;
554
+ for (l = a = f[h], r = 1; a >= 10; a /= 10) r++;
555
+ s %= v, o = s - v + r, u = o < 0 ? 0 : l / k(10, r - o - 1) % 10 | 0;
579
556
  }
580
- if (i = i || t < 0 || f[d + 1] !== void 0 || (o < 0 ? l : l % P(10, r - o - 1)), c = n < 4 ? (u || i) && (n == 0 || n == (e.s < 0 ? 3 : 2)) : u > 5 || u == 5 && (n == 4 || i || n == 6 && // Check whether the digit to the left of the rounding digit is odd.
581
- (s > 0 ? o > 0 ? l / P(10, r - o) : 0 : f[d - 1]) % 10 & 1 || n == (e.s < 0 ? 8 : 7)), t < 1 || !f[0])
582
- return f.length = 0, c ? (t -= e.e + 1, f[0] = P(10, (T - t % T) % T), e.e = -t || 0) : f[0] = e.e = 0, e;
583
- if (s == 0 ? (f.length = d, a = 1, d--) : (f.length = d + 1, a = P(10, T - s), f[d] = o > 0 ? (l / P(10, r - o) % P(10, o) | 0) * a : 0), c)
557
+ if (i = i || t < 0 || f[h + 1] !== void 0 || (o < 0 ? l : l % k(10, r - o - 1)), c = n < 4 ? (u || i) && (n == 0 || n == (e.s < 0 ? 3 : 2)) : u > 5 || u == 5 && (n == 4 || i || n == 6 && // Check whether the digit to the left of the rounding digit is odd.
558
+ (s > 0 ? o > 0 ? l / k(10, r - o) : 0 : f[h - 1]) % 10 & 1 || n == (e.s < 0 ? 8 : 7)), t < 1 || !f[0])
559
+ return f.length = 0, c ? (t -= e.e + 1, f[0] = k(10, (v - t % v) % v), e.e = -t || 0) : f[0] = e.e = 0, e;
560
+ if (s == 0 ? (f.length = h, a = 1, h--) : (f.length = h + 1, a = k(10, v - s), f[h] = o > 0 ? (l / k(10, r - o) % k(10, o) | 0) * a : 0), c)
584
561
  for (; ; )
585
- if (d == 0) {
562
+ if (h == 0) {
586
563
  for (s = 1, o = f[0]; o >= 10; o /= 10) s++;
587
564
  for (o = f[0] += a, a = 1; o >= 10; o /= 10) a++;
588
- s != a && (e.e++, f[0] == Q && (f[0] = 1));
565
+ s != a && (e.e++, f[0] == V && (f[0] = 1));
589
566
  break;
590
567
  } else {
591
- if (f[d] += a, f[d] != Q) break;
592
- f[d--] = 0, a = 1;
568
+ if (f[h] += a, f[h] != V) break;
569
+ f[h--] = 0, a = 1;
593
570
  }
594
571
  for (s = f.length; f[--s] === 0; ) f.pop();
595
572
  }
596
- return I && (e.e > y.maxE ? (e.d = null, e.e = NaN) : e.e < y.minE && (e.e = 0, e.d = [0])), e;
573
+ return I && (e.e > m.maxE ? (e.d = null, e.e = NaN) : e.e < m.minE && (e.e = 0, e.d = [0])), e;
597
574
  }
598
- function Z(e, t, n) {
599
- if (!e.isFinite()) return wt(e);
600
- var i, r = e.e, s = U(e.d), o = s.length;
601
- return t ? (n && (i = n - o) > 0 ? s = s.charAt(0) + "." + s.slice(1) + ee(i) : o > 1 && (s = s.charAt(0) + "." + s.slice(1)), s = s + (e.e < 0 ? "e" : "e+") + e.e) : r < 0 ? (s = "0." + ee(-r - 1) + s, n && (i = n - o) > 0 && (s += ee(i))) : r >= o ? (s += ee(r + 1 - o), n && (i = n - r - 1) > 0 && (s = s + "." + ee(i))) : ((i = r + 1) < o && (s = s.slice(0, i) + "." + s.slice(i)), n && (i = n - o) > 0 && (r + 1 === o && (s += "."), s += ee(i))), s;
575
+ function $(e, t, n) {
576
+ if (!e.isFinite()) return gt(e);
577
+ var i, r = e.e, s = b(e.d), o = s.length;
578
+ return t ? (n && (i = n - o) > 0 ? s = s.charAt(0) + "." + s.slice(1) + H(i) : o > 1 && (s = s.charAt(0) + "." + s.slice(1)), s = s + (e.e < 0 ? "e" : "e+") + e.e) : r < 0 ? (s = "0." + H(-r - 1) + s, n && (i = n - o) > 0 && (s += H(i))) : r >= o ? (s += H(r + 1 - o), n && (i = n - r - 1) > 0 && (s = s + "." + H(i))) : ((i = r + 1) < o && (s = s.slice(0, i) + "." + s.slice(i)), n && (i = n - o) > 0 && (r + 1 === o && (s += "."), s += H(i))), s;
602
579
  }
603
- function Re(e, t) {
580
+ function Ie(e, t) {
604
581
  var n = e[0];
605
- for (t *= T; n >= 10; n /= 10) t++;
582
+ for (t *= v; n >= 10; n /= 10) t++;
606
583
  return t;
607
584
  }
608
- function xe(e, t, n) {
609
- if (t > Ut)
610
- throw I = !0, n && (e.precision = n), Error(dt);
611
- return v(new e(De), t, 1, !0);
585
+ function we(e, t, n) {
586
+ if (t > Pt)
587
+ throw I = !0, n && (e.precision = n), Error(ut);
588
+ return T(new e(Ne), t, 1, !0);
612
589
  }
613
- function X(e, t, n) {
614
- if (t > He) throw Error(dt);
615
- return v(new e(Se), t, n, !0);
590
+ function j(e, t, n) {
591
+ if (t > Fe) throw Error(ut);
592
+ return T(new e(Te), t, n, !0);
616
593
  }
617
- function Et(e) {
618
- var t = e.length - 1, n = t * T + 1;
594
+ function dt(e) {
595
+ var t = e.length - 1, n = t * v + 1;
619
596
  if (t = e[t], t) {
620
597
  for (; t % 10 == 0; t /= 10) n--;
621
598
  for (t = e[0]; t >= 10; t /= 10) n++;
622
599
  }
623
600
  return n;
624
601
  }
625
- function ee(e) {
602
+ function H(e) {
626
603
  for (var t = ""; e--; ) t += "0";
627
604
  return t;
628
605
  }
629
- function yt(e, t, n, i) {
630
- var r, s = new e(1), o = Math.ceil(i / T + 4);
606
+ function pt(e, t, n, i) {
607
+ var r, s = new e(1), o = Math.ceil(i / v + 4);
631
608
  for (I = !1; ; ) {
632
- if (n % 2 && (s = s.times(t), nt(s.d, o) && (r = !0)), n = j(n / 2), n === 0) {
609
+ if (n % 2 && (s = s.times(t), Qe(s.d, o) && (r = !0)), n = F(n / 2), n === 0) {
633
610
  n = s.d.length - 1, r && s.d[n] === 0 && ++s.d[n];
634
611
  break;
635
612
  }
636
- t = t.times(t), nt(t.d, o);
613
+ t = t.times(t), Qe(t.d, o);
637
614
  }
638
615
  return I = !0, s;
639
616
  }
640
- function tt(e) {
617
+ function Je(e) {
641
618
  return e.d[e.d.length - 1] & 1;
642
619
  }
643
- function Nt(e, t, n) {
644
- for (var i, r = new e(t[0]), s = 0; ++s < t.length; )
645
- if (i = new e(t[s]), i.s)
646
- r[n](i) && (r = i);
647
- else {
648
- r = i;
620
+ function mt(e, t, n) {
621
+ for (var i, r, s = new e(t[0]), o = 0; ++o < t.length; ) {
622
+ if (r = new e(t[o]), !r.s) {
623
+ s = r;
649
624
  break;
650
625
  }
651
- return r;
626
+ i = s.cmp(r), (i === n || i === 0 && s.s === n) && (s = r);
627
+ }
628
+ return s;
652
629
  }
653
- function Ge(e, t) {
654
- var n, i, r, s, o, a, u, c = 0, l = 0, f = 0, d = e.constructor, y = d.rounding, N = d.precision;
630
+ function Me(e, t) {
631
+ var n, i, r, s, o, a, u, c = 0, l = 0, f = 0, h = e.constructor, m = h.rounding, N = h.precision;
655
632
  if (!e.d || !e.d[0] || e.e > 17)
656
- return new d(e.d ? e.d[0] ? e.s < 0 ? 0 : 1 / 0 : 1 : e.s ? e.s < 0 ? 0 : e : NaN);
657
- for (t == null ? (I = !1, u = N) : u = t, a = new d(0.03125); e.e > -2; )
633
+ return new h(e.d ? e.d[0] ? e.s < 0 ? 0 : 1 / 0 : 1 : e.s ? e.s < 0 ? 0 : e : NaN);
634
+ for (t == null ? (I = !1, u = N) : u = t, a = new h(0.03125); e.e > -2; )
658
635
  e = e.times(a), f += 5;
659
- for (i = Math.log(P(2, f)) / Math.LN10 * 2 + 5 | 0, u += i, n = s = o = new d(1), d.precision = u; ; ) {
660
- if (s = v(s.times(e), u, 1), n = n.times(++l), a = o.plus(R(s, n, u, 1)), U(a.d).slice(0, u) === U(o.d).slice(0, u)) {
661
- for (r = f; r--; ) o = v(o.times(o), u, 1);
636
+ for (i = Math.log(k(2, f)) / Math.LN10 * 2 + 5 | 0, u += i, n = s = o = new h(1), h.precision = u; ; ) {
637
+ if (s = T(s.times(e), u, 1), n = n.times(++l), a = o.plus(x(s, n, u, 1)), b(a.d).slice(0, u) === b(o.d).slice(0, u)) {
638
+ for (r = f; r--; ) o = T(o.times(o), u, 1);
662
639
  if (t == null)
663
- if (c < 3 && ye(o.d, u - i, y, c))
664
- d.precision = u += 10, n = s = a = new d(1), l = 0, c++;
640
+ if (c < 3 && ae(o.d, u - i, m, c))
641
+ h.precision = u += 10, n = s = a = new h(1), l = 0, c++;
665
642
  else
666
- return v(o, d.precision = N, y, I = !0);
643
+ return T(o, h.precision = N, m, I = !0);
667
644
  else
668
- return d.precision = N, o;
645
+ return h.precision = N, o;
669
646
  }
670
647
  o = a;
671
648
  }
672
649
  }
673
- function te(e, t) {
674
- var n, i, r, s, o, a, u, c, l, f, d, y = 1, N = 10, E = e, x = E.d, O = E.constructor, q = O.rounding, b = O.precision;
675
- if (E.s < 0 || !x || !x[0] || !E.e && x[0] == 1 && x.length == 1)
676
- return new O(x && !x[0] ? -1 / 0 : E.s != 1 ? NaN : x ? 0 : E);
677
- if (t == null ? (I = !1, l = b) : l = t, O.precision = l += N, n = U(x), i = n.charAt(0), Math.abs(s = E.e) < 15e14) {
650
+ function J(e, t) {
651
+ var n, i, r, s, o, a, u, c, l, f, h, m = 1, N = 10, E = e, C = E.d, y = E.constructor, M = y.rounding, A = y.precision;
652
+ if (E.s < 0 || !C || !C[0] || !E.e && C[0] == 1 && C.length == 1)
653
+ return new y(C && !C[0] ? -1 / 0 : E.s != 1 ? NaN : C ? 0 : E);
654
+ if (t == null ? (I = !1, l = A) : l = t, y.precision = l += N, n = b(C), i = n.charAt(0), Math.abs(s = E.e) < 15e14) {
678
655
  for (; i < 7 && i != 1 || i == 1 && n.charAt(1) > 3; )
679
- E = E.times(e), n = U(E.d), i = n.charAt(0), y++;
680
- s = E.e, i > 1 ? (E = new O("0." + n), s++) : E = new O(i + "." + n.slice(1));
656
+ E = E.times(e), n = b(E.d), i = n.charAt(0), m++;
657
+ s = E.e, i > 1 ? (E = new y("0." + n), s++) : E = new y(i + "." + n.slice(1));
681
658
  } else
682
- return c = xe(O, l + 2, b).times(s + ""), E = te(new O(i + "." + n.slice(1)), l - N).plus(c), O.precision = b, t == null ? v(E, b, q, I = !0) : E;
683
- for (f = E, u = o = E = R(E.minus(1), E.plus(1), l, 1), d = v(E.times(E), l, 1), r = 3; ; ) {
684
- if (o = v(o.times(d), l, 1), c = u.plus(R(o, new O(r), l, 1)), U(c.d).slice(0, l) === U(u.d).slice(0, l))
685
- if (u = u.times(2), s !== 0 && (u = u.plus(xe(O, l + 2, b).times(s + ""))), u = R(u, new O(y), l, 1), t == null)
686
- if (ye(u.d, l - N, q, a))
687
- O.precision = l += N, c = o = E = R(f.minus(1), f.plus(1), l, 1), d = v(E.times(E), l, 1), r = a = 1;
659
+ return c = we(y, l + 2, A).times(s + ""), E = J(new y(i + "." + n.slice(1)), l - N).plus(c), y.precision = A, t == null ? T(E, A, M, I = !0) : E;
660
+ for (f = E, u = o = E = x(E.minus(1), E.plus(1), l, 1), h = T(E.times(E), l, 1), r = 3; ; ) {
661
+ if (o = T(o.times(h), l, 1), c = u.plus(x(o, new y(r), l, 1)), b(c.d).slice(0, l) === b(u.d).slice(0, l))
662
+ if (u = u.times(2), s !== 0 && (u = u.plus(we(y, l + 2, A).times(s + ""))), u = x(u, new y(m), l, 1), t == null)
663
+ if (ae(u.d, l - N, M, a))
664
+ y.precision = l += N, c = o = E = x(f.minus(1), f.plus(1), l, 1), h = T(E.times(E), l, 1), r = a = 1;
688
665
  else
689
- return v(u, O.precision = b, q, I = !0);
666
+ return T(u, y.precision = A, M, I = !0);
690
667
  else
691
- return O.precision = b, u;
668
+ return y.precision = A, u;
692
669
  u = c, r += 2;
693
670
  }
694
671
  }
695
- function wt(e) {
672
+ function gt(e) {
696
673
  return String(e.s * e.s / 0);
697
674
  }
698
- function Ye(e, t) {
675
+ function pe(e, t) {
699
676
  var n, i, r;
700
677
  for ((n = t.indexOf(".")) > -1 && (t = t.replace(".", "")), (i = t.search(/e/i)) > 0 ? (n < 0 && (n = i), n += +t.slice(i + 1), t = t.substring(0, i)) : n < 0 && (n = t.length), i = 0; t.charCodeAt(i) === 48; i++) ;
701
678
  for (r = t.length; t.charCodeAt(r - 1) === 48; --r) ;
702
679
  if (t = t.slice(i, r), t) {
703
- if (r -= i, e.e = n = n - i - 1, e.d = [], i = (n + 1) % T, n < 0 && (i += T), i < r) {
704
- for (i && e.d.push(+t.slice(0, i)), r -= T; i < r; ) e.d.push(+t.slice(i, i += T));
705
- t = t.slice(i), i = T - t.length;
680
+ if (r -= i, e.e = n = n - i - 1, e.d = [], i = (n + 1) % v, n < 0 && (i += v), i < r) {
681
+ for (i && e.d.push(+t.slice(0, i)), r -= v; i < r; ) e.d.push(+t.slice(i, i += v));
682
+ t = t.slice(i), i = v - t.length;
706
683
  } else
707
684
  i -= r;
708
685
  for (; i--; ) t += "0";
@@ -711,36 +688,36 @@ function Ye(e, t) {
711
688
  e.e = 0, e.d = [0];
712
689
  return e;
713
690
  }
714
- function Vt(e, t) {
691
+ function Bt(e, t) {
715
692
  var n, i, r, s, o, a, u, c, l;
716
693
  if (t.indexOf("_") > -1) {
717
- if (t = t.replace(/(\d)_(?=\d)/g, "$1"), gt.test(t)) return Ye(e, t);
694
+ if (t = t.replace(/(\d)_(?=\d)/g, "$1"), ht.test(t)) return pe(e, t);
718
695
  } else if (t === "Infinity" || t === "NaN")
719
696
  return +t || (e.s = NaN), e.e = NaN, e.d = null, e;
720
- if (Pt.test(t))
697
+ if (Lt.test(t))
721
698
  n = 16, t = t.toLowerCase();
722
- else if (Ft.test(t))
699
+ else if (bt.test(t))
723
700
  n = 2;
724
- else if (Mt.test(t))
701
+ else if (Ft.test(t))
725
702
  n = 8;
726
703
  else
727
- throw Error(ne + t);
728
- for (s = t.search(/p/i), s > 0 ? (u = +t.slice(s + 1), t = t.substring(2, s)) : t = t.slice(2), s = t.indexOf("."), o = s >= 0, i = e.constructor, o && (t = t.replace(".", ""), a = t.length, s = a - s, r = yt(i, new i(n), s, s * 2)), c = Ie(t, n, Q), l = c.length - 1, s = l; c[s] === 0; --s) c.pop();
729
- return s < 0 ? new i(e.s * 0) : (e.e = Re(c, l), e.d = c, I = !1, o && (e = R(e, r, a * 4)), u && (e = e.times(Math.abs(u) < 54 ? P(2, u) : de.pow(2, u))), I = !0, e);
704
+ throw Error(Q + t);
705
+ for (s = t.search(/p/i), s > 0 ? (u = +t.slice(s + 1), t = t.substring(2, s)) : t = t.slice(2), s = t.indexOf("."), o = s >= 0, i = e.constructor, o && (t = t.replace(".", ""), a = t.length, s = a - s, r = pt(i, new i(n), s, s * 2)), c = de(t, n, V), l = c.length - 1, s = l; c[s] === 0; --s) c.pop();
706
+ return s < 0 ? new i(e.s * 0) : (e.e = Ie(c, l), e.d = c, I = !1, o && (e = x(e, r, a * 4)), u && (e = e.times(Math.abs(u) < 54 ? k(2, u) : ie.pow(2, u))), I = !0, e);
730
707
  }
731
- function jt(e, t) {
708
+ function Ut(e, t) {
732
709
  var n, i = t.d.length;
733
710
  if (i < 3)
734
- return t.isZero() ? t : he(e, 2, t, t);
735
- n = 1.4 * Math.sqrt(i), n = n > 16 ? 16 : n | 0, t = t.times(1 / Le(5, n)), t = he(e, 2, t, t);
711
+ return t.isZero() ? t : ne(e, 2, t, t);
712
+ n = 1.4 * Math.sqrt(i), n = n > 16 ? 16 : n | 0, t = t.times(1 / Oe(5, n)), t = ne(e, 2, t, t);
736
713
  for (var r, s = new e(5), o = new e(16), a = new e(20); n--; )
737
714
  r = t.times(t), t = t.times(s.plus(r.times(o.times(r).minus(a))));
738
715
  return t;
739
716
  }
740
- function he(e, t, n, i, r) {
741
- var s, o, a, u, c = e.precision, l = Math.ceil(c / T);
717
+ function ne(e, t, n, i, r) {
718
+ var s, o, a, u, c = e.precision, l = Math.ceil(c / v);
742
719
  for (I = !1, u = n.times(n), a = new e(i); ; ) {
743
- if (o = R(a.times(u), new e(t++ * t++), c, 1), a = r ? i.plus(o) : i.minus(o), i = R(o.times(u), new e(t++ * t++), c, 1), o = a.plus(i), o.d[l] !== void 0) {
720
+ if (o = x(a.times(u), new e(t++ * t++), c, 1), a = r ? i.plus(o) : i.minus(o), i = x(o.times(u), new e(t++ * t++), c, 1), o = a.plus(i), o.d[l] !== void 0) {
744
721
  for (s = l; o.d[s] === a.d[s] && s--; ) ;
745
722
  if (s == -1) break;
746
723
  }
@@ -748,43 +725,43 @@ function he(e, t, n, i, r) {
748
725
  }
749
726
  return I = !0, o.d.length = l + 1, o;
750
727
  }
751
- function Le(e, t) {
728
+ function Oe(e, t) {
752
729
  for (var n = e; --t; ) n *= e;
753
730
  return n;
754
731
  }
755
- function vt(e, t) {
756
- var n, i = t.s < 0, r = X(e, e.precision, 1), s = r.times(0.5);
732
+ function Et(e, t) {
733
+ var n, i = t.s < 0, r = j(e, e.precision, 1), s = r.times(0.5);
757
734
  if (t = t.abs(), t.lte(s))
758
- return W = i ? 4 : 1, t;
735
+ return G = i ? 4 : 1, t;
759
736
  if (n = t.divToInt(r), n.isZero())
760
- W = i ? 3 : 2;
737
+ G = i ? 3 : 2;
761
738
  else {
762
739
  if (t = t.minus(n.times(r)), t.lte(s))
763
- return W = tt(n) ? i ? 2 : 3 : i ? 4 : 1, t;
764
- W = tt(n) ? i ? 1 : 4 : i ? 3 : 2;
740
+ return G = Je(n) ? i ? 2 : 3 : i ? 4 : 1, t;
741
+ G = Je(n) ? i ? 1 : 4 : i ? 3 : 2;
765
742
  }
766
743
  return t.minus(r).abs();
767
744
  }
768
- function Qe(e, t, n, i) {
769
- var r, s, o, a, u, c, l, f, d, y = e.constructor, N = n !== void 0;
770
- if (N ? (G(n, 1, ie), i === void 0 ? i = y.rounding : G(i, 0, 8)) : (n = y.precision, i = y.rounding), !e.isFinite())
771
- l = wt(e);
745
+ function je(e, t, n, i) {
746
+ var r, s, o, a, u, c, l, f, h, m = e.constructor, N = n !== void 0;
747
+ if (N ? (P(n, 1, z), i === void 0 ? i = m.rounding : P(i, 0, 8)) : (n = m.precision, i = m.rounding), !e.isFinite())
748
+ l = gt(e);
772
749
  else {
773
- for (l = Z(e), o = l.indexOf("."), N ? (r = 2, t == 16 ? n = n * 4 - 3 : t == 8 && (n = n * 3 - 2)) : r = t, o >= 0 && (l = l.replace(".", ""), d = new y(1), d.e = l.length - o, d.d = Ie(Z(d), 10, r), d.e = d.d.length), f = Ie(l, 10, r), s = u = f.length; f[--u] == 0; ) f.pop();
750
+ for (l = $(e), o = l.indexOf("."), N ? (r = 2, t == 16 ? n = n * 4 - 3 : t == 8 && (n = n * 3 - 2)) : r = t, o >= 0 && (l = l.replace(".", ""), h = new m(1), h.e = l.length - o, h.d = de($(h), 10, r), h.e = h.d.length), f = de(l, 10, r), s = u = f.length; f[--u] == 0; ) f.pop();
774
751
  if (!f[0])
775
752
  l = N ? "0p+0" : "0";
776
753
  else {
777
- if (o < 0 ? s-- : (e = new y(e), e.d = f, e.e = s, e = R(e, d, n, i, 0, r), f = e.d, s = e.e, c = ht), o = f[n], a = r / 2, c = c || f[n + 1] !== void 0, c = i < 4 ? (o !== void 0 || c) && (i === 0 || i === (e.s < 0 ? 3 : 2)) : o > a || o === a && (i === 4 || c || i === 6 && f[n - 1] & 1 || i === (e.s < 0 ? 8 : 7)), f.length = n, c)
754
+ if (o < 0 ? s-- : (e = new m(e), e.d = f, e.e = s, e = x(e, h, n, i, 0, r), f = e.d, s = e.e, c = ct), o = f[n], a = r / 2, c = c || f[n + 1] !== void 0, c = i < 4 ? (o !== void 0 || c) && (i === 0 || i === (e.s < 0 ? 3 : 2)) : o > a || o === a && (i === 4 || c || i === 6 && f[n - 1] & 1 || i === (e.s < 0 ? 8 : 7)), f.length = n, c)
778
755
  for (; ++f[--n] > r - 1; )
779
756
  f[n] = 0, n || (++s, f.unshift(1));
780
757
  for (u = f.length; !f[u - 1]; --u) ;
781
- for (o = 0, l = ""; o < u; o++) l += je.charAt(f[o]);
758
+ for (o = 0, l = ""; o < u; o++) l += be.charAt(f[o]);
782
759
  if (N) {
783
760
  if (u > 1)
784
761
  if (t == 16 || t == 8) {
785
762
  for (o = t == 16 ? 4 : 3, --u; u % o; u++) l += "0";
786
- for (f = Ie(l, r, t), u = f.length; !f[u - 1]; --u) ;
787
- for (o = 1, l = "1."; o < u; o++) l += je.charAt(f[o]);
763
+ for (f = de(l, r, t), u = f.length; !f[u - 1]; --u) ;
764
+ for (o = 1, l = "1."; o < u; o++) l += be.charAt(f[o]);
788
765
  } else
789
766
  l = l.charAt(0) + "." + l.slice(1);
790
767
  l = l + (s < 0 ? "p" : "p+") + s;
@@ -798,102 +775,102 @@ function Qe(e, t, n, i) {
798
775
  }
799
776
  return e.s < 0 ? "-" + l : l;
800
777
  }
801
- function nt(e, t) {
778
+ function Qe(e, t) {
802
779
  if (e.length > t)
803
780
  return e.length = t, !0;
804
781
  }
805
- function $t(e) {
782
+ function Vt(e) {
806
783
  return new this(e).abs();
807
784
  }
808
- function Ht(e) {
785
+ function jt(e) {
809
786
  return new this(e).acos();
810
787
  }
811
- function Gt(e) {
788
+ function $t(e) {
812
789
  return new this(e).acosh();
813
790
  }
814
- function Yt(e, t) {
791
+ function Gt(e, t) {
815
792
  return new this(e).plus(t);
816
793
  }
817
- function Jt(e) {
794
+ function Yt(e) {
818
795
  return new this(e).asin();
819
796
  }
820
- function zt(e) {
797
+ function Ht(e) {
821
798
  return new this(e).asinh();
822
799
  }
823
- function Xt(e) {
800
+ function Jt(e) {
824
801
  return new this(e).atan();
825
802
  }
826
803
  function Qt(e) {
827
804
  return new this(e).atanh();
828
805
  }
829
- function Zt(e, t) {
806
+ function zt(e, t) {
830
807
  e = new this(e), t = new this(t);
831
808
  var n, i = this.precision, r = this.rounding, s = i + 4;
832
- return !e.s || !t.s ? n = new this(NaN) : !e.d && !t.d ? (n = X(this, s, 1).times(t.s > 0 ? 0.25 : 0.75), n.s = e.s) : !t.d || e.isZero() ? (n = t.s < 0 ? X(this, i, r) : new this(0), n.s = e.s) : !e.d || t.isZero() ? (n = X(this, s, 1).times(0.5), n.s = e.s) : t.s < 0 ? (this.precision = s, this.rounding = 1, n = this.atan(R(e, t, s, 1)), t = X(this, s, 1), this.precision = i, this.rounding = r, n = e.s < 0 ? n.minus(t) : n.plus(t)) : n = this.atan(R(e, t, s, 1)), n;
809
+ return !e.s || !t.s ? n = new this(NaN) : !e.d && !t.d ? (n = j(this, s, 1).times(t.s > 0 ? 0.25 : 0.75), n.s = e.s) : !t.d || e.isZero() ? (n = t.s < 0 ? j(this, i, r) : new this(0), n.s = e.s) : !e.d || t.isZero() ? (n = j(this, s, 1).times(0.5), n.s = e.s) : t.s < 0 ? (this.precision = s, this.rounding = 1, n = this.atan(x(e, t, s, 1)), t = j(this, s, 1), this.precision = i, this.rounding = r, n = e.s < 0 ? n.minus(t) : n.plus(t)) : n = this.atan(x(e, t, s, 1)), n;
833
810
  }
834
- function Wt(e) {
811
+ function Zt(e) {
835
812
  return new this(e).cbrt();
836
813
  }
837
- function Kt(e) {
838
- return v(e = new this(e), e.e + 1, 2);
814
+ function Xt(e) {
815
+ return T(e = new this(e), e.e + 1, 2);
839
816
  }
840
- function en(e, t, n) {
817
+ function Wt(e, t, n) {
841
818
  return new this(e).clamp(t, n);
842
819
  }
843
- function tn(e) {
844
- if (!e || typeof e != "object") throw Error(ke + "Object expected");
820
+ function Kt(e) {
821
+ if (!e || typeof e != "object") throw Error(ve + "Object expected");
845
822
  var t, n, i, r = e.defaults === !0, s = [
846
823
  "precision",
847
824
  1,
848
- ie,
825
+ z,
849
826
  "rounding",
850
827
  0,
851
828
  8,
852
829
  "toExpNeg",
853
- -le,
830
+ -ee,
854
831
  0,
855
832
  "toExpPos",
856
833
  0,
857
- le,
834
+ ee,
858
835
  "maxE",
859
836
  0,
860
- le,
837
+ ee,
861
838
  "minE",
862
- -le,
839
+ -ee,
863
840
  0,
864
841
  "modulo",
865
842
  0,
866
843
  9
867
844
  ];
868
845
  for (t = 0; t < s.length; t += 3)
869
- if (n = s[t], r && (this[n] = $e[n]), (i = e[n]) !== void 0)
870
- if (j(i) === i && i >= s[t + 1] && i <= s[t + 2]) this[n] = i;
871
- else throw Error(ne + n + ": " + i);
872
- if (n = "crypto", r && (this[n] = $e[n]), (i = e[n]) !== void 0)
846
+ if (n = s[t], r && (this[n] = Le[n]), (i = e[n]) !== void 0)
847
+ if (F(i) === i && i >= s[t + 1] && i <= s[t + 2]) this[n] = i;
848
+ else throw Error(Q + n + ": " + i);
849
+ if (n = "crypto", r && (this[n] = Le[n]), (i = e[n]) !== void 0)
873
850
  if (i === !0 || i === !1 || i === 0 || i === 1)
874
851
  if (i)
875
852
  if (typeof crypto < "u" && crypto && (crypto.getRandomValues || crypto.randomBytes))
876
853
  this[n] = !0;
877
854
  else
878
- throw Error(pt);
855
+ throw Error(lt);
879
856
  else
880
857
  this[n] = !1;
881
858
  else
882
- throw Error(ne + n + ": " + i);
859
+ throw Error(Q + n + ": " + i);
883
860
  return this;
884
861
  }
885
- function nn(e) {
862
+ function en(e) {
886
863
  return new this(e).cos();
887
864
  }
888
- function rn(e) {
865
+ function tn(e) {
889
866
  return new this(e).cosh();
890
867
  }
891
- function Tt(e) {
868
+ function Nt(e) {
892
869
  var t, n, i;
893
870
  function r(s) {
894
871
  var o, a, u, c = this;
895
872
  if (!(c instanceof r)) return new r(s);
896
- if (c.constructor = r, it(s)) {
873
+ if (c.constructor = r, ze(s)) {
897
874
  c.s = s.s, I ? !s.d || s.e > r.maxE ? (c.e = NaN, c.d = null) : s.e < r.minE ? (c.e = 0, c.d = [0]) : (c.e = s.e, c.d = s.d.slice()) : (c.e = s.e, c.d = s.d ? s.d.slice() : s.d);
898
875
  return;
899
876
  }
@@ -906,29 +883,33 @@ function Tt(e) {
906
883
  for (o = 0, a = s; a >= 10; a /= 10) o++;
907
884
  I ? o > r.maxE ? (c.e = NaN, c.d = null) : o < r.minE ? (c.e = 0, c.d = [0]) : (c.e = o, c.d = [s]) : (c.e = o, c.d = [s]);
908
885
  return;
909
- } else if (s * 0 !== 0) {
886
+ }
887
+ if (s * 0 !== 0) {
910
888
  s || (c.s = NaN), c.e = NaN, c.d = null;
911
889
  return;
912
890
  }
913
- return Ye(c, s.toString());
914
- } else if (u !== "string")
915
- throw Error(ne + s);
916
- return (a = s.charCodeAt(0)) === 45 ? (s = s.slice(1), c.s = -1) : (a === 43 && (s = s.slice(1)), c.s = 1), gt.test(s) ? Ye(c, s) : Vt(c, s);
891
+ return pe(c, s.toString());
892
+ }
893
+ if (u === "string")
894
+ return (a = s.charCodeAt(0)) === 45 ? (s = s.slice(1), c.s = -1) : (a === 43 && (s = s.slice(1)), c.s = 1), ht.test(s) ? pe(c, s) : Bt(c, s);
895
+ if (u === "bigint")
896
+ return s < 0 ? (s = -s, c.s = -1) : c.s = 1, pe(c, s.toString());
897
+ throw Error(Q + s);
917
898
  }
918
- if (r.prototype = g, r.ROUND_UP = 0, r.ROUND_DOWN = 1, r.ROUND_CEIL = 2, r.ROUND_FLOOR = 3, r.ROUND_HALF_UP = 4, r.ROUND_HALF_DOWN = 5, r.ROUND_HALF_EVEN = 6, r.ROUND_HALF_CEIL = 7, r.ROUND_HALF_FLOOR = 8, r.EUCLID = 9, r.config = r.set = tn, r.clone = Tt, r.isDecimal = it, r.abs = $t, r.acos = Ht, r.acosh = Gt, r.add = Yt, r.asin = Jt, r.asinh = zt, r.atan = Xt, r.atanh = Qt, r.atan2 = Zt, r.cbrt = Wt, r.ceil = Kt, r.clamp = en, r.cos = nn, r.cosh = rn, r.div = sn, r.exp = on, r.floor = an, r.hypot = cn, r.ln = un, r.log = ln, r.log10 = hn, r.log2 = fn, r.max = dn, r.min = pn, r.mod = mn, r.mul = gn, r.pow = En, r.random = yn, r.round = Nn, r.sign = wn, r.sin = vn, r.sinh = Tn, r.sqrt = An, r.sub = In, r.sum = On, r.tan = bn, r.tanh = _n, r.trunc = Dn, e === void 0 && (e = {}), e && e.defaults !== !0)
899
+ if (r.prototype = p, r.ROUND_UP = 0, r.ROUND_DOWN = 1, r.ROUND_CEIL = 2, r.ROUND_FLOOR = 3, r.ROUND_HALF_UP = 4, r.ROUND_HALF_DOWN = 5, r.ROUND_HALF_EVEN = 6, r.ROUND_HALF_CEIL = 7, r.ROUND_HALF_FLOOR = 8, r.EUCLID = 9, r.config = r.set = Kt, r.clone = Nt, r.isDecimal = ze, r.abs = Vt, r.acos = jt, r.acosh = $t, r.add = Gt, r.asin = Yt, r.asinh = Ht, r.atan = Jt, r.atanh = Qt, r.atan2 = zt, r.cbrt = Zt, r.ceil = Xt, r.clamp = Wt, r.cos = en, r.cosh = tn, r.div = nn, r.exp = rn, r.floor = sn, r.hypot = on, r.ln = an, r.log = cn, r.log10 = ln, r.log2 = un, r.max = fn, r.min = hn, r.mod = dn, r.mul = pn, r.pow = mn, r.random = gn, r.round = En, r.sign = Nn, r.sin = Tn, r.sinh = wn, r.sqrt = vn, r.sub = In, r.sum = On, r.tan = An, r.tanh = yn, r.trunc = xn, e === void 0 && (e = {}), e && e.defaults !== !0)
919
900
  for (i = ["precision", "rounding", "toExpNeg", "toExpPos", "maxE", "minE", "modulo", "crypto"], t = 0; t < i.length; ) e.hasOwnProperty(n = i[t++]) || (e[n] = this[n]);
920
901
  return r.config(e), r;
921
902
  }
922
- function sn(e, t) {
903
+ function nn(e, t) {
923
904
  return new this(e).div(t);
924
905
  }
925
- function on(e) {
906
+ function rn(e) {
926
907
  return new this(e).exp();
927
908
  }
928
- function an(e) {
929
- return v(e = new this(e), e.e + 1, 3);
909
+ function sn(e) {
910
+ return T(e = new this(e), e.e + 1, 3);
930
911
  }
931
- function cn() {
912
+ function on() {
932
913
  var e, t, n = new this(0);
933
914
  for (I = !1, e = 0; e < arguments.length; )
934
915
  if (t = new this(arguments[e++]), t.d)
@@ -940,39 +921,39 @@ function cn() {
940
921
  }
941
922
  return I = !0, n.sqrt();
942
923
  }
943
- function it(e) {
944
- return e instanceof de || e && e.toStringTag === mt || !1;
924
+ function ze(e) {
925
+ return e instanceof ie || e && e.toStringTag === ft || !1;
945
926
  }
946
- function un(e) {
927
+ function an(e) {
947
928
  return new this(e).ln();
948
929
  }
949
- function ln(e, t) {
930
+ function cn(e, t) {
950
931
  return new this(e).log(t);
951
932
  }
952
- function fn(e) {
933
+ function un(e) {
953
934
  return new this(e).log(2);
954
935
  }
955
- function hn(e) {
936
+ function ln(e) {
956
937
  return new this(e).log(10);
957
938
  }
958
- function dn() {
959
- return Nt(this, arguments, "lt");
939
+ function fn() {
940
+ return mt(this, arguments, -1);
960
941
  }
961
- function pn() {
962
- return Nt(this, arguments, "gt");
942
+ function hn() {
943
+ return mt(this, arguments, 1);
963
944
  }
964
- function mn(e, t) {
945
+ function dn(e, t) {
965
946
  return new this(e).mod(t);
966
947
  }
967
- function gn(e, t) {
948
+ function pn(e, t) {
968
949
  return new this(e).mul(t);
969
950
  }
970
- function En(e, t) {
951
+ function mn(e, t) {
971
952
  return new this(e).pow(t);
972
953
  }
973
- function yn(e) {
954
+ function gn(e) {
974
955
  var t, n, i, r, s = 0, o = new this(1), a = [];
975
- if (e === void 0 ? e = this.precision : G(e, 1, ie), i = Math.ceil(e / T), this.crypto)
956
+ if (e === void 0 ? e = this.precision : P(e, 1, z), i = Math.ceil(e / v), this.crypto)
976
957
  if (crypto.getRandomValues)
977
958
  for (t = crypto.getRandomValues(new Uint32Array(i)); s < i; )
978
959
  r = t[s], r >= 429e7 ? t[s] = crypto.getRandomValues(new Uint32Array(1))[0] : a[s++] = r % 1e7;
@@ -981,31 +962,31 @@ function yn(e) {
981
962
  r = t[s] + (t[s + 1] << 8) + (t[s + 2] << 16) + ((t[s + 3] & 127) << 24), r >= 214e7 ? crypto.randomBytes(4).copy(t, s) : (a.push(r % 1e7), s += 4);
982
963
  s = i / 4;
983
964
  } else
984
- throw Error(pt);
965
+ throw Error(lt);
985
966
  else for (; s < i; ) a[s++] = Math.random() * 1e7 | 0;
986
- for (i = a[--s], e %= T, i && e && (r = P(10, T - e), a[s] = (i / r | 0) * r); a[s] === 0; s--) a.pop();
967
+ for (i = a[--s], e %= v, i && e && (r = k(10, v - e), a[s] = (i / r | 0) * r); a[s] === 0; s--) a.pop();
987
968
  if (s < 0)
988
969
  n = 0, a = [0];
989
970
  else {
990
- for (n = -1; a[0] === 0; n -= T) a.shift();
971
+ for (n = -1; a[0] === 0; n -= v) a.shift();
991
972
  for (i = 1, r = a[0]; r >= 10; r /= 10) i++;
992
- i < T && (n -= T - i);
973
+ i < v && (n -= v - i);
993
974
  }
994
975
  return o.e = n, o.d = a, o;
995
976
  }
996
- function Nn(e) {
997
- return v(e = new this(e), e.e + 1, this.rounding);
977
+ function En(e) {
978
+ return T(e = new this(e), e.e + 1, this.rounding);
998
979
  }
999
- function wn(e) {
980
+ function Nn(e) {
1000
981
  return e = new this(e), e.d ? e.d[0] ? e.s : 0 * e.s : e.s || NaN;
1001
982
  }
1002
- function vn(e) {
983
+ function Tn(e) {
1003
984
  return new this(e).sin();
1004
985
  }
1005
- function Tn(e) {
986
+ function wn(e) {
1006
987
  return new this(e).sinh();
1007
988
  }
1008
- function An(e) {
989
+ function vn(e) {
1009
990
  return new this(e).sqrt();
1010
991
  }
1011
992
  function In(e, t) {
@@ -1014,60 +995,83 @@ function In(e, t) {
1014
995
  function On() {
1015
996
  var e = 0, t = arguments, n = new this(t[e]);
1016
997
  for (I = !1; n.s && ++e < t.length; ) n = n.plus(t[e]);
1017
- return I = !0, v(n, this.precision, this.rounding);
998
+ return I = !0, T(n, this.precision, this.rounding);
1018
999
  }
1019
- function bn(e) {
1000
+ function An(e) {
1020
1001
  return new this(e).tan();
1021
1002
  }
1022
- function _n(e) {
1003
+ function yn(e) {
1023
1004
  return new this(e).tanh();
1024
1005
  }
1025
- function Dn(e) {
1026
- return v(e = new this(e), e.e + 1, 1);
1006
+ function xn(e) {
1007
+ return T(e = new this(e), e.e + 1, 1);
1008
+ }
1009
+ p[/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")] = p.toString;
1010
+ p[Symbol.toStringTag] = "Decimal";
1011
+ var ie = p.constructor = Nt(Le);
1012
+ Ne = new ie(Ne);
1013
+ Te = new ie(Te);
1014
+ class Z extends Error {
1015
+ response;
1016
+ request;
1017
+ constructor(t, n) {
1018
+ const i = `${Z.extractMessage(t)}: ${JSON.stringify({
1019
+ response: t,
1020
+ request: n
1021
+ })}`;
1022
+ super(i), Object.setPrototypeOf(this, Z.prototype), this.response = t, this.request = n, typeof Error.captureStackTrace == "function" && Error.captureStackTrace(this, Z);
1023
+ }
1024
+ static extractMessage(t) {
1025
+ return t.errors?.[0]?.message ?? `GraphQL Error (Code: ${String(t.status)})`;
1026
+ }
1027
1027
  }
1028
- g[Symbol.for("nodejs.util.inspect.custom")] = g.toString;
1029
- g[Symbol.toStringTag] = "Decimal";
1030
- var de = g.constructor = Tt($e);
1031
- De = new de(De);
1032
- Se = new de(Se);
1033
- const Ze = JSON, Sn = (e) => e.toUpperCase(), xn = (e) => {
1028
+ const Ze = (e) => e.toUpperCase(), _e = (e) => typeof e == "function" ? e() : e, Tt = (e, t) => e.map((n, i) => [n, t[i]]), K = (e) => {
1029
+ let t = {};
1030
+ return e instanceof Headers ? t = Dn(e) : Array.isArray(e) ? e.forEach(([n, i]) => {
1031
+ n && i !== void 0 && (t[n] = i);
1032
+ }) : e && (t = e), t;
1033
+ }, Dn = (e) => {
1034
1034
  const t = {};
1035
1035
  return e.forEach((n, i) => {
1036
1036
  t[i] = n;
1037
1037
  }), t;
1038
- }, Cn = (e, t, n) => e.document ? e : {
1039
- document: e,
1040
- variables: t,
1041
- requestHeaders: n,
1038
+ }, _n = (e) => {
1039
+ try {
1040
+ const t = e();
1041
+ return Sn(t) ? t.catch((n) => Xe(n)) : t;
1042
+ } catch (t) {
1043
+ return Xe(t);
1044
+ }
1045
+ }, Xe = (e) => e instanceof Error ? e : new Error(String(e)), Sn = (e) => typeof e == "object" && e !== null && "then" in e && typeof e.then == "function" && "catch" in e && typeof e.catch == "function" && "finally" in e && typeof e.finally == "function", $e = (e) => {
1046
+ throw new Error(`Unhandled case: ${String(e)}`);
1047
+ }, me = (e) => typeof e == "object" && e !== null && !Array.isArray(e), Cn = (e, t) => e.documents ? e : {
1048
+ documents: e,
1049
+ requestHeaders: t,
1042
1050
  signal: void 0
1043
1051
  }, kn = (e, t, n) => e.query ? e : {
1044
1052
  query: e,
1045
1053
  variables: t,
1046
1054
  requestHeaders: n,
1047
1055
  signal: void 0
1048
- }, Rn = (e, t) => e.documents ? e : {
1049
- documents: e,
1050
- requestHeaders: t,
1051
- signal: void 0
1052
1056
  };
1053
- function Oe(e, t) {
1057
+ function ge(e, t) {
1054
1058
  if (!!!e)
1055
1059
  throw new Error(t);
1056
1060
  }
1057
- function Ln(e) {
1061
+ function Rn(e) {
1058
1062
  return typeof e == "object" && e !== null;
1059
1063
  }
1060
- function Fn(e, t) {
1064
+ function bn(e, t) {
1061
1065
  if (!!!e)
1062
1066
  throw new Error(
1063
1067
  "Unexpected invariant triggered."
1064
1068
  );
1065
1069
  }
1066
- const Pn = /\r\n|[\n\r]/g;
1067
- function Je(e, t) {
1070
+ const Ln = /\r\n|[\n\r]/g;
1071
+ function Pe(e, t) {
1068
1072
  let n = 0, i = 1;
1069
- for (const r of e.body.matchAll(Pn)) {
1070
- if (typeof r.index == "number" || Fn(!1), r.index >= t)
1073
+ for (const r of e.body.matchAll(Ln)) {
1074
+ if (typeof r.index == "number" || bn(!1), r.index >= t)
1071
1075
  break;
1072
1076
  n = r.index + r[0].length, i += 1;
1073
1077
  }
@@ -1076,27 +1080,27 @@ function Je(e, t) {
1076
1080
  column: t + 1 - n
1077
1081
  };
1078
1082
  }
1079
- function Mn(e) {
1080
- return At(
1083
+ function Fn(e) {
1084
+ return wt(
1081
1085
  e.source,
1082
- Je(e.source, e.start)
1086
+ Pe(e.source, e.start)
1083
1087
  );
1084
1088
  }
1085
- function At(e, t) {
1089
+ function wt(e, t) {
1086
1090
  const n = e.locationOffset.column - 1, i = "".padStart(n) + e.body, r = t.line - 1, s = e.locationOffset.line - 1, o = t.line + s, a = t.line === 1 ? n : 0, u = t.column + a, c = `${e.name}:${o}:${u}
1087
1091
  `, l = i.split(/\r\n|[\n\r]/g), f = l[r];
1088
1092
  if (f.length > 120) {
1089
- const d = Math.floor(u / 80), y = u % 80, N = [];
1093
+ const h = Math.floor(u / 80), m = u % 80, N = [];
1090
1094
  for (let E = 0; E < f.length; E += 80)
1091
1095
  N.push(f.slice(E, E + 80));
1092
- return c + rt([
1096
+ return c + We([
1093
1097
  [`${o} |`, N[0]],
1094
- ...N.slice(1, d + 1).map((E) => ["|", E]),
1095
- ["|", "^".padStart(y)],
1096
- ["|", N[d + 1]]
1098
+ ...N.slice(1, h + 1).map((E) => ["|", E]),
1099
+ ["|", "^".padStart(m)],
1100
+ ["|", N[h + 1]]
1097
1101
  ]);
1098
1102
  }
1099
- return c + rt([
1103
+ return c + We([
1100
1104
  // Lines specified like this: ["prefix", "string"],
1101
1105
  [`${o - 1} |`, l[r - 1]],
1102
1106
  [`${o} |`, f],
@@ -1104,12 +1108,12 @@ function At(e, t) {
1104
1108
  [`${o + 1} |`, l[r + 1]]
1105
1109
  ]);
1106
1110
  }
1107
- function rt(e) {
1111
+ function We(e) {
1108
1112
  const t = e.filter(([i, r]) => r !== void 0), n = Math.max(...t.map(([i]) => i.length));
1109
1113
  return t.map(([i, r]) => i.padStart(n) + (r ? " " + r : "")).join(`
1110
1114
  `);
1111
1115
  }
1112
- function Bn(e) {
1116
+ function Mn(e) {
1113
1117
  const t = e[0];
1114
1118
  return t == null || "kind" in t || "length" in t ? {
1115
1119
  nodes: t,
@@ -1120,7 +1124,7 @@ function Bn(e) {
1120
1124
  extensions: e[5]
1121
1125
  } : t;
1122
1126
  }
1123
- class We extends Error {
1127
+ class Ge extends Error {
1124
1128
  /**
1125
1129
  * An array of `{ line, column }` locations within the source GraphQL document
1126
1130
  * which correspond to this error.
@@ -1161,18 +1165,18 @@ class We extends Error {
1161
1165
  */
1162
1166
  constructor(t, ...n) {
1163
1167
  var i, r, s;
1164
- const { nodes: o, source: a, positions: u, path: c, originalError: l, extensions: f } = Bn(n);
1165
- super(t), this.name = "GraphQLError", this.path = c ?? void 0, this.originalError = l ?? void 0, this.nodes = st(
1168
+ const { nodes: o, source: a, positions: u, path: c, originalError: l, extensions: f } = Mn(n);
1169
+ super(t), this.name = "GraphQLError", this.path = c ?? void 0, this.originalError = l ?? void 0, this.nodes = Ke(
1166
1170
  Array.isArray(o) ? o : o ? [o] : void 0
1167
1171
  );
1168
- const d = st(
1172
+ const h = Ke(
1169
1173
  (i = this.nodes) === null || i === void 0 ? void 0 : i.map((N) => N.loc).filter((N) => N != null)
1170
1174
  );
1171
- this.source = a ?? (d == null || (r = d[0]) === null || r === void 0 ? void 0 : r.source), this.positions = u ?? d?.map((N) => N.start), this.locations = u && a ? u.map((N) => Je(a, N)) : d?.map((N) => Je(N.source, N.start));
1172
- const y = Ln(
1175
+ this.source = a ?? (h == null || (r = h[0]) === null || r === void 0 ? void 0 : r.source), this.positions = u ?? h?.map((N) => N.start), this.locations = u && a ? u.map((N) => Pe(a, N)) : h?.map((N) => Pe(N.source, N.start));
1176
+ const m = Rn(
1173
1177
  l?.extensions
1174
1178
  ) ? l?.extensions : void 0;
1175
- this.extensions = (s = f ?? y) !== null && s !== void 0 ? s : /* @__PURE__ */ Object.create(null), Object.defineProperties(this, {
1179
+ this.extensions = (s = f ?? m) !== null && s !== void 0 ? s : /* @__PURE__ */ Object.create(null), Object.defineProperties(this, {
1176
1180
  message: {
1177
1181
  writable: !0,
1178
1182
  enumerable: !0
@@ -1196,7 +1200,7 @@ class We extends Error {
1196
1200
  value: l.stack,
1197
1201
  writable: !0,
1198
1202
  configurable: !0
1199
- }) : Error.captureStackTrace ? Error.captureStackTrace(this, We) : Object.defineProperty(this, "stack", {
1203
+ }) : Error.captureStackTrace ? Error.captureStackTrace(this, Ge) : Object.defineProperty(this, "stack", {
1200
1204
  value: Error().stack,
1201
1205
  writable: !0,
1202
1206
  configurable: !0
@@ -1211,12 +1215,12 @@ class We extends Error {
1211
1215
  for (const n of this.nodes)
1212
1216
  n.loc && (t += `
1213
1217
 
1214
- ` + Mn(n.loc));
1218
+ ` + Fn(n.loc));
1215
1219
  else if (this.source && this.locations)
1216
1220
  for (const n of this.locations)
1217
1221
  t += `
1218
1222
 
1219
- ` + At(this.source, n);
1223
+ ` + wt(this.source, n);
1220
1224
  return t;
1221
1225
  }
1222
1226
  toJSON() {
@@ -1226,16 +1230,16 @@ class We extends Error {
1226
1230
  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;
1227
1231
  }
1228
1232
  }
1229
- function st(e) {
1233
+ function Ke(e) {
1230
1234
  return e === void 0 || e.length === 0 ? void 0 : e;
1231
1235
  }
1232
- function M(e, t, n) {
1233
- return new We(`Syntax Error: ${n}`, {
1236
+ function R(e, t, n) {
1237
+ return new Ge(`Syntax Error: ${n}`, {
1234
1238
  source: e,
1235
1239
  positions: [t]
1236
1240
  });
1237
1241
  }
1238
- class Un {
1242
+ class Pn {
1239
1243
  /**
1240
1244
  * The character offset at which this Node begins.
1241
1245
  */
@@ -1264,7 +1268,7 @@ class Un {
1264
1268
  };
1265
1269
  }
1266
1270
  }
1267
- class It {
1271
+ class vt {
1268
1272
  /**
1269
1273
  * The kind of Token.
1270
1274
  */
@@ -1306,16 +1310,23 @@ class It {
1306
1310
  };
1307
1311
  }
1308
1312
  }
1309
- const Ot = {
1313
+ const It = {
1310
1314
  Name: [],
1311
1315
  Document: ["definitions"],
1312
1316
  OperationDefinition: [
1317
+ "description",
1313
1318
  "name",
1314
1319
  "variableDefinitions",
1315
1320
  "directives",
1316
1321
  "selectionSet"
1317
1322
  ],
1318
- VariableDefinition: ["variable", "type", "defaultValue", "directives"],
1323
+ VariableDefinition: [
1324
+ "description",
1325
+ "variable",
1326
+ "type",
1327
+ "defaultValue",
1328
+ "directives"
1329
+ ],
1319
1330
  Variable: ["name"],
1320
1331
  SelectionSet: ["selections"],
1321
1332
  Field: ["alias", "name", "arguments", "directives", "selectionSet"],
@@ -1323,6 +1334,7 @@ const Ot = {
1323
1334
  FragmentSpread: ["name", "directives"],
1324
1335
  InlineFragment: ["typeCondition", "directives", "selectionSet"],
1325
1336
  FragmentDefinition: [
1337
+ "description",
1326
1338
  "name",
1327
1339
  // Note: fragment variable definitions are deprecated and will removed in v17.0.0
1328
1340
  "variableDefinitions",
@@ -1379,46 +1391,51 @@ const Ot = {
1379
1391
  InterfaceTypeExtension: ["name", "interfaces", "directives", "fields"],
1380
1392
  UnionTypeExtension: ["name", "directives", "types"],
1381
1393
  EnumTypeExtension: ["name", "directives", "values"],
1382
- InputObjectTypeExtension: ["name", "directives", "fields"]
1383
- }, qn = new Set(Object.keys(Ot));
1384
- function ot(e) {
1394
+ InputObjectTypeExtension: ["name", "directives", "fields"],
1395
+ TypeCoordinate: ["name"],
1396
+ MemberCoordinate: ["name", "memberName"],
1397
+ ArgumentCoordinate: ["name", "fieldName", "argumentName"],
1398
+ DirectiveCoordinate: ["name"],
1399
+ DirectiveArgumentCoordinate: ["name", "argumentName"]
1400
+ }, qn = new Set(Object.keys(It));
1401
+ function et(e) {
1385
1402
  const t = e?.kind;
1386
1403
  return typeof t == "string" && qn.has(t);
1387
1404
  }
1388
- var fe;
1405
+ var te;
1389
1406
  (function(e) {
1390
1407
  e.QUERY = "query", e.MUTATION = "mutation", e.SUBSCRIPTION = "subscription";
1391
- })(fe || (fe = {}));
1392
- var ze;
1408
+ })(te || (te = {}));
1409
+ var qe;
1393
1410
  (function(e) {
1394
1411
  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";
1395
- })(ze || (ze = {}));
1396
- var A;
1412
+ })(qe || (qe = {}));
1413
+ var w;
1397
1414
  (function(e) {
1398
- 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";
1399
- })(A || (A = {}));
1400
- function Xe(e) {
1415
+ 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";
1416
+ })(w || (w = {}));
1417
+ function Be(e) {
1401
1418
  return e === 9 || e === 32;
1402
1419
  }
1403
- function Ne(e) {
1420
+ function ce(e) {
1404
1421
  return e >= 48 && e <= 57;
1405
1422
  }
1406
- function bt(e) {
1423
+ function Ot(e) {
1407
1424
  return e >= 97 && e <= 122 || // A-Z
1408
1425
  e >= 65 && e <= 90;
1409
1426
  }
1410
- function _t(e) {
1411
- return bt(e) || e === 95;
1427
+ function At(e) {
1428
+ return Ot(e) || e === 95;
1412
1429
  }
1413
- function Vn(e) {
1414
- return bt(e) || Ne(e) || e === 95;
1430
+ function Bn(e) {
1431
+ return Ot(e) || ce(e) || e === 95;
1415
1432
  }
1416
- function jn(e) {
1433
+ function Un(e) {
1417
1434
  var t;
1418
1435
  let n = Number.MAX_SAFE_INTEGER, i = null, r = -1;
1419
1436
  for (let o = 0; o < e.length; ++o) {
1420
1437
  var s;
1421
- const a = e[o], u = $n(a);
1438
+ const a = e[o], u = Vn(a);
1422
1439
  u !== a.length && (i = (s = i) !== null && s !== void 0 ? s : o, r = o, o !== 0 && u < n && (n = u));
1423
1440
  }
1424
1441
  return e.map((o, a) => a === 0 ? o : o.slice(n)).slice(
@@ -1426,28 +1443,28 @@ function jn(e) {
1426
1443
  r + 1
1427
1444
  );
1428
1445
  }
1429
- function $n(e) {
1446
+ function Vn(e) {
1430
1447
  let t = 0;
1431
- for (; t < e.length && Xe(e.charCodeAt(t)); )
1448
+ for (; t < e.length && Be(e.charCodeAt(t)); )
1432
1449
  ++t;
1433
1450
  return t;
1434
1451
  }
1435
- function Hn(e, t) {
1436
- const n = e.replace(/"""/g, '\\"""'), i = n.split(/\r\n|[\n\r]/g), r = i.length === 1, s = i.length > 1 && i.slice(1).every((y) => y.length === 0 || Xe(y.charCodeAt(0))), o = n.endsWith('\\"""'), a = e.endsWith('"') && !o, u = e.endsWith("\\"), c = a || u, l = (
1452
+ function jn(e, t) {
1453
+ const n = e.replace(/"""/g, '\\"""'), i = n.split(/\r\n|[\n\r]/g), r = i.length === 1, s = i.length > 1 && i.slice(1).every((m) => m.length === 0 || Be(m.charCodeAt(0))), o = n.endsWith('\\"""'), a = e.endsWith('"') && !o, u = e.endsWith("\\"), c = a || u, l = (
1437
1454
  // add leading and trailing new lines only if it improves readability
1438
1455
  !r || e.length > 70 || c || s || o
1439
1456
  );
1440
1457
  let f = "";
1441
- const d = r && Xe(e.charCodeAt(0));
1442
- return (l && !d || s) && (f += `
1458
+ const h = r && Be(e.charCodeAt(0));
1459
+ return (l && !h || s) && (f += `
1443
1460
  `), f += n, (l || c) && (f += `
1444
1461
  `), '"""' + f + '"""';
1445
1462
  }
1446
- var m;
1463
+ var d;
1447
1464
  (function(e) {
1448
- e.SOF = "<SOF>", e.EOF = "<EOF>", e.BANG = "!", e.DOLLAR = "$", e.AMP = "&", e.PAREN_L = "(", e.PAREN_R = ")", 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";
1449
- })(m || (m = {}));
1450
- class Gn {
1465
+ 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";
1466
+ })(d || (d = {}));
1467
+ class $n {
1451
1468
  /**
1452
1469
  * The previously focused non-ignored token.
1453
1470
  */
@@ -1461,7 +1478,7 @@ class Gn {
1461
1478
  * The character offset at which the current line begins.
1462
1479
  */
1463
1480
  constructor(t) {
1464
- const n = new It(m.SOF, 0, 0, 0, 0);
1481
+ const n = new vt(d.SOF, 0, 0, 0, 0);
1465
1482
  this.source = t, this.lastToken = n, this.token = n, this.line = 1, this.lineStart = 0;
1466
1483
  }
1467
1484
  get [Symbol.toStringTag]() {
@@ -1479,48 +1496,48 @@ class Gn {
1479
1496
  */
1480
1497
  lookahead() {
1481
1498
  let t = this.token;
1482
- if (t.kind !== m.EOF)
1499
+ if (t.kind !== d.EOF)
1483
1500
  do
1484
1501
  if (t.next)
1485
1502
  t = t.next;
1486
1503
  else {
1487
- const n = Jn(this, t.end);
1504
+ const n = Yn(this, t.end);
1488
1505
  t.next = n, n.prev = t, t = n;
1489
1506
  }
1490
- while (t.kind === m.COMMENT);
1507
+ while (t.kind === d.COMMENT);
1491
1508
  return t;
1492
1509
  }
1493
1510
  }
1494
- function Yn(e) {
1495
- return e === m.BANG || e === m.DOLLAR || e === m.AMP || e === m.PAREN_L || e === m.PAREN_R || e === m.SPREAD || e === m.COLON || e === m.EQUALS || e === m.AT || e === m.BRACKET_L || e === m.BRACKET_R || e === m.BRACE_L || e === m.PIPE || e === m.BRACE_R;
1511
+ function Gn(e) {
1512
+ return e === d.BANG || e === d.DOLLAR || e === d.AMP || e === d.PAREN_L || e === d.PAREN_R || e === d.DOT || e === d.SPREAD || e === d.COLON || e === d.EQUALS || e === d.AT || e === d.BRACKET_L || e === d.BRACKET_R || e === d.BRACE_L || e === d.PIPE || e === d.BRACE_R;
1496
1513
  }
1497
- function pe(e) {
1514
+ function re(e) {
1498
1515
  return e >= 0 && e <= 55295 || e >= 57344 && e <= 1114111;
1499
1516
  }
1500
- function Fe(e, t) {
1501
- return Dt(e.charCodeAt(t)) && St(e.charCodeAt(t + 1));
1517
+ function Ae(e, t) {
1518
+ return yt(e.charCodeAt(t)) && xt(e.charCodeAt(t + 1));
1502
1519
  }
1503
- function Dt(e) {
1520
+ function yt(e) {
1504
1521
  return e >= 55296 && e <= 56319;
1505
1522
  }
1506
- function St(e) {
1523
+ function xt(e) {
1507
1524
  return e >= 56320 && e <= 57343;
1508
1525
  }
1509
- function oe(e, t) {
1526
+ function X(e, t) {
1510
1527
  const n = e.source.body.codePointAt(t);
1511
1528
  if (n === void 0)
1512
- return m.EOF;
1529
+ return d.EOF;
1513
1530
  if (n >= 32 && n <= 126) {
1514
1531
  const i = String.fromCodePoint(n);
1515
1532
  return i === '"' ? `'"'` : `"${i}"`;
1516
1533
  }
1517
1534
  return "U+" + n.toString(16).toUpperCase().padStart(4, "0");
1518
1535
  }
1519
- function F(e, t, n, i, r) {
1536
+ function S(e, t, n, i, r) {
1520
1537
  const s = e.line, o = 1 + n - e.lineStart;
1521
- return new It(t, n, i, s, o, r);
1538
+ return new vt(t, n, i, s, o, r);
1522
1539
  }
1523
- function Jn(e, t) {
1540
+ function Yn(e, t) {
1524
1541
  const n = e.source.body, i = n.length;
1525
1542
  let r = t;
1526
1543
  for (; r < i; ) {
@@ -1561,7 +1578,7 @@ function Jn(e, t) {
1561
1578
  continue;
1562
1579
  // Comment
1563
1580
  case 35:
1564
- return zn(e, r);
1581
+ return Hn(e, r);
1565
1582
  // Token ::
1566
1583
  // - Punctuator
1567
1584
  // - Name
@@ -1571,118 +1588,118 @@ function Jn(e, t) {
1571
1588
  //
1572
1589
  // Punctuator :: one of ! $ & ( ) ... : = @ [ ] { | }
1573
1590
  case 33:
1574
- return F(e, m.BANG, r, r + 1);
1591
+ return S(e, d.BANG, r, r + 1);
1575
1592
  case 36:
1576
- return F(e, m.DOLLAR, r, r + 1);
1593
+ return S(e, d.DOLLAR, r, r + 1);
1577
1594
  case 38:
1578
- return F(e, m.AMP, r, r + 1);
1595
+ return S(e, d.AMP, r, r + 1);
1579
1596
  case 40:
1580
- return F(e, m.PAREN_L, r, r + 1);
1597
+ return S(e, d.PAREN_L, r, r + 1);
1581
1598
  case 41:
1582
- return F(e, m.PAREN_R, r, r + 1);
1599
+ return S(e, d.PAREN_R, r, r + 1);
1583
1600
  case 46:
1584
1601
  if (n.charCodeAt(r + 1) === 46 && n.charCodeAt(r + 2) === 46)
1585
- return F(e, m.SPREAD, r, r + 3);
1602
+ return S(e, d.SPREAD, r, r + 3);
1586
1603
  break;
1587
1604
  case 58:
1588
- return F(e, m.COLON, r, r + 1);
1605
+ return S(e, d.COLON, r, r + 1);
1589
1606
  case 61:
1590
- return F(e, m.EQUALS, r, r + 1);
1607
+ return S(e, d.EQUALS, r, r + 1);
1591
1608
  case 64:
1592
- return F(e, m.AT, r, r + 1);
1609
+ return S(e, d.AT, r, r + 1);
1593
1610
  case 91:
1594
- return F(e, m.BRACKET_L, r, r + 1);
1611
+ return S(e, d.BRACKET_L, r, r + 1);
1595
1612
  case 93:
1596
- return F(e, m.BRACKET_R, r, r + 1);
1613
+ return S(e, d.BRACKET_R, r, r + 1);
1597
1614
  case 123:
1598
- return F(e, m.BRACE_L, r, r + 1);
1615
+ return S(e, d.BRACE_L, r, r + 1);
1599
1616
  case 124:
1600
- return F(e, m.PIPE, r, r + 1);
1617
+ return S(e, d.PIPE, r, r + 1);
1601
1618
  case 125:
1602
- return F(e, m.BRACE_R, r, r + 1);
1619
+ return S(e, d.BRACE_R, r, r + 1);
1603
1620
  // StringValue
1604
1621
  case 34:
1605
- return n.charCodeAt(r + 1) === 34 && n.charCodeAt(r + 2) === 34 ? ei(e, r) : Qn(e, r);
1622
+ return n.charCodeAt(r + 1) === 34 && n.charCodeAt(r + 2) === 34 ? Wn(e, r) : Qn(e, r);
1606
1623
  }
1607
- if (Ne(s) || s === 45)
1608
- return Xn(e, r, s);
1609
- if (_t(s))
1610
- return ti(e, r);
1611
- throw M(
1624
+ if (ce(s) || s === 45)
1625
+ return Jn(e, r, s);
1626
+ if (At(s))
1627
+ return Kn(e, r);
1628
+ throw R(
1612
1629
  e.source,
1613
1630
  r,
1614
- s === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : pe(s) || Fe(n, r) ? `Unexpected character: ${oe(e, r)}.` : `Invalid character: ${oe(e, r)}.`
1631
+ s === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : re(s) || Ae(n, r) ? `Unexpected character: ${X(e, r)}.` : `Invalid character: ${X(e, r)}.`
1615
1632
  );
1616
1633
  }
1617
- return F(e, m.EOF, i, i);
1634
+ return S(e, d.EOF, i, i);
1618
1635
  }
1619
- function zn(e, t) {
1636
+ function Hn(e, t) {
1620
1637
  const n = e.source.body, i = n.length;
1621
1638
  let r = t + 1;
1622
1639
  for (; r < i; ) {
1623
1640
  const s = n.charCodeAt(r);
1624
1641
  if (s === 10 || s === 13)
1625
1642
  break;
1626
- if (pe(s))
1643
+ if (re(s))
1627
1644
  ++r;
1628
- else if (Fe(n, r))
1645
+ else if (Ae(n, r))
1629
1646
  r += 2;
1630
1647
  else
1631
1648
  break;
1632
1649
  }
1633
- return F(
1650
+ return S(
1634
1651
  e,
1635
- m.COMMENT,
1652
+ d.COMMENT,
1636
1653
  t,
1637
1654
  r,
1638
1655
  n.slice(t + 1, r)
1639
1656
  );
1640
1657
  }
1641
- function Xn(e, t, n) {
1658
+ function Jn(e, t, n) {
1642
1659
  const i = e.source.body;
1643
1660
  let r = t, s = n, o = !1;
1644
1661
  if (s === 45 && (s = i.charCodeAt(++r)), s === 48) {
1645
- if (s = i.charCodeAt(++r), Ne(s))
1646
- throw M(
1662
+ if (s = i.charCodeAt(++r), ce(s))
1663
+ throw R(
1647
1664
  e.source,
1648
1665
  r,
1649
- `Invalid number, unexpected digit after 0: ${oe(
1666
+ `Invalid number, unexpected digit after 0: ${X(
1650
1667
  e,
1651
1668
  r
1652
1669
  )}.`
1653
1670
  );
1654
1671
  } else
1655
- r = Be(e, r, s), s = i.charCodeAt(r);
1656
- if (s === 46 && (o = !0, s = i.charCodeAt(++r), r = Be(e, r, s), s = i.charCodeAt(r)), (s === 69 || s === 101) && (o = !0, s = i.charCodeAt(++r), (s === 43 || s === 45) && (s = i.charCodeAt(++r)), r = Be(e, r, s), s = i.charCodeAt(r)), s === 46 || _t(s))
1657
- throw M(
1672
+ r = Se(e, r, s), s = i.charCodeAt(r);
1673
+ if (s === 46 && (o = !0, s = i.charCodeAt(++r), r = Se(e, r, s), s = i.charCodeAt(r)), (s === 69 || s === 101) && (o = !0, s = i.charCodeAt(++r), (s === 43 || s === 45) && (s = i.charCodeAt(++r)), r = Se(e, r, s), s = i.charCodeAt(r)), s === 46 || At(s))
1674
+ throw R(
1658
1675
  e.source,
1659
1676
  r,
1660
- `Invalid number, expected digit but got: ${oe(
1677
+ `Invalid number, expected digit but got: ${X(
1661
1678
  e,
1662
1679
  r
1663
1680
  )}.`
1664
1681
  );
1665
- return F(
1682
+ return S(
1666
1683
  e,
1667
- o ? m.FLOAT : m.INT,
1684
+ o ? d.FLOAT : d.INT,
1668
1685
  t,
1669
1686
  r,
1670
1687
  i.slice(t, r)
1671
1688
  );
1672
1689
  }
1673
- function Be(e, t, n) {
1674
- if (!Ne(n))
1675
- throw M(
1690
+ function Se(e, t, n) {
1691
+ if (!ce(n))
1692
+ throw R(
1676
1693
  e.source,
1677
1694
  t,
1678
- `Invalid number, expected digit but got: ${oe(
1695
+ `Invalid number, expected digit but got: ${X(
1679
1696
  e,
1680
1697
  t
1681
1698
  )}.`
1682
1699
  );
1683
1700
  const i = e.source.body;
1684
1701
  let r = t + 1;
1685
- for (; Ne(i.charCodeAt(r)); )
1702
+ for (; ce(i.charCodeAt(r)); )
1686
1703
  ++r;
1687
1704
  return r;
1688
1705
  }
@@ -1692,48 +1709,48 @@ function Qn(e, t) {
1692
1709
  for (; r < i; ) {
1693
1710
  const a = n.charCodeAt(r);
1694
1711
  if (a === 34)
1695
- return o += n.slice(s, r), F(e, m.STRING, t, r + 1, o);
1712
+ return o += n.slice(s, r), S(e, d.STRING, t, r + 1, o);
1696
1713
  if (a === 92) {
1697
1714
  o += n.slice(s, r);
1698
- const u = n.charCodeAt(r + 1) === 117 ? n.charCodeAt(r + 2) === 123 ? Zn(e, r) : Wn(e, r) : Kn(e, r);
1715
+ const u = n.charCodeAt(r + 1) === 117 ? n.charCodeAt(r + 2) === 123 ? zn(e, r) : Zn(e, r) : Xn(e, r);
1699
1716
  o += u.value, r += u.size, s = r;
1700
1717
  continue;
1701
1718
  }
1702
1719
  if (a === 10 || a === 13)
1703
1720
  break;
1704
- if (pe(a))
1721
+ if (re(a))
1705
1722
  ++r;
1706
- else if (Fe(n, r))
1723
+ else if (Ae(n, r))
1707
1724
  r += 2;
1708
1725
  else
1709
- throw M(
1726
+ throw R(
1710
1727
  e.source,
1711
1728
  r,
1712
- `Invalid character within String: ${oe(
1729
+ `Invalid character within String: ${X(
1713
1730
  e,
1714
1731
  r
1715
1732
  )}.`
1716
1733
  );
1717
1734
  }
1718
- throw M(e.source, r, "Unterminated string.");
1735
+ throw R(e.source, r, "Unterminated string.");
1719
1736
  }
1720
- function Zn(e, t) {
1737
+ function zn(e, t) {
1721
1738
  const n = e.source.body;
1722
1739
  let i = 0, r = 3;
1723
1740
  for (; r < 12; ) {
1724
1741
  const s = n.charCodeAt(t + r++);
1725
1742
  if (s === 125) {
1726
- if (r < 5 || !pe(i))
1743
+ if (r < 5 || !re(i))
1727
1744
  break;
1728
1745
  return {
1729
1746
  value: String.fromCodePoint(i),
1730
1747
  size: r
1731
1748
  };
1732
1749
  }
1733
- if (i = i << 4 | ge(s), i < 0)
1750
+ if (i = i << 4 | oe(s), i < 0)
1734
1751
  break;
1735
1752
  }
1736
- throw M(
1753
+ throw R(
1737
1754
  e.source,
1738
1755
  t,
1739
1756
  `Invalid Unicode escape sequence: "${n.slice(
@@ -1742,34 +1759,34 @@ function Zn(e, t) {
1742
1759
  )}".`
1743
1760
  );
1744
1761
  }
1745
- function Wn(e, t) {
1746
- const n = e.source.body, i = at(n, t + 2);
1747
- if (pe(i))
1762
+ function Zn(e, t) {
1763
+ const n = e.source.body, i = tt(n, t + 2);
1764
+ if (re(i))
1748
1765
  return {
1749
1766
  value: String.fromCodePoint(i),
1750
1767
  size: 6
1751
1768
  };
1752
- if (Dt(i) && n.charCodeAt(t + 6) === 92 && n.charCodeAt(t + 7) === 117) {
1753
- const r = at(n, t + 8);
1754
- if (St(r))
1769
+ if (yt(i) && n.charCodeAt(t + 6) === 92 && n.charCodeAt(t + 7) === 117) {
1770
+ const r = tt(n, t + 8);
1771
+ if (xt(r))
1755
1772
  return {
1756
1773
  value: String.fromCodePoint(i, r),
1757
1774
  size: 12
1758
1775
  };
1759
1776
  }
1760
- throw M(
1777
+ throw R(
1761
1778
  e.source,
1762
1779
  t,
1763
1780
  `Invalid Unicode escape sequence: "${n.slice(t, t + 6)}".`
1764
1781
  );
1765
1782
  }
1766
- function at(e, t) {
1767
- return ge(e.charCodeAt(t)) << 12 | ge(e.charCodeAt(t + 1)) << 8 | ge(e.charCodeAt(t + 2)) << 4 | ge(e.charCodeAt(t + 3));
1783
+ function tt(e, t) {
1784
+ return oe(e.charCodeAt(t)) << 12 | oe(e.charCodeAt(t + 1)) << 8 | oe(e.charCodeAt(t + 2)) << 4 | oe(e.charCodeAt(t + 3));
1768
1785
  }
1769
- function ge(e) {
1786
+ function oe(e) {
1770
1787
  return e >= 48 && e <= 57 ? e - 48 : e >= 65 && e <= 70 ? e - 55 : e >= 97 && e <= 102 ? e - 87 : -1;
1771
1788
  }
1772
- function Kn(e, t) {
1789
+ function Xn(e, t) {
1773
1790
  const n = e.source.body;
1774
1791
  switch (n.charCodeAt(t + 1)) {
1775
1792
  case 34:
@@ -1814,7 +1831,7 @@ function Kn(e, t) {
1814
1831
  size: 2
1815
1832
  };
1816
1833
  }
1817
- throw M(
1834
+ throw R(
1818
1835
  e.source,
1819
1836
  t,
1820
1837
  `Invalid character escape sequence: "${n.slice(
@@ -1823,7 +1840,7 @@ function Kn(e, t) {
1823
1840
  )}".`
1824
1841
  );
1825
1842
  }
1826
- function ei(e, t) {
1843
+ function Wn(e, t) {
1827
1844
  const n = e.source.body, i = n.length;
1828
1845
  let r = e.lineStart, s = t + 3, o = s, a = "";
1829
1846
  const u = [];
@@ -1831,13 +1848,13 @@ function ei(e, t) {
1831
1848
  const c = n.charCodeAt(s);
1832
1849
  if (c === 34 && n.charCodeAt(s + 1) === 34 && n.charCodeAt(s + 2) === 34) {
1833
1850
  a += n.slice(o, s), u.push(a);
1834
- const l = F(
1851
+ const l = S(
1835
1852
  e,
1836
- m.BLOCK_STRING,
1853
+ d.BLOCK_STRING,
1837
1854
  t,
1838
1855
  s + 3,
1839
1856
  // Return a string of the lines joined with U+000A.
1840
- jn(u).join(`
1857
+ Un(u).join(`
1841
1858
  `)
1842
1859
  );
1843
1860
  return e.line += u.length - 1, e.lineStart = r, l;
@@ -1850,90 +1867,90 @@ function ei(e, t) {
1850
1867
  a += n.slice(o, s), u.push(a), c === 13 && n.charCodeAt(s + 1) === 10 ? s += 2 : ++s, a = "", o = s, r = s;
1851
1868
  continue;
1852
1869
  }
1853
- if (pe(c))
1870
+ if (re(c))
1854
1871
  ++s;
1855
- else if (Fe(n, s))
1872
+ else if (Ae(n, s))
1856
1873
  s += 2;
1857
1874
  else
1858
- throw M(
1875
+ throw R(
1859
1876
  e.source,
1860
1877
  s,
1861
- `Invalid character within String: ${oe(
1878
+ `Invalid character within String: ${X(
1862
1879
  e,
1863
1880
  s
1864
1881
  )}.`
1865
1882
  );
1866
1883
  }
1867
- throw M(e.source, s, "Unterminated string.");
1884
+ throw R(e.source, s, "Unterminated string.");
1868
1885
  }
1869
- function ti(e, t) {
1886
+ function Kn(e, t) {
1870
1887
  const n = e.source.body, i = n.length;
1871
1888
  let r = t + 1;
1872
1889
  for (; r < i; ) {
1873
1890
  const s = n.charCodeAt(r);
1874
- if (Vn(s))
1891
+ if (Bn(s))
1875
1892
  ++r;
1876
1893
  else
1877
1894
  break;
1878
1895
  }
1879
- return F(
1896
+ return S(
1880
1897
  e,
1881
- m.NAME,
1898
+ d.NAME,
1882
1899
  t,
1883
1900
  r,
1884
1901
  n.slice(t, r)
1885
1902
  );
1886
1903
  }
1887
- const ni = 10, xt = 2;
1888
- function Ke(e) {
1889
- return Pe(e, []);
1904
+ const ei = 10, Dt = 2;
1905
+ function Ye(e) {
1906
+ return ye(e, []);
1890
1907
  }
1891
- function Pe(e, t) {
1908
+ function ye(e, t) {
1892
1909
  switch (typeof e) {
1893
1910
  case "string":
1894
1911
  return JSON.stringify(e);
1895
1912
  case "function":
1896
1913
  return e.name ? `[function ${e.name}]` : "[function]";
1897
1914
  case "object":
1898
- return ii(e, t);
1915
+ return ti(e, t);
1899
1916
  default:
1900
1917
  return String(e);
1901
1918
  }
1902
1919
  }
1903
- function ii(e, t) {
1920
+ function ti(e, t) {
1904
1921
  if (e === null)
1905
1922
  return "null";
1906
1923
  if (t.includes(e))
1907
1924
  return "[Circular]";
1908
1925
  const n = [...t, e];
1909
- if (ri(e)) {
1926
+ if (ni(e)) {
1910
1927
  const i = e.toJSON();
1911
1928
  if (i !== e)
1912
- return typeof i == "string" ? i : Pe(i, n);
1929
+ return typeof i == "string" ? i : ye(i, n);
1913
1930
  } else if (Array.isArray(e))
1914
- return oi(e, n);
1915
- return si(e, n);
1931
+ return ri(e, n);
1932
+ return ii(e, n);
1916
1933
  }
1917
- function ri(e) {
1934
+ function ni(e) {
1918
1935
  return typeof e.toJSON == "function";
1919
1936
  }
1920
- function si(e, t) {
1937
+ function ii(e, t) {
1921
1938
  const n = Object.entries(e);
1922
- return n.length === 0 ? "{}" : t.length > xt ? "[" + ai(e) + "]" : "{ " + n.map(
1923
- ([r, s]) => r + ": " + Pe(s, t)
1939
+ return n.length === 0 ? "{}" : t.length > Dt ? "[" + si(e) + "]" : "{ " + n.map(
1940
+ ([r, s]) => r + ": " + ye(s, t)
1924
1941
  ).join(", ") + " }";
1925
1942
  }
1926
- function oi(e, t) {
1943
+ function ri(e, t) {
1927
1944
  if (e.length === 0)
1928
1945
  return "[]";
1929
- if (t.length > xt)
1946
+ if (t.length > Dt)
1930
1947
  return "[Array]";
1931
- const n = Math.min(ni, e.length), i = e.length - n, r = [];
1948
+ const n = Math.min(ei, e.length), i = e.length - n, r = [];
1932
1949
  for (let s = 0; s < n; ++s)
1933
- r.push(Pe(e[s], t));
1950
+ r.push(ye(e[s], t));
1934
1951
  return i === 1 ? r.push("... 1 more item") : i > 1 && r.push(`... ${i} more items`), "[" + r.join(", ") + "]";
1935
1952
  }
1936
- function ai(e) {
1953
+ function si(e) {
1937
1954
  const t = Object.prototype.toString.call(e).replace(/^\[object /, "").replace(/]$/, "");
1938
1955
  if (t === "Object" && typeof e.constructor == "function") {
1939
1956
  const n = e.constructor.name;
@@ -1942,11 +1959,11 @@ function ai(e) {
1942
1959
  }
1943
1960
  return t;
1944
1961
  }
1945
- const ci = (
1962
+ const oi = globalThis.process && // eslint-disable-next-line no-undef
1963
+ process.env.NODE_ENV === "production", ai = (
1946
1964
  /* c8 ignore next 6 */
1947
1965
  // FIXME: https://github.com/graphql/graphql-js/issues/2317
1948
- // eslint-disable-next-line no-undef
1949
- process.env.NODE_ENV === "production" ? function(t, n) {
1966
+ oi ? function(t, n) {
1950
1967
  return t instanceof n;
1951
1968
  } : function(t, n) {
1952
1969
  if (t instanceof n)
@@ -1958,7 +1975,7 @@ const ci = (
1958
1975
  Symbol.toStringTag in t ? t[Symbol.toStringTag] : (i = t.constructor) === null || i === void 0 ? void 0 : i.name
1959
1976
  );
1960
1977
  if (r === s) {
1961
- const o = Ke(t);
1978
+ const o = Ye(t);
1962
1979
  throw new Error(`Cannot use ${r} "${o}" from another module or realm.
1963
1980
 
1964
1981
  Ensure that there is only one instance of "graphql" in the node_modules
@@ -1976,15 +1993,15 @@ spurious results.`);
1976
1993
  return !1;
1977
1994
  }
1978
1995
  );
1979
- class Ct {
1996
+ class _t {
1980
1997
  constructor(t, n = "GraphQL request", i = {
1981
1998
  line: 1,
1982
1999
  column: 1
1983
2000
  }) {
1984
- typeof t == "string" || Oe(!1, `Body must be a string. Received: ${Ke(t)}.`), this.body = t, this.name = n, this.locationOffset = i, this.locationOffset.line > 0 || Oe(
2001
+ typeof t == "string" || ge(!1, `Body must be a string. Received: ${Ye(t)}.`), this.body = t, this.name = n, this.locationOffset = i, this.locationOffset.line > 0 || ge(
1985
2002
  !1,
1986
2003
  "line in locationOffset is 1-indexed and must be positive."
1987
- ), this.locationOffset.column > 0 || Oe(
2004
+ ), this.locationOffset.column > 0 || ge(
1988
2005
  !1,
1989
2006
  "column in locationOffset is 1-indexed and must be positive."
1990
2007
  );
@@ -1993,24 +2010,37 @@ class Ct {
1993
2010
  return "Source";
1994
2011
  }
1995
2012
  }
1996
- function ui(e) {
1997
- return ci(e, Ct);
2013
+ function ci(e) {
2014
+ return ai(e, _t);
1998
2015
  }
1999
- function li(e, t) {
2000
- return new fi(e, t).parseDocument();
2016
+ function ui(e, t) {
2017
+ const n = new li(e, t), i = n.parseDocument();
2018
+ return Object.defineProperty(i, "tokenCount", {
2019
+ enumerable: !1,
2020
+ value: n.tokenCount
2021
+ }), i;
2001
2022
  }
2002
- class fi {
2023
+ class li {
2003
2024
  constructor(t, n = {}) {
2004
- const i = ui(t) ? t : new Ct(t);
2005
- this._lexer = new Gn(i), this._options = n, this._tokenCounter = 0;
2025
+ const { lexer: i, ...r } = n;
2026
+ if (i)
2027
+ this._lexer = i;
2028
+ else {
2029
+ const s = ci(t) ? t : new _t(t);
2030
+ this._lexer = new $n(s);
2031
+ }
2032
+ this._options = r, this._tokenCounter = 0;
2033
+ }
2034
+ get tokenCount() {
2035
+ return this._tokenCounter;
2006
2036
  }
2007
2037
  /**
2008
2038
  * Converts a name lex token into a name parse node.
2009
2039
  */
2010
2040
  parseName() {
2011
- const t = this.expectToken(m.NAME);
2041
+ const t = this.expectToken(d.NAME);
2012
2042
  return this.node(t, {
2013
- kind: A.NAME,
2043
+ kind: w.NAME,
2014
2044
  value: t.value
2015
2045
  });
2016
2046
  }
@@ -2020,11 +2050,11 @@ class fi {
2020
2050
  */
2021
2051
  parseDocument() {
2022
2052
  return this.node(this._lexer.token, {
2023
- kind: A.DOCUMENT,
2053
+ kind: w.DOCUMENT,
2024
2054
  definitions: this.many(
2025
- m.SOF,
2055
+ d.SOF,
2026
2056
  this.parseDefinition,
2027
- m.EOF
2057
+ d.EOF
2028
2058
  )
2029
2059
  });
2030
2060
  }
@@ -2052,10 +2082,16 @@ class fi {
2052
2082
  * - InputObjectTypeDefinition
2053
2083
  */
2054
2084
  parseDefinition() {
2055
- if (this.peek(m.BRACE_L))
2085
+ if (this.peek(d.BRACE_L))
2056
2086
  return this.parseOperationDefinition();
2057
2087
  const t = this.peekDescription(), n = t ? this._lexer.lookahead() : this._lexer.token;
2058
- if (n.kind === m.NAME) {
2088
+ if (t && n.kind === d.BRACE_L)
2089
+ throw R(
2090
+ this._lexer.source,
2091
+ this._lexer.token.start,
2092
+ "Unexpected description, descriptions are not supported on shorthand queries."
2093
+ );
2094
+ if (n.kind === d.NAME) {
2059
2095
  switch (n.value) {
2060
2096
  case "schema":
2061
2097
  return this.parseSchemaDefinition();
@@ -2074,12 +2110,6 @@ class fi {
2074
2110
  case "directive":
2075
2111
  return this.parseDirectiveDefinition();
2076
2112
  }
2077
- if (t)
2078
- throw M(
2079
- this._lexer.source,
2080
- this._lexer.token.start,
2081
- "Unexpected description, descriptions are supported only on type definitions."
2082
- );
2083
2113
  switch (n.value) {
2084
2114
  case "query":
2085
2115
  case "mutation":
@@ -2087,9 +2117,15 @@ class fi {
2087
2117
  return this.parseOperationDefinition();
2088
2118
  case "fragment":
2089
2119
  return this.parseFragmentDefinition();
2090
- case "extend":
2091
- return this.parseTypeSystemExtension();
2092
2120
  }
2121
+ if (t)
2122
+ throw R(
2123
+ this._lexer.source,
2124
+ this._lexer.token.start,
2125
+ "Unexpected description, only GraphQL definitions support descriptions."
2126
+ );
2127
+ if (n.value === "extend")
2128
+ return this.parseTypeSystemExtension();
2093
2129
  }
2094
2130
  throw this.unexpected(n);
2095
2131
  }
@@ -2101,21 +2137,23 @@ class fi {
2101
2137
  */
2102
2138
  parseOperationDefinition() {
2103
2139
  const t = this._lexer.token;
2104
- if (this.peek(m.BRACE_L))
2140
+ if (this.peek(d.BRACE_L))
2105
2141
  return this.node(t, {
2106
- kind: A.OPERATION_DEFINITION,
2107
- operation: fe.QUERY,
2142
+ kind: w.OPERATION_DEFINITION,
2143
+ operation: te.QUERY,
2144
+ description: void 0,
2108
2145
  name: void 0,
2109
2146
  variableDefinitions: [],
2110
2147
  directives: [],
2111
2148
  selectionSet: this.parseSelectionSet()
2112
2149
  });
2113
- const n = this.parseOperationType();
2114
- let i;
2115
- return this.peek(m.NAME) && (i = this.parseName()), this.node(t, {
2116
- kind: A.OPERATION_DEFINITION,
2117
- operation: n,
2118
- name: i,
2150
+ const n = this.parseDescription(), i = this.parseOperationType();
2151
+ let r;
2152
+ return this.peek(d.NAME) && (r = this.parseName()), this.node(t, {
2153
+ kind: w.OPERATION_DEFINITION,
2154
+ operation: i,
2155
+ description: n,
2156
+ name: r,
2119
2157
  variableDefinitions: this.parseVariableDefinitions(),
2120
2158
  directives: this.parseDirectives(!1),
2121
2159
  selectionSet: this.parseSelectionSet()
@@ -2125,14 +2163,14 @@ class fi {
2125
2163
  * OperationType : one of query mutation subscription
2126
2164
  */
2127
2165
  parseOperationType() {
2128
- const t = this.expectToken(m.NAME);
2166
+ const t = this.expectToken(d.NAME);
2129
2167
  switch (t.value) {
2130
2168
  case "query":
2131
- return fe.QUERY;
2169
+ return te.QUERY;
2132
2170
  case "mutation":
2133
- return fe.MUTATION;
2171
+ return te.MUTATION;
2134
2172
  case "subscription":
2135
- return fe.SUBSCRIPTION;
2173
+ return te.SUBSCRIPTION;
2136
2174
  }
2137
2175
  throw this.unexpected(t);
2138
2176
  }
@@ -2141,9 +2179,9 @@ class fi {
2141
2179
  */
2142
2180
  parseVariableDefinitions() {
2143
2181
  return this.optionalMany(
2144
- m.PAREN_L,
2182
+ d.PAREN_L,
2145
2183
  this.parseVariableDefinition,
2146
- m.PAREN_R
2184
+ d.PAREN_R
2147
2185
  );
2148
2186
  }
2149
2187
  /**
@@ -2151,10 +2189,11 @@ class fi {
2151
2189
  */
2152
2190
  parseVariableDefinition() {
2153
2191
  return this.node(this._lexer.token, {
2154
- kind: A.VARIABLE_DEFINITION,
2192
+ kind: w.VARIABLE_DEFINITION,
2193
+ description: this.parseDescription(),
2155
2194
  variable: this.parseVariable(),
2156
- type: (this.expectToken(m.COLON), this.parseTypeReference()),
2157
- defaultValue: this.expectOptionalToken(m.EQUALS) ? this.parseConstValueLiteral() : void 0,
2195
+ type: (this.expectToken(d.COLON), this.parseTypeReference()),
2196
+ defaultValue: this.expectOptionalToken(d.EQUALS) ? this.parseConstValueLiteral() : void 0,
2158
2197
  directives: this.parseConstDirectives()
2159
2198
  });
2160
2199
  }
@@ -2163,8 +2202,8 @@ class fi {
2163
2202
  */
2164
2203
  parseVariable() {
2165
2204
  const t = this._lexer.token;
2166
- return this.expectToken(m.DOLLAR), this.node(t, {
2167
- kind: A.VARIABLE,
2205
+ return this.expectToken(d.DOLLAR), this.node(t, {
2206
+ kind: w.VARIABLE,
2168
2207
  name: this.parseName()
2169
2208
  });
2170
2209
  }
@@ -2175,11 +2214,11 @@ class fi {
2175
2214
  */
2176
2215
  parseSelectionSet() {
2177
2216
  return this.node(this._lexer.token, {
2178
- kind: A.SELECTION_SET,
2217
+ kind: w.SELECTION_SET,
2179
2218
  selections: this.many(
2180
- m.BRACE_L,
2219
+ d.BRACE_L,
2181
2220
  this.parseSelection,
2182
- m.BRACE_R
2221
+ d.BRACE_R
2183
2222
  )
2184
2223
  });
2185
2224
  }
@@ -2190,7 +2229,7 @@ class fi {
2190
2229
  * - InlineFragment
2191
2230
  */
2192
2231
  parseSelection() {
2193
- return this.peek(m.SPREAD) ? this.parseFragment() : this.parseField();
2232
+ return this.peek(d.SPREAD) ? this.parseFragment() : this.parseField();
2194
2233
  }
2195
2234
  /**
2196
2235
  * Field : Alias? Name Arguments? Directives? SelectionSet?
@@ -2200,13 +2239,13 @@ class fi {
2200
2239
  parseField() {
2201
2240
  const t = this._lexer.token, n = this.parseName();
2202
2241
  let i, r;
2203
- return this.expectOptionalToken(m.COLON) ? (i = n, r = this.parseName()) : r = n, this.node(t, {
2204
- kind: A.FIELD,
2242
+ return this.expectOptionalToken(d.COLON) ? (i = n, r = this.parseName()) : r = n, this.node(t, {
2243
+ kind: w.FIELD,
2205
2244
  alias: i,
2206
2245
  name: r,
2207
2246
  arguments: this.parseArguments(!1),
2208
2247
  directives: this.parseDirectives(!1),
2209
- selectionSet: this.peek(m.BRACE_L) ? this.parseSelectionSet() : void 0
2248
+ selectionSet: this.peek(d.BRACE_L) ? this.parseSelectionSet() : void 0
2210
2249
  });
2211
2250
  }
2212
2251
  /**
@@ -2214,15 +2253,15 @@ class fi {
2214
2253
  */
2215
2254
  parseArguments(t) {
2216
2255
  const n = t ? this.parseConstArgument : this.parseArgument;
2217
- return this.optionalMany(m.PAREN_L, n, m.PAREN_R);
2256
+ return this.optionalMany(d.PAREN_L, n, d.PAREN_R);
2218
2257
  }
2219
2258
  /**
2220
2259
  * Argument[Const] : Name : Value[?Const]
2221
2260
  */
2222
2261
  parseArgument(t = !1) {
2223
2262
  const n = this._lexer.token, i = this.parseName();
2224
- return this.expectToken(m.COLON), this.node(n, {
2225
- kind: A.ARGUMENT,
2263
+ return this.expectToken(d.COLON), this.node(n, {
2264
+ kind: w.ARGUMENT,
2226
2265
  name: i,
2227
2266
  value: this.parseValueLiteral(t)
2228
2267
  });
@@ -2240,14 +2279,14 @@ class fi {
2240
2279
  */
2241
2280
  parseFragment() {
2242
2281
  const t = this._lexer.token;
2243
- this.expectToken(m.SPREAD);
2282
+ this.expectToken(d.SPREAD);
2244
2283
  const n = this.expectOptionalKeyword("on");
2245
- return !n && this.peek(m.NAME) ? this.node(t, {
2246
- kind: A.FRAGMENT_SPREAD,
2284
+ return !n && this.peek(d.NAME) ? this.node(t, {
2285
+ kind: w.FRAGMENT_SPREAD,
2247
2286
  name: this.parseFragmentName(),
2248
2287
  directives: this.parseDirectives(!1)
2249
2288
  }) : this.node(t, {
2250
- kind: A.INLINE_FRAGMENT,
2289
+ kind: w.INLINE_FRAGMENT,
2251
2290
  typeCondition: n ? this.parseNamedType() : void 0,
2252
2291
  directives: this.parseDirectives(!1),
2253
2292
  selectionSet: this.parseSelectionSet()
@@ -2260,16 +2299,18 @@ class fi {
2260
2299
  * TypeCondition : NamedType
2261
2300
  */
2262
2301
  parseFragmentDefinition() {
2263
- const t = this._lexer.token;
2302
+ const t = this._lexer.token, n = this.parseDescription();
2264
2303
  return this.expectKeyword("fragment"), this._options.allowLegacyFragmentVariables === !0 ? this.node(t, {
2265
- kind: A.FRAGMENT_DEFINITION,
2304
+ kind: w.FRAGMENT_DEFINITION,
2305
+ description: n,
2266
2306
  name: this.parseFragmentName(),
2267
2307
  variableDefinitions: this.parseVariableDefinitions(),
2268
2308
  typeCondition: (this.expectKeyword("on"), this.parseNamedType()),
2269
2309
  directives: this.parseDirectives(!1),
2270
2310
  selectionSet: this.parseSelectionSet()
2271
2311
  }) : this.node(t, {
2272
- kind: A.FRAGMENT_DEFINITION,
2312
+ kind: w.FRAGMENT_DEFINITION,
2313
+ description: n,
2273
2314
  name: this.parseFragmentName(),
2274
2315
  typeCondition: (this.expectKeyword("on"), this.parseNamedType()),
2275
2316
  directives: this.parseDirectives(!1),
@@ -2306,50 +2347,50 @@ class fi {
2306
2347
  parseValueLiteral(t) {
2307
2348
  const n = this._lexer.token;
2308
2349
  switch (n.kind) {
2309
- case m.BRACKET_L:
2350
+ case d.BRACKET_L:
2310
2351
  return this.parseList(t);
2311
- case m.BRACE_L:
2352
+ case d.BRACE_L:
2312
2353
  return this.parseObject(t);
2313
- case m.INT:
2354
+ case d.INT:
2314
2355
  return this.advanceLexer(), this.node(n, {
2315
- kind: A.INT,
2356
+ kind: w.INT,
2316
2357
  value: n.value
2317
2358
  });
2318
- case m.FLOAT:
2359
+ case d.FLOAT:
2319
2360
  return this.advanceLexer(), this.node(n, {
2320
- kind: A.FLOAT,
2361
+ kind: w.FLOAT,
2321
2362
  value: n.value
2322
2363
  });
2323
- case m.STRING:
2324
- case m.BLOCK_STRING:
2364
+ case d.STRING:
2365
+ case d.BLOCK_STRING:
2325
2366
  return this.parseStringLiteral();
2326
- case m.NAME:
2367
+ case d.NAME:
2327
2368
  switch (this.advanceLexer(), n.value) {
2328
2369
  case "true":
2329
2370
  return this.node(n, {
2330
- kind: A.BOOLEAN,
2371
+ kind: w.BOOLEAN,
2331
2372
  value: !0
2332
2373
  });
2333
2374
  case "false":
2334
2375
  return this.node(n, {
2335
- kind: A.BOOLEAN,
2376
+ kind: w.BOOLEAN,
2336
2377
  value: !1
2337
2378
  });
2338
2379
  case "null":
2339
2380
  return this.node(n, {
2340
- kind: A.NULL
2381
+ kind: w.NULL
2341
2382
  });
2342
2383
  default:
2343
2384
  return this.node(n, {
2344
- kind: A.ENUM,
2385
+ kind: w.ENUM,
2345
2386
  value: n.value
2346
2387
  });
2347
2388
  }
2348
- case m.DOLLAR:
2389
+ case d.DOLLAR:
2349
2390
  if (t)
2350
- if (this.expectToken(m.DOLLAR), this._lexer.token.kind === m.NAME) {
2391
+ if (this.expectToken(d.DOLLAR), this._lexer.token.kind === d.NAME) {
2351
2392
  const i = this._lexer.token.value;
2352
- throw M(
2393
+ throw R(
2353
2394
  this._lexer.source,
2354
2395
  n.start,
2355
2396
  `Unexpected variable "$${i}" in constant value.`
@@ -2367,9 +2408,9 @@ class fi {
2367
2408
  parseStringLiteral() {
2368
2409
  const t = this._lexer.token;
2369
2410
  return this.advanceLexer(), this.node(t, {
2370
- kind: A.STRING,
2411
+ kind: w.STRING,
2371
2412
  value: t.value,
2372
- block: t.kind === m.BLOCK_STRING
2413
+ block: t.kind === d.BLOCK_STRING
2373
2414
  });
2374
2415
  }
2375
2416
  /**
@@ -2380,8 +2421,8 @@ class fi {
2380
2421
  parseList(t) {
2381
2422
  const n = () => this.parseValueLiteral(t);
2382
2423
  return this.node(this._lexer.token, {
2383
- kind: A.LIST,
2384
- values: this.any(m.BRACKET_L, n, m.BRACKET_R)
2424
+ kind: w.LIST,
2425
+ values: this.any(d.BRACKET_L, n, d.BRACKET_R)
2385
2426
  });
2386
2427
  }
2387
2428
  /**
@@ -2394,8 +2435,8 @@ class fi {
2394
2435
  parseObject(t) {
2395
2436
  const n = () => this.parseObjectField(t);
2396
2437
  return this.node(this._lexer.token, {
2397
- kind: A.OBJECT,
2398
- fields: this.any(m.BRACE_L, n, m.BRACE_R)
2438
+ kind: w.OBJECT,
2439
+ fields: this.any(d.BRACE_L, n, d.BRACE_R)
2399
2440
  });
2400
2441
  }
2401
2442
  /**
@@ -2403,8 +2444,8 @@ class fi {
2403
2444
  */
2404
2445
  parseObjectField(t) {
2405
2446
  const n = this._lexer.token, i = this.parseName();
2406
- return this.expectToken(m.COLON), this.node(n, {
2407
- kind: A.OBJECT_FIELD,
2447
+ return this.expectToken(d.COLON), this.node(n, {
2448
+ kind: w.OBJECT_FIELD,
2408
2449
  name: i,
2409
2450
  value: this.parseValueLiteral(t)
2410
2451
  });
@@ -2415,7 +2456,7 @@ class fi {
2415
2456
  */
2416
2457
  parseDirectives(t) {
2417
2458
  const n = [];
2418
- for (; this.peek(m.AT); )
2459
+ for (; this.peek(d.AT); )
2419
2460
  n.push(this.parseDirective(t));
2420
2461
  return n;
2421
2462
  }
@@ -2429,8 +2470,8 @@ class fi {
2429
2470
  */
2430
2471
  parseDirective(t) {
2431
2472
  const n = this._lexer.token;
2432
- return this.expectToken(m.AT), this.node(n, {
2433
- kind: A.DIRECTIVE,
2473
+ return this.expectToken(d.AT), this.node(n, {
2474
+ kind: w.DIRECTIVE,
2434
2475
  name: this.parseName(),
2435
2476
  arguments: this.parseArguments(t)
2436
2477
  });
@@ -2445,16 +2486,16 @@ class fi {
2445
2486
  parseTypeReference() {
2446
2487
  const t = this._lexer.token;
2447
2488
  let n;
2448
- if (this.expectOptionalToken(m.BRACKET_L)) {
2489
+ if (this.expectOptionalToken(d.BRACKET_L)) {
2449
2490
  const i = this.parseTypeReference();
2450
- this.expectToken(m.BRACKET_R), n = this.node(t, {
2451
- kind: A.LIST_TYPE,
2491
+ this.expectToken(d.BRACKET_R), n = this.node(t, {
2492
+ kind: w.LIST_TYPE,
2452
2493
  type: i
2453
2494
  });
2454
2495
  } else
2455
2496
  n = this.parseNamedType();
2456
- return this.expectOptionalToken(m.BANG) ? this.node(t, {
2457
- kind: A.NON_NULL_TYPE,
2497
+ return this.expectOptionalToken(d.BANG) ? this.node(t, {
2498
+ kind: w.NON_NULL_TYPE,
2458
2499
  type: n
2459
2500
  }) : n;
2460
2501
  }
@@ -2463,13 +2504,13 @@ class fi {
2463
2504
  */
2464
2505
  parseNamedType() {
2465
2506
  return this.node(this._lexer.token, {
2466
- kind: A.NAMED_TYPE,
2507
+ kind: w.NAMED_TYPE,
2467
2508
  name: this.parseName()
2468
2509
  });
2469
2510
  }
2470
2511
  // Implements the parsing rules in the Type Definition section.
2471
2512
  peekDescription() {
2472
- return this.peek(m.STRING) || this.peek(m.BLOCK_STRING);
2513
+ return this.peek(d.STRING) || this.peek(d.BLOCK_STRING);
2473
2514
  }
2474
2515
  /**
2475
2516
  * Description : StringValue
@@ -2487,12 +2528,12 @@ class fi {
2487
2528
  const t = this._lexer.token, n = this.parseDescription();
2488
2529
  this.expectKeyword("schema");
2489
2530
  const i = this.parseConstDirectives(), r = this.many(
2490
- m.BRACE_L,
2531
+ d.BRACE_L,
2491
2532
  this.parseOperationTypeDefinition,
2492
- m.BRACE_R
2533
+ d.BRACE_R
2493
2534
  );
2494
2535
  return this.node(t, {
2495
- kind: A.SCHEMA_DEFINITION,
2536
+ kind: w.SCHEMA_DEFINITION,
2496
2537
  description: n,
2497
2538
  directives: i,
2498
2539
  operationTypes: r
@@ -2503,10 +2544,10 @@ class fi {
2503
2544
  */
2504
2545
  parseOperationTypeDefinition() {
2505
2546
  const t = this._lexer.token, n = this.parseOperationType();
2506
- this.expectToken(m.COLON);
2547
+ this.expectToken(d.COLON);
2507
2548
  const i = this.parseNamedType();
2508
2549
  return this.node(t, {
2509
- kind: A.OPERATION_TYPE_DEFINITION,
2550
+ kind: w.OPERATION_TYPE_DEFINITION,
2510
2551
  operation: n,
2511
2552
  type: i
2512
2553
  });
@@ -2519,7 +2560,7 @@ class fi {
2519
2560
  this.expectKeyword("scalar");
2520
2561
  const i = this.parseName(), r = this.parseConstDirectives();
2521
2562
  return this.node(t, {
2522
- kind: A.SCALAR_TYPE_DEFINITION,
2563
+ kind: w.SCALAR_TYPE_DEFINITION,
2523
2564
  description: n,
2524
2565
  name: i,
2525
2566
  directives: r
@@ -2535,7 +2576,7 @@ class fi {
2535
2576
  this.expectKeyword("type");
2536
2577
  const i = this.parseName(), r = this.parseImplementsInterfaces(), s = this.parseConstDirectives(), o = this.parseFieldsDefinition();
2537
2578
  return this.node(t, {
2538
- kind: A.OBJECT_TYPE_DEFINITION,
2579
+ kind: w.OBJECT_TYPE_DEFINITION,
2539
2580
  description: n,
2540
2581
  name: i,
2541
2582
  interfaces: r,
@@ -2549,7 +2590,7 @@ class fi {
2549
2590
  * - ImplementsInterfaces & NamedType
2550
2591
  */
2551
2592
  parseImplementsInterfaces() {
2552
- return this.expectOptionalKeyword("implements") ? this.delimitedMany(m.AMP, this.parseNamedType) : [];
2593
+ return this.expectOptionalKeyword("implements") ? this.delimitedMany(d.AMP, this.parseNamedType) : [];
2553
2594
  }
2554
2595
  /**
2555
2596
  * ```
@@ -2558,9 +2599,9 @@ class fi {
2558
2599
  */
2559
2600
  parseFieldsDefinition() {
2560
2601
  return this.optionalMany(
2561
- m.BRACE_L,
2602
+ d.BRACE_L,
2562
2603
  this.parseFieldDefinition,
2563
- m.BRACE_R
2604
+ d.BRACE_R
2564
2605
  );
2565
2606
  }
2566
2607
  /**
@@ -2569,10 +2610,10 @@ class fi {
2569
2610
  */
2570
2611
  parseFieldDefinition() {
2571
2612
  const t = this._lexer.token, n = this.parseDescription(), i = this.parseName(), r = this.parseArgumentDefs();
2572
- this.expectToken(m.COLON);
2613
+ this.expectToken(d.COLON);
2573
2614
  const s = this.parseTypeReference(), o = this.parseConstDirectives();
2574
2615
  return this.node(t, {
2575
- kind: A.FIELD_DEFINITION,
2616
+ kind: w.FIELD_DEFINITION,
2576
2617
  description: n,
2577
2618
  name: i,
2578
2619
  arguments: r,
@@ -2585,9 +2626,9 @@ class fi {
2585
2626
  */
2586
2627
  parseArgumentDefs() {
2587
2628
  return this.optionalMany(
2588
- m.PAREN_L,
2629
+ d.PAREN_L,
2589
2630
  this.parseInputValueDef,
2590
- m.PAREN_R
2631
+ d.PAREN_R
2591
2632
  );
2592
2633
  }
2593
2634
  /**
@@ -2596,13 +2637,13 @@ class fi {
2596
2637
  */
2597
2638
  parseInputValueDef() {
2598
2639
  const t = this._lexer.token, n = this.parseDescription(), i = this.parseName();
2599
- this.expectToken(m.COLON);
2640
+ this.expectToken(d.COLON);
2600
2641
  const r = this.parseTypeReference();
2601
2642
  let s;
2602
- this.expectOptionalToken(m.EQUALS) && (s = this.parseConstValueLiteral());
2643
+ this.expectOptionalToken(d.EQUALS) && (s = this.parseConstValueLiteral());
2603
2644
  const o = this.parseConstDirectives();
2604
2645
  return this.node(t, {
2605
- kind: A.INPUT_VALUE_DEFINITION,
2646
+ kind: w.INPUT_VALUE_DEFINITION,
2606
2647
  description: n,
2607
2648
  name: i,
2608
2649
  type: r,
@@ -2619,7 +2660,7 @@ class fi {
2619
2660
  this.expectKeyword("interface");
2620
2661
  const i = this.parseName(), r = this.parseImplementsInterfaces(), s = this.parseConstDirectives(), o = this.parseFieldsDefinition();
2621
2662
  return this.node(t, {
2622
- kind: A.INTERFACE_TYPE_DEFINITION,
2663
+ kind: w.INTERFACE_TYPE_DEFINITION,
2623
2664
  description: n,
2624
2665
  name: i,
2625
2666
  interfaces: r,
@@ -2636,7 +2677,7 @@ class fi {
2636
2677
  this.expectKeyword("union");
2637
2678
  const i = this.parseName(), r = this.parseConstDirectives(), s = this.parseUnionMemberTypes();
2638
2679
  return this.node(t, {
2639
- kind: A.UNION_TYPE_DEFINITION,
2680
+ kind: w.UNION_TYPE_DEFINITION,
2640
2681
  description: n,
2641
2682
  name: i,
2642
2683
  directives: r,
@@ -2649,7 +2690,7 @@ class fi {
2649
2690
  * - UnionMemberTypes | NamedType
2650
2691
  */
2651
2692
  parseUnionMemberTypes() {
2652
- return this.expectOptionalToken(m.EQUALS) ? this.delimitedMany(m.PIPE, this.parseNamedType) : [];
2693
+ return this.expectOptionalToken(d.EQUALS) ? this.delimitedMany(d.PIPE, this.parseNamedType) : [];
2653
2694
  }
2654
2695
  /**
2655
2696
  * EnumTypeDefinition :
@@ -2660,7 +2701,7 @@ class fi {
2660
2701
  this.expectKeyword("enum");
2661
2702
  const i = this.parseName(), r = this.parseConstDirectives(), s = this.parseEnumValuesDefinition();
2662
2703
  return this.node(t, {
2663
- kind: A.ENUM_TYPE_DEFINITION,
2704
+ kind: w.ENUM_TYPE_DEFINITION,
2664
2705
  description: n,
2665
2706
  name: i,
2666
2707
  directives: r,
@@ -2674,9 +2715,9 @@ class fi {
2674
2715
  */
2675
2716
  parseEnumValuesDefinition() {
2676
2717
  return this.optionalMany(
2677
- m.BRACE_L,
2718
+ d.BRACE_L,
2678
2719
  this.parseEnumValueDefinition,
2679
- m.BRACE_R
2720
+ d.BRACE_R
2680
2721
  );
2681
2722
  }
2682
2723
  /**
@@ -2685,7 +2726,7 @@ class fi {
2685
2726
  parseEnumValueDefinition() {
2686
2727
  const t = this._lexer.token, n = this.parseDescription(), i = this.parseEnumValueName(), r = this.parseConstDirectives();
2687
2728
  return this.node(t, {
2688
- kind: A.ENUM_VALUE_DEFINITION,
2729
+ kind: w.ENUM_VALUE_DEFINITION,
2689
2730
  description: n,
2690
2731
  name: i,
2691
2732
  directives: r
@@ -2696,10 +2737,10 @@ class fi {
2696
2737
  */
2697
2738
  parseEnumValueName() {
2698
2739
  if (this._lexer.token.value === "true" || this._lexer.token.value === "false" || this._lexer.token.value === "null")
2699
- throw M(
2740
+ throw R(
2700
2741
  this._lexer.source,
2701
2742
  this._lexer.token.start,
2702
- `${ve(
2743
+ `${he(
2703
2744
  this._lexer.token
2704
2745
  )} is reserved and cannot be used for an enum value.`
2705
2746
  );
@@ -2714,7 +2755,7 @@ class fi {
2714
2755
  this.expectKeyword("input");
2715
2756
  const i = this.parseName(), r = this.parseConstDirectives(), s = this.parseInputFieldsDefinition();
2716
2757
  return this.node(t, {
2717
- kind: A.INPUT_OBJECT_TYPE_DEFINITION,
2758
+ kind: w.INPUT_OBJECT_TYPE_DEFINITION,
2718
2759
  description: n,
2719
2760
  name: i,
2720
2761
  directives: r,
@@ -2728,9 +2769,9 @@ class fi {
2728
2769
  */
2729
2770
  parseInputFieldsDefinition() {
2730
2771
  return this.optionalMany(
2731
- m.BRACE_L,
2772
+ d.BRACE_L,
2732
2773
  this.parseInputValueDef,
2733
- m.BRACE_R
2774
+ d.BRACE_R
2734
2775
  );
2735
2776
  }
2736
2777
  /**
@@ -2748,7 +2789,7 @@ class fi {
2748
2789
  */
2749
2790
  parseTypeSystemExtension() {
2750
2791
  const t = this._lexer.lookahead();
2751
- if (t.kind === m.NAME)
2792
+ if (t.kind === d.NAME)
2752
2793
  switch (t.value) {
2753
2794
  case "schema":
2754
2795
  return this.parseSchemaExtension();
@@ -2778,14 +2819,14 @@ class fi {
2778
2819
  const t = this._lexer.token;
2779
2820
  this.expectKeyword("extend"), this.expectKeyword("schema");
2780
2821
  const n = this.parseConstDirectives(), i = this.optionalMany(
2781
- m.BRACE_L,
2822
+ d.BRACE_L,
2782
2823
  this.parseOperationTypeDefinition,
2783
- m.BRACE_R
2824
+ d.BRACE_R
2784
2825
  );
2785
2826
  if (n.length === 0 && i.length === 0)
2786
2827
  throw this.unexpected();
2787
2828
  return this.node(t, {
2788
- kind: A.SCHEMA_EXTENSION,
2829
+ kind: w.SCHEMA_EXTENSION,
2789
2830
  directives: n,
2790
2831
  operationTypes: i
2791
2832
  });
@@ -2801,7 +2842,7 @@ class fi {
2801
2842
  if (i.length === 0)
2802
2843
  throw this.unexpected();
2803
2844
  return this.node(t, {
2804
- kind: A.SCALAR_TYPE_EXTENSION,
2845
+ kind: w.SCALAR_TYPE_EXTENSION,
2805
2846
  name: n,
2806
2847
  directives: i
2807
2848
  });
@@ -2819,7 +2860,7 @@ class fi {
2819
2860
  if (i.length === 0 && r.length === 0 && s.length === 0)
2820
2861
  throw this.unexpected();
2821
2862
  return this.node(t, {
2822
- kind: A.OBJECT_TYPE_EXTENSION,
2863
+ kind: w.OBJECT_TYPE_EXTENSION,
2823
2864
  name: n,
2824
2865
  interfaces: i,
2825
2866
  directives: r,
@@ -2839,7 +2880,7 @@ class fi {
2839
2880
  if (i.length === 0 && r.length === 0 && s.length === 0)
2840
2881
  throw this.unexpected();
2841
2882
  return this.node(t, {
2842
- kind: A.INTERFACE_TYPE_EXTENSION,
2883
+ kind: w.INTERFACE_TYPE_EXTENSION,
2843
2884
  name: n,
2844
2885
  interfaces: i,
2845
2886
  directives: r,
@@ -2858,7 +2899,7 @@ class fi {
2858
2899
  if (i.length === 0 && r.length === 0)
2859
2900
  throw this.unexpected();
2860
2901
  return this.node(t, {
2861
- kind: A.UNION_TYPE_EXTENSION,
2902
+ kind: w.UNION_TYPE_EXTENSION,
2862
2903
  name: n,
2863
2904
  directives: i,
2864
2905
  types: r
@@ -2876,7 +2917,7 @@ class fi {
2876
2917
  if (i.length === 0 && r.length === 0)
2877
2918
  throw this.unexpected();
2878
2919
  return this.node(t, {
2879
- kind: A.ENUM_TYPE_EXTENSION,
2920
+ kind: w.ENUM_TYPE_EXTENSION,
2880
2921
  name: n,
2881
2922
  directives: i,
2882
2923
  values: r
@@ -2894,7 +2935,7 @@ class fi {
2894
2935
  if (i.length === 0 && r.length === 0)
2895
2936
  throw this.unexpected();
2896
2937
  return this.node(t, {
2897
- kind: A.INPUT_OBJECT_TYPE_EXTENSION,
2938
+ kind: w.INPUT_OBJECT_TYPE_EXTENSION,
2898
2939
  name: n,
2899
2940
  directives: i,
2900
2941
  fields: r
@@ -2908,12 +2949,12 @@ class fi {
2908
2949
  */
2909
2950
  parseDirectiveDefinition() {
2910
2951
  const t = this._lexer.token, n = this.parseDescription();
2911
- this.expectKeyword("directive"), this.expectToken(m.AT);
2952
+ this.expectKeyword("directive"), this.expectToken(d.AT);
2912
2953
  const i = this.parseName(), r = this.parseArgumentDefs(), s = this.expectOptionalKeyword("repeatable");
2913
2954
  this.expectKeyword("on");
2914
2955
  const o = this.parseDirectiveLocations();
2915
2956
  return this.node(t, {
2916
- kind: A.DIRECTIVE_DEFINITION,
2957
+ kind: w.DIRECTIVE_DEFINITION,
2917
2958
  description: n,
2918
2959
  name: i,
2919
2960
  arguments: r,
@@ -2927,7 +2968,7 @@ class fi {
2927
2968
  * - DirectiveLocations | DirectiveLocation
2928
2969
  */
2929
2970
  parseDirectiveLocations() {
2930
- return this.delimitedMany(m.PIPE, this.parseDirectiveLocation);
2971
+ return this.delimitedMany(d.PIPE, this.parseDirectiveLocation);
2931
2972
  }
2932
2973
  /*
2933
2974
  * DirectiveLocation :
@@ -2958,10 +2999,45 @@ class fi {
2958
2999
  */
2959
3000
  parseDirectiveLocation() {
2960
3001
  const t = this._lexer.token, n = this.parseName();
2961
- if (Object.prototype.hasOwnProperty.call(ze, n.value))
3002
+ if (Object.prototype.hasOwnProperty.call(qe, n.value))
2962
3003
  return n;
2963
3004
  throw this.unexpected(t);
2964
3005
  }
3006
+ // Schema Coordinates
3007
+ /**
3008
+ * SchemaCoordinate :
3009
+ * - Name
3010
+ * - Name . Name
3011
+ * - Name . Name ( Name : )
3012
+ * - \@ Name
3013
+ * - \@ Name ( Name : )
3014
+ */
3015
+ parseSchemaCoordinate() {
3016
+ const t = this._lexer.token, n = this.expectOptionalToken(d.AT), i = this.parseName();
3017
+ let r;
3018
+ !n && this.expectOptionalToken(d.DOT) && (r = this.parseName());
3019
+ let s;
3020
+ return (n || r) && this.expectOptionalToken(d.PAREN_L) && (s = this.parseName(), this.expectToken(d.COLON), this.expectToken(d.PAREN_R)), n ? s ? this.node(t, {
3021
+ kind: w.DIRECTIVE_ARGUMENT_COORDINATE,
3022
+ name: i,
3023
+ argumentName: s
3024
+ }) : this.node(t, {
3025
+ kind: w.DIRECTIVE_COORDINATE,
3026
+ name: i
3027
+ }) : r ? s ? this.node(t, {
3028
+ kind: w.ARGUMENT_COORDINATE,
3029
+ name: i,
3030
+ fieldName: r,
3031
+ argumentName: s
3032
+ }) : this.node(t, {
3033
+ kind: w.MEMBER_COORDINATE,
3034
+ name: i,
3035
+ memberName: r
3036
+ }) : this.node(t, {
3037
+ kind: w.TYPE_COORDINATE,
3038
+ name: i
3039
+ });
3040
+ }
2965
3041
  // Core parsing utility functions
2966
3042
  /**
2967
3043
  * Returns a node that, if configured to do so, sets a "loc" field as a
@@ -2969,7 +3045,7 @@ class fi {
2969
3045
  * given parsed object.
2970
3046
  */
2971
3047
  node(t, n) {
2972
- return this._options.noLocation !== !0 && (n.loc = new Un(
3048
+ return this._options.noLocation !== !0 && (n.loc = new Pn(
2973
3049
  t,
2974
3050
  this._lexer.lastToken,
2975
3051
  this._lexer.source
@@ -2989,10 +3065,10 @@ class fi {
2989
3065
  const n = this._lexer.token;
2990
3066
  if (n.kind === t)
2991
3067
  return this.advanceLexer(), n;
2992
- throw M(
3068
+ throw R(
2993
3069
  this._lexer.source,
2994
3070
  n.start,
2995
- `Expected ${kt(t)}, found ${ve(n)}.`
3071
+ `Expected ${St(t)}, found ${he(n)}.`
2996
3072
  );
2997
3073
  }
2998
3074
  /**
@@ -3008,13 +3084,13 @@ class fi {
3008
3084
  */
3009
3085
  expectKeyword(t) {
3010
3086
  const n = this._lexer.token;
3011
- if (n.kind === m.NAME && n.value === t)
3087
+ if (n.kind === d.NAME && n.value === t)
3012
3088
  this.advanceLexer();
3013
3089
  else
3014
- throw M(
3090
+ throw R(
3015
3091
  this._lexer.source,
3016
3092
  n.start,
3017
- `Expected "${t}", found ${ve(n)}.`
3093
+ `Expected "${t}", found ${he(n)}.`
3018
3094
  );
3019
3095
  }
3020
3096
  /**
@@ -3023,17 +3099,17 @@ class fi {
3023
3099
  */
3024
3100
  expectOptionalKeyword(t) {
3025
3101
  const n = this._lexer.token;
3026
- return n.kind === m.NAME && n.value === t ? (this.advanceLexer(), !0) : !1;
3102
+ return n.kind === d.NAME && n.value === t ? (this.advanceLexer(), !0) : !1;
3027
3103
  }
3028
3104
  /**
3029
3105
  * Helper function for creating an error when an unexpected lexed token is encountered.
3030
3106
  */
3031
3107
  unexpected(t) {
3032
3108
  const n = t ?? this._lexer.token;
3033
- return M(
3109
+ return R(
3034
3110
  this._lexer.source,
3035
3111
  n.start,
3036
- `Unexpected ${ve(n)}.`
3112
+ `Unexpected ${he(n)}.`
3037
3113
  );
3038
3114
  }
3039
3115
  /**
@@ -3092,29 +3168,29 @@ class fi {
3092
3168
  }
3093
3169
  advanceLexer() {
3094
3170
  const { maxTokens: t } = this._options, n = this._lexer.advance();
3095
- if (t !== void 0 && n.kind !== m.EOF && (++this._tokenCounter, this._tokenCounter > t))
3096
- throw M(
3171
+ if (n.kind !== d.EOF && (++this._tokenCounter, t !== void 0 && this._tokenCounter > t))
3172
+ throw R(
3097
3173
  this._lexer.source,
3098
3174
  n.start,
3099
3175
  `Document contains more that ${t} tokens. Parsing aborted.`
3100
3176
  );
3101
3177
  }
3102
3178
  }
3103
- function ve(e) {
3179
+ function he(e) {
3104
3180
  const t = e.value;
3105
- return kt(e.kind) + (t != null ? ` "${t}"` : "");
3181
+ return St(e.kind) + (t != null ? ` "${t}"` : "");
3106
3182
  }
3107
- function kt(e) {
3108
- return Yn(e) ? `"${e}"` : e;
3183
+ function St(e) {
3184
+ return Gn(e) ? `"${e}"` : e;
3109
3185
  }
3110
- function hi(e) {
3111
- return `"${e.replace(di, pi)}"`;
3186
+ function fi(e) {
3187
+ return `"${e.replace(hi, di)}"`;
3112
3188
  }
3113
- const di = /[\x00-\x1f\x22\x5c\x7f-\x9f]/g;
3114
- function pi(e) {
3115
- return mi[e.charCodeAt(0)];
3189
+ const hi = /[\x00-\x1f\x22\x5c\x7f-\x9f]/g;
3190
+ function di(e) {
3191
+ return pi[e.charCodeAt(0)];
3116
3192
  }
3117
- const mi = [
3193
+ const pi = [
3118
3194
  "\\u0000",
3119
3195
  "\\u0001",
3120
3196
  "\\u0002",
@@ -3280,75 +3356,72 @@ const mi = [
3280
3356
  "\\u009D",
3281
3357
  "\\u009E",
3282
3358
  "\\u009F"
3283
- ], gi = Object.freeze({});
3284
- function Ei(e, t, n = Ot) {
3359
+ ], mi = Object.freeze({});
3360
+ function gi(e, t, n = It) {
3285
3361
  const i = /* @__PURE__ */ new Map();
3286
- for (const O of Object.values(A))
3287
- i.set(O, yi(t, O));
3362
+ for (const y of Object.values(w))
3363
+ i.set(y, Ei(t, y));
3288
3364
  let r, s = Array.isArray(e), o = [e], a = -1, u = [], c = e, l, f;
3289
- const d = [], y = [];
3365
+ const h = [], m = [];
3290
3366
  do {
3291
3367
  a++;
3292
- const O = a === o.length, q = O && u.length !== 0;
3293
- if (O) {
3294
- if (l = y.length === 0 ? void 0 : d[d.length - 1], c = f, f = y.pop(), q)
3368
+ const y = a === o.length, M = y && u.length !== 0;
3369
+ if (y) {
3370
+ if (l = m.length === 0 ? void 0 : h[h.length - 1], c = f, f = m.pop(), M)
3295
3371
  if (s) {
3296
3372
  c = c.slice();
3297
- let C = 0;
3298
- for (const [J, $] of u) {
3299
- const K = J - C;
3300
- $ === null ? (c.splice(K, 1), C++) : c[K] = $;
3373
+ let _ = 0;
3374
+ for (const [Y, q] of u) {
3375
+ const W = Y - _;
3376
+ q === null ? (c.splice(W, 1), _++) : c[W] = q;
3301
3377
  }
3302
3378
  } else {
3303
- c = Object.defineProperties(
3304
- {},
3305
- Object.getOwnPropertyDescriptors(c)
3306
- );
3307
- for (const [C, J] of u)
3308
- c[C] = J;
3379
+ c = { ...c };
3380
+ for (const [_, Y] of u)
3381
+ c[_] = Y;
3309
3382
  }
3310
3383
  a = r.index, o = r.keys, u = r.edits, s = r.inArray, r = r.prev;
3311
3384
  } else if (f) {
3312
3385
  if (l = s ? a : o[a], c = f[l], c == null)
3313
3386
  continue;
3314
- d.push(l);
3387
+ h.push(l);
3315
3388
  }
3316
- let b;
3389
+ let A;
3317
3390
  if (!Array.isArray(c)) {
3318
3391
  var N, E;
3319
- ot(c) || Oe(!1, `Invalid AST Node: ${Ke(c)}.`);
3320
- const C = O ? (N = i.get(c.kind)) === null || N === void 0 ? void 0 : N.leave : (E = i.get(c.kind)) === null || E === void 0 ? void 0 : E.enter;
3321
- if (b = C?.call(t, c, l, f, d, y), b === gi)
3392
+ et(c) || ge(!1, `Invalid AST Node: ${Ye(c)}.`);
3393
+ const _ = y ? (N = i.get(c.kind)) === null || N === void 0 ? void 0 : N.leave : (E = i.get(c.kind)) === null || E === void 0 ? void 0 : E.enter;
3394
+ if (A = _?.call(t, c, l, f, h, m), A === mi)
3322
3395
  break;
3323
- if (b === !1) {
3324
- if (!O) {
3325
- d.pop();
3396
+ if (A === !1) {
3397
+ if (!y) {
3398
+ h.pop();
3326
3399
  continue;
3327
3400
  }
3328
- } else if (b !== void 0 && (u.push([l, b]), !O))
3329
- if (ot(b))
3330
- c = b;
3401
+ } else if (A !== void 0 && (u.push([l, A]), !y))
3402
+ if (et(A))
3403
+ c = A;
3331
3404
  else {
3332
- d.pop();
3405
+ h.pop();
3333
3406
  continue;
3334
3407
  }
3335
3408
  }
3336
- if (b === void 0 && q && u.push([l, c]), O)
3337
- d.pop();
3409
+ if (A === void 0 && M && u.push([l, c]), y)
3410
+ h.pop();
3338
3411
  else {
3339
- var x;
3412
+ var C;
3340
3413
  r = {
3341
3414
  inArray: s,
3342
3415
  index: a,
3343
3416
  keys: o,
3344
3417
  edits: u,
3345
3418
  prev: r
3346
- }, s = Array.isArray(c), o = s ? c : (x = n[c.kind]) !== null && x !== void 0 ? x : [], a = -1, u = [], f && y.push(f), f = c;
3419
+ }, s = Array.isArray(c), o = s ? c : (C = n[c.kind]) !== null && C !== void 0 ? C : [], a = -1, u = [], f && m.push(f), f = c;
3347
3420
  }
3348
3421
  } while (r !== void 0);
3349
3422
  return u.length !== 0 ? u[u.length - 1][1] : e;
3350
3423
  }
3351
- function yi(e, t) {
3424
+ function Ei(e, t) {
3352
3425
  const n = e[t];
3353
3426
  return typeof n == "object" ? n : typeof n == "function" ? {
3354
3427
  enter: n,
@@ -3359,9 +3432,9 @@ function yi(e, t) {
3359
3432
  };
3360
3433
  }
3361
3434
  function Ni(e) {
3362
- return Ei(e, vi);
3435
+ return gi(e, wi);
3363
3436
  }
3364
- const wi = 80, vi = {
3437
+ const Ti = 80, wi = {
3365
3438
  Name: {
3366
3439
  leave: (e) => e.value
3367
3440
  },
@@ -3370,17 +3443,21 @@ const wi = 80, vi = {
3370
3443
  },
3371
3444
  // Document
3372
3445
  Document: {
3373
- leave: (e) => w(e.definitions, `
3446
+ leave: (e) => g(e.definitions, `
3374
3447
 
3375
3448
  `)
3376
3449
  },
3377
3450
  OperationDefinition: {
3378
3451
  leave(e) {
3379
- const t = D("(", w(e.variableDefinitions, ", "), ")"), n = w(
3452
+ const t = Ce(e.variableDefinitions) ? O(`(
3453
+ `, g(e.variableDefinitions, `
3454
+ `), `
3455
+ )`) : O("(", g(e.variableDefinitions, ", "), ")"), n = O("", e.description, `
3456
+ `) + g(
3380
3457
  [
3381
3458
  e.operation,
3382
- w([e.name, t]),
3383
- w(e.directives, " ")
3459
+ g([e.name, t]),
3460
+ g(e.directives, " ")
3384
3461
  ],
3385
3462
  " "
3386
3463
  );
@@ -3388,19 +3465,20 @@ const wi = 80, vi = {
3388
3465
  }
3389
3466
  },
3390
3467
  VariableDefinition: {
3391
- leave: ({ variable: e, type: t, defaultValue: n, directives: i }) => e + ": " + t + D(" = ", n) + D(" ", w(i, " "))
3468
+ leave: ({ variable: e, type: t, defaultValue: n, directives: i, description: r }) => O("", r, `
3469
+ `) + e + ": " + t + O(" = ", n) + O(" ", g(i, " "))
3392
3470
  },
3393
3471
  SelectionSet: {
3394
- leave: ({ selections: e }) => z(e)
3472
+ leave: ({ selections: e }) => U(e)
3395
3473
  },
3396
3474
  Field: {
3397
3475
  leave({ alias: e, name: t, arguments: n, directives: i, selectionSet: r }) {
3398
- const s = D("", e, ": ") + t;
3399
- let o = s + D("(", w(n, ", "), ")");
3400
- return o.length > wi && (o = s + D(`(
3401
- `, be(w(n, `
3476
+ const s = O("", e, ": ") + t;
3477
+ let o = s + O("(", g(n, ", "), ")");
3478
+ return o.length > Ti && (o = s + O(`(
3479
+ `, Ee(g(n, `
3402
3480
  `)), `
3403
- )`)), w([o, w(i, " "), r], " ");
3481
+ )`)), g([o, g(i, " "), r], " ");
3404
3482
  }
3405
3483
  },
3406
3484
  Argument: {
@@ -3408,24 +3486,31 @@ const wi = 80, vi = {
3408
3486
  },
3409
3487
  // Fragments
3410
3488
  FragmentSpread: {
3411
- leave: ({ name: e, directives: t }) => "..." + e + D(" ", w(t, " "))
3489
+ leave: ({ name: e, directives: t }) => "..." + e + O(" ", g(t, " "))
3412
3490
  },
3413
3491
  InlineFragment: {
3414
- leave: ({ typeCondition: e, directives: t, selectionSet: n }) => w(
3492
+ leave: ({ typeCondition: e, directives: t, selectionSet: n }) => g(
3415
3493
  [
3416
3494
  "...",
3417
- D("on ", e),
3418
- w(t, " "),
3495
+ O("on ", e),
3496
+ g(t, " "),
3419
3497
  n
3420
3498
  ],
3421
3499
  " "
3422
3500
  )
3423
3501
  },
3424
3502
  FragmentDefinition: {
3425
- leave: ({ name: e, typeCondition: t, variableDefinitions: n, directives: i, selectionSet: r }) => (
3426
- // or removed in the future.
3427
- `fragment ${e}${D("(", w(n, ", "), ")")} on ${t} ${D("", w(i, " "), " ")}` + r
3428
- )
3503
+ leave: ({
3504
+ name: e,
3505
+ typeCondition: t,
3506
+ variableDefinitions: n,
3507
+ directives: i,
3508
+ selectionSet: r,
3509
+ description: s
3510
+ }) => O("", s, `
3511
+ `) + // Note: fragment variable definitions are experimental and may be changed
3512
+ // or removed in the future.
3513
+ `fragment ${e}${O("(", g(n, ", "), ")")} on ${t} ${O("", g(i, " "), " ")}` + r
3429
3514
  },
3430
3515
  // Value
3431
3516
  IntValue: {
@@ -3435,7 +3520,7 @@ const wi = 80, vi = {
3435
3520
  leave: ({ value: e }) => e
3436
3521
  },
3437
3522
  StringValue: {
3438
- leave: ({ value: e, block: t }) => t ? Hn(e) : hi(e)
3523
+ leave: ({ value: e, block: t }) => t ? jn(e) : fi(e)
3439
3524
  },
3440
3525
  BooleanValue: {
3441
3526
  leave: ({ value: e }) => e ? "true" : "false"
@@ -3447,17 +3532,17 @@ const wi = 80, vi = {
3447
3532
  leave: ({ value: e }) => e
3448
3533
  },
3449
3534
  ListValue: {
3450
- leave: ({ values: e }) => "[" + w(e, ", ") + "]"
3535
+ leave: ({ values: e }) => "[" + g(e, ", ") + "]"
3451
3536
  },
3452
3537
  ObjectValue: {
3453
- leave: ({ fields: e }) => "{" + w(e, ", ") + "}"
3538
+ leave: ({ fields: e }) => "{" + g(e, ", ") + "}"
3454
3539
  },
3455
3540
  ObjectField: {
3456
3541
  leave: ({ name: e, value: t }) => e + ": " + t
3457
3542
  },
3458
3543
  // Directive
3459
3544
  Directive: {
3460
- leave: ({ name: e, arguments: t }) => "@" + e + D("(", w(t, ", "), ")")
3545
+ leave: ({ name: e, arguments: t }) => "@" + e + O("(", g(t, ", "), ")")
3461
3546
  },
3462
3547
  // Type
3463
3548
  NamedType: {
@@ -3471,639 +3556,437 @@ const wi = 80, vi = {
3471
3556
  },
3472
3557
  // Type System Definitions
3473
3558
  SchemaDefinition: {
3474
- leave: ({ description: e, directives: t, operationTypes: n }) => D("", e, `
3475
- `) + w(["schema", w(t, " "), z(n)], " ")
3559
+ leave: ({ description: e, directives: t, operationTypes: n }) => O("", e, `
3560
+ `) + g(["schema", g(t, " "), U(n)], " ")
3476
3561
  },
3477
3562
  OperationTypeDefinition: {
3478
3563
  leave: ({ operation: e, type: t }) => e + ": " + t
3479
3564
  },
3480
3565
  ScalarTypeDefinition: {
3481
- leave: ({ description: e, name: t, directives: n }) => D("", e, `
3482
- `) + w(["scalar", t, w(n, " ")], " ")
3566
+ leave: ({ description: e, name: t, directives: n }) => O("", e, `
3567
+ `) + g(["scalar", t, g(n, " ")], " ")
3483
3568
  },
3484
3569
  ObjectTypeDefinition: {
3485
- leave: ({ description: e, name: t, interfaces: n, directives: i, fields: r }) => D("", e, `
3486
- `) + w(
3570
+ leave: ({ description: e, name: t, interfaces: n, directives: i, fields: r }) => O("", e, `
3571
+ `) + g(
3487
3572
  [
3488
3573
  "type",
3489
3574
  t,
3490
- D("implements ", w(n, " & ")),
3491
- w(i, " "),
3492
- z(r)
3575
+ O("implements ", g(n, " & ")),
3576
+ g(i, " "),
3577
+ U(r)
3493
3578
  ],
3494
3579
  " "
3495
3580
  )
3496
3581
  },
3497
3582
  FieldDefinition: {
3498
- leave: ({ description: e, name: t, arguments: n, type: i, directives: r }) => D("", e, `
3499
- `) + t + (ct(n) ? D(`(
3500
- `, be(w(n, `
3583
+ leave: ({ description: e, name: t, arguments: n, type: i, directives: r }) => O("", e, `
3584
+ `) + t + (Ce(n) ? O(`(
3585
+ `, Ee(g(n, `
3501
3586
  `)), `
3502
- )`) : D("(", w(n, ", "), ")")) + ": " + i + D(" ", w(r, " "))
3587
+ )`) : O("(", g(n, ", "), ")")) + ": " + i + O(" ", g(r, " "))
3503
3588
  },
3504
3589
  InputValueDefinition: {
3505
- leave: ({ description: e, name: t, type: n, defaultValue: i, directives: r }) => D("", e, `
3506
- `) + w(
3507
- [t + ": " + n, D("= ", i), w(r, " ")],
3590
+ leave: ({ description: e, name: t, type: n, defaultValue: i, directives: r }) => O("", e, `
3591
+ `) + g(
3592
+ [t + ": " + n, O("= ", i), g(r, " ")],
3508
3593
  " "
3509
3594
  )
3510
3595
  },
3511
3596
  InterfaceTypeDefinition: {
3512
- leave: ({ description: e, name: t, interfaces: n, directives: i, fields: r }) => D("", e, `
3513
- `) + w(
3597
+ leave: ({ description: e, name: t, interfaces: n, directives: i, fields: r }) => O("", e, `
3598
+ `) + g(
3514
3599
  [
3515
3600
  "interface",
3516
3601
  t,
3517
- D("implements ", w(n, " & ")),
3518
- w(i, " "),
3519
- z(r)
3602
+ O("implements ", g(n, " & ")),
3603
+ g(i, " "),
3604
+ U(r)
3520
3605
  ],
3521
3606
  " "
3522
3607
  )
3523
3608
  },
3524
3609
  UnionTypeDefinition: {
3525
- leave: ({ description: e, name: t, directives: n, types: i }) => D("", e, `
3526
- `) + w(
3527
- ["union", t, w(n, " "), D("= ", w(i, " | "))],
3610
+ leave: ({ description: e, name: t, directives: n, types: i }) => O("", e, `
3611
+ `) + g(
3612
+ ["union", t, g(n, " "), O("= ", g(i, " | "))],
3528
3613
  " "
3529
3614
  )
3530
3615
  },
3531
3616
  EnumTypeDefinition: {
3532
- leave: ({ description: e, name: t, directives: n, values: i }) => D("", e, `
3533
- `) + w(["enum", t, w(n, " "), z(i)], " ")
3617
+ leave: ({ description: e, name: t, directives: n, values: i }) => O("", e, `
3618
+ `) + g(["enum", t, g(n, " "), U(i)], " ")
3534
3619
  },
3535
3620
  EnumValueDefinition: {
3536
- leave: ({ description: e, name: t, directives: n }) => D("", e, `
3537
- `) + w([t, w(n, " ")], " ")
3621
+ leave: ({ description: e, name: t, directives: n }) => O("", e, `
3622
+ `) + g([t, g(n, " ")], " ")
3538
3623
  },
3539
3624
  InputObjectTypeDefinition: {
3540
- leave: ({ description: e, name: t, directives: n, fields: i }) => D("", e, `
3541
- `) + w(["input", t, w(n, " "), z(i)], " ")
3625
+ leave: ({ description: e, name: t, directives: n, fields: i }) => O("", e, `
3626
+ `) + g(["input", t, g(n, " "), U(i)], " ")
3542
3627
  },
3543
3628
  DirectiveDefinition: {
3544
- leave: ({ description: e, name: t, arguments: n, repeatable: i, locations: r }) => D("", e, `
3545
- `) + "directive @" + t + (ct(n) ? D(`(
3546
- `, be(w(n, `
3629
+ leave: ({ description: e, name: t, arguments: n, repeatable: i, locations: r }) => O("", e, `
3630
+ `) + "directive @" + t + (Ce(n) ? O(`(
3631
+ `, Ee(g(n, `
3547
3632
  `)), `
3548
- )`) : D("(", w(n, ", "), ")")) + (i ? " repeatable" : "") + " on " + w(r, " | ")
3633
+ )`) : O("(", g(n, ", "), ")")) + (i ? " repeatable" : "") + " on " + g(r, " | ")
3549
3634
  },
3550
3635
  SchemaExtension: {
3551
- leave: ({ directives: e, operationTypes: t }) => w(
3552
- ["extend schema", w(e, " "), z(t)],
3636
+ leave: ({ directives: e, operationTypes: t }) => g(
3637
+ ["extend schema", g(e, " "), U(t)],
3553
3638
  " "
3554
3639
  )
3555
3640
  },
3556
3641
  ScalarTypeExtension: {
3557
- leave: ({ name: e, directives: t }) => w(["extend scalar", e, w(t, " ")], " ")
3642
+ leave: ({ name: e, directives: t }) => g(["extend scalar", e, g(t, " ")], " ")
3558
3643
  },
3559
3644
  ObjectTypeExtension: {
3560
- leave: ({ name: e, interfaces: t, directives: n, fields: i }) => w(
3645
+ leave: ({ name: e, interfaces: t, directives: n, fields: i }) => g(
3561
3646
  [
3562
3647
  "extend type",
3563
3648
  e,
3564
- D("implements ", w(t, " & ")),
3565
- w(n, " "),
3566
- z(i)
3649
+ O("implements ", g(t, " & ")),
3650
+ g(n, " "),
3651
+ U(i)
3567
3652
  ],
3568
3653
  " "
3569
3654
  )
3570
3655
  },
3571
3656
  InterfaceTypeExtension: {
3572
- leave: ({ name: e, interfaces: t, directives: n, fields: i }) => w(
3657
+ leave: ({ name: e, interfaces: t, directives: n, fields: i }) => g(
3573
3658
  [
3574
3659
  "extend interface",
3575
3660
  e,
3576
- D("implements ", w(t, " & ")),
3577
- w(n, " "),
3578
- z(i)
3661
+ O("implements ", g(t, " & ")),
3662
+ g(n, " "),
3663
+ U(i)
3579
3664
  ],
3580
3665
  " "
3581
3666
  )
3582
3667
  },
3583
3668
  UnionTypeExtension: {
3584
- leave: ({ name: e, directives: t, types: n }) => w(
3669
+ leave: ({ name: e, directives: t, types: n }) => g(
3585
3670
  [
3586
3671
  "extend union",
3587
3672
  e,
3588
- w(t, " "),
3589
- D("= ", w(n, " | "))
3673
+ g(t, " "),
3674
+ O("= ", g(n, " | "))
3590
3675
  ],
3591
3676
  " "
3592
3677
  )
3593
3678
  },
3594
3679
  EnumTypeExtension: {
3595
- leave: ({ name: e, directives: t, values: n }) => w(["extend enum", e, w(t, " "), z(n)], " ")
3680
+ leave: ({ name: e, directives: t, values: n }) => g(["extend enum", e, g(t, " "), U(n)], " ")
3596
3681
  },
3597
3682
  InputObjectTypeExtension: {
3598
- leave: ({ name: e, directives: t, fields: n }) => w(["extend input", e, w(t, " "), z(n)], " ")
3683
+ leave: ({ name: e, directives: t, fields: n }) => g(["extend input", e, g(t, " "), U(n)], " ")
3684
+ },
3685
+ // Schema Coordinates
3686
+ TypeCoordinate: {
3687
+ leave: ({ name: e }) => e
3688
+ },
3689
+ MemberCoordinate: {
3690
+ leave: ({ name: e, memberName: t }) => g([e, O(".", t)])
3691
+ },
3692
+ ArgumentCoordinate: {
3693
+ leave: ({ name: e, fieldName: t, argumentName: n }) => g([e, O(".", t), O("(", n, ":)")])
3694
+ },
3695
+ DirectiveCoordinate: {
3696
+ leave: ({ name: e }) => g(["@", e])
3697
+ },
3698
+ DirectiveArgumentCoordinate: {
3699
+ leave: ({ name: e, argumentName: t }) => g(["@", e, O("(", t, ":)")])
3599
3700
  }
3600
3701
  };
3601
- function w(e, t = "") {
3702
+ function g(e, t = "") {
3602
3703
  var n;
3603
3704
  return (n = e?.filter((i) => i).join(t)) !== null && n !== void 0 ? n : "";
3604
3705
  }
3605
- function z(e) {
3606
- return D(`{
3607
- `, be(w(e, `
3706
+ function U(e) {
3707
+ return O(`{
3708
+ `, Ee(g(e, `
3608
3709
  `)), `
3609
3710
  }`);
3610
3711
  }
3611
- function D(e, t, n = "") {
3712
+ function O(e, t, n = "") {
3612
3713
  return t != null && t !== "" ? e + t + n : "";
3613
3714
  }
3614
- function be(e) {
3615
- return D(" ", e.replace(/\n/g, `
3715
+ function Ee(e) {
3716
+ return O(" ", e.replace(/\n/g, `
3616
3717
  `));
3617
3718
  }
3618
- function ct(e) {
3719
+ function Ce(e) {
3619
3720
  var t;
3620
3721
  return (t = e?.some((n) => n.includes(`
3621
3722
  `))) !== null && t !== void 0 ? t : !1;
3622
3723
  }
3623
- const ut = (e) => {
3724
+ const nt = "Accept", Ue = "Content-Type", Ve = "application/json", Ct = "application/graphql-response+json", it = (e) => e.replace(/([\s,]|#[^\n\r]+)+/g, " ").trim(), vi = (e) => {
3725
+ const t = e.toLowerCase();
3726
+ return t.includes(Ct) || t.includes(Ve);
3727
+ }, rt = (e) => {
3728
+ try {
3729
+ if (Array.isArray(e))
3730
+ return {
3731
+ _tag: "Batch",
3732
+ executionResults: e.map(st)
3733
+ };
3734
+ if (me(e))
3735
+ return {
3736
+ _tag: "Single",
3737
+ executionResult: st(e)
3738
+ };
3739
+ throw new Error(`Invalid execution result: result is not object or array.
3740
+ Got:
3741
+ ${String(e)}`);
3742
+ } catch (t) {
3743
+ return t;
3744
+ }
3745
+ }, st = (e) => {
3746
+ if (typeof e != "object" || e === null)
3747
+ throw new Error("Invalid execution result: result is not object");
3748
+ let t, n, i;
3749
+ if ("errors" in e) {
3750
+ if (!me(e.errors) && !Array.isArray(e.errors))
3751
+ throw new Error("Invalid execution result: errors is not plain object OR array");
3752
+ t = e.errors;
3753
+ }
3754
+ if ("data" in e) {
3755
+ if (!me(e.data) && e.data !== null)
3756
+ throw new Error("Invalid execution result: data is not plain object");
3757
+ n = e.data;
3758
+ }
3759
+ if ("extensions" in e) {
3760
+ if (!me(e.extensions))
3761
+ throw new Error("Invalid execution result: extensions is not plain object");
3762
+ i = e.extensions;
3763
+ }
3764
+ return {
3765
+ data: n,
3766
+ errors: t,
3767
+ extensions: i
3768
+ };
3769
+ }, Ii = (e) => e._tag === "Batch" ? e.executionResults.some(ot) : ot(e.executionResult), ot = (e) => Array.isArray(e.errors) ? e.errors.length > 0 : !!e.errors, kt = (e) => typeof e == "object" && e !== null && "kind" in e && e.kind === w.OPERATION_DEFINITION, Oi = (e) => {
3624
3770
  let t;
3625
- const n = e.definitions.filter((i) => i.kind === "OperationDefinition");
3626
- return n.length === 1 && (t = n[0]?.name?.value), t;
3627
- }, Ue = (e) => {
3628
- if (typeof e == "string") {
3629
- let n;
3630
- try {
3631
- const i = li(e);
3632
- n = ut(i);
3633
- } catch {
3771
+ const n = e.definitions.filter(kt);
3772
+ return n.length === 1 && (t = n[0].name?.value), t;
3773
+ }, Ai = (e) => {
3774
+ let t = !1;
3775
+ const n = e.definitions.filter(kt);
3776
+ return n.length === 1 && (t = n[0].operation === "mutation"), t;
3777
+ }, ke = (e, t) => {
3778
+ const n = typeof e == "string" || "kind" in e ? e : String(e), i = typeof n == "string" ? n : Ni(n);
3779
+ let r = !1, s;
3780
+ if (t)
3781
+ return { expression: i, isMutation: r, operationName: s };
3782
+ const o = _n(() => typeof n == "string" ? ui(n) : n);
3783
+ return o instanceof Error ? { expression: i, isMutation: r, operationName: s } : (s = Oi(o), r = Ai(o), { expression: i, operationName: s, isMutation: r });
3784
+ }, He = JSON, Re = async (e) => {
3785
+ const t = {
3786
+ ...e,
3787
+ method: e.request._tag === "Single" ? e.request.document.isMutation ? "POST" : Ze(e.method ?? "post") : e.request.hasMutations ? "POST" : Ze(e.method ?? "post"),
3788
+ fetchOptions: {
3789
+ ...e.fetchOptions,
3790
+ errorPolicy: e.fetchOptions.errorPolicy ?? "none"
3634
3791
  }
3635
- return { query: e, operationName: n };
3636
- }
3637
- const t = ut(e);
3638
- return { query: Ni(e), operationName: t };
3639
- };
3640
- class Ee extends Error {
3641
- constructor(t, n) {
3642
- const i = `${Ee.extractMessage(t)}: ${JSON.stringify({
3643
- response: t,
3644
- request: n
3645
- })}`;
3646
- super(i), Object.setPrototypeOf(this, Ee.prototype), this.response = t, this.request = n, typeof Error.captureStackTrace == "function" && Error.captureStackTrace(this, Ee);
3792
+ }, i = await xi(t.method)(t), r = await i.text();
3793
+ let s;
3794
+ try {
3795
+ s = yi(r, i.headers.get(Ue), e.fetchOptions.jsonSerializer ?? He);
3796
+ } catch (a) {
3797
+ s = a;
3798
+ }
3799
+ const o = {
3800
+ status: i.status,
3801
+ headers: i.headers,
3802
+ body: r
3803
+ };
3804
+ if (!i.ok) {
3805
+ if (s instanceof Error)
3806
+ return new Z({ ...o }, {
3807
+ query: e.request._tag === "Single" ? e.request.document.expression : e.request.query,
3808
+ variables: e.request.variables
3809
+ });
3810
+ const a = s._tag === "Batch" ? { ...s.executionResults, ...o } : {
3811
+ ...s.executionResult,
3812
+ ...o
3813
+ };
3814
+ return new Z(a, {
3815
+ query: e.request._tag === "Single" ? e.request.document.expression : e.request.query,
3816
+ variables: e.request.variables
3817
+ });
3647
3818
  }
3648
- static extractMessage(t) {
3649
- return t.errors?.[0]?.message ?? `GraphQL Error (Code: ${t.status})`;
3819
+ if (s instanceof Error)
3820
+ throw s;
3821
+ if (Ii(s) && t.fetchOptions.errorPolicy === "none") {
3822
+ const a = s._tag === "Batch" ? { ...s.executionResults, ...o } : {
3823
+ ...s.executionResult,
3824
+ ...o
3825
+ };
3826
+ return new Z(a, {
3827
+ query: e.request._tag === "Single" ? e.request.document.expression : e.request.query,
3828
+ variables: e.request.variables
3829
+ });
3650
3830
  }
3651
- }
3652
- var Te = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
3653
- function Ti(e) {
3654
- return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
3655
- }
3656
- var Ae = { exports: {} }, lt;
3657
- function Ai() {
3658
- return lt || (lt = 1, (function(e, t) {
3659
- var n = typeof globalThis < "u" && globalThis || typeof self < "u" && self || typeof Te < "u" && Te, i = (function() {
3660
- function s() {
3661
- this.fetch = !1, this.DOMException = n.DOMException;
3662
- }
3663
- return s.prototype = n, new s();
3664
- })();
3665
- (function(s) {
3666
- (function(o) {
3667
- var a = typeof s < "u" && s || typeof self < "u" && self || // eslint-disable-next-line no-undef
3668
- typeof Te < "u" && Te || {}, u = {
3669
- searchParams: "URLSearchParams" in a,
3670
- iterable: "Symbol" in a && "iterator" in Symbol,
3671
- blob: "FileReader" in a && "Blob" in a && (function() {
3672
- try {
3673
- return new Blob(), !0;
3674
- } catch {
3675
- return !1;
3676
- }
3677
- })(),
3678
- formData: "FormData" in a,
3679
- arrayBuffer: "ArrayBuffer" in a
3680
- };
3681
- function c(h) {
3682
- return h && DataView.prototype.isPrototypeOf(h);
3683
- }
3684
- if (u.arrayBuffer)
3685
- var l = [
3686
- "[object Int8Array]",
3687
- "[object Uint8Array]",
3688
- "[object Uint8ClampedArray]",
3689
- "[object Int16Array]",
3690
- "[object Uint16Array]",
3691
- "[object Int32Array]",
3692
- "[object Uint32Array]",
3693
- "[object Float32Array]",
3694
- "[object Float64Array]"
3695
- ], f = ArrayBuffer.isView || function(h) {
3696
- return h && l.indexOf(Object.prototype.toString.call(h)) > -1;
3697
- };
3698
- function d(h) {
3699
- if (typeof h != "string" && (h = String(h)), /[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(h) || h === "")
3700
- throw new TypeError('Invalid character in header field name: "' + h + '"');
3701
- return h.toLowerCase();
3702
- }
3703
- function y(h) {
3704
- return typeof h != "string" && (h = String(h)), h;
3705
- }
3706
- function N(h) {
3707
- var p = {
3708
- next: function() {
3709
- var _ = h.shift();
3710
- return { done: _ === void 0, value: _ };
3711
- }
3712
- };
3713
- return u.iterable && (p[Symbol.iterator] = function() {
3714
- return p;
3715
- }), p;
3716
- }
3717
- function E(h) {
3718
- this.map = {}, h instanceof E ? h.forEach(function(p, _) {
3719
- this.append(_, p);
3720
- }, this) : Array.isArray(h) ? h.forEach(function(p) {
3721
- if (p.length != 2)
3722
- throw new TypeError("Headers constructor: expected name/value pair to be length 2, found" + p.length);
3723
- this.append(p[0], p[1]);
3724
- }, this) : h && Object.getOwnPropertyNames(h).forEach(function(p) {
3725
- this.append(p, h[p]);
3726
- }, this);
3727
- }
3728
- E.prototype.append = function(h, p) {
3729
- h = d(h), p = y(p);
3730
- var _ = this.map[h];
3731
- this.map[h] = _ ? _ + ", " + p : p;
3732
- }, E.prototype.delete = function(h) {
3733
- delete this.map[d(h)];
3734
- }, E.prototype.get = function(h) {
3735
- return h = d(h), this.has(h) ? this.map[h] : null;
3736
- }, E.prototype.has = function(h) {
3737
- return this.map.hasOwnProperty(d(h));
3738
- }, E.prototype.set = function(h, p) {
3739
- this.map[d(h)] = y(p);
3740
- }, E.prototype.forEach = function(h, p) {
3741
- for (var _ in this.map)
3742
- this.map.hasOwnProperty(_) && h.call(p, this.map[_], _, this);
3743
- }, E.prototype.keys = function() {
3744
- var h = [];
3745
- return this.forEach(function(p, _) {
3746
- h.push(_);
3747
- }), N(h);
3748
- }, E.prototype.values = function() {
3749
- var h = [];
3750
- return this.forEach(function(p) {
3751
- h.push(p);
3752
- }), N(h);
3753
- }, E.prototype.entries = function() {
3754
- var h = [];
3755
- return this.forEach(function(p, _) {
3756
- h.push([_, p]);
3757
- }), N(h);
3758
- }, u.iterable && (E.prototype[Symbol.iterator] = E.prototype.entries);
3759
- function x(h) {
3760
- if (!h._noBody) {
3761
- if (h.bodyUsed)
3762
- return Promise.reject(new TypeError("Already read"));
3763
- h.bodyUsed = !0;
3764
- }
3765
- }
3766
- function O(h) {
3767
- return new Promise(function(p, _) {
3768
- h.onload = function() {
3769
- p(h.result);
3770
- }, h.onerror = function() {
3771
- _(h.error);
3772
- };
3773
- });
3774
- }
3775
- function q(h) {
3776
- var p = new FileReader(), _ = O(p);
3777
- return p.readAsArrayBuffer(h), _;
3778
- }
3779
- function b(h) {
3780
- var p = new FileReader(), _ = O(p), k = /charset=([A-Za-z0-9_-]+)/.exec(h.type), L = k ? k[1] : "utf-8";
3781
- return p.readAsText(h, L), _;
3782
- }
3783
- function C(h) {
3784
- for (var p = new Uint8Array(h), _ = new Array(p.length), k = 0; k < p.length; k++)
3785
- _[k] = String.fromCharCode(p[k]);
3786
- return _.join("");
3787
- }
3788
- function J(h) {
3789
- if (h.slice)
3790
- return h.slice(0);
3791
- var p = new Uint8Array(h.byteLength);
3792
- return p.set(new Uint8Array(h)), p.buffer;
3793
- }
3794
- function $() {
3795
- return this.bodyUsed = !1, this._initBody = function(h) {
3796
- this.bodyUsed = this.bodyUsed, this._bodyInit = h, h ? typeof h == "string" ? this._bodyText = h : u.blob && Blob.prototype.isPrototypeOf(h) ? this._bodyBlob = h : u.formData && FormData.prototype.isPrototypeOf(h) ? this._bodyFormData = h : u.searchParams && URLSearchParams.prototype.isPrototypeOf(h) ? this._bodyText = h.toString() : u.arrayBuffer && u.blob && c(h) ? (this._bodyArrayBuffer = J(h.buffer), this._bodyInit = new Blob([this._bodyArrayBuffer])) : u.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(h) || f(h)) ? this._bodyArrayBuffer = J(h) : this._bodyText = h = Object.prototype.toString.call(h) : (this._noBody = !0, this._bodyText = ""), this.headers.get("content-type") || (typeof h == "string" ? this.headers.set("content-type", "text/plain;charset=UTF-8") : this._bodyBlob && this._bodyBlob.type ? this.headers.set("content-type", this._bodyBlob.type) : u.searchParams && URLSearchParams.prototype.isPrototypeOf(h) && this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8"));
3797
- }, u.blob && (this.blob = function() {
3798
- var h = x(this);
3799
- if (h)
3800
- return h;
3801
- if (this._bodyBlob)
3802
- return Promise.resolve(this._bodyBlob);
3803
- if (this._bodyArrayBuffer)
3804
- return Promise.resolve(new Blob([this._bodyArrayBuffer]));
3805
- if (this._bodyFormData)
3806
- throw new Error("could not read FormData body as blob");
3807
- return Promise.resolve(new Blob([this._bodyText]));
3808
- }), this.arrayBuffer = function() {
3809
- if (this._bodyArrayBuffer) {
3810
- var h = x(this);
3811
- return h || (ArrayBuffer.isView(this._bodyArrayBuffer) ? Promise.resolve(
3812
- this._bodyArrayBuffer.buffer.slice(
3813
- this._bodyArrayBuffer.byteOffset,
3814
- this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength
3815
- )
3816
- ) : Promise.resolve(this._bodyArrayBuffer));
3817
- } else {
3818
- if (u.blob)
3819
- return this.blob().then(q);
3820
- throw new Error("could not read as ArrayBuffer");
3821
- }
3822
- }, this.text = function() {
3823
- var h = x(this);
3824
- if (h)
3825
- return h;
3826
- if (this._bodyBlob)
3827
- return b(this._bodyBlob);
3828
- if (this._bodyArrayBuffer)
3829
- return Promise.resolve(C(this._bodyArrayBuffer));
3830
- if (this._bodyFormData)
3831
- throw new Error("could not read FormData body as text");
3832
- return Promise.resolve(this._bodyText);
3833
- }, u.formData && (this.formData = function() {
3834
- return this.text().then(me);
3835
- }), this.json = function() {
3836
- return this.text().then(JSON.parse);
3837
- }, this;
3838
- }
3839
- var K = ["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"];
3840
- function ae(h) {
3841
- var p = h.toUpperCase();
3842
- return K.indexOf(p) > -1 ? p : h;
3843
- }
3844
- function H(h, p) {
3845
- if (!(this instanceof H))
3846
- throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');
3847
- p = p || {};
3848
- var _ = p.body;
3849
- if (h instanceof H) {
3850
- if (h.bodyUsed)
3851
- throw new TypeError("Already read");
3852
- this.url = h.url, this.credentials = h.credentials, p.headers || (this.headers = new E(h.headers)), this.method = h.method, this.mode = h.mode, this.signal = h.signal, !_ && h._bodyInit != null && (_ = h._bodyInit, h.bodyUsed = !0);
3853
- } else
3854
- this.url = String(h);
3855
- if (this.credentials = p.credentials || this.credentials || "same-origin", (p.headers || !this.headers) && (this.headers = new E(p.headers)), this.method = ae(p.method || this.method || "GET"), this.mode = p.mode || this.mode || null, this.signal = p.signal || this.signal || (function() {
3856
- if ("AbortController" in a) {
3857
- var S = new AbortController();
3858
- return S.signal;
3859
- }
3860
- })(), this.referrer = null, (this.method === "GET" || this.method === "HEAD") && _)
3861
- throw new TypeError("Body not allowed for GET or HEAD requests");
3862
- if (this._initBody(_), (this.method === "GET" || this.method === "HEAD") && (p.cache === "no-store" || p.cache === "no-cache")) {
3863
- var k = /([?&])_=[^&]*/;
3864
- if (k.test(this.url))
3865
- this.url = this.url.replace(k, "$1_=" + (/* @__PURE__ */ new Date()).getTime());
3866
- else {
3867
- var L = /\?/;
3868
- this.url += (L.test(this.url) ? "&" : "?") + "_=" + (/* @__PURE__ */ new Date()).getTime();
3869
- }
3870
- }
3871
- }
3872
- H.prototype.clone = function() {
3873
- return new H(this, { body: this._bodyInit });
3874
- };
3875
- function me(h) {
3876
- var p = new FormData();
3877
- return h.trim().split("&").forEach(function(_) {
3878
- if (_) {
3879
- var k = _.split("="), L = k.shift().replace(/\+/g, " "), S = k.join("=").replace(/\+/g, " ");
3880
- p.append(decodeURIComponent(L), decodeURIComponent(S));
3881
- }
3882
- }), p;
3883
- }
3884
- function Y(h) {
3885
- var p = new E(), _ = h.replace(/\r?\n[\t ]+/g, " ");
3886
- return _.split("\r").map(function(k) {
3887
- return k.indexOf(`
3888
- `) === 0 ? k.substr(1, k.length) : k;
3889
- }).forEach(function(k) {
3890
- var L = k.split(":"), S = L.shift().trim();
3891
- if (S) {
3892
- var we = L.join(":").trim();
3893
- try {
3894
- p.append(S, we);
3895
- } catch (Me) {
3896
- console.warn("Response " + Me.message);
3897
- }
3898
- }
3899
- }), p;
3900
- }
3901
- $.call(H.prototype);
3902
- function V(h, p) {
3903
- if (!(this instanceof V))
3904
- throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');
3905
- if (p || (p = {}), this.type = "default", this.status = p.status === void 0 ? 200 : p.status, this.status < 200 || this.status > 599)
3906
- throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");
3907
- this.ok = this.status >= 200 && this.status < 300, this.statusText = p.statusText === void 0 ? "" : "" + p.statusText, this.headers = new E(p.headers), this.url = p.url || "", this._initBody(h);
3908
- }
3909
- $.call(V.prototype), V.prototype.clone = function() {
3910
- return new V(this._bodyInit, {
3911
- status: this.status,
3912
- statusText: this.statusText,
3913
- headers: new E(this.headers),
3914
- url: this.url
3915
- });
3916
- }, V.error = function() {
3917
- var h = new V(null, { status: 200, statusText: "" });
3918
- return h.ok = !1, h.status = 0, h.type = "error", h;
3919
- };
3920
- var ce = [301, 302, 303, 307, 308];
3921
- V.redirect = function(h, p) {
3922
- if (ce.indexOf(p) === -1)
3923
- throw new RangeError("Invalid status code");
3924
- return new V(null, { status: p, headers: { location: h } });
3925
- }, o.DOMException = a.DOMException;
3926
- try {
3927
- new o.DOMException();
3928
- } catch {
3929
- o.DOMException = function(p, _) {
3930
- this.message = p, this.name = _;
3931
- var k = Error(p);
3932
- this.stack = k.stack;
3933
- }, o.DOMException.prototype = Object.create(Error.prototype), o.DOMException.prototype.constructor = o.DOMException;
3934
- }
3935
- function re(h, p) {
3936
- return new Promise(function(_, k) {
3937
- var L = new H(h, p);
3938
- if (L.signal && L.signal.aborted)
3939
- return k(new o.DOMException("Aborted", "AbortError"));
3940
- var S = new XMLHttpRequest();
3941
- function we() {
3942
- S.abort();
3943
- }
3944
- S.onload = function() {
3945
- var B = {
3946
- statusText: S.statusText,
3947
- headers: Y(S.getAllResponseHeaders() || "")
3948
- };
3949
- L.url.indexOf("file://") === 0 && (S.status < 200 || S.status > 599) ? B.status = 200 : B.status = S.status, B.url = "responseURL" in S ? S.responseURL : B.headers.get("X-Request-URL");
3950
- var se = "response" in S ? S.response : S.responseText;
3951
- setTimeout(function() {
3952
- _(new V(se, B));
3953
- }, 0);
3954
- }, S.onerror = function() {
3955
- setTimeout(function() {
3956
- k(new TypeError("Network request failed"));
3957
- }, 0);
3958
- }, S.ontimeout = function() {
3959
- setTimeout(function() {
3960
- k(new TypeError("Network request timed out"));
3961
- }, 0);
3962
- }, S.onabort = function() {
3963
- setTimeout(function() {
3964
- k(new o.DOMException("Aborted", "AbortError"));
3965
- }, 0);
3966
- };
3967
- function Me(B) {
3968
- try {
3969
- return B === "" && a.location.href ? a.location.href : B;
3970
- } catch {
3971
- return B;
3972
- }
3973
- }
3974
- if (S.open(L.method, Me(L.url), !0), L.credentials === "include" ? S.withCredentials = !0 : L.credentials === "omit" && (S.withCredentials = !1), "responseType" in S && (u.blob ? S.responseType = "blob" : u.arrayBuffer && (S.responseType = "arraybuffer")), p && typeof p.headers == "object" && !(p.headers instanceof E || a.Headers && p.headers instanceof a.Headers)) {
3975
- var et = [];
3976
- Object.getOwnPropertyNames(p.headers).forEach(function(B) {
3977
- et.push(d(B)), S.setRequestHeader(B, y(p.headers[B]));
3978
- }), L.headers.forEach(function(B, se) {
3979
- et.indexOf(se) === -1 && S.setRequestHeader(se, B);
3980
- });
3981
- } else
3982
- L.headers.forEach(function(B, se) {
3983
- S.setRequestHeader(se, B);
3984
- });
3985
- L.signal && (L.signal.addEventListener("abort", we), S.onreadystatechange = function() {
3986
- S.readyState === 4 && L.signal.removeEventListener("abort", we);
3987
- }), S.send(typeof L._bodyInit > "u" ? null : L._bodyInit);
3988
- });
3989
- }
3990
- return re.polyfill = !0, a.fetch || (a.fetch = re, a.Headers = E, a.Request = H, a.Response = V), o.Headers = E, o.Request = H, o.Response = V, o.fetch = re, Object.defineProperty(o, "__esModule", { value: !0 }), o;
3991
- })({});
3992
- })(i), i.fetch.ponyfill = !0, delete i.fetch.polyfill;
3993
- var r = n.fetch ? n : i;
3994
- t = r.fetch, t.default = r.fetch, t.fetch = r.fetch, t.Headers = r.Headers, t.Request = r.Request, t.Response = r.Response, e.exports = t;
3995
- })(Ae, Ae.exports)), Ae.exports;
3996
- }
3997
- var Ce = Ai();
3998
- const _e = /* @__PURE__ */ Ti(Ce), Ii = /* @__PURE__ */ Lt({
3999
- __proto__: null,
4000
- default: _e
4001
- }, [Ce]), ue = (e) => {
4002
- let t = {};
4003
- return e && (typeof Headers < "u" && e instanceof Headers || Ii && Ce.Headers && e instanceof Ce.Headers ? t = xn(e) : Array.isArray(e) ? e.forEach(([n, i]) => {
4004
- n && i !== void 0 && (t[n] = i);
4005
- }) : t = e), t;
4006
- }, ft = (e) => e.replace(/([\s,]|#[^\n\r]+)+/g, " ").trim(), Oi = (e) => {
4007
- if (!Array.isArray(e.query)) {
4008
- const i = e, r = [`query=${encodeURIComponent(ft(i.query))}`];
4009
- return e.variables && r.push(`variables=${encodeURIComponent(i.jsonSerializer.stringify(i.variables))}`), i.operationName && r.push(`operationName=${encodeURIComponent(i.operationName)}`), r.join("&");
4010
- }
4011
- if (typeof e.variables < "u" && !Array.isArray(e.variables))
4012
- throw new Error("Cannot create query with given variable type, array expected");
4013
- const t = e, n = e.query.reduce((i, r, s) => (i.push({
4014
- query: ft(r),
4015
- variables: t.variables ? t.jsonSerializer.stringify(t.variables[s]) : void 0
4016
- }), i), []);
4017
- return `query=${encodeURIComponent(t.jsonSerializer.stringify(n))}`;
4018
- }, bi = (e) => async (t) => {
4019
- const { url: n, query: i, variables: r, operationName: s, fetch: o, fetchOptions: a, middleware: u } = t, c = { ...t.headers };
4020
- let l = "", f;
4021
- e === "POST" ? (f = Di(i, r, s, a.jsonSerializer), typeof f == "string" && (c["Content-Type"] = "application/json")) : l = Oi({
4022
- query: i,
4023
- variables: r,
4024
- operationName: s,
4025
- jsonSerializer: a.jsonSerializer ?? Ze
4026
- });
4027
- const d = {
4028
- method: e,
4029
- headers: c,
4030
- body: f,
4031
- ...a
4032
- };
4033
- let y = n, N = d;
4034
- if (u) {
4035
- const E = await Promise.resolve(u({ ...d, url: n, operationName: s, variables: r })), { url: x, ...O } = E;
4036
- y = x, N = O;
3831
+ switch (s._tag) {
3832
+ case "Single":
3833
+ return {
3834
+ ...o,
3835
+ ...at(t)(s.executionResult)
3836
+ };
3837
+ case "Batch":
3838
+ return {
3839
+ ...o,
3840
+ data: s.executionResults.map(at(t))
3841
+ };
3842
+ default:
3843
+ $e(s);
3844
+ }
3845
+ }, at = (e) => (t) => ({
3846
+ extensions: t.extensions,
3847
+ data: t.data,
3848
+ errors: e.fetchOptions.errorPolicy === "all" ? t.errors : void 0
3849
+ }), yi = (e, t, n) => t && vi(t) ? rt(n.parse(e)) : rt(e), xi = (e) => async (t) => {
3850
+ const n = new Headers(t.headers);
3851
+ let i = null, r;
3852
+ n.has(nt) || n.set(nt, [Ct, Ve].join(", ")), e === "POST" ? (r = (t.fetchOptions.jsonSerializer ?? He).stringify(Di(t)), typeof r == "string" && !n.has(Ue) && n.set(Ue, Ve)) : i = _i(t);
3853
+ const s = { method: e, headers: n, body: r, ...t.fetchOptions };
3854
+ let o = new URL(t.url), a = s;
3855
+ if (t.middleware) {
3856
+ const c = await Promise.resolve(t.middleware({
3857
+ ...s,
3858
+ url: t.url,
3859
+ operationName: t.request._tag === "Single" ? t.request.document.operationName : void 0,
3860
+ variables: t.request.variables
3861
+ })), { url: l, ...f } = c;
3862
+ o = new URL(l), a = f;
3863
+ }
3864
+ return i && i.forEach((c, l) => {
3865
+ o.searchParams.append(l, c);
3866
+ }), await (t.fetch ?? fetch)(o, a);
3867
+ }, Di = (e) => {
3868
+ switch (e.request._tag) {
3869
+ case "Single":
3870
+ return {
3871
+ query: e.request.document.expression,
3872
+ variables: e.request.variables,
3873
+ operationName: e.request.document.operationName
3874
+ };
3875
+ case "Batch":
3876
+ return Tt(e.request.query, e.request.variables ?? []).map(([t, n]) => ({
3877
+ query: t,
3878
+ variables: n
3879
+ }));
3880
+ default:
3881
+ throw $e(e.request);
3882
+ }
3883
+ }, _i = (e) => {
3884
+ const t = e.fetchOptions.jsonSerializer ?? He, n = new URLSearchParams();
3885
+ switch (e.request._tag) {
3886
+ case "Single":
3887
+ return n.append("query", it(e.request.document.expression)), e.request.variables && n.append("variables", t.stringify(e.request.variables)), e.request.document.operationName && n.append("operationName", e.request.document.operationName), n;
3888
+ case "Batch": {
3889
+ const i = e.request.variables?.map((o) => t.stringify(o)) ?? [], r = e.request.query.map(it), s = Tt(r, i).map(([o, a]) => ({
3890
+ query: o,
3891
+ variables: a
3892
+ }));
3893
+ return n.append("query", t.stringify(s)), n;
3894
+ }
3895
+ default:
3896
+ throw $e(e.request);
4037
3897
  }
4038
- return l && (y = `${y}?${l}`), await o(y, N);
4039
3898
  };
4040
- class _i {
3899
+ class Si {
3900
+ url;
3901
+ requestConfig;
4041
3902
  constructor(t, n = {}) {
4042
- this.url = t, this.requestConfig = n, this.rawRequest = async (...i) => {
4043
- const [r, s, o] = i, a = kn(r, s, o), { headers: u, fetch: c = _e, method: l = "POST", requestMiddleware: f, responseMiddleware: d, ...y } = this.requestConfig, { url: N } = this;
4044
- a.signal !== void 0 && (y.signal = a.signal);
4045
- const { operationName: E } = Ue(a.query);
4046
- return qe({
4047
- url: N,
4048
- query: a.query,
4049
- variables: a.variables,
4050
- headers: {
4051
- ...ue(Ve(u)),
4052
- ...ue(a.requestHeaders)
4053
- },
4054
- operationName: E,
4055
- fetch: c,
4056
- method: l,
4057
- fetchOptions: y,
4058
- middleware: f
4059
- }).then((x) => (d && d(x), x)).catch((x) => {
4060
- throw d && d(x), x;
4061
- });
4062
- };
3903
+ this.url = t, this.requestConfig = n;
4063
3904
  }
3905
+ /**
3906
+ * Send a GraphQL query to the server.
3907
+ */
3908
+ rawRequest = async (...t) => {
3909
+ const [n, i, r] = t, s = kn(n, i, r), { headers: o, fetch: a = globalThis.fetch, method: u = "POST", requestMiddleware: c, responseMiddleware: l, excludeOperationName: f, ...h } = this.requestConfig, { url: m } = this;
3910
+ s.signal !== void 0 && (h.signal = s.signal);
3911
+ const N = ke(s.query, f), E = await Re({
3912
+ url: m,
3913
+ request: {
3914
+ _tag: "Single",
3915
+ document: N,
3916
+ variables: s.variables
3917
+ },
3918
+ headers: {
3919
+ ...K(_e(o)),
3920
+ ...K(s.requestHeaders)
3921
+ },
3922
+ fetch: a,
3923
+ method: u,
3924
+ fetchOptions: h,
3925
+ middleware: c
3926
+ });
3927
+ if (l && await l(E, {
3928
+ operationName: N.operationName,
3929
+ variables: i,
3930
+ url: this.url
3931
+ }), E instanceof Error)
3932
+ throw E;
3933
+ return E;
3934
+ };
4064
3935
  async request(t, ...n) {
4065
- const [i, r] = n, s = Cn(t, i, r), { headers: o, fetch: a = _e, method: u = "POST", requestMiddleware: c, responseMiddleware: l, ...f } = this.requestConfig, { url: d } = this;
4066
- s.signal !== void 0 && (f.signal = s.signal);
4067
- const { query: y, operationName: N } = Ue(s.document);
4068
- return qe({
4069
- url: d,
4070
- query: y,
4071
- variables: s.variables,
3936
+ const [i, r] = n, s = Ci(t, i, r), { headers: o, fetch: a = globalThis.fetch, method: u = "POST", requestMiddleware: c, responseMiddleware: l, excludeOperationName: f, ...h } = this.requestConfig, { url: m } = this;
3937
+ s.signal !== void 0 && (h.signal = s.signal);
3938
+ const N = ke(s.document, f), E = await Re({
3939
+ url: m,
3940
+ request: {
3941
+ _tag: "Single",
3942
+ document: N,
3943
+ variables: s.variables
3944
+ },
4072
3945
  headers: {
4073
- ...ue(Ve(o)),
4074
- ...ue(s.requestHeaders)
3946
+ ...K(_e(o)),
3947
+ ...K(s.requestHeaders)
4075
3948
  },
4076
- operationName: N,
4077
3949
  fetch: a,
4078
3950
  method: u,
4079
- fetchOptions: f,
3951
+ fetchOptions: h,
4080
3952
  middleware: c
4081
- }).then((E) => (l && l(E), E.data)).catch((E) => {
4082
- throw l && l(E), E;
4083
3953
  });
4084
- }
4085
- // prettier-ignore
4086
- batchRequests(t, n) {
4087
- const i = Rn(t, n), { headers: r, ...s } = this.requestConfig;
4088
- i.signal !== void 0 && (s.signal = i.signal);
4089
- const o = i.documents.map(({ document: u }) => Ue(u).query), a = i.documents.map(({ variables: u }) => u);
4090
- return qe({
3954
+ if (l && await l(E, {
3955
+ operationName: N.operationName,
3956
+ variables: s.variables,
3957
+ url: this.url
3958
+ }), E instanceof Error)
3959
+ throw E;
3960
+ return E.data;
3961
+ }
3962
+ async batchRequests(t, n) {
3963
+ const i = Cn(t, n), { headers: r, excludeOperationName: s, ...o } = this.requestConfig;
3964
+ i.signal !== void 0 && (o.signal = i.signal);
3965
+ const a = i.documents.map(({ document: h }) => ke(h, s)), u = a.map(({ expression: h }) => h), c = a.some(({ isMutation: h }) => h), l = i.documents.map(({ variables: h }) => h), f = await Re({
4091
3966
  url: this.url,
4092
- query: o,
4093
- // @ts-expect-error TODO reconcile batch variables into system.
4094
- variables: a,
3967
+ request: {
3968
+ _tag: "Batch",
3969
+ operationName: void 0,
3970
+ query: u,
3971
+ hasMutations: c,
3972
+ variables: l
3973
+ },
4095
3974
  headers: {
4096
- ...ue(Ve(r)),
4097
- ...ue(i.requestHeaders)
3975
+ ...K(_e(r)),
3976
+ ...K(i.requestHeaders)
4098
3977
  },
4099
- operationName: void 0,
4100
- fetch: this.requestConfig.fetch ?? _e,
3978
+ fetch: this.requestConfig.fetch ?? globalThis.fetch,
4101
3979
  method: this.requestConfig.method || "POST",
4102
- fetchOptions: s,
3980
+ fetchOptions: o,
4103
3981
  middleware: this.requestConfig.requestMiddleware
4104
- }).then((u) => (this.requestConfig.responseMiddleware && this.requestConfig.responseMiddleware(u), u.data)).catch((u) => {
4105
- throw this.requestConfig.responseMiddleware && this.requestConfig.responseMiddleware(u), u;
4106
3982
  });
3983
+ if (this.requestConfig.responseMiddleware && await this.requestConfig.responseMiddleware(f, {
3984
+ operationName: void 0,
3985
+ variables: l,
3986
+ url: this.url
3987
+ }), f instanceof Error)
3988
+ throw f;
3989
+ return f.data;
4107
3990
  }
4108
3991
  setHeaders(t) {
4109
3992
  return this.requestConfig.headers = t, this;
@@ -4122,39 +4005,12 @@ class _i {
4122
4005
  return this.url = t, this;
4123
4006
  }
4124
4007
  }
4125
- const qe = async (e) => {
4126
- const { query: t, variables: n, fetchOptions: i } = e, r = bi(Sn(e.method ?? "post")), s = Array.isArray(e.query), o = await r(e), a = await Si(o, i.jsonSerializer ?? Ze), u = Array.isArray(a) ? !a.some(({ data: l }) => !l) : !!a.data, c = Array.isArray(a) || !a.errors || Array.isArray(a.errors) && !a.errors.length || i.errorPolicy === "all" || i.errorPolicy === "ignore";
4127
- if (o.ok && c && u) {
4128
- const { errors: l, ...f } = (Array.isArray(a), a), d = i.errorPolicy === "ignore" ? f : a;
4129
- return {
4130
- ...s ? { data: d } : d,
4131
- headers: o.headers,
4132
- status: o.status
4133
- };
4134
- } else {
4135
- const l = typeof a == "string" ? {
4136
- error: a
4137
- } : a;
4138
- throw new Ee(
4139
- // @ts-expect-error TODO
4140
- { ...l, status: o.status, headers: o.headers },
4141
- { query: t, variables: n }
4142
- );
4143
- }
4144
- }, Di = (e, t, n, i) => {
4145
- const r = i ?? Ze;
4146
- if (!Array.isArray(e))
4147
- return r.stringify({ query: e, variables: t, operationName: n });
4148
- if (typeof t < "u" && !Array.isArray(t))
4149
- throw new Error("Cannot create request body with given variable type, array expected");
4150
- const s = e.reduce((o, a, u) => (o.push({ query: a, variables: t ? t[u] : void 0 }), o), []);
4151
- return r.stringify(s);
4152
- }, Si = async (e, t) => {
4153
- let n;
4154
- return e.headers.forEach((i, r) => {
4155
- r.toLowerCase() === "content-type" && (n = i);
4156
- }), n && (n.toLowerCase().startsWith("application/json") || n.toLowerCase().startsWith("application/graphql+json") || n.toLowerCase().startsWith("application/graphql-response+json")) ? t.parse(await e.text()) : e.text();
4157
- }, Ve = (e) => typeof e == "function" ? e() : e, Rt = (e, ...t) => e.reduce((n, i, r) => `${n}${i}${r in t ? String(t[r]) : ""}`, ""), xi = {
4008
+ const Ci = (e, t, n) => e.document ? e : {
4009
+ document: e,
4010
+ variables: t,
4011
+ requestHeaders: n,
4012
+ signal: void 0
4013
+ }, Rt = (e, ...t) => e.reduce((n, i, r) => `${n}${i}${r in t ? String(t[r]) : ""}`, ""), ki = {
4158
4014
  getMeta: Rt`
4159
4015
  query getDoctype($doctype: String!) {
4160
4016
  getMeta(doctype: $doctype) {
@@ -4166,7 +4022,7 @@ const qe = async (e) => {
4166
4022
  }
4167
4023
  }
4168
4024
  `
4169
- }, ki = Rt`
4025
+ }, bi = Rt`
4170
4026
  type Doctype {
4171
4027
  id: ID!
4172
4028
  name: String!
@@ -4212,36 +4068,36 @@ const qe = async (e) => {
4212
4068
  query: Query
4213
4069
  mutation: Mutation
4214
4070
  }
4215
- `, Ci = (e) => JSON.parse(e, (t, n) => {
4071
+ `, Ri = (e) => JSON.parse(e, (t, n) => {
4216
4072
  if (typeof n == "string")
4217
4073
  try {
4218
- return JSON.parse(n, (i, r) => typeof r == "string" && !isNaN(Number(r)) ? new de(r) : r);
4074
+ return JSON.parse(n, (i, r) => typeof r == "string" && !isNaN(Number(r)) ? new ie(r) : r);
4219
4075
  } catch {
4220
4076
  return n;
4221
4077
  }
4222
4078
  else if (!isNaN(Number(n)))
4223
- return new de(n);
4079
+ return new ie(n);
4224
4080
  return n;
4225
- }), Ri = {
4081
+ }), Li = {
4226
4082
  getMeta: async (e, t) => {
4227
- const n = new _i(t || "/graphql", {
4083
+ const n = new Si(t || "/graphql", {
4228
4084
  fetch: window.fetch,
4229
4085
  jsonSerializer: {
4230
4086
  stringify: (r) => JSON.stringify(r),
4231
4087
  // process the request object before sending; leave as default JSON
4232
- parse: Ci
4088
+ parse: Ri
4233
4089
  // process the response meta object
4234
4090
  }
4235
4091
  }), { getMeta: i } = await n.request({
4236
- document: xi.getMeta,
4092
+ document: ki.getMeta,
4237
4093
  variables: { doctype: e }
4238
4094
  });
4239
4095
  return i;
4240
4096
  }
4241
4097
  };
4242
4098
  export {
4243
- Ri as methods,
4244
- xi as queries,
4245
- ki as typeDefs
4099
+ Li as methods,
4100
+ ki as queries,
4101
+ bi as typeDefs
4246
4102
  };
4247
4103
  //# sourceMappingURL=graphql-client.js.map