import "../../../../@ant-design/cssinjs/es/extractStyle.mjs";
import "../../../../@ant-design/cssinjs/es/hooks/useCacheToken.mjs";
import "react";
import "../../../../@ant-design/cssinjs/es/StyleContext.mjs";
import { unit as n } from "../../../../@ant-design/cssinjs/es/util/index.mjs";
import "../../../../@ant-design/cssinjs/es/hooks/useCompatibleInsertionEffect.mjs";
import "../../../../@ant-design/cssinjs/es/hooks/useEffectCleanupRegister.mjs";
import "../../../../@ant-design/cssinjs/es/hooks/useHMR.mjs";
import "../../../../rc-util/es/warning.mjs";
import "../../../../@ant-design/cssinjs/es/theme/createTheme.mjs";
import "../../../../@ant-design/cssinjs/es/theme/ThemeCache.mjs";
import "../../../../@ant-design/cssinjs/es/transformers/legacyLogicalProperties.mjs";
import { resetComponent as s } from "../../style/index.mjs";
import { genStyleHooks as d } from "../../theme/util/genComponentStyleHook.mjs";
import { merge as g } from "../../theme/util/statistic.mjs";
import { TinyColor as p } from "../../../../@ctrl/tinycolor/dist/module/index.mjs";
const m = (o) => {
  const {
    paddingXXS: i,
    lineWidth: e,
    tagPaddingHorizontal: a,
    componentCls: r,
    calc: l
  } = o, t = l(a).sub(e).equal(), c = l(i).sub(e).equal();
  return {
    // Result
    [r]: Object.assign(Object.assign({}, s(o)), {
      display: "inline-block",
      height: "auto",
      marginInlineEnd: o.marginXS,
      paddingInline: t,
      fontSize: o.tagFontSize,
      lineHeight: o.tagLineHeight,
      whiteSpace: "nowrap",
      background: o.defaultBg,
      border: `${n(o.lineWidth)} ${o.lineType} ${o.colorBorder}`,
      borderRadius: o.borderRadiusSM,
      opacity: 1,
      transition: `all ${o.motionDurationMid}`,
      textAlign: "start",
      position: "relative",
      // RTL
      [`&${r}-rtl`]: {
        direction: "rtl"
      },
      "&, a, a:hover": {
        color: o.defaultColor
      },
      [`${r}-close-icon`]: {
        marginInlineStart: c,
        fontSize: o.tagIconSize,
        color: o.colorTextDescription,
        cursor: "pointer",
        transition: `all ${o.motionDurationMid}`,
        "&:hover": {
          color: o.colorTextHeading
        }
      },
      [`&${r}-has-color`]: {
        borderColor: "transparent",
        [`&, a, a:hover, ${o.iconCls}-close, ${o.iconCls}-close:hover`]: {
          color: o.colorTextLightSolid
        }
      },
      "&-checkable": {
        backgroundColor: "transparent",
        borderColor: "transparent",
        cursor: "pointer",
        [`&:not(${r}-checkable-checked):hover`]: {
          color: o.colorPrimary,
          backgroundColor: o.colorFillSecondary
        },
        "&:active, &-checked": {
          color: o.colorTextLightSolid
        },
        "&-checked": {
          backgroundColor: o.colorPrimary,
          "&:hover": {
            backgroundColor: o.colorPrimaryHover
          }
        },
        "&:active": {
          backgroundColor: o.colorPrimaryActive
        }
      },
      "&-hidden": {
        display: "none"
      },
      // To ensure that a space will be placed between character and `Icon`.
      [`> ${o.iconCls} + span, > span + ${o.iconCls}`]: {
        marginInlineStart: t
      }
    }),
    [`${r}-borderless`]: {
      borderColor: "transparent",
      background: o.tagBorderlessBg
    }
  };
}, u = (o) => {
  const {
    lineWidth: i,
    fontSizeIcon: e,
    calc: a
  } = o, r = o.fontSizeSM;
  return g(o, {
    tagFontSize: r,
    tagLineHeight: n(a(o.lineHeightSM).mul(r).equal()),
    tagIconSize: a(e).sub(a(i).mul(2)).equal(),
    // Tag icon is much smaller
    tagPaddingHorizontal: 8,
    // Fixed padding.
    tagBorderlessBg: o.colorFillTertiary
  });
}, h = (o) => ({
  defaultBg: new p(o.colorFillQuaternary).onBackground(o.colorBgContainer).toHexString(),
  defaultColor: o.colorText
}), q = d("Tag", (o) => {
  const i = u(o);
  return m(i);
}, h);
export {
  q as default,
  h as prepareComponentToken,
  u as prepareToken
};
