import { defineComponent as S, computed as s, openBlock as $, createElementBlock as b, normalizeClass as l, normalizeStyle as w, createElementVNode as B, toDisplayString as z } from "vue";
import "../../config-provider/index.mjs";
import I from "./style/index.mjs";
import { useNamespace as v } from "../../config-provider/hooks/use-namespace.mjs";
const W = ["title"], A = /* @__PURE__ */ S({
  name: "ApTag",
  __name: "ap-tag",
  props: {
    type: { default: "purely" },
    text: {},
    color: { default: "#34B77C" },
    size: { default: "middle" },
    disabled: { type: Boolean, default: !1 },
    fixedWidth: { type: Boolean, default: !1 }
  },
  setup(r) {
    const e = r, { b: a, bm: n } = v("tag"), c = I("tag");
    function p(t, i) {
      t.length === 4 && (t = `#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`);
      const m = parseInt(t.slice(1, 3), 16), f = parseInt(t.slice(3, 5), 16), g = parseInt(t.slice(5, 7), 16), y = Math.round(i * 255).toString(16).padStart(2, "0");
      return `#${m.toString(16).padStart(2, "0")}${f.toString(16).padStart(2, "0")}${g.toString(16).padStart(2, "0")}${y}`;
    }
    const o = s(() => ({
      "--tag-main-color": e.color,
      "--tag-main-color-opacity": p(e.color, 0.06),
      "--tag-main-color-background": p(e.color, 0.15)
    })), d = s(() => [
      a(),
      a("wrapper"),
      a(`wrapper-${e.type}`),
      n("wrapper", e.size),
      c.value
    ].filter(Boolean)), u = s(() => {
      const t = [a("inner-wrapper"), n("inner-wrapper", e.size)];
      return e.disabled && t.push(n("inner-wrapper", "disabled")), t;
    });
    return (t, i) => ($(), b("span", {
      style: w(o.value),
      title: r.text,
      class: l(d.value)
    }, [
      B("span", {
        class: l(u.value)
      }, z(r.text), 3)
    ], 14, W));
  }
});
export {
  A as default
};
