import { type Ref } from "./invoke.js";
/**
 * Methods for manipulating and interacting with WebView contents in a ToDesktop
 * window.
 *
 * @remarks
 * This package exposes a number of methods for manipulating and interacting
 * with WebView contents in a ToDesktop window.
 *
 * @see {@link https://docs.todesktop.com}
 * @experimental
 * @public
 * @packageDocumentation
 */
import { AuthenticationResponseDetails, AuthInfo, BluetoothDevice, Certificate, DidCreateWindowDetails, Input, Point, Rectangle, Size, WebPreferences, type WebContents } from "@todesktop/client-electron-types";
import { type NamespaceEvents } from "./utils.js";
/**
 * Loads a URL into the WebContents
 *
 * @param options - ref: Reference for the WebContents
 * @public
 */
export declare function loadURL({ ref }: {
    ref?: Ref;
}, ...args: Parameters<WebContents["loadURL"]>): Promise<void>;
/**
 * @public
 */
export declare type WebContentsEvent = "navigate";
/**
 * Represents the current status of a printer.
 *
 * @public
 * @see https://docs.microsoft.com/en-us/windows/win32/printdocs/printer-info-2
 * @see https://www.cups.org/doc/cupspm.html#basic-destination-information
 * more verbose status messages that may fit in to some of this enum's
 * constants.
 * Perhaps expose all of Windows' status' and map anything not covered by CUPS
 * over?
 */
export declare type PrinterStatus = 
/**
 * The printer is online and awaiting jobs to process.
 * On Windows, this represents `PRINTER_STATUS_WAITING`.
 * On macOS and Linux, this represents CUPS status 3.
 */
"Idle"
/**
 * The printer is currently printing a document.
 * On Windows, this represents `PRINTER_STATUS_PRINTING`.
 * On macOS and Linux, this represents CUPS status 4.
 */
 | "Printing"
/**
 * The printer has stopped.
 * On Windows this represents `PRINTER_STATUS_PAUSED`.
 * On macOS and Linux, this represents CUPS status 5.
 */
 | "Stopped";
/**
 * Configuration for a print job.
 *
 * @public
 */
export declare type PrintJob = {
    /**
     * When `true`, this job will bypass the standard print dialog and send the
     * job to the operating system immediately.
     *
     */
    silent?: boolean;
    /**
     * When `true`, the background colour and image of the current page will be
     * included in the print.
     *
     */
    printBackground?: boolean;
    /**
     * Name of the designated printer for this job.
     * This can be obtained by using {@link availablePrinters}.
     */
    deviceName: string;
};
/**
 * A single printer.
 *
 * @public
 */
export declare type Printer = {
    /**
     * Canonical name of this printer
     * This is used in {@link print} to specify which printer to send
     * a job to.
     */
    name: string;
    /**
     * Human-readable description of this printer.
     */
    description: string;
    /**
     * The current status of this printer.
     */
    status: PrinterStatus;
    /**
     * Whether this printer is the system's default destination for print jobs.
     */
    isDefault: boolean;
    /**
     * Additional options to pass to the printer.
     */
    options: {
        [key: string]: unknown;
    };
};
/**
 * Get a list of all available printers on the user's system.
 * @example
 * ```typescript
 * import { printing } from "@todesktop/client";
 *
 * async function logPrinters() {
 *   const printers = await printing.availablePrinters();
 * }
 * ```
 * @public
 */
export declare function availablePrinters(): Promise<Printer[]>;
/**
 * Adds a print job for the current page to the operating system's queue for
 * immediate printing.
 *
 * @param options - Options to use when processing this print job.
 * @public
 */
export declare function print(options: PrintJob): Promise<PrintJob>;
/**
 * Determine if the history stack has items before the currently loaded URL.
 * @public
 */
export declare function canGoBack(): Promise<boolean>;
/**
 * Determine if the history stack has items ahead of the currently loaded URL.
 * @public
 */
export declare function canGoForward(): Promise<boolean>;
/**
 * @see {@link Electron.WebContents.getZoomLevel}
 * @returns The current zoom level
 * @public
 */
export declare function getZoomLevel(): Promise<number>;
/**
 * @see {@link Electron.WebContents.setZoomLevel}
 * @param level - The zoom level to set the current `WebContents` to.
 * @public
 */
export declare function setZoomLevel(level: number): Promise<void>;
/**
 * @see {@link Electron.WebContents.getZoomFactor}
 * @returns The current zoom factor
 * @public
 */
export declare function getZoomFactor(): Promise<number>;
/**
 * @see {@link Electron.WebContents.setZoomFactor}
 * @param level - The zoom factor to set the current `WebContents` to.
 * @public
 */
export declare function setZoomFactor(factor: number): Promise<void>;
declare type WindowOpenerOptions = ReturnType<Parameters<WebContents["setWindowOpenHandler"]>[0]> | {
    action: "openInBrowser";
};
/**
 * @param options - An object containing the following properties:
 *    ref: Reference for the WebContents
 *    rules: An array of rules to use when opening new windows. Each rule is an object with the following properties:
 *      regex: A regular expression string to match against the URL being opened.
 *      options: An object of options to use when creating the window.
 *    fallback: A fallback rule to use when no other rules match. This is optional.
 */
export declare function setWindowOpenRules({ ref, rules, fallback, }: {
    ref: Ref;
    rules: {
        regex: string;
        options: WindowOpenerOptions;
    }[];
    fallback?: WindowOpenerOptions;
}): any;
/**
 * Toggles whether developer tools are displayed in the current WebContents.
 *
 * @see {@link Electron.WebContents.toggleDevTools}
 * @public
 */
export declare function toggleDevTools(): Promise<void>;
/**
 * Explicitly open a specified URL within the desktop app.
 * This bypasses the check and always opens URL in-app and never in the system browser.
 *
 * @param url - URL to open. Example: 'https://www.google.com'
 * @public
 */
export declare function openUrlInApp(url: string): Promise<void>;
export declare type WebContentsEvents = NamespaceEvents<{
    "before-input-event": (input: Input) => void;
    "certificate-error": (url: string, error: string, certificate: Certificate, callback: (isTrusted: boolean) => void, isMainFrame: boolean) => void;
    "select-client-certificate": (url: string, certificateList: Certificate[], callback: (certificate: Certificate) => void) => void;
    "select-bluetooth-device": (devices: BluetoothDevice[], callback: (deviceId: string) => void) => void;
    "console-message": () => void;
    "ipc-message": () => void;
    "ipc-message-sync": (channel: string, ...args: any[]) => void;
    "did-finish-load": () => void;
    "did-fail-load": () => void;
    "did-fail-provisional-load": (errorCode: number, errorDescription: string, validatedURL: string, isMainFrame: boolean, frameProcessId: number, frameRoutingId: number) => void;
    "did-frame-finish-load": (isMainFrame: boolean, frameProcessId: number, frameRoutingId: number) => void;
    "did-start-loading": () => void;
    "did-stop-loading": () => void;
    "dom-ready": () => void;
    "page-title-updated": (title: string, explicitSet: boolean) => void;
    "page-favicon-updated": () => void;
    "did-create-window": (details: DidCreateWindowDetails) => void;
    "will-navigate": () => void;
    "did-start-navigation": () => void;
    "will-redirect": () => void;
    "did-redirect-navigation": (useCapture?: boolean) => void;
    "did-navigate": (url: string, httpResponseCode: number, httpStatusText: string) => void;
    navigate: (url: string, httpResponseCode: number, httpStatusText: string) => void;
    "did-frame-navigate": (url: string, httpResponseCode: number, httpStatusText: string, isMainFrame: boolean, frameProcessId: number, frameRoutingId: number) => void;
    "did-navigate-in-page": (url: string, isMainFrame: boolean, frameProcessId: number, frameRoutingId: number) => void;
    "will-prevent-unload": () => void;
    crashed: (useCapture?: boolean) => void;
    "render-process-gone": (useCapture?: boolean) => void;
    unresponsive: () => void;
    responsive: () => void;
    "plugin-crashed": (name: string, version: string) => void;
    destroyed: () => void;
    "enter-html-full-screen": () => void;
    "leave-html-full-screen": () => void;
    "zoom-changed": (zoomDirection: "in" | "out") => void;
    "devtools-opened": () => void;
    "devtools-closed": () => void;
    "devtools-focused": () => void;
    login: (authenticationResponseDetails: AuthenticationResponseDetails, authInfo: AuthInfo, callback: (username?: string, password?: string) => void) => void;
    "found-in-page": () => void;
    "media-started-playing": () => void;
    "media-paused": () => void;
    "did-change-theme-color": (useCapture?: boolean) => void;
    "update-target-url": () => void;
    "cursor-changed": (type: string, image: Ref, scale: number, size: Size, hotspot: Point) => void;
    "context-menu": (useCapture?: boolean) => void;
    paint: (dirtyRect: Rectangle, image: Ref) => void;
    "devtools-reload-page": () => void;
    "will-attach-webview": (webPreferences: WebPreferences, params: Record<string, string>) => void;
    "did-attach-webview": (webContents: Ref) => void;
    "preferred-size-changed": (preferredSize: Size) => void;
}>;
/**
 * @public
 */
export declare const on: <E extends "login" | "render-process-gone" | "enter-html-full-screen" | "leave-html-full-screen" | "page-title-updated" | "responsive" | "unresponsive" | "navigate" | "did-navigate" | "before-input-event" | "certificate-error" | "select-client-certificate" | "select-bluetooth-device" | "console-message" | "ipc-message" | "ipc-message-sync" | "did-finish-load" | "did-fail-load" | "did-fail-provisional-load" | "did-frame-finish-load" | "did-start-loading" | "did-stop-loading" | "dom-ready" | "page-favicon-updated" | "did-create-window" | "will-navigate" | "did-start-navigation" | "will-redirect" | "did-redirect-navigation" | "did-frame-navigate" | "did-navigate-in-page" | "will-prevent-unload" | "crashed" | "plugin-crashed" | "destroyed" | "zoom-changed" | "devtools-opened" | "devtools-closed" | "devtools-focused" | "found-in-page" | "media-started-playing" | "media-paused" | "did-change-theme-color" | "update-target-url" | "cursor-changed" | "context-menu" | "paint" | "devtools-reload-page" | "will-attach-webview" | "did-attach-webview" | "preferred-size-changed">(eventName: E, callback: NamespaceEvents<{
    "before-input-event": (input: Input) => void;
    "certificate-error": (url: string, error: string, certificate: Certificate, callback: (isTrusted: boolean) => void, isMainFrame: boolean) => void;
    "select-client-certificate": (url: string, certificateList: Certificate[], callback: (certificate: Certificate) => void) => void;
    "select-bluetooth-device": (devices: BluetoothDevice[], callback: (deviceId: string) => void) => void;
    "console-message": () => void;
    "ipc-message": () => void;
    "ipc-message-sync": (channel: string, ...args: any[]) => void;
    "did-finish-load": () => void;
    "did-fail-load": () => void;
    "did-fail-provisional-load": (errorCode: number, errorDescription: string, validatedURL: string, isMainFrame: boolean, frameProcessId: number, frameRoutingId: number) => void;
    "did-frame-finish-load": (isMainFrame: boolean, frameProcessId: number, frameRoutingId: number) => void;
    "did-start-loading": () => void;
    "did-stop-loading": () => void;
    "dom-ready": () => void;
    "page-title-updated": (title: string, explicitSet: boolean) => void;
    "page-favicon-updated": () => void;
    "did-create-window": (details: DidCreateWindowDetails) => void;
    "will-navigate": () => void;
    "did-start-navigation": () => void;
    "will-redirect": () => void;
    "did-redirect-navigation": (useCapture?: boolean) => void;
    "did-navigate": (url: string, httpResponseCode: number, httpStatusText: string) => void;
    navigate: (url: string, httpResponseCode: number, httpStatusText: string) => void;
    "did-frame-navigate": (url: string, httpResponseCode: number, httpStatusText: string, isMainFrame: boolean, frameProcessId: number, frameRoutingId: number) => void;
    "did-navigate-in-page": (url: string, isMainFrame: boolean, frameProcessId: number, frameRoutingId: number) => void;
    "will-prevent-unload": () => void;
    crashed: (useCapture?: boolean) => void;
    "render-process-gone": (useCapture?: boolean) => void;
    unresponsive: () => void;
    responsive: () => void;
    "plugin-crashed": (name: string, version: string) => void;
    destroyed: () => void;
    "enter-html-full-screen": () => void;
    "leave-html-full-screen": () => void;
    "zoom-changed": (zoomDirection: "in" | "out") => void;
    "devtools-opened": () => void;
    "devtools-closed": () => void;
    "devtools-focused": () => void;
    login: (authenticationResponseDetails: AuthenticationResponseDetails, authInfo: AuthInfo, callback: (username?: string, password?: string) => void) => void;
    "found-in-page": () => void;
    "media-started-playing": () => void;
    "media-paused": () => void;
    "did-change-theme-color": (useCapture?: boolean) => void;
    "update-target-url": () => void;
    "cursor-changed": (type: string, image: Ref, scale: number, size: Size, hotspot: Point) => void;
    "context-menu": (useCapture?: boolean) => void;
    paint: (dirtyRect: Rectangle, image: Ref) => void;
    "devtools-reload-page": () => void;
    "will-attach-webview": (webPreferences: WebPreferences, params: Record<string, string>) => void;
    "did-attach-webview": (webContents: Ref) => void;
    "preferred-size-changed": (preferredSize: Size) => void;
}>[E], args_0?: {
    ref?: import("@todesktop/client-util").InstanceRefObject;
    preventDefault?: boolean;
}) => Promise<() => Promise<void>>;
/**
 * @public
 */
export declare const removeAllListeners: <E extends "login" | "render-process-gone" | "enter-html-full-screen" | "leave-html-full-screen" | "page-title-updated" | "responsive" | "unresponsive" | "navigate" | "did-navigate" | "before-input-event" | "certificate-error" | "select-client-certificate" | "select-bluetooth-device" | "console-message" | "ipc-message" | "ipc-message-sync" | "did-finish-load" | "did-fail-load" | "did-fail-provisional-load" | "did-frame-finish-load" | "did-start-loading" | "did-stop-loading" | "dom-ready" | "page-favicon-updated" | "did-create-window" | "will-navigate" | "did-start-navigation" | "will-redirect" | "did-redirect-navigation" | "did-frame-navigate" | "did-navigate-in-page" | "will-prevent-unload" | "crashed" | "plugin-crashed" | "destroyed" | "zoom-changed" | "devtools-opened" | "devtools-closed" | "devtools-focused" | "found-in-page" | "media-started-playing" | "media-paused" | "did-change-theme-color" | "update-target-url" | "cursor-changed" | "context-menu" | "paint" | "devtools-reload-page" | "will-attach-webview" | "did-attach-webview" | "preferred-size-changed">(eventName: E, args_0?: {
    ref?: import("@todesktop/client-util").InstanceRefObject;
}) => Promise<void>;
export {};
