import { r as registerInstance, h, g as getElement, c as createEvent } from './index-98dfb63a.js';
import { d as dist$1 } from './index-68ae9c30.js';
import { d as dist } from './index-649488b2.js';
import { h as Schedule } from './index-997ef4e9.js';
import './Token-0644b4fc.js';

const sv$1 = {
  "Upcoming payments": "Kommande betalningar",
};

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

const styleCss$1 = ".sc-ig-future-due-dates-h{display:block}[hidden].sc-ig-future-due-dates-h{display:none}.sc-ig-future-due-dates-h>table.sc-ig-future-due-dates{border:1px solid rgb(var(--smoothly-medium-color));width:100%;height:100%}tr.sc-ig-future-due-dates:first-of-type{border-bottom:1px solid rgb(var(--smoothly-medium-color));font-weight:bold}td.sc-ig-future-due-dates{padding:.3em}";

const IntergiroFutureDueDates = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
  }
  componentWillLoad() {
    this.t = create$1(this.element);
  }
  render() {
    return [
      h("table", null, h("tr", { color: "light" }, h("td", null, this.t("Upcoming payments"))), this.dates
        ? this.dates.map(date => (h("tr", null, h("td", null, dist$1.DateTime.localize(dist$1.DateTime.parse(date)).slice(0, 10)))))
        : []),
    ];
  }
  get element() { return getElement(this); }
};
IntergiroFutureDueDates.style = styleCss$1;

const en = {
  "-2": "third to last",
  "-1": "second to last",
  "0": "last",
};

const sv = {
  frequency: "frekvens",
  offset: "offset",
  daily: "daglig",
  weekly: "veckovis",
  monthly: "månadsvis",
  quarterly: "kvartalsvis",
  yearly: "årlig",
  date: "datum",
  month: "månad",
  weekday: "veckodag",
  monday: "måndag",
  tuesday: "tisdag",
  wednesday: "onsdag",
  thursday: "torsdag",
  friday: "fredag",
  saturday: "lördag",
  sunday: "söndag",
  january: "januari",
  february: "februari",
  march: "mars",
  may: "maj",
  june: "juni",
  july: "juli",
  august: "augusti",
  october: "oktober",
  first: "första",
  second: "andra",
  third: "tredje",
  "-2": "tredje sista dagen",
  "-1": "andra sista dagen",
  "0": "sista dagen",
};

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

const styleCss = ".sc-ig-schedule-h{width:100%;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:distribute;justify-content:space-around}[hidden].sc-ig-schedule-h{display:none}.sc-ig-schedule-h>section.sc-ig-schedule{width:100%}.sc-ig-schedule-h>section.sc-ig-schedule>label.sc-ig-schedule{font-weight:bold;text-align:left;padding-bottom:.2em;text-transform:capitalize}.sc-ig-schedule-h>section.sc-ig-schedule>smoothly-display.sc-ig-schedule{width:10em;max-width:10em;text-transform:capitalize;-ms-flex-item-align:start;align-self:flex-start}";

const IntergiroSchedule = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
    this.notice = createEvent(this, "notice", 7);
    this.advanced = false;
  }
  componentWillLoad() {
    this.t = create(this.element);
    this.frequency = typeof this.schedule == "object" ? this.schedule.frequency : this.schedule;
    this.offset = Schedule.is(this.schedule) && this.schedule.frequency != "daily" ? this.schedule.offset : undefined;
    this.divisor = Schedule.is(this.schedule) ? this.schedule.divisor : undefined;
  }
  render() {
    return [
      h("section", null, h("label", null, this.t("frequency")), h("smoothly-display", { type: "text", value: this.t(this.frequency) })),
      (this.frequency == "quarterly" || this.frequency == "yearly") && this.offset != undefined ? (h("section", null, h("label", null, this.t("month")), h("smoothly-display", { type: "text", value: this.t(Array.isArray(this.offset) ? Schedule.months[this.offset[0]] : Schedule.months[this.offset]) }))) : ([]),
      (this.frequency == "monthly" ||
        ((this.frequency == "yearly" || this.frequency == "quarterly") && Array.isArray(this.offset))) &&
        this.offset != undefined ? (h("section", null, h("label", null, this.t("date")), h("smoothly-display", { type: "text", value: this.t(Array.isArray(this.offset) ? (this.offset[1] + 1).toString() : (this.offset + 1).toString()) }))) : ([]),
      this.frequency == "weekly" && !Array.isArray(this.offset) && this.offset != undefined ? (h("section", null, h("label", null, this.t("weekday")), h("smoothly-display", { type: "text", value: this.t(Schedule.weekdays[this.offset - 1]) }))) : ([]),
      this.divisor != undefined ? (h("section", null, h("label", null, this.t("divisor")), h("smoothly-display", { type: "text", value: Array.isArray(this.divisor)
          ? this.divisor[0].toString() + " / " + this.divisor[1].toString()
          : this.divisor.toString() }))) : ([]),
    ];
  }
  get element() { return getElement(this); }
};
IntergiroSchedule.style = styleCss;

export { IntergiroFutureDueDates as ig_future_due_dates, IntergiroSchedule as ig_schedule };
