'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index$1 = require('./index-0b1e2673.js');
require('./_commonjsHelpers-937cd5b3.js');
const index$2 = require('./index-2eb96242.js');
const index = require('./index-36cf3884.js');

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

function create(language) {
  return index.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) {
    index$1.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 : index$2.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 (index$1.h("footer", null, index$1.h("td", null, index$1.h("span", null, this.t("total count: ")), index$1.h("span", null, this.accounts ? (_a = this.accounts) === null || _a === void 0 ? void 0 : _a.length : 0)), index$1.h("td", null, index$1.h("span", null, this.t("active: ")), index$1.h("span", null, active)), index$1.h("td", null, index$1.h("span", null, this.t("created: ")), index$1.h("span", null, created)), index$1.h("td", null, index$1.h("span", null, this.t("pending: ")), index$1.h("span", null, pending)), index$1.h("td", null, index$1.h("span", null, this.t("suspended: ")), index$1.h("span", null, suspended))));
  }
  get element() { return index$1.getElement(this); }
};
PayfuncAccountsFooter.style = styleCss;

exports.payfunc_accounts_footer = PayfuncAccountsFooter;
