vast-player
Version:
Playback VAST creatives in a web browser.
2 lines • 66 kB
JavaScript
!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.VASTPlayer=a()}}(function(){var a;return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){b.exports=a("./lib/VASTPlayer")},{"./lib/VASTPlayer":5}],2:[function(a,b,c){"use strict";function d(a,b,c){b.on(a,function(){for(var b=[],d=arguments.length;d--;)b[d]=arguments[d];c.emit.apply(c,[a].concat(b))})}function e(a,b,c){c.forEach(function(c){b.listeners(c).length>0&&d(c,a,b)}),b.on("newListener",function(e){c.indexOf(e)>-1&&b.listeners(e).length<1&&d(e,a,b)})}function f(a){this.events=a.slice(),this.__private__={target:null,source:null}}f.prototype.from=function(a){return this.__private__.source=a,this.__private__.target&&e(a,this.__private__.target,this.events),this},f.prototype.to=function(a){return this.__private__.target=a,this.__private__.source&&e(this.__private__.source,a,this.events),this},b.exports=f},{}],3:[function(a,b,c){"use strict";function d(a){var b=this;e.call(this,Math.floor(a.duration||0)),this.video=a,[g.PLAYING,g.PAUSE,g.TIMEUPDATE].forEach(function(c){return a.addEventListener(c,function(){return b.tick()},!1)})}var e=a("./VideoTracker"),f=a("util").inherits,g=a("./enums/HTML_MEDIA_EVENTS");f(d,e),d.prototype._getState=function(){return{playing:!this.video.paused,currentTime:this.video.currentTime}},b.exports=d},{"./VideoTracker":7,"./enums/HTML_MEDIA_EVENTS":8,util:35}],4:[function(a,b,c){"use strict";function d(a){return a}function e(a,b){(a||[]).forEach(function(a){(new Image).src=b(a)})}function f(a,b){this.pixels=a.reduce(function(a,b){return(a[b.event]||(a[b.event]=[])).push(b.uri),a},{}),this.__private__={mapper:b||d}}var g=a("./enums/VPAID_EVENTS");f.prototype.track=function(a){function b(a,b,g){function h(a){return f((b||d)(a))}return function(){g&&!g()||e(c[a],h)}}var c=this.pixels,f=this.__private__.mapper,h=a.adVolume;a.on(g.AdSkipped,b("skip")),a.on(g.AdStarted,b("creativeView")),a.on(g.AdVolumeChange,b("unmute",null,function(){return 0===h&&a.adVolume>0})),a.on(g.AdVolumeChange,b("mute",null,function(){return h>0&&0===a.adVolume})),a.on(g.AdImpression,b("impression")),a.on(g.AdVideoStart,b("start")),a.on(g.AdVideoFirstQuartile,b("firstQuartile")),a.on(g.AdVideoMidpoint,b("midpoint")),a.on(g.AdVideoThirdQuartile,b("thirdQuartile")),a.on(g.AdVideoComplete,b("complete")),a.on(g.AdClickThru,b("clickThrough")),a.on(g.AdUserAcceptInvitation,b("acceptInvitationLinear")),a.on(g.AdUserMinimize,b("collapse")),a.on(g.AdUserClose,b("closeLinear")),a.on(g.AdPaused,b("pause")),a.on(g.AdPlaying,b("resume")),a.on(g.AdError,b("error",function(a){return a.replace(/\[ERRORCODE\]/g,901)})),a.on(g.AdVolumeChange,function(){h=a.adVolume})},b.exports=f},{"./enums/VPAID_EVENTS":10}],5:[function(a,b,c){"use strict";function d(){var a,b,c,e,f={},g=arguments.length;for(a=0;a<g;a++){b=arguments[a]||{};for(c in b)e=b[c],void 0===f[c]&&(f[c]=e),"object"==typeof e&&(f[c]=d(f[c],e))}return f}function e(a){return a}function f(){return new Error("VASTPlayer not ready.")}function g(a){return function(){var b=this,c=this.__private__.player;return this.ready?c[a].apply(c,arguments).then(function(){return b}):s.reject(f())}}function h(a){return{get:function(){if(!this.ready)throw f();return this.__private__.player[a]},set:function(b){if(!this.ready)throw f();return this.__private__.player[a]=b}}}function i(a,b){var c=this;j.call(this),this.__private__={container:a,config:d(b,{vast:{resolveWrappers:!0,maxRedirects:5},tracking:{mapper:e}}),vast:null,ready:!1,player:null},this.on(q.AdClickThru,function(a,b,d){var e=a||c.vast.get("ads[0].creatives[0].videoClicks.clickThrough");d&&e&&window.open(e)})}var j=a("events").EventEmitter,k=a("util").inherits,l=a("vastacular").VAST,m=a("./players/JavaScriptVPAID"),n=a("./players/FlashVPAID"),o=a("./players/HTMLVideo"),p=a("./enums/MIME"),q=a("./enums/VPAID_EVENTS"),r=a("./EventProxy"),s=a("lie"),t=a("./PixelReporter");k(i,j),Object.defineProperties(i.prototype,{container:{get:function(){return this.__private__.container}},config:{get:function(){return this.__private__.config}},vast:{get:function(){return this.__private__.vast}},ready:{get:function(){return this.__private__.ready}},adRemainingTime:h("adRemainingTime"),adDuration:h("adDuration"),adVolume:h("adVolume")}),i.prototype.load=function(a){var b=this,c=this.config.vast;return l.fetch(a,c).then(function(a){var c=function(){var c=a.filter("ads[0].creatives[0].mediaFiles",function(a){return(a.type===p.JAVASCRIPT||"application/x-javascript"===a.type)&&"VPAID"===a.apiFramework}),d=a.filter("ads[0].creatives[0].mediaFiles",function(a){return a.type===p.FLASH&&"VPAID"===a.apiFramework}),e=a.filter("ads[0].creatives[0].mediaFiles",function(){return!0});return c.length>0?{player:new m(b.container),mediaFiles:c}:d.length>0?{player:new n(b.container,i.vpaidSWFLocation),mediaFiles:d}:{player:new o(b.container),mediaFiles:e}}(),d=a.get("ads[0].creatives[0].parameters"),e=[].concat(a.map("ads[0].impressions",function(a){return{event:"impression",uri:a.uri}}),a.map("ads[0].errors",function(a){return{event:"error",uri:a}}),a.get("ads[0].creatives[0].trackingEvents"),a.map("ads[0].creatives[0].videoClicks.clickTrackings",function(a){return{event:"clickThrough",uri:a}})),f=c.player,g=c.mediaFiles,h=new r(q),j=new t(e,b.config.tracking.mapper);return h.from(f).to(b),b.__private__.vast=a,b.__private__.player=f,f.load(g,d).then(function(){j.track(f)})}).then(function(){return b.__private__.ready=!0,b.emit("ready"),b}).catch(function(a){throw b.emit("error",a),a})},i.prototype.startAd=g("startAd"),i.prototype.stopAd=g("stopAd"),i.prototype.pauseAd=g("pauseAd"),i.prototype.resumeAd=g("resumeAd"),i.vpaidSWFLocation="https://cdn.jsdelivr.net/npm/vast-player@0.2.10/dist/vast-player--vpaid.swf",b.exports=i},{"./EventProxy":2,"./PixelReporter":4,"./enums/MIME":9,"./enums/VPAID_EVENTS":10,"./players/FlashVPAID":12,"./players/HTMLVideo":13,"./players/JavaScriptVPAID":14,events:19,lie:21,util:35,vastacular:36}],6:[function(a,b,c){"use strict";function d(a){var b=a.split(".").map(parseFloat);this.string=a,this.major=b[0],this.minor=b[1],this.patch=b[2],Object.freeze(this)}d.prototype.toString=function(){return this.string},b.exports=d},{}],7:[function(a,b,c){"use strict";function d(a,b){b.fired[a]||(b.emit(a),b.fired[a]=!0)}function e(a){f.apply(this,arguments),this.duration=a,this.seconds=Array.apply([],new Array(a)).map(function(){return!1}),this.fired=[h.AdVideoStart,h.AdVideoFirstQuartile,h.AdVideoMidpoint,h.AdVideoThirdQuartile,h.AdVideoComplete].reduce(function(a,b){return a[b]=!1,a},{})}var f=a("events").EventEmitter,g=a("util").inherits,h=a("./enums/VPAID_EVENTS");g(e,f),e.prototype.tick=function(){function a(a){var c=f[a-1];return b.slice(0,c).every(function(a){return a===!0})}var b=this.seconds,c=this._getState(),e=Math.round(c.currentTime)-1,f=[1,2,3,4].map(function(a){return Math.floor(this.duration/4*a)},this);c.playing&&(d(h.AdVideoStart,this),e>-1&&(this.seconds[e]=!0)),a(1)&&d(h.AdVideoFirstQuartile,this),a(2)&&d(h.AdVideoMidpoint,this),a(3)&&d(h.AdVideoThirdQuartile,this),a(4)&&d(h.AdVideoComplete,this)},b.exports=e},{"./enums/VPAID_EVENTS":10,events:19,util:35}],8:[function(a,b,c){"use strict";var d=["abort","canplay","canplaythrough","durationchange","emptied","encrypted","ended","error","interruptbegin","interruptend","loadeddata","loadedmetadata","loadstart","mozaudioavailable","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting"];d.forEach(function(a){this[a.toUpperCase()]=a},d),Object.freeze(d),b.exports=d},{}],9:[function(a,b,c){var d={JAVASCRIPT:"application/javascript",FLASH:"application/x-shockwave-flash"};Object.freeze(d),b.exports=d},{}],10:[function(a,b,c){"use strict";var d=["AdLoaded","AdStarted","AdStopped","AdSkipped","AdSkippableStateChange","AdSizeChange","AdLinearChange","AdDurationChange","AdExpandedChange","AdRemainingTimeChange","AdVolumeChange","AdImpression","AdVideoStart","AdVideoFirstQuartile","AdVideoMidpoint","AdVideoThirdQuartile","AdVideoComplete","AdClickThru","AdInteraction","AdUserAcceptInvitation","AdUserMinimize","AdUserClose","AdPaused","AdPlaying","AdLog","AdError"];d.forEach(function(a){d[a]=a}),Object.freeze(d),b.exports=d},{}],11:[function(a,b,c){"use strict";var d=a("./window"),e=document.createElement("video"),f=a("./enums/MIME");c.isDesktop=!/Android|Silk|Mobile|PlayBook/.test(d.navigator.userAgent),c.canPlay=function(a){var b=d.navigator.mimeTypes,c=d.ActiveXObject;switch(a){case f.FLASH:try{return new c("ShockwaveFlash.ShockwaveFlash")?2:0}catch(a){return b&&b[f.FLASH]?2:0}return 0;case f.JAVASCRIPT:case"application/x-javascript":return 2;default:if(e.canPlayType)switch(e.canPlayType(a)){case"probably":return 2;case"maybe":return 1;default:return 0}}return 0},Object.freeze(c)},{"./enums/MIME":9,"./window":17}],12:[function(a,b,c){"use strict";function d(a,b){e.apply(this,arguments),this.swfURI=b,this.object=null}var e=a("./VPAID"),f=a("util").inherits,g=a("lie"),h=a("../uuid"),i=a("querystring"),j=a("../enums/VPAID_EVENTS"),k=a("../VPAIDVersion");f(d,e),d.prototype.load=function(a,b){var c=this,d=a[0].uri,e=a[0].bitrate;return new g(function(a,f){function g(a){c.container.removeChild(l),c.api=null,c.object=null,delete window[m],a&&f(a)}var l=document.createElement("object"),m="vast_player__"+h(20),n=i.stringify({vpaidURI:d,eventCallback:m});l.type="application/x-shockwave-flash",l.data=c.swfURI+"?"+n,l.style.display="block",l.style.width="100%",l.style.height="100%",l.style.border="none",l.style.opacity="0",l.innerHTML=['<param name="movie" value="'+c.swfURI+'">','<param name="flashvars" value="'+n+'">','<param name="quality" value="high">','<param name="play" value="false">','<param name="loop" value="false">','<param name="wmode" value="opaque">','<param name="scale" value="noscale">','<param name="salign" value="lt">','<param name="allowScriptAccess" value="always">'].join("\n"),c.object=l,window[m]=function(a){switch(a.type){case j.AdClickThru:return c.emit(a.type,a.url,a.Id,a.playerHandles);case j.AdInteraction:case j.AdLog:return c.emit(a.type,a.Id);case j.AdError:return c.emit(a.type,a.message);default:return c.emit(a.type)}},c.once("VPAIDInterfaceReady",function(){var a=l.getBoundingClientRect(),d=c.vpaidVersion=new k(l.handshakeVersion("2.0"));return d.major>2?f(new Error("VPAID version "+d+" is not supported.")):(c.on("VPAIDInterfaceResize",function(){var a=l.getBoundingClientRect();c.resizeAd(a.width,a.height,"normal")}),void l.initAd(a.width,a.height,"normal",e,b,null))}),c.once(j.AdLoaded,function(){c.api=l,l.style.opacity="1",a(c)}),c.once(j.AdError,function(a){g(new Error(a))}),c.once(j.AdStopped,g),c.container.appendChild(l)})},b.exports=d},{"../VPAIDVersion":6,"../enums/VPAID_EVENTS":10,"../uuid":16,"./VPAID":15,lie:21,querystring:26,util:35}],13:[function(a,b,c){"use strict";function d(a,b,c){return a.addEventListener(b,c,!1)}function e(a,b,c){return a.removeEventListener(b,c,!1)}function f(a,b,c){return d(a,b,function d(){return e(a,b,d),c.apply(this,arguments)})}function g(a,b){function c(){return new Error("The <video> has not been loaded.")}return function(){if(!this.video){if(b)return l.reject(c());throw c()}return a.apply(this,arguments)}}function h(a,b){var c=b.width,d=a.map(function(a){return{mediaFile:a,playability:m(a.type)}}).filter(function(a){return a.playability>0}).sort(n("-playability","-mediaFile.bitrate")),e=d.map(function(a){return Math.abs(c-a.mediaFile.width)}),f=d[e.indexOf(Math.min.apply(Math,e))];return!f||f.playability<1?null:f.mediaFile}function i(a){this.container=a,this.video=null,this.__private__={hasPlayed:!1}}var j=a("events").EventEmitter,k=a("util").inherits,l=a("lie"),m=a("../environment").canPlay,n=a("sort-by"),o=a("../enums/VPAID_EVENTS"),p=a("../enums/HTML_MEDIA_EVENTS"),q=a("../HTMLVideoTracker"),r=a("../EventProxy");k(i,j),Object.defineProperties(i.prototype,{adRemainingTime:{get:g(function(){return this.video.duration-this.video.currentTime})},adDuration:{get:g(function(){return this.video.duration})},adVolume:{get:g(function(){return this.video.volume}),set:g(function(a){this.video.volume=a})}}),i.prototype.load=function(a){var b=this;return new l(function(c,e){var g=document.createElement("video"),i=h(a,b.container.getBoundingClientRect());return i?(g.setAttribute("webkit-playsinline",!0),g.src=i.uri,g.preload="auto",g.style.display="block",g.style.width="100%",g.style.height="100%",g.style.objectFit="contain",f(g,p.LOADEDMETADATA,function(){var a=new q(g),e=new r(o);e.from(a).to(b),b.video=g,c(b),b.emit(o.AdLoaded),d(g,p.DURATIONCHANGE,function(){b.emit(o.AdDurationChange)}),d(g,p.VOLUMECHANGE,function(){b.emit(o.AdVolumeChange)})}),f(g,p.ERROR,function(){var a=g.error;b.emit(o.AdError,a.message),e(a)}),f(g,p.PLAYING,function(){b.__private__.hasPlayed=!0,b.emit(o.AdImpression)}),f(g,p.ENDED,function(){b.stopAd()}),d(g,"click",function(){b.emit(o.AdClickThru,null,null,!0)}),void b.container.appendChild(g)):e(new Error("There are no playable <MediaFile>s."))})},i.prototype.startAd=g(function(){var a=this,b=this.video;return this.__private__.hasPlayed?l.reject(new Error("The ad has already been started.")):new l(function(c){return f(b,p.PLAYING,function(){c(a),a.emit(o.AdStarted)}),b.play()})},!0),i.prototype.stopAd=g(function(){return this.container.removeChild(this.video),this.emit(o.AdStopped),l.resolve(this)},!0),i.prototype.pauseAd=g(function(){var a=this,b=this.video;return this.video.paused?l.resolve(this):new l(function(c){return f(b,p.PAUSE,function(){c(a),a.emit(o.AdPaused)}),b.pause()})},!0),i.prototype.resumeAd=g(function(){var a=this,b=this.video;return this.__private__.hasPlayed?this.video.paused?new l(function(c){return f(b,p.PLAY,function(){c(a),a.emit(o.AdPlaying)}),b.play()}):l.resolve(this):l.reject(new Error("The ad has not been started yet."))},!0),b.exports=i},{"../EventProxy":2,"../HTMLVideoTracker":3,"../enums/HTML_MEDIA_EVENTS":8,"../enums/VPAID_EVENTS":10,"../environment":11,events:19,lie:21,"sort-by":28,util:35}],14:[function(a,b,c){"use strict";function d(){f.apply(this,arguments),this.frame=null}var e=a("util").inherits,f=a("./VPAID"),g=a("lie"),h=a("../enums/VPAID_EVENTS"),i=a("../environment").isDesktop,j=a("../VPAIDVersion");e(d,f),d.prototype.load=function(a,b){var c=this,d=a[0].uri,e=a[0].bitrate;return new g(function(a,f){function g(a){c.container.removeChild(k),c.frame=null,c.api=null,a&&f(a)}var k=document.createElement("iframe"),l=document.createElement("script"),m=document.createElement("video");k.src="about:blank",k.style.width="100%",k.style.height="100%",k.style.display="block",k.style.opacity="0",k.style.border="none",m.setAttribute("webkit-playsinline","true"),m.style.display="block",m.style.width="100%",m.style.height="100%",m.style.objectFit="contain",c.container.appendChild(k),k.contentWindow.document.open(),k.contentWindow.document.close(),k.contentWindow.document.body.style.margin="0",c.frame=k,l.src=d,l.onload=function(){function d(){var a=k.getBoundingClientRect();c.resizeAd(a.width,a.height,"normal")}var l=k.contentWindow.getVPAIDAd(),n=k.getBoundingClientRect(),o=k.contentWindow.document.body,p=c.vpaidVersion=new j(l.handshakeVersion("2.0"));return p.major>2?f(new Error("VPAID version "+p+" is not supported.")):(k.contentWindow.addEventListener("resize",d,!1),h.forEach(function(a){return l.subscribe(function(){for(var b=new Array(arguments.length),d=arguments.length;d--;)b[d]=arguments[d];return c.emit.apply(c,[a].concat(b))},a)}),c.once(h.AdLoaded,function(){k.style.opacity="1",c.api=l,a(c)}),c.once(h.AdError,function(a){g(new Error(a))}),c.once(h.AdStopped,g),void l.initAd(n.width,n.height,"normal",e,{AdParameters:b},{slot:o,videoSlot:m,videoSlotCanAutoPlay:i}))},l.onerror=function(){g(new Error("Failed to load MediaFile ["+d+"]."))},k.contentWindow.document.body.appendChild(m),k.contentWindow.document.head.appendChild(l)})},b.exports=d},{"../VPAIDVersion":6,"../enums/VPAID_EVENTS":10,"../environment":11,"./VPAID":15,lie:21,util:35}],15:[function(a,b,c){"use strict";function d(a,b){return function(){function c(){return new Error("Ad has not been loaded.")}function d(){return f[a].apply(f,e)}var e=arguments,f=this.api,g=this;if(!b){if(!f)throw c();return d()}return new h(function(a,e){return f?(g.once(b,function(){a(g)}),d()):e(c())})}}function e(a){this.container=a,this.api=null,this.vpaidVersion=null}var f=a("util").inherits,g=a("events").EventEmitter,h=a("lie"),i=a("../enums/VPAID_EVENTS");f(e,g),Object.defineProperties(e.prototype,{adLinear:{get:d("getAdLinear")},adWidth:{get:d("getAdWidth")},adHeight:{get:d("getAdHeight")},adExpanded:{get:d("getAdExpanded")},adSkippableState:{get:d("getAdSkippableState")},adRemainingTime:{get:d("getAdRemainingTime")},adDuration:{get:d("getAdDuration")},adVolume:{get:d("getAdVolume"),set:d("setAdVolume")},adCompanions:{get:d("getAdCompanions")},adIcons:{get:d("getAdIcons")}}),e.prototype.load=function(){throw new Error("VPAID subclass must implement load() method.")},e.prototype.resizeAd=d("resizeAd",i.AdSizeChange),e.prototype.startAd=d("startAd",i.AdStarted),e.prototype.stopAd=d("stopAd",i.AdStopped),e.prototype.pauseAd=d("pauseAd",i.AdPaused),e.prototype.resumeAd=d("resumeAd",i.AdPlaying),e.prototype.expandAd=d("expandAd",i.AdExpandedChange),e.prototype.collapseAd=d("collapseAd",i.AdExpandedChange),e.prototype.skipAd=d("skipAd",i.AdSkipped),b.exports=e},{"../enums/VPAID_EVENTS":10,events:19,lie:21,util:35}],16:[function(a,b,c){"use strict";var d="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",e=d.length;b.exports=function(a){for(var b="";a--;)b+=d.charAt(Math.floor(Math.random()*e));return b}},{}],17:[function(a,b,c){b.exports=window},{}],18:[function(a,b,c){function d(a){if(a)return e(a)}function e(a){for(var b in d.prototype)a[b]=d.prototype[b];return a}"undefined"!=typeof b&&(b.exports=d),d.prototype.on=d.prototype.addEventListener=function(a,b){return this._callbacks=this._callbacks||{},(this._callbacks["$"+a]=this._callbacks["$"+a]||[]).push(b),this},d.prototype.once=function(a,b){function c(){this.off(a,c),b.apply(this,arguments)}return c.fn=b,this.on(a,c),this},d.prototype.off=d.prototype.removeListener=d.prototype.removeAllListeners=d.prototype.removeEventListener=function(a,b){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var c=this._callbacks["$"+a];if(!c)return this;if(1==arguments.length)return delete this._callbacks["$"+a],this;for(var d,e=0;e<c.length;e++)if(d=c[e],d===b||d.fn===b){c.splice(e,1);break}return this},d.prototype.emit=function(a){this._callbacks=this._callbacks||{};var b=[].slice.call(arguments,1),c=this._callbacks["$"+a];if(c){c=c.slice(0);for(var d=0,e=c.length;d<e;++d)c[d].apply(this,b)}return this},d.prototype.listeners=function(a){return this._callbacks=this._callbacks||{},this._callbacks["$"+a]||[]},d.prototype.hasListeners=function(a){return!!this.listeners(a).length}},{}],19:[function(a,b,c){function d(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function e(a){return"function"==typeof a}function f(a){return"number"==typeof a}function g(a){return"object"==typeof a&&null!==a}function h(a){return void 0===a}b.exports=d,d.EventEmitter=d,d.prototype._events=void 0,d.prototype._maxListeners=void 0,d.defaultMaxListeners=10,d.prototype.setMaxListeners=function(a){if(!f(a)||a<0||isNaN(a))throw TypeError("n must be a positive number");return this._maxListeners=a,this},d.prototype.emit=function(a){var b,c,d,f,i,j;if(this._events||(this._events={}),"error"===a&&(!this._events.error||g(this._events.error)&&!this._events.error.length)){if(b=arguments[1],b instanceof Error)throw b;throw TypeError('Uncaught, unspecified "error" event.')}if(c=this._events[a],h(c))return!1;if(e(c))switch(arguments.length){case 1:c.call(this);break;case 2:c.call(this,arguments[1]);break;case 3:c.call(this,arguments[1],arguments[2]);break;default:for(d=arguments.length,f=new Array(d-1),i=1;i<d;i++)f[i-1]=arguments[i];c.apply(this,f)}else if(g(c)){for(d=arguments.length,f=new Array(d-1),i=1;i<d;i++)f[i-1]=arguments[i];for(j=c.slice(),d=j.length,i=0;i<d;i++)j[i].apply(this,f)}return!0},d.prototype.addListener=function(a,b){var c;if(!e(b))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",a,e(b.listener)?b.listener:b),this._events[a]?g(this._events[a])?this._events[a].push(b):this._events[a]=[this._events[a],b]:this._events[a]=b,g(this._events[a])&&!this._events[a].warned){var c;c=h(this._maxListeners)?d.defaultMaxListeners:this._maxListeners,c&&c>0&&this._events[a].length>c&&(this._events[a].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[a].length),"function"==typeof console.trace&&console.trace())}return this},d.prototype.on=d.prototype.addListener,d.prototype.once=function(a,b){function c(){this.removeListener(a,c),d||(d=!0,b.apply(this,arguments))}if(!e(b))throw TypeError("listener must be a function");var d=!1;return c.listener=b,this.on(a,c),this},d.prototype.removeListener=function(a,b){var c,d,f,h;if(!e(b))throw TypeError("listener must be a function");if(!this._events||!this._events[a])return this;if(c=this._events[a],f=c.length,d=-1,c===b||e(c.listener)&&c.listener===b)delete this._events[a],this._events.removeListener&&this.emit("removeListener",a,b);else if(g(c)){for(h=f;h-- >0;)if(c[h]===b||c[h].listener&&c[h].listener===b){d=h;break}if(d<0)return this;1===c.length?(c.length=0,delete this._events[a]):c.splice(d,1),this._events.removeListener&&this.emit("removeListener",a,b)}return this},d.prototype.removeAllListeners=function(a){var b,c;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[a]&&delete this._events[a],this;if(0===arguments.length){for(b in this._events)"removeListener"!==b&&this.removeAllListeners(b);return this.removeAllListeners("removeListener"),this._events={},this}if(c=this._events[a],e(c))this.removeListener(a,c);else for(;c.length;)this.removeListener(a,c[c.length-1]);return delete this._events[a],this},d.prototype.listeners=function(a){var b;return b=this._events&&this._events[a]?e(this._events[a])?[this._events[a]]:this._events[a].slice():[]},d.listenerCount=function(a,b){var c;return c=a._events&&a._events[b]?e(a._events[b])?1:a._events[b].length:0}},{}],20:[function(a,b,c){(function(a){"use strict";function c(){k=!0;for(var a,b,c=l.length;c;){for(b=l,l=[],a=-1;++a<c;)b[a]();c=l.length}k=!1}function d(a){1!==l.push(a)||k||e()}var e,f=a.MutationObserver||a.WebKitMutationObserver;if(f){var g=0,h=new f(c),i=a.document.createTextNode("");h.observe(i,{characterData:!0}),e=function(){i.data=g=++g%2}}else if(a.setImmediate||"undefined"==typeof a.MessageChannel)e="document"in a&&"onreadystatechange"in a.document.createElement("script")?function(){var b=a.document.createElement("script");b.onreadystatechange=function(){c(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},a.document.documentElement.appendChild(b)}:function(){setTimeout(c,0)};else{var j=new a.MessageChannel;j.port1.onmessage=c,e=function(){j.port2.postMessage(0)}}var k,l=[];b.exports=d}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],21:[function(a,b,c){"use strict";function d(){}function e(a){if("function"!=typeof a)throw new TypeError("resolver must be a function");this.state=s,this.queue=[],this.outcome=void 0,a!==d&&i(this,a)}function f(a,b,c){this.promise=a,"function"==typeof b&&(this.onFulfilled=b,this.callFulfilled=this.otherCallFulfilled),"function"==typeof c&&(this.onRejected=c,this.callRejected=this.otherCallRejected)}function g(a,b,c){o(function(){var d;try{d=b(c)}catch(b){return p.reject(a,b)}d===a?p.reject(a,new TypeError("Cannot resolve promise with itself")):p.resolve(a,d)})}function h(a){var b=a&&a.then;if(a&&("object"==typeof a||"function"==typeof a)&&"function"==typeof b)return function(){b.apply(a,arguments)}}function i(a,b){function c(b){f||(f=!0,p.reject(a,b))}function d(b){f||(f=!0,p.resolve(a,b))}function e(){b(d,c)}var f=!1,g=j(e);"error"===g.status&&c(g.value)}function j(a,b){var c={};try{c.value=a(b),c.status="success"}catch(a){c.status="error",c.value=a}return c}function k(a){return a instanceof this?a:p.resolve(new this(d),a)}function l(a){var b=new this(d);return p.reject(b,a)}function m(a){function b(a,b){function d(a){g[b]=a,++h!==e||f||(f=!0,p.resolve(j,g))}c.resolve(a).then(d,function(a){f||(f=!0,p.reject(j,a))})}var c=this;if("[object Array]"!==Object.prototype.toString.call(a))return this.reject(new TypeError("must be an array"));var e=a.length,f=!1;if(!e)return this.resolve([]);for(var g=new Array(e),h=0,i=-1,j=new this(d);++i<e;)b(a[i],i);return j}function n(a){function b(a){c.resolve(a).then(function(a){f||(f=!0,p.resolve(h,a))},function(a){f||(f=!0,p.reject(h,a))})}var c=this;if("[object Array]"!==Object.prototype.toString.call(a))return this.reject(new TypeError("must be an array"));var e=a.length,f=!1;if(!e)return this.resolve([]);for(var g=-1,h=new this(d);++g<e;)b(a[g]);return h}var o=a("immediate"),p={},q=["REJECTED"],r=["FULFILLED"],s=["PENDING"];b.exports=e,e.prototype.catch=function(a){return this.then(null,a)},e.prototype.then=function(a,b){if("function"!=typeof a&&this.state===r||"function"!=typeof b&&this.state===q)return this;var c=new this.constructor(d);if(this.state!==s){var e=this.state===r?a:b;g(c,e,this.outcome)}else this.queue.push(new f(c,a,b));return c},f.prototype.callFulfilled=function(a){p.resolve(this.promise,a)},f.prototype.otherCallFulfilled=function(a){g(this.promise,this.onFulfilled,a)},f.prototype.callRejected=function(a){p.reject(this.promise,a)},f.prototype.otherCallRejected=function(a){g(this.promise,this.onRejected,a)},p.resolve=function(a,b){var c=j(h,b);if("error"===c.status)return p.reject(a,c.value);var d=c.value;if(d)i(a,d);else{a.state=r,a.outcome=b;for(var e=-1,f=a.queue.length;++e<f;)a.queue[e].callFulfilled(b)}return a},p.reject=function(a,b){a.state=q,a.outcome=b;for(var c=-1,d=a.queue.length;++c<d;)a.queue[c].callRejected(b);return a},e.resolve=k,e.reject=l,e.all=m,e.race=n},{immediate:20}],22:[function(b,c,d){!function(b,d){"use strict";"object"==typeof c&&"object"==typeof c.exports?c.exports=d():"function"==typeof a&&a.amd?a([],d):b.objectPath=d()}(this,function(){"use strict";function a(a){if(!a)return!0;if(f(a)&&0===a.length)return!0;for(var b in a)if(l.call(a,b))return!1;return!0}function b(a){return k.call(a)}function c(a){return"number"==typeof a||"[object Number]"===b(a)}function d(a){return"string"==typeof a||"[object String]"===b(a)}function e(a){return"object"==typeof a&&"[object Object]"===b(a)}function f(a){return"object"==typeof a&&"number"==typeof a.length&&"[object Array]"===b(a)}function g(a){return"boolean"==typeof a||"[object Boolean]"===b(a)}function h(a){var b=parseInt(a);return b.toString()===a?b:a}function i(b,e,f,g){if(c(e)&&(e=[e]),a(e))return b;if(d(e))return i(b,e.split("."),f,g);var j=h(e[0]);if(1===e.length){var k=b[j];return void 0!==k&&g||(b[j]=f),k}return void 0===b[j]&&(c(j)?b[j]=[]:b[j]={}),i(b[j],e.slice(1),f,g)}function j(b,e){if(c(e)&&(e=[e]),!a(b)){if(a(e))return b;if(d(e))return j(b,e.split("."));var g=h(e[0]),i=b[g];if(1===e.length)void 0!==i&&(f(b)?b.splice(g,1):delete b[g]);else if(void 0!==b[g])return j(b[g],e.slice(1));return b}}var k=Object.prototype.toString,l=Object.prototype.hasOwnProperty,m={};return m.ensureExists=function(a,b,c){return i(a,b,c,!0)},m.set=function(a,b,c,d){return i(a,b,c,d)},m.insert=function(a,b,c,d){var e=m.get(a,b);d=~~d,f(e)||(e=[],m.set(a,b,e)),e.splice(d,0,c)},m.empty=function(b,h){if(a(h))return b;if(!a(b)){var i,j;if(!(i=m.get(b,h)))return b;if(d(i))return m.set(b,h,"");if(g(i))return m.set(b,h,!1);if(c(i))return m.set(b,h,0);if(f(i))i.length=0;else{if(!e(i))return m.set(b,h,null);for(j in i)l.call(i,j)&&delete i[j]}}},m.push=function(a,b){var c=m.get(a,b);f(c)||(c=[],m.set(a,b,c)),c.push.apply(c,Array.prototype.slice.call(arguments,2))},m.coalesce=function(a,b,c){for(var d,e=0,f=b.length;e<f;e++)if(void 0!==(d=m.get(a,b[e])))return d;return c},m.get=function(b,e,f){if(c(e)&&(e=[e]),a(e))return b;if(a(b))return f;if(d(e))return m.get(b,e.split("."),f);var g=h(e[0]);return 1===e.length?void 0===b[g]?f:b[g]:m.get(b[g],e.slice(1),f)},m.del=function(a,b){return j(a,b)},m})},{}],23:[function(a,b,c){function d(){throw new Error("setTimeout has not been defined")}function e(){throw new Error("clearTimeout has not been defined")}function f(a){if(l===setTimeout)return setTimeout(a,0);if((l===d||!l)&&setTimeout)return l=setTimeout,setTimeout(a,0);try{return l(a,0)}catch(b){try{return l.call(null,a,0)}catch(b){return l.call(this,a,0)}}}function g(a){if(m===clearTimeout)return clearTimeout(a);if((m===e||!m)&&clearTimeout)return m=clearTimeout,clearTimeout(a);try{return m(a)}catch(b){try{return m.call(null,a)}catch(b){return m.call(this,a)}}}function h(){q&&o&&(q=!1,o.length?p=o.concat(p):r=-1,p.length&&i())}function i(){if(!q){var a=f(h);q=!0;for(var b=p.length;b;){for(o=p,p=[];++r<b;)o&&o[r].run();r=-1,b=p.length}o=null,q=!1,g(a)}}function j(a,b){this.fun=a,this.array=b}function k(){}var l,m,n=b.exports={};!function(){try{l="function"==typeof setTimeout?setTimeout:d}catch(a){l=d}try{m="function"==typeof clearTimeout?clearTimeout:e}catch(a){m=e}}();var o,p=[],q=!1,r=-1;n.nextTick=function(a){var b=new Array(arguments.length-1);if(arguments.length>1)for(var c=1;c<arguments.length;c++)b[c-1]=arguments[c];p.push(new j(a,b)),1!==p.length||q||f(i)},j.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=k,n.addListener=k,n.once=k,n.off=k,n.removeListener=k,n.removeAllListeners=k,n.emit=k,n.prependListener=k,n.prependOnceListener=k,n.listeners=function(a){return[]},n.binding=function(a){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(a){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},{}],24:[function(a,b,c){"use strict";function d(a,b){return Object.prototype.hasOwnProperty.call(a,b)}b.exports=function(a,b,c,f){b=b||"&",c=c||"=";var g={};if("string"!=typeof a||0===a.length)return g;var h=/\+/g;a=a.split(b);var i=1e3;f&&"number"==typeof f.maxKeys&&(i=f.maxKeys);var j=a.length;i>0&&j>i&&(j=i);for(var k=0;k<j;++k){var l,m,n,o,p=a[k].replace(h,"%20"),q=p.indexOf(c);q>=0?(l=p.substr(0,q),m=p.substr(q+1)):(l=p,m=""),n=decodeURIComponent(l),o=decodeURIComponent(m),d(g,n)?e(g[n])?g[n].push(o):g[n]=[g[n],o]:g[n]=o}return g};var e=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)}},{}],25:[function(a,b,c){"use strict";function d(a,b){if(a.map)return a.map(b);for(var c=[],d=0;d<a.length;d++)c.push(b(a[d],d));return c}var e=function(a){switch(typeof a){case"string":return a;case"boolean":return a?"true":"false";case"number":return isFinite(a)?a:"";default:return""}};b.exports=function(a,b,c,h){return b=b||"&",c=c||"=",null===a&&(a=void 0),"object"==typeof a?d(g(a),function(g){var h=encodeURIComponent(e(g))+c;return f(a[g])?d(a[g],function(a){return h+encodeURIComponent(e(a))}).join(b):h+encodeURIComponent(e(a[g]))}).join(b):h?encodeURIComponent(e(h))+c+encodeURIComponent(e(a)):"";
};var f=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)},g=Object.keys||function(a){var b=[];for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&b.push(c);return b}},{}],26:[function(a,b,c){"use strict";c.decode=c.parse=a("./decode"),c.encode=c.stringify=a("./encode")},{"./decode":24,"./encode":25}],27:[function(a,b,c){b.exports=function(a,b,c){for(var d=0,e=a.length,f=3==arguments.length?c:a[d++];d<e;)f=b.call(null,f,a[d],++d,a);return f}},{}],28:[function(a,b,c){var d,e,f,g=a("object-path");f=function(a){return function(b){return typeof b===a}},e=function(a,b){var c=1,d=b||function(a,b){return b};return"-"===a[0]&&(c=-1,a=a.substr(1)),function(b,e){var f,h=d(a,g.get(b,a)),i=d(a,g.get(e,a));return h<i&&(f=-1),h>i&&(f=1),h===i&&(f=0),f*c}},d=function(){var a=Array.prototype.slice.call(arguments),b=a.filter(f("string")),c=a.filter(f("function"))[0];return function(a,d){for(var f=b.length,g=0,h=0;0===g&&h<f;)g=e(b[h],c)(a,d),h++;return g}},b.exports=d},{"object-path":22}],29:[function(a,b,c){function d(){}function e(a){var b={}.toString.call(a);switch(b){case"[object File]":case"[object Blob]":case"[object FormData]":return!0;default:return!1}}function f(a){if(!t(a))return a;var b=[];for(var c in a)null!=a[c]&&g(b,c,a[c]);return b.join("&")}function g(a,b,c){return Array.isArray(c)?c.forEach(function(c){g(a,b,c)}):void a.push(encodeURIComponent(b)+"="+encodeURIComponent(c))}function h(a){for(var b,c,d={},e=a.split("&"),f=0,g=e.length;f<g;++f)c=e[f],b=c.split("="),d[decodeURIComponent(b[0])]=decodeURIComponent(b[1]);return d}function i(a){var b,c,d,e,f=a.split(/\r?\n/),g={};f.pop();for(var h=0,i=f.length;h<i;++h)c=f[h],b=c.indexOf(":"),d=c.slice(0,b).toLowerCase(),e=v(c.slice(b+1)),g[d]=e;return g}function j(a){return/[\/+]json\b/.test(a)}function k(a){return a.split(/ *; */).shift()}function l(a){return r(a.split(/ *; */),function(a,b){var c=b.split(/ *= */),d=c.shift(),e=c.shift();return d&&e&&(a[d]=e),a},{})}function m(a,b){b=b||{},this.req=a,this.xhr=this.req.xhr,this.text="HEAD"!=this.req.method&&(""===this.xhr.responseType||"text"===this.xhr.responseType)||"undefined"==typeof this.xhr.responseType?this.xhr.responseText:null,this.statusText=this.req.xhr.statusText,this.setStatusProperties(this.xhr.status),this.header=this.headers=i(this.xhr.getAllResponseHeaders()),this.header["content-type"]=this.xhr.getResponseHeader("content-type"),this.setHeaderProperties(this.header),this.body="HEAD"!=this.req.method?this.parseBody(this.text?this.text:this.xhr.response):null}function n(a,b){var c=this;this._query=this._query||[],this.method=a,this.url=b,this.header={},this._header={},this.on("end",function(){var a=null,b=null;try{b=new m(c)}catch(b){return a=new Error("Parser is unable to parse the response"),a.parse=!0,a.original=b,a.rawResponse=c.xhr&&c.xhr.responseText?c.xhr.responseText:null,a.statusCode=c.xhr&&c.xhr.status?c.xhr.status:null,c.callback(a)}if(c.emit("response",b),a)return c.callback(a,b);if(b.status>=200&&b.status<300)return c.callback(a,b);var d=new Error(b.statusText||"Unsuccessful HTTP response");d.original=a,d.response=b,d.status=b.status,c.callback(d,b)})}function o(a,b){var c=u("DELETE",a);return b&&c.end(b),c}var p,q=a("emitter"),r=a("reduce"),s=a("./request-base"),t=a("./is-object");p="undefined"!=typeof window?window:"undefined"!=typeof self?self:this;var u=b.exports=a("./request").bind(null,n);u.getXHR=function(){if(!(!p.XMLHttpRequest||p.location&&"file:"==p.location.protocol&&p.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(a){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(a){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(a){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(a){}return!1};var v="".trim?function(a){return a.trim()}:function(a){return a.replace(/(^\s*|\s*$)/g,"")};u.serializeObject=f,u.parseString=h,u.types={html:"text/html",json:"application/json",xml:"application/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},u.serialize={"application/x-www-form-urlencoded":f,"application/json":JSON.stringify},u.parse={"application/x-www-form-urlencoded":h,"application/json":JSON.parse},m.prototype.get=function(a){return this.header[a.toLowerCase()]},m.prototype.setHeaderProperties=function(a){var b=this.header["content-type"]||"";this.type=k(b);var c=l(b);for(var d in c)this[d]=c[d]},m.prototype.parseBody=function(a){var b=u.parse[this.type];return!b&&j(this.type)&&(b=u.parse["application/json"]),b&&a&&(a.length||a instanceof Object)?b(a):null},m.prototype.setStatusProperties=function(a){1223===a&&(a=204);var b=a/100|0;this.status=this.statusCode=a,this.statusType=b,this.info=1==b,this.ok=2==b,this.clientError=4==b,this.serverError=5==b,this.error=(4==b||5==b)&&this.toError(),this.accepted=202==a,this.noContent=204==a,this.badRequest=400==a,this.unauthorized=401==a,this.notAcceptable=406==a,this.notFound=404==a,this.forbidden=403==a},m.prototype.toError=function(){var a=this.req,b=a.method,c=a.url,d="cannot "+b+" "+c+" ("+this.status+")",e=new Error(d);return e.status=this.status,e.method=b,e.url=c,e},u.Response=m,q(n.prototype);for(var w in s)n.prototype[w]=s[w];n.prototype.abort=function(){if(!this.aborted)return this.aborted=!0,this.xhr&&this.xhr.abort(),this.clearTimeout(),this.emit("abort"),this},n.prototype.type=function(a){return this.set("Content-Type",u.types[a]||a),this},n.prototype.responseType=function(a){return this._responseType=a,this},n.prototype.accept=function(a){return this.set("Accept",u.types[a]||a),this},n.prototype.auth=function(a,b,c){switch(c||(c={type:"basic"}),c.type){case"basic":var d=btoa(a+":"+b);this.set("Authorization","Basic "+d);break;case"auto":this.username=a,this.password=b}return this},n.prototype.query=function(a){return"string"!=typeof a&&(a=f(a)),a&&this._query.push(a),this},n.prototype.attach=function(a,b,c){return this._getFormData().append(a,b,c||b.name),this},n.prototype._getFormData=function(){return this._formData||(this._formData=new p.FormData),this._formData},n.prototype.send=function(a){var b=t(a),c=this._header["content-type"];if(b&&t(this._data))for(var d in a)this._data[d]=a[d];else"string"==typeof a?(c||this.type("form"),c=this._header["content-type"],"application/x-www-form-urlencoded"==c?this._data=this._data?this._data+"&"+a:a:this._data=(this._data||"")+a):this._data=a;return!b||e(a)?this:(c||this.type("json"),this)},m.prototype.parse=function(a){return p.console&&console.warn("Client-side parse() method has been renamed to serialize(). This method is not compatible with superagent v2.0"),this.serialize(a),this},m.prototype.serialize=function(a){return this._parser=a,this},n.prototype.callback=function(a,b){var c=this._callback;this.clearTimeout(),c(a,b)},n.prototype.crossDomainError=function(){var a=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");a.crossDomain=!0,a.status=this.status,a.method=this.method,a.url=this.url,this.callback(a)},n.prototype.timeoutError=function(){var a=this._timeout,b=new Error("timeout of "+a+"ms exceeded");b.timeout=a,this.callback(b)},n.prototype.withCredentials=function(){return this._withCredentials=!0,this},n.prototype.end=function(a){var b=this,c=this.xhr=u.getXHR(),f=this._query.join("&"),g=this._timeout,h=this._formData||this._data;this._callback=a||d,c.onreadystatechange=function(){if(4==c.readyState){var a;try{a=c.status}catch(b){a=0}if(0==a){if(b.timedout)return b.timeoutError();if(b.aborted)return;return b.crossDomainError()}b.emit("end")}};var i=function(a){a.total>0&&(a.percent=a.loaded/a.total*100),a.direction="download",b.emit("progress",a)};this.hasListeners("progress")&&(c.onprogress=i);try{c.upload&&this.hasListeners("progress")&&(c.upload.onprogress=i)}catch(a){}if(g&&!this._timer&&(this._timer=setTimeout(function(){b.timedout=!0,b.abort()},g)),f&&(f=u.serializeObject(f),this.url+=~this.url.indexOf("?")?"&"+f:"?"+f),this.username&&this.password?c.open(this.method,this.url,!0,this.username,this.password):c.open(this.method,this.url,!0),this._withCredentials&&(c.withCredentials=!0),"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof h&&!e(h)){var k=this._header["content-type"],l=this._parser||u.serialize[k?k.split(";")[0]:""];!l&&j(k)&&(l=u.serialize["application/json"]),l&&(h=l(h))}for(var m in this.header)null!=this.header[m]&&c.setRequestHeader(m,this.header[m]);return this._responseType&&(c.responseType=this._responseType),this.emit("request",this),c.send("undefined"!=typeof h?h:null),this},u.Request=n,u.get=function(a,b,c){var d=u("GET",a);return"function"==typeof b&&(c=b,b=null),b&&d.query(b),c&&d.end(c),d},u.head=function(a,b,c){var d=u("HEAD",a);return"function"==typeof b&&(c=b,b=null),b&&d.send(b),c&&d.end(c),d},u.del=o,u.delete=o,u.patch=function(a,b,c){var d=u("PATCH",a);return"function"==typeof b&&(c=b,b=null),b&&d.send(b),c&&d.end(c),d},u.post=function(a,b,c){var d=u("POST",a);return"function"==typeof b&&(c=b,b=null),b&&d.send(b),c&&d.end(c),d},u.put=function(a,b,c){var d=u("PUT",a);return"function"==typeof b&&(c=b,b=null),b&&d.send(b),c&&d.end(c),d}},{"./is-object":30,"./request":32,"./request-base":31,emitter:18,reduce:27}],30:[function(a,b,c){function d(a){return null!=a&&"object"==typeof a}b.exports=d},{}],31:[function(a,b,c){var d=a("./is-object");c.clearTimeout=function(){return this._timeout=0,clearTimeout(this._timer),this},c.parse=function(a){return this._parser=a,this},c.timeout=function(a){return this._timeout=a,this},c.then=function(a,b){return this.end(function(c,d){c?b(c):a(d)})},c.use=function(a){return a(this),this},c.get=function(a){return this._header[a.toLowerCase()]},c.getHeader=c.get,c.set=function(a,b){if(d(a)){for(var c in a)this.set(c,a[c]);return this}return this._header[a.toLowerCase()]=b,this.header[a]=b,this},c.unset=function(a){return delete this._header[a.toLowerCase()],delete this.header[a],this},c.field=function(a,b){return this._getFormData().append(a,b),this}},{"./is-object":30}],32:[function(a,b,c){function d(a,b,c){return"function"==typeof c?new a("GET",b).end(c):2==arguments.length?new a("GET",b):new a(b,c)}b.exports=d},{}],33:[function(a,b,c){"function"==typeof Object.create?b.exports=function(a,b){a.super_=b,a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}})}:b.exports=function(a,b){a.super_=b;var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a}},{}],34:[function(a,b,c){b.exports=function(a){return a&&"object"==typeof a&&"function"==typeof a.copy&&"function"==typeof a.fill&&"function"==typeof a.readUInt8}},{}],35:[function(a,b,c){(function(b,d){function e(a,b){var d={seen:[],stylize:g};return arguments.length>=3&&(d.depth=arguments[2]),arguments.length>=4&&(d.colors=arguments[3]),p(b)?d.showHidden=b:b&&c._extend(d,b),v(d.showHidden)&&(d.showHidden=!1),v(d.depth)&&(d.depth=2),v(d.colors)&&(d.colors=!1),v(d.customInspect)&&(d.customInspect=!0),d.colors&&(d.stylize=f),i(d,a,d.depth)}function f(a,b){var c=e.styles[b];return c?"["+e.colors[c][0]+"m"+a+"["+e.colors[c][1]+"m":a}function g(a,b){return a}function h(a){var b={};return a.forEach(function(a,c){b[a]=!0}),b}function i(a,b,d){if(a.customInspect&&b&&A(b.inspect)&&b.inspect!==c.inspect&&(!b.constructor||b.constructor.prototype!==b)){var e=b.inspect(d,a);return t(e)||(e=i(a,e,d)),e}var f=j(a,b);if(f)return f;var g=Object.keys(b),p=h(g);if(a.showHidden&&(g=Object.getOwnPropertyNames(b)),z(b)&&(g.indexOf("message")>=0||g.indexOf("description")>=0))return k(b);if(0===g.length){if(A(b)){var q=b.name?": "+b.name:"";return a.stylize("[Function"+q+"]","special")}if(w(b))return a.stylize(RegExp.prototype.toString.call(b),"regexp");if(y(b))return a.stylize(Date.prototype.toString.call(b),"date");if(z(b))return k(b)}var r="",s=!1,u=["{","}"];if(o(b)&&(s=!0,u=["[","]"]),A(b)){var v=b.name?": "+b.name:"";r=" [Function"+v+"]"}if(w(b)&&(r=" "+RegExp.prototype.toString.call(b)),y(b)&&(r=" "+Date.prototype.toUTCString.call(b)),z(b)&&(r=" "+k(b)),0===g.length&&(!s||0==b.length))return u[0]+r+u[1];if(d<0)return w(b)?a.stylize(RegExp.prototype.toString.call(b),"regexp"):a.stylize("[Object]","special");a.seen.push(b);var x;return x=s?l(a,b,d,p,g):g.map(function(c){return m(a,b,d,p,c,s)}),a.seen.pop(),n(x,r,u)}function j(a,b){if(v(b))return a.stylize("undefined","undefined");if(t(b)){var c="'"+JSON.stringify(b).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return a.stylize(c,"string")}return s(b)?a.stylize(""+b,"number"):p(b)?a.stylize(""+b,"boolean"):q(b)?a.stylize("null","null"):void 0}function k(a){return"["+Error.prototype.toString.call(a)+"]"}function l(a,b,c,d,e){for(var f=[],g=0,h=b.length;g<h;++g)F(b,String(g))?f.push(m(a,b,c,d,String(g),!0)):f.push("");return e.forEach(function(e){e.match(/^\d+$/)||f.push(m(a,b,c,d,e,!0))}),f}function m(a,b,c,d,e,f){var g,h,j;if(j=Object.getOwnPropertyDescriptor(b,e)||{value:b[e]},j.get?h=j.set?a.stylize("[Getter/Setter]","special"):a.stylize("[Getter]","special"):j.set&&(h=a.stylize("[Setter]","special")),F(d,e)||(g="["+e+"]"),h||(a.seen.indexOf(j.value)<0?(h=q(c)?i(a,j.value,null):i(a,j.value,c-1),h.indexOf("\n")>-1&&(h=f?h.split("\n").map(function(a){return" "+a}).join("\n").substr(2):"\n"+h.split("\n").map(function(a){return" "+a}).join("\n"))):h=a.stylize("[Circular]","special")),v(g)){if(f&&e.match(/^\d+$/))return h;g=JSON.stringify(""+e),g.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(g=g.substr(1,g.length-2),g=a.stylize(g,"name")):(g=g.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),g=a.stylize(g,"string"))}return g+": "+h}function n(a,b,c){var d=0,e=a.reduce(function(a,b){return d++,b.indexOf("\n")>=0&&d++,a+b.replace(/\u001b\[\d\d?m/g,"").length+1},0);return e>60?c[0]+(""===b?"":b+"\n ")+" "+a.join(",\n ")+" "+c[1]:c[0]+b+" "+a.join(", ")+" "+c[1]}function o(a){return Array.isArray(a)}function p(a){return"boolean"==typeof a}function q(a){return null===a}function r(a){return null==a}function s(a){return"number"==typeof a}function t(a){return"string"==typeof a}function u(a){return"symbol"==typeof a}function v(a){return void 0===a}function w(a){return x(a)&&"[object RegExp]"===C(a)}function x(a){return"object"==typeof a&&null!==a}function y(a){return x(a)&&"[object Date]"===C(a)}function z(a){return x(a)&&("[object Error]"===C(a)||a instanceof Error)}function A(a){return"function"==typeof a}function B(a){return null===a||"boolean"==typeof a||"number"==typeof a||"string"==typeof a||"symbol"==typeof a||"undefined"==typeof a}function C(a){return Object.prototype.toString.call(a)}function D(a){return a<10?"0"+a.toString(10):a.toString(10)}function E(){var a=new Date,b=[D(a.getHours()),D(a.getMinutes()),D(a.getSeconds())].join(":");return[a.getDate(),J[a.getMonth()],b].join(" ")}function F(a,b){return Object.prototype.hasOwnProperty.call(a,b)}var G=/%[sdj%]/g;c.format=function(a){if(!t(a)){for(var b=[],c=0;c<arguments.length;c++)b.push(e(arguments[c]));return b.join(" ")}for(var c=1,d=arguments,f=d.length,g=String(a).replace(G,function(a){if("%%"===a)return"%";if(c>=f)return a;switch(a){case"%s":return String(d[c++]);case"%d":return Number(d[c++]);case"%j":try{return JSON.stringify(d[c++])}catch(a){return"[Circular]"}default:return a}}),h=d[c];c<f;h=d[++c])g+=q(h)||!x(h)?" "+h:" "+e(h);return g},c.deprecate=function(a,e){function f(){if(!g){if(b.throwDeprecation)throw new Error(e);b.traceDeprecation?console.trace(e):console.error(e),g=!0}return a.apply(this,arguments)}if(v(d.process))return function(){return c.deprecate(a,e).apply(this,arguments)};if(b.noDeprecation===!0)return a;var g=!1;return f};var H,I={};c.debuglog=function(a){if(v(H)&&(H=b.env.NODE_DEBUG||""),a=a.toUpperCase(),!I[a])if(new RegExp("\\b"+a+"\\b","i").test(H)){var d=b.pid;I[a]=function(){var b=c.format.apply(c,arguments);console.error("%s %d: %s",a,d,b)}}else I[a]=function(){};return I[a]},c.inspect=e,e.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},e.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},c.isArray=o,c.isBoolean=p,c.isNull=q,c.isNullOrUndefined=r,c.isNumber=s,c.isString=t,c.isSymbol=u,c.isUndefined=v,c.isRegExp=w,c.isObject=x,c.isDate=y,c.isError=z,c.isFunction=A,c.isPrimitive=B,c.isBuffer=a("./support/isBuffer");var J=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];c.log=function(){console.log("%s - %s",E(),c.format.apply(c,arguments))},c.inherits=a("inherits"),c._extend=function(a,b){if(!b||!x(b))return a;for(var c=Object.keys(b),d=c.length;d--;)a[c[d]]=b[c[d]];return a}}).call(this,a("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":34,_process:23,inherits:33}],36:[function(a,b,c){c.VAST=a("./lib/VAST")},{"./lib/VAST":37}],37:[function(a,b,c){"use strict";function d(){}function e(a){n({description:null,survey:null},a)}function f(){}function g(a){n({trackingEvents:[],parameters:null,videoClicks:null},a),(a.mediaFiles||[]).forEach(function(a){n({id:null,bitrate:null,scalable:null,maintainAspectRatio:null,apiFramework:null},a)})}function h(a){a.companions.forEach(function(a){n({expandedWidth:null,expandedHeight:null,apiFramework:null,trackingEvents:[],clickThrough:null,altText:null,parameters:null},a)})}function i(a){n({trackingEvents:[]},a),a.ads.forEach(function(a){n({id:null,expandedWidth:null,expandedHeight:null,scalable:null,maintainAspectRatio:null,minSuggestedDuration:null,apiFramework:null,clickThrough:null,parameters:null},a)})}function j(a){m(a,this,!0),this.ads.forEach(