class BrfScrollSmoother{settings;smoother;constructor(){this.init()}async init(){document.body.classList.contains("brf-backend-view")||this.prepare()}prepare(){switch(this.settings=BRFSCROLLSMOOTHER.toolSettings.find((t=>7==t.id)),this.settings?(this.settings=this.settings.settings,this.settings.provider||(this.settings.provider="gsap")):this.settings={settings:{provider:"gsap",smooth:1,smoothTouch:!1,effects:!1}},this.settings.provider){case"gsap":if(document.body.classList.contains("brf-scroll-smoother-disabled"))return;gsap.registerPlugin(ScrollTrigger,ScrollSmoother),ScrollTrigger.config({ignoreMobileResize:!0}),window.bricksSmoothScroll=()=>!1,document.querySelectorAll("[data-brf-fixed]").forEach((t=>{document.body.append(t)}));!!this.settings.adjustFixedElements&&this.settings.adjustFixedElements&&this.adjustFixedPositions(),this.run(this.settings.provider);break;case"lenis":this.run(this.settings.provider)}}isTouchDevice(){return"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}run(t){switch(t){case"gsap":const t=document.querySelector("#smooth-content"),s=this.settings.smooth?this.settings.smooth:1,e=this.settings.smoothTouch?this.settings.smoothTouch:null,i=!!this.settings.effects&&this.settings.effects,o=this.settings.speed?this.settings.speed:1;if(!e&&this.isTouchDevice())return;let n={smooth:s,effects:i,normalizeScroll:!0,ignoreMobileResize:!0,speed:o};1==e&&(n.smoothTouch=s),this.smoother=ScrollSmoother.create(n);new ResizeObserver((t=>{gsap.delayedCall(.2,(()=>{this.smoother.refresh()}))})).observe(t),window.location.hash&&(window.location.hash.startsWith("/#")&&(window.location.hash=window.location.hash.replace("/#","#")),this.smoother.scrollTo(window.location.hash,!1,"top 50px")),document.querySelectorAll('a[href^="#"]:not([href="#"]), a[href^="/#"]').forEach((t=>{t.addEventListener("click",(t=>{t.preventDefault();let s=t.target.closest("a").getAttribute("href");s.startsWith("/#")&&(s=s.replace("/#","#")),setTimeout((()=>{this.smoother.scrollTo(s,!0,"top 50px")}),55)}))}));break;case"lenis":let r=this.settings.lenisDuration?this.settings.lenisDuration:1.2,h=this.settings.lenisEase?this.settings.lenisEase:"Math.min(1, 1.001 - Math.pow(2, -10 * x))",l=new Function("return (x) => { return  "+h+" }")(),c=this.settings.lenisDirection?this.settings.lenisDirection:"vertical",a=this.settings.lenisGestureDirection?this.settings.lenisGestureDirection:"vertical",u=!!this.settings.lenisSmooth&&this.settings.lenisSmooth,g=this.settings.lenisMouseMultiplier?this.settings.lenisMouseMultiplier:1,d=!!this.settings.lenisSmoothTouch&&this.settings.lenisSmoothTouch,m=this.settings.lenisTouchMultiplier?this.settings.lenisTouchMultiplier:2,f=!!this.settings.lenisInfinite&&this.settings.lenisInfinite,p=!!this.settings.lenisSmoothAnchorScroll&&this.settings.lenisSmoothAnchorScroll,S=this.settings.lenisAnchorScrollOffset?this.settings.lenisAnchorScrollOffset:0;this.smoother=new Lenis({duration:r,easing:t=>l(t),direction:c,gestureDirection:a,wheelMultiplier:g,touchMultiplier:m,smoothWheel:u,smoothTouch:d,infinite:f,prevent:t=>{const s=[],e=["perfmatters-script-manager-wrapper"],i=["consent-skip-blocker"];let o=!1;return t.classList&&s.forEach((s=>{t.classList.contains(s)&&(o=!0)})),t.id&&e.forEach((s=>{t.id==s&&(o=!0)})),t.attributes&&i.forEach((s=>{t.attributes[s]&&(o=!0)})),o}});const w=t=>{this.smoother.raf(t),requestAnimationFrame(w)};requestAnimationFrame(w),window.location.hash&&this.smoother.scrollTo(window.location.hash,{immediate:!1}),p&&document.querySelectorAll('a[href^="#"]:not([href="#"]), a[href^="/#"]').forEach((t=>{t.addEventListener("click",(t=>{t.preventDefault();const s=t.target.closest("a").getAttribute("href"),e=s.includes("/#")?"#"+s.split("/#")[1]:s;this.smoother.scrollTo(e,{immediate:!1,offset:S})}))}))}}adjustFixedPositions(){[].filter.call(document.querySelectorAll("*"),(t=>"fixed"==getComputedStyle(t).position)).forEach((t=>{t.classList.contains("bricks-mobile-menu-wrapper")||document.body.append(t)}))}}var brfScrollSmoother;window.addEventListener("load",(()=>{bricksIsFrontend&&"undefined"!=typeof BRFSCROLLSMOOTHER&&(brfScrollSmoother=new BrfScrollSmoother)}));