/// <reference types="node" />
import { EventEmitter } from "events";
import { ConsoleManager, KeyListenerArgs } from "../../ConsoleGui.js";
import PageBuilder from "../PageBuilder.js";
import { PhisicalValues } from "../Utils.js";
/**
 * @description The configuration for the CustomPopup class.
 * @typedef {Object} PopupConfig
 *
 * @prop {string} id - The id of the popup.
 * @prop {string} title - The title of the popup.
 * @prop {PageBuilder} content - The content of the popup.
 * @prop {number} width - The width of the popup.
 * @prop {boolean} [visible] - If the popup is visible.
 *
 * @export
 * @interface PopupConfig
 */
export interface PopupConfig {
    id: string;
    title: string;
    content: PageBuilder;
    width: number;
    visible?: boolean;
}
/**
 * @class CustomPopup
 * @extends EventEmitter
 * @description This class is used to create a popup with a free content built with PageBuilder class.
 *
 * ![Animation](https://user-images.githubusercontent.com/14907987/165736767-d60f857f-3945-4b95-aa4f-292b6a41f789.gif)
 *
 * Emits the following events:
 * - "confirm" when the user confirm
 * - "cancel" when the user cancel
 * - "exit" when the user exit
 * - "data" when the user send custom event - the data is an object with the data and the event name
 * @param {PopupConfig} config - The configuration of the popup.
 *
 * @example ```ts
 * const popup = new CustomPopup({
 *  id: "popup1",
 *  title: "See that values",
 *  content: new PageBuilder().addText("Hello world!"),
 * }).show()
 */
export declare class CustomPopup extends EventEmitter {
    readonly CM: ConsoleManager;
    readonly id: string;
    title: string;
    content: PageBuilder;
    width: number;
    private visible;
    private marginTop;
    parsingMouseFrame: boolean;
    /** @var {number} x - The x offset of the popup to be drown. If 0 it will be placed on the center */
    private offsetX;
    /** @var {number} y - The y offset of the popup to be drown. If 0 it will be placed on the center */
    private offsetY;
    private absoluteValues;
    private dragging;
    private dragStart;
    focused: boolean;
    constructor(config: PopupConfig);
    /**
     * @description This function is used to make the ConsoleManager handle the key events when the input is text and it is showed.
     * Inside this function are defined all the keys that can be pressed and the actions to do when they are pressed.
     * @param {string} str - The string of the input.
     * @param {Object} key - The key object.
     * @memberof CustomPopup
     */
    keyListener(_str: string, key: KeyListenerArgs): void;
    /**
     * @description This function is used to get the content of the popup.
     * @returns {PageBuilder} The content of the popup.
     * @memberof CustomPopup
     */
    getContent(): PageBuilder;
    /**
     * @description This function is used to change the content of the popup. It also refresh the ConsoleManager.
     * @param {PageBuilder} newContent - The new content of the popup.
     * @memberof CustomPopup
     * @returns {CustomPopup} The instance of the CustomPopup.
     */
    setContent(newContent: PageBuilder): CustomPopup;
    /**
     * @description This function is used to change the popup width. It also refresh the ConsoleManager.
     * @param {number} newWidth - The new width of the popup.
     * @memberof CustomPopup
     * @returns {CustomPopup} The instance of the CustomPopup.
     */
    setWidth(newWidth: number): this;
    /**
     * @description This function is used to show the popup. It also register the key events and refresh the ConsoleManager.
     * @returns {CustomPopup} The instance of the CustomPopup.
     * @memberof CustomPopup
     */
    show(): this;
    /**
     * @description This function is used to hide the popup. It also unregister the key events and refresh the ConsoleManager.
     * @returns {CustomPopup} The instance of the CustomPopup.
     * @memberof CustomPopup
     */
    hide(): this;
    /**
     * @description This function is used to get the visibility of the popup.
     * @returns {boolean} The visibility of the popup.
     * @memberof CustomPopup
     */
    isVisible(): boolean;
    /**
     * @description This function is used to return the PhisicalValues of the popup (x, y, width, height).
     * @memberof CustomPopup
     * @private
     * @returns {CustomPopup} The instance of the CustomPopup.
     * @memberof CustomPopup
     */
    getPosition(): PhisicalValues;
    /**
     * @description This function is used to add the CustomPopup key listener callback to te ConsoleManager.
     * @returns {CustomPopup} The instance of the CustomPopup.
     * @memberof CustomPopup
     */
    private manageInput;
    /**
     * @description This function is used to remove the CustomPopup key listener callback to te ConsoleManager.
     * @returns {CustomPopup} The instance of the CustomPopup.
     * @memberof CustomPopup
     */
    private unManageInput;
    /**
     * @description This function is used to draw a single line of the layout to the screen. It also trim the line if it is too long.
     * @param {Array<object>} line the line to be drawn
     * @memberof CustomPopup
     * @returns {void}
     */
    private drawLine;
    /**
     * @description This function is used to manage the mouse events on the OptionPopup.
     * @param {MouseEvent} event - The string of the input.
     * @memberof OptionPopup
     */
    private mouseListener;
    /**
     * @description This function is used to draw the CustomPopup to the screen in the middle.
     * @returns {CustomPopup} The instance of the CustomPopup.
     * @memberof CustomPopup
     */
    draw(): CustomPopup;
}
export default CustomPopup;
//# sourceMappingURL=CustomPopup.d.ts.map