2025-12-25 20:20:40 -05:00
import {
require _jsx _runtime
} from "./chunk-WKPQ4ZTV.js" ;
import {
require _react
} from "./chunk-BG45W2ER.js" ;
import {
_ _privateAdd ,
_ _privateGet ,
_ _privateMethod ,
_ _privateSet ,
_ _privateWrapper ,
_ _toESM
} from "./chunk-HXA6O6EE.js" ;
// 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 ( ) {
}
} ;
// node_modules/@tanstack/query-core/build/modern/timeoutManager.js
var defaultTimeoutProvider = {
// We need the wrapper function syntax below instead of direct references to
// global setTimeout etc.
//
// BAD: `setTimeout: setTimeout`
// GOOD: `setTimeout: (cb, delay) => setTimeout(cb, delay)`
//
// If we use direct references here, then anything that wants to spy on or
// replace the global setTimeout (like tests) won't work since we'll already
// have a hard reference to the original implementation at the time when this
// file was imported.
setTimeout : ( callback , delay ) => setTimeout ( callback , delay ) ,
clearTimeout : ( timeoutId ) => clearTimeout ( timeoutId ) ,
setInterval : ( callback , delay ) => setInterval ( callback , delay ) ,
clearInterval : ( intervalId ) => clearInterval ( intervalId )
} ;
var _provider , _providerCalled , _a ;
var TimeoutManager = ( _a = class {
constructor ( ) {
// We cannot have TimeoutManager<T> as we must instantiate it with a concrete
// type at app boot; and if we leave that type, then any new timer provider
// would need to support ReturnType<typeof setTimeout>, which is infeasible.
//
// We settle for type safety for the TimeoutProvider type, and accept that
// this class is unsafe internally to allow for extension.
_ _privateAdd ( this , _provider , defaultTimeoutProvider ) ;
_ _privateAdd ( this , _providerCalled , false ) ;
}
setTimeoutProvider ( provider ) {
if ( true ) {
if ( _ _privateGet ( this , _providerCalled ) && provider !== _ _privateGet ( this , _provider ) ) {
console . error (
` [timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior. ` ,
{ previous : _ _privateGet ( this , _provider ) , provider }
) ;
}
}
_ _privateSet ( this , _provider , provider ) ;
if ( true ) {
_ _privateSet ( this , _providerCalled , false ) ;
}
}
setTimeout ( callback , delay ) {
if ( true ) {
_ _privateSet ( this , _providerCalled , true ) ;
}
return _ _privateGet ( this , _provider ) . setTimeout ( callback , delay ) ;
}
clearTimeout ( timeoutId ) {
_ _privateGet ( this , _provider ) . clearTimeout ( timeoutId ) ;
}
setInterval ( callback , delay ) {
if ( true ) {
_ _privateSet ( this , _providerCalled , true ) ;
}
return _ _privateGet ( this , _provider ) . setInterval ( callback , delay ) ;
}
clearInterval ( intervalId ) {
_ _privateGet ( this , _provider ) . clearInterval ( intervalId ) ;
}
} , _provider = new WeakMap ( ) , _providerCalled = new WeakMap ( ) , _a ) ;
var timeoutManager = new TimeoutManager ( ) ;
function systemSetTimeoutZero ( callback ) {
setTimeout ( callback , 0 ) ;
}
// 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 resolveEnabled ( enabled , query ) {
return typeof enabled === "function" ? enabled ( query ) : enabled ;
}
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 ) {
const hashFn = ( options == null ? void 0 : options . queryKeyHashFn ) || hashKey ;
return hashFn ( 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 ) {
if ( a === b ) {
return a ;
}
const array = isPlainArray ( a ) && isPlainArray ( b ) ;
if ( ! array && ! ( isPlainObject ( a ) && isPlainObject ( b ) ) ) return b ;
const aItems = array ? a : Object . keys ( a ) ;
const aSize = aItems . 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 ) ;
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 ) {
if ( true ) {
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 = Symbol ( ) ;
function ensureQueryFn ( options , fetchOptions ) {
if ( true ) {
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 == null ? void 0 : fetchOptions . initialPromise ) ) {
return ( ) => fetchOptions . initialPromise ;
}
if ( ! options . queryFn || options . queryFn === skipToken ) {
return ( ) => Promise . reject ( new Error ( ` Missing queryFn: ' ${ options . queryHash } ' ` ) ) ;
}
return options . queryFn ;
}
function shouldThrowError ( throwOnError , params ) {
if ( typeof throwOnError === "function" ) {
return throwOnError ( ... params ) ;
}
return ! ! throwOnError ;
}
2026-01-02 22:46:03 -05:00
function addConsumeAwareSignal ( object , getSignal , onCancelled ) {
let consumed = false ;
let signal ;
Object . defineProperty ( object , "signal" , {
enumerable : true ,
get : ( ) => {
signal ? ? ( signal = getSignal ( ) ) ;
if ( consumed ) {
return signal ;
}
consumed = true ;
if ( signal . aborted ) {
onCancelled ( ) ;
} else {
signal . addEventListener ( "abort" , onCancelled , { once : true } ) ;
}
return signal ;
}
} ) ;
return object ;
}
2025-12-25 20:20:40 -05:00
// node_modules/@tanstack/query-core/build/modern/focusManager.js
var _focused , _cleanup , _setup , _a2 ;
var FocusManager = ( _a2 = class extends Subscribable {
constructor ( ) {
super ( ) ;
_ _privateAdd ( this , _focused ) ;
_ _privateAdd ( this , _cleanup ) ;
_ _privateAdd ( this , _setup ) ;
_ _privateSet ( this , _setup , ( onFocus ) => {
if ( ! isServer && window . addEventListener ) {
const listener = ( ) => onFocus ( ) ;
window . addEventListener ( "visibilitychange" , listener , false ) ;
return ( ) => {
window . removeEventListener ( "visibilitychange" , listener ) ;
} ;
}
return ;
} ) ;
}
onSubscribe ( ) {
if ( ! _ _privateGet ( this , _cleanup ) ) {
this . setEventListener ( _ _privateGet ( this , _setup ) ) ;
}
}
onUnsubscribe ( ) {
var _a13 ;
if ( ! this . hasListeners ( ) ) {
( _a13 = _ _privateGet ( this , _cleanup ) ) == null ? void 0 : _a13 . call ( this ) ;
_ _privateSet ( this , _cleanup , void 0 ) ;
}
}
setEventListener ( setup ) {
var _a13 ;
_ _privateSet ( this , _setup , setup ) ;
( _a13 = _ _privateGet ( this , _cleanup ) ) == null ? void 0 : _a13 . call ( this ) ;
_ _privateSet ( this , _cleanup , setup ( ( focused ) => {
if ( typeof focused === "boolean" ) {
this . setFocused ( focused ) ;
} else {
this . onFocus ( ) ;
}
} ) ) ;
}
setFocused ( focused ) {
const changed = _ _privateGet ( this , _focused ) !== focused ;
if ( changed ) {
_ _privateSet ( this , _focused , focused ) ;
this . onFocus ( ) ;
}
}
onFocus ( ) {
const isFocused = this . isFocused ( ) ;
this . listeners . forEach ( ( listener ) => {
listener ( isFocused ) ;
} ) ;
}
isFocused ( ) {
var _a13 ;
if ( typeof _ _privateGet ( this , _focused ) === "boolean" ) {
return _ _privateGet ( this , _focused ) ;
}
return ( ( _a13 = globalThis . document ) == null ? void 0 : _a13 . visibilityState ) !== "hidden" ;
}
} , _focused = new WeakMap ( ) , _cleanup = new WeakMap ( ) , _setup = new WeakMap ( ) , _a2 ) ;
var focusManager = new FocusManager ( ) ;
// 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 ) {
var _a13 ;
let data ;
( _a13 = promise . then ( ( result ) => {
data = result ;
return result ;
} , noop ) ) == null ? void 0 : _a13 . catch ( noop ) ;
if ( data !== void 0 ) {
return { data } ;
}
return void 0 ;
}
// 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 = ( ) => {
var _a13 ;
const promise = ( _a13 = query . promise ) == null ? void 0 : _a13 . then ( serializeData ) . catch ( ( error ) => {
if ( ! shouldRedactErrors ( error ) ) {
return Promise . reject ( error ) ;
}
if ( true ) {
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 ( new Error ( "redacted" ) ) ;
} ) ;
promise == null ? void 0 : 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 }
} ;
}
function defaultShouldDehydrateMutation ( mutation ) {
return mutation . state . isPaused ;
}
function defaultShouldDehydrateQuery ( query ) {
return query . state . status === "success" ;
}
function defaultShouldRedactErrors ( _ ) {
return true ;
}
function dehydrate ( client , options = { } ) {
var _a13 , _b , _c , _d ;
const filterMutation = options . shouldDehydrateMutation ? ? ( ( _a13 = client . getDefaultOptions ( ) . dehydrate ) == null ? void 0 : _a13 . shouldDehydrateMutation ) ? ? defaultShouldDehydrateMutation ;
const mutations = client . getMutationCache ( ) . getAll ( ) . flatMap (
( mutation ) => filterMutation ( mutation ) ? [ dehydrateMutation ( mutation ) ] : [ ]
) ;
const filterQuery = options . shouldDehydrateQuery ? ? ( ( _b = client . getDefaultOptions ( ) . dehydrate ) == null ? void 0 : _b . shouldDehydrateQuery ) ? ? defaultShouldDehydrateQuery ;
const shouldRedactErrors = options . shouldRedactErrors ? ? ( ( _c = client . getDefaultOptions ( ) . dehydrate ) == null ? void 0 : _c . shouldRedactErrors ) ? ? defaultShouldRedactErrors ;
const serializeData = options . serializeData ? ? ( ( _d = client . getDefaultOptions ( ) . dehydrate ) == null ? void 0 : _d . serializeData ) ? ? defaultTransformerFn ;
const queries = client . getQueryCache ( ) . getAll ( ) . flatMap (
( query ) => filterQuery ( query ) ? [ dehydrateQuery ( query , serializeData , shouldRedactErrors ) ] : [ ]
) ;
return { mutations , queries } ;
}
function hydrate ( client , dehydratedState , options ) {
var _a13 , _b ;
if ( typeof dehydratedState !== "object" || dehydratedState === null ) {
return ;
}
const mutationCache = client . getMutationCache ( ) ;
const queryCache = client . getQueryCache ( ) ;
const deserializeData = ( ( _a13 = options == null ? void 0 : options . defaultOptions ) == null ? void 0 : _a13 . deserializeData ) ? ? ( ( _b = client . getDefaultOptions ( ) . hydrate ) == null ? void 0 : _b . deserializeData ) ? ? defaultTransformerFn ;
const mutations = dehydratedState . mutations || [ ] ;
const queries = dehydratedState . queries || [ ] ;
mutations . forEach ( ( { state , ... mutationOptions2 } ) => {
var _a14 , _b2 ;
mutationCache . build (
client ,
{
... ( _a14 = client . getDefaultOptions ( ) . hydrate ) == null ? void 0 : _a14 . mutations ,
... ( _b2 = options == null ? void 0 : options . defaultOptions ) == null ? void 0 : _b2 . mutations ,
... mutationOptions2
} ,
state
) ;
} ) ;
queries . forEach (
( { queryKey , state , queryHash , meta , promise , dehydratedAt } ) => {
var _a14 , _b2 ;
const syncData = promise ? tryResolveSync ( promise ) : void 0 ;
const rawData = state . data === void 0 ? syncData == null ? void 0 : syncData . data : state . data ;
const data = rawData === void 0 ? rawData : deserializeData ( rawData ) ;
let query = queryCache . get ( queryHash ) ;
const existingQueryIsPending = ( query == null ? void 0 : query . state . status ) === "pending" ;
const existingQueryIsFetching = ( query == null ? void 0 : query . state . fetchStatus ) === "fetching" ;
if ( query ) {
const hasNewerSyncData = syncData && // We only need this undefined check to handle older dehydration
// payloads that might not have dehydratedAt
dehydratedAt !== void 0 && dehydratedAt > query . state . dataUpdatedAt ;
if ( state . dataUpdatedAt > query . state . dataUpdatedAt || hasNewerSyncData ) {
const { fetchStatus : _ignored , ... serializedState } = state ;
query . setState ( {
... serializedState ,
data
} ) ;
}
} else {
query = queryCache . build (
client ,
{
... ( _a14 = client . getDefaultOptions ( ) . hydrate ) == null ? void 0 : _a14 . queries ,
... ( _b2 = options == null ? void 0 : options . defaultOptions ) == null ? void 0 : _b2 . queries ,
queryKey ,
queryHash ,
meta
} ,
// Reset fetch status to idle to avoid
// query being stuck in fetching state upon hydration
{
... state ,
data ,
fetchStatus : "idle" ,
status : data !== void 0 ? "success" : state . status
}
) ;
}
if ( promise && ! existingQueryIsPending && ! existingQueryIsFetching && // Only hydrate if dehydration is newer than any existing data,
// this is always true for new queries
( dehydratedAt === void 0 || dehydratedAt > query . state . dataUpdatedAt ) ) {
query . fetch ( void 0 , {
// RSC transformed promises are not thenable
initialPromise : Promise . resolve ( promise ) . then ( deserializeData )
} ) . catch ( noop ) ;
}
}
) ;
}
// 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 ( ) ;
// node_modules/@tanstack/query-core/build/modern/onlineManager.js
var _online , _cleanup2 , _setup2 , _a3 ;
var OnlineManager = ( _a3 = class extends Subscribable {
constructor ( ) {
super ( ) ;
_ _privateAdd ( this , _online , true ) ;
_ _privateAdd ( this , _cleanup2 ) ;
_ _privateAdd ( this , _setup2 ) ;
_ _privateSet ( this , _setup2 , ( onOnline ) => {
if ( ! isServer && 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 ) ;
} ;
}
return ;
} ) ;
}
onSubscribe ( ) {
if ( ! _ _privateGet ( this , _cleanup2 ) ) {
this . setEventListener ( _ _privateGet ( this , _setup2 ) ) ;
}
}
onUnsubscribe ( ) {
var _a13 ;
if ( ! this . hasListeners ( ) ) {
( _a13 = _ _privateGet ( this , _cleanup2 ) ) == null ? void 0 : _a13 . call ( this ) ;
_ _privateSet ( this , _cleanup2 , void 0 ) ;
}
}
setEventListener ( setup ) {
var _a13 ;
_ _privateSet ( this , _setup2 , setup ) ;
( _a13 = _ _privateGet ( this , _cleanup2 ) ) == null ? void 0 : _a13 . call ( this ) ;
_ _privateSet ( this , _cleanup2 , setup ( this . setOnline . bind ( this ) ) ) ;
}
setOnline ( online ) {
const changed = _ _privateGet ( this , _online ) !== online ;
if ( changed ) {
_ _privateSet ( this , _online , online ) ;
this . listeners . forEach ( ( listener ) => {
listener ( online ) ;
} ) ;
}
}
isOnline ( ) {
return _ _privateGet ( this , _online ) ;
}
} , _online = new WeakMap ( ) , _cleanup2 = new WeakMap ( ) , _setup2 = new WeakMap ( ) , _a3 ) ;
var onlineManager = new OnlineManager ( ) ;
// 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 == null ? void 0 : options . revert ;
this . silent = options == null ? void 0 : 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 ) => {
var _a13 ;
if ( ! isResolved ( ) ) {
const error = new CancelledError ( cancelOptions ) ;
reject ( error ) ;
( _a13 = config . onCancel ) == null ? void 0 : _a13 . call ( config , 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 == null ? void 0 : continueFn ( ) ;
thenable . resolve ( value ) ;
}
} ;
const reject = ( value ) => {
if ( ! isResolved ( ) ) {
continueFn == null ? void 0 : continueFn ( ) ;
thenable . reject ( value ) ;
}
} ;
const pause = ( ) => {
return new Promise ( ( continueResolve ) => {
var _a13 ;
continueFn = ( value ) => {
if ( isResolved ( ) || canContinue ( ) ) {
continueResolve ( value ) ;
}
} ;
( _a13 = config . onPause ) == null ? void 0 : _a13 . call ( config ) ;
} ) . then ( ( ) => {
var _a13 ;
continueFn = void 0 ;
if ( ! isResolved ( ) ) {
( _a13 = config . onContinue ) == null ? void 0 : _a13 . call ( config ) ;
}
} ) ;
} ;
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 ) => {
var _a13 ;
if ( isResolved ( ) ) {
return ;
}
const retry = config . retry ? ? ( 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 ++ ;
( _a13 = config . onFail ) == null ? void 0 : _a13 . call ( config , 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 == null ? void 0 : continueFn ( ) ;
return thenable ;
} ,
cancelRetry ,
continueRetry ,
canStart ,
start : ( ) => {
if ( canStart ( ) ) {
run ( ) ;
} else {
pause ( ) . then ( run ) ;
}
return thenable ;
}
} ;
}
// node_modules/@tanstack/query-core/build/modern/removable.js
var _gcTimeout , _a4 ;
var Removable = ( _a4 = class {
constructor ( ) {
_ _privateAdd ( this , _gcTimeout ) ;
}
destroy ( ) {
this . clearGcTimeout ( ) ;
}
scheduleGc ( ) {
this . clearGcTimeout ( ) ;
if ( isValidTimeout ( this . gcTime ) ) {
_ _privateSet ( this , _gcTimeout , timeoutManager . setTimeout ( ( ) => {
this . optionalRemove ( ) ;
} , this . gcTime ) ) ;
}
}
updateGcTime ( newGcTime ) {
this . gcTime = Math . max (
this . gcTime || 0 ,
newGcTime ? ? ( isServer ? Infinity : 5 * 60 * 1e3 )
) ;
}
clearGcTimeout ( ) {
if ( _ _privateGet ( this , _gcTimeout ) ) {
timeoutManager . clearTimeout ( _ _privateGet ( this , _gcTimeout ) ) ;
_ _privateSet ( this , _gcTimeout , void 0 ) ;
}
}
} , _gcTimeout = new WeakMap ( ) , _a4 ) ;
// node_modules/@tanstack/query-core/build/modern/query.js
var _initialState , _revertState , _cache , _client , _retryer , _defaultOptions , _abortSignalConsumed , _Query _instances , dispatch _fn , _a5 ;
var Query = ( _a5 = class extends Removable {
constructor ( config ) {
super ( ) ;
_ _privateAdd ( this , _Query _instances ) ;
_ _privateAdd ( this , _initialState ) ;
_ _privateAdd ( this , _revertState ) ;
_ _privateAdd ( this , _cache ) ;
_ _privateAdd ( this , _client ) ;
_ _privateAdd ( this , _retryer ) ;
_ _privateAdd ( this , _defaultOptions ) ;
_ _privateAdd ( this , _abortSignalConsumed ) ;
_ _privateSet ( this , _abortSignalConsumed , false ) ;
_ _privateSet ( this , _defaultOptions , config . defaultOptions ) ;
this . setOptions ( config . options ) ;
this . observers = [ ] ;
_ _privateSet ( this , _client , config . client ) ;
_ _privateSet ( this , _cache , _ _privateGet ( this , _client ) . getQueryCache ( ) ) ;
this . queryKey = config . queryKey ;
this . queryHash = config . queryHash ;
_ _privateSet ( this , _initialState , getDefaultState ( this . options ) ) ;
this . state = config . state ? ? _ _privateGet ( this , _initialState ) ;
this . scheduleGc ( ) ;
}
get meta ( ) {
return this . options . meta ;
}
get promise ( ) {
var _a13 ;
return ( _a13 = _ _privateGet ( this , _retryer ) ) == null ? void 0 : _a13 . promise ;
}
setOptions ( options ) {
this . options = { ... _ _privateGet ( this , _defaultOptions ) , ... options } ;
this . updateGcTime ( this . options . gcTime ) ;
if ( this . state && this . state . data === void 0 ) {
const defaultState = getDefaultState ( this . options ) ;
if ( defaultState . data !== void 0 ) {
this . setState (
successState ( defaultState . data , defaultState . dataUpdatedAt )
) ;
_ _privateSet ( this , _initialState , defaultState ) ;
}
}
}
optionalRemove ( ) {
if ( ! this . observers . length && this . state . fetchStatus === "idle" ) {
_ _privateGet ( this , _cache ) . remove ( this ) ;
}
}
setData ( newData , options ) {
const data = replaceData ( this . state . data , newData , this . options ) ;
_ _privateMethod ( this , _Query _instances , dispatch _fn ) . call ( this , {
data ,
type : "success" ,
dataUpdatedAt : options == null ? void 0 : options . updatedAt ,
manual : options == null ? void 0 : options . manual
} ) ;
return data ;
}
setState ( state , setStateOptions ) {
_ _privateMethod ( this , _Query _instances , dispatch _fn ) . call ( this , { type : "setState" , state , setStateOptions } ) ;
}
cancel ( options ) {
var _a13 , _b ;
const promise = ( _a13 = _ _privateGet ( this , _retryer ) ) == null ? void 0 : _a13 . promise ;
( _b = _ _privateGet ( this , _retryer ) ) == null ? void 0 : _b . cancel ( options ) ;
return promise ? promise . then ( noop ) . catch ( noop ) : Promise . resolve ( ) ;
}
destroy ( ) {
super . destroy ( ) ;
this . cancel ( { silent : true } ) ;
}
reset ( ) {
this . destroy ( ) ;
this . setState ( _ _privateGet ( this , _initialState ) ) ;
}
isActive ( ) {
return this . observers . some (
( observer ) => resolveEnabled ( observer . options . enabled , this ) !== false
) ;
}
isDisabled ( ) {
if ( this . getObserversCount ( ) > 0 ) {
return ! this . isActive ( ) ;
}
return this . options . queryFn === skipToken || 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 ( ) {
var _a13 ;
const observer = this . observers . find ( ( x ) => x . shouldFetchOnWindowFocus ( ) ) ;
observer == null ? void 0 : observer . refetch ( { cancelRefetch : false } ) ;
( _a13 = _ _privateGet ( this , _retryer ) ) == null ? void 0 : _a13 . continue ( ) ;
}
onOnline ( ) {
var _a13 ;
const observer = this . observers . find ( ( x ) => x . shouldFetchOnReconnect ( ) ) ;
observer == null ? void 0 : observer . refetch ( { cancelRefetch : false } ) ;
( _a13 = _ _privateGet ( this , _retryer ) ) == null ? void 0 : _a13 . continue ( ) ;
}
addObserver ( observer ) {
if ( ! this . observers . includes ( observer ) ) {
this . observers . push ( observer ) ;
this . clearGcTimeout ( ) ;
_ _privateGet ( 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 ( _ _privateGet ( this , _retryer ) ) {
if ( _ _privateGet ( this , _abortSignalConsumed ) ) {
_ _privateGet ( this , _retryer ) . cancel ( { revert : true } ) ;
} else {
_ _privateGet ( this , _retryer ) . cancelRetry ( ) ;
}
}
this . scheduleGc ( ) ;
}
_ _privateGet ( this , _cache ) . notify ( { type : "observerRemoved" , query : this , observer } ) ;
}
}
getObserversCount ( ) {
return this . observers . length ;
}
invalidate ( ) {
if ( ! this . state . isInvalidated ) {
_ _privateMethod ( this , _Query _instances , dispatch _fn ) . call ( this , { type : "invalidate" } ) ;
}
}
async fetch ( options , fetchOptions ) {
var _a13 , _b , _c , _d , _e , _f , _g , _h , _i , _j , _k , _l ;
if ( this . state . fetchStatus !== "idle" && // If the promise in the retyer is already rejected, we have to definitely
// re-start the fetch; there is a chance that the query is still in a
// pending state when that happens
( ( _a13 = _ _privateGet ( this , _retryer ) ) == null ? void 0 : _a13 . status ( ) ) !== "rejected" ) {
if ( this . state . data !== void 0 && ( fetchOptions == null ? void 0 : fetchOptions . cancelRefetch ) ) {
this . cancel ( { silent : true } ) ;
} else if ( _ _privateGet ( this , _retryer ) ) {
_ _privateGet ( this , _retryer ) . continueRetry ( ) ;
return _ _privateGet ( 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 ( true ) {
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 : ( ) => {
_ _privateSet ( this , _abortSignalConsumed , true ) ;
return abortController . signal ;
}
} ) ;
} ;
const fetchFn = ( ) => {
const queryFn = ensureQueryFn ( this . options , fetchOptions ) ;
const createQueryFnContext = ( ) => {
const queryFnContext2 = {
client : _ _privateGet ( this , _client ) ,
queryKey : this . queryKey ,
meta : this . meta
} ;
addSignalProperty ( queryFnContext2 ) ;
return queryFnContext2 ;
} ;
const queryFnContext = createQueryFnContext ( ) ;
_ _privateSet ( 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 : _ _privateGet ( this , _client ) ,
state : this . state ,
fetchFn
} ;
addSignalProperty ( context2 ) ;
return context2 ;
} ;
const context = createFetchContext ( ) ;
( _b = this . options . behavior ) == null ? void 0 : _b . onFetch ( context , this ) ;
_ _privateSet ( this , _revertState , this . state ) ;
if ( this . state . fetchStatus === "idle" || this . state . fetchMeta !== ( ( _c = context . fetchOptions ) == null ? void 0 : _c . meta ) ) {
_ _privateMethod ( this , _Query _instances , dispatch _fn ) . call ( this , { type : "fetch" , meta : ( _d = context . fetchOptions ) == null ? void 0 : _d . meta } ) ;
}
_ _privateSet ( this , _retryer , createRetryer ( {
initialPromise : fetchOptions == null ? void 0 : fetchOptions . initialPromise ,
fn : context . fetchFn ,
onCancel : ( error ) => {
if ( error instanceof CancelledError && error . revert ) {
this . setState ( {
... _ _privateGet ( this , _revertState ) ,
fetchStatus : "idle"
} ) ;
}
abortController . abort ( ) ;
} ,
onFail : ( failureCount , error ) => {
_ _privateMethod ( this , _Query _instances , dispatch _fn ) . call ( this , { type : "failed" , failureCount , error } ) ;
} ,
onPause : ( ) => {
_ _privateMethod ( this , _Query _instances , dispatch _fn ) . call ( this , { type : "pause" } ) ;
} ,
onContinue : ( ) => {
_ _privateMethod ( this , _Query _instances , dispatch _fn ) . call ( this , { type : "continue" } ) ;
} ,
retry : context . options . retry ,
retryDelay : context . options . retryDelay ,
networkMode : context . options . networkMode ,
canRun : ( ) => true
} ) ) ;
try {
const data = await _ _privateGet ( this , _retryer ) . start ( ) ;
if ( data === void 0 ) {
if ( true ) {
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 ) ;
( _f = ( _e = _ _privateGet ( this , _cache ) . config ) . onSuccess ) == null ? void 0 : _f . call ( _e , data , this ) ;
( _h = ( _g = _ _privateGet ( this , _cache ) . config ) . onSettled ) == null ? void 0 : _h . call (
_g ,
data ,
this . state . error ,
this
) ;
return data ;
} catch ( error ) {
if ( error instanceof CancelledError ) {
if ( error . silent ) {
return _ _privateGet ( this , _retryer ) . promise ;
} else if ( error . revert ) {
if ( this . state . data === void 0 ) {
throw error ;
}
return this . state . data ;
}
}
_ _privateMethod ( this , _Query _instances , dispatch _fn ) . call ( this , {
type : "error" ,
error
} ) ;
( _j = ( _i = _ _privateGet ( this , _cache ) . config ) . onError ) == null ? void 0 : _j . call (
_i ,
error ,
this
) ;
( _l = ( _k = _ _privateGet ( this , _cache ) . config ) . onSettled ) == null ? void 0 : _l . call (
_k ,
this . state . data ,
error ,
this
) ;
throw error ;
} finally {
this . scheduleGc ( ) ;
}
}
} , _initialState = new WeakMap ( ) , _revertState = new WeakMap ( ) , _cache = new WeakMap ( ) , _client = new WeakMap ( ) , _retryer = new WeakMap ( ) , _defaultOptions = new WeakMap ( ) , _abortSignalConsumed = new WeakMap ( ) , _Query _instances = new WeakSet ( ) , dispatch _fn = function ( 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
}
} ;
_ _privateSet ( 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" ,
2026-01-02 22:46:03 -05:00
status : "error" ,
// flag existing data as invalidated if we get a background error
// note that "no data" always means stale so we can set unconditionally here
isInvalidated : true
2025-12-25 20:20:40 -05:00
} ;
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 ( ) ;
} ) ;
_ _privateGet ( this , _cache ) . notify ( { query : this , type : "updated" , action } ) ;
} ) ;
} , _a5 ) ;
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 ( 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"
} ;
}
// node_modules/@tanstack/query-core/build/modern/queryObserver.js
var _client2 , _currentQuery , _currentQueryInitialState , _currentResult , _currentResultState , _currentResultOptions , _currentThenable , _selectError , _selectFn , _selectResult , _lastQueryWithDefinedData , _staleTimeoutId , _refetchIntervalId , _currentRefetchInterval , _trackedProps , _QueryObserver _instances , executeFetch _fn , updateStaleTimeout _fn , computeRefetchInterval _fn , updateRefetchInterval _fn , updateTimers _fn , clearStaleTimeout _fn , clearRefetchInterval _fn , updateQuery _fn , notify _fn , _a6 ;
var QueryObserver = ( _a6 = class extends Subscribable {
constructor ( client , options ) {
super ( ) ;
_ _privateAdd ( this , _QueryObserver _instances ) ;
_ _privateAdd ( this , _client2 ) ;
_ _privateAdd ( this , _currentQuery ) ;
_ _privateAdd ( this , _currentQueryInitialState ) ;
_ _privateAdd ( this , _currentResult ) ;
_ _privateAdd ( this , _currentResultState ) ;
_ _privateAdd ( this , _currentResultOptions ) ;
_ _privateAdd ( this , _currentThenable ) ;
_ _privateAdd ( this , _selectError ) ;
_ _privateAdd ( this , _selectFn ) ;
_ _privateAdd ( this , _selectResult ) ;
// This property keeps track of the last query with defined data.
// It will be used to pass the previous data and query to the placeholder function between renders.
_ _privateAdd ( this , _lastQueryWithDefinedData ) ;
_ _privateAdd ( this , _staleTimeoutId ) ;
_ _privateAdd ( this , _refetchIntervalId ) ;
_ _privateAdd ( this , _currentRefetchInterval ) ;
_ _privateAdd ( this , _trackedProps , /* @__PURE__ */ new Set ( ) ) ;
this . options = options ;
_ _privateSet ( this , _client2 , client ) ;
_ _privateSet ( this , _selectError , null ) ;
_ _privateSet ( this , _currentThenable , pendingThenable ( ) ) ;
this . bindMethods ( ) ;
this . setOptions ( options ) ;
}
bindMethods ( ) {
this . refetch = this . refetch . bind ( this ) ;
}
onSubscribe ( ) {
if ( this . listeners . size === 1 ) {
_ _privateGet ( this , _currentQuery ) . addObserver ( this ) ;
if ( shouldFetchOnMount ( _ _privateGet ( this , _currentQuery ) , this . options ) ) {
_ _privateMethod ( this , _QueryObserver _instances , executeFetch _fn ) . call ( this ) ;
} else {
this . updateResult ( ) ;
}
_ _privateMethod ( this , _QueryObserver _instances , updateTimers _fn ) . call ( this ) ;
}
}
onUnsubscribe ( ) {
if ( ! this . hasListeners ( ) ) {
this . destroy ( ) ;
}
}
shouldFetchOnReconnect ( ) {
return shouldFetchOn (
_ _privateGet ( this , _currentQuery ) ,
this . options ,
this . options . refetchOnReconnect
) ;
}
shouldFetchOnWindowFocus ( ) {
return shouldFetchOn (
_ _privateGet ( this , _currentQuery ) ,
this . options ,
this . options . refetchOnWindowFocus
) ;
}
destroy ( ) {
this . listeners = /* @__PURE__ */ new Set ( ) ;
_ _privateMethod ( this , _QueryObserver _instances , clearStaleTimeout _fn ) . call ( this ) ;
_ _privateMethod ( this , _QueryObserver _instances , clearRefetchInterval _fn ) . call ( this ) ;
_ _privateGet ( this , _currentQuery ) . removeObserver ( this ) ;
}
setOptions ( options ) {
const prevOptions = this . options ;
const prevQuery = _ _privateGet ( this , _currentQuery ) ;
this . options = _ _privateGet ( this , _client2 ) . defaultQueryOptions ( options ) ;
if ( this . options . enabled !== void 0 && typeof this . options . enabled !== "boolean" && typeof this . options . enabled !== "function" && typeof resolveEnabled ( this . options . enabled , _ _privateGet ( this , _currentQuery ) ) !== "boolean" ) {
throw new Error (
"Expected enabled to be a boolean or a callback that returns a boolean"
) ;
}
_ _privateMethod ( this , _QueryObserver _instances , updateQuery _fn ) . call ( this ) ;
_ _privateGet ( this , _currentQuery ) . setOptions ( this . options ) ;
if ( prevOptions . _defaulted && ! shallowEqualObjects ( this . options , prevOptions ) ) {
_ _privateGet ( this , _client2 ) . getQueryCache ( ) . notify ( {
type : "observerOptionsUpdated" ,
query : _ _privateGet ( this , _currentQuery ) ,
observer : this
} ) ;
}
const mounted = this . hasListeners ( ) ;
if ( mounted && shouldFetchOptionally (
_ _privateGet ( this , _currentQuery ) ,
prevQuery ,
this . options ,
prevOptions
) ) {
_ _privateMethod ( this , _QueryObserver _instances , executeFetch _fn ) . call ( this ) ;
}
this . updateResult ( ) ;
if ( mounted && ( _ _privateGet ( this , _currentQuery ) !== prevQuery || resolveEnabled ( this . options . enabled , _ _privateGet ( this , _currentQuery ) ) !== resolveEnabled ( prevOptions . enabled , _ _privateGet ( this , _currentQuery ) ) || resolveStaleTime ( this . options . staleTime , _ _privateGet ( this , _currentQuery ) ) !== resolveStaleTime ( prevOptions . staleTime , _ _privateGet ( this , _currentQuery ) ) ) ) {
_ _privateMethod ( this , _QueryObserver _instances , updateStaleTimeout _fn ) . call ( this ) ;
}
const nextRefetchInterval = _ _privateMethod ( this , _QueryObserver _instances , computeRefetchInterval _fn ) . call ( this ) ;
if ( mounted && ( _ _privateGet ( this , _currentQuery ) !== prevQuery || resolveEnabled ( this . options . enabled , _ _privateGet ( this , _currentQuery ) ) !== resolveEnabled ( prevOptions . enabled , _ _privateGet ( this , _currentQuery ) ) || nextRefetchInterval !== _ _privateGet ( this , _currentRefetchInterval ) ) ) {
_ _privateMethod ( this , _QueryObserver _instances , updateRefetchInterval _fn ) . call ( this , nextRefetchInterval ) ;
}
}
getOptimisticResult ( options ) {
const query = _ _privateGet ( this , _client2 ) . getQueryCache ( ) . build ( _ _privateGet ( this , _client2 ) , options ) ;
const result = this . createResult ( query , options ) ;
if ( shouldAssignObserverCurrentProperties ( this , result ) ) {
_ _privateSet ( this , _currentResult , result ) ;
_ _privateSet ( this , _currentResultOptions , this . options ) ;
_ _privateSet ( this , _currentResultState , _ _privateGet ( this , _currentQuery ) . state ) ;
}
return result ;
}
getCurrentResult ( ) {
return _ _privateGet ( this , _currentResult ) ;
}
trackResult ( result , onPropTracked ) {
return new Proxy ( result , {
get : ( target , key ) => {
this . trackProp ( key ) ;
onPropTracked == null ? void 0 : onPropTracked ( key ) ;
if ( key === "promise" ) {
this . trackProp ( "data" ) ;
if ( ! this . options . experimental _prefetchInRender && _ _privateGet ( this , _currentThenable ) . status === "pending" ) {
_ _privateGet ( this , _currentThenable ) . reject (
new Error (
"experimental_prefetchInRender feature flag is not enabled"
)
) ;
}
}
return Reflect . get ( target , key ) ;
}
} ) ;
}
trackProp ( key ) {
_ _privateGet ( this , _trackedProps ) . add ( key ) ;
}
getCurrentQuery ( ) {
return _ _privateGet ( this , _currentQuery ) ;
}
refetch ( { ... options } = { } ) {
return this . fetch ( {
... options
} ) ;
}
fetchOptimistic ( options ) {
const defaultedOptions = _ _privateGet ( this , _client2 ) . defaultQueryOptions ( options ) ;
const query = _ _privateGet ( this , _client2 ) . getQueryCache ( ) . build ( _ _privateGet ( this , _client2 ) , defaultedOptions ) ;
return query . fetch ( ) . then ( ( ) => this . createResult ( query , defaultedOptions ) ) ;
}
fetch ( fetchOptions ) {
return _ _privateMethod ( this , _QueryObserver _instances , executeFetch _fn ) . call ( this , {
... fetchOptions ,
cancelRefetch : fetchOptions . cancelRefetch ? ? true
} ) . then ( ( ) => {
this . updateResult ( ) ;
return _ _privateGet ( this , _currentResult ) ;
} ) ;
}
createResult ( query , options ) {
var _a13 ;
const prevQuery = _ _privateGet ( this , _currentQuery ) ;
const prevOptions = this . options ;
const prevResult = _ _privateGet ( this , _currentResult ) ;
const prevResultState = _ _privateGet ( this , _currentResultState ) ;
const prevResultOptions = _ _privateGet ( this , _currentResultOptions ) ;
const queryChange = query !== prevQuery ;
const queryInitialState = queryChange ? query . state : _ _privateGet ( 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 == null ? void 0 : prevResult . isPlaceholderData ) && options . placeholderData === ( prevResultOptions == null ? void 0 : prevResultOptions . placeholderData ) ) {
placeholderData = prevResult . data ;
skipSelect = true ;
} else {
placeholderData = typeof options . placeholderData === "function" ? options . placeholderData (
( _a13 = _ _privateGet ( this , _lastQueryWithDefinedData ) ) == null ? void 0 : _a13 . state . data ,
_ _privateGet ( this , _lastQueryWithDefinedData )
) : options . placeholderData ;
}
if ( placeholderData !== void 0 ) {
status = "success" ;
data = replaceData (
prevResult == null ? void 0 : prevResult . data ,
placeholderData ,
options
) ;
isPlaceholderData = true ;
}
}
if ( options . select && data !== void 0 && ! skipSelect ) {
if ( prevResult && data === ( prevResultState == null ? void 0 : prevResultState . data ) && options . select === _ _privateGet ( this , _selectFn ) ) {
data = _ _privateGet ( this , _selectResult ) ;
} else {
try {
_ _privateSet ( this , _selectFn , options . select ) ;
data = options . select ( data ) ;
data = replaceData ( prevResult == null ? void 0 : prevResult . data , data , options ) ;
_ _privateSet ( this , _selectResult , data ) ;
_ _privateSet ( this , _selectError , null ) ;
} catch ( selectError ) {
_ _privateSet ( this , _selectError , selectError ) ;
}
}
}
if ( _ _privateGet ( this , _selectError ) ) {
error = _ _privateGet ( this , _selectError ) ;
data = _ _privateGet ( 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 result = {
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 : newState . dataUpdateCount > 0 || newState . errorUpdateCount > 0 ,
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 : _ _privateGet ( this , _currentThenable ) ,
isEnabled : resolveEnabled ( options . enabled , query ) !== false
} ;
const nextResult = result ;
if ( this . options . experimental _prefetchInRender ) {
const finalizeThenableIfPossible = ( thenable ) => {
if ( nextResult . status === "error" ) {
thenable . reject ( nextResult . error ) ;
} else if ( nextResult . data !== void 0 ) {
thenable . resolve ( nextResult . data ) ;
}
} ;
const recreateThenable = ( ) => {
const pending = _ _privateSet ( this , _currentThenable , nextResult . promise = pendingThenable ( ) ) ;
finalizeThenableIfPossible ( pending ) ;
} ;
const prevThenable = _ _privateGet ( this , _currentThenable ) ;
switch ( prevThenable . status ) {
case "pending" :
if ( query . queryHash === prevQuery . queryHash ) {
finalizeThenableIfPossible ( prevThenable ) ;
}
break ;
case "fulfilled" :
if ( nextResult . status === "error" || nextResult . data !== prevThenable . value ) {
recreateThenable ( ) ;
}
break ;
case "rejected" :
if ( nextResult . status !== "error" || nextResult . error !== prevThenable . reason ) {
recreateThenable ( ) ;
}
break ;
}
}
return nextResult ;
}
updateResult ( ) {
const prevResult = _ _privateGet ( this , _currentResult ) ;
const nextResult = this . createResult ( _ _privateGet ( this , _currentQuery ) , this . options ) ;
_ _privateSet ( this , _currentResultState , _ _privateGet ( this , _currentQuery ) . state ) ;
_ _privateSet ( this , _currentResultOptions , this . options ) ;
if ( _ _privateGet ( this , _currentResultState ) . data !== void 0 ) {
_ _privateSet ( this , _lastQueryWithDefinedData , _ _privateGet ( this , _currentQuery ) ) ;
}
if ( shallowEqualObjects ( nextResult , prevResult ) ) {
return ;
}
_ _privateSet ( this , _currentResult , nextResult ) ;
const shouldNotifyListeners = ( ) => {
if ( ! prevResult ) {
return true ;
}
const { notifyOnChangeProps } = this . options ;
const notifyOnChangePropsValue = typeof notifyOnChangeProps === "function" ? notifyOnChangeProps ( ) : notifyOnChangeProps ;
if ( notifyOnChangePropsValue === "all" || ! notifyOnChangePropsValue && ! _ _privateGet ( this , _trackedProps ) . size ) {
return true ;
}
const includedProps = new Set (
notifyOnChangePropsValue ? ? _ _privateGet ( this , _trackedProps )
) ;
if ( this . options . throwOnError ) {
includedProps . add ( "error" ) ;
}
return Object . keys ( _ _privateGet ( this , _currentResult ) ) . some ( ( key ) => {
const typedKey = key ;
const changed = _ _privateGet ( this , _currentResult ) [ typedKey ] !== prevResult [ typedKey ] ;
return changed && includedProps . has ( typedKey ) ;
} ) ;
} ;
_ _privateMethod ( this , _QueryObserver _instances , notify _fn ) . call ( this , { listeners : shouldNotifyListeners ( ) } ) ;
}
onQueryUpdate ( ) {
this . updateResult ( ) ;
if ( this . hasListeners ( ) ) {
_ _privateMethod ( this , _QueryObserver _instances , updateTimers _fn ) . call ( this ) ;
}
}
} , _client2 = new WeakMap ( ) , _currentQuery = new WeakMap ( ) , _currentQueryInitialState = new WeakMap ( ) , _currentResult = new WeakMap ( ) , _currentResultState = new WeakMap ( ) , _currentResultOptions = new WeakMap ( ) , _currentThenable = new WeakMap ( ) , _selectError = new WeakMap ( ) , _selectFn = new WeakMap ( ) , _selectResult = new WeakMap ( ) , _lastQueryWithDefinedData = new WeakMap ( ) , _staleTimeoutId = new WeakMap ( ) , _refetchIntervalId = new WeakMap ( ) , _currentRefetchInterval = new WeakMap ( ) , _trackedProps = new WeakMap ( ) , _QueryObserver _instances = new WeakSet ( ) , executeFetch _fn = function ( fetchOptions ) {
_ _privateMethod ( this , _QueryObserver _instances , updateQuery _fn ) . call ( this ) ;
let promise = _ _privateGet ( this , _currentQuery ) . fetch (
this . options ,
fetchOptions
) ;
if ( ! ( fetchOptions == null ? void 0 : fetchOptions . throwOnError ) ) {
promise = promise . catch ( noop ) ;
}
return promise ;
} , updateStaleTimeout _fn = function ( ) {
_ _privateMethod ( this , _QueryObserver _instances , clearStaleTimeout _fn ) . call ( this ) ;
const staleTime = resolveStaleTime (
this . options . staleTime ,
_ _privateGet ( this , _currentQuery )
) ;
if ( isServer || _ _privateGet ( this , _currentResult ) . isStale || ! isValidTimeout ( staleTime ) ) {
return ;
}
const time = timeUntilStale ( _ _privateGet ( this , _currentResult ) . dataUpdatedAt , staleTime ) ;
const timeout = time + 1 ;
_ _privateSet ( this , _staleTimeoutId , timeoutManager . setTimeout ( ( ) => {
if ( ! _ _privateGet ( this , _currentResult ) . isStale ) {
this . updateResult ( ) ;
}
} , timeout ) ) ;
} , computeRefetchInterval _fn = function ( ) {
return ( typeof this . options . refetchInterval === "function" ? this . options . refetchInterval ( _ _privateGet ( this , _currentQuery ) ) : this . options . refetchInterval ) ? ? false ;
} , updateRefetchInterval _fn = function ( nextInterval ) {
_ _privateMethod ( this , _QueryObserver _instances , clearRefetchInterval _fn ) . call ( this ) ;
_ _privateSet ( this , _currentRefetchInterval , nextInterval ) ;
if ( isServer || resolveEnabled ( this . options . enabled , _ _privateGet ( this , _currentQuery ) ) === false || ! isValidTimeout ( _ _privateGet ( this , _currentRefetchInterval ) ) || _ _privateGet ( this , _currentRefetchInterval ) === 0 ) {
return ;
}
_ _privateSet ( this , _refetchIntervalId , timeoutManager . setInterval ( ( ) => {
if ( this . options . refetchIntervalInBackground || focusManager . isFocused ( ) ) {
_ _privateMethod ( this , _QueryObserver _instances , executeFetch _fn ) . call ( this ) ;
}
} , _ _privateGet ( this , _currentRefetchInterval ) ) ) ;
} , updateTimers _fn = function ( ) {
_ _privateMethod ( this , _QueryObserver _instances , updateStaleTimeout _fn ) . call ( this ) ;
_ _privateMethod ( this , _QueryObserver _instances , updateRefetchInterval _fn ) . call ( this , _ _privateMethod ( this , _QueryObserver _instances , computeRefetchInterval _fn ) . call ( this ) ) ;
} , clearStaleTimeout _fn = function ( ) {
if ( _ _privateGet ( this , _staleTimeoutId ) ) {
timeoutManager . clearTimeout ( _ _privateGet ( this , _staleTimeoutId ) ) ;
_ _privateSet ( this , _staleTimeoutId , void 0 ) ;
}
} , clearRefetchInterval _fn = function ( ) {
if ( _ _privateGet ( this , _refetchIntervalId ) ) {
timeoutManager . clearInterval ( _ _privateGet ( this , _refetchIntervalId ) ) ;
_ _privateSet ( this , _refetchIntervalId , void 0 ) ;
}
} , updateQuery _fn = function ( ) {
const query = _ _privateGet ( this , _client2 ) . getQueryCache ( ) . build ( _ _privateGet ( this , _client2 ) , this . options ) ;
if ( query === _ _privateGet ( this , _currentQuery ) ) {
return ;
}
const prevQuery = _ _privateGet ( this , _currentQuery ) ;
_ _privateSet ( this , _currentQuery , query ) ;
_ _privateSet ( this , _currentQueryInitialState , query . state ) ;
if ( this . hasListeners ( ) ) {
prevQuery == null ? void 0 : prevQuery . removeObserver ( this ) ;
query . addObserver ( this ) ;
}
} , notify _fn = function ( notifyOptions ) {
notifyManager . batch ( ( ) => {
if ( notifyOptions . listeners ) {
this . listeners . forEach ( ( listener ) => {
listener ( _ _privateGet ( this , _currentResult ) ) ;
} ) ;
}
_ _privateGet ( this , _client2 ) . getQueryCache ( ) . notify ( {
query : _ _privateGet ( this , _currentQuery ) ,
type : "observerResultsUpdated"
} ) ;
} ) ;
} , _a6 ) ;
function shouldLoadOnMount ( query , options ) {
return resolveEnabled ( options . enabled , query ) !== false && query . state . data === void 0 && ! ( query . state . status === "error" && options . retryOnMount === 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 ( resolveEnabled ( 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 || resolveEnabled ( prevOptions . enabled , query ) === false ) && ( ! options . suspense || query . state . status !== "error" ) && isStale ( query , options ) ;
}
function isStale ( query , options ) {
return resolveEnabled ( options . enabled , query ) !== false && query . isStaleByTime ( resolveStaleTime ( options . staleTime , query ) ) ;
}
function shouldAssignObserverCurrentProperties ( observer , optimisticResult ) {
if ( ! shallowEqualObjects ( observer . getCurrentResult ( ) , optimisticResult ) ) {
return true ;
}
return false ;
}
// node_modules/@tanstack/query-core/build/modern/infiniteQueryBehavior.js
function infiniteQueryBehavior ( pages ) {
return {
onFetch : ( context , query ) => {
var _a13 , _b , _c , _d , _e ;
const options = context . options ;
const direction = ( _c = ( _b = ( _a13 = context . fetchOptions ) == null ? void 0 : _a13 . meta ) == null ? void 0 : _b . fetchMore ) == null ? void 0 : _c . direction ;
const oldPages = ( ( _d = context . state . data ) == null ? void 0 : _d . pages ) || [ ] ;
const oldPageParams = ( ( _e = context . state . data ) == null ? void 0 : _e . pageParams ) || [ ] ;
let result = { pages : [ ] , pageParams : [ ] } ;
let currentPage = 0 ;
const fetchFn = async ( ) => {
let cancelled = false ;
const addSignalProperty = ( object ) => {
2026-01-02 22:46:03 -05:00
addConsumeAwareSignal (
object ,
( ) => context . signal ,
( ) => cancelled = true
) ;
2025-12-25 20:20:40 -05:00
} ;
const queryFn = ensureQueryFn ( context . options , context . fetchOptions ) ;
const fetchPage = async ( data , param , previous ) => {
if ( cancelled ) {
return Promise . reject ( ) ;
}
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 queryFnContext = createQueryFnContext ( ) ;
const page = await queryFn ( queryFnContext ) ;
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
} ;
const param = pageParamFn ( options , oldData ) ;
result = await fetchPage ( oldData , param , 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 = ( ) => {
var _a14 , _b2 ;
return ( _b2 = ( _a14 = context . options ) . persister ) == null ? void 0 : _b2 . call (
_a14 ,
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 } ) {
var _a13 ;
return pages . length > 0 ? ( _a13 = options . getPreviousPageParam ) == null ? void 0 : _a13 . call ( options , 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 ;
}
// 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 ) {
super . setOptions ( {
... options ,
behavior : infiniteQueryBehavior ( )
} ) ;
}
getOptimisticResult ( options ) {
options . behavior = infiniteQueryBehavior ( ) ;
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 ) {
var _a13 , _b ;
const { state } = query ;
const parentResult = super . createResult ( query , options ) ;
const { isFetching , isRefetching , isError , isRefetchError } = parentResult ;
const fetchDirection = ( _b = ( _a13 = state . fetchMeta ) == null ? void 0 : _a13 . fetchMore ) == null ? void 0 : _b . direction ;
const isFetchNextPageError = isError && fetchDirection === "forward" ;
const isFetchingNextPage = isFetching && fetchDirection === "forward" ;
const isFetchPreviousPageError = isError && fetchDirection === "backward" ;
const isFetchingPreviousPage = isFetching && fetchDirection === "backward" ;
const result = {
... 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
} ;
return result ;
}
} ;
// node_modules/@tanstack/query-core/build/modern/mutation.js
var _client3 , _observers , _mutationCache , _retryer2 , _Mutation _instances , dispatch _fn2 , _a7 ;
var Mutation = ( _a7 = class extends Removable {
constructor ( config ) {
super ( ) ;
_ _privateAdd ( this , _Mutation _instances ) ;
_ _privateAdd ( this , _client3 ) ;
_ _privateAdd ( this , _observers ) ;
_ _privateAdd ( this , _mutationCache ) ;
_ _privateAdd ( this , _retryer2 ) ;
_ _privateSet ( this , _client3 , config . client ) ;
this . mutationId = config . mutationId ;
_ _privateSet ( this , _mutationCache , config . mutationCache ) ;
_ _privateSet ( this , _observers , [ ] ) ;
this . state = config . state || getDefaultState2 ( ) ;
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 ( ! _ _privateGet ( this , _observers ) . includes ( observer ) ) {
_ _privateGet ( this , _observers ) . push ( observer ) ;
this . clearGcTimeout ( ) ;
_ _privateGet ( this , _mutationCache ) . notify ( {
type : "observerAdded" ,
mutation : this ,
observer
} ) ;
}
}
removeObserver ( observer ) {
_ _privateSet ( this , _observers , _ _privateGet ( this , _observers ) . filter ( ( x ) => x !== observer ) ) ;
this . scheduleGc ( ) ;
_ _privateGet ( this , _mutationCache ) . notify ( {
type : "observerRemoved" ,
mutation : this ,
observer
} ) ;
}
optionalRemove ( ) {
if ( ! _ _privateGet ( this , _observers ) . length ) {
if ( this . state . status === "pending" ) {
this . scheduleGc ( ) ;
} else {
_ _privateGet ( this , _mutationCache ) . remove ( this ) ;
}
}
}
continue ( ) {
var _a13 ;
return ( ( _a13 = _ _privateGet ( this , _retryer2 ) ) == null ? void 0 : _a13 . continue ( ) ) ? ? // continuing a mutation assumes that variables are set, mutation must have been dehydrated before
this . execute ( this . state . variables ) ;
}
async execute ( variables ) {
var _a13 , _b , _c , _d , _e , _f , _g , _h , _i , _j , _k , _l , _m , _n , _o , _p , _q , _r , _s , _t ;
const onContinue = ( ) => {
_ _privateMethod ( this , _Mutation _instances , dispatch _fn2 ) . call ( this , { type : "continue" } ) ;
} ;
const mutationFnContext = {
client : _ _privateGet ( this , _client3 ) ,
meta : this . options . meta ,
mutationKey : this . options . mutationKey
} ;
_ _privateSet ( this , _retryer2 , createRetryer ( {
fn : ( ) => {
if ( ! this . options . mutationFn ) {
return Promise . reject ( new Error ( "No mutationFn found" ) ) ;
}
return this . options . mutationFn ( variables , mutationFnContext ) ;
} ,
onFail : ( failureCount , error ) => {
_ _privateMethod ( this , _Mutation _instances , dispatch _fn2 ) . call ( this , { type : "failed" , failureCount , error } ) ;
} ,
onPause : ( ) => {
_ _privateMethod ( this , _Mutation _instances , dispatch _fn2 ) . call ( this , { type : "pause" } ) ;
} ,
onContinue ,
retry : this . options . retry ? ? 0 ,
retryDelay : this . options . retryDelay ,
networkMode : this . options . networkMode ,
canRun : ( ) => _ _privateGet ( this , _mutationCache ) . canRun ( this )
} ) ) ;
const restored = this . state . status === "pending" ;
const isPaused = ! _ _privateGet ( this , _retryer2 ) . canStart ( ) ;
try {
if ( restored ) {
onContinue ( ) ;
} else {
_ _privateMethod ( this , _Mutation _instances , dispatch _fn2 ) . call ( this , { type : "pending" , variables , isPaused } ) ;
await ( ( _b = ( _a13 = _ _privateGet ( this , _mutationCache ) . config ) . onMutate ) == null ? void 0 : _b . call (
_a13 ,
variables ,
this ,
mutationFnContext
) ) ;
const context = await ( ( _d = ( _c = this . options ) . onMutate ) == null ? void 0 : _d . call (
_c ,
variables ,
mutationFnContext
) ) ;
if ( context !== this . state . context ) {
_ _privateMethod ( this , _Mutation _instances , dispatch _fn2 ) . call ( this , {
type : "pending" ,
context ,
variables ,
isPaused
} ) ;
}
}
const data = await _ _privateGet ( this , _retryer2 ) . start ( ) ;
await ( ( _f = ( _e = _ _privateGet ( this , _mutationCache ) . config ) . onSuccess ) == null ? void 0 : _f . call (
_e ,
data ,
variables ,
this . state . context ,
this ,
mutationFnContext
) ) ;
await ( ( _h = ( _g = this . options ) . onSuccess ) == null ? void 0 : _h . call (
_g ,
data ,
variables ,
this . state . context ,
mutationFnContext
) ) ;
await ( ( _j = ( _i = _ _privateGet ( this , _mutationCache ) . config ) . onSettled ) == null ? void 0 : _j . call (
_i ,
data ,
null ,
this . state . variables ,
this . state . context ,
this ,
mutationFnContext
) ) ;
await ( ( _l = ( _k = this . options ) . onSettled ) == null ? void 0 : _l . call (
_k ,
data ,
null ,
variables ,
this . state . context ,
mutationFnContext
) ) ;
_ _privateMethod ( this , _Mutation _instances , dispatch _fn2 ) . call ( this , { type : "success" , data } ) ;
return data ;
} catch ( error ) {
try {
await ( ( _n = ( _m = _ _privateGet ( this , _mutationCache ) . config ) . onError ) == null ? void 0 : _n . call (
_m ,
error ,
variables ,
this . state . context ,
this ,
mutationFnContext
) ) ;
2026-01-02 22:46:03 -05:00
} catch ( e ) {
void Promise . reject ( e ) ;
}
try {
2025-12-25 20:20:40 -05:00
await ( ( _p = ( _o = this . options ) . onError ) == null ? void 0 : _p . call (
_o ,
error ,
variables ,
this . state . context ,
mutationFnContext
) ) ;
2026-01-02 22:46:03 -05:00
} catch ( e ) {
void Promise . reject ( e ) ;
}
try {
2025-12-25 20:20:40 -05:00
await ( ( _r = ( _q = _ _privateGet ( this , _mutationCache ) . config ) . onSettled ) == null ? void 0 : _r . call (
_q ,
void 0 ,
error ,
this . state . variables ,
this . state . context ,
this ,
mutationFnContext
) ) ;
2026-01-02 22:46:03 -05:00
} catch ( e ) {
void Promise . reject ( e ) ;
}
try {
2025-12-25 20:20:40 -05:00
await ( ( _t = ( _s = this . options ) . onSettled ) == null ? void 0 : _t . call (
_s ,
void 0 ,
error ,
variables ,
this . state . context ,
mutationFnContext
) ) ;
2026-01-02 22:46:03 -05:00
} catch ( e ) {
void Promise . reject ( e ) ;
2025-12-25 20:20:40 -05:00
}
2026-01-02 22:46:03 -05:00
_ _privateMethod ( this , _Mutation _instances , dispatch _fn2 ) . call ( this , { type : "error" , error } ) ;
throw error ;
2025-12-25 20:20:40 -05:00
} finally {
_ _privateGet ( this , _mutationCache ) . runNext ( this ) ;
}
}
} , _client3 = new WeakMap ( ) , _observers = new WeakMap ( ) , _mutationCache = new WeakMap ( ) , _retryer2 = new WeakMap ( ) , _Mutation _instances = new WeakSet ( ) , dispatch _fn2 = function ( 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 ( ( ) => {
_ _privateGet ( this , _observers ) . forEach ( ( observer ) => {
observer . onMutationUpdate ( action ) ;
} ) ;
_ _privateGet ( this , _mutationCache ) . notify ( {
mutation : this ,
type : "updated" ,
action
} ) ;
} ) ;
} , _a7 ) ;
function getDefaultState2 ( ) {
return {
context : void 0 ,
data : void 0 ,
error : null ,
failureCount : 0 ,
failureReason : null ,
isPaused : false ,
status : "idle" ,
variables : void 0 ,
submittedAt : 0
} ;
}
// node_modules/@tanstack/query-core/build/modern/mutationCache.js
var _mutations , _scopes , _mutationId , _a8 ;
var MutationCache = ( _a8 = class extends Subscribable {
constructor ( config = { } ) {
super ( ) ;
_ _privateAdd ( this , _mutations ) ;
_ _privateAdd ( this , _scopes ) ;
_ _privateAdd ( this , _mutationId ) ;
this . config = config ;
_ _privateSet ( this , _mutations , /* @__PURE__ */ new Set ( ) ) ;
_ _privateSet ( this , _scopes , /* @__PURE__ */ new Map ( ) ) ;
_ _privateSet ( this , _mutationId , 0 ) ;
}
build ( client , options , state ) {
const mutation = new Mutation ( {
client ,
mutationCache : this ,
mutationId : ++ _ _privateWrapper ( this , _mutationId ) . _ ,
options : client . defaultMutationOptions ( options ) ,
state
} ) ;
this . add ( mutation ) ;
return mutation ;
}
add ( mutation ) {
_ _privateGet ( this , _mutations ) . add ( mutation ) ;
const scope = scopeFor ( mutation ) ;
if ( typeof scope === "string" ) {
const scopedMutations = _ _privateGet ( this , _scopes ) . get ( scope ) ;
if ( scopedMutations ) {
scopedMutations . push ( mutation ) ;
} else {
_ _privateGet ( this , _scopes ) . set ( scope , [ mutation ] ) ;
}
}
this . notify ( { type : "added" , mutation } ) ;
}
remove ( mutation ) {
if ( _ _privateGet ( this , _mutations ) . delete ( mutation ) ) {
const scope = scopeFor ( mutation ) ;
if ( typeof scope === "string" ) {
const scopedMutations = _ _privateGet ( 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 ) {
_ _privateGet ( this , _scopes ) . delete ( scope ) ;
}
}
}
}
this . notify ( { type : "removed" , mutation } ) ;
}
canRun ( mutation ) {
const scope = scopeFor ( mutation ) ;
if ( typeof scope === "string" ) {
const mutationsWithSameScope = _ _privateGet ( this , _scopes ) . get ( scope ) ;
const firstPendingMutation = mutationsWithSameScope == null ? void 0 : mutationsWithSameScope . find (
( m ) => m . state . status === "pending"
) ;
return ! firstPendingMutation || firstPendingMutation === mutation ;
} else {
return true ;
}
}
runNext ( mutation ) {
var _a13 ;
const scope = scopeFor ( mutation ) ;
if ( typeof scope === "string" ) {
const foundMutation = ( _a13 = _ _privateGet ( this , _scopes ) . get ( scope ) ) == null ? void 0 : _a13 . find ( ( m ) => m !== mutation && m . state . isPaused ) ;
return ( foundMutation == null ? void 0 : foundMutation . continue ( ) ) ? ? Promise . resolve ( ) ;
} else {
return Promise . resolve ( ) ;
}
}
clear ( ) {
notifyManager . batch ( ( ) => {
_ _privateGet ( this , _mutations ) . forEach ( ( mutation ) => {
this . notify ( { type : "removed" , mutation } ) ;
} ) ;
_ _privateGet ( this , _mutations ) . clear ( ) ;
_ _privateGet ( this , _scopes ) . clear ( ) ;
} ) ;
}
getAll ( ) {
return Array . from ( _ _privateGet ( 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 ) )
)
) ;
}
} , _mutations = new WeakMap ( ) , _scopes = new WeakMap ( ) , _mutationId = new WeakMap ( ) , _a8 ) ;
function scopeFor ( mutation ) {
var _a13 ;
return ( _a13 = mutation . options . scope ) == null ? void 0 : _a13 . id ;
}
// node_modules/@tanstack/query-core/build/modern/mutationObserver.js
var _client4 , _currentResult2 , _currentMutation , _mutateOptions , _MutationObserver _instances , updateResult _fn , notify _fn2 , _a9 ;
var MutationObserver = ( _a9 = class extends Subscribable {
constructor ( client , options ) {
super ( ) ;
_ _privateAdd ( this , _MutationObserver _instances ) ;
_ _privateAdd ( this , _client4 ) ;
_ _privateAdd ( this , _currentResult2 ) ;
_ _privateAdd ( this , _currentMutation ) ;
_ _privateAdd ( this , _mutateOptions ) ;
_ _privateSet ( this , _client4 , client ) ;
this . setOptions ( options ) ;
this . bindMethods ( ) ;
_ _privateMethod ( this , _MutationObserver _instances , updateResult _fn ) . call ( this ) ;
}
bindMethods ( ) {
this . mutate = this . mutate . bind ( this ) ;
this . reset = this . reset . bind ( this ) ;
}
setOptions ( options ) {
var _a13 ;
const prevOptions = this . options ;
this . options = _ _privateGet ( this , _client4 ) . defaultMutationOptions ( options ) ;
if ( ! shallowEqualObjects ( this . options , prevOptions ) ) {
_ _privateGet ( this , _client4 ) . getMutationCache ( ) . notify ( {
type : "observerOptionsUpdated" ,
mutation : _ _privateGet ( this , _currentMutation ) ,
observer : this
} ) ;
}
if ( ( prevOptions == null ? void 0 : prevOptions . mutationKey ) && this . options . mutationKey && hashKey ( prevOptions . mutationKey ) !== hashKey ( this . options . mutationKey ) ) {
this . reset ( ) ;
} else if ( ( ( _a13 = _ _privateGet ( this , _currentMutation ) ) == null ? void 0 : _a13 . state . status ) === "pending" ) {
_ _privateGet ( this , _currentMutation ) . setOptions ( this . options ) ;
}
}
onUnsubscribe ( ) {
var _a13 ;
if ( ! this . hasListeners ( ) ) {
( _a13 = _ _privateGet ( this , _currentMutation ) ) == null ? void 0 : _a13 . removeObserver ( this ) ;
}
}
onMutationUpdate ( action ) {
_ _privateMethod ( this , _MutationObserver _instances , updateResult _fn ) . call ( this ) ;
_ _privateMethod ( this , _MutationObserver _instances , notify _fn2 ) . call ( this , action ) ;
}
getCurrentResult ( ) {
return _ _privateGet ( this , _currentResult2 ) ;
}
reset ( ) {
var _a13 ;
( _a13 = _ _privateGet ( this , _currentMutation ) ) == null ? void 0 : _a13 . removeObserver ( this ) ;
_ _privateSet ( this , _currentMutation , void 0 ) ;
_ _privateMethod ( this , _MutationObserver _instances , updateResult _fn ) . call ( this ) ;
_ _privateMethod ( this , _MutationObserver _instances , notify _fn2 ) . call ( this ) ;
}
mutate ( variables , options ) {
var _a13 ;
_ _privateSet ( this , _mutateOptions , options ) ;
( _a13 = _ _privateGet ( this , _currentMutation ) ) == null ? void 0 : _a13 . removeObserver ( this ) ;
_ _privateSet ( this , _currentMutation , _ _privateGet ( this , _client4 ) . getMutationCache ( ) . build ( _ _privateGet ( this , _client4 ) , this . options ) ) ;
_ _privateGet ( this , _currentMutation ) . addObserver ( this ) ;
return _ _privateGet ( this , _currentMutation ) . execute ( variables ) ;
}
} , _client4 = new WeakMap ( ) , _currentResult2 = new WeakMap ( ) , _currentMutation = new WeakMap ( ) , _mutateOptions = new WeakMap ( ) , _MutationObserver _instances = new WeakSet ( ) , updateResult _fn = function ( ) {
var _a13 ;
const state = ( ( _a13 = _ _privateGet ( this , _currentMutation ) ) == null ? void 0 : _a13 . state ) ? ? getDefaultState2 ( ) ;
_ _privateSet ( this , _currentResult2 , {
... state ,
isPending : state . status === "pending" ,
isSuccess : state . status === "success" ,
isError : state . status === "error" ,
isIdle : state . status === "idle" ,
mutate : this . mutate ,
reset : this . reset
} ) ;
} , notify _fn2 = function ( action ) {
notifyManager . batch ( ( ) => {
var _a13 , _b , _c , _d , _e , _f , _g , _h ;
if ( _ _privateGet ( this , _mutateOptions ) && this . hasListeners ( ) ) {
const variables = _ _privateGet ( this , _currentResult2 ) . variables ;
const onMutateResult = _ _privateGet ( this , _currentResult2 ) . context ;
const context = {
client : _ _privateGet ( this , _client4 ) ,
meta : this . options . meta ,
mutationKey : this . options . mutationKey
} ;
if ( ( action == null ? void 0 : action . type ) === "success" ) {
2026-01-02 22:46:03 -05:00
try {
( _b = ( _a13 = _ _privateGet ( this , _mutateOptions ) ) . onSuccess ) == null ? void 0 : _b . call (
_a13 ,
action . data ,
variables ,
onMutateResult ,
context
) ;
} catch ( e ) {
void Promise . reject ( e ) ;
}
try {
( _d = ( _c = _ _privateGet ( this , _mutateOptions ) ) . onSettled ) == null ? void 0 : _d . call (
_c ,
action . data ,
null ,
variables ,
onMutateResult ,
context
) ;
} catch ( e ) {
void Promise . reject ( e ) ;
}
2025-12-25 20:20:40 -05:00
} else if ( ( action == null ? void 0 : action . type ) === "error" ) {
2026-01-02 22:46:03 -05:00
try {
( _f = ( _e = _ _privateGet ( this , _mutateOptions ) ) . onError ) == null ? void 0 : _f . call (
_e ,
action . error ,
variables ,
onMutateResult ,
context
) ;
} catch ( e ) {
void Promise . reject ( e ) ;
}
try {
( _h = ( _g = _ _privateGet ( this , _mutateOptions ) ) . onSettled ) == null ? void 0 : _h . call (
_g ,
void 0 ,
action . error ,
variables ,
onMutateResult ,
context
) ;
} catch ( e ) {
void Promise . reject ( e ) ;
}
2025-12-25 20:20:40 -05:00
}
}
this . listeners . forEach ( ( listener ) => {
listener ( _ _privateGet ( this , _currentResult2 ) ) ;
} ) ;
} ) ;
} , _a9 ) ;
// 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 _client5 , _result , _queries , _options , _observers2 , _combinedResult , _lastCombine , _lastResult , _observerMatches , _QueriesObserver _instances , trackResult _fn , combineResult _fn , findMatchingObservers _fn , onUpdate _fn , notify _fn3 , _a10 ;
var QueriesObserver = ( _a10 = class extends Subscribable {
constructor ( client , queries , options ) {
super ( ) ;
_ _privateAdd ( this , _QueriesObserver _instances ) ;
_ _privateAdd ( this , _client5 ) ;
_ _privateAdd ( this , _result ) ;
_ _privateAdd ( this , _queries ) ;
_ _privateAdd ( this , _options ) ;
_ _privateAdd ( this , _observers2 ) ;
_ _privateAdd ( this , _combinedResult ) ;
_ _privateAdd ( this , _lastCombine ) ;
_ _privateAdd ( this , _lastResult ) ;
_ _privateAdd ( this , _observerMatches , [ ] ) ;
_ _privateSet ( this , _client5 , client ) ;
_ _privateSet ( this , _options , options ) ;
_ _privateSet ( this , _queries , [ ] ) ;
_ _privateSet ( this , _observers2 , [ ] ) ;
_ _privateSet ( this , _result , [ ] ) ;
this . setQueries ( queries ) ;
}
onSubscribe ( ) {
if ( this . listeners . size === 1 ) {
_ _privateGet ( this , _observers2 ) . forEach ( ( observer ) => {
observer . subscribe ( ( result ) => {
_ _privateMethod ( this , _QueriesObserver _instances , onUpdate _fn ) . call ( this , observer , result ) ;
} ) ;
} ) ;
}
}
onUnsubscribe ( ) {
if ( ! this . listeners . size ) {
this . destroy ( ) ;
}
}
destroy ( ) {
this . listeners = /* @__PURE__ */ new Set ( ) ;
_ _privateGet ( this , _observers2 ) . forEach ( ( observer ) => {
observer . destroy ( ) ;
} ) ;
}
setQueries ( queries , options ) {
_ _privateSet ( this , _queries , queries ) ;
_ _privateSet ( this , _options , options ) ;
if ( true ) {
const queryHashes = queries . map (
( query ) => _ _privateGet ( this , _client5 ) . 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 = _ _privateGet ( this , _observers2 ) ;
const newObserverMatches = _ _privateMethod ( this , _QueriesObserver _instances , findMatchingObservers _fn ) . call ( this , _ _privateGet ( 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 = _ _privateGet ( this , _result ) [ index ] ;
return ! prev || ! shallowEqualObjects ( result , prev ) ;
} ) ;
if ( ! hasStructuralChange && ! hasResultChange ) return ;
if ( hasStructuralChange ) {
2026-01-02 22:46:03 -05:00
_ _privateSet ( this , _observerMatches , newObserverMatches ) ;
2025-12-25 20:20:40 -05:00
_ _privateSet ( this , _observers2 , newObservers ) ;
}
_ _privateSet ( this , _result , newResult ) ;
if ( ! this . hasListeners ( ) ) return ;
if ( hasStructuralChange ) {
difference ( prevObservers , newObservers ) . forEach ( ( observer ) => {
observer . destroy ( ) ;
} ) ;
difference ( newObservers , prevObservers ) . forEach ( ( observer ) => {
observer . subscribe ( ( result ) => {
_ _privateMethod ( this , _QueriesObserver _instances , onUpdate _fn ) . call ( this , observer , result ) ;
} ) ;
} ) ;
}
_ _privateMethod ( this , _QueriesObserver _instances , notify _fn3 ) . call ( this ) ;
} ) ;
}
getCurrentResult ( ) {
return _ _privateGet ( this , _result ) ;
}
getQueries ( ) {
return _ _privateGet ( this , _observers2 ) . map ( ( observer ) => observer . getCurrentQuery ( ) ) ;
}
getObservers ( ) {
return _ _privateGet ( this , _observers2 ) ;
}
getOptimisticResult ( queries , combine ) {
const matches = _ _privateMethod ( this , _QueriesObserver _instances , findMatchingObservers _fn ) . call ( this , queries ) ;
const result = matches . map (
( match ) => match . observer . getOptimisticResult ( match . defaultedQueryOptions )
) ;
return [
result ,
( r ) => {
return _ _privateMethod ( this , _QueriesObserver _instances , combineResult _fn ) . call ( this , r ? ? result , combine ) ;
} ,
( ) => {
return _ _privateMethod ( this , _QueriesObserver _instances , trackResult _fn ) . call ( this , result , matches ) ;
}
] ;
}
} , _client5 = new WeakMap ( ) , _result = new WeakMap ( ) , _queries = new WeakMap ( ) , _options = new WeakMap ( ) , _observers2 = new WeakMap ( ) , _combinedResult = new WeakMap ( ) , _lastCombine = new WeakMap ( ) , _lastResult = new WeakMap ( ) , _observerMatches = new WeakMap ( ) , _QueriesObserver _instances = new WeakSet ( ) , trackResult _fn = function ( 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 _fn = function ( input , combine ) {
if ( combine ) {
if ( ! _ _privateGet ( this , _combinedResult ) || _ _privateGet ( this , _result ) !== _ _privateGet ( this , _lastResult ) || combine !== _ _privateGet ( this , _lastCombine ) ) {
_ _privateSet ( this , _lastCombine , combine ) ;
_ _privateSet ( this , _lastResult , _ _privateGet ( this , _result ) ) ;
_ _privateSet ( this , _combinedResult , replaceEqualDeep (
_ _privateGet ( this , _combinedResult ) ,
combine ( input )
) ) ;
}
return _ _privateGet ( this , _combinedResult ) ;
}
return input ;
} , findMatchingObservers _fn = function ( queries ) {
const prevObserversMap = /* @__PURE__ */ new Map ( ) ;
_ _privateGet ( this , _observers2 ) . 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 ) => {
var _a13 ;
const defaultedOptions = _ _privateGet ( this , _client5 ) . defaultQueryOptions ( options ) ;
const match = ( _a13 = prevObserversMap . get ( defaultedOptions . queryHash ) ) == null ? void 0 : _a13 . shift ( ) ;
const observer = match ? ? new QueryObserver ( _ _privateGet ( this , _client5 ) , defaultedOptions ) ;
observers . push ( {
defaultedQueryOptions : defaultedOptions ,
observer
} ) ;
} ) ;
return observers ;
} , onUpdate _fn = function ( observer , result ) {
const index = _ _privateGet ( this , _observers2 ) . indexOf ( observer ) ;
if ( index !== - 1 ) {
_ _privateSet ( this , _result , replaceAt ( _ _privateGet ( this , _result ) , index , result ) ) ;
_ _privateMethod ( this , _QueriesObserver _instances , notify _fn3 ) . call ( this ) ;
}
} , notify _fn3 = function ( ) {
var _a13 ;
if ( this . hasListeners ( ) ) {
const previousResult = _ _privateGet ( this , _combinedResult ) ;
const newTracked = _ _privateMethod ( this , _QueriesObserver _instances , trackResult _fn ) . call ( this , _ _privateGet ( this , _result ) , _ _privateGet ( this , _observerMatches ) ) ;
const newResult = _ _privateMethod ( this , _QueriesObserver _instances , combineResult _fn ) . call ( this , newTracked , ( _a13 = _ _privateGet ( this , _options ) ) == null ? void 0 : _a13 . combine ) ;
if ( previousResult !== newResult ) {
notifyManager . batch ( ( ) => {
this . listeners . forEach ( ( listener ) => {
listener ( _ _privateGet ( this , _result ) ) ;
} ) ;
} ) ;
}
}
} , _a10 ) ;
// node_modules/@tanstack/query-core/build/modern/queryCache.js
var _queries2 , _a11 ;
var QueryCache = ( _a11 = class extends Subscribable {
constructor ( config = { } ) {
super ( ) ;
_ _privateAdd ( this , _queries2 ) ;
this . config = config ;
_ _privateSet ( this , _queries2 , /* @__PURE__ */ new Map ( ) ) ;
}
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 ( ! _ _privateGet ( this , _queries2 ) . has ( query . queryHash ) ) {
_ _privateGet ( this , _queries2 ) . set ( query . queryHash , query ) ;
this . notify ( {
type : "added" ,
query
} ) ;
}
}
remove ( query ) {
const queryInMap = _ _privateGet ( this , _queries2 ) . get ( query . queryHash ) ;
if ( queryInMap ) {
query . destroy ( ) ;
if ( queryInMap === query ) {
_ _privateGet ( this , _queries2 ) . delete ( query . queryHash ) ;
}
this . notify ( { type : "removed" , query } ) ;
}
}
clear ( ) {
notifyManager . batch ( ( ) => {
this . getAll ( ) . forEach ( ( query ) => {
this . remove ( query ) ;
} ) ;
} ) ;
}
get ( queryHash ) {
return _ _privateGet ( this , _queries2 ) . get ( queryHash ) ;
}
getAll ( ) {
return [ ... _ _privateGet ( this , _queries2 ) . 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 ( ) ;
} ) ;
} ) ;
}
} , _queries2 = new WeakMap ( ) , _a11 ) ;
// node_modules/@tanstack/query-core/build/modern/queryClient.js
var _queryCache , _mutationCache2 , _defaultOptions2 , _queryDefaults , _mutationDefaults , _mountCount , _unsubscribeFocus , _unsubscribeOnline , _a12 ;
var QueryClient = ( _a12 = class {
constructor ( config = { } ) {
_ _privateAdd ( this , _queryCache ) ;
_ _privateAdd ( this , _mutationCache2 ) ;
_ _privateAdd ( this , _defaultOptions2 ) ;
_ _privateAdd ( this , _queryDefaults ) ;
_ _privateAdd ( this , _mutationDefaults ) ;
_ _privateAdd ( this , _mountCount ) ;
_ _privateAdd ( this , _unsubscribeFocus ) ;
_ _privateAdd ( this , _unsubscribeOnline ) ;
_ _privateSet ( this , _queryCache , config . queryCache || new QueryCache ( ) ) ;
_ _privateSet ( this , _mutationCache2 , config . mutationCache || new MutationCache ( ) ) ;
_ _privateSet ( this , _defaultOptions2 , config . defaultOptions || { } ) ;
_ _privateSet ( this , _queryDefaults , /* @__PURE__ */ new Map ( ) ) ;
_ _privateSet ( this , _mutationDefaults , /* @__PURE__ */ new Map ( ) ) ;
_ _privateSet ( this , _mountCount , 0 ) ;
}
mount ( ) {
_ _privateWrapper ( this , _mountCount ) . _ ++ ;
if ( _ _privateGet ( this , _mountCount ) !== 1 ) return ;
_ _privateSet ( this , _unsubscribeFocus , focusManager . subscribe ( async ( focused ) => {
if ( focused ) {
await this . resumePausedMutations ( ) ;
_ _privateGet ( this , _queryCache ) . onFocus ( ) ;
}
} ) ) ;
_ _privateSet ( this , _unsubscribeOnline , onlineManager . subscribe ( async ( online ) => {
if ( online ) {
await this . resumePausedMutations ( ) ;
_ _privateGet ( this , _queryCache ) . onOnline ( ) ;
}
} ) ) ;
}
unmount ( ) {
var _a13 , _b ;
_ _privateWrapper ( this , _mountCount ) . _ -- ;
if ( _ _privateGet ( this , _mountCount ) !== 0 ) return ;
( _a13 = _ _privateGet ( this , _unsubscribeFocus ) ) == null ? void 0 : _a13 . call ( this ) ;
_ _privateSet ( this , _unsubscribeFocus , void 0 ) ;
( _b = _ _privateGet ( this , _unsubscribeOnline ) ) == null ? void 0 : _b . call ( this ) ;
_ _privateSet ( this , _unsubscribeOnline , void 0 ) ;
}
isFetching ( filters ) {
return _ _privateGet ( this , _queryCache ) . findAll ( { ... filters , fetchStatus : "fetching" } ) . length ;
}
isMutating ( filters ) {
return _ _privateGet ( this , _mutationCache2 ) . 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 ) {
var _a13 ;
const options = this . defaultQueryOptions ( { queryKey } ) ;
return ( _a13 = _ _privateGet ( this , _queryCache ) . get ( options . queryHash ) ) == null ? void 0 : _a13 . state . data ;
}
ensureQueryData ( options ) {
const defaultedOptions = this . defaultQueryOptions ( options ) ;
const query = _ _privateGet ( 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 ) ) ) {
void this . prefetchQuery ( defaultedOptions ) ;
}
return Promise . resolve ( cachedData ) ;
}
getQueriesData ( filters ) {
return _ _privateGet ( this , _queryCache ) . findAll ( filters ) . map ( ( { queryKey , state } ) => {
const data = state . data ;
return [ queryKey , data ] ;
} ) ;
}
setQueryData ( queryKey , updater , options ) {
const defaultedOptions = this . defaultQueryOptions ( { queryKey } ) ;
const query = _ _privateGet ( this , _queryCache ) . get (
defaultedOptions . queryHash
) ;
const prevData = query == null ? void 0 : query . state . data ;
const data = functionalUpdate ( updater , prevData ) ;
if ( data === void 0 ) {
return void 0 ;
}
return _ _privateGet ( this , _queryCache ) . build ( this , defaultedOptions ) . setData ( data , { ... options , manual : true } ) ;
}
setQueriesData ( filters , updater , options ) {
return notifyManager . batch (
( ) => _ _privateGet ( this , _queryCache ) . findAll ( filters ) . map ( ( { queryKey } ) => [
queryKey ,
this . setQueryData ( queryKey , updater , options )
] )
) ;
}
getQueryState ( queryKey ) {
var _a13 ;
const options = this . defaultQueryOptions ( { queryKey } ) ;
return ( _a13 = _ _privateGet ( this , _queryCache ) . get (
options . queryHash
) ) == null ? void 0 : _a13 . state ;
}
removeQueries ( filters ) {
const queryCache = _ _privateGet ( this , _queryCache ) ;
notifyManager . batch ( ( ) => {
queryCache . findAll ( filters ) . forEach ( ( query ) => {
queryCache . remove ( query ) ;
} ) ;
} ) ;
}
resetQueries ( filters , options ) {
const queryCache = _ _privateGet ( 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 (
( ) => _ _privateGet ( this , _queryCache ) . findAll ( filters ) . map ( ( query ) => query . cancel ( defaultedCancelOptions ) )
) ;
return Promise . all ( promises ) . then ( noop ) . catch ( noop ) ;
}
invalidateQueries ( filters , options = { } ) {
return notifyManager . batch ( ( ) => {
_ _privateGet ( this , _queryCache ) . findAll ( filters ) . forEach ( ( query ) => {
query . invalidate ( ) ;
} ) ;
if ( ( filters == null ? void 0 : filters . refetchType ) === "none" ) {
return Promise . resolve ( ) ;
}
return this . refetchQueries (
{
... filters ,
type : ( filters == null ? void 0 : filters . refetchType ) ? ? ( filters == null ? void 0 : filters . type ) ? ? "active"
} ,
options
) ;
} ) ;
}
refetchQueries ( filters , options = { } ) {
const fetchOptions = {
... options ,
cancelRefetch : options . cancelRefetch ? ? true
} ;
const promises = notifyManager . batch (
( ) => _ _privateGet ( 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 = _ _privateGet ( 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 . behavior = infiniteQueryBehavior ( options . pages ) ;
return this . fetchQuery ( options ) ;
}
prefetchInfiniteQuery ( options ) {
return this . fetchInfiniteQuery ( options ) . then ( noop ) . catch ( noop ) ;
}
ensureInfiniteQueryData ( options ) {
options . behavior = infiniteQueryBehavior ( options . pages ) ;
return this . ensureQueryData ( options ) ;
}
resumePausedMutations ( ) {
if ( onlineManager . isOnline ( ) ) {
return _ _privateGet ( this , _mutationCache2 ) . resumePausedMutations ( ) ;
}
return Promise . resolve ( ) ;
}
getQueryCache ( ) {
return _ _privateGet ( this , _queryCache ) ;
}
getMutationCache ( ) {
return _ _privateGet ( this , _mutationCache2 ) ;
}
getDefaultOptions ( ) {
return _ _privateGet ( this , _defaultOptions2 ) ;
}
setDefaultOptions ( options ) {
_ _privateSet ( this , _defaultOptions2 , options ) ;
}
setQueryDefaults ( queryKey , options ) {
_ _privateGet ( this , _queryDefaults ) . set ( hashKey ( queryKey ) , {
queryKey ,
defaultOptions : options
} ) ;
}
getQueryDefaults ( queryKey ) {
const defaults = [ ... _ _privateGet ( this , _queryDefaults ) . values ( ) ] ;
const result = { } ;
defaults . forEach ( ( queryDefault ) => {
if ( partialMatchKey ( queryKey , queryDefault . queryKey ) ) {
Object . assign ( result , queryDefault . defaultOptions ) ;
}
} ) ;
return result ;
}
setMutationDefaults ( mutationKey , options ) {
_ _privateGet ( this , _mutationDefaults ) . set ( hashKey ( mutationKey ) , {
mutationKey ,
defaultOptions : options
} ) ;
}
getMutationDefaults ( mutationKey ) {
const defaults = [ ... _ _privateGet ( 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 = {
... _ _privateGet ( this , _defaultOptions2 ) . 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 == null ? void 0 : options . _defaulted ) {
return options ;
}
return {
... _ _privateGet ( this , _defaultOptions2 ) . mutations ,
... ( options == null ? void 0 : options . mutationKey ) && this . getMutationDefaults ( options . mutationKey ) ,
... options ,
_defaulted : true
} ;
}
clear ( ) {
_ _privateGet ( this , _queryCache ) . clear ( ) ;
_ _privateGet ( this , _mutationCache2 ) . clear ( ) ;
}
} , _queryCache = new WeakMap ( ) , _mutationCache2 = new WeakMap ( ) , _defaultOptions2 = new WeakMap ( ) , _queryDefaults = new WeakMap ( ) , _mutationDefaults = new WeakMap ( ) , _mountCount = new WeakMap ( ) , _unsubscribeFocus = new WeakMap ( ) , _unsubscribeOnline = new WeakMap ( ) , _a12 ) ;
// 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 . state . data !== void 0 ;
if ( isRefetch && refetchMode === "reset" ) {
query . setState ( {
status : "pending" ,
data : void 0 ,
error : null ,
fetchStatus : "fetching"
} ) ;
}
let result = initialValue ;
2026-01-02 22:46:03 -05:00
let cancelled = false ;
const streamFnContext = addConsumeAwareSignal (
{
client : context . client ,
meta : context . meta ,
queryKey : context . queryKey ,
pageParam : context . pageParam ,
direction : context . direction
} ,
( ) => context . signal ,
( ) => cancelled = true
) ;
const stream = await streamFn ( streamFnContext ) ;
const isReplaceRefetch = isRefetch && refetchMode === "replace" ;
2025-12-25 20:20:40 -05:00
for await ( const chunk of stream ) {
2026-01-02 22:46:03 -05:00
if ( cancelled ) {
2025-12-25 20:20:40 -05:00
break ;
}
2026-01-02 22:46:03 -05:00
if ( isReplaceRefetch ) {
result = reducer ( result , chunk ) ;
} else {
2025-12-25 20:20:40 -05:00
context . client . setQueryData (
context . queryKey ,
( prev ) => reducer ( prev === void 0 ? initialValue : prev , chunk )
) ;
}
}
2026-01-02 22:46:03 -05:00
if ( isReplaceRefetch && ! cancelled ) {
2025-12-25 20:20:40 -05:00
context . client . setQueryData ( context . queryKey , result ) ;
}
return context . client . getQueryData ( context . queryKey ) ? ? initialValue ;
} ;
}
// node_modules/@tanstack/query-core/build/modern/types.js
var dataTagSymbol = Symbol ( "dataTagSymbol" ) ;
var dataTagErrorSymbol = Symbol ( "dataTagErrorSymbol" ) ;
var unsetMarker = Symbol ( "unsetMarker" ) ;
// node_modules/@tanstack/react-query/build/modern/useQueries.js
var React5 = _ _toESM ( require _react ( ) , 1 ) ;
// node_modules/@tanstack/react-query/build/modern/QueryClientProvider.js
var React = _ _toESM ( require _react ( ) , 1 ) ;
var import _jsx _runtime = _ _toESM ( require _jsx _runtime ( ) , 1 ) ;
var QueryClientContext = React . createContext (
void 0
) ;
var useQueryClient = ( queryClient ) => {
const client = 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
} ) => {
React . useEffect ( ( ) => {
client . mount ( ) ;
return ( ) => {
client . unmount ( ) ;
} ;
} , [ client ] ) ;
return ( 0 , import _jsx _runtime . jsx ) ( QueryClientContext . Provider , { value : client , children } ) ;
} ;
// node_modules/@tanstack/react-query/build/modern/IsRestoringProvider.js
var React2 = _ _toESM ( require _react ( ) , 1 ) ;
var IsRestoringContext = React2 . createContext ( false ) ;
var useIsRestoring = ( ) => React2 . useContext ( IsRestoringContext ) ;
var IsRestoringProvider = IsRestoringContext . Provider ;
// node_modules/@tanstack/react-query/build/modern/QueryErrorResetBoundary.js
var React3 = _ _toESM ( require _react ( ) , 1 ) ;
var import _jsx _runtime2 = _ _toESM ( require _jsx _runtime ( ) , 1 ) ;
function createValue ( ) {
let isReset = false ;
return {
clearReset : ( ) => {
isReset = false ;
} ,
reset : ( ) => {
isReset = true ;
} ,
isReset : ( ) => {
return isReset ;
}
} ;
}
var QueryErrorResetBoundaryContext = React3 . createContext ( createValue ( ) ) ;
var useQueryErrorResetBoundary = ( ) => React3 . useContext ( QueryErrorResetBoundaryContext ) ;
var QueryErrorResetBoundary = ( {
children
} ) => {
const [ value ] = React3 . useState ( ( ) => createValue ( ) ) ;
return ( 0 , import _jsx _runtime2 . jsx ) ( QueryErrorResetBoundaryContext . Provider , { value , children : typeof children === "function" ? children ( value ) : children } ) ;
} ;
// node_modules/@tanstack/react-query/build/modern/errorBoundaryUtils.js
var React4 = _ _toESM ( require _react ( ) , 1 ) ;
2026-01-02 22:46:03 -05:00
var ensurePreventErrorBoundaryRetry = ( options , errorResetBoundary , query ) => {
const throwOnError = ( query == null ? void 0 : query . state . error ) && typeof options . throwOnError === "function" ? shouldThrowError ( options . throwOnError , [ query . state . error , query ] ) : options . throwOnError ;
if ( options . suspense || options . experimental _prefetchInRender || throwOnError ) {
2025-12-25 20:20:40 -05:00
if ( ! errorResetBoundary . isReset ( ) ) {
options . retryOnMount = false ;
}
}
} ;
var useClearResetErrorBoundary = ( errorResetBoundary ) => {
React4 . 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 ] ) ) ;
} ;
// 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 == null ? void 0 : defaultedOptions . suspense ) && result . isPending ;
var fetchOptimistic = ( defaultedOptions , observer , errorResetBoundary ) => observer . fetchOptimistic ( defaultedOptions ) . catch ( ( ) => {
errorResetBoundary . clearReset ( ) ;
} ) ;
// 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 = React5 . useMemo (
( ) => queries . map ( ( opts ) => {
const defaultedOptions = client . defaultQueryOptions (
opts
) ;
defaultedOptions . _optimisticResults = isRestoring ? "isRestoring" : "optimistic" ;
return defaultedOptions ;
} ) ,
[ queries , client , isRestoring ]
) ;
2026-01-02 22:46:03 -05:00
defaultedQueries . forEach ( ( queryOptions2 ) => {
ensureSuspenseTimers ( queryOptions2 ) ;
const query = client . getQueryCache ( ) . get ( queryOptions2 . queryHash ) ;
ensurePreventErrorBoundaryRetry ( queryOptions2 , errorResetBoundary , query ) ;
2025-12-25 20:20:40 -05:00
} ) ;
useClearResetErrorBoundary ( errorResetBoundary ) ;
const [ observer ] = React5 . useState (
( ) => new QueriesObserver (
client ,
defaultedQueries ,
options
)
) ;
const [ optimisticResult , getCombinedResult , trackResult ] = observer . getOptimisticResult (
defaultedQueries ,
options . combine
) ;
const shouldSubscribe = ! isRestoring && options . subscribed !== false ;
React5 . useSyncExternalStore (
React5 . useCallback (
( onStoreChange ) => shouldSubscribe ? observer . subscribe ( notifyManager . batchCalls ( onStoreChange ) ) : noop ,
[ observer , shouldSubscribe ]
) ,
( ) => observer . getCurrentResult ( ) ,
( ) => observer . getCurrentResult ( )
) ;
React5 . useEffect ( ( ) => {
observer . setQueries (
defaultedQueries ,
options
) ;
} , [ defaultedQueries , options , observer ] ) ;
const shouldAtLeastOneSuspend = optimisticResult . some (
( result , index ) => shouldSuspend ( defaultedQueries [ index ] , result )
) ;
const suspensePromises = shouldAtLeastOneSuspend ? optimisticResult . flatMap ( ( result , index ) => {
const opts = defaultedQueries [ index ] ;
if ( opts ) {
const queryObserver = new QueryObserver ( client , opts ) ;
if ( shouldSuspend ( opts , result ) ) {
return fetchOptimistic ( opts , queryObserver , errorResetBoundary ) ;
} else if ( willFetch ( result , isRestoring ) ) {
void fetchOptimistic ( opts , queryObserver , 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 == null ? void 0 : firstSingleResultWhichShouldThrow . error ) {
throw firstSingleResultWhichShouldThrow . error ;
}
return getCombinedResult ( trackResult ( ) ) ;
}
// node_modules/@tanstack/react-query/build/modern/useBaseQuery.js
var React6 = _ _toESM ( require _react ( ) , 1 ) ;
function useBaseQuery ( options , Observer , queryClient ) {
2026-01-02 22:46:03 -05:00
var _a13 , _b , _c , _d ;
2025-12-25 20:20:40 -05:00
if ( true ) {
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 ) ;
( _b = ( _a13 = client . getDefaultOptions ( ) . queries ) == null ? void 0 : _a13 . _experimental _beforeQuery ) == null ? void 0 : _b . call (
_a13 ,
defaultedOptions
) ;
2026-01-02 22:46:03 -05:00
const query = client . getQueryCache ( ) . get ( defaultedOptions . queryHash ) ;
2025-12-25 20:20:40 -05:00
if ( true ) {
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 ) ;
2026-01-02 22:46:03 -05:00
ensurePreventErrorBoundaryRetry ( defaultedOptions , errorResetBoundary , query ) ;
2025-12-25 20:20:40 -05:00
useClearResetErrorBoundary ( errorResetBoundary ) ;
const isNewCacheEntry = ! client . getQueryCache ( ) . get ( defaultedOptions . queryHash ) ;
const [ observer ] = React6 . useState (
( ) => new Observer (
client ,
defaultedOptions
)
) ;
const result = observer . getOptimisticResult ( defaultedOptions ) ;
const shouldSubscribe = ! isRestoring && options . subscribed !== false ;
React6 . useSyncExternalStore (
React6 . useCallback (
( onStoreChange ) => {
const unsubscribe = shouldSubscribe ? observer . subscribe ( notifyManager . batchCalls ( onStoreChange ) ) : noop ;
observer . updateResult ( ) ;
return unsubscribe ;
} ,
[ observer , shouldSubscribe ]
) ,
( ) => observer . getCurrentResult ( ) ,
( ) => observer . getCurrentResult ( )
) ;
React6 . useEffect ( ( ) => {
observer . setOptions ( defaultedOptions ) ;
} , [ defaultedOptions , observer ] ) ;
if ( shouldSuspend ( defaultedOptions , result ) ) {
throw fetchOptimistic ( defaultedOptions , observer , errorResetBoundary ) ;
}
if ( getHasError ( {
result ,
errorResetBoundary ,
throwOnError : defaultedOptions . throwOnError ,
2026-01-02 22:46:03 -05:00
query ,
2025-12-25 20:20:40 -05:00
suspense : defaultedOptions . suspense
} ) ) {
throw result . error ;
}
;
( _d = ( _c = client . getDefaultOptions ( ) . queries ) == null ? void 0 : _c . _experimental _afterQuery ) == null ? void 0 : _d . call (
_c ,
defaultedOptions ,
result
) ;
if ( defaultedOptions . experimental _prefetchInRender && ! isServer && willFetch ( result , isRestoring ) ) {
const promise = isNewCacheEntry ? (
// Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted
fetchOptimistic ( defaultedOptions , observer , errorResetBoundary )
) : (
// subscribe to the "cache promise" so that we can finalize the currentThenable once data comes in
2026-01-02 22:46:03 -05:00
query == null ? void 0 : query . promise
2025-12-25 20:20:40 -05:00
) ;
promise == null ? void 0 : promise . catch ( noop ) . finally ( ( ) => {
observer . updateResult ( ) ;
} ) ;
}
return ! defaultedOptions . notifyOnChangeProps ? observer . trackResult ( result ) : result ;
}
// node_modules/@tanstack/react-query/build/modern/useQuery.js
function useQuery ( options , queryClient ) {
return useBaseQuery ( options , QueryObserver , queryClient ) ;
}
// node_modules/@tanstack/react-query/build/modern/useSuspenseQuery.js
function useSuspenseQuery ( options , queryClient ) {
if ( true ) {
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
) ;
}
// node_modules/@tanstack/react-query/build/modern/useSuspenseInfiniteQuery.js
function useSuspenseInfiniteQuery ( options , queryClient ) {
if ( true ) {
if ( options . queryFn === skipToken ) {
console . error ( "skipToken is not allowed for useSuspenseInfiniteQuery" ) ;
}
}
return useBaseQuery (
{
... options ,
enabled : true ,
suspense : true ,
throwOnError : defaultThrowOnError
} ,
InfiniteQueryObserver ,
queryClient
) ;
}
// node_modules/@tanstack/react-query/build/modern/useSuspenseQueries.js
function useSuspenseQueries ( options , queryClient ) {
return useQueries (
{
... options ,
queries : options . queries . map ( ( query ) => {
if ( true ) {
if ( query . queryFn === skipToken ) {
console . error ( "skipToken is not allowed for useSuspenseQueries" ) ;
}
}
return {
... query ,
suspense : true ,
throwOnError : defaultThrowOnError ,
enabled : true ,
placeholderData : void 0
} ;
} )
} ,
queryClient
) ;
}
// 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 ) ;
}
}
// 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 ) ;
}
}
// node_modules/@tanstack/react-query/build/modern/queryOptions.js
function queryOptions ( options ) {
return options ;
}
// node_modules/@tanstack/react-query/build/modern/infiniteQueryOptions.js
function infiniteQueryOptions ( options ) {
return options ;
}
// node_modules/@tanstack/react-query/build/modern/HydrationBoundary.js
var React7 = _ _toESM ( require _react ( ) , 1 ) ;
var HydrationBoundary = ( {
children ,
options = { } ,
state ,
queryClient
} ) => {
const client = useQueryClient ( queryClient ) ;
const optionsRef = React7 . useRef ( options ) ;
React7 . useEffect ( ( ) => {
optionsRef . current = options ;
} ) ;
const hydrationQueue = React7 . 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 {
const hydrationIsNewer = 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 ;
if ( hydrationIsNewer ) {
existingQueries . push ( dehydratedQuery ) ;
}
}
}
if ( newQueries . length > 0 ) {
hydrate ( client , { queries : newQueries } , optionsRef . current ) ;
}
if ( existingQueries . length > 0 ) {
return existingQueries ;
}
}
return void 0 ;
} , [ client , state ] ) ;
React7 . useEffect ( ( ) => {
if ( hydrationQueue ) {
hydrate ( client , { queries : hydrationQueue } , optionsRef . current ) ;
}
} , [ client , hydrationQueue ] ) ;
return children ;
} ;
// node_modules/@tanstack/react-query/build/modern/useIsFetching.js
var React8 = _ _toESM ( require _react ( ) , 1 ) ;
function useIsFetching ( filters , queryClient ) {
const client = useQueryClient ( queryClient ) ;
const queryCache = client . getQueryCache ( ) ;
return React8 . useSyncExternalStore (
React8 . useCallback (
( onStoreChange ) => queryCache . subscribe ( notifyManager . batchCalls ( onStoreChange ) ) ,
[ queryCache ]
) ,
( ) => client . isFetching ( filters ) ,
( ) => client . isFetching ( filters )
) ;
}
// node_modules/@tanstack/react-query/build/modern/useMutationState.js
var React9 = _ _toESM ( require _react ( ) , 1 ) ;
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 = React9 . useRef ( options ) ;
const result = React9 . useRef ( null ) ;
if ( result . current === null ) {
result . current = getResult ( mutationCache , options ) ;
}
React9 . useEffect ( ( ) => {
optionsRef . current = options ;
} ) ;
return React9 . useSyncExternalStore (
React9 . 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
) ;
}
// node_modules/@tanstack/react-query/build/modern/useMutation.js
var React10 = _ _toESM ( require _react ( ) , 1 ) ;
function useMutation ( options , queryClient ) {
const client = useQueryClient ( queryClient ) ;
const [ observer ] = React10 . useState (
( ) => new MutationObserver (
client ,
options
)
) ;
React10 . useEffect ( ( ) => {
observer . setOptions ( options ) ;
} , [ observer , options ] ) ;
const result = React10 . useSyncExternalStore (
React10 . useCallback (
( onStoreChange ) => observer . subscribe ( notifyManager . batchCalls ( onStoreChange ) ) ,
[ observer ]
) ,
( ) => observer . getCurrentResult ( ) ,
( ) => observer . getCurrentResult ( )
) ;
const mutate = React10 . 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 } ;
}
// node_modules/@tanstack/react-query/build/modern/mutationOptions.js
function mutationOptions ( options ) {
return options ;
}
// node_modules/@tanstack/react-query/build/modern/useInfiniteQuery.js
function useInfiniteQuery ( options , queryClient ) {
return useBaseQuery (
options ,
InfiniteQueryObserver ,
queryClient
) ;
}
export {
CancelledError ,
HydrationBoundary ,
InfiniteQueryObserver ,
IsRestoringProvider ,
Mutation ,
MutationCache ,
MutationObserver ,
QueriesObserver ,
Query ,
QueryCache ,
QueryClient ,
QueryClientContext ,
QueryClientProvider ,
QueryErrorResetBoundary ,
QueryObserver ,
dataTagErrorSymbol ,
dataTagSymbol ,
defaultScheduler ,
defaultShouldDehydrateMutation ,
defaultShouldDehydrateQuery ,
dehydrate ,
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