function i(o,t){return{top:Math.round(o.getBoundingClientRect().top-t.getBoundingClientRect().top),left:Math.round(o.getBoundingClientRect().left-t.getBoundingClientRect().left)}}var f=new Set;function m(){let o=document.documentElement.clientWidth;return Math.abs(window.innerWidth-o)}function T(o){if(f.add(o),!document.body.classList.contains("sd-scroll-lock")){let t=m();document.body.classList.add("sd-scroll-lock"),document.body.style.setProperty("--sd-scroll-lock-size",`${t}px`)}}function L(o){f.delete(o),f.size===0&&(document.body.classList.remove("sd-scroll-lock"),document.body.style.removeProperty("--sd-scrollbar-width"))}function y(o,t,l="vertical",s="smooth"){let d=i(o,t),e=d.top+t.scrollTop,c=d.left+t.scrollLeft,n=t.scrollLeft,r=t.scrollLeft+t.offsetWidth,u=t.scrollTop,h=t.scrollTop+t.offsetHeight;(l==="horizontal"||l==="both")&&(c<n?t.scrollTo({left:c,behavior:s}):c+o.clientWidth>r&&t.scrollTo({left:c-t.offsetWidth+o.clientWidth,behavior:s})),(l==="vertical"||l==="both")&&(e<u?t.scrollTo({top:e,behavior:s}):e+o.clientHeight>h&&t.scrollTo({top:e-t.offsetHeight+o.clientHeight,behavior:s}))}export{T as a,L as b,y as c};
