import i from "../../../@babel/runtime/helpers/esm/extends.mjs";
import d from "../../../@babel/runtime/helpers/esm/objectWithoutProperties.mjs";
import v from "../../../@babel/runtime/helpers/esm/typeof.mjs";
import * as n from "react";
import k from "../MenuItemGroup.mjs";
import E from "../SubMenu/index.mjs";
import I from "../Divider.mjs";
import b from "../MenuItem.mjs";
import { parseChildren as h } from "./commonUtil.mjs";
var x = ["label", "children", "key", "type"];
function p(m) {
  return (m || []).map(function(t, u) {
    if (t && v(t) === "object") {
      var r = t, c = r.label, f = r.children, a = r.key, l = r.type, e = d(r, x), o = a ?? "tmp-".concat(u);
      return f || l === "group" ? l === "group" ? /* @__PURE__ */ n.createElement(k, i({
        key: o
      }, e, {
        title: c
      }), p(f)) : /* @__PURE__ */ n.createElement(E, i({
        key: o
      }, e, {
        title: c
      }), p(f)) : l === "divider" ? /* @__PURE__ */ n.createElement(I, i({
        key: o
      }, e)) : /* @__PURE__ */ n.createElement(b, i({
        key: o
      }, e), c);
    }
    return null;
  }).filter(function(t) {
    return t;
  });
}
function R(m, t, u) {
  var r = m;
  return t && (r = p(t)), h(r, u);
}
export {
  R as parseItems
};
