Socket
Socket
Sign inDemoInstall

@tsparticles/plugin-sounds

Package Overview
Dependencies
Maintainers
2
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tsparticles/plugin-sounds - npm Package Compare versions

Comparing version 3.3.0 to 3.4.0

11

browser/enums.js

@@ -1,1 +0,10 @@

export {};
export var SoundsEventType;
(function (SoundsEventType) {
SoundsEventType["mute"] = "soundsMuted";
SoundsEventType["unmute"] = "soundsUnmuted";
})(SoundsEventType || (SoundsEventType = {}));
export var ImageDisplay;
(function (ImageDisplay) {
ImageDisplay["Block"] = "block";
ImageDisplay["None"] = "none";
})(ImageDisplay || (ImageDisplay = {}));

2

browser/index.js

@@ -0,4 +1,4 @@

import { SoundsPlugin } from "./SoundsPlugin.js";
export async function loadSoundsPlugin(engine, refresh = true) {
const { SoundsPlugin } = await import("./SoundsPlugin.js");
await engine.addPlugin(new SoundsPlugin(engine), refresh);
}

@@ -23,3 +23,3 @@ import { SoundsEvent } from "./SoundsEvent.js";

if (data.events !== undefined) {
this.events = data.events.map((t) => {
this.events = data.events.map(t => {
const event = new SoundsEvent();

@@ -26,0 +26,0 @@ event.load(t);

@@ -19,3 +19,3 @@ import { isArray, isFunction, isString, } from "@tsparticles/engine";

if (isArray(data.audio)) {
this.audio = data.audio.map((s) => {
this.audio = data.audio.map(s => {
const tmp = new SoundsAudio();

@@ -32,3 +32,3 @@ tmp.load(s);

if (data.notes !== undefined) {
this.notes = data.notes.map((t) => {
this.notes = data.notes.map(t => {
const tmp = new SoundsNote();

@@ -40,3 +40,3 @@ tmp.load(t);

if (data.melodies !== undefined) {
this.melodies = data.melodies.map((t) => {
this.melodies = data.melodies.map(t => {
const tmp = new SoundsMelody();

@@ -43,0 +43,0 @@ tmp.load(t);

@@ -16,3 +16,3 @@ import { SoundsNote } from "./SoundsNote.js";

if (data.melodies !== undefined) {
this.melodies = data.melodies.map((s) => {
this.melodies = data.melodies.map(s => {
const tmp = new SoundsMelody();

@@ -24,3 +24,3 @@ tmp.load(s);

if (data.notes !== undefined) {
this.notes = data.notes.map((s) => {
this.notes = data.notes.map(s => {
const tmp = new SoundsNote();

@@ -27,0 +27,0 @@ tmp.load(s);

import { clamp, executeOnSingleOrMultiple, getLogger, isArray, isNumber, itemFromArray, itemFromSingleOrMultiple, mouseDownEvent, percentDenominator, touchStartEvent, } from "@tsparticles/engine";
import { ImageDisplay, SoundsEventType } from "./enums.js";
import { getNoteFrequency, isWindowMuted, unmuteWindow } from "./utils.js";

@@ -36,3 +37,3 @@ const zIndexOffset = 1, rightOffset = 1, minVolume = 0;

constructor(container, engine) {
this._addBuffer = (audioCtx) => {
this._addBuffer = audioCtx => {
const buffer = audioCtx.createBufferSource();

@@ -42,3 +43,3 @@ this._audioSources.push(buffer);

};
this._addOscillator = (audioCtx) => {
this._addOscillator = audioCtx => {
const oscillator = audioCtx.createOscillator();

@@ -61,3 +62,3 @@ this._audioSources.push(oscillator);

if (!this._container || !!this._container.muted || this._container.destroyed) {
executeOnSingleOrMultiple(event.event, (item) => {
executeOnSingleOrMultiple(event.event, item => {
this._engine.removeEventListener(item, cb);

@@ -77,3 +78,3 @@ });

if (melody.melodies.length) {
await Promise.allSettled(melody.melodies.map((m) => this._playNote(m.notes, defaultNoteIndex, melody.loop)));
await Promise.allSettled(melody.melodies.map(m => this._playNote(m.notes, defaultNoteIndex, melody.loop)));
}

@@ -90,3 +91,3 @@ else {

};
executeOnSingleOrMultiple(event.event, (item) => {
executeOnSingleOrMultiple(event.event, item => {
this._engine.addEventListener(item, cb);

@@ -106,5 +107,5 @@ });

container.audioContext = undefined;
this._engine.dispatchEvent("soundsMuted", { container: this._container });
this._engine.dispatchEvent(SoundsEventType.mute, { container: this._container });
};
this._playBuffer = (audio) => {
this._playBuffer = audio => {
const audioBuffer = this._audioMap.get(audio.source);

@@ -133,3 +134,3 @@ if (!audioBuffer) {

oscillator.start();
return new Promise((resolve) => {
return new Promise(resolve => {
setTimeout(() => {

@@ -199,3 +200,3 @@ this._removeAudioSource(oscillator);

};
this._removeAudioSource = (source) => {
this._removeAudioSource = source => {
source.stop();

@@ -220,3 +221,3 @@ source.disconnect();

this._initEvents();
this._engine.dispatchEvent("soundsUnmuted", { container: this._container });
this._engine.dispatchEvent(SoundsEventType.unmute, { container: this._container });
};

@@ -336,3 +337,3 @@ this._updateMuteIcons = () => {

await this.toggleMute();
}, enableIcons = soundsOptions.icons.enable, display = enableIcons ? "block" : "none";
}, enableIcons = soundsOptions.icons.enable, display = enableIcons ? ImageDisplay.Block : ImageDisplay.None;
this._muteImg = initImage({

@@ -352,3 +353,3 @@ container,

pos,
display: "none",
display: ImageDisplay.None,
iconOptions: unmute,

@@ -355,0 +356,0 @@ margin,

import { mouseDownEvent, touchStartEvent, } from "@tsparticles/engine";
import { Sounds } from "./Options/Classes/Sounds.js";
import { SoundsInstance } from "./SoundsInstance.js";
import { unmuteWindow } from "./utils.js";

@@ -20,5 +21,4 @@ const generalFirstClickHandler = () => {

}
async getPlugin(container) {
const { SoundsInstance } = await import("./SoundsInstance.js");
return new SoundsInstance(container, this._engine);
getPlugin(container) {
return Promise.resolve(new SoundsInstance(container, this._engine));
}

@@ -25,0 +25,0 @@ loadOptions(options, source) {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ImageDisplay = exports.SoundsEventType = void 0;
var SoundsEventType;
(function (SoundsEventType) {
SoundsEventType["mute"] = "soundsMuted";
SoundsEventType["unmute"] = "soundsUnmuted";
})(SoundsEventType || (exports.SoundsEventType = SoundsEventType = {}));
var ImageDisplay;
(function (ImageDisplay) {
ImageDisplay["Block"] = "block";
ImageDisplay["None"] = "none";
})(ImageDisplay || (exports.ImageDisplay = ImageDisplay = {}));
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.loadSoundsPlugin = void 0;
const SoundsPlugin_js_1 = require("./SoundsPlugin.js");
async function loadSoundsPlugin(engine, refresh = true) {
const { SoundsPlugin } = await import("./SoundsPlugin.js");
await engine.addPlugin(new SoundsPlugin(engine), refresh);
await engine.addPlugin(new SoundsPlugin_js_1.SoundsPlugin(engine), refresh);
}
exports.loadSoundsPlugin = loadSoundsPlugin;

@@ -26,3 +26,3 @@ "use strict";

if (data.events !== undefined) {
this.events = data.events.map((t) => {
this.events = data.events.map(t => {
const event = new SoundsEvent_js_1.SoundsEvent();

@@ -29,0 +29,0 @@ event.load(t);

@@ -22,3 +22,3 @@ "use strict";

if ((0, engine_1.isArray)(data.audio)) {
this.audio = data.audio.map((s) => {
this.audio = data.audio.map(s => {
const tmp = new SoundsAudio_js_1.SoundsAudio();

@@ -35,3 +35,3 @@ tmp.load(s);

if (data.notes !== undefined) {
this.notes = data.notes.map((t) => {
this.notes = data.notes.map(t => {
const tmp = new SoundsNote_js_1.SoundsNote();

@@ -43,3 +43,3 @@ tmp.load(t);

if (data.melodies !== undefined) {
this.melodies = data.melodies.map((t) => {
this.melodies = data.melodies.map(t => {
const tmp = new SoundsMelody_js_1.SoundsMelody();

@@ -46,0 +46,0 @@ tmp.load(t);

@@ -19,3 +19,3 @@ "use strict";

if (data.melodies !== undefined) {
this.melodies = data.melodies.map((s) => {
this.melodies = data.melodies.map(s => {
const tmp = new SoundsMelody();

@@ -27,3 +27,3 @@ tmp.load(s);

if (data.notes !== undefined) {
this.notes = data.notes.map((s) => {
this.notes = data.notes.map(s => {
const tmp = new SoundsNote_js_1.SoundsNote();

@@ -30,0 +30,0 @@ tmp.load(s);

@@ -5,2 +5,3 @@ "use strict";

const engine_1 = require("@tsparticles/engine");
const enums_js_1 = require("./enums.js");
const utils_js_1 = require("./utils.js");

@@ -40,3 +41,3 @@ const zIndexOffset = 1, rightOffset = 1, minVolume = 0;

constructor(container, engine) {
this._addBuffer = (audioCtx) => {
this._addBuffer = audioCtx => {
const buffer = audioCtx.createBufferSource();

@@ -46,3 +47,3 @@ this._audioSources.push(buffer);

};
this._addOscillator = (audioCtx) => {
this._addOscillator = audioCtx => {
const oscillator = audioCtx.createOscillator();

@@ -65,3 +66,3 @@ this._audioSources.push(oscillator);

if (!this._container || !!this._container.muted || this._container.destroyed) {
(0, engine_1.executeOnSingleOrMultiple)(event.event, (item) => {
(0, engine_1.executeOnSingleOrMultiple)(event.event, item => {
this._engine.removeEventListener(item, cb);

@@ -81,3 +82,3 @@ });

if (melody.melodies.length) {
await Promise.allSettled(melody.melodies.map((m) => this._playNote(m.notes, defaultNoteIndex, melody.loop)));
await Promise.allSettled(melody.melodies.map(m => this._playNote(m.notes, defaultNoteIndex, melody.loop)));
}

@@ -94,3 +95,3 @@ else {

};
(0, engine_1.executeOnSingleOrMultiple)(event.event, (item) => {
(0, engine_1.executeOnSingleOrMultiple)(event.event, item => {
this._engine.addEventListener(item, cb);

@@ -110,5 +111,5 @@ });

container.audioContext = undefined;
this._engine.dispatchEvent("soundsMuted", { container: this._container });
this._engine.dispatchEvent(enums_js_1.SoundsEventType.mute, { container: this._container });
};
this._playBuffer = (audio) => {
this._playBuffer = audio => {
const audioBuffer = this._audioMap.get(audio.source);

@@ -137,3 +138,3 @@ if (!audioBuffer) {

oscillator.start();
return new Promise((resolve) => {
return new Promise(resolve => {
setTimeout(() => {

@@ -203,3 +204,3 @@ this._removeAudioSource(oscillator);

};
this._removeAudioSource = (source) => {
this._removeAudioSource = source => {
source.stop();

@@ -224,3 +225,3 @@ source.disconnect();

this._initEvents();
this._engine.dispatchEvent("soundsUnmuted", { container: this._container });
this._engine.dispatchEvent(enums_js_1.SoundsEventType.unmute, { container: this._container });
};

@@ -340,3 +341,3 @@ this._updateMuteIcons = () => {

await this.toggleMute();
}, enableIcons = soundsOptions.icons.enable, display = enableIcons ? "block" : "none";
}, enableIcons = soundsOptions.icons.enable, display = enableIcons ? enums_js_1.ImageDisplay.Block : enums_js_1.ImageDisplay.None;
this._muteImg = initImage({

@@ -356,3 +357,3 @@ container,

pos,
display: "none",
display: enums_js_1.ImageDisplay.None,
iconOptions: unmute,

@@ -359,0 +360,0 @@ margin,

@@ -6,2 +6,3 @@ "use strict";

const Sounds_js_1 = require("./Options/Classes/Sounds.js");
const SoundsInstance_js_1 = require("./SoundsInstance.js");
const utils_js_1 = require("./utils.js");

@@ -24,5 +25,4 @@ const generalFirstClickHandler = () => {

}
async getPlugin(container) {
const { SoundsInstance } = await import("./SoundsInstance.js");
return new SoundsInstance(container, this._engine);
getPlugin(container) {
return Promise.resolve(new SoundsInstance_js_1.SoundsInstance(container, this._engine));
}

@@ -29,0 +29,0 @@ loadOptions(options, source) {

@@ -1,1 +0,10 @@

export {};
export var SoundsEventType;
(function (SoundsEventType) {
SoundsEventType["mute"] = "soundsMuted";
SoundsEventType["unmute"] = "soundsUnmuted";
})(SoundsEventType || (SoundsEventType = {}));
export var ImageDisplay;
(function (ImageDisplay) {
ImageDisplay["Block"] = "block";
ImageDisplay["None"] = "none";
})(ImageDisplay || (ImageDisplay = {}));

@@ -0,4 +1,4 @@

import { SoundsPlugin } from "./SoundsPlugin.js";
export async function loadSoundsPlugin(engine, refresh = true) {
const { SoundsPlugin } = await import("./SoundsPlugin.js");
await engine.addPlugin(new SoundsPlugin(engine), refresh);
}

@@ -23,3 +23,3 @@ import { SoundsEvent } from "./SoundsEvent.js";

if (data.events !== undefined) {
this.events = data.events.map((t) => {
this.events = data.events.map(t => {
const event = new SoundsEvent();

@@ -26,0 +26,0 @@ event.load(t);

@@ -19,3 +19,3 @@ import { isArray, isFunction, isString, } from "@tsparticles/engine";

if (isArray(data.audio)) {
this.audio = data.audio.map((s) => {
this.audio = data.audio.map(s => {
const tmp = new SoundsAudio();

@@ -32,3 +32,3 @@ tmp.load(s);

if (data.notes !== undefined) {
this.notes = data.notes.map((t) => {
this.notes = data.notes.map(t => {
const tmp = new SoundsNote();

@@ -40,3 +40,3 @@ tmp.load(t);

if (data.melodies !== undefined) {
this.melodies = data.melodies.map((t) => {
this.melodies = data.melodies.map(t => {
const tmp = new SoundsMelody();

@@ -43,0 +43,0 @@ tmp.load(t);

@@ -16,3 +16,3 @@ import { SoundsNote } from "./SoundsNote.js";

if (data.melodies !== undefined) {
this.melodies = data.melodies.map((s) => {
this.melodies = data.melodies.map(s => {
const tmp = new SoundsMelody();

@@ -24,3 +24,3 @@ tmp.load(s);

if (data.notes !== undefined) {
this.notes = data.notes.map((s) => {
this.notes = data.notes.map(s => {
const tmp = new SoundsNote();

@@ -27,0 +27,0 @@ tmp.load(s);

import { clamp, executeOnSingleOrMultiple, getLogger, isArray, isNumber, itemFromArray, itemFromSingleOrMultiple, mouseDownEvent, percentDenominator, touchStartEvent, } from "@tsparticles/engine";
import { ImageDisplay, SoundsEventType } from "./enums.js";
import { getNoteFrequency, isWindowMuted, unmuteWindow } from "./utils.js";

@@ -36,3 +37,3 @@ const zIndexOffset = 1, rightOffset = 1, minVolume = 0;

constructor(container, engine) {
this._addBuffer = (audioCtx) => {
this._addBuffer = audioCtx => {
const buffer = audioCtx.createBufferSource();

@@ -42,3 +43,3 @@ this._audioSources.push(buffer);

};
this._addOscillator = (audioCtx) => {
this._addOscillator = audioCtx => {
const oscillator = audioCtx.createOscillator();

@@ -61,3 +62,3 @@ this._audioSources.push(oscillator);

if (!this._container || !!this._container.muted || this._container.destroyed) {
executeOnSingleOrMultiple(event.event, (item) => {
executeOnSingleOrMultiple(event.event, item => {
this._engine.removeEventListener(item, cb);

@@ -77,3 +78,3 @@ });

if (melody.melodies.length) {
await Promise.allSettled(melody.melodies.map((m) => this._playNote(m.notes, defaultNoteIndex, melody.loop)));
await Promise.allSettled(melody.melodies.map(m => this._playNote(m.notes, defaultNoteIndex, melody.loop)));
}

@@ -90,3 +91,3 @@ else {

};
executeOnSingleOrMultiple(event.event, (item) => {
executeOnSingleOrMultiple(event.event, item => {
this._engine.addEventListener(item, cb);

@@ -106,5 +107,5 @@ });

container.audioContext = undefined;
this._engine.dispatchEvent("soundsMuted", { container: this._container });
this._engine.dispatchEvent(SoundsEventType.mute, { container: this._container });
};
this._playBuffer = (audio) => {
this._playBuffer = audio => {
const audioBuffer = this._audioMap.get(audio.source);

@@ -133,3 +134,3 @@ if (!audioBuffer) {

oscillator.start();
return new Promise((resolve) => {
return new Promise(resolve => {
setTimeout(() => {

@@ -199,3 +200,3 @@ this._removeAudioSource(oscillator);

};
this._removeAudioSource = (source) => {
this._removeAudioSource = source => {
source.stop();

@@ -220,3 +221,3 @@ source.disconnect();

this._initEvents();
this._engine.dispatchEvent("soundsUnmuted", { container: this._container });
this._engine.dispatchEvent(SoundsEventType.unmute, { container: this._container });
};

@@ -336,3 +337,3 @@ this._updateMuteIcons = () => {

await this.toggleMute();
}, enableIcons = soundsOptions.icons.enable, display = enableIcons ? "block" : "none";
}, enableIcons = soundsOptions.icons.enable, display = enableIcons ? ImageDisplay.Block : ImageDisplay.None;
this._muteImg = initImage({

@@ -352,3 +353,3 @@ container,

pos,
display: "none",
display: ImageDisplay.None,
iconOptions: unmute,

@@ -355,0 +356,0 @@ margin,

import { mouseDownEvent, touchStartEvent, } from "@tsparticles/engine";
import { Sounds } from "./Options/Classes/Sounds.js";
import { SoundsInstance } from "./SoundsInstance.js";
import { unmuteWindow } from "./utils.js";

@@ -20,5 +21,4 @@ const generalFirstClickHandler = () => {

}
async getPlugin(container) {
const { SoundsInstance } = await import("./SoundsInstance.js");
return new SoundsInstance(container, this._engine);
getPlugin(container) {
return Promise.resolve(new SoundsInstance(container, this._engine));
}

@@ -25,0 +25,0 @@ loadOptions(options, source) {

{
"name": "@tsparticles/plugin-sounds",
"version": "3.3.0",
"version": "3.4.0",
"description": "tsParticles sounds plugin",

@@ -89,3 +89,3 @@ "homepage": "https://particles.js.org",

"dependencies": {
"@tsparticles/engine": "^3.3.0"
"@tsparticles/engine": "^3.4.0"
},

@@ -92,0 +92,0 @@ "publishConfig": {

@@ -7,3 +7,3 @@ /*!

* How to use? : Check the GitHub README
* v3.3.0
* v3.4.0
*/

@@ -32,2 +32,112 @@ /*

/***/ "./dist/browser/Options/Classes/Sounds.js":
/*!************************************************!*\
!*** ./dist/browser/Options/Classes/Sounds.js ***!
\************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
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?");
/***/ }),
/***/ "./dist/browser/Options/Classes/SoundsAudio.js":
/*!*****************************************************!*\
!*** ./dist/browser/Options/Classes/SoundsAudio.js ***!
\*****************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
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?");
/***/ }),
/***/ "./dist/browser/Options/Classes/SoundsEvent.js":
/*!*****************************************************!*\
!*** ./dist/browser/Options/Classes/SoundsEvent.js ***!
\*****************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
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?");
/***/ }),
/***/ "./dist/browser/Options/Classes/SoundsIcon.js":
/*!****************************************************!*\
!*** ./dist/browser/Options/Classes/SoundsIcon.js ***!
\****************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
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?");
/***/ }),
/***/ "./dist/browser/Options/Classes/SoundsIcons.js":
/*!*****************************************************!*\
!*** ./dist/browser/Options/Classes/SoundsIcons.js ***!
\*****************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
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?");
/***/ }),
/***/ "./dist/browser/Options/Classes/SoundsMelody.js":
/*!******************************************************!*\
!*** ./dist/browser/Options/Classes/SoundsMelody.js ***!
\******************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
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?");
/***/ }),
/***/ "./dist/browser/Options/Classes/SoundsNote.js":
/*!****************************************************!*\
!*** ./dist/browser/Options/Classes/SoundsNote.js ***!
\****************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
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?");
/***/ }),
/***/ "./dist/browser/Options/Classes/SoundsVolume.js":
/*!******************************************************!*\
!*** ./dist/browser/Options/Classes/SoundsVolume.js ***!
\******************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
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?");
/***/ }),
/***/ "./dist/browser/SoundsInstance.js":
/*!****************************************!*\
!*** ./dist/browser/SoundsInstance.js ***!
\****************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
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?");
/***/ }),
/***/ "./dist/browser/SoundsPlugin.js":
/*!**************************************!*\
!*** ./dist/browser/SoundsPlugin.js ***!
\**************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
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?");
/***/ }),
/***/ "./dist/browser/enums.js":
/*!*******************************!*\
!*** ./dist/browser/enums.js ***!
\*******************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
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?");
/***/ }),
/***/ "./dist/browser/index.js":

@@ -39,6 +149,16 @@ /*!*******************************!*\

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?");
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?");
/***/ }),
/***/ "./dist/browser/utils.js":
/*!*******************************!*\
!*** ./dist/browser/utils.js ***!
\*******************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
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?");
/***/ }),
/***/ "@tsparticles/engine":

@@ -80,5 +200,2 @@ /*!*********************************************************************************************************************************!*\

/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = __webpack_modules__;
/******/
/************************************************************************/

@@ -109,36 +226,2 @@ /******/ /* webpack/runtime/compat get default export */

/******/
/******/ /* webpack/runtime/ensure chunk */
/******/ (() => {
/******/ __webpack_require__.f = {};
/******/ // This file contains only the entry chunk.
/******/ // The chunk loading function for additional chunks
/******/ __webpack_require__.e = (chunkId) => {
/******/ return Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {
/******/ __webpack_require__.f[key](chunkId, promises);
/******/ return promises;
/******/ }, []));
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/get javascript chunk filename */
/******/ (() => {
/******/ // This function allow to reference async chunks
/******/ __webpack_require__.u = (chunkId) => {
/******/ // return url for filenames based on template
/******/ return "" + chunkId + ".js";
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/global */
/******/ (() => {
/******/ __webpack_require__.g = (function() {
/******/ if (typeof globalThis === 'object') return globalThis;
/******/ try {
/******/ return this || new Function('return this')();
/******/ } catch (e) {
/******/ if (typeof window === 'object') return window;
/******/ }
/******/ })();
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */

@@ -149,48 +232,2 @@ /******/ (() => {

/******/
/******/ /* webpack/runtime/load script */
/******/ (() => {
/******/ var inProgress = {};
/******/ var dataWebpackPrefix = "@tsparticles/plugin-sounds:";
/******/ // loadScript function to load a script via script tag
/******/ __webpack_require__.l = (url, done, key, chunkId) => {
/******/ if(inProgress[url]) { inProgress[url].push(done); return; }
/******/ var script, needAttach;
/******/ if(key !== undefined) {
/******/ var scripts = document.getElementsByTagName("script");
/******/ for(var i = 0; i < scripts.length; i++) {
/******/ var s = scripts[i];
/******/ if(s.getAttribute("src") == url || s.getAttribute("data-webpack") == dataWebpackPrefix + key) { script = s; break; }
/******/ }
/******/ }
/******/ if(!script) {
/******/ needAttach = true;
/******/ script = document.createElement('script');
/******/
/******/ script.charset = 'utf-8';
/******/ script.timeout = 120;
/******/ if (__webpack_require__.nc) {
/******/ script.setAttribute("nonce", __webpack_require__.nc);
/******/ }
/******/ script.setAttribute("data-webpack", dataWebpackPrefix + key);
/******/
/******/ script.src = url;
/******/ }
/******/ inProgress[url] = [done];
/******/ var onScriptComplete = (prev, event) => {
/******/ // avoid mem leaks in IE.
/******/ script.onerror = script.onload = null;
/******/ clearTimeout(timeout);
/******/ var doneFns = inProgress[url];
/******/ delete inProgress[url];
/******/ script.parentNode && script.parentNode.removeChild(script);
/******/ doneFns && doneFns.forEach((fn) => (fn(event)));
/******/ if(prev) return prev(event);
/******/ }
/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
/******/ script.onload = onScriptComplete.bind(null, script.onload);
/******/ needAttach && document.head.appendChild(script);
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */

@@ -207,117 +244,2 @@ /******/ (() => {

/******/
/******/ /* webpack/runtime/publicPath */
/******/ (() => {
/******/ var scriptUrl;
/******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
/******/ var document = __webpack_require__.g.document;
/******/ if (!scriptUrl && document) {
/******/ if (document.currentScript)
/******/ scriptUrl = document.currentScript.src;
/******/ if (!scriptUrl) {
/******/ var scripts = document.getElementsByTagName("script");
/******/ if(scripts.length) {
/******/ var i = scripts.length - 1;
/******/ while (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;
/******/ }
/******/ }
/******/ }
/******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
/******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
/******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
/******/ scriptUrl = scriptUrl.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
/******/ __webpack_require__.p = scriptUrl;
/******/ })();
/******/
/******/ /* webpack/runtime/jsonp chunk loading */
/******/ (() => {
/******/ // no baseURI
/******/
/******/ // object to store loaded and loading chunks
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
/******/ var installedChunks = {
/******/ "tsparticles.plugin.sounds": 0
/******/ };
/******/
/******/ __webpack_require__.f.j = (chunkId, promises) => {
/******/ // JSONP chunk loading for javascript
/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
/******/ if(installedChunkData !== 0) { // 0 means "already installed".
/******/
/******/ // a Promise means "currently loading".
/******/ if(installedChunkData) {
/******/ promises.push(installedChunkData[2]);
/******/ } else {
/******/ if(true) { // all chunks have JS
/******/ // setup Promise in chunk cache
/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
/******/ promises.push(installedChunkData[2] = promise);
/******/
/******/ // start chunk loading
/******/ var url = __webpack_require__.p + __webpack_require__.u(chunkId);
/******/ // create error before stack unwound to get useful stacktrace later
/******/ var error = new Error();
/******/ var loadingEnded = (event) => {
/******/ if(__webpack_require__.o(installedChunks, chunkId)) {
/******/ installedChunkData = installedChunks[chunkId];
/******/ if(installedChunkData !== 0) installedChunks[chunkId] = undefined;
/******/ if(installedChunkData) {
/******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
/******/ var realSrc = event && event.target && event.target.src;
/******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
/******/ error.name = 'ChunkLoadError';
/******/ error.type = errorType;
/******/ error.request = realSrc;
/******/ installedChunkData[1](error);
/******/ }
/******/ }
/******/ };
/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
/******/ }
/******/ }
/******/ }
/******/ };
/******/
/******/ // no prefetching
/******/
/******/ // no preloaded
/******/
/******/ // no HMR
/******/
/******/ // no HMR manifest
/******/
/******/ // no on chunks loaded
/******/
/******/ // install a JSONP callback for chunk loading
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
/******/ var chunkIds = data[0];
/******/ var moreModules = data[1];
/******/ var runtime = data[2];
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
/******/ var moduleId, chunkId, i = 0;
/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
/******/ for(moduleId in moreModules) {
/******/ if(__webpack_require__.o(moreModules, moduleId)) {
/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
/******/ }
/******/ }
/******/ if(runtime) var result = runtime(__webpack_require__);
/******/ }
/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
/******/ installedChunks[chunkId][0]();
/******/ }
/******/ installedChunks[chunkId] = 0;
/******/ }
/******/
/******/ }
/******/
/******/ var chunkLoadingGlobal = this["webpackChunk_tsparticles_plugin_sounds"] = this["webpackChunk_tsparticles_plugin_sounds"] || [];
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
/******/ })();
/******/
/************************************************************************/

@@ -324,0 +246,0 @@ /******/

/*! For license information please see tsparticles.plugin.sounds.min.js.LICENSE.txt */
!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})()));
!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={};return(()=>{n.r(s),n.d(s,{loadSoundsPlugin:()=>M});var t,e,i=n(303);class o{constructor(){this.loop=!1,this.source=""}load(t){void 0!==t&&((0,i.isObject)(t)?(void 0!==t.loop&&(this.loop=t.loop),void 0!==t.source&&(this.source=t.source)):this.source=t)}}class a{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 c{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 c;return e.load(t),e}))),void 0!==t.notes&&(this.notes=t.notes.map((t=>{const e=new a;return e.load(t),e}))))}}class u{constructor(){this.event=[],this.notes=[]}load(t){if(t&&(void 0!==t.event&&(this.event=t.event),void 0!==t.audio&&((0,i.isArray)(t.audio)?this.audio=t.audio.map((t=>{const e=new o;return e.load(t),e})):(this.audio=new o,this.audio.load(t.audio))),void 0!==t.notes&&(this.notes=t.notes.map((t=>{const e=new a;return e.load(t),e}))),void 0!==t.melodies&&(this.melodies=t.melodies.map((t=>{const e=new c;return e.load(t),e}))),t.filter))if((0,i.isString)(t.filter)){const e=window[t.filter];(0,i.isFunction)(e)&&(this.filter=e)}else this.filter=t.filter}}class l{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 r{constructor(){this.mute=new l,this.unmute=new l,this.volumeDown=new l,this.volumeUp=new l,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 d{constructor(){this.value=100,this.max=100,this.min=0,this.step=10}load(t){void 0!==t&&((0,i.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 h{constructor(){this.autoPlay=!0,this.enable=!1,this.events=[],this.icons=new r,this.volume=new d}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 u;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"}(t||(t={})),function(t){t.Block="block",t.None="none"}(e||(e={}));const m=new Map;function v(t){const e=/(([A-G]b?)(\d))|pause/i.exec(t);if(!e?.length)return;const i=e[2]||e[0],n=m.get(i);return n?n[parseInt(e[3]||"0")]:void 0}m.set("C",[16.35,32.7,65.41,130.81,261.63,523.25,1046.5,2093,4186.01]),m.set("Db",[17.32,34.65,69.3,138.59,277.18,554.37,1108.73,2217.46,4434.92]),m.set("D",[18.35,36.71,73.42,146.83,293.66,587.33,1174.66,2349.32,4698.63]),m.set("Eb",[19.45,38.89,77.78,155.56,311.13,622.25,1244.51,2489.02,4978.03]),m.set("E",[20.6,41.2,82.41,164.81,329.63,659.25,1318.51,2637.02,5274.04]),m.set("F",[21.83,43.65,87.31,174.61,349.23,698.46,1396.91,2793.83,5587.65]),m.set("Gb",[23.12,46.25,92.5,185,369.99,739.99,1479.98,2959.96,5919.91]),m.set("G",[24.5,49,98,196,392,783.99,1567.98,3135.96,6271.93]),m.set("Ab",[25.96,51.91,103.83,207.65,415.3,830.61,1661.22,3322.44,6644.88]),m.set("A",[27.5,55,110,220,440,880,1760,3520,7040]),m.set("Bb",[29.14,58.27,116.54,233.08,466.16,932.33,1864.66,3729.31,7458.62]),m.set("B",[30.87,61.74,123.47,246.94,493.88,987.77,1975.53,3951.07,7902.13]),m.set("pause",[0]);let p=!0;const f=()=>p,g=()=>{p=!1},_=1;function w(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+_}`,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+_,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 y(t){t&&t.remove()}class x{constructor(e,n){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=n=>{(async()=>{const s=t.filter&&!t.filter(n);if(this._container!==n.container)return;if(!this._container||this._container.muted||this._container.destroyed)return void(0,i.executeOnSingleOrMultiple)(t.event,(t=>{this._engine.removeEventListener(t,e)}));if(s)return;if(t.audio)this._playBuffer((0,i.itemFromSingleOrMultiple)(t.audio));else if(t.melodies){const e=(0,i.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,i.itemFromArray)(t.notes);await this._playNote([e],0,!1)}})()};(0,i.executeOnSingleOrMultiple)(t.event,(t=>{this._engine.addEventListener(t,e)}))}},this._mute=async()=>{const e=this._container,i=this._getAudioContext();for(const t of this._audioSources)this._removeAudioSource(t);this._gain&&this._gain.disconnect(),await i.close(),e.audioContext=void 0,this._engine.dispatchEvent(t.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,n)=>{if(this._container.muted)return;const s=t[e];if(!s)return;const o=s.value,a=(0,i.executeOnSingleOrMultiple)(o,(async(i,n)=>this._playNoteValue(t,e,n)));await((0,i.isArray)(a)?Promise.allSettled(a):a);let c=e+1;n&&c>=t.length&&(c%=t.length),this._container.muted||await this._playNote(t,c,n)},this._playNoteValue=async(t,e,n)=>{const s=t[e];if(!s)return;const o=(0,i.itemFromSingleOrMultiple)(s.value,n,!0);try{const t=v(o);if(!(0,i.isNumber)(t))return;await this._playFrequency(t,s.duration)}catch(t){(0,i.getLogger)().error(t)}},this._removeAudioSource=t=>{t.stop(),t.disconnect();this._audioSources.splice(this._audioSources.indexOf(t),1)},this._unmute=()=>{const e=this._container.actualOptions.sounds;if(!e)return;const n=this._getAudioContext();this._audioSources||(this._audioSources=[]);const s=n.createGain();s.connect(n.destination),s.gain.value=e.volume.value/i.percentDenominator,this._gain=s,this._initEvents(),this._engine.dispatchEvent(t.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,i.clamp)(this._volume,e.volume.min,e.volume.max);let n=!1;this._volume<=0&&!t.muted?(this._volume=0,t.muted=!0,n=!0):this._volume>0&&t.muted&&(t.muted=!1,n=!0),n&&(this._updateMuteIcons(),await this._updateMuteStatus()),this._gain?.gain&&(this._gain.gain.value=this._volume/i.percentDenominator)},this._container=e,this._engine=n,this._volume=0,this._audioSources=[],this._audioMap=new Map}async init(){const t=this._container.actualOptions.sounds;if(!t?.enable)return;if(t.autoPlay&&f()){const t=()=>{removeEventListener(i.mouseDownEvent,t),removeEventListener(i.touchStartEvent,t),g(),this.unmute()},e={capture:!0,once:!0};addEventListener(i.mouseDownEvent,t,e),addEventListener(i.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,i.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,i=t.actualOptions,n=i.sounds;if(!n?.enable||!t.canvas.element)return;t.muted=!0;const s=t.canvas.element,o={top:s.offsetTop,right:s.offsetLeft+s.offsetWidth},{mute:a,unmute:c,volumeDown:u,volumeUp:l}=n.icons,r=async()=>{await this.toggleMute()},d=n.icons.enable?e.Block:e.None;this._muteImg=w({container:t,options:i,pos:o,display:d,iconOptions:a,margin:10,rightOffsets:[u.width,l.width],clickCb:r}),this._unmuteImg=w({container:t,options:i,pos:o,display:e.None,iconOptions:c,margin:10,rightOffsets:[u.width,l.width],clickCb:r}),this._volumeDownImg=w({container:t,options:i,pos:o,display:d,iconOptions:u,margin:10,rightOffsets:[l.width],clickCb:async()=>{await this.volumeDown()}}),this._volumeUpImg=w({container:t,options:i,pos:o,display:d,iconOptions:l,margin:10,rightOffsets:[],clickCb:async()=>{await this.volumeUp()}}),!f()&&n.autoPlay&&await this.unmute()}stop(){this._container.muted=!0,(async()=>{await this._mute(),y(this._muteImg),y(this._unmuteImg),y(this._volumeDownImg),y(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 b=()=>{removeEventListener(i.mouseDownEvent,b),removeEventListener(i.touchStartEvent,b),g()};class C{constructor(t){this.id="sounds",this._engine=t;const e={capture:!0,once:!0};addEventListener(i.mouseDownEvent,b,e),addEventListener(i.touchStartEvent,b,e)}getPlugin(t){return Promise.resolve(new x(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 h),i.load(e?.sounds)}needsPlugin(t){return t?.sounds?.enable??!1}}async function M(t,e=!0){await t.addPlugin(new C(t),e)}})(),s})()));

@@ -1,1 +0,1 @@

/*! tsParticles Sounds Plugin v3.3.0 by Matteo Bruni */
/*! tsParticles Sounds Plugin v3.4.0 by Matteo Bruni */

@@ -1,8 +0,8 @@

export declare const enum SoundsEventType {
export declare enum SoundsEventType {
mute = "soundsMuted",
unmute = "soundsUnmuted"
}
export declare const enum ImageDisplay {
export declare enum ImageDisplay {
Block = "block",
None = "none"
}
import { type Container, type Engine, type IPlugin, type RecursivePartial } from "@tsparticles/engine";
import type { ISoundsOptions, SoundsOptions } from "./types.js";
import type { SoundsInstance } from "./SoundsInstance.js";
import { SoundsInstance } from "./SoundsInstance.js";
export declare class SoundsPlugin implements IPlugin {

@@ -5,0 +5,0 @@ readonly id: string;

@@ -12,2 +12,13 @@ (function (factory) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.ImageDisplay = exports.SoundsEventType = void 0;
var SoundsEventType;
(function (SoundsEventType) {
SoundsEventType["mute"] = "soundsMuted";
SoundsEventType["unmute"] = "soundsUnmuted";
})(SoundsEventType || (exports.SoundsEventType = SoundsEventType = {}));
var ImageDisplay;
(function (ImageDisplay) {
ImageDisplay["Block"] = "block";
ImageDisplay["None"] = "none";
})(ImageDisplay || (exports.ImageDisplay = ImageDisplay = {}));
});

@@ -1,24 +0,1 @@

var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
(function (factory) {

@@ -30,14 +7,13 @@ if (typeof module === "object" && typeof module.exports === "object") {

else if (typeof define === "function" && define.amd) {
define(["require", "exports"], factory);
define(["require", "exports", "./SoundsPlugin.js"], factory);
}
})(function (require, exports) {
"use strict";
var __syncRequire = typeof module === "object" && typeof module.exports === "object";
Object.defineProperty(exports, "__esModule", { value: true });
exports.loadSoundsPlugin = void 0;
const SoundsPlugin_js_1 = require("./SoundsPlugin.js");
async function loadSoundsPlugin(engine, refresh = true) {
const { SoundsPlugin } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./SoundsPlugin.js"))) : new Promise((resolve_1, reject_1) => { require(["./SoundsPlugin.js"], resolve_1, reject_1); }).then(__importStar));
await engine.addPlugin(new SoundsPlugin(engine), refresh);
await engine.addPlugin(new SoundsPlugin_js_1.SoundsPlugin(engine), refresh);
}
exports.loadSoundsPlugin = loadSoundsPlugin;
});

@@ -35,3 +35,3 @@ (function (factory) {

if (data.events !== undefined) {
this.events = data.events.map((t) => {
this.events = data.events.map(t => {
const event = new SoundsEvent_js_1.SoundsEvent();

@@ -38,0 +38,0 @@ event.load(t);

@@ -31,3 +31,3 @@ (function (factory) {

if ((0, engine_1.isArray)(data.audio)) {
this.audio = data.audio.map((s) => {
this.audio = data.audio.map(s => {
const tmp = new SoundsAudio_js_1.SoundsAudio();

@@ -44,3 +44,3 @@ tmp.load(s);

if (data.notes !== undefined) {
this.notes = data.notes.map((t) => {
this.notes = data.notes.map(t => {
const tmp = new SoundsNote_js_1.SoundsNote();

@@ -52,3 +52,3 @@ tmp.load(t);

if (data.melodies !== undefined) {
this.melodies = data.melodies.map((t) => {
this.melodies = data.melodies.map(t => {
const tmp = new SoundsMelody_js_1.SoundsMelody();

@@ -55,0 +55,0 @@ tmp.load(t);

@@ -28,3 +28,3 @@ (function (factory) {

if (data.melodies !== undefined) {
this.melodies = data.melodies.map((s) => {
this.melodies = data.melodies.map(s => {
const tmp = new SoundsMelody();

@@ -36,3 +36,3 @@ tmp.load(s);

if (data.notes !== undefined) {
this.notes = data.notes.map((s) => {
this.notes = data.notes.map(s => {
const tmp = new SoundsNote_js_1.SoundsNote();

@@ -39,0 +39,0 @@ tmp.load(s);

@@ -7,3 +7,3 @@ (function (factory) {

else if (typeof define === "function" && define.amd) {
define(["require", "exports", "@tsparticles/engine", "./utils.js"], factory);
define(["require", "exports", "@tsparticles/engine", "./enums.js", "./utils.js"], factory);
}

@@ -15,2 +15,3 @@ })(function (require, exports) {

const engine_1 = require("@tsparticles/engine");
const enums_js_1 = require("./enums.js");
const utils_js_1 = require("./utils.js");

@@ -50,3 +51,3 @@ const zIndexOffset = 1, rightOffset = 1, minVolume = 0;

constructor(container, engine) {
this._addBuffer = (audioCtx) => {
this._addBuffer = audioCtx => {
const buffer = audioCtx.createBufferSource();

@@ -56,3 +57,3 @@ this._audioSources.push(buffer);

};
this._addOscillator = (audioCtx) => {
this._addOscillator = audioCtx => {
const oscillator = audioCtx.createOscillator();

@@ -75,3 +76,3 @@ this._audioSources.push(oscillator);

if (!this._container || !!this._container.muted || this._container.destroyed) {
(0, engine_1.executeOnSingleOrMultiple)(event.event, (item) => {
(0, engine_1.executeOnSingleOrMultiple)(event.event, item => {
this._engine.removeEventListener(item, cb);

@@ -91,3 +92,3 @@ });

if (melody.melodies.length) {
await Promise.allSettled(melody.melodies.map((m) => this._playNote(m.notes, defaultNoteIndex, melody.loop)));
await Promise.allSettled(melody.melodies.map(m => this._playNote(m.notes, defaultNoteIndex, melody.loop)));
}

@@ -104,3 +105,3 @@ else {

};
(0, engine_1.executeOnSingleOrMultiple)(event.event, (item) => {
(0, engine_1.executeOnSingleOrMultiple)(event.event, item => {
this._engine.addEventListener(item, cb);

@@ -120,5 +121,5 @@ });

container.audioContext = undefined;
this._engine.dispatchEvent("soundsMuted", { container: this._container });
this._engine.dispatchEvent(enums_js_1.SoundsEventType.mute, { container: this._container });
};
this._playBuffer = (audio) => {
this._playBuffer = audio => {
const audioBuffer = this._audioMap.get(audio.source);

@@ -147,3 +148,3 @@ if (!audioBuffer) {

oscillator.start();
return new Promise((resolve) => {
return new Promise(resolve => {
setTimeout(() => {

@@ -213,3 +214,3 @@ this._removeAudioSource(oscillator);

};
this._removeAudioSource = (source) => {
this._removeAudioSource = source => {
source.stop();

@@ -234,3 +235,3 @@ source.disconnect();

this._initEvents();
this._engine.dispatchEvent("soundsUnmuted", { container: this._container });
this._engine.dispatchEvent(enums_js_1.SoundsEventType.unmute, { container: this._container });
};

@@ -350,3 +351,3 @@ this._updateMuteIcons = () => {

await this.toggleMute();
}, enableIcons = soundsOptions.icons.enable, display = enableIcons ? "block" : "none";
}, enableIcons = soundsOptions.icons.enable, display = enableIcons ? enums_js_1.ImageDisplay.Block : enums_js_1.ImageDisplay.None;
this._muteImg = initImage({

@@ -366,3 +367,3 @@ container,

pos,
display: "none",
display: enums_js_1.ImageDisplay.None,
iconOptions: unmute,

@@ -369,0 +370,0 @@ margin,

@@ -1,24 +0,1 @@

var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
(function (factory) {

@@ -30,7 +7,6 @@ if (typeof module === "object" && typeof module.exports === "object") {

else if (typeof define === "function" && define.amd) {
define(["require", "exports", "@tsparticles/engine", "./Options/Classes/Sounds.js", "./utils.js"], factory);
define(["require", "exports", "@tsparticles/engine", "./Options/Classes/Sounds.js", "./SoundsInstance.js", "./utils.js"], factory);
}
})(function (require, exports) {
"use strict";
var __syncRequire = typeof module === "object" && typeof module.exports === "object";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -40,2 +16,3 @@ exports.SoundsPlugin = void 0;

const Sounds_js_1 = require("./Options/Classes/Sounds.js");
const SoundsInstance_js_1 = require("./SoundsInstance.js");
const utils_js_1 = require("./utils.js");

@@ -58,5 +35,4 @@ const generalFirstClickHandler = () => {

}
async getPlugin(container) {
const { SoundsInstance } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./SoundsInstance.js"))) : new Promise((resolve_1, reject_1) => { require(["./SoundsInstance.js"], resolve_1, reject_1); }).then(__importStar));
return new SoundsInstance(container, this._engine);
getPlugin(container) {
return Promise.resolve(new SoundsInstance_js_1.SoundsInstance(container, this._engine));
}

@@ -63,0 +39,0 @@ loadOptions(options, source) {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc