var o=new Set;function lockBodyScrolling(t){if(o.add(t),!document.body.classList.contains("sl-scroll-lock")){const o=function getScrollbarWidth(){const o=document.documentElement.clientWidth;return Math.abs(window.innerWidth-o)}();document.body.classList.add("sl-scroll-lock"),document.body.style.setProperty("--sl-scroll-lock-size",`${o}px`)}}function unlockBodyScrolling(t){o.delete(t),0===o.size&&(document.body.classList.remove("sl-scroll-lock"),document.body.style.removeProperty("--sl-scroll-lock-size"))}function scrollIntoView(o,t,l="vertical",e="smooth"){const c=function getOffset(o,t){return{top:Math.round(o.getBoundingClientRect().top-t.getBoundingClientRect().top),left:Math.round(o.getBoundingClientRect().left-t.getBoundingClientRect().left)}}(o,t),n=c.top+t.scrollTop,i=c.left+t.scrollLeft,s=t.scrollLeft,r=t.scrollLeft+t.offsetWidth,d=t.scrollTop,f=t.scrollTop+t.offsetHeight;"horizontal"!==l&&"both"!==l||(i<s?t.scrollTo({left:i,behavior:e}):i+o.clientWidth>r&&t.scrollTo({left:i-t.offsetWidth+o.clientWidth,behavior:e})),"vertical"!==l&&"both"!==l||(n<d?t.scrollTo({top:n,behavior:e}):n+o.clientHeight>f&&t.scrollTo({top:n-t.offsetHeight+o.clientHeight,behavior:e}))}export{lockBodyScrolling,unlockBodyScrolling,scrollIntoView};