import{t as e}from"./rolldown-runtime.DwstSPKI.mjs";import{C as t,E as n,I as r,R as i,c as a,j as o,o as s,s as c}from"./react.DwPO4OJ5.mjs";import{C as l,H as u,r as d}from"./framer.B8DkDI5E.mjs";function f(){return f=Object.assign?Object.assign.bind():function(e){for(var t=1;t{r(),m=class{advance(e){var t;if(!this.isRunning)return;let n=!1;if(this.lerp)this.value=(r=this.value,i=this.to,(1-(a=1-Math.exp(-60*this.lerp*e)))*r+a*i),Math.round(this.value)===this.to&&(this.value=this.to,n=!0);else{this.currentTime+=e;let t=p(0,this.currentTime/this.duration,1);n=t>=1;let r=n?1:this.easing(t);this.value=this.from+(this.to-this.from)*r}var r,i,a;(t=this.onUpdate)==null||t.call(this,this.value,n),n&&this.stop()}stop(){this.isRunning=!1}fromTo(e,t,{lerp:n=.1,duration:r=1,easing:i=(e=>e),onStart:a,onUpdate:o}){this.from=this.value=e,this.to=t,this.lerp=n,this.duration=r,this.easing=i,this.currentTime=0,this.isRunning=!0,a?.(),this.onUpdate=o}},h=class{constructor({wrapper:e,content:t,autoResize:n=!0}={}){if(this.resize=()=>{this.onWrapperResize(),this.onContentResize()},this.onWrapperResize=()=>{this.wrapper===i?(this.width=i.innerWidth,this.height=i.innerHeight):(this.width=this.wrapper.clientWidth,this.height=this.wrapper.clientHeight)},this.onContentResize=()=>{this.scrollHeight=this.content.scrollHeight,this.scrollWidth=this.content.scrollWidth},this.wrapper=e,this.content=t,n){let e=function(e,t){let n;return function(){let t=arguments,r=this;clearTimeout(n),n=setTimeout((function(){e.apply(r,t)}),250)}}(this.resize);this.wrapper!==i&&(this.wrapperResizeObserver=new ResizeObserver(e),this.wrapperResizeObserver.observe(this.wrapper)),this.contentResizeObserver=new ResizeObserver(e),this.contentResizeObserver.observe(this.content)}this.resize()}destroy(){var e,t;(e=this.wrapperResizeObserver)==null||e.disconnect(),(t=this.contentResizeObserver)==null||t.disconnect()}get limit(){return{x:this.scrollWidth-this.width,y:this.scrollHeight-this.height}}},g=class{constructor(){this.events={}}emit(e,...t){let n=this.events[e]||[];for(let e=0,r=n.length;e{this.events[e]=this.events[e]?.filter((e=>t!==e))}}off(e,t){this.events[e]=this.events[e]?.filter((e=>t!==e))}destroy(){this.events={}}},_=class{constructor(e,{wheelMultiplier:t=1,touchMultiplier:n=2,normalizeWheel:r=!1}){this.onTouchStart=e=>{let{clientX:t,clientY:n}=e.targetTouches?e.targetTouches[0]:e;this.touchStart.x=t,this.touchStart.y=n,this.lastDelta={x:0,y:0}},this.onTouchMove=e=>{let{clientX:t,clientY:n}=e.targetTouches?e.targetTouches[0]:e,r=-(t-this.touchStart.x)*this.touchMultiplier,i=-(n-this.touchStart.y)*this.touchMultiplier;this.touchStart.x=t,this.touchStart.y=n,this.lastDelta={x:r,y:i},this.emitter.emit(`scroll`,{deltaX:r,deltaY:i,event:e})},this.onTouchEnd=e=>{this.emitter.emit(`scroll`,{deltaX:this.lastDelta.x,deltaY:this.lastDelta.y,event:e})},this.onWheel=e=>{let{deltaX:t,deltaY:n}=e;this.normalizeWheel&&(t=p(-100,t,100),n=p(-100,n,100)),t*=this.wheelMultiplier,n*=this.wheelMultiplier,this.emitter.emit(`scroll`,{deltaX:t,deltaY:n,event:e})},this.element=e,this.wheelMultiplier=t,this.touchMultiplier=n,this.normalizeWheel=r,this.touchStart={x:null,y:null},this.emitter=new g,this.element.addEventListener(`wheel`,this.onWheel,{passive:!1}),this.element.addEventListener(`touchstart`,this.onTouchStart,{passive:!1}),this.element.addEventListener(`touchmove`,this.onTouchMove,{passive:!1}),this.element.addEventListener(`touchend`,this.onTouchEnd,{passive:!1})}on(e,t){return this.emitter.on(e,t)}destroy(){this.emitter.destroy(),this.element.removeEventListener(`wheel`,this.onWheel,{passive:!1}),this.element.removeEventListener(`touchstart`,this.onTouchStart,{passive:!1}),this.element.removeEventListener(`touchmove`,this.onTouchMove,{passive:!1}),this.element.removeEventListener(`touchend`,this.onTouchEnd,{passive:!1})}},v=class{constructor({wrapper:e=i,content:t=document.documentElement,wheelEventsTarget:n=e,eventsTarget:r=n,smoothWheel:a=!0,smoothTouch:o=!1,syncTouch:s=!1,syncTouchLerp:c=.1,__iosNoInertiaSyncTouchLerp:l=.4,touchInertiaMultiplier:u=35,duration:d,easing:p=(e=>Math.min(1,1.001-2**(-10*e))),lerp:v=!d&&.1,infinite:y=!1,orientation:b=`vertical`,gestureOrientation:x=`vertical`,touchMultiplier:S=1,wheelMultiplier:C=1,normalizeWheel:w=!1,autoResize:T=!0}={}){this.onVirtualScroll=({deltaX:e,deltaY:t,event:n})=>{if(n.ctrlKey)return;let r=n.type.includes(`touch`),i=n.type.includes(`wheel`);if(this.options.gestureOrientation===`both`&&e===0&&t===0||this.options.gestureOrientation===`vertical`&&t===0||this.options.gestureOrientation===`horizontal`&&e===0||r&&this.options.gestureOrientation===`vertical`&&this.scroll===0&&!this.options.infinite&&t<=0)return;let a=n.composedPath();if(a=a.slice(0,a.indexOf(this.rootElement)),a.find((e=>(e.hasAttribute==null?void 0:e.hasAttribute(`data-lenis-prevent`))||r&&(e.hasAttribute==null?void 0:e.hasAttribute(`data-lenis-prevent-touch`))||i&&(e.hasAttribute==null?void 0:e.hasAttribute(`data-lenis-prevent-wheel`))||e.classList?.contains(`lenis`))))return;if(this.isStopped||this.isLocked)return void n.preventDefault();if(this.isSmooth=(this.options.smoothTouch||this.options.syncTouch)&&r||this.options.smoothWheel&&i,!this.isSmooth)return this.isScrolling=!1,void this.animate.stop();n.preventDefault();let o=t;this.options.gestureOrientation===`both`?o=Math.abs(t)>Math.abs(e)?t:e:this.options.gestureOrientation===`horizontal`&&(o=e);let s=r&&this.options.syncTouch,c=r&&n.type===`touchend`&&Math.abs(o)>1;c&&(o=this.velocity*this.options.touchInertiaMultiplier),this.scrollTo(this.targetScroll+o,f({programmatic:!1},s&&{lerp:c?this.syncTouchLerp:this.options.__iosNoInertiaSyncTouchLerp}))},this.onNativeScroll=()=>{if(!this.__preventNextScrollEvent&&!this.isScrolling){let e=this.animatedScroll;this.animatedScroll=this.targetScroll=this.actualScroll,this.velocity=0,this.direction=Math.sign(this.animatedScroll-e),this.emit()}},i.lenisVersion=`1.0.29`,e!==document.documentElement&&e!==document.body||(e=i),this.options={wrapper:e,content:t,wheelEventsTarget:n,eventsTarget:r,smoothWheel:a,smoothTouch:o,syncTouch:s,syncTouchLerp:c,__iosNoInertiaSyncTouchLerp:l,touchInertiaMultiplier:u,duration:d,easing:p,lerp:v,infinite:y,gestureOrientation:x,orientation:b,touchMultiplier:S,wheelMultiplier:C,normalizeWheel:w,autoResize:T},this.animate=new m,this.emitter=new g,this.dimensions=new h({wrapper:e,content:t,autoResize:T}),this.toggleClass(`lenis`,!0),this.velocity=0,this.isLocked=!1,this.isStopped=!1,this.isSmooth=s||a||o,this.isScrolling=!1,this.targetScroll=this.animatedScroll=this.actualScroll,this.options.wrapper.addEventListener(`scroll`,this.onNativeScroll,{passive:!1}),this.virtualScroll=new _(r,{touchMultiplier:S,wheelMultiplier:C,normalizeWheel:w}),this.virtualScroll.on(`scroll`,this.onVirtualScroll)}destroy(){this.emitter.destroy(),this.options.wrapper.removeEventListener(`scroll`,this.onNativeScroll,{passive:!1}),this.virtualScroll.destroy(),this.dimensions.destroy(),this.toggleClass(`lenis`,!1),this.toggleClass(`lenis-smooth`,!1),this.toggleClass(`lenis-scrolling`,!1),this.toggleClass(`lenis-stopped`,!1),this.toggleClass(`lenis-locked`,!1)}on(e,t){return this.emitter.on(e,t)}off(e,t){return this.emitter.off(e,t)}setScroll(e){this.isHorizontal?this.rootElement.scrollLeft=e:this.rootElement.scrollTop=e}resize(){this.dimensions.resize()}emit(){this.emitter.emit(`scroll`,this)}reset(){this.isLocked=!1,this.isScrolling=!1,this.animatedScroll=this.targetScroll=this.actualScroll,this.velocity=0,this.animate.stop()}start(){this.isStopped=!1,this.reset()}stop(){this.isStopped=!0,this.animate.stop(),this.reset()}raf(e){let t=e-(this.time||e);this.time=e,this.animate.advance(.001*t)}scrollTo(e,{offset:t=0,immediate:n=!1,lock:r=!1,duration:a=this.options.duration,easing:o=this.options.easing,lerp:s=!a&&this.options.lerp,onComplete:c=null,force:l=!1,programmatic:u=!0}={}){if(!this.isStopped&&!this.isLocked||l){if([`top`,`left`,`start`].includes(e))e=0;else if([`bottom`,`right`,`end`].includes(e))e=this.limit;else{var d;let n;if(typeof e==`string`?n=document.querySelector(e):(d=e)!=null&&d.nodeType&&(n=e),n){if(this.options.wrapper!==i){let e=this.options.wrapper.getBoundingClientRect();t-=this.isHorizontal?e.left:e.top}let r=n.getBoundingClientRect();e=(this.isHorizontal?r.left:r.top)+this.animatedScroll}}if(typeof e==`number`){if(e+=t,e=Math.round(e),this.options.infinite?u&&(this.targetScroll=this.animatedScroll=this.scroll):e=p(0,e,this.limit),n)return this.animatedScroll=this.targetScroll=e,this.setScroll(this.scroll),this.reset(),void(c==null||c(this));if(!u){if(e===this.targetScroll)return;this.targetScroll=e}this.animate.fromTo(this.animatedScroll,e,{duration:a,easing:o,lerp:s,onStart:()=>{r&&(this.isLocked=!0),this.isScrolling=!0},onUpdate:(e,t)=>{this.isScrolling=!0,this.velocity=e-this.animatedScroll,this.direction=Math.sign(this.velocity),this.animatedScroll=e,this.setScroll(this.scroll),u&&(this.targetScroll=e),t||this.emit(),t&&(this.reset(),this.emit(),c?.(this),this.__preventNextScrollEvent=!0,requestAnimationFrame((()=>{delete this.__preventNextScrollEvent})))}})}}}get rootElement(){return this.options.wrapper===i?document.documentElement:this.options.wrapper}get limit(){return this.dimensions.limit[this.isHorizontal?`x`:`y`]}get isHorizontal(){return this.options.orientation===`horizontal`}get actualScroll(){return this.isHorizontal?this.rootElement.scrollLeft:this.rootElement.scrollTop}get scroll(){return this.options.infinite?(this.animatedScroll%(e=this.limit)+e)%e:this.animatedScroll;var e}get progress(){return this.limit===0?1:this.scroll/this.limit}get isSmooth(){return this.__isSmooth}set isSmooth(e){this.__isSmooth!==e&&(this.__isSmooth=e,this.toggleClass(`lenis-smooth`,e))}get isScrolling(){return this.__isScrolling}set isScrolling(e){this.__isScrolling!==e&&(this.__isScrolling=e,this.toggleClass(`lenis-scrolling`,e))}get isStopped(){return this.__isStopped}set isStopped(e){this.__isStopped!==e&&(this.__isStopped=e,this.toggleClass(`lenis-stopped`,e))}get isLocked(){return this.__isLocked}set isLocked(e){this.__isLocked!==e&&(this.__isLocked=e,this.toggleClass(`lenis-locked`,e))}get className(){let e=`lenis`;return this.isStopped&&(e+=` lenis-stopped`),this.isLocked&&(e+=` lenis-locked`),this.isScrolling&&(e+=` lenis-scrolling`),this.isSmooth&&(e+=` lenis-smooth`),e}toggleClass(e,t){this.rootElement.classList.toggle(e,t),this.emitter.emit(`className change`,this)}}}));function b(e){let{intensity:t}=e,r=n(null);return o(()=>{r.current&&r.current.scrollTo(0,{immediate:!0})},[r]),o(()=>{let e=document.getElementById(`overlay`);if(e){let t=new MutationObserver((t,n)=>{for(let n of t)if(n.type===`childList`&&e.children.length>0){let t=document.documentElement;i.getComputedStyle(t).getPropertyValue(`overflow`)===`hidden`&&e.setAttribute(`data-lenis-prevent`,`true`)}});return t.observe(e,{childList:!0}),()=>t.disconnect()}},[]),o(()=>{let e=document.getElementsByTagName(`*`);for(let t=0;t{r.current=new v({duration:t/10});let e=t=>{r.current&&(r.current.raf(t),requestAnimationFrame(e))};return requestAnimationFrame(e),()=>{r.current&&=(r.current.destroy(),null)}},[]),o(()=>{let e=document.createElement(`style`);return e.textContent=` html.lenis { height: auto; } .lenis.lenis-smooth { scroll-behavior: auto !important; } .lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; } .lenis.lenis-stopped { overflow: hidden; } .lenis.lenis-scrolling iframe { pointer-events: none; } `,document.head.appendChild(e),()=>{document.head.removeChild(e)}},[]),o(()=>{let e=[...document.querySelectorAll(`a[href]`)],t=(e,t)=>{e.preventDefault(),r.current.scrollTo(t)};return e.filter(e=>e.href.includes(`#`)).forEach(e=>{let n=`#${e.href.split(`#`).pop()}`;e.addEventListener(`click`,e=>t(e,n))}),()=>{e.filter(e=>e.href.includes(`#`)).forEach(e=>{e.removeEventListener(`click`,t)})}},[r]),a(c,{})}var x=e((()=>{r(),s(),u(),y(),t(),b.displayName=`Smooth Scroll`,l(b,{intensity:{title:`Intensity`,type:d.Number,defaultValue:10}})}));export{x as n,b as t}; //# sourceMappingURL=Smooth_Scroll.InzzGI_0.mjs.map