"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const index = require("../../../hooks/use-locale/index.js");
const index$1 = require("../../../hooks/use-namespace/index.js");
const index$2 = require("../../icon/index.js");
const useFormCommonProps = require("../../form/src/hooks/use-form-common-props.js");
const tag = require("./tag.js");
const index$3 = require("../../../../../@element-plus/icons-vue/dist/index.js");
const Vue = require("vue");
const _hoisted_1 = ["aria-label"];
const _hoisted_2 = ["aria-label"];
var tag_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ Vue.defineComponent({
  name: "ElTag",
  __name: "tag",
  props: tag.tagProps,
  emits: tag.tagEmits,
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const tagSize = useFormCommonProps.useFormSize();
    const { t } = index.useLocale();
    const ns = index$1.useNamespace("tag");
    const containerKls = Vue.computed(() => {
      const { type, hit, effect, closable, round } = props;
      return [
        ns.b(),
        ns.is("closable", closable),
        ns.m(type || "primary"),
        ns.m(tagSize.value),
        ns.m(effect),
        ns.is("hit", hit),
        ns.is("round", round)
      ];
    });
    const handleClose = (event) => {
      emit("close", event);
    };
    const handleClick = (event) => {
      emit("click", event);
    };
    const handleVNodeMounted = (vnode) => {
      var _a, _b, _c;
      if ((_c = (_b = (_a = vnode == null ? void 0 : vnode.component) == null ? void 0 : _a.subTree) == null ? void 0 : _b.component) == null ? void 0 : _c.bum) vnode.component.subTree.component.bum = null;
    };
    return (_ctx, _cache) => {
      return __props.disableTransitions ? (Vue.openBlock(), Vue.createElementBlock("span", {
        key: 0,
        class: Vue.normalizeClass(containerKls.value),
        style: Vue.normalizeStyle({ backgroundColor: __props.color }),
        onClick: handleClick
      }, [Vue.createElementVNode("span", { class: Vue.normalizeClass(Vue.unref(ns).e("content")) }, [Vue.renderSlot(_ctx.$slots, "default")], 2), __props.closable ? (Vue.openBlock(), Vue.createElementBlock("button", {
        key: 0,
        "aria-label": Vue.unref(t)("el.tag.close"),
        class: Vue.normalizeClass(Vue.unref(ns).e("close")),
        type: "button",
        onClick: Vue.withModifiers(handleClose, ["stop"])
      }, [Vue.createVNode(Vue.unref(index$2.ElIcon), null, {
        default: Vue.withCtx(() => [Vue.createVNode(Vue.unref(index$3.Close))]),
        _: 1
      })], 10, _hoisted_1)) : Vue.createCommentVNode("v-if", true)], 6)) : (Vue.openBlock(), Vue.createBlock(Vue.Transition, {
        key: 1,
        name: `${Vue.unref(ns).namespace.value}-zoom-in-center`,
        appear: "",
        onVnodeMounted: handleVNodeMounted
      }, {
        default: Vue.withCtx(() => [Vue.createElementVNode("span", {
          class: Vue.normalizeClass(containerKls.value),
          style: Vue.normalizeStyle({ backgroundColor: __props.color }),
          onClick: handleClick
        }, [Vue.createElementVNode("span", { class: Vue.normalizeClass(Vue.unref(ns).e("content")) }, [Vue.renderSlot(_ctx.$slots, "default")], 2), __props.closable ? (Vue.openBlock(), Vue.createElementBlock("button", {
          key: 0,
          "aria-label": Vue.unref(t)("el.tag.close"),
          class: Vue.normalizeClass(Vue.unref(ns).e("close")),
          type: "button",
          onClick: Vue.withModifiers(handleClose, ["stop"])
        }, [Vue.createVNode(Vue.unref(index$2.ElIcon), null, {
          default: Vue.withCtx(() => [Vue.createVNode(Vue.unref(index$3.Close))]),
          _: 1
        })], 10, _hoisted_2)) : Vue.createCommentVNode("v-if", true)], 6)]),
        _: 3
      }, 8, ["name"]));
    };
  }
});
exports.default = tag_vue_vue_type_script_setup_true_lang_default;
