import { t as VikeState } from "../store-DRuFjsY3.mjs"; //#region src/__internal/client.d.ts declare function createLinkClickHandler(onNavigate: (url: URL) => void): (e: MouseEvent) => void; declare function createLinkPrefetchHandler(onPrefetch: (url: URL) => void): (e: Event) => void; declare function finalizeNavigation(shouldScrollToTop: { current: boolean; }): void; interface ViewComponents { Page: TComponent | null; Layout: TComponent | null; Head: TComponent | null; } /** * Shape of a dynamically-imported `+Page`/`+Layout`/`+Head` module. The actual * component type isn't statically known here (it's whatever the framework * adapter's JSX/template runtime expects) — callers of `loadViewModules` * specify it via the `TComponent` type param instead. */ interface ViewModule { default?: unknown; Page?: unknown; Layout?: unknown; Head?: unknown; } interface RouteModuleLoaders { Page: () => Promise; Layout?: () => Promise; Head?: () => Promise; } /** * Load a route's Page/Layout/Head modules in parallel and resolve each * module's export (named export first, falling back to the default export). */ declare function loadViewModules(route: RouteModuleLoaders): Promise>; /** * Build the URL of the `+data`/`+title` JSON endpoint for a given pathname * (e.g. base "/my-app" and path "/about" → "/my-app/about.pageContext.json"). */ declare function buildPageContextJsonUrl(pathname: string, search: string): string; /** Shape of a `.pageContext.json` payload as produced by the server-side `+data`/`+title` hooks. */ interface PageContextJson { data?: unknown; title?: string; is404?: boolean; is500?: boolean; isError?: boolean; reason?: string; _redirect?: string; } /** * Fetch and parse a `.pageContext.json` endpoint, throwing a descriptive error * if a proxy/CDN intercepted the request with a non-JSON response. */ declare function fetchPageContextJson(jsonUrl: string, options: { signal: AbortSignal; cache?: RequestCache; }): Promise; interface PrefetchableRoute { page?: string; layout?: string; head?: string; Page?: () => Promise; Layout?: () => Promise; Head?: () => Promise; } /** * Create a per-router-instance prefetcher that loads a route's modules at most once * (e.g. on link hover/focus), retrying later if the load failed. */ declare function createRoutePrefetcher(): (route: PrefetchableRoute) => void; /** * Detect a stale module graph error (dev server restarted / new build deployed) and * force a full browser reload, guarded against reload loops via sessionStorage. * Returns true if a reload was triggered — the caller should stop further error handling. */ declare function tryRecoverFromStaleModuleGraph(message: string, urlToReload: string): boolean; /** * Stamp the client-only flags that every `PageContextClient` requires (`isClientSide`, * `isHydration`) onto the raw context blob the server injected via `window.__PAGE_CONTEXT__`. * Centralized so every adapter sets these consistently instead of some silently omitting them. */ declare function buildInitialClientContext(rawContext: T | undefined, isHydration: boolean): T & { isClientSide: true; isHydration: boolean; }; /** * Build the pageContext object for a completed client-side navigation. Centralized * here (rather than each adapter constructing its own object literal) so the * required `isClientSide`/`isHydration` flags can never be silently omitted — * every adapter previously had to remember to add them by hand, and more than * one forgot, silently dropping the flags from `pageContext` on every navigation. */ declare function buildNavigationPageContext(fields: T): T & { isClientSide: true; isHydration: false; }; interface HydrationInitialContext { urlPathname?: string; is404?: boolean; is500?: boolean; errorMessage?: string; } /** * Resolve the Page/Layout/Head modules to hydrate with, matching what the server * actually rendered into the HTML: the error route's modules when the server * reported a 404/500/error, otherwise the modules of the route matching the * initial pathname. Returns a null view when hydration isn't happening (client * takeover) — the router's own first-load effect performs the initial load instead. */ declare function resolveHydrationView(initialContext: HydrationInitialContext, isHydration: boolean, routes: VikeState['routes'], errorRoute: VikeState['errorRoute']): Promise>; /** * Consume the server-injected initial context if it still matches the given pathname * (i.e. this is the very first client-side route load, right after SSR hydration/render). * Clears the global reference so a later remount at the same pathname (e.g. React * StrictMode double-invoke in dev) triggers a real fetch instead of being mistaken * for the original initial load. Returns true if consumed — the caller should skip * loading for this run. */ declare function consumeMatchingInitialContext(pathname: string): boolean; //#endregion export { PageContextJson, ViewComponents, buildInitialClientContext, buildNavigationPageContext, buildPageContextJsonUrl, consumeMatchingInitialContext, createLinkClickHandler, createLinkPrefetchHandler, createRoutePrefetcher, fetchPageContextJson, finalizeNavigation, loadViewModules, resolveHydrationView, tryRecoverFromStaleModuleGraph };