import { r as registerInstance, h, g as getElement } from './index-aeac5cad.js';
import './_commonjsHelpers-91fffb88.js';
import { A as Account } from './index-ec2a4942.js';
import { d as dist } from './index-fdd60c34.js';

const sv = {
  "total count: ": "totalt antal: ",
  "active: ": "aktiva: ",
  "created: ": "skapade: ",
  "inactive: ": "inaktiva: ",
  "pending: ": "väntande: ",
  "suspended: ": "avstängda: ",
};

function create(language) {
  return dist.create({
    sv,
  }, language);
}

const styleCss = "footer.sc-payfunc-accounts-footer{display:block;margin:auto;border:1px solid rgb(var(--smoothly-medium-color));width:100%;max-width:90em;z-index:1;position:sticky;bottom:0;color:rgb(var(--smoothly-light-contrast));background-color:rgb(var(--smoothly-light-color));padding:.5em 0 .5em 0em}.sc-payfunc-accounts-footer-h>footer.sc-payfunc-accounts-footer>td.sc-payfunc-accounts-footer>span.sc-payfunc-accounts-footer{display:inline-block;margin-left:0.4em;margin-right:0.6em}.sc-payfunc-accounts-footer-h>footer.sc-payfunc-accounts-footer>td.sc-payfunc-accounts-footer{display:inline-block;padding-top:0.2em;margin-left:2em}";

const PayfuncAccountsFooter = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
  }
  componentWillLoad() {
    this.t = create(this.element);
  }
  render() {
    var _a;
    const [active, created, pending, suspended] = this.accounts
      ? this.accounts.reduce(([a, c, p, s], account) => {
        var _a, _b;
        const status = (_a = account.status) !== null && _a !== void 0 ? _a : Account.Status.getStatus(account, this.orders ? (_b = this.orders[account.id]) === null || _b === void 0 ? void 0 : _b.slice(0, 1).shift() : undefined);
        return status == "active"
          ? [++a, c, p, s]
          : status == "created"
            ? [a, ++c, p, s]
            : status == "pending"
              ? [a, c, p++, s]
              : [a, c, p, ++s];
      }, [0, 0, 0, 0])
      : [0, 0, 0, 0];
    return (h("footer", null, h("td", null, h("span", null, this.t("total count: ")), h("span", null, this.accounts ? (_a = this.accounts) === null || _a === void 0 ? void 0 : _a.length : 0)), h("td", null, h("span", null, this.t("active: ")), h("span", null, active)), h("td", null, h("span", null, this.t("created: ")), h("span", null, created)), h("td", null, h("span", null, this.t("pending: ")), h("span", null, pending)), h("td", null, h("span", null, this.t("suspended: ")), h("span", null, suspended))));
  }
  get element() { return getElement(this); }
};
PayfuncAccountsFooter.style = styleCss;

export { PayfuncAccountsFooter as payfunc_accounts_footer };
