import { ContextMenuShortcut as b, ContextMenuSub as f, ContextMenuSubTrigger as p, ContextMenuSubContent as M, ContextMenuSeparator as S, ContextMenuLabel as g, ContextMenuCheckboxItem as k, ContextMenuItemPrimitive as I } from "../ContextMenuPrimitives.js";
import { jsx as i, jsxs as o } from "react/jsx-runtime";
import { useCallback as $, useMemo as j } from "react";
const v = (C) => {
  const { type: d = "item", label: e, shortcut: u, onClick: t, isDisabled: n, children: l, isSelected: h, onClose: r, inset: c = !0 } = C, m = $(
    (a) => {
      n || (a.stopPropagation(), t == null || t(), r == null || r());
    },
    [t, r, n]
  ), s = j(() => u ? /* @__PURE__ */ i(b, { children: u }) : null, [u]);
  return l && l.length > 0 ? /* @__PURE__ */ o(f, { children: [
    /* @__PURE__ */ o(p, { disabled: n, inset: c, children: [
      e,
      s
    ] }),
    /* @__PURE__ */ i(M, { children: l.map((a, x) => /* @__PURE__ */ i(v, { ...a, onClose: r, inset: !1 }, `${e}-child-${x}`)) })
  ] }) : d === "separator" ? /* @__PURE__ */ i(S, {}) : d === "label" ? /* @__PURE__ */ i(g, { inset: c, children: e }) : h !== void 0 ? /* @__PURE__ */ o(k, { checked: h, onCheckedChange: t, disabled: n, children: [
    e,
    s
  ] }) : /* @__PURE__ */ o(I, { onClick: m, disabled: n, inset: c, children: [
    e,
    s
  ] });
};
export {
  v as default
};
//# sourceMappingURL=ContextMenuItem.js.map
