@scrippsproduct/networks-ui-library 1.1.0-alpha.9 → 1.1.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/assets/DateNavigation.css +1 -1
- package/dist/assets/ScheduleLayout.css +1 -1
- package/dist/assets/ScheduleList.css +1 -1
- package/dist/components/ChannelSearch/ChannelSearch.js +53 -55
- package/dist/components/DateNavigation/DateNavigation.js +43 -43
- package/dist/components/ScheduleLayout/ScheduleContext.js +400 -395
- package/dist/components/ScheduleLayout/ScheduleLayout.js +35 -35
- package/dist/components/ScheduleList/ScheduleList.js +73 -73
- package/dist/components/ScheduleList/schedule-list-items/SeriesItem.js +26 -26
- package/dist/hooks/getSchedule.d.ts +2 -2
- package/dist/hooks/getSchedule.js +1 -1
- package/dist/hooks/useGetSchedule.d.ts +22 -0
- package/dist/hooks/useGetSchedule.js +62 -0
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var
|
|
1
|
+
var pe = (e) => {
|
|
2
2
|
throw TypeError(e);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var r = (e, t, s) => (
|
|
6
|
-
var
|
|
4
|
+
var Jt = (e, t, s) => t.has(e) || pe("Cannot " + s);
|
|
5
|
+
var r = (e, t, s) => (Jt(e, t, "read from private field"), s ? s.call(e) : t.get(e)), c = (e, t, s) => t.has(e) ? pe("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, s), o = (e, t, s, i) => (Jt(e, t, "write to private field"), i ? i.call(e, s) : t.set(e, s), s), v = (e, t, s) => (Jt(e, t, "access private method"), s);
|
|
6
|
+
var Gt = (e, t, s, i) => ({
|
|
7
7
|
set _(n) {
|
|
8
8
|
o(e, t, n, s);
|
|
9
9
|
},
|
|
@@ -11,11 +11,11 @@ var Ht = (e, t, s, i) => ({
|
|
|
11
11
|
return r(e, t, i);
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
|
-
import { jsx as
|
|
15
|
-
import * as
|
|
16
|
-
import { createContext as
|
|
17
|
-
import { f as
|
|
18
|
-
import { l as
|
|
14
|
+
import { jsx as zt } from "react/jsx-runtime";
|
|
15
|
+
import * as L from "react";
|
|
16
|
+
import { createContext as $e, useState as me, useRef as We, useCallback as Je, useEffect as ve, useMemo as Ze } from "react";
|
|
17
|
+
import { f as Bt } from "../../format-YhWt2D8M.mjs";
|
|
18
|
+
import { l as Y } from "../../logger-C0N7U0YY.mjs";
|
|
19
19
|
var Kt = class {
|
|
20
20
|
constructor() {
|
|
21
21
|
this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
|
|
@@ -47,7 +47,7 @@ var Kt = class {
|
|
|
47
47
|
clearTimeout: (e) => clearTimeout(e),
|
|
48
48
|
setInterval: (e, t) => setInterval(e, t),
|
|
49
49
|
clearInterval: (e) => clearInterval(e)
|
|
50
|
-
}, G,
|
|
50
|
+
}, G, ct, Qe, Ye = (Qe = class {
|
|
51
51
|
constructor() {
|
|
52
52
|
// We cannot have TimeoutManager<T> as we must instantiate it with a concrete
|
|
53
53
|
// type at app boot; and if we leave that type, then any new timer provider
|
|
@@ -56,49 +56,49 @@ var Kt = class {
|
|
|
56
56
|
// We settle for type safety for the TimeoutProvider type, and accept that
|
|
57
57
|
// this class is unsafe internally to allow for extension.
|
|
58
58
|
c(this, G, Xe);
|
|
59
|
-
c(this,
|
|
59
|
+
c(this, ct, !1);
|
|
60
60
|
}
|
|
61
61
|
setTimeoutProvider(e) {
|
|
62
|
-
process.env.NODE_ENV !== "production" && r(this,
|
|
62
|
+
process.env.NODE_ENV !== "production" && r(this, ct) && e !== r(this, G) && console.error(
|
|
63
63
|
"[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",
|
|
64
64
|
{ previous: r(this, G), provider: e }
|
|
65
|
-
), o(this, G, e), process.env.NODE_ENV !== "production" && o(this,
|
|
65
|
+
), o(this, G, e), process.env.NODE_ENV !== "production" && o(this, ct, !1);
|
|
66
66
|
}
|
|
67
67
|
setTimeout(e, t) {
|
|
68
|
-
return process.env.NODE_ENV !== "production" && o(this,
|
|
68
|
+
return process.env.NODE_ENV !== "production" && o(this, ct, !0), r(this, G).setTimeout(e, t);
|
|
69
69
|
}
|
|
70
70
|
clearTimeout(e) {
|
|
71
71
|
r(this, G).clearTimeout(e);
|
|
72
72
|
}
|
|
73
73
|
setInterval(e, t) {
|
|
74
|
-
return process.env.NODE_ENV !== "production" && o(this,
|
|
74
|
+
return process.env.NODE_ENV !== "production" && o(this, ct, !0), r(this, G).setInterval(e, t);
|
|
75
75
|
}
|
|
76
76
|
clearInterval(e) {
|
|
77
77
|
r(this, G).clearInterval(e);
|
|
78
78
|
}
|
|
79
|
-
}, G = new WeakMap(),
|
|
79
|
+
}, G = new WeakMap(), ct = new WeakMap(), Qe), ht = new Ye();
|
|
80
80
|
function ts(e) {
|
|
81
81
|
setTimeout(e, 0);
|
|
82
82
|
}
|
|
83
|
-
var
|
|
83
|
+
var wt = typeof window > "u" || "Deno" in globalThis;
|
|
84
84
|
function j() {
|
|
85
85
|
}
|
|
86
86
|
function es(e, t) {
|
|
87
87
|
return typeof e == "function" ? e(t) : e;
|
|
88
88
|
}
|
|
89
|
-
function
|
|
89
|
+
function Zt(e) {
|
|
90
90
|
return typeof e == "number" && e >= 0 && e !== 1 / 0;
|
|
91
91
|
}
|
|
92
|
-
function
|
|
92
|
+
function _e(e, t) {
|
|
93
93
|
return Math.max(e + (t || 0) - Date.now(), 0);
|
|
94
94
|
}
|
|
95
|
-
function
|
|
95
|
+
function ut(e, t) {
|
|
96
96
|
return typeof e == "function" ? e(t) : e;
|
|
97
97
|
}
|
|
98
98
|
function k(e, t) {
|
|
99
99
|
return typeof e == "function" ? e(t) : e;
|
|
100
100
|
}
|
|
101
|
-
function
|
|
101
|
+
function ge(e, t) {
|
|
102
102
|
const {
|
|
103
103
|
type: s = "all",
|
|
104
104
|
exact: i,
|
|
@@ -109,9 +109,9 @@ function ve(e, t) {
|
|
|
109
109
|
} = e;
|
|
110
110
|
if (h) {
|
|
111
111
|
if (i) {
|
|
112
|
-
if (t.queryHash !==
|
|
112
|
+
if (t.queryHash !== de(h, t.options))
|
|
113
113
|
return !1;
|
|
114
|
-
} else if (!
|
|
114
|
+
} else if (!Ut(t.queryKey, h))
|
|
115
115
|
return !1;
|
|
116
116
|
}
|
|
117
117
|
if (s !== "all") {
|
|
@@ -121,55 +121,55 @@ function ve(e, t) {
|
|
|
121
121
|
}
|
|
122
122
|
return !(typeof u == "boolean" && t.isStale() !== u || n && n !== t.state.fetchStatus || a && !a(t));
|
|
123
123
|
}
|
|
124
|
-
function
|
|
124
|
+
function be(e, t) {
|
|
125
125
|
const { exact: s, status: i, predicate: n, mutationKey: a } = e;
|
|
126
126
|
if (a) {
|
|
127
127
|
if (!t.options.mutationKey)
|
|
128
128
|
return !1;
|
|
129
129
|
if (s) {
|
|
130
|
-
if (
|
|
130
|
+
if (xt(t.options.mutationKey) !== xt(a))
|
|
131
131
|
return !1;
|
|
132
|
-
} else if (!
|
|
132
|
+
} else if (!Ut(t.options.mutationKey, a))
|
|
133
133
|
return !1;
|
|
134
134
|
}
|
|
135
135
|
return !(i && t.state.status !== i || n && !n(t));
|
|
136
136
|
}
|
|
137
|
-
function
|
|
138
|
-
return ((t == null ? void 0 : t.queryKeyHashFn) ||
|
|
137
|
+
function de(e, t) {
|
|
138
|
+
return ((t == null ? void 0 : t.queryKeyHashFn) || xt)(e);
|
|
139
139
|
}
|
|
140
|
-
function
|
|
140
|
+
function xt(e) {
|
|
141
141
|
return JSON.stringify(
|
|
142
142
|
e,
|
|
143
|
-
(t, s) =>
|
|
143
|
+
(t, s) => te(s) ? Object.keys(s).sort().reduce((i, n) => (i[n] = s[n], i), {}) : s
|
|
144
144
|
);
|
|
145
145
|
}
|
|
146
|
-
function
|
|
147
|
-
return e === t ? !0 : typeof e != typeof t ? !1 : e && t && typeof e == "object" && typeof t == "object" ? Object.keys(t).every((s) =>
|
|
146
|
+
function Ut(e, t) {
|
|
147
|
+
return e === t ? !0 : typeof e != typeof t ? !1 : e && t && typeof e == "object" && typeof t == "object" ? Object.keys(t).every((s) => Ut(e[s], t[s])) : !1;
|
|
148
148
|
}
|
|
149
149
|
var ss = Object.prototype.hasOwnProperty;
|
|
150
|
-
function
|
|
150
|
+
function Xt(e, t) {
|
|
151
151
|
if (e === t)
|
|
152
152
|
return e;
|
|
153
|
-
const s =
|
|
154
|
-
if (!s && !(
|
|
153
|
+
const s = we(e) && we(t);
|
|
154
|
+
if (!s && !(te(e) && te(t))) return t;
|
|
155
155
|
const n = (s ? e : Object.keys(e)).length, a = s ? t : Object.keys(t), h = a.length, u = s ? new Array(h) : {};
|
|
156
156
|
let d = 0;
|
|
157
157
|
for (let b = 0; b < h; b++) {
|
|
158
|
-
const
|
|
159
|
-
if (f ===
|
|
160
|
-
u[
|
|
158
|
+
const E = s ? b : a[b], f = e[E], C = t[E];
|
|
159
|
+
if (f === C) {
|
|
160
|
+
u[E] = f, (s ? b < n : ss.call(e, E)) && d++;
|
|
161
161
|
continue;
|
|
162
162
|
}
|
|
163
|
-
if (f === null ||
|
|
164
|
-
u[
|
|
163
|
+
if (f === null || C === null || typeof f != "object" || typeof C != "object") {
|
|
164
|
+
u[E] = C;
|
|
165
165
|
continue;
|
|
166
166
|
}
|
|
167
|
-
const y =
|
|
168
|
-
u[
|
|
167
|
+
const y = Xt(f, C);
|
|
168
|
+
u[E] = y, y === f && d++;
|
|
169
169
|
}
|
|
170
170
|
return n === h && d === n ? e : u;
|
|
171
171
|
}
|
|
172
|
-
function
|
|
172
|
+
function Yt(e, t) {
|
|
173
173
|
if (!t || Object.keys(e).length !== Object.keys(t).length)
|
|
174
174
|
return !1;
|
|
175
175
|
for (const s in e)
|
|
@@ -177,39 +177,39 @@ function Xt(e, t) {
|
|
|
177
177
|
return !1;
|
|
178
178
|
return !0;
|
|
179
179
|
}
|
|
180
|
-
function
|
|
180
|
+
function we(e) {
|
|
181
181
|
return Array.isArray(e) && e.length === Object.keys(e).length;
|
|
182
182
|
}
|
|
183
|
-
function
|
|
184
|
-
if (!
|
|
183
|
+
function te(e) {
|
|
184
|
+
if (!Se(e))
|
|
185
185
|
return !1;
|
|
186
186
|
const t = e.constructor;
|
|
187
187
|
if (t === void 0)
|
|
188
188
|
return !0;
|
|
189
189
|
const s = t.prototype;
|
|
190
|
-
return !(!
|
|
190
|
+
return !(!Se(s) || !s.hasOwnProperty("isPrototypeOf") || Object.getPrototypeOf(e) !== Object.prototype);
|
|
191
191
|
}
|
|
192
|
-
function
|
|
192
|
+
function Se(e) {
|
|
193
193
|
return Object.prototype.toString.call(e) === "[object Object]";
|
|
194
194
|
}
|
|
195
195
|
function rs(e) {
|
|
196
196
|
return new Promise((t) => {
|
|
197
|
-
|
|
197
|
+
ht.setTimeout(t, e);
|
|
198
198
|
});
|
|
199
199
|
}
|
|
200
|
-
function
|
|
200
|
+
function ee(e, t, s) {
|
|
201
201
|
if (typeof s.structuralSharing == "function")
|
|
202
202
|
return s.structuralSharing(e, t);
|
|
203
203
|
if (s.structuralSharing !== !1) {
|
|
204
204
|
if (process.env.NODE_ENV !== "production")
|
|
205
205
|
try {
|
|
206
|
-
return
|
|
206
|
+
return Xt(e, t);
|
|
207
207
|
} catch (i) {
|
|
208
208
|
throw console.error(
|
|
209
209
|
`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${s.queryHash}]: ${i}`
|
|
210
210
|
), i;
|
|
211
211
|
}
|
|
212
|
-
return
|
|
212
|
+
return Xt(e, t);
|
|
213
213
|
}
|
|
214
214
|
return t;
|
|
215
215
|
}
|
|
@@ -221,23 +221,23 @@ function ns(e, t, s = 0) {
|
|
|
221
221
|
const i = [t, ...e];
|
|
222
222
|
return s && i.length > s ? i.slice(0, -1) : i;
|
|
223
223
|
}
|
|
224
|
-
var
|
|
225
|
-
function
|
|
226
|
-
return process.env.NODE_ENV !== "production" && e.queryFn ===
|
|
224
|
+
var $t = Symbol();
|
|
225
|
+
function ke(e, t) {
|
|
226
|
+
return process.env.NODE_ENV !== "production" && e.queryFn === $t && console.error(
|
|
227
227
|
`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`
|
|
228
|
-
), !e.queryFn && (t != null && t.initialPromise) ? () => t.initialPromise : !e.queryFn || e.queryFn ===
|
|
228
|
+
), !e.queryFn && (t != null && t.initialPromise) ? () => t.initialPromise : !e.queryFn || e.queryFn === $t ? () => Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)) : e.queryFn;
|
|
229
229
|
}
|
|
230
230
|
function as(e, t) {
|
|
231
231
|
return typeof e == "function" ? e(...t) : !!e;
|
|
232
232
|
}
|
|
233
|
-
var
|
|
233
|
+
var lt, et, Ct, De, os = (De = class extends Kt {
|
|
234
234
|
constructor() {
|
|
235
235
|
super();
|
|
236
|
-
c(this,
|
|
237
|
-
c(this,
|
|
236
|
+
c(this, lt);
|
|
237
|
+
c(this, et);
|
|
238
238
|
c(this, Ct);
|
|
239
239
|
o(this, Ct, (t) => {
|
|
240
|
-
if (!
|
|
240
|
+
if (!wt && window.addEventListener) {
|
|
241
241
|
const s = () => t();
|
|
242
242
|
return window.addEventListener("visibilitychange", s, !1), () => {
|
|
243
243
|
window.removeEventListener("visibilitychange", s);
|
|
@@ -246,20 +246,20 @@ var ct, tt, Ct, Qe, os = (Qe = class extends Kt {
|
|
|
246
246
|
});
|
|
247
247
|
}
|
|
248
248
|
onSubscribe() {
|
|
249
|
-
r(this,
|
|
249
|
+
r(this, et) || this.setEventListener(r(this, Ct));
|
|
250
250
|
}
|
|
251
251
|
onUnsubscribe() {
|
|
252
252
|
var t;
|
|
253
|
-
this.hasListeners() || ((t = r(this,
|
|
253
|
+
this.hasListeners() || ((t = r(this, et)) == null || t.call(this), o(this, et, void 0));
|
|
254
254
|
}
|
|
255
255
|
setEventListener(t) {
|
|
256
256
|
var s;
|
|
257
|
-
o(this, Ct, t), (s = r(this,
|
|
257
|
+
o(this, Ct, t), (s = r(this, et)) == null || s.call(this), o(this, et, t((i) => {
|
|
258
258
|
typeof i == "boolean" ? this.setFocused(i) : this.onFocus();
|
|
259
259
|
}));
|
|
260
260
|
}
|
|
261
261
|
setFocused(t) {
|
|
262
|
-
r(this,
|
|
262
|
+
r(this, lt) !== t && (o(this, lt, t), this.onFocus());
|
|
263
263
|
}
|
|
264
264
|
onFocus() {
|
|
265
265
|
const t = this.isFocused();
|
|
@@ -269,10 +269,10 @@ var ct, tt, Ct, Qe, os = (Qe = class extends Kt {
|
|
|
269
269
|
}
|
|
270
270
|
isFocused() {
|
|
271
271
|
var t;
|
|
272
|
-
return typeof r(this,
|
|
272
|
+
return typeof r(this, lt) == "boolean" ? r(this, lt) : ((t = globalThis.document) == null ? void 0 : t.visibilityState) !== "hidden";
|
|
273
273
|
}
|
|
274
|
-
},
|
|
275
|
-
function
|
|
274
|
+
}, lt = new WeakMap(), et = new WeakMap(), Ct = new WeakMap(), De), fe = new os();
|
|
275
|
+
function se() {
|
|
276
276
|
let e, t;
|
|
277
277
|
const s = new Promise((n, a) => {
|
|
278
278
|
e = n, t = a;
|
|
@@ -354,14 +354,14 @@ function hs() {
|
|
|
354
354
|
}
|
|
355
355
|
};
|
|
356
356
|
}
|
|
357
|
-
var T = hs(),
|
|
357
|
+
var T = hs(), Ot, st, Et, Te, cs = (Te = class extends Kt {
|
|
358
358
|
constructor() {
|
|
359
359
|
super();
|
|
360
|
-
c(this,
|
|
361
|
-
c(this,
|
|
362
|
-
c(this,
|
|
363
|
-
o(this,
|
|
364
|
-
if (!
|
|
360
|
+
c(this, Ot, !0);
|
|
361
|
+
c(this, st);
|
|
362
|
+
c(this, Et);
|
|
363
|
+
o(this, Et, (t) => {
|
|
364
|
+
if (!wt && window.addEventListener) {
|
|
365
365
|
const s = () => t(!0), i = () => t(!1);
|
|
366
366
|
return window.addEventListener("online", s, !1), window.addEventListener("offline", i, !1), () => {
|
|
367
367
|
window.removeEventListener("online", s), window.removeEventListener("offline", i);
|
|
@@ -370,81 +370,81 @@ var T = hs(), St, et, Ot, De, cs = (De = class extends Kt {
|
|
|
370
370
|
});
|
|
371
371
|
}
|
|
372
372
|
onSubscribe() {
|
|
373
|
-
r(this,
|
|
373
|
+
r(this, st) || this.setEventListener(r(this, Et));
|
|
374
374
|
}
|
|
375
375
|
onUnsubscribe() {
|
|
376
376
|
var t;
|
|
377
|
-
this.hasListeners() || ((t = r(this,
|
|
377
|
+
this.hasListeners() || ((t = r(this, st)) == null || t.call(this), o(this, st, void 0));
|
|
378
378
|
}
|
|
379
379
|
setEventListener(t) {
|
|
380
380
|
var s;
|
|
381
|
-
o(this,
|
|
381
|
+
o(this, Et, t), (s = r(this, st)) == null || s.call(this), o(this, st, t(this.setOnline.bind(this)));
|
|
382
382
|
}
|
|
383
383
|
setOnline(t) {
|
|
384
|
-
r(this,
|
|
384
|
+
r(this, Ot) !== t && (o(this, Ot, t), this.listeners.forEach((i) => {
|
|
385
385
|
i(t);
|
|
386
386
|
}));
|
|
387
387
|
}
|
|
388
388
|
isOnline() {
|
|
389
|
-
return r(this,
|
|
389
|
+
return r(this, Ot);
|
|
390
390
|
}
|
|
391
|
-
},
|
|
391
|
+
}, Ot = new WeakMap(), st = new WeakMap(), Et = new WeakMap(), Te), Wt = new cs();
|
|
392
392
|
function ls(e) {
|
|
393
393
|
return Math.min(1e3 * 2 ** e, 3e4);
|
|
394
394
|
}
|
|
395
|
-
function
|
|
396
|
-
return (e ?? "online") === "online" ?
|
|
395
|
+
function Le(e) {
|
|
396
|
+
return (e ?? "online") === "online" ? Wt.isOnline() : !0;
|
|
397
397
|
}
|
|
398
|
-
var
|
|
398
|
+
var re = class extends Error {
|
|
399
399
|
constructor(e) {
|
|
400
400
|
super("CancelledError"), this.revert = e == null ? void 0 : e.revert, this.silent = e == null ? void 0 : e.silent;
|
|
401
401
|
}
|
|
402
402
|
};
|
|
403
403
|
function Ke(e) {
|
|
404
404
|
let t = !1, s = 0, i;
|
|
405
|
-
const n =
|
|
406
|
-
var
|
|
405
|
+
const n = se(), a = () => n.status !== "pending", h = (m) => {
|
|
406
|
+
var p;
|
|
407
407
|
if (!a()) {
|
|
408
|
-
const
|
|
409
|
-
O
|
|
408
|
+
const O = new re(m);
|
|
409
|
+
C(O), (p = e.onCancel) == null || p.call(e, O);
|
|
410
410
|
}
|
|
411
411
|
}, u = () => {
|
|
412
412
|
t = !0;
|
|
413
413
|
}, d = () => {
|
|
414
414
|
t = !1;
|
|
415
|
-
}, b = () =>
|
|
416
|
-
a() || (i == null || i(), n.resolve(
|
|
417
|
-
},
|
|
418
|
-
a() || (i == null || i(), n.reject(
|
|
419
|
-
}, y = () => new Promise((
|
|
420
|
-
var m;
|
|
421
|
-
i = (P) => {
|
|
422
|
-
(a() || b()) && p(P);
|
|
423
|
-
}, (m = e.onPause) == null || m.call(e);
|
|
424
|
-
}).then(() => {
|
|
415
|
+
}, b = () => fe.isFocused() && (e.networkMode === "always" || Wt.isOnline()) && e.canRun(), E = () => Le(e.networkMode) && e.canRun(), f = (m) => {
|
|
416
|
+
a() || (i == null || i(), n.resolve(m));
|
|
417
|
+
}, C = (m) => {
|
|
418
|
+
a() || (i == null || i(), n.reject(m));
|
|
419
|
+
}, y = () => new Promise((m) => {
|
|
425
420
|
var p;
|
|
426
|
-
i =
|
|
421
|
+
i = (O) => {
|
|
422
|
+
(a() || b()) && m(O);
|
|
423
|
+
}, (p = e.onPause) == null || p.call(e);
|
|
424
|
+
}).then(() => {
|
|
425
|
+
var m;
|
|
426
|
+
i = void 0, a() || (m = e.onContinue) == null || m.call(e);
|
|
427
427
|
}), R = () => {
|
|
428
428
|
if (a())
|
|
429
429
|
return;
|
|
430
|
-
let
|
|
431
|
-
const
|
|
430
|
+
let m;
|
|
431
|
+
const p = s === 0 ? e.initialPromise : void 0;
|
|
432
432
|
try {
|
|
433
|
-
|
|
434
|
-
} catch (
|
|
435
|
-
|
|
433
|
+
m = p ?? e.fn();
|
|
434
|
+
} catch (O) {
|
|
435
|
+
m = Promise.reject(O);
|
|
436
436
|
}
|
|
437
|
-
Promise.resolve(
|
|
437
|
+
Promise.resolve(m).then(f).catch((O) => {
|
|
438
438
|
var x;
|
|
439
439
|
if (a())
|
|
440
440
|
return;
|
|
441
|
-
const M = e.retry ?? (
|
|
441
|
+
const M = e.retry ?? (wt ? 0 : 3), P = e.retryDelay ?? ls, l = typeof P == "function" ? P(s, O) : P, Q = M === !0 || typeof M == "number" && s < M || typeof M == "function" && M(s, O);
|
|
442
442
|
if (t || !Q) {
|
|
443
|
-
O
|
|
443
|
+
C(O);
|
|
444
444
|
return;
|
|
445
445
|
}
|
|
446
|
-
s++, (x = e.onFail) == null || x.call(e, s,
|
|
447
|
-
t ? O
|
|
446
|
+
s++, (x = e.onFail) == null || x.call(e, s, O), rs(l).then(() => b() ? void 0 : y()).then(() => {
|
|
447
|
+
t ? C(O) : R();
|
|
448
448
|
});
|
|
449
449
|
});
|
|
450
450
|
};
|
|
@@ -455,43 +455,43 @@ function Ke(e) {
|
|
|
455
455
|
continue: () => (i == null || i(), n),
|
|
456
456
|
cancelRetry: u,
|
|
457
457
|
continueRetry: d,
|
|
458
|
-
canStart:
|
|
459
|
-
start: () => (
|
|
458
|
+
canStart: E,
|
|
459
|
+
start: () => (E() ? R() : y().then(R), n)
|
|
460
460
|
};
|
|
461
461
|
}
|
|
462
|
-
var
|
|
462
|
+
var dt, Ie, He = (Ie = class {
|
|
463
463
|
constructor() {
|
|
464
|
-
c(this,
|
|
464
|
+
c(this, dt);
|
|
465
465
|
}
|
|
466
466
|
destroy() {
|
|
467
467
|
this.clearGcTimeout();
|
|
468
468
|
}
|
|
469
469
|
scheduleGc() {
|
|
470
|
-
this.clearGcTimeout(),
|
|
470
|
+
this.clearGcTimeout(), Zt(this.gcTime) && o(this, dt, ht.setTimeout(() => {
|
|
471
471
|
this.optionalRemove();
|
|
472
472
|
}, this.gcTime));
|
|
473
473
|
}
|
|
474
474
|
updateGcTime(e) {
|
|
475
475
|
this.gcTime = Math.max(
|
|
476
476
|
this.gcTime || 0,
|
|
477
|
-
e ?? (
|
|
477
|
+
e ?? (wt ? 1 / 0 : 300 * 1e3)
|
|
478
478
|
);
|
|
479
479
|
}
|
|
480
480
|
clearGcTimeout() {
|
|
481
|
-
r(this,
|
|
481
|
+
r(this, dt) && (ht.clearTimeout(r(this, dt)), o(this, dt, void 0));
|
|
482
482
|
}
|
|
483
|
-
},
|
|
483
|
+
}, dt = new WeakMap(), Ie), ft, Pt, _, yt, D, jt, pt, K, $, qe, ds = (qe = class extends He {
|
|
484
484
|
constructor(t) {
|
|
485
485
|
super();
|
|
486
|
-
c(this,
|
|
487
|
-
c(this,
|
|
486
|
+
c(this, K);
|
|
487
|
+
c(this, ft);
|
|
488
488
|
c(this, Pt);
|
|
489
489
|
c(this, _);
|
|
490
|
-
c(this, ft);
|
|
491
|
-
c(this, D);
|
|
492
|
-
c(this, Ut);
|
|
493
490
|
c(this, yt);
|
|
494
|
-
|
|
491
|
+
c(this, D);
|
|
492
|
+
c(this, jt);
|
|
493
|
+
c(this, pt);
|
|
494
|
+
o(this, pt, !1), o(this, jt, t.defaultOptions), this.setOptions(t.options), this.observers = [], o(this, yt, t.client), o(this, _, r(this, yt).getQueryCache()), this.queryKey = t.queryKey, this.queryHash = t.queryHash, o(this, ft, Oe(this.options)), this.state = t.state ?? r(this, ft), this.scheduleGc();
|
|
495
495
|
}
|
|
496
496
|
get meta() {
|
|
497
497
|
return this.options.meta;
|
|
@@ -501,19 +501,19 @@ var lt, Te, Le = (Te = class {
|
|
|
501
501
|
return (t = r(this, D)) == null ? void 0 : t.promise;
|
|
502
502
|
}
|
|
503
503
|
setOptions(t) {
|
|
504
|
-
if (this.options = { ...r(this,
|
|
505
|
-
const s =
|
|
504
|
+
if (this.options = { ...r(this, jt), ...t }, this.updateGcTime(this.options.gcTime), this.state && this.state.data === void 0) {
|
|
505
|
+
const s = Oe(this.options);
|
|
506
506
|
s.data !== void 0 && (this.setState(
|
|
507
507
|
Ce(s.data, s.dataUpdatedAt)
|
|
508
|
-
), o(this,
|
|
508
|
+
), o(this, ft, s));
|
|
509
509
|
}
|
|
510
510
|
}
|
|
511
511
|
optionalRemove() {
|
|
512
512
|
!this.observers.length && this.state.fetchStatus === "idle" && r(this, _).remove(this);
|
|
513
513
|
}
|
|
514
514
|
setData(t, s) {
|
|
515
|
-
const i =
|
|
516
|
-
return v(this,
|
|
515
|
+
const i = ee(this.state.data, t, this.options);
|
|
516
|
+
return v(this, K, $).call(this, {
|
|
517
517
|
data: i,
|
|
518
518
|
type: "success",
|
|
519
519
|
dataUpdatedAt: s == null ? void 0 : s.updatedAt,
|
|
@@ -521,7 +521,7 @@ var lt, Te, Le = (Te = class {
|
|
|
521
521
|
}), i;
|
|
522
522
|
}
|
|
523
523
|
setState(t, s) {
|
|
524
|
-
v(this,
|
|
524
|
+
v(this, K, $).call(this, { type: "setState", state: t, setStateOptions: s });
|
|
525
525
|
}
|
|
526
526
|
cancel(t) {
|
|
527
527
|
var i, n;
|
|
@@ -532,7 +532,7 @@ var lt, Te, Le = (Te = class {
|
|
|
532
532
|
super.destroy(), this.cancel({ silent: !0 });
|
|
533
533
|
}
|
|
534
534
|
reset() {
|
|
535
|
-
this.destroy(), this.setState(r(this,
|
|
535
|
+
this.destroy(), this.setState(r(this, ft));
|
|
536
536
|
}
|
|
537
537
|
isActive() {
|
|
538
538
|
return this.observers.some(
|
|
@@ -540,11 +540,11 @@ var lt, Te, Le = (Te = class {
|
|
|
540
540
|
);
|
|
541
541
|
}
|
|
542
542
|
isDisabled() {
|
|
543
|
-
return this.getObserversCount() > 0 ? !this.isActive() : this.options.queryFn ===
|
|
543
|
+
return this.getObserversCount() > 0 ? !this.isActive() : this.options.queryFn === $t || this.state.dataUpdateCount + this.state.errorUpdateCount === 0;
|
|
544
544
|
}
|
|
545
545
|
isStatic() {
|
|
546
546
|
return this.getObserversCount() > 0 ? this.observers.some(
|
|
547
|
-
(t) =>
|
|
547
|
+
(t) => ut(t.options.staleTime, this) === "static"
|
|
548
548
|
) : !1;
|
|
549
549
|
}
|
|
550
550
|
isStale() {
|
|
@@ -553,7 +553,7 @@ var lt, Te, Le = (Te = class {
|
|
|
553
553
|
) : this.state.data === void 0 || this.state.isInvalidated;
|
|
554
554
|
}
|
|
555
555
|
isStaleByTime(t = 0) {
|
|
556
|
-
return this.state.data === void 0 ? !0 : t === "static" ? !1 : this.state.isInvalidated ? !0 : !
|
|
556
|
+
return this.state.data === void 0 ? !0 : t === "static" ? !1 : this.state.isInvalidated ? !0 : !_e(this.state.dataUpdatedAt, t);
|
|
557
557
|
}
|
|
558
558
|
onFocus() {
|
|
559
559
|
var s;
|
|
@@ -569,16 +569,16 @@ var lt, Te, Le = (Te = class {
|
|
|
569
569
|
this.observers.includes(t) || (this.observers.push(t), this.clearGcTimeout(), r(this, _).notify({ type: "observerAdded", query: this, observer: t }));
|
|
570
570
|
}
|
|
571
571
|
removeObserver(t) {
|
|
572
|
-
this.observers.includes(t) && (this.observers = this.observers.filter((s) => s !== t), this.observers.length || (r(this, D) && (r(this,
|
|
572
|
+
this.observers.includes(t) && (this.observers = this.observers.filter((s) => s !== t), this.observers.length || (r(this, D) && (r(this, pt) ? r(this, D).cancel({ revert: !0 }) : r(this, D).cancelRetry()), this.scheduleGc()), r(this, _).notify({ type: "observerRemoved", query: this, observer: t }));
|
|
573
573
|
}
|
|
574
574
|
getObserversCount() {
|
|
575
575
|
return this.observers.length;
|
|
576
576
|
}
|
|
577
577
|
invalidate() {
|
|
578
|
-
this.state.isInvalidated || v(this,
|
|
578
|
+
this.state.isInvalidated || v(this, K, $).call(this, { type: "invalidate" });
|
|
579
579
|
}
|
|
580
580
|
async fetch(t, s) {
|
|
581
|
-
var d, b,
|
|
581
|
+
var d, b, E, f, C, y, R, m, p, O, M, P;
|
|
582
582
|
if (this.state.fetchStatus !== "idle" && // If the promise in the retyer is already rejected, we have to definitely
|
|
583
583
|
// re-start the fetch; there is a chance that the query is still in a
|
|
584
584
|
// pending state when that happens
|
|
@@ -598,18 +598,18 @@ var lt, Te, Le = (Te = class {
|
|
|
598
598
|
const i = new AbortController(), n = (l) => {
|
|
599
599
|
Object.defineProperty(l, "signal", {
|
|
600
600
|
enumerable: !0,
|
|
601
|
-
get: () => (o(this,
|
|
601
|
+
get: () => (o(this, pt, !0), i.signal)
|
|
602
602
|
});
|
|
603
603
|
}, a = () => {
|
|
604
|
-
const l =
|
|
604
|
+
const l = ke(this.options, s), x = (() => {
|
|
605
605
|
const Z = {
|
|
606
|
-
client: r(this,
|
|
606
|
+
client: r(this, yt),
|
|
607
607
|
queryKey: this.queryKey,
|
|
608
608
|
meta: this.meta
|
|
609
609
|
};
|
|
610
610
|
return n(Z), Z;
|
|
611
611
|
})();
|
|
612
|
-
return o(this,
|
|
612
|
+
return o(this, pt, !1), this.options.persister ? this.options.persister(
|
|
613
613
|
l,
|
|
614
614
|
x,
|
|
615
615
|
this
|
|
@@ -619,29 +619,29 @@ var lt, Te, Le = (Te = class {
|
|
|
619
619
|
fetchOptions: s,
|
|
620
620
|
options: this.options,
|
|
621
621
|
queryKey: this.queryKey,
|
|
622
|
-
client: r(this,
|
|
622
|
+
client: r(this, yt),
|
|
623
623
|
state: this.state,
|
|
624
624
|
fetchFn: a
|
|
625
625
|
};
|
|
626
626
|
return n(l), l;
|
|
627
627
|
})();
|
|
628
|
-
(b = this.options.behavior) == null || b.onFetch(u, this), o(this, Pt, this.state), (this.state.fetchStatus === "idle" || this.state.fetchMeta !== ((
|
|
628
|
+
(b = this.options.behavior) == null || b.onFetch(u, this), o(this, Pt, this.state), (this.state.fetchStatus === "idle" || this.state.fetchMeta !== ((E = u.fetchOptions) == null ? void 0 : E.meta)) && v(this, K, $).call(this, { type: "fetch", meta: (f = u.fetchOptions) == null ? void 0 : f.meta }), o(this, D, Ke({
|
|
629
629
|
initialPromise: s == null ? void 0 : s.initialPromise,
|
|
630
630
|
fn: u.fetchFn,
|
|
631
631
|
onCancel: (l) => {
|
|
632
|
-
l instanceof
|
|
632
|
+
l instanceof re && l.revert && this.setState({
|
|
633
633
|
...r(this, Pt),
|
|
634
634
|
fetchStatus: "idle"
|
|
635
635
|
}), i.abort();
|
|
636
636
|
},
|
|
637
637
|
onFail: (l, Q) => {
|
|
638
|
-
v(this,
|
|
638
|
+
v(this, K, $).call(this, { type: "failed", failureCount: l, error: Q });
|
|
639
639
|
},
|
|
640
640
|
onPause: () => {
|
|
641
|
-
v(this,
|
|
641
|
+
v(this, K, $).call(this, { type: "pause" });
|
|
642
642
|
},
|
|
643
643
|
onContinue: () => {
|
|
644
|
-
v(this,
|
|
644
|
+
v(this, K, $).call(this, { type: "continue" });
|
|
645
645
|
},
|
|
646
646
|
retry: u.options.retry,
|
|
647
647
|
retryDelay: u.options.retryDelay,
|
|
@@ -654,14 +654,14 @@ var lt, Te, Le = (Te = class {
|
|
|
654
654
|
throw process.env.NODE_ENV !== "production" && console.error(
|
|
655
655
|
`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`
|
|
656
656
|
), new Error(`${this.queryHash} data is undefined`);
|
|
657
|
-
return this.setData(l), (y = (
|
|
657
|
+
return this.setData(l), (y = (C = r(this, _).config).onSuccess) == null || y.call(C, l, this), (m = (R = r(this, _).config).onSettled) == null || m.call(
|
|
658
658
|
R,
|
|
659
659
|
l,
|
|
660
660
|
this.state.error,
|
|
661
661
|
this
|
|
662
662
|
), l;
|
|
663
663
|
} catch (l) {
|
|
664
|
-
if (l instanceof
|
|
664
|
+
if (l instanceof re) {
|
|
665
665
|
if (l.silent)
|
|
666
666
|
return r(this, D).promise;
|
|
667
667
|
if (l.revert) {
|
|
@@ -670,14 +670,14 @@ var lt, Te, Le = (Te = class {
|
|
|
670
670
|
return this.state.data;
|
|
671
671
|
}
|
|
672
672
|
}
|
|
673
|
-
throw v(this,
|
|
673
|
+
throw v(this, K, $).call(this, {
|
|
674
674
|
type: "error",
|
|
675
675
|
error: l
|
|
676
|
-
}), (
|
|
677
|
-
|
|
676
|
+
}), (O = (p = r(this, _).config).onError) == null || O.call(
|
|
677
|
+
p,
|
|
678
678
|
l,
|
|
679
679
|
this
|
|
680
|
-
), (
|
|
680
|
+
), (P = (M = r(this, _).config).onSettled) == null || P.call(
|
|
681
681
|
M,
|
|
682
682
|
this.state.data,
|
|
683
683
|
l,
|
|
@@ -687,7 +687,7 @@ var lt, Te, Le = (Te = class {
|
|
|
687
687
|
this.scheduleGc();
|
|
688
688
|
}
|
|
689
689
|
}
|
|
690
|
-
},
|
|
690
|
+
}, ft = new WeakMap(), Pt = new WeakMap(), _ = new WeakMap(), yt = new WeakMap(), D = new WeakMap(), jt = new WeakMap(), pt = new WeakMap(), K = new WeakSet(), $ = function(t) {
|
|
691
691
|
const s = (i) => {
|
|
692
692
|
switch (t.type) {
|
|
693
693
|
case "failed":
|
|
@@ -709,7 +709,7 @@ var lt, Te, Le = (Te = class {
|
|
|
709
709
|
case "fetch":
|
|
710
710
|
return {
|
|
711
711
|
...i,
|
|
712
|
-
...
|
|
712
|
+
...Ge(i.data, this.options),
|
|
713
713
|
fetchMeta: t.meta ?? null
|
|
714
714
|
};
|
|
715
715
|
case "success":
|
|
@@ -753,12 +753,12 @@ var lt, Te, Le = (Te = class {
|
|
|
753
753
|
i.onQueryUpdate();
|
|
754
754
|
}), r(this, _).notify({ query: this, type: "updated", action: t });
|
|
755
755
|
});
|
|
756
|
-
},
|
|
757
|
-
function
|
|
756
|
+
}, qe);
|
|
757
|
+
function Ge(e, t) {
|
|
758
758
|
return {
|
|
759
759
|
fetchFailureCount: 0,
|
|
760
760
|
fetchFailureReason: null,
|
|
761
|
-
fetchStatus:
|
|
761
|
+
fetchStatus: Le(t.networkMode) ? "fetching" : "paused",
|
|
762
762
|
...e === void 0 && {
|
|
763
763
|
error: null,
|
|
764
764
|
status: "pending"
|
|
@@ -774,7 +774,7 @@ function Ce(e, t) {
|
|
|
774
774
|
status: "success"
|
|
775
775
|
};
|
|
776
776
|
}
|
|
777
|
-
function
|
|
777
|
+
function Oe(e) {
|
|
778
778
|
const t = typeof e.initialData == "function" ? e.initialData() : e.initialData, s = t !== void 0, i = s ? typeof e.initialDataUpdatedAt == "function" ? e.initialDataUpdatedAt() : e.initialDataUpdatedAt : 0;
|
|
779
779
|
return {
|
|
780
780
|
data: t,
|
|
@@ -791,54 +791,54 @@ function Se(e) {
|
|
|
791
791
|
fetchStatus: "idle"
|
|
792
792
|
};
|
|
793
793
|
}
|
|
794
|
-
var U, g,
|
|
794
|
+
var U, g, Nt, q, mt, Ft, W, rt, _t, Rt, Mt, vt, gt, it, Qt, S, At, ie, ne, ae, oe, ue, he, ce, Be, Ae, fs = (Ae = class extends Kt {
|
|
795
795
|
constructor(t, s) {
|
|
796
796
|
super();
|
|
797
|
-
c(this,
|
|
797
|
+
c(this, S);
|
|
798
798
|
c(this, U);
|
|
799
799
|
c(this, g);
|
|
800
|
-
c(this, jt);
|
|
801
|
-
c(this, q);
|
|
802
|
-
c(this, pt);
|
|
803
|
-
c(this, Et);
|
|
804
|
-
c(this, W);
|
|
805
|
-
c(this, st);
|
|
806
800
|
c(this, Nt);
|
|
801
|
+
c(this, q);
|
|
802
|
+
c(this, mt);
|
|
807
803
|
c(this, Ft);
|
|
804
|
+
c(this, W);
|
|
805
|
+
c(this, rt);
|
|
806
|
+
c(this, _t);
|
|
807
|
+
c(this, Rt);
|
|
808
808
|
// This property keeps track of the last query with defined data.
|
|
809
809
|
// It will be used to pass the previous data and query to the placeholder function between renders.
|
|
810
|
-
c(this,
|
|
811
|
-
c(this, mt);
|
|
810
|
+
c(this, Mt);
|
|
812
811
|
c(this, vt);
|
|
813
|
-
c(this,
|
|
814
|
-
c(this,
|
|
815
|
-
|
|
812
|
+
c(this, gt);
|
|
813
|
+
c(this, it);
|
|
814
|
+
c(this, Qt, /* @__PURE__ */ new Set());
|
|
815
|
+
this.options = s, o(this, U, t), o(this, rt, null), o(this, W, se()), this.bindMethods(), this.setOptions(s);
|
|
816
816
|
}
|
|
817
817
|
bindMethods() {
|
|
818
818
|
this.refetch = this.refetch.bind(this);
|
|
819
819
|
}
|
|
820
820
|
onSubscribe() {
|
|
821
|
-
this.listeners.size === 1 && (r(this, g).addObserver(this),
|
|
821
|
+
this.listeners.size === 1 && (r(this, g).addObserver(this), Ee(r(this, g), this.options) ? v(this, S, At).call(this) : this.updateResult(), v(this, S, oe).call(this));
|
|
822
822
|
}
|
|
823
823
|
onUnsubscribe() {
|
|
824
824
|
this.hasListeners() || this.destroy();
|
|
825
825
|
}
|
|
826
826
|
shouldFetchOnReconnect() {
|
|
827
|
-
return
|
|
827
|
+
return le(
|
|
828
828
|
r(this, g),
|
|
829
829
|
this.options,
|
|
830
830
|
this.options.refetchOnReconnect
|
|
831
831
|
);
|
|
832
832
|
}
|
|
833
833
|
shouldFetchOnWindowFocus() {
|
|
834
|
-
return
|
|
834
|
+
return le(
|
|
835
835
|
r(this, g),
|
|
836
836
|
this.options,
|
|
837
837
|
this.options.refetchOnWindowFocus
|
|
838
838
|
);
|
|
839
839
|
}
|
|
840
840
|
destroy() {
|
|
841
|
-
this.listeners = /* @__PURE__ */ new Set(), v(this,
|
|
841
|
+
this.listeners = /* @__PURE__ */ new Set(), v(this, S, ue).call(this), v(this, S, he).call(this), r(this, g).removeObserver(this);
|
|
842
842
|
}
|
|
843
843
|
setOptions(t) {
|
|
844
844
|
const s = this.options, i = r(this, g);
|
|
@@ -846,7 +846,7 @@ var U, g, jt, q, pt, Et, W, st, Nt, Ft, Rt, mt, vt, rt, Mt, C, qt, re, ie, ne, a
|
|
|
846
846
|
throw new Error(
|
|
847
847
|
"Expected enabled to be a boolean or a callback that returns a boolean"
|
|
848
848
|
);
|
|
849
|
-
v(this,
|
|
849
|
+
v(this, S, ce).call(this), r(this, g).setOptions(this.options), s._defaulted && !Yt(this.options, s) && r(this, U).getQueryCache().notify({
|
|
850
850
|
type: "observerOptionsUpdated",
|
|
851
851
|
query: r(this, g),
|
|
852
852
|
observer: this
|
|
@@ -857,13 +857,13 @@ var U, g, jt, q, pt, Et, W, st, Nt, Ft, Rt, mt, vt, rt, Mt, C, qt, re, ie, ne, a
|
|
|
857
857
|
i,
|
|
858
858
|
this.options,
|
|
859
859
|
s
|
|
860
|
-
) && v(this,
|
|
861
|
-
const a = v(this,
|
|
862
|
-
n && (r(this, g) !== i || k(this.options.enabled, r(this, g)) !== k(s.enabled, r(this, g)) || a !== r(this,
|
|
860
|
+
) && v(this, S, At).call(this), this.updateResult(), n && (r(this, g) !== i || k(this.options.enabled, r(this, g)) !== k(s.enabled, r(this, g)) || ut(this.options.staleTime, r(this, g)) !== ut(s.staleTime, r(this, g))) && v(this, S, ie).call(this);
|
|
861
|
+
const a = v(this, S, ne).call(this);
|
|
862
|
+
n && (r(this, g) !== i || k(this.options.enabled, r(this, g)) !== k(s.enabled, r(this, g)) || a !== r(this, it)) && v(this, S, ae).call(this, a);
|
|
863
863
|
}
|
|
864
864
|
getOptimisticResult(t) {
|
|
865
865
|
const s = r(this, U).getQueryCache().build(r(this, U), t), i = this.createResult(s, t);
|
|
866
|
-
return ps(this, i) && (o(this, q, i), o(this,
|
|
866
|
+
return ps(this, i) && (o(this, q, i), o(this, Ft, this.options), o(this, mt, r(this, g).state)), i;
|
|
867
867
|
}
|
|
868
868
|
getCurrentResult() {
|
|
869
869
|
return r(this, q);
|
|
@@ -878,7 +878,7 @@ var U, g, jt, q, pt, Et, W, st, Nt, Ft, Rt, mt, vt, rt, Mt, C, qt, re, ie, ne, a
|
|
|
878
878
|
});
|
|
879
879
|
}
|
|
880
880
|
trackProp(t) {
|
|
881
|
-
r(this,
|
|
881
|
+
r(this, Qt).add(t);
|
|
882
882
|
}
|
|
883
883
|
getCurrentQuery() {
|
|
884
884
|
return r(this, g);
|
|
@@ -893,90 +893,90 @@ var U, g, jt, q, pt, Et, W, st, Nt, Ft, Rt, mt, vt, rt, Mt, C, qt, re, ie, ne, a
|
|
|
893
893
|
return i.fetch().then(() => this.createResult(i, s));
|
|
894
894
|
}
|
|
895
895
|
fetch(t) {
|
|
896
|
-
return v(this,
|
|
896
|
+
return v(this, S, At).call(this, {
|
|
897
897
|
...t,
|
|
898
898
|
cancelRefetch: t.cancelRefetch ?? !0
|
|
899
899
|
}).then(() => (this.updateResult(), r(this, q)));
|
|
900
900
|
}
|
|
901
901
|
createResult(t, s) {
|
|
902
902
|
var X;
|
|
903
|
-
const i = r(this, g), n = this.options, a = r(this, q), h = r(this,
|
|
904
|
-
let f = { ...
|
|
903
|
+
const i = r(this, g), n = this.options, a = r(this, q), h = r(this, mt), u = r(this, Ft), b = t !== i ? t.state : r(this, Nt), { state: E } = t;
|
|
904
|
+
let f = { ...E }, C = !1, y;
|
|
905
905
|
if (s._optimisticResults) {
|
|
906
|
-
const w = this.hasListeners(), N = !w &&
|
|
907
|
-
(N ||
|
|
906
|
+
const w = this.hasListeners(), N = !w && Ee(t, s), St = w && Pe(t, i, s, n);
|
|
907
|
+
(N || St) && (f = {
|
|
908
908
|
...f,
|
|
909
|
-
...
|
|
909
|
+
...Ge(E.data, t.options)
|
|
910
910
|
}), s._optimisticResults === "isRestoring" && (f.fetchStatus = "idle");
|
|
911
911
|
}
|
|
912
|
-
let { error: R, errorUpdatedAt:
|
|
912
|
+
let { error: R, errorUpdatedAt: m, status: p } = f;
|
|
913
913
|
y = f.data;
|
|
914
|
-
let
|
|
915
|
-
if (s.placeholderData !== void 0 && y === void 0 &&
|
|
914
|
+
let O = !1;
|
|
915
|
+
if (s.placeholderData !== void 0 && y === void 0 && p === "pending") {
|
|
916
916
|
let w;
|
|
917
|
-
a != null && a.isPlaceholderData && s.placeholderData === (u == null ? void 0 : u.placeholderData) ? (w = a.data,
|
|
918
|
-
(X = r(this,
|
|
919
|
-
r(this,
|
|
920
|
-
) : s.placeholderData, w !== void 0 && (
|
|
917
|
+
a != null && a.isPlaceholderData && s.placeholderData === (u == null ? void 0 : u.placeholderData) ? (w = a.data, O = !0) : w = typeof s.placeholderData == "function" ? s.placeholderData(
|
|
918
|
+
(X = r(this, Mt)) == null ? void 0 : X.state.data,
|
|
919
|
+
r(this, Mt)
|
|
920
|
+
) : s.placeholderData, w !== void 0 && (p = "success", y = ee(
|
|
921
921
|
a == null ? void 0 : a.data,
|
|
922
922
|
w,
|
|
923
923
|
s
|
|
924
|
-
),
|
|
924
|
+
), C = !0);
|
|
925
925
|
}
|
|
926
|
-
if (s.select && y !== void 0 && !
|
|
927
|
-
if (a && y === (h == null ? void 0 : h.data) && s.select === r(this,
|
|
928
|
-
y = r(this,
|
|
926
|
+
if (s.select && y !== void 0 && !O)
|
|
927
|
+
if (a && y === (h == null ? void 0 : h.data) && s.select === r(this, _t))
|
|
928
|
+
y = r(this, Rt);
|
|
929
929
|
else
|
|
930
930
|
try {
|
|
931
|
-
o(this,
|
|
931
|
+
o(this, _t, s.select), y = s.select(y), y = ee(a == null ? void 0 : a.data, y, s), o(this, Rt, y), o(this, rt, null);
|
|
932
932
|
} catch (w) {
|
|
933
|
-
o(this,
|
|
933
|
+
o(this, rt, w);
|
|
934
934
|
}
|
|
935
|
-
r(this,
|
|
936
|
-
const M = f.fetchStatus === "fetching",
|
|
937
|
-
status:
|
|
935
|
+
r(this, rt) && (R = r(this, rt), y = r(this, Rt), m = Date.now(), p = "error");
|
|
936
|
+
const M = f.fetchStatus === "fetching", P = p === "pending", l = p === "error", Q = P && M, x = y !== void 0, I = {
|
|
937
|
+
status: p,
|
|
938
938
|
fetchStatus: f.fetchStatus,
|
|
939
|
-
isPending:
|
|
940
|
-
isSuccess:
|
|
939
|
+
isPending: P,
|
|
940
|
+
isSuccess: p === "success",
|
|
941
941
|
isError: l,
|
|
942
942
|
isInitialLoading: Q,
|
|
943
943
|
isLoading: Q,
|
|
944
944
|
data: y,
|
|
945
945
|
dataUpdatedAt: f.dataUpdatedAt,
|
|
946
946
|
error: R,
|
|
947
|
-
errorUpdatedAt:
|
|
947
|
+
errorUpdatedAt: m,
|
|
948
948
|
failureCount: f.fetchFailureCount,
|
|
949
949
|
failureReason: f.fetchFailureReason,
|
|
950
950
|
errorUpdateCount: f.errorUpdateCount,
|
|
951
951
|
isFetched: f.dataUpdateCount > 0 || f.errorUpdateCount > 0,
|
|
952
952
|
isFetchedAfterMount: f.dataUpdateCount > b.dataUpdateCount || f.errorUpdateCount > b.errorUpdateCount,
|
|
953
953
|
isFetching: M,
|
|
954
|
-
isRefetching: M && !
|
|
954
|
+
isRefetching: M && !P,
|
|
955
955
|
isLoadingError: l && !x,
|
|
956
956
|
isPaused: f.fetchStatus === "paused",
|
|
957
|
-
isPlaceholderData:
|
|
957
|
+
isPlaceholderData: C,
|
|
958
958
|
isRefetchError: l && x,
|
|
959
|
-
isStale:
|
|
959
|
+
isStale: ye(t, s),
|
|
960
960
|
refetch: this.refetch,
|
|
961
961
|
promise: r(this, W),
|
|
962
962
|
isEnabled: k(s.enabled, t) !== !1
|
|
963
963
|
};
|
|
964
964
|
if (this.options.experimental_prefetchInRender) {
|
|
965
|
-
const w = (
|
|
966
|
-
I.status === "error" ?
|
|
965
|
+
const w = (Ht) => {
|
|
966
|
+
I.status === "error" ? Ht.reject(I.error) : I.data !== void 0 && Ht.resolve(I.data);
|
|
967
967
|
}, N = () => {
|
|
968
|
-
const
|
|
969
|
-
w(
|
|
970
|
-
},
|
|
971
|
-
switch (
|
|
968
|
+
const Ht = o(this, W, I.promise = se());
|
|
969
|
+
w(Ht);
|
|
970
|
+
}, St = r(this, W);
|
|
971
|
+
switch (St.status) {
|
|
972
972
|
case "pending":
|
|
973
|
-
t.queryHash === i.queryHash && w(
|
|
973
|
+
t.queryHash === i.queryHash && w(St);
|
|
974
974
|
break;
|
|
975
975
|
case "fulfilled":
|
|
976
|
-
(I.status === "error" || I.data !==
|
|
976
|
+
(I.status === "error" || I.data !== St.value) && N();
|
|
977
977
|
break;
|
|
978
978
|
case "rejected":
|
|
979
|
-
(I.status !== "error" || I.error !==
|
|
979
|
+
(I.status !== "error" || I.error !== St.reason) && N();
|
|
980
980
|
break;
|
|
981
981
|
}
|
|
982
982
|
}
|
|
@@ -984,66 +984,66 @@ var U, g, jt, q, pt, Et, W, st, Nt, Ft, Rt, mt, vt, rt, Mt, C, qt, re, ie, ne, a
|
|
|
984
984
|
}
|
|
985
985
|
updateResult() {
|
|
986
986
|
const t = r(this, q), s = this.createResult(r(this, g), this.options);
|
|
987
|
-
if (o(this,
|
|
987
|
+
if (o(this, mt, r(this, g).state), o(this, Ft, this.options), r(this, mt).data !== void 0 && o(this, Mt, r(this, g)), Yt(s, t))
|
|
988
988
|
return;
|
|
989
989
|
o(this, q, s);
|
|
990
990
|
const i = () => {
|
|
991
991
|
if (!t)
|
|
992
992
|
return !0;
|
|
993
993
|
const { notifyOnChangeProps: n } = this.options, a = typeof n == "function" ? n() : n;
|
|
994
|
-
if (a === "all" || !a && !r(this,
|
|
994
|
+
if (a === "all" || !a && !r(this, Qt).size)
|
|
995
995
|
return !0;
|
|
996
996
|
const h = new Set(
|
|
997
|
-
a ?? r(this,
|
|
997
|
+
a ?? r(this, Qt)
|
|
998
998
|
);
|
|
999
999
|
return this.options.throwOnError && h.add("error"), Object.keys(r(this, q)).some((u) => {
|
|
1000
1000
|
const d = u;
|
|
1001
1001
|
return r(this, q)[d] !== t[d] && h.has(d);
|
|
1002
1002
|
});
|
|
1003
1003
|
};
|
|
1004
|
-
v(this,
|
|
1004
|
+
v(this, S, Be).call(this, { listeners: i() });
|
|
1005
1005
|
}
|
|
1006
1006
|
onQueryUpdate() {
|
|
1007
|
-
this.updateResult(), this.hasListeners() && v(this,
|
|
1007
|
+
this.updateResult(), this.hasListeners() && v(this, S, oe).call(this);
|
|
1008
1008
|
}
|
|
1009
|
-
}, U = new WeakMap(), g = new WeakMap(),
|
|
1010
|
-
v(this,
|
|
1009
|
+
}, U = new WeakMap(), g = new WeakMap(), Nt = new WeakMap(), q = new WeakMap(), mt = new WeakMap(), Ft = new WeakMap(), W = new WeakMap(), rt = new WeakMap(), _t = new WeakMap(), Rt = new WeakMap(), Mt = new WeakMap(), vt = new WeakMap(), gt = new WeakMap(), it = new WeakMap(), Qt = new WeakMap(), S = new WeakSet(), At = function(t) {
|
|
1010
|
+
v(this, S, ce).call(this);
|
|
1011
1011
|
let s = r(this, g).fetch(
|
|
1012
1012
|
this.options,
|
|
1013
1013
|
t
|
|
1014
1014
|
);
|
|
1015
1015
|
return t != null && t.throwOnError || (s = s.catch(j)), s;
|
|
1016
|
-
},
|
|
1017
|
-
v(this,
|
|
1018
|
-
const t =
|
|
1016
|
+
}, ie = function() {
|
|
1017
|
+
v(this, S, ue).call(this);
|
|
1018
|
+
const t = ut(
|
|
1019
1019
|
this.options.staleTime,
|
|
1020
1020
|
r(this, g)
|
|
1021
1021
|
);
|
|
1022
|
-
if (
|
|
1022
|
+
if (wt || r(this, q).isStale || !Zt(t))
|
|
1023
1023
|
return;
|
|
1024
|
-
const i =
|
|
1025
|
-
o(this,
|
|
1024
|
+
const i = _e(r(this, q).dataUpdatedAt, t) + 1;
|
|
1025
|
+
o(this, vt, ht.setTimeout(() => {
|
|
1026
1026
|
r(this, q).isStale || this.updateResult();
|
|
1027
1027
|
}, i));
|
|
1028
|
-
},
|
|
1028
|
+
}, ne = function() {
|
|
1029
1029
|
return (typeof this.options.refetchInterval == "function" ? this.options.refetchInterval(r(this, g)) : this.options.refetchInterval) ?? !1;
|
|
1030
|
-
},
|
|
1031
|
-
v(this,
|
|
1032
|
-
(this.options.refetchIntervalInBackground ||
|
|
1033
|
-
}, r(this,
|
|
1034
|
-
}, ae = function() {
|
|
1035
|
-
v(this, C, re).call(this), v(this, C, ne).call(this, v(this, C, ie).call(this));
|
|
1030
|
+
}, ae = function(t) {
|
|
1031
|
+
v(this, S, he).call(this), o(this, it, t), !(wt || k(this.options.enabled, r(this, g)) === !1 || !Zt(r(this, it)) || r(this, it) === 0) && o(this, gt, ht.setInterval(() => {
|
|
1032
|
+
(this.options.refetchIntervalInBackground || fe.isFocused()) && v(this, S, At).call(this);
|
|
1033
|
+
}, r(this, it)));
|
|
1036
1034
|
}, oe = function() {
|
|
1037
|
-
|
|
1035
|
+
v(this, S, ie).call(this), v(this, S, ae).call(this, v(this, S, ne).call(this));
|
|
1038
1036
|
}, ue = function() {
|
|
1039
|
-
r(this, vt) && (
|
|
1037
|
+
r(this, vt) && (ht.clearTimeout(r(this, vt)), o(this, vt, void 0));
|
|
1040
1038
|
}, he = function() {
|
|
1039
|
+
r(this, gt) && (ht.clearInterval(r(this, gt)), o(this, gt, void 0));
|
|
1040
|
+
}, ce = function() {
|
|
1041
1041
|
const t = r(this, U).getQueryCache().build(r(this, U), this.options);
|
|
1042
1042
|
if (t === r(this, g))
|
|
1043
1043
|
return;
|
|
1044
1044
|
const s = r(this, g);
|
|
1045
|
-
o(this, g, t), o(this,
|
|
1046
|
-
},
|
|
1045
|
+
o(this, g, t), o(this, Nt, t.state), this.hasListeners() && (s == null || s.removeObserver(this), t.addObserver(this));
|
|
1046
|
+
}, Be = function(t) {
|
|
1047
1047
|
T.batch(() => {
|
|
1048
1048
|
t.listeners && this.listeners.forEach((s) => {
|
|
1049
1049
|
s(r(this, q));
|
|
@@ -1052,49 +1052,49 @@ var U, g, jt, q, pt, Et, W, st, Nt, Ft, Rt, mt, vt, rt, Mt, C, qt, re, ie, ne, a
|
|
|
1052
1052
|
type: "observerResultsUpdated"
|
|
1053
1053
|
});
|
|
1054
1054
|
});
|
|
1055
|
-
},
|
|
1055
|
+
}, Ae);
|
|
1056
1056
|
function ys(e, t) {
|
|
1057
1057
|
return k(t.enabled, e) !== !1 && e.state.data === void 0 && !(e.state.status === "error" && t.retryOnMount === !1);
|
|
1058
1058
|
}
|
|
1059
|
-
function
|
|
1060
|
-
return ys(e, t) || e.state.data !== void 0 &&
|
|
1059
|
+
function Ee(e, t) {
|
|
1060
|
+
return ys(e, t) || e.state.data !== void 0 && le(e, t, t.refetchOnMount);
|
|
1061
1061
|
}
|
|
1062
|
-
function
|
|
1063
|
-
if (k(t.enabled, e) !== !1 &&
|
|
1062
|
+
function le(e, t, s) {
|
|
1063
|
+
if (k(t.enabled, e) !== !1 && ut(t.staleTime, e) !== "static") {
|
|
1064
1064
|
const i = typeof s == "function" ? s(e) : s;
|
|
1065
|
-
return i === "always" || i !== !1 &&
|
|
1065
|
+
return i === "always" || i !== !1 && ye(e, t);
|
|
1066
1066
|
}
|
|
1067
1067
|
return !1;
|
|
1068
1068
|
}
|
|
1069
1069
|
function Pe(e, t, s, i) {
|
|
1070
|
-
return (e !== t || k(i.enabled, e) === !1) && (!s.suspense || e.state.status !== "error") &&
|
|
1070
|
+
return (e !== t || k(i.enabled, e) === !1) && (!s.suspense || e.state.status !== "error") && ye(e, s);
|
|
1071
1071
|
}
|
|
1072
|
-
function
|
|
1073
|
-
return k(t.enabled, e) !== !1 && e.isStaleByTime(
|
|
1072
|
+
function ye(e, t) {
|
|
1073
|
+
return k(t.enabled, e) !== !1 && e.isStaleByTime(ut(t.staleTime, e));
|
|
1074
1074
|
}
|
|
1075
1075
|
function ps(e, t) {
|
|
1076
|
-
return !
|
|
1076
|
+
return !Yt(e.getCurrentResult(), t);
|
|
1077
1077
|
}
|
|
1078
|
-
function
|
|
1078
|
+
function Fe(e) {
|
|
1079
1079
|
return {
|
|
1080
1080
|
onFetch: (t, s) => {
|
|
1081
|
-
var
|
|
1082
|
-
const i = t.options, n = (
|
|
1081
|
+
var E, f, C, y, R;
|
|
1082
|
+
const i = t.options, n = (C = (f = (E = t.fetchOptions) == null ? void 0 : E.meta) == null ? void 0 : f.fetchMore) == null ? void 0 : C.direction, a = ((y = t.state.data) == null ? void 0 : y.pages) || [], h = ((R = t.state.data) == null ? void 0 : R.pageParams) || [];
|
|
1083
1083
|
let u = { pages: [], pageParams: [] }, d = 0;
|
|
1084
1084
|
const b = async () => {
|
|
1085
|
-
let
|
|
1086
|
-
const
|
|
1087
|
-
Object.defineProperty(
|
|
1085
|
+
let m = !1;
|
|
1086
|
+
const p = (P) => {
|
|
1087
|
+
Object.defineProperty(P, "signal", {
|
|
1088
1088
|
enumerable: !0,
|
|
1089
|
-
get: () => (t.signal.aborted ?
|
|
1090
|
-
|
|
1089
|
+
get: () => (t.signal.aborted ? m = !0 : t.signal.addEventListener("abort", () => {
|
|
1090
|
+
m = !0;
|
|
1091
1091
|
}), t.signal)
|
|
1092
1092
|
});
|
|
1093
|
-
},
|
|
1094
|
-
if (
|
|
1093
|
+
}, O = ke(t.options, t.fetchOptions), M = async (P, l, Q) => {
|
|
1094
|
+
if (m)
|
|
1095
1095
|
return Promise.reject();
|
|
1096
|
-
if (l == null &&
|
|
1097
|
-
return Promise.resolve(
|
|
1096
|
+
if (l == null && P.pages.length)
|
|
1097
|
+
return Promise.resolve(P);
|
|
1098
1098
|
const Z = (() => {
|
|
1099
1099
|
const N = {
|
|
1100
1100
|
client: t.client,
|
|
@@ -1103,34 +1103,34 @@ function Ee(e) {
|
|
|
1103
1103
|
direction: Q ? "backward" : "forward",
|
|
1104
1104
|
meta: t.options.meta
|
|
1105
1105
|
};
|
|
1106
|
-
return
|
|
1107
|
-
})(), I = await
|
|
1106
|
+
return p(N), N;
|
|
1107
|
+
})(), I = await O(Z), { maxPages: X } = t.options, w = Q ? ns : is;
|
|
1108
1108
|
return {
|
|
1109
|
-
pages: w(
|
|
1110
|
-
pageParams: w(
|
|
1109
|
+
pages: w(P.pages, I, X),
|
|
1110
|
+
pageParams: w(P.pageParams, l, X)
|
|
1111
1111
|
};
|
|
1112
1112
|
};
|
|
1113
1113
|
if (n && a.length) {
|
|
1114
|
-
const
|
|
1114
|
+
const P = n === "backward", l = P ? ms : Re, Q = {
|
|
1115
1115
|
pages: a,
|
|
1116
1116
|
pageParams: h
|
|
1117
1117
|
}, x = l(i, Q);
|
|
1118
|
-
u = await M(Q, x,
|
|
1118
|
+
u = await M(Q, x, P);
|
|
1119
1119
|
} else {
|
|
1120
|
-
const
|
|
1120
|
+
const P = e ?? a.length;
|
|
1121
1121
|
do {
|
|
1122
|
-
const l = d === 0 ? h[0] ?? i.initialPageParam :
|
|
1122
|
+
const l = d === 0 ? h[0] ?? i.initialPageParam : Re(i, u);
|
|
1123
1123
|
if (d > 0 && l == null)
|
|
1124
1124
|
break;
|
|
1125
1125
|
u = await M(u, l), d++;
|
|
1126
|
-
} while (d <
|
|
1126
|
+
} while (d < P);
|
|
1127
1127
|
}
|
|
1128
1128
|
return u;
|
|
1129
1129
|
};
|
|
1130
1130
|
t.options.persister ? t.fetchFn = () => {
|
|
1131
|
-
var
|
|
1132
|
-
return (
|
|
1133
|
-
|
|
1131
|
+
var m, p;
|
|
1132
|
+
return (p = (m = t.options).persister) == null ? void 0 : p.call(
|
|
1133
|
+
m,
|
|
1134
1134
|
b,
|
|
1135
1135
|
{
|
|
1136
1136
|
client: t.client,
|
|
@@ -1144,7 +1144,7 @@ function Ee(e) {
|
|
|
1144
1144
|
}
|
|
1145
1145
|
};
|
|
1146
1146
|
}
|
|
1147
|
-
function
|
|
1147
|
+
function Re(e, { pages: t, pageParams: s }) {
|
|
1148
1148
|
const i = t.length - 1;
|
|
1149
1149
|
return t.length > 0 ? e.getNextPageParam(
|
|
1150
1150
|
t[i],
|
|
@@ -1157,15 +1157,15 @@ function ms(e, { pages: t, pageParams: s }) {
|
|
|
1157
1157
|
var i;
|
|
1158
1158
|
return t.length > 0 ? (i = e.getPreviousPageParam) == null ? void 0 : i.call(e, t[0], t, s[0], s) : void 0;
|
|
1159
1159
|
}
|
|
1160
|
-
var
|
|
1160
|
+
var kt, B, A, bt, V, tt, xe, vs = (xe = class extends He {
|
|
1161
1161
|
constructor(t) {
|
|
1162
1162
|
super();
|
|
1163
1163
|
c(this, V);
|
|
1164
|
-
c(this,
|
|
1164
|
+
c(this, kt);
|
|
1165
1165
|
c(this, B);
|
|
1166
1166
|
c(this, A);
|
|
1167
|
-
c(this,
|
|
1168
|
-
o(this,
|
|
1167
|
+
c(this, bt);
|
|
1168
|
+
o(this, kt, t.client), this.mutationId = t.mutationId, o(this, A, t.mutationCache), o(this, B, []), this.state = t.state || gs(), this.setOptions(t.options), this.scheduleGc();
|
|
1169
1169
|
}
|
|
1170
1170
|
setOptions(t) {
|
|
1171
1171
|
this.options = t, this.updateGcTime(this.options.gcTime);
|
|
@@ -1192,25 +1192,25 @@ var _t, B, A, gt, V, Y, Ae, vs = (Ae = class extends Le {
|
|
|
1192
1192
|
}
|
|
1193
1193
|
continue() {
|
|
1194
1194
|
var t;
|
|
1195
|
-
return ((t = r(this,
|
|
1195
|
+
return ((t = r(this, bt)) == null ? void 0 : t.continue()) ?? // continuing a mutation assumes that variables are set, mutation must have been dehydrated before
|
|
1196
1196
|
this.execute(this.state.variables);
|
|
1197
1197
|
}
|
|
1198
1198
|
async execute(t) {
|
|
1199
|
-
var h, u, d, b,
|
|
1199
|
+
var h, u, d, b, E, f, C, y, R, m, p, O, M, P, l, Q, x, Z, I, X;
|
|
1200
1200
|
const s = () => {
|
|
1201
|
-
v(this, V,
|
|
1201
|
+
v(this, V, tt).call(this, { type: "continue" });
|
|
1202
1202
|
}, i = {
|
|
1203
|
-
client: r(this,
|
|
1203
|
+
client: r(this, kt),
|
|
1204
1204
|
meta: this.options.meta,
|
|
1205
1205
|
mutationKey: this.options.mutationKey
|
|
1206
1206
|
};
|
|
1207
|
-
o(this,
|
|
1207
|
+
o(this, bt, Ke({
|
|
1208
1208
|
fn: () => this.options.mutationFn ? this.options.mutationFn(t, i) : Promise.reject(new Error("No mutationFn found")),
|
|
1209
1209
|
onFail: (w, N) => {
|
|
1210
|
-
v(this, V,
|
|
1210
|
+
v(this, V, tt).call(this, { type: "failed", failureCount: w, error: N });
|
|
1211
1211
|
},
|
|
1212
1212
|
onPause: () => {
|
|
1213
|
-
v(this, V,
|
|
1213
|
+
v(this, V, tt).call(this, { type: "pause" });
|
|
1214
1214
|
},
|
|
1215
1215
|
onContinue: s,
|
|
1216
1216
|
retry: this.options.retry ?? 0,
|
|
@@ -1218,12 +1218,12 @@ var _t, B, A, gt, V, Y, Ae, vs = (Ae = class extends Le {
|
|
|
1218
1218
|
networkMode: this.options.networkMode,
|
|
1219
1219
|
canRun: () => r(this, A).canRun(this)
|
|
1220
1220
|
}));
|
|
1221
|
-
const n = this.state.status === "pending", a = !r(this,
|
|
1221
|
+
const n = this.state.status === "pending", a = !r(this, bt).canStart();
|
|
1222
1222
|
try {
|
|
1223
1223
|
if (n)
|
|
1224
1224
|
s();
|
|
1225
1225
|
else {
|
|
1226
|
-
v(this, V,
|
|
1226
|
+
v(this, V, tt).call(this, { type: "pending", variables: t, isPaused: a }), await ((u = (h = r(this, A).config).onMutate) == null ? void 0 : u.call(
|
|
1227
1227
|
h,
|
|
1228
1228
|
t,
|
|
1229
1229
|
this,
|
|
@@ -1234,28 +1234,28 @@ var _t, B, A, gt, V, Y, Ae, vs = (Ae = class extends Le {
|
|
|
1234
1234
|
t,
|
|
1235
1235
|
i
|
|
1236
1236
|
));
|
|
1237
|
-
N !== this.state.context && v(this, V,
|
|
1237
|
+
N !== this.state.context && v(this, V, tt).call(this, {
|
|
1238
1238
|
type: "pending",
|
|
1239
1239
|
context: N,
|
|
1240
1240
|
variables: t,
|
|
1241
1241
|
isPaused: a
|
|
1242
1242
|
});
|
|
1243
1243
|
}
|
|
1244
|
-
const w = await r(this,
|
|
1245
|
-
return await ((f = (
|
|
1246
|
-
|
|
1244
|
+
const w = await r(this, bt).start();
|
|
1245
|
+
return await ((f = (E = r(this, A).config).onSuccess) == null ? void 0 : f.call(
|
|
1246
|
+
E,
|
|
1247
1247
|
w,
|
|
1248
1248
|
t,
|
|
1249
1249
|
this.state.context,
|
|
1250
1250
|
this,
|
|
1251
1251
|
i
|
|
1252
|
-
)), await ((y = (
|
|
1253
|
-
|
|
1252
|
+
)), await ((y = (C = this.options).onSuccess) == null ? void 0 : y.call(
|
|
1253
|
+
C,
|
|
1254
1254
|
w,
|
|
1255
1255
|
t,
|
|
1256
1256
|
this.state.context,
|
|
1257
1257
|
i
|
|
1258
|
-
)), await ((
|
|
1258
|
+
)), await ((m = (R = r(this, A).config).onSettled) == null ? void 0 : m.call(
|
|
1259
1259
|
R,
|
|
1260
1260
|
w,
|
|
1261
1261
|
null,
|
|
@@ -1263,17 +1263,17 @@ var _t, B, A, gt, V, Y, Ae, vs = (Ae = class extends Le {
|
|
|
1263
1263
|
this.state.context,
|
|
1264
1264
|
this,
|
|
1265
1265
|
i
|
|
1266
|
-
)), await ((
|
|
1267
|
-
|
|
1266
|
+
)), await ((O = (p = this.options).onSettled) == null ? void 0 : O.call(
|
|
1267
|
+
p,
|
|
1268
1268
|
w,
|
|
1269
1269
|
null,
|
|
1270
1270
|
t,
|
|
1271
1271
|
this.state.context,
|
|
1272
1272
|
i
|
|
1273
|
-
)), v(this, V,
|
|
1273
|
+
)), v(this, V, tt).call(this, { type: "success", data: w }), w;
|
|
1274
1274
|
} catch (w) {
|
|
1275
1275
|
try {
|
|
1276
|
-
throw await ((
|
|
1276
|
+
throw await ((P = (M = r(this, A).config).onError) == null ? void 0 : P.call(
|
|
1277
1277
|
M,
|
|
1278
1278
|
w,
|
|
1279
1279
|
t,
|
|
@@ -1303,13 +1303,13 @@ var _t, B, A, gt, V, Y, Ae, vs = (Ae = class extends Le {
|
|
|
1303
1303
|
i
|
|
1304
1304
|
)), w;
|
|
1305
1305
|
} finally {
|
|
1306
|
-
v(this, V,
|
|
1306
|
+
v(this, V, tt).call(this, { type: "error", error: w });
|
|
1307
1307
|
}
|
|
1308
1308
|
} finally {
|
|
1309
1309
|
r(this, A).runNext(this);
|
|
1310
1310
|
}
|
|
1311
1311
|
}
|
|
1312
|
-
},
|
|
1312
|
+
}, kt = new WeakMap(), B = new WeakMap(), A = new WeakMap(), bt = new WeakMap(), V = new WeakSet(), tt = function(t) {
|
|
1313
1313
|
const s = (i) => {
|
|
1314
1314
|
switch (t.type) {
|
|
1315
1315
|
case "failed":
|
|
@@ -1372,7 +1372,7 @@ var _t, B, A, gt, V, Y, Ae, vs = (Ae = class extends Le {
|
|
|
1372
1372
|
action: t
|
|
1373
1373
|
});
|
|
1374
1374
|
});
|
|
1375
|
-
},
|
|
1375
|
+
}, xe);
|
|
1376
1376
|
function gs() {
|
|
1377
1377
|
return {
|
|
1378
1378
|
context: void 0,
|
|
@@ -1386,19 +1386,19 @@ function gs() {
|
|
|
1386
1386
|
submittedAt: 0
|
|
1387
1387
|
};
|
|
1388
1388
|
}
|
|
1389
|
-
var J, H,
|
|
1389
|
+
var J, H, Lt, Ue, bs = (Ue = class extends Kt {
|
|
1390
1390
|
constructor(t = {}) {
|
|
1391
1391
|
super();
|
|
1392
1392
|
c(this, J);
|
|
1393
1393
|
c(this, H);
|
|
1394
|
-
c(this,
|
|
1395
|
-
this.config = t, o(this, J, /* @__PURE__ */ new Set()), o(this, H, /* @__PURE__ */ new Map()), o(this,
|
|
1394
|
+
c(this, Lt);
|
|
1395
|
+
this.config = t, o(this, J, /* @__PURE__ */ new Set()), o(this, H, /* @__PURE__ */ new Map()), o(this, Lt, 0);
|
|
1396
1396
|
}
|
|
1397
1397
|
build(t, s, i) {
|
|
1398
1398
|
const n = new vs({
|
|
1399
1399
|
client: t,
|
|
1400
1400
|
mutationCache: this,
|
|
1401
|
-
mutationId: ++
|
|
1401
|
+
mutationId: ++Gt(this, Lt)._,
|
|
1402
1402
|
options: t.defaultMutationOptions(s),
|
|
1403
1403
|
state: i
|
|
1404
1404
|
});
|
|
@@ -1406,7 +1406,7 @@ var J, H, kt, xe, bs = (xe = class extends Kt {
|
|
|
1406
1406
|
}
|
|
1407
1407
|
add(t) {
|
|
1408
1408
|
r(this, J).add(t);
|
|
1409
|
-
const s =
|
|
1409
|
+
const s = Vt(t);
|
|
1410
1410
|
if (typeof s == "string") {
|
|
1411
1411
|
const i = r(this, H).get(s);
|
|
1412
1412
|
i ? i.push(t) : r(this, H).set(s, [t]);
|
|
@@ -1415,7 +1415,7 @@ var J, H, kt, xe, bs = (xe = class extends Kt {
|
|
|
1415
1415
|
}
|
|
1416
1416
|
remove(t) {
|
|
1417
1417
|
if (r(this, J).delete(t)) {
|
|
1418
|
-
const s =
|
|
1418
|
+
const s = Vt(t);
|
|
1419
1419
|
if (typeof s == "string") {
|
|
1420
1420
|
const i = r(this, H).get(s);
|
|
1421
1421
|
if (i)
|
|
@@ -1428,7 +1428,7 @@ var J, H, kt, xe, bs = (xe = class extends Kt {
|
|
|
1428
1428
|
this.notify({ type: "removed", mutation: t });
|
|
1429
1429
|
}
|
|
1430
1430
|
canRun(t) {
|
|
1431
|
-
const s =
|
|
1431
|
+
const s = Vt(t);
|
|
1432
1432
|
if (typeof s == "string") {
|
|
1433
1433
|
const i = r(this, H).get(s), n = i == null ? void 0 : i.find(
|
|
1434
1434
|
(a) => a.state.status === "pending"
|
|
@@ -1439,7 +1439,7 @@ var J, H, kt, xe, bs = (xe = class extends Kt {
|
|
|
1439
1439
|
}
|
|
1440
1440
|
runNext(t) {
|
|
1441
1441
|
var i;
|
|
1442
|
-
const s =
|
|
1442
|
+
const s = Vt(t);
|
|
1443
1443
|
if (typeof s == "string") {
|
|
1444
1444
|
const n = (i = r(this, H).get(s)) == null ? void 0 : i.find((a) => a !== t && a.state.isPaused);
|
|
1445
1445
|
return (n == null ? void 0 : n.continue()) ?? Promise.resolve();
|
|
@@ -1459,11 +1459,11 @@ var J, H, kt, xe, bs = (xe = class extends Kt {
|
|
|
1459
1459
|
find(t) {
|
|
1460
1460
|
const s = { exact: !0, ...t };
|
|
1461
1461
|
return this.getAll().find(
|
|
1462
|
-
(i) =>
|
|
1462
|
+
(i) => be(s, i)
|
|
1463
1463
|
);
|
|
1464
1464
|
}
|
|
1465
1465
|
findAll(t = {}) {
|
|
1466
|
-
return this.getAll().filter((s) =>
|
|
1466
|
+
return this.getAll().filter((s) => be(t, s));
|
|
1467
1467
|
}
|
|
1468
1468
|
notify(t) {
|
|
1469
1469
|
T.batch(() => {
|
|
@@ -1480,19 +1480,19 @@ var J, H, kt, xe, bs = (xe = class extends Kt {
|
|
|
1480
1480
|
)
|
|
1481
1481
|
);
|
|
1482
1482
|
}
|
|
1483
|
-
}, J = new WeakMap(), H = new WeakMap(),
|
|
1484
|
-
function
|
|
1483
|
+
}, J = new WeakMap(), H = new WeakMap(), Lt = new WeakMap(), Ue);
|
|
1484
|
+
function Vt(e) {
|
|
1485
1485
|
var t;
|
|
1486
1486
|
return (t = e.options.scope) == null ? void 0 : t.id;
|
|
1487
1487
|
}
|
|
1488
|
-
var z,
|
|
1488
|
+
var z, je, ws = (je = class extends Kt {
|
|
1489
1489
|
constructor(t = {}) {
|
|
1490
1490
|
super();
|
|
1491
1491
|
c(this, z);
|
|
1492
1492
|
this.config = t, o(this, z, /* @__PURE__ */ new Map());
|
|
1493
1493
|
}
|
|
1494
1494
|
build(t, s, i) {
|
|
1495
|
-
const n = s.queryKey, a = s.queryHash ??
|
|
1495
|
+
const n = s.queryKey, a = s.queryHash ?? de(n, s);
|
|
1496
1496
|
let h = this.get(a);
|
|
1497
1497
|
return h || (h = new ds({
|
|
1498
1498
|
client: t,
|
|
@@ -1529,12 +1529,12 @@ var z, Ue, ws = (Ue = class extends Kt {
|
|
|
1529
1529
|
find(t) {
|
|
1530
1530
|
const s = { exact: !0, ...t };
|
|
1531
1531
|
return this.getAll().find(
|
|
1532
|
-
(i) =>
|
|
1532
|
+
(i) => ge(s, i)
|
|
1533
1533
|
);
|
|
1534
1534
|
}
|
|
1535
1535
|
findAll(t = {}) {
|
|
1536
1536
|
const s = this.getAll();
|
|
1537
|
-
return Object.keys(t).length > 0 ? s.filter((i) =>
|
|
1537
|
+
return Object.keys(t).length > 0 ? s.filter((i) => ge(t, i)) : s;
|
|
1538
1538
|
}
|
|
1539
1539
|
notify(t) {
|
|
1540
1540
|
T.batch(() => {
|
|
@@ -1557,34 +1557,34 @@ var z, Ue, ws = (Ue = class extends Kt {
|
|
|
1557
1557
|
});
|
|
1558
1558
|
});
|
|
1559
1559
|
}
|
|
1560
|
-
}, z = new WeakMap(),
|
|
1560
|
+
}, z = new WeakMap(), je), F, nt, at, Dt, Tt, ot, It, qt, Ne, Ss = (Ne = class {
|
|
1561
1561
|
constructor(e = {}) {
|
|
1562
1562
|
c(this, F);
|
|
1563
|
-
c(this, it);
|
|
1564
1563
|
c(this, nt);
|
|
1565
|
-
c(this, Qt);
|
|
1566
|
-
c(this, Dt);
|
|
1567
1564
|
c(this, at);
|
|
1565
|
+
c(this, Dt);
|
|
1568
1566
|
c(this, Tt);
|
|
1567
|
+
c(this, ot);
|
|
1569
1568
|
c(this, It);
|
|
1570
|
-
|
|
1569
|
+
c(this, qt);
|
|
1570
|
+
o(this, F, e.queryCache || new ws()), o(this, nt, e.mutationCache || new bs()), o(this, at, e.defaultOptions || {}), o(this, Dt, /* @__PURE__ */ new Map()), o(this, Tt, /* @__PURE__ */ new Map()), o(this, ot, 0);
|
|
1571
1571
|
}
|
|
1572
1572
|
mount() {
|
|
1573
|
-
|
|
1573
|
+
Gt(this, ot)._++, r(this, ot) === 1 && (o(this, It, fe.subscribe(async (e) => {
|
|
1574
1574
|
e && (await this.resumePausedMutations(), r(this, F).onFocus());
|
|
1575
|
-
})), o(this,
|
|
1575
|
+
})), o(this, qt, Wt.subscribe(async (e) => {
|
|
1576
1576
|
e && (await this.resumePausedMutations(), r(this, F).onOnline());
|
|
1577
1577
|
})));
|
|
1578
1578
|
}
|
|
1579
1579
|
unmount() {
|
|
1580
1580
|
var e, t;
|
|
1581
|
-
|
|
1581
|
+
Gt(this, ot)._--, r(this, ot) === 0 && ((e = r(this, It)) == null || e.call(this), o(this, It, void 0), (t = r(this, qt)) == null || t.call(this), o(this, qt, void 0));
|
|
1582
1582
|
}
|
|
1583
1583
|
isFetching(e) {
|
|
1584
1584
|
return r(this, F).findAll({ ...e, fetchStatus: "fetching" }).length;
|
|
1585
1585
|
}
|
|
1586
1586
|
isMutating(e) {
|
|
1587
|
-
return r(this,
|
|
1587
|
+
return r(this, nt).findAll({ ...e, status: "pending" }).length;
|
|
1588
1588
|
}
|
|
1589
1589
|
/**
|
|
1590
1590
|
* Imperative (non-reactive) way to retrieve data for a QueryKey.
|
|
@@ -1600,7 +1600,7 @@ var z, Ue, ws = (Ue = class extends Kt {
|
|
|
1600
1600
|
}
|
|
1601
1601
|
ensureQueryData(e) {
|
|
1602
1602
|
const t = this.defaultQueryOptions(e), s = r(this, F).build(this, t), i = s.state.data;
|
|
1603
|
-
return i === void 0 ? this.fetchQuery(e) : (e.revalidateIfStale && s.isStaleByTime(
|
|
1603
|
+
return i === void 0 ? this.fetchQuery(e) : (e.revalidateIfStale && s.isStaleByTime(ut(t.staleTime, s)) && this.prefetchQuery(t), Promise.resolve(i));
|
|
1604
1604
|
}
|
|
1605
1605
|
getQueriesData(e) {
|
|
1606
1606
|
return r(this, F).findAll(e).map(({ queryKey: t, state: s }) => {
|
|
@@ -1684,100 +1684,100 @@ var z, Ue, ws = (Ue = class extends Kt {
|
|
|
1684
1684
|
t.retry === void 0 && (t.retry = !1);
|
|
1685
1685
|
const s = r(this, F).build(this, t);
|
|
1686
1686
|
return s.isStaleByTime(
|
|
1687
|
-
|
|
1687
|
+
ut(t.staleTime, s)
|
|
1688
1688
|
) ? s.fetch(t) : Promise.resolve(s.state.data);
|
|
1689
1689
|
}
|
|
1690
1690
|
prefetchQuery(e) {
|
|
1691
1691
|
return this.fetchQuery(e).then(j).catch(j);
|
|
1692
1692
|
}
|
|
1693
1693
|
fetchInfiniteQuery(e) {
|
|
1694
|
-
return e.behavior =
|
|
1694
|
+
return e.behavior = Fe(e.pages), this.fetchQuery(e);
|
|
1695
1695
|
}
|
|
1696
1696
|
prefetchInfiniteQuery(e) {
|
|
1697
1697
|
return this.fetchInfiniteQuery(e).then(j).catch(j);
|
|
1698
1698
|
}
|
|
1699
1699
|
ensureInfiniteQueryData(e) {
|
|
1700
|
-
return e.behavior =
|
|
1700
|
+
return e.behavior = Fe(e.pages), this.ensureQueryData(e);
|
|
1701
1701
|
}
|
|
1702
1702
|
resumePausedMutations() {
|
|
1703
|
-
return
|
|
1703
|
+
return Wt.isOnline() ? r(this, nt).resumePausedMutations() : Promise.resolve();
|
|
1704
1704
|
}
|
|
1705
1705
|
getQueryCache() {
|
|
1706
1706
|
return r(this, F);
|
|
1707
1707
|
}
|
|
1708
1708
|
getMutationCache() {
|
|
1709
|
-
return r(this,
|
|
1709
|
+
return r(this, nt);
|
|
1710
1710
|
}
|
|
1711
1711
|
getDefaultOptions() {
|
|
1712
|
-
return r(this,
|
|
1712
|
+
return r(this, at);
|
|
1713
1713
|
}
|
|
1714
1714
|
setDefaultOptions(e) {
|
|
1715
|
-
o(this,
|
|
1715
|
+
o(this, at, e);
|
|
1716
1716
|
}
|
|
1717
1717
|
setQueryDefaults(e, t) {
|
|
1718
|
-
r(this,
|
|
1718
|
+
r(this, Dt).set(xt(e), {
|
|
1719
1719
|
queryKey: e,
|
|
1720
1720
|
defaultOptions: t
|
|
1721
1721
|
});
|
|
1722
1722
|
}
|
|
1723
1723
|
getQueryDefaults(e) {
|
|
1724
|
-
const t = [...r(this,
|
|
1724
|
+
const t = [...r(this, Dt).values()], s = {};
|
|
1725
1725
|
return t.forEach((i) => {
|
|
1726
|
-
|
|
1726
|
+
Ut(e, i.queryKey) && Object.assign(s, i.defaultOptions);
|
|
1727
1727
|
}), s;
|
|
1728
1728
|
}
|
|
1729
1729
|
setMutationDefaults(e, t) {
|
|
1730
|
-
r(this,
|
|
1730
|
+
r(this, Tt).set(xt(e), {
|
|
1731
1731
|
mutationKey: e,
|
|
1732
1732
|
defaultOptions: t
|
|
1733
1733
|
});
|
|
1734
1734
|
}
|
|
1735
1735
|
getMutationDefaults(e) {
|
|
1736
|
-
const t = [...r(this,
|
|
1736
|
+
const t = [...r(this, Tt).values()], s = {};
|
|
1737
1737
|
return t.forEach((i) => {
|
|
1738
|
-
|
|
1738
|
+
Ut(e, i.mutationKey) && Object.assign(s, i.defaultOptions);
|
|
1739
1739
|
}), s;
|
|
1740
1740
|
}
|
|
1741
1741
|
defaultQueryOptions(e) {
|
|
1742
1742
|
if (e._defaulted)
|
|
1743
1743
|
return e;
|
|
1744
1744
|
const t = {
|
|
1745
|
-
...r(this,
|
|
1745
|
+
...r(this, at).queries,
|
|
1746
1746
|
...this.getQueryDefaults(e.queryKey),
|
|
1747
1747
|
...e,
|
|
1748
1748
|
_defaulted: !0
|
|
1749
1749
|
};
|
|
1750
|
-
return t.queryHash || (t.queryHash =
|
|
1750
|
+
return t.queryHash || (t.queryHash = de(
|
|
1751
1751
|
t.queryKey,
|
|
1752
1752
|
t
|
|
1753
|
-
)), t.refetchOnReconnect === void 0 && (t.refetchOnReconnect = t.networkMode !== "always"), t.throwOnError === void 0 && (t.throwOnError = !!t.suspense), !t.networkMode && t.persister && (t.networkMode = "offlineFirst"), t.queryFn ===
|
|
1753
|
+
)), t.refetchOnReconnect === void 0 && (t.refetchOnReconnect = t.networkMode !== "always"), t.throwOnError === void 0 && (t.throwOnError = !!t.suspense), !t.networkMode && t.persister && (t.networkMode = "offlineFirst"), t.queryFn === $t && (t.enabled = !1), t;
|
|
1754
1754
|
}
|
|
1755
1755
|
defaultMutationOptions(e) {
|
|
1756
1756
|
return e != null && e._defaulted ? e : {
|
|
1757
|
-
...r(this,
|
|
1757
|
+
...r(this, at).mutations,
|
|
1758
1758
|
...(e == null ? void 0 : e.mutationKey) && this.getMutationDefaults(e.mutationKey),
|
|
1759
1759
|
...e,
|
|
1760
1760
|
_defaulted: !0
|
|
1761
1761
|
};
|
|
1762
1762
|
}
|
|
1763
1763
|
clear() {
|
|
1764
|
-
r(this, F).clear(), r(this,
|
|
1764
|
+
r(this, F).clear(), r(this, nt).clear();
|
|
1765
1765
|
}
|
|
1766
|
-
}, F = new WeakMap(),
|
|
1766
|
+
}, F = new WeakMap(), nt = new WeakMap(), at = new WeakMap(), Dt = new WeakMap(), Tt = new WeakMap(), ot = new WeakMap(), It = new WeakMap(), qt = new WeakMap(), Ne), Ve = L.createContext(
|
|
1767
1767
|
void 0
|
|
1768
|
-
),
|
|
1769
|
-
const t =
|
|
1768
|
+
), Cs = (e) => {
|
|
1769
|
+
const t = L.useContext(Ve);
|
|
1770
1770
|
if (!t)
|
|
1771
1771
|
throw new Error("No QueryClient set, use QueryClientProvider to set one");
|
|
1772
1772
|
return t;
|
|
1773
1773
|
}, Os = ({
|
|
1774
1774
|
client: e,
|
|
1775
1775
|
children: t
|
|
1776
|
-
}) => (
|
|
1776
|
+
}) => (L.useEffect(() => (e.mount(), () => {
|
|
1777
1777
|
e.unmount();
|
|
1778
|
-
}), [e]), /* @__PURE__ */
|
|
1779
|
-
|
|
1780
|
-
function
|
|
1778
|
+
}), [e]), /* @__PURE__ */ zt(Ve.Provider, { value: e, children: t })), ze = L.createContext(!1), Es = () => L.useContext(ze);
|
|
1779
|
+
ze.Provider;
|
|
1780
|
+
function Ps() {
|
|
1781
1781
|
let e = !1;
|
|
1782
1782
|
return {
|
|
1783
1783
|
clearReset: () => {
|
|
@@ -1789,10 +1789,10 @@ function Es() {
|
|
|
1789
1789
|
isReset: () => e
|
|
1790
1790
|
};
|
|
1791
1791
|
}
|
|
1792
|
-
var Fs =
|
|
1792
|
+
var Fs = L.createContext(Ps()), Rs = () => L.useContext(Fs), Ms = (e, t) => {
|
|
1793
1793
|
(e.suspense || e.throwOnError || e.experimental_prefetchInRender) && (t.isReset() || (e.retryOnMount = !1));
|
|
1794
1794
|
}, Qs = (e) => {
|
|
1795
|
-
|
|
1795
|
+
L.useEffect(() => {
|
|
1796
1796
|
e.clearReset();
|
|
1797
1797
|
}, [e]);
|
|
1798
1798
|
}, Ds = ({
|
|
@@ -1809,42 +1809,42 @@ var Fs = K.createContext(Es()), Rs = () => K.useContext(Fs), Ms = (e, t) => {
|
|
|
1809
1809
|
1e3
|
|
1810
1810
|
));
|
|
1811
1811
|
}
|
|
1812
|
-
}, Is = (e, t) => e.isLoading && e.isFetching && !t, qs = (e, t) => (e == null ? void 0 : e.suspense) && t.isPending,
|
|
1812
|
+
}, Is = (e, t) => e.isLoading && e.isFetching && !t, qs = (e, t) => (e == null ? void 0 : e.suspense) && t.isPending, Me = (e, t, s) => t.fetchOptimistic(e).catch(() => {
|
|
1813
1813
|
s.clearReset();
|
|
1814
1814
|
});
|
|
1815
1815
|
function As(e, t, s) {
|
|
1816
|
-
var f,
|
|
1816
|
+
var f, C, y, R, m;
|
|
1817
1817
|
if (process.env.NODE_ENV !== "production" && (typeof e != "object" || Array.isArray(e)))
|
|
1818
1818
|
throw new Error(
|
|
1819
1819
|
'Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object'
|
|
1820
1820
|
);
|
|
1821
|
-
const i =
|
|
1822
|
-
(
|
|
1821
|
+
const i = Es(), n = Rs(), a = Cs(), h = a.defaultQueryOptions(e);
|
|
1822
|
+
(C = (f = a.getDefaultOptions().queries) == null ? void 0 : f._experimental_beforeQuery) == null || C.call(
|
|
1823
1823
|
f,
|
|
1824
1824
|
h
|
|
1825
1825
|
), process.env.NODE_ENV !== "production" && (h.queryFn || console.error(
|
|
1826
1826
|
`[${h.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`
|
|
1827
1827
|
)), h._optimisticResults = i ? "isRestoring" : "optimistic", Ts(h), Ms(h, n), Qs(n);
|
|
1828
|
-
const u = !a.getQueryCache().get(h.queryHash), [d] =
|
|
1828
|
+
const u = !a.getQueryCache().get(h.queryHash), [d] = L.useState(
|
|
1829
1829
|
() => new t(
|
|
1830
1830
|
a,
|
|
1831
1831
|
h
|
|
1832
1832
|
)
|
|
1833
|
-
), b = d.getOptimisticResult(h),
|
|
1834
|
-
if (
|
|
1835
|
-
|
|
1836
|
-
(
|
|
1837
|
-
const
|
|
1838
|
-
return d.updateResult(),
|
|
1833
|
+
), b = d.getOptimisticResult(h), E = !i && e.subscribed !== !1;
|
|
1834
|
+
if (L.useSyncExternalStore(
|
|
1835
|
+
L.useCallback(
|
|
1836
|
+
(p) => {
|
|
1837
|
+
const O = E ? d.subscribe(T.batchCalls(p)) : j;
|
|
1838
|
+
return d.updateResult(), O;
|
|
1839
1839
|
},
|
|
1840
|
-
[d,
|
|
1840
|
+
[d, E]
|
|
1841
1841
|
),
|
|
1842
1842
|
() => d.getCurrentResult(),
|
|
1843
1843
|
() => d.getCurrentResult()
|
|
1844
|
-
),
|
|
1844
|
+
), L.useEffect(() => {
|
|
1845
1845
|
d.setOptions(h);
|
|
1846
1846
|
}, [h, d]), qs(h, b))
|
|
1847
|
-
throw
|
|
1847
|
+
throw Me(h, d, n);
|
|
1848
1848
|
if (Ds({
|
|
1849
1849
|
result: b,
|
|
1850
1850
|
errorResetBoundary: n,
|
|
@@ -1857,15 +1857,15 @@ function As(e, t, s) {
|
|
|
1857
1857
|
y,
|
|
1858
1858
|
h,
|
|
1859
1859
|
b
|
|
1860
|
-
), h.experimental_prefetchInRender && !
|
|
1861
|
-
const
|
|
1860
|
+
), h.experimental_prefetchInRender && !wt && Is(b, i)) {
|
|
1861
|
+
const p = u ? (
|
|
1862
1862
|
// Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted
|
|
1863
|
-
|
|
1863
|
+
Me(h, d, n)
|
|
1864
1864
|
) : (
|
|
1865
1865
|
// subscribe to the "cache promise" so that we can finalize the currentThenable once data comes in
|
|
1866
|
-
(
|
|
1866
|
+
(m = a.getQueryCache().get(h.queryHash)) == null ? void 0 : m.promise
|
|
1867
1867
|
);
|
|
1868
|
-
|
|
1868
|
+
p == null || p.catch(j).finally(() => {
|
|
1869
1869
|
d.updateResult();
|
|
1870
1870
|
});
|
|
1871
1871
|
}
|
|
@@ -1874,7 +1874,7 @@ function As(e, t, s) {
|
|
|
1874
1874
|
function xs(e, t) {
|
|
1875
1875
|
return As(e, fs);
|
|
1876
1876
|
}
|
|
1877
|
-
const Us =
|
|
1877
|
+
const Us = $e(void 0), js = new Ss({
|
|
1878
1878
|
defaultOptions: {
|
|
1879
1879
|
queries: {
|
|
1880
1880
|
retry: 1,
|
|
@@ -1891,33 +1891,38 @@ function Ns({
|
|
|
1891
1891
|
handleDateChanged: i = () => !0,
|
|
1892
1892
|
children: n
|
|
1893
1893
|
}) {
|
|
1894
|
-
const [a, h] =
|
|
1895
|
-
|
|
1896
|
-
const
|
|
1897
|
-
const
|
|
1898
|
-
|
|
1899
|
-
}, [i]), { data: f, isLoading:
|
|
1900
|
-
queryKey: ["schedule",
|
|
1894
|
+
const [a, h] = me(s[0][0].date), [u, d] = me(!1), b = We(Bt(s[0][0].date, "yyyy-MM-dd"));
|
|
1895
|
+
Y.setComponent("ScheduleContext"), Y.log("fetchSchedule:", e);
|
|
1896
|
+
const E = Je((p) => {
|
|
1897
|
+
const O = Bt(p, "yyyy-MM-dd");
|
|
1898
|
+
O !== b.current && (d(!0), b.current = O), h(p), i(p);
|
|
1899
|
+
}, [i]), { data: f, isLoading: C, isError: y, error: R } = xs({
|
|
1900
|
+
queryKey: ["schedule", Bt(a, "yyyy-MM-dd")],
|
|
1901
1901
|
queryFn: () => e(a),
|
|
1902
1902
|
staleTime: 1e3 * 60 * 15,
|
|
1903
1903
|
// 15 minutes
|
|
1904
1904
|
retry: 1
|
|
1905
1905
|
});
|
|
1906
|
-
|
|
1907
|
-
f !== void 0 && u && d(!1);
|
|
1908
|
-
}, [f, u])
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1906
|
+
Y.log("useQuery result - data:", f, "isLoading:", C, "currentDate:", Bt(a, "yyyy-MM-dd")), ve(() => {
|
|
1907
|
+
f !== void 0 && u && (d(!1), Y.log("Schedule data loaded, ending transition state. Data:", f));
|
|
1908
|
+
}, [f, u]), ve(() => {
|
|
1909
|
+
y && (Y.log("Error fetching schedule for date:", a), Y.log("Error detials: ", R)), Y.log("ScheduleContext currentDate changed to:", a);
|
|
1910
|
+
}, [a, y, R]);
|
|
1911
|
+
const m = Ze(() => {
|
|
1912
|
+
const p = f ?? t;
|
|
1913
|
+
return Y.log("useMemo recalculating - data:", f, "initialSchedule:", t, "resulting schedule:", p), {
|
|
1914
|
+
schedule: p,
|
|
1915
|
+
weeks: s,
|
|
1916
|
+
currentDate: a,
|
|
1917
|
+
isLoading: C || u,
|
|
1918
|
+
isError: y,
|
|
1919
|
+
setCurrentDate: E
|
|
1920
|
+
};
|
|
1921
|
+
}, [f, t, s, a, C, u, y, E]);
|
|
1922
|
+
return /* @__PURE__ */ zt(Us.Provider, { value: m, children: n });
|
|
1918
1923
|
}
|
|
1919
1924
|
function Gs(e) {
|
|
1920
|
-
return /* @__PURE__ */
|
|
1925
|
+
return /* @__PURE__ */ zt(Os, { client: js, children: /* @__PURE__ */ zt(Ns, { ...e }) });
|
|
1921
1926
|
}
|
|
1922
1927
|
export {
|
|
1923
1928
|
Us as ScheduleContext,
|