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 i } 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 { prepareToken as m, prepareComponentToken as g } from "./index.mjs";
import { resetComponent as u } from "../../style/index.mjs";
import { genStyleHooks as f } from "../../theme/util/genComponentStyleHook.mjs";
import C from "../../theme/util/genPresetColor.mjs";
const $ = (r) => {
  const {
    antCls: e,
    badgeFontHeight: l,
    marginXS: s,
    badgeRibbonOffset: t,
    calc: n
  } = r, o = `${e}-ribbon`, p = `${e}-ribbon-wrapper`, b = C(r, (d, c) => {
    let {
      darkColor: a
    } = c;
    return {
      [`&${o}-color-${d}`]: {
        background: a,
        color: a
      }
    };
  });
  return {
    [`${p}`]: {
      position: "relative"
    },
    [`${o}`]: Object.assign(Object.assign(Object.assign(Object.assign({}, u(r)), {
      position: "absolute",
      top: s,
      padding: `0 ${i(r.paddingXS)}`,
      color: r.colorPrimary,
      lineHeight: i(l),
      whiteSpace: "nowrap",
      backgroundColor: r.colorPrimary,
      borderRadius: r.borderRadiusSM,
      [`${o}-text`]: {
        color: r.colorTextLightSolid
      },
      [`${o}-corner`]: {
        position: "absolute",
        top: "100%",
        width: t,
        height: t,
        color: "currentcolor",
        border: `${i(n(t).div(2).equal())} solid`,
        transform: r.badgeRibbonCornerTransform,
        transformOrigin: "top",
        filter: r.badgeRibbonCornerFilter
      }
    }), b), {
      [`&${o}-placement-end`]: {
        insetInlineEnd: n(t).mul(-1).equal(),
        borderEndEndRadius: 0,
        [`${o}-corner`]: {
          insetInlineEnd: 0,
          borderInlineEndColor: "transparent",
          borderBlockEndColor: "transparent"
        }
      },
      [`&${o}-placement-start`]: {
        insetInlineStart: n(t).mul(-1).equal(),
        borderEndStartRadius: 0,
        [`${o}-corner`]: {
          insetInlineStart: 0,
          borderBlockEndColor: "transparent",
          borderInlineStartColor: "transparent"
        }
      },
      // ====================== RTL =======================
      "&-rtl": {
        direction: "rtl"
      }
    })
  };
}, F = f(["Badge", "Ribbon"], (r) => {
  const e = m(r);
  return $(e);
}, g);
export {
  F as default
};
