import { h } from "@stencil/core";
export class BpSdkIconContainer {
    constructor() {
        this.name = undefined;
        this.cssClasses = '';
        this.useExternal = false;
        this.iconDefined = false;
    }
    resetState() { }
    connectedCallback() {
        this.resetState();
    }
    componentWillLoad() {
        this.useExternal = !!customElements.get('bp-sdk-external-icon-container');
        customElements.whenDefined('bp-sdk-external-icon-container').then(() => {
            this.useExternal = true;
        });
        this.iconDefined = !!customElements.get('bp-sdk-icon');
        customElements.whenDefined('bp-sdk-external-icon').then(() => {
            this.iconDefined = true;
        });
    }
    render() {
        return [this.useExternal && this.renderExternal(), !this.useExternal && this.renderInternal()];
    }
    renderExternal() {
        return h("bp-sdk-external-icon-container", { name: this.name, cssClasses: this.cssClasses });
    }
    renderInternal() {
        return (h("div", { class: "bp-sdk-icon__container" }, this.iconDefined && h("bp-sdk-icon", { name: this.name, cssClasses: this.cssClasses }), !this.iconDefined && h("span", { class: "bp-sdk-icon__container--fallback" }, this.name)));
    }
    static get is() { return "bp-sdk-icon-container"; }
    static get originalStyleUrls() {
        return {
            "$": ["./bp-sdk-icon-container.css"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["bp-sdk-icon-container.css"]
        };
    }
    static get properties() {
        return {
            "name": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Icon name"
                },
                "attribute": "name",
                "reflect": false
            },
            "cssClasses": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Additional css classes"
                },
                "attribute": "css-classes",
                "reflect": false,
                "defaultValue": "''"
            }
        };
    }
    static get states() {
        return {
            "useExternal": {},
            "iconDefined": {}
        };
    }
}
