@tsparticles/shape-image 4.0.1 → 4.0.2

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/browser/index.js CHANGED
@@ -56,7 +56,7 @@ function addLoadImageToEngine(engine) {
56
56
  };
57
57
  }
58
58
  export async function loadImageShape(engine) {
59
- engine.checkVersion("4.0.1");
59
+ engine.checkVersion("4.0.2");
60
60
  await engine.pluginManager.register(e => {
61
61
  addLoadImageToEngine(e);
62
62
  e.pluginManager.addPlugin(new ImagePreloaderPlugin(e));
@@ -56,7 +56,7 @@ function addLoadImageToEngine(engine) {
56
56
  };
57
57
  }
58
58
  export async function loadImageShape(engine) {
59
- engine.checkVersion("4.0.1");
59
+ engine.checkVersion("4.0.2");
60
60
  await engine.pluginManager.register(async (e) => {
61
61
  const { ImagePreloaderPlugin } = await import("./ImagePreloader.js");
62
62
  addLoadImageToEngine(e);
package/cjs/index.js CHANGED
@@ -56,7 +56,7 @@ function addLoadImageToEngine(engine) {
56
56
  };
57
57
  }
58
58
  export async function loadImageShape(engine) {
59
- engine.checkVersion("4.0.1");
59
+ engine.checkVersion("4.0.2");
60
60
  await engine.pluginManager.register(e => {
61
61
  addLoadImageToEngine(e);
62
62
  e.pluginManager.addPlugin(new ImagePreloaderPlugin(e));
package/cjs/index.lazy.js CHANGED
@@ -56,7 +56,7 @@ function addLoadImageToEngine(engine) {
56
56
  };
57
57
  }
58
58
  export async function loadImageShape(engine) {
59
- engine.checkVersion("4.0.1");
59
+ engine.checkVersion("4.0.2");
60
60
  await engine.pluginManager.register(async (e) => {
61
61
  const { ImagePreloaderPlugin } = await import("./ImagePreloader.js");
62
62
  addLoadImageToEngine(e);
package/esm/index.js CHANGED
@@ -56,7 +56,7 @@ function addLoadImageToEngine(engine) {
56
56
  };
57
57
  }
58
58
  export async function loadImageShape(engine) {
59
- engine.checkVersion("4.0.1");
59
+ engine.checkVersion("4.0.2");
60
60
  await engine.pluginManager.register(e => {
61
61
  addLoadImageToEngine(e);
62
62
  e.pluginManager.addPlugin(new ImagePreloaderPlugin(e));
package/esm/index.lazy.js CHANGED
@@ -56,7 +56,7 @@ function addLoadImageToEngine(engine) {
56
56
  };
57
57
  }
58
58
  export async function loadImageShape(engine) {
59
- engine.checkVersion("4.0.1");
59
+ engine.checkVersion("4.0.2");
60
60
  await engine.pluginManager.register(async (e) => {
61
61
  const { ImagePreloaderPlugin } = await import("./ImagePreloader.js");
62
62
  addLoadImageToEngine(e);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/shape-image",
3
- "version": "4.0.1",
3
+ "version": "4.0.2",
4
4
  "description": "tsParticles image shape",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -65,7 +65,7 @@
65
65
  "./package.json": "./package.json"
66
66
  },
67
67
  "peerDependencies": {
68
- "@tsparticles/engine": "4.0.1"
68
+ "@tsparticles/engine": "4.0.2"
69
69
  },
70
70
  "publishConfig": {
71
71
  "access": "public"
@@ -1,5 +1,5 @@
1
1
  (function(g){g.__tsParticlesInternals=g.__tsParticlesInternals||{};g.__tsParticlesInternals.bundles=g.__tsParticlesInternals.bundles||{};g.__tsParticlesInternals.effects=g.__tsParticlesInternals.effects||{};g.__tsParticlesInternals.engine=g.__tsParticlesInternals.engine||{};g.__tsParticlesInternals.interactions=g.__tsParticlesInternals.interactions||{};g.__tsParticlesInternals.palettes=g.__tsParticlesInternals.palettes||{};g.__tsParticlesInternals.paths=g.__tsParticlesInternals.paths||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins.emittersShapes=g.__tsParticlesInternals.plugins.emittersShapes||{};g.__tsParticlesInternals.presets=g.__tsParticlesInternals.presets||{};g.__tsParticlesInternals.shapes=g.__tsParticlesInternals.shapes||{};g.__tsParticlesInternals.updaters=g.__tsParticlesInternals.updaters||{};g.__tsParticlesInternals.utils=g.__tsParticlesInternals.utils||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas.utils=g.__tsParticlesInternals.canvas.utils||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path.utils=g.__tsParticlesInternals.path.utils||{};var __tsProxyFactory=typeof Proxy!=="undefined"?function(obj){return new Proxy(obj,{get:function(target,key){if(!(key in target)){target[key]={};}return target[key];}});}:function(obj){return obj;};g.__tsParticlesInternals.bundles=__tsProxyFactory(g.__tsParticlesInternals.bundles);g.__tsParticlesInternals.effects=__tsProxyFactory(g.__tsParticlesInternals.effects);g.__tsParticlesInternals.interactions=__tsProxyFactory(g.__tsParticlesInternals.interactions);g.__tsParticlesInternals.palettes=__tsProxyFactory(g.__tsParticlesInternals.palettes);g.__tsParticlesInternals.paths=__tsProxyFactory(g.__tsParticlesInternals.paths);g.__tsParticlesInternals.plugins=__tsProxyFactory(g.__tsParticlesInternals.plugins);g.__tsParticlesInternals.plugins.emittersShapes=__tsProxyFactory(g.__tsParticlesInternals.plugins.emittersShapes);g.__tsParticlesInternals.presets=__tsProxyFactory(g.__tsParticlesInternals.presets);g.__tsParticlesInternals.shapes=__tsProxyFactory(g.__tsParticlesInternals.shapes);g.__tsParticlesInternals.updaters=__tsProxyFactory(g.__tsParticlesInternals.updaters);g.__tsParticlesInternals.utils=__tsProxyFactory(g.__tsParticlesInternals.utils);g.__tsParticlesInternals.canvas=__tsProxyFactory(g.__tsParticlesInternals.canvas);g.__tsParticlesInternals.path=__tsProxyFactory(g.__tsParticlesInternals.path);g.tsparticlesInternalExports=g.tsparticlesInternalExports||{};})(typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:this);
2
- /* Shape v4.0.1 */
2
+ /* Shape v4.0.2 */
3
3
  (function (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tsparticles/engine')) :
5
5
  typeof define === 'function' && define.amd ? define(['exports', '@tsparticles/engine'], factory) :
@@ -825,7 +825,7 @@
825
825
  };
826
826
  }
827
827
  async function loadImageShape(engine) {
828
- engine.checkVersion("4.0.1");
828
+ engine.checkVersion("4.0.2");
829
829
  await engine.pluginManager.register(e => {
830
830
  addLoadImageToEngine(e);
831
831
  e.pluginManager.addPlugin(new ImagePreloaderPlugin(e));
@@ -1 +1 @@
1
- !function(e){e.__tsParticlesInternals=e.__tsParticlesInternals||{},e.__tsParticlesInternals.bundles=e.__tsParticlesInternals.bundles||{},e.__tsParticlesInternals.effects=e.__tsParticlesInternals.effects||{},e.__tsParticlesInternals.engine=e.__tsParticlesInternals.engine||{},e.__tsParticlesInternals.interactions=e.__tsParticlesInternals.interactions||{},e.__tsParticlesInternals.palettes=e.__tsParticlesInternals.palettes||{},e.__tsParticlesInternals.paths=e.__tsParticlesInternals.paths||{},e.__tsParticlesInternals.plugins=e.__tsParticlesInternals.plugins||{},e.__tsParticlesInternals.plugins=e.__tsParticlesInternals.plugins||{},e.__tsParticlesInternals.plugins.emittersShapes=e.__tsParticlesInternals.plugins.emittersShapes||{},e.__tsParticlesInternals.presets=e.__tsParticlesInternals.presets||{},e.__tsParticlesInternals.shapes=e.__tsParticlesInternals.shapes||{},e.__tsParticlesInternals.updaters=e.__tsParticlesInternals.updaters||{},e.__tsParticlesInternals.utils=e.__tsParticlesInternals.utils||{},e.__tsParticlesInternals.canvas=e.__tsParticlesInternals.canvas||{},e.__tsParticlesInternals.canvas=e.__tsParticlesInternals.canvas||{},e.__tsParticlesInternals.canvas.utils=e.__tsParticlesInternals.canvas.utils||{},e.__tsParticlesInternals.path=e.__tsParticlesInternals.path||{},e.__tsParticlesInternals.path=e.__tsParticlesInternals.path||{},e.__tsParticlesInternals.path.utils=e.__tsParticlesInternals.path.utils||{};var t="undefined"!=typeof Proxy?function(e){return new Proxy(e,{get:function(e,t){return t in e||(e[t]={}),e[t]}})}:function(e){return e};e.__tsParticlesInternals.bundles=t(e.__tsParticlesInternals.bundles),e.__tsParticlesInternals.effects=t(e.__tsParticlesInternals.effects),e.__tsParticlesInternals.interactions=t(e.__tsParticlesInternals.interactions),e.__tsParticlesInternals.palettes=t(e.__tsParticlesInternals.palettes),e.__tsParticlesInternals.paths=t(e.__tsParticlesInternals.paths),e.__tsParticlesInternals.plugins=t(e.__tsParticlesInternals.plugins),e.__tsParticlesInternals.plugins.emittersShapes=t(e.__tsParticlesInternals.plugins.emittersShapes),e.__tsParticlesInternals.presets=t(e.__tsParticlesInternals.presets),e.__tsParticlesInternals.shapes=t(e.__tsParticlesInternals.shapes),e.__tsParticlesInternals.updaters=t(e.__tsParticlesInternals.updaters),e.__tsParticlesInternals.utils=t(e.__tsParticlesInternals.utils),e.__tsParticlesInternals.canvas=t(e.__tsParticlesInternals.canvas),e.__tsParticlesInternals.path=t(e.__tsParticlesInternals.path),e.tsparticlesInternalExports=e.tsparticlesInternalExports||{}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:this),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@tsparticles/engine")):"function"==typeof define&&define.amd?define(["exports","@tsparticles/engine"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).__tsParticlesInternals=e.__tsParticlesInternals||{},e.__tsParticlesInternals.shapes=e.__tsParticlesInternals.shapes||{},e.__tsParticlesInternals.shapes.image=e.__tsParticlesInternals.shapes.image||{}),e.__tsParticlesInternals.engine)}(this,function(e,t){"use strict";const a=["image","images"],n=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d.]+%?\))|currentcolor/gi;async function s(e){return new Promise(a=>{e.loading=!0;const n=new Image;e.element=n,n.addEventListener("load",()=>{e.loading=!1,a()}),n.addEventListener("error",()=>{e.element=void 0,e.error=!0,e.loading=!1,t.getLogger().error(`Error loading image: ${e.source}`),a()}),n.src=e.source})}async function i(e){if("svg"!==e.type)return void await s(e);e.loading=!0;const a=await fetch(e.source);a.ok?e.svgData=await a.text():(t.getLogger().error("Image not found"),e.error=!0),e.loading=!1}function r(e,a,i,r,o=!1){const l=function(e,a,s,i=!1){const{svgData:r}=e;if(!r)return"";const o=t.getStyleFromHsl(a,i,s);if(r.includes("fill"))return r.replaceAll(n,()=>o);const l=r.indexOf(">");return`${r.substring(0,l)} fill="${o}"${r.substring(l)}`}(e,i,r.opacity?.value??1,o),c={color:i,gif:a.gif,data:{...e,svgData:l},loaded:!1,ratio:a.width/a.height,replaceColor:a.replaceColor,source:a.src};return new Promise(t=>{const a=new Blob([l],{type:"image/svg+xml"}),n=URL.createObjectURL(a),i=new Image;i.addEventListener("load",()=>{c.loaded=!0,c.element=i,t(c),URL.revokeObjectURL(n)});i.addEventListener("error",()=>{(async()=>{URL.revokeObjectURL(n);const a={...e,error:!1,loading:!0};await s(a),c.loaded=!0,c.element=a.element,t(c)})()}),i.src=n})}const o=[0,4,2,1],l=[8,8,4,2];class c{data;pos;constructor(e){this.pos=0,this.data=new Uint8ClampedArray(e)}getString(e){const t=this.data.slice(this.pos,this.pos+e);return this.pos+=t.length,t.reduce((e,t)=>e+String.fromCharCode(t),"")}nextByte(){return this.data[this.pos++]}nextTwoBytes(){return this.pos+=2,this.data[this.pos-2]+(this.data[this.pos-1]<<8)}readSubBlocks(){let e,t="";do{e=this.data[this.pos++];for(let a=e;--a>=0;t+=String.fromCharCode(this.data[this.pos++]));}while(0!==e);return t}readSubBlocksBin(){let e=this.data[this.pos],t=0;for(let a=0;0!==e;a+=e+1,e=this.data[this.pos+a])t+=e;const a=new Uint8Array(t);e=this.data[this.pos++];for(let t=0;0!==e;e=this.data[this.pos++])for(let n=e;--n>=0;a[t++]=this.data[this.pos++]);return a}skipSubBlocks(){for(const e=1,t=0;this.data[this.pos]!==t;this.pos+=this.data[this.pos]+e);this.pos++}}var g,h;!function(e){e[e.Replace=0]="Replace",e[e.Combine=1]="Combine",e[e.RestoreBackground=2]="RestoreBackground",e[e.RestorePrevious=3]="RestorePrevious",e[e.UndefinedA=4]="UndefinedA",e[e.UndefinedB=5]="UndefinedB",e[e.UndefinedC=6]="UndefinedC",e[e.UndefinedD=7]="UndefinedD"}(g||(g={})),function(e){e[e.Extension=33]="Extension",e[e.ApplicationExtension=255]="ApplicationExtension",e[e.GraphicsControlExtension=249]="GraphicsControlExtension",e[e.PlainTextExtension=1]="PlainTextExtension",e[e.CommentExtension=254]="CommentExtension",e[e.Image=44]="Image",e[e.EndOfFile=59]="EndOfFile"}(h||(h={}));function d(e,t){const a=[];for(let n=0;n<t;n++)a.push({r:e.data[e.pos],g:e.data[e.pos+1],b:e.data[e.pos+2]}),e.pos+=3;return a}function p(e,t,a){const n=t>>>3,s=7&t;return(e[n]+(e[n+1]<<8)+(e[n+2]<<16)&(1<<a)-1<<s)>>>s}async function f(e,t,a,n,s,i,r){switch(e.nextByte()){case h.EndOfFile:return!0;case h.Image:await async function(e,t,a,n,s,i){const r=t.frames[n(!0)];r.left=e.nextTwoBytes(),r.top=e.nextTwoBytes(),r.width=e.nextTwoBytes(),r.height=e.nextTwoBytes();const c=e.nextByte(),g=!(128&~c),h=!(64&~c);r.sortFlag=!(32&~c),r.reserved=(24&c)>>>3;const f=1<<1+(7&c);g&&(r.localColorTable=d(e,f));const u=e=>{const{r:n,g:i,b:o}=(g?r.localColorTable:t.globalColorTable)[e];return e!==s(null)?{r:n,g:i,b:o,a:255}:{r:n,g:i,b:o,a:a?Math.trunc((n+i+o)/3):0}},m=(()=>{try{return new ImageData(r.width,r.height,i)}catch(e){if(e instanceof DOMException&&"IndexSizeError"===e.name)return null;throw e}})();if(null==m)throw new EvalError("GIF frame size is to large");const _=e.nextByte(),I=e.readSubBlocksBin(),w=1<<_;if(h){for(let e=0,t=_+1,a=0,n=[[0]],s=0;s<4;s++)if(o[s]<r.height){let i=0,c=0,g=!1;for(;!g;){const h=e;if(e=p(I,a,t),a+=t+1,e===w){t=_+1,n.length=w+2;for(let e=0;e<n.length;e++)n[e]=e<w?[e]:[]}else{e>=n.length?n.push(n[h].concat(n[h][0])):h!==w&&n.push(n[h].concat(n[e][0]));for(const t of n[e]){const{r:e,g:a,b:n,a:g}=u(t);m.data.set([e,a,n,g],o[s]*r.width+l[s]*c+i%(4*r.width)),i+=4}n.length===1<<t&&t<12&&t++}i===4*r.width*(c+1)&&(c++,o[s]+l[s]*c>=r.height&&(g=!0))}}r.image=m,r.bitmap=await createImageBitmap(m)}else{let e=0,t=_+1,a=0,n=-4;const s=[[0]];for(;;){const i=e;if(e=p(I,a,t),a+=t,e===w){t=_+1,s.length=w+2;for(let e=0;e<s.length;e++)s[e]=e<w?[e]:[]}else{if(e===w+1)break;e>=s.length?s.push(s[i].concat(s[i][0])):i!==w&&s.push(s[i].concat(s[e][0]));for(const t of s[e]){const{r:e,g:a,b:s,a:i}=u(t);n+=4,m.data.set([e,a,s,i],n)}s.length>=1<<t&&t<12&&t++}}r.image=m,r.bitmap=await createImageBitmap(m)}}(e,t,a,n,s,i);break;case h.Extension:!function(e,t,a,n){switch(e.nextByte()){case h.GraphicsControlExtension:{const s=t.frames[a(!1)];e.pos++;const i=e.nextByte();s.GCreserved=(224&i)>>>5,s.disposalMethod=(28&i)>>>2,s.userInputDelayFlag=!(2&~i);const r=!(1&~i);s.delayTime=10*e.nextTwoBytes();const o=e.nextByte();r&&n(o),e.pos++;break}case h.ApplicationExtension:{e.pos++;const a={identifier:e.getString(8),authenticationCode:e.getString(3),data:e.readSubBlocksBin()};t.applicationExtensions.push(a);break}case h.CommentExtension:t.comments.push([a(!1),e.readSubBlocks()]);break;case h.PlainTextExtension:if(0===t.globalColorTable.length)throw new EvalError("plain text extension without global color table");e.pos++,t.frames[a(!1)].plainTextData={left:e.nextTwoBytes(),top:e.nextTwoBytes(),width:e.nextTwoBytes(),height:e.nextTwoBytes(),charSize:{width:e.nextTwoBytes(),height:e.nextTwoBytes()},foregroundColor:e.nextByte(),backgroundColor:e.nextByte(),text:e.readSubBlocks()};break;default:e.skipSubBlocks()}}(e,t,n,s);break;default:throw new EvalError("undefined block found")}return!1}async function u(e,t){if("gif"===e.type){e.loading=!0;try{e.gifData=await async function(e,t,a,n){n??=!1;const s=await fetch(e);if(!s.ok&&404===s.status)throw new EvalError("file not found");const i=await s.arrayBuffer(),r={width:0,height:0,totalTime:0,colorRes:0,pixelAspectRatio:0,frames:[],sortFlag:!1,globalColorTable:[],backgroundImage:new ImageData(1,1,t),comments:[],applicationExtensions:[]},o=new c(new Uint8ClampedArray(i));if("GIF89a"!==o.getString(6))throw new Error("not a supported GIF file");r.width=o.nextTwoBytes(),r.height=o.nextTwoBytes();const l=o.nextByte(),h=!(128&~l);r.colorRes=(112&l)>>>4,r.sortFlag=!(8&~l);const p=1<<1+(7&l),u=o.nextByte();r.pixelAspectRatio=o.nextByte(),0!==r.pixelAspectRatio&&(r.pixelAspectRatio=(r.pixelAspectRatio+15)/64),h&&(r.globalColorTable=d(o,p));const m=(()=>{try{return new ImageData(r.width,r.height,t)}catch(e){if(e instanceof DOMException&&"IndexSizeError"===e.name)return null;throw e}})();if(null==m)throw new Error("GIF frame size is to large");const{r:_,g:I,b:w}=r.globalColorTable[u];m.data.set(h?[_,I,w,255]:[0,0,0,0]);for(let e=4;e<m.data.length;e*=2)m.data.copyWithin(e,0,e);r.backgroundImage=m;let P=-1,x=!0,y=-1;const b=e=>(e&&(x=!0),P),C=e=>(null!=e&&(y=e),y);try{do{x&&(r.frames.push({left:0,top:0,width:0,height:0,disposalMethod:g.Replace,image:new ImageData(1,1,t),plainTextData:null,userInputDelayFlag:!1,delayTime:0,sortFlag:!1,localColorTable:[],reserved:0,GCreserved:0}),P++,y=-1,x=!1)}while(!await f(o,r,n,b,C,t));r.frames.length--;for(const e of r.frames){if(e.userInputDelayFlag&&0===e.delayTime){r.totalTime=1/0;break}r.totalTime+=e.delayTime}return r}catch(e){if(e instanceof EvalError)throw new Error(`error while parsing frame ${P.toString()} "${e.message}"`,{cause:e});throw e}}(e.source,t),e.gifLoopCount=function(e){for(const t of e.applicationExtensions)if(t.identifier+t.authenticationCode==="NETSCAPE2.0")return t.data[1]+(t.data[2]<<8);return Number.NaN}(e.gifData),e.gifLoopCount||(e.gifLoopCount=1/0)}catch{e.error=!0}e.loading=!1}else await s(e)}class m{_container;_engine;constructor(e,t){this._engine=e,this._container=t}draw(e){const{context:a,radius:n,particle:s,opacity:i}=e,r=s.image,o=r?.element;if(r){if(a.globalAlpha=i,r.gif&&r.gifData)!function(e,a){const{context:n,radius:s,particle:i,delta:r}=e,o=i.image;if(!o?.gifData||!o.gif)return;const l=new OffscreenCanvas(o.gifData.width,o.gifData.height),c=l.getContext("2d",a);if(!c)throw new Error("could not create offscreen canvas context");c.imageSmoothingQuality="low",c.imageSmoothingEnabled=!1,c.clearRect(t.originPoint.x,t.originPoint.y,l.width,l.height),i.gifLoopCount??=o.gifLoopCount??0;let h=i.gifFrame??0;const d={x:-o.gifData.width*t.half,y:-o.gifData.height*t.half},p=o.gifData.frames[h];if(i.gifTime??=0,p.bitmap){switch(n.scale(s/o.gifData.width,s/o.gifData.height),p.disposalMethod){case g.UndefinedA:case g.UndefinedB:case g.UndefinedC:case g.UndefinedD:case g.Replace:c.drawImage(p.bitmap,p.left,p.top),n.drawImage(l,d.x,d.y),c.clearRect(t.originPoint.x,t.originPoint.y,l.width,l.height);break;case g.Combine:c.drawImage(p.bitmap,p.left,p.top),n.drawImage(l,d.x,d.y);break;case g.RestoreBackground:c.drawImage(p.bitmap,p.left,p.top),n.drawImage(l,d.x,d.y),c.clearRect(t.originPoint.x,t.originPoint.y,l.width,l.height),o.gifData.globalColorTable.length?c.putImageData(o.gifData.backgroundImage,d.x,d.y):c.putImageData(o.gifData.frames[0].image,d.x+p.left,d.y+p.top);break;case g.RestorePrevious:{const e=c.getImageData(t.originPoint.x,t.originPoint.y,l.width,l.height);c.drawImage(p.bitmap,p.left,p.top),n.drawImage(l,d.x,d.y),c.clearRect(t.originPoint.x,t.originPoint.y,l.width,l.height),c.putImageData(e,t.originPoint.x,t.originPoint.y)}}if(i.gifTime+=r.value,i.gifTime>p.delayTime){if(i.gifTime-=p.delayTime,++h>=o.gifData.frames.length){if(--i.gifLoopCount<=0)return;h=0,c.clearRect(t.originPoint.x,t.originPoint.y,l.width,l.height)}i.gifFrame=h}n.scale(o.gifData.width/s,o.gifData.height/s)}}(e,this._container.canvas.render.settings);else if(o){const e=r.ratio,s={x:-n,y:-n},i=n*t.double;a.drawImage(o,s.x,s.y,i,i/e)}a.globalAlpha=t.defaultAlpha}}getSidesCount(){return 12}async init(e){const t=e.actualOptions;if(!t.preload||!this._engine.loadImage)return;const a=[];for(const n of t.preload)a.push(this._engine.loadImage(e,n));await Promise.all(a)}loadShape(e){const{_container:t}=this;if(!e.shape||!a.includes(e.shape))return;const n=e.shapeData;if(!n)return;const s=this._engine.getImages?.(t),i=s?.find(e=>e.name===n.name||e.source===n.src);i||this.loadImageShape(t,n).then(()=>{this.loadShape(e)})}particleInit(e,a){if("image"!==a.shape&&"images"!==a.shape)return;const n=this._engine.getImages?.(e),s=a.shapeData;if(!s)return;const i=a.getFillColor(),o=n?.find(e=>e.name===s.name||e.source===s.src);if(!o)return;const l=s.replaceColor;o.loading?setTimeout(()=>{this.particleInit(e,a)}):(async()=>{let n;n=o.svgData&&i?await r(o,s,i,a,e.hdr):{color:i,data:o,element:o.element,gif:o.gif,gifData:o.gifData,gifLoopCount:o.gifLoopCount,loaded:!0,ratio:s.width&&s.height?s.width/s.height:o.ratio??t.defaultRatio,replaceColor:l,source:s.src},n.ratio||(n.ratio=1);const c={image:n,close:s.close??a.shapeClose};a.image=c.image,a.shapeClose=c.close})()}loadImageShape=async(e,t)=>{if(!this._engine.loadImage)throw new Error("Image shape not initialized");await this._engine.loadImage(e,{gif:t.gif,name:t.name,replaceColor:t.replaceColor,src:t.src})}}class _{gif;height;name;replaceColor;src;width;constructor(){this.src="",this.gif=!1}load(e){t.isNull(e)||(void 0!==e.gif&&(this.gif=e.gif),void 0!==e.height&&(this.height=e.height),void 0!==e.name&&(this.name=e.name),void 0!==e.replaceColor&&(this.replaceColor=e.replaceColor),void 0!==e.src&&(this.src=e.src),void 0!==e.width&&(this.width=e.width))}}class I{id="image-preloader";_engine;constructor(e){this._engine=e}async getPlugin(e){const{ImagePreloaderInstance:t}=await Promise.resolve().then(function(){return x});return new t(this._engine,e)}loadOptions(e,t,a){if(!a?.preload)return;t.preload??=[];const n=t.preload;for(const e of a.preload){const t=n.find(t=>t.name===e.name||t.src===e.src);if(t)t.load(e);else{const t=new _;t.load(e),n.push(t)}}}needsPlugin(){return!0}}async function w(e){e.checkVersion("4.0.1"),await e.pluginManager.register(e=>{!function(e){e.getImages??=t=>{e.images??=new Map;let a=e.images.get(t);return a||(a=[],e.images.set(t,a)),a},e.loadImage??=async(t,a)=>{if(!e.getImages)throw new Error("No images collection found");if(!a.name&&!a.src)throw new Error("No image source provided");e.images??=new Map;const n=e.getImages(t);if(!n.some(e=>e.name===a.name||e.source===a.src))try{const r={gif:a.gif,name:a.name??a.src,source:a.src,type:a.src.substring(a.src.length-3),error:!1,loading:!0,replaceColor:a.replaceColor,ratio:a.width&&a.height?a.width/a.height:void 0};let o;n.push(r),e.images.set(t,n),o=a.gif?e=>u(e,{colorSpace:"srgb"}):a.replaceColor?i:s,await o(r)}catch{throw new Error(`${a.name??a.src} not found`)}}}(e),e.pluginManager.addPlugin(new I(e)),e.pluginManager.addShape(a,t=>Promise.resolve(new m(e,t)))})}const P=globalThis;P.__tsParticlesInternals=P.__tsParticlesInternals??{},P.loadImageShape=w;var x=Object.freeze({__proto__:null,ImagePreloaderInstance:class{_container;_engine;constructor(e,t){this._engine=e,this._container=t}destroy(){this._engine.images?.delete(this._container)}}});e.loadImageShape=w}),Object.assign(globalThis.window||globalThis,{loadImageShape:(globalThis.__tsParticlesInternals.shapes.image||{}).loadImageShape}),delete(globalThis.window||globalThis).tsparticlesInternalExports;
1
+ !function(e){e.__tsParticlesInternals=e.__tsParticlesInternals||{},e.__tsParticlesInternals.bundles=e.__tsParticlesInternals.bundles||{},e.__tsParticlesInternals.effects=e.__tsParticlesInternals.effects||{},e.__tsParticlesInternals.engine=e.__tsParticlesInternals.engine||{},e.__tsParticlesInternals.interactions=e.__tsParticlesInternals.interactions||{},e.__tsParticlesInternals.palettes=e.__tsParticlesInternals.palettes||{},e.__tsParticlesInternals.paths=e.__tsParticlesInternals.paths||{},e.__tsParticlesInternals.plugins=e.__tsParticlesInternals.plugins||{},e.__tsParticlesInternals.plugins=e.__tsParticlesInternals.plugins||{},e.__tsParticlesInternals.plugins.emittersShapes=e.__tsParticlesInternals.plugins.emittersShapes||{},e.__tsParticlesInternals.presets=e.__tsParticlesInternals.presets||{},e.__tsParticlesInternals.shapes=e.__tsParticlesInternals.shapes||{},e.__tsParticlesInternals.updaters=e.__tsParticlesInternals.updaters||{},e.__tsParticlesInternals.utils=e.__tsParticlesInternals.utils||{},e.__tsParticlesInternals.canvas=e.__tsParticlesInternals.canvas||{},e.__tsParticlesInternals.canvas=e.__tsParticlesInternals.canvas||{},e.__tsParticlesInternals.canvas.utils=e.__tsParticlesInternals.canvas.utils||{},e.__tsParticlesInternals.path=e.__tsParticlesInternals.path||{},e.__tsParticlesInternals.path=e.__tsParticlesInternals.path||{},e.__tsParticlesInternals.path.utils=e.__tsParticlesInternals.path.utils||{};var t="undefined"!=typeof Proxy?function(e){return new Proxy(e,{get:function(e,t){return t in e||(e[t]={}),e[t]}})}:function(e){return e};e.__tsParticlesInternals.bundles=t(e.__tsParticlesInternals.bundles),e.__tsParticlesInternals.effects=t(e.__tsParticlesInternals.effects),e.__tsParticlesInternals.interactions=t(e.__tsParticlesInternals.interactions),e.__tsParticlesInternals.palettes=t(e.__tsParticlesInternals.palettes),e.__tsParticlesInternals.paths=t(e.__tsParticlesInternals.paths),e.__tsParticlesInternals.plugins=t(e.__tsParticlesInternals.plugins),e.__tsParticlesInternals.plugins.emittersShapes=t(e.__tsParticlesInternals.plugins.emittersShapes),e.__tsParticlesInternals.presets=t(e.__tsParticlesInternals.presets),e.__tsParticlesInternals.shapes=t(e.__tsParticlesInternals.shapes),e.__tsParticlesInternals.updaters=t(e.__tsParticlesInternals.updaters),e.__tsParticlesInternals.utils=t(e.__tsParticlesInternals.utils),e.__tsParticlesInternals.canvas=t(e.__tsParticlesInternals.canvas),e.__tsParticlesInternals.path=t(e.__tsParticlesInternals.path),e.tsparticlesInternalExports=e.tsparticlesInternalExports||{}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:this),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@tsparticles/engine")):"function"==typeof define&&define.amd?define(["exports","@tsparticles/engine"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).__tsParticlesInternals=e.__tsParticlesInternals||{},e.__tsParticlesInternals.shapes=e.__tsParticlesInternals.shapes||{},e.__tsParticlesInternals.shapes.image=e.__tsParticlesInternals.shapes.image||{}),e.__tsParticlesInternals.engine)}(this,function(e,t){"use strict";const a=["image","images"],n=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d.]+%?\))|currentcolor/gi;async function s(e){return new Promise(a=>{e.loading=!0;const n=new Image;e.element=n,n.addEventListener("load",()=>{e.loading=!1,a()}),n.addEventListener("error",()=>{e.element=void 0,e.error=!0,e.loading=!1,t.getLogger().error(`Error loading image: ${e.source}`),a()}),n.src=e.source})}async function i(e){if("svg"!==e.type)return void await s(e);e.loading=!0;const a=await fetch(e.source);a.ok?e.svgData=await a.text():(t.getLogger().error("Image not found"),e.error=!0),e.loading=!1}function r(e,a,i,r,o=!1){const l=function(e,a,s,i=!1){const{svgData:r}=e;if(!r)return"";const o=t.getStyleFromHsl(a,i,s);if(r.includes("fill"))return r.replaceAll(n,()=>o);const l=r.indexOf(">");return`${r.substring(0,l)} fill="${o}"${r.substring(l)}`}(e,i,r.opacity?.value??1,o),c={color:i,gif:a.gif,data:{...e,svgData:l},loaded:!1,ratio:a.width/a.height,replaceColor:a.replaceColor,source:a.src};return new Promise(t=>{const a=new Blob([l],{type:"image/svg+xml"}),n=URL.createObjectURL(a),i=new Image;i.addEventListener("load",()=>{c.loaded=!0,c.element=i,t(c),URL.revokeObjectURL(n)});i.addEventListener("error",()=>{(async()=>{URL.revokeObjectURL(n);const a={...e,error:!1,loading:!0};await s(a),c.loaded=!0,c.element=a.element,t(c)})()}),i.src=n})}const o=[0,4,2,1],l=[8,8,4,2];class c{data;pos;constructor(e){this.pos=0,this.data=new Uint8ClampedArray(e)}getString(e){const t=this.data.slice(this.pos,this.pos+e);return this.pos+=t.length,t.reduce((e,t)=>e+String.fromCharCode(t),"")}nextByte(){return this.data[this.pos++]}nextTwoBytes(){return this.pos+=2,this.data[this.pos-2]+(this.data[this.pos-1]<<8)}readSubBlocks(){let e,t="";do{e=this.data[this.pos++];for(let a=e;--a>=0;t+=String.fromCharCode(this.data[this.pos++]));}while(0!==e);return t}readSubBlocksBin(){let e=this.data[this.pos],t=0;for(let a=0;0!==e;a+=e+1,e=this.data[this.pos+a])t+=e;const a=new Uint8Array(t);e=this.data[this.pos++];for(let t=0;0!==e;e=this.data[this.pos++])for(let n=e;--n>=0;a[t++]=this.data[this.pos++]);return a}skipSubBlocks(){for(const e=1,t=0;this.data[this.pos]!==t;this.pos+=this.data[this.pos]+e);this.pos++}}var g,h;!function(e){e[e.Replace=0]="Replace",e[e.Combine=1]="Combine",e[e.RestoreBackground=2]="RestoreBackground",e[e.RestorePrevious=3]="RestorePrevious",e[e.UndefinedA=4]="UndefinedA",e[e.UndefinedB=5]="UndefinedB",e[e.UndefinedC=6]="UndefinedC",e[e.UndefinedD=7]="UndefinedD"}(g||(g={})),function(e){e[e.Extension=33]="Extension",e[e.ApplicationExtension=255]="ApplicationExtension",e[e.GraphicsControlExtension=249]="GraphicsControlExtension",e[e.PlainTextExtension=1]="PlainTextExtension",e[e.CommentExtension=254]="CommentExtension",e[e.Image=44]="Image",e[e.EndOfFile=59]="EndOfFile"}(h||(h={}));function d(e,t){const a=[];for(let n=0;n<t;n++)a.push({r:e.data[e.pos],g:e.data[e.pos+1],b:e.data[e.pos+2]}),e.pos+=3;return a}function p(e,t,a){const n=t>>>3,s=7&t;return(e[n]+(e[n+1]<<8)+(e[n+2]<<16)&(1<<a)-1<<s)>>>s}async function f(e,t,a,n,s,i,r){switch(e.nextByte()){case h.EndOfFile:return!0;case h.Image:await async function(e,t,a,n,s,i){const r=t.frames[n(!0)];r.left=e.nextTwoBytes(),r.top=e.nextTwoBytes(),r.width=e.nextTwoBytes(),r.height=e.nextTwoBytes();const c=e.nextByte(),g=!(128&~c),h=!(64&~c);r.sortFlag=!(32&~c),r.reserved=(24&c)>>>3;const f=1<<1+(7&c);g&&(r.localColorTable=d(e,f));const u=e=>{const{r:n,g:i,b:o}=(g?r.localColorTable:t.globalColorTable)[e];return e!==s(null)?{r:n,g:i,b:o,a:255}:{r:n,g:i,b:o,a:a?Math.trunc((n+i+o)/3):0}},m=(()=>{try{return new ImageData(r.width,r.height,i)}catch(e){if(e instanceof DOMException&&"IndexSizeError"===e.name)return null;throw e}})();if(null==m)throw new EvalError("GIF frame size is to large");const _=e.nextByte(),I=e.readSubBlocksBin(),w=1<<_;if(h){for(let e=0,t=_+1,a=0,n=[[0]],s=0;s<4;s++)if(o[s]<r.height){let i=0,c=0,g=!1;for(;!g;){const h=e;if(e=p(I,a,t),a+=t+1,e===w){t=_+1,n.length=w+2;for(let e=0;e<n.length;e++)n[e]=e<w?[e]:[]}else{e>=n.length?n.push(n[h].concat(n[h][0])):h!==w&&n.push(n[h].concat(n[e][0]));for(const t of n[e]){const{r:e,g:a,b:n,a:g}=u(t);m.data.set([e,a,n,g],o[s]*r.width+l[s]*c+i%(4*r.width)),i+=4}n.length===1<<t&&t<12&&t++}i===4*r.width*(c+1)&&(c++,o[s]+l[s]*c>=r.height&&(g=!0))}}r.image=m,r.bitmap=await createImageBitmap(m)}else{let e=0,t=_+1,a=0,n=-4;const s=[[0]];for(;;){const i=e;if(e=p(I,a,t),a+=t,e===w){t=_+1,s.length=w+2;for(let e=0;e<s.length;e++)s[e]=e<w?[e]:[]}else{if(e===w+1)break;e>=s.length?s.push(s[i].concat(s[i][0])):i!==w&&s.push(s[i].concat(s[e][0]));for(const t of s[e]){const{r:e,g:a,b:s,a:i}=u(t);n+=4,m.data.set([e,a,s,i],n)}s.length>=1<<t&&t<12&&t++}}r.image=m,r.bitmap=await createImageBitmap(m)}}(e,t,a,n,s,i);break;case h.Extension:!function(e,t,a,n){switch(e.nextByte()){case h.GraphicsControlExtension:{const s=t.frames[a(!1)];e.pos++;const i=e.nextByte();s.GCreserved=(224&i)>>>5,s.disposalMethod=(28&i)>>>2,s.userInputDelayFlag=!(2&~i);const r=!(1&~i);s.delayTime=10*e.nextTwoBytes();const o=e.nextByte();r&&n(o),e.pos++;break}case h.ApplicationExtension:{e.pos++;const a={identifier:e.getString(8),authenticationCode:e.getString(3),data:e.readSubBlocksBin()};t.applicationExtensions.push(a);break}case h.CommentExtension:t.comments.push([a(!1),e.readSubBlocks()]);break;case h.PlainTextExtension:if(0===t.globalColorTable.length)throw new EvalError("plain text extension without global color table");e.pos++,t.frames[a(!1)].plainTextData={left:e.nextTwoBytes(),top:e.nextTwoBytes(),width:e.nextTwoBytes(),height:e.nextTwoBytes(),charSize:{width:e.nextTwoBytes(),height:e.nextTwoBytes()},foregroundColor:e.nextByte(),backgroundColor:e.nextByte(),text:e.readSubBlocks()};break;default:e.skipSubBlocks()}}(e,t,n,s);break;default:throw new EvalError("undefined block found")}return!1}async function u(e,t){if("gif"===e.type){e.loading=!0;try{e.gifData=await async function(e,t,a,n){n??=!1;const s=await fetch(e);if(!s.ok&&404===s.status)throw new EvalError("file not found");const i=await s.arrayBuffer(),r={width:0,height:0,totalTime:0,colorRes:0,pixelAspectRatio:0,frames:[],sortFlag:!1,globalColorTable:[],backgroundImage:new ImageData(1,1,t),comments:[],applicationExtensions:[]},o=new c(new Uint8ClampedArray(i));if("GIF89a"!==o.getString(6))throw new Error("not a supported GIF file");r.width=o.nextTwoBytes(),r.height=o.nextTwoBytes();const l=o.nextByte(),h=!(128&~l);r.colorRes=(112&l)>>>4,r.sortFlag=!(8&~l);const p=1<<1+(7&l),u=o.nextByte();r.pixelAspectRatio=o.nextByte(),0!==r.pixelAspectRatio&&(r.pixelAspectRatio=(r.pixelAspectRatio+15)/64),h&&(r.globalColorTable=d(o,p));const m=(()=>{try{return new ImageData(r.width,r.height,t)}catch(e){if(e instanceof DOMException&&"IndexSizeError"===e.name)return null;throw e}})();if(null==m)throw new Error("GIF frame size is to large");const{r:_,g:I,b:w}=r.globalColorTable[u];m.data.set(h?[_,I,w,255]:[0,0,0,0]);for(let e=4;e<m.data.length;e*=2)m.data.copyWithin(e,0,e);r.backgroundImage=m;let P=-1,x=!0,y=-1;const b=e=>(e&&(x=!0),P),C=e=>(null!=e&&(y=e),y);try{do{x&&(r.frames.push({left:0,top:0,width:0,height:0,disposalMethod:g.Replace,image:new ImageData(1,1,t),plainTextData:null,userInputDelayFlag:!1,delayTime:0,sortFlag:!1,localColorTable:[],reserved:0,GCreserved:0}),P++,y=-1,x=!1)}while(!await f(o,r,n,b,C,t));r.frames.length--;for(const e of r.frames){if(e.userInputDelayFlag&&0===e.delayTime){r.totalTime=1/0;break}r.totalTime+=e.delayTime}return r}catch(e){if(e instanceof EvalError)throw new Error(`error while parsing frame ${P.toString()} "${e.message}"`,{cause:e});throw e}}(e.source,t),e.gifLoopCount=function(e){for(const t of e.applicationExtensions)if(t.identifier+t.authenticationCode==="NETSCAPE2.0")return t.data[1]+(t.data[2]<<8);return Number.NaN}(e.gifData),e.gifLoopCount||(e.gifLoopCount=1/0)}catch{e.error=!0}e.loading=!1}else await s(e)}class m{_container;_engine;constructor(e,t){this._engine=e,this._container=t}draw(e){const{context:a,radius:n,particle:s,opacity:i}=e,r=s.image,o=r?.element;if(r){if(a.globalAlpha=i,r.gif&&r.gifData)!function(e,a){const{context:n,radius:s,particle:i,delta:r}=e,o=i.image;if(!o?.gifData||!o.gif)return;const l=new OffscreenCanvas(o.gifData.width,o.gifData.height),c=l.getContext("2d",a);if(!c)throw new Error("could not create offscreen canvas context");c.imageSmoothingQuality="low",c.imageSmoothingEnabled=!1,c.clearRect(t.originPoint.x,t.originPoint.y,l.width,l.height),i.gifLoopCount??=o.gifLoopCount??0;let h=i.gifFrame??0;const d={x:-o.gifData.width*t.half,y:-o.gifData.height*t.half},p=o.gifData.frames[h];if(i.gifTime??=0,p.bitmap){switch(n.scale(s/o.gifData.width,s/o.gifData.height),p.disposalMethod){case g.UndefinedA:case g.UndefinedB:case g.UndefinedC:case g.UndefinedD:case g.Replace:c.drawImage(p.bitmap,p.left,p.top),n.drawImage(l,d.x,d.y),c.clearRect(t.originPoint.x,t.originPoint.y,l.width,l.height);break;case g.Combine:c.drawImage(p.bitmap,p.left,p.top),n.drawImage(l,d.x,d.y);break;case g.RestoreBackground:c.drawImage(p.bitmap,p.left,p.top),n.drawImage(l,d.x,d.y),c.clearRect(t.originPoint.x,t.originPoint.y,l.width,l.height),o.gifData.globalColorTable.length?c.putImageData(o.gifData.backgroundImage,d.x,d.y):c.putImageData(o.gifData.frames[0].image,d.x+p.left,d.y+p.top);break;case g.RestorePrevious:{const e=c.getImageData(t.originPoint.x,t.originPoint.y,l.width,l.height);c.drawImage(p.bitmap,p.left,p.top),n.drawImage(l,d.x,d.y),c.clearRect(t.originPoint.x,t.originPoint.y,l.width,l.height),c.putImageData(e,t.originPoint.x,t.originPoint.y)}}if(i.gifTime+=r.value,i.gifTime>p.delayTime){if(i.gifTime-=p.delayTime,++h>=o.gifData.frames.length){if(--i.gifLoopCount<=0)return;h=0,c.clearRect(t.originPoint.x,t.originPoint.y,l.width,l.height)}i.gifFrame=h}n.scale(o.gifData.width/s,o.gifData.height/s)}}(e,this._container.canvas.render.settings);else if(o){const e=r.ratio,s={x:-n,y:-n},i=n*t.double;a.drawImage(o,s.x,s.y,i,i/e)}a.globalAlpha=t.defaultAlpha}}getSidesCount(){return 12}async init(e){const t=e.actualOptions;if(!t.preload||!this._engine.loadImage)return;const a=[];for(const n of t.preload)a.push(this._engine.loadImage(e,n));await Promise.all(a)}loadShape(e){const{_container:t}=this;if(!e.shape||!a.includes(e.shape))return;const n=e.shapeData;if(!n)return;const s=this._engine.getImages?.(t),i=s?.find(e=>e.name===n.name||e.source===n.src);i||this.loadImageShape(t,n).then(()=>{this.loadShape(e)})}particleInit(e,a){if("image"!==a.shape&&"images"!==a.shape)return;const n=this._engine.getImages?.(e),s=a.shapeData;if(!s)return;const i=a.getFillColor(),o=n?.find(e=>e.name===s.name||e.source===s.src);if(!o)return;const l=s.replaceColor;o.loading?setTimeout(()=>{this.particleInit(e,a)}):(async()=>{let n;n=o.svgData&&i?await r(o,s,i,a,e.hdr):{color:i,data:o,element:o.element,gif:o.gif,gifData:o.gifData,gifLoopCount:o.gifLoopCount,loaded:!0,ratio:s.width&&s.height?s.width/s.height:o.ratio??t.defaultRatio,replaceColor:l,source:s.src},n.ratio||(n.ratio=1);const c={image:n,close:s.close??a.shapeClose};a.image=c.image,a.shapeClose=c.close})()}loadImageShape=async(e,t)=>{if(!this._engine.loadImage)throw new Error("Image shape not initialized");await this._engine.loadImage(e,{gif:t.gif,name:t.name,replaceColor:t.replaceColor,src:t.src})}}class _{gif;height;name;replaceColor;src;width;constructor(){this.src="",this.gif=!1}load(e){t.isNull(e)||(void 0!==e.gif&&(this.gif=e.gif),void 0!==e.height&&(this.height=e.height),void 0!==e.name&&(this.name=e.name),void 0!==e.replaceColor&&(this.replaceColor=e.replaceColor),void 0!==e.src&&(this.src=e.src),void 0!==e.width&&(this.width=e.width))}}class I{id="image-preloader";_engine;constructor(e){this._engine=e}async getPlugin(e){const{ImagePreloaderInstance:t}=await Promise.resolve().then(function(){return x});return new t(this._engine,e)}loadOptions(e,t,a){if(!a?.preload)return;t.preload??=[];const n=t.preload;for(const e of a.preload){const t=n.find(t=>t.name===e.name||t.src===e.src);if(t)t.load(e);else{const t=new _;t.load(e),n.push(t)}}}needsPlugin(){return!0}}async function w(e){e.checkVersion("4.0.2"),await e.pluginManager.register(e=>{!function(e){e.getImages??=t=>{e.images??=new Map;let a=e.images.get(t);return a||(a=[],e.images.set(t,a)),a},e.loadImage??=async(t,a)=>{if(!e.getImages)throw new Error("No images collection found");if(!a.name&&!a.src)throw new Error("No image source provided");e.images??=new Map;const n=e.getImages(t);if(!n.some(e=>e.name===a.name||e.source===a.src))try{const r={gif:a.gif,name:a.name??a.src,source:a.src,type:a.src.substring(a.src.length-3),error:!1,loading:!0,replaceColor:a.replaceColor,ratio:a.width&&a.height?a.width/a.height:void 0};let o;n.push(r),e.images.set(t,n),o=a.gif?e=>u(e,{colorSpace:"srgb"}):a.replaceColor?i:s,await o(r)}catch{throw new Error(`${a.name??a.src} not found`)}}}(e),e.pluginManager.addPlugin(new I(e)),e.pluginManager.addShape(a,t=>Promise.resolve(new m(e,t)))})}const P=globalThis;P.__tsParticlesInternals=P.__tsParticlesInternals??{},P.loadImageShape=w;var x=Object.freeze({__proto__:null,ImagePreloaderInstance:class{_container;_engine;constructor(e,t){this._engine=e,this._container=t}destroy(){this._engine.images?.delete(this._container)}}});e.loadImageShape=w}),Object.assign(globalThis.window||globalThis,{loadImageShape:(globalThis.__tsParticlesInternals.shapes.image||{}).loadImageShape}),delete(globalThis.window||globalThis).tsparticlesInternalExports;