import { canUseDom as r } from "./can-use-dom.mjs";
const l = r ? window : void 0, i = ["scroll", "auto", "overlay"];
function c(n) {
  return n.nodeType === 1;
}
function u(n, t = l) {
  let e = n;
  for (; e && e !== t && c(e); ) {
    if (e === document.body)
      return t;
    const {
      overflowY: o
    } = window.getComputedStyle(e);
    if (i.includes(o) && e.scrollHeight > e.clientHeight)
      return e;
    e = e.parentNode;
  }
  return t;
}
export {
  u as getScrollParent
};
