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.0.1 to 3.0.2

77

browser/SoundsInstance.js

@@ -45,31 +45,34 @@ import { clamp, executeOnSingleOrMultiple, getLogger, isArray, isNumber, itemFromArray, itemFromSingleOrMultiple, } from "@tsparticles/engine";

for (const event of soundsOptions.events) {
const cb = async (args) => {
if (this._container !== args.container) {
return;
}
if (!this._container || this._container.muted || this._container.destroyed) {
executeOnSingleOrMultiple(event.event, (item) => {
this._engine.removeEventListener(item, cb);
});
return;
}
if (event.filter && !event.filter(args)) {
return;
}
if (event.audio) {
this._playBuffer(itemFromSingleOrMultiple(event.audio));
}
else if (event.melodies) {
const melody = itemFromArray(event.melodies);
if (melody.melodies.length) {
await Promise.allSettled(melody.melodies.map((m) => this._playNote(m.notes, 0, melody.loop)));
const cb = (args) => {
(async () => {
const filterNotValid = event.filter && !event.filter(args);
if (this._container !== args.container) {
return;
}
else {
await this._playNote(melody.notes, 0, melody.loop);
if (!this._container || this._container.muted || this._container.destroyed) {
executeOnSingleOrMultiple(event.event, (item) => {
this._engine.removeEventListener(item, cb);
});
return;
}
}
else if (event.notes) {
const note = itemFromArray(event.notes);
await this._playNote([note], 0, false);
}
if (filterNotValid) {
return;
}
if (event.audio) {
this._playBuffer(itemFromSingleOrMultiple(event.audio));
}
else if (event.melodies) {
const melody = itemFromArray(event.melodies);
if (melody.melodies.length) {
await Promise.allSettled(melody.melodies.map((m) => this._playNote(m.notes, 0, melody.loop)));
}
else {
await this._playNote(melody.notes, 0, melody.loop);
}
}
else if (event.notes) {
const note = itemFromArray(event.notes);
await this._playNote([note], 0, false);
}
})();
};

@@ -218,8 +221,10 @@ executeOnSingleOrMultiple(event.event, (item) => {

};
this._updateMuteStatus = () => {
this._updateMuteStatus = async () => {
const container = this._container;
if (container.muted) {
await container.audioContext?.suspend();
this._mute();
}
else {
await container.audioContext?.resume();
this._unmute();

@@ -229,3 +234,3 @@ this._playMuteSound();

};
this._updateVolume = () => {
this._updateVolume = async () => {
const container = this._container, soundsOptions = container.actualOptions.sounds;

@@ -248,3 +253,3 @@ if (!soundsOptions?.enable) {

this._updateMuteIcons();
this._updateMuteStatus();
await this._updateMuteStatus();
}

@@ -295,6 +300,6 @@ if (this._gain?.gain) {

}, { mute, unmute, volumeDown, volumeUp } = soundsOptions.icons, margin = 10;
const toggleMute = () => {
const toggleMute = async () => {
container.muted = !container.muted;
this._updateMuteIcons();
this._updateMuteStatus();
await this._updateMuteStatus();
};

@@ -329,3 +334,3 @@ this._muteImg = initImage({

rightOffsets: [volumeUp.width],
clickCb: () => {
clickCb: async () => {
if (container.muted) {

@@ -335,3 +340,3 @@ this._volume = 0;

this._volume -= soundsOptions.volume.step;
this._updateVolume();
await this._updateVolume();
},

@@ -347,3 +352,3 @@ });

rightOffsets: [],
clickCb: () => {
clickCb: async () => {
if (container.muted) {

@@ -353,3 +358,3 @@ this._volume = 0;

this._volume += soundsOptions.volume.step;
this._updateVolume();
await this._updateVolume();
},

@@ -356,0 +361,0 @@ });

@@ -48,31 +48,34 @@ "use strict";

for (const event of soundsOptions.events) {
const cb = async (args) => {
if (this._container !== args.container) {
return;
}
if (!this._container || this._container.muted || this._container.destroyed) {
(0, engine_1.executeOnSingleOrMultiple)(event.event, (item) => {
this._engine.removeEventListener(item, cb);
});
return;
}
if (event.filter && !event.filter(args)) {
return;
}
if (event.audio) {
this._playBuffer((0, engine_1.itemFromSingleOrMultiple)(event.audio));
}
else if (event.melodies) {
const melody = (0, engine_1.itemFromArray)(event.melodies);
if (melody.melodies.length) {
await Promise.allSettled(melody.melodies.map((m) => this._playNote(m.notes, 0, melody.loop)));
const cb = (args) => {
(async () => {
const filterNotValid = event.filter && !event.filter(args);
if (this._container !== args.container) {
return;
}
else {
await this._playNote(melody.notes, 0, melody.loop);
if (!this._container || this._container.muted || this._container.destroyed) {
(0, engine_1.executeOnSingleOrMultiple)(event.event, (item) => {
this._engine.removeEventListener(item, cb);
});
return;
}
}
else if (event.notes) {
const note = (0, engine_1.itemFromArray)(event.notes);
await this._playNote([note], 0, false);
}
if (filterNotValid) {
return;
}
if (event.audio) {
this._playBuffer((0, engine_1.itemFromSingleOrMultiple)(event.audio));
}
else if (event.melodies) {
const melody = (0, engine_1.itemFromArray)(event.melodies);
if (melody.melodies.length) {
await Promise.allSettled(melody.melodies.map((m) => this._playNote(m.notes, 0, melody.loop)));
}
else {
await this._playNote(melody.notes, 0, melody.loop);
}
}
else if (event.notes) {
const note = (0, engine_1.itemFromArray)(event.notes);
await this._playNote([note], 0, false);
}
})();
};

@@ -221,8 +224,10 @@ (0, engine_1.executeOnSingleOrMultiple)(event.event, (item) => {

};
this._updateMuteStatus = () => {
this._updateMuteStatus = async () => {
const container = this._container;
if (container.muted) {
await container.audioContext?.suspend();
this._mute();
}
else {
await container.audioContext?.resume();
this._unmute();

@@ -232,3 +237,3 @@ this._playMuteSound();

};
this._updateVolume = () => {
this._updateVolume = async () => {
const container = this._container, soundsOptions = container.actualOptions.sounds;

@@ -251,3 +256,3 @@ if (!soundsOptions?.enable) {

this._updateMuteIcons();
this._updateMuteStatus();
await this._updateMuteStatus();
}

@@ -298,6 +303,6 @@ if (this._gain?.gain) {

}, { mute, unmute, volumeDown, volumeUp } = soundsOptions.icons, margin = 10;
const toggleMute = () => {
const toggleMute = async () => {
container.muted = !container.muted;
this._updateMuteIcons();
this._updateMuteStatus();
await this._updateMuteStatus();
};

@@ -332,3 +337,3 @@ this._muteImg = initImage({

rightOffsets: [volumeUp.width],
clickCb: () => {
clickCb: async () => {
if (container.muted) {

@@ -338,3 +343,3 @@ this._volume = 0;

this._volume -= soundsOptions.volume.step;
this._updateVolume();
await this._updateVolume();
},

@@ -350,3 +355,3 @@ });

rightOffsets: [],
clickCb: () => {
clickCb: async () => {
if (container.muted) {

@@ -356,3 +361,3 @@ this._volume = 0;

this._volume += soundsOptions.volume.step;
this._updateVolume();
await this._updateVolume();
},

@@ -359,0 +364,0 @@ });

@@ -45,31 +45,34 @@ import { clamp, executeOnSingleOrMultiple, getLogger, isArray, isNumber, itemFromArray, itemFromSingleOrMultiple, } from "@tsparticles/engine";

for (const event of soundsOptions.events) {
const cb = async (args) => {
if (this._container !== args.container) {
return;
}
if (!this._container || this._container.muted || this._container.destroyed) {
executeOnSingleOrMultiple(event.event, (item) => {
this._engine.removeEventListener(item, cb);
});
return;
}
if (event.filter && !event.filter(args)) {
return;
}
if (event.audio) {
this._playBuffer(itemFromSingleOrMultiple(event.audio));
}
else if (event.melodies) {
const melody = itemFromArray(event.melodies);
if (melody.melodies.length) {
await Promise.allSettled(melody.melodies.map((m) => this._playNote(m.notes, 0, melody.loop)));
const cb = (args) => {
(async () => {
const filterNotValid = event.filter && !event.filter(args);
if (this._container !== args.container) {
return;
}
else {
await this._playNote(melody.notes, 0, melody.loop);
if (!this._container || this._container.muted || this._container.destroyed) {
executeOnSingleOrMultiple(event.event, (item) => {
this._engine.removeEventListener(item, cb);
});
return;
}
}
else if (event.notes) {
const note = itemFromArray(event.notes);
await this._playNote([note], 0, false);
}
if (filterNotValid) {
return;
}
if (event.audio) {
this._playBuffer(itemFromSingleOrMultiple(event.audio));
}
else if (event.melodies) {
const melody = itemFromArray(event.melodies);
if (melody.melodies.length) {
await Promise.allSettled(melody.melodies.map((m) => this._playNote(m.notes, 0, melody.loop)));
}
else {
await this._playNote(melody.notes, 0, melody.loop);
}
}
else if (event.notes) {
const note = itemFromArray(event.notes);
await this._playNote([note], 0, false);
}
})();
};

@@ -218,8 +221,10 @@ executeOnSingleOrMultiple(event.event, (item) => {

};
this._updateMuteStatus = () => {
this._updateMuteStatus = async () => {
const container = this._container;
if (container.muted) {
await container.audioContext?.suspend();
this._mute();
}
else {
await container.audioContext?.resume();
this._unmute();

@@ -229,3 +234,3 @@ this._playMuteSound();

};
this._updateVolume = () => {
this._updateVolume = async () => {
const container = this._container, soundsOptions = container.actualOptions.sounds;

@@ -248,3 +253,3 @@ if (!soundsOptions?.enable) {

this._updateMuteIcons();
this._updateMuteStatus();
await this._updateMuteStatus();
}

@@ -295,6 +300,6 @@ if (this._gain?.gain) {

}, { mute, unmute, volumeDown, volumeUp } = soundsOptions.icons, margin = 10;
const toggleMute = () => {
const toggleMute = async () => {
container.muted = !container.muted;
this._updateMuteIcons();
this._updateMuteStatus();
await this._updateMuteStatus();
};

@@ -329,3 +334,3 @@ this._muteImg = initImage({

rightOffsets: [volumeUp.width],
clickCb: () => {
clickCb: async () => {
if (container.muted) {

@@ -335,3 +340,3 @@ this._volume = 0;

this._volume -= soundsOptions.volume.step;
this._updateVolume();
await this._updateVolume();
},

@@ -347,3 +352,3 @@ });

rightOffsets: [],
clickCb: () => {
clickCb: async () => {
if (container.muted) {

@@ -353,3 +358,3 @@ this._volume = 0;

this._volume += soundsOptions.volume.step;
this._updateVolume();
await this._updateVolume();
},

@@ -356,0 +361,0 @@ });

{
"name": "@tsparticles/plugin-sounds",
"version": "3.0.1",
"version": "3.0.2",
"description": "tsParticles sounds plugin",

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

"dependencies": {
"@tsparticles/engine": "^3.0.1"
"@tsparticles/engine": "^3.0.2"
},

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

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

* How to use? : Check the GitHub README
* v3.0.1
* v3.0.2
*/

@@ -456,28 +456,31 @@ (function webpackUniversalModuleDefinition(root, factory) {

for (const event of soundsOptions.events) {
const cb = async args => {
if (this._container !== args.container) {
return;
}
if (!this._container || this._container.muted || this._container.destroyed) {
(0,engine_root_window_.executeOnSingleOrMultiple)(event.event, item => {
this._engine.removeEventListener(item, cb);
});
return;
}
if (event.filter && !event.filter(args)) {
return;
}
if (event.audio) {
this._playBuffer((0,engine_root_window_.itemFromSingleOrMultiple)(event.audio));
} else if (event.melodies) {
const melody = (0,engine_root_window_.itemFromArray)(event.melodies);
if (melody.melodies.length) {
await Promise.allSettled(melody.melodies.map(m => this._playNote(m.notes, 0, melody.loop)));
} else {
await this._playNote(melody.notes, 0, melody.loop);
const cb = args => {
(async () => {
const filterNotValid = event.filter && !event.filter(args);
if (this._container !== args.container) {
return;
}
} else if (event.notes) {
const note = (0,engine_root_window_.itemFromArray)(event.notes);
await this._playNote([note], 0, false);
}
if (!this._container || this._container.muted || this._container.destroyed) {
(0,engine_root_window_.executeOnSingleOrMultiple)(event.event, item => {
this._engine.removeEventListener(item, cb);
});
return;
}
if (filterNotValid) {
return;
}
if (event.audio) {
this._playBuffer((0,engine_root_window_.itemFromSingleOrMultiple)(event.audio));
} else if (event.melodies) {
const melody = (0,engine_root_window_.itemFromArray)(event.melodies);
if (melody.melodies.length) {
await Promise.allSettled(melody.melodies.map(m => this._playNote(m.notes, 0, melody.loop)));
} else {
await this._playNote(melody.notes, 0, melody.loop);
}
} else if (event.notes) {
const note = (0,engine_root_window_.itemFromArray)(event.notes);
await this._playNote([note], 0, false);
}
})();
};

@@ -635,7 +638,9 @@ (0,engine_root_window_.executeOnSingleOrMultiple)(event.event, item => {

};
this._updateMuteStatus = () => {
this._updateMuteStatus = async () => {
const container = this._container;
if (container.muted) {
await container.audioContext?.suspend();
this._mute();
} else {
await container.audioContext?.resume();
this._unmute();

@@ -645,3 +650,3 @@ this._playMuteSound();

};
this._updateVolume = () => {
this._updateVolume = async () => {
const container = this._container,

@@ -664,3 +669,3 @@ soundsOptions = container.actualOptions.sounds;

this._updateMuteIcons();
this._updateMuteStatus();
await this._updateMuteStatus();
}

@@ -723,6 +728,6 @@ if (this._gain?.gain) {

margin = 10;
const toggleMute = () => {
const toggleMute = async () => {
container.muted = !container.muted;
this._updateMuteIcons();
this._updateMuteStatus();
await this._updateMuteStatus();
};

@@ -757,3 +762,3 @@ this._muteImg = initImage({

rightOffsets: [volumeUp.width],
clickCb: () => {
clickCb: async () => {
if (container.muted) {

@@ -763,3 +768,3 @@ this._volume = 0;

this._volume -= soundsOptions.volume.step;
this._updateVolume();
await this._updateVolume();
}

@@ -775,3 +780,3 @@ });

rightOffsets: [],
clickCb: () => {
clickCb: async () => {
if (container.muted) {

@@ -781,3 +786,3 @@ this._volume = 0;

this._volume += soundsOptions.volume.step;
this._updateVolume();
await this._updateVolume();
}

@@ -784,0 +789,0 @@ });

/*! For license information please see tsparticles.plugin.sounds.min.js.LICENSE.txt */
!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 s in i)("object"==typeof exports?exports:t)[s]=i[s]}}(this,(t=>(()=>{"use strict";var e={533:e=>{e.exports=t}},i={};function s(t){var o=i[t];if(void 0!==o)return o.exports;var n=i[t]={exports:{}};return e[t](n,n.exports,s),n.exports}s.d=(t,e)=>{for(var i in e)s.o(e,i)&&!s.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),s.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var o={};return(()=>{s.r(o),s.d(o,{loadSoundsPlugin:()=>g});var t=s(533);class e{constructor(){this.loop=!1,this.source=""}load(e){void 0!==e&&((0,t.isObject)(e)?(void 0!==e.loop&&(this.loop=e.loop),void 0!==e.source&&(this.source=e.source)):this.source=e)}}class i{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 n{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 n;return e.load(t),e}))),void 0!==t.notes&&(this.notes=t.notes.map((t=>{const e=new i;return e.load(t),e}))))}}class a{constructor(){this.event=[],this.notes=[]}load(s){s&&(void 0!==s.event&&(this.event=s.event),void 0!==s.audio&&((0,t.isArray)(s.audio)?this.audio=s.audio.map((t=>{const i=new e;return i.load(t),i})):(this.audio=new e,this.audio.load(s.audio))),void 0!==s.notes&&(this.notes=s.notes.map((t=>{const e=new i;return e.load(t),e}))),void 0!==s.melodies&&(this.melodies=s.melodies.map((t=>{const e=new n;return e.load(t),e}))),void 0!==s.filter&&((0,t.isString)(s.filter)?(0,t.isFunction)(window[s.filter])&&(this.filter=window[s.filter]):this.filter=s.filter))}}class l{constructor(){this.width=24,this.height=24}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 c{constructor(){this.mute=new l,this.unmute=new l,this.volumeDown=new l,this.volumeUp=new l,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&&(this.mute.load(t.mute),this.unmute.load(t.unmute),this.volumeDown.load(t.volumeDown),this.volumeUp.load(t.volumeUp))}}class u{constructor(){this.value=100,this.max=100,this.min=0,this.step=10}load(e){void 0!==e&&((0,t.isObject)(e)?(void 0!==e.max&&(this.max=e.max),void 0!==e.min&&(this.min=e.min),void 0!==e.step&&(this.step=e.step),void 0!==e.value&&(this.value=e.value)):this.value=e)}}class r{constructor(){this.enable=!1,this.events=[],this.icons=new c,this.volume=new u}load(t){t&&(void 0!==t.enable&&(this.enable=t.enable),void 0!==t.events&&(this.events=t.events.map((t=>{const e=new a;return e.load(t),e}))),this.icons.load(t.icons),void 0!==t.volume&&this.volume.load(t.volume))}}const d=new Map;function h(t){const e=/(([A-G]b?)(\d))|pause/i.exec(t);if(!e||!e.length)return;const i=e[2]||e[0],s=d.get(i);return s?s[parseInt(e[3]||"0")]:void 0}function p(t){const e=document.createElement("img"),{clickCb:i,container:s,display:o,iconOptions:n,margin:a,options:l,pos:c,rightOffsets:u}=t,{width:r,path:d,svg:h}=n;!function(t,e,i,s,o,n,a){t.style.userSelect="none",t.style.webkitUserSelect="none",t.style.position="absolute",t.style.top=`${e+a}px`,t.style.left=i-a-n+"px",t.style.display=s,t.style.zIndex=`${o+1}`}(e,c.top+a,c.right-(a*(u.length+1)+r+u.reduce(((t,e)=>t+e),0)),o,l.fullScreen.zIndex+1,r,a),e.src=d??(h?`data:image/svg+xml;base64,${btoa(h)}`:"");return(s.canvas.element?.parentNode||document.body).append(e),e.addEventListener("click",i),e}function m(t){t&&t.remove()}d.set("C",[16.35,32.7,65.41,130.81,261.63,523.25,1046.5,2093,4186.01]),d.set("Db",[17.32,34.65,69.3,138.59,277.18,554.37,1108.73,2217.46,4434.92]),d.set("D",[18.35,36.71,73.42,146.83,293.66,587.33,1174.66,2349.32,4698.63]),d.set("Eb",[19.45,38.89,77.78,155.56,311.13,622.25,1244.51,2489.02,4978.03]),d.set("E",[20.6,41.2,82.41,164.81,329.63,659.25,1318.51,2637.02,5274.04]),d.set("F",[21.83,43.65,87.31,174.61,349.23,698.46,1396.91,2793.83,5587.65]),d.set("Gb",[23.12,46.25,92.5,185,369.99,739.99,1479.98,2959.96,5919.91]),d.set("G",[24.5,49,98,196,392,783.99,1567.98,3135.96,6271.93]),d.set("Ab",[25.96,51.91,103.83,207.65,415.3,830.61,1661.22,3322.44,6644.88]),d.set("A",[27.5,55,110,220,440,880,1760,3520,7040]),d.set("Bb",[29.14,58.27,116.54,233.08,466.16,932.33,1864.66,3729.31,7458.62]),d.set("B",[30.87,61.74,123.47,246.94,493.88,987.77,1975.53,3951.07,7902.13]),d.set("pause",[0]);class v{constructor(e,i){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 e=this._container,i=e.actualOptions.sounds;if(i?.enable&&e.canvas.element)for(const e of i.events){const i=async s=>{if(this._container===s.container)if(!this._container||this._container.muted||this._container.destroyed)(0,t.executeOnSingleOrMultiple)(e.event,(t=>{this._engine.removeEventListener(t,i)}));else if(!e.filter||e.filter(s))if(e.audio)this._playBuffer((0,t.itemFromSingleOrMultiple)(e.audio));else if(e.melodies){const i=(0,t.itemFromArray)(e.melodies);i.melodies.length?await Promise.allSettled(i.melodies.map((t=>this._playNote(t.notes,0,i.loop)))):await this._playNote(i.notes,0,i.loop)}else if(e.notes){const i=(0,t.itemFromArray)(e.notes);await this._playNote([i],0,!1)}};(0,t.executeOnSingleOrMultiple)(e.event,(t=>{this._engine.addEventListener(t,i)}))}},this._mute=()=>{const t=this._container;if(t.audioContext){for(const t of this._audioSources)this._removeAudioSource(t);this._gain&&this._gain.disconnect(),t.audioContext.close(),t.audioContext=void 0,this._engine.dispatchEvent("soundsMuted",{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 s=this._addBuffer(i);s.loop=t.loop,s.buffer=e,s.connect(this._gain??i.destination),s.start()},this._playFrequency=async(t,e)=>{if(!this._container.audioContext||!this._gain)return;const i=this._addOscillator(this._container.audioContext);return i.connect(this._gain),i.type="sine",i.frequency.value=t,i.start(),new Promise((t=>{setTimeout((()=>{this._removeAudioSource(i),t()}),e)}))},this._playMuteSound=()=>{const t=this._container;if(!t.audioContext)return;const e=t.audioContext.createGain();e.connect(t.audioContext.destination),e.gain.value=0;const i=t.audioContext.createOscillator();i.connect(e),i.type="sine",i.frequency.value=1,i.start(),setTimeout((()=>{i.stop(),i.disconnect(),e.disconnect()}))},this._playNote=async(e,i,s)=>{if(this._container.muted)return;const o=e[i];if(!o)return;const n=o.value,a=(0,t.executeOnSingleOrMultiple)(n,(async(t,s)=>this._playNoteValue(e,i,s)));await((0,t.isArray)(a)?Promise.allSettled(a):a);let l=i+1;s&&l>=e.length&&(l%=e.length),this._container.muted||await this._playNote(e,l,s)},this._playNoteValue=async(e,i,s)=>{const o=e[i];if(!o)return;const n=(0,t.itemFromSingleOrMultiple)(o.value,s,!0);try{const e=h(n);if(!(0,t.isNumber)(e))return;await this._playFrequency(e,o.duration)}catch(e){(0,t.getLogger)().error(e)}},this._removeAudioSource=t=>{t.stop(),t.disconnect(),this._audioSources.splice(this._audioSources.indexOf(t),1)},this._unmute=()=>{const t=this._container,e=t.actualOptions.sounds;if(!e)return;t.audioContext||(t.audioContext=new AudioContext);const{audioContext:i}=t;this._audioSources||(this._audioSources=[]);const s=i.createGain();s.connect(i.destination),s.gain.value=e.volume.value/100,this._gain=s,this._initEvents(),this._engine.dispatchEvent("soundsUnmuted",{container:this._container})},this._updateMuteIcons=()=>{const t=this._container,e=this._muteImg,i=this._unmuteImg;e&&(e.style.display=t.muted?"block":"none"),i&&(i.style.display=t.muted?"none":"block")},this._updateMuteStatus=()=>{this._container.muted?this._mute():(this._unmute(),this._playMuteSound())},this._updateVolume=()=>{const e=this._container,i=e.actualOptions.sounds;if(!i?.enable)return;(0,t.clamp)(this._volume,i.volume.min,i.volume.max);let s=!1;this._volume<=0&&!e.muted?(this._volume=0,e.muted=!0,s=!0):this._volume>0&&e.muted&&(e.muted=!1,s=!0),s&&(this._updateMuteIcons(),this._updateMuteStatus()),this._gain?.gain&&(this._gain.gain.value=this._volume/100)},this._container=e,this._engine=i,this._volume=0,this._audioSources=[],this._audioMap=new Map}async init(){const e=this._container,i=e.actualOptions.sounds;if(!i?.enable)return;this._volume=i.volume.value;const s=i.events;this._audioMap=new Map;for(const i of s)i.audio&&(0,t.executeOnSingleOrMultiple)(i.audio,(async t=>{const i=await fetch(t.source);if(!i.ok)return;const s=await i.arrayBuffer();e.audioContext=new AudioContext;const o=await e.audioContext.decodeAudioData(s);this._audioMap.set(t.source,o)}))}async start(){const t=this._container,e=t.actualOptions,i=e.sounds;if(!i?.enable||!t.canvas.element)return;t.muted=!0;const s=t.canvas.element,o={top:s.offsetTop,right:s.offsetLeft+s.offsetWidth},{mute:n,unmute:a,volumeDown:l,volumeUp:c}=i.icons,u=()=>{t.muted=!t.muted,this._updateMuteIcons(),this._updateMuteStatus()};this._muteImg=p({container:t,options:e,pos:o,display:"block",iconOptions:n,margin:10,rightOffsets:[l.width,c.width],clickCb:u}),this._unmuteImg=p({container:t,options:e,pos:o,display:"none",iconOptions:a,margin:10,rightOffsets:[l.width,c.width],clickCb:u}),this._volumeDownImg=p({container:t,options:e,pos:o,display:"block",iconOptions:l,margin:10,rightOffsets:[c.width],clickCb:()=>{t.muted&&(this._volume=0),this._volume-=i.volume.step,this._updateVolume()}}),this._volumeUpImg=p({container:t,options:e,pos:o,display:"block",iconOptions:c,margin:10,rightOffsets:[],clickCb:()=>{t.muted&&(this._volume=0),this._volume+=i.volume.step,this._updateVolume()}})}stop(){this._container.muted=!0,this._mute(),m(this._muteImg),m(this._unmuteImg),m(this._volumeDownImg),m(this._volumeUpImg)}}class f{constructor(t){this.id="sounds",this._engine=t}getPlugin(t){return new v(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 r),i.load(e?.sounds)}needsPlugin(t){return t?.sounds?.enable??!1}}async function g(t,e=!0){await t.addPlugin(new f(t),e)}})(),o})()));
!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 s in i)("object"==typeof exports?exports:t)[s]=i[s]}}(this,(t=>(()=>{"use strict";var e={533:e=>{e.exports=t}},i={};function s(t){var o=i[t];if(void 0!==o)return o.exports;var n=i[t]={exports:{}};return e[t](n,n.exports,s),n.exports}s.d=(t,e)=>{for(var i in e)s.o(e,i)&&!s.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),s.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var o={};return(()=>{s.r(o),s.d(o,{loadSoundsPlugin:()=>g});var t=s(533);class e{constructor(){this.loop=!1,this.source=""}load(e){void 0!==e&&((0,t.isObject)(e)?(void 0!==e.loop&&(this.loop=e.loop),void 0!==e.source&&(this.source=e.source)):this.source=e)}}class i{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 n{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 n;return e.load(t),e}))),void 0!==t.notes&&(this.notes=t.notes.map((t=>{const e=new i;return e.load(t),e}))))}}class a{constructor(){this.event=[],this.notes=[]}load(s){s&&(void 0!==s.event&&(this.event=s.event),void 0!==s.audio&&((0,t.isArray)(s.audio)?this.audio=s.audio.map((t=>{const i=new e;return i.load(t),i})):(this.audio=new e,this.audio.load(s.audio))),void 0!==s.notes&&(this.notes=s.notes.map((t=>{const e=new i;return e.load(t),e}))),void 0!==s.melodies&&(this.melodies=s.melodies.map((t=>{const e=new n;return e.load(t),e}))),void 0!==s.filter&&((0,t.isString)(s.filter)?(0,t.isFunction)(window[s.filter])&&(this.filter=window[s.filter]):this.filter=s.filter))}}class c{constructor(){this.width=24,this.height=24}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 l{constructor(){this.mute=new c,this.unmute=new c,this.volumeDown=new c,this.volumeUp=new c,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&&(this.mute.load(t.mute),this.unmute.load(t.unmute),this.volumeDown.load(t.volumeDown),this.volumeUp.load(t.volumeUp))}}class u{constructor(){this.value=100,this.max=100,this.min=0,this.step=10}load(e){void 0!==e&&((0,t.isObject)(e)?(void 0!==e.max&&(this.max=e.max),void 0!==e.min&&(this.min=e.min),void 0!==e.step&&(this.step=e.step),void 0!==e.value&&(this.value=e.value)):this.value=e)}}class r{constructor(){this.enable=!1,this.events=[],this.icons=new l,this.volume=new u}load(t){t&&(void 0!==t.enable&&(this.enable=t.enable),void 0!==t.events&&(this.events=t.events.map((t=>{const e=new a;return e.load(t),e}))),this.icons.load(t.icons),void 0!==t.volume&&this.volume.load(t.volume))}}const d=new Map;function h(t){const e=/(([A-G]b?)(\d))|pause/i.exec(t);if(!e||!e.length)return;const i=e[2]||e[0],s=d.get(i);return s?s[parseInt(e[3]||"0")]:void 0}function p(t){const e=document.createElement("img"),{clickCb:i,container:s,display:o,iconOptions:n,margin:a,options:c,pos:l,rightOffsets:u}=t,{width:r,path:d,svg:h}=n;!function(t,e,i,s,o,n,a){t.style.userSelect="none",t.style.webkitUserSelect="none",t.style.position="absolute",t.style.top=`${e+a}px`,t.style.left=i-a-n+"px",t.style.display=s,t.style.zIndex=`${o+1}`}(e,l.top+a,l.right-(a*(u.length+1)+r+u.reduce(((t,e)=>t+e),0)),o,c.fullScreen.zIndex+1,r,a),e.src=d??(h?`data:image/svg+xml;base64,${btoa(h)}`:"");return(s.canvas.element?.parentNode||document.body).append(e),e.addEventListener("click",i),e}function m(t){t&&t.remove()}d.set("C",[16.35,32.7,65.41,130.81,261.63,523.25,1046.5,2093,4186.01]),d.set("Db",[17.32,34.65,69.3,138.59,277.18,554.37,1108.73,2217.46,4434.92]),d.set("D",[18.35,36.71,73.42,146.83,293.66,587.33,1174.66,2349.32,4698.63]),d.set("Eb",[19.45,38.89,77.78,155.56,311.13,622.25,1244.51,2489.02,4978.03]),d.set("E",[20.6,41.2,82.41,164.81,329.63,659.25,1318.51,2637.02,5274.04]),d.set("F",[21.83,43.65,87.31,174.61,349.23,698.46,1396.91,2793.83,5587.65]),d.set("Gb",[23.12,46.25,92.5,185,369.99,739.99,1479.98,2959.96,5919.91]),d.set("G",[24.5,49,98,196,392,783.99,1567.98,3135.96,6271.93]),d.set("Ab",[25.96,51.91,103.83,207.65,415.3,830.61,1661.22,3322.44,6644.88]),d.set("A",[27.5,55,110,220,440,880,1760,3520,7040]),d.set("Bb",[29.14,58.27,116.54,233.08,466.16,932.33,1864.66,3729.31,7458.62]),d.set("B",[30.87,61.74,123.47,246.94,493.88,987.77,1975.53,3951.07,7902.13]),d.set("pause",[0]);class v{constructor(e,i){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 e=this._container,i=e.actualOptions.sounds;if(i?.enable&&e.canvas.element)for(const e of i.events){const i=s=>{(async()=>{const o=e.filter&&!e.filter(s);if(this._container===s.container)if(!this._container||this._container.muted||this._container.destroyed)(0,t.executeOnSingleOrMultiple)(e.event,(t=>{this._engine.removeEventListener(t,i)}));else if(!o)if(e.audio)this._playBuffer((0,t.itemFromSingleOrMultiple)(e.audio));else if(e.melodies){const i=(0,t.itemFromArray)(e.melodies);i.melodies.length?await Promise.allSettled(i.melodies.map((t=>this._playNote(t.notes,0,i.loop)))):await this._playNote(i.notes,0,i.loop)}else if(e.notes){const i=(0,t.itemFromArray)(e.notes);await this._playNote([i],0,!1)}})()};(0,t.executeOnSingleOrMultiple)(e.event,(t=>{this._engine.addEventListener(t,i)}))}},this._mute=()=>{const t=this._container;if(t.audioContext){for(const t of this._audioSources)this._removeAudioSource(t);this._gain&&this._gain.disconnect(),t.audioContext.close(),t.audioContext=void 0,this._engine.dispatchEvent("soundsMuted",{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 s=this._addBuffer(i);s.loop=t.loop,s.buffer=e,s.connect(this._gain??i.destination),s.start()},this._playFrequency=async(t,e)=>{if(!this._container.audioContext||!this._gain)return;const i=this._addOscillator(this._container.audioContext);return i.connect(this._gain),i.type="sine",i.frequency.value=t,i.start(),new Promise((t=>{setTimeout((()=>{this._removeAudioSource(i),t()}),e)}))},this._playMuteSound=()=>{const t=this._container;if(!t.audioContext)return;const e=t.audioContext.createGain();e.connect(t.audioContext.destination),e.gain.value=0;const i=t.audioContext.createOscillator();i.connect(e),i.type="sine",i.frequency.value=1,i.start(),setTimeout((()=>{i.stop(),i.disconnect(),e.disconnect()}))},this._playNote=async(e,i,s)=>{if(this._container.muted)return;const o=e[i];if(!o)return;const n=o.value,a=(0,t.executeOnSingleOrMultiple)(n,(async(t,s)=>this._playNoteValue(e,i,s)));await((0,t.isArray)(a)?Promise.allSettled(a):a);let c=i+1;s&&c>=e.length&&(c%=e.length),this._container.muted||await this._playNote(e,c,s)},this._playNoteValue=async(e,i,s)=>{const o=e[i];if(!o)return;const n=(0,t.itemFromSingleOrMultiple)(o.value,s,!0);try{const e=h(n);if(!(0,t.isNumber)(e))return;await this._playFrequency(e,o.duration)}catch(e){(0,t.getLogger)().error(e)}},this._removeAudioSource=t=>{t.stop(),t.disconnect(),this._audioSources.splice(this._audioSources.indexOf(t),1)},this._unmute=()=>{const t=this._container,e=t.actualOptions.sounds;if(!e)return;t.audioContext||(t.audioContext=new AudioContext);const{audioContext:i}=t;this._audioSources||(this._audioSources=[]);const s=i.createGain();s.connect(i.destination),s.gain.value=e.volume.value/100,this._gain=s,this._initEvents(),this._engine.dispatchEvent("soundsUnmuted",{container:this._container})},this._updateMuteIcons=()=>{const t=this._container,e=this._muteImg,i=this._unmuteImg;e&&(e.style.display=t.muted?"block":"none"),i&&(i.style.display=t.muted?"none":"block")},this._updateMuteStatus=async()=>{const t=this._container;t.muted?(await(t.audioContext?.suspend()),this._mute()):(await(t.audioContext?.resume()),this._unmute(),this._playMuteSound())},this._updateVolume=async()=>{const e=this._container,i=e.actualOptions.sounds;if(!i?.enable)return;(0,t.clamp)(this._volume,i.volume.min,i.volume.max);let s=!1;this._volume<=0&&!e.muted?(this._volume=0,e.muted=!0,s=!0):this._volume>0&&e.muted&&(e.muted=!1,s=!0),s&&(this._updateMuteIcons(),await this._updateMuteStatus()),this._gain?.gain&&(this._gain.gain.value=this._volume/100)},this._container=e,this._engine=i,this._volume=0,this._audioSources=[],this._audioMap=new Map}async init(){const e=this._container,i=e.actualOptions.sounds;if(!i?.enable)return;this._volume=i.volume.value;const s=i.events;this._audioMap=new Map;for(const i of s)i.audio&&(0,t.executeOnSingleOrMultiple)(i.audio,(async t=>{const i=await fetch(t.source);if(!i.ok)return;const s=await i.arrayBuffer();e.audioContext=new AudioContext;const o=await e.audioContext.decodeAudioData(s);this._audioMap.set(t.source,o)}))}async start(){const t=this._container,e=t.actualOptions,i=e.sounds;if(!i?.enable||!t.canvas.element)return;t.muted=!0;const s=t.canvas.element,o={top:s.offsetTop,right:s.offsetLeft+s.offsetWidth},{mute:n,unmute:a,volumeDown:c,volumeUp:l}=i.icons,u=async()=>{t.muted=!t.muted,this._updateMuteIcons(),await this._updateMuteStatus()};this._muteImg=p({container:t,options:e,pos:o,display:"block",iconOptions:n,margin:10,rightOffsets:[c.width,l.width],clickCb:u}),this._unmuteImg=p({container:t,options:e,pos:o,display:"none",iconOptions:a,margin:10,rightOffsets:[c.width,l.width],clickCb:u}),this._volumeDownImg=p({container:t,options:e,pos:o,display:"block",iconOptions:c,margin:10,rightOffsets:[l.width],clickCb:async()=>{t.muted&&(this._volume=0),this._volume-=i.volume.step,await this._updateVolume()}}),this._volumeUpImg=p({container:t,options:e,pos:o,display:"block",iconOptions:l,margin:10,rightOffsets:[],clickCb:async()=>{t.muted&&(this._volume=0),this._volume+=i.volume.step,await this._updateVolume()}})}stop(){this._container.muted=!0,this._mute(),m(this._muteImg),m(this._unmuteImg),m(this._volumeDownImg),m(this._volumeUpImg)}}class f{constructor(t){this.id="sounds",this._engine=t}getPlugin(t){return new v(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 r),i.load(e?.sounds)}needsPlugin(t){return t?.sounds?.enable??!1}}async function g(t,e=!0){await t.addPlugin(new f(t),e)}})(),o})()));

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

/*! tsParticles Sounds Plugin v3.0.1 by Matteo Bruni */
/*! tsParticles Sounds Plugin v3.0.2 by Matteo Bruni */

@@ -57,31 +57,34 @@ (function (factory) {

for (const event of soundsOptions.events) {
const cb = async (args) => {
if (this._container !== args.container) {
return;
}
if (!this._container || this._container.muted || this._container.destroyed) {
(0, engine_1.executeOnSingleOrMultiple)(event.event, (item) => {
this._engine.removeEventListener(item, cb);
});
return;
}
if (event.filter && !event.filter(args)) {
return;
}
if (event.audio) {
this._playBuffer((0, engine_1.itemFromSingleOrMultiple)(event.audio));
}
else if (event.melodies) {
const melody = (0, engine_1.itemFromArray)(event.melodies);
if (melody.melodies.length) {
await Promise.allSettled(melody.melodies.map((m) => this._playNote(m.notes, 0, melody.loop)));
const cb = (args) => {
(async () => {
const filterNotValid = event.filter && !event.filter(args);
if (this._container !== args.container) {
return;
}
else {
await this._playNote(melody.notes, 0, melody.loop);
if (!this._container || this._container.muted || this._container.destroyed) {
(0, engine_1.executeOnSingleOrMultiple)(event.event, (item) => {
this._engine.removeEventListener(item, cb);
});
return;
}
}
else if (event.notes) {
const note = (0, engine_1.itemFromArray)(event.notes);
await this._playNote([note], 0, false);
}
if (filterNotValid) {
return;
}
if (event.audio) {
this._playBuffer((0, engine_1.itemFromSingleOrMultiple)(event.audio));
}
else if (event.melodies) {
const melody = (0, engine_1.itemFromArray)(event.melodies);
if (melody.melodies.length) {
await Promise.allSettled(melody.melodies.map((m) => this._playNote(m.notes, 0, melody.loop)));
}
else {
await this._playNote(melody.notes, 0, melody.loop);
}
}
else if (event.notes) {
const note = (0, engine_1.itemFromArray)(event.notes);
await this._playNote([note], 0, false);
}
})();
};

@@ -230,8 +233,10 @@ (0, engine_1.executeOnSingleOrMultiple)(event.event, (item) => {

};
this._updateMuteStatus = () => {
this._updateMuteStatus = async () => {
const container = this._container;
if (container.muted) {
await container.audioContext?.suspend();
this._mute();
}
else {
await container.audioContext?.resume();
this._unmute();

@@ -241,3 +246,3 @@ this._playMuteSound();

};
this._updateVolume = () => {
this._updateVolume = async () => {
const container = this._container, soundsOptions = container.actualOptions.sounds;

@@ -260,3 +265,3 @@ if (!soundsOptions?.enable) {

this._updateMuteIcons();
this._updateMuteStatus();
await this._updateMuteStatus();
}

@@ -307,6 +312,6 @@ if (this._gain?.gain) {

}, { mute, unmute, volumeDown, volumeUp } = soundsOptions.icons, margin = 10;
const toggleMute = () => {
const toggleMute = async () => {
container.muted = !container.muted;
this._updateMuteIcons();
this._updateMuteStatus();
await this._updateMuteStatus();
};

@@ -341,3 +346,3 @@ this._muteImg = initImage({

rightOffsets: [volumeUp.width],
clickCb: () => {
clickCb: async () => {
if (container.muted) {

@@ -347,3 +352,3 @@ this._volume = 0;

this._volume -= soundsOptions.volume.step;
this._updateVolume();
await this._updateVolume();
},

@@ -359,3 +364,3 @@ });

rightOffsets: [],
clickCb: () => {
clickCb: async () => {
if (container.muted) {

@@ -365,3 +370,3 @@ this._volume = 0;

this._volume += soundsOptions.volume.step;
this._updateVolume();
await this._updateVolume();
},

@@ -368,0 +373,0 @@ });

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