1import{B as t}from"./GlobalStylesStore--z5tmrDj.js";import{d as e}from"./defineElement-Bh-rOTph.js";e("animate-parallax",class extends t{_targets=[];getCurrentYTranslation(t){const e=window.getComputedStyle(t),i=e.transform||e.webkitTransform||e.mozTransform;if("none"===i||void 0===i)return 0;return i.match(/matrix.*\((.+)\)/)[1].split(", ")[5]}properties(){return{rootMargin:"0px 0px 0px 0px",threshold:0,isIntersecting:!1,selector:"[parallax]",parallaxYDistance:100,parallaxXDistance:0,enabledQuery:"(min-width: 1024px)",enabled:!0}}connected(){this._matcher=window.matchMedia(this.enabledQuery),this._matcher.matches&&this.initialize()}watch(){return{enabled:()=>{this.enabled?this.initialize():this.destroy()}}}events(){return{window:{resize:()=>{this._matcher.matches?this.initialize():this.destroy()}}}}setIntersectionObserverForTarget(t,e){t.intersectionObserver=new IntersectionObserver(((t,i)=>{t.forEach((t=>{this._targets[e].isIntersecting=t.isIntersecting}))}),{rootMargin:this.rootMargin,threshold:this.threshold}),t.intersectionObserver.observe(t.$element)}getElementMovingTargetDistance(t){return Number(t.dataset.distance??100)}getContainerPositionRelativeToScroll(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window.pageYOffset;switch(t.dataset.containerOrigin){case"top":return e;case"bottom":return e+window.innerHeight;default:return e+window.innerHeight/2}}getCurrentElementPosition(t){const e=t.getBoundingClientRect(),i=this.getCurrentYTranslation(t);let n=window.pageYOffset+e.top;switch(t.dataset.parallaxOrigin){case"top":break;case"bottom":n+=e.height;break;default:n+=e.height/2}return n-i}getParallaxBoundingContainer(t){const{parallaxStart:e,parallaxEnd:i}=t.dataset,n=this.getCurrentElementPosition(t);return{top:n+(e?parseInt(e):this.parallaxYDistance),bottom:n+(i?parseInt(i):this.parallaxYDistance)}}initialHomePositionCorrection(t){const e=this.getContainerPositionRelativeToScroll(t,0)-this.getParallaxBoundingContainer(t).top;return this.getCurrentElementPosition(t)<window.innerHeight?e:Math.max(e,0)}getCorrectedBoundingContainer(t){const e=this.getParallaxBoundingContainer(t.$element);return{top:e.top+t.correction,bottom:e.bottom+t.correction}}destroy(){this._initialized&&(this._initialized=!1,this._targets.forEach((t=>{t.intersectionObserver&&t.intersectionObserver.unobserve(t.$element)})),this._animationInterval&&clearInterval(this._animationInterval),this.stopParallaxListener())}initialize(){if(!this.enabled||this._initialized)return;this._initialized=!0,this._targets=[];this.querySelectorAll(this.selector).forEach(((t,e)=>{const i={$element:t,isIntersecting:void 0,intersectionObserver:void 0,homePosition:this.getCurrentElementPosition(t),correction:this.initialHomePositionCorrection(t),lastScrollCalculation:this.getContainerPositionRelativeToScroll(t),currentTranslation:0};t.style.setProperty("transition","transform 0.2s"),this._targets.push(i),this.setIntersectionObserverForTarget(i,e)})),this.setAnimationInterval(),this.startParallaxListener()}setAnimationInterval(){this._animationInterval=setInterval((()=>{this._hasUpdated&&(this._targets.forEach(((t,e)=>{if(!t.isIntersecting)return;const{$element:i}=t,n=this.getContainerPositionRelativeToScroll(i),r=parseFloat(i.dataset.distance??this.parallaxYDistance),a=parseFloat(i.dataset.distanceHorizontal??this.parallaxXDistance),s=this.getCorrectedBoundingContainer(t),o=n-s.top,l=s.bottom-s.top;const h=Math.min(1,Math.max(-1,o/l)),c=r*h,d=a*h;requestAnimationFrame((()=>{t.$element.style.setProperty("transform",`translate3d(${d}px, ${c}px, 0)`)}))})),this._hasUpdated=!1)}),100)}onScroll(){this._hasUpdated=!0}startParallaxListener(){document.addEventListener("scroll",this.onScroll.bind(this),{passive:!0})}stopParallaxListener(){document.removeEventListener("scroll",this.onScroll.bind(this))}}); 2//# sourceMappingURL=animate-parallax-Rmy-Wx1G.js.map
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.