var getScrollParent=function(t){if(t===null){return null}if(t.classList.contains("element_scrolled")||(t===null||t===void 0?void 0:t.tagName)==="BODY"){return t}else{return getScrollParent(t.offsetParent)}};function positionElement(t){var e=t.actionElement,o=t.changedElement,i=t.intoView;var n=i?i:document.body;var f=n.offsetParent;var l=!!n.classList.contains("element_scrolled");var s=l?e.offsetTop-n.scrollTop+f.offsetTop:e.offsetTop-window.scrollY;var r=l?e.offsetLeft+f.offsetLeft:e.offsetLeft;var d=(o===null||o===void 0?void 0:o.offsetHeight)>window.innerHeight-s?s-(o===null||o===void 0?void 0:o.offsetHeight)-16:s+(e===null||e===void 0?void 0:e.offsetHeight)+16;var a=(o===null||o===void 0?void 0:o.offsetWidth)>window.innerWidth-r?r+(e===null||e===void 0?void 0:e.offsetWidth)-(o===null||o===void 0?void 0:o.offsetWidth):r;var v=window.innerHeight-(o===null||o===void 0?void 0:o.offsetHeight);var h=window.innerWidth-(o===null||o===void 0?void 0:o.offsetWidth);var u={top:d<8?8:d>v?v-8:d,left:a<0?0:a>h?h:a};return u}function positionAbsoluteElement(t){var e=t.actionElement,o=t.changedElement,i=t.intoView;var n=i?i:document.body;var f=n.offsetHeight<o.offsetHeight?window.screen.height:n.offsetHeight;var l=n.offsetWidth<o.offsetWidth?window.screen.width:n.offsetWidth;var s=f-e.offsetTop;var r=l-e.offsetLeft;var d={y:s<o.offsetHeight+e.offsetHeight?"top":"bottom",x:r<o.offsetWidth?"right":"left"};return d}export{positionElement as a,getScrollParent as g,positionAbsoluteElement as p};