reactjrx 1.87.0 → 1.88.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,21 +1,21 @@
1
1
  var Yt = Object.defineProperty;
2
2
  var Bt = (s, e, t) => e in s ? Yt(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
- var m = (s, e, t) => (Bt(s, typeof e != "symbol" ? e + "" : e, t), t), bt = (s, e, t) => {
3
+ var m = (s, e, t) => (Bt(s, typeof e != "symbol" ? e + "" : e, t), t), yt = (s, e, t) => {
4
4
  if (!e.has(s))
5
5
  throw TypeError("Cannot " + t);
6
6
  };
7
- var a = (s, e, t) => (bt(s, e, "read from private field"), t ? t.call(s) : e.get(s)), C = (s, e, t) => {
7
+ var a = (s, e, t) => (yt(s, e, "read from private field"), t ? t.call(s) : e.get(s)), C = (s, e, t) => {
8
8
  if (e.has(s))
9
9
  throw TypeError("Cannot add the same private member more than once");
10
10
  e instanceof WeakSet ? e.add(s) : e.set(s, t);
11
- }, M = (s, e, t, r) => (bt(s, e, "write to private field"), r ? r.call(s, t) : e.set(s, t), t);
11
+ }, M = (s, e, t, r) => (yt(s, e, "write to private field"), r ? r.call(s, t) : e.set(s, t), t);
12
12
  import * as Ge from "react";
13
- import { useRef as ge, useMemo as ut, useCallback as le, useSyncExternalStore as Xt, useEffect as X, createContext as Zt, memo as es, useContext as ts, useState as jt } from "react";
14
- import { distinctUntilChanged as Q, tap as E, catchError as B, EMPTY as re, isObservable as yt, from as me, of as v, defer as Me, Subject as I, BehaviorSubject as J, skip as at, first as Je, map as g, switchMap as x, zip as ss, mergeMap as k, merge as F, filter as O, throttleTime as rs, asyncScheduler as ns, throwError as ve, timer as Ae, Observable as is, takeWhile as Ye, concatMap as us, last as Te, takeUntil as ne, identity as Mt, shareReplay as Qe, ignoreElements as he, scan as Be, fromEvent as Ke, noop as N, startWith as ce, pairwise as At, NEVER as Ne, delay as ot, interval as as, withLatestFrom as gt, retry as os, iif as cs, concat as De, toArray as ke, share as de, take as qe, combineLatest as ls, endWith as hs, lastValueFrom as ds } from "rxjs";
15
- import { catchError as mt, mergeMap as tt, retryWhen as fs, concatMap as ps, first as bs, tap as Qt } from "rxjs/operators";
16
- import { jsxs as ys, jsx as gs } from "react/jsx-runtime";
13
+ import { useRef as me, useMemo as ut, useCallback as le, useSyncExternalStore as Xt, useEffect as X, createContext as Zt, memo as es, useContext as ts, useState as jt } from "react";
14
+ import { distinctUntilChanged as Q, tap as E, catchError as B, EMPTY as Z, isObservable as bt, from as Se, of as v, defer as Ae, Subject as I, BehaviorSubject as J, skip as at, first as Je, map as g, switchMap as x, zip as ss, mergeMap as k, merge as F, filter as O, throttleTime as rs, asyncScheduler as ns, throwError as Oe, timer as Qe, Observable as is, takeWhile as Ye, concatMap as us, last as Ke, takeUntil as ne, identity as Mt, shareReplay as Ue, ignoreElements as he, scan as Be, fromEvent as Ne, noop as N, startWith as ce, pairwise as At, NEVER as qe, delay as ot, interval as as, withLatestFrom as gt, retry as os, iif as cs, concat as ke, toArray as Te, share as de, take as He, combineLatest as ls, endWith as hs, lastValueFrom as ds } from "rxjs";
15
+ import { catchError as mt, mergeMap as tt, retryWhen as fs, concatMap as ps, first as ys, tap as Qt } from "rxjs/operators";
16
+ import { jsxs as bs, jsx as gs } from "react/jsx-runtime";
17
17
  const q = (s) => {
18
- const e = ge(s);
18
+ const e = me(s);
19
19
  return ut(() => {
20
20
  e.current = s;
21
21
  }, [s]), e;
@@ -27,11 +27,11 @@ function Xe(s, e, t) {
27
27
  const r = e != null && !Array.isArray(e) ? e : {
28
28
  defaultValue: void 0,
29
29
  unsubscribeOnUnmount: !0
30
- }, n = !t && Array.isArray(e) ? e : typeof s == "function" ? t ?? [] : [s], u = ge(
30
+ }, n = !t && Array.isArray(e) ? e : typeof s == "function" ? t ?? [] : [s], u = me(
31
31
  "getValue" in s && typeof s.getValue == "function" ? s.getValue() : r.defaultValue
32
32
  ), i = q(s), c = q(r), l = le(
33
33
  (p) => {
34
- const d = i.current, b = (typeof d == "function" ? d : () => d)().pipe(
34
+ const d = i.current, y = (typeof d == "function" ? d : () => d)().pipe(
35
35
  /**
36
36
  * @important
37
37
  * We only check primitives because underlying subscription might
@@ -39,13 +39,13 @@ function Xe(s, e, t) {
39
39
  * properties values
40
40
  */
41
41
  Q(ms),
42
- E((y) => {
43
- u.current = y;
42
+ E((b) => {
43
+ u.current = b;
44
44
  }),
45
- B((y) => (console.error(y), re))
45
+ B((b) => (console.error(b), Z))
46
46
  ).subscribe(p);
47
47
  return () => {
48
- c.current.unsubscribeOnUnmount !== !1 && b.unsubscribe();
48
+ c.current.unsubscribeOnUnmount !== !1 && y.unsubscribe();
49
49
  };
50
50
  },
51
51
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -57,16 +57,16 @@ function St(s) {
57
57
  return s instanceof Promise || s && typeof s.then == "function" && typeof s.catch == "function";
58
58
  }
59
59
  function U(s) {
60
- if (yt(s))
60
+ if (bt(s))
61
61
  return s;
62
62
  if (St(s))
63
- return me(s);
63
+ return Se(s);
64
64
  if (typeof s != "function")
65
65
  return v(s);
66
66
  const e = s;
67
- return Me(() => {
67
+ return Ae(() => {
68
68
  const t = e();
69
- return St(t) ? me(t) : yt(t) ? t : v(t);
69
+ return St(t) ? Se(t) : bt(t) ? t : v(t);
70
70
  });
71
71
  }
72
72
  function Ut(s, e = []) {
@@ -83,7 +83,7 @@ function Ut(s, e = []) {
83
83
  ]);
84
84
  }
85
85
  const Ze = (s) => {
86
- const e = ge();
86
+ const e = me();
87
87
  return e.current || (e.current = s()), X(() => {
88
88
  process.env.NODE_ENV;
89
89
  }, []), e;
@@ -91,7 +91,7 @@ const Ze = (s) => {
91
91
  onBeforeComplete: s,
92
92
  completeOnUnmount: e = !0
93
93
  } = {}) => {
94
- const t = Ze(() => new I()), r = ge(!1), n = q(s), u = q(e);
94
+ const t = Ze(() => new I()), r = me(!1), n = q(s), u = q(e);
95
95
  return X(() => (r.current && (t.current = new I(), r.current = !1), () => {
96
96
  if (!u.current) {
97
97
  r.current = !0;
@@ -109,7 +109,7 @@ const Ze = (s) => {
109
109
  );
110
110
  return [e.current, t];
111
111
  }, Vt = (s) => {
112
- const e = Ze(() => new J(s)), t = ge(!1), r = ge(s);
112
+ const e = Ze(() => new J(s)), t = me(!1), r = me(s);
113
113
  return X(() => (t.current && (e.current = new J(r.current), t.current = !1), () => {
114
114
  t.current || (e.current.complete(), t.current = !0);
115
115
  }), [e]), e;
@@ -123,7 +123,7 @@ const Ze = (s) => {
123
123
  );
124
124
  return [t.current, r, e.current.getValue()];
125
125
  }, Ss = Symbol("SIGNAL_RESET");
126
- function br(s = {}) {
126
+ function yr(s = {}) {
127
127
  const e = {
128
128
  default: s.default,
129
129
  key: s.key
@@ -160,7 +160,7 @@ function br(s = {}) {
160
160
  subject: r
161
161
  };
162
162
  }
163
- function yr(s, e) {
163
+ function br(s, e) {
164
164
  const r = e ?? (() => s.getValue());
165
165
  return Xe(
166
166
  () => s.subject.pipe(
@@ -227,8 +227,8 @@ const gr = (s) => ({
227
227
  setItem: async (e, t) => {
228
228
  localStorage.setItem(e, JSON.stringify(t));
229
229
  }
230
- }, Oe = "__reactjrx", $s = (s) => {
231
- if (typeof s == "object" && s !== null && Oe in s && s[Oe] === Oe)
230
+ }, $e = "__reactjrx", $s = (s) => {
231
+ if (typeof s == "object" && s !== null && $e in s && s[$e] === $e)
232
232
  return s;
233
233
  };
234
234
  function rt(s) {
@@ -246,17 +246,17 @@ const vt = (s) => {
246
246
  }) => {
247
247
  const n = {
248
248
  value: e.getValue(),
249
- [Oe]: Oe,
249
+ [$e]: $e,
250
250
  migrationVersion: t
251
251
  };
252
- return me(s.setItem(e.config.key, n)).pipe(
252
+ return Se(s.setItem(e.config.key, n)).pipe(
253
253
  B((u) => (console.error(u), v(null)))
254
254
  );
255
255
  }, ws = ({
256
256
  adapter: s,
257
257
  version: e,
258
258
  signal: t
259
- }) => me(s.getItem(t.config.key)).pipe(
259
+ }) => Se(s.getItem(t.config.key)).pipe(
260
260
  x((r) => {
261
261
  const n = $s(r);
262
262
  return n ? n.migrationVersion !== void 0 && e > n.migrationVersion ? v(r) : (t.setValue(n.value), v(r)) : v(r);
@@ -294,7 +294,7 @@ const vt = (s) => {
294
294
  E(() => {
295
295
  n.current != null && n.current();
296
296
  }),
297
- B((p) => (console.error("Unable to hydrate", p), re))
297
+ B((p) => (console.error("Unable to hydrate", p), Z))
298
298
  );
299
299
  })
300
300
  );
@@ -314,7 +314,7 @@ const vt = (s) => {
314
314
  rs(500, ns, {
315
315
  trailing: !0
316
316
  }),
317
- x(() => me(
317
+ x(() => Se(
318
318
  Ot({
319
319
  adapter: l,
320
320
  signal: h,
@@ -359,48 +359,48 @@ function Pt(s) {
359
359
  resetOnSuccess: o = !1,
360
360
  backoffDelay: p = Fs
361
361
  } = l;
362
- return (d) => Me(() => {
362
+ return (d) => Ae(() => {
363
363
  let f = 0;
364
- const b = (y, $) => y < u ? i(y, $) : !1;
364
+ const y = (b, $) => b < u ? i(b, $) : !1;
365
365
  return d.pipe(
366
- mt((y) => {
366
+ mt((b) => {
367
367
  var w;
368
- if (f++, !b(f - 1, y))
369
- throw y;
370
- const $ = (w = s.caughtError) == null ? void 0 : w.call(s, f, y);
368
+ if (f++, !y(f - 1, b))
369
+ throw b;
370
+ const $ = (w = s.caughtError) == null ? void 0 : w.call(s, f, b);
371
371
  if (!$)
372
- throw y;
372
+ throw b;
373
373
  return $.pipe(
374
374
  tt(
375
375
  (H) => F(
376
376
  v(H),
377
- ve(() => y)
377
+ Oe(() => b)
378
378
  )
379
379
  )
380
380
  );
381
381
  }),
382
- fs((y) => y.pipe(
382
+ fs((b) => b.pipe(
383
383
  ps(($) => {
384
384
  const w = f - 1;
385
385
  return n().pipe(
386
- bs(),
386
+ ys(),
387
387
  tt(
388
- () => b(w, $) ? Ae(
388
+ () => y(w, $) ? Qe(
389
389
  Cs(
390
390
  p(w, c),
391
391
  h
392
392
  )
393
393
  ).pipe(
394
- tt((H) => r && !r(w, $) ? ve(() => $) : v(H))
395
- ) : ve(() => $)
394
+ tt((H) => r && !r(w, $) ? Oe(() => $) : v(H))
395
+ ) : Oe(() => $)
396
396
  )
397
397
  );
398
398
  })
399
399
  )),
400
- mt((y) => {
400
+ mt((b) => {
401
401
  if (s.catchError)
402
- return s.catchError(f, y);
403
- throw y;
402
+ return s.catchError(f, b);
403
+ throw b;
404
404
  }),
405
405
  Qt(() => {
406
406
  o && (f = 0);
@@ -408,6 +408,7 @@ function Pt(s) {
408
408
  );
409
409
  });
410
410
  }
411
+ const vr = (s, e) => s.length === e.length && s.every((t, r) => t === e[r]);
411
412
  function $t(s) {
412
413
  return Object.prototype.toString.call(s) === "[object Object]";
413
414
  }
@@ -420,7 +421,7 @@ function nt(s) {
420
421
  const t = e.prototype;
421
422
  return !(!$t(t) || !t.hasOwnProperty("isPrototypeOf"));
422
423
  }
423
- const Se = (s) => JSON.stringify(
424
+ const ve = (s) => JSON.stringify(
424
425
  s,
425
426
  (e, t) => nt(t) ? Object.keys(t).sort().reduce((r, n) => (r[n] = t[n], r), {}) : t
426
427
  ), ct = (s = 21) => crypto.getRandomValues(new Uint8Array(s)).reduce((e, t) => (t &= 63, t < 36 ? e += t.toString(36) : t < 62 ? e += (t - 26).toString(36).toUpperCase() : t > 62 ? e += "-" : e += "_", e), ""), fe = () => ({
@@ -446,38 +447,38 @@ function lt(s) {
446
447
  });
447
448
  };
448
449
  }
449
- const $e = (s) => s.pipe(
450
+ const we = (s) => s.pipe(
450
451
  Ye(
451
452
  (e) => e.status !== "error" && e.status !== "success",
452
453
  !0
453
454
  )
454
455
  );
455
- var Z;
456
+ var ee;
456
457
  class Es {
457
458
  constructor({
458
459
  __queryFinalizeHook: e
459
460
  } = {}) {
460
- C(this, Z, new I());
461
+ C(this, ee, new I());
461
462
  m(this, "state$");
462
463
  const t = new J(0), r = t.pipe(
463
464
  O((n) => n === 0)
464
465
  );
465
- this.state$ = a(this, Z).pipe(
466
+ this.state$ = a(this, ee).pipe(
466
467
  us(({ args: n, mutation: u, options: i }) => {
467
- const c = i.mapOperator ?? "merge", l = a(this, Z).pipe(
468
+ const c = i.mapOperator ?? "merge", l = a(this, ee).pipe(
468
469
  O(() => c === "merge")
469
- ), h = a(this, Z).pipe(
470
+ ), h = a(this, ee).pipe(
470
471
  O(() => c === "switch"),
471
472
  E(() => {
472
473
  u.cancel();
473
474
  })
474
- ), o = Me(() => (u.execute(n), re)), p = u.state$.pipe(
475
- $e,
476
- Te(),
475
+ ), o = Ae(() => (u.execute(n), Z)), p = u.state$.pipe(
476
+ we,
477
+ Ke(),
477
478
  k(() => u.state$),
478
- ne(a(this, Z))
479
+ ne(a(this, ee))
479
480
  ), d = u.state$.pipe(
480
- $e,
481
+ we,
481
482
  at(1)
482
483
  ), f = F(
483
484
  r,
@@ -494,12 +495,12 @@ class Es {
494
495
  */
495
496
  o
496
497
  ).pipe(
497
- g((b) => ({ state: b, mutation: u })),
498
+ g((y) => ({ state: y, mutation: u })),
498
499
  e ?? Mt,
499
500
  ne(f)
500
501
  );
501
502
  }),
502
- Qe({
503
+ Ue({
503
504
  refCount: !0,
504
505
  bufferSize: 1
505
506
  }),
@@ -513,14 +514,14 @@ class Es {
513
514
  options: t,
514
515
  mutation: r
515
516
  }) {
516
- a(this, Z).next({ args: e, options: t, mutation: r });
517
+ a(this, ee).next({ args: e, options: t, mutation: r });
517
518
  }
518
519
  }
519
- Z = new WeakMap();
520
+ ee = new WeakMap();
520
521
  function et(s, e) {
521
522
  return s === e ? !0 : typeof s != typeof e ? !1 : s && e && typeof s == "object" && typeof e == "object" ? !Object.keys(e).some((t) => !et(s[t], e[t])) : !1;
522
523
  }
523
- const He = (s, e, { exact: t = !1 } = {}) => t ? Se(s) === Se(e) : et(s, e);
524
+ const _e = (s, e, { exact: t = !1 } = {}) => t ? ve(s) === ve(e) : et(s, e);
524
525
  function V(s, e) {
525
526
  if (s == null || e === void 0 || typeof s != "object" || typeof e != "object")
526
527
  return s === e;
@@ -569,7 +570,7 @@ class xs {
569
570
  k(
570
571
  (u) => a(this, ie).state$.pipe(
571
572
  ne(
572
- u.mutation.state$.pipe($e, Te())
573
+ u.mutation.state$.pipe(we, Ke())
573
574
  )
574
575
  )
575
576
  )
@@ -580,7 +581,7 @@ class xs {
580
581
  state: i,
581
582
  options: u.options
582
583
  }))
583
- )) ?? re),
584
+ )) ?? Z),
584
585
  E(({ state: u, options: i }) => {
585
586
  u.status === "error" && (i != null && i.onError && (i == null || i.onError(
586
587
  u.error,
@@ -613,7 +614,7 @@ class xs {
613
614
  ...e
614
615
  });
615
616
  const r = (n = a(this, L).getValue()) == null ? void 0 : n.mutation;
616
- this.options.mutationKey && t.mutationKey && !He(this.options.mutationKey, t.mutationKey, {
617
+ this.options.mutationKey && t.mutationKey && !_e(this.options.mutationKey, t.mutationKey, {
617
618
  exact: !0
618
619
  }) ? this.reset() : r == null || r.setOptions(this.options);
619
620
  }
@@ -667,7 +668,7 @@ class xs {
667
668
  options: this.options,
668
669
  mutation: r
669
670
  }), await new Promise((n, u) => {
670
- r.state$.pipe($e, Te()).subscribe({
671
+ r.state$.pipe(we, Ke()).subscribe({
671
672
  error: (i) => {
672
673
  u(i);
673
674
  },
@@ -692,10 +693,10 @@ class xs {
692
693
  ie = new WeakMap(), L = new WeakMap();
693
694
  const kt = Zt(void 0), Rs = ({ client: s }) => (X(() => (s.mount(), () => {
694
695
  s.unmount();
695
- }), [s]), null), vr = es(
696
+ }), [s]), null), Or = es(
696
697
  ({ children: s, client: e }) => {
697
698
  const t = ut(() => e, [e]);
698
- return /* @__PURE__ */ ys(kt.Provider, { value: t, children: [
699
+ return /* @__PURE__ */ bs(kt.Provider, { value: t, children: [
699
700
  /* @__PURE__ */ gs(Rs, { client: e }),
700
701
  s
701
702
  ] });
@@ -710,8 +711,8 @@ const kt = Zt(void 0), Rs = ({ client: s }) => (X(() => (s.mount(), () => {
710
711
  };
711
712
  function js() {
712
713
  }
713
- function Or(s, e) {
714
- const t = Tt(e), r = q(s), n = Ze(() => [ct()]), u = Se(s.mutationKey ?? n.current), [i] = jt(
714
+ function $r(s, e) {
715
+ const t = Tt(e), r = q(s), n = Ze(() => [ct()]), u = ve(s.mutationKey ?? n.current), [i] = jt(
715
716
  () => new xs(
716
717
  t,
717
718
  s
@@ -737,7 +738,7 @@ function Ms(s) {
737
738
  })
738
739
  );
739
740
  }
740
- const _e = typeof window > "u" || "Deno" in window;
741
+ const pe = typeof window > "u" || "Deno" in window;
741
742
  class As {
742
743
  constructor() {
743
744
  m(this, "isOnlineSubject", new J(!0));
@@ -747,8 +748,8 @@ class As {
747
748
  Je()
748
749
  ));
749
750
  F(
750
- _e ? re : Ke(window, "offline").pipe(g(() => !1)),
751
- _e ? re : Ke(window, "online").pipe(g(() => !0))
751
+ pe ? Z : Ne(window, "offline").pipe(g(() => !1)),
752
+ pe ? Z : Ne(window, "online").pipe(g(() => !0))
752
753
  ).pipe(Ms(this.isOnlineSubject)).subscribe();
753
754
  }
754
755
  isOnline() {
@@ -758,7 +759,7 @@ class As {
758
759
  this.isOnlineSubject.getValue() !== e && this.isOnlineSubject.next(e);
759
760
  }
760
761
  }
761
- const se = new As();
762
+ const re = new As();
762
763
  function ht(s, e) {
763
764
  return s.isStaleByTime(e.staleTime);
764
765
  }
@@ -782,7 +783,7 @@ function Kt(s, e, t) {
782
783
  return !1;
783
784
  }
784
785
  function Is(s) {
785
- return (s ?? "online") === "online" ? se.isOnline() : !0;
786
+ return (s ?? "online") === "online" ? re.isOnline() : !0;
786
787
  }
787
788
  function Ft(s, e) {
788
789
  return e.reduce(
@@ -809,7 +810,7 @@ function Nt(s, e) {
809
810
  return e;
810
811
  }
811
812
  function dt(s, e) {
812
- return ((e == null ? void 0 : e.queryKeyHashFn) ?? Se)(s);
813
+ return ((e == null ? void 0 : e.queryKeyHashFn) ?? ve)(s);
813
814
  }
814
815
  function xt(s, e) {
815
816
  const {
@@ -855,7 +856,7 @@ const it = Symbol(), Ds = ({
855
856
  const j = n.status === "pending" ? "pending" : i.status ?? n.status;
856
857
  return { ...n, ...i, status: j };
857
858
  }
858
- const c = i.data, l = c !== void 0 && c !== n.data, h = "data" in i, o = i.status === "success", p = n.data !== void 0, d = n.error !== void 0 || n.error !== null, f = i.status ?? n.status, b = l ? Le(e().data, c, s()) : h ? i.data : n.data, y = n.status === "error" || n.status === "success", $ = i.status === "error" && (n.status === "error" && n.fetchStatus === "fetching" || n.status !== "error") ? n.errorUpdateCount + 1 : n.errorUpdateCount, w = l ? n.dataUpdateCount + 1 : i.dataUpdateCount ?? n.dataUpdateCount, H = i.status === "pending" && y && // (dataUpdateCount !== 0 || errorUpdateCount !== 0)
859
+ const c = i.data, l = c !== void 0 && c !== n.data, h = "data" in i, o = i.status === "success", p = n.data !== void 0, d = n.error !== void 0 || n.error !== null, f = i.status ?? n.status, y = l ? Le(e().data, c, s()) : h ? i.data : n.data, b = n.status === "error" || n.status === "success", $ = i.status === "error" && (n.status === "error" && n.fetchStatus === "fetching" || n.status !== "error") ? n.errorUpdateCount + 1 : n.errorUpdateCount, w = l ? n.dataUpdateCount + 1 : i.dataUpdateCount ?? n.dataUpdateCount, H = i.status === "pending" && b && // (dataUpdateCount !== 0 || errorUpdateCount !== 0)
859
860
  (p || d), P = f === "pending" ? null : i.error ?? n.error;
860
861
  return {
861
862
  ...n,
@@ -866,7 +867,7 @@ const it = Symbol(), Ds = ({
866
867
  ...o && {
867
868
  isInvalidated: !1
868
869
  },
869
- data: b,
870
+ data: y,
870
871
  dataUpdateCount: w,
871
872
  ...H && {
872
873
  status: n.status
@@ -880,33 +881,33 @@ const it = Symbol(), Ds = ({
880
881
  ), qt = (s) => s.pipe(
881
882
  Ye((e) => e.fetchStatus !== "idle", !0)
882
883
  );
883
- var We, ee;
884
+ var We, te;
884
885
  class Ts {
885
886
  constructor() {
886
887
  C(this, We, F(
887
- Ke(document, "visibilitychange"),
888
- _e ? re : Ke(window, "visibilitychange")
888
+ pe ? Z : Ne(document, "visibilitychange"),
889
+ pe ? Z : Ne(window, "visibilitychange")
889
890
  ).pipe(g(() => document.visibilityState)));
890
- C(this, ee, new J(
891
- document.visibilityState === "visible"
891
+ C(this, te, new J(
892
+ pe ? !0 : document.visibilityState === "visible"
892
893
  ));
893
894
  // public readonly focused$ = this.#focusedSubject.pipe(distinctUntilChanged())
894
- m(this, "focused$", a(this, ee));
895
+ m(this, "focused$", a(this, te));
895
896
  m(this, "focusRegained$", this.focused$.pipe(
896
897
  at(1),
897
898
  O((e) => e)
898
899
  ));
899
900
  a(this, We).pipe(
900
901
  E((e) => {
901
- a(this, ee).next(e === "visible");
902
+ a(this, te).next(e === "visible");
902
903
  })
903
904
  ).subscribe();
904
905
  }
905
906
  isFocused() {
906
- return a(this, ee).getValue();
907
+ return a(this, te).getValue();
907
908
  }
908
909
  setFocused(e) {
909
- a(this, ee).getValue() !== (e ?? !0) && a(this, ee).next(e ?? !0);
910
+ a(this, te).getValue() !== (e ?? !0) && a(this, te).next(e ?? !0);
910
911
  }
911
912
  subscribe(e) {
912
913
  const t = this.focused$.subscribe(e);
@@ -925,7 +926,7 @@ class Ts {
925
926
  document.dispatchEvent(new Event("visibilitychange"));
926
927
  }
927
928
  }
928
- We = new WeakMap(), ee = new WeakMap();
929
+ We = new WeakMap(), te = new WeakMap();
929
930
  const ze = new Ts(), Ks = (s) => s.pipe(
930
931
  O((e) => e.status === "success"),
931
932
  g((e) => ({
@@ -935,12 +936,12 @@ const ze = new Ts(), Ks = (s) => s.pipe(
935
936
  })),
936
937
  Q(V)
937
938
  );
938
- var Y, R, we, ue, D, pe, Ce;
939
+ var Y, R, Ce, ue, D, ye, Fe;
939
940
  class Ht {
940
941
  constructor(e, t) {
941
942
  C(this, Y, void 0);
942
943
  C(this, R, void 0);
943
- C(this, we, new I());
944
+ C(this, Ce, new I());
944
945
  /**
945
946
  * Used to subscribe to changes in either query or options (or both).
946
947
  * We need to be able to track change to both of them at the same time
@@ -958,8 +959,8 @@ class Ht {
958
959
  C(this, D, void 0);
959
960
  // This property keeps track of the last query with defined data.
960
961
  // It will be used to pass the previous data and query to the placeholder function between renders.
961
- C(this, pe, void 0);
962
- C(this, Ce, 0);
962
+ C(this, ye, void 0);
963
+ C(this, Fe, 0);
963
964
  m(this, "getObserverResultFromQuery", ({
964
965
  options: e,
965
966
  query: t,
@@ -973,11 +974,11 @@ class Ht {
973
974
  selectResult: h
974
975
  }
975
976
  }) => {
976
- var Pe;
977
- const o = t.state, p = t.state.status === "pending", d = a(this, R), f = this.options, y = t !== d ? t.state : a(this, ue);
977
+ var De;
978
+ const o = t.state, p = t.state.status === "pending", d = a(this, R), f = this.options, b = t !== d ? t.state : a(this, ue);
978
979
  let { errorUpdatedAt: $, fetchStatus: w, error: H } = o;
979
980
  if (r) {
980
- const T = !!a(this, Ce), pt = !T && wt(t, e), Jt = T && Ct(t, d, e, f);
981
+ const T = !!a(this, Fe), pt = !T && wt(t, e), Jt = T && Ct(t, d, e, f);
981
982
  (pt || Jt) && (w = Is(t.options.networkMode) ? "fetching" : "paused");
982
983
  }
983
984
  const P = p && w === "fetching";
@@ -995,15 +996,15 @@ class Ht {
995
996
  j = o.data, S = null;
996
997
  let _ = w !== "idle" && !o.dataUpdatedAt ? "pending" : o.status;
997
998
  S && (H = S, j = h, $ = (n == null ? void 0 : n.errorUpdatedAt) ?? $, _ = "error");
998
- const Ue = _ === "error";
999
- let Ie = !1;
999
+ const Ie = _ === "error";
1000
+ let Ve = !1;
1000
1001
  if (typeof e.placeholderData < "u" && typeof j > "u" && _ === "pending") {
1001
1002
  let T;
1002
1003
  if (n != null && n.isPlaceholderData && e.placeholderData === (u == null ? void 0 : u.placeholderData))
1003
1004
  T = n.data;
1004
1005
  else if (T = typeof e.placeholderData == "function" ? e.placeholderData(
1005
- (Pe = a(this, pe)) == null ? void 0 : Pe.state.data,
1006
- a(this, pe)
1006
+ (De = a(this, ye)) == null ? void 0 : De.state.data,
1007
+ a(this, ye)
1007
1008
  ) : e.placeholderData, e.select && typeof T < "u")
1008
1009
  try {
1009
1010
  T = e.select(T);
@@ -1013,16 +1014,16 @@ class Ht {
1013
1014
  n == null ? void 0 : n.data,
1014
1015
  T,
1015
1016
  e
1016
- ), Ie = !0);
1017
+ ), Ve = !0);
1017
1018
  }
1018
- const Ve = w === "fetching";
1019
+ const Pe = w === "fetching";
1019
1020
  return {
1020
1021
  result: {
1021
1022
  status: _,
1022
1023
  fetchStatus: w,
1023
1024
  isPending: p,
1024
1025
  isSuccess: _ === "success",
1025
- isError: Ue,
1026
+ isError: Ie,
1026
1027
  isInitialLoading: P,
1027
1028
  isLoading: P,
1028
1029
  data: j,
@@ -1033,13 +1034,13 @@ class Ht {
1033
1034
  failureReason: o.fetchFailureReason,
1034
1035
  errorUpdateCount: o.errorUpdateCount,
1035
1036
  isFetched: o.dataUpdateCount > 0 || o.errorUpdateCount > 0,
1036
- isFetchedAfterMount: o.dataUpdateCount > y.dataUpdateCount || o.errorUpdateCount > y.errorUpdateCount,
1037
- isFetching: Ve,
1038
- isRefetching: Ve && !p,
1039
- isLoadingError: Ue && o.dataUpdatedAt === 0,
1037
+ isFetchedAfterMount: o.dataUpdateCount > b.dataUpdateCount || o.errorUpdateCount > b.errorUpdateCount,
1038
+ isFetching: Pe,
1039
+ isRefetching: Pe && !p,
1040
+ isLoadingError: Ie && o.dataUpdatedAt === 0,
1040
1041
  isPaused: w === "paused",
1041
- isPlaceholderData: Ie,
1042
- isRefetchError: Ue && o.dataUpdatedAt !== 0,
1042
+ isPlaceholderData: Ve,
1043
+ isRefetchError: Ie && o.dataUpdatedAt !== 0,
1043
1044
  isStale: ht(t, e),
1044
1045
  // eslint-disable-next-line @typescript-eslint/unbound-method
1045
1046
  refetch: this.refetch
@@ -1114,7 +1115,7 @@ class Ht {
1114
1115
  select: n,
1115
1116
  selectResult: u
1116
1117
  }) {
1117
- a(this, D).state = e.state, a(this, D).result = t, a(this, D).selectResult = u, r !== void 0 && (a(this, D).selectError = r), n !== void 0 && (a(this, D).select = n), a(this, D).options = this.options, e.state.data !== void 0 && M(this, pe, e), a(this, Y).getQueryCache().notify({
1118
+ a(this, D).state = e.state, a(this, D).result = t, a(this, D).selectResult = u, r !== void 0 && (a(this, D).selectError = r), n !== void 0 && (a(this, D).select = n), a(this, D).options = this.options, e.state.data !== void 0 && M(this, ye, e), a(this, Y).getQueryCache().notify({
1118
1119
  query: a(this, R),
1119
1120
  type: "observerResultsUpdated"
1120
1121
  });
@@ -1134,7 +1135,7 @@ class Ht {
1134
1135
  ...e,
1135
1136
  cancelRefetch: (e == null ? void 0 : e.cancelRefetch) ?? !0
1136
1137
  };
1137
- a(this, R).fetch(this.options, r).catch(N), a(this, we).next({
1138
+ a(this, R).fetch(this.options, r).catch(N), a(this, Ce).next({
1138
1139
  query: t,
1139
1140
  fetchOptions: r
1140
1141
  }), await t.getFetchResultAsPromise();
@@ -1189,26 +1190,26 @@ class Ht {
1189
1190
  O((S) => S.query === i),
1190
1191
  g((S) => S.options),
1191
1192
  Q(),
1192
- Qe(1)
1193
- ), h = a(this, we).pipe(
1193
+ Ue(1)
1194
+ ), h = a(this, Ce).pipe(
1194
1195
  O((S) => S.query === i)
1195
1196
  ), o = i.state$.pipe(
1196
1197
  Ks,
1197
1198
  x(
1198
- (S) => this.options.staleTime === 1 / 0 ? Ne : (this.options.staleTime ?? 0) <= 0 ? v(S).pipe(ot(1)) : Ae(this.options.staleTime ?? 1)
1199
+ (S) => this.options.staleTime === 1 / 0 ? qe : (this.options.staleTime ?? 0) <= 0 ? v(S).pipe(ot(1)) : Qe(this.options.staleTime ?? 1)
1199
1200
  ),
1200
1201
  Ye(() => this.options.enabled ?? !0)
1201
1202
  ), p = (S, z) => {
1202
1203
  const W = c.notifyOnChangeProps, _ = typeof W == "function" ? W() : W;
1203
- return (Array.isArray(_) ? _.length === 0 ? () => !0 : (Ie, Ve) => {
1204
+ return (Array.isArray(_) ? _.length === 0 ? () => !0 : (Ve, Pe) => {
1204
1205
  const ft = Ft(
1205
- Ie,
1206
- _
1207
- ), Pe = Ft(
1208
1206
  Ve,
1209
1207
  _
1208
+ ), De = Ft(
1209
+ Pe,
1210
+ _
1210
1211
  );
1211
- return V(ft, Pe);
1212
+ return V(ft, De);
1212
1213
  } : V)(S, z);
1213
1214
  }, d = h.pipe(
1214
1215
  x(() => i.state$),
@@ -1224,15 +1225,15 @@ class Ht {
1224
1225
  // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
1225
1226
  (z || ze.isFocused()) && this.fetch({ cancelRefetch: !1 }).catch(N);
1226
1227
  })
1227
- ) : Ne),
1228
+ ) : qe),
1228
1229
  he()
1229
- ), b = l.pipe(
1230
+ ), y = l.pipe(
1230
1231
  g(({ enabled: S }) => S ?? !0),
1231
1232
  Q()
1232
- ), y = b.pipe(
1233
+ ), b = y.pipe(
1233
1234
  O((S) => !S),
1234
1235
  g(() => i.state)
1235
- ), $ = b.pipe(
1236
+ ), $ = y.pipe(
1236
1237
  O((S) => S),
1237
1238
  x(() => ze.focusRegained$),
1238
1239
  gt(l),
@@ -1240,7 +1241,7 @@ class Ht {
1240
1241
  Us(i, S) && this.fetch({ cancelRefetch: !1 }).catch(N);
1241
1242
  }),
1242
1243
  he()
1243
- ), w = y.pipe(
1244
+ ), w = b.pipe(
1244
1245
  g(() => i.state)
1245
1246
  ), H = (S) => S.pipe(
1246
1247
  gt(l),
@@ -1268,7 +1269,7 @@ class Ht {
1268
1269
  return F(f, $, j);
1269
1270
  })
1270
1271
  ).pipe(
1271
- lt((i) => M(this, Ce, i)),
1272
+ lt((i) => M(this, Fe, i)),
1272
1273
  E({
1273
1274
  subscribe: () => {
1274
1275
  wt(e, this.options) && this.fetch().catch(N);
@@ -1280,7 +1281,7 @@ class Ht {
1280
1281
  destroy() {
1281
1282
  }
1282
1283
  }
1283
- Y = new WeakMap(), R = new WeakMap(), we = new WeakMap(), ue = new WeakMap(), D = new WeakMap(), pe = new WeakMap(), Ce = new WeakMap();
1284
+ Y = new WeakMap(), R = new WeakMap(), Ce = new WeakMap(), ue = new WeakMap(), D = new WeakMap(), ye = new WeakMap(), Fe = new WeakMap();
1284
1285
  function Ns(s, e) {
1285
1286
  return !V(s.getCurrentResult(), e);
1286
1287
  }
@@ -1346,10 +1347,10 @@ function Lt(s, e, t) {
1346
1347
  throw p;
1347
1348
  return h.current;
1348
1349
  }
1349
- function $r(s, e) {
1350
+ function wr(s, e) {
1350
1351
  return Lt(s, Ht, e);
1351
1352
  }
1352
- function wr(s, e) {
1353
+ function Cr(s, e) {
1353
1354
  return Lt(
1354
1355
  {
1355
1356
  refetchOnMount: "idle",
@@ -1362,7 +1363,7 @@ function wr(s, e) {
1362
1363
  e
1363
1364
  );
1364
1365
  }
1365
- function Cr(s, e, t = []) {
1366
+ function Fr(s, e, t = []) {
1366
1367
  const r = e != null && !Array.isArray(e) ? e : {}, n = r.retry ?? !0, u = q(
1367
1368
  r.onError ?? ((l) => {
1368
1369
  console.error(l);
@@ -1381,7 +1382,7 @@ function Cr(s, e, t = []) {
1381
1382
  const zt = () => (s) => F(
1382
1383
  // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
1383
1384
  v({ isPaused: !0 }),
1384
- se.backToOnline$.pipe(
1385
+ re.backToOnline$.pipe(
1385
1386
  k(
1386
1387
  () => (
1387
1388
  // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
@@ -1392,7 +1393,7 @@ const zt = () => (s) => F(
1392
1393
  ), Gs = (s) => {
1393
1394
  let e = 0;
1394
1395
  return s.pipe(
1395
- B((t) => (e++, e <= 1 && !se.isOnline() ? F(
1396
+ B((t) => (e++, e <= 1 && !re.isOnline() ? F(
1396
1397
  v({
1397
1398
  failureCount: e,
1398
1399
  failureReason: t
@@ -1401,12 +1402,12 @@ const zt = () => (s) => F(
1401
1402
  * @important
1402
1403
  * timer needed to be iso RQ, so the state returned by mutation include both previous and next one
1403
1404
  */
1404
- Ae(1).pipe(
1405
+ Qe(1).pipe(
1405
1406
  k(
1406
- () => ve(() => t).pipe(zt())
1407
+ () => Oe(() => t).pipe(zt())
1407
1408
  )
1408
1409
  )
1409
- ) : ve(() => t)))
1410
+ ) : Oe(() => t)))
1410
1411
  );
1411
1412
  }, Js = ({
1412
1413
  variables: s,
@@ -1423,7 +1424,7 @@ const zt = () => (s) => F(
1423
1424
  return ((d = t.onMutate) == null ? void 0 : d.call(t, s)) ?? void 0;
1424
1425
  }
1425
1426
  )
1426
- ).pipe(Qe(1)), l = (d, f, b) => U(
1427
+ ).pipe(Ue(1)), l = (d, f, y) => U(
1427
1428
  () => {
1428
1429
  var $;
1429
1430
  return ($ = t.onError) == null ? void 0 : $.call(t, d, s, f);
@@ -1432,7 +1433,7 @@ const zt = () => (s) => F(
1432
1433
  B(() => v(d)),
1433
1434
  g(
1434
1435
  () => ({
1435
- failureCount: b,
1436
+ failureCount: y,
1436
1437
  error: d,
1437
1438
  failureReason: d,
1438
1439
  context: f,
@@ -1441,14 +1442,14 @@ const zt = () => (s) => F(
1441
1442
  )
1442
1443
  ), h = c.pipe(
1443
1444
  x((d) => {
1444
- const b = (typeof u == "function" ? (
1445
+ const y = (typeof u == "function" ? (
1445
1446
  // eslint-disable-next-line @typescript-eslint/promise-function-async
1446
1447
  U(() => u(s))
1447
1448
  ) : u).pipe(
1448
1449
  g(
1449
- (y) => ({
1450
+ (b) => ({
1450
1451
  result: {
1451
- data: y
1452
+ data: b
1452
1453
  },
1453
1454
  error: null,
1454
1455
  context: d
@@ -1457,18 +1458,18 @@ const zt = () => (s) => F(
1457
1458
  Gs,
1458
1459
  Pt({
1459
1460
  ...t,
1460
- retry: (y, $) => {
1461
+ retry: (b, $) => {
1461
1462
  const w = t.retry ?? 0;
1462
- return typeof w == "function" ? w(y, $) : typeof w == "boolean" ? w : y < w;
1463
+ return typeof w == "function" ? w(b, $) : typeof w == "boolean" ? w : b < w;
1463
1464
  },
1464
- caughtError: (y, $) => (
1465
+ caughtError: (b, $) => (
1465
1466
  // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
1466
1467
  v({
1467
- failureCount: y,
1468
+ failureCount: b,
1468
1469
  failureReason: $
1469
1470
  })
1470
1471
  ),
1471
- catchError: (y, $) => l($, d, y).pipe(
1472
+ catchError: (b, $) => l($, d, b).pipe(
1472
1473
  g((w) => ({
1473
1474
  ...w,
1474
1475
  result: void 0
@@ -1476,11 +1477,11 @@ const zt = () => (s) => F(
1476
1477
  )
1477
1478
  }),
1478
1479
  Ye(
1479
- ({ result: y, error: $ }) => (y == null ? void 0 : y.data) === void 0 && $ === void 0,
1480
+ ({ result: b, error: $ }) => (b == null ? void 0 : b.data) === void 0 && $ === void 0,
1480
1481
  !0
1481
1482
  )
1482
1483
  );
1483
- return se.isOnline() || t.networkMode === "offlineFirst" || t.networkMode === "always" ? b : b.pipe(zt());
1484
+ return re.isOnline() || t.networkMode === "offlineFirst" || t.networkMode === "always" ? y : y.pipe(zt());
1484
1485
  })
1485
1486
  ), o = v({
1486
1487
  ...e,
@@ -1496,19 +1497,19 @@ const zt = () => (s) => F(
1496
1497
  // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
1497
1498
  c.pipe(g((d) => ({ context: d }))),
1498
1499
  h.pipe(
1499
- x(({ result: d, error: f, ...b }) => {
1500
+ x(({ result: d, error: f, ...y }) => {
1500
1501
  if (!d && !f)
1501
1502
  return v({
1502
- ...b
1503
+ ...y
1503
1504
  });
1504
- const y = f ? v(null) : U(
1505
+ const b = f ? v(null) : U(
1505
1506
  () => {
1506
1507
  var P;
1507
1508
  return (P = t.onSuccess) == null ? void 0 : P.call(
1508
1509
  t,
1509
1510
  d == null ? void 0 : d.data,
1510
1511
  s,
1511
- b.context
1512
+ y.context
1512
1513
  );
1513
1514
  }
1514
1515
  ), w = U(
@@ -1519,20 +1520,20 @@ const zt = () => (s) => F(
1519
1520
  d == null ? void 0 : d.data,
1520
1521
  f,
1521
1522
  s,
1522
- b.context
1523
+ y.context
1523
1524
  );
1524
1525
  }
1525
1526
  ).pipe(
1526
1527
  B((P) => d ? v(d) : v(P))
1527
1528
  );
1528
- return De(y, w).pipe(
1529
- ke(),
1529
+ return ke(b, w).pipe(
1530
+ Te(),
1530
1531
  g(
1531
1532
  () => f ? {
1532
1533
  error: f,
1533
1534
  data: void 0,
1534
1535
  variables: s,
1535
- ...b
1536
+ ...y
1536
1537
  } : {
1537
1538
  status: "success",
1538
1539
  error: f,
@@ -1540,11 +1541,11 @@ const zt = () => (s) => F(
1540
1541
  variables: s,
1541
1542
  failureCount: 0,
1542
1543
  failureReason: null,
1543
- ...b
1544
+ ...y
1544
1545
  }
1545
1546
  ),
1546
1547
  B(
1547
- (P) => l(P, b.context, 0).pipe(
1548
+ (P) => l(P, y.context, 0).pipe(
1548
1549
  g((j) => ({
1549
1550
  ...j,
1550
1551
  data: void 0
@@ -1563,23 +1564,23 @@ const zt = () => (s) => F(
1563
1564
  }), fe())
1564
1565
  );
1565
1566
  };
1566
- var Fe, te, be;
1567
+ var Ee, se, be;
1567
1568
  class Ys {
1568
1569
  constructor({
1569
1570
  options: e,
1570
1571
  mutationCache: t,
1571
1572
  state: r
1572
1573
  }) {
1573
- C(this, Fe, new J(0));
1574
- C(this, te, new I());
1574
+ C(this, Ee, new J(0));
1575
+ C(this, se, new I());
1575
1576
  C(this, be, new I());
1576
1577
  m(this, "state", fe());
1577
1578
  m(this, "state$");
1578
1579
  m(this, "options");
1579
- m(this, "observerCount$", a(this, Fe).asObservable());
1580
- m(this, "cancelled$", a(this, te).asObservable());
1580
+ m(this, "observerCount$", a(this, Ee).asObservable());
1581
+ m(this, "cancelled$", a(this, se).asObservable());
1581
1582
  this.options = e, this.state = r ?? this.state;
1582
- const n = a(this, te).pipe(
1583
+ const n = a(this, se).pipe(
1583
1584
  O(() => this.state.status === "pending"),
1584
1585
  g(() => ({
1585
1586
  status: "idle"
@@ -1592,16 +1593,16 @@ class Ys {
1592
1593
  onMutate: (l) => {
1593
1594
  const h = U(
1594
1595
  () => {
1595
- var f, b;
1596
- return (b = (f = t.config).onMutate) == null ? void 0 : b.call(
1596
+ var f, y;
1597
+ return (y = (f = t.config).onMutate) == null ? void 0 : y.call(
1597
1598
  f,
1598
1599
  l,
1599
1600
  this
1600
1601
  );
1601
1602
  }
1602
1603
  ), p = U(() => {
1603
- var f, b;
1604
- return (b = (f = this.options).onMutate) == null ? void 0 : b.call(f, l);
1604
+ var f, y;
1605
+ return (y = (f = this.options).onMutate) == null ? void 0 : y.call(f, l);
1605
1606
  });
1606
1607
  return h.pipe(
1607
1608
  k(() => p)
@@ -1610,8 +1611,8 @@ class Ys {
1610
1611
  onError: (l, h, o) => {
1611
1612
  const p = U(
1612
1613
  () => {
1613
- var f, b;
1614
- return (b = (f = t.config).onError) == null ? void 0 : b.call(
1614
+ var f, y;
1615
+ return (y = (f = t.config).onError) == null ? void 0 : y.call(
1615
1616
  f,
1616
1617
  l,
1617
1618
  h,
@@ -1621,18 +1622,18 @@ class Ys {
1621
1622
  }
1622
1623
  ), d = U(
1623
1624
  () => {
1624
- var f, b;
1625
- return (b = (f = this.options).onError) == null ? void 0 : b.call(f, l, h, o);
1625
+ var f, y;
1626
+ return (y = (f = this.options).onError) == null ? void 0 : y.call(f, l, h, o);
1626
1627
  }
1627
1628
  );
1628
- return De(p, d).pipe(ke());
1629
+ return ke(p, d).pipe(Te());
1629
1630
  },
1630
1631
  onSettled: (l, h, o, p) => {
1631
1632
  const d = U(
1632
1633
  () => {
1633
- var b, y;
1634
- return (y = (b = t.config).onSettled) == null ? void 0 : y.call(
1635
- b,
1634
+ var y, b;
1635
+ return (b = (y = t.config).onSettled) == null ? void 0 : b.call(
1636
+ y,
1636
1637
  l,
1637
1638
  h,
1638
1639
  o,
@@ -1642,17 +1643,17 @@ class Ys {
1642
1643
  }
1643
1644
  ), f = U(
1644
1645
  () => {
1645
- var b, y;
1646
- return (y = (b = this.options).onSettled) == null ? void 0 : y.call(b, l, h, o, p);
1646
+ var y, b;
1647
+ return (b = (y = this.options).onSettled) == null ? void 0 : b.call(y, l, h, o, p);
1647
1648
  }
1648
1649
  );
1649
- return De(d, f).pipe(ke());
1650
+ return ke(d, f).pipe(Te());
1650
1651
  },
1651
1652
  onSuccess: (l, h, o) => {
1652
1653
  const p = U(
1653
1654
  () => {
1654
- var f, b;
1655
- return (b = (f = t.config).onSuccess) == null ? void 0 : b.call(
1655
+ var f, y;
1656
+ return (y = (f = t.config).onSuccess) == null ? void 0 : y.call(
1656
1657
  f,
1657
1658
  l,
1658
1659
  h,
@@ -1662,16 +1663,16 @@ class Ys {
1662
1663
  }
1663
1664
  ), d = U(
1664
1665
  () => {
1665
- var f, b;
1666
- return (b = (f = this.options).onSuccess) == null ? void 0 : b.call(f, l, h, o);
1666
+ var f, y;
1667
+ return (y = (f = this.options).onSuccess) == null ? void 0 : y.call(f, l, h, o);
1667
1668
  }
1668
1669
  );
1669
- return De(p, d).pipe(ke());
1670
+ return ke(p, d).pipe(Te());
1670
1671
  }
1671
1672
  },
1672
1673
  state: this.state,
1673
1674
  variables: c
1674
- }).pipe(ne(a(this, te)))
1675
+ }).pipe(ne(a(this, se)))
1675
1676
  )
1676
1677
  ), i = F(n, u);
1677
1678
  this.state$ = i.pipe(
@@ -1687,9 +1688,9 @@ class Ys {
1687
1688
  E((c) => {
1688
1689
  this.state = c;
1689
1690
  }),
1690
- Qe(1),
1691
+ Ue(1),
1691
1692
  lt((c) => {
1692
- a(this, Fe).next(c);
1693
+ a(this, Ee).next(c);
1693
1694
  })
1694
1695
  );
1695
1696
  }
@@ -1705,7 +1706,7 @@ class Ys {
1705
1706
  * is over, unlike the state which can be re-subscribed later.
1706
1707
  */
1707
1708
  execute(e) {
1708
- return a(this, be).next(e), a(this, be).complete(), this.state$.pipe($e);
1709
+ return a(this, be).next(e), a(this, be).complete(), this.state$.pipe(we);
1709
1710
  }
1710
1711
  continue() {
1711
1712
  return this.execute(this.state.variables);
@@ -1716,16 +1717,16 @@ class Ys {
1716
1717
  * when no more observers are listening
1717
1718
  */
1718
1719
  cancel() {
1719
- a(this, te).next(), a(this, te).complete();
1720
+ a(this, se).next(), a(this, se).complete();
1720
1721
  }
1721
1722
  }
1722
- Fe = new WeakMap(), te = new WeakMap(), be = new WeakMap();
1723
+ Ee = new WeakMap(), se = new WeakMap(), be = new WeakMap();
1723
1724
  const Rt = ({
1724
1725
  mutationKey: s,
1725
1726
  status: e,
1726
1727
  predicate: t,
1727
1728
  exact: r = !0
1728
- } = {}) => (u) => r && s !== void 0 && u.options.mutationKey !== void 0 && !He(u.options.mutationKey, s, { exact: r }) || !r && s !== void 0 && u.options.mutationKey !== void 0 && !He(u.options.mutationKey, s, { exact: r }) || e && u.state.status !== e ? !1 : t ? t(u) : !0;
1729
+ } = {}) => (u) => r && s !== void 0 && u.options.mutationKey !== void 0 && !_e(u.options.mutationKey, s, { exact: r }) || !r && s !== void 0 && u.options.mutationKey !== void 0 && !_e(u.options.mutationKey, s, { exact: r }) || e && u.state.status !== e ? !1 : t ? t(u) : !0;
1729
1730
  class Wt {
1730
1731
  constructor() {
1731
1732
  /**
@@ -1748,7 +1749,7 @@ class Wt {
1748
1749
  m(this, "stateChange$", F(
1749
1750
  this.entriesSubject.pipe(
1750
1751
  Je(),
1751
- k((e) => me(e))
1752
+ k((e) => Se(e))
1752
1753
  ),
1753
1754
  this.added$
1754
1755
  ).pipe(
@@ -1801,12 +1802,12 @@ class Bs {
1801
1802
  x(
1802
1803
  () => n.observerCount$.pipe(
1803
1804
  O((u) => u <= 1),
1804
- qe(1)
1805
+ He(1)
1805
1806
  )
1806
1807
  ),
1807
1808
  // defaults to 5mn
1808
- x(() => Ae(n.options.gcTime ?? 5 * 60 * 1e3)),
1809
- qe(1)
1809
+ x(() => Qe(n.options.gcTime ?? 5 * 60 * 1e3)),
1810
+ He(1)
1810
1811
  ).subscribe({
1811
1812
  complete: () => {
1812
1813
  this.remove(n);
@@ -1875,7 +1876,7 @@ class Bs {
1875
1876
  predicate: (r) => r.state.isPaused
1876
1877
  });
1877
1878
  if (!e.length)
1878
- return re;
1879
+ return Z;
1879
1880
  const t = e.map((r) => r.continue());
1880
1881
  return ls(t);
1881
1882
  }
@@ -1903,10 +1904,10 @@ function Xs(s) {
1903
1904
  fetchStatus: "idle"
1904
1905
  };
1905
1906
  }
1906
- const Zs = (s) => Me(() => ze.isFocused() ? s : ze.focusRegained$.pipe(k(() => s))), er = (s) => {
1907
+ const Zs = (s) => Ae(() => ze.isFocused() ? s : ze.focusRegained$.pipe(k(() => s))), er = (s) => {
1907
1908
  let e = 0;
1908
1909
  return (t) => {
1909
- const r = se.backToOnline$.pipe(
1910
+ const r = re.backToOnline$.pipe(
1910
1911
  k(
1911
1912
  () => F(
1912
1913
  v({ fetchStatus: "fetching" }),
@@ -1914,10 +1915,10 @@ const Zs = (s) => Me(() => ze.isFocused() ? s : ze.focusRegained$.pipe(k(() => s
1914
1915
  )
1915
1916
  )
1916
1917
  );
1917
- return Me(() => (e++, !se.isOnline() && s.networkMode === "offlineFirst" && e > 1 ? F(
1918
+ return Ae(() => (e++, !re.isOnline() && s.networkMode === "offlineFirst" && e > 1 ? F(
1918
1919
  v({ fetchStatus: "paused" }),
1919
1920
  r
1920
- ) : !se.isOnline() && s.networkMode !== "always" && s.networkMode !== "offlineFirst" ? F(
1921
+ ) : !re.isOnline() && s.networkMode !== "always" && s.networkMode !== "offlineFirst" ? F(
1921
1922
  v({ fetchStatus: "paused" }),
1922
1923
  r
1923
1924
  ) : t));
@@ -2028,7 +2029,7 @@ const Zs = (s) => Me(() => ze.isFocused() ? s : ze.focusRegained$.pipe(k(() => s
2028
2029
  de()
2029
2030
  ), h = v({
2030
2031
  status: "pending",
2031
- fetchStatus: se.isOnline() ? "fetching" : "paused"
2032
+ fetchStatus: re.isOnline() ? "fetching" : "paused"
2032
2033
  });
2033
2034
  return {
2034
2035
  state$: F(
@@ -2095,14 +2096,14 @@ function Gt(s) {
2095
2096
  return e;
2096
2097
  }
2097
2098
  const ir = Gt();
2098
- var Ee, ae;
2099
+ var xe, ae;
2099
2100
  class ur {
2100
2101
  constructor(e) {
2101
2102
  m(this, "queryKey");
2102
2103
  m(this, "queryHash");
2103
2104
  m(this, "gcTime");
2104
2105
  m(this, "options");
2105
- C(this, Ee, void 0);
2106
+ C(this, xe, void 0);
2106
2107
  C(this, ae, void 0);
2107
2108
  m(this, "state");
2108
2109
  // @todo to share with mutation
@@ -2117,7 +2118,7 @@ class ur {
2117
2118
  m(this, "observerCount$", this.observersSubject.asObservable().pipe(g((e) => e.length)));
2118
2119
  m(this, "observers$", this.observersSubject.asObservable());
2119
2120
  m(this, "state$");
2120
- M(this, Ee, e.defaultOptions), this.options = this.setOptions(e.options), this.queryKey = e.queryKey, this.queryHash = e.queryHash, M(this, ae, e.state ?? Xs(this.options)), this.state = a(this, ae), this.gcTime = this.updateGcTime(this.options.gcTime), this.state$ = F(
2121
+ M(this, xe, e.defaultOptions), this.options = this.setOptions(e.options), this.queryKey = e.queryKey, this.queryHash = e.queryHash, M(this, ae, e.state ?? Xs(this.options)), this.state = a(this, ae), this.gcTime = this.updateGcTime(this.options.gcTime), this.state$ = F(
2121
2122
  this.resetSubject.pipe(
2122
2123
  g(() => ({ command: "reset", state: a(this, ae) }))
2123
2124
  ),
@@ -2215,11 +2216,11 @@ class ur {
2215
2216
  throw ir.error(t), t;
2216
2217
  }),
2217
2218
  ne(this.destroySubject),
2218
- Qe({ bufferSize: 1, refCount: !1 })
2219
+ Ue({ bufferSize: 1, refCount: !1 })
2219
2220
  );
2220
2221
  }
2221
2222
  setOptions(e) {
2222
- return this.options = { ...a(this, Ee), ...e }, this.updateGcTime(this.options.gcTime), this.options;
2223
+ return this.options = { ...a(this, xe), ...e }, this.updateGcTime(this.options.gcTime), this.options;
2223
2224
  }
2224
2225
  get meta() {
2225
2226
  return this.options.meta;
@@ -2269,7 +2270,7 @@ class ur {
2269
2270
  updateGcTime(e) {
2270
2271
  return this.gcTime = Math.max(
2271
2272
  this.gcTime || 0,
2272
- e ?? (_e ? 1 / 0 : 5 * 60 * 1e3)
2273
+ e ?? (pe ? 1 / 0 : 5 * 60 * 1e3)
2273
2274
  ), this.gcTime;
2274
2275
  }
2275
2276
  isActive() {
@@ -2286,7 +2287,7 @@ class ur {
2286
2287
  }
2287
2288
  async getFetchResultAsPromise() {
2288
2289
  return await new Promise((e, t) => {
2289
- this.state$.pipe(qt, Te()).subscribe({
2290
+ this.state$.pipe(qt, Ke()).subscribe({
2290
2291
  error: t,
2291
2292
  next: (r) => {
2292
2293
  r.error ? t(r.error) : e(r.data);
@@ -2317,13 +2318,13 @@ class ur {
2317
2318
  this.resetSubject.next();
2318
2319
  }
2319
2320
  }
2320
- Ee = new WeakMap(), ae = new WeakMap();
2321
- var xe, G;
2321
+ xe = new WeakMap(), ae = new WeakMap();
2322
+ var Re, G;
2322
2323
  class ar {
2323
2324
  // protected mountSubscriptions: Subscription[]
2324
2325
  constructor(e = {}) {
2325
2326
  // readonly #queries: QueryStore = new Map<string, Query>()
2326
- C(this, xe, new I());
2327
+ C(this, Re, new I());
2327
2328
  C(this, G, new Wt());
2328
2329
  this.config = e;
2329
2330
  }
@@ -2332,7 +2333,7 @@ class ar {
2332
2333
  unmount() {
2333
2334
  }
2334
2335
  notify(e) {
2335
- a(this, xe).next(e);
2336
+ a(this, Re).next(e);
2336
2337
  }
2337
2338
  observeIsFetching(e) {
2338
2339
  return a(this, G).stateChange$.pipe(
@@ -2369,7 +2370,7 @@ class ar {
2369
2370
  a(this, G).add(e);
2370
2371
  const t = e.observerCount$.pipe(
2371
2372
  O((r) => r < 1),
2372
- qe(1)
2373
+ He(1)
2373
2374
  );
2374
2375
  e.success$.subscribe(() => {
2375
2376
  var r, n;
@@ -2393,9 +2394,9 @@ class ar {
2393
2394
  ks,
2394
2395
  x((r) => r ? t.pipe(
2395
2396
  // defaults to 5mn
2396
- x(() => e.gcTime === 1 / 0 ? Ne : (setTimeout(N, e.gcTime), Ae(e.gcTime)))
2397
- ) : Ne),
2398
- qe(1)
2397
+ x(() => e.gcTime === 1 / 0 ? qe : (setTimeout(N, e.gcTime), Qe(e.gcTime)))
2398
+ ) : qe),
2399
+ He(1)
2399
2400
  ).subscribe({
2400
2401
  complete: () => {
2401
2402
  this.remove(e);
@@ -2414,7 +2415,7 @@ class ar {
2414
2415
  }
2415
2416
  subscribe(e) {
2416
2417
  const t = F(
2417
- a(this, xe).pipe(E(e))
2418
+ a(this, Re).pipe(E(e))
2418
2419
  // this.#store.added$.pipe(
2419
2420
  // mergeMap((query) => {
2420
2421
  // fn({
@@ -2450,9 +2451,9 @@ class ar {
2450
2451
  clear() {
2451
2452
  }
2452
2453
  }
2453
- xe = new WeakMap(), G = new WeakMap();
2454
- var oe, A, Re, je, ye;
2455
- class Fr {
2454
+ Re = new WeakMap(), G = new WeakMap();
2455
+ var oe, A, je, Me, ge;
2456
+ class Er {
2456
2457
  // #destroy = () => {}
2457
2458
  constructor({
2458
2459
  mutationCache: e,
@@ -2461,10 +2462,10 @@ class Fr {
2461
2462
  } = {}) {
2462
2463
  C(this, oe, void 0);
2463
2464
  C(this, A, void 0);
2464
- C(this, Re, /* @__PURE__ */ new Map());
2465
2465
  C(this, je, /* @__PURE__ */ new Map());
2466
- C(this, ye, void 0);
2467
- M(this, oe, e ?? new Bs()), M(this, A, t ?? new ar()), M(this, ye, r ?? {});
2466
+ C(this, Me, /* @__PURE__ */ new Map());
2467
+ C(this, ge, void 0);
2468
+ M(this, oe, e ?? new Bs()), M(this, A, t ?? new ar()), M(this, ge, r ?? {});
2468
2469
  }
2469
2470
  mount() {
2470
2471
  }
@@ -2478,7 +2479,7 @@ class Fr {
2478
2479
  }
2479
2480
  defaultMutationOptions(e) {
2480
2481
  return {
2481
- ...a(this, ye).mutations,
2482
+ ...a(this, ge).mutations,
2482
2483
  ...(e == null ? void 0 : e.mutationKey) && this.getMutationDefaults(e.mutationKey),
2483
2484
  ...e
2484
2485
  };
@@ -2487,7 +2488,7 @@ class Fr {
2487
2488
  if (e._defaulted)
2488
2489
  return e;
2489
2490
  const t = {
2490
- ...a(this, ye).queries,
2491
+ ...a(this, ge).queries,
2491
2492
  ...this.getQueryDefaults(e.queryKey),
2492
2493
  ...e,
2493
2494
  _defaulted: !0
@@ -2538,10 +2539,10 @@ class Fr {
2538
2539
  return a(this, A).build(this, n).setData(c, { ...r, manual: !0 });
2539
2540
  }
2540
2541
  getMutationDefaults(e) {
2541
- const t = [...a(this, Re).values()];
2542
+ const t = [...a(this, je).values()];
2542
2543
  let r = {};
2543
2544
  return t.forEach((n) => {
2544
- He(e, n.mutationKey) && (r = { ...r, ...n.defaultOptions });
2545
+ _e(e, n.mutationKey) && (r = { ...r, ...n.defaultOptions });
2545
2546
  }), r;
2546
2547
  }
2547
2548
  getQueryState(e) {
@@ -2549,19 +2550,19 @@ class Fr {
2549
2550
  return (t = a(this, A).find({ queryKey: e })) == null ? void 0 : t.state;
2550
2551
  }
2551
2552
  setMutationDefaults(e, t) {
2552
- a(this, Re).set(Se(e), {
2553
+ a(this, je).set(ve(e), {
2553
2554
  mutationKey: e,
2554
2555
  defaultOptions: t
2555
2556
  });
2556
2557
  }
2557
2558
  setQueryDefaults(e, t) {
2558
- a(this, je).set(Se(e), {
2559
+ a(this, Me).set(ve(e), {
2559
2560
  queryKey: e,
2560
2561
  defaultOptions: t
2561
2562
  });
2562
2563
  }
2563
2564
  getQueryDefaults(e) {
2564
- const t = [...a(this, je).values()];
2565
+ const t = [...a(this, Me).values()];
2565
2566
  let r = {};
2566
2567
  return t.forEach((n) => {
2567
2568
  et(e, n.queryKey) && (r = { ...r, ...n.defaultOptions });
@@ -2602,33 +2603,34 @@ class Fr {
2602
2603
  a(this, A).clear(), a(this, oe).clear();
2603
2604
  }
2604
2605
  }
2605
- oe = new WeakMap(), A = new WeakMap(), Re = new WeakMap(), je = new WeakMap(), ye = new WeakMap();
2606
+ oe = new WeakMap(), A = new WeakMap(), je = new WeakMap(), Me = new WeakMap(), ge = new WeakMap();
2606
2607
  export {
2607
2608
  Bs as MutationCache,
2608
2609
  ar as QueryCache,
2609
- Fr as QueryClient,
2610
- vr as QueryClientProvider,
2610
+ Er as QueryClient,
2611
+ Or as QueryClientProvider,
2611
2612
  Ss as SIGNAL_RESET,
2613
+ vr as arrayEqual,
2612
2614
  Os as createLocalStorageAdapter,
2613
2615
  gr as createLocalforageAdapter,
2614
2616
  Fs as exponentialBackoffDelay,
2615
2617
  Cs as getDelay,
2616
2618
  rt as isDefined,
2617
2619
  Pt as retryBackoff,
2618
- br as signal,
2620
+ yr as signal,
2619
2621
  Vt as useBehaviorSubject,
2620
- wr as useForeverQuery,
2622
+ Cr as useForeverQuery,
2621
2623
  q as useLiveRef,
2622
- Or as useMutation,
2624
+ $r as useMutation,
2623
2625
  pr as useObservableState,
2624
2626
  Xe as useObserve,
2625
2627
  fr as useObserveCallback,
2626
2628
  mr as usePersistSignals,
2627
- $r as useQuery,
2629
+ wr as useQuery,
2628
2630
  Tt as useQueryClient,
2629
- yr as useSignalValue,
2631
+ br as useSignalValue,
2630
2632
  It as useSubject,
2631
2633
  Ut as useSubscribe,
2632
- Cr as useSubscribeEffect,
2634
+ Fr as useSubscribeEffect,
2633
2635
  Sr as useUnmountObservable
2634
2636
  };