import "../../../../../../node_modules/.pnpm/vue@3.3.4/node_modules/vue/dist/vue.runtime.esm-bundler.mjs";
import { useChartEditStore } from "../../../../../store/modules/chartEditStore/chartEditStore.mjs";
import "../../../../../store/modules/designStore/designStore.mjs";
import "../../../../../settings/designSetting.mjs";
import "../../../../../../node_modules/.pnpm/screenfull@6.0.2/node_modules/screenfull/index.mjs";
import "../../../../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_root.mjs";
import "../../../../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGetTag.mjs";
import "../../../../../../node_modules/.pnpm/html2canvas@1.4.1/node_modules/html2canvas/dist/html2canvas.esm.mjs";
import "../../../../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseClone.mjs";
import "../../../../../../node_modules/.pnpm/crypto-js@4.1.1/node_modules/crypto-js/index.mjs";
import "../../../../../enums/pageEnum.mjs";
import "../../../../../router/index.mjs";
import "../../../../../../node_modules/.pnpm/vue3-lazyload@0.2.5-beta_a6dezdz3je235ci4e3tu4rayna/node_modules/vue3-lazyload/dist/vue3-lazyload.esm.mjs";
import "../../../../../components/GoSkeleton/index.vue.mjs";
import "../../../../../components/GoLoading/index.mjs";
import { useChartDataFetch } from "../../../../../hooks/useChartDataFetch.hook.mjs";
import "../../../../../api/axios.mjs";
import "../../../../../../node_modules/.pnpm/echarts@5.4.3/node_modules/echarts/index.mjs";
import "../../../../../store/modules/langStore/langStore.mjs";
import Flipper from "../../../../../components/Pages/Flipper/index.vue.mjs";
import { defineComponent, watch, resolveComponent, openBlock, createBlock, withCtx, createElementBlock, Fragment, renderList } from "../../../../../../node_modules/.pnpm/@vue_runtime-core@3.3.4/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.mjs";
import { useCssVars } from "../../../../../../node_modules/.pnpm/@vue_runtime-dom@3.3.4/node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.mjs";
import { unref, toRefs, ref } from "../../../../../../node_modules/.pnpm/@vue_reactivity@3.3.4/node_modules/@vue/reactivity/dist/reactivity.esm-bundler.mjs";
const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "index",
  props: {
    chartConfig: {
      type: Object,
      required: true
    }
  },
  setup(__props) {
    const props = __props;
    useCssVars((_ctx) => ({
      "0aa6998a": `${unref(w)}px`,
      "09d338fb": `${unref(h)}px`
    }));
    const { w, h } = toRefs(props.chartConfig.attr);
    const {
      flipperLength,
      flipperBgColor,
      flipperTextColor,
      flipperWidth,
      flipperHeight,
      flipperRadius,
      flipperGap,
      flipperType,
      flipperSpeed,
      flipperBorderWidth
    } = toRefs(props.chartConfig.option);
    const flipperData = ref([]);
    const getFlipperData = (val) => {
      return val.toString().padStart(flipperLength.value, "0").split("").slice(flipperLength.value * -1);
    };
    const updateDatasetHandler = (newVal) => {
      flipperData.value = getFlipperData(newVal);
    };
    watch(
      () => props.chartConfig.option,
      (newVal) => {
        try {
          updateDatasetHandler(newVal.dataset);
        } catch (error) {
          console.log(error);
        }
      },
      {
        immediate: true,
        deep: true
      }
    );
    useChartDataFetch(props.chartConfig, useChartEditStore, (newVal) => {
      updateDatasetHandler(newVal);
    });
    return (_ctx, _cache) => {
      const _component_n_space = resolveComponent("n-space");
      return openBlock(), createBlock(_component_n_space, {
        class: "go-decorates-flipper-number",
        size: unref(flipperGap),
        align: "center",
        justify: "center"
      }, {
        default: withCtx(() => [
          (openBlock(true), createElementBlock(Fragment, null, renderList(flipperData.value, (item, index) => {
            return openBlock(), createBlock(unref(Flipper), {
              count: item,
              width: unref(flipperWidth),
              height: unref(flipperHeight),
              "front-color": unref(flipperTextColor),
              "back-color": unref(flipperBgColor),
              radius: unref(flipperRadius),
              "flip-type": unref(flipperType),
              duration: unref(flipperSpeed),
              "border-width": unref(flipperBorderWidth),
              key: index,
              class: "go-d-block"
            }, null, 8, ["count", "width", "height", "front-color", "back-color", "radius", "flip-type", "duration", "border-width"]);
          }), 128))
        ]),
        _: 1
      }, 8, ["size"]);
    };
  }
});
export {
  _sfc_main as default
};
