import * as s from "react";
function k(r, v, u, f, o, t, n) {
  r.push({
    record: v,
    indent: u,
    index: n
  });
  var l = t(v), A = o == null ? void 0 : o.has(l);
  if (v && Array.isArray(v[f]) && A)
    for (var i = 0; i < v[f].length; i += 1)
      k(r, v[f][i], u + 1, f, o, t, i);
}
function z(r, v, u, f) {
  var o = s.useMemo(function() {
    if (u != null && u.size) {
      for (var t = [], n = 0; n < (r == null ? void 0 : r.length); n += 1) {
        var l = r[n];
        k(t, l, 0, v, u, f, n);
      }
      return t;
    }
    return r == null ? void 0 : r.map(function(A, i) {
      return {
        record: A,
        indent: 0,
        index: i
      };
    });
  }, [r, v, u, f]);
  return o;
}
export {
  z as default
};
