import type { NavigationStore, NavigationClient, UpdateSubscriber, ResolvedSegment } from "./types.js";
import type { ReactNode } from "react";
import type { RenderSegmentsOptions } from "../segment-system.js";
import type { BoundTransaction } from "./navigation-bridge.js";
/**
 * Configuration for creating a partial updater
 */
export interface PartialUpdateConfig {
    store: NavigationStore;
    client: NavigationClient;
    onUpdate: UpdateSubscriber;
    renderSegments: (segments: ResolvedSegment[], options?: RenderSegmentsOptions) => Promise<ReactNode> | ReactNode;
    /** RSC version received from server (from initial payload metadata) */
    version?: string;
}
/**
 * Options that can override the pre-configured commit settings
 */
export interface CommitOverrides {
    /** Override scroll behavior (e.g., disable for intercepts) */
    scroll?: boolean;
    /** Override replace behavior (e.g., force replace for intercepts) */
    replace?: boolean;
    /** Mark this as an intercept route */
    intercept?: boolean;
    /** Source URL where intercept was triggered from */
    interceptSourceUrl?: string;
}
/**
 * Commit context passed to partial updater for URL updates
 * Transaction encapsulates all store mutations for atomic commit
 */
/**
 * Type for the fetchPartialUpdate function
 */
export type PartialUpdater = (targetUrl: string, segmentIds: string[] | undefined, isRetry: boolean, signal: AbortSignal | undefined, type: BoundTransaction, options?: {
    isAction?: boolean;
    staleRevalidation?: boolean;
    interceptSourceUrl?: string;
    /** Cached segments for the target URL. When provided, these are used to build
     * the segment map instead of the current page's segments. This ensures consistency
     * when we send cached segment IDs to the server - if the server returns empty diff,
     * we use the same segments we told the server we have. */
    targetCacheSegments?: ResolvedSegment[];
    /** Cached handle data for the target URL. When server returns empty diff and we're
     * rendering from cache, this is passed to the UI to restore breadcrumbs etc. */
    targetCacheHandleData?: Record<string, Record<string, unknown[]>>;
    /** When true, we're leaving an intercept state - don't use current segment IDs
     * as fallback and force a fresh render from server */
    leavingIntercept?: boolean;
}) => Promise<Promise<void>>;
/**
 * Create a partial updater for fetching and applying RSC partial updates
 *
 * This function is shared between navigation-bridge and server-action-bridge
 * to handle partial RSC updates with HMR resilience.
 *
 * @param config - Partial update configuration
 * @returns fetchPartialUpdate function
 *
 * @example
 * ```typescript
 * const fetchPartialUpdate = createPartialUpdater({
 *   store,
 *   client,
 *   onUpdate: (update) => store.emit(update),
 *   renderSegments,
 * });
 *
 * await fetchPartialUpdate('/new-page');
 * ```
 */
export declare function createPartialUpdater(config: PartialUpdateConfig): PartialUpdater;
export { createPartialUpdater as default };
//# sourceMappingURL=partial-update.d.ts.map