"use strict";(globalThis.webpackChunk_websiteComponents=globalThis.webpackChunk_websiteComponents||[]).push([[1029],{86338(e,t,o){o.d(t,{t:()=>r});var i=o(78677),s=o(33814),n=o(80401);const a=e=>!(!e.complete||!e.src);class r{constructor(e){let{imageNode:t,containerNode:o,effectProps:r,WebGLComponent:d}=e;(0,i.A)(this,"currentImageSrc",""),(0,i.A)(this,"onPrefersReducedMotionChange",e=>{e?this.destroyComponent():this.prepareImage()}),(0,i.A)(this,"onContainerResize",()=>{var e;null===(e=this.componentManager)||void 0===e||e.refresh()}),(0,i.A)(this,"onImageLoaded",()=>{var e;this.currentImageSrc=this.imageNode.src,this.componentManager?this.componentManager.setProps({image:this.imageNode,imageNeedsUpdate:!0}):this.componentManager=new s.A(this.WebGLComponent,this.containerNode,{image:this.imageNode,pixelRatio:(null===(e=window)||void 0===e?void 0:e.devicePixelRatio)||1,...this.effectProps,focalPoint:this.getFocalPoint()},{scrollWindowRef:window,normalizeScroll:!1})}),(0,i.A)(this,"updateImage",e=>{this.componentManager&&(this.imageNode===e&&this.currentImageSrc===e.src||(this.imageNode.removeEventListener("load",this.onImageLoaded),this.imageNode=e,this.imageNode.addEventListener("load",this.onImageLoaded),a(this.imageNode)&&this.componentManager.setProps({image:this.imageNode,imageNeedsUpdate:!0})))}),(0,i.A)(this,"updateProps",e=>{this.componentManager&&this.componentManager.setProps(e)}),(0,i.A)(this,"getType",()=>{var e;return null===(e=this.componentManager)||void 0===e||null===(e=e.props)||void 0===e?void 0:e.type}),(0,i.A)(this,"destroy",()=>{this.destroyComponent(),this.removeListeners()}),this.imageNode=t,this.containerNode=o,this.effectProps=r,this.WebGLComponent=d,n.A&&(this.prefersReducedMotionHandler=((e,t)=>{const o=window.matchMedia("(prefers-reduced-motion: reduce)"),i={},s=((e,t)=>(e.addEventListener?e.addEventListener("change",t):e.addListener(t),t))(o,e=>{i.matches=e.matches,null==t||t(i.matches)});return i.matches=o.matches,i.destroy=()=>{((e,t)=>{e.removeEventListener?e.removeEventListener("change",t):e.removeListener(t)})(o,s)},i})(0,this.onPrefersReducedMotionChange),this.prefersReducedMotionHandler.matches||this.prepareImage())}prepareImage(){this.imageNode.addEventListener("load",this.onImageLoaded),this.imageNode.style.visibility="hidden",a(this.imageNode)&&this.onImageLoaded()}getFocalPoint(){if(this.effectProps.focalPoint)return this.effectProps.focalPoint;const[e,t]=window.getComputedStyle(this.imageNode).objectPosition.split(" ");return{x:parseFloat(e)/100,y:parseFloat(t)/100}}destroyComponent(){var e;null===(e=this.componentManager)||void 0===e||e.destroy(),this.componentManager=void 0,this.imageNode&&(this.imageNode.style.visibility="",this.imageNode.removeEventListener("load",this.onImageLoaded))}removeListeners(){var e,t;null===(e=this.prefersReducedMotionHandler)||void 0===e||null===(t=e.destroy)||void 0===t||t.call(e)}}},69289(e,t,o){o.r(t),o.d(t,{default:()=>n});var i=o(39882),s=o(86338);class n extends s.t{constructor(e){super({...e,WebGLComponent:i.A})}}}}]);