"use strict";(globalThis.webpackChunk_tsparticles_wordpress=globalThis.webpackChunk_tsparticles_wordpress||[]).push([[6061],{6061(t,i,a){a.d(i,{loadTrailEffect:()=>e});var o=a(3199);const r={a:1,b:0,c:0,d:1};class n{#t;constructor(t){this.#t=t}drawAfter(t){const{context:i,drawPosition:a,drawRadius:n,drawScale:e,particle:s,transformData:l}=t,h=this.#t,c=n*o.gdl,d=h.retina.pixelRatio,x=s.trail;if(!x||!s.trailLength)return;const p=a,f=s.trailLength*e+n;if(x.push({break:s.justWarped,color:i.fillStyle||i.strokeStyle,position:{x:p.x,y:p.y},transformData:l}),x.length<3)return;const g=Math.floor(f);x.length>g&&x.splice(0,x.length-g);const M=Math.min(x.length,f);i.save(),i.lineCap="butt",i.lineJoin="round";for(let t=M-2;t>0;t--){const a=x[t+1],n=x[t],l=x[t-1];if(!a||!n||!l)continue;const h=a.position,p=n.position,f=l.position,g=s.trailTransform?n.transformData??r:r;if(n.break||a.break||l.break)continue;i.setTransform(g.a,g.b,g.c,g.d,p.x,p.y);const m=(h.x+p.x)*o.MXx-p.x,u=(h.y+p.y)*o.MXx-p.y,y=(p.x+f.x)*o.MXx-p.x,b=(p.y+f.y)*o.MXx-p.y;i.beginPath(),i.moveTo(m,u),i.quadraticCurveTo(o.boI.x,o.boI.y,y,b);const k=Math.max(t/M*c,d,(s.trailMinWidth??-1)*e),v=i.globalAlpha;i.globalAlpha=s.trailFade?t/M:o.aZx,i.lineWidth=s.trailMaxWidth?Math.min(k,s.trailMaxWidth*e):k,i.strokeStyle=n.color,i.stroke(),i.globalAlpha=v}i.restore()}isInsideCanvas(t){const{canvasSize:i,direction:a,outMode:r,particle:n,radius:e}=t,s=n.position,l=n.trail;let h=s.x-e,c=s.x+e,d=s.y-e,x=s.y+e;if(l?.length){const t=Math.max(e,n.trailMaxWidth??0,n.trailMinWidth??0);for(const i of l)h=Math.min(h,i.position.x-t),c=Math.max(c,i.position.x+t),d=Math.min(d,i.position.y-t),x=Math.max(x,i.position.y+t)}const p=r===o.Yzx.destroy;return a===o.v5k.bottom?d<=i.height:a===o.v5k.left?c>=0:a===o.v5k.right?h<=i.width:a===o.v5k.top?x>=0:p?c>=0&&x>=0&&h<=i.width&&d<=i.height:s.x+e>=0&&s.y+e>=0&&s.x-e<=i.width&&s.y-e<=i.height}particleInit(t,i){i.trail=[];const a=i.effectData;i.trailFade=a?.fade??!0,i.trailLength=(0,o.VGA)(a?.length??10)*t.retina.pixelRatio,i.trailMaxWidth=a?.maxWidth?(0,o.VGA)(a.maxWidth)*t.retina.pixelRatio:void 0,i.trailMinWidth=a?.minWidth?(0,o.VGA)(a.minWidth)*t.retina.pixelRatio:void 0,i.trailTransform=a?.transform??!1}}async function e(t){t.checkVersion("4.1.3"),await t.pluginManager.register(t=>{t.pluginManager.addEffect("trail",t=>Promise.resolve(new n(t)))})}}}]);