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 __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 _GxIdeAbout_componentLocale, _GxIdeAbout_nextLogo, _GxIdeAbout_copyVersionsHandler;
import { Host, h, getAssetPath } from "@stencil/core";
import { Locale } from "../../common/locale";
const CSS_BUNDLES = [
    "resets/box-sizing",
    "utils/typography",
    "utils/elevation",
    "components/button",
    "chameleon/scrollbar"
];
export class GxIdeAbout {
    constructor() {
        _GxIdeAbout_componentLocale.set(this, void 0);
        _GxIdeAbout_nextLogo.set(this, getAssetPath(`./gx-ide-assets/about/images/next-logo.svg`));
        _GxIdeAbout_copyVersionsHandler.set(this, () => {
            this.copying = true;
            setTimeout(() => {
                this.copying = false;
            }, 1000);
            // be cautions with spaces and indentaiton on the following .writeText
            navigator.clipboard.writeText(`${this.appVersion}\n
${__classPrivateFieldGet(this, _GxIdeAbout_componentLocale, "f").copyVersionsAdditionalText}${this.versions
                .map(version => `- ${version}`)
                .join("\n")}`);
        });
        this.appVersion = undefined;
        this.versions = [];
        this.detailsCallback = undefined;
        this.privacyPolicyCallback = undefined;
        this.termsAndConditionsCallback = undefined;
        this.copying = false;
    }
    async componentWillLoad() {
        __classPrivateFieldSet(this, _GxIdeAbout_componentLocale, await Locale.getComponentStrings(this.el), "f");
    }
    render() {
        const renderPrivacyAndTerms = this.privacyPolicyCallback && this.termsAndConditionsCallback;
        const renderPrivacyOrTerms = this.privacyPolicyCallback || this.termsAndConditionsCallback;
        return (h(Host, { class: "scrollable" }, h("ch-theme", { model: CSS_BUNDLES }), h("section", { class: "section" }, h("header", { class: "header" }, h("figure", { class: "logo__container" }, h("img", { class: "logo__img", src: __classPrivateFieldGet(this, _GxIdeAbout_nextLogo, "f"), alt: __classPrivateFieldGet(this, _GxIdeAbout_componentLocale, "f").logoAlt }), h("figcaption", { class: "body-semi-bold-m logotype" }, "GeneXus Next")), this.appVersion && (h("p", { class: "body-reuglar-m" }, __classPrivateFieldGet(this, _GxIdeAbout_componentLocale, "f").nextVersion, " ", h("span", null, this.appVersion)))), h("div", { class: "main" }, this.versions.length ? (h("div", { class: "versions__container elevation-1" }, h("ul", { class: "versions__list scrollable" }, this.versions.map(version => {
            return h("li", { class: "body-regular-s" }, version);
        })), h("div", { class: "versions__container-footer" }, h("button", { class: "button-secondary", type: "button", onClick: __classPrivateFieldGet(this, _GxIdeAbout_copyVersionsHandler, "f"), disabled: this.copying }, this.copying
            ? __classPrivateFieldGet(this, _GxIdeAbout_componentLocale, "f").copied
            : __classPrivateFieldGet(this, _GxIdeAbout_componentLocale, "f").copy)))) : null, this.detailsCallback && (h("button", { class: "button-tertiary", type: "button", onClick: this.detailsCallback }, __classPrivateFieldGet(this, _GxIdeAbout_componentLocale, "f").detailsAndAcknowledgmentes))), h("footer", { class: "body-regular-s footer" }, renderPrivacyOrTerms && (h("div", { class: "links-container", hidden: !renderPrivacyAndTerms }, this.privacyPolicyCallback && (h("button", { class: "link-underlined caption-regular-m", type: "button", onClick: this.privacyPolicyCallback }, __classPrivateFieldGet(this, _GxIdeAbout_componentLocale, "f").privacyPolicy)), renderPrivacyAndTerms && "|", this.termsAndConditionsCallback && (h("button", { class: "link-underlined caption-regular-m", type: "button", onClick: this.termsAndConditionsCallback }, __classPrivateFieldGet(this, _GxIdeAbout_componentLocale, "f").termsAndConditions)))), __classPrivateFieldGet(this, _GxIdeAbout_componentLocale, "f").copyright))));
    }
    static get is() { return "gx-ide-about"; }
    static get encapsulation() { return "shadow"; }
    static get originalStyleUrls() {
        return {
            "$": ["about.scss"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["about.css"]
        };
    }
    static get assetsDirs() { return ["gx-ide-assets/about"]; }
    static get properties() {
        return {
            "appVersion": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "The application version to display in the dialog."
                },
                "attribute": "app-version",
                "reflect": false
            },
            "versions": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "string[]",
                    "resolved": "string[]",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "GeneXus Next version, and also related dependencies versions"
                },
                "defaultValue": "[]"
            },
            "detailsCallback": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "DetailsCallback",
                    "resolved": "() => Promise<void>",
                    "references": {
                        "DetailsCallback": {
                            "location": "local",
                            "path": "/home/runner/work/genexus-ide-ui/genexus-ide-ui/src/components/about/about.tsx",
                            "id": "src/components/about/about.tsx::DetailsCallback"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Callback invoked when the user clicks on \"Details & Acknowledgements\""
                }
            },
            "privacyPolicyCallback": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "PrivacyPolicyCallback",
                    "resolved": "() => Promise<void>",
                    "references": {
                        "PrivacyPolicyCallback": {
                            "location": "local",
                            "path": "/home/runner/work/genexus-ide-ui/genexus-ide-ui/src/components/about/about.tsx",
                            "id": "src/components/about/about.tsx::PrivacyPolicyCallback"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Callback invoked when the user clicks on \"Privacy policy\""
                }
            },
            "termsAndConditionsCallback": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "TermsAndConditionsCallback",
                    "resolved": "() => Promise<void>",
                    "references": {
                        "TermsAndConditionsCallback": {
                            "location": "local",
                            "path": "/home/runner/work/genexus-ide-ui/genexus-ide-ui/src/components/about/about.tsx",
                            "id": "src/components/about/about.tsx::TermsAndConditionsCallback"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Callback invoked when the user clicks on \"Terms and conditions\""
                }
            }
        };
    }
    static get states() {
        return {
            "copying": {}
        };
    }
    static get elementRef() { return "el"; }
}
_GxIdeAbout_componentLocale = new WeakMap(), _GxIdeAbout_nextLogo = new WeakMap(), _GxIdeAbout_copyVersionsHandler = new WeakMap();
//# sourceMappingURL=about.js.map
