@tbmui/particles 0.9.0
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/build/index.js +1 -0
- package/package.json +24 -0
package/build/index.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
var wi=Object.create;var Ut=Object.defineProperty;var zi=Object.getOwnPropertyDescriptor;var Mi=Object.getOwnPropertyNames;var Pi=Object.getPrototypeOf,Oi=Object.prototype.hasOwnProperty;var Ri=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports);var Ci=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Mi(e))!Oi.call(s,o)&&o!==t&&Ut(s,o,{get:()=>e[o],enumerable:!(i=zi(e,o))||i.enumerable});return s};var Si=(s,e,t)=>(t=s!=null?wi(Pi(s)):{},Ci(e||!s||!s.__esModule?Ut(t,"default",{value:s,enumerable:!0}):t,s));var di=Ri((Pc,pi)=>{"use strict";pi.exports=function s(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var i,o,n;if(Array.isArray(e)){if(i=e.length,i!=t.length)return!1;for(o=i;o--!==0;)if(!s(e[o],t[o]))return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if(n=Object.keys(e),i=n.length,i!==Object.keys(t).length)return!1;for(o=i;o--!==0;)if(!Object.prototype.hasOwnProperty.call(t,n[o]))return!1;for(o=i;o--!==0;){var r=n[o];if(!(r==="_owner"&&e.$$typeof)&&!s(e[r],t[r]))return!1}return!0}return e!==e&&t!==t}});import"react";import mi,{Component as $i}from"react";var le=class{constructor(){this._listeners=new Map}addEventListener(e,t){var i;this.removeEventListener(e,t),this._listeners.get(e)||this._listeners.set(e,[]),(i=this._listeners.get(e))===null||i===void 0||i.push(t)}dispatchEvent(e,t){var i;(i=this._listeners.get(e))===null||i===void 0||i.forEach(o=>o(t))}hasEventListener(e){return!!this._listeners.get(e)}removeAllEventListeners(e){e?this._listeners.delete(e):this._listeners=new Map}removeEventListener(e,t){let i=this._listeners.get(e);if(!i)return;let o=i.length,n=i.indexOf(t);n<0||(o===1?this._listeners.delete(e):i.splice(n,1))}};var M=class{constructor(e,t,i){if(typeof e!="number"&&e){this.x=e.x,this.y=e.y;let o=e;this.z=o.z?o.z:0}else if(e!==void 0&&t!==void 0)this.x=e,this.y=t,this.z=i??0;else throw new Error("tsParticles - Vector3d not initialized correctly")}static get origin(){return M.create(0,0,0)}get angle(){return Math.atan2(this.y,this.x)}set angle(e){this.updateFromAngle(e,this.length)}get length(){return Math.sqrt(this.getLengthSq())}set length(e){this.updateFromAngle(this.angle,e)}static clone(e){return M.create(e.x,e.y,e.z)}static create(e,t,i){return new M(e,t,i)}add(e){return M.create(this.x+e.x,this.y+e.y,this.z+e.z)}addTo(e){this.x+=e.x,this.y+=e.y,this.z+=e.z}copy(){return M.clone(this)}distanceTo(e){return this.sub(e).length}distanceToSq(e){return this.sub(e).getLengthSq()}div(e){return M.create(this.x/e,this.y/e,this.z/e)}divTo(e){this.x/=e,this.y/=e,this.z/=e}getLengthSq(){return this.x**2+this.y**2}mult(e){return M.create(this.x*e,this.y*e,this.z*e)}multTo(e){this.x*=e,this.y*=e,this.z*=e}rotate(e){return M.create(this.x*Math.cos(e)-this.y*Math.sin(e),this.x*Math.sin(e)+this.y*Math.cos(e),0)}setTo(e){this.x=e.x,this.y=e.y;let t=e;this.z=t.z?t.z:0}sub(e){return M.create(this.x-e.x,this.y-e.y,this.z-e.z)}subFrom(e){this.x-=e.x,this.y-=e.y,this.z-=e.z}updateFromAngle(e,t){this.x=Math.cos(e)*t,this.y=Math.sin(e)*t}};var D=class extends M{constructor(e,t){super(e,t,0)}static get origin(){return D.create(0,0)}static clone(e){return D.create(e.x,e.y)}static create(e,t){return new D(e,t)}};var ki=Math.random;function T(){return gt(ki(),0,1-1e-16)}function gt(s,e,t){return Math.min(Math.max(s,e),t)}function H(s){let e=ce(s),t=he(s);return e===t&&(t=0),T()*(e-t)+t}function x(s){return typeof s=="number"?s:H(s)}function he(s){return typeof s=="number"?s:s.min}function ce(s){return typeof s=="number"?s:s.max}function m(s,e){if(s===e||e===void 0&&typeof s=="number")return s;let t=he(s),i=ce(s);return e!==void 0?{min:Math.min(t,e),max:Math.max(i,e)}:m(t,i)}function xt(s){let e=s.random,{enable:t,minimumValue:i}=typeof e=="boolean"?{enable:e,minimumValue:0}:e;return x(t?m(s.value,i):s.value)}function Bt(s,e){let t=s.x-e.x,i=s.y-e.y;return{dx:t,dy:i,distance:Math.sqrt(t**2+i**2)}}function G(s,e){return Bt(s,e).distance}function Nt(s,e,t){if(typeof s=="number")return s*Math.PI/180;switch(s){case"top":return-Math.PI/2;case"top-right":return-Math.PI/4;case"right":return 0;case"bottom-right":return Math.PI/4;case"bottom":return Math.PI/2;case"bottom-left":return 3*Math.PI/4;case"left":return Math.PI;case"top-left":return-3*Math.PI/4;case"inside":return Math.atan2(t.y-e.y,t.x-e.x);case"outside":return Math.atan2(e.y-t.y,e.x-t.x);default:return T()*Math.PI*2}}function qt(s){let e=D.origin;return e.length=1,e.angle=s,e}function Gt(s){return s.position&&s.position.x!==void 0&&s.position.y!==void 0?{x:s.position.x*s.size.width/100,y:s.position.y*s.size.height/100}:void 0}function $t(s){var e,t,i,o;return{x:(t=(e=s.position)===null||e===void 0?void 0:e.x)!==null&&t!==void 0?t:T()*s.size.width,y:(o=(i=s.position)===null||i===void 0?void 0:i.y)!==null&&o!==void 0?o:T()*s.size.height}}function ue(s){return s?s.endsWith("%")?parseFloat(s)/100:parseFloat(s):1}function B(){return typeof window>"u"||!window||typeof window.document>"u"||!window.document}function Ti(){return!B()&&typeof matchMedia<"u"}function fe(s){if(Ti())return matchMedia(s)}function Xt(){return B()?s=>setTimeout(s):s=>(requestAnimationFrame||setTimeout)(s)}function Yt(){return B()?s=>clearTimeout(s):s=>(cancelAnimationFrame||clearTimeout)(s)}function jt(s,e){return s===e||e instanceof Array&&e.indexOf(s)>-1}function Ei(s){return Math.floor(T()*s.length)}function pe(s,e,t=!0){return s[e!==void 0&&t?e%s.length:Ei(s)]}function y(s,...e){for(let t of e){if(t==null)continue;if(typeof t!="object"){s=t;continue}let i=Array.isArray(t);i&&(typeof s!="object"||!s||!Array.isArray(s))?s=[]:!i&&(typeof s!="object"||!s||Array.isArray(s))&&(s={});for(let o in t){if(o==="__proto__")continue;let n=t,r=n[o],a=typeof r=="object",l=s;l[o]=a&&Array.isArray(r)?r.map(h=>y(l[o],h)):y(l[o],r)}}return s}function C(s,e){return s instanceof Array?s.map((t,i)=>e(t,i)):e(s,0)}function N(s,e,t){return s instanceof Array?pe(s,e,t):s}var Ii="random";var de=new Map;function bt(s){de.set(s.key,s)}function yt(s,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?s+(e-s)*6*t:t<1/2?e:t<2/3?s+(e-s)*(2/3-t)*6:s}function Di(s){for(let[,n]of de)if(s.startsWith(n.stringPrefix))return n.parseString(s);let e=/^#?([a-f\d])([a-f\d])([a-f\d])([a-f\d])?$/i,t=s.replace(e,(n,r,a,l,h)=>r+r+a+a+l+l+(h!==void 0?h+h:"")),i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i,o=i.exec(t);return o?{a:o[4]!==void 0?parseInt(o[4],16)/255:1,b:parseInt(o[3],16),g:parseInt(o[2],16),r:parseInt(o[1],16)}:void 0}function W(s,e,t=!0){if(!s)return;let i=typeof s=="string"?{value:s}:s;if(typeof i.value=="string")return Jt(i.value,e,t);if(i.value instanceof Array)return W({value:pe(i.value,e,t)});for(let[,o]of de){let n=o.handleRangeColor(i);if(n)return n}}function Jt(s,e,t=!0){if(!s)return;let i=typeof s=="string"?{value:s}:s;if(typeof i.value=="string")return i.value===Ii?Vi():Fi(i.value);if(i.value instanceof Array)return Jt({value:pe(i.value,e,t)});for(let[,o]of de){let n=o.handleColor(i);if(n)return n}}function _t(s,e,t=!0){let i=W(s,e,t);return i?Ai(i):void 0}function Ai(s){let e=s.r/255,t=s.g/255,i=s.b/255,o=Math.max(e,t,i),n=Math.min(e,t,i),r={h:0,l:(o+n)/2,s:0};return o!==n&&(r.s=r.l<.5?(o-n)/(o+n):(o-n)/(2-o-n),r.h=e===o?(t-i)/(o-n):r.h=t===o?2+(i-e)/(o-n):4+(e-t)/(o-n)),r.l*=100,r.s*=100,r.h*=60,r.h<0&&(r.h+=360),r.h>=360&&(r.h-=360),r}function Fi(s){return Di(s)}function me(s){let e={b:0,g:0,r:0},t={h:s.h/360,l:s.l/100,s:s.s/100};if(!t.s)e.b=t.l,e.g=t.l,e.r=t.l;else{let i=t.l<.5?t.l*(1+t.s):t.l+t.s-t.l*t.s,o=2*t.l-i;e.r=yt(o,i,t.h+1/3),e.g=yt(o,i,t.h),e.b=yt(o,i,t.h-1/3)}return e.r=Math.floor(e.r*255),e.g=Math.floor(e.g*255),e.b=Math.floor(e.b*255),e}function Zt(s){let e=me(s);return{a:s.a,b:e.b,g:e.g,r:e.r}}function Vi(s){let e=s??0;return{b:Math.floor(H(m(e,256))),g:Math.floor(H(m(e,256))),r:Math.floor(H(m(e,256)))}}function $(s,e){return`rgba(${s.r}, ${s.g}, ${s.b}, ${e??1})`}function wt(s,e){return`hsla(${s.h}, ${s.s}%, ${s.l}%, ${e??1})`}function zt(s){return s!==void 0?{h:s.h.value,s:s.s.value,l:s.l.value}:void 0}function Kt(s,e,t){s.fillStyle=t??"rgba(0,0,0,0)",s.fillRect(0,0,e.width,e.height)}function ve(s,e){s.clearRect(0,0,e.width,e.height)}function Qt(s){var e,t,i,o,n;let{container:r,context:a,particle:l,delta:h,colorStyles:f,backgroundMask:u,composite:p,radius:d,opacity:c,shadow:g,transform:v}=s,_=l.getPosition(),P=l.rotation+(l.pathRotation?l.velocity.angle:0),O={sin:Math.sin(P),cos:Math.cos(P)},R={a:O.cos*((e=v.a)!==null&&e!==void 0?e:1),b:O.sin*((t=v.b)!==null&&t!==void 0?t:1),c:-O.sin*((i=v.c)!==null&&i!==void 0?i:1),d:O.cos*((o=v.d)!==null&&o!==void 0?o:1)};a.setTransform(R.a,R.b,R.c,R.d,_.x,_.y),a.beginPath(),u&&(a.globalCompositeOperation=p);let L=l.shadowColor;g.enable&&L&&(a.shadowBlur=g.blur,a.shadowColor=$(L),a.shadowOffsetX=g.offset.x,a.shadowOffsetY=g.offset.y),f.fill&&(a.fillStyle=f.fill);let k=(n=l.strokeWidth)!==null&&n!==void 0?n:0;a.lineWidth=k,f.stroke&&(a.strokeStyle=f.stroke),Li(r,a,l,d,c,h),k>0&&a.stroke(),l.close&&a.closePath(),l.fill&&a.fill(),Hi(r,a,l,d,c,h),a.globalCompositeOperation="source-over",a.setTransform(1,0,0,1,0,0)}function Li(s,e,t,i,o,n){if(!t.shape)return;let r=s.drawers.get(t.shape);r&&r.draw(e,t,i,o,n,s.retina.pixelRatio)}function Hi(s,e,t,i,o,n){if(!t.shape)return;let r=s.drawers.get(t.shape);r?.afterEffect&&r.afterEffect(e,t,i,o,n,s.retina.pixelRatio)}function ei(s,e,t){e.draw&&e.draw(s,t)}function ti(s,e,t,i){e.drawParticle&&e.drawParticle(s,t,i)}function ii(s,e,t){return{h:s.h,s:s.s,l:s.l+(e==="darken"?-1:1)*t}}var q="generated",Mt="touchend",oi="pointerdown",si="pointerup",Pt="pointermove",ni="touchstart",ri="touchmove",Ot="pointerleave",ai="pointerout",li="touchcancel",hi="resize",ci="visibilitychange";function Wi(s,e,t){var i;let o=e[t];o!==void 0&&(s[t]=((i=s[t])!==null&&i!==void 0?i:1)*o)}var ge=class{constructor(e){this.container=e,this.size={height:0,width:0},this._context=null,this._generated=!1,this._preDrawUpdaters=[],this._postDrawUpdaters=[],this._resizePlugins=[],this._colorPlugins=[],this._mutationObserver=!B()&&typeof MutationObserver<"u"?new MutationObserver(t=>{for(let i of t)i.type==="attributes"&&i.attributeName==="style"&&this._repairStyle()}):void 0}get _fullScreen(){return this.container.actualOptions.fullScreen.enable}clear(){let e=this.container.actualOptions,t=e.particles.move.trail;e.backgroundMask.enable?this.paint():t.enable&&t.length>0&&this._trailFillColor?this._paintBase($(this._trailFillColor,1/t.length)):this.draw(i=>{ve(i,this.size)})}destroy(){var e,t;(e=this._mutationObserver)===null||e===void 0||e.disconnect(),this._generated?(t=this.element)===null||t===void 0||t.remove():this._resetOriginalStyle(),this.draw(i=>{ve(i,this.size)}),this._preDrawUpdaters=[],this._postDrawUpdaters=[],this._resizePlugins=[],this._colorPlugins=[]}draw(e){if(this._context)return e(this._context)}drawParticle(e,t){var i;if(e.spawning||e.destroyed)return;let o=e.getRadius();if(o<=0)return;let n=e.getFillColor(),r=(i=e.getStrokeColor())!==null&&i!==void 0?i:n,[a,l]=this._getPluginParticleColors(e);a||(a=n),l||(l=r),!(!a&&!l)&&this.draw(h=>{var f,u,p,d;let c=this.container.actualOptions,g=e.options.zIndex,v=(1-e.zIndexFactor)**g.opacityRate,_=(p=(f=e.bubble.opacity)!==null&&f!==void 0?f:(u=e.opacity)===null||u===void 0?void 0:u.value)!==null&&p!==void 0?p:1,P=(d=e.strokeOpacity)!==null&&d!==void 0?d:_,O=_*v,R=P*v,L={},k={fill:a?wt(a,O):void 0};k.stroke=l?wt(l,R):k.fill,this._applyPreDrawUpdaters(h,e,o,O,k,L),Qt({container:this.container,context:h,particle:e,delta:t,colorStyles:k,backgroundMask:c.backgroundMask.enable,composite:c.backgroundMask.composite,radius:o*(1-e.zIndexFactor)**g.sizeRate,opacity:O,shadow:e.options.shadow,transform:L}),this._applyPostDrawUpdaters(e)})}drawParticlePlugin(e,t,i){this.draw(o=>{ti(o,e,t,i)})}drawPlugin(e,t){this.draw(i=>{ei(i,e,t)})}init(){var e;this.resize(),this._initStyle(),this._initCover(),this._initTrail(),this.initBackground(),this.element&&((e=this._mutationObserver)===null||e===void 0||e.observe(this.element,{attributes:!0})),this.initUpdaters(),this.initPlugins(),this.paint()}initBackground(){let e=this.container.actualOptions,t=e.background,i=this.element,o=i?.style;if(o){if(t.color){let n=W(t.color);o.backgroundColor=n?$(n,t.opacity):""}else o.backgroundColor="";o.backgroundImage=t.image||"",o.backgroundPosition=t.position||"",o.backgroundRepeat=t.repeat||"",o.backgroundSize=t.size||""}}initPlugins(){this._resizePlugins=[];for(let[,e]of this.container.plugins)e.resize&&this._resizePlugins.push(e),(e.particleFillColor||e.particleStrokeColor)&&this._colorPlugins.push(e)}initUpdaters(){this._preDrawUpdaters=[],this._postDrawUpdaters=[];for(let e of this.container.particles.updaters)e.afterDraw&&this._postDrawUpdaters.push(e),(e.getColorStyles||e.getTransformValues||e.beforeDraw)&&this._preDrawUpdaters.push(e)}loadCanvas(e){var t,i;this._generated&&((t=this.element)===null||t===void 0||t.remove()),this._generated=e.dataset&&q in e.dataset?e.dataset[q]==="true":this._generated,this.element=e,this.element.ariaHidden="true",this._originalStyle=y({},this.element.style),this.size.height=e.offsetHeight,this.size.width=e.offsetWidth,this._context=this.element.getContext("2d"),(i=this._mutationObserver)===null||i===void 0||i.observe(this.element,{attributes:!0}),this.container.retina.init(),this.initBackground()}paint(){let e=this.container.actualOptions;this.draw(t=>{e.backgroundMask.enable&&e.backgroundMask.cover?(ve(t,this.size),this._paintBase(this._coverColorStyle)):this._paintBase()})}resize(){if(!this.element)return;let e=this.container,t=e.retina.pixelRatio,i=e.canvas.size,o={width:this.element.offsetWidth*t,height:this.element.offsetHeight*t};if(o.height===i.height&&o.width===i.width&&o.height===this.element.height&&o.width===this.element.width)return;let n=Object.assign({},i);this.element.width=i.width=this.element.offsetWidth*t,this.element.height=i.height=this.element.offsetHeight*t,this.container.started&&(this.resizeFactor={width:i.width/n.width,height:i.height/n.height})}async windowResize(){if(!this.element)return;this.resize();let e=this.container,t=e.updateActualOptions();e.particles.setDensity(),this._applyResizePlugins(),t&&await e.refresh()}_applyPostDrawUpdaters(e){var t;for(let i of this._postDrawUpdaters)(t=i.afterDraw)===null||t===void 0||t.call(i,e)}_applyPreDrawUpdaters(e,t,i,o,n,r){var a;for(let l of this._preDrawUpdaters){if(l.getColorStyles){let{fill:h,stroke:f}=l.getColorStyles(t,e,i,o);h&&(n.fill=h),f&&(n.stroke=f)}if(l.getTransformValues){let h=l.getTransformValues(t);for(let f in h)Wi(r,h,f)}(a=l.beforeDraw)===null||a===void 0||a.call(l,t)}}_applyResizePlugins(){for(let e of this._resizePlugins)e.resize&&e.resize()}_getPluginParticleColors(e){let t,i;for(let o of this._colorPlugins)if(!t&&o.particleFillColor&&(t=_t(o.particleFillColor(e))),!i&&o.particleStrokeColor&&(i=_t(o.particleStrokeColor(e))),t&&i)break;return[t,i]}_initCover(){let e=this.container.actualOptions,t=e.backgroundMask.cover,i=t.color,o=W(i);if(o){let n={r:o.r,g:o.g,b:o.b,a:t.opacity};this._coverColorStyle=$(n,n.a)}}_initStyle(){let e=this.element,t=this.container.actualOptions;if(e){this._fullScreen?(this._originalStyle=y({},e.style),this._setFullScreenStyle()):this._resetOriginalStyle();for(let i in t.style){if(!i||!t.style)continue;let o=t.style[i];o&&e.style.setProperty(i,o,"important")}}}_initTrail(){let e=this.container.actualOptions,t=e.particles.move.trail,i=W(t.fillColor);if(i){let o=e.particles.move.trail;this._trailFillColor=Object.assign(Object.assign({},i),{a:1/o.length})}}_paintBase(e){this.draw(t=>{Kt(t,this.size,e)})}_repairStyle(){var e,t;let i=this.element;i&&((e=this._mutationObserver)===null||e===void 0||e.disconnect(),this._initStyle(),this.initBackground(),(t=this._mutationObserver)===null||t===void 0||t.observe(i,{attributes:!0}))}_resetOriginalStyle(){let e=this.element,t=this._originalStyle;e&&t&&(e.style.position=t.position,e.style.zIndex=t.zIndex,e.style.top=t.top,e.style.left=t.left,e.style.width=t.width,e.style.height=t.height)}_setFullScreenStyle(){let e=this.element;if(!e)return;let t="important";e.style.setProperty("position","fixed",t),e.style.setProperty("z-index",this.container.actualOptions.fullScreen.zIndex.toString(10),t),e.style.setProperty("top","0",t),e.style.setProperty("left","0",t),e.style.setProperty("width","100%",t),e.style.setProperty("height","100%",t)}};function E(s,e,t,i,o){if(i){let n={passive:!0};typeof o=="boolean"?n.capture=o:o!==void 0&&(n=o),s.addEventListener(e,t,n)}else{let n=o;s.removeEventListener(e,t,n)}}var xe=class{constructor(e){this.container=e,this.canPush=!0,this.handlers={mouseMove:t=>this.mouseTouchMove(t),touchStart:t=>this.mouseTouchMove(t),touchMove:t=>this.mouseTouchMove(t),touchEnd:()=>this.mouseTouchFinish(),mouseLeave:()=>this.mouseTouchFinish(),touchCancel:()=>this.mouseTouchFinish(),touchEndClick:t=>this.mouseTouchClick(t),mouseUp:t=>this.mouseTouchClick(t),mouseDown:()=>this.mouseDown(),visibilityChange:()=>this.handleVisibilityChange(),themeChange:t=>this.handleThemeChange(t),oldThemeChange:t=>this.handleThemeChange(t),resize:()=>this.handleWindowResize()}}addListeners(){this.manageListeners(!0)}removeListeners(){this.manageListeners(!1)}doMouseTouchClick(e){let t=this.container,i=t.actualOptions;if(this.canPush){let o=t.interactivity.mouse,n=o.position;if(!n)return;o.clickPosition=Object.assign({},n),o.clickTime=new Date().getTime();let r=i.interactivity.events.onClick;C(r.mode,a=>this.handleClickMode(a))}e.type==="touchend"&&setTimeout(()=>this.mouseTouchFinish(),500)}handleClickMode(e){this.container.handleClickMode(e)}handleThemeChange(e){let t=e,i=this.container,o=i.options,n=o.defaultThemes,r=t.matches?n.dark:n.light,a=o.themes.find(l=>l.name===r);a&&a.default.auto&&i.loadTheme(r)}handleVisibilityChange(){let e=this.container,t=e.actualOptions;this.mouseTouchFinish(),t.pauseOnBlur&&(document?.hidden?(e.pageHidden=!0,e.pause()):(e.pageHidden=!1,e.getAnimationStatus()?e.play(!0):e.draw(!0)))}handleWindowResize(){this.resizeTimeout&&(clearTimeout(this.resizeTimeout),delete this.resizeTimeout),this.resizeTimeout=setTimeout(async()=>{var e;return(e=this.container.canvas)===null||e===void 0?void 0:e.windowResize()},this.container.actualOptions.interactivity.events.resize.delay*1e3)}manageListeners(e){var t;let i=this.handlers,o=this.container,n=o.actualOptions,r=n.interactivity.detectsOn,a=Ot;if(r==="window")o.interactivity.element=window,a=ai;else if(r==="parent"&&o.canvas.element){let u=o.canvas.element;o.interactivity.element=(t=u.parentElement)!==null&&t!==void 0?t:u.parentNode}else o.interactivity.element=o.canvas.element;let l=fe("(prefers-color-scheme: dark)");l&&(l.addEventListener!==void 0?E(l,"change",i.themeChange,e):l.addListener!==void 0&&(e?l.addListener(i.oldThemeChange):l.removeListener(i.oldThemeChange)));let h=o.interactivity.element;if(!h)return;let f=h;(n.interactivity.events.onHover.enable||n.interactivity.events.onClick.enable)&&(E(h,Pt,i.mouseMove,e),E(h,ni,i.touchStart,e),E(h,ri,i.touchMove,e),n.interactivity.events.onClick.enable?(E(h,Mt,i.touchEndClick,e),E(h,si,i.mouseUp,e),E(h,oi,i.mouseDown,e)):E(h,Mt,i.touchEnd,e),E(h,a,i.mouseLeave,e),E(h,li,i.touchCancel,e)),o.canvas.element&&(o.canvas.element.style.pointerEvents=f===o.canvas.element?"initial":"none"),n.interactivity.events.resize&&(typeof ResizeObserver<"u"?this.resizeObserver&&!e?(o.canvas.element&&this.resizeObserver.unobserve(o.canvas.element),this.resizeObserver.disconnect(),delete this.resizeObserver):!this.resizeObserver&&e&&o.canvas.element&&(this.resizeObserver=new ResizeObserver(u=>{u.find(d=>d.target===o.canvas.element)&&this.handleWindowResize()}),this.resizeObserver.observe(o.canvas.element)):E(window,hi,i.resize,e)),document&&E(document,ci,i.visibilityChange,e,!1)}mouseDown(){let e=this.container.interactivity;if(e){let t=e.mouse;t.clicking=!0,t.downPosition=t.position}}mouseTouchClick(e){let t=this.container,i=t.actualOptions,o=t.interactivity.mouse;o.inside=!0;let n=!1,r=o.position;if(!(!r||!i.interactivity.events.onClick.enable)){for(let[,a]of t.plugins)if(a.clickPositionValid&&(n=a.clickPositionValid(r),n))break;n||this.doMouseTouchClick(e),o.clicking=!1}}mouseTouchFinish(){let e=this.container.interactivity;if(!e)return;let t=e.mouse;delete t.position,delete t.clickPosition,delete t.downPosition,e.status=Ot,t.inside=!1,t.clicking=!1}mouseTouchMove(e){var t,i,o,n,r,a,l;let h=this.container,f=h.actualOptions;if(!(!((t=h.interactivity)===null||t===void 0)&&t.element))return;h.interactivity.mouse.inside=!0;let u,p=h.canvas.element;if(e.type.startsWith("pointer")){this.canPush=!0;let c=e;if(h.interactivity.element===window){if(p){let g=p.getBoundingClientRect();u={x:c.clientX-g.left,y:c.clientY-g.top}}}else if(f.interactivity.detectsOn==="parent"){let g=c.target,v=c.currentTarget,_=h.canvas.element;if(g&&v&&_){let P=g.getBoundingClientRect(),O=v.getBoundingClientRect(),R=_.getBoundingClientRect();u={x:c.offsetX+2*P.left-(O.left+R.left),y:c.offsetY+2*P.top-(O.top+R.top)}}else u={x:(i=c.offsetX)!==null&&i!==void 0?i:c.clientX,y:(o=c.offsetY)!==null&&o!==void 0?o:c.clientY}}else c.target===h.canvas.element&&(u={x:(n=c.offsetX)!==null&&n!==void 0?n:c.clientX,y:(r=c.offsetY)!==null&&r!==void 0?r:c.clientY})}else{this.canPush=e.type!=="touchmove";let c=e,g=c.touches[c.touches.length-1],v=p?.getBoundingClientRect();u={x:g.clientX-((a=v?.left)!==null&&a!==void 0?a:0),y:g.clientY-((l=v?.top)!==null&&l!==void 0?l:0)}}let d=h.retina.pixelRatio;u&&(u.x*=d,u.y*=d),h.interactivity.mouse.position=u,h.interactivity.status=Pt}};function Ui(s,e=60,t=!1){return{value:s,factor:t?60/e:60*s/1e3}}var ye=class{constructor(e){this.container=e}async nextFrame(e){var t;try{let i=this.container;if(!i.smooth&&i.lastFrameTime!==void 0&&e<i.lastFrameTime+1e3/i.fpsLimit){i.draw(!1);return}(t=i.lastFrameTime)!==null&&t!==void 0||(i.lastFrameTime=e);let o=Ui(e-i.lastFrameTime,i.fpsLimit,i.smooth);if(i.lifeTime+=o.value,i.lastFrameTime=e,o.value>1e3){i.draw(!1);return}if(await i.particles.draw(o),i.duration>0&&i.lifeTime>i.duration){i.destroy();return}i.getAnimationStatus()&&i.draw(!1)}catch(i){console.error("tsParticles error in animation loop",i)}}};var w=class{constructor(){this.value=""}static create(e,t){let i=new w;return i.load(e),t!==void 0&&(typeof t=="string"||t instanceof Array?i.load({value:t}):i.load(t)),i}load(e){e?.value!==void 0&&(this.value=e.value)}};var be=class{constructor(){this.color=new w,this.color.value="",this.image="",this.position="",this.repeat="",this.size="",this.opacity=1}load(e){e&&(e.color!==void 0&&(this.color=w.create(this.color,e.color)),e.image!==void 0&&(this.image=e.image),e.position!==void 0&&(this.position=e.position),e.repeat!==void 0&&(this.repeat=e.repeat),e.size!==void 0&&(this.size=e.size),e.opacity!==void 0&&(this.opacity=e.opacity))}};var _e=class{constructor(){this.color=new w,this.color.value="#fff",this.opacity=1}load(e){e&&(e.color!==void 0&&(this.color=w.create(this.color,e.color)),e.opacity!==void 0&&(this.opacity=e.opacity))}};var we=class{constructor(){this.composite="destination-out",this.cover=new _e,this.enable=!1}load(e){if(e){if(e.composite!==void 0&&(this.composite=e.composite),e.cover!==void 0){let t=e.cover,i=typeof e.cover=="string"?{color:e.cover}:e.cover;this.cover.load(t.color!==void 0?t:{color:i})}e.enable!==void 0&&(this.enable=e.enable)}}};var ze=class{constructor(){this.enable=!0,this.zIndex=0}load(e){e&&(e.enable!==void 0&&(this.enable=e.enable),e.zIndex!==void 0&&(this.zIndex=e.zIndex))}};var Me=class{constructor(){this.enable=!1,this.mode=[]}load(e){e&&(e.enable!==void 0&&(this.enable=e.enable),e.mode!==void 0&&(this.mode=e.mode))}};var ee=class{constructor(){this.selectors=[],this.enable=!1,this.mode=[],this.type="circle"}get el(){return this.elementId}set el(e){this.elementId=e}get elementId(){return this.ids}set elementId(e){this.ids=e}get ids(){return C(this.selectors,e=>e.replace("#",""))}set ids(e){this.selectors=C(e,t=>`#${t}`)}load(e){var t,i;if(!e)return;let o=(i=(t=e.ids)!==null&&t!==void 0?t:e.elementId)!==null&&i!==void 0?i:e.el;o!==void 0&&(this.ids=o),e.selectors!==void 0&&(this.selectors=e.selectors),e.enable!==void 0&&(this.enable=e.enable),e.mode!==void 0&&(this.mode=e.mode),e.type!==void 0&&(this.type=e.type)}};var Pe=class{constructor(){this.enable=!1,this.force=2,this.smooth=10}load(e){e&&(e.enable!==void 0&&(this.enable=e.enable),e.force!==void 0&&(this.force=e.force),e.smooth!==void 0&&(this.smooth=e.smooth))}};var Oe=class{constructor(){this.enable=!1,this.mode=[],this.parallax=new Pe}load(e){e&&(e.enable!==void 0&&(this.enable=e.enable),e.mode!==void 0&&(this.mode=e.mode),this.parallax.load(e.parallax))}};var te=class{constructor(){this.delay=.5,this.enable=!0}load(e){e!==void 0&&(e.delay!==void 0&&(this.delay=e.delay),e.enable!==void 0&&(this.enable=e.enable))}};var Re=class{constructor(){this.onClick=new Me,this.onDiv=new ee,this.onHover=new Oe,this.resize=new te}get onclick(){return this.onClick}set onclick(e){this.onClick=e}get ondiv(){return this.onDiv}set ondiv(e){this.onDiv=e}get onhover(){return this.onHover}set onhover(e){this.onHover=e}load(e){var t,i,o;if(!e)return;this.onClick.load((t=e.onClick)!==null&&t!==void 0?t:e.onclick);let n=(i=e.onDiv)!==null&&i!==void 0?i:e.ondiv;n!==void 0&&(this.onDiv=C(n,r=>{let a=new ee;return a.load(r),a})),this.onHover.load((o=e.onHover)!==null&&o!==void 0?o:e.onhover),typeof e.resize=="boolean"?this.resize.enable=e.resize:this.resize.load(e.resize)}};var Ce=class{constructor(e,t){this._engine=e,this._container=t}load(e){if(e&&this._container){let t=this._engine.plugins.interactors.get(this._container);if(t)for(let i of t)i.loadModeOptions&&i.loadModeOptions(this,e)}}};var X=class{constructor(e,t){this.detectsOn="window",this.events=new Re,this.modes=new Ce(e,t)}get detect_on(){return this.detectsOn}set detect_on(e){this.detectsOn=e}load(e){var t;if(!e)return;let i=(t=e.detectsOn)!==null&&t!==void 0?t:e.detect_on;i!==void 0&&(this.detectsOn=i),this.events.load(e.events),this.modes.load(e.modes)}};var Se=class{load(e){var t,i;e&&(e.position!==void 0&&(this.position={x:(t=e.position.x)!==null&&t!==void 0?t:50,y:(i=e.position.y)!==null&&i!==void 0?i:50}),e.options!==void 0&&(this.options=y({},e.options)))}};var ke=class{constructor(){this.maxWidth=1/0,this.options={},this.mode="canvas"}load(e){e&&(e.maxWidth!==void 0&&(this.maxWidth=e.maxWidth),e.mode!==void 0&&(e.mode==="screen"?this.mode="screen":this.mode="canvas"),e.options!==void 0&&(this.options=y({},e.options)))}};var Te=class{constructor(){this.auto=!1,this.mode="any",this.value=!1}load(e){e&&(e.auto!==void 0&&(this.auto=e.auto),e.mode!==void 0&&(this.mode=e.mode),e.value!==void 0&&(this.value=e.value))}};var Ee=class{constructor(){this.name="",this.default=new Te}load(e){e&&(e.name!==void 0&&(this.name=e.name),this.default.load(e.default),e.options!==void 0&&(this.options=y({},e.options)))}};var Y=class{constructor(){this.count=0,this.enable=!1,this.offset=0,this.speed=1,this.decay=0,this.sync=!0}load(e){e&&(e.count!==void 0&&(this.count=m(e.count)),e.enable!==void 0&&(this.enable=e.enable),e.offset!==void 0&&(this.offset=m(e.offset)),e.speed!==void 0&&(this.speed=m(e.speed)),e.decay!==void 0&&(this.decay=m(e.decay)),e.sync!==void 0&&(this.sync=e.sync))}};var Ie=class{constructor(){this.h=new Y,this.s=new Y,this.l=new Y}load(e){e&&(this.h.load(e.h),this.s.load(e.s),this.l.load(e.l))}};var V=class extends w{constructor(){super(),this.animation=new Ie}static create(e,t){let i=new V;return i.load(e),t!==void 0&&(typeof t=="string"||t instanceof Array?i.load({value:t}):i.load(t)),i}load(e){if(super.load(e),!e)return;let t=e.animation;t!==void 0&&(t.enable!==void 0?this.animation.h.load(t):this.animation.load(e.animation))}};var ie=class{constructor(){this.speed=2}load(e){e&&e.speed!==void 0&&(this.speed=e.speed)}};var De=class{constructor(){this.enable=!0,this.retries=0}load(e){e&&(e.enable!==void 0&&(this.enable=e.enable),e.retries!==void 0&&(this.retries=e.retries))}};var Ae=class{constructor(){this.enable=!1,this.minimumValue=0}load(e){e&&(e.enable!==void 0&&(this.enable=e.enable),e.minimumValue!==void 0&&(this.minimumValue=e.minimumValue))}};var I=class{constructor(){this.random=new Ae,this.value=0}load(e){e&&(typeof e.random=="boolean"?this.random.enable=e.random:this.random.load(e.random),e.value!==void 0&&(this.value=m(e.value,this.random.enable?this.random.minimumValue:void 0)))}};var oe=class extends I{constructor(){super(),this.random.minimumValue=.1,this.value=1}};var j=class{constructor(){this.horizontal=new oe,this.vertical=new oe}load(e){e&&(this.horizontal.load(e.horizontal),this.vertical.load(e.vertical))}};var Fe=class{constructor(){this.absorb=new ie,this.bounce=new j,this.enable=!1,this.mode="bounce",this.overlap=new De}load(e){e&&(this.absorb.load(e.absorb),this.bounce.load(e.bounce),e.enable!==void 0&&(this.enable=e.enable),e.mode!==void 0&&(this.mode=e.mode),this.overlap.load(e.overlap))}};var Ve=class{constructor(){this.offset=0,this.value=90}load(e){e&&(e.offset!==void 0&&(this.offset=m(e.offset)),e.value!==void 0&&(this.value=m(e.value)))}};var Le=class{constructor(){this.distance=200,this.enable=!1,this.rotate={x:3e3,y:3e3}}get rotateX(){return this.rotate.x}set rotateX(e){this.rotate.x=e}get rotateY(){return this.rotate.y}set rotateY(e){this.rotate.y=e}load(e){var t,i,o,n;if(!e)return;e.distance!==void 0&&(this.distance=m(e.distance)),e.enable!==void 0&&(this.enable=e.enable);let r=(i=(t=e.rotate)===null||t===void 0?void 0:t.x)!==null&&i!==void 0?i:e.rotateX;r!==void 0&&(this.rotate.x=r);let a=(n=(o=e.rotate)===null||o===void 0?void 0:o.y)!==null&&n!==void 0?n:e.rotateY;a!==void 0&&(this.rotate.y=a)}};var He=class{constructor(){this.x=50,this.y=50,this.mode="percent",this.radius=0}load(e){e&&(e.x!==void 0&&(this.x=e.x),e.y!==void 0&&(this.y=e.y),e.mode!==void 0&&(this.mode=e.mode),e.radius!==void 0&&(this.radius=e.radius))}};var We=class{constructor(){this.acceleration=9.81,this.enable=!1,this.inverse=!1,this.maxSpeed=50}load(e){e&&(e.acceleration!==void 0&&(this.acceleration=m(e.acceleration)),e.enable!==void 0&&(this.enable=e.enable),e.inverse!==void 0&&(this.inverse=e.inverse),e.maxSpeed!==void 0&&(this.maxSpeed=m(e.maxSpeed)))}};var Ue=class{constructor(){this.clamp=!0,this.delay=new I,this.enable=!1,this.options={}}load(e){e&&(e.clamp!==void 0&&(this.clamp=e.clamp),this.delay.load(e.delay),e.enable!==void 0&&(this.enable=e.enable),this.generator=e.generator,e.options&&(this.options=y(this.options,e.options)))}};var Be=class{constructor(){this.enable=!1,this.length=10,this.fillColor=new w,this.fillColor.value="#000000"}load(e){e&&(e.enable!==void 0&&(this.enable=e.enable),this.fillColor=w.create(this.fillColor,e.fillColor),e.length!==void 0&&(this.length=e.length))}};var Ne=class{constructor(){this.default="out"}load(e){var t,i,o,n;e&&(e.default!==void 0&&(this.default=e.default),this.bottom=(t=e.bottom)!==null&&t!==void 0?t:e.default,this.left=(i=e.left)!==null&&i!==void 0?i:e.default,this.right=(o=e.right)!==null&&o!==void 0?o:e.default,this.top=(n=e.top)!==null&&n!==void 0?n:e.default)}};var qe=class{constructor(){this.acceleration=0,this.enable=!1}load(e){e&&(e.acceleration!==void 0&&(this.acceleration=m(e.acceleration)),e.enable!==void 0&&(this.enable=e.enable),this.position=e.position?y({},e.position):void 0)}};var Ge=class{constructor(){this.angle=new Ve,this.attract=new Le,this.center=new He,this.decay=0,this.distance={},this.direction="none",this.drift=0,this.enable=!1,this.gravity=new We,this.path=new Ue,this.outModes=new Ne,this.random=!1,this.size=!1,this.speed=2,this.spin=new qe,this.straight=!1,this.trail=new Be,this.vibrate=!1,this.warp=!1}get bounce(){return this.collisions}set bounce(e){this.collisions=e}get collisions(){return!1}set collisions(e){}get noise(){return this.path}set noise(e){this.path=e}get outMode(){return this.outModes.default}set outMode(e){this.outModes.default=e}get out_mode(){return this.outMode}set out_mode(e){this.outMode=e}load(e){var t,i,o;if(!e)return;this.angle.load(typeof e.angle=="number"?{value:e.angle}:e.angle),this.attract.load(e.attract),this.center.load(e.center),e.decay!==void 0&&(this.decay=m(e.decay)),e.direction!==void 0&&(this.direction=e.direction),e.distance!==void 0&&(this.distance=typeof e.distance=="number"?{horizontal:e.distance,vertical:e.distance}:Object.assign({},e.distance)),e.drift!==void 0&&(this.drift=m(e.drift)),e.enable!==void 0&&(this.enable=e.enable),this.gravity.load(e.gravity);let n=(i=(t=e.outModes)!==null&&t!==void 0?t:e.outMode)!==null&&i!==void 0?i:e.out_mode;n!==void 0&&(typeof n=="object"?this.outModes.load(n):this.outModes.load({default:n})),this.path.load((o=e.path)!==null&&o!==void 0?o:e.noise),e.random!==void 0&&(this.random=e.random),e.size!==void 0&&(this.size=e.size),e.speed!==void 0&&(this.speed=m(e.speed)),this.spin.load(e.spin),e.straight!==void 0&&(this.straight=e.straight),this.trail.load(e.trail),e.vibrate!==void 0&&(this.vibrate=e.vibrate),e.warp!==void 0&&(this.warp=e.warp)}};var J=class{constructor(){this.count=0,this.enable=!1,this.speed=1,this.decay=0,this.sync=!1}load(e){e&&(e.count!==void 0&&(this.count=m(e.count)),e.enable!==void 0&&(this.enable=e.enable),e.speed!==void 0&&(this.speed=m(e.speed)),e.decay!==void 0&&(this.decay=m(e.decay)),e.sync!==void 0&&(this.sync=e.sync))}};var $e=class extends J{constructor(){super(),this.destroy="none",this.enable=!1,this.speed=2,this.startValue="random",this.sync=!1}get opacity_min(){return this.minimumValue}set opacity_min(e){this.minimumValue=e}load(e){var t;e&&(super.load(e),e.destroy!==void 0&&(this.destroy=e.destroy),e.enable!==void 0&&(this.enable=e.enable),this.minimumValue=(t=e.minimumValue)!==null&&t!==void 0?t:e.opacity_min,e.speed!==void 0&&(this.speed=e.speed),e.startValue!==void 0&&(this.startValue=e.startValue),e.sync!==void 0&&(this.sync=e.sync))}};var Xe=class extends I{constructor(){super(),this.animation=new $e,this.random.minimumValue=.1,this.value=1}get anim(){return this.animation}set anim(e){this.animation=e}load(e){var t;if(!e)return;super.load(e);let i=(t=e.animation)!==null&&t!==void 0?t:e.anim;i!==void 0&&(this.animation.load(i),this.value=m(this.value,this.animation.enable?this.animation.minimumValue:void 0))}};var Ye=class{constructor(){this.enable=!1,this.width=1920,this.height=1080}get area(){return this.width}set area(e){this.width=e}get factor(){return this.height}set factor(e){this.height=e}get value_area(){return this.area}set value_area(e){this.area=e}load(e){var t,i,o;if(!e)return;e.enable!==void 0&&(this.enable=e.enable);let n=(i=(t=e.width)!==null&&t!==void 0?t:e.area)!==null&&i!==void 0?i:e.value_area;n!==void 0&&(this.width=n);let r=(o=e.height)!==null&&o!==void 0?o:e.factor;r!==void 0&&(this.height=r)}};var je=class{constructor(){this.density=new Ye,this.limit=0,this.value=100}get max(){return this.limit}set max(e){this.limit=e}load(e){var t;if(!e)return;this.density.load(e.density);let i=(t=e.limit)!==null&&t!==void 0?t:e.max;i!==void 0&&(this.limit=i),e.value!==void 0&&(this.value=e.value)}};var Je=class{constructor(){this.blur=0,this.color=new w,this.enable=!1,this.offset={x:0,y:0},this.color.value="#000"}load(e){e&&(e.blur!==void 0&&(this.blur=e.blur),this.color=w.create(this.color,e.color),e.enable!==void 0&&(this.enable=e.enable),e.offset!==void 0&&(e.offset.x!==void 0&&(this.offset.x=e.offset.x),e.offset.y!==void 0&&(this.offset.y=e.offset.y)))}};var Rt="character",Ct="char",St="image",kt="images",Tt="polygon",Et="star",Ze=class{constructor(){this.options={},this.type="circle"}get character(){var e;return(e=this.options[Rt])!==null&&e!==void 0?e:this.options[Ct]}set character(e){this.options[Ct]=this.options[Rt]=e}get custom(){return this.options}set custom(e){this.options=e}get image(){var e;return(e=this.options[St])!==null&&e!==void 0?e:this.options[kt]}set image(e){this.options[kt]=this.options[St]=e}get images(){return this.image}set images(e){this.image=e}get polygon(){var e;return(e=this.options[Tt])!==null&&e!==void 0?e:this.options[Et]}set polygon(e){this.options[Et]=this.options[Tt]=e}get stroke(){return[]}set stroke(e){}load(e){var t,i,o;if(!e)return;let n=(t=e.options)!==null&&t!==void 0?t:e.custom;if(n!==void 0)for(let r in n){let a=n[r];a&&(this.options[r]=y((i=this.options[r])!==null&&i!==void 0?i:{},a))}this.loadShape(e.character,Rt,Ct,!0),this.loadShape(e.polygon,Tt,Et,!1),this.loadShape((o=e.image)!==null&&o!==void 0?o:e.images,St,kt,!0),e.type!==void 0&&(this.type=e.type)}loadShape(e,t,i,o){var n,r;if(!e)return;let a=e instanceof Array,l=a?[]:{},h=a!==this.options[t]instanceof Array,f=a!==this.options[i]instanceof Array;h&&(this.options[t]=l),f&&o&&(this.options[i]=l),this.options[t]=y((n=this.options[t])!==null&&n!==void 0?n:l,e),(!this.options[i]||o)&&(this.options[i]=y((r=this.options[i])!==null&&r!==void 0?r:l,e))}};var Ke=class extends J{constructor(){super(),this.destroy="none",this.enable=!1,this.speed=5,this.startValue="random",this.sync=!1}get size_min(){return this.minimumValue}set size_min(e){this.minimumValue=e}load(e){var t;super.load(e),e&&(e.destroy!==void 0&&(this.destroy=e.destroy),e.enable!==void 0&&(this.enable=e.enable),this.minimumValue=(t=e.minimumValue)!==null&&t!==void 0?t:e.size_min,e.speed!==void 0&&(this.speed=e.speed),e.startValue!==void 0&&(this.startValue=e.startValue),e.sync!==void 0&&(this.sync=e.sync))}};var Qe=class extends I{constructor(){super(),this.animation=new Ke,this.random.minimumValue=1,this.value=3}get anim(){return this.animation}set anim(e){this.animation=e}load(e){var t;if(super.load(e),!e)return;let i=(t=e.animation)!==null&&t!==void 0?t:e.anim;i!==void 0&&(this.animation.load(i),this.value=m(this.value,this.animation.enable?this.animation.minimumValue:void 0))}};var se=class{constructor(){this.width=0}load(e){e&&(e.color!==void 0&&(this.color=V.create(this.color,e.color)),e.width!==void 0&&(this.width=m(e.width)),e.opacity!==void 0&&(this.opacity=m(e.opacity)))}};var et=class extends I{constructor(){super(),this.opacityRate=1,this.sizeRate=1,this.velocityRate=1}load(e){super.load(e),e&&(e.opacityRate!==void 0&&(this.opacityRate=e.opacityRate),e.sizeRate!==void 0&&(this.sizeRate=e.sizeRate),e.velocityRate!==void 0&&(this.velocityRate=e.velocityRate))}};var tt=class{constructor(e,t){this._engine=e,this._container=t,this.bounce=new j,this.collisions=new Fe,this.color=new V,this.color.value="#fff",this.groups={},this.move=new Ge,this.number=new je,this.opacity=new Xe,this.reduceDuplicates=!1,this.shadow=new Je,this.shape=new Ze,this.size=new Qe,this.stroke=new se,this.zIndex=new et}load(e){var t,i,o,n,r,a;if(!e)return;if(this.bounce.load(e.bounce),this.color.load(V.create(this.color,e.color)),e.groups!==void 0)for(let f in e.groups){let u=e.groups[f];u!==void 0&&(this.groups[f]=y((t=this.groups[f])!==null&&t!==void 0?t:{},u))}this.move.load(e.move),this.number.load(e.number),this.opacity.load(e.opacity),e.reduceDuplicates!==void 0&&(this.reduceDuplicates=e.reduceDuplicates),this.shape.load(e.shape),this.size.load(e.size),this.shadow.load(e.shadow),this.zIndex.load(e.zIndex);let l=(o=(i=e.move)===null||i===void 0?void 0:i.collisions)!==null&&o!==void 0?o:(n=e.move)===null||n===void 0?void 0:n.bounce;l!==void 0&&(this.collisions.enable=l),this.collisions.load(e.collisions),e.interactivity!==void 0&&(this.interactivity=y({},e.interactivity));let h=(r=e.stroke)!==null&&r!==void 0?r:(a=e.shape)===null||a===void 0?void 0:a.stroke;if(h&&(this.stroke=C(h,f=>{let u=new se;return u.load(f),u})),this._container){let f=this._engine.plugins.updaters.get(this._container);if(f)for(let p of f)p.loadOptions&&p.loadOptions(this,e);let u=this._engine.plugins.interactors.get(this._container);if(u)for(let p of u)p.loadParticlesOptions&&p.loadParticlesOptions(this,e)}}};function It(s,...e){for(let t of e)s.load(t)}function it(s,e,...t){let i=new tt(s,e);return It(i,...t),i}var ot=class{constructor(e,t){this._engine=e,this._container=t,this.autoPlay=!0,this.background=new be,this.backgroundMask=new we,this.defaultThemes={},this.delay=0,this.fullScreen=new ze,this.detectRetina=!0,this.duration=0,this.fpsLimit=120,this.interactivity=new X(e,t),this.manualParticles=[],this.particles=it(this._engine,this._container),this.pauseOnBlur=!0,this.pauseOnOutsideViewport=!0,this.responsive=[],this.smooth=!1,this.style={},this.themes=[],this.zLayers=100}get backgroundMode(){return this.fullScreen}set backgroundMode(e){this.fullScreen.load(e)}get fps_limit(){return this.fpsLimit}set fps_limit(e){this.fpsLimit=e}get retina_detect(){return this.detectRetina}set retina_detect(e){this.detectRetina=e}load(e){var t,i,o,n,r;if(!e)return;e.preset!==void 0&&C(e.preset,u=>this._importPreset(u)),e.autoPlay!==void 0&&(this.autoPlay=e.autoPlay),e.delay!==void 0&&(this.delay=m(e.delay));let a=(t=e.detectRetina)!==null&&t!==void 0?t:e.retina_detect;a!==void 0&&(this.detectRetina=a),e.duration!==void 0&&(this.duration=m(e.duration));let l=(i=e.fpsLimit)!==null&&i!==void 0?i:e.fps_limit;l!==void 0&&(this.fpsLimit=l),e.pauseOnBlur!==void 0&&(this.pauseOnBlur=e.pauseOnBlur),e.pauseOnOutsideViewport!==void 0&&(this.pauseOnOutsideViewport=e.pauseOnOutsideViewport),e.zLayers!==void 0&&(this.zLayers=e.zLayers),this.background.load(e.background);let h=(o=e.fullScreen)!==null&&o!==void 0?o:e.backgroundMode;typeof h=="boolean"?this.fullScreen.enable=h:this.fullScreen.load(h),this.backgroundMask.load(e.backgroundMask),this.interactivity.load(e.interactivity),e.manualParticles!==void 0&&(this.manualParticles=e.manualParticles.map(u=>{let p=new Se;return p.load(u),p})),this.particles.load(e.particles),this.style=y(this.style,e.style),this._engine.plugins.loadOptions(this,e),e.smooth!==void 0&&(this.smooth=e.smooth);let f=this._engine.plugins.interactors.get(this._container);if(f)for(let u of f)u.loadOptions&&u.loadOptions(this,e);if(e.responsive!==void 0)for(let u of e.responsive){let p=new ke;p.load(u),this.responsive.push(p)}if(this.responsive.sort((u,p)=>u.maxWidth-p.maxWidth),e.themes!==void 0)for(let u of e.themes){let p=this.themes.find(d=>d.name===u.name);if(p)p.load(u);else{let d=new Ee;d.load(u),this.themes.push(d)}}this.defaultThemes.dark=(n=this._findDefaultTheme("dark"))===null||n===void 0?void 0:n.name,this.defaultThemes.light=(r=this._findDefaultTheme("light"))===null||r===void 0?void 0:r.name}setResponsive(e,t,i){this.load(i);let o=this.responsive.find(n=>n.mode==="screen"&&screen?n.maxWidth>screen.availWidth:n.maxWidth*t>e);return this.load(o?.options),o?.maxWidth}setTheme(e){if(e){let t=this.themes.find(i=>i.name===e);t&&this.load(t.options)}else{let t=fe("(prefers-color-scheme: dark)"),i=t&&t.matches,o=this._findDefaultTheme(i?"dark":"light");o&&this.load(o.options)}}_findDefaultTheme(e){var t;return(t=this.themes.find(i=>i.default.value&&i.default.mode===e))!==null&&t!==void 0?t:this.themes.find(i=>i.default.value&&i.default.mode==="any")}_importPreset(e){this.load(this._engine.plugins.getPreset(e))}};var st=class{constructor(e,t){this.container=t,this._engine=e,this._interactors=this._engine.plugins.getInteractors(this.container,!0),this._externalInteractors=[],this._particleInteractors=[]}async externalInteract(e){for(let t of this._externalInteractors)t.isEnabled()&&await t.interact(e)}handleClickMode(e){for(let t of this._externalInteractors)t.handleClickMode&&t.handleClickMode(e)}init(){this._externalInteractors=[],this._particleInteractors=[];for(let e of this._interactors){switch(e.type){case"external":this._externalInteractors.push(e);break;case"particles":this._particleInteractors.push(e);break}e.init()}}async particlesInteract(e,t){for(let i of this._externalInteractors)i.clear(e,t);for(let i of this._particleInteractors)i.isEnabled(e)&&await i.interact(e,t)}async reset(e){for(let t of this._externalInteractors)t.isEnabled()&&await t.reset(e);for(let t of this._particleInteractors)t.isEnabled(e)&&await t.reset(e)}};var ui=s=>{jt(s.outMode,s.checkModes)&&(s.coord>s.maxCoord-s.radius*2?s.setCb(-s.radius):s.coord<s.radius*2&&s.setCb(s.radius))},nt=class{constructor(e,t,i,o,n,r){this.container=i,this._engine=e,this.init(t,o,n,r)}destroy(e){var t;if(!(this.unbreakable||this.destroyed)){this.destroyed=!0,this.bubble.inRange=!1,this.slow.inRange=!1;for(let[,i]of this.container.plugins)i.particleDestroyed&&i.particleDestroyed(this,e);for(let i of this.container.particles.updaters)i.particleDestroyed&&i.particleDestroyed(this,e);(t=this.pathGenerator)===null||t===void 0||t.reset(this)}}draw(e){let t=this.container;for(let[,i]of t.plugins)t.canvas.drawParticlePlugin(i,this,e);t.canvas.drawParticle(this,e)}getFillColor(){var e;return this._getRollColor((e=this.bubble.color)!==null&&e!==void 0?e:zt(this.color))}getMass(){return this.getRadius()**2*Math.PI/2}getPosition(){return{x:this.position.x+this.offset.x,y:this.position.y+this.offset.y,z:this.position.z}}getRadius(){var e;return(e=this.bubble.radius)!==null&&e!==void 0?e:this.size.value}getStrokeColor(){var e;return this._getRollColor((e=this.bubble.color)!==null&&e!==void 0?e:zt(this.strokeColor))}init(e,t,i,o){var n,r,a,l,h,f,u,p,d;let c=this.container,g=this._engine;this.id=e,this.group=o,this.fill=!0,this.pathRotation=!1,this.close=!0,this.lastPathTime=0,this.destroyed=!1,this.unbreakable=!1,this.rotation=0,this.misplaced=!1,this.retina={maxDistance:{}},this.outType="normal",this.ignoresResizeRatio=!0;let v=c.retina.pixelRatio,_=c.actualOptions,P=it(this._engine,c,_.particles),O=P.shape.type,{reduceDuplicates:R}=P;this.shape=N(O,this.id,R);let L=P.shape;if(i&&i.shape&&i.shape.type){let F=i.shape.type,Wt=N(F,this.id,R);Wt&&(this.shape=Wt,L.load(i.shape))}this.shapeData=this._loadShapeData(L,R),P.load(i),P.load((n=this.shapeData)===null||n===void 0?void 0:n.particles),this.interactivity=new X(g,c),this.interactivity.load(c.actualOptions.interactivity),this.interactivity.load(P.interactivity),this.fill=(a=(r=this.shapeData)===null||r===void 0?void 0:r.fill)!==null&&a!==void 0?a:this.fill,this.close=(h=(l=this.shapeData)===null||l===void 0?void 0:l.close)!==null&&h!==void 0?h:this.close,this.options=P;let k=this.options.move.path;this.pathDelay=xt(k.delay)*1e3,k.generator&&(this.pathGenerator=this._engine.plugins.getPathGenerator(k.generator),this.pathGenerator&&c.addPath(k.generator,this.pathGenerator)&&this.pathGenerator.init(c));let _i=x(this.options.zIndex.value);c.retina.initParticle(this);let Q=this.options.size,Ft=Q.value,mt=Q.animation;if(this.size={enable:Q.animation.enable,value:x(Q.value)*c.retina.pixelRatio,max:ce(Ft)*v,min:he(Ft)*v,loops:0,maxLoops:x(Q.animation.count)},mt.enable)switch(this.size.status="increasing",this.size.decay=1-x(mt.decay),mt.startValue){case"min":this.size.value=this.size.min,this.size.status="increasing";break;case"random":this.size.value=H(this.size),this.size.status=T()>=.5?"increasing":"decreasing";break;case"max":default:this.size.value=this.size.max,this.size.status="decreasing";break}this.size.initialValue=this.size.value,this.bubble={inRange:!1},this.slow={inRange:!1,factor:1},this.position=this._calcPosition(c,t,gt(_i,0,c.zLayers)),this.initialPosition=this.position.copy();let Vt=c.canvas.size,vt=Object.assign({},this.options.move.center),Lt=vt.mode==="percent";switch(this.moveCenter={x:vt.x*(Lt?Vt.width/100:1),y:vt.y*(Lt?Vt.height/100:1),radius:(f=this.options.move.center.radius)!==null&&f!==void 0?f:0,mode:(u=this.options.move.center.mode)!==null&&u!==void 0?u:"percent"},this.direction=Nt(this.options.move.direction,this.position,this.moveCenter),this.options.move.direction){case"inside":this.outType="inside";break;case"outside":this.outType="outside";break}this.initialVelocity=this._calculateVelocity(),this.velocity=this.initialVelocity.copy(),this.moveDecay=1-x(this.options.move.decay),this.offset=D.origin;let ae=c.particles;ae.needsSort=ae.needsSort||ae.lastZIndex<this.position.z,ae.lastZIndex=this.position.z,this.zIndexFactor=this.position.z/c.zLayers,this.sides=24;let z=c.drawers.get(this.shape);z||(z=this._engine.plugins.getShapeDrawer(this.shape),z&&c.drawers.set(this.shape,z)),z?.loadShape&&z?.loadShape(this);let Ht=z?.getSidesCount;Ht&&(this.sides=Ht(this)),this.spawning=!1,this.shadowColor=W(this.options.shadow.color);for(let F of c.particles.updaters)F.init(this);for(let F of c.particles.movers)(p=F.init)===null||p===void 0||p.call(F,this);z?.particleInit&&z.particleInit(c,this);for(let[,F]of c.plugins)(d=F.particleCreated)===null||d===void 0||d.call(F,this)}isInsideCanvas(){let e=this.getRadius(),t=this.container.canvas.size;return this.position.x>=-e&&this.position.y>=-e&&this.position.y<=t.height+e&&this.position.x<=t.width+e}isVisible(){return!this.destroyed&&!this.spawning&&this.isInsideCanvas()}reset(){var e;for(let t of this.container.particles.updaters)(e=t.reset)===null||e===void 0||e.call(t,this)}_calcPosition(e,t,i,o=0){var n,r,a,l;for(let[,v]of e.plugins){let _=v.particlePosition!==void 0?v.particlePosition(t,this):void 0;if(_!==void 0)return M.create(_.x,_.y,i)}let h=e.canvas.size,f=$t({size:h,position:t}),u=M.create(f.x,f.y,i),p=this.getRadius(),d=this.options.move.outModes,c=v=>{ui({outMode:v,checkModes:["bounce","bounce-horizontal"],coord:u.x,maxCoord:e.canvas.size.width,setCb:_=>u.x+=_,radius:p})},g=v=>{ui({outMode:v,checkModes:["bounce","bounce-vertical"],coord:u.y,maxCoord:e.canvas.size.height,setCb:_=>u.y+=_,radius:p})};return c((n=d.left)!==null&&n!==void 0?n:d.default),c((r=d.right)!==null&&r!==void 0?r:d.default),g((a=d.top)!==null&&a!==void 0?a:d.default),g((l=d.bottom)!==null&&l!==void 0?l:d.default),this._checkOverlap(u,o)?this._calcPosition(e,void 0,i,o+1):u}_calculateVelocity(){let e=qt(this.direction),t=e.copy(),i=this.options.move;if(i.direction==="inside"||i.direction==="outside")return t;let o=Math.PI/180*x(i.angle.value),n=Math.PI/180*x(i.angle.offset),r={left:n-o/2,right:n+o/2};return i.straight||(t.angle+=H(m(r.left,r.right))),i.random&&typeof i.speed=="number"&&(t.length*=T()),t}_checkOverlap(e,t=0){let i=this.options.collisions,o=this.getRadius();if(!i.enable)return!1;let n=i.overlap;if(n.enable)return!1;let r=n.retries;if(r>=0&&t>r)throw new Error("Particle is overlapping and can't be placed");let a=!1;for(let l of this.container.particles.array)if(G(e,l.position)<o+l.getRadius()){a=!0;break}return a}_getRollColor(e){var t;if(!e||!this.roll||!this.backColor&&!this.roll.alter)return e;let i=this.roll.horizontal&&this.roll.vertical?2:1,o=this.roll.horizontal?Math.PI/2:0;return Math.floor((((t=this.roll.angle)!==null&&t!==void 0?t:0)+o)/(Math.PI/i))%2?this.backColor?this.backColor:this.roll.alter?ii(e,this.roll.alter.type,this.roll.alter.value):e:e}_loadShapeData(e,t){let i=e.options[this.shape];if(i)return y({},N(i,this.id,t))}};var rt=class{constructor(e,t){this.position=e,this.particle=t}};var Z=class{constructor(e,t){this.position={x:e,y:t}}};var K=class extends Z{constructor(e,t,i){super(e,t),this.radius=i}contains(e){return G(e,this.position)<=this.radius}intersects(e){let t=e,i=e,o=this.position,n=e.position,r={x:Math.abs(n.x-o.x),y:Math.abs(n.y-o.y)},a=this.radius;if(i.radius!==void 0){let l=a+i.radius,h=Math.sqrt(r.x**2+r.y**2);return l>h}else if(t.size!==void 0){let l=t.size.width,h=t.size.height;return Math.pow(r.x-l,2)+Math.pow(r.y-h,2)<=a**2||r.x<=a+l&&r.y<=a+h||r.x<=l||r.y<=h}return!1}};var S=class extends Z{constructor(e,t,i,o){super(e,t),this.size={height:o,width:i}}contains(e){let t=this.size.width,i=this.size.height,o=this.position;return e.x>=o.x&&e.x<=o.x+t&&e.y>=o.y&&e.y<=o.y+i}intersects(e){e instanceof K&&e.intersects(this);let t=this.size.width,i=this.size.height,o=this.position,n=e.position,r=e instanceof S?e.size:{width:0,height:0},a=r.width,l=r.height;return n.x<o.x+t&&n.x+a>o.x&&n.y<o.y+i&&n.y+l>o.y}};var A=class{constructor(e,t){this.rectangle=e,this.capacity=t,this._points=[],this._divided=!1}insert(e){var t,i,o,n,r;return this.rectangle.contains(e.position)?this._points.length<this.capacity?(this._points.push(e),!0):(this._divided||this.subdivide(),(r=((t=this._NE)===null||t===void 0?void 0:t.insert(e))||((i=this._NW)===null||i===void 0?void 0:i.insert(e))||((o=this._SE)===null||o===void 0?void 0:o.insert(e))||((n=this._SW)===null||n===void 0?void 0:n.insert(e)))!==null&&r!==void 0?r:!1):!1}query(e,t,i){var o,n,r,a;let l=i??[];if(!e.intersects(this.rectangle))return[];for(let h of this._points)!e.contains(h.position)&&G(e.position,h.position)>h.particle.getRadius()&&(!t||t(h.particle))||l.push(h.particle);return this._divided&&((o=this._NE)===null||o===void 0||o.query(e,t,l),(n=this._NW)===null||n===void 0||n.query(e,t,l),(r=this._SE)===null||r===void 0||r.query(e,t,l),(a=this._SW)===null||a===void 0||a.query(e,t,l)),l}queryCircle(e,t,i){return this.query(new K(e.x,e.y,t),i)}queryRectangle(e,t,i){return this.query(new S(e.x,e.y,t.width,t.height),i)}subdivide(){let e=this.rectangle.position.x,t=this.rectangle.position.y,i=this.rectangle.size.width,o=this.rectangle.size.height,n=this.capacity;this._NE=new A(new S(e,t,i/2,o/2),n),this._NW=new A(new S(e+i/2,t,i/2,o/2),n),this._SE=new A(new S(e,t+o/2,i/2,o/2),n),this._SW=new A(new S(e+i/2,t+o/2,i/2,o/2),n),this._divided=!0}};var at=class{constructor(e,t){this.container=t,this._engine=e,this.nextId=0,this.array=[],this.zArray=[],this.pool=[],this.limit=0,this.needsSort=!1,this.lastZIndex=0,this.interactionManager=new st(this._engine,t);let i=this.container.canvas.size;this.quadTree=new A(new S(-i.width/4,-i.height/4,i.width*3/2,i.height*3/2),4),this.movers=this._engine.plugins.getMovers(t,!0),this.updaters=this._engine.plugins.getUpdaters(t,!0)}get count(){return this.array.length}addManualParticles(){let e=this.container,t=e.actualOptions;for(let i of t.manualParticles)this.addParticle(Gt({size:e.canvas.size,position:i.position}),i.options)}addParticle(e,t,i,o){let n=this.container,r=n.actualOptions,a=r.particles.number.limit;if(a>0){let l=this.count+1-a;l>0&&this.removeQuantity(l)}return this._pushParticle(e,t,i,o)}clear(){this.array=[],this.zArray=[]}destroy(){this.array=[],this.zArray=[],this.movers=[],this.updaters=[]}async draw(e){let t=this.container,i=this.container.canvas.size;this.quadTree=new A(new S(-i.width/4,-i.height/4,i.width*3/2,i.height*3/2),4),t.canvas.clear(),await this.update(e),this.needsSort&&(this.zArray.sort((o,n)=>n.position.z-o.position.z||o.id-n.id),this.lastZIndex=this.zArray[this.zArray.length-1].position.z,this.needsSort=!1);for(let[,o]of t.plugins)t.canvas.drawPlugin(o,e);for(let o of this.zArray)o.draw(e)}handleClickMode(e){this.interactionManager.handleClickMode(e)}init(){var e;let t=this.container,i=t.actualOptions;this.lastZIndex=0,this.needsSort=!1;let o=!1;this.updaters=this._engine.plugins.getUpdaters(t,!0),this.interactionManager.init();for(let[,n]of t.plugins)if(n.particlesInitialization!==void 0&&(o=n.particlesInitialization()),o)break;this.interactionManager.init();for(let[,n]of t.pathGenerators)n.init(t);if(this.addManualParticles(),!o){for(let n in i.particles.groups){let r=i.particles.groups[n];for(let a=this.count,l=0;l<((e=r.number)===null||e===void 0?void 0:e.value)&&a<i.particles.number.value;a++,l++)this.addParticle(void 0,r,n)}for(let n=this.count;n<i.particles.number.value;n++)this.addParticle()}}push(e,t,i,o){this.pushing=!0;for(let n=0;n<e;n++)this.addParticle(t?.position,i,o);this.pushing=!1}async redraw(){this.clear(),this.init(),await this.draw({value:0,factor:0})}remove(e,t,i){this.removeAt(this.array.indexOf(e),void 0,t,i)}removeAt(e,t=1,i,o){if(e<0||e>this.count)return;let n=0;for(let r=e;n<t&&r<this.count;r++){let a=this.array[r];if(!a||a.group!==i)continue;a.destroy(o),this.array.splice(r--,1);let l=this.zArray.indexOf(a);this.zArray.splice(l,1),this.pool.push(a),n++,this._engine.dispatchEvent("particleRemoved",{container:this.container,data:{particle:a}})}}removeQuantity(e,t){this.removeAt(0,e,t)}setDensity(){let e=this.container.actualOptions;for(let t in e.particles.groups)this._applyDensity(e.particles.groups[t],0,t);this._applyDensity(e.particles,e.manualParticles.length)}async update(e){var t,i;let o=this.container,n=[];for(let[,r]of o.pathGenerators)r.update();for(let[,r]of o.plugins)(t=r.update)===null||t===void 0||t.call(r,e);for(let r of this.array){let a=o.canvas.resizeFactor;a&&!r.ignoresResizeRatio&&(r.position.x*=a.width,r.position.y*=a.height,r.initialPosition.x*=a.width,r.initialPosition.y*=a.height),r.ignoresResizeRatio=!1,await this.interactionManager.reset(r);for(let[,l]of this.container.plugins){if(r.destroyed)break;(i=l.particleUpdate)===null||i===void 0||i.call(l,r,e)}for(let l of this.movers)l.isEnabled(r)&&l.move(r,e);if(r.destroyed){n.push(r);continue}this.quadTree.insert(new rt(r.getPosition(),r))}for(let r of n)this.remove(r);await this.interactionManager.externalInteract(e);for(let r of this.array){for(let a of this.updaters)a.update(r,e);!r.destroyed&&!r.spawning&&await this.interactionManager.particlesInteract(r,e)}delete o.canvas.resizeFactor}_applyDensity(e,t,i){var o;if(!(!((o=e.number.density)===null||o===void 0)&&o.enable))return;let n=e.number,r=this._initDensityFactor(n.density),a=n.value,l=n.limit>0?n.limit:a,h=Math.min(a,l)*r+t,f=Math.min(this.count,this.array.filter(u=>u.group===i).length);this.limit=n.limit*r,f<h?this.push(Math.abs(h-f),void 0,e,i):f>h&&this.removeQuantity(f-h,i)}_initDensityFactor(e){let t=this.container;if(!t.canvas.element||!e.enable)return 1;let i=t.canvas.element,o=t.retina.pixelRatio;return i.width*i.height/(e.factor*o**2*e.area)}_pushParticle(e,t,i,o){try{let n=this.pool.pop();n?n.init(this.nextId,e,t,i):n=new nt(this._engine,this.nextId,this.container,e,t,i);let r=!0;return o&&(r=o(n)),r?(this.array.push(n),this.zArray.push(n),this.nextId++,this._engine.dispatchEvent("particleAdded",{container:this.container,data:{particle:n}}),n):void 0}catch(n){console.warn(`error adding particle: ${n}`);return}}};var lt=class{constructor(e){this.container=e}init(){let e=this.container,t=e.actualOptions;this.pixelRatio=!t.detectRetina||B()?1:window.devicePixelRatio,this.reduceFactor=1;let i=this.pixelRatio;if(e.canvas.element){let n=e.canvas.element;e.canvas.size.width=n.offsetWidth*i,e.canvas.size.height=n.offsetHeight*i}let o=t.particles;this.attractDistance=x(o.move.attract.distance)*i,this.sizeAnimationSpeed=x(o.size.animation.speed)*i,this.maxSpeed=x(o.move.gravity.maxSpeed)*i}initParticle(e){let t=e.options,i=this.pixelRatio,o=t.move.distance,n=e.retina;n.attractDistance=x(t.move.attract.distance)*i,n.moveDrift=x(t.move.drift)*i,n.moveSpeed=x(t.move.speed)*i,n.sizeAnimationSpeed=x(t.size.animation.speed)*i;let r=n.maxDistance;r.horizontal=o.horizontal!==void 0?o.horizontal*i:void 0,r.vertical=o.vertical!==void 0?o.vertical*i:void 0,n.maxSpeed=x(t.move.gravity.maxSpeed)*i}};function b(s){return s&&!s.destroyed}function ne(s,e,...t){let i=new ot(s,e);return It(i,...t),i}var Bi="default",fi={generate:s=>{let e=s.velocity.copy();return e.angle+=e.length*Math.PI/180,e},init:()=>{},update:()=>{},reset:()=>{}},ht=class{constructor(e,t,i){this.id=t,this._engine=e,this.fpsLimit=120,this.smooth=!1,this._delay=0,this.duration=0,this.lifeTime=0,this._firstStart=!0,this.started=!1,this.destroyed=!1,this._paused=!0,this.lastFrameTime=0,this.zLayers=100,this.pageHidden=!1,this._sourceOptions=i,this._initialSourceOptions=i,this.retina=new lt(this),this.canvas=new ge(this),this.particles=new at(this._engine,this),this.frameManager=new ye(this),this.pathGenerators=new Map,this.interactivity={mouse:{clicking:!1,inside:!1}},this.plugins=new Map,this.drawers=new Map,this._options=ne(this._engine,this),this.actualOptions=ne(this._engine,this),this._eventListeners=new xe(this),typeof IntersectionObserver<"u"&&IntersectionObserver&&(this._intersectionObserver=new IntersectionObserver(o=>this._intersectionManager(o))),this._engine.dispatchEvent("containerBuilt",{container:this})}get options(){return this._options}get sourceOptions(){return this._sourceOptions}addClickHandler(e){if(!b(this))return;let t=this.interactivity.element;if(!t)return;let i=(u,p,d)=>{if(!b(this))return;let c=this.retina.pixelRatio,g={x:p.x*c,y:p.y*c},v=this.particles.quadTree.queryCircle(g,d*c);e(u,v)},o=u=>{if(!b(this))return;let p=u,d={x:p.offsetX||p.clientX,y:p.offsetY||p.clientY};i(u,d,1)},n=()=>{b(this)&&(h=!0,f=!1)},r=()=>{b(this)&&(f=!0)},a=u=>{if(b(this)){if(h&&!f){let p=u,d=p.touches[p.touches.length-1];if(!d&&(d=p.changedTouches[p.changedTouches.length-1],!d))return;let c=this.canvas.element,g=c?c.getBoundingClientRect():void 0,v={x:d.clientX-(g?g.left:0),y:d.clientY-(g?g.top:0)};i(u,v,Math.max(d.radiusX,d.radiusY))}h=!1,f=!1}},l=()=>{b(this)&&(h=!1,f=!1)},h=!1,f=!1;t.addEventListener("click",o),t.addEventListener("touchstart",n),t.addEventListener("touchmove",r),t.addEventListener("touchend",a),t.addEventListener("touchcancel",l)}addPath(e,t,i=!1){return!b(this)||!i&&this.pathGenerators.has(e)?!1:(this.pathGenerators.set(e,t??fi),!0)}destroy(){if(!b(this))return;this.stop(),this.particles.destroy(),this.canvas.destroy();for(let[,i]of this.drawers)i.destroy&&i.destroy(this);for(let i of this.drawers.keys())this.drawers.delete(i);this._engine.plugins.destroy(this),this.destroyed=!0;let e=this._engine.dom(),t=e.findIndex(i=>i===this);t>=0&&e.splice(t,1),this._engine.dispatchEvent("containerDestroyed",{container:this})}draw(e){if(!b(this))return;let t=e;this._drawAnimationFrame=Xt()(async i=>{t&&(this.lastFrameTime=void 0,t=!1),await this.frameManager.nextFrame(i)})}exportConfiguration(){return JSON.stringify(this.actualOptions,(e,t)=>{if(!(e==="_engine"||e==="_container"))return t},2)}exportImage(e,t,i){let o=this.canvas.element;o&&o.toBlob(e,t??"image/png",i)}exportImg(e){this.exportImage(e)}getAnimationStatus(){return!this._paused&&!this.pageHidden&&b(this)}handleClickMode(e){if(b(this)){this.particles.handleClickMode(e);for(let[,t]of this.plugins)t.handleClickMode&&t.handleClickMode(e)}}async init(){if(!b(this))return;let e=this._engine.plugins.getSupportedShapes();for(let i of e){let o=this._engine.plugins.getShapeDrawer(i);o&&this.drawers.set(i,o)}this._options=ne(this._engine,this,this._initialSourceOptions,this.sourceOptions),this.actualOptions=ne(this._engine,this,this._options);let t=this._engine.plugins.getAvailablePlugins(this);for(let[i,o]of t)this.plugins.set(i,o);this.retina.init(),this.canvas.init(),this.updateActualOptions(),this.canvas.initBackground(),this.canvas.resize(),this.zLayers=this.actualOptions.zLayers,this.duration=x(this.actualOptions.duration)*1e3,this._delay=x(this.actualOptions.delay)*1e3,this.lifeTime=0,this.fpsLimit=this.actualOptions.fpsLimit>0?this.actualOptions.fpsLimit:120,this.smooth=this.actualOptions.smooth;for(let[,i]of this.drawers)i.init&&await i.init(this);for(let[,i]of this.plugins)i.init&&await i.init();this._engine.dispatchEvent("containerInit",{container:this}),this.particles.init(),this.particles.setDensity();for(let[,i]of this.plugins)i.particlesSetup&&i.particlesSetup();this._engine.dispatchEvent("particlesSetup",{container:this})}async loadTheme(e){b(this)&&(this._currentTheme=e,await this.refresh())}pause(){if(b(this)&&(this._drawAnimationFrame!==void 0&&(Yt()(this._drawAnimationFrame),delete this._drawAnimationFrame),!this._paused)){for(let[,e]of this.plugins)e.pause&&e.pause();this.pageHidden||(this._paused=!0),this._engine.dispatchEvent("containerPaused",{container:this})}}play(e){if(!b(this))return;let t=this._paused||e;if(this._firstStart&&!this.actualOptions.autoPlay){this._firstStart=!1;return}if(this._paused&&(this._paused=!1),t)for(let[,i]of this.plugins)i.play&&i.play();this._engine.dispatchEvent("containerPlay",{container:this}),this.draw(t||!1)}async refresh(){if(b(this))return this.stop(),this.start()}async reset(){if(b(this))return this._options=ne(this._engine,this),this.refresh()}setNoise(e,t,i){b(this)&&this.setPath(e,t,i)}setPath(e,t,i){if(!e||!b(this))return;let o=Object.assign({},fi);if(typeof e=="function")o.generate=e,t&&(o.init=t),i&&(o.update=i);else{let n=o;o.generate=e.generate||n.generate,o.init=e.init||n.init,o.update=e.update||n.update}this.addPath(Bi,o,!0)}async start(){!b(this)||this.started||(await this.init(),this.started=!0,await new Promise(e=>{this._delayTimeout=setTimeout(async()=>{this._eventListeners.addListeners(),this.interactivity.element instanceof HTMLElement&&this._intersectionObserver&&this._intersectionObserver.observe(this.interactivity.element);for(let[,t]of this.plugins)t.start&&await t.start();this._engine.dispatchEvent("containerStarted",{container:this}),this.play(),e()},this._delay)}))}stop(){if(!(!b(this)||!this.started)){this._delayTimeout&&(clearTimeout(this._delayTimeout),delete this._delayTimeout),this._firstStart=!0,this.started=!1,this._eventListeners.removeListeners(),this.pause(),this.particles.clear(),this.canvas.clear(),this.interactivity.element instanceof HTMLElement&&this._intersectionObserver&&this._intersectionObserver.unobserve(this.interactivity.element);for(let[,e]of this.plugins)e.stop&&e.stop();for(let e of this.plugins.keys())this.plugins.delete(e);this._sourceOptions=this._options,this._engine.dispatchEvent("containerStopped",{container:this})}}updateActualOptions(){this.actualOptions.responsive=[];let e=this.actualOptions.setResponsive(this.canvas.size.width,this.retina.pixelRatio,this._options);return this.actualOptions.setTheme(this._currentTheme),this.responsiveMaxWidth===e?!1:(this.responsiveMaxWidth=e,!0)}_intersectionManager(e){if(!(!b(this)||!this.actualOptions.pauseOnOutsideViewport))for(let t of e)t.target===this.interactivity.element&&(t.isIntersecting?this.play:this.pause)()}};async function Ni(s,e){let t=N(s,e);if(!t)return;let i=await fetch(t);if(i.ok)return i.json();console.error(`tsParticles - Error ${i.status} while retrieving config file`)}var ct=class{constructor(e){this._engine=e}load(e,t,i){let o={index:i,remote:!1};return typeof e=="string"?o.tagId=e:o.options=e,typeof t=="number"?o.index=t:o.options=t??o.options,this.loadOptions(o)}async loadJSON(e,t,i){let o,n;return typeof t=="number"||t===void 0?o=e:(n=e,o=t),this.loadRemoteOptions({tagId:n,url:o,index:i,remote:!0})}async loadOptions(e){var t,i,o;let n=(t=e.tagId)!==null&&t!==void 0?t:`tsparticles${Math.floor(T()*1e4)}`,{index:r,url:a,remote:l}=e,h=l?await Ni(a,r):e.options,f=(i=e.element)!==null&&i!==void 0?i:document.getElementById(n);f||(f=document.createElement("div"),f.id=n,(o=document.querySelector("body"))===null||o===void 0||o.append(f));let u=N(h,r),p=this._engine.dom(),d=p.findIndex(v=>v.id===n);if(d>=0){let v=this._engine.domItem(d);v&&!v.destroyed&&(v.destroy(),p.splice(d,1))}let c;if(f.tagName.toLowerCase()==="canvas")c=f,c.dataset[q]="false";else{let v=f.getElementsByTagName("canvas");v.length?(c=v[0],c.dataset[q]="false"):(c=document.createElement("canvas"),c.dataset[q]="true",f.appendChild(c))}c.style.width||(c.style.width="100%"),c.style.height||(c.style.height="100%");let g=new ht(this._engine,n,u);return d>=0?p.splice(d,0,g):p.push(g),g.canvas.loadCanvas(c),await g.start(),g}async loadRemoteOptions(e){return this.loadOptions(e)}async set(e,t,i,o){let n={index:o,remote:!1};return typeof e=="string"?n.tagId=e:n.element=e,t instanceof HTMLElement?n.element=t:n.options=t,typeof i=="number"?n.index=i:n.options=i??n.options,this.loadOptions(n)}async setJSON(e,t,i,o){let n,r,a,l;return e instanceof HTMLElement?(l=e,n=t,a=i):(r=e,l=t,n=i,a=o),this.loadRemoteOptions({tagId:r,url:n,index:a,element:l,remote:!0})}};function Dt(s,e,t,i=!1){let o=e.get(s);return(!o||i)&&(o=[...t.values()].map(n=>n(s)),e.set(s,o)),o}var ut=class{constructor(e){this._engine=e,this.plugins=[],this._initializers={interactors:new Map,movers:new Map,updaters:new Map},this.interactors=new Map,this.movers=new Map,this.updaters=new Map,this.presets=new Map,this.drawers=new Map,this.pathGenerators=new Map}addInteractor(e,t){this._initializers.interactors.set(e,t)}addParticleMover(e,t){this._initializers.movers.set(e,t)}addParticleUpdater(e,t){this._initializers.updaters.set(e,t)}addPathGenerator(e,t){this.getPathGenerator(e)||this.pathGenerators.set(e,t)}addPlugin(e){this.getPlugin(e.id)||this.plugins.push(e)}addPreset(e,t,i=!1){(i||!this.getPreset(e))&&this.presets.set(e,t)}addShapeDrawer(e,t){C(e,i=>{this.getShapeDrawer(i)||this.drawers.set(i,t)})}destroy(e){this.updaters.delete(e),this.movers.delete(e),this.interactors.delete(e)}getAvailablePlugins(e){let t=new Map;for(let i of this.plugins)i.needsPlugin(e.actualOptions)&&t.set(i.id,i.getPlugin(e));return t}getInteractors(e,t=!1){return Dt(e,this.interactors,this._initializers.interactors,t)}getMovers(e,t=!1){return Dt(e,this.movers,this._initializers.movers,t)}getPathGenerator(e){return this.pathGenerators.get(e)}getPlugin(e){return this.plugins.find(t=>t.id===e)}getPreset(e){return this.presets.get(e)}getShapeDrawer(e){return this.drawers.get(e)}getSupportedShapes(){return this.drawers.keys()}getUpdaters(e,t=!1){return Dt(e,this.updaters,this._initializers.updaters,t)}loadOptions(e,t){for(let i of this.plugins)i.loadOptions(e,t)}loadParticlesOptions(e,t,...i){let o=this.updaters.get(e);if(o)for(let n of o)n.loadOptions&&n.loadOptions(t,...i)}};var ft=class{constructor(){this._domArray=[],this._eventDispatcher=new le,this._initialized=!1,this._loader=new ct(this),this.plugins=new ut(this)}addEventListener(e,t){this._eventDispatcher.addEventListener(e,t)}async addInteractor(e,t){this.plugins.addInteractor(e,t),await this.refresh()}async addMover(e,t){this.plugins.addParticleMover(e,t),await this.refresh()}async addParticleUpdater(e,t){this.plugins.addParticleUpdater(e,t),await this.refresh()}async addPathGenerator(e,t){this.plugins.addPathGenerator(e,t),await this.refresh()}async addPlugin(e){this.plugins.addPlugin(e),await this.refresh()}async addPreset(e,t,i=!1){this.plugins.addPreset(e,t,i),await this.refresh()}async addShape(e,t,i,o,n){let r;typeof t=="function"?r={afterEffect:o,destroy:n,draw:t,init:i}:r=t,this.plugins.addShapeDrawer(e,r),await this.refresh()}dispatchEvent(e,t){this._eventDispatcher.dispatchEvent(e,t)}dom(){return this._domArray}domItem(e){let t=this.dom(),i=t[e];if(i&&!i.destroyed)return i;t.splice(e,1)}init(){this._initialized||(this._initialized=!0)}async load(e,t){return this._loader.load(e,t)}async loadFromArray(e,t,i){return this._loader.load(e,t,i)}async loadJSON(e,t,i){return this._loader.loadJSON(e,t,i)}async refresh(){for(let e of this.dom())await e.refresh()}removeEventListener(e,t){this._eventDispatcher.removeEventListener(e,t)}async set(e,t,i){return this._loader.set(e,t,i)}async setJSON(e,t,i,o){return this._loader.setJSON(e,t,i,o)}setOnClickHandler(e){let t=this.dom();if(!t.length)throw new Error("Can only set click handlers after calling tsParticles.load() or tsParticles.loadJSON()");for(let i of t)i.addClickHandler(e)}};var pt=class{constructor(){this.key="hsl",this.stringPrefix="hsl"}handleColor(e){var t;let i=e.value,o=(t=i.hsl)!==null&&t!==void 0?t:e.value;if(o.h!==void 0&&o.s!==void 0&&o.l!==void 0)return me(o)}handleRangeColor(e){var t;let i=e.value,o=(t=i.hsl)!==null&&t!==void 0?t:e.value;if(o.h!==void 0&&o.l!==void 0)return me({h:x(o.h),l:x(o.l),s:x(o.s)})}parseString(e){if(!e.startsWith("hsl"))return;let t=/hsla?\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(,\s*([\d.%]+)\s*)?\)/i,i=t.exec(e);return i?Zt({a:i.length>4?ue(i[5]):1,h:parseInt(i[1],10),l:parseInt(i[3],10),s:parseInt(i[2],10)}):void 0}};var dt=class{constructor(){this.key="rgb",this.stringPrefix="rgb"}handleColor(e){var t;let i=e.value,o=(t=i.rgb)!==null&&t!==void 0?t:e.value;if(o.r!==void 0)return o}handleRangeColor(e){var t;let i=e.value,o=(t=i.rgb)!==null&&t!==void 0?t:e.value;if(o.r!==void 0)return{r:x(o.r),g:x(o.g),b:x(o.b)}}parseString(e){if(!e.startsWith(this.stringPrefix))return;let t=/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([\d.%]+)\s*)?\)/i,i=t.exec(e);return i?{a:i.length>4?ue(i[5]):1,b:parseInt(i[3],10),g:parseInt(i[2],10),r:parseInt(i[1],10)}:void 0}};var qi=new dt,Gi=new pt;bt(qi);bt(Gi);var re=new ft;re.init();var vi=Si(di()),gi="tsparticles",U=class extends $i{constructor(e){super(e),this.state={init:!1,library:void 0}}destroy(){this.state.library&&(this.state.library.destroy(),this.setState({library:void 0}))}shouldComponentUpdate(e){return!(0,vi.default)(e,this.props)}componentDidUpdate(){this.refresh()}forceUpdate(){this.refresh().then(()=>{super.forceUpdate()})}componentDidMount(){(async()=>(this.props.init&&await this.props.init(re),this.setState({init:!0},async()=>{await this.loadParticles()})))()}componentWillUnmount(){this.destroy()}render(){let{width:e,height:t,className:i,canvasClassName:o,id:n}=this.props;return mi.createElement("div",{className:i,id:n},mi.createElement("canvas",{className:o,style:Object.assign(Object.assign({},this.props.style),{width:e,height:t})}))}async refresh(){this.destroy(),await this.loadParticles()}async loadParticles(){var e,t,i;if(!this.state.init)return;let o=async a=>{this.props.container&&(this.props.container.current=a),this.setState({library:a}),this.props.loaded&&await this.props.loaded(a)},n=(t=(e=this.props.id)!==null&&e!==void 0?e:U.defaultProps.id)!==null&&t!==void 0?t:gi,r=this.props.url?await re.loadJSON(n,this.props.url):await re.load(n,(i=this.props.params)!==null&&i!==void 0?i:this.props.options);await o(r)}};U.defaultProps={width:"100%",height:"100%",options:{},style:{},url:void 0,id:gi};var xi=U;var yi={color:{value:"#B5FFFC"},params:{}},bi={};import{jsx as Xi}from"react/jsx-runtime";var At=({color:s="green",params:e={},...t})=>Xi(xi,{params:{particles:{number:{value:80,density:{enable:!0,value_area:900}},color:s,shape:{type:"circle",stroke:{width:0,color:"#000000"},polygon:{nb_sides:5},image:{src:"img/github.svg",width:100,height:100}},opacity:{value:.5,random:!1,anim:{enable:!1,speed:1,opacity_min:.1,sync:!1}},size:{value:3,random:!0,anim:{enable:!1,speed:40,size_min:.1,sync:!1}},line_linked:{enable:!0,distance:142.0465754938091,color:"#ffffff",opacity:.1815039575754227,width:1.4204657549380908},move:{enable:!0,speed:1.1,direction:"none",random:!1,straight:!1,out_mode:"out",bounce:!1,attract:{enable:!1,rotateX:600,rotateY:1200}}},interactivity:{detect_on:"canvas",events:{onhover:{enable:!1,mode:"grab"},onclick:{enable:!1,mode:"push"},resize:!0},modes:{grab:{distance:143.85614385614386,line_linked:{opacity:1}},bubble:{distance:400,size:40,duration:2,opacity:8,speed:3},repulse:{distance:200,duration:.4},push:{particles_nb:4},remove:{particles_nb:2}}},retina_detect:!0,...e},...t});At.defaultProps=yi;At.propTypes=bi;var Fc=At;export{Fc as default};
|
package/package.json
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
{
|
2
|
+
"name": "@tbmui/particles",
|
3
|
+
"version": "0.9.0",
|
4
|
+
"main": "./build/index.js",
|
5
|
+
"author": "Jeremy Tenjo",
|
6
|
+
"types": "./build/types/index.d.ts",
|
7
|
+
"files": [
|
8
|
+
"build"
|
9
|
+
],
|
10
|
+
"scripts": {
|
11
|
+
"build": "node ./node_modules/@useweb/compiler/build ",
|
12
|
+
"build:watch": "node ./node_modules/@useweb/compiler/build --watch",
|
13
|
+
"deploy": "npm run build && npm publish --access public"
|
14
|
+
},
|
15
|
+
"peerDependencies": {
|
16
|
+
"react": "^18.0.0"
|
17
|
+
},
|
18
|
+
"devDependencies": {
|
19
|
+
"@useweb/compiler": "3.3.0"
|
20
|
+
},
|
21
|
+
"dependencies": {
|
22
|
+
"react-tsparticles": "^2.0.6"
|
23
|
+
}
|
24
|
+
}
|