var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
    if (kind === "m")
        throw new TypeError("Private method is not writable");
    if (kind === "a" && !f)
        throw new TypeError("Private accessor was defined without a setter");
    if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
        throw new TypeError("Cannot write private member to an object whose class did not declare it");
    return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
    if (kind === "a" && !f)
        throw new TypeError("Private accessor was defined without a getter");
    if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
        throw new TypeError("Cannot read private member from an object whose class did not declare it");
    return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _GxIdeChatContainer_menuItems, _GxIdeChatContainer_componentLocale, _GxIdeChatContainer_showMenuHandler, _GxIdeChatContainer_menuExpandedChangeHandler, _GxIdeChatContainer_copyConversationHandler, _GxIdeChatContainer_deleteConversationHandler;
import { Host, h } from "@stencil/core";
import { getIconPath } from "@genexus/mercury";
import { Locale } from "../../../common/locale";
const CSS_BUNDLES = [
    "resets/box-sizing",
    "utils/typography",
    "chameleon/scrollbar",
    "components/button",
    "components/dropdown",
    "components/icon",
    "utils/elevation"
];
const COPY_ICON = getIconPath({
    category: "system",
    name: "copy",
    colorType: "primary"
});
const DELETE_ICON = getIconPath({
    category: "system",
    name: "delete-outlined",
    colorType: "primary"
});
const CONVERSATION_ICON = getIconPath({
    category: "objects",
    name: "conversational-flows"
});
const MORE_HORIZONTAL_ICON = getIconPath({
    category: "system",
    name: "more-horizontal",
    colorType: "interactive"
});
export class GxIdeChatContainer {
    constructor() {
        _GxIdeChatContainer_menuItems.set(this, [
            { type: "slot", id: "delete-chat-button" },
            { type: "slot", id: "copy-chat-button" }
        ]);
        /**
         * The component hard-coded strings translations.
         */
        // eslint-disable-next-line @stencil-community/own-props-must-be-private
        _GxIdeChatContainer_componentLocale.set(this, void 0);
        _GxIdeChatContainer_showMenuHandler.set(this, () => {
            this.menuIsExpanded = true;
        });
        _GxIdeChatContainer_menuExpandedChangeHandler.set(this, (event) => {
            this.menuIsExpanded = event.detail;
        });
        _GxIdeChatContainer_copyConversationHandler.set(this, () => {
            if (this.copyConversationCallback) {
                this.copyConversationCallback();
                this.menuIsExpanded = false;
            }
        });
        _GxIdeChatContainer_deleteConversationHandler.set(this, () => {
            if (this.deleteConversationCallback) {
                this.deleteConversationCallback();
                this.menuIsExpanded = false;
            }
        });
        this.displayConversationCopiedMessage = false;
        this.menuIsExpanded = false;
        this.chatTitle = undefined;
        this.copyConversationCallback = undefined;
        this.deleteConversationCallback = undefined;
        this.displayWelcomeScreen = false;
    }
    async componentWillLoad() {
        __classPrivateFieldSet(this, _GxIdeChatContainer_componentLocale, await Locale.getComponentStrings(this.el), "f");
    }
    /**
     * It will display a feedback message that the conversation has been copied
     */
    async showCopyConversationMessage() {
        this.displayConversationCopiedMessage = true;
        setTimeout(() => {
            this.displayConversationCopiedMessage = false;
        }, 2000);
    }
    render() {
        const renderHeader = this.chatTitle ||
            this.copyConversationCallback ||
            this.deleteConversationCallback;
        const renderButtonsGroup = this.copyConversationCallback || this.deleteConversationCallback;
        return (h(Host, { class: {
                "chat-container": true,
                "with-header": !!renderHeader
            } }, h("ch-theme", { model: CSS_BUNDLES }), h("section", { class: "section" }, renderHeader && (h("header", { class: "header caption-semi-bold-l" }, this.chatTitle && this.chatTitle, renderButtonsGroup && (h("ch-action-menu-render", { class: "dropdown", blockAlign: "inside-start", inlineAlign: "inside-end", model: __classPrivateFieldGet(this, _GxIdeChatContainer_menuItems, "f"), expanded: this.menuIsExpanded, onExpandedChange: __classPrivateFieldGet(this, _GxIdeChatContainer_menuExpandedChangeHandler, "f") }, h("button", { class: "button-tertiary button-icon-only", onClick: __classPrivateFieldGet(this, _GxIdeChatContainer_showMenuHandler, "f"), type: "button", "aria-label": __classPrivateFieldGet(this, _GxIdeChatContainer_componentLocale, "f").showMenuAriaLabel, title: __classPrivateFieldGet(this, _GxIdeChatContainer_componentLocale, "f").showMenuAriaLabel }, h("ch-image", { class: "icon-m", src: MORE_HORIZONTAL_ICON })), this.copyConversationCallback && (h("button", { class: "button-tertiary button-icon-and-text button-copy-chat", slot: "copy-chat-button", onClick: __classPrivateFieldGet(this, _GxIdeChatContainer_copyConversationHandler, "f"), type: "button", "aria-label": __classPrivateFieldGet(this, _GxIdeChatContainer_componentLocale, "f").copyConversationAriaLabel, title: __classPrivateFieldGet(this, _GxIdeChatContainer_componentLocale, "f").copyConversationAriaLabel }, h("ch-image", { class: "icon-m", src: COPY_ICON }), __classPrivateFieldGet(this, _GxIdeChatContainer_componentLocale, "f").copyConversationLabel)), this.deleteConversationCallback && (h("button", { class: "button-tertiary button-icon-and-text button-delete-chat", slot: "delete-chat-button", onClick: __classPrivateFieldGet(this, _GxIdeChatContainer_deleteConversationHandler, "f"), type: "button", "aria-label": __classPrivateFieldGet(this, _GxIdeChatContainer_componentLocale, "f").deleteConversationAriaLabel, title: __classPrivateFieldGet(this, _GxIdeChatContainer_componentLocale, "f").deleteConversationAriaLabel }, h("ch-image", { class: "icon-m", src: DELETE_ICON }), __classPrivateFieldGet(this, _GxIdeChatContainer_componentLocale, "f").clearConversationLabel)))))), h("section", { class: "ch-chat-container" }, h("slot", null), this.displayConversationCopiedMessage && (h("div", { class: "chat-container__conversation-copied" }, h("div", { class: "chat-container__conversation-copied-wrapper" }, h("ch-image", { class: "icon-m", src: CONVERSATION_ICON }), h("p", { class: "body-regular-l" }, "conversation copied"))))))));
    }
    static get is() { return "gx-ide-chat-container"; }
    static get originalStyleUrls() {
        return {
            "$": ["chat-container.scss"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["chat-container.css"]
        };
    }
    static get assetsDirs() { return ["gx-ide-assets/chat-container"]; }
    static get properties() {
        return {
            "chatTitle": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "The chat title"
                },
                "attribute": "chat-title",
                "reflect": false
            },
            "copyConversationCallback": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "() => void",
                    "resolved": "() => void",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "If true a button for copying the conversation will be render on the header"
                }
            },
            "deleteConversationCallback": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "() => void",
                    "resolved": "() => void",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "If true a button for deleting the conversation will be render on the header"
                }
            },
            "displayWelcomeScreen": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "If true a the welcome screen will be rendered"
                },
                "attribute": "display-welcome-screen",
                "reflect": false,
                "defaultValue": "false"
            }
        };
    }
    static get states() {
        return {
            "displayConversationCopiedMessage": {},
            "menuIsExpanded": {}
        };
    }
    static get methods() {
        return {
            "showCopyConversationMessage": {
                "complexType": {
                    "signature": "() => Promise<void>",
                    "parameters": [],
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        }
                    },
                    "return": "Promise<void>"
                },
                "docs": {
                    "text": "It will display a feedback message that the conversation has been copied",
                    "tags": []
                }
            }
        };
    }
    static get elementRef() { return "el"; }
}
_GxIdeChatContainer_menuItems = new WeakMap(), _GxIdeChatContainer_componentLocale = new WeakMap(), _GxIdeChatContainer_showMenuHandler = new WeakMap(), _GxIdeChatContainer_menuExpandedChangeHandler = new WeakMap(), _GxIdeChatContainer_copyConversationHandler = new WeakMap(), _GxIdeChatContainer_deleteConversationHandler = new WeakMap();
//# sourceMappingURL=chat-container.js.map
