import { useState as s } from "react";
import { isEqual as E } from "es-toolkit/compat";
const d = (e, i) => {
  const [t, o] = s(e), [l, a] = s(e);
  return E(e, l) || (o(e), a(e)), {
    internalExpandedGroups: t,
    handleToggleNode: (n) => {
      if (!t)
        return;
      const r = t.includes(n) ? t.filter((u) => u !== n) : [...t, n];
      o(r), i?.(r);
    }
  };
};
export {
  d as useTreeExpansion
};
//# sourceMappingURL=useTreeExpansion.js.map
