import type { Database } from './types.js';
export type OpfsSupport = {
    available: boolean;
    reason?: string;
};
/**
 * Feature check for OPFS + cross-origin isolation.
 * We require getDirectory + crossOriginIsolated. createSyncAccessHandle is only
 * available in Web Workers, so we cannot reliably detect it from the main thread;
 * the OPFS VFS runs in a worker and will fail at init if unsupported (we fall
 * back to memory).
 */
export declare function detectOpfsSupport(): OpfsSupport;
/**
 * Remove database and related files (journal, wal) from OPFS storage.
 * Call only after the database handle is closed.
 *
 * @param filename - Path used when opening (e.g. /treecrdt.db or /treecrdt-playground.db)
 */
export declare function clearOpfsStorage(filename: string): Promise<void>;
/**
 * Check whether any DB-related files exist in OPFS for the given filename.
 *
 * @param filename - Path used when opening (e.g. /treecrdt.db or /drop-test-xxx.db)
 */
export declare function opfsStorageExists(filename: string): Promise<boolean>;
export type OpfsVfsKind = 'coop-sync' | 'any-context';
export type OpfsVfsOptions = {
    name?: string;
    kind?: OpfsVfsKind;
};
/**
 * Create an OPFS VFS bound to the provided wa-sqlite Module.
 * Uses local copies of wa-sqlite's example VFS implementations to avoid reaching into vendor paths.
 */
export declare function createOpfsVfs(module: any, opts?: OpfsVfsOptions): Promise<any>;
export type OpenOptions = {
    moduleFactory: () => Promise<any>;
    filename?: string;
    storage: 'memory' | 'opfs';
    sqliteApi: {
        Factory: (module: any) => any;
    };
    opfsVfs?: OpfsVfsKind;
};
/**
 * Convenience: open a wa-sqlite handle with CRDT extension ready, using OPFS when requested.
 */
export declare function openWithStorage(opts: OpenOptions): Promise<{
    db: Database;
    close?: () => Promise<void>;
}>;
