import { h } from "@stencil/core";
export class BpSdkDynamicInputList {
    constructor() {
        this.answers = [];
        this.labelledBy = undefined;
        this.useExternal = false;
    }
    componentWillLoad() {
        this.useExternal = !!customElements.get('bp-sdk-external-dynamic-input-list');
        customElements.whenDefined('bp-sdk-external-dynamic-input-list').then(() => {
            this.useExternal = true;
        });
    }
    render() {
        return [this.useExternal && this.renderExternal(), !this.useExternal && this.renderInternal()];
    }
    renderExternal() {
        return h("bp-sdk-external-dynamic-input-list", { answers: this.answers, labelledBy: this.labelledBy });
    }
    renderInternal() {
        var _a;
        return (h("div", { class: "bp-sdk-dynamic-input-list__container" }, (_a = this.answers) === null || _a === void 0 ? void 0 : _a.map((answer) => (h("bp-sdk-dynamic-input-redux-container", { code: answer.question.code, answer: answer, labelledBy: this.labelledBy })))));
    }
    static get is() { return "bp-sdk-dynamic-input-list"; }
    static get originalStyleUrls() {
        return {
            "$": ["./bp-sdk-dynamic-input-list.css"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["bp-sdk-dynamic-input-list.css"]
        };
    }
    static get properties() {
        return {
            "answers": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "IAnswer[]",
                    "resolved": "IAnswer[]",
                    "references": {
                        "IAnswer": {
                            "location": "import",
                            "path": "@boldpenguin/sdk-types",
                            "id": "../sdk-types/dist/types.d.ts::IAnswer"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Answer list"
                },
                "defaultValue": "[]"
            },
            "labelledBy": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Labels that describe group"
                },
                "attribute": "labelled-by",
                "reflect": false
            }
        };
    }
    static get states() {
        return {
            "useExternal": {}
        };
    }
}
