@tsparticles/stencil 4.2.0 → 4.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{Container-CGxn4Tv3.js → Container-BIhHE6mu.js} +1 -1
- package/dist/cjs/{index-7q-LddLf.js → index-BIoj1BEO.js} +2 -2
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/stencil-particles.cjs.entry.js +1 -1
- package/dist/esm/{Container-BWWTh10Z.js → Container-DZZsfp6i.js} +1 -1
- package/dist/esm/{index-aPxdqzSw.js → index-BH3sNkGS.js} +2 -2
- package/dist/esm/index.js +1 -1
- package/dist/esm/stencil-particles.entry.js +1 -1
- package/dist/tsparticlesstencil/index.esm.js +1 -1
- package/dist/tsparticlesstencil/p-CIUgBOXY.js +1 -0
- package/dist/tsparticlesstencil/{p-FNL2LsWF.js → p-QSzGOBhI.js} +1 -1
- package/dist/tsparticlesstencil/{p-e16c4912.entry.js → p-bd76f15b.entry.js} +1 -1
- package/dist/tsparticlesstencil/tsparticlesstencil.esm.js +1 -1
- package/package.json +3 -3
- package/dist/tsparticlesstencil/p-PBQ5N1xQ.js +0 -1
|
@@ -748,7 +748,7 @@ class Engine {
|
|
|
748
748
|
return this.#domArray;
|
|
749
749
|
}
|
|
750
750
|
get version() {
|
|
751
|
-
return "4.2.
|
|
751
|
+
return "4.2.1";
|
|
752
752
|
}
|
|
753
753
|
addEventListener(type, listener) {
|
|
754
754
|
this.#eventDispatcher.addEventListener(type, listener);
|
|
@@ -783,7 +783,7 @@ class Engine {
|
|
|
783
783
|
if (typeof HTMLElement !== "undefined" && params.element instanceof HTMLElement) {
|
|
784
784
|
domSourceElement = params.element;
|
|
785
785
|
}
|
|
786
|
-
const { Container } = await Promise.resolve().then(function () { return require('./Container-
|
|
786
|
+
const { Container } = await Promise.resolve().then(function () { return require('./Container-BIhHE6mu.js'); }), id = params.id ?? domSourceElement?.id ?? `tsparticles${Math.floor(getRandom() * loadRandomFactor).toString()}`, { index, url } = params, options = url ? await getDataFromUrl({ fallback: params.options, url, index }) : params.options, currentOptions = itemFromSingleOrMultiple(options, index), { items } = this, oldIndex = items.findIndex(v => v.id.description === id), newItem = new Container({
|
|
787
787
|
dispatchCallback: (eventType, args) => {
|
|
788
788
|
this.dispatchEvent(eventType, args);
|
|
789
789
|
},
|
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as RangeType, c as checkDistance, s as squareExp, a as isNull, b as setRangeValue, h as hMin, d as hMax, l as lMin, e as lMax, f as sMin, g as sMax, j as isString, k as isArray, m as deepExtend, P as PixelMode, O as OutMode, M as MoveDirection, n as isNumber, o as isObject, L as LimitMode, p as executeOnSingleOrMultiple, q as isBoolean, r as itemFromArray, u as defaultOpacity, v as randomColorValue, A as AlterType, w as lFactor, x as half, y as double, z as hPhase, B as rgbMax, C as getRandomInRange, D as identity, E as defaultRgbMin, F as maxNits, G as sextuple, H as triple, I as phaseNumerator, J as sNormalizedOffset, K as originPoint, N as minimumSize, Q as defaultCompositeValue, S as minStrokeWidth, T as defaultZoom, U as zIndexFactorOffset, V as defaultTransformValue, W as safeMutationObserver, X as generatedAttribute, Y as cloneStyle, Z as safeMatchMedia, _ as getFullScreenStyle, $ as safeDocument, a0 as millisecondsToSeconds, a1 as manageListener, a2 as visibilityChangeEvent, a3 as resizeEvent, a4 as Vector3d, a5 as EventType, a6 as defaultAngle, a7 as defaultTransform, a8 as defaultRetryCount, a9 as tryCountIncrement, aa as getParticleBaseVelocity, ab as randomInRangeValue, ac as getRandom, ad as OutModeDirection, ae as clamp, af as minZ, ag as getPosition, ah as getParticleDirectionAngle, ai as ParticleOutType, aj as Vector, ak as getRangeValue, al as calcExactPositionOrRandomFromSize, am as itemFromSingleOrMultiple, an as isInArray, ao as doublePI, ap as degToRad, aq as spatialHashGridCellSize, ar as minLimit, as as minCount, at as getLogger, au as minIndex, av as defaultRemoveQuantity, aw as defaultDensityFactor, ax as deleteCount, ay as countOffset, az as one, aA as defaultRatio, aB as defaultReduceFactor, aC as animate, aD as defaultFpsLimit, aE as minFpsLimit, aF as cancelAnimation, aG as defaultFps } from './index-
|
|
1
|
+
import { R as RangeType, c as checkDistance, s as squareExp, a as isNull, b as setRangeValue, h as hMin, d as hMax, l as lMin, e as lMax, f as sMin, g as sMax, j as isString, k as isArray, m as deepExtend, P as PixelMode, O as OutMode, M as MoveDirection, n as isNumber, o as isObject, L as LimitMode, p as executeOnSingleOrMultiple, q as isBoolean, r as itemFromArray, u as defaultOpacity, v as randomColorValue, A as AlterType, w as lFactor, x as half, y as double, z as hPhase, B as rgbMax, C as getRandomInRange, D as identity, E as defaultRgbMin, F as maxNits, G as sextuple, H as triple, I as phaseNumerator, J as sNormalizedOffset, K as originPoint, N as minimumSize, Q as defaultCompositeValue, S as minStrokeWidth, T as defaultZoom, U as zIndexFactorOffset, V as defaultTransformValue, W as safeMutationObserver, X as generatedAttribute, Y as cloneStyle, Z as safeMatchMedia, _ as getFullScreenStyle, $ as safeDocument, a0 as millisecondsToSeconds, a1 as manageListener, a2 as visibilityChangeEvent, a3 as resizeEvent, a4 as Vector3d, a5 as EventType, a6 as defaultAngle, a7 as defaultTransform, a8 as defaultRetryCount, a9 as tryCountIncrement, aa as getParticleBaseVelocity, ab as randomInRangeValue, ac as getRandom, ad as OutModeDirection, ae as clamp, af as minZ, ag as getPosition, ah as getParticleDirectionAngle, ai as ParticleOutType, aj as Vector, ak as getRangeValue, al as calcExactPositionOrRandomFromSize, am as itemFromSingleOrMultiple, an as isInArray, ao as doublePI, ap as degToRad, aq as spatialHashGridCellSize, ar as minLimit, as as minCount, at as getLogger, au as minIndex, av as defaultRemoveQuantity, aw as defaultDensityFactor, ax as deleteCount, ay as countOffset, az as one, aA as defaultRatio, aB as defaultReduceFactor, aC as animate, aD as defaultFpsLimit, aE as minFpsLimit, aF as cancelAnimation, aG as defaultFps } from './index-BH3sNkGS.js';
|
|
2
2
|
|
|
3
3
|
class BaseRange {
|
|
4
4
|
position;
|
|
@@ -746,7 +746,7 @@ class Engine {
|
|
|
746
746
|
return this.#domArray;
|
|
747
747
|
}
|
|
748
748
|
get version() {
|
|
749
|
-
return "4.2.
|
|
749
|
+
return "4.2.1";
|
|
750
750
|
}
|
|
751
751
|
addEventListener(type, listener) {
|
|
752
752
|
this.#eventDispatcher.addEventListener(type, listener);
|
|
@@ -781,7 +781,7 @@ class Engine {
|
|
|
781
781
|
if (typeof HTMLElement !== "undefined" && params.element instanceof HTMLElement) {
|
|
782
782
|
domSourceElement = params.element;
|
|
783
783
|
}
|
|
784
|
-
const { Container } = await import('./Container-
|
|
784
|
+
const { Container } = await import('./Container-DZZsfp6i.js'), id = params.id ?? domSourceElement?.id ?? `tsparticles${Math.floor(getRandom() * loadRandomFactor).toString()}`, { index, url } = params, options = url ? await getDataFromUrl({ fallback: params.options, url, index }) : params.options, currentOptions = itemFromSingleOrMultiple(options, index), { items } = this, oldIndex = items.findIndex(v => v.id.description === id), newItem = new Container({
|
|
785
785
|
dispatchCallback: (eventType, args) => {
|
|
786
786
|
this.dispatchEvent(eventType, args);
|
|
787
787
|
},
|
package/dist/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { i as initParticlesEngine, aH as isParticlesEngineInitialized, aI as waitForParticlesEngineInitialization } from './index-
|
|
1
|
+
export { i as initParticlesEngine, aH as isParticlesEngineInitialized, aI as waitForParticlesEngineInitialization } from './index-BH3sNkGS.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h } from './index-PhwiK2_P.js';
|
|
2
|
-
import { i as initParticlesEngine, t as tsParticles } from './index-
|
|
2
|
+
import { i as initParticlesEngine, t as tsParticles } from './index-BH3sNkGS.js';
|
|
3
3
|
|
|
4
4
|
const StencilParticles = class {
|
|
5
5
|
constructor(hostRef) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{i as initParticlesEngine,aH as isParticlesEngineInitialized,aI as waitForParticlesEngineInitialization}from"./p-
|
|
1
|
+
export{i as initParticlesEngine,aH as isParticlesEngineInitialized,aI as waitForParticlesEngineInitialization}from"./p-QSzGOBhI.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{R as t,c as s,s as i,a as e,b as h,h as o,d as n,l as a,e as r,f as c,g as l,j as d,k as f,m as u,P as p,O as w,M as v,n as g,o as y,L as m,p as b,q as x,r as M,u as P,v as z,A as C,w as k,x as L,y as S,z as R,B as D,C as O,D as $,E as T,F as B,G as I,H as F,I as E,J as A,K as U,N as q,Q as V,S as j,T as H,U as W,V as X,W as Y,X as _,Y as G,Z as N,_ as Q,$ as Z,a0 as K,a1 as J,a2 as tt,a3 as st,a4 as it,a5 as et,a6 as ht,a7 as ot,a8 as nt,a9 as at,aa as rt,ab as ct,ac as lt,ad as dt,ae as ft,af as ut,ag as pt,ah as wt,ai as vt,aj as gt,ak as yt,al as mt,am as bt,an as xt,ao as Mt,ap as Pt,aq as zt,ar as Ct,as as kt,at as Lt,au as St,av as Rt,aw as Dt,ax as Ot,ay as $t,az as Tt,aA as Bt,aB as It,aC as Ft,aD as Et,aE as At,aF as Ut,aG as qt}from"./p-QSzGOBhI.js";class Vt{position;type;constructor(t,s,i){this.position={x:t,y:s},this.type=i}_resetPosition(t,s){this.position.x=t,this.position.y=s}}class jt extends Vt{radius;constructor(s,i,e){super(s,i,t.circle),this.radius=e}contains(t){return s(t,this.position,this.radius)}intersects(s){const e=this.position,h=s.position,o=this.radius,n=Math.abs(h.x-e.x),a=Math.abs(h.y-e.y);if(s instanceof jt||s.type===t.circle)return o+s.radius>Math.hypot(n,a);if(s instanceof Ht||s.type===t.rectangle){const t=s,{width:e,height:h}=t.size;return Math.pow(n-e,i)+Math.pow(a-h,i)<=o**i||n<=o+e&&a<=o+h||n<=e||a<=h}return!1}reset(t,s,i){return this._resetPosition(t,s),this.radius=i,this}}class Ht extends Vt{size;constructor(s,i,e,h){super(s,i,t.rectangle),this.size={height:h,width:e}}contains(t){const s=this.position;return t.x>=s.x&&t.x<=s.x+this.size.width&&t.y>=s.y&&t.y<=s.y+this.size.height}intersects(t){if(t instanceof jt)return t.intersects(this);if(!(t instanceof Ht))return!1;const s=this.position,i=t.position,e=t.size;return i.x<s.x+this.size.width&&i.x+e.width>s.x&&i.y<s.y+this.size.height&&i.y+e.height>s.y}reset(t,s,i,e){return this._resetPosition(t,s),this.size.width=i,this.size.height=e,this}}class Wt{load(t){e(t)||this.doLoad(t)}}function Xt(t,...s){for(const i of s)t.load(i)}function Yt(t,s,i){void 0!==i&&(t[s]=i)}function _t(t,s,i){void 0!==i&&(t[s]=h(i))}function Gt(t,s,i,e){if(void 0!==i){const h=t;h[s]??=e(),h[s].load(i)}}class Nt extends Wt{count=0;decay=0;delay=0;enable=!1;speed=1;sync=!1;doLoad(t){_t(this,"count",t.count),Yt(this,"enable",t.enable),_t(this,"speed",t.speed),_t(this,"decay",t.decay),_t(this,"delay",t.delay),Yt(this,"sync",t.sync)}}class Qt extends Nt{max;min;offset=0;sync=!0;constructor(t,s){super(),this.min=t,this.max=s}doLoad(t){super.doLoad(t),Yt(this,"max",t.max),Yt(this,"min",t.min),_t(this,"offset",t.offset)}}class Zt extends Wt{h=new Qt(o,n);l=new Qt(a,r);s=new Qt(c,l);doLoad(t){this.h.load(t.h),this.s.load(t.s),this.l.load(t.l)}}class Kt extends Wt{value="";static create(t,s){const i=new Kt;return i.load(t),void 0!==s&&(d(s)||f(s)?i.load({value:s}):i.load(s)),i}doLoad(t){e(t.value)||(this.value=t.value)}}class Jt extends Kt{animation=new Zt;static create(t,s){const i=new Jt;return i.load(t),void 0!==s&&(d(s)||f(s)?i.load({value:s}):i.load(s)),i}doLoad(t){super.doLoad(t);const s=t.animation;void 0!==s&&(void 0===s.enable?this.animation.load(t.animation):this.animation.h.load(s))}}class ts extends Wt{color;image="";opacity=1;position="";repeat="";size="";constructor(){super(),this.color=new Kt,this.color.value=""}doLoad(t){void 0!==t.color&&(this.color=Kt.create(this.color,t.color)),Yt(this,"image",t.image),Yt(this,"position",t.position),Yt(this,"repeat",t.repeat),Yt(this,"size",t.size),Yt(this,"opacity",t.opacity)}}class ss extends Wt{enable=!0;zIndex=0;doLoad(t){Yt(this,"enable",t.enable),Yt(this,"zIndex",t.zIndex)}}class is extends Wt{delay=.5;enable=!0;doLoad(t){Yt(this,"delay",t.delay),Yt(this,"enable",t.enable)}}class es extends Wt{close=!0;options={};type=[];doLoad(t){const s=t.options;if(void 0!==s)for(const t in s){const i=s[t];i&&(this.options[t]=u(this.options[t]??{},i))}Yt(this,"close",t.close),Yt(this,"type",t.type)}}class hs extends Wt{color;enable=!0;opacity=1;doLoad(t){void 0!==t.color&&(this.color=Jt.create(this.color,t.color)),Yt(this,"enable",t.enable),_t(this,"opacity",t.opacity)}}class os extends Wt{offset=0;value=90;doLoad(t){_t(this,"offset",t.offset),_t(this,"value",t.value)}}class ns extends Wt{mode=p.percent;radius=0;x=50;y=50;doLoad(t){Yt(this,"x",t.x),Yt(this,"y",t.y),Yt(this,"mode",t.mode),Yt(this,"radius",t.radius)}}class as extends Wt{acceleration=9.81;enable=!1;inverse=!1;maxSpeed=50;doLoad(t){_t(this,"acceleration",t.acceleration),Yt(this,"enable",t.enable),Yt(this,"inverse",t.inverse),_t(this,"maxSpeed",t.maxSpeed)}}class rs extends Wt{value=0;doLoad(t){e(t.value)||(this.value=h(t.value))}}class cs extends Wt{clamp=!0;delay=new rs;enable=!1;generator;options={};doLoad(t){Yt(this,"clamp",t.clamp),this.delay.load(t.delay),Yt(this,"enable",t.enable),this.generator=t.generator,t.options&&(this.options=u(this.options,t.options))}}class ls extends Wt{bottom;default=w.out;left;right;top;doLoad(t){void 0!==t.default&&(this.default=t.default),this.bottom=t.bottom??t.default,this.left=t.left??t.default,this.right=t.right??t.default,this.top=t.top??t.default}}class ds extends Wt{acceleration=0;enable=!1;position;doLoad(t){_t(this,"acceleration",t.acceleration),Yt(this,"enable",t.enable),t.position&&(this.position=u({},t.position))}}class fs extends Wt{angle=new os;center=new ns;decay=0;direction=v.none;distance={};drift=0;enable=!1;gravity=new as;outModes=new ls;path=new cs;random=!1;size=!1;speed=2;spin=new ds;straight=!1;vibrate=!1;warp=!1;doLoad(t){this.angle.load(g(t.angle)?{value:t.angle}:t.angle),this.center.load(t.center),_t(this,"decay",t.decay),Yt(this,"direction",t.direction),void 0!==t.distance&&(this.distance=g(t.distance)?{horizontal:t.distance,vertical:t.distance}:{...t.distance}),_t(this,"drift",t.drift),Yt(this,"enable",t.enable),this.gravity.load(t.gravity);const s=t.outModes;void 0!==s&&(y(s)?this.outModes.load(s):this.outModes.load({default:s})),this.path.load(t.path),Yt(this,"random",t.random),Yt(this,"size",t.size),_t(this,"speed",t.speed),this.spin.load(t.spin),Yt(this,"straight",t.straight),Yt(this,"vibrate",t.vibrate),Yt(this,"warp",t.warp)}}class us extends Wt{color;opacity;width=0;doLoad(t){void 0!==t.color&&(this.color=Jt.create(this.color,t.color)),_t(this,"width",t.width),_t(this,"opacity",t.opacity)}}class ps extends Wt{color;fill;stroke;doLoad(t){void 0!==t.color&&(this.color=Jt.create(this.color,t.color)),Gt(this,"fill",t.fill,(()=>new hs)),Gt(this,"stroke",t.stroke,(()=>new us))}}class ws extends rs{value=1}class vs extends Wt{horizontal=new ws;vertical=new ws;doLoad(t){this.horizontal.load(t.horizontal),this.vertical.load(t.vertical)}}class gs extends Wt{enable=!1;height=1080;width=1920;doLoad(t){Yt(this,"enable",t.enable),Yt(this,"width",t.width),Yt(this,"height",t.height)}}class ys extends Wt{mode=m.delete;value=0;doLoad(t){Yt(this,"mode",t.mode),Yt(this,"value",t.value)}}class ms extends Wt{density=new gs;limit=new ys;value=0;doLoad(t){this.density.load(t.density),this.limit.load(t.limit),Yt(this,"value",t.value)}}class bs extends Wt{close=!0;options={};type="circle";doLoad(t){const s=t.options;if(void 0!==s)for(const t in s){const i=s[t];i&&(this.options[t]=u(this.options[t]??{},i))}Yt(this,"close",t.close),Yt(this,"type",t.type)}}class xs extends rs{opacityRate=1;sizeRate=1;velocityRate=1;doLoad(t){super.doLoad(t),Yt(this,"opacityRate",t.opacityRate),Yt(this,"sizeRate",t.sizeRate),Yt(this,"velocityRate",t.velocityRate)}}class Ms extends Wt{bounce=new vs;effect=new es;groups={};move=new fs;number=new ms;paint;palette;reduceDuplicates=!1;shape=new bs;zIndex=new xs;#t;#s;constructor(t,s){super(),this.#s=t,this.#t=s,this.paint=new ps,this.paint.color=new Jt,this.paint.color.value="#fff",this.paint.fill=new hs,this.paint.fill.enable=!0}doLoad(t){if(t.palette&&(this.palette=t.palette,this.#i(this.palette)),void 0!==t.groups)for(const s of Object.keys(t.groups)){if(!(s in t.groups))continue;const i=t.groups[s];void 0!==i&&(this.groups[s]=u(this.groups[s]??{},i))}void 0!==t.reduceDuplicates&&(this.reduceDuplicates=t.reduceDuplicates),this.bounce.load(t.bounce),this.effect.load(t.effect),this.move.load(t.move),this.number.load(t.number);const s=t.paint;if(s&&(f(s)?this.paint=b(s,(t=>{const s=new ps;return s.load(t),s})):f(this.paint)?(this.paint=new ps,this.paint.load(s)):this.paint.load(s)),this.shape.load(t.shape),this.zIndex.load(t.zIndex),this.#t){for(const s of this.#s.plugins)s.loadParticlesOptions&&s.loadParticlesOptions(this.#t,this,t);const s=this.#s.updaters.get(this.#t);if(s)for(const i of s)i.loadOptions&&i.loadOptions(this,t)}}#i(t){const s=this.#s.getPalette(t);if(!s)return;const i=s.colors,e=(f(i)?i:[i]).flatMap((t=>{const s=t.fill,i=t.stroke,e=s?{color:{value:s.value},enable:s.enable,opacity:s.opacity}:void 0;return i?[{fill:e,stroke:{color:{value:i.value},opacity:i.opacity,width:i.width||0}}]:[{fill:e}]}));this.load({paint:e.length>1?e:e[0]??{},blend:{enable:!0,mode:s.blendMode}})}}function Ps(t,s,...i){const e=new Ms(t,s);return Xt(e,...i),e}class zs extends Wt{autoPlay=!0;background;clear=!0;defaultThemes={};delay=0;detectRetina=!0;duration=0;fpsLimit=120;fullScreen;hdr=!0;key;name;palette;particles;pauseOnBlur=!0;pauseOnOutsideViewport=!0;preset;resize;smooth=!1;style={};zLayers=100;#t;#s;constructor(t,s){super(),this.#s=t,this.#t=s,this.background=new ts,this.fullScreen=new ss,this.particles=Ps(this.#s,this.#t),this.resize=new is}doLoad(t){void 0!==t.preset&&(this.preset=t.preset,b(this.preset,(t=>{this.#e(t)}))),void 0!==t.palette&&(this.palette=t.palette,this.#i(this.palette)),Yt(this,"autoPlay",t.autoPlay),Yt(this,"clear",t.clear),Yt(this,"key",t.key),Yt(this,"name",t.name),_t(this,"delay",t.delay),Yt(this,"detectRetina",t.detectRetina),_t(this,"duration",t.duration),Yt(this,"fpsLimit",t.fpsLimit),Yt(this,"hdr",t.hdr),Yt(this,"pauseOnBlur",t.pauseOnBlur),Yt(this,"pauseOnOutsideViewport",t.pauseOnOutsideViewport),Yt(this,"zLayers",t.zLayers),this.background.load(t.background);const s=t.fullScreen;x(s)?this.fullScreen.enable=s:this.fullScreen.load(s),this.particles.load(t.particles),this.resize.load(t.resize),this.style=u(this.style,t.style),Yt(this,"smooth",t.smooth),this.#s.plugins.forEach((s=>{s.loadOptions(this.#t,this,t)}))}#i(t){const s=this.#s.getPalette(t);s&&this.load({background:{color:s.background},blend:{enable:!0,mode:s.blendMode},particles:{palette:t}})}#e(t){this.load(this.#s.getPreset(t))}}const Cs=new Map;function ks(t,s){let i=Cs.get(t);return i||(i=s(),Cs.size>2e3&&Cs.clear(),Cs.set(t,i)),i}function Ls(t,s,i,e=!0){if(!s)return;const h=d(s)?{value:s}:s;if(d(h.value))return Ss(t,h.value,i,e);if(f(h.value)){const s=M(h.value,i,e);if(!s)return;return Ls(t,{value:s})}for(const s of t.colorManagers.values()){const t=s.handleRangeColor(h);if(t)return t}}function Ss(t,s,i,e=!0){if(!s)return;const h=d(s)?{value:s}:s;if(d(h.value))return h.value===z?function(){const t=T,s=D+$,i=()=>Math.floor(O(t,s));return{b:i(),g:i(),r:i()}}():function(t,s){return function(t,s){if(s)for(const i of t.colorManagers.values())if(i.accepts(s))return i.parseString(s)}(t,s)}(t,h.value);if(f(h.value)){const s=M(h.value,i,e);if(!s)return;return Ss(t,{value:s})}for(const s of t.colorManagers.values()){const t=s.handleColor(h);if(t)return t}}function Rs(t,s,i,e=!0){const h=Ls(t,s,i,e);return h?function(t){const s=t.r/D,i=t.g/D,e=t.b/D,h=Math.max(s,i,e),a=Math.min(s,i,e),d={h:o,l:(h+a)*L,s:c};return h!==a&&(d.s=d.l<L?(h-a)/(h+a):(h-a)/(S-h-a),d.h=s===h?(i-e)/(h-a):i===h?S+(e-s)/(h-a):S*S+(s-i)/(h-a)),d.l*=r,d.s*=l,d.h*=R,d.h<o&&(d.h+=n),d.h>=n&&(d.h-=n),d}(h):void 0}function Ds(t,s,i){return i<0&&i++,i>1&&i--,i*I<1?t+(s-t)*I*i:i*S<1?s:i*F<1*S?t+(s-t)*(S/F-i)*I:t}function Os(t,s,i){const e=i??P;return ks(`rgb-${t.r.toFixed(2)}-${t.g.toFixed(2)}-${t.b.toFixed(2)}-${s?"hdr":"sdr"}-${e.toString()}`,(()=>s?function(t,s,i=B){const e=i/203;return`color(display-p3 ${(t.r/D*e).toString()} ${(t.g/D*e).toString()} ${(t.b/D*e).toString()} / ${(s??P).toString()})`}(t,i):function(t,s){return`rgba(${t.r.toString()}, ${t.g.toString()}, ${t.b.toString()}, ${(s??P).toString()})`}(t,i)))}function $s(t,s,i){const e=i??P;return ks(`hsl-${t.h.toFixed(2)}-${t.s.toFixed(2)}-${t.l.toFixed(2)}-${s?"hdr":"sdr"}-${e.toString()}`,(()=>s?Os(function(t){const s=(t.h%n+n)%n,i=Math.max(c,Math.min(l,t.s)),e=Math.max(a,Math.min(r,t.l)),h=s/n,o=i/l,d=e/r;if(i===c){const t=Math.round(d*D);return{r:t,g:t,b:t}}const f=d<L?d*(A+o):d+o-d*o,u=S*d-f,p=E/F,w=Math.min(D,D*Ds(u,f,h+p)),v=Math.min(D,D*Ds(u,f,h)),g=Math.min(D,D*Ds(u,f,h-p));return{r:Math.round(w),g:Math.round(v),b:Math.round(g)}}(t),!0,i):`hsla(${t.h.toString()}, ${t.s.toString()}%, ${t.l.toString()}%, ${e.toString()})`))}function Ts(t){return void 0===t?void 0:{h:t.h.value,s:t.s.value,l:t.l.value}}function Bs(t,s,i){const e=s[i];void 0!==e&&(t[i]=(t[i]??X)*e)}class Is{#h;#o;#n;#a;#r;#t;#c;#l;#d;#f;#u;#p;#w;#v;#s;#g;#y;#m={};#b=[void 0,void 0];#x={};constructor(t,s,i){this.#s=t,this.#t=s,this.#o=i,this.#c=null,this.#y=[],this.#g=[],this.#r=[],this.#h=[],this.#n=[],this.#a=[],this.#d=[],this.#f=[],this.#u=[],this.#p=[],this.#v=[],this.#w=[]}get settings(){return this.#l}canvasClear(){this.#t.actualOptions.clear&&this.draw((t=>{t.clearRect(U.x,U.y,this.#o.size.width,this.#o.size.height)}))}clear(){let t=!1;for(const s of this.#h)if(t=s.canvasClear?.()??!1,t)break;t||this.canvasClear()}destroy(){this.stop(),this.#y=[],this.#g=[],this.#r=[],this.#h=[],this.#n=[],this.#a=[],this.#d=[],this.#f=[],this.#u=[],this.#p=[],this.#v=[],this.#w=[]}draw(t){const s=this.#c;if(s)return t(s)}drawParticle(t,s){if(t.spawning||t.destroyed)return;const i=t.getRadius();if(i<=q)return;const e=t.getFillColor(),h=t.getStrokeColor();let[o,n]=this.#M(t);if(o??=e,n??=h,!o&&!n)return;const a=this.#t,r=t.options.zIndex,c=W-t.zIndexFactor,{fillOpacity:l,opacity:d,strokeOpacity:f}=t.getOpacity(),u=this.#x,p=this.#m,w=o?$s(o,a.hdr,l*d):void 0,v=n?$s(n,a.hdr,f*d):w;u.a=u.b=u.c=u.d=void 0,p.fill=w,p.stroke=v,this.draw((e=>{for(const i of this.#u)i.drawParticleSetup?.(e,t,s);this.#P(e,t,i,d,p,u),this.#z({container:a,context:e,particle:t,delta:s,colorStyles:p,radius:i*c**r.sizeRate,opacity:d,transform:u}),this.#C(t);for(const i of this.#f)i.drawParticleCleanup?.(e,t,s)}))}drawParticlePlugins(t,s){this.draw((i=>{for(const e of this.#d)this.#k(i,e,t,s)}))}drawParticles(t){const{particles:s}=this.#t;this.clear(),s.update(t),this.draw((i=>{for(const s of this.#v)s.drawSettingsSetup?.(i,t);for(const s of this.#p)s.draw?.(i,t);s.drawParticles(t);for(const s of this.#a)s.clearDraw?.(i,t);for(const s of this.#w)s.drawSettingsCleanup?.(i,t)}))}init(){this.initUpdaters(),this.initPlugins(),this.paint()}initPlugins(){this.#r=[],this.#h=[],this.#n=[],this.#a=[],this.#d=[],this.#u=[],this.#f=[],this.#p=[],this.#v=[],this.#w=[];for(const t of this.#t.plugins)(t.particleFillColor??t.particleStrokeColor)&&this.#r.push(t),t.canvasClear&&this.#h.push(t),t.canvasPaint&&this.#n.push(t),t.drawParticle&&this.#d.push(t),t.drawParticleSetup&&this.#u.push(t),t.drawParticleCleanup&&this.#f.push(t),t.draw&&this.#p.push(t),t.drawSettingsSetup&&this.#v.push(t),t.drawSettingsCleanup&&this.#w.push(t),t.clearDraw&&this.#a.push(t)}initUpdaters(){this.#y=[],this.#g=[];for(const t of this.#t.particleUpdaters)t.afterDraw&&this.#g.push(t),(t.getColorStyles??t.getTransformValues??t.beforeDraw)&&this.#y.push(t)}paint(){let t=!1;for(const s of this.#n)if(t=s.canvasPaint?.()??!1,t)break;t||this.paintBase()}paintBase(t){this.draw((s=>{s.fillStyle=t??"rgba(0,0,0,0)",s.fillRect(U.x,U.y,this.#o.size.width,this.#o.size.height)}))}paintImage(t,s){this.draw((i=>{if(!t)return;const e=i.globalAlpha;i.globalAlpha=s,i.drawImage(t,U.x,U.y,this.#o.size.width,this.#o.size.height),i.globalAlpha=e}))}setContext(t){this.#c=t,this.#c&&(this.#c.globalCompositeOperation=V)}setContextSettings(t){this.#l=t}stop(){this.draw((t=>{t.clearRect(U.x,U.y,this.#o.size.width,this.#o.size.height)}))}#C(t){for(const s of this.#g)s.afterDraw?.(t)}#P(t,s,i,e,h,o){for(const n of this.#y){if(n.getColorStyles){const{fill:o,stroke:a}=n.getColorStyles(s,t,i,e);o&&(h.fill=o),a&&(h.stroke=a)}if(n.getTransformValues){const t=n.getTransformValues(s);for(const s in t)Bs(o,t,s)}n.beforeDraw?.(s)}}#L(t,s){if(!t?.drawAfter)return;const{particle:i}=s;i.effect&&t.drawAfter(s)}#S(t,s){if(!t?.drawBefore)return;const{particle:i}=s;i.effect&&t.drawBefore(s)}#z(t){const{container:s,context:i,particle:e,delta:h,colorStyles:o,radius:n,opacity:a,transform:r}=t,{effectDrawers:c,shapeDrawers:l}=s,d=e.getPosition(),f=e.getTransformData(r),u=H,p={x:d.x,y:d.y};i.setTransform(f.a,f.b,f.c,f.d,d.x,d.y),o.fill&&(i.fillStyle=o.fill);const w=!!e.fillEnabled,v=e.strokeWidth??j;i.lineWidth=v,o.stroke&&(i.strokeStyle=o.stroke);const g={context:i,particle:e,radius:n,drawRadius:n*u,opacity:a,delta:h,pixelRatio:s.retina.pixelRatio,fill:w,stroke:v>j,transformData:f,position:{...d},drawPosition:p,drawScale:u};for(const t of s.plugins)t.drawParticleTransform?.(g);const y=e.effect?c.get(e.effect):void 0,m=e.shape?l.get(e.shape):void 0;this.#S(y,g),this.#R(m,g),this.#D(m,g),this.#O(m,g),this.#L(y,g),i.resetTransform()}#k(t,s,i,e){s.drawParticle&&s.drawParticle(t,i,e)}#D(t,s){if(!t)return;const{context:i,fill:e,particle:h,stroke:o}=s;h.shape&&(i.beginPath(),t.draw(s),h.shapeClose&&i.closePath(),e&&i.fill(),o&&i.stroke())}#O(t,s){if(!t?.afterDraw)return;const{particle:i}=s;i.shape&&t.afterDraw(s)}#R(t,s){if(!t?.beforeDraw)return;const{particle:i}=s;i.shape&&t.beforeDraw(s)}#M(t){let s,i;for(const e of this.#r)if(!s&&e.particleFillColor&&(s=Rs(this.#s,e.particleFillColor(t))),!i&&e.particleStrokeColor&&(i=Rs(this.#s,e.particleStrokeColor(t))),s&&i)break;return this.#b[0]=s,this.#b[1]=i,this.#b}}const Fs=new WeakMap;function Es(t,s,i=!1){if(!s)return;const e=t.style,h=new Set;for(let t=0;t<e.length;t++){const s=e.item(t);s&&h.add(s)}for(let t=0;t<s.length;t++){const i=s.item(t);i&&h.add(i)}for(const t of h){const h=s.getPropertyValue(t);h?e.setProperty(t,h,i?"important":""):e.removeProperty(t)}}class As{domElement;render;renderCanvas;size;zoom=H;#t;#$;#T;#B;#s;#I;#F;#E;#A;constructor(t,s){this.#s=t,this.#t=s,this.render=new Is(t,s,this),this.#E={height:0,width:0};const i=s.retina.pixelRatio,e=this.#E;this.size={height:e.height*i,width:e.width*i},this.#$=!1,this.#F=[],this.#I="none"}get#U(){return this.#t.actualOptions.fullScreen.enable}destroy(){if(this.stop(),this.#$){const t=this.domElement;t?.remove(),this.domElement=void 0,this.renderCanvas=void 0}else this.#q();this.render.destroy(),this.#F=[]}getZoomCenter(){const t=this.#t.retina.pixelRatio,{width:s,height:i}=this.size;return this.#A?this.#A:{x:s*L/t,y:i*L/t}}init(){this.#V((t=>{t.disconnect()})),this.#T=Y((t=>{for(const s of t)"attributes"===s.type&&"style"===s.attributeName&&this.#j()})),this.resize(),this.#H(),this.initBackground(),this.#V((t=>{const s=this.domElement;s&&s instanceof Node&&t.observe(s,{attributes:!0})})),this.initPlugins(),this.#W(),this.render.init()}initBackground(){const t=this.#t,s=t.actualOptions.background,i=this.domElement;if(!i)return;const e=i.style,h=Ls(this.#s,s.color);e.backgroundColor=h?Os(h,t.actualOptions.hdr,s.opacity):"",e.backgroundImage=s.image||"",e.backgroundPosition=s.position||"",e.backgroundRepeat=s.repeat||"",e.backgroundSize=s.size||""}initPlugins(){this.#F=[];for(const t of this.#t.plugins)t.resize&&this.#F.push(t)}loadCanvas(t){this.#$&&this.domElement&&this.domElement.remove();const s=(t=>"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement)(t)?t:void 0;this.domElement=s,this.#$=!!s&&"true"===s.dataset[_],this.renderCanvas=s?(t=>{const s=Fs.get(t);if(s)return s;if("function"!=typeof t.transferControlToOffscreen)throw new TypeError("OffscreenCanvas is required but not supported by this browser");try{const s=t.transferControlToOffscreen();return Fs.set(t,s),s}catch{throw new TypeError("OffscreenCanvas transfer failed")}})(s):t;const i=this.domElement;i&&(i.ariaHidden="true",this.#B=G(i.style));const e=this.#E,h=this.renderCanvas;i?(e.height=i.offsetHeight,e.width=i.offsetWidth):(e.height=h.height,e.width=h.width);const o=this.#t.retina.pixelRatio,n=this.size;h.height=n.height=e.height*o,h.width=n.width=e.width*o}resize(){const t=this.domElement;if(!t)return!1;const s=this.#t,i=this.renderCanvas;if(void 0===i)return!1;const e=s.canvas.#E,h={width:t.offsetWidth,height:t.offsetHeight},o=s.retina.pixelRatio,n={width:h.width*o,height:h.height*o};if(h.height===e.height&&h.width===e.width&&n.height===i.height&&n.width===i.width)return!1;const a={...e};e.height=h.height,e.width=h.width;const r=this.size;return i.width=r.width=n.width,i.height=r.height=n.height,this.#t.started&&s.particles.setResizeFactor({width:e.width/a.width,height:e.height/a.height}),!0}setPointerEvents(t){this.domElement&&(this.#I=t,this.#j())}setZoom(t,s){this.zoom=t,this.#A=s}stop(){this.#V((t=>{t.disconnect()})),this.#T=void 0,this.render.stop()}async windowResize(){if(!this.domElement||!this.resize())return;const t=this.#t,s=t.updateActualOptions();t.particles.setDensity(),this.#X(),s&&await t.refresh()}#X(){for(const t of this.#F)t.resize?.()}#W(){const t=this.#t.actualOptions.hdr&&N("(color-gamut: p3)")?.matches&&N("(dynamic-range: high)")?.matches;this.render.setContextSettings({alpha:!0,desynchronized:!0,willReadFrequently:!1,...t?{colorSpace:"display-p3",colorType:"float16"}:{colorSpace:"srgb"}});const s=this.renderCanvas;s&&this.render.setContext(s.getContext("2d",this.render.settings))}#H(){const t=this.domElement,s=this.#t.actualOptions;if(t){this.#U?this.#Y():this.#q();for(const i in s.style){if(!i||!(i in s.style))continue;const e=s.style[i];e&&t.style.setProperty(i,e,"important")}}}#j(){const t=this.domElement;if(!t)return;this.#V((t=>{t.disconnect()})),this.#H(),this.initBackground();const s=this.#I;t.style.pointerEvents=s,t.style.setProperty("pointer-events",s),this.#V((s=>{t instanceof Node&&s.observe(t,{attributes:!0})}))}#q(){const t=this.domElement,s=this.#B;t&&s&&Es(t,s,!0)}#V(t){this.#T&&t(this.#T)}#Y(){const t=this.domElement;t&&Es(t,Q(this.#t.actualOptions.fullScreen.zIndex),!0)}}class Us{#t;#_;#G;#N;constructor(t){this.#t=t,this.#_={visibilityChange:()=>{this.#Q()},resize:()=>{this.#Z()}}}addListeners(){this.#K(!0)}removeListeners(){this.#K(!1)}#Q(){const t=this.#t;t.actualOptions.pauseOnBlur&&(Z().hidden?(t.pageHidden=!0,t.pause()):(t.pageHidden=!1,t.animationStatus?t.play(!0):t.draw(!0)))}#Z(){this.#N&&(clearTimeout(this.#N),this.#N=void 0);const t=async()=>{const t=this.#t.canvas;await t.windowResize()};this.#N=setTimeout((()=>{t()}),this.#t.actualOptions.resize.delay*K)}#K(t){const s=this.#_;this.#J(t),J(document,tt,s.visibilityChange,t,!1)}#J(t){const s=this.#_,i=this.#t;if(!i.actualOptions.resize.enable)return;if("undefined"==typeof ResizeObserver)return void J(globalThis,st,s.resize,t);const e=i.canvas.domElement;this.#G&&!t?(e&&this.#G.unobserve(e),this.#G.disconnect(),this.#G=void 0):!this.#G&&t&&e&&(this.#G=new ResizeObserver((t=>{t.find((t=>t.target===e))&&this.#Z()})),this.#G.observe(e))}}function qs(t){if(!xt(t.outMode,t.checkModes))return;const s=t.radius*S;t.coord>t.maxCoord-s?t.setCb(-t.radius):t.coord<s&&t.setCb(t.radius)}function Vs(t,s){const i=t%s;return i<ht?i+s:i}class js{backColor;bubble;destroyed;direction;effect;effectClose;effectData;fillColor;fillEnabled;fillOpacity;group;id;ignoresResizeRatio;initialPosition;initialVelocity;isRotating;justWarped;lastPathTime;misplaced;moveCenter;offset;opacity;options;outType;pathRotation;position;randomIndexData;retina;roll;rotation;shape;shapeClose;shapeData;sides;size;slow;spawning;strokeColor;strokeOpacity;strokeWidth;unbreakable;velocity;zIndexFactor;#tt={fillOpacity:P,opacity:P,strokeOpacity:P};#st=it.origin;#it={sin:0,cos:0};#et={a:1,b:0,c:0,d:1};#t;#s;constructor(t,s){this.#s=t,this.#t=s}destroy(t){if(this.unbreakable||this.destroyed)return;this.destroyed=!0,this.bubble.inRange=!1,this.slow.inRange=!1;const s=this.#t,i=this.shape?s.shapeDrawers.get(this.shape):void 0;i?.particleDestroy?.(this);for(const i of s.particleDestroyedPlugins)i.particleDestroyed?.(this,t);for(const i of s.particleUpdaters)i.particleDestroyed?.(this,t);this.#t.dispatchEvent(et.particleDestroyed,{particle:this})}draw(t){const s=this.#t.canvas.render;s.drawParticlePlugins(this,t),s.drawParticle(this,t)}getAngle(){return this.rotation+(this.pathRotation?this.velocity.angle:ht)}getFillColor(){return this.#ht(this.bubble.color??Ts(this.fillColor))}getMass(){return this.getRadius()**i*Math.PI*L}getOpacity(){const t=(W-this.zIndexFactor)**this.options.zIndex.opacityRate,s=this.bubble.opacity??yt(this.opacity?.value??P),i=this.strokeOpacity??P;return this.#tt.fillOpacity=s*(this.fillOpacity??P)*t,this.#tt.opacity=s*t,this.#tt.strokeOpacity=s*i*t,this.#tt}getPosition(){return this.#st.x=this.position.x+this.offset.x,this.#st.y=this.position.y+this.offset.y,this.#st.z=this.position.z,this.#st}getRadius(){return this.bubble.radius??this.size.value}getRotateData(){const t=this.getAngle();return this.#it.sin=Math.sin(t),this.#it.cos=Math.cos(t),this.#it}getStrokeColor(){return this.#ht(this.bubble.color??Ts(this.strokeColor))}getTransformData(t){const s=this.getRotateData(),i=this.isRotating;return this.#et.a=s.cos*(t.a??ot.a),this.#et.b=i?s.sin*(t.b??$):t.b??ot.b,this.#et.c=i?-s.sin*(t.c??$):t.c??ot.c,this.#et.d=s.cos*(t.d??ot.d),this.#et}init(t,s,i,e){const h=this.#t;!function(t,s,i){t.id=s,t.group=i,t.justWarped=!1,t.effectClose=!0,t.shapeClose=!0,t.pathRotation=!1,t.lastPathTime=0,t.destroyed=!1,t.unbreakable=!1,t.isRotating=!1,t.rotation=0,t.misplaced=!1,t.retina={maxDistance:{},maxSpeed:0,moveDrift:0,moveSpeed:0,sizeAnimationSpeed:0},t.size={value:1,max:1,min:1,enable:!1},t.outType=vt.normal,t.ignoresResizeRatio=!0}(this,t,e),this.options=function(t,s,i,e){const h=Ps(i,s,s.actualOptions.particles),o=h.reduceDuplicates;t.effect=bt(h.effect.type,t.id,o),t.shape=bt(h.shape.type,t.id,o);const n=h.effect,a=h.shape;if(e){if(e.effect){const s=e.effect.type;if(s&&s!==t.effect){const i=bt(s,t.id,o);i&&(t.effect=i)}n.load(e.effect)}if(e.shape){const s=e.shape.type;if(s&&s!==t.shape){const i=bt(s,t.id,o);i&&(t.shape=i)}a.load(e.shape)}}if(t.effect===z){const i=[...s.effectDrawers.keys()];t.effect=i[Math.floor(lt()*i.length)]}if(t.shape===z){const i=[...s.shapeDrawers.keys()];t.shape=i[Math.floor(lt()*i.length)]}t.effectData=t.effect?function(t,s,i,e){return u({close:s.close},bt(s.options[t],i,e))}(t.effect,n,t.id,o):void 0,t.shapeData=t.shape?function(t,s,i,e){return u({close:s.close},bt(s.options[t],i,e))}(t.shape,a,t.id,o):void 0,h.load(e);const r=t.effectData,c=t.shapeData;return r&&h.load(r.particles),c&&h.load(c.particles),t.effectClose=r?.close??h.effect.close,t.shapeClose=c?.close??h.shape.close,h}(this,h,this.#s,i),h.retina.initParticle(this),function(t,s){for(const i of t)i.preInit?.(s)}(h.particleUpdaters,this),this.bubble={inRange:!1},this.slow={inRange:!1,factor:1},this.#ot(s),this.initialVelocity=this.#nt(),this.velocity=this.initialVelocity.copy(),this.zIndexFactor=this.position.z/h.zLayers,this.sides=24,function(t,s){let i,e;t.effect&&(i=s.effectDrawers.get(t.effect)),i?.loadEffect&&i.loadEffect(t),t.shape&&(e=s.shapeDrawers.get(t.shape)),e?.loadShape&&e.loadShape(t);const h=e?.getSidesCount;h&&(t.sides=h(t))}(this,h),this.spawning=!1,function(t,s){for(const i of t)i.init(s)}(h.particleUpdaters,this),function(t,s){const i=s.shape?t.shapeDrawers.get(s.shape):void 0,e=s.effect?t.effectDrawers.get(s.effect):void 0;e?.particleInit?.(t,s),i?.particleInit?.(t,s)}(h,this),function(t,s){for(const i of t.particleCreatedPlugins)i.particleCreated?.(s)}(h,this)}isInsideCanvas(t){return this.#at({direction:t}).inside}isInsideCanvasForOutMode(t,s){return this.#at({direction:s,outMode:t}).inside}isShowingBack(){if(!this.roll)return!1;const t=this.roll.angle;if(this.roll.horizontal&&this.roll.vertical){const s=Vs(t,Mt);return s>=Math.PI*L&&s<Math.PI*F*L}if(this.roll.horizontal){const s=Vs(t+Math.PI*L,Mt);return s>=Math.PI&&s<Math.PI*S}if(this.roll.vertical){const s=Vs(t,Mt);return s>=Math.PI&&s<Math.PI*S}return!1}isVisible(){return!this.destroyed&&!this.spawning&&this.isInsideCanvas()}reset(){for(const t of this.#t.particleUpdaters)t.reset?.(this)}#rt(t,s){let i=nt,e=t?it.create(t.x,t.y,s):void 0;const h=this.#t,o=h.particlePositionPlugins,n=this.options.move.outModes,a=this.getRadius(),r=h.canvas.size;for(;;){for(const t of o){const i=t.particlePosition?.(e,this);if(i)return it.create(i.x,i.y,s)}const t=mt({size:r,position:e}),c=it.create(t.x,t.y,s);this.#ct(c,a,n.left??n.default),this.#ct(c,a,n.right??n.default),this.#lt(c,a,n.top??n.default),this.#lt(c,a,n.bottom??n.default);let l=!0;for(const t of h.particles.checkParticlePositionPlugins)if(l=t.checkParticlePosition?.(this,c,i)??!0,!l)break;if(l)return c;i+=at,e=void 0}}#nt(){const t=this.options.move,s=rt(this.direction).copy();if(t.direction===v.inside||t.direction===v.outside)return s;const i=Pt(yt(t.angle.value)),e=Pt(yt(t.angle.offset)),o={left:e-i*L,right:e+i*L};return t.straight||(s.angle+=ct(h(o.left,o.right))),t.random&&"number"==typeof t.speed&&(s.length*=lt()),s}#ct(t,s,i){qs({outMode:i,checkModes:[w.bounce],coord:t.x,maxCoord:this.#t.canvas.size.width,setCb:s=>t.x+=s,radius:s})}#lt(t,s,i){qs({outMode:i,checkModes:[w.bounce],coord:t.y,maxCoord:this.#t.canvas.size.height,setCb:s=>t.y+=s,radius:s})}#dt(t,s){const i=this.getRadius(),e=this.#t.canvas.size,h=this.position,o=s===w.bounce;return t===dt.bottom?{inside:o?h.y+i<e.height:h.y-i<e.height,reason:"default"}:t===dt.left?{inside:o?h.x-i>ht:h.x+i>ht,reason:"default"}:t===dt.right?{inside:o?h.x+i<e.width:h.x-i<e.width,reason:"default"}:t===dt.top?{inside:o?h.y-i>ht:h.y+i>ht,reason:"default"}:{inside:h.x>=-i&&h.y>=-i&&h.y<=e.height+i&&h.x<=e.width+i,reason:"default"}}#ft(t,s){return{canvasSize:this.#t.canvas.size,direction:t,outMode:s,particle:this,radius:this.getRadius()}}#at(t){const s=this.#dt(t.direction,t.outMode),i=this.#t,e=this.shape?i.shapeDrawers.get(this.shape):void 0,h=this.effect?i.effectDrawers.get(this.effect):void 0,o=e?.isInsideCanvas,n=h?.isInsideCanvas;if(!o&&!n)return s;const a=this.#ft(t.direction,t.outMode),r=o?this.#ut(o(a),"shape"):void 0,c=n?this.#ut(n(a),"effect"):void 0;if(r&&c){const t=Math.max(r.margin??ht,c.margin??ht);return{inside:r.inside&&c.inside,margin:t>ht?t:void 0,reason:"combined"}}return r??c??s}#ht(t){return t&&this.roll&&(this.backColor||this.roll.alter)&&this.isShowingBack()?this.backColor?this.backColor:this.roll.alter?function(t,s,i){return{h:t.h,s:t.s,l:t.l+(s===C.darken?-k:k)*i}}(t,this.roll.alter.type,this.roll.alter.value):t:t}#ot(t){const s=this.#t,i=Math.floor(yt(this.options.zIndex.value)),e=this.#rt(t,ft(i,ut,s.zLayers));if(!e)throw new Error("a valid position cannot be found for particle");switch(this.position=e,this.initialPosition=this.position.copy(),this.moveCenter={...pt(this.options.move.center,s.canvas.size),radius:this.options.move.center.radius,mode:this.options.move.center.mode},this.direction=wt(this.options.move.direction,this.position,this.moveCenter),this.options.move.direction){case v.inside:this.outType=vt.inside;break;case v.outside:this.outType=vt.outside}this.offset=gt.origin}#ut(t,s){return"boolean"==typeof t?{inside:t,reason:s}:{inside:t.inside,margin:t.margin,reason:t.reason??s}}}class Hs{#pt;#wt=new Map;#vt=[];#gt;#yt;#mt=[];#bt;constructor(t){this.#pt=t,this.#gt=0,this.#bt=0}clear(){this.#wt.clear();const t=this.#yt;t&&(this.#pt=t),this.#yt=void 0}insert(t){const{x:s,y:i}=t.getPosition(),e=this.#xt(s,i);this.#wt.has(e)||this.#wt.set(e,[]),this.#wt.get(e)?.push(t)}query(t,s,i=[]){const e=this.#Mt(t);if(!e)return i;const h=Math.floor(e.minX/this.#pt),o=Math.floor(e.maxX/this.#pt),n=Math.floor(e.minY/this.#pt),a=Math.floor(e.maxY/this.#pt);for(let e=h;e<=o;e++)for(let h=n;h<=a;h++){const o=this.#wt.get(`${e}_${h}`);if(o)for(const e of o)s&&!s(e)||t.contains(e.getPosition())&&i.push(e)}return i}queryCircle(t,s,i,e=[]){const h=this.#Pt(t.x,t.y,s),o=this.query(h,i,e);return this.#zt(),o}queryRectangle(t,s,i,e=[]){const h=this.#Ct(t.x,t.y,s.width,s.height),o=this.query(h,i,e);return this.#zt(),o}setCellSize(t){this.#yt=t}#Pt(t,s,i){return(this.#vt[this.#gt++]??=new jt(t,s,i)).reset(t,s,i)}#Ct(t,s,i,e){return(this.#mt[this.#bt++]??=new Ht(t,s,i,e)).reset(t,s,i,e)}#xt(t,s){return`${Math.floor(t/this.#pt)}_${Math.floor(s/this.#pt)}`}#Mt(t){if(t instanceof jt){const s=t.radius,{x:i,y:e}=t.position;return{minX:i-s,maxX:i+s,minY:e-s,maxY:e+s}}if(t instanceof Ht){const{x:s,y:i}=t.position,{width:e,height:h}=t.size;return{minX:s,maxX:s+e,minY:i,maxY:i+h}}return null}#zt(){this.#gt=0,this.#bt=0}}class Ws{checkParticlePositionPlugins;grid;#kt;#t;#Lt;#St;#Rt;#Dt;#Ot;#$t;#s;#Tt;#Bt;#It;#Ft;#Et;#At;constructor(t,s){this.#s=t,this.#t=s,this.#Rt=0,this.#kt=[],this.#Tt=[],this.#St=0,this.#Lt=new Map,this.#Dt=new Map,this.#At=this.#Ut(this.#t.zLayers),this.grid=new Hs(zt),this.checkParticlePositionPlugins=[],this.#Ot=[],this.#$t=[],this.#It=[],this.#Bt=[],this.#Et=[]}get count(){return this.#kt.length}addParticle(t,s,i,e){const h=this.#t.actualOptions.particles.number.limit.mode,o=void 0===i?this.#St:this.#Lt.get(i)??this.#St,n=this.count;if(o>Ct)switch(h){case m.delete:{const t=n+$t-o;t>kt&&this.removeQuantity(t);break}case m.wait:if(n>=o)return}try{const h=this.#Tt.pop()??new js(this.#s,this.#t);h.init(this.#Rt,t,s,i);let o=!0;return e&&(o=e(h)),o?(this.#kt.push(h),this.#qt(h),this.#Rt++,this.#t.dispatchEvent(et.particleAdded,{particle:h}),h):void this.#Tt.push(h)}catch(t){Lt().warning(`error adding particle: ${t}`)}}clear(){this.#kt=[],this.#Dt.clear(),this.#Vt(this.#t.zLayers)}destroy(){this.#kt=[],this.#Tt.length=0,this.#Dt.clear(),this.#At=[],this.checkParticlePositionPlugins=[],this.#Ot=[],this.#$t=[],this.#It=[],this.#Bt=[],this.#Et=[]}drawParticles(t){for(let s=this.#At.length-Tt;s>=St;s--){const i=this.#At[s];if(i)for(const s of i)s.draw(t)}}filter(t){return this.#kt.filter(t)}find(t){return this.#kt.find(t)}get(t){return this.#kt[t]}async init(){const t=this.#t,s=t.actualOptions;this.checkParticlePositionPlugins=[],this.#Et=[],this.#$t=[],this.#It=[],this.#Ot=[],this.#Bt=[],this.#Dt.clear(),this.#Vt(t.zLayers),this.grid=new Hs(zt*t.retina.pixelRatio);for(const s of t.plugins)s.redrawInit&&await s.redrawInit(),s.checkParticlePosition&&this.checkParticlePositionPlugins.push(s),s.update&&this.#Et.push(s),s.particleUpdate&&this.#$t.push(s),s.postUpdate&&this.#It.push(s),s.particleReset&&this.#Ot.push(s),s.postParticleUpdate&&this.#Bt.push(s);await this.#t.initDrawersAndUpdaters();for(const s of this.#t.effectDrawers.values())await(s.init?.(t));for(const s of this.#t.shapeDrawers.values())await(s.init?.(t));let i=!1;for(const s of t.plugins)if(i=s.particlesInitialization?.()??i,i)break;if(!i){const t=s.particles,i=t.groups;for(const s in i){const e=i[s];if(e)for(let i=this.count,h=0;h<e.number.value&&i<t.number.value;i++,h++)this.addParticle(void 0,e,s)}for(let s=this.count;s<t.number.value;s++)this.addParticle()}}push(t,s,i,e){for(let h=0;h<t;h++)this.addParticle(s,i,e)}async redraw(){this.clear(),await this.init(),this.#t.canvas.render.drawParticles({value:0,factor:0})}remove(t,s,i){this.removeAt(this.#kt.indexOf(t),void 0,s,i)}removeAt(t,s=Rt,i,e){if(t<St||t>this.count)return;let h=0;for(let o=t;h<s&&o<this.count;o++)this.#jt(o,i,e)&&(o--,h++)}removeQuantity(t,s){this.removeAt(St,t,s)}setDensity(){const t=this.#t.actualOptions,s=t.particles.groups;let i=0;for(const t of this.#t.plugins)t.particlesDensityCount&&(i+=t.particlesDensityCount());for(const t in s){const e=s[t];if(!e)continue;const h=Ps(this.#s,this.#t,e);this.#Ht(h,i,t)}this.#Ht(t.particles,i)}setResizeFactor(t){this.#Ft=t}update(t){this.grid.clear();for(const s of this.#Et)s.update?.(t);const s=this.#Wt(t);for(const s of this.#It)s.postUpdate?.(t);if(this.#Xt(t,s),s.size)for(const t of s)this.remove(t);this.#Ft=void 0}#Yt(...t){this.#Tt.push(...t)}#Ht(t,s,i,e){const h=t.number;if(!h.density.enable)return void(void 0===i?this.#St=h.limit.value:(e?.number.limit.value??h.limit.value)&&this.#Lt.set(i,e?.number.limit.value??h.limit.value));const o=this.#_t(h.density),n=h.value,a=Math.min(n,h.limit.value>Ct?h.limit.value:n)*o+s,r=Math.min(this.count,this.filter((t=>t.group===i)).length);void 0===i?this.#St=h.limit.value*o:this.#Lt.set(i,h.limit.value*o),r<a?this.push(Math.abs(a-r),void 0,t,i):r>a&&this.removeQuantity(r-a,i)}#Ut(t){const s=Math.max(Math.floor(t),Tt);return Array.from({length:s},(()=>[]))}#Gt(t){const s=this.#At.length-Tt;return s<=St?St:Math.min(Math.max(Math.floor(t),St),s)}#_t(t){const s=this.#t;if(!t.enable)return Dt;const e=s.canvas.size;return e.width&&e.height?e.width*e.height/(t.height*t.width*s.retina.pixelRatio**i):Dt}#qt(t){const s=this.#Gt(t.position.z),i=this.#At[s];i&&(i.push(t),this.#Dt.set(t.id,s))}#jt(t,s,i){const e=this.#kt[t];return!!e&&e.group===s&&(this.#kt.splice(t,Ot),this.#Nt(e),e.destroy(i),this.#t.dispatchEvent(et.particleRemoved,{particle:e}),this.#Yt(e),!0)}#Nt(t){const s=this.#Dt.get(t.id)??this.#Gt(t.position.z),i=this.#At[s];if(!i)return void this.#Dt.delete(t.id);const e=i.findIndex((s=>s.id===t.id));e>=St&&i.splice(e,Ot),this.#Dt.delete(t.id)}#Vt(t){const s=Math.max(Math.floor(t),Tt);if(this.#At.length===s)for(const t of this.#At)t.length=St;else this.#At=this.#Ut(s)}#Qt(t){const s=this.#Gt(t.position.z),i=this.#Dt.get(t.id);if(void 0===i)return void this.#qt(t);if(i===s)return;const e=this.#At[i];if(e){const s=e.findIndex((s=>s.id===t.id));s>=St&&e.splice(s,Ot)}const h=this.#At[s];if(h){if(h.push(t),h.length>=S){const s=h[h.length-S];s&&t.id<s.id&&h.sort(((t,s)=>t.id-s.id))}this.#Dt.set(t.id,s)}else this.#Dt.set(t.id,s)}#Wt(t){const s=new Set,i=this.#Ft;for(const e of this.#kt){i&&!e.ignoresResizeRatio&&(e.position.x*=i.width,e.position.y*=i.height,e.initialPosition.x*=i.width,e.initialPosition.y*=i.height),e.ignoresResizeRatio=!1;for(const t of this.#Ot)t.particleReset?.(e);for(const s of this.#$t){if(e.destroyed)break;s.particleUpdate?.(e,t)}e.destroyed?s.add(e):this.grid.insert(e)}return s}#Xt(t,s){for(const i of this.#kt)if(i.destroyed)s.add(i);else{for(const s of this.#t.particleUpdaters)s.update(i,t);if(!i.spawning)for(const s of this.#Bt)s.postParticleUpdate?.(i,t);this.#Qt(i)}}}class Xs{pixelRatio;reduceFactor;#t;constructor(t){this.#t=t,this.pixelRatio=Bt,this.reduceFactor=It}init(){const t=this.#t;this.pixelRatio=t.actualOptions.detectRetina?devicePixelRatio:Bt,this.reduceFactor=It;const s=this.pixelRatio,i=t.canvas,e=i.domElement;e&&(i.size.width=e.offsetWidth*s,i.size.height=e.offsetHeight*s)}initParticle(t){const s=this.pixelRatio,i=t.options.move,e=i.distance,h=t.retina;h.maxSpeed=yt(i.gravity.maxSpeed)*s,h.moveDrift=yt(i.drift)*s,h.moveSpeed=yt(i.speed)*s;const o=h.maxDistance;o.horizontal=void 0===e.horizontal?void 0:e.horizontal*s,o.vertical=void 0===e.vertical?void 0:e.vertical*s}}function Ys(t){return!t.destroyed}function _s(t,s,...i){const e=new zs(t,s);return Xt(e,...i),e}class Gs{actualOptions;canvas;destroyed;effectDrawers;fpsLimit;hdr;id;pageHidden;particleCreatedPlugins;particleDestroyedPlugins;particlePositionPlugins;particleUpdaters;particles;plugins;retina;shapeDrawers;started;zLayers;#Zt;#Kt;#Jt={value:0,factor:0};#ts;#ss;#is;#es;#hs;#os;#ns;#as;#rs;#cs;#ls;#s;#ds;#fs;constructor(t){const{dispatchCallback:s,pluginManager:i,id:e,onDestroy:h,sourceOptions:o}=t;this.#s=i,this.#ts=s,this.#rs=h,this.id=Symbol(e),this.fpsLimit=120,this.hdr=!1,this.#ds=!1,this.#Zt=0,this.#is=0,this.#as=0,this.#hs=!0,this.started=!1,this.destroyed=!1,this.#ls=!0,this.#ns=0,this.zLayers=100,this.pageHidden=!1,this.#fs=o,this.#os=o,this.effectDrawers=new Map,this.shapeDrawers=new Map,this.particleUpdaters=[],this.retina=new Xs(this),this.canvas=new As(this.#s,this),this.particles=new Ws(this.#s,this),this.plugins=[],this.particleDestroyedPlugins=[],this.particleCreatedPlugins=[],this.particlePositionPlugins=[],this.#cs=_s(this.#s,this),this.actualOptions=_s(this.#s,this),this.#es=new Us(this),this.dispatchEvent(et.containerBuilt)}get animationStatus(){return!this.#ls&&!this.pageHidden&&Ys(this)}get options(){return this.#cs}get sourceOptions(){return this.#fs}addLifeTime(t){this.#as+=t}alive(){return!this.#is||this.#as<=this.#is}destroy(t=!0){if(Ys(this)){this.stop(),this.particles.destroy(),this.canvas.destroy();for(const[,t]of this.effectDrawers)t.destroy?.(this);for(const[,t]of this.shapeDrawers)t.destroy?.(this);for(const t of this.plugins)t.destroy?.();this.effectDrawers=new Map,this.shapeDrawers=new Map,this.particleUpdaters=[],this.plugins.length=0,this.#s.clearPlugins(this),this.destroyed=!0,this.#rs(t),this.dispatchEvent(et.containerDestroyed)}}dispatchEvent(t,s){this.#ts(t,{container:this,data:s})}draw(t){if(!Ys(this))return;let s=t;this.#ss=Ft((t=>{s&&(this.#ns=void 0,s=!1),this.#us(t)}))}async export(t,s={}){for(const i of this.plugins){if(!i.export)continue;const e=await i.export(t,s);if(e.supported)return e.blob}Lt().error(`Export plugin with type ${t} not found`)}async init(){if(!Ys(this))return;const t=new Map;for(const s of this.#s.plugins){const i=await s.getPlugin(this);i.preInit&&await i.preInit(),t.set(s,i)}await this.initDrawersAndUpdaters(),this.#cs=_s(this.#s,this,this.#os,this.sourceOptions),this.actualOptions=_s(this.#s,this,this.#cs),this.plugins.length=0,this.particleDestroyedPlugins.length=0,this.particleCreatedPlugins.length=0,this.particlePositionPlugins.length=0;for(const[s,i]of t)s.needsPlugin(this.actualOptions)&&(this.plugins.push(i),i.particleCreated&&this.particleCreatedPlugins.push(i),i.particleDestroyed&&this.particleDestroyedPlugins.push(i),i.particlePosition&&this.particlePositionPlugins.push(i));this.retina.init(),this.canvas.init(),this.updateActualOptions(),this.canvas.initBackground(),this.canvas.resize();const{delay:s,duration:i,fpsLimit:e,hdr:h,smooth:o,zLayers:n}=this.actualOptions;this.hdr=h,this.zLayers=n,this.#is=yt(i)*K,this.#Zt=yt(s)*K,this.#as=0,this.fpsLimit=e>At?e:Et,this.#ds=o;for(const t of this.plugins)await(t.init?.());await this.particles.init(),this.dispatchEvent(et.containerInit),this.particles.setDensity();for(const t of this.plugins)t.particlesSetup?.();this.dispatchEvent(et.particlesSetup)}async initDrawersAndUpdaters(){const t=this.#s;this.effectDrawers=await t.getEffectDrawers(this,!0),this.shapeDrawers=await t.getShapeDrawers(this,!0),this.particleUpdaters=await t.getUpdaters(this,!0)}pause(){if(Ys(this)&&(void 0!==this.#ss&&(Ut(this.#ss),this.#ss=void 0),!this.#ls)){for(const t of this.plugins)t.pause?.();this.pageHidden||(this.#ls=!0),this.dispatchEvent(et.containerPaused)}}play(t){if(!Ys(this))return;const s=this.#ls||t;if(!this.#hs||this.actualOptions.autoPlay){if(this.#ls&&(this.#ls=!1),s)for(const t of this.plugins)t.play&&t.play();this.dispatchEvent(et.containerPlay),this.draw(s??!1)}else this.#hs=!1}async refresh(){if(Ys(this))return this.stop(),this.start()}async reset(t){if(Ys(this))return this.#os=t,this.#fs=t,this.#cs=_s(this.#s,this,this.#os,this.sourceOptions),this.actualOptions=_s(this.#s,this,this.#cs),this.refresh()}async start(){Ys(this)&&!this.started&&(await this.init(),this.started=!0,await new Promise((t=>{const s=async()=>{this.#es.addListeners();for(const t of this.plugins)await(t.start?.());this.dispatchEvent(et.containerStarted),this.play(),t()};this.#Kt=setTimeout((()=>{s()}),this.#Zt)})))}stop(){if(Ys(this)&&this.started){this.#Kt&&(clearTimeout(this.#Kt),this.#Kt=void 0),this.#hs=!0,this.started=!1,this.#es.removeListeners(),this.pause(),this.particles.clear(),this.canvas.stop();for(const t of this.plugins)t.stop?.();this.particleCreatedPlugins.length=0,this.particleDestroyedPlugins.length=0,this.particlePositionPlugins.length=0,this.#fs=this.#cs,this.dispatchEvent(et.containerStopped)}}updateActualOptions(){let t=!1;for(const s of this.plugins)s.updateActualOptions&&(t=s.updateActualOptions()||t);return t}#us(t){try{if(!this.#ds&&void 0!==this.#ns&&t<this.#ns+K/this.fpsLimit)return void this.draw(!1);if(this.#ns??=t,function(t,s,i=qt,e=!1){t.value=s,t.factor=e?qt/i:qt*s/K}(this.#Jt,t-this.#ns,this.fpsLimit,this.#ds),this.addLifeTime(this.#Jt.value),this.#ns=t,this.#Jt.value>K)return void this.draw(!1);if(this.canvas.render.drawParticles(this.#Jt),!this.alive())return void this.destroy();this.animationStatus&&this.draw(!1)}catch(t){Lt().error("error in animation loop",t)}}}export{Gs as Container}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const t="generated",n="source-over",e="resize",s="visibilitychange",i=100,a=.5,r=1e3,o={x:0,y:0,z:0},c={a:1,b:0,c:0,d:1},u="random",h=2,f=2*Math.PI,l=60,d="true",p="false",g="canvas",w=0,m=2,M=100,v=1,y=1,b=1,E=255,P=360,x=100,A=100,S=0,L=0,z=60,D=1,k=0,C=1,T=1,O=120,F=0,$=1,j=1,H=0,_=0,q=1,B=0,I=0,R=1,N=1,Q=0,U=1,G=0,V=1,W=0,J=400,K=3,X=6,Y=1,Z=1,tt=0,nt=1;var et;function st(t){return"z"in t?t.z:o.z}!function(t){t.bottom="bottom",t.bottomLeft="bottom-left",t.bottomRight="bottom-right",t.left="left",t.none="none",t.right="right",t.top="top",t.topLeft="top-left",t.topRight="top-right",t.outside="outside",t.inside="inside"}(et||(et={}));class it{x;y;z;constructor(t=o.x,n=o.y,e=o.z){this.x=t,this.y=n,this.z=e}static get origin(){return it.create(o.x,o.y,o.z)}get angle(){return Math.atan2(this.y,this.x)}set angle(t){this.#t(t,this.length)}get length(){return Math.sqrt(this.getLengthSq())}set length(t){this.#t(this.angle,t)}static clone(t){return it.create(t.x,t.y,st(t))}static create(t,n,e){return"number"==typeof t?new it(t,n??o.y,e??o.z):new it(t.x,t.y,st(t))}add(t){return it.create(this.x+t.x,this.y+t.y,this.z+st(t))}addTo(t){this.x+=t.x,this.y+=t.y,this.z+=st(t)}copy(){return it.clone(this)}div(t){return it.create(this.x/t,this.y/t,this.z/t)}getLengthSq(){return this.x**2+this.y**2}mult(t){return it.create(this.x*t,this.y*t,this.z*t)}multTo(t){this.x*=t,this.y*=t,this.z*=t}normalize(){const t=this.length;0!=t&&this.multTo(1/t)}rotate(t){return it.create(this.x*Math.cos(t)-this.y*Math.sin(t),this.x*Math.sin(t)+this.y*Math.cos(t),o.z)}setTo(t){this.x=t.x,this.y=t.y,this.z=st(t)}sub(t){return it.create(this.x-t.x,this.y-t.y,this.z-st(t))}subFrom(t){this.x-=t.x,this.y-=t.y,this.z-=st(t)}#t(t,n){this.x=Math.cos(t)*n,this.y=Math.sin(t)*n}}class at extends it{constructor(t=o.x,n=o.y){super(t,n,o.z)}static get origin(){return at.create(o.x,o.y)}static clone(t){return at.create(t.x,t.y)}static create(t,n){return"number"==typeof t?new at(t,n??o.y):new at(t.x,t.y)}}function rt(t){return"boolean"==typeof t}function ot(t){return"string"==typeof t}function ct(t){return"number"==typeof t}function ut(t){return"object"==typeof t&&null!==t}function ht(t){return Array.isArray(t)}function ft(t){return null==t}const lt=Math.PI/180;let dt=Math.random;function pt(){return Mt(dt(),0,1-Number.EPSILON)}function gt(t,n){return pt()*(n-t)+t}function wt(t){return requestAnimationFrame(t)}function mt(t){cancelAnimationFrame(t)}function Mt(t,n,e){return Math.min(Math.max(t,n),e)}function vt(t){const n=Et(t);let e=bt(t);return n===e&&(e=0),gt(e,n)}function yt(t){return ct(t)?t:vt(t)}function bt(t){return ct(t)?t:t.min}function Et(t){return ct(t)?t:t.max}function Pt(t,n){if(t===n||void 0===n&&ct(t))return t;const e=bt(t),s=Et(t);return void 0!==n?{min:Math.min(e,n),max:Math.max(s,n)}:Pt(e,s)}function xt(t,n,e){return function(t,n){const e=t.x-n.x,s=t.y-n.y;return e*e+s*s}(t,n)<=e*e}function At(t){return t*lt}function St(t,n,e){if(ct(t))return At(t);switch(t){case et.top:return.5*-Math.PI;case et.topRight:return.25*-Math.PI;case et.right:return 0;case et.bottomRight:return.25*Math.PI;case et.bottom:return.5*Math.PI;case et.bottomLeft:return.75*Math.PI;case et.left:return Math.PI;case et.topLeft:return.75*-Math.PI;case et.inside:return Math.atan2(e.y-n.y,e.x-n.x);case et.outside:return Math.atan2(n.y-e.y,n.x-e.x);default:return pt()*f}}function Lt(t){const n=at.origin;return n.length=1,n.angle=t,n}function zt(t){const{position:n,size:e}=t;return{x:n?.x??pt()*e.width,y:n?.y??pt()*e.height}}var Dt,kt;function Ct(){return globalThis.document}function Tt(t){if("undefined"!=typeof matchMedia)return matchMedia(t)}function Ot(t){if("undefined"!=typeof MutationObserver)return new MutationObserver(t)}function Ft(t,n){return t===n||ht(n)&&n.includes(t)}function $t(t,n,e=!0){return t[void 0!==n&&e?n%t.length:Math.floor(pt()*t.length)]}function jt(t,...n){for(const e of n){if(ft(e))continue;if(!ut(e)){t=e;continue}Array.isArray(e)?Array.isArray(t)||(t=[]):ut(t)&&!Array.isArray(t)||(t={});const n=Object.keys(e),s=new Set(["__proto__","constructor","prototype"]);if(n.some((t=>{const n=e[t];return ut(n)||Array.isArray(n)})))for(const i of n){if(s.has(i))continue;const n=t,a=e[i];n[i]=Array.isArray(a)?a.map((t=>jt(void 0,t))):jt(n[i],a)}else{const i=e,a=t;for(const t of n)if(!s.has(t)&&t in i){const n=i[t];void 0!==n&&(a[t]=n)}}}return t}function Ht(t,n){return ht(t)?t.map(((t,e)=>n(t,e))):n(t,0)}function _t(t,n,e){return ht(t)?$t(t,n,e):t}function qt(t,n){return function(t,n){if(t.mode!==kt.percent){const{mode:n,...e}=t;return e}return"x"in t?{x:t.x/i*n.width,y:t.y/i*n.height}:{width:t.width/i*n.width,height:t.height/i*n.height}}(t,n)}function Bt(t){const n=Ct().createElement("div").style;for(const e in t){const s=t[e];if(!(e in t)||ft(s))continue;const i=t.getPropertyValue?.(s);if(!i)continue;const a=t.getPropertyPriority?.(s);a?n.setProperty(s,i,a):n.setProperty(s,i)}return n}let It,Rt;function Nt(t){if(It!==t||!Rt){It=t;const n=Ct().createElement("div").style,e=10,s={width:"100%",height:"100%",margin:"0",padding:"0",borderWidth:"0",position:"fixed",zIndex:t.toString(e),"z-index":t.toString(e),top:"0",left:"0","pointer-events":"none"};for(const t in s){const e=s[t];void 0!==e&&n.setProperty(t,e)}Rt=n}return Rt}function Qt(t,n,e,s,i){if(s){let s={passive:!0};rt(i)?s.capture=i:void 0!==i&&(s=i),t.addEventListener(n,e,s)}else t.removeEventListener(n,e,i)}async function Ut(t,n,e,s=!1){let i=n.get(t);if(!i||s){const s=await Promise.all([...e.entries()].map((([n,e])=>e(t).then((t=>[n,t])))));i=new Map(s),n.set(t,i)}return i}!function(t){t.bottom="bottom",t.left="left",t.right="right",t.top="top"}(Dt||(Dt={})),function(t){t.precise="precise",t.percent="percent"}(kt||(kt={}));class Gt{#n;constructor(){this.#n=new Map}addEventListener(t,n){this.removeEventListener(t,n);let e=this.#n.get(t);e||(e=[],this.#n.set(t,e)),e.push(n)}dispatchEvent(t,n){const e=this.#n.get(t);e?.forEach((t=>{t(n)}))}hasEventListener(t){return!!this.#n.get(t)}removeAllEventListeners(t){t?this.#n.delete(t):this.#n=new Map}removeEventListener(t,n){const e=this.#n.get(t);if(!e)return;const s=e.length,i=e.indexOf(n);i<0||(1===s?this.#n.delete(t):e.splice(i,1))}}var Vt;!function(t){t.configAdded="configAdded",t.containerInit="containerInit",t.particlesSetup="particlesSetup",t.containerStarted="containerStarted",t.containerStopped="containerStopped",t.containerDestroyed="containerDestroyed",t.containerPaused="containerPaused",t.containerPlay="containerPlay",t.containerBuilt="containerBuilt",t.particleAdded="particleAdded",t.particleDestroyed="particleDestroyed",t.particleRemoved="particleRemoved"}(Vt||(Vt={}));class Wt{colorManagers=new Map;easingFunctions=new Map;effectDrawers=new Map;initializers={effects:new Map,shapes:new Map,updaters:new Map};palettes=new Map;plugins=[];presets=new Map;shapeDrawers=new Map;updaters=new Map;#e=new Set;#s=new Map;#i;#a=new Set;#r=!1;#o=!1;#c=new Set;constructor(t){this.#i=t}get configs(){const t={};for(const[n,e]of this.#s)t[n]=e;return t}addColorManager(t,n){this.colorManagers.set(t,n)}addConfig(t){const n=t.key??t.name??"default";this.#s.set(n,t),this.#i.dispatchEvent(Vt.configAdded,{data:{name:n,config:t}})}addEasing(t,n){this.easingFunctions.get(t)||this.easingFunctions.set(t,n)}addEffect(t,n){this.initializers.effects.set(t,n)}addPalette(t,n){this.palettes.set(t,n)}addParticleUpdater(t,n){this.initializers.updaters.set(t,n)}addPlugin(t){this.getPlugin(t.id)||this.plugins.push(t)}addPreset(t,n,e=!1){!e&&this.getPreset(t)||this.presets.set(t,n)}addShape(t,n){for(const e of t)this.initializers.shapes.set(e,n)}clearPlugins(t){this.effectDrawers.delete(t),this.shapeDrawers.delete(t),this.updaters.delete(t)}getEasing(t){return this.easingFunctions.get(t)??(t=>t)}getEffectDrawers(t,n=!1){return Ut(t,this.effectDrawers,this.initializers.effects,n)}getPalette(t){return this.palettes.get(t)}getPlugin(t){return this.plugins.find((n=>n.id===t))}getPreset(t){return this.presets.get(t)}async getShapeDrawers(t,n=!1){return Ut(t,this.shapeDrawers,this.initializers.shapes,n)}async getUpdaters(t,n=!1){return async function(t,n,e,s=!1){let i=n.get(t);return i&&!s||(i=await Promise.all([...e.values()].map((n=>n(t)))),n.set(t,i)),i}(t,this.updaters,this.initializers.updaters,n)}async init(){if(!this.#r&&!this.#o){this.#o=!0,this.#a=new Set,this.#e=new Set(this.#c);try{for(const t of this.#e)await this.#u(t,this.#a,this.#e)}finally{this.#c.clear(),this.#o=!1,this.#r=!0}}}loadParticlesOptions(t,n,...e){const s=this.updaters.get(t);s&&s.forEach((t=>t.loadOptions?.(n,...e)))}async register(...t){if(this.#r)throw new Error("Register plugins can only be done before calling tsParticles.load()");for(const n of t)this.#o?await this.#u(n,this.#a,this.#e):this.#c.add(n)}async#u(t,n,e){n.has(t)||(n.add(t),e.add(t),await t(this.#i))}}const Jt=t=>(...n)=>{t(...n)},Kt={debug:Jt(console.debug),error:(t,...n)=>{console.error(`tsParticles - Error - ${t}`,...n)},info:Jt(console.info),log:Jt(console.log),trace:Jt(console.trace),verbose:Jt(console.log),warning:Jt(console.warn)};function Xt(){return Kt}const Yt="100%";var Zt,tn,nn,en,sn,an,rn,on,cn,un,hn;!function(t){t.circle="circle",t.rectangle="rectangle"}(Zt||(Zt={})),function(t){t.clockwise="clockwise",t.counterClockwise="counter-clockwise",t.random="random"}(tn||(tn={})),function(t){t.auto="auto",t.increase="increase",t.decrease="decrease",t.random="random"}(nn||(nn={})),function(t){t.delete="delete",t.wait="wait"}(en||(en={})),function(t){t.bounce="bounce",t.none="none",t.out="out",t.destroy="destroy",t.split="split"}(sn||(sn={})),function(t){t.darken="darken",t.enlighten="enlighten"}(an||(an={})),function(t){t.none="none",t.max="max",t.min="min"}(rn||(rn={})),function(t){t.linear="linear",t.radial="radial",t.random="random"}(on||(on={})),function(t){t.normal="normal",t.inside="inside",t.outside="outside"}(cn||(cn={})),function(t){t.max="max",t.min="min",t.random="random"}(un||(un={})),function(t){t.increasing="increasing",t.decreasing="decreasing"}(hn||(hn={}));const fn=new class{pluginManager=new Wt(this);#h=[];#f=new Gt;#r=!1;get items(){return this.#h}get version(){return"4.2.0"}addEventListener(t,n){this.#f.addEventListener(t,n)}checkVersion(t){if(this.version!==t)throw new Error(`The tsParticles version is different from the loaded plugins version. Engine version: ${this.version}. Plugin version: ${t}`)}dispatchEvent(t,n){this.#f.dispatchEvent(t,n)}async init(){this.#r||(await this.pluginManager.init(),this.#r=!0)}item(t){const n=this.items,e=n[t];if(!e?.destroyed)return e;n.splice(t,1)}async load(n){let e;await this.init(),"undefined"!=typeof HTMLElement&&n.element instanceof HTMLElement&&(e=n.element);const{Container:s}=await import("./p-PBQ5N1xQ.js"),i=n.id??e?.id??`tsparticles${Math.floor(1e4*pt()).toString()}`,{index:a,url:r}=n,o=r?await async function(t){const n=_t(t.url,t.index);if(!n)return t.fallback;const e=await fetch(n);return e.ok?await e.json():(Xt().error(`${e.status.toString()} while retrieving config file`),t.fallback)}({fallback:n.options,url:r,index:a}):n.options,c=_t(o,a),{items:u}=this,h=u.findIndex((t=>t.id.description===i)),f=new s({dispatchCallback:(t,n)=>{this.dispatchEvent(t,n)},id:i,onDestroy:t=>{if(!t)return;const n=this.items,e=n.indexOf(f);e>=0&&n.splice(e,1)},pluginManager:this.pluginManager,sourceOptions:c});if(h>=0){const t=this.item(h),n=t?1:0;t&&!t.destroyed&&t.destroy(!1),u.splice(h,n,f)}else u.push(f);const l="undefined"!=typeof OffscreenCanvas&&n.element instanceof OffscreenCanvas?n.element:(n=>{const e=Ct();let s;if(n instanceof HTMLCanvasElement||n.tagName.toLowerCase()===g)s=n,s.dataset[t]??=p,s.dataset[t]===d&&(s.style.width||=Yt,s.style.height||=Yt,s.style.pointerEvents="none",s.style.setProperty("pointer-events","none"));else{const i=n.getElementsByTagName(g).item(0);i?(s=i,s.dataset[t]=p):(s=e.createElement(g),s.dataset[t]=d,n.appendChild(s)),s.style.width||=Yt,s.style.height||=Yt,s.style.pointerEvents="none",s.style.setProperty("pointer-events","none")}return s})(((n,e)=>{const s=Ct();let i=e??s.getElementById(n);return i||(i=s.createElement("canvas"),i.id=n,i.dataset[t]=d,s.body.append(i),i)})(i,e));return f.canvas.loadCanvas(l),await f.start(),f}async refresh(t=!0){t&&await Promise.all(this.items.map((t=>t.refresh())))}removeEventListener(t,n){this.#f.removeEventListener(t,n)}};let ln,dn,pn=!1;async function gn(t){if(!pn)if(ln){if(dn!==t)throw new Error("initParticlesEngine callback must be stable across the app lifecycle.");await ln}else dn=t,ln=(async()=>{t&&await t(fn),"function"==typeof fn.init&&await fn.init(),pn=!0})().catch((t=>{throw ln=void 0,dn=void 0,pn=!1,t})),await ln}function wn(){return pn}async function mn(){await(null!=ln?ln:Promise.resolve())}export{Ct as $,an as A,E as B,gt as C,U as D,tt as E,J as F,X as G,K as H,Z as I,Y as J,o as K,en as L,et as M,k as N,sn as O,kt as P,n as Q,Zt as R,G as S,nt as T,C as U,D as V,Ot as W,t as X,Bt as Y,Tt as Z,Nt as _,ft as a,r as a0,Qt as a1,s as a2,e as a3,it as a4,Vt as a5,Q as a6,c as a7,w as a8,j as a9,y as aA,b as aB,wt as aC,O as aD,F as aE,mt as aF,l as aG,wn as aH,mn as aI,Lt as aa,vt as ab,pt as ac,Dt as ad,Mt as ae,H as af,qt as ag,St as ah,cn as ai,at as aj,yt as ak,zt as al,_t as am,Ft as an,f as ao,At as ap,M as aq,_ as ar,B as as,Xt as at,I as au,v as av,R as aw,N as ax,q as ay,$ as az,Pt as b,xt as c,P as d,A as e,L as f,x as g,S as h,gn as i,ot as j,ht as k,W as l,jt as m,ct as n,ut as o,Ht as p,rt as q,$t as r,m as s,fn as t,T as u,u as v,V as w,a as x,h as y,z}
|
|
1
|
+
const t="generated",n="source-over",e="resize",s="visibilitychange",i=100,a=.5,r=1e3,o={x:0,y:0,z:0},c={a:1,b:0,c:0,d:1},u="random",h=2,f=2*Math.PI,l=60,d="true",p="false",g="canvas",w=0,m=2,M=100,v=1,y=1,b=1,E=255,P=360,x=100,A=100,S=0,L=0,z=60,C=1,D=0,k=1,O=1,T=120,F=0,$=1,j=1,H=0,I=0,_=1,q=0,B=0,R=1,U=1,G=0,N=1,V=0,W=1,X=0,Y=400,J=3,K=6,Q=1,Z=1,tt=0,nt=1;var et;function st(t){return"z"in t?t.z:o.z}!function(t){t.bottom="bottom",t.bottomLeft="bottom-left",t.bottomRight="bottom-right",t.left="left",t.none="none",t.right="right",t.top="top",t.topLeft="top-left",t.topRight="top-right",t.outside="outside",t.inside="inside"}(et||(et={}));class it{x;y;z;constructor(t=o.x,n=o.y,e=o.z){this.x=t,this.y=n,this.z=e}static get origin(){return it.create(o.x,o.y,o.z)}get angle(){return Math.atan2(this.y,this.x)}set angle(t){this.#t(t,this.length)}get length(){return Math.sqrt(this.getLengthSq())}set length(t){this.#t(this.angle,t)}static clone(t){return it.create(t.x,t.y,st(t))}static create(t,n,e){return"number"==typeof t?new it(t,n??o.y,e??o.z):new it(t.x,t.y,st(t))}add(t){return it.create(this.x+t.x,this.y+t.y,this.z+st(t))}addTo(t){this.x+=t.x,this.y+=t.y,this.z+=st(t)}copy(){return it.clone(this)}div(t){return it.create(this.x/t,this.y/t,this.z/t)}getLengthSq(){return this.x**2+this.y**2}mult(t){return it.create(this.x*t,this.y*t,this.z*t)}multTo(t){this.x*=t,this.y*=t,this.z*=t}normalize(){const t=this.length;0!=t&&this.multTo(1/t)}rotate(t){return it.create(this.x*Math.cos(t)-this.y*Math.sin(t),this.x*Math.sin(t)+this.y*Math.cos(t),o.z)}setTo(t){this.x=t.x,this.y=t.y,this.z=st(t)}sub(t){return it.create(this.x-t.x,this.y-t.y,this.z-st(t))}subFrom(t){this.x-=t.x,this.y-=t.y,this.z-=st(t)}#t(t,n){this.x=Math.cos(t)*n,this.y=Math.sin(t)*n}}class at extends it{constructor(t=o.x,n=o.y){super(t,n,o.z)}static get origin(){return at.create(o.x,o.y)}static clone(t){return at.create(t.x,t.y)}static create(t,n){return"number"==typeof t?new at(t,n??o.y):new at(t.x,t.y)}}function rt(t){return"boolean"==typeof t}function ot(t){return"string"==typeof t}function ct(t){return"number"==typeof t}function ut(t){return"object"==typeof t&&null!==t}function ht(t){return Array.isArray(t)}function ft(t){return null==t}const lt=Math.PI/180;let dt=Math.random;function pt(){return Mt(dt(),0,1-Number.EPSILON)}function gt(t,n){return pt()*(n-t)+t}function wt(t){return requestAnimationFrame(t)}function mt(t){cancelAnimationFrame(t)}function Mt(t,n,e){return Math.min(Math.max(t,n),e)}function vt(t){const n=Et(t);let e=bt(t);return n===e&&(e=0),gt(e,n)}function yt(t){return ct(t)?t:vt(t)}function bt(t){return ct(t)?t:t.min}function Et(t){return ct(t)?t:t.max}function Pt(t,n){if(t===n||void 0===n&&ct(t))return t;const e=bt(t),s=Et(t);return void 0!==n?{min:Math.min(e,n),max:Math.max(s,n)}:Pt(e,s)}function xt(t,n,e){return function(t,n){const e=t.x-n.x,s=t.y-n.y;return e*e+s*s}(t,n)<=e*e}function At(t){return t*lt}function St(t,n,e){if(ct(t))return At(t);switch(t){case et.top:return.5*-Math.PI;case et.topRight:return.25*-Math.PI;case et.right:return 0;case et.bottomRight:return.25*Math.PI;case et.bottom:return.5*Math.PI;case et.bottomLeft:return.75*Math.PI;case et.left:return Math.PI;case et.topLeft:return.75*-Math.PI;case et.inside:return Math.atan2(e.y-n.y,e.x-n.x);case et.outside:return Math.atan2(n.y-e.y,n.x-e.x);default:return pt()*f}}function Lt(t){const n=at.origin;return n.length=1,n.angle=t,n}function zt(t){const{position:n,size:e}=t;return{x:n?.x??pt()*e.width,y:n?.y??pt()*e.height}}var Ct,Dt;function kt(){return globalThis.document}function Ot(t){if("undefined"!=typeof matchMedia)return matchMedia(t)}function Tt(t){if("undefined"!=typeof MutationObserver)return new MutationObserver(t)}function Ft(t,n){return t===n||ht(n)&&n.includes(t)}function $t(t,n,e=!0){return t[void 0!==n&&e?n%t.length:Math.floor(pt()*t.length)]}function jt(t,...n){for(const e of n){if(ft(e))continue;if(!ut(e)){t=e;continue}Array.isArray(e)?Array.isArray(t)||(t=[]):ut(t)&&!Array.isArray(t)||(t={});const n=Object.keys(e),s=new Set(["__proto__","constructor","prototype"]);if(n.some((t=>{const n=e[t];return ut(n)||Array.isArray(n)})))for(const i of n){if(s.has(i))continue;const n=t,a=e[i];n[i]=Array.isArray(a)?a.map((t=>jt(void 0,t))):jt(n[i],a)}else{const i=e,a=t;for(const t of n)if(!s.has(t)&&t in i){const n=i[t];void 0!==n&&(a[t]=n)}}}return t}function Ht(t,n){return ht(t)?t.map(((t,e)=>n(t,e))):n(t,0)}function It(t,n,e){return ht(t)?$t(t,n,e):t}function _t(t,n){return function(t,n){if(t.mode!==Dt.percent){const{mode:n,...e}=t;return e}return"x"in t?{x:t.x/i*n.width,y:t.y/i*n.height}:{width:t.width/i*n.width,height:t.height/i*n.height}}(t,n)}function qt(t){const n=kt().createElement("div").style;for(const e in t){const s=t[e];if(!(e in t)||ft(s))continue;const i=t.getPropertyValue?.(s);if(!i)continue;const a=t.getPropertyPriority?.(s);a?n.setProperty(s,i,a):n.setProperty(s,i)}return n}let Bt,Rt;function Ut(t){if(Bt!==t||!Rt){Bt=t;const n=kt().createElement("div").style,e=10,s={width:"100%",height:"100%",margin:"0",padding:"0",borderWidth:"0",position:"fixed",zIndex:t.toString(e),"z-index":t.toString(e),top:"0",left:"0","pointer-events":"none"};for(const t in s){const e=s[t];void 0!==e&&n.setProperty(t,e)}Rt=n}return Rt}function Gt(t,n,e,s,i){if(s){let s={passive:!0};rt(i)?s.capture=i:void 0!==i&&(s=i),t.addEventListener(n,e,s)}else t.removeEventListener(n,e,i)}async function Nt(t,n,e,s=!1){let i=n.get(t);if(!i||s){const s=await Promise.all([...e.entries()].map((([n,e])=>e(t).then((t=>[n,t])))));i=new Map(s),n.set(t,i)}return i}!function(t){t.bottom="bottom",t.left="left",t.right="right",t.top="top"}(Ct||(Ct={})),function(t){t.precise="precise",t.percent="percent"}(Dt||(Dt={}));class Vt{#n;constructor(){this.#n=new Map}addEventListener(t,n){this.removeEventListener(t,n);let e=this.#n.get(t);e||(e=[],this.#n.set(t,e)),e.push(n)}dispatchEvent(t,n){const e=this.#n.get(t);e?.forEach((t=>{t(n)}))}hasEventListener(t){return!!this.#n.get(t)}removeAllEventListeners(t){t?this.#n.delete(t):this.#n=new Map}removeEventListener(t,n){const e=this.#n.get(t);if(!e)return;const s=e.length,i=e.indexOf(n);i<0||(1===s?this.#n.delete(t):e.splice(i,1))}}var Wt;!function(t){t.configAdded="configAdded",t.containerInit="containerInit",t.particlesSetup="particlesSetup",t.containerStarted="containerStarted",t.containerStopped="containerStopped",t.containerDestroyed="containerDestroyed",t.containerPaused="containerPaused",t.containerPlay="containerPlay",t.containerBuilt="containerBuilt",t.particleAdded="particleAdded",t.particleDestroyed="particleDestroyed",t.particleRemoved="particleRemoved"}(Wt||(Wt={}));class Xt{colorManagers=new Map;easingFunctions=new Map;effectDrawers=new Map;initializers={effects:new Map,shapes:new Map,updaters:new Map};palettes=new Map;plugins=[];presets=new Map;shapeDrawers=new Map;updaters=new Map;#e=new Set;#s=new Map;#i;#a=new Set;#r=!1;#o=!1;#c=new Set;constructor(t){this.#i=t}get configs(){const t={};for(const[n,e]of this.#s)t[n]=e;return t}addColorManager(t,n){this.colorManagers.set(t,n)}addConfig(t){const n=t.key??t.name??"default";this.#s.set(n,t),this.#i.dispatchEvent(Wt.configAdded,{data:{name:n,config:t}})}addEasing(t,n){this.easingFunctions.get(t)||this.easingFunctions.set(t,n)}addEffect(t,n){this.initializers.effects.set(t,n)}addPalette(t,n){this.palettes.set(t,n)}addParticleUpdater(t,n){this.initializers.updaters.set(t,n)}addPlugin(t){this.getPlugin(t.id)||this.plugins.push(t)}addPreset(t,n,e=!1){!e&&this.getPreset(t)||this.presets.set(t,n)}addShape(t,n){for(const e of t)this.initializers.shapes.set(e,n)}clearPlugins(t){this.effectDrawers.delete(t),this.shapeDrawers.delete(t),this.updaters.delete(t)}getEasing(t){return this.easingFunctions.get(t)??(t=>t)}getEffectDrawers(t,n=!1){return Nt(t,this.effectDrawers,this.initializers.effects,n)}getPalette(t){return this.palettes.get(t)}getPlugin(t){return this.plugins.find((n=>n.id===t))}getPreset(t){return this.presets.get(t)}async getShapeDrawers(t,n=!1){return Nt(t,this.shapeDrawers,this.initializers.shapes,n)}async getUpdaters(t,n=!1){return async function(t,n,e,s=!1){let i=n.get(t);return i&&!s||(i=await Promise.all([...e.values()].map((n=>n(t)))),n.set(t,i)),i}(t,this.updaters,this.initializers.updaters,n)}async init(){if(!this.#r&&!this.#o){this.#o=!0,this.#a=new Set,this.#e=new Set(this.#c);try{for(const t of this.#e)await this.#u(t,this.#a,this.#e)}finally{this.#c.clear(),this.#o=!1,this.#r=!0}}}loadParticlesOptions(t,n,...e){const s=this.updaters.get(t);s&&s.forEach((t=>t.loadOptions?.(n,...e)))}async register(...t){if(this.#r)throw new Error("Register plugins can only be done before calling tsParticles.load()");for(const n of t)this.#o?await this.#u(n,this.#a,this.#e):this.#c.add(n)}async#u(t,n,e){n.has(t)||(n.add(t),e.add(t),await t(this.#i))}}const Yt=t=>(...n)=>{t(...n)},Jt={debug:Yt(console.debug),error:(t,...n)=>{console.error(`tsParticles - Error - ${t}`,...n)},info:Yt(console.info),log:Yt(console.log),trace:Yt(console.trace),verbose:Yt(console.log),warning:Yt(console.warn)};function Kt(){return Jt}const Qt="100%";var Zt,tn,nn,en,sn,an,rn,on,cn,un,hn;!function(t){t.circle="circle",t.rectangle="rectangle"}(Zt||(Zt={})),function(t){t.clockwise="clockwise",t.counterClockwise="counter-clockwise",t.random="random"}(tn||(tn={})),function(t){t.auto="auto",t.increase="increase",t.decrease="decrease",t.random="random"}(nn||(nn={})),function(t){t.delete="delete",t.wait="wait"}(en||(en={})),function(t){t.bounce="bounce",t.none="none",t.out="out",t.destroy="destroy",t.split="split"}(sn||(sn={})),function(t){t.darken="darken",t.enlighten="enlighten"}(an||(an={})),function(t){t.none="none",t.max="max",t.min="min"}(rn||(rn={})),function(t){t.linear="linear",t.radial="radial",t.random="random"}(on||(on={})),function(t){t.normal="normal",t.inside="inside",t.outside="outside"}(cn||(cn={})),function(t){t.max="max",t.min="min",t.random="random"}(un||(un={})),function(t){t.increasing="increasing",t.decreasing="decreasing"}(hn||(hn={}));const fn=new class{pluginManager=new Xt(this);#h=[];#f=new Vt;#r=!1;get items(){return this.#h}get version(){return"4.2.1"}addEventListener(t,n){this.#f.addEventListener(t,n)}checkVersion(t){if(this.version!==t)throw new Error(`The tsParticles version is different from the loaded plugins version. Engine version: ${this.version}. Plugin version: ${t}`)}dispatchEvent(t,n){this.#f.dispatchEvent(t,n)}async init(){this.#r||(await this.pluginManager.init(),this.#r=!0)}item(t){const n=this.items,e=n[t];if(!e?.destroyed)return e;n.splice(t,1)}async load(n){let e;await this.init(),"undefined"!=typeof HTMLElement&&n.element instanceof HTMLElement&&(e=n.element);const{Container:s}=await import("./p-CIUgBOXY.js"),i=n.id??e?.id??`tsparticles${Math.floor(1e4*pt()).toString()}`,{index:a,url:r}=n,o=r?await async function(t){const n=It(t.url,t.index);if(!n)return t.fallback;const e=await fetch(n);return e.ok?await e.json():(Kt().error(`${e.status.toString()} while retrieving config file`),t.fallback)}({fallback:n.options,url:r,index:a}):n.options,c=It(o,a),{items:u}=this,h=u.findIndex((t=>t.id.description===i)),f=new s({dispatchCallback:(t,n)=>{this.dispatchEvent(t,n)},id:i,onDestroy:t=>{if(!t)return;const n=this.items,e=n.indexOf(f);e>=0&&n.splice(e,1)},pluginManager:this.pluginManager,sourceOptions:c});if(h>=0){const t=this.item(h),n=t?1:0;t&&!t.destroyed&&t.destroy(!1),u.splice(h,n,f)}else u.push(f);const l="undefined"!=typeof OffscreenCanvas&&n.element instanceof OffscreenCanvas?n.element:(n=>{const e=kt();let s;if(n instanceof HTMLCanvasElement||n.tagName.toLowerCase()===g)s=n,s.dataset[t]??=p,s.dataset[t]===d&&(s.style.width||=Qt,s.style.height||=Qt,s.style.pointerEvents="none",s.style.setProperty("pointer-events","none"));else{const i=n.getElementsByTagName(g).item(0);i?(s=i,s.dataset[t]=p):(s=e.createElement(g),s.dataset[t]=d,n.appendChild(s)),s.style.width||=Qt,s.style.height||=Qt,s.style.pointerEvents="none",s.style.setProperty("pointer-events","none")}return s})(((n,e)=>{const s=kt();let i=e??s.getElementById(n);return i||(i=s.createElement("canvas"),i.id=n,i.dataset[t]=d,s.body.append(i),i)})(i,e));return f.canvas.loadCanvas(l),await f.start(),f}async refresh(t=!0){t&&await Promise.all(this.items.map((t=>t.refresh())))}removeEventListener(t,n){this.#f.removeEventListener(t,n)}};let ln,dn,pn=!1;async function gn(t){if(!pn)if(ln){if(dn!==t)throw new Error("initParticlesEngine callback must be stable across the app lifecycle.");await ln}else dn=t,ln=(async()=>{t&&await t(fn),"function"==typeof fn.init&&await fn.init(),pn=!0})().catch((t=>{throw ln=void 0,dn=void 0,pn=!1,t})),await ln}function wn(){return pn}async function mn(){await(null!=ln?ln:Promise.resolve())}export{kt as $,an as A,E as B,gt as C,N as D,tt as E,Y as F,K as G,J as H,Z as I,Q as J,o as K,en as L,et as M,D as N,sn as O,Dt as P,n as Q,Zt as R,V as S,nt as T,k as U,C as V,Tt as W,t as X,qt as Y,Ot as Z,Ut as _,ft as a,r as a0,Gt as a1,s as a2,e as a3,it as a4,Wt as a5,G as a6,c as a7,w as a8,j as a9,y as aA,b as aB,wt as aC,T as aD,F as aE,mt as aF,l as aG,wn as aH,mn as aI,Lt as aa,vt as ab,pt as ac,Ct as ad,Mt as ae,H as af,_t as ag,St as ah,cn as ai,at as aj,yt as ak,zt as al,It as am,Ft as an,f as ao,At as ap,M as aq,I as ar,q as as,Kt as at,B as au,v as av,R as aw,U as ax,_ as ay,$ as az,Pt as b,xt as c,P as d,A as e,L as f,x as g,S as h,gn as i,ot as j,ht as k,X as l,jt as m,ct as n,ut as o,Ht as p,rt as q,$t as r,m as s,fn as t,O as u,u as v,W as w,a as x,h as y,z}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,c as i,h as s}from"./p-PhwiK2_P.js";import{i as e,t as n}from"./p-
|
|
1
|
+
import{r as t,c as i,h as s}from"./p-PhwiK2_P.js";import{i as e,t as n}from"./p-QSzGOBhI.js";const a=class{constructor(s){t(this,s),this.particlesLoaded=i(this,"particlesLoaded"),this.renderId=0}async componentDidLoad(){await this.loadParticles(++this.renderId)}disconnectedCallback(){var t;this.renderId++,null===(t=this.container)||void 0===t||t.destroy(),this.container=void 0}async onPropsChange(){await this.loadParticles(++this.renderId)}async onThemeChange(){var t,i;this.container&&(null===(i=(t=this.container).loadTheme)||void 0===i||i.call(t,this.theme))}async loadParticles(t){var i,s,a;if(null===(i=this.container)||void 0===i||i.destroy(),!this.containerElement)return void console.warn("[stencil-particles] container element not available yet");let o;try{if(this.init&&await e(this.init),!this.options&&!this.url)return void console.warn("[stencil-particles] neither options nor url provided");const t=Object.assign(Object.assign({element:this.containerElement},this.containerId?{id:this.containerId}:{}),this.options?{options:this.options}:{url:this.url});o=await n.load(t)}catch(t){return void console.error("[stencil-particles] load failed",t)}t===this.renderId?(this.container=o,this.particlesLoaded.emit(o),o&&this.theme&&(null===(a=(s=o).loadTheme)||void 0===a||a.call(s,this.theme))):null==o||o.destroy()}render(){return s("div",{key:"f5fe33d147a1a606a75fe0d1ee385bacaf0e0b7d",id:this.containerId,ref:t=>{this.containerElement=t},style:{width:"100%",height:"100%"}})}static get watchers(){return{options:[{onPropsChange:0}],url:[{onPropsChange:0}],init:[{onPropsChange:0}],containerId:[{onPropsChange:0}],theme:[{onThemeChange:0}]}}};export{a as stencil_particles}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as n,b as o}from"./p-PhwiK2_P.js";export{s as setNonce}from"./p-PhwiK2_P.js";import{g as e}from"./p-DQuL1Twl.js";(()=>{const o=import.meta.url,e={};return""!==o&&(e.resourcesUrl=new URL(".",o).href),n(e)})().then((async n=>(await e(),o([["p-
|
|
1
|
+
import{p as n,b as o}from"./p-PhwiK2_P.js";export{s as setNonce}from"./p-PhwiK2_P.js";import{g as e}from"./p-DQuL1Twl.js";(()=>{const o=import.meta.url,e={};return""!==o&&(e.resourcesUrl=new URL(".",o).href),n(e)})().then((async n=>(await e(),o([["p-bd76f15b",[[0,"stencil-particles",{options:[16],url:[1],init:[16],containerId:[1,"container-id"],theme:[1]},null,{options:[{onPropsChange:0}],url:[{onPropsChange:0}],init:[{onPropsChange:0}],containerId:[{onPropsChange:0}],theme:[{onThemeChange:0}]}]]]],n))));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/stencil",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.1",
|
|
4
4
|
"description": "Official tsParticles Stencil Component - Easily create highly customizable particle, confetti and fireworks animations and use them as animated backgrounds for your website.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Matteo Bruni <matteo.bruni@me.com>",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@stencil/core": "^4.43.5",
|
|
44
|
-
"@tsparticles/engine": "4.2.
|
|
44
|
+
"@tsparticles/engine": "4.2.1",
|
|
45
45
|
"typescript": "^6.0.3"
|
|
46
46
|
},
|
|
47
47
|
"publishConfig": {
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"@stencil/core": "^4",
|
|
62
62
|
"@tsparticles/engine": "workspace:*"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "1f62e3eb35dea236f08382f909ff7c1959cf5870"
|
|
65
65
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{R as t,c as s,s as i,a as e,b as h,h as o,d as n,l as a,e as r,f as c,g as l,j as d,k as f,m as u,P as p,O as w,M as v,n as g,o as y,L as m,p as b,q as x,r as M,u as P,v as C,A as z,w as L,x as k,y as S,z as R,B as D,C as O,D as $,E as T,F as B,G as F,H as I,I as E,J as A,K as U,N as q,Q as V,S as W,T as j,U as H,V as X,W as Y,X as N,Y as _,Z,_ as G,$ as K,a0 as Q,a1 as J,a2 as tt,a3 as st,a4 as it,a5 as et,a6 as ht,a7 as ot,a8 as nt,a9 as at,aa as rt,ab as ct,ac as lt,ad as dt,ae as ft,af as ut,ag as pt,ah as wt,ai as vt,aj as gt,ak as yt,al as mt,am as bt,an as xt,ao as Mt,ap as Pt,aq as Ct,ar as zt,as as Lt,at as kt,au as St,av as Rt,aw as Dt,ax as Ot,ay as $t,az as Tt,aA as Bt,aB as Ft,aC as It,aD as Et,aE as At,aF as Ut,aG as qt}from"./p-FNL2LsWF.js";class Vt{position;type;constructor(t,s,i){this.position={x:t,y:s},this.type=i}_resetPosition(t,s){this.position.x=t,this.position.y=s}}class Wt extends Vt{radius;constructor(s,i,e){super(s,i,t.circle),this.radius=e}contains(t){return s(t,this.position,this.radius)}intersects(s){const e=this.position,h=s.position,o=this.radius,n=Math.abs(h.x-e.x),a=Math.abs(h.y-e.y);if(s instanceof Wt||s.type===t.circle)return o+s.radius>Math.hypot(n,a);if(s instanceof jt||s.type===t.rectangle){const t=s,{width:e,height:h}=t.size;return Math.pow(n-e,i)+Math.pow(a-h,i)<=o**i||n<=o+e&&a<=o+h||n<=e||a<=h}return!1}reset(t,s,i){return this._resetPosition(t,s),this.radius=i,this}}class jt extends Vt{size;constructor(s,i,e,h){super(s,i,t.rectangle),this.size={height:h,width:e}}contains(t){const s=this.position;return t.x>=s.x&&t.x<=s.x+this.size.width&&t.y>=s.y&&t.y<=s.y+this.size.height}intersects(t){if(t instanceof Wt)return t.intersects(this);if(!(t instanceof jt))return!1;const s=this.position,i=t.position,e=t.size;return i.x<s.x+this.size.width&&i.x+e.width>s.x&&i.y<s.y+this.size.height&&i.y+e.height>s.y}reset(t,s,i,e){return this._resetPosition(t,s),this.size.width=i,this.size.height=e,this}}class Ht{load(t){e(t)||this.doLoad(t)}}function Xt(t,...s){for(const i of s)t.load(i)}function Yt(t,s,i){void 0!==i&&(t[s]=i)}function Nt(t,s,i){void 0!==i&&(t[s]=h(i))}function _t(t,s,i,e){if(void 0!==i){const h=t;h[s]??=e(),h[s].load(i)}}class Zt extends Ht{count=0;decay=0;delay=0;enable=!1;speed=1;sync=!1;doLoad(t){Nt(this,"count",t.count),Yt(this,"enable",t.enable),Nt(this,"speed",t.speed),Nt(this,"decay",t.decay),Nt(this,"delay",t.delay),Yt(this,"sync",t.sync)}}class Gt extends Zt{max;min;offset=0;sync=!0;constructor(t,s){super(),this.min=t,this.max=s}doLoad(t){super.doLoad(t),Yt(this,"max",t.max),Yt(this,"min",t.min),Nt(this,"offset",t.offset)}}class Kt extends Ht{h=new Gt(o,n);l=new Gt(a,r);s=new Gt(c,l);doLoad(t){this.h.load(t.h),this.s.load(t.s),this.l.load(t.l)}}class Qt extends Ht{value="";static create(t,s){const i=new Qt;return i.load(t),void 0!==s&&(d(s)||f(s)?i.load({value:s}):i.load(s)),i}doLoad(t){e(t.value)||(this.value=t.value)}}class Jt extends Qt{animation=new Kt;static create(t,s){const i=new Jt;return i.load(t),void 0!==s&&(d(s)||f(s)?i.load({value:s}):i.load(s)),i}doLoad(t){super.doLoad(t);const s=t.animation;void 0!==s&&(void 0===s.enable?this.animation.load(t.animation):this.animation.h.load(s))}}class ts extends Ht{color;image="";opacity=1;position="";repeat="";size="";constructor(){super(),this.color=new Qt,this.color.value=""}doLoad(t){void 0!==t.color&&(this.color=Qt.create(this.color,t.color)),Yt(this,"image",t.image),Yt(this,"position",t.position),Yt(this,"repeat",t.repeat),Yt(this,"size",t.size),Yt(this,"opacity",t.opacity)}}class ss extends Ht{enable=!0;zIndex=0;doLoad(t){Yt(this,"enable",t.enable),Yt(this,"zIndex",t.zIndex)}}class is extends Ht{delay=.5;enable=!0;doLoad(t){Yt(this,"delay",t.delay),Yt(this,"enable",t.enable)}}class es extends Ht{close=!0;options={};type=[];doLoad(t){const s=t.options;if(void 0!==s)for(const t in s){const i=s[t];i&&(this.options[t]=u(this.options[t]??{},i))}Yt(this,"close",t.close),Yt(this,"type",t.type)}}class hs extends Ht{color;enable=!0;opacity=1;doLoad(t){void 0!==t.color&&(this.color=Jt.create(this.color,t.color)),Yt(this,"enable",t.enable),Nt(this,"opacity",t.opacity)}}class os extends Ht{offset=0;value=90;doLoad(t){Nt(this,"offset",t.offset),Nt(this,"value",t.value)}}class ns extends Ht{mode=p.percent;radius=0;x=50;y=50;doLoad(t){Yt(this,"x",t.x),Yt(this,"y",t.y),Yt(this,"mode",t.mode),Yt(this,"radius",t.radius)}}class as extends Ht{acceleration=9.81;enable=!1;inverse=!1;maxSpeed=50;doLoad(t){Nt(this,"acceleration",t.acceleration),Yt(this,"enable",t.enable),Yt(this,"inverse",t.inverse),Nt(this,"maxSpeed",t.maxSpeed)}}class rs extends Ht{value=0;doLoad(t){e(t.value)||(this.value=h(t.value))}}class cs extends Ht{clamp=!0;delay=new rs;enable=!1;generator;options={};doLoad(t){Yt(this,"clamp",t.clamp),this.delay.load(t.delay),Yt(this,"enable",t.enable),this.generator=t.generator,t.options&&(this.options=u(this.options,t.options))}}class ls extends Ht{bottom;default=w.out;left;right;top;doLoad(t){void 0!==t.default&&(this.default=t.default),this.bottom=t.bottom??t.default,this.left=t.left??t.default,this.right=t.right??t.default,this.top=t.top??t.default}}class ds extends Ht{acceleration=0;enable=!1;position;doLoad(t){Nt(this,"acceleration",t.acceleration),Yt(this,"enable",t.enable),t.position&&(this.position=u({},t.position))}}class fs extends Ht{angle=new os;center=new ns;decay=0;direction=v.none;distance={};drift=0;enable=!1;gravity=new as;outModes=new ls;path=new cs;random=!1;size=!1;speed=2;spin=new ds;straight=!1;vibrate=!1;warp=!1;doLoad(t){this.angle.load(g(t.angle)?{value:t.angle}:t.angle),this.center.load(t.center),Nt(this,"decay",t.decay),Yt(this,"direction",t.direction),void 0!==t.distance&&(this.distance=g(t.distance)?{horizontal:t.distance,vertical:t.distance}:{...t.distance}),Nt(this,"drift",t.drift),Yt(this,"enable",t.enable),this.gravity.load(t.gravity);const s=t.outModes;void 0!==s&&(y(s)?this.outModes.load(s):this.outModes.load({default:s})),this.path.load(t.path),Yt(this,"random",t.random),Yt(this,"size",t.size),Nt(this,"speed",t.speed),this.spin.load(t.spin),Yt(this,"straight",t.straight),Yt(this,"vibrate",t.vibrate),Yt(this,"warp",t.warp)}}class us extends Ht{color;opacity;width=0;doLoad(t){void 0!==t.color&&(this.color=Jt.create(this.color,t.color)),Nt(this,"width",t.width),Nt(this,"opacity",t.opacity)}}class ps extends Ht{color;fill;stroke;doLoad(t){void 0!==t.color&&(this.color=Jt.create(this.color,t.color)),_t(this,"fill",t.fill,(()=>new hs)),_t(this,"stroke",t.stroke,(()=>new us))}}class ws extends rs{value=1}class vs extends Ht{horizontal=new ws;vertical=new ws;doLoad(t){this.horizontal.load(t.horizontal),this.vertical.load(t.vertical)}}class gs extends Ht{enable=!1;height=1080;width=1920;doLoad(t){Yt(this,"enable",t.enable),Yt(this,"width",t.width),Yt(this,"height",t.height)}}class ys extends Ht{mode=m.delete;value=0;doLoad(t){Yt(this,"mode",t.mode),Yt(this,"value",t.value)}}class ms extends Ht{density=new gs;limit=new ys;value=0;doLoad(t){this.density.load(t.density),this.limit.load(t.limit),Yt(this,"value",t.value)}}class bs extends Ht{close=!0;options={};type="circle";doLoad(t){const s=t.options;if(void 0!==s)for(const t in s){const i=s[t];i&&(this.options[t]=u(this.options[t]??{},i))}Yt(this,"close",t.close),Yt(this,"type",t.type)}}class xs extends rs{opacityRate=1;sizeRate=1;velocityRate=1;doLoad(t){super.doLoad(t),Yt(this,"opacityRate",t.opacityRate),Yt(this,"sizeRate",t.sizeRate),Yt(this,"velocityRate",t.velocityRate)}}class Ms extends Ht{bounce=new vs;effect=new es;groups={};move=new fs;number=new ms;paint;palette;reduceDuplicates=!1;shape=new bs;zIndex=new xs;#t;#s;constructor(t,s){super(),this.#s=t,this.#t=s,this.paint=new ps,this.paint.color=new Jt,this.paint.color.value="#fff",this.paint.fill=new hs,this.paint.fill.enable=!0}doLoad(t){if(t.palette&&(this.palette=t.palette,this.#i(this.palette)),void 0!==t.groups)for(const s of Object.keys(t.groups)){if(!(s in t.groups))continue;const i=t.groups[s];void 0!==i&&(this.groups[s]=u(this.groups[s]??{},i))}void 0!==t.reduceDuplicates&&(this.reduceDuplicates=t.reduceDuplicates),this.bounce.load(t.bounce),this.effect.load(t.effect),this.move.load(t.move),this.number.load(t.number);const s=t.paint;if(s&&(f(s)?this.paint=b(s,(t=>{const s=new ps;return s.load(t),s})):f(this.paint)?(this.paint=new ps,this.paint.load(s)):this.paint.load(s)),this.shape.load(t.shape),this.zIndex.load(t.zIndex),this.#t){for(const s of this.#s.plugins)s.loadParticlesOptions&&s.loadParticlesOptions(this.#t,this,t);const s=this.#s.updaters.get(this.#t);if(s)for(const i of s)i.loadOptions&&i.loadOptions(this,t)}}#i(t){const s=this.#s.getPalette(t);if(!s)return;const i=s.colors,e=(f(i)?i:[i]).flatMap((t=>{const s=t.fill,i=t.stroke,e=s?{color:{value:s.value},enable:s.enable,opacity:s.opacity}:void 0;return i?[{fill:e,stroke:{color:{value:i.value},opacity:i.opacity,width:i.width||0}}]:[{fill:e}]}));this.load({paint:e.length>1?e:e[0]??{},blend:{enable:!0,mode:s.blendMode}})}}function Ps(t,s,...i){const e=new Ms(t,s);return Xt(e,...i),e}class Cs extends Ht{autoPlay=!0;background;clear=!0;defaultThemes={};delay=0;detectRetina=!0;duration=0;fpsLimit=120;fullScreen;hdr=!0;key;name;palette;particles;pauseOnBlur=!0;pauseOnOutsideViewport=!0;preset;resize;smooth=!1;style={};zLayers=100;#t;#s;constructor(t,s){super(),this.#s=t,this.#t=s,this.background=new ts,this.fullScreen=new ss,this.particles=Ps(this.#s,this.#t),this.resize=new is}doLoad(t){void 0!==t.preset&&(this.preset=t.preset,b(this.preset,(t=>{this.#e(t)}))),void 0!==t.palette&&(this.palette=t.palette,this.#i(this.palette)),Yt(this,"autoPlay",t.autoPlay),Yt(this,"clear",t.clear),Yt(this,"key",t.key),Yt(this,"name",t.name),Nt(this,"delay",t.delay),Yt(this,"detectRetina",t.detectRetina),Nt(this,"duration",t.duration),Yt(this,"fpsLimit",t.fpsLimit),Yt(this,"hdr",t.hdr),Yt(this,"pauseOnBlur",t.pauseOnBlur),Yt(this,"pauseOnOutsideViewport",t.pauseOnOutsideViewport),Yt(this,"zLayers",t.zLayers),this.background.load(t.background);const s=t.fullScreen;x(s)?this.fullScreen.enable=s:this.fullScreen.load(s),this.particles.load(t.particles),this.resize.load(t.resize),this.style=u(this.style,t.style),Yt(this,"smooth",t.smooth),this.#s.plugins.forEach((s=>{s.loadOptions(this.#t,this,t)}))}#i(t){const s=this.#s.getPalette(t);s&&this.load({background:{color:s.background},blend:{enable:!0,mode:s.blendMode},particles:{palette:t}})}#e(t){this.load(this.#s.getPreset(t))}}const zs=new Map;function Ls(t,s){let i=zs.get(t);return i||(i=s(),zs.size>2e3&&zs.clear(),zs.set(t,i)),i}function ks(t,s,i,e=!0){if(!s)return;const h=d(s)?{value:s}:s;if(d(h.value))return Ss(t,h.value,i,e);if(f(h.value)){const s=M(h.value,i,e);if(!s)return;return ks(t,{value:s})}for(const s of t.colorManagers.values()){const t=s.handleRangeColor(h);if(t)return t}}function Ss(t,s,i,e=!0){if(!s)return;const h=d(s)?{value:s}:s;if(d(h.value))return h.value===C?function(){const t=T,s=D+$,i=()=>Math.floor(O(t,s));return{b:i(),g:i(),r:i()}}():function(t,s){return function(t,s){if(s)for(const i of t.colorManagers.values())if(i.accepts(s))return i.parseString(s)}(t,s)}(t,h.value);if(f(h.value)){const s=M(h.value,i,e);if(!s)return;return Ss(t,{value:s})}for(const s of t.colorManagers.values()){const t=s.handleColor(h);if(t)return t}}function Rs(t,s,i,e=!0){const h=ks(t,s,i,e);return h?function(t){const s=t.r/D,i=t.g/D,e=t.b/D,h=Math.max(s,i,e),a=Math.min(s,i,e),d={h:o,l:(h+a)*k,s:c};return h!==a&&(d.s=d.l<k?(h-a)/(h+a):(h-a)/(S-h-a),d.h=s===h?(i-e)/(h-a):i===h?S+(e-s)/(h-a):S*S+(s-i)/(h-a)),d.l*=r,d.s*=l,d.h*=R,d.h<o&&(d.h+=n),d.h>=n&&(d.h-=n),d}(h):void 0}function Ds(t,s,i){return i<0&&i++,i>1&&i--,i*F<1?t+(s-t)*F*i:i*S<1?s:i*I<1*S?t+(s-t)*(S/I-i)*F:t}function Os(t,s,i){const e=i??P;return Ls(`rgb-${t.r.toFixed(2)}-${t.g.toFixed(2)}-${t.b.toFixed(2)}-${s?"hdr":"sdr"}-${e.toString()}`,(()=>s?function(t,s,i=B){const e=i/203;return`color(display-p3 ${(t.r/D*e).toString()} ${(t.g/D*e).toString()} ${(t.b/D*e).toString()} / ${(s??P).toString()})`}(t,i):function(t,s){return`rgba(${t.r.toString()}, ${t.g.toString()}, ${t.b.toString()}, ${(s??P).toString()})`}(t,i)))}function $s(t,s,i){const e=i??P;return Ls(`hsl-${t.h.toFixed(2)}-${t.s.toFixed(2)}-${t.l.toFixed(2)}-${s?"hdr":"sdr"}-${e.toString()}`,(()=>s?Os(function(t){const s=(t.h%n+n)%n,i=Math.max(c,Math.min(l,t.s)),e=Math.max(a,Math.min(r,t.l)),h=s/n,o=i/l,d=e/r;if(i===c){const t=Math.round(d*D);return{r:t,g:t,b:t}}const f=d<k?d*(A+o):d+o-d*o,u=S*d-f,p=E/I,w=Math.min(D,D*Ds(u,f,h+p)),v=Math.min(D,D*Ds(u,f,h)),g=Math.min(D,D*Ds(u,f,h-p));return{r:Math.round(w),g:Math.round(v),b:Math.round(g)}}(t),!0,i):`hsla(${t.h.toString()}, ${t.s.toString()}%, ${t.l.toString()}%, ${e.toString()})`))}function Ts(t){return void 0===t?void 0:{h:t.h.value,s:t.s.value,l:t.l.value}}function Bs(t,s,i){const e=s[i];void 0!==e&&(t[i]=(t[i]??X)*e)}class Fs{#h;#o;#n;#a;#r;#t;#c;#l;#d;#f;#u;#p;#w;#v;#s;#g;#y;#m={};#b=[void 0,void 0];#x={};constructor(t,s,i){this.#s=t,this.#t=s,this.#o=i,this.#c=null,this.#y=[],this.#g=[],this.#r=[],this.#h=[],this.#n=[],this.#a=[],this.#d=[],this.#f=[],this.#u=[],this.#p=[],this.#v=[],this.#w=[]}get settings(){return this.#l}canvasClear(){this.#t.actualOptions.clear&&this.draw((t=>{t.clearRect(U.x,U.y,this.#o.size.width,this.#o.size.height)}))}clear(){let t=!1;for(const s of this.#h)if(t=s.canvasClear?.()??!1,t)break;t||this.canvasClear()}destroy(){this.stop(),this.#y=[],this.#g=[],this.#r=[],this.#h=[],this.#n=[],this.#a=[],this.#d=[],this.#f=[],this.#u=[],this.#p=[],this.#v=[],this.#w=[]}draw(t){const s=this.#c;if(s)return t(s)}drawParticle(t,s){if(t.spawning||t.destroyed)return;const i=t.getRadius();if(i<=q)return;const e=t.getFillColor(),h=t.getStrokeColor();let[o,n]=this.#M(t);if(o??=e,n??=h,!o&&!n)return;const a=this.#t,r=t.options.zIndex,c=H-t.zIndexFactor,{fillOpacity:l,opacity:d,strokeOpacity:f}=t.getOpacity(),u=this.#x,p=this.#m,w=o?$s(o,a.hdr,l*d):void 0,v=n?$s(n,a.hdr,f*d):w;u.a=u.b=u.c=u.d=void 0,p.fill=w,p.stroke=v,this.draw((e=>{for(const i of this.#u)i.drawParticleSetup?.(e,t,s);this.#P(e,t,i,d,p,u),this.#C({container:a,context:e,particle:t,delta:s,colorStyles:p,radius:i*c**r.sizeRate,opacity:d,transform:u}),this.#z(t);for(const i of this.#f)i.drawParticleCleanup?.(e,t,s)}))}drawParticlePlugins(t,s){this.draw((i=>{for(const e of this.#d)this.#L(i,e,t,s)}))}drawParticles(t){const{particles:s}=this.#t;this.clear(),s.update(t),this.draw((i=>{for(const s of this.#v)s.drawSettingsSetup?.(i,t);for(const s of this.#p)s.draw?.(i,t);s.drawParticles(t);for(const s of this.#a)s.clearDraw?.(i,t);for(const s of this.#w)s.drawSettingsCleanup?.(i,t)}))}init(){this.initUpdaters(),this.initPlugins(),this.paint()}initPlugins(){this.#r=[],this.#h=[],this.#n=[],this.#a=[],this.#d=[],this.#u=[],this.#f=[],this.#p=[],this.#v=[],this.#w=[];for(const t of this.#t.plugins)(t.particleFillColor??t.particleStrokeColor)&&this.#r.push(t),t.canvasClear&&this.#h.push(t),t.canvasPaint&&this.#n.push(t),t.drawParticle&&this.#d.push(t),t.drawParticleSetup&&this.#u.push(t),t.drawParticleCleanup&&this.#f.push(t),t.draw&&this.#p.push(t),t.drawSettingsSetup&&this.#v.push(t),t.drawSettingsCleanup&&this.#w.push(t),t.clearDraw&&this.#a.push(t)}initUpdaters(){this.#y=[],this.#g=[];for(const t of this.#t.particleUpdaters)t.afterDraw&&this.#g.push(t),(t.getColorStyles??t.getTransformValues??t.beforeDraw)&&this.#y.push(t)}paint(){let t=!1;for(const s of this.#n)if(t=s.canvasPaint?.()??!1,t)break;t||this.paintBase()}paintBase(t){this.draw((s=>{s.fillStyle=t??"rgba(0,0,0,0)",s.fillRect(U.x,U.y,this.#o.size.width,this.#o.size.height)}))}paintImage(t,s){this.draw((i=>{if(!t)return;const e=i.globalAlpha;i.globalAlpha=s,i.drawImage(t,U.x,U.y,this.#o.size.width,this.#o.size.height),i.globalAlpha=e}))}setContext(t){this.#c=t,this.#c&&(this.#c.globalCompositeOperation=V)}setContextSettings(t){this.#l=t}stop(){this.draw((t=>{t.clearRect(U.x,U.y,this.#o.size.width,this.#o.size.height)}))}#z(t){for(const s of this.#g)s.afterDraw?.(t)}#P(t,s,i,e,h,o){for(const n of this.#y){if(n.getColorStyles){const{fill:o,stroke:a}=n.getColorStyles(s,t,i,e);o&&(h.fill=o),a&&(h.stroke=a)}if(n.getTransformValues){const t=n.getTransformValues(s);for(const s in t)Bs(o,t,s)}n.beforeDraw?.(s)}}#k(t,s){if(!t?.drawAfter)return;const{particle:i}=s;i.effect&&t.drawAfter(s)}#S(t,s){if(!t?.drawBefore)return;const{particle:i}=s;i.effect&&t.drawBefore(s)}#C(t){const{container:s,context:i,particle:e,delta:h,colorStyles:o,radius:n,opacity:a,transform:r}=t,{effectDrawers:c,shapeDrawers:l}=s,d=e.getPosition(),f=e.getTransformData(r),u=j,p={x:d.x,y:d.y};i.setTransform(f.a,f.b,f.c,f.d,d.x,d.y),o.fill&&(i.fillStyle=o.fill);const w=!!e.fillEnabled,v=e.strokeWidth??W;i.lineWidth=v,o.stroke&&(i.strokeStyle=o.stroke);const g={context:i,particle:e,radius:n,drawRadius:n*u,opacity:a,delta:h,pixelRatio:s.retina.pixelRatio,fill:w,stroke:v>W,transformData:f,position:{...d},drawPosition:p,drawScale:u};for(const t of s.plugins)t.drawParticleTransform?.(g);const y=e.effect?c.get(e.effect):void 0,m=e.shape?l.get(e.shape):void 0;this.#S(y,g),this.#R(m,g),this.#D(m,g),this.#O(m,g),this.#k(y,g),i.resetTransform()}#L(t,s,i,e){s.drawParticle&&s.drawParticle(t,i,e)}#D(t,s){if(!t)return;const{context:i,fill:e,particle:h,stroke:o}=s;h.shape&&(i.beginPath(),t.draw(s),h.shapeClose&&i.closePath(),e&&i.fill(),o&&i.stroke())}#O(t,s){if(!t?.afterDraw)return;const{particle:i}=s;i.shape&&t.afterDraw(s)}#R(t,s){if(!t?.beforeDraw)return;const{particle:i}=s;i.shape&&t.beforeDraw(s)}#M(t){let s,i;for(const e of this.#r)if(!s&&e.particleFillColor&&(s=Rs(this.#s,e.particleFillColor(t))),!i&&e.particleStrokeColor&&(i=Rs(this.#s,e.particleStrokeColor(t))),s&&i)break;return this.#b[0]=s,this.#b[1]=i,this.#b}}const Is=new WeakMap;function Es(t,s,i=!1){if(!s)return;const e=t.style,h=new Set;for(let t=0;t<e.length;t++){const s=e.item(t);s&&h.add(s)}for(let t=0;t<s.length;t++){const i=s.item(t);i&&h.add(i)}for(const t of h){const h=s.getPropertyValue(t);h?e.setProperty(t,h,i?"important":""):e.removeProperty(t)}}class As{domElement;render;renderCanvas;size;zoom=j;#t;#$;#T;#B;#s;#F;#I;#E;#A;constructor(t,s){this.#s=t,this.#t=s,this.render=new Fs(t,s,this),this.#E={height:0,width:0};const i=s.retina.pixelRatio,e=this.#E;this.size={height:e.height*i,width:e.width*i},this.#$=!1,this.#I=[],this.#F="none"}get#U(){return this.#t.actualOptions.fullScreen.enable}destroy(){if(this.stop(),this.#$){const t=this.domElement;t?.remove(),this.domElement=void 0,this.renderCanvas=void 0}else this.#q();this.render.destroy(),this.#I=[]}getZoomCenter(){const t=this.#t.retina.pixelRatio,{width:s,height:i}=this.size;return this.#A?this.#A:{x:s*k/t,y:i*k/t}}init(){this.#V((t=>{t.disconnect()})),this.#T=Y((t=>{for(const s of t)"attributes"===s.type&&"style"===s.attributeName&&this.#W()})),this.resize(),this.#j(),this.initBackground(),this.#V((t=>{const s=this.domElement;s&&s instanceof Node&&t.observe(s,{attributes:!0})})),this.initPlugins(),this.#H(),this.render.init()}initBackground(){const t=this.#t,s=t.actualOptions.background,i=this.domElement;if(!i)return;const e=i.style,h=ks(this.#s,s.color);e.backgroundColor=h?Os(h,t.actualOptions.hdr,s.opacity):"",e.backgroundImage=s.image||"",e.backgroundPosition=s.position||"",e.backgroundRepeat=s.repeat||"",e.backgroundSize=s.size||""}initPlugins(){this.#I=[];for(const t of this.#t.plugins)t.resize&&this.#I.push(t)}loadCanvas(t){this.#$&&this.domElement&&this.domElement.remove();const s=(t=>"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement)(t)?t:void 0;this.domElement=s,this.#$=!!s&&"true"===s.dataset[N],this.renderCanvas=s?(t=>{const s=Is.get(t);if(s)return s;if("function"!=typeof t.transferControlToOffscreen)throw new TypeError("OffscreenCanvas is required but not supported by this browser");try{const s=t.transferControlToOffscreen();return Is.set(t,s),s}catch{throw new TypeError("OffscreenCanvas transfer failed")}})(s):t;const i=this.domElement;i&&(i.ariaHidden="true",this.#B=_(i.style));const e=this.#E,h=this.renderCanvas;i?(e.height=i.offsetHeight,e.width=i.offsetWidth):(e.height=h.height,e.width=h.width);const o=this.#t.retina.pixelRatio,n=this.size;h.height=n.height=e.height*o,h.width=n.width=e.width*o}resize(){const t=this.domElement;if(!t)return!1;const s=this.#t,i=this.renderCanvas;if(void 0===i)return!1;const e=s.canvas.#E,h={width:t.offsetWidth,height:t.offsetHeight},o=s.retina.pixelRatio,n={width:h.width*o,height:h.height*o};if(h.height===e.height&&h.width===e.width&&n.height===i.height&&n.width===i.width)return!1;const a={...e};e.height=h.height,e.width=h.width;const r=this.size;return i.width=r.width=n.width,i.height=r.height=n.height,this.#t.started&&s.particles.setResizeFactor({width:e.width/a.width,height:e.height/a.height}),!0}setPointerEvents(t){this.domElement&&(this.#F=t,this.#W())}setZoom(t,s){this.zoom=t,this.#A=s}stop(){this.#V((t=>{t.disconnect()})),this.#T=void 0,this.render.stop()}async windowResize(){if(!this.domElement||!this.resize())return;const t=this.#t,s=t.updateActualOptions();t.particles.setDensity(),this.#X(),s&&await t.refresh()}#X(){for(const t of this.#I)t.resize?.()}#H(){const t=this.#t.actualOptions.hdr&&Z("(color-gamut: p3)")?.matches&&Z("(dynamic-range: high)")?.matches;this.render.setContextSettings({alpha:!0,desynchronized:!0,willReadFrequently:!1,...t?{colorSpace:"display-p3",colorType:"float16"}:{colorSpace:"srgb"}});const s=this.renderCanvas;s&&this.render.setContext(s.getContext("2d",this.render.settings))}#j(){const t=this.domElement,s=this.#t.actualOptions;if(t){this.#U?this.#Y():this.#q();for(const i in s.style){if(!i||!(i in s.style))continue;const e=s.style[i];e&&t.style.setProperty(i,e,"important")}}}#W(){const t=this.domElement;if(!t)return;this.#V((t=>{t.disconnect()})),this.#j(),this.initBackground();const s=this.#F;t.style.pointerEvents=s,t.style.setProperty("pointer-events",s),this.#V((s=>{t instanceof Node&&s.observe(t,{attributes:!0})}))}#q(){const t=this.domElement,s=this.#B;t&&s&&Es(t,s,!0)}#V(t){this.#T&&t(this.#T)}#Y(){const t=this.domElement;t&&Es(t,G(this.#t.actualOptions.fullScreen.zIndex),!0)}}class Us{#t;#N;#_;#Z;constructor(t){this.#t=t,this.#N={visibilityChange:()=>{this.#G()},resize:()=>{this.#K()}}}addListeners(){this.#Q(!0)}removeListeners(){this.#Q(!1)}#G(){const t=this.#t;t.actualOptions.pauseOnBlur&&(K().hidden?(t.pageHidden=!0,t.pause()):(t.pageHidden=!1,t.animationStatus?t.play(!0):t.draw(!0)))}#K(){this.#Z&&(clearTimeout(this.#Z),this.#Z=void 0);const t=async()=>{const t=this.#t.canvas;await t.windowResize()};this.#Z=setTimeout((()=>{t()}),this.#t.actualOptions.resize.delay*Q)}#Q(t){const s=this.#N;this.#J(t),J(document,tt,s.visibilityChange,t,!1)}#J(t){const s=this.#N,i=this.#t;if(!i.actualOptions.resize.enable)return;if("undefined"==typeof ResizeObserver)return void J(globalThis,st,s.resize,t);const e=i.canvas.domElement;this.#_&&!t?(e&&this.#_.unobserve(e),this.#_.disconnect(),this.#_=void 0):!this.#_&&t&&e&&(this.#_=new ResizeObserver((t=>{t.find((t=>t.target===e))&&this.#K()})),this.#_.observe(e))}}function qs(t){if(!xt(t.outMode,t.checkModes))return;const s=t.radius*S;t.coord>t.maxCoord-s?t.setCb(-t.radius):t.coord<s&&t.setCb(t.radius)}function Vs(t,s){const i=t%s;return i<ht?i+s:i}class Ws{backColor;bubble;destroyed;direction;effect;effectClose;effectData;fillColor;fillEnabled;fillOpacity;group;id;ignoresResizeRatio;initialPosition;initialVelocity;isRotating;justWarped;lastPathTime;misplaced;moveCenter;offset;opacity;options;outType;pathRotation;position;randomIndexData;retina;roll;rotation;shape;shapeClose;shapeData;sides;size;slow;spawning;strokeColor;strokeOpacity;strokeWidth;unbreakable;velocity;zIndexFactor;#tt={fillOpacity:P,opacity:P,strokeOpacity:P};#st=it.origin;#it={sin:0,cos:0};#et={a:1,b:0,c:0,d:1};#t;#s;constructor(t,s){this.#s=t,this.#t=s}destroy(t){if(this.unbreakable||this.destroyed)return;this.destroyed=!0,this.bubble.inRange=!1,this.slow.inRange=!1;const s=this.#t,i=this.shape?s.shapeDrawers.get(this.shape):void 0;i?.particleDestroy?.(this);for(const i of s.particleDestroyedPlugins)i.particleDestroyed?.(this,t);for(const i of s.particleUpdaters)i.particleDestroyed?.(this,t);this.#t.dispatchEvent(et.particleDestroyed,{particle:this})}draw(t){const s=this.#t.canvas.render;s.drawParticlePlugins(this,t),s.drawParticle(this,t)}getAngle(){return this.rotation+(this.pathRotation?this.velocity.angle:ht)}getFillColor(){return this.#ht(this.bubble.color??Ts(this.fillColor))}getMass(){return this.getRadius()**i*Math.PI*k}getOpacity(){const t=(H-this.zIndexFactor)**this.options.zIndex.opacityRate,s=this.bubble.opacity??yt(this.opacity?.value??P),i=this.strokeOpacity??P;return this.#tt.fillOpacity=s*(this.fillOpacity??P)*t,this.#tt.opacity=s*t,this.#tt.strokeOpacity=s*i*t,this.#tt}getPosition(){return this.#st.x=this.position.x+this.offset.x,this.#st.y=this.position.y+this.offset.y,this.#st.z=this.position.z,this.#st}getRadius(){return this.bubble.radius??this.size.value}getRotateData(){const t=this.getAngle();return this.#it.sin=Math.sin(t),this.#it.cos=Math.cos(t),this.#it}getStrokeColor(){return this.#ht(this.bubble.color??Ts(this.strokeColor))}getTransformData(t){const s=this.getRotateData(),i=this.isRotating;return this.#et.a=s.cos*(t.a??ot.a),this.#et.b=i?s.sin*(t.b??$):t.b??ot.b,this.#et.c=i?-s.sin*(t.c??$):t.c??ot.c,this.#et.d=s.cos*(t.d??ot.d),this.#et}init(t,s,i,e){const h=this.#t;!function(t,s,i){t.id=s,t.group=i,t.justWarped=!1,t.effectClose=!0,t.shapeClose=!0,t.pathRotation=!1,t.lastPathTime=0,t.destroyed=!1,t.unbreakable=!1,t.isRotating=!1,t.rotation=0,t.misplaced=!1,t.retina={maxDistance:{},maxSpeed:0,moveDrift:0,moveSpeed:0,sizeAnimationSpeed:0},t.size={value:1,max:1,min:1,enable:!1},t.outType=vt.normal,t.ignoresResizeRatio=!0}(this,t,e),this.options=function(t,s,i,e){const h=Ps(i,s,s.actualOptions.particles),o=h.reduceDuplicates;t.effect=bt(h.effect.type,t.id,o),t.shape=bt(h.shape.type,t.id,o);const n=h.effect,a=h.shape;if(e){if(e.effect){const s=e.effect.type;if(s&&s!==t.effect){const i=bt(s,t.id,o);i&&(t.effect=i)}n.load(e.effect)}if(e.shape){const s=e.shape.type;if(s&&s!==t.shape){const i=bt(s,t.id,o);i&&(t.shape=i)}a.load(e.shape)}}if(t.effect===C){const i=[...s.effectDrawers.keys()];t.effect=i[Math.floor(lt()*i.length)]}if(t.shape===C){const i=[...s.shapeDrawers.keys()];t.shape=i[Math.floor(lt()*i.length)]}t.effectData=t.effect?function(t,s,i,e){return u({close:s.close},bt(s.options[t],i,e))}(t.effect,n,t.id,o):void 0,t.shapeData=t.shape?function(t,s,i,e){return u({close:s.close},bt(s.options[t],i,e))}(t.shape,a,t.id,o):void 0,h.load(e);const r=t.effectData,c=t.shapeData;return r&&h.load(r.particles),c&&h.load(c.particles),t.effectClose=r?.close??h.effect.close,t.shapeClose=c?.close??h.shape.close,h}(this,h,this.#s,i),h.retina.initParticle(this),function(t,s){for(const i of t)i.preInit?.(s)}(h.particleUpdaters,this),this.bubble={inRange:!1},this.slow={inRange:!1,factor:1},this.#ot(s),this.initialVelocity=this.#nt(),this.velocity=this.initialVelocity.copy(),this.zIndexFactor=this.position.z/h.zLayers,this.sides=24,function(t,s){let i,e;t.effect&&(i=s.effectDrawers.get(t.effect)),i?.loadEffect&&i.loadEffect(t),t.shape&&(e=s.shapeDrawers.get(t.shape)),e?.loadShape&&e.loadShape(t);const h=e?.getSidesCount;h&&(t.sides=h(t))}(this,h),this.spawning=!1,function(t,s){for(const i of t)i.init(s)}(h.particleUpdaters,this),function(t,s){const i=s.shape?t.shapeDrawers.get(s.shape):void 0,e=s.effect?t.effectDrawers.get(s.effect):void 0;e?.particleInit?.(t,s),i?.particleInit?.(t,s)}(h,this),function(t,s){for(const i of t.particleCreatedPlugins)i.particleCreated?.(s)}(h,this)}isInsideCanvas(t){return this.#at({direction:t}).inside}isInsideCanvasForOutMode(t,s){return this.#at({direction:s,outMode:t}).inside}isShowingBack(){if(!this.roll)return!1;const t=this.roll.angle;if(this.roll.horizontal&&this.roll.vertical){const s=Vs(t,Mt);return s>=Math.PI*k&&s<Math.PI*I*k}if(this.roll.horizontal){const s=Vs(t+Math.PI*k,Mt);return s>=Math.PI&&s<Math.PI*S}if(this.roll.vertical){const s=Vs(t,Mt);return s>=Math.PI&&s<Math.PI*S}return!1}isVisible(){return!this.destroyed&&!this.spawning&&this.isInsideCanvas()}reset(){for(const t of this.#t.particleUpdaters)t.reset?.(this)}#rt(t,s){let i=nt,e=t?it.create(t.x,t.y,s):void 0;const h=this.#t,o=h.particlePositionPlugins,n=this.options.move.outModes,a=this.getRadius(),r=h.canvas.size;for(;;){for(const t of o){const i=t.particlePosition?.(e,this);if(i)return it.create(i.x,i.y,s)}const t=mt({size:r,position:e}),c=it.create(t.x,t.y,s);this.#ct(c,a,n.left??n.default),this.#ct(c,a,n.right??n.default),this.#lt(c,a,n.top??n.default),this.#lt(c,a,n.bottom??n.default);let l=!0;for(const t of h.particles.checkParticlePositionPlugins)if(l=t.checkParticlePosition?.(this,c,i)??!0,!l)break;if(l)return c;i+=at,e=void 0}}#nt(){const t=this.options.move,s=rt(this.direction).copy();if(t.direction===v.inside||t.direction===v.outside)return s;const i=Pt(yt(t.angle.value)),e=Pt(yt(t.angle.offset)),o={left:e-i*k,right:e+i*k};return t.straight||(s.angle+=ct(h(o.left,o.right))),t.random&&"number"==typeof t.speed&&(s.length*=lt()),s}#ct(t,s,i){qs({outMode:i,checkModes:[w.bounce],coord:t.x,maxCoord:this.#t.canvas.size.width,setCb:s=>t.x+=s,radius:s})}#lt(t,s,i){qs({outMode:i,checkModes:[w.bounce],coord:t.y,maxCoord:this.#t.canvas.size.height,setCb:s=>t.y+=s,radius:s})}#dt(t,s){const i=this.getRadius(),e=this.#t.canvas.size,h=this.position,o=s===w.bounce;return t===dt.bottom?{inside:o?h.y+i<e.height:h.y-i<e.height,reason:"default"}:t===dt.left?{inside:o?h.x-i>ht:h.x+i>ht,reason:"default"}:t===dt.right?{inside:o?h.x+i<e.width:h.x-i<e.width,reason:"default"}:t===dt.top?{inside:o?h.y-i>ht:h.y+i>ht,reason:"default"}:{inside:h.x>=-i&&h.y>=-i&&h.y<=e.height+i&&h.x<=e.width+i,reason:"default"}}#ft(t,s){return{canvasSize:this.#t.canvas.size,direction:t,outMode:s,particle:this,radius:this.getRadius()}}#at(t){const s=this.#dt(t.direction,t.outMode),i=this.#t,e=this.shape?i.shapeDrawers.get(this.shape):void 0,h=this.effect?i.effectDrawers.get(this.effect):void 0,o=e?.isInsideCanvas,n=h?.isInsideCanvas;if(!o&&!n)return s;const a=this.#ft(t.direction,t.outMode),r=o?this.#ut(o(a),"shape"):void 0,c=n?this.#ut(n(a),"effect"):void 0;if(r&&c){const t=Math.max(r.margin??ht,c.margin??ht);return{inside:r.inside&&c.inside,margin:t>ht?t:void 0,reason:"combined"}}return r??c??s}#ht(t){return t&&this.roll&&(this.backColor||this.roll.alter)&&this.isShowingBack()?this.backColor?this.backColor:this.roll.alter?function(t,s,i){return{h:t.h,s:t.s,l:t.l+(s===z.darken?-L:L)*i}}(t,this.roll.alter.type,this.roll.alter.value):t:t}#ot(t){const s=this.#t,i=Math.floor(yt(this.options.zIndex.value)),e=this.#rt(t,ft(i,ut,s.zLayers));if(!e)throw new Error("a valid position cannot be found for particle");switch(this.position=e,this.initialPosition=this.position.copy(),this.moveCenter={...pt(this.options.move.center,s.canvas.size),radius:this.options.move.center.radius,mode:this.options.move.center.mode},this.direction=wt(this.options.move.direction,this.position,this.moveCenter),this.options.move.direction){case v.inside:this.outType=vt.inside;break;case v.outside:this.outType=vt.outside}this.offset=gt.origin}#ut(t,s){return"boolean"==typeof t?{inside:t,reason:s}:{inside:t.inside,margin:t.margin,reason:t.reason??s}}}class js{#pt;#wt=new Map;#vt=[];#gt;#yt;#mt=[];#bt;constructor(t){this.#pt=t,this.#gt=0,this.#bt=0}clear(){this.#wt.clear();const t=this.#yt;t&&(this.#pt=t),this.#yt=void 0}insert(t){const{x:s,y:i}=t.getPosition(),e=this.#xt(s,i);this.#wt.has(e)||this.#wt.set(e,[]),this.#wt.get(e)?.push(t)}query(t,s,i=[]){const e=this.#Mt(t);if(!e)return i;const h=Math.floor(e.minX/this.#pt),o=Math.floor(e.maxX/this.#pt),n=Math.floor(e.minY/this.#pt),a=Math.floor(e.maxY/this.#pt);for(let e=h;e<=o;e++)for(let h=n;h<=a;h++){const o=this.#wt.get(`${e}_${h}`);if(o)for(const e of o)s&&!s(e)||t.contains(e.getPosition())&&i.push(e)}return i}queryCircle(t,s,i,e=[]){const h=this.#Pt(t.x,t.y,s),o=this.query(h,i,e);return this.#Ct(),o}queryRectangle(t,s,i,e=[]){const h=this.#zt(t.x,t.y,s.width,s.height),o=this.query(h,i,e);return this.#Ct(),o}setCellSize(t){this.#yt=t}#Pt(t,s,i){return(this.#vt[this.#gt++]??=new Wt(t,s,i)).reset(t,s,i)}#zt(t,s,i,e){return(this.#mt[this.#bt++]??=new jt(t,s,i,e)).reset(t,s,i,e)}#xt(t,s){return`${Math.floor(t/this.#pt)}_${Math.floor(s/this.#pt)}`}#Mt(t){if(t instanceof Wt){const s=t.radius,{x:i,y:e}=t.position;return{minX:i-s,maxX:i+s,minY:e-s,maxY:e+s}}if(t instanceof jt){const{x:s,y:i}=t.position,{width:e,height:h}=t.size;return{minX:s,maxX:s+e,minY:i,maxY:i+h}}return null}#Ct(){this.#gt=0,this.#bt=0}}class Hs{checkParticlePositionPlugins;grid;#Lt;#t;#kt;#St;#Rt;#Dt;#Ot;#$t;#s;#Tt;#Bt;#Ft;#It;#Et;#At;constructor(t,s){this.#s=t,this.#t=s,this.#Rt=0,this.#Lt=[],this.#Tt=[],this.#St=0,this.#kt=new Map,this.#Dt=new Map,this.#At=this.#Ut(this.#t.zLayers),this.grid=new js(Ct),this.checkParticlePositionPlugins=[],this.#Ot=[],this.#$t=[],this.#Ft=[],this.#Bt=[],this.#Et=[]}get count(){return this.#Lt.length}addParticle(t,s,i,e){const h=this.#t.actualOptions.particles.number.limit.mode,o=void 0===i?this.#St:this.#kt.get(i)??this.#St,n=this.count;if(o>zt)switch(h){case m.delete:{const t=n+$t-o;t>Lt&&this.removeQuantity(t);break}case m.wait:if(n>=o)return}try{const h=this.#Tt.pop()??new Ws(this.#s,this.#t);h.init(this.#Rt,t,s,i);let o=!0;return e&&(o=e(h)),o?(this.#Lt.push(h),this.#qt(h),this.#Rt++,this.#t.dispatchEvent(et.particleAdded,{particle:h}),h):void this.#Tt.push(h)}catch(t){kt().warning(`error adding particle: ${t}`)}}clear(){this.#Lt=[],this.#Dt.clear(),this.#Vt(this.#t.zLayers)}destroy(){this.#Lt=[],this.#Tt.length=0,this.#Dt.clear(),this.#At=[],this.checkParticlePositionPlugins=[],this.#Ot=[],this.#$t=[],this.#Ft=[],this.#Bt=[],this.#Et=[]}drawParticles(t){for(let s=this.#At.length-Tt;s>=St;s--){const i=this.#At[s];if(i)for(const s of i)s.draw(t)}}filter(t){return this.#Lt.filter(t)}find(t){return this.#Lt.find(t)}get(t){return this.#Lt[t]}async init(){const t=this.#t,s=t.actualOptions;this.checkParticlePositionPlugins=[],this.#Et=[],this.#$t=[],this.#Ft=[],this.#Ot=[],this.#Bt=[],this.#Dt.clear(),this.#Vt(t.zLayers),this.grid=new js(Ct*t.retina.pixelRatio);for(const s of t.plugins)s.redrawInit&&await s.redrawInit(),s.checkParticlePosition&&this.checkParticlePositionPlugins.push(s),s.update&&this.#Et.push(s),s.particleUpdate&&this.#$t.push(s),s.postUpdate&&this.#Ft.push(s),s.particleReset&&this.#Ot.push(s),s.postParticleUpdate&&this.#Bt.push(s);await this.#t.initDrawersAndUpdaters();for(const s of this.#t.effectDrawers.values())await(s.init?.(t));for(const s of this.#t.shapeDrawers.values())await(s.init?.(t));let i=!1;for(const s of t.plugins)if(i=s.particlesInitialization?.()??i,i)break;if(!i){const t=s.particles,i=t.groups;for(const s in i){const e=i[s];if(e)for(let i=this.count,h=0;h<e.number.value&&i<t.number.value;i++,h++)this.addParticle(void 0,e,s)}for(let s=this.count;s<t.number.value;s++)this.addParticle()}}push(t,s,i,e){for(let h=0;h<t;h++)this.addParticle(s,i,e)}async redraw(){this.clear(),await this.init(),this.#t.canvas.render.drawParticles({value:0,factor:0})}remove(t,s,i){this.removeAt(this.#Lt.indexOf(t),void 0,s,i)}removeAt(t,s=Rt,i,e){if(t<St||t>this.count)return;let h=0;for(let o=t;h<s&&o<this.count;o++)this.#Wt(o,i,e)&&(o--,h++)}removeQuantity(t,s){this.removeAt(St,t,s)}setDensity(){const t=this.#t.actualOptions,s=t.particles.groups;let i=0;for(const t of this.#t.plugins)t.particlesDensityCount&&(i+=t.particlesDensityCount());for(const t in s){const e=s[t];if(!e)continue;const h=Ps(this.#s,this.#t,e);this.#jt(h,i,t)}this.#jt(t.particles,i)}setResizeFactor(t){this.#It=t}update(t){this.grid.clear();for(const s of this.#Et)s.update?.(t);const s=this.#Ht(t);for(const s of this.#Ft)s.postUpdate?.(t);if(this.#Xt(t,s),s.size)for(const t of s)this.remove(t);this.#It=void 0}#Yt(...t){this.#Tt.push(...t)}#jt(t,s,i,e){const h=t.number;if(!h.density.enable)return void(void 0===i?this.#St=h.limit.value:(e?.number.limit.value??h.limit.value)&&this.#kt.set(i,e?.number.limit.value??h.limit.value));const o=this.#Nt(h.density),n=h.value,a=Math.min(n,h.limit.value>zt?h.limit.value:n)*o+s,r=Math.min(this.count,this.filter((t=>t.group===i)).length);void 0===i?this.#St=h.limit.value*o:this.#kt.set(i,h.limit.value*o),r<a?this.push(Math.abs(a-r),void 0,t,i):r>a&&this.removeQuantity(r-a,i)}#Ut(t){const s=Math.max(Math.floor(t),Tt);return Array.from({length:s},(()=>[]))}#_t(t){const s=this.#At.length-Tt;return s<=St?St:Math.min(Math.max(Math.floor(t),St),s)}#Nt(t){const s=this.#t;if(!t.enable)return Dt;const e=s.canvas.size;return e.width&&e.height?e.width*e.height/(t.height*t.width*s.retina.pixelRatio**i):Dt}#qt(t){const s=this.#_t(t.position.z),i=this.#At[s];i&&(i.push(t),this.#Dt.set(t.id,s))}#Wt(t,s,i){const e=this.#Lt[t];return!!e&&e.group===s&&(this.#Lt.splice(t,Ot),this.#Zt(e),e.destroy(i),this.#t.dispatchEvent(et.particleRemoved,{particle:e}),this.#Yt(e),!0)}#Zt(t){const s=this.#Dt.get(t.id)??this.#_t(t.position.z),i=this.#At[s];if(!i)return void this.#Dt.delete(t.id);const e=i.findIndex((s=>s.id===t.id));e>=St&&i.splice(e,Ot),this.#Dt.delete(t.id)}#Vt(t){const s=Math.max(Math.floor(t),Tt);if(this.#At.length===s)for(const t of this.#At)t.length=St;else this.#At=this.#Ut(s)}#Gt(t){const s=this.#_t(t.position.z),i=this.#Dt.get(t.id);if(void 0===i)return void this.#qt(t);if(i===s)return;const e=this.#At[i];if(e){const s=e.findIndex((s=>s.id===t.id));s>=St&&e.splice(s,Ot)}const h=this.#At[s];if(h){if(h.push(t),h.length>=S){const s=h[h.length-S];s&&t.id<s.id&&h.sort(((t,s)=>t.id-s.id))}this.#Dt.set(t.id,s)}else this.#Dt.set(t.id,s)}#Ht(t){const s=new Set,i=this.#It;for(const e of this.#Lt){i&&!e.ignoresResizeRatio&&(e.position.x*=i.width,e.position.y*=i.height,e.initialPosition.x*=i.width,e.initialPosition.y*=i.height),e.ignoresResizeRatio=!1;for(const t of this.#Ot)t.particleReset?.(e);for(const s of this.#$t){if(e.destroyed)break;s.particleUpdate?.(e,t)}e.destroyed?s.add(e):this.grid.insert(e)}return s}#Xt(t,s){for(const i of this.#Lt)if(i.destroyed)s.add(i);else{for(const s of this.#t.particleUpdaters)s.update(i,t);if(!i.spawning)for(const s of this.#Bt)s.postParticleUpdate?.(i,t);this.#Gt(i)}}}class Xs{pixelRatio;reduceFactor;#t;constructor(t){this.#t=t,this.pixelRatio=Bt,this.reduceFactor=Ft}init(){const t=this.#t;this.pixelRatio=t.actualOptions.detectRetina?devicePixelRatio:Bt,this.reduceFactor=Ft;const s=this.pixelRatio,i=t.canvas,e=i.domElement;e&&(i.size.width=e.offsetWidth*s,i.size.height=e.offsetHeight*s)}initParticle(t){const s=this.pixelRatio,i=t.options.move,e=i.distance,h=t.retina;h.maxSpeed=yt(i.gravity.maxSpeed)*s,h.moveDrift=yt(i.drift)*s,h.moveSpeed=yt(i.speed)*s;const o=h.maxDistance;o.horizontal=void 0===e.horizontal?void 0:e.horizontal*s,o.vertical=void 0===e.vertical?void 0:e.vertical*s}}function Ys(t){return!t.destroyed}function Ns(t,s,...i){const e=new Cs(t,s);return Xt(e,...i),e}class _s{actualOptions;canvas;destroyed;effectDrawers;fpsLimit;hdr;id;pageHidden;particleCreatedPlugins;particleDestroyedPlugins;particlePositionPlugins;particleUpdaters;particles;plugins;retina;shapeDrawers;started;zLayers;#Kt;#Qt;#Jt={value:0,factor:0};#ts;#ss;#is;#es;#hs;#os;#ns;#as;#rs;#cs;#ls;#s;#ds;#fs;constructor(t){const{dispatchCallback:s,pluginManager:i,id:e,onDestroy:h,sourceOptions:o}=t;this.#s=i,this.#ts=s,this.#rs=h,this.id=Symbol(e),this.fpsLimit=120,this.hdr=!1,this.#ds=!1,this.#Kt=0,this.#is=0,this.#as=0,this.#hs=!0,this.started=!1,this.destroyed=!1,this.#ls=!0,this.#ns=0,this.zLayers=100,this.pageHidden=!1,this.#fs=o,this.#os=o,this.effectDrawers=new Map,this.shapeDrawers=new Map,this.particleUpdaters=[],this.retina=new Xs(this),this.canvas=new As(this.#s,this),this.particles=new Hs(this.#s,this),this.plugins=[],this.particleDestroyedPlugins=[],this.particleCreatedPlugins=[],this.particlePositionPlugins=[],this.#cs=Ns(this.#s,this),this.actualOptions=Ns(this.#s,this),this.#es=new Us(this),this.dispatchEvent(et.containerBuilt)}get animationStatus(){return!this.#ls&&!this.pageHidden&&Ys(this)}get options(){return this.#cs}get sourceOptions(){return this.#fs}addLifeTime(t){this.#as+=t}alive(){return!this.#is||this.#as<=this.#is}destroy(t=!0){if(Ys(this)){this.stop(),this.particles.destroy(),this.canvas.destroy();for(const[,t]of this.effectDrawers)t.destroy?.(this);for(const[,t]of this.shapeDrawers)t.destroy?.(this);for(const t of this.plugins)t.destroy?.();this.effectDrawers=new Map,this.shapeDrawers=new Map,this.particleUpdaters=[],this.plugins.length=0,this.#s.clearPlugins(this),this.destroyed=!0,this.#rs(t),this.dispatchEvent(et.containerDestroyed)}}dispatchEvent(t,s){this.#ts(t,{container:this,data:s})}draw(t){if(!Ys(this))return;let s=t;this.#ss=It((t=>{s&&(this.#ns=void 0,s=!1),this.#us(t)}))}async export(t,s={}){for(const i of this.plugins){if(!i.export)continue;const e=await i.export(t,s);if(e.supported)return e.blob}kt().error(`Export plugin with type ${t} not found`)}async init(){if(!Ys(this))return;const t=new Map;for(const s of this.#s.plugins){const i=await s.getPlugin(this);i.preInit&&await i.preInit(),t.set(s,i)}await this.initDrawersAndUpdaters(),this.#cs=Ns(this.#s,this,this.#os,this.sourceOptions),this.actualOptions=Ns(this.#s,this,this.#cs),this.plugins.length=0,this.particleDestroyedPlugins.length=0,this.particleCreatedPlugins.length=0,this.particlePositionPlugins.length=0;for(const[s,i]of t)s.needsPlugin(this.actualOptions)&&(this.plugins.push(i),i.particleCreated&&this.particleCreatedPlugins.push(i),i.particleDestroyed&&this.particleDestroyedPlugins.push(i),i.particlePosition&&this.particlePositionPlugins.push(i));this.retina.init(),this.canvas.init(),this.updateActualOptions(),this.canvas.initBackground(),this.canvas.resize();const{delay:s,duration:i,fpsLimit:e,hdr:h,smooth:o,zLayers:n}=this.actualOptions;this.hdr=h,this.zLayers=n,this.#is=yt(i)*Q,this.#Kt=yt(s)*Q,this.#as=0,this.fpsLimit=e>At?e:Et,this.#ds=o;for(const t of this.plugins)await(t.init?.());await this.particles.init(),this.dispatchEvent(et.containerInit),this.particles.setDensity();for(const t of this.plugins)t.particlesSetup?.();this.dispatchEvent(et.particlesSetup)}async initDrawersAndUpdaters(){const t=this.#s;this.effectDrawers=await t.getEffectDrawers(this,!0),this.shapeDrawers=await t.getShapeDrawers(this,!0),this.particleUpdaters=await t.getUpdaters(this,!0)}pause(){if(Ys(this)&&(void 0!==this.#ss&&(Ut(this.#ss),this.#ss=void 0),!this.#ls)){for(const t of this.plugins)t.pause?.();this.pageHidden||(this.#ls=!0),this.dispatchEvent(et.containerPaused)}}play(t){if(!Ys(this))return;const s=this.#ls||t;if(!this.#hs||this.actualOptions.autoPlay){if(this.#ls&&(this.#ls=!1),s)for(const t of this.plugins)t.play&&t.play();this.dispatchEvent(et.containerPlay),this.draw(s??!1)}else this.#hs=!1}async refresh(){if(Ys(this))return this.stop(),this.start()}async reset(t){if(Ys(this))return this.#os=t,this.#fs=t,this.#cs=Ns(this.#s,this,this.#os,this.sourceOptions),this.actualOptions=Ns(this.#s,this,this.#cs),this.refresh()}async start(){Ys(this)&&!this.started&&(await this.init(),this.started=!0,await new Promise((t=>{const s=async()=>{this.#es.addListeners();for(const t of this.plugins)await(t.start?.());this.dispatchEvent(et.containerStarted),this.play(),t()};this.#Qt=setTimeout((()=>{s()}),this.#Kt)})))}stop(){if(Ys(this)&&this.started){this.#Qt&&(clearTimeout(this.#Qt),this.#Qt=void 0),this.#hs=!0,this.started=!1,this.#es.removeListeners(),this.pause(),this.particles.clear(),this.canvas.stop();for(const t of this.plugins)t.stop?.();this.particleCreatedPlugins.length=0,this.particleDestroyedPlugins.length=0,this.particlePositionPlugins.length=0,this.#fs=this.#cs,this.dispatchEvent(et.containerStopped)}}updateActualOptions(){let t=!1;for(const s of this.plugins)s.updateActualOptions&&(t=s.updateActualOptions()||t);return t}#us(t){try{if(!this.#ds&&void 0!==this.#ns&&t<this.#ns+Q/this.fpsLimit)return void this.draw(!1);if(this.#ns??=t,function(t,s,i=qt,e=!1){t.value=s,t.factor=e?qt/i:qt*s/Q}(this.#Jt,t-this.#ns,this.fpsLimit,this.#ds),this.addLifeTime(this.#Jt.value),this.#ns=t,this.#Jt.value>Q)return void this.draw(!1);if(this.canvas.render.drawParticles(this.#Jt),!this.alive())return void this.destroy();this.animationStatus&&this.draw(!1)}catch(t){kt().error("error in animation loop",t)}}}export{_s as Container}
|