!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).MidiPlayer=t()}}(function(){return function t(e,r,n){function i(o,a){if(!r[o]){if(!e[o]){var u="function"==typeof require&&require;if(!a&&u)return u(o,!0);if(s)return s(o,!0);var h=new Error("Cannot find module '"+o+"'");throw h.code="MODULE_NOT_FOUND",h}var f=r[o]={exports:{}};e[o][0].call(f.exports,function(t){var r=e[o][1][t];return i(r||t)},f,f.exports,t,e,r,n)}return r[o].exports}for(var s="function"==typeof require&&require,o=0;o0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function i(t){return o[t>>18&63]+o[t>>12&63]+o[t>>6&63]+o[63&t]}function s(t,e,r){for(var n,s=[],o=e;o0?h-4:h;var f=0;for(e=0;e>16&255,o[f++]=i>>8&255,o[f++]=255&i;return 2===s?(i=a[t.charCodeAt(e)]<<2|a[t.charCodeAt(e+1)]>>4,o[f++]=255&i):1===s&&(i=a[t.charCodeAt(e)]<<10|a[t.charCodeAt(e+1)]<<4|a[t.charCodeAt(e+2)]>>2,o[f++]=i>>8&255,o[f++]=255&i),o},r.fromByteArray=function(t){for(var e,r=t.length,n=r%3,i="",a=[],u=0,h=r-n;uh?h:u+16383));return 1===n?(e=t[r-1],i+=o[e>>2],i+=o[e<<4&63],i+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],i+=o[e>>10],i+=o[e>>4&63],i+=o[e<<2&63],i+="="),a.push(i),a.join("")};for(var o=[],a=[],u="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",f=0,c=h.length;f_)throw new RangeError("Invalid typed array length");var e=new Uint8Array(t);return e.__proto__=i.prototype,e}function i(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return a(t)}return s(t,e,r)}function s(t,e,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return L(t)?function(t,e,r){if(e<0||t.byteLength=_)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+_.toString(16)+" bytes");return 0|t}function f(t,e){if(i.isBuffer(t))return t.length;if(U(t)||L(t))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return A(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return C(t).length;default:if(n)return A(t).length;e=(""+e).toLowerCase(),n=!0}}function c(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,e>>>=0,r<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return function(t,e,r){var n=t.length;(!e||e<0)&&(e=0);(!r||r<0||r>n)&&(r=n);for(var i="",s=e;s2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,M(r)&&(r=s?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(s)return-1;r=t.length-1}else if(r<0){if(!s)return-1;r=0}if("string"==typeof e&&(e=i.from(e,n)),i.isBuffer(e))return 0===e.length?-1:y(t,e,r,n,s);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?s?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):y(t,[e],r,n,s);throw new TypeError("val must be string, number or Buffer")}function y(t,e,r,n,i){function s(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}var o=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;o=2,a/=2,u/=2,r/=2}var h;if(i){var f=-1;for(h=r;ha&&(r=a-u),h=r;h>=0;h--){for(var c=!0,l=0;li&&(n=i):n=i;var s=e.length;if(s%2!=0)throw new TypeError("Invalid hex string");n>s/2&&(n=s/2);for(var o=0;o>8,i=r%256,s.push(i),s.push(n);return s}(e,t.length-r),t,r,n)}function k(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:s>223?3:s>191?2:1;if(i+a<=r){var u,h,f,c;switch(a){case 1:s<128&&(o=s);break;case 2:128==(192&(u=t[i+1]))&&(c=(31&s)<<6|63&u)>127&&(o=c);break;case 3:u=t[i+1],h=t[i+2],128==(192&u)&&128==(192&h)&&(c=(15&s)<<12|(63&u)<<6|63&h)>2047&&(c<55296||c>57343)&&(o=c);break;case 4:u=t[i+1],h=t[i+2],f=t[i+3],128==(192&u)&&128==(192&h)&&128==(192&f)&&(c=(15&s)<<18|(63&u)<<12|(63&h)<<6|63&f)>65535&&c<1114112&&(o=c)}}null===o?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=a}return function(t){var e=t.length;if(e<=D)return String.fromCharCode.apply(String,t);var r="",n=0;for(;nr)throw new RangeError("Trying to access beyond buffer length")}function T(t,e,r,n,s,o){if(!i.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>s||et.length)throw new RangeError("Index out of range")}function S(t,e,r,n,i,s){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function I(t,e,r,n,i){return e=+e,r>>>=0,i||S(t,0,r,4),P.write(t,e,r,n,23,4),r+4}function B(t,e,r,n,i){return e=+e,r>>>=0,i||S(t,0,r,8),P.write(t,e,r,n,52,8),r+8}function A(t,e){e=e||1/0;for(var r,n=t.length,i=null,s=[],o=0;o55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function C(t){return N.toByteArray(function(t){if((t=t.trim().replace(O,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function x(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function L(t){return t instanceof ArrayBuffer||null!=t&&null!=t.constructor&&"ArrayBuffer"===t.constructor.name&&"number"==typeof t.byteLength}function U(t){return"function"==typeof ArrayBuffer.isView&&ArrayBuffer.isView(t)}function M(t){return t!=t}var N=t("base64-js"),P=t("ieee754");r.Buffer=i,r.SlowBuffer=function(t){return+t!=t&&(t=0),i.alloc(+t)},r.INSPECT_MAX_BYTES=50;var _=2147483647;r.kMaxLength=_,(i.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(t){return!1}}())||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),i.poolSize=8192,i.from=function(t,e,r){return s(t,e,r)},i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,i.alloc=function(t,e,r){return function(t,e,r){return o(t),t<=0?n(t):void 0!==e?"string"==typeof r?n(t).fill(e,r):n(t).fill(e):n(t)}(t,e,r)},i.allocUnsafe=function(t){return a(t)},i.allocUnsafeSlow=function(t){return a(t)},i.isBuffer=function(t){return null!=t&&!0===t._isBuffer},i.compare=function(t,e){if(!i.isBuffer(t)||!i.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,s=0,o=Math.min(r,n);s0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},i.prototype.compare=function(t,e,r,n,s){if(!i.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===s&&(s=this.length),e<0||r>t.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&e>=r)return 0;if(n>=s)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,s>>>=0,this===t)return 0;for(var o=s-n,a=r-e,u=Math.min(o,a),h=this.slice(n,s),f=t.slice(e,r),c=0;c>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var s=!1;;)switch(n){case"hex":return g(this,t,e,r);case"utf8":case"utf-8":return d(this,t,e,r);case"ascii":return v(this,t,e,r);case"latin1":case"binary":return b(this,t,e,r);case"base64":return m(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,t,e,r);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var D=4096;i.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||E(t,e,this.length);for(var n=this[t],i=1,s=0;++s>>=0,e>>>=0,r||E(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},i.prototype.readUInt8=function(t,e){return t>>>=0,e||E(t,1,this.length),this[t]},i.prototype.readUInt16LE=function(t,e){return t>>>=0,e||E(t,2,this.length),this[t]|this[t+1]<<8},i.prototype.readUInt16BE=function(t,e){return t>>>=0,e||E(t,2,this.length),this[t]<<8|this[t+1]},i.prototype.readUInt32LE=function(t,e){return t>>>=0,e||E(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},i.prototype.readUInt32BE=function(t,e){return t>>>=0,e||E(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},i.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||E(t,e,this.length);for(var n=this[t],i=1,s=0;++s=i&&(n-=Math.pow(2,8*e)),n},i.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||E(t,e,this.length);for(var n=e,i=1,s=this[t+--n];n>0&&(i*=256);)s+=this[t+--n]*i;return i*=128,s>=i&&(s-=Math.pow(2,8*e)),s},i.prototype.readInt8=function(t,e){return t>>>=0,e||E(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},i.prototype.readInt16LE=function(t,e){t>>>=0,e||E(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt16BE=function(t,e){t>>>=0,e||E(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt32LE=function(t,e){return t>>>=0,e||E(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},i.prototype.readInt32BE=function(t,e){return t>>>=0,e||E(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},i.prototype.readFloatLE=function(t,e){return t>>>=0,e||E(t,4,this.length),P.read(this,t,!0,23,4)},i.prototype.readFloatBE=function(t,e){return t>>>=0,e||E(t,4,this.length),P.read(this,t,!1,23,4)},i.prototype.readDoubleLE=function(t,e){return t>>>=0,e||E(t,8,this.length),P.read(this,t,!0,52,8)},i.prototype.readDoubleBE=function(t,e){return t>>>=0,e||E(t,8,this.length),P.read(this,t,!1,52,8)},i.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){T(this,t,e,r,Math.pow(2,8*r)-1,0)}var i=1,s=0;for(this[e]=255&t;++s>>=0,r>>>=0,!n){T(this,t,e,r,Math.pow(2,8*r)-1,0)}var i=r-1,s=1;for(this[e+i]=255&t;--i>=0&&(s*=256);)this[e+i]=t/s&255;return e+r},i.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,1,255,0),this[e]=255&t,e+1},i.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},i.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},i.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);T(this,t,e,r,i-1,-i)}var s=0,o=1,a=0;for(this[e]=255&t;++s>0)-a&255;return e+r},i.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);T(this,t,e,r,i-1,-i)}var s=r-1,o=1,a=0;for(this[e+s]=255&t;--s>=0&&(o*=256);)t<0&&0===a&&0!==this[e+s+1]&&(a=1),this[e+s]=(t/o>>0)-a&255;return e+r},i.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},i.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},i.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},i.prototype.writeFloatLE=function(t,e,r){return I(this,t,e,!0,r)},i.prototype.writeFloatBE=function(t,e,r){return I(this,t,e,!1,r)},i.prototype.writeDoubleLE=function(t,e,r){return B(this,t,e,!0,r)},i.prototype.writeDoubleBE=function(t,e,r){return B(this,t,e,!1,r)},i.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--i)t[i+e]=this[i+r];else if(s<1e3)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var o;if("number"==typeof t)for(o=e;o>1,f=-7,c=r?i-1:0,l=r?-1:1,p=t[e+c];for(c+=l,s=p&(1<<-f)-1,p>>=-f,f+=a;f>0;s=256*s+t[e+c],c+=l,f-=8);for(o=s&(1<<-f)-1,s>>=-f,f+=n;f>0;o=256*o+t[e+c],c+=l,f-=8);if(0===s)s=1-h;else{if(s===u)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,n),s-=h}return(p?-1:1)*o*Math.pow(2,s-n)},r.write=function(t,e,r,n,i,s){var o,a,u,h=8*s-i-1,f=(1<>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:s-1,y=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=f):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),(e+=o+c>=1?l/u:l*Math.pow(2,1-c))*u>=2&&(o++,u/=2),o+c>=f?(a=0,o=f):o+c>=1?(a=(e*u-1)*Math.pow(2,i),o+=c):(a=e*Math.pow(2,c-1)*Math.pow(2,i),o=0));i>=8;t[r+p]=255&a,p+=y,a/=256,i-=8);for(o=o<0;t[r+p]=255&o,p+=y,o/=256,h-=8);t[r+p-y]|=128*g}},{}],4:[function(t,e,r){"use strict";var n={VERSION:"2.0.1",NOTES:[]};!function(){for(var t=[["C"],["C#","Db"],["D"],["D#","Eb"],["E"],["F"],["F#","Gb"],["G"],["G#","Ab"],["A"],["A#","Bb"],["B"]],e=0,r=function(r){t.forEach(function(t){t.forEach(function(t){return n.NOTES[e]=t+r}),e++})},i=-1;i<=9;i++)r(i)}(),r.Constants=n},{}],5:[function(t,e,r){"use strict";var n=t("./player"),i=t("./utils"),s=t("./constants");e.exports={Player:n.Player,Utils:i.Utils,Constants:s.Constants}},{"./constants":4,"./player":6,"./utils":8}],6:[function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=function(){function t(t,e){for(var r=0;r100)throw"Percent must be number between 1 and 100.";return this.skipToTick(Math.round(t/100*this.totalTicks)),this}},{key:"skipToSeconds",value:function(t){var e=this.getSongTime();if(t<0||t>e)throw t+" seconds not within song time of "+e;return this.skipToPercent(t/e*100),this}},{key:"isPlaying",value:function(){return this.setIntervalId>0||"object"===n(this.setIntervalId)}},{key:"dryRun",value:function(){for(this.resetTracks();!this.endOfFile();)this.playLoop(!0);return this.events=this.getEvents(),this.totalEvents=this.getTotalEvents(),this.totalTicks=this.getTotalTicks(),this.startTick=0,this.startTime=0,this.resetTracks(),this.triggerPlayerEvent("fileLoaded",this),this}},{key:"resetTracks",value:function(){return this.tracks.forEach(function(t){return t.reset()}),this}},{key:"getEvents",value:function(){return this.tracks.map(function(t){return t.events})}},{key:"getTotalTicks",value:function(){return Math.max.apply(null,this.tracks.map(function(t){return t.delta}))}},{key:"getTotalEvents",value:function(){return this.tracks.reduce(function(t,e){return{events:{length:t.events.length+e.events.length}}},{events:{length:0}}).events.length}},{key:"getSongTime",value:function(){return this.totalTicks/this.division/this.tempo*60}},{key:"getSongTimeRemaining",value:function(){return Math.round((this.totalTicks-this.tick)/this.division/this.tempo*60)}},{key:"getSongPercentRemaining",value:function(){return Math.round(this.getSongTimeRemaining()/this.getSongTime()*100)}},{key:"bytesProcessed",value:function(){return 14+8*this.tracks.length+this.tracks.reduce(function(t,e){return{pointer:t.pointer+e.pointer}},{pointer:0}).pointer}},{key:"eventsPlayed",value:function(){return this.tracks.reduce(function(t,e){return{eventIndex:t.eventIndex+e.eventIndex}},{eventIndex:0}).eventIndex}},{key:"endOfFile",value:function(){return this.isPlaying()?this.eventsPlayed()==this.totalEvents:this.bytesProcessed()==this.buffer.length}},{key:"getCurrentTick",value:function(){return Math.round(((new Date).getTime()-this.startTime)/1e3*(this.division*(this.tempo/60)))+this.startTick}},{key:"emitEvent",value:function(t){return this.triggerPlayerEvent("midiEvent",t),this}},{key:"on",value:function(t,e){return this.eventListeners.hasOwnProperty(t)||(this.eventListeners[t]=[]),this.eventListeners[t].push(e),this}},{key:"triggerPlayerEvent",value:function(t,e){return this.eventListeners.hasOwnProperty(t)&&this.eventListeners[t].forEach(function(t){return t(e||{})}),this}}]),e}();r.Player=a},{"./track":7,"./utils":8,fs:"fs"}],7:[function(t,e,r){"use strict";var n=function(){function t(t,e){for(var r=0;r=t)return this.eventIndex=e,this}},{key:"getCurrentByte",value:function(){return this.data[this.pointer]}},{key:"getDeltaByteCount",value:function(){for(var t=this.getCurrentByte(),e=1;t>=128;)t=this.data[this.pointer+e],e++;return e}},{key:"getDelta",value:function(){return s.readVarInt(this.data.subarray(this.pointer,this.pointer+this.getDeltaByteCount()))}},{key:"handleEvent",value:function(t,e){if(e=e||!1){var r=t-this.lastTick>=this.getDelta();if(this.pointer>>0).toString(2)}},{key:"readVarInt",value:function(t){var e=0;return t.forEach(function(t){128&t?(e+=127&t,e<<=7):e+=t}),e}},{key:"atob",value:function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}(function(e){return"function"==typeof atob?atob(e):new t(e,"base64").toString("binary")})}]),r}();r.Utils=n}).call(this,t("buffer").Buffer)},{buffer:2}]},{},[5])(5)});