UNPKG

itako

Version:
5 lines 104 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("events")):"function"==typeof define&&define.amd?define(["events"],t):e.Itako=t(e.require$$1)}(this,function(e){"use strict";function t(e,t){return t={exports:{}},e(t,t.exports,n),t.exports}e="default"in e?e["default"]:e;var n="undefined"!=typeof window?window:"undefined"!=typeof global?global:this,r={};r["typeof"]="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},r.classCallCheck=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},r.createClass=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),r["extends"]=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},r.inherits=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},r.possibleConstructorReturn=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t};var i=t(function(e){e.exports=function(e,t){var n=e.map;e.prototype.filter=function(e,r){return n(this,e,r,t)},e.filter=function(e,r,i){return n(e,r,i,t)}}}),o=i&&"object"===("undefined"==typeof i?"undefined":r["typeof"](i))&&"default"in i?i["default"]:i,a=t(function(e){e.exports=function(e,t){function n(){return o(this)}function r(e,n){return i(e,n,t,t)}var i=e.reduce,o=e.all;e.prototype.each=function(e){return this.mapSeries(e)._then(n,void 0,void 0,this,void 0)},e.prototype.mapSeries=function(e){return i(this,e,t,t)},e.each=function(e,t){return r(e,t)._then(n,void 0,void 0,e,void 0)},e.mapSeries=r}}),s=a&&"object"===("undefined"==typeof a?"undefined":r["typeof"](a))&&"default"in a?a["default"]:a,u=t(function(e){e.exports=function(e){function t(e){var t=new n(e),r=t.promise();return t.setHowMany(1),t.setUnwrap(),t.init(),r}var n=e._SomePromiseArray;e.any=function(e){return t(e)},e.prototype.any=function(){return t(this)}}}),c=u&&"object"===("undefined"==typeof u?"undefined":r["typeof"](u))&&"default"in u?u["default"]:u,l=t(function(e){var t=function(){return void 0===this}();if(t)e.exports={freeze:Object.freeze,defineProperty:Object.defineProperty,getDescriptor:Object.getOwnPropertyDescriptor,keys:Object.keys,names:Object.getOwnPropertyNames,getPrototypeOf:Object.getPrototypeOf,isArray:Array.isArray,isES5:t,propertyIsWritable:function(e,t){var n=Object.getOwnPropertyDescriptor(e,t);return!(n&&!n.writable&&!n.set)}};else{var n={}.hasOwnProperty,r={}.toString,i={}.constructor.prototype,o=function(e){var t=[];for(var r in e)n.call(e,r)&&t.push(r);return t},a=function(e,t){return{value:e[t]}},s=function(e,t,n){return e[t]=n.value,e},u=function(e){return e},c=function(e){try{return Object(e).constructor.prototype}catch(t){return i}},l=function(e){try{return"[object Array]"===r.call(e)}catch(t){return!1}};e.exports={isArray:l,keys:o,names:o,defineProperty:s,getDescriptor:a,freeze:u,getPrototypeOf:c,isES5:t,propertyIsWritable:function(){return!0}}}}),f=l&&"object"===("undefined"==typeof l?"undefined":r["typeof"](l))&&"default"in l?l["default"]:l,p=t(function(e,t,i){function o(){try{var e=P;return P=null,e.apply(this,arguments)}catch(t){return O.e=t,O}}function a(e){return P=e,o}function s(e){return null==e||e===!0||e===!1||"string"==typeof e||"number"==typeof e}function u(e){return"function"==typeof e||"object"===("undefined"==typeof e?"undefined":r["typeof"](e))&&null!==e}function c(e){return s(e)?new Error(g(e)):e}function l(e,t){var n,r=e.length,i=new Array(r+1);for(n=0;r>n;++n)i[n]=e[n];return i[n]=t,i}function p(e,t,n){if(!x.isES5)return{}.hasOwnProperty.call(e,t)?e[t]:void 0;var r=Object.getOwnPropertyDescriptor(e,t);return null!=r?null==r.get&&null==r.set?r.value:n:void 0}function h(e,t,n){if(s(e))return e;var r={value:n,configurable:!0,enumerable:!1,writable:!0};return x.defineProperty(e,t,r),e}function d(e){throw e}function _(e){try{if("function"==typeof e){var t=x.names(e.prototype),n=x.isES5&&t.length>1,r=t.length>0&&!(1===t.length&&"constructor"===t[0]),i=N.test(e+"")&&x.names(e).length>0;if(n||r||i)return!0}return!1}catch(o){return!1}}function v(e){function t(){}t.prototype=e;for(var n=8;n--;)new t;return e}function y(e){return D.test(e)}function m(e,t,n){for(var r=new Array(e),i=0;e>i;++i)r[i]=t+i+n;return r}function g(e){try{return e+""}catch(t){return"[no string representation]"}}function b(e){return null!==e&&"object"===("undefined"==typeof e?"undefined":r["typeof"](e))&&"string"==typeof e.message&&"string"==typeof e.name}function w(e){try{h(e,"isOperational",!0)}catch(t){}}function j(e){return null==e?!1:e instanceof Error.__BluebirdErrorTypes__.OperationalError||e.isOperational===!0}function C(e){return b(e)&&x.propertyIsWritable(e,"stack")}function k(e){return{}.toString.call(e)}function F(e,t,n){for(var r=x.names(e),i=0;i<r.length;++i){var o=r[i];if(n(o))try{x.defineProperty(t,o,x.getDescriptor(e,o))}catch(a){}}}function E(e,t){return H?process.env[e]:t}var x=f,T="undefined"==typeof navigator,O={e:{}},P,R="undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof i?i:void 0!==n?n:null,S=function(e,t){function n(){this.constructor=e,this.constructor$=t;for(var n in t.prototype)r.call(t.prototype,n)&&"$"!==n.charAt(n.length-1)&&(this[n+"$"]=t.prototype[n])}var r={}.hasOwnProperty;return n.prototype=t.prototype,e.prototype=new n,e.prototype},A=function(){var e=[Array.prototype,Object.prototype,Function.prototype],t=function(t){for(var n=0;n<e.length;++n)if(e[n]===t)return!0;return!1};if(x.isES5){var n=Object.getOwnPropertyNames;return function(e){for(var r=[],i=Object.create(null);null!=e&&!t(e);){var o;try{o=n(e)}catch(a){return r}for(var s=0;s<o.length;++s){var u=o[s];if(!i[u]){i[u]=!0;var c=Object.getOwnPropertyDescriptor(e,u);null!=c&&null==c.get&&null==c.set&&r.push(u)}}e=x.getPrototypeOf(e)}return r}}var r={}.hasOwnProperty;return function(n){if(t(n))return[];var i=[];e:for(var o in n)if(r.call(n,o))i.push(o);else{for(var a=0;a<e.length;++a)if(r.call(e[a],o))continue e;i.push(o)}return i}}(),N=/this\s*\.\s*\S+\s*=/,D=/^[a-z$_][a-z$_0-9]*$/i,I=function(){return"stack"in new Error?function(e){return C(e)?e:new Error(g(e))}:function(e){if(C(e))return e;try{throw new Error(g(e))}catch(t){return t}}}(),V=function(e){return x.isArray(e)?e:null};if("undefined"!=typeof Symbol&&Symbol.iterator){var L="function"==typeof Array.from?function(e){return Array.from(e)}:function(e){for(var t,n=[],r=e[Symbol.iterator]();!(t=r.next()).done;)n.push(t.value);return n};V=function(e){return x.isArray(e)?e:null!=e&&"function"==typeof e[Symbol.iterator]?L(e):null}}var H="undefined"!=typeof process&&"[object process]"===k(process).toLowerCase(),M={isClass:_,isIdentifier:y,inheritedDataKeys:A,getDataPropertyOrDefault:p,thrower:d,isArray:x.isArray,asArray:V,notEnumerableProp:h,isPrimitive:s,isObject:u,isError:b,canEvaluate:T,errorObj:O,tryCatch:a,inherits:S,withAppended:l,maybeWrapAsError:c,toFastProperties:v,filledRange:m,toString:g,canAttachTrace:C,ensureErrorObject:I,originatesFromRejection:j,markAsOriginatingFromRejection:w,classString:k,copyDescriptors:F,hasDevTools:"undefined"!=typeof chrome&&chrome&&"function"==typeof chrome.loadTimes,isNode:H,env:E,global:R};M.isRecentNode=M.isNode&&function(){var e=process.versions.node.split(".").map(Number);return 0===e[0]&&e[1]>10||e[0]>0}(),M.isNode&&M.toFastProperties(process);try{throw new Error}catch(U){M.lastLineError=U}e.exports=M}),h=p&&"object"===("undefined"==typeof p?"undefined":r["typeof"](p))&&"default"in p?p["default"]:p,d=t(function(e){function t(e,t){function n(r){return this instanceof n?(c(this,"message","string"==typeof r?r:t),c(this,"name",e),void(Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):Error.call(this))):new n(r)}return u(n,Error),n}function n(e){return this instanceof n?(c(this,"name","OperationalError"),c(this,"message",e),this.cause=e,this.isOperational=!0,void(e instanceof Error?(c(this,"message",e.message),c(this,"stack",e.stack)):Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor))):new n(e)}var r,i,o=f,a=o.freeze,s=h,u=s.inherits,c=s.notEnumerableProp,l=t("Warning","warning"),p=t("CancellationError","cancellation error"),d=t("TimeoutError","timeout error"),_=t("AggregateError","aggregate error");try{r=TypeError,i=RangeError}catch(v){r=t("TypeError","type error"),i=t("RangeError","range error")}for(var y="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),m=0;m<y.length;++m)"function"==typeof Array.prototype[y[m]]&&(_.prototype[y[m]]=Array.prototype[y[m]]);o.defineProperty(_.prototype,"length",{value:0,configurable:!1,writable:!0,enumerable:!0}),_.prototype.isOperational=!0;var g=0;_.prototype.toString=function(){var e=Array(4*g+1).join(" "),t="\n"+e+"AggregateError of:\n";g++,e=Array(4*g+1).join(" ");for(var n=0;n<this.length;++n){for(var r=this[n]===this?"[Circular AggregateError]":this[n]+"",i=r.split("\n"),o=0;o<i.length;++o)i[o]=e+i[o];r=i.join("\n"),t+=r+"\n"}return g--,t},u(n,Error);var b=Error.__BluebirdErrorTypes__;b||(b=a({CancellationError:p,TimeoutError:d,OperationalError:n,RejectionError:n,AggregateError:_}),o.defineProperty(Error,"__BluebirdErrorTypes__",{value:b,writable:!1,enumerable:!1,configurable:!1})),e.exports={Error:Error,TypeError:r,RangeError:i,CancellationError:b.CancellationError,OperationalError:b.OperationalError,TimeoutError:b.TimeoutError,AggregateError:b.AggregateError,Warning:l}}),_=d&&"object"===("undefined"==typeof d?"undefined":r["typeof"](d))&&"default"in d?d["default"]:d,v=t(function(e){function t(e){return e instanceof Error&&u.getPrototypeOf(e)===Error.prototype}function n(e){var n;if(t(e)){n=new s(e),n.name=e.name,n.message=e.message,n.stack=e.stack;for(var r=u.keys(e),o=0;o<r.length;++o){var a=r[o];c.test(a)||(n[a]=e[a])}return n}return i.markAsOriginatingFromRejection(e),e}function r(e,t){return function(r,i){if(null!==e){if(r){var a=n(o(r));e._attachExtraTrace(a),e._reject(a)}else if(t){for(var s=arguments.length,u=new Array(s-1),c=1;s>c;++c)u[c-1]=arguments[c];e._fulfill(u)}else e._fulfill(i);e=null}}}var i=h,o=i.maybeWrapAsError,a=_,s=a.OperationalError,u=f,c=/^(?:name|message|stack|cause)$/;e.exports=r}),y=v&&"object"===("undefined"==typeof v?"undefined":r["typeof"](v))&&"default"in v?v["default"]:v,m=t(function(e){e.exports=function(e,t){function n(e){return!F.test(e)}function i(e){try{return e.__isPromisified__===!0}catch(t){return!1}}function o(e,t,n){var r=d.getDataPropertyOrDefault(e,t+n,C);return r?i(r):!1}function a(e,t,n){for(var r=0;r<e.length;r+=2){var i=e[r];if(n.test(i))for(var o=i.replace(n,""),a=0;a<e.length;a+=2)if(e[a]===o)throw new w("Cannot promisify an API that has normal methods with '%s'-suffix\n\n    See http://goo.gl/MqrFmX\n".replace("%s",t))}}function s(e,t,n,r){for(var s=d.inheritedDataKeys(e),u=[],c=0;c<s.length;++c){var l=s[c],f=e[l],p=r===E?!0:E(l,f,e);"function"!=typeof f||i(f)||o(e,l,t)||!r(l,f,e,p)||u.push(l,f)}return a(u,t,n),u}function u(n,r,i,o,a,s){function u(){var i=r;r===p&&(i=this);var o=new e(t);o._captureStackTrace();var a="string"==typeof l&&this!==c?this[l]:n,u=v(o,s);try{a.apply(i,m(arguments,u))}catch(f){o._rejectCallback(g(f),!0,!0)}return o._isFateSealed()||o._setAsyncGuaranteed(),o}var c=function(){return this}(),l=n;return"string"==typeof l&&(n=o),d.notEnumerableProp(u,"__isPromisified__",!0),u}function c(e,t,n,r,i){for(var o=new RegExp(x(t)+"$"),a=s(e,t,o,n),u=0,c=a.length;c>u;u+=2){var l=a[u],f=a[u+1],h=l+t;if(r===S)e[h]=S(l,p,l,f,t,i);else{var _=r(f,function(){return S(l,p,l,f,t,i)});d.notEnumerableProp(_,"__isPromisified__",!0),e[h]=_}}return d.toFastProperties(e),e}function l(e,t,n){return S(e,t,void 0,e,null,n)}var f,p={},d=h,v=y,m=d.withAppended,g=d.maybeWrapAsError,b=d.canEvaluate,w=_.TypeError,j="Async",C={__isPromisified__:!0},k=["arity","length","name","arguments","caller","callee","prototype","__isPromisified__"],F=new RegExp("^(?:"+k.join("|")+")$"),E=function(e){return d.isIdentifier(e)&&"_"!==e.charAt(0)&&"constructor"!==e},x=function(e){return e.replace(/([$])/,"\\$")},T=function(e){for(var t=[e],n=Math.max(0,e-1-3),r=e-1;r>=n;--r)t.push(r);for(var r=e+1;3>=r;++r)t.push(r);return t},O=function(e){return d.filledRange(e,"_arg","")},P=function(e){return d.filledRange(Math.max(e,3),"_arg","")},R=function(e){return"number"==typeof e.length?Math.max(Math.min(e.length,1024),0):0};f=function(n,r,i,o,a,s){function u(e){var t,n=O(e).join(", "),i=e>0?", ":"";return t=h?"ret = callback.call(this, {{args}}, nodeback); break;\n":void 0===r?"ret = callback({{args}}, nodeback); break;\n":"ret = callback.call(receiver, {{args}}, nodeback); break;\n",t.replace("{{args}}",n).replace(", ",i)}function c(){for(var e="",t=0;t<f.length;++t)e+="case "+f[t]+":"+u(f[t]);return e+="                                                             \n        default:                                                             \n            var args = new Array(len + 1);                                   \n            var i = 0;                                                       \n            for (var i = 0; i < len; ++i) {                                  \n               args[i] = arguments[i];                                       \n            }                                                                \n            args[i] = nodeback;                                              \n            [CodeForCall]                                                    \n            break;                                                           \n        ".replace("[CodeForCall]",h?"ret = callback.apply(this, args);\n":"ret = callback.apply(receiver, args);\n")}var l=Math.max(0,R(o)-1),f=T(l),h="string"==typeof n||r===p,_="string"==typeof n?"this != null ? this['"+n+"'] : fn":"fn",y="'use strict';                                                \n        var ret = function (Parameters) {                                    \n            'use strict';                                                    \n            var len = arguments.length;                                      \n            var promise = new Promise(INTERNAL);                             \n            promise._captureStackTrace();                                    \n            var nodeback = nodebackForPromise(promise, "+s+");   \n            var ret;                                                         \n            var callback = tryCatch([GetFunctionCode]);                      \n            switch(len) {                                                    \n                [CodeForSwitchCase]                                          \n            }                                                                \n            if (ret === errorObj) {                                          \n                promise._rejectCallback(maybeWrapAsError(ret.e), true, true);\n            }                                                                \n            if (!promise._isFateSealed()) promise._setAsyncGuaranteed();     \n            return promise;                                                  \n        };                                                                   \n        notEnumerableProp(ret, '__isPromisified__', true);                   \n        return ret;                                                          \n    ".replace("[CodeForSwitchCase]",c()).replace("[GetFunctionCode]",_);return y=y.replace("Parameters",P(l)),new Function("Promise","fn","receiver","withAppended","maybeWrapAsError","nodebackForPromise","tryCatch","errorObj","notEnumerableProp","INTERNAL",y)(e,o,r,m,g,v,d.tryCatch,d.errorObj,d.notEnumerableProp,t)};var S=b?f:u;e.promisify=function(e,t){if("function"!=typeof e)throw new w("expecting a function but got "+d.classString(e));if(i(e))return e;t=Object(t);var r=void 0===t.context?p:t.context,o=!!t.multiArgs,a=l(e,r,o);return d.copyDescriptors(e,a,n),a},e.promisifyAll=function(e,t){if("function"!=typeof e&&"object"!==("undefined"==typeof e?"undefined":r["typeof"](e)))throw new w("the target of promisifyAll must be an object or a function\n\n    See http://goo.gl/MqrFmX\n");t=Object(t);var n=!!t.multiArgs,i=t.suffix;"string"!=typeof i&&(i=j);var o=t.filter;"function"!=typeof o&&(o=E);var a=t.promisifier;if("function"!=typeof a&&(a=S),!d.isIdentifier(i))throw new RangeError("suffix must be a valid identifier\n\n    See http://goo.gl/MqrFmX\n");for(var s=d.inheritedDataKeys(e),u=0;u<s.length;++u){var l=e[s[u]];"constructor"!==s[u]&&d.isClass(l)&&(c(l.prototype,i,o,a,n),c(l,i,o,a,n))}return c(e,i,o,a,n)}}}),g=m&&"object"===("undefined"==typeof m?"undefined":r["typeof"](m))&&"default"in m?m["default"]:m,b=t(function(e){e.exports=function(e,t,n){function r(e){this.constructor$(e),this._howMany=0,this._unwrap=!1,this._initialized=!1}function i(e,t){if((0|t)!==t||0>t)return n("expecting a positive integer\n\n    See http://goo.gl/MqrFmX\n");var i=new r(e),o=i.promise();return i.setHowMany(t),i.init(),o}var o=h,a=_.RangeError,s=_.AggregateError,u=o.isArray,c={};o.inherits(r,t),r.prototype._init=function(){if(this._initialized){if(0===this._howMany)return void this._resolve([]);this._init$(void 0,-5);var e=u(this._values);!this._isResolved()&&e&&this._howMany>this._canPossiblyFulfill()&&this._reject(this._getRangeError(this.length()))}},r.prototype.init=function(){this._initialized=!0,this._init()},r.prototype.setUnwrap=function(){this._unwrap=!0},r.prototype.howMany=function(){return this._howMany},r.prototype.setHowMany=function(e){this._howMany=e},r.prototype._promiseFulfilled=function(e){return this._addFulfilled(e),this._fulfilled()===this.howMany()?(this._values.length=this.howMany(),1===this.howMany()&&this._unwrap?this._resolve(this._values[0]):this._resolve(this._values),!0):!1},r.prototype._promiseRejected=function(e){return this._addRejected(e),this._checkOutcome()},r.prototype._promiseCancelled=function(){return this._values instanceof e||null==this._values?this._cancel():(this._addRejected(c),this._checkOutcome())},r.prototype._checkOutcome=function(){if(this.howMany()>this._canPossiblyFulfill()){for(var e=new s,t=this.length();t<this._values.length;++t)this._values[t]!==c&&e.push(this._values[t]);return e.length>0?this._reject(e):this._cancel(),!0}return!1},r.prototype._fulfilled=function(){return this._totalResolved},r.prototype._rejected=function(){return this._values.length-this.length()},r.prototype._addRejected=function(e){this._values.push(e)},r.prototype._addFulfilled=function(e){this._values[this._totalResolved++]=e},r.prototype._canPossiblyFulfill=function(){return this.length()-this._rejected()},r.prototype._getRangeError=function(e){var t="Input array must contain at least "+this._howMany+" items but contains only "+e+" items";return new a(t)},r.prototype._resolveEmptyArray=function(){this._reject(this._getRangeError(0))},e.some=function(e,t){return i(e,t)},e.prototype.some=function(e){return i(this,e)},e._SomePromiseArray=r}}),w=b&&"object"===("undefined"==typeof b?"undefined":r["typeof"](b))&&"default"in b?b["default"]:b,j=t(function(e){e.exports=function(e,t,n){function r(e){this.constructor$(e)}var i=e.PromiseInspection,o=h;o.inherits(r,t),r.prototype._promiseResolved=function(e,t){this._values[e]=t;var n=++this._totalResolved;return n>=this._length?(this._resolve(this._values),!0):!1},r.prototype._promiseFulfilled=function(e,t){var n=new i;return n._bitField=33554432,n._settledValueField=e,this._promiseResolved(t,n)},r.prototype._promiseRejected=function(e,t){var n=new i;return n._bitField=16777216,n._settledValueField=e,this._promiseResolved(t,n)},e.settle=function(e){return n.deprecated(".settle()",".reflect()"),new r(e).promise()},e.prototype.settle=function(){return e.settle(this)}}}),C=j&&"object"===("undefined"==typeof j?"undefined":r["typeof"](j))&&"default"in j?j["default"]:j,k=t(function(e){e.exports=function(e,t,n,r,i,o){function a(t,n,r,o){this.constructor$(t);var a=f();this._fn=null===a?n:a.bind(n),void 0!==r&&(r=e.resolve(r),r._attachCancellationCallback(this)),this._initialValue=r,this._currentCancellable=null,this._eachValues=o===i?[]:void 0,this._promise._captureStackTrace(),this._init$(void 0,-5)}function s(e,t){this.isFulfilled()?t._resolve(e):t._reject(e)}function u(e,t,r,i){if("function"!=typeof t)return n("expecting a function but got "+p.classString(t));var o=new a(e,t,r,i);return o.promise()}function c(t){this.accum=t,this.array._gotAccum(t);var n=r(this.value,this.array._promise);return n instanceof e?(this.array._currentCancellable=n,n._then(l,void 0,void 0,this,void 0)):l.call(this,n)}function l(t){var n=this.array,r=n._promise,i=d(n._fn);r._pushContext();var a;a=void 0!==n._eachValues?i.call(r._boundValue(),t,this.index,this.length):i.call(r._boundValue(),this.accum,t,this.index,this.length),a instanceof e&&(n._currentCancellable=a);var s=r._popContext();return o.checkForgottenReturns(a,s,void 0!==n._eachValues?"Promise.each":"Promise.reduce",r),a}var f=e._getDomain,p=h,d=p.tryCatch;p.inherits(a,t),a.prototype._gotAccum=function(e){void 0!==this._eachValues&&e!==i&&this._eachValues.push(e)},a.prototype._eachComplete=function(e){return this._eachValues.push(e),this._eachValues},a.prototype._init=function(){},a.prototype._resolveEmptyArray=function(){this._resolve(void 0!==this._eachValues?this._eachValues:this._initialValue)},a.prototype.shouldCopyValues=function(){return!1},a.prototype._resolve=function(e){this._promise._resolveCallback(e),this._values=null},a.prototype._resultCancelled=function(t){return t===this._initialValue?this._cancel():void(this._isResolved()||(this._resultCancelled$(),this._currentCancellable instanceof e&&this._currentCancellable.cancel(),this._initialValue instanceof e&&this._initialValue.cancel()))},a.prototype._iterate=function(t){this._values=t;var n,r,i=t.length;if(void 0!==this._initialValue?(n=this._initialValue,r=0):(n=e.resolve(t[0]),r=1),this._currentCancellable=n,!n.isRejected())for(;i>r;++r){var o={accum:null,value:t[r],index:r,length:i,array:this};n=n._then(c,void 0,void 0,o,void 0)}void 0!==this._eachValues&&(n=n._then(this._eachComplete,void 0,void 0,this,void 0)),n._then(s,s,void 0,n,this)},e.prototype.reduce=function(e,t){return u(this,e,t,null)},e.reduce=function(e,t,n,r){return u(e,t,n,r)}}}),F=k&&"object"===("undefined"==typeof k?"undefined":r["typeof"](k))&&"default"in k?k["default"]:k,E=t(function(e){e.exports=function(e,t,n,r){function i(i,s){var u=n(i);if(u instanceof e)return a(u);if(i=o.asArray(i),null===i)return r("expecting an array or an iterable object but got "+o.classString(i));var c=new e(t);void 0!==s&&c._propagateFrom(s,3);for(var l=c._fulfill,f=c._reject,p=0,h=i.length;h>p;++p){var d=i[p];(void 0!==d||p in i)&&e.cast(d)._then(l,f,void 0,c,null)}return c}var o=h,a=function(e){return e.then(function(t){return i(t,e)})};e.race=function(e){return i(e,void 0)},e.prototype.race=function(){return i(this,void 0)}}}),x=E&&"object"===("undefined"==typeof E?"undefined":r["typeof"](E))&&"default"in E?E["default"]:E,T=t(function(e){e.exports=function(e,t,n,r){function i(e){var t,n=!1;if(void 0!==a&&e instanceof a)t=l(e),n=!0;else{var r=c.keys(e),i=r.length;t=new Array(2*i);for(var o=0;i>o;++o){var s=r[o];t[o]=e[s],t[o+i]=s}}this.constructor$(t),this._isMap=n,this._init$(void 0,-3)}function o(t){var o,a=n(t);return u(a)?(o=a instanceof e?a._then(e.props,void 0,void 0,void 0,void 0):new i(a).promise(),a instanceof e&&o._propagateFrom(a,2),o):r("cannot await properties of a non-object\n\n    See http://goo.gl/MqrFmX\n")}var a,s=h,u=s.isObject,c=f;"function"==typeof Map&&(a=Map);var l=function(){function e(e,r){this[t]=e,this[t+n]=r,t++}var t=0,n=0;return function(r){n=r.size,t=0;var i=new Array(2*r.size);return r.forEach(e,i),i}}(),p=function(e){for(var t=new a,n=e.length/2|0,r=0;n>r;++r){var i=e[n+r],o=e[r];t.set(i,o)}return t};s.inherits(i,t),i.prototype._init=function(){},i.prototype._promiseFulfilled=function(e,t){this._values[t]=e;var n=++this._totalResolved;if(n>=this._length){var r;if(this._isMap)r=p(this._values);else{r={};for(var i=this.length(),o=0,a=this.length();a>o;++o)r[this._values[o+i]]=this._values[o]}return this._resolve(r),!0}return!1},i.prototype.shouldCopyValues=function(){return!1},i.prototype.getActualLength=function(e){return e>>1},e.prototype.props=function(){return o(this)},e.props=function(e){return o(e)}}}),O=T&&"object"===("undefined"==typeof T?"undefined":r["typeof"](T))&&"default"in T?T["default"]:T,P=t(function(e){var t=Object.create;if(t){var n=t(null),r=t(null);n[" size"]=r[" size"]=0}e.exports=function(e){function t(t,n){var r;if(null!=t&&(r=t[n]),"function"!=typeof r){var i="Object "+c.classString(t)+" has no method '"+c.toString(n)+"'";throw new e.TypeError(i)}return r}function i(e){var n=this.pop(),r=t(e,n);return r.apply(e,this)}function o(e){return e[this]}function a(e){var t=+this;return 0>t&&(t=Math.max(0,t+e.length)),e[t]}var s,u,c=h,l=c.canEvaluate,f=c.isIdentifier,p=function(e){return new Function("ensureMethod","                                    \n        return function(obj) {                                               \n            'use strict'                                                     \n            var len = this.length;                                           \n            ensureMethod(obj, 'methodName');                                 \n            switch(len) {                                                    \n                case 1: return obj.methodName(this[0]);                      \n                case 2: return obj.methodName(this[0], this[1]);             \n                case 3: return obj.methodName(this[0], this[1], this[2]);    \n                case 0: return obj.methodName();                             \n                default:                                                     \n                    return obj.methodName.apply(obj, this);                  \n            }                                                                \n        };                                                                   \n        ".replace(/methodName/g,e))(t)},d=function(e){return new Function("obj","                                             \n        'use strict';                                                        \n        return obj.propertyName;                                             \n        ".replace("propertyName",e))},_=function(e,t,n){var r=n[e];if("function"!=typeof r){if(!f(e))return null;if(r=t(e),n[e]=r,n[" size"]++,n[" size"]>512){for(var i=Object.keys(n),o=0;256>o;++o)delete n[i[o]];n[" size"]=i.length-256}}return r};s=function(e){return _(e,p,n)},u=function(e){return _(e,d,r)},e.prototype.call=function(e){for(var t=arguments.length,n=new Array(t-1),r=1;t>r;++r)n[r-1]=arguments[r];if(l){var o=s(e);if(null!==o)return this._then(o,void 0,void 0,n,void 0)}return n.push(e),this._then(i,void 0,void 0,n,void 0)},e.prototype.get=function(e){var t,n="number"==typeof e;if(n)t=a;else if(l){var r=u(e);t=null!==r?r:o}else t=o;return this._then(t,void 0,void 0,e,void 0)}}}),R=P&&"object"===("undefined"==typeof P?"undefined":r["typeof"](P))&&"default"in P?P["default"]:P,S=t(function(e){e.exports=function(e){function t(e,t){var r=this;if(!i.isArray(e))return n.call(r,e,t);var u=a(t).apply(r._boundValue(),[null].concat(e));u===s&&o.throwLater(u.e)}function n(e,t){var n=this,r=n._boundValue(),i=void 0===e?a(t).call(r,null):a(t).call(r,null,e);i===s&&o.throwLater(i.e)}function r(e,t){var n=this;if(!e){var r=new Error(e+"");r.cause=e,e=r}var i=a(t).call(n._boundValue(),e);i===s&&o.throwLater(i.e)}var i=h,o=e._async,a=i.tryCatch,s=i.errorObj;e.prototype.asCallback=e.prototype.nodeify=function(e,i){if("function"==typeof e){var o=n;void 0!==i&&Object(i).spread&&(o=t),this._then(o,r,void 0,this,e)}return this}}}),A=S&&"object"===("undefined"==typeof S?"undefined":r["typeof"](S))&&"default"in S?S["default"]:S,N=t(function(e){e.exports=function(e,t,n,r,i,o){function a(t,n,i){for(var o=0;o<n.length;++o){i._pushContext();var a=p(n[o])(t);if(i._popContext(),a===f){i._pushContext();var s=e.reject(f.e);return i._popContext(),s}var u=r(a,i);if(u instanceof e)return u}return null}function s(t,r,i,o){var a=this._promise=new e(n);a._captureStackTrace(),a._setOnCancel(this),this._stack=o,this._generatorFunction=t,this._receiver=r,this._generator=void 0,this._yieldHandlers="function"==typeof i?[i].concat(d):d,this._yieldedPromise=null}var u=_,c=u.TypeError,l=h,f=l.errorObj,p=l.tryCatch,d=[];l.inherits(s,i),s.prototype._isResolved=function(){return null===this._promise},s.prototype._cleanup=function(){this._promise=this._generator=null},s.prototype._promiseCancelled=function(){if(!this._isResolved()){var t,n="undefined"!=typeof this._generator["return"];if(n)this._promise._pushContext(),t=p(this._generator["return"]).call(this._generator,void 0),this._promise._popContext();else{var r=new e.CancellationError("generator .return() sentinel");e.coroutine.returnSentinel=r,this._promise._attachExtraTrace(r),this._promise._pushContext(),t=p(this._generator["throw"]).call(this._generator,r),this._promise._popContext(),t===f&&t.e===r&&(t=null)}var i=this._promise;this._cleanup(),t===f?i._rejectCallback(t.e,!1):i.cancel()}},s.prototype._promiseFulfilled=function(e){this._yieldedPromise=null,this._promise._pushContext();var t=p(this._generator.next).call(this._generator,e);this._promise._popContext(),this._continue(t)},s.prototype._promiseRejected=function(e){this._yieldedPromise=null,this._promise._attachExtraTrace(e),this._promise._pushContext();var t=p(this._generator["throw"]).call(this._generator,e);this._promise._popContext(),this._continue(t)},s.prototype._resultCancelled=function(){if(this._yieldedPromise instanceof e){var t=this._yieldedPromise;this._yieldedPromise=null,this._promiseCancelled(),t.cancel()}},s.prototype.promise=function(){return this._promise},s.prototype._run=function(){this._generator=this._generatorFunction.call(this._receiver),this._receiver=this._generatorFunction=void 0,this._promiseFulfilled(void 0)},s.prototype._continue=function(t){var n=this._promise;if(t===f)return this._cleanup(),n._rejectCallback(t.e,!1);var i=t.value;if(t.done===!0)return this._cleanup(),n._resolveCallback(i);var o=r(i,this._promise);if(!(o instanceof e)&&(o=a(o,this._yieldHandlers,this._promise),null===o))return void this._promiseRejected(new c("A value %s was yielded that could not be treated as a promise\n\n    See http://goo.gl/MqrFmX\n\n".replace("%s",i)+"From coroutine:\n"+this._stack.split("\n").slice(1,-7).join("\n")));o=o._target();var s=o._bitField;0===(50397184&s)?(this._yieldedPromise=o,o._proxy(this,null)):0!==(33554432&s)?this._promiseFulfilled(o._value()):0!==(16777216&s)?this._promiseRejected(o._reason()):this._promiseCancelled()},e.coroutine=function(e,t){if("function"!=typeof e)throw new c("generatorFunction must be a function\n\n    See http://goo.gl/MqrFmX\n");var n=Object(t).yieldHandler,r=s,i=(new Error).stack;return function(){var t=e.apply(this,arguments),o=new r(void 0,void 0,n,i),a=o.promise();return o._generator=t,o._promiseFulfilled(void 0),a}},e.coroutine.addYieldHandler=function(e){if("function"!=typeof e)throw new c("expecting a function but got "+l.classString(e));d.push(e)},e.spawn=function(n){if(o.deprecated("Promise.spawn()","Promise.coroutine()"),"function"!=typeof n)return t("generatorFunction must be a function\n\n    See http://goo.gl/MqrFmX\n");
var r=new s(n,this),i=r.promise();return r._run(e.spawn),i}}}),D=N&&"object"===("undefined"==typeof N?"undefined":r["typeof"](N))&&"default"in N?N["default"]:N,I=t(function(e){e.exports=function(e,t,n){function r(e){this.handle=e}function i(e){return clearTimeout(this.handle),e}function o(e){throw clearTimeout(this.handle),e}var a=h,s=e.TimeoutError;r.prototype._resultCancelled=function(){clearTimeout(this.handle)};var u=function(e){return c(+this).thenReturn(e)},c=e.delay=function(i,o){var a,s;return void 0!==o?(a=e.resolve(o)._then(u,null,null,i,void 0),n.cancellation()&&o instanceof e&&a._setOnCancel(o)):(a=new e(t),s=setTimeout(function(){a._fulfill()},+i),n.cancellation()&&a._setOnCancel(new r(s))),a._setAsyncGuaranteed(),a};e.prototype.delay=function(e){return c(e,this)};var l=function(e,t,n){var r;r="string"!=typeof t?t instanceof Error?t:new s("operation timed out"):new s(t),a.markAsOriginatingFromRejection(r),e._attachExtraTrace(r),e._reject(r),null!=n&&n.cancel()};e.prototype.timeout=function(e,t){e=+e;var a,s,u=new r(setTimeout(function(){a.isPending()&&l(a,t,s)},e));return n.cancellation()?(s=this.then(),a=s._then(i,o,void 0,u,void 0),a._setOnCancel(u)):a=this._then(i,o,void 0,u,void 0),a}}}),V=I&&"object"===("undefined"==typeof I?"undefined":r["typeof"](I))&&"default"in I?I["default"]:I,L=t(function(e){e.exports=function(e,t,n,r,i,o){function a(e){setTimeout(function(){throw e},0)}function s(e){var t=n(e);return t!==e&&"function"==typeof e._isDisposable&&"function"==typeof e._getDisposer&&e._isDisposable()&&t._setDisposable(e._getDisposer()),t}function u(t,r){function o(){if(u>=c)return l._fulfill();var i=s(t[u++]);if(i instanceof e&&i._isDisposable()){try{i=n(i._getDisposer().tryDispose(r),t.promise)}catch(f){return a(f)}if(i instanceof e)return i._then(o,a,null,null,null)}o()}var u=0,c=t.length,l=new e(i);return o(),l}function c(e,t,n){this._data=e,this._promise=t,this._context=n}function l(e,t,n){this.constructor$(e,t,n)}function f(e){return c.isDisposer(e)?(this.resources[this.index]._setDisposable(e),e.promise()):e}function p(e){this.length=e,this.promise=null,this[e-1]=null}var d=h,v=_.TypeError,y=h.inherits,m=d.errorObj,g=d.tryCatch;c.prototype.data=function(){return this._data},c.prototype.promise=function(){return this._promise},c.prototype.resource=function(){return this.promise().isFulfilled()?this.promise().value():null},c.prototype.tryDispose=function(e){var t=this.resource(),n=this._context;void 0!==n&&n._pushContext();var r=null!==t?this.doDispose(t,e):null;return void 0!==n&&n._popContext(),this._promise._unsetDisposable(),this._data=null,r},c.isDisposer=function(e){return null!=e&&"function"==typeof e.resource&&"function"==typeof e.tryDispose},y(l,c),l.prototype.doDispose=function(e,t){var n=this.data();return n.call(e,e,t)},p.prototype._resultCancelled=function(){for(var t=this.length,n=0;t>n;++n){var r=this[n];r instanceof e&&r.cancel()}},e.using=function(){var r=arguments.length;if(2>r)return t("you must pass at least 2 arguments to Promise.using");var i=arguments[r-1];if("function"!=typeof i)return t("expecting a function but got "+d.classString(i));var a,s=!0;2===r&&Array.isArray(arguments[0])?(a=arguments[0],r=a.length,s=!1):(a=arguments,r--);for(var l=new p(r),h=0;r>h;++h){var _=a[h];if(c.isDisposer(_)){var v=_;_=_.promise(),_._setDisposable(v)}else{var y=n(_);y instanceof e&&(_=y._then(f,null,null,{resources:l,index:h},void 0))}l[h]=_}for(var b=new Array(l.length),h=0;h<b.length;++h)b[h]=e.resolve(l[h]).reflect();var w=e.all(b).then(function(e){for(var t=0;t<e.length;++t){var n=e[t];if(n.isRejected())return m.e=n.error(),m;if(!n.isFulfilled())return void w.cancel();e[t]=n.value()}j._pushContext(),i=g(i);var r=s?i.apply(void 0,e):i(e),a=j._popContext();return o.checkForgottenReturns(r,a,"Promise.using",j),r}),j=w.lastly(function(){var t=new e.PromiseInspection(w);return u(l,t)});return l.promise=j,j._setOnCancel(l),j},e.prototype._setDisposable=function(e){this._bitField=131072|this._bitField,this._disposer=e},e.prototype._isDisposable=function(){return(131072&this._bitField)>0},e.prototype._getDisposer=function(){return this._disposer},e.prototype._unsetDisposable=function(){this._bitField=-131073&this._bitField,this._disposer=void 0},e.prototype.disposer=function(e){if("function"==typeof e)return new l(e,this,r());throw new v}}}),H=L&&"object"===("undefined"==typeof L?"undefined":r["typeof"](L))&&"default"in L?L["default"]:L,M=t(function(e){e.exports=function(e,t,n,i,o,a){function s(e,t,n,r){this.constructor$(e),this._promise._captureStackTrace();var i=c();this._callback=null===i?t:i.bind(t),this._preservedValues=r===o?new Array(this.length()):null,this._limit=n,this._inFlight=0,this._queue=n>=1?[]:d,this._init$(void 0,-2)}function u(e,t,i,o){if("function"!=typeof t)return n("expecting a function but got "+l.classString(t));var a="object"===("undefined"==typeof i?"undefined":r["typeof"](i))&&null!==i?i.concurrency:0;return a="number"==typeof a&&isFinite(a)&&a>=1?a:0,new s(e,t,a,o).promise()}var c=e._getDomain,l=h,f=l.tryCatch,p=l.errorObj,d=[];l.inherits(s,t),s.prototype._init=function(){},s.prototype._promiseFulfilled=function(t,n){var r=this._values,o=this.length(),s=this._preservedValues,u=this._limit;if(0>n){if(n=-1*n-1,r[n]=t,u>=1&&(this._inFlight--,this._drainQueue(),this._isResolved()))return!0}else{if(u>=1&&this._inFlight>=u)return r[n]=t,this._queue.push(n),!1;null!==s&&(s[n]=t);var c=this._promise,l=this._callback,h=c._boundValue();c._pushContext();var d=f(l).call(h,t,n,o),_=c._popContext();if(a.checkForgottenReturns(d,_,null!==s?"Promise.filter":"Promise.map",c),d===p)return this._reject(d.e),!0;var v=i(d,this._promise);if(v instanceof e){v=v._target();var y=v._bitField;if(0===(50397184&y))return u>=1&&this._inFlight++,r[n]=v,v._proxy(this,-1*(n+1)),!1;if(0===(33554432&y))return 0!==(16777216&y)?(this._reject(v._reason()),!0):(this._cancel(),!0);d=v._value()}r[n]=d}var m=++this._totalResolved;return m>=o?(null!==s?this._filter(r,s):this._resolve(r),!0):!1},s.prototype._drainQueue=function(){for(var e=this._queue,t=this._limit,n=this._values;e.length>0&&this._inFlight<t;){if(this._isResolved())return;var r=e.pop();this._promiseFulfilled(n[r],r)}},s.prototype._filter=function(e,t){for(var n=t.length,r=new Array(n),i=0,o=0;n>o;++o)e[o]&&(r[i++]=t[o]);r.length=i,this._resolve(r)},s.prototype.preservedValues=function(){return this._preservedValues},e.prototype.map=function(e,t){return u(this,e,t,null)},e.map=function(e,t,n,r){return u(e,t,n,r)}}}),U=M&&"object"===("undefined"==typeof M?"undefined":r["typeof"](M))&&"default"in M?M["default"]:M,B=t(function(e){e.exports=function(e,t,n,r){var i,o=h,a=o.canEvaluate,s=o.tryCatch,u=o.errorObj;if(a){for(var c=function(e){return new Function("value","holder","                             \n            'use strict';                                                    \n            holder.pIndex = value;                                           \n            holder.checkFulfillment(this);                                   \n            ".replace(/Index/g,e))},l=function(e){return new Function("promise","holder","                           \n            'use strict';                                                    \n            holder.pIndex = promise;                                         \n            ".replace(/Index/g,e))},f=function(t){for(var n=new Array(t),r=0;r<n.length;++r)n[r]="this.p"+(r+1);var i=n.join(" = ")+" = null;",o="var promise;\n"+n.map(function(e){return"                                                         \n                promise = "+e+";                                      \n                if (promise instanceof Promise) {                            \n                    promise.cancel();                                        \n                }                                                            \n            "}).join("\n"),a=n.join(", "),c="Holder$"+t,l="return function(tryCatch, errorObj, Promise) {           \n            'use strict';                                                    \n            function [TheName](fn) {                                         \n                [TheProperties]                                              \n                this.fn = fn;                                                \n                this.now = 0;                                                \n            }                                                                \n            [TheName].prototype.checkFulfillment = function(promise) {       \n                var now = ++this.now;                                        \n                if (now === [TheTotal]) {                                    \n                    promise._pushContext();                                  \n                    var callback = this.fn;                                  \n                    var ret = tryCatch(callback)([ThePassedArguments]);      \n                    promise._popContext();                                   \n                    if (ret === errorObj) {                                  \n                        promise._rejectCallback(ret.e, false);               \n                    } else {                                                 \n                        promise._resolveCallback(ret);                       \n                    }                                                        \n                }                                                            \n            };                                                               \n                                                                             \n            [TheName].prototype._resultCancelled = function() {              \n                [CancellationCode]                                           \n            };                                                               \n                                                                             \n            return [TheName];                                                \n        }(tryCatch, errorObj, Promise);                                      \n        ";return l=l.replace(/\[TheName\]/g,c).replace(/\[TheTotal\]/g,t).replace(/\[ThePassedArguments\]/g,a).replace(/\[TheProperties\]/g,i).replace(/\[CancellationCode\]/g,o),new Function("tryCatch","errorObj","Promise",l)(s,u,e)},p=[],d=[],_=[],v=0;8>v;++v)p.push(f(v+1)),d.push(c(v+1)),_.push(l(v+1));i=function(e){this._reject(e)}}e.join=function(){var o,s=arguments.length-1;if(s>0&&"function"==typeof arguments[s]&&(o=arguments[s],8>=s&&a)){var u=new e(r);u._captureStackTrace();for(var c=p[s-1],l=new c(o),f=d,h=0;s>h;++h){var v=n(arguments[h],u);if(v instanceof e){v=v._target();var y=v._bitField;0===(50397184&y)?(v._then(f[h],i,void 0,u,l),_[h](v,l)):0!==(33554432&y)?f[h].call(u,v._value(),l):0!==(16777216&y)?u._reject(v._reason()):u._cancel()}else f[h].call(u,v,l)}return u._isFateSealed()||(u._setAsyncGuaranteed(),u._setOnCancel(l)),u}for(var m=arguments.length,g=new Array(m),b=0;m>b;++b)g[b]=arguments[b];o&&g.pop();var u=new t(g).promise();return void 0!==o?u.spread(o):u}}}),$=B&&"object"===("undefined"==typeof B?"undefined":r["typeof"](B))&&"default"in B?B["default"]:B,Q=t(function(e){e.exports=function(e){function t(e){void 0!==e?(e=e._target(),this._bitField=e._bitField,this._settledValueField=e._isFateSealed()?e._settledValue():void 0):(this._bitField=0,this._settledValueField=void 0)}t.prototype._settledValue=function(){return this._settledValueField};var n=t.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()},r=t.prototype.error=t.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=t.prototype.isFulfilled=function(){return 0!==(33554432&this._bitField)},o=t.prototype.isRejected=function(){return 0!==(16777216&this._bitField)},a=t.prototype.isPending=function(){return 0===(50397184&this._bitField)},s=t.prototype.isResolved=function(){return 0!==(50331648&this._bitField)};t.prototype.isCancelled=e.prototype._isCancelled=function(){return 65536===(65536&this._bitField)},e.prototype.isCancelled=function(){return this._target()._isCancelled()},e.prototype.isPending=function(){return a.call(this._target())},e.prototype.isRejected=function(){return o.call(this._target())},e.prototype.isFulfilled=function(){return i.call(this._target())},e.prototype.isResolved=function(){return s.call(this._target())},e.prototype.value=function(){return n.call(this._target())},e.prototype.reason=function(){var e=this._target();return e._unsetRejectionIsUnhandled(),r.call(e)},e.prototype._value=function(){return this._settledValue()},e.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue()},e.PromiseInspection=t}}),q=Q&&"object"===("undefined"==typeof Q?"undefined":r["typeof"](Q))&&"default"in Q?Q["default"]:Q,G=t(function(e){e.exports=function(e){function t(){return this.value}function n(){throw this.reason}e.prototype["return"]=e.prototype.thenReturn=function(n){return n instanceof e&&n.suppressUnhandledRejections(),this._then(t,void 0,void 0,{value:n},void 0)},e.prototype["throw"]=e.prototype.thenThrow=function(e){return this._then(n,void 0,void 0,{reason:e},void 0)},e.prototype.catchThrow=function(e){if(arguments.length<=1)return this._then(void 0,n,void 0,{reason:e},void 0);var t=arguments[1],r=function(){throw t};return this.caught(e,r)},e.prototype.catchReturn=function(n){if(arguments.length<=1)return n instanceof e&&n.suppressUnhandledRejections(),this._then(void 0,t,void 0,{value:n},void 0);var r=arguments[1];r instanceof e&&r.suppressUnhandledRejections();var i=function(){return r};return this.caught(n,i)}}}),z=G&&"object"===("undefined"==typeof G?"undefined":r["typeof"](G))&&"default"in G?G["default"]:G,X=t(function(e){e.exports=function(e,t,n,r){var i=h,o=i.tryCatch,a=i.errorObj,s=e._async;e.prototype["break"]=e.prototype.cancel=function(){if(!r.cancellation())return this._warn("cancellation is disabled");for(var e=this,t=e;e.isCancellable();){if(!e._cancelBy(t)){t._isFollowing()?t._followee().cancel():t._cancelBranched();break}var n=e._cancellationParent;if(null==n||!n.isCancellable()){e._isFollowing()?e._followee().cancel():e._cancelBranched();break}e._isFollowing()&&e._followee().cancel(),t=e,e=n}},e.prototype._branchHasCancelled=function(){this._branchesRemainingToCancel--},e.prototype._enoughBranchesHaveCancelled=function(){return void 0===this._branchesRemainingToCancel||this._branchesRemainingToCancel<=0},e.prototype._cancelBy=function(e){return e===this?(this._branchesRemainingToCancel=0,this._invokeOnCancel(),!0):(this._branchHasCancelled(),this._enoughBranchesHaveCancelled()?(this._invokeOnCancel(),!0):!1)},e.prototype._cancelBranched=function(){this._enoughBranchesHaveCancelled()&&this._cancel()},e.prototype._cancel=function(){this.isCancellable()&&(this._setCancelled(),s.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._doInvokeOnCancel=function(e,t){if(i.isArray(e))for(var n=0;n<e.length;++n)this._doInvokeOnCancel(e[n],t);else if(void 0!==e)if("function"==typeof e){if(!t){var r=o(e).call(this._boundValue());r===a&&(this._attachExtraTrace(r.e),s.throwLater(r.e))}}else e._resultCancelled(this)},e.prototype._invokeOnCancel=function(){var e=this._onCancel();this._unsetOnCancel(),s.invoke(this._doInvokeOnCancel,this,e)},e.prototype._invokeInternalOnCancel=function(){this.isCancellable()&&(this._doInvokeOnCancel(this._onCancel(),!0),this._unsetOnCancel())},e.prototype._resultCancelled=function(){this.cancel()}}}),W=X&&"object"===("undefined"==typeof X?"undefined":r["typeof"](X))&&"default"in X?X["default"]:X,K=t(function(e){e.exports=function(e,t,n,r){var i=!1,o=function(e,t){this._reject(t)},a=function(e,t){t.promiseRejectionQueued=!0,t.bindingPromise._then(o,o,null,this,e)},s=function(e,t){0===(50397184&this._bitField)&&this._resolveCallback(t.target)},u=function(e,t){t.promiseRejectionQueued||this._reject(e)};e.prototype.bind=function(o){i||(i=!0,e.prototype._propagateFrom=r.propagateFromFunction(),e.prototype._boundValue=r.boundValueFunction());var c=n(o),l=new e(t);l._propagateFrom(this,1);var f=this._target();if(l._setBoundTo(c),c instanceof e){var p={promiseRejectionQueued:!1,promise:l,target:f,bindingPromise:c};f._then(t,a,void 0,l,p),c._then(s,u,void 0,l,p),l._setOnCancel(c)}else l._resolveCallback(f);return l},e.prototype._setBoundTo=function(e){void 0!==e?(this._bitField=2097152|this._bitField,this._boundTo=e):this._bitField=-2097153&this._bitField},e.prototype._isBound=function(){return 2097152===(2097152&this._bitField)},e.bind=function(t,n){return e.resolve(n).bind(t)}}}),J=K&&"object"===("undefined"==typeof K?"undefined":r["typeof"](K))&&"default"in K?K["default"]:K,Y=t(function(e){e.exports=function(e,t,n,r,i){var o=h,a=o.tryCatch;e.method=function(n){if("function"!=typeof n)throw new e.TypeError("expecting a function but got "+o.classString(n));return function(){var r=new e(t);r._captureStackTrace(),r._pushContext();var o=a(n).apply(this,arguments),s=r._popContext();return i.checkForgottenReturns(o,s,"Promise.method",r),r._resolveFromSyncValue(o),r}},e.attempt=e["try"]=function(n){if("function"!=typeof n)return r("expecting a function but got "+o.classString(n));var s=new e(t);s._captureStackTrace(),s._pushContext();var u;if(arguments.length>1){i.deprecated("calling Promise.try with more than 1 argument");var c=arguments[1],l=arguments[2];u=o.isArray(c)?a(n).apply(l,c):a(n).call(l,c)}else u=a(n)();var f=s._popContext();return i.checkForgottenReturns(u,f,"Promise.try",s),s._resolveFromSyncValue(u),s},e.prototype._resolveFromSyncValue=function(e){e===o.errorObj?this._rejectCallback(e.e,!1):this._resolveCallback(e,!0)}}}),Z=Y&&"object"===("undefined"==typeof Y?"undefined":r["typeof"](Y))&&"default"in Y?Y["default"]:Y,ee=t(function(e){e.exports=function(e){function t(t,a,s){return function(u){var c=s._boundValue();e:for(var l=0;l<t.length;++l){var f=t[l];if(f===Error||null!=f&&f.prototype instanceof Error){if(u instanceof f)return i(a).call(c,u)}else if("function"==typeof f){var p=i(f).call(c,u);if(p===o)return p;if(p)return i(a).call(c,u)}else if(n.isObject(u)){for(var h=r(f),d=0;d<h.length;++d){var _=h[d];if(f[_]!=u[_])continue e}return i(a).call(c,u)}}return e}}var n=h,r=f.keys,i=n.tryCatch,o=n.errorObj;return t}}),te=ee&&"object"===("undefined"==typeof ee?"undefined":r["typeof"](ee))&&"default"in ee?ee["default"]:ee,ne=t(function(e){e.exports=function(e,t){function n(e,t,n){this.promise=e,this.type=t,this.handler=n,this.called=!1,this.cancelPromise=null}function r(e){this.finallyHandler=e}function i(e,t){return null!=e.cancelPromise?(arguments.length>1?e.cancelPromise._reject(t):e.cancelPromise._cancel(),e.cancelPromise=null,!0):!1}function o(){return s.call(this,this.promise._target()._settledValue())}function a(e){return i(this,e)?void 0:(l.e=e,l)}function s(n){var s=this.promise,u=this.handler;if(!this.called){this.called=!0;var f=this.isFinallyHandler()?u.call(s._boundValue()):u.call(s._boundValue(),n);if(void 0!==f){s._setReturnedNonUndefined();var p=t(f,s);if(p instanceof e){if(null!=this.cancelPromise){if(p.isCancelled()){var h=new c("late cancellation observer");return s._attachExtraTrace(h),l.e=h,l}p.isPending()&&p._attachCancellationCallback(new r(this))}return p._then(o,a,void 0,this,void 0)}}}return s.isRejected()?(i(this),l.e=n,l):(i(this),n)}var u=h,c=e.CancellationError,l=u.errorObj;return n.prototype.isFinallyHandler=function(){return 0===this.type},r.prototype._resultCancelled=function(){i(this.finallyHandler)},e.prototype._passThrough=function(e,t,r,i){return"function"!=typeof e?this.then():this._then(r,i,void 0,new n(this,t,e),void 0)},e.prototype.lastly=e.prototype["finally"]=function(e){return this._passThrough(e,0,s,s)},e.prototype.tap=function(e){return this._passThrough(e,1,s)},n}}),re=ne&&"object"===("undefined"==typeof ne?"undefined":r["typeof"](ne))&&"default"in ne?ne["default"]:ne,ie=t(function(e){e.exports=function(e,t){function n(e,t){return{promise:t}}function i(){return!1}function o(e,t,n){var r=this;try{e(t,n,function(e){if("function"!=typeof e)throw new TypeError("onCancel must be a function, got: "+M.toString(e));r._attachCancellationCallback(e)})}catch(i){return i}}function a(e){if(!this.isCancellable())return this;var t=this._onCancel();void 0!==t?M.isArray(t)?t.push(e):this._setOnCancel([t,e]):this._setOnCancel(e)}function s(){return this._onCancelField}function u(e){this._onCancelField=e}function c(){this._cancellationParent=void 0,this._onCancelField=void 0}function l(e,t){if(0!==(1&t)){this._cancellationParent=e;var n=e._branchesRemainingToCancel;void 0===n&&(n=0),e._branchesRemainingToCancel=n+1}0!==(2&t)&&e._isBound()&&this._setBoundTo(e._boundTo)}function f(e,t){0!==(2&t)&&e._isBound()&&this._setBoundTo(e._boundTo)}function p(){var t=this._boundTo;return void 0!==t&&t instanceof e?t.isFulfilled()?t.value():void 0:t}function d(){this._trace=new A(this._peekContext())}function v(e,t){if(U(e)){var n=this._trace;if(void 0!==n&&t&&(n=n._parent),void 0!==n)n.attachExtraTrace(e);else if(!e.__stackCleaned__){var r=F(e);M.notEnumerableProp(e,"stack",r.message+"\n"+r.stack.join("\n")),M.notEnumerableProp(e,"__stackCleaned__",!0)}}}function y(e,t,n,r,i){if(void 0===e&&null!==t&&W){if(void 0!==i&&i._returnedNonUndefined())return;var o=r._bitField;if(0===(65535&o))return;n&&(n+=" ");var a="a promise was created in a "+n+"handler but was not returned from it";r._warn(a,!0,t)}}function m(e,t){var n=e+" is deprecated and will be removed in a future version.";return t&&(n+=" Use "+t+" instead."),g(n)}function g(t,n,r){if(oe.warnings){var i,o=new H(t);if(n)r._attachExtraTrace(o);else if(oe.longStackTraces&&(i=e._peekContext()))i.attachExtraTrace(o);else{var a=F(o);o.stack=a.message+"\n"+a.stack.join("\n")}ee("warning",o)||E(o,"",!0)}}function b(e,t){for(var n=0;n<t.length-1;++n)t[n].push("From previous event:"),t[n]=t[n].join("\n");return n<t.length&&(t[n]=t[n].join("\n")),e+"\n"+t.join("\n")}function w(e){for(var t=0;t<e.length;++t)(0===e[t].length||t+1<e.length&&e[t][0]===e[t+1][0])&&(e.splice(t,1),t--)}function j(e){for(var t=e[0],n=1;n<e.length;++n){for(var r=e[n],i=t.length-1,o=t[i],a=-1,s=r.length-1;s>=0;--s)if(r[s]===o){a=s;break}for(var s=a;s>=0;--s){var u=r[s];if(t[i]!==u)break;t.pop(),i--}t=r}}function C(e){for(var t=[],n=0;n<e.length;++n){var r=e[n],i="    (No stack trace)"===r||$.test(r),o=i&&ne(r);i&&!o&&(q&&" "!==r.charAt(0)&&(r="    "+r),t.push(r))}return t}function k(e){for(var t=e.stack.replace(/\s+$/g,"").split("\n"),n=0;n<t.length;++n){var r=t[n];if("    (No stack trace)"===r||$.test(r))break}return n>0&&(t=t.slice(n)),t}function F(e){var t=e.stack,n=e.toString();return t="string"==typeof t&&t.length>0?k(e):["    (No stack trace)"],{message:n,stack:C(t)}}function E(e,t,n){if("undefined"!=typeof console){var i;if(M.isObject(e)){var o=e.stack;i=t+Q(o,e)}else i=t+String(e);"function"==typeof I?I(i,n):"function"!=typeof console.log&&"object"!==r["typeof"](console.log)||console.log(i)}}function x(e,t,n,r){var i=!1;try{"function"==typeof t&&(i=!0,"rejectionHandled"===e?t(r):t(n,r))}catch(o){L.throwLater(o)}"unhandledRejection"===e?ee(e,n,r)||i||E(n,"Unhandled rejection "):ee(e,r)}function T(e){var t;if("function"==typeof e)t="[function "+(e.name||"anonymous")+"]";else{t=e&&"function"==typeof e.toString?e.toString():M.toString(e);var n=/\[object [a-zA-Z0-9$_]+\]/;if(n.test(t))try{var r=JSON.stringify(e);t=r}catch(i){}0===t.length&&(t="(empty array)")}return"(<"+O(t)+">, no stack trace)"}function O(e){var t=41;return e.length<t?e:e.substr(0,t-3)+"..."}function P(){return"function"==typeof ie}function R(e){var t=e.match(re);return t?{fileName:t[1],line:parseInt(t[2],10)}:void 0}function S(e,t){if(P()){for(var n,r,i=e.stack.split("\n"),o=t.stack.split("\n"),a=-1,s=-1,u=0;u<i.length;++u){var c=R(i[u]);if(c){n=c.fileName,a=c.line;break}}for(var u=0;u<o.length;++u){var c=R(o[u]);if(c){r=c.fileName,s=c.line;break}}0>a||0>s||!n||!r||n!==r||a>=s||(ne=function(e){if(B.test(e))return!0;var t=R(e);return!!(t&&t.fileName===n&&a<=t.line&&t.line<=s)})}}function A(e){this._parent=e,this._promisesCreated=0;var t=this._length=1+(void 0===e?0:e._length);ie(this,A),t>32&&this.uncycle()}var N,D,I,V=e._getDomain,L=e._async,H=_.Warning,M=h,U=M.canAttachTrace,B=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/,$=null,Q=null,q=!1,G=!(0==M.env("BLUEBIRD_DEBUG")||!M.env("BLUEBIRD_DEBUG")&&"development"!==M.env("NODE_ENV")),z=!(0==M.env("BLUEBIRD_WARNINGS")||!G&&!M.env("BLUEBIRD_WARNINGS")),X=!(0==M.env("BLUEBIRD_LONG_STACK_TRACES")||!G&&!M.env("BLUEBIRD_LONG_STACK_TRACES")),W=0!=M.env("BLUEBIRD_W_FORGOTTEN_RETURN")&&(z||!!M.env("BLUEBIRD_W_FORGOTTEN_RETURN"));e.prototype.suppressUnhandledRejections=function(){var e=this._target();e._bitField=-1048577&e._bitField|524288},e.prototype._ensurePossibleRejectionHandled=function(){0===(524288&this._bitField)&&(this._setRejectionIsUnhandled(),L.invokeLater(this._notifyUnhandledRejection,this,void 0))},e.prototype._notifyUnhandledRejectionIsHandled=function(){x("rejectionHandled",N,void 0,this)},e.prototype._setReturnedNonUndefined=function(){this._bitField=268435456|this._bitField},e.prototype._returnedNonUndefined=function(){return 0!==(268435456&this._bitField)},e.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var e=this._settledValue();this._setUnhandledRejectionIsNotified(),x("unhandledRejection",D,e,this)}},e.prototype._setUnhandledRejectionIsNotified=function(){this._bitField=262144|this._bitField},e.prototype._unsetUnhandledRejectionIsNotified=function(){this._bitField=-262145&this._bitField},e.prototype._isUnhandledRejectionNotified=function(){return(262144&this._bitField)>0},e.prototype._setRejectionIsUnhandled=function(){this._bitField=1048576|this._bitField},e.prototype._unsetRejectionIsUnhandled=function(){this._bitField=-1048577&this._bitField,this._isUnhandledRejectionNotified()&&(this._unsetUnhandledRejectionIsNotified(),this._notifyUnhandledRejectionIsHandled())},e.prototype._isRejectionUnhandled=function(){return(1048576&this._bitField)>0},e.prototype._warn=function(e,t,n){return g(e,t,n||this)},e.onPossiblyUnhandledRejection=function(e){var t=V();D="function"==typeof e?null===t?e:t.bind(e):void 0},e.onUnhandledRejectionHandled=function(e){var t=V();N="function"==typeof e?null===t?e:t.bind(e):void 0};var K=function(){};e.longStackTraces=function(){if(L.haveItemsQueued()&&!oe.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n    See http://goo.gl/MqrFmX\n");if(!oe.longStackTraces&&P()){var n=e.prototype._captureStackTrace,r=e.prototype._attachExtraTrace;oe.longStackTraces=!0,K=function(){if(L.haveItemsQueued()&&!oe.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n    See http://goo.gl/MqrFmX\n");e.prototype._captureStackTrace=n,e.prototype._attachExtraTrace=r,t.deactivateLongStackTraces(),L.enableTrampoline(),oe.longStackTraces=!1},e.prototype._captureStackTrace=d,e.prototype._attachExtraTrace=v,t.activateLongStackTraces(),L.disableTrampolineIfNecessary()}},e.hasLongStackTraces=function(){return oe.longStackTraces&&P()};var J=function(){try{var e=document.createEvent("CustomEvent");return e.initCustomEvent("testingtheevent",!1,!0,{}),M.global.dispatchEvent(e),function(e,t){var n=document.createEvent("CustomEvent");return n.initCustomEvent(e.toLowerCase(),!1,!0,t),!M.global.dispatchEvent(n)}}catch(t){}return function(){return!1}}(),Y=function(){return M.isNode?function(){return process.emit.apply(process,arguments)}:M.global?function(e){var t="on"+e.toLowerCase(),n=M.global[t];return n?(n.apply(M.global,[].slice.call(arguments,1)),!0):!1}:function(){return!1}}(),Z={promiseCreated:n,promiseFulfilled:n,promiseRejected:n,promiseResolved:n,promiseCancelled:n,promiseChained:function(e,t,n){return{promise:t,child:n}},warning:function(e,t){return{warning:t}},unhandledRejection:function(e,t,n){return{reason:t,promise:n}},rejectionHandled:n},ee=function(e){var t=!1;try{t=Y.apply(null,arguments)}catch(n){L.throwLater(n),t=!0}var r=!1;try{r=J(e,Z[e].apply(null,arguments))}catch(n){L.throwLater(n),r=!0}return r||t};e.config=function(t){if(t=Object(t),"longStackTraces"in t&&(t.longStackTraces?e.longStackTraces():!t.longStackTraces&&e.hasLongStackTraces()&&K()),"warnings"in t){var n=t.warnings;oe.warnings=!!n,W=oe.warnings,M.isObject(n)&&"wForgottenReturn"in n&&(W=!!n.wForgottenReturn)}if("cancellation"in t&&t.cancellation&&!oe.cancellation){if(L.haveItemsQueued())throw new Error("cannot enable cancellation after promises are in use");e.prototype._clearCancellationData=c,e.prototype._propagateFrom=l,e.prototype._onCancel=s,e.prototype._setOnCancel=u,e.prototype._attachCancellationCallback=a,e.prototype._execute=o,te=l,oe.cancellation=!0}"monitoring"in t&&(t.monitoring&&!oe.monitoring?(oe.monitoring=!0,e.prototype._fireEvent=ee):!t.monitoring&&oe.monitoring&&(oe.monitoring=!1,e.prototype._fireEvent=i))},e.prototype._fireEvent=i,e.prototype._execute=function(e,t,n){try{e(t,n)}catch(r){return r}},e.prototype._onCancel=function(){},e.prototype._setOnCancel=function(e){},e.prototype._attachCancellationCallback=function(e){},e.prototype._captureStackTrace=function(){},e.prototype._attachExtraTrace=function(){},e.prototype._clearCancellationData=function(){},e.prototype._propagateFrom=function(e,t){};var te=f,ne=function(){return!1},re=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;M.inherits(A,Error),t.CapturedTrace=A,A.prototype.uncycle=function(){var e=this._length;if(!(2>e)){for(var t=[],n={},r=0,i=this;void 0!==i;++r)t.push(i),i=i._parent;e=this._length=r;for(var r=e-1;r>=0;--r){var o=t[r].stack;void 0===n[o]&&(n[o]=r)}for(var r=0;e>r;++r){var a=t[r].stack,s=n[a];if(void 0!==s&&s!==r){s>0&&(t[s-1]._parent=void 0,t[s-1]._length=1),t[r]._parent=void 0,t[r]._length=1;var u=r>0?t[r-1]:this;e-1>s?(u._parent=t[s+1],u._parent.uncycle(),u._length=u._parent._length+1):(u._parent=void 0,u._length=1);for(var c=u._length+1,l=r-2;l>=0;--l)t[l]._length=c,c++;return}}}},A.prototype.attachExtraTrace=function(e){if(!e.__stackCleaned__){this.uncycle();for(var t=F(e),n=t.message,r=[t.stack],i=this;void 0!==i;)r.push(C(i.stack.split("\n"))),i=i._parent;j(r),w(r),M.notEnumerableProp(e,"stack",b(n,r)),M.notEnumerableProp(e,"__stackCleaned__",!0)}};var ie=function(){var e=/^\s*at\s*/,t=function(e,t){return"string"==typeof e?e:void 0!==t.name&&void 0!==t.message?t.toString():T(t)};if("number"==typeof Error.stackTraceLimit&&"function"==typeof Error.captureStackTrace){Error.stackTraceLimit+=6,$=e,Q=t;var n=Error.captureStackTrace;return ne=function(e){return B.test(e)},function(e,t){Error.stackTraceLimit+=6,n(e,t),Error.stackTraceLimit-=6}}var i=new Error;if("string"==typeof i.stack&&i.stack.split("\n")[0].indexOf("stackDetection@")>=0)return $=/@/,Q=t,q=!0,function(e){e.stack=(new Error).stack};var o;try{throw new Error}catch(a){o="stack"in a}return"stack"in i||!o||"number"!=typeof Error.stackTraceLimit?(Q=function(e,t){return"string"==typeof e?e:"object"!==("undefined"==typeof t?"undefined":r["typeof"](t))&&"function"!=typeof t||void 0===t.name||void 0===t.message?T(t):t.toString()},null):($=e,Q=t,function(e){Error.stackTraceLimit+=6;try{throw new Error}catch(t){e.stack=t.stack}Error.stackTraceLimit-=6})}([]);"undefined"!=typeof console&&"undefined"!=typeof console.warn&&(I=function(e){console.warn(e)},M.isNode&&process.stderr.isTTY?I=function(e,t){var n=t?"":"";console.warn(n+e+"\n")}:M.isNode||"string"!=typeof(new Error).stack||(I=function(e,t){
console.warn("%c"+e,t?"color: darkorange":"color: red")}));var oe={warnings:z,longStackTraces:!1,cancellation:!1,monitoring:!1};return X&&e.longStackTraces(),{longStackTraces:function(){return oe.longStackTraces},warnings:function(){return oe.warnings},cancellation:function(){return oe.cancellation},monitoring:function(){return oe.monitoring},propagateFromFunction:function(){return te},boundValueFunction:function(){return p},checkForgottenReturns:y,setBounds:S,warn:g,deprecated:m,CapturedTrace:A,fireDomEvent:J,fireGlobalEvent:Y}}}),oe=ie&&"object"===("undefined"==typeof ie?"undefined":r["typeof"](ie))&&"default"in ie?ie["default"]:ie,ae=t(function(e){e.exports=function(e){function t(){this._trace=new t.CapturedTrace(r())}function n(){return i?new t:void 0}function r(){var e=o.length-1;return e>=0?o[e]:void 0}var i=!1,o=[];return e.prototype._promiseCreated=function(){},e.prototype._pushContext=function(){},e.prototype._popContext=function(){return null},e._peekContext=e.prototype._peekContext=function(){},t.prototype._pushContext=function(){void 0!==this._trace&&(this._trace._promiseCreated=null,o.push(this._trace))},t.prototype._popContext=function(){if(void 0!==this._trace){var e=o.pop(),t=e._promiseCreated;return e._promiseCreated=null,t}return null},t.CapturedTrace=null,t.create=n,t.deactivateLongStackTraces=function(){},t.activateLongStackTraces=function(){var n=e.prototype._pushContext,o=e.prototype._popContext,a=e._peekContext,s=e.prototype._peekContext,u=e.prototype._promiseCreated;t.deactivateLongStackTraces=function(){e.prototype._pushContext=n,e.prototype._popContext=o,e._peekContext=a,e.prototype._peekContext=s,e.prototype._promiseCreated=u,i=!1},i=!0,e.prototype._pushContext=t.prototype._pushContext,e.prototype._popContext=t.prototype._popContext,e._peekContext=e.prototype._peekContext=r,e.prototype._promiseCreated=function(){var e=this._peekContext();e&&null==e._promiseCreated&&(e._promiseCreated=this)}},t}}),se=ae&&"object"===("undefined"==typeof ae?"undefined":r["typeof"](ae))&&"default"in ae?ae["default"]:ae,ue=t(function(e){e.exports=function(e,t,n,r,i){function o(e){switch(e){case-2:return[];case-3:return{}}}function a(n){var r=this._promise=new e(t);n instanceof e&&r._propagateFrom(n,3),r._setOnCancel(this),this._values=n,this._length=0,this._totalResolved=0,this._init(void 0,-2)}var s=h;s.isArray;return s.inherits(a,i),a.prototype.length=function(){return this._length},a.prototype.promise=function(){return this._promise},a.prototype._init=function u(t,i){var a=n(this._values,this._promise);if(a instanceof e){a=a._target();var c=a._bitField;if(this._values=a,0===(50397184&c))return this._promise._setAsyncGuaranteed(),a._then(u,this._reject,void 0,this,i);if(0===(33554432&c))return 0!==(16777216&c)?this._reject(a._reason()):this._cancel();a=a._value()}if(a=s.asArray(a),null===a){var l=r("expecting an array or an iterable object but got "+s.classString(a)).reason();return void this._promise._rejectCallback(l,!1)}return 0===a.length?void(-5===i?this._resolveEmptyArray():this._resolve(o(i))):void this._iterate(a)},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,a=null,s=0;r>s;++s){var u=n(t[s],i);u instanceof e?(u=u._target(),a=u._bitField):a=null,o?null!==a&&u.suppressUnhandledRejections():null!==a?0===(50397184&a)?(u._proxy(this,s),this._values[s]=u):o=0!==(33554432&a)?this._promiseFulfilled(u._value(),s):0!==(16777216&a)?this._promiseRejected(u._reason(),s):this._promiseCancelled(s):o=this._promiseFulfilled(u,s)}o||i._setAsyncGuaranteed()},a.prototype._isResolved=function(){return null===this._values},a.prototype._resolve=function(e){this._values=null,this._promise._fulfill(e)},a.prototype._cancel=function(){!this._isResolved()&&this._promise.isCancellable()&&(this._values=null,this._promise._cancel())},a.prototype._reject=function(e){this._values=null,this._promise._rejectCallback(e,!1)},a.prototype._promiseFulfilled=function(e,t){this._values[t]=e;var n=++this._totalResolved;return n>=this._length?(this._resolve(this._values),!0):!1},a.prototype._promiseCancelled=function(){return this._cancel(),!0},a.prototype._promiseRejected=function(e){return this._totalResolved++,this._reject(e),!0},a.prototype._resultCancelled=function(){if(!this._isResolved()){var t=this._values;if(this._cancel(),t instanceof e)t.cancel();else for(var n=0;n<t.length;++n)t[n]instanceof e&&t[n].cancel()}},a.prototype.shouldCopyValues=function(){return!0},a.prototype.getActualLength=function(e){return e},a}}),ce=ue&&"object"===("undefined"==typeof ue?"undefined":r["typeof"](ue))&&"default"in ue?ue["default"]:ue,le=t(function(e){e.exports=function(e,t){function n(n,r){if(c(n)){if(n instanceof e)return n;var s=i(n);if(s===u){r&&r._pushContext();var l=e.reject(s.e);return r&&r._popContext(),l}if("function"==typeof s){if(o(n)){var l=new e(t);return n._then(l._fulfill,l._reject,void 0,l,null),l}return a(n,s,r)}}return n}function r(e){return e.then}function i(e){try{return r(e)}catch(t){return u.e=t,u}}function o(e){return l.call(e,"_promise0")}function a(n,r,i){function o(e){c&&(c._resolveCallback(e),c=null)}function a(e){c&&(c._rejectCallback(e,f,!0),c=null)}var c=new e(t),l=c;i&&i._pushContext(),c._captureStackTrace(),i&&i._popContext();var f=!0,p=s.tryCatch(r).call(n,o,a);return f=!1,c&&p===u&&(c._rejectCallback(p.e,!0,!0),c=null),l}var s=h,u=s.errorObj,c=s.isObject,l={}.hasOwnProperty;return n}}),fe=le&&"object"===("undefined"==typeof le?"undefined":r["typeof"](le))&&"default"in le?le["default"]:le,pe=t(function(e){function t(e,t,n,r,i){for(var o=0;i>o;++o)n[o+r]=e[o+t],e[o+t]=void 0}function n(e){this._capacity=e,this._length=0,this._front=0}n.prototype._willBeOverCapacity=function(e){return this._capacity<e},n.prototype._pushOne=function(e){var t=this.length();this._checkCapacity(t+1);var n=this._front+t&this._capacity-1;this[n]=e,this._length=t+1},n.prototype._unshiftOne=function(e){var t=this._capacity;this._checkCapacity(this.length()+1);var n=this._front,r=(n-1&t-1^t)-t;this[r]=e,this._front=r,this._length=this.length()+1},n.prototype.unshift=function(e,t,n){this._unshiftOne(n),this._unshiftOne(t),this._unshiftOne(e)},n.prototype.push=function(e,t,n){var r=this.length()+3;if(this._willBeOverCapacity(r))return this._pushOne(e),this._pushOne(t),void this._pushOne(n);var i=this._front+r-3;this._checkCapacity(r);var o=this._capacity-1;this[i+0&o]=e,this[i+1&o]=t,this[i+2&o]=n,this._length=r},n.prototype.shift=function(){var e=this._front,t=this[e];return this[e]=void 0,this._front=e+1&this._capacity-1,this._length--,t},n.prototype.length=function(){return this._length},n.prototype._checkCapacity=function(e){this._capacity<e&&this._resizeTo(this._capacity<<1)},n.prototype._resizeTo=function(e){var n=this._capacity;this._capacity=e;var r=this._front,i=this._length,o=r+i&n-1;t(this,0,this,n,o)},e.exports=n}),he=pe&&"object"===("undefined"==typeof pe?"undefined":r["typeof"](pe))&&"default"in pe?pe["default"]:pe,de=t(function(e,t,n){var r,i=h,o=function(){throw new Error("No async scheduler available\n\n    See http://goo.gl/MqrFmX\n")};if(i.isNode&&"undefined"==typeof MutationObserver){var a=n.setImmediate,s=process.nextTick;r=i.isRecentNode?function(e){a.call(n,e)}:function(e){s.call(process,e)}}else r="undefined"==typeof MutationObserver||"undefined"!=typeof window&&window.navigator&&window.navigator.standalone?"undefined"!=typeof setImmediate?function(e){setImmediate(e)}:"undefined"!=typeof setTimeout?function(e){setTimeout(e,0)}:o:function(){var e=document.createElement("div"),t={attributes:!0},n=!1,r=document.createElement("div"),i=new MutationObserver(function(){e.classList.toggle("foo"),n=!1});i.observe(r,t);var o=function(){n||(n=!0,r.classList.toggle("foo"))};return function(n){var r=new MutationObserver(function(){r.disconnect(),n()});r.observe(e,t),o()}}();e.exports=r}),_e=de&&"object"===("undefined"==typeof de?"undefined":r["typeof"](de))&&"default"in de?de["default"]:de,ve=t(function(e){function t(){this._isTickUsed=!1,this._lateQueue=new u(16),this._normalQueue=new u(16),this._haveDrainedQueues=!1,this._trampolineEnabled=!0;var e=this;this.drainQueues=function(){e._drainQueues()},this._schedule=s}function n(e,t,n){this._lateQueue.push(e,t,n),this._queueTick()}function r(e,t,n){this._normalQueue.push(e,t,n),this._queueTick()}function i(e){this._normalQueue._pushOne(e),this._queueTick()}var o;try{throw new Error}catch(a){o=a}var s=_e,u=he,c=h;t.prototype.enableTrampoline=function(){this._trampolineEnabled=!0},t.prototype.disableTrampolineIfNecessary=function(){c.hasDevTools&&(this._trampolineEnabled=!1)},t.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues},t.prototype.fatalError=function(e,t){t?(process.stderr.write("Fatal "+(e instanceof Error?e.stack:e)+"\n"),process.exit(2)):this.throwLater(e)},t.prototype.throwLater=function(e,t){if(1===arguments.length&&(t=e,e=function(){throw t}),"undefined"!=typeof setTimeout)setTimeout(function(){e(t)},0);else try{this._schedule(function(){e(t)})}catch(n){throw new Error("No async scheduler available\n\n    See http://goo.gl/MqrFmX\n")}},c.hasDevTools?(t.prototype.invokeLater=function(e,t,r){this._trampolineEnabled?n.call(this,e,t,r):this._schedule(function(){setTimeout(function(){e.call(t,r)},100)})},t.prototype.invoke=function(e,t,n){this._trampolineEnabled?r.call(this,e,t,n):this._schedule(function(){e.call(t,n)})},t.prototype.settlePromises=function(e){this._trampolineEnabled?i.call(this,e):this._schedule(function(){e._settlePromises()})}):(t.prototype.invokeLater=n,t.prototype.invoke=r,t.prototype.settlePromises=i),t.prototype.invokeFirst=function(e,t,n){this._normalQueue.unshift(e,t,n),this._queueTick()},t.prototype._drainQueue=function(e){for(;e.length()>0;){var t=e.shift();if("function"==typeof t){var n=e.shift(),r=e.shift();t.call(n,r)}else t._settlePromises()}},t.prototype._drainQueues=function(){this._drainQueue(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,this._drainQueue(this._lateQueue)},t.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},t.prototype._reset=function(){this._isTickUsed=!1},e.exports=t,e.exports.firstLineError=o}),ye=ve&&"object"===("undefined"==typeof ve?"undefined":r["typeof"](ve))&&"default"in ve?ve["default"]:ve,me=t(function(e){e.exports=function(){function e(){}function t(e,t){if("function"!=typeof t)throw new T("expecting a function but got "+m.classString(t));if(e.constructor!==n)throw new T("the promise constructor cannot be invoked directly\n\n    See http://goo.gl/MqrFmX\n")}function n(e){this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,e!==S&&(t(this,e),this._resolveFromExecutor(e)),this._promiseCreated(),this._fireEvent("promiseCreated",this)}function r(e){this.promise._resolveCallback(e)}function i(e){this.promise._rejectCallback(e,!1)}function a(e){var t=new n(S);t._fulfillmentHandler0=e,t._rejectionHandler0=e,t._promise0=e,t._receiver0=e}var u,l=function(){return new T("circular promise resolution chain\n\n    See http://goo.gl/MqrFmX\n")},p=function(){return new n.PromiseInspection(this._target())},d=function(e){return n.reject(new T(e))},v={},m=h;u=m.isNode?function(){var e=process.domain;return void 0===e&&(e=null),e}:function(){return null},m.notEnumerableProp(n,"_getDomain",u);var b=f,j=ye,k=new j;b.defineProperty(n,"_async",{value:k});var E=_,T=n.TypeError=E.TypeError;n.RangeError=E.RangeError;var P=n.CancellationError=E.CancellationError;n.TimeoutError=E.TimeoutError,n.OperationalError=E.OperationalError,n.RejectionError=E.OperationalError,n.AggregateError=E.AggregateError;var S=function(){},N={},I={},L=fe(n,S),M=ce(n,S,L,d,e),B=se(n),Q=B.create,G=oe(n,B),X=(G.CapturedTrace,re(n,L)),K=te(I),Y=y,ee=m.errorObj,ne=m.tryCatch;return n.prototype.toString=function(){return"[object Promise]"},n.prototype.caught=n.prototype["catch"]=function(e){var t=arguments.length;if(t>1){var n,r=new Array(t-1),i=0;for(n=0;t-1>n;++n){var o=arguments[n];if(!m.isObject(o))return d("expecting an object but got "+m.classString(o));r[i++]=o}return r.length=i,e=arguments[n],this.then(void 0,K(r,e,this))}return this.then(void 0,e)},n.prototype.reflect=function(){return this._then(p,p,void 0,this,void 0)},n.prototype.then=function(e,t){if(G.warnings()&&arguments.length>0&&"function"!=typeof e&&"function"!=typeof t){var n=".then() only accepts functions but was passed: "+m.classString(e);arguments.length>1&&(n+=", "+m.classString(t)),this._warn(n)}return this._then(e,t,void 0,void 0,void 0)},n.prototype.done=function(e,t){var n=this._then(e,t,void 0,void 0,void 0);n._setIsFinal()},n.prototype.spread=function(e){return"function"!=typeof e?d("expecting a function but got "+m.classString(e)):this.all()._then(e,void 0,void 0,N,void 0)},n.prototype.toJSON=function(){var e={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(e.fulfillmentValue=this.value(),e.isFulfilled=!0):this.isRejected()&&(e.rejectionReason=this.reason(),e.isRejected=!0),e},n.prototype.all=function(){return arguments.length>0&&this._warn(".all() was passed arguments but it does not take any"),new M(this).promise()},n.prototype.error=function(e){return this.caught(m.originatesFromRejection,e)},n.is=function(e){return e instanceof n},n.fromNode=n.fromCallback=function(e){var t=new n(S);t._captureStackTrace();var r=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,i=ne(e)(Y(t,r));return i===ee&&t._rejectCallback(i.e,!0),t._isFateSealed()||t._setAsyncGuaranteed(),t},n.all=function(e){return new M(e).promise()},n.cast=function(e){var t=L(e);return t instanceof n||(t=new n(S),t._captureStackTrace(),t._setFulfilled(),t._rejectionHandler0=e),t},n.resolve=n.fulfilled=n.cast,n.reject=n.rejected=function(e){var t=new n(S);return t._captureStackTrace(),t._rejectCallback(e,!0),t},n.setScheduler=function(e){if("function"!=typeof e)throw new T("expecting a function but got "+m.classString(e));var t=k._schedule;return k._schedule=e,t},n.prototype._then=function(e,t,r,i,o){var a=void 0!==o,s=a?o:new n(S),c=this._target(),l=c._bitField;a||(s._propagateFrom(this,3),s._captureStackTrace(),void 0===i&&0!==(2097152&this._bitField)&&(i=0!==(50397184&l)?this._boundValue():c===this?void 0:this._boundTo),this._fireEvent("promiseChained",this,s));var f=u();if(0!==(50397184&l)){var p,h,d=c._settlePromiseCtx;0!==(33554432&l)?(h=c._rejectionHandler0,p=e):0!==(16777216&l)?(h=c._fulfillmentHandler0,p=t,c._unsetRejectionIsUnhandled()):(d=c._settlePromiseLateCancellationObserver,h=new P("late cancellation observer"),c._attachExtraTrace(h),p=t),k.invoke(d,c,{handler:null===f?p:"function"==typeof p&&f.bind(p),promise:s,receiver:i,value:h})}else c._addCallbacks(e,t,s,i,f);return s},n.prototype._length=function(){return 65535&this._bitField},n.prototype._isFateSealed=function(){return 0!==(117506048&this._bitField)},n.prototype._isFollowing=function(){return 67108864===(67108864&this._bitField)},n.prototype._setLength=function(e){this._bitField=-65536&this._bitField|65535&e},n.prototype._setFulfilled=function(){this._bitField=33554432|this._bitField,this._fireEvent("promiseFulfilled",this)},n.prototype._setRejected=function(){this._bitField=16777216|this._bitField,this._fireEvent("promiseRejected",this)},n.prototype._setFollowing=function(){this._bitField=67108864|this._bitField,this._fireEvent("promiseResolved",this)},n.prototype._setIsFinal=function(){this._bitField=4194304|this._bitField},n.prototype._isFinal=function(){return(4194304&this._bitField)>0},n.prototype._unsetCancelled=function(){this._bitField=-65537&this._bitField},n.prototype._setCancelled=function(){this._bitField=65536|this._bitField,this._fireEvent("promiseCancelled",this)},n.prototype._setAsyncGuaranteed=function(){this._bitField=134217728|this._bitField},n.prototype._receiverAt=function(e){var t=0===e?this._receiver0:this[4*e-4+3];if(t!==v)return void 0===t&&this._isBound()?this._boundValue():t},n.prototype._promiseAt=function(e){return this[4*e-4+2]},n.prototype._fulfillmentHandlerAt=function(e){return this[4*e-4+0]},n.prototype._rejectionHandlerAt=function(e){return this[4*e-4+1]},n.prototype._boundValue=function(){},n.prototype._migrateCallback0=function(e){var t=(e._bitField,e._fulfillmentHandler0),n=e._rejectionHandler0,r=e._promise0,i=e._receiverAt(0);void 0===i&&(i=v),this._addCallbacks(t,n,r,i,null)},n.prototype._migrateCallbackAt=function(e,t){var n=e._fulfillmentHandlerAt(t),r=e._rejectionHandlerAt(t),i=e._promiseAt(t),o=e._receiverAt(t);void 0===o&&(o=v),this._addCallbacks(n,r,i,o,null)},n.prototype._addCallbacks=function(e,t,n,r,i){var o=this._length();if(o>=65531&&(o=0,this._setLength(0)),0===o)this._promise0=n,this._receiver0=r,"function"==typeof e&&(this._fulfillmentHandler0=null===i?e:i.bind(e)),"function"==typeof t&&(this._rejectionHandler0=null===i?t:i.bind(t));else{var a=4*o-4;this[a+2]=n,this[a+3]=r,"function"==typeof e&&(this[a+0]=null===i?e:i.bind(e)),"function"==typeof t&&(this[a+1]=null===i?t:i.bind(t))}return this._setLength(o+1),o},n.prototype._proxy=function(e,t){this._addCallbacks(void 0,void 0,t,e,null)},n.prototype._resolveCallback=function(e,t){if(0===(117506048&this._bitField)){if(e===this)return this._rejectCallback(l(),!1);var r=L(e,this);if(!(r instanceof n))return this._fulfill(e);t&&this._propagateFrom(r,2);var i=r._target();if(i===this)return void this._reject(l());var o=i._bitField;if(0===(50397184&o)){var a=this._length();a>0&&i._migrateCallback0(this);for(var s=1;a>s;++s)i._migrateCallbackAt(this,s);this._setFollowing(),this._setLength(0),this._setFollowee(i)}else if(0!==(33554432&o))this._fulfill(i._value());else if(0!==(16777216&o))this._reject(i._reason());else{var u=new P("late cancellation observer");i._attachExtraTrace(u),this._reject(u)}}},n.prototype._rejectCallback=function(e,t,n){var r=m.ensureErrorObject(e),i=r===e;if(!i&&!n&&G.warnings()){var o="a promise was rejected with a non-error: "+m.classString(e);this._warn(o,!0)}this._attachExtraTrace(r,t?i:!1),this._reject(e)},n.prototype._resolveFromExecutor=function(e){var t=this;this._captureStackTrace(),this._pushContext();var n=!0,r=this._execute(e,function(e){t._resolveCallback(e)},function(e){t._rejectCallback(e,n)});n=!1,this._popContext(),void 0!==r&&t._rejectCallback(r,!0)},n.prototype._settlePromiseFromHandler=function(e,t,n,r){var i=r._bitField;if(0===(65536&i)){r._pushContext();var o;t===N?n&&"number"==typeof n.length?o=ne(e).apply(this._boundValue(),n):(o=ee,o.e=new T("cannot .spread() a non-array: "+m.classString(n))):o=ne(e).call(t,n);var a=r._popContext();i=r._bitField,0===(65536&i)&&(o===I?r._reject(n):o===ee?r._rejectCallback(o.e,!1):(G.checkForgottenReturns(o,a,"",r,this),r._resolveCallback(o)))}},n.prototype._target=function(){for(var e=this;e._isFollowing();)e=e._followee();return e},n.prototype._followee=function(){return this._rejectionHandler0},n.prototype._setFollowee=function(e){this._rejectionHandler0=e},n.prototype._settlePromise=function(t,r,i,o){var a=t instanceof n,s=this._bitField,u=0!==(134217728&s);0!==(65536&s)?(a&&t._invokeInternalOnCancel(),i instanceof X&&i.isFinallyHandler()?(i.cancelPromise=t,ne(r).call(i,o)===ee&&t._reject(ee.e)):r===p?t._fulfill(p.call(i)):i instanceof e?i._promiseCancelled(t):a||t instanceof M?t._cancel():i.cancel()):"function"==typeof r?a?(u&&t._setAsyncGuaranteed(),this._settlePromiseFromHandler(r,i,o,t)):r.call(i,o,t):i instanceof e?i._isResolved()||(0!==(33554432&s)?i._promiseFulfilled(o,t):i._promiseRejected(o,t)):a&&(u&&t._setAsyncGuaranteed(),0!==(33554432&s)?t._fulfill(o):t._reject(o))},n.prototype._settlePromiseLateCancellationObserver=function(e){var t=e.handler,r=e.promise,i=e.receiver,o=e.value;"function"==typeof t?r instanceof n?this._settlePromiseFromHandler(t,i,o,r):t.call(i,o,r):r instanceof n&&r._reject(o)},n.prototype._settlePromiseCtx=function(e){this._settlePromise(e.promise,e.handler,e.receiver,e.value)},n.prototype._settlePromise0=function(e,t,n){var r=this._promise0,i=this._receiverAt(0);this._promise0=void 0,this._receiver0=void 0,this._settlePromise(r,e,i,t)},n.prototype._clearCallbackDataAtIndex=function(e){var t=4*e-4;this[t+2]=this[t+3]=this[t+0]=this[t+1]=void 0},n.prototype._fulfill=function(e){var t=this._bitField;if(!((117506048&t)>>>16)){if(e===this){var n=l();return this._attachExtraTrace(n),this._reject(n)}this._setFulfilled(),this._rejectionHandler0=e,(65535&t)>0&&(0!==(134217728&t)?this._settlePromises():k.settlePromises(this))}},n.prototype._reject=function(e){var t=this._bitField;if(!((117506048&t)>>>16))return this._setRejected(),this._fulfillmentHandler0=e,this._isFinal()?k.fatalError(e,m.isNode):void((65535&t)>0?k.settlePromises(this):this._ensurePossibleRejectionHandled())},n.prototype._fulfillPromises=function(e,t){for(var n=1;e>n;n++){var r=this._fulfillmentHandlerAt(n),i=this._promiseAt(n),o=this._receiverAt(n);this._clearCallbackDataAtIndex(n),this._settlePromise(i,r,o,t)}},n.prototype._rejectPromises=function(e,t){for(var n=1;e>n;n++){var r=this._rejectionHandlerAt(n),i=this._promiseAt(n),o=this._receiverAt(n);this._clearCallbackDataAtIndex(n),this._settlePromise(i,r,o,t)}},n.prototype._settlePromises=function(){var e=this._bitField,t=65535&e;if(t>0){if(0!==(16842752&e)){var n=this._fulfillmentHandler0;this._settlePromise0(this._rejectionHandler0,n,e),this._rejectPromises(t,n)}else{var r=this._rejectionHandler0;this._settlePromise0(this._fulfillmentHandler0,r,e),this._fulfillPromises(t,r)}this._setLength(0)}this._clearCancellationData()},n.prototype._settledValue=function(){var e=this._bitField;return 0!==(33554432&e)?this._rejectionHandler0:0!==(16777216&e)?this._fulfillmentHandler0:void 0},n.defer=n.pending=function(){G.deprecated("Promise.defer","new Promise");var e=new n(S);return{promise:e,resolve:r,reject:i}},m.notEnumerableProp(n,"_makeSelfResolutionError",l),Z(n,S,L,d,G),J(n,S,L,G),W(n,M,d,G),z(n),q(n),$(n,M,L,S,G),n.Promise=n,U(n,M,d,L,S,G),H(n,d,L,Q,S,G),V(n,S,G),D(n,d,S,L,e,G),A(n),R(n),O(n,M,L,d),x(n,S,L,d),F(n,M,d,L,S,G),C(n,M,G),w(n,M,d),g(n,S),c(n),s(n,S),o(n,S),m.toFastProperties(n),m.toFastProperties(n.prototype),a({a:1}),a({b:2}),a({c:3}),a(1),a(function(){}),a(void 0),a(!1),a(new n(S)),G.setBounds(j.firstLineError,m.lastLineError),n}}),ge=me&&"object"===("undefined"==typeof me?"undefined":r["typeof"](me))&&"default"in me?me["default"]:me,be=t(function(e){function t(){try{Promise===r&&(Promise=n)}catch(e){}return r}var n;"undefined"!=typeof Promise&&(n=Promise);var r=ge();r.noConflict=t,e.exports=r}),we=be&&"object"===("undefined"==typeof be?"undefined":r["typeof"](be))&&"default"in be?be["default"]:be,je=t(function(t,n){function i(e){return e&&e.__esModule?e:{"default":e}}function o(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==("undefined"==typeof t?"undefined":r["typeof"](t))&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+("undefined"==typeof t?"undefined":r["typeof"](t)));e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0});var c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=e,f=we,p=i(f),h=function(e){function t(){return a(this,t),s(this,Object.getPrototypeOf(t).apply(this,arguments))}return u(t,e),c(t,[{key:"toPromise",value:function(e,t){try{return p["default"].resolve(e.apply(void 0,o(t)))}catch(n){return p["default"].reject(n)}}},{key:"emitParallel",value:function(e){for(var t=this,n=arguments.length,r=Array(n>1?n-1:0),i=1;n>i;i++)r[i-1]=arguments[i];var o=[];return this.listeners(e).forEach(function(e){o.push(t.toPromise(e,r))}),p["default"].all(o)}},{key:"emitSerial",value:function(e){for(var t=this,n=arguments.length,r=Array(n>1?n-1:0),i=1;n>i;i++)r[i-1]=arguments[i];return this.listeners(e).reduce(function(e,n){return e.then(function(e){return t.toPromise(n,r).then(function(t){return e.push(t),e})})},p["default"].resolve([]))}},{key:"emitReduce",value:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;t>r;r++)n[r-1]=arguments[r];return this.emitReduceRun(!1,e,n)}},{key:"emitReduceRight",value:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;t>r;r++)n[r-1]=arguments[r];return this.emitReduceRun(!0,e,n)}},{key:"emitReduceRun",value:function(e,t,n){var r=this,i=e?this.listeners(t).reverse():this.listeners(t);return i.reduce(function(e,t){return e.then(function(e){var n=e instanceof Array?e:[e];return r.toPromise(t,n)})},p["default"].resolve(n))}},{key:"once",value:function(e,t){var n=this;if("function"!=typeof t)throw new TypeError("listener must be a function");var r=!1,i=function o(){return n.removeListener(e,o),r===!1?(r=!0,t.apply(void 0,arguments)):void 0};return i.listener=t,this.on(e,i),this}},{key:"subscribe",value:function(e,t){var n=this,r=arguments.length<=2||void 0===arguments[2]?!1:arguments[2],i=function(){n.removeListener(e,t)};return r?this.once(e,t):this.on(e,t),i}}]),t}(l.EventEmitter);n["default"]=h,t.exports=n["default"]}),Ce=je&&"object"===("undefined"==typeof je?"undefined":r["typeof"](je))&&"default"in je?je["default"]:je,ke=t(function(e,t,i){!function(n,i){"object"==("undefined"==typeof t?"undefined":r["typeof"](t))&&"undefined"!=typeof e?e.exports=i():"function"==typeof define&&define.amd?define(i):n.ItakoToken=i()}(n,function(){var e={};e.classCallCheck=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.createClass=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),e["extends"]=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};var t=function(){function t(){var n=arguments.length<=0||void 0===arguments[0]?"text":arguments[0],r=arguments.length<=1||void 0===arguments[1]?null:arguments[1],i=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],o=arguments.length<=3||void 0===arguments[3]?{}:arguments[3];e.classCallCheck(this,t),this.type=n,this.value=r,this.options=e["extends"]({},i),this.meta=e["extends"]({},o)}return e.createClass(t,[{key:"clone",value:function(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];return new this.constructor(this.type,this.value,this.options,e["extends"]({},this.meta,t))}},{key:"setType",value:function(e){return this.type=e,this}},{key:"setValue",value:function(e){return this.value=e,this}},{key:"setOption",value:function(e,t){return this.options[e]=t,this}},{key:"setOptions",value:function(t){return this.options=e["extends"]({},this.options,t),this}},{key:"setMeta",value:function(e,t){return this.meta[e]=t,this}}]),t}();return t})}),Fe=ke&&"object"===("undefined"==typeof ke?"undefined":r["typeof"](ke))&&"default"in ke?ke["default"]:ke,Ee=t(function(e){function t(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}function n(e,r,i,a,s){var u=-1,c=e.length;for(i||(i=o),s||(s=[]);++u<c;){var l=e[u];r>0&&i(l)?r>1?n(l,r-1,i,a,s):t(s,l):a||(s[s.length]=l)}return s}function i(e){return function(t){return null==t?void 0:t[e]}}function o(e){return u(e)&&(j(e)||a(e))}function a(e){return u(e)&&m.call(e,"callee")&&(!b.call(e,"callee")||g.call(e)==d)}function s(e){return null!=e&&l(w(e))&&!c(e)}function u(e){return p(e)&&s(e)}function c(e){var t=f(e)?g.call(e):"";return t==_||t==v}function l(e){return"number"==typeof e&&e>-1&&e%1==0&&h>=e}function f(e){var t="undefined"==typeof e?"undefined":r["typeof"](e);return!!e&&("object"==t||"function"==t)}function p(e){return!!e&&"object"==("undefined"==typeof e?"undefined":r["typeof"](e))}var h=9007199254740991,d="[object Arguments]",_="[object Function]",v="[object GeneratorFunction]",y=Object.prototype,m=y.hasOwnProperty,g=y.toString,b=y.propertyIsEnumerable,w=i("length"),j=Array.isArray;e.exports=n}),xe=Ee&&"object"===("undefined"==typeof Ee?"undefined":r["typeof"](Ee))&&"default"in Ee?Ee["default"]:Ee,Te=t(function(e){function t(e){var t=e?e.length:0;return t?n(e,r):[]}var n=xe,r=1/0;e.exports=t}),Oe=Te&&"object"===("undefined"==typeof Te?"undefined":r["typeof"](Te))&&"default"in Te?Te["default"]:Te,Pe=t(function(e,t,i){function o(e){return e&&e.Object===Object?e:null}function a(e){if("string"==typeof e)return e;if(u(e))return C?C.call(e):"";var t=e+"";return"0"==t&&1/e==-c?"-0":t}function s(e){return!!e&&"object"==("undefined"==typeof e?"undefined":r["typeof"](e))}function u(e){return"symbol"==("undefined"==typeof e?"undefined":r["typeof"](e))||s(e)&&b.call(e)==l}var c=1/0,l="[object Symbol]",f={"function":!0,object:!0},p=f["undefined"==typeof t?"undefined":r["typeof"](t)]&&t&&!t.nodeType?t:void 0,h=f["undefined"==typeof e?"undefined":r["typeof"](e)]&&e&&!e.nodeType?e:void 0,d=o(p&&h&&"object"==("undefined"==typeof i?"undefined":r["typeof"](i))&&i),_=o(f["undefined"==typeof self?"undefined":r["typeof"](self)]&&self),v=o(f["undefined"==typeof window?"undefined":r["typeof"](window)]&&window),y=o(f["undefined"==typeof n?"undefined":r["typeof"](n)]&&n),m=d||v!==(y&&y.window)&&v||_||y||Function("return this")(),g=Object.prototype,b=g.toString,w=m.Symbol,j=w?w.prototype:void 0,C=j?j.toString:void 0;e.exports=a}),Re=Pe&&"object"===("undefined"==typeof Pe?"undefined":r["typeof"](Pe))&&"default"in Pe?Pe["default"]:Pe,Se=t(function(e,t,i){function o(e){return e&&e.Object===Object?e:null}function a(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(n){}return t}function s(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function u(){this.__data__=se?se(null):{}}function c(e){return this.has(e)&&delete this.__data__[e]}function l(e){var t=this.__data__;if(se){var n=t[e];return n===L?void 0:n}return ne.call(t,e)?t[e]:void 0}function f(e){var t=this.__data__;return se?void 0!==t[e]:ne.call(t,e)}function p(e,t){var n=this.__data__;return n[e]=se&&void 0===t?L:t,this}function h(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function d(){this.__data__=[]}function _(e){var t=this.__data__,n=F(t,e);if(0>n)return!1;var r=t.length-1;return n==r?t.pop():oe.call(t,n,1),!0}function v(e){var t=this.__data__,n=F(t,e);return 0>n?void 0:t[n][1]}function y(e){return F(this.__data__,e)>-1}function m(e,t){var n=this.__data__,r=F(n,e);return 0>r?n.push([e,t]):n[r][1]=t,this}function g(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function b(){this.__data__={hash:new s,map:new(ae||h),string:new s}}function w(e){return E(this,e)["delete"](e)}function j(e){return E(this,e).get(e)}function C(e){return E(this,e).has(e)}function k(e,t){return E(this,e).set(e,t),this}function F(e,t){for(var n=e.length;n--;)if(R(e[n][0],t))return n;return-1}function E(e,t){var n=e.__data__;return T(t)?n["string"==typeof t?"string":"hash"]:n.map}function x(e,t){var n=e[t];return N(n)?n:void 0}function T(e){var t="undefined"==typeof e?"undefined":r["typeof"](e);return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}function O(e){if(null!=e){try{return te.call(e)}catch(t){}try{return e+"";
}catch(t){}}return""}function P(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new TypeError(V);var n=function r(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var a=e.apply(this,n);return r.cache=o.set(i,a),a};return n.cache=new(P.Cache||g),n}function R(e,t){return e===t||e!==e&&t!==t}function S(e){var t=A(e)?re.call(e):"";return t==H||t==M}function A(e){var t="undefined"==typeof e?"undefined":r["typeof"](e);return!!e&&("object"==t||"function"==t)}function N(e){if(!A(e))return!1;var t=S(e)||a(e)?ie:Q;return t.test(O(e))}function D(e){return null==e?"":I(e)}var I=Re,V="Expected a function",L="__lodash_hash_undefined__",H="[object Function]",M="[object GeneratorFunction]",U=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g,B=/[\\^$.*+?()[\]{}|]/g,$=/\\(\\)?/g,Q=/^\[object .+?Constructor\]$/,q={"function":!0,object:!0},G=q["undefined"==typeof t?"undefined":r["typeof"](t)]&&t&&!t.nodeType?t:void 0,z=q["undefined"==typeof e?"undefined":r["typeof"](e)]&&e&&!e.nodeType?e:void 0,X=o(G&&z&&"object"==("undefined"==typeof i?"undefined":r["typeof"](i))&&i),W=o(q["undefined"==typeof self?"undefined":r["typeof"](self)]&&self),K=o(q["undefined"==typeof window?"undefined":r["typeof"](window)]&&window),J=o(q["undefined"==typeof n?"undefined":r["typeof"](n)]&&n),Y=X||K!==(J&&J.window)&&K||W||J||Function("return this")(),Z=Array.prototype,ee=Object.prototype,te=Function.prototype.toString,ne=ee.hasOwnProperty,re=ee.toString,ie=RegExp("^"+te.call(ne).replace(B,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),oe=Z.splice,ae=x(Y,"Map"),se=x(Object,"create");s.prototype.clear=u,s.prototype["delete"]=c,s.prototype.get=l,s.prototype.has=f,s.prototype.set=p,h.prototype.clear=d,h.prototype["delete"]=_,h.prototype.get=v,h.prototype.has=y,h.prototype.set=m,g.prototype.clear=b,g.prototype["delete"]=w,g.prototype.get=j,g.prototype.has=C,g.prototype.set=k;var ue=P(function(e){var t=[];return D(e).replace(U,function(e,n,r,i){t.push(r?i.replace($,"$1"):n||e)}),t});P.Cache=g,e.exports=ue}),Ae=Se&&"object"===("undefined"==typeof Se?"undefined":r["typeof"](Se))&&"default"in Se?Se["default"]:Se,Ne=t(function(e){function t(e,t){t=i(t,e)?[t]:n(t);for(var r=0,a=t.length;null!=e&&a>r;)e=e[o(t[r++])];return r&&r==a?e:void 0}function n(e){return v(e)?e:c(e)}function i(e,t){if(v(e))return!1;var n="undefined"==typeof e?"undefined":r["typeof"](e);return"number"==n||"symbol"==n||"boolean"==n||null==e||s(e)?!0:h.test(e)||!p.test(e)||null!=t&&e in Object(t)}function o(e){if("string"==typeof e||s(e))return e;var t=e+"";return"0"==t&&1/e==-l?"-0":t}function a(e){return!!e&&"object"==("undefined"==typeof e?"undefined":r["typeof"](e))}function s(e){return"symbol"==("undefined"==typeof e?"undefined":r["typeof"](e))||a(e)&&_.call(e)==f}function u(e,n,r){var i=null==e?void 0:t(e,n);return void 0===i?r:i}var c=Ae,l=1/0,f="[object Symbol]",p=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,h=/^\w*$/,d=Object.prototype,_=d.toString,v=Array.isArray;e.exports=u}),De=Ne&&"object"===("undefined"==typeof Ne?"undefined":r["typeof"](Ne))&&"default"in Ne?Ne["default"]:Ne,Ie=t(function(e){function t(e,t,n){var r=e[t];b.call(e,t)&&u(r,n)&&(void 0!==n||t in e)||(e[t]=n)}function n(e,n,r,u){n=a(n,e)?[n]:i(n);for(var l=-1,f=n.length,p=f-1,h=e;null!=h&&++l<f;){var d=s(n[l]);if(c(h)){var _=r;if(l!=p){var v=h[d];_=u?u(v,d,h):void 0,void 0===_&&(_=null==v?o(n[l+1])?[]:{}:v)}t(h,d,_)}h=h[d]}return e}function i(e){return j(e)?e:p(e)}function o(e,t){return t=null==t?d:t,!!t&&("number"==typeof e||m.test(e))&&e>-1&&e%1==0&&t>e}function a(e,t){if(j(e))return!1;var n="undefined"==typeof e?"undefined":r["typeof"](e);return"number"==n||"symbol"==n||"boolean"==n||null==e||f(e)?!0:y.test(e)||!v.test(e)||null!=t&&e in Object(t)}function s(e){if("string"==typeof e||f(e))return e;var t=e+"";return"0"==t&&1/e==-h?"-0":t}function u(e,t){return e===t||e!==e&&t!==t}function c(e){var t="undefined"==typeof e?"undefined":r["typeof"](e);return!!e&&("object"==t||"function"==t)}function l(e){return!!e&&"object"==("undefined"==typeof e?"undefined":r["typeof"](e))}function f(e){return"symbol"==("undefined"==typeof e?"undefined":r["typeof"](e))||l(e)&&w.call(e)==_}var p=Ae,h=1/0,d=9007199254740991,_="[object Symbol]",v=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,y=/^\w*$/,m=/^(?:0|[1-9]\d*)$/,g=Object.prototype,b=g.hasOwnProperty,w=g.toString,j=Array.isArray;e.exports=n}),Ve=Ie&&"object"===("undefined"==typeof Ie?"undefined":r["typeof"](Ie))&&"default"in Ie?Ie["default"]:Ie,Le=t(function(e){function t(e,t,r){return null==e?e:n(e,t,r)}var n=Ve;e.exports=t}),He=Le&&"object"===("undefined"==typeof Le?"undefined":r["typeof"](Le))&&"default"in Le?Le["default"]:Le,Me=function(e){function t(){var e=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],n=arguments.length<=1||void 0===arguments[1]?[]:arguments[1],i=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];r.classCallCheck(this,t);var o=r.possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this));return o.transformers=n,o.readers=e,o.options=r["extends"]({},i),o}return r.inherits(t,e),r.createClass(t,null,[{key:"createToken",value:function(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];return new(Function.prototype.bind.apply(Fe,[null].concat(t)))}}]),r.createClass(t,[{key:"validatePath",value:function(e){var t="string"==typeof e||e instanceof Array;if(t===!1)throw new TypeError("path is must be string or array")}},{key:"setOption",value:function(e,t){return this.validatePath(e),He(this.options,e,t),this}},{key:"setOptions",value:function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];return this.options=r["extends"]({},this.options,e),this}},{key:"getOption",value:function(e,t){return this.validatePath(e),De(this.options,e,t)}},{key:"getOptions",value:function(){return r["extends"]({},this.options)}},{key:"transform",value:function(e){var t=this,n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],i=r["extends"]({},this.getOption("transform.options",{}),n);return this.transformers.reduce(function(e,n){var r=n.name||"anonymous",i=t.getOption(["transformers",r],{}),o=i.disable,a=i.options;return o?e:Oe(n.transform(e,a))},[this.constructor.createToken("text",e,i)])}},{key:"read",value:function(e){var t=this,n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],i=r["extends"]({},De(this.options,"transform",{}),n),o=e instanceof Array?e:this.transform(e,i),a=De(this.options,"read",{});if(a.preload&&this.preload(o),a.serial){void 0===this.current&&(this.current=we.resolve());var s=this.current["finally"](function(){return t.readSerial(o)}).then(function(){return o});return this.current=s,s}return this.readSerial(o).then(function(){return o})}},{key:"preload",value:function(e){var t=this;e.forEach(function(e){for(var n=0;n<t.readers.length;n++){var r=t.readers[n],i=r.name||"anonymous",o=t.getOption(["readers",i],{}),a=o.disable,s=o.options;if(!a&&"function"==typeof r.preload&&r.preload(e,s)){e.setMeta("preloader",r),t.emit("preload",e);break}}})}},{key:"readSerial",value:function(e){var t=this;return this.emitParallel("before-read",e).then(function(){return e.reduce(function(e,n){return e.then(function(){var e=t.readToken(n);if(t.isPromise(e)===!1){var r=e.type,i=e.value;return we.reject(new Error('unexpected token "'+r+":"+i+'"'))}return e})},we.resolve(null))}).then(function(){return t.emitParallel("after-read",e)})}},{key:"isPromise",value:function(e){return e&&"undefined"!=typeof e.then}},{key:"readToken",value:function(e){var t=this;return this.readers.reduce(function(e,n){if(t.isPromise(e))return e;var r=n.name||"anonymous",i=t.getOption(["readers",r],{}),o=i.disable,a=i.options;if(o)return e;var s=n.read(e,a);return t.isPromise(s)&&(e.setMeta("reader",n),t.emit("read",e)),s},e)}}]),t}(Ce);return Me});
//# sourceMappingURL=index.js.map