Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tsparticles-plugin-sounds

Package Overview
Dependencies
Maintainers
1
Versions
12
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 2.10.1 to 2.11.0

5

browser/index.js

@@ -25,5 +25,4 @@ import { Sounds } from "./Options/Classes/Sounds";

}
export async function loadSoundsPlugin(engine) {
const plugin = new SoundsPlugin(engine);
await engine.addPlugin(plugin);
export async function loadSoundsPlugin(engine, refresh = true) {
await engine.addPlugin(new SoundsPlugin(engine), refresh);
}

3

browser/Options/Classes/SoundsAudio.js

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

import { isObject } from "tsparticles-engine";
export class SoundsAudio {

@@ -10,3 +11,3 @@ constructor() {

}
if (typeof data === "object") {
if (isObject(data)) {
if (data.loop !== undefined) {

@@ -13,0 +14,0 @@ this.loop = data.loop;

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

import { isArray, isFunction, isString, } from "tsparticles-engine";
import { SoundsAudio } from "./SoundsAudio";

@@ -17,3 +18,3 @@ import { SoundsMelody } from "./SoundsMelody";

if (data.audio !== undefined) {
if (data.audio instanceof Array) {
if (isArray(data.audio)) {
this.audio = data.audio.map((s) => {

@@ -45,4 +46,4 @@ const tmp = new SoundsAudio();

if (data.filter !== undefined) {
if (typeof data.filter === "string") {
if (typeof window[data.filter] === "function") {
if (isString(data.filter)) {
if (isFunction(window[data.filter])) {
this.filter = window[data.filter];

@@ -49,0 +50,0 @@ }

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

import { isObject } from "tsparticles-engine";
export class SoundsVolume {

@@ -12,3 +13,3 @@ constructor() {

}
if (typeof data === "object") {
if (isObject(data)) {
if (data.max !== undefined) {

@@ -15,0 +16,0 @@ this.max = data.max;

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

import { clamp, executeOnSingleOrMultiple, itemFromArray, itemFromSingleOrMultiple, } from "tsparticles-engine";
import { clamp, executeOnSingleOrMultiple, getLogger, isArray, isNumber, itemFromArray, itemFromSingleOrMultiple, } from "tsparticles-engine";
import { getNoteFrequency } from "./utils";

@@ -157,3 +157,3 @@ function initImage(data) {

});
await (promises instanceof Array ? Promise.allSettled(promises) : promises);
await (isArray(promises) ? Promise.allSettled(promises) : promises);
let nextNoteIdx = noteIdx + 1;

@@ -176,3 +176,3 @@ if (loop && nextNoteIdx >= notes.length) {

const freq = getNoteFrequency(value);
if (typeof freq !== "number") {
if (!isNumber(freq)) {
return;

@@ -183,3 +183,3 @@ }

catch (e) {
console.error(e);
getLogger().error(e);
}

@@ -186,0 +186,0 @@ };

@@ -28,6 +28,5 @@ "use strict";

}
async function loadSoundsPlugin(engine) {
const plugin = new SoundsPlugin(engine);
await engine.addPlugin(plugin);
async function loadSoundsPlugin(engine, refresh = true) {
await engine.addPlugin(new SoundsPlugin(engine), refresh);
}
exports.loadSoundsPlugin = loadSoundsPlugin;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SoundsAudio = void 0;
const tsparticles_engine_1 = require("tsparticles-engine");
class SoundsAudio {

@@ -13,3 +14,3 @@ constructor() {

}
if (typeof data === "object") {
if ((0, tsparticles_engine_1.isObject)(data)) {
if (data.loop !== undefined) {

@@ -16,0 +17,0 @@ this.loop = data.loop;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SoundsEvent = void 0;
const tsparticles_engine_1 = require("tsparticles-engine");
const SoundsAudio_1 = require("./SoundsAudio");

@@ -20,3 +21,3 @@ const SoundsMelody_1 = require("./SoundsMelody");

if (data.audio !== undefined) {
if (data.audio instanceof Array) {
if ((0, tsparticles_engine_1.isArray)(data.audio)) {
this.audio = data.audio.map((s) => {

@@ -48,4 +49,4 @@ const tmp = new SoundsAudio_1.SoundsAudio();

if (data.filter !== undefined) {
if (typeof data.filter === "string") {
if (typeof window[data.filter] === "function") {
if ((0, tsparticles_engine_1.isString)(data.filter)) {
if ((0, tsparticles_engine_1.isFunction)(window[data.filter])) {
this.filter = window[data.filter];

@@ -52,0 +53,0 @@ }

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SoundsVolume = void 0;
const tsparticles_engine_1 = require("tsparticles-engine");
class SoundsVolume {

@@ -15,3 +16,3 @@ constructor() {

}
if (typeof data === "object") {
if ((0, tsparticles_engine_1.isObject)(data)) {
if (data.max !== undefined) {

@@ -18,0 +19,0 @@ this.max = data.max;

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

});
await (promises instanceof Array ? Promise.allSettled(promises) : promises);
await ((0, tsparticles_engine_1.isArray)(promises) ? Promise.allSettled(promises) : promises);
let nextNoteIdx = noteIdx + 1;

@@ -179,3 +179,3 @@ if (loop && nextNoteIdx >= notes.length) {

const freq = (0, utils_1.getNoteFrequency)(value);
if (typeof freq !== "number") {
if (!(0, tsparticles_engine_1.isNumber)(freq)) {
return;

@@ -186,3 +186,3 @@ }

catch (e) {
console.error(e);
(0, tsparticles_engine_1.getLogger)().error(e);
}

@@ -189,0 +189,0 @@ };

@@ -25,5 +25,4 @@ import { Sounds } from "./Options/Classes/Sounds";

}
export async function loadSoundsPlugin(engine) {
const plugin = new SoundsPlugin(engine);
await engine.addPlugin(plugin);
export async function loadSoundsPlugin(engine, refresh = true) {
await engine.addPlugin(new SoundsPlugin(engine), refresh);
}

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

import { isObject } from "tsparticles-engine";
export class SoundsAudio {

@@ -10,3 +11,3 @@ constructor() {

}
if (typeof data === "object") {
if (isObject(data)) {
if (data.loop !== undefined) {

@@ -13,0 +14,0 @@ this.loop = data.loop;

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

import { isArray, isFunction, isString, } from "tsparticles-engine";
import { SoundsAudio } from "./SoundsAudio";

@@ -17,3 +18,3 @@ import { SoundsMelody } from "./SoundsMelody";

if (data.audio !== undefined) {
if (data.audio instanceof Array) {
if (isArray(data.audio)) {
this.audio = data.audio.map((s) => {

@@ -45,4 +46,4 @@ const tmp = new SoundsAudio();

if (data.filter !== undefined) {
if (typeof data.filter === "string") {
if (typeof window[data.filter] === "function") {
if (isString(data.filter)) {
if (isFunction(window[data.filter])) {
this.filter = window[data.filter];

@@ -49,0 +50,0 @@ }

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

import { isObject } from "tsparticles-engine";
export class SoundsVolume {

@@ -12,3 +13,3 @@ constructor() {

}
if (typeof data === "object") {
if (isObject(data)) {
if (data.max !== undefined) {

@@ -15,0 +16,0 @@ this.max = data.max;

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

import { clamp, executeOnSingleOrMultiple, itemFromArray, itemFromSingleOrMultiple, } from "tsparticles-engine";
import { clamp, executeOnSingleOrMultiple, getLogger, isArray, isNumber, itemFromArray, itemFromSingleOrMultiple, } from "tsparticles-engine";
import { getNoteFrequency } from "./utils";

@@ -157,3 +157,3 @@ function initImage(data) {

});
await (promises instanceof Array ? Promise.allSettled(promises) : promises);
await (isArray(promises) ? Promise.allSettled(promises) : promises);
let nextNoteIdx = noteIdx + 1;

@@ -176,3 +176,3 @@ if (loop && nextNoteIdx >= notes.length) {

const freq = getNoteFrequency(value);
if (typeof freq !== "number") {
if (!isNumber(freq)) {
return;

@@ -183,3 +183,3 @@ }

catch (e) {
console.error(e);
getLogger().error(e);
}

@@ -186,0 +186,0 @@ };

{
"name": "tsparticles-plugin-sounds",
"version": "2.10.1",
"version": "2.11.0",
"description": "tsParticles sounds plugin",

@@ -79,5 +79,6 @@ "homepage": "https://particles.js.org",

"types": "types/index.d.ts",
"sideEffects": false,
"dependencies": {
"tsparticles-engine": "^2.10.1"
"tsparticles-engine": "^2.11.0"
}
}

@@ -31,4 +31,7 @@ [![banner](https://particles.js.org/images/banner2.png)](https://particles.js.org)

await tsParticles.load("tsparticles", {
/* options */
await tsParticles.load({
id: "tsparticles",
options: {
/* options */
},
});

@@ -58,3 +61,5 @@ })();

loadSoundsPlugin(tsParticles); // awaitable
(async () => {
await loadSoundsPlugin(tsParticles);
})();
```

@@ -68,3 +73,5 @@

loadSoundsPlugin(tsParticles); // awaitable
(async () => {
await loadSoundsPlugin(tsParticles);
})();
```

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

* How to use? : Check the GitHub README
* v2.10.1
* v2.11.0
*/

@@ -98,3 +98,6 @@ (function webpackUniversalModuleDefinition(root, factory) {

// EXTERNAL MODULE: external {"commonjs":"tsparticles-engine","commonjs2":"tsparticles-engine","amd":"tsparticles-engine","root":"window"}
var external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_ = __webpack_require__(961);
;// CONCATENATED MODULE: ./dist/browser/Options/Classes/SoundsAudio.js
class SoundsAudio {

@@ -109,3 +112,3 @@ constructor() {

}
if (typeof data === "object") {
if ((0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.isObject)(data)) {
if (data.loop !== undefined) {

@@ -175,2 +178,3 @@ this.loop = data.loop;

class SoundsEvent {

@@ -189,3 +193,3 @@ constructor() {

if (data.audio !== undefined) {
if (data.audio instanceof Array) {
if ((0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.isArray)(data.audio)) {
this.audio = data.audio.map(s => {

@@ -216,4 +220,4 @@ const tmp = new SoundsAudio();

if (data.filter !== undefined) {
if (typeof data.filter === "string") {
if (typeof window[data.filter] === "function") {
if ((0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.isString)(data.filter)) {
if ((0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.isFunction)(window[data.filter])) {
this.filter = window[data.filter];

@@ -307,2 +311,3 @@ }

;// CONCATENATED MODULE: ./dist/browser/Options/Classes/SoundsVolume.js
class SoundsVolume {

@@ -319,3 +324,3 @@ constructor() {

}
if (typeof data === "object") {
if ((0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.isObject)(data)) {
if (data.max !== undefined) {

@@ -369,4 +374,2 @@ this.max = data.max;

}
// EXTERNAL MODULE: external {"commonjs":"tsparticles-engine","commonjs2":"tsparticles-engine","amd":"tsparticles-engine","root":"window"}
var external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_ = __webpack_require__(961);
;// CONCATENATED MODULE: ./dist/browser/utils.js

@@ -572,3 +575,3 @@ const notes = new Map();

});
await (promises instanceof Array ? Promise.allSettled(promises) : promises);
await ((0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.isArray)(promises) ? Promise.allSettled(promises) : promises);
let nextNoteIdx = noteIdx + 1;

@@ -591,3 +594,3 @@ if (loop && nextNoteIdx >= notes.length) {

const freq = getNoteFrequency(value);
if (typeof freq !== "number") {
if (!(0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.isNumber)(freq)) {
return;

@@ -597,3 +600,3 @@ }

} catch (e) {
console.error(e);
(0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.getLogger)().error(e);
}

@@ -819,5 +822,4 @@ };

}
async function loadSoundsPlugin(engine) {
const plugin = new SoundsPlugin(engine);
await engine.addPlugin(plugin);
async function loadSoundsPlugin(engine, refresh = true) {
await engine.addPlugin(new SoundsPlugin(engine), refresh);
}

@@ -824,0 +826,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 o in i)("object"==typeof exports?exports:t)[o]=i[o]}}(this,(t=>(()=>{"use strict";var e={961:e=>{e.exports=t}},i={};function o(t){var s=i[t];if(void 0!==s)return s.exports;var n=i[t]={exports:{}};return e[t](n,n.exports,o),n.exports}o.d=(t,e)=>{for(var i in e)o.o(e,i)&&!o.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var s={};return(()=>{o.r(s),o.d(s,{loadSoundsPlugin:()=>g});class t{constructor(){this.loop=!1,this.source=""}load(t){void 0!==t&&("object"==typeof t?(void 0!==t.loop&&(this.loop=t.loop),void 0!==t.source&&(this.source=t.source)):this.source=t)}}class e{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 i{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 i;return e.load(t),e}))),void 0!==t.notes&&(this.notes=t.notes.map((t=>{const i=new e;return i.load(t),i}))))}}class n{constructor(){this.event=[],this.notes=[]}load(o){o&&(void 0!==o.event&&(this.event=o.event),void 0!==o.audio&&(o.audio instanceof Array?this.audio=o.audio.map((e=>{const i=new t;return i.load(e),i})):(this.audio=new t,this.audio.load(o.audio))),void 0!==o.notes&&(this.notes=o.notes.map((t=>{const i=new e;return i.load(t),i}))),void 0!==o.melodies&&(this.melodies=o.melodies.map((t=>{const e=new i;return e.load(t),e}))),void 0!==o.filter&&("string"==typeof o.filter?"function"==typeof window[o.filter]&&(this.filter=window[o.filter]):this.filter=o.filter))}}class a{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 a,this.unmute=new a,this.volumeDown=new a,this.volumeUp=new a,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 l{constructor(){this.value=100,this.max=100,this.min=0,this.step=10}load(t){void 0!==t&&("object"==typeof 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 u{constructor(){this.enable=!1,this.events=[],this.icons=new c,this.volume=new l}load(t){t&&(void 0!==t.enable&&(this.enable=t.enable),void 0!==t.events&&(this.events=t.events.map((t=>{const e=new n;return e.load(t),e}))),this.icons.load(t.icons),void 0!==t.volume&&this.volume.load(t.volume))}}var r=o(961);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],o=d.get(i);return o?o[parseInt(e[3]||"0")]:void 0}function p(t){const e=document.createElement("img"),{clickCb:i,container:o,display:s,iconOptions:n,margin:a,options:c,pos:l,rightOffsets:u}=t,{width:r,path:d,svg:h}=n;!function(t,e,i,o,s,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=o,t.style.zIndex=`${s+1}`}(e,l.top+a,l.right-(a*(u.length+1)+r+u.reduce(((t,e)=>t+e),0)),s,c.fullScreen.zIndex+1,r,a),e.src=d??(h?`data:image/svg+xml;base64,${btoa(h)}`:"");return(o.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(t,e){this._addBuffer=t=>{const e=t.createBufferSource();return this._audioSources.push(e),e},this._addOscillator=t=>{const e=t.createOscillator();return this._audioSources.push(e),e},this._initEvents=()=>{const t=this._container,e=t.actualOptions.sounds;if(e?.enable&&t.canvas.element)for(const t of e.events){const e=async i=>{if(this._container===i.container)if(!this._container||this._container.muted||this._container.destroyed)(0,r.executeOnSingleOrMultiple)(t.event,(t=>{this._engine.removeEventListener(t,e)}));else if(!t.filter||t.filter(i))if(t.audio)this._playBuffer((0,r.itemFromSingleOrMultiple)(t.audio));else if(t.melodies){const e=(0,r.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,r.itemFromArray)(t.notes);await this._playNote([e],0,!1)}};(0,r.executeOnSingleOrMultiple)(t.event,(t=>{this._engine.addEventListener(t,e)}))}},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 o=this._addBuffer(i);o.loop=t.loop,o.buffer=e,o.connect(this._gain??i.destination),o.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(t,e,i)=>{if(this._container.muted)return;const o=t[e];if(!o)return;const s=o.value,n=(0,r.executeOnSingleOrMultiple)(s,(async(i,o)=>this._playNoteValue(t,e,o)));await(n instanceof Array?Promise.allSettled(n):n);let a=e+1;i&&a>=t.length&&(a%=t.length),this._container.muted||await this._playNote(t,a,i)},this._playNoteValue=async(t,e,i)=>{const o=t[e];if(!o)return;const s=(0,r.itemFromSingleOrMultiple)(o.value,i,!0);try{const t=h(s);if("number"!=typeof t)return;await this._playFrequency(t,o.duration)}catch(t){console.error(t)}},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 o=i.createGain();o.connect(i.destination),o.gain.value=e.volume.value/100,this._gain=o,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 t=this._container,e=t.actualOptions.sounds;if(!e?.enable)return;(0,r.clamp)(this._volume,e.volume.min,e.volume.max);let i=!1;this._volume<=0&&!t.muted?(this._volume=0,t.muted=!0,i=!0):this._volume>0&&t.muted&&(t.muted=!1,i=!0),i&&(this._updateMuteIcons(),this._updateMuteStatus()),this._gain?.gain&&(this._gain.gain.value=this._volume/100)},this._container=t,this._engine=e,this._volume=0,this._audioSources=[],this._audioMap=new Map}async init(){const t=this._container,e=t.actualOptions.sounds;if(!e?.enable)return;this._volume=e.volume.value;const i=e.events;this._audioMap=new Map;for(const e of i)e.audio&&(0,r.executeOnSingleOrMultiple)(e.audio,(async e=>{const i=await fetch(e.source);if(!i.ok)return;const o=await i.arrayBuffer();t.audioContext=new AudioContext;const s=await t.audioContext.decodeAudioData(o);this._audioMap.set(e.source,s)}))}async start(){const t=this._container,e=t.actualOptions,i=e.sounds;if(!i?.enable||!t.canvas.element)return;t.muted=!0;const o=t.canvas.element,s={top:o.offsetTop,right:o.offsetLeft+o.offsetWidth},{mute:n,unmute:a,volumeDown:c,volumeUp:l}=i.icons,u=()=>{t.muted=!t.muted,this._updateMuteIcons(),this._updateMuteStatus()};this._muteImg=p({container:t,options:e,pos:s,display:"block",iconOptions:n,margin:10,rightOffsets:[c.width,l.width],clickCb:u}),this._unmuteImg=p({container:t,options:e,pos:s,display:"none",iconOptions:a,margin:10,rightOffsets:[c.width,l.width],clickCb:u}),this._volumeDownImg=p({container:t,options:e,pos:s,display:"block",iconOptions:c,margin:10,rightOffsets:[l.width],clickCb:()=>{t.muted&&(this._volume=0),this._volume-=i.volume.step,this._updateVolume()}}),this._volumeUpImg=p({container:t,options:e,pos:s,display:"block",iconOptions:l,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 u),i.load(e?.sounds)}needsPlugin(t){return t?.sounds?.enable??!1}}async function g(t){const e=new f(t);await t.addPlugin(e)}})(),s})()));
!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={961: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(961);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})()));

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

/*! tsParticles Sounds Plugin v2.10.1 by Matteo Bruni */
/*! tsParticles Sounds Plugin v2.11.0 by Matteo Bruni */
import type { Engine } from "tsparticles-engine";
export declare function loadSoundsPlugin(engine: Engine): Promise<void>;
export declare function loadSoundsPlugin(engine: Engine, refresh?: boolean): Promise<void>;

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

import type { IOptionLoader, RecursivePartial } from "tsparticles-engine";
import { type IOptionLoader, type RecursivePartial } from "tsparticles-engine";
import type { ISoundsAudio } from "../Interfaces/ISoundsAudio";

@@ -3,0 +3,0 @@ export declare class SoundsAudio implements ISoundsAudio, IOptionLoader<ISoundsAudio> {

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

import type { IOptionLoader, RecursivePartial, SingleOrMultiple } from "tsparticles-engine";
import { type IOptionLoader, type RecursivePartial, type SingleOrMultiple } from "tsparticles-engine";
import type { FilterFunction } from "../../types";

@@ -3,0 +3,0 @@ import type { ISoundsEvent } from "../Interfaces/ISoundsEvent";

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

import type { IOptionLoader, RecursivePartial } from "tsparticles-engine";
import { type IOptionLoader, type RecursivePartial } from "tsparticles-engine";
import type { ISoundsVolume } from "../Interfaces/ISoundsVolume";

@@ -3,0 +3,0 @@ export declare class SoundsVolume implements ISoundsVolume, IOptionLoader<ISoundsVolume> {

@@ -37,7 +37,6 @@ (function (factory) {

}
async function loadSoundsPlugin(engine) {
const plugin = new SoundsPlugin(engine);
await engine.addPlugin(plugin);
async function loadSoundsPlugin(engine, refresh = true) {
await engine.addPlugin(new SoundsPlugin(engine), refresh);
}
exports.loadSoundsPlugin = loadSoundsPlugin;
});

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

else if (typeof define === "function" && define.amd) {
define(["require", "exports"], factory);
define(["require", "exports", "tsparticles-engine"], factory);
}

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

exports.SoundsAudio = void 0;
const tsparticles_engine_1 = require("tsparticles-engine");
class SoundsAudio {

@@ -24,3 +25,3 @@ constructor() {

}
if (typeof data === "object") {
if ((0, tsparticles_engine_1.isObject)(data)) {
if (data.loop !== undefined) {

@@ -27,0 +28,0 @@ this.loop = data.loop;

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

else if (typeof define === "function" && define.amd) {
define(["require", "exports", "./SoundsAudio", "./SoundsMelody", "./SoundsNote"], factory);
define(["require", "exports", "tsparticles-engine", "./SoundsAudio", "./SoundsMelody", "./SoundsNote"], factory);
}

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

exports.SoundsEvent = void 0;
const tsparticles_engine_1 = require("tsparticles-engine");
const SoundsAudio_1 = require("./SoundsAudio");

@@ -31,3 +32,3 @@ const SoundsMelody_1 = require("./SoundsMelody");

if (data.audio !== undefined) {
if (data.audio instanceof Array) {
if ((0, tsparticles_engine_1.isArray)(data.audio)) {
this.audio = data.audio.map((s) => {

@@ -59,4 +60,4 @@ const tmp = new SoundsAudio_1.SoundsAudio();

if (data.filter !== undefined) {
if (typeof data.filter === "string") {
if (typeof window[data.filter] === "function") {
if ((0, tsparticles_engine_1.isString)(data.filter)) {
if ((0, tsparticles_engine_1.isFunction)(window[data.filter])) {
this.filter = window[data.filter];

@@ -63,0 +64,0 @@ }

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

else if (typeof define === "function" && define.amd) {
define(["require", "exports"], factory);
define(["require", "exports", "tsparticles-engine"], factory);
}

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

exports.SoundsVolume = void 0;
const tsparticles_engine_1 = require("tsparticles-engine");
class SoundsVolume {

@@ -26,3 +27,3 @@ constructor() {

}
if (typeof data === "object") {
if ((0, tsparticles_engine_1.isObject)(data)) {
if (data.max !== undefined) {

@@ -29,0 +30,0 @@ this.max = data.max;

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

});
await (promises instanceof Array ? Promise.allSettled(promises) : promises);
await ((0, tsparticles_engine_1.isArray)(promises) ? Promise.allSettled(promises) : promises);
let nextNoteIdx = noteIdx + 1;

@@ -188,3 +188,3 @@ if (loop && nextNoteIdx >= notes.length) {

const freq = (0, utils_1.getNoteFrequency)(value);
if (typeof freq !== "number") {
if (!(0, tsparticles_engine_1.isNumber)(freq)) {
return;

@@ -195,3 +195,3 @@ }

catch (e) {
console.error(e);
(0, tsparticles_engine_1.getLogger)().error(e);
}

@@ -198,0 +198,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