import { isHTMLElement as u, isElement as n } from "./index-instanceOf.js";
import { round as g } from "./index-math.js";
import l from "./index-getWindow.js";
import m from "./index-isLayoutViewport.js";
function R(t, f, r) {
  f === void 0 && (f = !1), r === void 0 && (r = !1);
  var i = t.getBoundingClientRect(), h = 1, s = 1;
  f && u(t) && (h = t.offsetWidth > 0 && g(i.width) / t.offsetWidth || 1, s = t.offsetHeight > 0 && g(i.height) / t.offsetHeight || 1);
  var w = n(t) ? l(t) : window, o = w.visualViewport, d = !m() && r, a = (i.left + (d && o ? o.offsetLeft : 0)) / h, v = (i.top + (d && o ? o.offsetTop : 0)) / s, e = i.width / h, p = i.height / s;
  return {
    width: e,
    height: p,
    top: v,
    right: a + e,
    bottom: v + p,
    left: a,
    x: a,
    y: v
  };
}
export {
  R as default
};
