/// <reference path="../vendor/i18next.d.ts" />
//@ts-ignore
import { i18n } from "i18next";
import { DsPdfViewer } from "../DsPdfViewer";
import { ISupportApi } from "../SupportApi/ISupportApi";
import { TableDataExportFormat, TableDefClientModel } from "../SupportApi/types";
import { TableDataExtractionSettings } from "../ViewerOptions";
import { ExtractedTableEditor } from "./ExtractedTableEditor";
import { ClientTableExtractOptions, TableDataExtractionDialogMode } from "./types";
/**
 * Manages the extraction of table data from a PDF document.
 * Provides methods to extract, reset, reload, and export table data.
 * Allows subscribing to state changes.
 */
export declare class TableDataExtractor {
    viewer: DsPdfViewer;
    private _extractedTableEditor;
    private _keydownHandler?;
    private _prevExtractCallArgs?;
    private _unregOnBeforeOpen?;
    private _unregOnAfterOpen?;
    private _state;
    private _subscribers;
    private static _tableExtractOptionsDescription;
    constructor(viewer: DsPdfViewer);
    /**
     * Gets the extracted table editor instance.
     */
    get extractedTableEditor(): ExtractedTableEditor;
    /**
     * Gets the localization helper.
     */
    get in17n(): i18n;
    /**
     * Checks if extraction parameters exist.
     */
    get hasExtractDataParams(): boolean;
    /**
     * Gets or sets the extraction dialog mode.
     */
    get mode(): TableDataExtractionDialogMode;
    set mode(val: TableDataExtractionDialogMode);
    /**
     * Gets the support API instance.
     */
    get supportApi(): ISupportApi;
    /**
     * Retrieves the extraction options, ensuring default values are applied.
     * @returns {ClientTableExtractOptions} The extraction options with all properties initialized.
     */
    get extractOptions(): ClientTableExtractOptions;
    /**
     * Gets the default extraction options based on settings and predefined defaults.
     * @returns {ClientTableExtractOptions} An object containing the default table extraction options.
     */
    get defaultExtractOptions(): ClientTableExtractOptions;
    /**
     * Gets the table extraction settings from viewer options
     * @returns {TableDataExtractionSettings} The table extraction settings object
     */
    get tableExtractSettings(): TableDataExtractionSettings;
    /**
     * Checks if the extraction result is empty
     * @returns {boolean} True if the extraction result is empty, false otherwise
     */
    get isEmptyResult(): any;
    /**
     * Gets the description and metadata for all available table extraction options
     * @param {i18n} in17n - The internationalization object for localization
     * @returns {Object} Dictionary of extraction option descriptors with their metadata:
     *                  - label: Display label
     *                  - title: Tooltip text
     *                  - defaultValue: Default value for the option
     *                  - step: Increment step for number inputs (optional)
     *                  - min: Minimum value for number inputs (optional)
     *                  - max: Maximum value for number inputs (optional)
     *                  - type: Input type ("checkbox" or "number")
     */
    static getTableExtractOptionsDescription(in17n: i18n): {
        [optionName: string]: {
            label: string;
            title: string;
            defaultValue: any;
            step?: number;
            min?: number;
            max?: number;
            type: "checkbox" | "number";
        };
    };
    /**
     * Subscribes to state changes with a unique key.
     * @param {string} key - Unique key for the subscriber.
     * @param {(state: Record<string, any>) => void} callback - Callback function triggered when the state changes.
     */
    subscribe(key: string, callback: (state: Record<string, any>) => void): void;
    /**
     * Unsubscribes from state changes using the unique key.
     * @param {string} key - Unique key of the subscriber to remove.
     */
    unsubscribe(key: string): void;
    /**
     * Updates the component state and notifies subscribers of the change.
     *
     * @param newState - An object containing the new state properties to be merged with the existing state.
     *
     * The updated state is stored internally and triggers the `raiseStateChanged` method
     * to notify all registered subscribers about the state update.
     */
    setState(newState: Record<string, any>): void;
    /**
     * Notifies all subscribers about a state change.
     *
     * This method iterates through the list of registered subscriber callbacks
     * and invokes each one with the updated state.
     */
    raiseStateChanged(): void;
    /**
     * Activates the table data extractor by binding necessary events.
     */
    activate(): void;
    /**
     * Binds necessary events for handling keyboard shortcuts and PDF interactions.
     */
    bindEvents(): void;
    /**
     * Unbinds events when deactivating the extractor.
     */
    unbindEvents(): void;
    /**
     * Cancels the extraction process.
     * @param keepPrevExtractParams - Whether to retain previous extraction parameters.
     */
    cancel(keepPrevExtractParams?: boolean): void;
    /**
     * Disposes the extractor by unbinding events.
     */
    dispose(): void;
    /**
     * Activates the region selection mode for extracting table data.
     * Disables the extracted table editor, resets the extracted table data,
     * and sets the mode to "SelectRegion". Once the user selects a region,
     * the selection mode is deactivated, the mode switches to "Processing",
     * and the table data extraction begins.
     *
     * @returns {Promise<void>} Resolves when the process is initiated.
     */
    selectRegionToExtractTableData(): Promise<void>;
    cancelPageRegionSelection(): Promise<void>;
    /**
     * Extracts table data from a specified page.
     *
     * @param {number} pageIndex - The index of the page to extract table data from.
     * @param {number[]} bounds - The rectangular bounds defining the table region in PDF coordinates.
     * @param {TableDefClientModel} [tableDef] - Optional predefined table structure.
     * @param {Object} [args] - Additional extraction options.
     * @param {boolean} [args.skipUndo] - If true, skips adding this action to the undo history.
     * @param {ClientTableExtractOptions} [args.extractOptions] - Options to configure the table extraction process.
     * @param {boolean} [args.silentMode] - If true, suppresses the table editor UI and only returns the extracted data.
     * @returns {Promise<Object>} Extracted table data containing rows, columns, and cells.
     */
    extractTableData(pageIndex: number, bounds: number[], tableDef?: TableDefClientModel, args?: {
        skipUndo?: boolean;
        extractOptions?: ClientTableExtractOptions;
        silentMode?: boolean;
    }): Promise<TableDefClientModel[]>;
    /**
     * Resets extracted table data.
     */
    resetExtractedTable(): Promise<any>;
    reloadTableData(): Promise<void>;
    showSelectedRegion(pageIndex: number, selectionBounds: number[]): void;
    selectExctractedTable(tableData: TableDefClientModel, pageIndex: number, selectionBounds: number[]): void;
    deactivate(): void;
    reset(): void;
    /**
  * Exports the extracted table data to the specified format and triggers a download of the file.
  * This method handles the process of exporting the table data in various formats such as CSV, JSON, XLSX, XML, or HTML.
  * It ensures the proper error handling and updates the UI state (such as disabling buttons or showing a loading indicator).
  *
  * @param exportFormat - The format to which the table data should be exported. This can be one of the following:
  *   - `"tsv"`: Exports the data as a CSV file.
  *   - `"csv"`: Exports the data as a CSV file.
  *   - `"json"`: Exports the data as a JSON file.
  *   - `"xlsx"`: Exports the data as an XLSX (Excel) file.
  *   - `"xml"`: Exports the data as an XML file.
  *   - `"html"`: Exports the data as an HTML file.
  *
  * @throws {Error} Throws an error if the export process encounters any issues.
  */
    exportToFormatAndDownload(exportFormat: TableDataExportFormat): Promise<void>;
    get tablesData(): TableDefClientModel[];
    get selectionBounds(): any;
    exportToFormatAndCopyToClipboard(exportFormat: TableDataExportFormat): Promise<void>;
}
