@tsparticles/plugin-infection 3.9.1 → 4.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@
4
4
  * Demo / Generator : https://particles.js.org/
5
5
  * GitHub : https://www.github.com/matteobruni/tsparticles
6
6
  * How to use? : Check the GitHub README
7
- * v3.9.1
7
+ * v4.0.0-alpha.1
8
8
  */
9
9
  /*
10
10
  * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
@@ -28,85 +28,25 @@ return /******/ (() => { // webpackBootstrap
28
28
  /******/ "use strict";
29
29
  /******/ var __webpack_modules__ = ({
30
30
 
31
- /***/ "./dist/browser/Infecter.js":
32
- /*!**********************************!*\
33
- !*** ./dist/browser/Infecter.js ***!
34
- \**********************************/
35
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
36
-
37
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Infecter: () => (/* binding */ Infecter)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n\nconst minStage = 0,\n minDuration = 0;\nclass Infecter {\n constructor(container) {\n this._nextInfectionStage = particle => {\n const infectionOptions = this._container.actualOptions.infection,\n {\n infection\n } = particle;\n if (!infectionOptions || !infection) {\n return;\n }\n const stagesCount = infectionOptions.stages.length;\n if (stagesCount <= minStage || infection.stage === undefined) {\n return;\n }\n infection.time = 0;\n if (stagesCount <= ++infection.stage) {\n if (infectionOptions.cure) {\n delete infection.stage;\n delete infection.time;\n } else {\n infection.stage = 0;\n infection.time = 0;\n }\n }\n };\n this._container = container;\n }\n startInfection(particle, stage) {\n const infectionOptions = this._container.actualOptions.infection,\n {\n infection\n } = particle;\n if (!infectionOptions || !infection) {\n return;\n }\n const stages = infectionOptions.stages,\n stagesCount = stages.length;\n if (stage > stagesCount || stage < minStage) {\n return;\n }\n infection.delay = 0;\n infection.delayStage = stage;\n }\n updateInfection(particle, delta) {\n const infectionOptions = this._container.actualOptions.infection,\n {\n infection\n } = particle;\n if (!infectionOptions || !infection) {\n return;\n }\n const stages = infectionOptions.stages,\n stagesCount = stages.length;\n if (infection.delay !== undefined && infection.delayStage !== undefined) {\n const stage = infection.delayStage;\n if (stage > stagesCount || stage < minStage) {\n return;\n }\n if (infection.delay >= infectionOptions.delay * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.millisecondsToSeconds) {\n infection.stage = stage;\n infection.time = 0;\n delete infection.delay;\n delete infection.delayStage;\n } else {\n infection.delay += delta;\n }\n } else {\n delete infection.delay;\n delete infection.delayStage;\n }\n if (infection.stage !== undefined && infection.time !== undefined) {\n const infectionStage = stages[infection.stage];\n if (infectionStage.duration !== undefined && infectionStage.duration >= minDuration) {\n if (infection.time > infectionStage.duration * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.millisecondsToSeconds) {\n this._nextInfectionStage(particle);\n } else {\n infection.time += delta;\n }\n } else {\n infection.time += delta;\n }\n } else {\n delete infection.stage;\n delete infection.time;\n }\n }\n updateInfectionStage(particle, stage) {\n const options = this._container.actualOptions,\n {\n infection\n } = particle;\n if (!options.infection || !infection) {\n return;\n }\n const stagesCount = options.infection.stages.length;\n if (stage > stagesCount || stage < minStage || infection.stage !== undefined && infection.stage > stage) {\n return;\n }\n infection.stage = stage;\n infection.time = 0;\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-infection/./dist/browser/Infecter.js?\n}");
38
-
39
- /***/ }),
40
-
41
- /***/ "./dist/browser/InfectionInstance.js":
42
- /*!*******************************************!*\
43
- !*** ./dist/browser/InfectionInstance.js ***!
44
- \*******************************************/
45
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
46
-
47
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ InfectionInstance: () => (/* binding */ InfectionInstance)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _Infecter_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Infecter.js */ \"./dist/browser/Infecter.js\");\n\n\nconst minStage = 0;\nclass InfectionInstance {\n constructor(container) {\n this._container = container;\n this._container.infecter = new _Infecter_js__WEBPACK_IMPORTED_MODULE_1__.Infecter(this._container);\n }\n particleFillColor(particle) {\n const options = this._container.actualOptions;\n if (!particle.infection || !options.infection) {\n return;\n }\n const infectionStage = particle.infection.stage,\n infection = options.infection,\n infectionStages = infection.stages;\n return infectionStage !== undefined ? infectionStages[infectionStage].color : undefined;\n }\n particleStrokeColor(particle) {\n return this.particleFillColor(particle);\n }\n particlesSetup() {\n const options = this._container.actualOptions;\n if (!options.infection) {\n return;\n }\n for (let i = 0; i < options.infection.infections; i++) {\n const notInfected = this._container.particles.filter(p => {\n const infP = p;\n if (!infP.infection) {\n infP.infection = {};\n }\n return infP.infection.stage === undefined;\n });\n const infected = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.itemFromArray)(notInfected);\n this._container.infecter?.startInfection(infected, minStage);\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-infection/./dist/browser/InfectionInstance.js?\n}");
48
-
49
- /***/ }),
50
-
51
- /***/ "./dist/browser/InfectionPlugin.js":
52
- /*!*****************************************!*\
53
- !*** ./dist/browser/InfectionPlugin.js ***!
54
- \*****************************************/
55
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
56
-
57
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ InfectionPlugin: () => (/* binding */ InfectionPlugin)\n/* harmony export */ });\n/* harmony import */ var _Options_Classes_Infection_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Options/Classes/Infection.js */ \"./dist/browser/Options/Classes/Infection.js\");\n/* harmony import */ var _InfectionInstance_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./InfectionInstance.js */ \"./dist/browser/InfectionInstance.js\");\n\n\nclass InfectionPlugin {\n constructor() {\n this.id = \"infection\";\n }\n getPlugin(container) {\n return Promise.resolve(new _InfectionInstance_js__WEBPACK_IMPORTED_MODULE_1__.InfectionInstance(container));\n }\n loadOptions(options, source) {\n if (!this.needsPlugin(options) && !this.needsPlugin(source)) {\n return;\n }\n let infectionOptions = options.infection;\n if (infectionOptions?.load === undefined) {\n options.infection = infectionOptions = new _Options_Classes_Infection_js__WEBPACK_IMPORTED_MODULE_0__.Infection();\n }\n infectionOptions.load(source?.infection);\n }\n needsPlugin(options) {\n return options?.infection?.enable ?? false;\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-infection/./dist/browser/InfectionPlugin.js?\n}");
58
-
59
- /***/ }),
60
-
61
- /***/ "./dist/browser/Options/Classes/Infection.js":
62
- /*!***************************************************!*\
63
- !*** ./dist/browser/Options/Classes/Infection.js ***!
64
- \***************************************************/
65
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
66
-
67
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Infection: () => (/* binding */ Infection)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _InfectionStage_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./InfectionStage.js */ \"./dist/browser/Options/Classes/InfectionStage.js\");\n\n\nclass Infection {\n constructor() {\n this.cure = false;\n this.delay = 0;\n this.enable = false;\n this.infections = 0;\n this.stages = [];\n }\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(data)) {\n return;\n }\n if (data.cure !== undefined) {\n this.cure = data.cure;\n }\n if (data.delay !== undefined) {\n this.delay = data.delay;\n }\n if (data.enable !== undefined) {\n this.enable = data.enable;\n }\n if (data.infections !== undefined) {\n this.infections = data.infections;\n }\n if (data.stages === undefined) {\n return;\n }\n this.stages = data.stages.map(t => {\n const s = new _InfectionStage_js__WEBPACK_IMPORTED_MODULE_1__.InfectionStage();\n s.load(t);\n return s;\n });\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-infection/./dist/browser/Options/Classes/Infection.js?\n}");
68
-
69
- /***/ }),
70
-
71
- /***/ "./dist/browser/Options/Classes/InfectionStage.js":
72
- /*!********************************************************!*\
73
- !*** ./dist/browser/Options/Classes/InfectionStage.js ***!
74
- \********************************************************/
75
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
76
-
77
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ InfectionStage: () => (/* binding */ InfectionStage)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n\nclass InfectionStage {\n constructor() {\n this.color = new _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.OptionsColor();\n this.color.value = \"#ff0000\";\n this.radius = 0;\n this.rate = 1;\n }\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(data)) {\n return;\n }\n if (data.color !== undefined) {\n this.color = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.OptionsColor.create(this.color, data.color);\n }\n this.duration = data.duration;\n this.infectedStage = data.infectedStage;\n if (data.radius !== undefined) {\n this.radius = data.radius;\n }\n if (data.rate !== undefined) {\n this.rate = data.rate;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-infection/./dist/browser/Options/Classes/InfectionStage.js?\n}");
78
-
79
- /***/ }),
80
-
81
- /***/ "./dist/browser/ParticlesInfecter.js":
82
- /*!*******************************************!*\
83
- !*** ./dist/browser/ParticlesInfecter.js ***!
84
- \*******************************************/
85
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
86
-
87
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ParticlesInfecter: () => (/* binding */ ParticlesInfecter)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n\nconst minStagesCount = 1,\n double = 2;\nclass ParticlesInfecter extends _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.ParticlesInteractorBase {\n constructor(container) {\n super(container);\n }\n clear() {}\n init() {}\n interact(p1, delta) {\n const infecter = this.container.infecter;\n if (!infecter) {\n return;\n }\n infecter.updateInfection(p1, delta.value);\n if (p1.infection?.stage === undefined) {\n return;\n }\n const container = this.container,\n options = container.actualOptions,\n infectionOptions = options.infection;\n if (!infectionOptions?.enable || infectionOptions.stages.length < minStagesCount) {\n return;\n }\n const infectionStage1 = infectionOptions.stages[p1.infection.stage],\n pxRatio = container.retina.pixelRatio,\n radius = p1.getRadius() * double + infectionStage1.radius * pxRatio,\n pos = p1.getPosition(),\n infectedStage1 = infectionStage1.infectedStage ?? p1.infection.stage,\n query = container.particles.quadTree.queryCircle(pos, radius),\n infections = infectionStage1.rate,\n neighbors = query.length;\n for (const p2 of query) {\n const infP2 = p2;\n if (infP2 === p1 || infP2.destroyed || infP2.spawning || !(infP2.infection?.stage === undefined || infP2.infection.stage !== p1.infection.stage) || (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)() >= infections / neighbors) {\n continue;\n }\n if (infP2.infection?.stage === undefined) {\n infecter.startInfection(infP2, infectedStage1);\n } else if (infP2.infection.stage < p1.infection.stage) {\n infecter.updateInfectionStage(infP2, infectedStage1);\n } else if (infP2.infection.stage > p1.infection.stage) {\n const infectionStage2 = infectionOptions.stages[infP2.infection.stage];\n const infectedStage2 = infectionStage2?.infectedStage ?? infP2.infection.stage;\n infecter.updateInfectionStage(p1, infectedStage2);\n }\n }\n }\n isEnabled() {\n return this.container.actualOptions?.infection?.enable ?? false;\n }\n reset() {}\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-infection/./dist/browser/ParticlesInfecter.js?\n}");
88
-
89
- /***/ }),
90
-
91
- /***/ "./dist/browser/index.js":
31
+ /***/ "./dist/browser/index.js"
92
32
  /*!*******************************!*\
93
33
  !*** ./dist/browser/index.js ***!
94
34
  \*******************************/
95
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
35
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
96
36
 
97
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadInfectionPlugin: () => (/* binding */ loadInfectionPlugin)\n/* harmony export */ });\n/* harmony import */ var _InfectionPlugin_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./InfectionPlugin.js */ \"./dist/browser/InfectionPlugin.js\");\n/* harmony import */ var _ParticlesInfecter_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ParticlesInfecter.js */ \"./dist/browser/ParticlesInfecter.js\");\n\n\nasync function loadInfectionPlugin(engine, refresh = true) {\n engine.checkVersion(\"3.9.1\");\n const plugin = new _InfectionPlugin_js__WEBPACK_IMPORTED_MODULE_0__.InfectionPlugin();\n await engine.addPlugin(plugin, refresh);\n await engine.addInteractor(\"particlesInfection\", container => {\n return Promise.resolve(new _ParticlesInfecter_js__WEBPACK_IMPORTED_MODULE_1__.ParticlesInfecter(container));\n }, refresh);\n}\n\n\n\n//# sourceURL=webpack://@tsparticles/plugin-infection/./dist/browser/index.js?\n}");
37
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadInfectionPlugin: () => (/* binding */ loadInfectionPlugin)\n/* harmony export */ });\nfunction loadInfectionPlugin(engine) {\n engine.checkVersion(\"4.0.0-alpha.1\");\n engine.register(async e => {\n const {\n InfectionPlugin\n } = await __webpack_require__.e(/*! import() */ \"dist_browser_InfectionPlugin_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./InfectionPlugin.js */ \"./dist/browser/InfectionPlugin.js\"));\n e.addPlugin(new InfectionPlugin());\n e.addInteractor(\"particlesInfection\", async container => {\n const {\n ParticlesInfecter\n } = await __webpack_require__.e(/*! import() */ \"dist_browser_ParticlesInfecter_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./ParticlesInfecter.js */ \"./dist/browser/ParticlesInfecter.js\"));\n return new ParticlesInfecter(container);\n });\n });\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-infection/./dist/browser/index.js?\n}");
98
38
 
99
- /***/ }),
39
+ /***/ },
100
40
 
101
- /***/ "@tsparticles/engine":
41
+ /***/ "@tsparticles/engine"
102
42
  /*!*********************************************************************************************************************************!*\
103
43
  !*** external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"} ***!
104
44
  \*********************************************************************************************************************************/
105
- /***/ ((module) => {
45
+ (module) {
106
46
 
107
47
  module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
108
48
 
109
- /***/ })
49
+ /***/ }
110
50
 
111
51
  /******/ });
112
52
  /************************************************************************/
@@ -120,6 +60,12 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
120
60
  /******/ if (cachedModule !== undefined) {
121
61
  /******/ return cachedModule.exports;
122
62
  /******/ }
63
+ /******/ // Check if module exists (development only)
64
+ /******/ if (__webpack_modules__[moduleId] === undefined) {
65
+ /******/ var e = new Error("Cannot find module '" + moduleId + "'");
66
+ /******/ e.code = 'MODULE_NOT_FOUND';
67
+ /******/ throw e;
68
+ /******/ }
123
69
  /******/ // Create a new module (and put it into the cache)
124
70
  /******/ var module = __webpack_module_cache__[moduleId] = {
125
71
  /******/ // no module.id needed
@@ -134,19 +80,10 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
134
80
  /******/ return module.exports;
135
81
  /******/ }
136
82
  /******/
137
- /************************************************************************/
138
- /******/ /* webpack/runtime/compat get default export */
139
- /******/ (() => {
140
- /******/ // getDefaultExport function for compatibility with non-harmony modules
141
- /******/ __webpack_require__.n = (module) => {
142
- /******/ var getter = module && module.__esModule ?
143
- /******/ () => (module['default']) :
144
- /******/ () => (module);
145
- /******/ __webpack_require__.d(getter, { a: getter });
146
- /******/ return getter;
147
- /******/ };
148
- /******/ })();
83
+ /******/ // expose the modules object (__webpack_modules__)
84
+ /******/ __webpack_require__.m = __webpack_modules__;
149
85
  /******/
86
+ /************************************************************************/
150
87
  /******/ /* webpack/runtime/define property getters */
151
88
  /******/ (() => {
152
89
  /******/ // define getter functions for harmony exports
@@ -159,11 +96,90 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
159
96
  /******/ };
160
97
  /******/ })();
161
98
  /******/
99
+ /******/ /* webpack/runtime/ensure chunk */
100
+ /******/ (() => {
101
+ /******/ __webpack_require__.f = {};
102
+ /******/ // This file contains only the entry chunk.
103
+ /******/ // The chunk loading function for additional chunks
104
+ /******/ __webpack_require__.e = (chunkId) => {
105
+ /******/ return Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {
106
+ /******/ __webpack_require__.f[key](chunkId, promises);
107
+ /******/ return promises;
108
+ /******/ }, []));
109
+ /******/ };
110
+ /******/ })();
111
+ /******/
112
+ /******/ /* webpack/runtime/get javascript chunk filename */
113
+ /******/ (() => {
114
+ /******/ // This function allow to reference async chunks
115
+ /******/ __webpack_require__.u = (chunkId) => {
116
+ /******/ // return url for filenames based on template
117
+ /******/ return "" + chunkId + ".js";
118
+ /******/ };
119
+ /******/ })();
120
+ /******/
121
+ /******/ /* webpack/runtime/global */
122
+ /******/ (() => {
123
+ /******/ __webpack_require__.g = (function() {
124
+ /******/ if (typeof globalThis === 'object') return globalThis;
125
+ /******/ try {
126
+ /******/ return this || new Function('return this')();
127
+ /******/ } catch (e) {
128
+ /******/ if (typeof window === 'object') return window;
129
+ /******/ }
130
+ /******/ })();
131
+ /******/ })();
132
+ /******/
162
133
  /******/ /* webpack/runtime/hasOwnProperty shorthand */
163
134
  /******/ (() => {
164
135
  /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
165
136
  /******/ })();
166
137
  /******/
138
+ /******/ /* webpack/runtime/load script */
139
+ /******/ (() => {
140
+ /******/ var inProgress = {};
141
+ /******/ var dataWebpackPrefix = "@tsparticles/plugin-infection:";
142
+ /******/ // loadScript function to load a script via script tag
143
+ /******/ __webpack_require__.l = (url, done, key, chunkId) => {
144
+ /******/ if(inProgress[url]) { inProgress[url].push(done); return; }
145
+ /******/ var script, needAttach;
146
+ /******/ if(key !== undefined) {
147
+ /******/ var scripts = document.getElementsByTagName("script");
148
+ /******/ for(var i = 0; i < scripts.length; i++) {
149
+ /******/ var s = scripts[i];
150
+ /******/ if(s.getAttribute("src") == url || s.getAttribute("data-webpack") == dataWebpackPrefix + key) { script = s; break; }
151
+ /******/ }
152
+ /******/ }
153
+ /******/ if(!script) {
154
+ /******/ needAttach = true;
155
+ /******/ script = document.createElement('script');
156
+ /******/
157
+ /******/ script.charset = 'utf-8';
158
+ /******/ if (__webpack_require__.nc) {
159
+ /******/ script.setAttribute("nonce", __webpack_require__.nc);
160
+ /******/ }
161
+ /******/ script.setAttribute("data-webpack", dataWebpackPrefix + key);
162
+ /******/
163
+ /******/ script.src = url;
164
+ /******/ }
165
+ /******/ inProgress[url] = [done];
166
+ /******/ var onScriptComplete = (prev, event) => {
167
+ /******/ // avoid mem leaks in IE.
168
+ /******/ script.onerror = script.onload = null;
169
+ /******/ clearTimeout(timeout);
170
+ /******/ var doneFns = inProgress[url];
171
+ /******/ delete inProgress[url];
172
+ /******/ script.parentNode && script.parentNode.removeChild(script);
173
+ /******/ doneFns && doneFns.forEach((fn) => (fn(event)));
174
+ /******/ if(prev) return prev(event);
175
+ /******/ }
176
+ /******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
177
+ /******/ script.onerror = onScriptComplete.bind(null, script.onerror);
178
+ /******/ script.onload = onScriptComplete.bind(null, script.onload);
179
+ /******/ needAttach && document.head.appendChild(script);
180
+ /******/ };
181
+ /******/ })();
182
+ /******/
167
183
  /******/ /* webpack/runtime/make namespace object */
168
184
  /******/ (() => {
169
185
  /******/ // define __esModule on exports
@@ -175,6 +191,119 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
175
191
  /******/ };
176
192
  /******/ })();
177
193
  /******/
194
+ /******/ /* webpack/runtime/publicPath */
195
+ /******/ (() => {
196
+ /******/ var scriptUrl;
197
+ /******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
198
+ /******/ var document = __webpack_require__.g.document;
199
+ /******/ if (!scriptUrl && document) {
200
+ /******/ if (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT')
201
+ /******/ scriptUrl = document.currentScript.src;
202
+ /******/ if (!scriptUrl) {
203
+ /******/ var scripts = document.getElementsByTagName("script");
204
+ /******/ if(scripts.length) {
205
+ /******/ var i = scripts.length - 1;
206
+ /******/ while (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;
207
+ /******/ }
208
+ /******/ }
209
+ /******/ }
210
+ /******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
211
+ /******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
212
+ /******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
213
+ /******/ scriptUrl = scriptUrl.replace(/^blob:/, "").replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
214
+ /******/ __webpack_require__.p = scriptUrl;
215
+ /******/ })();
216
+ /******/
217
+ /******/ /* webpack/runtime/jsonp chunk loading */
218
+ /******/ (() => {
219
+ /******/ // no baseURI
220
+ /******/
221
+ /******/ // object to store loaded and loading chunks
222
+ /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
223
+ /******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
224
+ /******/ var installedChunks = {
225
+ /******/ "tsparticles.plugin.infection": 0
226
+ /******/ };
227
+ /******/
228
+ /******/ __webpack_require__.f.j = (chunkId, promises) => {
229
+ /******/ // JSONP chunk loading for javascript
230
+ /******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
231
+ /******/ if(installedChunkData !== 0) { // 0 means "already installed".
232
+ /******/
233
+ /******/ // a Promise means "currently loading".
234
+ /******/ if(installedChunkData) {
235
+ /******/ promises.push(installedChunkData[2]);
236
+ /******/ } else {
237
+ /******/ if(true) { // all chunks have JS
238
+ /******/ // setup Promise in chunk cache
239
+ /******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
240
+ /******/ promises.push(installedChunkData[2] = promise);
241
+ /******/
242
+ /******/ // start chunk loading
243
+ /******/ var url = __webpack_require__.p + __webpack_require__.u(chunkId);
244
+ /******/ // create error before stack unwound to get useful stacktrace later
245
+ /******/ var error = new Error();
246
+ /******/ var loadingEnded = (event) => {
247
+ /******/ if(__webpack_require__.o(installedChunks, chunkId)) {
248
+ /******/ installedChunkData = installedChunks[chunkId];
249
+ /******/ if(installedChunkData !== 0) installedChunks[chunkId] = undefined;
250
+ /******/ if(installedChunkData) {
251
+ /******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
252
+ /******/ var realSrc = event && event.target && event.target.src;
253
+ /******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
254
+ /******/ error.name = 'ChunkLoadError';
255
+ /******/ error.type = errorType;
256
+ /******/ error.request = realSrc;
257
+ /******/ installedChunkData[1](error);
258
+ /******/ }
259
+ /******/ }
260
+ /******/ };
261
+ /******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
262
+ /******/ }
263
+ /******/ }
264
+ /******/ }
265
+ /******/ };
266
+ /******/
267
+ /******/ // no prefetching
268
+ /******/
269
+ /******/ // no preloaded
270
+ /******/
271
+ /******/ // no HMR
272
+ /******/
273
+ /******/ // no HMR manifest
274
+ /******/
275
+ /******/ // no on chunks loaded
276
+ /******/
277
+ /******/ // install a JSONP callback for chunk loading
278
+ /******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
279
+ /******/ var [chunkIds, moreModules, runtime] = data;
280
+ /******/ // add "moreModules" to the modules object,
281
+ /******/ // then flag all "chunkIds" as loaded and fire callback
282
+ /******/ var moduleId, chunkId, i = 0;
283
+ /******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
284
+ /******/ for(moduleId in moreModules) {
285
+ /******/ if(__webpack_require__.o(moreModules, moduleId)) {
286
+ /******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
287
+ /******/ }
288
+ /******/ }
289
+ /******/ if(runtime) var result = runtime(__webpack_require__);
290
+ /******/ }
291
+ /******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
292
+ /******/ for(;i < chunkIds.length; i++) {
293
+ /******/ chunkId = chunkIds[i];
294
+ /******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
295
+ /******/ installedChunks[chunkId][0]();
296
+ /******/ }
297
+ /******/ installedChunks[chunkId] = 0;
298
+ /******/ }
299
+ /******/
300
+ /******/ }
301
+ /******/
302
+ /******/ var chunkLoadingGlobal = this["webpackChunk_tsparticles_plugin_infection"] = this["webpackChunk_tsparticles_plugin_infection"] || [];
303
+ /******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
304
+ /******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
305
+ /******/ })();
306
+ /******/
178
307
  /************************************************************************/
179
308
  /******/
180
309
  /******/ // startup
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see tsparticles.plugin.infection.min.js.LICENSE.txt */
2
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var i="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var n in i)("object"==typeof exports?exports:e)[n]=i[n]}}(this,(e=>(()=>{var t={303:t=>{t.exports=e}},i={};function n(e){var o=i[e];if(void 0!==o)return o.exports;var s=i[e]={exports:{}};return t[e](s,s.exports,n),s.exports}n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};n.r(o),n.d(o,{loadInfectionPlugin:()=>u});var s=n(303);class a{constructor(){this.color=new s.OptionsColor,this.color.value="#ff0000",this.radius=0,this.rate=1}load(e){(0,s.isNull)(e)||(void 0!==e.color&&(this.color=s.OptionsColor.create(this.color,e.color)),this.duration=e.duration,this.infectedStage=e.infectedStage,void 0!==e.radius&&(this.radius=e.radius),void 0!==e.rate&&(this.rate=e.rate))}}class r{constructor(){this.cure=!1,this.delay=0,this.enable=!1,this.infections=0,this.stages=[]}load(e){(0,s.isNull)(e)||(void 0!==e.cure&&(this.cure=e.cure),void 0!==e.delay&&(this.delay=e.delay),void 0!==e.enable&&(this.enable=e.enable),void 0!==e.infections&&(this.infections=e.infections),void 0!==e.stages&&(this.stages=e.stages.map((e=>{const t=new a;return t.load(e),t}))))}}class c{constructor(e){this._nextInfectionStage=e=>{const t=this._container.actualOptions.infection,{infection:i}=e;if(!t||!i)return;const n=t.stages.length;n<=0||void 0===i.stage||(i.time=0,n<=++i.stage&&(t.cure?(delete i.stage,delete i.time):(i.stage=0,i.time=0)))},this._container=e}startInfection(e,t){const i=this._container.actualOptions.infection,{infection:n}=e;if(!i||!n)return;t>i.stages.length||t<0||(n.delay=0,n.delayStage=t)}updateInfection(e,t){const i=this._container.actualOptions.infection,{infection:n}=e;if(!i||!n)return;const o=i.stages,a=o.length;if(void 0!==n.delay&&void 0!==n.delayStage){const e=n.delayStage;if(e>a||e<0)return;n.delay>=i.delay*s.millisecondsToSeconds?(n.stage=e,n.time=0,delete n.delay,delete n.delayStage):n.delay+=t}else delete n.delay,delete n.delayStage;if(void 0!==n.stage&&void 0!==n.time){const i=o[n.stage];void 0!==i.duration&&i.duration>=0&&n.time>i.duration*s.millisecondsToSeconds?this._nextInfectionStage(e):n.time+=t}else delete n.stage,delete n.time}updateInfectionStage(e,t){const i=this._container.actualOptions,{infection:n}=e;if(!i.infection||!n)return;t>i.infection.stages.length||t<0||void 0!==n.stage&&n.stage>t||(n.stage=t,n.time=0)}}class l{constructor(e){this._container=e,this._container.infecter=new c(this._container)}particleFillColor(e){const t=this._container.actualOptions;if(!e.infection||!t.infection)return;const i=e.infection.stage,n=t.infection.stages;return void 0!==i?n[i].color:void 0}particleStrokeColor(e){return this.particleFillColor(e)}particlesSetup(){const e=this._container.actualOptions;if(e.infection)for(let t=0;t<e.infection.infections;t++){const e=this._container.particles.filter((e=>{const t=e;return t.infection||(t.infection={}),void 0===t.infection.stage})),t=(0,s.itemFromArray)(e);this._container.infecter?.startInfection(t,0)}}}class d{constructor(){this.id="infection"}getPlugin(e){return Promise.resolve(new l(e))}loadOptions(e,t){if(!this.needsPlugin(e)&&!this.needsPlugin(t))return;let i=e.infection;void 0===i?.load&&(e.infection=i=new r),i.load(t?.infection)}needsPlugin(e){return e?.infection?.enable??!1}}class f extends s.ParticlesInteractorBase{constructor(e){super(e)}clear(){}init(){}interact(e,t){const i=this.container.infecter;if(!i)return;if(i.updateInfection(e,t.value),void 0===e.infection?.stage)return;const n=this.container,o=n.actualOptions.infection;if(!o?.enable||o.stages.length<1)return;const a=o.stages[e.infection.stage],r=n.retina.pixelRatio,c=2*e.getRadius()+a.radius*r,l=e.getPosition(),d=a.infectedStage??e.infection.stage,f=n.particles.quadTree.queryCircle(l,c),u=a.rate,g=f.length;for(const t of f){const n=t;if(!(n===e||n.destroyed||n.spawning||void 0!==n.infection?.stage&&n.infection.stage===e.infection.stage||(0,s.getRandom)()>=u/g))if(void 0===n.infection?.stage)i.startInfection(n,d);else if(n.infection.stage<e.infection.stage)i.updateInfectionStage(n,d);else if(n.infection.stage>e.infection.stage){const t=o.stages[n.infection.stage],s=t?.infectedStage??n.infection.stage;i.updateInfectionStage(e,s)}}}isEnabled(){return this.container.actualOptions?.infection?.enable??!1}reset(){}}async function u(e,t=!0){e.checkVersion("3.9.1");const i=new d;await e.addPlugin(i,t),await e.addInteractor("particlesInfection",(e=>Promise.resolve(new f(e))),t)}return o})()));
2
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var r="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(this,(e=>(()=>{var t,r,n={303(t){t.exports=e}},o={};function i(e){var t=o[e];if(void 0!==t)return t.exports;var r=o[e]={exports:{}};return n[e](r,r.exports,i),r.exports}i.m=n,i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.f={},i.e=e=>Promise.all(Object.keys(i.f).reduce(((t,r)=>(i.f[r](e,t),t)),[])),i.u=e=>e+".min.js",i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),t={},r="@tsparticles/plugin-infection:",i.l=(e,n,o,a)=>{if(t[e])t[e].push(n);else{var c,s;if(void 0!==o)for(var l=document.getElementsByTagName("script"),p=0;p<l.length;p++){var u=l[p];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==r+o){c=u;break}}c||(s=!0,(c=document.createElement("script")).charset="utf-8",i.nc&&c.setAttribute("nonce",i.nc),c.setAttribute("data-webpack",r+o),c.src=e),t[e]=[n];var d=(r,n)=>{c.onerror=c.onload=null,clearTimeout(f);var o=t[e];if(delete t[e],c.parentNode&&c.parentNode.removeChild(c),o&&o.forEach((e=>e(n))),r)return r(n)},f=setTimeout(d.bind(null,void 0,{type:"timeout",target:c}),12e4);c.onerror=d.bind(null,c.onerror),c.onload=d.bind(null,c.onload),s&&document.head.appendChild(c)}},i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;i.g.importScripts&&(e=i.g.location+"");var t=i.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var n=r.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=r[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i.p=e})(),(()=>{var e={587:0};i.f.j=(t,r)=>{var n=i.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[2]);else{var o=new Promise(((r,o)=>n=e[t]=[r,o]));r.push(n[2]=o);var a=i.p+i.u(t),c=new Error;i.l(a,(r=>{if(i.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var o=r&&("load"===r.type?"missing":r.type),a=r&&r.target&&r.target.src;c.message="Loading chunk "+t+" failed.\n("+o+": "+a+")",c.name="ChunkLoadError",c.type=o,c.request=a,n[1](c)}}),"chunk-"+t,t)}};var t=(t,r)=>{var n,o,[a,c,s]=r,l=0;if(a.some((t=>0!==e[t]))){for(n in c)i.o(c,n)&&(i.m[n]=c[n]);if(s)s(i)}for(t&&t(r);l<a.length;l++)o=a[l],i.o(e,o)&&e[o]&&e[o][0](),e[o]=0},r=this.webpackChunk_tsparticles_plugin_infection=this.webpackChunk_tsparticles_plugin_infection||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var a={};function c(e){e.checkVersion("4.0.0-alpha.1"),e.register((async e=>{const{InfectionPlugin:t}=await i.e(492).then(i.bind(i,492));e.addPlugin(new t),e.addInteractor("particlesInfection",(async e=>{const{ParticlesInfecter:t}=await i.e(796).then(i.bind(i,796));return new t(e)}))}))}return i.r(a),i.d(a,{loadInfectionPlugin:()=>c}),a})()));
@@ -1 +1 @@
1
- /*! tsParticles Infection Plugin v3.9.1 by Matteo Bruni */
1
+ /*! tsParticles Infection Plugin v4.0.0-alpha.1 by Matteo Bruni */
package/types/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import { type Engine } from "@tsparticles/engine";
2
- export declare function loadInfectionPlugin(engine: Engine, refresh?: boolean): Promise<void>;
3
- export * from "./Options/Interfaces/IInfection.js";
4
- export * from "./Options/Interfaces/IInfectionStage.js";
2
+ export declare function loadInfectionPlugin(engine: Engine): void;
3
+ export type * from "./Options/Interfaces/IInfection.js";
4
+ export type * from "./Options/Interfaces/IInfectionStage.js";
package/umd/Infecter.js CHANGED
@@ -76,7 +76,7 @@
76
76
  }
77
77
  if (infection.stage !== undefined && infection.time !== undefined) {
78
78
  const infectionStage = stages[infection.stage];
79
- if (infectionStage.duration !== undefined && infectionStage.duration >= minDuration) {
79
+ if (infectionStage?.duration !== undefined && infectionStage.duration >= minDuration) {
80
80
  if (infection.time > infectionStage.duration * engine_1.millisecondsToSeconds) {
81
81
  this._nextInfectionStage(particle);
82
82
  }
@@ -24,7 +24,7 @@
24
24
  return;
25
25
  }
26
26
  const infectionStage = particle.infection.stage, infection = options.infection, infectionStages = infection.stages;
27
- return infectionStage !== undefined ? infectionStages[infectionStage].color : undefined;
27
+ return infectionStage === undefined ? undefined : infectionStages[infectionStage]?.color;
28
28
  }
29
29
  particleStrokeColor(particle) {
30
30
  return this.particleFillColor(particle);
@@ -37,12 +37,13 @@
37
37
  for (let i = 0; i < options.infection.infections; i++) {
38
38
  const notInfected = this._container.particles.filter(p => {
39
39
  const infP = p;
40
- if (!infP.infection) {
41
- infP.infection = {};
42
- }
40
+ infP.infection ??= {};
43
41
  return infP.infection.stage === undefined;
44
42
  });
45
43
  const infected = (0, engine_1.itemFromArray)(notInfected);
44
+ if (!infected) {
45
+ continue;
46
+ }
46
47
  this._container.infecter?.startInfection(infected, minStage);
47
48
  }
48
49
  }
@@ -33,7 +33,11 @@
33
33
  if (!infectionOptions?.enable || infectionOptions.stages.length < minStagesCount) {
34
34
  return;
35
35
  }
36
- const infectionStage1 = infectionOptions.stages[p1.infection.stage], pxRatio = container.retina.pixelRatio, radius = p1.getRadius() * double + infectionStage1.radius * pxRatio, pos = p1.getPosition(), infectedStage1 = infectionStage1.infectedStage ?? p1.infection.stage, query = container.particles.quadTree.queryCircle(pos, radius), infections = infectionStage1.rate, neighbors = query.length;
36
+ const infectionStage1 = infectionOptions.stages[p1.infection.stage];
37
+ if (!infectionStage1) {
38
+ return;
39
+ }
40
+ const pxRatio = container.retina.pixelRatio, radius = p1.getRadius() * double + infectionStage1.radius * pxRatio, pos = p1.getPosition(), infectedStage1 = infectionStage1.infectedStage ?? p1.infection.stage, query = container.particles.quadTree.queryCircle(pos, radius), infections = infectionStage1.rate, neighbors = query.length;
37
41
  for (const p2 of query) {
38
42
  const infP2 = p2;
39
43
  if (infP2 === p1 ||
@@ -51,13 +55,16 @@
51
55
  }
52
56
  else if (infP2.infection.stage > p1.infection.stage) {
53
57
  const infectionStage2 = infectionOptions.stages[infP2.infection.stage];
54
- const infectedStage2 = infectionStage2?.infectedStage ?? infP2.infection.stage;
58
+ if (!infectionStage2) {
59
+ continue;
60
+ }
61
+ const infectedStage2 = infectionStage2.infectedStage ?? infP2.infection.stage;
55
62
  infecter.updateInfectionStage(p1, infectedStage2);
56
63
  }
57
64
  }
58
65
  }
59
66
  isEnabled() {
60
- return this.container.actualOptions?.infection?.enable ?? false;
67
+ return this.container.actualOptions.infection?.enable ?? false;
61
68
  }
62
69
  reset() {
63
70
  }
package/umd/index.js CHANGED
@@ -9,31 +9,50 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
9
9
  if (k2 === undefined) k2 = k;
10
10
  o[k2] = m[k];
11
11
  }));
12
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
13
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
14
- };
12
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
13
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
14
+ }) : function(o, v) {
15
+ o["default"] = v;
16
+ });
17
+ var __importStar = (this && this.__importStar) || (function () {
18
+ var ownKeys = function(o) {
19
+ ownKeys = Object.getOwnPropertyNames || function (o) {
20
+ var ar = [];
21
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
22
+ return ar;
23
+ };
24
+ return ownKeys(o);
25
+ };
26
+ return function (mod) {
27
+ if (mod && mod.__esModule) return mod;
28
+ var result = {};
29
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
30
+ __setModuleDefault(result, mod);
31
+ return result;
32
+ };
33
+ })();
15
34
  (function (factory) {
16
35
  if (typeof module === "object" && typeof module.exports === "object") {
17
36
  var v = factory(require, exports);
18
37
  if (v !== undefined) module.exports = v;
19
38
  }
20
39
  else if (typeof define === "function" && define.amd) {
21
- define(["require", "exports", "./InfectionPlugin.js", "./ParticlesInfecter.js", "./Options/Interfaces/IInfection.js", "./Options/Interfaces/IInfectionStage.js"], factory);
40
+ define(["require", "exports"], factory);
22
41
  }
23
42
  })(function (require, exports) {
24
43
  "use strict";
44
+ var __syncRequire = typeof module === "object" && typeof module.exports === "object";
25
45
  Object.defineProperty(exports, "__esModule", { value: true });
26
46
  exports.loadInfectionPlugin = loadInfectionPlugin;
27
- const InfectionPlugin_js_1 = require("./InfectionPlugin.js");
28
- const ParticlesInfecter_js_1 = require("./ParticlesInfecter.js");
29
- async function loadInfectionPlugin(engine, refresh = true) {
30
- engine.checkVersion("3.9.1");
31
- const plugin = new InfectionPlugin_js_1.InfectionPlugin();
32
- await engine.addPlugin(plugin, refresh);
33
- await engine.addInteractor("particlesInfection", container => {
34
- return Promise.resolve(new ParticlesInfecter_js_1.ParticlesInfecter(container));
35
- }, refresh);
47
+ function loadInfectionPlugin(engine) {
48
+ engine.checkVersion("4.0.0-alpha.1");
49
+ engine.register(async (e) => {
50
+ const { InfectionPlugin } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./InfectionPlugin.js"))) : new Promise((resolve_1, reject_1) => { require(["./InfectionPlugin.js"], resolve_1, reject_1); }).then(__importStar));
51
+ e.addPlugin(new InfectionPlugin());
52
+ e.addInteractor("particlesInfection", async (container) => {
53
+ const { ParticlesInfecter } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./ParticlesInfecter.js"))) : new Promise((resolve_2, reject_2) => { require(["./ParticlesInfecter.js"], resolve_2, reject_2); }).then(__importStar));
54
+ return new ParticlesInfecter(container);
55
+ });
56
+ });
36
57
  }
37
- __exportStar(require("./Options/Interfaces/IInfection.js"), exports);
38
- __exportStar(require("./Options/Interfaces/IInfectionStage.js"), exports);
39
58
  });