import { Fragment, h } from "@stencil/core";
import { DataTestIdsEnum } from "../../../../../constants/dataTestIds.enum";
import { renderAccounts } from "../../helpers/renderAccounts";
export class LedgerAccountScreen {
    render() {
        const isSelectedIndexOnPage = this.accountScreenData.accounts.some(({ index }) => index === this.selectedIndex);
        const accountsList = this.accountScreenData.isLoading || this.accountScreenData.accounts.length === 0 ? (h("generic-spinner", { "data-testid": DataTestIdsEnum.ledgerLoading })) : (renderAccounts({
            shownAccounts: this.accountScreenData.accounts,
            onSelectAccount: (index) => this.selectAccount.emit(index),
            selectedIndex: this.selectedIndex,
        }));
        return (h(Fragment, { key: '838d37d86d04247b19101ff5dc387a6531c90265' }, accountsList, !this.accountScreenData.isLoading && this.accountScreenData.accounts.length !== 0 && (h(Fragment, { key: 'aeb62e0519bbcc46944ce97bcace57504db3f73b' }, h("div", { key: 'c4bd512b2c8b08591774abc0af92a85e16697c85', class: "navigation" }, h("button", { key: '0c891e5f8af57d75a693f4cf9a12d2114aa493cb', onClick: () => this.prevPage.emit(), disabled: this.accountScreenData.startIndex <= 0, "data-testid": DataTestIdsEnum.prevBtn, class: "navigation-button" }, '< ', " Prev"), h("button", { key: '081d4f65b0c978dc2be6700631d41ae4eadfc1ac', onClick: () => this.nextPage.emit(), "data-testid": DataTestIdsEnum.nextBtn, class: "navigation-button" }, "Next", ' >')), h("button", { key: 'ef36f5928ee6c5a4e90661edffaf41718f35326e', "data-testid": DataTestIdsEnum.confirmBtn, class: "access-button", onClick: () => this.accessWallet.emit(), disabled: !isSelectedIndexOnPage }, "Access Wallet")))));
    }
    static get is() { return "ledger-account-screen"; }
    static get encapsulation() { return "shadow"; }
    static get originalStyleUrls() {
        return {
            "$": ["ledger-account-screen.scss"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["ledger-account-screen.css"]
        };
    }
    static get properties() {
        return {
            "accountScreenData": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "IAccountScreenData",
                    "resolved": "IAccountScreenData",
                    "references": {
                        "IAccountScreenData": {
                            "location": "import",
                            "path": "../../ledger-connect.types",
                            "id": "src/components/functional/ledger-connect-components/ledger-connect.types.ts::IAccountScreenData"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false
            },
            "selectedIndex": {
                "type": "number",
                "mutable": false,
                "complexType": {
                    "original": "number",
                    "resolved": "number",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "attribute": "selected-index",
                "reflect": false
            }
        };
    }
    static get events() {
        return [{
                "method": "selectAccount",
                "name": "selectAccount",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "complexType": {
                    "original": "any",
                    "resolved": "any",
                    "references": {}
                }
            }, {
                "method": "nextPage",
                "name": "nextPage",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "complexType": {
                    "original": "any",
                    "resolved": "any",
                    "references": {}
                }
            }, {
                "method": "prevPage",
                "name": "prevPage",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "complexType": {
                    "original": "any",
                    "resolved": "any",
                    "references": {}
                }
            }, {
                "method": "accessWallet",
                "name": "accessWallet",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "complexType": {
                    "original": "any",
                    "resolved": "any",
                    "references": {}
                }
            }];
    }
}
//# sourceMappingURL=ledger-account-screen.js.map
