@hortiview/modulebase 1.1.2-alpha.870da389.1 → 2.0.0-alpha.e897c28d.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/IsRestoringProvider-Dc5Evyjr.js +6 -0
  2. package/dist/QueryClientProvider-DZI32rjZ.js +21 -0
  3. package/dist/api-CSxWxEZl.js +148 -0
  4. package/dist/{chunk-EVOBXE3Y-B43QN6RE.js → chunk-EVOBXE3Y-BRmUxtwH.js} +126 -127
  5. package/dist/components/ModuleBase.js +13 -17
  6. package/dist/components/ModuleCore.js +11398 -9
  7. package/dist/constants.js +1 -2
  8. package/dist/defaultQueryClient-Cfsorhtn.js +620 -0
  9. package/dist/hooks/useBreadcrumbTranslation.js +13 -16
  10. package/dist/hooks/useCustom.js +1 -1
  11. package/dist/hooks/useCustomMutation.js +5 -5
  12. package/dist/hooks/useEntity.js +1 -1
  13. package/dist/hooks/useOffline.js +1 -1
  14. package/dist/hooks/useOption.js +2 -2
  15. package/dist/hooks/useSignalRMessages.js +1 -1
  16. package/dist/lib/components/ModuleBase.d.ts +3 -22
  17. package/dist/lib/components/ModuleCore.d.ts +3 -17
  18. package/dist/lib/main.d.ts +0 -3
  19. package/dist/lib/module-router.d.ts +1 -1
  20. package/dist/lib/provider/SignalR/SignalRProvider.d.ts +0 -4
  21. package/dist/lib/types/BaseProps.d.ts +38 -1
  22. package/dist/lib/utils/defaultQueryClient.d.ts +2 -0
  23. package/dist/lib/utils/defaultSignalRClient.d.ts +4 -0
  24. package/dist/lib/utils/helper.d.ts +1 -2
  25. package/dist/main.js +56 -187
  26. package/dist/module-router.js +2 -2
  27. package/dist/provider/SignalR/SignalRProvider.js +22 -5966
  28. package/dist/{IsRestoringProvider-SzKJZczp.js → query-DZDIN635.js} +211 -232
  29. package/dist/stores/BasePropsStore.js +1 -0
  30. package/dist/{useCustomMutation-9VUQ7NbQ.js → useCustomMutation-C1aVbjpt.js} +13 -12
  31. package/dist/{useQuery-DUDyh33-.js → useQuery-CUSHkb38.js} +33 -31
  32. package/dist/utils/api.js +1 -1
  33. package/dist/utils/baseFetches.js +1 -1
  34. package/dist/utils/defaultQueryClient.js +4 -0
  35. package/dist/utils/defaultSignalRClient.js +5949 -0
  36. package/dist/utils/helper.js +9 -10
  37. package/package.json +1 -1
  38. package/dist/ModuleCore-DRMqZO8r.js +0 -12017
  39. package/dist/api-COabZnyn.js +0 -147
  40. package/dist/lib/types/ServiceBus.d.ts +0 -17
  41. package/dist/types/ServiceBus.js +0 -1
@@ -1,6 +1,4 @@
1
- import * as S from "react";
2
- import { jsx as H } from "react/jsx-runtime";
3
- var k = class {
1
+ var M = class {
4
2
  constructor() {
5
3
  this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
6
4
  }
@@ -16,7 +14,7 @@ var k = class {
16
14
  }
17
15
  onUnsubscribe() {
18
16
  }
19
- }, z = class extends k {
17
+ }, G = class extends M {
20
18
  #e;
21
19
  #t;
22
20
  #r;
@@ -53,7 +51,7 @@ var k = class {
53
51
  isFocused() {
54
52
  return typeof this.#e == "boolean" ? this.#e : globalThis.document?.visibilityState !== "hidden";
55
53
  }
56
- }, B = new z(), $ = {
54
+ }, V = new G(), H = {
57
55
  // We need the wrapper function syntax below instead of direct references to
58
56
  // global setTimeout etc.
59
57
  //
@@ -68,7 +66,7 @@ var k = class {
68
66
  clearTimeout: (e) => clearTimeout(e),
69
67
  setInterval: (e, t) => setInterval(e, t),
70
68
  clearInterval: (e) => clearInterval(e)
71
- }, J = class {
69
+ }, x = class {
72
70
  // We cannot have TimeoutManager<T> as we must instantiate it with a concrete
73
71
  // type at app boot; and if we leave that type, then any new timer provider
74
72
  // would need to support the default provider's concrete timer ID, which is
@@ -76,7 +74,7 @@ var k = class {
76
74
  //
77
75
  // We settle for type safety for the TimeoutProvider type, and accept that
78
76
  // this class is unsafe internally to allow for extension.
79
- #e = $;
77
+ #e = H;
80
78
  #t = !1;
81
79
  setTimeoutProvider(e) {
82
80
  process.env.NODE_ENV !== "production" && this.#t && e !== this.#e && console.error(
@@ -96,101 +94,101 @@ var k = class {
96
94
  clearInterval(e) {
97
95
  this.#e.clearInterval(e);
98
96
  }
99
- }, C = new J();
100
- function W(e) {
97
+ }, P = new x();
98
+ function z(e) {
101
99
  setTimeout(e, 0);
102
100
  }
103
- var Z = typeof window > "u" || "Deno" in globalThis;
104
- function P() {
101
+ var $ = typeof window > "u" || "Deno" in globalThis;
102
+ function w() {
105
103
  }
106
- function Se(e, t) {
104
+ function pe(e, t) {
107
105
  return typeof e == "function" ? e(t) : e;
108
106
  }
109
- function X(e) {
107
+ function B(e) {
110
108
  return typeof e == "number" && e >= 0 && e !== 1 / 0;
111
109
  }
112
- function Y(e, t) {
110
+ function J(e, t) {
113
111
  return Math.max(e + (t || 0) - Date.now(), 0);
114
112
  }
115
- function ee(e, t) {
113
+ function W(e, t) {
116
114
  return typeof e == "function" ? e(t) : e;
117
115
  }
118
- function te(e, t) {
116
+ function Z(e, t) {
119
117
  return typeof e == "function" ? e(t) : e;
120
118
  }
121
- function Fe(e, t) {
119
+ function ve(e, t) {
122
120
  const {
123
121
  type: s = "all",
124
122
  exact: r,
125
- fetchStatus: i,
123
+ fetchStatus: n,
126
124
  predicate: o,
127
125
  queryKey: u,
128
126
  stale: a
129
127
  } = e;
130
128
  if (u) {
131
129
  if (r) {
132
- if (t.queryHash !== se(u, t.options))
130
+ if (t.queryHash !== X(u, t.options))
133
131
  return !1;
134
- } else if (!I(t.queryKey, u))
132
+ } else if (!D(t.queryKey, u))
135
133
  return !1;
136
134
  }
137
135
  if (s !== "all") {
138
- const n = t.isActive();
139
- if (s === "active" && !n || s === "inactive" && n)
136
+ const i = t.isActive();
137
+ if (s === "active" && !i || s === "inactive" && i)
140
138
  return !1;
141
139
  }
142
- return !(typeof a == "boolean" && t.isStale() !== a || i && i !== t.state.fetchStatus || o && !o(t));
140
+ return !(typeof a == "boolean" && t.isStale() !== a || n && n !== t.state.fetchStatus || o && !o(t));
143
141
  }
144
- function we(e, t) {
145
- const { exact: s, status: r, predicate: i, mutationKey: o } = e;
142
+ function me(e, t) {
143
+ const { exact: s, status: r, predicate: n, mutationKey: o } = e;
146
144
  if (o) {
147
145
  if (!t.options.mutationKey)
148
146
  return !1;
149
147
  if (s) {
150
148
  if (O(t.options.mutationKey) !== O(o))
151
149
  return !1;
152
- } else if (!I(t.options.mutationKey, o))
150
+ } else if (!D(t.options.mutationKey, o))
153
151
  return !1;
154
152
  }
155
- return !(r && t.state.status !== r || i && !i(t));
153
+ return !(r && t.state.status !== r || n && !n(t));
156
154
  }
157
- function se(e, t) {
155
+ function X(e, t) {
158
156
  return (t?.queryKeyHashFn || O)(e);
159
157
  }
160
158
  function O(e) {
161
159
  return JSON.stringify(
162
160
  e,
163
- (t, s) => E(s) ? Object.keys(s).sort().reduce((r, i) => (r[i] = s[i], r), {}) : s
161
+ (t, s) => C(s) ? Object.keys(s).sort().reduce((r, n) => (r[n] = s[n], r), {}) : s
164
162
  );
165
163
  }
166
- function I(e, t) {
167
- return e === t ? !0 : typeof e != typeof t ? !1 : e && t && typeof e == "object" && typeof t == "object" ? Object.keys(t).every((s) => I(e[s], t[s])) : !1;
164
+ function D(e, t) {
165
+ return e === t ? !0 : typeof e != typeof t ? !1 : e && t && typeof e == "object" && typeof t == "object" ? Object.keys(t).every((s) => D(e[s], t[s])) : !1;
168
166
  }
169
- var re = Object.prototype.hasOwnProperty;
167
+ var Y = Object.prototype.hasOwnProperty;
170
168
  function q(e, t, s = 0) {
171
169
  if (e === t)
172
170
  return e;
173
171
  if (s > 500) return t;
174
- const r = R(e) && R(t);
175
- if (!r && !(E(e) && E(t))) return t;
176
- const o = (r ? e : Object.keys(e)).length, u = r ? t : Object.keys(t), a = u.length, n = r ? new Array(a) : {};
172
+ const r = I(e) && I(t);
173
+ if (!r && !(C(e) && C(t))) return t;
174
+ const o = (r ? e : Object.keys(e)).length, u = r ? t : Object.keys(t), a = u.length, i = r ? new Array(a) : {};
177
175
  let h = 0;
178
176
  for (let f = 0; f < a; f++) {
179
177
  const d = r ? f : u[f], y = e[d], v = t[d];
180
178
  if (y === v) {
181
- n[d] = y, (r ? f < o : re.call(e, d)) && h++;
179
+ i[d] = y, (r ? f < o : Y.call(e, d)) && h++;
182
180
  continue;
183
181
  }
184
182
  if (y === null || v === null || typeof y != "object" || typeof v != "object") {
185
- n[d] = v;
183
+ i[d] = v;
186
184
  continue;
187
185
  }
188
186
  const l = q(y, v, s + 1);
189
- n[d] = l, l === y && h++;
187
+ i[d] = l, l === y && h++;
190
188
  }
191
- return o === a && h === o ? e : n;
189
+ return o === a && h === o ? e : i;
192
190
  }
193
- function Pe(e, t) {
191
+ function ge(e, t) {
194
192
  if (!t || Object.keys(e).length !== Object.keys(t).length)
195
193
  return !1;
196
194
  for (const s in e)
@@ -198,27 +196,27 @@ function Pe(e, t) {
198
196
  return !1;
199
197
  return !0;
200
198
  }
201
- function R(e) {
199
+ function I(e) {
202
200
  return Array.isArray(e) && e.length === Object.keys(e).length;
203
201
  }
204
- function E(e) {
205
- if (!N(e))
202
+ function C(e) {
203
+ if (!R(e))
206
204
  return !1;
207
205
  const t = e.constructor;
208
206
  if (t === void 0)
209
207
  return !0;
210
208
  const s = t.prototype;
211
- return !(!N(s) || !s.hasOwnProperty("isPrototypeOf") || Object.getPrototypeOf(e) !== Object.prototype);
209
+ return !(!R(s) || !s.hasOwnProperty("isPrototypeOf") || Object.getPrototypeOf(e) !== Object.prototype);
212
210
  }
213
- function N(e) {
211
+ function R(e) {
214
212
  return Object.prototype.toString.call(e) === "[object Object]";
215
213
  }
216
- function ne(e) {
214
+ function ee(e) {
217
215
  return new Promise((t) => {
218
- C.setTimeout(t, e);
216
+ P.setTimeout(t, e);
219
217
  });
220
218
  }
221
- function ie(e, t, s) {
219
+ function te(e, t, s) {
222
220
  if (typeof s.structuralSharing == "function")
223
221
  return s.structuralSharing(e, t);
224
222
  if (s.structuralSharing !== !1) {
@@ -234,32 +232,32 @@ function ie(e, t, s) {
234
232
  }
235
233
  return t;
236
234
  }
237
- function ae(e, t, s = 0) {
235
+ function se(e, t, s = 0) {
238
236
  const r = [...e, t];
239
237
  return s && r.length > s ? r.slice(1) : r;
240
238
  }
241
- function oe(e, t, s = 0) {
239
+ function re(e, t, s = 0) {
242
240
  const r = [t, ...e];
243
241
  return s && r.length > s ? r.slice(0, -1) : r;
244
242
  }
245
243
  var T = /* @__PURE__ */ Symbol();
246
- function K(e, t) {
244
+ function k(e, t) {
247
245
  return process.env.NODE_ENV !== "production" && e.queryFn === T && console.error(
248
246
  `Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`
249
247
  ), !e.queryFn && t?.initialPromise ? () => t.initialPromise : !e.queryFn || e.queryFn === T ? () => Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)) : e.queryFn;
250
248
  }
251
- function Ce(e, t) {
249
+ function be(e, t) {
252
250
  return typeof e == "function" ? e(...t) : !!e;
253
251
  }
254
- function ue(e, t, s) {
255
- let r = !1, i;
252
+ function ie(e, t, s) {
253
+ let r = !1, n;
256
254
  return Object.defineProperty(e, "signal", {
257
255
  enumerable: !0,
258
- get: () => (i ??= t(), r || (r = !0, i.aborted ? s() : i.addEventListener("abort", s, { once: !0 })), i)
256
+ get: () => (n ??= t(), r || (r = !0, n.aborted ? s() : n.addEventListener("abort", s, { once: !0 })), n)
259
257
  }), e;
260
258
  }
261
- var Q = /* @__PURE__ */ (() => {
262
- let e = () => Z;
259
+ var K = /* @__PURE__ */ (() => {
260
+ let e = () => $;
263
261
  return {
264
262
  /**
265
263
  * Returns whether the current runtime should be treated as a server environment.
@@ -275,71 +273,71 @@ var Q = /* @__PURE__ */ (() => {
275
273
  }
276
274
  };
277
275
  })();
278
- function ce() {
276
+ function ne() {
279
277
  let e, t;
280
- const s = new Promise((i, o) => {
281
- e = i, t = o;
278
+ const s = new Promise((n, o) => {
279
+ e = n, t = o;
282
280
  });
283
281
  s.status = "pending", s.catch(() => {
284
282
  });
285
- function r(i) {
286
- Object.assign(s, i), delete s.resolve, delete s.reject;
283
+ function r(n) {
284
+ Object.assign(s, n), delete s.resolve, delete s.reject;
287
285
  }
288
- return s.resolve = (i) => {
286
+ return s.resolve = (n) => {
289
287
  r({
290
288
  status: "fulfilled",
291
- value: i
292
- }), e(i);
293
- }, s.reject = (i) => {
289
+ value: n
290
+ }), e(n);
291
+ }, s.reject = (n) => {
294
292
  r({
295
293
  status: "rejected",
296
- reason: i
297
- }), t(i);
294
+ reason: n
295
+ }), t(n);
298
296
  }, s;
299
297
  }
300
- function Oe(e) {
298
+ function Se(e) {
301
299
  let t;
302
- if (e.then((s) => (t = s, s), P)?.catch(P), t !== void 0)
300
+ if (e.then((s) => (t = s, s), w)?.catch(w), t !== void 0)
303
301
  return { data: t };
304
302
  }
305
- var le = W;
306
- function he() {
303
+ var ae = z;
304
+ function oe() {
307
305
  let e = [], t = 0, s = (a) => {
308
306
  a();
309
307
  }, r = (a) => {
310
308
  a();
311
- }, i = le;
309
+ }, n = ae;
312
310
  const o = (a) => {
313
- t ? e.push(a) : i(() => {
311
+ t ? e.push(a) : n(() => {
314
312
  s(a);
315
313
  });
316
314
  }, u = () => {
317
315
  const a = e;
318
- e = [], a.length && i(() => {
316
+ e = [], a.length && n(() => {
319
317
  r(() => {
320
- a.forEach((n) => {
321
- s(n);
318
+ a.forEach((i) => {
319
+ s(i);
322
320
  });
323
321
  });
324
322
  });
325
323
  };
326
324
  return {
327
325
  batch: (a) => {
328
- let n;
326
+ let i;
329
327
  t++;
330
328
  try {
331
- n = a();
329
+ i = a();
332
330
  } finally {
333
331
  t--, t || u();
334
332
  }
335
- return n;
333
+ return i;
336
334
  },
337
335
  /**
338
336
  * All calls to the wrapped function will be batched.
339
337
  */
340
- batchCalls: (a) => (...n) => {
338
+ batchCalls: (a) => (...i) => {
341
339
  o(() => {
342
- a(...n);
340
+ a(...i);
343
341
  });
344
342
  },
345
343
  schedule: o,
@@ -358,11 +356,11 @@ function he() {
358
356
  r = a;
359
357
  },
360
358
  setScheduler: (a) => {
361
- i = a;
359
+ n = a;
362
360
  }
363
361
  };
364
362
  }
365
- var fe = he(), de = class extends k {
363
+ var ue = oe(), ce = class extends M {
366
364
  #e = !0;
367
365
  #t;
368
366
  #r;
@@ -393,33 +391,33 @@ var fe = he(), de = class extends k {
393
391
  isOnline() {
394
392
  return this.#e;
395
393
  }
396
- }, L = new de();
397
- function ye(e) {
394
+ }, L = new ce();
395
+ function le(e) {
398
396
  return Math.min(1e3 * 2 ** e, 3e4);
399
397
  }
400
- function x(e) {
398
+ function Q(e) {
401
399
  return (e ?? "online") === "online" ? L.isOnline() : !0;
402
400
  }
403
- var j = class extends Error {
401
+ var E = class extends Error {
404
402
  constructor(e) {
405
403
  super("CancelledError"), this.revert = e?.revert, this.silent = e?.silent;
406
404
  }
407
405
  };
408
- function pe(e) {
406
+ function he(e) {
409
407
  let t = !1, s = 0, r;
410
- const i = ce(), o = () => i.status !== "pending", u = (c) => {
408
+ const n = ne(), o = () => n.status !== "pending", u = (c) => {
411
409
  if (!o()) {
412
- const p = new j(c);
410
+ const p = new E(c);
413
411
  y(p), e.onCancel?.(p);
414
412
  }
415
413
  }, a = () => {
416
414
  t = !0;
417
- }, n = () => {
415
+ }, i = () => {
418
416
  t = !1;
419
- }, h = () => B.isFocused() && (e.networkMode === "always" || L.isOnline()) && e.canRun(), f = () => x(e.networkMode) && e.canRun(), d = (c) => {
420
- o() || (r?.(), i.resolve(c));
417
+ }, h = () => V.isFocused() && (e.networkMode === "always" || L.isOnline()) && e.canRun(), f = () => Q(e.networkMode) && e.canRun(), d = (c) => {
418
+ o() || (r?.(), n.resolve(c));
421
419
  }, y = (c) => {
422
- o() || (r?.(), i.reject(c));
420
+ o() || (r?.(), n.reject(c));
423
421
  }, v = () => new Promise((c) => {
424
422
  r = (p) => {
425
423
  (o() || h()) && c(p);
@@ -439,61 +437,61 @@ function pe(e) {
439
437
  Promise.resolve(c).then(d).catch((m) => {
440
438
  if (o())
441
439
  return;
442
- const g = e.retry ?? (Q.isServer() ? 0 : 3), b = e.retryDelay ?? ye, F = typeof b == "function" ? b(s, m) : b, w = g === !0 || typeof g == "number" && s < g || typeof g == "function" && g(s, m);
443
- if (t || !w) {
440
+ const g = e.retry ?? (K.isServer() ? 0 : 3), b = e.retryDelay ?? le, S = typeof b == "function" ? b(s, m) : b, F = g === !0 || typeof g == "number" && s < g || typeof g == "function" && g(s, m);
441
+ if (t || !F) {
444
442
  y(m);
445
443
  return;
446
444
  }
447
- s++, e.onFail?.(s, m), ne(F).then(() => h() ? void 0 : v()).then(() => {
445
+ s++, e.onFail?.(s, m), ee(S).then(() => h() ? void 0 : v()).then(() => {
448
446
  t ? y(m) : l();
449
447
  });
450
448
  });
451
449
  };
452
450
  return {
453
- promise: i,
454
- status: () => i.status,
451
+ promise: n,
452
+ status: () => n.status,
455
453
  cancel: u,
456
- continue: () => (r?.(), i),
454
+ continue: () => (r?.(), n),
457
455
  cancelRetry: a,
458
- continueRetry: n,
456
+ continueRetry: i,
459
457
  canStart: f,
460
- start: () => (f() ? l() : v().then(l), i)
458
+ start: () => (f() ? l() : v().then(l), n)
461
459
  };
462
460
  }
463
- var ve = class {
461
+ var fe = class {
464
462
  #e;
465
463
  destroy() {
466
464
  this.clearGcTimeout();
467
465
  }
468
466
  scheduleGc() {
469
- this.clearGcTimeout(), X(this.gcTime) && (this.#e = C.setTimeout(() => {
467
+ this.clearGcTimeout(), B(this.gcTime) && (this.#e = P.setTimeout(() => {
470
468
  this.optionalRemove();
471
469
  }, this.gcTime));
472
470
  }
473
471
  updateGcTime(e) {
474
472
  this.gcTime = Math.max(
475
473
  this.gcTime || 0,
476
- e ?? (Q.isServer() ? 1 / 0 : 300 * 1e3)
474
+ e ?? (K.isServer() ? 1 / 0 : 300 * 1e3)
477
475
  );
478
476
  }
479
477
  clearGcTimeout() {
480
- this.#e !== void 0 && (C.clearTimeout(this.#e), this.#e = void 0);
478
+ this.#e !== void 0 && (P.clearTimeout(this.#e), this.#e = void 0);
481
479
  }
482
480
  };
483
- function me(e) {
481
+ function de(e) {
484
482
  return {
485
483
  onFetch: (t, s) => {
486
- const r = t.options, i = t.fetchOptions?.meta?.fetchMore?.direction, o = t.state.data?.pages || [], u = t.state.data?.pageParams || [];
487
- let a = { pages: [], pageParams: [] }, n = 0;
484
+ const r = t.options, n = t.fetchOptions?.meta?.fetchMore?.direction, o = t.state.data?.pages || [], u = t.state.data?.pageParams || [];
485
+ let a = { pages: [], pageParams: [] }, i = 0;
488
486
  const h = async () => {
489
487
  let f = !1;
490
488
  const d = (l) => {
491
- ue(
489
+ ie(
492
490
  l,
493
491
  () => t.signal,
494
492
  () => f = !0
495
493
  );
496
- }, y = K(t.options, t.fetchOptions), v = async (l, c, p) => {
494
+ }, y = k(t.options, t.fetchOptions), v = async (l, c, p) => {
497
495
  if (f)
498
496
  return Promise.reject(t.signal.reason);
499
497
  if (c == null && l.pages.length)
@@ -507,14 +505,14 @@ function me(e) {
507
505
  meta: t.options.meta
508
506
  };
509
507
  return d(A), A;
510
- })(), b = await y(g), { maxPages: F } = t.options, w = p ? oe : ae;
508
+ })(), b = await y(g), { maxPages: S } = t.options, F = p ? re : se;
511
509
  return {
512
- pages: w(l.pages, b, F),
513
- pageParams: w(l.pageParams, c, F)
510
+ pages: F(l.pages, b, S),
511
+ pageParams: F(l.pageParams, c, S)
514
512
  };
515
513
  };
516
- if (i && o.length) {
517
- const l = i === "backward", c = l ? _ : D, p = {
514
+ if (n && o.length) {
515
+ const l = n === "backward", c = l ? _ : j, p = {
518
516
  pages: o,
519
517
  pageParams: u
520
518
  }, m = c(r, p);
@@ -522,11 +520,11 @@ function me(e) {
522
520
  } else {
523
521
  const l = e ?? o.length;
524
522
  do {
525
- const c = n === 0 ? u[0] ?? r.initialPageParam : D(r, a);
526
- if (n > 0 && c == null)
523
+ const c = i === 0 ? u[0] ?? r.initialPageParam : j(r, a);
524
+ if (i > 0 && c == null)
527
525
  break;
528
- a = await v(a, c), n++;
529
- } while (n < l);
526
+ a = await v(a, c), i++;
527
+ } while (i < l);
530
528
  }
531
529
  return a;
532
530
  };
@@ -543,7 +541,7 @@ function me(e) {
543
541
  }
544
542
  };
545
543
  }
546
- function D(e, { pages: t, pageParams: s }) {
544
+ function j(e, { pages: t, pageParams: s }) {
547
545
  const r = t.length - 1;
548
546
  return t.length > 0 ? e.getNextPageParam(
549
547
  t[r],
@@ -555,23 +553,23 @@ function D(e, { pages: t, pageParams: s }) {
555
553
  function _(e, { pages: t, pageParams: s }) {
556
554
  return t.length > 0 ? e.getPreviousPageParam?.(t[0], t, s[0], s) : void 0;
557
555
  }
558
- function qe(e, t) {
559
- return t ? D(e, t) != null : !1;
556
+ function Fe(e, t) {
557
+ return t ? j(e, t) != null : !1;
560
558
  }
561
- function Ee(e, t) {
559
+ function we(e, t) {
562
560
  return !t || !e.getPreviousPageParam ? !1 : _(e, t) != null;
563
561
  }
564
- var Te = class extends ve {
562
+ var Pe = class extends fe {
565
563
  #e;
566
564
  #t;
567
565
  #r;
568
- #n;
566
+ #i;
569
567
  #a;
570
568
  #s;
571
569
  #u;
572
570
  #o;
573
571
  constructor(e) {
574
- super(), this.#o = !1, this.#u = e.defaultOptions, this.setOptions(e.options), this.observers = [], this.#a = e.client, this.#n = this.#a.getQueryCache(), this.queryKey = e.queryKey, this.queryHash = e.queryHash, this.#t = M(this.options), this.state = e.state ?? this.#t, this.scheduleGc();
572
+ super(), this.#o = !1, this.#u = e.defaultOptions, this.setOptions(e.options), this.observers = [], this.#a = e.client, this.#i = this.#a.getQueryCache(), this.queryKey = e.queryKey, this.queryHash = e.queryHash, this.#t = N(this.options), this.state = e.state ?? this.#t, this.scheduleGc();
575
573
  }
576
574
  get meta() {
577
575
  return this.options.meta;
@@ -584,18 +582,18 @@ var Te = class extends ve {
584
582
  }
585
583
  setOptions(e) {
586
584
  if (this.options = { ...this.#u, ...e }, e?._type && (this.#e = e._type), this.updateGcTime(this.options.gcTime), this.state && this.state.data === void 0) {
587
- const t = M(this.options);
585
+ const t = N(this.options);
588
586
  t.data !== void 0 && (this.setState(
589
587
  U(t.data, t.dataUpdatedAt)
590
588
  ), this.#t = t);
591
589
  }
592
590
  }
593
591
  optionalRemove() {
594
- !this.observers.length && this.state.fetchStatus === "idle" && this.#n.remove(this);
592
+ !this.observers.length && this.state.fetchStatus === "idle" && this.#i.remove(this);
595
593
  }
596
594
  setData(e, t) {
597
- const s = ie(this.state.data, e, this.options);
598
- return this.#i({
595
+ const s = te(this.state.data, e, this.options);
596
+ return this.#n({
599
597
  data: s,
600
598
  type: "success",
601
599
  dataUpdatedAt: t?.updatedAt,
@@ -603,11 +601,11 @@ var Te = class extends ve {
603
601
  }), s;
604
602
  }
605
603
  setState(e) {
606
- this.#i({ type: "setState", state: e });
604
+ this.#n({ type: "setState", state: e });
607
605
  }
608
606
  cancel(e) {
609
607
  const t = this.#s?.promise;
610
- return this.#s?.cancel(e), t ? t.then(P).catch(P) : Promise.resolve();
608
+ return this.#s?.cancel(e), t ? t.then(w).catch(w) : Promise.resolve();
611
609
  }
612
610
  destroy() {
613
611
  super.destroy(), this.cancel({ silent: !0 });
@@ -620,7 +618,7 @@ var Te = class extends ve {
620
618
  }
621
619
  isActive() {
622
620
  return this.observers.some(
623
- (e) => te(e.options.enabled, this) !== !1
621
+ (e) => Z(e.options.enabled, this) !== !1
624
622
  );
625
623
  }
626
624
  isDisabled() {
@@ -631,7 +629,7 @@ var Te = class extends ve {
631
629
  }
632
630
  isStatic() {
633
631
  return this.getObserversCount() > 0 ? this.observers.some(
634
- (e) => ee(e.options.staleTime, this) === "static"
632
+ (e) => W(e.options.staleTime, this) === "static"
635
633
  ) : !1;
636
634
  }
637
635
  isStale() {
@@ -640,7 +638,7 @@ var Te = class extends ve {
640
638
  ) : this.state.data === void 0 || this.state.isInvalidated;
641
639
  }
642
640
  isStaleByTime(e = 0) {
643
- return this.state.data === void 0 ? !0 : e === "static" ? !1 : this.state.isInvalidated ? !0 : !Y(this.state.dataUpdatedAt, e);
641
+ return this.state.data === void 0 ? !0 : e === "static" ? !1 : this.state.isInvalidated ? !0 : !J(this.state.dataUpdatedAt, e);
644
642
  }
645
643
  onFocus() {
646
644
  this.observers.find((t) => t.shouldFetchOnWindowFocus())?.refetch({ cancelRefetch: !1 }), this.#s?.continue();
@@ -649,10 +647,10 @@ var Te = class extends ve {
649
647
  this.observers.find((t) => t.shouldFetchOnReconnect())?.refetch({ cancelRefetch: !1 }), this.#s?.continue();
650
648
  }
651
649
  addObserver(e) {
652
- this.observers.includes(e) || (this.observers.push(e), this.clearGcTimeout(), this.#n.notify({ type: "observerAdded", query: this, observer: e }));
650
+ this.observers.includes(e) || (this.observers.push(e), this.clearGcTimeout(), this.#i.notify({ type: "observerAdded", query: this, observer: e }));
653
651
  }
654
652
  removeObserver(e) {
655
- this.observers.includes(e) && (this.observers = this.observers.filter((t) => t !== e), this.observers.length || (this.#s && (this.#o || this.#c() ? this.#s.cancel({ revert: !0 }) : this.#s.cancelRetry()), this.scheduleGc()), this.#n.notify({ type: "observerRemoved", query: this, observer: e }));
653
+ this.observers.includes(e) && (this.observers = this.observers.filter((t) => t !== e), this.observers.length || (this.#s && (this.#o || this.#c() ? this.#s.cancel({ revert: !0 }) : this.#s.cancelRetry()), this.scheduleGc()), this.#i.notify({ type: "observerRemoved", query: this, observer: e }));
656
654
  }
657
655
  getObserversCount() {
658
656
  return this.observers.length;
@@ -661,7 +659,7 @@ var Te = class extends ve {
661
659
  return this.state.fetchStatus === "paused" && this.state.status === "pending";
662
660
  }
663
661
  invalidate() {
664
- this.state.isInvalidated || this.#i({ type: "invalidate" });
662
+ this.state.isInvalidated || this.#n({ type: "invalidate" });
665
663
  }
666
664
  async fetch(e, t) {
667
665
  if (this.state.fetchStatus !== "idle" && // If the promise in the retryer is already rejected, we have to definitely
@@ -674,19 +672,19 @@ var Te = class extends ve {
674
672
  return this.#s.continueRetry(), this.#s.promise;
675
673
  }
676
674
  if (e && this.setOptions(e), !this.options.queryFn) {
677
- const n = this.observers.find((h) => h.options.queryFn);
678
- n && this.setOptions(n.options);
675
+ const i = this.observers.find((h) => h.options.queryFn);
676
+ i && this.setOptions(i.options);
679
677
  }
680
678
  process.env.NODE_ENV !== "production" && (Array.isArray(this.options.queryKey) || console.error(
681
679
  "As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"
682
680
  ));
683
- const s = new AbortController(), r = (n) => {
684
- Object.defineProperty(n, "signal", {
681
+ const s = new AbortController(), r = (i) => {
682
+ Object.defineProperty(i, "signal", {
685
683
  enumerable: !0,
686
684
  get: () => (this.#o = !0, s.signal)
687
685
  });
688
- }, i = () => {
689
- const n = K(this.options, t), f = (() => {
686
+ }, n = () => {
687
+ const i = k(this.options, t), f = (() => {
690
688
  const d = {
691
689
  client: this.#a,
692
690
  queryKey: this.queryKey,
@@ -695,40 +693,40 @@ var Te = class extends ve {
695
693
  return r(d), d;
696
694
  })();
697
695
  return this.#o = !1, this.options.persister ? this.options.persister(
698
- n,
696
+ i,
699
697
  f,
700
698
  this
701
- ) : n(f);
699
+ ) : i(f);
702
700
  }, u = (() => {
703
- const n = {
701
+ const i = {
704
702
  fetchOptions: t,
705
703
  options: this.options,
706
704
  queryKey: this.queryKey,
707
705
  client: this.#a,
708
706
  state: this.state,
709
- fetchFn: i
707
+ fetchFn: n
710
708
  };
711
- return r(n), n;
709
+ return r(i), i;
712
710
  })();
713
- (this.#e === "infinite" ? me(
711
+ (this.#e === "infinite" ? de(
714
712
  this.options.pages
715
- ) : this.options.behavior)?.onFetch(u, this), this.#r = this.state, (this.state.fetchStatus === "idle" || this.state.fetchMeta !== u.fetchOptions?.meta) && this.#i({ type: "fetch", meta: u.fetchOptions?.meta }), this.#s = pe({
713
+ ) : this.options.behavior)?.onFetch(u, this), this.#r = this.state, (this.state.fetchStatus === "idle" || this.state.fetchMeta !== u.fetchOptions?.meta) && this.#n({ type: "fetch", meta: u.fetchOptions?.meta }), this.#s = he({
716
714
  initialPromise: t?.initialPromise,
717
715
  fn: u.fetchFn,
718
- onCancel: (n) => {
719
- n instanceof j && n.revert && this.setState({
716
+ onCancel: (i) => {
717
+ i instanceof E && i.revert && this.setState({
720
718
  ...this.#r,
721
719
  fetchStatus: "idle"
722
720
  }), s.abort();
723
721
  },
724
- onFail: (n, h) => {
725
- this.#i({ type: "failed", failureCount: n, error: h });
722
+ onFail: (i, h) => {
723
+ this.#n({ type: "failed", failureCount: i, error: h });
726
724
  },
727
725
  onPause: () => {
728
- this.#i({ type: "pause" });
726
+ this.#n({ type: "pause" });
729
727
  },
730
728
  onContinue: () => {
731
- this.#i({ type: "continue" });
729
+ this.#n({ type: "continue" });
732
730
  },
733
731
  retry: u.options.retry,
734
732
  retryDelay: u.options.retryDelay,
@@ -736,42 +734,42 @@ var Te = class extends ve {
736
734
  canRun: () => !0
737
735
  });
738
736
  try {
739
- const n = await this.#s.start();
740
- if (n === void 0)
737
+ const i = await this.#s.start();
738
+ if (i === void 0)
741
739
  throw process.env.NODE_ENV !== "production" && console.error(
742
740
  `Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`
743
741
  ), new Error(`${this.queryHash} data is undefined`);
744
- return this.setData(n), this.#n.config.onSuccess?.(n, this), this.#n.config.onSettled?.(
745
- n,
742
+ return this.setData(i), this.#i.config.onSuccess?.(i, this), this.#i.config.onSettled?.(
743
+ i,
746
744
  this.state.error,
747
745
  this
748
- ), n;
749
- } catch (n) {
750
- if (n instanceof j) {
751
- if (n.silent)
746
+ ), i;
747
+ } catch (i) {
748
+ if (i instanceof E) {
749
+ if (i.silent)
752
750
  return this.#s.promise;
753
- if (n.revert) {
751
+ if (i.revert) {
754
752
  if (this.state.data === void 0)
755
- throw n;
753
+ throw i;
756
754
  return this.state.data;
757
755
  }
758
756
  }
759
- throw this.#i({
757
+ throw this.#n({
760
758
  type: "error",
761
- error: n
762
- }), this.#n.config.onError?.(
763
- n,
759
+ error: i
760
+ }), this.#i.config.onError?.(
761
+ i,
764
762
  this
765
- ), this.#n.config.onSettled?.(
763
+ ), this.#i.config.onSettled?.(
766
764
  this.state.data,
767
- n,
765
+ i,
768
766
  this
769
- ), n;
767
+ ), i;
770
768
  } finally {
771
769
  this.scheduleGc();
772
770
  }
773
771
  }
774
- #i(e) {
772
+ #n(e) {
775
773
  const t = (s) => {
776
774
  switch (e.type) {
777
775
  case "failed":
@@ -793,7 +791,7 @@ var Te = class extends ve {
793
791
  case "fetch":
794
792
  return {
795
793
  ...s,
796
- ...ge(s.data, this.options),
794
+ ...ye(s.data, this.options),
797
795
  fetchMeta: e.meta ?? null
798
796
  };
799
797
  case "success":
@@ -809,14 +807,14 @@ var Te = class extends ve {
809
807
  };
810
808
  return this.#r = e.manual ? r : void 0, r;
811
809
  case "error":
812
- const i = e.error;
810
+ const n = e.error;
813
811
  return {
814
812
  ...s,
815
- error: i,
813
+ error: n,
816
814
  errorUpdateCount: s.errorUpdateCount + 1,
817
815
  errorUpdatedAt: Date.now(),
818
816
  fetchFailureCount: s.fetchFailureCount + 1,
819
- fetchFailureReason: i,
817
+ fetchFailureReason: n,
820
818
  fetchStatus: "idle",
821
819
  status: "error",
822
820
  // flag existing data as invalidated if we get a background error
@@ -835,18 +833,18 @@ var Te = class extends ve {
835
833
  };
836
834
  }
837
835
  };
838
- this.state = t(this.state), fe.batch(() => {
836
+ this.state = t(this.state), ue.batch(() => {
839
837
  this.observers.forEach((s) => {
840
838
  s.onQueryUpdate();
841
- }), this.#n.notify({ query: this, type: "updated", action: e });
839
+ }), this.#i.notify({ query: this, type: "updated", action: e });
842
840
  });
843
841
  }
844
842
  };
845
- function ge(e, t) {
843
+ function ye(e, t) {
846
844
  return {
847
845
  fetchFailureCount: 0,
848
846
  fetchFailureReason: null,
849
- fetchStatus: x(t.networkMode) ? "fetching" : "paused",
847
+ fetchStatus: Q(t.networkMode) ? "fetching" : "paused",
850
848
  ...e === void 0 && {
851
849
  error: null,
852
850
  status: "pending"
@@ -862,7 +860,7 @@ function U(e, t) {
862
860
  status: "success"
863
861
  };
864
862
  }
865
- function M(e) {
863
+ function N(e) {
866
864
  const t = typeof e.initialData == "function" ? e.initialData() : e.initialData, s = t !== void 0, r = s ? typeof e.initialDataUpdatedAt == "function" ? e.initialDataUpdatedAt() : e.initialDataUpdatedAt : 0;
867
865
  return {
868
866
  data: t,
@@ -879,53 +877,34 @@ function M(e) {
879
877
  fetchStatus: "idle"
880
878
  };
881
879
  }
882
- var G = S.createContext(
883
- void 0
884
- ), je = (e) => {
885
- const t = S.useContext(G);
886
- if (e)
887
- return e;
888
- if (!t)
889
- throw new Error("No QueryClient set, use QueryClientProvider to set one");
890
- return t;
891
- }, De = ({
892
- client: e,
893
- children: t
894
- }) => (S.useEffect(() => (e.mount(), () => {
895
- e.unmount();
896
- }), [e]), /* @__PURE__ */ H(G.Provider, { value: e, children: t })), V = S.createContext(!1), Ie = () => S.useContext(V), Ae = V.Provider;
897
880
  export {
898
- I as A,
899
- T as B,
900
- De as C,
901
- Ae as I,
902
- Te as Q,
903
- ve as R,
904
- k as S,
905
- qe as a,
881
+ Pe as Q,
882
+ fe as R,
883
+ M as S,
884
+ Fe as a,
906
885
  O as b,
907
- P as c,
908
- Ce as d,
909
- ee as e,
910
- Q as f,
911
- C as g,
912
- Ee as h,
913
- X as i,
914
- B as j,
915
- ge as k,
916
- ie as l,
917
- Ie as m,
918
- fe as n,
919
- Oe as o,
920
- ce as p,
921
- pe as q,
922
- te as r,
923
- Pe as s,
924
- Y as t,
925
- je as u,
926
- we as v,
927
- se as w,
928
- Fe as x,
929
- L as y,
886
+ w as c,
887
+ be as d,
888
+ he as e,
889
+ X as f,
890
+ ve as g,
891
+ we as h,
892
+ V as i,
893
+ pe as j,
894
+ T as k,
895
+ ne as l,
896
+ me as m,
897
+ ue as n,
898
+ L as o,
899
+ D as p,
900
+ Z as q,
901
+ W as r,
902
+ ge as s,
903
+ K as t,
904
+ B as u,
905
+ J as v,
906
+ P as w,
907
+ ye as x,
908
+ te as y,
930
909
  Se as z
931
910
  };