{"version":3,"file":"static/chunks/1144-6f6bffb19ea08e38.js","mappings":"gLAKA,cACA,6BACA,CACA,cACA,gCAAkD,GAAa,WAC/D,CACA,0BACA,eACA,wBACA,sBACA,qBACA,CACA,EACA,cACA,qBACA,CACA,cACA,IAGA,EAHA,KACA,IACA,KAEA,EAAmB,OAAe,GAalC,MAA4B,GAAY,yCAAoD,GAAa,yBACzG,mCACA,MACA,IACA,KACA,iBACA,MACA,aAEA,EACA,MACA,IACA,KACA,eACA,MACA,YAEA,EACA,MACA,gBACA,MACA,UACA,IAEA,EACA,aACA,CAAK,YACL,SACA,GACA,gBAEA,CAAK,EAEL,WAIA,EAHA,KACA,OAGA,oCACA,IACA,WACA,CAAM,SACN,mBACA,CACA,qCACA,KACA,OAEA,eAA6C,GAAR,IAAQ,CAC7C,kBACA,gCACA,gEACA,UACA,KACA,MACA,CACA,IACA,gBACM,QAAK,aACX,gBACO,UACP,EACA,KAEA,GAEA,CAAO,CACP,CAAK,CACL,EACA,OACA,UACA,OAnFA,IACA,IACA,YACA,YAEA,EA+EA,cACA,MACA,GAEA,YAlFA,KACA,IACA,EAiFA,cAhFA,KACA,IACA,EA+EA,WACA,WACA,IACA,IAEA,YAEA,EAEA,CACA,mCClDA,MA5EA,WACA,SACA,IACA,MACA,GACA,EACA,MACA,GACA,EACA,qBACA,MACA,EACA,UAEA,OACA,IACA,CAAO,CAEP,EACA,OACA,QACA,KACA,UACA,OACA,OACA,cACA,IACA,CAAW,CACX,CAAS,CACT,CAAO,CAEP,EACA,OACA,UACA,KACA,KACA,IACA,KACA,EAAQ,SAER,GACA,GAEA,CACA,QACA,CAAK,CAIL,cACA,SACA,OACA,OACA,CAAS,CACT,EAEA,WAKA,sBACA,GACA,CAAK,CAKL,2BACA,GACA,CAAK,CACL,iBACA,GACA,CACA,CACA,gECxBA,MAjDA,cAAkC,GAAY,CAC9C,OACA,CACA,GACA,eACA,QACA,YACA,IAAW,IAAQ,2BACnB,gBACA,YAGA,OAFA,uCACA,wCACA,KACA,uCACA,uCACA,CACA,CAEA,CACA,CACA,cACA,SACA,8BAEA,CACA,gBACA,sBACA,YACA,eAEA,CACA,oBACA,UACA,YACA,oCACA,CACA,aACA,cAEA,UACA,2BACA,IACA,CAAO,EAEP,CACA,WACA,eAEA,oCClDA,YACA,cACA,uBACA,wCACA,CACA,aAGA,OAFA,sBACA,mBACA,KACA,yBACA,oBACA,CACA,CACA,eACA,4BACA,CACA,cACA,CACA,gBACA,CACA,wEChBa,EAA2B,gBACtC,QAGW,EAAiB,IAC5B,IAAM,EAAe,aAAW,GAEhC,GAAI,EACF,OAAO,EAGT,CANkD,CAEjC,CAIb,CAAC,EACH,MADW,MACK,wDAAwD,EAG1E,OAAO,CACT,EAOa,EAAsB,OAAC,QAClC,WACA,EACF,GAAmD,OAC3C,YAAU,KACd,EAAO,MAAM,EACN,KACL,EAAO,QAAQ,CACjB,GACC,CAAC,EAAO,EAGT,EAHQ,CAGR,OAAC,EAAmB,SAAnB,CAA4B,MAAO,WACjC,EACH,CAEJ,+ECxCA,gBAA6B,GAAS,CACtC,IACA,CACA,gBACA,GACA,QACA,6BACA,wBACA,WACA,wBACA,2BACA,iBACA,CACA,cACA,eACA,sCACA,CACA,WACA,wBACA,CACA,eACA,sBACA,gBACA,sBACA,gBACA,qBACA,cACA,UACA,CAAO,EAEP,CACA,kBACA,iCACA,kBACA,gBACA,uBACA,cACA,UACA,CAAK,CACL,CACA,iBACA,iBACA,8BACA,kBAEA,qBAGA,CACA,WACA,4BACA,kCACA,CACA,iBACA,QAAoB,QAAa,EACjC,OACA,wBAGA,2BAFA,6CAIA,eACA,SAAyB,qCAAqC,CAC9D,CAAO,CACP,aACA,SAAyB,aAAe,CACxC,CAAO,CACP,gBACA,SAAyB,gBAAkB,CAC3C,CAAO,CACP,4BACA,mCACA,qCACA,+BACA,CAAK,EACL,oCACA,sBACA,IACA,OACA,SAAyB,sCAAsC,EAC/D,gCACA,EACA,MAEA,uCACA,wBACA,SACA,eACA,UACA,YACA,UACA,CAAW,CAEX,CACA,4BAiBA,OAhBA,iCACA,EACA,EACA,mBACA,MAEA,uDACA,iCACA,EACA,KACA,qBACA,mBACA,MAEA,4DACA,SAAuB,sBAAuB,EAC9C,CACA,CAAM,SACN,IAyBA,MAxBA,+BACA,EACA,EACA,mBACA,MAEA,6BACA,EACA,EACA,oBAEA,iCACA,OACA,EACA,qBACA,mBACA,MAEA,+BACA,OACA,EACA,EACA,oBAEA,CACA,EAAQ,OACR,SAAyB,qBAAsB,CAC/C,CACA,EAAM,OACN,qBACA,CACA,CACA,MAsDA,WArDA,KACA,eACA,aACA,OACA,KACA,4BACA,qBACA,CACA,aACA,OACA,KACA,WACA,CACA,gBACA,OACA,KACA,WACA,CACA,eACA,OACA,KACA,kBACA,YACA,eACA,mBACA,WACA,oBACA,iBACA,sBACA,sBACA,CACA,eACA,OACA,KACA,YACA,eACA,mBACA,WACA,iBACA,WACA,CACA,aACA,OACA,KACA,YACA,cACA,8BACA,sBACA,YACA,cACA,CACA,CACA,GACA,YACI,GAAa,YACjB,oBACA,qBACA,CAAO,EACP,gBACA,cACA,eACA,QACA,CAAO,CACP,CAAK,CACL,CACA,EACA,aACA,OACA,eACA,YACA,WACA,eACA,mBACA,YACA,cACA,iBACA,aACA,CACA,8DCvKA,MA3DA,cAAiC,GAAY,CAC7C,EACA,KACA,eACA,CACA,QACA,YACA,IAAW,IAAQ,2BACnB,cAEA,OADA,iDACA,KACA,gDACA,CACA,CAEA,CACA,CACA,cACA,SACA,8BAEA,CACA,gBACA,sBACA,YACA,eAEA,CACA,oBACA,UACA,YACA,cACA,oBACA,mBAEA,cAEA,CAAK,CACL,CACA,cACA,cAEA,UACA,eAEA,CACA,UACA,uBACA,2BACA,IACA,CAAK,CACL,CACA,kBACA,0BACA,QAEA,+CACA,CACA,uMC5DA,sDACA,aACA,CACA,gBACA,iCACA,CACA,cACA,uCACA,CACA,gBACA,sCACA,CACA,gBACA,iCACA,CACA,gBACA,iCACA,CACA,gBACA,IACA,aACA,QACA,cACA,YACA,WACA,QACA,CAAI,EACJ,MACA,KACA,iCACA,QACA,MACM,oBACN,SAGA,cACA,mBACA,qBAGA,kBAFA,QAKA,OACA,wCAGA,+BAGA,YAIA,CACA,gBACA,UAAU,sCAAwC,EAClD,MACA,0BACA,SAEA,KACA,oCACA,QACA,MACM,+BACN,QAEA,OACA,0BAGA,YAIA,CACA,gBAEA,MADA,uBACA,EACA,CACA,cACA,sBACA,EACA,iDACA,UACA,GACK,EAAI,IAET,CACA,uBACA,OAGA,oBAGA,kDACA,sCAGA,CA6BA,gBACA,qDACA,SAEA,eACA,eACA,SAGA,QACA,CACA,cACA,0DAEA,cACA,SACA,SAEA,oBACA,cACA,SAEA,2BACA,MAGA,oCAGA,4CAKA,cACA,2DACA,CACA,cACA,uBACA,eACA,CAAG,CACH,CACA,wBACA,uCACA,yBACI,yBAzEJ,gBACA,SACA,SAEA,iBACA,kBACA,yBACA,WACA,qBACA,WACA,UACA,IACA,YAAoB,IAAW,KAC/B,eACA,sDACA,YACA,MAEA,kBACA,4BACA,IAGA,CACA,uBACA,CACA,QACA,EAwDA,KAEA,CACA,CAIA,oBACA,eACA,iCACA,CACA,oBACA,eACA,oCACA,CACA,eACA,sBAQA,8BACA,qBAEA,yBAGA,UAFA,8CAA+D,YAAkB,IAGjF,mDCxNA,QACA,GACA,UACA,qBACA,CACA,aACA,sBACQ,QAAc,eACtB,yBACA,qBACA,CAAO,cAEP,CACA,gBACA,qBACA,eACA,IAAoB,IAAQ,UAE5B,CACA,iBACA,UACA,sBACA,eAEA,CACA,oCC1BA,iBACA,EACA,EACA,0BACA,IACA,GACA,CAAG,EAIH,cACA,mBACA,iBACA,eACA,CAeA,OAtBA,mBACA,aACA,CAAG,EAMH,cACA,GACA,mBACA,OACA,CAAK,EACL,IACA,EACA,aACA,GACA,kBACA,QACA,CAAK,EACL,IACA,EACA,CACA","sources":["webpack://_N_E/./node_modules/@tanstack/query-core/build/modern/retryer.js","webpack://_N_E/./node_modules/@tanstack/query-core/build/modern/notifyManager.js","webpack://_N_E/./node_modules/@tanstack/query-core/build/modern/onlineManager.js","webpack://_N_E/./node_modules/@tanstack/query-core/build/modern/subscribable.js","webpack://_N_E/../QueryClientProvider.tsx","webpack://_N_E/./node_modules/@tanstack/query-core/build/modern/mutation.js","webpack://_N_E/./node_modules/@tanstack/query-core/build/modern/focusManager.js","webpack://_N_E/./node_modules/@tanstack/query-core/build/modern/utils.js","webpack://_N_E/./node_modules/@tanstack/query-core/build/modern/removable.js","webpack://_N_E/./node_modules/@tanstack/query-core/build/modern/thenable.js"],"sourcesContent":["// src/retryer.ts\nimport { focusManager } from \"./focusManager.js\";\nimport { onlineManager } from \"./onlineManager.js\";\nimport { pendingThenable } from \"./thenable.js\";\nimport { isServer, sleep } from \"./utils.js\";\nfunction defaultRetryDelay(failureCount) {\n return Math.min(1e3 * 2 ** failureCount, 3e4);\n}\nfunction canFetch(networkMode) {\n return (networkMode ?? \"online\") === \"online\" ? onlineManager.isOnline() : true;\n}\nvar CancelledError = class extends Error {\n constructor(options) {\n super(\"CancelledError\");\n this.revert = options?.revert;\n this.silent = options?.silent;\n }\n};\nfunction isCancelledError(value) {\n return value instanceof CancelledError;\n}\nfunction createRetryer(config) {\n let isRetryCancelled = false;\n let failureCount = 0;\n let isResolved = false;\n let continueFn;\n const thenable = pendingThenable();\n const cancel = (cancelOptions) => {\n if (!isResolved) {\n reject(new CancelledError(cancelOptions));\n config.abort?.();\n }\n };\n const cancelRetry = () => {\n isRetryCancelled = true;\n };\n const continueRetry = () => {\n isRetryCancelled = false;\n };\n const canContinue = () => focusManager.isFocused() && (config.networkMode === \"always\" || onlineManager.isOnline()) && config.canRun();\n const canStart = () => canFetch(config.networkMode) && config.canRun();\n const resolve = (value) => {\n if (!isResolved) {\n isResolved = true;\n config.onSuccess?.(value);\n continueFn?.();\n thenable.resolve(value);\n }\n };\n const reject = (value) => {\n if (!isResolved) {\n isResolved = true;\n config.onError?.(value);\n continueFn?.();\n thenable.reject(value);\n }\n };\n const pause = () => {\n return new Promise((continueResolve) => {\n continueFn = (value) => {\n if (isResolved || canContinue()) {\n continueResolve(value);\n }\n };\n config.onPause?.();\n }).then(() => {\n continueFn = void 0;\n if (!isResolved) {\n config.onContinue?.();\n }\n });\n };\n const run = () => {\n if (isResolved) {\n return;\n }\n let promiseOrValue;\n const initialPromise = failureCount === 0 ? config.initialPromise : void 0;\n try {\n promiseOrValue = initialPromise ?? config.fn();\n } catch (error) {\n promiseOrValue = Promise.reject(error);\n }\n Promise.resolve(promiseOrValue).then(resolve).catch((error) => {\n if (isResolved) {\n return;\n }\n const retry = config.retry ?? (isServer ? 0 : 3);\n const retryDelay = config.retryDelay ?? defaultRetryDelay;\n const delay = typeof retryDelay === \"function\" ? retryDelay(failureCount, error) : retryDelay;\n const shouldRetry = retry === true || typeof retry === \"number\" && failureCount < retry || typeof retry === \"function\" && retry(failureCount, error);\n if (isRetryCancelled || !shouldRetry) {\n reject(error);\n return;\n }\n failureCount++;\n config.onFail?.(failureCount, error);\n sleep(delay).then(() => {\n return canContinue() ? void 0 : pause();\n }).then(() => {\n if (isRetryCancelled) {\n reject(error);\n } else {\n run();\n }\n });\n });\n };\n return {\n promise: thenable,\n cancel,\n continue: () => {\n continueFn?.();\n return thenable;\n },\n cancelRetry,\n continueRetry,\n canStart,\n start: () => {\n if (canStart()) {\n run();\n } else {\n pause().then(run);\n }\n return thenable;\n }\n };\n}\nexport {\n CancelledError,\n canFetch,\n createRetryer,\n isCancelledError\n};\n//# sourceMappingURL=retryer.js.map","// src/notifyManager.ts\nfunction createNotifyManager() {\n let queue = [];\n let transactions = 0;\n let notifyFn = (callback) => {\n callback();\n };\n let batchNotifyFn = (callback) => {\n callback();\n };\n let scheduleFn = (cb) => setTimeout(cb, 0);\n const schedule = (callback) => {\n if (transactions) {\n queue.push(callback);\n } else {\n scheduleFn(() => {\n notifyFn(callback);\n });\n }\n };\n const flush = () => {\n const originalQueue = queue;\n queue = [];\n if (originalQueue.length) {\n scheduleFn(() => {\n batchNotifyFn(() => {\n originalQueue.forEach((callback) => {\n notifyFn(callback);\n });\n });\n });\n }\n };\n return {\n batch: (callback) => {\n let result;\n transactions++;\n try {\n result = callback();\n } finally {\n transactions--;\n if (!transactions) {\n flush();\n }\n }\n return result;\n },\n /**\n * All calls to the wrapped function will be batched.\n */\n batchCalls: (callback) => {\n return (...args) => {\n schedule(() => {\n callback(...args);\n });\n };\n },\n schedule,\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 setNotifyFunction: (fn) => {\n notifyFn = fn;\n },\n /**\n * Use this method to set a custom function to batch notifications together into a single tick.\n * By default React Query will use the batch function provided by ReactDOM or React Native.\n */\n setBatchNotifyFunction: (fn) => {\n batchNotifyFn = fn;\n },\n setScheduler: (fn) => {\n scheduleFn = fn;\n }\n };\n}\nvar notifyManager = createNotifyManager();\nexport {\n createNotifyManager,\n notifyManager\n};\n//# sourceMappingURL=notifyManager.js.map","// src/onlineManager.ts\nimport { Subscribable } from \"./subscribable.js\";\nimport { isServer } from \"./utils.js\";\nvar OnlineManager = class extends Subscribable {\n #online = true;\n #cleanup;\n #setup;\n constructor() {\n super();\n this.#setup = (onOnline) => {\n if (!isServer && window.addEventListener) {\n const onlineListener = () => onOnline(true);\n const offlineListener = () => onOnline(false);\n window.addEventListener(\"online\", onlineListener, false);\n window.addEventListener(\"offline\", offlineListener, false);\n return () => {\n window.removeEventListener(\"online\", onlineListener);\n window.removeEventListener(\"offline\", offlineListener);\n };\n }\n return;\n };\n }\n onSubscribe() {\n if (!this.#cleanup) {\n this.setEventListener(this.#setup);\n }\n }\n onUnsubscribe() {\n if (!this.hasListeners()) {\n this.#cleanup?.();\n this.#cleanup = void 0;\n }\n }\n setEventListener(setup) {\n this.#setup = setup;\n this.#cleanup?.();\n this.#cleanup = setup(this.setOnline.bind(this));\n }\n setOnline(online) {\n const changed = this.#online !== online;\n if (changed) {\n this.#online = online;\n this.listeners.forEach((listener) => {\n listener(online);\n });\n }\n }\n isOnline() {\n return this.#online;\n }\n};\nvar onlineManager = new OnlineManager();\nexport {\n OnlineManager,\n onlineManager\n};\n//# sourceMappingURL=onlineManager.js.map","// src/subscribable.ts\nvar Subscribable = class {\n constructor() {\n this.listeners = /* @__PURE__ */ new Set();\n this.subscribe = this.subscribe.bind(this);\n }\n subscribe(listener) {\n this.listeners.add(listener);\n this.onSubscribe();\n return () => {\n this.listeners.delete(listener);\n this.onUnsubscribe();\n };\n }\n hasListeners() {\n return this.listeners.size > 0;\n }\n onSubscribe() {\n }\n onUnsubscribe() {\n }\n};\nexport {\n Subscribable\n};\n//# sourceMappingURL=subscribable.js.map","'use client'\nimport * as React from 'react'\n\nimport type { QueryClient } from '@tanstack/query-core'\n\nexport const QueryClientContext = React.createContext(\n undefined,\n)\n\nexport const useQueryClient = (queryClient?: QueryClient) => {\n const client = React.useContext(QueryClientContext)\n\n if (queryClient) {\n return queryClient\n }\n\n if (!client) {\n throw new Error('No QueryClient set, use QueryClientProvider to set one')\n }\n\n return client\n}\n\nexport type QueryClientProviderProps = {\n client: QueryClient\n children?: React.ReactNode\n}\n\nexport const QueryClientProvider = ({\n client,\n children,\n}: QueryClientProviderProps): React.JSX.Element => {\n React.useEffect(() => {\n client.mount()\n return () => {\n client.unmount()\n }\n }, [client])\n\n return (\n \n {children}\n \n )\n}\n","// src/mutation.ts\nimport { notifyManager } from \"./notifyManager.js\";\nimport { Removable } from \"./removable.js\";\nimport { createRetryer } from \"./retryer.js\";\nvar Mutation = class extends Removable {\n #observers;\n #mutationCache;\n #retryer;\n constructor(config) {\n super();\n this.mutationId = config.mutationId;\n this.#mutationCache = config.mutationCache;\n this.#observers = [];\n this.state = config.state || getDefaultState();\n this.setOptions(config.options);\n this.scheduleGc();\n }\n setOptions(options) {\n this.options = options;\n this.updateGcTime(this.options.gcTime);\n }\n get meta() {\n return this.options.meta;\n }\n addObserver(observer) {\n if (!this.#observers.includes(observer)) {\n this.#observers.push(observer);\n this.clearGcTimeout();\n this.#mutationCache.notify({\n type: \"observerAdded\",\n mutation: this,\n observer\n });\n }\n }\n removeObserver(observer) {\n this.#observers = this.#observers.filter((x) => x !== observer);\n this.scheduleGc();\n this.#mutationCache.notify({\n type: \"observerRemoved\",\n mutation: this,\n observer\n });\n }\n optionalRemove() {\n if (!this.#observers.length) {\n if (this.state.status === \"pending\") {\n this.scheduleGc();\n } else {\n this.#mutationCache.remove(this);\n }\n }\n }\n continue() {\n return this.#retryer?.continue() ?? // continuing a mutation assumes that variables are set, mutation must have been dehydrated before\n this.execute(this.state.variables);\n }\n async execute(variables) {\n this.#retryer = createRetryer({\n fn: () => {\n if (!this.options.mutationFn) {\n return Promise.reject(new Error(\"No mutationFn found\"));\n }\n return this.options.mutationFn(variables);\n },\n onFail: (failureCount, error) => {\n this.#dispatch({ type: \"failed\", failureCount, error });\n },\n onPause: () => {\n this.#dispatch({ type: \"pause\" });\n },\n onContinue: () => {\n this.#dispatch({ type: \"continue\" });\n },\n retry: this.options.retry ?? 0,\n retryDelay: this.options.retryDelay,\n networkMode: this.options.networkMode,\n canRun: () => this.#mutationCache.canRun(this)\n });\n const restored = this.state.status === \"pending\";\n const isPaused = !this.#retryer.canStart();\n try {\n if (!restored) {\n this.#dispatch({ type: \"pending\", variables, isPaused });\n await this.#mutationCache.config.onMutate?.(\n variables,\n this\n );\n const context = await this.options.onMutate?.(variables);\n if (context !== this.state.context) {\n this.#dispatch({\n type: \"pending\",\n context,\n variables,\n isPaused\n });\n }\n }\n const data = await this.#retryer.start();\n await this.#mutationCache.config.onSuccess?.(\n data,\n variables,\n this.state.context,\n this\n );\n await this.options.onSuccess?.(data, variables, this.state.context);\n await this.#mutationCache.config.onSettled?.(\n data,\n null,\n this.state.variables,\n this.state.context,\n this\n );\n await this.options.onSettled?.(data, null, variables, this.state.context);\n this.#dispatch({ type: \"success\", data });\n return data;\n } catch (error) {\n try {\n await this.#mutationCache.config.onError?.(\n error,\n variables,\n this.state.context,\n this\n );\n await this.options.onError?.(\n error,\n variables,\n this.state.context\n );\n await this.#mutationCache.config.onSettled?.(\n void 0,\n error,\n this.state.variables,\n this.state.context,\n this\n );\n await this.options.onSettled?.(\n void 0,\n error,\n variables,\n this.state.context\n );\n throw error;\n } finally {\n this.#dispatch({ type: \"error\", error });\n }\n } finally {\n this.#mutationCache.runNext(this);\n }\n }\n #dispatch(action) {\n const reducer = (state) => {\n switch (action.type) {\n case \"failed\":\n return {\n ...state,\n failureCount: action.failureCount,\n failureReason: action.error\n };\n case \"pause\":\n return {\n ...state,\n isPaused: true\n };\n case \"continue\":\n return {\n ...state,\n isPaused: false\n };\n case \"pending\":\n return {\n ...state,\n context: action.context,\n data: void 0,\n failureCount: 0,\n failureReason: null,\n error: null,\n isPaused: action.isPaused,\n status: \"pending\",\n variables: action.variables,\n submittedAt: Date.now()\n };\n case \"success\":\n return {\n ...state,\n data: action.data,\n failureCount: 0,\n failureReason: null,\n error: null,\n status: \"success\",\n isPaused: false\n };\n case \"error\":\n return {\n ...state,\n data: void 0,\n error: action.error,\n failureCount: state.failureCount + 1,\n failureReason: action.error,\n isPaused: false,\n status: \"error\"\n };\n }\n };\n this.state = reducer(this.state);\n notifyManager.batch(() => {\n this.#observers.forEach((observer) => {\n observer.onMutationUpdate(action);\n });\n this.#mutationCache.notify({\n mutation: this,\n type: \"updated\",\n action\n });\n });\n }\n};\nfunction getDefaultState() {\n return {\n context: void 0,\n data: void 0,\n error: null,\n failureCount: 0,\n failureReason: null,\n isPaused: false,\n status: \"idle\",\n variables: void 0,\n submittedAt: 0\n };\n}\nexport {\n Mutation,\n getDefaultState\n};\n//# sourceMappingURL=mutation.js.map","// src/focusManager.ts\nimport { Subscribable } from \"./subscribable.js\";\nimport { isServer } from \"./utils.js\";\nvar FocusManager = class extends Subscribable {\n #focused;\n #cleanup;\n #setup;\n constructor() {\n super();\n this.#setup = (onFocus) => {\n if (!isServer && window.addEventListener) {\n const listener = () => onFocus();\n window.addEventListener(\"visibilitychange\", listener, false);\n return () => {\n window.removeEventListener(\"visibilitychange\", listener);\n };\n }\n return;\n };\n }\n onSubscribe() {\n if (!this.#cleanup) {\n this.setEventListener(this.#setup);\n }\n }\n onUnsubscribe() {\n if (!this.hasListeners()) {\n this.#cleanup?.();\n this.#cleanup = void 0;\n }\n }\n setEventListener(setup) {\n this.#setup = setup;\n this.#cleanup?.();\n this.#cleanup = setup((focused) => {\n if (typeof focused === \"boolean\") {\n this.setFocused(focused);\n } else {\n this.onFocus();\n }\n });\n }\n setFocused(focused) {\n const changed = this.#focused !== focused;\n if (changed) {\n this.#focused = focused;\n this.onFocus();\n }\n }\n onFocus() {\n const isFocused = this.isFocused();\n this.listeners.forEach((listener) => {\n listener(isFocused);\n });\n }\n isFocused() {\n if (typeof this.#focused === \"boolean\") {\n return this.#focused;\n }\n return globalThis.document?.visibilityState !== \"hidden\";\n }\n};\nvar focusManager = new FocusManager();\nexport {\n FocusManager,\n focusManager\n};\n//# sourceMappingURL=focusManager.js.map","// src/utils.ts\nvar isServer = typeof window === \"undefined\" || \"Deno\" in globalThis;\nfunction noop() {\n}\nfunction functionalUpdate(updater, input) {\n return typeof updater === \"function\" ? updater(input) : updater;\n}\nfunction isValidTimeout(value) {\n return typeof value === \"number\" && value >= 0 && value !== Infinity;\n}\nfunction timeUntilStale(updatedAt, staleTime) {\n return Math.max(updatedAt + (staleTime || 0) - Date.now(), 0);\n}\nfunction resolveStaleTime(staleTime, query) {\n return typeof staleTime === \"function\" ? staleTime(query) : staleTime;\n}\nfunction resolveEnabled(enabled, query) {\n return typeof enabled === \"function\" ? enabled(query) : enabled;\n}\nfunction matchQuery(filters, query) {\n const {\n type = \"all\",\n exact,\n fetchStatus,\n predicate,\n queryKey,\n stale\n } = filters;\n if (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 if (type !== \"all\") {\n const isActive = query.isActive();\n if (type === \"active\" && !isActive) {\n return false;\n }\n if (type === \"inactive\" && isActive) {\n return false;\n }\n }\n if (typeof stale === \"boolean\" && query.isStale() !== stale) {\n return false;\n }\n if (fetchStatus && fetchStatus !== query.state.fetchStatus) {\n return false;\n }\n if (predicate && !predicate(query)) {\n return false;\n }\n return true;\n}\nfunction matchMutation(filters, mutation) {\n const { exact, status, predicate, mutationKey } = filters;\n if (mutationKey) {\n if (!mutation.options.mutationKey) {\n return false;\n }\n if (exact) {\n if (hashKey(mutation.options.mutationKey) !== hashKey(mutationKey)) {\n return false;\n }\n } else if (!partialMatchKey(mutation.options.mutationKey, mutationKey)) {\n return false;\n }\n }\n if (status && mutation.state.status !== status) {\n return false;\n }\n if (predicate && !predicate(mutation)) {\n return false;\n }\n return true;\n}\nfunction hashQueryKeyByOptions(queryKey, options) {\n const hashFn = options?.queryKeyHashFn || hashKey;\n return hashFn(queryKey);\n}\nfunction hashKey(queryKey) {\n return JSON.stringify(\n queryKey,\n (_, val) => isPlainObject(val) ? Object.keys(val).sort().reduce((result, key) => {\n result[key] = val[key];\n return result;\n }, {}) : val\n );\n}\nfunction partialMatchKey(a, b) {\n if (a === b) {\n return true;\n }\n if (typeof a !== typeof b) {\n return false;\n }\n if (a && b && typeof a === \"object\" && typeof b === \"object\") {\n return !Object.keys(b).some((key) => !partialMatchKey(a[key], b[key]));\n }\n return false;\n}\nfunction replaceEqualDeep(a, b) {\n if (a === b) {\n return a;\n }\n const array = isPlainArray(a) && isPlainArray(b);\n if (array || isPlainObject(a) && isPlainObject(b)) {\n const aItems = array ? a : Object.keys(a);\n const aSize = aItems.length;\n const bItems = array ? b : Object.keys(b);\n const bSize = bItems.length;\n const copy = array ? [] : {};\n let equalItems = 0;\n for (let i = 0; i < bSize; i++) {\n const key = array ? i : bItems[i];\n if ((!array && aItems.includes(key) || array) && a[key] === void 0 && b[key] === void 0) {\n copy[key] = void 0;\n equalItems++;\n } else {\n copy[key] = replaceEqualDeep(a[key], b[key]);\n if (copy[key] === a[key] && a[key] !== void 0) {\n equalItems++;\n }\n }\n }\n return aSize === bSize && equalItems === aSize ? a : copy;\n }\n return b;\n}\nfunction shallowEqualObjects(a, b) {\n if (!b || Object.keys(a).length !== Object.keys(b).length) {\n return false;\n }\n for (const key in a) {\n if (a[key] !== b[key]) {\n return false;\n }\n }\n return true;\n}\nfunction isPlainArray(value) {\n return Array.isArray(value) && value.length === Object.keys(value).length;\n}\nfunction isPlainObject(o) {\n if (!hasObjectPrototype(o)) {\n return false;\n }\n const ctor = o.constructor;\n if (ctor === void 0) {\n return true;\n }\n const prot = ctor.prototype;\n if (!hasObjectPrototype(prot)) {\n return false;\n }\n if (!prot.hasOwnProperty(\"isPrototypeOf\")) {\n return false;\n }\n if (Object.getPrototypeOf(o) !== Object.prototype) {\n return false;\n }\n return true;\n}\nfunction hasObjectPrototype(o) {\n return Object.prototype.toString.call(o) === \"[object Object]\";\n}\nfunction sleep(timeout) {\n return new Promise((resolve) => {\n setTimeout(resolve, timeout);\n });\n}\nfunction replaceData(prevData, data, options) {\n if (typeof options.structuralSharing === \"function\") {\n return options.structuralSharing(prevData, data);\n } else if (options.structuralSharing !== false) {\n if (process.env.NODE_ENV !== \"production\") {\n try {\n return replaceEqualDeep(prevData, data);\n } catch (error) {\n console.error(\n `Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${options.queryHash}]: ${error}`\n );\n }\n }\n return replaceEqualDeep(prevData, data);\n }\n return data;\n}\nfunction keepPreviousData(previousData) {\n return previousData;\n}\nfunction addToEnd(items, item, max = 0) {\n const newItems = [...items, item];\n return max && newItems.length > max ? newItems.slice(1) : newItems;\n}\nfunction addToStart(items, item, max = 0) {\n const newItems = [item, ...items];\n return max && newItems.length > max ? newItems.slice(0, -1) : newItems;\n}\nvar skipToken = Symbol();\nfunction ensureQueryFn(options, fetchOptions) {\n if (process.env.NODE_ENV !== \"production\") {\n if (options.queryFn === skipToken) {\n console.error(\n `Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${options.queryHash}'`\n );\n }\n }\n if (!options.queryFn && fetchOptions?.initialPromise) {\n return () => fetchOptions.initialPromise;\n }\n if (!options.queryFn || options.queryFn === skipToken) {\n return () => Promise.reject(new Error(`Missing queryFn: '${options.queryHash}'`));\n }\n return options.queryFn;\n}\nexport {\n addToEnd,\n addToStart,\n ensureQueryFn,\n functionalUpdate,\n hashKey,\n hashQueryKeyByOptions,\n isPlainArray,\n isPlainObject,\n isServer,\n isValidTimeout,\n keepPreviousData,\n matchMutation,\n matchQuery,\n noop,\n partialMatchKey,\n replaceData,\n replaceEqualDeep,\n resolveEnabled,\n resolveStaleTime,\n shallowEqualObjects,\n skipToken,\n sleep,\n timeUntilStale\n};\n//# sourceMappingURL=utils.js.map","// src/removable.ts\nimport { isServer, isValidTimeout } from \"./utils.js\";\nvar Removable = class {\n #gcTimeout;\n destroy() {\n this.clearGcTimeout();\n }\n scheduleGc() {\n this.clearGcTimeout();\n if (isValidTimeout(this.gcTime)) {\n this.#gcTimeout = setTimeout(() => {\n this.optionalRemove();\n }, this.gcTime);\n }\n }\n updateGcTime(newGcTime) {\n this.gcTime = Math.max(\n this.gcTime || 0,\n newGcTime ?? (isServer ? Infinity : 5 * 60 * 1e3)\n );\n }\n clearGcTimeout() {\n if (this.#gcTimeout) {\n clearTimeout(this.#gcTimeout);\n this.#gcTimeout = void 0;\n }\n }\n};\nexport {\n Removable\n};\n//# sourceMappingURL=removable.js.map","// src/thenable.ts\nfunction pendingThenable() {\n let resolve;\n let reject;\n const thenable = new Promise((_resolve, _reject) => {\n resolve = _resolve;\n reject = _reject;\n });\n thenable.status = \"pending\";\n thenable.catch(() => {\n });\n function finalize(data) {\n Object.assign(thenable, data);\n delete thenable.resolve;\n delete thenable.reject;\n }\n thenable.resolve = (value) => {\n finalize({\n status: \"fulfilled\",\n value\n });\n resolve(value);\n };\n thenable.reject = (reason) => {\n finalize({\n status: \"rejected\",\n reason\n });\n reject(reason);\n };\n return thenable;\n}\nexport {\n pendingThenable\n};\n//# sourceMappingURL=thenable.js.map"],"names":[],"sourceRoot":"","ignoreList":[0,1,2,3,5,6,7,8,9]}