import * as t from "react";
import o from "../../../classnames/index.mjs";
import { isPresetColor as S } from "../_util/colors.mjs";
import "../config-provider/index.mjs";
import v from "./style/ribbon.mjs";
import { ConfigContext as P } from "../config-provider/context.mjs";
const i = (m) => {
  const {
    className: p,
    prefixCls: f,
    style: C,
    color: s,
    children: b,
    text: d,
    placement: N = "end",
    rootClassName: x
  } = m, {
    getPrefixCls: $,
    direction: u
  } = t.useContext(P), e = $("ribbon", f), r = `${e}-wrapper`, [y, c, E] = v(e, r), l = S(s, !1), g = o(e, `${e}-placement-${N}`, {
    [`${e}-rtl`]: u === "rtl",
    [`${e}-color-${s}`]: l
  }, p), n = {}, a = {};
  return s && !l && (n.background = s, a.color = s), y(/* @__PURE__ */ t.createElement("div", {
    className: o(r, x, c, E)
  }, b, /* @__PURE__ */ t.createElement("div", {
    className: o(g, c),
    style: Object.assign(Object.assign({}, n), C)
  }, /* @__PURE__ */ t.createElement("span", {
    className: `${e}-text`
  }, d), /* @__PURE__ */ t.createElement("div", {
    className: `${e}-corner`,
    style: a
  }))));
};
process.env.NODE_ENV !== "production" && (i.displayName = "Ribbon");
const j = i;
export {
  j as default
};
