@clicktap/state 0.14.6 → 0.14.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.js +17 -17
  2. package/index.mjs +501 -497
  3. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx as xe } from "react/jsx-runtime";
2
- import { createContext as be, useContext as Ne, useState as Ce, useEffect as Oe, cloneElement as An } from "react";
3
- function wn(e, t) {
2
+ import { createContext as be, useContext as Ne, useState as Oe, useEffect as Ce, cloneElement as In } from "react";
3
+ function An(e, t) {
4
4
  for (var n = 0; n < t.length; n++) {
5
5
  const s = t[n];
6
6
  if (typeof s != "string" && !Array.isArray(s)) {
@@ -16,7 +16,7 @@ function wn(e, t) {
16
16
  }
17
17
  return Object.freeze(Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }));
18
18
  }
19
- function xn() {
19
+ function wn() {
20
20
  if (typeof globalThis < "u")
21
21
  return globalThis;
22
22
  if (typeof self < "u")
@@ -26,15 +26,15 @@ function xn() {
26
26
  if (typeof global < "u")
27
27
  return global;
28
28
  }
29
- function bn() {
30
- const e = xn();
29
+ function xn() {
30
+ const e = wn();
31
31
  if (e.__xstate__)
32
32
  return e.__xstate__;
33
33
  }
34
- const Nn = (e) => {
34
+ const bn = (e) => {
35
35
  if (typeof window > "u")
36
36
  return;
37
- const t = bn();
37
+ const t = xn();
38
38
  t && t.register(e);
39
39
  };
40
40
  class ft {
@@ -66,8 +66,8 @@ class ft {
66
66
  this._last = null;
67
67
  }
68
68
  }
69
- const Ft = ".", Cn = "", Bt = "", On = "#", kn = "*", jt = "xstate.init", Dn = "xstate.error", ue = "xstate.stop";
70
- function Rn(e, t) {
69
+ const Pt = ".", Nn = "", Ft = "", On = "#", Cn = "*", Bt = "xstate.init", kn = "xstate.error", ue = "xstate.stop";
70
+ function Dn(e, t) {
71
71
  return {
72
72
  type: `xstate.after.${e}.${t}`
73
73
  };
@@ -78,35 +78,35 @@ function ze(e, t) {
78
78
  output: t
79
79
  };
80
80
  }
81
- function qn(e, t) {
81
+ function Rn(e, t) {
82
82
  return {
83
83
  type: `xstate.done.actor.${e}`,
84
84
  output: t
85
85
  };
86
86
  }
87
- function $t(e, t) {
87
+ function jt(e, t) {
88
88
  return {
89
89
  type: `xstate.error.actor.${e}`,
90
90
  error: t
91
91
  };
92
92
  }
93
- function Vt(e) {
93
+ function $t(e) {
94
94
  return {
95
- type: jt,
95
+ type: Bt,
96
96
  input: e
97
97
  };
98
98
  }
99
- function B(e) {
99
+ function F(e) {
100
100
  setTimeout(() => {
101
101
  throw e;
102
102
  });
103
103
  }
104
- const Mn = (() => typeof Symbol == "function" && Symbol.observable || "@@observable")();
104
+ const qn = (() => typeof Symbol == "function" && Symbol.observable || "@@observable")();
105
105
  function pt(e, t) {
106
106
  return `${e.sessionId}.${t}`;
107
107
  }
108
- let Ln = 0;
109
- function Pn(e, t) {
108
+ let Mn = 0;
109
+ function Ln(e, t) {
110
110
  const n = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new WeakMap(), i = /* @__PURE__ */ new Set(), o = {}, {
111
111
  clock: a,
112
112
  logger: c
@@ -151,7 +151,7 @@ function Pn(e, t) {
151
151
  _snapshot: {
152
152
  _scheduledEvents: ((t == null ? void 0 : t.snapshot) && t.snapshot.scheduler) ?? {}
153
153
  },
154
- _bookId: () => `x:${Ln++}`,
154
+ _bookId: () => `x:${Mn++}`,
155
155
  _register: (f, m) => (n.set(f, m), f),
156
156
  _unregister: (f) => {
157
157
  n.delete(f.sessionId);
@@ -202,12 +202,12 @@ function Pn(e, t) {
202
202
  };
203
203
  return d;
204
204
  }
205
- function Ht(e, t) {
205
+ function Vt(e, t) {
206
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 ? Ht(n[r], s[r]) : !1);
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);
208
208
  }
209
209
  function et(e) {
210
- if (Gt(e))
210
+ if (zt(e))
211
211
  return e;
212
212
  let t = [], n = "";
213
213
  for (let s = 0; s < e.length; s++) {
@@ -224,7 +224,7 @@ function et(e) {
224
224
  return t.push(n), t;
225
225
  }
226
226
  function yt(e) {
227
- if (ps(e))
227
+ if (fs(e))
228
228
  return e.value;
229
229
  if (typeof e != "string")
230
230
  return e;
@@ -253,11 +253,11 @@ function mt(e, t) {
253
253
  }
254
254
  return n;
255
255
  }
256
- function zt(e) {
257
- return Gt(e) ? e : [e];
256
+ function Ht(e) {
257
+ return zt(e) ? e : [e];
258
258
  }
259
- function j(e) {
260
- return e === void 0 ? [] : zt(e);
259
+ function B(e) {
260
+ return e === void 0 ? [] : Ht(e);
261
261
  }
262
262
  function Ge(e, t, n, s) {
263
263
  return typeof e == "function" ? e({
@@ -266,20 +266,20 @@ function Ge(e, t, n, s) {
266
266
  self: s
267
267
  }) : e;
268
268
  }
269
- function Gt(e) {
269
+ function zt(e) {
270
270
  return Array.isArray(e);
271
271
  }
272
- function Fn(e) {
272
+ function Pn(e) {
273
273
  return e.type.startsWith("xstate.error.actor");
274
274
  }
275
275
  function K(e) {
276
- return zt(e).map((t) => typeof t > "u" || typeof t == "string" ? {
276
+ return Ht(e).map((t) => typeof t > "u" || typeof t == "string" ? {
277
277
  target: t
278
278
  } : t);
279
279
  }
280
- function Jt(e) {
281
- if (!(e === void 0 || e === Cn))
282
- return j(e);
280
+ function Gt(e) {
281
+ if (!(e === void 0 || e === Nn))
282
+ return B(e);
283
283
  }
284
284
  function gt(e, t, n) {
285
285
  var i, o, a;
@@ -304,7 +304,7 @@ const nt = 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
  }({});
307
- const Bn = {
307
+ const Fn = {
308
308
  clock: {
309
309
  setTimeout: (e, t) => setTimeout(e, t),
310
310
  clearTimeout: (e) => clearTimeout(e)
@@ -312,7 +312,7 @@ const Bn = {
312
312
  logger: console.log.bind(console),
313
313
  devTools: !1
314
314
  };
315
- class jn {
315
+ class Bn {
316
316
  /**
317
317
  * Creates a new actor instance for the given logic with the provided options, if any.
318
318
  *
@@ -322,7 +322,7 @@ class jn {
322
322
  constructor(t, n) {
323
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 = [];
324
324
  const s = {
325
- ...Bn,
325
+ ...Fn,
326
326
  ...n
327
327
  }, {
328
328
  clock: r,
@@ -333,7 +333,7 @@ class jn {
333
333
  systemId: u,
334
334
  inspect: h
335
335
  } = s;
336
- this.system = o ? o.system : Pn(this, {
336
+ this.system = o ? o.system : Ln(this, {
337
337
  clock: r,
338
338
  logger: i
339
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 = {
@@ -393,7 +393,7 @@ class jn {
393
393
  try {
394
394
  (r = o.next) == null || r.call(o, t);
395
395
  } catch (a) {
396
- B(a);
396
+ F(a);
397
397
  }
398
398
  break;
399
399
  case "done":
@@ -401,9 +401,9 @@ class jn {
401
401
  try {
402
402
  (i = o.next) == null || i.call(o, t);
403
403
  } catch (a) {
404
- B(a);
404
+ F(a);
405
405
  }
406
- this._stopProcedure(), this._complete(), this._doneEvent = qn(this.id, this._snapshot.output), this._parent && this.system._relay(this, this._parent, this._doneEvent);
406
+ this._stopProcedure(), this._complete(), this._doneEvent = Rn(this.id, this._snapshot.output), this._parent && this.system._relay(this, this._parent, this._doneEvent);
407
407
  break;
408
408
  case "error":
409
409
  this._error(this._snapshot.error);
@@ -475,18 +475,18 @@ class jn {
475
475
  try {
476
476
  (i = r.complete) == null || i.call(r);
477
477
  } catch (o) {
478
- B(o);
478
+ F(o);
479
479
  }
480
480
  break;
481
481
  case "error": {
482
482
  const o = this._snapshot.error;
483
483
  if (!r.error)
484
- B(o);
484
+ F(o);
485
485
  else
486
486
  try {
487
487
  r.error(o);
488
488
  } catch (a) {
489
- B(a);
489
+ F(a);
490
490
  }
491
491
  break;
492
492
  }
@@ -523,7 +523,7 @@ class jn {
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 = Vt(this.options.input);
526
+ const t = $t(this.options.input);
527
527
  switch (this.system._sendInspectionEvent({
528
528
  type: "@xstate.event",
529
529
  sourceRef: this._parent,
@@ -588,13 +588,13 @@ class jn {
588
588
  try {
589
589
  (t = n.complete) == null || t.call(n);
590
590
  } catch (s) {
591
- B(s);
591
+ F(s);
592
592
  }
593
593
  this.observers.clear();
594
594
  }
595
595
  _reportError(t) {
596
596
  if (!this.observers.size) {
597
- this._parent || B(t);
597
+ this._parent || F(t);
598
598
  return;
599
599
  }
600
600
  let n = !1;
@@ -604,13 +604,13 @@ class jn {
604
604
  try {
605
605
  r == null || r(t);
606
606
  } catch (i) {
607
- B(i);
607
+ F(i);
608
608
  }
609
609
  }
610
- this.observers.clear(), n && B(t);
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, $t(this.id, t));
613
+ this._stopProcedure(), this._reportError(t), this._parent && this.system._relay(this, this._parent, jt(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
@@ -638,7 +638,7 @@ class jn {
638
638
  const {
639
639
  devTools: t
640
640
  } = this.options;
641
- t && (typeof t == "function" ? t : Nn)(this);
641
+ t && (typeof t == "function" ? t : bn)(this);
642
642
  }
643
643
  toJSON() {
644
644
  return {
@@ -661,7 +661,7 @@ class jn {
661
661
  getPersistedSnapshot(t) {
662
662
  return this.logic.getPersistedSnapshot(this._snapshot, t);
663
663
  }
664
- [Mn]() {
664
+ [qn]() {
665
665
  return this;
666
666
  }
667
667
  /**
@@ -682,26 +682,26 @@ class jn {
682
682
  return this._snapshot;
683
683
  }
684
684
  }
685
- function U(e, ...[t]) {
686
- return new jn(e, t);
685
+ function j(e, ...[t]) {
686
+ return new Bn(e, t);
687
687
  }
688
- function $n(e, t, n, s, {
688
+ function jn(e, t, n, s, {
689
689
  sendId: r
690
690
  }) {
691
691
  const i = typeof r == "function" ? r(n, s) : r;
692
692
  return [t, i];
693
693
  }
694
- function Vn(e, t) {
694
+ function $n(e, t) {
695
695
  e.defer(() => {
696
696
  e.system.scheduler.cancel(e.self, t);
697
697
  });
698
698
  }
699
- function Hn(e) {
699
+ function Vn(e) {
700
700
  function t(n, s) {
701
701
  }
702
- return t.type = "xstate.cancel", t.sendId = e, t.resolve = $n, t.execute = Vn, t;
702
+ return t.type = "xstate.cancel", t.sendId = e, t.resolve = jn, t.execute = $n, t;
703
703
  }
704
- function zn(e, t, n, s, {
704
+ function Hn(e, t, n, s, {
705
705
  id: r,
706
706
  systemId: i,
707
707
  src: o,
@@ -710,7 +710,7 @@ function zn(e, t, n, s, {
710
710
  }) {
711
711
  const u = typeof o == "string" ? tt(t.machine, o) : o, h = typeof r == "function" ? r(n) : r;
712
712
  let d;
713
- return u && (d = U(u, {
713
+ return u && (d = j(u, {
714
714
  id: h,
715
715
  src: o,
716
716
  parent: e.self,
@@ -731,7 +731,7 @@ function zn(e, t, n, s, {
731
731
  actorRef: d
732
732
  }];
733
733
  }
734
- function Gn(e, {
734
+ function zn(e, {
735
735
  id: t,
736
736
  actorRef: n
737
737
  }) {
@@ -739,7 +739,7 @@ function Gn(e, {
739
739
  n._processingStatus !== D.Stopped && n.start();
740
740
  });
741
741
  }
742
- function Jn(...[e, {
742
+ function Gn(...[e, {
743
743
  id: t,
744
744
  systemId: n,
745
745
  input: s,
@@ -747,9 +747,9 @@ function Jn(...[e, {
747
747
  } = {}]) {
748
748
  function i(o, a) {
749
749
  }
750
- return i.type = "snapshot.spawnChild", i.id = t, i.systemId = n, i.src = e, i.input = s, i.syncSnapshot = r, i.resolve = zn, i.execute = Gn, i;
750
+ return i.type = "snapshot.spawnChild", i.id = t, i.systemId = n, i.src = e, i.input = s, i.syncSnapshot = r, i.resolve = Hn, i.execute = zn, i;
751
751
  }
752
- function Yn(e, t, n, s, {
752
+ function Jn(e, t, n, s, {
753
753
  actorRef: r
754
754
  }) {
755
755
  const i = typeof r == "function" ? r(n, s) : r, o = typeof i == "string" ? t.children[i] : i;
@@ -760,7 +760,7 @@ function Yn(e, t, n, s, {
760
760
  children: a
761
761
  }), o];
762
762
  }
763
- function Qn(e, t) {
763
+ function Yn(e, t) {
764
764
  if (t) {
765
765
  if (e.system._unregister(t), t._processingStatus !== D.Running) {
766
766
  e.stopChild(t);
@@ -771,10 +771,10 @@ function Qn(e, t) {
771
771
  });
772
772
  }
773
773
  }
774
- function Yt(e) {
774
+ function Jt(e) {
775
775
  function t(n, s) {
776
776
  }
777
- return t.type = "xstate.stopChild", t.actorRef = e, t.resolve = Yn, t.execute = Qn, t;
777
+ return t.type = "xstate.stopChild", t.actorRef = e, t.resolve = Jn, t.execute = Yn, t;
778
778
  }
779
779
  function st(e, t, n, s) {
780
780
  const {
@@ -812,7 +812,7 @@ function le(e, t) {
812
812
  return n;
813
813
  }
814
814
  function Se(e) {
815
- const t = new Set(e), n = Xt(t);
815
+ const t = new Set(e), n = Qt(t);
816
816
  for (const s of t)
817
817
  if (s.type === "compound" && (!n.get(s) || !n.get(s).length))
818
818
  vt(s).forEach((r) => t.add(r));
@@ -831,7 +831,7 @@ function Se(e) {
831
831
  }
832
832
  return t;
833
833
  }
834
- function Qt(e, t) {
834
+ function Yt(e, t) {
835
835
  const n = t.get(e);
836
836
  if (!n)
837
837
  return {};
@@ -845,26 +845,26 @@ function Qt(e, t) {
845
845
  }
846
846
  const s = {};
847
847
  for (const r of n)
848
- s[r.key] = Qt(r, t);
848
+ s[r.key] = Yt(r, t);
849
849
  return s;
850
850
  }
851
- function Xt(e) {
851
+ function Qt(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 Wt(e, t) {
857
+ function Xt(e, t) {
858
858
  const n = Se(t);
859
- return Qt(e, Xt(n));
859
+ return Yt(e, Qt(n));
860
860
  }
861
861
  function it(e, t) {
862
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";
863
863
  }
864
864
  const ke = (e) => e[0] === On;
865
- function Xn(e, t) {
865
+ function Qn(e, t) {
866
866
  return e.transitions.get(t) || [...e.transitions.keys()].filter((s) => {
867
- if (s === kn)
867
+ if (s === Cn)
868
868
  return !0;
869
869
  if (!s.endsWith(".*"))
870
870
  return !1;
@@ -879,22 +879,22 @@ function Xn(e, t) {
879
879
  return !0;
880
880
  }).sort((s, r) => r.length - s.length).flatMap((s) => e.transitions.get(s));
881
881
  }
882
- function Wn(e) {
882
+ function Xn(e) {
883
883
  const t = e.config.after;
884
884
  if (!t)
885
885
  return [];
886
886
  const n = (r, i) => {
887
- const o = Rn(r, e.id), a = o.type;
888
- return e.entry.push(Is(o, {
887
+ const o = Dn(r, e.id), a = o.type;
888
+ return e.entry.push(Ss(o, {
889
889
  id: a,
890
890
  delay: r
891
- })), e.exit.push(Hn(a)), a;
891
+ })), e.exit.push(Vn(a)), a;
892
892
  };
893
893
  return Object.keys(t).flatMap((r, i) => {
894
894
  const o = t[r], a = typeof o == "string" ? {
895
895
  target: o
896
896
  } : o, c = Number.isNaN(+r) ? r : +r, u = n(c);
897
- return j(a).map((h) => ({
897
+ return B(a).map((h) => ({
898
898
  ...h,
899
899
  event: u,
900
900
  delay: c
@@ -910,9 +910,9 @@ function Wn(e) {
910
910
  });
911
911
  }
912
912
  function G(e, t, n) {
913
- const s = Jt(n.target), r = n.reenter ?? !1, i = es(e, s), o = {
913
+ const s = Gt(n.target), r = n.reenter ?? !1, i = Zn(e, s), o = {
914
914
  ...n,
915
- actions: j(n.actions),
915
+ actions: B(n.actions),
916
916
  guard: n.guard,
917
917
  target: i,
918
918
  source: e,
@@ -926,11 +926,11 @@ function G(e, t, n) {
926
926
  };
927
927
  return o;
928
928
  }
929
- function Kn(e) {
929
+ 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 === Bt)
933
+ if (n === Ft)
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)));
@@ -959,13 +959,13 @@ function Kn(e) {
959
959
  }
960
960
  return t;
961
961
  }
962
- function Zn(e, t) {
962
+ function Kn(e, t) {
963
963
  const n = typeof t == "string" ? e.states[t] : t ? e.states[t.target] : void 0;
964
964
  if (!n && t)
965
965
  throw new Error(`Initial state node "${t}" not found on parent state node #${e.id}`);
966
966
  const s = {
967
967
  source: e,
968
- actions: !t || typeof t == "string" ? [] : j(t.actions),
968
+ actions: !t || typeof t == "string" ? [] : B(t.actions),
969
969
  eventType: null,
970
970
  reenter: !1,
971
971
  target: n ? [n] : [],
@@ -977,14 +977,14 @@ function Zn(e, t) {
977
977
  };
978
978
  return s;
979
979
  }
980
- function es(e, t) {
980
+ function Zn(e, t) {
981
981
  if (t !== void 0)
982
982
  return t.map((n) => {
983
983
  if (typeof n != "string")
984
984
  return n;
985
985
  if (ke(n))
986
986
  return e.machine.getStateNodeById(n);
987
- const s = n[0] === Ft;
987
+ const s = n[0] === Pt;
988
988
  if (s && !e.parent)
989
989
  return Ie(e, n.slice(1));
990
990
  const r = s ? e.key + n : n;
@@ -999,8 +999,8 @@ ${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 Kt(e) {
1003
- const t = Jt(e.config.target);
1002
+ function Wt(e) {
1003
+ const t = Gt(e.config.target);
1004
1004
  return t ? {
1005
1005
  target: t.map((n) => typeof n == "string" ? Ie(e.parent, n) : n)
1006
1006
  } : e.parent.initial;
@@ -1009,13 +1009,13 @@ function J(e) {
1009
1009
  return e.type === "history";
1010
1010
  }
1011
1011
  function vt(e) {
1012
- const t = Zt(e);
1012
+ const t = Kt(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 Zt(e) {
1018
+ function Kt(e) {
1019
1019
  const t = /* @__PURE__ */ new Set();
1020
1020
  function n(s) {
1021
1021
  if (!t.has(s)) {
@@ -1070,15 +1070,15 @@ function Ae(e, t) {
1070
1070
  return r.concat(a);
1071
1071
  }, []));
1072
1072
  }
1073
- function ts(e, t, n, s) {
1073
+ function es(e, t, n, s) {
1074
1074
  const i = ne(e, t).next(n, s);
1075
1075
  return !i || !i.length ? e.next(n, s) : i;
1076
1076
  }
1077
- function ns(e, t, n, s) {
1077
+ function ts(e, t, n, s) {
1078
1078
  const r = Object.keys(t), i = ne(e, r[0]), o = ot(i, t[r[0]], n, s);
1079
1079
  return !o || !o.length ? e.next(n, s) : o;
1080
1080
  }
1081
- function ss(e, t, n, s) {
1081
+ function ns(e, t, n, s) {
1082
1082
  const r = [];
1083
1083
  for (const i of Object.keys(t)) {
1084
1084
  const o = t[i];
@@ -1090,9 +1090,9 @@ function ss(e, t, n, s) {
1090
1090
  return r.length ? r : e.next(n, s);
1091
1091
  }
1092
1092
  function ot(e, t, n, s) {
1093
- return typeof t == "string" ? ts(e, t, n, s) : Object.keys(t).length === 1 ? ns(e, t, n, s) : ss(e, t, n, s);
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
- function rs(e) {
1095
+ function ss(e) {
1096
1096
  return Object.keys(e.states).map((t) => e.states[t]).filter((t) => t.type === "history");
1097
1097
  }
1098
1098
  function $(e, t) {
@@ -1101,7 +1101,7 @@ function $(e, t) {
1101
1101
  n = n.parent;
1102
1102
  return n.parent === t;
1103
1103
  }
1104
- function is(e, t) {
1104
+ function rs(e, t) {
1105
1105
  const n = new Set(e), s = new Set(t);
1106
1106
  for (const r of n)
1107
1107
  if (s.has(r))
@@ -1111,13 +1111,13 @@ function is(e, t) {
1111
1111
  return !0;
1112
1112
  return !1;
1113
1113
  }
1114
- function en(e, t, n) {
1114
+ function Zt(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
- if (is(Je([r], t, n), Je([a], t, n)))
1120
+ if (rs(Je([r], t, n), Je([a], t, n)))
1121
1121
  if ($(r.source, a.source))
1122
1122
  o.add(a);
1123
1123
  else {
@@ -1132,7 +1132,7 @@ function en(e, t, n) {
1132
1132
  }
1133
1133
  return Array.from(s);
1134
1134
  }
1135
- function os(e) {
1135
+ function is(e) {
1136
1136
  const [t, ...n] = e;
1137
1137
  for (const s of le(t, void 0))
1138
1138
  if (n.every((r) => $(r, s)))
@@ -1148,19 +1148,19 @@ 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(Kt(s), t))
1151
+ for (const r of at(Wt(s), t))
1152
1152
  n.add(r);
1153
1153
  else
1154
1154
  n.add(s);
1155
1155
  return [...n];
1156
1156
  }
1157
- function tn(e, t) {
1157
+ function en(e, t) {
1158
1158
  const n = at(e, t);
1159
1159
  if (!n)
1160
1160
  return;
1161
1161
  if (!e.reenter && n.every((r) => r === e.source || $(r, e.source)))
1162
1162
  return e.source;
1163
- const s = os(n.concat(e.source));
1163
+ const s = is(n.concat(e.source));
1164
1164
  if (s)
1165
1165
  return s;
1166
1166
  if (!e.reenter)
@@ -1171,14 +1171,14 @@ 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 = tn(i, n);
1174
+ const o = en(i, n);
1175
1175
  i.reenter && i.source === o && s.add(o);
1176
1176
  for (const a of t)
1177
1177
  $(a, o) && s.add(a);
1178
1178
  }
1179
1179
  return [...s];
1180
1180
  }
1181
- function as(e, t) {
1181
+ function os(e, t) {
1182
1182
  if (e.length !== t.size)
1183
1183
  return !1;
1184
1184
  for (const n of e)
@@ -1191,13 +1191,13 @@ 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 = en(e, o, a);
1194
+ const c = Zt(e, o, a);
1195
1195
  let u = t;
1196
- r || ([u, a] = ls(u, s, n, c, o, a, i)), u = se(u, s, n, c.flatMap((d) => d.actions), i), u = us(u, s, n, c, o, i, a, r);
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];
1198
1198
  u.status === "done" && (u = se(u, s, n, h.sort((d, f) => f.order - d.order).flatMap((d) => d.exit), i));
1199
1199
  try {
1200
- return a === t.historyValue && as(t._nodes, o) ? u : Y(u, {
1200
+ return a === t.historyValue && os(t._nodes, o) ? u : Y(u, {
1201
1201
  _nodes: h,
1202
1202
  historyValue: a
1203
1203
  });
@@ -1205,23 +1205,23 @@ function Ye(e, t, n, s, r, i) {
1205
1205
  throw d;
1206
1206
  }
1207
1207
  }
1208
- function cs(e, t, n, s, r) {
1208
+ function as(e, t, n, s, r) {
1209
1209
  if (s.output === void 0)
1210
1210
  return;
1211
1211
  const i = ze(r.id, r.output !== void 0 && r.parent ? Ge(r.output, e.context, t, n.self) : void 0);
1212
1212
  return Ge(s.output, e.context, i, n.self);
1213
1213
  }
1214
- function us(e, t, n, s, r, i, o, a) {
1214
+ function cs(e, t, n, s, r, i, o, a) {
1215
1215
  let c = e;
1216
1216
  const u = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set();
1217
- ds(s, o, h, u), a && h.add(e.machine.root);
1217
+ us(s, o, h, u), a && h.add(e.machine.root);
1218
1218
  const d = /* @__PURE__ */ new Set();
1219
1219
  for (const f of [...u].sort((m, y) => m.order - y.order)) {
1220
1220
  r.add(f);
1221
1221
  const m = [];
1222
1222
  m.push(...f.entry);
1223
1223
  for (const y of f.invoke)
1224
- m.push(Jn(y.src, {
1224
+ m.push(Gn(y.src, {
1225
1225
  ...y,
1226
1226
  syncSnapshot: !!y.onSnapshot
1227
1227
  }));
@@ -1238,15 +1238,15 @@ function us(e, t, n, s, r, i, o, a) {
1238
1238
  continue;
1239
1239
  c = Y(c, {
1240
1240
  status: "done",
1241
- output: cs(c, t, n, c.machine.root, I)
1241
+ output: as(c, t, n, c.machine.root, I)
1242
1242
  });
1243
1243
  }
1244
1244
  }
1245
1245
  return c;
1246
1246
  }
1247
- function ds(e, t, n, s) {
1247
+ function us(e, t, n, s) {
1248
1248
  for (const r of e) {
1249
- const i = tn(r, t);
1249
+ const i = en(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
@@ -1256,7 +1256,7 @@ function ds(e, t, n, s) {
1256
1256
  const o = at(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), nn(s, t, n, c, !r.source.parent && r.reenter ? void 0 : 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);
1260
1260
  }
1261
1261
  }
1262
1262
  }
@@ -1268,48 +1268,48 @@ function Z(e, t, n, s) {
1268
1268
  for (const o of i)
1269
1269
  s.add(o), Z(o, t, n, s);
1270
1270
  for (const o of i)
1271
- Pe(o, e.parent, s, t, n);
1271
+ Ue(o, e.parent, s, t, n);
1272
1272
  } else {
1273
- const i = Kt(e);
1273
+ const i = Wt(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)
1277
- Pe(o, e.parent, s, t, n);
1277
+ Ue(o, e.parent, s, t, n);
1278
1278
  }
1279
1279
  else if (e.type === "compound") {
1280
1280
  const [i] = e.initial.target;
1281
- J(i) || (s.add(i), n.add(i)), Z(i, t, n, s), Pe(i, e, s, t, n);
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
1284
  [...s].some((o) => $(o, i)) || (J(i) || (s.add(i), n.add(i)), Z(i, t, n, s));
1285
1285
  }
1286
- function nn(e, t, n, s, r) {
1286
+ function tn(e, t, n, s, r) {
1287
1287
  for (const i of s)
1288
1288
  if ((!r || $(i, r)) && e.add(i), i.type === "parallel")
1289
1289
  for (const o of te(i).filter((a) => !J(a)))
1290
1290
  [...e].some((a) => $(a, o)) || (e.add(o), Z(o, t, n, e));
1291
1291
  }
1292
- function Pe(e, t, n, s, r) {
1293
- nn(n, s, r, le(e, t));
1292
+ function Ue(e, t, n, s, r) {
1293
+ tn(n, s, r, le(e, t));
1294
1294
  }
1295
- function ls(e, t, n, s, r, i, o) {
1295
+ function ds(e, t, n, s, r, i, o) {
1296
1296
  let a = e;
1297
1297
  const c = Je(s, r, i);
1298
1298
  c.sort((h, d) => d.order - h.order);
1299
1299
  let u;
1300
1300
  for (const h of c)
1301
- for (const d of rs(h)) {
1301
+ for (const d of ss(h)) {
1302
1302
  let f;
1303
1303
  d.history === "deep" ? f = (m) => rt(m) && $(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) => Yt(d.id))], o), r.delete(h);
1308
+ a = se(a, t, n, [...h.exit, ...h.invoke.map((d) => Jt(d.id))], o), r.delete(h);
1309
1309
  return [a, u || i];
1310
1310
  }
1311
1311
  let Tt = !1;
1312
- function sn(e, t, n, s, r, i) {
1312
+ function nn(e, t, n, s, r, i) {
1313
1313
  const {
1314
1314
  machine: o
1315
1315
  } = e;
@@ -1362,12 +1362,12 @@ function sn(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 = sn(a, t, n, w, r, i));
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));
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 = sn(e, t, n, s, {
1370
+ const o = i ? [] : void 0, a = nn(e, t, n, s, {
1371
1371
  internalQueue: r,
1372
1372
  deferredActorIds: i
1373
1373
  }, o);
@@ -1375,7 +1375,7 @@ function se(e, t, n, s, r, i) {
1375
1375
  c.retryResolve(n, a, u);
1376
1376
  }), a;
1377
1377
  }
1378
- function Ue(e, t, n, s = []) {
1378
+ function Pe(e, t, n, s = []) {
1379
1379
  let r = e;
1380
1380
  const i = [];
1381
1381
  function o(u, h, d) {
@@ -1395,8 +1395,8 @@ function Ue(e, t, n, s = []) {
1395
1395
  microstates: i
1396
1396
  };
1397
1397
  let a = t;
1398
- if (a.type !== jt) {
1399
- const u = a, h = Fn(u), d = St(u, r);
1398
+ if (a.type !== Bt) {
1399
+ const u = a, h = Pn(u), d = St(u, r);
1400
1400
  if (h && !d.length)
1401
1401
  return r = Y(e, {
1402
1402
  status: "error",
@@ -1417,7 +1417,7 @@ function Ue(e, t, n, s = []) {
1417
1417
  }
1418
1418
  let c = !0;
1419
1419
  for (; r.status === "active"; ) {
1420
- let u = c ? hs(r, a) : [];
1420
+ let u = c ? ls(r, a) : [];
1421
1421
  const h = u.length ? r : void 0;
1422
1422
  if (!u.length) {
1423
1423
  if (!s.length)
@@ -1432,12 +1432,12 @@ function Ue(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) => Yt(s)), []);
1435
+ return se(e, t, n, Object.values(e.children).map((s) => Jt(s)), []);
1436
1436
  }
1437
1437
  function St(e, t) {
1438
1438
  return t.machine.getTransitionData(t, e);
1439
1439
  }
1440
- function hs(e, t) {
1440
+ function ls(e, t) {
1441
1441
  const n = /* @__PURE__ */ new Set(), s = e._nodes.filter(rt);
1442
1442
  for (const r of s)
1443
1443
  e:
@@ -1449,24 +1449,24 @@ function hs(e, t) {
1449
1449
  break e;
1450
1450
  }
1451
1451
  }
1452
- return en(Array.from(n), new Set(e._nodes), e.historyValue);
1452
+ return Zt(Array.from(n), new Set(e._nodes), e.historyValue);
1453
1453
  }
1454
- function fs(e, t) {
1454
+ function hs(e, t) {
1455
1455
  const n = Se(Ae(e, t));
1456
- return Wt(e, [...n]);
1456
+ return Xt(e, [...n]);
1457
1457
  }
1458
- function ps(e) {
1458
+ function fs(e) {
1459
1459
  return !!e && typeof e == "object" && "machine" in e && "value" in e;
1460
1460
  }
1461
- const ys = function(t) {
1462
- return Ht(t, this.value);
1463
- }, ms = function(t) {
1461
+ const ps = function(t) {
1462
+ return Vt(t, this.value);
1463
+ }, ys = function(t) {
1464
1464
  return this.tags.has(t);
1465
- }, gs = function(t) {
1465
+ }, ms = function(t) {
1466
1466
  const n = this.machine.getTransitionData(this, t);
1467
1467
  return !!(n != null && n.length) && // Check that at least one transition is not forbidden
1468
1468
  n.some((s) => s.target !== void 0 || s.actions.length);
1469
- }, Es = function() {
1469
+ }, gs = function() {
1470
1470
  const {
1471
1471
  _nodes: t,
1472
1472
  tags: n,
@@ -1482,7 +1482,7 @@ const ys = function(t) {
1482
1482
  ...u,
1483
1483
  tags: Array.from(n)
1484
1484
  };
1485
- }, vs = function() {
1485
+ }, Es = function() {
1486
1486
  return this._nodes.reduce((t, n) => (n.meta !== void 0 && (t[n.id] = n.meta), t), {});
1487
1487
  };
1488
1488
  function Ee(e, t) {
@@ -1493,15 +1493,15 @@ function Ee(e, t) {
1493
1493
  machine: t,
1494
1494
  context: e.context,
1495
1495
  _nodes: e._nodes,
1496
- value: Wt(t.root, e._nodes),
1496
+ value: Xt(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 || {},
1500
- matches: ys,
1501
- hasTag: ms,
1502
- can: gs,
1503
- getMeta: vs,
1504
- toJSON: Es
1500
+ matches: ps,
1501
+ hasTag: ys,
1502
+ can: ms,
1503
+ getMeta: Es,
1504
+ toJSON: gs
1505
1505
  };
1506
1506
  }
1507
1507
  function Y(e, t = {}) {
@@ -1510,7 +1510,7 @@ function Y(e, t = {}) {
1510
1510
  ...t
1511
1511
  }, e.machine);
1512
1512
  }
1513
- function Ts(e, t) {
1513
+ function vs(e, t) {
1514
1514
  const {
1515
1515
  _nodes: n,
1516
1516
  tags: s,
@@ -1535,11 +1535,11 @@ function Ts(e, t) {
1535
1535
  }
1536
1536
  return {
1537
1537
  ...f,
1538
- context: rn(o),
1538
+ context: sn(o),
1539
1539
  children: m
1540
1540
  };
1541
1541
  }
1542
- function rn(e) {
1542
+ function sn(e) {
1543
1543
  let t;
1544
1544
  for (const n in e) {
1545
1545
  const s = e[n];
@@ -1552,7 +1552,7 @@ function rn(e) {
1552
1552
  id: s.id
1553
1553
  };
1554
1554
  else {
1555
- const r = rn(s);
1555
+ const r = sn(s);
1556
1556
  r !== s && (t ?? (t = Array.isArray(e) ? e.slice() : {
1557
1557
  ...e
1558
1558
  }), t[n] = r);
@@ -1560,7 +1560,7 @@ function rn(e) {
1560
1560
  }
1561
1561
  return t ?? e;
1562
1562
  }
1563
- function _s(e, t, n, s, {
1563
+ function Ts(e, t, n, s, {
1564
1564
  event: r,
1565
1565
  id: i,
1566
1566
  delay: o
@@ -1583,7 +1583,7 @@ function _s(e, t, n, s, {
1583
1583
  delay: h
1584
1584
  }];
1585
1585
  }
1586
- function Ss(e, t) {
1586
+ function _s(e, t) {
1587
1587
  const {
1588
1588
  event: n,
1589
1589
  delay: s,
@@ -1597,13 +1597,13 @@ function Ss(e, t) {
1597
1597
  return;
1598
1598
  }
1599
1599
  }
1600
- function Is(e, t) {
1600
+ function Ss(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 = _s, n.execute = Ss, 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 = _s, n;
1604
1604
  }
1605
1605
  const It = /* @__PURE__ */ new WeakMap();
1606
- function As(e) {
1606
+ function Is(e) {
1607
1607
  return {
1608
1608
  config: e,
1609
1609
  start: (n, s) => {
@@ -1714,7 +1714,7 @@ function V(e) {
1714
1714
  restoreSnapshot: (n) => n
1715
1715
  };
1716
1716
  }
1717
- function ws(e, {
1717
+ function As(e, {
1718
1718
  machine: t,
1719
1719
  context: n
1720
1720
  }, s, r) {
@@ -1727,7 +1727,7 @@ function ws(e, {
1727
1727
  const h = tt(t, o);
1728
1728
  if (!h)
1729
1729
  throw new Error(`Actor logic '${o}' not implemented in machine '${t.id}'`);
1730
- const d = U(h, {
1730
+ const d = j(h, {
1731
1731
  id: a.id,
1732
1732
  parent: e.self,
1733
1733
  syncSnapshot: a.syncSnapshot,
@@ -1741,7 +1741,7 @@ function ws(e, {
1741
1741
  });
1742
1742
  return r[d.id] = d, d;
1743
1743
  } else
1744
- return U(o, {
1744
+ return j(o, {
1745
1745
  id: a.id,
1746
1746
  parent: e.self,
1747
1747
  syncSnapshot: a.syncSnapshot,
@@ -1757,7 +1757,7 @@ function ws(e, {
1757
1757
  }), c;
1758
1758
  };
1759
1759
  }
1760
- function xs(e, t, n, s, {
1760
+ function ws(e, t, n, s, {
1761
1761
  assignment: r
1762
1762
  }) {
1763
1763
  if (!t.context)
@@ -1765,7 +1765,7 @@ function xs(e, t, n, s, {
1765
1765
  const i = {}, o = {
1766
1766
  context: t.context,
1767
1767
  event: n.event,
1768
- spawn: ws(e, t, n.event, i),
1768
+ spawn: As(e, t, n.event, i),
1769
1769
  self: e.self,
1770
1770
  system: e.system
1771
1771
  };
@@ -1789,9 +1789,9 @@ function xs(e, t, n, s, {
1789
1789
  function b(e) {
1790
1790
  function t(n, s) {
1791
1791
  }
1792
- return t.type = "xstate.assign", t.assignment = e, t.resolve = xs, t;
1792
+ return t.type = "xstate.assign", t.assignment = e, t.resolve = ws, t;
1793
1793
  }
1794
- function bs(e, t, n, s, {
1794
+ function xs(e, t, n, s, {
1795
1795
  event: r
1796
1796
  }) {
1797
1797
  const i = typeof r == "function" ? r(n, s) : r;
@@ -1799,7 +1799,7 @@ function bs(e, t, n, s, {
1799
1799
  event: i
1800
1800
  }];
1801
1801
  }
1802
- function Ns(e, {
1802
+ function bs(e, {
1803
1803
  event: t
1804
1804
  }) {
1805
1805
  e.defer(() => e.emit(t));
@@ -1807,12 +1807,12 @@ function Ns(e, {
1807
1807
  function Fe(e) {
1808
1808
  function t(n, s) {
1809
1809
  }
1810
- return t.type = "xstate.emit", t.event = e, t.resolve = bs, t.execute = Ns, t;
1810
+ return t.type = "xstate.emit", t.event = e, t.resolve = xs, t.execute = bs, t;
1811
1811
  }
1812
1812
  let xt = /* @__PURE__ */ function(e) {
1813
1813
  return e.Parent = "#_parent", e.Internal = "#_internal", e;
1814
1814
  }({});
1815
- function Cs(e, t, n, s, {
1815
+ function Ns(e, t, n, s, {
1816
1816
  to: r,
1817
1817
  event: i,
1818
1818
  id: o,
@@ -1846,7 +1846,7 @@ function Cs(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 ks(e, t) {
1849
+ function Cs(e, t) {
1850
1850
  e.defer(() => {
1851
1851
  const {
1852
1852
  to: n,
@@ -1863,14 +1863,14 @@ function ks(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 === Dn ? $t(e.self.id, s.data) : s
1866
+ s.type === kn ? jt(e.self.id, s.data) : s
1867
1867
  );
1868
1868
  });
1869
1869
  }
1870
1870
  function bt(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 = Cs, s.retryResolve = Os, s.execute = ks, 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 = Ns, s.retryResolve = Os, s.execute = Cs, s;
1874
1874
  }
1875
1875
  const Nt = /* @__PURE__ */ new WeakMap();
1876
1876
  function X(e, t, n) {
@@ -1879,7 +1879,7 @@ function X(e, t, n) {
1879
1879
  [t]: n()
1880
1880
  }, Nt.set(e, s)), s[t];
1881
1881
  }
1882
- const Ds = {}, oe = (e) => typeof e == "string" ? {
1882
+ const ks = {}, oe = (e) => typeof e == "string" ? {
1883
1883
  type: e
1884
1884
  } : typeof e == "function" ? "resolve" in e ? {
1885
1885
  type: e.type
@@ -1888,17 +1888,17 @@ const Ds = {}, oe = (e) => typeof e == "string" ? {
1888
1888
  } : e;
1889
1889
  class ct {
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(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 ? 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(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, {
1892
1892
  _parent: this,
1893
1893
  _key: r,
1894
1894
  _machine: this.machine
1895
- })) : Ds, this.type === "compound" && !this.config.initial)
1895
+ })) : ks, this.type === "compound" && !this.config.initial)
1896
1896
  throw new Error(`No initial state specified for compound state node "#${this.id}". Try adding { initial: "${Object.keys(this.states)[0]}" } to the state config.`);
1897
- this.history = this.config.history === !0 ? "shallow" : this.config.history || !1, this.entry = j(this.config.entry).slice(), this.exit = j(this.config.exit).slice(), this.meta = this.config.meta, this.output = this.type === "final" || !this.parent ? this.config.output : void 0, this.tags = j(t.tags).slice();
1897
+ this.history = this.config.history === !0 ? "shallow" : this.config.history || !1, this.entry = B(this.config.entry).slice(), this.exit = B(this.config.exit).slice(), this.meta = this.config.meta, this.output = this.type === "final" || !this.parent ? this.config.output : void 0, this.tags = B(t.tags).slice();
1898
1898
  }
1899
1899
  /** @internal */
1900
1900
  _initialize() {
1901
- this.transitions = Kn(this), this.config.always && (this.always = K(this.config.always).map((t) => G(this, Bt, 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, Ft, t))), Object.keys(this.states).forEach((t) => {
1902
1902
  this.states[t]._initialize();
1903
1903
  });
1904
1904
  }
@@ -1949,7 +1949,7 @@ class ct {
1949
1949
  * The logic invoked as actors by this state node.
1950
1950
  */
1951
1951
  get invoke() {
1952
- return X(this, "invoke", () => j(this.config.invoke).map((t, n) => {
1952
+ return X(this, "invoke", () => B(this.config.invoke).map((t, n) => {
1953
1953
  const {
1954
1954
  src: s,
1955
1955
  systemId: r
@@ -1982,16 +1982,16 @@ class ct {
1982
1982
  return X(this, "on", () => [...this.transitions].flatMap(([n, s]) => s.map((r) => [n, r])).reduce((n, [s, r]) => (n[s] = n[s] || [], n[s].push(r), n), {}));
1983
1983
  }
1984
1984
  get after() {
1985
- return X(this, "delayedTransitions", () => Wn(this));
1985
+ return X(this, "delayedTransitions", () => Xn(this));
1986
1986
  }
1987
1987
  get initial() {
1988
- return X(this, "initial", () => Zn(this, this.config.initial));
1988
+ return X(this, "initial", () => Kn(this, this.config.initial));
1989
1989
  }
1990
1990
  /** @internal */
1991
1991
  next(t, n) {
1992
1992
  const s = n.type, r = [];
1993
1993
  let i;
1994
- const o = X(this, `candidates-${s}`, () => Xn(this, s));
1994
+ const o = X(this, `candidates-${s}`, () => Qn(this, s));
1995
1995
  for (const a of o) {
1996
1996
  const {
1997
1997
  guard: c
@@ -2039,7 +2039,7 @@ ${d.message}`);
2039
2039
  return Array.from(t);
2040
2040
  }
2041
2041
  }
2042
- const Rs = "#";
2042
+ const Ds = "#";
2043
2043
  class ut {
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 = {
@@ -2088,7 +2088,7 @@ class ut {
2088
2088
  });
2089
2089
  }
2090
2090
  resolveState(t) {
2091
- const n = fs(this.root, t.value), s = Se(Ae(this.root, n));
2091
+ const n = hs(this.root, t.value), s = Se(Ae(this.root, n));
2092
2092
  return Ee({
2093
2093
  _nodes: [...s],
2094
2094
  context: t.context || {},
@@ -2107,7 +2107,7 @@ class ut {
2107
2107
  * @param event The received event
2108
2108
  */
2109
2109
  transition(t, n, s) {
2110
- return Ue(t, n, s).snapshot;
2110
+ return Pe(t, n, s).snapshot;
2111
2111
  }
2112
2112
  /**
2113
2113
  * Determines the next state given the current `state` and `event`.
@@ -2117,7 +2117,7 @@ class ut {
2117
2117
  * @param event The received event
2118
2118
  */
2119
2119
  microstep(t, n, s) {
2120
- return Ue(t, n, s).microstates;
2120
+ return Pe(t, n, s).microstates;
2121
2121
  }
2122
2122
  getTransitionData(t, n) {
2123
2123
  return ot(this.root, t.value, t, n) || [];
@@ -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 = Vt(n), r = [], i = this.getPreInitialState(t, s, r), o = Ye([{
2153
- target: [...Zt(this.root)],
2152
+ const s = $t(n), r = [], i = this.getPreInitialState(t, s, r), o = Ye([{
2153
+ target: [...Kt(this.root)],
2154
2154
  source: this.root,
2155
2155
  reenter: !0,
2156
2156
  actions: [],
@@ -2159,7 +2159,7 @@ class ut {
2159
2159
  // TODO: fix
2160
2160
  }], i, t, s, !0, r), {
2161
2161
  snapshot: a
2162
- } = Ue(o, s, t, r);
2162
+ } = Pe(o, s, t, r);
2163
2163
  return a;
2164
2164
  }
2165
2165
  start(t) {
@@ -2168,7 +2168,7 @@ 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(Rs.length) : n[0], i = this.idMap.get(r);
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);
2172
2172
  if (!i)
2173
2173
  throw new Error(`Child state node '#${r}' does not exist on machine '${this.id}'`);
2174
2174
  return Ie(i, s);
@@ -2180,7 +2180,7 @@ class ut {
2180
2180
  return this.definition;
2181
2181
  }
2182
2182
  getPersistedSnapshot(t, n) {
2183
- return Ts(t, n);
2183
+ return vs(t, n);
2184
2184
  }
2185
2185
  restoreSnapshot(t, n) {
2186
2186
  const s = {}, r = t.children;
@@ -2188,7 +2188,7 @@ class ut {
2188
2188
  const u = r[c], h = u.snapshot, d = u.src, f = typeof d == "string" ? tt(this, d) : d;
2189
2189
  if (!f)
2190
2190
  return;
2191
- const m = U(f, {
2191
+ const m = j(f, {
2192
2192
  id: c,
2193
2193
  parent: n.self,
2194
2194
  syncSnapshot: u.syncSnapshot,
@@ -2222,7 +2222,7 @@ class ut {
2222
2222
  return a(i.context, s), i;
2223
2223
  }
2224
2224
  }
2225
- function qs(e, t) {
2225
+ function Rs(e, t) {
2226
2226
  return new ut(e, t);
2227
2227
  }
2228
2228
  function he({
@@ -2233,7 +2233,7 @@ function he({
2233
2233
  delays: r
2234
2234
  }) {
2235
2235
  return {
2236
- createMachine: (i) => qs({
2236
+ createMachine: (i) => Rs({
2237
2237
  ...i,
2238
2238
  schemas: e
2239
2239
  }, {
@@ -2244,14 +2244,14 @@ function he({
2244
2244
  })
2245
2245
  };
2246
2246
  }
2247
- function on(e, t) {
2248
- const n = j(t);
2247
+ function rn(e, t) {
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('", "')}"`;
2251
2251
  throw new Error(`Expected event ${JSON.stringify(e)} to have ${s}`);
2252
2252
  }
2253
2253
  }
2254
- function Ms({
2254
+ function qs({
2255
2255
  context: e,
2256
2256
  event: t
2257
2257
  }) {
@@ -2262,12 +2262,12 @@ function Ms({
2262
2262
  errors: [...e.errors, String(n.error).replace("Error: ", "")]
2263
2263
  };
2264
2264
  }
2265
- function Ls() {
2265
+ function Ms() {
2266
2266
  return {
2267
2267
  errors: []
2268
2268
  };
2269
2269
  }
2270
- function Ps({
2270
+ function Ls({
2271
2271
  context: e,
2272
2272
  event: t
2273
2273
  }) {
@@ -2284,7 +2284,7 @@ function Us() {
2284
2284
  ignoreRefreshToken: !0
2285
2285
  };
2286
2286
  }
2287
- function Fs({
2287
+ function Ps({
2288
2288
  context: e,
2289
2289
  event: t
2290
2290
  }) {
@@ -2296,12 +2296,12 @@ function Fs({
2296
2296
  ignoreRefreshToken: !1
2297
2297
  };
2298
2298
  }
2299
- function Bs() {
2299
+ function Fs() {
2300
2300
  return {
2301
2301
  refreshToken: ""
2302
2302
  };
2303
2303
  }
2304
- function js() {
2304
+ function Bs() {
2305
2305
  return {
2306
2306
  user: null,
2307
2307
  accessToken: "",
@@ -2316,7 +2316,7 @@ async function Qe(e, t) {
2316
2316
  success: !1
2317
2317
  });
2318
2318
  }
2319
- const $s = V(async ({ input: e }) => {
2319
+ const js = V(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.");
@@ -2347,13 +2347,13 @@ const $s = 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
- }), Vs = V(async ({ input: e }) => {
2350
+ }), $s = typeof window > "u", Vs = V(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 === "")
2354
2354
  throw console.log("refreshAccessToken: No server endpoint provided."), new Error("No server endpoint provided.");
2355
2355
  let t;
2356
- if (typeof window > "u") {
2356
+ if ($s) {
2357
2357
  if (e.refreshToken === "")
2358
2358
  throw new Error("Unauthorized.");
2359
2359
  try {
@@ -2420,23 +2420,23 @@ const $s = V(async ({ input: e }) => {
2420
2420
  } catch (t) {
2421
2421
  throw console.log(t), new Error("Could not complete unauthenticate request (server)");
2422
2422
  }
2423
- }), Ct = he({
2423
+ }), zs = he({
2424
2424
  types: {
2425
2425
  context: {},
2426
2426
  events: {},
2427
2427
  input: {}
2428
2428
  },
2429
2429
  actions: {
2430
- addError: b(Ms),
2431
- clearErrors: b(Ls),
2432
- setAccessToken: b(Ps),
2430
+ addError: b(qs),
2431
+ clearErrors: b(Ms),
2432
+ setAccessToken: b(Ls),
2433
2433
  setIgnoreRefreshToken: b(Us),
2434
- setUserContext: b(Fs),
2435
- unsetRefreshToken: b(Bs),
2436
- unsetUserContext: b(js)
2434
+ setUserContext: b(Ps),
2435
+ unsetRefreshToken: b(Fs),
2436
+ unsetUserContext: b(Bs)
2437
2437
  },
2438
2438
  actors: {
2439
- authenticate: $s,
2439
+ authenticate: js,
2440
2440
  refreshAccessToken: Vs,
2441
2441
  unauthenticate: Hs
2442
2442
  }
@@ -2468,7 +2468,7 @@ const $s = V(async ({ input: e }) => {
2468
2468
  authenticating: {
2469
2469
  invoke: {
2470
2470
  src: "authenticate",
2471
- input: ({ context: e, event: t }) => (on(t, "LOGIN"), {
2471
+ input: ({ context: e, event: t }) => (rn(t, "LOGIN"), {
2472
2472
  endpoint: {
2473
2473
  client: e.endpoints.login
2474
2474
  },
@@ -2528,10 +2528,23 @@ const $s = V(async ({ input: e }) => {
2528
2528
  target: "loggedIn"
2529
2529
  }
2530
2530
  ],
2531
+ /**
2532
+ * @todo
2533
+ * confirm this logic, does it make sense to unset refresh token
2534
+ * if the request fails for some reason on server side?
2535
+ */
2531
2536
  onError: [
2537
+ // logout can only happen on the client side, so we
2538
+ // guard the action to prevent it from happening on the server
2539
+ // and fall back to loggedOut state server-side
2532
2540
  {
2533
2541
  actions: "unsetRefreshToken",
2534
- target: "unauthenticating"
2542
+ target: "unauthenticating",
2543
+ guard: () => typeof window < "u"
2544
+ },
2545
+ {
2546
+ actions: "unsetRefreshToken",
2547
+ target: "loggedOut"
2535
2548
  }
2536
2549
  ]
2537
2550
  }
@@ -2577,13 +2590,13 @@ const $s = V(async ({ input: e }) => {
2577
2590
  // },
2578
2591
  // },
2579
2592
  }
2580
- }), an = be(
2593
+ }), on = be(
2581
2594
  {}
2582
- ), pi = () => {
2583
- const e = Ne(an), [t, n] = Ce(
2595
+ ), yi = () => {
2596
+ const e = Ne(on), [t, n] = Oe(
2584
2597
  typeof window < "u" && e.getSnapshot().value === "loggedIn"
2585
2598
  );
2586
- return Oe(() => {
2599
+ return Ce(() => {
2587
2600
  if (typeof window > "u")
2588
2601
  return;
2589
2602
  const s = e.subscribe((r) => {
@@ -2593,19 +2606,10 @@ const $s = V(async ({ input: e }) => {
2593
2606
  s.unsubscribe();
2594
2607
  };
2595
2608
  }, [e]), { authActor: e, isLoggedIn: t };
2596
- }, yi = async (e = "", t = {
2609
+ }, mi = async (e = "", t = {
2597
2610
  inspect: void 0,
2598
2611
  endpoints: { login: "", logout: "", refresh: "", ssrRefresh: "" }
2599
- }) => typeof window < "u" ? (console.warn(
2600
- "App.getInitialProps::getAuth should not be run on the frontend. You are probably missing getServerSideProps in your page."
2601
- ), U(Ct, {
2602
- inspect: t.inspect,
2603
- input: {
2604
- initialContext: {
2605
- endpoints: t.endpoints
2606
- }
2607
- }
2608
- }).start()) : U(Ct, {
2612
+ }) => j(zs, {
2609
2613
  input: {
2610
2614
  initialContext: {
2611
2615
  endpoints: t.endpoints,
@@ -2614,10 +2618,10 @@ const $s = V(async ({ input: e }) => {
2614
2618
  },
2615
2619
  inspect: t.inspect
2616
2620
  }).start();
2617
- function mi({ actor: e, children: t }) {
2618
- return /* @__PURE__ */ xe(an.Provider, { value: e, children: t });
2621
+ function gi({ actor: e, children: t }) {
2622
+ return /* @__PURE__ */ xe(on.Provider, { value: e, children: t });
2619
2623
  }
2620
- function zs({
2624
+ function Gs({
2621
2625
  context: e,
2622
2626
  event: t
2623
2627
  }) {
@@ -2630,7 +2634,7 @@ function zs({
2630
2634
  currentStep: n.code ?? e.currentStep
2631
2635
  });
2632
2636
  }
2633
- function Gs({
2637
+ function Js({
2634
2638
  context: e,
2635
2639
  event: t
2636
2640
  }) {
@@ -2644,7 +2648,7 @@ function Gs({
2644
2648
  currentStep: s ?? e.currentStep
2645
2649
  } : e;
2646
2650
  }
2647
- function Js({
2651
+ function Ys({
2648
2652
  context: e,
2649
2653
  event: t
2650
2654
  }) {
@@ -2655,26 +2659,26 @@ function Js({
2655
2659
  quote: { ...e.quote, ...n.output.quote }
2656
2660
  };
2657
2661
  }
2658
- const dt = JSON, Ys = (e) => e.toUpperCase(), Qs = (e) => {
2662
+ const dt = JSON, Qs = (e) => e.toUpperCase(), Xs = (e) => {
2659
2663
  const t = {};
2660
2664
  return e.forEach((n, s) => {
2661
2665
  t[s] = n;
2662
2666
  }), t;
2663
- }, Xs = (e, t, n) => e.document ? e : {
2667
+ }, Ws = (e, t, n) => e.document ? e : {
2664
2668
  document: e,
2665
2669
  variables: t,
2666
2670
  requestHeaders: n,
2667
2671
  signal: void 0
2668
- }, Ws = (e, t, n) => e.query ? e : {
2672
+ }, Ks = (e, t, n) => e.query ? e : {
2669
2673
  query: e,
2670
2674
  variables: t,
2671
2675
  requestHeaders: n,
2672
2676
  signal: void 0
2673
- }, Ks = (e, t) => e.documents ? e : {
2677
+ }, Zs = (e, t) => e.documents ? e : {
2674
2678
  documents: e,
2675
2679
  requestHeaders: t,
2676
2680
  signal: void 0
2677
- }, Zs = (e, t, ...n) => {
2681
+ }, er = (e, t, ...n) => {
2678
2682
  const [s, r] = n;
2679
2683
  return e.document ? e : {
2680
2684
  url: e,
@@ -2688,20 +2692,20 @@ function ve(e, t) {
2688
2692
  if (!!!e)
2689
2693
  throw new Error(t);
2690
2694
  }
2691
- function er(e) {
2695
+ function tr(e) {
2692
2696
  return typeof e == "object" && e !== null;
2693
2697
  }
2694
- function tr(e, t) {
2698
+ function nr(e, t) {
2695
2699
  if (!!!e)
2696
2700
  throw new Error(
2697
2701
  t ?? "Unexpected invariant triggered."
2698
2702
  );
2699
2703
  }
2700
- const nr = /\r\n|[\n\r]/g;
2704
+ const sr = /\r\n|[\n\r]/g;
2701
2705
  function Xe(e, t) {
2702
2706
  let n = 0, s = 1;
2703
- for (const r of e.body.matchAll(nr)) {
2704
- if (typeof r.index == "number" || tr(!1), r.index >= t)
2707
+ for (const r of e.body.matchAll(sr)) {
2708
+ if (typeof r.index == "number" || nr(!1), r.index >= t)
2705
2709
  break;
2706
2710
  n = r.index + r[0].length, s += 1;
2707
2711
  }
@@ -2710,13 +2714,13 @@ function Xe(e, t) {
2710
2714
  column: t + 1 - n
2711
2715
  };
2712
2716
  }
2713
- function sr(e) {
2714
- return cn(
2717
+ function rr(e) {
2718
+ return an(
2715
2719
  e.source,
2716
2720
  Xe(e.source, e.start)
2717
2721
  );
2718
2722
  }
2719
- function cn(e, t) {
2723
+ function an(e, t) {
2720
2724
  const n = e.locationOffset.column - 1, s = "".padStart(n) + e.body, r = t.line - 1, i = e.locationOffset.line - 1, o = t.line + i, a = t.line === 1 ? n : 0, c = t.column + a, u = `${e.name}:${o}:${c}
2721
2725
  `, h = s.split(/\r\n|[\n\r]/g), d = h[r];
2722
2726
  if (d.length > 120) {
@@ -2743,7 +2747,7 @@ function Ot(e) {
2743
2747
  return t.map(([s, r]) => s.padStart(n) + (r ? " " + r : "")).join(`
2744
2748
  `);
2745
2749
  }
2746
- function rr(e) {
2750
+ function ir(e) {
2747
2751
  const t = e[0];
2748
2752
  return t == null || "kind" in t || "length" in t ? {
2749
2753
  nodes: t,
@@ -2795,15 +2799,15 @@ class lt extends Error {
2795
2799
  */
2796
2800
  constructor(t, ...n) {
2797
2801
  var s, r, i;
2798
- const { nodes: o, source: a, positions: c, path: u, originalError: h, extensions: d } = rr(n);
2799
- super(t), this.name = "GraphQLError", this.path = u ?? void 0, this.originalError = h ?? void 0, this.nodes = kt(
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(
2800
2804
  Array.isArray(o) ? o : o ? [o] : void 0
2801
2805
  );
2802
- const f = kt(
2806
+ const f = Ct(
2803
2807
  (s = this.nodes) === null || s === void 0 ? void 0 : s.map((y) => y.loc).filter((y) => y != null)
2804
2808
  );
2805
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));
2806
- const m = er(
2810
+ const m = tr(
2807
2811
  h == null ? void 0 : h.extensions
2808
2812
  ) ? h == null ? void 0 : h.extensions : void 0;
2809
2813
  this.extensions = (i = d ?? m) !== null && i !== void 0 ? i : /* @__PURE__ */ Object.create(null), Object.defineProperties(this, {
@@ -2845,12 +2849,12 @@ class lt extends Error {
2845
2849
  for (const n of this.nodes)
2846
2850
  n.loc && (t += `
2847
2851
 
2848
- ` + sr(n.loc));
2852
+ ` + rr(n.loc));
2849
2853
  else if (this.source && this.locations)
2850
2854
  for (const n of this.locations)
2851
2855
  t += `
2852
2856
 
2853
- ` + cn(this.source, n);
2857
+ ` + an(this.source, n);
2854
2858
  return t;
2855
2859
  }
2856
2860
  toJSON() {
@@ -2860,7 +2864,7 @@ class lt extends Error {
2860
2864
  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;
2861
2865
  }
2862
2866
  }
2863
- function kt(e) {
2867
+ function Ct(e) {
2864
2868
  return e === void 0 || e.length === 0 ? void 0 : e;
2865
2869
  }
2866
2870
  function N(e, t, n) {
@@ -2869,7 +2873,7 @@ function N(e, t, n) {
2869
2873
  positions: [t]
2870
2874
  });
2871
2875
  }
2872
- class ir {
2876
+ class or {
2873
2877
  /**
2874
2878
  * The character offset at which this Node begins.
2875
2879
  */
@@ -2898,7 +2902,7 @@ class ir {
2898
2902
  };
2899
2903
  }
2900
2904
  }
2901
- class un {
2905
+ class cn {
2902
2906
  /**
2903
2907
  * The kind of Token.
2904
2908
  */
@@ -2940,7 +2944,7 @@ class un {
2940
2944
  };
2941
2945
  }
2942
2946
  }
2943
- const dn = {
2947
+ const un = {
2944
2948
  Name: [],
2945
2949
  Document: ["definitions"],
2946
2950
  OperationDefinition: [
@@ -3014,10 +3018,10 @@ const dn = {
3014
3018
  UnionTypeExtension: ["name", "directives", "types"],
3015
3019
  EnumTypeExtension: ["name", "directives", "values"],
3016
3020
  InputObjectTypeExtension: ["name", "directives", "fields"]
3017
- }, or = new Set(Object.keys(dn));
3018
- function Dt(e) {
3021
+ }, ar = new Set(Object.keys(un));
3022
+ function kt(e) {
3019
3023
  const t = e == null ? void 0 : e.kind;
3020
- return typeof t == "string" && or.has(t);
3024
+ return typeof t == "string" && ar.has(t);
3021
3025
  }
3022
3026
  var ee;
3023
3027
  (function(e) {
@@ -3037,22 +3041,22 @@ function Ke(e) {
3037
3041
  function de(e) {
3038
3042
  return e >= 48 && e <= 57;
3039
3043
  }
3040
- function ln(e) {
3044
+ function dn(e) {
3041
3045
  return e >= 97 && e <= 122 || // A-Z
3042
3046
  e >= 65 && e <= 90;
3043
3047
  }
3044
- function hn(e) {
3045
- return ln(e) || e === 95;
3046
- }
3047
- function ar(e) {
3048
- return ln(e) || de(e) || e === 95;
3048
+ function ln(e) {
3049
+ return dn(e) || e === 95;
3049
3050
  }
3050
3051
  function cr(e) {
3052
+ return dn(e) || de(e) || e === 95;
3053
+ }
3054
+ function ur(e) {
3051
3055
  var t;
3052
3056
  let n = Number.MAX_SAFE_INTEGER, s = null, r = -1;
3053
3057
  for (let o = 0; o < e.length; ++o) {
3054
3058
  var i;
3055
- const a = e[o], c = ur(a);
3059
+ const a = e[o], c = dr(a);
3056
3060
  c !== a.length && (s = (i = s) !== null && i !== void 0 ? i : o, r = o, o !== 0 && c < n && (n = c));
3057
3061
  }
3058
3062
  return e.map((o, a) => a === 0 ? o : o.slice(n)).slice(
@@ -3060,13 +3064,13 @@ function cr(e) {
3060
3064
  r + 1
3061
3065
  );
3062
3066
  }
3063
- function ur(e) {
3067
+ function dr(e) {
3064
3068
  let t = 0;
3065
3069
  for (; t < e.length && Ke(e.charCodeAt(t)); )
3066
3070
  ++t;
3067
3071
  return t;
3068
3072
  }
3069
- function dr(e, t) {
3073
+ function lr(e, t) {
3070
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
3071
3075
  (!r || e.length > 70 || u || i || o);
3072
3076
  let d = "";
@@ -3079,7 +3083,7 @@ var p;
3079
3083
  (function(e) {
3080
3084
  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";
3081
3085
  })(p || (p = {}));
3082
- class lr {
3086
+ class hr {
3083
3087
  /**
3084
3088
  * The previously focused non-ignored token.
3085
3089
  */
@@ -3093,7 +3097,7 @@ class lr {
3093
3097
  * The character offset at which the current line begins.
3094
3098
  */
3095
3099
  constructor(t) {
3096
- const n = new un(p.SOF, 0, 0, 0, 0);
3100
+ const n = new cn(p.SOF, 0, 0, 0, 0);
3097
3101
  this.source = t, this.lastToken = n, this.token = n, this.line = 1, this.lineStart = 0;
3098
3102
  }
3099
3103
  get [Symbol.toStringTag]() {
@@ -3116,26 +3120,26 @@ class lr {
3116
3120
  if (t.next)
3117
3121
  t = t.next;
3118
3122
  else {
3119
- const n = fr(this, t.end);
3123
+ const n = pr(this, t.end);
3120
3124
  t.next = n, n.prev = t, t = n;
3121
3125
  }
3122
3126
  while (t.kind === p.COMMENT);
3123
3127
  return t;
3124
3128
  }
3125
3129
  }
3126
- function hr(e) {
3130
+ function fr(e) {
3127
3131
  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;
3128
3132
  }
3129
3133
  function re(e) {
3130
3134
  return e >= 0 && e <= 55295 || e >= 57344 && e <= 1114111;
3131
3135
  }
3132
3136
  function De(e, t) {
3133
- return fn(e.charCodeAt(t)) && pn(e.charCodeAt(t + 1));
3137
+ return hn(e.charCodeAt(t)) && fn(e.charCodeAt(t + 1));
3134
3138
  }
3135
- function fn(e) {
3139
+ function hn(e) {
3136
3140
  return e >= 55296 && e <= 56319;
3137
3141
  }
3138
- function pn(e) {
3142
+ function fn(e) {
3139
3143
  return e >= 56320 && e <= 57343;
3140
3144
  }
3141
3145
  function Q(e, t) {
@@ -3150,9 +3154,9 @@ function Q(e, t) {
3150
3154
  }
3151
3155
  function x(e, t, n, s, r) {
3152
3156
  const i = e.line, o = 1 + n - e.lineStart;
3153
- return new un(t, n, s, i, o, r);
3157
+ return new cn(t, n, s, i, o, r);
3154
3158
  }
3155
- function fr(e, t) {
3159
+ function pr(e, t) {
3156
3160
  const n = e.source.body, s = n.length;
3157
3161
  let r = t;
3158
3162
  for (; r < s; ) {
@@ -3171,7 +3175,7 @@ function fr(e, t) {
3171
3175
  n.charCodeAt(r + 1) === 10 ? r += 2 : ++r, ++e.line, e.lineStart = r;
3172
3176
  continue;
3173
3177
  case 35:
3174
- return pr(e, r);
3178
+ return yr(e, r);
3175
3179
  case 33:
3176
3180
  return x(e, p.BANG, r, r + 1);
3177
3181
  case 36:
@@ -3203,12 +3207,12 @@ function fr(e, t) {
3203
3207
  case 125:
3204
3208
  return x(e, p.BRACE_R, r, r + 1);
3205
3209
  case 34:
3206
- return n.charCodeAt(r + 1) === 34 && n.charCodeAt(r + 2) === 34 ? Tr(e, r) : mr(e, r);
3210
+ return n.charCodeAt(r + 1) === 34 && n.charCodeAt(r + 2) === 34 ? _r(e, r) : gr(e, r);
3207
3211
  }
3208
3212
  if (de(i) || i === 45)
3209
- return yr(e, r, i);
3210
- if (hn(i))
3211
- return _r(e, r);
3213
+ return mr(e, r, i);
3214
+ if (ln(i))
3215
+ return Sr(e, r);
3212
3216
  throw N(
3213
3217
  e.source,
3214
3218
  r,
@@ -3217,7 +3221,7 @@ function fr(e, t) {
3217
3221
  }
3218
3222
  return x(e, p.EOF, s, s);
3219
3223
  }
3220
- function pr(e, t) {
3224
+ function yr(e, t) {
3221
3225
  const n = e.source.body, s = n.length;
3222
3226
  let r = t + 1;
3223
3227
  for (; r < s; ) {
@@ -3239,7 +3243,7 @@ function pr(e, t) {
3239
3243
  n.slice(t + 1, r)
3240
3244
  );
3241
3245
  }
3242
- function yr(e, t, n) {
3246
+ function mr(e, t, n) {
3243
3247
  const s = e.source.body;
3244
3248
  let r = t, i = n, o = !1;
3245
3249
  if (i === 45 && (i = s.charCodeAt(++r)), i === 48) {
@@ -3254,7 +3258,7 @@ function yr(e, t, n) {
3254
3258
  );
3255
3259
  } else
3256
3260
  r = Be(e, r, i), i = s.charCodeAt(r);
3257
- 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 || hn(i))
3261
+ 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))
3258
3262
  throw N(
3259
3263
  e.source,
3260
3264
  r,
@@ -3287,7 +3291,7 @@ function Be(e, t, n) {
3287
3291
  ++r;
3288
3292
  return r;
3289
3293
  }
3290
- function mr(e, t) {
3294
+ function gr(e, t) {
3291
3295
  const n = e.source.body, s = n.length;
3292
3296
  let r = t + 1, i = r, o = "";
3293
3297
  for (; r < s; ) {
@@ -3296,7 +3300,7 @@ function mr(e, t) {
3296
3300
  return o += n.slice(i, r), x(e, p.STRING, t, r + 1, o);
3297
3301
  if (a === 92) {
3298
3302
  o += n.slice(i, r);
3299
- const c = n.charCodeAt(r + 1) === 117 ? n.charCodeAt(r + 2) === 123 ? gr(e, r) : Er(e, r) : vr(e, r);
3303
+ const c = n.charCodeAt(r + 1) === 117 ? n.charCodeAt(r + 2) === 123 ? Er(e, r) : vr(e, r) : Tr(e, r);
3300
3304
  o += c.value, r += c.size, i = r;
3301
3305
  continue;
3302
3306
  }
@@ -3318,7 +3322,7 @@ function mr(e, t) {
3318
3322
  }
3319
3323
  throw N(e.source, r, "Unterminated string.");
3320
3324
  }
3321
- function gr(e, t) {
3325
+ function Er(e, t) {
3322
3326
  const n = e.source.body;
3323
3327
  let s = 0, r = 3;
3324
3328
  for (; r < 12; ) {
@@ -3343,16 +3347,16 @@ function gr(e, t) {
3343
3347
  )}".`
3344
3348
  );
3345
3349
  }
3346
- function Er(e, t) {
3347
- const n = e.source.body, s = Rt(n, t + 2);
3350
+ function vr(e, t) {
3351
+ const n = e.source.body, s = Dt(n, t + 2);
3348
3352
  if (re(s))
3349
3353
  return {
3350
3354
  value: String.fromCodePoint(s),
3351
3355
  size: 6
3352
3356
  };
3353
- if (fn(s) && n.charCodeAt(t + 6) === 92 && n.charCodeAt(t + 7) === 117) {
3354
- const r = Rt(n, t + 8);
3355
- if (pn(r))
3357
+ if (hn(s) && n.charCodeAt(t + 6) === 92 && n.charCodeAt(t + 7) === 117) {
3358
+ const r = Dt(n, t + 8);
3359
+ if (fn(r))
3356
3360
  return {
3357
3361
  value: String.fromCodePoint(s, r),
3358
3362
  size: 12
@@ -3364,13 +3368,13 @@ function Er(e, t) {
3364
3368
  `Invalid Unicode escape sequence: "${n.slice(t, t + 6)}".`
3365
3369
  );
3366
3370
  }
3367
- function Rt(e, t) {
3371
+ function Dt(e, t) {
3368
3372
  return ae(e.charCodeAt(t)) << 12 | ae(e.charCodeAt(t + 1)) << 8 | ae(e.charCodeAt(t + 2)) << 4 | ae(e.charCodeAt(t + 3));
3369
3373
  }
3370
3374
  function ae(e) {
3371
3375
  return e >= 48 && e <= 57 ? e - 48 : e >= 65 && e <= 70 ? e - 55 : e >= 97 && e <= 102 ? e - 87 : -1;
3372
3376
  }
3373
- function vr(e, t) {
3377
+ function Tr(e, t) {
3374
3378
  const n = e.source.body;
3375
3379
  switch (n.charCodeAt(t + 1)) {
3376
3380
  case 34:
@@ -3424,7 +3428,7 @@ function vr(e, t) {
3424
3428
  )}".`
3425
3429
  );
3426
3430
  }
3427
- function Tr(e, t) {
3431
+ function _r(e, t) {
3428
3432
  const n = e.source.body, s = n.length;
3429
3433
  let r = e.lineStart, i = t + 3, o = i, a = "";
3430
3434
  const c = [];
@@ -3438,7 +3442,7 @@ function Tr(e, t) {
3438
3442
  t,
3439
3443
  i + 3,
3440
3444
  // Return a string of the lines joined with U+000A.
3441
- cr(c).join(`
3445
+ ur(c).join(`
3442
3446
  `)
3443
3447
  );
3444
3448
  return e.line += c.length - 1, e.lineStart = r, h;
@@ -3467,12 +3471,12 @@ function Tr(e, t) {
3467
3471
  }
3468
3472
  throw N(e.source, i, "Unterminated string.");
3469
3473
  }
3470
- function _r(e, t) {
3474
+ function Sr(e, t) {
3471
3475
  const n = e.source.body, s = n.length;
3472
3476
  let r = t + 1;
3473
3477
  for (; r < s; ) {
3474
3478
  const i = n.charCodeAt(r);
3475
- if (ar(i))
3479
+ if (cr(i))
3476
3480
  ++r;
3477
3481
  else
3478
3482
  break;
@@ -3485,7 +3489,7 @@ function _r(e, t) {
3485
3489
  n.slice(t, r)
3486
3490
  );
3487
3491
  }
3488
- const Sr = 10, yn = 2;
3492
+ const Ir = 10, pn = 2;
3489
3493
  function ht(e) {
3490
3494
  return Re(e, []);
3491
3495
  }
@@ -3496,45 +3500,45 @@ function Re(e, t) {
3496
3500
  case "function":
3497
3501
  return e.name ? `[function ${e.name}]` : "[function]";
3498
3502
  case "object":
3499
- return Ir(e, t);
3503
+ return Ar(e, t);
3500
3504
  default:
3501
3505
  return String(e);
3502
3506
  }
3503
3507
  }
3504
- function Ir(e, t) {
3508
+ function Ar(e, t) {
3505
3509
  if (e === null)
3506
3510
  return "null";
3507
3511
  if (t.includes(e))
3508
3512
  return "[Circular]";
3509
3513
  const n = [...t, e];
3510
- if (Ar(e)) {
3514
+ if (wr(e)) {
3511
3515
  const s = e.toJSON();
3512
3516
  if (s !== e)
3513
3517
  return typeof s == "string" ? s : Re(s, n);
3514
3518
  } else if (Array.isArray(e))
3515
- return xr(e, n);
3516
- return wr(e, n);
3519
+ return br(e, n);
3520
+ return xr(e, n);
3517
3521
  }
3518
- function Ar(e) {
3522
+ function wr(e) {
3519
3523
  return typeof e.toJSON == "function";
3520
3524
  }
3521
- function wr(e, t) {
3525
+ function xr(e, t) {
3522
3526
  const n = Object.entries(e);
3523
- return n.length === 0 ? "{}" : t.length > yn ? "[" + br(e) + "]" : "{ " + n.map(
3527
+ return n.length === 0 ? "{}" : t.length > pn ? "[" + Nr(e) + "]" : "{ " + n.map(
3524
3528
  ([r, i]) => r + ": " + Re(i, t)
3525
3529
  ).join(", ") + " }";
3526
3530
  }
3527
- function xr(e, t) {
3531
+ function br(e, t) {
3528
3532
  if (e.length === 0)
3529
3533
  return "[]";
3530
- if (t.length > yn)
3534
+ if (t.length > pn)
3531
3535
  return "[Array]";
3532
- const n = Math.min(Sr, e.length), s = e.length - n, r = [];
3536
+ const n = Math.min(Ir, e.length), s = e.length - n, r = [];
3533
3537
  for (let i = 0; i < n; ++i)
3534
3538
  r.push(Re(e[i], t));
3535
3539
  return s === 1 ? r.push("... 1 more item") : s > 1 && r.push(`... ${s} more items`), "[" + r.join(", ") + "]";
3536
3540
  }
3537
- function br(e) {
3541
+ function Nr(e) {
3538
3542
  const t = Object.prototype.toString.call(e).replace(/^\[object /, "").replace(/]$/, "");
3539
3543
  if (t === "Object" && typeof e.constructor == "function") {
3540
3544
  const n = e.constructor.name;
@@ -3543,11 +3547,11 @@ function br(e) {
3543
3547
  }
3544
3548
  return t;
3545
3549
  }
3546
- const Nr = globalThis.process && // eslint-disable-next-line no-undef
3550
+ const Or = globalThis.process && // eslint-disable-next-line no-undef
3547
3551
  process.env.NODE_ENV === "production", Cr = (
3548
3552
  /* c8 ignore next 6 */
3549
3553
  // FIXME: https://github.com/graphql/graphql-js/issues/2317
3550
- Nr ? function(t, n) {
3554
+ Or ? function(t, n) {
3551
3555
  return t instanceof n;
3552
3556
  } : function(t, n) {
3553
3557
  if (t instanceof n)
@@ -3577,7 +3581,7 @@ spurious results.`);
3577
3581
  return !1;
3578
3582
  }
3579
3583
  );
3580
- class mn {
3584
+ class yn {
3581
3585
  constructor(t, n = "GraphQL request", s = {
3582
3586
  line: 1,
3583
3587
  column: 1
@@ -3594,16 +3598,16 @@ class mn {
3594
3598
  return "Source";
3595
3599
  }
3596
3600
  }
3597
- function Or(e) {
3598
- return Cr(e, mn);
3601
+ function kr(e) {
3602
+ return Cr(e, yn);
3599
3603
  }
3600
- function kr(e, t) {
3601
- return new Dr(e, t).parseDocument();
3604
+ function Dr(e, t) {
3605
+ return new Rr(e, t).parseDocument();
3602
3606
  }
3603
- class Dr {
3607
+ class Rr {
3604
3608
  constructor(t, n = {}) {
3605
- const s = Or(t) ? t : new mn(t);
3606
- this._lexer = new lr(s), this._options = n, this._tokenCounter = 0;
3609
+ const s = kr(t) ? t : new yn(t);
3610
+ this._lexer = new hr(s), this._options = n, this._tokenCounter = 0;
3607
3611
  }
3608
3612
  /**
3609
3613
  * Converts a name lex token into a name parse node.
@@ -4570,7 +4574,7 @@ class Dr {
4570
4574
  * given parsed object.
4571
4575
  */
4572
4576
  node(t, n) {
4573
- return this._options.noLocation !== !0 && (n.loc = new ir(
4577
+ return this._options.noLocation !== !0 && (n.loc = new or(
4574
4578
  t,
4575
4579
  this._lexer.lastToken,
4576
4580
  this._lexer.source
@@ -4593,7 +4597,7 @@ class Dr {
4593
4597
  throw N(
4594
4598
  this._lexer.source,
4595
4599
  n.start,
4596
- `Expected ${gn(t)}, found ${ge(n)}.`
4600
+ `Expected ${mn(t)}, found ${ge(n)}.`
4597
4601
  );
4598
4602
  }
4599
4603
  /**
@@ -4703,19 +4707,19 @@ class Dr {
4703
4707
  }
4704
4708
  function ge(e) {
4705
4709
  const t = e.value;
4706
- return gn(e.kind) + (t != null ? ` "${t}"` : "");
4710
+ return mn(e.kind) + (t != null ? ` "${t}"` : "");
4707
4711
  }
4708
- function gn(e) {
4709
- return hr(e) ? `"${e}"` : e;
4712
+ function mn(e) {
4713
+ return fr(e) ? `"${e}"` : e;
4710
4714
  }
4711
- function Rr(e) {
4712
- return `"${e.replace(qr, Mr)}"`;
4715
+ function qr(e) {
4716
+ return `"${e.replace(Mr, Lr)}"`;
4713
4717
  }
4714
- const qr = /[\x00-\x1f\x22\x5c\x7f-\x9f]/g;
4715
- function Mr(e) {
4716
- return Lr[e.charCodeAt(0)];
4718
+ const Mr = /[\x00-\x1f\x22\x5c\x7f-\x9f]/g;
4719
+ function Lr(e) {
4720
+ return Ur[e.charCodeAt(0)];
4717
4721
  }
4718
- const Lr = [
4722
+ const Ur = [
4719
4723
  "\\u0000",
4720
4724
  "\\u0001",
4721
4725
  "\\u0002",
@@ -4882,10 +4886,10 @@ const Lr = [
4882
4886
  "\\u009E",
4883
4887
  "\\u009F"
4884
4888
  ], Pr = Object.freeze({});
4885
- function Ur(e, t, n = dn) {
4889
+ function Fr(e, t, n = un) {
4886
4890
  const s = /* @__PURE__ */ new Map();
4887
4891
  for (const w of Object.values(T))
4888
- s.set(w, Fr(t, w));
4892
+ s.set(w, Br(t, w));
4889
4893
  let r, i = Array.isArray(e), o = [e], a = -1, c = [], u = e, h, d;
4890
4894
  const f = [], m = [];
4891
4895
  do {
@@ -4896,8 +4900,8 @@ function Ur(e, t, n = dn) {
4896
4900
  if (i) {
4897
4901
  u = u.slice();
4898
4902
  let q = 0;
4899
- for (const [F, H] of c) {
4900
- const z = F - q;
4903
+ for (const [P, H] of c) {
4904
+ const z = P - q;
4901
4905
  H === null ? (u.splice(z, 1), q++) : u[z] = H;
4902
4906
  }
4903
4907
  } else {
@@ -4905,8 +4909,8 @@ function Ur(e, t, n = dn) {
4905
4909
  {},
4906
4910
  Object.getOwnPropertyDescriptors(u)
4907
4911
  );
4908
- for (const [q, F] of c)
4909
- u[q] = F;
4912
+ for (const [q, P] of c)
4913
+ u[q] = P;
4910
4914
  }
4911
4915
  a = r.index, o = r.keys, c = r.edits, i = r.inArray, r = r.prev;
4912
4916
  } else if (d) {
@@ -4917,7 +4921,7 @@ function Ur(e, t, n = dn) {
4917
4921
  let k;
4918
4922
  if (!Array.isArray(u)) {
4919
4923
  var y, v;
4920
- Dt(u) || ve(!1, `Invalid AST Node: ${ht(u)}.`);
4924
+ kt(u) || ve(!1, `Invalid AST Node: ${ht(u)}.`);
4921
4925
  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;
4922
4926
  if (k = q == null ? void 0 : q.call(t, u, h, d, f, m), k === Pr)
4923
4927
  break;
@@ -4927,7 +4931,7 @@ function Ur(e, t, n = dn) {
4927
4931
  continue;
4928
4932
  }
4929
4933
  } else if (k !== void 0 && (c.push([h, k]), !w))
4930
- if (Dt(k))
4934
+ if (kt(k))
4931
4935
  u = k;
4932
4936
  else {
4933
4937
  f.pop();
@@ -4949,7 +4953,7 @@ function Ur(e, t, n = dn) {
4949
4953
  } while (r !== void 0);
4950
4954
  return c.length !== 0 ? c[c.length - 1][1] : e;
4951
4955
  }
4952
- function Fr(e, t) {
4956
+ function Br(e, t) {
4953
4957
  const n = e[t];
4954
4958
  return typeof n == "object" ? n : typeof n == "function" ? {
4955
4959
  enter: n,
@@ -4959,10 +4963,10 @@ function Fr(e, t) {
4959
4963
  leave: e.leave
4960
4964
  };
4961
4965
  }
4962
- function En(e) {
4963
- return Ur(e, jr);
4966
+ function gn(e) {
4967
+ return Fr(e, $r);
4964
4968
  }
4965
- const Br = 80, jr = {
4969
+ const jr = 80, $r = {
4966
4970
  Name: {
4967
4971
  leave: (e) => e.value
4968
4972
  },
@@ -4998,7 +5002,7 @@ const Br = 80, jr = {
4998
5002
  leave({ alias: e, name: t, arguments: n, directives: s, selectionSet: r }) {
4999
5003
  const i = S("", e, ": ") + t;
5000
5004
  let o = i + S("(", E(n, ", "), ")");
5001
- return o.length > Br && (o = i + S(`(
5005
+ return o.length > jr && (o = i + S(`(
5002
5006
  `, Te(E(n, `
5003
5007
  `)), `
5004
5008
  )`)), E([o, E(s, " "), r], " ");
@@ -5036,7 +5040,7 @@ const Br = 80, jr = {
5036
5040
  leave: ({ value: e }) => e
5037
5041
  },
5038
5042
  StringValue: {
5039
- leave: ({ value: e, block: t }) => t ? dr(e) : Rr(e)
5043
+ leave: ({ value: e, block: t }) => t ? lr(e) : qr(e)
5040
5044
  },
5041
5045
  BooleanValue: {
5042
5046
  leave: ({ value: e }) => e ? "true" : "false"
@@ -5097,7 +5101,7 @@ const Br = 80, jr = {
5097
5101
  },
5098
5102
  FieldDefinition: {
5099
5103
  leave: ({ description: e, name: t, arguments: n, type: s, directives: r }) => S("", e, `
5100
- `) + t + (qt(n) ? S(`(
5104
+ `) + t + (Rt(n) ? S(`(
5101
5105
  `, Te(E(n, `
5102
5106
  `)), `
5103
5107
  )`) : S("(", E(n, ", "), ")")) + ": " + s + S(" ", E(r, " "))
@@ -5143,7 +5147,7 @@ const Br = 80, jr = {
5143
5147
  },
5144
5148
  DirectiveDefinition: {
5145
5149
  leave: ({ description: e, name: t, arguments: n, repeatable: s, locations: r }) => S("", e, `
5146
- `) + "directive @" + t + (qt(n) ? S(`(
5150
+ `) + "directive @" + t + (Rt(n) ? S(`(
5147
5151
  `, Te(E(n, `
5148
5152
  `)), `
5149
5153
  )`) : S("(", E(n, ", "), ")")) + (s ? " repeatable" : "") + " on " + E(r, " | ")
@@ -5216,12 +5220,12 @@ function Te(e) {
5216
5220
  return S(" ", e.replace(/\n/g, `
5217
5221
  `));
5218
5222
  }
5219
- function qt(e) {
5223
+ function Rt(e) {
5220
5224
  var t;
5221
5225
  return (t = e == null ? void 0 : e.some((n) => n.includes(`
5222
5226
  `))) !== null && t !== void 0 ? t : !1;
5223
5227
  }
5224
- const Mt = (e) => {
5228
+ const qt = (e) => {
5225
5229
  var s, r;
5226
5230
  let t;
5227
5231
  const n = e.definitions.filter((i) => i.kind === "OperationDefinition");
@@ -5230,14 +5234,14 @@ const Mt = (e) => {
5230
5234
  if (typeof e == "string") {
5231
5235
  let n;
5232
5236
  try {
5233
- const s = kr(e);
5234
- n = Mt(s);
5237
+ const s = Dr(e);
5238
+ n = qt(s);
5235
5239
  } catch {
5236
5240
  }
5237
5241
  return { query: e, operationName: n };
5238
5242
  }
5239
- const t = Mt(e);
5240
- return { query: En(e), operationName: t };
5243
+ const t = qt(e);
5244
+ return { query: gn(e), operationName: t };
5241
5245
  };
5242
5246
  class ce extends Error {
5243
5247
  constructor(t, n) {
@@ -5252,13 +5256,13 @@ class ce extends Error {
5252
5256
  return ((s = (n = t.errors) == null ? void 0 : n[0]) == null ? void 0 : s.message) ?? `GraphQL Error (Code: ${t.status})`;
5253
5257
  }
5254
5258
  }
5255
- var $r = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
5256
- function Vr(e) {
5259
+ var Vr = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
5260
+ function Hr(e) {
5257
5261
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
5258
5262
  }
5259
5263
  var Ze = { exports: {} };
5260
5264
  (function(e, t) {
5261
- var n = typeof self < "u" ? self : $r, s = function() {
5265
+ var n = typeof self < "u" ? self : Vr, s = function() {
5262
5266
  function i() {
5263
5267
  this.fetch = !1, this.DOMException = n.DOMException;
5264
5268
  }
@@ -5378,8 +5382,8 @@ var Ze = { exports: {} };
5378
5382
  return g.readAsText(l), _;
5379
5383
  }
5380
5384
  function k(l) {
5381
- for (var g = new Uint8Array(l), _ = new Array(g.length), O = 0; O < g.length; O++)
5382
- _[O] = String.fromCharCode(g[O]);
5385
+ for (var g = new Uint8Array(l), _ = new Array(g.length), C = 0; C < g.length; C++)
5386
+ _[C] = String.fromCharCode(g[C]);
5383
5387
  return _.join("");
5384
5388
  }
5385
5389
  function q(l) {
@@ -5388,7 +5392,7 @@ var Ze = { exports: {} };
5388
5392
  var g = new Uint8Array(l.byteLength);
5389
5393
  return g.set(new Uint8Array(l)), g.buffer;
5390
5394
  }
5391
- function F() {
5395
+ function P() {
5392
5396
  return this.bodyUsed = !1, this._initBody = function(l) {
5393
5397
  this._bodyInit = l, l ? typeof l == "string" ? this._bodyText = l : a.blob && Blob.prototype.isPrototypeOf(l) ? this._bodyBlob = l : a.formData && FormData.prototype.isPrototypeOf(l) ? this._bodyFormData = l : a.searchParams && URLSearchParams.prototype.isPrototypeOf(l) ? this._bodyText = l.toString() : a.arrayBuffer && a.blob && c(l) ? (this._bodyArrayBuffer = q(l.buffer), this._bodyInit = new Blob([this._bodyArrayBuffer])) : a.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(l) || h(l)) ? this._bodyArrayBuffer = q(l) : this._bodyText = l = Object.prototype.toString.call(l) : this._bodyText = "", this.headers.get("content-type") || (typeof l == "string" ? this.headers.set("content-type", "text/plain;charset=UTF-8") : this._bodyBlob && this._bodyBlob.type ? this.headers.set("content-type", this._bodyBlob.type) : a.searchParams && URLSearchParams.prototype.isPrototypeOf(l) && this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8"));
5394
5398
  }, a.blob && (this.blob = function() {
@@ -5446,56 +5450,56 @@ var Ze = { exports: {} };
5446
5450
  var g = new FormData();
5447
5451
  return l.trim().split("&").forEach(function(_) {
5448
5452
  if (_) {
5449
- var O = _.split("="), C = O.shift().replace(/\+/g, " "), A = O.join("=").replace(/\+/g, " ");
5450
- g.append(decodeURIComponent(C), decodeURIComponent(A));
5453
+ var C = _.split("="), O = C.shift().replace(/\+/g, " "), A = C.join("=").replace(/\+/g, " ");
5454
+ g.append(decodeURIComponent(O), decodeURIComponent(A));
5451
5455
  }
5452
5456
  }), g;
5453
5457
  }
5454
5458
  function pe(l) {
5455
5459
  var g = new y(), _ = l.replace(/\r?\n[\t ]+/g, " ");
5456
- return _.split(/\r?\n/).forEach(function(O) {
5457
- var C = O.split(":"), A = C.shift().trim();
5460
+ return _.split(/\r?\n/).forEach(function(C) {
5461
+ var O = C.split(":"), A = O.shift().trim();
5458
5462
  if (A) {
5459
- var ye = C.join(":").trim();
5463
+ var ye = O.join(":").trim();
5460
5464
  g.append(A, ye);
5461
5465
  }
5462
5466
  }), g;
5463
5467
  }
5464
- F.call(L.prototype);
5465
- function P(l, g) {
5468
+ P.call(L.prototype);
5469
+ function U(l, g) {
5466
5470
  g || (g = {}), this.type = "default", this.status = g.status === void 0 ? 200 : g.status, this.ok = this.status >= 200 && this.status < 300, this.statusText = "statusText" in g ? g.statusText : "OK", this.headers = new y(g.headers), this.url = g.url || "", this._initBody(l);
5467
5471
  }
5468
- F.call(P.prototype), P.prototype.clone = function() {
5469
- return new P(this._bodyInit, {
5472
+ P.call(U.prototype), U.prototype.clone = function() {
5473
+ return new U(this._bodyInit, {
5470
5474
  status: this.status,
5471
5475
  statusText: this.statusText,
5472
5476
  headers: new y(this.headers),
5473
5477
  url: this.url
5474
5478
  });
5475
- }, P.error = function() {
5476
- var l = new P(null, { status: 0, statusText: "" });
5479
+ }, U.error = function() {
5480
+ var l = new U(null, { status: 0, statusText: "" });
5477
5481
  return l.type = "error", l;
5478
5482
  };
5479
- var In = [301, 302, 303, 307, 308];
5480
- P.redirect = function(l, g) {
5481
- if (In.indexOf(g) === -1)
5483
+ var Sn = [301, 302, 303, 307, 308];
5484
+ U.redirect = function(l, g) {
5485
+ if (Sn.indexOf(g) === -1)
5482
5486
  throw new RangeError("Invalid status code");
5483
- return new P(null, { status: g, headers: { location: l } });
5487
+ return new U(null, { status: g, headers: { location: l } });
5484
5488
  }, o.DOMException = i.DOMException;
5485
5489
  try {
5486
5490
  new o.DOMException();
5487
5491
  } catch {
5488
5492
  o.DOMException = function(g, _) {
5489
5493
  this.message = g, this.name = _;
5490
- var O = Error(g);
5491
- this.stack = O.stack;
5494
+ var C = Error(g);
5495
+ this.stack = C.stack;
5492
5496
  }, o.DOMException.prototype = Object.create(Error.prototype), o.DOMException.prototype.constructor = o.DOMException;
5493
5497
  }
5494
5498
  function Me(l, g) {
5495
- return new Promise(function(_, O) {
5496
- var C = new L(l, g);
5497
- if (C.signal && C.signal.aborted)
5498
- return O(new o.DOMException("Aborted", "AbortError"));
5499
+ return new Promise(function(_, C) {
5500
+ var O = new L(l, g);
5501
+ if (O.signal && O.signal.aborted)
5502
+ return C(new o.DOMException("Aborted", "AbortError"));
5499
5503
  var A = new XMLHttpRequest();
5500
5504
  function ye() {
5501
5505
  A.abort();
@@ -5508,51 +5512,51 @@ var Ze = { exports: {} };
5508
5512
  };
5509
5513
  ie.url = "responseURL" in A ? A.responseURL : ie.headers.get("X-Request-URL");
5510
5514
  var Le = "response" in A ? A.response : A.responseText;
5511
- _(new P(Le, ie));
5515
+ _(new U(Le, ie));
5512
5516
  }, A.onerror = function() {
5513
- O(new TypeError("Network request failed"));
5517
+ C(new TypeError("Network request failed"));
5514
5518
  }, A.ontimeout = function() {
5515
- O(new TypeError("Network request failed"));
5519
+ C(new TypeError("Network request failed"));
5516
5520
  }, A.onabort = function() {
5517
- O(new o.DOMException("Aborted", "AbortError"));
5518
- }, A.open(C.method, C.url, !0), C.credentials === "include" ? A.withCredentials = !0 : C.credentials === "omit" && (A.withCredentials = !1), "responseType" in A && a.blob && (A.responseType = "blob"), C.headers.forEach(function(ie, Le) {
5521
+ C(new o.DOMException("Aborted", "AbortError"));
5522
+ }, 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) {
5519
5523
  A.setRequestHeader(Le, ie);
5520
- }), C.signal && (C.signal.addEventListener("abort", ye), A.onreadystatechange = function() {
5521
- A.readyState === 4 && C.signal.removeEventListener("abort", ye);
5522
- }), A.send(typeof C._bodyInit > "u" ? null : C._bodyInit);
5524
+ }), O.signal && (O.signal.addEventListener("abort", ye), A.onreadystatechange = function() {
5525
+ A.readyState === 4 && O.signal.removeEventListener("abort", ye);
5526
+ }), A.send(typeof O._bodyInit > "u" ? null : O._bodyInit);
5523
5527
  });
5524
5528
  }
5525
- return Me.polyfill = !0, i.fetch || (i.fetch = Me, i.Headers = y, i.Request = L, i.Response = P), o.Headers = y, o.Request = L, o.Response = P, o.fetch = Me, Object.defineProperty(o, "__esModule", { value: !0 }), o;
5529
+ return Me.polyfill = !0, i.fetch || (i.fetch = Me, i.Headers = y, i.Request = L, i.Response = U), o.Headers = y, o.Request = L, o.Response = U, o.fetch = Me, Object.defineProperty(o, "__esModule", { value: !0 }), o;
5526
5530
  })({});
5527
5531
  })(s), s.fetch.ponyfill = !0, delete s.fetch.polyfill;
5528
5532
  var r = s;
5529
5533
  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;
5530
5534
  })(Ze, Ze.exports);
5531
5535
  var we = Ze.exports;
5532
- const _e = /* @__PURE__ */ Vr(we), Hr = /* @__PURE__ */ wn({
5536
+ const _e = /* @__PURE__ */ Hr(we), zr = /* @__PURE__ */ An({
5533
5537
  __proto__: null,
5534
5538
  default: _e
5535
5539
  }, [we]), W = (e) => {
5536
5540
  let t = {};
5537
- return e && (typeof Headers < "u" && e instanceof Headers || Hr && we.Headers && e instanceof we.Headers ? t = Qs(e) : Array.isArray(e) ? e.forEach(([n, s]) => {
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]) => {
5538
5542
  n && s !== void 0 && (t[n] = s);
5539
5543
  }) : t = e), t;
5540
- }, Lt = (e) => e.replace(/([\s,]|#[^\n\r]+)+/g, " ").trim(), zr = (e) => {
5544
+ }, Mt = (e) => e.replace(/([\s,]|#[^\n\r]+)+/g, " ").trim(), Gr = (e) => {
5541
5545
  if (!Array.isArray(e.query)) {
5542
- const s = e, r = [`query=${encodeURIComponent(Lt(s.query))}`];
5546
+ const s = e, r = [`query=${encodeURIComponent(Mt(s.query))}`];
5543
5547
  return e.variables && r.push(`variables=${encodeURIComponent(s.jsonSerializer.stringify(s.variables))}`), s.operationName && r.push(`operationName=${encodeURIComponent(s.operationName)}`), r.join("&");
5544
5548
  }
5545
5549
  if (typeof e.variables < "u" && !Array.isArray(e.variables))
5546
5550
  throw new Error("Cannot create query with given variable type, array expected");
5547
5551
  const t = e, n = e.query.reduce((s, r, i) => (s.push({
5548
- query: Lt(r),
5552
+ query: Mt(r),
5549
5553
  variables: t.variables ? t.jsonSerializer.stringify(t.variables[i]) : void 0
5550
5554
  }), s), []);
5551
5555
  return `query=${encodeURIComponent(t.jsonSerializer.stringify(n))}`;
5552
- }, Gr = (e) => async (t) => {
5556
+ }, Jr = (e) => async (t) => {
5553
5557
  const { url: n, query: s, variables: r, operationName: i, fetch: o, fetchOptions: a, middleware: c } = t, u = { ...t.headers };
5554
5558
  let h = "", d;
5555
- e === "POST" ? (d = Jr(s, r, i, a.jsonSerializer), typeof d == "string" && (u["Content-Type"] = "application/json")) : h = zr({
5559
+ e === "POST" ? (d = Yr(s, r, i, a.jsonSerializer), typeof d == "string" && (u["Content-Type"] = "application/json")) : h = Gr({
5556
5560
  query: s,
5557
5561
  variables: r,
5558
5562
  operationName: i,
@@ -5571,10 +5575,10 @@ const _e = /* @__PURE__ */ Vr(we), Hr = /* @__PURE__ */ wn({
5571
5575
  }
5572
5576
  return h && (m = `${m}?${h}`), await o(m, y);
5573
5577
  };
5574
- class vn {
5578
+ class En {
5575
5579
  constructor(t, n = {}) {
5576
5580
  this.url = t, this.requestConfig = n, this.rawRequest = async (...s) => {
5577
- const [r, i, o] = s, a = Ws(r, i, o), { headers: c, fetch: u = _e, method: h = "POST", requestMiddleware: d, responseMiddleware: f, ...m } = this.requestConfig, { url: y } = this;
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;
5578
5582
  a.signal !== void 0 && (m.signal = a.signal);
5579
5583
  const { operationName: v } = je(a.query);
5580
5584
  return $e({
@@ -5596,7 +5600,7 @@ class vn {
5596
5600
  };
5597
5601
  }
5598
5602
  async request(t, ...n) {
5599
- const [s, r] = n, i = Xs(t, s, r), { headers: o, fetch: a = _e, method: c = "POST", requestMiddleware: u, responseMiddleware: h, ...d } = this.requestConfig, { url: f } = this;
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;
5600
5604
  i.signal !== void 0 && (d.signal = i.signal);
5601
5605
  const { query: m, operationName: y } = je(i.document);
5602
5606
  return $e({
@@ -5618,7 +5622,7 @@ class vn {
5618
5622
  }
5619
5623
  // prettier-ignore
5620
5624
  batchRequests(t, n) {
5621
- const s = Ks(t, n), { headers: r, ...i } = this.requestConfig;
5625
+ const s = Zs(t, n), { headers: r, ...i } = this.requestConfig;
5622
5626
  s.signal !== void 0 && (i.signal = s.signal);
5623
5627
  const o = s.documents.map(({ document: c }) => je(c).query), a = s.documents.map(({ variables: c }) => c);
5624
5628
  return $e({
@@ -5657,7 +5661,7 @@ class vn {
5657
5661
  }
5658
5662
  }
5659
5663
  const $e = async (e) => {
5660
- const { query: t, variables: n, fetchOptions: s } = e, r = Gr(Ys(e.method ?? "post")), i = Array.isArray(e.query), o = await r(e), a = await Yr(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";
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";
5661
5665
  if (o.ok && u && c) {
5662
5666
  const { errors: h, ...d } = (Array.isArray(a), a), f = s.errorPolicy === "ignore" ? d : a;
5663
5667
  return {
@@ -5677,12 +5681,12 @@ const $e = async (e) => {
5677
5681
  }
5678
5682
  };
5679
5683
  async function qe(e, t, ...n) {
5680
- const s = Zs(e, t, ...n);
5681
- return new vn(s.url).request({
5684
+ const s = er(e, t, ...n);
5685
+ return new En(s.url).request({
5682
5686
  ...s
5683
5687
  });
5684
5688
  }
5685
- const Jr = (e, t, n, s) => {
5689
+ const Yr = (e, t, n, s) => {
5686
5690
  const r = s ?? dt;
5687
5691
  if (!Array.isArray(e))
5688
5692
  return r.stringify({ query: e, variables: t, operationName: n });
@@ -5690,12 +5694,12 @@ const Jr = (e, t, n, s) => {
5690
5694
  throw new Error("Cannot create request body with given variable type, array expected");
5691
5695
  const i = e.reduce((o, a, c) => (o.push({ query: a, variables: t ? t[c] : void 0 }), o), []);
5692
5696
  return r.stringify(i);
5693
- }, Yr = async (e, t) => {
5697
+ }, Qr = async (e, t) => {
5694
5698
  let n;
5695
5699
  return e.headers.forEach((s, r) => {
5696
5700
  r.toLowerCase() === "content-type" && (n = s);
5697
5701
  }), 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();
5698
- }, Ve = (e) => typeof e == "function" ? e() : e, Qr = V(async ({ input: e }) => {
5702
+ }, Ve = (e) => typeof e == "function" ? e() : e, Xr = V(async ({ input: e }) => {
5699
5703
  var t;
5700
5704
  if (!e.endpoint || e.endpoint === "")
5701
5705
  throw new Error("No endpoint provided.");
@@ -5727,19 +5731,19 @@ const Jr = (e, t, n, s) => {
5727
5731
  } catch {
5728
5732
  throw console.log("Request to add submit step data failed."), new Error("Request to add submit step data failed.");
5729
5733
  }
5730
- }), Xr = ({ context: e }) => Object.keys(e.quote).length > 0, Pt = he({
5734
+ }), Wr = ({ context: e }) => Object.keys(e.quote).length > 0, Lt = he({
5731
5735
  types: {
5732
5736
  context: {},
5733
5737
  events: {},
5734
5738
  input: {}
5735
5739
  },
5736
5740
  actions: {
5737
- changeStep: b(zs),
5738
- nextStep: b(Gs),
5739
- updateQuote: b(Js)
5741
+ changeStep: b(Gs),
5742
+ nextStep: b(Js),
5743
+ updateQuote: b(Ys)
5740
5744
  },
5741
- actors: { submitStepData: Qr },
5742
- guards: { quoteExists: Xr }
5745
+ actors: { submitStepData: Xr },
5746
+ guards: { quoteExists: Wr }
5743
5747
  }).createMachine({
5744
5748
  /** @todo do we need to add the view to the id? (e.g. checkout_en-us) */
5745
5749
  id: "checkout",
@@ -5819,7 +5823,7 @@ const Jr = (e, t, n, s) => {
5819
5823
  },
5820
5824
  submittingStepData: {
5821
5825
  invoke: {
5822
- input: ({ context: e, event: t }) => (on(t, "SUBMIT_STEP_DATA"), {
5826
+ input: ({ context: e, event: t }) => (rn(t, "SUBMIT_STEP_DATA"), {
5823
5827
  // quoteId: context.quote.id,
5824
5828
  // locale: context.quote.locale,
5825
5829
  endpoint: e.endpoints.client,
@@ -5880,12 +5884,12 @@ const Jr = (e, t, n, s) => {
5880
5884
  // SYNC_IS_LOGGED_IN: '.syncIsLoggedIn',
5881
5885
  // SYNC_QUOTE: '.syncQuote',
5882
5886
  // },
5883
- }), Tn = be({}), gi = () => {
5884
- const e = Ne(Tn);
5887
+ }), vn = be({}), Ei = () => {
5888
+ const e = Ne(vn);
5885
5889
  if (!e || !e.getSnapshot)
5886
5890
  throw new Error("checkoutActor is not properly initialized");
5887
- const [t, n] = Ce(() => e.getSnapshot());
5888
- Oe(() => {
5891
+ const [t, n] = Oe(() => e.getSnapshot());
5892
+ Ce(() => {
5889
5893
  if (!e || !e.getSnapshot) {
5890
5894
  console.error("checkoutActor is not properly initialized");
5891
5895
  return;
@@ -5905,7 +5909,7 @@ const Jr = (e, t, n, s) => {
5905
5909
  checkoutActor: e,
5906
5910
  currentStep: s
5907
5911
  };
5908
- }, Ei = async (e = {
5912
+ }, vi = async (e = {
5909
5913
  inspect: void 0,
5910
5914
  currentStep: "",
5911
5915
  steps: [],
@@ -5914,14 +5918,14 @@ const Jr = (e, t, n, s) => {
5914
5918
  graphql: {}
5915
5919
  }) => typeof window < "u" ? (console.warn(
5916
5920
  "App.getInitialProps::getAuth should not be run on the frontend. You are probably missing getServerSideProps in your page."
5917
- ), U(Pt, {
5921
+ ), j(Lt, {
5918
5922
  inspect: e.inspect,
5919
5923
  input: {
5920
5924
  initialContext: {
5921
5925
  endpoints: e.endpoints
5922
5926
  }
5923
5927
  }
5924
- }).start()) : U(Pt, {
5928
+ }).start()) : j(Lt, {
5925
5929
  input: {
5926
5930
  initialContext: {
5927
5931
  currentStep: e.currentStep,
@@ -5935,13 +5939,13 @@ const Jr = (e, t, n, s) => {
5935
5939
  },
5936
5940
  inspect: e.inspect
5937
5941
  }).start();
5938
- function vi({ actor: e, children: t }) {
5939
- return /* @__PURE__ */ xe(Tn.Provider, { value: e, children: t });
5942
+ function Ti({ actor: e, children: t }) {
5943
+ return /* @__PURE__ */ xe(vn.Provider, { value: e, children: t });
5940
5944
  }
5941
- let Wr = (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), "");
5942
- const Kr = he({
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({
5943
5947
  actors: {
5944
- tick: As(
5948
+ tick: Is(
5945
5949
  ({ sendBack: e, input: t }) => {
5946
5950
  const n = setInterval(() => {
5947
5951
  e({ type: "TICK" });
@@ -6017,9 +6021,9 @@ const Kr = he({
6017
6021
  type: "final"
6018
6022
  }
6019
6023
  }
6020
- }), Ti = he({
6024
+ }), _i = he({
6021
6025
  actors: {
6022
- timer: Kr
6026
+ timer: Zr
6023
6027
  },
6024
6028
  types: {
6025
6029
  context: {},
@@ -6030,7 +6034,7 @@ const Kr = he({
6030
6034
  addItem: b(({ context: e, event: t }) => {
6031
6035
  if (t.type !== "ADD_ITEM")
6032
6036
  return e;
6033
- const n = `notification-${Wr()}`, s = t.duration ?? e.duration, r = An(t.item, {
6037
+ const n = `notification-${Kr()}`, s = t.duration ?? e.duration, r = In(t.item, {
6034
6038
  duration: s,
6035
6039
  id: n,
6036
6040
  key: t.item.key ?? n,
@@ -6140,14 +6144,14 @@ const Kr = he({
6140
6144
  }
6141
6145
  }
6142
6146
  }
6143
- }), _n = be(
6147
+ }), Tn = be(
6144
6148
  {}
6145
- ), _i = () => {
6146
- const e = Ne(_n);
6149
+ ), Si = () => {
6150
+ const e = Ne(Tn);
6147
6151
  if (!e || !e.getSnapshot)
6148
6152
  throw new Error("toastActor is not properly initialized");
6149
- const [t, n] = Ce(() => e.getSnapshot());
6150
- return Oe(() => {
6153
+ const [t, n] = Oe(() => e.getSnapshot());
6154
+ return Ce(() => {
6151
6155
  if (!e || !e.getSnapshot) {
6152
6156
  console.error("toastActor is not properly initialized");
6153
6157
  return;
@@ -6163,10 +6167,10 @@ const Kr = he({
6163
6167
  };
6164
6168
  }, [e]), { toastActor: e };
6165
6169
  };
6166
- function Si({ children: e, actor: t }) {
6167
- return /* @__PURE__ */ xe(_n.Provider, { value: t, children: e });
6170
+ function Ii({ children: e, actor: t }) {
6171
+ return /* @__PURE__ */ xe(Tn.Provider, { value: t, children: e });
6168
6172
  }
6169
- function Zr({
6173
+ function ei({
6170
6174
  context: e,
6171
6175
  event: t
6172
6176
  }) {
@@ -6178,7 +6182,7 @@ function Zr({
6178
6182
  itemsAdded: n.output.itemsAdded
6179
6183
  };
6180
6184
  }
6181
- function ei({
6185
+ function ti({
6182
6186
  event: e
6183
6187
  }) {
6184
6188
  if (!e.type.includes("xstate.done.actor"))
@@ -6189,7 +6193,7 @@ function ei({
6189
6193
  itemsAdded: t.output.itemsAdded
6190
6194
  };
6191
6195
  }
6192
- function ti({
6196
+ function ni({
6193
6197
  event: e
6194
6198
  }) {
6195
6199
  if (!e.type.includes("xstate.done.actor"))
@@ -6200,7 +6204,7 @@ function ti({
6200
6204
  itemsRemoved: t.output.itemsRemoved
6201
6205
  };
6202
6206
  }
6203
- function ni({
6207
+ function si({
6204
6208
  event: e
6205
6209
  }) {
6206
6210
  if (!e.type.includes("xstate.done.actor"))
@@ -6217,7 +6221,7 @@ function ni({
6217
6221
  itemsUpdated: t.output.itemsUpdated
6218
6222
  };
6219
6223
  }
6220
- function si({
6224
+ function ri({
6221
6225
  context: e,
6222
6226
  event: t
6223
6227
  }) {
@@ -6229,7 +6233,7 @@ function si({
6229
6233
  itemsRemoved: n.output.itemsRemoved
6230
6234
  };
6231
6235
  }
6232
- function ri({
6236
+ function ii({
6233
6237
  context: e,
6234
6238
  event: t
6235
6239
  }) {
@@ -6240,7 +6244,7 @@ function ri({
6240
6244
  quote: { ...e.quote, ...n.output.quote }
6241
6245
  };
6242
6246
  }
6243
- function ii({
6247
+ function oi({
6244
6248
  context: e,
6245
6249
  event: t
6246
6250
  }) {
@@ -6252,7 +6256,7 @@ function ii({
6252
6256
  itemsUpdated: n.output.itemsUpdated
6253
6257
  };
6254
6258
  }
6255
- const oi = V(
6259
+ const ai = V(
6256
6260
  async ({ input: e }) => {
6257
6261
  var t;
6258
6262
  if (!e.endpoint || e.endpoint === "")
@@ -6281,7 +6285,7 @@ const oi = V(
6281
6285
  throw new Error("Request to add item(s) failed.");
6282
6286
  }
6283
6287
  }
6284
- ), ai = V(async ({ input: e }) => {
6288
+ ), ci = V(async ({ input: e }) => {
6285
6289
  var t;
6286
6290
  if (!e.endpoint || e.endpoint === "")
6287
6291
  throw new Error("No endpoint provided.");
@@ -6305,7 +6309,7 @@ const oi = V(
6305
6309
  } catch {
6306
6310
  throw new Error("Request to remove item(s) failed.");
6307
6311
  }
6308
- }), He = typeof window > "u", ci = V(
6312
+ }), He = typeof window > "u", ui = V(
6309
6313
  async ({ input: e }) => {
6310
6314
  var n, s, r, i;
6311
6315
  if (!e.endpoint)
@@ -6318,7 +6322,7 @@ const oi = V(
6318
6322
  throw console.log("no request document"), new Error("No request document provided.");
6319
6323
  if (!e.requestHeaders)
6320
6324
  throw console.log("no headers"), new Error("No request headers provided.");
6321
- const t = new vn(
6325
+ const t = new En(
6322
6326
  He ? e.endpointSsr : e.endpoint,
6323
6327
  He ? { fetch, method: "POST" } : {
6324
6328
  credentials: "include",
@@ -6328,7 +6332,7 @@ const oi = V(
6328
6332
  );
6329
6333
  try {
6330
6334
  const { data: o, headers: a, status: c, errors: u, extensions: h } = await t.rawRequest(
6331
- En(e.document),
6335
+ gn(e.document),
6332
6336
  {},
6333
6337
  He ? {
6334
6338
  ...e.requestHeaders,
@@ -6347,7 +6351,7 @@ const oi = V(
6347
6351
  throw console.log("refresh error", o), new Error("Request to add item(s) failed.");
6348
6352
  }
6349
6353
  }
6350
- ), ui = V(async ({ input: e }) => {
6354
+ ), di = V(async ({ input: e }) => {
6351
6355
  var t;
6352
6356
  if (!e.endpoint || e.endpoint === "")
6353
6357
  throw new Error("No endpoint provided.");
@@ -6374,7 +6378,7 @@ const oi = V(
6374
6378
  } catch {
6375
6379
  throw new Error("Request to add item(s) failed.");
6376
6380
  }
6377
- }), di = ({ context: e }) => typeof window > "u" && e.quote.id !== "" || typeof window < "u", li = ({ context: e }) => !!e.quote.items && e.quote.items.length > 0, Ut = he({
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({
6378
6382
  types: {
6379
6383
  context: {},
6380
6384
  emitted: {},
@@ -6382,30 +6386,30 @@ const oi = V(
6382
6386
  input: {}
6383
6387
  },
6384
6388
  actions: {
6385
- addItems: b(Zr),
6386
- notifyAddItems: Fe(ei),
6387
- notifyRemoveItems: Fe(ti),
6388
- notifyUpdateItems: Fe(ni),
6389
- removeItems: b(si),
6390
- refresh: b(ri),
6391
- updateItems: b(ii)
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)
6392
6396
  },
6393
6397
  actors: {
6394
- addItems: oi,
6395
- removeItems: ai,
6396
- refresh: ci,
6397
- updateItems: ui
6398
+ addItems: ai,
6399
+ removeItems: ci,
6400
+ refresh: ui,
6401
+ updateItems: di
6398
6402
  },
6399
6403
  guards: {
6400
- canRefresh: di,
6401
- hasItems: li
6404
+ canRefresh: li,
6405
+ hasItems: hi
6402
6406
  }
6403
6407
  }).createMachine({
6404
6408
  /** @todo do we need to add the view to the id? (e.g. quote_en-us) */
6405
6409
  id: "quote",
6406
6410
  initial: "initializing",
6407
6411
  context: ({ input: e }) => {
6408
- var t, n, s, r, i, o, a, c, u, h, d, f, m, y, v, I, w, R, k, q, F, H, z, L, fe, pe;
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;
6409
6413
  return {
6410
6414
  quote: {
6411
6415
  id: "",
@@ -6480,7 +6484,7 @@ const oi = V(
6480
6484
  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
6481
6485
  },
6482
6486
  updateItems: {
6483
- document: ((z = (H = (F = e == null ? void 0 : e.initialContext) == null ? void 0 : F.graphql) == null ? void 0 : H.updateItems) == null ? void 0 : z.document) ?? "",
6487
+ 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) ?? "",
6484
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
6485
6489
  }
6486
6490
  }
@@ -6751,15 +6755,15 @@ const oi = V(
6751
6755
  // removingGiftCard: {},
6752
6756
  // applyingSettings: {},
6753
6757
  }
6754
- }), Sn = be(
6758
+ }), _n = be(
6755
6759
  {}
6756
- ), Ii = () => {
6760
+ ), Ai = () => {
6757
6761
  var c;
6758
- const e = Ne(Sn);
6762
+ const e = Ne(_n);
6759
6763
  if (!e || !e.getSnapshot)
6760
6764
  throw new Error("quoteActor is not properly initialized");
6761
- const [t, n] = Ce(() => e.getSnapshot());
6762
- Oe(() => {
6765
+ const [t, n] = Oe(() => e.getSnapshot());
6766
+ Ce(() => {
6763
6767
  if (!e || !e.getSnapshot) {
6764
6768
  console.error("quoteActor is not properly initialized");
6765
6769
  return;
@@ -6783,21 +6787,21 @@ const oi = V(
6783
6787
  isRemovingItems: o,
6784
6788
  isUpdatingItems: a
6785
6789
  };
6786
- }, Ai = async (e = {
6790
+ }, wi = async (e = {
6787
6791
  inspect: void 0,
6788
6792
  quote: { id: "", locale: "" },
6789
6793
  endpoints: { client: "", server: "" },
6790
6794
  graphql: {}
6791
6795
  }) => typeof window < "u" ? (console.warn(
6792
6796
  "App.getInitialProps::getAuth should not be run on the frontend. You are probably missing getServerSideProps in your page."
6793
- ), U(Ut, {
6797
+ ), j(Ut, {
6794
6798
  inspect: e.inspect,
6795
6799
  input: {
6796
6800
  initialContext: {
6797
6801
  endpoints: e.endpoints
6798
6802
  }
6799
6803
  }
6800
- }).start()) : U(Ut, {
6804
+ }).start()) : j(Ut, {
6801
6805
  input: {
6802
6806
  initialContext: {
6803
6807
  endpoints: e.endpoints,
@@ -6810,28 +6814,28 @@ const oi = V(
6810
6814
  },
6811
6815
  inspect: e.inspect
6812
6816
  }).start();
6813
- function wi({ actor: e, children: t }) {
6814
- return /* @__PURE__ */ xe(Sn.Provider, { value: e, children: t });
6817
+ function xi({ actor: e, children: t }) {
6818
+ return /* @__PURE__ */ xe(_n.Provider, { value: e, children: t });
6815
6819
  }
6816
6820
  export {
6817
- an as AuthContext,
6818
- mi as AuthProvider,
6819
- Tn as CheckoutContext,
6820
- vi as CheckoutProvider,
6821
- Sn as QuoteContext,
6822
- wi as QuoteProvider,
6823
- _n as ToastContext,
6824
- Si as ToastProvider,
6825
- Ct as authMachine,
6826
- Pt as checkoutMachine,
6827
- yi as getAuth,
6828
- Ei as getCheckout,
6829
- Ai as getQuote,
6821
+ on as AuthContext,
6822
+ gi as AuthProvider,
6823
+ vn as CheckoutContext,
6824
+ Ti as CheckoutProvider,
6825
+ _n as QuoteContext,
6826
+ xi as QuoteProvider,
6827
+ Tn as ToastContext,
6828
+ Ii as ToastProvider,
6829
+ zs as authMachine,
6830
+ Lt as checkoutMachine,
6831
+ mi as getAuth,
6832
+ vi as getCheckout,
6833
+ wi as getQuote,
6830
6834
  Ut as quoteMachine,
6831
- Kr as timerMachine,
6832
- Ti as toastMachine,
6833
- pi as useAuth,
6834
- gi as useCheckout,
6835
- Ii as useQuote,
6836
- _i as useToast
6835
+ Zr as timerMachine,
6836
+ _i as toastMachine,
6837
+ yi as useAuth,
6838
+ Ei as useCheckout,
6839
+ Ai as useQuote,
6840
+ Si as useToast
6837
6841
  };