import "../../../../rc-menu/es/index.mjs";
import * as l from "react";
import p from "../MenuDivider.mjs";
import y from "../MenuItem.mjs";
import s from "../SubMenu.mjs";
import b from "../../../../rc-menu/es/MenuItemGroup.mjs";
var O = globalThis && globalThis.__rest || function(e, n) {
  var o = {};
  for (var r in e)
    Object.prototype.hasOwnProperty.call(e, r) && n.indexOf(r) < 0 && (o[r] = e[r]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
    for (var t = 0, r = Object.getOwnPropertySymbols(e); t < r.length; t++)
      n.indexOf(r[t]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[t]) && (o[r[t]] = e[r[t]]);
  return o;
};
function m(e) {
  return (e || []).map((n, o) => {
    if (n && typeof n == "object") {
      const r = n, {
        label: t,
        children: a,
        key: c,
        type: f
      } = r, i = O(r, ["label", "children", "key", "type"]), u = c ?? `tmp-${o}`;
      return a || f === "group" ? f === "group" ? /* @__PURE__ */ l.createElement(b, Object.assign({
        key: u
      }, i, {
        title: t
      }), m(a)) : /* @__PURE__ */ l.createElement(s, Object.assign({
        key: u
      }, i, {
        title: t
      }), m(a)) : f === "divider" ? /* @__PURE__ */ l.createElement(p, Object.assign({
        key: u
      }, i)) : /* @__PURE__ */ l.createElement(y, Object.assign({
        key: u
      }, i), t);
    }
    return null;
  }).filter((n) => n);
}
function k(e) {
  return l.useMemo(() => e && m(e), [e]);
}
export {
  k as default
};
