/**
 * Handle data structure: handleName -> segmentId -> entries[]
 *
 * @example
 * ```ts
 * {
 *   "breadcrumbs": {
 *     "$root.layout": [{ label: "Home", href: "/" }],
 *     "shop.layout": [{ label: "Shop", href: "/shop" }],
 *   }
 * }
 * ```
 */
export type HandleData = Record<string, Record<string, unknown[]>>;
/**
 * HandleStore tracks pending handler promises and stores handle data.
 *
 * Combines two responsibilities:
 * 1. Promise tracking - know when all handlers have resolved
 * 2. Data storage - collect handle data pushed by handlers
 * 3. Streaming - emit handle data via async iterator on each push
 */
export interface HandleStore {
    /**
     * Track a handler promise (non-blocking).
     * Returns the promise unchanged - just registers it for tracking.
     */
    track<T>(promise: Promise<T>): Promise<T>;
    /**
     * Promise that resolves when all tracked handlers have settled.
     * Does not reject - uses Promise.allSettled internally.
     */
    readonly settled: Promise<void>;
    /**
     * Push handle data for a specific handle and segment.
     * Multiple pushes to the same handle/segment accumulate in an array.
     * Each push triggers an emission on the stream.
     */
    push(handleName: string, segmentId: string, data: unknown): void;
    /**
     * Get all collected handle data after all handlers have settled.
     * Returns a promise that waits for `settled`, then returns the data.
     * The data may contain unresolved promises which RSC will stream.
     * @deprecated Use stream() for progressive updates
     */
    getData(): Promise<HandleData>;
    /**
     * Get an async iterator that yields handle data on each push.
     * The iterator completes when all handlers have settled.
     * Each yield contains the full accumulated state (not just the delta).
     */
    stream(): AsyncGenerator<HandleData, void, unknown>;
    /**
     * Get handle data for a specific segment (for caching).
     * Returns data in format: { handleName: [values...] }
     */
    getDataForSegment(segmentId: string): Record<string, unknown[]>;
    /**
     * Replay cached handle data back into the store (for cache hits).
     * Used to restore handle data when serving cached segments.
     */
    replaySegmentData(segmentId: string, segmentHandles: Record<string, unknown[]>): void;
}
/**
 * Create a new HandleStore instance.
 *
 * @example
 * ```ts
 * const handleStore = createHandleStore();
 *
 * // In router - track without awaiting
 * const component = handleStore.track(entry.handler(context));
 *
 * // In handler - push handle data (value, promise, or async callback result)
 * handleStore.push("breadcrumbs", segmentId, { label: "Home", href: "/" });
 * handleStore.push("meta", segmentId, fetchMetaAsync()); // promise
 *
 * // Stream handle data progressively
 * for await (const handles of handleStore.stream()) {
 *   console.log("Handle update:", handles);
 * }
 * ```
 */
export declare function createHandleStore(): HandleStore;
//# sourceMappingURL=handle-store.d.ts.map