"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const Vue = require("vue");
const index$1 = require("../common/base/Select/index.js");
const index$2 = require("../common/base/Option/index.js");
const index = require("../../locales/index.js");
const _hoisted_1 = { class: "container" };
const _sfc_main = /* @__PURE__ */ Vue.defineComponent({
  __name: "DurationTimePicker",
  props: {
    modelValue: {}
  },
  emits: ["input"],
  setup(__props, { emit: __emit }) {
    const { t } = index.useI18n();
    const props = __props;
    const emit = __emit;
    const selectedTime = Vue.ref(props.modelValue);
    const timeOptions = Vue.computed(() => {
      const options = [];
      for (let i = 15; i < 60; i += 15) {
        options.push({ value: i * 60, label: `${i} ${t("minutes")}` });
      }
      for (let i = 1; i < 24; i++) {
        options.push({ value: i * 60 * 60, label: `${i} ${t("hours")}` });
      }
      return options;
    });
    const updateTime = () => {
      emit("input", selectedTime.value);
    };
    Vue.watch(
      selectedTime,
      () => {
        updateTime();
      },
      {
        immediate: true
      }
    );
    Vue.watch(
      () => props.modelValue,
      (newValue) => {
        selectedTime.value = newValue;
      },
      { immediate: true }
    );
    return (_ctx, _cache) => {
      return Vue.openBlock(), Vue.createElementBlock("div", _hoisted_1, [
        Vue.createVNode(Vue.unref(index$1.default), {
          modelValue: selectedTime.value,
          "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => selectedTime.value = $event),
          theme: "white",
          teleported: false,
          "custom-select-content-style": { "font-weight": 400 },
          value: selectedTime.value,
          onInput: _cache[1] || (_cache[1] = ($event) => selectedTime.value = $event)
        }, {
          default: Vue.withCtx(() => [
            (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(timeOptions.value, (time) => {
              return Vue.openBlock(), Vue.createBlock(Vue.unref(index$2.default), {
                key: time.value,
                theme: "white",
                value: time.value,
                label: time.label,
                "custom-option-content-style": { "font-weight": 400 }
              }, null, 8, ["value", "label"]);
            }), 128))
          ]),
          _: 1
        }, 8, ["modelValue", "value"])
      ]);
    };
  }
});
exports.default = _sfc_main;
