import type { RouteProps } from '../isomorphic-utils/route-path.js'; type Elements = Readonly>; /** * A fetch attempt and its intended browser URL, which can differ for a custom * 404. `follows` counts earlier redirects and custom-404 follows in this navigation. */ export type RouteAttempt = { route: RouteProps; url: URL; follows: number; }; /** * Fetches one attempt's elements. Return `undefined` only when this Root * already has usable content for the attempt. An empty record cancels the * update, preserving the active route. Forward the signal to transport. */ export type FetchRoute = (attempt: RouteAttempt, signal: AbortSignal) => Promise; /** * `route` identifies the last fetch/follow attempt. A successful payload's * route metadata can identify a different server-rendered destination, which * the binding must reconcile before committing. */ export type LoadOutcome = { type: 'loaded'; route: RouteProps; url: URL; elements: Elements; follows: number; } | { type: 'reused'; route: RouteProps; url: URL; follows: number; } | { type: 'failed'; route: RouteProps; url: URL; error: unknown; follows: number; } | { type: 'aborted'; } | { type: 'leave'; url: URL; follows: number; location: URL; }; /** A payload-bearing outcome; does not imply that React has committed it. */ export type Loaded = Extract; /** * `url` defaults to the requested route's URL. `follows` defaults to zero; * pass the preceding count when following a route intent. `has404` enables * recovery from HTTP 404s, including missing files on a static host. */ export type LoadOptions = { signal: AbortSignal; has404: boolean; url?: URL; follows?: number; }; export declare function rejectOnAbort(promise: Promise, signal: AbortSignal | undefined): Promise; /** * Fetches a route through the supplied callback without merging elements or * updating browser state. Ready intents and HTTP 404s follow within the navigation * budget before returning a payload. `leave` carries the attempted `url` and * external `location`; the binding commits history before replacing the document. * Cancellation stops waiting even if the callback ignores its * signal. Pending intents do not delay loading; the binding observes them after * committing and reconciles the final response's route metadata. * * @example * const outcome = await unstable_load(fetchRoute, route, { signal, has404 }); */ export declare function load(fetchRoute: FetchRoute, requested: RouteProps, opts: LoadOptions): Promise; export {};