import { useMemo as y } from "react";
var c = {
  width: 0,
  height: 0,
  left: 0,
  top: 0,
  right: 0
};
function w(i, l, d, f, k, m, h) {
  var t = h.tabs, p = h.tabPosition, s = h.rtl, v, a, r;
  return ["top", "bottom"].includes(p) ? (v = "width", a = s ? "right" : "left", r = Math.abs(d)) : (v = "height", a = "top", r = -d), y(function() {
    if (!t.length)
      return [0, 0];
    for (var e = t.length, u = e, n = 0; n < e; n += 1) {
      var b = i.get(t[n].key) || c;
      if (b[a] + b[v] > r + l) {
        u = n - 1;
        break;
      }
    }
    for (var g = 0, o = e - 1; o >= 0; o -= 1) {
      var x = i.get(t[o].key) || c;
      if (x[a] < r) {
        g = o + 1;
        break;
      }
    }
    return g >= u ? [0, 0] : [g, u];
  }, [i, l, f, k, m, r, p, t.map(function(e) {
    return e.key;
  }).join("_"), s]);
}
export {
  w as default
};
