PluginProbe
Elementor Website Builder – more than just a page builder / 3.17.2
Elementor Website Builder – more than just a page builder v3.17.2
4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
elementor / assets / js / packages / query / query.js

query.js in Elementor Website Builder – more than just a page builder 3.17.2, at assets/js/packages/query/query.js

4,153 lines 144.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /******/ (function() { // webpackBootstrap
2 /******/ "use strict";
3 /******/ var __webpack_modules__ = ({
4
5 /***/ "./node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js":
6 /*!**********************************************************************************************!*\
7 !*** ./node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js ***!
8 \**********************************************************************************************/
9 /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
10
11 /**
12 * @license React
13 * use-sync-external-store-shim.development.js
14 *
15 * Copyright (c) Facebook, Inc. and its affiliates.
16 *
17 * This source code is licensed under the MIT license found in the
18 * LICENSE file in the root directory of this source tree.
19 */
20
21
22
23 if (true) {
24 (function() {
25
26 'use strict';
27
28 /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
29 if (
30 typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
31 typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===
32 'function'
33 ) {
34 __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
35 }
36 var React = __webpack_require__(/*! react */ "react");
37
38 var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
39
40 function error(format) {
41 {
42 {
43 for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
44 args[_key2 - 1] = arguments[_key2];
45 }
46
47 printWarning('error', format, args);
48 }
49 }
50 }
51
52 function printWarning(level, format, args) {
53 // When changing this logic, you might want to also
54 // update consoleWithStackDev.www.js as well.
55 {
56 var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
57 var stack = ReactDebugCurrentFrame.getStackAddendum();
58
59 if (stack !== '') {
60 format += '%s';
61 args = args.concat([stack]);
62 } // eslint-disable-next-line react-internal/safe-string-coercion
63
64
65 var argsWithFormat = args.map(function (item) {
66 return String(item);
67 }); // Careful: RN currently depends on this prefix
68
69 argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
70 // breaks IE9: https://github.com/facebook/react/issues/13610
71 // eslint-disable-next-line react-internal/no-production-logging
72
73 Function.prototype.apply.call(console[level], console, argsWithFormat);
74 }
75 }
76
77 /**
78 * inlined Object.is polyfill to avoid requiring consumers ship their own
79 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
80 */
81 function is(x, y) {
82 return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare
83 ;
84 }
85
86 var objectIs = typeof Object.is === 'function' ? Object.is : is;
87
88 // dispatch for CommonJS interop named imports.
89
90 var useState = React.useState,
91 useEffect = React.useEffect,
92 useLayoutEffect = React.useLayoutEffect,
93 useDebugValue = React.useDebugValue;
94 var didWarnOld18Alpha = false;
95 var didWarnUncachedGetSnapshot = false; // Disclaimer: This shim breaks many of the rules of React, and only works
96 // because of a very particular set of implementation details and assumptions
97 // -- change any one of them and it will break. The most important assumption
98 // is that updates are always synchronous, because concurrent rendering is
99 // only available in versions of React that also have a built-in
100 // useSyncExternalStore API. And we only use this shim when the built-in API
101 // does not exist.
102 //
103 // Do not assume that the clever hacks used by this hook also work in general.
104 // The point of this shim is to replace the need for hacks by other libraries.
105
106 function useSyncExternalStore(subscribe, getSnapshot, // Note: The shim does not use getServerSnapshot, because pre-18 versions of
107 // React do not expose a way to check if we're hydrating. So users of the shim
108 // will need to track that themselves and return the correct value
109 // from `getSnapshot`.
110 getServerSnapshot) {
111 {
112 if (!didWarnOld18Alpha) {
113 if (React.startTransition !== undefined) {
114 didWarnOld18Alpha = true;
115
116 error('You are using an outdated, pre-release alpha of React 18 that ' + 'does not support useSyncExternalStore. The ' + 'use-sync-external-store shim will not work correctly. Upgrade ' + 'to a newer pre-release.');
117 }
118 }
119 } // Read the current snapshot from the store on every render. Again, this
120 // breaks the rules of React, and only works here because of specific
121 // implementation details, most importantly that updates are
122 // always synchronous.
123
124
125 var value = getSnapshot();
126
127 {
128 if (!didWarnUncachedGetSnapshot) {
129 var cachedValue = getSnapshot();
130
131 if (!objectIs(value, cachedValue)) {
132 error('The result of getSnapshot should be cached to avoid an infinite loop');
133
134 didWarnUncachedGetSnapshot = true;
135 }
136 }
137 } // Because updates are synchronous, we don't queue them. Instead we force a
138 // re-render whenever the subscribed state changes by updating an some
139 // arbitrary useState hook. Then, during render, we call getSnapshot to read
140 // the current value.
141 //
142 // Because we don't actually use the state returned by the useState hook, we
143 // can save a bit of memory by storing other stuff in that slot.
144 //
145 // To implement the early bailout, we need to track some things on a mutable
146 // object. Usually, we would put that in a useRef hook, but we can stash it in
147 // our useState hook instead.
148 //
149 // To force a re-render, we call forceUpdate({inst}). That works because the
150 // new object always fails an equality check.
151
152
153 var _useState = useState({
154 inst: {
155 value: value,
156 getSnapshot: getSnapshot
157 }
158 }),
159 inst = _useState[0].inst,
160 forceUpdate = _useState[1]; // Track the latest getSnapshot function with a ref. This needs to be updated
161 // in the layout phase so we can access it during the tearing check that
162 // happens on subscribe.
163
164
165 useLayoutEffect(function () {
166 inst.value = value;
167 inst.getSnapshot = getSnapshot; // Whenever getSnapshot or subscribe changes, we need to check in the
168 // commit phase if there was an interleaved mutation. In concurrent mode
169 // this can happen all the time, but even in synchronous mode, an earlier
170 // effect may have mutated the store.
171
172 if (checkIfSnapshotChanged(inst)) {
173 // Force a re-render.
174 forceUpdate({
175 inst: inst
176 });
177 }
178 }, [subscribe, value, getSnapshot]);
179 useEffect(function () {
180 // Check for changes right before subscribing. Subsequent changes will be
181 // detected in the subscription handler.
182 if (checkIfSnapshotChanged(inst)) {
183 // Force a re-render.
184 forceUpdate({
185 inst: inst
186 });
187 }
188
189 var handleStoreChange = function () {
190 // TODO: Because there is no cross-renderer API for batching updates, it's
191 // up to the consumer of this library to wrap their subscription event
192 // with unstable_batchedUpdates. Should we try to detect when this isn't
193 // the case and print a warning in development?
194 // The store changed. Check if the snapshot changed since the last time we
195 // read from the store.
196 if (checkIfSnapshotChanged(inst)) {
197 // Force a re-render.
198 forceUpdate({
199 inst: inst
200 });
201 }
202 }; // Subscribe to the store and return a clean-up function.
203
204
205 return subscribe(handleStoreChange);
206 }, [subscribe]);
207 useDebugValue(value);
208 return value;
209 }
210
211 function checkIfSnapshotChanged(inst) {
212 var latestGetSnapshot = inst.getSnapshot;
213 var prevValue = inst.value;
214
215 try {
216 var nextValue = latestGetSnapshot();
217 return !objectIs(prevValue, nextValue);
218 } catch (error) {
219 return true;
220 }
221 }
222
223 function useSyncExternalStore$1(subscribe, getSnapshot, getServerSnapshot) {
224 // Note: The shim does not use getServerSnapshot, because pre-18 versions of
225 // React do not expose a way to check if we're hydrating. So users of the shim
226 // will need to track that themselves and return the correct value
227 // from `getSnapshot`.
228 return getSnapshot();
229 }
230
231 var canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');
232
233 var isServerEnvironment = !canUseDOM;
234
235 var shim = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore;
236 var useSyncExternalStore$2 = React.useSyncExternalStore !== undefined ? React.useSyncExternalStore : shim;
237
238 exports.useSyncExternalStore = useSyncExternalStore$2;
239 /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
240 if (
241 typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
242 typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===
243 'function'
244 ) {
245 __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
246 }
247
248 })();
249 }
250
251
252 /***/ }),
253
254 /***/ "./node_modules/use-sync-external-store/shim/index.js":
255 /*!************************************************************!*\
256 !*** ./node_modules/use-sync-external-store/shim/index.js ***!
257 \************************************************************/
258 /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
259
260
261
262 if (false) {} else {
263 module.exports = __webpack_require__(/*! ../cjs/use-sync-external-store-shim.development.js */ "./node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js");
264 }
265
266
267 /***/ }),
268
269 /***/ "react":
270 /*!**************************!*\
271 !*** external ["React"] ***!
272 \**************************/
273 /***/ (function(module) {
274
275 module.exports = window["React"];
276
277 /***/ }),
278
279 /***/ "./node_modules/@tanstack/query-core/build/lib/focusManager.mjs":
280 /*!**********************************************************************!*\
281 !*** ./node_modules/@tanstack/query-core/build/lib/focusManager.mjs ***!
282 \**********************************************************************/
283 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
284
285 __webpack_require__.r(__webpack_exports__);
286 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
287 /* harmony export */ FocusManager: function() { return /* binding */ FocusManager; },
288 /* harmony export */ focusManager: function() { return /* binding */ focusManager; }
289 /* harmony export */ });
290 /* harmony import */ var _subscribable_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./subscribable.mjs */ "./node_modules/@tanstack/query-core/build/lib/subscribable.mjs");
291 /* harmony import */ var _utils_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.mjs */ "./node_modules/@tanstack/query-core/build/lib/utils.mjs");
292
293
294
295 class FocusManager extends _subscribable_mjs__WEBPACK_IMPORTED_MODULE_0__.Subscribable {
296 constructor() {
297 super();
298
299 this.setup = onFocus => {
300 // addEventListener does not exist in React Native, but window does
301 // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
302 if (!_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.isServer && window.addEventListener) {
303 const listener = () => onFocus(); // Listen to visibillitychange and focus
304
305
306 window.addEventListener('visibilitychange', listener, false);
307 window.addEventListener('focus', listener, false);
308 return () => {
309 // Be sure to unsubscribe if a new handler is set
310 window.removeEventListener('visibilitychange', listener);
311 window.removeEventListener('focus', listener);
312 };
313 }
314
315 return;
316 };
317 }
318
319 onSubscribe() {
320 if (!this.cleanup) {
321 this.setEventListener(this.setup);
322 }
323 }
324
325 onUnsubscribe() {
326 if (!this.hasListeners()) {
327 var _this$cleanup;
328
329 (_this$cleanup = this.cleanup) == null ? void 0 : _this$cleanup.call(this);
330 this.cleanup = undefined;
331 }
332 }
333
334 setEventListener(setup) {
335 var _this$cleanup2;
336
337 this.setup = setup;
338 (_this$cleanup2 = this.cleanup) == null ? void 0 : _this$cleanup2.call(this);
339 this.cleanup = setup(focused => {
340 if (typeof focused === 'boolean') {
341 this.setFocused(focused);
342 } else {
343 this.onFocus();
344 }
345 });
346 }
347
348 setFocused(focused) {
349 const changed = this.focused !== focused;
350
351 if (changed) {
352 this.focused = focused;
353 this.onFocus();
354 }
355 }
356
357 onFocus() {
358 this.listeners.forEach(({
359 listener
360 }) => {
361 listener();
362 });
363 }
364
365 isFocused() {
366 if (typeof this.focused === 'boolean') {
367 return this.focused;
368 } // document global can be unavailable in react native
369
370
371 if (typeof document === 'undefined') {
372 return true;
373 }
374
375 return [undefined, 'visible', 'prerender'].includes(document.visibilityState);
376 }
377
378 }
379 const focusManager = new FocusManager();
380
381
382 //# sourceMappingURL=focusManager.mjs.map
383
384
385 /***/ }),
386
387 /***/ "./node_modules/@tanstack/query-core/build/lib/infiniteQueryBehavior.mjs":
388 /*!*******************************************************************************!*\
389 !*** ./node_modules/@tanstack/query-core/build/lib/infiniteQueryBehavior.mjs ***!
390 \*******************************************************************************/
391 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
392
393 __webpack_require__.r(__webpack_exports__);
394 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
395 /* harmony export */ getNextPageParam: function() { return /* binding */ getNextPageParam; },
396 /* harmony export */ getPreviousPageParam: function() { return /* binding */ getPreviousPageParam; },
397 /* harmony export */ hasNextPage: function() { return /* binding */ hasNextPage; },
398 /* harmony export */ hasPreviousPage: function() { return /* binding */ hasPreviousPage; },
399 /* harmony export */ infiniteQueryBehavior: function() { return /* binding */ infiniteQueryBehavior; }
400 /* harmony export */ });
401 function infiniteQueryBehavior() {
402 return {
403 onFetch: context => {
404 context.fetchFn = () => {
405 var _context$fetchOptions, _context$fetchOptions2, _context$fetchOptions3, _context$fetchOptions4, _context$state$data, _context$state$data2;
406
407 const refetchPage = (_context$fetchOptions = context.fetchOptions) == null ? void 0 : (_context$fetchOptions2 = _context$fetchOptions.meta) == null ? void 0 : _context$fetchOptions2.refetchPage;
408 const fetchMore = (_context$fetchOptions3 = context.fetchOptions) == null ? void 0 : (_context$fetchOptions4 = _context$fetchOptions3.meta) == null ? void 0 : _context$fetchOptions4.fetchMore;
409 const pageParam = fetchMore == null ? void 0 : fetchMore.pageParam;
410 const isFetchingNextPage = (fetchMore == null ? void 0 : fetchMore.direction) === 'forward';
411 const isFetchingPreviousPage = (fetchMore == null ? void 0 : fetchMore.direction) === 'backward';
412 const oldPages = ((_context$state$data = context.state.data) == null ? void 0 : _context$state$data.pages) || [];
413 const oldPageParams = ((_context$state$data2 = context.state.data) == null ? void 0 : _context$state$data2.pageParams) || [];
414 let newPageParams = oldPageParams;
415 let cancelled = false;
416
417 const addSignalProperty = object => {
418 Object.defineProperty(object, 'signal', {
419 enumerable: true,
420 get: () => {
421 var _context$signal;
422
423 if ((_context$signal = context.signal) != null && _context$signal.aborted) {
424 cancelled = true;
425 } else {
426 var _context$signal2;
427
428 (_context$signal2 = context.signal) == null ? void 0 : _context$signal2.addEventListener('abort', () => {
429 cancelled = true;
430 });
431 }
432
433 return context.signal;
434 }
435 });
436 }; // Get query function
437
438
439 const queryFn = context.options.queryFn || (() => Promise.reject("Missing queryFn for queryKey '" + context.options.queryHash + "'"));
440
441 const buildNewPages = (pages, param, page, previous) => {
442 newPageParams = previous ? [param, ...newPageParams] : [...newPageParams, param];
443 return previous ? [page, ...pages] : [...pages, page];
444 }; // Create function to fetch a page
445
446
447 const fetchPage = (pages, manual, param, previous) => {
448 if (cancelled) {
449 return Promise.reject('Cancelled');
450 }
451
452 if (typeof param === 'undefined' && !manual && pages.length) {
453 return Promise.resolve(pages);
454 }
455
456 const queryFnContext = {
457 queryKey: context.queryKey,
458 pageParam: param,
459 meta: context.options.meta
460 };
461 addSignalProperty(queryFnContext);
462 const queryFnResult = queryFn(queryFnContext);
463 const promise = Promise.resolve(queryFnResult).then(page => buildNewPages(pages, param, page, previous));
464 return promise;
465 };
466
467 let promise; // Fetch first page?
468
469 if (!oldPages.length) {
470 promise = fetchPage([]);
471 } // Fetch next page?
472 else if (isFetchingNextPage) {
473 const manual = typeof pageParam !== 'undefined';
474 const param = manual ? pageParam : getNextPageParam(context.options, oldPages);
475 promise = fetchPage(oldPages, manual, param);
476 } // Fetch previous page?
477 else if (isFetchingPreviousPage) {
478 const manual = typeof pageParam !== 'undefined';
479 const param = manual ? pageParam : getPreviousPageParam(context.options, oldPages);
480 promise = fetchPage(oldPages, manual, param, true);
481 } // Refetch pages
482 else {
483 newPageParams = [];
484 const manual = typeof context.options.getNextPageParam === 'undefined';
485 const shouldFetchFirstPage = refetchPage && oldPages[0] ? refetchPage(oldPages[0], 0, oldPages) : true; // Fetch first page
486
487 promise = shouldFetchFirstPage ? fetchPage([], manual, oldPageParams[0]) : Promise.resolve(buildNewPages([], oldPageParams[0], oldPages[0])); // Fetch remaining pages
488
489 for (let i = 1; i < oldPages.length; i++) {
490 promise = promise.then(pages => {
491 const shouldFetchNextPage = refetchPage && oldPages[i] ? refetchPage(oldPages[i], i, oldPages) : true;
492
493 if (shouldFetchNextPage) {
494 const param = manual ? oldPageParams[i] : getNextPageParam(context.options, pages);
495 return fetchPage(pages, manual, param);
496 }
497
498 return Promise.resolve(buildNewPages(pages, oldPageParams[i], oldPages[i]));
499 });
500 }
501 }
502
503 const finalPromise = promise.then(pages => ({
504 pages,
505 pageParams: newPageParams
506 }));
507 return finalPromise;
508 };
509 }
510 };
511 }
512 function getNextPageParam(options, pages) {
513 return options.getNextPageParam == null ? void 0 : options.getNextPageParam(pages[pages.length - 1], pages);
514 }
515 function getPreviousPageParam(options, pages) {
516 return options.getPreviousPageParam == null ? void 0 : options.getPreviousPageParam(pages[0], pages);
517 }
518 /**
519 * Checks if there is a next page.
520 * Returns `undefined` if it cannot be determined.
521 */
522
523 function hasNextPage(options, pages) {
524 if (options.getNextPageParam && Array.isArray(pages)) {
525 const nextPageParam = getNextPageParam(options, pages);
526 return typeof nextPageParam !== 'undefined' && nextPageParam !== null && nextPageParam !== false;
527 }
528
529 return;
530 }
531 /**
532 * Checks if there is a previous page.
533 * Returns `undefined` if it cannot be determined.
534 */
535
536 function hasPreviousPage(options, pages) {
537 if (options.getPreviousPageParam && Array.isArray(pages)) {
538 const previousPageParam = getPreviousPageParam(options, pages);
539 return typeof previousPageParam !== 'undefined' && previousPageParam !== null && previousPageParam !== false;
540 }
541
542 return;
543 }
544
545
546 //# sourceMappingURL=infiniteQueryBehavior.mjs.map
547
548
549 /***/ }),
550
551 /***/ "./node_modules/@tanstack/query-core/build/lib/logger.mjs":
552 /*!****************************************************************!*\
553 !*** ./node_modules/@tanstack/query-core/build/lib/logger.mjs ***!
554 \****************************************************************/
555 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
556
557 __webpack_require__.r(__webpack_exports__);
558 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
559 /* harmony export */ defaultLogger: function() { return /* binding */ defaultLogger; }
560 /* harmony export */ });
561 const defaultLogger = console;
562
563
564 //# sourceMappingURL=logger.mjs.map
565
566
567 /***/ }),
568
569 /***/ "./node_modules/@tanstack/query-core/build/lib/mutation.mjs":
570 /*!******************************************************************!*\
571 !*** ./node_modules/@tanstack/query-core/build/lib/mutation.mjs ***!
572 \******************************************************************/
573 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
574
575 __webpack_require__.r(__webpack_exports__);
576 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
577 /* harmony export */ Mutation: function() { return /* binding */ Mutation; },
578 /* harmony export */ getDefaultState: function() { return /* binding */ getDefaultState; }
579 /* harmony export */ });
580 /* harmony import */ var _logger_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./logger.mjs */ "./node_modules/@tanstack/query-core/build/lib/logger.mjs");
581 /* harmony import */ var _notifyManager_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./notifyManager.mjs */ "./node_modules/@tanstack/query-core/build/lib/notifyManager.mjs");
582 /* harmony import */ var _removable_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./removable.mjs */ "./node_modules/@tanstack/query-core/build/lib/removable.mjs");
583 /* harmony import */ var _retryer_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./retryer.mjs */ "./node_modules/@tanstack/query-core/build/lib/retryer.mjs");
584
585
586
587
588
589 // CLASS
590 class Mutation extends _removable_mjs__WEBPACK_IMPORTED_MODULE_0__.Removable {
591 constructor(config) {
592 super();
593 this.defaultOptions = config.defaultOptions;
594 this.mutationId = config.mutationId;
595 this.mutationCache = config.mutationCache;
596 this.logger = config.logger || _logger_mjs__WEBPACK_IMPORTED_MODULE_1__.defaultLogger;
597 this.observers = [];
598 this.state = config.state || getDefaultState();
599 this.setOptions(config.options);
600 this.scheduleGc();
601 }
602
603 setOptions(options) {
604 this.options = { ...this.defaultOptions,
605 ...options
606 };
607 this.updateCacheTime(this.options.cacheTime);
608 }
609
610 get meta() {
611 return this.options.meta;
612 }
613
614 setState(state) {
615 this.dispatch({
616 type: 'setState',
617 state
618 });
619 }
620
621 addObserver(observer) {
622 if (!this.observers.includes(observer)) {
623 this.observers.push(observer); // Stop the mutation from being garbage collected
624
625 this.clearGcTimeout();
626 this.mutationCache.notify({
627 type: 'observerAdded',
628 mutation: this,
629 observer
630 });
631 }
632 }
633
634 removeObserver(observer) {
635 this.observers = this.observers.filter(x => x !== observer);
636 this.scheduleGc();
637 this.mutationCache.notify({
638 type: 'observerRemoved',
639 mutation: this,
640 observer
641 });
642 }
643
644 optionalRemove() {
645 if (!this.observers.length) {
646 if (this.state.status === 'loading') {
647 this.scheduleGc();
648 } else {
649 this.mutationCache.remove(this);
650 }
651 }
652 }
653
654 continue() {
655 var _this$retryer$continu, _this$retryer;
656
657 return (_this$retryer$continu = (_this$retryer = this.retryer) == null ? void 0 : _this$retryer.continue()) != null ? _this$retryer$continu : this.execute();
658 }
659
660 async execute() {
661 const executeMutation = () => {
662 var _this$options$retry;
663
664 this.retryer = (0,_retryer_mjs__WEBPACK_IMPORTED_MODULE_2__.createRetryer)({
665 fn: () => {
666 if (!this.options.mutationFn) {
667 return Promise.reject('No mutationFn found');
668 }
669
670 return this.options.mutationFn(this.state.variables);
671 },
672 onFail: (failureCount, error) => {
673 this.dispatch({
674 type: 'failed',
675 failureCount,
676 error
677 });
678 },
679 onPause: () => {
680 this.dispatch({
681 type: 'pause'
682 });
683 },
684 onContinue: () => {
685 this.dispatch({
686 type: 'continue'
687 });
688 },
689 retry: (_this$options$retry = this.options.retry) != null ? _this$options$retry : 0,
690 retryDelay: this.options.retryDelay,
691 networkMode: this.options.networkMode
692 });
693 return this.retryer.promise;
694 };
695
696 const restored = this.state.status === 'loading';
697
698 try {
699 var _this$mutationCache$c3, _this$mutationCache$c4, _this$options$onSucce, _this$options2, _this$mutationCache$c5, _this$mutationCache$c6, _this$options$onSettl, _this$options3;
700
701 if (!restored) {
702 var _this$mutationCache$c, _this$mutationCache$c2, _this$options$onMutat, _this$options;
703
704 this.dispatch({
705 type: 'loading',
706 variables: this.options.variables
707 }); // Notify cache callback
708
709 await ((_this$mutationCache$c = (_this$mutationCache$c2 = this.mutationCache.config).onMutate) == null ? void 0 : _this$mutationCache$c.call(_this$mutationCache$c2, this.state.variables, this));
710 const context = await ((_this$options$onMutat = (_this$options = this.options).onMutate) == null ? void 0 : _this$options$onMutat.call(_this$options, this.state.variables));
711
712 if (context !== this.state.context) {
713 this.dispatch({
714 type: 'loading',
715 context,
716 variables: this.state.variables
717 });
718 }
719 }
720
721 const data = await executeMutation(); // Notify cache callback
722
723 await ((_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));
724 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)); // Notify cache callback
725
726 await ((_this$mutationCache$c5 = (_this$mutationCache$c6 = this.mutationCache.config).onSettled) == null ? void 0 : _this$mutationCache$c5.call(_this$mutationCache$c6, data, null, this.state.variables, this.state.context, this));
727 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));
728 this.dispatch({
729 type: 'success',
730 data
731 });
732 return data;
733 } catch (error) {
734 try {
735 var _this$mutationCache$c7, _this$mutationCache$c8, _this$options$onError, _this$options4, _this$mutationCache$c9, _this$mutationCache$c10, _this$options$onSettl2, _this$options5;
736
737 // Notify cache callback
738 await ((_this$mutationCache$c7 = (_this$mutationCache$c8 = this.mutationCache.config).onError) == null ? void 0 : _this$mutationCache$c7.call(_this$mutationCache$c8, error, this.state.variables, this.state.context, this));
739
740 if (true) {
741 this.logger.error(error);
742 }
743
744 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)); // Notify cache callback
745
746 await ((_this$mutationCache$c9 = (_this$mutationCache$c10 = this.mutationCache.config).onSettled) == null ? void 0 : _this$mutationCache$c9.call(_this$mutationCache$c10, undefined, error, this.state.variables, this.state.context, this));
747 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));
748 throw error;
749 } finally {
750 this.dispatch({
751 type: 'error',
752 error: error
753 });
754 }
755 }
756 }
757
758 dispatch(action) {
759 const reducer = state => {
760 switch (action.type) {
761 case 'failed':
762 return { ...state,
763 failureCount: action.failureCount,
764 failureReason: action.error
765 };
766
767 case 'pause':
768 return { ...state,
769 isPaused: true
770 };
771
772 case 'continue':
773 return { ...state,
774 isPaused: false
775 };
776
777 case 'loading':
778 return { ...state,
779 context: action.context,
780 data: undefined,
781 failureCount: 0,
782 failureReason: null,
783 error: null,
784 isPaused: !(0,_retryer_mjs__WEBPACK_IMPORTED_MODULE_2__.canFetch)(this.options.networkMode),
785 status: 'loading',
786 variables: action.variables
787 };
788
789 case 'success':
790 return { ...state,
791 data: action.data,
792 failureCount: 0,
793 failureReason: null,
794 error: null,
795 status: 'success',
796 isPaused: false
797 };
798
799 case 'error':
800 return { ...state,
801 data: undefined,
802 error: action.error,
803 failureCount: state.failureCount + 1,
804 failureReason: action.error,
805 isPaused: false,
806 status: 'error'
807 };
808
809 case 'setState':
810 return { ...state,
811 ...action.state
812 };
813 }
814 };
815
816 this.state = reducer(this.state);
817 _notifyManager_mjs__WEBPACK_IMPORTED_MODULE_3__.notifyManager.batch(() => {
818 this.observers.forEach(observer => {
819 observer.onMutationUpdate(action);
820 });
821 this.mutationCache.notify({
822 mutation: this,
823 type: 'updated',
824 action
825 });
826 });
827 }
828
829 }
830 function getDefaultState() {
831 return {
832 context: undefined,
833 data: undefined,
834 error: null,
835 failureCount: 0,
836 failureReason: null,
837 isPaused: false,
838 status: 'idle',
839 variables: undefined
840 };
841 }
842
843
844 //# sourceMappingURL=mutation.mjs.map
845
846
847 /***/ }),
848
849 /***/ "./node_modules/@tanstack/query-core/build/lib/mutationCache.mjs":
850 /*!***********************************************************************!*\
851 !*** ./node_modules/@tanstack/query-core/build/lib/mutationCache.mjs ***!
852 \***********************************************************************/
853 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
854
855 __webpack_require__.r(__webpack_exports__);
856 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
857 /* harmony export */ MutationCache: function() { return /* binding */ MutationCache; }
858 /* harmony export */ });
859 /* harmony import */ var _notifyManager_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./notifyManager.mjs */ "./node_modules/@tanstack/query-core/build/lib/notifyManager.mjs");
860 /* harmony import */ var _mutation_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./mutation.mjs */ "./node_modules/@tanstack/query-core/build/lib/mutation.mjs");
861 /* harmony import */ var _utils_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils.mjs */ "./node_modules/@tanstack/query-core/build/lib/utils.mjs");
862 /* harmony import */ var _subscribable_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./subscribable.mjs */ "./node_modules/@tanstack/query-core/build/lib/subscribable.mjs");
863
864
865
866
867
868 // CLASS
869 class MutationCache extends _subscribable_mjs__WEBPACK_IMPORTED_MODULE_0__.Subscribable {
870 constructor(config) {
871 super();
872 this.config = config || {};
873 this.mutations = [];
874 this.mutationId = 0;
875 }
876
877 build(client, options, state) {
878 const mutation = new _mutation_mjs__WEBPACK_IMPORTED_MODULE_1__.Mutation({
879 mutationCache: this,
880 logger: client.getLogger(),
881 mutationId: ++this.mutationId,
882 options: client.defaultMutationOptions(options),
883 state,
884 defaultOptions: options.mutationKey ? client.getMutationDefaults(options.mutationKey) : undefined
885 });
886 this.add(mutation);
887 return mutation;
888 }
889
890 add(mutation) {
891 this.mutations.push(mutation);
892 this.notify({
893 type: 'added',
894 mutation
895 });
896 }
897
898 remove(mutation) {
899 this.mutations = this.mutations.filter(x => x !== mutation);
900 this.notify({
901 type: 'removed',
902 mutation
903 });
904 }
905
906 clear() {
907 _notifyManager_mjs__WEBPACK_IMPORTED_MODULE_2__.notifyManager.batch(() => {
908 this.mutations.forEach(mutation => {
909 this.remove(mutation);
910 });
911 });
912 }
913
914 getAll() {
915 return this.mutations;
916 }
917
918 find(filters) {
919 if (typeof filters.exact === 'undefined') {
920 filters.exact = true;
921 }
922
923 return this.mutations.find(mutation => (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_3__.matchMutation)(filters, mutation));
924 }
925
926 findAll(filters) {
927 return this.mutations.filter(mutation => (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_3__.matchMutation)(filters, mutation));
928 }
929
930 notify(event) {
931 _notifyManager_mjs__WEBPACK_IMPORTED_MODULE_2__.notifyManager.batch(() => {
932 this.listeners.forEach(({
933 listener
934 }) => {
935 listener(event);
936 });
937 });
938 }
939
940 resumePausedMutations() {
941 var _this$resuming;
942
943 this.resuming = ((_this$resuming = this.resuming) != null ? _this$resuming : Promise.resolve()).then(() => {
944 const pausedMutations = this.mutations.filter(x => x.state.isPaused);
945 return _notifyManager_mjs__WEBPACK_IMPORTED_MODULE_2__.notifyManager.batch(() => pausedMutations.reduce((promise, mutation) => promise.then(() => mutation.continue().catch(_utils_mjs__WEBPACK_IMPORTED_MODULE_3__.noop)), Promise.resolve()));
946 }).then(() => {
947 this.resuming = undefined;
948 });
949 return this.resuming;
950 }
951
952 }
953
954
955 //# sourceMappingURL=mutationCache.mjs.map
956
957
958 /***/ }),
959
960 /***/ "./node_modules/@tanstack/query-core/build/lib/mutationObserver.mjs":
961 /*!**************************************************************************!*\
962 !*** ./node_modules/@tanstack/query-core/build/lib/mutationObserver.mjs ***!
963 \**************************************************************************/
964 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
965
966 __webpack_require__.r(__webpack_exports__);
967 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
968 /* harmony export */ MutationObserver: function() { return /* binding */ MutationObserver; }
969 /* harmony export */ });
970 /* harmony import */ var _mutation_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./mutation.mjs */ "./node_modules/@tanstack/query-core/build/lib/mutation.mjs");
971 /* harmony import */ var _notifyManager_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./notifyManager.mjs */ "./node_modules/@tanstack/query-core/build/lib/notifyManager.mjs");
972 /* harmony import */ var _subscribable_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./subscribable.mjs */ "./node_modules/@tanstack/query-core/build/lib/subscribable.mjs");
973 /* harmony import */ var _utils_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.mjs */ "./node_modules/@tanstack/query-core/build/lib/utils.mjs");
974
975
976
977
978
979 // CLASS
980 class MutationObserver extends _subscribable_mjs__WEBPACK_IMPORTED_MODULE_0__.Subscribable {
981 constructor(client, options) {
982 super();
983 this.client = client;
984 this.setOptions(options);
985 this.bindMethods();
986 this.updateResult();
987 }
988
989 bindMethods() {
990 this.mutate = this.mutate.bind(this);
991 this.reset = this.reset.bind(this);
992 }
993
994 setOptions(options) {
995 var _this$currentMutation;
996
997 const prevOptions = this.options;
998 this.options = this.client.defaultMutationOptions(options);
999
1000 if (!(0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.shallowEqualObjects)(prevOptions, this.options)) {
1001 this.client.getMutationCache().notify({
1002 type: 'observerOptionsUpdated',
1003 mutation: this.currentMutation,
1004 observer: this
1005 });
1006 }
1007
1008 (_this$currentMutation = this.currentMutation) == null ? void 0 : _this$currentMutation.setOptions(this.options);
1009 }
1010
1011 onUnsubscribe() {
1012 if (!this.hasListeners()) {
1013 var _this$currentMutation2;
1014
1015 (_this$currentMutation2 = this.currentMutation) == null ? void 0 : _this$currentMutation2.removeObserver(this);
1016 }
1017 }
1018
1019 onMutationUpdate(action) {
1020 this.updateResult(); // Determine which callbacks to trigger
1021
1022 const notifyOptions = {
1023 listeners: true
1024 };
1025
1026 if (action.type === 'success') {
1027 notifyOptions.onSuccess = true;
1028 } else if (action.type === 'error') {
1029 notifyOptions.onError = true;
1030 }
1031
1032 this.notify(notifyOptions);
1033 }
1034
1035 getCurrentResult() {
1036 return this.currentResult;
1037 }
1038
1039 reset() {
1040 this.currentMutation = undefined;
1041 this.updateResult();
1042 this.notify({
1043 listeners: true
1044 });
1045 }
1046
1047 mutate(variables, options) {
1048 this.mutateOptions = options;
1049
1050 if (this.currentMutation) {
1051 this.currentMutation.removeObserver(this);
1052 }
1053
1054 this.currentMutation = this.client.getMutationCache().build(this.client, { ...this.options,
1055 variables: typeof variables !== 'undefined' ? variables : this.options.variables
1056 });
1057 this.currentMutation.addObserver(this);
1058 return this.currentMutation.execute();
1059 }
1060
1061 updateResult() {
1062 const state = this.currentMutation ? this.currentMutation.state : (0,_mutation_mjs__WEBPACK_IMPORTED_MODULE_2__.getDefaultState)();
1063 const result = { ...state,
1064 isLoading: state.status === 'loading',
1065 isSuccess: state.status === 'success',
1066 isError: state.status === 'error',
1067 isIdle: state.status === 'idle',
1068 mutate: this.mutate,
1069 reset: this.reset
1070 };
1071 this.currentResult = result;
1072 }
1073
1074 notify(options) {
1075 _notifyManager_mjs__WEBPACK_IMPORTED_MODULE_3__.notifyManager.batch(() => {
1076 // First trigger the mutate callbacks
1077 if (this.mutateOptions && this.hasListeners()) {
1078 if (options.onSuccess) {
1079 var _this$mutateOptions$o, _this$mutateOptions, _this$mutateOptions$o2, _this$mutateOptions2;
1080
1081 (_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);
1082 (_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);
1083 } else if (options.onError) {
1084 var _this$mutateOptions$o3, _this$mutateOptions3, _this$mutateOptions$o4, _this$mutateOptions4;
1085
1086 (_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);
1087 (_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);
1088 }
1089 } // Then trigger the listeners
1090
1091
1092 if (options.listeners) {
1093 this.listeners.forEach(({
1094 listener
1095 }) => {
1096 listener(this.currentResult);
1097 });
1098 }
1099 });
1100 }
1101
1102 }
1103
1104
1105 //# sourceMappingURL=mutationObserver.mjs.map
1106
1107
1108 /***/ }),
1109
1110 /***/ "./node_modules/@tanstack/query-core/build/lib/notifyManager.mjs":
1111 /*!***********************************************************************!*\
1112 !*** ./node_modules/@tanstack/query-core/build/lib/notifyManager.mjs ***!
1113 \***********************************************************************/
1114 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
1115
1116 __webpack_require__.r(__webpack_exports__);
1117 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1118 /* harmony export */ createNotifyManager: function() { return /* binding */ createNotifyManager; },
1119 /* harmony export */ notifyManager: function() { return /* binding */ notifyManager; }
1120 /* harmony export */ });
1121 /* harmony import */ var _utils_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils.mjs */ "./node_modules/@tanstack/query-core/build/lib/utils.mjs");
1122
1123
1124 function createNotifyManager() {
1125 let queue = [];
1126 let transactions = 0;
1127
1128 let notifyFn = callback => {
1129 callback();
1130 };
1131
1132 let batchNotifyFn = callback => {
1133 callback();
1134 };
1135
1136 const batch = callback => {
1137 let result;
1138 transactions++;
1139
1140 try {
1141 result = callback();
1142 } finally {
1143 transactions--;
1144
1145 if (!transactions) {
1146 flush();
1147 }
1148 }
1149
1150 return result;
1151 };
1152
1153 const schedule = callback => {
1154 if (transactions) {
1155 queue.push(callback);
1156 } else {
1157 (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_0__.scheduleMicrotask)(() => {
1158 notifyFn(callback);
1159 });
1160 }
1161 };
1162 /**
1163 * All calls to the wrapped function will be batched.
1164 */
1165
1166
1167 const batchCalls = callback => {
1168 return (...args) => {
1169 schedule(() => {
1170 callback(...args);
1171 });
1172 };
1173 };
1174
1175 const flush = () => {
1176 const originalQueue = queue;
1177 queue = [];
1178
1179 if (originalQueue.length) {
1180 (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_0__.scheduleMicrotask)(() => {
1181 batchNotifyFn(() => {
1182 originalQueue.forEach(callback => {
1183 notifyFn(callback);
1184 });
1185 });
1186 });
1187 }
1188 };
1189 /**
1190 * Use this method to set a custom notify function.
1191 * This can be used to for example wrap notifications with `React.act` while running tests.
1192 */
1193
1194
1195 const setNotifyFunction = fn => {
1196 notifyFn = fn;
1197 };
1198 /**
1199 * Use this method to set a custom function to batch notifications together into a single tick.
1200 * By default React Query will use the batch function provided by ReactDOM or React Native.
1201 */
1202
1203
1204 const setBatchNotifyFunction = fn => {
1205 batchNotifyFn = fn;
1206 };
1207
1208 return {
1209 batch,
1210 batchCalls,
1211 schedule,
1212 setNotifyFunction,
1213 setBatchNotifyFunction
1214 };
1215 } // SINGLETON
1216
1217 const notifyManager = createNotifyManager();
1218
1219
1220 //# sourceMappingURL=notifyManager.mjs.map
1221
1222
1223 /***/ }),
1224
1225 /***/ "./node_modules/@tanstack/query-core/build/lib/onlineManager.mjs":
1226 /*!***********************************************************************!*\
1227 !*** ./node_modules/@tanstack/query-core/build/lib/onlineManager.mjs ***!
1228 \***********************************************************************/
1229 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
1230
1231 __webpack_require__.r(__webpack_exports__);
1232 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1233 /* harmony export */ OnlineManager: function() { return /* binding */ OnlineManager; },
1234 /* harmony export */ onlineManager: function() { return /* binding */ onlineManager; }
1235 /* harmony export */ });
1236 /* harmony import */ var _subscribable_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./subscribable.mjs */ "./node_modules/@tanstack/query-core/build/lib/subscribable.mjs");
1237 /* harmony import */ var _utils_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.mjs */ "./node_modules/@tanstack/query-core/build/lib/utils.mjs");
1238
1239
1240
1241 const onlineEvents = ['online', 'offline'];
1242 class OnlineManager extends _subscribable_mjs__WEBPACK_IMPORTED_MODULE_0__.Subscribable {
1243 constructor() {
1244 super();
1245
1246 this.setup = onOnline => {
1247 // addEventListener does not exist in React Native, but window does
1248 // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
1249 if (!_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.isServer && window.addEventListener) {
1250 const listener = () => onOnline(); // Listen to online
1251
1252
1253 onlineEvents.forEach(event => {
1254 window.addEventListener(event, listener, false);
1255 });
1256 return () => {
1257 // Be sure to unsubscribe if a new handler is set
1258 onlineEvents.forEach(event => {
1259 window.removeEventListener(event, listener);
1260 });
1261 };
1262 }
1263
1264 return;
1265 };
1266 }
1267
1268 onSubscribe() {
1269 if (!this.cleanup) {
1270 this.setEventListener(this.setup);
1271 }
1272 }
1273
1274 onUnsubscribe() {
1275 if (!this.hasListeners()) {
1276 var _this$cleanup;
1277
1278 (_this$cleanup = this.cleanup) == null ? void 0 : _this$cleanup.call(this);
1279 this.cleanup = undefined;
1280 }
1281 }
1282
1283 setEventListener(setup) {
1284 var _this$cleanup2;
1285
1286 this.setup = setup;
1287 (_this$cleanup2 = this.cleanup) == null ? void 0 : _this$cleanup2.call(this);
1288 this.cleanup = setup(online => {
1289 if (typeof online === 'boolean') {
1290 this.setOnline(online);
1291 } else {
1292 this.onOnline();
1293 }
1294 });
1295 }
1296
1297 setOnline(online) {
1298 const changed = this.online !== online;
1299
1300 if (changed) {
1301 this.online = online;
1302 this.onOnline();
1303 }
1304 }
1305
1306 onOnline() {
1307 this.listeners.forEach(({
1308 listener
1309 }) => {
1310 listener();
1311 });
1312 }
1313
1314 isOnline() {
1315 if (typeof this.online === 'boolean') {
1316 return this.online;
1317 }
1318
1319 if (typeof navigator === 'undefined' || typeof navigator.onLine === 'undefined') {
1320 return true;
1321 }
1322
1323 return navigator.onLine;
1324 }
1325
1326 }
1327 const onlineManager = new OnlineManager();
1328
1329
1330 //# sourceMappingURL=onlineManager.mjs.map
1331
1332
1333 /***/ }),
1334
1335 /***/ "./node_modules/@tanstack/query-core/build/lib/query.mjs":
1336 /*!***************************************************************!*\
1337 !*** ./node_modules/@tanstack/query-core/build/lib/query.mjs ***!
1338 \***************************************************************/
1339 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
1340
1341 __webpack_require__.r(__webpack_exports__);
1342 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1343 /* harmony export */ Query: function() { return /* binding */ Query; }
1344 /* harmony export */ });
1345 /* harmony import */ var _utils_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils.mjs */ "./node_modules/@tanstack/query-core/build/lib/utils.mjs");
1346 /* harmony import */ var _logger_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./logger.mjs */ "./node_modules/@tanstack/query-core/build/lib/logger.mjs");
1347 /* harmony import */ var _notifyManager_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./notifyManager.mjs */ "./node_modules/@tanstack/query-core/build/lib/notifyManager.mjs");
1348 /* harmony import */ var _retryer_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./retryer.mjs */ "./node_modules/@tanstack/query-core/build/lib/retryer.mjs");
1349 /* harmony import */ var _removable_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./removable.mjs */ "./node_modules/@tanstack/query-core/build/lib/removable.mjs");
1350
1351
1352
1353
1354
1355
1356 // CLASS
1357 class Query extends _removable_mjs__WEBPACK_IMPORTED_MODULE_0__.Removable {
1358 constructor(config) {
1359 super();
1360 this.abortSignalConsumed = false;
1361 this.defaultOptions = config.defaultOptions;
1362 this.setOptions(config.options);
1363 this.observers = [];
1364 this.cache = config.cache;
1365 this.logger = config.logger || _logger_mjs__WEBPACK_IMPORTED_MODULE_1__.defaultLogger;
1366 this.queryKey = config.queryKey;
1367 this.queryHash = config.queryHash;
1368 this.initialState = config.state || getDefaultState(this.options);
1369 this.state = this.initialState;
1370 this.scheduleGc();
1371 }
1372
1373 get meta() {
1374 return this.options.meta;
1375 }
1376
1377 setOptions(options) {
1378 this.options = { ...this.defaultOptions,
1379 ...options
1380 };
1381 this.updateCacheTime(this.options.cacheTime);
1382 }
1383
1384 optionalRemove() {
1385 if (!this.observers.length && this.state.fetchStatus === 'idle') {
1386 this.cache.remove(this);
1387 }
1388 }
1389
1390 setData(newData, options) {
1391 const data = (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_2__.replaceData)(this.state.data, newData, this.options); // Set data and mark it as cached
1392
1393 this.dispatch({
1394 data,
1395 type: 'success',
1396 dataUpdatedAt: options == null ? void 0 : options.updatedAt,
1397 manual: options == null ? void 0 : options.manual
1398 });
1399 return data;
1400 }
1401
1402 setState(state, setStateOptions) {
1403 this.dispatch({
1404 type: 'setState',
1405 state,
1406 setStateOptions
1407 });
1408 }
1409
1410 cancel(options) {
1411 var _this$retryer;
1412
1413 const promise = this.promise;
1414 (_this$retryer = this.retryer) == null ? void 0 : _this$retryer.cancel(options);
1415 return promise ? promise.then(_utils_mjs__WEBPACK_IMPORTED_MODULE_2__.noop).catch(_utils_mjs__WEBPACK_IMPORTED_MODULE_2__.noop) : Promise.resolve();
1416 }
1417
1418 destroy() {
1419 super.destroy();
1420 this.cancel({
1421 silent: true
1422 });
1423 }
1424
1425 reset() {
1426 this.destroy();
1427 this.setState(this.initialState);
1428 }
1429
1430 isActive() {
1431 return this.observers.some(observer => observer.options.enabled !== false);
1432 }
1433
1434 isDisabled() {
1435 return this.getObserversCount() > 0 && !this.isActive();
1436 }
1437
1438 isStale() {
1439 return this.state.isInvalidated || !this.state.dataUpdatedAt || this.observers.some(observer => observer.getCurrentResult().isStale);
1440 }
1441
1442 isStaleByTime(staleTime = 0) {
1443 return this.state.isInvalidated || !this.state.dataUpdatedAt || !(0,_utils_mjs__WEBPACK_IMPORTED_MODULE_2__.timeUntilStale)(this.state.dataUpdatedAt, staleTime);
1444 }
1445
1446 onFocus() {
1447 var _this$retryer2;
1448
1449 const observer = this.observers.find(x => x.shouldFetchOnWindowFocus());
1450
1451 if (observer) {
1452 observer.refetch({
1453 cancelRefetch: false
1454 });
1455 } // Continue fetch if currently paused
1456
1457
1458 (_this$retryer2 = this.retryer) == null ? void 0 : _this$retryer2.continue();
1459 }
1460
1461 onOnline() {
1462 var _this$retryer3;
1463
1464 const observer = this.observers.find(x => x.shouldFetchOnReconnect());
1465
1466 if (observer) {
1467 observer.refetch({
1468 cancelRefetch: false
1469 });
1470 } // Continue fetch if currently paused
1471
1472
1473 (_this$retryer3 = this.retryer) == null ? void 0 : _this$retryer3.continue();
1474 }
1475
1476 addObserver(observer) {
1477 if (!this.observers.includes(observer)) {
1478 this.observers.push(observer); // Stop the query from being garbage collected
1479
1480 this.clearGcTimeout();
1481 this.cache.notify({
1482 type: 'observerAdded',
1483 query: this,
1484 observer
1485 });
1486 }
1487 }
1488
1489 removeObserver(observer) {
1490 if (this.observers.includes(observer)) {
1491 this.observers = this.observers.filter(x => x !== observer);
1492
1493 if (!this.observers.length) {
1494 // If the transport layer does not support cancellation
1495 // we'll let the query continue so the result can be cached
1496 if (this.retryer) {
1497 if (this.abortSignalConsumed) {
1498 this.retryer.cancel({
1499 revert: true
1500 });
1501 } else {
1502 this.retryer.cancelRetry();
1503 }
1504 }
1505
1506 this.scheduleGc();
1507 }
1508
1509 this.cache.notify({
1510 type: 'observerRemoved',
1511 query: this,
1512 observer
1513 });
1514 }
1515 }
1516
1517 getObserversCount() {
1518 return this.observers.length;
1519 }
1520
1521 invalidate() {
1522 if (!this.state.isInvalidated) {
1523 this.dispatch({
1524 type: 'invalidate'
1525 });
1526 }
1527 }
1528
1529 fetch(options, fetchOptions) {
1530 var _this$options$behavio, _context$fetchOptions;
1531
1532 if (this.state.fetchStatus !== 'idle') {
1533 if (this.state.dataUpdatedAt && fetchOptions != null && fetchOptions.cancelRefetch) {
1534 // Silently cancel current fetch if the user wants to cancel refetches
1535 this.cancel({
1536 silent: true
1537 });
1538 } else if (this.promise) {
1539 var _this$retryer4;
1540
1541 // make sure that retries that were potentially cancelled due to unmounts can continue
1542 (_this$retryer4 = this.retryer) == null ? void 0 : _this$retryer4.continueRetry(); // Return current promise if we are already fetching
1543
1544 return this.promise;
1545 }
1546 } // Update config if passed, otherwise the config from the last execution is used
1547
1548
1549 if (options) {
1550 this.setOptions(options);
1551 } // Use the options from the first observer with a query function if no function is found.
1552 // This can happen when the query is hydrated or created with setQueryData.
1553
1554
1555 if (!this.options.queryFn) {
1556 const observer = this.observers.find(x => x.options.queryFn);
1557
1558 if (observer) {
1559 this.setOptions(observer.options);
1560 }
1561 }
1562
1563 if (!Array.isArray(this.options.queryKey)) {
1564 if (true) {
1565 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']");
1566 }
1567 }
1568
1569 const abortController = (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_2__.getAbortController)(); // Create query function context
1570
1571 const queryFnContext = {
1572 queryKey: this.queryKey,
1573 pageParam: undefined,
1574 meta: this.meta
1575 }; // Adds an enumerable signal property to the object that
1576 // which sets abortSignalConsumed to true when the signal
1577 // is read.
1578
1579 const addSignalProperty = object => {
1580 Object.defineProperty(object, 'signal', {
1581 enumerable: true,
1582 get: () => {
1583 if (abortController) {
1584 this.abortSignalConsumed = true;
1585 return abortController.signal;
1586 }
1587
1588 return undefined;
1589 }
1590 });
1591 };
1592
1593 addSignalProperty(queryFnContext); // Create fetch function
1594
1595 const fetchFn = () => {
1596 if (!this.options.queryFn) {
1597 return Promise.reject("Missing queryFn for queryKey '" + this.options.queryHash + "'");
1598 }
1599
1600 this.abortSignalConsumed = false;
1601 return this.options.queryFn(queryFnContext);
1602 }; // Trigger behavior hook
1603
1604
1605 const context = {
1606 fetchOptions,
1607 options: this.options,
1608 queryKey: this.queryKey,
1609 state: this.state,
1610 fetchFn
1611 };
1612 addSignalProperty(context);
1613 (_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
1614
1615 this.revertState = this.state; // Set to fetching state if not already in it
1616
1617 if (this.state.fetchStatus === 'idle' || this.state.fetchMeta !== ((_context$fetchOptions = context.fetchOptions) == null ? void 0 : _context$fetchOptions.meta)) {
1618 var _context$fetchOptions2;
1619
1620 this.dispatch({
1621 type: 'fetch',
1622 meta: (_context$fetchOptions2 = context.fetchOptions) == null ? void 0 : _context$fetchOptions2.meta
1623 });
1624 }
1625
1626 const onError = error => {
1627 // Optimistically update state if needed
1628 if (!((0,_retryer_mjs__WEBPACK_IMPORTED_MODULE_3__.isCancelledError)(error) && error.silent)) {
1629 this.dispatch({
1630 type: 'error',
1631 error: error
1632 });
1633 }
1634
1635 if (!(0,_retryer_mjs__WEBPACK_IMPORTED_MODULE_3__.isCancelledError)(error)) {
1636 var _this$cache$config$on, _this$cache$config, _this$cache$config$on2, _this$cache$config2;
1637
1638 // Notify cache callback
1639 (_this$cache$config$on = (_this$cache$config = this.cache.config).onError) == null ? void 0 : _this$cache$config$on.call(_this$cache$config, error, this);
1640 (_this$cache$config$on2 = (_this$cache$config2 = this.cache.config).onSettled) == null ? void 0 : _this$cache$config$on2.call(_this$cache$config2, this.state.data, error, this);
1641
1642 if (true) {
1643 this.logger.error(error);
1644 }
1645 }
1646
1647 if (!this.isFetchingOptimistic) {
1648 // Schedule query gc after fetching
1649 this.scheduleGc();
1650 }
1651
1652 this.isFetchingOptimistic = false;
1653 }; // Try to fetch the data
1654
1655
1656 this.retryer = (0,_retryer_mjs__WEBPACK_IMPORTED_MODULE_3__.createRetryer)({
1657 fn: context.fetchFn,
1658 abort: abortController == null ? void 0 : abortController.abort.bind(abortController),
1659 onSuccess: data => {
1660 var _this$cache$config$on3, _this$cache$config3, _this$cache$config$on4, _this$cache$config4;
1661
1662 if (typeof data === 'undefined') {
1663 if (true) {
1664 this.logger.error("Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: " + this.queryHash);
1665 }
1666
1667 onError(new Error(this.queryHash + " data is undefined"));
1668 return;
1669 }
1670
1671 this.setData(data); // Notify cache callback
1672
1673 (_this$cache$config$on3 = (_this$cache$config3 = this.cache.config).onSuccess) == null ? void 0 : _this$cache$config$on3.call(_this$cache$config3, data, this);
1674 (_this$cache$config$on4 = (_this$cache$config4 = this.cache.config).onSettled) == null ? void 0 : _this$cache$config$on4.call(_this$cache$config4, data, this.state.error, this);
1675
1676 if (!this.isFetchingOptimistic) {
1677 // Schedule query gc after fetching
1678 this.scheduleGc();
1679 }
1680
1681 this.isFetchingOptimistic = false;
1682 },
1683 onError,
1684 onFail: (failureCount, error) => {
1685 this.dispatch({
1686 type: 'failed',
1687 failureCount,
1688 error
1689 });
1690 },
1691 onPause: () => {
1692 this.dispatch({
1693 type: 'pause'
1694 });
1695 },
1696 onContinue: () => {
1697 this.dispatch({
1698 type: 'continue'
1699 });
1700 },
1701 retry: context.options.retry,
1702 retryDelay: context.options.retryDelay,
1703 networkMode: context.options.networkMode
1704 });
1705 this.promise = this.retryer.promise;
1706 return this.promise;
1707 }
1708
1709 dispatch(action) {
1710 const reducer = state => {
1711 var _action$meta, _action$dataUpdatedAt;
1712
1713 switch (action.type) {
1714 case 'failed':
1715 return { ...state,
1716 fetchFailureCount: action.failureCount,
1717 fetchFailureReason: action.error
1718 };
1719
1720 case 'pause':
1721 return { ...state,
1722 fetchStatus: 'paused'
1723 };
1724
1725 case 'continue':
1726 return { ...state,
1727 fetchStatus: 'fetching'
1728 };
1729
1730 case 'fetch':
1731 return { ...state,
1732 fetchFailureCount: 0,
1733 fetchFailureReason: null,
1734 fetchMeta: (_action$meta = action.meta) != null ? _action$meta : null,
1735 fetchStatus: (0,_retryer_mjs__WEBPACK_IMPORTED_MODULE_3__.canFetch)(this.options.networkMode) ? 'fetching' : 'paused',
1736 ...(!state.dataUpdatedAt && {
1737 error: null,
1738 status: 'loading'
1739 })
1740 };
1741
1742 case 'success':
1743 return { ...state,
1744 data: action.data,
1745 dataUpdateCount: state.dataUpdateCount + 1,
1746 dataUpdatedAt: (_action$dataUpdatedAt = action.dataUpdatedAt) != null ? _action$dataUpdatedAt : Date.now(),
1747 error: null,
1748 isInvalidated: false,
1749 status: 'success',
1750 ...(!action.manual && {
1751 fetchStatus: 'idle',
1752 fetchFailureCount: 0,
1753 fetchFailureReason: null
1754 })
1755 };
1756
1757 case 'error':
1758 const error = action.error;
1759
1760 if ((0,_retryer_mjs__WEBPACK_IMPORTED_MODULE_3__.isCancelledError)(error) && error.revert && this.revertState) {
1761 return { ...this.revertState
1762 };
1763 }
1764
1765 return { ...state,
1766 error: error,
1767 errorUpdateCount: state.errorUpdateCount + 1,
1768 errorUpdatedAt: Date.now(),
1769 fetchFailureCount: state.fetchFailureCount + 1,
1770 fetchFailureReason: error,
1771 fetchStatus: 'idle',
1772 status: 'error'
1773 };
1774
1775 case 'invalidate':
1776 return { ...state,
1777 isInvalidated: true
1778 };
1779
1780 case 'setState':
1781 return { ...state,
1782 ...action.state
1783 };
1784 }
1785 };
1786
1787 this.state = reducer(this.state);
1788 _notifyManager_mjs__WEBPACK_IMPORTED_MODULE_4__.notifyManager.batch(() => {
1789 this.observers.forEach(observer => {
1790 observer.onQueryUpdate(action);
1791 });
1792 this.cache.notify({
1793 query: this,
1794 type: 'updated',
1795 action
1796 });
1797 });
1798 }
1799
1800 }
1801
1802 function getDefaultState(options) {
1803 const data = typeof options.initialData === 'function' ? options.initialData() : options.initialData;
1804 const hasData = typeof data !== 'undefined';
1805 const initialDataUpdatedAt = hasData ? typeof options.initialDataUpdatedAt === 'function' ? options.initialDataUpdatedAt() : options.initialDataUpdatedAt : 0;
1806 return {
1807 data,
1808 dataUpdateCount: 0,
1809 dataUpdatedAt: hasData ? initialDataUpdatedAt != null ? initialDataUpdatedAt : Date.now() : 0,
1810 error: null,
1811 errorUpdateCount: 0,
1812 errorUpdatedAt: 0,
1813 fetchFailureCount: 0,
1814 fetchFailureReason: null,
1815 fetchMeta: null,
1816 isInvalidated: false,
1817 status: hasData ? 'success' : 'loading',
1818 fetchStatus: 'idle'
1819 };
1820 }
1821
1822
1823 //# sourceMappingURL=query.mjs.map
1824
1825
1826 /***/ }),
1827
1828 /***/ "./node_modules/@tanstack/query-core/build/lib/queryCache.mjs":
1829 /*!********************************************************************!*\
1830 !*** ./node_modules/@tanstack/query-core/build/lib/queryCache.mjs ***!
1831 \********************************************************************/
1832 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
1833
1834 __webpack_require__.r(__webpack_exports__);
1835 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1836 /* harmony export */ QueryCache: function() { return /* binding */ QueryCache; }
1837 /* harmony export */ });
1838 /* harmony import */ var _utils_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.mjs */ "./node_modules/@tanstack/query-core/build/lib/utils.mjs");
1839 /* harmony import */ var _query_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./query.mjs */ "./node_modules/@tanstack/query-core/build/lib/query.mjs");
1840 /* harmony import */ var _notifyManager_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./notifyManager.mjs */ "./node_modules/@tanstack/query-core/build/lib/notifyManager.mjs");
1841 /* harmony import */ var _subscribable_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./subscribable.mjs */ "./node_modules/@tanstack/query-core/build/lib/subscribable.mjs");
1842
1843
1844
1845
1846
1847 // CLASS
1848 class QueryCache extends _subscribable_mjs__WEBPACK_IMPORTED_MODULE_0__.Subscribable {
1849 constructor(config) {
1850 super();
1851 this.config = config || {};
1852 this.queries = [];
1853 this.queriesMap = {};
1854 }
1855
1856 build(client, options, state) {
1857 var _options$queryHash;
1858
1859 const queryKey = options.queryKey;
1860 const queryHash = (_options$queryHash = options.queryHash) != null ? _options$queryHash : (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.hashQueryKeyByOptions)(queryKey, options);
1861 let query = this.get(queryHash);
1862
1863 if (!query) {
1864 query = new _query_mjs__WEBPACK_IMPORTED_MODULE_2__.Query({
1865 cache: this,
1866 logger: client.getLogger(),
1867 queryKey,
1868 queryHash,
1869 options: client.defaultQueryOptions(options),
1870 state,
1871 defaultOptions: client.getQueryDefaults(queryKey)
1872 });
1873 this.add(query);
1874 }
1875
1876 return query;
1877 }
1878
1879 add(query) {
1880 if (!this.queriesMap[query.queryHash]) {
1881 this.queriesMap[query.queryHash] = query;
1882 this.queries.push(query);
1883 this.notify({
1884 type: 'added',
1885 query
1886 });
1887 }
1888 }
1889
1890 remove(query) {
1891 const queryInMap = this.queriesMap[query.queryHash];
1892
1893 if (queryInMap) {
1894 query.destroy();
1895 this.queries = this.queries.filter(x => x !== query);
1896
1897 if (queryInMap === query) {
1898 delete this.queriesMap[query.queryHash];
1899 }
1900
1901 this.notify({
1902 type: 'removed',
1903 query
1904 });
1905 }
1906 }
1907
1908 clear() {
1909 _notifyManager_mjs__WEBPACK_IMPORTED_MODULE_3__.notifyManager.batch(() => {
1910 this.queries.forEach(query => {
1911 this.remove(query);
1912 });
1913 });
1914 }
1915
1916 get(queryHash) {
1917 return this.queriesMap[queryHash];
1918 }
1919
1920 getAll() {
1921 return this.queries;
1922 }
1923
1924 find(arg1, arg2) {
1925 const [filters] = (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.parseFilterArgs)(arg1, arg2);
1926
1927 if (typeof filters.exact === 'undefined') {
1928 filters.exact = true;
1929 }
1930
1931 return this.queries.find(query => (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.matchQuery)(filters, query));
1932 }
1933
1934 findAll(arg1, arg2) {
1935 const [filters] = (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.parseFilterArgs)(arg1, arg2);
1936 return Object.keys(filters).length > 0 ? this.queries.filter(query => (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.matchQuery)(filters, query)) : this.queries;
1937 }
1938
1939 notify(event) {
1940 _notifyManager_mjs__WEBPACK_IMPORTED_MODULE_3__.notifyManager.batch(() => {
1941 this.listeners.forEach(({
1942 listener
1943 }) => {
1944 listener(event);
1945 });
1946 });
1947 }
1948
1949 onFocus() {
1950 _notifyManager_mjs__WEBPACK_IMPORTED_MODULE_3__.notifyManager.batch(() => {
1951 this.queries.forEach(query => {
1952 query.onFocus();
1953 });
1954 });
1955 }
1956
1957 onOnline() {
1958 _notifyManager_mjs__WEBPACK_IMPORTED_MODULE_3__.notifyManager.batch(() => {
1959 this.queries.forEach(query => {
1960 query.onOnline();
1961 });
1962 });
1963 }
1964
1965 }
1966
1967
1968 //# sourceMappingURL=queryCache.mjs.map
1969
1970
1971 /***/ }),
1972
1973 /***/ "./node_modules/@tanstack/query-core/build/lib/queryClient.mjs":
1974 /*!*********************************************************************!*\
1975 !*** ./node_modules/@tanstack/query-core/build/lib/queryClient.mjs ***!
1976 \*********************************************************************/
1977 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
1978
1979 __webpack_require__.r(__webpack_exports__);
1980 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1981 /* harmony export */ QueryClient: function() { return /* binding */ QueryClient; }
1982 /* harmony export */ });
1983 /* harmony import */ var _utils_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./utils.mjs */ "./node_modules/@tanstack/query-core/build/lib/utils.mjs");
1984 /* harmony import */ var _queryCache_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./queryCache.mjs */ "./node_modules/@tanstack/query-core/build/lib/queryCache.mjs");
1985 /* harmony import */ var _mutationCache_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./mutationCache.mjs */ "./node_modules/@tanstack/query-core/build/lib/mutationCache.mjs");
1986 /* harmony import */ var _focusManager_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./focusManager.mjs */ "./node_modules/@tanstack/query-core/build/lib/focusManager.mjs");
1987 /* harmony import */ var _onlineManager_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./onlineManager.mjs */ "./node_modules/@tanstack/query-core/build/lib/onlineManager.mjs");
1988 /* harmony import */ var _notifyManager_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./notifyManager.mjs */ "./node_modules/@tanstack/query-core/build/lib/notifyManager.mjs");
1989 /* harmony import */ var _infiniteQueryBehavior_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./infiniteQueryBehavior.mjs */ "./node_modules/@tanstack/query-core/build/lib/infiniteQueryBehavior.mjs");
1990 /* harmony import */ var _logger_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./logger.mjs */ "./node_modules/@tanstack/query-core/build/lib/logger.mjs");
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000 // CLASS
2001 class QueryClient {
2002 constructor(config = {}) {
2003 this.queryCache = config.queryCache || new _queryCache_mjs__WEBPACK_IMPORTED_MODULE_0__.QueryCache();
2004 this.mutationCache = config.mutationCache || new _mutationCache_mjs__WEBPACK_IMPORTED_MODULE_1__.MutationCache();
2005 this.logger = config.logger || _logger_mjs__WEBPACK_IMPORTED_MODULE_2__.defaultLogger;
2006 this.defaultOptions = config.defaultOptions || {};
2007 this.queryDefaults = [];
2008 this.mutationDefaults = [];
2009 this.mountCount = 0;
2010
2011 if ( true && config.logger) {
2012 this.logger.error("Passing a custom logger has been deprecated and will be removed in the next major version.");
2013 }
2014 }
2015
2016 mount() {
2017 this.mountCount++;
2018 if (this.mountCount !== 1) return;
2019 this.unsubscribeFocus = _focusManager_mjs__WEBPACK_IMPORTED_MODULE_3__.focusManager.subscribe(() => {
2020 if (_focusManager_mjs__WEBPACK_IMPORTED_MODULE_3__.focusManager.isFocused()) {
2021 this.resumePausedMutations();
2022 this.queryCache.onFocus();
2023 }
2024 });
2025 this.unsubscribeOnline = _onlineManager_mjs__WEBPACK_IMPORTED_MODULE_4__.onlineManager.subscribe(() => {
2026 if (_onlineManager_mjs__WEBPACK_IMPORTED_MODULE_4__.onlineManager.isOnline()) {
2027 this.resumePausedMutations();
2028 this.queryCache.onOnline();
2029 }
2030 });
2031 }
2032
2033 unmount() {
2034 var _this$unsubscribeFocu, _this$unsubscribeOnli;
2035
2036 this.mountCount--;
2037 if (this.mountCount !== 0) return;
2038 (_this$unsubscribeFocu = this.unsubscribeFocus) == null ? void 0 : _this$unsubscribeFocu.call(this);
2039 this.unsubscribeFocus = undefined;
2040 (_this$unsubscribeOnli = this.unsubscribeOnline) == null ? void 0 : _this$unsubscribeOnli.call(this);
2041 this.unsubscribeOnline = undefined;
2042 }
2043
2044 isFetching(arg1, arg2) {
2045 const [filters] = (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_5__.parseFilterArgs)(arg1, arg2);
2046 filters.fetchStatus = 'fetching';
2047 return this.queryCache.findAll(filters).length;
2048 }
2049
2050 isMutating(filters) {
2051 return this.mutationCache.findAll({ ...filters,
2052 fetching: true
2053 }).length;
2054 }
2055
2056 getQueryData(queryKey, filters) {
2057 var _this$queryCache$find;
2058
2059 return (_this$queryCache$find = this.queryCache.find(queryKey, filters)) == null ? void 0 : _this$queryCache$find.state.data;
2060 }
2061
2062 ensureQueryData(arg1, arg2, arg3) {
2063 const parsedOptions = (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_5__.parseQueryArgs)(arg1, arg2, arg3);
2064 const cachedData = this.getQueryData(parsedOptions.queryKey);
2065 return cachedData ? Promise.resolve(cachedData) : this.fetchQuery(parsedOptions);
2066 }
2067
2068 getQueriesData(queryKeyOrFilters) {
2069 return this.getQueryCache().findAll(queryKeyOrFilters).map(({
2070 queryKey,
2071 state
2072 }) => {
2073 const data = state.data;
2074 return [queryKey, data];
2075 });
2076 }
2077
2078 setQueryData(queryKey, updater, options) {
2079 const query = this.queryCache.find(queryKey);
2080 const prevData = query == null ? void 0 : query.state.data;
2081 const data = (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_5__.functionalUpdate)(updater, prevData);
2082
2083 if (typeof data === 'undefined') {
2084 return undefined;
2085 }
2086
2087 const parsedOptions = (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_5__.parseQueryArgs)(queryKey);
2088 const defaultedOptions = this.defaultQueryOptions(parsedOptions);
2089 return this.queryCache.build(this, defaultedOptions).setData(data, { ...options,
2090 manual: true
2091 });
2092 }
2093
2094 setQueriesData(queryKeyOrFilters, updater, options) {
2095 return _notifyManager_mjs__WEBPACK_IMPORTED_MODULE_6__.notifyManager.batch(() => this.getQueryCache().findAll(queryKeyOrFilters).map(({
2096 queryKey
2097 }) => [queryKey, this.setQueryData(queryKey, updater, options)]));
2098 }
2099
2100 getQueryState(queryKey, filters) {
2101 var _this$queryCache$find2;
2102
2103 return (_this$queryCache$find2 = this.queryCache.find(queryKey, filters)) == null ? void 0 : _this$queryCache$find2.state;
2104 }
2105
2106 removeQueries(arg1, arg2) {
2107 const [filters] = (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_5__.parseFilterArgs)(arg1, arg2);
2108 const queryCache = this.queryCache;
2109 _notifyManager_mjs__WEBPACK_IMPORTED_MODULE_6__.notifyManager.batch(() => {
2110 queryCache.findAll(filters).forEach(query => {
2111 queryCache.remove(query);
2112 });
2113 });
2114 }
2115
2116 resetQueries(arg1, arg2, arg3) {
2117 const [filters, options] = (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_5__.parseFilterArgs)(arg1, arg2, arg3);
2118 const queryCache = this.queryCache;
2119 const refetchFilters = {
2120 type: 'active',
2121 ...filters
2122 };
2123 return _notifyManager_mjs__WEBPACK_IMPORTED_MODULE_6__.notifyManager.batch(() => {
2124 queryCache.findAll(filters).forEach(query => {
2125 query.reset();
2126 });
2127 return this.refetchQueries(refetchFilters, options);
2128 });
2129 }
2130
2131 cancelQueries(arg1, arg2, arg3) {
2132 const [filters, cancelOptions = {}] = (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_5__.parseFilterArgs)(arg1, arg2, arg3);
2133
2134 if (typeof cancelOptions.revert === 'undefined') {
2135 cancelOptions.revert = true;
2136 }
2137
2138 const promises = _notifyManager_mjs__WEBPACK_IMPORTED_MODULE_6__.notifyManager.batch(() => this.queryCache.findAll(filters).map(query => query.cancel(cancelOptions)));
2139 return Promise.all(promises).then(_utils_mjs__WEBPACK_IMPORTED_MODULE_5__.noop).catch(_utils_mjs__WEBPACK_IMPORTED_MODULE_5__.noop);
2140 }
2141
2142 invalidateQueries(arg1, arg2, arg3) {
2143 const [filters, options] = (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_5__.parseFilterArgs)(arg1, arg2, arg3);
2144 return _notifyManager_mjs__WEBPACK_IMPORTED_MODULE_6__.notifyManager.batch(() => {
2145 var _ref, _filters$refetchType;
2146
2147 this.queryCache.findAll(filters).forEach(query => {
2148 query.invalidate();
2149 });
2150
2151 if (filters.refetchType === 'none') {
2152 return Promise.resolve();
2153 }
2154
2155 const refetchFilters = { ...filters,
2156 type: (_ref = (_filters$refetchType = filters.refetchType) != null ? _filters$refetchType : filters.type) != null ? _ref : 'active'
2157 };
2158 return this.refetchQueries(refetchFilters, options);
2159 });
2160 }
2161
2162 refetchQueries(arg1, arg2, arg3) {
2163 const [filters, options] = (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_5__.parseFilterArgs)(arg1, arg2, arg3);
2164 const promises = _notifyManager_mjs__WEBPACK_IMPORTED_MODULE_6__.notifyManager.batch(() => this.queryCache.findAll(filters).filter(query => !query.isDisabled()).map(query => {
2165 var _options$cancelRefetc;
2166
2167 return query.fetch(undefined, { ...options,
2168 cancelRefetch: (_options$cancelRefetc = options == null ? void 0 : options.cancelRefetch) != null ? _options$cancelRefetc : true,
2169 meta: {
2170 refetchPage: filters.refetchPage
2171 }
2172 });
2173 }));
2174 let promise = Promise.all(promises).then(_utils_mjs__WEBPACK_IMPORTED_MODULE_5__.noop);
2175
2176 if (!(options != null && options.throwOnError)) {
2177 promise = promise.catch(_utils_mjs__WEBPACK_IMPORTED_MODULE_5__.noop);
2178 }
2179
2180 return promise;
2181 }
2182
2183 fetchQuery(arg1, arg2, arg3) {
2184 const parsedOptions = (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_5__.parseQueryArgs)(arg1, arg2, arg3);
2185 const defaultedOptions = this.defaultQueryOptions(parsedOptions); // https://github.com/tannerlinsley/react-query/issues/652
2186
2187 if (typeof defaultedOptions.retry === 'undefined') {
2188 defaultedOptions.retry = false;
2189 }
2190
2191 const query = this.queryCache.build(this, defaultedOptions);
2192 return query.isStaleByTime(defaultedOptions.staleTime) ? query.fetch(defaultedOptions) : Promise.resolve(query.state.data);
2193 }
2194
2195 prefetchQuery(arg1, arg2, arg3) {
2196 return this.fetchQuery(arg1, arg2, arg3).then(_utils_mjs__WEBPACK_IMPORTED_MODULE_5__.noop).catch(_utils_mjs__WEBPACK_IMPORTED_MODULE_5__.noop);
2197 }
2198
2199 fetchInfiniteQuery(arg1, arg2, arg3) {
2200 const parsedOptions = (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_5__.parseQueryArgs)(arg1, arg2, arg3);
2201 parsedOptions.behavior = (0,_infiniteQueryBehavior_mjs__WEBPACK_IMPORTED_MODULE_7__.infiniteQueryBehavior)();
2202 return this.fetchQuery(parsedOptions);
2203 }
2204
2205 prefetchInfiniteQuery(arg1, arg2, arg3) {
2206 return this.fetchInfiniteQuery(arg1, arg2, arg3).then(_utils_mjs__WEBPACK_IMPORTED_MODULE_5__.noop).catch(_utils_mjs__WEBPACK_IMPORTED_MODULE_5__.noop);
2207 }
2208
2209 resumePausedMutations() {
2210 return this.mutationCache.resumePausedMutations();
2211 }
2212
2213 getQueryCache() {
2214 return this.queryCache;
2215 }
2216
2217 getMutationCache() {
2218 return this.mutationCache;
2219 }
2220
2221 getLogger() {
2222 return this.logger;
2223 }
2224
2225 getDefaultOptions() {
2226 return this.defaultOptions;
2227 }
2228
2229 setDefaultOptions(options) {
2230 this.defaultOptions = options;
2231 }
2232
2233 setQueryDefaults(queryKey, options) {
2234 const result = this.queryDefaults.find(x => (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_5__.hashQueryKey)(queryKey) === (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_5__.hashQueryKey)(x.queryKey));
2235
2236 if (result) {
2237 result.defaultOptions = options;
2238 } else {
2239 this.queryDefaults.push({
2240 queryKey,
2241 defaultOptions: options
2242 });
2243 }
2244 }
2245
2246 getQueryDefaults(queryKey) {
2247 if (!queryKey) {
2248 return undefined;
2249 } // Get the first matching defaults
2250
2251
2252 const firstMatchingDefaults = this.queryDefaults.find(x => (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_5__.partialMatchKey)(queryKey, x.queryKey)); // Additional checks and error in dev mode
2253
2254 if (true) {
2255 // Retrieve all matching defaults for the given key
2256 const matchingDefaults = this.queryDefaults.filter(x => (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_5__.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
2257
2258 if (matchingDefaults.length > 1) {
2259 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.");
2260 }
2261 }
2262
2263 return firstMatchingDefaults == null ? void 0 : firstMatchingDefaults.defaultOptions;
2264 }
2265
2266 setMutationDefaults(mutationKey, options) {
2267 const result = this.mutationDefaults.find(x => (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_5__.hashQueryKey)(mutationKey) === (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_5__.hashQueryKey)(x.mutationKey));
2268
2269 if (result) {
2270 result.defaultOptions = options;
2271 } else {
2272 this.mutationDefaults.push({
2273 mutationKey,
2274 defaultOptions: options
2275 });
2276 }
2277 }
2278
2279 getMutationDefaults(mutationKey) {
2280 if (!mutationKey) {
2281 return undefined;
2282 } // Get the first matching defaults
2283
2284
2285 const firstMatchingDefaults = this.mutationDefaults.find(x => (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_5__.partialMatchKey)(mutationKey, x.mutationKey)); // Additional checks and error in dev mode
2286
2287 if (true) {
2288 // Retrieve all matching defaults for the given key
2289 const matchingDefaults = this.mutationDefaults.filter(x => (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_5__.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
2290
2291 if (matchingDefaults.length > 1) {
2292 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.");
2293 }
2294 }
2295
2296 return firstMatchingDefaults == null ? void 0 : firstMatchingDefaults.defaultOptions;
2297 }
2298
2299 defaultQueryOptions(options) {
2300 if (options != null && options._defaulted) {
2301 return options;
2302 }
2303
2304 const defaultedOptions = { ...this.defaultOptions.queries,
2305 ...this.getQueryDefaults(options == null ? void 0 : options.queryKey),
2306 ...options,
2307 _defaulted: true
2308 };
2309
2310 if (!defaultedOptions.queryHash && defaultedOptions.queryKey) {
2311 defaultedOptions.queryHash = (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_5__.hashQueryKeyByOptions)(defaultedOptions.queryKey, defaultedOptions);
2312 } // dependent default values
2313
2314
2315 if (typeof defaultedOptions.refetchOnReconnect === 'undefined') {
2316 defaultedOptions.refetchOnReconnect = defaultedOptions.networkMode !== 'always';
2317 }
2318
2319 if (typeof defaultedOptions.useErrorBoundary === 'undefined') {
2320 defaultedOptions.useErrorBoundary = !!defaultedOptions.suspense;
2321 }
2322
2323 return defaultedOptions;
2324 }
2325
2326 defaultMutationOptions(options) {
2327 if (options != null && options._defaulted) {
2328 return options;
2329 }
2330
2331 return { ...this.defaultOptions.mutations,
2332 ...this.getMutationDefaults(options == null ? void 0 : options.mutationKey),
2333 ...options,
2334 _defaulted: true
2335 };
2336 }
2337
2338 clear() {
2339 this.queryCache.clear();
2340 this.mutationCache.clear();
2341 }
2342
2343 }
2344
2345
2346 //# sourceMappingURL=queryClient.mjs.map
2347
2348
2349 /***/ }),
2350
2351 /***/ "./node_modules/@tanstack/query-core/build/lib/queryObserver.mjs":
2352 /*!***********************************************************************!*\
2353 !*** ./node_modules/@tanstack/query-core/build/lib/queryObserver.mjs ***!
2354 \***********************************************************************/
2355 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
2356
2357 __webpack_require__.r(__webpack_exports__);
2358 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2359 /* harmony export */ QueryObserver: function() { return /* binding */ QueryObserver; }
2360 /* harmony export */ });
2361 /* harmony import */ var _utils_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.mjs */ "./node_modules/@tanstack/query-core/build/lib/utils.mjs");
2362 /* harmony import */ var _notifyManager_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./notifyManager.mjs */ "./node_modules/@tanstack/query-core/build/lib/notifyManager.mjs");
2363 /* harmony import */ var _focusManager_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./focusManager.mjs */ "./node_modules/@tanstack/query-core/build/lib/focusManager.mjs");
2364 /* harmony import */ var _subscribable_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./subscribable.mjs */ "./node_modules/@tanstack/query-core/build/lib/subscribable.mjs");
2365 /* harmony import */ var _retryer_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./retryer.mjs */ "./node_modules/@tanstack/query-core/build/lib/retryer.mjs");
2366
2367
2368
2369
2370
2371
2372 class QueryObserver extends _subscribable_mjs__WEBPACK_IMPORTED_MODULE_0__.Subscribable {
2373 constructor(client, options) {
2374 super();
2375 this.client = client;
2376 this.options = options;
2377 this.trackedProps = new Set();
2378 this.selectError = null;
2379 this.bindMethods();
2380 this.setOptions(options);
2381 }
2382
2383 bindMethods() {
2384 this.remove = this.remove.bind(this);
2385 this.refetch = this.refetch.bind(this);
2386 }
2387
2388 onSubscribe() {
2389 if (this.listeners.size === 1) {
2390 this.currentQuery.addObserver(this);
2391
2392 if (shouldFetchOnMount(this.currentQuery, this.options)) {
2393 this.executeFetch();
2394 }
2395
2396 this.updateTimers();
2397 }
2398 }
2399
2400 onUnsubscribe() {
2401 if (!this.hasListeners()) {
2402 this.destroy();
2403 }
2404 }
2405
2406 shouldFetchOnReconnect() {
2407 return shouldFetchOn(this.currentQuery, this.options, this.options.refetchOnReconnect);
2408 }
2409
2410 shouldFetchOnWindowFocus() {
2411 return shouldFetchOn(this.currentQuery, this.options, this.options.refetchOnWindowFocus);
2412 }
2413
2414 destroy() {
2415 this.listeners = new Set();
2416 this.clearStaleTimeout();
2417 this.clearRefetchInterval();
2418 this.currentQuery.removeObserver(this);
2419 }
2420
2421 setOptions(options, notifyOptions) {
2422 const prevOptions = this.options;
2423 const prevQuery = this.currentQuery;
2424 this.options = this.client.defaultQueryOptions(options);
2425
2426 if ( true && typeof (options == null ? void 0 : options.isDataEqual) !== 'undefined') {
2427 this.client.getLogger().error("The isDataEqual option has been deprecated and will be removed in the next major version. You can achieve the same functionality by passing a function as the structuralSharing option");
2428 }
2429
2430 if (!(0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.shallowEqualObjects)(prevOptions, this.options)) {
2431 this.client.getQueryCache().notify({
2432 type: 'observerOptionsUpdated',
2433 query: this.currentQuery,
2434 observer: this
2435 });
2436 }
2437
2438 if (typeof this.options.enabled !== 'undefined' && typeof this.options.enabled !== 'boolean') {
2439 throw new Error('Expected enabled to be a boolean');
2440 } // Keep previous query key if the user does not supply one
2441
2442
2443 if (!this.options.queryKey) {
2444 this.options.queryKey = prevOptions.queryKey;
2445 }
2446
2447 this.updateQuery();
2448 const mounted = this.hasListeners(); // Fetch if there are subscribers
2449
2450 if (mounted && shouldFetchOptionally(this.currentQuery, prevQuery, this.options, prevOptions)) {
2451 this.executeFetch();
2452 } // Update result
2453
2454
2455 this.updateResult(notifyOptions); // Update stale interval if needed
2456
2457 if (mounted && (this.currentQuery !== prevQuery || this.options.enabled !== prevOptions.enabled || this.options.staleTime !== prevOptions.staleTime)) {
2458 this.updateStaleTimeout();
2459 }
2460
2461 const nextRefetchInterval = this.computeRefetchInterval(); // Update refetch interval if needed
2462
2463 if (mounted && (this.currentQuery !== prevQuery || this.options.enabled !== prevOptions.enabled || nextRefetchInterval !== this.currentRefetchInterval)) {
2464 this.updateRefetchInterval(nextRefetchInterval);
2465 }
2466 }
2467
2468 getOptimisticResult(options) {
2469 const query = this.client.getQueryCache().build(this.client, options);
2470 const result = this.createResult(query, options);
2471
2472 if (shouldAssignObserverCurrentProperties(this, result, options)) {
2473 // this assigns the optimistic result to the current Observer
2474 // because if the query function changes, useQuery will be performing
2475 // an effect where it would fetch again.
2476 // When the fetch finishes, we perform a deep data cloning in order
2477 // to reuse objects references. This deep data clone is performed against
2478 // the `observer.currentResult.data` property
2479 // When QueryKey changes, we refresh the query and get new `optimistic`
2480 // result, while we leave the `observer.currentResult`, so when new data
2481 // arrives, it finds the old `observer.currentResult` which is related
2482 // to the old QueryKey. Which means that currentResult and selectData are
2483 // out of sync already.
2484 // To solve this, we move the cursor of the currentResult everytime
2485 // an observer reads an optimistic value.
2486 // When keeping the previous data, the result doesn't change until new
2487 // data arrives.
2488 this.currentResult = result;
2489 this.currentResultOptions = this.options;
2490 this.currentResultState = this.currentQuery.state;
2491 }
2492
2493 return result;
2494 }
2495
2496 getCurrentResult() {
2497 return this.currentResult;
2498 }
2499
2500 trackResult(result) {
2501 const trackedResult = {};
2502 Object.keys(result).forEach(key => {
2503 Object.defineProperty(trackedResult, key, {
2504 configurable: false,
2505 enumerable: true,
2506 get: () => {
2507 this.trackedProps.add(key);
2508 return result[key];
2509 }
2510 });
2511 });
2512 return trackedResult;
2513 }
2514
2515 getCurrentQuery() {
2516 return this.currentQuery;
2517 }
2518
2519 remove() {
2520 this.client.getQueryCache().remove(this.currentQuery);
2521 }
2522
2523 refetch({
2524 refetchPage,
2525 ...options
2526 } = {}) {
2527 return this.fetch({ ...options,
2528 meta: {
2529 refetchPage
2530 }
2531 });
2532 }
2533
2534 fetchOptimistic(options) {
2535 const defaultedOptions = this.client.defaultQueryOptions(options);
2536 const query = this.client.getQueryCache().build(this.client, defaultedOptions);
2537 query.isFetchingOptimistic = true;
2538 return query.fetch().then(() => this.createResult(query, defaultedOptions));
2539 }
2540
2541 fetch(fetchOptions) {
2542 var _fetchOptions$cancelR;
2543
2544 return this.executeFetch({ ...fetchOptions,
2545 cancelRefetch: (_fetchOptions$cancelR = fetchOptions.cancelRefetch) != null ? _fetchOptions$cancelR : true
2546 }).then(() => {
2547 this.updateResult();
2548 return this.currentResult;
2549 });
2550 }
2551
2552 executeFetch(fetchOptions) {
2553 // Make sure we reference the latest query as the current one might have been removed
2554 this.updateQuery(); // Fetch
2555
2556 let promise = this.currentQuery.fetch(this.options, fetchOptions);
2557
2558 if (!(fetchOptions != null && fetchOptions.throwOnError)) {
2559 promise = promise.catch(_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.noop);
2560 }
2561
2562 return promise;
2563 }
2564
2565 updateStaleTimeout() {
2566 this.clearStaleTimeout();
2567
2568 if (_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.isServer || this.currentResult.isStale || !(0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.isValidTimeout)(this.options.staleTime)) {
2569 return;
2570 }
2571
2572 const time = (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.timeUntilStale)(this.currentResult.dataUpdatedAt, this.options.staleTime); // The timeout is sometimes triggered 1 ms before the stale time expiration.
2573 // To mitigate this issue we always add 1 ms to the timeout.
2574
2575 const timeout = time + 1;
2576 this.staleTimeoutId = setTimeout(() => {
2577 if (!this.currentResult.isStale) {
2578 this.updateResult();
2579 }
2580 }, timeout);
2581 }
2582
2583 computeRefetchInterval() {
2584 var _this$options$refetch;
2585
2586 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;
2587 }
2588
2589 updateRefetchInterval(nextInterval) {
2590 this.clearRefetchInterval();
2591 this.currentRefetchInterval = nextInterval;
2592
2593 if (_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.isServer || this.options.enabled === false || !(0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.isValidTimeout)(this.currentRefetchInterval) || this.currentRefetchInterval === 0) {
2594 return;
2595 }
2596
2597 this.refetchIntervalId = setInterval(() => {
2598 if (this.options.refetchIntervalInBackground || _focusManager_mjs__WEBPACK_IMPORTED_MODULE_2__.focusManager.isFocused()) {
2599 this.executeFetch();
2600 }
2601 }, this.currentRefetchInterval);
2602 }
2603
2604 updateTimers() {
2605 this.updateStaleTimeout();
2606 this.updateRefetchInterval(this.computeRefetchInterval());
2607 }
2608
2609 clearStaleTimeout() {
2610 if (this.staleTimeoutId) {
2611 clearTimeout(this.staleTimeoutId);
2612 this.staleTimeoutId = undefined;
2613 }
2614 }
2615
2616 clearRefetchInterval() {
2617 if (this.refetchIntervalId) {
2618 clearInterval(this.refetchIntervalId);
2619 this.refetchIntervalId = undefined;
2620 }
2621 }
2622
2623 createResult(query, options) {
2624 const prevQuery = this.currentQuery;
2625 const prevOptions = this.options;
2626 const prevResult = this.currentResult;
2627 const prevResultState = this.currentResultState;
2628 const prevResultOptions = this.currentResultOptions;
2629 const queryChange = query !== prevQuery;
2630 const queryInitialState = queryChange ? query.state : this.currentQueryInitialState;
2631 const prevQueryResult = queryChange ? this.currentResult : this.previousQueryResult;
2632 const {
2633 state
2634 } = query;
2635 let {
2636 dataUpdatedAt,
2637 error,
2638 errorUpdatedAt,
2639 fetchStatus,
2640 status
2641 } = state;
2642 let isPreviousData = false;
2643 let isPlaceholderData = false;
2644 let data; // Optimistically set result in fetching state if needed
2645
2646 if (options._optimisticResults) {
2647 const mounted = this.hasListeners();
2648 const fetchOnMount = !mounted && shouldFetchOnMount(query, options);
2649 const fetchOptionally = mounted && shouldFetchOptionally(query, prevQuery, options, prevOptions);
2650
2651 if (fetchOnMount || fetchOptionally) {
2652 fetchStatus = (0,_retryer_mjs__WEBPACK_IMPORTED_MODULE_3__.canFetch)(query.options.networkMode) ? 'fetching' : 'paused';
2653
2654 if (!dataUpdatedAt) {
2655 status = 'loading';
2656 }
2657 }
2658
2659 if (options._optimisticResults === 'isRestoring') {
2660 fetchStatus = 'idle';
2661 }
2662 } // Keep previous data if needed
2663
2664
2665 if (options.keepPreviousData && !state.dataUpdatedAt && prevQueryResult != null && prevQueryResult.isSuccess && status !== 'error') {
2666 data = prevQueryResult.data;
2667 dataUpdatedAt = prevQueryResult.dataUpdatedAt;
2668 status = prevQueryResult.status;
2669 isPreviousData = true;
2670 } // Select data if needed
2671 else if (options.select && typeof state.data !== 'undefined') {
2672 // Memoize select result
2673 if (prevResult && state.data === (prevResultState == null ? void 0 : prevResultState.data) && options.select === this.selectFn) {
2674 data = this.selectResult;
2675 } else {
2676 try {
2677 this.selectFn = options.select;
2678 data = options.select(state.data);
2679 data = (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.replaceData)(prevResult == null ? void 0 : prevResult.data, data, options);
2680 this.selectResult = data;
2681 this.selectError = null;
2682 } catch (selectError) {
2683 if (true) {
2684 this.client.getLogger().error(selectError);
2685 }
2686
2687 this.selectError = selectError;
2688 }
2689 }
2690 } // Use query data
2691 else {
2692 data = state.data;
2693 } // Show placeholder data if needed
2694
2695
2696 if (typeof options.placeholderData !== 'undefined' && typeof data === 'undefined' && status === 'loading') {
2697 let placeholderData; // Memoize placeholder data
2698
2699 if (prevResult != null && prevResult.isPlaceholderData && options.placeholderData === (prevResultOptions == null ? void 0 : prevResultOptions.placeholderData)) {
2700 placeholderData = prevResult.data;
2701 } else {
2702 placeholderData = typeof options.placeholderData === 'function' ? options.placeholderData() : options.placeholderData;
2703
2704 if (options.select && typeof placeholderData !== 'undefined') {
2705 try {
2706 placeholderData = options.select(placeholderData);
2707 this.selectError = null;
2708 } catch (selectError) {
2709 if (true) {
2710 this.client.getLogger().error(selectError);
2711 }
2712
2713 this.selectError = selectError;
2714 }
2715 }
2716 }
2717
2718 if (typeof placeholderData !== 'undefined') {
2719 status = 'success';
2720 data = (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.replaceData)(prevResult == null ? void 0 : prevResult.data, placeholderData, options);
2721 isPlaceholderData = true;
2722 }
2723 }
2724
2725 if (this.selectError) {
2726 error = this.selectError;
2727 data = this.selectResult;
2728 errorUpdatedAt = Date.now();
2729 status = 'error';
2730 }
2731
2732 const isFetching = fetchStatus === 'fetching';
2733 const isLoading = status === 'loading';
2734 const isError = status === 'error';
2735 const result = {
2736 status,
2737 fetchStatus,
2738 isLoading,
2739 isSuccess: status === 'success',
2740 isError,
2741 isInitialLoading: isLoading && isFetching,
2742 data,
2743 dataUpdatedAt,
2744 error,
2745 errorUpdatedAt,
2746 failureCount: state.fetchFailureCount,
2747 failureReason: state.fetchFailureReason,
2748 errorUpdateCount: state.errorUpdateCount,
2749 isFetched: state.dataUpdateCount > 0 || state.errorUpdateCount > 0,
2750 isFetchedAfterMount: state.dataUpdateCount > queryInitialState.dataUpdateCount || state.errorUpdateCount > queryInitialState.errorUpdateCount,
2751 isFetching,
2752 isRefetching: isFetching && !isLoading,
2753 isLoadingError: isError && state.dataUpdatedAt === 0,
2754 isPaused: fetchStatus === 'paused',
2755 isPlaceholderData,
2756 isPreviousData,
2757 isRefetchError: isError && state.dataUpdatedAt !== 0,
2758 isStale: isStale(query, options),
2759 refetch: this.refetch,
2760 remove: this.remove
2761 };
2762 return result;
2763 }
2764
2765 updateResult(notifyOptions) {
2766 const prevResult = this.currentResult;
2767 const nextResult = this.createResult(this.currentQuery, this.options);
2768 this.currentResultState = this.currentQuery.state;
2769 this.currentResultOptions = this.options; // Only notify and update result if something has changed
2770
2771 if ((0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.shallowEqualObjects)(nextResult, prevResult)) {
2772 return;
2773 }
2774
2775 this.currentResult = nextResult; // Determine which callbacks to trigger
2776
2777 const defaultNotifyOptions = {
2778 cache: true
2779 };
2780
2781 const shouldNotifyListeners = () => {
2782 if (!prevResult) {
2783 return true;
2784 }
2785
2786 const {
2787 notifyOnChangeProps
2788 } = this.options;
2789 const notifyOnChangePropsValue = typeof notifyOnChangeProps === 'function' ? notifyOnChangeProps() : notifyOnChangeProps;
2790
2791 if (notifyOnChangePropsValue === 'all' || !notifyOnChangePropsValue && !this.trackedProps.size) {
2792 return true;
2793 }
2794
2795 const includedProps = new Set(notifyOnChangePropsValue != null ? notifyOnChangePropsValue : this.trackedProps);
2796
2797 if (this.options.useErrorBoundary) {
2798 includedProps.add('error');
2799 }
2800
2801 return Object.keys(this.currentResult).some(key => {
2802 const typedKey = key;
2803 const changed = this.currentResult[typedKey] !== prevResult[typedKey];
2804 return changed && includedProps.has(typedKey);
2805 });
2806 };
2807
2808 if ((notifyOptions == null ? void 0 : notifyOptions.listeners) !== false && shouldNotifyListeners()) {
2809 defaultNotifyOptions.listeners = true;
2810 }
2811
2812 this.notify({ ...defaultNotifyOptions,
2813 ...notifyOptions
2814 });
2815 }
2816
2817 updateQuery() {
2818 const query = this.client.getQueryCache().build(this.client, this.options);
2819
2820 if (query === this.currentQuery) {
2821 return;
2822 }
2823
2824 const prevQuery = this.currentQuery;
2825 this.currentQuery = query;
2826 this.currentQueryInitialState = query.state;
2827 this.previousQueryResult = this.currentResult;
2828
2829 if (this.hasListeners()) {
2830 prevQuery == null ? void 0 : prevQuery.removeObserver(this);
2831 query.addObserver(this);
2832 }
2833 }
2834
2835 onQueryUpdate(action) {
2836 const notifyOptions = {};
2837
2838 if (action.type === 'success') {
2839 notifyOptions.onSuccess = !action.manual;
2840 } else if (action.type === 'error' && !(0,_retryer_mjs__WEBPACK_IMPORTED_MODULE_3__.isCancelledError)(action.error)) {
2841 notifyOptions.onError = true;
2842 }
2843
2844 this.updateResult(notifyOptions);
2845
2846 if (this.hasListeners()) {
2847 this.updateTimers();
2848 }
2849 }
2850
2851 notify(notifyOptions) {
2852 _notifyManager_mjs__WEBPACK_IMPORTED_MODULE_4__.notifyManager.batch(() => {
2853 // First trigger the configuration callbacks
2854 if (notifyOptions.onSuccess) {
2855 var _this$options$onSucce, _this$options, _this$options$onSettl, _this$options2;
2856
2857 (_this$options$onSucce = (_this$options = this.options).onSuccess) == null ? void 0 : _this$options$onSucce.call(_this$options, this.currentResult.data);
2858 (_this$options$onSettl = (_this$options2 = this.options).onSettled) == null ? void 0 : _this$options$onSettl.call(_this$options2, this.currentResult.data, null);
2859 } else if (notifyOptions.onError) {
2860 var _this$options$onError, _this$options3, _this$options$onSettl2, _this$options4;
2861
2862 (_this$options$onError = (_this$options3 = this.options).onError) == null ? void 0 : _this$options$onError.call(_this$options3, this.currentResult.error);
2863 (_this$options$onSettl2 = (_this$options4 = this.options).onSettled) == null ? void 0 : _this$options$onSettl2.call(_this$options4, undefined, this.currentResult.error);
2864 } // Then trigger the listeners
2865
2866
2867 if (notifyOptions.listeners) {
2868 this.listeners.forEach(({
2869 listener
2870 }) => {
2871 listener(this.currentResult);
2872 });
2873 } // Then the cache listeners
2874
2875
2876 if (notifyOptions.cache) {
2877 this.client.getQueryCache().notify({
2878 query: this.currentQuery,
2879 type: 'observerResultsUpdated'
2880 });
2881 }
2882 });
2883 }
2884
2885 }
2886
2887 function shouldLoadOnMount(query, options) {
2888 return options.enabled !== false && !query.state.dataUpdatedAt && !(query.state.status === 'error' && options.retryOnMount === false);
2889 }
2890
2891 function shouldFetchOnMount(query, options) {
2892 return shouldLoadOnMount(query, options) || query.state.dataUpdatedAt > 0 && shouldFetchOn(query, options, options.refetchOnMount);
2893 }
2894
2895 function shouldFetchOn(query, options, field) {
2896 if (options.enabled !== false) {
2897 const value = typeof field === 'function' ? field(query) : field;
2898 return value === 'always' || value !== false && isStale(query, options);
2899 }
2900
2901 return false;
2902 }
2903
2904 function shouldFetchOptionally(query, prevQuery, options, prevOptions) {
2905 return options.enabled !== false && (query !== prevQuery || prevOptions.enabled === false) && (!options.suspense || query.state.status !== 'error') && isStale(query, options);
2906 }
2907
2908 function isStale(query, options) {
2909 return query.isStaleByTime(options.staleTime);
2910 } // this function would decide if we will update the observer's 'current'
2911 // properties after an optimistic reading via getOptimisticResult
2912
2913
2914 function shouldAssignObserverCurrentProperties(observer, optimisticResult, options) {
2915 // it is important to keep this condition like this for three reasons:
2916 // 1. It will get removed in the v5
2917 // 2. it reads: don't update the properties if we want to keep the previous
2918 // data.
2919 // 3. The opposite condition (!options.keepPreviousData) would fallthrough
2920 // and will result in a bad decision
2921 if (options.keepPreviousData) {
2922 return false;
2923 } // this means we want to put some placeholder data when pending and queryKey
2924 // changed.
2925
2926
2927 if (options.placeholderData !== undefined) {
2928 // re-assign properties only if current data is placeholder data
2929 // which means that data did not arrive yet, so, if there is some cached data
2930 // we need to "prepare" to receive it
2931 return optimisticResult.isPlaceholderData;
2932 } // if the newly created result isn't what the observer is holding as current,
2933 // then we'll need to update the properties as well
2934
2935
2936 if (observer.getCurrentResult() !== optimisticResult) {
2937 return true;
2938 } // basically, just keep previous properties if nothing changed
2939
2940
2941 return false;
2942 }
2943
2944
2945 //# sourceMappingURL=queryObserver.mjs.map
2946
2947
2948 /***/ }),
2949
2950 /***/ "./node_modules/@tanstack/query-core/build/lib/removable.mjs":
2951 /*!*******************************************************************!*\
2952 !*** ./node_modules/@tanstack/query-core/build/lib/removable.mjs ***!
2953 \*******************************************************************/
2954 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
2955
2956 __webpack_require__.r(__webpack_exports__);
2957 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2958 /* harmony export */ Removable: function() { return /* binding */ Removable; }
2959 /* harmony export */ });
2960 /* harmony import */ var _utils_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils.mjs */ "./node_modules/@tanstack/query-core/build/lib/utils.mjs");
2961
2962
2963 class Removable {
2964 destroy() {
2965 this.clearGcTimeout();
2966 }
2967
2968 scheduleGc() {
2969 this.clearGcTimeout();
2970
2971 if ((0,_utils_mjs__WEBPACK_IMPORTED_MODULE_0__.isValidTimeout)(this.cacheTime)) {
2972 this.gcTimeout = setTimeout(() => {
2973 this.optionalRemove();
2974 }, this.cacheTime);
2975 }
2976 }
2977
2978 updateCacheTime(newCacheTime) {
2979 // Default to 5 minutes (Infinity for server-side) if no cache time is set
2980 this.cacheTime = Math.max(this.cacheTime || 0, newCacheTime != null ? newCacheTime : _utils_mjs__WEBPACK_IMPORTED_MODULE_0__.isServer ? Infinity : 5 * 60 * 1000);
2981 }
2982
2983 clearGcTimeout() {
2984 if (this.gcTimeout) {
2985 clearTimeout(this.gcTimeout);
2986 this.gcTimeout = undefined;
2987 }
2988 }
2989
2990 }
2991
2992
2993 //# sourceMappingURL=removable.mjs.map
2994
2995
2996 /***/ }),
2997
2998 /***/ "./node_modules/@tanstack/query-core/build/lib/retryer.mjs":
2999 /*!*****************************************************************!*\
3000 !*** ./node_modules/@tanstack/query-core/build/lib/retryer.mjs ***!
3001 \*****************************************************************/
3002 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
3003
3004 __webpack_require__.r(__webpack_exports__);
3005 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3006 /* harmony export */ CancelledError: function() { return /* binding */ CancelledError; },
3007 /* harmony export */ canFetch: function() { return /* binding */ canFetch; },
3008 /* harmony export */ createRetryer: function() { return /* binding */ createRetryer; },
3009 /* harmony export */ isCancelledError: function() { return /* binding */ isCancelledError; }
3010 /* harmony export */ });
3011 /* harmony import */ var _focusManager_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./focusManager.mjs */ "./node_modules/@tanstack/query-core/build/lib/focusManager.mjs");
3012 /* harmony import */ var _onlineManager_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./onlineManager.mjs */ "./node_modules/@tanstack/query-core/build/lib/onlineManager.mjs");
3013 /* harmony import */ var _utils_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils.mjs */ "./node_modules/@tanstack/query-core/build/lib/utils.mjs");
3014
3015
3016
3017
3018 function defaultRetryDelay(failureCount) {
3019 return Math.min(1000 * 2 ** failureCount, 30000);
3020 }
3021
3022 function canFetch(networkMode) {
3023 return (networkMode != null ? networkMode : 'online') === 'online' ? _onlineManager_mjs__WEBPACK_IMPORTED_MODULE_0__.onlineManager.isOnline() : true;
3024 }
3025 class CancelledError {
3026 constructor(options) {
3027 this.revert = options == null ? void 0 : options.revert;
3028 this.silent = options == null ? void 0 : options.silent;
3029 }
3030
3031 }
3032 function isCancelledError(value) {
3033 return value instanceof CancelledError;
3034 }
3035 function createRetryer(config) {
3036 let isRetryCancelled = false;
3037 let failureCount = 0;
3038 let isResolved = false;
3039 let continueFn;
3040 let promiseResolve;
3041 let promiseReject;
3042 const promise = new Promise((outerResolve, outerReject) => {
3043 promiseResolve = outerResolve;
3044 promiseReject = outerReject;
3045 });
3046
3047 const cancel = cancelOptions => {
3048 if (!isResolved) {
3049 reject(new CancelledError(cancelOptions));
3050 config.abort == null ? void 0 : config.abort();
3051 }
3052 };
3053
3054 const cancelRetry = () => {
3055 isRetryCancelled = true;
3056 };
3057
3058 const continueRetry = () => {
3059 isRetryCancelled = false;
3060 };
3061
3062 const shouldPause = () => !_focusManager_mjs__WEBPACK_IMPORTED_MODULE_1__.focusManager.isFocused() || config.networkMode !== 'always' && !_onlineManager_mjs__WEBPACK_IMPORTED_MODULE_0__.onlineManager.isOnline();
3063
3064 const resolve = value => {
3065 if (!isResolved) {
3066 isResolved = true;
3067 config.onSuccess == null ? void 0 : config.onSuccess(value);
3068 continueFn == null ? void 0 : continueFn();
3069 promiseResolve(value);
3070 }
3071 };
3072
3073 const reject = value => {
3074 if (!isResolved) {
3075 isResolved = true;
3076 config.onError == null ? void 0 : config.onError(value);
3077 continueFn == null ? void 0 : continueFn();
3078 promiseReject(value);
3079 }
3080 };
3081
3082 const pause = () => {
3083 return new Promise(continueResolve => {
3084 continueFn = value => {
3085 const canContinue = isResolved || !shouldPause();
3086
3087 if (canContinue) {
3088 continueResolve(value);
3089 }
3090
3091 return canContinue;
3092 };
3093
3094 config.onPause == null ? void 0 : config.onPause();
3095 }).then(() => {
3096 continueFn = undefined;
3097
3098 if (!isResolved) {
3099 config.onContinue == null ? void 0 : config.onContinue();
3100 }
3101 });
3102 }; // Create loop function
3103
3104
3105 const run = () => {
3106 // Do nothing if already resolved
3107 if (isResolved) {
3108 return;
3109 }
3110
3111 let promiseOrValue; // Execute query
3112
3113 try {
3114 promiseOrValue = config.fn();
3115 } catch (error) {
3116 promiseOrValue = Promise.reject(error);
3117 }
3118
3119 Promise.resolve(promiseOrValue).then(resolve).catch(error => {
3120 var _config$retry, _config$retryDelay;
3121
3122 // Stop if the fetch is already resolved
3123 if (isResolved) {
3124 return;
3125 } // Do we need to retry the request?
3126
3127
3128 const retry = (_config$retry = config.retry) != null ? _config$retry : 3;
3129 const retryDelay = (_config$retryDelay = config.retryDelay) != null ? _config$retryDelay : defaultRetryDelay;
3130 const delay = typeof retryDelay === 'function' ? retryDelay(failureCount, error) : retryDelay;
3131 const shouldRetry = retry === true || typeof retry === 'number' && failureCount < retry || typeof retry === 'function' && retry(failureCount, error);
3132
3133 if (isRetryCancelled || !shouldRetry) {
3134 // We are done if the query does not need to be retried
3135 reject(error);
3136 return;
3137 }
3138
3139 failureCount++; // Notify on fail
3140
3141 config.onFail == null ? void 0 : config.onFail(failureCount, error); // Delay
3142
3143 (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_2__.sleep)(delay) // Pause if the document is not visible or when the device is offline
3144 .then(() => {
3145 if (shouldPause()) {
3146 return pause();
3147 }
3148
3149 return;
3150 }).then(() => {
3151 if (isRetryCancelled) {
3152 reject(error);
3153 } else {
3154 run();
3155 }
3156 });
3157 });
3158 }; // Start loop
3159
3160
3161 if (canFetch(config.networkMode)) {
3162 run();
3163 } else {
3164 pause().then(run);
3165 }
3166
3167 return {
3168 promise,
3169 cancel,
3170 continue: () => {
3171 const didContinue = continueFn == null ? void 0 : continueFn();
3172 return didContinue ? promise : Promise.resolve();
3173 },
3174 cancelRetry,
3175 continueRetry
3176 };
3177 }
3178
3179
3180 //# sourceMappingURL=retryer.mjs.map
3181
3182
3183 /***/ }),
3184
3185 /***/ "./node_modules/@tanstack/query-core/build/lib/subscribable.mjs":
3186 /*!**********************************************************************!*\
3187 !*** ./node_modules/@tanstack/query-core/build/lib/subscribable.mjs ***!
3188 \**********************************************************************/
3189 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
3190
3191 __webpack_require__.r(__webpack_exports__);
3192 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3193 /* harmony export */ Subscribable: function() { return /* binding */ Subscribable; }
3194 /* harmony export */ });
3195 class Subscribable {
3196 constructor() {
3197 this.listeners = new Set();
3198 this.subscribe = this.subscribe.bind(this);
3199 }
3200
3201 subscribe(listener) {
3202 const identity = {
3203 listener
3204 };
3205 this.listeners.add(identity);
3206 this.onSubscribe();
3207 return () => {
3208 this.listeners.delete(identity);
3209 this.onUnsubscribe();
3210 };
3211 }
3212
3213 hasListeners() {
3214 return this.listeners.size > 0;
3215 }
3216
3217 onSubscribe() {// Do nothing
3218 }
3219
3220 onUnsubscribe() {// Do nothing
3221 }
3222
3223 }
3224
3225
3226 //# sourceMappingURL=subscribable.mjs.map
3227
3228
3229 /***/ }),
3230
3231 /***/ "./node_modules/@tanstack/query-core/build/lib/utils.mjs":
3232 /*!***************************************************************!*\
3233 !*** ./node_modules/@tanstack/query-core/build/lib/utils.mjs ***!
3234 \***************************************************************/
3235 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
3236
3237 __webpack_require__.r(__webpack_exports__);
3238 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3239 /* harmony export */ difference: function() { return /* binding */ difference; },
3240 /* harmony export */ functionalUpdate: function() { return /* binding */ functionalUpdate; },
3241 /* harmony export */ getAbortController: function() { return /* binding */ getAbortController; },
3242 /* harmony export */ hashQueryKey: function() { return /* binding */ hashQueryKey; },
3243 /* harmony export */ hashQueryKeyByOptions: function() { return /* binding */ hashQueryKeyByOptions; },
3244 /* harmony export */ isError: function() { return /* binding */ isError; },
3245 /* harmony export */ isPlainArray: function() { return /* binding */ isPlainArray; },
3246 /* harmony export */ isPlainObject: function() { return /* binding */ isPlainObject; },
3247 /* harmony export */ isQueryKey: function() { return /* binding */ isQueryKey; },
3248 /* harmony export */ isServer: function() { return /* binding */ isServer; },
3249 /* harmony export */ isValidTimeout: function() { return /* binding */ isValidTimeout; },
3250 /* harmony export */ matchMutation: function() { return /* binding */ matchMutation; },
3251 /* harmony export */ matchQuery: function() { return /* binding */ matchQuery; },
3252 /* harmony export */ noop: function() { return /* binding */ noop; },
3253 /* harmony export */ parseFilterArgs: function() { return /* binding */ parseFilterArgs; },
3254 /* harmony export */ parseMutationArgs: function() { return /* binding */ parseMutationArgs; },
3255 /* harmony export */ parseMutationFilterArgs: function() { return /* binding */ parseMutationFilterArgs; },
3256 /* harmony export */ parseQueryArgs: function() { return /* binding */ parseQueryArgs; },
3257 /* harmony export */ partialDeepEqual: function() { return /* binding */ partialDeepEqual; },
3258 /* harmony export */ partialMatchKey: function() { return /* binding */ partialMatchKey; },
3259 /* harmony export */ replaceAt: function() { return /* binding */ replaceAt; },
3260 /* harmony export */ replaceData: function() { return /* binding */ replaceData; },
3261 /* harmony export */ replaceEqualDeep: function() { return /* binding */ replaceEqualDeep; },
3262 /* harmony export */ scheduleMicrotask: function() { return /* binding */ scheduleMicrotask; },
3263 /* harmony export */ shallowEqualObjects: function() { return /* binding */ shallowEqualObjects; },
3264 /* harmony export */ sleep: function() { return /* binding */ sleep; },
3265 /* harmony export */ timeUntilStale: function() { return /* binding */ timeUntilStale; }
3266 /* harmony export */ });
3267 // TYPES
3268 // UTILS
3269 const isServer = typeof window === 'undefined' || 'Deno' in window;
3270 function noop() {
3271 return undefined;
3272 }
3273 function functionalUpdate(updater, input) {
3274 return typeof updater === 'function' ? updater(input) : updater;
3275 }
3276 function isValidTimeout(value) {
3277 return typeof value === 'number' && value >= 0 && value !== Infinity;
3278 }
3279 function difference(array1, array2) {
3280 return array1.filter(x => !array2.includes(x));
3281 }
3282 function replaceAt(array, index, value) {
3283 const copy = array.slice(0);
3284 copy[index] = value;
3285 return copy;
3286 }
3287 function timeUntilStale(updatedAt, staleTime) {
3288 return Math.max(updatedAt + (staleTime || 0) - Date.now(), 0);
3289 }
3290 function parseQueryArgs(arg1, arg2, arg3) {
3291 if (!isQueryKey(arg1)) {
3292 return arg1;
3293 }
3294
3295 if (typeof arg2 === 'function') {
3296 return { ...arg3,
3297 queryKey: arg1,
3298 queryFn: arg2
3299 };
3300 }
3301
3302 return { ...arg2,
3303 queryKey: arg1
3304 };
3305 }
3306 function parseMutationArgs(arg1, arg2, arg3) {
3307 if (isQueryKey(arg1)) {
3308 if (typeof arg2 === 'function') {
3309 return { ...arg3,
3310 mutationKey: arg1,
3311 mutationFn: arg2
3312 };
3313 }
3314
3315 return { ...arg2,
3316 mutationKey: arg1
3317 };
3318 }
3319
3320 if (typeof arg1 === 'function') {
3321 return { ...arg2,
3322 mutationFn: arg1
3323 };
3324 }
3325
3326 return { ...arg1
3327 };
3328 }
3329 function parseFilterArgs(arg1, arg2, arg3) {
3330 return isQueryKey(arg1) ? [{ ...arg2,
3331 queryKey: arg1
3332 }, arg3] : [arg1 || {}, arg2];
3333 }
3334 function parseMutationFilterArgs(arg1, arg2, arg3) {
3335 return isQueryKey(arg1) ? [{ ...arg2,
3336 mutationKey: arg1
3337 }, arg3] : [arg1 || {}, arg2];
3338 }
3339 function matchQuery(filters, query) {
3340 const {
3341 type = 'all',
3342 exact,
3343 fetchStatus,
3344 predicate,
3345 queryKey,
3346 stale
3347 } = filters;
3348
3349 if (isQueryKey(queryKey)) {
3350 if (exact) {
3351 if (query.queryHash !== hashQueryKeyByOptions(queryKey, query.options)) {
3352 return false;
3353 }
3354 } else if (!partialMatchKey(query.queryKey, queryKey)) {
3355 return false;
3356 }
3357 }
3358
3359 if (type !== 'all') {
3360 const isActive = query.isActive();
3361
3362 if (type === 'active' && !isActive) {
3363 return false;
3364 }
3365
3366 if (type === 'inactive' && isActive) {
3367 return false;
3368 }
3369 }
3370
3371 if (typeof stale === 'boolean' && query.isStale() !== stale) {
3372 return false;
3373 }
3374
3375 if (typeof fetchStatus !== 'undefined' && fetchStatus !== query.state.fetchStatus) {
3376 return false;
3377 }
3378
3379 if (predicate && !predicate(query)) {
3380 return false;
3381 }
3382
3383 return true;
3384 }
3385 function matchMutation(filters, mutation) {
3386 const {
3387 exact,
3388 fetching,
3389 predicate,
3390 mutationKey
3391 } = filters;
3392
3393 if (isQueryKey(mutationKey)) {
3394 if (!mutation.options.mutationKey) {
3395 return false;
3396 }
3397
3398 if (exact) {
3399 if (hashQueryKey(mutation.options.mutationKey) !== hashQueryKey(mutationKey)) {
3400 return false;
3401 }
3402 } else if (!partialMatchKey(mutation.options.mutationKey, mutationKey)) {
3403 return false;
3404 }
3405 }
3406
3407 if (typeof fetching === 'boolean' && mutation.state.status === 'loading' !== fetching) {
3408 return false;
3409 }
3410
3411 if (predicate && !predicate(mutation)) {
3412 return false;
3413 }
3414
3415 return true;
3416 }
3417 function hashQueryKeyByOptions(queryKey, options) {
3418 const hashFn = (options == null ? void 0 : options.queryKeyHashFn) || hashQueryKey;
3419 return hashFn(queryKey);
3420 }
3421 /**
3422 * Default query keys hash function.
3423 * Hashes the value into a stable hash.
3424 */
3425
3426 function hashQueryKey(queryKey) {
3427 return JSON.stringify(queryKey, (_, val) => isPlainObject(val) ? Object.keys(val).sort().reduce((result, key) => {
3428 result[key] = val[key];
3429 return result;
3430 }, {}) : val);
3431 }
3432 /**
3433 * Checks if key `b` partially matches with key `a`.
3434 */
3435
3436 function partialMatchKey(a, b) {
3437 return partialDeepEqual(a, b);
3438 }
3439 /**
3440 * Checks if `b` partially matches with `a`.
3441 */
3442
3443 function partialDeepEqual(a, b) {
3444 if (a === b) {
3445 return true;
3446 }
3447
3448 if (typeof a !== typeof b) {
3449 return false;
3450 }
3451
3452 if (a && b && typeof a === 'object' && typeof b === 'object') {
3453 return !Object.keys(b).some(key => !partialDeepEqual(a[key], b[key]));
3454 }
3455
3456 return false;
3457 }
3458 /**
3459 * This function returns `a` if `b` is deeply equal.
3460 * If not, it will replace any deeply equal children of `b` with those of `a`.
3461 * This can be used for structural sharing between JSON values for example.
3462 */
3463
3464 function replaceEqualDeep(a, b) {
3465 if (a === b) {
3466 return a;
3467 }
3468
3469 const array = isPlainArray(a) && isPlainArray(b);
3470
3471 if (array || isPlainObject(a) && isPlainObject(b)) {
3472 const aSize = array ? a.length : Object.keys(a).length;
3473 const bItems = array ? b : Object.keys(b);
3474 const bSize = bItems.length;
3475 const copy = array ? [] : {};
3476 let equalItems = 0;
3477
3478 for (let i = 0; i < bSize; i++) {
3479 const key = array ? i : bItems[i];
3480 copy[key] = replaceEqualDeep(a[key], b[key]);
3481
3482 if (copy[key] === a[key]) {
3483 equalItems++;
3484 }
3485 }
3486
3487 return aSize === bSize && equalItems === aSize ? a : copy;
3488 }
3489
3490 return b;
3491 }
3492 /**
3493 * Shallow compare objects. Only works with objects that always have the same properties.
3494 */
3495
3496 function shallowEqualObjects(a, b) {
3497 if (a && !b || b && !a) {
3498 return false;
3499 }
3500
3501 for (const key in a) {
3502 if (a[key] !== b[key]) {
3503 return false;
3504 }
3505 }
3506
3507 return true;
3508 }
3509 function isPlainArray(value) {
3510 return Array.isArray(value) && value.length === Object.keys(value).length;
3511 } // Copied from: https://github.com/jonschlinkert/is-plain-object
3512
3513 function isPlainObject(o) {
3514 if (!hasObjectPrototype(o)) {
3515 return false;
3516 } // If has modified constructor
3517
3518
3519 const ctor = o.constructor;
3520
3521 if (typeof ctor === 'undefined') {
3522 return true;
3523 } // If has modified prototype
3524
3525
3526 const prot = ctor.prototype;
3527
3528 if (!hasObjectPrototype(prot)) {
3529 return false;
3530 } // If constructor does not have an Object-specific method
3531
3532
3533 if (!prot.hasOwnProperty('isPrototypeOf')) {
3534 return false;
3535 } // Most likely a plain Object
3536
3537
3538 return true;
3539 }
3540
3541 function hasObjectPrototype(o) {
3542 return Object.prototype.toString.call(o) === '[object Object]';
3543 }
3544
3545 function isQueryKey(value) {
3546 return Array.isArray(value);
3547 }
3548 function isError(value) {
3549 return value instanceof Error;
3550 }
3551 function sleep(timeout) {
3552 return new Promise(resolve => {
3553 setTimeout(resolve, timeout);
3554 });
3555 }
3556 /**
3557 * Schedules a microtask.
3558 * This can be useful to schedule state updates after rendering.
3559 */
3560
3561 function scheduleMicrotask(callback) {
3562 sleep(0).then(callback);
3563 }
3564 function getAbortController() {
3565 if (typeof AbortController === 'function') {
3566 return new AbortController();
3567 }
3568
3569 return;
3570 }
3571 function replaceData(prevData, data, options) {
3572 // Use prev data if an isDataEqual function is defined and returns `true`
3573 if (options.isDataEqual != null && options.isDataEqual(prevData, data)) {
3574 return prevData;
3575 } else if (typeof options.structuralSharing === 'function') {
3576 return options.structuralSharing(prevData, data);
3577 } else if (options.structuralSharing !== false) {
3578 // Structurally share data between prev and new data if needed
3579 return replaceEqualDeep(prevData, data);
3580 }
3581
3582 return data;
3583 }
3584
3585
3586 //# sourceMappingURL=utils.mjs.map
3587
3588
3589 /***/ }),
3590
3591 /***/ "./node_modules/@tanstack/react-query/build/lib/QueryClientProvider.mjs":
3592 /*!******************************************************************************!*\
3593 !*** ./node_modules/@tanstack/react-query/build/lib/QueryClientProvider.mjs ***!
3594 \******************************************************************************/
3595 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
3596
3597 __webpack_require__.r(__webpack_exports__);
3598 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3599 /* harmony export */ QueryClientProvider: function() { return /* binding */ QueryClientProvider; },
3600 /* harmony export */ defaultContext: function() { return /* binding */ defaultContext; },
3601 /* harmony export */ useQueryClient: function() { return /* binding */ useQueryClient; }
3602 /* harmony export */ });
3603 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
3604 'use client';
3605
3606
3607 const defaultContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createContext(undefined);
3608 const QueryClientSharingContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createContext(false); // If we are given a context, we will use it.
3609 // Otherwise, if contextSharing is on, we share the first and at least one
3610 // instance of the context across the window
3611 // to ensure that if React Query is used across
3612 // different bundles or microfrontends they will
3613 // all use the same **instance** of context, regardless
3614 // of module scoping.
3615
3616 function getQueryClientContext(context, contextSharing) {
3617 if (context) {
3618 return context;
3619 }
3620
3621 if (contextSharing && typeof window !== 'undefined') {
3622 if (!window.ReactQueryClientContext) {
3623 window.ReactQueryClientContext = defaultContext;
3624 }
3625
3626 return window.ReactQueryClientContext;
3627 }
3628
3629 return defaultContext;
3630 }
3631
3632 const useQueryClient = ({
3633 context
3634 } = {}) => {
3635 const queryClient = react__WEBPACK_IMPORTED_MODULE_0__.useContext(getQueryClientContext(context, react__WEBPACK_IMPORTED_MODULE_0__.useContext(QueryClientSharingContext)));
3636
3637 if (!queryClient) {
3638 throw new Error('No QueryClient set, use QueryClientProvider to set one');
3639 }
3640
3641 return queryClient;
3642 };
3643 const QueryClientProvider = ({
3644 client,
3645 children,
3646 context,
3647 contextSharing = false
3648 }) => {
3649 react__WEBPACK_IMPORTED_MODULE_0__.useEffect(() => {
3650 client.mount();
3651 return () => {
3652 client.unmount();
3653 };
3654 }, [client]);
3655
3656 if ( true && contextSharing) {
3657 client.getLogger().error("The contextSharing option has been deprecated and will be removed in the next major version");
3658 }
3659
3660 const Context = getQueryClientContext(context, contextSharing);
3661 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(QueryClientSharingContext.Provider, {
3662 value: !context && contextSharing
3663 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Context.Provider, {
3664 value: client
3665 }, children));
3666 };
3667
3668
3669 //# sourceMappingURL=QueryClientProvider.mjs.map
3670
3671
3672 /***/ }),
3673
3674 /***/ "./node_modules/@tanstack/react-query/build/lib/QueryErrorResetBoundary.mjs":
3675 /*!**********************************************************************************!*\
3676 !*** ./node_modules/@tanstack/react-query/build/lib/QueryErrorResetBoundary.mjs ***!
3677 \**********************************************************************************/
3678 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
3679
3680 __webpack_require__.r(__webpack_exports__);
3681 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3682 /* harmony export */ QueryErrorResetBoundary: function() { return /* binding */ QueryErrorResetBoundary; },
3683 /* harmony export */ useQueryErrorResetBoundary: function() { return /* binding */ useQueryErrorResetBoundary; }
3684 /* harmony export */ });
3685 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
3686 'use client';
3687
3688
3689 function createValue() {
3690 let isReset = false;
3691 return {
3692 clearReset: () => {
3693 isReset = false;
3694 },
3695 reset: () => {
3696 isReset = true;
3697 },
3698 isReset: () => {
3699 return isReset;
3700 }
3701 };
3702 }
3703
3704 const QueryErrorResetBoundaryContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createContext(createValue()); // HOOK
3705
3706 const useQueryErrorResetBoundary = () => react__WEBPACK_IMPORTED_MODULE_0__.useContext(QueryErrorResetBoundaryContext); // COMPONENT
3707
3708 const QueryErrorResetBoundary = ({
3709 children
3710 }) => {
3711 const [value] = react__WEBPACK_IMPORTED_MODULE_0__.useState(() => createValue());
3712 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(QueryErrorResetBoundaryContext.Provider, {
3713 value: value
3714 }, typeof children === 'function' ? children(value) : children);
3715 };
3716
3717
3718 //# sourceMappingURL=QueryErrorResetBoundary.mjs.map
3719
3720
3721 /***/ }),
3722
3723 /***/ "./node_modules/@tanstack/react-query/build/lib/errorBoundaryUtils.mjs":
3724 /*!*****************************************************************************!*\
3725 !*** ./node_modules/@tanstack/react-query/build/lib/errorBoundaryUtils.mjs ***!
3726 \*****************************************************************************/
3727 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
3728
3729 __webpack_require__.r(__webpack_exports__);
3730 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3731 /* harmony export */ ensurePreventErrorBoundaryRetry: function() { return /* binding */ ensurePreventErrorBoundaryRetry; },
3732 /* harmony export */ getHasError: function() { return /* binding */ getHasError; },
3733 /* harmony export */ useClearResetErrorBoundary: function() { return /* binding */ useClearResetErrorBoundary; }
3734 /* harmony export */ });
3735 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
3736 /* harmony import */ var _utils_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.mjs */ "./node_modules/@tanstack/react-query/build/lib/utils.mjs");
3737 'use client';
3738
3739
3740
3741 const ensurePreventErrorBoundaryRetry = (options, errorResetBoundary) => {
3742 if (options.suspense || options.useErrorBoundary) {
3743 // Prevent retrying failed query if the error boundary has not been reset yet
3744 if (!errorResetBoundary.isReset()) {
3745 options.retryOnMount = false;
3746 }
3747 }
3748 };
3749 const useClearResetErrorBoundary = errorResetBoundary => {
3750 react__WEBPACK_IMPORTED_MODULE_0__.useEffect(() => {
3751 errorResetBoundary.clearReset();
3752 }, [errorResetBoundary]);
3753 };
3754 const getHasError = ({
3755 result,
3756 errorResetBoundary,
3757 useErrorBoundary,
3758 query
3759 }) => {
3760 return result.isError && !errorResetBoundary.isReset() && !result.isFetching && (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.shouldThrowError)(useErrorBoundary, [result.error, query]);
3761 };
3762
3763
3764 //# sourceMappingURL=errorBoundaryUtils.mjs.map
3765
3766
3767 /***/ }),
3768
3769 /***/ "./node_modules/@tanstack/react-query/build/lib/isRestoring.mjs":
3770 /*!**********************************************************************!*\
3771 !*** ./node_modules/@tanstack/react-query/build/lib/isRestoring.mjs ***!
3772 \**********************************************************************/
3773 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
3774
3775 __webpack_require__.r(__webpack_exports__);
3776 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3777 /* harmony export */ IsRestoringProvider: function() { return /* binding */ IsRestoringProvider; },
3778 /* harmony export */ useIsRestoring: function() { return /* binding */ useIsRestoring; }
3779 /* harmony export */ });
3780 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
3781 'use client';
3782
3783
3784 const IsRestoringContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createContext(false);
3785 const useIsRestoring = () => react__WEBPACK_IMPORTED_MODULE_0__.useContext(IsRestoringContext);
3786 const IsRestoringProvider = IsRestoringContext.Provider;
3787
3788
3789 //# sourceMappingURL=isRestoring.mjs.map
3790
3791
3792 /***/ }),
3793
3794 /***/ "./node_modules/@tanstack/react-query/build/lib/suspense.mjs":
3795 /*!*******************************************************************!*\
3796 !*** ./node_modules/@tanstack/react-query/build/lib/suspense.mjs ***!
3797 \*******************************************************************/
3798 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
3799
3800 __webpack_require__.r(__webpack_exports__);
3801 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3802 /* harmony export */ ensureStaleTime: function() { return /* binding */ ensureStaleTime; },
3803 /* harmony export */ fetchOptimistic: function() { return /* binding */ fetchOptimistic; },
3804 /* harmony export */ shouldSuspend: function() { return /* binding */ shouldSuspend; },
3805 /* harmony export */ willFetch: function() { return /* binding */ willFetch; }
3806 /* harmony export */ });
3807 const ensureStaleTime = defaultedOptions => {
3808 if (defaultedOptions.suspense) {
3809 // Always set stale time when using suspense to prevent
3810 // fetching again when directly mounting after suspending
3811 if (typeof defaultedOptions.staleTime !== 'number') {
3812 defaultedOptions.staleTime = 1000;
3813 }
3814 }
3815 };
3816 const willFetch = (result, isRestoring) => result.isLoading && result.isFetching && !isRestoring;
3817 const shouldSuspend = (defaultedOptions, result, isRestoring) => (defaultedOptions == null ? void 0 : defaultedOptions.suspense) && willFetch(result, isRestoring);
3818 const fetchOptimistic = (defaultedOptions, observer, errorResetBoundary) => observer.fetchOptimistic(defaultedOptions).then(({
3819 data
3820 }) => {
3821 defaultedOptions.onSuccess == null ? void 0 : defaultedOptions.onSuccess(data);
3822 defaultedOptions.onSettled == null ? void 0 : defaultedOptions.onSettled(data, null);
3823 }).catch(error => {
3824 errorResetBoundary.clearReset();
3825 defaultedOptions.onError == null ? void 0 : defaultedOptions.onError(error);
3826 defaultedOptions.onSettled == null ? void 0 : defaultedOptions.onSettled(undefined, error);
3827 });
3828
3829
3830 //# sourceMappingURL=suspense.mjs.map
3831
3832
3833 /***/ }),
3834
3835 /***/ "./node_modules/@tanstack/react-query/build/lib/useBaseQuery.mjs":
3836 /*!***********************************************************************!*\
3837 !*** ./node_modules/@tanstack/react-query/build/lib/useBaseQuery.mjs ***!
3838 \***********************************************************************/
3839 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
3840
3841 __webpack_require__.r(__webpack_exports__);
3842 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3843 /* harmony export */ useBaseQuery: function() { return /* binding */ useBaseQuery; }
3844 /* harmony export */ });
3845 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
3846 /* harmony import */ var _tanstack_query_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @tanstack/query-core */ "./node_modules/@tanstack/query-core/build/lib/notifyManager.mjs");
3847 /* harmony import */ var _useSyncExternalStore_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./useSyncExternalStore.mjs */ "./node_modules/@tanstack/react-query/build/lib/useSyncExternalStore.mjs");
3848 /* harmony import */ var _QueryErrorResetBoundary_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./QueryErrorResetBoundary.mjs */ "./node_modules/@tanstack/react-query/build/lib/QueryErrorResetBoundary.mjs");
3849 /* harmony import */ var _QueryClientProvider_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./QueryClientProvider.mjs */ "./node_modules/@tanstack/react-query/build/lib/QueryClientProvider.mjs");
3850 /* harmony import */ var _isRestoring_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./isRestoring.mjs */ "./node_modules/@tanstack/react-query/build/lib/isRestoring.mjs");
3851 /* harmony import */ var _errorBoundaryUtils_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./errorBoundaryUtils.mjs */ "./node_modules/@tanstack/react-query/build/lib/errorBoundaryUtils.mjs");
3852 /* harmony import */ var _suspense_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./suspense.mjs */ "./node_modules/@tanstack/react-query/build/lib/suspense.mjs");
3853 'use client';
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863 function useBaseQuery(options, Observer) {
3864 const queryClient = (0,_QueryClientProvider_mjs__WEBPACK_IMPORTED_MODULE_1__.useQueryClient)({
3865 context: options.context
3866 });
3867 const isRestoring = (0,_isRestoring_mjs__WEBPACK_IMPORTED_MODULE_2__.useIsRestoring)();
3868 const errorResetBoundary = (0,_QueryErrorResetBoundary_mjs__WEBPACK_IMPORTED_MODULE_3__.useQueryErrorResetBoundary)();
3869 const defaultedOptions = queryClient.defaultQueryOptions(options); // Make sure results are optimistically set in fetching state before subscribing or updating options
3870
3871 defaultedOptions._optimisticResults = isRestoring ? 'isRestoring' : 'optimistic'; // Include callbacks in batch renders
3872
3873 if (defaultedOptions.onError) {
3874 defaultedOptions.onError = _tanstack_query_core__WEBPACK_IMPORTED_MODULE_4__.notifyManager.batchCalls(defaultedOptions.onError);
3875 }
3876
3877 if (defaultedOptions.onSuccess) {
3878 defaultedOptions.onSuccess = _tanstack_query_core__WEBPACK_IMPORTED_MODULE_4__.notifyManager.batchCalls(defaultedOptions.onSuccess);
3879 }
3880
3881 if (defaultedOptions.onSettled) {
3882 defaultedOptions.onSettled = _tanstack_query_core__WEBPACK_IMPORTED_MODULE_4__.notifyManager.batchCalls(defaultedOptions.onSettled);
3883 }
3884
3885 (0,_suspense_mjs__WEBPACK_IMPORTED_MODULE_5__.ensureStaleTime)(defaultedOptions);
3886 (0,_errorBoundaryUtils_mjs__WEBPACK_IMPORTED_MODULE_6__.ensurePreventErrorBoundaryRetry)(defaultedOptions, errorResetBoundary);
3887 (0,_errorBoundaryUtils_mjs__WEBPACK_IMPORTED_MODULE_6__.useClearResetErrorBoundary)(errorResetBoundary);
3888 const [observer] = react__WEBPACK_IMPORTED_MODULE_0__.useState(() => new Observer(queryClient, defaultedOptions));
3889 const result = observer.getOptimisticResult(defaultedOptions);
3890 (0,_useSyncExternalStore_mjs__WEBPACK_IMPORTED_MODULE_7__.useSyncExternalStore)(react__WEBPACK_IMPORTED_MODULE_0__.useCallback(onStoreChange => {
3891 const unsubscribe = isRestoring ? () => undefined : observer.subscribe(_tanstack_query_core__WEBPACK_IMPORTED_MODULE_4__.notifyManager.batchCalls(onStoreChange)); // Update result to make sure we did not miss any query updates
3892 // between creating the observer and subscribing to it.
3893
3894 observer.updateResult();
3895 return unsubscribe;
3896 }, [observer, isRestoring]), () => observer.getCurrentResult(), () => observer.getCurrentResult());
3897 react__WEBPACK_IMPORTED_MODULE_0__.useEffect(() => {
3898 // Do not notify on updates because of changes in the options because
3899 // these changes should already be reflected in the optimistic result.
3900 observer.setOptions(defaultedOptions, {
3901 listeners: false
3902 });
3903 }, [defaultedOptions, observer]); // Handle suspense
3904
3905 if ((0,_suspense_mjs__WEBPACK_IMPORTED_MODULE_5__.shouldSuspend)(defaultedOptions, result, isRestoring)) {
3906 throw (0,_suspense_mjs__WEBPACK_IMPORTED_MODULE_5__.fetchOptimistic)(defaultedOptions, observer, errorResetBoundary);
3907 } // Handle error boundary
3908
3909
3910 if ((0,_errorBoundaryUtils_mjs__WEBPACK_IMPORTED_MODULE_6__.getHasError)({
3911 result,
3912 errorResetBoundary,
3913 useErrorBoundary: defaultedOptions.useErrorBoundary,
3914 query: observer.getCurrentQuery()
3915 })) {
3916 throw result.error;
3917 } // Handle result property usage tracking
3918
3919
3920 return !defaultedOptions.notifyOnChangeProps ? observer.trackResult(result) : result;
3921 }
3922
3923
3924 //# sourceMappingURL=useBaseQuery.mjs.map
3925
3926
3927 /***/ }),
3928
3929 /***/ "./node_modules/@tanstack/react-query/build/lib/useMutation.mjs":
3930 /*!**********************************************************************!*\
3931 !*** ./node_modules/@tanstack/react-query/build/lib/useMutation.mjs ***!
3932 \**********************************************************************/
3933 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
3934
3935 __webpack_require__.r(__webpack_exports__);
3936 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3937 /* harmony export */ useMutation: function() { return /* binding */ useMutation; }
3938 /* harmony export */ });
3939 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
3940 /* harmony import */ var _tanstack_query_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @tanstack/query-core */ "./node_modules/@tanstack/query-core/build/lib/utils.mjs");
3941 /* harmony import */ var _tanstack_query_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @tanstack/query-core */ "./node_modules/@tanstack/query-core/build/lib/mutationObserver.mjs");
3942 /* harmony import */ var _tanstack_query_core__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @tanstack/query-core */ "./node_modules/@tanstack/query-core/build/lib/notifyManager.mjs");
3943 /* harmony import */ var _useSyncExternalStore_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./useSyncExternalStore.mjs */ "./node_modules/@tanstack/react-query/build/lib/useSyncExternalStore.mjs");
3944 /* harmony import */ var _QueryClientProvider_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./QueryClientProvider.mjs */ "./node_modules/@tanstack/react-query/build/lib/QueryClientProvider.mjs");
3945 /* harmony import */ var _utils_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./utils.mjs */ "./node_modules/@tanstack/react-query/build/lib/utils.mjs");
3946 'use client';
3947
3948
3949
3950
3951
3952
3953 function useMutation(arg1, arg2, arg3) {
3954 const options = (0,_tanstack_query_core__WEBPACK_IMPORTED_MODULE_1__.parseMutationArgs)(arg1, arg2, arg3);
3955 const queryClient = (0,_QueryClientProvider_mjs__WEBPACK_IMPORTED_MODULE_2__.useQueryClient)({
3956 context: options.context
3957 });
3958 const [observer] = react__WEBPACK_IMPORTED_MODULE_0__.useState(() => new _tanstack_query_core__WEBPACK_IMPORTED_MODULE_3__.MutationObserver(queryClient, options));
3959 react__WEBPACK_IMPORTED_MODULE_0__.useEffect(() => {
3960 observer.setOptions(options);
3961 }, [observer, options]);
3962 const result = (0,_useSyncExternalStore_mjs__WEBPACK_IMPORTED_MODULE_4__.useSyncExternalStore)(react__WEBPACK_IMPORTED_MODULE_0__.useCallback(onStoreChange => observer.subscribe(_tanstack_query_core__WEBPACK_IMPORTED_MODULE_5__.notifyManager.batchCalls(onStoreChange)), [observer]), () => observer.getCurrentResult(), () => observer.getCurrentResult());
3963 const mutate = react__WEBPACK_IMPORTED_MODULE_0__.useCallback((variables, mutateOptions) => {
3964 observer.mutate(variables, mutateOptions).catch(noop);
3965 }, [observer]);
3966
3967 if (result.error && (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_6__.shouldThrowError)(observer.options.useErrorBoundary, [result.error])) {
3968 throw result.error;
3969 }
3970
3971 return { ...result,
3972 mutate,
3973 mutateAsync: result.mutate
3974 };
3975 } // eslint-disable-next-line @typescript-eslint/no-empty-function
3976
3977 function noop() {}
3978
3979
3980 //# sourceMappingURL=useMutation.mjs.map
3981
3982
3983 /***/ }),
3984
3985 /***/ "./node_modules/@tanstack/react-query/build/lib/useQuery.mjs":
3986 /*!*******************************************************************!*\
3987 !*** ./node_modules/@tanstack/react-query/build/lib/useQuery.mjs ***!
3988 \*******************************************************************/
3989 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
3990
3991 __webpack_require__.r(__webpack_exports__);
3992 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3993 /* harmony export */ useQuery: function() { return /* binding */ useQuery; }
3994 /* harmony export */ });
3995 /* harmony import */ var _tanstack_query_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tanstack/query-core */ "./node_modules/@tanstack/query-core/build/lib/utils.mjs");
3996 /* harmony import */ var _tanstack_query_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @tanstack/query-core */ "./node_modules/@tanstack/query-core/build/lib/queryObserver.mjs");
3997 /* harmony import */ var _useBaseQuery_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./useBaseQuery.mjs */ "./node_modules/@tanstack/react-query/build/lib/useBaseQuery.mjs");
3998 'use client';
3999
4000
4001
4002 function useQuery(arg1, arg2, arg3) {
4003 const parsedOptions = (0,_tanstack_query_core__WEBPACK_IMPORTED_MODULE_0__.parseQueryArgs)(arg1, arg2, arg3);
4004 return (0,_useBaseQuery_mjs__WEBPACK_IMPORTED_MODULE_1__.useBaseQuery)(parsedOptions, _tanstack_query_core__WEBPACK_IMPORTED_MODULE_2__.QueryObserver);
4005 }
4006
4007
4008 //# sourceMappingURL=useQuery.mjs.map
4009
4010
4011 /***/ }),
4012
4013 /***/ "./node_modules/@tanstack/react-query/build/lib/useSyncExternalStore.mjs":
4014 /*!*******************************************************************************!*\
4015 !*** ./node_modules/@tanstack/react-query/build/lib/useSyncExternalStore.mjs ***!
4016 \*******************************************************************************/
4017 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
4018
4019 __webpack_require__.r(__webpack_exports__);
4020 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4021 /* harmony export */ useSyncExternalStore: function() { return /* binding */ useSyncExternalStore; }
4022 /* harmony export */ });
4023 /* harmony import */ var use_sync_external_store_shim_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! use-sync-external-store/shim/index.js */ "./node_modules/use-sync-external-store/shim/index.js");
4024 'use client';
4025
4026
4027 const useSyncExternalStore = use_sync_external_store_shim_index_js__WEBPACK_IMPORTED_MODULE_0__.useSyncExternalStore;
4028
4029
4030 //# sourceMappingURL=useSyncExternalStore.mjs.map
4031
4032
4033 /***/ }),
4034
4035 /***/ "./node_modules/@tanstack/react-query/build/lib/utils.mjs":
4036 /*!****************************************************************!*\
4037 !*** ./node_modules/@tanstack/react-query/build/lib/utils.mjs ***!
4038 \****************************************************************/
4039 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
4040
4041 __webpack_require__.r(__webpack_exports__);
4042 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4043 /* harmony export */ shouldThrowError: function() { return /* binding */ shouldThrowError; }
4044 /* harmony export */ });
4045 function shouldThrowError(_useErrorBoundary, params) {
4046 // Allow useErrorBoundary function to override throwing behavior on a per-error basis
4047 if (typeof _useErrorBoundary === 'function') {
4048 return _useErrorBoundary(...params);
4049 }
4050
4051 return !!_useErrorBoundary;
4052 }
4053
4054
4055 //# sourceMappingURL=utils.mjs.map
4056
4057
4058 /***/ })
4059
4060 /******/ });
4061 /************************************************************************/
4062 /******/ // The module cache
4063 /******/ var __webpack_module_cache__ = {};
4064 /******/
4065 /******/ // The require function
4066 /******/ function __webpack_require__(moduleId) {
4067 /******/ // Check if module is in cache
4068 /******/ var cachedModule = __webpack_module_cache__[moduleId];
4069 /******/ if (cachedModule !== undefined) {
4070 /******/ return cachedModule.exports;
4071 /******/ }
4072 /******/ // Create a new module (and put it into the cache)
4073 /******/ var module = __webpack_module_cache__[moduleId] = {
4074 /******/ // no module.id needed
4075 /******/ // no module.loaded needed
4076 /******/ exports: {}
4077 /******/ };
4078 /******/
4079 /******/ // Execute the module function
4080 /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
4081 /******/
4082 /******/ // Return the exports of the module
4083 /******/ return module.exports;
4084 /******/ }
4085 /******/
4086 /************************************************************************/
4087 /******/ /* webpack/runtime/define property getters */
4088 /******/ !function() {
4089 /******/ // define getter functions for harmony exports
4090 /******/ __webpack_require__.d = function(exports, definition) {
4091 /******/ for(var key in definition) {
4092 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
4093 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
4094 /******/ }
4095 /******/ }
4096 /******/ };
4097 /******/ }();
4098 /******/
4099 /******/ /* webpack/runtime/hasOwnProperty shorthand */
4100 /******/ !function() {
4101 /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
4102 /******/ }();
4103 /******/
4104 /******/ /* webpack/runtime/make namespace object */
4105 /******/ !function() {
4106 /******/ // define __esModule on exports
4107 /******/ __webpack_require__.r = function(exports) {
4108 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
4109 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4110 /******/ }
4111 /******/ Object.defineProperty(exports, '__esModule', { value: true });
4112 /******/ };
4113 /******/ }();
4114 /******/
4115 /************************************************************************/
4116 var __webpack_exports__ = {};
4117 // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
4118 !function() {
4119 /*!******************************************************!*\
4120 !*** ./node_modules/@elementor/query/dist/index.mjs ***!
4121 \******************************************************/
4122 __webpack_require__.r(__webpack_exports__);
4123 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4124 /* harmony export */ QueryClient: function() { return /* reexport safe */ _tanstack_react_query__WEBPACK_IMPORTED_MODULE_0__.QueryClient; },
4125 /* harmony export */ QueryClientProvider: function() { return /* reexport safe */ _tanstack_react_query__WEBPACK_IMPORTED_MODULE_1__.QueryClientProvider; },
4126 /* harmony export */ createQueryClient: function() { return /* binding */ createQueryClient; },
4127 /* harmony export */ useMutation: function() { return /* reexport safe */ _tanstack_react_query__WEBPACK_IMPORTED_MODULE_2__.useMutation; },
4128 /* harmony export */ useQuery: function() { return /* reexport safe */ _tanstack_react_query__WEBPACK_IMPORTED_MODULE_3__.useQuery; },
4129 /* harmony export */ useQueryClient: function() { return /* reexport safe */ _tanstack_react_query__WEBPACK_IMPORTED_MODULE_1__.useQueryClient; }
4130 /* harmony export */ });
4131 /* harmony import */ var _tanstack_react_query__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tanstack/react-query */ "./node_modules/@tanstack/query-core/build/lib/queryClient.mjs");
4132 /* harmony import */ var _tanstack_react_query__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @tanstack/react-query */ "./node_modules/@tanstack/react-query/build/lib/QueryClientProvider.mjs");
4133 /* harmony import */ var _tanstack_react_query__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @tanstack/react-query */ "./node_modules/@tanstack/react-query/build/lib/useMutation.mjs");
4134 /* harmony import */ var _tanstack_react_query__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @tanstack/react-query */ "./node_modules/@tanstack/react-query/build/lib/useQuery.mjs");
4135 // src/index.ts
4136
4137
4138 function createQueryClient() {
4139 return new _tanstack_react_query__WEBPACK_IMPORTED_MODULE_0__.QueryClient({
4140 defaultOptions: {
4141 queries: {
4142 refetchOnWindowFocus: false,
4143 refetchOnReconnect: false
4144 }
4145 }
4146 });
4147 }
4148
4149 //# sourceMappingURL=index.mjs.map
4150 }();
4151 (window.elementorV2 = window.elementorV2 || {}).query = __webpack_exports__;
4152 /******/ })()
4153 ;