'use strict';

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

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

const sv = {
  Number: "Nummer",
  Amount: "Summa",
  Schedule: "Schema",
  Start: "Påbörjar",
  End: "Upphör",
  Due: "Nästa betalning",
  "There are no subscriptions to display.": "Det finns inga prenummerationer att visa.",
};

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

const styleCss = ".sc-payfunc-subscription-table-h{display:block;width:100%;max-width:90em;margin:auto}[hidden].sc-payfunc-subscription-table-h{display:none}.sc-payfunc-subscription-table-h>p.sc-payfunc-subscription-table{padding-left:1em}.sc-payfunc-subscription-table-h>table.sc-payfunc-subscription-table{width:100%}.sc-payfunc-subscription-table-h>table.sc-payfunc-subscription-table>thead.sc-payfunc-subscription-table>tr.sc-payfunc-subscription-table{display:table-row;font-weight:bold;height:2em}.sc-payfunc-subscription-table-h>table.sc-payfunc-subscription-table>thead.sc-payfunc-subscription-table>tr.sc-payfunc-subscription-table>*.sc-payfunc-subscription-table{display:table-cell;padding-right:.5em;padding-left:.3em;vertical-align:middle;position:sticky;top:1.55cm;z-index:1;text-align:left}.sc-payfunc-subscription-table-h>table.sc-payfunc-subscription-table>td.sc-payfunc-subscription-table{text-align:center}";

const PayfuncSubscriptionTable = class {
  constructor(hostRef) {
    index$1.registerInstance(this, hostRef);
    this.opened = {};
  }
  componentWillLoad() {
    this.t = create(this.element);
  }
  toggleColumn(e) {
    const opened = Object.assign({}, this.opened);
    if (e.detail["id"] && opened[e.detail.id] == e.detail.column)
      delete opened[e.detail.id];
    else
      opened[e.detail.id] = e.detail.column;
    this.opened = opened;
  }
  render() {
    return [
      this.subscriptions ? ([
        index$1.h("table", null, index$1.h("thead", null, index$1.h("tr", null, index$1.h("th", { color: "light" }, this.t("Number")), index$1.h("th", { color: "light" }, this.t("Amount")), index$1.h("th", { color: "light" }, this.t("Schedule")), index$1.h("th", { color: "light" }, this.t("Start")), index$1.h("th", { color: "light" }, this.t("End")), index$1.h("th", { color: "light" }, this.t("Due")))), this.subscriptions.map(s => {
          var _a;
          return [
            index$1.h("payfunc-subscription-table-row", { opened: this.opened[s.id], subscription: s }),
            index$1.h("payfunc-subscription-details", { opened: (_a = this.opened[s.id]) !== null && _a !== void 0 ? _a : "", subscription: s, account: this.account }),
          ];
        })),
      ]) : (index$1.h("p", null, this.t("There are no subscriptions to display."))),
    ];
  }
  get element() { return index$1.getElement(this); }
};
PayfuncSubscriptionTable.style = styleCss;

exports.payfunc_subscription_table = PayfuncSubscriptionTable;
