import { EventEmitter2 } from "@inweb/eventemitter2";
import { Assembly, Client, File, Model } from "@inweb/client";
import { CanvasEventMap, Dragger, IComponent, IDragger, IOptions, IViewer, IViewpoint, Options, OptionsEventMap, ViewerEventMap } from "@inweb/viewer-core";
import { IMarkup, IWorldTransform } from "@inweb/markup";
import { MarkupType } from "./Markup/MarkupFactory";
/**
 * 3D viewer powered by {@link https://cloud.opendesign.com/docs/index.html#/visualizejs | VisualizeJS}
 * library.
 */
export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMap & OptionsEventMap> implements IViewer, IWorldTransform {
    private _activeDragger;
    private _components;
    private _enableAutoUpdate;
    private _isNeedRender;
    private _isRunAsyncUpdate;
    private _renderTime;
    protected _options: Options;
    protected _visualizeJsUrl: string;
    protected _visualizeJs: any;
    protected _visualizeTimestamp: number;
    protected _crossOrigin: any;
    private canvaseventlistener;
    canvasEvents: string[];
    private _markup;
    canvas: HTMLCanvasElement | undefined;
    _abortController: AbortController | undefined;
    _abortControllerForRequestMap: Map<string, AbortController> | undefined;
    _abortControllerForReferences: AbortController | undefined;
    client: Client | undefined;
    /**
     * @param client - The `Client` instance that is used to load model reference files from the Open Cloud
     *   Server. Do not specify `Client` if you need a standalone viewer instance to view `VSFX` files from
     *   the web or from local computer.
     * @param params - An object containing viewer configuration parameters.
     * @param params.visualizeJsUrl - `VisualizeJS` library URL. Set this URL to use your own library
     *   instance, or specify `undefined` or blank to use the default URL defined by `Viewer.visualize`
     *   library you are using.
     * @param params.crossOrigin - The
     *   {@link https://developer.mozilla.org/docs/Web/HTML/Attributes/crossorigin | crossorigin} content
     *   attribute on `Visalize.js` script element. One of the following values: `""`, `anonymous` or
     *   `use-credentials`.
     * @param params.enableAutoUpdate - Enable auto-update of the viewer after any changes. If the
     *   auto-update is disabled, you need to register an `update` event handler and update the
     *   `VisualizeJS` viewer and active dragger manually. Default is `true`.
     * @param params.markupType - The type of the markup core: `Visualize` (deprecated) or `Konva`. Default
     *   is `Konva`.
     */
    constructor(client?: Client, params?: {
        visualizeJsUrl?: string;
        crossOrigin?: string;
        enableAutoUpdate?: boolean;
        markupType?: MarkupType;
    });
    /**
     * Viewer options.
     */
    get options(): IOptions;
    /**
     * `VisualizeJS` library URL. Use {@link configure | configure()} to change library URL.
     *
     * @readonly
     */
    get visualizeJsUrl(): string;
    /**
     * 2D markup core instance used to create markups.
     *
     * @readonly
     */
    get markup(): IMarkup;
    /**
     * Changes the viewer parameters.
     *
     * @param params - An object containing new parameters.
     * @param params.visualizeJsUrl - `VisualizeJS` library URL. Set this URL to use your own library
     *   instance or specify `undefined` or blank to use the default URL defined by `Viewer.visualize`
     *   library you are using.
     * @param params.crossOrigin - The
     *   {@link https://developer.mozilla.org/docs/Web/HTML/Attributes/crossorigin | crossorigin} content
     *   attribute on `Visalize.js` script element. One of the following values: `""`, `anonymous` or
     *   `use-credentials`.
     */
    configure(params: {
        visualizeJsUrl?: string;
        crossOrigin?: string;
    }): this;
    /**
     * Loads the `VisualizeJS` module and initializes it with the specified canvas. Call
     * {@link dispose | dispose()} to release allocated resources.
     *
     * Fires:
     *
     * - {@link InitializeEvent | initialize}
     * - {@link InitializeProgressEvent | initializeprogress}
     *
     * @param canvas -
     *   {@link https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement | HTMLCanvasElement} for
     *   `VisualizeJS`.
     * @param onProgress - A callback function that handles events measuring progress of loading of the
     *   `VisualizeJS` library.
     */
    initialize(canvas: HTMLCanvasElement, onProgress?: (event: ProgressEvent) => void): Promise<this>;
    dispose(): this;
    /**
     * Returns `true` if `VisualizeJS` module has been loaded and initialized.
     */
    isInitialized(): boolean;
    render(time: DOMHighResTimeStamp): void;
    resize(): this;
    /**
     * Updates the viewer.
     *
     * Do nothing if the auto-update mode is disabled in the constructor. In this case, register an
     * `update` event handler and update the `Visualize` viewer and active dragger manually.
     *
     * Fires:
     *
     * - {@link UpdateEvent | update}
     *
     * @param force - If `true` updates the viewer immidietly. Otherwise updates on next animation frame.
     *   Default is `false`.
     */
    update(force?: boolean): void;
    private scheduleUpdateAsync;
    /**
     * Updates the viewer asynchronously without locking the user interface. Used to update the viewer
     * after changes that require a long rendering time.
     *
     * Do nothing if the auto-update mode is disabled in the constructor. In this case, register an
     * `update` event handler and update the `VisualizeJS` viewer and active dragger manually.
     *
     * Fires:
     *
     * - {@link UpdateEvent | update}
     *
     * @param maxScheduleUpdateTimeInMs - Maximum time for one update, default 30 ms.
     * @param maxScheduleUpdateCount - Maximum count of scheduled updates.
     */
    updateAsync(maxScheduleUpdateTimeInMs?: number, maxScheduleUpdateCount?: number): Promise<void>;
    /**
     * Returns `VisualizeJS` {@link https://cloud.opendesign.com/docs/index.html#/visualizejs_api | module}
     * instance.
     */
    get visualizeJs(): any;
    /**
     * Returns `VisualizeJS` {@link https://cloud.opendesign.com/docs/index.html#/visualizejs_api | module}
     * instance.
     */
    visLib(): any;
    /**
     * Returns `VisualizeJS` {@link https://cloud.opendesign.com/docs/index.html#/vis/Viewer | Viewer}
     * instance.
     */
    visViewer(): any;
    syncOpenCloudVisualStyle(isInitializing: boolean): this;
    syncOptions(options?: IOptions): this;
    syncHighlightingOptions(options?: IOptions): this;
    get draggers(): string[];
    get components(): string[];
    /**
     * Deprecated since `25.12`. Use {@link draggers.registerDragger} instead.
     */
    registerDragger(name: string, dragger: typeof Dragger): void;
    activeDragger(): IDragger | null;
    setActiveDragger(name?: string): IDragger | null;
    resetActiveDragger(): void;
    getComponent(name: string): IComponent;
    clearSlices(): void;
    clearOverlay(): void;
    syncOverlay(): void;
    is3D(): boolean;
    screenToWorld(position: {
        x: number;
        y: number;
    }): {
        x: number;
        y: number;
        z: number;
    };
    worldToScreen(position: {
        x: number;
        y: number;
        z: number;
    }): {
        x: number;
        y: number;
    };
    getScale(): {
        x: number;
        y: number;
        z: number;
    };
    getSelected(): string[];
    setSelected(handles?: string[]): void;
    clearSelected(): void;
    hideSelected(): void;
    isolateSelected(): void;
    showAll(): void;
    explode(index?: number): void;
    collect(): void;
    loadReferences(model: Model | File | Assembly): Promise<this>;
    applyModelTransformMatrix(model: Model | Assembly): void;
    applySceneGraphSettings(options?: IOptions): void;
    /**
     * Loads a file from Open Cloud Server into the viewer.
     *
     * The file geometry data on the server must be converted to `VSFX` format.
     *
     * To open a large file, enable {@link IOptions.enablePartialMode | partial streaming} mode before
     * opening (see example below).
     *
     * This method requires a `Client` instance to be specified when creating the viewer to load model
     * reference files from the Open Cloud Server. For a standalone viewer instance use
     * {@link openVsfFile | openVsfFile()} or {@link openVsfxFile | openVsfxFile()}.
     *
     * If there was an active dragger before opening the file, it will be deactivated. After opening the
     * file, you must manually activate the required dragger.
     *
     * Fires:
     *
     * - {@link OpenEvent | open}
     * - {@link GeometryStartEvent | geometrystart}
     * - {@link GeometryProgressEvent | geometryprogress}
     * - {@link DatabaseChunkEvent | databasechunk}
     * - {@link GeometryChunkEvent | geometrychunk}
     * - {@link GeometryEndEvent | geometryend}
     * - {@link GeometryErrorEvent | geometryerror}
     *
     * @example Using partial streaming mode to open a large file from a server.
     *
     * ```javascript
     * viewer.options.enableStreamingMode = true;
     * viewer.options.enablePartialMode = true;
     * await viewer.open(file);
     * ```
     *
     * @param file - File, assembly or specific model to load. If a `File` instance with multiple models is
     *   specified, the default model will be loaded. If there is no default model, first availiable model
     *   will be loaded.
     */
    open(file: File | Assembly | Model): Promise<this>;
    /**
     * Loads a `VSF` file into the viewer.
     *
     * This method does not support {@link IOptions.enableStreamingMode | streaming} or
     * {@link IOptions.enablePartialMode | partial streaming} mode.
     *
     * If there was an active dragger before opening the file, it will be deactivated. After opening the
     * file, you must manually activate the required dragger.
     *
     * Fires:
     *
     * - {@link OpenEvent | open}
     * - {@link GeometryStartEvent | geometrystart}
     * - {@link GeometryProgressEvent | geometryprogress}
     * - {@link DatabaseChunkEvent | databasechunk}
     * - {@link GeometryEndEvent | geometryend}
     * - {@link GeometryErrorEvent | geometryerror}
     *
     * @param buffer - Binary data buffer to load.
     */
    openVsfFile(buffer: Uint8Array | ArrayBuffer): this;
    /**
     * Loads a `VSFX` file into the viewer.
     *
     * This method does not support {@link IOptions.enableStreamingMode | streaming} or
     * {@link IOptions.enablePartialMode | partial streaming} mode.
     *
     * If there was an active dragger before opening the file, it will be deactivated. After opening the
     * file, you must manually activate the required dragger.
     *
     * Fires:
     *
     * - {@link OpenEvent | open}
     * - {@link GeometryStartEvent | geometrystart}
     * - {@link GeometryProgressEvent | geometryprogress}
     * - {@link DatabaseChunkEvent | databasechunk}
     * - {@link GeometryEndEvent | geometryend}
     * - {@link GeometryErrorEvent | geometryerror}
     *
     * @param buffer - Binary data buffer to load.
     */
    openVsfxFile(buffer: Uint8Array | ArrayBuffer): this;
    cancel(): this;
    clear(): this;
    /**
     * Deprecated since `25.11`. Use {@link IMarkup.getMarkupColor | markup.getMarkupColor()} instead.
     */
    getMarkupColor(): {
        r: number;
        g: number;
        b: number;
    };
    /**
     * Deprecated since `25.11`. Use {@link IMarkup.setMarkupColor | markup.setMarkupColor()} instead.
     */
    setMarkupColor(r?: number, g?: number, b?: number): void;
    /**
     * Deprecated since `25.11`. Use {@link IMarkup.colorizeAllMarkup | markup.colorizeAllMarkup()} instead.
     */
    colorizeAllMarkup(r?: number, g?: number, b?: number): void;
    /**
     * Deprecated since `25.11`. Use
     * {@link IMarkup.colorizeSelectedMarkups | markup.colorizeSelectedMarkups()} instead.
     */
    colorizeSelectedMarkups(r?: number, g?: number, b?: number): void;
    /**
     * Adds an empty `Visualize` markup entity to the overlay.
     */
    addMarkupEntity(entityName: string): any;
    drawViewpoint(viewpoint: IViewpoint): void;
    createViewpoint(): IViewpoint;
    private getPoint3dFromArray;
    private getLogicalPoint3dAsArray;
    private getOrthogonalCameraSettings;
    private setOrthogonalCameraSettings;
    private getClippingPlanes;
    private setClippingPlanes;
    private getSelection;
    private setSelection;
    /**
     * Executes the command denoted by the given command. If the command is not found, tries to set active
     * dragger with the specified name.
     *
     * The following commands are available by default:
     *
     * - `applyModelTransform`
     * - `autoTransformAllModelsToCentralPoint`
     * - `clearMarkup`
     * - `clearSelected`
     * - `clearSlices`
     * - `createPreview`
     * - `explode`
     * - `getDefaultViewPositions`
     * - `getModels`
     * - `getSelected`
     * - `hideSelected`
     * - `isolateSelected`
     * - `regenerateAll`
     * - `resetView`
     * - `selectModel`
     * - `setActiveDragger`
     * - `setDefaultViewPosition`
     * - `setMarkupColor`
     * - `setSelected`
     * - `showAll`
     * - `zoomToExtents`
     * - `zoomToObjects`
     * - `zoomToSelected`
     *
     * To register custom command use the {@link commands.registerCommand}.
     *
     * @param id - Command ID or dragger name.
     * @param args - Parameters passed to the command handler function.
     * @returns Returns the result of the command handler function or new active dragger instance. Returns
     *   `undefined` if neither the command nor the dragger exists.
     */
    executeCommand(id: string, ...args: any[]): any;
    deviceAutoRegeneration(): void;
}
