import { defineComponent, ref, watch, openBlock, createElementBlock, createVNode, unref, withCtx, Fragment, renderList, createBlock } from "vue";
import Select from "../Select/index.mjs";
import OPtion from "../Option/index.mjs";
const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "TimepickerH5",
  props: {
    value: {}
  },
  emits: ["input"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const currentValue = ref();
    watch(
      () => props.value,
      (val) => {
        if (!val) return;
        currentValue.value = val;
      },
      { immediate: true }
    );
    watch(currentValue, (val) => emit("input", val), { immediate: true });
    const getTimeList = () => {
      const options = [];
      for (let i = 0; i < 24; i++) {
        for (let j = 0; j < 60; j += 15) {
          const hour = i < 10 ? `0${i}` : `${i}`;
          const minute = j < 10 ? `0${j}` : `${j}`;
          options.push(`${hour}:${minute}`);
        }
      }
      return options;
    };
    const timeOptions = getTimeList();
    const list = timeOptions.map((item) => ({
      label: item,
      value: item
    }));
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", null, [
        createVNode(unref(Select), {
          value: currentValue.value,
          onInput: _cache[0] || (_cache[0] = ($event) => currentValue.value = $event)
        }, {
          default: withCtx(() => [
            (openBlock(true), createElementBlock(Fragment, null, renderList(unref(list), (item) => {
              return openBlock(), createBlock(unref(OPtion), {
                key: item.value,
                value: item.value,
                label: item.label
              }, null, 8, ["value", "label"]);
            }), 128))
          ]),
          _: 1
        }, 8, ["value"])
      ]);
    };
  }
});
export {
  _sfc_main as default
};
