import type { TreePrefetch } from '../../../server/app-render/collect-segment-data';
import type { LoadingModuleData } from '../../../shared/lib/app-router-context.shared-runtime';
import { type PrefetchTask } from './scheduler';
import type { RouteCacheKey } from './cache-key';
type RouteCacheEntryShared = {
    staleAt: number;
    couldBeIntercepted: boolean;
};
export declare const enum EntryStatus {
    Pending = 0,
    Rejected = 1,
    Fulfilled = 2
}
type PendingRouteCacheEntry = RouteCacheEntryShared & {
    status: EntryStatus.Pending;
    canonicalUrl: null;
    tree: null;
    head: null;
};
type RejectedRouteCacheEntry = RouteCacheEntryShared & {
    status: EntryStatus.Rejected;
    canonicalUrl: null;
    tree: null;
    head: null;
};
export type FulfilledRouteCacheEntry = RouteCacheEntryShared & {
    status: EntryStatus.Fulfilled;
    canonicalUrl: string;
    tree: TreePrefetch;
    head: React.ReactNode | null;
};
export type RouteCacheEntry = PendingRouteCacheEntry | FulfilledRouteCacheEntry | RejectedRouteCacheEntry;
type SegmentCacheEntryShared = {
    staleAt: number;
};
type PendingSegmentCacheEntry = SegmentCacheEntryShared & {
    status: EntryStatus.Pending;
    rsc: null;
    loading: null;
    promise: null | PromiseWithResolvers<FulfilledSegmentCacheEntry | null>;
};
type RejectedSegmentCacheEntry = SegmentCacheEntryShared & {
    status: EntryStatus.Rejected;
    rsc: null;
    loading: null;
    promise: null;
};
type FulfilledSegmentCacheEntry = SegmentCacheEntryShared & {
    status: EntryStatus.Fulfilled;
    rsc: React.ReactNode | null;
    loading: LoadingModuleData | Promise<LoadingModuleData>;
    promise: null;
};
export type SegmentCacheEntry = PendingSegmentCacheEntry | RejectedSegmentCacheEntry | FulfilledSegmentCacheEntry;
export declare function readRouteCacheEntry(now: number, key: RouteCacheKey): RouteCacheEntry | null;
export declare function readSegmentCacheEntry(now: number, path: string): SegmentCacheEntry | null;
export declare function waitForSegmentCacheEntry(pendingEntry: PendingSegmentCacheEntry): Promise<FulfilledSegmentCacheEntry | null>;
/**
 * Reads the route cache for a matching entry *and* spawns a request if there's
 * no match. Because this may issue a network request, it should only be called
 * from within the context of a prefetch task.
 */
export declare function requestRouteCacheEntryFromCache(now: number, task: PrefetchTask): RouteCacheEntry;
/**
 * Reads the route cache for a matching entry *and* spawns a request if there's
 * no match. Because this may issue a network request, it should only be called
 * from within the context of a prefetch task.
 */
export declare function requestSegmentEntryFromCache(now: number, task: PrefetchTask, route: FulfilledRouteCacheEntry, path: string, accessToken: string): SegmentCacheEntry;
export {};
