@tanstack/react-query-persist-client 4.0.11-beta.0 → 4.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/_virtual/_rollupPluginBabelHelpers.js +33 -0
- package/build/cjs/_virtual/_rollupPluginBabelHelpers.js.map +1 -0
- package/build/cjs/query-core/build/esm/index.js +314 -0
- package/build/cjs/query-core/build/esm/index.js.map +1 -0
- package/build/cjs/react-query-persist-client/src/PersistQueryClientProvider.js +83 -0
- package/build/cjs/react-query-persist-client/src/PersistQueryClientProvider.js.map +1 -0
- package/build/cjs/react-query-persist-client/src/index.js +27 -0
- package/build/cjs/react-query-persist-client/src/index.js.map +1 -0
- package/build/{lib/index.mjs → cjs/react-query-persist-client/src/persist.js} +12 -89
- package/build/cjs/react-query-persist-client/src/persist.js.map +1 -0
- package/build/cjs/react-query-persist-client/src/retryStrategies.js +39 -0
- package/build/cjs/react-query-persist-client/src/retryStrategies.js.map +1 -0
- package/build/esm/index.js +492 -0
- package/build/esm/index.js.map +1 -0
- package/build/stats-html.html +2689 -0
- package/build/stats.json +217 -0
- package/build/types/packages/query-core/src/focusManager.d.ts +16 -0
- package/build/types/packages/query-core/src/hydration.d.ts +34 -0
- package/build/types/packages/query-core/src/index.d.ts +20 -0
- package/build/types/packages/query-core/src/infiniteQueryBehavior.d.ts +15 -0
- package/build/types/packages/query-core/src/infiniteQueryObserver.d.ts +18 -0
- package/build/types/packages/query-core/src/logger.d.ts +8 -0
- package/build/types/packages/query-core/src/mutation.d.ts +70 -0
- package/build/types/packages/query-core/src/mutationCache.d.ts +57 -0
- package/build/types/packages/query-core/src/mutationObserver.d.ts +23 -0
- package/build/types/packages/query-core/src/notifyManager.d.ts +18 -0
- package/build/types/packages/query-core/src/onlineManager.d.ts +16 -0
- package/build/types/packages/query-core/src/queriesObserver.d.ts +23 -0
- package/build/types/packages/query-core/src/query.d.ts +119 -0
- package/build/types/packages/query-core/src/queryCache.d.ts +64 -0
- package/build/types/packages/query-core/src/queryClient.d.ts +65 -0
- package/build/types/packages/query-core/src/queryObserver.d.ts +61 -0
- package/build/types/packages/query-core/src/removable.d.ts +9 -0
- package/build/types/packages/query-core/src/retryer.d.ts +33 -0
- package/build/types/packages/query-core/src/subscribable.d.ts +10 -0
- package/build/types/packages/query-core/src/types.d.ts +419 -0
- package/build/types/packages/query-core/src/utils.d.ts +99 -0
- package/build/types/packages/react-query/src/Hydrate.d.ts +10 -0
- package/build/types/packages/react-query/src/QueryClientProvider.d.ts +24 -0
- package/build/types/packages/react-query/src/QueryErrorResetBoundary.d.ts +12 -0
- package/build/types/packages/react-query/src/index.d.ts +17 -0
- package/build/types/packages/react-query/src/isRestoring.d.ts +3 -0
- package/build/types/packages/react-query/src/reactBatchedUpdates.d.ts +2 -0
- package/build/types/packages/react-query/src/setBatchUpdatesFn.d.ts +1 -0
- package/build/types/packages/react-query/src/types.d.ts +34 -0
- package/build/types/packages/react-query/src/useBaseQuery.d.ts +3 -0
- package/build/types/packages/react-query/src/useInfiniteQuery.d.ts +5 -0
- package/build/types/packages/react-query/src/useIsFetching.d.ts +7 -0
- package/build/types/packages/react-query/src/useIsMutating.d.ts +7 -0
- package/build/types/packages/react-query/src/useMutation.d.ts +6 -0
- package/build/types/packages/react-query/src/useQueries.d.ts +49 -0
- package/build/types/packages/react-query/src/useQuery.d.ts +23 -0
- package/build/types/packages/react-query/src/utils.d.ts +1 -0
- package/build/{lib → types/packages/react-query-persist-client/src}/PersistQueryClientProvider.d.ts +0 -0
- package/build/types/packages/react-query-persist-client/src/__tests__/PersistQueryClientProvider.test.d.ts +1 -0
- package/build/types/packages/react-query-persist-client/src/__tests__/persist.test.d.ts +1 -0
- package/build/{lib → types/packages/react-query-persist-client/src}/index.d.ts +0 -0
- package/build/{lib → types/packages/react-query-persist-client/src}/persist.d.ts +0 -0
- package/build/{lib → types/packages/react-query-persist-client/src}/retryStrategies.d.ts +0 -0
- package/build/types/tests/utils.d.ts +24 -0
- package/build/umd/index.development.js +303 -6
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +11 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +7 -20
- package/build/lib/index.js +0 -225
- package/build/lib/index.js.map +0 -1
- package/build/lib/index.mjs.map +0 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* react-query-persist-client
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) TanStack
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
+
*
|
|
9
|
+
* @license MIT
|
|
10
|
+
*/
|
|
11
|
+
'use strict';
|
|
12
|
+
|
|
13
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
14
|
+
|
|
15
|
+
function _extends() {
|
|
16
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
17
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
18
|
+
var source = arguments[i];
|
|
19
|
+
|
|
20
|
+
for (var key in source) {
|
|
21
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
22
|
+
target[key] = source[key];
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return target;
|
|
28
|
+
};
|
|
29
|
+
return _extends.apply(this, arguments);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
exports["extends"] = _extends;
|
|
33
|
+
//# sourceMappingURL=_rollupPluginBabelHelpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_rollupPluginBabelHelpers.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* react-query-persist-client
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) TanStack
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
+
*
|
|
9
|
+
* @license MIT
|
|
10
|
+
*/
|
|
11
|
+
'use strict';
|
|
12
|
+
|
|
13
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* query-core
|
|
17
|
+
*
|
|
18
|
+
* Copyright (c) TanStack
|
|
19
|
+
*
|
|
20
|
+
* This source code is licensed under the MIT license found in the
|
|
21
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
22
|
+
*
|
|
23
|
+
* @license MIT
|
|
24
|
+
*/
|
|
25
|
+
class Subscribable {
|
|
26
|
+
constructor() {
|
|
27
|
+
this.listeners = [];
|
|
28
|
+
this.subscribe = this.subscribe.bind(this);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
subscribe(listener) {
|
|
32
|
+
this.listeners.push(listener);
|
|
33
|
+
this.onSubscribe();
|
|
34
|
+
return () => {
|
|
35
|
+
this.listeners = this.listeners.filter(x => x !== listener);
|
|
36
|
+
this.onUnsubscribe();
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
hasListeners() {
|
|
41
|
+
return this.listeners.length > 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
onSubscribe() {// Do nothing
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
onUnsubscribe() {// Do nothing
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// TYPES
|
|
53
|
+
// UTILS
|
|
54
|
+
const isServer = typeof window === 'undefined';
|
|
55
|
+
|
|
56
|
+
class FocusManager extends Subscribable {
|
|
57
|
+
constructor() {
|
|
58
|
+
super();
|
|
59
|
+
|
|
60
|
+
this.setup = onFocus => {
|
|
61
|
+
// addEventListener does not exist in React Native, but window does
|
|
62
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
63
|
+
if (!isServer && window.addEventListener) {
|
|
64
|
+
const listener = () => onFocus(); // Listen to visibillitychange and focus
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
window.addEventListener('visibilitychange', listener, false);
|
|
68
|
+
window.addEventListener('focus', listener, false);
|
|
69
|
+
return () => {
|
|
70
|
+
// Be sure to unsubscribe if a new handler is set
|
|
71
|
+
window.removeEventListener('visibilitychange', listener);
|
|
72
|
+
window.removeEventListener('focus', listener);
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
onSubscribe() {
|
|
79
|
+
if (!this.cleanup) {
|
|
80
|
+
this.setEventListener(this.setup);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
onUnsubscribe() {
|
|
85
|
+
if (!this.hasListeners()) {
|
|
86
|
+
var _this$cleanup;
|
|
87
|
+
|
|
88
|
+
(_this$cleanup = this.cleanup) == null ? void 0 : _this$cleanup.call(this);
|
|
89
|
+
this.cleanup = undefined;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
setEventListener(setup) {
|
|
94
|
+
var _this$cleanup2;
|
|
95
|
+
|
|
96
|
+
this.setup = setup;
|
|
97
|
+
(_this$cleanup2 = this.cleanup) == null ? void 0 : _this$cleanup2.call(this);
|
|
98
|
+
this.cleanup = setup(focused => {
|
|
99
|
+
if (typeof focused === 'boolean') {
|
|
100
|
+
this.setFocused(focused);
|
|
101
|
+
} else {
|
|
102
|
+
this.onFocus();
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
setFocused(focused) {
|
|
108
|
+
this.focused = focused;
|
|
109
|
+
|
|
110
|
+
if (focused) {
|
|
111
|
+
this.onFocus();
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
onFocus() {
|
|
116
|
+
this.listeners.forEach(listener => {
|
|
117
|
+
listener();
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
isFocused() {
|
|
122
|
+
if (typeof this.focused === 'boolean') {
|
|
123
|
+
return this.focused;
|
|
124
|
+
} // document global can be unavailable in react native
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
if (typeof document === 'undefined') {
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return [undefined, 'visible', 'prerender'].includes(document.visibilityState);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
}
|
|
135
|
+
new FocusManager();
|
|
136
|
+
|
|
137
|
+
class OnlineManager extends Subscribable {
|
|
138
|
+
constructor() {
|
|
139
|
+
super();
|
|
140
|
+
|
|
141
|
+
this.setup = onOnline => {
|
|
142
|
+
// addEventListener does not exist in React Native, but window does
|
|
143
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
144
|
+
if (!isServer && window.addEventListener) {
|
|
145
|
+
const listener = () => onOnline(); // Listen to online
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
window.addEventListener('online', listener, false);
|
|
149
|
+
window.addEventListener('offline', listener, false);
|
|
150
|
+
return () => {
|
|
151
|
+
// Be sure to unsubscribe if a new handler is set
|
|
152
|
+
window.removeEventListener('online', listener);
|
|
153
|
+
window.removeEventListener('offline', listener);
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
onSubscribe() {
|
|
160
|
+
if (!this.cleanup) {
|
|
161
|
+
this.setEventListener(this.setup);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
onUnsubscribe() {
|
|
166
|
+
if (!this.hasListeners()) {
|
|
167
|
+
var _this$cleanup;
|
|
168
|
+
|
|
169
|
+
(_this$cleanup = this.cleanup) == null ? void 0 : _this$cleanup.call(this);
|
|
170
|
+
this.cleanup = undefined;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
setEventListener(setup) {
|
|
175
|
+
var _this$cleanup2;
|
|
176
|
+
|
|
177
|
+
this.setup = setup;
|
|
178
|
+
(_this$cleanup2 = this.cleanup) == null ? void 0 : _this$cleanup2.call(this);
|
|
179
|
+
this.cleanup = setup(online => {
|
|
180
|
+
if (typeof online === 'boolean') {
|
|
181
|
+
this.setOnline(online);
|
|
182
|
+
} else {
|
|
183
|
+
this.onOnline();
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
setOnline(online) {
|
|
189
|
+
this.online = online;
|
|
190
|
+
|
|
191
|
+
if (online) {
|
|
192
|
+
this.onOnline();
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
onOnline() {
|
|
197
|
+
this.listeners.forEach(listener => {
|
|
198
|
+
listener();
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
isOnline() {
|
|
203
|
+
if (typeof this.online === 'boolean') {
|
|
204
|
+
return this.online;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
if (typeof navigator === 'undefined' || typeof navigator.onLine === 'undefined') {
|
|
208
|
+
return true;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
return navigator.onLine;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
}
|
|
215
|
+
new OnlineManager();
|
|
216
|
+
|
|
217
|
+
// TYPES
|
|
218
|
+
// FUNCTIONS
|
|
219
|
+
function dehydrateMutation(mutation) {
|
|
220
|
+
return {
|
|
221
|
+
mutationKey: mutation.options.mutationKey,
|
|
222
|
+
state: mutation.state
|
|
223
|
+
};
|
|
224
|
+
} // Most config is not dehydrated but instead meant to configure again when
|
|
225
|
+
// consuming the de/rehydrated data, typically with useQuery on the client.
|
|
226
|
+
// Sometimes it might make sense to prefetch data on the server and include
|
|
227
|
+
// in the html-payload, but not consume it on the initial render.
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
function dehydrateQuery(query) {
|
|
231
|
+
return {
|
|
232
|
+
state: query.state,
|
|
233
|
+
queryKey: query.queryKey,
|
|
234
|
+
queryHash: query.queryHash
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function defaultShouldDehydrateMutation(mutation) {
|
|
239
|
+
return mutation.state.isPaused;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
function defaultShouldDehydrateQuery(query) {
|
|
243
|
+
return query.state.status === 'success';
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
function dehydrate(client, options = {}) {
|
|
247
|
+
const mutations = [];
|
|
248
|
+
const queries = [];
|
|
249
|
+
|
|
250
|
+
if (options.dehydrateMutations !== false) {
|
|
251
|
+
const shouldDehydrateMutation = options.shouldDehydrateMutation || defaultShouldDehydrateMutation;
|
|
252
|
+
client.getMutationCache().getAll().forEach(mutation => {
|
|
253
|
+
if (shouldDehydrateMutation(mutation)) {
|
|
254
|
+
mutations.push(dehydrateMutation(mutation));
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
if (options.dehydrateQueries !== false) {
|
|
260
|
+
const shouldDehydrateQuery = options.shouldDehydrateQuery || defaultShouldDehydrateQuery;
|
|
261
|
+
client.getQueryCache().getAll().forEach(query => {
|
|
262
|
+
if (shouldDehydrateQuery(query)) {
|
|
263
|
+
queries.push(dehydrateQuery(query));
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
return {
|
|
269
|
+
mutations,
|
|
270
|
+
queries
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
function hydrate(client, dehydratedState, options) {
|
|
274
|
+
if (typeof dehydratedState !== 'object' || dehydratedState === null) {
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
const mutationCache = client.getMutationCache();
|
|
279
|
+
const queryCache = client.getQueryCache(); // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
280
|
+
|
|
281
|
+
const mutations = dehydratedState.mutations || []; // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
282
|
+
|
|
283
|
+
const queries = dehydratedState.queries || [];
|
|
284
|
+
mutations.forEach(dehydratedMutation => {
|
|
285
|
+
var _options$defaultOptio;
|
|
286
|
+
|
|
287
|
+
mutationCache.build(client, { ...(options == null ? void 0 : (_options$defaultOptio = options.defaultOptions) == null ? void 0 : _options$defaultOptio.mutations),
|
|
288
|
+
mutationKey: dehydratedMutation.mutationKey
|
|
289
|
+
}, dehydratedMutation.state);
|
|
290
|
+
});
|
|
291
|
+
queries.forEach(dehydratedQuery => {
|
|
292
|
+
var _options$defaultOptio2;
|
|
293
|
+
|
|
294
|
+
const query = queryCache.get(dehydratedQuery.queryHash); // Do not hydrate if an existing query exists with newer data
|
|
295
|
+
|
|
296
|
+
if (query) {
|
|
297
|
+
if (query.state.dataUpdatedAt < dehydratedQuery.state.dataUpdatedAt) {
|
|
298
|
+
query.setState(dehydratedQuery.state);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
return;
|
|
302
|
+
} // Restore query
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
queryCache.build(client, { ...(options == null ? void 0 : (_options$defaultOptio2 = options.defaultOptions) == null ? void 0 : _options$defaultOptio2.queries),
|
|
306
|
+
queryKey: dehydratedQuery.queryKey,
|
|
307
|
+
queryHash: dehydratedQuery.queryHash
|
|
308
|
+
}, dehydratedQuery.state);
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
exports.dehydrate = dehydrate;
|
|
313
|
+
exports.hydrate = hydrate;
|
|
314
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../query-core/build/esm/index.js"],"sourcesContent":["/**\n * query-core\n *\n * Copyright (c) TanStack\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\nclass Subscribable {\n constructor() {\n this.listeners = [];\n this.subscribe = this.subscribe.bind(this);\n }\n\n subscribe(listener) {\n this.listeners.push(listener);\n this.onSubscribe();\n return () => {\n this.listeners = this.listeners.filter(x => x !== listener);\n this.onUnsubscribe();\n };\n }\n\n hasListeners() {\n return this.listeners.length > 0;\n }\n\n onSubscribe() {// Do nothing\n }\n\n onUnsubscribe() {// Do nothing\n }\n\n}\n\n// TYPES\n// UTILS\nconst isServer = typeof window === 'undefined';\nfunction noop() {\n return undefined;\n}\nfunction functionalUpdate(updater, input) {\n return typeof updater === 'function' ? updater(input) : updater;\n}\nfunction isValidTimeout(value) {\n return typeof value === 'number' && value >= 0 && value !== Infinity;\n}\nfunction difference(array1, array2) {\n return array1.filter(x => array2.indexOf(x) === -1);\n}\nfunction replaceAt(array, index, value) {\n const copy = array.slice(0);\n copy[index] = value;\n return copy;\n}\nfunction timeUntilStale(updatedAt, staleTime) {\n return Math.max(updatedAt + (staleTime || 0) - Date.now(), 0);\n}\nfunction parseQueryArgs(arg1, arg2, arg3) {\n if (!isQueryKey(arg1)) {\n return arg1;\n }\n\n if (typeof arg2 === 'function') {\n return { ...arg3,\n queryKey: arg1,\n queryFn: arg2\n };\n }\n\n return { ...arg2,\n queryKey: arg1\n };\n}\nfunction parseMutationArgs(arg1, arg2, arg3) {\n if (isQueryKey(arg1)) {\n if (typeof arg2 === 'function') {\n return { ...arg3,\n mutationKey: arg1,\n mutationFn: arg2\n };\n }\n\n return { ...arg2,\n mutationKey: arg1\n };\n }\n\n if (typeof arg1 === 'function') {\n return { ...arg2,\n mutationFn: arg1\n };\n }\n\n return { ...arg1\n };\n}\nfunction parseFilterArgs(arg1, arg2, arg3) {\n return isQueryKey(arg1) ? [{ ...arg2,\n queryKey: arg1\n }, arg3] : [arg1 || {}, arg2];\n}\nfunction parseMutationFilterArgs(arg1, arg2, arg3) {\n return isQueryKey(arg1) ? [{ ...arg2,\n mutationKey: arg1\n }, arg3] : [arg1 || {}, arg2];\n}\nfunction matchQuery(filters, query) {\n const {\n type = 'all',\n exact,\n fetchStatus,\n predicate,\n queryKey,\n stale\n } = filters;\n\n if (isQueryKey(queryKey)) {\n if (exact) {\n if (query.queryHash !== hashQueryKeyByOptions(queryKey, query.options)) {\n return false;\n }\n } else if (!partialMatchKey(query.queryKey, queryKey)) {\n return false;\n }\n }\n\n if (type !== 'all') {\n const isActive = query.isActive();\n\n if (type === 'active' && !isActive) {\n return false;\n }\n\n if (type === 'inactive' && isActive) {\n return false;\n }\n }\n\n if (typeof stale === 'boolean' && query.isStale() !== stale) {\n return false;\n }\n\n if (typeof fetchStatus !== 'undefined' && fetchStatus !== query.state.fetchStatus) {\n return false;\n }\n\n if (predicate && !predicate(query)) {\n return false;\n }\n\n return true;\n}\nfunction matchMutation(filters, mutation) {\n const {\n exact,\n fetching,\n predicate,\n mutationKey\n } = filters;\n\n if (isQueryKey(mutationKey)) {\n if (!mutation.options.mutationKey) {\n return false;\n }\n\n if (exact) {\n if (hashQueryKey(mutation.options.mutationKey) !== hashQueryKey(mutationKey)) {\n return false;\n }\n } else if (!partialMatchKey(mutation.options.mutationKey, mutationKey)) {\n return false;\n }\n }\n\n if (typeof fetching === 'boolean' && mutation.state.status === 'loading' !== fetching) {\n return false;\n }\n\n if (predicate && !predicate(mutation)) {\n return false;\n }\n\n return true;\n}\nfunction hashQueryKeyByOptions(queryKey, options) {\n const hashFn = (options == null ? void 0 : options.queryKeyHashFn) || hashQueryKey;\n return hashFn(queryKey);\n}\n/**\n * Default query keys hash function.\n * Hashes the value into a stable hash.\n */\n\nfunction hashQueryKey(queryKey) {\n return JSON.stringify(queryKey, (_, val) => isPlainObject(val) ? Object.keys(val).sort().reduce((result, key) => {\n result[key] = val[key];\n return result;\n }, {}) : val);\n}\n/**\n * Checks if key `b` partially matches with key `a`.\n */\n\nfunction partialMatchKey(a, b) {\n return partialDeepEqual(a, b);\n}\n/**\n * Checks if `b` partially matches with `a`.\n */\n\nfunction partialDeepEqual(a, b) {\n if (a === b) {\n return true;\n }\n\n if (typeof a !== typeof b) {\n return false;\n }\n\n if (a && b && typeof a === 'object' && typeof b === 'object') {\n return !Object.keys(b).some(key => !partialDeepEqual(a[key], b[key]));\n }\n\n return false;\n}\n/**\n * This function returns `a` if `b` is deeply equal.\n * If not, it will replace any deeply equal children of `b` with those of `a`.\n * This can be used for structural sharing between JSON values for example.\n */\n\nfunction replaceEqualDeep(a, b) {\n if (a === b) {\n return a;\n }\n\n const array = isPlainArray(a) && isPlainArray(b);\n\n if (array || isPlainObject(a) && isPlainObject(b)) {\n const aSize = array ? a.length : Object.keys(a).length;\n const bItems = array ? b : Object.keys(b);\n const bSize = bItems.length;\n const copy = array ? [] : {};\n let equalItems = 0;\n\n for (let i = 0; i < bSize; i++) {\n const key = array ? i : bItems[i];\n copy[key] = replaceEqualDeep(a[key], b[key]);\n\n if (copy[key] === a[key]) {\n equalItems++;\n }\n }\n\n return aSize === bSize && equalItems === aSize ? a : copy;\n }\n\n return b;\n}\n/**\n * Shallow compare objects. Only works with objects that always have the same properties.\n */\n\nfunction shallowEqualObjects(a, b) {\n if (a && !b || b && !a) {\n return false;\n }\n\n for (const key in a) {\n if (a[key] !== b[key]) {\n return false;\n }\n }\n\n return true;\n}\nfunction isPlainArray(value) {\n return Array.isArray(value) && value.length === Object.keys(value).length;\n} // Copied from: https://github.com/jonschlinkert/is-plain-object\n\nfunction isPlainObject(o) {\n if (!hasObjectPrototype(o)) {\n return false;\n } // If has modified constructor\n\n\n const ctor = o.constructor;\n\n if (typeof ctor === 'undefined') {\n return true;\n } // If has modified prototype\n\n\n const prot = ctor.prototype;\n\n if (!hasObjectPrototype(prot)) {\n return false;\n } // If constructor does not have an Object-specific method\n\n\n if (!prot.hasOwnProperty('isPrototypeOf')) {\n return false;\n } // Most likely a plain Object\n\n\n return true;\n}\n\nfunction hasObjectPrototype(o) {\n return Object.prototype.toString.call(o) === '[object Object]';\n}\n\nfunction isQueryKey(value) {\n return Array.isArray(value);\n}\nfunction isError(value) {\n return value instanceof Error;\n}\nfunction sleep(timeout) {\n return new Promise(resolve => {\n setTimeout(resolve, timeout);\n });\n}\n/**\n * Schedules a microtask.\n * This can be useful to schedule state updates after rendering.\n */\n\nfunction scheduleMicrotask(callback) {\n sleep(0).then(callback);\n}\nfunction getAbortController() {\n if (typeof AbortController === 'function') {\n return new AbortController();\n }\n}\nfunction replaceData(prevData, data, options) {\n // Use prev data if an isDataEqual function is defined and returns `true`\n if (options.isDataEqual != null && options.isDataEqual(prevData, data)) {\n return prevData;\n } else if (typeof options.structuralSharing === 'function') {\n return options.structuralSharing(prevData, data);\n } else if (options.structuralSharing !== false) {\n // Structurally share data between prev and new data if needed\n return replaceEqualDeep(prevData, data);\n }\n\n return data;\n}\n\nclass FocusManager extends Subscribable {\n constructor() {\n super();\n\n this.setup = onFocus => {\n // addEventListener does not exist in React Native, but window does\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (!isServer && window.addEventListener) {\n const listener = () => onFocus(); // Listen to visibillitychange and focus\n\n\n window.addEventListener('visibilitychange', listener, false);\n window.addEventListener('focus', listener, false);\n return () => {\n // Be sure to unsubscribe if a new handler is set\n window.removeEventListener('visibilitychange', listener);\n window.removeEventListener('focus', listener);\n };\n }\n };\n }\n\n onSubscribe() {\n if (!this.cleanup) {\n this.setEventListener(this.setup);\n }\n }\n\n onUnsubscribe() {\n if (!this.hasListeners()) {\n var _this$cleanup;\n\n (_this$cleanup = this.cleanup) == null ? void 0 : _this$cleanup.call(this);\n this.cleanup = undefined;\n }\n }\n\n setEventListener(setup) {\n var _this$cleanup2;\n\n this.setup = setup;\n (_this$cleanup2 = this.cleanup) == null ? void 0 : _this$cleanup2.call(this);\n this.cleanup = setup(focused => {\n if (typeof focused === 'boolean') {\n this.setFocused(focused);\n } else {\n this.onFocus();\n }\n });\n }\n\n setFocused(focused) {\n this.focused = focused;\n\n if (focused) {\n this.onFocus();\n }\n }\n\n onFocus() {\n this.listeners.forEach(listener => {\n listener();\n });\n }\n\n isFocused() {\n if (typeof this.focused === 'boolean') {\n return this.focused;\n } // document global can be unavailable in react native\n\n\n if (typeof document === 'undefined') {\n return true;\n }\n\n return [undefined, 'visible', 'prerender'].includes(document.visibilityState);\n }\n\n}\nconst focusManager = new FocusManager();\n\nclass OnlineManager extends Subscribable {\n constructor() {\n super();\n\n this.setup = onOnline => {\n // addEventListener does not exist in React Native, but window does\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (!isServer && window.addEventListener) {\n const listener = () => onOnline(); // Listen to online\n\n\n window.addEventListener('online', listener, false);\n window.addEventListener('offline', listener, false);\n return () => {\n // Be sure to unsubscribe if a new handler is set\n window.removeEventListener('online', listener);\n window.removeEventListener('offline', listener);\n };\n }\n };\n }\n\n onSubscribe() {\n if (!this.cleanup) {\n this.setEventListener(this.setup);\n }\n }\n\n onUnsubscribe() {\n if (!this.hasListeners()) {\n var _this$cleanup;\n\n (_this$cleanup = this.cleanup) == null ? void 0 : _this$cleanup.call(this);\n this.cleanup = undefined;\n }\n }\n\n setEventListener(setup) {\n var _this$cleanup2;\n\n this.setup = setup;\n (_this$cleanup2 = this.cleanup) == null ? void 0 : _this$cleanup2.call(this);\n this.cleanup = setup(online => {\n if (typeof online === 'boolean') {\n this.setOnline(online);\n } else {\n this.onOnline();\n }\n });\n }\n\n setOnline(online) {\n this.online = online;\n\n if (online) {\n this.onOnline();\n }\n }\n\n onOnline() {\n this.listeners.forEach(listener => {\n listener();\n });\n }\n\n isOnline() {\n if (typeof this.online === 'boolean') {\n return this.online;\n }\n\n if (typeof navigator === 'undefined' || typeof navigator.onLine === 'undefined') {\n return true;\n }\n\n return navigator.onLine;\n }\n\n}\nconst onlineManager = new OnlineManager();\n\nfunction defaultRetryDelay(failureCount) {\n return Math.min(1000 * 2 ** failureCount, 30000);\n}\n\nfunction canFetch(networkMode) {\n return (networkMode != null ? networkMode : 'online') === 'online' ? onlineManager.isOnline() : true;\n}\nclass CancelledError {\n constructor(options) {\n this.revert = options == null ? void 0 : options.revert;\n this.silent = options == null ? void 0 : options.silent;\n }\n\n}\nfunction isCancelledError(value) {\n return value instanceof CancelledError;\n}\nfunction createRetryer(config) {\n let isRetryCancelled = false;\n let failureCount = 0;\n let isResolved = false;\n let continueFn;\n let promiseResolve;\n let promiseReject;\n const promise = new Promise((outerResolve, outerReject) => {\n promiseResolve = outerResolve;\n promiseReject = outerReject;\n });\n\n const cancel = cancelOptions => {\n if (!isResolved) {\n reject(new CancelledError(cancelOptions));\n config.abort == null ? void 0 : config.abort();\n }\n };\n\n const cancelRetry = () => {\n isRetryCancelled = true;\n };\n\n const continueRetry = () => {\n isRetryCancelled = false;\n };\n\n const shouldPause = () => !focusManager.isFocused() || config.networkMode !== 'always' && !onlineManager.isOnline();\n\n const resolve = value => {\n if (!isResolved) {\n isResolved = true;\n config.onSuccess == null ? void 0 : config.onSuccess(value);\n continueFn == null ? void 0 : continueFn();\n promiseResolve(value);\n }\n };\n\n const reject = value => {\n if (!isResolved) {\n isResolved = true;\n config.onError == null ? void 0 : config.onError(value);\n continueFn == null ? void 0 : continueFn();\n promiseReject(value);\n }\n };\n\n const pause = () => {\n return new Promise(continueResolve => {\n continueFn = value => {\n if (isResolved || !shouldPause()) {\n return continueResolve(value);\n }\n };\n\n config.onPause == null ? void 0 : config.onPause();\n }).then(() => {\n continueFn = undefined;\n\n if (!isResolved) {\n config.onContinue == null ? void 0 : config.onContinue();\n }\n });\n }; // Create loop function\n\n\n const run = () => {\n // Do nothing if already resolved\n if (isResolved) {\n return;\n }\n\n let promiseOrValue; // Execute query\n\n try {\n promiseOrValue = config.fn();\n } catch (error) {\n promiseOrValue = Promise.reject(error);\n }\n\n Promise.resolve(promiseOrValue).then(resolve).catch(error => {\n var _config$retry, _config$retryDelay;\n\n // Stop if the fetch is already resolved\n if (isResolved) {\n return;\n } // Do we need to retry the request?\n\n\n const retry = (_config$retry = config.retry) != null ? _config$retry : 3;\n const retryDelay = (_config$retryDelay = config.retryDelay) != null ? _config$retryDelay : defaultRetryDelay;\n const delay = typeof retryDelay === 'function' ? retryDelay(failureCount, error) : retryDelay;\n const shouldRetry = retry === true || typeof retry === 'number' && failureCount < retry || typeof retry === 'function' && retry(failureCount, error);\n\n if (isRetryCancelled || !shouldRetry) {\n // We are done if the query does not need to be retried\n reject(error);\n return;\n }\n\n failureCount++; // Notify on fail\n\n config.onFail == null ? void 0 : config.onFail(failureCount, error); // Delay\n\n sleep(delay) // Pause if the document is not visible or when the device is offline\n .then(() => {\n if (shouldPause()) {\n return pause();\n }\n }).then(() => {\n if (isRetryCancelled) {\n reject(error);\n } else {\n run();\n }\n });\n });\n }; // Start loop\n\n\n if (canFetch(config.networkMode)) {\n run();\n } else {\n pause().then(run);\n }\n\n return {\n promise,\n cancel,\n continue: () => {\n continueFn == null ? void 0 : continueFn();\n },\n cancelRetry,\n continueRetry\n };\n}\n\nconst defaultLogger = console;\n\nfunction createNotifyManager() {\n let queue = [];\n let transactions = 0;\n\n let notifyFn = callback => {\n callback();\n };\n\n let batchNotifyFn = callback => {\n callback();\n };\n\n const batch = callback => {\n let result;\n transactions++;\n\n try {\n result = callback();\n } finally {\n transactions--;\n\n if (!transactions) {\n flush();\n }\n }\n\n return result;\n };\n\n const schedule = callback => {\n if (transactions) {\n queue.push(callback);\n } else {\n scheduleMicrotask(() => {\n notifyFn(callback);\n });\n }\n };\n /**\n * All calls to the wrapped function will be batched.\n */\n\n\n const batchCalls = callback => {\n return (...args) => {\n schedule(() => {\n callback(...args);\n });\n };\n };\n\n const flush = () => {\n const originalQueue = queue;\n queue = [];\n\n if (originalQueue.length) {\n scheduleMicrotask(() => {\n batchNotifyFn(() => {\n originalQueue.forEach(callback => {\n notifyFn(callback);\n });\n });\n });\n }\n };\n /**\n * Use this method to set a custom notify function.\n * This can be used to for example wrap notifications with `React.act` while running tests.\n */\n\n\n const setNotifyFunction = fn => {\n notifyFn = fn;\n };\n /**\n * Use this method to set a custom function to batch notifications together into a single tick.\n * By default React Query will use the batch function provided by ReactDOM or React Native.\n */\n\n\n const setBatchNotifyFunction = fn => {\n batchNotifyFn = fn;\n };\n\n return {\n batch,\n batchCalls,\n schedule,\n setNotifyFunction,\n setBatchNotifyFunction\n };\n} // SINGLETON\n\nconst notifyManager = createNotifyManager();\n\nclass Removable {\n destroy() {\n this.clearGcTimeout();\n }\n\n scheduleGc() {\n this.clearGcTimeout();\n\n if (isValidTimeout(this.cacheTime)) {\n this.gcTimeout = setTimeout(() => {\n this.optionalRemove();\n }, this.cacheTime);\n }\n }\n\n updateCacheTime(newCacheTime) {\n // Default to 5 minutes (Infinity for server-side) if no cache time is set\n this.cacheTime = Math.max(this.cacheTime || 0, newCacheTime != null ? newCacheTime : isServer ? Infinity : 5 * 60 * 1000);\n }\n\n clearGcTimeout() {\n if (this.gcTimeout) {\n clearTimeout(this.gcTimeout);\n this.gcTimeout = undefined;\n }\n }\n\n}\n\n// CLASS\nclass Query extends Removable {\n constructor(config) {\n super();\n this.abortSignalConsumed = false;\n this.defaultOptions = config.defaultOptions;\n this.setOptions(config.options);\n this.observers = [];\n this.cache = config.cache;\n this.logger = config.logger || defaultLogger;\n this.queryKey = config.queryKey;\n this.queryHash = config.queryHash;\n this.initialState = config.state || getDefaultState$1(this.options);\n this.state = this.initialState;\n this.meta = config.meta;\n }\n\n setOptions(options) {\n this.options = { ...this.defaultOptions,\n ...options\n };\n this.meta = options == null ? void 0 : options.meta;\n this.updateCacheTime(this.options.cacheTime);\n }\n\n optionalRemove() {\n if (!this.observers.length && this.state.fetchStatus === 'idle') {\n this.cache.remove(this);\n }\n }\n\n setData(newData, options) {\n const data = replaceData(this.state.data, newData, this.options); // Set data and mark it as cached\n\n this.dispatch({\n data,\n type: 'success',\n dataUpdatedAt: options == null ? void 0 : options.updatedAt,\n manual: options == null ? void 0 : options.manual\n });\n return data;\n }\n\n setState(state, setStateOptions) {\n this.dispatch({\n type: 'setState',\n state,\n setStateOptions\n });\n }\n\n cancel(options) {\n var _this$retryer;\n\n const promise = this.promise;\n (_this$retryer = this.retryer) == null ? void 0 : _this$retryer.cancel(options);\n return promise ? promise.then(noop).catch(noop) : Promise.resolve();\n }\n\n destroy() {\n super.destroy();\n this.cancel({\n silent: true\n });\n }\n\n reset() {\n this.destroy();\n this.setState(this.initialState);\n }\n\n isActive() {\n return this.observers.some(observer => observer.options.enabled !== false);\n }\n\n isDisabled() {\n return this.getObserversCount() > 0 && !this.isActive();\n }\n\n isStale() {\n return this.state.isInvalidated || !this.state.dataUpdatedAt || this.observers.some(observer => observer.getCurrentResult().isStale);\n }\n\n isStaleByTime(staleTime = 0) {\n return this.state.isInvalidated || !this.state.dataUpdatedAt || !timeUntilStale(this.state.dataUpdatedAt, staleTime);\n }\n\n onFocus() {\n var _this$retryer2;\n\n const observer = this.observers.find(x => x.shouldFetchOnWindowFocus());\n\n if (observer) {\n observer.refetch({\n cancelRefetch: false\n });\n } // Continue fetch if currently paused\n\n\n (_this$retryer2 = this.retryer) == null ? void 0 : _this$retryer2.continue();\n }\n\n onOnline() {\n var _this$retryer3;\n\n const observer = this.observers.find(x => x.shouldFetchOnReconnect());\n\n if (observer) {\n observer.refetch({\n cancelRefetch: false\n });\n } // Continue fetch if currently paused\n\n\n (_this$retryer3 = this.retryer) == null ? void 0 : _this$retryer3.continue();\n }\n\n addObserver(observer) {\n if (this.observers.indexOf(observer) === -1) {\n this.observers.push(observer); // Stop the query from being garbage collected\n\n this.clearGcTimeout();\n this.cache.notify({\n type: 'observerAdded',\n query: this,\n observer\n });\n }\n }\n\n removeObserver(observer) {\n if (this.observers.indexOf(observer) !== -1) {\n this.observers = this.observers.filter(x => x !== observer);\n\n if (!this.observers.length) {\n // If the transport layer does not support cancellation\n // we'll let the query continue so the result can be cached\n if (this.retryer) {\n if (this.abortSignalConsumed) {\n this.retryer.cancel({\n revert: true\n });\n } else {\n this.retryer.cancelRetry();\n }\n }\n\n this.scheduleGc();\n }\n\n this.cache.notify({\n type: 'observerRemoved',\n query: this,\n observer\n });\n }\n }\n\n getObserversCount() {\n return this.observers.length;\n }\n\n invalidate() {\n if (!this.state.isInvalidated) {\n this.dispatch({\n type: 'invalidate'\n });\n }\n }\n\n fetch(options, fetchOptions) {\n var _this$options$behavio, _context$fetchOptions;\n\n if (this.state.fetchStatus !== 'idle') {\n if (this.state.dataUpdatedAt && fetchOptions != null && fetchOptions.cancelRefetch) {\n // Silently cancel current fetch if the user wants to cancel refetches\n this.cancel({\n silent: true\n });\n } else if (this.promise) {\n var _this$retryer4;\n\n // make sure that retries that were potentially cancelled due to unmounts can continue\n (_this$retryer4 = this.retryer) == null ? void 0 : _this$retryer4.continueRetry(); // Return current promise if we are already fetching\n\n return this.promise;\n }\n } // Update config if passed, otherwise the config from the last execution is used\n\n\n if (options) {\n this.setOptions(options);\n } // Use the options from the first observer with a query function if no function is found.\n // This can happen when the query is hydrated or created with setQueryData.\n\n\n if (!this.options.queryFn) {\n const observer = this.observers.find(x => x.options.queryFn);\n\n if (observer) {\n this.setOptions(observer.options);\n }\n }\n\n if (!Array.isArray(this.options.queryKey)) {\n if (process.env.NODE_ENV !== 'production') {\n this.logger.error(\"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']\");\n }\n }\n\n const abortController = getAbortController(); // Create query function context\n\n const queryFnContext = {\n queryKey: this.queryKey,\n pageParam: undefined,\n meta: this.meta\n }; // Adds an enumerable signal property to the object that\n // which sets abortSignalConsumed to true when the signal\n // is read.\n\n const addSignalProperty = object => {\n Object.defineProperty(object, 'signal', {\n enumerable: true,\n get: () => {\n if (abortController) {\n this.abortSignalConsumed = true;\n return abortController.signal;\n }\n\n return undefined;\n }\n });\n };\n\n addSignalProperty(queryFnContext); // Create fetch function\n\n const fetchFn = () => {\n if (!this.options.queryFn) {\n return Promise.reject('Missing queryFn');\n }\n\n this.abortSignalConsumed = false;\n return this.options.queryFn(queryFnContext);\n }; // Trigger behavior hook\n\n\n const context = {\n fetchOptions,\n options: this.options,\n queryKey: this.queryKey,\n state: this.state,\n fetchFn,\n meta: this.meta\n };\n addSignalProperty(context);\n (_this$options$behavio = this.options.behavior) == null ? void 0 : _this$options$behavio.onFetch(context); // Store state in case the current fetch needs to be reverted\n\n this.revertState = this.state; // Set to fetching state if not already in it\n\n if (this.state.fetchStatus === 'idle' || this.state.fetchMeta !== ((_context$fetchOptions = context.fetchOptions) == null ? void 0 : _context$fetchOptions.meta)) {\n var _context$fetchOptions2;\n\n this.dispatch({\n type: 'fetch',\n meta: (_context$fetchOptions2 = context.fetchOptions) == null ? void 0 : _context$fetchOptions2.meta\n });\n }\n\n const onError = error => {\n // Optimistically update state if needed\n if (!(isCancelledError(error) && error.silent)) {\n this.dispatch({\n type: 'error',\n error: error\n });\n }\n\n if (!isCancelledError(error)) {\n var _this$cache$config$on, _this$cache$config;\n\n // Notify cache callback\n (_this$cache$config$on = (_this$cache$config = this.cache.config).onError) == null ? void 0 : _this$cache$config$on.call(_this$cache$config, error, this);\n\n if (process.env.NODE_ENV !== 'production') {\n this.logger.error(error);\n }\n }\n\n if (!this.isFetchingOptimistic) {\n // Schedule query gc after fetching\n this.scheduleGc();\n }\n\n this.isFetchingOptimistic = false;\n }; // Try to fetch the data\n\n\n this.retryer = createRetryer({\n fn: context.fetchFn,\n abort: abortController == null ? void 0 : abortController.abort.bind(abortController),\n onSuccess: data => {\n var _this$cache$config$on2, _this$cache$config2;\n\n if (typeof data === 'undefined') {\n onError(new Error('Query data cannot be undefined'));\n return;\n }\n\n this.setData(data); // Notify cache callback\n\n (_this$cache$config$on2 = (_this$cache$config2 = this.cache.config).onSuccess) == null ? void 0 : _this$cache$config$on2.call(_this$cache$config2, data, this);\n\n if (!this.isFetchingOptimistic) {\n // Schedule query gc after fetching\n this.scheduleGc();\n }\n\n this.isFetchingOptimistic = false;\n },\n onError,\n onFail: () => {\n this.dispatch({\n type: 'failed'\n });\n },\n onPause: () => {\n this.dispatch({\n type: 'pause'\n });\n },\n onContinue: () => {\n this.dispatch({\n type: 'continue'\n });\n },\n retry: context.options.retry,\n retryDelay: context.options.retryDelay,\n networkMode: context.options.networkMode\n });\n this.promise = this.retryer.promise;\n return this.promise;\n }\n\n dispatch(action) {\n const reducer = state => {\n var _action$meta, _action$dataUpdatedAt;\n\n switch (action.type) {\n case 'failed':\n return { ...state,\n fetchFailureCount: state.fetchFailureCount + 1\n };\n\n case 'pause':\n return { ...state,\n fetchStatus: 'paused'\n };\n\n case 'continue':\n return { ...state,\n fetchStatus: 'fetching'\n };\n\n case 'fetch':\n return { ...state,\n fetchFailureCount: 0,\n fetchMeta: (_action$meta = action.meta) != null ? _action$meta : null,\n fetchStatus: canFetch(this.options.networkMode) ? 'fetching' : 'paused',\n ...(!state.dataUpdatedAt && {\n error: null,\n status: 'loading'\n })\n };\n\n case 'success':\n return { ...state,\n data: action.data,\n dataUpdateCount: state.dataUpdateCount + 1,\n dataUpdatedAt: (_action$dataUpdatedAt = action.dataUpdatedAt) != null ? _action$dataUpdatedAt : Date.now(),\n error: null,\n isInvalidated: false,\n status: 'success',\n ...(!action.manual && {\n fetchStatus: 'idle',\n fetchFailureCount: 0\n })\n };\n\n case 'error':\n const error = action.error;\n\n if (isCancelledError(error) && error.revert && this.revertState) {\n return { ...this.revertState\n };\n }\n\n return { ...state,\n error: error,\n errorUpdateCount: state.errorUpdateCount + 1,\n errorUpdatedAt: Date.now(),\n fetchFailureCount: state.fetchFailureCount + 1,\n fetchStatus: 'idle',\n status: 'error'\n };\n\n case 'invalidate':\n return { ...state,\n isInvalidated: true\n };\n\n case 'setState':\n return { ...state,\n ...action.state\n };\n }\n };\n\n this.state = reducer(this.state);\n notifyManager.batch(() => {\n this.observers.forEach(observer => {\n observer.onQueryUpdate(action);\n });\n this.cache.notify({\n query: this,\n type: 'updated',\n action\n });\n });\n }\n\n}\n\nfunction getDefaultState$1(options) {\n const data = typeof options.initialData === 'function' ? options.initialData() : options.initialData;\n const hasInitialData = typeof options.initialData !== 'undefined';\n const initialDataUpdatedAt = hasInitialData ? typeof options.initialDataUpdatedAt === 'function' ? options.initialDataUpdatedAt() : options.initialDataUpdatedAt : 0;\n const hasData = typeof data !== 'undefined';\n return {\n data,\n dataUpdateCount: 0,\n dataUpdatedAt: hasData ? initialDataUpdatedAt != null ? initialDataUpdatedAt : Date.now() : 0,\n error: null,\n errorUpdateCount: 0,\n errorUpdatedAt: 0,\n fetchFailureCount: 0,\n fetchMeta: null,\n isInvalidated: false,\n status: hasData ? 'success' : 'loading',\n fetchStatus: 'idle'\n };\n}\n\n// CLASS\nclass QueryCache extends Subscribable {\n constructor(config) {\n super();\n this.config = config || {};\n this.queries = [];\n this.queriesMap = {};\n }\n\n build(client, options, state) {\n var _options$queryHash;\n\n const queryKey = options.queryKey;\n const queryHash = (_options$queryHash = options.queryHash) != null ? _options$queryHash : hashQueryKeyByOptions(queryKey, options);\n let query = this.get(queryHash);\n\n if (!query) {\n query = new Query({\n cache: this,\n logger: client.getLogger(),\n queryKey,\n queryHash,\n options: client.defaultQueryOptions(options),\n state,\n defaultOptions: client.getQueryDefaults(queryKey),\n meta: options.meta\n });\n this.add(query);\n }\n\n return query;\n }\n\n add(query) {\n if (!this.queriesMap[query.queryHash]) {\n this.queriesMap[query.queryHash] = query;\n this.queries.push(query);\n this.notify({\n type: 'added',\n query\n });\n }\n }\n\n remove(query) {\n const queryInMap = this.queriesMap[query.queryHash];\n\n if (queryInMap) {\n query.destroy();\n this.queries = this.queries.filter(x => x !== query);\n\n if (queryInMap === query) {\n delete this.queriesMap[query.queryHash];\n }\n\n this.notify({\n type: 'removed',\n query\n });\n }\n }\n\n clear() {\n notifyManager.batch(() => {\n this.queries.forEach(query => {\n this.remove(query);\n });\n });\n }\n\n get(queryHash) {\n return this.queriesMap[queryHash];\n }\n\n getAll() {\n return this.queries;\n }\n\n find(arg1, arg2) {\n const [filters] = parseFilterArgs(arg1, arg2);\n\n if (typeof filters.exact === 'undefined') {\n filters.exact = true;\n }\n\n return this.queries.find(query => matchQuery(filters, query));\n }\n\n findAll(arg1, arg2) {\n const [filters] = parseFilterArgs(arg1, arg2);\n return Object.keys(filters).length > 0 ? this.queries.filter(query => matchQuery(filters, query)) : this.queries;\n }\n\n notify(event) {\n notifyManager.batch(() => {\n this.listeners.forEach(listener => {\n listener(event);\n });\n });\n }\n\n onFocus() {\n notifyManager.batch(() => {\n this.queries.forEach(query => {\n query.onFocus();\n });\n });\n }\n\n onOnline() {\n notifyManager.batch(() => {\n this.queries.forEach(query => {\n query.onOnline();\n });\n });\n }\n\n}\n\n// CLASS\nclass Mutation extends Removable {\n constructor(config) {\n super();\n this.options = { ...config.defaultOptions,\n ...config.options\n };\n this.mutationId = config.mutationId;\n this.mutationCache = config.mutationCache;\n this.logger = config.logger || defaultLogger;\n this.observers = [];\n this.state = config.state || getDefaultState();\n this.meta = config.meta;\n this.updateCacheTime(this.options.cacheTime);\n this.scheduleGc();\n }\n\n setState(state) {\n this.dispatch({\n type: 'setState',\n state\n });\n }\n\n addObserver(observer) {\n if (this.observers.indexOf(observer) === -1) {\n this.observers.push(observer); // Stop the mutation from being garbage collected\n\n this.clearGcTimeout();\n this.mutationCache.notify({\n type: 'observerAdded',\n mutation: this,\n observer\n });\n }\n }\n\n removeObserver(observer) {\n this.observers = this.observers.filter(x => x !== observer);\n this.scheduleGc();\n this.mutationCache.notify({\n type: 'observerRemoved',\n mutation: this,\n observer\n });\n }\n\n optionalRemove() {\n if (!this.observers.length) {\n if (this.state.status === 'loading') {\n this.scheduleGc();\n } else {\n this.mutationCache.remove(this);\n }\n }\n }\n\n continue() {\n if (this.retryer) {\n this.retryer.continue();\n return this.retryer.promise;\n }\n\n return this.execute();\n }\n\n async execute() {\n const executeMutation = () => {\n var _this$options$retry;\n\n this.retryer = createRetryer({\n fn: () => {\n if (!this.options.mutationFn) {\n return Promise.reject('No mutationFn found');\n }\n\n return this.options.mutationFn(this.state.variables);\n },\n onFail: () => {\n this.dispatch({\n type: 'failed'\n });\n },\n onPause: () => {\n this.dispatch({\n type: 'pause'\n });\n },\n onContinue: () => {\n this.dispatch({\n type: 'continue'\n });\n },\n retry: (_this$options$retry = this.options.retry) != null ? _this$options$retry : 0,\n retryDelay: this.options.retryDelay,\n networkMode: this.options.networkMode\n });\n return this.retryer.promise;\n };\n\n const restored = this.state.status === 'loading';\n\n try {\n var _this$mutationCache$c3, _this$mutationCache$c4, _this$options$onSucce, _this$options2, _this$options$onSettl, _this$options3;\n\n if (!restored) {\n var _this$mutationCache$c, _this$mutationCache$c2, _this$options$onMutat, _this$options;\n\n this.dispatch({\n type: 'loading',\n variables: this.options.variables\n }); // Notify cache callback\n\n (_this$mutationCache$c = (_this$mutationCache$c2 = this.mutationCache.config).onMutate) == null ? void 0 : _this$mutationCache$c.call(_this$mutationCache$c2, this.state.variables, this);\n const context = await ((_this$options$onMutat = (_this$options = this.options).onMutate) == null ? void 0 : _this$options$onMutat.call(_this$options, this.state.variables));\n\n if (context !== this.state.context) {\n this.dispatch({\n type: 'loading',\n context,\n variables: this.state.variables\n });\n }\n }\n\n const data = await executeMutation(); // Notify cache callback\n\n (_this$mutationCache$c3 = (_this$mutationCache$c4 = this.mutationCache.config).onSuccess) == null ? void 0 : _this$mutationCache$c3.call(_this$mutationCache$c4, data, this.state.variables, this.state.context, this);\n await ((_this$options$onSucce = (_this$options2 = this.options).onSuccess) == null ? void 0 : _this$options$onSucce.call(_this$options2, data, this.state.variables, this.state.context));\n await ((_this$options$onSettl = (_this$options3 = this.options).onSettled) == null ? void 0 : _this$options$onSettl.call(_this$options3, data, null, this.state.variables, this.state.context));\n this.dispatch({\n type: 'success',\n data\n });\n return data;\n } catch (error) {\n try {\n var _this$mutationCache$c5, _this$mutationCache$c6, _this$options$onError, _this$options4, _this$options$onSettl2, _this$options5;\n\n // Notify cache callback\n (_this$mutationCache$c5 = (_this$mutationCache$c6 = this.mutationCache.config).onError) == null ? void 0 : _this$mutationCache$c5.call(_this$mutationCache$c6, error, this.state.variables, this.state.context, this);\n\n if (process.env.NODE_ENV !== 'production') {\n this.logger.error(error);\n }\n\n await ((_this$options$onError = (_this$options4 = this.options).onError) == null ? void 0 : _this$options$onError.call(_this$options4, error, this.state.variables, this.state.context));\n await ((_this$options$onSettl2 = (_this$options5 = this.options).onSettled) == null ? void 0 : _this$options$onSettl2.call(_this$options5, undefined, error, this.state.variables, this.state.context));\n throw error;\n } finally {\n this.dispatch({\n type: 'error',\n error: error\n });\n }\n }\n }\n\n dispatch(action) {\n const reducer = state => {\n switch (action.type) {\n case 'failed':\n return { ...state,\n failureCount: state.failureCount + 1\n };\n\n case 'pause':\n return { ...state,\n isPaused: true\n };\n\n case 'continue':\n return { ...state,\n isPaused: false\n };\n\n case 'loading':\n return { ...state,\n context: action.context,\n data: undefined,\n error: null,\n isPaused: !canFetch(this.options.networkMode),\n status: 'loading',\n variables: action.variables\n };\n\n case 'success':\n return { ...state,\n data: action.data,\n error: null,\n status: 'success',\n isPaused: false\n };\n\n case 'error':\n return { ...state,\n data: undefined,\n error: action.error,\n failureCount: state.failureCount + 1,\n isPaused: false,\n status: 'error'\n };\n\n case 'setState':\n return { ...state,\n ...action.state\n };\n }\n };\n\n this.state = reducer(this.state);\n notifyManager.batch(() => {\n this.observers.forEach(observer => {\n observer.onMutationUpdate(action);\n });\n this.mutationCache.notify({\n mutation: this,\n type: 'updated',\n action\n });\n });\n }\n\n}\nfunction getDefaultState() {\n return {\n context: undefined,\n data: undefined,\n error: null,\n failureCount: 0,\n isPaused: false,\n status: 'idle',\n variables: undefined\n };\n}\n\n// CLASS\nclass MutationCache extends Subscribable {\n constructor(config) {\n super();\n this.config = config || {};\n this.mutations = [];\n this.mutationId = 0;\n }\n\n build(client, options, state) {\n const mutation = new Mutation({\n mutationCache: this,\n logger: client.getLogger(),\n mutationId: ++this.mutationId,\n options: client.defaultMutationOptions(options),\n state,\n defaultOptions: options.mutationKey ? client.getMutationDefaults(options.mutationKey) : undefined,\n meta: options.meta\n });\n this.add(mutation);\n return mutation;\n }\n\n add(mutation) {\n this.mutations.push(mutation);\n this.notify({\n type: 'added',\n mutation\n });\n }\n\n remove(mutation) {\n this.mutations = this.mutations.filter(x => x !== mutation);\n this.notify({\n type: 'removed',\n mutation\n });\n }\n\n clear() {\n notifyManager.batch(() => {\n this.mutations.forEach(mutation => {\n this.remove(mutation);\n });\n });\n }\n\n getAll() {\n return this.mutations;\n }\n\n find(filters) {\n if (typeof filters.exact === 'undefined') {\n filters.exact = true;\n }\n\n return this.mutations.find(mutation => matchMutation(filters, mutation));\n }\n\n findAll(filters) {\n return this.mutations.filter(mutation => matchMutation(filters, mutation));\n }\n\n notify(event) {\n notifyManager.batch(() => {\n this.listeners.forEach(listener => {\n listener(event);\n });\n });\n }\n\n resumePausedMutations() {\n const pausedMutations = this.mutations.filter(x => x.state.isPaused);\n return notifyManager.batch(() => pausedMutations.reduce((promise, mutation) => promise.then(() => mutation.continue().catch(noop)), Promise.resolve()));\n }\n\n}\n\nfunction infiniteQueryBehavior() {\n return {\n onFetch: context => {\n context.fetchFn = () => {\n var _context$fetchOptions, _context$fetchOptions2, _context$fetchOptions3, _context$fetchOptions4, _context$state$data, _context$state$data2;\n\n const refetchPage = (_context$fetchOptions = context.fetchOptions) == null ? void 0 : (_context$fetchOptions2 = _context$fetchOptions.meta) == null ? void 0 : _context$fetchOptions2.refetchPage;\n const fetchMore = (_context$fetchOptions3 = context.fetchOptions) == null ? void 0 : (_context$fetchOptions4 = _context$fetchOptions3.meta) == null ? void 0 : _context$fetchOptions4.fetchMore;\n const pageParam = fetchMore == null ? void 0 : fetchMore.pageParam;\n const isFetchingNextPage = (fetchMore == null ? void 0 : fetchMore.direction) === 'forward';\n const isFetchingPreviousPage = (fetchMore == null ? void 0 : fetchMore.direction) === 'backward';\n const oldPages = ((_context$state$data = context.state.data) == null ? void 0 : _context$state$data.pages) || [];\n const oldPageParams = ((_context$state$data2 = context.state.data) == null ? void 0 : _context$state$data2.pageParams) || [];\n let newPageParams = oldPageParams;\n let cancelled = false;\n\n const addSignalProperty = object => {\n Object.defineProperty(object, 'signal', {\n enumerable: true,\n get: () => {\n var _context$signal;\n\n if ((_context$signal = context.signal) != null && _context$signal.aborted) {\n cancelled = true;\n } else {\n var _context$signal2;\n\n (_context$signal2 = context.signal) == null ? void 0 : _context$signal2.addEventListener('abort', () => {\n cancelled = true;\n });\n }\n\n return context.signal;\n }\n });\n }; // Get query function\n\n\n const queryFn = context.options.queryFn || (() => Promise.reject('Missing queryFn'));\n\n const buildNewPages = (pages, param, page, previous) => {\n newPageParams = previous ? [param, ...newPageParams] : [...newPageParams, param];\n return previous ? [page, ...pages] : [...pages, page];\n }; // Create function to fetch a page\n\n\n const fetchPage = (pages, manual, param, previous) => {\n if (cancelled) {\n return Promise.reject('Cancelled');\n }\n\n if (typeof param === 'undefined' && !manual && pages.length) {\n return Promise.resolve(pages);\n }\n\n const queryFnContext = {\n queryKey: context.queryKey,\n pageParam: param,\n meta: context.meta\n };\n addSignalProperty(queryFnContext);\n const queryFnResult = queryFn(queryFnContext);\n const promise = Promise.resolve(queryFnResult).then(page => buildNewPages(pages, param, page, previous));\n return promise;\n };\n\n let promise; // Fetch first page?\n\n if (!oldPages.length) {\n promise = fetchPage([]);\n } // Fetch next page?\n else if (isFetchingNextPage) {\n const manual = typeof pageParam !== 'undefined';\n const param = manual ? pageParam : getNextPageParam(context.options, oldPages);\n promise = fetchPage(oldPages, manual, param);\n } // Fetch previous page?\n else if (isFetchingPreviousPage) {\n const manual = typeof pageParam !== 'undefined';\n const param = manual ? pageParam : getPreviousPageParam(context.options, oldPages);\n promise = fetchPage(oldPages, manual, param, true);\n } // Refetch pages\n else {\n newPageParams = [];\n const manual = typeof context.options.getNextPageParam === 'undefined';\n const shouldFetchFirstPage = refetchPage && oldPages[0] ? refetchPage(oldPages[0], 0, oldPages) : true; // Fetch first page\n\n promise = shouldFetchFirstPage ? fetchPage([], manual, oldPageParams[0]) : Promise.resolve(buildNewPages([], oldPageParams[0], oldPages[0])); // Fetch remaining pages\n\n for (let i = 1; i < oldPages.length; i++) {\n promise = promise.then(pages => {\n const shouldFetchNextPage = refetchPage && oldPages[i] ? refetchPage(oldPages[i], i, oldPages) : true;\n\n if (shouldFetchNextPage) {\n const param = manual ? oldPageParams[i] : getNextPageParam(context.options, pages);\n return fetchPage(pages, manual, param);\n }\n\n return Promise.resolve(buildNewPages(pages, oldPageParams[i], oldPages[i]));\n });\n }\n }\n\n const finalPromise = promise.then(pages => ({\n pages,\n pageParams: newPageParams\n }));\n return finalPromise;\n };\n }\n };\n}\nfunction getNextPageParam(options, pages) {\n return options.getNextPageParam == null ? void 0 : options.getNextPageParam(pages[pages.length - 1], pages);\n}\nfunction getPreviousPageParam(options, pages) {\n return options.getPreviousPageParam == null ? void 0 : options.getPreviousPageParam(pages[0], pages);\n}\n/**\n * Checks if there is a next page.\n * Returns `undefined` if it cannot be determined.\n */\n\nfunction hasNextPage(options, pages) {\n if (options.getNextPageParam && Array.isArray(pages)) {\n const nextPageParam = getNextPageParam(options, pages);\n return typeof nextPageParam !== 'undefined' && nextPageParam !== null && nextPageParam !== false;\n }\n}\n/**\n * Checks if there is a previous page.\n * Returns `undefined` if it cannot be determined.\n */\n\nfunction hasPreviousPage(options, pages) {\n if (options.getPreviousPageParam && Array.isArray(pages)) {\n const previousPageParam = getPreviousPageParam(options, pages);\n return typeof previousPageParam !== 'undefined' && previousPageParam !== null && previousPageParam !== false;\n }\n}\n\n// CLASS\nclass QueryClient {\n constructor(config = {}) {\n this.queryCache = config.queryCache || new QueryCache();\n this.mutationCache = config.mutationCache || new MutationCache();\n this.logger = config.logger || defaultLogger;\n this.defaultOptions = config.defaultOptions || {};\n this.queryDefaults = [];\n this.mutationDefaults = [];\n }\n\n mount() {\n this.unsubscribeFocus = focusManager.subscribe(() => {\n if (focusManager.isFocused()) {\n this.resumePausedMutations();\n this.queryCache.onFocus();\n }\n });\n this.unsubscribeOnline = onlineManager.subscribe(() => {\n if (onlineManager.isOnline()) {\n this.resumePausedMutations();\n this.queryCache.onOnline();\n }\n });\n }\n\n unmount() {\n var _this$unsubscribeFocu, _this$unsubscribeOnli;\n\n (_this$unsubscribeFocu = this.unsubscribeFocus) == null ? void 0 : _this$unsubscribeFocu.call(this);\n (_this$unsubscribeOnli = this.unsubscribeOnline) == null ? void 0 : _this$unsubscribeOnli.call(this);\n }\n\n isFetching(arg1, arg2) {\n const [filters] = parseFilterArgs(arg1, arg2);\n filters.fetchStatus = 'fetching';\n return this.queryCache.findAll(filters).length;\n }\n\n isMutating(filters) {\n return this.mutationCache.findAll({ ...filters,\n fetching: true\n }).length;\n }\n\n getQueryData(queryKey, filters) {\n var _this$queryCache$find;\n\n return (_this$queryCache$find = this.queryCache.find(queryKey, filters)) == null ? void 0 : _this$queryCache$find.state.data;\n }\n\n getQueriesData(queryKeyOrFilters) {\n return this.getQueryCache().findAll(queryKeyOrFilters).map(({\n queryKey,\n state\n }) => {\n const data = state.data;\n return [queryKey, data];\n });\n }\n\n setQueryData(queryKey, updater, options) {\n const query = this.queryCache.find(queryKey);\n const prevData = query == null ? void 0 : query.state.data;\n const data = functionalUpdate(updater, prevData);\n\n if (typeof data === 'undefined') {\n return undefined;\n }\n\n const parsedOptions = parseQueryArgs(queryKey);\n const defaultedOptions = this.defaultQueryOptions(parsedOptions);\n return this.queryCache.build(this, defaultedOptions).setData(data, { ...options,\n manual: true\n });\n }\n\n setQueriesData(queryKeyOrFilters, updater, options) {\n return notifyManager.batch(() => this.getQueryCache().findAll(queryKeyOrFilters).map(({\n queryKey\n }) => [queryKey, this.setQueryData(queryKey, updater, options)]));\n }\n\n getQueryState(queryKey, filters) {\n var _this$queryCache$find2;\n\n return (_this$queryCache$find2 = this.queryCache.find(queryKey, filters)) == null ? void 0 : _this$queryCache$find2.state;\n }\n\n removeQueries(arg1, arg2) {\n const [filters] = parseFilterArgs(arg1, arg2);\n const queryCache = this.queryCache;\n notifyManager.batch(() => {\n queryCache.findAll(filters).forEach(query => {\n queryCache.remove(query);\n });\n });\n }\n\n resetQueries(arg1, arg2, arg3) {\n const [filters, options] = parseFilterArgs(arg1, arg2, arg3);\n const queryCache = this.queryCache;\n const refetchFilters = {\n type: 'active',\n ...filters\n };\n return notifyManager.batch(() => {\n queryCache.findAll(filters).forEach(query => {\n query.reset();\n });\n return this.refetchQueries(refetchFilters, options);\n });\n }\n\n cancelQueries(arg1, arg2, arg3) {\n const [filters, cancelOptions = {}] = parseFilterArgs(arg1, arg2, arg3);\n\n if (typeof cancelOptions.revert === 'undefined') {\n cancelOptions.revert = true;\n }\n\n const promises = notifyManager.batch(() => this.queryCache.findAll(filters).map(query => query.cancel(cancelOptions)));\n return Promise.all(promises).then(noop).catch(noop);\n }\n\n invalidateQueries(arg1, arg2, arg3) {\n const [filters, options] = parseFilterArgs(arg1, arg2, arg3);\n return notifyManager.batch(() => {\n var _ref, _filters$refetchType;\n\n this.queryCache.findAll(filters).forEach(query => {\n query.invalidate();\n });\n\n if (filters.refetchType === 'none') {\n return Promise.resolve();\n }\n\n const refetchFilters = { ...filters,\n type: (_ref = (_filters$refetchType = filters.refetchType) != null ? _filters$refetchType : filters.type) != null ? _ref : 'active'\n };\n return this.refetchQueries(refetchFilters, options);\n });\n }\n\n refetchQueries(arg1, arg2, arg3) {\n const [filters, options] = parseFilterArgs(arg1, arg2, arg3);\n const promises = notifyManager.batch(() => this.queryCache.findAll(filters).filter(query => !query.isDisabled()).map(query => {\n var _options$cancelRefetc;\n\n return query.fetch(undefined, { ...options,\n cancelRefetch: (_options$cancelRefetc = options == null ? void 0 : options.cancelRefetch) != null ? _options$cancelRefetc : true,\n meta: {\n refetchPage: filters.refetchPage\n }\n });\n }));\n let promise = Promise.all(promises).then(noop);\n\n if (!(options != null && options.throwOnError)) {\n promise = promise.catch(noop);\n }\n\n return promise;\n }\n\n fetchQuery(arg1, arg2, arg3) {\n const parsedOptions = parseQueryArgs(arg1, arg2, arg3);\n const defaultedOptions = this.defaultQueryOptions(parsedOptions); // https://github.com/tannerlinsley/react-query/issues/652\n\n if (typeof defaultedOptions.retry === 'undefined') {\n defaultedOptions.retry = false;\n }\n\n const query = this.queryCache.build(this, defaultedOptions);\n return query.isStaleByTime(defaultedOptions.staleTime) ? query.fetch(defaultedOptions) : Promise.resolve(query.state.data);\n }\n\n prefetchQuery(arg1, arg2, arg3) {\n return this.fetchQuery(arg1, arg2, arg3).then(noop).catch(noop);\n }\n\n fetchInfiniteQuery(arg1, arg2, arg3) {\n const parsedOptions = parseQueryArgs(arg1, arg2, arg3);\n parsedOptions.behavior = infiniteQueryBehavior();\n return this.fetchQuery(parsedOptions);\n }\n\n prefetchInfiniteQuery(arg1, arg2, arg3) {\n return this.fetchInfiniteQuery(arg1, arg2, arg3).then(noop).catch(noop);\n }\n\n resumePausedMutations() {\n return this.mutationCache.resumePausedMutations();\n }\n\n getQueryCache() {\n return this.queryCache;\n }\n\n getMutationCache() {\n return this.mutationCache;\n }\n\n getLogger() {\n return this.logger;\n }\n\n getDefaultOptions() {\n return this.defaultOptions;\n }\n\n setDefaultOptions(options) {\n this.defaultOptions = options;\n }\n\n setQueryDefaults(queryKey, options) {\n const result = this.queryDefaults.find(x => hashQueryKey(queryKey) === hashQueryKey(x.queryKey));\n\n if (result) {\n result.defaultOptions = options;\n } else {\n this.queryDefaults.push({\n queryKey,\n defaultOptions: options\n });\n }\n }\n\n getQueryDefaults(queryKey) {\n if (!queryKey) {\n return undefined;\n } // Get the first matching defaults\n\n\n const firstMatchingDefaults = this.queryDefaults.find(x => partialMatchKey(queryKey, x.queryKey)); // Additional checks and error in dev mode\n\n if (process.env.NODE_ENV !== 'production') {\n // Retrieve all matching defaults for the given key\n const matchingDefaults = this.queryDefaults.filter(x => partialMatchKey(queryKey, x.queryKey)); // It is ok not having defaults, but it is error prone to have more than 1 default for a given key\n\n if (matchingDefaults.length > 1) {\n this.logger.error(\"[QueryClient] Several query defaults match with key '\" + JSON.stringify(queryKey) + \"'. The first matching query defaults are used. Please check how query defaults are registered. Order does matter here. cf. https://react-query.tanstack.com/reference/QueryClient#queryclientsetquerydefaults.\");\n }\n }\n\n return firstMatchingDefaults == null ? void 0 : firstMatchingDefaults.defaultOptions;\n }\n\n setMutationDefaults(mutationKey, options) {\n const result = this.mutationDefaults.find(x => hashQueryKey(mutationKey) === hashQueryKey(x.mutationKey));\n\n if (result) {\n result.defaultOptions = options;\n } else {\n this.mutationDefaults.push({\n mutationKey,\n defaultOptions: options\n });\n }\n }\n\n getMutationDefaults(mutationKey) {\n if (!mutationKey) {\n return undefined;\n } // Get the first matching defaults\n\n\n const firstMatchingDefaults = this.mutationDefaults.find(x => partialMatchKey(mutationKey, x.mutationKey)); // Additional checks and error in dev mode\n\n if (process.env.NODE_ENV !== 'production') {\n // Retrieve all matching defaults for the given key\n const matchingDefaults = this.mutationDefaults.filter(x => partialMatchKey(mutationKey, x.mutationKey)); // It is ok not having defaults, but it is error prone to have more than 1 default for a given key\n\n if (matchingDefaults.length > 1) {\n this.logger.error(\"[QueryClient] Several mutation defaults match with key '\" + JSON.stringify(mutationKey) + \"'. The first matching mutation defaults are used. Please check how mutation defaults are registered. Order does matter here. cf. https://react-query.tanstack.com/reference/QueryClient#queryclientsetmutationdefaults.\");\n }\n }\n\n return firstMatchingDefaults == null ? void 0 : firstMatchingDefaults.defaultOptions;\n }\n\n defaultQueryOptions(options) {\n if (options != null && options._defaulted) {\n return options;\n }\n\n const defaultedOptions = { ...this.defaultOptions.queries,\n ...this.getQueryDefaults(options == null ? void 0 : options.queryKey),\n ...options,\n _defaulted: true\n };\n\n if (!defaultedOptions.queryHash && defaultedOptions.queryKey) {\n defaultedOptions.queryHash = hashQueryKeyByOptions(defaultedOptions.queryKey, defaultedOptions);\n } // dependent default values\n\n\n if (typeof defaultedOptions.refetchOnReconnect === 'undefined') {\n defaultedOptions.refetchOnReconnect = defaultedOptions.networkMode !== 'always';\n }\n\n if (typeof defaultedOptions.useErrorBoundary === 'undefined') {\n defaultedOptions.useErrorBoundary = !!defaultedOptions.suspense;\n }\n\n return defaultedOptions;\n }\n\n defaultMutationOptions(options) {\n if (options != null && options._defaulted) {\n return options;\n }\n\n return { ...this.defaultOptions.mutations,\n ...this.getMutationDefaults(options == null ? void 0 : options.mutationKey),\n ...options,\n _defaulted: true\n };\n }\n\n clear() {\n this.queryCache.clear();\n this.mutationCache.clear();\n }\n\n}\n\nclass QueryObserver extends Subscribable {\n constructor(client, options) {\n super();\n this.client = client;\n this.options = options;\n this.trackedProps = new Set();\n this.selectError = null;\n this.bindMethods();\n this.setOptions(options);\n }\n\n bindMethods() {\n this.remove = this.remove.bind(this);\n this.refetch = this.refetch.bind(this);\n }\n\n onSubscribe() {\n if (this.listeners.length === 1) {\n this.currentQuery.addObserver(this);\n\n if (shouldFetchOnMount(this.currentQuery, this.options)) {\n this.executeFetch();\n }\n\n this.updateTimers();\n }\n }\n\n onUnsubscribe() {\n if (!this.listeners.length) {\n this.destroy();\n }\n }\n\n shouldFetchOnReconnect() {\n return shouldFetchOn(this.currentQuery, this.options, this.options.refetchOnReconnect);\n }\n\n shouldFetchOnWindowFocus() {\n return shouldFetchOn(this.currentQuery, this.options, this.options.refetchOnWindowFocus);\n }\n\n destroy() {\n this.listeners = [];\n this.clearStaleTimeout();\n this.clearRefetchInterval();\n this.currentQuery.removeObserver(this);\n }\n\n setOptions(options, notifyOptions) {\n const prevOptions = this.options;\n const prevQuery = this.currentQuery;\n this.options = this.client.defaultQueryOptions(options);\n\n if (!shallowEqualObjects(prevOptions, this.options)) {\n this.client.getQueryCache().notify({\n type: 'observerOptionsUpdated',\n query: this.currentQuery,\n observer: this\n });\n }\n\n if (typeof this.options.enabled !== 'undefined' && typeof this.options.enabled !== 'boolean') {\n throw new Error('Expected enabled to be a boolean');\n } // Keep previous query key if the user does not supply one\n\n\n if (!this.options.queryKey) {\n this.options.queryKey = prevOptions.queryKey;\n }\n\n this.updateQuery();\n const mounted = this.hasListeners(); // Fetch if there are subscribers\n\n if (mounted && shouldFetchOptionally(this.currentQuery, prevQuery, this.options, prevOptions)) {\n this.executeFetch();\n } // Update result\n\n\n this.updateResult(notifyOptions); // Update stale interval if needed\n\n if (mounted && (this.currentQuery !== prevQuery || this.options.enabled !== prevOptions.enabled || this.options.staleTime !== prevOptions.staleTime)) {\n this.updateStaleTimeout();\n }\n\n const nextRefetchInterval = this.computeRefetchInterval(); // Update refetch interval if needed\n\n if (mounted && (this.currentQuery !== prevQuery || this.options.enabled !== prevOptions.enabled || nextRefetchInterval !== this.currentRefetchInterval)) {\n this.updateRefetchInterval(nextRefetchInterval);\n }\n }\n\n getOptimisticResult(options) {\n const query = this.client.getQueryCache().build(this.client, options);\n return this.createResult(query, options);\n }\n\n getCurrentResult() {\n return this.currentResult;\n }\n\n trackResult(result) {\n const trackedResult = {};\n Object.keys(result).forEach(key => {\n Object.defineProperty(trackedResult, key, {\n configurable: false,\n enumerable: true,\n get: () => {\n this.trackedProps.add(key);\n return result[key];\n }\n });\n });\n return trackedResult;\n }\n\n getCurrentQuery() {\n return this.currentQuery;\n }\n\n remove() {\n this.client.getQueryCache().remove(this.currentQuery);\n }\n\n refetch({\n refetchPage,\n ...options\n } = {}) {\n return this.fetch({ ...options,\n meta: {\n refetchPage\n }\n });\n }\n\n fetchOptimistic(options) {\n const defaultedOptions = this.client.defaultQueryOptions(options);\n const query = this.client.getQueryCache().build(this.client, defaultedOptions);\n query.isFetchingOptimistic = true;\n return query.fetch().then(() => this.createResult(query, defaultedOptions));\n }\n\n fetch(fetchOptions) {\n var _fetchOptions$cancelR;\n\n return this.executeFetch({ ...fetchOptions,\n cancelRefetch: (_fetchOptions$cancelR = fetchOptions.cancelRefetch) != null ? _fetchOptions$cancelR : true\n }).then(() => {\n this.updateResult();\n return this.currentResult;\n });\n }\n\n executeFetch(fetchOptions) {\n // Make sure we reference the latest query as the current one might have been removed\n this.updateQuery(); // Fetch\n\n let promise = this.currentQuery.fetch(this.options, fetchOptions);\n\n if (!(fetchOptions != null && fetchOptions.throwOnError)) {\n promise = promise.catch(noop);\n }\n\n return promise;\n }\n\n updateStaleTimeout() {\n this.clearStaleTimeout();\n\n if (isServer || this.currentResult.isStale || !isValidTimeout(this.options.staleTime)) {\n return;\n }\n\n const time = timeUntilStale(this.currentResult.dataUpdatedAt, this.options.staleTime); // The timeout is sometimes triggered 1 ms before the stale time expiration.\n // To mitigate this issue we always add 1 ms to the timeout.\n\n const timeout = time + 1;\n this.staleTimeoutId = setTimeout(() => {\n if (!this.currentResult.isStale) {\n this.updateResult();\n }\n }, timeout);\n }\n\n computeRefetchInterval() {\n var _this$options$refetch;\n\n return typeof this.options.refetchInterval === 'function' ? this.options.refetchInterval(this.currentResult.data, this.currentQuery) : (_this$options$refetch = this.options.refetchInterval) != null ? _this$options$refetch : false;\n }\n\n updateRefetchInterval(nextInterval) {\n this.clearRefetchInterval();\n this.currentRefetchInterval = nextInterval;\n\n if (isServer || this.options.enabled === false || !isValidTimeout(this.currentRefetchInterval) || this.currentRefetchInterval === 0) {\n return;\n }\n\n this.refetchIntervalId = setInterval(() => {\n if (this.options.refetchIntervalInBackground || focusManager.isFocused()) {\n this.executeFetch();\n }\n }, this.currentRefetchInterval);\n }\n\n updateTimers() {\n this.updateStaleTimeout();\n this.updateRefetchInterval(this.computeRefetchInterval());\n }\n\n clearStaleTimeout() {\n if (this.staleTimeoutId) {\n clearTimeout(this.staleTimeoutId);\n this.staleTimeoutId = undefined;\n }\n }\n\n clearRefetchInterval() {\n if (this.refetchIntervalId) {\n clearInterval(this.refetchIntervalId);\n this.refetchIntervalId = undefined;\n }\n }\n\n createResult(query, options) {\n const prevQuery = this.currentQuery;\n const prevOptions = this.options;\n const prevResult = this.currentResult;\n const prevResultState = this.currentResultState;\n const prevResultOptions = this.currentResultOptions;\n const queryChange = query !== prevQuery;\n const queryInitialState = queryChange ? query.state : this.currentQueryInitialState;\n const prevQueryResult = queryChange ? this.currentResult : this.previousQueryResult;\n const {\n state\n } = query;\n let {\n dataUpdatedAt,\n error,\n errorUpdatedAt,\n fetchStatus,\n status\n } = state;\n let isPreviousData = false;\n let isPlaceholderData = false;\n let data; // Optimistically set result in fetching state if needed\n\n if (options._optimisticResults) {\n const mounted = this.hasListeners();\n const fetchOnMount = !mounted && shouldFetchOnMount(query, options);\n const fetchOptionally = mounted && shouldFetchOptionally(query, prevQuery, options, prevOptions);\n\n if (fetchOnMount || fetchOptionally) {\n fetchStatus = canFetch(query.options.networkMode) ? 'fetching' : 'paused';\n\n if (!dataUpdatedAt) {\n status = 'loading';\n }\n }\n\n if (options._optimisticResults === 'isRestoring') {\n fetchStatus = 'idle';\n }\n } // Keep previous data if needed\n\n\n if (options.keepPreviousData && !state.dataUpdateCount && prevQueryResult != null && prevQueryResult.isSuccess && status !== 'error') {\n data = prevQueryResult.data;\n dataUpdatedAt = prevQueryResult.dataUpdatedAt;\n status = prevQueryResult.status;\n isPreviousData = true;\n } // Select data if needed\n else if (options.select && typeof state.data !== 'undefined') {\n // Memoize select result\n if (prevResult && state.data === (prevResultState == null ? void 0 : prevResultState.data) && options.select === this.selectFn) {\n data = this.selectResult;\n } else {\n try {\n this.selectFn = options.select;\n data = options.select(state.data);\n data = replaceData(prevResult == null ? void 0 : prevResult.data, data, options);\n this.selectResult = data;\n this.selectError = null;\n } catch (selectError) {\n if (process.env.NODE_ENV !== 'production') {\n this.client.getLogger().error(selectError);\n }\n\n this.selectError = selectError;\n }\n }\n } // Use query data\n else {\n data = state.data;\n } // Show placeholder data if needed\n\n\n if (typeof options.placeholderData !== 'undefined' && typeof data === 'undefined' && status === 'loading') {\n let placeholderData; // Memoize placeholder data\n\n if (prevResult != null && prevResult.isPlaceholderData && options.placeholderData === (prevResultOptions == null ? void 0 : prevResultOptions.placeholderData)) {\n placeholderData = prevResult.data;\n } else {\n placeholderData = typeof options.placeholderData === 'function' ? options.placeholderData() : options.placeholderData;\n\n if (options.select && typeof placeholderData !== 'undefined') {\n try {\n placeholderData = options.select(placeholderData);\n placeholderData = replaceData(prevResult == null ? void 0 : prevResult.data, placeholderData, options);\n this.selectError = null;\n } catch (selectError) {\n if (process.env.NODE_ENV !== 'production') {\n this.client.getLogger().error(selectError);\n }\n\n this.selectError = selectError;\n }\n }\n }\n\n if (typeof placeholderData !== 'undefined') {\n status = 'success';\n data = placeholderData;\n isPlaceholderData = true;\n }\n }\n\n if (this.selectError) {\n error = this.selectError;\n data = this.selectResult;\n errorUpdatedAt = Date.now();\n status = 'error';\n }\n\n const isFetching = fetchStatus === 'fetching';\n const result = {\n status,\n fetchStatus,\n isLoading: status === 'loading',\n isSuccess: status === 'success',\n isError: status === 'error',\n data,\n dataUpdatedAt,\n error,\n errorUpdatedAt,\n failureCount: state.fetchFailureCount,\n errorUpdateCount: state.errorUpdateCount,\n isFetched: state.dataUpdateCount > 0 || state.errorUpdateCount > 0,\n isFetchedAfterMount: state.dataUpdateCount > queryInitialState.dataUpdateCount || state.errorUpdateCount > queryInitialState.errorUpdateCount,\n isFetching: isFetching,\n isRefetching: isFetching && status !== 'loading',\n isLoadingError: status === 'error' && state.dataUpdatedAt === 0,\n isPaused: fetchStatus === 'paused',\n isPlaceholderData,\n isPreviousData,\n isRefetchError: status === 'error' && state.dataUpdatedAt !== 0,\n isStale: isStale(query, options),\n refetch: this.refetch,\n remove: this.remove\n };\n return result;\n }\n\n updateResult(notifyOptions) {\n const prevResult = this.currentResult;\n const nextResult = this.createResult(this.currentQuery, this.options);\n this.currentResultState = this.currentQuery.state;\n this.currentResultOptions = this.options; // Only notify and update result if something has changed\n\n if (shallowEqualObjects(nextResult, prevResult)) {\n return;\n }\n\n this.currentResult = nextResult; // Determine which callbacks to trigger\n\n const defaultNotifyOptions = {\n cache: true\n };\n\n const shouldNotifyListeners = () => {\n if (!prevResult) {\n return true;\n }\n\n const {\n notifyOnChangeProps\n } = this.options;\n\n if (notifyOnChangeProps === 'all' || !notifyOnChangeProps && !this.trackedProps.size) {\n return true;\n }\n\n const includedProps = new Set(notifyOnChangeProps != null ? notifyOnChangeProps : this.trackedProps);\n\n if (this.options.useErrorBoundary) {\n includedProps.add('error');\n }\n\n return Object.keys(this.currentResult).some(key => {\n const typedKey = key;\n const changed = this.currentResult[typedKey] !== prevResult[typedKey];\n return changed && includedProps.has(typedKey);\n });\n };\n\n if ((notifyOptions == null ? void 0 : notifyOptions.listeners) !== false && shouldNotifyListeners()) {\n defaultNotifyOptions.listeners = true;\n }\n\n this.notify({ ...defaultNotifyOptions,\n ...notifyOptions\n });\n }\n\n updateQuery() {\n const query = this.client.getQueryCache().build(this.client, this.options);\n\n if (query === this.currentQuery) {\n return;\n }\n\n const prevQuery = this.currentQuery;\n this.currentQuery = query;\n this.currentQueryInitialState = query.state;\n this.previousQueryResult = this.currentResult;\n\n if (this.hasListeners()) {\n prevQuery == null ? void 0 : prevQuery.removeObserver(this);\n query.addObserver(this);\n }\n }\n\n onQueryUpdate(action) {\n const notifyOptions = {};\n\n if (action.type === 'success') {\n notifyOptions.onSuccess = !action.manual;\n } else if (action.type === 'error' && !isCancelledError(action.error)) {\n notifyOptions.onError = true;\n }\n\n this.updateResult(notifyOptions);\n\n if (this.hasListeners()) {\n this.updateTimers();\n }\n }\n\n notify(notifyOptions) {\n notifyManager.batch(() => {\n // First trigger the configuration callbacks\n if (notifyOptions.onSuccess) {\n var _this$options$onSucce, _this$options, _this$options$onSettl, _this$options2;\n\n (_this$options$onSucce = (_this$options = this.options).onSuccess) == null ? void 0 : _this$options$onSucce.call(_this$options, this.currentResult.data);\n (_this$options$onSettl = (_this$options2 = this.options).onSettled) == null ? void 0 : _this$options$onSettl.call(_this$options2, this.currentResult.data, null);\n } else if (notifyOptions.onError) {\n var _this$options$onError, _this$options3, _this$options$onSettl2, _this$options4;\n\n (_this$options$onError = (_this$options3 = this.options).onError) == null ? void 0 : _this$options$onError.call(_this$options3, this.currentResult.error);\n (_this$options$onSettl2 = (_this$options4 = this.options).onSettled) == null ? void 0 : _this$options$onSettl2.call(_this$options4, undefined, this.currentResult.error);\n } // Then trigger the listeners\n\n\n if (notifyOptions.listeners) {\n this.listeners.forEach(listener => {\n listener(this.currentResult);\n });\n } // Then the cache listeners\n\n\n if (notifyOptions.cache) {\n this.client.getQueryCache().notify({\n query: this.currentQuery,\n type: 'observerResultsUpdated'\n });\n }\n });\n }\n\n}\n\nfunction shouldLoadOnMount(query, options) {\n return options.enabled !== false && !query.state.dataUpdatedAt && !(query.state.status === 'error' && options.retryOnMount === false);\n}\n\nfunction shouldFetchOnMount(query, options) {\n return shouldLoadOnMount(query, options) || query.state.dataUpdatedAt > 0 && shouldFetchOn(query, options, options.refetchOnMount);\n}\n\nfunction shouldFetchOn(query, options, field) {\n if (options.enabled !== false) {\n const value = typeof field === 'function' ? field(query) : field;\n return value === 'always' || value !== false && isStale(query, options);\n }\n\n return false;\n}\n\nfunction shouldFetchOptionally(query, prevQuery, options, prevOptions) {\n return options.enabled !== false && (query !== prevQuery || prevOptions.enabled === false) && (!options.suspense || query.state.status !== 'error') && isStale(query, options);\n}\n\nfunction isStale(query, options) {\n return query.isStaleByTime(options.staleTime);\n}\n\nclass QueriesObserver extends Subscribable {\n constructor(client, queries) {\n super();\n this.client = client;\n this.queries = [];\n this.result = [];\n this.observers = [];\n this.observersMap = {};\n\n if (queries) {\n this.setQueries(queries);\n }\n }\n\n onSubscribe() {\n if (this.listeners.length === 1) {\n this.observers.forEach(observer => {\n observer.subscribe(result => {\n this.onUpdate(observer, result);\n });\n });\n }\n }\n\n onUnsubscribe() {\n if (!this.listeners.length) {\n this.destroy();\n }\n }\n\n destroy() {\n this.listeners = [];\n this.observers.forEach(observer => {\n observer.destroy();\n });\n }\n\n setQueries(queries, notifyOptions) {\n this.queries = queries;\n notifyManager.batch(() => {\n const prevObservers = this.observers;\n const newObserverMatches = this.findMatchingObservers(this.queries); // set options for the new observers to notify of changes\n\n newObserverMatches.forEach(match => match.observer.setOptions(match.defaultedQueryOptions, notifyOptions));\n const newObservers = newObserverMatches.map(match => match.observer);\n const newObserversMap = Object.fromEntries(newObservers.map(observer => [observer.options.queryHash, observer]));\n const newResult = newObservers.map(observer => observer.getCurrentResult());\n const hasIndexChange = newObservers.some((observer, index) => observer !== prevObservers[index]);\n\n if (prevObservers.length === newObservers.length && !hasIndexChange) {\n return;\n }\n\n this.observers = newObservers;\n this.observersMap = newObserversMap;\n this.result = newResult;\n\n if (!this.hasListeners()) {\n return;\n }\n\n difference(prevObservers, newObservers).forEach(observer => {\n observer.destroy();\n });\n difference(newObservers, prevObservers).forEach(observer => {\n observer.subscribe(result => {\n this.onUpdate(observer, result);\n });\n });\n this.notify();\n });\n }\n\n getCurrentResult() {\n return this.result;\n }\n\n getOptimisticResult(queries) {\n return this.findMatchingObservers(queries).map(match => match.observer.getOptimisticResult(match.defaultedQueryOptions));\n }\n\n findMatchingObservers(queries) {\n const prevObservers = this.observers;\n const defaultedQueryOptions = queries.map(options => this.client.defaultQueryOptions(options));\n const matchingObservers = defaultedQueryOptions.flatMap(defaultedOptions => {\n const match = prevObservers.find(observer => observer.options.queryHash === defaultedOptions.queryHash);\n\n if (match != null) {\n return [{\n defaultedQueryOptions: defaultedOptions,\n observer: match\n }];\n }\n\n return [];\n });\n const matchedQueryHashes = matchingObservers.map(match => match.defaultedQueryOptions.queryHash);\n const unmatchedQueries = defaultedQueryOptions.filter(defaultedOptions => !matchedQueryHashes.includes(defaultedOptions.queryHash));\n const unmatchedObservers = prevObservers.filter(prevObserver => !matchingObservers.some(match => match.observer === prevObserver));\n\n const getObserver = options => {\n const defaultedOptions = this.client.defaultQueryOptions(options);\n const currentObserver = this.observersMap[defaultedOptions.queryHash];\n return currentObserver != null ? currentObserver : new QueryObserver(this.client, defaultedOptions);\n };\n\n const newOrReusedObservers = unmatchedQueries.map((options, index) => {\n if (options.keepPreviousData) {\n // return previous data from one of the observers that no longer match\n const previouslyUsedObserver = unmatchedObservers[index];\n\n if (previouslyUsedObserver !== undefined) {\n return {\n defaultedQueryOptions: options,\n observer: previouslyUsedObserver\n };\n }\n }\n\n return {\n defaultedQueryOptions: options,\n observer: getObserver(options)\n };\n });\n\n const sortMatchesByOrderOfQueries = (a, b) => defaultedQueryOptions.indexOf(a.defaultedQueryOptions) - defaultedQueryOptions.indexOf(b.defaultedQueryOptions);\n\n return matchingObservers.concat(newOrReusedObservers).sort(sortMatchesByOrderOfQueries);\n }\n\n onUpdate(observer, result) {\n const index = this.observers.indexOf(observer);\n\n if (index !== -1) {\n this.result = replaceAt(this.result, index, result);\n this.notify();\n }\n }\n\n notify() {\n notifyManager.batch(() => {\n this.listeners.forEach(listener => {\n listener(this.result);\n });\n });\n }\n\n}\n\nclass InfiniteQueryObserver extends QueryObserver {\n // Type override\n // Type override\n // Type override\n // eslint-disable-next-line @typescript-eslint/no-useless-constructor\n constructor(client, options) {\n super(client, options);\n }\n\n bindMethods() {\n super.bindMethods();\n this.fetchNextPage = this.fetchNextPage.bind(this);\n this.fetchPreviousPage = this.fetchPreviousPage.bind(this);\n }\n\n setOptions(options, notifyOptions) {\n super.setOptions({ ...options,\n behavior: infiniteQueryBehavior()\n }, notifyOptions);\n }\n\n getOptimisticResult(options) {\n options.behavior = infiniteQueryBehavior();\n return super.getOptimisticResult(options);\n }\n\n fetchNextPage({\n pageParam,\n ...options\n } = {}) {\n return this.fetch({ ...options,\n meta: {\n fetchMore: {\n direction: 'forward',\n pageParam\n }\n }\n });\n }\n\n fetchPreviousPage({\n pageParam,\n ...options\n } = {}) {\n return this.fetch({ ...options,\n meta: {\n fetchMore: {\n direction: 'backward',\n pageParam\n }\n }\n });\n }\n\n createResult(query, options) {\n var _state$data, _state$data2, _state$fetchMeta, _state$fetchMeta$fetc, _state$fetchMeta2, _state$fetchMeta2$fet;\n\n const {\n state\n } = query;\n const result = super.createResult(query, options);\n return { ...result,\n fetchNextPage: this.fetchNextPage,\n fetchPreviousPage: this.fetchPreviousPage,\n hasNextPage: hasNextPage(options, (_state$data = state.data) == null ? void 0 : _state$data.pages),\n hasPreviousPage: hasPreviousPage(options, (_state$data2 = state.data) == null ? void 0 : _state$data2.pages),\n isFetchingNextPage: state.fetchStatus === 'fetching' && ((_state$fetchMeta = state.fetchMeta) == null ? void 0 : (_state$fetchMeta$fetc = _state$fetchMeta.fetchMore) == null ? void 0 : _state$fetchMeta$fetc.direction) === 'forward',\n isFetchingPreviousPage: state.fetchStatus === 'fetching' && ((_state$fetchMeta2 = state.fetchMeta) == null ? void 0 : (_state$fetchMeta2$fet = _state$fetchMeta2.fetchMore) == null ? void 0 : _state$fetchMeta2$fet.direction) === 'backward'\n };\n }\n\n}\n\n// CLASS\nclass MutationObserver extends Subscribable {\n constructor(client, options) {\n super();\n this.client = client;\n this.setOptions(options);\n this.bindMethods();\n this.updateResult();\n }\n\n bindMethods() {\n this.mutate = this.mutate.bind(this);\n this.reset = this.reset.bind(this);\n }\n\n setOptions(options) {\n const prevOptions = this.options;\n this.options = this.client.defaultMutationOptions(options);\n\n if (!shallowEqualObjects(prevOptions, this.options)) {\n this.client.getMutationCache().notify({\n type: 'observerOptionsUpdated',\n mutation: this.currentMutation,\n observer: this\n });\n }\n }\n\n onUnsubscribe() {\n if (!this.listeners.length) {\n var _this$currentMutation;\n\n (_this$currentMutation = this.currentMutation) == null ? void 0 : _this$currentMutation.removeObserver(this);\n }\n }\n\n onMutationUpdate(action) {\n this.updateResult(); // Determine which callbacks to trigger\n\n const notifyOptions = {\n listeners: true\n };\n\n if (action.type === 'success') {\n notifyOptions.onSuccess = true;\n } else if (action.type === 'error') {\n notifyOptions.onError = true;\n }\n\n this.notify(notifyOptions);\n }\n\n getCurrentResult() {\n return this.currentResult;\n }\n\n reset() {\n this.currentMutation = undefined;\n this.updateResult();\n this.notify({\n listeners: true\n });\n }\n\n mutate(variables, options) {\n this.mutateOptions = options;\n\n if (this.currentMutation) {\n this.currentMutation.removeObserver(this);\n }\n\n this.currentMutation = this.client.getMutationCache().build(this.client, { ...this.options,\n variables: typeof variables !== 'undefined' ? variables : this.options.variables\n });\n this.currentMutation.addObserver(this);\n return this.currentMutation.execute();\n }\n\n updateResult() {\n const state = this.currentMutation ? this.currentMutation.state : getDefaultState();\n const result = { ...state,\n isLoading: state.status === 'loading',\n isSuccess: state.status === 'success',\n isError: state.status === 'error',\n isIdle: state.status === 'idle',\n mutate: this.mutate,\n reset: this.reset\n };\n this.currentResult = result;\n }\n\n notify(options) {\n notifyManager.batch(() => {\n // First trigger the mutate callbacks\n if (this.mutateOptions) {\n if (options.onSuccess) {\n var _this$mutateOptions$o, _this$mutateOptions, _this$mutateOptions$o2, _this$mutateOptions2;\n\n (_this$mutateOptions$o = (_this$mutateOptions = this.mutateOptions).onSuccess) == null ? void 0 : _this$mutateOptions$o.call(_this$mutateOptions, this.currentResult.data, this.currentResult.variables, this.currentResult.context);\n (_this$mutateOptions$o2 = (_this$mutateOptions2 = this.mutateOptions).onSettled) == null ? void 0 : _this$mutateOptions$o2.call(_this$mutateOptions2, this.currentResult.data, null, this.currentResult.variables, this.currentResult.context);\n } else if (options.onError) {\n var _this$mutateOptions$o3, _this$mutateOptions3, _this$mutateOptions$o4, _this$mutateOptions4;\n\n (_this$mutateOptions$o3 = (_this$mutateOptions3 = this.mutateOptions).onError) == null ? void 0 : _this$mutateOptions$o3.call(_this$mutateOptions3, this.currentResult.error, this.currentResult.variables, this.currentResult.context);\n (_this$mutateOptions$o4 = (_this$mutateOptions4 = this.mutateOptions).onSettled) == null ? void 0 : _this$mutateOptions$o4.call(_this$mutateOptions4, undefined, this.currentResult.error, this.currentResult.variables, this.currentResult.context);\n }\n } // Then trigger the listeners\n\n\n if (options.listeners) {\n this.listeners.forEach(listener => {\n listener(this.currentResult);\n });\n }\n });\n }\n\n}\n\n// TYPES\n// FUNCTIONS\nfunction dehydrateMutation(mutation) {\n return {\n mutationKey: mutation.options.mutationKey,\n state: mutation.state\n };\n} // Most config is not dehydrated but instead meant to configure again when\n// consuming the de/rehydrated data, typically with useQuery on the client.\n// Sometimes it might make sense to prefetch data on the server and include\n// in the html-payload, but not consume it on the initial render.\n\n\nfunction dehydrateQuery(query) {\n return {\n state: query.state,\n queryKey: query.queryKey,\n queryHash: query.queryHash\n };\n}\n\nfunction defaultShouldDehydrateMutation(mutation) {\n return mutation.state.isPaused;\n}\n\nfunction defaultShouldDehydrateQuery(query) {\n return query.state.status === 'success';\n}\n\nfunction dehydrate(client, options = {}) {\n const mutations = [];\n const queries = [];\n\n if (options.dehydrateMutations !== false) {\n const shouldDehydrateMutation = options.shouldDehydrateMutation || defaultShouldDehydrateMutation;\n client.getMutationCache().getAll().forEach(mutation => {\n if (shouldDehydrateMutation(mutation)) {\n mutations.push(dehydrateMutation(mutation));\n }\n });\n }\n\n if (options.dehydrateQueries !== false) {\n const shouldDehydrateQuery = options.shouldDehydrateQuery || defaultShouldDehydrateQuery;\n client.getQueryCache().getAll().forEach(query => {\n if (shouldDehydrateQuery(query)) {\n queries.push(dehydrateQuery(query));\n }\n });\n }\n\n return {\n mutations,\n queries\n };\n}\nfunction hydrate(client, dehydratedState, options) {\n if (typeof dehydratedState !== 'object' || dehydratedState === null) {\n return;\n }\n\n const mutationCache = client.getMutationCache();\n const queryCache = client.getQueryCache(); // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n\n const mutations = dehydratedState.mutations || []; // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n\n const queries = dehydratedState.queries || [];\n mutations.forEach(dehydratedMutation => {\n var _options$defaultOptio;\n\n mutationCache.build(client, { ...(options == null ? void 0 : (_options$defaultOptio = options.defaultOptions) == null ? void 0 : _options$defaultOptio.mutations),\n mutationKey: dehydratedMutation.mutationKey\n }, dehydratedMutation.state);\n });\n queries.forEach(dehydratedQuery => {\n var _options$defaultOptio2;\n\n const query = queryCache.get(dehydratedQuery.queryHash); // Do not hydrate if an existing query exists with newer data\n\n if (query) {\n if (query.state.dataUpdatedAt < dehydratedQuery.state.dataUpdatedAt) {\n query.setState(dehydratedQuery.state);\n }\n\n return;\n } // Restore query\n\n\n queryCache.build(client, { ...(options == null ? void 0 : (_options$defaultOptio2 = options.defaultOptions) == null ? void 0 : _options$defaultOptio2.queries),\n queryKey: dehydratedQuery.queryKey,\n queryHash: dehydratedQuery.queryHash\n }, dehydratedQuery.state);\n });\n}\n\nexport { CancelledError, InfiniteQueryObserver, MutationCache, MutationObserver, QueriesObserver, QueryCache, QueryClient, QueryObserver, dehydrate, focusManager, hashQueryKey, hydrate, isCancelledError, isError, notifyManager, onlineManager, parseFilterArgs, parseMutationArgs, parseMutationFilterArgs, parseQueryArgs };\n//# sourceMappingURL=index.js.map\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,YAAY,CAAC;AACnB,EAAE,WAAW,GAAG;AAChB,IAAI,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;AACxB,IAAI,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC/C,GAAG;AACH;AACA,EAAE,SAAS,CAAC,QAAQ,EAAE;AACtB,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAClC,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;AACvB,IAAI,OAAO,MAAM;AACjB,MAAM,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,KAAK,QAAQ,CAAC,CAAC;AAClE,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;AAC3B,KAAK,CAAC;AACN,GAAG;AACH;AACA,EAAE,YAAY,GAAG;AACjB,IAAI,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC;AACrC,GAAG;AACH;AACA,EAAE,WAAW,GAAG;AAChB,GAAG;AACH;AACA,EAAE,aAAa,GAAG;AAClB,GAAG;AACH;AACA,CAAC;AACD;AACA;AACA;AACA,MAAM,QAAQ,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC;AAyT/C;AACA,MAAM,YAAY,SAAS,YAAY,CAAC;AACxC,EAAE,WAAW,GAAG;AAChB,IAAI,KAAK,EAAE,CAAC;AACZ;AACA,IAAI,IAAI,CAAC,KAAK,GAAG,OAAO,IAAI;AAC5B;AACA;A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