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