1import{$ as e,B as t,C as n,D as r,G as i,H as a,J as o,K as s,L as c,M as l,N as u,O as d,Q as f,S as p,T as m,U as h,V as g,X as _,Y as v,_ as y,b as ee,c as b,et as x,f as te,g as S,it as C,j as ne,l as re,lt as ie,n as w,o as ae,ot as T,p as oe,s as E,st as D,t as O,tt as se,ut as ce,v as le,w as ue,x as de,y as k}from"./LogUtils-D1uL_RU1.js";import{t as A}from"./DrawLayer-DBsd50qj.js";import{A as j,C as M,D as N,E as P,M as F,N as I,O as L,S as R,T as z,_ as fe,b as pe,g as B,k as V,m as H,p as me,v as U,w as W,x as G,y as he}from"./index-BDimrMBs.js";var K;(function(e){e.delete=`delete`,e.wait=`wait`})(K||={});var ge=class extends N{color;draw;element;image=``;opacity=1;position=``;repeat=``;size=``;constructor(){super(),this.color=new M,this.color.value=``}doLoad(e){e.color!==void 0&&(this.color=M.create(this.color,e.color)),z(this,`element`,e.element),z(this,`draw`,e.draw),z(this,`image`,e.image),z(this,`position`,e.position),z(this,`repeat`,e.repeat),z(this,`size`,e.size),z(this,`opacity`,e.opacity)}},_e=class extends N{enable=!0;zIndex=0;doLoad(e){z(this,`enable`,e.enable),z(this,`zIndex`,e.zIndex)}},ve=class extends N{delay=.5;enable=!0;doLoad(e){z(this,`delay`,e.delay),z(this,`enable`,e.enable)}},ye=class extends N{close=!0;options={};type=[];doLoad(e){let t=e.options;if(t!==void 0)for(let e in t){let n=t[e];n&&(this.options[e]=E(this.options[e]??{},n))}z(this,`close`,e.close),z(this,`type`,e.type)}},q=class extends N{color;enable=!0;opacity=1;doLoad(e){e.color!==void 0&&(this.color=R.create(this.color,e.color)),z(this,`enable`,e.enable),P(this,`opacity`,e.opacity)}},be=class extends N{offset=0;value=90;doLoad(e){P(this,`offset`,e.offset),P(this,`value`,e.value)}},xe=class extends N{mode=de.percent;radius=0;x=50;y=50;doLoad(e){z(this,`x`,e.x),z(this,`y`,e.y),z(this,`mode`,e.mode),z(this,`radius`,e.radius)}},Se=class extends N{acceleration=9.81;enable=!1;inverse=!1;maxSpeed=50;doLoad(e){P(this,`acceleration`,e.acceleration),z(this,`enable`,e.enable),z(this,`inverse`,e.inverse),P(this,`maxSpeed`,e.maxSpeed)}},Ce=class extends N{clamp=!0;delay=new G;enable=!1;generator;options={};doLoad(e){z(this,`clamp`,e.clamp),this.delay.load(e.delay),z(this,`enable`,e.enable),this.generator=e.generator,e.options&&(this.options=E(this.options,e.options))}},we=class extends N{bottom;default=j.out;left;right;top;doLoad(e){e.default!==void 0&&(this.default=e.default),this.bottom=e.bottom??e.default,this.left=e.left??e.default,this.right=e.right??e.default,this.top=e.top??e.default}},Te=class extends N{acceleration=0;enable=!1;position;doLoad(e){P(this,`acceleration`,e.acceleration),z(this,`enable`,e.enable),e.position&&(this.position=E({},e.position))}},Ee=class extends N{angle=new be;center=new xe;decay=0;direction=_.none;distance={};drift=0;enable=!1;gravity=new Se;outModes=new we;path=new Ce;random=!1;size=!1;speed=2;spin=new Te;straight=!1;vibrate=!1;warp=!1;doLoad(e){this.angle.load(i(e.angle)?{value:e.angle}:e.angle),this.center.load(e.center),P(this,`decay`,e.decay),z(this,`direction`,e.direction),e.distance!==void 0&&(this.distance=i(e.distance)?{horizontal:e.distance,vertical:e.distance}:{...e.distance}),P(this,`drift`,e.drift),z(this,`enable`,e.enable),this.gravity.load(e.gravity);let t=e.outModes;t!==void 0&&(s(t)?this.outModes.load(t):this.outModes.load({default:t})),this.path.load(e.path),z(this,`random`,e.random),z(this,`size`,e.size),P(this,`speed`,e.speed),this.spin.load(e.spin),z(this,`straight`,e.straight),z(this,`vibrate`,e.vibrate),z(this,`warp`,e.warp)}},De=class extends N{color;opacity;width=0;doLoad(e){e.color!==void 0&&(this.color=R.create(this.color,e.color)),P(this,`width`,e.width),P(this,`opacity`,e.opacity)}},J=class extends N{color;fill;stroke;doLoad(e){e.color!==void 0&&(this.color=R.create(this.color,e.color)),W(this,`fill`,e.fill,()=>new q),W(this,`stroke`,e.stroke,()=>new De)}},Oe=class extends N{enable=!1;height=1080;width=1920;doLoad(e){z(this,`enable`,e.enable),z(this,`width`,e.width),z(this,`height`,e.height)}},ke=class extends N{mode=K.delete;value=0;doLoad(e){z(this,`mode`,e.mode),z(this,`value`,e.value)}},Ae=class extends N{density=new Oe;limit=new ke;value=0;doLoad(e){this.density.load(e.density),this.limit.load(e.limit),z(this,`value`,e.value)}},je=class extends N{close=!0;options={};type=`circle`;doLoad(e){let t=e.options;if(t!==void 0)for(let e in t){let n=t[e];n&&(this.options[e]=E(this.options[e]??{},n))}z(this,`close`,e.close),z(this,`type`,e.type)}},Me=class extends G{opacityRate=1;sizeRate=1;velocityRate=1;doLoad(e){super.doLoad(e),z(this,`opacityRate`,e.opacityRate),z(this,`sizeRate`,e.sizeRate),z(this,`velocityRate`,e.velocityRate)}},Ne=class extends N{bounce=new pe;effect=new ye;groups={};move=new Ee;number=new Ae;paint;palette;reduceDuplicates=!1;shape=new je;zIndex=new Me;#e;#t;constructor(e,t){super(),this.#t=e,this.#e=t,this.paint=new J,this.paint.color=new R,this.paint.color.value=`#fff`,this.paint.fill=new q,this.paint.fill.enable=!0}doLoad(e){if(e.palette&&(this.palette=e.palette,this.#n(this.palette)),e.groups!==void 0)for(let t of Object.keys(e.groups)){if(!(t in e.groups))continue;let n=e.groups[t];n!==void 0&&(this.groups[t]=E(this.groups[t]??{},n))}e.reduceDuplicates!==void 0&&(this.reduceDuplicates=e.reduceDuplicates),this.bounce.load(e.bounce),this.effect.load(e.effect),this.move.load(e.move),this.number.load(e.number);let t=e.paint;if(t&&(a(t)?this.paint=b(t,e=>{let t=new J;return t.load(e),t}):(a(this.paint)&&(this.paint=new J),this.paint.load(t))),this.shape.load(e.shape),this.zIndex.load(e.zIndex),this.#e){for(let t of this.#t.plugins)t.loadParticlesOptions&&t.loadParticlesOptions(this.#e,this,e);let t=this.#t.updaters.get(this.#e);if(t)for(let n of t)n.loadOptions&&n.loadOptions(this,e)}}#n(e){let t=this.#t.getPalette(e);
1if(!t)return;let n=t.colors,r={},i=(a(n)?n:[n]).flatMap(e=>{let t=e.fill,n=e.stroke,r=t?{color:{value:t.value},enable:t.enable,opacity:t.opacity}:void 0;return n?[{fill:r,stroke:{color:{value:n.value},opacity:n.opacity,width:n.width||0}}]:[{fill:r}]}),o=i.length>1?i:i[0]??r;this.load({paint:o,blend:{enable:!0,mode:t.blendMode}})}};function Y(e,t,...n){let r=new Ne(e,t);return L(r,...n),r}var Pe=class extends N{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;#e;#t;constructor(e,t){super(),this.#t=e,this.#e=t,this.background=new ge,this.fullScreen=new _e,this.particles=Y(this.#t,this.#e),this.resize=new ve}doLoad(e){e.preset!==void 0&&(this.preset=e.preset,b(this.preset,e=>{this.#r(e)})),e.palette!==void 0&&(this.palette=e.palette,this.#n(this.palette)),z(this,`autoPlay`,e.autoPlay),z(this,`clear`,e.clear),z(this,`key`,e.key),z(this,`name`,e.name),P(this,`delay`,e.delay),z(this,`detectRetina`,e.detectRetina),P(this,`duration`,e.duration),z(this,`fpsLimit`,e.fpsLimit),z(this,`hdr`,e.hdr),z(this,`pauseOnBlur`,e.pauseOnBlur),z(this,`pauseOnOutsideViewport`,e.pauseOnOutsideViewport),z(this,`zLayers`,e.zLayers),this.background.load(e.background);let t=e.fullScreen;h(t)?this.fullScreen.enable=t:this.fullScreen.load(t),this.particles.load(e.particles),this.resize.load(e.resize),this.style=E(this.style,e.style),z(this,`smooth`,e.smooth),this.#t.plugins.forEach(t=>{t.loadOptions(this.#e,this,e)})}#n(e){let t=this.#t.getPalette(e);t&&this.load({background:{color:t.background},blend:{enable:!0,mode:t.blendMode},particles:{palette:e}})}#r(e){this.load(this.#t.getPreset(e))}},Fe=0,Ie=1;function Le(e,t,n){let r=t[n];r!==void 0&&(e[n]=(e[n]??1)*r)}var Re=class{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m;#h={};#g=[void 0,void 0];#_={};constructor(e,t,n){this.#f=e,this.#a=t,this.#r=n,this.#o=null,this.#e=null,this.#t=new Set,this.#m=[],this.#p=[],this.#n=[],this.#i=[],this.#c=[],this.#l=[],this.#u=[],this.#d={0:[],1:[],2:[],3:[],4:[],5:[],6:[],7:[]}}get settings(){return this.#s}canvasClear(){this.#a.actualOptions.clear&&this.draw(e=>{e.clearRect(D.x,D.y,this.#r.size.width,this.#r.size.height)})}clear(){for(let e of this.#n)if(e.canvasClear?.()??!1)return;for(let e of Object.values(A))if(typeof e==`number`){for(let t of this.#D(e))if(t.canvasClear?.()??!1)return}this.canvasClear()}destroy(){this.stop(),this.#e=null,this.#t.clear(),this.#m=[],this.#p=[],this.#n=[],this.#i=[],this.#c=[],this.#l=[],this.#u=[];for(let e of Object.values(A))typeof e==`number`&&(this.#d[e]=[])}draw(e){let t=this.#o;if(t)return e(t)}drawParticle(e,t){if(e.spawning||e.destroyed)return;let n=e.getRadius();if(n<=0)return;let r=e.getFillColor(),i=e.getStrokeColor(),[a,o]=this.#O(e);if(a??=r,o??=i,!a&&!o)return;let s=this.#a,c=e.options.zIndex,l=1-e.zIndexFactor,{fillOpacity:u,opacity:d,strokeOpacity:f}=e.getOpacity(),p=this.#_,m=this.#h,h=a?B(a,s.hdr,u*d):void 0,g=o?B(o,s.hdr,f*d):h;p.a=p.b=p.c=p.d=void 0,m.fill=h,m.stroke=g,this.draw(r=>{for(let n of this.#u)n.drawParticleSetup?.(r,e,t);this.#y(r,e,n,d,m,p),this.#S({container:s,context:r,particle:e,delta:t,colorStyles:m,radius:n*l**c.sizeRate,opacity:d,transform:p}),this.#v(e);for(let n of this.#l)n.drawParticleCleanup?.(r,e,t)})}drawParticlePlugins(e,t){this.draw(n=>{for(let r of this.#c)this.#C(n,r,e,t)})}drawParticles(e){let{particles:t,actualOptions:n}=this.#a;this.clear(),t.update(e),this.draw(r=>{let i=this.#r.size.width,a=this.#r.size.height;if(this.#e)try{r.drawImage(this.#e,D.x,D.y,i,a)}catch{this.#A(`background-element-draw-error`,`Error drawing background element onto canvas`)}let o=n.background;if(o.draw)try{o.draw(r,e)}catch{this.#A(`background-draw-error`,`Error in background.draw callback`)}for(let e of this.#D(A.BackgroundMask))e.canvasPaint?.();for(let t of this.#D(A.CanvasSetup))t.drawSettingsSetup?.(r,e);for(let t of this.#D(A.PluginContent))t.draw?.(r,e);t.drawParticles(e);for(let t of this.#D(A.CanvasCleanup))t.clearDraw?.(r,e),t.drawSettingsCleanup?.(r,e)})}init(){this.initUpdaters(),this.initPlugins(),this.#k(),this.paint()}initPlugins(){this.#n=[],this.#i=[],this.#c=[],this.#u=[],this.#l=[];for(let e of Object.values(A))typeof e==`number`&&(this.#d[e]=[]);for(let e of this.#a.plugins)(e.particleFillColor??e.particleStrokeColor)&&this.#i.push(e),e.drawParticle&&this.#c.push(e),e.drawParticleSetup&&this.#u.push(e),e.drawParticleCleanup&&this.#l.push(e),e.canvasClear&&this.#n.push(e),e.canvasPaint&&this.#D(A.Backgroun
1dMask).push(e),e.drawSettingsSetup&&this.#D(A.CanvasSetup).push(e),e.draw&&this.#D(A.PluginContent).push(e),(e.clearDraw??e.drawSettingsCleanup)&&this.#D(A.CanvasCleanup).push(e)}initUpdaters(){this.#m=[],this.#p=[];for(let e of this.#a.particleUpdaters)e.afterDraw&&this.#p.push(e),(e.getColorStyles??e.getTransformValues??e.beforeDraw)&&this.#m.push(e)}paint(){let e=!1;for(let t of this.#D(A.BackgroundMask))if(e=t.canvasPaint?.()??!1,e)break;e||this.paintBase()}paintBase(e){this.draw(t=>{t.fillStyle=e??`rgba(0,0,0,0)`,t.fillRect(D.x,D.y,this.#r.size.width,this.#r.size.height)})}paintImage(e,t){this.draw(n=>{if(!e)return;let r=n.globalAlpha;n.globalAlpha=t,n.drawImage(e,D.x,D.y,this.#r.size.width,this.#r.size.height),n.globalAlpha=r})}setContext(e){this.#o=e,this.#o&&(this.#o.globalCompositeOperation=f)}setContextSettings(e){this.#s=e}stop(){this.draw(e=>{e.clearRect(D.x,D.y,this.#r.size.width,this.#r.size.height)})}#v(e){for(let t of this.#p)t.afterDraw?.(e)}#y(e,t,n,r,i,a){for(let o of this.#m){if(o.getColorStyles){let{fill:a,stroke:s}=o.getColorStyles(t,e,n,r);a&&(i.fill=a),s&&(i.stroke=s)}if(o.getTransformValues){let e=o.getTransformValues(t);for(let t in e)Le(a,e,t)}o.beforeDraw?.(t)}}#b(e,t){if(!e?.drawAfter)return;let{particle:n}=t;n.effect&&e.drawAfter(t)}#x(e,t){if(!e?.drawBefore)return;let{particle:n}=t;n.effect&&e.drawBefore(t)}#S(e){let{container:t,context:n,particle:r,delta:i,colorStyles:a,radius:o,opacity:s,transform:c}=e,{effectDrawers:l,shapeDrawers:u}=t,d=r.getPosition(),f=r.getTransformData(c),p={x:d.x,y:d.y};n.setTransform(f.a,f.b,f.c,f.d,d.x,d.y),a.fill&&(n.fillStyle=a.fill);let m=!!r.fillEnabled,h=r.strokeWidth??0;n.lineWidth=h,a.stroke&&(n.strokeStyle=a.stroke);let g={context:n,particle:r,radius:o,drawRadius:o*1,opacity:s,delta:i,pixelRatio:t.retina.pixelRatio,fill:m,stroke:h>0,transformData:f,position:{...d},drawPosition:p,drawScale:1};for(let e of t.plugins)e.drawParticleTransform?.(g);let _=r.effect?l.get(r.effect):void 0,v=r.shape?u.get(r.shape):void 0;this.#x(_,g),this.#E(v,g),this.#w(v,g),this.#T(v,g),this.#b(_,g),n.resetTransform()}#C(e,t,n,r){t.drawParticle&&t.drawParticle(e,n,r)}#w(e,t){if(!e)return;let{context:n,fill:r,particle:i,stroke:a}=t;i.shape&&(n.beginPath(),e.draw(t),i.shapeClose&&n.closePath(),r&&n.fill(),a&&n.stroke())}#T(e,t){if(!e?.afterDraw)return;let{particle:n}=t;n.shape&&e.afterDraw(t)}#E(e,t){if(!e?.beforeDraw)return;let{particle:n}=t;n.shape&&e.beforeDraw(t)}#D(e){return this.#d[e]}#O(e){let t,n;for(let r of this.#i)if(!t&&r.particleFillColor&&(t=U(this.#f,r.particleFillColor(e))),!n&&r.particleStrokeColor&&(n=U(this.#f,r.particleStrokeColor(e))),t&&n)break;return this.#g[Fe]=t,this.#g[Ie]=n,this.#g}#k(){let e=this.#a.actualOptions.background;if(this.#e=null,e.element)if(typeof e.element==`string`){if(typeof document<`u`){let t=document.querySelector(e.element);t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof HTMLImageElement?this.#e=t:t?this.#A(`background-element-not-supported`,`Background element "${e.element}" is not a supported drawable element (canvas, video, or img)`):this.#A(`background-element-not-found`,`Background element selector "${e.element}" not found`)}}else (e.element instanceof HTMLCanvasElement||e.element instanceof OffscreenCanvas||e.element instanceof HTMLVideoElement||e.element instanceof HTMLImageElement)&&(this.#e=e.element)}#A(e,t){this.#t.has(e)||(this.#t.add(e),O().warning(t))}},X=new WeakMap,ze=e=>{let t=X.get(e);if(t)return t;if(typeof e.transferControlToOffscreen!=`function`)throw TypeError(`OffscreenCanvas is required but not supported by this browser`);try{let t=e.transferControlToOffscreen();return X.set(e,t),t}catch{throw TypeError(`OffscreenCanvas transfer failed`)}},Be=e=>typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement;function Ve(e,t,n=!1){if(!t)return;let r=e.style,i=new Set;for(let e=0;e<r.length;e++){let t=r.item(e);t&&i.add(t)}for(let e=0;e<t.length;e++){let n=t.item(e);n&&i.add(n)}for(let e of i){let i=t.getPropertyValue(e);i?r.setProperty(e,i,n?`important`:``):r.removeProperty(e)}}var He=class{domElement;render;renderCanvas;size;zoom=1;#e;#t;#n;#r;#i;#a;#o;#s;#c;constructor(e,t){this.#i=e,this.#e=t,this.render=new Re(e,t,this),this.#s={height:0,width:0};let n=t.retina.pixelRatio,r=this.#s;this.size={height:r.height*n,width:r.width*n},this.#t=!1,this.#o=[],this.#a=`none`}get#l(){return this.#e.actualOptions.fullScreen.enable}destroy(){this.stop(),this.#t?(this.domElement?.remove(),this.domElement=void 0,this.renderCanvas=void 0):this.#m(),this.render.destroy(),this.#o=[]}getZoomCenter(){let e=this.#e.retina.pixelRatio,{width:t,height:n}=this.size;return this.#c?this.#c:{x:t*C/e,y:n*C/e}}init(){this.#h(e=>{e.disconnect()}),this.#n=ee(e=>{for(let t of e)t.type===`attributes`&&t.attributeName===`style`&&this.#p()}
1),this.resize(),this.#f(),this.initBackground(),this.#h(e=>{let t=this.domElement;!t||!(t instanceof Node)||e.observe(t,{attributes:!0})}),this.initPlugins(),this.#d(),this.render.init()}initBackground(){let e=this.#e,t=e.actualOptions.background,n=this.domElement;if(!n)return;let r=n.style,i=he(this.#i,t.color);i?r.backgroundColor=fe(i,e.actualOptions.hdr,t.opacity):r.backgroundColor=``,r.backgroundImage=t.image||``,r.backgroundPosition=t.position||``,r.backgroundRepeat=t.repeat||``,r.backgroundSize=t.size||``}initPlugins(){this.#o=[];for(let e of this.#e.plugins)e.resize&&this.#o.push(e)}loadCanvas(e){this.#t&&this.domElement&&this.domElement.remove();let t=Be(e)?e:void 0;this.domElement=t,this.#t=t?t.dataset[se]===`true`:!1,this.renderCanvas=t?ze(t):e;let n=this.domElement;n&&(n.ariaHidden=`true`,this.#r=ae(n.style));let r=this.#s,i=this.renderCanvas;n?(r.height=n.offsetHeight,r.width=n.offsetWidth):(r.height=i.height,r.width=i.width);let a=this.#e.retina.pixelRatio,o=this.size;i.height=o.height=r.height*a,i.width=o.width=r.width*a}resize(){let e=this.domElement;if(!e)return!1;let t=this.#e,n=this.renderCanvas;if(n===void 0)return!1;let r=t.canvas.#s,i={width:e.offsetWidth,height:e.offsetHeight},a=t.retina.pixelRatio,o={width:i.width*a,height:i.height*a};if(i.height===r.height&&i.width===r.width&&o.height===n.height&&o.width===n.width)return!1;let s={...r};r.height=i.height,r.width=i.width;let c=this.size;return n.width=c.width=o.width,n.height=c.height=o.height,this.#e.started&&t.particles.setResizeFactor({width:r.width/s.width,height:r.height/s.height}),!0}setPointerEvents(e){this.domElement&&(this.#a=e,this.#p())}setZoom(e,t){this.zoom=e,this.#c=t}stop(){this.#h(e=>{e.disconnect()}),this.#n=void 0,this.render.stop()}async windowResize(){if(!this.domElement||!this.resize())return;let e=this.#e,t=e.updateActualOptions();e.particles.setDensity(),this.#u(),t&&await e.refresh()}#u(){for(let e of this.#o)e.resize?.()}#d(){let e=this.#e.actualOptions.hdr&&k(`(color-gamut: p3)`)?.matches&&k(`(dynamic-range: high)`)?.matches;this.render.setContextSettings({alpha:!0,desynchronized:!0,willReadFrequently:!1,...e?{colorSpace:`display-p3`,colorType:`float16`}:{colorSpace:`srgb`}});let t=this.renderCanvas;t&&this.render.setContext(t.getContext(`2d`,this.render.settings))}#f(){let e=this.domElement,t=this.#e.actualOptions;if(e){this.#l?this.#g():this.#m();for(let n in t.style){if(!n||!(n in t.style))continue;let r=t.style[n];r&&e.style.setProperty(n,r,`important`)}}}#p(){let e=this.domElement;if(!e)return;this.#h(e=>{e.disconnect()}
1),this.#f(),this.initBackground();let t=this.#a;e.style.pointerEvents=t,e.style.setProperty(`pointer-events`,t),this.#h(t=>{e instanceof Node&&t.observe(e,{attributes:!0})})}#m(){let e=this.domElement,t=this.#r;!e||!t||Ve(e,t,!0)}#h(e){this.#n&&e(this.#n)}#g(){let e=this.domElement;e&&Ve(e,re(this.#e.actualOptions.fullScreen.zIndex),!0)}},Ue=class{#e;#t;#n;#r;constructor(e){this.#e=e,this.#t={visibilityChange:()=>{this.#i()},resize:()=>{this.#a()}}}addListeners(){this.#o(!0)}removeListeners(){this.#o(!1)}#i(){let e=this.#e;e.actualOptions.pauseOnBlur&&(le().hidden?(e.pageHidden=!0,e.pause()):(e.pageHidden=!1,e.animationStatus?e.play(!0):e.draw(!0)))}#a(){this.#r&&=(clearTimeout(this.#r),void 0);let e=async()=>{await this.#e.canvas.windowResize()};this.#r=setTimeout(()=>void e(),this.#e.actualOptions.resize.delay*T)}#o(e){let t=this.#t;this.#s(e),y(document,ce,t.visibilityChange,e,!1)}#s(e){let t=this.#t,n=this.#e;if(!n.actualOptions.resize.enable)return;if(typeof ResizeObserver>`u`){y(globalThis,ie,t.resize,e);return}let r=n.canvas.domElement;this.#n&&!e?(r&&this.#n.unobserve(r),this.#n.disconnect(),this.#n=void 0):!this.#n&&e&&r&&(this.#n=new ResizeObserver(e=>{e.find(e=>e.target===r)&&this.#a()}),this.#n.observe(r))}};function We(e,t,n,r){let i=t.options[e];return E({close:t.close},S(i,n,r))}function Ge(e,t,n,r){let i=t.options[e];return E({close:t.close},S(i,n,r))}function Ke(e){if(!oe(e.outMode,e.checkModes))return;let t=e.radius*2;e.coord>e.maxCoord-t?e.setCb(-e.radius):e.coord<t&&e.setCb(e.radius)}function Z(e,t){let n=e%t;return n<0?n+t:n}function qe(e,t,n){e.id=t,e.group=n,e.justWarped=!1,e.effectClose=!0,e.shapeClose=!0,e.pathRotation=!1,e.lastPathTime=0,e.destroyed=!1,e.unbreakable=!1,e.isRotating=!1,e.rotation=0,e.misplaced=!1,e.retina={maxDistance:{},maxSpeed:0,moveDrift:0,moveSpeed:0,sizeAnimationSpeed:0},e.size={value:1,max:1,min:1,enable:!1},e.outType=V.normal,e.ignoresResizeRatio=!0}function Je(e,t,n,r){let i=t.actualOptions,a=Y(n,t,i.particles),o=a.reduceDuplicates;e.effect=S(a.effect.type,e.id,o),e.shape=S(a.shape.type,e.id,o);let s=a.effect,c=a.shape;if(r){if(r.effect){let t=r.effect.type;if(t&&t!==e.effect){let n=S(t,e.id,o);n&&(e.effect=n)}s.load(r.effect)}if(r.shape){let t=r.shape.type;if(t&&t!==e.shape){let n=S(t,e.id,o);n&&(e.shape=n)}c.load(r.shape)}}if(e.effect===`random`){let n=[...t.effectDrawers.keys()];e.effect=n[Math.floor(u()*n.length)]}if(e.shape===`random`){let n=[...t.shapeDrawers.keys()];e.shape=n[Math.floor(u()*n.length)]}e.effectData=e.effect?We(e.effect,s,e.id,o):void 0,e.shapeData=e.shape?Ge(e.shape,c,e.id,o):void 0,a.load(r);let l=e.effectData,d=e.shapeData;return l&&a.load(l.particles),d&&a.load(d.particles),e.effectClose=l?.close??a.effect.close,e.shapeClose=d?.close??a.shape.close,a}function Ye(e,t){let n,r;e.effect&&(n=t.effectDrawers.get(e.effect)),n?.loadEffect&&n.loadEffect(e),e.shape&&(r=t.shapeDrawers.get(e.shape)),r?.loadShape&&r.loadShape(e);let i=r?.getSidesCount;i&&(e.sides=i(e))}function Xe(e,t){for(let n of e)n.preInit?.(t)}function Ze(e,t){for(let n of e)n.init(t)}function Qe(e,t){let n=t.shape?e.shapeDrawers.get(t.shape):void 0;(t.effect?e.effectDrawers.get(t.effect):void 0)?.particleInit?.(e,t),n?.particleInit?.(e,t)}function $e(e,t){for(let n of e.particleCreatedPlugins)n.particleCreated?.(t)}var et=class{backColor;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;spawning;strokeColor;strokeOpacity;strokeWidth;unbreakable;velocity;zIndexFactor;#e={fillOpacity:1,opacity:1,strokeOpacity:1};#t=v.origin;#n={sin:0,cos:0};#r={a:1,b:0,c:0,d:1};#i;#a=[];#o;constructor(e,t){this.#o=e,this.#i=t}addModifier(e){this.#a.push(e),this.#a.sort((e,t)=>e.priority-t.priority)}clearModifiers(){this.#a.length=0}destroy(e){if(this.unbreakable||this.destroyed)return;this.destroyed=!0,this.clearModifiers();let t=this.#i;(this.shape?t.shapeDrawers.get(this.shape):void 0)?.particleDestroy?.(this);for(let n of t.particleDestroyedPlugins)n.particleDestroyed?.(this,e);for(let n of t.particleUpdaters)n.particleDestroyed?.(this,e);this.#i.dispatchEvent(w.particleDestroyed,{particle:this})}draw(e){let t=this.#i.canvas.render;
1t.drawParticlePlugins(this,e),t.drawParticle(this,e)}getAngle(){return this.rotation+(this.pathRotation?this.velocity.angle:0)}getFillColor(){return this.#h(this.#s(H(this.fillColor),e=>e.fillColor))}getMass(){return this.getRadius()**2*Math.PI*C}getModifier(e){return this.#a.find(t=>t.id===e)}getOpacity(){let e=this.options.zIndex,t=(1-this.zIndexFactor)**e.opacityRate,n=c(this.opacity?.value??1),r=this.#s(void 0,e=>e.opacity)??n,i=this.fillOpacity??1,a=this.strokeOpacity??1;return this.#e.fillOpacity=r*i*t,this.#e.opacity=r*t,this.#e.strokeOpacity=r*a*t,this.#e}getPosition(){return this.#t.x=this.position.x+this.offset.x,this.#t.y=this.position.y+this.offset.y,this.#t.z=this.position.z,this.#t}getRadius(){return this.#s(this.size.value,e=>e.radius)}getRotateData(){let e=this.getAngle();return this.#n.sin=Math.sin(e),this.#n.cos=Math.cos(e),this.#n}getStrokeColor(){return this.#h(this.#s(H(this.strokeColor),e=>e.strokeColor))}getTransformData(t){let n=this.getRotateData(),r=this.isRotating;return this.#r.a=n.cos*(t.a??e.a),this.#r.b=r?n.sin*(t.b??1):t.b??e.b,this.#r.c=r?-n.sin*(t.c??1):t.c??e.c,this.#r.d=n.cos*(t.d??e.d),this.#r}init(e,t,n,r){let i=this.#i;qe(this,e,r),this.options=Je(this,i,this.#o,n),i.retina.initParticle(this),Xe(i.particleUpdaters,this),this.#g(t),this.initialVelocity=this.#l(),this.velocity=this.initialVelocity.copy(),this.zIndexFactor=this.position.z/i.zLayers,this.sides=24,Ye(this,i),this.spawning=!1,Ze(i.particleUpdaters,this),Qe(i,this),$e(i,this)}isInsideCanvas(e){return this.#m({direction:e}).inside}isInsideCanvasForOutMode(e,t){return this.#m({direction:t,outMode:e}).inside}isShowingBack(){if(!this.roll)return!1;let e=this.roll.angle;if(this.roll.horizontal&&this.roll.vertical){let t=Z(e,x);return t>=Math.PI*.5&&t<Math.PI*3*.5}if(this.roll.horizontal){let t=Z(e+Math.PI*C,x);return t>=Math.PI&&t<Math.PI*2}if(this.roll.vertical){let t=Z(e,x);return t>=Math.PI&&t<Math.PI*2}return!1}isVisible(){return!this.destroyed&&!this.spawning&&this.isInsideCanvas()}removeModifier(e){let t=this.#a.findIndex(t=>t.id===e);t>=0&&this.#a.splice(t,1)}reset(){for(let e of this.#i.particleUpdaters)e.reset?.(this)}#s(e,t){let n=e;for(let e of this.#a)if(e.enabled){let r=t(e);r!==void 0&&(n=r)}return n}#c(e,t){let n=0,r=e?v.create(e.x,e.y,t):void 0,i=this.#i,a=i.particlePositionPlugins,o=this.options.move.outModes,s=this.getRadius(),c=i.canvas.size;for(;;){for(let e of a){let n=e.particlePosition?.(r,this);if(n)return v.create(n.x,n.y,t)}let e=ue({size:c,position:r}),l=v.create(e.x,e.y,t);this.#u(l,s,o.left??o.default),this.#u(l,s,o.right??o.default),this.#d(l,s,o.top??o.default),this.#d(l,s,o.bottom??o.default);let u=!0;for(let e of i.particles.checkParticlePositionPlugins)if(u=e.checkParticlePosition?.(this,l,n)??!0,!u)break;if(u)return l;n+=1,r=void 0}}#l(){let e=this.options.move,n=ne(this.direction).copy();if(e.direction===_.inside||e.direction===_.outside)return n;let r=d(c(e.angle.value)),i=d(c(e.angle.offset)),a={left:i-r*C,right:i+r*C};return e.straight||(n.angle+=t(g(a.left,a.right))),e.random&&typeof e.speed==`number`&&(n.length*=u()),n}#u(e,t,n){Ke({outMode:n,checkModes:[j.bounce],coord:e.x,maxCoord:this.#i.canvas.size.width,setCb:t=>e.x+=t,radius:t})}#d(e,t,n){Ke({outMode:n,checkModes:[j.bounce],coord:e.y,maxCoord:this.#i.canvas.size.height,setCb:t=>e.y+=t,radius:t})}#f(e,t){let n=this.getRadius(),r=this.#i.canvas.size,i=this.position,a=t===j.bounce;return e===p.bottom?{inside:a?i.y+n<r.height:i.y-n<r.height,reason:`default`}:e===p.left?{inside:a?i.x-n>0:i.x+n>0,reason:`default`}:e===p.right?{inside:a?i.x+n<r.width:i.x-n<r.width,reason:`default`}:e===p.top?{inside:a?i.y-n>0:i.y+n>0,reason:`default`}:{inside:i.x>=-n&&i.y>=-n&&i.y<=r.height+n&&i.x<=r.width+n,reason:`default`}}#p(e,t){return{canvasSize:this.#i.canvas.size,direction:e,outMode:t,particle:this,radius:this.getRadius()}}#m(e){let t=this.#f(e.direction,e.outMode),n=this.#i,r=this.shape?n.shapeDrawers.get(this.shape):void 0,i=this.effect?n.effectDrawers.get(this.effect):void 0,a=r?.isInsideCanvas,o=i?.isInsideCanvas;if(!a&&!o)return t;let s=this.#p(e.direction,e.outMode),c=a?this.#_(a(s),`shape`):void 0,l=o?this.#_(o(s),`effect`):void 0;if(c&&l){let e=Math.max(c.margin??0,l.margin??0);return{inside:c.inside&&l.inside,margin:e>0?e:void 0,reason:`combined`}}return c??l??t}#h(e){return!e||!this.roll||!this.backColor&&!this.roll.alter||!this.isShowingBack()?e:this.backColor?this.backColor:this.roll.alter?me(e,this.roll.alter.type,this.roll.alter.value):e}#g(e){let t=this.#i,n=Math.floor(c(this.options.zIndex.value)),i=this.#c(e,r(n,0,t.zLayers));if(!i)throw Error(`a valid position cannot be found for particle`);this.position=i,this.initialPosition=this.position.copy();let a=t.canvas.size;switch(this.moveCenter={...te(this.options.move.center,a),radius:this.options.move.center.radius,mode:this.options.move.center.mode},this.direction=l(this.options.move.direction,this.position,this.moveCenter),this.options.move.direction){case _.inside:this.outType=V.inside;break;case _.outside:this.outType=V.outside;break;default:break}this.offset=o.origin}#_(e,t){return typeof e==`boolean`?{inside:e,reason:t}:{inside:e.inside,margin:e.margin,reason:e.reason??t}}},tt=class{#e;#t=new Map;#n=[];#r;#i;#a=[];#o;constructor(e){this.#e=e,this.#r=0,this.#o=0}clear(){this.#t.clear();let e=this.#i;e&&(this.#e=e),this.#i=void 0}insert(e){let{x:t,y:n}=e.getPosition(),r=this.#l(t,n);this.#t.has(r)||this.#t.set(r,[]),this.#t.get(r)?.push(e)}query(e,t,n=[]){let r=this.#u(e);
1if(!r)return n;let i=Math.floor(r.minX/this.#e),a=Math.floor(r.maxX/this.#e),o=Math.floor(r.minY/this.#e),s=Math.floor(r.maxY/this.#e);for(let r=i;r<=a;r++)for(let i=o;i<=s;i++){let a=`${r}_${i}`,o=this.#t.get(a);if(o)for(let r of o)t&&!t(r)||e.contains(r.getPosition())&&n.push(r)}return n}queryCircle(e,t,n,r=[]){let i=this.#s(e.x,e.y,t),a=this.query(i,n,r);return this.#d(),a}queryRectangle(e,t,n,r=[]){let i=this.#c(e.x,e.y,t.width,t.height),a=this.query(i,n,r);return this.#d(),a}setCellSize(e){this.#i=e}#s(e,t,n){return(this.#n[this.#r++]??=new F(e,t,n)).reset(e,t,n)}#c(e,t,n,r){return(this.#a[this.#o++]??=new I(e,t,n,r)).reset(e,t,n,r)}#l(e,t){return`${Math.floor(e/this.#e)}_${Math.floor(t/this.#e)}`}#u(e){if(e instanceof F){let t=e.radius,{x:n,y:r}=e.position;return{minX:n-t,maxX:n+t,minY:r-t,maxY:r+t}}if(e instanceof I){let{x:t,y:n}=e.position,{width:r,height:i}=e.size;return{minX:t,maxX:t+r,minY:n,maxY:n+i}}return null}#d(){this.#r=0,this.#o=0}},nt=class{checkParticlePositionPlugins;grid;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m;constructor(e,t){this.#c=e,this.#t=t,this.#i=0,this.#e=[],this.#l=[],this.#r=0,this.#n=new Map,this.#a=new Map,this.#m=this.#_(this.#t.zLayers),this.grid=new tt(100),this.checkParticlePositionPlugins=[],this.#o=[],this.#s=[],this.#d=[],this.#u=[],this.#p=[]}get count(){return this.#e.length}addParticle(e,t,n,r){let i=this.#t.actualOptions.particles.number.limit.mode,a=n===void 0?this.#r:this.#n.get(n)??this.#r,o=this.count;if(a>0)switch(i){case K.delete:{let e=o+1-a;e>0&&this.removeQuantity(e);break}case K.wait:if(o>=a)return;break;default:break}try{let i=this.#l.pop()??new et(this.#c,this.#t);i.init(this.#i,e,t,n);let a=!0;if(r&&(a=r(i)),!a){this.#l.push(i);return}return this.#e.push(i),this.#b(i),this.#i++,this.#t.dispatchEvent(w.particleAdded,{particle:i}),i}catch(e){O().warning(`error adding particle: ${e}`)}}clear(){this.#e=[],this.#a.clear(),this.#C(this.#t.zLayers)}destroy(){this.#e=[],this.#l.length=0,this.#a.clear(),this.#m=[],this.checkParticlePositionPlugins=[],this.#o=[],this.#s=[],this.#d=[],this.#u=[],this.#p=[]}drawParticles(e){for(let t=this.#m.length-1;t>=0;t--){let n=this.#m[t];if(n)for(let t of n)t.draw(e)}}filter(e){return this.#e.filter(e)}find(e){return this.#e.find(e)}get(e){return this.#e[e]}
1async init(){let e=this.#t,t=e.actualOptions;this.checkParticlePositionPlugins=[],this.#p=[],this.#s=[],this.#d=[],this.#o=[],this.#u=[],this.#a.clear(),this.#C(e.zLayers),this.grid=new tt(100*e.retina.pixelRatio);for(let t of e.plugins)t.redrawInit&&await t.redrawInit(),t.checkParticlePosition&&this.checkParticlePositionPlugins.push(t),t.update&&this.#p.push(t),t.particleUpdate&&this.#s.push(t),t.postUpdate&&this.#d.push(t),t.particleReset&&this.#o.push(t),t.postParticleUpdate&&this.#u.push(t);await this.#t.initDrawersAndUpdaters();for(let t of this.#t.effectDrawers.values())await t.init?.(e);for(let t of this.#t.shapeDrawers.values())await t.init?.(e);let n=!1;for(let t of e.plugins)if(n=t.particlesInitialization?.()??n,n)break;if(!n){let e=t.particles,n=e.groups;for(let t in n){let r=n[t];if(r)for(let n=this.count,i=0;i<r.number.value&&n<e.number.value;n++,i++)this.addParticle(void 0,r,t)}for(let t=this.count;t<e.number.value;t++)this.addParticle()}}push(e,t,n,r){for(let i=0;i<e;i++)this.addParticle(t,n,r)}async redraw(){this.clear(),await this.init(),this.#t.canvas.render.drawParticles({value:0,factor:0})}remove(e,t,n){this.removeAt(this.#e.indexOf(e),void 0,t,n)}removeAt(e,t=1,n,r){if(e<0||e>this.count)return;let i=0;for(let a=e;i<t&&a<this.count;a++)this.#x(a,n,r)&&(a--,i++)}removeQuantity(e,t){this.removeAt(0,e,t)}setDensity(){let e=this.#t.actualOptions,t=e.particles.groups,n=0;for(let e of this.#t.plugins)e.particlesDensityCount&&(n+=e.particlesDensityCount());for(let e in t){let r=t[e];if(!r)continue;let i=Y(this.#c,this.#t,r);this.#g(i,n,e)}this.#g(e.particles,n)}setResizeFactor(e){this.#f=e}update(e){this.grid.clear();for(let t of this.#p)t.update?.(e);let t=this.#T(e);for(let t of this.#d)t.postUpdate?.(e);if(this.#E(e,t),t.size)for(let e of t)this.remove(e);this.#f=void 0}#h(...e){this.#l.push(...e)}#g(e,t,n,r){let i=e.number;if(!i.density.enable){n===void 0?this.#r=i.limit.value:(r?.number.limit.value??i.limit.value)&&this.#n.set(n,r?.number.limit.value??i.limit.value);return}let a=this.#y(i.density),o=i.value,s=i.limit.value>0?i.limit.value:o,c=Math.min(o,s)*a+t,l=Math.min(this.count,this.filter(e=>e.group===n).length);n===void 0?this.#r=i.limit.value*a:this.#n.set(n,i.limit.value*a),l<c?this.push(Math.abs(c-l),void 0,e,n):l>c&&this.removeQuantity(l-c,n)}#_(e){let t=Math.max(Math.floor(e),1);return Array.from({length:t},()=>[])}#v(e){let t=this.#m.length-1;return t<=0?0:Math.min(Math.max(Math.floor(e),0),t)}#y(e){let t=this.#t;if(!e.enable)return 1;let n=t.canvas.size,r=t.retina.pixelRatio;return!n.width||!n.height?1:n.width*n.height/(e.height*e.width*r**2)}#b(e){let t=this.#v(e.position.z),n=this.#m[t];n&&(n.push(e),this.#a.set(e.id,t))}#x(e,t,n){let r=this.#e[e];return!r||r.group!==t?!1:(this.#e.splice(e,1),this.#S(r),r.destroy(n),this.#t.dispatchEvent(w.particleRemoved,{particle:r}),this.#h(r),!0)}#S(e){let t=this.#a.get(e.id)??this.#v(e.position.z),n=this.#m[t];if(!n){this.#a.delete(e.id);return}let r=n.findIndex(t=>t.id===e.id);r>=0&&n.splice(r,1),this.#a.delete(e.id)}#C(e){let t=Math.max(Math.floor(e),1);if(this.#m.length!==t){this.#m=this.#_(t);return}for(let e of this.#m)e.length=0}#w(e){let t=this.#v(e.position.z),n=this.#a.get(e.id);if(n===void 0){this.#b(e);return}if(n===t)return;let r=this.#m[n];if(r){let t=r.findIndex(t=>t.id===e.id);t>=0&&r.splice(t,1)}let i=this.#m[t];if(!i){this.#a.set(e.id,t);return}if(i.push(e),i.length>=2){let t=i[i.length-2];t&&e.id<t.id&&i.sort((e,t)=>e.id-t.id)}this.#a.set(e.id,t)}#T(e){let t=new Set,n=this.#f;for(let r of this.#e){n&&!r.ignoresResizeRatio&&(r.position.x*=n.width,r.position.y*=n.height,r.initialPosition.x*=n.width,r.initialPosition.y*=n.height),r.ignoresResizeRatio=!1;for(let e of this.#o)e.particleReset?.(r);for(let t of this.#s){if(r.destroyed)break;t.particleUpdate?.(r,e)}if(r.destroyed){t.add(r);continue}this.grid.insert(r)}return t}#E(e,t){for(let n of this.#e){if(n.destroyed){t.add(n);continue}for(let t of this.#t.particleUpdaters)t.update(n,e);if(!n.spawning)for(let t of this.#u)t.postParticleUpdate?.(n,e);this.#w(n)}}},rt=class{pixelRatio;reduceFactor;#e;constructor(e){this.#e=e,this.pixelRatio=1,this.reduceFactor=1}init(){let e=this.#e,t=e.actualOptions;this.pixelRatio=t.detectRetina?devicePixelRatio:1,this.reduceFactor=1;let n=this.pixelRatio,r=e.canvas,i=r.domElement;i&&(r.size.width=i.offsetWidth*n,r.size.height=i.offsetHeight*n)}initParticle(e){let t=e.options,n=this.pixelRatio,r=t.move,i=r.distance,a=e.retina;a.maxSpeed=c(r.gravity.maxSpeed)*n,a.moveDrift=c(r.drift)*n,a.moveSpeed=c(r.speed)*n;let o=a.maxDistance;o.horizontal=i.horizontal===void 0?void 0:i.horizontal*n,o.vertical=i.vertical===void 0?void 0:i.vertical*n}};function Q(e){return!e.destroyed}function it(e,t,n=60,r=!1){e.value=t,e.factor=r?60/n:60*t/T}function $(e,t,...n){let r=new Pe(e,t);return L(r,...n),r}var at=class{actualOptions;canvas;destroyed;effectDrawers;fpsLimit;hdr;id;pageHidden;particleCreatedPlugins;particleDestroyedPlugins;particlePositionPlugins;particleUpdaters;particles;plugins;retina;shapeDrawers;started;zLayers;#e;#t;#n={value:0,factor:0};#r;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m;#h;#g;constructor(e){let{dispatchCallback:t,pluginManager:n,id:r,onDestroy:i,sourceOptions:a}=e;this.#m=n,this.#r=t,this.#d=i,this.id=Symbol(r),this.fpsLimit=120,this.hdr=!1,this.#h=!1,this.#e=0,this.#a=0,this.#u=0,this.#s=!0,this.started=!1,this.destroyed=!1,this.#p=!0,this.#l=0,this.zLayers=100,this.pageHidden=!1,this.#g=a,this.#c=a,this.effectDrawers=new Map,this.shapeDrawers=new Map,this.particleUpdaters=[],this.retina=new rt(this),this.canvas=new He(this.#m,this),this.particles=new nt(this.#m,this),this.plugins=[],this.particleDestroyedPlugins=[],this.particleCreatedPlugins=[],this.particlePositionPlugins=[],this.#f=$(this.#m,this),this.actualOptions=$(this.#m,this),this.#o=new Ue(this),this.dispatchEvent(w.containerBuilt)}get animationStatus(){return!this.#p&&!this.pageHidden&&Q(this)}get options(){return this.#f}get sourceOptions(){return this.#g}addLifeTime(e){this.#u+=e}alive(){return!this.#a||this.#u<=this.#a}destroy(e=!0){if(Q(this)){this.stop(),this.particles.destroy(),this.canvas.destroy();for(let[,e]of this.effectDrawers)e.destroy?.(this);for(let[,e]of this.shapeDrawers)e.destroy?.(this);for(let e of this.plugins)e.destroy?.();this.effectDrawers=new Map,this.shapeDrawers=new Map,this.particleUpdaters=[],this.plugins.length=0,this.#m.clearPlugins(this),this.destroyed=!0,this.#d(e),this.dispatchEvent(w.containerDestroyed)}}dispatchEvent(e,t){this.#r(e,{container:this,data:t})}draw(e){if(!Q(this))return;let t=e;this.#i=n(e=>{t&&=(this.#l=void 0,!1),this.#_(e)})}async export(e,t={}){for(let n of this.plugins){if(!n.export)continue;let r=await n.export(e,t);if(r.supported)return r.blob}O().error(`Export plugin with type ${e} not found`)}
1async init(){if(!Q(this))return;let e=new Map;for(let t of this.#m.plugins){let n=await t.getPlugin(this);n.preInit&&await n.preInit(),e.set(t,n)}await this.initDrawersAndUpdaters(),this.#f=$(this.#m,this,this.#c,this.sourceOptions),this.actualOptions=$(this.#m,this,this.#f),this.plugins.length=0,this.particleDestroyedPlugins.length=0,this.particleCreatedPlugins.length=0,this.particlePositionPlugins.length=0;for(let[t,n]of e)t.needsPlugin(this.actualOptions)&&(this.plugins.push(n),n.particleCreated&&this.particleCreatedPlugins.push(n),n.particleDestroyed&&this.particleDestroyedPlugins.push(n),n.particlePosition&&this.particlePositionPlugins.push(n));this.retina.init(),this.canvas.init(),this.updateActualOptions(),this.canvas.initBackground(),this.canvas.resize();let{delay:t,duration:n,fpsLimit:r,hdr:i,smooth:a,zLayers:o}=this.actualOptions;this.hdr=i,this.zLayers=o,this.#a=c(n)*T,this.#e=c(t)*T,this.#u=0,this.fpsLimit=r>0?r:120,this.#h=a;for(let e of this.plugins)await e.init?.();await this.particles.init(),this.dispatchEvent(w.containerInit),this.particles.setDensity();for(let e of this.plugins)e.particlesSetup?.();this.dispatchEvent(w.particlesSetup)}async initDrawersAndUpdaters(){let e=this.#m;this.effectDrawers=await e.getEffectDrawers(this,!0),this.shapeDrawers=await e.getShapeDrawers(this,!0),this.particleUpdaters=await e.getUpdaters(this,!0)}pause(){if(Q(this)&&(this.#i!==void 0&&(m(this.#i),this.#i=void 0),!this.#p)){for(let e of this.plugins)e.pause?.();this.pageHidden||(this.#p=!0),this.dispatchEvent(w.containerPaused)}}play(e){if(!Q(this))return;let t=this.#p||e;if(this.#s&&!this.actualOptions.autoPlay){this.#s=!1;return}if(this.#p&&=!1,t)for(let e of this.plugins)e.play&&e.play();this.dispatchEvent(w.containerPlay),this.draw(t??!1)}async refresh(){if(Q(this))return this.stop(),this.start()}async reset(e){if(Q(this))return this.#c=e,this.#g=e,this.#f=$(this.#m,this,this.#c,this.sourceOptions),this.actualOptions=$(this.#m,this,this.#f),this.refresh()}async start(){!Q(this)||this.started||(await this.init(),this.started=!0,await new Promise(e=>{let t=async()=>{this.#o.addListeners();for(let e of this.plugins)await e.start?.();this.dispatchEvent(w.containerStarted),this.play(),e()};this.#t=setTimeout(()=>void t(),this.#e)}))}stop(){if(!(!Q(this)||!this.started)){this.#t&&=(clearTimeout(this.#t),void 0),this.#s=!0,this.started=!1,this.#o.removeListeners(),this.pause(),this.particles.clear(),this.canvas.stop();for(let e of this.plugins)e.stop?.();this.particleCreatedPlugins.length=0,this.particleDestroyedPlugins.length=0,this.particlePositionPlugins.length=0,this.#g=this.#f,this.dispatchEvent(w.containerStopped)}}updateActualOptions(){let e=!1;for(let t of this.plugins)t.updateActualOptions&&(e=t.updateActualOptions()||e);return e}#_(e){try{if(!this.#h&&this.#l!==void 0&&e<this.#l+1e3/this.fpsLimit){this.draw(!1);return}if(this.#l??=e,it(this.#n,e-this.#l,this.fpsLimit,this.#h),this.addLifeTime(this.#n.value),this.#l=e,this.#n.value>1e3){this.draw(!1);return}if(this.canvas.render.drawParticles(this.#n),!this.alive()){this.destroy();return}this.animationStatus&&this.draw(!1)}catch(e){O().error(`error in animation loop`,e)}}};export{at as Container};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.