import { r as __toESM, t as __commonJSMin } from "./chunk-CYJPkc-J.js"; import { t as require_react } from "./react.js"; //#region node_modules/.pnpm/@tanstack+query-core@5.100.9/node_modules/@tanstack/query-core/build/modern/subscribable.js var Subscribable = class { constructor() { this.listeners = /* @__PURE__ */ new Set(); this.subscribe = this.subscribe.bind(this); } subscribe(listener) { this.listeners.add(listener); this.onSubscribe(); return () => { this.listeners.delete(listener); this.onUnsubscribe(); }; } hasListeners() { return this.listeners.size > 0; } onSubscribe() {} onUnsubscribe() {} }; //#endregion //#region node_modules/.pnpm/@tanstack+query-core@5.100.9/node_modules/@tanstack/query-core/build/modern/focusManager.js var FocusManager = class extends Subscribable { #focused; #cleanup; #setup; constructor() { super(); this.#setup = (onFocus) => { if (typeof window !== "undefined" && window.addEventListener) { const listener = () => onFocus(); window.addEventListener("visibilitychange", listener, false); return () => { window.removeEventListener("visibilitychange", listener); }; } }; } onSubscribe() { if (!this.#cleanup) this.setEventListener(this.#setup); } onUnsubscribe() { if (!this.hasListeners()) { this.#cleanup?.(); this.#cleanup = void 0; } } setEventListener(setup) { this.#setup = setup; this.#cleanup?.(); this.#cleanup = setup((focused) => { if (typeof focused === "boolean") this.setFocused(focused); else this.onFocus(); }); } setFocused(focused) { if (this.#focused !== focused) { this.#focused = focused; this.onFocus(); } } onFocus() { const isFocused = this.isFocused(); this.listeners.forEach((listener) => { listener(isFocused); }); } isFocused() { if (typeof this.#focused === "boolean") return this.#focused; return globalThis.document?.visibilityState !== "hidden"; } }; var focusManager = new FocusManager(); //#endregion //#region node_modules/.pnpm/@tanstack+query-core@5.100.9/node_modules/@tanstack/query-core/build/modern/timeoutManager.js var defaultTimeoutProvider = { setTimeout: (callback, delay) => setTimeout(callback, delay), clearTimeout: (timeoutId) => clearTimeout(timeoutId), setInterval: (callback, delay) => setInterval(callback, delay), clearInterval: (intervalId) => clearInterval(intervalId) }; var TimeoutManager = class { #provider = defaultTimeoutProvider; #providerCalled = false; setTimeoutProvider(provider) { if (this.#providerCalled && provider !== this.#provider) console.error(`[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.`, { previous: this.#provider, provider }); this.#provider = provider; this.#providerCalled = false; } setTimeout(callback, delay) { this.#providerCalled = true; return this.#provider.setTimeout(callback, delay); } clearTimeout(timeoutId) { this.#provider.clearTimeout(timeoutId); } setInterval(callback, delay) { this.#providerCalled = true; return this.#provider.setInterval(callback, delay); } clearInterval(intervalId) { this.#provider.clearInterval(intervalId); } }; var timeoutManager = new TimeoutManager(); function systemSetTimeoutZero(callback) { setTimeout(callback, 0); } //#endregion //#region node_modules/.pnpm/@tanstack+query-core@5.100.9/node_modules/@tanstack/query-core/build/modern/utils.js var isServer = typeof window === "undefined" || "Deno" in globalThis; function noop() {} function functionalUpdate(updater, input) { return typeof updater === "function" ? updater(input) : updater; } function isValidTimeout(value) { return typeof value === "number" && value >= 0 && value !== Infinity; } function timeUntilStale(updatedAt, staleTime) { return Math.max(updatedAt + (staleTime || 0) - Date.now(), 0); } function resolveStaleTime(staleTime, query) { return typeof staleTime === "function" ? staleTime(query) : staleTime; } function resolveQueryBoolean(option, query) { return typeof option === "function" ? option(query) : option; } function matchQuery(filters, query) { const { type = "all", exact, fetchStatus, predicate, queryKey, stale } = filters; if (queryKey) { if (exact) { if (query.queryHash !== hashQueryKeyByOptions(queryKey, query.options)) return false; } else if (!partialMatchKey(query.queryKey, queryKey)) return false; } if (type !== "all") { const isActive = query.isActive(); if (type === "active" && !isActive) return false; if (type === "inactive" && isActive) return false; } if (typeof stale === "boolean" && query.isStale() !== stale) return false; if (fetchStatus && fetchStatus !== query.state.fetchStatus) return false; if (predicate && !predicate(query)) return false; return true; } function matchMutation(filters, mutation) { const { exact, status, predicate, mutationKey } = filters; if (mutationKey) { if (!mutation.options.mutationKey) return false; if (exact) { if (hashKey(mutation.options.mutationKey) !== hashKey(mutationKey)) return false; } else if (!partialMatchKey(mutation.options.mutationKey, mutationKey)) return false; } if (status && mutation.state.status !== status) return false; if (predicate && !predicate(mutation)) return false; return true; } function hashQueryKeyByOptions(queryKey, options) { return (options?.queryKeyHashFn || hashKey)(queryKey); } function hashKey(queryKey) { return JSON.stringify(queryKey, (_, val) => isPlainObject(val) ? Object.keys(val).sort().reduce((result, key) => { result[key] = val[key]; return result; }, {}) : val); } function partialMatchKey(a, b) { if (a === b) return true; if (typeof a !== typeof b) return false; if (a && b && typeof a === "object" && typeof b === "object") return Object.keys(b).every((key) => partialMatchKey(a[key], b[key])); return false; } var hasOwn = Object.prototype.hasOwnProperty; function replaceEqualDeep(a, b, depth = 0) { if (a === b) return a; if (depth > 500) return b; const array = isPlainArray(a) && isPlainArray(b); if (!array && !(isPlainObject(a) && isPlainObject(b))) return b; const aSize = (array ? a : Object.keys(a)).length; const bItems = array ? b : Object.keys(b); const bSize = bItems.length; const copy = array ? new Array(bSize) : {}; let equalItems = 0; for (let i = 0; i < bSize; i++) { const key = array ? i : bItems[i]; const aItem = a[key]; const bItem = b[key]; if (aItem === bItem) { copy[key] = aItem; if (array ? i < aSize : hasOwn.call(a, key)) equalItems++; continue; } if (aItem === null || bItem === null || typeof aItem !== "object" || typeof bItem !== "object") { copy[key] = bItem; continue; } const v = replaceEqualDeep(aItem, bItem, depth + 1); copy[key] = v; if (v === aItem) equalItems++; } return aSize === bSize && equalItems === aSize ? a : copy; } function shallowEqualObjects(a, b) { if (!b || Object.keys(a).length !== Object.keys(b).length) return false; for (const key in a) if (a[key] !== b[key]) return false; return true; } function isPlainArray(value) { return Array.isArray(value) && value.length === Object.keys(value).length; } function isPlainObject(o) { if (!hasObjectPrototype(o)) return false; const ctor = o.constructor; if (ctor === void 0) return true; const prot = ctor.prototype; if (!hasObjectPrototype(prot)) return false; if (!prot.hasOwnProperty("isPrototypeOf")) return false; if (Object.getPrototypeOf(o) !== Object.prototype) return false; return true; } function hasObjectPrototype(o) { return Object.prototype.toString.call(o) === "[object Object]"; } function sleep(timeout) { return new Promise((resolve) => { timeoutManager.setTimeout(resolve, timeout); }); } function replaceData(prevData, data, options) { if (typeof options.structuralSharing === "function") return options.structuralSharing(prevData, data); else if (options.structuralSharing !== false) { try { return replaceEqualDeep(prevData, data); } catch (error) { console.error(`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}`); throw error; } return replaceEqualDeep(prevData, data); } return data; } function keepPreviousData(previousData) { return previousData; } function addToEnd(items, item, max = 0) { const newItems = [...items, item]; return max && newItems.length > max ? newItems.slice(1) : newItems; } function addToStart(items, item, max = 0) { const newItems = [item, ...items]; return max && newItems.length > max ? newItems.slice(0, -1) : newItems; } var skipToken = /* @__PURE__ */ Symbol(); function ensureQueryFn(options, fetchOptions) { if (options.queryFn === skipToken) console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${options.queryHash}'`); if (!options.queryFn && fetchOptions?.initialPromise) return () => fetchOptions.initialPromise; if (!options.queryFn || options.queryFn === skipToken) return () => Promise.reject(/* @__PURE__ */ new Error(`Missing queryFn: '${options.queryHash}'`)); return options.queryFn; } function shouldThrowError(throwOnError, params) { if (typeof throwOnError === "function") return throwOnError(...params); return !!throwOnError; } function addConsumeAwareSignal(object, getSignal, onCancelled) { let consumed = false; let signal; Object.defineProperty(object, "signal", { enumerable: true, get: () => { signal ??= getSignal(); if (consumed) return signal; consumed = true; if (signal.aborted) onCancelled(); else signal.addEventListener("abort", onCancelled, { once: true }); return signal; } }); return object; } //#endregion //#region node_modules/.pnpm/@tanstack+query-core@5.100.9/node_modules/@tanstack/query-core/build/modern/environmentManager.js var environmentManager = /* @__PURE__ */ (() => { let isServerFn = () => isServer; return { /** * Returns whether the current runtime should be treated as a server environment. */ isServer() { return isServerFn(); }, /** * Overrides the server check globally. */ setIsServer(isServerValue) { isServerFn = isServerValue; } }; })(); //#endregion //#region node_modules/.pnpm/@tanstack+query-core@5.100.9/node_modules/@tanstack/query-core/build/modern/thenable.js function pendingThenable() { let resolve; let reject; const thenable = new Promise((_resolve, _reject) => { resolve = _resolve; reject = _reject; }); thenable.status = "pending"; thenable.catch(() => {}); function finalize(data) { Object.assign(thenable, data); delete thenable.resolve; delete thenable.reject; } thenable.resolve = (value) => { finalize({ status: "fulfilled", value }); resolve(value); }; thenable.reject = (reason) => { finalize({ status: "rejected", reason }); reject(reason); }; return thenable; } function tryResolveSync(promise) { let data; promise.then((result) => { data = result; return result; }, noop)?.catch(noop); if (data !== void 0) return { data }; } //#endregion //#region node_modules/.pnpm/@tanstack+query-core@5.100.9/node_modules/@tanstack/query-core/build/modern/hydration.js function defaultTransformerFn(data) { return data; } function dehydrateMutation(mutation) { return { mutationKey: mutation.options.mutationKey, state: mutation.state, ...mutation.options.scope && { scope: mutation.options.scope }, ...mutation.meta && { meta: mutation.meta } }; } function dehydrateQuery(query, serializeData, shouldRedactErrors) { const dehydratePromise = () => { const promise = query.promise?.then(serializeData).catch((error) => { if (!shouldRedactErrors(error)) return Promise.reject(error); console.error(`A query that was dehydrated as pending ended up rejecting. [${query.queryHash}]: ${error}; The error will be redacted in production builds`); return Promise.reject(/* @__PURE__ */ new Error("redacted")); }); promise?.catch(noop); return promise; }; return { dehydratedAt: Date.now(), state: { ...query.state, ...query.state.data !== void 0 && { data: serializeData(query.state.data) } }, queryKey: query.queryKey, queryHash: query.queryHash, ...query.state.status === "pending" && { promise: dehydratePromise() }, ...query.meta && { meta: query.meta }, ...query.queryType && { queryType: query.queryType } }; } function defaultShouldDehydrateMutation(mutation) { return mutation.state.isPaused; } function defaultShouldDehydrateQuery(query) { return query.state.status === "success"; } function defaultShouldRedactErrors(_) { return true; } function dehydrate(client, options = {}) { const filterMutation = options.shouldDehydrateMutation ?? client.getDefaultOptions().dehydrate?.shouldDehydrateMutation ?? defaultShouldDehydrateMutation; const mutations = client.getMutationCache().getAll().flatMap((mutation) => filterMutation(mutation) ? [dehydrateMutation(mutation)] : []); const filterQuery = options.shouldDehydrateQuery ?? client.getDefaultOptions().dehydrate?.shouldDehydrateQuery ?? defaultShouldDehydrateQuery; const shouldRedactErrors = options.shouldRedactErrors ?? client.getDefaultOptions().dehydrate?.shouldRedactErrors ?? defaultShouldRedactErrors; const serializeData = options.serializeData ?? client.getDefaultOptions().dehydrate?.serializeData ?? defaultTransformerFn; return { mutations, queries: client.getQueryCache().getAll().flatMap((query) => filterQuery(query) ? [dehydrateQuery(query, serializeData, shouldRedactErrors)] : []) }; } function hydrate(client, dehydratedState, options) { if (typeof dehydratedState !== "object" || dehydratedState === null) return; const mutationCache = client.getMutationCache(); const queryCache = client.getQueryCache(); const deserializeData = options?.defaultOptions?.deserializeData ?? client.getDefaultOptions().hydrate?.deserializeData ?? defaultTransformerFn; const mutations = dehydratedState.mutations || []; const queries = dehydratedState.queries || []; mutations.forEach(({ state, ...mutationOptions }) => { mutationCache.build(client, { ...client.getDefaultOptions().hydrate?.mutations, ...options?.defaultOptions?.mutations, ...mutationOptions }, state); }); queries.forEach(({ queryKey, state, queryHash, meta, promise, dehydratedAt, queryType }) => { const syncData = promise ? tryResolveSync(promise) : void 0; const rawData = state.data === void 0 ? syncData?.data : state.data; const data = rawData === void 0 ? rawData : deserializeData(rawData); let query = queryCache.get(queryHash); const existingQueryIsPending = query?.state.status === "pending"; const existingQueryIsFetching = query?.state.fetchStatus === "fetching"; if (query) { const hasNewerSyncData = syncData && dehydratedAt !== void 0 && dehydratedAt > query.state.dataUpdatedAt; if (state.dataUpdatedAt > query.state.dataUpdatedAt || hasNewerSyncData) { const { fetchStatus: _ignored, ...serializedState } = state; query.setState({ ...serializedState, data, ...state.status === "pending" && data !== void 0 && { status: "success", ...!existingQueryIsFetching && { fetchStatus: "idle" } } }); } } else query = queryCache.build(client, { ...client.getDefaultOptions().hydrate?.queries, ...options?.defaultOptions?.queries, queryKey, queryHash, meta, _type: queryType }, { ...state, data, fetchStatus: "idle", status: state.status === "pending" && data !== void 0 ? "success" : state.status }); if (promise && !syncData && !existingQueryIsPending && !existingQueryIsFetching && (dehydratedAt === void 0 || dehydratedAt > query.state.dataUpdatedAt)) query.fetch(void 0, { initialPromise: Promise.resolve(promise).then(deserializeData) }).catch(noop); }); } //#endregion //#region node_modules/.pnpm/@tanstack+query-core@5.100.9/node_modules/@tanstack/query-core/build/modern/notifyManager.js var defaultScheduler = systemSetTimeoutZero; function createNotifyManager() { let queue = []; let transactions = 0; let notifyFn = (callback) => { callback(); }; let batchNotifyFn = (callback) => { callback(); }; let scheduleFn = defaultScheduler; const schedule = (callback) => { if (transactions) queue.push(callback); else scheduleFn(() => { notifyFn(callback); }); }; const flush = () => { const originalQueue = queue; queue = []; if (originalQueue.length) scheduleFn(() => { batchNotifyFn(() => { originalQueue.forEach((callback) => { notifyFn(callback); }); }); }); }; return { batch: (callback) => { let result; transactions++; try { result = callback(); } finally { transactions--; if (!transactions) flush(); } return result; }, /** * All calls to the wrapped function will be batched. */ batchCalls: (callback) => { return (...args) => { schedule(() => { callback(...args); }); }; }, schedule, /** * Use this method to set a custom notify function. * This can be used to for example wrap notifications with `React.act` while running tests. */ setNotifyFunction: (fn) => { notifyFn = fn; }, /** * Use this method to set a custom function to batch notifications together into a single tick. * By default React Query will use the batch function provided by ReactDOM or React Native. */ setBatchNotifyFunction: (fn) => { batchNotifyFn = fn; }, setScheduler: (fn) => { scheduleFn = fn; } }; } var notifyManager = createNotifyManager(); //#endregion //#region node_modules/.pnpm/@tanstack+query-core@5.100.9/node_modules/@tanstack/query-core/build/modern/onlineManager.js var OnlineManager = class extends Subscribable { #online = true; #cleanup; #setup; constructor() { super(); this.#setup = (onOnline) => { if (typeof window !== "undefined" && window.addEventListener) { const onlineListener = () => onOnline(true); const offlineListener = () => onOnline(false); window.addEventListener("online", onlineListener, false); window.addEventListener("offline", offlineListener, false); return () => { window.removeEventListener("online", onlineListener); window.removeEventListener("offline", offlineListener); }; } }; } onSubscribe() { if (!this.#cleanup) this.setEventListener(this.#setup); } onUnsubscribe() { if (!this.hasListeners()) { this.#cleanup?.(); this.#cleanup = void 0; } } setEventListener(setup) { this.#setup = setup; this.#cleanup?.(); this.#cleanup = setup(this.setOnline.bind(this)); } setOnline(online) { if (this.#online !== online) { this.#online = online; this.listeners.forEach((listener) => { listener(online); }); } } isOnline() { return this.#online; } }; var onlineManager = new OnlineManager(); //#endregion //#region node_modules/.pnpm/@tanstack+query-core@5.100.9/node_modules/@tanstack/query-core/build/modern/retryer.js function defaultRetryDelay(failureCount) { return Math.min(1e3 * 2 ** failureCount, 3e4); } function canFetch(networkMode) { return (networkMode ?? "online") === "online" ? onlineManager.isOnline() : true; } var CancelledError = class extends Error { constructor(options) { super("CancelledError"); this.revert = options?.revert; this.silent = options?.silent; } }; function isCancelledError(value) { return value instanceof CancelledError; } function createRetryer(config) { let isRetryCancelled = false; let failureCount = 0; let continueFn; const thenable = pendingThenable(); const isResolved = () => thenable.status !== "pending"; const cancel = (cancelOptions) => { if (!isResolved()) { const error = new CancelledError(cancelOptions); reject(error); config.onCancel?.(error); } }; const cancelRetry = () => { isRetryCancelled = true; }; const continueRetry = () => { isRetryCancelled = false; }; const canContinue = () => focusManager.isFocused() && (config.networkMode === "always" || onlineManager.isOnline()) && config.canRun(); const canStart = () => canFetch(config.networkMode) && config.canRun(); const resolve = (value) => { if (!isResolved()) { continueFn?.(); thenable.resolve(value); } }; const reject = (value) => { if (!isResolved()) { continueFn?.(); thenable.reject(value); } }; const pause = () => { return new Promise((continueResolve) => { continueFn = (value) => { if (isResolved() || canContinue()) continueResolve(value); }; config.onPause?.(); }).then(() => { continueFn = void 0; if (!isResolved()) config.onContinue?.(); }); }; const run = () => { if (isResolved()) return; let promiseOrValue; const initialPromise = failureCount === 0 ? config.initialPromise : void 0; try { promiseOrValue = initialPromise ?? config.fn(); } catch (error) { promiseOrValue = Promise.reject(error); } Promise.resolve(promiseOrValue).then(resolve).catch((error) => { if (isResolved()) return; const retry = config.retry ?? (environmentManager.isServer() ? 0 : 3); const retryDelay = config.retryDelay ?? defaultRetryDelay; const delay = typeof retryDelay === "function" ? retryDelay(failureCount, error) : retryDelay; const shouldRetry = retry === true || typeof retry === "number" && failureCount < retry || typeof retry === "function" && retry(failureCount, error); if (isRetryCancelled || !shouldRetry) { reject(error); return; } failureCount++; config.onFail?.(failureCount, error); sleep(delay).then(() => { return canContinue() ? void 0 : pause(); }).then(() => { if (isRetryCancelled) reject(error); else run(); }); }); }; return { promise: thenable, status: () => thenable.status, cancel, continue: () => { continueFn?.(); return thenable; }, cancelRetry, continueRetry, canStart, start: () => { if (canStart()) run(); else pause().then(run); return thenable; } }; } //#endregion //#region node_modules/.pnpm/@tanstack+query-core@5.100.9/node_modules/@tanstack/query-core/build/modern/removable.js var Removable = class { #gcTimeout; destroy() { this.clearGcTimeout(); } scheduleGc() { this.clearGcTimeout(); if (isValidTimeout(this.gcTime)) this.#gcTimeout = timeoutManager.setTimeout(() => { this.optionalRemove(); }, this.gcTime); } updateGcTime(newGcTime) { this.gcTime = Math.max(this.gcTime || 0, newGcTime ?? (environmentManager.isServer() ? Infinity : 300 * 1e3)); } clearGcTimeout() { if (this.#gcTimeout !== void 0) { timeoutManager.clearTimeout(this.#gcTimeout); this.#gcTimeout = void 0; } } }; //#endregion //#region node_modules/.pnpm/@tanstack+query-core@5.100.9/node_modules/@tanstack/query-core/build/modern/infiniteQueryBehavior.js function infiniteQueryBehavior(pages) { return { onFetch: (context, query) => { const options = context.options; const direction = context.fetchOptions?.meta?.fetchMore?.direction; const oldPages = context.state.data?.pages || []; const oldPageParams = context.state.data?.pageParams || []; let result = { pages: [], pageParams: [] }; let currentPage = 0; const fetchFn = async () => { let cancelled = false; const addSignalProperty = (object) => { addConsumeAwareSignal(object, () => context.signal, () => cancelled = true); }; const queryFn = ensureQueryFn(context.options, context.fetchOptions); const fetchPage = async (data, param, previous) => { if (cancelled) return Promise.reject(context.signal.reason); if (param == null && data.pages.length) return Promise.resolve(data); const createQueryFnContext = () => { const queryFnContext2 = { client: context.client, queryKey: context.queryKey, pageParam: param, direction: previous ? "backward" : "forward", meta: context.options.meta }; addSignalProperty(queryFnContext2); return queryFnContext2; }; const page = await queryFn(createQueryFnContext()); const { maxPages } = context.options; const addTo = previous ? addToStart : addToEnd; return { pages: addTo(data.pages, page, maxPages), pageParams: addTo(data.pageParams, param, maxPages) }; }; if (direction && oldPages.length) { const previous = direction === "backward"; const pageParamFn = previous ? getPreviousPageParam : getNextPageParam; const oldData = { pages: oldPages, pageParams: oldPageParams }; result = await fetchPage(oldData, pageParamFn(options, oldData), previous); } else { const remainingPages = pages ?? oldPages.length; do { const param = currentPage === 0 ? oldPageParams[0] ?? options.initialPageParam : getNextPageParam(options, result); if (currentPage > 0 && param == null) break; result = await fetchPage(result, param); currentPage++; } while (currentPage < remainingPages); } return result; }; if (context.options.persister) context.fetchFn = () => { return context.options.persister?.(fetchFn, { client: context.client, queryKey: context.queryKey, meta: context.options.meta, signal: context.signal }, query); }; else context.fetchFn = fetchFn; } }; } function getNextPageParam(options, { pages, pageParams }) { const lastIndex = pages.length - 1; return pages.length > 0 ? options.getNextPageParam(pages[lastIndex], pages, pageParams[lastIndex], pageParams) : void 0; } function getPreviousPageParam(options, { pages, pageParams }) { return pages.length > 0 ? options.getPreviousPageParam?.(pages[0], pages, pageParams[0], pageParams) : void 0; } function hasNextPage(options, data) { if (!data) return false; return getNextPageParam(options, data) != null; } function hasPreviousPage(options, data) { if (!data || !options.getPreviousPageParam) return false; return getPreviousPageParam(options, data) != null; } //#endregion //#region node_modules/.pnpm/@tanstack+query-core@5.100.9/node_modules/@tanstack/query-core/build/modern/query.js var Query = class extends Removable { #queryType; #initialState; #revertState; #cache; #client; #retryer; #defaultOptions; #abortSignalConsumed; constructor(config) { super(); this.#abortSignalConsumed = false; this.#defaultOptions = config.defaultOptions; this.setOptions(config.options); this.observers = []; this.#client = config.client; this.#cache = this.#client.getQueryCache(); this.queryKey = config.queryKey; this.queryHash = config.queryHash; this.#initialState = getDefaultState$1(this.options); this.state = config.state ?? this.#initialState; this.scheduleGc(); } get meta() { return this.options.meta; } get queryType() { return this.#queryType; } get promise() { return this.#retryer?.promise; } setOptions(options) { this.options = { ...this.#defaultOptions, ...options }; if (options?._type) this.#queryType = options._type; this.updateGcTime(this.options.gcTime); if (this.state && this.state.data === void 0) { const defaultState = getDefaultState$1(this.options); if (defaultState.data !== void 0) { this.setState(successState(defaultState.data, defaultState.dataUpdatedAt)); this.#initialState = defaultState; } } } optionalRemove() { if (!this.observers.length && this.state.fetchStatus === "idle") this.#cache.remove(this); } setData(newData, options) { const data = replaceData(this.state.data, newData, this.options); this.#dispatch({ data, type: "success", dataUpdatedAt: options?.updatedAt, manual: options?.manual }); return data; } setState(state) { this.#dispatch({ type: "setState", state }); } cancel(options) { const promise = this.#retryer?.promise; this.#retryer?.cancel(options); return promise ? promise.then(noop).catch(noop) : Promise.resolve(); } destroy() { super.destroy(); this.cancel({ silent: true }); } get resetState() { return this.#initialState; } reset() { this.destroy(); this.setState(this.resetState); } isActive() { return this.observers.some((observer) => resolveQueryBoolean(observer.options.enabled, this) !== false); } isDisabled() { if (this.getObserversCount() > 0) return !this.isActive(); return this.options.queryFn === skipToken || !this.isFetched(); } isFetched() { return this.state.dataUpdateCount + this.state.errorUpdateCount > 0; } isStatic() { if (this.getObserversCount() > 0) return this.observers.some((observer) => resolveStaleTime(observer.options.staleTime, this) === "static"); return false; } isStale() { if (this.getObserversCount() > 0) return this.observers.some((observer) => observer.getCurrentResult().isStale); return this.state.data === void 0 || this.state.isInvalidated; } isStaleByTime(staleTime = 0) { if (this.state.data === void 0) return true; if (staleTime === "static") return false; if (this.state.isInvalidated) return true; return !timeUntilStale(this.state.dataUpdatedAt, staleTime); } onFocus() { this.observers.find((x) => x.shouldFetchOnWindowFocus())?.refetch({ cancelRefetch: false }); this.#retryer?.continue(); } onOnline() { this.observers.find((x) => x.shouldFetchOnReconnect())?.refetch({ cancelRefetch: false }); this.#retryer?.continue(); } addObserver(observer) { if (!this.observers.includes(observer)) { this.observers.push(observer); this.clearGcTimeout(); this.#cache.notify({ type: "observerAdded", query: this, observer }); } } removeObserver(observer) { if (this.observers.includes(observer)) { this.observers = this.observers.filter((x) => x !== observer); if (!this.observers.length) { if (this.#retryer) if (this.#abortSignalConsumed || this.#isInitialPausedFetch()) this.#retryer.cancel({ revert: true }); else this.#retryer.cancelRetry(); this.scheduleGc(); } this.#cache.notify({ type: "observerRemoved", query: this, observer }); } } getObserversCount() { return this.observers.length; } #isInitialPausedFetch() { return this.state.fetchStatus === "paused" && this.state.status === "pending"; } invalidate() { if (!this.state.isInvalidated) this.#dispatch({ type: "invalidate" }); } async fetch(options, fetchOptions) { if (this.state.fetchStatus !== "idle" && this.#retryer?.status() !== "rejected") { if (this.state.data !== void 0 && fetchOptions?.cancelRefetch) this.cancel({ silent: true }); else if (this.#retryer) { this.#retryer.continueRetry(); return this.#retryer.promise; } } if (options) this.setOptions(options); if (!this.options.queryFn) { const observer = this.observers.find((x) => x.options.queryFn); if (observer) this.setOptions(observer.options); } if (!Array.isArray(this.options.queryKey)) console.error(`As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']`); const abortController = new AbortController(); const addSignalProperty = (object) => { Object.defineProperty(object, "signal", { enumerable: true, get: () => { this.#abortSignalConsumed = true; return abortController.signal; } }); }; const fetchFn = () => { const queryFn = ensureQueryFn(this.options, fetchOptions); const createQueryFnContext = () => { const queryFnContext2 = { client: this.#client, queryKey: this.queryKey, meta: this.meta }; addSignalProperty(queryFnContext2); return queryFnContext2; }; const queryFnContext = createQueryFnContext(); this.#abortSignalConsumed = false; if (this.options.persister) return this.options.persister(queryFn, queryFnContext, this); return queryFn(queryFnContext); }; const createFetchContext = () => { const context2 = { fetchOptions, options: this.options, queryKey: this.queryKey, client: this.#client, state: this.state, fetchFn }; addSignalProperty(context2); return context2; }; const context = createFetchContext(); (this.#queryType === "infinite" ? infiniteQueryBehavior(this.options.pages) : this.options.behavior)?.onFetch(context, this); this.#revertState = this.state; if (this.state.fetchStatus === "idle" || this.state.fetchMeta !== context.fetchOptions?.meta) this.#dispatch({ type: "fetch", meta: context.fetchOptions?.meta }); this.#retryer = createRetryer({ initialPromise: fetchOptions?.initialPromise, fn: context.fetchFn, onCancel: (error) => { if (error instanceof CancelledError && error.revert) this.setState({ ...this.#revertState, fetchStatus: "idle" }); abortController.abort(); }, onFail: (failureCount, error) => { this.#dispatch({ type: "failed", failureCount, error }); }, onPause: () => { this.#dispatch({ type: "pause" }); }, onContinue: () => { this.#dispatch({ type: "continue" }); }, retry: context.options.retry, retryDelay: context.options.retryDelay, networkMode: context.options.networkMode, canRun: () => true }); try { const data = await this.#retryer.start(); if (data === void 0) { console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`); throw new Error(`${this.queryHash} data is undefined`); } this.setData(data); this.#cache.config.onSuccess?.(data, this); this.#cache.config.onSettled?.(data, this.state.error, this); return data; } catch (error) { if (error instanceof CancelledError) { if (error.silent) return this.#retryer.promise; else if (error.revert) { if (this.state.data === void 0) throw error; return this.state.data; } } this.#dispatch({ type: "error", error }); this.#cache.config.onError?.(error, this); this.#cache.config.onSettled?.(this.state.data, error, this); throw error; } finally { this.scheduleGc(); } } #dispatch(action) { const reducer = (state) => { switch (action.type) { case "failed": return { ...state, fetchFailureCount: action.failureCount, fetchFailureReason: action.error }; case "pause": return { ...state, fetchStatus: "paused" }; case "continue": return { ...state, fetchStatus: "fetching" }; case "fetch": return { ...state, ...fetchState(state.data, this.options), fetchMeta: action.meta ?? null }; case "success": const newState = { ...state, ...successState(action.data, action.dataUpdatedAt), dataUpdateCount: state.dataUpdateCount + 1, ...!action.manual && { fetchStatus: "idle", fetchFailureCount: 0, fetchFailureReason: null } }; this.#revertState = action.manual ? newState : void 0; return newState; case "error": const error = action.error; return { ...state, error, errorUpdateCount: state.errorUpdateCount + 1, errorUpdatedAt: Date.now(), fetchFailureCount: state.fetchFailureCount + 1, fetchFailureReason: error, fetchStatus: "idle", status: "error", isInvalidated: true }; case "invalidate": return { ...state, isInvalidated: true }; case "setState": return { ...state, ...action.state }; } }; this.state = reducer(this.state); notifyManager.batch(() => { this.observers.forEach((observer) => { observer.onQueryUpdate(); }); this.#cache.notify({ query: this, type: "updated", action }); }); } }; function fetchState(data, options) { return { fetchFailureCount: 0, fetchFailureReason: null, fetchStatus: canFetch(options.networkMode) ? "fetching" : "paused", ...data === void 0 && { error: null, status: "pending" } }; } function successState(data, dataUpdatedAt) { return { data, dataUpdatedAt: dataUpdatedAt ?? Date.now(), error: null, isInvalidated: false, status: "success" }; } function getDefaultState$1(options) { const data = typeof options.initialData === "function" ? options.initialData() : options.initialData; const hasData = data !== void 0; const initialDataUpdatedAt = hasData ? typeof options.initialDataUpdatedAt === "function" ? options.initialDataUpdatedAt() : options.initialDataUpdatedAt : 0; return { data, dataUpdateCount: 0, dataUpdatedAt: hasData ? initialDataUpdatedAt ?? Date.now() : 0, error: null, errorUpdateCount: 0, errorUpdatedAt: 0, fetchFailureCount: 0, fetchFailureReason: null, fetchMeta: null, isInvalidated: false, status: hasData ? "success" : "pending", fetchStatus: "idle" }; } //#endregion //#region node_modules/.pnpm/@tanstack+query-core@5.100.9/node_modules/@tanstack/query-core/build/modern/queryObserver.js var QueryObserver = class extends Subscribable { constructor(client, options) { super(); this.options = options; this.#client = client; this.#selectError = null; this.#currentThenable = pendingThenable(); this.bindMethods(); this.setOptions(options); } #client; #currentQuery = void 0; #currentQueryInitialState = void 0; #currentResult = void 0; #currentResultState; #currentResultOptions; #currentThenable; #selectError; #selectFn; #selectResult; #lastQueryWithDefinedData; #staleTimeoutId; #refetchIntervalId; #currentRefetchInterval; #trackedProps = /* @__PURE__ */ new Set(); bindMethods() { this.refetch = this.refetch.bind(this); } onSubscribe() { if (this.listeners.size === 1) { this.#currentQuery.addObserver(this); if (shouldFetchOnMount(this.#currentQuery, this.options)) this.#executeFetch(); else this.updateResult(); this.#updateTimers(); } } onUnsubscribe() { if (!this.hasListeners()) this.destroy(); } shouldFetchOnReconnect() { return shouldFetchOn(this.#currentQuery, this.options, this.options.refetchOnReconnect); } shouldFetchOnWindowFocus() { return shouldFetchOn(this.#currentQuery, this.options, this.options.refetchOnWindowFocus); } destroy() { this.listeners = /* @__PURE__ */ new Set(); this.#clearStaleTimeout(); this.#clearRefetchInterval(); this.#currentQuery.removeObserver(this); } setOptions(options) { const prevOptions = this.options; const prevQuery = this.#currentQuery; this.options = this.#client.defaultQueryOptions(options); if (this.options.enabled !== void 0 && typeof this.options.enabled !== "boolean" && typeof this.options.enabled !== "function" && typeof resolveQueryBoolean(this.options.enabled, this.#currentQuery) !== "boolean") throw new Error("Expected enabled to be a boolean or a callback that returns a boolean"); this.#updateQuery(); this.#currentQuery.setOptions(this.options); if (prevOptions._defaulted && !shallowEqualObjects(this.options, prevOptions)) this.#client.getQueryCache().notify({ type: "observerOptionsUpdated", query: this.#currentQuery, observer: this }); const mounted = this.hasListeners(); if (mounted && shouldFetchOptionally(this.#currentQuery, prevQuery, this.options, prevOptions)) this.#executeFetch(); this.updateResult(); if (mounted && (this.#currentQuery !== prevQuery || resolveQueryBoolean(this.options.enabled, this.#currentQuery) !== resolveQueryBoolean(prevOptions.enabled, this.#currentQuery) || resolveStaleTime(this.options.staleTime, this.#currentQuery) !== resolveStaleTime(prevOptions.staleTime, this.#currentQuery))) this.#updateStaleTimeout(); const nextRefetchInterval = this.#computeRefetchInterval(); if (mounted && (this.#currentQuery !== prevQuery || resolveQueryBoolean(this.options.enabled, this.#currentQuery) !== resolveQueryBoolean(prevOptions.enabled, this.#currentQuery) || nextRefetchInterval !== this.#currentRefetchInterval)) this.#updateRefetchInterval(nextRefetchInterval); } getOptimisticResult(options) { const query = this.#client.getQueryCache().build(this.#client, options); const result = this.createResult(query, options); if (shouldAssignObserverCurrentProperties(this, result)) { this.#currentResult = result; this.#currentResultOptions = this.options; this.#currentResultState = this.#currentQuery.state; } return result; } getCurrentResult() { return this.#currentResult; } trackResult(result, onPropTracked) { return new Proxy(result, { get: (target, key) => { this.trackProp(key); onPropTracked?.(key); if (key === "promise") { this.trackProp("data"); if (!this.options.experimental_prefetchInRender && this.#currentThenable.status === "pending") this.#currentThenable.reject(/* @__PURE__ */ new Error("experimental_prefetchInRender feature flag is not enabled")); } return Reflect.get(target, key); } }); } trackProp(key) { this.#trackedProps.add(key); } getCurrentQuery() { return this.#currentQuery; } refetch({ ...options } = {}) { return this.fetch({ ...options }); } fetchOptimistic(options) { const defaultedOptions = this.#client.defaultQueryOptions(options); const query = this.#client.getQueryCache().build(this.#client, defaultedOptions); return query.fetch().then(() => this.createResult(query, defaultedOptions)); } fetch(fetchOptions) { return this.#executeFetch({ ...fetchOptions, cancelRefetch: fetchOptions.cancelRefetch ?? true }).then(() => { this.updateResult(); return this.#currentResult; }); } #executeFetch(fetchOptions) { this.#updateQuery(); let promise = this.#currentQuery.fetch(this.options, fetchOptions); if (!fetchOptions?.throwOnError) promise = promise.catch(noop); return promise; } #updateStaleTimeout() { this.#clearStaleTimeout(); const staleTime = resolveStaleTime(this.options.staleTime, this.#currentQuery); if (environmentManager.isServer() || this.#currentResult.isStale || !isValidTimeout(staleTime)) return; const timeout = timeUntilStale(this.#currentResult.dataUpdatedAt, staleTime) + 1; this.#staleTimeoutId = timeoutManager.setTimeout(() => { if (!this.#currentResult.isStale) this.updateResult(); }, timeout); } #computeRefetchInterval() { return (typeof this.options.refetchInterval === "function" ? this.options.refetchInterval(this.#currentQuery) : this.options.refetchInterval) ?? false; } #updateRefetchInterval(nextInterval) { this.#clearRefetchInterval(); this.#currentRefetchInterval = nextInterval; if (environmentManager.isServer() || resolveQueryBoolean(this.options.enabled, this.#currentQuery) === false || !isValidTimeout(this.#currentRefetchInterval) || this.#currentRefetchInterval === 0) return; this.#refetchIntervalId = timeoutManager.setInterval(() => { if (this.options.refetchIntervalInBackground || focusManager.isFocused()) this.#executeFetch(); }, this.#currentRefetchInterval); } #updateTimers() { this.#updateStaleTimeout(); this.#updateRefetchInterval(this.#computeRefetchInterval()); } #clearStaleTimeout() { if (this.#staleTimeoutId !== void 0) { timeoutManager.clearTimeout(this.#staleTimeoutId); this.#staleTimeoutId = void 0; } } #clearRefetchInterval() { if (this.#refetchIntervalId !== void 0) { timeoutManager.clearInterval(this.#refetchIntervalId); this.#refetchIntervalId = void 0; } } createResult(query, options) { const prevQuery = this.#currentQuery; const prevOptions = this.options; const prevResult = this.#currentResult; const prevResultState = this.#currentResultState; const prevResultOptions = this.#currentResultOptions; const queryInitialState = query !== prevQuery ? query.state : this.#currentQueryInitialState; const { state } = query; let newState = { ...state }; let isPlaceholderData = false; let data; if (options._optimisticResults) { const mounted = this.hasListeners(); const fetchOnMount = !mounted && shouldFetchOnMount(query, options); const fetchOptionally = mounted && shouldFetchOptionally(query, prevQuery, options, prevOptions); if (fetchOnMount || fetchOptionally) newState = { ...newState, ...fetchState(state.data, query.options) }; if (options._optimisticResults === "isRestoring") newState.fetchStatus = "idle"; } let { error, errorUpdatedAt, status } = newState; data = newState.data; let skipSelect = false; if (options.placeholderData !== void 0 && data === void 0 && status === "pending") { let placeholderData; if (prevResult?.isPlaceholderData && options.placeholderData === prevResultOptions?.placeholderData) { placeholderData = prevResult.data; skipSelect = true; } else placeholderData = typeof options.placeholderData === "function" ? options.placeholderData(this.#lastQueryWithDefinedData?.state.data, this.#lastQueryWithDefinedData) : options.placeholderData; if (placeholderData !== void 0) { status = "success"; data = replaceData(prevResult?.data, placeholderData, options); isPlaceholderData = true; } } if (options.select && data !== void 0 && !skipSelect) if (prevResult && data === prevResultState?.data && options.select === this.#selectFn) data = this.#selectResult; else try { this.#selectFn = options.select; data = options.select(data); data = replaceData(prevResult?.data, data, options); this.#selectResult = data; this.#selectError = null; } catch (selectError) { this.#selectError = selectError; } if (this.#selectError) { error = this.#selectError; data = this.#selectResult; errorUpdatedAt = Date.now(); status = "error"; } const isFetching = newState.fetchStatus === "fetching"; const isPending = status === "pending"; const isError = status === "error"; const isLoading = isPending && isFetching; const hasData = data !== void 0; const nextResult = { status, fetchStatus: newState.fetchStatus, isPending, isSuccess: status === "success", isError, isInitialLoading: isLoading, isLoading, data, dataUpdatedAt: newState.dataUpdatedAt, error, errorUpdatedAt, failureCount: newState.fetchFailureCount, failureReason: newState.fetchFailureReason, errorUpdateCount: newState.errorUpdateCount, isFetched: query.isFetched(), isFetchedAfterMount: newState.dataUpdateCount > queryInitialState.dataUpdateCount || newState.errorUpdateCount > queryInitialState.errorUpdateCount, isFetching, isRefetching: isFetching && !isPending, isLoadingError: isError && !hasData, isPaused: newState.fetchStatus === "paused", isPlaceholderData, isRefetchError: isError && hasData, isStale: isStale(query, options), refetch: this.refetch, promise: this.#currentThenable, isEnabled: resolveQueryBoolean(options.enabled, query) !== false }; if (this.options.experimental_prefetchInRender) { const hasResultData = nextResult.data !== void 0; const isErrorWithoutData = nextResult.status === "error" && !hasResultData; const finalizeThenableIfPossible = (thenable) => { if (isErrorWithoutData) thenable.reject(nextResult.error); else if (hasResultData) thenable.resolve(nextResult.data); }; const recreateThenable = () => { finalizeThenableIfPossible(this.#currentThenable = nextResult.promise = pendingThenable()); }; const prevThenable = this.#currentThenable; switch (prevThenable.status) { case "pending": if (query.queryHash === prevQuery.queryHash) finalizeThenableIfPossible(prevThenable); break; case "fulfilled": if (isErrorWithoutData || nextResult.data !== prevThenable.value) recreateThenable(); break; case "rejected": if (!isErrorWithoutData || nextResult.error !== prevThenable.reason) recreateThenable(); break; } } return nextResult; } updateResult() { const prevResult = this.#currentResult; const nextResult = this.createResult(this.#currentQuery, this.options); this.#currentResultState = this.#currentQuery.state; this.#currentResultOptions = this.options; if (this.#currentResultState.data !== void 0) this.#lastQueryWithDefinedData = this.#currentQuery; if (shallowEqualObjects(nextResult, prevResult)) return; this.#currentResult = nextResult; const shouldNotifyListeners = () => { if (!prevResult) return true; const { notifyOnChangeProps } = this.options; const notifyOnChangePropsValue = typeof notifyOnChangeProps === "function" ? notifyOnChangeProps() : notifyOnChangeProps; if (notifyOnChangePropsValue === "all" || !notifyOnChangePropsValue && !this.#trackedProps.size) return true; const includedProps = new Set(notifyOnChangePropsValue ?? this.#trackedProps); if (this.options.throwOnError) includedProps.add("error"); return Object.keys(this.#currentResult).some((key) => { const typedKey = key; return this.#currentResult[typedKey] !== prevResult[typedKey] && includedProps.has(typedKey); }); }; this.#notify({ listeners: shouldNotifyListeners() }); } #updateQuery() { const query = this.#client.getQueryCache().build(this.#client, this.options); if (query === this.#currentQuery) return; const prevQuery = this.#currentQuery; this.#currentQuery = query; this.#currentQueryInitialState = query.state; if (this.hasListeners()) { prevQuery?.removeObserver(this); query.addObserver(this); } } onQueryUpdate() { this.updateResult(); if (this.hasListeners()) this.#updateTimers(); } #notify(notifyOptions) { notifyManager.batch(() => { if (notifyOptions.listeners) this.listeners.forEach((listener) => { listener(this.#currentResult); }); this.#client.getQueryCache().notify({ query: this.#currentQuery, type: "observerResultsUpdated" }); }); } }; function shouldLoadOnMount(query, options) { return resolveQueryBoolean(options.enabled, query) !== false && query.state.data === void 0 && !(query.state.status === "error" && resolveQueryBoolean(options.retryOnMount, query) === false); } function shouldFetchOnMount(query, options) { return shouldLoadOnMount(query, options) || query.state.data !== void 0 && shouldFetchOn(query, options, options.refetchOnMount); } function shouldFetchOn(query, options, field) { if (resolveQueryBoolean(options.enabled, query) !== false && resolveStaleTime(options.staleTime, query) !== "static") { const value = typeof field === "function" ? field(query) : field; return value === "always" || value !== false && isStale(query, options); } return false; } function shouldFetchOptionally(query, prevQuery, options, prevOptions) { return (query !== prevQuery || resolveQueryBoolean(prevOptions.enabled, query) === false) && (!options.suspense || query.state.status !== "error") && isStale(query, options); } function isStale(query, options) { return resolveQueryBoolean(options.enabled, query) !== false && query.isStaleByTime(resolveStaleTime(options.staleTime, query)); } function shouldAssignObserverCurrentProperties(observer, optimisticResult) { if (!shallowEqualObjects(observer.getCurrentResult(), optimisticResult)) return true; return false; } //#endregion //#region node_modules/.pnpm/@tanstack+query-core@5.100.9/node_modules/@tanstack/query-core/build/modern/infiniteQueryObserver.js var InfiniteQueryObserver = class extends QueryObserver { constructor(client, options) { super(client, options); } bindMethods() { super.bindMethods(); this.fetchNextPage = this.fetchNextPage.bind(this); this.fetchPreviousPage = this.fetchPreviousPage.bind(this); } setOptions(options) { options._type = "infinite"; super.setOptions(options); } getOptimisticResult(options) { options._type = "infinite"; return super.getOptimisticResult(options); } fetchNextPage(options) { return this.fetch({ ...options, meta: { fetchMore: { direction: "forward" } } }); } fetchPreviousPage(options) { return this.fetch({ ...options, meta: { fetchMore: { direction: "backward" } } }); } createResult(query, options) { const { state } = query; const parentResult = super.createResult(query, options); const { isFetching, isRefetching, isError, isRefetchError } = parentResult; const fetchDirection = state.fetchMeta?.fetchMore?.direction; const isFetchNextPageError = isError && fetchDirection === "forward"; const isFetchingNextPage = isFetching && fetchDirection === "forward"; const isFetchPreviousPageError = isError && fetchDirection === "backward"; const isFetchingPreviousPage = isFetching && fetchDirection === "backward"; return { ...parentResult, fetchNextPage: this.fetchNextPage, fetchPreviousPage: this.fetchPreviousPage, hasNextPage: hasNextPage(options, state.data), hasPreviousPage: hasPreviousPage(options, state.data), isFetchNextPageError, isFetchingNextPage, isFetchPreviousPageError, isFetchingPreviousPage, isRefetchError: isRefetchError && !isFetchNextPageError && !isFetchPreviousPageError, isRefetching: isRefetching && !isFetchingNextPage && !isFetchingPreviousPage }; } }; //#endregion //#region node_modules/.pnpm/@tanstack+query-core@5.100.9/node_modules/@tanstack/query-core/build/modern/mutation.js var Mutation = class extends Removable { #client; #observers; #mutationCache; #retryer; constructor(config) { super(); this.#client = config.client; this.mutationId = config.mutationId; this.#mutationCache = config.mutationCache; this.#observers = []; this.state = config.state || getDefaultState(); this.setOptions(config.options); this.scheduleGc(); } setOptions(options) { this.options = options; this.updateGcTime(this.options.gcTime); } get meta() { return this.options.meta; } addObserver(observer) { if (!this.#observers.includes(observer)) { this.#observers.push(observer); this.clearGcTimeout(); this.#mutationCache.notify({ type: "observerAdded", mutation: this, observer }); } } removeObserver(observer) { this.#observers = this.#observers.filter((x) => x !== observer); this.scheduleGc(); this.#mutationCache.notify({ type: "observerRemoved", mutation: this, observer }); } optionalRemove() { if (!this.#observers.length) if (this.state.status === "pending") this.scheduleGc(); else this.#mutationCache.remove(this); } continue() { return this.#retryer?.continue() ?? this.execute(this.state.variables); } async execute(variables) { const onContinue = () => { this.#dispatch({ type: "continue" }); }; const mutationFnContext = { client: this.#client, meta: this.options.meta, mutationKey: this.options.mutationKey }; this.#retryer = createRetryer({ fn: () => { if (!this.options.mutationFn) return Promise.reject(/* @__PURE__ */ new Error("No mutationFn found")); return this.options.mutationFn(variables, mutationFnContext); }, onFail: (failureCount, error) => { this.#dispatch({ type: "failed", failureCount, error }); }, onPause: () => { this.#dispatch({ type: "pause" }); }, onContinue, retry: this.options.retry ?? 0, retryDelay: this.options.retryDelay, networkMode: this.options.networkMode, canRun: () => this.#mutationCache.canRun(this) }); const restored = this.state.status === "pending"; const isPaused = !this.#retryer.canStart(); try { if (restored) onContinue(); else { this.#dispatch({ type: "pending", variables, isPaused }); if (this.#mutationCache.config.onMutate) await this.#mutationCache.config.onMutate(variables, this, mutationFnContext); const context = await this.options.onMutate?.(variables, mutationFnContext); if (context !== this.state.context) this.#dispatch({ type: "pending", context, variables, isPaused }); } const data = await this.#retryer.start(); await this.#mutationCache.config.onSuccess?.(data, variables, this.state.context, this, mutationFnContext); await this.options.onSuccess?.(data, variables, this.state.context, mutationFnContext); await this.#mutationCache.config.onSettled?.(data, null, this.state.variables, this.state.context, this, mutationFnContext); await this.options.onSettled?.(data, null, variables, this.state.context, mutationFnContext); this.#dispatch({ type: "success", data }); return data; } catch (error) { try { await this.#mutationCache.config.onError?.(error, variables, this.state.context, this, mutationFnContext); } catch (e) { Promise.reject(e); } try { await this.options.onError?.(error, variables, this.state.context, mutationFnContext); } catch (e) { Promise.reject(e); } try { await this.#mutationCache.config.onSettled?.(void 0, error, this.state.variables, this.state.context, this, mutationFnContext); } catch (e) { Promise.reject(e); } try { await this.options.onSettled?.(void 0, error, variables, this.state.context, mutationFnContext); } catch (e) { Promise.reject(e); } this.#dispatch({ type: "error", error }); throw error; } finally { this.#mutationCache.runNext(this); } } #dispatch(action) { const reducer = (state) => { switch (action.type) { case "failed": return { ...state, failureCount: action.failureCount, failureReason: action.error }; case "pause": return { ...state, isPaused: true }; case "continue": return { ...state, isPaused: false }; case "pending": return { ...state, context: action.context, data: void 0, failureCount: 0, failureReason: null, error: null, isPaused: action.isPaused, status: "pending", variables: action.variables, submittedAt: Date.now() }; case "success": return { ...state, data: action.data, failureCount: 0, failureReason: null, error: null, status: "success", isPaused: false }; case "error": return { ...state, data: void 0, error: action.error, failureCount: state.failureCount + 1, failureReason: action.error, isPaused: false, status: "error" }; } }; this.state = reducer(this.state); notifyManager.batch(() => { this.#observers.forEach((observer) => { observer.onMutationUpdate(action); }); this.#mutationCache.notify({ mutation: this, type: "updated", action }); }); } }; function getDefaultState() { return { context: void 0, data: void 0, error: null, failureCount: 0, failureReason: null, isPaused: false, status: "idle", variables: void 0, submittedAt: 0 }; } //#endregion //#region node_modules/.pnpm/@tanstack+query-core@5.100.9/node_modules/@tanstack/query-core/build/modern/mutationCache.js var MutationCache = class extends Subscribable { constructor(config = {}) { super(); this.config = config; this.#mutations = /* @__PURE__ */ new Set(); this.#scopes = /* @__PURE__ */ new Map(); this.#mutationId = 0; } #mutations; #scopes; #mutationId; build(client, options, state) { const mutation = new Mutation({ client, mutationCache: this, mutationId: ++this.#mutationId, options: client.defaultMutationOptions(options), state }); this.add(mutation); return mutation; } add(mutation) { this.#mutations.add(mutation); const scope = scopeFor(mutation); if (typeof scope === "string") { const scopedMutations = this.#scopes.get(scope); if (scopedMutations) scopedMutations.push(mutation); else this.#scopes.set(scope, [mutation]); } this.notify({ type: "added", mutation }); } remove(mutation) { if (this.#mutations.delete(mutation)) { const scope = scopeFor(mutation); if (typeof scope === "string") { const scopedMutations = this.#scopes.get(scope); if (scopedMutations) { if (scopedMutations.length > 1) { const index = scopedMutations.indexOf(mutation); if (index !== -1) scopedMutations.splice(index, 1); } else if (scopedMutations[0] === mutation) this.#scopes.delete(scope); } } } this.notify({ type: "removed", mutation }); } canRun(mutation) { const scope = scopeFor(mutation); if (typeof scope === "string") { const firstPendingMutation = this.#scopes.get(scope)?.find((m) => m.state.status === "pending"); return !firstPendingMutation || firstPendingMutation === mutation; } else return true; } runNext(mutation) { const scope = scopeFor(mutation); if (typeof scope === "string") return (this.#scopes.get(scope)?.find((m) => m !== mutation && m.state.isPaused))?.continue() ?? Promise.resolve(); else return Promise.resolve(); } clear() { notifyManager.batch(() => { this.#mutations.forEach((mutation) => { this.notify({ type: "removed", mutation }); }); this.#mutations.clear(); this.#scopes.clear(); }); } getAll() { return Array.from(this.#mutations); } find(filters) { const defaultedFilters = { exact: true, ...filters }; return this.getAll().find((mutation) => matchMutation(defaultedFilters, mutation)); } findAll(filters = {}) { return this.getAll().filter((mutation) => matchMutation(filters, mutation)); } notify(event) { notifyManager.batch(() => { this.listeners.forEach((listener) => { listener(event); }); }); } resumePausedMutations() { const pausedMutations = this.getAll().filter((x) => x.state.isPaused); return notifyManager.batch(() => Promise.all(pausedMutations.map((mutation) => mutation.continue().catch(noop)))); } }; function scopeFor(mutation) { return mutation.options.scope?.id; } //#endregion //#region node_modules/.pnpm/@tanstack+query-core@5.100.9/node_modules/@tanstack/query-core/build/modern/mutationObserver.js var MutationObserver = class extends Subscribable { #client; #currentResult = void 0; #currentMutation; #mutateOptions; constructor(client, options) { super(); this.#client = client; this.setOptions(options); this.bindMethods(); this.#updateResult(); } bindMethods() { this.mutate = this.mutate.bind(this); this.reset = this.reset.bind(this); } setOptions(options) { const prevOptions = this.options; this.options = this.#client.defaultMutationOptions(options); if (!shallowEqualObjects(this.options, prevOptions)) this.#client.getMutationCache().notify({ type: "observerOptionsUpdated", mutation: this.#currentMutation, observer: this }); if (prevOptions?.mutationKey && this.options.mutationKey && hashKey(prevOptions.mutationKey) !== hashKey(this.options.mutationKey)) this.reset(); else if (this.#currentMutation?.state.status === "pending") this.#currentMutation.setOptions(this.options); } onUnsubscribe() { if (!this.hasListeners()) this.#currentMutation?.removeObserver(this); } onMutationUpdate(action) { this.#updateResult(); this.#notify(action); } getCurrentResult() { return this.#currentResult; } reset() { this.#currentMutation?.removeObserver(this); this.#currentMutation = void 0; this.#updateResult(); this.#notify(); } mutate(variables, options) { this.#mutateOptions = options; this.#currentMutation?.removeObserver(this); this.#currentMutation = this.#client.getMutationCache().build(this.#client, this.options); this.#currentMutation.addObserver(this); return this.#currentMutation.execute(variables); } #updateResult() { const state = this.#currentMutation?.state ?? getDefaultState(); this.#currentResult = { ...state, isPending: state.status === "pending", isSuccess: state.status === "success", isError: state.status === "error", isIdle: state.status === "idle", mutate: this.mutate, reset: this.reset }; } #notify(action) { notifyManager.batch(() => { if (this.#mutateOptions && this.hasListeners()) { const variables = this.#currentResult.variables; const onMutateResult = this.#currentResult.context; const context = { client: this.#client, meta: this.options.meta, mutationKey: this.options.mutationKey }; if (action?.type === "success") { try { this.#mutateOptions.onSuccess?.(action.data, variables, onMutateResult, context); } catch (e) { Promise.reject(e); } try { this.#mutateOptions.onSettled?.(action.data, null, variables, onMutateResult, context); } catch (e) { Promise.reject(e); } } else if (action?.type === "error") { try { this.#mutateOptions.onError?.(action.error, variables, onMutateResult, context); } catch (e) { Promise.reject(e); } try { this.#mutateOptions.onSettled?.(void 0, action.error, variables, onMutateResult, context); } catch (e) { Promise.reject(e); } } } this.listeners.forEach((listener) => { listener(this.#currentResult); }); }); } }; //#endregion //#region node_modules/.pnpm/@tanstack+query-core@5.100.9/node_modules/@tanstack/query-core/build/modern/queriesObserver.js function difference(array1, array2) { const excludeSet = new Set(array2); return array1.filter((x) => !excludeSet.has(x)); } function replaceAt(array, index, value) { const copy = array.slice(0); copy[index] = value; return copy; } var QueriesObserver = class extends Subscribable { #client; #result; #queries; #options; #observers; #combinedResult; #lastCombine; #lastResult; #lastQueryHashes; #observerMatches = []; constructor(client, queries, options) { super(); this.#client = client; this.#options = options; this.#queries = []; this.#observers = []; this.#result = []; this.setQueries(queries); } onSubscribe() { if (this.listeners.size === 1) this.#observers.forEach((observer) => { observer.subscribe((result) => { this.#onUpdate(observer, result); }); }); } onUnsubscribe() { if (!this.listeners.size) this.destroy(); } destroy() { this.listeners = /* @__PURE__ */ new Set(); this.#observers.forEach((observer) => { observer.destroy(); }); } setQueries(queries, options) { this.#queries = queries; this.#options = options; { const queryHashes = queries.map((query) => this.#client.defaultQueryOptions(query).queryHash); if (new Set(queryHashes).size !== queryHashes.length) console.warn("[QueriesObserver]: Duplicate Queries found. This might result in unexpected behavior."); } notifyManager.batch(() => { const prevObservers = this.#observers; const newObserverMatches = this.#findMatchingObservers(this.#queries); newObserverMatches.forEach((match) => match.observer.setOptions(match.defaultedQueryOptions)); const newObservers = newObserverMatches.map((match) => match.observer); const newResult = newObservers.map((observer) => observer.getCurrentResult()); const hasLengthChange = prevObservers.length !== newObservers.length; const hasIndexChange = newObservers.some((observer, index) => observer !== prevObservers[index]); const hasStructuralChange = hasLengthChange || hasIndexChange; const hasResultChange = hasStructuralChange ? true : newResult.some((result, index) => { const prev = this.#result[index]; return !prev || !shallowEqualObjects(result, prev); }); if (!hasStructuralChange && !hasResultChange) return; if (hasStructuralChange) { this.#observerMatches = newObserverMatches; this.#observers = newObservers; } this.#result = newResult; if (!this.hasListeners()) return; if (hasStructuralChange) { difference(prevObservers, newObservers).forEach((observer) => { observer.destroy(); }); difference(newObservers, prevObservers).forEach((observer) => { observer.subscribe((result) => { this.#onUpdate(observer, result); }); }); } this.#notify(); }); } getCurrentResult() { return this.#result; } getQueries() { return this.#observers.map((observer) => observer.getCurrentQuery()); } getObservers() { return this.#observers; } getOptimisticResult(queries, combine) { const matches = this.#findMatchingObservers(queries); const result = matches.map((match) => match.observer.getOptimisticResult(match.defaultedQueryOptions)); const queryHashes = matches.map((match) => match.defaultedQueryOptions.queryHash); return [ result, (r) => { return this.#combineResult(r ?? result, combine, queryHashes); }, () => { return this.#trackResult(result, matches); } ]; } #trackResult(result, matches) { return matches.map((match, index) => { const observerResult = result[index]; return !match.defaultedQueryOptions.notifyOnChangeProps ? match.observer.trackResult(observerResult, (accessedProp) => { matches.forEach((m) => { m.observer.trackProp(accessedProp); }); }) : observerResult; }); } #combineResult(input, combine, queryHashes) { if (combine) { const lastHashes = this.#lastQueryHashes; const queryHashesChanged = queryHashes !== void 0 && lastHashes !== void 0 && (lastHashes.length !== queryHashes.length || queryHashes.some((hash, i) => hash !== lastHashes[i])); if (!this.#combinedResult || this.#result !== this.#lastResult || queryHashesChanged || combine !== this.#lastCombine) { this.#lastCombine = combine; this.#lastResult = this.#result; if (queryHashes !== void 0) this.#lastQueryHashes = queryHashes; this.#combinedResult = replaceEqualDeep(this.#combinedResult, combine(input)); } return this.#combinedResult; } return input; } #shouldSkipCombine() { return this.#options?.combine !== void 0 && this.#observers.some((observer, index) => { return observer.options.suspense && this.#result[index]?.data === void 0; }); } #findMatchingObservers(queries) { const prevObserversMap = /* @__PURE__ */ new Map(); this.#observers.forEach((observer) => { const key = observer.options.queryHash; if (!key) return; const previousObservers = prevObserversMap.get(key); if (previousObservers) previousObservers.push(observer); else prevObserversMap.set(key, [observer]); }); const observers = []; queries.forEach((options) => { const defaultedOptions = this.#client.defaultQueryOptions(options); const observer = prevObserversMap.get(defaultedOptions.queryHash)?.shift() ?? new QueryObserver(this.#client, defaultedOptions); observers.push({ defaultedQueryOptions: defaultedOptions, observer }); }); return observers; } #onUpdate(observer, result) { const index = this.#observers.indexOf(observer); if (index !== -1) { this.#result = replaceAt(this.#result, index, result); this.#notify(); } } #notify() { if (this.hasListeners()) { const newTracked = this.#trackResult(this.#result, this.#observerMatches); const shouldSkipCombine = this.#shouldSkipCombine(); const previousResult = this.#combinedResult; const newResult = shouldSkipCombine ? previousResult : this.#combineResult(newTracked, this.#options?.combine); if (shouldSkipCombine || previousResult !== newResult) notifyManager.batch(() => { this.listeners.forEach((listener) => { listener(this.#result); }); }); } } }; //#endregion //#region node_modules/.pnpm/@tanstack+query-core@5.100.9/node_modules/@tanstack/query-core/build/modern/queryCache.js var QueryCache = class extends Subscribable { constructor(config = {}) { super(); this.config = config; this.#queries = /* @__PURE__ */ new Map(); } #queries; build(client, options, state) { const queryKey = options.queryKey; const queryHash = options.queryHash ?? hashQueryKeyByOptions(queryKey, options); let query = this.get(queryHash); if (!query) { query = new Query({ client, queryKey, queryHash, options: client.defaultQueryOptions(options), state, defaultOptions: client.getQueryDefaults(queryKey) }); this.add(query); } return query; } add(query) { if (!this.#queries.has(query.queryHash)) { this.#queries.set(query.queryHash, query); this.notify({ type: "added", query }); } } remove(query) { const queryInMap = this.#queries.get(query.queryHash); if (queryInMap) { query.destroy(); if (queryInMap === query) this.#queries.delete(query.queryHash); this.notify({ type: "removed", query }); } } clear() { notifyManager.batch(() => { this.getAll().forEach((query) => { this.remove(query); }); }); } get(queryHash) { return this.#queries.get(queryHash); } getAll() { return [...this.#queries.values()]; } find(filters) { const defaultedFilters = { exact: true, ...filters }; return this.getAll().find((query) => matchQuery(defaultedFilters, query)); } findAll(filters = {}) { const queries = this.getAll(); return Object.keys(filters).length > 0 ? queries.filter((query) => matchQuery(filters, query)) : queries; } notify(event) { notifyManager.batch(() => { this.listeners.forEach((listener) => { listener(event); }); }); } onFocus() { notifyManager.batch(() => { this.getAll().forEach((query) => { query.onFocus(); }); }); } onOnline() { notifyManager.batch(() => { this.getAll().forEach((query) => { query.onOnline(); }); }); } }; //#endregion //#region node_modules/.pnpm/@tanstack+query-core@5.100.9/node_modules/@tanstack/query-core/build/modern/queryClient.js var QueryClient = class { #queryCache; #mutationCache; #defaultOptions; #queryDefaults; #mutationDefaults; #mountCount; #unsubscribeFocus; #unsubscribeOnline; constructor(config = {}) { this.#queryCache = config.queryCache || new QueryCache(); this.#mutationCache = config.mutationCache || new MutationCache(); this.#defaultOptions = config.defaultOptions || {}; this.#queryDefaults = /* @__PURE__ */ new Map(); this.#mutationDefaults = /* @__PURE__ */ new Map(); this.#mountCount = 0; } mount() { this.#mountCount++; if (this.#mountCount !== 1) return; this.#unsubscribeFocus = focusManager.subscribe(async (focused) => { if (focused) { await this.resumePausedMutations(); this.#queryCache.onFocus(); } }); this.#unsubscribeOnline = onlineManager.subscribe(async (online) => { if (online) { await this.resumePausedMutations(); this.#queryCache.onOnline(); } }); } unmount() { this.#mountCount--; if (this.#mountCount !== 0) return; this.#unsubscribeFocus?.(); this.#unsubscribeFocus = void 0; this.#unsubscribeOnline?.(); this.#unsubscribeOnline = void 0; } isFetching(filters) { return this.#queryCache.findAll({ ...filters, fetchStatus: "fetching" }).length; } isMutating(filters) { return this.#mutationCache.findAll({ ...filters, status: "pending" }).length; } /** * Imperative (non-reactive) way to retrieve data for a QueryKey. * Should only be used in callbacks or functions where reading the latest data is necessary, e.g. for optimistic updates. * * Hint: Do not use this function inside a component, because it won't receive updates. * Use `useQuery` to create a `QueryObserver` that subscribes to changes. */ getQueryData(queryKey) { const options = this.defaultQueryOptions({ queryKey }); return this.#queryCache.get(options.queryHash)?.state.data; } ensureQueryData(options) { const defaultedOptions = this.defaultQueryOptions(options); const query = this.#queryCache.build(this, defaultedOptions); const cachedData = query.state.data; if (cachedData === void 0) return this.fetchQuery(options); if (options.revalidateIfStale && query.isStaleByTime(resolveStaleTime(defaultedOptions.staleTime, query))) this.prefetchQuery(defaultedOptions); return Promise.resolve(cachedData); } getQueriesData(filters) { return this.#queryCache.findAll(filters).map(({ queryKey, state }) => { return [queryKey, state.data]; }); } setQueryData(queryKey, updater, options) { const defaultedOptions = this.defaultQueryOptions({ queryKey }); const prevData = this.#queryCache.get(defaultedOptions.queryHash)?.state.data; const data = functionalUpdate(updater, prevData); if (data === void 0) return; return this.#queryCache.build(this, defaultedOptions).setData(data, { ...options, manual: true }); } setQueriesData(filters, updater, options) { return notifyManager.batch(() => this.#queryCache.findAll(filters).map(({ queryKey }) => [queryKey, this.setQueryData(queryKey, updater, options)])); } getQueryState(queryKey) { const options = this.defaultQueryOptions({ queryKey }); return this.#queryCache.get(options.queryHash)?.state; } removeQueries(filters) { const queryCache = this.#queryCache; notifyManager.batch(() => { queryCache.findAll(filters).forEach((query) => { queryCache.remove(query); }); }); } resetQueries(filters, options) { const queryCache = this.#queryCache; return notifyManager.batch(() => { queryCache.findAll(filters).forEach((query) => { query.reset(); }); return this.refetchQueries({ type: "active", ...filters }, options); }); } cancelQueries(filters, cancelOptions = {}) { const defaultedCancelOptions = { revert: true, ...cancelOptions }; const promises = notifyManager.batch(() => this.#queryCache.findAll(filters).map((query) => query.cancel(defaultedCancelOptions))); return Promise.all(promises).then(noop).catch(noop); } invalidateQueries(filters, options = {}) { return notifyManager.batch(() => { this.#queryCache.findAll(filters).forEach((query) => { query.invalidate(); }); if (filters?.refetchType === "none") return Promise.resolve(); return this.refetchQueries({ ...filters, type: filters?.refetchType ?? filters?.type ?? "active" }, options); }); } refetchQueries(filters, options = {}) { const fetchOptions = { ...options, cancelRefetch: options.cancelRefetch ?? true }; const promises = notifyManager.batch(() => this.#queryCache.findAll(filters).filter((query) => !query.isDisabled() && !query.isStatic()).map((query) => { let promise = query.fetch(void 0, fetchOptions); if (!fetchOptions.throwOnError) promise = promise.catch(noop); return query.state.fetchStatus === "paused" ? Promise.resolve() : promise; })); return Promise.all(promises).then(noop); } fetchQuery(options) { const defaultedOptions = this.defaultQueryOptions(options); if (defaultedOptions.retry === void 0) defaultedOptions.retry = false; const query = this.#queryCache.build(this, defaultedOptions); return query.isStaleByTime(resolveStaleTime(defaultedOptions.staleTime, query)) ? query.fetch(defaultedOptions) : Promise.resolve(query.state.data); } prefetchQuery(options) { return this.fetchQuery(options).then(noop).catch(noop); } fetchInfiniteQuery(options) { options._type = "infinite"; return this.fetchQuery(options); } prefetchInfiniteQuery(options) { return this.fetchInfiniteQuery(options).then(noop).catch(noop); } ensureInfiniteQueryData(options) { options._type = "infinite"; return this.ensureQueryData(options); } resumePausedMutations() { if (onlineManager.isOnline()) return this.#mutationCache.resumePausedMutations(); return Promise.resolve(); } getQueryCache() { return this.#queryCache; } getMutationCache() { return this.#mutationCache; } getDefaultOptions() { return this.#defaultOptions; } setDefaultOptions(options) { this.#defaultOptions = options; } setQueryDefaults(queryKey, options) { this.#queryDefaults.set(hashKey(queryKey), { queryKey, defaultOptions: options }); } getQueryDefaults(queryKey) { const defaults = [...this.#queryDefaults.values()]; const result = {}; defaults.forEach((queryDefault) => { if (partialMatchKey(queryKey, queryDefault.queryKey)) Object.assign(result, queryDefault.defaultOptions); }); return result; } setMutationDefaults(mutationKey, options) { this.#mutationDefaults.set(hashKey(mutationKey), { mutationKey, defaultOptions: options }); } getMutationDefaults(mutationKey) { const defaults = [...this.#mutationDefaults.values()]; const result = {}; defaults.forEach((queryDefault) => { if (partialMatchKey(mutationKey, queryDefault.mutationKey)) Object.assign(result, queryDefault.defaultOptions); }); return result; } defaultQueryOptions(options) { if (options._defaulted) return options; const defaultedOptions = { ...this.#defaultOptions.queries, ...this.getQueryDefaults(options.queryKey), ...options, _defaulted: true }; if (!defaultedOptions.queryHash) defaultedOptions.queryHash = hashQueryKeyByOptions(defaultedOptions.queryKey, defaultedOptions); if (defaultedOptions.refetchOnReconnect === void 0) defaultedOptions.refetchOnReconnect = defaultedOptions.networkMode !== "always"; if (defaultedOptions.throwOnError === void 0) defaultedOptions.throwOnError = !!defaultedOptions.suspense; if (!defaultedOptions.networkMode && defaultedOptions.persister) defaultedOptions.networkMode = "offlineFirst"; if (defaultedOptions.queryFn === skipToken) defaultedOptions.enabled = false; return defaultedOptions; } defaultMutationOptions(options) { if (options?._defaulted) return options; return { ...this.#defaultOptions.mutations, ...options?.mutationKey && this.getMutationDefaults(options.mutationKey), ...options, _defaulted: true }; } clear() { this.#queryCache.clear(); this.#mutationCache.clear(); } }; //#endregion //#region node_modules/.pnpm/@tanstack+query-core@5.100.9/node_modules/@tanstack/query-core/build/modern/streamedQuery.js function streamedQuery({ streamFn, refetchMode = "reset", reducer = (items, chunk) => addToEnd(items, chunk), initialValue = [] }) { return async (context) => { const query = context.client.getQueryCache().find({ queryKey: context.queryKey, exact: true }); const isRefetch = !!query && query.isFetched(); if (isRefetch && refetchMode === "reset") query.setState({ ...query.resetState, fetchStatus: "fetching" }); let result = initialValue; let cancelled = false; const stream = await streamFn(addConsumeAwareSignal({ client: context.client, meta: context.meta, queryKey: context.queryKey, pageParam: context.pageParam, direction: context.direction }, () => context.signal, () => cancelled = true)); const isReplaceRefetch = isRefetch && refetchMode === "replace"; for await (const chunk of stream) { if (cancelled) break; if (isReplaceRefetch) result = reducer(result, chunk); else context.client.setQueryData(context.queryKey, (prev) => reducer(prev === void 0 ? initialValue : prev, chunk)); } if (isReplaceRefetch && !cancelled) context.client.setQueryData(context.queryKey, result); return context.client.getQueryData(context.queryKey) ?? initialValue; }; } //#endregion //#region node_modules/.pnpm/@tanstack+query-core@5.100.9/node_modules/@tanstack/query-core/build/modern/types.js var dataTagSymbol = /* @__PURE__ */ Symbol("dataTagSymbol"); var dataTagErrorSymbol = /* @__PURE__ */ Symbol("dataTagErrorSymbol"); var unsetMarker = /* @__PURE__ */ Symbol("unsetMarker"); //#endregion //#region node_modules/.pnpm/react@19.2.6/node_modules/react/cjs/react-jsx-runtime.development.js /** * @license React * react-jsx-runtime.development.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var require_react_jsx_runtime_development = /* @__PURE__ */ __commonJSMin(((exports) => { (function() { function getComponentNameFromType(type) { if (null == type) return null; if ("function" === typeof type) return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null; if ("string" === typeof type) return type; switch (type) { case REACT_FRAGMENT_TYPE: return "Fragment"; case REACT_PROFILER_TYPE: return "Profiler"; case REACT_STRICT_MODE_TYPE: return "StrictMode"; case REACT_SUSPENSE_TYPE: return "Suspense"; case REACT_SUSPENSE_LIST_TYPE: return "SuspenseList"; case REACT_ACTIVITY_TYPE: return "Activity"; } if ("object" === typeof type) switch ("number" === typeof type.tag && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), type.$$typeof) { case REACT_PORTAL_TYPE: return "Portal"; case REACT_CONTEXT_TYPE: return type.displayName || "Context"; case REACT_CONSUMER_TYPE: return (type._context.displayName || "Context") + ".Consumer"; case REACT_FORWARD_REF_TYPE: var innerType = type.render; type = type.displayName; type || (type = innerType.displayName || innerType.name || "", type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef"); return type; case REACT_MEMO_TYPE: return innerType = type.displayName || null, null !== innerType ? innerType : getComponentNameFromType(type.type) || "Memo"; case REACT_LAZY_TYPE: innerType = type._payload; type = type._init; try { return getComponentNameFromType(type(innerType)); } catch (x) {} } return null; } function testStringCoercion(value) { return "" + value; } function checkKeyStringCoercion(value) { try { testStringCoercion(value); var JSCompiler_inline_result = !1; } catch (e) { JSCompiler_inline_result = !0; } if (JSCompiler_inline_result) { JSCompiler_inline_result = console; var JSCompiler_temp_const = JSCompiler_inline_result.error; var JSCompiler_inline_result$jscomp$0 = "function" === typeof Symbol && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object"; JSCompiler_temp_const.call(JSCompiler_inline_result, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", JSCompiler_inline_result$jscomp$0); return testStringCoercion(value); } } function getTaskName(type) { if (type === REACT_FRAGMENT_TYPE) return "<>"; if ("object" === typeof type && null !== type && type.$$typeof === REACT_LAZY_TYPE) return "<...>"; try { var name = getComponentNameFromType(type); return name ? "<" + name + ">" : "<...>"; } catch (x) { return "<...>"; } } function getOwner() { var dispatcher = ReactSharedInternals.A; return null === dispatcher ? null : dispatcher.getOwner(); } function UnknownOwner() { return Error("react-stack-top-frame"); } function hasValidKey(config) { if (hasOwnProperty.call(config, "key")) { var getter = Object.getOwnPropertyDescriptor(config, "key").get; if (getter && getter.isReactWarning) return !1; } return void 0 !== config.key; } function defineKeyPropWarningGetter(props, displayName) { function warnAboutAccessingKey() { specialPropKeyWarningShown || (specialPropKeyWarningShown = !0, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", displayName)); } warnAboutAccessingKey.isReactWarning = !0; Object.defineProperty(props, "key", { get: warnAboutAccessingKey, configurable: !0 }); } function elementRefGetterWithDeprecationWarning() { var componentName = getComponentNameFromType(this.type); didWarnAboutElementRef[componentName] || (didWarnAboutElementRef[componentName] = !0, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")); componentName = this.props.ref; return void 0 !== componentName ? componentName : null; } function ReactElement(type, key, props, owner, debugStack, debugTask) { var refProp = props.ref; type = { $$typeof: REACT_ELEMENT_TYPE, type, key, props, _owner: owner }; null !== (void 0 !== refProp ? refProp : null) ? Object.defineProperty(type, "ref", { enumerable: !1, get: elementRefGetterWithDeprecationWarning }) : Object.defineProperty(type, "ref", { enumerable: !1, value: null }); type._store = {}; Object.defineProperty(type._store, "validated", { configurable: !1, enumerable: !1, writable: !0, value: 0 }); Object.defineProperty(type, "_debugInfo", { configurable: !1, enumerable: !1, writable: !0, value: null }); Object.defineProperty(type, "_debugStack", { configurable: !1, enumerable: !1, writable: !0, value: debugStack }); Object.defineProperty(type, "_debugTask", { configurable: !1, enumerable: !1, writable: !0, value: debugTask }); Object.freeze && (Object.freeze(type.props), Object.freeze(type)); return type; } function jsxDEVImpl(type, config, maybeKey, isStaticChildren, debugStack, debugTask) { var children = config.children; if (void 0 !== children) if (isStaticChildren) if (isArrayImpl(children)) { for (isStaticChildren = 0; isStaticChildren < children.length; isStaticChildren++) validateChildKeys(children[isStaticChildren]); Object.freeze && Object.freeze(children); } else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."); else validateChildKeys(children); if (hasOwnProperty.call(config, "key")) { children = getComponentNameFromType(type); var keys = Object.keys(config).filter(function(k) { return "key" !== k; }); isStaticChildren = 0 < keys.length ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" : "{key: someKey}"; didWarnAboutKeySpread[children + isStaticChildren] || (keys = 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}", console.error("A props object containing a \"key\" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />", isStaticChildren, children, keys, children), didWarnAboutKeySpread[children + isStaticChildren] = !0); } children = null; void 0 !== maybeKey && (checkKeyStringCoercion(maybeKey), children = "" + maybeKey); hasValidKey(config) && (checkKeyStringCoercion(config.key), children = "" + config.key); if ("key" in config) { maybeKey = {}; for (var propName in config) "key" !== propName && (maybeKey[propName] = config[propName]); } else maybeKey = config; children && defineKeyPropWarningGetter(maybeKey, "function" === typeof type ? type.displayName || type.name || "Unknown" : type); return ReactElement(type, children, maybeKey, getOwner(), debugStack, debugTask); } function validateChildKeys(node) { isValidElement(node) ? node._store && (node._store.validated = 1) : "object" === typeof node && null !== node && node.$$typeof === REACT_LAZY_TYPE && ("fulfilled" === node._payload.status ? isValidElement(node._payload.value) && node._payload.value._store && (node._payload.value._store.validated = 1) : node._store && (node._store.validated = 1)); } function isValidElement(object) { return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE; } var React = require_react(), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, hasOwnProperty = Object.prototype.hasOwnProperty, isArrayImpl = Array.isArray, createTask = console.createTask ? console.createTask : function() { return null; }; React = { react_stack_bottom_frame: function(callStackForError) { return callStackForError(); } }; var specialPropKeyWarningShown; var didWarnAboutElementRef = {}; var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind(React, UnknownOwner)(); var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner)); var didWarnAboutKeySpread = {}; exports.Fragment = REACT_FRAGMENT_TYPE; exports.jsx = function(type, config, maybeKey) { var trackActualOwner = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++; return jsxDEVImpl(type, config, maybeKey, !1, trackActualOwner ? Error("react-stack-top-frame") : unknownOwnerDebugStack, trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask); }; exports.jsxs = function(type, config, maybeKey) { var trackActualOwner = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++; return jsxDEVImpl(type, config, maybeKey, !0, trackActualOwner ? Error("react-stack-top-frame") : unknownOwnerDebugStack, trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask); }; })(); })); //#endregion //#region node_modules/.pnpm/react@19.2.6/node_modules/react/jsx-runtime.js var require_jsx_runtime = /* @__PURE__ */ __commonJSMin(((exports, module) => { module.exports = require_react_jsx_runtime_development(); })); //#endregion //#region node_modules/.pnpm/@tanstack+react-query@5.100.9_react@19.2.6/node_modules/@tanstack/react-query/build/modern/QueryClientProvider.js var import_react = /* @__PURE__ */ __toESM(require_react(), 1); var import_jsx_runtime = require_jsx_runtime(); var QueryClientContext = import_react.createContext(void 0); var useQueryClient = (queryClient) => { const client = import_react.useContext(QueryClientContext); if (queryClient) return queryClient; if (!client) throw new Error("No QueryClient set, use QueryClientProvider to set one"); return client; }; var QueryClientProvider = ({ client, children }) => { import_react.useEffect(() => { client.mount(); return () => { client.unmount(); }; }, [client]); return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(QueryClientContext.Provider, { value: client, children }); }; //#endregion //#region node_modules/.pnpm/@tanstack+react-query@5.100.9_react@19.2.6/node_modules/@tanstack/react-query/build/modern/IsRestoringProvider.js var IsRestoringContext = import_react.createContext(false); var useIsRestoring = () => import_react.useContext(IsRestoringContext); var IsRestoringProvider = IsRestoringContext.Provider; //#endregion //#region node_modules/.pnpm/@tanstack+react-query@5.100.9_react@19.2.6/node_modules/@tanstack/react-query/build/modern/QueryErrorResetBoundary.js function createValue() { let isReset = false; return { clearReset: () => { isReset = false; }, reset: () => { isReset = true; }, isReset: () => { return isReset; } }; } var QueryErrorResetBoundaryContext = import_react.createContext(createValue()); var useQueryErrorResetBoundary = () => import_react.useContext(QueryErrorResetBoundaryContext); var QueryErrorResetBoundary = ({ children }) => { const [value] = import_react.useState(() => createValue()); return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(QueryErrorResetBoundaryContext.Provider, { value, children: typeof children === "function" ? children(value) : children }); }; //#endregion //#region node_modules/.pnpm/@tanstack+react-query@5.100.9_react@19.2.6/node_modules/@tanstack/react-query/build/modern/errorBoundaryUtils.js var ensurePreventErrorBoundaryRetry = (options, errorResetBoundary, query) => { const throwOnError = query?.state.error && typeof options.throwOnError === "function" ? shouldThrowError(options.throwOnError, [query.state.error, query]) : options.throwOnError; if (options.suspense || options.experimental_prefetchInRender || throwOnError) { if (!errorResetBoundary.isReset()) options.retryOnMount = false; } }; var useClearResetErrorBoundary = (errorResetBoundary) => { import_react.useEffect(() => { errorResetBoundary.clearReset(); }, [errorResetBoundary]); }; var getHasError = ({ result, errorResetBoundary, throwOnError, query, suspense }) => { return result.isError && !errorResetBoundary.isReset() && !result.isFetching && query && (suspense && result.data === void 0 || shouldThrowError(throwOnError, [result.error, query])); }; //#endregion //#region node_modules/.pnpm/@tanstack+react-query@5.100.9_react@19.2.6/node_modules/@tanstack/react-query/build/modern/suspense.js var defaultThrowOnError = (_error, query) => query.state.data === void 0; var ensureSuspenseTimers = (defaultedOptions) => { if (defaultedOptions.suspense) { const MIN_SUSPENSE_TIME_MS = 1e3; const clamp = (value) => value === "static" ? value : Math.max(value ?? MIN_SUSPENSE_TIME_MS, MIN_SUSPENSE_TIME_MS); const originalStaleTime = defaultedOptions.staleTime; defaultedOptions.staleTime = typeof originalStaleTime === "function" ? (...args) => clamp(originalStaleTime(...args)) : clamp(originalStaleTime); if (typeof defaultedOptions.gcTime === "number") defaultedOptions.gcTime = Math.max(defaultedOptions.gcTime, MIN_SUSPENSE_TIME_MS); } }; var willFetch = (result, isRestoring) => result.isLoading && result.isFetching && !isRestoring; var shouldSuspend = (defaultedOptions, result) => defaultedOptions?.suspense && result.isPending; var fetchOptimistic = (defaultedOptions, observer, errorResetBoundary) => observer.fetchOptimistic(defaultedOptions).catch(() => { errorResetBoundary.clearReset(); }); //#endregion //#region node_modules/.pnpm/@tanstack+react-query@5.100.9_react@19.2.6/node_modules/@tanstack/react-query/build/modern/useQueries.js function useQueries({ queries, ...options }, queryClient) { const client = useQueryClient(queryClient); const isRestoring = useIsRestoring(); const errorResetBoundary = useQueryErrorResetBoundary(); const defaultedQueries = import_react.useMemo(() => queries.map((opts) => { const defaultedOptions = client.defaultQueryOptions(opts); defaultedOptions._optimisticResults = isRestoring ? "isRestoring" : "optimistic"; return defaultedOptions; }), [ queries, client, isRestoring ]); defaultedQueries.forEach((queryOptions) => { ensureSuspenseTimers(queryOptions); ensurePreventErrorBoundaryRetry(queryOptions, errorResetBoundary, client.getQueryCache().get(queryOptions.queryHash)); }); useClearResetErrorBoundary(errorResetBoundary); const [observer] = import_react.useState(() => new QueriesObserver(client, defaultedQueries, options)); const [optimisticResult, getCombinedResult, trackResult] = observer.getOptimisticResult(defaultedQueries, options.combine); const shouldSubscribe = !isRestoring && options.subscribed !== false; import_react.useSyncExternalStore(import_react.useCallback((onStoreChange) => shouldSubscribe ? observer.subscribe(notifyManager.batchCalls(onStoreChange)) : noop, [observer, shouldSubscribe]), () => observer.getCurrentResult(), () => observer.getCurrentResult()); import_react.useEffect(() => { observer.setQueries(defaultedQueries, options); }, [ defaultedQueries, options, observer ]); const suspensePromises = optimisticResult.some((result, index) => shouldSuspend(defaultedQueries[index], result)) ? optimisticResult.flatMap((result, index) => { const opts = defaultedQueries[index]; if (opts && shouldSuspend(opts, result)) return fetchOptimistic(opts, new QueryObserver(client, opts), errorResetBoundary); return []; }) : []; if (suspensePromises.length > 0) throw Promise.all(suspensePromises); const firstSingleResultWhichShouldThrow = optimisticResult.find((result, index) => { const query = defaultedQueries[index]; return query && getHasError({ result, errorResetBoundary, throwOnError: query.throwOnError, query: client.getQueryCache().get(query.queryHash), suspense: query.suspense }); }); if (firstSingleResultWhichShouldThrow?.error) throw firstSingleResultWhichShouldThrow.error; return getCombinedResult(trackResult()); } //#endregion //#region node_modules/.pnpm/@tanstack+react-query@5.100.9_react@19.2.6/node_modules/@tanstack/react-query/build/modern/useBaseQuery.js function useBaseQuery(options, Observer, queryClient) { if (typeof options !== "object" || Array.isArray(options)) throw new Error("Bad argument type. Starting with v5, only the \"Object\" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object"); const isRestoring = useIsRestoring(); const errorResetBoundary = useQueryErrorResetBoundary(); const client = useQueryClient(queryClient); const defaultedOptions = client.defaultQueryOptions(options); client.getDefaultOptions().queries?._experimental_beforeQuery?.(defaultedOptions); const query = client.getQueryCache().get(defaultedOptions.queryHash); if (!defaultedOptions.queryFn) console.error(`[${defaultedOptions.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`); defaultedOptions._optimisticResults = isRestoring ? "isRestoring" : "optimistic"; ensureSuspenseTimers(defaultedOptions); ensurePreventErrorBoundaryRetry(defaultedOptions, errorResetBoundary, query); useClearResetErrorBoundary(errorResetBoundary); const isNewCacheEntry = !client.getQueryCache().get(defaultedOptions.queryHash); const [observer] = import_react.useState(() => new Observer(client, defaultedOptions)); const result = observer.getOptimisticResult(defaultedOptions); const shouldSubscribe = !isRestoring && options.subscribed !== false; import_react.useSyncExternalStore(import_react.useCallback((onStoreChange) => { const unsubscribe = shouldSubscribe ? observer.subscribe(notifyManager.batchCalls(onStoreChange)) : noop; observer.updateResult(); return unsubscribe; }, [observer, shouldSubscribe]), () => observer.getCurrentResult(), () => observer.getCurrentResult()); import_react.useEffect(() => { observer.setOptions(defaultedOptions); }, [defaultedOptions, observer]); if (shouldSuspend(defaultedOptions, result)) throw fetchOptimistic(defaultedOptions, observer, errorResetBoundary); if (getHasError({ result, errorResetBoundary, throwOnError: defaultedOptions.throwOnError, query, suspense: defaultedOptions.suspense })) throw result.error; client.getDefaultOptions().queries?._experimental_afterQuery?.(defaultedOptions, result); if (defaultedOptions.experimental_prefetchInRender && !environmentManager.isServer() && willFetch(result, isRestoring)) (isNewCacheEntry ? fetchOptimistic(defaultedOptions, observer, errorResetBoundary) : query?.promise)?.catch(noop).finally(() => { observer.updateResult(); }); return !defaultedOptions.notifyOnChangeProps ? observer.trackResult(result) : result; } //#endregion //#region node_modules/.pnpm/@tanstack+react-query@5.100.9_react@19.2.6/node_modules/@tanstack/react-query/build/modern/useQuery.js function useQuery(options, queryClient) { return useBaseQuery(options, QueryObserver, queryClient); } //#endregion //#region node_modules/.pnpm/@tanstack+react-query@5.100.9_react@19.2.6/node_modules/@tanstack/react-query/build/modern/useSuspenseQuery.js function useSuspenseQuery(options, queryClient) { if (options.queryFn === skipToken) console.error("skipToken is not allowed for useSuspenseQuery"); return useBaseQuery({ ...options, enabled: true, suspense: true, throwOnError: defaultThrowOnError, placeholderData: void 0 }, QueryObserver, queryClient); } //#endregion //#region node_modules/.pnpm/@tanstack+react-query@5.100.9_react@19.2.6/node_modules/@tanstack/react-query/build/modern/useSuspenseInfiniteQuery.js function useSuspenseInfiniteQuery(options, queryClient) { if (options.queryFn === skipToken) console.error("skipToken is not allowed for useSuspenseInfiniteQuery"); return useBaseQuery({ ...options, enabled: true, suspense: true, throwOnError: defaultThrowOnError }, InfiniteQueryObserver, queryClient); } //#endregion //#region node_modules/.pnpm/@tanstack+react-query@5.100.9_react@19.2.6/node_modules/@tanstack/react-query/build/modern/useSuspenseQueries.js function useSuspenseQueries(options, queryClient) { return useQueries({ ...options, queries: options.queries.map((query) => { if (query.queryFn === skipToken) console.error("skipToken is not allowed for useSuspenseQueries"); return { ...query, suspense: true, throwOnError: defaultThrowOnError, enabled: true, placeholderData: void 0 }; }) }, queryClient); } //#endregion //#region node_modules/.pnpm/@tanstack+react-query@5.100.9_react@19.2.6/node_modules/@tanstack/react-query/build/modern/usePrefetchQuery.js function usePrefetchQuery(options, queryClient) { const client = useQueryClient(queryClient); if (!client.getQueryState(options.queryKey)) client.prefetchQuery(options); } //#endregion //#region node_modules/.pnpm/@tanstack+react-query@5.100.9_react@19.2.6/node_modules/@tanstack/react-query/build/modern/usePrefetchInfiniteQuery.js function usePrefetchInfiniteQuery(options, queryClient) { const client = useQueryClient(queryClient); if (!client.getQueryState(options.queryKey)) client.prefetchInfiniteQuery(options); } //#endregion //#region node_modules/.pnpm/@tanstack+react-query@5.100.9_react@19.2.6/node_modules/@tanstack/react-query/build/modern/queryOptions.js function queryOptions(options) { return options; } //#endregion //#region node_modules/.pnpm/@tanstack+react-query@5.100.9_react@19.2.6/node_modules/@tanstack/react-query/build/modern/infiniteQueryOptions.js function infiniteQueryOptions(options) { return options; } //#endregion //#region node_modules/.pnpm/@tanstack+react-query@5.100.9_react@19.2.6/node_modules/@tanstack/react-query/build/modern/HydrationBoundary.js var HydrationBoundary = ({ children, options = {}, state, queryClient }) => { const client = useQueryClient(queryClient); const optionsRef = import_react.useRef(options); import_react.useEffect(() => { optionsRef.current = options; }); const hydrationQueue = import_react.useMemo(() => { if (state) { if (typeof state !== "object") return; const queryCache = client.getQueryCache(); const queries = state.queries || []; const newQueries = []; const existingQueries = []; for (const dehydratedQuery of queries) { const existingQuery = queryCache.get(dehydratedQuery.queryHash); if (!existingQuery) newQueries.push(dehydratedQuery); else if (dehydratedQuery.state.dataUpdatedAt > existingQuery.state.dataUpdatedAt || dehydratedQuery.promise && existingQuery.state.status !== "pending" && existingQuery.state.fetchStatus !== "fetching" && dehydratedQuery.dehydratedAt !== void 0 && dehydratedQuery.dehydratedAt > existingQuery.state.dataUpdatedAt) existingQueries.push(dehydratedQuery); } if (newQueries.length > 0) hydrate(client, { queries: newQueries }, optionsRef.current); if (existingQueries.length > 0) return existingQueries; } }, [client, state]); import_react.useEffect(() => { if (hydrationQueue) hydrate(client, { queries: hydrationQueue }, optionsRef.current); }, [client, hydrationQueue]); return children; }; //#endregion //#region node_modules/.pnpm/@tanstack+react-query@5.100.9_react@19.2.6/node_modules/@tanstack/react-query/build/modern/useIsFetching.js function useIsFetching(filters, queryClient) { const client = useQueryClient(queryClient); const queryCache = client.getQueryCache(); return import_react.useSyncExternalStore(import_react.useCallback((onStoreChange) => queryCache.subscribe(notifyManager.batchCalls(onStoreChange)), [queryCache]), () => client.isFetching(filters), () => client.isFetching(filters)); } //#endregion //#region node_modules/.pnpm/@tanstack+react-query@5.100.9_react@19.2.6/node_modules/@tanstack/react-query/build/modern/useMutationState.js function useIsMutating(filters, queryClient) { const client = useQueryClient(queryClient); return useMutationState({ filters: { ...filters, status: "pending" } }, client).length; } function getResult(mutationCache, options) { return mutationCache.findAll(options.filters).map((mutation) => options.select ? options.select(mutation) : mutation.state); } function useMutationState(options = {}, queryClient) { const mutationCache = useQueryClient(queryClient).getMutationCache(); const optionsRef = import_react.useRef(options); const result = import_react.useRef(null); if (result.current === null) result.current = getResult(mutationCache, options); import_react.useEffect(() => { optionsRef.current = options; }); return import_react.useSyncExternalStore(import_react.useCallback((onStoreChange) => mutationCache.subscribe(() => { const nextResult = replaceEqualDeep(result.current, getResult(mutationCache, optionsRef.current)); if (result.current !== nextResult) { result.current = nextResult; notifyManager.schedule(onStoreChange); } }), [mutationCache]), () => result.current, () => result.current); } //#endregion //#region node_modules/.pnpm/@tanstack+react-query@5.100.9_react@19.2.6/node_modules/@tanstack/react-query/build/modern/useMutation.js function useMutation(options, queryClient) { const client = useQueryClient(queryClient); const [observer] = import_react.useState(() => new MutationObserver(client, options)); import_react.useEffect(() => { observer.setOptions(options); }, [observer, options]); const result = import_react.useSyncExternalStore(import_react.useCallback((onStoreChange) => observer.subscribe(notifyManager.batchCalls(onStoreChange)), [observer]), () => observer.getCurrentResult(), () => observer.getCurrentResult()); const mutate = import_react.useCallback((variables, mutateOptions) => { observer.mutate(variables, mutateOptions).catch(noop); }, [observer]); if (result.error && shouldThrowError(observer.options.throwOnError, [result.error])) throw result.error; return { ...result, mutate, mutateAsync: result.mutate }; } //#endregion //#region node_modules/.pnpm/@tanstack+react-query@5.100.9_react@19.2.6/node_modules/@tanstack/react-query/build/modern/mutationOptions.js function mutationOptions(options) { return options; } //#endregion //#region node_modules/.pnpm/@tanstack+react-query@5.100.9_react@19.2.6/node_modules/@tanstack/react-query/build/modern/useInfiniteQuery.js function useInfiniteQuery(options, queryClient) { return useBaseQuery(options, InfiniteQueryObserver, queryClient); } //#endregion export { CancelledError, HydrationBoundary, InfiniteQueryObserver, IsRestoringProvider, Mutation, MutationCache, MutationObserver, QueriesObserver, Query, QueryCache, QueryClient, QueryClientContext, QueryClientProvider, QueryErrorResetBoundary, QueryObserver, dataTagErrorSymbol, dataTagSymbol, defaultScheduler, defaultShouldDehydrateMutation, defaultShouldDehydrateQuery, dehydrate, environmentManager, streamedQuery as experimental_streamedQuery, focusManager, hashKey, hydrate, infiniteQueryOptions, isCancelledError, isServer, keepPreviousData, matchMutation, matchQuery, mutationOptions, noop, notifyManager, onlineManager, partialMatchKey, queryOptions, replaceEqualDeep, shouldThrowError, skipToken, timeoutManager, unsetMarker, useInfiniteQuery, useIsFetching, useIsMutating, useIsRestoring, useMutation, useMutationState, usePrefetchInfiniteQuery, usePrefetchQuery, useQueries, useQuery, useQueryClient, useQueryErrorResetBoundary, useSuspenseInfiniteQuery, useSuspenseQueries, useSuspenseQuery }; //# sourceMappingURL=@tanstack_react-query.js.map