import { defineComponent as g, useCssVars as _, unref as a, toRefs as x, ref as r, watch as b, openBlock as T, createElementBlock as y, normalizeClass as C, createElementVNode as i, toDisplayString as s } from "vue";
const w = { class: "current top" }, S = { class: "next top" }, k = { class: "current bottom" }, q = { class: "next bottom" }, D = /* @__PURE__ */ g({
  name: "DigitalItem",
  props: {
    chartConfig: {
      type: Object,
      required: !0
    },
    value: {
      type: Number,
      required: !1
    }
  },
  setup(m) {
    const l = m;
    _((e) => ({
      "253f07e1": a(v) + "px",
      "13e9aa98": a(p) + "px",
      "2acebbd7": a(d) + "px",
      a9c4bd56: a(p) / 2 + "px"
    }));
    const { fontSize: d, singleHeight: p, singleWidth: v } = x(l.chartConfig.option);
    let o = r(""), t = r(0), u = r(0), c = 1e3, n = "up";
    b(
      () => l.value,
      (e) => {
        typeof e == "number" && h(e);
      },
      { deep: !0, immediate: !0 }
    );
    function h(e) {
      o.value = "", setTimeout(() => {
        o.value = "changing";
      }, 20), setTimeout(() => {
        o.value = "changed";
      }, c * 0.9), t.value = e, u.value = e - 1 < 0 ? 0 : e - 1;
    }
    function f() {
      setTimeout(() => {
        o.value = "", setTimeout(() => {
          o.value = "changing";
        }, 20), setTimeout(() => {
          o.value = "changed";
        }, c * 0.9), t.value == 0 && (n = "up"), t.value == 9 && (n = "down");
        let e = -1;
        n == "up" && (e = 1), n == "down" && t.value == 0 && setTimeout(() => {
          t.value = 9;
        }, 20), n == "up" && t.value == 9 && setTimeout(() => {
          t.value = 0;
        }, 20), t.value += e, u.value = t.value - e, f();
      }, c);
    }
    return typeof l.value != "number" && f(), (e, z) => (T(), y("div", {
      class: C(["count", [a(o), a(n)]])
    }, [
      i("span", w, s(a(u)), 1),
      i("span", S, s(a(t)), 1),
      i("span", k, s(a(u)), 1),
      i("span", q, s(a(t)), 1)
    ], 2));
  }
});
export {
  D as default
};
