import P from "../../../@ant-design/icons/es/icons/DownOutlined.mjs";
import * as n from "react";
import "../config-provider/index.mjs";
import w from "../dropdown/dropdown.mjs";
import B from "./BreadcrumbSeparator.mjs";
import { renderItem as _ } from "./useItemRender.mjs";
import { devUseWarning as I } from "../_util/warning.mjs";
import { ConfigContext as D } from "../config-provider/context.mjs";
var b = globalThis && globalThis.__rest || function(r, l) {
  var o = {};
  for (var e in r)
    Object.prototype.hasOwnProperty.call(r, e) && l.indexOf(e) < 0 && (o[e] = r[e]);
  if (r != null && typeof Object.getOwnPropertySymbols == "function")
    for (var t = 0, e = Object.getOwnPropertySymbols(r); t < e.length; t++)
      l.indexOf(e[t]) < 0 && Object.prototype.propertyIsEnumerable.call(r, e[t]) && (o[e[t]] = r[e[t]]);
  return o;
};
const N = (r) => {
  const {
    prefixCls: l,
    separator: o = "/",
    children: e,
    menu: t,
    overlay: a,
    dropdownProps: i,
    href: h
  } = r;
  process.env.NODE_ENV !== "production" && I("Breadcrumb.Item").deprecated(!("overlay" in r), "overlay", "menu");
  const s = ((m) => {
    if (t || a) {
      const c = Object.assign({}, i);
      if (t) {
        const g = t || {}, {
          items: u
        } = g, E = b(g, ["items"]);
        c.menu = Object.assign(Object.assign({}, E), {
          items: u == null ? void 0 : u.map((O, x) => {
            var {
              key: f,
              title: j,
              label: p,
              path: y
            } = O, C = b(O, ["key", "title", "label", "path"]);
            let d = p ?? j;
            return y && (d = /* @__PURE__ */ n.createElement("a", {
              href: `${h}${y}`
            }, d)), Object.assign(Object.assign({}, C), {
              key: f ?? x,
              label: d
            });
          })
        });
      } else
        a && (c.overlay = a);
      return /* @__PURE__ */ n.createElement(w, Object.assign({
        placement: "bottom"
      }, c), /* @__PURE__ */ n.createElement("span", {
        className: `${l}-overlay-link`
      }, m, /* @__PURE__ */ n.createElement(P, null)));
    }
    return m;
  })(e);
  return s != null ? /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement("li", null, s), o && /* @__PURE__ */ n.createElement(B, null, o)) : null;
}, v = (r) => {
  const {
    prefixCls: l,
    children: o,
    href: e
  } = r, t = b(r, ["prefixCls", "children", "href"]), {
    getPrefixCls: a
  } = n.useContext(D), i = a("breadcrumb", l);
  return /* @__PURE__ */ n.createElement(N, Object.assign({}, t, {
    prefixCls: i
  }), _(i, t, o, e));
};
v.__ANT_BREADCRUMB_ITEM = !0;
const z = v;
export {
  N as InternalBreadcrumbItem,
  z as default
};
