) => {\n this.props.onReset?.(...args)\n this.reset()\n }\n\n reset() {\n this.setState(initialState)\n }\n\n componentDidCatch(error: Error, info: React.ErrorInfo) {\n this.props.onError?.(error, info)\n }\n\n componentDidUpdate(\n prevProps: ErrorBoundaryProps,\n prevState: ErrorBoundaryState,\n ) {\n const {error} = this.state\n const {resetKeys} = this.props\n\n // There's an edge case where if the thing that triggered the error\n // happens to *also* be in the resetKeys array, we'd end up resetting\n // the error boundary immediately. This would likely trigger a second\n // error to be thrown.\n // So we make sure that we don't check the resetKeys on the first call\n // of cDU after the error is set\n\n if (\n error !== null &&\n prevState.error !== null &&\n changedArray(prevProps.resetKeys, resetKeys)\n ) {\n this.props.onResetKeysChange?.(prevProps.resetKeys, resetKeys)\n this.reset()\n }\n }\n\n render() {\n const {error} = this.state\n\n const {fallbackRender, FallbackComponent, fallback} = this.props\n\n if (error !== null) {\n const props = {\n error,\n resetErrorBoundary: this.resetErrorBoundary,\n }\n if (React.isValidElement(fallback)) {\n return fallback\n } else if (typeof fallbackRender === 'function') {\n return fallbackRender(props)\n } else if (FallbackComponent) {\n return \n } else {\n throw new Error(\n 'react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop',\n )\n }\n }\n\n return this.props.children\n }\n}\n\nfunction withErrorBoundary(\n Component: React.ComponentType
,\n errorBoundaryProps: ErrorBoundaryProps,\n): React.ComponentType
{\n const Wrapped: React.ComponentType
= props => {\n return (\n \n \n \n )\n }\n\n // Format for display in DevTools\n const name = Component.displayName || Component.name || 'Unknown'\n Wrapped.displayName = `withErrorBoundary(${name})`\n\n return Wrapped\n}\n\nfunction useErrorHandler(givenError?: unknown): (error: unknown) => void {\n const [error, setError] = React.useState(null)\n if (givenError != null) throw givenError\n if (error != null) throw error\n return setError\n}\n\nexport {ErrorBoundary, withErrorBoundary, useErrorHandler}\nexport type {\n FallbackProps,\n ErrorBoundaryPropsWithComponent,\n ErrorBoundaryPropsWithRender,\n ErrorBoundaryPropsWithFallback,\n ErrorBoundaryProps,\n}\n\n/*\neslint\n @typescript-eslint/sort-type-union-intersection-members: \"off\",\n @typescript-eslint/no-throw-literal: \"off\",\n @typescript-eslint/prefer-nullish-coalescing: \"off\"\n*/\n","/**\n * @license React\n * react-is.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var b=Symbol.for(\"react.element\"),c=Symbol.for(\"react.portal\"),d=Symbol.for(\"react.fragment\"),e=Symbol.for(\"react.strict_mode\"),f=Symbol.for(\"react.profiler\"),g=Symbol.for(\"react.provider\"),h=Symbol.for(\"react.context\"),k=Symbol.for(\"react.server_context\"),l=Symbol.for(\"react.forward_ref\"),m=Symbol.for(\"react.suspense\"),n=Symbol.for(\"react.suspense_list\"),p=Symbol.for(\"react.memo\"),q=Symbol.for(\"react.lazy\"),t=Symbol.for(\"react.offscreen\"),u;u=Symbol.for(\"react.module.reference\");\nfunction v(a){if(\"object\"===typeof a&&null!==a){var r=a.$$typeof;switch(r){case b:switch(a=a.type,a){case d:case f:case e:case m:case n:return a;default:switch(a=a&&a.$$typeof,a){case k:case h:case l:case q:case p:case g:return a;default:return r}}case c:return r}}}exports.ContextConsumer=h;exports.ContextProvider=g;exports.Element=b;exports.ForwardRef=l;exports.Fragment=d;exports.Lazy=q;exports.Memo=p;exports.Portal=c;exports.Profiler=f;exports.StrictMode=e;exports.Suspense=m;\nexports.SuspenseList=n;exports.isAsyncMode=function(){return!1};exports.isConcurrentMode=function(){return!1};exports.isContextConsumer=function(a){return v(a)===h};exports.isContextProvider=function(a){return v(a)===g};exports.isElement=function(a){return\"object\"===typeof a&&null!==a&&a.$$typeof===b};exports.isForwardRef=function(a){return v(a)===l};exports.isFragment=function(a){return v(a)===d};exports.isLazy=function(a){return v(a)===q};exports.isMemo=function(a){return v(a)===p};\nexports.isPortal=function(a){return v(a)===c};exports.isProfiler=function(a){return v(a)===f};exports.isStrictMode=function(a){return v(a)===e};exports.isSuspense=function(a){return v(a)===m};exports.isSuspenseList=function(a){return v(a)===n};\nexports.isValidElementType=function(a){return\"string\"===typeof a||\"function\"===typeof a||a===d||a===f||a===e||a===m||a===n||a===t||\"object\"===typeof a&&null!==a&&(a.$$typeof===q||a.$$typeof===p||a.$$typeof===g||a.$$typeof===h||a.$$typeof===l||a.$$typeof===u||void 0!==a.getModuleId)?!0:!1};exports.typeOf=v;\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-is.production.min.js');\n} else {\n module.exports = require('./cjs/react-is.development.js');\n}\n","import _inheritsLoose from \"@babel/runtime/helpers/esm/inheritsLoose\";\nimport { Subscribable } from './subscribable';\nimport { isServer } from './utils';\nexport var FocusManager = /*#__PURE__*/function (_Subscribable) {\n _inheritsLoose(FocusManager, _Subscribable);\n\n function FocusManager() {\n var _this;\n\n _this = _Subscribable.call(this) || this;\n\n _this.setup = function (onFocus) {\n var _window;\n\n if (!isServer && ((_window = window) == null ? void 0 : _window.addEventListener)) {\n var listener = function listener() {\n return onFocus();\n }; // Listen to visibillitychange and focus\n\n\n window.addEventListener('visibilitychange', listener, false);\n window.addEventListener('focus', listener, false);\n return function () {\n // Be sure to unsubscribe if a new handler is set\n window.removeEventListener('visibilitychange', listener);\n window.removeEventListener('focus', listener);\n };\n }\n };\n\n return _this;\n }\n\n var _proto = FocusManager.prototype;\n\n _proto.onSubscribe = function onSubscribe() {\n if (!this.cleanup) {\n this.setEventListener(this.setup);\n }\n };\n\n _proto.onUnsubscribe = function onUnsubscribe() {\n if (!this.hasListeners()) {\n var _this$cleanup;\n\n (_this$cleanup = this.cleanup) == null ? void 0 : _this$cleanup.call(this);\n this.cleanup = undefined;\n }\n };\n\n _proto.setEventListener = function setEventListener(setup) {\n var _this$cleanup2,\n _this2 = this;\n\n this.setup = setup;\n (_this$cleanup2 = this.cleanup) == null ? void 0 : _this$cleanup2.call(this);\n this.cleanup = setup(function (focused) {\n if (typeof focused === 'boolean') {\n _this2.setFocused(focused);\n } else {\n _this2.onFocus();\n }\n });\n };\n\n _proto.setFocused = function setFocused(focused) {\n this.focused = focused;\n\n if (focused) {\n this.onFocus();\n }\n };\n\n _proto.onFocus = function onFocus() {\n this.listeners.forEach(function (listener) {\n listener();\n });\n };\n\n _proto.isFocused = function isFocused() {\n if (typeof this.focused === 'boolean') {\n return this.focused;\n } // document global can be unavailable in react native\n\n\n if (typeof document === 'undefined') {\n return true;\n }\n\n return [undefined, 'visible', 'prerender'].includes(document.visibilityState);\n };\n\n return FocusManager;\n}(Subscribable);\nexport var focusManager = new FocusManager();","// TYPES\n// FUNCTIONS\nvar logger = console;\nexport function getLogger() {\n return logger;\n}\nexport function setLogger(newLogger) {\n logger = newLogger;\n}","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport { getLogger } from './logger';\nimport { notifyManager } from './notifyManager';\nimport { Retryer } from './retryer';\nimport { noop } from './utils'; // TYPES\n\n// CLASS\nexport var Mutation = /*#__PURE__*/function () {\n function Mutation(config) {\n this.options = _extends({}, config.defaultOptions, config.options);\n this.mutationId = config.mutationId;\n this.mutationCache = config.mutationCache;\n this.observers = [];\n this.state = config.state || getDefaultState();\n this.meta = config.meta;\n }\n\n var _proto = Mutation.prototype;\n\n _proto.setState = function setState(state) {\n this.dispatch({\n type: 'setState',\n state: state\n });\n };\n\n _proto.addObserver = function addObserver(observer) {\n if (this.observers.indexOf(observer) === -1) {\n this.observers.push(observer);\n }\n };\n\n _proto.removeObserver = function removeObserver(observer) {\n this.observers = this.observers.filter(function (x) {\n return x !== observer;\n });\n };\n\n _proto.cancel = function cancel() {\n if (this.retryer) {\n this.retryer.cancel();\n return this.retryer.promise.then(noop).catch(noop);\n }\n\n return Promise.resolve();\n };\n\n _proto.continue = function _continue() {\n if (this.retryer) {\n this.retryer.continue();\n return this.retryer.promise;\n }\n\n return this.execute();\n };\n\n _proto.execute = function execute() {\n var _this = this;\n\n var data;\n var restored = this.state.status === 'loading';\n var promise = Promise.resolve();\n\n if (!restored) {\n this.dispatch({\n type: 'loading',\n variables: this.options.variables\n });\n promise = promise.then(function () {\n // Notify cache callback\n _this.mutationCache.config.onMutate == null ? void 0 : _this.mutationCache.config.onMutate(_this.state.variables, _this);\n }).then(function () {\n return _this.options.onMutate == null ? void 0 : _this.options.onMutate(_this.state.variables);\n }).then(function (context) {\n if (context !== _this.state.context) {\n _this.dispatch({\n type: 'loading',\n context: context,\n variables: _this.state.variables\n });\n }\n });\n }\n\n return promise.then(function () {\n return _this.executeMutation();\n }).then(function (result) {\n data = result; // Notify cache callback\n\n _this.mutationCache.config.onSuccess == null ? void 0 : _this.mutationCache.config.onSuccess(data, _this.state.variables, _this.state.context, _this);\n }).then(function () {\n return _this.options.onSuccess == null ? void 0 : _this.options.onSuccess(data, _this.state.variables, _this.state.context);\n }).then(function () {\n return _this.options.onSettled == null ? void 0 : _this.options.onSettled(data, null, _this.state.variables, _this.state.context);\n }).then(function () {\n _this.dispatch({\n type: 'success',\n data: data\n });\n\n return data;\n }).catch(function (error) {\n // Notify cache callback\n _this.mutationCache.config.onError == null ? void 0 : _this.mutationCache.config.onError(error, _this.state.variables, _this.state.context, _this); // Log error\n\n getLogger().error(error);\n return Promise.resolve().then(function () {\n return _this.options.onError == null ? void 0 : _this.options.onError(error, _this.state.variables, _this.state.context);\n }).then(function () {\n return _this.options.onSettled == null ? void 0 : _this.options.onSettled(undefined, error, _this.state.variables, _this.state.context);\n }).then(function () {\n _this.dispatch({\n type: 'error',\n error: error\n });\n\n throw error;\n });\n });\n };\n\n _proto.executeMutation = function executeMutation() {\n var _this2 = this,\n _this$options$retry;\n\n this.retryer = new Retryer({\n fn: function fn() {\n if (!_this2.options.mutationFn) {\n return Promise.reject('No mutationFn found');\n }\n\n return _this2.options.mutationFn(_this2.state.variables);\n },\n onFail: function onFail() {\n _this2.dispatch({\n type: 'failed'\n });\n },\n onPause: function onPause() {\n _this2.dispatch({\n type: 'pause'\n });\n },\n onContinue: function onContinue() {\n _this2.dispatch({\n type: 'continue'\n });\n },\n retry: (_this$options$retry = this.options.retry) != null ? _this$options$retry : 0,\n retryDelay: this.options.retryDelay\n });\n return this.retryer.promise;\n };\n\n _proto.dispatch = function dispatch(action) {\n var _this3 = this;\n\n this.state = reducer(this.state, action);\n notifyManager.batch(function () {\n _this3.observers.forEach(function (observer) {\n observer.onMutationUpdate(action);\n });\n\n _this3.mutationCache.notify(_this3);\n });\n };\n\n return Mutation;\n}();\nexport function getDefaultState() {\n return {\n context: undefined,\n data: undefined,\n error: null,\n failureCount: 0,\n isPaused: false,\n status: 'idle',\n variables: undefined\n };\n}\n\nfunction reducer(state, action) {\n switch (action.type) {\n case 'failed':\n return _extends({}, state, {\n failureCount: state.failureCount + 1\n });\n\n case 'pause':\n return _extends({}, state, {\n isPaused: true\n });\n\n case 'continue':\n return _extends({}, state, {\n isPaused: false\n });\n\n case 'loading':\n return _extends({}, state, {\n context: action.context,\n data: undefined,\n error: null,\n isPaused: false,\n status: 'loading',\n variables: action.variables\n });\n\n case 'success':\n return _extends({}, state, {\n data: action.data,\n error: null,\n status: 'success',\n isPaused: false\n });\n\n case 'error':\n return _extends({}, state, {\n data: undefined,\n error: action.error,\n failureCount: state.failureCount + 1,\n isPaused: false,\n status: 'error'\n });\n\n case 'setState':\n return _extends({}, state, action.state);\n\n default:\n return state;\n }\n}","import { scheduleMicrotask } from './utils'; // TYPES\n\n// CLASS\nexport var NotifyManager = /*#__PURE__*/function () {\n function NotifyManager() {\n this.queue = [];\n this.transactions = 0;\n\n this.notifyFn = function (callback) {\n callback();\n };\n\n this.batchNotifyFn = function (callback) {\n callback();\n };\n }\n\n var _proto = NotifyManager.prototype;\n\n _proto.batch = function batch(callback) {\n var result;\n this.transactions++;\n\n try {\n result = callback();\n } finally {\n this.transactions--;\n\n if (!this.transactions) {\n this.flush();\n }\n }\n\n return result;\n };\n\n _proto.schedule = function schedule(callback) {\n var _this = this;\n\n if (this.transactions) {\n this.queue.push(callback);\n } else {\n scheduleMicrotask(function () {\n _this.notifyFn(callback);\n });\n }\n }\n /**\n * All calls to the wrapped function will be batched.\n */\n ;\n\n _proto.batchCalls = function batchCalls(callback) {\n var _this2 = this;\n\n return function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this2.schedule(function () {\n callback.apply(void 0, args);\n });\n };\n };\n\n _proto.flush = function flush() {\n var _this3 = this;\n\n var queue = this.queue;\n this.queue = [];\n\n if (queue.length) {\n scheduleMicrotask(function () {\n _this3.batchNotifyFn(function () {\n queue.forEach(function (callback) {\n _this3.notifyFn(callback);\n });\n });\n });\n }\n }\n /**\n * Use this method to set a custom notify function.\n * This can be used to for example wrap notifications with `React.act` while running tests.\n */\n ;\n\n _proto.setNotifyFunction = function setNotifyFunction(fn) {\n this.notifyFn = fn;\n }\n /**\n * Use this method to set a custom function to batch notifications together into a single tick.\n * By default React Query will use the batch function provided by ReactDOM or React Native.\n */\n ;\n\n _proto.setBatchNotifyFunction = function setBatchNotifyFunction(fn) {\n this.batchNotifyFn = fn;\n };\n\n return NotifyManager;\n}(); // SINGLETON\n\nexport var notifyManager = new NotifyManager();","import _inheritsLoose from \"@babel/runtime/helpers/esm/inheritsLoose\";\nimport { Subscribable } from './subscribable';\nimport { isServer } from './utils';\nexport var OnlineManager = /*#__PURE__*/function (_Subscribable) {\n _inheritsLoose(OnlineManager, _Subscribable);\n\n function OnlineManager() {\n var _this;\n\n _this = _Subscribable.call(this) || this;\n\n _this.setup = function (onOnline) {\n var _window;\n\n if (!isServer && ((_window = window) == null ? void 0 : _window.addEventListener)) {\n var listener = function listener() {\n return onOnline();\n }; // Listen to online\n\n\n window.addEventListener('online', listener, false);\n window.addEventListener('offline', listener, false);\n return function () {\n // Be sure to unsubscribe if a new handler is set\n window.removeEventListener('online', listener);\n window.removeEventListener('offline', listener);\n };\n }\n };\n\n return _this;\n }\n\n var _proto = OnlineManager.prototype;\n\n _proto.onSubscribe = function onSubscribe() {\n if (!this.cleanup) {\n this.setEventListener(this.setup);\n }\n };\n\n _proto.onUnsubscribe = function onUnsubscribe() {\n if (!this.hasListeners()) {\n var _this$cleanup;\n\n (_this$cleanup = this.cleanup) == null ? void 0 : _this$cleanup.call(this);\n this.cleanup = undefined;\n }\n };\n\n _proto.setEventListener = function setEventListener(setup) {\n var _this$cleanup2,\n _this2 = this;\n\n this.setup = setup;\n (_this$cleanup2 = this.cleanup) == null ? void 0 : _this$cleanup2.call(this);\n this.cleanup = setup(function (online) {\n if (typeof online === 'boolean') {\n _this2.setOnline(online);\n } else {\n _this2.onOnline();\n }\n });\n };\n\n _proto.setOnline = function setOnline(online) {\n this.online = online;\n\n if (online) {\n this.onOnline();\n }\n };\n\n _proto.onOnline = function onOnline() {\n this.listeners.forEach(function (listener) {\n listener();\n });\n };\n\n _proto.isOnline = function isOnline() {\n if (typeof this.online === 'boolean') {\n return this.online;\n }\n\n if (typeof navigator === 'undefined' || typeof navigator.onLine === 'undefined') {\n return true;\n }\n\n return navigator.onLine;\n };\n\n return OnlineManager;\n}(Subscribable);\nexport var onlineManager = new OnlineManager();","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport { getAbortController, functionalUpdate, isValidTimeout, noop, replaceEqualDeep, timeUntilStale, ensureQueryKeyArray } from './utils';\nimport { notifyManager } from './notifyManager';\nimport { getLogger } from './logger';\nimport { Retryer, isCancelledError } from './retryer'; // TYPES\n\n// CLASS\nexport var Query = /*#__PURE__*/function () {\n function Query(config) {\n this.abortSignalConsumed = false;\n this.hadObservers = false;\n this.defaultOptions = config.defaultOptions;\n this.setOptions(config.options);\n this.observers = [];\n this.cache = config.cache;\n this.queryKey = config.queryKey;\n this.queryHash = config.queryHash;\n this.initialState = config.state || this.getDefaultState(this.options);\n this.state = this.initialState;\n this.meta = config.meta;\n this.scheduleGc();\n }\n\n var _proto = Query.prototype;\n\n _proto.setOptions = function setOptions(options) {\n var _this$options$cacheTi;\n\n this.options = _extends({}, this.defaultOptions, options);\n this.meta = options == null ? void 0 : options.meta; // Default to 5 minutes if not cache time is set\n\n this.cacheTime = Math.max(this.cacheTime || 0, (_this$options$cacheTi = this.options.cacheTime) != null ? _this$options$cacheTi : 5 * 60 * 1000);\n };\n\n _proto.setDefaultOptions = function setDefaultOptions(options) {\n this.defaultOptions = options;\n };\n\n _proto.scheduleGc = function scheduleGc() {\n var _this = this;\n\n this.clearGcTimeout();\n\n if (isValidTimeout(this.cacheTime)) {\n this.gcTimeout = setTimeout(function () {\n _this.optionalRemove();\n }, this.cacheTime);\n }\n };\n\n _proto.clearGcTimeout = function clearGcTimeout() {\n if (this.gcTimeout) {\n clearTimeout(this.gcTimeout);\n this.gcTimeout = undefined;\n }\n };\n\n _proto.optionalRemove = function optionalRemove() {\n if (!this.observers.length) {\n if (this.state.isFetching) {\n if (this.hadObservers) {\n this.scheduleGc();\n }\n } else {\n this.cache.remove(this);\n }\n }\n };\n\n _proto.setData = function setData(updater, options) {\n var _this$options$isDataE, _this$options;\n\n var prevData = this.state.data; // Get the new data\n\n var data = functionalUpdate(updater, prevData); // Use prev data if an isDataEqual function is defined and returns `true`\n\n if ((_this$options$isDataE = (_this$options = this.options).isDataEqual) == null ? void 0 : _this$options$isDataE.call(_this$options, prevData, data)) {\n data = prevData;\n } else if (this.options.structuralSharing !== false) {\n // Structurally share data between prev and new data if needed\n data = replaceEqualDeep(prevData, data);\n } // Set data and mark it as cached\n\n\n this.dispatch({\n data: data,\n type: 'success',\n dataUpdatedAt: options == null ? void 0 : options.updatedAt\n });\n return data;\n };\n\n _proto.setState = function setState(state, setStateOptions) {\n this.dispatch({\n type: 'setState',\n state: state,\n setStateOptions: setStateOptions\n });\n };\n\n _proto.cancel = function cancel(options) {\n var _this$retryer;\n\n var promise = this.promise;\n (_this$retryer = this.retryer) == null ? void 0 : _this$retryer.cancel(options);\n return promise ? promise.then(noop).catch(noop) : Promise.resolve();\n };\n\n _proto.destroy = function destroy() {\n this.clearGcTimeout();\n this.cancel({\n silent: true\n });\n };\n\n _proto.reset = function reset() {\n this.destroy();\n this.setState(this.initialState);\n };\n\n _proto.isActive = function isActive() {\n return this.observers.some(function (observer) {\n return observer.options.enabled !== false;\n });\n };\n\n _proto.isFetching = function isFetching() {\n return this.state.isFetching;\n };\n\n _proto.isStale = function isStale() {\n return this.state.isInvalidated || !this.state.dataUpdatedAt || this.observers.some(function (observer) {\n return observer.getCurrentResult().isStale;\n });\n };\n\n _proto.isStaleByTime = function isStaleByTime(staleTime) {\n if (staleTime === void 0) {\n staleTime = 0;\n }\n\n return this.state.isInvalidated || !this.state.dataUpdatedAt || !timeUntilStale(this.state.dataUpdatedAt, staleTime);\n };\n\n _proto.onFocus = function onFocus() {\n var _this$retryer2;\n\n var observer = this.observers.find(function (x) {\n return x.shouldFetchOnWindowFocus();\n });\n\n if (observer) {\n observer.refetch();\n } // Continue fetch if currently paused\n\n\n (_this$retryer2 = this.retryer) == null ? void 0 : _this$retryer2.continue();\n };\n\n _proto.onOnline = function onOnline() {\n var _this$retryer3;\n\n var observer = this.observers.find(function (x) {\n return x.shouldFetchOnReconnect();\n });\n\n if (observer) {\n observer.refetch();\n } // Continue fetch if currently paused\n\n\n (_this$retryer3 = this.retryer) == null ? void 0 : _this$retryer3.continue();\n };\n\n _proto.addObserver = function addObserver(observer) {\n if (this.observers.indexOf(observer) === -1) {\n this.observers.push(observer);\n this.hadObservers = true; // Stop the query from being garbage collected\n\n this.clearGcTimeout();\n this.cache.notify({\n type: 'observerAdded',\n query: this,\n observer: observer\n });\n }\n };\n\n _proto.removeObserver = function removeObserver(observer) {\n if (this.observers.indexOf(observer) !== -1) {\n this.observers = this.observers.filter(function (x) {\n return x !== observer;\n });\n\n if (!this.observers.length) {\n // If the transport layer does not support cancellation\n // we'll let the query continue so the result can be cached\n if (this.retryer) {\n if (this.retryer.isTransportCancelable || this.abortSignalConsumed) {\n this.retryer.cancel({\n revert: true\n });\n } else {\n this.retryer.cancelRetry();\n }\n }\n\n if (this.cacheTime) {\n this.scheduleGc();\n } else {\n this.cache.remove(this);\n }\n }\n\n this.cache.notify({\n type: 'observerRemoved',\n query: this,\n observer: observer\n });\n }\n };\n\n _proto.getObserversCount = function getObserversCount() {\n return this.observers.length;\n };\n\n _proto.invalidate = function invalidate() {\n if (!this.state.isInvalidated) {\n this.dispatch({\n type: 'invalidate'\n });\n }\n };\n\n _proto.fetch = function fetch(options, fetchOptions) {\n var _this2 = this,\n _this$options$behavio,\n _context$fetchOptions,\n _abortController$abor;\n\n if (this.state.isFetching) {\n if (this.state.dataUpdatedAt && (fetchOptions == null ? void 0 : fetchOptions.cancelRefetch)) {\n // Silently cancel current fetch if the user wants to cancel refetches\n this.cancel({\n silent: true\n });\n } else if (this.promise) {\n var _this$retryer4;\n\n // make sure that retries that were potentially cancelled due to unmounts can continue\n (_this$retryer4 = this.retryer) == null ? void 0 : _this$retryer4.continueRetry(); // Return current promise if we are already fetching\n\n return this.promise;\n }\n } // Update config if passed, otherwise the config from the last execution is used\n\n\n if (options) {\n this.setOptions(options);\n } // Use the options from the first observer with a query function if no function is found.\n // This can happen when the query is hydrated or created with setQueryData.\n\n\n if (!this.options.queryFn) {\n var observer = this.observers.find(function (x) {\n return x.options.queryFn;\n });\n\n if (observer) {\n this.setOptions(observer.options);\n }\n }\n\n var queryKey = ensureQueryKeyArray(this.queryKey);\n var abortController = getAbortController(); // Create query function context\n\n var queryFnContext = {\n queryKey: queryKey,\n pageParam: undefined,\n meta: this.meta\n };\n Object.defineProperty(queryFnContext, 'signal', {\n enumerable: true,\n get: function get() {\n if (abortController) {\n _this2.abortSignalConsumed = true;\n return abortController.signal;\n }\n\n return undefined;\n }\n }); // Create fetch function\n\n var fetchFn = function fetchFn() {\n if (!_this2.options.queryFn) {\n return Promise.reject('Missing queryFn');\n }\n\n _this2.abortSignalConsumed = false;\n return _this2.options.queryFn(queryFnContext);\n }; // Trigger behavior hook\n\n\n var context = {\n fetchOptions: fetchOptions,\n options: this.options,\n queryKey: queryKey,\n state: this.state,\n fetchFn: fetchFn,\n meta: this.meta\n };\n\n if ((_this$options$behavio = this.options.behavior) == null ? void 0 : _this$options$behavio.onFetch) {\n var _this$options$behavio2;\n\n (_this$options$behavio2 = this.options.behavior) == null ? void 0 : _this$options$behavio2.onFetch(context);\n } // Store state in case the current fetch needs to be reverted\n\n\n this.revertState = this.state; // Set to fetching state if not already in it\n\n if (!this.state.isFetching || this.state.fetchMeta !== ((_context$fetchOptions = context.fetchOptions) == null ? void 0 : _context$fetchOptions.meta)) {\n var _context$fetchOptions2;\n\n this.dispatch({\n type: 'fetch',\n meta: (_context$fetchOptions2 = context.fetchOptions) == null ? void 0 : _context$fetchOptions2.meta\n });\n } // Try to fetch the data\n\n\n this.retryer = new Retryer({\n fn: context.fetchFn,\n abort: abortController == null ? void 0 : (_abortController$abor = abortController.abort) == null ? void 0 : _abortController$abor.bind(abortController),\n onSuccess: function onSuccess(data) {\n _this2.setData(data); // Notify cache callback\n\n\n _this2.cache.config.onSuccess == null ? void 0 : _this2.cache.config.onSuccess(data, _this2); // Remove query after fetching if cache time is 0\n\n if (_this2.cacheTime === 0) {\n _this2.optionalRemove();\n }\n },\n onError: function onError(error) {\n // Optimistically update state if needed\n if (!(isCancelledError(error) && error.silent)) {\n _this2.dispatch({\n type: 'error',\n error: error\n });\n }\n\n if (!isCancelledError(error)) {\n // Notify cache callback\n _this2.cache.config.onError == null ? void 0 : _this2.cache.config.onError(error, _this2); // Log error\n\n getLogger().error(error);\n } // Remove query after fetching if cache time is 0\n\n\n if (_this2.cacheTime === 0) {\n _this2.optionalRemove();\n }\n },\n onFail: function onFail() {\n _this2.dispatch({\n type: 'failed'\n });\n },\n onPause: function onPause() {\n _this2.dispatch({\n type: 'pause'\n });\n },\n onContinue: function onContinue() {\n _this2.dispatch({\n type: 'continue'\n });\n },\n retry: context.options.retry,\n retryDelay: context.options.retryDelay\n });\n this.promise = this.retryer.promise;\n return this.promise;\n };\n\n _proto.dispatch = function dispatch(action) {\n var _this3 = this;\n\n this.state = this.reducer(this.state, action);\n notifyManager.batch(function () {\n _this3.observers.forEach(function (observer) {\n observer.onQueryUpdate(action);\n });\n\n _this3.cache.notify({\n query: _this3,\n type: 'queryUpdated',\n action: action\n });\n });\n };\n\n _proto.getDefaultState = function getDefaultState(options) {\n var data = typeof options.initialData === 'function' ? options.initialData() : options.initialData;\n var hasInitialData = typeof options.initialData !== 'undefined';\n var initialDataUpdatedAt = hasInitialData ? typeof options.initialDataUpdatedAt === 'function' ? options.initialDataUpdatedAt() : options.initialDataUpdatedAt : 0;\n var hasData = typeof data !== 'undefined';\n return {\n data: data,\n dataUpdateCount: 0,\n dataUpdatedAt: hasData ? initialDataUpdatedAt != null ? initialDataUpdatedAt : Date.now() : 0,\n error: null,\n errorUpdateCount: 0,\n errorUpdatedAt: 0,\n fetchFailureCount: 0,\n fetchMeta: null,\n isFetching: false,\n isInvalidated: false,\n isPaused: false,\n status: hasData ? 'success' : 'idle'\n };\n };\n\n _proto.reducer = function reducer(state, action) {\n var _action$meta, _action$dataUpdatedAt;\n\n switch (action.type) {\n case 'failed':\n return _extends({}, state, {\n fetchFailureCount: state.fetchFailureCount + 1\n });\n\n case 'pause':\n return _extends({}, state, {\n isPaused: true\n });\n\n case 'continue':\n return _extends({}, state, {\n isPaused: false\n });\n\n case 'fetch':\n return _extends({}, state, {\n fetchFailureCount: 0,\n fetchMeta: (_action$meta = action.meta) != null ? _action$meta : null,\n isFetching: true,\n isPaused: false\n }, !state.dataUpdatedAt && {\n error: null,\n status: 'loading'\n });\n\n case 'success':\n return _extends({}, state, {\n data: action.data,\n dataUpdateCount: state.dataUpdateCount + 1,\n dataUpdatedAt: (_action$dataUpdatedAt = action.dataUpdatedAt) != null ? _action$dataUpdatedAt : Date.now(),\n error: null,\n fetchFailureCount: 0,\n isFetching: false,\n isInvalidated: false,\n isPaused: false,\n status: 'success'\n });\n\n case 'error':\n var error = action.error;\n\n if (isCancelledError(error) && error.revert && this.revertState) {\n return _extends({}, this.revertState);\n }\n\n return _extends({}, state, {\n error: error,\n errorUpdateCount: state.errorUpdateCount + 1,\n errorUpdatedAt: Date.now(),\n fetchFailureCount: state.fetchFailureCount + 1,\n isFetching: false,\n isPaused: false,\n status: 'error'\n });\n\n case 'invalidate':\n return _extends({}, state, {\n isInvalidated: true\n });\n\n case 'setState':\n return _extends({}, state, action.state);\n\n default:\n return state;\n }\n };\n\n return Query;\n}();","import _inheritsLoose from \"@babel/runtime/helpers/esm/inheritsLoose\";\nimport { hashQueryKeyByOptions, matchQuery, parseFilterArgs } from './utils';\nimport { Query } from './query';\nimport { notifyManager } from './notifyManager';\nimport { Subscribable } from './subscribable';\n// CLASS\nexport var QueryCache = /*#__PURE__*/function (_Subscribable) {\n _inheritsLoose(QueryCache, _Subscribable);\n\n function QueryCache(config) {\n var _this;\n\n _this = _Subscribable.call(this) || this;\n _this.config = config || {};\n _this.queries = [];\n _this.queriesMap = {};\n return _this;\n }\n\n var _proto = QueryCache.prototype;\n\n _proto.build = function build(client, options, state) {\n var _options$queryHash;\n\n var queryKey = options.queryKey;\n var queryHash = (_options$queryHash = options.queryHash) != null ? _options$queryHash : hashQueryKeyByOptions(queryKey, options);\n var query = this.get(queryHash);\n\n if (!query) {\n query = new Query({\n cache: this,\n queryKey: queryKey,\n queryHash: queryHash,\n options: client.defaultQueryOptions(options),\n state: state,\n defaultOptions: client.getQueryDefaults(queryKey),\n meta: options.meta\n });\n this.add(query);\n }\n\n return query;\n };\n\n _proto.add = function add(query) {\n if (!this.queriesMap[query.queryHash]) {\n this.queriesMap[query.queryHash] = query;\n this.queries.push(query);\n this.notify({\n type: 'queryAdded',\n query: query\n });\n }\n };\n\n _proto.remove = function remove(query) {\n var queryInMap = this.queriesMap[query.queryHash];\n\n if (queryInMap) {\n query.destroy();\n this.queries = this.queries.filter(function (x) {\n return x !== query;\n });\n\n if (queryInMap === query) {\n delete this.queriesMap[query.queryHash];\n }\n\n this.notify({\n type: 'queryRemoved',\n query: query\n });\n }\n };\n\n _proto.clear = function clear() {\n var _this2 = this;\n\n notifyManager.batch(function () {\n _this2.queries.forEach(function (query) {\n _this2.remove(query);\n });\n });\n };\n\n _proto.get = function get(queryHash) {\n return this.queriesMap[queryHash];\n };\n\n _proto.getAll = function getAll() {\n return this.queries;\n };\n\n _proto.find = function find(arg1, arg2) {\n var _parseFilterArgs = parseFilterArgs(arg1, arg2),\n filters = _parseFilterArgs[0];\n\n if (typeof filters.exact === 'undefined') {\n filters.exact = true;\n }\n\n return this.queries.find(function (query) {\n return matchQuery(filters, query);\n });\n };\n\n _proto.findAll = function findAll(arg1, arg2) {\n var _parseFilterArgs2 = parseFilterArgs(arg1, arg2),\n filters = _parseFilterArgs2[0];\n\n return Object.keys(filters).length > 0 ? this.queries.filter(function (query) {\n return matchQuery(filters, query);\n }) : this.queries;\n };\n\n _proto.notify = function notify(event) {\n var _this3 = this;\n\n notifyManager.batch(function () {\n _this3.listeners.forEach(function (listener) {\n listener(event);\n });\n });\n };\n\n _proto.onFocus = function onFocus() {\n var _this4 = this;\n\n notifyManager.batch(function () {\n _this4.queries.forEach(function (query) {\n query.onFocus();\n });\n });\n };\n\n _proto.onOnline = function onOnline() {\n var _this5 = this;\n\n notifyManager.batch(function () {\n _this5.queries.forEach(function (query) {\n query.onOnline();\n });\n });\n };\n\n return QueryCache;\n}(Subscribable);","import _inheritsLoose from \"@babel/runtime/helpers/esm/inheritsLoose\";\nimport { notifyManager } from './notifyManager';\nimport { Mutation } from './mutation';\nimport { matchMutation, noop } from './utils';\nimport { Subscribable } from './subscribable'; // TYPES\n\n// CLASS\nexport var MutationCache = /*#__PURE__*/function (_Subscribable) {\n _inheritsLoose(MutationCache, _Subscribable);\n\n function MutationCache(config) {\n var _this;\n\n _this = _Subscribable.call(this) || this;\n _this.config = config || {};\n _this.mutations = [];\n _this.mutationId = 0;\n return _this;\n }\n\n var _proto = MutationCache.prototype;\n\n _proto.build = function build(client, options, state) {\n var mutation = new Mutation({\n mutationCache: this,\n mutationId: ++this.mutationId,\n options: client.defaultMutationOptions(options),\n state: state,\n defaultOptions: options.mutationKey ? client.getMutationDefaults(options.mutationKey) : undefined,\n meta: options.meta\n });\n this.add(mutation);\n return mutation;\n };\n\n _proto.add = function add(mutation) {\n this.mutations.push(mutation);\n this.notify(mutation);\n };\n\n _proto.remove = function remove(mutation) {\n this.mutations = this.mutations.filter(function (x) {\n return x !== mutation;\n });\n mutation.cancel();\n this.notify(mutation);\n };\n\n _proto.clear = function clear() {\n var _this2 = this;\n\n notifyManager.batch(function () {\n _this2.mutations.forEach(function (mutation) {\n _this2.remove(mutation);\n });\n });\n };\n\n _proto.getAll = function getAll() {\n return this.mutations;\n };\n\n _proto.find = function find(filters) {\n if (typeof filters.exact === 'undefined') {\n filters.exact = true;\n }\n\n return this.mutations.find(function (mutation) {\n return matchMutation(filters, mutation);\n });\n };\n\n _proto.findAll = function findAll(filters) {\n return this.mutations.filter(function (mutation) {\n return matchMutation(filters, mutation);\n });\n };\n\n _proto.notify = function notify(mutation) {\n var _this3 = this;\n\n notifyManager.batch(function () {\n _this3.listeners.forEach(function (listener) {\n listener(mutation);\n });\n });\n };\n\n _proto.onFocus = function onFocus() {\n this.resumePausedMutations();\n };\n\n _proto.onOnline = function onOnline() {\n this.resumePausedMutations();\n };\n\n _proto.resumePausedMutations = function resumePausedMutations() {\n var pausedMutations = this.mutations.filter(function (x) {\n return x.state.isPaused;\n });\n return notifyManager.batch(function () {\n return pausedMutations.reduce(function (promise, mutation) {\n return promise.then(function () {\n return mutation.continue().catch(noop);\n });\n }, Promise.resolve());\n });\n };\n\n return MutationCache;\n}(Subscribable);","import { isCancelable } from './retryer';\nimport { getAbortController } from './utils';\nexport function infiniteQueryBehavior() {\n return {\n onFetch: function onFetch(context) {\n context.fetchFn = function () {\n var _context$fetchOptions, _context$fetchOptions2, _context$fetchOptions3, _context$fetchOptions4, _context$state$data, _context$state$data2;\n\n var refetchPage = (_context$fetchOptions = context.fetchOptions) == null ? void 0 : (_context$fetchOptions2 = _context$fetchOptions.meta) == null ? void 0 : _context$fetchOptions2.refetchPage;\n var fetchMore = (_context$fetchOptions3 = context.fetchOptions) == null ? void 0 : (_context$fetchOptions4 = _context$fetchOptions3.meta) == null ? void 0 : _context$fetchOptions4.fetchMore;\n var pageParam = fetchMore == null ? void 0 : fetchMore.pageParam;\n var isFetchingNextPage = (fetchMore == null ? void 0 : fetchMore.direction) === 'forward';\n var isFetchingPreviousPage = (fetchMore == null ? void 0 : fetchMore.direction) === 'backward';\n var oldPages = ((_context$state$data = context.state.data) == null ? void 0 : _context$state$data.pages) || [];\n var oldPageParams = ((_context$state$data2 = context.state.data) == null ? void 0 : _context$state$data2.pageParams) || [];\n var abortController = getAbortController();\n var abortSignal = abortController == null ? void 0 : abortController.signal;\n var newPageParams = oldPageParams;\n var cancelled = false; // Get query function\n\n var queryFn = context.options.queryFn || function () {\n return Promise.reject('Missing queryFn');\n };\n\n var buildNewPages = function buildNewPages(pages, param, page, previous) {\n newPageParams = previous ? [param].concat(newPageParams) : [].concat(newPageParams, [param]);\n return previous ? [page].concat(pages) : [].concat(pages, [page]);\n }; // Create function to fetch a page\n\n\n var fetchPage = function fetchPage(pages, manual, param, previous) {\n if (cancelled) {\n return Promise.reject('Cancelled');\n }\n\n if (typeof param === 'undefined' && !manual && pages.length) {\n return Promise.resolve(pages);\n }\n\n var queryFnContext = {\n queryKey: context.queryKey,\n signal: abortSignal,\n pageParam: param,\n meta: context.meta\n };\n var queryFnResult = queryFn(queryFnContext);\n var promise = Promise.resolve(queryFnResult).then(function (page) {\n return buildNewPages(pages, param, page, previous);\n });\n\n if (isCancelable(queryFnResult)) {\n var promiseAsAny = promise;\n promiseAsAny.cancel = queryFnResult.cancel;\n }\n\n return promise;\n };\n\n var promise; // Fetch first page?\n\n if (!oldPages.length) {\n promise = fetchPage([]);\n } // Fetch next page?\n else if (isFetchingNextPage) {\n var manual = typeof pageParam !== 'undefined';\n var param = manual ? pageParam : getNextPageParam(context.options, oldPages);\n promise = fetchPage(oldPages, manual, param);\n } // Fetch previous page?\n else if (isFetchingPreviousPage) {\n var _manual = typeof pageParam !== 'undefined';\n\n var _param = _manual ? pageParam : getPreviousPageParam(context.options, oldPages);\n\n promise = fetchPage(oldPages, _manual, _param, true);\n } // Refetch pages\n else {\n (function () {\n newPageParams = [];\n var manual = typeof context.options.getNextPageParam === 'undefined';\n var shouldFetchFirstPage = refetchPage && oldPages[0] ? refetchPage(oldPages[0], 0, oldPages) : true; // Fetch first page\n\n promise = shouldFetchFirstPage ? fetchPage([], manual, oldPageParams[0]) : Promise.resolve(buildNewPages([], oldPageParams[0], oldPages[0])); // Fetch remaining pages\n\n var _loop = function _loop(i) {\n promise = promise.then(function (pages) {\n var shouldFetchNextPage = refetchPage && oldPages[i] ? refetchPage(oldPages[i], i, oldPages) : true;\n\n if (shouldFetchNextPage) {\n var _param2 = manual ? oldPageParams[i] : getNextPageParam(context.options, pages);\n\n return fetchPage(pages, manual, _param2);\n }\n\n return Promise.resolve(buildNewPages(pages, oldPageParams[i], oldPages[i]));\n });\n };\n\n for (var i = 1; i < oldPages.length; i++) {\n _loop(i);\n }\n })();\n }\n\n var finalPromise = promise.then(function (pages) {\n return {\n pages: pages,\n pageParams: newPageParams\n };\n });\n var finalPromiseAsAny = finalPromise;\n\n finalPromiseAsAny.cancel = function () {\n cancelled = true;\n abortController == null ? void 0 : abortController.abort();\n\n if (isCancelable(promise)) {\n promise.cancel();\n }\n };\n\n return finalPromise;\n };\n }\n };\n}\nexport function getNextPageParam(options, pages) {\n return options.getNextPageParam == null ? void 0 : options.getNextPageParam(pages[pages.length - 1], pages);\n}\nexport function getPreviousPageParam(options, pages) {\n return options.getPreviousPageParam == null ? void 0 : options.getPreviousPageParam(pages[0], pages);\n}\n/**\n * Checks if there is a next page.\n * Returns `undefined` if it cannot be determined.\n */\n\nexport function hasNextPage(options, pages) {\n if (options.getNextPageParam && Array.isArray(pages)) {\n var nextPageParam = getNextPageParam(options, pages);\n return typeof nextPageParam !== 'undefined' && nextPageParam !== null && nextPageParam !== false;\n }\n}\n/**\n * Checks if there is a previous page.\n * Returns `undefined` if it cannot be determined.\n */\n\nexport function hasPreviousPage(options, pages) {\n if (options.getPreviousPageParam && Array.isArray(pages)) {\n var previousPageParam = getPreviousPageParam(options, pages);\n return typeof previousPageParam !== 'undefined' && previousPageParam !== null && previousPageParam !== false;\n }\n}","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport { hashQueryKey, noop, parseFilterArgs, parseQueryArgs, partialMatchKey, hashQueryKeyByOptions } from './utils';\nimport { QueryCache } from './queryCache';\nimport { MutationCache } from './mutationCache';\nimport { focusManager } from './focusManager';\nimport { onlineManager } from './onlineManager';\nimport { notifyManager } from './notifyManager';\nimport { infiniteQueryBehavior } from './infiniteQueryBehavior';\n// CLASS\nexport var QueryClient = /*#__PURE__*/function () {\n function QueryClient(config) {\n if (config === void 0) {\n config = {};\n }\n\n this.queryCache = config.queryCache || new QueryCache();\n this.mutationCache = config.mutationCache || new MutationCache();\n this.defaultOptions = config.defaultOptions || {};\n this.queryDefaults = [];\n this.mutationDefaults = [];\n }\n\n var _proto = QueryClient.prototype;\n\n _proto.mount = function mount() {\n var _this = this;\n\n this.unsubscribeFocus = focusManager.subscribe(function () {\n if (focusManager.isFocused() && onlineManager.isOnline()) {\n _this.mutationCache.onFocus();\n\n _this.queryCache.onFocus();\n }\n });\n this.unsubscribeOnline = onlineManager.subscribe(function () {\n if (focusManager.isFocused() && onlineManager.isOnline()) {\n _this.mutationCache.onOnline();\n\n _this.queryCache.onOnline();\n }\n });\n };\n\n _proto.unmount = function unmount() {\n var _this$unsubscribeFocu, _this$unsubscribeOnli;\n\n (_this$unsubscribeFocu = this.unsubscribeFocus) == null ? void 0 : _this$unsubscribeFocu.call(this);\n (_this$unsubscribeOnli = this.unsubscribeOnline) == null ? void 0 : _this$unsubscribeOnli.call(this);\n };\n\n _proto.isFetching = function isFetching(arg1, arg2) {\n var _parseFilterArgs = parseFilterArgs(arg1, arg2),\n filters = _parseFilterArgs[0];\n\n filters.fetching = true;\n return this.queryCache.findAll(filters).length;\n };\n\n _proto.isMutating = function isMutating(filters) {\n return this.mutationCache.findAll(_extends({}, filters, {\n fetching: true\n })).length;\n };\n\n _proto.getQueryData = function getQueryData(queryKey, filters) {\n var _this$queryCache$find;\n\n return (_this$queryCache$find = this.queryCache.find(queryKey, filters)) == null ? void 0 : _this$queryCache$find.state.data;\n };\n\n _proto.getQueriesData = function getQueriesData(queryKeyOrFilters) {\n return this.getQueryCache().findAll(queryKeyOrFilters).map(function (_ref) {\n var queryKey = _ref.queryKey,\n state = _ref.state;\n var data = state.data;\n return [queryKey, data];\n });\n };\n\n _proto.setQueryData = function setQueryData(queryKey, updater, options) {\n var parsedOptions = parseQueryArgs(queryKey);\n var defaultedOptions = this.defaultQueryOptions(parsedOptions);\n return this.queryCache.build(this, defaultedOptions).setData(updater, options);\n };\n\n _proto.setQueriesData = function setQueriesData(queryKeyOrFilters, updater, options) {\n var _this2 = this;\n\n return notifyManager.batch(function () {\n return _this2.getQueryCache().findAll(queryKeyOrFilters).map(function (_ref2) {\n var queryKey = _ref2.queryKey;\n return [queryKey, _this2.setQueryData(queryKey, updater, options)];\n });\n });\n };\n\n _proto.getQueryState = function getQueryState(queryKey, filters) {\n var _this$queryCache$find2;\n\n return (_this$queryCache$find2 = this.queryCache.find(queryKey, filters)) == null ? void 0 : _this$queryCache$find2.state;\n };\n\n _proto.removeQueries = function removeQueries(arg1, arg2) {\n var _parseFilterArgs2 = parseFilterArgs(arg1, arg2),\n filters = _parseFilterArgs2[0];\n\n var queryCache = this.queryCache;\n notifyManager.batch(function () {\n queryCache.findAll(filters).forEach(function (query) {\n queryCache.remove(query);\n });\n });\n };\n\n _proto.resetQueries = function resetQueries(arg1, arg2, arg3) {\n var _this3 = this;\n\n var _parseFilterArgs3 = parseFilterArgs(arg1, arg2, arg3),\n filters = _parseFilterArgs3[0],\n options = _parseFilterArgs3[1];\n\n var queryCache = this.queryCache;\n\n var refetchFilters = _extends({}, filters, {\n active: true\n });\n\n return notifyManager.batch(function () {\n queryCache.findAll(filters).forEach(function (query) {\n query.reset();\n });\n return _this3.refetchQueries(refetchFilters, options);\n });\n };\n\n _proto.cancelQueries = function cancelQueries(arg1, arg2, arg3) {\n var _this4 = this;\n\n var _parseFilterArgs4 = parseFilterArgs(arg1, arg2, arg3),\n filters = _parseFilterArgs4[0],\n _parseFilterArgs4$ = _parseFilterArgs4[1],\n cancelOptions = _parseFilterArgs4$ === void 0 ? {} : _parseFilterArgs4$;\n\n if (typeof cancelOptions.revert === 'undefined') {\n cancelOptions.revert = true;\n }\n\n var promises = notifyManager.batch(function () {\n return _this4.queryCache.findAll(filters).map(function (query) {\n return query.cancel(cancelOptions);\n });\n });\n return Promise.all(promises).then(noop).catch(noop);\n };\n\n _proto.invalidateQueries = function invalidateQueries(arg1, arg2, arg3) {\n var _ref3,\n _filters$refetchActiv,\n _filters$refetchInact,\n _this5 = this;\n\n var _parseFilterArgs5 = parseFilterArgs(arg1, arg2, arg3),\n filters = _parseFilterArgs5[0],\n options = _parseFilterArgs5[1];\n\n var refetchFilters = _extends({}, filters, {\n // if filters.refetchActive is not provided and filters.active is explicitly false,\n // e.g. invalidateQueries({ active: false }), we don't want to refetch active queries\n active: (_ref3 = (_filters$refetchActiv = filters.refetchActive) != null ? _filters$refetchActiv : filters.active) != null ? _ref3 : true,\n inactive: (_filters$refetchInact = filters.refetchInactive) != null ? _filters$refetchInact : false\n });\n\n return notifyManager.batch(function () {\n _this5.queryCache.findAll(filters).forEach(function (query) {\n query.invalidate();\n });\n\n return _this5.refetchQueries(refetchFilters, options);\n });\n };\n\n _proto.refetchQueries = function refetchQueries(arg1, arg2, arg3) {\n var _this6 = this;\n\n var _parseFilterArgs6 = parseFilterArgs(arg1, arg2, arg3),\n filters = _parseFilterArgs6[0],\n options = _parseFilterArgs6[1];\n\n var promises = notifyManager.batch(function () {\n return _this6.queryCache.findAll(filters).map(function (query) {\n return query.fetch(undefined, _extends({}, options, {\n meta: {\n refetchPage: filters == null ? void 0 : filters.refetchPage\n }\n }));\n });\n });\n var promise = Promise.all(promises).then(noop);\n\n if (!(options == null ? void 0 : options.throwOnError)) {\n promise = promise.catch(noop);\n }\n\n return promise;\n };\n\n _proto.fetchQuery = function fetchQuery(arg1, arg2, arg3) {\n var parsedOptions = parseQueryArgs(arg1, arg2, arg3);\n var defaultedOptions = this.defaultQueryOptions(parsedOptions); // https://github.com/tannerlinsley/react-query/issues/652\n\n if (typeof defaultedOptions.retry === 'undefined') {\n defaultedOptions.retry = false;\n }\n\n var query = this.queryCache.build(this, defaultedOptions);\n return query.isStaleByTime(defaultedOptions.staleTime) ? query.fetch(defaultedOptions) : Promise.resolve(query.state.data);\n };\n\n _proto.prefetchQuery = function prefetchQuery(arg1, arg2, arg3) {\n return this.fetchQuery(arg1, arg2, arg3).then(noop).catch(noop);\n };\n\n _proto.fetchInfiniteQuery = function fetchInfiniteQuery(arg1, arg2, arg3) {\n var parsedOptions = parseQueryArgs(arg1, arg2, arg3);\n parsedOptions.behavior = infiniteQueryBehavior();\n return this.fetchQuery(parsedOptions);\n };\n\n _proto.prefetchInfiniteQuery = function prefetchInfiniteQuery(arg1, arg2, arg3) {\n return this.fetchInfiniteQuery(arg1, arg2, arg3).then(noop).catch(noop);\n };\n\n _proto.cancelMutations = function cancelMutations() {\n var _this7 = this;\n\n var promises = notifyManager.batch(function () {\n return _this7.mutationCache.getAll().map(function (mutation) {\n return mutation.cancel();\n });\n });\n return Promise.all(promises).then(noop).catch(noop);\n };\n\n _proto.resumePausedMutations = function resumePausedMutations() {\n return this.getMutationCache().resumePausedMutations();\n };\n\n _proto.executeMutation = function executeMutation(options) {\n return this.mutationCache.build(this, options).execute();\n };\n\n _proto.getQueryCache = function getQueryCache() {\n return this.queryCache;\n };\n\n _proto.getMutationCache = function getMutationCache() {\n return this.mutationCache;\n };\n\n _proto.getDefaultOptions = function getDefaultOptions() {\n return this.defaultOptions;\n };\n\n _proto.setDefaultOptions = function setDefaultOptions(options) {\n this.defaultOptions = options;\n };\n\n _proto.setQueryDefaults = function setQueryDefaults(queryKey, options) {\n var result = this.queryDefaults.find(function (x) {\n return hashQueryKey(queryKey) === hashQueryKey(x.queryKey);\n });\n\n if (result) {\n result.defaultOptions = options;\n } else {\n this.queryDefaults.push({\n queryKey: queryKey,\n defaultOptions: options\n });\n }\n };\n\n _proto.getQueryDefaults = function getQueryDefaults(queryKey) {\n var _this$queryDefaults$f;\n\n return queryKey ? (_this$queryDefaults$f = this.queryDefaults.find(function (x) {\n return partialMatchKey(queryKey, x.queryKey);\n })) == null ? void 0 : _this$queryDefaults$f.defaultOptions : undefined;\n };\n\n _proto.setMutationDefaults = function setMutationDefaults(mutationKey, options) {\n var result = this.mutationDefaults.find(function (x) {\n return hashQueryKey(mutationKey) === hashQueryKey(x.mutationKey);\n });\n\n if (result) {\n result.defaultOptions = options;\n } else {\n this.mutationDefaults.push({\n mutationKey: mutationKey,\n defaultOptions: options\n });\n }\n };\n\n _proto.getMutationDefaults = function getMutationDefaults(mutationKey) {\n var _this$mutationDefault;\n\n return mutationKey ? (_this$mutationDefault = this.mutationDefaults.find(function (x) {\n return partialMatchKey(mutationKey, x.mutationKey);\n })) == null ? void 0 : _this$mutationDefault.defaultOptions : undefined;\n };\n\n _proto.defaultQueryOptions = function defaultQueryOptions(options) {\n if (options == null ? void 0 : options._defaulted) {\n return options;\n }\n\n var defaultedOptions = _extends({}, this.defaultOptions.queries, this.getQueryDefaults(options == null ? void 0 : options.queryKey), options, {\n _defaulted: true\n });\n\n if (!defaultedOptions.queryHash && defaultedOptions.queryKey) {\n defaultedOptions.queryHash = hashQueryKeyByOptions(defaultedOptions.queryKey, defaultedOptions);\n }\n\n return defaultedOptions;\n };\n\n _proto.defaultQueryObserverOptions = function defaultQueryObserverOptions(options) {\n return this.defaultQueryOptions(options);\n };\n\n _proto.defaultMutationOptions = function defaultMutationOptions(options) {\n if (options == null ? void 0 : options._defaulted) {\n return options;\n }\n\n return _extends({}, this.defaultOptions.mutations, this.getMutationDefaults(options == null ? void 0 : options.mutationKey), options, {\n _defaulted: true\n });\n };\n\n _proto.clear = function clear() {\n this.queryCache.clear();\n this.mutationCache.clear();\n };\n\n return QueryClient;\n}();","import { focusManager } from './focusManager';\nimport { onlineManager } from './onlineManager';\nimport { sleep } from './utils';\n\nfunction defaultRetryDelay(failureCount) {\n return Math.min(1000 * Math.pow(2, failureCount), 30000);\n}\n\nexport function isCancelable(value) {\n return typeof (value == null ? void 0 : value.cancel) === 'function';\n}\nexport var CancelledError = function CancelledError(options) {\n this.revert = options == null ? void 0 : options.revert;\n this.silent = options == null ? void 0 : options.silent;\n};\nexport function isCancelledError(value) {\n return value instanceof CancelledError;\n} // CLASS\n\nexport var Retryer = function Retryer(config) {\n var _this = this;\n\n var cancelRetry = false;\n var cancelFn;\n var continueFn;\n var promiseResolve;\n var promiseReject;\n this.abort = config.abort;\n\n this.cancel = function (cancelOptions) {\n return cancelFn == null ? void 0 : cancelFn(cancelOptions);\n };\n\n this.cancelRetry = function () {\n cancelRetry = true;\n };\n\n this.continueRetry = function () {\n cancelRetry = false;\n };\n\n this.continue = function () {\n return continueFn == null ? void 0 : continueFn();\n };\n\n this.failureCount = 0;\n this.isPaused = false;\n this.isResolved = false;\n this.isTransportCancelable = false;\n this.promise = new Promise(function (outerResolve, outerReject) {\n promiseResolve = outerResolve;\n promiseReject = outerReject;\n });\n\n var resolve = function resolve(value) {\n if (!_this.isResolved) {\n _this.isResolved = true;\n config.onSuccess == null ? void 0 : config.onSuccess(value);\n continueFn == null ? void 0 : continueFn();\n promiseResolve(value);\n }\n };\n\n var reject = function reject(value) {\n if (!_this.isResolved) {\n _this.isResolved = true;\n config.onError == null ? void 0 : config.onError(value);\n continueFn == null ? void 0 : continueFn();\n promiseReject(value);\n }\n };\n\n var pause = function pause() {\n return new Promise(function (continueResolve) {\n continueFn = continueResolve;\n _this.isPaused = true;\n config.onPause == null ? void 0 : config.onPause();\n }).then(function () {\n continueFn = undefined;\n _this.isPaused = false;\n config.onContinue == null ? void 0 : config.onContinue();\n });\n }; // Create loop function\n\n\n var run = function run() {\n // Do nothing if already resolved\n if (_this.isResolved) {\n return;\n }\n\n var promiseOrValue; // Execute query\n\n try {\n promiseOrValue = config.fn();\n } catch (error) {\n promiseOrValue = Promise.reject(error);\n } // Create callback to cancel this fetch\n\n\n cancelFn = function cancelFn(cancelOptions) {\n if (!_this.isResolved) {\n reject(new CancelledError(cancelOptions));\n _this.abort == null ? void 0 : _this.abort(); // Cancel transport if supported\n\n if (isCancelable(promiseOrValue)) {\n try {\n promiseOrValue.cancel();\n } catch (_unused) {}\n }\n }\n }; // Check if the transport layer support cancellation\n\n\n _this.isTransportCancelable = isCancelable(promiseOrValue);\n Promise.resolve(promiseOrValue).then(resolve).catch(function (error) {\n var _config$retry, _config$retryDelay;\n\n // Stop if the fetch is already resolved\n if (_this.isResolved) {\n return;\n } // Do we need to retry the request?\n\n\n var retry = (_config$retry = config.retry) != null ? _config$retry : 3;\n var retryDelay = (_config$retryDelay = config.retryDelay) != null ? _config$retryDelay : defaultRetryDelay;\n var delay = typeof retryDelay === 'function' ? retryDelay(_this.failureCount, error) : retryDelay;\n var shouldRetry = retry === true || typeof retry === 'number' && _this.failureCount < retry || typeof retry === 'function' && retry(_this.failureCount, error);\n\n if (cancelRetry || !shouldRetry) {\n // We are done if the query does not need to be retried\n reject(error);\n return;\n }\n\n _this.failureCount++; // Notify on fail\n\n config.onFail == null ? void 0 : config.onFail(_this.failureCount, error); // Delay\n\n sleep(delay) // Pause if the document is not visible or when the device is offline\n .then(function () {\n if (!focusManager.isFocused() || !onlineManager.isOnline()) {\n return pause();\n }\n }).then(function () {\n if (cancelRetry) {\n reject(error);\n } else {\n run();\n }\n });\n });\n }; // Start loop\n\n\n run();\n};","export var Subscribable = /*#__PURE__*/function () {\n function Subscribable() {\n this.listeners = [];\n }\n\n var _proto = Subscribable.prototype;\n\n _proto.subscribe = function subscribe(listener) {\n var _this = this;\n\n var callback = listener || function () {\n return undefined;\n };\n\n this.listeners.push(callback);\n this.onSubscribe();\n return function () {\n _this.listeners = _this.listeners.filter(function (x) {\n return x !== callback;\n });\n\n _this.onUnsubscribe();\n };\n };\n\n _proto.hasListeners = function hasListeners() {\n return this.listeners.length > 0;\n };\n\n _proto.onSubscribe = function onSubscribe() {// Do nothing\n };\n\n _proto.onUnsubscribe = function onUnsubscribe() {// Do nothing\n };\n\n return Subscribable;\n}();","import _extends from \"@babel/runtime/helpers/esm/extends\";\n// TYPES\n// UTILS\nexport var isServer = typeof window === 'undefined';\nexport function noop() {\n return undefined;\n}\nexport function functionalUpdate(updater, input) {\n return typeof updater === 'function' ? updater(input) : updater;\n}\nexport function isValidTimeout(value) {\n return typeof value === 'number' && value >= 0 && value !== Infinity;\n}\nexport function ensureQueryKeyArray(value) {\n return Array.isArray(value) ? value : [value];\n}\nexport function difference(array1, array2) {\n return array1.filter(function (x) {\n return array2.indexOf(x) === -1;\n });\n}\nexport function replaceAt(array, index, value) {\n var copy = array.slice(0);\n copy[index] = value;\n return copy;\n}\nexport function timeUntilStale(updatedAt, staleTime) {\n return Math.max(updatedAt + (staleTime || 0) - Date.now(), 0);\n}\nexport function parseQueryArgs(arg1, arg2, arg3) {\n if (!isQueryKey(arg1)) {\n return arg1;\n }\n\n if (typeof arg2 === 'function') {\n return _extends({}, arg3, {\n queryKey: arg1,\n queryFn: arg2\n });\n }\n\n return _extends({}, arg2, {\n queryKey: arg1\n });\n}\nexport function parseMutationArgs(arg1, arg2, arg3) {\n if (isQueryKey(arg1)) {\n if (typeof arg2 === 'function') {\n return _extends({}, arg3, {\n mutationKey: arg1,\n mutationFn: arg2\n });\n }\n\n return _extends({}, arg2, {\n mutationKey: arg1\n });\n }\n\n if (typeof arg1 === 'function') {\n return _extends({}, arg2, {\n mutationFn: arg1\n });\n }\n\n return _extends({}, arg1);\n}\nexport function parseFilterArgs(arg1, arg2, arg3) {\n return isQueryKey(arg1) ? [_extends({}, arg2, {\n queryKey: arg1\n }), arg3] : [arg1 || {}, arg2];\n}\nexport function parseMutationFilterArgs(arg1, arg2) {\n return isQueryKey(arg1) ? _extends({}, arg2, {\n mutationKey: arg1\n }) : arg1;\n}\nexport function mapQueryStatusFilter(active, inactive) {\n if (active === true && inactive === true || active == null && inactive == null) {\n return 'all';\n } else if (active === false && inactive === false) {\n return 'none';\n } else {\n // At this point, active|inactive can only be true|false or false|true\n // so, when only one value is provided, the missing one has to be the negated value\n var isActive = active != null ? active : !inactive;\n return isActive ? 'active' : 'inactive';\n }\n}\nexport function matchQuery(filters, query) {\n var active = filters.active,\n exact = filters.exact,\n fetching = filters.fetching,\n inactive = filters.inactive,\n predicate = filters.predicate,\n queryKey = filters.queryKey,\n stale = filters.stale;\n\n if (isQueryKey(queryKey)) {\n if (exact) {\n if (query.queryHash !== hashQueryKeyByOptions(queryKey, query.options)) {\n return false;\n }\n } else if (!partialMatchKey(query.queryKey, queryKey)) {\n return false;\n }\n }\n\n var queryStatusFilter = mapQueryStatusFilter(active, inactive);\n\n if (queryStatusFilter === 'none') {\n return false;\n } else if (queryStatusFilter !== 'all') {\n var isActive = query.isActive();\n\n if (queryStatusFilter === 'active' && !isActive) {\n return false;\n }\n\n if (queryStatusFilter === 'inactive' && isActive) {\n return false;\n }\n }\n\n if (typeof stale === 'boolean' && query.isStale() !== stale) {\n return false;\n }\n\n if (typeof fetching === 'boolean' && query.isFetching() !== fetching) {\n return false;\n }\n\n if (predicate && !predicate(query)) {\n return false;\n }\n\n return true;\n}\nexport function matchMutation(filters, mutation) {\n var exact = filters.exact,\n fetching = filters.fetching,\n predicate = filters.predicate,\n mutationKey = filters.mutationKey;\n\n if (isQueryKey(mutationKey)) {\n if (!mutation.options.mutationKey) {\n return false;\n }\n\n if (exact) {\n if (hashQueryKey(mutation.options.mutationKey) !== hashQueryKey(mutationKey)) {\n return false;\n }\n } else if (!partialMatchKey(mutation.options.mutationKey, mutationKey)) {\n return false;\n }\n }\n\n if (typeof fetching === 'boolean' && mutation.state.status === 'loading' !== fetching) {\n return false;\n }\n\n if (predicate && !predicate(mutation)) {\n return false;\n }\n\n return true;\n}\nexport function hashQueryKeyByOptions(queryKey, options) {\n var hashFn = (options == null ? void 0 : options.queryKeyHashFn) || hashQueryKey;\n return hashFn(queryKey);\n}\n/**\n * Default query keys hash function.\n */\n\nexport function hashQueryKey(queryKey) {\n var asArray = ensureQueryKeyArray(queryKey);\n return stableValueHash(asArray);\n}\n/**\n * Hashes the value into a stable hash.\n */\n\nexport function stableValueHash(value) {\n return JSON.stringify(value, function (_, val) {\n return isPlainObject(val) ? Object.keys(val).sort().reduce(function (result, key) {\n result[key] = val[key];\n return result;\n }, {}) : val;\n });\n}\n/**\n * Checks if key `b` partially matches with key `a`.\n */\n\nexport function partialMatchKey(a, b) {\n return partialDeepEqual(ensureQueryKeyArray(a), ensureQueryKeyArray(b));\n}\n/**\n * Checks if `b` partially matches with `a`.\n */\n\nexport function partialDeepEqual(a, b) {\n if (a === b) {\n return true;\n }\n\n if (typeof a !== typeof b) {\n return false;\n }\n\n if (a && b && typeof a === 'object' && typeof b === 'object') {\n return !Object.keys(b).some(function (key) {\n return !partialDeepEqual(a[key], b[key]);\n });\n }\n\n return false;\n}\n/**\n * This function returns `a` if `b` is deeply equal.\n * If not, it will replace any deeply equal children of `b` with those of `a`.\n * This can be used for structural sharing between JSON values for example.\n */\n\nexport function replaceEqualDeep(a, b) {\n if (a === b) {\n return a;\n }\n\n var array = Array.isArray(a) && Array.isArray(b);\n\n if (array || isPlainObject(a) && isPlainObject(b)) {\n var aSize = array ? a.length : Object.keys(a).length;\n var bItems = array ? b : Object.keys(b);\n var bSize = bItems.length;\n var copy = array ? [] : {};\n var equalItems = 0;\n\n for (var i = 0; i < bSize; i++) {\n var key = array ? i : bItems[i];\n copy[key] = replaceEqualDeep(a[key], b[key]);\n\n if (copy[key] === a[key]) {\n equalItems++;\n }\n }\n\n return aSize === bSize && equalItems === aSize ? a : copy;\n }\n\n return b;\n}\n/**\n * Shallow compare objects. Only works with objects that always have the same properties.\n */\n\nexport function shallowEqualObjects(a, b) {\n if (a && !b || b && !a) {\n return false;\n }\n\n for (var key in a) {\n if (a[key] !== b[key]) {\n return false;\n }\n }\n\n return true;\n} // Copied from: https://github.com/jonschlinkert/is-plain-object\n\nexport function isPlainObject(o) {\n if (!hasObjectPrototype(o)) {\n return false;\n } // If has modified constructor\n\n\n var ctor = o.constructor;\n\n if (typeof ctor === 'undefined') {\n return true;\n } // If has modified prototype\n\n\n var prot = ctor.prototype;\n\n if (!hasObjectPrototype(prot)) {\n return false;\n } // If constructor does not have an Object-specific method\n\n\n if (!prot.hasOwnProperty('isPrototypeOf')) {\n return false;\n } // Most likely a plain Object\n\n\n return true;\n}\n\nfunction hasObjectPrototype(o) {\n return Object.prototype.toString.call(o) === '[object Object]';\n}\n\nexport function isQueryKey(value) {\n return typeof value === 'string' || Array.isArray(value);\n}\nexport function isError(value) {\n return value instanceof Error;\n}\nexport function sleep(timeout) {\n return new Promise(function (resolve) {\n setTimeout(resolve, timeout);\n });\n}\n/**\n * Schedules a microtask.\n * This can be useful to schedule state updates after rendering.\n */\n\nexport function scheduleMicrotask(callback) {\n Promise.resolve().then(callback).catch(function (error) {\n return setTimeout(function () {\n throw error;\n });\n });\n}\nexport function getAbortController() {\n if (typeof AbortController === 'function') {\n return new AbortController();\n }\n}","import ReactDOM from 'react-dom';\nexport var unstable_batchedUpdates = ReactDOM.unstable_batchedUpdates;","import { notifyManager } from '../core';\nimport { unstable_batchedUpdates } from './reactBatchedUpdates';\nnotifyManager.setBatchNotifyFunction(unstable_batchedUpdates);","export var logger = console;","import { setLogger } from '../core';\nimport { logger } from './logger';\nsetLogger(logger);","import React from 'react';\nvar defaultContext = /*#__PURE__*/React.createContext(undefined);\nvar QueryClientSharingContext = /*#__PURE__*/React.createContext(false); // if contextSharing is on, we share the first and at least one\n// instance of the context across the window\n// to ensure that if React Query is used across\n// different bundles or microfrontends they will\n// all use the same **instance** of context, regardless\n// of module scoping.\n\nfunction getQueryClientContext(contextSharing) {\n if (contextSharing && typeof window !== 'undefined') {\n if (!window.ReactQueryClientContext) {\n window.ReactQueryClientContext = defaultContext;\n }\n\n return window.ReactQueryClientContext;\n }\n\n return defaultContext;\n}\n\nexport var useQueryClient = function useQueryClient() {\n var queryClient = React.useContext(getQueryClientContext(React.useContext(QueryClientSharingContext)));\n\n if (!queryClient) {\n throw new Error('No QueryClient set, use QueryClientProvider to set one');\n }\n\n return queryClient;\n};\nexport var QueryClientProvider = function QueryClientProvider(_ref) {\n var client = _ref.client,\n _ref$contextSharing = _ref.contextSharing,\n contextSharing = _ref$contextSharing === void 0 ? false : _ref$contextSharing,\n children = _ref.children;\n React.useEffect(function () {\n client.mount();\n return function () {\n client.unmount();\n };\n }, [client]);\n var Context = getQueryClientContext(contextSharing);\n return /*#__PURE__*/React.createElement(QueryClientSharingContext.Provider, {\n value: contextSharing\n }, /*#__PURE__*/React.createElement(Context.Provider, {\n value: client\n }, children));\n};","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _inheritsLoose from \"@babel/runtime/helpers/esm/inheritsLoose\";\nimport { getDefaultState } from './mutation';\nimport { notifyManager } from './notifyManager';\nimport { Subscribable } from './subscribable';\n// CLASS\nexport var MutationObserver = /*#__PURE__*/function (_Subscribable) {\n _inheritsLoose(MutationObserver, _Subscribable);\n\n function MutationObserver(client, options) {\n var _this;\n\n _this = _Subscribable.call(this) || this;\n _this.client = client;\n\n _this.setOptions(options);\n\n _this.bindMethods();\n\n _this.updateResult();\n\n return _this;\n }\n\n var _proto = MutationObserver.prototype;\n\n _proto.bindMethods = function bindMethods() {\n this.mutate = this.mutate.bind(this);\n this.reset = this.reset.bind(this);\n };\n\n _proto.setOptions = function setOptions(options) {\n this.options = this.client.defaultMutationOptions(options);\n };\n\n _proto.onUnsubscribe = function onUnsubscribe() {\n if (!this.listeners.length) {\n var _this$currentMutation;\n\n (_this$currentMutation = this.currentMutation) == null ? void 0 : _this$currentMutation.removeObserver(this);\n }\n };\n\n _proto.onMutationUpdate = function onMutationUpdate(action) {\n this.updateResult(); // Determine which callbacks to trigger\n\n var notifyOptions = {\n listeners: true\n };\n\n if (action.type === 'success') {\n notifyOptions.onSuccess = true;\n } else if (action.type === 'error') {\n notifyOptions.onError = true;\n }\n\n this.notify(notifyOptions);\n };\n\n _proto.getCurrentResult = function getCurrentResult() {\n return this.currentResult;\n };\n\n _proto.reset = function reset() {\n this.currentMutation = undefined;\n this.updateResult();\n this.notify({\n listeners: true\n });\n };\n\n _proto.mutate = function mutate(variables, options) {\n this.mutateOptions = options;\n\n if (this.currentMutation) {\n this.currentMutation.removeObserver(this);\n }\n\n this.currentMutation = this.client.getMutationCache().build(this.client, _extends({}, this.options, {\n variables: typeof variables !== 'undefined' ? variables : this.options.variables\n }));\n this.currentMutation.addObserver(this);\n return this.currentMutation.execute();\n };\n\n _proto.updateResult = function updateResult() {\n var state = this.currentMutation ? this.currentMutation.state : getDefaultState();\n\n var result = _extends({}, state, {\n isLoading: state.status === 'loading',\n isSuccess: state.status === 'success',\n isError: state.status === 'error',\n isIdle: state.status === 'idle',\n mutate: this.mutate,\n reset: this.reset\n });\n\n this.currentResult = result;\n };\n\n _proto.notify = function notify(options) {\n var _this2 = this;\n\n notifyManager.batch(function () {\n // First trigger the mutate callbacks\n if (_this2.mutateOptions) {\n if (options.onSuccess) {\n _this2.mutateOptions.onSuccess == null ? void 0 : _this2.mutateOptions.onSuccess(_this2.currentResult.data, _this2.currentResult.variables, _this2.currentResult.context);\n _this2.mutateOptions.onSettled == null ? void 0 : _this2.mutateOptions.onSettled(_this2.currentResult.data, null, _this2.currentResult.variables, _this2.currentResult.context);\n } else if (options.onError) {\n _this2.mutateOptions.onError == null ? void 0 : _this2.mutateOptions.onError(_this2.currentResult.error, _this2.currentResult.variables, _this2.currentResult.context);\n _this2.mutateOptions.onSettled == null ? void 0 : _this2.mutateOptions.onSettled(undefined, _this2.currentResult.error, _this2.currentResult.variables, _this2.currentResult.context);\n }\n } // Then trigger the listeners\n\n\n if (options.listeners) {\n _this2.listeners.forEach(function (listener) {\n listener(_this2.currentResult);\n });\n }\n });\n };\n\n return MutationObserver;\n}(Subscribable);","export function shouldThrowError(suspense, _useErrorBoundary, params) {\n // Allow useErrorBoundary function to override throwing behavior on a per-error basis\n if (typeof _useErrorBoundary === 'function') {\n return _useErrorBoundary.apply(void 0, params);\n } // Allow useErrorBoundary to override suspense's throwing behavior\n\n\n if (typeof _useErrorBoundary === 'boolean') return _useErrorBoundary; // If suspense is enabled default to throwing errors\n\n return !!suspense;\n}","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport React from 'react';\nimport { notifyManager } from '../core/notifyManager';\nimport { noop, parseMutationArgs } from '../core/utils';\nimport { MutationObserver } from '../core/mutationObserver';\nimport { useQueryClient } from './QueryClientProvider';\nimport { shouldThrowError } from './utils'; // HOOK\n\nexport function useMutation(arg1, arg2, arg3) {\n var mountedRef = React.useRef(false);\n\n var _React$useState = React.useState(0),\n forceUpdate = _React$useState[1];\n\n var options = parseMutationArgs(arg1, arg2, arg3);\n var queryClient = useQueryClient();\n var obsRef = React.useRef();\n\n if (!obsRef.current) {\n obsRef.current = new MutationObserver(queryClient, options);\n } else {\n obsRef.current.setOptions(options);\n }\n\n var currentResult = obsRef.current.getCurrentResult();\n React.useEffect(function () {\n mountedRef.current = true;\n var unsubscribe = obsRef.current.subscribe(notifyManager.batchCalls(function () {\n if (mountedRef.current) {\n forceUpdate(function (x) {\n return x + 1;\n });\n }\n }));\n return function () {\n mountedRef.current = false;\n unsubscribe();\n };\n }, []);\n var mutate = React.useCallback(function (variables, mutateOptions) {\n obsRef.current.mutate(variables, mutateOptions).catch(noop);\n }, []);\n\n if (currentResult.error && shouldThrowError(undefined, obsRef.current.options.useErrorBoundary, [currentResult.error])) {\n throw currentResult.error;\n }\n\n return _extends({}, currentResult, {\n mutate: mutate,\n mutateAsync: currentResult.mutate\n });\n}","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _inheritsLoose from \"@babel/runtime/helpers/esm/inheritsLoose\";\nimport { isServer, isValidTimeout, noop, replaceEqualDeep, shallowEqualObjects, timeUntilStale } from './utils';\nimport { notifyManager } from './notifyManager';\nimport { focusManager } from './focusManager';\nimport { Subscribable } from './subscribable';\nimport { getLogger } from './logger';\nimport { isCancelledError } from './retryer';\nexport var QueryObserver = /*#__PURE__*/function (_Subscribable) {\n _inheritsLoose(QueryObserver, _Subscribable);\n\n function QueryObserver(client, options) {\n var _this;\n\n _this = _Subscribable.call(this) || this;\n _this.client = client;\n _this.options = options;\n _this.trackedProps = [];\n _this.selectError = null;\n\n _this.bindMethods();\n\n _this.setOptions(options);\n\n return _this;\n }\n\n var _proto = QueryObserver.prototype;\n\n _proto.bindMethods = function bindMethods() {\n this.remove = this.remove.bind(this);\n this.refetch = this.refetch.bind(this);\n };\n\n _proto.onSubscribe = function onSubscribe() {\n if (this.listeners.length === 1) {\n this.currentQuery.addObserver(this);\n\n if (shouldFetchOnMount(this.currentQuery, this.options)) {\n this.executeFetch();\n }\n\n this.updateTimers();\n }\n };\n\n _proto.onUnsubscribe = function onUnsubscribe() {\n if (!this.listeners.length) {\n this.destroy();\n }\n };\n\n _proto.shouldFetchOnReconnect = function shouldFetchOnReconnect() {\n return shouldFetchOn(this.currentQuery, this.options, this.options.refetchOnReconnect);\n };\n\n _proto.shouldFetchOnWindowFocus = function shouldFetchOnWindowFocus() {\n return shouldFetchOn(this.currentQuery, this.options, this.options.refetchOnWindowFocus);\n };\n\n _proto.destroy = function destroy() {\n this.listeners = [];\n this.clearTimers();\n this.currentQuery.removeObserver(this);\n };\n\n _proto.setOptions = function setOptions(options, notifyOptions) {\n var prevOptions = this.options;\n var prevQuery = this.currentQuery;\n this.options = this.client.defaultQueryObserverOptions(options);\n\n if (typeof this.options.enabled !== 'undefined' && typeof this.options.enabled !== 'boolean') {\n throw new Error('Expected enabled to be a boolean');\n } // Keep previous query key if the user does not supply one\n\n\n if (!this.options.queryKey) {\n this.options.queryKey = prevOptions.queryKey;\n }\n\n this.updateQuery();\n var mounted = this.hasListeners(); // Fetch if there are subscribers\n\n if (mounted && shouldFetchOptionally(this.currentQuery, prevQuery, this.options, prevOptions)) {\n this.executeFetch();\n } // Update result\n\n\n this.updateResult(notifyOptions); // Update stale interval if needed\n\n if (mounted && (this.currentQuery !== prevQuery || this.options.enabled !== prevOptions.enabled || this.options.staleTime !== prevOptions.staleTime)) {\n this.updateStaleTimeout();\n }\n\n var nextRefetchInterval = this.computeRefetchInterval(); // Update refetch interval if needed\n\n if (mounted && (this.currentQuery !== prevQuery || this.options.enabled !== prevOptions.enabled || nextRefetchInterval !== this.currentRefetchInterval)) {\n this.updateRefetchInterval(nextRefetchInterval);\n }\n };\n\n _proto.getOptimisticResult = function getOptimisticResult(options) {\n var defaultedOptions = this.client.defaultQueryObserverOptions(options);\n var query = this.client.getQueryCache().build(this.client, defaultedOptions);\n return this.createResult(query, defaultedOptions);\n };\n\n _proto.getCurrentResult = function getCurrentResult() {\n return this.currentResult;\n };\n\n _proto.trackResult = function trackResult(result, defaultedOptions) {\n var _this2 = this;\n\n var trackedResult = {};\n\n var trackProp = function trackProp(key) {\n if (!_this2.trackedProps.includes(key)) {\n _this2.trackedProps.push(key);\n }\n };\n\n Object.keys(result).forEach(function (key) {\n Object.defineProperty(trackedResult, key, {\n configurable: false,\n enumerable: true,\n get: function get() {\n trackProp(key);\n return result[key];\n }\n });\n });\n\n if (defaultedOptions.useErrorBoundary || defaultedOptions.suspense) {\n trackProp('error');\n }\n\n return trackedResult;\n };\n\n _proto.getNextResult = function getNextResult(options) {\n var _this3 = this;\n\n return new Promise(function (resolve, reject) {\n var unsubscribe = _this3.subscribe(function (result) {\n if (!result.isFetching) {\n unsubscribe();\n\n if (result.isError && (options == null ? void 0 : options.throwOnError)) {\n reject(result.error);\n } else {\n resolve(result);\n }\n }\n });\n });\n };\n\n _proto.getCurrentQuery = function getCurrentQuery() {\n return this.currentQuery;\n };\n\n _proto.remove = function remove() {\n this.client.getQueryCache().remove(this.currentQuery);\n };\n\n _proto.refetch = function refetch(options) {\n return this.fetch(_extends({}, options, {\n meta: {\n refetchPage: options == null ? void 0 : options.refetchPage\n }\n }));\n };\n\n _proto.fetchOptimistic = function fetchOptimistic(options) {\n var _this4 = this;\n\n var defaultedOptions = this.client.defaultQueryObserverOptions(options);\n var query = this.client.getQueryCache().build(this.client, defaultedOptions);\n return query.fetch().then(function () {\n return _this4.createResult(query, defaultedOptions);\n });\n };\n\n _proto.fetch = function fetch(fetchOptions) {\n var _this5 = this;\n\n return this.executeFetch(fetchOptions).then(function () {\n _this5.updateResult();\n\n return _this5.currentResult;\n });\n };\n\n _proto.executeFetch = function executeFetch(fetchOptions) {\n // Make sure we reference the latest query as the current one might have been removed\n this.updateQuery(); // Fetch\n\n var promise = this.currentQuery.fetch(this.options, fetchOptions);\n\n if (!(fetchOptions == null ? void 0 : fetchOptions.throwOnError)) {\n promise = promise.catch(noop);\n }\n\n return promise;\n };\n\n _proto.updateStaleTimeout = function updateStaleTimeout() {\n var _this6 = this;\n\n this.clearStaleTimeout();\n\n if (isServer || this.currentResult.isStale || !isValidTimeout(this.options.staleTime)) {\n return;\n }\n\n var time = timeUntilStale(this.currentResult.dataUpdatedAt, this.options.staleTime); // The timeout is sometimes triggered 1 ms before the stale time expiration.\n // To mitigate this issue we always add 1 ms to the timeout.\n\n var timeout = time + 1;\n this.staleTimeoutId = setTimeout(function () {\n if (!_this6.currentResult.isStale) {\n _this6.updateResult();\n }\n }, timeout);\n };\n\n _proto.computeRefetchInterval = function computeRefetchInterval() {\n var _this$options$refetch;\n\n return typeof this.options.refetchInterval === 'function' ? this.options.refetchInterval(this.currentResult.data, this.currentQuery) : (_this$options$refetch = this.options.refetchInterval) != null ? _this$options$refetch : false;\n };\n\n _proto.updateRefetchInterval = function updateRefetchInterval(nextInterval) {\n var _this7 = this;\n\n this.clearRefetchInterval();\n this.currentRefetchInterval = nextInterval;\n\n if (isServer || this.options.enabled === false || !isValidTimeout(this.currentRefetchInterval) || this.currentRefetchInterval === 0) {\n return;\n }\n\n this.refetchIntervalId = setInterval(function () {\n if (_this7.options.refetchIntervalInBackground || focusManager.isFocused()) {\n _this7.executeFetch();\n }\n }, this.currentRefetchInterval);\n };\n\n _proto.updateTimers = function updateTimers() {\n this.updateStaleTimeout();\n this.updateRefetchInterval(this.computeRefetchInterval());\n };\n\n _proto.clearTimers = function clearTimers() {\n this.clearStaleTimeout();\n this.clearRefetchInterval();\n };\n\n _proto.clearStaleTimeout = function clearStaleTimeout() {\n if (this.staleTimeoutId) {\n clearTimeout(this.staleTimeoutId);\n this.staleTimeoutId = undefined;\n }\n };\n\n _proto.clearRefetchInterval = function clearRefetchInterval() {\n if (this.refetchIntervalId) {\n clearInterval(this.refetchIntervalId);\n this.refetchIntervalId = undefined;\n }\n };\n\n _proto.createResult = function createResult(query, options) {\n var prevQuery = this.currentQuery;\n var prevOptions = this.options;\n var prevResult = this.currentResult;\n var prevResultState = this.currentResultState;\n var prevResultOptions = this.currentResultOptions;\n var queryChange = query !== prevQuery;\n var queryInitialState = queryChange ? query.state : this.currentQueryInitialState;\n var prevQueryResult = queryChange ? this.currentResult : this.previousQueryResult;\n var state = query.state;\n var dataUpdatedAt = state.dataUpdatedAt,\n error = state.error,\n errorUpdatedAt = state.errorUpdatedAt,\n isFetching = state.isFetching,\n status = state.status;\n var isPreviousData = false;\n var isPlaceholderData = false;\n var data; // Optimistically set result in fetching state if needed\n\n if (options.optimisticResults) {\n var mounted = this.hasListeners();\n var fetchOnMount = !mounted && shouldFetchOnMount(query, options);\n var fetchOptionally = mounted && shouldFetchOptionally(query, prevQuery, options, prevOptions);\n\n if (fetchOnMount || fetchOptionally) {\n isFetching = true;\n\n if (!dataUpdatedAt) {\n status = 'loading';\n }\n }\n } // Keep previous data if needed\n\n\n if (options.keepPreviousData && !state.dataUpdateCount && (prevQueryResult == null ? void 0 : prevQueryResult.isSuccess) && status !== 'error') {\n data = prevQueryResult.data;\n dataUpdatedAt = prevQueryResult.dataUpdatedAt;\n status = prevQueryResult.status;\n isPreviousData = true;\n } // Select data if needed\n else if (options.select && typeof state.data !== 'undefined') {\n // Memoize select result\n if (prevResult && state.data === (prevResultState == null ? void 0 : prevResultState.data) && options.select === this.selectFn) {\n data = this.selectResult;\n } else {\n try {\n this.selectFn = options.select;\n data = options.select(state.data);\n\n if (options.structuralSharing !== false) {\n data = replaceEqualDeep(prevResult == null ? void 0 : prevResult.data, data);\n }\n\n this.selectResult = data;\n this.selectError = null;\n } catch (selectError) {\n getLogger().error(selectError);\n this.selectError = selectError;\n }\n }\n } // Use query data\n else {\n data = state.data;\n } // Show placeholder data if needed\n\n\n if (typeof options.placeholderData !== 'undefined' && typeof data === 'undefined' && (status === 'loading' || status === 'idle')) {\n var placeholderData; // Memoize placeholder data\n\n if ((prevResult == null ? void 0 : prevResult.isPlaceholderData) && options.placeholderData === (prevResultOptions == null ? void 0 : prevResultOptions.placeholderData)) {\n placeholderData = prevResult.data;\n } else {\n placeholderData = typeof options.placeholderData === 'function' ? options.placeholderData() : options.placeholderData;\n\n if (options.select && typeof placeholderData !== 'undefined') {\n try {\n placeholderData = options.select(placeholderData);\n\n if (options.structuralSharing !== false) {\n placeholderData = replaceEqualDeep(prevResult == null ? void 0 : prevResult.data, placeholderData);\n }\n\n this.selectError = null;\n } catch (selectError) {\n getLogger().error(selectError);\n this.selectError = selectError;\n }\n }\n }\n\n if (typeof placeholderData !== 'undefined') {\n status = 'success';\n data = placeholderData;\n isPlaceholderData = true;\n }\n }\n\n if (this.selectError) {\n error = this.selectError;\n data = this.selectResult;\n errorUpdatedAt = Date.now();\n status = 'error';\n }\n\n var result = {\n status: status,\n isLoading: status === 'loading',\n isSuccess: status === 'success',\n isError: status === 'error',\n isIdle: status === 'idle',\n data: data,\n dataUpdatedAt: dataUpdatedAt,\n error: error,\n errorUpdatedAt: errorUpdatedAt,\n failureCount: state.fetchFailureCount,\n errorUpdateCount: state.errorUpdateCount,\n isFetched: state.dataUpdateCount > 0 || state.errorUpdateCount > 0,\n isFetchedAfterMount: state.dataUpdateCount > queryInitialState.dataUpdateCount || state.errorUpdateCount > queryInitialState.errorUpdateCount,\n isFetching: isFetching,\n isRefetching: isFetching && status !== 'loading',\n isLoadingError: status === 'error' && state.dataUpdatedAt === 0,\n isPlaceholderData: isPlaceholderData,\n isPreviousData: isPreviousData,\n isRefetchError: status === 'error' && state.dataUpdatedAt !== 0,\n isStale: isStale(query, options),\n refetch: this.refetch,\n remove: this.remove\n };\n return result;\n };\n\n _proto.shouldNotifyListeners = function shouldNotifyListeners(result, prevResult) {\n if (!prevResult) {\n return true;\n }\n\n var _this$options = this.options,\n notifyOnChangeProps = _this$options.notifyOnChangeProps,\n notifyOnChangePropsExclusions = _this$options.notifyOnChangePropsExclusions;\n\n if (!notifyOnChangeProps && !notifyOnChangePropsExclusions) {\n return true;\n }\n\n if (notifyOnChangeProps === 'tracked' && !this.trackedProps.length) {\n return true;\n }\n\n var includedProps = notifyOnChangeProps === 'tracked' ? this.trackedProps : notifyOnChangeProps;\n return Object.keys(result).some(function (key) {\n var typedKey = key;\n var changed = result[typedKey] !== prevResult[typedKey];\n var isIncluded = includedProps == null ? void 0 : includedProps.some(function (x) {\n return x === key;\n });\n var isExcluded = notifyOnChangePropsExclusions == null ? void 0 : notifyOnChangePropsExclusions.some(function (x) {\n return x === key;\n });\n return changed && !isExcluded && (!includedProps || isIncluded);\n });\n };\n\n _proto.updateResult = function updateResult(notifyOptions) {\n var prevResult = this.currentResult;\n this.currentResult = this.createResult(this.currentQuery, this.options);\n this.currentResultState = this.currentQuery.state;\n this.currentResultOptions = this.options; // Only notify if something has changed\n\n if (shallowEqualObjects(this.currentResult, prevResult)) {\n return;\n } // Determine which callbacks to trigger\n\n\n var defaultNotifyOptions = {\n cache: true\n };\n\n if ((notifyOptions == null ? void 0 : notifyOptions.listeners) !== false && this.shouldNotifyListeners(this.currentResult, prevResult)) {\n defaultNotifyOptions.listeners = true;\n }\n\n this.notify(_extends({}, defaultNotifyOptions, notifyOptions));\n };\n\n _proto.updateQuery = function updateQuery() {\n var query = this.client.getQueryCache().build(this.client, this.options);\n\n if (query === this.currentQuery) {\n return;\n }\n\n var prevQuery = this.currentQuery;\n this.currentQuery = query;\n this.currentQueryInitialState = query.state;\n this.previousQueryResult = this.currentResult;\n\n if (this.hasListeners()) {\n prevQuery == null ? void 0 : prevQuery.removeObserver(this);\n query.addObserver(this);\n }\n };\n\n _proto.onQueryUpdate = function onQueryUpdate(action) {\n var notifyOptions = {};\n\n if (action.type === 'success') {\n notifyOptions.onSuccess = true;\n } else if (action.type === 'error' && !isCancelledError(action.error)) {\n notifyOptions.onError = true;\n }\n\n this.updateResult(notifyOptions);\n\n if (this.hasListeners()) {\n this.updateTimers();\n }\n };\n\n _proto.notify = function notify(notifyOptions) {\n var _this8 = this;\n\n notifyManager.batch(function () {\n // First trigger the configuration callbacks\n if (notifyOptions.onSuccess) {\n _this8.options.onSuccess == null ? void 0 : _this8.options.onSuccess(_this8.currentResult.data);\n _this8.options.onSettled == null ? void 0 : _this8.options.onSettled(_this8.currentResult.data, null);\n } else if (notifyOptions.onError) {\n _this8.options.onError == null ? void 0 : _this8.options.onError(_this8.currentResult.error);\n _this8.options.onSettled == null ? void 0 : _this8.options.onSettled(undefined, _this8.currentResult.error);\n } // Then trigger the listeners\n\n\n if (notifyOptions.listeners) {\n _this8.listeners.forEach(function (listener) {\n listener(_this8.currentResult);\n });\n } // Then the cache listeners\n\n\n if (notifyOptions.cache) {\n _this8.client.getQueryCache().notify({\n query: _this8.currentQuery,\n type: 'observerResultsUpdated'\n });\n }\n });\n };\n\n return QueryObserver;\n}(Subscribable);\n\nfunction shouldLoadOnMount(query, options) {\n return options.enabled !== false && !query.state.dataUpdatedAt && !(query.state.status === 'error' && options.retryOnMount === false);\n}\n\nfunction shouldFetchOnMount(query, options) {\n return shouldLoadOnMount(query, options) || query.state.dataUpdatedAt > 0 && shouldFetchOn(query, options, options.refetchOnMount);\n}\n\nfunction shouldFetchOn(query, options, field) {\n if (options.enabled !== false) {\n var value = typeof field === 'function' ? field(query) : field;\n return value === 'always' || value !== false && isStale(query, options);\n }\n\n return false;\n}\n\nfunction shouldFetchOptionally(query, prevQuery, options, prevOptions) {\n return options.enabled !== false && (query !== prevQuery || prevOptions.enabled === false) && (!options.suspense || query.state.status !== 'error') && isStale(query, options);\n}\n\nfunction isStale(query, options) {\n return query.isStaleByTime(options.staleTime);\n}","import React from 'react'; // CONTEXT\n\nfunction createValue() {\n var _isReset = false;\n return {\n clearReset: function clearReset() {\n _isReset = false;\n },\n reset: function reset() {\n _isReset = true;\n },\n isReset: function isReset() {\n return _isReset;\n }\n };\n}\n\nvar QueryErrorResetBoundaryContext = /*#__PURE__*/React.createContext(createValue()); // HOOK\n\nexport var useQueryErrorResetBoundary = function useQueryErrorResetBoundary() {\n return React.useContext(QueryErrorResetBoundaryContext);\n}; // COMPONENT\n\nexport var QueryErrorResetBoundary = function QueryErrorResetBoundary(_ref) {\n var children = _ref.children;\n var value = React.useMemo(function () {\n return createValue();\n }, []);\n return /*#__PURE__*/React.createElement(QueryErrorResetBoundaryContext.Provider, {\n value: value\n }, typeof children === 'function' ? children(value) : children);\n};","import { QueryObserver } from '../core';\nimport { parseQueryArgs } from '../core/utils';\nimport { useBaseQuery } from './useBaseQuery'; // HOOK\n\nexport function useQuery(arg1, arg2, arg3) {\n var parsedOptions = parseQueryArgs(arg1, arg2, arg3);\n return useBaseQuery(parsedOptions, QueryObserver);\n}","import React from 'react';\nimport { notifyManager } from '../core/notifyManager';\nimport { useQueryErrorResetBoundary } from './QueryErrorResetBoundary';\nimport { useQueryClient } from './QueryClientProvider';\nimport { shouldThrowError } from './utils';\nexport function useBaseQuery(options, Observer) {\n var mountedRef = React.useRef(false);\n\n var _React$useState = React.useState(0),\n forceUpdate = _React$useState[1];\n\n var queryClient = useQueryClient();\n var errorResetBoundary = useQueryErrorResetBoundary();\n var defaultedOptions = queryClient.defaultQueryObserverOptions(options); // Make sure results are optimistically set in fetching state before subscribing or updating options\n\n defaultedOptions.optimisticResults = true; // Include callbacks in batch renders\n\n if (defaultedOptions.onError) {\n defaultedOptions.onError = notifyManager.batchCalls(defaultedOptions.onError);\n }\n\n if (defaultedOptions.onSuccess) {\n defaultedOptions.onSuccess = notifyManager.batchCalls(defaultedOptions.onSuccess);\n }\n\n if (defaultedOptions.onSettled) {\n defaultedOptions.onSettled = notifyManager.batchCalls(defaultedOptions.onSettled);\n }\n\n if (defaultedOptions.suspense) {\n // Always set stale time when using suspense to prevent\n // fetching again when directly mounting after suspending\n if (typeof defaultedOptions.staleTime !== 'number') {\n defaultedOptions.staleTime = 1000;\n } // Set cache time to 1 if the option has been set to 0\n // when using suspense to prevent infinite loop of fetches\n\n\n if (defaultedOptions.cacheTime === 0) {\n defaultedOptions.cacheTime = 1;\n }\n }\n\n if (defaultedOptions.suspense || defaultedOptions.useErrorBoundary) {\n // Prevent retrying failed query if the error boundary has not been reset yet\n if (!errorResetBoundary.isReset()) {\n defaultedOptions.retryOnMount = false;\n }\n }\n\n var _React$useState2 = React.useState(function () {\n return new Observer(queryClient, defaultedOptions);\n }),\n observer = _React$useState2[0];\n\n var result = observer.getOptimisticResult(defaultedOptions);\n React.useEffect(function () {\n mountedRef.current = true;\n errorResetBoundary.clearReset();\n var unsubscribe = observer.subscribe(notifyManager.batchCalls(function () {\n if (mountedRef.current) {\n forceUpdate(function (x) {\n return x + 1;\n });\n }\n })); // Update result to make sure we did not miss any query updates\n // between creating the observer and subscribing to it.\n\n observer.updateResult();\n return function () {\n mountedRef.current = false;\n unsubscribe();\n };\n }, [errorResetBoundary, observer]);\n React.useEffect(function () {\n // Do not notify on updates because of changes in the options because\n // these changes should already be reflected in the optimistic result.\n observer.setOptions(defaultedOptions, {\n listeners: false\n });\n }, [defaultedOptions, observer]); // Handle suspense\n\n if (defaultedOptions.suspense && result.isLoading) {\n throw observer.fetchOptimistic(defaultedOptions).then(function (_ref) {\n var data = _ref.data;\n defaultedOptions.onSuccess == null ? void 0 : defaultedOptions.onSuccess(data);\n defaultedOptions.onSettled == null ? void 0 : defaultedOptions.onSettled(data, null);\n }).catch(function (error) {\n errorResetBoundary.clearReset();\n defaultedOptions.onError == null ? void 0 : defaultedOptions.onError(error);\n defaultedOptions.onSettled == null ? void 0 : defaultedOptions.onSettled(undefined, error);\n });\n } // Handle error boundary\n\n\n if (result.isError && !errorResetBoundary.isReset() && !result.isFetching && shouldThrowError(defaultedOptions.suspense, defaultedOptions.useErrorBoundary, [result.error, observer.getCurrentQuery()])) {\n throw result.error;\n } // Handle result property usage tracking\n\n\n if (defaultedOptions.notifyOnChangeProps === 'tracked') {\n result = observer.trackResult(result, defaultedOptions);\n }\n\n return result;\n}","/**\n * @license React\n * react-jsx-runtime.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var f=require(\"react\"),k=Symbol.for(\"react.element\"),l=Symbol.for(\"react.fragment\"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};\nfunction q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=\"\"+g);void 0!==a.key&&(e=\"\"+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return{$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}exports.Fragment=l;exports.jsx=q;exports.jsxs=q;\n","/**\n * @license React\n * react.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var l=Symbol.for(\"react.element\"),n=Symbol.for(\"react.portal\"),p=Symbol.for(\"react.fragment\"),q=Symbol.for(\"react.strict_mode\"),r=Symbol.for(\"react.profiler\"),t=Symbol.for(\"react.provider\"),u=Symbol.for(\"react.context\"),v=Symbol.for(\"react.forward_ref\"),w=Symbol.for(\"react.suspense\"),x=Symbol.for(\"react.memo\"),y=Symbol.for(\"react.lazy\"),z=Symbol.iterator;function A(a){if(null===a||\"object\"!==typeof a)return null;a=z&&a[z]||a[\"@@iterator\"];return\"function\"===typeof a?a:null}\nvar B={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,D={};function E(a,b,e){this.props=a;this.context=b;this.refs=D;this.updater=e||B}E.prototype.isReactComponent={};\nE.prototype.setState=function(a,b){if(\"object\"!==typeof a&&\"function\"!==typeof a&&null!=a)throw Error(\"setState(...): takes an object of state variables to update or a function which returns an object of state variables.\");this.updater.enqueueSetState(this,a,b,\"setState\")};E.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,\"forceUpdate\")};function F(){}F.prototype=E.prototype;function G(a,b,e){this.props=a;this.context=b;this.refs=D;this.updater=e||B}var H=G.prototype=new F;\nH.constructor=G;C(H,E.prototype);H.isPureReactComponent=!0;var I=Array.isArray,J=Object.prototype.hasOwnProperty,K={current:null},L={key:!0,ref:!0,__self:!0,__source:!0};\nfunction M(a,b,e){var d,c={},k=null,h=null;if(null!=b)for(d in void 0!==b.ref&&(h=b.ref),void 0!==b.key&&(k=\"\"+b.key),b)J.call(b,d)&&!L.hasOwnProperty(d)&&(c[d]=b[d]);var g=arguments.length-2;if(1===g)c.children=e;else if(1>>1,e=a[d];if(0