import { defineComponent, ref, toRefs, watch, onMounted, onUnmounted, openBlock, createElementBlock, normalizeStyle, unref, createElementVNode, toDisplayString } from "vue";
import "./index.vue_vue_type_style_index_0_scoped_true_lang.mjs";
import _export_sfc from "../../../../_virtual/plugin-vue_export-helper.mjs";
const __default__ = defineComponent({ name: "EClock" });
const _sfc_main = /* @__PURE__ */ defineComponent({
  ...__default__,
  props: {
    chartConfig: {
      type: Object,
      required: true
    }
  },
  setup(__props) {
    const props = __props;
    let yearMonthDay = ref("2021-2-3");
    let nowData = ref("08:00:00");
    let newData = ref("2021-2-3 08:00:00");
    let boxShadow = ref("none");
    const { w, h } = toRefs(props.chartConfig.attr);
    let {
      timeColor,
      timeSize,
      timeLineHeight,
      timeTextIndent,
      fontWeight,
      showShadow,
      hShadow,
      vShadow,
      blurShadow,
      colorShadow
    } = toRefs(props.chartConfig.option);
    watch(
      props.chartConfig.option,
      () => {
        try {
          if (props.chartConfig.option.showShadow) {
            boxShadow.value = `${props.chartConfig.option.hShadow}px ${props.chartConfig.option.vShadow}px ${props.chartConfig.option.blurShadow}px ${props.chartConfig.option.colorShadow}`;
          } else {
            boxShadow.value = "none";
          }
        } catch (error) {
          console.log(error);
        }
      },
      {
        immediate: true
      }
    );
    let timer;
    onMounted(() => {
      timer = setInterval(() => {
        var datetime = new Date();
        var year = datetime.getFullYear();
        var month = datetime.getMonth() + 1 < 10 ? "0" + (datetime.getMonth() + 1) : datetime.getMonth() + 1;
        var date = datetime.getDate() < 10 ? "0" + datetime.getDate() : datetime.getDate();
        var hh = datetime.getHours();
        var mm = datetime.getMinutes();
        var ss = datetime.getSeconds();
        let time = "";
        if (hh < 10)
          time += "0";
        time += hh + ":";
        if (mm < 10)
          time += "0";
        time += mm + ":";
        if (ss < 10)
          time += "0";
        time += ss;
        yearMonthDay.value = `${year}-${month}-${date}`;
        nowData.value = time;
        newData.value = yearMonthDay.value + " " + nowData.value;
      }, 500);
    });
    onUnmounted(() => {
      clearInterval(timer);
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: "go-decorates-number",
        style: normalizeStyle(`width:${unref(w)}px;height:${unref(h)}px;`)
      }, [
        createElementVNode("div", {
          style: normalizeStyle(`color:${unref(timeColor)};font-size:${unref(timeSize)}px;line-height:${unref(timeLineHeight)}px;
      letter-spacing:${unref(timeTextIndent)}px;font-weight:${unref(fontWeight)};
      text-shadow: ${unref(boxShadow)}`)
        }, toDisplayString(unref(newData)), 5)
      ], 4);
    };
  }
});
var _ETimeCommon = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-6c609856"]]);
export { _ETimeCommon as default };
