@clicktap/state 0.14.7 → 0.14.8

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.
package/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { jsx as xe } from "react/jsx-runtime";
2
- import { createContext as be, useContext as Ne, useState as Oe, useEffect as Ce, cloneElement as In } from "react";
1
+ import { jsx as be } from "react/jsx-runtime";
2
+ import { createContext as Ce, useContext as Oe, useState as Ne, useEffect as ke, cloneElement as In } from "react";
3
3
  function An(e, t) {
4
4
  for (var n = 0; n < t.length; n++) {
5
5
  const s = t[n];
@@ -37,7 +37,7 @@ const bn = (e) => {
37
37
  const t = xn();
38
38
  t && t.register(e);
39
39
  };
40
- class ft {
40
+ class pt {
41
41
  constructor(t) {
42
42
  this._process = t, this._active = !1, this._current = null, this._last = null;
43
43
  }
@@ -66,7 +66,7 @@ class ft {
66
66
  this._last = null;
67
67
  }
68
68
  }
69
- const Pt = ".", Nn = "", Ft = "", On = "#", Cn = "*", Bt = "xstate.init", kn = "xstate.error", ue = "xstate.stop";
69
+ const Ft = ".", Cn = "", Bt = "", On = "#", Nn = "*", jt = "xstate.init", kn = "xstate.error", ue = "xstate.stop";
70
70
  function Dn(e, t) {
71
71
  return {
72
72
  type: `xstate.after.${e}.${t}`
@@ -84,15 +84,15 @@ function Rn(e, t) {
84
84
  output: t
85
85
  };
86
86
  }
87
- function jt(e, t) {
87
+ function $t(e, t) {
88
88
  return {
89
89
  type: `xstate.error.actor.${e}`,
90
90
  error: t
91
91
  };
92
92
  }
93
- function $t(e) {
93
+ function Vt(e) {
94
94
  return {
95
- type: Bt,
95
+ type: jt,
96
96
  input: e
97
97
  };
98
98
  }
@@ -102,7 +102,7 @@ function F(e) {
102
102
  });
103
103
  }
104
104
  const qn = (() => typeof Symbol == "function" && Symbol.observable || "@@observable")();
105
- function pt(e, t) {
105
+ function yt(e, t) {
106
106
  return `${e.sessionId}.${t}`;
107
107
  }
108
108
  let Mn = 0;
@@ -111,15 +111,15 @@ function Ln(e, t) {
111
111
  clock: a,
112
112
  logger: c
113
113
  } = t, u = {
114
- schedule: (f, m, y, v, I = Math.random().toString(36).slice(2)) => {
114
+ schedule: (f, m, y, v, _ = Math.random().toString(36).slice(2)) => {
115
115
  const w = {
116
116
  source: f,
117
117
  target: m,
118
118
  event: y,
119
119
  delay: v,
120
- id: I,
120
+ id: _,
121
121
  startedAt: Date.now()
122
- }, R = pt(f, I);
122
+ }, R = yt(f, _);
123
123
  d._snapshot._scheduledEvents[R] = w;
124
124
  const k = a.setTimeout(() => {
125
125
  delete o[R], delete d._snapshot._scheduledEvents[R], d._relay(f, m, y);
@@ -127,7 +127,7 @@ function Ln(e, t) {
127
127
  o[R] = k;
128
128
  },
129
129
  cancel: (f, m) => {
130
- const y = pt(f, m), v = o[y];
130
+ const y = yt(f, m), v = o[y];
131
131
  delete o[y], delete d._snapshot._scheduledEvents[y], a.clearTimeout(v);
132
132
  },
133
133
  cancelAll: (f) => {
@@ -190,11 +190,11 @@ function Ln(e, t) {
190
190
  const {
191
191
  source: y,
192
192
  target: v,
193
- event: I,
193
+ event: _,
194
194
  delay: w,
195
195
  id: R
196
196
  } = f[m];
197
- u.schedule(y, v, I, w, R);
197
+ u.schedule(y, v, _, w, R);
198
198
  }
199
199
  },
200
200
  _clock: a,
@@ -202,12 +202,12 @@ function Ln(e, t) {
202
202
  };
203
203
  return d;
204
204
  }
205
- function Vt(e, t) {
206
- const n = yt(e), s = yt(t);
207
- return typeof s == "string" ? typeof n == "string" ? s === n : !1 : typeof n == "string" ? n in s : Object.keys(n).every((r) => r in s ? Vt(n[r], s[r]) : !1);
205
+ function Ht(e, t) {
206
+ const n = mt(e), s = mt(t);
207
+ return typeof s == "string" ? typeof n == "string" ? s === n : !1 : typeof n == "string" ? n in s : Object.keys(n).every((r) => r in s ? Ht(n[r], s[r]) : !1);
208
208
  }
209
- function et(e) {
210
- if (zt(e))
209
+ function tt(e) {
210
+ if (Gt(e))
211
211
  return e;
212
212
  let t = [], n = "";
213
213
  for (let s = 0; s < e.length; s++) {
@@ -223,12 +223,12 @@ function et(e) {
223
223
  }
224
224
  return t.push(n), t;
225
225
  }
226
- function yt(e) {
226
+ function mt(e) {
227
227
  if (fs(e))
228
228
  return e.value;
229
229
  if (typeof e != "string")
230
230
  return e;
231
- const t = et(e);
231
+ const t = tt(e);
232
232
  return Un(t);
233
233
  }
234
234
  function Un(e) {
@@ -245,7 +245,7 @@ function Un(e) {
245
245
  }
246
246
  return t;
247
247
  }
248
- function mt(e, t) {
248
+ function gt(e, t) {
249
249
  const n = {}, s = Object.keys(e);
250
250
  for (let r = 0; r < s.length; r++) {
251
251
  const i = s[r];
@@ -253,11 +253,11 @@ function mt(e, t) {
253
253
  }
254
254
  return n;
255
255
  }
256
- function Ht(e) {
257
- return zt(e) ? e : [e];
256
+ function zt(e) {
257
+ return Gt(e) ? e : [e];
258
258
  }
259
259
  function B(e) {
260
- return e === void 0 ? [] : Ht(e);
260
+ return e === void 0 ? [] : zt(e);
261
261
  }
262
262
  function Ge(e, t, n, s) {
263
263
  return typeof e == "function" ? e({
@@ -266,22 +266,22 @@ function Ge(e, t, n, s) {
266
266
  self: s
267
267
  }) : e;
268
268
  }
269
- function zt(e) {
269
+ function Gt(e) {
270
270
  return Array.isArray(e);
271
271
  }
272
272
  function Pn(e) {
273
273
  return e.type.startsWith("xstate.error.actor");
274
274
  }
275
275
  function K(e) {
276
- return Ht(e).map((t) => typeof t > "u" || typeof t == "string" ? {
276
+ return zt(e).map((t) => typeof t > "u" || typeof t == "string" ? {
277
277
  target: t
278
278
  } : t);
279
279
  }
280
- function Gt(e) {
281
- if (!(e === void 0 || e === Nn))
280
+ function Jt(e) {
281
+ if (!(e === void 0 || e === Cn))
282
282
  return B(e);
283
283
  }
284
- function gt(e, t, n) {
284
+ function Et(e, t, n) {
285
285
  var i, o, a;
286
286
  const s = typeof e == "object", r = s ? e : void 0;
287
287
  return {
@@ -290,17 +290,17 @@ function gt(e, t, n) {
290
290
  complete: (a = s ? e.complete : n) == null ? void 0 : a.bind(r)
291
291
  };
292
292
  }
293
- function Et(e, t) {
293
+ function vt(e, t) {
294
294
  return `${t}.${e}`;
295
295
  }
296
- function tt(e, t) {
296
+ function nt(e, t) {
297
297
  const n = t.match(/^xstate\.invoke\.(\d+)\.(.*)/);
298
298
  if (!n)
299
299
  return e.implementations.actors[t];
300
300
  const [, s, r] = n, o = e.getStateNodeById(r).config.invoke;
301
301
  return (Array.isArray(o) ? o[s] : o).src;
302
302
  }
303
- const nt = 1;
303
+ const st = 1;
304
304
  let D = /* @__PURE__ */ function(e) {
305
305
  return e[e.NotStarted = 0] = "NotStarted", e[e.Running = 1] = "Running", e[e.Stopped = 2] = "Stopped", e;
306
306
  }({});
@@ -320,7 +320,7 @@ class Bn {
320
320
  * @param options Actor options
321
321
  */
322
322
  constructor(t, n) {
323
- this.logic = t, this._snapshot = void 0, this.clock = void 0, this.options = void 0, this.id = void 0, this.mailbox = new ft(this._process.bind(this)), this.observers = /* @__PURE__ */ new Set(), this.eventListeners = /* @__PURE__ */ new Map(), this.logger = void 0, this._processingStatus = D.NotStarted, this._parent = void 0, this._syncSnapshot = void 0, this.ref = void 0, this._actorScope = void 0, this._systemId = void 0, this.sessionId = void 0, this.system = void 0, this._doneEvent = void 0, this.src = void 0, this._deferred = [];
323
+ this.logic = t, this._snapshot = void 0, this.clock = void 0, this.options = void 0, this.id = void 0, this.mailbox = new pt(this._process.bind(this)), this.observers = /* @__PURE__ */ new Set(), this.eventListeners = /* @__PURE__ */ new Map(), this.logger = void 0, this._processingStatus = D.NotStarted, this._parent = void 0, this._syncSnapshot = void 0, this.ref = void 0, this._actorScope = void 0, this._systemId = void 0, this.sessionId = void 0, this.system = void 0, this._doneEvent = void 0, this.src = void 0, this._deferred = [];
324
324
  const s = {
325
325
  ...Fn,
326
326
  ...n
@@ -336,7 +336,7 @@ class Bn {
336
336
  this.system = o ? o.system : Ln(this, {
337
337
  clock: r,
338
338
  logger: i
339
- }), h && !o && this.system.inspect(gt(h)), this.sessionId = this.system._bookId(), this.id = c ?? this.sessionId, this.logger = (n == null ? void 0 : n.logger) ?? this.system._logger, this.clock = (n == null ? void 0 : n.clock) ?? this.system._clock, this._parent = o, this._syncSnapshot = a, this.options = s, this.src = s.src ?? t, this.ref = this, this._actorScope = {
339
+ }), h && !o && this.system.inspect(Et(h)), this.sessionId = this.system._bookId(), this.id = c ?? this.sessionId, this.logger = (n == null ? void 0 : n.logger) ?? this.system._logger, this.clock = (n == null ? void 0 : n.clock) ?? this.system._clock, this._parent = o, this._syncSnapshot = a, this.options = s, this.src = s.src ?? t, this.ref = this, this._actorScope = {
340
340
  self: this,
341
341
  id: this.id,
342
342
  sessionId: this.sessionId,
@@ -466,7 +466,7 @@ class Bn {
466
466
  */
467
467
  subscribe(t, n, s) {
468
468
  var i;
469
- const r = gt(t, n, s);
469
+ const r = Et(t, n, s);
470
470
  if (this._processingStatus !== D.Stopped)
471
471
  this.observers.add(r);
472
472
  else
@@ -523,7 +523,7 @@ class Bn {
523
523
  error: () => {
524
524
  }
525
525
  }), this.system._register(this.sessionId, this), this._systemId && this.system._set(this._systemId, this), this._processingStatus = D.Running;
526
- const t = $t(this.options.input);
526
+ const t = Vt(this.options.input);
527
527
  switch (this.system._sendInspectionEvent({
528
528
  type: "@xstate.event",
529
529
  sourceRef: this._parent,
@@ -610,7 +610,7 @@ class Bn {
610
610
  this.observers.clear(), n && F(t);
611
611
  }
612
612
  _error(t) {
613
- this._stopProcedure(), this._reportError(t), this._parent && this.system._relay(this, this._parent, jt(this.id, t));
613
+ this._stopProcedure(), this._reportError(t), this._parent && this.system._relay(this, this._parent, $t(this.id, t));
614
614
  }
615
615
  // TODO: atm children don't belong entirely to the actor so
616
616
  // in a way - it's not even super aware of them
@@ -618,7 +618,7 @@ class Bn {
618
618
  // right now, they are being stopped within the machine's transition
619
619
  // but that could throw and leave us with "orphaned" active actors
620
620
  _stopProcedure() {
621
- return this._processingStatus !== D.Running ? this : (this.system.scheduler.cancelAll(this), this.mailbox.clear(), this.mailbox = new ft(this._process.bind(this)), this._processingStatus = D.Stopped, this.system._unregister(this), this);
621
+ return this._processingStatus !== D.Running ? this : (this.system.scheduler.cancelAll(this), this.mailbox.clear(), this.mailbox = new pt(this._process.bind(this)), this._processingStatus = D.Stopped, this.system._unregister(this), this);
622
622
  }
623
623
  /**
624
624
  * @internal
@@ -642,7 +642,7 @@ class Bn {
642
642
  }
643
643
  toJSON() {
644
644
  return {
645
- xstate$$type: nt,
645
+ xstate$$type: st,
646
646
  id: this.id
647
647
  };
648
648
  }
@@ -708,7 +708,7 @@ function Hn(e, t, n, s, {
708
708
  input: a,
709
709
  syncSnapshot: c
710
710
  }) {
711
- const u = typeof o == "string" ? tt(t.machine, o) : o, h = typeof r == "function" ? r(n) : r;
711
+ const u = typeof o == "string" ? nt(t.machine, o) : o, h = typeof r == "function" ? r(n) : r;
712
712
  let d;
713
713
  return u && (d = j(u, {
714
714
  id: h,
@@ -771,19 +771,19 @@ function Yn(e, t) {
771
771
  });
772
772
  }
773
773
  }
774
- function Jt(e) {
774
+ function Yt(e) {
775
775
  function t(n, s) {
776
776
  }
777
777
  return t.type = "xstate.stopChild", t.actorRef = e, t.resolve = Jn, t.execute = Yn, t;
778
778
  }
779
- function st(e, t, n, s) {
779
+ function rt(e, t, n, s) {
780
780
  const {
781
781
  machine: r
782
782
  } = s, i = typeof e == "function", o = i ? e : r.implementations.guards[typeof e == "string" ? e : e.type];
783
783
  if (!i && !o)
784
784
  throw new Error(`Guard '${typeof e == "string" ? e : e.type}' is not implemented.'.`);
785
785
  if (typeof o != "function")
786
- return st(o, t, n, s);
786
+ return rt(o, t, n, s);
787
787
  const a = {
788
788
  context: t,
789
789
  event: n
@@ -798,7 +798,7 @@ function st(e, t, n, s) {
798
798
  // this holds all params
799
799
  ) : o(a, c);
800
800
  }
801
- const rt = (e) => e.type === "atomic" || e.type === "final";
801
+ const it = (e) => e.type === "atomic" || e.type === "final";
802
802
  function te(e) {
803
803
  return Object.values(e.states).filter((t) => t.type !== "history");
804
804
  }
@@ -811,15 +811,15 @@ function le(e, t) {
811
811
  n.push(s), s = s.parent;
812
812
  return n;
813
813
  }
814
- function Se(e) {
815
- const t = new Set(e), n = Qt(t);
814
+ function Ie(e) {
815
+ const t = new Set(e), n = Xt(t);
816
816
  for (const s of t)
817
817
  if (s.type === "compound" && (!n.get(s) || !n.get(s).length))
818
- vt(s).forEach((r) => t.add(r));
818
+ Tt(s).forEach((r) => t.add(r));
819
819
  else if (s.type === "parallel") {
820
820
  for (const r of te(s))
821
821
  if (r.type !== "history" && !t.has(r)) {
822
- const i = vt(r);
822
+ const i = Tt(r);
823
823
  for (const o of i)
824
824
  t.add(o);
825
825
  }
@@ -831,40 +831,40 @@ function Se(e) {
831
831
  }
832
832
  return t;
833
833
  }
834
- function Yt(e, t) {
834
+ function Qt(e, t) {
835
835
  const n = t.get(e);
836
836
  if (!n)
837
837
  return {};
838
838
  if (e.type === "compound") {
839
839
  const r = n[0];
840
840
  if (r) {
841
- if (rt(r))
841
+ if (it(r))
842
842
  return r.key;
843
843
  } else
844
844
  return {};
845
845
  }
846
846
  const s = {};
847
847
  for (const r of n)
848
- s[r.key] = Yt(r, t);
848
+ s[r.key] = Qt(r, t);
849
849
  return s;
850
850
  }
851
- function Qt(e) {
851
+ function Xt(e) {
852
852
  const t = /* @__PURE__ */ new Map();
853
853
  for (const n of e)
854
854
  t.has(n) || t.set(n, []), n.parent && (t.has(n.parent) || t.set(n.parent, []), t.get(n.parent).push(n));
855
855
  return t;
856
856
  }
857
- function Xt(e, t) {
858
- const n = Se(t);
859
- return Yt(e, Qt(n));
857
+ function Wt(e, t) {
858
+ const n = Ie(t);
859
+ return Qt(e, Xt(n));
860
860
  }
861
- function it(e, t) {
862
- return t.type === "compound" ? te(t).some((n) => n.type === "final" && e.has(n)) : t.type === "parallel" ? te(t).every((n) => it(e, n)) : t.type === "final";
861
+ function ot(e, t) {
862
+ return t.type === "compound" ? te(t).some((n) => n.type === "final" && e.has(n)) : t.type === "parallel" ? te(t).every((n) => ot(e, n)) : t.type === "final";
863
863
  }
864
- const ke = (e) => e[0] === On;
864
+ const De = (e) => e[0] === On;
865
865
  function Qn(e, t) {
866
866
  return e.transitions.get(t) || [...e.transitions.keys()].filter((s) => {
867
- if (s === Cn)
867
+ if (s === Nn)
868
868
  return !0;
869
869
  if (!s.endsWith(".*"))
870
870
  return !1;
@@ -885,7 +885,7 @@ function Xn(e) {
885
885
  return [];
886
886
  const n = (r, i) => {
887
887
  const o = Dn(r, e.id), a = o.type;
888
- return e.entry.push(Ss(o, {
888
+ return e.entry.push(_s(o, {
889
889
  id: a,
890
890
  delay: r
891
891
  })), e.exit.push(Vn(a)), a;
@@ -910,7 +910,7 @@ function Xn(e) {
910
910
  });
911
911
  }
912
912
  function G(e, t, n) {
913
- const s = Gt(n.target), r = n.reenter ?? !1, i = Zn(e, s), o = {
913
+ const s = Jt(n.target), r = n.reenter ?? !1, i = Zn(e, s), o = {
914
914
  ...n,
915
915
  actions: B(n.actions),
916
916
  guard: n.guard,
@@ -930,7 +930,7 @@ function Wn(e) {
930
930
  const t = /* @__PURE__ */ new Map();
931
931
  if (e.config.on)
932
932
  for (const n of Object.keys(e.config.on)) {
933
- if (n === Ft)
933
+ if (n === Bt)
934
934
  throw new Error('Null events ("") cannot be specified as a transition key. Use `always: { ... }` instead.');
935
935
  const s = e.config.on[n];
936
936
  t.set(n, K(s).map((r) => G(e, n, r)));
@@ -982,15 +982,15 @@ function Zn(e, t) {
982
982
  return t.map((n) => {
983
983
  if (typeof n != "string")
984
984
  return n;
985
- if (ke(n))
985
+ if (De(n))
986
986
  return e.machine.getStateNodeById(n);
987
- const s = n[0] === Pt;
987
+ const s = n[0] === Ft;
988
988
  if (s && !e.parent)
989
- return Ie(e, n.slice(1));
989
+ return Ae(e, n.slice(1));
990
990
  const r = s ? e.key + n : n;
991
991
  if (e.parent)
992
992
  try {
993
- return Ie(e.parent, r);
993
+ return Ae(e.parent, r);
994
994
  } catch (i) {
995
995
  throw new Error(`Invalid transition definition for state node '${e.id}':
996
996
  ${i.message}`);
@@ -999,23 +999,23 @@ ${i.message}`);
999
999
  throw new Error(`Invalid target: "${n}" is not a valid target from the root node. Did you mean ".${n}"?`);
1000
1000
  });
1001
1001
  }
1002
- function Wt(e) {
1003
- const t = Gt(e.config.target);
1002
+ function Kt(e) {
1003
+ const t = Jt(e.config.target);
1004
1004
  return t ? {
1005
- target: t.map((n) => typeof n == "string" ? Ie(e.parent, n) : n)
1005
+ target: t.map((n) => typeof n == "string" ? Ae(e.parent, n) : n)
1006
1006
  } : e.parent.initial;
1007
1007
  }
1008
1008
  function J(e) {
1009
1009
  return e.type === "history";
1010
1010
  }
1011
- function vt(e) {
1012
- const t = Kt(e);
1011
+ function Tt(e) {
1012
+ const t = Zt(e);
1013
1013
  for (const n of t)
1014
1014
  for (const s of le(n, e))
1015
1015
  t.add(s);
1016
1016
  return t;
1017
1017
  }
1018
- function Kt(e) {
1018
+ function Zt(e) {
1019
1019
  const t = /* @__PURE__ */ new Set();
1020
1020
  function n(s) {
1021
1021
  if (!t.has(s)) {
@@ -1029,7 +1029,7 @@ function Kt(e) {
1029
1029
  return n(e), t;
1030
1030
  }
1031
1031
  function ne(e, t) {
1032
- if (ke(t))
1032
+ if (De(t))
1033
1033
  return e.machine.getStateNodeById(t);
1034
1034
  if (!e.states)
1035
1035
  throw new Error(`Unable to retrieve child state '${t}' from '${e.id}'; no child states exist.`);
@@ -1038,13 +1038,13 @@ function ne(e, t) {
1038
1038
  throw new Error(`Child state '${t}' does not exist on '${e.id}'`);
1039
1039
  return n;
1040
1040
  }
1041
- function Ie(e, t) {
1042
- if (typeof t == "string" && ke(t))
1041
+ function Ae(e, t) {
1042
+ if (typeof t == "string" && De(t))
1043
1043
  try {
1044
1044
  return e.machine.getStateNodeById(t);
1045
1045
  } catch {
1046
1046
  }
1047
- const n = et(t).slice();
1047
+ const n = tt(t).slice();
1048
1048
  let s = e;
1049
1049
  for (; n.length; ) {
1050
1050
  const r = n.shift();
@@ -1054,7 +1054,7 @@ function Ie(e, t) {
1054
1054
  }
1055
1055
  return s;
1056
1056
  }
1057
- function Ae(e, t) {
1057
+ function we(e, t) {
1058
1058
  if (typeof t == "string") {
1059
1059
  const r = e.states[t];
1060
1060
  if (!r)
@@ -1066,7 +1066,7 @@ function Ae(e, t) {
1066
1066
  const o = ne(e, i);
1067
1067
  if (!o)
1068
1068
  return r;
1069
- const a = Ae(o, t[i]);
1069
+ const a = we(o, t[i]);
1070
1070
  return r.concat(a);
1071
1071
  }, []));
1072
1072
  }
@@ -1075,7 +1075,7 @@ function es(e, t, n, s) {
1075
1075
  return !i || !i.length ? e.next(n, s) : i;
1076
1076
  }
1077
1077
  function ts(e, t, n, s) {
1078
- const r = Object.keys(t), i = ne(e, r[0]), o = ot(i, t[r[0]], n, s);
1078
+ const r = Object.keys(t), i = ne(e, r[0]), o = at(i, t[r[0]], n, s);
1079
1079
  return !o || !o.length ? e.next(n, s) : o;
1080
1080
  }
1081
1081
  function ns(e, t, n, s) {
@@ -1084,18 +1084,18 @@ function ns(e, t, n, s) {
1084
1084
  const o = t[i];
1085
1085
  if (!o)
1086
1086
  continue;
1087
- const a = ne(e, i), c = ot(a, o, n, s);
1087
+ const a = ne(e, i), c = at(a, o, n, s);
1088
1088
  c && r.push(...c);
1089
1089
  }
1090
1090
  return r.length ? r : e.next(n, s);
1091
1091
  }
1092
- function ot(e, t, n, s) {
1092
+ function at(e, t, n, s) {
1093
1093
  return typeof t == "string" ? es(e, t, n, s) : Object.keys(t).length === 1 ? ts(e, t, n, s) : ns(e, t, n, s);
1094
1094
  }
1095
1095
  function ss(e) {
1096
1096
  return Object.keys(e.states).map((t) => e.states[t]).filter((t) => t.type === "history");
1097
1097
  }
1098
- function $(e, t) {
1098
+ function V(e, t) {
1099
1099
  let n = e;
1100
1100
  for (; n.parent && n.parent !== t; )
1101
1101
  n = n.parent;
@@ -1111,14 +1111,14 @@ function rs(e, t) {
1111
1111
  return !0;
1112
1112
  return !1;
1113
1113
  }
1114
- function Zt(e, t, n) {
1114
+ function en(e, t, n) {
1115
1115
  const s = /* @__PURE__ */ new Set();
1116
1116
  for (const r of e) {
1117
1117
  let i = !1;
1118
1118
  const o = /* @__PURE__ */ new Set();
1119
1119
  for (const a of s)
1120
1120
  if (rs(Je([r], t, n), Je([a], t, n)))
1121
- if ($(r.source, a.source))
1121
+ if (V(r.source, a.source))
1122
1122
  o.add(a);
1123
1123
  else {
1124
1124
  i = !0;
@@ -1135,10 +1135,10 @@ function Zt(e, t, n) {
1135
1135
  function is(e) {
1136
1136
  const [t, ...n] = e;
1137
1137
  for (const s of le(t, void 0))
1138
- if (n.every((r) => $(r, s)))
1138
+ if (n.every((r) => V(r, s)))
1139
1139
  return s;
1140
1140
  }
1141
- function at(e, t) {
1141
+ function ct(e, t) {
1142
1142
  if (!e.target)
1143
1143
  return [];
1144
1144
  const n = /* @__PURE__ */ new Set();
@@ -1148,17 +1148,17 @@ function at(e, t) {
1148
1148
  for (const r of t[s.id])
1149
1149
  n.add(r);
1150
1150
  else
1151
- for (const r of at(Wt(s), t))
1151
+ for (const r of ct(Kt(s), t))
1152
1152
  n.add(r);
1153
1153
  else
1154
1154
  n.add(s);
1155
1155
  return [...n];
1156
1156
  }
1157
- function en(e, t) {
1158
- const n = at(e, t);
1157
+ function tn(e, t) {
1158
+ const n = ct(e, t);
1159
1159
  if (!n)
1160
1160
  return;
1161
- if (!e.reenter && n.every((r) => r === e.source || $(r, e.source)))
1161
+ if (!e.reenter && n.every((r) => r === e.source || V(r, e.source)))
1162
1162
  return e.source;
1163
1163
  const s = is(n.concat(e.source));
1164
1164
  if (s)
@@ -1171,10 +1171,10 @@ function Je(e, t, n) {
1171
1171
  const s = /* @__PURE__ */ new Set();
1172
1172
  for (const i of e)
1173
1173
  if ((r = i.target) != null && r.length) {
1174
- const o = en(i, n);
1174
+ const o = tn(i, n);
1175
1175
  i.reenter && i.source === o && s.add(o);
1176
1176
  for (const a of t)
1177
- $(a, o) && s.add(a);
1177
+ V(a, o) && s.add(a);
1178
1178
  }
1179
1179
  return [...s];
1180
1180
  }
@@ -1191,7 +1191,7 @@ function Ye(e, t, n, s, r, i) {
1191
1191
  return t;
1192
1192
  const o = new Set(t._nodes);
1193
1193
  let a = t.historyValue;
1194
- const c = Zt(e, o, a);
1194
+ const c = en(e, o, a);
1195
1195
  let u = t;
1196
1196
  r || ([u, a] = ds(u, s, n, c, o, a, i)), u = se(u, s, n, c.flatMap((d) => d.actions), i), u = cs(u, s, n, c, o, i, a, r);
1197
1197
  const h = [...o];
@@ -1231,14 +1231,14 @@ function cs(e, t, n, s, r, i, o, a) {
1231
1231
  }
1232
1232
  if (c = se(c, t, n, m, i, f.invoke.map((y) => y.id)), f.type === "final") {
1233
1233
  const y = f.parent;
1234
- let v = (y == null ? void 0 : y.type) === "parallel" ? y : y == null ? void 0 : y.parent, I = v || f;
1235
- for ((y == null ? void 0 : y.type) === "compound" && i.push(ze(y.id, f.output !== void 0 ? Ge(f.output, c.context, t, n.self) : void 0)); (v == null ? void 0 : v.type) === "parallel" && !d.has(v) && it(r, v); )
1236
- d.add(v), i.push(ze(v.id)), I = v, v = v.parent;
1234
+ let v = (y == null ? void 0 : y.type) === "parallel" ? y : y == null ? void 0 : y.parent, _ = v || f;
1235
+ for ((y == null ? void 0 : y.type) === "compound" && i.push(ze(y.id, f.output !== void 0 ? Ge(f.output, c.context, t, n.self) : void 0)); (v == null ? void 0 : v.type) === "parallel" && !d.has(v) && ot(r, v); )
1236
+ d.add(v), i.push(ze(v.id)), _ = v, v = v.parent;
1237
1237
  if (v)
1238
1238
  continue;
1239
1239
  c = Y(c, {
1240
1240
  status: "done",
1241
- output: as(c, t, n, c.machine.root, I)
1241
+ output: as(c, t, n, c.machine.root, _)
1242
1242
  });
1243
1243
  }
1244
1244
  }
@@ -1246,17 +1246,17 @@ function cs(e, t, n, s, r, i, o, a) {
1246
1246
  }
1247
1247
  function us(e, t, n, s) {
1248
1248
  for (const r of e) {
1249
- const i = en(r, t);
1249
+ const i = tn(r, t);
1250
1250
  for (const a of r.target || [])
1251
1251
  !J(a) && // if the target is different than the source then it will *definitely* be entered
1252
1252
  (r.source !== a || // we know that the domain can't lie within the source
1253
1253
  // if it's different than the source then it's outside of it and it means that the target has to be entered as well
1254
1254
  r.source !== i || // reentering transitions always enter the target, even if it's the source itself
1255
1255
  r.reenter) && (s.add(a), n.add(a)), Z(a, t, n, s);
1256
- const o = at(r, t);
1256
+ const o = ct(r, t);
1257
1257
  for (const a of o) {
1258
1258
  const c = le(a, i);
1259
- (i == null ? void 0 : i.type) === "parallel" && c.push(i), tn(s, t, n, c, !r.source.parent && r.reenter ? void 0 : i);
1259
+ (i == null ? void 0 : i.type) === "parallel" && c.push(i), nn(s, t, n, c, !r.source.parent && r.reenter ? void 0 : i);
1260
1260
  }
1261
1261
  }
1262
1262
  }
@@ -1270,7 +1270,7 @@ function Z(e, t, n, s) {
1270
1270
  for (const o of i)
1271
1271
  Ue(o, e.parent, s, t, n);
1272
1272
  } else {
1273
- const i = Wt(e);
1273
+ const i = Kt(e);
1274
1274
  for (const o of i.target)
1275
1275
  s.add(o), i === ((r = e.parent) == null ? void 0 : r.initial) && n.add(e.parent), Z(o, t, n, s);
1276
1276
  for (const o of i.target)
@@ -1281,16 +1281,16 @@ function Z(e, t, n, s) {
1281
1281
  J(i) || (s.add(i), n.add(i)), Z(i, t, n, s), Ue(i, e, s, t, n);
1282
1282
  } else if (e.type === "parallel")
1283
1283
  for (const i of te(e).filter((o) => !J(o)))
1284
- [...s].some((o) => $(o, i)) || (J(i) || (s.add(i), n.add(i)), Z(i, t, n, s));
1284
+ [...s].some((o) => V(o, i)) || (J(i) || (s.add(i), n.add(i)), Z(i, t, n, s));
1285
1285
  }
1286
- function tn(e, t, n, s, r) {
1286
+ function nn(e, t, n, s, r) {
1287
1287
  for (const i of s)
1288
- if ((!r || $(i, r)) && e.add(i), i.type === "parallel")
1288
+ if ((!r || V(i, r)) && e.add(i), i.type === "parallel")
1289
1289
  for (const o of te(i).filter((a) => !J(a)))
1290
- [...e].some((a) => $(a, o)) || (e.add(o), Z(o, t, n, e));
1290
+ [...e].some((a) => V(a, o)) || (e.add(o), Z(o, t, n, e));
1291
1291
  }
1292
1292
  function Ue(e, t, n, s, r) {
1293
- tn(n, s, r, le(e, t));
1293
+ nn(n, s, r, le(e, t));
1294
1294
  }
1295
1295
  function ds(e, t, n, s, r, i, o) {
1296
1296
  let a = e;
@@ -1300,16 +1300,16 @@ function ds(e, t, n, s, r, i, o) {
1300
1300
  for (const h of c)
1301
1301
  for (const d of ss(h)) {
1302
1302
  let f;
1303
- d.history === "deep" ? f = (m) => rt(m) && $(m, h) : f = (m) => m.parent === h, u ?? (u = {
1303
+ d.history === "deep" ? f = (m) => it(m) && V(m, h) : f = (m) => m.parent === h, u ?? (u = {
1304
1304
  ...i
1305
1305
  }), u[d.id] = Array.from(r).filter(f);
1306
1306
  }
1307
1307
  for (const h of c)
1308
- a = se(a, t, n, [...h.exit, ...h.invoke.map((d) => Jt(d.id))], o), r.delete(h);
1308
+ a = se(a, t, n, [...h.exit, ...h.invoke.map((d) => Yt(d.id))], o), r.delete(h);
1309
1309
  return [a, u || i];
1310
1310
  }
1311
- let Tt = !1;
1312
- function nn(e, t, n, s, r, i) {
1311
+ let St = !1;
1312
+ function sn(e, t, n, s, r, i) {
1313
1313
  const {
1314
1314
  machine: o
1315
1315
  } = e;
@@ -1325,9 +1325,9 @@ function nn(e, t, n, s, r, i) {
1325
1325
  }
1326
1326
  });
1327
1327
  try {
1328
- Tt = h, h(d, f);
1328
+ St = h, h(d, f);
1329
1329
  } finally {
1330
- Tt = !1;
1330
+ St = !1;
1331
1331
  }
1332
1332
  };
1333
1333
  const u = typeof c == "function", h = u ? c : (
@@ -1353,7 +1353,7 @@ function nn(e, t, n, s, r, i) {
1353
1353
  });
1354
1354
  continue;
1355
1355
  }
1356
- const y = h, [v, I, w] = y.resolve(
1356
+ const y = h, [v, _, w] = y.resolve(
1357
1357
  n,
1358
1358
  a,
1359
1359
  d,
@@ -1362,12 +1362,12 @@ function nn(e, t, n, s, r, i) {
1362
1362
  // this holds all params
1363
1363
  r
1364
1364
  );
1365
- a = v, "retryResolve" in y && (i == null || i.push([y, I])), "execute" in y && (n.self._processingStatus === D.Running ? y.execute(n, I) : n.defer(y.execute.bind(null, n, I))), w && (a = nn(a, t, n, w, r, i));
1365
+ a = v, "retryResolve" in y && (i == null || i.push([y, _])), "execute" in y && (n.self._processingStatus === D.Running ? y.execute(n, _) : n.defer(y.execute.bind(null, n, _))), w && (a = sn(a, t, n, w, r, i));
1366
1366
  }
1367
1367
  return a;
1368
1368
  }
1369
1369
  function se(e, t, n, s, r, i) {
1370
- const o = i ? [] : void 0, a = nn(e, t, n, s, {
1370
+ const o = i ? [] : void 0, a = sn(e, t, n, s, {
1371
1371
  internalQueue: r,
1372
1372
  deferredActorIds: i
1373
1373
  }, o);
@@ -1395,8 +1395,8 @@ function Pe(e, t, n, s = []) {
1395
1395
  microstates: i
1396
1396
  };
1397
1397
  let a = t;
1398
- if (a.type !== Bt) {
1399
- const u = a, h = Pn(u), d = St(u, r);
1398
+ if (a.type !== jt) {
1399
+ const u = a, h = Pn(u), d = It(u, r);
1400
1400
  if (h && !d.length)
1401
1401
  return r = Y(e, {
1402
1402
  status: "error",
@@ -1422,7 +1422,7 @@ function Pe(e, t, n, s = []) {
1422
1422
  if (!u.length) {
1423
1423
  if (!s.length)
1424
1424
  break;
1425
- a = s.shift(), u = St(a, r);
1425
+ a = s.shift(), u = It(a, r);
1426
1426
  }
1427
1427
  r = Ye(u, r, n, a, !1, s), c = r !== h, o(r, a, u);
1428
1428
  }
@@ -1432,34 +1432,34 @@ function Pe(e, t, n, s = []) {
1432
1432
  };
1433
1433
  }
1434
1434
  function _t(e, t, n) {
1435
- return se(e, t, n, Object.values(e.children).map((s) => Jt(s)), []);
1435
+ return se(e, t, n, Object.values(e.children).map((s) => Yt(s)), []);
1436
1436
  }
1437
- function St(e, t) {
1437
+ function It(e, t) {
1438
1438
  return t.machine.getTransitionData(t, e);
1439
1439
  }
1440
1440
  function ls(e, t) {
1441
- const n = /* @__PURE__ */ new Set(), s = e._nodes.filter(rt);
1441
+ const n = /* @__PURE__ */ new Set(), s = e._nodes.filter(it);
1442
1442
  for (const r of s)
1443
1443
  e:
1444
1444
  for (const i of [r].concat(le(r, void 0)))
1445
1445
  if (i.always) {
1446
1446
  for (const o of i.always)
1447
- if (o.guard === void 0 || st(o.guard, e.context, t, e)) {
1447
+ if (o.guard === void 0 || rt(o.guard, e.context, t, e)) {
1448
1448
  n.add(o);
1449
1449
  break e;
1450
1450
  }
1451
1451
  }
1452
- return Zt(Array.from(n), new Set(e._nodes), e.historyValue);
1452
+ return en(Array.from(n), new Set(e._nodes), e.historyValue);
1453
1453
  }
1454
1454
  function hs(e, t) {
1455
- const n = Se(Ae(e, t));
1456
- return Xt(e, [...n]);
1455
+ const n = Ie(we(e, t));
1456
+ return Wt(e, [...n]);
1457
1457
  }
1458
1458
  function fs(e) {
1459
1459
  return !!e && typeof e == "object" && "machine" in e && "value" in e;
1460
1460
  }
1461
1461
  const ps = function(t) {
1462
- return Vt(t, this.value);
1462
+ return Ht(t, this.value);
1463
1463
  }, ys = function(t) {
1464
1464
  return this.tags.has(t);
1465
1465
  }, ms = function(t) {
@@ -1485,7 +1485,7 @@ const ps = function(t) {
1485
1485
  }, Es = function() {
1486
1486
  return this._nodes.reduce((t, n) => (n.meta !== void 0 && (t[n.id] = n.meta), t), {});
1487
1487
  };
1488
- function Ee(e, t) {
1488
+ function ve(e, t) {
1489
1489
  return {
1490
1490
  status: e.status,
1491
1491
  output: e.output,
@@ -1493,7 +1493,7 @@ function Ee(e, t) {
1493
1493
  machine: t,
1494
1494
  context: e.context,
1495
1495
  _nodes: e._nodes,
1496
- value: Xt(t.root, e._nodes),
1496
+ value: Wt(t.root, e._nodes),
1497
1497
  tags: new Set(e._nodes.flatMap((n) => n.tags)),
1498
1498
  children: e.children,
1499
1499
  historyValue: e.historyValue || {},
@@ -1505,7 +1505,7 @@ function Ee(e, t) {
1505
1505
  };
1506
1506
  }
1507
1507
  function Y(e, t = {}) {
1508
- return Ee({
1508
+ return ve({
1509
1509
  ...e,
1510
1510
  ...t
1511
1511
  }, e.machine);
@@ -1525,21 +1525,21 @@ function vs(e, t) {
1525
1525
  ...f
1526
1526
  } = e, m = {};
1527
1527
  for (const v in i) {
1528
- const I = i[v];
1528
+ const _ = i[v];
1529
1529
  m[v] = {
1530
- snapshot: I.getPersistedSnapshot(t),
1531
- src: I.src,
1532
- systemId: I._systemId,
1533
- syncSnapshot: I._syncSnapshot
1530
+ snapshot: _.getPersistedSnapshot(t),
1531
+ src: _.src,
1532
+ systemId: _._systemId,
1533
+ syncSnapshot: _._syncSnapshot
1534
1534
  };
1535
1535
  }
1536
1536
  return {
1537
1537
  ...f,
1538
- context: sn(o),
1538
+ context: rn(o),
1539
1539
  children: m
1540
1540
  };
1541
1541
  }
1542
- function sn(e) {
1542
+ function rn(e) {
1543
1543
  let t;
1544
1544
  for (const n in e) {
1545
1545
  const s = e[n];
@@ -1548,11 +1548,11 @@ function sn(e) {
1548
1548
  t ?? (t = Array.isArray(e) ? e.slice() : {
1549
1549
  ...e
1550
1550
  }), t[n] = {
1551
- xstate$$type: nt,
1551
+ xstate$$type: st,
1552
1552
  id: s.id
1553
1553
  };
1554
1554
  else {
1555
- const r = sn(s);
1555
+ const r = rn(s);
1556
1556
  r !== s && (t ?? (t = Array.isArray(e) ? e.slice() : {
1557
1557
  ...e
1558
1558
  }), t[n] = r);
@@ -1583,7 +1583,7 @@ function Ts(e, t, n, s, {
1583
1583
  delay: h
1584
1584
  }];
1585
1585
  }
1586
- function _s(e, t) {
1586
+ function Ss(e, t) {
1587
1587
  const {
1588
1588
  event: n,
1589
1589
  delay: s,
@@ -1597,12 +1597,12 @@ function _s(e, t) {
1597
1597
  return;
1598
1598
  }
1599
1599
  }
1600
- function Ss(e, t) {
1600
+ function _s(e, t) {
1601
1601
  function n(s, r) {
1602
1602
  }
1603
- return n.type = "xstate.raise", n.event = e, n.id = t == null ? void 0 : t.id, n.delay = t == null ? void 0 : t.delay, n.resolve = Ts, n.execute = _s, n;
1603
+ return n.type = "xstate.raise", n.event = e, n.id = t == null ? void 0 : t.id, n.delay = t == null ? void 0 : t.delay, n.resolve = Ts, n.execute = Ss, n;
1604
1604
  }
1605
- const It = /* @__PURE__ */ new WeakMap();
1605
+ const At = /* @__PURE__ */ new WeakMap();
1606
1606
  function Is(e) {
1607
1607
  return {
1608
1608
  config: e,
@@ -1614,7 +1614,7 @@ function Is(e) {
1614
1614
  receivers: void 0,
1615
1615
  dispose: void 0
1616
1616
  };
1617
- It.set(r, o), o.dispose = e({
1617
+ At.set(r, o), o.dispose = e({
1618
1618
  input: n.input,
1619
1619
  system: i,
1620
1620
  self: r,
@@ -1628,7 +1628,7 @@ function Is(e) {
1628
1628
  },
1629
1629
  transition: (n, s, r) => {
1630
1630
  var o, a;
1631
- const i = It.get(r.self);
1631
+ const i = At.get(r.self);
1632
1632
  return s.type === ue ? (n = {
1633
1633
  ...n,
1634
1634
  status: "stopped",
@@ -1645,8 +1645,8 @@ function Is(e) {
1645
1645
  restoreSnapshot: (n) => n
1646
1646
  };
1647
1647
  }
1648
- const At = "xstate.promise.resolve", wt = "xstate.promise.reject", me = /* @__PURE__ */ new WeakMap();
1649
- function V(e) {
1648
+ const wt = "xstate.promise.resolve", xt = "xstate.promise.reject", ge = /* @__PURE__ */ new WeakMap();
1649
+ function $(e) {
1650
1650
  return {
1651
1651
  config: e,
1652
1652
  transition: (n, s, r) => {
@@ -1654,7 +1654,7 @@ function V(e) {
1654
1654
  if (n.status !== "active")
1655
1655
  return n;
1656
1656
  switch (s.type) {
1657
- case At: {
1657
+ case wt: {
1658
1658
  const o = s.data;
1659
1659
  return {
1660
1660
  ...n,
@@ -1663,7 +1663,7 @@ function V(e) {
1663
1663
  input: void 0
1664
1664
  };
1665
1665
  }
1666
- case wt:
1666
+ case xt:
1667
1667
  return {
1668
1668
  ...n,
1669
1669
  status: "error",
@@ -1671,7 +1671,7 @@ function V(e) {
1671
1671
  input: void 0
1672
1672
  };
1673
1673
  case ue:
1674
- return (i = me.get(r.self)) == null || i.abort(), {
1674
+ return (i = ge.get(r.self)) == null || i.abort(), {
1675
1675
  ...n,
1676
1676
  status: "stopped",
1677
1677
  input: void 0
@@ -1687,19 +1687,19 @@ function V(e) {
1687
1687
  if (n.status !== "active")
1688
1688
  return;
1689
1689
  const i = new AbortController();
1690
- me.set(s, i), Promise.resolve(e({
1690
+ ge.set(s, i), Promise.resolve(e({
1691
1691
  input: n.input,
1692
1692
  system: r,
1693
1693
  self: s,
1694
1694
  signal: i.signal
1695
1695
  })).then((a) => {
1696
- s.getSnapshot().status === "active" && (me.delete(s), r._relay(s, s, {
1697
- type: At,
1696
+ s.getSnapshot().status === "active" && (ge.delete(s), r._relay(s, s, {
1697
+ type: wt,
1698
1698
  data: a
1699
1699
  }));
1700
1700
  }, (a) => {
1701
- s.getSnapshot().status === "active" && (me.delete(s), r._relay(s, s, {
1702
- type: wt,
1701
+ s.getSnapshot().status === "active" && (ge.delete(s), r._relay(s, s, {
1702
+ type: xt,
1703
1703
  data: a
1704
1704
  }));
1705
1705
  });
@@ -1724,7 +1724,7 @@ function As(e, {
1724
1724
  input: u
1725
1725
  } = a;
1726
1726
  if (typeof o == "string") {
1727
- const h = tt(t, o);
1727
+ const h = nt(t, o);
1728
1728
  if (!h)
1729
1729
  throw new Error(`Actor logic '${o}' not implemented in machine '${t.id}'`);
1730
1730
  const d = j(h, {
@@ -1786,7 +1786,7 @@ function ws(e, t, n, s, {
1786
1786
  } : t.children
1787
1787
  })];
1788
1788
  }
1789
- function b(e) {
1789
+ function x(e) {
1790
1790
  function t(n, s) {
1791
1791
  }
1792
1792
  return t.type = "xstate.assign", t.assignment = e, t.resolve = ws, t;
@@ -1809,10 +1809,10 @@ function Fe(e) {
1809
1809
  }
1810
1810
  return t.type = "xstate.emit", t.event = e, t.resolve = xs, t.execute = bs, t;
1811
1811
  }
1812
- let xt = /* @__PURE__ */ function(e) {
1812
+ let bt = /* @__PURE__ */ function(e) {
1813
1813
  return e.Parent = "#_parent", e.Internal = "#_internal", e;
1814
1814
  }({});
1815
- function Ns(e, t, n, s, {
1815
+ function Cs(e, t, n, s, {
1816
1816
  to: r,
1817
1817
  event: i,
1818
1818
  id: o,
@@ -1832,7 +1832,7 @@ function Ns(e, t, n, s, {
1832
1832
  const f = typeof r == "function" ? r(n, s) : r;
1833
1833
  let m;
1834
1834
  if (typeof f == "string") {
1835
- if (f === xt.Parent ? m = e.self._parent : f === xt.Internal ? m = e.self : f.startsWith("#_") ? m = t.children[f.slice(2)] : m = (y = c.deferredActorIds) != null && y.includes(f) ? f : t.children[f], !m)
1835
+ if (f === bt.Parent ? m = e.self._parent : f === bt.Internal ? m = e.self : f.startsWith("#_") ? m = t.children[f.slice(2)] : m = (y = c.deferredActorIds) != null && y.includes(f) ? f : t.children[f], !m)
1836
1836
  throw new Error(`Unable to send event to actor '${f}' from machine '${t.machine.id}'.`);
1837
1837
  } else
1838
1838
  m = f || e.self;
@@ -1846,7 +1846,7 @@ function Ns(e, t, n, s, {
1846
1846
  function Os(e, t, n) {
1847
1847
  typeof n.to == "string" && (n.to = t.children[n.to]);
1848
1848
  }
1849
- function Cs(e, t) {
1849
+ function Ns(e, t) {
1850
1850
  e.defer(() => {
1851
1851
  const {
1852
1852
  to: n,
@@ -1863,21 +1863,21 @@ function Cs(e, t) {
1863
1863
  // at this point, in a deferred task, it should already be mutated by retryResolveSendTo
1864
1864
  // if it initially started as a string
1865
1865
  n,
1866
- s.type === kn ? jt(e.self.id, s.data) : s
1866
+ s.type === kn ? $t(e.self.id, s.data) : s
1867
1867
  );
1868
1868
  });
1869
1869
  }
1870
- function bt(e, t, n) {
1870
+ function Ct(e, t, n) {
1871
1871
  function s(r, i) {
1872
1872
  }
1873
- return s.type = "xsnapshot.sendTo", s.to = e, s.event = t, s.id = n == null ? void 0 : n.id, s.delay = n == null ? void 0 : n.delay, s.resolve = Ns, s.retryResolve = Os, s.execute = Cs, s;
1873
+ return s.type = "xsnapshot.sendTo", s.to = e, s.event = t, s.id = n == null ? void 0 : n.id, s.delay = n == null ? void 0 : n.delay, s.resolve = Cs, s.retryResolve = Os, s.execute = Ns, s;
1874
1874
  }
1875
- const Nt = /* @__PURE__ */ new WeakMap();
1875
+ const Ot = /* @__PURE__ */ new WeakMap();
1876
1876
  function X(e, t, n) {
1877
- let s = Nt.get(e);
1877
+ let s = Ot.get(e);
1878
1878
  return s ? t in s || (s[t] = n()) : (s = {
1879
1879
  [t]: n()
1880
- }, Nt.set(e, s)), s[t];
1880
+ }, Ot.set(e, s)), s[t];
1881
1881
  }
1882
1882
  const ks = {}, oe = (e) => typeof e == "string" ? {
1883
1883
  type: e
@@ -1886,9 +1886,9 @@ const ks = {}, oe = (e) => typeof e == "string" ? {
1886
1886
  } : {
1887
1887
  type: e.name
1888
1888
  } : e;
1889
- class ct {
1889
+ class ut {
1890
1890
  constructor(t, n) {
1891
- if (this.config = t, this.key = void 0, this.id = void 0, this.type = void 0, this.path = void 0, this.states = void 0, this.history = void 0, this.entry = void 0, this.exit = void 0, this.parent = void 0, this.machine = void 0, this.meta = void 0, this.output = void 0, this.order = -1, this.description = void 0, this.tags = [], this.transitions = void 0, this.always = void 0, this.parent = n._parent, this.key = n._key, this.machine = n._machine, this.path = this.parent ? this.parent.path.concat(this.key) : [], this.id = this.config.id || [this.machine.id, ...this.path].join(Pt), this.type = this.config.type || (this.config.states && Object.keys(this.config.states).length ? "compound" : this.config.history ? "history" : "atomic"), this.description = this.config.description, this.order = this.machine.idMap.size, this.machine.idMap.set(this.id, this), this.states = this.config.states ? mt(this.config.states, (s, r) => new ct(s, {
1891
+ if (this.config = t, this.key = void 0, this.id = void 0, this.type = void 0, this.path = void 0, this.states = void 0, this.history = void 0, this.entry = void 0, this.exit = void 0, this.parent = void 0, this.machine = void 0, this.meta = void 0, this.output = void 0, this.order = -1, this.description = void 0, this.tags = [], this.transitions = void 0, this.always = void 0, this.parent = n._parent, this.key = n._key, this.machine = n._machine, this.path = this.parent ? this.parent.path.concat(this.key) : [], this.id = this.config.id || [this.machine.id, ...this.path].join(Ft), this.type = this.config.type || (this.config.states && Object.keys(this.config.states).length ? "compound" : this.config.history ? "history" : "atomic"), this.description = this.config.description, this.order = this.machine.idMap.size, this.machine.idMap.set(this.id, this), this.states = this.config.states ? gt(this.config.states, (s, r) => new ut(s, {
1892
1892
  _parent: this,
1893
1893
  _key: r,
1894
1894
  _machine: this.machine
@@ -1898,7 +1898,7 @@ class ct {
1898
1898
  }
1899
1899
  /** @internal */
1900
1900
  _initialize() {
1901
- this.transitions = Wn(this), this.config.always && (this.always = K(this.config.always).map((t) => G(this, Ft, t))), Object.keys(this.states).forEach((t) => {
1901
+ this.transitions = Wn(this), this.config.always && (this.always = K(this.config.always).map((t) => G(this, Bt, t))), Object.keys(this.states).forEach((t) => {
1902
1902
  this.states[t]._initialize();
1903
1903
  });
1904
1904
  }
@@ -1925,7 +1925,7 @@ class ct {
1925
1925
  })
1926
1926
  } : void 0,
1927
1927
  history: this.history,
1928
- states: mt(this.states, (t) => t.definition),
1928
+ states: gt(this.states, (t) => t.definition),
1929
1929
  on: this.on,
1930
1930
  transitions: [...this.transitions.values()].flat().map((t) => ({
1931
1931
  ...t,
@@ -1953,7 +1953,7 @@ class ct {
1953
1953
  const {
1954
1954
  src: s,
1955
1955
  systemId: r
1956
- } = t, i = t.id ?? Et(this.id, n), o = typeof s == "string" ? s : `xstate.invoke.${Et(this.id, n)}`;
1956
+ } = t, i = t.id ?? vt(this.id, n), o = typeof s == "string" ? s : `xstate.invoke.${vt(this.id, n)}`;
1957
1957
  return {
1958
1958
  ...t,
1959
1959
  src: o,
@@ -1998,7 +1998,7 @@ class ct {
1998
1998
  } = a, u = t.context;
1999
1999
  let h = !1;
2000
2000
  try {
2001
- h = !c || st(c, u, n, t);
2001
+ h = !c || rt(c, u, n, t);
2002
2002
  } catch (d) {
2003
2003
  const f = typeof c == "string" ? c : typeof c == "object" ? c.type : void 0;
2004
2004
  throw new Error(`Unable to evaluate guard ${f ? `'${f}' ` : ""}in transition for event '${s}' in state node '${this.id}':
@@ -2040,14 +2040,14 @@ ${d.message}`);
2040
2040
  }
2041
2041
  }
2042
2042
  const Ds = "#";
2043
- class ut {
2043
+ class dt {
2044
2044
  constructor(t, n) {
2045
2045
  this.config = t, this.version = void 0, this.schemas = void 0, this.implementations = void 0, this.__xstatenode = !0, this.idMap = /* @__PURE__ */ new Map(), this.root = void 0, this.id = void 0, this.states = void 0, this.events = void 0, this.__TResolvedTypesMeta = void 0, this.id = t.id || "(machine)", this.implementations = {
2046
2046
  actors: (n == null ? void 0 : n.actors) ?? {},
2047
2047
  actions: (n == null ? void 0 : n.actions) ?? {},
2048
2048
  delays: (n == null ? void 0 : n.delays) ?? {},
2049
2049
  guards: (n == null ? void 0 : n.guards) ?? {}
2050
- }, this.version = this.config.version, this.schemas = this.config.schemas, this.transition = this.transition.bind(this), this.getInitialSnapshot = this.getInitialSnapshot.bind(this), this.getPersistedSnapshot = this.getPersistedSnapshot.bind(this), this.restoreSnapshot = this.restoreSnapshot.bind(this), this.start = this.start.bind(this), this.root = new ct(t, {
2050
+ }, this.version = this.config.version, this.schemas = this.config.schemas, this.transition = this.transition.bind(this), this.getInitialSnapshot = this.getInitialSnapshot.bind(this), this.getPersistedSnapshot = this.getPersistedSnapshot.bind(this), this.restoreSnapshot = this.restoreSnapshot.bind(this), this.start = this.start.bind(this), this.root = new ut(t, {
2051
2051
  _key: this.id,
2052
2052
  _machine: this
2053
2053
  }), this.root._initialize(), this.states = this.root.states, this.events = this.root.events;
@@ -2068,7 +2068,7 @@ class ut {
2068
2068
  actors: r,
2069
2069
  delays: i
2070
2070
  } = this.implementations;
2071
- return new ut(this.config, {
2071
+ return new dt(this.config, {
2072
2072
  actions: {
2073
2073
  ...n,
2074
2074
  ...t.actions
@@ -2088,12 +2088,12 @@ class ut {
2088
2088
  });
2089
2089
  }
2090
2090
  resolveState(t) {
2091
- const n = hs(this.root, t.value), s = Se(Ae(this.root, n));
2092
- return Ee({
2091
+ const n = hs(this.root, t.value), s = Ie(we(this.root, n));
2092
+ return ve({
2093
2093
  _nodes: [...s],
2094
2094
  context: t.context || {},
2095
2095
  children: {},
2096
- status: it(s, this.root) ? "done" : t.status || "active",
2096
+ status: ot(s, this.root) ? "done" : t.status || "active",
2097
2097
  output: t.output,
2098
2098
  error: t.error,
2099
2099
  historyValue: t.historyValue
@@ -2120,7 +2120,7 @@ class ut {
2120
2120
  return Pe(t, n, s).microstates;
2121
2121
  }
2122
2122
  getTransitionData(t, n) {
2123
- return ot(this.root, t.value, t, n) || [];
2123
+ return at(this.root, t.value, t, n) || [];
2124
2124
  }
2125
2125
  /**
2126
2126
  * The initial state _before_ evaluating any microsteps.
@@ -2129,13 +2129,13 @@ class ut {
2129
2129
  getPreInitialState(t, n, s) {
2130
2130
  const {
2131
2131
  context: r
2132
- } = this.config, i = Ee({
2132
+ } = this.config, i = ve({
2133
2133
  context: typeof r != "function" && r ? r : {},
2134
2134
  _nodes: [this.root],
2135
2135
  children: {},
2136
2136
  status: "active"
2137
2137
  }, this);
2138
- return typeof r == "function" ? se(i, n, t, [b(({
2138
+ return typeof r == "function" ? se(i, n, t, [x(({
2139
2139
  spawn: a,
2140
2140
  event: c,
2141
2141
  self: u
@@ -2149,8 +2149,8 @@ class ut {
2149
2149
  * Returns the initial `State` instance, with reference to `self` as an `ActorRef`.
2150
2150
  */
2151
2151
  getInitialSnapshot(t, n) {
2152
- const s = $t(n), r = [], i = this.getPreInitialState(t, s, r), o = Ye([{
2153
- target: [...Kt(this.root)],
2152
+ const s = Vt(n), r = [], i = this.getPreInitialState(t, s, r), o = Ye([{
2153
+ target: [...Zt(this.root)],
2154
2154
  source: this.root,
2155
2155
  reenter: !0,
2156
2156
  actions: [],
@@ -2168,10 +2168,10 @@ class ut {
2168
2168
  });
2169
2169
  }
2170
2170
  getStateNodeById(t) {
2171
- const n = et(t), s = n.slice(1), r = ke(n[0]) ? n[0].slice(Ds.length) : n[0], i = this.idMap.get(r);
2171
+ const n = tt(t), s = n.slice(1), r = De(n[0]) ? n[0].slice(Ds.length) : n[0], i = this.idMap.get(r);
2172
2172
  if (!i)
2173
2173
  throw new Error(`Child state node '#${r}' does not exist on machine '${this.id}'`);
2174
- return Ie(i, s);
2174
+ return Ae(i, s);
2175
2175
  }
2176
2176
  get definition() {
2177
2177
  return this.root.definition;
@@ -2185,7 +2185,7 @@ class ut {
2185
2185
  restoreSnapshot(t, n) {
2186
2186
  const s = {}, r = t.children;
2187
2187
  Object.keys(r).forEach((c) => {
2188
- const u = r[c], h = u.snapshot, d = u.src, f = typeof d == "string" ? tt(this, d) : d;
2188
+ const u = r[c], h = u.snapshot, d = u.src, f = typeof d == "string" ? nt(this, d) : d;
2189
2189
  if (!f)
2190
2190
  return;
2191
2191
  const m = j(f, {
@@ -2198,10 +2198,10 @@ class ut {
2198
2198
  });
2199
2199
  s[c] = m;
2200
2200
  });
2201
- const i = Ee({
2201
+ const i = ve({
2202
2202
  ...t,
2203
2203
  children: s,
2204
- _nodes: Array.from(Se(Ae(this.root, t.value)))
2204
+ _nodes: Array.from(Ie(we(this.root, t.value)))
2205
2205
  }, this);
2206
2206
  let o = /* @__PURE__ */ new Set();
2207
2207
  function a(c, u) {
@@ -2210,7 +2210,7 @@ class ut {
2210
2210
  for (let h in c) {
2211
2211
  const d = c[h];
2212
2212
  if (d && typeof d == "object") {
2213
- if ("xstate$$type" in d && d.xstate$$type === nt) {
2213
+ if ("xstate$$type" in d && d.xstate$$type === st) {
2214
2214
  c[h] = u[d.id];
2215
2215
  continue;
2216
2216
  }
@@ -2223,7 +2223,7 @@ class ut {
2223
2223
  }
2224
2224
  }
2225
2225
  function Rs(e, t) {
2226
- return new ut(e, t);
2226
+ return new dt(e, t);
2227
2227
  }
2228
2228
  function he({
2229
2229
  schemas: e,
@@ -2244,7 +2244,7 @@ function he({
2244
2244
  })
2245
2245
  };
2246
2246
  }
2247
- function rn(e, t) {
2247
+ function Qe(e, t) {
2248
2248
  const n = B(t);
2249
2249
  if (!n.includes(e.type)) {
2250
2250
  const s = n.length === 1 ? `type "${n[0]}"` : `one of types "${n.join('", "')}"`;
@@ -2309,19 +2309,19 @@ function Bs() {
2309
2309
  ignoreRefreshToken: !1
2310
2310
  };
2311
2311
  }
2312
- async function Qe(e, t) {
2312
+ async function Xe(e, t) {
2313
2313
  const n = await fetch(e, t);
2314
2314
  return n.status === 200 ? n.json() : Promise.resolve({
2315
2315
  message: n.statusText,
2316
2316
  success: !1
2317
2317
  });
2318
2318
  }
2319
- const js = V(async ({ input: e }) => {
2319
+ const js = $(async ({ input: e }) => {
2320
2320
  var t;
2321
2321
  if (!e.endpoint.client || e.endpoint.client === "")
2322
2322
  throw console.log("refreshAccessToken: No client endpoint provided."), new Error("No client endpoint provided.");
2323
2323
  try {
2324
- const n = await Qe(e.endpoint.client, {
2324
+ const n = await Xe(e.endpoint.client, {
2325
2325
  method: "POST",
2326
2326
  mode: "cors",
2327
2327
  credentials: "include",
@@ -2347,7 +2347,7 @@ const js = V(async ({ input: e }) => {
2347
2347
  } catch (n) {
2348
2348
  throw console.log(n), new Error("Could not complete authenticate request (server)");
2349
2349
  }
2350
- }), $s = typeof window > "u", Vs = V(async ({ input: e }) => {
2350
+ }), $s = typeof window > "u", Vs = $(async ({ input: e }) => {
2351
2351
  if (!e.endpoint.client || e.endpoint.client === "")
2352
2352
  throw console.log("refreshAccessToken: No client endpoint provided."), new Error("No client endpoint provided.");
2353
2353
  if (!e.endpoint.server || e.endpoint.server === "")
@@ -2357,7 +2357,7 @@ const js = V(async ({ input: e }) => {
2357
2357
  if (e.refreshToken === "")
2358
2358
  throw new Error("Unauthorized.");
2359
2359
  try {
2360
- if (t = await Qe(e.endpoint.server, {
2360
+ if (t = await Xe(e.endpoint.server, {
2361
2361
  method: "POST",
2362
2362
  mode: "cors",
2363
2363
  credentials: "include",
@@ -2377,7 +2377,7 @@ const js = V(async ({ input: e }) => {
2377
2377
  throw console.log(n), new Error("Could not complete refresh request (server)");
2378
2378
  }
2379
2379
  } else {
2380
- if (t = await Qe(e.endpoint.client, {
2380
+ if (t = await Xe(e.endpoint.client, {
2381
2381
  method: "POST",
2382
2382
  mode: "cors",
2383
2383
  credentials: "include",
@@ -2400,7 +2400,7 @@ const js = V(async ({ input: e }) => {
2400
2400
  accessToken: t.accessToken
2401
2401
  };
2402
2402
  }
2403
- }), Hs = V(async ({ input: e }) => {
2403
+ }), Hs = $(async ({ input: e }) => {
2404
2404
  if (!e.endpoint.client || e.endpoint.client === "")
2405
2405
  throw console.log("unauthenticate: No client endpoint provided."), new Error("No client endpoint provided.");
2406
2406
  try {
@@ -2427,13 +2427,13 @@ const js = V(async ({ input: e }) => {
2427
2427
  input: {}
2428
2428
  },
2429
2429
  actions: {
2430
- addError: b(qs),
2431
- clearErrors: b(Ms),
2432
- setAccessToken: b(Ls),
2433
- setIgnoreRefreshToken: b(Us),
2434
- setUserContext: b(Ps),
2435
- unsetRefreshToken: b(Fs),
2436
- unsetUserContext: b(Bs)
2430
+ addError: x(qs),
2431
+ clearErrors: x(Ms),
2432
+ setAccessToken: x(Ls),
2433
+ setIgnoreRefreshToken: x(Us),
2434
+ setUserContext: x(Ps),
2435
+ unsetRefreshToken: x(Fs),
2436
+ unsetUserContext: x(Bs)
2437
2437
  },
2438
2438
  actors: {
2439
2439
  authenticate: js,
@@ -2468,7 +2468,7 @@ const js = V(async ({ input: e }) => {
2468
2468
  authenticating: {
2469
2469
  invoke: {
2470
2470
  src: "authenticate",
2471
- input: ({ context: e, event: t }) => (rn(t, "LOGIN"), {
2471
+ input: ({ context: e, event: t }) => (Qe(t, "LOGIN"), {
2472
2472
  endpoint: {
2473
2473
  client: e.endpoints.login
2474
2474
  },
@@ -2590,13 +2590,13 @@ const js = V(async ({ input: e }) => {
2590
2590
  // },
2591
2591
  // },
2592
2592
  }
2593
- }), on = be(
2593
+ }), on = Ce(
2594
2594
  {}
2595
- ), yi = () => {
2596
- const e = Ne(on), [t, n] = Oe(
2595
+ ), vi = () => {
2596
+ const e = Oe(on), [t, n] = Ne(
2597
2597
  typeof window < "u" && e.getSnapshot().value === "loggedIn"
2598
2598
  );
2599
- return Ce(() => {
2599
+ return ke(() => {
2600
2600
  if (typeof window > "u")
2601
2601
  return;
2602
2602
  const s = e.subscribe((r) => {
@@ -2606,7 +2606,7 @@ const js = V(async ({ input: e }) => {
2606
2606
  s.unsubscribe();
2607
2607
  };
2608
2608
  }, [e]), { authActor: e, isLoggedIn: t };
2609
- }, mi = async (e = "", t = {
2609
+ }, Ti = async (e = "", t = {
2610
2610
  inspect: void 0,
2611
2611
  endpoints: { login: "", logout: "", refresh: "", ssrRefresh: "" }
2612
2612
  }) => j(zs, {
@@ -2618,21 +2618,19 @@ const js = V(async ({ input: e }) => {
2618
2618
  },
2619
2619
  inspect: t.inspect
2620
2620
  }).start();
2621
- function gi({ actor: e, children: t }) {
2622
- return /* @__PURE__ */ xe(on.Provider, { value: e, children: t });
2621
+ function Si({ actor: e, children: t }) {
2622
+ return /* @__PURE__ */ be(on.Provider, { value: e, children: t });
2623
2623
  }
2624
2624
  function Gs({
2625
2625
  context: e,
2626
2626
  event: t
2627
2627
  }) {
2628
- var s;
2629
2628
  if (t.type !== "CHANGE_STEP")
2630
2629
  return e;
2631
- console.log("changeStep steps", e.steps);
2632
- const n = (s = e.steps) == null ? void 0 : s.find((r) => r.code === t.step);
2633
- return !n || !n.isAvailable ? e : (console.log("changeStep", n.code), {
2634
- currentStep: n.code ?? e.currentStep
2635
- });
2630
+ const n = e.quote.checkoutSteps, s = n == null ? void 0 : n.find((r) => r.code === t.step);
2631
+ return !s || !s.isAvailable ? e : {
2632
+ currentStep: s.code ?? e.currentStep
2633
+ };
2636
2634
  }
2637
2635
  function Js({
2638
2636
  context: e,
@@ -2651,6 +2649,18 @@ function Js({
2651
2649
  function Ys({
2652
2650
  context: e,
2653
2651
  event: t
2652
+ }) {
2653
+ return t.type !== "RESET_CHECKOUT" ? e : {
2654
+ currentStep: t.data.currentStep,
2655
+ errors: [],
2656
+ steps: t.data.steps,
2657
+ successId: "",
2658
+ quote: t.data.quote
2659
+ };
2660
+ }
2661
+ function Qs({
2662
+ context: e,
2663
+ event: t
2654
2664
  }) {
2655
2665
  if (!t.type.includes("xstate.done.actor"))
2656
2666
  return e;
@@ -2659,26 +2669,37 @@ function Ys({
2659
2669
  quote: { ...e.quote, ...n.output.quote }
2660
2670
  };
2661
2671
  }
2662
- const dt = JSON, Qs = (e) => e.toUpperCase(), Xs = (e) => {
2672
+ function Xs({
2673
+ context: e,
2674
+ event: t
2675
+ }) {
2676
+ if (!t.type.includes("xstate.done.actor"))
2677
+ return e;
2678
+ const n = t;
2679
+ return n.output.type !== "PLACE_ORDER_SUCCESS" ? e : {
2680
+ successId: n.output.successId
2681
+ };
2682
+ }
2683
+ const lt = JSON, Ws = (e) => e.toUpperCase(), Ks = (e) => {
2663
2684
  const t = {};
2664
2685
  return e.forEach((n, s) => {
2665
2686
  t[s] = n;
2666
2687
  }), t;
2667
- }, Ws = (e, t, n) => e.document ? e : {
2688
+ }, Zs = (e, t, n) => e.document ? e : {
2668
2689
  document: e,
2669
2690
  variables: t,
2670
2691
  requestHeaders: n,
2671
2692
  signal: void 0
2672
- }, Ks = (e, t, n) => e.query ? e : {
2693
+ }, er = (e, t, n) => e.query ? e : {
2673
2694
  query: e,
2674
2695
  variables: t,
2675
2696
  requestHeaders: n,
2676
2697
  signal: void 0
2677
- }, Zs = (e, t) => e.documents ? e : {
2698
+ }, tr = (e, t) => e.documents ? e : {
2678
2699
  documents: e,
2679
2700
  requestHeaders: t,
2680
2701
  signal: void 0
2681
- }, er = (e, t, ...n) => {
2702
+ }, nr = (e, t, ...n) => {
2682
2703
  const [s, r] = n;
2683
2704
  return e.document ? e : {
2684
2705
  url: e,
@@ -2688,24 +2709,24 @@ const dt = JSON, Qs = (e) => e.toUpperCase(), Xs = (e) => {
2688
2709
  signal: void 0
2689
2710
  };
2690
2711
  };
2691
- function ve(e, t) {
2712
+ function Te(e, t) {
2692
2713
  if (!!!e)
2693
2714
  throw new Error(t);
2694
2715
  }
2695
- function tr(e) {
2716
+ function sr(e) {
2696
2717
  return typeof e == "object" && e !== null;
2697
2718
  }
2698
- function nr(e, t) {
2719
+ function rr(e, t) {
2699
2720
  if (!!!e)
2700
2721
  throw new Error(
2701
2722
  t ?? "Unexpected invariant triggered."
2702
2723
  );
2703
2724
  }
2704
- const sr = /\r\n|[\n\r]/g;
2705
- function Xe(e, t) {
2725
+ const ir = /\r\n|[\n\r]/g;
2726
+ function We(e, t) {
2706
2727
  let n = 0, s = 1;
2707
- for (const r of e.body.matchAll(sr)) {
2708
- if (typeof r.index == "number" || nr(!1), r.index >= t)
2728
+ for (const r of e.body.matchAll(ir)) {
2729
+ if (typeof r.index == "number" || rr(!1), r.index >= t)
2709
2730
  break;
2710
2731
  n = r.index + r[0].length, s += 1;
2711
2732
  }
@@ -2714,10 +2735,10 @@ function Xe(e, t) {
2714
2735
  column: t + 1 - n
2715
2736
  };
2716
2737
  }
2717
- function rr(e) {
2738
+ function or(e) {
2718
2739
  return an(
2719
2740
  e.source,
2720
- Xe(e.source, e.start)
2741
+ We(e.source, e.start)
2721
2742
  );
2722
2743
  }
2723
2744
  function an(e, t) {
@@ -2727,14 +2748,14 @@ function an(e, t) {
2727
2748
  const f = Math.floor(c / 80), m = c % 80, y = [];
2728
2749
  for (let v = 0; v < d.length; v += 80)
2729
2750
  y.push(d.slice(v, v + 80));
2730
- return u + Ot([
2751
+ return u + Nt([
2731
2752
  [`${o} |`, y[0]],
2732
2753
  ...y.slice(1, f + 1).map((v) => ["|", v]),
2733
2754
  ["|", "^".padStart(m)],
2734
2755
  ["|", y[f + 1]]
2735
2756
  ]);
2736
2757
  }
2737
- return u + Ot([
2758
+ return u + Nt([
2738
2759
  // Lines specified like this: ["prefix", "string"],
2739
2760
  [`${o - 1} |`, h[r - 1]],
2740
2761
  [`${o} |`, d],
@@ -2742,12 +2763,12 @@ function an(e, t) {
2742
2763
  [`${o + 1} |`, h[r + 1]]
2743
2764
  ]);
2744
2765
  }
2745
- function Ot(e) {
2766
+ function Nt(e) {
2746
2767
  const t = e.filter(([s, r]) => r !== void 0), n = Math.max(...t.map(([s]) => s.length));
2747
2768
  return t.map(([s, r]) => s.padStart(n) + (r ? " " + r : "")).join(`
2748
2769
  `);
2749
2770
  }
2750
- function ir(e) {
2771
+ function ar(e) {
2751
2772
  const t = e[0];
2752
2773
  return t == null || "kind" in t || "length" in t ? {
2753
2774
  nodes: t,
@@ -2758,7 +2779,7 @@ function ir(e) {
2758
2779
  extensions: e[5]
2759
2780
  } : t;
2760
2781
  }
2761
- class lt extends Error {
2782
+ class ht extends Error {
2762
2783
  /**
2763
2784
  * An array of `{ line, column }` locations within the source GraphQL document
2764
2785
  * which correspond to this error.
@@ -2799,15 +2820,15 @@ class lt extends Error {
2799
2820
  */
2800
2821
  constructor(t, ...n) {
2801
2822
  var s, r, i;
2802
- const { nodes: o, source: a, positions: c, path: u, originalError: h, extensions: d } = ir(n);
2803
- super(t), this.name = "GraphQLError", this.path = u ?? void 0, this.originalError = h ?? void 0, this.nodes = Ct(
2823
+ const { nodes: o, source: a, positions: c, path: u, originalError: h, extensions: d } = ar(n);
2824
+ super(t), this.name = "GraphQLError", this.path = u ?? void 0, this.originalError = h ?? void 0, this.nodes = kt(
2804
2825
  Array.isArray(o) ? o : o ? [o] : void 0
2805
2826
  );
2806
- const f = Ct(
2827
+ const f = kt(
2807
2828
  (s = this.nodes) === null || s === void 0 ? void 0 : s.map((y) => y.loc).filter((y) => y != null)
2808
2829
  );
2809
- this.source = a ?? (f == null || (r = f[0]) === null || r === void 0 ? void 0 : r.source), this.positions = c ?? (f == null ? void 0 : f.map((y) => y.start)), this.locations = c && a ? c.map((y) => Xe(a, y)) : f == null ? void 0 : f.map((y) => Xe(y.source, y.start));
2810
- const m = tr(
2830
+ this.source = a ?? (f == null || (r = f[0]) === null || r === void 0 ? void 0 : r.source), this.positions = c ?? (f == null ? void 0 : f.map((y) => y.start)), this.locations = c && a ? c.map((y) => We(a, y)) : f == null ? void 0 : f.map((y) => We(y.source, y.start));
2831
+ const m = sr(
2811
2832
  h == null ? void 0 : h.extensions
2812
2833
  ) ? h == null ? void 0 : h.extensions : void 0;
2813
2834
  this.extensions = (i = d ?? m) !== null && i !== void 0 ? i : /* @__PURE__ */ Object.create(null), Object.defineProperties(this, {
@@ -2834,7 +2855,7 @@ class lt extends Error {
2834
2855
  value: h.stack,
2835
2856
  writable: !0,
2836
2857
  configurable: !0
2837
- }) : Error.captureStackTrace ? Error.captureStackTrace(this, lt) : Object.defineProperty(this, "stack", {
2858
+ }) : Error.captureStackTrace ? Error.captureStackTrace(this, ht) : Object.defineProperty(this, "stack", {
2838
2859
  value: Error().stack,
2839
2860
  writable: !0,
2840
2861
  configurable: !0
@@ -2849,7 +2870,7 @@ class lt extends Error {
2849
2870
  for (const n of this.nodes)
2850
2871
  n.loc && (t += `
2851
2872
 
2852
- ` + rr(n.loc));
2873
+ ` + or(n.loc));
2853
2874
  else if (this.source && this.locations)
2854
2875
  for (const n of this.locations)
2855
2876
  t += `
@@ -2864,16 +2885,16 @@ class lt extends Error {
2864
2885
  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;
2865
2886
  }
2866
2887
  }
2867
- function Ct(e) {
2888
+ function kt(e) {
2868
2889
  return e === void 0 || e.length === 0 ? void 0 : e;
2869
2890
  }
2870
- function N(e, t, n) {
2871
- return new lt(`Syntax Error: ${n}`, {
2891
+ function C(e, t, n) {
2892
+ return new ht(`Syntax Error: ${n}`, {
2872
2893
  source: e,
2873
2894
  positions: [t]
2874
2895
  });
2875
2896
  }
2876
- class or {
2897
+ class cr {
2877
2898
  /**
2878
2899
  * The character offset at which this Node begins.
2879
2900
  */
@@ -3018,24 +3039,24 @@ const un = {
3018
3039
  UnionTypeExtension: ["name", "directives", "types"],
3019
3040
  EnumTypeExtension: ["name", "directives", "values"],
3020
3041
  InputObjectTypeExtension: ["name", "directives", "fields"]
3021
- }, ar = new Set(Object.keys(un));
3022
- function kt(e) {
3042
+ }, ur = new Set(Object.keys(un));
3043
+ function Dt(e) {
3023
3044
  const t = e == null ? void 0 : e.kind;
3024
- return typeof t == "string" && ar.has(t);
3045
+ return typeof t == "string" && ur.has(t);
3025
3046
  }
3026
3047
  var ee;
3027
3048
  (function(e) {
3028
3049
  e.QUERY = "query", e.MUTATION = "mutation", e.SUBSCRIPTION = "subscription";
3029
3050
  })(ee || (ee = {}));
3030
- var We;
3051
+ var Ke;
3031
3052
  (function(e) {
3032
3053
  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";
3033
- })(We || (We = {}));
3054
+ })(Ke || (Ke = {}));
3034
3055
  var T;
3035
3056
  (function(e) {
3036
3057
  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";
3037
3058
  })(T || (T = {}));
3038
- function Ke(e) {
3059
+ function Ze(e) {
3039
3060
  return e === 9 || e === 32;
3040
3061
  }
3041
3062
  function de(e) {
@@ -3048,15 +3069,15 @@ function dn(e) {
3048
3069
  function ln(e) {
3049
3070
  return dn(e) || e === 95;
3050
3071
  }
3051
- function cr(e) {
3072
+ function dr(e) {
3052
3073
  return dn(e) || de(e) || e === 95;
3053
3074
  }
3054
- function ur(e) {
3075
+ function lr(e) {
3055
3076
  var t;
3056
3077
  let n = Number.MAX_SAFE_INTEGER, s = null, r = -1;
3057
3078
  for (let o = 0; o < e.length; ++o) {
3058
3079
  var i;
3059
- const a = e[o], c = dr(a);
3080
+ const a = e[o], c = hr(a);
3060
3081
  c !== a.length && (s = (i = s) !== null && i !== void 0 ? i : o, r = o, o !== 0 && c < n && (n = c));
3061
3082
  }
3062
3083
  return e.map((o, a) => a === 0 ? o : o.slice(n)).slice(
@@ -3064,17 +3085,17 @@ function ur(e) {
3064
3085
  r + 1
3065
3086
  );
3066
3087
  }
3067
- function dr(e) {
3088
+ function hr(e) {
3068
3089
  let t = 0;
3069
- for (; t < e.length && Ke(e.charCodeAt(t)); )
3090
+ for (; t < e.length && Ze(e.charCodeAt(t)); )
3070
3091
  ++t;
3071
3092
  return t;
3072
3093
  }
3073
- function lr(e, t) {
3074
- const n = e.replace(/"""/g, '\\"""'), s = n.split(/\r\n|[\n\r]/g), r = s.length === 1, i = s.length > 1 && s.slice(1).every((m) => m.length === 0 || Ke(m.charCodeAt(0))), o = n.endsWith('\\"""'), a = e.endsWith('"') && !o, c = e.endsWith("\\"), u = a || c, h = !(t != null && t.minimize) && // add leading and trailing new lines only if it improves readability
3094
+ function fr(e, t) {
3095
+ const n = e.replace(/"""/g, '\\"""'), s = n.split(/\r\n|[\n\r]/g), r = s.length === 1, i = s.length > 1 && s.slice(1).every((m) => m.length === 0 || Ze(m.charCodeAt(0))), o = n.endsWith('\\"""'), a = e.endsWith('"') && !o, c = e.endsWith("\\"), u = a || c, h = !(t != null && t.minimize) && // add leading and trailing new lines only if it improves readability
3075
3096
  (!r || e.length > 70 || u || i || o);
3076
3097
  let d = "";
3077
- const f = r && Ke(e.charCodeAt(0));
3098
+ const f = r && Ze(e.charCodeAt(0));
3078
3099
  return (h && !f || i) && (d += `
3079
3100
  `), d += n, (h || u) && (d += `
3080
3101
  `), '"""' + d + '"""';
@@ -3083,7 +3104,7 @@ var p;
3083
3104
  (function(e) {
3084
3105
  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";
3085
3106
  })(p || (p = {}));
3086
- class hr {
3107
+ class pr {
3087
3108
  /**
3088
3109
  * The previously focused non-ignored token.
3089
3110
  */
@@ -3120,20 +3141,20 @@ class hr {
3120
3141
  if (t.next)
3121
3142
  t = t.next;
3122
3143
  else {
3123
- const n = pr(this, t.end);
3144
+ const n = mr(this, t.end);
3124
3145
  t.next = n, n.prev = t, t = n;
3125
3146
  }
3126
3147
  while (t.kind === p.COMMENT);
3127
3148
  return t;
3128
3149
  }
3129
3150
  }
3130
- function fr(e) {
3151
+ function yr(e) {
3131
3152
  return e === p.BANG || e === p.DOLLAR || e === p.AMP || e === p.PAREN_L || e === p.PAREN_R || e === p.SPREAD || e === p.COLON || e === p.EQUALS || e === p.AT || e === p.BRACKET_L || e === p.BRACKET_R || e === p.BRACE_L || e === p.PIPE || e === p.BRACE_R;
3132
3153
  }
3133
3154
  function re(e) {
3134
3155
  return e >= 0 && e <= 55295 || e >= 57344 && e <= 1114111;
3135
3156
  }
3136
- function De(e, t) {
3157
+ function Re(e, t) {
3137
3158
  return hn(e.charCodeAt(t)) && fn(e.charCodeAt(t + 1));
3138
3159
  }
3139
3160
  function hn(e) {
@@ -3152,11 +3173,11 @@ function Q(e, t) {
3152
3173
  }
3153
3174
  return "U+" + n.toString(16).toUpperCase().padStart(4, "0");
3154
3175
  }
3155
- function x(e, t, n, s, r) {
3176
+ function b(e, t, n, s, r) {
3156
3177
  const i = e.line, o = 1 + n - e.lineStart;
3157
3178
  return new cn(t, n, s, i, o, r);
3158
3179
  }
3159
- function pr(e, t) {
3180
+ function mr(e, t) {
3160
3181
  const n = e.source.body, s = n.length;
3161
3182
  let r = t;
3162
3183
  for (; r < s; ) {
@@ -3175,53 +3196,53 @@ function pr(e, t) {
3175
3196
  n.charCodeAt(r + 1) === 10 ? r += 2 : ++r, ++e.line, e.lineStart = r;
3176
3197
  continue;
3177
3198
  case 35:
3178
- return yr(e, r);
3199
+ return gr(e, r);
3179
3200
  case 33:
3180
- return x(e, p.BANG, r, r + 1);
3201
+ return b(e, p.BANG, r, r + 1);
3181
3202
  case 36:
3182
- return x(e, p.DOLLAR, r, r + 1);
3203
+ return b(e, p.DOLLAR, r, r + 1);
3183
3204
  case 38:
3184
- return x(e, p.AMP, r, r + 1);
3205
+ return b(e, p.AMP, r, r + 1);
3185
3206
  case 40:
3186
- return x(e, p.PAREN_L, r, r + 1);
3207
+ return b(e, p.PAREN_L, r, r + 1);
3187
3208
  case 41:
3188
- return x(e, p.PAREN_R, r, r + 1);
3209
+ return b(e, p.PAREN_R, r, r + 1);
3189
3210
  case 46:
3190
3211
  if (n.charCodeAt(r + 1) === 46 && n.charCodeAt(r + 2) === 46)
3191
- return x(e, p.SPREAD, r, r + 3);
3212
+ return b(e, p.SPREAD, r, r + 3);
3192
3213
  break;
3193
3214
  case 58:
3194
- return x(e, p.COLON, r, r + 1);
3215
+ return b(e, p.COLON, r, r + 1);
3195
3216
  case 61:
3196
- return x(e, p.EQUALS, r, r + 1);
3217
+ return b(e, p.EQUALS, r, r + 1);
3197
3218
  case 64:
3198
- return x(e, p.AT, r, r + 1);
3219
+ return b(e, p.AT, r, r + 1);
3199
3220
  case 91:
3200
- return x(e, p.BRACKET_L, r, r + 1);
3221
+ return b(e, p.BRACKET_L, r, r + 1);
3201
3222
  case 93:
3202
- return x(e, p.BRACKET_R, r, r + 1);
3223
+ return b(e, p.BRACKET_R, r, r + 1);
3203
3224
  case 123:
3204
- return x(e, p.BRACE_L, r, r + 1);
3225
+ return b(e, p.BRACE_L, r, r + 1);
3205
3226
  case 124:
3206
- return x(e, p.PIPE, r, r + 1);
3227
+ return b(e, p.PIPE, r, r + 1);
3207
3228
  case 125:
3208
- return x(e, p.BRACE_R, r, r + 1);
3229
+ return b(e, p.BRACE_R, r, r + 1);
3209
3230
  case 34:
3210
- return n.charCodeAt(r + 1) === 34 && n.charCodeAt(r + 2) === 34 ? _r(e, r) : gr(e, r);
3231
+ return n.charCodeAt(r + 1) === 34 && n.charCodeAt(r + 2) === 34 ? Ir(e, r) : vr(e, r);
3211
3232
  }
3212
3233
  if (de(i) || i === 45)
3213
- return mr(e, r, i);
3234
+ return Er(e, r, i);
3214
3235
  if (ln(i))
3215
- return Sr(e, r);
3216
- throw N(
3236
+ return Ar(e, r);
3237
+ throw C(
3217
3238
  e.source,
3218
3239
  r,
3219
- i === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : re(i) || De(n, r) ? `Unexpected character: ${Q(e, r)}.` : `Invalid character: ${Q(e, r)}.`
3240
+ i === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : re(i) || Re(n, r) ? `Unexpected character: ${Q(e, r)}.` : `Invalid character: ${Q(e, r)}.`
3220
3241
  );
3221
3242
  }
3222
- return x(e, p.EOF, s, s);
3243
+ return b(e, p.EOF, s, s);
3223
3244
  }
3224
- function yr(e, t) {
3245
+ function gr(e, t) {
3225
3246
  const n = e.source.body, s = n.length;
3226
3247
  let r = t + 1;
3227
3248
  for (; r < s; ) {
@@ -3230,12 +3251,12 @@ function yr(e, t) {
3230
3251
  break;
3231
3252
  if (re(i))
3232
3253
  ++r;
3233
- else if (De(n, r))
3254
+ else if (Re(n, r))
3234
3255
  r += 2;
3235
3256
  else
3236
3257
  break;
3237
3258
  }
3238
- return x(
3259
+ return b(
3239
3260
  e,
3240
3261
  p.COMMENT,
3241
3262
  t,
@@ -3243,12 +3264,12 @@ function yr(e, t) {
3243
3264
  n.slice(t + 1, r)
3244
3265
  );
3245
3266
  }
3246
- function mr(e, t, n) {
3267
+ function Er(e, t, n) {
3247
3268
  const s = e.source.body;
3248
3269
  let r = t, i = n, o = !1;
3249
3270
  if (i === 45 && (i = s.charCodeAt(++r)), i === 48) {
3250
3271
  if (i = s.charCodeAt(++r), de(i))
3251
- throw N(
3272
+ throw C(
3252
3273
  e.source,
3253
3274
  r,
3254
3275
  `Invalid number, unexpected digit after 0: ${Q(
@@ -3259,7 +3280,7 @@ function mr(e, t, n) {
3259
3280
  } else
3260
3281
  r = Be(e, r, i), i = s.charCodeAt(r);
3261
3282
  if (i === 46 && (o = !0, i = s.charCodeAt(++r), r = Be(e, r, i), i = s.charCodeAt(r)), (i === 69 || i === 101) && (o = !0, i = s.charCodeAt(++r), (i === 43 || i === 45) && (i = s.charCodeAt(++r)), r = Be(e, r, i), i = s.charCodeAt(r)), i === 46 || ln(i))
3262
- throw N(
3283
+ throw C(
3263
3284
  e.source,
3264
3285
  r,
3265
3286
  `Invalid number, expected digit but got: ${Q(
@@ -3267,7 +3288,7 @@ function mr(e, t, n) {
3267
3288
  r
3268
3289
  )}.`
3269
3290
  );
3270
- return x(
3291
+ return b(
3271
3292
  e,
3272
3293
  o ? p.FLOAT : p.INT,
3273
3294
  t,
@@ -3277,7 +3298,7 @@ function mr(e, t, n) {
3277
3298
  }
3278
3299
  function Be(e, t, n) {
3279
3300
  if (!de(n))
3280
- throw N(
3301
+ throw C(
3281
3302
  e.source,
3282
3303
  t,
3283
3304
  `Invalid number, expected digit but got: ${Q(
@@ -3291,16 +3312,16 @@ function Be(e, t, n) {
3291
3312
  ++r;
3292
3313
  return r;
3293
3314
  }
3294
- function gr(e, t) {
3315
+ function vr(e, t) {
3295
3316
  const n = e.source.body, s = n.length;
3296
3317
  let r = t + 1, i = r, o = "";
3297
3318
  for (; r < s; ) {
3298
3319
  const a = n.charCodeAt(r);
3299
3320
  if (a === 34)
3300
- return o += n.slice(i, r), x(e, p.STRING, t, r + 1, o);
3321
+ return o += n.slice(i, r), b(e, p.STRING, t, r + 1, o);
3301
3322
  if (a === 92) {
3302
3323
  o += n.slice(i, r);
3303
- const c = n.charCodeAt(r + 1) === 117 ? n.charCodeAt(r + 2) === 123 ? Er(e, r) : vr(e, r) : Tr(e, r);
3324
+ const c = n.charCodeAt(r + 1) === 117 ? n.charCodeAt(r + 2) === 123 ? Tr(e, r) : Sr(e, r) : _r(e, r);
3304
3325
  o += c.value, r += c.size, i = r;
3305
3326
  continue;
3306
3327
  }
@@ -3308,10 +3329,10 @@ function gr(e, t) {
3308
3329
  break;
3309
3330
  if (re(a))
3310
3331
  ++r;
3311
- else if (De(n, r))
3332
+ else if (Re(n, r))
3312
3333
  r += 2;
3313
3334
  else
3314
- throw N(
3335
+ throw C(
3315
3336
  e.source,
3316
3337
  r,
3317
3338
  `Invalid character within String: ${Q(
@@ -3320,9 +3341,9 @@ function gr(e, t) {
3320
3341
  )}.`
3321
3342
  );
3322
3343
  }
3323
- throw N(e.source, r, "Unterminated string.");
3344
+ throw C(e.source, r, "Unterminated string.");
3324
3345
  }
3325
- function Er(e, t) {
3346
+ function Tr(e, t) {
3326
3347
  const n = e.source.body;
3327
3348
  let s = 0, r = 3;
3328
3349
  for (; r < 12; ) {
@@ -3338,7 +3359,7 @@ function Er(e, t) {
3338
3359
  if (s = s << 4 | ae(i), s < 0)
3339
3360
  break;
3340
3361
  }
3341
- throw N(
3362
+ throw C(
3342
3363
  e.source,
3343
3364
  t,
3344
3365
  `Invalid Unicode escape sequence: "${n.slice(
@@ -3347,34 +3368,34 @@ function Er(e, t) {
3347
3368
  )}".`
3348
3369
  );
3349
3370
  }
3350
- function vr(e, t) {
3351
- const n = e.source.body, s = Dt(n, t + 2);
3371
+ function Sr(e, t) {
3372
+ const n = e.source.body, s = Rt(n, t + 2);
3352
3373
  if (re(s))
3353
3374
  return {
3354
3375
  value: String.fromCodePoint(s),
3355
3376
  size: 6
3356
3377
  };
3357
3378
  if (hn(s) && n.charCodeAt(t + 6) === 92 && n.charCodeAt(t + 7) === 117) {
3358
- const r = Dt(n, t + 8);
3379
+ const r = Rt(n, t + 8);
3359
3380
  if (fn(r))
3360
3381
  return {
3361
3382
  value: String.fromCodePoint(s, r),
3362
3383
  size: 12
3363
3384
  };
3364
3385
  }
3365
- throw N(
3386
+ throw C(
3366
3387
  e.source,
3367
3388
  t,
3368
3389
  `Invalid Unicode escape sequence: "${n.slice(t, t + 6)}".`
3369
3390
  );
3370
3391
  }
3371
- function Dt(e, t) {
3392
+ function Rt(e, t) {
3372
3393
  return ae(e.charCodeAt(t)) << 12 | ae(e.charCodeAt(t + 1)) << 8 | ae(e.charCodeAt(t + 2)) << 4 | ae(e.charCodeAt(t + 3));
3373
3394
  }
3374
3395
  function ae(e) {
3375
3396
  return e >= 48 && e <= 57 ? e - 48 : e >= 65 && e <= 70 ? e - 55 : e >= 97 && e <= 102 ? e - 87 : -1;
3376
3397
  }
3377
- function Tr(e, t) {
3398
+ function _r(e, t) {
3378
3399
  const n = e.source.body;
3379
3400
  switch (n.charCodeAt(t + 1)) {
3380
3401
  case 34:
@@ -3419,7 +3440,7 @@ function Tr(e, t) {
3419
3440
  size: 2
3420
3441
  };
3421
3442
  }
3422
- throw N(
3443
+ throw C(
3423
3444
  e.source,
3424
3445
  t,
3425
3446
  `Invalid character escape sequence: "${n.slice(
@@ -3428,7 +3449,7 @@ function Tr(e, t) {
3428
3449
  )}".`
3429
3450
  );
3430
3451
  }
3431
- function _r(e, t) {
3452
+ function Ir(e, t) {
3432
3453
  const n = e.source.body, s = n.length;
3433
3454
  let r = e.lineStart, i = t + 3, o = i, a = "";
3434
3455
  const c = [];
@@ -3436,13 +3457,13 @@ function _r(e, t) {
3436
3457
  const u = n.charCodeAt(i);
3437
3458
  if (u === 34 && n.charCodeAt(i + 1) === 34 && n.charCodeAt(i + 2) === 34) {
3438
3459
  a += n.slice(o, i), c.push(a);
3439
- const h = x(
3460
+ const h = b(
3440
3461
  e,
3441
3462
  p.BLOCK_STRING,
3442
3463
  t,
3443
3464
  i + 3,
3444
3465
  // Return a string of the lines joined with U+000A.
3445
- ur(c).join(`
3466
+ lr(c).join(`
3446
3467
  `)
3447
3468
  );
3448
3469
  return e.line += c.length - 1, e.lineStart = r, h;
@@ -3457,10 +3478,10 @@ function _r(e, t) {
3457
3478
  }
3458
3479
  if (re(u))
3459
3480
  ++i;
3460
- else if (De(n, i))
3481
+ else if (Re(n, i))
3461
3482
  i += 2;
3462
3483
  else
3463
- throw N(
3484
+ throw C(
3464
3485
  e.source,
3465
3486
  i,
3466
3487
  `Invalid character within String: ${Q(
@@ -3469,19 +3490,19 @@ function _r(e, t) {
3469
3490
  )}.`
3470
3491
  );
3471
3492
  }
3472
- throw N(e.source, i, "Unterminated string.");
3493
+ throw C(e.source, i, "Unterminated string.");
3473
3494
  }
3474
- function Sr(e, t) {
3495
+ function Ar(e, t) {
3475
3496
  const n = e.source.body, s = n.length;
3476
3497
  let r = t + 1;
3477
3498
  for (; r < s; ) {
3478
3499
  const i = n.charCodeAt(r);
3479
- if (cr(i))
3500
+ if (dr(i))
3480
3501
  ++r;
3481
3502
  else
3482
3503
  break;
3483
3504
  }
3484
- return x(
3505
+ return b(
3485
3506
  e,
3486
3507
  p.NAME,
3487
3508
  t,
@@ -3489,53 +3510,53 @@ function Sr(e, t) {
3489
3510
  n.slice(t, r)
3490
3511
  );
3491
3512
  }
3492
- const Ir = 10, pn = 2;
3493
- function ht(e) {
3494
- return Re(e, []);
3513
+ const wr = 10, pn = 2;
3514
+ function ft(e) {
3515
+ return qe(e, []);
3495
3516
  }
3496
- function Re(e, t) {
3517
+ function qe(e, t) {
3497
3518
  switch (typeof e) {
3498
3519
  case "string":
3499
3520
  return JSON.stringify(e);
3500
3521
  case "function":
3501
3522
  return e.name ? `[function ${e.name}]` : "[function]";
3502
3523
  case "object":
3503
- return Ar(e, t);
3524
+ return xr(e, t);
3504
3525
  default:
3505
3526
  return String(e);
3506
3527
  }
3507
3528
  }
3508
- function Ar(e, t) {
3529
+ function xr(e, t) {
3509
3530
  if (e === null)
3510
3531
  return "null";
3511
3532
  if (t.includes(e))
3512
3533
  return "[Circular]";
3513
3534
  const n = [...t, e];
3514
- if (wr(e)) {
3535
+ if (br(e)) {
3515
3536
  const s = e.toJSON();
3516
3537
  if (s !== e)
3517
- return typeof s == "string" ? s : Re(s, n);
3538
+ return typeof s == "string" ? s : qe(s, n);
3518
3539
  } else if (Array.isArray(e))
3519
- return br(e, n);
3520
- return xr(e, n);
3540
+ return Or(e, n);
3541
+ return Cr(e, n);
3521
3542
  }
3522
- function wr(e) {
3543
+ function br(e) {
3523
3544
  return typeof e.toJSON == "function";
3524
3545
  }
3525
- function xr(e, t) {
3546
+ function Cr(e, t) {
3526
3547
  const n = Object.entries(e);
3527
3548
  return n.length === 0 ? "{}" : t.length > pn ? "[" + Nr(e) + "]" : "{ " + n.map(
3528
- ([r, i]) => r + ": " + Re(i, t)
3549
+ ([r, i]) => r + ": " + qe(i, t)
3529
3550
  ).join(", ") + " }";
3530
3551
  }
3531
- function br(e, t) {
3552
+ function Or(e, t) {
3532
3553
  if (e.length === 0)
3533
3554
  return "[]";
3534
3555
  if (t.length > pn)
3535
3556
  return "[Array]";
3536
- const n = Math.min(Ir, e.length), s = e.length - n, r = [];
3557
+ const n = Math.min(wr, e.length), s = e.length - n, r = [];
3537
3558
  for (let i = 0; i < n; ++i)
3538
- r.push(Re(e[i], t));
3559
+ r.push(qe(e[i], t));
3539
3560
  return s === 1 ? r.push("... 1 more item") : s > 1 && r.push(`... ${s} more items`), "[" + r.join(", ") + "]";
3540
3561
  }
3541
3562
  function Nr(e) {
@@ -3547,11 +3568,11 @@ function Nr(e) {
3547
3568
  }
3548
3569
  return t;
3549
3570
  }
3550
- const Or = globalThis.process && // eslint-disable-next-line no-undef
3551
- process.env.NODE_ENV === "production", Cr = (
3571
+ const kr = globalThis.process && // eslint-disable-next-line no-undef
3572
+ process.env.NODE_ENV === "production", Dr = (
3552
3573
  /* c8 ignore next 6 */
3553
3574
  // FIXME: https://github.com/graphql/graphql-js/issues/2317
3554
- Or ? function(t, n) {
3575
+ kr ? function(t, n) {
3555
3576
  return t instanceof n;
3556
3577
  } : function(t, n) {
3557
3578
  if (t instanceof n)
@@ -3563,7 +3584,7 @@ process.env.NODE_ENV === "production", Cr = (
3563
3584
  Symbol.toStringTag in t ? t[Symbol.toStringTag] : (s = t.constructor) === null || s === void 0 ? void 0 : s.name
3564
3585
  );
3565
3586
  if (r === i) {
3566
- const o = ht(t);
3587
+ const o = ft(t);
3567
3588
  throw new Error(`Cannot use ${r} "${o}" from another module or realm.
3568
3589
 
3569
3590
  Ensure that there is only one instance of "graphql" in the node_modules
@@ -3586,10 +3607,10 @@ class yn {
3586
3607
  line: 1,
3587
3608
  column: 1
3588
3609
  }) {
3589
- typeof t == "string" || ve(!1, `Body must be a string. Received: ${ht(t)}.`), this.body = t, this.name = n, this.locationOffset = s, this.locationOffset.line > 0 || ve(
3610
+ typeof t == "string" || Te(!1, `Body must be a string. Received: ${ft(t)}.`), this.body = t, this.name = n, this.locationOffset = s, this.locationOffset.line > 0 || Te(
3590
3611
  !1,
3591
3612
  "line in locationOffset is 1-indexed and must be positive."
3592
- ), this.locationOffset.column > 0 || ve(
3613
+ ), this.locationOffset.column > 0 || Te(
3593
3614
  !1,
3594
3615
  "column in locationOffset is 1-indexed and must be positive."
3595
3616
  );
@@ -3598,16 +3619,16 @@ class yn {
3598
3619
  return "Source";
3599
3620
  }
3600
3621
  }
3601
- function kr(e) {
3602
- return Cr(e, yn);
3622
+ function Rr(e) {
3623
+ return Dr(e, yn);
3603
3624
  }
3604
- function Dr(e, t) {
3605
- return new Rr(e, t).parseDocument();
3625
+ function qr(e, t) {
3626
+ return new Mr(e, t).parseDocument();
3606
3627
  }
3607
- class Rr {
3628
+ class Mr {
3608
3629
  constructor(t, n = {}) {
3609
- const s = kr(t) ? t : new yn(t);
3610
- this._lexer = new hr(s), this._options = n, this._tokenCounter = 0;
3630
+ const s = Rr(t) ? t : new yn(t);
3631
+ this._lexer = new pr(s), this._options = n, this._tokenCounter = 0;
3611
3632
  }
3612
3633
  /**
3613
3634
  * Converts a name lex token into a name parse node.
@@ -3680,7 +3701,7 @@ class Rr {
3680
3701
  return this.parseDirectiveDefinition();
3681
3702
  }
3682
3703
  if (t)
3683
- throw N(
3704
+ throw C(
3684
3705
  this._lexer.source,
3685
3706
  this._lexer.token.start,
3686
3707
  "Unexpected description, descriptions are supported only on type definitions."
@@ -3954,7 +3975,7 @@ class Rr {
3954
3975
  if (t)
3955
3976
  if (this.expectToken(p.DOLLAR), this._lexer.token.kind === p.NAME) {
3956
3977
  const s = this._lexer.token.value;
3957
- throw N(
3978
+ throw C(
3958
3979
  this._lexer.source,
3959
3980
  n.start,
3960
3981
  `Unexpected variable "$${s}" in constant value.`
@@ -4301,10 +4322,10 @@ class Rr {
4301
4322
  */
4302
4323
  parseEnumValueName() {
4303
4324
  if (this._lexer.token.value === "true" || this._lexer.token.value === "false" || this._lexer.token.value === "null")
4304
- throw N(
4325
+ throw C(
4305
4326
  this._lexer.source,
4306
4327
  this._lexer.token.start,
4307
- `${ge(
4328
+ `${Ee(
4308
4329
  this._lexer.token
4309
4330
  )} is reserved and cannot be used for an enum value.`
4310
4331
  );
@@ -4563,7 +4584,7 @@ class Rr {
4563
4584
  */
4564
4585
  parseDirectiveLocation() {
4565
4586
  const t = this._lexer.token, n = this.parseName();
4566
- if (Object.prototype.hasOwnProperty.call(We, n.value))
4587
+ if (Object.prototype.hasOwnProperty.call(Ke, n.value))
4567
4588
  return n;
4568
4589
  throw this.unexpected(t);
4569
4590
  }
@@ -4574,7 +4595,7 @@ class Rr {
4574
4595
  * given parsed object.
4575
4596
  */
4576
4597
  node(t, n) {
4577
- return this._options.noLocation !== !0 && (n.loc = new or(
4598
+ return this._options.noLocation !== !0 && (n.loc = new cr(
4578
4599
  t,
4579
4600
  this._lexer.lastToken,
4580
4601
  this._lexer.source
@@ -4594,10 +4615,10 @@ class Rr {
4594
4615
  const n = this._lexer.token;
4595
4616
  if (n.kind === t)
4596
4617
  return this.advanceLexer(), n;
4597
- throw N(
4618
+ throw C(
4598
4619
  this._lexer.source,
4599
4620
  n.start,
4600
- `Expected ${mn(t)}, found ${ge(n)}.`
4621
+ `Expected ${mn(t)}, found ${Ee(n)}.`
4601
4622
  );
4602
4623
  }
4603
4624
  /**
@@ -4616,10 +4637,10 @@ class Rr {
4616
4637
  if (n.kind === p.NAME && n.value === t)
4617
4638
  this.advanceLexer();
4618
4639
  else
4619
- throw N(
4640
+ throw C(
4620
4641
  this._lexer.source,
4621
4642
  n.start,
4622
- `Expected "${t}", found ${ge(n)}.`
4643
+ `Expected "${t}", found ${Ee(n)}.`
4623
4644
  );
4624
4645
  }
4625
4646
  /**
@@ -4635,10 +4656,10 @@ class Rr {
4635
4656
  */
4636
4657
  unexpected(t) {
4637
4658
  const n = t ?? this._lexer.token;
4638
- return N(
4659
+ return C(
4639
4660
  this._lexer.source,
4640
4661
  n.start,
4641
- `Unexpected ${ge(n)}.`
4662
+ `Unexpected ${Ee(n)}.`
4642
4663
  );
4643
4664
  }
4644
4665
  /**
@@ -4698,28 +4719,28 @@ class Rr {
4698
4719
  advanceLexer() {
4699
4720
  const { maxTokens: t } = this._options, n = this._lexer.advance();
4700
4721
  if (t !== void 0 && n.kind !== p.EOF && (++this._tokenCounter, this._tokenCounter > t))
4701
- throw N(
4722
+ throw C(
4702
4723
  this._lexer.source,
4703
4724
  n.start,
4704
4725
  `Document contains more that ${t} tokens. Parsing aborted.`
4705
4726
  );
4706
4727
  }
4707
4728
  }
4708
- function ge(e) {
4729
+ function Ee(e) {
4709
4730
  const t = e.value;
4710
4731
  return mn(e.kind) + (t != null ? ` "${t}"` : "");
4711
4732
  }
4712
4733
  function mn(e) {
4713
- return fr(e) ? `"${e}"` : e;
4734
+ return yr(e) ? `"${e}"` : e;
4714
4735
  }
4715
- function qr(e) {
4716
- return `"${e.replace(Mr, Lr)}"`;
4717
- }
4718
- const Mr = /[\x00-\x1f\x22\x5c\x7f-\x9f]/g;
4719
4736
  function Lr(e) {
4720
- return Ur[e.charCodeAt(0)];
4737
+ return `"${e.replace(Ur, Pr)}"`;
4738
+ }
4739
+ const Ur = /[\x00-\x1f\x22\x5c\x7f-\x9f]/g;
4740
+ function Pr(e) {
4741
+ return Fr[e.charCodeAt(0)];
4721
4742
  }
4722
- const Ur = [
4743
+ const Fr = [
4723
4744
  "\\u0000",
4724
4745
  "\\u0001",
4725
4746
  "\\u0002",
@@ -4885,11 +4906,11 @@ const Ur = [
4885
4906
  "\\u009D",
4886
4907
  "\\u009E",
4887
4908
  "\\u009F"
4888
- ], Pr = Object.freeze({});
4889
- function Fr(e, t, n = un) {
4909
+ ], Br = Object.freeze({});
4910
+ function jr(e, t, n = un) {
4890
4911
  const s = /* @__PURE__ */ new Map();
4891
4912
  for (const w of Object.values(T))
4892
- s.set(w, Br(t, w));
4913
+ s.set(w, $r(t, w));
4893
4914
  let r, i = Array.isArray(e), o = [e], a = -1, c = [], u = e, h, d;
4894
4915
  const f = [], m = [];
4895
4916
  do {
@@ -4921,9 +4942,9 @@ function Fr(e, t, n = un) {
4921
4942
  let k;
4922
4943
  if (!Array.isArray(u)) {
4923
4944
  var y, v;
4924
- kt(u) || ve(!1, `Invalid AST Node: ${ht(u)}.`);
4945
+ Dt(u) || Te(!1, `Invalid AST Node: ${ft(u)}.`);
4925
4946
  const q = w ? (y = s.get(u.kind)) === null || y === void 0 ? void 0 : y.leave : (v = s.get(u.kind)) === null || v === void 0 ? void 0 : v.enter;
4926
- if (k = q == null ? void 0 : q.call(t, u, h, d, f, m), k === Pr)
4947
+ if (k = q == null ? void 0 : q.call(t, u, h, d, f, m), k === Br)
4927
4948
  break;
4928
4949
  if (k === !1) {
4929
4950
  if (!w) {
@@ -4931,7 +4952,7 @@ function Fr(e, t, n = un) {
4931
4952
  continue;
4932
4953
  }
4933
4954
  } else if (k !== void 0 && (c.push([h, k]), !w))
4934
- if (kt(k))
4955
+ if (Dt(k))
4935
4956
  u = k;
4936
4957
  else {
4937
4958
  f.pop();
@@ -4941,19 +4962,19 @@ function Fr(e, t, n = un) {
4941
4962
  if (k === void 0 && R && c.push([h, u]), w)
4942
4963
  f.pop();
4943
4964
  else {
4944
- var I;
4965
+ var _;
4945
4966
  r = {
4946
4967
  inArray: i,
4947
4968
  index: a,
4948
4969
  keys: o,
4949
4970
  edits: c,
4950
4971
  prev: r
4951
- }, i = Array.isArray(u), o = i ? u : (I = n[u.kind]) !== null && I !== void 0 ? I : [], a = -1, c = [], d && m.push(d), d = u;
4972
+ }, i = Array.isArray(u), o = i ? u : (_ = n[u.kind]) !== null && _ !== void 0 ? _ : [], a = -1, c = [], d && m.push(d), d = u;
4952
4973
  }
4953
4974
  } while (r !== void 0);
4954
4975
  return c.length !== 0 ? c[c.length - 1][1] : e;
4955
4976
  }
4956
- function Br(e, t) {
4977
+ function $r(e, t) {
4957
4978
  const n = e[t];
4958
4979
  return typeof n == "object" ? n : typeof n == "function" ? {
4959
4980
  enter: n,
@@ -4964,9 +4985,9 @@ function Br(e, t) {
4964
4985
  };
4965
4986
  }
4966
4987
  function gn(e) {
4967
- return Fr(e, $r);
4988
+ return jr(e, Hr);
4968
4989
  }
4969
- const jr = 80, $r = {
4990
+ const Vr = 80, Hr = {
4970
4991
  Name: {
4971
4992
  leave: (e) => e.value
4972
4993
  },
@@ -4981,7 +5002,7 @@ const jr = 80, $r = {
4981
5002
  },
4982
5003
  OperationDefinition: {
4983
5004
  leave(e) {
4984
- const t = S("(", E(e.variableDefinitions, ", "), ")"), n = E(
5005
+ const t = I("(", E(e.variableDefinitions, ", "), ")"), n = E(
4985
5006
  [
4986
5007
  e.operation,
4987
5008
  E([e.name, t]),
@@ -4993,17 +5014,17 @@ const jr = 80, $r = {
4993
5014
  }
4994
5015
  },
4995
5016
  VariableDefinition: {
4996
- leave: ({ variable: e, type: t, defaultValue: n, directives: s }) => e + ": " + t + S(" = ", n) + S(" ", E(s, " "))
5017
+ leave: ({ variable: e, type: t, defaultValue: n, directives: s }) => e + ": " + t + I(" = ", n) + I(" ", E(s, " "))
4997
5018
  },
4998
5019
  SelectionSet: {
4999
5020
  leave: ({ selections: e }) => M(e)
5000
5021
  },
5001
5022
  Field: {
5002
5023
  leave({ alias: e, name: t, arguments: n, directives: s, selectionSet: r }) {
5003
- const i = S("", e, ": ") + t;
5004
- let o = i + S("(", E(n, ", "), ")");
5005
- return o.length > jr && (o = i + S(`(
5006
- `, Te(E(n, `
5024
+ const i = I("", e, ": ") + t;
5025
+ let o = i + I("(", E(n, ", "), ")");
5026
+ return o.length > Vr && (o = i + I(`(
5027
+ `, Se(E(n, `
5007
5028
  `)), `
5008
5029
  )`)), E([o, E(s, " "), r], " ");
5009
5030
  }
@@ -5013,13 +5034,13 @@ const jr = 80, $r = {
5013
5034
  },
5014
5035
  // Fragments
5015
5036
  FragmentSpread: {
5016
- leave: ({ name: e, directives: t }) => "..." + e + S(" ", E(t, " "))
5037
+ leave: ({ name: e, directives: t }) => "..." + e + I(" ", E(t, " "))
5017
5038
  },
5018
5039
  InlineFragment: {
5019
5040
  leave: ({ typeCondition: e, directives: t, selectionSet: n }) => E(
5020
5041
  [
5021
5042
  "...",
5022
- S("on ", e),
5043
+ I("on ", e),
5023
5044
  E(t, " "),
5024
5045
  n
5025
5046
  ],
@@ -5029,7 +5050,7 @@ const jr = 80, $r = {
5029
5050
  FragmentDefinition: {
5030
5051
  leave: ({ name: e, typeCondition: t, variableDefinitions: n, directives: s, selectionSet: r }) => (
5031
5052
  // or removed in the future.
5032
- `fragment ${e}${S("(", E(n, ", "), ")")} on ${t} ${S("", E(s, " "), " ")}` + r
5053
+ `fragment ${e}${I("(", E(n, ", "), ")")} on ${t} ${I("", E(s, " "), " ")}` + r
5033
5054
  )
5034
5055
  },
5035
5056
  // Value
@@ -5040,7 +5061,7 @@ const jr = 80, $r = {
5040
5061
  leave: ({ value: e }) => e
5041
5062
  },
5042
5063
  StringValue: {
5043
- leave: ({ value: e, block: t }) => t ? lr(e) : qr(e)
5064
+ leave: ({ value: e, block: t }) => t ? fr(e) : Lr(e)
5044
5065
  },
5045
5066
  BooleanValue: {
5046
5067
  leave: ({ value: e }) => e ? "true" : "false"
@@ -5062,7 +5083,7 @@ const jr = 80, $r = {
5062
5083
  },
5063
5084
  // Directive
5064
5085
  Directive: {
5065
- leave: ({ name: e, arguments: t }) => "@" + e + S("(", E(t, ", "), ")")
5086
+ leave: ({ name: e, arguments: t }) => "@" + e + I("(", E(t, ", "), ")")
5066
5087
  },
5067
5088
  // Type
5068
5089
  NamedType: {
@@ -5076,23 +5097,23 @@ const jr = 80, $r = {
5076
5097
  },
5077
5098
  // Type System Definitions
5078
5099
  SchemaDefinition: {
5079
- leave: ({ description: e, directives: t, operationTypes: n }) => S("", e, `
5100
+ leave: ({ description: e, directives: t, operationTypes: n }) => I("", e, `
5080
5101
  `) + E(["schema", E(t, " "), M(n)], " ")
5081
5102
  },
5082
5103
  OperationTypeDefinition: {
5083
5104
  leave: ({ operation: e, type: t }) => e + ": " + t
5084
5105
  },
5085
5106
  ScalarTypeDefinition: {
5086
- leave: ({ description: e, name: t, directives: n }) => S("", e, `
5107
+ leave: ({ description: e, name: t, directives: n }) => I("", e, `
5087
5108
  `) + E(["scalar", t, E(n, " ")], " ")
5088
5109
  },
5089
5110
  ObjectTypeDefinition: {
5090
- leave: ({ description: e, name: t, interfaces: n, directives: s, fields: r }) => S("", e, `
5111
+ leave: ({ description: e, name: t, interfaces: n, directives: s, fields: r }) => I("", e, `
5091
5112
  `) + E(
5092
5113
  [
5093
5114
  "type",
5094
5115
  t,
5095
- S("implements ", E(n, " & ")),
5116
+ I("implements ", E(n, " & ")),
5096
5117
  E(s, " "),
5097
5118
  M(r)
5098
5119
  ],
@@ -5100,26 +5121,26 @@ const jr = 80, $r = {
5100
5121
  )
5101
5122
  },
5102
5123
  FieldDefinition: {
5103
- leave: ({ description: e, name: t, arguments: n, type: s, directives: r }) => S("", e, `
5104
- `) + t + (Rt(n) ? S(`(
5105
- `, Te(E(n, `
5124
+ leave: ({ description: e, name: t, arguments: n, type: s, directives: r }) => I("", e, `
5125
+ `) + t + (qt(n) ? I(`(
5126
+ `, Se(E(n, `
5106
5127
  `)), `
5107
- )`) : S("(", E(n, ", "), ")")) + ": " + s + S(" ", E(r, " "))
5128
+ )`) : I("(", E(n, ", "), ")")) + ": " + s + I(" ", E(r, " "))
5108
5129
  },
5109
5130
  InputValueDefinition: {
5110
- leave: ({ description: e, name: t, type: n, defaultValue: s, directives: r }) => S("", e, `
5131
+ leave: ({ description: e, name: t, type: n, defaultValue: s, directives: r }) => I("", e, `
5111
5132
  `) + E(
5112
- [t + ": " + n, S("= ", s), E(r, " ")],
5133
+ [t + ": " + n, I("= ", s), E(r, " ")],
5113
5134
  " "
5114
5135
  )
5115
5136
  },
5116
5137
  InterfaceTypeDefinition: {
5117
- leave: ({ description: e, name: t, interfaces: n, directives: s, fields: r }) => S("", e, `
5138
+ leave: ({ description: e, name: t, interfaces: n, directives: s, fields: r }) => I("", e, `
5118
5139
  `) + E(
5119
5140
  [
5120
5141
  "interface",
5121
5142
  t,
5122
- S("implements ", E(n, " & ")),
5143
+ I("implements ", E(n, " & ")),
5123
5144
  E(s, " "),
5124
5145
  M(r)
5125
5146
  ],
@@ -5127,30 +5148,30 @@ const jr = 80, $r = {
5127
5148
  )
5128
5149
  },
5129
5150
  UnionTypeDefinition: {
5130
- leave: ({ description: e, name: t, directives: n, types: s }) => S("", e, `
5151
+ leave: ({ description: e, name: t, directives: n, types: s }) => I("", e, `
5131
5152
  `) + E(
5132
- ["union", t, E(n, " "), S("= ", E(s, " | "))],
5153
+ ["union", t, E(n, " "), I("= ", E(s, " | "))],
5133
5154
  " "
5134
5155
  )
5135
5156
  },
5136
5157
  EnumTypeDefinition: {
5137
- leave: ({ description: e, name: t, directives: n, values: s }) => S("", e, `
5158
+ leave: ({ description: e, name: t, directives: n, values: s }) => I("", e, `
5138
5159
  `) + E(["enum", t, E(n, " "), M(s)], " ")
5139
5160
  },
5140
5161
  EnumValueDefinition: {
5141
- leave: ({ description: e, name: t, directives: n }) => S("", e, `
5162
+ leave: ({ description: e, name: t, directives: n }) => I("", e, `
5142
5163
  `) + E([t, E(n, " ")], " ")
5143
5164
  },
5144
5165
  InputObjectTypeDefinition: {
5145
- leave: ({ description: e, name: t, directives: n, fields: s }) => S("", e, `
5166
+ leave: ({ description: e, name: t, directives: n, fields: s }) => I("", e, `
5146
5167
  `) + E(["input", t, E(n, " "), M(s)], " ")
5147
5168
  },
5148
5169
  DirectiveDefinition: {
5149
- leave: ({ description: e, name: t, arguments: n, repeatable: s, locations: r }) => S("", e, `
5150
- `) + "directive @" + t + (Rt(n) ? S(`(
5151
- `, Te(E(n, `
5170
+ leave: ({ description: e, name: t, arguments: n, repeatable: s, locations: r }) => I("", e, `
5171
+ `) + "directive @" + t + (qt(n) ? I(`(
5172
+ `, Se(E(n, `
5152
5173
  `)), `
5153
- )`) : S("(", E(n, ", "), ")")) + (s ? " repeatable" : "") + " on " + E(r, " | ")
5174
+ )`) : I("(", E(n, ", "), ")")) + (s ? " repeatable" : "") + " on " + E(r, " | ")
5154
5175
  },
5155
5176
  SchemaExtension: {
5156
5177
  leave: ({ directives: e, operationTypes: t }) => E(
@@ -5166,7 +5187,7 @@ const jr = 80, $r = {
5166
5187
  [
5167
5188
  "extend type",
5168
5189
  e,
5169
- S("implements ", E(t, " & ")),
5190
+ I("implements ", E(t, " & ")),
5170
5191
  E(n, " "),
5171
5192
  M(s)
5172
5193
  ],
@@ -5178,7 +5199,7 @@ const jr = 80, $r = {
5178
5199
  [
5179
5200
  "extend interface",
5180
5201
  e,
5181
- S("implements ", E(t, " & ")),
5202
+ I("implements ", E(t, " & ")),
5182
5203
  E(n, " "),
5183
5204
  M(s)
5184
5205
  ],
@@ -5191,7 +5212,7 @@ const jr = 80, $r = {
5191
5212
  "extend union",
5192
5213
  e,
5193
5214
  E(t, " "),
5194
- S("= ", E(n, " | "))
5215
+ I("= ", E(n, " | "))
5195
5216
  ],
5196
5217
  " "
5197
5218
  )
@@ -5208,24 +5229,24 @@ function E(e, t = "") {
5208
5229
  return (n = e == null ? void 0 : e.filter((s) => s).join(t)) !== null && n !== void 0 ? n : "";
5209
5230
  }
5210
5231
  function M(e) {
5211
- return S(`{
5212
- `, Te(E(e, `
5232
+ return I(`{
5233
+ `, Se(E(e, `
5213
5234
  `)), `
5214
5235
  }`);
5215
5236
  }
5216
- function S(e, t, n = "") {
5237
+ function I(e, t, n = "") {
5217
5238
  return t != null && t !== "" ? e + t + n : "";
5218
5239
  }
5219
- function Te(e) {
5220
- return S(" ", e.replace(/\n/g, `
5240
+ function Se(e) {
5241
+ return I(" ", e.replace(/\n/g, `
5221
5242
  `));
5222
5243
  }
5223
- function Rt(e) {
5244
+ function qt(e) {
5224
5245
  var t;
5225
5246
  return (t = e == null ? void 0 : e.some((n) => n.includes(`
5226
5247
  `))) !== null && t !== void 0 ? t : !1;
5227
5248
  }
5228
- const qt = (e) => {
5249
+ const Mt = (e) => {
5229
5250
  var s, r;
5230
5251
  let t;
5231
5252
  const n = e.definitions.filter((i) => i.kind === "OperationDefinition");
@@ -5234,13 +5255,13 @@ const qt = (e) => {
5234
5255
  if (typeof e == "string") {
5235
5256
  let n;
5236
5257
  try {
5237
- const s = Dr(e);
5238
- n = qt(s);
5258
+ const s = qr(e);
5259
+ n = Mt(s);
5239
5260
  } catch {
5240
5261
  }
5241
5262
  return { query: e, operationName: n };
5242
5263
  }
5243
- const t = qt(e);
5264
+ const t = Mt(e);
5244
5265
  return { query: gn(e), operationName: t };
5245
5266
  };
5246
5267
  class ce extends Error {
@@ -5256,13 +5277,13 @@ class ce extends Error {
5256
5277
  return ((s = (n = t.errors) == null ? void 0 : n[0]) == null ? void 0 : s.message) ?? `GraphQL Error (Code: ${t.status})`;
5257
5278
  }
5258
5279
  }
5259
- var Vr = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
5260
- function Hr(e) {
5280
+ var zr = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
5281
+ function Gr(e) {
5261
5282
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
5262
5283
  }
5263
- var Ze = { exports: {} };
5284
+ var et = { exports: {} };
5264
5285
  (function(e, t) {
5265
- var n = typeof self < "u" ? self : Vr, s = function() {
5286
+ var n = typeof self < "u" ? self : zr, s = function() {
5266
5287
  function i() {
5267
5288
  this.fetch = !1, this.DOMException = n.DOMException;
5268
5289
  }
@@ -5311,8 +5332,8 @@ var Ze = { exports: {} };
5311
5332
  function m(l) {
5312
5333
  var g = {
5313
5334
  next: function() {
5314
- var _ = l.shift();
5315
- return { done: _ === void 0, value: _ };
5335
+ var S = l.shift();
5336
+ return { done: S === void 0, value: S };
5316
5337
  }
5317
5338
  };
5318
5339
  return a.iterable && (g[Symbol.iterator] = function() {
@@ -5320,8 +5341,8 @@ var Ze = { exports: {} };
5320
5341
  }), g;
5321
5342
  }
5322
5343
  function y(l) {
5323
- this.map = {}, l instanceof y ? l.forEach(function(g, _) {
5324
- this.append(_, g);
5344
+ this.map = {}, l instanceof y ? l.forEach(function(g, S) {
5345
+ this.append(S, g);
5325
5346
  }, this) : Array.isArray(l) ? l.forEach(function(g) {
5326
5347
  this.append(g[0], g[1]);
5327
5348
  }, this) : l && Object.getOwnPropertyNames(l).forEach(function(g) {
@@ -5330,8 +5351,8 @@ var Ze = { exports: {} };
5330
5351
  }
5331
5352
  y.prototype.append = function(l, g) {
5332
5353
  l = d(l), g = f(g);
5333
- var _ = this.map[l];
5334
- this.map[l] = _ ? _ + ", " + g : g;
5354
+ var S = this.map[l];
5355
+ this.map[l] = S ? S + ", " + g : g;
5335
5356
  }, y.prototype.delete = function(l) {
5336
5357
  delete this.map[d(l)];
5337
5358
  }, y.prototype.get = function(l) {
@@ -5341,12 +5362,12 @@ var Ze = { exports: {} };
5341
5362
  }, y.prototype.set = function(l, g) {
5342
5363
  this.map[d(l)] = f(g);
5343
5364
  }, y.prototype.forEach = function(l, g) {
5344
- for (var _ in this.map)
5345
- this.map.hasOwnProperty(_) && l.call(g, this.map[_], _, this);
5365
+ for (var S in this.map)
5366
+ this.map.hasOwnProperty(S) && l.call(g, this.map[S], S, this);
5346
5367
  }, y.prototype.keys = function() {
5347
5368
  var l = [];
5348
- return this.forEach(function(g, _) {
5349
- l.push(_);
5369
+ return this.forEach(function(g, S) {
5370
+ l.push(S);
5350
5371
  }), m(l);
5351
5372
  }, y.prototype.values = function() {
5352
5373
  var l = [];
@@ -5355,8 +5376,8 @@ var Ze = { exports: {} };
5355
5376
  }), m(l);
5356
5377
  }, y.prototype.entries = function() {
5357
5378
  var l = [];
5358
- return this.forEach(function(g, _) {
5359
- l.push([_, g]);
5379
+ return this.forEach(function(g, S) {
5380
+ l.push([S, g]);
5360
5381
  }), m(l);
5361
5382
  }, a.iterable && (y.prototype[Symbol.iterator] = y.prototype.entries);
5362
5383
  function v(l) {
@@ -5364,27 +5385,27 @@ var Ze = { exports: {} };
5364
5385
  return Promise.reject(new TypeError("Already read"));
5365
5386
  l.bodyUsed = !0;
5366
5387
  }
5367
- function I(l) {
5368
- return new Promise(function(g, _) {
5388
+ function _(l) {
5389
+ return new Promise(function(g, S) {
5369
5390
  l.onload = function() {
5370
5391
  g(l.result);
5371
5392
  }, l.onerror = function() {
5372
- _(l.error);
5393
+ S(l.error);
5373
5394
  };
5374
5395
  });
5375
5396
  }
5376
5397
  function w(l) {
5377
- var g = new FileReader(), _ = I(g);
5378
- return g.readAsArrayBuffer(l), _;
5398
+ var g = new FileReader(), S = _(g);
5399
+ return g.readAsArrayBuffer(l), S;
5379
5400
  }
5380
5401
  function R(l) {
5381
- var g = new FileReader(), _ = I(g);
5382
- return g.readAsText(l), _;
5402
+ var g = new FileReader(), S = _(g);
5403
+ return g.readAsText(l), S;
5383
5404
  }
5384
5405
  function k(l) {
5385
- for (var g = new Uint8Array(l), _ = new Array(g.length), C = 0; C < g.length; C++)
5386
- _[C] = String.fromCharCode(g[C]);
5387
- return _.join("");
5406
+ for (var g = new Uint8Array(l), S = new Array(g.length), N = 0; N < g.length; N++)
5407
+ S[N] = String.fromCharCode(g[N]);
5408
+ return S.join("");
5388
5409
  }
5389
5410
  function q(l) {
5390
5411
  if (l.slice)
@@ -5420,7 +5441,7 @@ var Ze = { exports: {} };
5420
5441
  throw new Error("could not read FormData body as text");
5421
5442
  return Promise.resolve(this._bodyText);
5422
5443
  }, a.formData && (this.formData = function() {
5423
- return this.text().then(fe);
5444
+ return this.text().then(pe);
5424
5445
  }), this.json = function() {
5425
5446
  return this.text().then(JSON.parse);
5426
5447
  }, this;
@@ -5432,36 +5453,36 @@ var Ze = { exports: {} };
5432
5453
  }
5433
5454
  function L(l, g) {
5434
5455
  g = g || {};
5435
- var _ = g.body;
5456
+ var S = g.body;
5436
5457
  if (l instanceof L) {
5437
5458
  if (l.bodyUsed)
5438
5459
  throw new TypeError("Already read");
5439
- this.url = l.url, this.credentials = l.credentials, g.headers || (this.headers = new y(l.headers)), this.method = l.method, this.mode = l.mode, this.signal = l.signal, !_ && l._bodyInit != null && (_ = l._bodyInit, l.bodyUsed = !0);
5460
+ this.url = l.url, this.credentials = l.credentials, g.headers || (this.headers = new y(l.headers)), this.method = l.method, this.mode = l.mode, this.signal = l.signal, !S && l._bodyInit != null && (S = l._bodyInit, l.bodyUsed = !0);
5440
5461
  } else
5441
5462
  this.url = String(l);
5442
- if (this.credentials = g.credentials || this.credentials || "same-origin", (g.headers || !this.headers) && (this.headers = new y(g.headers)), this.method = z(g.method || this.method || "GET"), this.mode = g.mode || this.mode || null, this.signal = g.signal || this.signal, this.referrer = null, (this.method === "GET" || this.method === "HEAD") && _)
5463
+ if (this.credentials = g.credentials || this.credentials || "same-origin", (g.headers || !this.headers) && (this.headers = new y(g.headers)), this.method = z(g.method || this.method || "GET"), this.mode = g.mode || this.mode || null, this.signal = g.signal || this.signal, this.referrer = null, (this.method === "GET" || this.method === "HEAD") && S)
5443
5464
  throw new TypeError("Body not allowed for GET or HEAD requests");
5444
- this._initBody(_);
5465
+ this._initBody(S);
5445
5466
  }
5446
5467
  L.prototype.clone = function() {
5447
5468
  return new L(this, { body: this._bodyInit });
5448
5469
  };
5449
- function fe(l) {
5470
+ function pe(l) {
5450
5471
  var g = new FormData();
5451
- return l.trim().split("&").forEach(function(_) {
5452
- if (_) {
5453
- var C = _.split("="), O = C.shift().replace(/\+/g, " "), A = C.join("=").replace(/\+/g, " ");
5472
+ return l.trim().split("&").forEach(function(S) {
5473
+ if (S) {
5474
+ var N = S.split("="), O = N.shift().replace(/\+/g, " "), A = N.join("=").replace(/\+/g, " ");
5454
5475
  g.append(decodeURIComponent(O), decodeURIComponent(A));
5455
5476
  }
5456
5477
  }), g;
5457
5478
  }
5458
- function pe(l) {
5459
- var g = new y(), _ = l.replace(/\r?\n[\t ]+/g, " ");
5460
- return _.split(/\r?\n/).forEach(function(C) {
5461
- var O = C.split(":"), A = O.shift().trim();
5479
+ function ye(l) {
5480
+ var g = new y(), S = l.replace(/\r?\n[\t ]+/g, " ");
5481
+ return S.split(/\r?\n/).forEach(function(N) {
5482
+ var O = N.split(":"), A = O.shift().trim();
5462
5483
  if (A) {
5463
- var ye = O.join(":").trim();
5464
- g.append(A, ye);
5484
+ var me = O.join(":").trim();
5485
+ g.append(A, me);
5465
5486
  }
5466
5487
  }), g;
5467
5488
  }
@@ -5480,49 +5501,49 @@ var Ze = { exports: {} };
5480
5501
  var l = new U(null, { status: 0, statusText: "" });
5481
5502
  return l.type = "error", l;
5482
5503
  };
5483
- var Sn = [301, 302, 303, 307, 308];
5504
+ var _n = [301, 302, 303, 307, 308];
5484
5505
  U.redirect = function(l, g) {
5485
- if (Sn.indexOf(g) === -1)
5506
+ if (_n.indexOf(g) === -1)
5486
5507
  throw new RangeError("Invalid status code");
5487
5508
  return new U(null, { status: g, headers: { location: l } });
5488
5509
  }, o.DOMException = i.DOMException;
5489
5510
  try {
5490
5511
  new o.DOMException();
5491
5512
  } catch {
5492
- o.DOMException = function(g, _) {
5493
- this.message = g, this.name = _;
5494
- var C = Error(g);
5495
- this.stack = C.stack;
5513
+ o.DOMException = function(g, S) {
5514
+ this.message = g, this.name = S;
5515
+ var N = Error(g);
5516
+ this.stack = N.stack;
5496
5517
  }, o.DOMException.prototype = Object.create(Error.prototype), o.DOMException.prototype.constructor = o.DOMException;
5497
5518
  }
5498
5519
  function Me(l, g) {
5499
- return new Promise(function(_, C) {
5520
+ return new Promise(function(S, N) {
5500
5521
  var O = new L(l, g);
5501
5522
  if (O.signal && O.signal.aborted)
5502
- return C(new o.DOMException("Aborted", "AbortError"));
5523
+ return N(new o.DOMException("Aborted", "AbortError"));
5503
5524
  var A = new XMLHttpRequest();
5504
- function ye() {
5525
+ function me() {
5505
5526
  A.abort();
5506
5527
  }
5507
5528
  A.onload = function() {
5508
5529
  var ie = {
5509
5530
  status: A.status,
5510
5531
  statusText: A.statusText,
5511
- headers: pe(A.getAllResponseHeaders() || "")
5532
+ headers: ye(A.getAllResponseHeaders() || "")
5512
5533
  };
5513
5534
  ie.url = "responseURL" in A ? A.responseURL : ie.headers.get("X-Request-URL");
5514
5535
  var Le = "response" in A ? A.response : A.responseText;
5515
- _(new U(Le, ie));
5536
+ S(new U(Le, ie));
5516
5537
  }, A.onerror = function() {
5517
- C(new TypeError("Network request failed"));
5538
+ N(new TypeError("Network request failed"));
5518
5539
  }, A.ontimeout = function() {
5519
- C(new TypeError("Network request failed"));
5540
+ N(new TypeError("Network request failed"));
5520
5541
  }, A.onabort = function() {
5521
- C(new o.DOMException("Aborted", "AbortError"));
5542
+ N(new o.DOMException("Aborted", "AbortError"));
5522
5543
  }, A.open(O.method, O.url, !0), O.credentials === "include" ? A.withCredentials = !0 : O.credentials === "omit" && (A.withCredentials = !1), "responseType" in A && a.blob && (A.responseType = "blob"), O.headers.forEach(function(ie, Le) {
5523
5544
  A.setRequestHeader(Le, ie);
5524
- }), O.signal && (O.signal.addEventListener("abort", ye), A.onreadystatechange = function() {
5525
- A.readyState === 4 && O.signal.removeEventListener("abort", ye);
5545
+ }), O.signal && (O.signal.addEventListener("abort", me), A.onreadystatechange = function() {
5546
+ A.readyState === 4 && O.signal.removeEventListener("abort", me);
5526
5547
  }), A.send(typeof O._bodyInit > "u" ? null : O._bodyInit);
5527
5548
  });
5528
5549
  }
@@ -5531,36 +5552,36 @@ var Ze = { exports: {} };
5531
5552
  })(s), s.fetch.ponyfill = !0, delete s.fetch.polyfill;
5532
5553
  var r = s;
5533
5554
  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;
5534
- })(Ze, Ze.exports);
5535
- var we = Ze.exports;
5536
- const _e = /* @__PURE__ */ Hr(we), zr = /* @__PURE__ */ An({
5555
+ })(et, et.exports);
5556
+ var xe = et.exports;
5557
+ const _e = /* @__PURE__ */ Gr(xe), Jr = /* @__PURE__ */ An({
5537
5558
  __proto__: null,
5538
5559
  default: _e
5539
- }, [we]), W = (e) => {
5560
+ }, [xe]), W = (e) => {
5540
5561
  let t = {};
5541
- return e && (typeof Headers < "u" && e instanceof Headers || zr && we.Headers && e instanceof we.Headers ? t = Xs(e) : Array.isArray(e) ? e.forEach(([n, s]) => {
5562
+ return e && (typeof Headers < "u" && e instanceof Headers || Jr && xe.Headers && e instanceof xe.Headers ? t = Ks(e) : Array.isArray(e) ? e.forEach(([n, s]) => {
5542
5563
  n && s !== void 0 && (t[n] = s);
5543
5564
  }) : t = e), t;
5544
- }, Mt = (e) => e.replace(/([\s,]|#[^\n\r]+)+/g, " ").trim(), Gr = (e) => {
5565
+ }, Lt = (e) => e.replace(/([\s,]|#[^\n\r]+)+/g, " ").trim(), Yr = (e) => {
5545
5566
  if (!Array.isArray(e.query)) {
5546
- const s = e, r = [`query=${encodeURIComponent(Mt(s.query))}`];
5567
+ const s = e, r = [`query=${encodeURIComponent(Lt(s.query))}`];
5547
5568
  return e.variables && r.push(`variables=${encodeURIComponent(s.jsonSerializer.stringify(s.variables))}`), s.operationName && r.push(`operationName=${encodeURIComponent(s.operationName)}`), r.join("&");
5548
5569
  }
5549
5570
  if (typeof e.variables < "u" && !Array.isArray(e.variables))
5550
5571
  throw new Error("Cannot create query with given variable type, array expected");
5551
5572
  const t = e, n = e.query.reduce((s, r, i) => (s.push({
5552
- query: Mt(r),
5573
+ query: Lt(r),
5553
5574
  variables: t.variables ? t.jsonSerializer.stringify(t.variables[i]) : void 0
5554
5575
  }), s), []);
5555
5576
  return `query=${encodeURIComponent(t.jsonSerializer.stringify(n))}`;
5556
- }, Jr = (e) => async (t) => {
5577
+ }, Qr = (e) => async (t) => {
5557
5578
  const { url: n, query: s, variables: r, operationName: i, fetch: o, fetchOptions: a, middleware: c } = t, u = { ...t.headers };
5558
5579
  let h = "", d;
5559
- e === "POST" ? (d = Yr(s, r, i, a.jsonSerializer), typeof d == "string" && (u["Content-Type"] = "application/json")) : h = Gr({
5580
+ e === "POST" ? (d = Xr(s, r, i, a.jsonSerializer), typeof d == "string" && (u["Content-Type"] = "application/json")) : h = Yr({
5560
5581
  query: s,
5561
5582
  variables: r,
5562
5583
  operationName: i,
5563
- jsonSerializer: a.jsonSerializer ?? dt
5584
+ jsonSerializer: a.jsonSerializer ?? lt
5564
5585
  });
5565
5586
  const f = {
5566
5587
  method: e,
@@ -5570,15 +5591,15 @@ const _e = /* @__PURE__ */ Hr(we), zr = /* @__PURE__ */ An({
5570
5591
  };
5571
5592
  let m = n, y = f;
5572
5593
  if (c) {
5573
- const v = await Promise.resolve(c({ ...f, url: n, operationName: i, variables: r })), { url: I, ...w } = v;
5574
- m = I, y = w;
5594
+ const v = await Promise.resolve(c({ ...f, url: n, operationName: i, variables: r })), { url: _, ...w } = v;
5595
+ m = _, y = w;
5575
5596
  }
5576
5597
  return h && (m = `${m}?${h}`), await o(m, y);
5577
5598
  };
5578
5599
  class En {
5579
5600
  constructor(t, n = {}) {
5580
5601
  this.url = t, this.requestConfig = n, this.rawRequest = async (...s) => {
5581
- const [r, i, o] = s, a = Ks(r, i, o), { headers: c, fetch: u = _e, method: h = "POST", requestMiddleware: d, responseMiddleware: f, ...m } = this.requestConfig, { url: y } = this;
5602
+ const [r, i, o] = s, a = er(r, i, o), { headers: c, fetch: u = _e, method: h = "POST", requestMiddleware: d, responseMiddleware: f, ...m } = this.requestConfig, { url: y } = this;
5582
5603
  a.signal !== void 0 && (m.signal = a.signal);
5583
5604
  const { operationName: v } = je(a.query);
5584
5605
  return $e({
@@ -5594,13 +5615,13 @@ class En {
5594
5615
  method: h,
5595
5616
  fetchOptions: m,
5596
5617
  middleware: d
5597
- }).then((I) => (f && f(I), I)).catch((I) => {
5598
- throw f && f(I), I;
5618
+ }).then((_) => (f && f(_), _)).catch((_) => {
5619
+ throw f && f(_), _;
5599
5620
  });
5600
5621
  };
5601
5622
  }
5602
5623
  async request(t, ...n) {
5603
- const [s, r] = n, i = Ws(t, s, r), { headers: o, fetch: a = _e, method: c = "POST", requestMiddleware: u, responseMiddleware: h, ...d } = this.requestConfig, { url: f } = this;
5624
+ const [s, r] = n, i = Zs(t, s, r), { headers: o, fetch: a = _e, method: c = "POST", requestMiddleware: u, responseMiddleware: h, ...d } = this.requestConfig, { url: f } = this;
5604
5625
  i.signal !== void 0 && (d.signal = i.signal);
5605
5626
  const { query: m, operationName: y } = je(i.document);
5606
5627
  return $e({
@@ -5622,7 +5643,7 @@ class En {
5622
5643
  }
5623
5644
  // prettier-ignore
5624
5645
  batchRequests(t, n) {
5625
- const s = Zs(t, n), { headers: r, ...i } = this.requestConfig;
5646
+ const s = tr(t, n), { headers: r, ...i } = this.requestConfig;
5626
5647
  s.signal !== void 0 && (i.signal = s.signal);
5627
5648
  const o = s.documents.map(({ document: c }) => je(c).query), a = s.documents.map(({ variables: c }) => c);
5628
5649
  return $e({
@@ -5661,7 +5682,7 @@ class En {
5661
5682
  }
5662
5683
  }
5663
5684
  const $e = async (e) => {
5664
- const { query: t, variables: n, fetchOptions: s } = e, r = Jr(Qs(e.method ?? "post")), i = Array.isArray(e.query), o = await r(e), a = await Qr(o, s.jsonSerializer ?? dt), c = Array.isArray(a) ? !a.some(({ data: h }) => !h) : !!a.data, u = Array.isArray(a) || !a.errors || Array.isArray(a.errors) && !a.errors.length || s.errorPolicy === "all" || s.errorPolicy === "ignore";
5685
+ const { query: t, variables: n, fetchOptions: s } = e, r = Qr(Ws(e.method ?? "post")), i = Array.isArray(e.query), o = await r(e), a = await Wr(o, s.jsonSerializer ?? lt), c = Array.isArray(a) ? !a.some(({ data: h }) => !h) : !!a.data, u = Array.isArray(a) || !a.errors || Array.isArray(a.errors) && !a.errors.length || s.errorPolicy === "all" || s.errorPolicy === "ignore";
5665
5686
  if (o.ok && u && c) {
5666
5687
  const { errors: h, ...d } = (Array.isArray(a), a), f = s.errorPolicy === "ignore" ? d : a;
5667
5688
  return {
@@ -5680,26 +5701,50 @@ const $e = async (e) => {
5680
5701
  );
5681
5702
  }
5682
5703
  };
5683
- async function qe(e, t, ...n) {
5684
- const s = er(e, t, ...n);
5704
+ async function fe(e, t, ...n) {
5705
+ const s = nr(e, t, ...n);
5685
5706
  return new En(s.url).request({
5686
5707
  ...s
5687
5708
  });
5688
5709
  }
5689
- const Yr = (e, t, n, s) => {
5690
- const r = s ?? dt;
5710
+ const Xr = (e, t, n, s) => {
5711
+ const r = s ?? lt;
5691
5712
  if (!Array.isArray(e))
5692
5713
  return r.stringify({ query: e, variables: t, operationName: n });
5693
5714
  if (typeof t < "u" && !Array.isArray(t))
5694
5715
  throw new Error("Cannot create request body with given variable type, array expected");
5695
5716
  const i = e.reduce((o, a, c) => (o.push({ query: a, variables: t ? t[c] : void 0 }), o), []);
5696
5717
  return r.stringify(i);
5697
- }, Qr = async (e, t) => {
5718
+ }, Wr = async (e, t) => {
5698
5719
  let n;
5699
5720
  return e.headers.forEach((s, r) => {
5700
5721
  r.toLowerCase() === "content-type" && (n = s);
5701
5722
  }), 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();
5702
- }, Ve = (e) => typeof e == "function" ? e() : e, Xr = V(async ({ input: e }) => {
5723
+ }, Ve = (e) => typeof e == "function" ? e() : e, Kr = $(async ({ input: e }) => {
5724
+ var t, n;
5725
+ if (!e.endpoint || e.endpoint === "")
5726
+ throw new Error("No endpoint provided.");
5727
+ if (!e.document)
5728
+ throw new Error("No request document provided.");
5729
+ if (!e.requestHeaders)
5730
+ throw new Error("No request headers provided.");
5731
+ try {
5732
+ const s = await fe(
5733
+ e.endpoint,
5734
+ e.document,
5735
+ {},
5736
+ e.requestHeaders
5737
+ );
5738
+ if (!((n = (t = s.placeOrder) == null ? void 0 : t.checkoutSuccess) != null && n.id))
5739
+ throw console.log("Could not place order."), new Error("Could not place order.");
5740
+ return {
5741
+ type: "PLACE_ORDER_SUCCESS",
5742
+ successId: s.placeOrder.checkoutSuccess.id
5743
+ };
5744
+ } catch (s) {
5745
+ throw console.log("Request to place order failed."), console.log(s), new Error("Request to place order failed.");
5746
+ }
5747
+ }), Zr = $(async ({ input: e }) => {
5703
5748
  var t;
5704
5749
  if (!e.endpoint || e.endpoint === "")
5705
5750
  throw new Error("No endpoint provided.");
@@ -5710,7 +5755,7 @@ const Yr = (e, t, n, s) => {
5710
5755
  if (!e.requestHeaders)
5711
5756
  throw new Error("No request headers provided.");
5712
5757
  try {
5713
- const n = await qe(
5758
+ const n = await fe(
5714
5759
  e.endpoint,
5715
5760
  e.document,
5716
5761
  {
@@ -5731,25 +5776,27 @@ const Yr = (e, t, n, s) => {
5731
5776
  } catch {
5732
5777
  throw console.log("Request to add submit step data failed."), new Error("Request to add submit step data failed.");
5733
5778
  }
5734
- }), Wr = ({ context: e }) => Object.keys(e.quote).length > 0, Lt = he({
5779
+ }), ei = ({ context: e }) => Object.keys(e.quote).length > 0, Ut = he({
5735
5780
  types: {
5736
5781
  context: {},
5737
5782
  events: {},
5738
5783
  input: {}
5739
5784
  },
5740
5785
  actions: {
5741
- changeStep: b(Gs),
5742
- nextStep: b(Js),
5743
- updateQuote: b(Ys)
5786
+ changeStep: x(Gs),
5787
+ nextStep: x(Js),
5788
+ resetCheckout: x(Ys),
5789
+ updateQuote: x(Qs),
5790
+ updateSuccessId: x(Xs)
5744
5791
  },
5745
- actors: { submitStepData: Xr },
5746
- guards: { quoteExists: Wr }
5792
+ actors: { placeOrder: Kr, submitStepData: Zr },
5793
+ guards: { quoteExists: ei }
5747
5794
  }).createMachine({
5748
5795
  /** @todo do we need to add the view to the id? (e.g. checkout_en-us) */
5749
5796
  id: "checkout",
5750
5797
  initial: "uninitialized",
5751
5798
  context: ({ input: e }) => {
5752
- var t, n, s, r, i, o, a, c, u, h, d;
5799
+ var t, n, s, r, i, o, a, c, u, h, d, f, m, y, v, _, w;
5753
5800
  return {
5754
5801
  currentStep: ((t = e == null ? void 0 : e.initialContext) == null ? void 0 : t.currentStep) ?? "",
5755
5802
  errors: [],
@@ -5773,6 +5820,7 @@ const Yr = (e, t, n, s) => {
5773
5820
  // 'paymentMethod',
5774
5821
  // 'shippingMethod',
5775
5822
  ],
5823
+ successId: "",
5776
5824
  quote: ((r = e == null ? void 0 : e.initialContext) == null ? void 0 : r.quote) ?? {},
5777
5825
  // sync with quote machine
5778
5826
  endpoints: {
@@ -5781,9 +5829,13 @@ const Yr = (e, t, n, s) => {
5781
5829
  ...(i = e == null ? void 0 : e.initialContext) == null ? void 0 : i.endpoints
5782
5830
  },
5783
5831
  graphql: {
5832
+ placeOrder: {
5833
+ document: ((c = (a = (o = e == null ? void 0 : e.initialContext) == null ? void 0 : o.graphql) == null ? void 0 : a.placeOrder) == null ? void 0 : c.document) ?? "",
5834
+ requestHeaders: ((d = (h = (u = e == null ? void 0 : e.initialContext) == null ? void 0 : u.graphql) == null ? void 0 : h.placeOrder) == null ? void 0 : d.requestHeaders) ?? void 0
5835
+ },
5784
5836
  submitStepData: {
5785
- document: ((c = (a = (o = e == null ? void 0 : e.initialContext) == null ? void 0 : o.graphql) == null ? void 0 : a.submitStepData) == null ? void 0 : c.document) ?? "",
5786
- requestHeaders: ((d = (h = (u = e == null ? void 0 : e.initialContext) == null ? void 0 : u.graphql) == null ? void 0 : h.submitStepData) == null ? void 0 : d.requestHeaders) ?? void 0
5837
+ document: ((y = (m = (f = e == null ? void 0 : e.initialContext) == null ? void 0 : f.graphql) == null ? void 0 : m.submitStepData) == null ? void 0 : y.document) ?? "",
5838
+ requestHeaders: ((w = (_ = (v = e == null ? void 0 : e.initialContext) == null ? void 0 : v.graphql) == null ? void 0 : _.submitStepData) == null ? void 0 : w.requestHeaders) ?? void 0
5787
5839
  }
5788
5840
  }
5789
5841
  };
@@ -5818,12 +5870,13 @@ const Yr = (e, t, n, s) => {
5818
5870
  // always guard to make sure we can show the step we're on
5819
5871
  on: {
5820
5872
  SUBMIT_STEP_DATA: "submittingStepData",
5821
- CHANGE_STEP: "changingStep"
5873
+ CHANGE_STEP: "changingStep",
5874
+ PLACE_ORDER: "placingOrder"
5822
5875
  }
5823
5876
  },
5824
5877
  submittingStepData: {
5825
5878
  invoke: {
5826
- input: ({ context: e, event: t }) => (rn(t, "SUBMIT_STEP_DATA"), {
5879
+ input: ({ context: e, event: t }) => (Qe(t, "SUBMIT_STEP_DATA"), {
5827
5880
  // quoteId: context.quote.id,
5828
5881
  // locale: context.quote.locale,
5829
5882
  endpoint: e.endpoints.client,
@@ -5854,6 +5907,35 @@ const Yr = (e, t, n, s) => {
5854
5907
  actions: ["changeStep"],
5855
5908
  target: "showStep"
5856
5909
  }
5910
+ },
5911
+ placingOrder: {
5912
+ invoke: {
5913
+ input: ({ context: e, event: t }) => (Qe(t, "PLACE_ORDER"), {
5914
+ endpoint: e.endpoints.client,
5915
+ document: e.graphql.placeOrder.document,
5916
+ requestHeaders: e.graphql.placeOrder.requestHeaders
5917
+ }),
5918
+ src: "placeOrder",
5919
+ onDone: [
5920
+ {
5921
+ /**
5922
+ * @todo
5923
+ * how to handle quote and checkout being synced here?
5924
+ */
5925
+ // actions: ['updateQuote', 'updateCheckout', 'nextStep'],
5926
+ // actions: ['resetCheckout'],
5927
+ actions: ["updateSuccessId"],
5928
+ target: "success"
5929
+ }
5930
+ ],
5931
+ onError: {
5932
+ /** @todo add action to emit checkout error */
5933
+ target: "showStep"
5934
+ }
5935
+ }
5936
+ },
5937
+ success: {
5938
+ type: "final"
5857
5939
  }
5858
5940
  // syncIsLoggedIn: {},
5859
5941
  // syncQuote: {},
@@ -5877,39 +5959,33 @@ const Yr = (e, t, n, s) => {
5877
5959
  // submittingPaymentMethod: {},
5878
5960
  // shippingMethod: {},
5879
5961
  // submittingShippingMethod: {},
5880
- // placingOrder: {},
5881
5962
  // orderSuccess: {},
5882
5963
  }
5883
5964
  // on: {
5884
5965
  // SYNC_IS_LOGGED_IN: '.syncIsLoggedIn',
5885
5966
  // SYNC_QUOTE: '.syncQuote',
5886
5967
  // },
5887
- }), vn = be({}), Ei = () => {
5888
- const e = Ne(vn);
5968
+ }), vn = Ce({}), _i = () => {
5969
+ const e = Oe(vn);
5889
5970
  if (!e || !e.getSnapshot)
5890
5971
  throw new Error("checkoutActor is not properly initialized");
5891
- const [t, n] = Oe(() => e.getSnapshot());
5892
- Ce(() => {
5972
+ const [t, n] = Ne(e.getSnapshot());
5973
+ return ke(() => {
5893
5974
  if (!e || !e.getSnapshot) {
5894
5975
  console.error("checkoutActor is not properly initialized");
5895
5976
  return;
5896
5977
  }
5897
- (() => {
5898
- n(e.getSnapshot());
5899
- })();
5900
- const i = e.subscribe((o) => {
5901
- n(o);
5978
+ const s = e.subscribe((r) => {
5979
+ n(r);
5902
5980
  });
5903
5981
  return () => {
5904
- i.unsubscribe();
5982
+ s.unsubscribe();
5905
5983
  };
5906
- }, [e]);
5907
- const s = t.context.currentStep ?? "";
5908
- return {
5984
+ }, [e]), {
5909
5985
  checkoutActor: e,
5910
- currentStep: s
5986
+ currentStep: t.context.currentStep
5911
5987
  };
5912
- }, vi = async (e = {
5988
+ }, Ii = async (e = {
5913
5989
  inspect: void 0,
5914
5990
  currentStep: "",
5915
5991
  steps: [],
@@ -5918,14 +5994,14 @@ const Yr = (e, t, n, s) => {
5918
5994
  graphql: {}
5919
5995
  }) => typeof window < "u" ? (console.warn(
5920
5996
  "App.getInitialProps::getAuth should not be run on the frontend. You are probably missing getServerSideProps in your page."
5921
- ), j(Lt, {
5997
+ ), j(Ut, {
5922
5998
  inspect: e.inspect,
5923
5999
  input: {
5924
6000
  initialContext: {
5925
6001
  endpoints: e.endpoints
5926
6002
  }
5927
6003
  }
5928
- }).start()) : j(Lt, {
6004
+ }).start()) : j(Ut, {
5929
6005
  input: {
5930
6006
  initialContext: {
5931
6007
  currentStep: e.currentStep,
@@ -5939,11 +6015,11 @@ const Yr = (e, t, n, s) => {
5939
6015
  },
5940
6016
  inspect: e.inspect
5941
6017
  }).start();
5942
- function Ti({ actor: e, children: t }) {
5943
- return /* @__PURE__ */ xe(vn.Provider, { value: e, children: t });
6018
+ function Ai({ actor: e, children: t }) {
6019
+ return /* @__PURE__ */ be(vn.Provider, { value: e, children: t });
5944
6020
  }
5945
- let Kr = (e = 21) => crypto.getRandomValues(new Uint8Array(e)).reduce((t, n) => (n &= 63, n < 36 ? t += n.toString(36) : n < 62 ? t += (n - 26).toString(36).toUpperCase() : n > 62 ? t += "-" : t += "_", t), "");
5946
- const Zr = he({
6021
+ let ti = (e = 21) => crypto.getRandomValues(new Uint8Array(e)).reduce((t, n) => (n &= 63, n < 36 ? t += n.toString(36) : n < 62 ? t += (n - 26).toString(36).toUpperCase() : n > 62 ? t += "-" : t += "_", t), "");
6022
+ const ni = he({
5947
6023
  actors: {
5948
6024
  tick: Is(
5949
6025
  ({ sendBack: e, input: t }) => {
@@ -6010,7 +6086,7 @@ const Zr = he({
6010
6086
  ],
6011
6087
  on: {
6012
6088
  TICK: {
6013
- actions: b(({ context: e, event: t }) => t.type !== "TICK" ? e : {
6089
+ actions: x(({ context: e, event: t }) => t.type !== "TICK" ? e : {
6014
6090
  elapsed: e.elapsed + e.interval
6015
6091
  })
6016
6092
  },
@@ -6021,9 +6097,9 @@ const Zr = he({
6021
6097
  type: "final"
6022
6098
  }
6023
6099
  }
6024
- }), _i = he({
6100
+ }), wi = he({
6025
6101
  actors: {
6026
- timer: Zr
6102
+ timer: ni
6027
6103
  },
6028
6104
  types: {
6029
6105
  context: {},
@@ -6031,10 +6107,10 @@ const Zr = he({
6031
6107
  input: {}
6032
6108
  },
6033
6109
  actions: {
6034
- addItem: b(({ context: e, event: t }) => {
6110
+ addItem: x(({ context: e, event: t }) => {
6035
6111
  if (t.type !== "ADD_ITEM")
6036
6112
  return e;
6037
- const n = `notification-${Kr()}`, s = t.duration ?? e.duration, r = In(t.item, {
6113
+ const n = `notification-${ti()}`, s = t.duration ?? e.duration, r = In(t.item, {
6038
6114
  duration: s,
6039
6115
  id: n,
6040
6116
  key: t.item.key ?? n,
@@ -6049,7 +6125,7 @@ const Zr = he({
6049
6125
  activeItem: n
6050
6126
  };
6051
6127
  }),
6052
- removeItem: b(({ context: e, event: t }) => {
6128
+ removeItem: x(({ context: e, event: t }) => {
6053
6129
  if (t.type !== "REMOVE_ITEM" && t.type !== "xstate.done.actor.timer")
6054
6130
  return e;
6055
6131
  const n = e.items;
@@ -6114,10 +6190,10 @@ const Zr = he({
6114
6190
  target: "idle"
6115
6191
  },
6116
6192
  RESUME_TIMER: {
6117
- actions: bt("timer", { type: "RESUME_TIMER" })
6193
+ actions: Ct("timer", { type: "RESUME_TIMER" })
6118
6194
  },
6119
6195
  PAUSE_TIMER: {
6120
- actions: bt("timer", { type: "PAUSE_TIMER" })
6196
+ actions: Ct("timer", { type: "PAUSE_TIMER" })
6121
6197
  }
6122
6198
  }
6123
6199
  },
@@ -6144,14 +6220,14 @@ const Zr = he({
6144
6220
  }
6145
6221
  }
6146
6222
  }
6147
- }), Tn = be(
6223
+ }), Tn = Ce(
6148
6224
  {}
6149
- ), Si = () => {
6150
- const e = Ne(Tn);
6225
+ ), xi = () => {
6226
+ const e = Oe(Tn);
6151
6227
  if (!e || !e.getSnapshot)
6152
6228
  throw new Error("toastActor is not properly initialized");
6153
- const [t, n] = Oe(() => e.getSnapshot());
6154
- return Ce(() => {
6229
+ const [t, n] = Ne(() => e.getSnapshot());
6230
+ return ke(() => {
6155
6231
  if (!e || !e.getSnapshot) {
6156
6232
  console.error("toastActor is not properly initialized");
6157
6233
  return;
@@ -6167,10 +6243,10 @@ const Zr = he({
6167
6243
  };
6168
6244
  }, [e]), { toastActor: e };
6169
6245
  };
6170
- function Ii({ children: e, actor: t }) {
6171
- return /* @__PURE__ */ xe(Tn.Provider, { value: t, children: e });
6246
+ function bi({ children: e, actor: t }) {
6247
+ return /* @__PURE__ */ be(Tn.Provider, { value: t, children: e });
6172
6248
  }
6173
- function ei({
6249
+ function si({
6174
6250
  context: e,
6175
6251
  event: t
6176
6252
  }) {
@@ -6182,7 +6258,7 @@ function ei({
6182
6258
  itemsAdded: n.output.itemsAdded
6183
6259
  };
6184
6260
  }
6185
- function ti({
6261
+ function ri({
6186
6262
  event: e
6187
6263
  }) {
6188
6264
  if (!e.type.includes("xstate.done.actor"))
@@ -6193,7 +6269,7 @@ function ti({
6193
6269
  itemsAdded: t.output.itemsAdded
6194
6270
  };
6195
6271
  }
6196
- function ni({
6272
+ function ii({
6197
6273
  event: e
6198
6274
  }) {
6199
6275
  if (!e.type.includes("xstate.done.actor"))
@@ -6204,7 +6280,7 @@ function ni({
6204
6280
  itemsRemoved: t.output.itemsRemoved
6205
6281
  };
6206
6282
  }
6207
- function si({
6283
+ function oi({
6208
6284
  event: e
6209
6285
  }) {
6210
6286
  if (!e.type.includes("xstate.done.actor"))
@@ -6221,7 +6297,7 @@ function si({
6221
6297
  itemsUpdated: t.output.itemsUpdated
6222
6298
  };
6223
6299
  }
6224
- function ri({
6300
+ function ai({
6225
6301
  context: e,
6226
6302
  event: t
6227
6303
  }) {
@@ -6233,7 +6309,7 @@ function ri({
6233
6309
  itemsRemoved: n.output.itemsRemoved
6234
6310
  };
6235
6311
  }
6236
- function ii({
6312
+ function ci({
6237
6313
  context: e,
6238
6314
  event: t
6239
6315
  }) {
@@ -6244,7 +6320,51 @@ function ii({
6244
6320
  quote: { ...e.quote, ...n.output.quote }
6245
6321
  };
6246
6322
  }
6247
- function oi({
6323
+ function ui({
6324
+ context: e,
6325
+ event: t
6326
+ }) {
6327
+ const n = t;
6328
+ if (n.type !== "RESET")
6329
+ return e;
6330
+ const { locale: s } = n.data;
6331
+ return {
6332
+ quote: {
6333
+ id: "",
6334
+ locale: s,
6335
+ baseCurrency: "USD",
6336
+ currencyConversionRate: 1,
6337
+ dateCreated: null,
6338
+ dateLastUpdated: null,
6339
+ currency: "USD",
6340
+ items: [],
6341
+ promotions: [],
6342
+ shippingAddresses: {
6343
+ available: [],
6344
+ applied: []
6345
+ },
6346
+ paymentMethods: {
6347
+ available: [],
6348
+ applied: []
6349
+ },
6350
+ totals: {
6351
+ discount: 0,
6352
+ taxAmount: 0,
6353
+ shippingAmount: 0,
6354
+ shippingTaxAmount: 0,
6355
+ subtotal: 0,
6356
+ grandTotal: 0
6357
+ },
6358
+ appliedPriceRules: [],
6359
+ appliedPromotions: [],
6360
+ shippingMethods: [],
6361
+ storeCredit: [],
6362
+ rewards: [],
6363
+ giftCards: []
6364
+ }
6365
+ };
6366
+ }
6367
+ function di({
6248
6368
  context: e,
6249
6369
  event: t
6250
6370
  }) {
@@ -6256,7 +6376,7 @@ function oi({
6256
6376
  itemsUpdated: n.output.itemsUpdated
6257
6377
  };
6258
6378
  }
6259
- const ai = V(
6379
+ const li = $(
6260
6380
  async ({ input: e }) => {
6261
6381
  var t;
6262
6382
  if (!e.endpoint || e.endpoint === "")
@@ -6268,7 +6388,7 @@ const ai = V(
6268
6388
  if (!e.requestHeaders)
6269
6389
  throw new Error("No request headers provided.");
6270
6390
  try {
6271
- const n = await qe(
6391
+ const n = await fe(
6272
6392
  e.endpoint,
6273
6393
  e.document,
6274
6394
  { items: e.items },
@@ -6285,14 +6405,14 @@ const ai = V(
6285
6405
  throw new Error("Request to add item(s) failed.");
6286
6406
  }
6287
6407
  }
6288
- ), ci = V(async ({ input: e }) => {
6408
+ ), hi = $(async ({ input: e }) => {
6289
6409
  var t;
6290
6410
  if (!e.endpoint || e.endpoint === "")
6291
6411
  throw new Error("No endpoint provided.");
6292
6412
  if (e.items.length < 1)
6293
6413
  throw new Error("No items provided.");
6294
6414
  try {
6295
- const n = await qe(
6415
+ const n = await fe(
6296
6416
  e.endpoint,
6297
6417
  ""
6298
6418
  // input.document,
@@ -6309,7 +6429,7 @@ const ai = V(
6309
6429
  } catch {
6310
6430
  throw new Error("Request to remove item(s) failed.");
6311
6431
  }
6312
- }), He = typeof window > "u", ui = V(
6432
+ }), He = typeof window > "u", fi = $(
6313
6433
  async ({ input: e }) => {
6314
6434
  var n, s, r, i;
6315
6435
  if (!e.endpoint)
@@ -6351,7 +6471,7 @@ const ai = V(
6351
6471
  throw console.log("refresh error", o), new Error("Request to add item(s) failed.");
6352
6472
  }
6353
6473
  }
6354
- ), di = V(async ({ input: e }) => {
6474
+ ), pi = $(async ({ input: e }) => {
6355
6475
  var t;
6356
6476
  if (!e.endpoint || e.endpoint === "")
6357
6477
  throw new Error("No endpoint provided.");
@@ -6362,7 +6482,7 @@ const ai = V(
6362
6482
  if (!e.requestHeaders)
6363
6483
  throw new Error("No request headers provided.");
6364
6484
  try {
6365
- const n = await qe(
6485
+ const n = await fe(
6366
6486
  e.endpoint,
6367
6487
  e.document,
6368
6488
  { items: e.items },
@@ -6378,7 +6498,7 @@ const ai = V(
6378
6498
  } catch {
6379
6499
  throw new Error("Request to add item(s) failed.");
6380
6500
  }
6381
- }), li = ({ context: e }) => typeof window > "u" && e.quote.id !== "" || typeof window < "u", hi = ({ context: e }) => !!e.quote.items && e.quote.items.length > 0, Ut = he({
6501
+ }), yi = ({ context: e }) => typeof window > "u" && e.quote.id !== "" || typeof window < "u", mi = ({ context: e }) => !!e.quote.items && e.quote.items.length > 0, Pt = he({
6382
6502
  types: {
6383
6503
  context: {},
6384
6504
  emitted: {},
@@ -6386,30 +6506,31 @@ const ai = V(
6386
6506
  input: {}
6387
6507
  },
6388
6508
  actions: {
6389
- addItems: b(ei),
6390
- notifyAddItems: Fe(ti),
6391
- notifyRemoveItems: Fe(ni),
6392
- notifyUpdateItems: Fe(si),
6393
- removeItems: b(ri),
6394
- refresh: b(ii),
6395
- updateItems: b(oi)
6509
+ addItems: x(si),
6510
+ notifyAddItems: Fe(ri),
6511
+ notifyRemoveItems: Fe(ii),
6512
+ notifyUpdateItems: Fe(oi),
6513
+ removeItems: x(ai),
6514
+ refresh: x(ci),
6515
+ reset: x(ui),
6516
+ updateItems: x(di)
6396
6517
  },
6397
6518
  actors: {
6398
- addItems: ai,
6399
- removeItems: ci,
6400
- refresh: ui,
6401
- updateItems: di
6519
+ addItems: li,
6520
+ removeItems: hi,
6521
+ refresh: fi,
6522
+ updateItems: pi
6402
6523
  },
6403
6524
  guards: {
6404
- canRefresh: li,
6405
- hasItems: hi
6525
+ canRefresh: yi,
6526
+ hasItems: mi
6406
6527
  }
6407
6528
  }).createMachine({
6408
6529
  /** @todo do we need to add the view to the id? (e.g. quote_en-us) */
6409
6530
  id: "quote",
6410
6531
  initial: "initializing",
6411
6532
  context: ({ input: e }) => {
6412
- var t, n, s, r, i, o, a, c, u, h, d, f, m, y, v, I, w, R, k, q, P, H, z, L, fe, pe;
6533
+ var t, n, s, r, i, o, a, c, u, h, d, f, m, y, v, _, w, R, k, q, P, H, z, L, pe, ye;
6413
6534
  return {
6414
6535
  quote: {
6415
6536
  id: "",
@@ -6480,12 +6601,12 @@ const ai = V(
6480
6601
  requestHeaders: ((y = (m = (f = e == null ? void 0 : e.initialContext) == null ? void 0 : f.graphql) == null ? void 0 : m.addItems) == null ? void 0 : y.requestHeaders) ?? void 0
6481
6602
  },
6482
6603
  removeItems: {
6483
- document: ((w = (I = (v = e == null ? void 0 : e.initialContext) == null ? void 0 : v.graphql) == null ? void 0 : I.removeItems) == null ? void 0 : w.document) ?? "",
6604
+ document: ((w = (_ = (v = e == null ? void 0 : e.initialContext) == null ? void 0 : v.graphql) == null ? void 0 : _.removeItems) == null ? void 0 : w.document) ?? "",
6484
6605
  requestHeaders: ((q = (k = (R = e == null ? void 0 : e.initialContext) == null ? void 0 : R.graphql) == null ? void 0 : k.removeItems) == null ? void 0 : q.requestHeaders) ?? void 0
6485
6606
  },
6486
6607
  updateItems: {
6487
6608
  document: ((z = (H = (P = e == null ? void 0 : e.initialContext) == null ? void 0 : P.graphql) == null ? void 0 : H.updateItems) == null ? void 0 : z.document) ?? "",
6488
- requestHeaders: ((pe = (fe = (L = e == null ? void 0 : e.initialContext) == null ? void 0 : L.graphql) == null ? void 0 : fe.updateItems) == null ? void 0 : pe.requestHeaders) ?? void 0
6609
+ requestHeaders: ((ye = (pe = (L = e == null ? void 0 : e.initialContext) == null ? void 0 : L.graphql) == null ? void 0 : pe.updateItems) == null ? void 0 : ye.requestHeaders) ?? void 0
6489
6610
  }
6490
6611
  }
6491
6612
  };
@@ -6516,7 +6637,8 @@ const ai = V(
6516
6637
  ADD_ITEMS: "addingItems",
6517
6638
  REMOVE_ITEMS: "removingItems",
6518
6639
  REFRESH: "refreshing",
6519
- UPDATE_ITEMS: "updatingItems"
6640
+ UPDATE_ITEMS: "updatingItems",
6641
+ RESET: "resetting"
6520
6642
  // CLEAR_ITEMS: 'clearing',
6521
6643
  // APPLY_PROMOTION: 'applyingPromotion',
6522
6644
  // REMOVE_PROMOTION: 'removingPromotion',
@@ -6694,6 +6816,17 @@ const ai = V(
6694
6816
  }
6695
6817
  ]
6696
6818
  }
6819
+ },
6820
+ /**
6821
+ * Reset quote to empty state, usually after order is placed
6822
+ */
6823
+ resetting: {
6824
+ always: [
6825
+ {
6826
+ actions: ["reset"],
6827
+ target: "uninitialized"
6828
+ }
6829
+ ]
6697
6830
  }
6698
6831
  // invoke: {
6699
6832
  // /** @todo is there any way to limit the event to be a known event? */
@@ -6755,15 +6888,15 @@ const ai = V(
6755
6888
  // removingGiftCard: {},
6756
6889
  // applyingSettings: {},
6757
6890
  }
6758
- }), _n = be(
6891
+ }), Sn = Ce(
6759
6892
  {}
6760
- ), Ai = () => {
6893
+ ), Ci = () => {
6761
6894
  var c;
6762
- const e = Ne(_n);
6895
+ const e = Oe(Sn);
6763
6896
  if (!e || !e.getSnapshot)
6764
6897
  throw new Error("quoteActor is not properly initialized");
6765
- const [t, n] = Oe(() => e.getSnapshot());
6766
- Ce(() => {
6898
+ const [t, n] = Ne(() => e.getSnapshot());
6899
+ ke(() => {
6767
6900
  if (!e || !e.getSnapshot) {
6768
6901
  console.error("quoteActor is not properly initialized");
6769
6902
  return;
@@ -6787,21 +6920,21 @@ const ai = V(
6787
6920
  isRemovingItems: o,
6788
6921
  isUpdatingItems: a
6789
6922
  };
6790
- }, wi = async (e = {
6923
+ }, Oi = async (e = {
6791
6924
  inspect: void 0,
6792
6925
  quote: { id: "", locale: "" },
6793
6926
  endpoints: { client: "", server: "" },
6794
6927
  graphql: {}
6795
6928
  }) => typeof window < "u" ? (console.warn(
6796
6929
  "App.getInitialProps::getAuth should not be run on the frontend. You are probably missing getServerSideProps in your page."
6797
- ), j(Ut, {
6930
+ ), j(Pt, {
6798
6931
  inspect: e.inspect,
6799
6932
  input: {
6800
6933
  initialContext: {
6801
6934
  endpoints: e.endpoints
6802
6935
  }
6803
6936
  }
6804
- }).start()) : j(Ut, {
6937
+ }).start()) : j(Pt, {
6805
6938
  input: {
6806
6939
  initialContext: {
6807
6940
  endpoints: e.endpoints,
@@ -6814,28 +6947,28 @@ const ai = V(
6814
6947
  },
6815
6948
  inspect: e.inspect
6816
6949
  }).start();
6817
- function xi({ actor: e, children: t }) {
6818
- return /* @__PURE__ */ xe(_n.Provider, { value: e, children: t });
6950
+ function Ni({ actor: e, children: t }) {
6951
+ return /* @__PURE__ */ be(Sn.Provider, { value: e, children: t });
6819
6952
  }
6820
6953
  export {
6821
6954
  on as AuthContext,
6822
- gi as AuthProvider,
6955
+ Si as AuthProvider,
6823
6956
  vn as CheckoutContext,
6824
- Ti as CheckoutProvider,
6825
- _n as QuoteContext,
6826
- xi as QuoteProvider,
6957
+ Ai as CheckoutProvider,
6958
+ Sn as QuoteContext,
6959
+ Ni as QuoteProvider,
6827
6960
  Tn as ToastContext,
6828
- Ii as ToastProvider,
6961
+ bi as ToastProvider,
6829
6962
  zs as authMachine,
6830
- Lt as checkoutMachine,
6831
- mi as getAuth,
6832
- vi as getCheckout,
6833
- wi as getQuote,
6834
- Ut as quoteMachine,
6835
- Zr as timerMachine,
6836
- _i as toastMachine,
6837
- yi as useAuth,
6838
- Ei as useCheckout,
6839
- Ai as useQuote,
6840
- Si as useToast
6963
+ Ut as checkoutMachine,
6964
+ Ti as getAuth,
6965
+ Ii as getCheckout,
6966
+ Oi as getQuote,
6967
+ Pt as quoteMachine,
6968
+ ni as timerMachine,
6969
+ wi as toastMachine,
6970
+ vi as useAuth,
6971
+ _i as useCheckout,
6972
+ Ci as useQuote,
6973
+ xi as useToast
6841
6974
  };