1var k=Object.defineProperty;var x=(t,i,e)=>i in t?k(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e;var s=(t,i,e)=>x(t,typeof i!="symbol"?i+"":i,e);var N="1.3.18";function W(t,i,e){return Math.max(t,Math.min(i,e))}function D(t,i,e){return(1-e)*t+e*i}function X(t,i,e,r){return D(t,i,1-Math.exp(-e*r))}function Y(t,i){return(t%i+i)%i}var C=class{constructor(){s(this,"isRunning",!1);s(this,"value",0);s(this,"from",0);s(this,"to",0);s(this,"currentTime",0);s(this,"lerp");s(this,"duration");s(this,"easing");s(this,"onUpdate")}advance(t){if(!this.isRunning)return;let i=!1;if(this.duration&&this.easing){this.currentTime+=t;const e=W(0,this.currentTime/this.duration,1);i=e>=1;const r=i?1:this.easing(e);this.value=this.from+(this.to-this.from)*r}else this.lerp?(this.value=X(this.value,this.to,this.lerp*60,t),Math.round(this.value)===this.to&&(this.value=this.to,i=!0)):(this.value=this.to,i=!0);i&&this.stop(),this.onUpdate?.(this.value,i)}stop(){this.isRunning=!1}fromTo(t,i,{lerp:e,duration:r,easing:o,onStart:a,onUpdate:h}){this.from=this.value=t,this.to=i,this.lerp=e,this.duration=r,this.easing=o,this.currentTime=0,this.isRunning=!0,a?.(),this.onUpdate=h}};function A(t,i){let e;return function(...r){clearTimeout(e),e=setTimeout(()=>{e=void 0,t.apply(this,r)},i)}}var P=class{constructor(t,i,{autoResize:e=!0,debounce:r=250}={}){s(this,"width",0);s(this,"height",0);s(this,"scrollHeight",0);s(this,"scrollWidth",0);s(this,"debouncedResize");s(this,"wrapperResizeObserver");s(this,"contentResizeObserver");s(this,"resize",()=>{this.onWrapperResize(),this.onContentResize()});s(this,"onWrapperResize",()=>{this.wrapper instanceof Window?(this.width=window.innerWidth,this.height=window.innerHeight):(this.width=this.wrapper.clientWidth,this.height=this.wrapper.clientHeight)});s(this,"onContentResize",()=>{this.wrapper instanceof Window?(this.scrollHeight=this.content.scrollHeight,this.scrollWidth=this.content.scrollWidth):(this.scrollHeight=this.wrapper.scrollHeight,this.scrollWidth=this.wrapper.scrollWidth)});this.wrapper=t,this.content=i,e&&(this.debouncedResize=A(this.resize,r),this.wrapper instanceof Window?window.addEventListener("resize",this.debouncedResize):(this.wrapperResizeObserver=new ResizeObserver(this.debouncedResize),this.wrapperResizeObserver.observe(this.wrapper)),this.contentResizeObserver=new ResizeObserver(this.debouncedResize),this.contentResizeObserver.observe(this.content)),this.resize()}destroy(){this.wrapperResizeObserver?.disconnect(),this.contentResizeObserver?.disconnect(),this.wrapper===window&&this.debouncedResize&&window.removeEventListener("resize",this.debouncedResize)}get limit(){return{x:this.scrollWidth-this.width,y:this.scrollHeight-this.height}}},H=class{constructor(){s(this,"events",{})}emit(t,...i){const e=this.events[t]||[];for(let r=0,o=e.length;r<o;r++)e[r]?.(...i)}on(t,i){return this.events[t]?this.events[t].push(i):this.events[t]=[i],()=>{this.events[t]=this.events[t]?.filter(e=>i!==e)}}off(t,i){this.events[t]=this.events[t]?.filter(e=>i!==e)}destroy(){this.events={}}},V=100/6,g={passive:!1};function O(t,i){return t===1?V:t===2?i:1}var I=class{constructor(t,i={wheelMultiplier:1,touchMultiplier:1}){s(this,"touchStart",{x:0,y:0});s(this,"lastDelta",{x:0,y:0});s(this,"window",{width:0,height:0});s(this,"emitter",new H);s(this,"onTouchStart",t=>{const{clientX:i,clientY:e}=t.targetTouches?t.targetTouches[0]:t;this.touchStart.x=i,this.touchStart.y=e,this.lastDelta={x:0,y:0},this.emitter.emit("scroll",{deltaX:0,deltaY:0,event:t})});s(this,"onTouchMove",t=>{const{clientX:i,clientY:e}=t.targetTouches?t.targetTouches[0]:t,r=-(i-this.touchStart.x)*this.options.touchMultiplier,o=-(e-this.touchStart.y)*this.options.touchMultiplier;this.touchStart.x=i,this.touchStart.y=e,this.lastDelta={x:r,y:o},this.emitter.emit("scroll",{deltaX:r,deltaY:o,event:t})});s(this,"onTouchEnd",t=>{this.emitter.emit("scroll",{deltaX:this.lastDelta.x,deltaY:this.lastDelta.y,event:t})});s(this,"onWheel",t=>{let{deltaX:i,deltaY:e,deltaMode:r}=t;const o=O(r,this.window.width),a=O(r,this.window.height);i*=o,e*=a,i*=this.options.wheelMultiplier,e*=this.options.wheelMultiplier,this.emitter.emit("scroll",{deltaX:i,deltaY:e,event:t})});s(this,"onWindowResize",()=>{this.window={width:window.innerWidth,height:window.innerHeight}});this.element=t,this.options=i,window.addEventListener("resize",this.onWindowResize),this.onWindowResize(),this.element.addEventListener("wheel",this.onWheel,g),this.element.addEventListener("touchstart",this.onTouchStart,g),this.element.addEventListener("touchmove",this.onTouchMove,g),this.element.addEventListener("touchend",this.onTouchEnd,g)}on(t,i){return this.emitter.on(t,i)}destroy(){this.emitter.destroy(),window.removeEventListener("resize",this.onWindowResize),this.element.removeEventListener("wheel",this.onWheel,g),this.element.removeEventListener("touchstart",this.onTouchStart,g),this.element.removeEventListener("touchmove",this.onTouchMove,g),this.element.removeEventListener("touchend",this.onTouchEnd,g)}},R=t=>Math.min(1,1.001-2**(-10*t)),U=class{constructor({wrapper:t=window,content:i=document.documentElement,eventsTarget:e=t,smoothWheel:r=!0,syncTouch:o=!1,syncTouchLerp:a=.075,touchInertiaExponent:h=1.7,duration:c,easing:u,lerp:d=.1,infinite:w=!1,orientation:m="vertical",gestureOrientation:l=m==="horizontal"?"both":"vertical",touchMultiplier:p=1,wheelMultiplier:n=1,autoResize:S=!0,prevent:v,virtualScroll:f,overscroll:E=!0,autoRaf:T=!1,anchors:b=!1,autoToggle:z=!1,allowNestedScroll:L=!1,__experimental__naiveDimensions:y=!1,naiveDimensions:_=y,stopInertiaOnNavigate:M=!1}={}){s(this,"_isScrolling",!1);s(this,"_isStopped",!1);s(this,"_isLocked",!1);s(this,"_preventNextNativeScrollEvent",!1);s(this,"_resetVelocityTimeout",null);s(this,"_rafId",null);s(this,"isTouching");s(this,"time",0);s(this,"userData",{});s(this,"lastVelocity",0);s(this,"velocity",0);s(this,"direction",0);s(this,"options");s(this,"targetScroll");s(this,"animatedScroll");s(this,"animate",new C);s(this,"emitter",new H);s(this,"dimensions");s(this,"virtualScroll");s(this,"onScrollEnd",t=>{t instanceof CustomEvent||(this.isScrolling==="smooth"||this.isScrolling===!1)&&t.stopPropagation()});s(this,"dispatchScrollendEvent",()=>{this.options.wrapper.dispatchEvent(new CustomEvent("scrollend",{bubbles:this.options.wrapper===window,detail:{lenisScrollEnd:!0}}))});s(this,"onTransitionEnd",t=>{t.propertyName.includes("overflow")&&this.checkOverflow()});s(this,"onClick",t=>{const e=t.composedPath().filter(r=>r instanceof HTMLAnchorElement&&r.getAttribute("href"));if(this.options.anchors){const r=e.find(o=>o.getAttribute("href")?.includes("#"));if(r){const o=r.getAttribute("href");if(o){const a=typeof this.options.anchors=="object"&&this.options.anchors?this.options.anchors:void 0,h=`#${o.split("#")[1]}`;this.scrollTo(h,a)}}}this.options.stopInertiaOnNavigate&&e.find(o=>o.host===window.location.host)&&this.reset()});s(this,"onPointerDown",t=>{t.button===1&&this.reset()});s(this,"onVirtualScroll",t=>{if(typeof this.options.virtualScroll=="function"&&this.options.virtualScroll(t)===!1)return;const{deltaX:i,deltaY:e,event:r}=t;if(this.emitter.emit("virtual-scroll",{deltaX:i,deltaY:e,event:r}),r.ctrlKey||r.lenisStopPropagation)return;const o=r.type.includes("touch"),a=r.type.includes("wheel");this.isTouching=r.type==="touchstart"||r.type==="touchmove";
vendor: 10,652 bytes, line 1
1const h=i===0&&e===0;if(this.options.syncTouch&&o&&r.type==="touchstart"&&h&&!this.isStopped&&!this.isLocked){this.reset();return}const u=this.options.gestureOrientation==="vertical"&&e===0||this.options.gestureOrientation==="horizontal"&&i===0;if(h||u)return;let d=r.composedPath();d=d.slice(0,d.indexOf(this.rootElement));const w=this.options.prevent,m=Math.abs(i)>=Math.abs(e)?"horizontal":"vertical";if(d.find(f=>f instanceof HTMLElement&&(typeof w=="function"&&w?.(f)||f.hasAttribute?.("data-lenis-prevent")||m==="vertical"&&f.hasAttribute?.("data-lenis-prevent-vertical")||m==="horizontal"&&f.hasAttribute?.("data-lenis-prevent-horizontal")||o&&f.hasAttribute?.("data-lenis-prevent-touch")||a&&f.hasAttribute?.("data-lenis-prevent-wheel")||this.options.allowNestedScroll&&this.hasNestedScroll(f,{deltaX:i,deltaY:e}))))return;if(this.isStopped||this.isLocked){r.cancelable&&r.preventDefault();return}if(!(this.options.syncTouch&&o||this.options.smoothWheel&&a)){this.isScrolling="native",this.animate.stop(),r.lenisStopPropagation=!0;return}let p=e;this.options.gestureOrientation==="both"?p=Math.abs(e)>Math.abs(i)?e:i:this.options.gestureOrientation==="horizontal"&&(p=i),(!this.options.overscroll||this.options.infinite||this.options.wrapper!==window&&this.limit>0&&(this.animatedScroll>0&&this.animatedScroll<this.limit||this.animatedScroll===0&&e>0||this.animatedScroll===this.limit&&e<0))&&(r.lenisStopPropagation=!0),r.cancelable&&r.preventDefault();const n=o&&this.options.syncTouch,v=o&&r.type==="touchend";v&&(p=Math.sign(this.velocity)*Math.abs(this.velocity)**this.options.touchInertiaExponent),this.scrollTo(this.targetScroll+p,{programmatic:!1,...n?{lerp:v?this.options.syncTouchLerp:1}:{lerp:this.options.lerp,duration:this.options.duration,easing:this.options.easing}})});s(this,"onNativeScroll",()=>{if(this._resetVelocityTimeout!==null&&(clearTimeout(this._resetVelocityTimeout),this._resetVelocityTimeout=null),this._preventNextNativeScrollEvent){this._preventNextNativeScrollEvent=!1;return}if(this.isScrolling===!1||this.isScrolling==="native"){const t=this.animatedScroll;this.animatedScroll=this.targetScroll=this.actualScroll,this.lastVelocity=this.velocity,this.velocity=this.animatedScroll-t,this.direction=Math.sign(this.animatedScroll-t),this.isStopped||(this.isScrolling="native"),this.emit(),this.velocity!==0&&(this._resetVelocityTimeout=setTimeout(()=>{this.lastVelocity=this.velocity,this.velocity=0,this.isScrolling=!1,this.emit()},400))}});s(this,"raf",t=>{const i=t-(this.time||t);this.time=t,this.animate.advance(i*.001),this.options.autoRaf&&(this._rafId=requestAnimationFrame(this.raf))});window.lenisVersion=N,window.lenis||(window.lenis={}),window.lenis.version=N,m==="horizontal"&&(window.lenis.horizontal=!0),(!t||t===document.documentElement)&&(t=window),typeof c=="number"&&typeof u!="function"?u=R:typeof u=="function"&&typeof c!="number"&&(c=1),this.options={wrapper:t,content:i,eventsTarget:e,smoothWheel:r,syncTouch:o,syncTouchLerp:a,touchInertiaExponent:h,duration:c,easing:u,lerp:d,infinite:w,gestureOrientation:l,orientation:m,touchMultiplier:p,wheelMultiplier:n,autoResize:S,prevent:v,virtualScroll:f,overscroll:E,autoRaf:T,anchors:b,autoToggle:z,allowNestedScroll:L,naiveDimensions:_,stopInertiaOnNavigate:M},this.dimensions=new P(t,i,{autoResize:S}),this.updateClassName(),this.targetScroll=this.animatedScroll=this.actualScroll,this.options.wrapper.addEventListener("scroll",this.onNativeScroll),this.options.wrapper.addEventListener("scrollend",this.onScrollEnd,{capture:!0}),(this.options.anchors||this.options.stopInertiaOnNavigate)&&this.options.wrapper.addEventListener("click",this.onClick),this.options.wrapper.addEventListener("pointerdown",this.onPointerDown),this.virtualScroll=new I(e,{touchMultiplier:p,wheelMultiplier:n}),this.virtualScroll.on("scroll",this.onVirtualScroll),this.options.autoToggle&&(this.checkOverflow(),this.rootElement.addEventListener("transitionend",this.onTransitionEnd)),this.options.autoRaf&&(this._rafId=requestAnimationFrame(this.raf))}destroy(){this.emitter.destroy(),this.options.wrapper.removeEventListener("scroll",this.onNativeScroll),this.options.wrapper.removeEventListener("scrollend",this.onScrollEnd,{capture:!0}),this.options.wrapper.removeEventListener("pointerdown",this.onPointerDown),(this.options.anchors||this.options.stopInertiaOnNavigate)&&this.options.wrapper.removeEventListener("click",this.onClick),this.virtualScroll.destroy(),this.dimensions.destroy(),this.cleanUpClassName(),this._rafId&&cancelAnimationFrame(this._rafId)}on(t,i){return this.emitter.on(t,i)}off(t,i){return this.emitter.off(t,i)}get overflow(){const t=this.isHorizontal?"overflow-x":"overflow-y";return getComputedStyle(this.rootElement)[t]}checkOverflow(){["hidden","clip"].includes(this.overflow)?this.internalStop():this.internalStart()}setScroll(t){this.isHorizontal?this.options.wrapper.scrollTo({left:t,behavior:"instant"}):this.options.wrapper.scrollTo({top:t,behavior:"instant"})}resize(){this.dimensions.resize(),this.animatedScroll=this.targetScroll=this.actualScroll,this.emit()}emit(){this.emitter.emit("scroll",this)}reset(){this.isLocked=!1,this.isScrolling=!1,this.animatedScroll=this.targetScroll=this.actualScroll,this.lastVelocity=this.velocity=0,this.animate.stop()}start(){if(this.isStopped){if(this.options.autoToggle){this.rootElement.style.removeProperty("overflow");return}this.internalStart()}}internalStart(){this.isStopped&&(this.reset(),this.isStopped=!1,this.emit())}stop(){if(!this.isStopped){if(this.options.autoToggle){this.rootElement.style.setProperty("overflow","clip");return}this.internalStop()}}internalStop(){this.isStopped||(this.reset(),this.isStopped=!0,this.emit())}scrollTo(t,{offset:i=0,immediate:e=!1,lock:r=!1,programmatic:o=!0,lerp:a=o?this.options.lerp:void 0,duration:h=o?this.options.duration:void 0,easing:c=o?this.options.easing:void 0,onStart:u,onComplete:d,force:w=!1,userData:m}={}){if((this.isStopped||this.isLocked)&&!w)return;let l=t,p=i;if(typeof l=="string"&&["top","left","start","#"].includes(l))l=0;else if(typeof l=="string"&&["bottom","right","end"].includes(l))l=this.limit;else{let n=null;if(typeof l=="string"?(n=document.querySelector(l),n||(l==="#top"?l=0:console.warn("Lenis: Target not found",l))):l instanceof HTMLElement&&l?.nodeType&&(n=l),n){if(this.options.wrapper!==window){const v=this.rootElement.getBoundingClientRect();p-=this.isHorizontal?v.left:v.top}const S=n.getBoundingClientRect();l=(this.isHorizontal?S.left:S.top)+this.animatedScroll}}if(typeof l=="number"){if(l+=p,l=Math.round(l),this.options.infinite){if(o){this.targetScroll=this.animatedScroll=this.scroll;const n=l-this.animatedScroll;n>this.limit/2?l-=this.limit:n<-this.limit/2&&(l+=this.limit)}}else l=W(0,l,this.limit);if(l===this.targetScroll){u?.(this),d?.(this);return}if(this.userData=m??{},e){this.animatedScroll=this.targetScroll=l,this.setScroll(this.scroll),this.reset(),this.preventNextNativeScrollEvent(),this.emit(),d?.(this),this.userData={},requestAnimationFrame(()=>{this.dispatchScrollendEvent()});return}o||(this.targetScroll=l),typeof h=="number"&&typeof c!="function"?c=R:typeof c=="function"&&typeof h!="number"&&(h=1),this.animate.fromTo(this.animatedScroll,l,{duration:h,easing:c,lerp:a,onStart:()=>{r&&(this.isLocked=!0),this.isScrolling="smooth",u?.(this)},onUpdate:(n,S)=>{this.isScrolling="smooth",this.lastVelocity=this.velocity,this.velocity=n-this.animatedScroll,this.direction=Math.sign(this.velocity),this.animatedScroll=n,this.setScroll(this.scroll),o&&(this.targetScroll=n),S||this.emit(),S&&(this.reset(),this.emit(),d?.(this),this.userData={},requestAnimationFrame(()=>{this.dispatchScrollendEvent()}),this.preventNextNativeScrollEvent())}})}}preventNextNativeScrollEvent(){this._preventNextNativeScrollEvent=!0,requestAnimationFrame(()=>{this._preventNextNativeScrollEvent=!1})}hasNestedScroll(t,{deltaX:i,deltaY:e}){const r=Date.now();t._lenis||(t._lenis={});const o=t._lenis;let a,h,c,u,d,w,m,l,p,n;if(r-(o.time??0)>2e3){o.time=Date.now();const y=window.getComputedStyle(t);if(o.computedStyle=y,a=["auto","overlay","scroll"].includes(y.overflowX),h=["auto","overlay","scroll"].includes(y.overflowY),d=["auto"].includes(y.overscrollBehaviorX),w=["auto"].includes(y.overscrollBehaviorY),o.hasOverflowX=a,o.hasOverflowY=h,!(a||h))return!1;m=t.scrollWidth,l=t.scrollHeight,p=t.clientWidth,n=t.clientHeight,c=m>p,u=l>n,o.isScrollableX=c,o.isScrollableY=u,o.scrollWidth=m,o.scrollHeight=l,o.clientWidth=p,o.clientHeight=n,o.hasOverscrollBehaviorX=d,o.hasOverscrollBehaviorY=w}else c=o.isScrollableX,u=o.isScrollableY,a=o.hasOverflowX,h=o.hasOverflowY,m=o.scrollWidth,l=o.scrollHeight,p=o.clientWidth,n=o.clientHeight,d=o.hasOverscrollBehaviorX,w=o.hasOverscrollBehaviorY;if(!(a&&c||h&&u))return!1;const S=Math.abs(i)>=Math.abs(e)?"horizontal":"vertical";let v,f,E,T,b,z;if(S==="horizontal")v=Math.round(t.scrollLeft),f=m-p,E=i,T=a,b=c,z=d;else if(S==="vertical")v=Math.round(t.scrollTop),f=l-n,E=e,T=h,b=u,z=w;else return!1;return!z&&(v>=f||v<=0)?!0:(E>0?v<f:v>0)&&T&&b}get rootElement(){return this.options.wrapper===window?document.documentElement:this.options.wrapper}get limit(){return this.options.naiveDimensions?this.isHorizontal?this.rootElement.scrollWidth-this.rootElement.clientWidth:this.rootElement.scrollHeight-this.rootElement.clientHeight:this.dimensions.limit[this.isHorizontal?"x":"y"]}get isHorizontal(){return this.options.orientation==="horizontal"}get actualScroll(){const t=this.options.wrapper;return this.isHorizontal?t.scrollX??t.scrollLeft:t.scrollY??t.scrollTop}get scroll(){return this.options.infinite?Y(this.animatedScroll,this.limit):this.animatedScroll}get progress(){return this.limit===0?1:this.scroll/this.limit}get isScrolling(){return this._isScrolling}set isScrolling(t){this._isScrolling!==t&&(this._isScrolling=t,this.updateClassName())}get isStopped(){return this._isStopped}set isStopped(t){this._isStopped!==t&&(this._isStopped=t,this.updateClassName())}get isLocked(){return this._isLocked}set isLocked(t){this._isLocked!==t&&(this._isLocked=t,this.updateClassName())}get isSmooth(){return this.isScrolling==="smooth"}get className(){let t="lenis";return this.options.autoToggle&&(t+=" lenis-autoToggle"),this.isStopped&&(t+=" lenis-stopped"),this.isLocked&&(t+=" lenis-locked"),this.isScrolling&&(t+=" lenis-scrolling"),this.isScrolling==="smooth"&&(t+=" lenis-smooth"),t}updateClassName(){this.cleanUpClassName(),this.rootElement.className=`${this.rootElement.className} ${this.className}`.trim()}cleanUpClassName(){this.rootElement.className=this.rootElement.className.replace(/lenis(-\w+)?/g,"").trim()}};export{U as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.