@scrippsproduct/networks-ui-library 1.1.9 → 1.1.10-alpha.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/{Form.module-Cd8qH2rj.mjs → Form.module-CarfWK5T.mjs} +1 -1
- package/dist/ResultsTable.module-wcNUQEKe.mjs +14 -0
- package/dist/_commonjsHelpers-DaMA6jEr.mjs +8 -0
- package/dist/assets/ResultsTable.css +1 -1
- package/dist/{chevron-left-DRvpaLmK.mjs → chevron-left-D0UjbrKw.mjs} +1 -1
- package/dist/{chevron-right-C8yCnmfx.mjs → chevron-right-0ZF3LruR.mjs} +1 -1
- package/dist/components/ActionButton/ActionButton.test.js +209 -0
- package/dist/components/AdBlock/AdBlock.test.js +286 -0
- package/dist/components/AdjustableTwoColumnGrid/AdjustableTwoColumnGrid.test.js +295 -0
- package/dist/components/AirDateFormatter/AirDateFormatter.test.js +192 -0
- package/dist/components/AnchorTag/AnchorTag.test.js +463 -0
- package/dist/components/BCVideoPlayer/BCVideoPlayer.test.js +295 -0
- package/dist/components/BasicGridModule/BasicGridModule.js +41 -37
- package/dist/components/BasicGridModule/BasicGridModule.test.js +227 -0
- package/dist/components/Button/Button.test.js +434 -0
- package/dist/components/Carousel/Carousel.js +2 -2
- package/dist/components/Carousel/Carousel.test.js +705 -0
- package/dist/components/CarouselSlide/CarouselSlide.test.js +378 -0
- package/dist/components/CarouselSlide/slide-layouts/TwoColumn/TwoColumnSlide.js +1 -1
- package/dist/components/CastInfoLayout/CastInfoLayout.test.js +294 -0
- package/dist/components/ChannelSearch/ChannelSearch.test.js +565 -0
- package/dist/components/ChoicesItem/ChoicesItem.test.js +428 -0
- package/dist/components/Concat/Concat.js +1 -1
- package/dist/components/Concat/Concat.test.js +115 -0
- package/dist/components/CtaBlock/CtaBlock.js +1 -1
- package/dist/components/CtaBlock/CtaBlock.test.js +226 -0
- package/dist/components/CustomDataList/CustomDataList.js +4 -4
- package/dist/components/CustomSelect/CustomSelect.js +86 -86
- package/dist/components/CustomSelect/CustomSelect.test.js +313 -0
- package/dist/components/DateNavigation/DateNavigation.js +10 -10
- package/dist/components/DateNavigation/DateNavigation.test.js +370 -0
- package/dist/components/DatePicker/DatePicker.js +1 -1
- package/dist/components/DeviceAndPlatformLists/DeviceAndPlatformLists.test.js +288 -0
- package/dist/components/DrawerNavigation/DrawerNavigation.test.js +316 -0
- package/dist/components/EqualSizeFlexRow/EqualSizeFlexRow.test.js +337 -0
- package/dist/components/EqualSizeGrid/EqualSizeGrid.test.js +358 -0
- package/dist/components/ErrorHandler/ErrorHandler.js +2 -2
- package/dist/components/ErrorHandler/ErrorHandler.test.js +158 -0
- package/dist/components/FeaturedList/FeaturedList.test.js +353 -0
- package/dist/components/Figure/Figure.js +1 -1
- package/dist/components/Figure/Figure.test.js +198 -0
- package/dist/components/FindUs/FindUs.test.js +499 -0
- package/dist/components/FooterNavigation/FooterNavigation.test.js +310 -0
- package/dist/components/GenericList/GenericList.js +1 -1
- package/dist/components/GenericList/GenericList.test.js +288 -0
- package/dist/components/GetAirdateWrapper/GetAirdateWrapper.test.js +689 -0
- package/dist/components/GradientButton/GradientButton.d.ts +1 -1
- package/dist/components/GradientButton/GradientButton.js +33 -31
- package/dist/components/GradientButton/GradientButton.test.js +457 -0
- package/dist/components/GridList/GridList.test.js +371 -0
- package/dist/components/ImageCard/ImageCard.test.js +668 -0
- package/dist/components/ImageCard/ImageCardCore.js +28 -28
- package/dist/components/ImageCard/ImageCardCore.test.js +577 -0
- package/dist/components/ImageReplacementAnchor/ImageReplacementAnchor.test.js +379 -0
- package/dist/components/InfoPanel/InfoPanel.js +1 -1
- package/dist/components/InlineNavigation/InlineNavigation.test.js +149 -0
- package/dist/components/Input/Input.js +1 -1
- package/dist/components/Input/Input.test.js +263 -0
- package/dist/components/InstructionsList/InstructionsList.js +11 -11
- package/dist/components/InstructionsList/InstructionsList.test.js +181 -0
- package/dist/components/LogoListItem/LogoListItem.test.js +303 -0
- package/dist/components/LogoNavigation/LogoNavigation.test.js +352 -0
- package/dist/components/ModalContainer/ModalContainer.js +2 -2
- package/dist/components/NavList/NavList.test.js +332 -0
- package/dist/components/Overlay/Overlay.js +24 -23
- package/dist/components/Overlay/Overlay.test.js +198 -0
- package/dist/components/PageHero/PageHero.test.js +241 -0
- package/dist/components/PageHero/page-hero-layouts/IONShow/IONShowHero.js +1 -1
- package/dist/components/ProgramAirdate/ProgramAirdate.js +1 -1
- package/dist/components/ProgramAirdate/ProgramAirdate.test.js +414 -0
- package/dist/components/PromotionBlock/PromotionBlock.test.js +208 -0
- package/dist/components/PromotionsRowBlock/PromotionsRowBlock.test.js +221 -0
- package/dist/components/PromotionsRowModule/PromotionsRowModule.test.js +349 -0
- package/dist/components/RescanInstructions/RescanInstructions.test.js +218 -0
- package/dist/components/ResponsiveImage/ResponsiveImage.test.js +264 -0
- package/dist/components/ResultsTable/ResultsTable.js +9 -2
- package/dist/components/ResultsTable/ResultsTable.test.js +402 -0
- package/dist/components/ResultsTableBody/ResultsTableBody.js +1 -1
- package/dist/components/ResultsTableBody/ResultsTableBody.test.js +445 -0
- package/dist/components/ResultsTableHeader/ResultsTableHeader.js +37 -15
- package/dist/components/ResultsTableHeader/ResultsTableHeader.test.js +275 -0
- package/dist/components/ScheduleLayout/ScheduleContext.js +654 -626
- package/dist/components/ScheduleLayout/ScheduleLayout.js +1 -1
- package/dist/components/ScheduleLayout/useScheduleContext.js +5 -10
- package/dist/components/ScheduleList/ScheduleList.js +1 -1
- package/dist/components/SectionedContent/SectionedContent.js +1 -1
- package/dist/components/SectionedContent/SectionedContent.test.js +341 -0
- package/dist/components/Select/Select.js +24 -24
- package/dist/components/Select/Select.test.js +367 -0
- package/dist/components/ShowAboutContent/ShowAboutContent.js +1 -1
- package/dist/components/ShowAboutContent/ShowAboutContent.test.js +535 -0
- package/dist/components/ShowAboutLayout/ShowAboutLayout.test.js +570 -0
- package/dist/components/SocialLinks/SocialLinks.js +1 -1
- package/dist/components/StringList/StringList.js +1 -1
- package/dist/components/StringList/StringList.test.js +311 -0
- package/dist/components/TabContent/TabContent.js +1 -1
- package/dist/components/TabContent/TabContent.test.js +274 -0
- package/dist/components/TabNavigation/TabNavigation.js +21 -21
- package/dist/components/TabNavigation/TabNavigation.test.js +535 -0
- package/dist/components/TabbedContent/TabbedContent.test.js +654 -0
- package/dist/components/TextArea/TextArea.js +1 -1
- package/dist/components/UpcomingList/UpcomingList.test.js +471 -0
- package/dist/{index-VjANCDXC.mjs → index-06PEPfBQ.mjs} +1 -1
- package/dist/index-BUN4jQ3m.mjs +3098 -0
- package/dist/index-BVxBrkZB.mjs +3 -0
- package/dist/{index-DC2JJV3a.mjs → index-D3kkcgee.mjs} +1 -1
- package/dist/{index-C-kn9Zhn.mjs → index-DzfYkULW.mjs} +2 -1
- package/dist/magic-string.es-uPKorP4O.mjs +663 -0
- package/dist/matchers-35e4d3bd-BBPNTlen.mjs +2404 -0
- package/dist/react.esm-DLSrfVwM.mjs +23410 -0
- package/dist/test/setupTests.d.ts +1 -0
- package/dist/test/setupTests.js +55 -0
- package/dist/{triangle-PcCcGXjr.mjs → triangle-C4z906Wf.mjs} +1 -1
- package/dist/useScheduleContext-D7FdzNxe.mjs +17 -0
- package/dist/utils/analytics.js +1 -1
- package/dist/utils/getOnNowProgram.js +10 -10
- package/dist/{x-C-QzJ-qD.mjs → x-Ck9Vk5Fo.mjs} +1 -1
- package/package.json +4 -1
- package/dist/ResultsTable.module-1zxhXaem.mjs +0 -14
- package/dist/_commonjsHelpers-C6fGbg64.mjs +0 -6
|
@@ -2,18 +2,18 @@ var pe = (e) => {
|
|
|
2
2
|
throw TypeError(e);
|
|
3
3
|
};
|
|
4
4
|
var Wt = (e, t, s) => t.has(e) || pe("Cannot " + s);
|
|
5
|
-
var
|
|
6
|
-
var Ht = (e, t, s,
|
|
5
|
+
var i = (e, t, s) => (Wt(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, r) => (Wt(e, t, "write to private field"), r ? r.call(e, s) : t.set(e, s), s), v = (e, t, s) => (Wt(e, t, "access private method"), s);
|
|
6
|
+
var Ht = (e, t, s, r) => ({
|
|
7
7
|
set _(n) {
|
|
8
8
|
o(e, t, n, s);
|
|
9
9
|
},
|
|
10
10
|
get _() {
|
|
11
|
-
return
|
|
11
|
+
return i(e, t, r);
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
14
|
import { jsx as Vt } from "react/jsx-runtime";
|
|
15
15
|
import * as K from "react";
|
|
16
|
-
import { createContext as
|
|
16
|
+
import { createContext as We, useState as me, useRef as Je, useCallback as Ze, useEffect as ve, useMemo as Xe } from "react";
|
|
17
17
|
import { f as Jt } from "../../format-YhWt2D8M.mjs";
|
|
18
18
|
import { l as Gt } from "../../logger-C0N7U0YY.mjs";
|
|
19
19
|
var Kt = class {
|
|
@@ -32,7 +32,7 @@ var Kt = class {
|
|
|
32
32
|
}
|
|
33
33
|
onUnsubscribe() {
|
|
34
34
|
}
|
|
35
|
-
},
|
|
35
|
+
}, Ye = {
|
|
36
36
|
// We need the wrapper function syntax below instead of direct references to
|
|
37
37
|
// global setTimeout etc.
|
|
38
38
|
//
|
|
@@ -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, ht, Qe,
|
|
50
|
+
}, G, ht, Qe, ts = (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
|
|
@@ -55,35 +55,35 @@ var Kt = class {
|
|
|
55
55
|
//
|
|
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
|
-
c(this, G,
|
|
58
|
+
c(this, G, Ye);
|
|
59
59
|
c(this, ht, !1);
|
|
60
60
|
}
|
|
61
61
|
setTimeoutProvider(e) {
|
|
62
|
-
process.env.NODE_ENV !== "production" &&
|
|
62
|
+
process.env.NODE_ENV !== "production" && i(this, ht) && e !== i(this, G) && console.error(
|
|
63
63
|
"[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",
|
|
64
|
-
{ previous:
|
|
64
|
+
{ previous: i(this, G), provider: e }
|
|
65
65
|
), o(this, G, e), process.env.NODE_ENV !== "production" && o(this, ht, !1);
|
|
66
66
|
}
|
|
67
67
|
setTimeout(e, t) {
|
|
68
|
-
return process.env.NODE_ENV !== "production" && o(this, ht, !0),
|
|
68
|
+
return process.env.NODE_ENV !== "production" && o(this, ht, !0), i(this, G).setTimeout(e, t);
|
|
69
69
|
}
|
|
70
70
|
clearTimeout(e) {
|
|
71
|
-
|
|
71
|
+
i(this, G).clearTimeout(e);
|
|
72
72
|
}
|
|
73
73
|
setInterval(e, t) {
|
|
74
|
-
return process.env.NODE_ENV !== "production" && o(this, ht, !0),
|
|
74
|
+
return process.env.NODE_ENV !== "production" && o(this, ht, !0), i(this, G).setInterval(e, t);
|
|
75
75
|
}
|
|
76
76
|
clearInterval(e) {
|
|
77
|
-
|
|
77
|
+
i(this, G).clearInterval(e);
|
|
78
78
|
}
|
|
79
|
-
}, G = new WeakMap(), ht = new WeakMap(), Qe), ut = new
|
|
80
|
-
function
|
|
79
|
+
}, G = new WeakMap(), ht = new WeakMap(), Qe), ut = new ts();
|
|
80
|
+
function es(e) {
|
|
81
81
|
setTimeout(e, 0);
|
|
82
82
|
}
|
|
83
83
|
var bt = typeof window > "u" || "Deno" in globalThis;
|
|
84
|
-
function
|
|
84
|
+
function N() {
|
|
85
85
|
}
|
|
86
|
-
function
|
|
86
|
+
function ss(e, t) {
|
|
87
87
|
return typeof e == "function" ? e(t) : e;
|
|
88
88
|
}
|
|
89
89
|
function Zt(e) {
|
|
@@ -101,73 +101,73 @@ function k(e, t) {
|
|
|
101
101
|
function ge(e, t) {
|
|
102
102
|
const {
|
|
103
103
|
type: s = "all",
|
|
104
|
-
exact:
|
|
104
|
+
exact: r,
|
|
105
105
|
fetchStatus: n,
|
|
106
106
|
predicate: a,
|
|
107
107
|
queryKey: h,
|
|
108
108
|
stale: u
|
|
109
109
|
} = e;
|
|
110
110
|
if (h) {
|
|
111
|
-
if (
|
|
111
|
+
if (r) {
|
|
112
112
|
if (t.queryHash !== de(h, t.options))
|
|
113
113
|
return !1;
|
|
114
114
|
} else if (!xt(t.queryKey, h))
|
|
115
115
|
return !1;
|
|
116
116
|
}
|
|
117
117
|
if (s !== "all") {
|
|
118
|
-
const
|
|
119
|
-
if (s === "active" && !
|
|
118
|
+
const f = t.isActive();
|
|
119
|
+
if (s === "active" && !f || s === "inactive" && f)
|
|
120
120
|
return !1;
|
|
121
121
|
}
|
|
122
122
|
return !(typeof u == "boolean" && t.isStale() !== u || n && n !== t.state.fetchStatus || a && !a(t));
|
|
123
123
|
}
|
|
124
124
|
function be(e, t) {
|
|
125
|
-
const { exact: s, status:
|
|
125
|
+
const { exact: s, status: r, 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 (qt(t.options.mutationKey) !== qt(a))
|
|
131
131
|
return !1;
|
|
132
132
|
} else if (!xt(t.options.mutationKey, a))
|
|
133
133
|
return !1;
|
|
134
134
|
}
|
|
135
|
-
return !(
|
|
135
|
+
return !(r && t.state.status !== r || n && !n(t));
|
|
136
136
|
}
|
|
137
137
|
function de(e, t) {
|
|
138
|
-
return ((t == null ? void 0 : t.queryKeyHashFn) ||
|
|
138
|
+
return ((t == null ? void 0 : t.queryKeyHashFn) || qt)(e);
|
|
139
139
|
}
|
|
140
|
-
function
|
|
140
|
+
function qt(e) {
|
|
141
141
|
return JSON.stringify(
|
|
142
142
|
e,
|
|
143
|
-
(t, s) => te(s) ? Object.keys(s).sort().reduce((
|
|
143
|
+
(t, s) => te(s) ? Object.keys(s).sort().reduce((r, n) => (r[n] = s[n], r), {}) : s
|
|
144
144
|
);
|
|
145
145
|
}
|
|
146
146
|
function xt(e, t) {
|
|
147
147
|
return e === t ? !0 : typeof e != typeof t ? !1 : e && t && typeof e == "object" && typeof t == "object" ? Object.keys(t).every((s) => xt(e[s], t[s])) : !1;
|
|
148
148
|
}
|
|
149
|
-
var
|
|
149
|
+
var rs = Object.prototype.hasOwnProperty;
|
|
150
150
|
function Xt(e, t) {
|
|
151
151
|
if (e === t)
|
|
152
152
|
return e;
|
|
153
153
|
const s = we(e) && we(t);
|
|
154
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
|
-
let
|
|
157
|
-
for (let
|
|
158
|
-
const
|
|
159
|
-
if (
|
|
160
|
-
u[
|
|
156
|
+
let f = 0;
|
|
157
|
+
for (let y = 0; y < h; y++) {
|
|
158
|
+
const w = s ? y : a[y], d = e[w], P = t[w];
|
|
159
|
+
if (d === P) {
|
|
160
|
+
u[w] = d, (s ? y < n : rs.call(e, w)) && f++;
|
|
161
161
|
continue;
|
|
162
162
|
}
|
|
163
|
-
if (
|
|
164
|
-
u[
|
|
163
|
+
if (d === null || P === null || typeof d != "object" || typeof P != "object") {
|
|
164
|
+
u[w] = P;
|
|
165
165
|
continue;
|
|
166
166
|
}
|
|
167
|
-
const
|
|
168
|
-
u[
|
|
167
|
+
const p = Xt(d, P);
|
|
168
|
+
u[w] = p, p === d && f++;
|
|
169
169
|
}
|
|
170
|
-
return n === h &&
|
|
170
|
+
return n === h && f === n ? e : u;
|
|
171
171
|
}
|
|
172
172
|
function Yt(e, t) {
|
|
173
173
|
if (!t || Object.keys(e).length !== Object.keys(t).length)
|
|
@@ -181,18 +181,18 @@ function we(e) {
|
|
|
181
181
|
return Array.isArray(e) && e.length === Object.keys(e).length;
|
|
182
182
|
}
|
|
183
183
|
function te(e) {
|
|
184
|
-
if (!
|
|
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
|
-
function
|
|
195
|
+
function is(e) {
|
|
196
196
|
return new Promise((t) => {
|
|
197
197
|
ut.setTimeout(t, e);
|
|
198
198
|
});
|
|
@@ -204,22 +204,22 @@ function ee(e, t, s) {
|
|
|
204
204
|
if (process.env.NODE_ENV !== "production")
|
|
205
205
|
try {
|
|
206
206
|
return Xt(e, t);
|
|
207
|
-
} catch (
|
|
207
|
+
} catch (r) {
|
|
208
208
|
throw console.error(
|
|
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}]: ${
|
|
210
|
-
),
|
|
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}]: ${r}`
|
|
210
|
+
), r;
|
|
211
211
|
}
|
|
212
212
|
return Xt(e, t);
|
|
213
213
|
}
|
|
214
214
|
return t;
|
|
215
215
|
}
|
|
216
|
-
function is(e, t, s = 0) {
|
|
217
|
-
const i = [...e, t];
|
|
218
|
-
return s && i.length > s ? i.slice(1) : i;
|
|
219
|
-
}
|
|
220
216
|
function ns(e, t, s = 0) {
|
|
221
|
-
const
|
|
222
|
-
return s &&
|
|
217
|
+
const r = [...e, t];
|
|
218
|
+
return s && r.length > s ? r.slice(1) : r;
|
|
219
|
+
}
|
|
220
|
+
function as(e, t, s = 0) {
|
|
221
|
+
const r = [t, ...e];
|
|
222
|
+
return s && r.length > s ? r.slice(0, -1) : r;
|
|
223
223
|
}
|
|
224
224
|
var zt = Symbol();
|
|
225
225
|
function ke(e, t) {
|
|
@@ -227,16 +227,23 @@ function ke(e, t) {
|
|
|
227
227
|
`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`
|
|
228
228
|
), !e.queryFn && (t != null && t.initialPromise) ? () => t.initialPromise : !e.queryFn || e.queryFn === zt ? () => Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)) : e.queryFn;
|
|
229
229
|
}
|
|
230
|
-
function
|
|
230
|
+
function Ke(e, t) {
|
|
231
231
|
return typeof e == "function" ? e(...t) : !!e;
|
|
232
232
|
}
|
|
233
|
-
|
|
233
|
+
function os(e, t, s) {
|
|
234
|
+
let r = !1, n;
|
|
235
|
+
return Object.defineProperty(e, "signal", {
|
|
236
|
+
enumerable: !0,
|
|
237
|
+
get: () => (n ?? (n = t()), r || (r = !0, n.aborted ? s() : n.addEventListener("abort", s, { once: !0 })), n)
|
|
238
|
+
}), e;
|
|
239
|
+
}
|
|
240
|
+
var ct, tt, St, De, us = (De = class extends Kt {
|
|
234
241
|
constructor() {
|
|
235
242
|
super();
|
|
236
243
|
c(this, ct);
|
|
237
244
|
c(this, tt);
|
|
238
|
-
c(this,
|
|
239
|
-
o(this,
|
|
245
|
+
c(this, St);
|
|
246
|
+
o(this, St, (t) => {
|
|
240
247
|
if (!bt && window.addEventListener) {
|
|
241
248
|
const s = () => t();
|
|
242
249
|
return window.addEventListener("visibilitychange", s, !1), () => {
|
|
@@ -246,20 +253,20 @@ var ct, tt, Ct, De, os = (De = class extends Kt {
|
|
|
246
253
|
});
|
|
247
254
|
}
|
|
248
255
|
onSubscribe() {
|
|
249
|
-
|
|
256
|
+
i(this, tt) || this.setEventListener(i(this, St));
|
|
250
257
|
}
|
|
251
258
|
onUnsubscribe() {
|
|
252
259
|
var t;
|
|
253
|
-
this.hasListeners() || ((t =
|
|
260
|
+
this.hasListeners() || ((t = i(this, tt)) == null || t.call(this), o(this, tt, void 0));
|
|
254
261
|
}
|
|
255
262
|
setEventListener(t) {
|
|
256
263
|
var s;
|
|
257
|
-
o(this,
|
|
258
|
-
typeof
|
|
264
|
+
o(this, St, t), (s = i(this, tt)) == null || s.call(this), o(this, tt, t((r) => {
|
|
265
|
+
typeof r == "boolean" ? this.setFocused(r) : this.onFocus();
|
|
259
266
|
}));
|
|
260
267
|
}
|
|
261
268
|
setFocused(t) {
|
|
262
|
-
|
|
269
|
+
i(this, ct) !== t && (o(this, ct, t), this.onFocus());
|
|
263
270
|
}
|
|
264
271
|
onFocus() {
|
|
265
272
|
const t = this.isFocused();
|
|
@@ -269,9 +276,9 @@ var ct, tt, Ct, De, os = (De = class extends Kt {
|
|
|
269
276
|
}
|
|
270
277
|
isFocused() {
|
|
271
278
|
var t;
|
|
272
|
-
return typeof
|
|
279
|
+
return typeof i(this, ct) == "boolean" ? i(this, ct) : ((t = globalThis.document) == null ? void 0 : t.visibilityState) !== "hidden";
|
|
273
280
|
}
|
|
274
|
-
}, ct = new WeakMap(), tt = new WeakMap(),
|
|
281
|
+
}, ct = new WeakMap(), tt = new WeakMap(), St = new WeakMap(), De), fe = new us();
|
|
275
282
|
function se() {
|
|
276
283
|
let e, t;
|
|
277
284
|
const s = new Promise((n, a) => {
|
|
@@ -279,28 +286,28 @@ function se() {
|
|
|
279
286
|
});
|
|
280
287
|
s.status = "pending", s.catch(() => {
|
|
281
288
|
});
|
|
282
|
-
function
|
|
289
|
+
function r(n) {
|
|
283
290
|
Object.assign(s, n), delete s.resolve, delete s.reject;
|
|
284
291
|
}
|
|
285
292
|
return s.resolve = (n) => {
|
|
286
|
-
|
|
293
|
+
r({
|
|
287
294
|
status: "fulfilled",
|
|
288
295
|
value: n
|
|
289
296
|
}), e(n);
|
|
290
297
|
}, s.reject = (n) => {
|
|
291
|
-
|
|
298
|
+
r({
|
|
292
299
|
status: "rejected",
|
|
293
300
|
reason: n
|
|
294
301
|
}), t(n);
|
|
295
302
|
}, s;
|
|
296
303
|
}
|
|
297
|
-
var
|
|
298
|
-
function
|
|
304
|
+
var hs = es;
|
|
305
|
+
function cs() {
|
|
299
306
|
let e = [], t = 0, s = (u) => {
|
|
300
307
|
u();
|
|
301
|
-
},
|
|
308
|
+
}, r = (u) => {
|
|
302
309
|
u();
|
|
303
|
-
}, n =
|
|
310
|
+
}, n = hs;
|
|
304
311
|
const a = (u) => {
|
|
305
312
|
t ? e.push(u) : n(() => {
|
|
306
313
|
s(u);
|
|
@@ -308,30 +315,30 @@ function hs() {
|
|
|
308
315
|
}, h = () => {
|
|
309
316
|
const u = e;
|
|
310
317
|
e = [], u.length && n(() => {
|
|
311
|
-
|
|
312
|
-
u.forEach((
|
|
313
|
-
s(
|
|
318
|
+
r(() => {
|
|
319
|
+
u.forEach((f) => {
|
|
320
|
+
s(f);
|
|
314
321
|
});
|
|
315
322
|
});
|
|
316
323
|
});
|
|
317
324
|
};
|
|
318
325
|
return {
|
|
319
326
|
batch: (u) => {
|
|
320
|
-
let
|
|
327
|
+
let f;
|
|
321
328
|
t++;
|
|
322
329
|
try {
|
|
323
|
-
|
|
330
|
+
f = u();
|
|
324
331
|
} finally {
|
|
325
332
|
t--, t || h();
|
|
326
333
|
}
|
|
327
|
-
return
|
|
334
|
+
return f;
|
|
328
335
|
},
|
|
329
336
|
/**
|
|
330
337
|
* All calls to the wrapped function will be batched.
|
|
331
338
|
*/
|
|
332
|
-
batchCalls: (u) => (...
|
|
339
|
+
batchCalls: (u) => (...f) => {
|
|
333
340
|
a(() => {
|
|
334
|
-
u(...
|
|
341
|
+
u(...f);
|
|
335
342
|
});
|
|
336
343
|
},
|
|
337
344
|
schedule: a,
|
|
@@ -347,52 +354,52 @@ function hs() {
|
|
|
347
354
|
* By default React Query will use the batch function provided by ReactDOM or React Native.
|
|
348
355
|
*/
|
|
349
356
|
setBatchNotifyFunction: (u) => {
|
|
350
|
-
|
|
357
|
+
r = u;
|
|
351
358
|
},
|
|
352
359
|
setScheduler: (u) => {
|
|
353
360
|
n = u;
|
|
354
361
|
}
|
|
355
362
|
};
|
|
356
363
|
}
|
|
357
|
-
var
|
|
364
|
+
var I = cs(), Ct, et, Ot, Te, ls = (Te = class extends Kt {
|
|
358
365
|
constructor() {
|
|
359
366
|
super();
|
|
360
|
-
c(this,
|
|
367
|
+
c(this, Ct, !0);
|
|
361
368
|
c(this, et);
|
|
362
369
|
c(this, Ot);
|
|
363
370
|
o(this, Ot, (t) => {
|
|
364
371
|
if (!bt && window.addEventListener) {
|
|
365
|
-
const s = () => t(!0),
|
|
366
|
-
return window.addEventListener("online", s, !1), window.addEventListener("offline",
|
|
367
|
-
window.removeEventListener("online", s), window.removeEventListener("offline",
|
|
372
|
+
const s = () => t(!0), r = () => t(!1);
|
|
373
|
+
return window.addEventListener("online", s, !1), window.addEventListener("offline", r, !1), () => {
|
|
374
|
+
window.removeEventListener("online", s), window.removeEventListener("offline", r);
|
|
368
375
|
};
|
|
369
376
|
}
|
|
370
377
|
});
|
|
371
378
|
}
|
|
372
379
|
onSubscribe() {
|
|
373
|
-
|
|
380
|
+
i(this, et) || this.setEventListener(i(this, Ot));
|
|
374
381
|
}
|
|
375
382
|
onUnsubscribe() {
|
|
376
383
|
var t;
|
|
377
|
-
this.hasListeners() || ((t =
|
|
384
|
+
this.hasListeners() || ((t = i(this, et)) == null || t.call(this), o(this, et, void 0));
|
|
378
385
|
}
|
|
379
386
|
setEventListener(t) {
|
|
380
387
|
var s;
|
|
381
|
-
o(this, Ot, t), (s =
|
|
388
|
+
o(this, Ot, t), (s = i(this, et)) == null || s.call(this), o(this, et, t(this.setOnline.bind(this)));
|
|
382
389
|
}
|
|
383
390
|
setOnline(t) {
|
|
384
|
-
|
|
385
|
-
|
|
391
|
+
i(this, Ct) !== t && (o(this, Ct, t), this.listeners.forEach((r) => {
|
|
392
|
+
r(t);
|
|
386
393
|
}));
|
|
387
394
|
}
|
|
388
395
|
isOnline() {
|
|
389
|
-
return
|
|
396
|
+
return i(this, Ct);
|
|
390
397
|
}
|
|
391
|
-
},
|
|
392
|
-
function
|
|
398
|
+
}, Ct = new WeakMap(), et = new WeakMap(), Ot = new WeakMap(), Te), $t = new ls();
|
|
399
|
+
function ds(e) {
|
|
393
400
|
return Math.min(1e3 * 2 ** e, 3e4);
|
|
394
401
|
}
|
|
395
|
-
function
|
|
402
|
+
function Le(e) {
|
|
396
403
|
return (e ?? "online") === "online" ? $t.isOnline() : !0;
|
|
397
404
|
}
|
|
398
405
|
var re = class extends Error {
|
|
@@ -400,51 +407,51 @@ var re = class extends Error {
|
|
|
400
407
|
super("CancelledError"), this.revert = e == null ? void 0 : e.revert, this.silent = e == null ? void 0 : e.silent;
|
|
401
408
|
}
|
|
402
409
|
};
|
|
403
|
-
function
|
|
404
|
-
let t = !1, s = 0,
|
|
405
|
-
const n = se(), a = () => n.status !== "pending", h = (
|
|
406
|
-
var
|
|
410
|
+
function He(e) {
|
|
411
|
+
let t = !1, s = 0, r;
|
|
412
|
+
const n = se(), a = () => n.status !== "pending", h = (m) => {
|
|
413
|
+
var b;
|
|
407
414
|
if (!a()) {
|
|
408
|
-
const
|
|
409
|
-
P(
|
|
415
|
+
const S = new re(m);
|
|
416
|
+
P(S), (b = e.onCancel) == null || b.call(e, S);
|
|
410
417
|
}
|
|
411
418
|
}, u = () => {
|
|
412
419
|
t = !0;
|
|
413
|
-
},
|
|
420
|
+
}, f = () => {
|
|
414
421
|
t = !1;
|
|
415
|
-
},
|
|
416
|
-
a() || (
|
|
417
|
-
}, P = (
|
|
418
|
-
a() || (
|
|
419
|
-
},
|
|
420
|
-
var
|
|
421
|
-
|
|
422
|
-
(a() ||
|
|
423
|
-
}, (
|
|
422
|
+
}, y = () => fe.isFocused() && (e.networkMode === "always" || $t.isOnline()) && e.canRun(), w = () => Le(e.networkMode) && e.canRun(), d = (m) => {
|
|
423
|
+
a() || (r == null || r(), n.resolve(m));
|
|
424
|
+
}, P = (m) => {
|
|
425
|
+
a() || (r == null || r(), n.reject(m));
|
|
426
|
+
}, p = () => new Promise((m) => {
|
|
427
|
+
var b;
|
|
428
|
+
r = (S) => {
|
|
429
|
+
(a() || y()) && m(S);
|
|
430
|
+
}, (b = e.onPause) == null || b.call(e);
|
|
424
431
|
}).then(() => {
|
|
425
|
-
var
|
|
426
|
-
|
|
427
|
-
}),
|
|
432
|
+
var m;
|
|
433
|
+
r = void 0, a() || (m = e.onContinue) == null || m.call(e);
|
|
434
|
+
}), E = () => {
|
|
428
435
|
if (a())
|
|
429
436
|
return;
|
|
430
|
-
let
|
|
431
|
-
const
|
|
437
|
+
let m;
|
|
438
|
+
const b = s === 0 ? e.initialPromise : void 0;
|
|
432
439
|
try {
|
|
433
|
-
|
|
434
|
-
} catch (
|
|
435
|
-
|
|
440
|
+
m = b ?? e.fn();
|
|
441
|
+
} catch (S) {
|
|
442
|
+
m = Promise.reject(S);
|
|
436
443
|
}
|
|
437
|
-
Promise.resolve(
|
|
438
|
-
var
|
|
444
|
+
Promise.resolve(m).then(d).catch((S) => {
|
|
445
|
+
var j;
|
|
439
446
|
if (a())
|
|
440
447
|
return;
|
|
441
|
-
const R = e.retry ?? (bt ? 0 : 3),
|
|
442
|
-
if (t || !
|
|
443
|
-
P(
|
|
448
|
+
const R = e.retry ?? (bt ? 0 : 3), F = e.retryDelay ?? ds, l = typeof F == "function" ? F(s, S) : F, D = R === !0 || typeof R == "number" && s < R || typeof R == "function" && R(s, S);
|
|
449
|
+
if (t || !D) {
|
|
450
|
+
P(S);
|
|
444
451
|
return;
|
|
445
452
|
}
|
|
446
|
-
s++, (
|
|
447
|
-
t ? P(
|
|
453
|
+
s++, (j = e.onFail) == null || j.call(e, s, S), is(l).then(() => y() ? void 0 : p()).then(() => {
|
|
454
|
+
t ? P(S) : E();
|
|
448
455
|
});
|
|
449
456
|
});
|
|
450
457
|
};
|
|
@@ -452,14 +459,14 @@ function Le(e) {
|
|
|
452
459
|
promise: n,
|
|
453
460
|
status: () => n.status,
|
|
454
461
|
cancel: h,
|
|
455
|
-
continue: () => (
|
|
462
|
+
continue: () => (r == null || r(), n),
|
|
456
463
|
cancelRetry: u,
|
|
457
|
-
continueRetry:
|
|
458
|
-
canStart:
|
|
459
|
-
start: () => (
|
|
464
|
+
continueRetry: f,
|
|
465
|
+
canStart: w,
|
|
466
|
+
start: () => (w() ? E() : p().then(E), n)
|
|
460
467
|
};
|
|
461
468
|
}
|
|
462
|
-
var lt, Ie,
|
|
469
|
+
var lt, Ie, Ge = (Ie = class {
|
|
463
470
|
constructor() {
|
|
464
471
|
c(this, lt);
|
|
465
472
|
}
|
|
@@ -478,9 +485,9 @@ var lt, Ie, He = (Ie = class {
|
|
|
478
485
|
);
|
|
479
486
|
}
|
|
480
487
|
clearGcTimeout() {
|
|
481
|
-
|
|
488
|
+
i(this, lt) && (ut.clearTimeout(i(this, lt)), o(this, lt, void 0));
|
|
482
489
|
}
|
|
483
|
-
}, lt = new WeakMap(), Ie), dt, Pt, _, ft,
|
|
490
|
+
}, lt = new WeakMap(), Ie), dt, Pt, _, ft, T, jt, yt, L, $, Ae, fs = (Ae = class extends Ge {
|
|
484
491
|
constructor(t) {
|
|
485
492
|
super();
|
|
486
493
|
c(this, L);
|
|
@@ -488,51 +495,51 @@ var lt, Ie, He = (Ie = class {
|
|
|
488
495
|
c(this, Pt);
|
|
489
496
|
c(this, _);
|
|
490
497
|
c(this, ft);
|
|
491
|
-
c(this,
|
|
492
|
-
c(this,
|
|
498
|
+
c(this, T);
|
|
499
|
+
c(this, jt);
|
|
493
500
|
c(this, yt);
|
|
494
|
-
o(this, yt, !1), o(this,
|
|
501
|
+
o(this, yt, !1), o(this, jt, t.defaultOptions), this.setOptions(t.options), this.observers = [], o(this, ft, t.client), o(this, _, i(this, ft).getQueryCache()), this.queryKey = t.queryKey, this.queryHash = t.queryHash, o(this, dt, Oe(this.options)), this.state = t.state ?? i(this, dt), this.scheduleGc();
|
|
495
502
|
}
|
|
496
503
|
get meta() {
|
|
497
504
|
return this.options.meta;
|
|
498
505
|
}
|
|
499
506
|
get promise() {
|
|
500
507
|
var t;
|
|
501
|
-
return (t =
|
|
508
|
+
return (t = i(this, T)) == null ? void 0 : t.promise;
|
|
502
509
|
}
|
|
503
510
|
setOptions(t) {
|
|
504
|
-
if (this.options = { ...
|
|
511
|
+
if (this.options = { ...i(this, jt), ...t }, this.updateGcTime(this.options.gcTime), this.state && this.state.data === void 0) {
|
|
505
512
|
const s = Oe(this.options);
|
|
506
513
|
s.data !== void 0 && (this.setState(
|
|
507
|
-
|
|
514
|
+
Ce(s.data, s.dataUpdatedAt)
|
|
508
515
|
), o(this, dt, s));
|
|
509
516
|
}
|
|
510
517
|
}
|
|
511
518
|
optionalRemove() {
|
|
512
|
-
!this.observers.length && this.state.fetchStatus === "idle" &&
|
|
519
|
+
!this.observers.length && this.state.fetchStatus === "idle" && i(this, _).remove(this);
|
|
513
520
|
}
|
|
514
521
|
setData(t, s) {
|
|
515
|
-
const
|
|
516
|
-
return
|
|
517
|
-
data:
|
|
522
|
+
const r = ee(this.state.data, t, this.options);
|
|
523
|
+
return v(this, L, $).call(this, {
|
|
524
|
+
data: r,
|
|
518
525
|
type: "success",
|
|
519
526
|
dataUpdatedAt: s == null ? void 0 : s.updatedAt,
|
|
520
527
|
manual: s == null ? void 0 : s.manual
|
|
521
|
-
}),
|
|
528
|
+
}), r;
|
|
522
529
|
}
|
|
523
530
|
setState(t, s) {
|
|
524
|
-
|
|
531
|
+
v(this, L, $).call(this, { type: "setState", state: t, setStateOptions: s });
|
|
525
532
|
}
|
|
526
533
|
cancel(t) {
|
|
527
|
-
var
|
|
528
|
-
const s = (
|
|
529
|
-
return (n =
|
|
534
|
+
var r, n;
|
|
535
|
+
const s = (r = i(this, T)) == null ? void 0 : r.promise;
|
|
536
|
+
return (n = i(this, T)) == null || n.cancel(t), s ? s.then(N).catch(N) : Promise.resolve();
|
|
530
537
|
}
|
|
531
538
|
destroy() {
|
|
532
539
|
super.destroy(), this.cancel({ silent: !0 });
|
|
533
540
|
}
|
|
534
541
|
reset() {
|
|
535
|
-
this.destroy(), this.setState(
|
|
542
|
+
this.destroy(), this.setState(i(this, dt));
|
|
536
543
|
}
|
|
537
544
|
isActive() {
|
|
538
545
|
return this.observers.some(
|
|
@@ -557,91 +564,91 @@ var lt, Ie, He = (Ie = class {
|
|
|
557
564
|
}
|
|
558
565
|
onFocus() {
|
|
559
566
|
var s;
|
|
560
|
-
const t = this.observers.find((
|
|
561
|
-
t == null || t.refetch({ cancelRefetch: !1 }), (s =
|
|
567
|
+
const t = this.observers.find((r) => r.shouldFetchOnWindowFocus());
|
|
568
|
+
t == null || t.refetch({ cancelRefetch: !1 }), (s = i(this, T)) == null || s.continue();
|
|
562
569
|
}
|
|
563
570
|
onOnline() {
|
|
564
571
|
var s;
|
|
565
|
-
const t = this.observers.find((
|
|
566
|
-
t == null || t.refetch({ cancelRefetch: !1 }), (s =
|
|
572
|
+
const t = this.observers.find((r) => r.shouldFetchOnReconnect());
|
|
573
|
+
t == null || t.refetch({ cancelRefetch: !1 }), (s = i(this, T)) == null || s.continue();
|
|
567
574
|
}
|
|
568
575
|
addObserver(t) {
|
|
569
|
-
this.observers.includes(t) || (this.observers.push(t), this.clearGcTimeout(),
|
|
576
|
+
this.observers.includes(t) || (this.observers.push(t), this.clearGcTimeout(), i(this, _).notify({ type: "observerAdded", query: this, observer: t }));
|
|
570
577
|
}
|
|
571
578
|
removeObserver(t) {
|
|
572
|
-
this.observers.includes(t) && (this.observers = this.observers.filter((s) => s !== t), this.observers.length || (
|
|
579
|
+
this.observers.includes(t) && (this.observers = this.observers.filter((s) => s !== t), this.observers.length || (i(this, T) && (i(this, yt) ? i(this, T).cancel({ revert: !0 }) : i(this, T).cancelRetry()), this.scheduleGc()), i(this, _).notify({ type: "observerRemoved", query: this, observer: t }));
|
|
573
580
|
}
|
|
574
581
|
getObserversCount() {
|
|
575
582
|
return this.observers.length;
|
|
576
583
|
}
|
|
577
584
|
invalidate() {
|
|
578
|
-
this.state.isInvalidated ||
|
|
585
|
+
this.state.isInvalidated || v(this, L, $).call(this, { type: "invalidate" });
|
|
579
586
|
}
|
|
580
587
|
async fetch(t, s) {
|
|
581
|
-
var
|
|
588
|
+
var f, y, w, d, P, p, E, m, b, S, R, F;
|
|
582
589
|
if (this.state.fetchStatus !== "idle" && // If the promise in the retyer is already rejected, we have to definitely
|
|
583
590
|
// re-start the fetch; there is a chance that the query is still in a
|
|
584
591
|
// pending state when that happens
|
|
585
|
-
((
|
|
592
|
+
((f = i(this, T)) == null ? void 0 : f.status()) !== "rejected") {
|
|
586
593
|
if (this.state.data !== void 0 && (s != null && s.cancelRefetch))
|
|
587
594
|
this.cancel({ silent: !0 });
|
|
588
|
-
else if (
|
|
589
|
-
return
|
|
595
|
+
else if (i(this, T))
|
|
596
|
+
return i(this, T).continueRetry(), i(this, T).promise;
|
|
590
597
|
}
|
|
591
598
|
if (t && this.setOptions(t), !this.options.queryFn) {
|
|
592
|
-
const
|
|
593
|
-
|
|
599
|
+
const l = this.observers.find((D) => D.options.queryFn);
|
|
600
|
+
l && this.setOptions(l.options);
|
|
594
601
|
}
|
|
595
602
|
process.env.NODE_ENV !== "production" && (Array.isArray(this.options.queryKey) || console.error(
|
|
596
603
|
"As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"
|
|
597
604
|
));
|
|
598
|
-
const
|
|
599
|
-
Object.defineProperty(
|
|
605
|
+
const r = new AbortController(), n = (l) => {
|
|
606
|
+
Object.defineProperty(l, "signal", {
|
|
600
607
|
enumerable: !0,
|
|
601
|
-
get: () => (o(this, yt, !0),
|
|
608
|
+
get: () => (o(this, yt, !0), r.signal)
|
|
602
609
|
});
|
|
603
610
|
}, a = () => {
|
|
604
|
-
const
|
|
611
|
+
const l = ke(this.options, s), j = (() => {
|
|
605
612
|
const Z = {
|
|
606
|
-
client:
|
|
613
|
+
client: i(this, ft),
|
|
607
614
|
queryKey: this.queryKey,
|
|
608
615
|
meta: this.meta
|
|
609
616
|
};
|
|
610
617
|
return n(Z), Z;
|
|
611
618
|
})();
|
|
612
619
|
return o(this, yt, !1), this.options.persister ? this.options.persister(
|
|
613
|
-
|
|
614
|
-
|
|
620
|
+
l,
|
|
621
|
+
j,
|
|
615
622
|
this
|
|
616
|
-
) :
|
|
623
|
+
) : l(j);
|
|
617
624
|
}, u = (() => {
|
|
618
|
-
const
|
|
625
|
+
const l = {
|
|
619
626
|
fetchOptions: s,
|
|
620
627
|
options: this.options,
|
|
621
628
|
queryKey: this.queryKey,
|
|
622
|
-
client:
|
|
629
|
+
client: i(this, ft),
|
|
623
630
|
state: this.state,
|
|
624
631
|
fetchFn: a
|
|
625
632
|
};
|
|
626
|
-
return n(
|
|
633
|
+
return n(l), l;
|
|
627
634
|
})();
|
|
628
|
-
(
|
|
635
|
+
(y = this.options.behavior) == null || y.onFetch(u, this), o(this, Pt, this.state), (this.state.fetchStatus === "idle" || this.state.fetchMeta !== ((w = u.fetchOptions) == null ? void 0 : w.meta)) && v(this, L, $).call(this, { type: "fetch", meta: (d = u.fetchOptions) == null ? void 0 : d.meta }), o(this, T, He({
|
|
629
636
|
initialPromise: s == null ? void 0 : s.initialPromise,
|
|
630
637
|
fn: u.fetchFn,
|
|
631
|
-
onCancel: (
|
|
632
|
-
|
|
633
|
-
...
|
|
638
|
+
onCancel: (l) => {
|
|
639
|
+
l instanceof re && l.revert && this.setState({
|
|
640
|
+
...i(this, Pt),
|
|
634
641
|
fetchStatus: "idle"
|
|
635
|
-
}),
|
|
642
|
+
}), r.abort();
|
|
636
643
|
},
|
|
637
|
-
onFail: (
|
|
638
|
-
|
|
644
|
+
onFail: (l, D) => {
|
|
645
|
+
v(this, L, $).call(this, { type: "failed", failureCount: l, error: D });
|
|
639
646
|
},
|
|
640
647
|
onPause: () => {
|
|
641
|
-
|
|
648
|
+
v(this, L, $).call(this, { type: "pause" });
|
|
642
649
|
},
|
|
643
650
|
onContinue: () => {
|
|
644
|
-
|
|
651
|
+
v(this, L, $).call(this, { type: "continue" });
|
|
645
652
|
},
|
|
646
653
|
retry: u.options.retry,
|
|
647
654
|
retryDelay: u.options.retryDelay,
|
|
@@ -649,74 +656,74 @@ var lt, Ie, He = (Ie = class {
|
|
|
649
656
|
canRun: () => !0
|
|
650
657
|
}));
|
|
651
658
|
try {
|
|
652
|
-
const
|
|
653
|
-
if (
|
|
659
|
+
const l = await i(this, T).start();
|
|
660
|
+
if (l === void 0)
|
|
654
661
|
throw process.env.NODE_ENV !== "production" && console.error(
|
|
655
662
|
`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
663
|
), new Error(`${this.queryHash} data is undefined`);
|
|
657
|
-
return this.setData(
|
|
658
|
-
|
|
659
|
-
|
|
664
|
+
return this.setData(l), (p = (P = i(this, _).config).onSuccess) == null || p.call(P, l, this), (m = (E = i(this, _).config).onSettled) == null || m.call(
|
|
665
|
+
E,
|
|
666
|
+
l,
|
|
660
667
|
this.state.error,
|
|
661
668
|
this
|
|
662
|
-
),
|
|
663
|
-
} catch (
|
|
664
|
-
if (
|
|
665
|
-
if (
|
|
666
|
-
return
|
|
667
|
-
if (
|
|
669
|
+
), l;
|
|
670
|
+
} catch (l) {
|
|
671
|
+
if (l instanceof re) {
|
|
672
|
+
if (l.silent)
|
|
673
|
+
return i(this, T).promise;
|
|
674
|
+
if (l.revert) {
|
|
668
675
|
if (this.state.data === void 0)
|
|
669
|
-
throw
|
|
676
|
+
throw l;
|
|
670
677
|
return this.state.data;
|
|
671
678
|
}
|
|
672
679
|
}
|
|
673
|
-
throw
|
|
680
|
+
throw v(this, L, $).call(this, {
|
|
674
681
|
type: "error",
|
|
675
|
-
error:
|
|
676
|
-
}), (
|
|
677
|
-
|
|
678
|
-
|
|
682
|
+
error: l
|
|
683
|
+
}), (S = (b = i(this, _).config).onError) == null || S.call(
|
|
684
|
+
b,
|
|
685
|
+
l,
|
|
679
686
|
this
|
|
680
|
-
), (
|
|
687
|
+
), (F = (R = i(this, _).config).onSettled) == null || F.call(
|
|
681
688
|
R,
|
|
682
689
|
this.state.data,
|
|
683
|
-
|
|
690
|
+
l,
|
|
684
691
|
this
|
|
685
|
-
),
|
|
692
|
+
), l;
|
|
686
693
|
} finally {
|
|
687
694
|
this.scheduleGc();
|
|
688
695
|
}
|
|
689
696
|
}
|
|
690
|
-
}, dt = new WeakMap(), Pt = new WeakMap(), _ = new WeakMap(), ft = new WeakMap(),
|
|
691
|
-
const s = (
|
|
697
|
+
}, dt = new WeakMap(), Pt = new WeakMap(), _ = new WeakMap(), ft = new WeakMap(), T = new WeakMap(), jt = new WeakMap(), yt = new WeakMap(), L = new WeakSet(), $ = function(t) {
|
|
698
|
+
const s = (r) => {
|
|
692
699
|
switch (t.type) {
|
|
693
700
|
case "failed":
|
|
694
701
|
return {
|
|
695
|
-
...
|
|
702
|
+
...r,
|
|
696
703
|
fetchFailureCount: t.failureCount,
|
|
697
704
|
fetchFailureReason: t.error
|
|
698
705
|
};
|
|
699
706
|
case "pause":
|
|
700
707
|
return {
|
|
701
|
-
...
|
|
708
|
+
...r,
|
|
702
709
|
fetchStatus: "paused"
|
|
703
710
|
};
|
|
704
711
|
case "continue":
|
|
705
712
|
return {
|
|
706
|
-
...
|
|
713
|
+
...r,
|
|
707
714
|
fetchStatus: "fetching"
|
|
708
715
|
};
|
|
709
716
|
case "fetch":
|
|
710
717
|
return {
|
|
711
|
-
...
|
|
712
|
-
...
|
|
718
|
+
...r,
|
|
719
|
+
...Be(r.data, this.options),
|
|
713
720
|
fetchMeta: t.meta ?? null
|
|
714
721
|
};
|
|
715
722
|
case "success":
|
|
716
723
|
const n = {
|
|
717
|
-
...
|
|
718
|
-
...
|
|
719
|
-
dataUpdateCount:
|
|
724
|
+
...r,
|
|
725
|
+
...Ce(t.data, t.dataUpdatedAt),
|
|
726
|
+
dataUpdateCount: r.dataUpdateCount + 1,
|
|
720
727
|
...!t.manual && {
|
|
721
728
|
fetchStatus: "idle",
|
|
722
729
|
fetchFailureCount: 0,
|
|
@@ -727,45 +734,48 @@ var lt, Ie, He = (Ie = class {
|
|
|
727
734
|
case "error":
|
|
728
735
|
const a = t.error;
|
|
729
736
|
return {
|
|
730
|
-
...
|
|
737
|
+
...r,
|
|
731
738
|
error: a,
|
|
732
|
-
errorUpdateCount:
|
|
739
|
+
errorUpdateCount: r.errorUpdateCount + 1,
|
|
733
740
|
errorUpdatedAt: Date.now(),
|
|
734
|
-
fetchFailureCount:
|
|
741
|
+
fetchFailureCount: r.fetchFailureCount + 1,
|
|
735
742
|
fetchFailureReason: a,
|
|
736
743
|
fetchStatus: "idle",
|
|
737
|
-
status: "error"
|
|
744
|
+
status: "error",
|
|
745
|
+
// flag existing data as invalidated if we get a background error
|
|
746
|
+
// note that "no data" always means stale so we can set unconditionally here
|
|
747
|
+
isInvalidated: !0
|
|
738
748
|
};
|
|
739
749
|
case "invalidate":
|
|
740
750
|
return {
|
|
741
|
-
...
|
|
751
|
+
...r,
|
|
742
752
|
isInvalidated: !0
|
|
743
753
|
};
|
|
744
754
|
case "setState":
|
|
745
755
|
return {
|
|
746
|
-
...
|
|
756
|
+
...r,
|
|
747
757
|
...t.state
|
|
748
758
|
};
|
|
749
759
|
}
|
|
750
760
|
};
|
|
751
|
-
this.state = s(this.state),
|
|
752
|
-
this.observers.forEach((
|
|
753
|
-
|
|
754
|
-
}),
|
|
761
|
+
this.state = s(this.state), I.batch(() => {
|
|
762
|
+
this.observers.forEach((r) => {
|
|
763
|
+
r.onQueryUpdate();
|
|
764
|
+
}), i(this, _).notify({ query: this, type: "updated", action: t });
|
|
755
765
|
});
|
|
756
|
-
},
|
|
757
|
-
function
|
|
766
|
+
}, Ae);
|
|
767
|
+
function Be(e, t) {
|
|
758
768
|
return {
|
|
759
769
|
fetchFailureCount: 0,
|
|
760
770
|
fetchFailureReason: null,
|
|
761
|
-
fetchStatus:
|
|
771
|
+
fetchStatus: Le(t.networkMode) ? "fetching" : "paused",
|
|
762
772
|
...e === void 0 && {
|
|
763
773
|
error: null,
|
|
764
774
|
status: "pending"
|
|
765
775
|
}
|
|
766
776
|
};
|
|
767
777
|
}
|
|
768
|
-
function
|
|
778
|
+
function Ce(e, t) {
|
|
769
779
|
return {
|
|
770
780
|
data: e,
|
|
771
781
|
dataUpdatedAt: t ?? Date.now(),
|
|
@@ -775,11 +785,11 @@ function Se(e, t) {
|
|
|
775
785
|
};
|
|
776
786
|
}
|
|
777
787
|
function Oe(e) {
|
|
778
|
-
const t = typeof e.initialData == "function" ? e.initialData() : e.initialData, s = t !== void 0,
|
|
788
|
+
const t = typeof e.initialData == "function" ? e.initialData() : e.initialData, s = t !== void 0, r = s ? typeof e.initialDataUpdatedAt == "function" ? e.initialDataUpdatedAt() : e.initialDataUpdatedAt : 0;
|
|
779
789
|
return {
|
|
780
790
|
data: t,
|
|
781
791
|
dataUpdateCount: 0,
|
|
782
|
-
dataUpdatedAt: s ?
|
|
792
|
+
dataUpdatedAt: s ? r ?? Date.now() : 0,
|
|
783
793
|
error: null,
|
|
784
794
|
errorUpdateCount: 0,
|
|
785
795
|
errorUpdatedAt: 0,
|
|
@@ -791,13 +801,13 @@ function Oe(e) {
|
|
|
791
801
|
fetchStatus: "idle"
|
|
792
802
|
};
|
|
793
803
|
}
|
|
794
|
-
var U,
|
|
804
|
+
var U, g, Ut, q, pt, Et, W, st, Nt, Ft, Rt, mt, vt, rt, Mt, O, At, ie, ne, ae, oe, ue, he, ce, Ve, qe, ys = (qe = class extends Kt {
|
|
795
805
|
constructor(t, s) {
|
|
796
806
|
super();
|
|
797
|
-
c(this,
|
|
807
|
+
c(this, O);
|
|
798
808
|
c(this, U);
|
|
799
|
-
c(this,
|
|
800
|
-
c(this,
|
|
809
|
+
c(this, g);
|
|
810
|
+
c(this, Ut);
|
|
801
811
|
c(this, q);
|
|
802
812
|
c(this, pt);
|
|
803
813
|
c(this, Et);
|
|
@@ -818,70 +828,70 @@ var U, v, jt, q, pt, Et, W, st, Nt, Ft, Rt, mt, vt, rt, Mt, S, qt, ie, ne, ae, o
|
|
|
818
828
|
this.refetch = this.refetch.bind(this);
|
|
819
829
|
}
|
|
820
830
|
onSubscribe() {
|
|
821
|
-
this.listeners.size === 1 && (
|
|
831
|
+
this.listeners.size === 1 && (i(this, g).addObserver(this), Pe(i(this, g), this.options) ? v(this, O, At).call(this) : this.updateResult(), v(this, O, oe).call(this));
|
|
822
832
|
}
|
|
823
833
|
onUnsubscribe() {
|
|
824
834
|
this.hasListeners() || this.destroy();
|
|
825
835
|
}
|
|
826
836
|
shouldFetchOnReconnect() {
|
|
827
837
|
return le(
|
|
828
|
-
|
|
838
|
+
i(this, g),
|
|
829
839
|
this.options,
|
|
830
840
|
this.options.refetchOnReconnect
|
|
831
841
|
);
|
|
832
842
|
}
|
|
833
843
|
shouldFetchOnWindowFocus() {
|
|
834
844
|
return le(
|
|
835
|
-
|
|
845
|
+
i(this, g),
|
|
836
846
|
this.options,
|
|
837
847
|
this.options.refetchOnWindowFocus
|
|
838
848
|
);
|
|
839
849
|
}
|
|
840
850
|
destroy() {
|
|
841
|
-
this.listeners = /* @__PURE__ */ new Set(),
|
|
851
|
+
this.listeners = /* @__PURE__ */ new Set(), v(this, O, ue).call(this), v(this, O, he).call(this), i(this, g).removeObserver(this);
|
|
842
852
|
}
|
|
843
853
|
setOptions(t) {
|
|
844
|
-
const s = this.options,
|
|
845
|
-
if (this.options =
|
|
854
|
+
const s = this.options, r = i(this, g);
|
|
855
|
+
if (this.options = i(this, U).defaultQueryOptions(t), this.options.enabled !== void 0 && typeof this.options.enabled != "boolean" && typeof this.options.enabled != "function" && typeof k(this.options.enabled, i(this, g)) != "boolean")
|
|
846
856
|
throw new Error(
|
|
847
857
|
"Expected enabled to be a boolean or a callback that returns a boolean"
|
|
848
858
|
);
|
|
849
|
-
|
|
859
|
+
v(this, O, ce).call(this), i(this, g).setOptions(this.options), s._defaulted && !Yt(this.options, s) && i(this, U).getQueryCache().notify({
|
|
850
860
|
type: "observerOptionsUpdated",
|
|
851
|
-
query:
|
|
861
|
+
query: i(this, g),
|
|
852
862
|
observer: this
|
|
853
863
|
});
|
|
854
864
|
const n = this.hasListeners();
|
|
855
865
|
n && Ee(
|
|
856
|
-
|
|
857
|
-
|
|
866
|
+
i(this, g),
|
|
867
|
+
r,
|
|
858
868
|
this.options,
|
|
859
869
|
s
|
|
860
|
-
) &&
|
|
861
|
-
const a =
|
|
862
|
-
n && (
|
|
870
|
+
) && v(this, O, At).call(this), this.updateResult(), n && (i(this, g) !== r || k(this.options.enabled, i(this, g)) !== k(s.enabled, i(this, g)) || ot(this.options.staleTime, i(this, g)) !== ot(s.staleTime, i(this, g))) && v(this, O, ie).call(this);
|
|
871
|
+
const a = v(this, O, ne).call(this);
|
|
872
|
+
n && (i(this, g) !== r || k(this.options.enabled, i(this, g)) !== k(s.enabled, i(this, g)) || a !== i(this, rt)) && v(this, O, ae).call(this, a);
|
|
863
873
|
}
|
|
864
874
|
getOptimisticResult(t) {
|
|
865
|
-
const s =
|
|
866
|
-
return
|
|
875
|
+
const s = i(this, U).getQueryCache().build(i(this, U), t), r = this.createResult(s, t);
|
|
876
|
+
return ms(this, r) && (o(this, q, r), o(this, Et, this.options), o(this, pt, i(this, g).state)), r;
|
|
867
877
|
}
|
|
868
878
|
getCurrentResult() {
|
|
869
|
-
return
|
|
879
|
+
return i(this, q);
|
|
870
880
|
}
|
|
871
881
|
trackResult(t, s) {
|
|
872
882
|
return new Proxy(t, {
|
|
873
|
-
get: (
|
|
883
|
+
get: (r, n) => (this.trackProp(n), s == null || s(n), n === "promise" && (this.trackProp("data"), !this.options.experimental_prefetchInRender && i(this, W).status === "pending" && i(this, W).reject(
|
|
874
884
|
new Error(
|
|
875
885
|
"experimental_prefetchInRender feature flag is not enabled"
|
|
876
886
|
)
|
|
877
|
-
)), Reflect.get(
|
|
887
|
+
)), Reflect.get(r, n))
|
|
878
888
|
});
|
|
879
889
|
}
|
|
880
890
|
trackProp(t) {
|
|
881
|
-
|
|
891
|
+
i(this, Mt).add(t);
|
|
882
892
|
}
|
|
883
893
|
getCurrentQuery() {
|
|
884
|
-
return
|
|
894
|
+
return i(this, g);
|
|
885
895
|
}
|
|
886
896
|
refetch({ ...t } = {}) {
|
|
887
897
|
return this.fetch({
|
|
@@ -889,249 +899,248 @@ var U, v, jt, q, pt, Et, W, st, Nt, Ft, Rt, mt, vt, rt, Mt, S, qt, ie, ne, ae, o
|
|
|
889
899
|
});
|
|
890
900
|
}
|
|
891
901
|
fetchOptimistic(t) {
|
|
892
|
-
const s =
|
|
893
|
-
return
|
|
902
|
+
const s = i(this, U).defaultQueryOptions(t), r = i(this, U).getQueryCache().build(i(this, U), s);
|
|
903
|
+
return r.fetch().then(() => this.createResult(r, s));
|
|
894
904
|
}
|
|
895
905
|
fetch(t) {
|
|
896
|
-
return
|
|
906
|
+
return v(this, O, At).call(this, {
|
|
897
907
|
...t,
|
|
898
908
|
cancelRefetch: t.cancelRefetch ?? !0
|
|
899
|
-
}).then(() => (this.updateResult(),
|
|
909
|
+
}).then(() => (this.updateResult(), i(this, q)));
|
|
900
910
|
}
|
|
901
911
|
createResult(t, s) {
|
|
902
912
|
var X;
|
|
903
|
-
const
|
|
904
|
-
let
|
|
913
|
+
const r = i(this, g), n = this.options, a = i(this, q), h = i(this, pt), u = i(this, Et), y = t !== r ? t.state : i(this, Ut), { state: w } = t;
|
|
914
|
+
let d = { ...w }, P = !1, p;
|
|
905
915
|
if (s._optimisticResults) {
|
|
906
|
-
const C = this.hasListeners(),
|
|
907
|
-
(
|
|
908
|
-
...
|
|
909
|
-
...
|
|
910
|
-
}), s._optimisticResults === "isRestoring" && (
|
|
916
|
+
const C = this.hasListeners(), Q = !C && Pe(t, s), wt = C && Ee(t, r, s, n);
|
|
917
|
+
(Q || wt) && (d = {
|
|
918
|
+
...d,
|
|
919
|
+
...Be(w.data, t.options)
|
|
920
|
+
}), s._optimisticResults === "isRestoring" && (d.fetchStatus = "idle");
|
|
911
921
|
}
|
|
912
|
-
let { error:
|
|
913
|
-
|
|
914
|
-
let
|
|
915
|
-
if (s.placeholderData !== void 0 &&
|
|
922
|
+
let { error: E, errorUpdatedAt: m, status: b } = d;
|
|
923
|
+
p = d.data;
|
|
924
|
+
let S = !1;
|
|
925
|
+
if (s.placeholderData !== void 0 && p === void 0 && b === "pending") {
|
|
916
926
|
let C;
|
|
917
|
-
a != null && a.isPlaceholderData && s.placeholderData === (u == null ? void 0 : u.placeholderData) ? (C = a.data,
|
|
918
|
-
(X =
|
|
919
|
-
|
|
920
|
-
) : s.placeholderData, C !== void 0 && (
|
|
927
|
+
a != null && a.isPlaceholderData && s.placeholderData === (u == null ? void 0 : u.placeholderData) ? (C = a.data, S = !0) : C = typeof s.placeholderData == "function" ? s.placeholderData(
|
|
928
|
+
(X = i(this, Rt)) == null ? void 0 : X.state.data,
|
|
929
|
+
i(this, Rt)
|
|
930
|
+
) : s.placeholderData, C !== void 0 && (b = "success", p = ee(
|
|
921
931
|
a == null ? void 0 : a.data,
|
|
922
932
|
C,
|
|
923
933
|
s
|
|
924
934
|
), P = !0);
|
|
925
935
|
}
|
|
926
|
-
if (s.select &&
|
|
927
|
-
if (a &&
|
|
928
|
-
|
|
936
|
+
if (s.select && p !== void 0 && !S)
|
|
937
|
+
if (a && p === (h == null ? void 0 : h.data) && s.select === i(this, Nt))
|
|
938
|
+
p = i(this, Ft);
|
|
929
939
|
else
|
|
930
940
|
try {
|
|
931
|
-
o(this, Nt, s.select),
|
|
941
|
+
o(this, Nt, s.select), p = s.select(p), p = ee(a == null ? void 0 : a.data, p, s), o(this, Ft, p), o(this, st, null);
|
|
932
942
|
} catch (C) {
|
|
933
943
|
o(this, st, C);
|
|
934
944
|
}
|
|
935
|
-
|
|
936
|
-
const R =
|
|
937
|
-
status:
|
|
938
|
-
fetchStatus:
|
|
939
|
-
isPending:
|
|
940
|
-
isSuccess:
|
|
941
|
-
isError:
|
|
942
|
-
isInitialLoading:
|
|
943
|
-
isLoading:
|
|
944
|
-
data:
|
|
945
|
-
dataUpdatedAt:
|
|
946
|
-
error:
|
|
947
|
-
errorUpdatedAt:
|
|
948
|
-
failureCount:
|
|
949
|
-
failureReason:
|
|
950
|
-
errorUpdateCount:
|
|
951
|
-
isFetched:
|
|
952
|
-
isFetchedAfterMount:
|
|
945
|
+
i(this, st) && (E = i(this, st), p = i(this, Ft), m = Date.now(), b = "error");
|
|
946
|
+
const R = d.fetchStatus === "fetching", F = b === "pending", l = b === "error", D = F && R, j = p !== void 0, A = {
|
|
947
|
+
status: b,
|
|
948
|
+
fetchStatus: d.fetchStatus,
|
|
949
|
+
isPending: F,
|
|
950
|
+
isSuccess: b === "success",
|
|
951
|
+
isError: l,
|
|
952
|
+
isInitialLoading: D,
|
|
953
|
+
isLoading: D,
|
|
954
|
+
data: p,
|
|
955
|
+
dataUpdatedAt: d.dataUpdatedAt,
|
|
956
|
+
error: E,
|
|
957
|
+
errorUpdatedAt: m,
|
|
958
|
+
failureCount: d.fetchFailureCount,
|
|
959
|
+
failureReason: d.fetchFailureReason,
|
|
960
|
+
errorUpdateCount: d.errorUpdateCount,
|
|
961
|
+
isFetched: d.dataUpdateCount > 0 || d.errorUpdateCount > 0,
|
|
962
|
+
isFetchedAfterMount: d.dataUpdateCount > y.dataUpdateCount || d.errorUpdateCount > y.errorUpdateCount,
|
|
953
963
|
isFetching: R,
|
|
954
|
-
isRefetching: R && !
|
|
955
|
-
isLoadingError:
|
|
956
|
-
isPaused:
|
|
964
|
+
isRefetching: R && !F,
|
|
965
|
+
isLoadingError: l && !j,
|
|
966
|
+
isPaused: d.fetchStatus === "paused",
|
|
957
967
|
isPlaceholderData: P,
|
|
958
|
-
isRefetchError:
|
|
968
|
+
isRefetchError: l && j,
|
|
959
969
|
isStale: ye(t, s),
|
|
960
970
|
refetch: this.refetch,
|
|
961
|
-
promise:
|
|
971
|
+
promise: i(this, W),
|
|
962
972
|
isEnabled: k(s.enabled, t) !== !1
|
|
963
973
|
};
|
|
964
974
|
if (this.options.experimental_prefetchInRender) {
|
|
965
975
|
const C = (Lt) => {
|
|
966
|
-
|
|
967
|
-
},
|
|
968
|
-
const Lt = o(this, W,
|
|
976
|
+
A.status === "error" ? Lt.reject(A.error) : A.data !== void 0 && Lt.resolve(A.data);
|
|
977
|
+
}, Q = () => {
|
|
978
|
+
const Lt = o(this, W, A.promise = se());
|
|
969
979
|
C(Lt);
|
|
970
|
-
}, wt =
|
|
980
|
+
}, wt = i(this, W);
|
|
971
981
|
switch (wt.status) {
|
|
972
982
|
case "pending":
|
|
973
|
-
t.queryHash ===
|
|
983
|
+
t.queryHash === r.queryHash && C(wt);
|
|
974
984
|
break;
|
|
975
985
|
case "fulfilled":
|
|
976
|
-
(
|
|
986
|
+
(A.status === "error" || A.data !== wt.value) && Q();
|
|
977
987
|
break;
|
|
978
988
|
case "rejected":
|
|
979
|
-
(
|
|
989
|
+
(A.status !== "error" || A.error !== wt.reason) && Q();
|
|
980
990
|
break;
|
|
981
991
|
}
|
|
982
992
|
}
|
|
983
|
-
return
|
|
993
|
+
return A;
|
|
984
994
|
}
|
|
985
995
|
updateResult() {
|
|
986
|
-
const t =
|
|
987
|
-
if (o(this, pt,
|
|
996
|
+
const t = i(this, q), s = this.createResult(i(this, g), this.options);
|
|
997
|
+
if (o(this, pt, i(this, g).state), o(this, Et, this.options), i(this, pt).data !== void 0 && o(this, Rt, i(this, g)), Yt(s, t))
|
|
988
998
|
return;
|
|
989
999
|
o(this, q, s);
|
|
990
|
-
const
|
|
1000
|
+
const r = () => {
|
|
991
1001
|
if (!t)
|
|
992
1002
|
return !0;
|
|
993
1003
|
const { notifyOnChangeProps: n } = this.options, a = typeof n == "function" ? n() : n;
|
|
994
|
-
if (a === "all" || !a && !
|
|
1004
|
+
if (a === "all" || !a && !i(this, Mt).size)
|
|
995
1005
|
return !0;
|
|
996
1006
|
const h = new Set(
|
|
997
|
-
a ??
|
|
1007
|
+
a ?? i(this, Mt)
|
|
998
1008
|
);
|
|
999
|
-
return this.options.throwOnError && h.add("error"), Object.keys(
|
|
1000
|
-
const
|
|
1001
|
-
return
|
|
1009
|
+
return this.options.throwOnError && h.add("error"), Object.keys(i(this, q)).some((u) => {
|
|
1010
|
+
const f = u;
|
|
1011
|
+
return i(this, q)[f] !== t[f] && h.has(f);
|
|
1002
1012
|
});
|
|
1003
1013
|
};
|
|
1004
|
-
|
|
1014
|
+
v(this, O, Ve).call(this, { listeners: r() });
|
|
1005
1015
|
}
|
|
1006
1016
|
onQueryUpdate() {
|
|
1007
|
-
this.updateResult(), this.hasListeners() &&
|
|
1017
|
+
this.updateResult(), this.hasListeners() && v(this, O, oe).call(this);
|
|
1008
1018
|
}
|
|
1009
|
-
}, U = new WeakMap(),
|
|
1010
|
-
|
|
1011
|
-
let s =
|
|
1019
|
+
}, U = new WeakMap(), g = new WeakMap(), Ut = new WeakMap(), q = new WeakMap(), pt = new WeakMap(), Et = new WeakMap(), W = new WeakMap(), st = new WeakMap(), Nt = new WeakMap(), Ft = new WeakMap(), Rt = new WeakMap(), mt = new WeakMap(), vt = new WeakMap(), rt = new WeakMap(), Mt = new WeakMap(), O = new WeakSet(), At = function(t) {
|
|
1020
|
+
v(this, O, ce).call(this);
|
|
1021
|
+
let s = i(this, g).fetch(
|
|
1012
1022
|
this.options,
|
|
1013
1023
|
t
|
|
1014
1024
|
);
|
|
1015
|
-
return t != null && t.throwOnError || (s = s.catch(
|
|
1025
|
+
return t != null && t.throwOnError || (s = s.catch(N)), s;
|
|
1016
1026
|
}, ie = function() {
|
|
1017
|
-
|
|
1027
|
+
v(this, O, ue).call(this);
|
|
1018
1028
|
const t = ot(
|
|
1019
1029
|
this.options.staleTime,
|
|
1020
|
-
|
|
1030
|
+
i(this, g)
|
|
1021
1031
|
);
|
|
1022
|
-
if (bt ||
|
|
1032
|
+
if (bt || i(this, q).isStale || !Zt(t))
|
|
1023
1033
|
return;
|
|
1024
|
-
const
|
|
1034
|
+
const r = _e(i(this, q).dataUpdatedAt, t) + 1;
|
|
1025
1035
|
o(this, mt, ut.setTimeout(() => {
|
|
1026
|
-
|
|
1027
|
-
},
|
|
1036
|
+
i(this, q).isStale || this.updateResult();
|
|
1037
|
+
}, r));
|
|
1028
1038
|
}, ne = function() {
|
|
1029
|
-
return (typeof this.options.refetchInterval == "function" ? this.options.refetchInterval(
|
|
1039
|
+
return (typeof this.options.refetchInterval == "function" ? this.options.refetchInterval(i(this, g)) : this.options.refetchInterval) ?? !1;
|
|
1030
1040
|
}, ae = function(t) {
|
|
1031
|
-
|
|
1032
|
-
(this.options.refetchIntervalInBackground || fe.isFocused()) &&
|
|
1033
|
-
},
|
|
1041
|
+
v(this, O, he).call(this), o(this, rt, t), !(bt || k(this.options.enabled, i(this, g)) === !1 || !Zt(i(this, rt)) || i(this, rt) === 0) && o(this, vt, ut.setInterval(() => {
|
|
1042
|
+
(this.options.refetchIntervalInBackground || fe.isFocused()) && v(this, O, At).call(this);
|
|
1043
|
+
}, i(this, rt)));
|
|
1034
1044
|
}, oe = function() {
|
|
1035
|
-
|
|
1045
|
+
v(this, O, ie).call(this), v(this, O, ae).call(this, v(this, O, ne).call(this));
|
|
1036
1046
|
}, ue = function() {
|
|
1037
|
-
|
|
1047
|
+
i(this, mt) && (ut.clearTimeout(i(this, mt)), o(this, mt, void 0));
|
|
1038
1048
|
}, he = function() {
|
|
1039
|
-
|
|
1049
|
+
i(this, vt) && (ut.clearInterval(i(this, vt)), o(this, vt, void 0));
|
|
1040
1050
|
}, ce = function() {
|
|
1041
|
-
const t =
|
|
1042
|
-
if (t ===
|
|
1051
|
+
const t = i(this, U).getQueryCache().build(i(this, U), this.options);
|
|
1052
|
+
if (t === i(this, g))
|
|
1043
1053
|
return;
|
|
1044
|
-
const s =
|
|
1045
|
-
o(this,
|
|
1046
|
-
},
|
|
1047
|
-
|
|
1054
|
+
const s = i(this, g);
|
|
1055
|
+
o(this, g, t), o(this, Ut, t.state), this.hasListeners() && (s == null || s.removeObserver(this), t.addObserver(this));
|
|
1056
|
+
}, Ve = function(t) {
|
|
1057
|
+
I.batch(() => {
|
|
1048
1058
|
t.listeners && this.listeners.forEach((s) => {
|
|
1049
|
-
s(
|
|
1050
|
-
}),
|
|
1051
|
-
query:
|
|
1059
|
+
s(i(this, q));
|
|
1060
|
+
}), i(this, U).getQueryCache().notify({
|
|
1061
|
+
query: i(this, g),
|
|
1052
1062
|
type: "observerResultsUpdated"
|
|
1053
1063
|
});
|
|
1054
1064
|
});
|
|
1055
|
-
},
|
|
1056
|
-
function
|
|
1065
|
+
}, qe);
|
|
1066
|
+
function ps(e, t) {
|
|
1057
1067
|
return k(t.enabled, e) !== !1 && e.state.data === void 0 && !(e.state.status === "error" && t.retryOnMount === !1);
|
|
1058
1068
|
}
|
|
1059
1069
|
function Pe(e, t) {
|
|
1060
|
-
return
|
|
1070
|
+
return ps(e, t) || e.state.data !== void 0 && le(e, t, t.refetchOnMount);
|
|
1061
1071
|
}
|
|
1062
1072
|
function le(e, t, s) {
|
|
1063
1073
|
if (k(t.enabled, e) !== !1 && ot(t.staleTime, e) !== "static") {
|
|
1064
|
-
const
|
|
1065
|
-
return
|
|
1074
|
+
const r = typeof s == "function" ? s(e) : s;
|
|
1075
|
+
return r === "always" || r !== !1 && ye(e, t);
|
|
1066
1076
|
}
|
|
1067
1077
|
return !1;
|
|
1068
1078
|
}
|
|
1069
|
-
function Ee(e, t, s,
|
|
1070
|
-
return (e !== t || k(
|
|
1079
|
+
function Ee(e, t, s, r) {
|
|
1080
|
+
return (e !== t || k(r.enabled, e) === !1) && (!s.suspense || e.state.status !== "error") && ye(e, s);
|
|
1071
1081
|
}
|
|
1072
1082
|
function ye(e, t) {
|
|
1073
1083
|
return k(t.enabled, e) !== !1 && e.isStaleByTime(ot(t.staleTime, e));
|
|
1074
1084
|
}
|
|
1075
|
-
function
|
|
1085
|
+
function ms(e, t) {
|
|
1076
1086
|
return !Yt(e.getCurrentResult(), t);
|
|
1077
1087
|
}
|
|
1078
1088
|
function Fe(e) {
|
|
1079
1089
|
return {
|
|
1080
1090
|
onFetch: (t, s) => {
|
|
1081
|
-
var
|
|
1082
|
-
const
|
|
1083
|
-
let u = { pages: [], pageParams: [] },
|
|
1084
|
-
const
|
|
1085
|
-
let
|
|
1086
|
-
const
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
if (p)
|
|
1091
|
+
var w, d, P, p, E;
|
|
1092
|
+
const r = t.options, n = (P = (d = (w = t.fetchOptions) == null ? void 0 : w.meta) == null ? void 0 : d.fetchMore) == null ? void 0 : P.direction, a = ((p = t.state.data) == null ? void 0 : p.pages) || [], h = ((E = t.state.data) == null ? void 0 : E.pageParams) || [];
|
|
1093
|
+
let u = { pages: [], pageParams: [] }, f = 0;
|
|
1094
|
+
const y = async () => {
|
|
1095
|
+
let m = !1;
|
|
1096
|
+
const b = (F) => {
|
|
1097
|
+
os(
|
|
1098
|
+
F,
|
|
1099
|
+
() => t.signal,
|
|
1100
|
+
() => m = !0
|
|
1101
|
+
);
|
|
1102
|
+
}, S = ke(t.options, t.fetchOptions), R = async (F, l, D) => {
|
|
1103
|
+
if (m)
|
|
1095
1104
|
return Promise.reject();
|
|
1096
|
-
if (
|
|
1097
|
-
return Promise.resolve(
|
|
1105
|
+
if (l == null && F.pages.length)
|
|
1106
|
+
return Promise.resolve(F);
|
|
1098
1107
|
const Z = (() => {
|
|
1099
|
-
const
|
|
1108
|
+
const Q = {
|
|
1100
1109
|
client: t.client,
|
|
1101
1110
|
queryKey: t.queryKey,
|
|
1102
|
-
pageParam:
|
|
1103
|
-
direction:
|
|
1111
|
+
pageParam: l,
|
|
1112
|
+
direction: D ? "backward" : "forward",
|
|
1104
1113
|
meta: t.options.meta
|
|
1105
1114
|
};
|
|
1106
|
-
return
|
|
1107
|
-
})(),
|
|
1115
|
+
return b(Q), Q;
|
|
1116
|
+
})(), A = await S(Z), { maxPages: X } = t.options, C = D ? as : ns;
|
|
1108
1117
|
return {
|
|
1109
|
-
pages: C(
|
|
1110
|
-
pageParams: C(
|
|
1118
|
+
pages: C(F.pages, A, X),
|
|
1119
|
+
pageParams: C(F.pageParams, l, X)
|
|
1111
1120
|
};
|
|
1112
1121
|
};
|
|
1113
1122
|
if (n && a.length) {
|
|
1114
|
-
const
|
|
1123
|
+
const F = n === "backward", l = F ? vs : Re, D = {
|
|
1115
1124
|
pages: a,
|
|
1116
1125
|
pageParams: h
|
|
1117
|
-
},
|
|
1118
|
-
u = await R(
|
|
1126
|
+
}, j = l(r, D);
|
|
1127
|
+
u = await R(D, j, F);
|
|
1119
1128
|
} else {
|
|
1120
|
-
const
|
|
1129
|
+
const F = e ?? a.length;
|
|
1121
1130
|
do {
|
|
1122
|
-
const
|
|
1123
|
-
if (
|
|
1131
|
+
const l = f === 0 ? h[0] ?? r.initialPageParam : Re(r, u);
|
|
1132
|
+
if (f > 0 && l == null)
|
|
1124
1133
|
break;
|
|
1125
|
-
u = await R(u,
|
|
1126
|
-
} while (
|
|
1134
|
+
u = await R(u, l), f++;
|
|
1135
|
+
} while (f < F);
|
|
1127
1136
|
}
|
|
1128
1137
|
return u;
|
|
1129
1138
|
};
|
|
1130
1139
|
t.options.persister ? t.fetchFn = () => {
|
|
1131
|
-
var
|
|
1132
|
-
return (
|
|
1133
|
-
|
|
1134
|
-
|
|
1140
|
+
var m, b;
|
|
1141
|
+
return (b = (m = t.options).persister) == null ? void 0 : b.call(
|
|
1142
|
+
m,
|
|
1143
|
+
y,
|
|
1135
1144
|
{
|
|
1136
1145
|
client: t.client,
|
|
1137
1146
|
queryKey: t.queryKey,
|
|
@@ -1140,32 +1149,32 @@ function Fe(e) {
|
|
|
1140
1149
|
},
|
|
1141
1150
|
s
|
|
1142
1151
|
);
|
|
1143
|
-
} : t.fetchFn =
|
|
1152
|
+
} : t.fetchFn = y;
|
|
1144
1153
|
}
|
|
1145
1154
|
};
|
|
1146
1155
|
}
|
|
1147
1156
|
function Re(e, { pages: t, pageParams: s }) {
|
|
1148
|
-
const
|
|
1157
|
+
const r = t.length - 1;
|
|
1149
1158
|
return t.length > 0 ? e.getNextPageParam(
|
|
1150
|
-
t[
|
|
1159
|
+
t[r],
|
|
1151
1160
|
t,
|
|
1152
|
-
s[
|
|
1161
|
+
s[r],
|
|
1153
1162
|
s
|
|
1154
1163
|
) : void 0;
|
|
1155
1164
|
}
|
|
1156
|
-
function
|
|
1157
|
-
var
|
|
1158
|
-
return t.length > 0 ? (
|
|
1165
|
+
function vs(e, { pages: t, pageParams: s }) {
|
|
1166
|
+
var r;
|
|
1167
|
+
return t.length > 0 ? (r = e.getPreviousPageParam) == null ? void 0 : r.call(e, t[0], t, s[0], s) : void 0;
|
|
1159
1168
|
}
|
|
1160
|
-
var _t, B,
|
|
1169
|
+
var _t, B, x, gt, V, Y, xe, gs = (xe = class extends Ge {
|
|
1161
1170
|
constructor(t) {
|
|
1162
1171
|
super();
|
|
1163
1172
|
c(this, V);
|
|
1164
1173
|
c(this, _t);
|
|
1165
1174
|
c(this, B);
|
|
1166
|
-
c(this,
|
|
1175
|
+
c(this, x);
|
|
1167
1176
|
c(this, gt);
|
|
1168
|
-
o(this, _t, t.client), this.mutationId = t.mutationId, o(this,
|
|
1177
|
+
o(this, _t, t.client), this.mutationId = t.mutationId, o(this, x, t.mutationCache), o(this, B, []), this.state = t.state || bs(), this.setOptions(t.options), this.scheduleGc();
|
|
1169
1178
|
}
|
|
1170
1179
|
setOptions(t) {
|
|
1171
1180
|
this.options = t, this.updateGcTime(this.options.gcTime);
|
|
@@ -1174,163 +1183,179 @@ var _t, B, A, gt, V, Y, xe, vs = (xe = class extends He {
|
|
|
1174
1183
|
return this.options.meta;
|
|
1175
1184
|
}
|
|
1176
1185
|
addObserver(t) {
|
|
1177
|
-
|
|
1186
|
+
i(this, B).includes(t) || (i(this, B).push(t), this.clearGcTimeout(), i(this, x).notify({
|
|
1178
1187
|
type: "observerAdded",
|
|
1179
1188
|
mutation: this,
|
|
1180
1189
|
observer: t
|
|
1181
1190
|
}));
|
|
1182
1191
|
}
|
|
1183
1192
|
removeObserver(t) {
|
|
1184
|
-
o(this, B,
|
|
1193
|
+
o(this, B, i(this, B).filter((s) => s !== t)), this.scheduleGc(), i(this, x).notify({
|
|
1185
1194
|
type: "observerRemoved",
|
|
1186
1195
|
mutation: this,
|
|
1187
1196
|
observer: t
|
|
1188
1197
|
});
|
|
1189
1198
|
}
|
|
1190
1199
|
optionalRemove() {
|
|
1191
|
-
|
|
1200
|
+
i(this, B).length || (this.state.status === "pending" ? this.scheduleGc() : i(this, x).remove(this));
|
|
1192
1201
|
}
|
|
1193
1202
|
continue() {
|
|
1194
1203
|
var t;
|
|
1195
|
-
return ((t =
|
|
1204
|
+
return ((t = i(this, gt)) == null ? void 0 : t.continue()) ?? // continuing a mutation assumes that variables are set, mutation must have been dehydrated before
|
|
1196
1205
|
this.execute(this.state.variables);
|
|
1197
1206
|
}
|
|
1198
1207
|
async execute(t) {
|
|
1199
|
-
var h, u,
|
|
1208
|
+
var h, u, f, y, w, d, P, p, E, m, b, S, R, F, l, D, j, Z, A, X;
|
|
1200
1209
|
const s = () => {
|
|
1201
|
-
|
|
1202
|
-
},
|
|
1203
|
-
client:
|
|
1210
|
+
v(this, V, Y).call(this, { type: "continue" });
|
|
1211
|
+
}, r = {
|
|
1212
|
+
client: i(this, _t),
|
|
1204
1213
|
meta: this.options.meta,
|
|
1205
1214
|
mutationKey: this.options.mutationKey
|
|
1206
1215
|
};
|
|
1207
|
-
o(this, gt,
|
|
1208
|
-
fn: () => this.options.mutationFn ? this.options.mutationFn(t,
|
|
1209
|
-
onFail: (C,
|
|
1210
|
-
|
|
1216
|
+
o(this, gt, He({
|
|
1217
|
+
fn: () => this.options.mutationFn ? this.options.mutationFn(t, r) : Promise.reject(new Error("No mutationFn found")),
|
|
1218
|
+
onFail: (C, Q) => {
|
|
1219
|
+
v(this, V, Y).call(this, { type: "failed", failureCount: C, error: Q });
|
|
1211
1220
|
},
|
|
1212
1221
|
onPause: () => {
|
|
1213
|
-
|
|
1222
|
+
v(this, V, Y).call(this, { type: "pause" });
|
|
1214
1223
|
},
|
|
1215
1224
|
onContinue: s,
|
|
1216
1225
|
retry: this.options.retry ?? 0,
|
|
1217
1226
|
retryDelay: this.options.retryDelay,
|
|
1218
1227
|
networkMode: this.options.networkMode,
|
|
1219
|
-
canRun: () =>
|
|
1228
|
+
canRun: () => i(this, x).canRun(this)
|
|
1220
1229
|
}));
|
|
1221
|
-
const n = this.state.status === "pending", a = !
|
|
1230
|
+
const n = this.state.status === "pending", a = !i(this, gt).canStart();
|
|
1222
1231
|
try {
|
|
1223
1232
|
if (n)
|
|
1224
1233
|
s();
|
|
1225
1234
|
else {
|
|
1226
|
-
|
|
1235
|
+
v(this, V, Y).call(this, { type: "pending", variables: t, isPaused: a }), await ((u = (h = i(this, x).config).onMutate) == null ? void 0 : u.call(
|
|
1227
1236
|
h,
|
|
1228
1237
|
t,
|
|
1229
1238
|
this,
|
|
1230
|
-
|
|
1239
|
+
r
|
|
1231
1240
|
));
|
|
1232
|
-
const
|
|
1233
|
-
|
|
1241
|
+
const Q = await ((y = (f = this.options).onMutate) == null ? void 0 : y.call(
|
|
1242
|
+
f,
|
|
1234
1243
|
t,
|
|
1235
|
-
|
|
1244
|
+
r
|
|
1236
1245
|
));
|
|
1237
|
-
|
|
1246
|
+
Q !== this.state.context && v(this, V, Y).call(this, {
|
|
1238
1247
|
type: "pending",
|
|
1239
|
-
context:
|
|
1248
|
+
context: Q,
|
|
1240
1249
|
variables: t,
|
|
1241
1250
|
isPaused: a
|
|
1242
1251
|
});
|
|
1243
1252
|
}
|
|
1244
|
-
const C = await
|
|
1245
|
-
return await ((
|
|
1246
|
-
|
|
1253
|
+
const C = await i(this, gt).start();
|
|
1254
|
+
return await ((d = (w = i(this, x).config).onSuccess) == null ? void 0 : d.call(
|
|
1255
|
+
w,
|
|
1247
1256
|
C,
|
|
1248
1257
|
t,
|
|
1249
1258
|
this.state.context,
|
|
1250
1259
|
this,
|
|
1251
|
-
|
|
1252
|
-
)), await ((
|
|
1260
|
+
r
|
|
1261
|
+
)), await ((p = (P = this.options).onSuccess) == null ? void 0 : p.call(
|
|
1253
1262
|
P,
|
|
1254
1263
|
C,
|
|
1255
1264
|
t,
|
|
1256
1265
|
this.state.context,
|
|
1257
|
-
|
|
1258
|
-
)), await ((
|
|
1259
|
-
|
|
1266
|
+
r
|
|
1267
|
+
)), await ((m = (E = i(this, x).config).onSettled) == null ? void 0 : m.call(
|
|
1268
|
+
E,
|
|
1260
1269
|
C,
|
|
1261
1270
|
null,
|
|
1262
1271
|
this.state.variables,
|
|
1263
1272
|
this.state.context,
|
|
1264
1273
|
this,
|
|
1265
|
-
|
|
1266
|
-
)), await ((
|
|
1267
|
-
|
|
1274
|
+
r
|
|
1275
|
+
)), await ((S = (b = this.options).onSettled) == null ? void 0 : S.call(
|
|
1276
|
+
b,
|
|
1268
1277
|
C,
|
|
1269
1278
|
null,
|
|
1270
1279
|
t,
|
|
1271
1280
|
this.state.context,
|
|
1272
|
-
|
|
1273
|
-
)),
|
|
1281
|
+
r
|
|
1282
|
+
)), v(this, V, Y).call(this, { type: "success", data: C }), C;
|
|
1274
1283
|
} catch (C) {
|
|
1275
1284
|
try {
|
|
1276
|
-
|
|
1285
|
+
await ((F = (R = i(this, x).config).onError) == null ? void 0 : F.call(
|
|
1277
1286
|
R,
|
|
1278
1287
|
C,
|
|
1279
1288
|
t,
|
|
1280
1289
|
this.state.context,
|
|
1281
1290
|
this,
|
|
1282
|
-
|
|
1283
|
-
))
|
|
1284
|
-
|
|
1291
|
+
r
|
|
1292
|
+
));
|
|
1293
|
+
} catch (Q) {
|
|
1294
|
+
Promise.reject(Q);
|
|
1295
|
+
}
|
|
1296
|
+
try {
|
|
1297
|
+
await ((D = (l = this.options).onError) == null ? void 0 : D.call(
|
|
1298
|
+
l,
|
|
1285
1299
|
C,
|
|
1286
1300
|
t,
|
|
1287
1301
|
this.state.context,
|
|
1288
|
-
|
|
1289
|
-
))
|
|
1290
|
-
|
|
1302
|
+
r
|
|
1303
|
+
));
|
|
1304
|
+
} catch (Q) {
|
|
1305
|
+
Promise.reject(Q);
|
|
1306
|
+
}
|
|
1307
|
+
try {
|
|
1308
|
+
await ((Z = (j = i(this, x).config).onSettled) == null ? void 0 : Z.call(
|
|
1309
|
+
j,
|
|
1291
1310
|
void 0,
|
|
1292
1311
|
C,
|
|
1293
1312
|
this.state.variables,
|
|
1294
1313
|
this.state.context,
|
|
1295
1314
|
this,
|
|
1296
|
-
|
|
1297
|
-
))
|
|
1298
|
-
|
|
1315
|
+
r
|
|
1316
|
+
));
|
|
1317
|
+
} catch (Q) {
|
|
1318
|
+
Promise.reject(Q);
|
|
1319
|
+
}
|
|
1320
|
+
try {
|
|
1321
|
+
await ((X = (A = this.options).onSettled) == null ? void 0 : X.call(
|
|
1322
|
+
A,
|
|
1299
1323
|
void 0,
|
|
1300
1324
|
C,
|
|
1301
1325
|
t,
|
|
1302
1326
|
this.state.context,
|
|
1303
|
-
|
|
1304
|
-
))
|
|
1305
|
-
}
|
|
1306
|
-
|
|
1327
|
+
r
|
|
1328
|
+
));
|
|
1329
|
+
} catch (Q) {
|
|
1330
|
+
Promise.reject(Q);
|
|
1307
1331
|
}
|
|
1332
|
+
throw v(this, V, Y).call(this, { type: "error", error: C }), C;
|
|
1308
1333
|
} finally {
|
|
1309
|
-
|
|
1334
|
+
i(this, x).runNext(this);
|
|
1310
1335
|
}
|
|
1311
1336
|
}
|
|
1312
|
-
}, _t = new WeakMap(), B = new WeakMap(),
|
|
1313
|
-
const s = (
|
|
1337
|
+
}, _t = new WeakMap(), B = new WeakMap(), x = new WeakMap(), gt = new WeakMap(), V = new WeakSet(), Y = function(t) {
|
|
1338
|
+
const s = (r) => {
|
|
1314
1339
|
switch (t.type) {
|
|
1315
1340
|
case "failed":
|
|
1316
1341
|
return {
|
|
1317
|
-
...
|
|
1342
|
+
...r,
|
|
1318
1343
|
failureCount: t.failureCount,
|
|
1319
1344
|
failureReason: t.error
|
|
1320
1345
|
};
|
|
1321
1346
|
case "pause":
|
|
1322
1347
|
return {
|
|
1323
|
-
...
|
|
1348
|
+
...r,
|
|
1324
1349
|
isPaused: !0
|
|
1325
1350
|
};
|
|
1326
1351
|
case "continue":
|
|
1327
1352
|
return {
|
|
1328
|
-
...
|
|
1353
|
+
...r,
|
|
1329
1354
|
isPaused: !1
|
|
1330
1355
|
};
|
|
1331
1356
|
case "pending":
|
|
1332
1357
|
return {
|
|
1333
|
-
...
|
|
1358
|
+
...r,
|
|
1334
1359
|
context: t.context,
|
|
1335
1360
|
data: void 0,
|
|
1336
1361
|
failureCount: 0,
|
|
@@ -1343,7 +1368,7 @@ var _t, B, A, gt, V, Y, xe, vs = (xe = class extends He {
|
|
|
1343
1368
|
};
|
|
1344
1369
|
case "success":
|
|
1345
1370
|
return {
|
|
1346
|
-
...
|
|
1371
|
+
...r,
|
|
1347
1372
|
data: t.data,
|
|
1348
1373
|
failureCount: 0,
|
|
1349
1374
|
failureReason: null,
|
|
@@ -1353,27 +1378,27 @@ var _t, B, A, gt, V, Y, xe, vs = (xe = class extends He {
|
|
|
1353
1378
|
};
|
|
1354
1379
|
case "error":
|
|
1355
1380
|
return {
|
|
1356
|
-
...
|
|
1381
|
+
...r,
|
|
1357
1382
|
data: void 0,
|
|
1358
1383
|
error: t.error,
|
|
1359
|
-
failureCount:
|
|
1384
|
+
failureCount: r.failureCount + 1,
|
|
1360
1385
|
failureReason: t.error,
|
|
1361
1386
|
isPaused: !1,
|
|
1362
1387
|
status: "error"
|
|
1363
1388
|
};
|
|
1364
1389
|
}
|
|
1365
1390
|
};
|
|
1366
|
-
this.state = s(this.state),
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
}),
|
|
1391
|
+
this.state = s(this.state), I.batch(() => {
|
|
1392
|
+
i(this, B).forEach((r) => {
|
|
1393
|
+
r.onMutationUpdate(t);
|
|
1394
|
+
}), i(this, x).notify({
|
|
1370
1395
|
mutation: this,
|
|
1371
1396
|
type: "updated",
|
|
1372
1397
|
action: t
|
|
1373
1398
|
});
|
|
1374
1399
|
});
|
|
1375
1400
|
}, xe);
|
|
1376
|
-
function
|
|
1401
|
+
function bs() {
|
|
1377
1402
|
return {
|
|
1378
1403
|
context: void 0,
|
|
1379
1404
|
data: void 0,
|
|
@@ -1386,7 +1411,7 @@ function gs() {
|
|
|
1386
1411
|
submittedAt: 0
|
|
1387
1412
|
};
|
|
1388
1413
|
}
|
|
1389
|
-
var J, H, kt,
|
|
1414
|
+
var J, H, kt, je, ws = (je = class extends Kt {
|
|
1390
1415
|
constructor(t = {}) {
|
|
1391
1416
|
super();
|
|
1392
1417
|
c(this, J);
|
|
@@ -1394,35 +1419,35 @@ var J, H, kt, Ue, bs = (Ue = class extends Kt {
|
|
|
1394
1419
|
c(this, kt);
|
|
1395
1420
|
this.config = t, o(this, J, /* @__PURE__ */ new Set()), o(this, H, /* @__PURE__ */ new Map()), o(this, kt, 0);
|
|
1396
1421
|
}
|
|
1397
|
-
build(t, s,
|
|
1398
|
-
const n = new
|
|
1422
|
+
build(t, s, r) {
|
|
1423
|
+
const n = new gs({
|
|
1399
1424
|
client: t,
|
|
1400
1425
|
mutationCache: this,
|
|
1401
1426
|
mutationId: ++Ht(this, kt)._,
|
|
1402
1427
|
options: t.defaultMutationOptions(s),
|
|
1403
|
-
state:
|
|
1428
|
+
state: r
|
|
1404
1429
|
});
|
|
1405
1430
|
return this.add(n), n;
|
|
1406
1431
|
}
|
|
1407
1432
|
add(t) {
|
|
1408
|
-
|
|
1433
|
+
i(this, J).add(t);
|
|
1409
1434
|
const s = Bt(t);
|
|
1410
1435
|
if (typeof s == "string") {
|
|
1411
|
-
const
|
|
1412
|
-
|
|
1436
|
+
const r = i(this, H).get(s);
|
|
1437
|
+
r ? r.push(t) : i(this, H).set(s, [t]);
|
|
1413
1438
|
}
|
|
1414
1439
|
this.notify({ type: "added", mutation: t });
|
|
1415
1440
|
}
|
|
1416
1441
|
remove(t) {
|
|
1417
|
-
if (
|
|
1442
|
+
if (i(this, J).delete(t)) {
|
|
1418
1443
|
const s = Bt(t);
|
|
1419
1444
|
if (typeof s == "string") {
|
|
1420
|
-
const
|
|
1421
|
-
if (
|
|
1422
|
-
if (
|
|
1423
|
-
const n =
|
|
1424
|
-
n !== -1 &&
|
|
1425
|
-
} else
|
|
1445
|
+
const r = i(this, H).get(s);
|
|
1446
|
+
if (r)
|
|
1447
|
+
if (r.length > 1) {
|
|
1448
|
+
const n = r.indexOf(t);
|
|
1449
|
+
n !== -1 && r.splice(n, 1);
|
|
1450
|
+
} else r[0] === t && i(this, H).delete(s);
|
|
1426
1451
|
}
|
|
1427
1452
|
}
|
|
1428
1453
|
this.notify({ type: "removed", mutation: t });
|
|
@@ -1430,7 +1455,7 @@ var J, H, kt, Ue, bs = (Ue = class extends Kt {
|
|
|
1430
1455
|
canRun(t) {
|
|
1431
1456
|
const s = Bt(t);
|
|
1432
1457
|
if (typeof s == "string") {
|
|
1433
|
-
const
|
|
1458
|
+
const r = i(this, H).get(s), n = r == null ? void 0 : r.find(
|
|
1434
1459
|
(a) => a.state.status === "pending"
|
|
1435
1460
|
);
|
|
1436
1461
|
return !n || n === t;
|
|
@@ -1438,35 +1463,35 @@ var J, H, kt, Ue, bs = (Ue = class extends Kt {
|
|
|
1438
1463
|
return !0;
|
|
1439
1464
|
}
|
|
1440
1465
|
runNext(t) {
|
|
1441
|
-
var
|
|
1466
|
+
var r;
|
|
1442
1467
|
const s = Bt(t);
|
|
1443
1468
|
if (typeof s == "string") {
|
|
1444
|
-
const n = (
|
|
1469
|
+
const n = (r = i(this, H).get(s)) == null ? void 0 : r.find((a) => a !== t && a.state.isPaused);
|
|
1445
1470
|
return (n == null ? void 0 : n.continue()) ?? Promise.resolve();
|
|
1446
1471
|
} else
|
|
1447
1472
|
return Promise.resolve();
|
|
1448
1473
|
}
|
|
1449
1474
|
clear() {
|
|
1450
|
-
|
|
1451
|
-
|
|
1475
|
+
I.batch(() => {
|
|
1476
|
+
i(this, J).forEach((t) => {
|
|
1452
1477
|
this.notify({ type: "removed", mutation: t });
|
|
1453
|
-
}),
|
|
1478
|
+
}), i(this, J).clear(), i(this, H).clear();
|
|
1454
1479
|
});
|
|
1455
1480
|
}
|
|
1456
1481
|
getAll() {
|
|
1457
|
-
return Array.from(
|
|
1482
|
+
return Array.from(i(this, J));
|
|
1458
1483
|
}
|
|
1459
1484
|
find(t) {
|
|
1460
1485
|
const s = { exact: !0, ...t };
|
|
1461
1486
|
return this.getAll().find(
|
|
1462
|
-
(
|
|
1487
|
+
(r) => be(s, r)
|
|
1463
1488
|
);
|
|
1464
1489
|
}
|
|
1465
1490
|
findAll(t = {}) {
|
|
1466
1491
|
return this.getAll().filter((s) => be(t, s));
|
|
1467
1492
|
}
|
|
1468
1493
|
notify(t) {
|
|
1469
|
-
|
|
1494
|
+
I.batch(() => {
|
|
1470
1495
|
this.listeners.forEach((s) => {
|
|
1471
1496
|
s(t);
|
|
1472
1497
|
});
|
|
@@ -1474,90 +1499,90 @@ var J, H, kt, Ue, bs = (Ue = class extends Kt {
|
|
|
1474
1499
|
}
|
|
1475
1500
|
resumePausedMutations() {
|
|
1476
1501
|
const t = this.getAll().filter((s) => s.state.isPaused);
|
|
1477
|
-
return
|
|
1502
|
+
return I.batch(
|
|
1478
1503
|
() => Promise.all(
|
|
1479
|
-
t.map((s) => s.continue().catch(
|
|
1504
|
+
t.map((s) => s.continue().catch(N))
|
|
1480
1505
|
)
|
|
1481
1506
|
);
|
|
1482
1507
|
}
|
|
1483
|
-
}, J = new WeakMap(), H = new WeakMap(), kt = new WeakMap(),
|
|
1508
|
+
}, J = new WeakMap(), H = new WeakMap(), kt = new WeakMap(), je);
|
|
1484
1509
|
function Bt(e) {
|
|
1485
1510
|
var t;
|
|
1486
1511
|
return (t = e.options.scope) == null ? void 0 : t.id;
|
|
1487
1512
|
}
|
|
1488
|
-
var z,
|
|
1513
|
+
var z, Ue, Ss = (Ue = class extends Kt {
|
|
1489
1514
|
constructor(t = {}) {
|
|
1490
1515
|
super();
|
|
1491
1516
|
c(this, z);
|
|
1492
1517
|
this.config = t, o(this, z, /* @__PURE__ */ new Map());
|
|
1493
1518
|
}
|
|
1494
|
-
build(t, s,
|
|
1519
|
+
build(t, s, r) {
|
|
1495
1520
|
const n = s.queryKey, a = s.queryHash ?? de(n, s);
|
|
1496
1521
|
let h = this.get(a);
|
|
1497
|
-
return h || (h = new
|
|
1522
|
+
return h || (h = new fs({
|
|
1498
1523
|
client: t,
|
|
1499
1524
|
queryKey: n,
|
|
1500
1525
|
queryHash: a,
|
|
1501
1526
|
options: t.defaultQueryOptions(s),
|
|
1502
|
-
state:
|
|
1527
|
+
state: r,
|
|
1503
1528
|
defaultOptions: t.getQueryDefaults(n)
|
|
1504
1529
|
}), this.add(h)), h;
|
|
1505
1530
|
}
|
|
1506
1531
|
add(t) {
|
|
1507
|
-
|
|
1532
|
+
i(this, z).has(t.queryHash) || (i(this, z).set(t.queryHash, t), this.notify({
|
|
1508
1533
|
type: "added",
|
|
1509
1534
|
query: t
|
|
1510
1535
|
}));
|
|
1511
1536
|
}
|
|
1512
1537
|
remove(t) {
|
|
1513
|
-
const s =
|
|
1514
|
-
s && (t.destroy(), s === t &&
|
|
1538
|
+
const s = i(this, z).get(t.queryHash);
|
|
1539
|
+
s && (t.destroy(), s === t && i(this, z).delete(t.queryHash), this.notify({ type: "removed", query: t }));
|
|
1515
1540
|
}
|
|
1516
1541
|
clear() {
|
|
1517
|
-
|
|
1542
|
+
I.batch(() => {
|
|
1518
1543
|
this.getAll().forEach((t) => {
|
|
1519
1544
|
this.remove(t);
|
|
1520
1545
|
});
|
|
1521
1546
|
});
|
|
1522
1547
|
}
|
|
1523
1548
|
get(t) {
|
|
1524
|
-
return
|
|
1549
|
+
return i(this, z).get(t);
|
|
1525
1550
|
}
|
|
1526
1551
|
getAll() {
|
|
1527
|
-
return [...
|
|
1552
|
+
return [...i(this, z).values()];
|
|
1528
1553
|
}
|
|
1529
1554
|
find(t) {
|
|
1530
1555
|
const s = { exact: !0, ...t };
|
|
1531
1556
|
return this.getAll().find(
|
|
1532
|
-
(
|
|
1557
|
+
(r) => ge(s, r)
|
|
1533
1558
|
);
|
|
1534
1559
|
}
|
|
1535
1560
|
findAll(t = {}) {
|
|
1536
1561
|
const s = this.getAll();
|
|
1537
|
-
return Object.keys(t).length > 0 ? s.filter((
|
|
1562
|
+
return Object.keys(t).length > 0 ? s.filter((r) => ge(t, r)) : s;
|
|
1538
1563
|
}
|
|
1539
1564
|
notify(t) {
|
|
1540
|
-
|
|
1565
|
+
I.batch(() => {
|
|
1541
1566
|
this.listeners.forEach((s) => {
|
|
1542
1567
|
s(t);
|
|
1543
1568
|
});
|
|
1544
1569
|
});
|
|
1545
1570
|
}
|
|
1546
1571
|
onFocus() {
|
|
1547
|
-
|
|
1572
|
+
I.batch(() => {
|
|
1548
1573
|
this.getAll().forEach((t) => {
|
|
1549
1574
|
t.onFocus();
|
|
1550
1575
|
});
|
|
1551
1576
|
});
|
|
1552
1577
|
}
|
|
1553
1578
|
onOnline() {
|
|
1554
|
-
|
|
1579
|
+
I.batch(() => {
|
|
1555
1580
|
this.getAll().forEach((t) => {
|
|
1556
1581
|
t.onOnline();
|
|
1557
1582
|
});
|
|
1558
1583
|
});
|
|
1559
1584
|
}
|
|
1560
|
-
}, z = new WeakMap(),
|
|
1585
|
+
}, z = new WeakMap(), Ue), M, it, nt, Qt, Dt, at, Tt, It, Ne, Cs = (Ne = class {
|
|
1561
1586
|
constructor(e = {}) {
|
|
1562
1587
|
c(this, M);
|
|
1563
1588
|
c(this, it);
|
|
@@ -1567,24 +1592,24 @@ var z, je, ws = (je = class extends Kt {
|
|
|
1567
1592
|
c(this, at);
|
|
1568
1593
|
c(this, Tt);
|
|
1569
1594
|
c(this, It);
|
|
1570
|
-
o(this, M, e.queryCache || new
|
|
1595
|
+
o(this, M, e.queryCache || new Ss()), o(this, it, e.mutationCache || new ws()), o(this, nt, e.defaultOptions || {}), o(this, Qt, /* @__PURE__ */ new Map()), o(this, Dt, /* @__PURE__ */ new Map()), o(this, at, 0);
|
|
1571
1596
|
}
|
|
1572
1597
|
mount() {
|
|
1573
|
-
Ht(this, at)._++,
|
|
1574
|
-
e && (await this.resumePausedMutations(),
|
|
1598
|
+
Ht(this, at)._++, i(this, at) === 1 && (o(this, Tt, fe.subscribe(async (e) => {
|
|
1599
|
+
e && (await this.resumePausedMutations(), i(this, M).onFocus());
|
|
1575
1600
|
})), o(this, It, $t.subscribe(async (e) => {
|
|
1576
|
-
e && (await this.resumePausedMutations(),
|
|
1601
|
+
e && (await this.resumePausedMutations(), i(this, M).onOnline());
|
|
1577
1602
|
})));
|
|
1578
1603
|
}
|
|
1579
1604
|
unmount() {
|
|
1580
1605
|
var e, t;
|
|
1581
|
-
Ht(this, at)._--,
|
|
1606
|
+
Ht(this, at)._--, i(this, at) === 0 && ((e = i(this, Tt)) == null || e.call(this), o(this, Tt, void 0), (t = i(this, It)) == null || t.call(this), o(this, It, void 0));
|
|
1582
1607
|
}
|
|
1583
1608
|
isFetching(e) {
|
|
1584
|
-
return
|
|
1609
|
+
return i(this, M).findAll({ ...e, fetchStatus: "fetching" }).length;
|
|
1585
1610
|
}
|
|
1586
1611
|
isMutating(e) {
|
|
1587
|
-
return
|
|
1612
|
+
return i(this, it).findAll({ ...e, status: "pending" }).length;
|
|
1588
1613
|
}
|
|
1589
1614
|
/**
|
|
1590
1615
|
* Imperative (non-reactive) way to retrieve data for a QueryKey.
|
|
@@ -1596,52 +1621,52 @@ var z, je, ws = (je = class extends Kt {
|
|
|
1596
1621
|
getQueryData(e) {
|
|
1597
1622
|
var s;
|
|
1598
1623
|
const t = this.defaultQueryOptions({ queryKey: e });
|
|
1599
|
-
return (s =
|
|
1624
|
+
return (s = i(this, M).get(t.queryHash)) == null ? void 0 : s.state.data;
|
|
1600
1625
|
}
|
|
1601
1626
|
ensureQueryData(e) {
|
|
1602
|
-
const t = this.defaultQueryOptions(e), s =
|
|
1603
|
-
return
|
|
1627
|
+
const t = this.defaultQueryOptions(e), s = i(this, M).build(this, t), r = s.state.data;
|
|
1628
|
+
return r === void 0 ? this.fetchQuery(e) : (e.revalidateIfStale && s.isStaleByTime(ot(t.staleTime, s)) && this.prefetchQuery(t), Promise.resolve(r));
|
|
1604
1629
|
}
|
|
1605
1630
|
getQueriesData(e) {
|
|
1606
|
-
return
|
|
1607
|
-
const
|
|
1608
|
-
return [t,
|
|
1631
|
+
return i(this, M).findAll(e).map(({ queryKey: t, state: s }) => {
|
|
1632
|
+
const r = s.data;
|
|
1633
|
+
return [t, r];
|
|
1609
1634
|
});
|
|
1610
1635
|
}
|
|
1611
1636
|
setQueryData(e, t, s) {
|
|
1612
|
-
const
|
|
1613
|
-
|
|
1614
|
-
), a = n == null ? void 0 : n.state.data, h =
|
|
1637
|
+
const r = this.defaultQueryOptions({ queryKey: e }), n = i(this, M).get(
|
|
1638
|
+
r.queryHash
|
|
1639
|
+
), a = n == null ? void 0 : n.state.data, h = ss(t, a);
|
|
1615
1640
|
if (h !== void 0)
|
|
1616
|
-
return
|
|
1641
|
+
return i(this, M).build(this, r).setData(h, { ...s, manual: !0 });
|
|
1617
1642
|
}
|
|
1618
1643
|
setQueriesData(e, t, s) {
|
|
1619
|
-
return
|
|
1620
|
-
() =>
|
|
1621
|
-
|
|
1622
|
-
this.setQueryData(
|
|
1644
|
+
return I.batch(
|
|
1645
|
+
() => i(this, M).findAll(e).map(({ queryKey: r }) => [
|
|
1646
|
+
r,
|
|
1647
|
+
this.setQueryData(r, t, s)
|
|
1623
1648
|
])
|
|
1624
1649
|
);
|
|
1625
1650
|
}
|
|
1626
1651
|
getQueryState(e) {
|
|
1627
1652
|
var s;
|
|
1628
1653
|
const t = this.defaultQueryOptions({ queryKey: e });
|
|
1629
|
-
return (s =
|
|
1654
|
+
return (s = i(this, M).get(
|
|
1630
1655
|
t.queryHash
|
|
1631
1656
|
)) == null ? void 0 : s.state;
|
|
1632
1657
|
}
|
|
1633
1658
|
removeQueries(e) {
|
|
1634
|
-
const t =
|
|
1635
|
-
|
|
1659
|
+
const t = i(this, M);
|
|
1660
|
+
I.batch(() => {
|
|
1636
1661
|
t.findAll(e).forEach((s) => {
|
|
1637
1662
|
t.remove(s);
|
|
1638
1663
|
});
|
|
1639
1664
|
});
|
|
1640
1665
|
}
|
|
1641
1666
|
resetQueries(e, t) {
|
|
1642
|
-
const s =
|
|
1643
|
-
return
|
|
1644
|
-
|
|
1667
|
+
const s = i(this, M);
|
|
1668
|
+
return I.batch(() => (s.findAll(e).forEach((r) => {
|
|
1669
|
+
r.reset();
|
|
1645
1670
|
}), this.refetchQueries(
|
|
1646
1671
|
{
|
|
1647
1672
|
type: "active",
|
|
@@ -1651,13 +1676,13 @@ var z, je, ws = (je = class extends Kt {
|
|
|
1651
1676
|
)));
|
|
1652
1677
|
}
|
|
1653
1678
|
cancelQueries(e, t = {}) {
|
|
1654
|
-
const s = { revert: !0, ...t },
|
|
1655
|
-
() =>
|
|
1679
|
+
const s = { revert: !0, ...t }, r = I.batch(
|
|
1680
|
+
() => i(this, M).findAll(e).map((n) => n.cancel(s))
|
|
1656
1681
|
);
|
|
1657
|
-
return Promise.all(
|
|
1682
|
+
return Promise.all(r).then(N).catch(N);
|
|
1658
1683
|
}
|
|
1659
1684
|
invalidateQueries(e, t = {}) {
|
|
1660
|
-
return
|
|
1685
|
+
return I.batch(() => (i(this, M).findAll(e).forEach((s) => {
|
|
1661
1686
|
s.invalidate();
|
|
1662
1687
|
}), (e == null ? void 0 : e.refetchType) === "none" ? Promise.resolve() : this.refetchQueries(
|
|
1663
1688
|
{
|
|
@@ -1671,78 +1696,78 @@ var z, je, ws = (je = class extends Kt {
|
|
|
1671
1696
|
const s = {
|
|
1672
1697
|
...t,
|
|
1673
1698
|
cancelRefetch: t.cancelRefetch ?? !0
|
|
1674
|
-
},
|
|
1675
|
-
() =>
|
|
1699
|
+
}, r = I.batch(
|
|
1700
|
+
() => i(this, M).findAll(e).filter((n) => !n.isDisabled() && !n.isStatic()).map((n) => {
|
|
1676
1701
|
let a = n.fetch(void 0, s);
|
|
1677
|
-
return s.throwOnError || (a = a.catch(
|
|
1702
|
+
return s.throwOnError || (a = a.catch(N)), n.state.fetchStatus === "paused" ? Promise.resolve() : a;
|
|
1678
1703
|
})
|
|
1679
1704
|
);
|
|
1680
|
-
return Promise.all(
|
|
1705
|
+
return Promise.all(r).then(N);
|
|
1681
1706
|
}
|
|
1682
1707
|
fetchQuery(e) {
|
|
1683
1708
|
const t = this.defaultQueryOptions(e);
|
|
1684
1709
|
t.retry === void 0 && (t.retry = !1);
|
|
1685
|
-
const s =
|
|
1710
|
+
const s = i(this, M).build(this, t);
|
|
1686
1711
|
return s.isStaleByTime(
|
|
1687
1712
|
ot(t.staleTime, s)
|
|
1688
1713
|
) ? s.fetch(t) : Promise.resolve(s.state.data);
|
|
1689
1714
|
}
|
|
1690
1715
|
prefetchQuery(e) {
|
|
1691
|
-
return this.fetchQuery(e).then(
|
|
1716
|
+
return this.fetchQuery(e).then(N).catch(N);
|
|
1692
1717
|
}
|
|
1693
1718
|
fetchInfiniteQuery(e) {
|
|
1694
1719
|
return e.behavior = Fe(e.pages), this.fetchQuery(e);
|
|
1695
1720
|
}
|
|
1696
1721
|
prefetchInfiniteQuery(e) {
|
|
1697
|
-
return this.fetchInfiniteQuery(e).then(
|
|
1722
|
+
return this.fetchInfiniteQuery(e).then(N).catch(N);
|
|
1698
1723
|
}
|
|
1699
1724
|
ensureInfiniteQueryData(e) {
|
|
1700
1725
|
return e.behavior = Fe(e.pages), this.ensureQueryData(e);
|
|
1701
1726
|
}
|
|
1702
1727
|
resumePausedMutations() {
|
|
1703
|
-
return $t.isOnline() ?
|
|
1728
|
+
return $t.isOnline() ? i(this, it).resumePausedMutations() : Promise.resolve();
|
|
1704
1729
|
}
|
|
1705
1730
|
getQueryCache() {
|
|
1706
|
-
return
|
|
1731
|
+
return i(this, M);
|
|
1707
1732
|
}
|
|
1708
1733
|
getMutationCache() {
|
|
1709
|
-
return
|
|
1734
|
+
return i(this, it);
|
|
1710
1735
|
}
|
|
1711
1736
|
getDefaultOptions() {
|
|
1712
|
-
return
|
|
1737
|
+
return i(this, nt);
|
|
1713
1738
|
}
|
|
1714
1739
|
setDefaultOptions(e) {
|
|
1715
1740
|
o(this, nt, e);
|
|
1716
1741
|
}
|
|
1717
1742
|
setQueryDefaults(e, t) {
|
|
1718
|
-
|
|
1743
|
+
i(this, Qt).set(qt(e), {
|
|
1719
1744
|
queryKey: e,
|
|
1720
1745
|
defaultOptions: t
|
|
1721
1746
|
});
|
|
1722
1747
|
}
|
|
1723
1748
|
getQueryDefaults(e) {
|
|
1724
|
-
const t = [...
|
|
1725
|
-
return t.forEach((
|
|
1726
|
-
xt(e,
|
|
1749
|
+
const t = [...i(this, Qt).values()], s = {};
|
|
1750
|
+
return t.forEach((r) => {
|
|
1751
|
+
xt(e, r.queryKey) && Object.assign(s, r.defaultOptions);
|
|
1727
1752
|
}), s;
|
|
1728
1753
|
}
|
|
1729
1754
|
setMutationDefaults(e, t) {
|
|
1730
|
-
|
|
1755
|
+
i(this, Dt).set(qt(e), {
|
|
1731
1756
|
mutationKey: e,
|
|
1732
1757
|
defaultOptions: t
|
|
1733
1758
|
});
|
|
1734
1759
|
}
|
|
1735
1760
|
getMutationDefaults(e) {
|
|
1736
|
-
const t = [...
|
|
1737
|
-
return t.forEach((
|
|
1738
|
-
xt(e,
|
|
1761
|
+
const t = [...i(this, Dt).values()], s = {};
|
|
1762
|
+
return t.forEach((r) => {
|
|
1763
|
+
xt(e, r.mutationKey) && Object.assign(s, r.defaultOptions);
|
|
1739
1764
|
}), s;
|
|
1740
1765
|
}
|
|
1741
1766
|
defaultQueryOptions(e) {
|
|
1742
1767
|
if (e._defaulted)
|
|
1743
1768
|
return e;
|
|
1744
1769
|
const t = {
|
|
1745
|
-
...
|
|
1770
|
+
...i(this, nt).queries,
|
|
1746
1771
|
...this.getQueryDefaults(e.queryKey),
|
|
1747
1772
|
...e,
|
|
1748
1773
|
_defaulted: !0
|
|
@@ -1754,30 +1779,30 @@ var z, je, ws = (je = class extends Kt {
|
|
|
1754
1779
|
}
|
|
1755
1780
|
defaultMutationOptions(e) {
|
|
1756
1781
|
return e != null && e._defaulted ? e : {
|
|
1757
|
-
...
|
|
1782
|
+
...i(this, nt).mutations,
|
|
1758
1783
|
...(e == null ? void 0 : e.mutationKey) && this.getMutationDefaults(e.mutationKey),
|
|
1759
1784
|
...e,
|
|
1760
1785
|
_defaulted: !0
|
|
1761
1786
|
};
|
|
1762
1787
|
}
|
|
1763
1788
|
clear() {
|
|
1764
|
-
|
|
1789
|
+
i(this, M).clear(), i(this, it).clear();
|
|
1765
1790
|
}
|
|
1766
|
-
}, M = new WeakMap(), it = new WeakMap(), nt = new WeakMap(), Qt = new WeakMap(), Dt = new WeakMap(), at = new WeakMap(), Tt = new WeakMap(), It = new WeakMap(), Ne),
|
|
1791
|
+
}, M = new WeakMap(), it = new WeakMap(), nt = new WeakMap(), Qt = new WeakMap(), Dt = new WeakMap(), at = new WeakMap(), Tt = new WeakMap(), It = new WeakMap(), Ne), ze = K.createContext(
|
|
1767
1792
|
void 0
|
|
1768
|
-
),
|
|
1769
|
-
const t = K.useContext(
|
|
1793
|
+
), Os = (e) => {
|
|
1794
|
+
const t = K.useContext(ze);
|
|
1770
1795
|
if (!t)
|
|
1771
1796
|
throw new Error("No QueryClient set, use QueryClientProvider to set one");
|
|
1772
1797
|
return t;
|
|
1773
|
-
},
|
|
1798
|
+
}, Ps = ({
|
|
1774
1799
|
client: e,
|
|
1775
1800
|
children: t
|
|
1776
1801
|
}) => (K.useEffect(() => (e.mount(), () => {
|
|
1777
1802
|
e.unmount();
|
|
1778
|
-
}), [e]), /* @__PURE__ */ Vt(
|
|
1779
|
-
|
|
1780
|
-
function
|
|
1803
|
+
}), [e]), /* @__PURE__ */ Vt(ze.Provider, { value: e, children: t })), $e = K.createContext(!1), Es = () => K.useContext($e);
|
|
1804
|
+
$e.Provider;
|
|
1805
|
+
function Fs() {
|
|
1781
1806
|
let e = !1;
|
|
1782
1807
|
return {
|
|
1783
1808
|
clearReset: () => {
|
|
@@ -1789,92 +1814,95 @@ function Es() {
|
|
|
1789
1814
|
isReset: () => e
|
|
1790
1815
|
};
|
|
1791
1816
|
}
|
|
1792
|
-
var
|
|
1793
|
-
|
|
1794
|
-
|
|
1817
|
+
var Rs = K.createContext(Fs()), Ms = () => K.useContext(Rs), Qs = (e, t, s) => {
|
|
1818
|
+
const r = s != null && s.state.error && typeof e.throwOnError == "function" ? Ke(e.throwOnError, [s.state.error, s]) : e.throwOnError;
|
|
1819
|
+
(e.suspense || e.experimental_prefetchInRender || r) && (t.isReset() || (e.retryOnMount = !1));
|
|
1820
|
+
}, Ds = (e) => {
|
|
1795
1821
|
K.useEffect(() => {
|
|
1796
1822
|
e.clearReset();
|
|
1797
1823
|
}, [e]);
|
|
1798
|
-
},
|
|
1824
|
+
}, Ts = ({
|
|
1799
1825
|
result: e,
|
|
1800
1826
|
errorResetBoundary: t,
|
|
1801
1827
|
throwOnError: s,
|
|
1802
|
-
query:
|
|
1828
|
+
query: r,
|
|
1803
1829
|
suspense: n
|
|
1804
|
-
}) => e.isError && !t.isReset() && !e.isFetching &&
|
|
1830
|
+
}) => e.isError && !t.isReset() && !e.isFetching && r && (n && e.data === void 0 || Ke(s, [e.error, r])), Is = (e) => {
|
|
1805
1831
|
if (e.suspense) {
|
|
1806
|
-
const s = (n) => n === "static" ? n : Math.max(n ?? 1e3, 1e3),
|
|
1807
|
-
e.staleTime = typeof
|
|
1832
|
+
const s = (n) => n === "static" ? n : Math.max(n ?? 1e3, 1e3), r = e.staleTime;
|
|
1833
|
+
e.staleTime = typeof r == "function" ? (...n) => s(r(...n)) : s(r), typeof e.gcTime == "number" && (e.gcTime = Math.max(
|
|
1808
1834
|
e.gcTime,
|
|
1809
1835
|
1e3
|
|
1810
1836
|
));
|
|
1811
1837
|
}
|
|
1812
|
-
},
|
|
1838
|
+
}, As = (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
1839
|
s.clearReset();
|
|
1814
1840
|
});
|
|
1815
|
-
function
|
|
1816
|
-
var
|
|
1841
|
+
function xs(e, t, s) {
|
|
1842
|
+
var P, p, E, m;
|
|
1817
1843
|
if (process.env.NODE_ENV !== "production" && (typeof e != "object" || Array.isArray(e)))
|
|
1818
1844
|
throw new Error(
|
|
1819
1845
|
'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
1846
|
);
|
|
1821
|
-
const
|
|
1822
|
-
(
|
|
1823
|
-
|
|
1847
|
+
const r = Es(), n = Ms(), a = Os(), h = a.defaultQueryOptions(e);
|
|
1848
|
+
(p = (P = a.getDefaultOptions().queries) == null ? void 0 : P._experimental_beforeQuery) == null || p.call(
|
|
1849
|
+
P,
|
|
1824
1850
|
h
|
|
1825
|
-
)
|
|
1851
|
+
);
|
|
1852
|
+
const u = a.getQueryCache().get(h.queryHash);
|
|
1853
|
+
process.env.NODE_ENV !== "production" && (h.queryFn || console.error(
|
|
1826
1854
|
`[${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
|
-
)), h._optimisticResults =
|
|
1828
|
-
const
|
|
1855
|
+
)), h._optimisticResults = r ? "isRestoring" : "optimistic", Is(h), Qs(h, n, u), Ds(n);
|
|
1856
|
+
const f = !a.getQueryCache().get(h.queryHash), [y] = K.useState(
|
|
1829
1857
|
() => new t(
|
|
1830
1858
|
a,
|
|
1831
1859
|
h
|
|
1832
1860
|
)
|
|
1833
|
-
),
|
|
1861
|
+
), w = y.getOptimisticResult(h), d = !r && e.subscribed !== !1;
|
|
1834
1862
|
if (K.useSyncExternalStore(
|
|
1835
1863
|
K.useCallback(
|
|
1836
|
-
(
|
|
1837
|
-
const
|
|
1838
|
-
return
|
|
1864
|
+
(b) => {
|
|
1865
|
+
const S = d ? y.subscribe(I.batchCalls(b)) : N;
|
|
1866
|
+
return y.updateResult(), S;
|
|
1839
1867
|
},
|
|
1840
|
-
[
|
|
1868
|
+
[y, d]
|
|
1841
1869
|
),
|
|
1842
|
-
() =>
|
|
1843
|
-
() =>
|
|
1870
|
+
() => y.getCurrentResult(),
|
|
1871
|
+
() => y.getCurrentResult()
|
|
1844
1872
|
), K.useEffect(() => {
|
|
1845
|
-
|
|
1846
|
-
}, [h,
|
|
1847
|
-
throw Me(h,
|
|
1848
|
-
if (
|
|
1849
|
-
result:
|
|
1873
|
+
y.setOptions(h);
|
|
1874
|
+
}, [h, y]), qs(h, w))
|
|
1875
|
+
throw Me(h, y, n);
|
|
1876
|
+
if (Ts({
|
|
1877
|
+
result: w,
|
|
1850
1878
|
errorResetBoundary: n,
|
|
1851
1879
|
throwOnError: h.throwOnError,
|
|
1852
|
-
query:
|
|
1880
|
+
query: u,
|
|
1853
1881
|
suspense: h.suspense
|
|
1854
1882
|
}))
|
|
1855
|
-
throw
|
|
1856
|
-
if ((
|
|
1857
|
-
|
|
1883
|
+
throw w.error;
|
|
1884
|
+
if ((m = (E = a.getDefaultOptions().queries) == null ? void 0 : E._experimental_afterQuery) == null || m.call(
|
|
1885
|
+
E,
|
|
1858
1886
|
h,
|
|
1859
|
-
|
|
1860
|
-
), h.experimental_prefetchInRender && !bt &&
|
|
1861
|
-
const
|
|
1887
|
+
w
|
|
1888
|
+
), h.experimental_prefetchInRender && !bt && As(w, r)) {
|
|
1889
|
+
const b = f ? (
|
|
1862
1890
|
// Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted
|
|
1863
|
-
Me(h,
|
|
1891
|
+
Me(h, y, n)
|
|
1864
1892
|
) : (
|
|
1865
1893
|
// subscribe to the "cache promise" so that we can finalize the currentThenable once data comes in
|
|
1866
|
-
|
|
1894
|
+
u == null ? void 0 : u.promise
|
|
1867
1895
|
);
|
|
1868
|
-
|
|
1869
|
-
|
|
1896
|
+
b == null || b.catch(N).finally(() => {
|
|
1897
|
+
y.updateResult();
|
|
1870
1898
|
});
|
|
1871
1899
|
}
|
|
1872
|
-
return h.notifyOnChangeProps ?
|
|
1900
|
+
return h.notifyOnChangeProps ? w : y.trackResult(w);
|
|
1873
1901
|
}
|
|
1874
|
-
function
|
|
1875
|
-
return
|
|
1902
|
+
function js(e, t) {
|
|
1903
|
+
return xs(e, ys);
|
|
1876
1904
|
}
|
|
1877
|
-
const Us =
|
|
1905
|
+
const Us = We(void 0), Ns = new Cs({
|
|
1878
1906
|
defaultOptions: {
|
|
1879
1907
|
queries: {
|
|
1880
1908
|
retry: 1,
|
|
@@ -1884,19 +1912,19 @@ const Us = $e(void 0), js = new Cs({
|
|
|
1884
1912
|
}
|
|
1885
1913
|
}
|
|
1886
1914
|
});
|
|
1887
|
-
function
|
|
1915
|
+
function _s({
|
|
1888
1916
|
fetchSchedule: e,
|
|
1889
1917
|
initialSchedule: t = [],
|
|
1890
1918
|
weeks: s,
|
|
1891
|
-
handleDateChanged:
|
|
1919
|
+
handleDateChanged: r = () => !0,
|
|
1892
1920
|
children: n
|
|
1893
1921
|
}) {
|
|
1894
|
-
const [a, h] = me(s[0][0].date), [u,
|
|
1922
|
+
const [a, h] = me(s[0][0].date), [u, f] = me(!1), y = Je(Jt(s[0][0].date, "yyyy-MM-dd"));
|
|
1895
1923
|
Gt.setComponent("ScheduleContext"), Gt.log("ScheduleProvider initialized with date: ", a);
|
|
1896
|
-
const
|
|
1897
|
-
const R = Jt(
|
|
1898
|
-
R !==
|
|
1899
|
-
}, [
|
|
1924
|
+
const w = Ze((S) => {
|
|
1925
|
+
const R = Jt(S, "yyyy-MM-dd");
|
|
1926
|
+
R !== y.current && (f(!0), y.current = R), h(S), r(S);
|
|
1927
|
+
}, [r]), { data: d, isLoading: P, isFetching: p, isError: E, error: m } = js({
|
|
1900
1928
|
queryKey: ["schedule", Jt(a, "yyyy-MM-dd")],
|
|
1901
1929
|
queryFn: () => e(a),
|
|
1902
1930
|
staleTime: 1e3 * 60 * 15,
|
|
@@ -1904,32 +1932,32 @@ function Ns({
|
|
|
1904
1932
|
retry: 1
|
|
1905
1933
|
});
|
|
1906
1934
|
ve(() => {
|
|
1907
|
-
if (
|
|
1908
|
-
if (!
|
|
1935
|
+
if (d !== void 0 && u)
|
|
1936
|
+
if (!p) {
|
|
1909
1937
|
const R = setTimeout(() => {
|
|
1910
|
-
|
|
1938
|
+
f(!1);
|
|
1911
1939
|
}, 500);
|
|
1912
1940
|
return () => clearTimeout(R);
|
|
1913
1941
|
} else
|
|
1914
|
-
|
|
1915
|
-
}, [
|
|
1916
|
-
|
|
1917
|
-
}, [a,
|
|
1918
|
-
const
|
|
1919
|
-
schedule:
|
|
1942
|
+
f(!1);
|
|
1943
|
+
}, [d, u, p]), ve(() => {
|
|
1944
|
+
E && (Gt.log("Error fetching schedule for date:", a), Gt.log("Error detials: ", m));
|
|
1945
|
+
}, [a, E, m]);
|
|
1946
|
+
const b = Xe(() => ({
|
|
1947
|
+
schedule: d ?? t,
|
|
1920
1948
|
weeks: s,
|
|
1921
1949
|
currentDate: a,
|
|
1922
1950
|
isLoading: P || u,
|
|
1923
|
-
isError:
|
|
1924
|
-
setCurrentDate:
|
|
1925
|
-
}), [
|
|
1926
|
-
return /* @__PURE__ */ Vt(Us.Provider, { value:
|
|
1951
|
+
isError: E,
|
|
1952
|
+
setCurrentDate: w
|
|
1953
|
+
}), [d, t, s, a, P, u, E, w]);
|
|
1954
|
+
return /* @__PURE__ */ Vt(Us.Provider, { value: b, children: n });
|
|
1927
1955
|
}
|
|
1928
|
-
function
|
|
1929
|
-
return /* @__PURE__ */ Vt(
|
|
1956
|
+
function Bs(e) {
|
|
1957
|
+
return /* @__PURE__ */ Vt(Ps, { client: Ns, children: /* @__PURE__ */ Vt(_s, { ...e }) });
|
|
1930
1958
|
}
|
|
1931
1959
|
export {
|
|
1932
1960
|
Us as ScheduleContext,
|
|
1933
|
-
|
|
1934
|
-
|
|
1961
|
+
Bs as ScheduleProvider,
|
|
1962
|
+
Bs as default
|
|
1935
1963
|
};
|