import { isHTMLElement } from './is-element.mjs'; function isScrollParent(el) { const win = el.ownerDocument.defaultView || window; const { overflow, overflowX, overflowY } = win.getComputedStyle(el); return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX); } function getParent(el) { if (el.localName === "html") return el; return el.assignedSlot || el.parentElement || el.ownerDocument.documentElement; } function getScrollParent(el) { if (["html", "body", "#document"].includes(el.localName)) { return el.ownerDocument.body; } if (isHTMLElement(el) && isScrollParent(el)) { return el; } return getScrollParent(getParent(el)); } export { getScrollParent };