uppy
Version:
Almost as cute as a Puppy :dog:
72 lines (64 loc) • 363 kB
JavaScript
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Uppy = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
function after(o,n,t){function r(o,e){if(r.count<=0)throw new Error("after called too many times");--r.count,o?(u=!0,n(o),n=t):0!==r.count||u||n(null,e)}var u=!1;return t=t||noop,r.count=o,0===o?n():r}function noop(){}module.exports=after;
},{}],2:[function(require,module,exports){
module.exports=function(r,e,n){var t=r.byteLength;if(e=e||0,n=n||t,r.slice)return r.slice(e,n);if(e<0&&(e+=t),n<0&&(n+=t),n>t&&(n=t),e>=t||e>=n||0===t)return new ArrayBuffer(0);for(var f=new Uint8Array(r),i=new Uint8Array(n-e),u=e,a=0;u<n;u++,a++)i[a]=f[u];return i.buffer};
},{}],3:[function(require,module,exports){
(function (global){
"use strict";function compare(e,t){if(e===t)return 0;for(var r=e.length,n=t.length,i=0,a=Math.min(r,n);i<a;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0}function isBuffer(e){return global.Buffer&&"function"==typeof global.Buffer.isBuffer?global.Buffer.isBuffer(e):!(null==e||!e._isBuffer)}function pToString(e){return Object.prototype.toString.call(e)}function isView(e){return!isBuffer(e)&&("function"==typeof global.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):!!e&&(e instanceof DataView||!!(e.buffer&&e.buffer instanceof ArrayBuffer))))}function getName(e){if(util.isFunction(e)){if(functionsHaveNames)return e.name;var t=e.toString(),r=t.match(regex);return r&&r[1]}}function truncate(e,t){return"string"==typeof e?e.length<t?e:e.slice(0,t):e}function inspect(e){if(functionsHaveNames||!util.isFunction(e))return util.inspect(e);var t=getName(e);return"[Function"+(t?": "+t:"")+"]"}function getMessage(e){return truncate(inspect(e.actual),128)+" "+e.operator+" "+truncate(inspect(e.expected),128)}function fail(e,t,r,n,i){throw new assert.AssertionError({message:r,actual:e,expected:t,operator:n,stackStartFunction:i})}function ok(e,t){e||fail(e,!0,t,"==",assert.ok)}function _deepEqual(e,t,r,n){if(e===t)return!0;if(isBuffer(e)&&isBuffer(t))return 0===compare(e,t);if(util.isDate(e)&&util.isDate(t))return e.getTime()===t.getTime();if(util.isRegExp(e)&&util.isRegExp(t))return e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.lastIndex===t.lastIndex&&e.ignoreCase===t.ignoreCase;if(null!==e&&"object"==typeof e||null!==t&&"object"==typeof t){if(isView(e)&&isView(t)&&pToString(e)===pToString(t)&&!(e instanceof Float32Array||e instanceof Float64Array))return 0===compare(new Uint8Array(e.buffer),new Uint8Array(t.buffer));if(isBuffer(e)!==isBuffer(t))return!1;n=n||{actual:[],expected:[]};var i=n.actual.indexOf(e);return-1!==i&&i===n.expected.indexOf(t)||(n.actual.push(e),n.expected.push(t),objEquiv(e,t,r,n))}return r?e===t:e==t}function isArguments(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function objEquiv(e,t,r,n){if(null===e||void 0===e||null===t||void 0===t)return!1;if(util.isPrimitive(e)||util.isPrimitive(t))return e===t;if(r&&Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;var i=isArguments(e),a=isArguments(t);if(i&&!a||!i&&a)return!1;if(i)return e=pSlice.call(e),t=pSlice.call(t),_deepEqual(e,t,r);var s,u,o=objectKeys(e),f=objectKeys(t);if(o.length!==f.length)return!1;for(o.sort(),f.sort(),u=o.length-1;u>=0;u--)if(o[u]!==f[u])return!1;for(u=o.length-1;u>=0;u--)if(s=o[u],!_deepEqual(e[s],t[s],r,n))return!1;return!0}function notDeepStrictEqual(e,t,r){_deepEqual(e,t,!0)&&fail(e,t,r,"notDeepStrictEqual",notDeepStrictEqual)}function expectedException(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function _tryBlock(e){var t;try{e()}catch(e){t=e}return t}function _throws(e,t,r,n){var i;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),i=_tryBlock(t),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),e&&!i&&fail(i,r,"Missing expected exception"+n);var a="string"==typeof n,s=!e&&util.isError(i),u=!e&&i&&!r;if((s&&a&&expectedException(i,r)||u)&&fail(i,r,"Got unwanted exception"+n),e&&i&&r&&!expectedException(i,r)||!e&&i)throw i}var util=require("util/"),hasOwn=Object.prototype.hasOwnProperty,pSlice=Array.prototype.slice,functionsHaveNames=function(){return"foo"===function(){}.name}(),assert=module.exports=ok,regex=/\s*function\s+([^\(\s]*)\s*/;assert.AssertionError=function(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=getMessage(this),this.generatedMessage=!0);var t=e.stackStartFunction||fail;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var r=new Error;if(r.stack){var n=r.stack,i=getName(t),a=n.indexOf("\n"+i);if(a>=0){var s=n.indexOf("\n",a+1);n=n.substring(s+1)}this.stack=n}}},util.inherits(assert.AssertionError,Error),assert.fail=fail,assert.ok=ok,assert.equal=function(e,t,r){e!=t&&fail(e,t,r,"==",assert.equal)},assert.notEqual=function(e,t,r){e==t&&fail(e,t,r,"!=",assert.notEqual)},assert.deepEqual=function(e,t,r){_deepEqual(e,t,!1)||fail(e,t,r,"deepEqual",assert.deepEqual)},assert.deepStrictEqual=function(e,t,r){_deepEqual(e,t,!0)||fail(e,t,r,"deepStrictEqual",assert.deepStrictEqual)},assert.notDeepEqual=function(e,t,r){_deepEqual(e,t,!1)&&fail(e,t,r,"notDeepEqual",assert.notDeepEqual)},assert.notDeepStrictEqual=notDeepStrictEqual,assert.strictEqual=function(e,t,r){e!==t&&fail(e,t,r,"===",assert.strictEqual)},assert.notStrictEqual=function(e,t,r){e===t&&fail(e,t,r,"!==",assert.notStrictEqual)},assert.throws=function(e,t,r){_throws(!0,e,t,r)},assert.doesNotThrow=function(e,t,r){_throws(!1,e,t,r)},assert.ifError=function(e){if(e)throw e};var objectKeys=Object.keys||function(e){var t=[];for(var r in e)hasOwn.call(e,r)&&t.push(r);return t};
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"util/":79}],4:[function(require,module,exports){
function Backoff(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}module.exports=Backoff,Backoff.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var o=Math.random(),i=Math.floor(o*this.jitter*t);t=0==(1&Math.floor(10*o))?t-i:t+i}return 0|Math.min(t,this.max)},Backoff.prototype.reset=function(){this.attempts=0},Backoff.prototype.setMin=function(t){this.ms=t},Backoff.prototype.setMax=function(t){this.max=t},Backoff.prototype.setJitter=function(t){this.jitter=t};
},{}],5:[function(require,module,exports){
!function(){"use strict";for(var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=new Uint8Array(256),t=0;t<r.length;t++)e[r.charCodeAt(t)]=t;exports.encode=function(e){var t,n=new Uint8Array(e),o=n.length,a="";for(t=0;t<o;t+=3)a+=r[n[t]>>2],a+=r[(3&n[t])<<4|n[t+1]>>4],a+=r[(15&n[t+1])<<2|n[t+2]>>6],a+=r[63&n[t+2]];return o%3==2?a=a.substring(0,a.length-1)+"=":o%3==1&&(a=a.substring(0,a.length-2)+"=="),a},exports.decode=function(r){var t,n,o,a,h,c=.75*r.length,g=r.length,i=0;"="===r[r.length-1]&&(c--,"="===r[r.length-2]&&c--);var u=new ArrayBuffer(c),A=new Uint8Array(u);for(t=0;t<g;t+=4)n=e[r.charCodeAt(t)],o=e[r.charCodeAt(t+1)],a=e[r.charCodeAt(t+2)],h=e[r.charCodeAt(t+3)],A[i++]=n<<2|o>>4,A[i++]=(15&o)<<4|a>>2,A[i++]=(3&a)<<6|63&h;return u}}();
},{}],6:[function(require,module,exports){
function belCreateElement(e,t,n){function a(e){if(Array.isArray(e))for(var t=0;t<e.length;t++){var n=e[t];if(Array.isArray(n))a(n);else{if(("number"==typeof n||"boolean"==typeof n||"function"==typeof n||n instanceof Date||n instanceof RegExp)&&(n=n.toString()),"string"==typeof n){if(o.lastChild&&"#text"===o.lastChild.nodeName){o.lastChild.nodeValue+=n;continue}n=document.createTextNode(n)}n&&n.nodeType&&o.appendChild(n)}}}var o;-1!==SVG_TAGS.indexOf(e)&&(t.namespace=SVGNS);var l=!1;if(t.namespace&&(l=t.namespace,delete t.namespace),l)o=document.createElementNS(l,e);else{if(e===COMMENT_TAG)return document.createComment(t.comment);o=document.createElement(e)}if(t.onload||t.onunload){var r=t.onload||function(){},i=t.onunload||function(){};onload(o,function(){r(o)},function(){i(o)},belCreateElement.caller.caller.caller),delete t.onload,delete t.onunload}for(var f in t)if(t.hasOwnProperty(f)){var c=f.toLowerCase(),s=t[f];if("classname"===c&&(c="class",f="class"),"htmlFor"===f&&(f="for"),BOOL_PROPS[c])if("true"===s)s=c;else if("false"===s)continue;"on"===c.slice(0,2)?o[f]=s:l?"xlink:href"===f?o.setAttributeNS(XLINKNS,f,s):/^xmlns($|:)/i.test(f)||o.setAttributeNS(null,f,s):o.setAttribute(f,s)}return a(n),o}var document=require("global/document"),hyperx=require("hyperx"),onload=require("on-load"),SVGNS="http://www.w3.org/2000/svg",XLINKNS="http://www.w3.org/1999/xlink",BOOL_PROPS={autofocus:1,checked:1,defaultchecked:1,disabled:1,formnovalidate:1,indeterminate:1,readonly:1,required:1,selected:1,willvalidate:1},COMMENT_TAG="!--",SVG_TAGS=["svg","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignObject","g","glyph","glyphRef","hkern","image","line","linearGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","set","stop","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"];module.exports=hyperx(belCreateElement,{comments:!0}),module.exports.default=module.exports,module.exports.createElement=belCreateElement;
},{"global/document":34,"hyperx":39,"on-load":48}],7:[function(require,module,exports){
(function (global){
function mapArrayBufferViews(r){for(var e=0;e<r.length;e++){var o=r[e];if(o.buffer instanceof ArrayBuffer){var t=o.buffer;if(o.byteLength!==t.byteLength){var l=new Uint8Array(o.byteLength);l.set(new Uint8Array(t,o.byteOffset,o.byteLength)),t=l.buffer}r[e]=t}}}function BlobBuilderConstructor(r,e){e=e||{};var o=new BlobBuilder;mapArrayBufferViews(r);for(var t=0;t<r.length;t++)o.append(r[t]);return e.type?o.getBlob(e.type):o.getBlob()}function BlobConstructor(r,e){return mapArrayBufferViews(r),new Blob(r,e||{})}var BlobBuilder=global.BlobBuilder||global.WebKitBlobBuilder||global.MSBlobBuilder||global.MozBlobBuilder,blobSupported=function(){try{return 2===new Blob(["hi"]).size}catch(r){return!1}}(),blobSupportsArrayBufferView=blobSupported&&function(){try{return 2===new Blob([new Uint8Array([1,2])]).size}catch(r){return!1}}(),blobBuilderSupported=BlobBuilder&&BlobBuilder.prototype.append&&BlobBuilder.prototype.getBlob;module.exports=function(){return blobSupported?blobSupportsArrayBufferView?global.Blob:BlobConstructor:blobBuilderSupported?BlobBuilderConstructor:void 0}();
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{}],8:[function(require,module,exports){
},{}],9:[function(require,module,exports){
function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}function runTimeout(e){if(cachedSetTimeout===setTimeout)return setTimeout(e,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(e,0);try{return cachedSetTimeout(e,0)}catch(t){try{return cachedSetTimeout.call(null,e,0)}catch(t){return cachedSetTimeout.call(this,e,0)}}}function runClearTimeout(e){if(cachedClearTimeout===clearTimeout)return clearTimeout(e);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(e);try{return cachedClearTimeout(e)}catch(t){try{return cachedClearTimeout.call(null,e)}catch(t){return cachedClearTimeout.call(this,e)}}}function cleanUpNextTick(){draining&¤tQueue&&(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var e=runTimeout(cleanUpNextTick);draining=!0;for(var t=queue.length;t;){for(currentQueue=queue,queue=[];++queueIndex<t;)currentQueue&¤tQueue[queueIndex].run();queueIndex=-1,t=queue.length}currentQueue=null,draining=!1,runClearTimeout(e)}}function Item(e,t){this.fun=e,this.array=t}function noop(){}var process=module.exports={},cachedSetTimeout,cachedClearTimeout;!function(){try{cachedSetTimeout="function"==typeof setTimeout?setTimeout:defaultSetTimout}catch(e){cachedSetTimeout=defaultSetTimout}try{cachedClearTimeout="function"==typeof clearTimeout?clearTimeout:defaultClearTimeout}catch(e){cachedClearTimeout=defaultClearTimeout}}();var queue=[],draining=!1,currentQueue,queueIndex=-1;process.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];queue.push(new Item(e,t)),1!==queue.length||draining||runTimeout(drainQueue)},Item.prototype.run=function(){this.fun.apply(null,this.array)},process.title="browser",process.browser=!0,process.env={},process.argv=[],process.version="",process.versions={},process.on=noop,process.addListener=noop,process.once=noop,process.off=noop,process.removeListener=noop,process.removeAllListeners=noop,process.emit=noop,process.prependListener=noop,process.prependOnceListener=noop,process.listeners=function(e){return[]},process.binding=function(e){throw new Error("process.binding is not supported")},process.cwd=function(){return"/"},process.chdir=function(e){throw new Error("process.chdir is not supported")},process.umask=function(){return 0};
},{}],10:[function(require,module,exports){
var slice=[].slice;module.exports=function(n,r){if("string"==typeof r&&(r=n[r]),"function"!=typeof r)throw new Error("bind() requires a function");var e=slice.call(arguments,2);return function(){return r.apply(n,e.concat(slice.call(arguments)))}};
},{}],11:[function(require,module,exports){
function Emitter(t){if(t)return mixin(t)}function mixin(t){for(var e in Emitter.prototype)t[e]=Emitter.prototype[e];return t}"undefined"!=typeof module&&(module.exports=Emitter),Emitter.prototype.on=Emitter.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},Emitter.prototype.once=function(t,e){function i(){this.off(t,i),e.apply(this,arguments)}return i.fn=e,this.on(t,i),this},Emitter.prototype.off=Emitter.prototype.removeListener=Emitter.prototype.removeAllListeners=Emitter.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var i=this._callbacks["$"+t];if(!i)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var r,s=0;s<i.length;s++)if((r=i[s])===e||r.fn===e){i.splice(s,1);break}return this},Emitter.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),i=this._callbacks["$"+t];if(i){i=i.slice(0);for(var r=0,s=i.length;r<s;++r)i[r].apply(this,e)}return this},Emitter.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},Emitter.prototype.hasListeners=function(t){return!!this.listeners(t).length};
},{}],12:[function(require,module,exports){
module.exports=function(o,t){var p=function(){};p.prototype=t.prototype,o.prototype=new p,o.prototype.constructor=o};
},{}],13:[function(require,module,exports){
!function(t){"use strict";var n=0,r=Math.pow(36,4),i=function(t,n){var r="000000000"+t;return r.substr(r.length-n)},e=function(){return i((Math.random()*r<<0).toString(36),4)},o=function(){return n=n<r?n:0,++n-1},u=function(){var t,n=(new Date).getTime().toString(36),r=u.fingerprint(),g=e()+e();return t=i(o().toString(36),4),"c"+n+t+r+g};u.slug=function(){var t,n=(new Date).getTime().toString(36),r=u.fingerprint().slice(0,1)+u.fingerprint().slice(-1),i=e().slice(-2);return t=o().toString(36).slice(-4),n.slice(-2)+t+r+i},u.globalCount=function(){var t=function(){var t,n=0;for(t in window)n++;return n}();return u.globalCount=function(){return t},t},u.fingerprint=function(){return i((navigator.mimeTypes.length+navigator.userAgent.length).toString(36)+u.globalCount().toString(36),4)},t.register?t.register("cuid",u):"undefined"!=typeof module?module.exports=u:t.cuid=u}(this.applitude||this);
},{}],14:[function(require,module,exports){
(function (process){
function useColors(){return!("undefined"==typeof window||!window||void 0===window.process||"renderer"!==window.process.type)||("undefined"!=typeof document&&document&&"WebkitAppearance"in document.documentElement.style||"undefined"!=typeof window&&window&&window.console&&(console.firebug||console.exception&&console.table)||"undefined"!=typeof navigator&&navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function formatArgs(e){var o=this.useColors;if(e[0]=(o?"%c":"")+this.namespace+(o?" %c":" ")+e[0]+(o?"%c ":" ")+"+"+exports.humanize(this.diff),o){var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var t=0,n=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(t++,"%c"===e&&(n=t))}),e.splice(n,0,r)}}function log(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function save(e){try{null==e?exports.storage.removeItem("debug"):exports.storage.debug=e}catch(e){}}function load(){var e;try{e=exports.storage.debug}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e}function localstorage(){try{return window.localStorage}catch(e){}}exports=module.exports=require("./debug"),exports.log=log,exports.formatArgs=formatArgs,exports.save=save,exports.load=load,exports.useColors=useColors,exports.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:localstorage(),exports.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],exports.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},exports.enable(load());
}).call(this,require('_process'))
},{"./debug":15,"_process":9}],15:[function(require,module,exports){
function selectColor(e){var r,t=0;for(r in e)t=(t<<5)-t+e.charCodeAt(r),t|=0;return exports.colors[Math.abs(t)%exports.colors.length]}function createDebug(e){function r(){if(r.enabled){var e=r,t=+new Date,o=t-(prevTime||t);e.diff=o,e.prev=prevTime,e.curr=t,prevTime=t;for(var s=new Array(arguments.length),n=0;n<s.length;n++)s[n]=arguments[n];s[0]=exports.coerce(s[0]),"string"!=typeof s[0]&&s.unshift("%O");var p=0;s[0]=s[0].replace(/%([a-zA-Z%])/g,function(r,t){if("%%"===r)return r;p++;var o=exports.formatters[t];if("function"==typeof o){var n=s[p];r=o.call(e,n),s.splice(p,1),p--}return r}),exports.formatArgs.call(e,s);(r.log||exports.log||console.log.bind(console)).apply(e,s)}}return r.namespace=e,r.enabled=exports.enabled(e),r.useColors=exports.useColors(),r.color=selectColor(e),"function"==typeof exports.init&&exports.init(r),r}function enable(e){exports.save(e),exports.names=[],exports.skips=[];for(var r=("string"==typeof e?e:"").split(/[\s,]+/),t=r.length,o=0;o<t;o++)r[o]&&(e=r[o].replace(/\*/g,".*?"),"-"===e[0]?exports.skips.push(new RegExp("^"+e.substr(1)+"$")):exports.names.push(new RegExp("^"+e+"$")))}function disable(){exports.enable("")}function enabled(e){var r,t;for(r=0,t=exports.skips.length;r<t;r++)if(exports.skips[r].test(e))return!1;for(r=0,t=exports.names.length;r<t;r++)if(exports.names[r].test(e))return!0;return!1}function coerce(e){return e instanceof Error?e.stack||e.message:e}exports=module.exports=createDebug.debug=createDebug.default=createDebug,exports.coerce=coerce,exports.disable=disable,exports.enable=enable,exports.enabled=enabled,exports.humanize=require("ms"),exports.names=[],exports.skips=[],exports.formatters={};var prevTime;
},{"ms":45}],16:[function(require,module,exports){
function dragDrop(e,r){function t(e){return r.onDragEnter&&r.onDragEnter(e),e.stopPropagation(),e.preventDefault(),!1}function n(t){if(t.stopPropagation(),t.preventDefault(),t.dataTransfer.items){var n=toArray(t.dataTransfer.items),a=n.filter(function(e){return"file"===e.kind}),o=n.filter(function(e){return"string"===e.kind});if(0===a.length&&!r.onDropText)return;if(0===o.length&&!r.onDrop)return;if(0===a.length&&0===o.length)return}return e.classList.add("drag"),clearTimeout(l),r.onDragOver&&r.onDragOver(t),t.dataTransfer.dropEffect="copy",!1}function a(e){return e.stopPropagation(),e.preventDefault(),r.onDragLeave&&r.onDragLeave(e),clearTimeout(l),l=setTimeout(i,50),!1}function o(e){e.stopPropagation(),e.preventDefault(),r.onDragLeave&&r.onDragLeave(e),clearTimeout(l),i();var t={x:e.clientX,y:e.clientY},n=e.dataTransfer.getData("text");if(n&&r.onDropText&&r.onDropText(n,t),e.dataTransfer.items){var a=toArray(e.dataTransfer.items).filter(function(e){return"file"===e.kind});if(0===a.length)return;parallel(a.map(function(e){return function(r){processEntry(e.webkitGetAsEntry(),r)}}),function(e,n){if(e)throw e;r.onDrop&&r.onDrop(flatten(n),t)})}else{var o=toArray(e.dataTransfer.files);if(0===o.length)return;o.forEach(function(e){e.fullPath="/"+e.name}),r.onDrop&&r.onDrop(o,t)}return!1}function i(){e.classList.remove("drag")}if("string"==typeof e){var f=e;if(!(e=window.document.querySelector(e)))throw new Error('"'+f+'" does not match any HTML elements')}if(!e)throw new Error('"'+e+'" is not a valid HTML element');"function"==typeof r&&(r={onDrop:r});var l;return e.addEventListener("dragenter",t,!1),e.addEventListener("dragover",n,!1),e.addEventListener("dragleave",a,!1),e.addEventListener("drop",o,!1),function(){i(),e.removeEventListener("dragenter",t,!1),e.removeEventListener("dragover",n,!1),e.removeEventListener("dragleave",a,!1),e.removeEventListener("drop",o,!1)}}function processEntry(e,r){function t(){o.readEntries(function(e){e.length>0?(a=a.concat(toArray(e)),t()):n()})}function n(){parallel(a.map(function(e){return function(r){processEntry(e,r)}}),r)}var a=[];if(e.isFile)e.file(function(t){t.fullPath=e.fullPath,r(null,t)},function(e){r(e)});else if(e.isDirectory){var o=e.createReader();t()}}function toArray(e){return Array.prototype.slice.call(e||[],0)}module.exports=dragDrop;var flatten=require("flatten"),parallel=require("run-parallel");
},{"flatten":32,"run-parallel":58}],17:[function(require,module,exports){
module.exports=require("./lib/index");
},{"./lib/index":18}],18:[function(require,module,exports){
module.exports=require("./socket"),module.exports.parser=require("engine.io-parser");
},{"./socket":19,"engine.io-parser":27}],19:[function(require,module,exports){
(function (global){
function Socket(e,t){if(!(this instanceof Socket))return new Socket(e,t);t=t||{},e&&"object"==typeof e&&(t=e,e=null),e?(e=parseuri(e),t.hostname=e.host,t.secure="https"===e.protocol||"wss"===e.protocol,t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=parseuri(t.host).host),this.secure=null!=t.secure?t.secure:global.location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.agent=t.agent||!1,this.hostname=t.hostname||(global.location?location.hostname:"localhost"),this.port=t.port||(global.location&&location.port?location.port:this.secure?443:80),this.query=t.query||{},"string"==typeof this.query&&(this.query=parseqs.decode(this.query)),this.upgrade=!1!==t.upgrade,this.path=(t.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!t.forceJSONP,this.jsonp=!1!==t.jsonp,this.forceBase64=!!t.forceBase64,this.enablesXDR=!!t.enablesXDR,this.timestampParam=t.timestampParam||"t",this.timestampRequests=t.timestampRequests,this.transports=t.transports||["polling","websocket"],this.transportOptions=t.transportOptions||{},this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.policyPort=t.policyPort||843,this.rememberUpgrade=t.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=t.onlyBinaryUpgrades,this.perMessageDeflate=!1!==t.perMessageDeflate&&(t.perMessageDeflate||{}),!0===this.perMessageDeflate&&(this.perMessageDeflate={}),this.perMessageDeflate&&null==this.perMessageDeflate.threshold&&(this.perMessageDeflate.threshold=1024),this.pfx=t.pfx||null,this.key=t.key||null,this.passphrase=t.passphrase||null,this.cert=t.cert||null,this.ca=t.ca||null,this.ciphers=t.ciphers||null,this.rejectUnauthorized=void 0===t.rejectUnauthorized||t.rejectUnauthorized,this.forceNode=!!t.forceNode;var r="object"==typeof global&&global;r.global===r&&(t.extraHeaders&&Object.keys(t.extraHeaders).length>0&&(this.extraHeaders=t.extraHeaders),t.localAddress&&(this.localAddress=t.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}function clone(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t}var transports=require("./transports/index"),Emitter=require("component-emitter"),debug=require("debug")("engine.io-client:socket"),index=require("indexof"),parser=require("engine.io-parser"),parseuri=require("parseuri"),parsejson=require("parsejson"),parseqs=require("parseqs");module.exports=Socket,Socket.priorWebsocketSuccess=!1,Emitter(Socket.prototype),Socket.protocol=parser.protocol,Socket.Socket=Socket,Socket.Transport=require("./transport"),Socket.transports=require("./transports/index"),Socket.parser=require("engine.io-parser"),Socket.prototype.createTransport=function(e){debug('creating transport "%s"',e);var t=clone(this.query);t.EIO=parser.protocol,t.transport=e;var r=this.transportOptions[e]||{};return this.id&&(t.sid=this.id),new transports[e]({query:t,socket:this,agent:r.agent||this.agent,hostname:r.hostname||this.hostname,port:r.port||this.port,secure:r.secure||this.secure,path:r.path||this.path,forceJSONP:r.forceJSONP||this.forceJSONP,jsonp:r.jsonp||this.jsonp,forceBase64:r.forceBase64||this.forceBase64,enablesXDR:r.enablesXDR||this.enablesXDR,timestampRequests:r.timestampRequests||this.timestampRequests,timestampParam:r.timestampParam||this.timestampParam,policyPort:r.policyPort||this.policyPort,pfx:r.pfx||this.pfx,key:r.key||this.key,passphrase:r.passphrase||this.passphrase,cert:r.cert||this.cert,ca:r.ca||this.ca,ciphers:r.ciphers||this.ciphers,rejectUnauthorized:r.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:r.perMessageDeflate||this.perMessageDeflate,extraHeaders:r.extraHeaders||this.extraHeaders,forceNode:r.forceNode||this.forceNode,localAddress:r.localAddress||this.localAddress,requestTimeout:r.requestTimeout||this.requestTimeout,protocols:r.protocols||void 0})},Socket.prototype.open=function(){var e;if(this.rememberUpgrade&&Socket.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))e="websocket";else{if(0===this.transports.length){var t=this;return void setTimeout(function(){t.emit("error","No transports available")},0)}e=this.transports[0]}this.readyState="opening";try{e=this.createTransport(e)}catch(e){return this.transports.shift(),void this.open()}e.open(),this.setTransport(e)},Socket.prototype.setTransport=function(e){debug("setting transport %s",e.name);var t=this;this.transport&&(debug("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=e,e.on("drain",function(){t.onDrain()}).on("packet",function(e){t.onPacket(e)}).on("error",function(e){t.onError(e)}).on("close",function(){t.onClose("transport close")})},Socket.prototype.probe=function(e){function t(){if(h.onlyBinaryUpgrades){var t=!this.supportsBinary&&h.transport.supportsBinary;c=c||t}c||(debug('probe transport "%s" opened',e),p.send([{type:"ping",data:"probe"}]),p.once("packet",function(t){if(!c)if("pong"===t.type&&"probe"===t.data){if(debug('probe transport "%s" pong',e),h.upgrading=!0,h.emit("upgrading",p),!p)return;Socket.priorWebsocketSuccess="websocket"===p.name,debug('pausing current transport "%s"',h.transport.name),h.transport.pause(function(){c||"closed"!==h.readyState&&(debug("changing transport and sending upgrade packet"),a(),h.setTransport(p),p.send([{type:"upgrade"}]),h.emit("upgrade",p),p=null,h.upgrading=!1,h.flush())})}else{debug('probe transport "%s" failed',e);var r=new Error("probe error");r.transport=p.name,h.emit("upgradeError",r)}}))}function r(){c||(c=!0,a(),p.close(),p=null)}function s(t){var s=new Error("probe error: "+t);s.transport=p.name,r(),debug('probe transport "%s" failed because of error: %s',e,t),h.emit("upgradeError",s)}function o(){s("transport closed")}function i(){s("socket closed")}function n(e){p&&e.name!==p.name&&(debug('"%s" works - aborting "%s"',e.name,p.name),r())}function a(){p.removeListener("open",t),p.removeListener("error",s),p.removeListener("close",o),h.removeListener("close",i),h.removeListener("upgrading",n)}debug('probing transport "%s"',e);var p=this.createTransport(e,{probe:1}),c=!1,h=this;Socket.priorWebsocketSuccess=!1,p.once("open",t),p.once("error",s),p.once("close",o),this.once("close",i),this.once("upgrading",n),p.open()},Socket.prototype.onOpen=function(){if(debug("socket open"),this.readyState="open",Socket.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause){debug("starting upgrade probes");for(var e=0,t=this.upgrades.length;e<t;e++)this.probe(this.upgrades[e])}},Socket.prototype.onPacket=function(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(debug('socket receive: type "%s", data "%s"',e.type,e.data),this.emit("packet",e),this.emit("heartbeat"),e.type){case"open":this.onHandshake(parsejson(e.data));break;case"pong":this.setPing(),this.emit("pong");break;case"error":var t=new Error("server error");t.code=e.data,this.onError(t);break;case"message":this.emit("data",e.data),this.emit("message",e.data)}else debug('packet received with socket readyState "%s"',this.readyState)},Socket.prototype.onHandshake=function(e){this.emit("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.onOpen(),"closed"!==this.readyState&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))},Socket.prototype.onHeartbeat=function(e){clearTimeout(this.pingTimeoutTimer);var t=this;t.pingTimeoutTimer=setTimeout(function(){"closed"!==t.readyState&&t.onClose("ping timeout")},e||t.pingInterval+t.pingTimeout)},Socket.prototype.setPing=function(){var e=this;clearTimeout(e.pingIntervalTimer),e.pingIntervalTimer=setTimeout(function(){debug("writing ping packet - expecting pong within %sms",e.pingTimeout),e.ping(),e.onHeartbeat(e.pingTimeout)},e.pingInterval)},Socket.prototype.ping=function(){var e=this;this.sendPacket("ping",function(){e.emit("ping")})},Socket.prototype.onDrain=function(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emit("drain"):this.flush()},Socket.prototype.flush=function(){"closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(debug("flushing %d packets in socket",this.writeBuffer.length),this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))},Socket.prototype.write=Socket.prototype.send=function(e,t,r){return this.sendPacket("message",e,t,r),this},Socket.prototype.sendPacket=function(e,t,r,s){if("function"==typeof t&&(s=t,t=void 0),"function"==typeof r&&(s=r,r=null),"closing"!==this.readyState&&"closed"!==this.readyState){r=r||{},r.compress=!1!==r.compress;var o={type:e,data:t,options:r};this.emit("packetCreate",o),this.writeBuffer.push(o),s&&this.once("flush",s),this.flush()}},Socket.prototype.close=function(){function e(){s.onClose("forced close"),debug("socket closing - telling transport to close"),s.transport.close()}function t(){s.removeListener("upgrade",t),s.removeListener("upgradeError",t),e()}function r(){s.once("upgrade",t),s.once("upgradeError",t)}if("opening"===this.readyState||"open"===this.readyState){this.readyState="closing";var s=this;this.writeBuffer.length?this.once("drain",function(){this.upgrading?r():e()}):this.upgrading?r():e()}return this},Socket.prototype.onError=function(e){debug("socket error %j",e),Socket.priorWebsocketSuccess=!1,this.emit("error",e),this.onClose("transport error",e)},Socket.prototype.onClose=function(e,t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){debug('socket close with reason: "%s"',e);var r=this;clearTimeout(this.pingIntervalTimer),clearTimeout(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),this.readyState="closed",this.id=null,this.emit("close",e,t),r.writeBuffer=[],r.prevBufferLen=0}},Socket.prototype.filterUpgrades=function(e){for(var t=[],r=0,s=e.length;r<s;r++)~index(this.transports,e[r])&&t.push(e[r]);return t};
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"./transport":20,"./transports/index":21,"component-emitter":11,"debug":14,"engine.io-parser":27,"indexof":40,"parsejson":49,"parseqs":50,"parseuri":51}],20:[function(require,module,exports){
function Transport(t){this.path=t.path,this.hostname=t.hostname,this.port=t.port,this.secure=t.secure,this.query=t.query,this.timestampParam=t.timestampParam,this.timestampRequests=t.timestampRequests,this.readyState="",this.agent=t.agent||!1,this.socket=t.socket,this.enablesXDR=t.enablesXDR,this.pfx=t.pfx,this.key=t.key,this.passphrase=t.passphrase,this.cert=t.cert,this.ca=t.ca,this.ciphers=t.ciphers,this.rejectUnauthorized=t.rejectUnauthorized,this.forceNode=t.forceNode,this.extraHeaders=t.extraHeaders,this.localAddress=t.localAddress}var parser=require("engine.io-parser"),Emitter=require("component-emitter");module.exports=Transport,Emitter(Transport.prototype),Transport.prototype.onError=function(t,e){var r=new Error(t);return r.type="TransportError",r.description=e,this.emit("error",r),this},Transport.prototype.open=function(){return"closed"!==this.readyState&&""!==this.readyState||(this.readyState="opening",this.doOpen()),this},Transport.prototype.close=function(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this},Transport.prototype.send=function(t){if("open"!==this.readyState)throw new Error("Transport not open");this.write(t)},Transport.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},Transport.prototype.onData=function(t){var e=parser.decodePacket(t,this.socket.binaryType);this.onPacket(e)},Transport.prototype.onPacket=function(t){this.emit("packet",t)},Transport.prototype.onClose=function(){this.readyState="closed",this.emit("close")};
},{"component-emitter":11,"engine.io-parser":27}],21:[function(require,module,exports){
(function (global){
function polling(e){var o=!1,t=!1,r=!1!==e.jsonp;if(global.location){var n="https:"===location.protocol,i=location.port;i||(i=n?443:80),o=e.hostname!==location.hostname||i!==e.port,t=e.secure!==n}if(e.xdomain=o,e.xscheme=t,"open"in new XMLHttpRequest(e)&&!e.forceJSONP)return new XHR(e);if(!r)throw new Error("JSONP disabled");return new JSONP(e)}var XMLHttpRequest=require("xmlhttprequest-ssl"),XHR=require("./polling-xhr"),JSONP=require("./polling-jsonp"),websocket=require("./websocket");exports.polling=polling,exports.websocket=websocket;
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"./polling-jsonp":22,"./polling-xhr":23,"./websocket":25,"xmlhttprequest-ssl":26}],22:[function(require,module,exports){
(function (global){
function empty(){}function JSONPPolling(e){Polling.call(this,e),this.query=this.query||{},callbacks||(global.___eio||(global.___eio=[]),callbacks=global.___eio),this.index=callbacks.length;var t=this;callbacks.push(function(e){t.onData(e)}),this.query.j=this.index,global.document&&global.addEventListener&&global.addEventListener("beforeunload",function(){t.script&&(t.script.onerror=empty)},!1)}var Polling=require("./polling"),inherit=require("component-inherit");module.exports=JSONPPolling;var rNewline=/\n/g,rEscapedNewline=/\\n/g,callbacks;inherit(JSONPPolling,Polling),JSONPPolling.prototype.supportsBinary=!1,JSONPPolling.prototype.doClose=function(){this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),this.form&&(this.form.parentNode.removeChild(this.form),this.form=null,this.iframe=null),Polling.prototype.doClose.call(this)},JSONPPolling.prototype.doPoll=function(){var e=this,t=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),t.async=!0,t.src=this.uri(),t.onerror=function(t){e.onError("jsonp poll error",t)};var i=document.getElementsByTagName("script")[0];i?i.parentNode.insertBefore(t,i):(document.head||document.body).appendChild(t),this.script=t,"undefined"!=typeof navigator&&/gecko/i.test(navigator.userAgent)&&setTimeout(function(){var e=document.createElement("iframe");document.body.appendChild(e),document.body.removeChild(e)},100)},JSONPPolling.prototype.doWrite=function(e,t){function i(){r(),t()}function r(){if(o.iframe)try{o.form.removeChild(o.iframe)}catch(e){o.onError("jsonp polling iframe removal error",e)}try{var e='<iframe src="javascript:0" name="'+o.iframeId+'">';n=document.createElement(e)}catch(e){n=document.createElement("iframe"),n.name=o.iframeId,n.src="javascript:0"}n.id=o.iframeId,o.form.appendChild(n),o.iframe=n}var o=this;if(!this.form){var n,a=document.createElement("form"),l=document.createElement("textarea"),s=this.iframeId="eio_iframe_"+this.index;a.className="socketio",a.style.position="absolute",a.style.top="-1000px",a.style.left="-1000px",a.target=s,a.method="POST",a.setAttribute("accept-charset","utf-8"),l.name="d",a.appendChild(l),document.body.appendChild(a),this.form=a,this.area=l}this.form.action=this.uri(),r(),e=e.replace(rEscapedNewline,"\\\n"),this.area.value=e.replace(rNewline,"\\n");try{this.form.submit()}catch(e){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"===o.iframe.readyState&&i()}:this.iframe.onload=i};
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"./polling":24,"component-inherit":12}],23:[function(require,module,exports){
(function (global){
function empty(){}function XHR(t){if(Polling.call(this,t),this.requestTimeout=t.requestTimeout,this.extraHeaders=t.extraHeaders,global.location){var e="https:"===location.protocol,s=location.port;s||(s=e?443:80),this.xd=t.hostname!==global.location.hostname||s!==t.port,this.xs=t.secure!==e}}function Request(t){this.method=t.method||"GET",this.uri=t.uri,this.xd=!!t.xd,this.xs=!!t.xs,this.async=!1!==t.async,this.data=void 0!==t.data?t.data:null,this.agent=t.agent,this.isBinary=t.isBinary,this.supportsBinary=t.supportsBinary,this.enablesXDR=t.enablesXDR,this.requestTimeout=t.requestTimeout,this.pfx=t.pfx,this.key=t.key,this.passphrase=t.passphrase,this.cert=t.cert,this.ca=t.ca,this.ciphers=t.ciphers,this.rejectUnauthorized=t.rejectUnauthorized,this.extraHeaders=t.extraHeaders,this.create()}function unloadHandler(){for(var t in Request.requests)Request.requests.hasOwnProperty(t)&&Request.requests[t].abort()}var XMLHttpRequest=require("xmlhttprequest-ssl"),Polling=require("./polling"),Emitter=require("component-emitter"),inherit=require("component-inherit"),debug=require("debug")("engine.io-client:polling-xhr");module.exports=XHR,module.exports.Request=Request,inherit(XHR,Polling),XHR.prototype.supportsBinary=!0,XHR.prototype.request=function(t){return t=t||{},t.uri=this.uri(),t.xd=this.xd,t.xs=this.xs,t.agent=this.agent||!1,t.supportsBinary=this.supportsBinary,t.enablesXDR=this.enablesXDR,t.pfx=this.pfx,t.key=this.key,t.passphrase=this.passphrase,t.cert=this.cert,t.ca=this.ca,t.ciphers=this.ciphers,t.rejectUnauthorized=this.rejectUnauthorized,t.requestTimeout=this.requestTimeout,t.extraHeaders=this.extraHeaders,new Request(t)},XHR.prototype.doWrite=function(t,e){var s="string"!=typeof t&&void 0!==t,r=this.request({method:"POST",data:t,isBinary:s}),i=this;r.on("success",e),r.on("error",function(t){i.onError("xhr post error",t)}),this.sendXhr=r},XHR.prototype.doPoll=function(){debug("xhr poll");var t=this.request(),e=this;t.on("data",function(t){e.onData(t)}),t.on("error",function(t){e.onError("xhr poll error",t)}),this.pollXhr=t},Emitter(Request.prototype),Request.prototype.create=function(){var t={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR};t.pfx=this.pfx,t.key=this.key,t.passphrase=this.passphrase,t.cert=this.cert,t.ca=this.ca,t.ciphers=this.ciphers,t.rejectUnauthorized=this.rejectUnauthorized;var e=this.xhr=new XMLHttpRequest(t),s=this;try{debug("xhr open %s: %s",this.method,this.uri),e.open(this.method,this.uri,this.async);try{if(this.extraHeaders){e.setDisableHeaderCheck&&e.setDisableHeaderCheck(!0);for(var r in this.extraHeaders)this.extraHeaders.hasOwnProperty(r)&&e.setRequestHeader(r,this.extraHeaders[r])}}catch(t){}if("POST"===this.method)try{this.isBinary?e.setRequestHeader("Content-type","application/octet-stream"):e.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(t){}try{e.setRequestHeader("Accept","*/*")}catch(t){}"withCredentials"in e&&(e.withCredentials=!0),this.requestTimeout&&(e.timeout=this.requestTimeout),this.hasXDR()?(e.onload=function(){s.onLoad()},e.onerror=function(){s.onError(e.responseText)}):e.onreadystatechange=function(){if(2===e.readyState){var t;try{t=e.getResponseHeader("Content-Type")}catch(t){}"application/octet-stream"===t&&(e.responseType="arraybuffer")}4===e.readyState&&(200===e.status||1223===e.status?s.onLoad():setTimeout(function(){s.onError(e.status)},0))},debug("xhr data %s",this.data),e.send(this.data)}catch(t){return void setTimeout(function(){s.onError(t)},0)}global.document&&(this.index=Request.requestsCount++,Request.requests[this.index]=this)},Request.prototype.onSuccess=function(){this.emit("success"),this.cleanup()},Request.prototype.onData=function(t){this.emit("data",t),this.onSuccess()},Request.prototype.onError=function(t){this.emit("error",t),this.cleanup(!0)},Request.prototype.cleanup=function(t){if(void 0!==this.xhr&&null!==this.xhr){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=empty:this.xhr.onreadystatechange=empty,t)try{this.xhr.abort()}catch(t){}global.document&&delete Request.requests[this.index],this.xhr=null}},Request.prototype.onLoad=function(){var t;try{var e;try{e=this.xhr.getResponseHeader("Content-Type")}catch(t){}t="application/octet-stream"===e?this.xhr.response||this.xhr.responseText:this.xhr.responseText}catch(t){this.onError(t)}null!=t&&this.onData(t)},Request.prototype.hasXDR=function(){return void 0!==global.XDomainRequest&&!this.xs&&this.enablesXDR},Request.prototype.abort=function(){this.cleanup()},Request.requestsCount=0,Request.requests={},global.document&&(global.attachEvent?global.attachEvent("onunload",unloadHandler):global.addEventListener&&global.addEventListener("beforeunload",unloadHandler,!1));
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"./polling":24,"component-emitter":11,"component-inherit":12,"debug":14,"xmlhttprequest-ssl":26}],24:[function(require,module,exports){
function Polling(t){var e=t&&t.forceBase64;hasXHR2&&!e||(this.supportsBinary=!1),Transport.call(this,t)}var Transport=require("../transport"),parseqs=require("parseqs"),parser=require("engine.io-parser"),inherit=require("component-inherit"),yeast=require("yeast"),debug=require("debug")("engine.io-client:polling");module.exports=Polling;var hasXHR2=function(){return null!=new(require("xmlhttprequest-ssl"))({xdomain:!1}).responseType}();inherit(Polling,Transport),Polling.prototype.name="polling",Polling.prototype.doOpen=function(){this.poll()},Polling.prototype.pause=function(t){function e(){debug("paused"),i.readyState="paused",t()}var i=this;if(this.readyState="pausing",this.polling||!this.writable){var o=0;this.polling&&(debug("we are currently polling - waiting to pause"),o++,this.once("pollComplete",function(){debug("pre-pause polling complete"),--o||e()})),this.writable||(debug("we are currently writing - waiting to pause"),o++,this.once("drain",function(){debug("pre-pause writing complete"),--o||e()}))}else e()},Polling.prototype.poll=function(){debug("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},Polling.prototype.onData=function(t){var e=this;debug("polling got data %s",t);var i=function(t,i,o){if("opening"===e.readyState&&e.onOpen(),"close"===t.type)return e.onClose(),!1;e.onPacket(t)};parser.decodePayload(t,this.socket.binaryType,i),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState?this.poll():debug('ignoring poll - transport state "%s"',this.readyState))},Polling.prototype.doClose=function(){function t(){debug("writing close packet"),e.write([{type:"close"}])}var e=this;"open"===this.readyState?(debug("transport open - closing"),t()):(debug("transport not open - deferring close"),this.once("open",t))},Polling.prototype.write=function(t){var e=this;this.writable=!1;var i=function(){e.writable=!0,e.emit("drain")};parser.encodePayload(t,this.supportsBinary,function(t){e.doWrite(t,i)})},Polling.prototype.uri=function(){var t=this.query||{},e=this.secure?"https":"http",i="";return!1!==this.timestampRequests&&(t[this.timestampParam]=yeast()),this.supportsBinary||t.sid||(t.b64=1),t=parseqs.encode(t),this.port&&("https"===e&&443!==Number(this.port)||"http"===e&&80!==Number(this.port))&&(i=":"+this.port),t.length&&(t="?"+t),e+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+i+this.path+t};
},{"../transport":20,"component-inherit":12,"debug":14,"engine.io-parser":27,"parseqs":50,"xmlhttprequest-ssl":26,"yeast":82}],25:[function(require,module,exports){
(function (global){
function WS(e){e&&e.forceBase64&&(this.supportsBinary=!1),this.perMessageDeflate=e.perMessageDeflate,this.usingBrowserWebSocket=BrowserWebSocket&&!e.forceNode,this.protocols=e.protocols,this.usingBrowserWebSocket||(WebSocket=NodeWebSocket),Transport.call(this,e)}var Transport=require("../transport"),parser=require("engine.io-parser"),parseqs=require("parseqs"),inherit=require("component-inherit"),yeast=require("yeast"),debug=require("debug")("engine.io-client:websocket"),BrowserWebSocket=global.WebSocket||global.MozWebSocket,NodeWebSocket;if("undefined"==typeof window)try{NodeWebSocket=require("ws")}catch(e){}var WebSocket=BrowserWebSocket;WebSocket||"undefined"!=typeof window||(WebSocket=NodeWebSocket),module.exports=WS,inherit(WS,Transport),WS.prototype.name="websocket",WS.prototype.supportsBinary=!0,WS.prototype.doOpen=function(){if(this.check()){var e=this.uri(),t=this.protocols,s={agent:this.agent,perMessageDeflate:this.perMessageDeflate};s.pfx=this.pfx,s.key=this.key,s.passphrase=this.passphrase,s.cert=this.cert,s.ca=this.ca,s.ciphers=this.ciphers,s.rejectUnauthorized=this.rejectUnauthorized,this.extraHeaders&&(s.headers=this.extraHeaders),this.localAddress&&(s.localAddress=this.localAddress);try{this.ws=this.usingBrowserWebSocket?t?new WebSocket(e,t):new WebSocket(e):new WebSocket(e,t,s)}catch(e){return this.emit("error",e)}void 0===this.ws.binaryType&&(this.supportsBinary=!1),this.ws.supports&&this.ws.supports.binary?(this.supportsBinary=!0,this.ws.binaryType="nodebuffer"):this.ws.binaryType="arraybuffer",this.addEventListeners()}},WS.prototype.addEventListeners=function(){var e=this;this.ws.onopen=function(){e.onOpen()},this.ws.onclose=function(){e.onClose()},this.ws.onmessage=function(t){e.onData(t.data)},this.ws.onerror=function(t){e.onError("websocket error",t)}},WS.prototype.write=function(e){function t(){s.emit("flush"),setTimeout(function(){s.writable=!0,s.emit("drain")},0)}var s=this;this.writable=!1;for(var o=e.length,r=0,i=o;r<i;r++)!function(e){parser.encodePacket(e,s.supportsBinary,function(r){if(!s.usingBrowserWebSocket){var i={};if(e.options&&(i.compress=e.options.compress),s.perMessageDeflate){("string"==typeof r?global.Buffer.byteLength(r):r.length)<s.perMessageDeflate.threshold&&(i.compress=!1)}}try{s.usingBrowserWebSocket?s.ws.send(r):s.ws.send(r,i)}catch(e){debug("websocket closed before onclo