import { h } from "@stencil/core";
export class BpSdkChip {
    constructor() {
        this.type = undefined;
        this.text = undefined;
        this.useExternal = false;
    }
    resetState() { }
    connectedCallback() {
        this.resetState();
    }
    componentWillLoad() {
        this.useExternal = !!customElements.get('bp-sdk-external-chip');
        customElements.whenDefined('bp-sdk-external-chip').then(() => {
            this.useExternal = true;
        });
    }
    render() {
        return [this.useExternal && this.renderExternal(), !this.useExternal && this.renderInternal()];
    }
    renderExternal() {
        return h("bp-sdk-external-chip", { type: this.type, text: this.text });
    }
    renderInternal() {
        return [
            h("bp-sdk-chip-before", { text: this.text }),
            h("span", { class: `bp-sdk-chip bp-sdk-chip__${this.type}`, innerHTML: this.text }),
            h("bp-sdk-chip-after", { text: this.text }),
        ];
    }
    static get is() { return "bp-sdk-chip"; }
    static get properties() {
        return {
            "type": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Chip type"
                },
                "attribute": "type",
                "reflect": false
            },
            "text": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Inner text"
                },
                "attribute": "text",
                "reflect": false
            }
        };
    }
    static get states() {
        return {
            "useExternal": {}
        };
    }
}
