import { defineComponent, toRefs, reactive, onUnmounted, openBlock, createElementBlock, Fragment, renderList, unref, createBlock, createCommentVNode } from "vue";
import DigitalItem from "./components/DigitalItem.mjs";
import moment from "moment";
import "./index.vue_vue_type_style_index_0_scoped_true_lang.mjs";
import _export_sfc from "../../../../_virtual/plugin-vue_export-helper.mjs";
const _hoisted_1 = { class: "times" };
const __default__ = defineComponent({ name: "ETime3d" });
const _sfc_main = /* @__PURE__ */ defineComponent({
  ...__default__,
  props: {
    chartConfig: {
      type: Object,
      required: true
    }
  },
  setup(__props) {
    const props = __props;
    const { times: checkTimes } = toRefs(props.chartConfig.option);
    const times = reactive({
      year: [],
      month: [],
      date: [],
      hour: [],
      minute: [],
      second: []
    });
    let timeout;
    function Interval() {
      timeout = setTimeout(() => {
        let now = moment();
        times.year = changeNumberArray(now.year());
        times.month = changeNumberArray(now.month());
        times.date = changeNumberArray(now.date());
        times.hour = changeNumberArray(now.hour());
        times.minute = changeNumberArray(now.minute());
        times.second = changeNumberArray(now.second());
        Interval();
      }, 1e3);
    }
    Interval();
    function changeNumberArray(item) {
      let arr = [];
      item.toString().split("").forEach((jtem) => {
        arr.push(parseInt(jtem));
      });
      if (arr.length == 1)
        arr.unshift(0);
      return arr;
    }
    onUnmounted(() => {
      clearTimeout(timeout);
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1, [
        (openBlock(true), createElementBlock(Fragment, null, renderList(times, (value, key, index) => {
          return openBlock(), createElementBlock(Fragment, null, [
            (openBlock(true), createElementBlock(Fragment, null, renderList(value, (item, jndex) => {
              return openBlock(), createElementBlock(Fragment, null, [
                unref(checkTimes).includes(key) ? (openBlock(), createBlock(DigitalItem, {
                  key: 0,
                  chartConfig: __props.chartConfig,
                  value: item
                }, null, 8, ["chartConfig", "value"])) : createCommentVNode("", true)
              ], 64);
            }), 256))
          ], 64);
        }), 256))
      ]);
    };
  }
});
var _ETime3d = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-32804650"]]);
export { _ETime3d as default };
