"use strict";
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ChildWindowManager = void 0;
const InternalChildWindowManager_1 = require("./InternalChildWindowManager");
/** Supports opening a child browser window from the main application window. The child window is managed by the main application
 * and is running in the same security context. The application must deliver the html file iTwinPopup.html along side its index.html.
 * See also: [Child Window Manager]($docs/learning/ui/appui-react/ChildWindows.md)
 * @public
 * @deprecated in 3.7. Use `UiFramework.childWindows` property to access.
 * */
class ChildWindowManager {
    constructor() {
        this.internal = new InternalChildWindowManager_1.InternalChildWindowManager();
        /**
         * @deprecated in 3.7. Use `close` method.
         */
        this.closeChildWindow = (childWindowId, processWindowClose = true) => {
            return this.internal.close(childWindowId, processWindowClose);
        };
        /**
           * Close a specific child window.
           * @param childWindowId Id of the window to close
           * @param processWindowClose should the `close` method be called on the closing window. (defaults to true)
           * @returns false if the window could not be found.
           */
        this.close = (childWindowId, processWindowClose = true) => {
            return this.internal.close(childWindowId, processWindowClose);
        };
    }
    /**
     * Override internal implementation for a mock
     * @internal For tests only.
     */
    mockInternal(internal) {
        this.internal = internal;
    }
    get openChildWindows() {
        return this.internal.openChildWindows;
    }
    /**
     * @deprecated in 3.7. Use `find` method.
     */
    findChildWindow(childWindowId) {
        return this.internal.find(childWindowId);
    }
    /**
     * @deprecated in 3.7. Use `findId` method.
     */
    findChildWindowId(contentWindow) {
        return this.internal.findId(contentWindow);
    }
    /** Close all child/pop-out windows. This typically is called when the frontstage is changed.
     * @deprecated in 3.7. Use `closeAll` method.
     */
    closeAllChildWindows() {
        return this.internal.closeAll();
    }
    /**
     * @deprecated in 3.7. Use `open` method.
     */
    // istanbul ignore next
    openChildWindow(childWindowId, title, content, location, useDefaultPopoutUrl) {
        return this.internal.open(childWindowId, title, content, location, useDefaultPopoutUrl);
    }
    /**
     * Returns the OpenChildWindowInfo for the related id.
     * @param childWindowId Id of the window to retrieve.
     * @returns undefined if not found.
     */
    find(childWindowId) {
        return this.internal.find(childWindowId);
    }
    /**
       * Return the childWindowId of the provided window.
       * @param contentWindow Window element to identify
       * @returns undefined if not found
       */
    findId(contentWindow) {
        return this.internal.findId(contentWindow);
    }
    /** Close all child/pop-out windows. This typically is called when the frontstage is changed. */
    closeAll() {
        return this.internal.closeAll();
    }
    /**
       * Open a new child window.
       * @param childWindowId Id to assign to the newly created window.
       * @param title Title to display on the window.
       * @param content ReactNode to be rendered in the window.
       * @param location Position and size information
       * @param useDefaultPopoutUrl use "/iTwinPopup.html" as the window Url, "" otherwise.
       * @returns true if the window is opened successfully.
       */
    // istanbul ignore next
    open(childWindowId, title, content, location, useDefaultPopoutUrl) {
        return this.internal.open(childWindowId, title, content, location, useDefaultPopoutUrl);
    }
}
exports.ChildWindowManager = ChildWindowManager;
//# sourceMappingURL=ChildWindowManager.js.map