import { r as registerInstance, h } from './index-07845439.js';
import { b as Schedule } from './index-aeffd5c5.js';
import './index-82c01ab3.js';
import './_commonjsHelpers-9bc404fc.js';

const styleCss = ".sc-ig-account-balance-h{display:block;padding-top:.5em}[hidden].sc-ig-account-balance-h{display:none}.sc-ig-account-balance-h>section.sc-ig-account-balance>ig-items-list.sc-ig-account-balance{padding-top:1em}.sc-ig-account-balance-h>section.sc-ig-account-balance:first-of-type{display:flex;justify-content:space-between}.sc-ig-account-balance-h>section.sc-ig-account-balance:last-of-type{display:block}ig-future-due-dates.sc-ig-account-balance{min-width:13em}ig-orders-table.sc-ig-account-balance{border:1px solid rgb(var(--smoothly-medium-color));margin-top:1em}main.sc-ig-account-balance{display:flex;flex-wrap:wrap}main.sc-ig-account-balance>*.sc-ig-account-balance{width:min-content}";

const IntergiroAccountBalance = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
  }
  componentWillLoad() {
    this.filterOrders();
  }
  filterOrders() {
    const orders = this.orders
      ? this.orders.filter(o => o.payment.type == "account" || o.payment.type == "card" ? o.payment.charge == "balance" : false)
      : undefined;
    this.ordersFiltered = orders;
  }
  render() {
    return [
      h("section", null, h("main", null, h("ig-schedule", { schedule: this.account.schedule }), this.account.limit ? h("ig-limit", { account: this.account }) : []), h("ig-future-due-dates", { dates: Schedule.calculateDueDates(this.account.schedule, 4) })),
      h("section", null, this.account.balance.length > 0 ? h("ig-items-list", { items: this.account.balance }) : [], this.ordersFiltered && this.ordersFiltered.length > 0 ? (h("ig-orders-table", { display: true, orders: this.ordersFiltered })) : ([])),
    ];
  }
  static get watchers() { return {
    "orders": ["filterOrders"]
  }; }
};
IntergiroAccountBalance.style = styleCss;

export { IntergiroAccountBalance as ig_account_balance };
