"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const types = require("../../../utils/types.js");
const index = require("../../../hooks/use-namespace/index.js");
const statistic = require("./statistic.js");
const Vue = require("vue");
const shared_esmBundler = require("../../../../../@vue/shared/dist/shared.esm-bundler.js");
var statistic_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ Vue.defineComponent({
  name: "ElStatistic",
  __name: "statistic",
  props: statistic.statisticProps,
  setup(__props, { expose: __expose }) {
    const props = __props;
    const ns = index.useNamespace("statistic");
    const displayValue = Vue.computed(() => {
      const { value, formatter, precision, decimalSeparator, groupSeparator } = props;
      if (shared_esmBundler.isFunction(formatter)) return formatter(value);
      if (!types.isNumber(value) || Number.isNaN(value)) return value;
      let [integer, decimal = ""] = String(value).split(".");
      decimal = decimal.padEnd(precision, "0").slice(0, precision > 0 ? precision : 0);
      integer = integer.replace(/\B(?=(\d{3})+(?!\d))/g, groupSeparator);
      return [integer, decimal].join(decimal ? decimalSeparator : "");
    });
    __expose({ displayValue });
    return (_ctx, _cache) => {
      return Vue.openBlock(), Vue.createElementBlock("div", { class: Vue.normalizeClass(Vue.unref(ns).b()) }, [_ctx.$slots.title || __props.title ? (Vue.openBlock(), Vue.createElementBlock("div", {
        key: 0,
        class: Vue.normalizeClass(Vue.unref(ns).e("head"))
      }, [Vue.renderSlot(_ctx.$slots, "title", {}, () => [Vue.createTextVNode(Vue.toDisplayString(__props.title), 1)])], 2)) : Vue.createCommentVNode("v-if", true), Vue.createElementVNode("div", { class: Vue.normalizeClass(Vue.unref(ns).e("content")) }, [
        _ctx.$slots.prefix || __props.prefix ? (Vue.openBlock(), Vue.createElementBlock("div", {
          key: 0,
          class: Vue.normalizeClass(Vue.unref(ns).e("prefix"))
        }, [Vue.renderSlot(_ctx.$slots, "prefix", {}, () => [Vue.createElementVNode("span", null, Vue.toDisplayString(__props.prefix), 1)])], 2)) : Vue.createCommentVNode("v-if", true),
        Vue.createElementVNode("span", {
          class: Vue.normalizeClass(Vue.unref(ns).e("number")),
          style: Vue.normalizeStyle(__props.valueStyle)
        }, Vue.toDisplayString(displayValue.value), 7),
        _ctx.$slots.suffix || __props.suffix ? (Vue.openBlock(), Vue.createElementBlock("div", {
          key: 1,
          class: Vue.normalizeClass(Vue.unref(ns).e("suffix"))
        }, [Vue.renderSlot(_ctx.$slots, "suffix", {}, () => [Vue.createElementVNode("span", null, Vue.toDisplayString(__props.suffix), 1)])], 2)) : Vue.createCommentVNode("v-if", true)
      ], 2)], 2);
    };
  }
});
exports.default = statistic_vue_vue_type_script_setup_true_lang_default;
