import { r as registerInstance, j as createEvent, h, g as getElement } from './index-07845439.js';
import { c as Schedule } from './index-e20749b7.js';
import { d as dist } from './index-63517df5.js';
import './index-b6cf748e.js';
import './_commonjsHelpers-8fe71198.js';
import './index-265fba1f.js';

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 { IntergiroSchedule as ig_schedule };
