import { jsx as n } from "react/jsx-runtime";
import M from "react";
import { noop as r } from "es-toolkit/function";
import b from "../../utils/classNames.js";
import x from "../dropdown/DropdownSubmenu.js";
import E from "../selects/DropdownHeader.js";
const k = (l) => {
  const {
    index: i,
    value: e,
    divider: s = !1,
    disabled: o = !1,
    active: m = !1,
    header: d = !1,
    onSelect: c = r,
    closeMenu: a = r,
    onMouseEnter: f = r
  } = l;
  if (M.isValidElement(e) && e.type === x)
    return e;
  const p = s ? "separator" : "presentation", u = b(s && "divider pointer-events-none", o && "disabled", m && "active"), v = (t) => {
    o || (c(i, t), a && a());
  }, h = (t) => {
    o || f(t);
  };
  return d ? /* @__PURE__ */ n(E, { label: e, center: !1 }) : /* @__PURE__ */ n(
    "li",
    {
      role: p,
      className: u,
      onClick: v,
      onMouseEnter: h,
      "data-item-index": i,
      children: /* @__PURE__ */ n("a", { role: "menuitem", children: e })
    }
  );
};
export {
  k as default
};
//# sourceMappingURL=MenuItem.js.map
