1var th=Object.defineProperty,ih=(t,i,e)=>((t,i,e)=>i in t?th(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e)(t,"symbol"!=typeof i?i+"":i,e);function tt(t,i,e){return Math.max(t,Math.min(i,e))}var eh=class{constructor(){ih(this,"isRunning",!1),ih(this,"value",0),ih(this,"from",0),ih(this,"to",0),ih(this,"currentTime",0),ih(this,"lerp"),ih(this,"duration"),ih(this,"easing"),ih(this,"onUpdate")}advance(t){var i;if(!this.isRunning)return;let e=!1;if(this.duration&&this.easing){this.currentTime+=t;const i=tt(0,this.currentTime/this.duration,1);e=i>=1;const s=e?1:this.easing(i);this.value=this.from+(this.to-this.from)*s}else this.lerp?(this.value=function(t,i,e,s){return function(t,i,e){return(1-e)*t+e*i}(t,i,1-Math.exp(-e*s))}(this.value,this.to,60*this.lerp,t),Math.round(this.value)===this.to&&(this.value=this.to,e=!0)):(this.value=this.to,e=!0);e&&this.stop(),null==(i=this.onUpdate)||i.call(this,this.value,e)}stop(){this.isRunning=!1}fromTo(t,i,{lerp:e,duration:s,easing:o,onStart:n,onUpdate:r}){this.from=this.value=t,this.to=i,this.lerp=e,this.duration=s,this.easing=o,this.currentTime=0,this.isRunning=!0,null==n||n(),this.onUpdate=r}};var sh=class{constructor(t,i,{autoResize:e=!0,debounce:s=250}={}){ih(this,"width",0),ih(this,"height",0),ih(this,"scrollHeight",0),ih(this,"scrollWidth",0),ih(this,"debouncedResize"),ih(this,"wrapperResizeObserver"),ih(this,"contentResizeObserver"),ih(this,"resize",()=>{this.onWrapperResize(),this.onContentResize()}),ih(this,"onWrapperResize",()=>{this.wrapper instanceof Window?(this.width=window.innerWidth,this.height=window.innerHeight):(this.width=this.wrapper.clientWidth,this.height=this.wrapper.clientHeight)}),ih(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=function(t,i){let e;return function(...s){let o=this;clearTimeout(e),e=setTimeout(()=>{e=void 0,t.apply(o,s)},i)}}(this.resize,s),this.wrapper instanceof Window?window.addEventListener("resize",this.debouncedResize,!1):(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(){var t,i;null==(t=this.wrapperResizeObserver)||t.disconnect(),null==(i=this.contentResizeObserver)||i.disconnect(),this.wrapper===window&&this.debouncedResize&&window.removeEventListener("resize",this.debouncedResize,!1)}get limit(){return{x:this.scrollWidth-this.width,y:this.scrollHeight-this.height}}},oh=class{constructor(){ih(this,"events",{})}emit(t,...i){var e;let s=this.events[t]||[];for(let t=0,o=s.length;t<o;t++)null==(e=s[t])||e.call(s,...i)}on(t,i){var e;return(null==(e=this.events[t])?void 0:e.push(i))||(this.events[t]=[i]),()=>{var e;this.events[t]=null==(e=this.events[t])?void 0:e.filter(t=>i!==t)}}off(t,i){var e;this.events[t]=null==(e=this.events[t])?void 0:e.filter(t=>i!==t)}destroy(){this.events={}}},nh=100/6,rh={passive:!1},lh=class{constructor(t,i={wheelMultiplier:1,touchMultiplier:1}){ih(this,"touchStart",{x:0,y:0}),ih(this,"lastDelta",{x:0,y:0}),ih(this,"window",{width:0,height:0}),ih(this,"emitter",new oh),ih(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})}),ih(this,"onTouchMove",t=>{const{clientX:i,clientY:e}=t.targetTouches?t.targetTouches[0]:t,s=-(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:s,y:o},this.emitter.emit("scroll",{deltaX:s,deltaY:o,event:t})}),ih(this,"onTouchEnd",t=>{this.emitter.emit("scroll",{deltaX:this.lastDelta.x,deltaY:this.lastDelta.y,event:t})}),ih(this,"onWheel",t=>{let{deltaX:i,deltaY:e,deltaMode:s}=t;i*=1===s?nh:2===s?this.window.width:1,e*=1===s?nh:2===s?this.window.height:1,i*=this.options.wheelMultiplier,e*=this.options.wheelMultiplier,this.emitter.emit("scroll",{deltaX:i,deltaY:e,event:t})}),ih(this,"onWindowResize",()=>{this.window={width:window.innerWidth,height:window.innerHeight}}),this.element=t,this.options=i,window.addEventListener("resize",this.onWindowResize,!1),this.onWindowResize(),this.element.addEventListener("wheel",this.onWheel,rh),this.element.addEventListener("touchstart",this.onTouchStart,rh),this.element.addEventListener("touchmove",this.onTouchMove,rh),this.element.addEventListener("touchend",this.onTouchEnd,rh)}on(t,i){return this.emitter.on(t,i)}destroy(){this.emitter.destroy(),window.removeEventListener("resize",this.onWindowResize,!1),this.element.removeEventListener("wheel",this.onWheel,rh),this.element.removeEventListener("touchstart",this.onTouchStart,rh),this.element.removeEventListener("touchmove",this.onTouchMove,rh),this.element.removeEventListener("touchend",this.onTouchEnd,rh)}},hh=t=>Math.min(1,1.001-Math.pow(2,-10*t)),ah=class{constructor({wrapper:t=window,content:i=document.documentElement,eventsTarget:e=t,smoothWheel:s=!0,syncTouch:o=!1,syncTouchLerp:n=.075,touchInertiaExponent:r=1.7,duration:l,easing:h,lerp:a=.1,infinite:c=!1,orientation:p="vertical",gestureOrientation:u=("horizontal"===p?"both":"vertical"),touchMultiplier:d=1,wheelMultiplier:m=1,autoResize:v=!0,prevent:S,virtualScroll:w,overscroll:g=!0,autoRaf:f=!1,anchors:y=!1,autoToggle:E=!1,allowNestedScroll:T=!1,__experimental__naiveDimensions:b=!1}={}){ih(this,"_isScrolling",!1),ih(this,"_isStopped",!1),ih(this,"_isLocked",!1),ih(this,"_preventNextNativeScrollEvent",!1),ih(this,"_resetVelocityTimeout",null),ih(this,"__rafID",null),ih(this,"isTouching"),ih(this,"time",0),ih(this,"userData",{}),ih(this,"lastVelocity",0),ih(this,"velocity",0),ih(this,"direction",0),ih(this,"options"),ih(this,"targetScroll"),ih(this,"animatedScroll"),ih(this,"animate",new eh),ih(this,"emitter",new oh),ih(this,"dimensions"),ih(this,"virtualScroll"),ih(this,"onScrollEnd",t=>{t instanceof CustomEvent||"smooth"!==this.isScrolling&&!1!==this.isScrolling||t.stopPropagation()}),ih(this,"dispatchScrollendEvent",()=>{this.options.wrapper.dispatchEvent(new CustomEvent("scrollend",{bubbles:this.options.wrapper===window,detail:{lenisScrollEnd:!0}}))}),ih(this,"onTransitionEnd",t=>{if(t.propertyName.includes("overflow")){const t=this.isHorizontal?"overflow-x":"overflow-y",i=getComputedStyle(this.rootElement)[t];["hidden","clip"].includes(i)?this.internalStop():this.internalStart()}}),ih(this,"onClick",t=>{const i=t.composedPath().find(t=>{var i;return t instanceof HTMLAnchorElement&&(null==(i=t.getAttribute("href"))?void 0:i.includes("#"))});if(i){const t=i.getAttribute("href");if(t){const i="object"==typeof this.options.anchors&&this.options.anchors?this.options.anchors:void 0,e=`#${t.split("#")[1]}`;this.scrollTo(e,i)}}}),ih(this,"onPointerDown",t=>{1===t.button&&this.reset()}),ih(this,"onVirtualScroll",t=>{if("function"==typeof this.options.virtualScroll&&!1===this.options.virtualScroll(t))return;const{deltaX:i,deltaY:e,event:s}=t;if(this.emitter.emit("virtual-scroll",{deltaX:i,deltaY:e,event:s}),s.ctrlKey)return;if(s.lenisStopPropagation)return;const o=s.type.includes("touch"),n=s.type.includes("wheel");this.isTouching="touchstart"===s.type||"touchmove"===s.type;const r=0===i&&0===e;if(this.options.syncTouch&&o&&"touchstart"===s.type&&r&&!this.isStopped&&!this.isLocked)return void this.reset();const l="vertical"===this.options.gestureOrientation&&0===e||"horizontal"===this.options.gestureOrientation&&0===i;if(r||l)return;let h=s.composedPath();h=h.slice(0,h.indexOf(this.rootElement));const a=this.options.prevent;if(h.find(t=>{var s,r,l;return t instanceof HTMLElement&&("function"==typeof a&&(null==a?void 0:a(t))||(null==(s=t.hasAttribute)?void 0:s.call(t,"data-lenis-prevent"))||o&&(null==(r=t.hasAttribute)?void 0:r.call(t,"data-lenis-prevent-touch"))||n&&(null==(l=t.hasAttribute)?void 0:l.call(t,"data-lenis-prevent-wheel"))||this.options.allowNestedScroll&&this.checkNestedScroll(t,{deltaX:i,deltaY:e}))}))return;if(this.isStopped||this.isLocked)return void(s.cancelable&&s.preventDefault());if(!(this.options.syncTouch&&o||this.options.smoothWheel&&n))return this.isScrolling="native",this.animate.stop(),void(s.lenisStopPropagation=!0);let c=e;"both"===this.options.gestureOrientation?c=Math.abs(e)>Math.abs(i)?e:i:"horizontal"===this.options.gestureOrientation&&(c=i),(!this.options.overscroll||this.options.infinite||this.options.wrapper!==window&&this.limit>0&&(this.animatedScroll>0&&this.animatedScroll<this.limit||0===this.animatedScroll&&e>0||this.animatedScroll===this.limit&&e<0))&&(s.lenisStopPropagation=!0),s.cancelable&&s.preventDefault();const p=o&&this.options.syncTouch,u=o&&"touchend"===s.type;u&&(c=Math.sign(this.velocity)*Math.pow(Math.abs(this.velocity),this.options.touchInertiaExponent)),this.scrollTo(this.targetScroll+c,{programmatic:!1,...p?{lerp:u?this.options.syncTouchLerp:1}:{lerp:this.options.lerp,duration:this.options.duration,easing:this.options.easing}})}),ih(this,"onNativeScroll",()=>{if(null!==this._resetVelocityTimeout&&(clearTimeout(this._resetVelocityTimeout),this._resetVelocityTimeout=null),this._preventNextNativeScrollEvent)this._preventNextNativeScrollEvent=!1;else if(!1===this.isScrolling||"native"===this.isScrolling){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
1(),0!==this.velocity&&(this._resetVelocityTimeout=setTimeout(()=>{this.lastVelocity=this.velocity,this.velocity=0,this.isScrolling=!1,this.emit()},400))}}),ih(this,"raf",t=>{const i=t-(this.time||t);this.time=t,this.animate.advance(.001*i),this.options.autoRaf&&(this.__rafID=requestAnimationFrame(this.raf))}),window.lenisVersion="1.3.14",t&&t!==document.documentElement||(t=window),"number"==typeof l&&"function"!=typeof h?h=hh:"function"==typeof h&&"number"!=typeof l&&(l=1),this.options={wrapper:t,content:i,eventsTarget:e,smoothWheel:s,syncTouch:o,syncTouchLerp:n,touchInertiaExponent:r,duration:l,easing:h,lerp:a,infinite:c,gestureOrientation:u,orientation:p,touchMultiplier:d,wheelMultiplier:m,autoResize:v,prevent:S,virtualScroll:w,overscroll:g,autoRaf:f,anchors:y,autoToggle:E,allowNestedScroll:T,__experimental__naiveDimensions:b},this.dimensions=new sh(t,i,{autoResize:v}),this.updateClassName(),this.targetScroll=this.animatedScroll=this.actualScroll,this.options.wrapper.addEventListener("scroll",this.onNativeScroll,!1),this.options.wrapper.addEventListener("scrollend",this.onScrollEnd,{capture:!0}),this.options.anchors&&this.options.wrapper===window&&this.options.wrapper.addEventListener("click",this.onClick,!1),this.options.wrapper.addEventListener("pointerdown",this.onPointerDown,!1),this.virtualScroll=new lh(e,{touchMultiplier:d,wheelMultiplier:m}),this.virtualScroll.on("scroll",this.onVirtualScroll),this.options.autoToggle&&this.rootElement.addEventListener("transitionend",this.onTransitionEnd,{passive:!0}),this.options.autoRaf&&(this.__rafID=requestAnimationFrame(this.raf))}destroy(){this.emitter.destroy(),this.options.wrapper.removeEventListener("scroll",this.onNativeScroll,!1),this.options.wrapper.removeEventListener("scrollend",this.onScrollEnd,{capture:!0}),this.options.wrapper.removeEventListener("pointerdown",this.onPointerDown,!1),this.options.anchors&&this.options.wrapper===window&&this.options.wrapper.removeEventListener("click",this.onClick,!1),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)}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(){this.isStopped&&(this.options.autoToggle?this.rootElement.style.removeProperty("overflow"):this.internalStart())}internalStart(){this.isStopped&&(this.reset(),this.isStopped=!1,this.emit())}stop(){this.isStopped||(this.options.autoToggle?this.rootElement.style.setProperty("overflow","clip"):this.internalStop())}internalStop(){this.isStopped||(this.reset(),this.isStopped=!0,this.emit())}scrollTo(t,{offset:i=0,immediate:e=!1,lock:s=!1,duration:o=this.options.duration,easing:n=this.options.easing,lerp:r=this.options.lerp,onStart:l,onComplete:h,force:a=!1,programmatic:c=!0,userData:p}={}){if(!this.isStopped&&!this.isLocked||a){if("string"==typeof t&&["top","left","start","#"].includes(t))t=0;else if("string"==typeof t&&["bottom","right","end"].includes(t))t=this.limit;else{let e;if("string"==typeof t?(e=document.querySelector(t),e||("#top"===t?t=0:console.warn("Lenis: Target not found",t))):t instanceof HTMLElement&&(null==t?void 0:t.nodeType)&&(e=t),e){if(this.options.wrapper!==window){const t=this.rootElement.getBoundingClientRect();i-=this.isHorizontal?t.left:t.top}const s=e.getBoundingClientRect();t=(this.isHorizontal?s.left:s.top)+this.animatedScroll}}if("number"==typeof t){if(t+=i,t=Math.round(t),this.options.infinite){if(c){this.targetScroll=this.animatedScroll=this.scroll;const i=t-this.animatedScroll;i>this.limit/2?t-=this.limit:i<-this.limit/2&&(t+=this.limit)}}else t=tt(0,t,this.limit);if(t===this.targetScroll)return null==l||l(this),void(null==h||h(this));if(this.userData=p??{},e)return this.animatedScroll=this.targetScroll=t,this.setScroll(this.scroll),this.reset(),this.preventNextNativeScrollEvent(),this.emit
vendor: 3,705 bytes, line 1
1(),null==h||h(this),this.userData={},void requestAnimationFrame(()=>{this.dispatchScrollendEvent()});c||(this.targetScroll=t),"number"==typeof o&&"function"!=typeof n?n=hh:"function"==typeof n&&"number"!=typeof o&&(o=1),this.animate.fromTo(this.animatedScroll,t,{duration:o,easing:n,lerp:r,onStart:()=>{s&&(this.isLocked=!0),this.isScrolling="smooth",null==l||l(this)},onUpdate:(t,i)=>{this.isScrolling="smooth",this.lastVelocity=this.velocity,this.velocity=t-this.animatedScroll,this.direction=Math.sign(this.velocity),this.animatedScroll=t,this.setScroll(this.scroll),c&&(this.targetScroll=t),i||this.emit(),i&&(this.reset(),this.emit(),null==h||h(this),this.userData={},requestAnimationFrame(()=>{this.dispatchScrollendEvent()}),this.preventNextNativeScrollEvent())}})}}}preventNextNativeScrollEvent(){this._preventNextNativeScrollEvent=!0,requestAnimationFrame(()=>{this._preventNextNativeScrollEvent=!1})}checkNestedScroll(t,{deltaX:i,deltaY:e}){const s=Date.now(),o=t._lenis??(t._lenis={});let n,r,l,h,a,c,p,u;const d=this.options.gestureOrientation;if(s-(o.time??0)>2e3){o.time=Date.now();const i=window.getComputedStyle(t);o.computedStyle=i;const e=i.overflowX,s=i.overflowY;if(n=["auto","overlay","scroll"].includes(e),r=["auto","overlay","scroll"].includes(s),o.hasOverflowX=n,o.hasOverflowY=r,!n&&!r)return!1;if("vertical"===d&&!r)return!1;if("horizontal"===d&&!n)return!1;a=t.scrollWidth,c=t.scrollHeight,p=t.clientWidth,u=t.clientHeight,l=a>p,h=c>u,o.isScrollableX=l,o.isScrollableY=h,o.scrollWidth=a,o.scrollHeight=c,o.clientWidth=p,o.clientHeight=u}else l=o.isScrollableX,h=o.isScrollableY,n=o.hasOverflowX,r=o.hasOverflowY,a=o.scrollWidth,c=o.scrollHeight,p=o.clientWidth,u=o.clientHeight;if(!n&&!r||!l&&!h)return!1;if(!("vertical"!==d||r&&h))return!1;if(!("horizontal"!==d||n&&l))return!1;let m,v,S,w,g,f;if("horizontal"===d)m="x";else if("vertical"===d)m="y";else{0!==i&&n&&l&&(m="x"),0!==e&&r&&h&&(m="y")}if(!m)return!1;if("x"===m)v=t.scrollLeft,S=a-p,w=i,g=n,f=l;else{if("y"!==m)return!1;v=t.scrollTop,S=c-u,w=e,g=r,f=h}return(w>0?v<S:v>0)&&g&&f}get rootElement(){return this.options.wrapper===window?document.documentElement:this.options.wrapper}get limit(){return this.options.__experimental__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"horizontal"===this.options.orientation}get actualScroll(){const t=this.options.wrapper;return this.isHorizontal?t.scrollX??t.scrollLeft:t.scrollY??t.scrollTop}get scroll(){return this.options.infinite?(t=this.animatedScroll,i=this.limit,(t%i+i)%i):this.animatedScroll;var t,i}get progress(){return 0===this.limit?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"smooth"===this.isScrolling}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"),"smooth"===this.isScrolling&&(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{ah as Lenis};
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.