"use strict";(globalThis.webpackChunk_tsparticles_wordpress=globalThis.webpackChunk_tsparticles_wordpress||[]).push([[7589],{7589(i,e,t){t.d(e,{LinkInstance:()=>o});var n=t(3199);function s(i,e){const t=(s=i.map(i=>i.id),[...s].sort((i,e)=>i-e).join("_"));var s;let o=e.get(t);return void 0===o&&(o=(0,n.G0i)(),e.set(t,o)),o}class o{#i=new Map;#e;#t;#n;constructor(i,e){this.#n=i,this.#e=e,this.#t={links:new Map,triangles:new Map}}drawParticle(i,e){const{links:t,options:s}=e;if(!t?.length||!s.links)return;const o=s.links,l=e.retina.linksWidth??0,a=e.getPosition(),r=e.options.twinkle?.links,c=o.triangles.enable,h=c?new Set(t.map(i=>i.destination.id)):null,g=i.globalAlpha;let d="",p=-1,k=-1,u=!1;const y=()=>{u&&(i.stroke(),u=!1)};for(const g of t){if(o.frequency<1&&this.#s(e,g.destination)>o.frequency)continue;const t=g.destination.getPosition();if(c&&!g.isWarped&&h&&(y(),this.#o(s,e,g,h,a,t,i)),g.opacity<=0||l<=0)continue;if(!o.enable)continue;let f=g.opacity,b=g.color;const x=r?.enable&&(0,n.G0i)()<r.frequency?(0,n.BN0)(this.#n,r.color):void 0;if(r&&x&&(b=x,f=(0,n.VGA)(r.opacity)),!b){const i=void 0!==o.id?this.#e.particles.linksColors.get(o.id):this.#e.particles.linksColor;b=(0,n._hh)(e,g.destination,i)}if(!b)continue;const q=this.#l(b);if(q===d&&l===p&&f===k||(y(),i.strokeStyle=q,i.lineWidth=l,i.globalAlpha=f,d=q,p=l,k=f,i.beginPath(),u=!0),g.isWarped){const e=this.#e.canvas.size,s=t.x-a.x,o=t.y-a.y;let l=n.boI.x,r=n.boI.y;Math.abs(s)>e.width*n.MXx&&(l=s>0?-e.width:e.width),Math.abs(o)>e.height*n.MXx&&(r=o>0?-e.height:e.height),i.moveTo(a.x,a.y),i.lineTo(t.x+l,t.y+r),i.moveTo(a.x-l,a.y-r),i.lineTo(t.x,t.y)}else i.moveTo(a.x,a.y),i.lineTo(t.x,t.y)}y(),i.globalAlpha=g}init(){return this.#t.links.clear(),this.#t.triangles.clear(),this.#i.clear(),Promise.resolve()}particleCreated(i){if(i.links=[],!i.options.links)return;i.linksDistance=i.options.links.distance,i.linksWidth=i.options.links.width;const e=this.#e.retina.pixelRatio;i.retina.linksDistance=i.linksDistance*e,i.retina.linksWidth=i.linksWidth*e}particleDestroyed(i){i.links=[]}#o(i,e,t,s,o,l,a){const r=t.destination,c=i.links?.triangles;if(!c?.enable||!r.options.links?.triangles.enable)return;const h=r.links;if(h?.length)for(const g of h){if(g.isWarped||this.#s(r,g.destination)>r.options.links.frequency||!s.has(g.destination.id))continue;const h=g.destination;if(this.#a(e,r,h)>(i.links?.triangles.frequency??0))continue;const d=c.opacity??(t.opacity+g.opacity)*n.MXx,p=(0,n.BN0)(this.#n,c.color)??t.color;if(!p||d<=0)continue;const k=h.getPosition();a.save(),a.fillStyle=this.#l(p),a.globalAlpha=d,a.beginPath(),a.moveTo(o.x,o.y),a.lineTo(l.x,l.y),a.lineTo(k.x,k.y),a.closePath(),a.fill(),a.restore()}}#l(i){const e=`${i.r},${i.g},${i.b}`;let t=this.#i.get(e);return t||(t=(0,n.xxz)(i,this.#e.hdr),this.#i.set(e,t)),t}#s(i,e){return s([i,e],this.#t.links)}#a(i,e,t){return s([i,e,t],this.#t.triangles)}}}}]);