@clicktap/state 0.14.2 → 0.14.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.mjs CHANGED
@@ -760,7 +760,7 @@ function Yn(e, t, n, s, {
760
760
  children: a
761
761
  }), o];
762
762
  }
763
- function Xn(e, t) {
763
+ function Qn(e, t) {
764
764
  if (t) {
765
765
  if (e.system._unregister(t), t._processingStatus !== D.Running) {
766
766
  e.stopChild(t);
@@ -774,7 +774,7 @@ function Xn(e, t) {
774
774
  function Yt(e) {
775
775
  function t(n, s) {
776
776
  }
777
- return t.type = "xstate.stopChild", t.actorRef = e, t.resolve = Yn, t.execute = Xn, t;
777
+ return t.type = "xstate.stopChild", t.actorRef = e, t.resolve = Yn, t.execute = Qn, 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 = Qt(t);
815
+ const t = new Set(e), n = Xt(t);
816
816
  for (const s of t)
817
817
  if (s.type === "compound" && (!n.get(s) || !n.get(s).length))
818
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 Xt(e, t) {
834
+ function Qt(e, t) {
835
835
  const n = t.get(e);
836
836
  if (!n)
837
837
  return {};
@@ -845,10 +845,10 @@ function Xt(e, t) {
845
845
  }
846
846
  const s = {};
847
847
  for (const r of n)
848
- s[r.key] = Xt(r, t);
848
+ s[r.key] = Qt(r, t);
849
849
  return s;
850
850
  }
851
- function Qt(e) {
851
+ function Xt(e) {
852
852
  const t = /* @__PURE__ */ new Map();
853
853
  for (const n of e)
854
854
  t.has(n) || t.set(n, []), n.parent && (t.has(n.parent) || t.set(n.parent, []), t.get(n.parent).push(n));
@@ -856,13 +856,13 @@ function Qt(e) {
856
856
  }
857
857
  function Wt(e, t) {
858
858
  const n = Se(t);
859
- return Xt(e, Qt(n));
859
+ return Qt(e, Xt(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] === Cn;
865
- function Qn(e, t) {
865
+ function Xn(e, t) {
866
866
  return e.transitions.get(t) || [...e.transitions.keys()].filter((s) => {
867
867
  if (s === kn)
868
868
  return !0;
@@ -1786,7 +1786,7 @@ function ws(e, t, n, s, {
1786
1786
  } : t.children
1787
1787
  })];
1788
1788
  }
1789
- function C(e) {
1789
+ function O(e) {
1790
1790
  function t(n, s) {
1791
1791
  }
1792
1792
  return t.type = "xstate.assign", t.assignment = e, t.resolve = ws, t;
@@ -1873,7 +1873,7 @@ function bt(e, t, n) {
1873
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 = Os, s.retryResolve = Cs, s.execute = ks, s;
1874
1874
  }
1875
1875
  const Nt = /* @__PURE__ */ new WeakMap();
1876
- function Q(e, t, n) {
1876
+ function X(e, t, n) {
1877
1877
  let s = Nt.get(e);
1878
1878
  return s ? t in s || (s[t] = n()) : (s = {
1879
1879
  [t]: n()
@@ -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 Q(this, "invoke", () => j(this.config.invoke).map((t, n) => {
1952
+ return X(this, "invoke", () => j(this.config.invoke).map((t, n) => {
1953
1953
  const {
1954
1954
  src: s,
1955
1955
  systemId: r
@@ -1979,19 +1979,19 @@ class ct {
1979
1979
  * The mapping of events to transitions.
1980
1980
  */
1981
1981
  get on() {
1982
- return Q(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), {}));
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 Q(this, "delayedTransitions", () => Wn(this));
1985
+ return X(this, "delayedTransitions", () => Wn(this));
1986
1986
  }
1987
1987
  get initial() {
1988
- return Q(this, "initial", () => Zn(this, this.config.initial));
1988
+ return X(this, "initial", () => Zn(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 = Q(this, `candidates-${s}`, () => Qn(this, s));
1994
+ const o = X(this, `candidates-${s}`, () => Xn(this, s));
1995
1995
  for (const a of o) {
1996
1996
  const {
1997
1997
  guard: c
@@ -2015,7 +2015,7 @@ ${d.message}`);
2015
2015
  * All the event types accepted by this state node and its descendants.
2016
2016
  */
2017
2017
  get events() {
2018
- return Q(this, "events", () => {
2018
+ return X(this, "events", () => {
2019
2019
  const {
2020
2020
  states: t
2021
2021
  } = this, n = new Set(this.ownEvents);
@@ -2135,7 +2135,7 @@ class ut {
2135
2135
  children: {},
2136
2136
  status: "active"
2137
2137
  }, this);
2138
- return typeof r == "function" ? se(i, n, t, [C(({
2138
+ return typeof r == "function" ? se(i, n, t, [O(({
2139
2139
  spawn: a,
2140
2140
  event: c,
2141
2141
  self: u
@@ -2309,7 +2309,7 @@ function js() {
2309
2309
  ignoreRefreshToken: !1
2310
2310
  };
2311
2311
  }
2312
- async function Xe(e, t) {
2312
+ async function Qe(e, t) {
2313
2313
  const n = await fetch(e, t);
2314
2314
  return n.status === 200 ? n.json() : Promise.resolve({
2315
2315
  message: n.statusText,
@@ -2318,7 +2318,7 @@ async function Xe(e, t) {
2318
2318
  }
2319
2319
  const $s = V(async ({ input: e }) => {
2320
2320
  var n;
2321
- const t = await Xe(e.endpoint.client, {
2321
+ const t = await Qe(e.endpoint.client, {
2322
2322
  method: "POST",
2323
2323
  mode: "cors",
2324
2324
  credentials: "include",
@@ -2351,7 +2351,7 @@ const $s = V(async ({ input: e }) => {
2351
2351
  if (e.refreshToken === "")
2352
2352
  throw new Error("Unauthorized.");
2353
2353
  try {
2354
- if (t = await Xe(e.endpoint.server, {
2354
+ if (t = await Qe(e.endpoint.server, {
2355
2355
  method: "POST",
2356
2356
  mode: "cors",
2357
2357
  credentials: "include",
@@ -2371,7 +2371,7 @@ const $s = V(async ({ input: e }) => {
2371
2371
  throw console.log(n), new Error("Could not complete refresh request (server)");
2372
2372
  }
2373
2373
  } else {
2374
- if (t = await Xe(e.endpoint.client, {
2374
+ if (t = await Qe(e.endpoint.client, {
2375
2375
  method: "POST",
2376
2376
  mode: "cors",
2377
2377
  credentials: "include",
@@ -2413,13 +2413,13 @@ const $s = V(async ({ input: e }) => {
2413
2413
  input: {}
2414
2414
  },
2415
2415
  actions: {
2416
- addError: C(Ms),
2417
- clearErrors: C(Ls),
2418
- setAccessToken: C(Us),
2419
- setIgnoreRefreshToken: C(Ps),
2420
- setUserContext: C(Fs),
2421
- unsetRefreshToken: C(Bs),
2422
- unsetUserContext: C(js)
2416
+ addError: O(Ms),
2417
+ clearErrors: O(Ls),
2418
+ setAccessToken: O(Us),
2419
+ setIgnoreRefreshToken: O(Ps),
2420
+ setUserContext: O(Fs),
2421
+ unsetRefreshToken: O(Bs),
2422
+ unsetUserContext: O(js)
2423
2423
  },
2424
2424
  actors: {
2425
2425
  authenticate: $s,
@@ -2565,7 +2565,7 @@ const $s = V(async ({ input: e }) => {
2565
2565
  }
2566
2566
  }), an = be(
2567
2567
  {}
2568
- ), li = () => {
2568
+ ), fi = () => {
2569
2569
  const e = Ne(an), [t, n] = Oe(
2570
2570
  typeof window < "u" && e.getSnapshot().value === "loggedIn"
2571
2571
  );
@@ -2579,7 +2579,7 @@ const $s = V(async ({ input: e }) => {
2579
2579
  s.unsubscribe();
2580
2580
  };
2581
2581
  }, [e]), { authActor: e, isLoggedIn: t };
2582
- }, hi = async (e = "", t = {
2582
+ }, pi = async (e = "", t = {
2583
2583
  inspect: void 0,
2584
2584
  endpoints: { login: "", logout: "", refresh: "", ssrRefresh: "" }
2585
2585
  }) => typeof window < "u" ? (console.warn(
@@ -2600,7 +2600,7 @@ const $s = V(async ({ input: e }) => {
2600
2600
  },
2601
2601
  inspect: t.inspect
2602
2602
  }).start();
2603
- function fi({ actor: e, children: t }) {
2603
+ function yi({ actor: e, children: t }) {
2604
2604
  return /* @__PURE__ */ we(an.Provider, { value: e, children: t });
2605
2605
  }
2606
2606
  function zs({
@@ -2613,16 +2613,27 @@ function zs({
2613
2613
  const s = (i = (r = e.steps) == null ? void 0 : r.find(
2614
2614
  (o) => o.name === e.currentStep
2615
2615
  )) == null ? void 0 : i.next;
2616
- return s ? (console.log("nextStep currentStep", e.currentStep), console.log("nextStep next", s), {
2616
+ return s ? {
2617
2617
  currentStep: s ?? e.currentStep
2618
- }) : e;
2618
+ } : e;
2619
+ }
2620
+ function Gs({
2621
+ context: e,
2622
+ event: t
2623
+ }) {
2624
+ if (!t.type.includes("xstate.done.actor"))
2625
+ return e;
2626
+ const n = t;
2627
+ return n.output.type !== "SUBMIT_STEP_DATA_SUCCESS" ? e : {
2628
+ quote: { ...e.quote, ...n.output.quote }
2629
+ };
2619
2630
  }
2620
- const dt = JSON, Gs = (e) => e.toUpperCase(), Js = (e) => {
2631
+ const dt = JSON, Js = (e) => e.toUpperCase(), Ys = (e) => {
2621
2632
  const t = {};
2622
2633
  return e.forEach((n, s) => {
2623
2634
  t[s] = n;
2624
2635
  }), t;
2625
- }, Ys = (e, t, n) => e.document ? e : {
2636
+ }, Qs = (e, t, n) => e.document ? e : {
2626
2637
  document: e,
2627
2638
  variables: t,
2628
2639
  requestHeaders: n,
@@ -2632,11 +2643,11 @@ const dt = JSON, Gs = (e) => e.toUpperCase(), Js = (e) => {
2632
2643
  variables: t,
2633
2644
  requestHeaders: n,
2634
2645
  signal: void 0
2635
- }, Qs = (e, t) => e.documents ? e : {
2646
+ }, Ws = (e, t) => e.documents ? e : {
2636
2647
  documents: e,
2637
2648
  requestHeaders: t,
2638
2649
  signal: void 0
2639
- }, Ws = (e, t, ...n) => {
2650
+ }, Ks = (e, t, ...n) => {
2640
2651
  const [s, r] = n;
2641
2652
  return e.document ? e : {
2642
2653
  url: e,
@@ -2650,20 +2661,20 @@ function ve(e, t) {
2650
2661
  if (!!!e)
2651
2662
  throw new Error(t);
2652
2663
  }
2653
- function Ks(e) {
2664
+ function Zs(e) {
2654
2665
  return typeof e == "object" && e !== null;
2655
2666
  }
2656
- function Zs(e, t) {
2667
+ function er(e, t) {
2657
2668
  if (!!!e)
2658
2669
  throw new Error(
2659
2670
  t ?? "Unexpected invariant triggered."
2660
2671
  );
2661
2672
  }
2662
- const er = /\r\n|[\n\r]/g;
2663
- function Qe(e, t) {
2673
+ const tr = /\r\n|[\n\r]/g;
2674
+ function Xe(e, t) {
2664
2675
  let n = 0, s = 1;
2665
- for (const r of e.body.matchAll(er)) {
2666
- if (typeof r.index == "number" || Zs(!1), r.index >= t)
2676
+ for (const r of e.body.matchAll(tr)) {
2677
+ if (typeof r.index == "number" || er(!1), r.index >= t)
2667
2678
  break;
2668
2679
  n = r.index + r[0].length, s += 1;
2669
2680
  }
@@ -2672,10 +2683,10 @@ function Qe(e, t) {
2672
2683
  column: t + 1 - n
2673
2684
  };
2674
2685
  }
2675
- function tr(e) {
2686
+ function nr(e) {
2676
2687
  return cn(
2677
2688
  e.source,
2678
- Qe(e.source, e.start)
2689
+ Xe(e.source, e.start)
2679
2690
  );
2680
2691
  }
2681
2692
  function cn(e, t) {
@@ -2705,7 +2716,7 @@ function Ct(e) {
2705
2716
  return t.map(([s, r]) => s.padStart(n) + (r ? " " + r : "")).join(`
2706
2717
  `);
2707
2718
  }
2708
- function nr(e) {
2719
+ function sr(e) {
2709
2720
  const t = e[0];
2710
2721
  return t == null || "kind" in t || "length" in t ? {
2711
2722
  nodes: t,
@@ -2757,15 +2768,15 @@ class lt extends Error {
2757
2768
  */
2758
2769
  constructor(t, ...n) {
2759
2770
  var s, r, i;
2760
- const { nodes: o, source: a, positions: c, path: u, originalError: h, extensions: d } = nr(n);
2771
+ const { nodes: o, source: a, positions: c, path: u, originalError: h, extensions: d } = sr(n);
2761
2772
  super(t), this.name = "GraphQLError", this.path = u ?? void 0, this.originalError = h ?? void 0, this.nodes = kt(
2762
2773
  Array.isArray(o) ? o : o ? [o] : void 0
2763
2774
  );
2764
2775
  const f = kt(
2765
2776
  (s = this.nodes) === null || s === void 0 ? void 0 : s.map((y) => y.loc).filter((y) => y != null)
2766
2777
  );
2767
- 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) => Qe(a, y)) : f == null ? void 0 : f.map((y) => Qe(y.source, y.start));
2768
- const m = Ks(
2778
+ 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));
2779
+ const m = Zs(
2769
2780
  h == null ? void 0 : h.extensions
2770
2781
  ) ? h == null ? void 0 : h.extensions : void 0;
2771
2782
  this.extensions = (i = d ?? m) !== null && i !== void 0 ? i : /* @__PURE__ */ Object.create(null), Object.defineProperties(this, {
@@ -2807,7 +2818,7 @@ class lt extends Error {
2807
2818
  for (const n of this.nodes)
2808
2819
  n.loc && (t += `
2809
2820
 
2810
- ` + tr(n.loc));
2821
+ ` + nr(n.loc));
2811
2822
  else if (this.source && this.locations)
2812
2823
  for (const n of this.locations)
2813
2824
  t += `
@@ -2831,7 +2842,7 @@ function b(e, t, n) {
2831
2842
  positions: [t]
2832
2843
  });
2833
2844
  }
2834
- class sr {
2845
+ class rr {
2835
2846
  /**
2836
2847
  * The character offset at which this Node begins.
2837
2848
  */
@@ -2976,10 +2987,10 @@ const dn = {
2976
2987
  UnionTypeExtension: ["name", "directives", "types"],
2977
2988
  EnumTypeExtension: ["name", "directives", "values"],
2978
2989
  InputObjectTypeExtension: ["name", "directives", "fields"]
2979
- }, rr = new Set(Object.keys(dn));
2990
+ }, ir = new Set(Object.keys(dn));
2980
2991
  function Dt(e) {
2981
2992
  const t = e == null ? void 0 : e.kind;
2982
- return typeof t == "string" && rr.has(t);
2993
+ return typeof t == "string" && ir.has(t);
2983
2994
  }
2984
2995
  var ee;
2985
2996
  (function(e) {
@@ -3006,15 +3017,15 @@ function ln(e) {
3006
3017
  function hn(e) {
3007
3018
  return ln(e) || e === 95;
3008
3019
  }
3009
- function ir(e) {
3020
+ function or(e) {
3010
3021
  return ln(e) || de(e) || e === 95;
3011
3022
  }
3012
- function or(e) {
3023
+ function ar(e) {
3013
3024
  var t;
3014
3025
  let n = Number.MAX_SAFE_INTEGER, s = null, r = -1;
3015
3026
  for (let o = 0; o < e.length; ++o) {
3016
3027
  var i;
3017
- const a = e[o], c = ar(a);
3028
+ const a = e[o], c = cr(a);
3018
3029
  c !== a.length && (s = (i = s) !== null && i !== void 0 ? i : o, r = o, o !== 0 && c < n && (n = c));
3019
3030
  }
3020
3031
  return e.map((o, a) => a === 0 ? o : o.slice(n)).slice(
@@ -3022,13 +3033,13 @@ function or(e) {
3022
3033
  r + 1
3023
3034
  );
3024
3035
  }
3025
- function ar(e) {
3036
+ function cr(e) {
3026
3037
  let t = 0;
3027
3038
  for (; t < e.length && Ke(e.charCodeAt(t)); )
3028
3039
  ++t;
3029
3040
  return t;
3030
3041
  }
3031
- function cr(e, t) {
3042
+ function ur(e, t) {
3032
3043
  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
3033
3044
  (!r || e.length > 70 || u || i || o);
3034
3045
  let d = "";
@@ -3041,7 +3052,7 @@ var p;
3041
3052
  (function(e) {
3042
3053
  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";
3043
3054
  })(p || (p = {}));
3044
- class ur {
3055
+ class dr {
3045
3056
  /**
3046
3057
  * The previously focused non-ignored token.
3047
3058
  */
@@ -3078,14 +3089,14 @@ class ur {
3078
3089
  if (t.next)
3079
3090
  t = t.next;
3080
3091
  else {
3081
- const n = lr(this, t.end);
3092
+ const n = hr(this, t.end);
3082
3093
  t.next = n, n.prev = t, t = n;
3083
3094
  }
3084
3095
  while (t.kind === p.COMMENT);
3085
3096
  return t;
3086
3097
  }
3087
3098
  }
3088
- function dr(e) {
3099
+ function lr(e) {
3089
3100
  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;
3090
3101
  }
3091
3102
  function re(e) {
@@ -3100,7 +3111,7 @@ function fn(e) {
3100
3111
  function pn(e) {
3101
3112
  return e >= 56320 && e <= 57343;
3102
3113
  }
3103
- function X(e, t) {
3114
+ function Q(e, t) {
3104
3115
  const n = e.source.body.codePointAt(t);
3105
3116
  if (n === void 0)
3106
3117
  return p.EOF;
@@ -3114,7 +3125,7 @@ function w(e, t, n, s, r) {
3114
3125
  const i = e.line, o = 1 + n - e.lineStart;
3115
3126
  return new un(t, n, s, i, o, r);
3116
3127
  }
3117
- function lr(e, t) {
3128
+ function hr(e, t) {
3118
3129
  const n = e.source.body, s = n.length;
3119
3130
  let r = t;
3120
3131
  for (; r < s; ) {
@@ -3133,7 +3144,7 @@ function lr(e, t) {
3133
3144
  n.charCodeAt(r + 1) === 10 ? r += 2 : ++r, ++e.line, e.lineStart = r;
3134
3145
  continue;
3135
3146
  case 35:
3136
- return hr(e, r);
3147
+ return fr(e, r);
3137
3148
  case 33:
3138
3149
  return w(e, p.BANG, r, r + 1);
3139
3150
  case 36:
@@ -3165,21 +3176,21 @@ function lr(e, t) {
3165
3176
  case 125:
3166
3177
  return w(e, p.BRACE_R, r, r + 1);
3167
3178
  case 34:
3168
- return n.charCodeAt(r + 1) === 34 && n.charCodeAt(r + 2) === 34 ? Er(e, r) : pr(e, r);
3179
+ return n.charCodeAt(r + 1) === 34 && n.charCodeAt(r + 2) === 34 ? vr(e, r) : yr(e, r);
3169
3180
  }
3170
3181
  if (de(i) || i === 45)
3171
- return fr(e, r, i);
3182
+ return pr(e, r, i);
3172
3183
  if (hn(i))
3173
- return vr(e, r);
3184
+ return Tr(e, r);
3174
3185
  throw b(
3175
3186
  e.source,
3176
3187
  r,
3177
- i === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : re(i) || De(n, r) ? `Unexpected character: ${X(e, r)}.` : `Invalid character: ${X(e, r)}.`
3188
+ i === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : re(i) || De(n, r) ? `Unexpected character: ${Q(e, r)}.` : `Invalid character: ${Q(e, r)}.`
3178
3189
  );
3179
3190
  }
3180
3191
  return w(e, p.EOF, s, s);
3181
3192
  }
3182
- function hr(e, t) {
3193
+ function fr(e, t) {
3183
3194
  const n = e.source.body, s = n.length;
3184
3195
  let r = t + 1;
3185
3196
  for (; r < s; ) {
@@ -3201,7 +3212,7 @@ function hr(e, t) {
3201
3212
  n.slice(t + 1, r)
3202
3213
  );
3203
3214
  }
3204
- function fr(e, t, n) {
3215
+ function pr(e, t, n) {
3205
3216
  const s = e.source.body;
3206
3217
  let r = t, i = n, o = !1;
3207
3218
  if (i === 45 && (i = s.charCodeAt(++r)), i === 48) {
@@ -3209,7 +3220,7 @@ function fr(e, t, n) {
3209
3220
  throw b(
3210
3221
  e.source,
3211
3222
  r,
3212
- `Invalid number, unexpected digit after 0: ${X(
3223
+ `Invalid number, unexpected digit after 0: ${Q(
3213
3224
  e,
3214
3225
  r
3215
3226
  )}.`
@@ -3220,7 +3231,7 @@ function fr(e, t, n) {
3220
3231
  throw b(
3221
3232
  e.source,
3222
3233
  r,
3223
- `Invalid number, expected digit but got: ${X(
3234
+ `Invalid number, expected digit but got: ${Q(
3224
3235
  e,
3225
3236
  r
3226
3237
  )}.`
@@ -3238,7 +3249,7 @@ function Be(e, t, n) {
3238
3249
  throw b(
3239
3250
  e.source,
3240
3251
  t,
3241
- `Invalid number, expected digit but got: ${X(
3252
+ `Invalid number, expected digit but got: ${Q(
3242
3253
  e,
3243
3254
  t
3244
3255
  )}.`
@@ -3249,7 +3260,7 @@ function Be(e, t, n) {
3249
3260
  ++r;
3250
3261
  return r;
3251
3262
  }
3252
- function pr(e, t) {
3263
+ function yr(e, t) {
3253
3264
  const n = e.source.body, s = n.length;
3254
3265
  let r = t + 1, i = r, o = "";
3255
3266
  for (; r < s; ) {
@@ -3258,7 +3269,7 @@ function pr(e, t) {
3258
3269
  return o += n.slice(i, r), w(e, p.STRING, t, r + 1, o);
3259
3270
  if (a === 92) {
3260
3271
  o += n.slice(i, r);
3261
- const c = n.charCodeAt(r + 1) === 117 ? n.charCodeAt(r + 2) === 123 ? yr(e, r) : mr(e, r) : gr(e, r);
3272
+ const c = n.charCodeAt(r + 1) === 117 ? n.charCodeAt(r + 2) === 123 ? mr(e, r) : gr(e, r) : Er(e, r);
3262
3273
  o += c.value, r += c.size, i = r;
3263
3274
  continue;
3264
3275
  }
@@ -3272,7 +3283,7 @@ function pr(e, t) {
3272
3283
  throw b(
3273
3284
  e.source,
3274
3285
  r,
3275
- `Invalid character within String: ${X(
3286
+ `Invalid character within String: ${Q(
3276
3287
  e,
3277
3288
  r
3278
3289
  )}.`
@@ -3280,7 +3291,7 @@ function pr(e, t) {
3280
3291
  }
3281
3292
  throw b(e.source, r, "Unterminated string.");
3282
3293
  }
3283
- function yr(e, t) {
3294
+ function mr(e, t) {
3284
3295
  const n = e.source.body;
3285
3296
  let s = 0, r = 3;
3286
3297
  for (; r < 12; ) {
@@ -3305,7 +3316,7 @@ function yr(e, t) {
3305
3316
  )}".`
3306
3317
  );
3307
3318
  }
3308
- function mr(e, t) {
3319
+ function gr(e, t) {
3309
3320
  const n = e.source.body, s = Rt(n, t + 2);
3310
3321
  if (re(s))
3311
3322
  return {
@@ -3332,7 +3343,7 @@ function Rt(e, t) {
3332
3343
  function ae(e) {
3333
3344
  return e >= 48 && e <= 57 ? e - 48 : e >= 65 && e <= 70 ? e - 55 : e >= 97 && e <= 102 ? e - 87 : -1;
3334
3345
  }
3335
- function gr(e, t) {
3346
+ function Er(e, t) {
3336
3347
  const n = e.source.body;
3337
3348
  switch (n.charCodeAt(t + 1)) {
3338
3349
  case 34:
@@ -3386,7 +3397,7 @@ function gr(e, t) {
3386
3397
  )}".`
3387
3398
  );
3388
3399
  }
3389
- function Er(e, t) {
3400
+ function vr(e, t) {
3390
3401
  const n = e.source.body, s = n.length;
3391
3402
  let r = e.lineStart, i = t + 3, o = i, a = "";
3392
3403
  const c = [];
@@ -3400,7 +3411,7 @@ function Er(e, t) {
3400
3411
  t,
3401
3412
  i + 3,
3402
3413
  // Return a string of the lines joined with U+000A.
3403
- or(c).join(`
3414
+ ar(c).join(`
3404
3415
  `)
3405
3416
  );
3406
3417
  return e.line += c.length - 1, e.lineStart = r, h;
@@ -3421,7 +3432,7 @@ function Er(e, t) {
3421
3432
  throw b(
3422
3433
  e.source,
3423
3434
  i,
3424
- `Invalid character within String: ${X(
3435
+ `Invalid character within String: ${Q(
3425
3436
  e,
3426
3437
  i
3427
3438
  )}.`
@@ -3429,12 +3440,12 @@ function Er(e, t) {
3429
3440
  }
3430
3441
  throw b(e.source, i, "Unterminated string.");
3431
3442
  }
3432
- function vr(e, t) {
3443
+ function Tr(e, t) {
3433
3444
  const n = e.source.body, s = n.length;
3434
3445
  let r = t + 1;
3435
3446
  for (; r < s; ) {
3436
3447
  const i = n.charCodeAt(r);
3437
- if (ir(i))
3448
+ if (or(i))
3438
3449
  ++r;
3439
3450
  else
3440
3451
  break;
@@ -3447,7 +3458,7 @@ function vr(e, t) {
3447
3458
  n.slice(t, r)
3448
3459
  );
3449
3460
  }
3450
- const Tr = 10, yn = 2;
3461
+ const _r = 10, yn = 2;
3451
3462
  function ht(e) {
3452
3463
  return Re(e, []);
3453
3464
  }
@@ -3458,45 +3469,45 @@ function Re(e, t) {
3458
3469
  case "function":
3459
3470
  return e.name ? `[function ${e.name}]` : "[function]";
3460
3471
  case "object":
3461
- return _r(e, t);
3472
+ return Sr(e, t);
3462
3473
  default:
3463
3474
  return String(e);
3464
3475
  }
3465
3476
  }
3466
- function _r(e, t) {
3477
+ function Sr(e, t) {
3467
3478
  if (e === null)
3468
3479
  return "null";
3469
3480
  if (t.includes(e))
3470
3481
  return "[Circular]";
3471
3482
  const n = [...t, e];
3472
- if (Sr(e)) {
3483
+ if (Ir(e)) {
3473
3484
  const s = e.toJSON();
3474
3485
  if (s !== e)
3475
3486
  return typeof s == "string" ? s : Re(s, n);
3476
3487
  } else if (Array.isArray(e))
3477
- return Ar(e, n);
3478
- return Ir(e, n);
3488
+ return xr(e, n);
3489
+ return Ar(e, n);
3479
3490
  }
3480
- function Sr(e) {
3491
+ function Ir(e) {
3481
3492
  return typeof e.toJSON == "function";
3482
3493
  }
3483
- function Ir(e, t) {
3494
+ function Ar(e, t) {
3484
3495
  const n = Object.entries(e);
3485
- return n.length === 0 ? "{}" : t.length > yn ? "[" + xr(e) + "]" : "{ " + n.map(
3496
+ return n.length === 0 ? "{}" : t.length > yn ? "[" + wr(e) + "]" : "{ " + n.map(
3486
3497
  ([r, i]) => r + ": " + Re(i, t)
3487
3498
  ).join(", ") + " }";
3488
3499
  }
3489
- function Ar(e, t) {
3500
+ function xr(e, t) {
3490
3501
  if (e.length === 0)
3491
3502
  return "[]";
3492
3503
  if (t.length > yn)
3493
3504
  return "[Array]";
3494
- const n = Math.min(Tr, e.length), s = e.length - n, r = [];
3505
+ const n = Math.min(_r, e.length), s = e.length - n, r = [];
3495
3506
  for (let i = 0; i < n; ++i)
3496
3507
  r.push(Re(e[i], t));
3497
3508
  return s === 1 ? r.push("... 1 more item") : s > 1 && r.push(`... ${s} more items`), "[" + r.join(", ") + "]";
3498
3509
  }
3499
- function xr(e) {
3510
+ function wr(e) {
3500
3511
  const t = Object.prototype.toString.call(e).replace(/^\[object /, "").replace(/]$/, "");
3501
3512
  if (t === "Object" && typeof e.constructor == "function") {
3502
3513
  const n = e.constructor.name;
@@ -3505,10 +3516,11 @@ function xr(e) {
3505
3516
  }
3506
3517
  return t;
3507
3518
  }
3508
- const wr = (
3519
+ const br = globalThis.process && // eslint-disable-next-line no-undef
3520
+ process.env.NODE_ENV === "production", Nr = (
3509
3521
  /* c8 ignore next 6 */
3510
3522
  // FIXME: https://github.com/graphql/graphql-js/issues/2317
3511
- globalThis.process && globalThis.process.env.NODE_ENV === "production" ? function(t, n) {
3523
+ br ? function(t, n) {
3512
3524
  return t instanceof n;
3513
3525
  } : function(t, n) {
3514
3526
  if (t instanceof n)
@@ -3555,16 +3567,16 @@ class mn {
3555
3567
  return "Source";
3556
3568
  }
3557
3569
  }
3558
- function br(e) {
3559
- return wr(e, mn);
3570
+ function Or(e) {
3571
+ return Nr(e, mn);
3560
3572
  }
3561
- function Nr(e, t) {
3562
- return new Or(e, t).parseDocument();
3573
+ function Cr(e, t) {
3574
+ return new kr(e, t).parseDocument();
3563
3575
  }
3564
- class Or {
3576
+ class kr {
3565
3577
  constructor(t, n = {}) {
3566
- const s = br(t) ? t : new mn(t);
3567
- this._lexer = new ur(s), this._options = n, this._tokenCounter = 0;
3578
+ const s = Or(t) ? t : new mn(t);
3579
+ this._lexer = new dr(s), this._options = n, this._tokenCounter = 0;
3568
3580
  }
3569
3581
  /**
3570
3582
  * Converts a name lex token into a name parse node.
@@ -4531,7 +4543,7 @@ class Or {
4531
4543
  * given parsed object.
4532
4544
  */
4533
4545
  node(t, n) {
4534
- return this._options.noLocation !== !0 && (n.loc = new sr(
4546
+ return this._options.noLocation !== !0 && (n.loc = new rr(
4535
4547
  t,
4536
4548
  this._lexer.lastToken,
4537
4549
  this._lexer.source
@@ -4667,16 +4679,16 @@ function ge(e) {
4667
4679
  return gn(e.kind) + (t != null ? ` "${t}"` : "");
4668
4680
  }
4669
4681
  function gn(e) {
4670
- return dr(e) ? `"${e}"` : e;
4671
- }
4672
- function Cr(e) {
4673
- return `"${e.replace(kr, Dr)}"`;
4682
+ return lr(e) ? `"${e}"` : e;
4674
4683
  }
4675
- const kr = /[\x00-\x1f\x22\x5c\x7f-\x9f]/g;
4676
4684
  function Dr(e) {
4677
- return Rr[e.charCodeAt(0)];
4685
+ return `"${e.replace(Rr, qr)}"`;
4686
+ }
4687
+ const Rr = /[\x00-\x1f\x22\x5c\x7f-\x9f]/g;
4688
+ function qr(e) {
4689
+ return Mr[e.charCodeAt(0)];
4678
4690
  }
4679
- const Rr = [
4691
+ const Mr = [
4680
4692
  "\\u0000",
4681
4693
  "\\u0001",
4682
4694
  "\\u0002",
@@ -4842,11 +4854,11 @@ const Rr = [
4842
4854
  "\\u009D",
4843
4855
  "\\u009E",
4844
4856
  "\\u009F"
4845
- ], qr = Object.freeze({});
4846
- function Mr(e, t, n = dn) {
4857
+ ], Lr = Object.freeze({});
4858
+ function Ur(e, t, n = dn) {
4847
4859
  const s = /* @__PURE__ */ new Map();
4848
4860
  for (const x of Object.values(T))
4849
- s.set(x, Lr(t, x));
4861
+ s.set(x, Pr(t, x));
4850
4862
  let r, i = Array.isArray(e), o = [e], a = -1, c = [], u = e, h, d;
4851
4863
  const f = [], m = [];
4852
4864
  do {
@@ -4880,7 +4892,7 @@ function Mr(e, t, n = dn) {
4880
4892
  var y, v;
4881
4893
  Dt(u) || ve(!1, `Invalid AST Node: ${ht(u)}.`);
4882
4894
  const q = x ? (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;
4883
- if (k = q == null ? void 0 : q.call(t, u, h, d, f, m), k === qr)
4895
+ if (k = q == null ? void 0 : q.call(t, u, h, d, f, m), k === Lr)
4884
4896
  break;
4885
4897
  if (k === !1) {
4886
4898
  if (!x) {
@@ -4910,7 +4922,7 @@ function Mr(e, t, n = dn) {
4910
4922
  } while (r !== void 0);
4911
4923
  return c.length !== 0 ? c[c.length - 1][1] : e;
4912
4924
  }
4913
- function Lr(e, t) {
4925
+ function Pr(e, t) {
4914
4926
  const n = e[t];
4915
4927
  return typeof n == "object" ? n : typeof n == "function" ? {
4916
4928
  enter: n,
@@ -4921,9 +4933,9 @@ function Lr(e, t) {
4921
4933
  };
4922
4934
  }
4923
4935
  function En(e) {
4924
- return Mr(e, Pr);
4936
+ return Ur(e, Br);
4925
4937
  }
4926
- const Ur = 80, Pr = {
4938
+ const Fr = 80, Br = {
4927
4939
  Name: {
4928
4940
  leave: (e) => e.value
4929
4941
  },
@@ -4959,7 +4971,7 @@ const Ur = 80, Pr = {
4959
4971
  leave({ alias: e, name: t, arguments: n, directives: s, selectionSet: r }) {
4960
4972
  const i = S("", e, ": ") + t;
4961
4973
  let o = i + S("(", E(n, ", "), ")");
4962
- return o.length > Ur && (o = i + S(`(
4974
+ return o.length > Fr && (o = i + S(`(
4963
4975
  `, Te(E(n, `
4964
4976
  `)), `
4965
4977
  )`)), E([o, E(s, " "), r], " ");
@@ -4997,7 +5009,7 @@ const Ur = 80, Pr = {
4997
5009
  leave: ({ value: e }) => e
4998
5010
  },
4999
5011
  StringValue: {
5000
- leave: ({ value: e, block: t }) => t ? cr(e) : Cr(e)
5012
+ leave: ({ value: e, block: t }) => t ? ur(e) : Dr(e)
5001
5013
  },
5002
5014
  BooleanValue: {
5003
5015
  leave: ({ value: e }) => e ? "true" : "false"
@@ -5191,7 +5203,7 @@ const Mt = (e) => {
5191
5203
  if (typeof e == "string") {
5192
5204
  let n;
5193
5205
  try {
5194
- const s = Nr(e);
5206
+ const s = Cr(e);
5195
5207
  n = Mt(s);
5196
5208
  } catch {
5197
5209
  }
@@ -5213,13 +5225,13 @@ class ce extends Error {
5213
5225
  return ((s = (n = t.errors) == null ? void 0 : n[0]) == null ? void 0 : s.message) ?? `GraphQL Error (Code: ${t.status})`;
5214
5226
  }
5215
5227
  }
5216
- var Fr = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
5217
- function Br(e) {
5228
+ var jr = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
5229
+ function $r(e) {
5218
5230
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
5219
5231
  }
5220
5232
  var Ze = { exports: {} };
5221
5233
  (function(e, t) {
5222
- var n = typeof self < "u" ? self : Fr, s = function() {
5234
+ var n = typeof self < "u" ? self : jr, s = function() {
5223
5235
  function i() {
5224
5236
  this.fetch = !1, this.DOMException = n.DOMException;
5225
5237
  }
@@ -5339,8 +5351,8 @@ var Ze = { exports: {} };
5339
5351
  return g.readAsText(l), _;
5340
5352
  }
5341
5353
  function k(l) {
5342
- for (var g = new Uint8Array(l), _ = new Array(g.length), O = 0; O < g.length; O++)
5343
- _[O] = String.fromCharCode(g[O]);
5354
+ for (var g = new Uint8Array(l), _ = new Array(g.length), C = 0; C < g.length; C++)
5355
+ _[C] = String.fromCharCode(g[C]);
5344
5356
  return _.join("");
5345
5357
  }
5346
5358
  function q(l) {
@@ -5407,15 +5419,15 @@ var Ze = { exports: {} };
5407
5419
  var g = new FormData();
5408
5420
  return l.trim().split("&").forEach(function(_) {
5409
5421
  if (_) {
5410
- var O = _.split("="), N = O.shift().replace(/\+/g, " "), A = O.join("=").replace(/\+/g, " ");
5422
+ var C = _.split("="), N = C.shift().replace(/\+/g, " "), A = C.join("=").replace(/\+/g, " ");
5411
5423
  g.append(decodeURIComponent(N), decodeURIComponent(A));
5412
5424
  }
5413
5425
  }), g;
5414
5426
  }
5415
5427
  function pe(l) {
5416
5428
  var g = new y(), _ = l.replace(/\r?\n[\t ]+/g, " ");
5417
- return _.split(/\r?\n/).forEach(function(O) {
5418
- var N = O.split(":"), A = N.shift().trim();
5429
+ return _.split(/\r?\n/).forEach(function(C) {
5430
+ var N = C.split(":"), A = N.shift().trim();
5419
5431
  if (A) {
5420
5432
  var ye = N.join(":").trim();
5421
5433
  g.append(A, ye);
@@ -5448,15 +5460,15 @@ var Ze = { exports: {} };
5448
5460
  } catch {
5449
5461
  o.DOMException = function(g, _) {
5450
5462
  this.message = g, this.name = _;
5451
- var O = Error(g);
5452
- this.stack = O.stack;
5463
+ var C = Error(g);
5464
+ this.stack = C.stack;
5453
5465
  }, o.DOMException.prototype = Object.create(Error.prototype), o.DOMException.prototype.constructor = o.DOMException;
5454
5466
  }
5455
5467
  function Me(l, g) {
5456
- return new Promise(function(_, O) {
5468
+ return new Promise(function(_, C) {
5457
5469
  var N = new L(l, g);
5458
5470
  if (N.signal && N.signal.aborted)
5459
- return O(new o.DOMException("Aborted", "AbortError"));
5471
+ return C(new o.DOMException("Aborted", "AbortError"));
5460
5472
  var A = new XMLHttpRequest();
5461
5473
  function ye() {
5462
5474
  A.abort();
@@ -5471,11 +5483,11 @@ var Ze = { exports: {} };
5471
5483
  var Le = "response" in A ? A.response : A.responseText;
5472
5484
  _(new U(Le, ie));
5473
5485
  }, A.onerror = function() {
5474
- O(new TypeError("Network request failed"));
5486
+ C(new TypeError("Network request failed"));
5475
5487
  }, A.ontimeout = function() {
5476
- O(new TypeError("Network request failed"));
5488
+ C(new TypeError("Network request failed"));
5477
5489
  }, A.onabort = function() {
5478
- O(new o.DOMException("Aborted", "AbortError"));
5490
+ C(new o.DOMException("Aborted", "AbortError"));
5479
5491
  }, A.open(N.method, N.url, !0), N.credentials === "include" ? A.withCredentials = !0 : N.credentials === "omit" && (A.withCredentials = !1), "responseType" in A && a.blob && (A.responseType = "blob"), N.headers.forEach(function(ie, Le) {
5480
5492
  A.setRequestHeader(Le, ie);
5481
5493
  }), N.signal && (N.signal.addEventListener("abort", ye), A.onreadystatechange = function() {
@@ -5490,15 +5502,15 @@ var Ze = { exports: {} };
5490
5502
  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;
5491
5503
  })(Ze, Ze.exports);
5492
5504
  var xe = Ze.exports;
5493
- const _e = /* @__PURE__ */ Br(xe), jr = /* @__PURE__ */ xn({
5505
+ const _e = /* @__PURE__ */ $r(xe), Vr = /* @__PURE__ */ xn({
5494
5506
  __proto__: null,
5495
5507
  default: _e
5496
5508
  }, [xe]), W = (e) => {
5497
5509
  let t = {};
5498
- return e && (typeof Headers < "u" && e instanceof Headers || jr && xe.Headers && e instanceof xe.Headers ? t = Js(e) : Array.isArray(e) ? e.forEach(([n, s]) => {
5510
+ return e && (typeof Headers < "u" && e instanceof Headers || Vr && xe.Headers && e instanceof xe.Headers ? t = Ys(e) : Array.isArray(e) ? e.forEach(([n, s]) => {
5499
5511
  n && s !== void 0 && (t[n] = s);
5500
5512
  }) : t = e), t;
5501
- }, Lt = (e) => e.replace(/([\s,]|#[^\n\r]+)+/g, " ").trim(), $r = (e) => {
5513
+ }, Lt = (e) => e.replace(/([\s,]|#[^\n\r]+)+/g, " ").trim(), Hr = (e) => {
5502
5514
  if (!Array.isArray(e.query)) {
5503
5515
  const s = e, r = [`query=${encodeURIComponent(Lt(s.query))}`];
5504
5516
  return e.variables && r.push(`variables=${encodeURIComponent(s.jsonSerializer.stringify(s.variables))}`), s.operationName && r.push(`operationName=${encodeURIComponent(s.operationName)}`), r.join("&");
@@ -5510,10 +5522,10 @@ const _e = /* @__PURE__ */ Br(xe), jr = /* @__PURE__ */ xn({
5510
5522
  variables: t.variables ? t.jsonSerializer.stringify(t.variables[i]) : void 0
5511
5523
  }), s), []);
5512
5524
  return `query=${encodeURIComponent(t.jsonSerializer.stringify(n))}`;
5513
- }, Vr = (e) => async (t) => {
5525
+ }, zr = (e) => async (t) => {
5514
5526
  const { url: n, query: s, variables: r, operationName: i, fetch: o, fetchOptions: a, middleware: c } = t, u = { ...t.headers };
5515
5527
  let h = "", d;
5516
- e === "POST" ? (d = Hr(s, r, i, a.jsonSerializer), typeof d == "string" && (u["Content-Type"] = "application/json")) : h = $r({
5528
+ e === "POST" ? (d = Gr(s, r, i, a.jsonSerializer), typeof d == "string" && (u["Content-Type"] = "application/json")) : h = Hr({
5517
5529
  query: s,
5518
5530
  variables: r,
5519
5531
  operationName: i,
@@ -5557,7 +5569,7 @@ class vn {
5557
5569
  };
5558
5570
  }
5559
5571
  async request(t, ...n) {
5560
- const [s, r] = n, i = Ys(t, s, r), { headers: o, fetch: a = _e, method: c = "POST", requestMiddleware: u, responseMiddleware: h, ...d } = this.requestConfig, { url: f } = this;
5572
+ const [s, r] = n, i = Qs(t, s, r), { headers: o, fetch: a = _e, method: c = "POST", requestMiddleware: u, responseMiddleware: h, ...d } = this.requestConfig, { url: f } = this;
5561
5573
  i.signal !== void 0 && (d.signal = i.signal);
5562
5574
  const { query: m, operationName: y } = je(i.document);
5563
5575
  return $e({
@@ -5579,7 +5591,7 @@ class vn {
5579
5591
  }
5580
5592
  // prettier-ignore
5581
5593
  batchRequests(t, n) {
5582
- const s = Qs(t, n), { headers: r, ...i } = this.requestConfig;
5594
+ const s = Ws(t, n), { headers: r, ...i } = this.requestConfig;
5583
5595
  s.signal !== void 0 && (i.signal = s.signal);
5584
5596
  const o = s.documents.map(({ document: c }) => je(c).query), a = s.documents.map(({ variables: c }) => c);
5585
5597
  return $e({
@@ -5618,7 +5630,7 @@ class vn {
5618
5630
  }
5619
5631
  }
5620
5632
  const $e = async (e) => {
5621
- const { query: t, variables: n, fetchOptions: s } = e, r = Vr(Gs(e.method ?? "post")), i = Array.isArray(e.query), o = await r(e), a = await zr(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";
5633
+ const { query: t, variables: n, fetchOptions: s } = e, r = zr(Js(e.method ?? "post")), i = Array.isArray(e.query), o = await r(e), a = await Jr(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";
5622
5634
  if (o.ok && u && c) {
5623
5635
  const { errors: h, ...d } = (Array.isArray(a), a), f = s.errorPolicy === "ignore" ? d : a;
5624
5636
  return {
@@ -5638,12 +5650,12 @@ const $e = async (e) => {
5638
5650
  }
5639
5651
  };
5640
5652
  async function qe(e, t, ...n) {
5641
- const s = Ws(e, t, ...n);
5653
+ const s = Ks(e, t, ...n);
5642
5654
  return new vn(s.url).request({
5643
5655
  ...s
5644
5656
  });
5645
5657
  }
5646
- const Hr = (e, t, n, s) => {
5658
+ const Gr = (e, t, n, s) => {
5647
5659
  const r = s ?? dt;
5648
5660
  if (!Array.isArray(e))
5649
5661
  return r.stringify({ query: e, variables: t, operationName: n });
@@ -5651,12 +5663,12 @@ const Hr = (e, t, n, s) => {
5651
5663
  throw new Error("Cannot create request body with given variable type, array expected");
5652
5664
  const i = e.reduce((o, a, c) => (o.push({ query: a, variables: t ? t[c] : void 0 }), o), []);
5653
5665
  return r.stringify(i);
5654
- }, zr = async (e, t) => {
5666
+ }, Jr = async (e, t) => {
5655
5667
  let n;
5656
5668
  return e.headers.forEach((s, r) => {
5657
5669
  r.toLowerCase() === "content-type" && (n = s);
5658
5670
  }), 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();
5659
- }, Ve = (e) => typeof e == "function" ? e() : e, Gr = V(async ({ input: e }) => {
5671
+ }, Ve = (e) => typeof e == "function" ? e() : e, Yr = V(async ({ input: e }) => {
5660
5672
  var t;
5661
5673
  if (!e.endpoint || e.endpoint === "")
5662
5674
  throw new Error("No endpoint provided.");
@@ -5688,15 +5700,18 @@ const Hr = (e, t, n, s) => {
5688
5700
  } catch {
5689
5701
  throw console.log("Request to add submit step data failed."), new Error("Request to add submit step data failed.");
5690
5702
  }
5691
- }), Jr = ({ context: e }) => Object.keys(e.quote).length > 0, Ut = he({
5703
+ }), Qr = ({ context: e }) => Object.keys(e.quote).length > 0, Ut = he({
5692
5704
  types: {
5693
5705
  context: {},
5694
5706
  events: {},
5695
5707
  input: {}
5696
5708
  },
5697
- actions: { nextStep: C(zs) },
5698
- actors: { submitStepData: Gr },
5699
- guards: { quoteExists: Jr }
5709
+ actions: {
5710
+ nextStep: O(zs),
5711
+ updateQuote: O(Gs)
5712
+ },
5713
+ actors: { submitStepData: Yr },
5714
+ guards: { quoteExists: Qr }
5700
5715
  }).createMachine({
5701
5716
  /** @todo do we need to add the view to the id? (e.g. checkout_en-us) */
5702
5717
  id: "checkout",
@@ -5792,7 +5807,7 @@ const Hr = (e, t, n, s) => {
5792
5807
  * how to handle quote and checkout being synced here?
5793
5808
  */
5794
5809
  // actions: ['updateQuote', 'updateCheckout', 'nextStep'],
5795
- actions: ["nextStep"],
5810
+ actions: ["updateQuote", "nextStep"],
5796
5811
  target: "showStep"
5797
5812
  }
5798
5813
  ],
@@ -5832,7 +5847,7 @@ const Hr = (e, t, n, s) => {
5832
5847
  // SYNC_IS_LOGGED_IN: '.syncIsLoggedIn',
5833
5848
  // SYNC_QUOTE: '.syncQuote',
5834
5849
  // },
5835
- }), Tn = be({}), pi = () => {
5850
+ }), Tn = be({}), mi = () => {
5836
5851
  const e = Ne(Tn);
5837
5852
  if (!e || !e.getSnapshot)
5838
5853
  throw new Error("checkoutActor is not properly initialized");
@@ -5857,7 +5872,7 @@ const Hr = (e, t, n, s) => {
5857
5872
  checkoutActor: e,
5858
5873
  currentStep: s
5859
5874
  };
5860
- }, yi = async (e = {
5875
+ }, gi = async (e = {
5861
5876
  inspect: void 0,
5862
5877
  currentStep: "",
5863
5878
  steps: [],
@@ -5887,11 +5902,11 @@ const Hr = (e, t, n, s) => {
5887
5902
  },
5888
5903
  inspect: e.inspect
5889
5904
  }).start();
5890
- function mi({ actor: e, children: t }) {
5905
+ function Ei({ actor: e, children: t }) {
5891
5906
  return /* @__PURE__ */ we(Tn.Provider, { value: e, children: t });
5892
5907
  }
5893
- let Yr = (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), "");
5894
- const Xr = he({
5908
+ let Xr = (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), "");
5909
+ const Wr = he({
5895
5910
  actors: {
5896
5911
  tick: As(
5897
5912
  ({ sendBack: e, input: t }) => {
@@ -5958,7 +5973,7 @@ const Xr = he({
5958
5973
  ],
5959
5974
  on: {
5960
5975
  TICK: {
5961
- actions: C(({ context: e, event: t }) => t.type !== "TICK" ? e : {
5976
+ actions: O(({ context: e, event: t }) => t.type !== "TICK" ? e : {
5962
5977
  elapsed: e.elapsed + e.interval
5963
5978
  })
5964
5979
  },
@@ -5969,9 +5984,9 @@ const Xr = he({
5969
5984
  type: "final"
5970
5985
  }
5971
5986
  }
5972
- }), gi = he({
5987
+ }), vi = he({
5973
5988
  actors: {
5974
- timer: Xr
5989
+ timer: Wr
5975
5990
  },
5976
5991
  types: {
5977
5992
  context: {},
@@ -5979,10 +5994,10 @@ const Xr = he({
5979
5994
  input: {}
5980
5995
  },
5981
5996
  actions: {
5982
- addItem: C(({ context: e, event: t }) => {
5997
+ addItem: O(({ context: e, event: t }) => {
5983
5998
  if (t.type !== "ADD_ITEM")
5984
5999
  return e;
5985
- const n = `notification-${Yr()}`, s = t.duration ?? e.duration, r = An(t.item, {
6000
+ const n = `notification-${Xr()}`, s = t.duration ?? e.duration, r = An(t.item, {
5986
6001
  duration: s,
5987
6002
  id: n,
5988
6003
  key: t.item.key ?? n,
@@ -5997,7 +6012,7 @@ const Xr = he({
5997
6012
  activeItem: n
5998
6013
  };
5999
6014
  }),
6000
- removeItem: C(({ context: e, event: t }) => {
6015
+ removeItem: O(({ context: e, event: t }) => {
6001
6016
  if (t.type !== "REMOVE_ITEM" && t.type !== "xstate.done.actor.timer")
6002
6017
  return e;
6003
6018
  const n = e.items;
@@ -6094,7 +6109,7 @@ const Xr = he({
6094
6109
  }
6095
6110
  }), _n = be(
6096
6111
  {}
6097
- ), Ei = () => {
6112
+ ), Ti = () => {
6098
6113
  const e = Ne(_n);
6099
6114
  if (!e || !e.getSnapshot)
6100
6115
  throw new Error("toastActor is not properly initialized");
@@ -6115,10 +6130,10 @@ const Xr = he({
6115
6130
  };
6116
6131
  }, [e]), { toastActor: e };
6117
6132
  };
6118
- function vi({ children: e, actor: t }) {
6133
+ function _i({ children: e, actor: t }) {
6119
6134
  return /* @__PURE__ */ we(_n.Provider, { value: t, children: e });
6120
6135
  }
6121
- function Qr({
6136
+ function Kr({
6122
6137
  context: e,
6123
6138
  event: t
6124
6139
  }) {
@@ -6130,7 +6145,7 @@ function Qr({
6130
6145
  itemsAdded: n.output.itemsAdded
6131
6146
  };
6132
6147
  }
6133
- function Wr({
6148
+ function Zr({
6134
6149
  event: e
6135
6150
  }) {
6136
6151
  if (!e.type.includes("xstate.done.actor"))
@@ -6141,7 +6156,7 @@ function Wr({
6141
6156
  itemsAdded: t.output.itemsAdded
6142
6157
  };
6143
6158
  }
6144
- function Kr({
6159
+ function ei({
6145
6160
  event: e
6146
6161
  }) {
6147
6162
  if (!e.type.includes("xstate.done.actor"))
@@ -6152,7 +6167,7 @@ function Kr({
6152
6167
  itemsRemoved: t.output.itemsRemoved
6153
6168
  };
6154
6169
  }
6155
- function Zr({
6170
+ function ti({
6156
6171
  event: e
6157
6172
  }) {
6158
6173
  if (!e.type.includes("xstate.done.actor"))
@@ -6169,7 +6184,7 @@ function Zr({
6169
6184
  itemsUpdated: t.output.itemsUpdated
6170
6185
  };
6171
6186
  }
6172
- function ei({
6187
+ function ni({
6173
6188
  context: e,
6174
6189
  event: t
6175
6190
  }) {
@@ -6181,7 +6196,7 @@ function ei({
6181
6196
  itemsRemoved: n.output.itemsRemoved
6182
6197
  };
6183
6198
  }
6184
- function ti({
6199
+ function si({
6185
6200
  context: e,
6186
6201
  event: t
6187
6202
  }) {
@@ -6192,7 +6207,7 @@ function ti({
6192
6207
  quote: { ...e.quote, ...n.output.quote }
6193
6208
  };
6194
6209
  }
6195
- function ni({
6210
+ function ri({
6196
6211
  context: e,
6197
6212
  event: t
6198
6213
  }) {
@@ -6204,7 +6219,7 @@ function ni({
6204
6219
  itemsUpdated: n.output.itemsUpdated
6205
6220
  };
6206
6221
  }
6207
- const si = V(
6222
+ const ii = V(
6208
6223
  async ({ input: e }) => {
6209
6224
  var t;
6210
6225
  if (!e.endpoint || e.endpoint === "")
@@ -6233,7 +6248,7 @@ const si = V(
6233
6248
  throw new Error("Request to add item(s) failed.");
6234
6249
  }
6235
6250
  }
6236
- ), ri = V(async ({ input: e }) => {
6251
+ ), oi = V(async ({ input: e }) => {
6237
6252
  var t;
6238
6253
  if (!e.endpoint || e.endpoint === "")
6239
6254
  throw new Error("No endpoint provided.");
@@ -6257,7 +6272,7 @@ const si = V(
6257
6272
  } catch {
6258
6273
  throw new Error("Request to remove item(s) failed.");
6259
6274
  }
6260
- }), He = typeof window > "u", ii = V(
6275
+ }), He = typeof window > "u", ai = V(
6261
6276
  async ({ input: e }) => {
6262
6277
  var n, s, r, i;
6263
6278
  if (!e.endpoint)
@@ -6299,7 +6314,7 @@ const si = V(
6299
6314
  throw console.log("refresh error", o), new Error("Request to add item(s) failed.");
6300
6315
  }
6301
6316
  }
6302
- ), oi = V(async ({ input: e }) => {
6317
+ ), ci = V(async ({ input: e }) => {
6303
6318
  var t;
6304
6319
  if (!e.endpoint || e.endpoint === "")
6305
6320
  throw new Error("No endpoint provided.");
@@ -6326,7 +6341,7 @@ const si = V(
6326
6341
  } catch {
6327
6342
  throw new Error("Request to add item(s) failed.");
6328
6343
  }
6329
- }), ai = ({ context: e }) => typeof window > "u" && e.quote.id !== "" || typeof window < "u", ci = ({ context: e }) => !!e.quote.items && e.quote.items.length > 0, Pt = he({
6344
+ }), ui = ({ context: e }) => typeof window > "u" && e.quote.id !== "" || typeof window < "u", di = ({ context: e }) => !!e.quote.items && e.quote.items.length > 0, Pt = he({
6330
6345
  types: {
6331
6346
  context: {},
6332
6347
  emitted: {},
@@ -6334,23 +6349,23 @@ const si = V(
6334
6349
  input: {}
6335
6350
  },
6336
6351
  actions: {
6337
- addItems: C(Qr),
6338
- notifyAddItems: Fe(Wr),
6339
- notifyRemoveItems: Fe(Kr),
6340
- notifyUpdateItems: Fe(Zr),
6341
- removeItems: C(ei),
6342
- refresh: C(ti),
6343
- updateItems: C(ni)
6352
+ addItems: O(Kr),
6353
+ notifyAddItems: Fe(Zr),
6354
+ notifyRemoveItems: Fe(ei),
6355
+ notifyUpdateItems: Fe(ti),
6356
+ removeItems: O(ni),
6357
+ refresh: O(si),
6358
+ updateItems: O(ri)
6344
6359
  },
6345
6360
  actors: {
6346
- addItems: si,
6347
- removeItems: ri,
6348
- refresh: ii,
6349
- updateItems: oi
6361
+ addItems: ii,
6362
+ removeItems: oi,
6363
+ refresh: ai,
6364
+ updateItems: ci
6350
6365
  },
6351
6366
  guards: {
6352
- canRefresh: ai,
6353
- hasItems: ci
6367
+ canRefresh: ui,
6368
+ hasItems: di
6354
6369
  }
6355
6370
  }).createMachine({
6356
6371
  /** @todo do we need to add the view to the id? (e.g. quote_en-us) */
@@ -6705,7 +6720,7 @@ const si = V(
6705
6720
  }
6706
6721
  }), Sn = be(
6707
6722
  {}
6708
- ), Ti = () => {
6723
+ ), Si = () => {
6709
6724
  var c;
6710
6725
  const e = Ne(Sn);
6711
6726
  if (!e || !e.getSnapshot)
@@ -6735,7 +6750,7 @@ const si = V(
6735
6750
  isRemovingItems: o,
6736
6751
  isUpdatingItems: a
6737
6752
  };
6738
- }, _i = async (e = {
6753
+ }, Ii = async (e = {
6739
6754
  inspect: void 0,
6740
6755
  quote: { id: "", locale: "" },
6741
6756
  endpoints: { client: "", server: "" },
@@ -6762,28 +6777,28 @@ const si = V(
6762
6777
  },
6763
6778
  inspect: e.inspect
6764
6779
  }).start();
6765
- function Si({ actor: e, children: t }) {
6780
+ function Ai({ actor: e, children: t }) {
6766
6781
  return /* @__PURE__ */ we(Sn.Provider, { value: e, children: t });
6767
6782
  }
6768
6783
  export {
6769
6784
  an as AuthContext,
6770
- fi as AuthProvider,
6785
+ yi as AuthProvider,
6771
6786
  Tn as CheckoutContext,
6772
- mi as CheckoutProvider,
6787
+ Ei as CheckoutProvider,
6773
6788
  Sn as QuoteContext,
6774
- Si as QuoteProvider,
6789
+ Ai as QuoteProvider,
6775
6790
  _n as ToastContext,
6776
- vi as ToastProvider,
6791
+ _i as ToastProvider,
6777
6792
  Ot as authMachine,
6778
6793
  Ut as checkoutMachine,
6779
- hi as getAuth,
6780
- yi as getCheckout,
6781
- _i as getQuote,
6794
+ pi as getAuth,
6795
+ gi as getCheckout,
6796
+ Ii as getQuote,
6782
6797
  Pt as quoteMachine,
6783
- Xr as timerMachine,
6784
- gi as toastMachine,
6785
- li as useAuth,
6786
- pi as useCheckout,
6787
- Ti as useQuote,
6788
- Ei as useToast
6798
+ Wr as timerMachine,
6799
+ vi as toastMachine,
6800
+ fi as useAuth,
6801
+ mi as useCheckout,
6802
+ Si as useQuote,
6803
+ Ti as useToast
6789
6804
  };