@tsparticles/plugin-sounds 3.3.0 → 3.5.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.
Files changed (43) hide show
  1. package/browser/Options/Classes/Sounds.js +1 -1
  2. package/browser/Options/Classes/SoundsEvent.js +3 -3
  3. package/browser/Options/Classes/SoundsMelody.js +2 -2
  4. package/browser/SoundsInstance.js +13 -12
  5. package/browser/SoundsPlugin.js +3 -3
  6. package/browser/enums.js +10 -1
  7. package/browser/index.js +1 -1
  8. package/cjs/Options/Classes/Sounds.js +1 -1
  9. package/cjs/Options/Classes/SoundsEvent.js +3 -3
  10. package/cjs/Options/Classes/SoundsMelody.js +2 -2
  11. package/cjs/SoundsInstance.js +13 -12
  12. package/cjs/SoundsPlugin.js +3 -3
  13. package/cjs/enums.js +11 -0
  14. package/cjs/index.js +3 -4
  15. package/cjs/utils.js +2 -2
  16. package/esm/Options/Classes/Sounds.js +1 -1
  17. package/esm/Options/Classes/SoundsEvent.js +3 -3
  18. package/esm/Options/Classes/SoundsMelody.js +2 -2
  19. package/esm/SoundsInstance.js +13 -12
  20. package/esm/SoundsPlugin.js +3 -3
  21. package/esm/enums.js +10 -1
  22. package/esm/index.js +1 -1
  23. package/package.json +2 -2
  24. package/report.html +1 -1
  25. package/tsparticles.plugin.sounds.js +122 -200
  26. package/tsparticles.plugin.sounds.min.js +1 -1
  27. package/tsparticles.plugin.sounds.min.js.LICENSE.txt +1 -1
  28. package/types/SoundsPlugin.d.ts +1 -1
  29. package/types/enums.d.ts +2 -2
  30. package/umd/Options/Classes/Sounds.js +1 -1
  31. package/umd/Options/Classes/SoundsEvent.js +3 -3
  32. package/umd/Options/Classes/SoundsMelody.js +2 -2
  33. package/umd/SoundsInstance.js +14 -13
  34. package/umd/SoundsPlugin.js +4 -28
  35. package/umd/enums.js +11 -0
  36. package/umd/index.js +4 -29
  37. package/umd/utils.js +2 -2
  38. package/826.min.js +0 -2
  39. package/826.min.js.LICENSE.txt +0 -1
  40. package/999.min.js +0 -2
  41. package/999.min.js.LICENSE.txt +0 -1
  42. package/dist_browser_SoundsInstance_js.js +0 -30
  43. package/dist_browser_SoundsPlugin_js.js +0 -120
@@ -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.3.0
7
+ * v3.5.0
8
8
  */
9
9
  /*
10
10
  * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
@@ -28,13 +28,133 @@ return /******/ (() => { // webpackBootstrap
28
28
  /******/ "use strict";
29
29
  /******/ var __webpack_modules__ = ({
30
30
 
31
+ /***/ "./dist/browser/Options/Classes/Sounds.js":
32
+ /*!************************************************!*\
33
+ !*** ./dist/browser/Options/Classes/Sounds.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 */ Sounds: () => (/* binding */ Sounds)\n/* harmony export */ });\n/* harmony import */ var _SoundsEvent_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SoundsEvent.js */ \"./dist/browser/Options/Classes/SoundsEvent.js\");\n/* harmony import */ var _SoundsIcons_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./SoundsIcons.js */ \"./dist/browser/Options/Classes/SoundsIcons.js\");\n/* harmony import */ var _SoundsVolume_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./SoundsVolume.js */ \"./dist/browser/Options/Classes/SoundsVolume.js\");\n\n\n\nclass Sounds {\n constructor() {\n this.autoPlay = true;\n this.enable = false;\n this.events = [];\n this.icons = new _SoundsIcons_js__WEBPACK_IMPORTED_MODULE_0__.SoundsIcons();\n this.volume = new _SoundsVolume_js__WEBPACK_IMPORTED_MODULE_1__.SoundsVolume();\n }\n load(data) {\n if (!data) {\n return;\n }\n if (data.autoPlay !== undefined) {\n this.autoPlay = data.autoPlay;\n }\n if (data.enable !== undefined) {\n this.enable = data.enable;\n }\n if (data.events !== undefined) {\n this.events = data.events.map(t => {\n const event = new _SoundsEvent_js__WEBPACK_IMPORTED_MODULE_2__.SoundsEvent();\n event.load(t);\n return event;\n });\n }\n this.icons.load(data.icons);\n if (data.volume !== undefined) {\n this.volume.load(data.volume);\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-sounds/./dist/browser/Options/Classes/Sounds.js?");
38
+
39
+ /***/ }),
40
+
41
+ /***/ "./dist/browser/Options/Classes/SoundsAudio.js":
42
+ /*!*****************************************************!*\
43
+ !*** ./dist/browser/Options/Classes/SoundsAudio.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 */ SoundsAudio: () => (/* binding */ SoundsAudio)\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 SoundsAudio {\n constructor() {\n this.loop = false;\n this.source = \"\";\n }\n load(data) {\n if (data === undefined) {\n return;\n }\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isObject)(data)) {\n if (data.loop !== undefined) {\n this.loop = data.loop;\n }\n if (data.source !== undefined) {\n this.source = data.source;\n }\n } else {\n this.source = data;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-sounds/./dist/browser/Options/Classes/SoundsAudio.js?");
48
+
49
+ /***/ }),
50
+
51
+ /***/ "./dist/browser/Options/Classes/SoundsEvent.js":
52
+ /*!*****************************************************!*\
53
+ !*** ./dist/browser/Options/Classes/SoundsEvent.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 */ SoundsEvent: () => (/* binding */ SoundsEvent)\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 _SoundsAudio_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./SoundsAudio.js */ \"./dist/browser/Options/Classes/SoundsAudio.js\");\n/* harmony import */ var _SoundsMelody_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./SoundsMelody.js */ \"./dist/browser/Options/Classes/SoundsMelody.js\");\n/* harmony import */ var _SoundsNote_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SoundsNote.js */ \"./dist/browser/Options/Classes/SoundsNote.js\");\n\n\n\n\nclass SoundsEvent {\n constructor() {\n this.event = [];\n this.notes = [];\n }\n load(data) {\n if (!data) {\n return;\n }\n if (data.event !== undefined) {\n this.event = data.event;\n }\n if (data.audio !== undefined) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isArray)(data.audio)) {\n this.audio = data.audio.map(s => {\n const tmp = new _SoundsAudio_js__WEBPACK_IMPORTED_MODULE_1__.SoundsAudio();\n tmp.load(s);\n return tmp;\n });\n } else {\n this.audio = new _SoundsAudio_js__WEBPACK_IMPORTED_MODULE_1__.SoundsAudio();\n this.audio.load(data.audio);\n }\n }\n if (data.notes !== undefined) {\n this.notes = data.notes.map(t => {\n const tmp = new _SoundsNote_js__WEBPACK_IMPORTED_MODULE_2__.SoundsNote();\n tmp.load(t);\n return tmp;\n });\n }\n if (data.melodies !== undefined) {\n this.melodies = data.melodies.map(t => {\n const tmp = new _SoundsMelody_js__WEBPACK_IMPORTED_MODULE_3__.SoundsMelody();\n tmp.load(t);\n return tmp;\n });\n }\n if (data.filter) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isString)(data.filter)) {\n const filterFunc = window[data.filter];\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isFunction)(filterFunc)) {\n this.filter = filterFunc;\n }\n } else {\n this.filter = data.filter;\n }\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-sounds/./dist/browser/Options/Classes/SoundsEvent.js?");
58
+
59
+ /***/ }),
60
+
61
+ /***/ "./dist/browser/Options/Classes/SoundsIcon.js":
62
+ /*!****************************************************!*\
63
+ !*** ./dist/browser/Options/Classes/SoundsIcon.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 */ SoundsIcon: () => (/* binding */ SoundsIcon)\n/* harmony export */ });\nclass SoundsIcon {\n constructor() {\n this.width = 24;\n this.height = 24;\n this.style = \"\";\n }\n load(data) {\n if (!data) {\n return;\n }\n if (data.path !== undefined) {\n this.path = data.path;\n }\n if (data.svg !== undefined) {\n this.svg = data.svg;\n }\n if (data.width !== undefined) {\n this.width = data.width;\n }\n if (data.height !== undefined) {\n this.height = data.height;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-sounds/./dist/browser/Options/Classes/SoundsIcon.js?");
68
+
69
+ /***/ }),
70
+
71
+ /***/ "./dist/browser/Options/Classes/SoundsIcons.js":
72
+ /*!*****************************************************!*\
73
+ !*** ./dist/browser/Options/Classes/SoundsIcons.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 */ SoundsIcons: () => (/* binding */ SoundsIcons)\n/* harmony export */ });\n/* harmony import */ var _SoundsIcon_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./SoundsIcon.js */ \"./dist/browser/Options/Classes/SoundsIcon.js\");\n\nclass SoundsIcons {\n constructor() {\n this.mute = new _SoundsIcon_js__WEBPACK_IMPORTED_MODULE_0__.SoundsIcon();\n this.unmute = new _SoundsIcon_js__WEBPACK_IMPORTED_MODULE_0__.SoundsIcon();\n this.volumeDown = new _SoundsIcon_js__WEBPACK_IMPORTED_MODULE_0__.SoundsIcon();\n this.volumeUp = new _SoundsIcon_js__WEBPACK_IMPORTED_MODULE_0__.SoundsIcon();\n this.enable = false;\n this.mute.svg = `<?xml version=\"1.0\"?>\n<svg baseProfile=\"tiny\" height=\"24px\" version=\"1.2\" viewBox=\"0 0 24 24\" width=\"24px\"\n xml:space=\"preserve\" xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n <g id=\"Layer_1\">\n <path fill=\"#fff\" d=\"M19.707,5.293c-0.391-0.391-1.023-0.391-1.414,0l-1.551,1.551c-0.345-0.688-0.987-1.02-1.604-1.02c-0.449,0-0.905,0.152-1.356,0.453l-2.672,1.781C10.357,8.561,8.904,9,8,9c-1.654,0-3,1.346-3,3v2c0,1.237,0.754,2.302,1.826,2.76l-1.533,1.533c-0.391,0.391-0.391,1.023,0,1.414C5.488,19.902,5.744,20,6,20s0.512-0.098,0.707-0.293l2.527-2.527c0.697,0.174,1.416,0.455,1.875,0.762l2.672,1.781c0.451,0.301,0.907,0.453,1.356,0.453C16.035,20.176,17,19.495,17,18V9.414l2.707-2.707C20.098,6.316,20.098,5.684,19.707,5.293z M14.891,7.941c0.038-0.025,0.073-0.046,0.104-0.062C14.998,7.914,15,7.954,15,8v1.293l-2,2V9.202L14.891,7.941z M7,12c0-0.552,0.448-1,1-1c1.211,0,2.907-0.495,4-1.146v2.439l-2.83,2.83C8.757,15.046,8.356,15,8,15c-0.552,0-1-0.448-1-1V12z M10.301,15.406L12,13.707v2.439C11.519,15.859,10.925,15.604,10.301,15.406z M14.994,18.12c-0.03-0.016-0.065-0.036-0.104-0.062L13,16.798v-4.091l2-2V18C15,18.046,14.998,18.086,14.994,18.12z\"/>\n </g>\n</svg>`;\n this.unmute.svg = `<?xml version=\"1.0\"?>\n<svg baseProfile=\"tiny\" height=\"24px\" version=\"1.2\" viewBox=\"0 0 24 24\" width=\"24px\"\n xml:space=\"preserve\" xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n <g id=\"Layer_1\">\n <path fill=\"#fff\" d=\"M17.138,5.824c-0.449,0-0.905,0.152-1.356,0.453l-2.672,1.781C12.357,8.561,10.904,9,10,9c-1.654,0-3,1.346-3,3v2c0,1.654,1.346,3,3,3c0.904,0,2.357,0.439,3.109,0.941l2.672,1.781c0.451,0.301,0.907,0.453,1.356,0.453C18.035,20.176,19,19.495,19,18V8C19,6.505,18.035,5.824,17.138,5.824z M14,16.146C12.907,15.495,11.211,15,10,15c-0.552,0-1-0.448-1-1v-2c0-0.552,0.448-1,1-1c1.211,0,2.907-0.495,4-1.146V16.146z M17,18c0,0.046-0.002,0.086-0.006,0.12c-0.03-0.016-0.065-0.036-0.104-0.062L15,16.798V9.202l1.891-1.261c0.038-0.025,0.073-0.046,0.104-0.062C16.998,7.914,17,7.954,17,8V18z\"/>\n </g>\n</svg>`;\n this.volumeDown.svg = `<?xml version=\"1.0\"?>\n<svg baseProfile=\"tiny\" height=\"24px\" version=\"1.2\" viewBox=\"0 0 24 24\" width=\"24px\"\n xml:space=\"preserve\" xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n <g id=\"Layer_1\">\n <path fill=\"#fff\" d=\"M15.138,5.824c-0.449,0-0.905,0.152-1.356,0.453l-2.672,1.781C10.357,8.561,8.904,9,8,9c-1.654,0-3,1.346-3,3v2c0,1.654,1.346,3,3,3c0.904,0,2.357,0.439,3.109,0.941l2.672,1.781c0.451,0.301,0.907,0.453,1.356,0.453C16.035,20.176,17,19.495,17,18V8C17,6.505,16.035,5.824,15.138,5.824z M8,15c-0.552,0-1-0.448-1-1v-2c0-0.552,0.448-1,1-1c1.211,0,2.907-0.495,4-1.146v6.293C10.907,15.495,9.211,15,8,15z M15,18c0,0.046-0.002,0.086-0.006,0.12c-0.03-0.016-0.065-0.036-0.104-0.062L13,16.798V9.202l1.891-1.261c0.038-0.025,0.073-0.046,0.104-0.062C14.998,7.914,15,7.954,15,8V18z\"/>\n <path fill=\"#fff\" d=\"M18.292,10.294c-0.39,0.391-0.39,1.023,0.002,1.414c0.345,0.345,0.535,0.803,0.535,1.291c0,0.489-0.19,0.948-0.536,1.294c-0.391,0.39-0.391,1.023,0,1.414C18.488,15.902,18.744,16,19,16s0.512-0.098,0.707-0.293c0.724-0.723,1.122-1.685,1.122-2.708s-0.398-1.984-1.123-2.707C19.317,9.903,18.683,9.901,18.292,10.294z\"/>\n </g>\n</svg>`;\n this.volumeUp.svg = `<?xml version=\"1.0\"?>\n<svg baseProfile=\"tiny\" height=\"24px\" version=\"1.2\" viewBox=\"0 0 24 24\" width=\"24px\"\n xml:space=\"preserve\" xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n <g id=\"Layer_1\">\n <path fill=\"#fff\" d=\"M16.706,10.292c-0.389-0.389-1.023-0.391-1.414,0.002c-0.39,0.391-0.39,1.023,0.002,1.414c0.345,0.345,0.535,0.803,0.535,1.291c0,0.489-0.19,0.948-0.536,1.294c-0.391,0.39-0.391,1.023,0,1.414C15.488,15.902,15.744,16,16,16s0.512-0.098,0.707-0.293c0.724-0.723,1.122-1.685,1.122-2.708S17.431,11.015,16.706,10.292z\"/>\n <path fill=\"#fff\" d=\"M18.706,8.292c-0.391-0.389-1.023-0.39-1.414,0.002c-0.39,0.391-0.39,1.024,0.002,1.414c0.879,0.877,1.363,2.044,1.364,3.287c0.001,1.246-0.484,2.417-1.365,3.298c-0.391,0.391-0.391,1.023,0,1.414C17.488,17.902,17.744,18,18,18s0.512-0.098,0.707-0.293c1.259-1.259,1.952-2.933,1.951-4.713C20.657,11.217,19.964,9.547,18.706,8.292z\"/>\n <path fill=\"#fff\" d=\"M20.706,6.292c-0.391-0.389-1.023-0.39-1.414,0.002c-0.39,0.391-0.39,1.024,0.002,1.414c1.412,1.409,2.191,3.285,2.192,5.284c0.002,2.002-0.777,3.885-2.193,5.301c-0.391,0.391-0.391,1.023,0,1.414C19.488,19.902,19.744,20,20,20s0.512-0.098,0.707-0.293c1.794-1.794,2.781-4.18,2.779-6.717C23.485,10.457,22.497,8.078,20.706,6.292z\"/>\n <path fill=\"#fff\" d=\"M12.138,5.824c-0.449,0-0.905,0.152-1.356,0.453L8.109,8.059C7.357,8.561,5.904,9,5,9c-1.654,0-3,1.346-3,3v2c0,1.654,1.346,3,3,3c0.904,0,2.357,0.439,3.109,0.941l2.672,1.781c0.451,0.301,0.907,0.453,1.356,0.453C13.035,20.176,14,19.495,14,18V8C14,6.505,13.035,5.824,12.138,5.824z M5,15c-0.552,0-1-0.448-1-1v-2c0-0.552,0.448-1,1-1c1.211,0,2.907-0.495,4-1.146v6.293C7.907,15.495,6.211,15,5,15z M12,18c0,0.046-0.002,0.086-0.006,0.12c-0.03-0.016-0.065-0.036-0.104-0.062L10,16.798V9.202l1.891-1.261c0.038-0.025,0.073-0.046,0.104-0.062C11.998,7.914,12,7.954,12,8V18z\"/>\n </g>\n</svg>`;\n }\n load(data) {\n if (!data) {\n return;\n }\n if (data.enable !== undefined) {\n this.enable = data.enable;\n }\n this.mute.load(data.mute);\n this.unmute.load(data.unmute);\n this.volumeDown.load(data.volumeDown);\n this.volumeUp.load(data.volumeUp);\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-sounds/./dist/browser/Options/Classes/SoundsIcons.js?");
78
+
79
+ /***/ }),
80
+
81
+ /***/ "./dist/browser/Options/Classes/SoundsMelody.js":
82
+ /*!******************************************************!*\
83
+ !*** ./dist/browser/Options/Classes/SoundsMelody.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 */ SoundsMelody: () => (/* binding */ SoundsMelody)\n/* harmony export */ });\n/* harmony import */ var _SoundsNote_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./SoundsNote.js */ \"./dist/browser/Options/Classes/SoundsNote.js\");\n\nclass SoundsMelody {\n constructor() {\n this.loop = false;\n this.melodies = [];\n this.notes = [];\n }\n load(data) {\n if (data === undefined) {\n return;\n }\n if (data.loop !== undefined) {\n this.loop = data.loop;\n }\n if (data.melodies !== undefined) {\n this.melodies = data.melodies.map(s => {\n const tmp = new SoundsMelody();\n tmp.load(s);\n return tmp;\n });\n }\n if (data.notes !== undefined) {\n this.notes = data.notes.map(s => {\n const tmp = new _SoundsNote_js__WEBPACK_IMPORTED_MODULE_0__.SoundsNote();\n tmp.load(s);\n return tmp;\n });\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-sounds/./dist/browser/Options/Classes/SoundsMelody.js?");
88
+
89
+ /***/ }),
90
+
91
+ /***/ "./dist/browser/Options/Classes/SoundsNote.js":
92
+ /*!****************************************************!*\
93
+ !*** ./dist/browser/Options/Classes/SoundsNote.js ***!
94
+ \****************************************************/
95
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
96
+
97
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ SoundsNote: () => (/* binding */ SoundsNote)\n/* harmony export */ });\nclass SoundsNote {\n constructor() {\n this.duration = 500;\n this.value = [];\n }\n load(data) {\n if (!data) {\n return;\n }\n if (data.duration !== undefined) {\n this.duration = data.duration;\n }\n if (data.value !== undefined) {\n this.value = data.value;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-sounds/./dist/browser/Options/Classes/SoundsNote.js?");
98
+
99
+ /***/ }),
100
+
101
+ /***/ "./dist/browser/Options/Classes/SoundsVolume.js":
102
+ /*!******************************************************!*\
103
+ !*** ./dist/browser/Options/Classes/SoundsVolume.js ***!
104
+ \******************************************************/
105
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
106
+
107
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ SoundsVolume: () => (/* binding */ SoundsVolume)\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 SoundsVolume {\n constructor() {\n this.value = 100;\n this.max = 100;\n this.min = 0;\n this.step = 10;\n }\n load(data) {\n if (data === undefined) {\n return;\n }\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isObject)(data)) {\n if (data.max !== undefined) {\n this.max = data.max;\n }\n if (data.min !== undefined) {\n this.min = data.min;\n }\n if (data.step !== undefined) {\n this.step = data.step;\n }\n if (data.value !== undefined) {\n this.value = data.value;\n }\n } else {\n this.value = data;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-sounds/./dist/browser/Options/Classes/SoundsVolume.js?");
108
+
109
+ /***/ }),
110
+
111
+ /***/ "./dist/browser/SoundsInstance.js":
112
+ /*!****************************************!*\
113
+ !*** ./dist/browser/SoundsInstance.js ***!
114
+ \****************************************/
115
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
116
+
117
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ SoundsInstance: () => (/* binding */ SoundsInstance)\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 _enums_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./enums.js */ \"./dist/browser/enums.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils.js */ \"./dist/browser/utils.js\");\n\n\n\nconst zIndexOffset = 1,\n rightOffset = 1,\n minVolume = 0;\nfunction initImage(data) {\n const img = document.createElement(\"img\"),\n {\n clickCb,\n container,\n display,\n iconOptions,\n margin,\n options,\n pos,\n rightOffsets\n } = data,\n {\n width,\n path,\n style,\n svg\n } = iconOptions,\n defaultAccumulator = 0;\n setIconStyle(img, pos.top + margin, pos.right - (margin * (rightOffsets.length + rightOffset) + width + rightOffsets.reduce((a, b) => a + b, defaultAccumulator)), display, options.fullScreen.zIndex + zIndexOffset, width, margin, style);\n img.src = path ?? (svg ? `data:image/svg+xml;base64,${btoa(svg)}` : \"\");\n const parent = container.canvas.element?.parentNode ?? document.body;\n parent.append(img);\n img.addEventListener(\"click\", () => {\n void clickCb();\n });\n return img;\n}\nfunction removeImage(image) {\n if (!image) {\n return;\n }\n image.remove();\n}\nfunction setIconStyle(icon, top, left, display, zIndex, width, margin, style) {\n icon.style.userSelect = \"none\";\n icon.style.webkitUserSelect = \"none\";\n icon.style.position = \"absolute\";\n icon.style.top = `${top + margin}px`;\n icon.style.left = `${left - margin - width}px`;\n icon.style.display = display;\n icon.style.zIndex = `${zIndex + zIndexOffset}`;\n icon.style.cssText += style;\n}\nclass SoundsInstance {\n constructor(container, engine) {\n this._addBuffer = audioCtx => {\n const buffer = audioCtx.createBufferSource();\n this._audioSources.push(buffer);\n return buffer;\n };\n this._addOscillator = audioCtx => {\n const oscillator = audioCtx.createOscillator();\n this._audioSources.push(oscillator);\n return oscillator;\n };\n this._initEvents = () => {\n const container = this._container,\n soundsOptions = container.actualOptions.sounds;\n if (!soundsOptions?.enable || !container.canvas.element) {\n return;\n }\n for (const event of soundsOptions.events) {\n const cb = args => {\n void (async () => {\n const filterNotValid = event.filter && !event.filter(args);\n if (this._container !== args.container) {\n return;\n }\n if (!this._container || !!this._container.muted || this._container.destroyed) {\n (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.executeOnSingleOrMultiple)(event.event, item => {\n this._engine.removeEventListener(item, cb);\n });\n return;\n }\n if (filterNotValid) {\n return;\n }\n const defaultNoteIndex = 0;\n if (event.audio) {\n this._playBuffer((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.itemFromSingleOrMultiple)(event.audio));\n } else if (event.melodies) {\n const melody = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.itemFromArray)(event.melodies);\n if (melody.melodies.length) {\n await Promise.allSettled(melody.melodies.map(m => this._playNote(m.notes, defaultNoteIndex, melody.loop)));\n } else {\n await this._playNote(melody.notes, defaultNoteIndex, melody.loop);\n }\n } else if (event.notes) {\n const note = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.itemFromArray)(event.notes);\n await this._playNote([note], defaultNoteIndex, false);\n }\n })();\n };\n (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.executeOnSingleOrMultiple)(event.event, item => {\n this._engine.addEventListener(item, cb);\n });\n }\n };\n this._mute = async () => {\n const container = this._container,\n audioContext = this._getAudioContext();\n for (const source of this._audioSources) {\n this._removeAudioSource(source);\n }\n if (this._gain) {\n this._gain.disconnect();\n }\n await audioContext.close();\n container.audioContext = undefined;\n this._engine.dispatchEvent(_enums_js__WEBPACK_IMPORTED_MODULE_1__.SoundsEventType.mute, {\n container: this._container\n });\n };\n this._playBuffer = audio => {\n const audioBuffer = this._audioMap.get(audio.source);\n if (!audioBuffer) {\n return;\n }\n const audioCtx = this._container.audioContext;\n if (!audioCtx) {\n return;\n }\n const source = this._addBuffer(audioCtx);\n source.loop = audio.loop;\n source.buffer = audioBuffer;\n source.connect(this._gain ?? audioCtx.destination);\n source.start();\n };\n this._playFrequency = async (frequency, duration) => {\n if (!this._gain || this._container.muted) {\n return;\n }\n const audioContext = this._getAudioContext(),\n oscillator = this._addOscillator(audioContext);\n oscillator.connect(this._gain);\n oscillator.type = \"sine\";\n oscillator.frequency.value = frequency;\n oscillator.start();\n return new Promise(resolve => {\n setTimeout(() => {\n this._removeAudioSource(oscillator);\n resolve();\n }, duration);\n });\n };\n this._playMuteSound = () => {\n if (this._container.muted) {\n return;\n }\n const audioContext = this._getAudioContext(),\n gain = audioContext.createGain();\n gain.connect(audioContext.destination);\n gain.gain.value = 0;\n const oscillator = audioContext.createOscillator();\n oscillator.connect(gain);\n oscillator.type = \"sine\";\n oscillator.frequency.value = 1;\n oscillator.start();\n setTimeout(() => {\n oscillator.stop();\n oscillator.disconnect();\n gain.disconnect();\n });\n };\n this._playNote = async (notes, noteIdx, loop) => {\n if (this._container.muted) {\n return;\n }\n const note = notes[noteIdx];\n if (!note) {\n return;\n }\n const value = note.value;\n const promises = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.executeOnSingleOrMultiple)(value, async (_, idx) => {\n return this._playNoteValue(notes, noteIdx, idx);\n });\n await ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isArray)(promises) ? Promise.allSettled(promises) : promises);\n const indexOffset = 1;\n let nextNoteIdx = noteIdx + indexOffset;\n if (loop && nextNoteIdx >= notes.length) {\n nextNoteIdx = nextNoteIdx % notes.length;\n }\n if (this._container.muted) {\n return;\n }\n await this._playNote(notes, nextNoteIdx, loop);\n };\n this._playNoteValue = async (notes, noteIdx, valueIdx) => {\n const note = notes[noteIdx];\n if (!note) {\n return;\n }\n const value = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.itemFromSingleOrMultiple)(note.value, valueIdx, true);\n try {\n const freq = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.getNoteFrequency)(value);\n if (!(0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNumber)(freq)) {\n return;\n }\n await this._playFrequency(freq, note.duration);\n } catch (e) {\n (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getLogger)().error(e);\n }\n };\n this._removeAudioSource = source => {\n source.stop();\n source.disconnect();\n const deleteCount = 1;\n this._audioSources.splice(this._audioSources.indexOf(source), deleteCount);\n };\n this._unmute = () => {\n const container = this._container,\n options = container.actualOptions,\n soundsOptions = options.sounds;\n if (!soundsOptions) {\n return;\n }\n const audioContext = this._getAudioContext();\n if (!this._audioSources) {\n this._audioSources = [];\n }\n const gain = audioContext.createGain();\n gain.connect(audioContext.destination);\n gain.gain.value = soundsOptions.volume.value / _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.percentDenominator;\n this._gain = gain;\n this._initEvents();\n this._engine.dispatchEvent(_enums_js__WEBPACK_IMPORTED_MODULE_1__.SoundsEventType.unmute, {\n container: this._container\n });\n };\n this._updateMuteIcons = () => {\n const container = this._container,\n soundsOptions = container.actualOptions.sounds;\n if (!soundsOptions?.enable || !soundsOptions.icons.enable) {\n return;\n }\n const muteImg = this._muteImg,\n unmuteImg = this._unmuteImg;\n if (muteImg) {\n muteImg.style.display = container.muted ? \"block\" : \"none\";\n }\n if (unmuteImg) {\n unmuteImg.style.display = container.muted ? \"none\" : \"block\";\n }\n };\n this._updateMuteStatus = async () => {\n const container = this._container,\n audioContext = this._getAudioContext();\n if (container.muted) {\n await audioContext?.suspend();\n await this._mute();\n } else {\n await audioContext?.resume();\n this._unmute();\n this._playMuteSound();\n }\n };\n this._updateVolume = async () => {\n const container = this._container,\n soundsOptions = container.actualOptions.sounds;\n if (!soundsOptions?.enable) {\n return;\n }\n (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.clamp)(this._volume, soundsOptions.volume.min, soundsOptions.volume.max);\n let stateChanged = false;\n if (this._volume <= minVolume && !container.muted) {\n this._volume = 0;\n container.muted = true;\n stateChanged = true;\n } else if (this._volume > minVolume && container.muted) {\n container.muted = false;\n stateChanged = true;\n }\n if (stateChanged) {\n this._updateMuteIcons();\n await this._updateMuteStatus();\n }\n if (this._gain?.gain) {\n this._gain.gain.value = this._volume / _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.percentDenominator;\n }\n };\n this._container = container;\n this._engine = engine;\n this._volume = 0;\n this._audioSources = [];\n this._audioMap = new Map();\n }\n async init() {\n const container = this._container,\n options = container.actualOptions,\n soundsOptions = options.sounds;\n if (!soundsOptions?.enable) {\n return;\n }\n if (soundsOptions.autoPlay && (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.isWindowMuted)()) {\n const firstClickHandler = () => {\n removeEventListener(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.mouseDownEvent, firstClickHandler);\n removeEventListener(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.touchStartEvent, firstClickHandler);\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.unmuteWindow)();\n void this.unmute();\n };\n const listenerOptions = {\n capture: true,\n once: true\n };\n addEventListener(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.mouseDownEvent, firstClickHandler, listenerOptions);\n addEventListener(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.touchStartEvent, firstClickHandler, listenerOptions);\n }\n this._volume = soundsOptions.volume.value;\n const events = soundsOptions.events;\n this._audioMap = new Map();\n for (const event of events) {\n if (!event.audio) {\n continue;\n }\n const promises = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.executeOnSingleOrMultiple)(event.audio, async audio => {\n const response = await fetch(audio.source);\n if (!response.ok) {\n return;\n }\n const arrayBuffer = await response.arrayBuffer(),\n audioContext = this._getAudioContext(),\n audioBuffer = await audioContext.decodeAudioData(arrayBuffer);\n this._audioMap.set(audio.source, audioBuffer);\n });\n if (promises instanceof Promise) {\n await promises;\n } else {\n await Promise.allSettled(promises);\n }\n }\n }\n async mute() {\n if (!this._container.muted) {\n await this.toggleMute();\n }\n }\n async start() {\n const container = this._container,\n options = container.actualOptions,\n soundsOptions = options.sounds;\n if (!soundsOptions?.enable || !container.canvas.element) {\n return;\n }\n container.muted = true;\n const canvas = container.canvas.element,\n pos = {\n top: canvas.offsetTop,\n right: canvas.offsetLeft + canvas.offsetWidth\n },\n {\n mute,\n unmute,\n volumeDown,\n volumeUp\n } = soundsOptions.icons,\n margin = 10,\n toggleMute = async () => {\n await this.toggleMute();\n },\n enableIcons = soundsOptions.icons.enable,\n display = enableIcons ? _enums_js__WEBPACK_IMPORTED_MODULE_1__.ImageDisplay.Block : _enums_js__WEBPACK_IMPORTED_MODULE_1__.ImageDisplay.None;\n this._muteImg = initImage({\n container,\n options,\n pos,\n display,\n iconOptions: mute,\n margin,\n rightOffsets: [volumeDown.width, volumeUp.width],\n clickCb: toggleMute\n });\n this._unmuteImg = initImage({\n container,\n options,\n pos,\n display: _enums_js__WEBPACK_IMPORTED_MODULE_1__.ImageDisplay.None,\n iconOptions: unmute,\n margin,\n rightOffsets: [volumeDown.width, volumeUp.width],\n clickCb: toggleMute\n });\n this._volumeDownImg = initImage({\n container,\n options,\n pos,\n display,\n iconOptions: volumeDown,\n margin,\n rightOffsets: [volumeUp.width],\n clickCb: async () => {\n await this.volumeDown();\n }\n });\n this._volumeUpImg = initImage({\n container,\n options,\n pos,\n display,\n iconOptions: volumeUp,\n margin,\n rightOffsets: [],\n clickCb: async () => {\n await this.volumeUp();\n }\n });\n if (!(0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.isWindowMuted)() && soundsOptions.autoPlay) {\n await this.unmute();\n }\n }\n stop() {\n this._container.muted = true;\n void (async () => {\n await this._mute();\n removeImage(this._muteImg);\n removeImage(this._unmuteImg);\n removeImage(this._volumeDownImg);\n removeImage(this._volumeUpImg);\n })();\n }\n async toggleMute() {\n const container = this._container;\n container.muted = !container.muted;\n this._updateMuteIcons();\n await this._updateMuteStatus();\n }\n async unmute() {\n if (this._container.muted) {\n await this.toggleMute();\n }\n }\n async volumeDown() {\n const container = this._container,\n soundsOptions = container.actualOptions.sounds;\n if (!soundsOptions?.enable) {\n return;\n }\n if (container.muted) {\n this._volume = 0;\n }\n this._volume -= soundsOptions.volume.step;\n await this._updateVolume();\n }\n async volumeUp() {\n const container = this._container,\n soundsOptions = container.actualOptions.sounds;\n if (!soundsOptions?.enable) {\n return;\n }\n this._volume += soundsOptions.volume.step;\n await this._updateVolume();\n }\n _getAudioContext() {\n const container = this._container;\n if (!container.audioContext) {\n container.audioContext = new AudioContext();\n }\n return container.audioContext;\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-sounds/./dist/browser/SoundsInstance.js?");
118
+
119
+ /***/ }),
120
+
121
+ /***/ "./dist/browser/SoundsPlugin.js":
122
+ /*!**************************************!*\
123
+ !*** ./dist/browser/SoundsPlugin.js ***!
124
+ \**************************************/
125
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
126
+
127
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ SoundsPlugin: () => (/* binding */ SoundsPlugin)\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 _Options_Classes_Sounds_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Options/Classes/Sounds.js */ \"./dist/browser/Options/Classes/Sounds.js\");\n/* harmony import */ var _SoundsInstance_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SoundsInstance.js */ \"./dist/browser/SoundsInstance.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.js */ \"./dist/browser/utils.js\");\n\n\n\n\nconst generalFirstClickHandler = () => {\n removeEventListener(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.mouseDownEvent, generalFirstClickHandler);\n removeEventListener(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.touchStartEvent, generalFirstClickHandler);\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.unmuteWindow)();\n};\nclass SoundsPlugin {\n constructor(engine) {\n this.id = \"sounds\";\n this._engine = engine;\n const listenerOptions = {\n capture: true,\n once: true\n };\n addEventListener(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.mouseDownEvent, generalFirstClickHandler, listenerOptions);\n addEventListener(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.touchStartEvent, generalFirstClickHandler, listenerOptions);\n }\n getPlugin(container) {\n return Promise.resolve(new _SoundsInstance_js__WEBPACK_IMPORTED_MODULE_2__.SoundsInstance(container, this._engine));\n }\n loadOptions(options, source) {\n if (!this.needsPlugin(options) && !this.needsPlugin(source)) {\n return;\n }\n let soundsOptions = options.sounds;\n if (soundsOptions?.load === undefined) {\n options.sounds = soundsOptions = new _Options_Classes_Sounds_js__WEBPACK_IMPORTED_MODULE_3__.Sounds();\n }\n soundsOptions.load(source?.sounds);\n }\n needsPlugin(options) {\n return options?.sounds?.enable ?? false;\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-sounds/./dist/browser/SoundsPlugin.js?");
128
+
129
+ /***/ }),
130
+
131
+ /***/ "./dist/browser/enums.js":
132
+ /*!*******************************!*\
133
+ !*** ./dist/browser/enums.js ***!
134
+ \*******************************/
135
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
136
+
137
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ImageDisplay: () => (/* binding */ ImageDisplay),\n/* harmony export */ SoundsEventType: () => (/* binding */ SoundsEventType)\n/* harmony export */ });\nvar SoundsEventType;\n(function (SoundsEventType) {\n SoundsEventType[\"mute\"] = \"soundsMuted\";\n SoundsEventType[\"unmute\"] = \"soundsUnmuted\";\n})(SoundsEventType || (SoundsEventType = {}));\nvar ImageDisplay;\n(function (ImageDisplay) {\n ImageDisplay[\"Block\"] = \"block\";\n ImageDisplay[\"None\"] = \"none\";\n})(ImageDisplay || (ImageDisplay = {}));\n\n//# sourceURL=webpack://@tsparticles/plugin-sounds/./dist/browser/enums.js?");
138
+
139
+ /***/ }),
140
+
31
141
  /***/ "./dist/browser/index.js":
32
142
  /*!*******************************!*\
33
143
  !*** ./dist/browser/index.js ***!
34
144
  \*******************************/
35
145
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
36
146
 
37
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadSoundsPlugin: () => (/* binding */ loadSoundsPlugin)\n/* harmony export */ });\nasync function loadSoundsPlugin(engine, refresh = true) {\n const {\n SoundsPlugin\n } = await __webpack_require__.e(/*! import() */ \"dist_browser_SoundsPlugin_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./SoundsPlugin.js */ \"./dist/browser/SoundsPlugin.js\"));\n await engine.addPlugin(new SoundsPlugin(engine), refresh);\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-sounds/./dist/browser/index.js?");
147
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadSoundsPlugin: () => (/* binding */ loadSoundsPlugin)\n/* harmony export */ });\n/* harmony import */ var _SoundsPlugin_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./SoundsPlugin.js */ \"./dist/browser/SoundsPlugin.js\");\n\nasync function loadSoundsPlugin(engine, refresh = true) {\n await engine.addPlugin(new _SoundsPlugin_js__WEBPACK_IMPORTED_MODULE_0__.SoundsPlugin(engine), refresh);\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-sounds/./dist/browser/index.js?");
148
+
149
+ /***/ }),
150
+
151
+ /***/ "./dist/browser/utils.js":
152
+ /*!*******************************!*\
153
+ !*** ./dist/browser/utils.js ***!
154
+ \*******************************/
155
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
156
+
157
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getNoteFrequency: () => (/* binding */ getNoteFrequency),\n/* harmony export */ isWindowMuted: () => (/* binding */ isWindowMuted),\n/* harmony export */ unmuteWindow: () => (/* binding */ unmuteWindow)\n/* harmony export */ });\nconst notes = new Map();\nnotes.set(\"C\", [16.35, 32.7, 65.41, 130.81, 261.63, 523.25, 1046.5, 2093.0, 4186.01]);\nnotes.set(\"Db\", [17.32, 34.65, 69.3, 138.59, 277.18, 554.37, 1108.73, 2217.46, 4434.92]);\nnotes.set(\"D\", [18.35, 36.71, 73.42, 146.83, 293.66, 587.33, 1174.66, 2349.32, 4698.63]);\nnotes.set(\"Eb\", [19.45, 38.89, 77.78, 155.56, 311.13, 622.25, 1244.51, 2489.02, 4978.03]);\nnotes.set(\"E\", [20.6, 41.2, 82.41, 164.81, 329.63, 659.25, 1318.51, 2637.02, 5274.04]);\nnotes.set(\"F\", [21.83, 43.65, 87.31, 174.61, 349.23, 698.46, 1396.91, 2793.83, 5587.65]);\nnotes.set(\"Gb\", [23.12, 46.25, 92.5, 185.0, 369.99, 739.99, 1479.98, 2959.96, 5919.91]);\nnotes.set(\"G\", [24.5, 49.0, 98.0, 196.0, 392.0, 783.99, 1567.98, 3135.96, 6271.93]);\nnotes.set(\"Ab\", [25.96, 51.91, 103.83, 207.65, 415.3, 830.61, 1661.22, 3322.44, 6644.88]);\nnotes.set(\"A\", [27.5, 55.0, 110.0, 220.0, 440.0, 880.0, 1760.0, 3520.0, 7040.0]);\nnotes.set(\"Bb\", [29.14, 58.27, 116.54, 233.08, 466.16, 932.33, 1864.66, 3729.31, 7458.62]);\nnotes.set(\"B\", [30.87, 61.74, 123.47, 246.94, 493.88, 987.77, 1975.53, 3951.07, 7902.13]);\nnotes.set(\"pause\", [0]);\nfunction getNoteFrequency(note) {\n const regex = /(([A-G]b?)(\\d))|pause/i,\n result = regex.exec(note),\n groupKey = 2,\n defaultMatchKey = 0,\n innerGroupKey = 3;\n if (!result?.length) {\n return;\n }\n const noteKey = result[groupKey] || result[defaultMatchKey],\n noteItem = notes.get(noteKey);\n if (!noteItem) {\n return;\n }\n return noteItem[parseInt(result[innerGroupKey] || \"0\")];\n}\nlet muted = true;\nconst isWindowMuted = () => {\n return muted;\n};\nconst unmuteWindow = () => {\n muted = false;\n};\n\n//# sourceURL=webpack://@tsparticles/plugin-sounds/./dist/browser/utils.js?");
38
158
 
39
159
  /***/ }),
40
160
 
@@ -74,9 +194,6 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
74
194
  /******/ return module.exports;
75
195
  /******/ }
76
196
  /******/
77
- /******/ // expose the modules object (__webpack_modules__)
78
- /******/ __webpack_require__.m = __webpack_modules__;
79
- /******/
80
197
  /************************************************************************/
81
198
  /******/ /* webpack/runtime/compat get default export */
82
199
  /******/ (() => {
@@ -102,91 +219,11 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
102
219
  /******/ };
103
220
  /******/ })();
104
221
  /******/
105
- /******/ /* webpack/runtime/ensure chunk */
106
- /******/ (() => {
107
- /******/ __webpack_require__.f = {};
108
- /******/ // This file contains only the entry chunk.
109
- /******/ // The chunk loading function for additional chunks
110
- /******/ __webpack_require__.e = (chunkId) => {
111
- /******/ return Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {
112
- /******/ __webpack_require__.f[key](chunkId, promises);
113
- /******/ return promises;
114
- /******/ }, []));
115
- /******/ };
116
- /******/ })();
117
- /******/
118
- /******/ /* webpack/runtime/get javascript chunk filename */
119
- /******/ (() => {
120
- /******/ // This function allow to reference async chunks
121
- /******/ __webpack_require__.u = (chunkId) => {
122
- /******/ // return url for filenames based on template
123
- /******/ return "" + chunkId + ".js";
124
- /******/ };
125
- /******/ })();
126
- /******/
127
- /******/ /* webpack/runtime/global */
128
- /******/ (() => {
129
- /******/ __webpack_require__.g = (function() {
130
- /******/ if (typeof globalThis === 'object') return globalThis;
131
- /******/ try {
132
- /******/ return this || new Function('return this')();
133
- /******/ } catch (e) {
134
- /******/ if (typeof window === 'object') return window;
135
- /******/ }
136
- /******/ })();
137
- /******/ })();
138
- /******/
139
222
  /******/ /* webpack/runtime/hasOwnProperty shorthand */
140
223
  /******/ (() => {
141
224
  /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
142
225
  /******/ })();
143
226
  /******/
144
- /******/ /* webpack/runtime/load script */
145
- /******/ (() => {
146
- /******/ var inProgress = {};
147
- /******/ var dataWebpackPrefix = "@tsparticles/plugin-sounds:";
148
- /******/ // loadScript function to load a script via script tag
149
- /******/ __webpack_require__.l = (url, done, key, chunkId) => {
150
- /******/ if(inProgress[url]) { inProgress[url].push(done); return; }
151
- /******/ var script, needAttach;
152
- /******/ if(key !== undefined) {
153
- /******/ var scripts = document.getElementsByTagName("script");
154
- /******/ for(var i = 0; i < scripts.length; i++) {
155
- /******/ var s = scripts[i];
156
- /******/ if(s.getAttribute("src") == url || s.getAttribute("data-webpack") == dataWebpackPrefix + key) { script = s; break; }
157
- /******/ }
158
- /******/ }
159
- /******/ if(!script) {
160
- /******/ needAttach = true;
161
- /******/ script = document.createElement('script');
162
- /******/
163
- /******/ script.charset = 'utf-8';
164
- /******/ script.timeout = 120;
165
- /******/ if (__webpack_require__.nc) {
166
- /******/ script.setAttribute("nonce", __webpack_require__.nc);
167
- /******/ }
168
- /******/ script.setAttribute("data-webpack", dataWebpackPrefix + key);
169
- /******/
170
- /******/ script.src = url;
171
- /******/ }
172
- /******/ inProgress[url] = [done];
173
- /******/ var onScriptComplete = (prev, event) => {
174
- /******/ // avoid mem leaks in IE.
175
- /******/ script.onerror = script.onload = null;
176
- /******/ clearTimeout(timeout);
177
- /******/ var doneFns = inProgress[url];
178
- /******/ delete inProgress[url];
179
- /******/ script.parentNode && script.parentNode.removeChild(script);
180
- /******/ doneFns && doneFns.forEach((fn) => (fn(event)));
181
- /******/ if(prev) return prev(event);
182
- /******/ }
183
- /******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
184
- /******/ script.onerror = onScriptComplete.bind(null, script.onerror);
185
- /******/ script.onload = onScriptComplete.bind(null, script.onload);
186
- /******/ needAttach && document.head.appendChild(script);
187
- /******/ };
188
- /******/ })();
189
- /******/
190
227
  /******/ /* webpack/runtime/make namespace object */
191
228
  /******/ (() => {
192
229
  /******/ // define __esModule on exports
@@ -198,121 +235,6 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
198
235
  /******/ };
199
236
  /******/ })();
200
237
  /******/
201
- /******/ /* webpack/runtime/publicPath */
202
- /******/ (() => {
203
- /******/ var scriptUrl;
204
- /******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
205
- /******/ var document = __webpack_require__.g.document;
206
- /******/ if (!scriptUrl && document) {
207
- /******/ if (document.currentScript)
208
- /******/ scriptUrl = document.currentScript.src;
209
- /******/ if (!scriptUrl) {
210
- /******/ var scripts = document.getElementsByTagName("script");
211
- /******/ if(scripts.length) {
212
- /******/ var i = scripts.length - 1;
213
- /******/ while (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;
214
- /******/ }
215
- /******/ }
216
- /******/ }
217
- /******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
218
- /******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
219
- /******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
220
- /******/ scriptUrl = scriptUrl.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
221
- /******/ __webpack_require__.p = scriptUrl;
222
- /******/ })();
223
- /******/
224
- /******/ /* webpack/runtime/jsonp chunk loading */
225
- /******/ (() => {
226
- /******/ // no baseURI
227
- /******/
228
- /******/ // object to store loaded and loading chunks
229
- /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
230
- /******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
231
- /******/ var installedChunks = {
232
- /******/ "tsparticles.plugin.sounds": 0
233
- /******/ };
234
- /******/
235
- /******/ __webpack_require__.f.j = (chunkId, promises) => {
236
- /******/ // JSONP chunk loading for javascript
237
- /******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
238
- /******/ if(installedChunkData !== 0) { // 0 means "already installed".
239
- /******/
240
- /******/ // a Promise means "currently loading".
241
- /******/ if(installedChunkData) {
242
- /******/ promises.push(installedChunkData[2]);
243
- /******/ } else {
244
- /******/ if(true) { // all chunks have JS
245
- /******/ // setup Promise in chunk cache
246
- /******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
247
- /******/ promises.push(installedChunkData[2] = promise);
248
- /******/
249
- /******/ // start chunk loading
250
- /******/ var url = __webpack_require__.p + __webpack_require__.u(chunkId);
251
- /******/ // create error before stack unwound to get useful stacktrace later
252
- /******/ var error = new Error();
253
- /******/ var loadingEnded = (event) => {
254
- /******/ if(__webpack_require__.o(installedChunks, chunkId)) {
255
- /******/ installedChunkData = installedChunks[chunkId];
256
- /******/ if(installedChunkData !== 0) installedChunks[chunkId] = undefined;
257
- /******/ if(installedChunkData) {
258
- /******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
259
- /******/ var realSrc = event && event.target && event.target.src;
260
- /******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
261
- /******/ error.name = 'ChunkLoadError';
262
- /******/ error.type = errorType;
263
- /******/ error.request = realSrc;
264
- /******/ installedChunkData[1](error);
265
- /******/ }
266
- /******/ }
267
- /******/ };
268
- /******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
269
- /******/ }
270
- /******/ }
271
- /******/ }
272
- /******/ };
273
- /******/
274
- /******/ // no prefetching
275
- /******/
276
- /******/ // no preloaded
277
- /******/
278
- /******/ // no HMR
279
- /******/
280
- /******/ // no HMR manifest
281
- /******/
282
- /******/ // no on chunks loaded
283
- /******/
284
- /******/ // install a JSONP callback for chunk loading
285
- /******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
286
- /******/ var chunkIds = data[0];
287
- /******/ var moreModules = data[1];
288
- /******/ var runtime = data[2];
289
- /******/ // add "moreModules" to the modules object,
290
- /******/ // then flag all "chunkIds" as loaded and fire callback
291
- /******/ var moduleId, chunkId, i = 0;
292
- /******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
293
- /******/ for(moduleId in moreModules) {
294
- /******/ if(__webpack_require__.o(moreModules, moduleId)) {
295
- /******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
296
- /******/ }
297
- /******/ }
298
- /******/ if(runtime) var result = runtime(__webpack_require__);
299
- /******/ }
300
- /******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
301
- /******/ for(;i < chunkIds.length; i++) {
302
- /******/ chunkId = chunkIds[i];
303
- /******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
304
- /******/ installedChunks[chunkId][0]();
305
- /******/ }
306
- /******/ installedChunks[chunkId] = 0;
307
- /******/ }
308
- /******/
309
- /******/ }
310
- /******/
311
- /******/ var chunkLoadingGlobal = this["webpackChunk_tsparticles_plugin_sounds"] = this["webpackChunk_tsparticles_plugin_sounds"] || [];
312
- /******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
313
- /******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
314
- /******/ })();
315
- /******/
316
238
  /************************************************************************/
317
239
  /******/
318
240
  /******/ // startup
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see tsparticles.plugin.sounds.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 r="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(this,(e=>(()=>{var t,r,o={303:t=>{t.exports=e}},n={};function i(e){var t=n[e];if(void 0!==t)return t.exports;var r=n[e]={exports:{}};return o[e](r,r.exports,i),r.exports}i.m=o,i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},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-sounds:",i.l=(e,o,n,a)=>{if(t[e])t[e].push(o);else{var s,u;if(void 0!==n)for(var l=document.getElementsByTagName("script"),c=0;c<l.length;c++){var p=l[c];if(p.getAttribute("src")==e||p.getAttribute("data-webpack")==r+n){s=p;break}}s||(u=!0,(s=document.createElement("script")).charset="utf-8",s.timeout=120,i.nc&&s.setAttribute("nonce",i.nc),s.setAttribute("data-webpack",r+n),s.src=e),t[e]=[o];var d=(r,o)=>{s.onerror=s.onload=null,clearTimeout(f);var n=t[e];if(delete t[e],s.parentNode&&s.parentNode.removeChild(s),n&&n.forEach((e=>e(o))),r)return r(o)},f=setTimeout(d.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=d.bind(null,s.onerror),s.onload=d.bind(null,s.onload),u&&document.head.appendChild(s)}},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&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var o=r.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=r[o--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i.p=e})(),(()=>{var e={848:0};i.f.j=(t,r)=>{var o=i.o(e,t)?e[t]:void 0;if(0!==o)if(o)r.push(o[2]);else{var n=new Promise(((r,n)=>o=e[t]=[r,n]));r.push(o[2]=n);var a=i.p+i.u(t),s=new Error;i.l(a,(r=>{if(i.o(e,t)&&(0!==(o=e[t])&&(e[t]=void 0),o)){var n=r&&("load"===r.type?"missing":r.type),a=r&&r.target&&r.target.src;s.message="Loading chunk "+t+" failed.\n("+n+": "+a+")",s.name="ChunkLoadError",s.type=n,s.request=a,o[1](s)}}),"chunk-"+t,t)}};var t=(t,r)=>{var o,n,a=r[0],s=r[1],u=r[2],l=0;if(a.some((t=>0!==e[t]))){for(o in s)i.o(s,o)&&(i.m[o]=s[o]);if(u)u(i)}for(t&&t(r);l<a.length;l++)n=a[l],i.o(e,n)&&e[n]&&e[n][0](),e[n]=0},r=this.webpackChunk_tsparticles_plugin_sounds=this.webpackChunk_tsparticles_plugin_sounds||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var a={};return(()=>{async function e(e,t=!0){const{SoundsPlugin:r}=await i.e(999).then(i.bind(i,999));await e.addPlugin(new r(e),t)}i.r(a),i.d(a,{loadSoundsPlugin:()=>e})})(),a})()));
2
+ !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],e);else{var i="object"==typeof exports?e(require("@tsparticles/engine")):e(t.window);for(var n in i)("object"==typeof exports?exports:t)[n]=i[n]}}(this,(t=>(()=>{var e={303:e=>{e.exports=t}},i={};function n(t){var s=i[t];if(void 0!==s)return s.exports;var o=i[t]={exports:{}};return e[t](o,o.exports,n),o.exports}n.d=(t,e)=>{for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var s={};n.r(s),n.d(s,{loadSoundsPlugin:()=>E});var o,a,c=n(303);class u{constructor(){this.loop=!1,this.source=""}load(t){void 0!==t&&((0,c.isObject)(t)?(void 0!==t.loop&&(this.loop=t.loop),void 0!==t.source&&(this.source=t.source)):this.source=t)}}class l{constructor(){this.duration=500,this.value=[]}load(t){t&&(void 0!==t.duration&&(this.duration=t.duration),void 0!==t.value&&(this.value=t.value))}}class r{constructor(){this.loop=!1,this.melodies=[],this.notes=[]}load(t){void 0!==t&&(void 0!==t.loop&&(this.loop=t.loop),void 0!==t.melodies&&(this.melodies=t.melodies.map((t=>{const e=new r;return e.load(t),e}))),void 0!==t.notes&&(this.notes=t.notes.map((t=>{const e=new l;return e.load(t),e}))))}}class d{constructor(){this.event=[],this.notes=[]}load(t){if(t&&(void 0!==t.event&&(this.event=t.event),void 0!==t.audio&&((0,c.isArray)(t.audio)?this.audio=t.audio.map((t=>{const e=new u;return e.load(t),e})):(this.audio=new u,this.audio.load(t.audio))),void 0!==t.notes&&(this.notes=t.notes.map((t=>{const e=new l;return e.load(t),e}))),void 0!==t.melodies&&(this.melodies=t.melodies.map((t=>{const e=new r;return e.load(t),e}))),t.filter))if((0,c.isString)(t.filter)){const e=window[t.filter];(0,c.isFunction)(e)&&(this.filter=e)}else this.filter=t.filter}}class h{constructor(){this.width=24,this.height=24,this.style=""}load(t){t&&(void 0!==t.path&&(this.path=t.path),void 0!==t.svg&&(this.svg=t.svg),void 0!==t.width&&(this.width=t.width),void 0!==t.height&&(this.height=t.height))}}class m{constructor(){this.mute=new h,this.unmute=new h,this.volumeDown=new h,this.volumeUp=new h,this.enable=!1,this.mute.svg='<?xml version="1.0"?>\n<svg baseProfile="tiny" height="24px" version="1.2" viewBox="0 0 24 24" width="24px"\n xml:space="preserve" xmlns="http://www.w3.org/2000/svg"\n xmlns:xlink="http://www.w3.org/1999/xlink">\n <g id="Layer_1">\n <path fill="#fff" d="M19.707,5.293c-0.391-0.391-1.023-0.391-1.414,0l-1.551,1.551c-0.345-0.688-0.987-1.02-1.604-1.02c-0.449,0-0.905,0.152-1.356,0.453l-2.672,1.781C10.357,8.561,8.904,9,8,9c-1.654,0-3,1.346-3,3v2c0,1.237,0.754,2.302,1.826,2.76l-1.533,1.533c-0.391,0.391-0.391,1.023,0,1.414C5.488,19.902,5.744,20,6,20s0.512-0.098,0.707-0.293l2.527-2.527c0.697,0.174,1.416,0.455,1.875,0.762l2.672,1.781c0.451,0.301,0.907,0.453,1.356,0.453C16.035,20.176,17,19.495,17,18V9.414l2.707-2.707C20.098,6.316,20.098,5.684,19.707,5.293z M14.891,7.941c0.038-0.025,0.073-0.046,0.104-0.062C14.998,7.914,15,7.954,15,8v1.293l-2,2V9.202L14.891,7.941z M7,12c0-0.552,0.448-1,1-1c1.211,0,2.907-0.495,4-1.146v2.439l-2.83,2.83C8.757,15.046,8.356,15,8,15c-0.552,0-1-0.448-1-1V12z M10.301,15.406L12,13.707v2.439C11.519,15.859,10.925,15.604,10.301,15.406z M14.994,18.12c-0.03-0.016-0.065-0.036-0.104-0.062L13,16.798v-4.091l2-2V18C15,18.046,14.998,18.086,14.994,18.12z"/>\n </g>\n</svg>',this.unmute.svg='<?xml version="1.0"?>\n<svg baseProfile="tiny" height="24px" version="1.2" viewBox="0 0 24 24" width="24px"\n xml:space="preserve" xmlns="http://www.w3.org/2000/svg"\n xmlns:xlink="http://www.w3.org/1999/xlink">\n <g id="Layer_1">\n <path fill="#fff" d="M17.138,5.824c-0.449,0-0.905,0.152-1.356,0.453l-2.672,1.781C12.357,8.561,10.904,9,10,9c-1.654,0-3,1.346-3,3v2c0,1.654,1.346,3,3,3c0.904,0,2.357,0.439,3.109,0.941l2.672,1.781c0.451,0.301,0.907,0.453,1.356,0.453C18.035,20.176,19,19.495,19,18V8C19,6.505,18.035,5.824,17.138,5.824z M14,16.146C12.907,15.495,11.211,15,10,15c-0.552,0-1-0.448-1-1v-2c0-0.552,0.448-1,1-1c1.211,0,2.907-0.495,4-1.146V16.146z M17,18c0,0.046-0.002,0.086-0.006,0.12c-0.03-0.016-0.065-0.036-0.104-0.062L15,16.798V9.202l1.891-1.261c0.038-0.025,0.073-0.046,0.104-0.062C16.998,7.914,17,7.954,17,8V18z"/>\n </g>\n</svg>',this.volumeDown.svg='<?xml version="1.0"?>\n<svg baseProfile="tiny" height="24px" version="1.2" viewBox="0 0 24 24" width="24px"\n xml:space="preserve" xmlns="http://www.w3.org/2000/svg"\n xmlns:xlink="http://www.w3.org/1999/xlink">\n <g id="Layer_1">\n <path fill="#fff" d="M15.138,5.824c-0.449,0-0.905,0.152-1.356,0.453l-2.672,1.781C10.357,8.561,8.904,9,8,9c-1.654,0-3,1.346-3,3v2c0,1.654,1.346,3,3,3c0.904,0,2.357,0.439,3.109,0.941l2.672,1.781c0.451,0.301,0.907,0.453,1.356,0.453C16.035,20.176,17,19.495,17,18V8C17,6.505,16.035,5.824,15.138,5.824z M8,15c-0.552,0-1-0.448-1-1v-2c0-0.552,0.448-1,1-1c1.211,0,2.907-0.495,4-1.146v6.293C10.907,15.495,9.211,15,8,15z M15,18c0,0.046-0.002,0.086-0.006,0.12c-0.03-0.016-0.065-0.036-0.104-0.062L13,16.798V9.202l1.891-1.261c0.038-0.025,0.073-0.046,0.104-0.062C14.998,7.914,15,7.954,15,8V18z"/>\n <path fill="#fff" d="M18.292,10.294c-0.39,0.391-0.39,1.023,0.002,1.414c0.345,0.345,0.535,0.803,0.535,1.291c0,0.489-0.19,0.948-0.536,1.294c-0.391,0.39-0.391,1.023,0,1.414C18.488,15.902,18.744,16,19,16s0.512-0.098,0.707-0.293c0.724-0.723,1.122-1.685,1.122-2.708s-0.398-1.984-1.123-2.707C19.317,9.903,18.683,9.901,18.292,10.294z"/>\n </g>\n</svg>',this.volumeUp.svg='<?xml version="1.0"?>\n<svg baseProfile="tiny" height="24px" version="1.2" viewBox="0 0 24 24" width="24px"\n xml:space="preserve" xmlns="http://www.w3.org/2000/svg"\n xmlns:xlink="http://www.w3.org/1999/xlink">\n <g id="Layer_1">\n <path fill="#fff" d="M16.706,10.292c-0.389-0.389-1.023-0.391-1.414,0.002c-0.39,0.391-0.39,1.023,0.002,1.414c0.345,0.345,0.535,0.803,0.535,1.291c0,0.489-0.19,0.948-0.536,1.294c-0.391,0.39-0.391,1.023,0,1.414C15.488,15.902,15.744,16,16,16s0.512-0.098,0.707-0.293c0.724-0.723,1.122-1.685,1.122-2.708S17.431,11.015,16.706,10.292z"/>\n <path fill="#fff" d="M18.706,8.292c-0.391-0.389-1.023-0.39-1.414,0.002c-0.39,0.391-0.39,1.024,0.002,1.414c0.879,0.877,1.363,2.044,1.364,3.287c0.001,1.246-0.484,2.417-1.365,3.298c-0.391,0.391-0.391,1.023,0,1.414C17.488,17.902,17.744,18,18,18s0.512-0.098,0.707-0.293c1.259-1.259,1.952-2.933,1.951-4.713C20.657,11.217,19.964,9.547,18.706,8.292z"/>\n <path fill="#fff" d="M20.706,6.292c-0.391-0.389-1.023-0.39-1.414,0.002c-0.39,0.391-0.39,1.024,0.002,1.414c1.412,1.409,2.191,3.285,2.192,5.284c0.002,2.002-0.777,3.885-2.193,5.301c-0.391,0.391-0.391,1.023,0,1.414C19.488,19.902,19.744,20,20,20s0.512-0.098,0.707-0.293c1.794-1.794,2.781-4.18,2.779-6.717C23.485,10.457,22.497,8.078,20.706,6.292z"/>\n <path fill="#fff" d="M12.138,5.824c-0.449,0-0.905,0.152-1.356,0.453L8.109,8.059C7.357,8.561,5.904,9,5,9c-1.654,0-3,1.346-3,3v2c0,1.654,1.346,3,3,3c0.904,0,2.357,0.439,3.109,0.941l2.672,1.781c0.451,0.301,0.907,0.453,1.356,0.453C13.035,20.176,14,19.495,14,18V8C14,6.505,13.035,5.824,12.138,5.824z M5,15c-0.552,0-1-0.448-1-1v-2c0-0.552,0.448-1,1-1c1.211,0,2.907-0.495,4-1.146v6.293C7.907,15.495,6.211,15,5,15z M12,18c0,0.046-0.002,0.086-0.006,0.12c-0.03-0.016-0.065-0.036-0.104-0.062L10,16.798V9.202l1.891-1.261c0.038-0.025,0.073-0.046,0.104-0.062C11.998,7.914,12,7.954,12,8V18z"/>\n </g>\n</svg>'}load(t){t&&(void 0!==t.enable&&(this.enable=t.enable),this.mute.load(t.mute),this.unmute.load(t.unmute),this.volumeDown.load(t.volumeDown),this.volumeUp.load(t.volumeUp))}}class v{constructor(){this.value=100,this.max=100,this.min=0,this.step=10}load(t){void 0!==t&&((0,c.isObject)(t)?(void 0!==t.max&&(this.max=t.max),void 0!==t.min&&(this.min=t.min),void 0!==t.step&&(this.step=t.step),void 0!==t.value&&(this.value=t.value)):this.value=t)}}class p{constructor(){this.autoPlay=!0,this.enable=!1,this.events=[],this.icons=new m,this.volume=new v}load(t){t&&(void 0!==t.autoPlay&&(this.autoPlay=t.autoPlay),void 0!==t.enable&&(this.enable=t.enable),void 0!==t.events&&(this.events=t.events.map((t=>{const e=new d;return e.load(t),e}))),this.icons.load(t.icons),void 0!==t.volume&&this.volume.load(t.volume))}}!function(t){t.mute="soundsMuted",t.unmute="soundsUnmuted"}(o||(o={})),function(t){t.Block="block",t.None="none"}(a||(a={}));const f=new Map;function g(t){const e=/(([A-G]b?)(\d))|pause/i.exec(t);if(!e?.length)return;const i=e[2]||e[0],n=f.get(i);return n?n[parseInt(e[3]||"0")]:void 0}f.set("C",[16.35,32.7,65.41,130.81,261.63,523.25,1046.5,2093,4186.01]),f.set("Db",[17.32,34.65,69.3,138.59,277.18,554.37,1108.73,2217.46,4434.92]),f.set("D",[18.35,36.71,73.42,146.83,293.66,587.33,1174.66,2349.32,4698.63]),f.set("Eb",[19.45,38.89,77.78,155.56,311.13,622.25,1244.51,2489.02,4978.03]),f.set("E",[20.6,41.2,82.41,164.81,329.63,659.25,1318.51,2637.02,5274.04]),f.set("F",[21.83,43.65,87.31,174.61,349.23,698.46,1396.91,2793.83,5587.65]),f.set("Gb",[23.12,46.25,92.5,185,369.99,739.99,1479.98,2959.96,5919.91]),f.set("G",[24.5,49,98,196,392,783.99,1567.98,3135.96,6271.93]),f.set("Ab",[25.96,51.91,103.83,207.65,415.3,830.61,1661.22,3322.44,6644.88]),f.set("A",[27.5,55,110,220,440,880,1760,3520,7040]),f.set("Bb",[29.14,58.27,116.54,233.08,466.16,932.33,1864.66,3729.31,7458.62]),f.set("B",[30.87,61.74,123.47,246.94,493.88,987.77,1975.53,3951.07,7902.13]),f.set("pause",[0]);let _=!0;const w=()=>_,y=()=>{_=!1},x=1;function b(t){const e=document.createElement("img"),{clickCb:i,container:n,display:s,iconOptions:o,margin:a,options:c,pos:u,rightOffsets:l}=t,{width:r,path:d,style:h,svg:m}=o;!function(t,e,i,n,s,o,a,c){t.style.userSelect="none",t.style.webkitUserSelect="none",t.style.position="absolute",t.style.top=`${e+a}px`,t.style.left=i-a-o+"px",t.style.display=n,t.style.zIndex=`${s+x}`,t.style.cssText+=c}(e,u.top+a,u.right-(a*(l.length+1)+r+l.reduce(((t,e)=>t+e),0)),s,c.fullScreen.zIndex+x,r,a,h),e.src=d??(m?`data:image/svg+xml;base64,${btoa(m)}`:"");return(n.canvas.element?.parentNode??document.body).append(e),e.addEventListener("click",(()=>{i()})),e}function C(t){t&&t.remove()}class M{constructor(t,e){this._addBuffer=t=>{const e=t.createBufferSource();return this._audioSources.push(e),e},this._addOscillator=t=>{const e=t.createOscillator();return this._audioSources.push(e),e},this._initEvents=()=>{const t=this._container,e=t.actualOptions.sounds;if(e?.enable&&t.canvas.element)for(const t of e.events){const e=i=>{(async()=>{const n=t.filter&&!t.filter(i);if(this._container!==i.container)return;if(!this._container||this._container.muted||this._container.destroyed)return void(0,c.executeOnSingleOrMultiple)(t.event,(t=>{this._engine.removeEventListener(t,e)}));if(n)return;if(t.audio)this._playBuffer((0,c.itemFromSingleOrMultiple)(t.audio));else if(t.melodies){const e=(0,c.itemFromArray)(t.melodies);e.melodies.length?await Promise.allSettled(e.melodies.map((t=>this._playNote(t.notes,0,e.loop)))):await this._playNote(e.notes,0,e.loop)}else if(t.notes){const e=(0,c.itemFromArray)(t.notes);await this._playNote([e],0,!1)}})()};(0,c.executeOnSingleOrMultiple)(t.event,(t=>{this._engine.addEventListener(t,e)}))}},this._mute=async()=>{const t=this._container,e=this._getAudioContext();for(const t of this._audioSources)this._removeAudioSource(t);this._gain&&this._gain.disconnect(),await e.close(),t.audioContext=void 0,this._engine.dispatchEvent(o.mute,{container:this._container})},this._playBuffer=t=>{const e=this._audioMap.get(t.source);if(!e)return;const i=this._container.audioContext;if(!i)return;const n=this._addBuffer(i);n.loop=t.loop,n.buffer=e,n.connect(this._gain??i.destination),n.start()},this._playFrequency=async(t,e)=>{if(!this._gain||this._container.muted)return;const i=this._getAudioContext(),n=this._addOscillator(i);return n.connect(this._gain),n.type="sine",n.frequency.value=t,n.start(),new Promise((t=>{setTimeout((()=>{this._removeAudioSource(n),t()}),e)}))},this._playMuteSound=()=>{if(this._container.muted)return;const t=this._getAudioContext(),e=t.createGain();e.connect(t.destination),e.gain.value=0;const i=t.createOscillator();i.connect(e),i.type="sine",i.frequency.value=1,i.start(),setTimeout((()=>{i.stop(),i.disconnect(),e.disconnect()}))},this._playNote=async(t,e,i)=>{if(this._container.muted)return;const n=t[e];if(!n)return;const s=n.value,o=(0,c.executeOnSingleOrMultiple)(s,(async(i,n)=>this._playNoteValue(t,e,n)));await((0,c.isArray)(o)?Promise.allSettled(o):o);let a=e+1;i&&a>=t.length&&(a%=t.length),this._container.muted||await this._playNote(t,a,i)},this._playNoteValue=async(t,e,i)=>{const n=t[e];if(!n)return;const s=(0,c.itemFromSingleOrMultiple)(n.value,i,!0);try{const t=g(s);if(!(0,c.isNumber)(t))return;await this._playFrequency(t,n.duration)}catch(t){(0,c.getLogger)().error(t)}},this._removeAudioSource=t=>{t.stop(),t.disconnect();this._audioSources.splice(this._audioSources.indexOf(t),1)},this._unmute=()=>{const t=this._container.actualOptions.sounds;if(!t)return;const e=this._getAudioContext();this._audioSources||(this._audioSources=[]);const i=e.createGain();i.connect(e.destination),i.gain.value=t.volume.value/c.percentDenominator,this._gain=i,this._initEvents(),this._engine.dispatchEvent(o.unmute,{container:this._container})},this._updateMuteIcons=()=>{const t=this._container,e=t.actualOptions.sounds;if(!e?.enable||!e.icons.enable)return;const i=this._muteImg,n=this._unmuteImg;i&&(i.style.display=t.muted?"block":"none"),n&&(n.style.display=t.muted?"none":"block")},this._updateMuteStatus=async()=>{const t=this._container,e=this._getAudioContext();t.muted?(await(e?.suspend()),await this._mute()):(await(e?.resume()),this._unmute(),this._playMuteSound())},this._updateVolume=async()=>{const t=this._container,e=t.actualOptions.sounds;if(!e?.enable)return;(0,c.clamp)(this._volume,e.volume.min,e.volume.max);let i=!1;this._volume<=0&&!t.muted?(this._volume=0,t.muted=!0,i=!0):this._volume>0&&t.muted&&(t.muted=!1,i=!0),i&&(this._updateMuteIcons(),await this._updateMuteStatus()),this._gain?.gain&&(this._gain.gain.value=this._volume/c.percentDenominator)},this._container=t,this._engine=e,this._volume=0,this._audioSources=[],this._audioMap=new Map}async init(){const t=this._container.actualOptions.sounds;if(!t?.enable)return;if(t.autoPlay&&w()){const t=()=>{removeEventListener(c.mouseDownEvent,t),removeEventListener(c.touchStartEvent,t),y(),this.unmute()},e={capture:!0,once:!0};addEventListener(c.mouseDownEvent,t,e),addEventListener(c.touchStartEvent,t,e)}this._volume=t.volume.value;const e=t.events;this._audioMap=new Map;for(const t of e){if(!t.audio)continue;const e=(0,c.executeOnSingleOrMultiple)(t.audio,(async t=>{const e=await fetch(t.source);if(!e.ok)return;const i=await e.arrayBuffer(),n=this._getAudioContext(),s=await n.decodeAudioData(i);this._audioMap.set(t.source,s)}));e instanceof Promise?await e:await Promise.allSettled(e)}}async mute(){this._container.muted||await this.toggleMute()}async start(){const t=this._container,e=t.actualOptions,i=e.sounds;if(!i?.enable||!t.canvas.element)return;t.muted=!0;const n=t.canvas.element,s={top:n.offsetTop,right:n.offsetLeft+n.offsetWidth},{mute:o,unmute:c,volumeDown:u,volumeUp:l}=i.icons,r=async()=>{await this.toggleMute()},d=i.icons.enable?a.Block:a.None;this._muteImg=b({container:t,options:e,pos:s,display:d,iconOptions:o,margin:10,rightOffsets:[u.width,l.width],clickCb:r}),this._unmuteImg=b({container:t,options:e,pos:s,display:a.None,iconOptions:c,margin:10,rightOffsets:[u.width,l.width],clickCb:r}),this._volumeDownImg=b({container:t,options:e,pos:s,display:d,iconOptions:u,margin:10,rightOffsets:[l.width],clickCb:async()=>{await this.volumeDown()}}),this._volumeUpImg=b({container:t,options:e,pos:s,display:d,iconOptions:l,margin:10,rightOffsets:[],clickCb:async()=>{await this.volumeUp()}}),!w()&&i.autoPlay&&await this.unmute()}stop(){this._container.muted=!0,(async()=>{await this._mute(),C(this._muteImg),C(this._unmuteImg),C(this._volumeDownImg),C(this._volumeUpImg)})()}async toggleMute(){const t=this._container;t.muted=!t.muted,this._updateMuteIcons(),await this._updateMuteStatus()}async unmute(){this._container.muted&&await this.toggleMute()}async volumeDown(){const t=this._container,e=t.actualOptions.sounds;e?.enable&&(t.muted&&(this._volume=0),this._volume-=e.volume.step,await this._updateVolume())}async volumeUp(){const t=this._container.actualOptions.sounds;t?.enable&&(this._volume+=t.volume.step,await this._updateVolume())}_getAudioContext(){const t=this._container;return t.audioContext||(t.audioContext=new AudioContext),t.audioContext}}const O=()=>{removeEventListener(c.mouseDownEvent,O),removeEventListener(c.touchStartEvent,O),y()};class S{constructor(t){this.id="sounds",this._engine=t;const e={capture:!0,once:!0};addEventListener(c.mouseDownEvent,O,e),addEventListener(c.touchStartEvent,O,e)}getPlugin(t){return Promise.resolve(new M(t,this._engine))}loadOptions(t,e){if(!this.needsPlugin(t)&&!this.needsPlugin(e))return;let i=t.sounds;void 0===i?.load&&(t.sounds=i=new p),i.load(e?.sounds)}needsPlugin(t){return t?.sounds?.enable??!1}}async function E(t,e=!0){await t.addPlugin(new S(t),e)}return s})()));
@@ -1 +1 @@
1
- /*! tsParticles Sounds Plugin v3.3.0 by Matteo Bruni */
1
+ /*! tsParticles Sounds Plugin v3.5.0 by Matteo Bruni */
@@ -1,6 +1,6 @@
1
1
  import { type Container, type Engine, type IPlugin, type RecursivePartial } from "@tsparticles/engine";
2
2
  import type { ISoundsOptions, SoundsOptions } from "./types.js";
3
- import type { SoundsInstance } from "./SoundsInstance.js";
3
+ import { SoundsInstance } from "./SoundsInstance.js";
4
4
  export declare class SoundsPlugin implements IPlugin {
5
5
  readonly id: string;
6
6
  private readonly _engine;
package/types/enums.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- export declare const enum SoundsEventType {
1
+ export declare enum SoundsEventType {
2
2
  mute = "soundsMuted",
3
3
  unmute = "soundsUnmuted"
4
4
  }
5
- export declare const enum ImageDisplay {
5
+ export declare enum ImageDisplay {
6
6
  Block = "block",
7
7
  None = "none"
8
8
  }
@@ -32,7 +32,7 @@
32
32
  this.enable = data.enable;
33
33
  }
34
34
  if (data.events !== undefined) {
35
- this.events = data.events.map((t) => {
35
+ this.events = data.events.map(t => {
36
36
  const event = new SoundsEvent_js_1.SoundsEvent();
37
37
  event.load(t);
38
38
  return event;
@@ -28,7 +28,7 @@
28
28
  }
29
29
  if (data.audio !== undefined) {
30
30
  if ((0, engine_1.isArray)(data.audio)) {
31
- this.audio = data.audio.map((s) => {
31
+ this.audio = data.audio.map(s => {
32
32
  const tmp = new SoundsAudio_js_1.SoundsAudio();
33
33
  tmp.load(s);
34
34
  return tmp;
@@ -40,14 +40,14 @@
40
40
  }
41
41
  }
42
42
  if (data.notes !== undefined) {
43
- this.notes = data.notes.map((t) => {
43
+ this.notes = data.notes.map(t => {
44
44
  const tmp = new SoundsNote_js_1.SoundsNote();
45
45
  tmp.load(t);
46
46
  return tmp;
47
47
  });
48
48
  }
49
49
  if (data.melodies !== undefined) {
50
- this.melodies = data.melodies.map((t) => {
50
+ this.melodies = data.melodies.map(t => {
51
51
  const tmp = new SoundsMelody_js_1.SoundsMelody();
52
52
  tmp.load(t);
53
53
  return tmp;
@@ -25,14 +25,14 @@
25
25
  this.loop = data.loop;
26
26
  }
27
27
  if (data.melodies !== undefined) {
28
- this.melodies = data.melodies.map((s) => {
28
+ this.melodies = data.melodies.map(s => {
29
29
  const tmp = new SoundsMelody();
30
30
  tmp.load(s);
31
31
  return tmp;
32
32
  });
33
33
  }
34
34
  if (data.notes !== undefined) {
35
- this.notes = data.notes.map((s) => {
35
+ this.notes = data.notes.map(s => {
36
36
  const tmp = new SoundsNote_js_1.SoundsNote();
37
37
  tmp.load(s);
38
38
  return tmp;