@blibliki/engine 0.1.22 → 0.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -61,8 +61,8 @@ declare class Engine {
61
61
  addRoute(props: Optional<RouteInterface, "id">): {
62
62
  id: string;
63
63
  sourceId: string;
64
- destinationId: string;
65
64
  sourceIOId: string;
65
+ destinationId: string;
66
66
  destinationIOId: string;
67
67
  };
68
68
  removeRoute(id: string): void;
@@ -11,8 +11,8 @@ export interface RouteInterface extends RouteProps {
11
11
  export declare function createRoute(props: Optional<RouteInterface, "id">): {
12
12
  id: string;
13
13
  sourceId: string;
14
- destinationId: string;
15
14
  sourceIOId: string;
15
+ destinationId: string;
16
16
  destinationIOId: string;
17
17
  };
18
18
  export declare function applyRoutes(routes: RouteInterface[]): void;
package/dist/main.cjs.js CHANGED
@@ -21,7 +21,7 @@ return t.mode.CTRGladman=function(){var e=t.lib.BlockCipherMode.extend();functio
21
21
 
22
22
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23
23
  */
24
- return function(e){var n=t,s=n.lib,i=s.WordArray,r=s.Hasher,o=n.algo,a=i.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),u=i.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),c=i.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),l=i.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),h=i.create([0,1518500249,1859775393,2400959708,2840853838]),p=i.create([1352829926,1548603684,1836072691,2053994217,0]),d=o.RIPEMD160=r.extend({_doReset:function(){this._hash=i.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var n=0;n<16;n++){var s=e+n,i=t[s];t[s]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var r,o,d,w,b,x,T,A,k,C,S,O=this._hash.words,M=h.words,E=p.words,D=a.words,I=u.words,R=c.words,N=l.words;for(x=r=O[0],T=o=O[1],A=d=O[2],k=w=O[3],C=b=O[4],n=0;n<80;n+=1)S=r+t[e+D[n]]|0,S+=n<16?f(o,d,w)+M[0]:n<32?_(o,d,w)+M[1]:n<48?m(o,d,w)+M[2]:n<64?g(o,d,w)+M[3]:v(o,d,w)+M[4],S=(S=y(S|=0,R[n]))+b|0,r=b,b=w,w=y(d,10),d=o,o=S,S=x+t[e+I[n]]|0,S+=n<16?v(T,A,k)+E[0]:n<32?g(T,A,k)+E[1]:n<48?m(T,A,k)+E[2]:n<64?_(T,A,k)+E[3]:f(T,A,k)+E[4],S=(S=y(S|=0,N[n]))+C|0,x=C,C=k,k=y(A,10),A=T,T=S;S=O[1]+d+k|0,O[1]=O[2]+w+C|0,O[2]=O[3]+b+x|0,O[3]=O[4]+r+T|0,O[4]=O[0]+o+A|0,O[0]=S},_doFinalize:function(){var t=this._data,e=t.words,n=8*this._nDataBytes,s=8*t.sigBytes;e[s>>>5]|=128<<24-s%32,e[14+(s+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),t.sigBytes=4*(e.length+1),this._process();for(var i=this._hash,r=i.words,o=0;o<5;o++){var a=r[o];r[o]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}return i},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t}});function f(t,e,n){return t^e^n}function _(t,e,n){return t&e|~t&n}function m(t,e,n){return(t|~e)^n}function g(t,e,n){return t&n|e&~n}function v(t,e,n){return t^(e|~n)}function y(t,e){return t<<e|t>>>32-e}n.RIPEMD160=r._createHelper(d),n.HmacRIPEMD160=r._createHmacHelper(d)}(),t.RIPEMD160}(sa())),Wa(),La||(La=1,Ua.exports=function(t){return s=(n=(e=t).lib).Base,i=n.WordArray,o=(r=e.algo).SHA256,a=r.HMAC,u=r.PBKDF2=s.extend({cfg:s.extend({keySize:4,hasher:o,iterations:25e4}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){for(var n=this.cfg,s=a.create(n.hasher,t),r=i.create(),o=i.create([1]),u=r.words,c=o.words,l=n.keySize,h=n.iterations;u.length<l;){var p=s.update(e).finalize(o);s.reset();for(var d=p.words,f=d.length,_=p,m=1;m<h;m++){_=s.finalize(_),s.reset();for(var g=_.words,v=0;v<f;v++)d[v]^=g[v]}r.concat(p),c[0]++}return r.sigBytes=4*l,r}}),e.PBKDF2=function(t,e,n){return u.create(n).compute(t,e)},t.PBKDF2;var e,n,s,i,r,o,a,u}(sa(),Sa(),Wa())),Ga(),Ya(),Ja(),nu(),ru(),uu(),cu||(cu=1,lu.exports=function(t){return t.mode.ECB=((e=t.lib.BlockCipherMode.extend()).Encryptor=e.extend({processBlock:function(t,e){this._cipher.encryptBlock(t,e)}}),e.Decryptor=e.extend({processBlock:function(t,e){this._cipher.decryptBlock(t,e)}}),e),t.mode.ECB;var e}(sa(),Ya())),hu||(hu=1,pu.exports=function(t){return t.pad.AnsiX923={pad:function(t,e){var n=t.sigBytes,s=4*e,i=s-n%s,r=n+i-1;t.clamp(),t.words[r>>>2]|=i<<24-r%4*8,t.sigBytes+=i},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},t.pad.Ansix923}(sa(),Ya())),du||(du=1,fu.exports=function(t){return t.pad.Iso10126={pad:function(e,n){var s=4*n,i=s-e.sigBytes%s;e.concat(t.lib.WordArray.random(i-1)).concat(t.lib.WordArray.create([i<<24],1))},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},t.pad.Iso10126}(sa(),Ya())),_u||(_u=1,mu.exports=function(t){return t.pad.Iso97971={pad:function(e,n){e.concat(t.lib.WordArray.create([2147483648],1)),t.pad.ZeroPadding.pad(e,n)},unpad:function(e){t.pad.ZeroPadding.unpad(e),e.sigBytes--}},t.pad.Iso97971}(sa(),Ya())),gu||(gu=1,vu.exports=function(t){return t.pad.ZeroPadding={pad:function(t,e){var n=4*e;t.clamp(),t.sigBytes+=n-(t.sigBytes%n||n)},unpad:function(t){var e=t.words,n=t.sigBytes-1;for(n=t.sigBytes-1;n>=0;n--)if(e[n>>>2]>>>24-n%4*8&255){t.sigBytes=n+1;break}}},t.pad.ZeroPadding}(sa(),Ya())),yu||(yu=1,wu.exports=function(t){return t.pad.NoPadding={pad:function(){},unpad:function(){}},t.pad.NoPadding}(sa(),Ya())),bu||(bu=1,xu.exports=function(t){return n=(e=t).lib.CipherParams,s=e.enc.Hex,e.format.Hex={stringify:function(t){return t.ciphertext.toString(s)},parse:function(t){var e=s.parse(t);return n.create({ciphertext:e})}},t.format.Hex;var e,n,s}(sa(),Ya())),Tu||(Tu=1,Au.exports=function(t){return function(){var e=t,n=e.lib.BlockCipher,s=e.algo,i=[],r=[],o=[],a=[],u=[],c=[],l=[],h=[],p=[],d=[];!function(){for(var t=[],e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;var n=0,s=0;for(e=0;e<256;e++){var f=s^s<<1^s<<2^s<<3^s<<4;f=f>>>8^255&f^99,i[n]=f,r[f]=n;var _=t[n],m=t[_],g=t[m],v=257*t[f]^16843008*f;o[n]=v<<24|v>>>8,a[n]=v<<16|v>>>16,u[n]=v<<8|v>>>24,c[n]=v,v=16843009*g^65537*m^257*_^16843008*n,l[f]=v<<24|v>>>8,h[f]=v<<16|v>>>16,p[f]=v<<8|v>>>24,d[f]=v,n?(n=_^t[t[t[g^_]]],s^=t[t[s]]):n=s=1}}();var f=[0,1,2,4,8,16,32,64,128,27,54],_=s.AES=n.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var t=this._keyPriorReset=this._key,e=t.words,n=t.sigBytes/4,s=4*((this._nRounds=n+6)+1),r=this._keySchedule=[],o=0;o<s;o++)o<n?r[o]=e[o]:(c=r[o-1],o%n?n>6&&o%n==4&&(c=i[c>>>24]<<24|i[c>>>16&255]<<16|i[c>>>8&255]<<8|i[255&c]):(c=i[(c=c<<8|c>>>24)>>>24]<<24|i[c>>>16&255]<<16|i[c>>>8&255]<<8|i[255&c],c^=f[o/n|0]<<24),r[o]=r[o-n]^c);for(var a=this._invKeySchedule=[],u=0;u<s;u++){if(o=s-u,u%4)var c=r[o];else c=r[o-4];a[u]=u<4||o<=4?c:l[i[c>>>24]]^h[i[c>>>16&255]]^p[i[c>>>8&255]]^d[i[255&c]]}}},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._keySchedule,o,a,u,c,i)},decryptBlock:function(t,e){var n=t[e+1];t[e+1]=t[e+3],t[e+3]=n,this._doCryptBlock(t,e,this._invKeySchedule,l,h,p,d,r),n=t[e+1],t[e+1]=t[e+3],t[e+3]=n},_doCryptBlock:function(t,e,n,s,i,r,o,a){for(var u=this._nRounds,c=t[e]^n[0],l=t[e+1]^n[1],h=t[e+2]^n[2],p=t[e+3]^n[3],d=4,f=1;f<u;f++){var _=s[c>>>24]^i[l>>>16&255]^r[h>>>8&255]^o[255&p]^n[d++],m=s[l>>>24]^i[h>>>16&255]^r[p>>>8&255]^o[255&c]^n[d++],g=s[h>>>24]^i[p>>>16&255]^r[c>>>8&255]^o[255&l]^n[d++],v=s[p>>>24]^i[c>>>16&255]^r[l>>>8&255]^o[255&h]^n[d++];c=_,l=m,h=g,p=v}_=(a[c>>>24]<<24|a[l>>>16&255]<<16|a[h>>>8&255]<<8|a[255&p])^n[d++],m=(a[l>>>24]<<24|a[h>>>16&255]<<16|a[p>>>8&255]<<8|a[255&c])^n[d++],g=(a[h>>>24]<<24|a[p>>>16&255]<<16|a[c>>>8&255]<<8|a[255&l])^n[d++],v=(a[p>>>24]<<24|a[c>>>16&255]<<16|a[l>>>8&255]<<8|a[255&h])^n[d++],t[e]=_,t[e+1]=m,t[e+2]=g,t[e+3]=v},keySize:8});e.AES=n._createHelper(_)}(),t.AES}(sa(),_a(),ba(),Ga(),Ya())),Su(),Ou||(Ou=1,Mu.exports=function(t){return function(){var e=t,n=e.lib.StreamCipher,s=e.algo,i=s.RC4=n.extend({_doReset:function(){for(var t=this._key,e=t.words,n=t.sigBytes,s=this._S=[],i=0;i<256;i++)s[i]=i;i=0;for(var r=0;i<256;i++){var o=i%n,a=e[o>>>2]>>>24-o%4*8&255;r=(r+s[i]+a)%256;var u=s[i];s[i]=s[r],s[r]=u}this._i=this._j=0},_doProcessBlock:function(t,e){t[e]^=r.call(this)},keySize:8,ivSize:0});function r(){for(var t=this._S,e=this._i,n=this._j,s=0,i=0;i<4;i++){n=(n+t[e=(e+1)%256])%256;var r=t[e];t[e]=t[n],t[n]=r,s|=t[(t[e]+t[n])%256]<<24-8*i}return this._i=e,this._j=n,s}e.RC4=n._createHelper(i);var o=s.RC4Drop=i.extend({cfg:i.cfg.extend({drop:192}),_doReset:function(){i._doReset.call(this);for(var t=this.cfg.drop;t>0;t--)r.call(this)}});e.RC4Drop=n._createHelper(o)}(),t.RC4}(sa(),_a(),ba(),Ga(),Ya())),Eu||(Eu=1,Du.exports=function(t){return function(){var e=t,n=e.lib.StreamCipher,s=e.algo,i=[],r=[],o=[],a=s.Rabbit=n.extend({_doReset:function(){for(var t=this._key.words,e=this.cfg.iv,n=0;n<4;n++)t[n]=16711935&(t[n]<<8|t[n]>>>24)|4278255360&(t[n]<<24|t[n]>>>8);var s=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],i=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];for(this._b=0,n=0;n<4;n++)u.call(this);for(n=0;n<8;n++)i[n]^=s[n+4&7];if(e){var r=e.words,o=r[0],a=r[1],c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),h=c>>>16|4294901760&l,p=l<<16|65535&c;for(i[0]^=c,i[1]^=h,i[2]^=l,i[3]^=p,i[4]^=c,i[5]^=h,i[6]^=l,i[7]^=p,n=0;n<4;n++)u.call(this)}},_doProcessBlock:function(t,e){var n=this._X;u.call(this),i[0]=n[0]^n[5]>>>16^n[3]<<16,i[1]=n[2]^n[7]>>>16^n[5]<<16,i[2]=n[4]^n[1]>>>16^n[7]<<16,i[3]=n[6]^n[3]>>>16^n[1]<<16;for(var s=0;s<4;s++)i[s]=16711935&(i[s]<<8|i[s]>>>24)|4278255360&(i[s]<<24|i[s]>>>8),t[e+s]^=i[s]},blockSize:4,ivSize:2});function u(){for(var t=this._X,e=this._C,n=0;n<8;n++)r[n]=e[n];for(e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0<r[0]>>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0<r[1]>>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0<r[2]>>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0<r[3]>>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0<r[4]>>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0<r[5]>>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0<r[6]>>>0?1:0)|0,this._b=e[7]>>>0<r[7]>>>0?1:0,n=0;n<8;n++){var s=t[n]+e[n],i=65535&s,a=s>>>16,u=((i*i>>>17)+i*a>>>15)+a*a,c=((4294901760&s)*s|0)+((65535&s)*s|0);o[n]=u^c}t[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,t[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,t[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,t[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,t[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,t[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,t[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,t[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}e.Rabbit=n._createHelper(a)}(),t.Rabbit}(sa(),_a(),ba(),Ga(),Ya())),Iu||(Iu=1,Ru.exports=function(t){return function(){var e=t,n=e.lib.StreamCipher,s=e.algo,i=[],r=[],o=[],a=s.RabbitLegacy=n.extend({_doReset:function(){var t=this._key.words,e=this.cfg.iv,n=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],s=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];this._b=0;for(var i=0;i<4;i++)u.call(this);for(i=0;i<8;i++)s[i]^=n[i+4&7];if(e){var r=e.words,o=r[0],a=r[1],c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),h=c>>>16|4294901760&l,p=l<<16|65535&c;for(s[0]^=c,s[1]^=h,s[2]^=l,s[3]^=p,s[4]^=c,s[5]^=h,s[6]^=l,s[7]^=p,i=0;i<4;i++)u.call(this)}},_doProcessBlock:function(t,e){var n=this._X;u.call(this),i[0]=n[0]^n[5]>>>16^n[3]<<16,i[1]=n[2]^n[7]>>>16^n[5]<<16,i[2]=n[4]^n[1]>>>16^n[7]<<16,i[3]=n[6]^n[3]>>>16^n[1]<<16;for(var s=0;s<4;s++)i[s]=16711935&(i[s]<<8|i[s]>>>24)|4278255360&(i[s]<<24|i[s]>>>8),t[e+s]^=i[s]},blockSize:4,ivSize:2});function u(){for(var t=this._X,e=this._C,n=0;n<8;n++)r[n]=e[n];for(e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0<r[0]>>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0<r[1]>>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0<r[2]>>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0<r[3]>>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0<r[4]>>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0<r[5]>>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0<r[6]>>>0?1:0)|0,this._b=e[7]>>>0<r[7]>>>0?1:0,n=0;n<8;n++){var s=t[n]+e[n],i=65535&s,a=s>>>16,u=((i*i>>>17)+i*a>>>15)+a*a,c=((4294901760&s)*s|0)+((65535&s)*s|0);o[n]=u^c}t[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,t[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,t[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,t[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,t[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,t[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,t[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,t[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}e.RabbitLegacy=n._createHelper(a)}(),t.RabbitLegacy}(sa(),_a(),ba(),Ga(),Ya())),Pu());var Vu,Fu=Jo(ta.exports);function qu(t,e){const n=`${t}:${e}`,s=Fu.SHA256(n).toString(Fu.enc.Hex);return`${s.substring(0,8)}-${s.substring(8,12)}-4${s.substring(13,16)}-${"89AB"[parseInt(s.substring(17,18),16)%4]}${s.substring(18,21)}-${s.substring(21,33)}`}function ju(t,e){if(t instanceof Hu&&e instanceof $u)t.plug(e);else if(t instanceof Gu&&e instanceof Xu)t.plug(e);else if(t instanceof Lu&&e instanceof Uu)t.plug(e);else if(t instanceof Lu&&e instanceof Xu)t.plug(e);else if(t instanceof Lu&&e instanceof $u)t.plug(e);else if(t instanceof Hu&&e instanceof Uu)t.plug(e);else{if(!(t instanceof Gu&&e instanceof Uu))throw Error("Input and output type is not compatible");t.plug(e)}}function zu(t,e){if(t instanceof Hu&&e instanceof $u)t.unPlug(e);else if(t instanceof Gu&&e instanceof Xu)t.unPlug(e);else if(t instanceof Lu&&e instanceof Uu)t.unPlug(e);else if(t instanceof Lu&&e instanceof Xu)t.unPlug(e);else if(t instanceof Lu&&e instanceof $u)t.unPlug(e);else if(t instanceof Hu&&e instanceof Uu)t.unPlug(e);else{if(!(t instanceof Gu&&e instanceof Uu))throw Error("Input and output type is not compatible");t.unPlug(e)}}!function(t){t.AudioInput="audioInput",t.AudioOutput="audioOutput",t.MidiInput="midiInput",t.MidiOutput="midiOutput",t.ForwardInput="forwardInput",t.ForwardOutput="forwardOutput"}(Vu||(Vu={}));class Wu{id;ioType;name;plugableModule;connections=[];static unPlugAll(t){t.connections.forEach((e=>t.unPlug(e)))}constructor(t,e){this.plugableModule=t,this.id=qu(t.id,e.name),Object.assign(this,e)}plug(t,e=!0){this.connections.push(t),e&&t.plug(this,!1)}unPlug(t,e=!0){this.connections=this.connections.filter((e=>e.id!==t.id)),e&&t.unPlug(this,!1)}serialize(){return{id:this.id,name:this.name,moduleId:this.plugableModule.id,moduleName:this.plugableModule.name,ioType:this.ioType}}}class Lu extends Wu{constructor(t,e){super(t,e),this.checkNameValidity()}get subInputs(){return this.plugableModule.audioModules.map((t=>{const e=t.inputs.findByName(this.name);if(!e)throw Error(`Could not forward input ${this.name}`);return e}))}get subModules(){return this.plugableModule.audioModules}subModule(t){const e=this.subModules.find((e=>e.voiceNo===t));if(!e)throw Error(`Submodule with voiceNo ${t} not found`);return e}subInput(t){const e=this.subModule(t).inputs.findByName(this.name);if(!e)throw Error(`Could not forward input ${this.name}`);return e}plug(t,e=!0){super.plug(t,e),!e&&t instanceof Uu||(t instanceof Uu?this.subModules.forEach((e=>{const n=e.inputs.findByName(this.name);if(!n)throw Error(`Could not forward input ${this.name}`);ju(n,t.subOutput(e.voiceNo))})):this.subInputs.forEach((e=>ju(e,t))))}unPlug(t,e=!0){super.unPlug(t,e),!e&&t instanceof Uu||(t instanceof Uu?this.subModules.forEach((e=>{const n=e.inputs.findByName(this.name);if(!n)throw Error(`Could not forward input ${this.name}`);zu(n,t.subOutput(e.voiceNo))})):this.subInputs.forEach((e=>zu(e,t))))}unPlugAll(){Wu.unPlugAll(this)}checkNameValidity(){if(!this.plugableModule.audioModules[0].inputs.findByName(this.name))throw Error("You should forward to existing input")}}class Uu extends Wu{constructor(t,e){super(t,e),this.checkNameValidity()}get subOutputs(){return this.subModules.map((t=>{const e=t.outputs.findByName(this.name);if(!e)throw Error(`Could not forward input ${this.name}`);return e}))}get subModules(){return this.plugableModule.audioModules}subModule(t){const e=this.subModules.find((e=>e.voiceNo===t));if(!e)throw Error(`Submodule with voiceNo ${t} not found`);return e}subOutput(t){const e=this.subModule(t).outputs.findByName(this.name);if(!e)throw Error(`Could not forward input ${this.name}`);return e}plug(t,e=!0){super.plug(t,e),!e&&t instanceof Lu||(t instanceof Lu?this.subModules.forEach((e=>{const n=e.outputs.findByName(this.name);if(!n)throw Error(`Could not forward output ${this.name}`);ju(t.subInput(e.voiceNo),n)})):this.subOutputs.forEach((e=>ju(t,e))))}unPlug(t,e=!0){super.unPlug(t,e),!e&&t instanceof Lu||(t instanceof Lu?this.subModules.forEach((e=>{const n=e.outputs.findByName(this.name);if(!n)throw Error(`Could not forward output ${this.name}`);zu(t.subInput(e.voiceNo),n)})):this.subOutputs.forEach((e=>zu(t,e))))}unPlugAll(){Wu.unPlugAll(this)}checkNameValidity(){if(!this.plugableModule.audioModules[0].outputs.findByName(this.name))throw Error("You should forward to existing output")}}class Hu extends Wu{internalModule;constructor(t,e){super(t,e),this.internalModule=e.internalModule}plug(t,e=!0){super.plug(t,e)}unPlug(t,e=!0){super.unPlug(t,e)}unPlugAll(){Wu.unPlugAll(this)}}class $u extends Wu{internalModule;constructor(t,e){super(t,e),this.internalModule=e.internalModule}plug(t,e=!0){super.plug(t,e),t instanceof Lu||this.internalModule.connect(t.internalModule)}unPlug(t,e=!0){super.unPlug(t,e),t instanceof Lu||this.internalModule.disconnect(t.internalModule)}unPlugAll(){Wu.unPlugAll(this)}}class Gu extends Wu{onMidiEvent;constructor(t,e){super(t,e),this.onMidiEvent=e.onMidiEvent}plug(t,e=!0){super.plug(t,e)}unPlug(t,e=!0){super.unPlug(t,e)}unPlugAll(){Wu.unPlugAll(this)}}class Xu extends Wu{constructor(t,e){super(t,e)}plug(t,e=!0){super.plug(t,e)}unPlug(t,e=!0){super.unPlug(t,e)}unPlugAll(){Wu.unPlugAll(this)}onMidiEvent=t=>{this.midiConnections.forEach((e=>{e.onMidiEvent(t)}))};get midiConnections(){return this.connections.filter((t=>t instanceof Gu))}}class Zu{plugableModule;collection=[];constructor(t){this.plugableModule=t}add(t){let e;switch(t.ioType){case Vu.AudioInput:if(this.plugableModule instanceof Ku)throw Error("PolyModule is not supported");e=new Hu(this.plugableModule,t);break;case Vu.AudioOutput:if(this.plugableModule instanceof Ku)throw Error("PolyModule is not supported");e=new $u(this.plugableModule,t);break;case Vu.ForwardInput:if(this.plugableModule instanceof Qu)throw Error("MonoModule is not supported");e=new Lu(this.plugableModule,t);break;case Vu.ForwardOutput:if(this.plugableModule instanceof Qu)throw Error("MonoModule is not supported");e=new Uu(this.plugableModule,t);break;case Vu.MidiInput:e=new Gu(this.plugableModule,t);break;case Vu.MidiOutput:e=new Xu(this.plugableModule,t);break;default:throw Error("Unknown IOType")}return this.collection.push(e),e}unPlugAll(){this.collection.forEach((t=>t.unPlugAll()))}find(t){return this.collection.find((e=>e.id===t))}findByName(t){return this.collection.find((e=>e.name===t))}serialize(){return this.collection.map((t=>t.serialize()))}}class Yu{connect(){throw Error("This module is not connectable")}disconnect(){throw Error("This module is not connectable")}dispose(){}}var Qu=class{static moduleName;id;name;internalModule;inputs;outputs;voiceNo;updatedAt;_props={};constructor(t,e){this.internalModule=t,this.id=e.id||Qo(),delete e.id,this.inputs=new Zu(this),this.outputs=new Zu(this),Object.assign(this,e)}set props(t){t&&(this.updatedAt=new Date,Object.assign(this,t))}get props(){return this._props}plug(t,e,n){const s=this.outputs.findByName(e);if(!s)throw Error(`Output ${e} not exist`);const i=t.inputs.findByName(n);if(!i)throw Error(`Input ${n} not exist`);ju(i,s)}unPlugAll(){this.outputs.unPlugAll()}dispose(){this.inputs.unPlugAll(),this.outputs.unPlugAll(),this.internalModule.dispose()}triggerAttack=(t,e)=>{throw Error("triggerAttack not implemented")};triggerRelease=(t,e)=>{throw Error("triggerRelease not implemented")};onMidiEvent=t=>{if(void 0!==t.voiceNo&&t.voiceNo!==this.voiceNo)return;const{note:e,triggeredAt:n}=t;switch(t.type){case"noteOn":{const{duration:t}=e;if(this.triggerer(this.triggerAttack,e,n),t){const r=n+(s=t,new Xi(zi(),s,i)).toSeconds();this.triggerer(this.triggerRelease,e,r)}break}case"noteOff":this.triggerer(this.triggerRelease,e,n);break;default:throw Error("This type is not a note")}var s,i};triggerer(t,e,n){t(e,n)}serialize(){const t=this.constructor;return{id:this.id,name:this.name,type:t.moduleName,props:this.props,inputs:this.inputs.serialize(),outputs:this.outputs.serialize()}}registerMidiInput(t){return this.inputs.add({...t,ioType:Vu.MidiInput})}registerAudioInput(t){return this.inputs.add({...t,ioType:Vu.AudioInput})}registerMidiOutput(t){return this.outputs.add({...t,ioType:Vu.MidiOutput})}registerAudioOutput(t){return this.outputs.add({...t,ioType:Vu.AudioOutput})}registerBasicOutputs(){this.registerAudioOutput({name:"output",internalModule:this.internalModule})}registerBasicInputs(){this.registerAudioInput({name:"input",internalModule:this.internalModule}),this.registerDefaultMidiInput()}registerDefaultMidiInput(){this.registerMidiInput({name:"midi in",onMidiEvent:this.onMidiEvent})}};class Ku{static moduleName;id;child;_name;audioModules;inputs;outputs;_numberOfVoices;constructor(t){this.id=t.id||Qo(),delete t.id,this.audioModules=[];const{child:e,props:n,...s}=t;this.child=e,Object.assign(this,s),this.numberOfVoices=t.numberOfVoices||1,this.inputs=new Zu(this),this.outputs=new Zu(this),Object.assign(this,{props:n})}get name(){return this._name}set name(t){this._name=t,this.audioModules.forEach((e=>e.name=t))}get props(){if(0===this.audioModules.length)throw Error("There isn't any initialized module");return this.audioModules[0].props}set props(t){Object.assign(this,t),this.audioModules.forEach((e=>e.props=t))}get numberOfVoices(){return this._numberOfVoices}set numberOfVoices(t){this._numberOfVoices=t,this.adjustNumberOfModules()}plug(t,e,n){const s=this.outputs.findByName(e);if(!s)throw Error(`Output ${e} not exist`);const i=t.inputs.findByName(n);if(!i)throw Error(`Input ${n} not exist`);ju(i,s)}unPlugAll(){this.outputs.unPlugAll()}dispose(){this.unPlugAll(),this.audioModules.forEach((t=>t.dispose()))}onMidiEvent=t=>{const e=t.voiceNo||0,n=this.findVoice(e);n?.onMidiEvent(t)};serialize(){if(0===this.audioModules.length)throw Error("There isn't any initialized module");const t=this.constructor;return{...this.audioModules[0].serialize(),id:this.id,type:t.moduleName,numberOfVoices:this.numberOfVoices,inputs:this.inputs.serialize(),outputs:this.outputs.serialize()}}find(t){const e=this.audioModules.find(t);if(!e)throw Error("Audio module not found");return e}findVoice(t){return this.audioModules.find((e=>e.voiceNo===t))}registerInput(t){return this.inputs.add({...t,ioType:Vu.ForwardInput})}registerOutput(t){return this.outputs.add({...t,ioType:Vu.ForwardOutput})}registerMidiInput(t){return this.inputs.add({...t,ioType:Vu.MidiInput})}registerMidiOutput(t){return this.outputs.add({...t,ioType:Vu.MidiOutput})}registerBasicOutputs(){this.registerOutput({name:"output"})}registerBasicInputs(){this.registerInput({name:"input"}),this.registerMidiInput({name:"midi in",onMidiEvent:this.onMidiEvent})}adjustNumberOfModules(){if(this.audioModules.length!==this.numberOfVoices){if(this.audioModules.length>this.numberOfVoices){const t=this.audioModules.pop();t?.dispose()}else{const t=this.audioModules.length,e=qu(this.id,t.toString()),n=0===t?{}:this.props,s=new this.child({id:e,name:this.name,props:{...n,voiceNo:t}});if(s instanceof Ku)throw Error("Polymodule not supported");this.audioModules.push(s)}this.adjustNumberOfModules()}}}var Ju={exports:{}};
24
+ return function(e){var n=t,s=n.lib,i=s.WordArray,r=s.Hasher,o=n.algo,a=i.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),u=i.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),c=i.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),l=i.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),h=i.create([0,1518500249,1859775393,2400959708,2840853838]),p=i.create([1352829926,1548603684,1836072691,2053994217,0]),d=o.RIPEMD160=r.extend({_doReset:function(){this._hash=i.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var n=0;n<16;n++){var s=e+n,i=t[s];t[s]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var r,o,d,w,b,x,T,A,k,C,S,O=this._hash.words,M=h.words,E=p.words,D=a.words,I=u.words,R=c.words,N=l.words;for(x=r=O[0],T=o=O[1],A=d=O[2],k=w=O[3],C=b=O[4],n=0;n<80;n+=1)S=r+t[e+D[n]]|0,S+=n<16?f(o,d,w)+M[0]:n<32?_(o,d,w)+M[1]:n<48?m(o,d,w)+M[2]:n<64?g(o,d,w)+M[3]:v(o,d,w)+M[4],S=(S=y(S|=0,R[n]))+b|0,r=b,b=w,w=y(d,10),d=o,o=S,S=x+t[e+I[n]]|0,S+=n<16?v(T,A,k)+E[0]:n<32?g(T,A,k)+E[1]:n<48?m(T,A,k)+E[2]:n<64?_(T,A,k)+E[3]:f(T,A,k)+E[4],S=(S=y(S|=0,N[n]))+C|0,x=C,C=k,k=y(A,10),A=T,T=S;S=O[1]+d+k|0,O[1]=O[2]+w+C|0,O[2]=O[3]+b+x|0,O[3]=O[4]+r+T|0,O[4]=O[0]+o+A|0,O[0]=S},_doFinalize:function(){var t=this._data,e=t.words,n=8*this._nDataBytes,s=8*t.sigBytes;e[s>>>5]|=128<<24-s%32,e[14+(s+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),t.sigBytes=4*(e.length+1),this._process();for(var i=this._hash,r=i.words,o=0;o<5;o++){var a=r[o];r[o]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}return i},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t}});function f(t,e,n){return t^e^n}function _(t,e,n){return t&e|~t&n}function m(t,e,n){return(t|~e)^n}function g(t,e,n){return t&n|e&~n}function v(t,e,n){return t^(e|~n)}function y(t,e){return t<<e|t>>>32-e}n.RIPEMD160=r._createHelper(d),n.HmacRIPEMD160=r._createHmacHelper(d)}(),t.RIPEMD160}(sa())),Wa(),La||(La=1,Ua.exports=function(t){return s=(n=(e=t).lib).Base,i=n.WordArray,o=(r=e.algo).SHA256,a=r.HMAC,u=r.PBKDF2=s.extend({cfg:s.extend({keySize:4,hasher:o,iterations:25e4}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){for(var n=this.cfg,s=a.create(n.hasher,t),r=i.create(),o=i.create([1]),u=r.words,c=o.words,l=n.keySize,h=n.iterations;u.length<l;){var p=s.update(e).finalize(o);s.reset();for(var d=p.words,f=d.length,_=p,m=1;m<h;m++){_=s.finalize(_),s.reset();for(var g=_.words,v=0;v<f;v++)d[v]^=g[v]}r.concat(p),c[0]++}return r.sigBytes=4*l,r}}),e.PBKDF2=function(t,e,n){return u.create(n).compute(t,e)},t.PBKDF2;var e,n,s,i,r,o,a,u}(sa(),Sa(),Wa())),Ga(),Ya(),Ja(),nu(),ru(),uu(),cu||(cu=1,lu.exports=function(t){return t.mode.ECB=((e=t.lib.BlockCipherMode.extend()).Encryptor=e.extend({processBlock:function(t,e){this._cipher.encryptBlock(t,e)}}),e.Decryptor=e.extend({processBlock:function(t,e){this._cipher.decryptBlock(t,e)}}),e),t.mode.ECB;var e}(sa(),Ya())),hu||(hu=1,pu.exports=function(t){return t.pad.AnsiX923={pad:function(t,e){var n=t.sigBytes,s=4*e,i=s-n%s,r=n+i-1;t.clamp(),t.words[r>>>2]|=i<<24-r%4*8,t.sigBytes+=i},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},t.pad.Ansix923}(sa(),Ya())),du||(du=1,fu.exports=function(t){return t.pad.Iso10126={pad:function(e,n){var s=4*n,i=s-e.sigBytes%s;e.concat(t.lib.WordArray.random(i-1)).concat(t.lib.WordArray.create([i<<24],1))},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},t.pad.Iso10126}(sa(),Ya())),_u||(_u=1,mu.exports=function(t){return t.pad.Iso97971={pad:function(e,n){e.concat(t.lib.WordArray.create([2147483648],1)),t.pad.ZeroPadding.pad(e,n)},unpad:function(e){t.pad.ZeroPadding.unpad(e),e.sigBytes--}},t.pad.Iso97971}(sa(),Ya())),gu||(gu=1,vu.exports=function(t){return t.pad.ZeroPadding={pad:function(t,e){var n=4*e;t.clamp(),t.sigBytes+=n-(t.sigBytes%n||n)},unpad:function(t){var e=t.words,n=t.sigBytes-1;for(n=t.sigBytes-1;n>=0;n--)if(e[n>>>2]>>>24-n%4*8&255){t.sigBytes=n+1;break}}},t.pad.ZeroPadding}(sa(),Ya())),yu||(yu=1,wu.exports=function(t){return t.pad.NoPadding={pad:function(){},unpad:function(){}},t.pad.NoPadding}(sa(),Ya())),bu||(bu=1,xu.exports=function(t){return n=(e=t).lib.CipherParams,s=e.enc.Hex,e.format.Hex={stringify:function(t){return t.ciphertext.toString(s)},parse:function(t){var e=s.parse(t);return n.create({ciphertext:e})}},t.format.Hex;var e,n,s}(sa(),Ya())),Tu||(Tu=1,Au.exports=function(t){return function(){var e=t,n=e.lib.BlockCipher,s=e.algo,i=[],r=[],o=[],a=[],u=[],c=[],l=[],h=[],p=[],d=[];!function(){for(var t=[],e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;var n=0,s=0;for(e=0;e<256;e++){var f=s^s<<1^s<<2^s<<3^s<<4;f=f>>>8^255&f^99,i[n]=f,r[f]=n;var _=t[n],m=t[_],g=t[m],v=257*t[f]^16843008*f;o[n]=v<<24|v>>>8,a[n]=v<<16|v>>>16,u[n]=v<<8|v>>>24,c[n]=v,v=16843009*g^65537*m^257*_^16843008*n,l[f]=v<<24|v>>>8,h[f]=v<<16|v>>>16,p[f]=v<<8|v>>>24,d[f]=v,n?(n=_^t[t[t[g^_]]],s^=t[t[s]]):n=s=1}}();var f=[0,1,2,4,8,16,32,64,128,27,54],_=s.AES=n.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var t=this._keyPriorReset=this._key,e=t.words,n=t.sigBytes/4,s=4*((this._nRounds=n+6)+1),r=this._keySchedule=[],o=0;o<s;o++)o<n?r[o]=e[o]:(c=r[o-1],o%n?n>6&&o%n==4&&(c=i[c>>>24]<<24|i[c>>>16&255]<<16|i[c>>>8&255]<<8|i[255&c]):(c=i[(c=c<<8|c>>>24)>>>24]<<24|i[c>>>16&255]<<16|i[c>>>8&255]<<8|i[255&c],c^=f[o/n|0]<<24),r[o]=r[o-n]^c);for(var a=this._invKeySchedule=[],u=0;u<s;u++){if(o=s-u,u%4)var c=r[o];else c=r[o-4];a[u]=u<4||o<=4?c:l[i[c>>>24]]^h[i[c>>>16&255]]^p[i[c>>>8&255]]^d[i[255&c]]}}},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._keySchedule,o,a,u,c,i)},decryptBlock:function(t,e){var n=t[e+1];t[e+1]=t[e+3],t[e+3]=n,this._doCryptBlock(t,e,this._invKeySchedule,l,h,p,d,r),n=t[e+1],t[e+1]=t[e+3],t[e+3]=n},_doCryptBlock:function(t,e,n,s,i,r,o,a){for(var u=this._nRounds,c=t[e]^n[0],l=t[e+1]^n[1],h=t[e+2]^n[2],p=t[e+3]^n[3],d=4,f=1;f<u;f++){var _=s[c>>>24]^i[l>>>16&255]^r[h>>>8&255]^o[255&p]^n[d++],m=s[l>>>24]^i[h>>>16&255]^r[p>>>8&255]^o[255&c]^n[d++],g=s[h>>>24]^i[p>>>16&255]^r[c>>>8&255]^o[255&l]^n[d++],v=s[p>>>24]^i[c>>>16&255]^r[l>>>8&255]^o[255&h]^n[d++];c=_,l=m,h=g,p=v}_=(a[c>>>24]<<24|a[l>>>16&255]<<16|a[h>>>8&255]<<8|a[255&p])^n[d++],m=(a[l>>>24]<<24|a[h>>>16&255]<<16|a[p>>>8&255]<<8|a[255&c])^n[d++],g=(a[h>>>24]<<24|a[p>>>16&255]<<16|a[c>>>8&255]<<8|a[255&l])^n[d++],v=(a[p>>>24]<<24|a[c>>>16&255]<<16|a[l>>>8&255]<<8|a[255&h])^n[d++],t[e]=_,t[e+1]=m,t[e+2]=g,t[e+3]=v},keySize:8});e.AES=n._createHelper(_)}(),t.AES}(sa(),_a(),ba(),Ga(),Ya())),Su(),Ou||(Ou=1,Mu.exports=function(t){return function(){var e=t,n=e.lib.StreamCipher,s=e.algo,i=s.RC4=n.extend({_doReset:function(){for(var t=this._key,e=t.words,n=t.sigBytes,s=this._S=[],i=0;i<256;i++)s[i]=i;i=0;for(var r=0;i<256;i++){var o=i%n,a=e[o>>>2]>>>24-o%4*8&255;r=(r+s[i]+a)%256;var u=s[i];s[i]=s[r],s[r]=u}this._i=this._j=0},_doProcessBlock:function(t,e){t[e]^=r.call(this)},keySize:8,ivSize:0});function r(){for(var t=this._S,e=this._i,n=this._j,s=0,i=0;i<4;i++){n=(n+t[e=(e+1)%256])%256;var r=t[e];t[e]=t[n],t[n]=r,s|=t[(t[e]+t[n])%256]<<24-8*i}return this._i=e,this._j=n,s}e.RC4=n._createHelper(i);var o=s.RC4Drop=i.extend({cfg:i.cfg.extend({drop:192}),_doReset:function(){i._doReset.call(this);for(var t=this.cfg.drop;t>0;t--)r.call(this)}});e.RC4Drop=n._createHelper(o)}(),t.RC4}(sa(),_a(),ba(),Ga(),Ya())),Eu||(Eu=1,Du.exports=function(t){return function(){var e=t,n=e.lib.StreamCipher,s=e.algo,i=[],r=[],o=[],a=s.Rabbit=n.extend({_doReset:function(){for(var t=this._key.words,e=this.cfg.iv,n=0;n<4;n++)t[n]=16711935&(t[n]<<8|t[n]>>>24)|4278255360&(t[n]<<24|t[n]>>>8);var s=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],i=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];for(this._b=0,n=0;n<4;n++)u.call(this);for(n=0;n<8;n++)i[n]^=s[n+4&7];if(e){var r=e.words,o=r[0],a=r[1],c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),h=c>>>16|4294901760&l,p=l<<16|65535&c;for(i[0]^=c,i[1]^=h,i[2]^=l,i[3]^=p,i[4]^=c,i[5]^=h,i[6]^=l,i[7]^=p,n=0;n<4;n++)u.call(this)}},_doProcessBlock:function(t,e){var n=this._X;u.call(this),i[0]=n[0]^n[5]>>>16^n[3]<<16,i[1]=n[2]^n[7]>>>16^n[5]<<16,i[2]=n[4]^n[1]>>>16^n[7]<<16,i[3]=n[6]^n[3]>>>16^n[1]<<16;for(var s=0;s<4;s++)i[s]=16711935&(i[s]<<8|i[s]>>>24)|4278255360&(i[s]<<24|i[s]>>>8),t[e+s]^=i[s]},blockSize:4,ivSize:2});function u(){for(var t=this._X,e=this._C,n=0;n<8;n++)r[n]=e[n];for(e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0<r[0]>>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0<r[1]>>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0<r[2]>>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0<r[3]>>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0<r[4]>>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0<r[5]>>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0<r[6]>>>0?1:0)|0,this._b=e[7]>>>0<r[7]>>>0?1:0,n=0;n<8;n++){var s=t[n]+e[n],i=65535&s,a=s>>>16,u=((i*i>>>17)+i*a>>>15)+a*a,c=((4294901760&s)*s|0)+((65535&s)*s|0);o[n]=u^c}t[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,t[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,t[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,t[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,t[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,t[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,t[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,t[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}e.Rabbit=n._createHelper(a)}(),t.Rabbit}(sa(),_a(),ba(),Ga(),Ya())),Iu||(Iu=1,Ru.exports=function(t){return function(){var e=t,n=e.lib.StreamCipher,s=e.algo,i=[],r=[],o=[],a=s.RabbitLegacy=n.extend({_doReset:function(){var t=this._key.words,e=this.cfg.iv,n=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],s=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];this._b=0;for(var i=0;i<4;i++)u.call(this);for(i=0;i<8;i++)s[i]^=n[i+4&7];if(e){var r=e.words,o=r[0],a=r[1],c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),h=c>>>16|4294901760&l,p=l<<16|65535&c;for(s[0]^=c,s[1]^=h,s[2]^=l,s[3]^=p,s[4]^=c,s[5]^=h,s[6]^=l,s[7]^=p,i=0;i<4;i++)u.call(this)}},_doProcessBlock:function(t,e){var n=this._X;u.call(this),i[0]=n[0]^n[5]>>>16^n[3]<<16,i[1]=n[2]^n[7]>>>16^n[5]<<16,i[2]=n[4]^n[1]>>>16^n[7]<<16,i[3]=n[6]^n[3]>>>16^n[1]<<16;for(var s=0;s<4;s++)i[s]=16711935&(i[s]<<8|i[s]>>>24)|4278255360&(i[s]<<24|i[s]>>>8),t[e+s]^=i[s]},blockSize:4,ivSize:2});function u(){for(var t=this._X,e=this._C,n=0;n<8;n++)r[n]=e[n];for(e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0<r[0]>>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0<r[1]>>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0<r[2]>>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0<r[3]>>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0<r[4]>>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0<r[5]>>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0<r[6]>>>0?1:0)|0,this._b=e[7]>>>0<r[7]>>>0?1:0,n=0;n<8;n++){var s=t[n]+e[n],i=65535&s,a=s>>>16,u=((i*i>>>17)+i*a>>>15)+a*a,c=((4294901760&s)*s|0)+((65535&s)*s|0);o[n]=u^c}t[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,t[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,t[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,t[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,t[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,t[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,t[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,t[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}e.RabbitLegacy=n._createHelper(a)}(),t.RabbitLegacy}(sa(),_a(),ba(),Ga(),Ya())),Pu());var Vu,Fu=Jo(ta.exports);function qu(t,e){const n=`${t}:${e}`,s=Fu.SHA256(n).toString(Fu.enc.Hex);return`${s.substring(0,8)}-${s.substring(8,12)}-4${s.substring(13,16)}-${"89AB"[parseInt(s.substring(17,18),16)%4]}${s.substring(18,21)}-${s.substring(21,33)}`}function ju(t,e){if(t instanceof Hu&&e instanceof $u)t.plug(e);else if(t instanceof Gu&&e instanceof Xu)t.plug(e);else if(t instanceof Lu&&e instanceof Uu)t.plug(e);else if(t instanceof Lu&&e instanceof Xu)t.plug(e);else if(t instanceof Lu&&e instanceof $u)t.plug(e);else if(t instanceof Hu&&e instanceof Uu)t.plug(e);else{if(!(t instanceof Gu&&e instanceof Uu))throw Error("Input and output type is not compatible");t.plug(e)}}function zu(t,e){if(t instanceof Hu&&e instanceof $u)t.unPlug(e);else if(t instanceof Gu&&e instanceof Xu)t.unPlug(e);else if(t instanceof Lu&&e instanceof Uu)t.unPlug(e);else if(t instanceof Lu&&e instanceof Xu)t.unPlug(e);else if(t instanceof Lu&&e instanceof $u)t.unPlug(e);else if(t instanceof Hu&&e instanceof Uu)t.unPlug(e);else{if(!(t instanceof Gu&&e instanceof Uu))throw Error("Input and output type is not compatible");t.unPlug(e)}}!function(t){t.AudioInput="audioInput",t.AudioOutput="audioOutput",t.MidiInput="midiInput",t.MidiOutput="midiOutput",t.ForwardInput="forwardInput",t.ForwardOutput="forwardOutput"}(Vu||(Vu={}));class Wu{id;ioType;name;plugableModule;connections=[];static unPlugAll(t){t.connections.forEach((e=>t.unPlug(e)))}constructor(t,e){this.plugableModule=t,this.id=qu(t.id,e.name),Object.assign(this,e)}plug(t,e=!0){this.connections.push(t),e&&t.plug(this,!1)}unPlug(t,e=!0){this.connections=this.connections.filter((e=>e.id!==t.id)),e&&t.unPlug(this,!1)}serialize(){return{id:this.id,name:this.name,moduleId:this.plugableModule.id,moduleName:this.plugableModule.name,ioType:this.ioType}}}class Lu extends Wu{constructor(t,e){super(t,e),this.checkNameValidity()}get subInputs(){return this.plugableModule.audioModules.map((t=>{const e=t.inputs.findByName(this.name);if(!e)throw Error(`Could not forward input ${this.name}`);return e}))}get subModules(){return this.plugableModule.audioModules}subModule(t){const e=this.subModules.find((e=>e.voiceNo===t));if(!e)throw Error(`Submodule with voiceNo ${t} not found`);return e}subInput(t){const e=this.subModule(t).inputs.findByName(this.name);if(!e)throw Error(`Could not forward input ${this.name}`);return e}plug(t,e=!0){super.plug(t,e),!e&&t instanceof Uu||(t instanceof Uu?this.subModules.forEach((e=>{const n=e.inputs.findByName(this.name);if(!n)throw Error(`Could not forward input ${this.name}`);ju(n,t.subOutput(e.voiceNo))})):this.subInputs.forEach((e=>ju(e,t))))}unPlug(t,e=!0){super.unPlug(t,e),!e&&t instanceof Uu||(t instanceof Uu?this.subModules.forEach((e=>{const n=e.inputs.findByName(this.name);if(!n)throw Error(`Could not forward input ${this.name}`);zu(n,t.subOutput(e.voiceNo))})):this.subInputs.forEach((e=>zu(e,t))))}unPlugAll(){Wu.unPlugAll(this)}checkNameValidity(){if(!this.plugableModule.audioModules[0].inputs.findByName(this.name))throw Error("You should forward to existing input")}}class Uu extends Wu{constructor(t,e){super(t,e),this.checkNameValidity()}get subOutputs(){return this.subModules.map((t=>{const e=t.outputs.findByName(this.name);if(!e)throw Error(`Could not forward input ${this.name}`);return e}))}get subModules(){return this.plugableModule.audioModules}subModule(t){const e=this.subModules.find((e=>e.voiceNo===t));if(!e)throw Error(`Submodule with voiceNo ${t} not found`);return e}subOutput(t){const e=this.subModule(t).outputs.findByName(this.name);if(!e)throw Error(`Could not forward input ${this.name}`);return e}plug(t,e=!0){super.plug(t,e),!e&&t instanceof Lu||(t instanceof Lu?this.subModules.forEach((e=>{const n=e.outputs.findByName(this.name);if(!n)throw Error(`Could not forward output ${this.name}`);ju(t.subInput(e.voiceNo),n)})):this.subOutputs.forEach((e=>ju(t,e))))}unPlug(t,e=!0){super.unPlug(t,e),!e&&t instanceof Lu||(t instanceof Lu?this.subModules.forEach((e=>{const n=e.outputs.findByName(this.name);if(!n)throw Error(`Could not forward output ${this.name}`);zu(t.subInput(e.voiceNo),n)})):this.subOutputs.forEach((e=>zu(t,e))))}unPlugAll(){Wu.unPlugAll(this)}checkNameValidity(){if(!this.plugableModule.audioModules[0].outputs.findByName(this.name))throw Error("You should forward to existing output")}}class Hu extends Wu{internalModule;constructor(t,e){super(t,e),this.internalModule=e.internalModule}plug(t,e=!0){super.plug(t,e)}unPlug(t,e=!0){super.unPlug(t,e)}unPlugAll(){Wu.unPlugAll(this)}}class $u extends Wu{internalModule;constructor(t,e){super(t,e),this.internalModule=e.internalModule}plug(t,e=!0){super.plug(t,e),t instanceof Lu||this.internalModule.connect(t.internalModule)}unPlug(t,e=!0){if(super.unPlug(t,e),!(t instanceof Lu))try{this.internalModule.disconnect(t.internalModule)}catch(t){console.error(t)}}unPlugAll(){Wu.unPlugAll(this)}}class Gu extends Wu{onMidiEvent;constructor(t,e){super(t,e),this.onMidiEvent=e.onMidiEvent}plug(t,e=!0){super.plug(t,e)}unPlug(t,e=!0){super.unPlug(t,e)}unPlugAll(){Wu.unPlugAll(this)}}class Xu extends Wu{constructor(t,e){super(t,e)}plug(t,e=!0){super.plug(t,e)}unPlug(t,e=!0){super.unPlug(t,e)}unPlugAll(){Wu.unPlugAll(this)}onMidiEvent=t=>{this.midiConnections.forEach((e=>{e.onMidiEvent(t)}))};get midiConnections(){return this.connections.filter((t=>t instanceof Gu))}}class Zu{plugableModule;collection=[];constructor(t){this.plugableModule=t}add(t){let e;switch(t.ioType){case Vu.AudioInput:if(this.plugableModule instanceof Ku)throw Error("PolyModule is not supported");e=new Hu(this.plugableModule,t);break;case Vu.AudioOutput:if(this.plugableModule instanceof Ku)throw Error("PolyModule is not supported");e=new $u(this.plugableModule,t);break;case Vu.ForwardInput:if(this.plugableModule instanceof Qu)throw Error("MonoModule is not supported");e=new Lu(this.plugableModule,t);break;case Vu.ForwardOutput:if(this.plugableModule instanceof Qu)throw Error("MonoModule is not supported");e=new Uu(this.plugableModule,t);break;case Vu.MidiInput:e=new Gu(this.plugableModule,t);break;case Vu.MidiOutput:e=new Xu(this.plugableModule,t);break;default:throw Error("Unknown IOType")}return this.collection.push(e),e}unPlugAll(){this.collection.forEach((t=>t.unPlugAll()))}find(t){return this.collection.find((e=>e.id===t))}findByName(t){return this.collection.find((e=>e.name===t))}serialize(){return this.collection.map((t=>t.serialize()))}}class Yu{connect(){throw Error("This module is not connectable")}disconnect(){throw Error("This module is not connectable")}dispose(){}}var Qu=class{static moduleName;id;name;internalModule;inputs;outputs;voiceNo;updatedAt;_props={};constructor(t,e){this.internalModule=t,this.id=e.id||Qo(),delete e.id,this.inputs=new Zu(this),this.outputs=new Zu(this),Object.assign(this,e)}set props(t){t&&(this.updatedAt=new Date,Object.assign(this,t))}get props(){return this._props}plug(t,e,n){const s=this.outputs.findByName(e);if(!s)throw Error(`Output ${e} not exist`);const i=t.inputs.findByName(n);if(!i)throw Error(`Input ${n} not exist`);ju(i,s)}unPlugAll(){this.outputs.unPlugAll()}dispose(){this.inputs.unPlugAll(),this.outputs.unPlugAll(),this.internalModule.dispose()}triggerAttack=(t,e)=>{throw Error("triggerAttack not implemented")};triggerRelease=(t,e)=>{throw Error("triggerRelease not implemented")};onMidiEvent=t=>{if(void 0!==t.voiceNo&&t.voiceNo!==this.voiceNo)return;const{note:e,triggeredAt:n}=t;switch(t.type){case"noteOn":{const{duration:t}=e;if(this.triggerer(this.triggerAttack,e,n),t){const r=n+(s=t,new Xi(zi(),s,i)).toSeconds();this.triggerer(this.triggerRelease,e,r)}break}case"noteOff":this.triggerer(this.triggerRelease,e,n);break;default:throw Error("This type is not a note")}var s,i};triggerer(t,e,n){t(e,n)}serialize(){const t=this.constructor;return{id:this.id,name:this.name,type:t.moduleName,props:this.props,inputs:this.inputs.serialize(),outputs:this.outputs.serialize()}}registerMidiInput(t){return this.inputs.add({...t,ioType:Vu.MidiInput})}registerAudioInput(t){return this.inputs.add({...t,ioType:Vu.AudioInput})}registerMidiOutput(t){return this.outputs.add({...t,ioType:Vu.MidiOutput})}registerAudioOutput(t){return this.outputs.add({...t,ioType:Vu.AudioOutput})}registerBasicOutputs(){this.registerAudioOutput({name:"output",internalModule:this.internalModule})}registerBasicInputs(){this.registerAudioInput({name:"input",internalModule:this.internalModule}),this.registerDefaultMidiInput()}registerDefaultMidiInput(){this.registerMidiInput({name:"midi in",onMidiEvent:this.onMidiEvent})}};class Ku{static moduleName;id;child;_name;audioModules;inputs;outputs;_numberOfVoices;constructor(t){this.id=t.id||Qo(),delete t.id,this.audioModules=[];const{child:e,props:n,...s}=t;this.child=e,Object.assign(this,s),this.numberOfVoices=t.numberOfVoices||1,this.inputs=new Zu(this),this.outputs=new Zu(this),Object.assign(this,{props:n})}get name(){return this._name}set name(t){this._name=t,this.audioModules.forEach((e=>e.name=t))}get props(){if(0===this.audioModules.length)throw Error("There isn't any initialized module");return this.audioModules[0].props}set props(t){Object.assign(this,t),this.audioModules.forEach((e=>e.props=t))}get numberOfVoices(){return this._numberOfVoices}set numberOfVoices(t){this._numberOfVoices=t,this.adjustNumberOfModules()}plug(t,e,n){const s=this.outputs.findByName(e);if(!s)throw Error(`Output ${e} not exist`);const i=t.inputs.findByName(n);if(!i)throw Error(`Input ${n} not exist`);ju(i,s)}unPlugAll(){this.outputs.unPlugAll()}dispose(){this.unPlugAll(),this.audioModules.forEach((t=>t.dispose()))}onMidiEvent=t=>{const e=t.voiceNo||0,n=this.findVoice(e);n?.onMidiEvent(t)};serialize(){if(0===this.audioModules.length)throw Error("There isn't any initialized module");const t=this.constructor;return{...this.audioModules[0].serialize(),id:this.id,type:t.moduleName,numberOfVoices:this.numberOfVoices,inputs:this.inputs.serialize(),outputs:this.outputs.serialize()}}find(t){const e=this.audioModules.find(t);if(!e)throw Error("Audio module not found");return e}findVoice(t){return this.audioModules.find((e=>e.voiceNo===t))}registerInput(t){return this.inputs.add({...t,ioType:Vu.ForwardInput})}registerOutput(t){return this.outputs.add({...t,ioType:Vu.ForwardOutput})}registerMidiInput(t){return this.inputs.add({...t,ioType:Vu.MidiInput})}registerMidiOutput(t){return this.outputs.add({...t,ioType:Vu.MidiOutput})}registerBasicOutputs(){this.registerOutput({name:"output"})}registerBasicInputs(){this.registerInput({name:"input"}),this.registerMidiInput({name:"midi in",onMidiEvent:this.onMidiEvent})}adjustNumberOfModules(){if(this.audioModules.length!==this.numberOfVoices){if(this.audioModules.length>this.numberOfVoices){const t=this.audioModules.pop();t?.dispose()}else{const t=this.audioModules.length,e=qu(this.id,t.toString()),n=0===t?{}:this.props,s=new this.child({id:e,name:this.name,props:{...n,voiceNo:t}});if(s instanceof Ku)throw Error("Polymodule not supported");this.audioModules.push(s)}this.adjustNumberOfModules()}}}var Ju={exports:{}};
25
25
  /**
26
26
  * @license
27
27
  * Lodash <https://lodash.com/>