import { ROOT_ID as a } from "./constants.es.js";
const I = (o, r) => {
  const s = new Set(r);
  return o.filter((e) => !s.has(e.props.id));
}, h = (o, r) => {
  const s = [], t = new Map(o.map((p) => [p.props.id, p])).get(r);
  function d(p) {
    const i = o.filter((n) => n.props.parentId === p);
    for (const n of i)
      s.push(n.props.id), d(n.props.id);
  }
  return t && d(t.props.id), s;
}, m = (o, r) => {
  const s = [], t = new Map(o.map((p) => [p.props.id, p])).get(r);
  function d(p) {
    const i = o.filter((n) => n.props.parentId === p);
    for (const n of i)
      s.push(n), d(n.props.id);
  }
  return t && d(t.props.id), s;
}, N = (o, r) => {
  const s = [];
  for (const e of o) {
    const t = e.props.parentId;
    typeof t == "string" && (t === a || r.has(t) && s.find((d) => d.id === t)) && s.push({ id: e.props.id, node: e });
  }
  return s.map((e) => e.node);
}, c = (o) => ({
  id: o.props.id,
  level: o.props.level,
  parentId: o.props.parentId,
  extendedId: `${o.props.parentId}/${o.props.id}`,
  nodes: []
}), f = (o = [], r = "__ROOT__") => o.filter((e) => e.props.parentId === r).map((e, t) => ({
  ...c(e),
  nodes: f(o.slice(t + 1), e.props.id)
}));
export {
  c as extractNodeFromElement,
  N as getNodesToRender,
  h as getReactNodeIdsInFlatArray,
  m as getReactNodesInFlatArray,
  f as getTreeNodesWithoutElements,
  I as removeReactNodesFromFlatArray
};
//# sourceMappingURL=nodes.es.js.map
