import { h } from "@stencil/core";
import { DataTestIdsEnum } from "../../../../constants/dataTestIds.enum";
export function trimAddress(s) {
    const firstFour = s.slice(0, 6);
    const lastFour = s.slice(-6);
    return `${firstFour}...${lastFour}`;
}
export const renderAccounts = ({ shownAccounts = [], onSelectAccount, selectedIndex }) => {
    return (h("div", { class: "account-list", "data-testid": DataTestIdsEnum.addressTableContainer }, h("div", { class: "account-header" }, h("div", { class: "account-header-item" }, "Address"), h("div", { class: "account-header-item" }, "Balance"), h("div", { class: "account-header-item" }, "#")), shownAccounts.map(account => (h("div", { class: "account-row", onClick: () => onSelectAccount(account.index) }, h("div", { class: "address-row-item-data " }, h("input", { type: "radio", name: "account", checked: account.index === selectedIndex, value: account.index }), h("span", { class: "address" }, trimAddress(account.address))), h("div", { class: "address-row-item-data" }, account.balance), h("div", { class: "address-row-item-data" }, account.index))))));
};
//# sourceMappingURL=renderAccounts.js.map
