import g from "../../../@babel/runtime/helpers/esm/slicedToArray.mjs";
import * as z from "react";
function S(u, s, v, i) {
  var l = z.useMemo(function() {
    return [/* @__PURE__ */ new Map(), []];
  }, [u, v.id, i]), m = g(l, 2), a = m[0], n = m[1], p = function(d) {
    var c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : d, r = a.get(d), t = a.get(c);
    if (r === void 0 || t === void 0)
      for (var x = u.length, e = n.length; e < x; e += 1) {
        var f, M = u[e], o = s(M);
        a.set(o, e);
        var b = (f = v.get(o)) !== null && f !== void 0 ? f : i;
        if (n[e] = (n[e - 1] || 0) + b, o === d && (r = e), o === c && (t = e), r !== void 0 && t !== void 0)
          break;
      }
    return {
      top: n[r - 1] || 0,
      bottom: n[t]
    };
  };
  return p;
}
export {
  S as useGetSize
};
