"use strict";(globalThis.webpackChunk_tsparticles_wordpress=globalThis.webpackChunk_tsparticles_wordpress||[]).push([[9486],{9486(e,t,n){n.d(t,{ZoomPluginInstance:()=>r});var s=n(3199),i=n(8894);class a{#e;#t;#n;#s;constructor(e){this.#e=e,this.#t=s.Pf9,this.#s=i.Be,this.#n={gestureStart:e=>{this.#i(e)},gestureChange:e=>{this.#a(e)},gestureEnd:e=>{this.#r(e)},wheel:e=>{this.#o(e)},touchMove:e=>{this.#c(e)},touchEnd:()=>{this.#h()}}}addListeners(){this.#u(!0)}removeListeners(){this.#u(!1)}#a(e){const t=this.#e,n=t.canvas,a=n.domElement;if(!a)return;const r=t.actualOptions.zoom;if(!r?.enable)return;if(!this.#l(e,a))return;e.preventDefault();const o=e,c=s.Pf9,h=i.Iq,u=o.scale??c;if(u===this.#t)return;const l=c+(u/this.#t-c)*h,d=n.zoom,m=Math.max(r.min,Math.min(d*l,r.max)),p=a.getBoundingClientRect(),g=o.clientX??p.left+p.width/i.pI,f=o.clientY??p.top+p.height/i.pI,v=this.#e.retina.pixelRatio,E=(g-p.left)*v,C=(f-p.top)*v;n.setZoom(m,{x:E,y:C}),this.#t=u}#r(e){const t=this.#e,n=t.canvas.domElement;if(!n)return;const i=t.actualOptions.zoom;i?.enable&&this.#l(e,n)&&(e.preventDefault(),this.#t=s.Pf9)}#i(e){const t=this.#e,n=t.canvas.domElement;if(!n)return;const i=t.actualOptions.zoom;i?.enable&&this.#l(e,n)&&(e.preventDefault(),this.#t=s.Pf9)}#o(e){if(!e.ctrlKey&&!e.metaKey)return;const t=this.#e,n=t.actualOptions.zoom,s=t.canvas,a=s.domElement;if(!a)return;if(!n?.enable)return;if(!this.#l(e,a))return;e.preventDefault();const r=e.deltaY>i.Be?i.nP:i.Kb,o=s.zoom,c=Math.max(n.min,Math.min(o*r,n.max)),h=a.getBoundingClientRect(),u=this.#e.retina.pixelRatio,l=(e.clientX-h.left)*u,d=(e.clientY-h.top)*u;s.setZoom(c,{x:l,y:d})}#h(){this.#s=i.Be}#c(e){if(e.touches.length!==i.s0)return;e.preventDefault();const t=e.touches[i.WS],n=e.touches[i.Ai];if(!t||!n)return;const a=Math.hypot(t.clientX-n.clientX,t.clientY-n.clientY);if(this.#s===i.Be)return void(this.#s=a);const r=this.#e,o=r.actualOptions.zoom,c=r.canvas,h=c.domElement;if(!h)return;if(!o?.enable)return;if(!this.#l(e,h))return;const u=a/this.#s,l=s.Pf9,d=l+(u-l)*i.Iq,m=c.zoom,p=Math.max(o.min,Math.min(m*d,o.max)),g=h.getBoundingClientRect(),f=this.#e.retina.pixelRatio,v=((t.clientX+n.clientX)/i.pI-g.left)*f,E=((t.clientY+n.clientY)/i.pI-g.top)*f;c.setZoom(p,{x:v,y:E}),this.#s=a}#l(e,t){if(e.target===t)return!0;const n=e;if(n.composedPath().includes(t))return!0;const{clientX:s,clientY:i}=n;if("number"==typeof s&&"number"==typeof i){const e=t.getBoundingClientRect();return s>=e.left&&s<=e.right&&i>=e.top&&i<=e.bottom}return!1}#u(e){const t=this.#n,n=this.#e.canvas.domElement,i=this.#e.actualOptions,a=(0,s.T5G)();if(!n)return;if(e&&!i.zoom?.enable)return;const r={passive:!1},o={capture:!0,passive:!1};(0,s.KpY)(a,"gesturestart",t.gestureStart,e,o),(0,s.KpY)(a,"gesturechange",t.gestureChange,e,o),(0,s.KpY)(a,"gestureend",t.gestureEnd,e,o),(0,s.KpY)(a,"wheel",t.wheel,e,o),(0,s.KpY)(n,"gesturestart",t.gestureStart,e,r),(0,s.KpY)(n,"gesturechange",t.gestureChange,e,r),(0,s.KpY)(n,"gestureend",t.gestureEnd,e,r),(0,s.KpY)(n,"wheel",t.wheel,e,r),(0,s.KpY)(n,"touchmove",t.touchMove,e,r),(0,s.KpY)(n,"touchend",t.touchEnd,e,r),(0,s.KpY)(n,"touchcancel",t.touchEnd,e,r)}}class r{#e;#d;constructor(e){this.#e=e,this.#d=new a(e)}destroy(){this.#d.removeListeners()}drawParticleTransform(e){const t=this.#e.canvas,n=t.zoom;if(n===s.Pf9)return;const i=t.getZoomCenter(),{context:a,position:r,transformData:o}=e,c=i.x+(r.x-i.x)*n,h=i.y+(r.y-i.y)*n;e.drawScale=n,e.drawRadius=e.radius*n,e.drawPosition={x:c,y:h},a.setTransform(o.a*n,o.b*n,o.c*n,o.d*n,c,h)}drawSettingsCleanup(e){this.#e.canvas.zoom!==s.Pf9&&e.restore()}drawSettingsSetup(e){const t=this.#e.canvas.zoom;if(t===s.Pf9)return;e.save();const{x:n,y:i}=this.#e.canvas.getZoomCenter();e.translate(n,i),e.scale(t,t),e.translate(-n,-i)}start(){return this.#d.addListeners(),Promise.resolve()}stop(){this.#d.removeListeners()}}}}]);