"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const Vue = require("vue");
const index = require("../badge/index.js");
const ConfigProvider = require("../config-provider/ConfigProvider.js");
const props = require("../utils/props.js");
const create = require("../utils/create.js");
const format = require("../utils/format.js");
const [name, bem] = create.createNamespace("icon");
const isImage = (name2) => name2 == null ? void 0 : name2.includes("/");
const iconProps = {
  dot: Boolean,
  tag: props.makeStringProp("i"),
  name: String,
  size: props.numericProp,
  badge: props.numericProp,
  color: String,
  badgeProps: Object,
  classPrefix: String
};
var stdin_default = Vue.defineComponent({
  name,
  props: iconProps,
  setup(props2, {
    slots
  }) {
    const config = Vue.inject(ConfigProvider.CONFIG_PROVIDER_KEY, null);
    const classPrefix = Vue.computed(() => props2.classPrefix || (config == null ? void 0 : config.iconPrefix) || bem());
    return () => {
      const {
        tag,
        dot,
        name: name2,
        size,
        badge,
        color
      } = props2;
      const isImageIcon = isImage(name2);
      return Vue.createVNode(index.Badge, Vue.mergeProps({
        "dot": dot,
        "tag": tag,
        "class": [classPrefix.value, isImageIcon ? "" : `${classPrefix.value}-${name2}`],
        "style": {
          color,
          fontSize: format.addUnit(size)
        },
        "content": badge
      }, props2.badgeProps), {
        default: () => {
          var _a;
          return [(_a = slots.default) == null ? void 0 : _a.call(slots), isImageIcon && Vue.createVNode("img", {
            "class": bem("image"),
            "src": name2
          }, null)];
        }
      });
    };
  }
});
exports.default = stdin_default;
exports.iconProps = iconProps;
