"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const types = require("../../../utils/types.js");
const style = require("../../../utils/dom/style.js");
const index = require("../../../hooks/use-namespace/index.js");
const badge = require("./badge.js");
const vue = require("vue");
var badge_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  name: "ElBadge",
  __name: "badge",
  props: badge.badgeProps,
  setup(__props, { expose: __expose }) {
    const props = __props;
    const ns = index.useNamespace("badge");
    const content = vue.computed(() => {
      if (props.isDot) return "";
      if (types.isNumber(props.value) && types.isNumber(props.max)) return props.max < props.value ? `${props.max}+` : `${props.value}`;
      return `${props.value}`;
    });
    const style$1 = vue.computed(() => {
      return [{
        backgroundColor: props.color,
        marginRight: style.addUnit(-props.offset[0]),
        marginTop: style.addUnit(props.offset[1])
      }, props.badgeStyle ?? {}];
    });
    __expose({ content });
    return (_ctx, _cache) => {
      return vue.openBlock(), vue.createElementBlock("div", { class: vue.normalizeClass(vue.unref(ns).b()) }, [vue.renderSlot(_ctx.$slots, "default"), vue.createVNode(vue.Transition, { name: `${vue.unref(ns).namespace.value}-zoom-in-center` }, {
        default: vue.withCtx(() => [!__props.hidden && (content.value || __props.isDot || _ctx.$slots.content) ? (vue.openBlock(), vue.createElementBlock("sup", {
          key: 0,
          class: vue.normalizeClass([
            vue.unref(ns).e("content"),
            vue.unref(ns).em("content", __props.type),
            vue.unref(ns).is("fixed", !!_ctx.$slots.default),
            vue.unref(ns).is("dot", __props.isDot),
            vue.unref(ns).is("hide-zero", !__props.showZero && __props.value === 0),
            __props.badgeClass
          ]),
          style: vue.normalizeStyle(style$1.value)
        }, [vue.renderSlot(_ctx.$slots, "content", { value: content.value }, () => [vue.createTextVNode(vue.toDisplayString(content.value), 1)])], 6)) : vue.createCommentVNode("v-if", true)]),
        _: 3
      }, 8, ["name"])], 2);
    };
  }
});
exports.default = badge_vue_vue_type_script_setup_true_lang_default;
