/**
 * BrowserService — singleton managing Playwright browser lifecycle.
 *
 * One browser instance, one persistent context, multiple pages (tabs).
 * Collects console messages and network requests automatically.
 * Follows the same singleton pattern as fetcher-mcp's BrowserService.
 *
 * Playwright is loaded lazily on first use (not at import time). This allows
 * the module to load in standalone Bun binaries where playwright is unavailable.
 * Tools will report a clear "Browser unavailable" error instead of crashing.
 */
import type { Browser, BrowserContext, Page } from "playwright";
import type { BrowserConfig } from "./config.js";
export interface NetworkRequest {
    index: number;
    url: string;
    method: string;
    status: number;
    statusText: string;
    headers: Record<string, string>;
    responseHeaders: Record<string, string>;
    postData?: string;
    body?: string;
    timestamp: number;
}
export declare class BrowserService {
    private browser;
    private context;
    private pages;
    private activePageIndex;
    private config;
    private consoleBuffer;
    private networkBuffer;
    private nextNetworkIndex;
    private pendingDialogs;
    constructor(config?: Partial<BrowserConfig>);
    /** Get or create the singleton instance. */
    static getInstance(config?: Partial<BrowserConfig>): BrowserService;
    /** Reset singleton (for testing). */
    static resetInstance(): void;
    /** Check whether Playwright is installed and loadable (static, does NOT start a browser). */
    static isAvailable(): boolean;
    /**
     * Human-readable message explaining why the browser is unavailable.
     * Returns null when the browser is available.
     */
    static unavailabilityReason(): string | null;
    /** Ensure browser, context, and at least one page are ready. */
    ensureBrowser(): Promise<{
        browser: Browser;
        context: BrowserContext;
        page: Page;
    }>;
    /** Get the currently active page. */
    getActivePage(): Page;
    /** Navigate to a URL on the active page. */
    navigate(url: string): Promise<{
        title: string;
        url: string;
    }>;
    /** Navigate back. */
    navigateBack(): Promise<{
        title: string;
        url: string;
    }>;
    /** Close the active page. If last page, create a blank one. */
    closePage(): Promise<void>;
    /** Resize the viewport. */
    resize(width: number, height: number): Promise<void>;
    listTabs(): Array<{
        index: number;
        title: string;
        url: string;
    }>;
    createTab(): Promise<{
        index: number;
    }>;
    closeTab(index: number): Promise<void>;
    selectTab(index: number): Promise<{
        index: number;
    }>;
    private installDialogInterceptor;
    getPendingDialogs(): Array<{
        message: string;
        type: string;
    }>;
    handleDialog(accept: boolean, promptText?: string): Promise<string>;
    getConsoleMessages(level?: "error" | "warning" | "info" | "debug", all?: boolean): Array<{
        type: string;
        text: string;
        pageUrl: string;
    }>;
    clearConsoleMessages(): void;
    trackNetworkRequest(page: Page): void;
    getNetworkRequests(): NetworkRequest[];
    getNetworkRequest(index: number): NetworkRequest | undefined;
    clearNetworkRequests(): void;
    /** Close browser, context, and all pages. */
    close(): Promise<void>;
    /** Reset console/network buffers. */
    resetBuffers(): void;
    getConfig(): BrowserConfig;
}
//# sourceMappingURL=browser-service.d.ts.map