diff --git a/browser/browser.js b/browser/browser.js index 60538a6..a34c0ba 100644 --- a/browser/browser.js +++ b/browser/browser.js @@ -1,8 +1,8 @@ -module.exports=function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=32)}([function(t,e){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";var n=r(6),i=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=f;var o=r(5);o.inherits=r(2);var s=r(23),a=r(14);o.inherits(f,s);for(var u=i(a.prototype),c=0;c * @license MIT */ -var n=r(38),i=r(39),o=r(40);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(s()=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|t}function d(t,e){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return N(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return H(t).length;default:if(n)return N(t).length;e=(""+e).toLowerCase(),n=!0}}function _(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function v(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:y(t,e,r,n,i);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):y(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function y(t,e,r,n,i){var o,s=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var l=-1;for(o=r;oa&&(r=a-u),o=r;o>=0;o--){for(var f=!0,h=0;hi&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function x(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function j(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:c>223?3:c>191?2:1;if(i+f<=r)switch(f){case 1:c<128&&(l=c);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&c)<<6|63&o)>127&&(l=u);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(u=(15&c)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(l=u)}null===l?(l=65533,f=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=f}return function(t){var e=t.length;if(e<=S)return String.fromCharCode.apply(String,t);for(var r="",n=0;nthis.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return T(this,e,r);case"utf8":case"utf-8":return j(this,e,r);case"ascii":return R(this,e,r);case"latin1":case"binary":return k(this,e,r);case"base64":return x(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),""},u.prototype.compare=function(t,e,r,n,i){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,i>>>=0,this===t)return 0;for(var o=i-n,s=r-e,a=Math.min(o,s),c=this.slice(n,i),l=t.slice(e,r),f=0;fi)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return m(this,t,e,r);case"utf8":case"utf-8":return g(this,t,e,r);case"ascii":return b(this,t,e,r);case"latin1":case"binary":return w(this,t,e,r);case"base64":return E(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var S=4096;function R(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;in)&&(r=n);for(var i="",o=e;or)throw new RangeError("Trying to access beyond buffer length")}function A(t,e,r,n,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function F(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i>>8*(n?i:1-i)}function L(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i>>8*(n?i:3-i)&255}function M(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function B(t,e,r,n,o){return o||M(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function D(t,e,r,n,o){return o||M(t,0,r,8),i.write(t,e,r,n,52,8),r+8}u.prototype.slice=function(t,e){var r,n=this.length;if(t=~~t,e=void 0===e?n:~~e,t<0?(t+=n)<0&&(t=0):t>n&&(t=n),e<0?(e+=n)<0&&(e=0):e>n&&(e=n),e0&&(i*=256);)n+=this[t+--e]*i;return n},u.prototype.readUInt8=function(t,e){return e||O(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return e||O(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return e||O(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,e){return e||O(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function(t,e){return e||O(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||O(t,e,this.length);for(var n=this[t],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||O(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return e||O(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){e||O(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){e||O(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return e||O(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return e||O(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return e||O(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return e||O(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return e||O(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return e||O(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,e,r,n){t=+t,e|=0,r|=0,n||A(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o=0&&(o*=256);)this[e+i]=t/o&255;return e+r},u.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||A(this,t,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||A(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):F(this,t,e,!0),e+2},u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||A(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):F(this,t,e,!1),e+2},u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||A(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):L(this,t,e,!0),e+4},u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||A(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):L(this,t,e,!1),e+4},u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);A(this,t,e,r,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o>0)-a&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);A(this,t,e,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||A(this,t,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||A(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):F(this,t,e,!0),e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||A(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):F(this,t,e,!1),e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||A(this,t,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):L(this,t,e,!0),e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||A(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):L(this,t,e,!1),e+4},u.prototype.writeFloatLE=function(t,e,r){return B(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return B(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return D(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return D(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--i)t[i+e]=this[i+r];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function H(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(I,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function V(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}}).call(this,r(0))},function(t,e){var r,n,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(r===setTimeout)return setTimeout(t,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(t){r=o}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(t){n=s}}();var u,c=[],l=!1,f=-1;function h(){l&&u&&(l=!1,u.length?c=u.concat(c):f=-1,c.length&&p())}function p(){if(!l){var t=a(h);l=!0;for(var e=c.length;e;){for(u=c,c=[];++f1)for(var r=1;r=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},r(35),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,r(0))},function(t,e){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function n(t){return"function"==typeof t}function i(t){return"object"==typeof t&&null!==t}function o(t){return void 0===t}t.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(t){if(!function(t){return"number"==typeof t}(t)||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},r.prototype.emit=function(t){var e,r,s,a,u,c;if(this._events||(this._events={}),"error"===t&&(!this._events.error||i(this._events.error)&&!this._events.error.length)){if((e=arguments[1])instanceof Error)throw e;var l=new Error('Uncaught, unspecified "error" event. ('+e+")");throw l.context=e,l}if(o(r=this._events[t]))return!1;if(n(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),r.apply(this,a)}else if(i(r))for(a=Array.prototype.slice.call(arguments,1),s=(c=r.slice()).length,u=0;u0&&this._events[t].length>s&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace()),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(t,e){if(!n(e))throw TypeError("listener must be a function");var r=!1;function i(){this.removeListener(t,i),r||(r=!0,e.apply(this,arguments))}return i.listener=e,this.on(t,i),this},r.prototype.removeListener=function(t,e){var r,o,s,a;if(!n(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(s=(r=this._events[t]).length,o=-1,r===e||n(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(i(r)){for(a=s;a-- >0;)if(r[a]===e||r[a].listener&&r[a].listener===e){o=a;break}if(o<0)return this;1===r.length?(r.length=0,delete this._events[t]):r.splice(o,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},r.prototype.removeAllListeners=function(t){var e,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(n(r=this._events[t]))this.removeListener(t,r);else if(r)for(;r.length;)this.removeListener(t,r[r.length-1]);return delete this._events[t],this},r.prototype.listeners=function(t){return this._events&&this._events[t]?n(this._events[t])?[this._events[t]]:this._events[t].slice():[]},r.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(n(e))return 1;if(e)return e.length}return 0},r.listenerCount=function(t,e){return t.listenerCount(e)}},function(t,e,r){(e=t.exports=r(23)).Stream=e,e.Readable=e,e.Writable=r(14),e.Duplex=r(1),e.Transform=r(27),e.PassThrough=r(45)},function(t,e,r){"use strict";(function(e,n,i){var o=r(6);function s(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var n=t.entry;for(t.entry=null;n;){var i=n.callback;e.pendingcb--,i(void 0),n=n.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}(e,t)}}t.exports=m;var a,u=!e.browser&&["v0.10","v0.9."].indexOf(e.version.slice(0,5))>-1?n:o.nextTick;m.WritableState=y;var c=r(5);c.inherits=r(2);var l,f={deprecate:r(44)},h=r(24),p=r(7).Buffer,d=i.Uint8Array||function(){},_=r(25);function v(){}function y(t,e){a=a||r(1),t=t||{};var n=e instanceof a;this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var i=t.highWaterMark,c=t.writableHighWaterMark,l=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(c||0===c)?c:l,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var f=!1===t.decodeStrings;this.decodeStrings=!f,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,n=r.sync,i=r.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,n,i){--e.pendingcb,r?(o.nextTick(i,n),o.nextTick(x,t,e),t._writableState.errorEmitted=!0,t.emit("error",n)):(i(n),t._writableState.errorEmitted=!0,t.emit("error",n),x(t,e))}(t,r,n,e,i);else{var s=E(r);s||r.corked||r.bufferProcessing||!r.bufferedRequest||w(t,r),n?u(b,t,r,s,i):b(t,r,s,i)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function m(t){if(a=a||r(1),!(l.call(m,this)||this instanceof a))return new m(t);this._writableState=new y(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),h.call(this)}function g(t,e,r,n,i,o,s){e.writelen=n,e.writecb=s,e.writing=!0,e.sync=!0,r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function b(t,e,r,n){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,n(),x(t,e)}function w(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var n=e.bufferedRequestCount,i=new Array(n),o=e.corkedRequestsFree;o.entry=r;for(var a=0,u=!0;r;)i[a]=r,r.isBuf||(u=!1),r=r.next,a+=1;i.allBuffers=u,g(t,e,!0,e.length,i,"",o.finish),e.pendingcb++,e.lastBufferedRequest=null,o.next?(e.corkedRequestsFree=o.next,o.next=null):e.corkedRequestsFree=new s(e),e.bufferedRequestCount=0}else{for(;r;){var c=r.chunk,l=r.encoding,f=r.callback;if(g(t,e,!1,e.objectMode?1:c.length,c,l,f),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function E(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function C(t,e){t._final(function(r){e.pendingcb--,r&&t.emit("error",r),e.prefinished=!0,t.emit("prefinish"),x(t,e)})}function x(t,e){var r=E(e);return r&&(function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,o.nextTick(C,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),r}c.inherits(m,h),y.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(y.prototype,"buffer",{get:f.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(l=Function.prototype[Symbol.hasInstance],Object.defineProperty(m,Symbol.hasInstance,{value:function(t){return!!l.call(this,t)||this===m&&t&&t._writableState instanceof y}})):l=function(t){return t instanceof this},m.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},m.prototype.write=function(t,e,r){var n=this._writableState,i=!1,s=!n.objectMode&&function(t){return p.isBuffer(t)||t instanceof d}(t);return s&&!p.isBuffer(t)&&(t=function(t){return p.from(t)}(t)),"function"==typeof e&&(r=e,e=null),s?e="buffer":e||(e=n.defaultEncoding),"function"!=typeof r&&(r=v),n.ended?function(t,e){var r=new Error("write after end");t.emit("error",r),o.nextTick(e,r)}(this,r):(s||function(t,e,r,n){var i=!0,s=!1;return null===r?s=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||e.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(t.emit("error",s),o.nextTick(n,s),i=!1),i}(this,n,t,r))&&(n.pendingcb++,i=function(t,e,r,n,i,o){if(!r){var s=function(t,e,r){return t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=p.from(e,r)),e}(e,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=e.objectMode?1:n.length;e.length+=a;var u=e.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(m.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),m.prototype._write=function(t,e,r){r(new Error("_write() is not implemented"))},m.prototype._writev=null,m.prototype.end=function(t,e,r){var n=this._writableState;"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!==t&&void 0!==t&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||function(t,e,r){e.ending=!0,x(t,e),r&&(e.finished?o.nextTick(r):t.once("finish",r)),e.ended=!0,t.writable=!1}(this,n,r)},Object.defineProperty(m.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),m.prototype.destroy=_.destroy,m.prototype._undestroy=_.undestroy,m.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,r(4),r(11).setImmediate,r(0))},function(t,e,r){(function(e,r,n){t.exports=function t(e,r,n){function i(s,a){if(!r[s]){if(!e[s]){var u="function"==typeof _dereq_&&_dereq_;if(!a&&u)return u(s,!0);if(o)return o(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var l=r[s]={exports:{}};e[s][0].call(l.exports,function(t){return i(e[s][1][t]||t)},l,l.exports,t,e,r,n)}return r[s].exports}for(var o="function"==typeof _dereq_&&_dereq_,s=0;s0;){var e=t.shift();if("function"==typeof e){var r=t.shift(),n=t.shift();e.call(r,n)}else e._settlePromises()}},u.prototype._drainQueues=function(){this._drainQueue(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,this._drainQueue(this._lateQueue)},u.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},u.prototype._reset=function(){this._isTickUsed=!1},r.exports=u,r.exports.firstLineError=i},{"./queue":26,"./schedule":29,"./util":36}],3:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){var i=!1,o=function(t,e){this._reject(e)},s=function(t,e){e.promiseRejectionQueued=!0,e.bindingPromise._then(o,o,null,this,t)},a=function(t,e){0==(50397184&this._bitField)&&this._resolveCallback(e.target)},u=function(t,e){e.promiseRejectionQueued||this._reject(t)};t.prototype.bind=function(o){i||(i=!0,t.prototype._propagateFrom=n.propagateFromFunction(),t.prototype._boundValue=n.boundValueFunction());var c=r(o),l=new t(e);l._propagateFrom(this,1);var f=this._target();if(l._setBoundTo(c),c instanceof t){var h={promiseRejectionQueued:!1,promise:l,target:f,bindingPromise:c};f._then(e,s,void 0,l,h),c._then(a,u,void 0,l,h),l._setOnCancel(c)}else l._resolveCallback(f);return l},t.prototype._setBoundTo=function(t){void 0!==t?(this._bitField=2097152|this._bitField,this._boundTo=t):this._bitField=-2097153&this._bitField},t.prototype._isBound=function(){return 2097152==(2097152&this._bitField)},t.bind=function(e,r){return t.resolve(r).bind(e)}}},{}],4:[function(t,e,r){"use strict";var n;"undefined"!=typeof Promise&&(n=Promise);var i=t("./promise")();i.noConflict=function(){try{Promise===i&&(Promise=n)}catch(t){}return i},e.exports=i},{"./promise":22}],5:[function(t,e,r){"use strict";var n=Object.create;if(n){var i=n(null),o=n(null);i[" size"]=o[" size"]=0}e.exports=function(e){var r=t("./util"),n=r.canEvaluate;function i(t){return function(t,n){var i;if(null!=t&&(i=t[n]),"function"!=typeof i){var o="Object "+r.classString(t)+" has no method '"+r.toString(n)+"'";throw new e.TypeError(o)}return i}(t,this.pop()).apply(t,this)}function o(t){return t[this]}function s(t){var e=+this;return e<0&&(e=Math.max(0,e+t.length)),t[e]}r.isIdentifier,e.prototype.call=function(t){var e=[].slice.call(arguments,1);return e.push(t),this._then(i,void 0,void 0,e,void 0)},e.prototype.get=function(t){var e;if("number"==typeof t)e=s;else if(n){var r=(void 0)(t);e=null!==r?r:o}else e=o;return this._then(e,void 0,void 0,t,void 0)}}},{"./util":36}],6:[function(t,e,r){"use strict";e.exports=function(e,r,n,i){var o=t("./util"),s=o.tryCatch,a=o.errorObj,u=e._async;e.prototype.break=e.prototype.cancel=function(){if(!i.cancellation())return this._warn("cancellation is disabled");for(var t=this,e=t;t._isCancellable();){if(!t._cancelBy(e)){e._isFollowing()?e._followee().cancel():e._cancelBranched();break}var r=t._cancellationParent;if(null==r||!r._isCancellable()){t._isFollowing()?t._followee().cancel():t._cancelBranched();break}t._isFollowing()&&t._followee().cancel(),t._setWillBeCancelled(),e=t,t=r}},e.prototype._branchHasCancelled=function(){this._branchesRemainingToCancel--},e.prototype._enoughBranchesHaveCancelled=function(){return void 0===this._branchesRemainingToCancel||this._branchesRemainingToCancel<=0},e.prototype._cancelBy=function(t){return t===this?(this._branchesRemainingToCancel=0,this._invokeOnCancel(),!0):(this._branchHasCancelled(),!!this._enoughBranchesHaveCancelled()&&(this._invokeOnCancel(),!0))},e.prototype._cancelBranched=function(){this._enoughBranchesHaveCancelled()&&this._cancel()},e.prototype._cancel=function(){this._isCancellable()&&(this._setCancelled(),u.invoke(this._cancelPromises,this,void 0))},e.prototype._cancelPromises=function(){this._length()>0&&this._settlePromises()},e.prototype._unsetOnCancel=function(){this._onCancelField=void 0},e.prototype._isCancellable=function(){return this.isPending()&&!this._isCancelled()},e.prototype.isCancellable=function(){return this.isPending()&&!this.isCancelled()},e.prototype._doInvokeOnCancel=function(t,e){if(o.isArray(t))for(var r=0;r=0)return r[t]}return t.prototype._promiseCreated=function(){},t.prototype._pushContext=function(){},t.prototype._popContext=function(){return null},t._peekContext=t.prototype._peekContext=function(){},n.prototype._pushContext=function(){void 0!==this._trace&&(this._trace._promiseCreated=null,r.push(this._trace))},n.prototype._popContext=function(){if(void 0!==this._trace){var t=r.pop(),e=t._promiseCreated;return t._promiseCreated=null,e}return null},n.CapturedTrace=null,n.create=function(){if(e)return new n},n.deactivateLongStackTraces=function(){},n.activateLongStackTraces=function(){var r=t.prototype._pushContext,o=t.prototype._popContext,s=t._peekContext,a=t.prototype._peekContext,u=t.prototype._promiseCreated;n.deactivateLongStackTraces=function(){t.prototype._pushContext=r,t.prototype._popContext=o,t._peekContext=s,t.prototype._peekContext=a,t.prototype._promiseCreated=u,e=!1},e=!0,t.prototype._pushContext=n.prototype._pushContext,t.prototype._popContext=n.prototype._popContext,t._peekContext=t.prototype._peekContext=i,t.prototype._promiseCreated=function(){var t=this._peekContext();t&&null==t._promiseCreated&&(t._promiseCreated=this)}},n}},{}],9:[function(t,r,n){"use strict";r.exports=function(r,n){var i,o,s,a=r._getDomain,u=r._async,c=t("./errors").Warning,l=t("./util"),f=l.canAttachTrace,h=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/,p=/\((?:timers\.js):\d+:\d+\)/,d=/[\/<\(](.+?):(\d+):(\d+)\)?\s*$/,_=null,v=null,y=!1,m=!(0==l.env("BLUEBIRD_DEBUG")),g=!(0==l.env("BLUEBIRD_WARNINGS")||!m&&!l.env("BLUEBIRD_WARNINGS")),b=!(0==l.env("BLUEBIRD_LONG_STACK_TRACES")||!m&&!l.env("BLUEBIRD_LONG_STACK_TRACES")),w=0!=l.env("BLUEBIRD_W_FORGOTTEN_RETURN")&&(g||!!l.env("BLUEBIRD_W_FORGOTTEN_RETURN"));r.prototype.suppressUnhandledRejections=function(){var t=this._target();t._bitField=-1048577&t._bitField|524288},r.prototype._ensurePossibleRejectionHandled=function(){if(0==(524288&this._bitField)){this._setRejectionIsUnhandled();var t=this;setTimeout(function(){t._notifyUnhandledRejection()},1)}},r.prototype._notifyUnhandledRejectionIsHandled=function(){q("rejectionHandled",i,void 0,this)},r.prototype._setReturnedNonUndefined=function(){this._bitField=268435456|this._bitField},r.prototype._returnedNonUndefined=function(){return 0!=(268435456&this._bitField)},r.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var t=this._settledValue();this._setUnhandledRejectionIsNotified(),q("unhandledRejection",o,t,this)}},r.prototype._setUnhandledRejectionIsNotified=function(){this._bitField=262144|this._bitField},r.prototype._unsetUnhandledRejectionIsNotified=function(){this._bitField=-262145&this._bitField},r.prototype._isUnhandledRejectionNotified=function(){return(262144&this._bitField)>0},r.prototype._setRejectionIsUnhandled=function(){this._bitField=1048576|this._bitField},r.prototype._unsetRejectionIsUnhandled=function(){this._bitField=-1048577&this._bitField,this._isUnhandledRejectionNotified()&&(this._unsetUnhandledRejectionIsNotified(),this._notifyUnhandledRejectionIsHandled())},r.prototype._isRejectionUnhandled=function(){return(1048576&this._bitField)>0},r.prototype._warn=function(t,e,r){return U(t,e,r||this)},r.onPossiblyUnhandledRejection=function(t){var e=a();o="function"==typeof t?null===e?t:l.domainBind(e,t):void 0},r.onUnhandledRejectionHandled=function(t){var e=a();i="function"==typeof t?null===e?t:l.domainBind(e,t):void 0};var E=function(){};r.longStackTraces=function(){if(u.haveItemsQueued()&&!J.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");if(!J.longStackTraces&&Y()){var t=r.prototype._captureStackTrace,e=r.prototype._attachExtraTrace;J.longStackTraces=!0,E=function(){if(u.haveItemsQueued()&&!J.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");r.prototype._captureStackTrace=t,r.prototype._attachExtraTrace=e,n.deactivateLongStackTraces(),u.enableTrampoline(),J.longStackTraces=!1},r.prototype._captureStackTrace=D,r.prototype._attachExtraTrace=I,n.activateLongStackTraces(),u.disableTrampolineIfNecessary()}},r.hasLongStackTraces=function(){return J.longStackTraces&&Y()};var C=function(){try{if("function"==typeof CustomEvent){var t=new CustomEvent("CustomEvent");return l.global.dispatchEvent(t),function(t,e){var r=new CustomEvent(t.toLowerCase(),{detail:e,cancelable:!0});return!l.global.dispatchEvent(r)}}return"function"==typeof Event?(t=new Event("CustomEvent"),l.global.dispatchEvent(t),function(t,e){var r=new Event(t.toLowerCase(),{cancelable:!0});return r.detail=e,!l.global.dispatchEvent(r)}):((t=document.createEvent("CustomEvent")).initCustomEvent("testingtheevent",!1,!0,{}),l.global.dispatchEvent(t),function(t,e){var r=document.createEvent("CustomEvent");return r.initCustomEvent(t.toLowerCase(),!1,!0,e),!l.global.dispatchEvent(r)})}catch(t){}return function(){return!1}}(),x=l.isNode?function(){return e.emit.apply(e,arguments)}:l.global?function(t){var e="on"+t.toLowerCase(),r=l.global[e];return!!r&&(r.apply(l.global,[].slice.call(arguments,1)),!0)}:function(){return!1};function j(t,e){return{promise:e}}var S={promiseCreated:j,promiseFulfilled:j,promiseRejected:j,promiseResolved:j,promiseCancelled:j,promiseChained:function(t,e,r){return{promise:e,child:r}},warning:function(t,e){return{warning:e}},unhandledRejection:function(t,e,r){return{reason:e,promise:r}},rejectionHandled:j},R=function(t){var e=!1;try{e=x.apply(null,arguments)}catch(t){u.throwLater(t),e=!0}var r=!1;try{r=C(t,S[t].apply(null,arguments))}catch(t){u.throwLater(t),r=!0}return r||e};function k(){return!1}function T(t,e,r){var n=this;try{t(e,r,function(t){if("function"!=typeof t)throw new TypeError("onCancel must be a function, got: "+l.toString(t));n._attachCancellationCallback(t)})}catch(t){return t}}function P(t){if(!this._isCancellable())return this;var e=this._onCancel();void 0!==e?l.isArray(e)?e.push(t):this._setOnCancel([e,t]):this._setOnCancel(t)}function O(){return this._onCancelField}function A(t){this._onCancelField=t}function F(){this._cancellationParent=void 0,this._onCancelField=void 0}function L(t,e){if(0!=(1&e)){this._cancellationParent=t;var r=t._branchesRemainingToCancel;void 0===r&&(r=0),t._branchesRemainingToCancel=r+1}0!=(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)}r.config=function(t){if("longStackTraces"in(t=Object(t))&&(t.longStackTraces?r.longStackTraces():!t.longStackTraces&&r.hasLongStackTraces()&&E()),"warnings"in t){var e=t.warnings;J.warnings=!!e,w=J.warnings,l.isObject(e)&&"wForgottenReturn"in e&&(w=!!e.wForgottenReturn)}if("cancellation"in t&&t.cancellation&&!J.cancellation){if(u.haveItemsQueued())throw new Error("cannot enable cancellation after promises are in use");r.prototype._clearCancellationData=F,r.prototype._propagateFrom=L,r.prototype._onCancel=O,r.prototype._setOnCancel=A,r.prototype._attachCancellationCallback=P,r.prototype._execute=T,M=L,J.cancellation=!0}return"monitoring"in t&&(t.monitoring&&!J.monitoring?(J.monitoring=!0,r.prototype._fireEvent=R):!t.monitoring&&J.monitoring&&(J.monitoring=!1,r.prototype._fireEvent=k)),r},r.prototype._fireEvent=k,r.prototype._execute=function(t,e,r){try{t(e,r)}catch(t){return t}},r.prototype._onCancel=function(){},r.prototype._setOnCancel=function(t){},r.prototype._attachCancellationCallback=function(t){},r.prototype._captureStackTrace=function(){},r.prototype._attachExtraTrace=function(){},r.prototype._clearCancellationData=function(){},r.prototype._propagateFrom=function(t,e){};var M=function(t,e){0!=(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)};function B(){var t=this._boundTo;return void 0!==t&&t instanceof r?t.isFulfilled()?t.value():void 0:t}function D(){this._trace=new X(this._peekContext())}function I(t,e){if(f(t)){var r=this._trace;if(void 0!==r&&e&&(r=r._parent),void 0!==r)r.attachExtraTrace(t);else if(!t.__stackCleaned__){var n=H(t);l.notEnumerableProp(t,"stack",n.message+"\n"+n.stack.join("\n")),l.notEnumerableProp(t,"__stackCleaned__",!0)}}}function U(t,e,n){if(J.warnings){var i,o=new c(t);if(e)n._attachExtraTrace(o);else if(J.longStackTraces&&(i=r._peekContext()))i.attachExtraTrace(o);else{var s=H(o);o.stack=s.message+"\n"+s.stack.join("\n")}R("warning",o)||V(o,"",!0)}}function N(t){for(var e=[],r=0;r0?function(t){for(var e=t.stack.replace(/\s+$/g,"").split("\n"),r=0;r0&&"SyntaxError"!=t.name&&(e=e.slice(r)),e}(t):[" (No stack trace)"],{message:r,stack:"SyntaxError"==t.name?e:N(e)}}function V(t,e,r){if("undefined"!=typeof console){var n;if(l.isObject(t)){var i=t.stack;n=e+v(i,t)}else n=e+String(t);"function"==typeof s?s(n,r):"function"!=typeof console.log&&"object"!=typeof console.log||console.log(n)}}function q(t,e,r,n){var i=!1;try{"function"==typeof e&&(i=!0,"rejectionHandled"===t?e(n):e(r,n))}catch(t){u.throwLater(t)}"unhandledRejection"===t?R(t,r,n)||i||V(r,"Unhandled rejection "):R(t,n)}function W(t){var e;if("function"==typeof t)e="[function "+(t.name||"anonymous")+"]";else{if(e=t&&"function"==typeof t.toString?t.toString():l.toString(t),/\[object [a-zA-Z0-9$_]+\]/.test(e))try{e=JSON.stringify(t)}catch(t){}0===e.length&&(e="(empty array)")}return"(<"+function(t){return t.length<41?t:t.substr(0,38)+"..."}(e)+">, no stack trace)"}function Y(){return"function"==typeof G}var $=function(){return!1},z=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;function Q(t){var e=t.match(z);if(e)return{fileName:e[1],line:parseInt(e[2],10)}}function X(t){this._parent=t,this._promisesCreated=0;var e=this._length=1+(void 0===t?0:t._length);G(this,X),e>32&&this.uncycle()}l.inherits(X,Error),n.CapturedTrace=X,X.prototype.uncycle=function(){var t=this._length;if(!(t<2)){for(var e=[],r={},n=0,i=this;void 0!==i;++n)e.push(i),i=i._parent;for(n=(t=this._length=n)-1;n>=0;--n){var o=e[n].stack;void 0===r[o]&&(r[o]=n)}for(n=0;n0&&(e[s-1]._parent=void 0,e[s-1]._length=1),e[n]._parent=void 0,e[n]._length=1;var a=n>0?e[n-1]:this;s=0;--c)e[c]._length=u,u++;return}}}},X.prototype.attachExtraTrace=function(t){if(!t.__stackCleaned__){this.uncycle();for(var e=H(t),r=e.message,n=[e.stack],i=this;void 0!==i;)n.push(N(i.stack.split("\n"))),i=i._parent;!function(t){for(var e=t[0],r=1;r=0;--a)if(n[a]===o){s=a;break}for(a=s;a>=0;--a){var u=n[a];if(e[i]!==u)break;e.pop(),i--}e=n}}(n),function(t){for(var e=0;e=0)return _=/@/,v=e,y=!0,function(t){t.stack=(new Error).stack};try{throw new Error}catch(t){n="stack"in t}return"stack"in i||!n||"number"!=typeof Error.stackTraceLimit?(v=function(t,e){return"string"==typeof t?t:"object"!=typeof e&&"function"!=typeof e||void 0===e.name||void 0===e.message?W(e):e.toString()},null):(_=t,v=e,function(t){Error.stackTraceLimit+=6;try{throw new Error}catch(e){t.stack=e.stack}Error.stackTraceLimit-=6})}();"undefined"!=typeof console&&void 0!==console.warn&&(s=function(t){console.warn(t)},l.isNode&&e.stderr.isTTY?s=function(t,e){var r=e?"":"";console.warn(r+t+"\n")}:l.isNode||"string"!=typeof(new Error).stack||(s=function(t,e){console.warn("%c"+t,e?"color: darkorange":"color: red")}));var J={warnings:g,longStackTraces:!1,cancellation:!1,monitoring:!1};return b&&r.longStackTraces(),{longStackTraces:function(){return J.longStackTraces},warnings:function(){return J.warnings},cancellation:function(){return J.cancellation},monitoring:function(){return J.monitoring},propagateFromFunction:function(){return M},boundValueFunction:function(){return B},checkForgottenReturns:function(t,e,r,n,i){if(void 0===t&&null!==e&&w){if(void 0!==i&&i._returnedNonUndefined())return;if(0==(65535&n._bitField))return;r&&(r+=" ");var o="",s="";if(e._trace){for(var a=e._trace.stack.split("\n"),u=N(a),c=u.length-1;c>=0;--c){var l=u[c];if(!p.test(l)){var f=l.match(d);f&&(o="at "+f[1]+":"+f[2]+":"+f[3]+" ");break}}if(u.length>0){var h=u[0];for(c=0;c0&&(s="\n"+a[c-1]);break}}}var _="a promise was created in a "+r+"handler "+o+"but was not returned from it, see http://goo.gl/rRqMUw"+s;n._warn(_,!0,e)}},setBounds:function(t,e){if(Y()){for(var r,n,i=t.stack.split("\n"),o=e.stack.split("\n"),s=-1,a=-1,u=0;u=a||($=function(t){if(h.test(t))return!0;var e=Q(t);return!!(e&&e.fileName===r&&s<=e.line&&e.line<=a)})}},warn:U,deprecated:function(t,e){var r=t+" is deprecated and will be removed in a future version.";return e&&(r+=" Use "+e+" instead."),U(r)},CapturedTrace:X,fireDomEvent:C,fireGlobalEvent:x}}},{"./errors":12,"./util":36}],10:[function(t,e,r){"use strict";e.exports=function(t){function e(){return this.value}function r(){throw this.reason}t.prototype.return=t.prototype.thenReturn=function(r){return r instanceof t&&r.suppressUnhandledRejections(),this._then(e,void 0,void 0,{value:r},void 0)},t.prototype.throw=t.prototype.thenThrow=function(t){return this._then(r,void 0,void 0,{reason:t},void 0)},t.prototype.catchThrow=function(t){if(arguments.length<=1)return this._then(void 0,r,void 0,{reason:t},void 0);var e=arguments[1];return this.caught(t,function(){throw e})},t.prototype.catchReturn=function(r){if(arguments.length<=1)return r instanceof t&&r.suppressUnhandledRejections(),this._then(void 0,e,void 0,{value:r},void 0);var n=arguments[1];return n instanceof t&&n.suppressUnhandledRejections(),this.caught(r,function(){return n})}}},{}],11:[function(t,e,r){"use strict";e.exports=function(t,e){var r=t.reduce,n=t.all;function i(){return n(this)}t.prototype.each=function(t){return r(this,t,e,0)._then(i,void 0,void 0,this,void 0)},t.prototype.mapSeries=function(t){return r(this,t,e,e)},t.each=function(t,n){return r(t,n,e,0)._then(i,void 0,void 0,t,void 0)},t.mapSeries=function(t,n){return r(t,n,e,e)}}},{}],12:[function(t,e,r){"use strict";var n,i,o=t("./es5"),s=o.freeze,a=t("./util"),u=a.inherits,c=a.notEnumerableProp;function l(t,e){function r(n){if(!(this instanceof r))return new r(n);c(this,"message","string"==typeof n?n:e),c(this,"name",t),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):Error.call(this)}return u(r,Error),r}var f=l("Warning","warning"),h=l("CancellationError","cancellation error"),p=l("TimeoutError","timeout error"),d=l("AggregateError","aggregate error");try{n=TypeError,i=RangeError}catch(t){n=l("TypeError","type error"),i=l("RangeError","range error")}for(var _="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),v=0;v<_.length;++v)"function"==typeof Array.prototype[_[v]]&&(d.prototype[_[v]]=Array.prototype[_[v]]);o.defineProperty(d.prototype,"length",{value:0,configurable:!1,writable:!0,enumerable:!0}),d.prototype.isOperational=!0;var y=0;function m(t){if(!(this instanceof m))return new m(t);c(this,"name","OperationalError"),c(this,"message",t),this.cause=t,this.isOperational=!0,t instanceof Error?(c(this,"message",t.message),c(this,"stack",t.stack)):Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}d.prototype.toString=function(){var t=Array(4*y+1).join(" "),e="\n"+t+"AggregateError of:\n";y++,t=Array(4*y+1).join(" ");for(var r=0;r1?t.cancelPromise._reject(e):t.cancelPromise._cancel(),t.cancelPromise=null,!0)}function f(){return p.call(this,this.promise._target()._settledValue())}function h(t){if(!l(this,t))return s.e=t,s}function p(t){var i=this.promise,a=this.handler;if(!this.called){this.called=!0;var u=this.isFinallyHandler()?a.call(i._boundValue()):a.call(i._boundValue(),t);if(u===n)return u;if(void 0!==u){i._setReturnedNonUndefined();var p=r(u,i);if(p instanceof e){if(null!=this.cancelPromise){if(p._isCancelled()){var d=new o("late cancellation observer");return i._attachExtraTrace(d),s.e=d,s}p.isPending()&&p._attachCancellationCallback(new c(this))}return p._then(f,h,void 0,this,void 0)}}}return i.isRejected()?(l(this),s.e=t,s):(l(this),t)}return u.prototype.isFinallyHandler=function(){return 0===this.type},c.prototype._resultCancelled=function(){l(this.finallyHandler)},e.prototype._passThrough=function(t,e,r,n){return"function"!=typeof t?this.then():this._then(r,n,void 0,new u(this,e,t),void 0)},e.prototype.lastly=e.prototype.finally=function(t){return this._passThrough(t,0,p,p)},e.prototype.tap=function(t){return this._passThrough(t,1,p)},e.prototype.tapCatch=function(t){var r=arguments.length;if(1===r)return this._passThrough(t,1,void 0,p);var n,o=new Array(r-1),s=0;for(n=0;n0&&"function"==typeof arguments[e]&&(t=arguments[e]);var n=[].slice.call(arguments);t&&n.pop();var i=new r(n).promise();return void 0!==t?i.spread(t):i}}},{"./util":36}],18:[function(t,e,r){"use strict";e.exports=function(e,r,n,i,o,s){var a=e._getDomain,u=t("./util"),c=u.tryCatch,l=u.errorObj,f=e._async;function h(t,e,r,n){this.constructor$(t),this._promise._captureStackTrace();var i=a();this._callback=null===i?e:u.domainBind(i,e),this._preservedValues=n===o?new Array(this.length()):null,this._limit=r,this._inFlight=0,this._queue=[],f.invoke(this._asyncInit,this,void 0)}function p(t,r,i,o){if("function"!=typeof r)return n("expecting a function but got "+u.classString(r));var s=0;if(void 0!==i){if("object"!=typeof i||null===i)return e.reject(new TypeError("options argument must be an object but it is "+u.classString(i)));if("number"!=typeof i.concurrency)return e.reject(new TypeError("'concurrency' must be a number but it is "+u.classString(i.concurrency)));s=i.concurrency}return new h(t,r,s="number"==typeof s&&isFinite(s)&&s>=1?s:0,o).promise()}u.inherits(h,r),h.prototype._asyncInit=function(){this._init$(void 0,-2)},h.prototype._init=function(){},h.prototype._promiseFulfilled=function(t,r){var n=this._values,o=this.length(),a=this._preservedValues,u=this._limit;if(r<0){if(n[r=-1*r-1]=t,u>=1&&(this._inFlight--,this._drainQueue(),this._isResolved()))return!0}else{if(u>=1&&this._inFlight>=u)return n[r]=t,this._queue.push(r),!1;null!==a&&(a[r]=t);var f=this._promise,h=this._callback,p=f._boundValue();f._pushContext();var d=c(h).call(p,t,r,o),_=f._popContext();if(s.checkForgottenReturns(d,_,null!==a?"Promise.filter":"Promise.map",f),d===l)return this._reject(d.e),!0;var v=i(d,this._promise);if(v instanceof e){var y=(v=v._target())._bitField;if(0==(50397184&y))return u>=1&&this._inFlight++,n[r]=v,v._proxy(this,-1*(r+1)),!1;if(0==(33554432&y))return 0!=(16777216&y)?(this._reject(v._reason()),!0):(this._cancel(),!0);d=v._value()}n[r]=d}return++this._totalResolved>=o&&(null!==a?this._filter(n,a):this._resolve(n),!0)},h.prototype._drainQueue=function(){for(var t=this._queue,e=this._limit,r=this._values;t.length>0&&this._inFlight1){o.deprecated("calling Promise.try with more than 1 argument");var c=arguments[1],l=arguments[2];n=s.isArray(c)?a(t).apply(l,c):a(t).call(l,c)}else n=a(t)();var f=u._popContext();return o.checkForgottenReturns(n,f,"Promise.try",u),u._resolveFromSyncValue(n),u},e.prototype._resolveFromSyncValue=function(t){t===s.errorObj?this._rejectCallback(t.e,!1):this._resolveCallback(t,!0)}}},{"./util":36}],20:[function(t,e,r){"use strict";var n=t("./util"),i=n.maybeWrapAsError,o=t("./errors").OperationalError,s=t("./es5"),a=/^(?:name|message|stack|cause)$/;function u(t){var e;if(function(t){return t instanceof Error&&s.getPrototypeOf(t)===Error.prototype}(t)){(e=new o(t)).name=t.name,e.message=t.message,e.stack=t.stack;for(var r=s.keys(t),i=0;i1){var r,n=new Array(e-1),i=0;for(r=0;r0&&"function"!=typeof t&&"function"!=typeof e){var r=".then() only accepts functions but was passed: "+c.classString(t);arguments.length>1&&(r+=", "+c.classString(e)),this._warn(r)}return this._then(t,e,void 0,void 0,void 0)},T.prototype.done=function(t,e){this._then(t,e,void 0,void 0,void 0)._setIsFinal()},T.prototype.spread=function(t){return"function"!=typeof t?o("expecting a function but got "+c.classString(t)):this.all()._then(t,void 0,void 0,y,void 0)},T.prototype.toJSON=function(){var t={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(t.fulfillmentValue=this.value(),t.isFulfilled=!0):this.isRejected()&&(t.rejectionReason=this.reason(),t.isRejected=!0),t},T.prototype.all=function(){return arguments.length>0&&this._warn(".all() was passed arguments but it does not take any"),new b(this).promise()},T.prototype.error=function(t){return this.caught(c.originatesFromRejection,t)},T.getNewLibraryCopy=r.exports,T.is=function(t){return t instanceof T},T.fromNode=T.fromCallback=function(t){var e=new T(v);e._captureStackTrace();var r=arguments.length>1&&!!Object(arguments[1]).multiArgs,n=k(t)(S(e,r));return n===R&&e._rejectCallback(n.e,!0),e._isFateSealed()||e._setAsyncGuaranteed(),e},T.all=function(t){return new b(t).promise()},T.cast=function(t){var e=g(t);return e instanceof T||((e=new T(v))._captureStackTrace(),e._setFulfilled(),e._rejectionHandler0=t),e},T.resolve=T.fulfilled=T.cast,T.reject=T.rejected=function(t){var e=new T(v);return e._captureStackTrace(),e._rejectCallback(t,!0),e},T.setScheduler=function(t){if("function"!=typeof t)throw new d("expecting a function but got "+c.classString(t));return h.setScheduler(t)},T.prototype._then=function(t,e,r,n,i){var o=void 0!==i,s=o?i:new T(v),u=this._target(),l=u._bitField;o||(s._propagateFrom(this,3),s._captureStackTrace(),void 0===n&&0!=(2097152&this._bitField)&&(n=0!=(50397184&l)?this._boundValue():u===this?void 0:this._boundTo),this._fireEvent("promiseChained",this,s));var f=a();if(0!=(50397184&l)){var p,d,y=u._settlePromiseCtx;0!=(33554432&l)?(d=u._rejectionHandler0,p=t):0!=(16777216&l)?(d=u._fulfillmentHandler0,p=e,u._unsetRejectionIsUnhandled()):(y=u._settlePromiseLateCancellationObserver,d=new _("late cancellation observer"),u._attachExtraTrace(d),p=e),h.invoke(y,u,{handler:null===f?p:"function"==typeof p&&c.domainBind(f,p),promise:s,receiver:n,value:d})}else u._addCallbacks(t,e,s,n,f);return s},T.prototype._length=function(){return 65535&this._bitField},T.prototype._isFateSealed=function(){return 0!=(117506048&this._bitField)},T.prototype._isFollowing=function(){return 67108864==(67108864&this._bitField)},T.prototype._setLength=function(t){this._bitField=-65536&this._bitField|65535&t},T.prototype._setFulfilled=function(){this._bitField=33554432|this._bitField,this._fireEvent("promiseFulfilled",this)},T.prototype._setRejected=function(){this._bitField=16777216|this._bitField,this._fireEvent("promiseRejected",this)},T.prototype._setFollowing=function(){this._bitField=67108864|this._bitField,this._fireEvent("promiseResolved",this)},T.prototype._setIsFinal=function(){this._bitField=4194304|this._bitField},T.prototype._isFinal=function(){return(4194304&this._bitField)>0},T.prototype._unsetCancelled=function(){this._bitField=-65537&this._bitField},T.prototype._setCancelled=function(){this._bitField=65536|this._bitField,this._fireEvent("promiseCancelled",this)},T.prototype._setWillBeCancelled=function(){this._bitField=8388608|this._bitField},T.prototype._setAsyncGuaranteed=function(){h.hasCustomScheduler()||(this._bitField=134217728|this._bitField)},T.prototype._receiverAt=function(t){var e=0===t?this._receiver0:this[4*t-4+3];if(e!==u)return void 0===e&&this._isBound()?this._boundValue():e},T.prototype._promiseAt=function(t){return this[4*t-4+2]},T.prototype._fulfillmentHandlerAt=function(t){return this[4*t-4+0]},T.prototype._rejectionHandlerAt=function(t){return this[4*t-4+1]},T.prototype._boundValue=function(){},T.prototype._migrateCallback0=function(t){t._bitField;var e=t._fulfillmentHandler0,r=t._rejectionHandler0,n=t._promise0,i=t._receiverAt(0);void 0===i&&(i=u),this._addCallbacks(e,r,n,i,null)},T.prototype._migrateCallbackAt=function(t,e){var r=t._fulfillmentHandlerAt(e),n=t._rejectionHandlerAt(e),i=t._promiseAt(e),o=t._receiverAt(e);void 0===o&&(o=u),this._addCallbacks(r,n,i,o,null)},T.prototype._addCallbacks=function(t,e,r,n,i){var o=this._length();if(o>=65531&&(o=0,this._setLength(0)),0===o)this._promise0=r,this._receiver0=n,"function"==typeof t&&(this._fulfillmentHandler0=null===i?t:c.domainBind(i,t)),"function"==typeof e&&(this._rejectionHandler0=null===i?e:c.domainBind(i,e));else{var s=4*o-4;this[s+2]=r,this[s+3]=n,"function"==typeof t&&(this[s+0]=null===i?t:c.domainBind(i,t)),"function"==typeof e&&(this[s+1]=null===i?e:c.domainBind(i,e))}return this._setLength(o+1),o},T.prototype._proxy=function(t,e){this._addCallbacks(void 0,void 0,e,t,null)},T.prototype._resolveCallback=function(t,e){if(0==(117506048&this._bitField)){if(t===this)return this._rejectCallback(n(),!1);var r=g(t,this);if(!(r instanceof T))return this._fulfill(t);e&&this._propagateFrom(r,2);var i=r._target();if(i!==this){var o=i._bitField;if(0==(50397184&o)){var s=this._length();s>0&&i._migrateCallback0(this);for(var a=1;a>>16)){if(t===this){var r=n();return this._attachExtraTrace(r),this._reject(r)}this._setFulfilled(),this._rejectionHandler0=t,(65535&e)>0&&(0!=(134217728&e)?this._settlePromises():h.settlePromises(this))}},T.prototype._reject=function(t){var e=this._bitField;if(!((117506048&e)>>>16)){if(this._setRejected(),this._fulfillmentHandler0=t,this._isFinal())return h.fatalError(t,c.isNode);(65535&e)>0?h.settlePromises(this):this._ensurePossibleRejectionHandled()}},T.prototype._fulfillPromises=function(t,e){for(var r=1;r0){if(0!=(16842752&t)){var r=this._fulfillmentHandler0;this._settlePromise0(this._rejectionHandler0,r,t),this._rejectPromises(e,r)}else{var n=this._rejectionHandler0;this._settlePromise0(this._fulfillmentHandler0,n,t),this._fulfillPromises(e,n)}this._setLength(0)}this._clearCancellationData()},T.prototype._settledValue=function(){var t=this._bitField;return 0!=(33554432&t)?this._rejectionHandler0:0!=(16777216&t)?this._fulfillmentHandler0:void 0},T.defer=T.pending=function(){return C.deprecated("Promise.defer","new Promise"),{promise:new T(v),resolve:P,reject:O}},c.notEnumerableProp(T,"_makeSelfResolutionError",n),t("./method")(T,v,g,o,C),t("./bind")(T,v,g,C),t("./cancel")(T,b,o,C),t("./direct_resolve")(T),t("./synchronous_inspection")(T),t("./join")(T,b,g,v,h,a),T.Promise=T,T.version="3.5.1",t("./map.js")(T,b,o,g,v,C),t("./call_get.js")(T),t("./using.js")(T,o,g,E,v,C),t("./timers.js")(T,v,C),t("./generators.js")(T,o,v,g,s,C),t("./nodeify.js")(T),t("./promisify.js")(T,v),t("./props.js")(T,b,g,o),t("./race.js")(T,v,g,o),t("./reduce.js")(T,b,o,g,v,C),t("./settle.js")(T,b,C),t("./some.js")(T,b,o),t("./filter.js")(T,v),t("./each.js")(T,v),t("./any.js")(T),c.toFastProperties(T),c.toFastProperties(T.prototype),A({a:1}),A({b:2}),A({c:3}),A(1),A(function(){}),A(void 0),A(!1),A(new T(v)),C.setBounds(f.firstLineError,c.lastLineError),T}},{"./any.js":1,"./async":2,"./bind":3,"./call_get.js":5,"./cancel":6,"./catch_filter":7,"./context":8,"./debuggability":9,"./direct_resolve":10,"./each.js":11,"./errors":12,"./es5":13,"./filter.js":14,"./finally":15,"./generators.js":16,"./join":17,"./map.js":18,"./method":19,"./nodeback":20,"./nodeify.js":21,"./promise_array":23,"./promisify.js":24,"./props.js":25,"./race.js":27,"./reduce.js":28,"./settle.js":30,"./some.js":31,"./synchronous_inspection":32,"./thenables":33,"./timers.js":34,"./using.js":35,"./util":36}],23:[function(t,e,r){"use strict";e.exports=function(e,r,n,i,o){var s=t("./util");function a(t){var n=this._promise=new e(r);t instanceof e&&n._propagateFrom(t,3),n._setOnCancel(this),this._values=t,this._length=0,this._totalResolved=0,this._init(void 0,-2)}return s.isArray,s.inherits(a,o),a.prototype.length=function(){return this._length},a.prototype.promise=function(){return this._promise},a.prototype._init=function t(r,o){var a=n(this._values,this._promise);if(a instanceof e){var u=(a=a._target())._bitField;if(this._values=a,0==(50397184&u))return this._promise._setAsyncGuaranteed(),a._then(t,this._reject,void 0,this,o);if(0==(33554432&u))return 0!=(16777216&u)?this._reject(a._reason()):this._cancel();a=a._value()}if(null!==(a=s.asArray(a)))0!==a.length?this._iterate(a):-5===o?this._resolveEmptyArray():this._resolve(function(t){switch(o){case-2:return[];case-3:return{};case-6:return new Map}}());else{var c=i("expecting an array or an iterable object but got "+s.classString(a)).reason();this._promise._rejectCallback(c,!1)}},a.prototype._iterate=function(t){var r=this.getActualLength(t.length);this._length=r,this._values=this.shouldCopyValues()?new Array(r):this._values;for(var i=this._promise,o=!1,s=null,a=0;a=this._length&&(this._resolve(this._values),!0)},a.prototype._promiseCancelled=function(){return this._cancel(),!0},a.prototype._promiseRejected=function(t){return this._totalResolved++,this._reject(t),!0},a.prototype._resultCancelled=function(){if(!this._isResolved()){var t=this._values;if(this._cancel(),t instanceof e)t.cancel();else for(var r=0;r=this._length){var r;if(this._isMap)r=function(t){for(var e=new o,r=t.length/2|0,n=0;n>1},e.prototype.props=function(){return f(this)},e.props=function(t){return f(t)}}},{"./es5":13,"./util":36}],26:[function(t,e,r){"use strict";function n(t){this._capacity=t,this._length=0,this._front=0}n.prototype._willBeOverCapacity=function(t){return this._capacity=this._length&&(this._resolve(this._values),!0)},o.prototype._promiseFulfilled=function(t,e){var r=new i;return r._bitField=33554432,r._settledValueField=t,this._promiseResolved(e,r)},o.prototype._promiseRejected=function(t,e){var r=new i;return r._bitField=16777216,r._settledValueField=t,this._promiseResolved(e,r)},e.settle=function(t){return n.deprecated(".settle()",".reflect()"),new o(t).promise()},e.prototype.settle=function(){return e.settle(this)}}},{"./util":36}],31:[function(t,e,r){"use strict";e.exports=function(e,r,n){var i=t("./util"),o=t("./errors").RangeError,s=t("./errors").AggregateError,a=i.isArray,u={};function c(t){this.constructor$(t),this._howMany=0,this._unwrap=!1,this._initialized=!1}function l(t,e){if((0|e)!==e||e<0)return n("expecting a positive integer\n\n See http://goo.gl/MqrFmX\n");var r=new c(t),i=r.promise();return r.setHowMany(e),r.init(),i}i.inherits(c,r),c.prototype._init=function(){if(this._initialized)if(0!==this._howMany){this._init$(void 0,-5);var t=a(this._values);!this._isResolved()&&t&&this._howMany>this._canPossiblyFulfill()&&this._reject(this._getRangeError(this.length()))}else this._resolve([])},c.prototype.init=function(){this._initialized=!0,this._init()},c.prototype.setUnwrap=function(){this._unwrap=!0},c.prototype.howMany=function(){return this._howMany},c.prototype.setHowMany=function(t){this._howMany=t},c.prototype._promiseFulfilled=function(t){return this._addFulfilled(t),this._fulfilled()===this.howMany()&&(this._values.length=this.howMany(),1===this.howMany()&&this._unwrap?this._resolve(this._values[0]):this._resolve(this._values),!0)},c.prototype._promiseRejected=function(t){return this._addRejected(t),this._checkOutcome()},c.prototype._promiseCancelled=function(){return this._values instanceof e||null==this._values?this._cancel():(this._addRejected(u),this._checkOutcome())},c.prototype._checkOutcome=function(){if(this.howMany()>this._canPossiblyFulfill()){for(var t=new s,e=this.length();e0?this._reject(t):this._cancel(),!0}return!1},c.prototype._fulfilled=function(){return this._totalResolved},c.prototype._rejected=function(){return this._values.length-this.length()},c.prototype._addRejected=function(t){this._values.push(t)},c.prototype._addFulfilled=function(t){this._values[this._totalResolved++]=t},c.prototype._canPossiblyFulfill=function(){return this.length()-this._rejected()},c.prototype._getRangeError=function(t){var e="Input array must contain at least "+this._howMany+" items but contains only "+t+" items";return new o(e)},c.prototype._resolveEmptyArray=function(){this._reject(this._getRangeError(0))},e.some=function(t,e){return l(t,e)},e.prototype.some=function(t){return l(this,t)},e._SomePromiseArray=c}},{"./errors":12,"./util":36}],32:[function(t,e,r){"use strict";e.exports=function(t){function e(t){void 0!==t?(t=t._target(),this._bitField=t._bitField,this._settledValueField=t._isFateSealed()?t._settledValue():void 0):(this._bitField=0,this._settledValueField=void 0)}e.prototype._settledValue=function(){return this._settledValueField};var r=e.prototype.value=function(){if(!this.isFulfilled())throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},n=e.prototype.error=e.prototype.reason=function(){if(!this.isRejected())throw new TypeError("cannot get rejection reason of a non-rejected promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},i=e.prototype.isFulfilled=function(){return 0!=(33554432&this._bitField)},o=e.prototype.isRejected=function(){return 0!=(16777216&this._bitField)},s=e.prototype.isPending=function(){return 0==(50397184&this._bitField)},a=e.prototype.isResolved=function(){return 0!=(50331648&this._bitField)};e.prototype.isCancelled=function(){return 0!=(8454144&this._bitField)},t.prototype.__isCancelled=function(){return 65536==(65536&this._bitField)},t.prototype._isCancelled=function(){return this._target().__isCancelled()},t.prototype.isCancelled=function(){return 0!=(8454144&this._target()._bitField)},t.prototype.isPending=function(){return s.call(this._target())},t.prototype.isRejected=function(){return o.call(this._target())},t.prototype.isFulfilled=function(){return i.call(this._target())},t.prototype.isResolved=function(){return a.call(this._target())},t.prototype.value=function(){return r.call(this._target())},t.prototype.reason=function(){var t=this._target();return t._unsetRejectionIsUnhandled(),n.call(t)},t.prototype._value=function(){return this._settledValue()},t.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue()},t.PromiseInspection=e}},{}],33:[function(t,e,r){"use strict";e.exports=function(e,r){var n=t("./util"),i=n.errorObj,o=n.isObject,s={}.hasOwnProperty;return function(t,a){if(o(t)){if(t instanceof e)return t;var u=function(t){try{return function(t){return t.then}(t)}catch(t){return i.e=t,i}}(t);if(u===i){a&&a._pushContext();var c=e.reject(u.e);return a&&a._popContext(),c}if("function"==typeof u)return function(t){try{return s.call(t,"_promise0")}catch(t){return!1}}(t)?(c=new e(r),t._then(c._fulfill,c._reject,void 0,c,null),c):function(t,o,s){var a=new e(r),u=a;s&&s._pushContext(),a._captureStackTrace(),s&&s._popContext();var c=!0,l=n.tryCatch(o).call(t,function(t){a&&(a._resolveCallback(t),a=null)},function(t){a&&(a._rejectCallback(t,c,!0),a=null)});return c=!1,a&&l===i&&(a._rejectCallback(l.e,!0,!0),a=null),u}(t,u,a)}return t}}},{"./util":36}],34:[function(t,e,r){"use strict";e.exports=function(e,r,n){var i=t("./util"),o=e.TimeoutError;function s(t){this.handle=t}s.prototype._resultCancelled=function(){clearTimeout(this.handle)};var a=function(t){return u(+this).thenReturn(t)},u=e.delay=function(t,i){var o,u;return void 0!==i?(o=e.resolve(i)._then(a,null,null,t,void 0),n.cancellation()&&i instanceof e&&o._setOnCancel(i)):(o=new e(r),u=setTimeout(function(){o._fulfill()},+t),n.cancellation()&&o._setOnCancel(new s(u)),o._captureStackTrace()),o._setAsyncGuaranteed(),o};function c(t){return clearTimeout(this.handle),t}function l(t){throw clearTimeout(this.handle),t}e.prototype.delay=function(t){return u(t,this)},e.prototype.timeout=function(t,e){var r,a;t=+t;var u=new s(setTimeout(function(){r.isPending()&&function(t,e,r){var n;n="string"!=typeof e?e instanceof Error?e:new o("operation timed out"):new o(e),i.markAsOriginatingFromRejection(n),t._attachExtraTrace(n),t._reject(n),null!=r&&r.cancel()}(r,e,a)},t));return n.cancellation()?(a=this.then(),(r=a._then(c,l,void 0,u,void 0))._setOnCancel(u)):r=this._then(c,l,void 0,u,void 0),r}}},{"./util":36}],35:[function(t,e,r){"use strict";e.exports=function(e,r,n,i,o,s){var a=t("./util"),u=t("./errors").TypeError,c=t("./util").inherits,l=a.errorObj,f=a.tryCatch,h={};function p(t){setTimeout(function(){throw t},0)}function d(t,r){var i=0,s=t.length,a=new e(o);return function o(){if(i>=s)return a._fulfill();var u=function(t){var e=n(t);return e!==t&&"function"==typeof t._isDisposable&&"function"==typeof t._getDisposer&&t._isDisposable()&&e._setDisposable(t._getDisposer()),e}(t[i++]);if(u instanceof e&&u._isDisposable()){try{u=n(u._getDisposer().tryDispose(r),t.promise)}catch(t){return p(t)}if(u instanceof e)return u._then(o,p,null,null,null)}o()}(),a}function _(t,e,r){this._data=t,this._promise=e,this._context=r}function v(t,e,r){this.constructor$(t,e,r)}function y(t){return _.isDisposer(t)?(this.resources[this.index]._setDisposable(t),t.promise()):t}function m(t){this.length=t,this.promise=null,this[t-1]=null}_.prototype.data=function(){return this._data},_.prototype.promise=function(){return this._promise},_.prototype.resource=function(){return this.promise().isFulfilled()?this.promise().value():h},_.prototype.tryDispose=function(t){var e=this.resource(),r=this._context;void 0!==r&&r._pushContext();var n=e!==h?this.doDispose(e,t):null;return void 0!==r&&r._popContext(),this._promise._unsetDisposable(),this._data=null,n},_.isDisposer=function(t){return null!=t&&"function"==typeof t.resource&&"function"==typeof t.tryDispose},c(v,_),v.prototype.doDispose=function(t,e){return this.data().call(t,t,e)},m.prototype._resultCancelled=function(){for(var t=this.length,r=0;r0},e.prototype._getDisposer=function(){return this._disposer},e.prototype._unsetDisposable=function(){this._bitField=-131073&this._bitField,this._disposer=void 0},e.prototype.disposer=function(t){if("function"==typeof t)return new v(t,this,i());throw new u}}},{"./errors":12,"./util":36}],36:[function(t,n,i){"use strict";var o,s=t("./es5"),a="undefined"==typeof navigator,u={e:{}},c="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==r?r:void 0!==this?this:null;function l(){try{var t=o;return o=null,t.apply(this,arguments)}catch(t){return u.e=t,u}}function f(t){return null==t||!0===t||!1===t||"string"==typeof t||"number"==typeof t}function h(t,e,r){if(f(t))return t;var n={value:r,configurable:!0,enumerable:!1,writable:!0};return s.defineProperty(t,e,n),t}var p=function(){var t=[Array.prototype,Object.prototype,Function.prototype],e=function(e){for(var r=0;r1,n=e.length>0&&!(1===e.length&&"constructor"===e[0]),i=d.test(t+"")&&s.names(t).length>0;if(r||n||i)return!0}return!1}catch(t){return!1}},isIdentifier:function(t){return _.test(t)},inheritedDataKeys:p,getDataPropertyOrDefault:function(t,e,r){if(!s.isES5)return{}.hasOwnProperty.call(t,e)?t[e]:void 0;var n=Object.getOwnPropertyDescriptor(t,e);return null!=n?null==n.get&&null==n.set?n.value:r:void 0},thrower:function(t){throw t},isArray:s.isArray,asArray:w,notEnumerableProp:h,isPrimitive:f,isObject:function(t){return"function"==typeof t||"object"==typeof t&&null!==t},isError:y,canEvaluate:a,errorObj:u,tryCatch:function(t){return o=t,l},inherits:function(t,e){var r={}.hasOwnProperty;function n(){for(var n in this.constructor=t,this.constructor$=e,e.prototype)r.call(e.prototype,n)&&"$"!==n.charAt(n.length-1)&&(this[n+"$"]=e.prototype[n])}return n.prototype=e.prototype,t.prototype=new n,t.prototype},withAppended:function(t,e){var r,n=t.length,i=new Array(n+1);for(r=0;r10||t[0]>0}(),j.isNode&&j.toFastProperties(e);try{throw new Error}catch(t){j.lastLineError=t}n.exports=j},{"./es5":13}]},{},[4])(4),"undefined"!=typeof window&&null!==window?window.P=window.Promise:"undefined"!=typeof self&&null!==self&&(self.P=self.Promise)}).call(this,r(4),r(0),r(11).setImmediate)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e){if(!e.eol&&t)for(var r=0,n=t.length;r0?("string"==typeof e||s.objectMode||Object.getPrototypeOf(e)===c.prototype||(e=function(t){return c.from(t)}(e)),n?s.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):w(t,s,e,!0):s.ended?t.emit("error",new Error("stream.push() after EOF")):(s.reading=!1,s.decoder&&!r?(e=s.decoder.write(e),s.objectMode||0!==e.length?w(t,s,e,!1):S(t,s)):w(t,s,e,!1))):n||(s.reading=!1)),function(t){return!t.ended&&(t.needReadable||t.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=E?t=E:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function x(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(p("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?i.nextTick(j,t):j(t))}function j(t){p("emit readable"),t.emit("readable"),P(t)}function S(t,e){e.readingMore||(e.readingMore=!0,i.nextTick(R,t,e))}function R(t,e){for(var r=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):r=function(t,e,r){var n;return to.length?o.length:t;if(s===o.length?i+=o:i+=o.slice(0,t),0==(t-=s)){s===o.length?(++n,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=o.slice(s));break}++n}return e.length-=n,i}(t,e):function(t,e){var r=c.allocUnsafe(t),n=e.head,i=1;for(n.data.copy(r),t-=n.data.length;n=n.next;){var o=n.data,s=t>o.length?o.length:t;if(o.copy(r,r.length-t,0,s),0==(t-=s)){s===o.length?(++i,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=o.slice(s));break}++i}return e.length-=i,r}(t,e),n}(t,e.buffer,e.decoder),r);var r}function A(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,i.nextTick(F,e,t))}function F(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function L(t,e){for(var r=0,n=t.length;r=e.highWaterMark||e.ended))return p("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?A(this):x(this),null;if(0===(t=C(t,e))&&e.ended)return 0===e.length&&A(this),null;var n,i=e.needReadable;return p("need readable",i),(0===e.length||e.length-t0?O(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&A(this)),null!==n&&this.emit("data",n),n},g.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},g.prototype.pipe=function(t,e){var r=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=t;break;case 1:o.pipes=[o.pipes,t];break;default:o.pipes.push(t)}o.pipesCount+=1,p("pipe count=%d opts=%j",o.pipesCount,e);var u=e&&!1===e.end||t===n.stdout||t===n.stderr?m:c;function c(){p("onend"),t.end()}o.endEmitted?i.nextTick(u):r.once("end",u),t.on("unpipe",function e(n,i){p("onunpipe"),n===r&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,p("cleanup"),t.removeListener("close",v),t.removeListener("finish",y),t.removeListener("drain",l),t.removeListener("error",_),t.removeListener("unpipe",e),r.removeListener("end",c),r.removeListener("end",m),r.removeListener("data",d),f=!0,!o.awaitDrain||t._writableState&&!t._writableState.needDrain||l())});var l=function(t){return function(){var e=t._readableState;p("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&a(t,"data")&&(e.flowing=!0,P(t))}}(r);t.on("drain",l);var f=!1,h=!1;function d(e){p("ondata"),h=!1,!1!==t.write(e)||h||((1===o.pipesCount&&o.pipes===t||o.pipesCount>1&&-1!==L(o.pipes,t))&&!f&&(p("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,h=!0),r.pause())}function _(e){p("onerror",e),m(),t.removeListener("error",_),0===a(t,"error")&&t.emit("error",e)}function v(){t.removeListener("finish",y),m()}function y(){p("onfinish"),t.removeListener("close",v),m()}function m(){p("unpipe"),r.unpipe(t)}return r.on("data",d),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?s(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",_),t.once("close",v),t.once("finish",y),t.emit("pipe",r),o.flowing||(p("pipe resume"),r.resume()),t},g.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r),this);if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function a(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function u(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function c(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function l(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function f(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function h(t){return t.toString(this.encoding)}function p(t){return t&&t.length?this.write(t):""}e.StringDecoder=o,o.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0?(i>0&&(t.lastNeed=i-1),i):--n=0?(i>0&&(t.lastNeed=i-2),i):--n=0?(i>0&&(2===i?i=0:t.lastNeed=i-3),i):0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)},o.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},function(t,e,r){"use strict";t.exports=o;var n=r(1),i=r(5);function o(t){if(!(this instanceof o))return new o(t);n.call(this,t),this._transformState={afterTransform:function(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=e&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length-1&&r.push(t[n]);return r},e.trimLeft=String.prototype.trimLeft?function(t){return t.trimLeft()}:function(t){return t.replace(/^\s+/,"")},e.trimRight=String.prototype.trimRight?function(t){return t.trimRight()}:function(t){return t.replace(/\s+$/,"")}}).call(this,r(3).Buffer)},function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=function(t){function e(e,r,n){var i=t.call(this,"Error: "+e+". JSON Line number: "+r+(n?" near: "+n:""))||this;return i.err=e,i.line=r,i.extra=n,i.name="CSV Parse Error",i}return n(e,t),e.column_mismatched=function(t,r){return new e("column_mismatched",t,r)},e.unclosed_quote=function(t,r){return new e("unclosed_quote",t,r)},e.fromJSON=function(t){return new e(t.err,t.line,t.extra)},e.prototype.toJSON=function(){return{err:this.err,line:this.line,extra:this.extra}},e}(Error);e.default=i},function(t,e,r){var n=r(18),i=r(68),o=r(69),s=n?n.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":s&&s in Object(t)?i(t):o(t)}},function(t,e){t.exports=function(t,e){return t===e||t!=t&&e!=e}},function(t,e,r){t.exports=r(33)},function(t,e,r){"use strict";var n=r(34),i=function(t,e){return new n.Converter(t,e)};i.csv=i,i.Converter=n.Converter,t.exports=i},function(t,e,r){"use strict";(function(t){var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=r(36),s=r(50),a=r(51),u=i(r(15)),c=r(52),l=r(105),f=function(e){function i(r,n){void 0===n&&(n={});var i=e.call(this,n)||this;return i.options=n,i.params=s.mergeParams(r),i.runtime=a.initParseRuntime(i),i.result=new l.Result(i),i.processor=new c.ProcessorLocal(i),i.once("error",function(e){t(function(){i.result.processError(e),i.emit("done",e)})}),i.once("done",function(){i.processor.destroy()}),i}return n(i,e),i.prototype.preRawData=function(t){return this.runtime.preRawDataHook=t,this},i.prototype.preFileLine=function(t){return this.runtime.preFileLineHook=t,this},i.prototype.subscribe=function(t,e,r){return this.parseRuntime.subscribe={onNext:t,onError:e,onCompleted:r},this},i.prototype.fromFile=function(t,e){var n=this,i=r(!function(){var t=new Error("Cannot find module 'fs'");throw t.code="MODULE_NOT_FOUND",t}());return i.exists(t,function(r){r?i.createReadStream(t,e).pipe(n):n.emit("error",new Error("File does not exist. Check to make sure the file path to your csv is correct."))}),this},i.prototype.fromStream=function(t){return t.pipe(this),this},i.prototype.fromString=function(t){t.toString();var e=new o.Readable,r=0;return e._read=function(e){if(r>=t.length)this.push(null);else{var n=t.substr(r,e);this.push(n),r+=e}},this.fromStream(e)},i.prototype.then=function(t,e){var r=this;return new u.default(function(n,i){r.parseRuntime.then={onfulfilled:function(e){n(t?t(e):e)},onrejected:function(t){e?n(e(t)):i(t)}}})},Object.defineProperty(i.prototype,"parseParam",{get:function(){return this.params},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"parseRuntime",{get:function(){return this.runtime},enumerable:!0,configurable:!0}),i.prototype._transform=function(t,e,r){var n=this;this.processor.process(t).then(function(t){if(t.length>0)return n.runtime.started=!0,n.result.processResult(t)}).then(function(){n.emit("drained"),r()},function(t){n.runtime.hasError=!0,n.runtime.error=t,n.emit("error",t),r()})},i.prototype._flush=function(t){var e=this;this.processor.flush().then(function(t){if(t.length>0)return e.result.processResult(t)}).then(function(){e.processEnd(t)},function(r){e.emit("error",r),t()})},i.prototype.processEnd=function(t){this.result.endProcess(),this.emit("done"),t()},Object.defineProperty(i.prototype,"parsedLineNumber",{get:function(){return this.runtime.parsedLineNumber},enumerable:!0,configurable:!0}),i}(o.Transform);e.Converter=f}).call(this,r(11).setImmediate)},function(t,e,r){(function(t,e){!function(t,r){"use strict";if(!t.setImmediate){var n,i=1,o={},s=!1,a=t.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(t);u=u&&u.setTimeout?u:t,"[object process]"==={}.toString.call(t.process)?n=function(t){e.nextTick(function(){l(t)})}:function(){if(t.postMessage&&!t.importScripts){var e=!0,r=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=r,e}}()?function(){var e="setImmediate$"+Math.random()+"$",r=function(r){r.source===t&&"string"==typeof r.data&&0===r.data.indexOf(e)&&l(+r.data.slice(e.length))};t.addEventListener?t.addEventListener("message",r,!1):t.attachEvent("onmessage",r),n=function(r){t.postMessage(e+r,"*")}}():t.MessageChannel?function(){var t=new MessageChannel;t.port1.onmessage=function(t){l(t.data)},n=function(e){t.port2.postMessage(e)}}():a&&"onreadystatechange"in a.createElement("script")?function(){var t=a.documentElement;n=function(e){var r=a.createElement("script");r.onreadystatechange=function(){l(e),r.onreadystatechange=null,t.removeChild(r),r=null},t.appendChild(r)}}():n=function(t){setTimeout(l,0,t)},u.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),r=0;r0?n-4:n,f=0;f>16&255,a[u++]=e>>8&255,a[u++]=255&e;return 2===s&&(e=i[t.charCodeAt(f)]<<2|i[t.charCodeAt(f+1)]>>4,a[u++]=255&e),1===s&&(e=i[t.charCodeAt(f)]<<10|i[t.charCodeAt(f+1)]<<4|i[t.charCodeAt(f+2)]>>2,a[u++]=e>>8&255,a[u++]=255&e),a},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],s=0,a=r-i;sa?a:s+16383));return 1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"=")),o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function l(t){return n[t>>18&63]+n[t>>12&63]+n[t>>6&63]+n[63&t]}function f(t,e,r){for(var n,i=[],o=e;o>1,l=-7,f=r?i-1:0,h=r?-1:1,p=t[e+f];for(f+=h,o=p&(1<<-l)-1,p>>=-l,l+=a;l>0;o=256*o+t[e+f],f+=h,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=n;l>0;s=256*s+t[e+f],f+=h,l-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),o-=c}return(p?-1:1)*s*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var s,a,u,c=8*o-i-1,l=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,d=n?1:-1,_=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=l):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+f>=1?h/u:h*Math.pow(2,1-f))*u>=2&&(s++,u/=2),s+f>=l?(a=0,s=l):s+f>=1?(a=(e*u-1)*Math.pow(2,i),s+=f):(a=e*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;t[r+p]=255&a,p+=d,a/=256,i-=8);for(s=s<0;t[r+p]=255&s,p+=d,s/=256,c-=8);t[r+p-d]|=128*_}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e){},function(t,e,r){"use strict";var n=r(7).Buffer,i=r(43);function o(t,e,r){t.copy(e,r)}t.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r},t.prototype.concat=function(t){if(0===this.length)return n.alloc(0);if(1===this.length)return this.head.data;for(var e=n.allocUnsafe(t>>>0),r=this.head,i=0;r;)o(r.data,e,i),i+=r.data.length,r=r.next;return e},t}(),i&&i.inspect&&i.inspect.custom&&(t.exports.prototype[i.inspect.custom]=function(){var t=i.inspect({length:this.length});return this.constructor.name+" "+t})},function(t,e){},function(t,e,r){(function(e){function r(t){try{if(!e.localStorage)return!1}catch(t){return!1}var r=e.localStorage[t];return null!=r&&"true"===String(r).toLowerCase()}t.exports=function(t,e){if(r("noDeprecation"))return t;var n=!1;return function(){if(!n){if(r("throwDeprecation"))throw new Error(e);r("traceDeprecation")?console.trace(e):console.warn(e),n=!0}return t.apply(this,arguments)}}}).call(this,r(0))},function(t,e,r){"use strict";t.exports=o;var n=r(27),i=r(5);function o(t){if(!(this instanceof o))return new o(t);n.call(this,t)}i.inherits=r(2),i.inherits(o,n),o.prototype._transform=function(t,e,r){r(null,t)}},function(t,e,r){t.exports=r(14)},function(t,e,r){t.exports=r(1)},function(t,e,r){t.exports=r(13).Transform},function(t,e,r){t.exports=r(13).PassThrough},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.mergeParams=function(t){var e={delimiter:",",ignoreColumns:void 0,includeColumns:void 0,quote:'"',trim:!0,checkType:!1,ignoreEmpty:!1,noheader:!1,headers:void 0,flatKeys:!1,maxRowLength:0,checkColumn:!1,escape:'"',colParser:{},eol:void 0,alwaysSplitAtEOL:!1,output:"json",nullObject:!1,downstreamFormat:"line",needEmitAll:!0};for(var r in t||(t={}),t)t.hasOwnProperty(r)&&(Array.isArray(t[r])?e[r]=[].concat(t[r]):e[r]=t[r]);return e}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.initParseRuntime=function(t){var e=t.parseParam,r={needProcessIgnoreColumn:!1,needProcessIncludeColumn:!1,selectedColumns:void 0,ended:!1,hasError:!1,error:void 0,delimiter:t.parseParam.delimiter,eol:t.parseParam.eol,columnConv:[],headerType:[],headerTitle:[],headerFlag:[],headers:void 0,started:!1,parsedLineNumber:0,columnValueSetter:[]};return e.ignoreColumns&&(r.needProcessIgnoreColumn=!0),e.includeColumns&&(r.needProcessIncludeColumn=!0),r}},function(t,e,r){"use strict";(function(t){var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=r(53),s=i(r(15)),a=r(54),u=i(r(16)),c=r(57),l=r(28),f=r(58),h=i(r(59)),p=i(r(29)),d=function(e){function r(){var t=null!==e&&e.apply(this,arguments)||this;return t.rowSplit=new f.RowSplit(t.converter),t.eolEmitted=!1,t._needEmitEol=void 0,t.headEmitted=!1,t._needEmitHead=void 0,t}return n(r,e),r.prototype.flush=function(){var t=this;if(this.runtime.csvLineBuffer&&this.runtime.csvLineBuffer.length>0){var e=this.runtime.csvLineBuffer;return this.runtime.csvLineBuffer=void 0,this.process(e,!0).then(function(e){return t.runtime.csvLineBuffer&&t.runtime.csvLineBuffer.length>0?s.default.reject(p.default.unclosed_quote(t.runtime.parsedLineNumber,t.runtime.csvLineBuffer.toString())):s.default.resolve(e)})}return s.default.resolve([])},r.prototype.destroy=function(){return s.default.resolve()},Object.defineProperty(r.prototype,"needEmitEol",{get:function(){return void 0===this._needEmitEol&&(this._needEmitEol=this.converter.listeners("eol").length>0),this._needEmitEol},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"needEmitHead",{get:function(){return void 0===this._needEmitHead&&(this._needEmitHead=this.converter.listeners("header").length>0),this._needEmitHead},enumerable:!0,configurable:!0}),r.prototype.process=function(t,e){var r,n=this;return void 0===e&&(e=!1),r=e?t.toString():a.prepareData(t,this.converter.parseRuntime),s.default.resolve().then(function(){return n.runtime.preRawDataHook?n.runtime.preRawDataHook(r):r}).then(function(t){return t&&t.length>0?n.processCSV(t,e):s.default.resolve([])})},r.prototype.processCSV=function(t,e){var r=this,n=this.params,i=this.runtime;i.eol||u.default(t,i),this.needEmitEol&&!this.eolEmitted&&i.eol&&(this.converter.emit("eol",i.eol),this.eolEmitted=!0),n.ignoreEmpty&&!i.started&&(t=l.trimLeft(t));var o=c.stringToLines(t,i);return e?(o.lines.push(o.partial),o.partial=""):this.prependLeftBuf(l.bufFromString(o.partial)),o.lines.length>0?(i.preFileLineHook?this.runPreLineHook(o.lines):s.default.resolve(o.lines)).then(function(t){return i.started||r.runtime.headers?r.processCSVBody(t):r.processDataWithHead(t)}):s.default.resolve([])},r.prototype.processDataWithHead=function(t){if(this.params.noheader)this.params.headers?this.runtime.headers=this.params.headers:this.runtime.headers=[];else{for(var e="",r=[];t.length;){var n=e+t.shift(),i=this.rowSplit.parse(n);if(i.closed){r=i.cells,e="";break}e=n+u.default(n,this.runtime)}if(this.prependLeftBuf(l.bufFromString(e)),0===r.length)return[];this.params.headers?this.runtime.headers=this.params.headers:this.runtime.headers=r}return(this.runtime.needProcessIgnoreColumn||this.runtime.needProcessIncludeColumn)&&this.filterHeader(),this.needEmitHead&&!this.headEmitted&&(this.converter.emit("header",this.runtime.headers),this.headEmitted=!0),this.processCSVBody(t)},r.prototype.filterHeader=function(){if(this.runtime.selectedColumns=[],this.runtime.headers){for(var t=this.runtime.headers,e=0;e=e.length)i();else if(r.preFileLineHook){var o=e[n],s=r.preFileLineHook(o,r.parsedLineNumber+n);if(n++,s&&s.then)s.then(function(o){e[n-1]=o,t(e,r,n,i)});else{for(e[n-1]=s;n0?t.concat([r.csvLineBuffer,e]):e}(e,r);r.csvLineBuffer=void 0;var o=function(t,e){var r=t.length-1;if(0!=(128&t[r])){for(;128==(192&t[r]);)r--;r--}return r!=t.length-1?(e.csvLineBuffer=t.slice(r+1),t.slice(0,r+1)):t}(n,r).toString("utf8");return!1===r.started?i.default(o):o}}).call(this,r(3).Buffer)},function(t,e,r){"use strict";(function(e){var n=r(56);t.exports=function(t){return"string"==typeof t&&65279===t.charCodeAt(0)?t.slice(1):e.isBuffer(t)&&n(t)&&239===t[0]&&187===t[1]&&191===t[2]?t.slice(3):t}}).call(this,r(3).Buffer)},function(t,e){t.exports=function(t){for(var e=0;e0),this._needEmitDelimiter},enumerable:!0,configurable:!0}),t.prototype.parse=function(t){if(0===t.length||this.conv.parseParam.ignoreEmpty&&0===t.trim().length)return{cells:[],closed:!0};var e=this.quote,r=this.trim;this.escape,(this.conv.parseRuntime.delimiter instanceof Array||"auto"===this.conv.parseRuntime.delimiter.toLowerCase())&&(this.conv.parseRuntime.delimiter=this.getDelimiter(t)),this.needEmitDelimiter&&!this.delimiterEmitted&&(this.conv.emit("delimiter",this.conv.parseRuntime.delimiter),this.delimiterEmitted=!0);var n=this.conv.parseRuntime.delimiter,i=t.split(n);if("off"===e){if(r)for(var o=0;or&&(n=e,r=i)}),n},t.prototype.isQuoteOpen=function(t){var e=this.quote,r=this.escape;return t[0]===e&&(t[1]!==e||t[1]===r&&(t[2]===e||2===t.length))},t.prototype.isQuoteClose=function(t){var e=this.quote,r=this.escape;this.conv.parseParam.trim&&(t=o.trimRight(t));for(var n=0,i=t.length-1;t[i]===e||t[i]===r;)i--,n++;return n%2!=0},t.prototype.escapeQuote=function(t){var e="es|"+this.quote+"|"+this.escape;void 0===this.cachedRegExp[e]&&(this.cachedRegExp[e]=new RegExp("\\"+this.escape+"\\"+this.quote,"g"));var r=this.cachedRegExp[e];return t.replace(r,this.quote)},t.prototype.parseMultiLines=function(t){for(var e=[],r="";t.length;){var n=r+t.shift(),s=this.parse(n);0===s.cells.length&&this.conv.parseParam.ignoreEmpty||(s.closed||this.conv.parseParam.alwaysSplitAtEOL?(this.conv.parseRuntime.selectedColumns?e.push(o.filterArray(s.cells,this.conv.parseRuntime.selectedColumns)):e.push(s.cells),r=""):r=n+(i.default(n,this.conv.parseRuntime)||"\n"))}return{rowsCells:e,partial:r}},t}();e.RowSplit=a},function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=n(r(29)),o=n(r(60)),s=/^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$/;function a(t,e,r){if(e.parseParam.checkColumn&&e.parseRuntime.headers&&t.length!==e.parseRuntime.headers.length)throw i.default.column_mismatched(e.parseRuntime.parsedLineNumber+r);return function(t,e,r){for(var n=!1,i={},o=0,s=t.length;o-1){for(var o=e.split("."),s=!0;o.length>0;)if(0===o.shift().length){s=!1;break}!s||n.parseParam.colParser[e]&&n.parseParam.colParser[e].flat?n.parseRuntime.columnValueSetter[i]=f:n.parseRuntime.columnValueSetter[i]=h}else n.parseRuntime.columnValueSetter[i]=f;!0===n.parseParam.nullObject&&"null"===r&&(r=null),n.parseRuntime.columnValueSetter[i](t,e,r)}function f(t,e,r){t[e]=r}function h(t,e,r){o.default(t,e,r)}function p(t,e,r,n){return n.parseRuntime.headerType[r]?n.parseRuntime.headerType[r]:e.indexOf("number#!")>-1?n.parseRuntime.headerType[r]=d:e.indexOf("string#!")>-1?n.parseRuntime.headerType[r]=_:n.parseParam.checkType?n.parseRuntime.headerType[r]=v:n.parseRuntime.headerType[r]=_}function d(t){var e=parseFloat(t);return isNaN(e)?t:e}function _(t){return t.toString()}function v(t){var e=t.trim();return""===e?_(t):s.test(e)?d(t):5===e.length&&"false"===e.toLowerCase()||4===e.length&&"true"===e.toLowerCase()?function(t){var e=t.trim();return 5!==e.length||"false"!==e.toLowerCase()}(t):"{"===e[0]&&"}"===e[e.length-1]||"["===e[0]&&"]"===e[e.length-1]?function(t){try{return JSON.parse(t)}catch(e){return t}}(t):_(t)}},function(t,e,r){var n=r(61);t.exports=function(t,e,r){return null==t?t:n(t,e,r)}},function(t,e,r){var n=r(62),i=r(74),o=r(103),s=r(20),a=r(104);t.exports=function(t,e,r,u){if(!s(t))return t;for(var c=-1,l=(e=i(e,t)).length,f=l-1,h=t;null!=h&&++c-1}},function(t,e,r){var n=r(9);t.exports=function(t,e){var r=this.__data__,i=n(r,t);return i<0?(++this.size,r.push([t,e])):r[i][1]=e,this}},function(t,e,r){var n=r(17)(r(19),"Map");t.exports=n},function(t,e,r){var n=r(10);t.exports=function(t){var e=n(this,t).delete(t);return this.size-=e?1:0,e}},function(t,e){t.exports=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}},function(t,e,r){var n=r(10);t.exports=function(t){return n(this,t).get(t)}},function(t,e,r){var n=r(10);t.exports=function(t){return n(this,t).has(t)}},function(t,e,r){var n=r(10);t.exports=function(t,e){var r=n(this,t),i=r.size;return r.set(t,e),this.size+=r.size==i?0:1,this}},function(t,e,r){var n=r(101);t.exports=function(t){return null==t?"":n(t)}},function(t,e,r){var n=r(18),i=r(102),o=r(21),s=r(22),a=n?n.prototype:void 0,u=a?a.toString:void 0;t.exports=function t(e){if("string"==typeof e)return e;if(o(e))return i(e,t)+"";if(s(e))return u?u.call(e):"";var r=e+"";return"0"==r&&1/e==-1/0?"-0":r}},function(t,e){t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length,i=Array(n);++r-1&&t%1==0&&t0||this.converter.listeners("readable").length>0),this._needPushDownstream},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"needEmitAll",{get:function(){return!!this.converter.parseRuntime.then&&this.converter.parseParam.needEmitAll},enumerable:!0,configurable:!0}),t.prototype.processResult=function(t){var e=this,r=this.converter.parseRuntime.parsedLineNumber;return this.needPushDownstream&&"array"===this.converter.parseParam.downstreamFormat&&0===r&&a(this.converter,"["+o.EOL),new i.default(function(r,n){e.needEmitLine?function t(e,r,n,i,o){if(n>=e.length)o();else if(r.parseRuntime.subscribe&&r.parseRuntime.subscribe.onNext){var s=r.parseRuntime.subscribe.onNext,u=e[n],c=s(u,r.parseRuntime.parsedLineNumber+n);if(n++,c&&c.then)c.then(function(){!function(e,r,n,i,o,s,u){o&&a(n,u),t(e,n,i,o,s)}(e,0,r,n,i,o,u)},o);else{for(i&&a(r,u);n=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function d(e,t){if(u.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return F(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Y(e).length;default:if(n)return F(e).length;t=(""+t).toLowerCase(),n=!0}}function m(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function v(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=u.from(t,n)),u.isBuffer(t))return 0===t.length?-1:g(e,t,r,n,i);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):g(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function g(e,t,r,n,i){var o,s=1,a=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,u/=2,r/=2}function f(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var c=-1;for(o=r;oa&&(r=a-u),o=r;o>=0;o--){for(var l=!0,h=0;hi&&(n=i):n=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function R(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function x(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i239?4:f>223?3:f>191?2:1;if(i+l<=r)switch(l){case 1:f<128&&(c=f);break;case 2:128==(192&(o=e[i+1]))&&(u=(31&f)<<6|63&o)>127&&(c=u);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(u=(15&f)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&f)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(c=u)}null===c?(c=65533,l=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=l}return function(e){var t=e.length;if(t<=P)return String.fromCharCode.apply(String,e);for(var r="",n=0;nthis.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return A(this,t,r);case"utf8":case"utf-8":return x(this,t,r);case"ascii":return T(this,t,r);case"latin1":case"binary":return L(this,t,r);case"base64":return R(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}.apply(this,arguments)},u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===u.compare(this,e)},u.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},u.prototype.compare=function(e,t,r,n,i){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;for(var o=i-n,s=r-t,a=Math.min(o,s),f=this.slice(n,i),c=e.slice(t,r),l=0;li)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return y(this,e,t,r);case"utf8":case"utf-8":return b(this,e,t,r);case"ascii":return w(this,e,t,r);case"latin1":case"binary":return _(this,e,t,r);case"base64":return E(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var P=4096;function T(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;in)&&(r=n);for(var i="",o=t;or)throw new RangeError("Trying to access beyond buffer length")}function k(e,t,r,n,i,o){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function j(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-r,2);i>>8*(n?i:1-i)}function M(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-r,4);i>>8*(n?i:3-i)&255}function B(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(e,t,r,n,o){return o||B(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function U(e,t,r,n,o){return o||B(e,0,r,8),i.write(e,t,r,n,52,8),r+8}u.prototype.slice=function(e,t){var r,n=this.length;if(e=~~e,t=void 0===t?n:~~t,e<0?(e+=n)<0&&(e=0):e>n&&(e=n),t<0?(t+=n)<0&&(t=0):t>n&&(t=n),t0&&(i*=256);)n+=this[e+--t]*i;return n},u.prototype.readUInt8=function(e,t){return t||C(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return t||C(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return t||C(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return t||C(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return t||C(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||C(e,t,this.length);for(var n=this[e],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*t)),n},u.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||C(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},u.prototype.readInt8=function(e,t){return t||C(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){t||C(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(e,t){t||C(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(e,t){return t||C(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return t||C(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return t||C(e,4,this.length),i.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||C(e,4,this.length),i.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||C(e,8,this.length),i.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||C(e,8,this.length),i.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,r,n){e=+e,t|=0,r|=0,n||k(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+i]=e/o&255;return t+r},u.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||k(this,e,t,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||k(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):j(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||k(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):j(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||k(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):M(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||k(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):M(this,e,t,!1),t+4},u.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);k(this,e,t,r,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o>0)-a&255;return t+r},u.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);k(this,e,t,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},u.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||k(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||k(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):j(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||k(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):j(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||k(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):M(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||k(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):M(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,r){return D(this,e,t,!0,r)},u.prototype.writeFloatBE=function(e,t,r){return D(this,e,t,!1,r)},u.prototype.writeDoubleLE=function(e,t,r){return U(this,e,t,!0,r)},u.prototype.writeDoubleBE=function(e,t,r){return U(this,e,t,!1,r)},u.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--i)e[i+t]=this[i+r];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function Y(e){return n.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(I,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function q(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}}).call(this,r(0))},function(e,t,r){(function(e){function r(e){return Object.prototype.toString.call(e)}t.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===r(e)},t.isBoolean=function(e){return"boolean"==typeof e},t.isNull=function(e){return null===e},t.isNullOrUndefined=function(e){return null==e},t.isNumber=function(e){return"number"==typeof e},t.isString=function(e){return"string"==typeof e},t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=function(e){return void 0===e},t.isRegExp=function(e){return"[object RegExp]"===r(e)},t.isObject=function(e){return"object"==typeof e&&null!==e},t.isDate=function(e){return"[object Date]"===r(e)},t.isError=function(e){return"[object Error]"===r(e)||e instanceof Error},t.isFunction=function(e){return"function"==typeof e},t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=e.isBuffer}).call(this,r(3).Buffer)},function(e,t){var r,n,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(r===setTimeout)return setTimeout(e,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(e){r=o}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(e){n=s}}();var u,f=[],c=!1,l=-1;function h(){c&&u&&(c=!1,u.length?f=u.concat(f):l=-1,f.length&&p())}function p(){if(!c){var e=a(h);c=!0;for(var t=f.length;t;){for(u=f,f=[];++l1)for(var r=1;r0&&this._events[e].length>s&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){if(!n(t))throw TypeError("listener must be a function");var r=!1;function i(){this.removeListener(e,i),r||(r=!0,t.apply(this,arguments))}return i.listener=t,this.on(e,i),this},r.prototype.removeListener=function(e,t){var r,o,s,a;if(!n(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(s=(r=this._events[e]).length,o=-1,r===t||n(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(i(r)){for(a=s;a-- >0;)if(r[a]===t||r[a].listener&&r[a].listener===t){o=a;break}if(o<0)return this;1===r.length?(r.length=0,delete this._events[e]):r.splice(o,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n(r=this._events[e]))this.removeListener(e,r);else if(r)for(;r.length;)this.removeListener(e,r[r.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){return this._events&&this._events[e]?n(this._events[e])?[this._events[e]]:this._events[e].slice():[]},r.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(n(t))return 1;if(t)return t.length}return 0},r.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,r){(t=e.exports=r(22)).Stream=t,t.Readable=t,t.Writable=r(13),t.Duplex=r(1),t.Transform=r(26),t.PassThrough=r(44)},function(e,t,r){"use strict";(function(t,n,i){var o=r(6);function s(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var n=e.entry;for(e.entry=null;n;){var i=n.callback;t.pendingcb--,i(void 0),n=n.next}t.corkedRequestsFree?t.corkedRequestsFree.next=e:t.corkedRequestsFree=e}(t,e)}}e.exports=y;var a,u=!t.browser&&["v0.10","v0.9."].indexOf(t.version.slice(0,5))>-1?n:o.nextTick;y.WritableState=g;var f=r(4);f.inherits=r(2);var c,l={deprecate:r(43)},h=r(23),p=r(7).Buffer,d=i.Uint8Array||function(){},m=r(24);function v(){}function g(e,t){a=a||r(1),e=e||{};var n=t instanceof a;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,f=e.writableHighWaterMark,c=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(f||0===f)?f:c,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===e.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,n=r.sync,i=r.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,n,i){--t.pendingcb,r?(o.nextTick(i,n),o.nextTick(R,e,t),e._writableState.errorEmitted=!0,e.emit("error",n)):(i(n),e._writableState.errorEmitted=!0,e.emit("error",n),R(e,t))}(e,r,n,t,i);else{var s=E(r);s||r.corked||r.bufferProcessing||!r.bufferedRequest||_(e,r),n?u(w,e,r,s,i):w(e,r,s,i)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function y(e){if(a=a||r(1),!(c.call(y,this)||this instanceof a))return new y(e);this._writableState=new g(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),h.call(this)}function b(e,t,r,n,i,o,s){t.writelen=n,t.writecb=s,t.writing=!0,t.sync=!0,r?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function w(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),R(e,t)}function _(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,i=new Array(n),o=t.corkedRequestsFree;o.entry=r;for(var a=0,u=!0;r;)i[a]=r,r.isBuf||(u=!1),r=r.next,a+=1;i.allBuffers=u,b(e,t,!0,t.length,i,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new s(t),t.bufferedRequestCount=0}else{for(;r;){var f=r.chunk,c=r.encoding,l=r.callback;if(b(e,t,!1,t.objectMode?1:f.length,f,c,l),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function E(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function S(e,t){e._final(function(r){t.pendingcb--,r&&e.emit("error",r),t.prefinished=!0,e.emit("prefinish"),R(e,t)})}function R(e,t){var r=E(t);return r&&(function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,o.nextTick(S,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),r}f.inherits(y,h),g.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(g.prototype,"buffer",{get:l.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(c=Function.prototype[Symbol.hasInstance],Object.defineProperty(y,Symbol.hasInstance,{value:function(e){return!!c.call(this,e)||this===y&&e&&e._writableState instanceof g}})):c=function(e){return e instanceof this},y.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},y.prototype.write=function(e,t,r){var n=this._writableState,i=!1,s=!n.objectMode&&function(e){return p.isBuffer(e)||e instanceof d}(e);return s&&!p.isBuffer(e)&&(e=function(e){return p.from(e)}(e)),"function"==typeof t&&(r=t,t=null),s?t="buffer":t||(t=n.defaultEncoding),"function"!=typeof r&&(r=v),n.ended?function(e,t){var r=new Error("write after end");e.emit("error",r),o.nextTick(t,r)}(this,r):(s||function(e,t,r,n){var i=!0,s=!1;return null===r?s=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),o.nextTick(n,s),i=!1),i}(this,n,e,r))&&(n.pendingcb++,i=function(e,t,r,n,i,o){if(!r){var s=function(e,t,r){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=p.from(t,r)),t}(t,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=t.objectMode?1:n.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(y.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),y.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))},y.prototype._writev=null,y.prototype.end=function(e,t,r){var n=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!==e&&void 0!==e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||function(e,t,r){t.ending=!0,R(e,t),r&&(t.finished?o.nextTick(r):e.once("finish",r)),t.ended=!0,e.writable=!1}(this,n,r)},Object.defineProperty(y.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),y.prototype.destroy=m.destroy,y.prototype._undestroy=m.undestroy,y.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,r(5),r(21).setImmediate,r(0))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if(!t.eol&&e)for(var r=0,n=e.length;r=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},r(34),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,r(0))},function(e,t,r){"use strict";(function(t,n){var i=r(6);e.exports=b;var o,s=r(36);b.ReadableState=y,r(11).EventEmitter;var a=function(e,t){return e.listeners(t).length},u=r(23),f=r(7).Buffer,c=t.Uint8Array||function(){},l=r(4);l.inherits=r(2);var h=r(40),p=void 0;p=h&&h.debuglog?h.debuglog("stream"):function(){};var d,m=r(41),v=r(24);l.inherits(b,u);var g=["error","close","destroy","pause","resume"];function y(e,t){o=o||r(1),e=e||{};var n=t instanceof o;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,s=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(s||0===s)?s:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new m,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(d||(d=r(25).StringDecoder),this.decoder=new d(e.encoding),this.encoding=e.encoding)}function b(e){if(o=o||r(1),!(this instanceof b))return new b(e);this._readableState=new y(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),u.call(this)}function w(e,t,r,n,i){var o,s=e._readableState;return null===t?(s.reading=!1,function(e,t){if(!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,R(e)}}(e,s)):(i||(o=function(e,t){var r;return function(e){return f.isBuffer(e)||e instanceof c}(t)||"string"==typeof t||void 0===t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk")),r}(s,t)),o?e.emit("error",o):s.objectMode||t&&t.length>0?("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===f.prototype||(t=function(e){return f.from(e)}(t)),n?s.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):_(e,s,t,!0):s.ended?e.emit("error",new Error("stream.push() after EOF")):(s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||0!==t.length?_(e,s,t,!1):P(e,s)):_(e,s,t,!1))):n||(s.reading=!1)),function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=E?e=E:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(p("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(x,e):x(e))}function x(e){p("emit readable"),e.emit("readable"),O(e)}function P(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(T,e,t))}function T(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=function(e,t,r){var n;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),0==(e-=s)){s===o.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++n}return t.length-=n,i}(e,t):function(e,t){var r=f.allocUnsafe(e),n=t.head,i=1;for(n.data.copy(r),e-=n.data.length;n=n.next;){var o=n.data,s=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,s),0==(e-=s)){s===o.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++i}return t.length-=i,r}(e,t),n}(e,t.buffer,t.decoder),r);var r}function k(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(j,t,e))}function j(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function M(e,t){for(var r=0,n=e.length;r=t.highWaterMark||t.ended))return p("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?k(this):R(this),null;if(0===(e=S(e,t))&&t.ended)return 0===t.length&&k(this),null;var n,i=t.needReadable;return p("need readable",i),(0===t.length||t.length-e0?C(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&k(this)),null!==n&&this.emit("data",n),n},b.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},b.prototype.pipe=function(e,t){var r=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,p("pipe count=%d opts=%j",o.pipesCount,t);var u=t&&!1===t.end||e===n.stdout||e===n.stderr?y:f;function f(){p("onend"),e.end()}o.endEmitted?i.nextTick(u):r.once("end",u),e.on("unpipe",function t(n,i){p("onunpipe"),n===r&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,p("cleanup"),e.removeListener("close",v),e.removeListener("finish",g),e.removeListener("drain",c),e.removeListener("error",m),e.removeListener("unpipe",t),r.removeListener("end",f),r.removeListener("end",y),r.removeListener("data",d),l=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||c())});var c=function(e){return function(){var t=e._readableState;p("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&a(e,"data")&&(t.flowing=!0,O(e))}}(r);e.on("drain",c);var l=!1,h=!1;function d(t){p("ondata"),h=!1,!1!==e.write(t)||h||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==M(o.pipes,e))&&!l&&(p("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,h=!0),r.pause())}function m(t){p("onerror",t),y(),e.removeListener("error",m),0===a(e,"error")&&e.emit("error",t)}function v(){e.removeListener("finish",g),y()}function g(){p("onfinish"),e.removeListener("close",v),y()}function y(){p("unpipe"),r.unpipe(e)}return r.on("data",d),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?s(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",m),e.once("close",v),e.once("finish",g),e.emit("pipe",r),o.flowing||(p("pipe resume"),r.resume()),e},b.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r),this);if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function u(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function f(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function c(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function l(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function h(e){return e.toString(this.encoding)}function p(e){return e&&e.length?this.write(e):""}t.StringDecoder=o,o.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0?(i>0&&(e.lastNeed=i-1),i):--n=0?(i>0&&(e.lastNeed=i-2),i):--n=0?(i>0&&(2===i?i=0:e.lastNeed=i-3),i):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},o.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},function(e,t,r){"use strict";e.exports=o;var n=r(1),i=r(4);function o(e){if(!(this instanceof o))return new o(e);n.call(this,e),this._transformState={afterTransform:function(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length-1&&r.push(e[n]);return r},t.trimLeft=String.prototype.trimLeft?function(e){return e.trimLeft()}:function(e){return e.replace(/^\s+/,"")},t.trimRight=String.prototype.trimRight?function(e){return e.trimRight()}:function(e){return e.replace(/\s+$/,"")}}).call(this,r(3).Buffer)},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(t,r,n){var i=e.call(this,"Error: "+t+". JSON Line number: "+r+(n?" near: "+n:""))||this;return i.err=t,i.line=r,i.extra=n,i.name="CSV Parse Error",i}return n(t,e),t.column_mismatched=function(e,r){return new t("column_mismatched",e,r)},t.unclosed_quote=function(e,r){return new t("unclosed_quote",e,r)},t.fromJSON=function(e){return new t(e.err,e.line,e.extra)},t.prototype.toJSON=function(){return{err:this.err,line:this.line,extra:this.extra}},t}(Error);t.default=i},function(e,t,r){var n=r(16),i=r(67),o=r(68),s=n?n.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":s&&s in Object(e)?i(e):o(e)}},function(e,t){e.exports=function(e,t){return e===t||e!=e&&t!=t}},function(e,t,r){e.exports=r(32)},function(e,t,r){"use strict";var n=r(33),i=function(e,t){return new n.Converter(e,t)};i.csv=i,i.Converter=n.Converter,e.exports=i},function(e,t,r){"use strict";(function(e){var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var i=r(35),o=r(49),s=r(50),a=r(51),u=r(104),f=function(t){function f(r,n){void 0===n&&(n={});var i=t.call(this,n)||this;return i.options=n,i.params=o.mergeParams(r),i.runtime=s.initParseRuntime(i),i.result=new u.Result(i),i.processor=new a.ProcessorLocal(i),i.once("error",function(t){e(function(){i.result.processError(t),i.emit("done",t)})}),i.once("done",function(){i.processor.destroy()}),i}return n(f,t),f.prototype.preRawData=function(e){return this.runtime.preRawDataHook=e,this},f.prototype.preFileLine=function(e){return this.runtime.preFileLineHook=e,this},f.prototype.subscribe=function(e,t,r){return this.parseRuntime.subscribe={onNext:e,onError:t,onCompleted:r},this},f.prototype.fromFile=function(e,t){var n=this,i=r(!function(){var e=new Error("Cannot find module 'fs'");throw e.code="MODULE_NOT_FOUND",e}());return i.exists(e,function(r){r?i.createReadStream(e,t).pipe(n):n.emit("error",new Error("File does not exist. Check to make sure the file path to your csv is correct."))}),this},f.prototype.fromStream=function(e){return e.pipe(this),this},f.prototype.fromString=function(e){e.toString();var t=new i.Readable,r=0;return t._read=function(t){if(r>=e.length)this.push(null);else{var n=e.substr(r,t);this.push(n),r+=t}},this.fromStream(t)},f.prototype.then=function(e,t){var r=this;return new Promise(function(n,i){r.parseRuntime.then={onfulfilled:function(t){n(e?e(t):t)},onrejected:function(e){t?n(t(e)):i(e)}}})},Object.defineProperty(f.prototype,"parseParam",{get:function(){return this.params},enumerable:!0,configurable:!0}),Object.defineProperty(f.prototype,"parseRuntime",{get:function(){return this.runtime},enumerable:!0,configurable:!0}),f.prototype._transform=function(e,t,r){var n=this;this.processor.process(e).then(function(e){if(e.length>0)return n.runtime.started=!0,n.result.processResult(e)}).then(function(){n.emit("drained"),r()},function(e){n.runtime.hasError=!0,n.runtime.error=e,n.emit("error",e),r()})},f.prototype._flush=function(e){var t=this;this.processor.flush().then(function(e){if(e.length>0)return t.result.processResult(e)}).then(function(){t.processEnd(e)},function(r){t.emit("error",r),e()})},f.prototype.processEnd=function(e){this.result.endProcess(),this.emit("done"),e()},Object.defineProperty(f.prototype,"parsedLineNumber",{get:function(){return this.runtime.parsedLineNumber},enumerable:!0,configurable:!0}),f}(i.Transform);t.Converter=f}).call(this,r(21).setImmediate)},function(e,t,r){(function(e,t){!function(e,r){"use strict";if(!e.setImmediate){var n,i=1,o={},s=!1,a=e.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(e);u=u&&u.setTimeout?u:e,"[object process]"==={}.toString.call(e.process)?n=function(e){t.nextTick(function(){c(e)})}:function(){if(e.postMessage&&!e.importScripts){var t=!0,r=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=r,t}}()?function(){var t="setImmediate$"+Math.random()+"$",r=function(r){r.source===e&&"string"==typeof r.data&&0===r.data.indexOf(t)&&c(+r.data.slice(t.length))};e.addEventListener?e.addEventListener("message",r,!1):e.attachEvent("onmessage",r),n=function(r){e.postMessage(t+r,"*")}}():e.MessageChannel?function(){var e=new MessageChannel;e.port1.onmessage=function(e){c(e.data)},n=function(t){e.port2.postMessage(t)}}():a&&"onreadystatechange"in a.createElement("script")?function(){var e=a.documentElement;n=function(t){var r=a.createElement("script");r.onreadystatechange=function(){c(t),r.onreadystatechange=null,e.removeChild(r),r=null},e.appendChild(r)}}():n=function(e){setTimeout(c,0,e)},u.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),r=0;r0?n-4:n,l=0;l>16&255,a[u++]=t>>8&255,a[u++]=255&t;return 2===s&&(t=i[e.charCodeAt(l)]<<2|i[e.charCodeAt(l+1)]>>4,a[u++]=255&t),1===s&&(t=i[e.charCodeAt(l)]<<10|i[e.charCodeAt(l+1)]<<4|i[e.charCodeAt(l+2)]>>2,a[u++]=t>>8&255,a[u++]=255&t),a},t.fromByteArray=function(e){for(var t,r=e.length,i=r%3,o=[],s=0,a=r-i;sa?a:s+16383));return 1===i?(t=e[r-1],o.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],o.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"=")),o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function c(e){return n[e>>18&63]+n[e>>12&63]+n[e>>6&63]+n[63&e]}function l(e,t,r){for(var n,i=[],o=t;o>1,c=-7,l=r?i-1:0,h=r?-1:1,p=e[t+l];for(l+=h,o=p&(1<<-c)-1,p>>=-c,c+=a;c>0;o=256*o+e[t+l],l+=h,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=n;c>0;s=256*s+e[t+l],l+=h,c-=8);if(0===o)o=1-f;else{if(o===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),o-=f}return(p?-1:1)*s*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var s,a,u,f=8*o-i-1,c=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,d=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+l>=1?h/u:h*Math.pow(2,1-l))*u>=2&&(s++,u/=2),s+l>=c?(a=0,s=c):s+l>=1?(a=(t*u-1)*Math.pow(2,i),s+=l):(a=t*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;e[r+p]=255&a,p+=d,a/=256,i-=8);for(s=s<0;e[r+p]=255&s,p+=d,s/=256,f-=8);e[r+p-d]|=128*m}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t){},function(e,t,r){"use strict";var n=r(7).Buffer,i=r(42);function o(e,t,r){e.copy(t,r)}e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r},e.prototype.concat=function(e){if(0===this.length)return n.alloc(0);if(1===this.length)return this.head.data;for(var t=n.allocUnsafe(e>>>0),r=this.head,i=0;r;)o(r.data,t,i),i+=r.data.length,r=r.next;return t},e}(),i&&i.inspect&&i.inspect.custom&&(e.exports.prototype[i.inspect.custom]=function(){var e=i.inspect({length:this.length});return this.constructor.name+" "+e})},function(e,t){},function(e,t,r){(function(t){function r(e){try{if(!t.localStorage)return!1}catch(e){return!1}var r=t.localStorage[e];return null!=r&&"true"===String(r).toLowerCase()}e.exports=function(e,t){if(r("noDeprecation"))return e;var n=!1;return function(){if(!n){if(r("throwDeprecation"))throw new Error(t);r("traceDeprecation")?console.trace(t):console.warn(t),n=!0}return e.apply(this,arguments)}}}).call(this,r(0))},function(e,t,r){"use strict";e.exports=o;var n=r(26),i=r(4);function o(e){if(!(this instanceof o))return new o(e);n.call(this,e)}i.inherits=r(2),i.inherits(o,n),o.prototype._transform=function(e,t,r){r(null,e)}},function(e,t,r){e.exports=r(13)},function(e,t,r){e.exports=r(1)},function(e,t,r){e.exports=r(12).Transform},function(e,t,r){e.exports=r(12).PassThrough},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mergeParams=function(e){var t={delimiter:",",ignoreColumns:void 0,includeColumns:void 0,quote:'"',trim:!0,checkType:!1,ignoreEmpty:!1,noheader:!1,headers:void 0,flatKeys:!1,maxRowLength:0,checkColumn:!1,escape:'"',colParser:{},eol:void 0,alwaysSplitAtEOL:!1,output:"json",nullObject:!1,downstreamFormat:"line",needEmitAll:!0};for(var r in e||(e={}),e)e.hasOwnProperty(r)&&(Array.isArray(e[r])?t[r]=[].concat(e[r]):t[r]=e[r]);return t}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.initParseRuntime=function(e){var t=e.parseParam,r={needProcessIgnoreColumn:!1,needProcessIncludeColumn:!1,selectedColumns:void 0,ended:!1,hasError:!1,error:void 0,delimiter:e.parseParam.delimiter,eol:e.parseParam.eol,columnConv:[],headerType:[],headerTitle:[],headerFlag:[],headers:void 0,started:!1,parsedLineNumber:0,columnValueSetter:[]};return t.ignoreColumns&&(r.needProcessIgnoreColumn=!0),t.includeColumns&&(r.needProcessIncludeColumn=!0),r}},function(e,t,r){"use strict";(function(e){var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=r(52),s=r(53),a=i(r(14)),u=r(56),f=r(27),c=r(57),l=i(r(58)),h=i(r(28)),p=function(t){function r(){var e=null!==t&&t.apply(this,arguments)||this;return e.rowSplit=new c.RowSplit(e.converter),e.eolEmitted=!1,e._needEmitEol=void 0,e.headEmitted=!1,e._needEmitHead=void 0,e}return n(r,t),r.prototype.flush=function(){var e=this;if(this.runtime.csvLineBuffer&&this.runtime.csvLineBuffer.length>0){var t=this.runtime.csvLineBuffer;return this.runtime.csvLineBuffer=void 0,this.process(t,!0).then(function(t){return e.runtime.csvLineBuffer&&e.runtime.csvLineBuffer.length>0?Promise.reject(h.default.unclosed_quote(e.runtime.parsedLineNumber,e.runtime.csvLineBuffer.toString())):Promise.resolve(t)})}return Promise.resolve([])},r.prototype.destroy=function(){return Promise.resolve()},Object.defineProperty(r.prototype,"needEmitEol",{get:function(){return void 0===this._needEmitEol&&(this._needEmitEol=this.converter.listeners("eol").length>0),this._needEmitEol},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"needEmitHead",{get:function(){return void 0===this._needEmitHead&&(this._needEmitHead=this.converter.listeners("header").length>0),this._needEmitHead},enumerable:!0,configurable:!0}),r.prototype.process=function(e,t){var r,n=this;return void 0===t&&(t=!1),r=t?e.toString():s.prepareData(e,this.converter.parseRuntime),Promise.resolve().then(function(){return n.runtime.preRawDataHook?n.runtime.preRawDataHook(r):r}).then(function(e){return e&&e.length>0?n.processCSV(e,t):Promise.resolve([])})},r.prototype.processCSV=function(e,t){var r=this,n=this.params,i=this.runtime;i.eol||a.default(e,i),this.needEmitEol&&!this.eolEmitted&&i.eol&&(this.converter.emit("eol",i.eol),this.eolEmitted=!0),n.ignoreEmpty&&!i.started&&(e=f.trimLeft(e));var o=u.stringToLines(e,i);return t?(o.lines.push(o.partial),o.partial=""):this.prependLeftBuf(f.bufFromString(o.partial)),o.lines.length>0?(i.preFileLineHook?this.runPreLineHook(o.lines):Promise.resolve(o.lines)).then(function(e){return i.started||r.runtime.headers?r.processCSVBody(e):r.processDataWithHead(e)}):Promise.resolve([])},r.prototype.processDataWithHead=function(e){if(this.params.noheader)this.params.headers?this.runtime.headers=this.params.headers:this.runtime.headers=[];else{for(var t="",r=[];e.length;){var n=t+e.shift(),i=this.rowSplit.parse(n);if(i.closed){r=i.cells,t="";break}t=n+a.default(n,this.runtime)}if(this.prependLeftBuf(f.bufFromString(t)),0===r.length)return[];this.params.headers?this.runtime.headers=this.params.headers:this.runtime.headers=r}return(this.runtime.needProcessIgnoreColumn||this.runtime.needProcessIncludeColumn)&&this.filterHeader(),this.needEmitHead&&!this.headEmitted&&(this.converter.emit("header",this.runtime.headers),this.headEmitted=!0),this.processCSVBody(e)},r.prototype.filterHeader=function(){if(this.runtime.selectedColumns=[],this.runtime.headers){for(var e=this.runtime.headers,t=0;t=t.length)i();else if(r.preFileLineHook){var o=t[n],s=r.preFileLineHook(o,r.parsedLineNumber+n);if(n++,s&&s.then)s.then(function(o){t[n-1]=o,e(t,r,n,i)});else{for(t[n-1]=s;n0?e.concat([r.csvLineBuffer,t]):t}(t,r);r.csvLineBuffer=void 0;var o=function(e,t){var r=e.length-1;if(0!=(128&e[r])){for(;128==(192&e[r]);)r--;r--}return r!=e.length-1?(t.csvLineBuffer=e.slice(r+1),e.slice(0,r+1)):e}(n,r).toString("utf8");return!1===r.started?i.default(o):o}}).call(this,r(3).Buffer)},function(e,t,r){"use strict";(function(t){var n=r(55);e.exports=function(e){return"string"==typeof e&&65279===e.charCodeAt(0)?e.slice(1):t.isBuffer(e)&&n(e)&&239===e[0]&&187===e[1]&&191===e[2]?e.slice(3):e}}).call(this,r(3).Buffer)},function(e,t){e.exports=function(e){for(var t=0;t0),this._needEmitDelimiter},enumerable:!0,configurable:!0}),e.prototype.parse=function(e){if(0===e.length||this.conv.parseParam.ignoreEmpty&&0===e.trim().length)return{cells:[],closed:!0};var t=this.quote,r=this.trim;this.escape,(this.conv.parseRuntime.delimiter instanceof Array||"auto"===this.conv.parseRuntime.delimiter.toLowerCase())&&(this.conv.parseRuntime.delimiter=this.getDelimiter(e)),this.needEmitDelimiter&&!this.delimiterEmitted&&(this.conv.emit("delimiter",this.conv.parseRuntime.delimiter),this.delimiterEmitted=!0);var n=this.conv.parseRuntime.delimiter,i=e.split(n);if("off"===t){if(r)for(var o=0;or&&(n=t,r=i)}),n},e.prototype.isQuoteOpen=function(e){var t=this.quote,r=this.escape;return e[0]===t&&(e[1]!==t||e[1]===r&&(e[2]===t||2===e.length))},e.prototype.isQuoteClose=function(e){var t=this.quote,r=this.escape;this.conv.parseParam.trim&&(e=o.trimRight(e));for(var n=0,i=e.length-1;e[i]===t||e[i]===r;)i--,n++;return n%2!=0},e.prototype.escapeQuote=function(e){var t="es|"+this.quote+"|"+this.escape;void 0===this.cachedRegExp[t]&&(this.cachedRegExp[t]=new RegExp("\\"+this.escape+"\\"+this.quote,"g"));var r=this.cachedRegExp[t];return e.replace(r,this.quote)},e.prototype.parseMultiLines=function(e){for(var t=[],r="";e.length;){var n=r+e.shift(),s=this.parse(n);0===s.cells.length&&this.conv.parseParam.ignoreEmpty||(s.closed||this.conv.parseParam.alwaysSplitAtEOL?(this.conv.parseRuntime.selectedColumns?t.push(o.filterArray(s.cells,this.conv.parseRuntime.selectedColumns)):t.push(s.cells),r=""):r=n+(i.default(n,this.conv.parseRuntime)||"\n"))}return{rowsCells:t,partial:r}},e}();t.RowSplit=a},function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var i=n(r(28)),o=n(r(59)),s=/^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$/;function a(e,t,r){if(t.parseParam.checkColumn&&t.parseRuntime.headers&&e.length!==t.parseRuntime.headers.length)throw i.default.column_mismatched(t.parseRuntime.parsedLineNumber+r);return function(e,t,r){for(var n=!1,i={},o=0,s=e.length;o-1){for(var o=t.split("."),s=!0;o.length>0;)if(0===o.shift().length){s=!1;break}!s||n.parseParam.colParser[t]&&n.parseParam.colParser[t].flat?n.parseRuntime.columnValueSetter[i]=l:n.parseRuntime.columnValueSetter[i]=h}else n.parseRuntime.columnValueSetter[i]=l;!0===n.parseParam.nullObject&&"null"===r&&(r=null),n.parseRuntime.columnValueSetter[i](e,t,r)}function l(e,t,r){e[t]=r}function h(e,t,r){o.default(e,t,r)}function p(e,t,r,n){return n.parseRuntime.headerType[r]?n.parseRuntime.headerType[r]:t.indexOf("number#!")>-1?n.parseRuntime.headerType[r]=d:t.indexOf("string#!")>-1?n.parseRuntime.headerType[r]=m:n.parseParam.checkType?n.parseRuntime.headerType[r]=v:n.parseRuntime.headerType[r]=m}function d(e){var t=parseFloat(e);return isNaN(t)?e:t}function m(e){return e.toString()}function v(e){var t=e.trim();return""===t?m(e):s.test(t)?d(e):5===t.length&&"false"===t.toLowerCase()||4===t.length&&"true"===t.toLowerCase()?function(e){var t=e.trim();return 5!==t.length||"false"!==t.toLowerCase()}(e):"{"===t[0]&&"}"===t[t.length-1]||"["===t[0]&&"]"===t[t.length-1]?function(e){try{return JSON.parse(e)}catch(t){return e}}(e):m(e)}},function(e,t,r){var n=r(60);e.exports=function(e,t,r){return null==e?e:n(e,t,r)}},function(e,t,r){var n=r(61),i=r(73),o=r(102),s=r(18),a=r(103);e.exports=function(e,t,r,u){if(!s(e))return e;for(var f=-1,c=(t=i(t,e)).length,l=c-1,h=e;null!=h&&++f-1}},function(e,t,r){var n=r(9);e.exports=function(e,t){var r=this.__data__,i=n(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}},function(e,t,r){var n=r(15)(r(17),"Map");e.exports=n},function(e,t,r){var n=r(10);e.exports=function(e){var t=n(this,e).delete(e);return this.size-=t?1:0,t}},function(e,t){e.exports=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}},function(e,t,r){var n=r(10);e.exports=function(e){return n(this,e).get(e)}},function(e,t,r){var n=r(10);e.exports=function(e){return n(this,e).has(e)}},function(e,t,r){var n=r(10);e.exports=function(e,t){var r=n(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}},function(e,t,r){var n=r(100);e.exports=function(e){return null==e?"":n(e)}},function(e,t,r){var n=r(16),i=r(101),o=r(19),s=r(20),a=n?n.prototype:void 0,u=a?a.toString:void 0;e.exports=function e(t){if("string"==typeof t)return t;if(o(t))return i(t,e)+"";if(s(t))return u?u.call(t):"";var r=t+"";return"0"==r&&1/t==-1/0?"-0":r}},function(e,t){e.exports=function(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r-1&&e%1==0&&e0||this.converter.listeners("readable").length>0),this._needPushDownstream},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"needEmitAll",{get:function(){return!!this.converter.parseRuntime.then&&this.converter.parseParam.needEmitAll},enumerable:!0,configurable:!0}),e.prototype.processResult=function(e){var t=this,r=this.converter.parseRuntime.parsedLineNumber;return this.needPushDownstream&&"array"===this.converter.parseParam.downstreamFormat&&0===r&&o(this.converter,"["+n.EOL),new Promise(function(r,n){t.needEmitLine?function e(t,r,n,i,s){if(n>=t.length)s();else if(r.parseRuntime.subscribe&&r.parseRuntime.subscribe.onNext){var a=r.parseRuntime.subscribe.onNext,u=t[n],f=a(u,r.parseRuntime.parsedLineNumber+n);if(n++,f&&f.then)f.then(function(){!function(t,r,n,i,s,a,u){s&&o(n,u),e(t,n,i,s,a)}(t,0,r,n,i,s,u)},s);else{for(i&&o(r,u);n * @license MIT */ -var n=r(38),i=r(39),o=r(40);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(s()=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|t}function d(t,e){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return N(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return H(t).length;default:if(n)return N(t).length;e=(""+e).toLowerCase(),n=!0}}function _(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function v(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:y(t,e,r,n,i);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):y(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function y(t,e,r,n,i){var o,s=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var l=-1;for(o=r;oa&&(r=a-u),o=r;o>=0;o--){for(var f=!0,h=0;hi&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function x(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function j(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:c>223?3:c>191?2:1;if(i+f<=r)switch(f){case 1:c<128&&(l=c);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&c)<<6|63&o)>127&&(l=u);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(u=(15&c)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(l=u)}null===l?(l=65533,f=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=f}return function(t){var e=t.length;if(e<=S)return String.fromCharCode.apply(String,t);for(var r="",n=0;nthis.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return T(this,e,r);case"utf8":case"utf-8":return j(this,e,r);case"ascii":return R(this,e,r);case"latin1":case"binary":return k(this,e,r);case"base64":return x(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),""},u.prototype.compare=function(t,e,r,n,i){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,i>>>=0,this===t)return 0;for(var o=i-n,s=r-e,a=Math.min(o,s),c=this.slice(n,i),l=t.slice(e,r),f=0;fi)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return m(this,t,e,r);case"utf8":case"utf-8":return g(this,t,e,r);case"ascii":return b(this,t,e,r);case"latin1":case"binary":return w(this,t,e,r);case"base64":return E(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var S=4096;function R(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;in)&&(r=n);for(var i="",o=e;or)throw new RangeError("Trying to access beyond buffer length")}function A(t,e,r,n,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function F(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i>>8*(n?i:1-i)}function L(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i>>8*(n?i:3-i)&255}function M(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function B(t,e,r,n,o){return o||M(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function D(t,e,r,n,o){return o||M(t,0,r,8),i.write(t,e,r,n,52,8),r+8}u.prototype.slice=function(t,e){var r,n=this.length;if(t=~~t,e=void 0===e?n:~~e,t<0?(t+=n)<0&&(t=0):t>n&&(t=n),e<0?(e+=n)<0&&(e=0):e>n&&(e=n),e0&&(i*=256);)n+=this[t+--e]*i;return n},u.prototype.readUInt8=function(t,e){return e||O(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return e||O(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return e||O(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,e){return e||O(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function(t,e){return e||O(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||O(t,e,this.length);for(var n=this[t],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||O(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return e||O(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){e||O(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){e||O(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return e||O(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return e||O(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return e||O(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return e||O(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return e||O(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return e||O(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,e,r,n){t=+t,e|=0,r|=0,n||A(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o=0&&(o*=256);)this[e+i]=t/o&255;return e+r},u.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||A(this,t,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||A(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):F(this,t,e,!0),e+2},u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||A(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):F(this,t,e,!1),e+2},u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||A(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):L(this,t,e,!0),e+4},u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||A(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):L(this,t,e,!1),e+4},u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);A(this,t,e,r,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o>0)-a&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);A(this,t,e,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||A(this,t,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||A(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):F(this,t,e,!0),e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||A(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):F(this,t,e,!1),e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||A(this,t,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):L(this,t,e,!0),e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||A(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):L(this,t,e,!1),e+4},u.prototype.writeFloatLE=function(t,e,r){return B(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return B(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return D(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return D(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--i)t[i+e]=this[i+r];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function H(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(I,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function V(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}}).call(this,r(0))},function(t,e){var r,n,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(r===setTimeout)return setTimeout(t,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(t){r=o}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(t){n=s}}();var u,c=[],l=!1,f=-1;function h(){l&&u&&(l=!1,u.length?c=u.concat(c):f=-1,c.length&&p())}function p(){if(!l){var t=a(h);l=!0;for(var e=c.length;e;){for(u=c,c=[];++f1)for(var r=1;r=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},r(35),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,r(0))},function(t,e){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function n(t){return"function"==typeof t}function i(t){return"object"==typeof t&&null!==t}function o(t){return void 0===t}t.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(t){if(!function(t){return"number"==typeof t}(t)||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},r.prototype.emit=function(t){var e,r,s,a,u,c;if(this._events||(this._events={}),"error"===t&&(!this._events.error||i(this._events.error)&&!this._events.error.length)){if((e=arguments[1])instanceof Error)throw e;var l=new Error('Uncaught, unspecified "error" event. ('+e+")");throw l.context=e,l}if(o(r=this._events[t]))return!1;if(n(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),r.apply(this,a)}else if(i(r))for(a=Array.prototype.slice.call(arguments,1),s=(c=r.slice()).length,u=0;u0&&this._events[t].length>s&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace()),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(t,e){if(!n(e))throw TypeError("listener must be a function");var r=!1;function i(){this.removeListener(t,i),r||(r=!0,e.apply(this,arguments))}return i.listener=e,this.on(t,i),this},r.prototype.removeListener=function(t,e){var r,o,s,a;if(!n(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(s=(r=this._events[t]).length,o=-1,r===e||n(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(i(r)){for(a=s;a-- >0;)if(r[a]===e||r[a].listener&&r[a].listener===e){o=a;break}if(o<0)return this;1===r.length?(r.length=0,delete this._events[t]):r.splice(o,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},r.prototype.removeAllListeners=function(t){var e,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(n(r=this._events[t]))this.removeListener(t,r);else if(r)for(;r.length;)this.removeListener(t,r[r.length-1]);return delete this._events[t],this},r.prototype.listeners=function(t){return this._events&&this._events[t]?n(this._events[t])?[this._events[t]]:this._events[t].slice():[]},r.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(n(e))return 1;if(e)return e.length}return 0},r.listenerCount=function(t,e){return t.listenerCount(e)}},function(t,e,r){(e=t.exports=r(23)).Stream=e,e.Readable=e,e.Writable=r(14),e.Duplex=r(1),e.Transform=r(27),e.PassThrough=r(45)},function(t,e,r){"use strict";(function(e,n,i){var o=r(6);function s(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var n=t.entry;for(t.entry=null;n;){var i=n.callback;e.pendingcb--,i(void 0),n=n.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}(e,t)}}t.exports=m;var a,u=!e.browser&&["v0.10","v0.9."].indexOf(e.version.slice(0,5))>-1?n:o.nextTick;m.WritableState=y;var c=r(5);c.inherits=r(2);var l,f={deprecate:r(44)},h=r(24),p=r(7).Buffer,d=i.Uint8Array||function(){},_=r(25);function v(){}function y(t,e){a=a||r(1),t=t||{};var n=e instanceof a;this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var i=t.highWaterMark,c=t.writableHighWaterMark,l=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(c||0===c)?c:l,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var f=!1===t.decodeStrings;this.decodeStrings=!f,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,n=r.sync,i=r.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,n,i){--e.pendingcb,r?(o.nextTick(i,n),o.nextTick(x,t,e),t._writableState.errorEmitted=!0,t.emit("error",n)):(i(n),t._writableState.errorEmitted=!0,t.emit("error",n),x(t,e))}(t,r,n,e,i);else{var s=E(r);s||r.corked||r.bufferProcessing||!r.bufferedRequest||w(t,r),n?u(b,t,r,s,i):b(t,r,s,i)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function m(t){if(a=a||r(1),!(l.call(m,this)||this instanceof a))return new m(t);this._writableState=new y(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),h.call(this)}function g(t,e,r,n,i,o,s){e.writelen=n,e.writecb=s,e.writing=!0,e.sync=!0,r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function b(t,e,r,n){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,n(),x(t,e)}function w(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var n=e.bufferedRequestCount,i=new Array(n),o=e.corkedRequestsFree;o.entry=r;for(var a=0,u=!0;r;)i[a]=r,r.isBuf||(u=!1),r=r.next,a+=1;i.allBuffers=u,g(t,e,!0,e.length,i,"",o.finish),e.pendingcb++,e.lastBufferedRequest=null,o.next?(e.corkedRequestsFree=o.next,o.next=null):e.corkedRequestsFree=new s(e),e.bufferedRequestCount=0}else{for(;r;){var c=r.chunk,l=r.encoding,f=r.callback;if(g(t,e,!1,e.objectMode?1:c.length,c,l,f),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function E(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function C(t,e){t._final(function(r){e.pendingcb--,r&&t.emit("error",r),e.prefinished=!0,t.emit("prefinish"),x(t,e)})}function x(t,e){var r=E(e);return r&&(function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,o.nextTick(C,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),r}c.inherits(m,h),y.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(y.prototype,"buffer",{get:f.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(l=Function.prototype[Symbol.hasInstance],Object.defineProperty(m,Symbol.hasInstance,{value:function(t){return!!l.call(this,t)||this===m&&t&&t._writableState instanceof y}})):l=function(t){return t instanceof this},m.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},m.prototype.write=function(t,e,r){var n=this._writableState,i=!1,s=!n.objectMode&&function(t){return p.isBuffer(t)||t instanceof d}(t);return s&&!p.isBuffer(t)&&(t=function(t){return p.from(t)}(t)),"function"==typeof e&&(r=e,e=null),s?e="buffer":e||(e=n.defaultEncoding),"function"!=typeof r&&(r=v),n.ended?function(t,e){var r=new Error("write after end");t.emit("error",r),o.nextTick(e,r)}(this,r):(s||function(t,e,r,n){var i=!0,s=!1;return null===r?s=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||e.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(t.emit("error",s),o.nextTick(n,s),i=!1),i}(this,n,t,r))&&(n.pendingcb++,i=function(t,e,r,n,i,o){if(!r){var s=function(t,e,r){return t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=p.from(e,r)),e}(e,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=e.objectMode?1:n.length;e.length+=a;var u=e.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(m.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),m.prototype._write=function(t,e,r){r(new Error("_write() is not implemented"))},m.prototype._writev=null,m.prototype.end=function(t,e,r){var n=this._writableState;"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!==t&&void 0!==t&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||function(t,e,r){e.ending=!0,x(t,e),r&&(e.finished?o.nextTick(r):t.once("finish",r)),e.ended=!0,t.writable=!1}(this,n,r)},Object.defineProperty(m.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),m.prototype.destroy=_.destroy,m.prototype._undestroy=_.undestroy,m.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,r(4),r(11).setImmediate,r(0))},function(t,e,r){(function(e,r,n){t.exports=function t(e,r,n){function i(s,a){if(!r[s]){if(!e[s]){var u="function"==typeof _dereq_&&_dereq_;if(!a&&u)return u(s,!0);if(o)return o(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var l=r[s]={exports:{}};e[s][0].call(l.exports,function(t){return i(e[s][1][t]||t)},l,l.exports,t,e,r,n)}return r[s].exports}for(var o="function"==typeof _dereq_&&_dereq_,s=0;s0;){var e=t.shift();if("function"==typeof e){var r=t.shift(),n=t.shift();e.call(r,n)}else e._settlePromises()}},u.prototype._drainQueues=function(){this._drainQueue(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,this._drainQueue(this._lateQueue)},u.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},u.prototype._reset=function(){this._isTickUsed=!1},r.exports=u,r.exports.firstLineError=i},{"./queue":26,"./schedule":29,"./util":36}],3:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){var i=!1,o=function(t,e){this._reject(e)},s=function(t,e){e.promiseRejectionQueued=!0,e.bindingPromise._then(o,o,null,this,t)},a=function(t,e){0==(50397184&this._bitField)&&this._resolveCallback(e.target)},u=function(t,e){e.promiseRejectionQueued||this._reject(t)};t.prototype.bind=function(o){i||(i=!0,t.prototype._propagateFrom=n.propagateFromFunction(),t.prototype._boundValue=n.boundValueFunction());var c=r(o),l=new t(e);l._propagateFrom(this,1);var f=this._target();if(l._setBoundTo(c),c instanceof t){var h={promiseRejectionQueued:!1,promise:l,target:f,bindingPromise:c};f._then(e,s,void 0,l,h),c._then(a,u,void 0,l,h),l._setOnCancel(c)}else l._resolveCallback(f);return l},t.prototype._setBoundTo=function(t){void 0!==t?(this._bitField=2097152|this._bitField,this._boundTo=t):this._bitField=-2097153&this._bitField},t.prototype._isBound=function(){return 2097152==(2097152&this._bitField)},t.bind=function(e,r){return t.resolve(r).bind(e)}}},{}],4:[function(t,e,r){"use strict";var n;"undefined"!=typeof Promise&&(n=Promise);var i=t("./promise")();i.noConflict=function(){try{Promise===i&&(Promise=n)}catch(t){}return i},e.exports=i},{"./promise":22}],5:[function(t,e,r){"use strict";var n=Object.create;if(n){var i=n(null),o=n(null);i[" size"]=o[" size"]=0}e.exports=function(e){var r=t("./util"),n=r.canEvaluate;function i(t){return function(t,n){var i;if(null!=t&&(i=t[n]),"function"!=typeof i){var o="Object "+r.classString(t)+" has no method '"+r.toString(n)+"'";throw new e.TypeError(o)}return i}(t,this.pop()).apply(t,this)}function o(t){return t[this]}function s(t){var e=+this;return e<0&&(e=Math.max(0,e+t.length)),t[e]}r.isIdentifier,e.prototype.call=function(t){var e=[].slice.call(arguments,1);return e.push(t),this._then(i,void 0,void 0,e,void 0)},e.prototype.get=function(t){var e;if("number"==typeof t)e=s;else if(n){var r=(void 0)(t);e=null!==r?r:o}else e=o;return this._then(e,void 0,void 0,t,void 0)}}},{"./util":36}],6:[function(t,e,r){"use strict";e.exports=function(e,r,n,i){var o=t("./util"),s=o.tryCatch,a=o.errorObj,u=e._async;e.prototype.break=e.prototype.cancel=function(){if(!i.cancellation())return this._warn("cancellation is disabled");for(var t=this,e=t;t._isCancellable();){if(!t._cancelBy(e)){e._isFollowing()?e._followee().cancel():e._cancelBranched();break}var r=t._cancellationParent;if(null==r||!r._isCancellable()){t._isFollowing()?t._followee().cancel():t._cancelBranched();break}t._isFollowing()&&t._followee().cancel(),t._setWillBeCancelled(),e=t,t=r}},e.prototype._branchHasCancelled=function(){this._branchesRemainingToCancel--},e.prototype._enoughBranchesHaveCancelled=function(){return void 0===this._branchesRemainingToCancel||this._branchesRemainingToCancel<=0},e.prototype._cancelBy=function(t){return t===this?(this._branchesRemainingToCancel=0,this._invokeOnCancel(),!0):(this._branchHasCancelled(),!!this._enoughBranchesHaveCancelled()&&(this._invokeOnCancel(),!0))},e.prototype._cancelBranched=function(){this._enoughBranchesHaveCancelled()&&this._cancel()},e.prototype._cancel=function(){this._isCancellable()&&(this._setCancelled(),u.invoke(this._cancelPromises,this,void 0))},e.prototype._cancelPromises=function(){this._length()>0&&this._settlePromises()},e.prototype._unsetOnCancel=function(){this._onCancelField=void 0},e.prototype._isCancellable=function(){return this.isPending()&&!this._isCancelled()},e.prototype.isCancellable=function(){return this.isPending()&&!this.isCancelled()},e.prototype._doInvokeOnCancel=function(t,e){if(o.isArray(t))for(var r=0;r=0)return r[t]}return t.prototype._promiseCreated=function(){},t.prototype._pushContext=function(){},t.prototype._popContext=function(){return null},t._peekContext=t.prototype._peekContext=function(){},n.prototype._pushContext=function(){void 0!==this._trace&&(this._trace._promiseCreated=null,r.push(this._trace))},n.prototype._popContext=function(){if(void 0!==this._trace){var t=r.pop(),e=t._promiseCreated;return t._promiseCreated=null,e}return null},n.CapturedTrace=null,n.create=function(){if(e)return new n},n.deactivateLongStackTraces=function(){},n.activateLongStackTraces=function(){var r=t.prototype._pushContext,o=t.prototype._popContext,s=t._peekContext,a=t.prototype._peekContext,u=t.prototype._promiseCreated;n.deactivateLongStackTraces=function(){t.prototype._pushContext=r,t.prototype._popContext=o,t._peekContext=s,t.prototype._peekContext=a,t.prototype._promiseCreated=u,e=!1},e=!0,t.prototype._pushContext=n.prototype._pushContext,t.prototype._popContext=n.prototype._popContext,t._peekContext=t.prototype._peekContext=i,t.prototype._promiseCreated=function(){var t=this._peekContext();t&&null==t._promiseCreated&&(t._promiseCreated=this)}},n}},{}],9:[function(t,r,n){"use strict";r.exports=function(r,n){var i,o,s,a=r._getDomain,u=r._async,c=t("./errors").Warning,l=t("./util"),f=l.canAttachTrace,h=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/,p=/\((?:timers\.js):\d+:\d+\)/,d=/[\/<\(](.+?):(\d+):(\d+)\)?\s*$/,_=null,v=null,y=!1,m=!(0==l.env("BLUEBIRD_DEBUG")),g=!(0==l.env("BLUEBIRD_WARNINGS")||!m&&!l.env("BLUEBIRD_WARNINGS")),b=!(0==l.env("BLUEBIRD_LONG_STACK_TRACES")||!m&&!l.env("BLUEBIRD_LONG_STACK_TRACES")),w=0!=l.env("BLUEBIRD_W_FORGOTTEN_RETURN")&&(g||!!l.env("BLUEBIRD_W_FORGOTTEN_RETURN"));r.prototype.suppressUnhandledRejections=function(){var t=this._target();t._bitField=-1048577&t._bitField|524288},r.prototype._ensurePossibleRejectionHandled=function(){if(0==(524288&this._bitField)){this._setRejectionIsUnhandled();var t=this;setTimeout(function(){t._notifyUnhandledRejection()},1)}},r.prototype._notifyUnhandledRejectionIsHandled=function(){q("rejectionHandled",i,void 0,this)},r.prototype._setReturnedNonUndefined=function(){this._bitField=268435456|this._bitField},r.prototype._returnedNonUndefined=function(){return 0!=(268435456&this._bitField)},r.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var t=this._settledValue();this._setUnhandledRejectionIsNotified(),q("unhandledRejection",o,t,this)}},r.prototype._setUnhandledRejectionIsNotified=function(){this._bitField=262144|this._bitField},r.prototype._unsetUnhandledRejectionIsNotified=function(){this._bitField=-262145&this._bitField},r.prototype._isUnhandledRejectionNotified=function(){return(262144&this._bitField)>0},r.prototype._setRejectionIsUnhandled=function(){this._bitField=1048576|this._bitField},r.prototype._unsetRejectionIsUnhandled=function(){this._bitField=-1048577&this._bitField,this._isUnhandledRejectionNotified()&&(this._unsetUnhandledRejectionIsNotified(),this._notifyUnhandledRejectionIsHandled())},r.prototype._isRejectionUnhandled=function(){return(1048576&this._bitField)>0},r.prototype._warn=function(t,e,r){return U(t,e,r||this)},r.onPossiblyUnhandledRejection=function(t){var e=a();o="function"==typeof t?null===e?t:l.domainBind(e,t):void 0},r.onUnhandledRejectionHandled=function(t){var e=a();i="function"==typeof t?null===e?t:l.domainBind(e,t):void 0};var E=function(){};r.longStackTraces=function(){if(u.haveItemsQueued()&&!J.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");if(!J.longStackTraces&&Y()){var t=r.prototype._captureStackTrace,e=r.prototype._attachExtraTrace;J.longStackTraces=!0,E=function(){if(u.haveItemsQueued()&&!J.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");r.prototype._captureStackTrace=t,r.prototype._attachExtraTrace=e,n.deactivateLongStackTraces(),u.enableTrampoline(),J.longStackTraces=!1},r.prototype._captureStackTrace=D,r.prototype._attachExtraTrace=I,n.activateLongStackTraces(),u.disableTrampolineIfNecessary()}},r.hasLongStackTraces=function(){return J.longStackTraces&&Y()};var C=function(){try{if("function"==typeof CustomEvent){var t=new CustomEvent("CustomEvent");return l.global.dispatchEvent(t),function(t,e){var r=new CustomEvent(t.toLowerCase(),{detail:e,cancelable:!0});return!l.global.dispatchEvent(r)}}return"function"==typeof Event?(t=new Event("CustomEvent"),l.global.dispatchEvent(t),function(t,e){var r=new Event(t.toLowerCase(),{cancelable:!0});return r.detail=e,!l.global.dispatchEvent(r)}):((t=document.createEvent("CustomEvent")).initCustomEvent("testingtheevent",!1,!0,{}),l.global.dispatchEvent(t),function(t,e){var r=document.createEvent("CustomEvent");return r.initCustomEvent(t.toLowerCase(),!1,!0,e),!l.global.dispatchEvent(r)})}catch(t){}return function(){return!1}}(),x=l.isNode?function(){return e.emit.apply(e,arguments)}:l.global?function(t){var e="on"+t.toLowerCase(),r=l.global[e];return!!r&&(r.apply(l.global,[].slice.call(arguments,1)),!0)}:function(){return!1};function j(t,e){return{promise:e}}var S={promiseCreated:j,promiseFulfilled:j,promiseRejected:j,promiseResolved:j,promiseCancelled:j,promiseChained:function(t,e,r){return{promise:e,child:r}},warning:function(t,e){return{warning:e}},unhandledRejection:function(t,e,r){return{reason:e,promise:r}},rejectionHandled:j},R=function(t){var e=!1;try{e=x.apply(null,arguments)}catch(t){u.throwLater(t),e=!0}var r=!1;try{r=C(t,S[t].apply(null,arguments))}catch(t){u.throwLater(t),r=!0}return r||e};function k(){return!1}function T(t,e,r){var n=this;try{t(e,r,function(t){if("function"!=typeof t)throw new TypeError("onCancel must be a function, got: "+l.toString(t));n._attachCancellationCallback(t)})}catch(t){return t}}function P(t){if(!this._isCancellable())return this;var e=this._onCancel();void 0!==e?l.isArray(e)?e.push(t):this._setOnCancel([e,t]):this._setOnCancel(t)}function O(){return this._onCancelField}function A(t){this._onCancelField=t}function F(){this._cancellationParent=void 0,this._onCancelField=void 0}function L(t,e){if(0!=(1&e)){this._cancellationParent=t;var r=t._branchesRemainingToCancel;void 0===r&&(r=0),t._branchesRemainingToCancel=r+1}0!=(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)}r.config=function(t){if("longStackTraces"in(t=Object(t))&&(t.longStackTraces?r.longStackTraces():!t.longStackTraces&&r.hasLongStackTraces()&&E()),"warnings"in t){var e=t.warnings;J.warnings=!!e,w=J.warnings,l.isObject(e)&&"wForgottenReturn"in e&&(w=!!e.wForgottenReturn)}if("cancellation"in t&&t.cancellation&&!J.cancellation){if(u.haveItemsQueued())throw new Error("cannot enable cancellation after promises are in use");r.prototype._clearCancellationData=F,r.prototype._propagateFrom=L,r.prototype._onCancel=O,r.prototype._setOnCancel=A,r.prototype._attachCancellationCallback=P,r.prototype._execute=T,M=L,J.cancellation=!0}return"monitoring"in t&&(t.monitoring&&!J.monitoring?(J.monitoring=!0,r.prototype._fireEvent=R):!t.monitoring&&J.monitoring&&(J.monitoring=!1,r.prototype._fireEvent=k)),r},r.prototype._fireEvent=k,r.prototype._execute=function(t,e,r){try{t(e,r)}catch(t){return t}},r.prototype._onCancel=function(){},r.prototype._setOnCancel=function(t){},r.prototype._attachCancellationCallback=function(t){},r.prototype._captureStackTrace=function(){},r.prototype._attachExtraTrace=function(){},r.prototype._clearCancellationData=function(){},r.prototype._propagateFrom=function(t,e){};var M=function(t,e){0!=(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)};function B(){var t=this._boundTo;return void 0!==t&&t instanceof r?t.isFulfilled()?t.value():void 0:t}function D(){this._trace=new X(this._peekContext())}function I(t,e){if(f(t)){var r=this._trace;if(void 0!==r&&e&&(r=r._parent),void 0!==r)r.attachExtraTrace(t);else if(!t.__stackCleaned__){var n=H(t);l.notEnumerableProp(t,"stack",n.message+"\n"+n.stack.join("\n")),l.notEnumerableProp(t,"__stackCleaned__",!0)}}}function U(t,e,n){if(J.warnings){var i,o=new c(t);if(e)n._attachExtraTrace(o);else if(J.longStackTraces&&(i=r._peekContext()))i.attachExtraTrace(o);else{var s=H(o);o.stack=s.message+"\n"+s.stack.join("\n")}R("warning",o)||V(o,"",!0)}}function N(t){for(var e=[],r=0;r0?function(t){for(var e=t.stack.replace(/\s+$/g,"").split("\n"),r=0;r0&&"SyntaxError"!=t.name&&(e=e.slice(r)),e}(t):[" (No stack trace)"],{message:r,stack:"SyntaxError"==t.name?e:N(e)}}function V(t,e,r){if("undefined"!=typeof console){var n;if(l.isObject(t)){var i=t.stack;n=e+v(i,t)}else n=e+String(t);"function"==typeof s?s(n,r):"function"!=typeof console.log&&"object"!=typeof console.log||console.log(n)}}function q(t,e,r,n){var i=!1;try{"function"==typeof e&&(i=!0,"rejectionHandled"===t?e(n):e(r,n))}catch(t){u.throwLater(t)}"unhandledRejection"===t?R(t,r,n)||i||V(r,"Unhandled rejection "):R(t,n)}function W(t){var e;if("function"==typeof t)e="[function "+(t.name||"anonymous")+"]";else{if(e=t&&"function"==typeof t.toString?t.toString():l.toString(t),/\[object [a-zA-Z0-9$_]+\]/.test(e))try{e=JSON.stringify(t)}catch(t){}0===e.length&&(e="(empty array)")}return"(<"+function(t){return t.length<41?t:t.substr(0,38)+"..."}(e)+">, no stack trace)"}function Y(){return"function"==typeof G}var $=function(){return!1},z=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;function Q(t){var e=t.match(z);if(e)return{fileName:e[1],line:parseInt(e[2],10)}}function X(t){this._parent=t,this._promisesCreated=0;var e=this._length=1+(void 0===t?0:t._length);G(this,X),e>32&&this.uncycle()}l.inherits(X,Error),n.CapturedTrace=X,X.prototype.uncycle=function(){var t=this._length;if(!(t<2)){for(var e=[],r={},n=0,i=this;void 0!==i;++n)e.push(i),i=i._parent;for(n=(t=this._length=n)-1;n>=0;--n){var o=e[n].stack;void 0===r[o]&&(r[o]=n)}for(n=0;n0&&(e[s-1]._parent=void 0,e[s-1]._length=1),e[n]._parent=void 0,e[n]._length=1;var a=n>0?e[n-1]:this;s=0;--c)e[c]._length=u,u++;return}}}},X.prototype.attachExtraTrace=function(t){if(!t.__stackCleaned__){this.uncycle();for(var e=H(t),r=e.message,n=[e.stack],i=this;void 0!==i;)n.push(N(i.stack.split("\n"))),i=i._parent;!function(t){for(var e=t[0],r=1;r=0;--a)if(n[a]===o){s=a;break}for(a=s;a>=0;--a){var u=n[a];if(e[i]!==u)break;e.pop(),i--}e=n}}(n),function(t){for(var e=0;e=0)return _=/@/,v=e,y=!0,function(t){t.stack=(new Error).stack};try{throw new Error}catch(t){n="stack"in t}return"stack"in i||!n||"number"!=typeof Error.stackTraceLimit?(v=function(t,e){return"string"==typeof t?t:"object"!=typeof e&&"function"!=typeof e||void 0===e.name||void 0===e.message?W(e):e.toString()},null):(_=t,v=e,function(t){Error.stackTraceLimit+=6;try{throw new Error}catch(e){t.stack=e.stack}Error.stackTraceLimit-=6})}();"undefined"!=typeof console&&void 0!==console.warn&&(s=function(t){console.warn(t)},l.isNode&&e.stderr.isTTY?s=function(t,e){var r=e?"":"";console.warn(r+t+"\n")}:l.isNode||"string"!=typeof(new Error).stack||(s=function(t,e){console.warn("%c"+t,e?"color: darkorange":"color: red")}));var J={warnings:g,longStackTraces:!1,cancellation:!1,monitoring:!1};return b&&r.longStackTraces(),{longStackTraces:function(){return J.longStackTraces},warnings:function(){return J.warnings},cancellation:function(){return J.cancellation},monitoring:function(){return J.monitoring},propagateFromFunction:function(){return M},boundValueFunction:function(){return B},checkForgottenReturns:function(t,e,r,n,i){if(void 0===t&&null!==e&&w){if(void 0!==i&&i._returnedNonUndefined())return;if(0==(65535&n._bitField))return;r&&(r+=" ");var o="",s="";if(e._trace){for(var a=e._trace.stack.split("\n"),u=N(a),c=u.length-1;c>=0;--c){var l=u[c];if(!p.test(l)){var f=l.match(d);f&&(o="at "+f[1]+":"+f[2]+":"+f[3]+" ");break}}if(u.length>0){var h=u[0];for(c=0;c0&&(s="\n"+a[c-1]);break}}}var _="a promise was created in a "+r+"handler "+o+"but was not returned from it, see http://goo.gl/rRqMUw"+s;n._warn(_,!0,e)}},setBounds:function(t,e){if(Y()){for(var r,n,i=t.stack.split("\n"),o=e.stack.split("\n"),s=-1,a=-1,u=0;u=a||($=function(t){if(h.test(t))return!0;var e=Q(t);return!!(e&&e.fileName===r&&s<=e.line&&e.line<=a)})}},warn:U,deprecated:function(t,e){var r=t+" is deprecated and will be removed in a future version.";return e&&(r+=" Use "+e+" instead."),U(r)},CapturedTrace:X,fireDomEvent:C,fireGlobalEvent:x}}},{"./errors":12,"./util":36}],10:[function(t,e,r){"use strict";e.exports=function(t){function e(){return this.value}function r(){throw this.reason}t.prototype.return=t.prototype.thenReturn=function(r){return r instanceof t&&r.suppressUnhandledRejections(),this._then(e,void 0,void 0,{value:r},void 0)},t.prototype.throw=t.prototype.thenThrow=function(t){return this._then(r,void 0,void 0,{reason:t},void 0)},t.prototype.catchThrow=function(t){if(arguments.length<=1)return this._then(void 0,r,void 0,{reason:t},void 0);var e=arguments[1];return this.caught(t,function(){throw e})},t.prototype.catchReturn=function(r){if(arguments.length<=1)return r instanceof t&&r.suppressUnhandledRejections(),this._then(void 0,e,void 0,{value:r},void 0);var n=arguments[1];return n instanceof t&&n.suppressUnhandledRejections(),this.caught(r,function(){return n})}}},{}],11:[function(t,e,r){"use strict";e.exports=function(t,e){var r=t.reduce,n=t.all;function i(){return n(this)}t.prototype.each=function(t){return r(this,t,e,0)._then(i,void 0,void 0,this,void 0)},t.prototype.mapSeries=function(t){return r(this,t,e,e)},t.each=function(t,n){return r(t,n,e,0)._then(i,void 0,void 0,t,void 0)},t.mapSeries=function(t,n){return r(t,n,e,e)}}},{}],12:[function(t,e,r){"use strict";var n,i,o=t("./es5"),s=o.freeze,a=t("./util"),u=a.inherits,c=a.notEnumerableProp;function l(t,e){function r(n){if(!(this instanceof r))return new r(n);c(this,"message","string"==typeof n?n:e),c(this,"name",t),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):Error.call(this)}return u(r,Error),r}var f=l("Warning","warning"),h=l("CancellationError","cancellation error"),p=l("TimeoutError","timeout error"),d=l("AggregateError","aggregate error");try{n=TypeError,i=RangeError}catch(t){n=l("TypeError","type error"),i=l("RangeError","range error")}for(var _="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),v=0;v<_.length;++v)"function"==typeof Array.prototype[_[v]]&&(d.prototype[_[v]]=Array.prototype[_[v]]);o.defineProperty(d.prototype,"length",{value:0,configurable:!1,writable:!0,enumerable:!0}),d.prototype.isOperational=!0;var y=0;function m(t){if(!(this instanceof m))return new m(t);c(this,"name","OperationalError"),c(this,"message",t),this.cause=t,this.isOperational=!0,t instanceof Error?(c(this,"message",t.message),c(this,"stack",t.stack)):Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}d.prototype.toString=function(){var t=Array(4*y+1).join(" "),e="\n"+t+"AggregateError of:\n";y++,t=Array(4*y+1).join(" ");for(var r=0;r1?t.cancelPromise._reject(e):t.cancelPromise._cancel(),t.cancelPromise=null,!0)}function f(){return p.call(this,this.promise._target()._settledValue())}function h(t){if(!l(this,t))return s.e=t,s}function p(t){var i=this.promise,a=this.handler;if(!this.called){this.called=!0;var u=this.isFinallyHandler()?a.call(i._boundValue()):a.call(i._boundValue(),t);if(u===n)return u;if(void 0!==u){i._setReturnedNonUndefined();var p=r(u,i);if(p instanceof e){if(null!=this.cancelPromise){if(p._isCancelled()){var d=new o("late cancellation observer");return i._attachExtraTrace(d),s.e=d,s}p.isPending()&&p._attachCancellationCallback(new c(this))}return p._then(f,h,void 0,this,void 0)}}}return i.isRejected()?(l(this),s.e=t,s):(l(this),t)}return u.prototype.isFinallyHandler=function(){return 0===this.type},c.prototype._resultCancelled=function(){l(this.finallyHandler)},e.prototype._passThrough=function(t,e,r,n){return"function"!=typeof t?this.then():this._then(r,n,void 0,new u(this,e,t),void 0)},e.prototype.lastly=e.prototype.finally=function(t){return this._passThrough(t,0,p,p)},e.prototype.tap=function(t){return this._passThrough(t,1,p)},e.prototype.tapCatch=function(t){var r=arguments.length;if(1===r)return this._passThrough(t,1,void 0,p);var n,o=new Array(r-1),s=0;for(n=0;n0&&"function"==typeof arguments[e]&&(t=arguments[e]);var n=[].slice.call(arguments);t&&n.pop();var i=new r(n).promise();return void 0!==t?i.spread(t):i}}},{"./util":36}],18:[function(t,e,r){"use strict";e.exports=function(e,r,n,i,o,s){var a=e._getDomain,u=t("./util"),c=u.tryCatch,l=u.errorObj,f=e._async;function h(t,e,r,n){this.constructor$(t),this._promise._captureStackTrace();var i=a();this._callback=null===i?e:u.domainBind(i,e),this._preservedValues=n===o?new Array(this.length()):null,this._limit=r,this._inFlight=0,this._queue=[],f.invoke(this._asyncInit,this,void 0)}function p(t,r,i,o){if("function"!=typeof r)return n("expecting a function but got "+u.classString(r));var s=0;if(void 0!==i){if("object"!=typeof i||null===i)return e.reject(new TypeError("options argument must be an object but it is "+u.classString(i)));if("number"!=typeof i.concurrency)return e.reject(new TypeError("'concurrency' must be a number but it is "+u.classString(i.concurrency)));s=i.concurrency}return new h(t,r,s="number"==typeof s&&isFinite(s)&&s>=1?s:0,o).promise()}u.inherits(h,r),h.prototype._asyncInit=function(){this._init$(void 0,-2)},h.prototype._init=function(){},h.prototype._promiseFulfilled=function(t,r){var n=this._values,o=this.length(),a=this._preservedValues,u=this._limit;if(r<0){if(n[r=-1*r-1]=t,u>=1&&(this._inFlight--,this._drainQueue(),this._isResolved()))return!0}else{if(u>=1&&this._inFlight>=u)return n[r]=t,this._queue.push(r),!1;null!==a&&(a[r]=t);var f=this._promise,h=this._callback,p=f._boundValue();f._pushContext();var d=c(h).call(p,t,r,o),_=f._popContext();if(s.checkForgottenReturns(d,_,null!==a?"Promise.filter":"Promise.map",f),d===l)return this._reject(d.e),!0;var v=i(d,this._promise);if(v instanceof e){var y=(v=v._target())._bitField;if(0==(50397184&y))return u>=1&&this._inFlight++,n[r]=v,v._proxy(this,-1*(r+1)),!1;if(0==(33554432&y))return 0!=(16777216&y)?(this._reject(v._reason()),!0):(this._cancel(),!0);d=v._value()}n[r]=d}return++this._totalResolved>=o&&(null!==a?this._filter(n,a):this._resolve(n),!0)},h.prototype._drainQueue=function(){for(var t=this._queue,e=this._limit,r=this._values;t.length>0&&this._inFlight1){o.deprecated("calling Promise.try with more than 1 argument");var c=arguments[1],l=arguments[2];n=s.isArray(c)?a(t).apply(l,c):a(t).call(l,c)}else n=a(t)();var f=u._popContext();return o.checkForgottenReturns(n,f,"Promise.try",u),u._resolveFromSyncValue(n),u},e.prototype._resolveFromSyncValue=function(t){t===s.errorObj?this._rejectCallback(t.e,!1):this._resolveCallback(t,!0)}}},{"./util":36}],20:[function(t,e,r){"use strict";var n=t("./util"),i=n.maybeWrapAsError,o=t("./errors").OperationalError,s=t("./es5"),a=/^(?:name|message|stack|cause)$/;function u(t){var e;if(function(t){return t instanceof Error&&s.getPrototypeOf(t)===Error.prototype}(t)){(e=new o(t)).name=t.name,e.message=t.message,e.stack=t.stack;for(var r=s.keys(t),i=0;i1){var r,n=new Array(e-1),i=0;for(r=0;r0&&"function"!=typeof t&&"function"!=typeof e){var r=".then() only accepts functions but was passed: "+c.classString(t);arguments.length>1&&(r+=", "+c.classString(e)),this._warn(r)}return this._then(t,e,void 0,void 0,void 0)},T.prototype.done=function(t,e){this._then(t,e,void 0,void 0,void 0)._setIsFinal()},T.prototype.spread=function(t){return"function"!=typeof t?o("expecting a function but got "+c.classString(t)):this.all()._then(t,void 0,void 0,y,void 0)},T.prototype.toJSON=function(){var t={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(t.fulfillmentValue=this.value(),t.isFulfilled=!0):this.isRejected()&&(t.rejectionReason=this.reason(),t.isRejected=!0),t},T.prototype.all=function(){return arguments.length>0&&this._warn(".all() was passed arguments but it does not take any"),new b(this).promise()},T.prototype.error=function(t){return this.caught(c.originatesFromRejection,t)},T.getNewLibraryCopy=r.exports,T.is=function(t){return t instanceof T},T.fromNode=T.fromCallback=function(t){var e=new T(v);e._captureStackTrace();var r=arguments.length>1&&!!Object(arguments[1]).multiArgs,n=k(t)(S(e,r));return n===R&&e._rejectCallback(n.e,!0),e._isFateSealed()||e._setAsyncGuaranteed(),e},T.all=function(t){return new b(t).promise()},T.cast=function(t){var e=g(t);return e instanceof T||((e=new T(v))._captureStackTrace(),e._setFulfilled(),e._rejectionHandler0=t),e},T.resolve=T.fulfilled=T.cast,T.reject=T.rejected=function(t){var e=new T(v);return e._captureStackTrace(),e._rejectCallback(t,!0),e},T.setScheduler=function(t){if("function"!=typeof t)throw new d("expecting a function but got "+c.classString(t));return h.setScheduler(t)},T.prototype._then=function(t,e,r,n,i){var o=void 0!==i,s=o?i:new T(v),u=this._target(),l=u._bitField;o||(s._propagateFrom(this,3),s._captureStackTrace(),void 0===n&&0!=(2097152&this._bitField)&&(n=0!=(50397184&l)?this._boundValue():u===this?void 0:this._boundTo),this._fireEvent("promiseChained",this,s));var f=a();if(0!=(50397184&l)){var p,d,y=u._settlePromiseCtx;0!=(33554432&l)?(d=u._rejectionHandler0,p=t):0!=(16777216&l)?(d=u._fulfillmentHandler0,p=e,u._unsetRejectionIsUnhandled()):(y=u._settlePromiseLateCancellationObserver,d=new _("late cancellation observer"),u._attachExtraTrace(d),p=e),h.invoke(y,u,{handler:null===f?p:"function"==typeof p&&c.domainBind(f,p),promise:s,receiver:n,value:d})}else u._addCallbacks(t,e,s,n,f);return s},T.prototype._length=function(){return 65535&this._bitField},T.prototype._isFateSealed=function(){return 0!=(117506048&this._bitField)},T.prototype._isFollowing=function(){return 67108864==(67108864&this._bitField)},T.prototype._setLength=function(t){this._bitField=-65536&this._bitField|65535&t},T.prototype._setFulfilled=function(){this._bitField=33554432|this._bitField,this._fireEvent("promiseFulfilled",this)},T.prototype._setRejected=function(){this._bitField=16777216|this._bitField,this._fireEvent("promiseRejected",this)},T.prototype._setFollowing=function(){this._bitField=67108864|this._bitField,this._fireEvent("promiseResolved",this)},T.prototype._setIsFinal=function(){this._bitField=4194304|this._bitField},T.prototype._isFinal=function(){return(4194304&this._bitField)>0},T.prototype._unsetCancelled=function(){this._bitField=-65537&this._bitField},T.prototype._setCancelled=function(){this._bitField=65536|this._bitField,this._fireEvent("promiseCancelled",this)},T.prototype._setWillBeCancelled=function(){this._bitField=8388608|this._bitField},T.prototype._setAsyncGuaranteed=function(){h.hasCustomScheduler()||(this._bitField=134217728|this._bitField)},T.prototype._receiverAt=function(t){var e=0===t?this._receiver0:this[4*t-4+3];if(e!==u)return void 0===e&&this._isBound()?this._boundValue():e},T.prototype._promiseAt=function(t){return this[4*t-4+2]},T.prototype._fulfillmentHandlerAt=function(t){return this[4*t-4+0]},T.prototype._rejectionHandlerAt=function(t){return this[4*t-4+1]},T.prototype._boundValue=function(){},T.prototype._migrateCallback0=function(t){t._bitField;var e=t._fulfillmentHandler0,r=t._rejectionHandler0,n=t._promise0,i=t._receiverAt(0);void 0===i&&(i=u),this._addCallbacks(e,r,n,i,null)},T.prototype._migrateCallbackAt=function(t,e){var r=t._fulfillmentHandlerAt(e),n=t._rejectionHandlerAt(e),i=t._promiseAt(e),o=t._receiverAt(e);void 0===o&&(o=u),this._addCallbacks(r,n,i,o,null)},T.prototype._addCallbacks=function(t,e,r,n,i){var o=this._length();if(o>=65531&&(o=0,this._setLength(0)),0===o)this._promise0=r,this._receiver0=n,"function"==typeof t&&(this._fulfillmentHandler0=null===i?t:c.domainBind(i,t)),"function"==typeof e&&(this._rejectionHandler0=null===i?e:c.domainBind(i,e));else{var s=4*o-4;this[s+2]=r,this[s+3]=n,"function"==typeof t&&(this[s+0]=null===i?t:c.domainBind(i,t)),"function"==typeof e&&(this[s+1]=null===i?e:c.domainBind(i,e))}return this._setLength(o+1),o},T.prototype._proxy=function(t,e){this._addCallbacks(void 0,void 0,e,t,null)},T.prototype._resolveCallback=function(t,e){if(0==(117506048&this._bitField)){if(t===this)return this._rejectCallback(n(),!1);var r=g(t,this);if(!(r instanceof T))return this._fulfill(t);e&&this._propagateFrom(r,2);var i=r._target();if(i!==this){var o=i._bitField;if(0==(50397184&o)){var s=this._length();s>0&&i._migrateCallback0(this);for(var a=1;a>>16)){if(t===this){var r=n();return this._attachExtraTrace(r),this._reject(r)}this._setFulfilled(),this._rejectionHandler0=t,(65535&e)>0&&(0!=(134217728&e)?this._settlePromises():h.settlePromises(this))}},T.prototype._reject=function(t){var e=this._bitField;if(!((117506048&e)>>>16)){if(this._setRejected(),this._fulfillmentHandler0=t,this._isFinal())return h.fatalError(t,c.isNode);(65535&e)>0?h.settlePromises(this):this._ensurePossibleRejectionHandled()}},T.prototype._fulfillPromises=function(t,e){for(var r=1;r0){if(0!=(16842752&t)){var r=this._fulfillmentHandler0;this._settlePromise0(this._rejectionHandler0,r,t),this._rejectPromises(e,r)}else{var n=this._rejectionHandler0;this._settlePromise0(this._fulfillmentHandler0,n,t),this._fulfillPromises(e,n)}this._setLength(0)}this._clearCancellationData()},T.prototype._settledValue=function(){var t=this._bitField;return 0!=(33554432&t)?this._rejectionHandler0:0!=(16777216&t)?this._fulfillmentHandler0:void 0},T.defer=T.pending=function(){return C.deprecated("Promise.defer","new Promise"),{promise:new T(v),resolve:P,reject:O}},c.notEnumerableProp(T,"_makeSelfResolutionError",n),t("./method")(T,v,g,o,C),t("./bind")(T,v,g,C),t("./cancel")(T,b,o,C),t("./direct_resolve")(T),t("./synchronous_inspection")(T),t("./join")(T,b,g,v,h,a),T.Promise=T,T.version="3.5.1",t("./map.js")(T,b,o,g,v,C),t("./call_get.js")(T),t("./using.js")(T,o,g,E,v,C),t("./timers.js")(T,v,C),t("./generators.js")(T,o,v,g,s,C),t("./nodeify.js")(T),t("./promisify.js")(T,v),t("./props.js")(T,b,g,o),t("./race.js")(T,v,g,o),t("./reduce.js")(T,b,o,g,v,C),t("./settle.js")(T,b,C),t("./some.js")(T,b,o),t("./filter.js")(T,v),t("./each.js")(T,v),t("./any.js")(T),c.toFastProperties(T),c.toFastProperties(T.prototype),A({a:1}),A({b:2}),A({c:3}),A(1),A(function(){}),A(void 0),A(!1),A(new T(v)),C.setBounds(f.firstLineError,c.lastLineError),T}},{"./any.js":1,"./async":2,"./bind":3,"./call_get.js":5,"./cancel":6,"./catch_filter":7,"./context":8,"./debuggability":9,"./direct_resolve":10,"./each.js":11,"./errors":12,"./es5":13,"./filter.js":14,"./finally":15,"./generators.js":16,"./join":17,"./map.js":18,"./method":19,"./nodeback":20,"./nodeify.js":21,"./promise_array":23,"./promisify.js":24,"./props.js":25,"./race.js":27,"./reduce.js":28,"./settle.js":30,"./some.js":31,"./synchronous_inspection":32,"./thenables":33,"./timers.js":34,"./using.js":35,"./util":36}],23:[function(t,e,r){"use strict";e.exports=function(e,r,n,i,o){var s=t("./util");function a(t){var n=this._promise=new e(r);t instanceof e&&n._propagateFrom(t,3),n._setOnCancel(this),this._values=t,this._length=0,this._totalResolved=0,this._init(void 0,-2)}return s.isArray,s.inherits(a,o),a.prototype.length=function(){return this._length},a.prototype.promise=function(){return this._promise},a.prototype._init=function t(r,o){var a=n(this._values,this._promise);if(a instanceof e){var u=(a=a._target())._bitField;if(this._values=a,0==(50397184&u))return this._promise._setAsyncGuaranteed(),a._then(t,this._reject,void 0,this,o);if(0==(33554432&u))return 0!=(16777216&u)?this._reject(a._reason()):this._cancel();a=a._value()}if(null!==(a=s.asArray(a)))0!==a.length?this._iterate(a):-5===o?this._resolveEmptyArray():this._resolve(function(t){switch(o){case-2:return[];case-3:return{};case-6:return new Map}}());else{var c=i("expecting an array or an iterable object but got "+s.classString(a)).reason();this._promise._rejectCallback(c,!1)}},a.prototype._iterate=function(t){var r=this.getActualLength(t.length);this._length=r,this._values=this.shouldCopyValues()?new Array(r):this._values;for(var i=this._promise,o=!1,s=null,a=0;a=this._length&&(this._resolve(this._values),!0)},a.prototype._promiseCancelled=function(){return this._cancel(),!0},a.prototype._promiseRejected=function(t){return this._totalResolved++,this._reject(t),!0},a.prototype._resultCancelled=function(){if(!this._isResolved()){var t=this._values;if(this._cancel(),t instanceof e)t.cancel();else for(var r=0;r=this._length){var r;if(this._isMap)r=function(t){for(var e=new o,r=t.length/2|0,n=0;n>1},e.prototype.props=function(){return f(this)},e.props=function(t){return f(t)}}},{"./es5":13,"./util":36}],26:[function(t,e,r){"use strict";function n(t){this._capacity=t,this._length=0,this._front=0}n.prototype._willBeOverCapacity=function(t){return this._capacity=this._length&&(this._resolve(this._values),!0)},o.prototype._promiseFulfilled=function(t,e){var r=new i;return r._bitField=33554432,r._settledValueField=t,this._promiseResolved(e,r)},o.prototype._promiseRejected=function(t,e){var r=new i;return r._bitField=16777216,r._settledValueField=t,this._promiseResolved(e,r)},e.settle=function(t){return n.deprecated(".settle()",".reflect()"),new o(t).promise()},e.prototype.settle=function(){return e.settle(this)}}},{"./util":36}],31:[function(t,e,r){"use strict";e.exports=function(e,r,n){var i=t("./util"),o=t("./errors").RangeError,s=t("./errors").AggregateError,a=i.isArray,u={};function c(t){this.constructor$(t),this._howMany=0,this._unwrap=!1,this._initialized=!1}function l(t,e){if((0|e)!==e||e<0)return n("expecting a positive integer\n\n See http://goo.gl/MqrFmX\n");var r=new c(t),i=r.promise();return r.setHowMany(e),r.init(),i}i.inherits(c,r),c.prototype._init=function(){if(this._initialized)if(0!==this._howMany){this._init$(void 0,-5);var t=a(this._values);!this._isResolved()&&t&&this._howMany>this._canPossiblyFulfill()&&this._reject(this._getRangeError(this.length()))}else this._resolve([])},c.prototype.init=function(){this._initialized=!0,this._init()},c.prototype.setUnwrap=function(){this._unwrap=!0},c.prototype.howMany=function(){return this._howMany},c.prototype.setHowMany=function(t){this._howMany=t},c.prototype._promiseFulfilled=function(t){return this._addFulfilled(t),this._fulfilled()===this.howMany()&&(this._values.length=this.howMany(),1===this.howMany()&&this._unwrap?this._resolve(this._values[0]):this._resolve(this._values),!0)},c.prototype._promiseRejected=function(t){return this._addRejected(t),this._checkOutcome()},c.prototype._promiseCancelled=function(){return this._values instanceof e||null==this._values?this._cancel():(this._addRejected(u),this._checkOutcome())},c.prototype._checkOutcome=function(){if(this.howMany()>this._canPossiblyFulfill()){for(var t=new s,e=this.length();e0?this._reject(t):this._cancel(),!0}return!1},c.prototype._fulfilled=function(){return this._totalResolved},c.prototype._rejected=function(){return this._values.length-this.length()},c.prototype._addRejected=function(t){this._values.push(t)},c.prototype._addFulfilled=function(t){this._values[this._totalResolved++]=t},c.prototype._canPossiblyFulfill=function(){return this.length()-this._rejected()},c.prototype._getRangeError=function(t){var e="Input array must contain at least "+this._howMany+" items but contains only "+t+" items";return new o(e)},c.prototype._resolveEmptyArray=function(){this._reject(this._getRangeError(0))},e.some=function(t,e){return l(t,e)},e.prototype.some=function(t){return l(this,t)},e._SomePromiseArray=c}},{"./errors":12,"./util":36}],32:[function(t,e,r){"use strict";e.exports=function(t){function e(t){void 0!==t?(t=t._target(),this._bitField=t._bitField,this._settledValueField=t._isFateSealed()?t._settledValue():void 0):(this._bitField=0,this._settledValueField=void 0)}e.prototype._settledValue=function(){return this._settledValueField};var r=e.prototype.value=function(){if(!this.isFulfilled())throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},n=e.prototype.error=e.prototype.reason=function(){if(!this.isRejected())throw new TypeError("cannot get rejection reason of a non-rejected promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},i=e.prototype.isFulfilled=function(){return 0!=(33554432&this._bitField)},o=e.prototype.isRejected=function(){return 0!=(16777216&this._bitField)},s=e.prototype.isPending=function(){return 0==(50397184&this._bitField)},a=e.prototype.isResolved=function(){return 0!=(50331648&this._bitField)};e.prototype.isCancelled=function(){return 0!=(8454144&this._bitField)},t.prototype.__isCancelled=function(){return 65536==(65536&this._bitField)},t.prototype._isCancelled=function(){return this._target().__isCancelled()},t.prototype.isCancelled=function(){return 0!=(8454144&this._target()._bitField)},t.prototype.isPending=function(){return s.call(this._target())},t.prototype.isRejected=function(){return o.call(this._target())},t.prototype.isFulfilled=function(){return i.call(this._target())},t.prototype.isResolved=function(){return a.call(this._target())},t.prototype.value=function(){return r.call(this._target())},t.prototype.reason=function(){var t=this._target();return t._unsetRejectionIsUnhandled(),n.call(t)},t.prototype._value=function(){return this._settledValue()},t.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue()},t.PromiseInspection=e}},{}],33:[function(t,e,r){"use strict";e.exports=function(e,r){var n=t("./util"),i=n.errorObj,o=n.isObject,s={}.hasOwnProperty;return function(t,a){if(o(t)){if(t instanceof e)return t;var u=function(t){try{return function(t){return t.then}(t)}catch(t){return i.e=t,i}}(t);if(u===i){a&&a._pushContext();var c=e.reject(u.e);return a&&a._popContext(),c}if("function"==typeof u)return function(t){try{return s.call(t,"_promise0")}catch(t){return!1}}(t)?(c=new e(r),t._then(c._fulfill,c._reject,void 0,c,null),c):function(t,o,s){var a=new e(r),u=a;s&&s._pushContext(),a._captureStackTrace(),s&&s._popContext();var c=!0,l=n.tryCatch(o).call(t,function(t){a&&(a._resolveCallback(t),a=null)},function(t){a&&(a._rejectCallback(t,c,!0),a=null)});return c=!1,a&&l===i&&(a._rejectCallback(l.e,!0,!0),a=null),u}(t,u,a)}return t}}},{"./util":36}],34:[function(t,e,r){"use strict";e.exports=function(e,r,n){var i=t("./util"),o=e.TimeoutError;function s(t){this.handle=t}s.prototype._resultCancelled=function(){clearTimeout(this.handle)};var a=function(t){return u(+this).thenReturn(t)},u=e.delay=function(t,i){var o,u;return void 0!==i?(o=e.resolve(i)._then(a,null,null,t,void 0),n.cancellation()&&i instanceof e&&o._setOnCancel(i)):(o=new e(r),u=setTimeout(function(){o._fulfill()},+t),n.cancellation()&&o._setOnCancel(new s(u)),o._captureStackTrace()),o._setAsyncGuaranteed(),o};function c(t){return clearTimeout(this.handle),t}function l(t){throw clearTimeout(this.handle),t}e.prototype.delay=function(t){return u(t,this)},e.prototype.timeout=function(t,e){var r,a;t=+t;var u=new s(setTimeout(function(){r.isPending()&&function(t,e,r){var n;n="string"!=typeof e?e instanceof Error?e:new o("operation timed out"):new o(e),i.markAsOriginatingFromRejection(n),t._attachExtraTrace(n),t._reject(n),null!=r&&r.cancel()}(r,e,a)},t));return n.cancellation()?(a=this.then(),(r=a._then(c,l,void 0,u,void 0))._setOnCancel(u)):r=this._then(c,l,void 0,u,void 0),r}}},{"./util":36}],35:[function(t,e,r){"use strict";e.exports=function(e,r,n,i,o,s){var a=t("./util"),u=t("./errors").TypeError,c=t("./util").inherits,l=a.errorObj,f=a.tryCatch,h={};function p(t){setTimeout(function(){throw t},0)}function d(t,r){var i=0,s=t.length,a=new e(o);return function o(){if(i>=s)return a._fulfill();var u=function(t){var e=n(t);return e!==t&&"function"==typeof t._isDisposable&&"function"==typeof t._getDisposer&&t._isDisposable()&&e._setDisposable(t._getDisposer()),e}(t[i++]);if(u instanceof e&&u._isDisposable()){try{u=n(u._getDisposer().tryDispose(r),t.promise)}catch(t){return p(t)}if(u instanceof e)return u._then(o,p,null,null,null)}o()}(),a}function _(t,e,r){this._data=t,this._promise=e,this._context=r}function v(t,e,r){this.constructor$(t,e,r)}function y(t){return _.isDisposer(t)?(this.resources[this.index]._setDisposable(t),t.promise()):t}function m(t){this.length=t,this.promise=null,this[t-1]=null}_.prototype.data=function(){return this._data},_.prototype.promise=function(){return this._promise},_.prototype.resource=function(){return this.promise().isFulfilled()?this.promise().value():h},_.prototype.tryDispose=function(t){var e=this.resource(),r=this._context;void 0!==r&&r._pushContext();var n=e!==h?this.doDispose(e,t):null;return void 0!==r&&r._popContext(),this._promise._unsetDisposable(),this._data=null,n},_.isDisposer=function(t){return null!=t&&"function"==typeof t.resource&&"function"==typeof t.tryDispose},c(v,_),v.prototype.doDispose=function(t,e){return this.data().call(t,t,e)},m.prototype._resultCancelled=function(){for(var t=this.length,r=0;r0},e.prototype._getDisposer=function(){return this._disposer},e.prototype._unsetDisposable=function(){this._bitField=-131073&this._bitField,this._disposer=void 0},e.prototype.disposer=function(t){if("function"==typeof t)return new v(t,this,i());throw new u}}},{"./errors":12,"./util":36}],36:[function(t,n,i){"use strict";var o,s=t("./es5"),a="undefined"==typeof navigator,u={e:{}},c="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==r?r:void 0!==this?this:null;function l(){try{var t=o;return o=null,t.apply(this,arguments)}catch(t){return u.e=t,u}}function f(t){return null==t||!0===t||!1===t||"string"==typeof t||"number"==typeof t}function h(t,e,r){if(f(t))return t;var n={value:r,configurable:!0,enumerable:!1,writable:!0};return s.defineProperty(t,e,n),t}var p=function(){var t=[Array.prototype,Object.prototype,Function.prototype],e=function(e){for(var r=0;r1,n=e.length>0&&!(1===e.length&&"constructor"===e[0]),i=d.test(t+"")&&s.names(t).length>0;if(r||n||i)return!0}return!1}catch(t){return!1}},isIdentifier:function(t){return _.test(t)},inheritedDataKeys:p,getDataPropertyOrDefault:function(t,e,r){if(!s.isES5)return{}.hasOwnProperty.call(t,e)?t[e]:void 0;var n=Object.getOwnPropertyDescriptor(t,e);return null!=n?null==n.get&&null==n.set?n.value:r:void 0},thrower:function(t){throw t},isArray:s.isArray,asArray:w,notEnumerableProp:h,isPrimitive:f,isObject:function(t){return"function"==typeof t||"object"==typeof t&&null!==t},isError:y,canEvaluate:a,errorObj:u,tryCatch:function(t){return o=t,l},inherits:function(t,e){var r={}.hasOwnProperty;function n(){for(var n in this.constructor=t,this.constructor$=e,e.prototype)r.call(e.prototype,n)&&"$"!==n.charAt(n.length-1)&&(this[n+"$"]=e.prototype[n])}return n.prototype=e.prototype,t.prototype=new n,t.prototype},withAppended:function(t,e){var r,n=t.length,i=new Array(n+1);for(r=0;r10||t[0]>0}(),j.isNode&&j.toFastProperties(e);try{throw new Error}catch(t){j.lastLineError=t}n.exports=j},{"./es5":13}]},{},[4])(4),"undefined"!=typeof window&&null!==window?window.P=window.Promise:"undefined"!=typeof self&&null!==self&&(self.P=self.Promise)}).call(this,r(4),r(0),r(11).setImmediate)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e){if(!e.eol&&t)for(var r=0,n=t.length;r0?("string"==typeof e||s.objectMode||Object.getPrototypeOf(e)===c.prototype||(e=function(t){return c.from(t)}(e)),n?s.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):w(t,s,e,!0):s.ended?t.emit("error",new Error("stream.push() after EOF")):(s.reading=!1,s.decoder&&!r?(e=s.decoder.write(e),s.objectMode||0!==e.length?w(t,s,e,!1):S(t,s)):w(t,s,e,!1))):n||(s.reading=!1)),function(t){return!t.ended&&(t.needReadable||t.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=E?t=E:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function x(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(p("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?i.nextTick(j,t):j(t))}function j(t){p("emit readable"),t.emit("readable"),P(t)}function S(t,e){e.readingMore||(e.readingMore=!0,i.nextTick(R,t,e))}function R(t,e){for(var r=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):r=function(t,e,r){var n;return to.length?o.length:t;if(s===o.length?i+=o:i+=o.slice(0,t),0==(t-=s)){s===o.length?(++n,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=o.slice(s));break}++n}return e.length-=n,i}(t,e):function(t,e){var r=c.allocUnsafe(t),n=e.head,i=1;for(n.data.copy(r),t-=n.data.length;n=n.next;){var o=n.data,s=t>o.length?o.length:t;if(o.copy(r,r.length-t,0,s),0==(t-=s)){s===o.length?(++i,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=o.slice(s));break}++i}return e.length-=i,r}(t,e),n}(t,e.buffer,e.decoder),r);var r}function A(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,i.nextTick(F,e,t))}function F(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function L(t,e){for(var r=0,n=t.length;r=e.highWaterMark||e.ended))return p("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?A(this):x(this),null;if(0===(t=C(t,e))&&e.ended)return 0===e.length&&A(this),null;var n,i=e.needReadable;return p("need readable",i),(0===e.length||e.length-t0?O(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&A(this)),null!==n&&this.emit("data",n),n},g.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},g.prototype.pipe=function(t,e){var r=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=t;break;case 1:o.pipes=[o.pipes,t];break;default:o.pipes.push(t)}o.pipesCount+=1,p("pipe count=%d opts=%j",o.pipesCount,e);var u=e&&!1===e.end||t===n.stdout||t===n.stderr?m:c;function c(){p("onend"),t.end()}o.endEmitted?i.nextTick(u):r.once("end",u),t.on("unpipe",function e(n,i){p("onunpipe"),n===r&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,p("cleanup"),t.removeListener("close",v),t.removeListener("finish",y),t.removeListener("drain",l),t.removeListener("error",_),t.removeListener("unpipe",e),r.removeListener("end",c),r.removeListener("end",m),r.removeListener("data",d),f=!0,!o.awaitDrain||t._writableState&&!t._writableState.needDrain||l())});var l=function(t){return function(){var e=t._readableState;p("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&a(t,"data")&&(e.flowing=!0,P(t))}}(r);t.on("drain",l);var f=!1,h=!1;function d(e){p("ondata"),h=!1,!1!==t.write(e)||h||((1===o.pipesCount&&o.pipes===t||o.pipesCount>1&&-1!==L(o.pipes,t))&&!f&&(p("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,h=!0),r.pause())}function _(e){p("onerror",e),m(),t.removeListener("error",_),0===a(t,"error")&&t.emit("error",e)}function v(){t.removeListener("finish",y),m()}function y(){p("onfinish"),t.removeListener("close",v),m()}function m(){p("unpipe"),r.unpipe(t)}return r.on("data",d),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?s(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",_),t.once("close",v),t.once("finish",y),t.emit("pipe",r),o.flowing||(p("pipe resume"),r.resume()),t},g.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r),this);if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function a(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function u(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function c(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function l(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function f(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function h(t){return t.toString(this.encoding)}function p(t){return t&&t.length?this.write(t):""}e.StringDecoder=o,o.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0?(i>0&&(t.lastNeed=i-1),i):--n=0?(i>0&&(t.lastNeed=i-2),i):--n=0?(i>0&&(2===i?i=0:t.lastNeed=i-3),i):0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)},o.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},function(t,e,r){"use strict";t.exports=o;var n=r(1),i=r(5);function o(t){if(!(this instanceof o))return new o(t);n.call(this,t),this._transformState={afterTransform:function(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=e&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length-1&&r.push(t[n]);return r},e.trimLeft=String.prototype.trimLeft?function(t){return t.trimLeft()}:function(t){return t.replace(/^\s+/,"")},e.trimRight=String.prototype.trimRight?function(t){return t.trimRight()}:function(t){return t.replace(/\s+$/,"")}}).call(this,r(3).Buffer)},function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=function(t){function e(e,r,n){var i=t.call(this,"Error: "+e+". JSON Line number: "+r+(n?" near: "+n:""))||this;return i.err=e,i.line=r,i.extra=n,i.name="CSV Parse Error",i}return n(e,t),e.column_mismatched=function(t,r){return new e("column_mismatched",t,r)},e.unclosed_quote=function(t,r){return new e("unclosed_quote",t,r)},e.fromJSON=function(t){return new e(t.err,t.line,t.extra)},e.prototype.toJSON=function(){return{err:this.err,line:this.line,extra:this.extra}},e}(Error);e.default=i},function(t,e,r){var n=r(18),i=r(68),o=r(69),s=n?n.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":s&&s in Object(t)?i(t):o(t)}},function(t,e){t.exports=function(t,e){return t===e||t!=t&&e!=e}},function(t,e,r){t.exports=r(33)},function(t,e,r){"use strict";var n=r(34),i=function(t,e){return new n.Converter(t,e)};i.csv=i,i.Converter=n.Converter,t.exports=i},function(t,e,r){"use strict";(function(t){var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=r(36),s=r(50),a=r(51),u=i(r(15)),c=r(52),l=r(105),f=function(e){function i(r,n){void 0===n&&(n={});var i=e.call(this,n)||this;return i.options=n,i.params=s.mergeParams(r),i.runtime=a.initParseRuntime(i),i.result=new l.Result(i),i.processor=new c.ProcessorLocal(i),i.once("error",function(e){t(function(){i.result.processError(e),i.emit("done",e)})}),i.once("done",function(){i.processor.destroy()}),i}return n(i,e),i.prototype.preRawData=function(t){return this.runtime.preRawDataHook=t,this},i.prototype.preFileLine=function(t){return this.runtime.preFileLineHook=t,this},i.prototype.subscribe=function(t,e,r){return this.parseRuntime.subscribe={onNext:t,onError:e,onCompleted:r},this},i.prototype.fromFile=function(t,e){var n=this,i=r(!function(){var t=new Error("Cannot find module 'fs'");throw t.code="MODULE_NOT_FOUND",t}());return i.exists(t,function(r){r?i.createReadStream(t,e).pipe(n):n.emit("error",new Error("File does not exist. Check to make sure the file path to your csv is correct."))}),this},i.prototype.fromStream=function(t){return t.pipe(this),this},i.prototype.fromString=function(t){t.toString();var e=new o.Readable,r=0;return e._read=function(e){if(r>=t.length)this.push(null);else{var n=t.substr(r,e);this.push(n),r+=e}},this.fromStream(e)},i.prototype.then=function(t,e){var r=this;return new u.default(function(n,i){r.parseRuntime.then={onfulfilled:function(e){n(t?t(e):e)},onrejected:function(t){e?n(e(t)):i(t)}}})},Object.defineProperty(i.prototype,"parseParam",{get:function(){return this.params},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"parseRuntime",{get:function(){return this.runtime},enumerable:!0,configurable:!0}),i.prototype._transform=function(t,e,r){var n=this;this.processor.process(t).then(function(t){if(t.length>0)return n.runtime.started=!0,n.result.processResult(t)}).then(function(){n.emit("drained"),r()},function(t){n.runtime.hasError=!0,n.runtime.error=t,n.emit("error",t),r()})},i.prototype._flush=function(t){var e=this;this.processor.flush().then(function(t){if(t.length>0)return e.result.processResult(t)}).then(function(){e.processEnd(t)},function(r){e.emit("error",r),t()})},i.prototype.processEnd=function(t){this.result.endProcess(),this.emit("done"),t()},Object.defineProperty(i.prototype,"parsedLineNumber",{get:function(){return this.runtime.parsedLineNumber},enumerable:!0,configurable:!0}),i}(o.Transform);e.Converter=f}).call(this,r(11).setImmediate)},function(t,e,r){(function(t,e){!function(t,r){"use strict";if(!t.setImmediate){var n,i=1,o={},s=!1,a=t.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(t);u=u&&u.setTimeout?u:t,"[object process]"==={}.toString.call(t.process)?n=function(t){e.nextTick(function(){l(t)})}:function(){if(t.postMessage&&!t.importScripts){var e=!0,r=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=r,e}}()?function(){var e="setImmediate$"+Math.random()+"$",r=function(r){r.source===t&&"string"==typeof r.data&&0===r.data.indexOf(e)&&l(+r.data.slice(e.length))};t.addEventListener?t.addEventListener("message",r,!1):t.attachEvent("onmessage",r),n=function(r){t.postMessage(e+r,"*")}}():t.MessageChannel?function(){var t=new MessageChannel;t.port1.onmessage=function(t){l(t.data)},n=function(e){t.port2.postMessage(e)}}():a&&"onreadystatechange"in a.createElement("script")?function(){var t=a.documentElement;n=function(e){var r=a.createElement("script");r.onreadystatechange=function(){l(e),r.onreadystatechange=null,t.removeChild(r),r=null},t.appendChild(r)}}():n=function(t){setTimeout(l,0,t)},u.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),r=0;r0?n-4:n,f=0;f>16&255,a[u++]=e>>8&255,a[u++]=255&e;return 2===s&&(e=i[t.charCodeAt(f)]<<2|i[t.charCodeAt(f+1)]>>4,a[u++]=255&e),1===s&&(e=i[t.charCodeAt(f)]<<10|i[t.charCodeAt(f+1)]<<4|i[t.charCodeAt(f+2)]>>2,a[u++]=e>>8&255,a[u++]=255&e),a},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],s=0,a=r-i;sa?a:s+16383));return 1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"=")),o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function l(t){return n[t>>18&63]+n[t>>12&63]+n[t>>6&63]+n[63&t]}function f(t,e,r){for(var n,i=[],o=e;o>1,l=-7,f=r?i-1:0,h=r?-1:1,p=t[e+f];for(f+=h,o=p&(1<<-l)-1,p>>=-l,l+=a;l>0;o=256*o+t[e+f],f+=h,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=n;l>0;s=256*s+t[e+f],f+=h,l-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),o-=c}return(p?-1:1)*s*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var s,a,u,c=8*o-i-1,l=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,d=n?1:-1,_=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=l):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+f>=1?h/u:h*Math.pow(2,1-f))*u>=2&&(s++,u/=2),s+f>=l?(a=0,s=l):s+f>=1?(a=(e*u-1)*Math.pow(2,i),s+=f):(a=e*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;t[r+p]=255&a,p+=d,a/=256,i-=8);for(s=s<0;t[r+p]=255&s,p+=d,s/=256,c-=8);t[r+p-d]|=128*_}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e){},function(t,e,r){"use strict";var n=r(7).Buffer,i=r(43);function o(t,e,r){t.copy(e,r)}t.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r},t.prototype.concat=function(t){if(0===this.length)return n.alloc(0);if(1===this.length)return this.head.data;for(var e=n.allocUnsafe(t>>>0),r=this.head,i=0;r;)o(r.data,e,i),i+=r.data.length,r=r.next;return e},t}(),i&&i.inspect&&i.inspect.custom&&(t.exports.prototype[i.inspect.custom]=function(){var t=i.inspect({length:this.length});return this.constructor.name+" "+t})},function(t,e){},function(t,e,r){(function(e){function r(t){try{if(!e.localStorage)return!1}catch(t){return!1}var r=e.localStorage[t];return null!=r&&"true"===String(r).toLowerCase()}t.exports=function(t,e){if(r("noDeprecation"))return t;var n=!1;return function(){if(!n){if(r("throwDeprecation"))throw new Error(e);r("traceDeprecation")?console.trace(e):console.warn(e),n=!0}return t.apply(this,arguments)}}}).call(this,r(0))},function(t,e,r){"use strict";t.exports=o;var n=r(27),i=r(5);function o(t){if(!(this instanceof o))return new o(t);n.call(this,t)}i.inherits=r(2),i.inherits(o,n),o.prototype._transform=function(t,e,r){r(null,t)}},function(t,e,r){t.exports=r(14)},function(t,e,r){t.exports=r(1)},function(t,e,r){t.exports=r(13).Transform},function(t,e,r){t.exports=r(13).PassThrough},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.mergeParams=function(t){var e={delimiter:",",ignoreColumns:void 0,includeColumns:void 0,quote:'"',trim:!0,checkType:!1,ignoreEmpty:!1,noheader:!1,headers:void 0,flatKeys:!1,maxRowLength:0,checkColumn:!1,escape:'"',colParser:{},eol:void 0,alwaysSplitAtEOL:!1,output:"json",nullObject:!1,downstreamFormat:"line",needEmitAll:!0};for(var r in t||(t={}),t)t.hasOwnProperty(r)&&(Array.isArray(t[r])?e[r]=[].concat(t[r]):e[r]=t[r]);return e}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.initParseRuntime=function(t){var e=t.parseParam,r={needProcessIgnoreColumn:!1,needProcessIncludeColumn:!1,selectedColumns:void 0,ended:!1,hasError:!1,error:void 0,delimiter:t.parseParam.delimiter,eol:t.parseParam.eol,columnConv:[],headerType:[],headerTitle:[],headerFlag:[],headers:void 0,started:!1,parsedLineNumber:0,columnValueSetter:[]};return e.ignoreColumns&&(r.needProcessIgnoreColumn=!0),e.includeColumns&&(r.needProcessIncludeColumn=!0),r}},function(t,e,r){"use strict";(function(t){var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=r(53),s=i(r(15)),a=r(54),u=i(r(16)),c=r(57),l=r(28),f=r(58),h=i(r(59)),p=i(r(29)),d=function(e){function r(){var t=null!==e&&e.apply(this,arguments)||this;return t.rowSplit=new f.RowSplit(t.converter),t.eolEmitted=!1,t._needEmitEol=void 0,t.headEmitted=!1,t._needEmitHead=void 0,t}return n(r,e),r.prototype.flush=function(){var t=this;if(this.runtime.csvLineBuffer&&this.runtime.csvLineBuffer.length>0){var e=this.runtime.csvLineBuffer;return this.runtime.csvLineBuffer=void 0,this.process(e,!0).then(function(e){return t.runtime.csvLineBuffer&&t.runtime.csvLineBuffer.length>0?s.default.reject(p.default.unclosed_quote(t.runtime.parsedLineNumber,t.runtime.csvLineBuffer.toString())):s.default.resolve(e)})}return s.default.resolve([])},r.prototype.destroy=function(){return s.default.resolve()},Object.defineProperty(r.prototype,"needEmitEol",{get:function(){return void 0===this._needEmitEol&&(this._needEmitEol=this.converter.listeners("eol").length>0),this._needEmitEol},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"needEmitHead",{get:function(){return void 0===this._needEmitHead&&(this._needEmitHead=this.converter.listeners("header").length>0),this._needEmitHead},enumerable:!0,configurable:!0}),r.prototype.process=function(t,e){var r,n=this;return void 0===e&&(e=!1),r=e?t.toString():a.prepareData(t,this.converter.parseRuntime),s.default.resolve().then(function(){return n.runtime.preRawDataHook?n.runtime.preRawDataHook(r):r}).then(function(t){return t&&t.length>0?n.processCSV(t,e):s.default.resolve([])})},r.prototype.processCSV=function(t,e){var r=this,n=this.params,i=this.runtime;i.eol||u.default(t,i),this.needEmitEol&&!this.eolEmitted&&i.eol&&(this.converter.emit("eol",i.eol),this.eolEmitted=!0),n.ignoreEmpty&&!i.started&&(t=l.trimLeft(t));var o=c.stringToLines(t,i);return e?(o.lines.push(o.partial),o.partial=""):this.prependLeftBuf(l.bufFromString(o.partial)),o.lines.length>0?(i.preFileLineHook?this.runPreLineHook(o.lines):s.default.resolve(o.lines)).then(function(t){return i.started||r.runtime.headers?r.processCSVBody(t):r.processDataWithHead(t)}):s.default.resolve([])},r.prototype.processDataWithHead=function(t){if(this.params.noheader)this.params.headers?this.runtime.headers=this.params.headers:this.runtime.headers=[];else{for(var e="",r=[];t.length;){var n=e+t.shift(),i=this.rowSplit.parse(n);if(i.closed){r=i.cells,e="";break}e=n+u.default(n,this.runtime)}if(this.prependLeftBuf(l.bufFromString(e)),0===r.length)return[];this.params.headers?this.runtime.headers=this.params.headers:this.runtime.headers=r}return(this.runtime.needProcessIgnoreColumn||this.runtime.needProcessIncludeColumn)&&this.filterHeader(),this.needEmitHead&&!this.headEmitted&&(this.converter.emit("header",this.runtime.headers),this.headEmitted=!0),this.processCSVBody(t)},r.prototype.filterHeader=function(){if(this.runtime.selectedColumns=[],this.runtime.headers){for(var t=this.runtime.headers,e=0;e=e.length)i();else if(r.preFileLineHook){var o=e[n],s=r.preFileLineHook(o,r.parsedLineNumber+n);if(n++,s&&s.then)s.then(function(o){e[n-1]=o,t(e,r,n,i)});else{for(e[n-1]=s;n0?t.concat([r.csvLineBuffer,e]):e}(e,r);r.csvLineBuffer=void 0;var o=function(t,e){var r=t.length-1;if(0!=(128&t[r])){for(;128==(192&t[r]);)r--;r--}return r!=t.length-1?(e.csvLineBuffer=t.slice(r+1),t.slice(0,r+1)):t}(n,r).toString("utf8");return!1===r.started?i.default(o):o}}).call(this,r(3).Buffer)},function(t,e,r){"use strict";(function(e){var n=r(56);t.exports=function(t){return"string"==typeof t&&65279===t.charCodeAt(0)?t.slice(1):e.isBuffer(t)&&n(t)&&239===t[0]&&187===t[1]&&191===t[2]?t.slice(3):t}}).call(this,r(3).Buffer)},function(t,e){t.exports=function(t){for(var e=0;e0),this._needEmitDelimiter},enumerable:!0,configurable:!0}),t.prototype.parse=function(t){if(0===t.length||this.conv.parseParam.ignoreEmpty&&0===t.trim().length)return{cells:[],closed:!0};var e=this.quote,r=this.trim;this.escape,(this.conv.parseRuntime.delimiter instanceof Array||"auto"===this.conv.parseRuntime.delimiter.toLowerCase())&&(this.conv.parseRuntime.delimiter=this.getDelimiter(t)),this.needEmitDelimiter&&!this.delimiterEmitted&&(this.conv.emit("delimiter",this.conv.parseRuntime.delimiter),this.delimiterEmitted=!0);var n=this.conv.parseRuntime.delimiter,i=t.split(n);if("off"===e){if(r)for(var o=0;or&&(n=e,r=i)}),n},t.prototype.isQuoteOpen=function(t){var e=this.quote,r=this.escape;return t[0]===e&&(t[1]!==e||t[1]===r&&(t[2]===e||2===t.length))},t.prototype.isQuoteClose=function(t){var e=this.quote,r=this.escape;this.conv.parseParam.trim&&(t=o.trimRight(t));for(var n=0,i=t.length-1;t[i]===e||t[i]===r;)i--,n++;return n%2!=0},t.prototype.escapeQuote=function(t){var e="es|"+this.quote+"|"+this.escape;void 0===this.cachedRegExp[e]&&(this.cachedRegExp[e]=new RegExp("\\"+this.escape+"\\"+this.quote,"g"));var r=this.cachedRegExp[e];return t.replace(r,this.quote)},t.prototype.parseMultiLines=function(t){for(var e=[],r="";t.length;){var n=r+t.shift(),s=this.parse(n);0===s.cells.length&&this.conv.parseParam.ignoreEmpty||(s.closed||this.conv.parseParam.alwaysSplitAtEOL?(this.conv.parseRuntime.selectedColumns?e.push(o.filterArray(s.cells,this.conv.parseRuntime.selectedColumns)):e.push(s.cells),r=""):r=n+(i.default(n,this.conv.parseRuntime)||"\n"))}return{rowsCells:e,partial:r}},t}();e.RowSplit=a},function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=n(r(29)),o=n(r(60)),s=/^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$/;function a(t,e,r){if(e.parseParam.checkColumn&&e.parseRuntime.headers&&t.length!==e.parseRuntime.headers.length)throw i.default.column_mismatched(e.parseRuntime.parsedLineNumber+r);return function(t,e,r){for(var n=!1,i={},o=0,s=t.length;o-1){for(var o=e.split("."),s=!0;o.length>0;)if(0===o.shift().length){s=!1;break}!s||n.parseParam.colParser[e]&&n.parseParam.colParser[e].flat?n.parseRuntime.columnValueSetter[i]=f:n.parseRuntime.columnValueSetter[i]=h}else n.parseRuntime.columnValueSetter[i]=f;!0===n.parseParam.nullObject&&"null"===r&&(r=null),n.parseRuntime.columnValueSetter[i](t,e,r)}function f(t,e,r){t[e]=r}function h(t,e,r){o.default(t,e,r)}function p(t,e,r,n){return n.parseRuntime.headerType[r]?n.parseRuntime.headerType[r]:e.indexOf("number#!")>-1?n.parseRuntime.headerType[r]=d:e.indexOf("string#!")>-1?n.parseRuntime.headerType[r]=_:n.parseParam.checkType?n.parseRuntime.headerType[r]=v:n.parseRuntime.headerType[r]=_}function d(t){var e=parseFloat(t);return isNaN(e)?t:e}function _(t){return t.toString()}function v(t){var e=t.trim();return""===e?_(t):s.test(e)?d(t):5===e.length&&"false"===e.toLowerCase()||4===e.length&&"true"===e.toLowerCase()?function(t){var e=t.trim();return 5!==e.length||"false"!==e.toLowerCase()}(t):"{"===e[0]&&"}"===e[e.length-1]||"["===e[0]&&"]"===e[e.length-1]?function(t){try{return JSON.parse(t)}catch(e){return t}}(t):_(t)}},function(t,e,r){var n=r(61);t.exports=function(t,e,r){return null==t?t:n(t,e,r)}},function(t,e,r){var n=r(62),i=r(74),o=r(103),s=r(20),a=r(104);t.exports=function(t,e,r,u){if(!s(t))return t;for(var c=-1,l=(e=i(e,t)).length,f=l-1,h=t;null!=h&&++c-1}},function(t,e,r){var n=r(9);t.exports=function(t,e){var r=this.__data__,i=n(r,t);return i<0?(++this.size,r.push([t,e])):r[i][1]=e,this}},function(t,e,r){var n=r(17)(r(19),"Map");t.exports=n},function(t,e,r){var n=r(10);t.exports=function(t){var e=n(this,t).delete(t);return this.size-=e?1:0,e}},function(t,e){t.exports=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}},function(t,e,r){var n=r(10);t.exports=function(t){return n(this,t).get(t)}},function(t,e,r){var n=r(10);t.exports=function(t){return n(this,t).has(t)}},function(t,e,r){var n=r(10);t.exports=function(t,e){var r=n(this,t),i=r.size;return r.set(t,e),this.size+=r.size==i?0:1,this}},function(t,e,r){var n=r(101);t.exports=function(t){return null==t?"":n(t)}},function(t,e,r){var n=r(18),i=r(102),o=r(21),s=r(22),a=n?n.prototype:void 0,u=a?a.toString:void 0;t.exports=function t(e){if("string"==typeof e)return e;if(o(e))return i(e,t)+"";if(s(e))return u?u.call(e):"";var r=e+"";return"0"==r&&1/e==-1/0?"-0":r}},function(t,e){t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length,i=Array(n);++r-1&&t%1==0&&t0||this.converter.listeners("readable").length>0),this._needPushDownstream},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"needEmitAll",{get:function(){return!!this.converter.parseRuntime.then&&this.converter.parseParam.needEmitAll},enumerable:!0,configurable:!0}),t.prototype.processResult=function(t){var e=this,r=this.converter.parseRuntime.parsedLineNumber;return this.needPushDownstream&&"array"===this.converter.parseParam.downstreamFormat&&0===r&&a(this.converter,"["+o.EOL),new i.default(function(r,n){e.needEmitLine?function t(e,r,n,i,o){if(n>=e.length)o();else if(r.parseRuntime.subscribe&&r.parseRuntime.subscribe.onNext){var s=r.parseRuntime.subscribe.onNext,u=e[n],c=s(u,r.parseRuntime.parsedLineNumber+n);if(n++,c&&c.then)c.then(function(){!function(e,r,n,i,o,s,u){o&&a(n,u),t(e,n,i,o,s)}(e,0,r,n,i,o,u)},o);else{for(i&&a(r,u);n=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function d(e,t){if(u.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return F(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Y(e).length;default:if(n)return F(e).length;t=(""+t).toLowerCase(),n=!0}}function m(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function v(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=u.from(t,n)),u.isBuffer(t))return 0===t.length?-1:g(e,t,r,n,i);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):g(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function g(e,t,r,n,i){var o,s=1,a=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,u/=2,r/=2}function f(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var c=-1;for(o=r;oa&&(r=a-u),o=r;o>=0;o--){for(var l=!0,h=0;hi&&(n=i):n=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function R(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function x(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i239?4:f>223?3:f>191?2:1;if(i+l<=r)switch(l){case 1:f<128&&(c=f);break;case 2:128==(192&(o=e[i+1]))&&(u=(31&f)<<6|63&o)>127&&(c=u);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(u=(15&f)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&f)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(c=u)}null===c?(c=65533,l=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=l}return function(e){var t=e.length;if(t<=P)return String.fromCharCode.apply(String,e);for(var r="",n=0;nthis.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return A(this,t,r);case"utf8":case"utf-8":return x(this,t,r);case"ascii":return T(this,t,r);case"latin1":case"binary":return L(this,t,r);case"base64":return R(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}.apply(this,arguments)},u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===u.compare(this,e)},u.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},u.prototype.compare=function(e,t,r,n,i){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;for(var o=i-n,s=r-t,a=Math.min(o,s),f=this.slice(n,i),c=e.slice(t,r),l=0;li)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return y(this,e,t,r);case"utf8":case"utf-8":return b(this,e,t,r);case"ascii":return w(this,e,t,r);case"latin1":case"binary":return _(this,e,t,r);case"base64":return E(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var P=4096;function T(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;in)&&(r=n);for(var i="",o=t;or)throw new RangeError("Trying to access beyond buffer length")}function k(e,t,r,n,i,o){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function j(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-r,2);i>>8*(n?i:1-i)}function M(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-r,4);i>>8*(n?i:3-i)&255}function B(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(e,t,r,n,o){return o||B(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function U(e,t,r,n,o){return o||B(e,0,r,8),i.write(e,t,r,n,52,8),r+8}u.prototype.slice=function(e,t){var r,n=this.length;if(e=~~e,t=void 0===t?n:~~t,e<0?(e+=n)<0&&(e=0):e>n&&(e=n),t<0?(t+=n)<0&&(t=0):t>n&&(t=n),t0&&(i*=256);)n+=this[e+--t]*i;return n},u.prototype.readUInt8=function(e,t){return t||C(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return t||C(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return t||C(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return t||C(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return t||C(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||C(e,t,this.length);for(var n=this[e],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*t)),n},u.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||C(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},u.prototype.readInt8=function(e,t){return t||C(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){t||C(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(e,t){t||C(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(e,t){return t||C(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return t||C(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return t||C(e,4,this.length),i.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||C(e,4,this.length),i.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||C(e,8,this.length),i.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||C(e,8,this.length),i.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,r,n){e=+e,t|=0,r|=0,n||k(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+i]=e/o&255;return t+r},u.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||k(this,e,t,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||k(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):j(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||k(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):j(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||k(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):M(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||k(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):M(this,e,t,!1),t+4},u.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);k(this,e,t,r,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o>0)-a&255;return t+r},u.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);k(this,e,t,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},u.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||k(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||k(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):j(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||k(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):j(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||k(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):M(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||k(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):M(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,r){return D(this,e,t,!0,r)},u.prototype.writeFloatBE=function(e,t,r){return D(this,e,t,!1,r)},u.prototype.writeDoubleLE=function(e,t,r){return U(this,e,t,!0,r)},u.prototype.writeDoubleBE=function(e,t,r){return U(this,e,t,!1,r)},u.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--i)e[i+t]=this[i+r];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function Y(e){return n.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(I,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function q(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}}).call(this,r(0))},function(e,t,r){(function(e){function r(e){return Object.prototype.toString.call(e)}t.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===r(e)},t.isBoolean=function(e){return"boolean"==typeof e},t.isNull=function(e){return null===e},t.isNullOrUndefined=function(e){return null==e},t.isNumber=function(e){return"number"==typeof e},t.isString=function(e){return"string"==typeof e},t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=function(e){return void 0===e},t.isRegExp=function(e){return"[object RegExp]"===r(e)},t.isObject=function(e){return"object"==typeof e&&null!==e},t.isDate=function(e){return"[object Date]"===r(e)},t.isError=function(e){return"[object Error]"===r(e)||e instanceof Error},t.isFunction=function(e){return"function"==typeof e},t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=e.isBuffer}).call(this,r(3).Buffer)},function(e,t){var r,n,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(r===setTimeout)return setTimeout(e,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(e){r=o}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(e){n=s}}();var u,f=[],c=!1,l=-1;function h(){c&&u&&(c=!1,u.length?f=u.concat(f):l=-1,f.length&&p())}function p(){if(!c){var e=a(h);c=!0;for(var t=f.length;t;){for(u=f,f=[];++l1)for(var r=1;r0&&this._events[e].length>s&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){if(!n(t))throw TypeError("listener must be a function");var r=!1;function i(){this.removeListener(e,i),r||(r=!0,t.apply(this,arguments))}return i.listener=t,this.on(e,i),this},r.prototype.removeListener=function(e,t){var r,o,s,a;if(!n(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(s=(r=this._events[e]).length,o=-1,r===t||n(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(i(r)){for(a=s;a-- >0;)if(r[a]===t||r[a].listener&&r[a].listener===t){o=a;break}if(o<0)return this;1===r.length?(r.length=0,delete this._events[e]):r.splice(o,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n(r=this._events[e]))this.removeListener(e,r);else if(r)for(;r.length;)this.removeListener(e,r[r.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){return this._events&&this._events[e]?n(this._events[e])?[this._events[e]]:this._events[e].slice():[]},r.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(n(t))return 1;if(t)return t.length}return 0},r.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,r){(t=e.exports=r(22)).Stream=t,t.Readable=t,t.Writable=r(13),t.Duplex=r(1),t.Transform=r(26),t.PassThrough=r(44)},function(e,t,r){"use strict";(function(t,n,i){var o=r(6);function s(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var n=e.entry;for(e.entry=null;n;){var i=n.callback;t.pendingcb--,i(void 0),n=n.next}t.corkedRequestsFree?t.corkedRequestsFree.next=e:t.corkedRequestsFree=e}(t,e)}}e.exports=y;var a,u=!t.browser&&["v0.10","v0.9."].indexOf(t.version.slice(0,5))>-1?n:o.nextTick;y.WritableState=g;var f=r(4);f.inherits=r(2);var c,l={deprecate:r(43)},h=r(23),p=r(7).Buffer,d=i.Uint8Array||function(){},m=r(24);function v(){}function g(e,t){a=a||r(1),e=e||{};var n=t instanceof a;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,f=e.writableHighWaterMark,c=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(f||0===f)?f:c,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===e.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,n=r.sync,i=r.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,n,i){--t.pendingcb,r?(o.nextTick(i,n),o.nextTick(R,e,t),e._writableState.errorEmitted=!0,e.emit("error",n)):(i(n),e._writableState.errorEmitted=!0,e.emit("error",n),R(e,t))}(e,r,n,t,i);else{var s=E(r);s||r.corked||r.bufferProcessing||!r.bufferedRequest||_(e,r),n?u(w,e,r,s,i):w(e,r,s,i)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function y(e){if(a=a||r(1),!(c.call(y,this)||this instanceof a))return new y(e);this._writableState=new g(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),h.call(this)}function b(e,t,r,n,i,o,s){t.writelen=n,t.writecb=s,t.writing=!0,t.sync=!0,r?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function w(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),R(e,t)}function _(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,i=new Array(n),o=t.corkedRequestsFree;o.entry=r;for(var a=0,u=!0;r;)i[a]=r,r.isBuf||(u=!1),r=r.next,a+=1;i.allBuffers=u,b(e,t,!0,t.length,i,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new s(t),t.bufferedRequestCount=0}else{for(;r;){var f=r.chunk,c=r.encoding,l=r.callback;if(b(e,t,!1,t.objectMode?1:f.length,f,c,l),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function E(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function S(e,t){e._final(function(r){t.pendingcb--,r&&e.emit("error",r),t.prefinished=!0,e.emit("prefinish"),R(e,t)})}function R(e,t){var r=E(t);return r&&(function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,o.nextTick(S,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),r}f.inherits(y,h),g.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(g.prototype,"buffer",{get:l.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(c=Function.prototype[Symbol.hasInstance],Object.defineProperty(y,Symbol.hasInstance,{value:function(e){return!!c.call(this,e)||this===y&&e&&e._writableState instanceof g}})):c=function(e){return e instanceof this},y.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},y.prototype.write=function(e,t,r){var n=this._writableState,i=!1,s=!n.objectMode&&function(e){return p.isBuffer(e)||e instanceof d}(e);return s&&!p.isBuffer(e)&&(e=function(e){return p.from(e)}(e)),"function"==typeof t&&(r=t,t=null),s?t="buffer":t||(t=n.defaultEncoding),"function"!=typeof r&&(r=v),n.ended?function(e,t){var r=new Error("write after end");e.emit("error",r),o.nextTick(t,r)}(this,r):(s||function(e,t,r,n){var i=!0,s=!1;return null===r?s=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),o.nextTick(n,s),i=!1),i}(this,n,e,r))&&(n.pendingcb++,i=function(e,t,r,n,i,o){if(!r){var s=function(e,t,r){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=p.from(t,r)),t}(t,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=t.objectMode?1:n.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(y.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),y.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))},y.prototype._writev=null,y.prototype.end=function(e,t,r){var n=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!==e&&void 0!==e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||function(e,t,r){t.ending=!0,R(e,t),r&&(t.finished?o.nextTick(r):e.once("finish",r)),t.ended=!0,e.writable=!1}(this,n,r)},Object.defineProperty(y.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),y.prototype.destroy=m.destroy,y.prototype._undestroy=m.undestroy,y.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,r(5),r(21).setImmediate,r(0))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if(!t.eol&&e)for(var r=0,n=e.length;r=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},r(34),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,r(0))},function(e,t,r){"use strict";(function(t,n){var i=r(6);e.exports=b;var o,s=r(36);b.ReadableState=y,r(11).EventEmitter;var a=function(e,t){return e.listeners(t).length},u=r(23),f=r(7).Buffer,c=t.Uint8Array||function(){},l=r(4);l.inherits=r(2);var h=r(40),p=void 0;p=h&&h.debuglog?h.debuglog("stream"):function(){};var d,m=r(41),v=r(24);l.inherits(b,u);var g=["error","close","destroy","pause","resume"];function y(e,t){o=o||r(1),e=e||{};var n=t instanceof o;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,s=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(s||0===s)?s:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new m,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(d||(d=r(25).StringDecoder),this.decoder=new d(e.encoding),this.encoding=e.encoding)}function b(e){if(o=o||r(1),!(this instanceof b))return new b(e);this._readableState=new y(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),u.call(this)}function w(e,t,r,n,i){var o,s=e._readableState;return null===t?(s.reading=!1,function(e,t){if(!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,R(e)}}(e,s)):(i||(o=function(e,t){var r;return function(e){return f.isBuffer(e)||e instanceof c}(t)||"string"==typeof t||void 0===t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk")),r}(s,t)),o?e.emit("error",o):s.objectMode||t&&t.length>0?("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===f.prototype||(t=function(e){return f.from(e)}(t)),n?s.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):_(e,s,t,!0):s.ended?e.emit("error",new Error("stream.push() after EOF")):(s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||0!==t.length?_(e,s,t,!1):P(e,s)):_(e,s,t,!1))):n||(s.reading=!1)),function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=E?e=E:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(p("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(x,e):x(e))}function x(e){p("emit readable"),e.emit("readable"),O(e)}function P(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(T,e,t))}function T(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=function(e,t,r){var n;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),0==(e-=s)){s===o.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++n}return t.length-=n,i}(e,t):function(e,t){var r=f.allocUnsafe(e),n=t.head,i=1;for(n.data.copy(r),e-=n.data.length;n=n.next;){var o=n.data,s=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,s),0==(e-=s)){s===o.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++i}return t.length-=i,r}(e,t),n}(e,t.buffer,t.decoder),r);var r}function k(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(j,t,e))}function j(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function M(e,t){for(var r=0,n=e.length;r=t.highWaterMark||t.ended))return p("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?k(this):R(this),null;if(0===(e=S(e,t))&&t.ended)return 0===t.length&&k(this),null;var n,i=t.needReadable;return p("need readable",i),(0===t.length||t.length-e0?C(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&k(this)),null!==n&&this.emit("data",n),n},b.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},b.prototype.pipe=function(e,t){var r=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,p("pipe count=%d opts=%j",o.pipesCount,t);var u=t&&!1===t.end||e===n.stdout||e===n.stderr?y:f;function f(){p("onend"),e.end()}o.endEmitted?i.nextTick(u):r.once("end",u),e.on("unpipe",function t(n,i){p("onunpipe"),n===r&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,p("cleanup"),e.removeListener("close",v),e.removeListener("finish",g),e.removeListener("drain",c),e.removeListener("error",m),e.removeListener("unpipe",t),r.removeListener("end",f),r.removeListener("end",y),r.removeListener("data",d),l=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||c())});var c=function(e){return function(){var t=e._readableState;p("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&a(e,"data")&&(t.flowing=!0,O(e))}}(r);e.on("drain",c);var l=!1,h=!1;function d(t){p("ondata"),h=!1,!1!==e.write(t)||h||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==M(o.pipes,e))&&!l&&(p("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,h=!0),r.pause())}function m(t){p("onerror",t),y(),e.removeListener("error",m),0===a(e,"error")&&e.emit("error",t)}function v(){e.removeListener("finish",g),y()}function g(){p("onfinish"),e.removeListener("close",v),y()}function y(){p("unpipe"),r.unpipe(e)}return r.on("data",d),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?s(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",m),e.once("close",v),e.once("finish",g),e.emit("pipe",r),o.flowing||(p("pipe resume"),r.resume()),e},b.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r),this);if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function u(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function f(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function c(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function l(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function h(e){return e.toString(this.encoding)}function p(e){return e&&e.length?this.write(e):""}t.StringDecoder=o,o.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0?(i>0&&(e.lastNeed=i-1),i):--n=0?(i>0&&(e.lastNeed=i-2),i):--n=0?(i>0&&(2===i?i=0:e.lastNeed=i-3),i):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},o.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},function(e,t,r){"use strict";e.exports=o;var n=r(1),i=r(4);function o(e){if(!(this instanceof o))return new o(e);n.call(this,e),this._transformState={afterTransform:function(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length-1&&r.push(e[n]);return r},t.trimLeft=String.prototype.trimLeft?function(e){return e.trimLeft()}:function(e){return e.replace(/^\s+/,"")},t.trimRight=String.prototype.trimRight?function(e){return e.trimRight()}:function(e){return e.replace(/\s+$/,"")}}).call(this,r(3).Buffer)},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(t,r,n){var i=e.call(this,"Error: "+t+". JSON Line number: "+r+(n?" near: "+n:""))||this;return i.err=t,i.line=r,i.extra=n,i.name="CSV Parse Error",i}return n(t,e),t.column_mismatched=function(e,r){return new t("column_mismatched",e,r)},t.unclosed_quote=function(e,r){return new t("unclosed_quote",e,r)},t.fromJSON=function(e){return new t(e.err,e.line,e.extra)},t.prototype.toJSON=function(){return{err:this.err,line:this.line,extra:this.extra}},t}(Error);t.default=i},function(e,t,r){var n=r(16),i=r(67),o=r(68),s=n?n.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":s&&s in Object(e)?i(e):o(e)}},function(e,t){e.exports=function(e,t){return e===t||e!=e&&t!=t}},function(e,t,r){e.exports=r(32)},function(e,t,r){"use strict";var n=r(33),i=function(e,t){return new n.Converter(e,t)};i.csv=i,i.Converter=n.Converter,e.exports=i},function(e,t,r){"use strict";(function(e){var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var i=r(35),o=r(49),s=r(50),a=r(51),u=r(104),f=function(t){function f(r,n){void 0===n&&(n={});var i=t.call(this,n)||this;return i.options=n,i.params=o.mergeParams(r),i.runtime=s.initParseRuntime(i),i.result=new u.Result(i),i.processor=new a.ProcessorLocal(i),i.once("error",function(t){e(function(){i.result.processError(t),i.emit("done",t)})}),i.once("done",function(){i.processor.destroy()}),i}return n(f,t),f.prototype.preRawData=function(e){return this.runtime.preRawDataHook=e,this},f.prototype.preFileLine=function(e){return this.runtime.preFileLineHook=e,this},f.prototype.subscribe=function(e,t,r){return this.parseRuntime.subscribe={onNext:e,onError:t,onCompleted:r},this},f.prototype.fromFile=function(e,t){var n=this,i=r(!function(){var e=new Error("Cannot find module 'fs'");throw e.code="MODULE_NOT_FOUND",e}());return i.exists(e,function(r){r?i.createReadStream(e,t).pipe(n):n.emit("error",new Error("File does not exist. Check to make sure the file path to your csv is correct."))}),this},f.prototype.fromStream=function(e){return e.pipe(this),this},f.prototype.fromString=function(e){e.toString();var t=new i.Readable,r=0;return t._read=function(t){if(r>=e.length)this.push(null);else{var n=e.substr(r,t);this.push(n),r+=t}},this.fromStream(t)},f.prototype.then=function(e,t){var r=this;return new Promise(function(n,i){r.parseRuntime.then={onfulfilled:function(t){n(e?e(t):t)},onrejected:function(e){t?n(t(e)):i(e)}}})},Object.defineProperty(f.prototype,"parseParam",{get:function(){return this.params},enumerable:!0,configurable:!0}),Object.defineProperty(f.prototype,"parseRuntime",{get:function(){return this.runtime},enumerable:!0,configurable:!0}),f.prototype._transform=function(e,t,r){var n=this;this.processor.process(e).then(function(e){if(e.length>0)return n.runtime.started=!0,n.result.processResult(e)}).then(function(){n.emit("drained"),r()},function(e){n.runtime.hasError=!0,n.runtime.error=e,n.emit("error",e),r()})},f.prototype._flush=function(e){var t=this;this.processor.flush().then(function(e){if(e.length>0)return t.result.processResult(e)}).then(function(){t.processEnd(e)},function(r){t.emit("error",r),e()})},f.prototype.processEnd=function(e){this.result.endProcess(),this.emit("done"),e()},Object.defineProperty(f.prototype,"parsedLineNumber",{get:function(){return this.runtime.parsedLineNumber},enumerable:!0,configurable:!0}),f}(i.Transform);t.Converter=f}).call(this,r(21).setImmediate)},function(e,t,r){(function(e,t){!function(e,r){"use strict";if(!e.setImmediate){var n,i=1,o={},s=!1,a=e.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(e);u=u&&u.setTimeout?u:e,"[object process]"==={}.toString.call(e.process)?n=function(e){t.nextTick(function(){c(e)})}:function(){if(e.postMessage&&!e.importScripts){var t=!0,r=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=r,t}}()?function(){var t="setImmediate$"+Math.random()+"$",r=function(r){r.source===e&&"string"==typeof r.data&&0===r.data.indexOf(t)&&c(+r.data.slice(t.length))};e.addEventListener?e.addEventListener("message",r,!1):e.attachEvent("onmessage",r),n=function(r){e.postMessage(t+r,"*")}}():e.MessageChannel?function(){var e=new MessageChannel;e.port1.onmessage=function(e){c(e.data)},n=function(t){e.port2.postMessage(t)}}():a&&"onreadystatechange"in a.createElement("script")?function(){var e=a.documentElement;n=function(t){var r=a.createElement("script");r.onreadystatechange=function(){c(t),r.onreadystatechange=null,e.removeChild(r),r=null},e.appendChild(r)}}():n=function(e){setTimeout(c,0,e)},u.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),r=0;r0?n-4:n,l=0;l>16&255,a[u++]=t>>8&255,a[u++]=255&t;return 2===s&&(t=i[e.charCodeAt(l)]<<2|i[e.charCodeAt(l+1)]>>4,a[u++]=255&t),1===s&&(t=i[e.charCodeAt(l)]<<10|i[e.charCodeAt(l+1)]<<4|i[e.charCodeAt(l+2)]>>2,a[u++]=t>>8&255,a[u++]=255&t),a},t.fromByteArray=function(e){for(var t,r=e.length,i=r%3,o=[],s=0,a=r-i;sa?a:s+16383));return 1===i?(t=e[r-1],o.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],o.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"=")),o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function c(e){return n[e>>18&63]+n[e>>12&63]+n[e>>6&63]+n[63&e]}function l(e,t,r){for(var n,i=[],o=t;o>1,c=-7,l=r?i-1:0,h=r?-1:1,p=e[t+l];for(l+=h,o=p&(1<<-c)-1,p>>=-c,c+=a;c>0;o=256*o+e[t+l],l+=h,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=n;c>0;s=256*s+e[t+l],l+=h,c-=8);if(0===o)o=1-f;else{if(o===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),o-=f}return(p?-1:1)*s*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var s,a,u,f=8*o-i-1,c=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,d=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+l>=1?h/u:h*Math.pow(2,1-l))*u>=2&&(s++,u/=2),s+l>=c?(a=0,s=c):s+l>=1?(a=(t*u-1)*Math.pow(2,i),s+=l):(a=t*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;e[r+p]=255&a,p+=d,a/=256,i-=8);for(s=s<0;e[r+p]=255&s,p+=d,s/=256,f-=8);e[r+p-d]|=128*m}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t){},function(e,t,r){"use strict";var n=r(7).Buffer,i=r(42);function o(e,t,r){e.copy(t,r)}e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r},e.prototype.concat=function(e){if(0===this.length)return n.alloc(0);if(1===this.length)return this.head.data;for(var t=n.allocUnsafe(e>>>0),r=this.head,i=0;r;)o(r.data,t,i),i+=r.data.length,r=r.next;return t},e}(),i&&i.inspect&&i.inspect.custom&&(e.exports.prototype[i.inspect.custom]=function(){var e=i.inspect({length:this.length});return this.constructor.name+" "+e})},function(e,t){},function(e,t,r){(function(t){function r(e){try{if(!t.localStorage)return!1}catch(e){return!1}var r=t.localStorage[e];return null!=r&&"true"===String(r).toLowerCase()}e.exports=function(e,t){if(r("noDeprecation"))return e;var n=!1;return function(){if(!n){if(r("throwDeprecation"))throw new Error(t);r("traceDeprecation")?console.trace(t):console.warn(t),n=!0}return e.apply(this,arguments)}}}).call(this,r(0))},function(e,t,r){"use strict";e.exports=o;var n=r(26),i=r(4);function o(e){if(!(this instanceof o))return new o(e);n.call(this,e)}i.inherits=r(2),i.inherits(o,n),o.prototype._transform=function(e,t,r){r(null,e)}},function(e,t,r){e.exports=r(13)},function(e,t,r){e.exports=r(1)},function(e,t,r){e.exports=r(12).Transform},function(e,t,r){e.exports=r(12).PassThrough},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mergeParams=function(e){var t={delimiter:",",ignoreColumns:void 0,includeColumns:void 0,quote:'"',trim:!0,checkType:!1,ignoreEmpty:!1,noheader:!1,headers:void 0,flatKeys:!1,maxRowLength:0,checkColumn:!1,escape:'"',colParser:{},eol:void 0,alwaysSplitAtEOL:!1,output:"json",nullObject:!1,downstreamFormat:"line",needEmitAll:!0};for(var r in e||(e={}),e)e.hasOwnProperty(r)&&(Array.isArray(e[r])?t[r]=[].concat(e[r]):t[r]=e[r]);return t}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.initParseRuntime=function(e){var t=e.parseParam,r={needProcessIgnoreColumn:!1,needProcessIncludeColumn:!1,selectedColumns:void 0,ended:!1,hasError:!1,error:void 0,delimiter:e.parseParam.delimiter,eol:e.parseParam.eol,columnConv:[],headerType:[],headerTitle:[],headerFlag:[],headers:void 0,started:!1,parsedLineNumber:0,columnValueSetter:[]};return t.ignoreColumns&&(r.needProcessIgnoreColumn=!0),t.includeColumns&&(r.needProcessIncludeColumn=!0),r}},function(e,t,r){"use strict";(function(e){var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=r(52),s=r(53),a=i(r(14)),u=r(56),f=r(27),c=r(57),l=i(r(58)),h=i(r(28)),p=function(t){function r(){var e=null!==t&&t.apply(this,arguments)||this;return e.rowSplit=new c.RowSplit(e.converter),e.eolEmitted=!1,e._needEmitEol=void 0,e.headEmitted=!1,e._needEmitHead=void 0,e}return n(r,t),r.prototype.flush=function(){var e=this;if(this.runtime.csvLineBuffer&&this.runtime.csvLineBuffer.length>0){var t=this.runtime.csvLineBuffer;return this.runtime.csvLineBuffer=void 0,this.process(t,!0).then(function(t){return e.runtime.csvLineBuffer&&e.runtime.csvLineBuffer.length>0?Promise.reject(h.default.unclosed_quote(e.runtime.parsedLineNumber,e.runtime.csvLineBuffer.toString())):Promise.resolve(t)})}return Promise.resolve([])},r.prototype.destroy=function(){return Promise.resolve()},Object.defineProperty(r.prototype,"needEmitEol",{get:function(){return void 0===this._needEmitEol&&(this._needEmitEol=this.converter.listeners("eol").length>0),this._needEmitEol},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"needEmitHead",{get:function(){return void 0===this._needEmitHead&&(this._needEmitHead=this.converter.listeners("header").length>0),this._needEmitHead},enumerable:!0,configurable:!0}),r.prototype.process=function(e,t){var r,n=this;return void 0===t&&(t=!1),r=t?e.toString():s.prepareData(e,this.converter.parseRuntime),Promise.resolve().then(function(){return n.runtime.preRawDataHook?n.runtime.preRawDataHook(r):r}).then(function(e){return e&&e.length>0?n.processCSV(e,t):Promise.resolve([])})},r.prototype.processCSV=function(e,t){var r=this,n=this.params,i=this.runtime;i.eol||a.default(e,i),this.needEmitEol&&!this.eolEmitted&&i.eol&&(this.converter.emit("eol",i.eol),this.eolEmitted=!0),n.ignoreEmpty&&!i.started&&(e=f.trimLeft(e));var o=u.stringToLines(e,i);return t?(o.lines.push(o.partial),o.partial=""):this.prependLeftBuf(f.bufFromString(o.partial)),o.lines.length>0?(i.preFileLineHook?this.runPreLineHook(o.lines):Promise.resolve(o.lines)).then(function(e){return i.started||r.runtime.headers?r.processCSVBody(e):r.processDataWithHead(e)}):Promise.resolve([])},r.prototype.processDataWithHead=function(e){if(this.params.noheader)this.params.headers?this.runtime.headers=this.params.headers:this.runtime.headers=[];else{for(var t="",r=[];e.length;){var n=t+e.shift(),i=this.rowSplit.parse(n);if(i.closed){r=i.cells,t="";break}t=n+a.default(n,this.runtime)}if(this.prependLeftBuf(f.bufFromString(t)),0===r.length)return[];this.params.headers?this.runtime.headers=this.params.headers:this.runtime.headers=r}return(this.runtime.needProcessIgnoreColumn||this.runtime.needProcessIncludeColumn)&&this.filterHeader(),this.needEmitHead&&!this.headEmitted&&(this.converter.emit("header",this.runtime.headers),this.headEmitted=!0),this.processCSVBody(e)},r.prototype.filterHeader=function(){if(this.runtime.selectedColumns=[],this.runtime.headers){for(var e=this.runtime.headers,t=0;t=t.length)i();else if(r.preFileLineHook){var o=t[n],s=r.preFileLineHook(o,r.parsedLineNumber+n);if(n++,s&&s.then)s.then(function(o){t[n-1]=o,e(t,r,n,i)});else{for(t[n-1]=s;n0?e.concat([r.csvLineBuffer,t]):t}(t,r);r.csvLineBuffer=void 0;var o=function(e,t){var r=e.length-1;if(0!=(128&e[r])){for(;128==(192&e[r]);)r--;r--}return r!=e.length-1?(t.csvLineBuffer=e.slice(r+1),e.slice(0,r+1)):e}(n,r).toString("utf8");return!1===r.started?i.default(o):o}}).call(this,r(3).Buffer)},function(e,t,r){"use strict";(function(t){var n=r(55);e.exports=function(e){return"string"==typeof e&&65279===e.charCodeAt(0)?e.slice(1):t.isBuffer(e)&&n(e)&&239===e[0]&&187===e[1]&&191===e[2]?e.slice(3):e}}).call(this,r(3).Buffer)},function(e,t){e.exports=function(e){for(var t=0;t0),this._needEmitDelimiter},enumerable:!0,configurable:!0}),e.prototype.parse=function(e){if(0===e.length||this.conv.parseParam.ignoreEmpty&&0===e.trim().length)return{cells:[],closed:!0};var t=this.quote,r=this.trim;this.escape,(this.conv.parseRuntime.delimiter instanceof Array||"auto"===this.conv.parseRuntime.delimiter.toLowerCase())&&(this.conv.parseRuntime.delimiter=this.getDelimiter(e)),this.needEmitDelimiter&&!this.delimiterEmitted&&(this.conv.emit("delimiter",this.conv.parseRuntime.delimiter),this.delimiterEmitted=!0);var n=this.conv.parseRuntime.delimiter,i=e.split(n);if("off"===t){if(r)for(var o=0;or&&(n=t,r=i)}),n},e.prototype.isQuoteOpen=function(e){var t=this.quote,r=this.escape;return e[0]===t&&(e[1]!==t||e[1]===r&&(e[2]===t||2===e.length))},e.prototype.isQuoteClose=function(e){var t=this.quote,r=this.escape;this.conv.parseParam.trim&&(e=o.trimRight(e));for(var n=0,i=e.length-1;e[i]===t||e[i]===r;)i--,n++;return n%2!=0},e.prototype.escapeQuote=function(e){var t="es|"+this.quote+"|"+this.escape;void 0===this.cachedRegExp[t]&&(this.cachedRegExp[t]=new RegExp("\\"+this.escape+"\\"+this.quote,"g"));var r=this.cachedRegExp[t];return e.replace(r,this.quote)},e.prototype.parseMultiLines=function(e){for(var t=[],r="";e.length;){var n=r+e.shift(),s=this.parse(n);0===s.cells.length&&this.conv.parseParam.ignoreEmpty||(s.closed||this.conv.parseParam.alwaysSplitAtEOL?(this.conv.parseRuntime.selectedColumns?t.push(o.filterArray(s.cells,this.conv.parseRuntime.selectedColumns)):t.push(s.cells),r=""):r=n+(i.default(n,this.conv.parseRuntime)||"\n"))}return{rowsCells:t,partial:r}},e}();t.RowSplit=a},function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var i=n(r(28)),o=n(r(59)),s=/^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$/;function a(e,t,r){if(t.parseParam.checkColumn&&t.parseRuntime.headers&&e.length!==t.parseRuntime.headers.length)throw i.default.column_mismatched(t.parseRuntime.parsedLineNumber+r);return function(e,t,r){for(var n=!1,i={},o=0,s=e.length;o-1){for(var o=t.split("."),s=!0;o.length>0;)if(0===o.shift().length){s=!1;break}!s||n.parseParam.colParser[t]&&n.parseParam.colParser[t].flat?n.parseRuntime.columnValueSetter[i]=l:n.parseRuntime.columnValueSetter[i]=h}else n.parseRuntime.columnValueSetter[i]=l;!0===n.parseParam.nullObject&&"null"===r&&(r=null),n.parseRuntime.columnValueSetter[i](e,t,r)}function l(e,t,r){e[t]=r}function h(e,t,r){o.default(e,t,r)}function p(e,t,r,n){return n.parseRuntime.headerType[r]?n.parseRuntime.headerType[r]:t.indexOf("number#!")>-1?n.parseRuntime.headerType[r]=d:t.indexOf("string#!")>-1?n.parseRuntime.headerType[r]=m:n.parseParam.checkType?n.parseRuntime.headerType[r]=v:n.parseRuntime.headerType[r]=m}function d(e){var t=parseFloat(e);return isNaN(t)?e:t}function m(e){return e.toString()}function v(e){var t=e.trim();return""===t?m(e):s.test(t)?d(e):5===t.length&&"false"===t.toLowerCase()||4===t.length&&"true"===t.toLowerCase()?function(e){var t=e.trim();return 5!==t.length||"false"!==t.toLowerCase()}(e):"{"===t[0]&&"}"===t[t.length-1]||"["===t[0]&&"]"===t[t.length-1]?function(e){try{return JSON.parse(e)}catch(t){return e}}(e):m(e)}},function(e,t,r){var n=r(60);e.exports=function(e,t,r){return null==e?e:n(e,t,r)}},function(e,t,r){var n=r(61),i=r(73),o=r(102),s=r(18),a=r(103);e.exports=function(e,t,r,u){if(!s(e))return e;for(var f=-1,c=(t=i(t,e)).length,l=c-1,h=e;null!=h&&++f-1}},function(e,t,r){var n=r(9);e.exports=function(e,t){var r=this.__data__,i=n(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}},function(e,t,r){var n=r(15)(r(17),"Map");e.exports=n},function(e,t,r){var n=r(10);e.exports=function(e){var t=n(this,e).delete(e);return this.size-=t?1:0,t}},function(e,t){e.exports=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}},function(e,t,r){var n=r(10);e.exports=function(e){return n(this,e).get(e)}},function(e,t,r){var n=r(10);e.exports=function(e){return n(this,e).has(e)}},function(e,t,r){var n=r(10);e.exports=function(e,t){var r=n(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}},function(e,t,r){var n=r(100);e.exports=function(e){return null==e?"":n(e)}},function(e,t,r){var n=r(16),i=r(101),o=r(19),s=r(20),a=n?n.prototype:void 0,u=a?a.toString:void 0;e.exports=function e(t){if("string"==typeof t)return t;if(o(t))return i(t,e)+"";if(s(t))return u?u.call(t):"";var r=t+"";return"0"==r&&1/t==-1/0?"-0":r}},function(e,t){e.exports=function(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r-1&&e%1==0&&e0||this.converter.listeners("readable").length>0),this._needPushDownstream},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"needEmitAll",{get:function(){return!!this.converter.parseRuntime.then&&this.converter.parseParam.needEmitAll},enumerable:!0,configurable:!0}),e.prototype.processResult=function(e){var t=this,r=this.converter.parseRuntime.parsedLineNumber;return this.needPushDownstream&&"array"===this.converter.parseParam.downstreamFormat&&0===r&&o(this.converter,"["+n.EOL),new Promise(function(r,n){t.needEmitLine?function e(t,r,n,i,s){if(n>=t.length)s();else if(r.parseRuntime.subscribe&&r.parseRuntime.subscribe.onNext){var a=r.parseRuntime.subscribe.onNext,u=t[n],f=a(u,r.parseRuntime.parsedLineNumber+n);if(n++,f&&f.then)f.then(function(){!function(t,r,n,i,s,a,u){s&&o(n,u),e(t,n,i,s,a)}(t,0,r,n,i,s,u)},s);else{for(i&&o(r,u);n=4.0.0" }, "devDependencies": { - "@types/bluebird": "^3.5.20", "@types/mocha": "^5.2.0", "@types/node": "^10.0.1", "babel-plugin-syntax-dynamic-import": "^6.18.0", @@ -281,7 +280,6 @@ "webpack-cli": "^3.1.0" }, "dependencies": { - "bluebird": "^3.5.1", "lodash": "^4.17.15", "strip-bom": "^2.0.0" }, diff --git a/src/Converter.ts b/src/Converter.ts index 83f076e..bd315de 100644 --- a/src/Converter.ts +++ b/src/Converter.ts @@ -1,7 +1,7 @@ import { Transform, TransformOptions, Readable } from "stream"; import { CSVParseParam, mergeParams } from "./Parameters"; import { ParseRuntime, initParseRuntime } from "./ParseRuntime"; -import P from "bluebird"; + import { stringToLines } from "./fileline"; import { map } from "lodash/map"; import { RowSplit, RowSplitResult } from "./rowSplit"; @@ -74,7 +74,7 @@ export class Converter extends Transform implements PromiseLike { return this.fromStream(read); } then(onfulfilled?: (value: any[]) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): PromiseLike { - return new P((resolve, reject) => { + return new Promise((resolve, reject) => { this.parseRuntime.then = { onfulfilled: (value: any[]) => { if (onfulfilled) { diff --git a/src/ProcessFork.ts b/src/ProcessFork.ts index 346d894..44d967b 100644 --- a/src/ProcessFork.ts +++ b/src/ProcessFork.ts @@ -1,5 +1,5 @@ import { Processor, ProcessLineResult } from "./Processor"; -import P from "bluebird" + import { Converter } from "./Converter"; import { ChildProcess } from "child_process"; import { CSVParseParam, mergeParams } from "./Parameters"; @@ -9,8 +9,8 @@ import { bufFromString, emptyBuffer } from "./util"; import CSVError from "./CSVError"; export class ProcessorFork extends Processor { - flush(): P { - return new P((resolve, reject) => { + flush(): Promise { + return new Promise((resolve, reject) => { // console.log("flush"); this.finalChunk = true; this.next = resolve; @@ -21,9 +21,9 @@ export class ProcessorFork extends Processor { // }) }); } - destroy(): P { + destroy(): Promise { this.childProcess.kill(); - return P.resolve(); + return Promise.resolve(); } childProcess: ChildProcess; inited: boolean = false; @@ -124,8 +124,8 @@ export class ProcessorFork extends Processor { // console.log("buf length",this.resultBuf.length); } - process(chunk: Buffer): P { - return new P((resolve, reject) => { + process(chunk: Buffer): Promise { + return new Promise((resolve, reject) => { // console.log("chunk", chunk.length); this.next = resolve; // this.appendReadBuf(chunk); diff --git a/src/Processor.ts b/src/Processor.ts index 97d1b17..18315b7 100644 --- a/src/Processor.ts +++ b/src/Processor.ts @@ -1,5 +1,5 @@ import { Converter } from "./Converter"; -import P from "bluebird"; + import { JSONResult } from "./lineToJson"; import { CSVParseParam } from "./Parameters"; import { ParseRuntime } from "./ParseRuntime"; @@ -11,8 +11,8 @@ export abstract class Processor { this.params = converter.parseParam; this.runtime = converter.parseRuntime; } - abstract process(chunk: Buffer,finalChunk?:boolean): P - abstract destroy():P; - abstract flush(): P; + abstract process(chunk: Buffer,finalChunk?:boolean): Promise + abstract destroy():Promise; + abstract flush(): Promise; } export type ProcessLineResult = string | string[] | JSONResult; diff --git a/src/ProcessorLocal.test.ts b/src/ProcessorLocal.test.ts index f4d66ab..37e52ab 100644 --- a/src/ProcessorLocal.test.ts +++ b/src/ProcessorLocal.test.ts @@ -1,6 +1,6 @@ import {ProcessorLocal} from "./ProcessorLocal"; import { Converter } from "./Converter"; -import P from "bluebird"; + import {readFileSync} from "fs"; import path from "path"; import assert from "assert"; diff --git a/src/ProcessorLocal.ts b/src/ProcessorLocal.ts index 01ba50c..e9f345c 100644 --- a/src/ProcessorLocal.ts +++ b/src/ProcessorLocal.ts @@ -1,5 +1,5 @@ import { Processor, ProcessLineResult } from "./Processor"; -import P from "bluebird"; + import { prepareData } from "./dataClean"; import getEol from "./getEol"; import { stringToLines } from "./fileline"; @@ -12,24 +12,24 @@ import CSVError from "./CSVError"; export class ProcessorLocal extends Processor { - flush(): P { + flush(): Promise { if (this.runtime.csvLineBuffer && this.runtime.csvLineBuffer.length > 0) { const buf = this.runtime.csvLineBuffer; this.runtime.csvLineBuffer = undefined; return this.process(buf, true) .then((res) => { if (this.runtime.csvLineBuffer && this.runtime.csvLineBuffer.length > 0) { - return P.reject(CSVError.unclosed_quote(this.runtime.parsedLineNumber, this.runtime.csvLineBuffer.toString())) + return Promise.reject(CSVError.unclosed_quote(this.runtime.parsedLineNumber, this.runtime.csvLineBuffer.toString())) } else { - return P.resolve(res); + return Promise.resolve(res); } }) } else { - return P.resolve([]); + return Promise.resolve([]); } } - destroy(): P { - return P.resolve(); + destroy(): Promise { + return Promise.resolve(); } private rowSplit: RowSplit = new RowSplit(this.converter); private eolEmitted = false; @@ -49,7 +49,7 @@ export class ProcessorLocal extends Processor { return this._needEmitHead; } - process(chunk: Buffer, finalChunk = false): P { + process(chunk: Buffer, finalChunk = false): Promise { let csvString: string; if (finalChunk) { csvString = chunk.toString(); @@ -57,7 +57,7 @@ export class ProcessorLocal extends Processor { csvString = prepareData(chunk, this.converter.parseRuntime); } - return P.resolve() + return Promise.resolve() .then(() => { if (this.runtime.preRawDataHook) { return this.runtime.preRawDataHook(csvString); @@ -69,11 +69,11 @@ export class ProcessorLocal extends Processor { if (csv && csv.length > 0) { return this.processCSV(csv, finalChunk); } else { - return P.resolve([]); + return Promise.resolve([]); } }) } - private processCSV(csv: string, finalChunk: boolean): P { + private processCSV(csv: string, finalChunk: boolean): Promise { const params = this.params; const runtime = this.runtime; if (!runtime.eol) { @@ -95,11 +95,11 @@ export class ProcessorLocal extends Processor { stringToLineResult.partial = ""; } if (stringToLineResult.lines.length > 0) { - let prom: P; + let prom: Promise; if (runtime.preFileLineHook) { prom = this.runPreLineHook(stringToLineResult.lines); } else { - prom = P.resolve(stringToLineResult.lines); + prom = Promise.resolve(stringToLineResult.lines); } return prom.then((lines) => { if (!runtime.started @@ -114,7 +114,7 @@ export class ProcessorLocal extends Processor { } else { - return P.resolve([]); + return Promise.resolve([]); } } @@ -227,8 +227,8 @@ export class ProcessorLocal extends Processor { } } - private runPreLineHook(lines: string[]): P { - return new P((resolve, reject) => { + private runPreLineHook(lines: string[]): Promise { + return new Promise((resolve, reject) => { processLineHook(lines, this.runtime, 0, (err) => { if (err) { reject(err); diff --git a/src/Result.test.ts b/src/Result.test.ts index 9797c07..b9e4f2b 100644 --- a/src/Result.test.ts +++ b/src/Result.test.ts @@ -1,6 +1,6 @@ import {Result} from "./Result"; import { Converter } from "./Converter"; -import P from "bluebird"; + import {readFileSync} from "fs"; import path from "path"; import assert from "assert"; diff --git a/src/Result.ts b/src/Result.ts index 7c376ab..4cec0c8 100644 --- a/src/Result.ts +++ b/src/Result.ts @@ -1,6 +1,6 @@ import { Converter } from "./Converter"; import { ProcessLineResult } from "./Processor"; -import P from "bluebird"; + import CSVError from "./CSVError"; import { EOL } from "os"; export class Result { @@ -20,15 +20,15 @@ export class Result { } private finalResult: any[] = []; constructor(private converter: Converter) { } - processResult(resultLines: ProcessLineResult[]): P { + processResult(resultLines: ProcessLineResult[]): Promise { const startPos = this.converter.parseRuntime.parsedLineNumber; if (this.needPushDownstream && this.converter.parseParam.downstreamFormat === "array") { if (startPos === 0) { pushDownstream(this.converter, "[" + EOL); } } - // let prom: P; - return new P((resolve, reject) => { + // let prom: Promise; + return new Promise((resolve, reject) => { if (this.needEmitLine) { processLineByLine( resultLines, diff --git a/v2/Converter.js b/v2/Converter.js index 909a38a..ea70314 100644 --- a/v2/Converter.js +++ b/v2/Converter.js @@ -9,14 +9,10 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; Object.defineProperty(exports, "__esModule", { value: true }); var stream_1 = require("stream"); var Parameters_1 = require("./Parameters"); var ParseRuntime_1 = require("./ParseRuntime"); -var bluebird_1 = __importDefault(require("bluebird")); // import { ProcessorFork } from "./ProcessFork"; var ProcessorLocal_1 = require("./ProcessorLocal"); var Result_1 = require("./Result"); @@ -105,7 +101,7 @@ var Converter = /** @class */ (function (_super) { }; Converter.prototype.then = function (onfulfilled, onrejected) { var _this = this; - return new bluebird_1.default(function (resolve, reject) { + return new Promise(function (resolve, reject) { _this.parseRuntime.then = { onfulfilled: function (value) { if (onfulfilled) { diff --git a/v2/Converter.js.map b/v2/Converter.js.map index 4e1f317..11ba40d 100644 --- a/v2/Converter.js.map +++ b/v2/Converter.js.map @@ -1 +1 @@ -{"version":3,"file":"Converter.js","sourceRoot":"","sources":["../src/Converter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,iCAA+D;AAC/D,2CAA0D;AAC1D,+CAAgE;AAChE,sDAAyB;AAOzB,iDAAiD;AACjD,mDAAkD;AAClD,mCAAkC;AAMlC;IAA+B,6BAAS;IAuFtC,mBAAY,KAA8B,EAAS,OAA8B;QAA9B,wBAAA,EAAA,YAA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,CAAC;QACP,CAAC,EAAE,UAAC,KAAK;YACP,KAAI,CAAC,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;YAC7B,KAAI,CAAC,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;YAC3B,KAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;YAC1B,EAAE,EAAE,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;IACD,0BAAM,GAAN,UAAO,EAAY;QAAnB,iBAcC;QAbC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE;aACnB,IAAI,CAAC,UAAC,IAAI;YACT,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;gBAEnB,OAAO,KAAI,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;aACxC;QACH,CAAC,CAAC;aACD,IAAI,CAAC;YACJ,KAAI,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;QACtB,CAAC,EAAE,UAAC,GAAG;YACL,KAAI,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;YACxB,EAAE,EAAE,CAAC;QACP,CAAC,CAAC,CAAA;IACN,CAAC;IACO,8BAAU,GAAlB,UAAmB,EAAE;QACnB,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;QACzB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAClB,EAAE,EAAE,CAAC;IACP,CAAC;IACD,sBAAI,uCAAgB;aAApB;YACE,OAAO,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC;QACvC,CAAC;;;OAAA;IACH,gBAAC;AAAD,CAAC,AA3JD,CAA+B,kBAAS,GA2JvC;AA3JY,8BAAS"} \ No newline at end of file +{"version":3,"file":"Converter.js","sourceRoot":"","sources":["../src/Converter.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iCAA+D;AAC/D,2CAA0D;AAC1D,+CAAgE;AAQhE,iDAAiD;AACjD,mDAAkD;AAClD,m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/ProcessFork.d.ts +++ b/v2/ProcessFork.d.ts @@ -1,13 +1,11 @@ -/// /// import { Processor, ProcessLineResult } from "./Processor"; -import P from "bluebird"; import { Converter } from "./Converter"; import { ChildProcess } from "child_process"; export declare class ProcessorFork extends Processor { protected converter: Converter; - flush(): P; - destroy(): P; + flush(): Promise; + destroy(): Promise; childProcess: ChildProcess; inited: boolean; private resultBuf; @@ -19,7 +17,7 @@ export declare class ProcessorFork extends Processor { private initWorker(); private flushResult(); private appendBuf(data); - process(chunk: Buffer): P; + process(chunk: Buffer): Promise; } export interface Message { cmd: string; diff --git a/v2/ProcessFork.js b/v2/ProcessFork.js index bb56903..6354ef6 100644 --- a/v2/ProcessFork.js +++ b/v2/ProcessFork.js @@ -14,7 +14,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) { }; Object.defineProperty(exports, "__esModule", { value: true }); var Processor_1 = require("./Processor"); -var bluebird_1 = __importDefault(require("bluebird")); var Parameters_1 = require("./Parameters"); var CSVError_1 = __importDefault(require("./CSVError")); var ProcessorFork = /** @class */ (function (_super) { @@ -34,7 +33,7 @@ var ProcessorFork = /** @class */ (function (_super) { } ProcessorFork.prototype.flush = function () { var _this = this; - return new bluebird_1.default(function (resolve, reject) { + return new Promise(function (resolve, reject) { // console.log("flush"); _this.finalChunk = true; _this.next = resolve; @@ -47,7 +46,7 @@ var ProcessorFork = /** @class */ (function (_super) { }; ProcessorFork.prototype.destroy = function () { this.childProcess.kill(); - return bluebird_1.default.resolve(); + return Promise.resolve(); }; ProcessorFork.prototype.prepareParam = function (param) { var clone = Parameters_1.mergeParams(param); @@ -137,7 +136,7 @@ var ProcessorFork = /** @class */ (function (_super) { }; ProcessorFork.prototype.process = function (chunk) { var _this = this; - return new bluebird_1.default(function (resolve, reject) { + return new Promise(function (resolve, reject) { // console.log("chunk", chunk.length); _this.next = resolve; // this.appendReadBuf(chunk); diff --git a/v2/ProcessFork.js.map b/v2/ProcessFork.js.map index 4a7ee23..3a4ee7d 100644 --- a/v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CAAC;QACtC,IAAI,OAAO,KAAK,EAAE,EAAE;YAClB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC;SACnC;aAAM;YACL,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;SACrB;QACD,IAAI,CAAC,SAAS,GAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC3C,wBAAwB;QACxB,mCAAmC;QACnC,8BAA8B;QAC9B,gBAAgB;QAChB,MAAM;QACN,4CAA4C;QAC5C,oCAAoC;QACpC,SAAS;QACT,+BAA+B;QAC/B,eAAe;QACf,IAAI;QACJ,mDAAmD;IACrD,CAAC;IAED,+BAAO,GAAP,UAAQ,KAAa;QAArB,iBAUC;QATC,OAAO,IAAI,kBAAC,CAAC,UAAC,OAAO,EAAE,MAAM;YAC3B,sCAAsC;YACtC,KAAI,CAAC,IAAI,GAAG,OAAO,CAAC;YACpB,6BAA6B;YAC7B,KAAI,CAAC,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE;gBACnC,iCAAiC;gBACjC,KAAI,CAAC,WAAW,EAAE,CAAC;YACrB,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IACH,oBAAC;AAAD,CAAC,AA/HD,CAAmC,qBAAS,GA+H3C;AA/HY,sCAAa;AA2Ib,QAAA,GAAG,GAAG,MAAM,CAAC"} \ No newline at end of file +{"version":3,"file":"ProcessFork.js","sourceRoot":"","sources":["../src/ProcessFork.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,yCAA2D;AAI3D,2CAA0D;AAI1D,wDAAkC;AAElC;IAAmC,iCAAS;IAuB1C,uBAAsB,SAAoB;QAA1C,YACE,kBAAM,SAAS,CAAC,SAKjB;QANqB,eAAS,GAAT,SAAS,CAAW;QAL1C,YAAM,GAAY,KAAK,CAAC;QAChB,eAAS,GAAwB,EAAE,CAAC;QACpC,eAAS,GAAW,EAAE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,IAAI;QACJ,mDAAmD;IACrD,CAAC;IAED,+BAAO,GAAP,UAAQ,KAAa;QAArB,iBAUC;QATC,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;YACjC,sCAAsC;YACtC,KAAI,CAAC,IAAI,GAAG,OAAO,CAAC;YACpB,6BAA6B;YAC7B,KAAI,CAAC,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE;gBACnC,iCAAiC;gBACjC,KAAI,CAAC,WAAW,EAAE,CAAC;YACrB,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IACH,oBAAC;AAAD,CAAC,AA/HD,CAAmC,qBAAS,GA+H3C;AA/HY,sCAAa;AA2Ib,QAAA,GAAG,GAAG,MAAM,CAAC"} \ No newline at end of file diff --git a/v2/Processor.d.ts b/v2/Processor.d.ts index 96abc57..92cc1e9 100644 --- a/v2/Processor.d.ts +++ b/v2/Processor.d.ts @@ -1,7 +1,5 @@ /// -/// import { Converter } from "./Converter"; -import P from "bluebird"; import { JSONResult } from "./lineToJson"; import { CSVParseParam } from "./Parameters"; import { ParseRuntime } from "./ParseRuntime"; @@ -10,8 +8,8 @@ export declare abstract class Processor { protected params: CSVParseParam; protected runtime: ParseRuntime; constructor(converter: Converter); - abstract process(chunk: Buffer, finalChunk?: boolean): P; - abstract destroy(): P; - abstract flush(): P; + abstract process(chunk: Buffer, finalChunk?: boolean): Promise; + abstract destroy(): Promise; + abstract flush(): Promise; } export declare type ProcessLineResult = string | string[] | JSONResult; diff --git a/v2/ProcessorLocal.d.ts b/v2/ProcessorLocal.d.ts index 6cdb1d5..3647e4d 100644 --- a/v2/ProcessorLocal.d.ts +++ b/v2/ProcessorLocal.d.ts @@ -1,10 +1,8 @@ -/// /// import { Processor, ProcessLineResult } from "./Processor"; -import P from "bluebird"; export declare class ProcessorLocal extends Processor { - flush(): P; - destroy(): P; + flush(): Promise; + destroy(): Promise; private rowSplit; private eolEmitted; private _needEmitEol?; @@ -12,7 +10,7 @@ export declare class ProcessorLocal extends Processor { private headEmitted; private _needEmitHead?; private readonly needEmitHead; - process(chunk: Buffer, finalChunk?: boolean): P; + process(chunk: Buffer, finalChunk?: boolean): Promise; private processCSV(csv, finalChunk); private processDataWithHead(lines); private filterHeader(); diff --git a/v2/ProcessorLocal.js b/v2/ProcessorLocal.js index 978fab7..183fbef 100644 --- a/v2/ProcessorLocal.js +++ b/v2/ProcessorLocal.js @@ -14,7 +14,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) { }; Object.defineProperty(exports, "__esModule", { value: true }); var Processor_1 = require("./Processor"); -var bluebird_1 = __importDefault(require("bluebird")); var dataClean_1 = require("./dataClean"); var getEol_1 = __importDefault(require("./getEol")); var fileline_1 = require("./fileline"); @@ -41,19 +40,19 @@ var ProcessorLocal = /** @class */ (function (_super) { return this.process(buf, true) .then(function (res) { if (_this.runtime.csvLineBuffer && _this.runtime.csvLineBuffer.length > 0) { - return bluebird_1.default.reject(CSVError_1.default.unclosed_quote(_this.runtime.parsedLineNumber, _this.runtime.csvLineBuffer.toString())); + return Promise.reject(CSVError_1.default.unclosed_quote(_this.runtime.parsedLineNumber, _this.runtime.csvLineBuffer.toString())); } else { - return bluebird_1.default.resolve(res); + return Promise.resolve(res); } }); } else { - return bluebird_1.default.resolve([]); + return Promise.resolve([]); } }; ProcessorLocal.prototype.destroy = function () { - return bluebird_1.default.resolve(); + return Promise.resolve(); }; Object.defineProperty(ProcessorLocal.prototype, "needEmitEol", { get: function () { @@ -85,7 +84,7 @@ var ProcessorLocal = /** @class */ (function (_super) { else { csvString = dataClean_1.prepareData(chunk, this.converter.parseRuntime); } - return bluebird_1.default.resolve() + return Promise.resolve() .then(function () { if (_this.runtime.preRawDataHook) { return _this.runtime.preRawDataHook(csvString); @@ -99,7 +98,7 @@ var ProcessorLocal = /** @class */ (function (_super) { return _this.processCSV(csv, finalChunk); } else { - return bluebird_1.default.resolve([]); + return Promise.resolve([]); } }); }; @@ -132,7 +131,7 @@ var ProcessorLocal = /** @class */ (function (_super) { prom = this.runPreLineHook(stringToLineResult.lines); } else { - prom = bluebird_1.default.resolve(stringToLineResult.lines); + prom = Promise.resolve(stringToLineResult.lines); } return prom.then(function (lines) { if (!runtime.started @@ -145,7 +144,7 @@ var ProcessorLocal = /** @class */ (function (_super) { }); } else { - return bluebird_1.default.resolve([]); + return Promise.resolve([]); } }; ProcessorLocal.prototype.processDataWithHead = function (lines) { @@ -264,7 +263,7 @@ var ProcessorLocal = /** @class */ (function (_super) { }; ProcessorLocal.prototype.runPreLineHook = function (lines) { var _this = this; - return new bluebird_1.default(function (resolve, reject) { + return new Promise(function (resolve, reject) { processLineHook(lines, _this.runtime, 0, function (err) { if (err) { reject(err); diff --git a/v2/ProcessorLocal.js.map b/v2/ProcessorLocal.js.map index e31eee6..fa66955 100644 --- a/v2/ProcessorLocal.js.map +++ b/v2/ProcessorLocal.js.map @@ -1 +1 @@ -{"version":3,"file":"ProcessorLocal.js","sourceRoot":"","sources":["../src/ProcessorLocal.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,yCAA2D;AAC3D,sDAAyB;AACzB,yCAA0C;AAC1C,oDAA8B;AAC9B,uCAA2C;AAC3C,+BAA6D;AAC7D,uCAAsC;AACtC,4DAAsC;AAEtC,wDAAkC;AAIlC;IAAoC,kCAAS;IAA7C;QAAA,qEAmOC;QA/MS,cAAQ,GAAa,IAAI,mBAAQ,CAAC,KAAI,CAAC,SAAS,CAAC,CAAC;QAClD,gBAAU,GAAG,KAAK,CAAC;QACnB,kBAAY,GAAa,SAAS,CAAC;QAOnC,iBAAW,GAAG,KAAK,CAAC;QACpB,mBAAa,GAAa,SAAS,CAAC;;IAqM9C,CAAC;IAlOC,8BAAK,GAAL;QAAA,iBAeC;QAdC,IAAI,IAAI,CAAC,OAAO,CAAC,aAAa,IAAI,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE;YACvE,IAAM,GAAG,GAAG,I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@@ -/// import { Converter } from "./Converter"; import { ProcessLineResult } from "./Processor"; -import P from "bluebird"; import CSVError from "./CSVError"; export declare class Result { private converter; @@ -11,7 +9,7 @@ export declare class Result { private readonly needEmitAll; private finalResult; constructor(converter: Converter); - processResult(resultLines: ProcessLineResult[]): P; + processResult(resultLines: ProcessLineResult[]): Promise; appendFinalResult(lines: any[]): void; processError(err: CSVError): void; endProcess(): void; diff --git a/v2/Result.js b/v2/Result.js index c5b62c3..daa836a 100644 --- a/v2/Result.js +++ b/v2/Result.js @@ -1,9 +1,5 @@ "use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; Object.defineProperty(exports, "__esModule", { value: true }); -var bluebird_1 = __importDefault(require("bluebird")); var os_1 = require("os"); var Result = /** @class */ (function () { function Result(converter) { @@ -43,8 +39,8 @@ var Result = /** @class */ (function () { pushDownstream(this.converter, "[" + os_1.EOL); } } - // let prom: P; - return new bluebird_1.default(function (resolve, reject) { + // let prom: Promise; + return new Promise(function (resolve, reject) { if (_this.needEmitLine) { processLineByLine(resultLines, _this.converter, 0, _this.needPushDownstream, function (err) { if (err) { diff --git a/v2/Result.js.map b/v2/Result.js.map index ec645e7..c58c445 100644 --- a/v2/Result.js.map +++ b/v2/Result.js.map @@ -1 +1 @@ -{"version":3,"file":"Result.js","sourceRoot":"","sources":["../src/Result.ts"],"names":[],"mappings":";;;;;AAEA,sDAAyB;AAEzB,yBAAyB;AACzB;IAgBE,gBAAoB,SAAoB;QAApB,cAAS,GAAT,SAAS,CAAW;QADhC,gBAAW,GAAU,EAAE,CAAC;IACY,CAAC;IAf7C,sBAAY,gCAAY;aAAxB;YACE,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,SAAS,IAAI,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,SAAS,CAAC,MAAM,IAAI,IAAI,CAAC,kBAAkB,CAAA;QAC7H,CAAC;;;OAAA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