import { C as CookieOptions } from './types-BK2-7cKa.js';

interface StorageAdapter {
    /** Runtime read (post-hydration). */
    get(): string | null;
    /** Runtime write. */
    set(value: string): void;
    /** Optional: subscribe to cross-tab / external changes. */
    subscribe?(cb: (value: string | null) => void): () => void;
}
interface AdapterOptions {
    key: string;
    cookie: Required<Pick<CookieOptions, 'name'>> & Omit<CookieOptions, 'name'>;
    /**
     * Called when a storage read or write throws.
     *
     * Every adapter swallows storage exceptions on purpose — Safari private mode,
     * sandboxed iframes, disabled cookies, and quota-exceeded must never break
     * theming. But swallowing them silently left users with no way to find out
     * why their theme stopped persisting. This is the diagnostic seam: failures
     * stay non-fatal, and now they are also observable.
     */
    onStorageError?: (error: unknown, context: {
        operation: 'get' | 'set';
        key: string;
    }) => void;
}
type AdapterFactory = (opts: AdapterOptions) => StorageAdapter;

declare function readCookieFromString(cookie: string, name: string): string | null;
declare function serializeCookie(name: string, value: string, options?: CookieOptions): string;
declare const cookieAdapter: AdapterFactory;

export { cookieAdapter as c, readCookieFromString as r, serializeCookie as s };
export type { AdapterFactory as A, StorageAdapter as S, AdapterOptions as a };
