This repository was archived by the owner on Apr 22, 2022. It is now read-only.
forked from Experience-Monks/web-audio-player
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbundle.js
More file actions
2 lines (2 loc) · 36.4 KB
/
bundle.js
File metadata and controls
2 lines (2 loc) · 36.4 KB
1
2
!function(){function e(t,n,r){function o(a,u){if(!n[a]){if(!t[a]){var s="function"==typeof require&&require;if(!u&&s)return s(a,!0);if(i)return i(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var f=n[a]={exports:{}};t[a][0].call(f.exports,function(e){var n=t[a][1][e];return o(n||e)},f,f.exports,e,t,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;a<r.length;a++)o(r[a]);return o}return e}()({1:[function(e,t,n){function r(){var e=s();c(function(t){o(e,!t)},e)}function o(e,t){function n(){var e=v.shape[0],t=v.shape[1];d.save(),d.scale(v.scale,v.scale),d.clearRect(0,0,e,t);var n=a.frequencies(),r=f(s,n,40,100);d.beginPath();var o=Math.min(e,t)/4*r;d.arc(e/2,t/2,o,0,2*Math.PI),d.fill(),d.restore()}var r=["demo/bluejean_short.mp3","demo/bluejean_short.ogg"],o=i(r,{context:e,buffer:!0,loop:!0}),a=u(o.node,o.context,{stereo:!1}),s=a.analyser;o.once("decoding",function(e){h.innerText="Decoding..."}),o.on("end",function(){console.log("Audio ended")}),o.on("error",function(e){console.error(e.message),h.innerText="Error loading audio."}),o.on("load",function(){h.style.display="none",console.log("Source:",o.element?"MediaElement":"Buffer"),console.log("Playing",Math.round(o.duration)+"s of audio..."),o.play(),v.on("tick",n),v.start()});var c=function(){o.playing?o.pause():o.play(),o.playing?m.style.display="none":(m.textContent="Paused",m.style.display="block")};window.addEventListener("click",c)}var i=e("../"),a=e("canvas-loop"),u=e("web-audio-analyser"),s=e("ios-safe-audio-context"),c=e("detect-media-element-source"),f=e("analyser-frequency-average"),l=e("tap-event"),p=document.querySelector("canvas"),d=p.getContext("2d"),h=document.querySelector(".loading"),m=document.querySelector(".play"),v=a(p,{scale:window.devicePixelRatio});m.style.display="block",h.style.display="none";var y,w;w=function(e){window.removeEventListener("touchstart",y),window.removeEventListener("mousedown",w),e.preventDefault(),h.style.display="block",m.style.display="none",r()},y=l(w),window.addEventListener("touchstart",y),window.addEventListener("mousedown",w)},{"../":2,"analyser-frequency-average":12,"canvas-loop":19,"detect-media-element-source":21,"ios-safe-audio-context":27,"tap-event":38,"web-audio-analyser":40}],2:[function(e,t,n){function r(e,t){if(!e)throw new TypeError("must specify a src parameter");return t=t||{},t.buffer?o(e,t):t.partialbuffer?i(e,t):a(e,t)}var o=e("./lib/buffer-source"),i=e("./lib/partial-buffer-source"),a=e("./lib/media-source");t.exports=r},{"./lib/buffer-source":4,"./lib/media-source":7,"./lib/partial-buffer-source":8}],3:[function(e,t,n){function r(){return new(window.AudioContext||window.webkitAudioContext)}t.exports=r},{}],4:[function(e,t,n){(function(n){function r(e,t){function r(){v.emit("end"),E=!1,p(),x=0,v.emit("timeupdate",x)}function f(){d&&d.disconnect()}function l(){var e=function(){_=window.requestAnimationFrame(e);var t=x+(s()-g)/1e3;m&&t>m&&(t%=m),v.emit("timeupdate",t)};e()}function p(){_&&window.cancelAnimationFrame(_)}t=t||{};var d,h,m,v=new u,y=t.context||i(),w=y.createGain(),g=null,b=null,x=0,E=!1,A=t.loop,T=0,_=null;v.play=function(){if(!E){E=!0,!1!==t.autoResume&&c(v.context),f(),d=y.createBufferSource(),d.connect(v.node),d.onended=r,h&&(d.buffer=h),A&&(d.loop=!0,"number"==typeof t.loopStart&&(d.loopStart=t.loopStart),"number"==typeof t.loopEnd&&(d.loopEnd=t.loopEnd)),m&&x>m&&(x%=m);var e=x;d.start(0,e),g=s(),l()}},v.pause=function(){E&&(E=!1,d.onended=null,d.stop(0),b=s(),x+=(b-g)/1e3,v.emit("timeupdate",x),p())},v.stop=function(){v.pause(),r()},v.dispose=function(){f(),h=null},v.node=w,v.context=y,Object.defineProperties(v,{duration:{enumerable:!0,configurable:!0,get:function(){return m}},readyState:{enumerable:!0,configurable:!0,get:function(){return T}},currentTime:{enumerable:!0,configurable:!0,get:function(){return x},set:function(e){x=e}},playing:{enumerable:!0,configurable:!0,get:function(){return E}},buffer:{enumerable:!0,configurable:!0,get:function(){return h}},volume:{enumerable:!0,configurable:!0,get:function(){return w.gain.value},set:function(e){w.gain.value=e}}}),"number"==typeof t.volume&&(v.volume=t.volume);var L=Array.isArray(e)?e:[e];if(L=L.filter(Boolean),L.some(o)){var O=L.filter(o)[0];"function"==typeof O.getAttribute?O=O.getAttribute("src"):"string"==typeof O.src&&(O=O.src),function(e){a(y,e,function(e,t){if(e)return v.emit("error",e);h=t,d&&(d.buffer=h),T=4,m=h.duration,w.buffer=h,v.emit("load")},function(e,t){v.emit("progress",e,t)},function(e){if(v.emit("decoding"),t.preDecode&&"function"==typeof t.preDecode)return t.preDecode(e)})}(O)}else n.nextTick(function(){v.emit("error",o.createError(L))});return v}var o=e("./can-play-src"),i=e("./audio-context"),a=e("./xhr-audio"),u=e("events").EventEmitter,s=e("right-now"),c=e("./resume-context");t.exports=r}).call(this,e("_process"))},{"./audio-context":3,"./can-play-src":5,"./resume-context":10,"./xhr-audio":11,_process:17,events:23,"right-now":36}],5:[function(e,t,n){function r(e){if(!e)throw new TypeError("src cannot be empty");var t;if("function"==typeof e.getAttribute)t=e.getAttribute("type");else if("string"==typeof e){var n=i(e);n&&(t=u(n))}else t=e.type;if(!t)return!0;a||(a=new window.Audio);var r=a.canPlayType(t).replace(/no/,"");return Boolean(r)}function o(e){var t=new Error("This browser does not support any of the following sources:\n "+e.join(", ")+"\nTry using an array of OGG, MP3 and WAV.");return t.type="AUDIO_FORMAT",t}function i(e){var t=e.lastIndexOf(".");if(!(t<=0||t===e.length-1))return e.substring(t+1)}var a,u=e("browser-media-mime-type");t.exports=r,t.exports.createError=o},{"browser-media-mime-type":15}],6:[function(e,t,n){function r(e,t,n){function r(o){e.removeEventListener(t,r,!1),n(o,e)}e.addEventListener(t,r,!1)}t.exports=r},{}],7:[function(e,t,n){(function(n){function r(e,t){t=a({},t);var r=new o;t.element||(t.element=new window.Audio);var l=t.volume;delete t.volume;var p=i(e,t),d=t.context||s(),h=d.createGain();d.createMediaElementSource(p).connect(h),p.addEventListener("ended",function(){r.emit("end")});var m=t.loopStart,v=t.loopEnd,y="number"==typeof m&&isFinite(m),w="number"==typeof v&&isFinite(v),g=!1;(y||w)&&window.requestAnimationFrame(function e(){if("number"==typeof p.duration){var t=p.currentTime,n=w?Math.min(p.duration,v):p.duration;t>(m||0)&&(g=!0),y&&g&&t<m&&(p.currentTime=m),t>=n&&w&&(p.currentTime=y?m:0),window.requestAnimationFrame(e)}}),r.element=p,r.context=d,r.node=h,r.pause=p.pause.bind(p),r.play=function(){return!1!==t.autoResume&&u(r.context),p.play()},r.dispose=function(){},r.stop=function(){var e=r.playing;p.pause(),p.currentTime=0,g=!1,e&&r.emit("end")},Object.defineProperties(r,{duration:{enumerable:!0,configurable:!0,get:function(){return p.duration}},currentTime:{enumerable:!0,configurable:!0,get:function(){return p.currentTime}},playing:{enumerable:!0,configurable:!0,get:function(){return!p.paused}},volume:{enumerable:!0,configurable:!0,get:function(){return h.gain.value},set:function(e){h.gain.value=e}}}),"number"==typeof l&&(r.volume=l);var b=Array.isArray(e)?e:[e];return b=b.filter(Boolean),b.some(c)?function(){var e=Array.prototype.slice.call(p.children),t=e.length,o=!1,i=function(n,a){o||(t--,console.warn("Error loading source: "+a.getAttribute("src")),t<=0&&(o=!0,e.forEach(function(e){e.removeEventListener("error",i,!1)}),r.emit("error",new Error("Could not play any of the supplied sources"))))},a=function(){r.emit("load")};p.readyState>=p.HAVE_ENOUGH_DATA?n.nextTick(a):(f(p,"canplay",a),f(p,"error",function(e){r.emit(new Error("Unknown error while loading <audio>"))}),e.forEach(function(e){f(e,"error",i)})),p.load()}():n.nextTick(function(){r.emit("error",c.createError(b))}),r}var o=e("events").EventEmitter,i=e("simple-media-element").audio,a=e("object-assign"),u=e("./resume-context"),s=e("./audio-context"),c=e("./can-play-src"),f=e("./event-add-once");t.exports=r}).call(this,e("_process"))},{"./audio-context":3,"./can-play-src":5,"./event-add-once":6,"./resume-context":10,_process:17,events:23,"object-assign":30,"simple-media-element":37}],8:[function(e,t,n){(function(n){function r(e,t){function r(){v.emit("end"),E=!1,p(),x=0,v.emit("timeupdate",x)}function f(){d&&d.disconnect()}function l(){var e=function(){_=window.requestAnimationFrame(e);var t=x+(s()-g)/1e3;h&&t>h&&(t%=h),v.emit("timeupdate",t)};e()}function p(){_&&window.cancelAnimationFrame(_)}t=t||{};var d,h,m,v=new u,y=t.context||i(),w=y.createGain(),g=null,b=null,x=0,E=!1,A=t.loop,T=0,_=null,L=null,O=null,j=!1;v.play=function(){if(!E){E=!0,!1!==t.autoResume&&c(v.context),f(),d=y.createBufferSource(),d.connect(v.node),d.onended=r,m&&(d.buffer=m),A&&(d.loop=!0,"number"==typeof t.loopStart&&(d.loopStart=t.loopStart),"number"==typeof t.loopEnd&&(d.loopEnd=t.loopEnd)),h&&x>h&&(x%=h);var e=x;d.start(0,e),g=s(),l(),O&&!j&&(O.start(!0),j=!0)}},v.pause=function(){E&&(E=!1,d.onended=null,d.stop(0),b=s(),x+=(b-g)/1e3,v.emit("timeupdate",x),p())},v.stop=function(){v.pause(),r()},v.dispose=function(){f(),m=null},v.node=w,v.context=y,Object.defineProperties(v,{duration:{enumerable:!0,configurable:!0,get:function(){return h}},readyState:{enumerable:!0,configurable:!0,get:function(){return T}},currentTime:{enumerable:!0,configurable:!0,get:function(){return x},set:function(e){x=e}},playing:{enumerable:!0,configurable:!0,get:function(){return E}},buffer:{enumerable:!0,configurable:!0,get:function(){return m}},volume:{enumerable:!0,configurable:!0,get:function(){return w.gain.value},set:function(e){w.gain.value=e}}}),"number"==typeof t.volume&&(v.volume=t.volume);var C=Array.isArray(e)?e:[e];return C=C.filter(Boolean),C.some(o)?(L=C.filter(o)[0],"function"==typeof L.getAttribute?L=L.getAttribute("src"):"string"==typeof L.src&&(L=L.src),function(e){O=new a(y,e,function(e,t,n,r){if(e)return v.emit("error",e);h||n===r?n===r&&(h=t.duration):h=t.duration*r/n,m=t,T=4,v.emit("loadedDuration",t.duration),v.emit("load")},function(e,t){v.emit("progress",e,t)},function(e){if(v.emit("decoding"),t.preDecode&&"function"==typeof t.preDecode)return t.preDecode(e)}),O.start()}(L)):n.nextTick(function(){v.emit("error",o.createError(C))}),v}var o=e("./can-play-src"),i=e("./audio-context"),a=e("./partial-xhr-audio"),u=e("events").EventEmitter,s=e("right-now"),c=e("./resume-context");t.exports=r}).call(this,e("_process"))},{"./audio-context":3,"./can-play-src":5,"./partial-xhr-audio":9,"./resume-context":10,_process:17,events:23,"right-now":36}],9:[function(e,t,n){function r(e,t){var n=new Uint8Array(e.byteLength+t.byteLength);return n.set(new Uint8Array(e),0),n.set(new Uint8Array(t),e.byteLength),n.buffer}function o(e,t,n,o,u){function s(e){var u=c();if(u){var s={uri:t,responseType:"arraybuffer"};s.headers={Range:u};var h=i(s,function(o,i,a){return/^2/.test(i.statusCode)||(o=new Error("status code "+i.statusCode+" requesting "+t)),o?n(o):i.headers["content-range"]?(d||(d=parseInt(i.headers["content-range"].split("/")[1],10)),p+=a.byteLength,l=r(l,a),void f(e)):n(new Error("`content-range` not found in response headers"))});a(h).on("data",function(e,t){o(e,t)})}}function c(){var e=p+h;return 0===p&&0===d||e<d?"bytes="+p+"-"+e:p>=d?null:"bytes="+p+"-"}function f(t){var r=u(l),o=r||l;e.decodeAudioData(o,function(e){n(null,e,p,d),!0===t&&setTimeout(function(){s(t)},1e3)},function(){var e=new Error("Error decoding audio data");e.type="DECODE_AUDIO_DATA",n(e)})}var l=new Uint8Array(0),p=0,d=0,h=5e6;return{setDownloadLength:function(e){return h=e,this},start:s}}var i=e("xhr"),a=e("xhr-progress");t.exports=o},{xhr:43,"xhr-progress":42}],10:[function(e,t,n){t.exports=function(e){"suspended"===e.state&&"function"==typeof e.resume&&e.resume()}},{}],11:[function(e,t,n){function r(e,t,n,r,a){function u(t){var r=a(t);e.decodeAudioData(r||t,function(e){n(null,e)},function(){var e=new Error("Error decoding audio data");e.type="DECODE_AUDIO_DATA",n(e)})}var s=o({uri:t,responseType:"arraybuffer"},function(e,r,o){if(/^2/.test(r.statusCode)||(e=new Error("status code "+r.statusCode+" requesting "+t)),e)return n(e);u(o)});i(s).on("data",function(e,t){r(e,t)})}var o=e("xhr"),i=e("xhr-progress");t.exports=r},{xhr:43,"xhr-progress":42}],12:[function(e,t,n){function r(e,t,n,r,i){for(var a=t.context.sampleRate,u=t.frequencyBinCount,s=o(r,a,u),c=o(i,a,u),f=c-s,l=0;s<c;s++)l+=n[s]/e;return 0===f?0:l/f}var o=e("audio-frequency-to-index");t.exports=r.bind(null,255),t.exports.floatData=r.bind(null,1)},{"audio-frequency-to-index":13}],13:[function(e,t,n){function r(e,t,n){var r=t/2,i=Math.round(e/r*n);return o(i,0,n)}var o=e("clamp");t.exports=r},{clamp:20}],14:[function(e,t,n){function r(e,t){t=t||{};var n,r=e.numberOfChannels,a=e.sampleRate,u=t.float32?3:1,s=3===u?32:16;return n=2===r?i(e.getChannelData(0),e.getChannelData(1)):e.getChannelData(0),o(n,u,a,r,s)}function o(e,t,n,r,o){var i=o/8,c=r*i,f=new ArrayBuffer(44+e.length*i),l=new DataView(f);return s(l,0,"RIFF"),l.setUint32(4,36+e.length*i,!0),s(l,8,"WAVE"),s(l,12,"fmt "),l.setUint32(16,16,!0),l.setUint16(20,t,!0),l.setUint16(22,r,!0),l.setUint32(24,n,!0),l.setUint32(28,n*c,!0),l.setUint16(32,c,!0),l.setUint16(34,o,!0),s(l,36,"data"),l.setUint32(40,e.length*i,!0),1===t?u(l,44,e):a(l,44,e),f}function i(e,t){for(var n=e.length+t.length,r=new Float32Array(n),o=0,i=0;o<n;)r[o++]=e[i],r[o++]=t[i],i++;return r}function a(e,t,n){for(var r=0;r<n.length;r++,t+=4)e.setFloat32(t,n[r],!0)}function u(e,t,n){for(var r=0;r<n.length;r++,t+=2){var o=Math.max(-1,Math.min(1,n[r]));e.setInt16(t,o<0?32768*o:32767*o,!0)}}function s(e,t,n){for(var r=0;r<n.length;r++)e.setUint8(t+r,n.charCodeAt(r))}t.exports=r},{}],15:[function(e,t,n){var r=e("./mime-types.json"),o={};Object.keys(r).forEach(function(e){r[e].forEach(function(t){o[t]=e})}),t.exports=function(e){if(!e)throw new TypeError("must specify extension string");return 0===e.indexOf(".")&&(e=e.substring(1)),o[e.toLowerCase()]}},{"./mime-types.json":16}],16:[function(e,t,n){t.exports={"audio/midi":["mid","midi","kar","rmi"],"audio/mp4":["mp4a","m4a"],"audio/mpeg":["mpga","mp2","mp2a","mp3","m2a","m3a"],"audio/ogg":["oga","ogg","spx"],"audio/webm":["weba"],"audio/x-matroska":["mka"],"audio/x-mpegurl":["m3u"],"audio/wav":["wav"],"video/3gpp":["3gp"],"video/3gpp2":["3g2"],"video/mp4":["mp4","mp4v","mpg4"],"video/mpeg":["mpeg","mpg","mpe","m1v","m2v"],"video/ogg":["ogv"],"video/quicktime":["qt","mov"],"video/webm":["webm"],"video/x-f4v":["f4v"],"video/x-fli":["fli"],"video/x-flv":["flv"],"video/x-m4v":["m4v"],"video/x-matroska":["mkv","mk3d","mks"]}},{}],17:[function(e,t,n){function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function i(e){if(l===setTimeout)return setTimeout(e,0);if((l===r||!l)&&setTimeout)return l=setTimeout,setTimeout(e,0);try{return l(e,0)}catch(t){try{return l.call(null,e,0)}catch(t){return l.call(this,e,0)}}}function a(e){if(p===clearTimeout)return clearTimeout(e);if((p===o||!p)&&clearTimeout)return p=clearTimeout,clearTimeout(e);try{return p(e)}catch(t){try{return p.call(null,e)}catch(t){return p.call(this,e)}}}function u(){v&&h&&(v=!1,h.length?m=h.concat(m):y=-1,m.length&&s())}function s(){if(!v){var e=i(u);v=!0;for(var t=m.length;t;){for(h=m,m=[];++y<t;)h&&h[y].run();y=-1,t=m.length}h=null,v=!1,a(e)}}function c(e,t){this.fun=e,this.array=t}function f(){}var l,p,d=t.exports={};!function(){try{l="function"==typeof setTimeout?setTimeout:r}catch(e){l=r}try{p="function"==typeof clearTimeout?clearTimeout:o}catch(e){p=o}}();var h,m=[],v=!1,y=-1;d.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];m.push(new c(e,t)),1!==m.length||v||i(s)},c.prototype.run=function(){this.fun.apply(null,this.array)},d.title="browser",d.browser=!0,d.env={},d.argv=[],d.version="",d.versions={},d.on=f,d.addListener=f,d.once=f,d.off=f,d.removeListener=f,d.removeAllListeners=f,d.emit=f,d.prependListener=f,d.prependOnceListener=f,d.listeners=function(e){return[]},d.binding=function(e){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(e){throw new Error("process.chdir is not supported")},d.umask=function(){return 0}},{}],18:[function(e,t,n){function r(e,t,n){function r(){var t=r.parent||e.parentNode;if("function"==typeof t)var n=t(i)||i,u=n[0],s=n[1];else if(t&&t!==document.body)var c=o(t),u=0|c[0],s=0|c[1];else var u=window.innerWidth,s=window.innerHeight;return a?(e.setAttribute("width",u*r.scale+"px"),e.setAttribute("height",s*r.scale+"px")):(e.width=u*r.scale,e.height=s*r.scale),e.style.width=u+"px",e.style.height=s+"px",r}var a="SVG"===e.nodeName.toUpperCase();return e.style.position=e.style.position||"absolute",e.style.top=0,e.style.left=0,r.scale=parseFloat(n||1),r.parent=t,r()}var o=e("element-size");t.exports=r;var i=new Float32Array(2)},{"element-size":22}],19:[function(e,t,n){var r=e("canvas-fit"),o=e("raf-loop");t.exports=function(e,t){function n(){i();var t=e.width,n=e.height;u[0]=t/i.scale,u[1]=n/i.scale}if(!e)throw new TypeError("must specify a canvas element");t=t||{};var i=r(e,t.parent,t.scale),a=o(),u=[0,0];return n(),window.addEventListener("resize",function(){n(),a.emit("resize")},!1),Object.defineProperties(a,{scale:{get:function(){return i.scale},set:function(e){i.scale=e}},shape:{get:function(){return u}},parent:{get:function(){return i.parent},set:function(e){i.parent=e}}}),a}},{"canvas-fit":18,"raf-loop":34}],20:[function(e,t,n){function r(e,t,n){return t<n?e<t?t:e>n?n:e:e<n?n:e>t?t:e}t.exports=r},{}],21:[function(e,t,n){(function(n){function r(e,t,r,a){function u(){var e=new window.Audio,n=t.createMediaElementSource(e),a=t.createAnalyser();n.connect(a);var u,l,p=o(function(t){clearInterval(u),clearTimeout(l),e.pause(),n.disconnect(),s(t)});e.addEventListener("canplaythrough",o(function(){e.play()})),e.addEventListener("play",o(function(){var e=new Uint8Array(a.frequencyBinCount);u=setInterval(function(){a.getByteFrequencyData(e),c(e)&&p(!0)},1)}));var d=f(1,44100),h=i(d);!function(){l&&clearTimeout(l),l=setTimeout(function(){p(!1)},r)}();try{var m=new window.Blob([h],{type:"audio/wav"}),v=window.URL.createObjectURL(m);e.loop=!0,e.src=v,e.load()}catch(e){p(!1)}}function s(n){p&&"function"==typeof t.close&&t.close(),e(n)}function c(e){for(var t=0;t<e.length;t++)if(e[t]>0)return!0;return!1}function f(e,t){var n=Math.floor(t*e);n+=4-n%4;for(var r=new Float32Array(n),o=0;o<n;o++)r[o]=1/255;return{duration:e,length:n,numberOfChannels:1,sampleRate:t,getChannelData:function(){return r}}}if("function"!=typeof e)throw new TypeError("must specify a callback function");var l=window.AudioContext||window.webkitAudioContext;if(!l||void 0===window.Blob||void 0===window.URL||"function"!=typeof window.URL.createObjectURL)return n.nextTick(function(){e(!1)});var p=!1;t||(p=!0,t=new l);var d=/Safari/.test(navigator.userAgent)?550:250;r="number"==typeof r?r:d,"suspended"===t.state&&"function"==typeof t.resume?(t.resume(),setTimeout(u,10)):u()}var o=e("once"),i=e("audiobuffer-to-wav");t.exports=r}).call(this,e("_process"))},{_process:17,"audiobuffer-to-wav":14,once:31}],22:[function(e,t,n){function r(e){if(e===window||e===document.body)return[window.innerWidth,window.innerHeight];if(!e.parentNode){var t=!0;document.body.appendChild(e)}var n=e.getBoundingClientRect(),r=getComputedStyle(e),i=(0|n.height)+o(r.getPropertyValue("margin-top"))+o(r.getPropertyValue("margin-bottom")),a=(0|n.width)+o(r.getPropertyValue("margin-left"))+o(r.getPropertyValue("margin-right"));return t&&document.body.removeChild(e),[a,i]}function o(e){return parseFloat(e)||0}t.exports=r},{}],23:[function(e,t,n){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function o(e){return"function"==typeof e}function i(e){return"number"==typeof e}function a(e){return"object"==typeof e&&null!==e}function u(e){return void 0===e}t.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(e){if(!i(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},r.prototype.emit=function(e){var t,n,r,i,s,c;if(this._events||(this._events={}),"error"===e&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var f=new Error('Uncaught, unspecified "error" event. ('+t+")");throw f.context=t,f}if(n=this._events[e],u(n))return!1;if(o(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:i=Array.prototype.slice.call(arguments,1),n.apply(this,i)}else if(a(n))for(i=Array.prototype.slice.call(arguments,1),c=n.slice(),r=c.length,s=0;s<r;s++)c[s].apply(this,i);return!0},r.prototype.addListener=function(e,t){var n;if(!o(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,o(t.listener)?t.listener:t),this._events[e]?a(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,a(this._events[e])&&!this._events[e].warned&&(n=u(this._maxListeners)?r.defaultMaxListeners:this._maxListeners)&&n>0&&this._events[e].length>n&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){function n(){this.removeListener(e,n),r||(r=!0,t.apply(this,arguments))}if(!o(t))throw TypeError("listener must be a function");var r=!1;return n.listener=t,this.on(e,n),this},r.prototype.removeListener=function(e,t){var n,r,i,u;if(!o(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],i=n.length,r=-1,n===t||o(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(a(n)){for(u=i;u-- >0;)if(n[u]===t||n[u].listener&&n[u].listener===t){r=u;break}if(r<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[e],o(n))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){return this._events&&this._events[e]?o(this._events[e])?[this._events[e]]:this._events[e].slice():[]},r.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(o(t))return 1;if(t)return t.length}return 0},r.listenerCount=function(e,t){return e.listenerCount(t)}},{}],24:[function(e,t,n){function r(e,t,n){if(!u(t))throw new TypeError("iterator must be a function");arguments.length<3&&(n=this),"[object Array]"===s.call(e)?o(e,t,n):"string"==typeof e?i(e,t,n):a(e,t,n)}function o(e,t,n){for(var r=0,o=e.length;r<o;r++)c.call(e,r)&&t.call(n,e[r],r,e)}function i(e,t,n){for(var r=0,o=e.length;r<o;r++)t.call(n,e.charAt(r),r,e)}function a(e,t,n){for(var r in e)c.call(e,r)&&t.call(n,e[r],r,e)}var u=e("is-function");t.exports=r;var s=Object.prototype.toString,c=Object.prototype.hasOwnProperty},{"is-function":29}],25:[function(e,t,n){(function(e){var n;n="undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{},t.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],26:[function(e,t,n){"function"==typeof Object.create?t.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},{}],27:[function(e,t,n){function r(e){var t=window.AudioContext||window.webkitAudioContext;e="number"==typeof e?e:44100;var n=new t;if(/(iPhone|iPad)/i.test(navigator.userAgent)&&n.sampleRate!==e){var r=n.createBuffer(1,1,e),o=n.createBufferSource();o.buffer=r,o.connect(n.destination),o.start(0),o.disconnect(),n.close(),n=new t}return n}t.exports=r},{}],28:[function(e,t,n){function r(e){return!(!e||"object"!=typeof e)&&("object"==typeof window&&"object"==typeof window.Node?e instanceof window.Node:"number"==typeof e.nodeType&&"string"==typeof e.nodeName)}t.exports=r},{}],29:[function(e,t,n){function r(e){var t=o.call(e);return"[object Function]"===t||"function"==typeof e&&"[object RegExp]"!==t||"undefined"!=typeof window&&(e===window.setTimeout||e===window.alert||e===window.confirm||e===window.prompt)}t.exports=r;var o=Object.prototype.toString},{}],30:[function(e,t,n){"use strict";function r(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}var o=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;t.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,u,s=r(e),c=1;c<arguments.length;c++){n=Object(arguments[c]);for(var f in n)i.call(n,f)&&(s[f]=n[f]);if(o){u=o(n);for(var l=0;l<u.length;l++)a.call(n,u[l])&&(s[u[l]]=n[u[l]])}}return s}},{}],31:[function(e,t,n){function r(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function o(e){var t=function(){if(t.called)throw new Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)},n=e.name||"Function wrapped with `once`";return t.onceError=n+" shouldn't be called more than once",t.called=!1,t}var i=e("wrappy");t.exports=i(r),t.exports.strict=i(o),r.proto=r(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return r(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return o(this)},configurable:!0})})},{wrappy:41}],32:[function(e,t,n){var r=e("trim"),o=e("for-each"),i=function(e){return"[object Array]"===Object.prototype.toString.call(e)};t.exports=function(e){if(!e)return{};var t={};return o(r(e).split("\n"),function(e){var n=e.indexOf(":"),o=r(e.slice(0,n)).toLowerCase(),a=r(e.slice(n+1));void 0===t[o]?t[o]=a:i(t[o])?t[o].push(a):t[o]=[t[o],a]}),t}},{"for-each":24,trim:39}],33:[function(e,t,n){(function(e){(function(){var n,r,o,i,a,u;"undefined"!=typeof performance&&null!==performance&&performance.now?t.exports=function(){return performance.now()}:void 0!==e&&null!==e&&e.hrtime?(t.exports=function(){return(n()-a)/1e6},r=e.hrtime,n=function(){var e;return e=r(),1e9*e[0]+e[1]},i=n(),u=1e9*e.uptime(),a=i-u):Date.now?(t.exports=function(){return Date.now()-o},o=Date.now()):(t.exports=function(){return(new Date).getTime()-o},o=(new Date).getTime())}).call(this)}).call(this,e("_process"))},{_process:17}],34:[function(e,t,n){function r(e){if(!(this instanceof r))return new r(e);this.running=!1,this.last=a(),this._frame=0,this._tick=this.tick.bind(this),e&&this.on("tick",e)}var o=e("inherits"),i=e("events").EventEmitter,a=e("right-now"),u=e("raf");t.exports=r,o(r,i),r.prototype.start=function(){if(!this.running)return this.running=!0,this.last=a(),this._frame=u(this._tick),this},r.prototype.stop=function(){return this.running=!1,0!==this._frame&&u.cancel(this._frame),this._frame=0,this},r.prototype.tick=function(){this._frame=u(this._tick);var e=a(),t=e-this.last;this.emit("tick",t),this.last=e}},{events:23,inherits:26,raf:35,"right-now":36}],35:[function(e,t,n){(function(n){for(var r=e("performance-now"),o="undefined"==typeof window?n:window,i=["moz","webkit"],a="AnimationFrame",u=o["request"+a],s=o["cancel"+a]||o["cancelRequest"+a],c=0;!u&&c<i.length;c++)u=o[i[c]+"Request"+a],s=o[i[c]+"Cancel"+a]||o[i[c]+"CancelRequest"+a];if(!u||!s){var f=0,l=0,p=[];u=function(e){if(0===p.length){var t=r(),n=Math.max(0,1e3/60-(t-f));f=n+t,setTimeout(function(){var e=p.slice(0);p.length=0;for(var t=0;t<e.length;t++)if(!e[t].cancelled)try{e[t].callback(f)}catch(e){setTimeout(function(){throw e},0)}},Math.round(n))}return p.push({handle:++l,callback:e,cancelled:!1}),l},s=function(e){for(var t=0;t<p.length;t++)p[t].handle===e&&(p[t].cancelled=!0)}}t.exports=function(e){return u.call(o,e)},t.exports.cancel=function(){s.apply(o,arguments)},t.exports.polyfill=function(e){e||(e=o),e.requestAnimationFrame=u,e.cancelAnimationFrame=s}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"performance-now":33}],36:[function(e,t,n){(function(e){t.exports=e.performance&&e.performance.now?function(){return performance.now()}:Date.now||function(){return+new Date}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],37:[function(e,t,n){function r(e,t,n){n=n||{},Array.isArray(t)||(t=[t]);var r=n.element||document.createElement(e);return n.loop&&r.setAttribute("loop","loop"),n.muted&&r.setAttribute("muted","muted"),n.autoplay&&r.setAttribute("autoplay","autoplay"),n.controls&&r.setAttribute("controls","controls"),n.crossOrigin&&r.setAttribute("crossorigin",n.crossOrigin),n.preload&&r.setAttribute("preload",n.preload),n.poster&&r.setAttribute("poster",n.poster),void 0!==n.volume&&r.setAttribute("volume",n.volume),t=t.filter(Boolean),t.forEach(function(e){r.appendChild(o(e))}),r}function o(e){if(a(e))return e;if("string"==typeof e&&(e={src:e},e.src)){var t=i(e.src);t&&(e.type=u(t))}var n=document.createElement("source");return e.src&&n.setAttribute("src",e.src),e.type&&n.setAttribute("type",e.type),n}function i(e){var t=e.lastIndexOf(".");return t<=0||t===e.length-1?null:e.substring(t+1)}var a=e("is-dom"),u=e("browser-media-mime-type");t.exports.video=r.bind(null,"video"),t.exports.audio=r.bind(null,"audio")},{"browser-media-mime-type":15,"is-dom":28}],38:[function(e,t,n){function r(e,t){function n(t){function n(n){if(t!==n&&(r(),!n.defaultPrevented)){var o=t.preventDefault,i=t.stopPropagation;n.stopPropagation=function(){i.call(t),i.call(n)},n.preventDefault=function(){o.call(t),o.call(n)},e.call(u,n)}}function r(e){t!==e&&(clearTimeout(s),o.forEach(function(e){document.removeEventListener(e,r)}),i.forEach(function(e){document.removeEventListener(e,n)}))}if(t.touches&&!(t.touches.length>1)){var u=this,s=setTimeout(r,a);o.forEach(function(e){document.addEventListener(e,r)}),i.forEach(function(e){document.addEventListener(e,n)})}}t=t||{};var a=t.timeout||r.timeout;return n.handler=e,n}var o=["touchmove","touchcancel","touchstart"],i=["touchend"];t.exports=r,r.timeout=200},{}],39:[function(e,t,n){function r(e){return e.replace(/^\s*|\s*$/g,"")}n=t.exports=r,n.left=function(e){return e.replace(/^\s*/,"")},n.right=function(e){return e.replace(/\s*$/,"")}},{}],40:[function(e,t,n){function r(e,t,n){if(!(this instanceof r))return new r(e,t,n);if(t instanceof o||(n=t,t=null),n=n||{},this.ctx=t=t||new o,e instanceof AudioNode||(e=e instanceof Audio||e instanceof HTMLAudioElement?t.createMediaElementSource(e):t.createMediaStreamSource(e)),this.analyser=t.createAnalyser(),this.stereo=!!n.stereo,
this.audible=!1!==n.audible,this.wavedata=null,this.freqdata=null,this.splitter=null,this.merger=null,this.source=e,this.stereo){this.analyser=[this.analyser],this.analyser.push(t.createAnalyser()),this.splitter=t.createChannelSplitter(2),this.merger=t.createChannelMerger(2),this.output=this.merger,this.source.connect(this.splitter);for(var i=0;i<2;i++)this.splitter.connect(this.analyser[i],i,0),this.analyser[i].connect(this.merger,0,i);this.audible&&this.merger.connect(t.destination)}else this.output=this.source,this.source.connect(this.analyser),this.audible&&this.analyser.connect(t.destination)}var o=window.AudioContext||window.webkitAudioContext;t.exports=r,r.prototype.waveform=function(e,t){return e||(e=this.wavedata||(this.wavedata=new Uint8Array((this.analyser[0]||this.analyser).frequencyBinCount))),(this.stereo?this.analyser[t||0]:this.analyser).getByteTimeDomainData(e),e},r.prototype.frequencies=function(e,t){return e||(e=this.freqdata||(this.freqdata=new Uint8Array((this.analyser[0]||this.analyser).frequencyBinCount))),(this.stereo?this.analyser[t||0]:this.analyser).getByteFrequencyData(e),e}},{}],41:[function(e,t,n){function r(e,t){function n(){for(var t=new Array(arguments.length),n=0;n<t.length;n++)t[n]=arguments[n];var r=e.apply(this,t),o=t[t.length-1];return"function"==typeof r&&r!==o&&Object.keys(o).forEach(function(e){r[e]=o[e]}),r}if(e&&t)return r(e)(t);if("function"!=typeof e)throw new TypeError("need wrapper function");return Object.keys(e).forEach(function(t){n[t]=e[t]}),n}t.exports=r},{}],42:[function(e,t,n){function r(e){function t(e){var t=e.lengthComputable?e.loaded/e.total:0;i||r.emit("data",t,e.total||null),i=1===t}function n(o){("load"===o.type||/^(ready|complete)$/g.test((o.currentTarget||o.srcElement).readyState))&&(i||(e.removeEventListener?(e.removeEventListener("load",n,!1),e.removeEventListener("progress",t,!1)):e.detatchEvent&&e.detatchEvent("onreadystatechange",n),r.emit("data",1,o.total||null),r.emit("done"),i=!0))}var r=new o,i=!1;return e.attachEvent?(e.attachEvent("onreadystatechange",n),r):(e.addEventListener("load",n,!1),e.addEventListener("progress",t,!1),r)}var o=e("events").EventEmitter;t.exports=r},{events:23}],43:[function(e,t,n){"use strict";function r(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}function o(e,t,n){var r=e;return f(t)?(n=t,"string"==typeof e&&(r={uri:e})):r=p(t,{uri:e}),r.callback=n,r}function i(e,t,n){return t=o(e,t,n),a(t)}function a(e){function t(){4===f.readyState&&setTimeout(a,0)}function n(){var e=void 0;if(e=f.response?f.response:f.responseText||u(f),b)try{e=JSON.parse(e)}catch(e){}return e}function o(e){return clearTimeout(h),e instanceof Error||(e=new Error(""+(e||"Unknown XMLHttpRequest Error"))),e.statusCode=0,c(e,x)}function a(){if(!d){var t;clearTimeout(h),t=e.useXDR&&void 0===f.status?200:1223===f.status?204:f.status;var r=x,o=null;return 0!==t?(r={body:n(),statusCode:t,method:v,headers:{},url:m,rawRequest:f},f.getAllResponseHeaders&&(r.headers=l(f.getAllResponseHeaders()))):o=new Error("Internal XMLHttpRequest Error"),c(o,r,r.body)}}if(void 0===e.callback)throw new Error("callback argument missing");var s=!1,c=function(t,n,r){s||(s=!0,e.callback(t,n,r))},f=e.xhr||null;f||(f=e.cors||e.useXDR?new i.XDomainRequest:new i.XMLHttpRequest);var p,d,h,m=f.url=e.uri||e.url,v=f.method=e.method||"GET",y=e.body||e.data,w=f.headers=e.headers||{},g=!!e.sync,b=!1,x={body:void 0,headers:{},statusCode:0,method:v,url:m,rawRequest:f};if("json"in e&&!1!==e.json&&(b=!0,w.accept||w.Accept||(w.Accept="application/json"),"GET"!==v&&"HEAD"!==v&&(w["content-type"]||w["Content-Type"]||(w["Content-Type"]="application/json"),y=JSON.stringify(!0===e.json?y:e.json))),f.onreadystatechange=t,f.onload=a,f.onerror=o,f.onprogress=function(){},f.onabort=function(){d=!0},f.ontimeout=o,f.open(v,m,!g,e.username,e.password),g||(f.withCredentials=!!e.withCredentials),!g&&e.timeout>0&&(h=setTimeout(function(){if(!d){d=!0,f.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",o(e)}},e.timeout)),f.setRequestHeader)for(p in w)w.hasOwnProperty(p)&&f.setRequestHeader(p,w[p]);else if(e.headers&&!r(e.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in e&&(f.responseType=e.responseType),"beforeSend"in e&&"function"==typeof e.beforeSend&&e.beforeSend(f),f.send(y||null),f}function u(e){try{if("document"===e.responseType)return e.responseXML;var t=e.responseXML&&"parsererror"===e.responseXML.documentElement.nodeName;if(""===e.responseType&&!t)return e.responseXML}catch(e){}return null}function s(){}var c=e("global/window"),f=e("is-function"),l=e("parse-headers"),p=e("xtend");t.exports=i,i.XMLHttpRequest=c.XMLHttpRequest||s,i.XDomainRequest="withCredentials"in new i.XMLHttpRequest?i.XMLHttpRequest:c.XDomainRequest,function(e,t){for(var n=0;n<e.length;n++)t(e[n])}(["get","put","post","patch","head","delete"],function(e){i["delete"===e?"del":e]=function(t,n,r){return n=o(t,n,r),n.method=e.toUpperCase(),a(n)}})},{"global/window":25,"is-function":29,"parse-headers":32,xtend:44}],44:[function(e,t,n){function r(){for(var e={},t=0;t<arguments.length;t++){var n=arguments[t];for(var r in n)o.call(n,r)&&(e[r]=n[r])}return e}t.exports=r;var o=Object.prototype.hasOwnProperty},{}]},{},[1]);