/**
 * Browser Controller
 *
 * Provides browser automation via Chrome DevTools Protocol.
 * Works with both Puppeteer and Playwright-style APIs.
 */
import { EventEmitter } from 'events';
import type { BrowserLaunchOptions, NavigationOptions, ScreenshotOptions, PDFOptions, SelectorOptions, ClickOptions, TypeOptions, Cookie, PageMetrics, ViewportOptions } from './types.js';
/**
 * CDP WebSocket connection
 */
export declare class CDPConnection {
    private ws;
    private messageId;
    private pendingMessages;
    private eventListeners;
    connect(wsUrl: string): Promise<void>;
    private handleMessage;
    private handleClose;
    send(method: string, params?: Record<string, unknown>): Promise<unknown>;
    on(event: string, callback: (params: unknown) => void): void;
    off(event: string, callback: (params: unknown) => void): void;
    disconnect(): void;
}
/**
 * Controls a browser page/tab
 */
export declare class PageController extends EventEmitter {
    private cdp;
    private targetId;
    private frameId;
    constructor(cdp: CDPConnection, targetId: string);
    private setupEventListeners;
    /**
     * Navigate to URL
     */
    goto(url: string, options?: NavigationOptions): Promise<void>;
    /**
     * Wait for navigation to complete
     */
    waitForNavigation(options?: NavigationOptions): Promise<void>;
    /**
     * Get current URL
     */
    url(): Promise<string>;
    /**
     * Get page title
     */
    title(): Promise<string>;
    /**
     * Get page content
     */
    content(): Promise<string>;
    /**
     * Set page content
     */
    setContent(html: string): Promise<void>;
    /**
     * Wait for selector
     */
    waitForSelector(selector: string, options?: SelectorOptions): Promise<void>;
    /**
     * Click element
     */
    click(selector: string, options?: ClickOptions): Promise<void>;
    /**
     * Type text into element
     */
    type(selector: string, text: string, options?: TypeOptions): Promise<void>;
    /**
     * Evaluate JavaScript
     */
    evaluate<T>(fn: string | ((...args: unknown[]) => T), ...args: unknown[]): Promise<T>;
    /**
     * Take screenshot
     */
    screenshot(options?: ScreenshotOptions): Promise<Buffer | string>;
    /**
     * Generate PDF
     */
    pdf(options?: PDFOptions): Promise<Buffer>;
    /**
     * Set viewport
     */
    setViewport(viewport: ViewportOptions): Promise<void>;
    /**
     * Get cookies
     */
    cookies(): Promise<Cookie[]>;
    /**
     * Set cookies
     */
    setCookie(...cookies: Cookie[]): Promise<void>;
    /**
     * Delete cookies
     */
    deleteCookie(...cookies: Pick<Cookie, 'name' | 'domain'>[]): Promise<void>;
    /**
     * Get page metrics
     */
    metrics(): Promise<PageMetrics>;
    /**
     * Reload page
     */
    reload(options?: NavigationOptions): Promise<void>;
    /**
     * Go back
     */
    goBack(options?: NavigationOptions): Promise<void>;
    /**
     * Go forward
     */
    goForward(options?: NavigationOptions): Promise<void>;
    /**
     * Close page
     */
    close(): Promise<void>;
}
/**
 * Main browser controller
 */
export declare class BrowserController extends EventEmitter {
    private options;
    private process;
    private cdp;
    private pagesMap;
    private wsEndpoint;
    constructor(options?: Partial<BrowserLaunchOptions>);
    /**
     * Launch browser
     */
    launch(): Promise<void>;
    /**
     * Find Chrome executable path
     */
    private findChromePath;
    /**
     * Get WebSocket endpoint from browser output
     */
    private getWSEndpoint;
    /**
     * Connect to existing browser
     */
    connect(wsEndpoint: string): Promise<void>;
    /**
     * Create new page
     */
    newPage(): Promise<PageController>;
    /**
     * Get all pages
     */
    pages(): Promise<PageController[]>;
    /**
     * Get browser version
     */
    version(): Promise<string>;
    /**
     * Get WebSocket endpoint
     */
    wsEndpointUrl(): string;
    /**
     * Close browser
     */
    close(): Promise<void>;
    /**
     * Check if browser is connected
     */
    isConnected(): boolean;
}
/**
 * Get or launch browser
 */
export declare function getBrowser(options?: Partial<BrowserLaunchOptions>): Promise<BrowserController>;
/**
 * Close browser
 */
export declare function closeBrowser(): Promise<void>;
