import{b as balBrowser}from"./browser-B1u-Mq75.js";var BalScrollHandler=function(){function n(){this.x=undefined;this.y=undefined;this.disabled=false}n.disableSmoothScrolling=function(){this.setScrollBehavior("auto")};n.enableSmoothScrolling=function(){this.setScrollBehavior("smooth")};n.setScrollBehavior=function(n){var o;if(balBrowser.hasDocument){var t=document;var i=document.body;i.style.scrollBehavior=n;var e=(o=t.firstChild)===null||o===void 0?void 0:o.nextSibling;var s=getComputedStyle(e);if(s.scrollBehavior==="smooth"){e.style.scrollBehavior=n}}};n.prototype.connect=function(n){if(n){this.target=n}else{if(balBrowser.hasDocument){this.target=document}}onscroll=null;onkeydown=null};n.prototype.disconnect=function(){if(this.disabled){this.enable()}this.target=undefined;onscroll=null;onkeydown=null};n.prototype.isDisabled=function(){return this.disabled};n.prototype.enable=function(){if(this.target){if(balBrowser.hasWindow&&balBrowser.hasDocument){document.documentElement.style.overflow="";document.body.classList.remove("noscroll");document.body.style.position="";document.body.style.top="";document.body.style.width="";if(this.x!==undefined&&this.y!==undefined){window.scrollTo(this.x,this.y);this.x=undefined;this.y=undefined}this.disabled=false}}};n.prototype.disable=function(){if(!this.disabled&&this.target){if(balBrowser.hasWindow&&balBrowser.hasDocument){this.x=window.pageXOffset||document.documentElement.scrollLeft;this.y=window.pageYOffset||document.documentElement.scrollTop;document.documentElement.style.overflow="hidden";document.body.classList.add("noscroll");document.body.style.position="fixed";document.body.style.top="-".concat(this.y,"px");document.body.style.width="100%";this.disabled=true}}};return n}();export{BalScrollHandler as B};