@warp-works/warpjs-utils
Version:
Utility functions for WarpJS and plugins
25 lines • 404 kB
JavaScript
(function(e){var t={};function r(n){if(t[n]){return t[n].exports}var i=t[n]={i:n,l:false,exports:{}};e[n].call(i.exports,i,i.exports,r);i.l=true;return i.exports}r.m=e;r.c=t;r.i=function(e){return e};r.d=function(e,t,n){if(!r.o(e,t)){Object.defineProperty(e,t,{configurable:false,enumerable:true,get:n})}};r.n=function(e){var t=e&&e.__esModule?function t(){return e["default"]}:function t(){return e};r.d(t,"a",t);return t};r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};r.p="";return r(r.s=312)})([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.SUFFIX=undefined;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false;n.configurable=true;if("value"in n)n.writable=true;Object.defineProperty(e,n.key,n)}}return function(t,r,n){if(r)e(t.prototype,r);if(n)e(t,n);return t}}();var i=r(16);var o=s(i);var a=r(145);var u=s(a);function s(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function l(e,t){if(!e){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return t&&(typeof t==="object"||typeof t==="function")?t:e}function f(e,t){if(typeof t!=="function"&&t!==null){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:false,writable:true,configurable:true}});if(t)Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t}var p=(0,u.default)("error-boundary");var h=t.SUFFIX="ErrorBoundary";t.default=function(e){var t=function(t){f(r,t);function r(e){c(this,r);var t=l(this,(r.__proto__||Object.getPrototypeOf(r)).call(this,e));t.state={hasError:false};return t}n(r,[{key:"componentDidCatch",value:function e(t,n){p("Got error:",t,n);console.error(r.displayName+".componentDidCatch(): info=",n&&n.componentStack?n.componentStack:n)}},{key:"render",value:function t(){if(this.state.hasError){return React.createElement("h1",{className:"text-danger"},"*** REACT ERROR: Something went wrong. ***")}return React.createElement(e,this.props)}}],[{key:"getDerivedStateFromError",value:function e(t){p("getDerivedStateFromError(): error=",t);return{hasError:true}}}]);return r}(React.Component);t.displayName=""+(0,o.default)(e.displayName)+h;t.propTypes=e.propTypes;t.defaultProps=e.defaultProps;return t}},function(e,t,r){"use strict";var n=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol==="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.__esModule=true;t.extend=s;t.indexOf=p;t.escapeExpression=h;t.isEmpty=d;t.createFrame=v;t.blockParams=y;t.appendContextPath=_;var i={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`","=":"="};var o=/[&<>"'`=]/g,a=/[&<>"'`=]/;function u(e){return i[e]}function s(e){for(var t=1;t<arguments.length;t++){for(var r in arguments[t]){if(Object.prototype.hasOwnProperty.call(arguments[t],r)){e[r]=arguments[t][r]}}}return e}var c=Object.prototype.toString;t.toString=c;var l=function e(t){return typeof t==="function"};if(l(/x/)){t.isFunction=l=function e(t){return typeof t==="function"&&c.call(t)==="[object Function]"}}t.isFunction=l;var f=Array.isArray||function(e){return e&&(typeof e==="undefined"?"undefined":n(e))==="object"?c.call(e)==="[object Array]":false};t.isArray=f;function p(e,t){for(var r=0,n=e.length;r<n;r++){if(e[r]===t){return r}}return-1}function h(e){if(typeof e!=="string"){if(e&&e.toHTML){return e.toHTML()}else if(e==null){return""}else if(!e){return e+""}e=""+e}if(!a.test(e)){return e}return e.replace(o,u)}function d(e){if(!e&&e!==0){return true}else if(f(e)&&e.length===0){return true}else{return false}}function v(e){var t=s({},e);t._parent=e;return t}function y(e,t){e.path=t;return e}function _(e,t){return(e?e+".":"")+t}},function(e,t,r){"use strict";if(false){var n=require("react-is");var i=true;e.exports=require("./factoryWithTypeCheckers")(n.isElement,i)}else{e.exports=r(292)()}},function(e,t,r){"use strict";t.__esModule=true;var n=["description","fileName","lineNumber","endLineNumber","message","name","number","stack"];function i(e,t){var r=t&&t.loc,o=undefined,a=undefined,u=undefined,s=undefined;if(r){o=r.start.line;a=r.end.line;u=r.start.column;s=r.end.column;e+=" - "+o+":"+u}var c=Error.prototype.constructor.call(this,e);for(var l=0;l<n.length;l++){this[n[l]]=c[n[l]]}if(Error.captureStackTrace){Error.captureStackTrace(this,i)}try{if(r){this.lineNumber=o;this.endLineNumber=a;if(Object.defineProperty){Object.defineProperty(this,"column",{value:u,enumerable:true});Object.defineProperty(this,"endColumn",{value:s,enumerable:true})}else{this.column=u;this.endColumn=s}}}catch(e){}}i.prototype=new Error;t["default"]=i;e.exports=t["default"]},function(e,t){e.exports=ReactBootstrap},function(e,t,r){"use strict";var n=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol==="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};var i=r(92);var o=(typeof self==="undefined"?"undefined":n(self))=="object"&&self&&self.Object===Object&&self;var a=i||o||Function("return this")();e.exports=a},function(e,t,r){"use strict";var n=r(46);var i=1,o=4;function a(e){return n(e,i|o)}e.exports=a},function(e,t,r){"use strict";var n=Array.isArray;e.exports=n},function(e,t,r){"use strict";var n=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol==="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};var i;i=function(){return this}();try{i=i||Function("return this")()||(1,eval)("this")}catch(e){if((typeof window==="undefined"?"undefined":n(window))==="object")i=window}e.exports=i},function(e,t,r){"use strict";var n=r(211),i=r(239);function o(e,t){var r=i(e,t);return n(r)?r:undefined}e.exports=o},function(e,t,r){"use strict";var n=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol==="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function i(e){var t=typeof e==="undefined"?"undefined":n(e);return e!=null&&(t=="object"||t=="function")}e.exports=i},function(e,t,r){"use strict";var n=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol==="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function i(e){return e!=null&&(typeof e==="undefined"?"undefined":n(e))=="object"}e.exports=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:true});var n=r(294);var i=u(n);var o=r(70);var a=u(o);function u(e){return e&&e.__esModule?e:{default:e}}t.default=function(e){return(0,i.default)(e.map(function(e){return e&&e.actions&&e.reducer?(0,a.default)(e.actions,e.reducer):e}))}},function(e,t,r){"use strict";var n=r(21),i=r(238),o=r(266);var a="[object Null]",u="[object Undefined]";var s=n?n.toStringTag:undefined;function c(e){if(e==null){return e===undefined?u:a}return s&&s in Object(e)?i(e):o(e)}e.exports=c},function(e,t,r){"use strict";var n=r(88),i=r(89);function o(e,t,r,o){var a=!r;r||(r={});var u=-1,s=t.length;while(++u<s){var c=t[u];var l=o?o(r[c],e[c],c,r,e):undefined;if(l===undefined){l=e[c]}if(a){i(r,c,l)}else{n(r,c,l)}}return r}e.exports=o},function(e,t){e.exports=ReactRedux},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:true});var n=r(0);t.default=function(e){var t=(e||"").indexOf(n.SUFFIX);return t===-1?e:e.slice(0,t)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:true});var n=r(58);var i=u(n);var o=r(72);var a=u(o);function u(e){return e&&e.__esModule?e:{default:e}}t.default=function(e,t,r){return(0,a.default)(e,i.default.name,t,r)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:true});var n=r(6);var i=o(n);function o(e){return e&&e.__esModule?e:{default:e}}t.default=function(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var t=arguments[1];return(0,i.default)(e[t()]||{})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:true});var n=r(101);var i=o(n);function o(e){return e&&e.__esModule?e:{default:e}}function a(e,t,r){if(t in e){Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true})}else{e[t]=r}return e}t.default=function(e,t){return Object.freeze(t.reduce(function(t,r){return(0,i.default)(t,a({},r,e(r)))},{}))}},function(e,t,r){"use strict";e.exports=r(77)["default"]},function(e,t,r){"use strict";var n=r(5);var i=n.Symbol;e.exports=i},function(e,t,r){"use strict";var n=e.exports={};var i;var o;function a(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}(function(){try{if(typeof setTimeout==="function"){i=setTimeout}else{i=a}}catch(e){i=a}try{if(typeof clearTimeout==="function"){o=clearTimeout}else{o=u}}catch(e){o=u}})();function s(e){if(i===setTimeout){return setTimeout(e,0)}if((i===a||!i)&&setTimeout){i=setTimeout;return setTimeout(e,0)}try{return i(e,0)}catch(t){try{return i.call(null,e,0)}catch(t){return i.call(this,e,0)}}}function c(e){if(o===clearTimeout){return clearTimeout(e)}if((o===u||!o)&&clearTimeout){o=clearTimeout;return clearTimeout(e)}try{return o(e)}catch(t){try{return o.call(null,e)}catch(t){return o.call(this,e)}}}var l=[];var f=false;var p;var h=-1;function d(){if(!f||!p){return}f=false;if(p.length){l=p.concat(l)}else{h=-1}if(l.length){v()}}function v(){if(f){return}var e=s(d);f=true;var t=l.length;while(t){p=l;l=[];while(++h<t){if(p){p[h].run()}}h=-1;t=l.length}p=null;f=false;c(e)}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1){for(var r=1;r<arguments.length;r++){t[r-1]=arguments[r]}}l.push(new y(e,t));if(l.length===1&&!f){s(v)}};function y(e,t){this.fun=e;this.array=t}y.prototype.run=function(){this.fun.apply(null,this.array)};n.title="browser";n.browser=true;n.env={};n.argv=[];n.version="";n.versions={};function _(){}n.on=_;n.addListener=_;n.once=_;n.off=_;n.removeListener=_;n.removeAllListeners=_;n.emit=_;n.prependListener=_;n.prependOnceListener=_;n.listeners=function(e){return[]};n.binding=function(e){throw new Error("process.binding is not supported")};n.cwd=function(){return"/"};n.chdir=function(e){throw new Error("process.chdir is not supported")};n.umask=function(){return 0}},function(e,t,r){"use strict";e.exports=function(e){if(!e.webpackPolyfill){e.deprecate=function(){};e.paths=[];if(!e.children)e.children=[];Object.defineProperty(e,"loaded",{enumerable:true,get:function t(){return e.l}});Object.defineProperty(e,"id",{enumerable:true,get:function t(){return e.i}});e.webpackPolyfill=1}return e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.default=function(e,t){return Object.freeze({type:e,payload:t})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:true});var n=r(71);var i=u(n);var o=r(58);var a=u(o);function u(e){return e&&e.__esModule?e:{default:e}}t.default=function(e){return(0,i.default)(a.default.name+"."+e)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:true});var n=r(6);var i=u(n);var o=r(101);var a=u(o);function u(e){return e&&e.__esModule?e:{default:e}}function s(e,t,r){if(t in e){Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true})}else{e[t]=r}return e}t.default=function(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var t=arguments[1];var r=arguments[2];return(0,a.default)((0,i.default)(e),s({},t(),(0,i.default)(r)))}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:true});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r){if(Object.prototype.hasOwnProperty.call(r,n)){e[n]=r[n]}}}return e};var i=r(0);var o=s(i);var a=r(16);var u=s(a);function s(e){return e&&e.__esModule?e:{default:e}}t.default=function(e,t,r,i){var a=function r(o){return React.createElement(e,n({},i,t(o)))};a.displayName=(0,u.default)(e.displayName)+"Container";a.propTypes=r||e.propTypes;a.defaultProps=i||e.defaultProps;return(0,o.default)(a)}},function(e,t,r){"use strict";var n=r(37);var i=r(29);var o=r(161);e.exports=function(e,t,r,a){return i.resolve().then(function(){return e.ajax(n.extend({},o,{method:t,url:r,data:a?JSON.stringify(a,null,2):undefined}))})}},function(module,exports,__webpack_require__){"use strict";(function(process,global,setImmediate){var __WEBPACK_AMD_DEFINE_FACTORY__,__WEBPACK_AMD_DEFINE_ARRAY__,__WEBPACK_AMD_DEFINE_RESULT__;var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol==="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};/* @preserve
* The MIT License (MIT)
*
* Copyright (c) 2013-2018 Petka Antonov
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*/
!function(e){if("object"==(false?"undefined":_typeof(exports))&&"undefined"!=typeof module)module.exports=e();else if(true)!(__WEBPACK_AMD_DEFINE_ARRAY__=[],__WEBPACK_AMD_DEFINE_FACTORY__=e,__WEBPACK_AMD_DEFINE_RESULT__=typeof __WEBPACK_AMD_DEFINE_FACTORY__==="function"?__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports,__WEBPACK_AMD_DEFINE_ARRAY__):__WEBPACK_AMD_DEFINE_FACTORY__,__WEBPACK_AMD_DEFINE_RESULT__!==undefined&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__));else{var t;"undefined"!=typeof window?t=window:"undefined"!=typeof global?t=global:"undefined"!=typeof self&&(t=self),t.Promise=e()}}(function(){var define,module,exports;return function e(t,r,n){function i(a,u){if(!r[a]){if(!t[a]){var s=typeof _dereq_=="function"&&_dereq_;if(!u&&s)return s(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var l=r[a]={exports:{}};t[a][0].call(l.exports,function(e){var r=t[a][1][e];return i(r?r:e)},l,l.exports,e,t,r,n)}return r[a].exports}var o=typeof _dereq_=="function"&&_dereq_;for(var a=0;a<n.length;a++){i(n[a])}return i}({1:[function(e,t,r){"use strict";t.exports=function(e){var t=e._SomePromiseArray;function r(e){var r=new t(e);var n=r.promise();r.setHowMany(1);r.setUnwrap();r.init();return n}e.any=function(e){return r(e)};e.prototype.any=function(){return r(this)}}},{}],2:[function(e,t,r){"use strict";var n;try{throw new Error}catch(e){n=e}var i=e("./schedule");var o=e("./queue");function a(){this._customScheduler=false;this._isTickUsed=false;this._lateQueue=new o(16);this._normalQueue=new o(16);this._haveDrainedQueues=false;var e=this;this.drainQueues=function(){e._drainQueues()};this._schedule=i}a.prototype.setScheduler=function(e){var t=this._schedule;this._schedule=e;this._customScheduler=true;return t};a.prototype.hasCustomScheduler=function(){return this._customScheduler};a.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues};a.prototype.fatalError=function(e,t){if(t){process.stderr.write("Fatal "+(e instanceof Error?e.stack:e)+"\n");process.exit(2)}else{this.throwLater(e)}};a.prototype.throwLater=function(e,t){if(arguments.length===1){t=e;e=function e(){throw t}}if(typeof setTimeout!=="undefined"){setTimeout(function(){e(t)},0)}else try{this._schedule(function(){e(t)})}catch(e){throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")}};function u(e,t,r){this._lateQueue.push(e,t,r);this._queueTick()}function s(e,t,r){this._normalQueue.push(e,t,r);this._queueTick()}function c(e){this._normalQueue._pushOne(e);this._queueTick()}a.prototype.invokeLater=u;a.prototype.invoke=s;a.prototype.settlePromises=c;function l(e){while(e.length()>0){f(e)}}function f(e){var t=e.shift();if(typeof t!=="function"){t._settlePromises()}else{var r=e.shift();var n=e.shift();t.call(r,n)}}a.prototype._drainQueues=function(){l(this._normalQueue);this._reset();this._haveDrainedQueues=true;l(this._lateQueue)};a.prototype._queueTick=function(){if(!this._isTickUsed){this._isTickUsed=true;this._schedule(this.drainQueues)}};a.prototype._reset=function(){this._isTickUsed=false};t.exports=a;t.exports.firstLineError=n},{"./queue":26,"./schedule":29}],3:[function(e,t,r){"use strict";t.exports=function(e,t,r,n){var i=false;var o=function e(t,r){this._reject(r)};var a=function e(t,r){r.promiseRejectionQueued=true;r.bindingPromise._then(o,o,null,this,t)};var u=function e(t,r){if((this._bitField&50397184)===0){this._resolveCallback(r.target)}};var s=function e(t,r){if(!r.promiseRejectionQueued)this._reject(t)};e.prototype.bind=function(o){if(!i){i=true;e.prototype._propagateFrom=n.propagateFromFunction();e.prototype._boundValue=n.boundValueFunction()}var c=r(o);var l=new e(t);l._propagateFrom(this,1);var f=this._target();l._setBoundTo(c);if(c instanceof e){var p={promiseRejectionQueued:false,promise:l,target:f,bindingPromise:c};f._then(t,a,undefined,l,p);c._then(u,s,undefined,l,p);l._setOnCancel(c)}else{l._resolveCallback(f)}return l};e.prototype._setBoundTo=function(e){if(e!==undefined){this._bitField=this._bitField|2097152;this._boundTo=e}else{this._bitField=this._bitField&~2097152}};e.prototype._isBound=function(){return(this._bitField&2097152)===2097152};e.bind=function(t,r){return e.resolve(r).bind(t)}}},{}],4:[function(e,t,r){"use strict";var n;if(typeof Promise!=="undefined")n=Promise;function i(){try{if(Promise===o)Promise=n}catch(e){}return o}var o=e("./promise")();o.noConflict=i;t.exports=o},{"./promise":22}],5:[function(e,t,r){"use strict";var n=Object.create;if(n){var i=n(null);var o=n(null);i[" size"]=o[" size"]=0}t.exports=function(t){var r=e("./util");var n=r.canEvaluate;var a=r.isIdentifier;var u;var s;if(false){var c=function e(t){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,t))(p)};var l=function e(t){return new Function("obj"," \n 'use strict'; \n return obj.propertyName; \n ".replace("propertyName",t))};var f=function e(t,r,n){var i=n[t];if(typeof i!=="function"){if(!a(t)){return null}i=r(t);n[t]=i;n[" size"]++;if(n[" size"]>512){var o=Object.keys(n);for(var u=0;u<256;++u){delete n[o[u]]}n[" size"]=o.length-256}}return i};u=function e(t){return f(t,c,i)};s=function e(t){return f(t,l,o)}}function p(e,n){var i;if(e!=null)i=e[n];if(typeof i!=="function"){var o="Object "+r.classString(e)+" has no method '"+r.toString(n)+"'";throw new t.TypeError(o)}return i}function h(e){var t=this.pop();var r=p(e,t);return r.apply(e,this)}t.prototype.call=function(e){var t=[].slice.call(arguments,1);if(false){if(n){var r=u(e);if(r!==null){return this._then(r,undefined,undefined,t,undefined)}}}t.push(e);return this._then(h,undefined,undefined,t,undefined)};function d(e){return e[this]}function v(e){var t=+this;if(t<0)t=Math.max(0,t+e.length);return e[t]}t.prototype.get=function(e){var t=typeof e==="number";var r;if(!t){if(n){var i=s(e);r=i!==null?i:d}else{r=d}}else{r=v}return this._then(r,undefined,undefined,e,undefined)}}},{"./util":36}],6:[function(e,t,r){"use strict";t.exports=function(t,r,n,i){var o=e("./util");var a=o.tryCatch;var u=o.errorObj;var s=t._async;t.prototype["break"]=t.prototype.cancel=function(){if(!i.cancellation())return this._warn("cancellation is disabled");var e=this;var t=e;while(e._isCancellable()){if(!e._cancelBy(t)){if(t._isFollowing()){t._followee().cancel()}else{t._cancelBranched()}break}var r=e._cancellationParent;if(r==null||!r._isCancellable()){if(e._isFollowing()){e._followee().cancel()}else{e._cancelBranched()}break}else{if(e._isFollowing())e._followee().cancel();e._setWillBeCancelled();t=e;e=r}}};t.prototype._branchHasCancelled=function(){this._branchesRemainingToCancel--};t.prototype._enoughBranchesHaveCancelled=function(){return this._branchesRemainingToCancel===undefined||this._branchesRemainingToCancel<=0};t.prototype._cancelBy=function(e){if(e===this){this._branchesRemainingToCancel=0;this._invokeOnCancel();return true}else{this._branchHasCancelled();if(this._enoughBranchesHaveCancelled()){this._invokeOnCancel();return true}}return false};t.prototype._cancelBranched=function(){if(this._enoughBranchesHaveCancelled()){this._cancel()}};t.prototype._cancel=function(){if(!this._isCancellable())return;this._setCancelled();s.invoke(this._cancelPromises,this,undefined)};t.prototype._cancelPromises=function(){if(this._length()>0)this._settlePromises()};t.prototype._unsetOnCancel=function(){this._onCancelField=undefined};t.prototype._isCancellable=function(){return this.isPending()&&!this._isCancelled()};t.prototype.isCancellable=function(){return this.isPending()&&!this.isCancelled()};t.prototype._doInvokeOnCancel=function(e,t){if(o.isArray(e)){for(var r=0;r<e.length;++r){this._doInvokeOnCancel(e[r],t)}}else if(e!==undefined){if(typeof e==="function"){if(!t){var n=a(e).call(this._boundValue());if(n===u){this._attachExtraTrace(n.e);s.throwLater(n.e)}}}else{e._resultCancelled(this)}}};t.prototype._invokeOnCancel=function(){var e=this._onCancel();this._unsetOnCancel();s.invoke(this._doInvokeOnCancel,this,e)};t.prototype._invokeInternalOnCancel=function(){if(this._isCancellable()){this._doInvokeOnCancel(this._onCancel(),true);this._unsetOnCancel()}};t.prototype._resultCancelled=function(){this.cancel()}}},{"./util":36}],7:[function(e,t,r){"use strict";t.exports=function(t){var r=e("./util");var n=e("./es5").keys;var i=r.tryCatch;var o=r.errorObj;function a(e,a,u){return function(s){var c=u._boundValue();e:for(var l=0;l<e.length;++l){var f=e[l];if(f===Error||f!=null&&f.prototype instanceof Error){if(s instanceof f){return i(a).call(c,s)}}else if(typeof f==="function"){var p=i(f).call(c,s);if(p===o){return p}else if(p){return i(a).call(c,s)}}else if(r.isObject(s)){var h=n(f);for(var d=0;d<h.length;++d){var v=h[d];if(f[v]!=s[v]){continue e}}return i(a).call(c,s)}}return t}}return a}},{"./es5":13,"./util":36}],8:[function(e,t,r){"use strict";t.exports=function(e){var t=false;var r=[];e.prototype._promiseCreated=function(){};e.prototype._pushContext=function(){};e.prototype._popContext=function(){return null};e._peekContext=e.prototype._peekContext=function(){};function n(){this._trace=new n.CapturedTrace(o())}n.prototype._pushContext=function(){if(this._trace!==undefined){this._trace._promiseCreated=null;r.push(this._trace)}};n.prototype._popContext=function(){if(this._trace!==undefined){var e=r.pop();var t=e._promiseCreated;e._promiseCreated=null;return t}return null};function i(){if(t)return new n}function o(){var e=r.length-1;if(e>=0){return r[e]}return undefined}n.CapturedTrace=null;n.create=i;n.deactivateLongStackTraces=function(){};n.activateLongStackTraces=function(){var r=e.prototype._pushContext;var i=e.prototype._popContext;var a=e._peekContext;var u=e.prototype._peekContext;var s=e.prototype._promiseCreated;n.deactivateLongStackTraces=function(){e.prototype._pushContext=r;e.prototype._popContext=i;e._peekContext=a;e.prototype._peekContext=u;e.prototype._promiseCreated=s;t=false};t=true;e.prototype._pushContext=n.prototype._pushContext;e.prototype._popContext=n.prototype._popContext;e._peekContext=e.prototype._peekContext=o;e.prototype._promiseCreated=function(){var e=this._peekContext();if(e&&e._promiseCreated==null)e._promiseCreated=this}};return n}},{}],9:[function(e,t,r){"use strict";t.exports=function(t,r,n,i){var o=t._async;var a=e("./errors").Warning;var u=e("./util");var s=e("./es5");var c=u.canAttachTrace;var l;var f;var p=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/;var h=/\((?:timers\.js):\d+:\d+\)/;var d=/[\/<\(](.+?):(\d+):(\d+)\)?\s*$/;var v=null;var y=null;var _=false;var m;var g=!!(u.env("BLUEBIRD_DEBUG")!=0&&(true||u.env("BLUEBIRD_DEBUG")||u.env("NODE_ENV")==="development"));var b=!!(u.env("BLUEBIRD_WARNINGS")!=0&&(g||u.env("BLUEBIRD_WARNINGS")));var w=!!(u.env("BLUEBIRD_LONG_STACK_TRACES")!=0&&(g||u.env("BLUEBIRD_LONG_STACK_TRACES")));var j=u.env("BLUEBIRD_W_FORGOTTEN_RETURN")!=0&&(b||!!u.env("BLUEBIRD_W_FORGOTTEN_RETURN"));var k;(function(){var e=[];function r(){for(var t=0;t<e.length;++t){e[t]._notifyUnhandledRejection()}n()}function n(){e.length=0}k=function t(n){e.push(n);setTimeout(r,1)};s.defineProperty(t,"_unhandledRejectionCheck",{value:r});s.defineProperty(t,"_unhandledRejectionClear",{value:n})})();t.prototype.suppressUnhandledRejections=function(){var e=this._target();e._bitField=e._bitField&~1048576|524288};t.prototype._ensurePossibleRejectionHandled=function(){if((this._bitField&524288)!==0)return;this._setRejectionIsUnhandled();k(this)};t.prototype._notifyUnhandledRejectionIsHandled=function(){ee("rejectionHandled",l,undefined,this)};t.prototype._setReturnedNonUndefined=function(){this._bitField=this._bitField|268435456};t.prototype._returnedNonUndefined=function(){return(this._bitField&268435456)!==0};t.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var e=this._settledValue();this._setUnhandledRejectionIsNotified();ee("unhandledRejection",f,e,this)}};t.prototype._setUnhandledRejectionIsNotified=function(){this._bitField=this._bitField|262144};t.prototype._unsetUnhandledRejectionIsNotified=function(){this._bitField=this._bitField&~262144};t.prototype._isUnhandledRejectionNotified=function(){return(this._bitField&262144)>0};t.prototype._setRejectionIsUnhandled=function(){this._bitField=this._bitField|1048576};t.prototype._unsetRejectionIsUnhandled=function(){this._bitField=this._bitField&~1048576;if(this._isUnhandledRejectionNotified()){this._unsetUnhandledRejectionIsNotified();this._notifyUnhandledRejectionIsHandled()}};t.prototype._isRejectionUnhandled=function(){return(this._bitField&1048576)>0};t.prototype._warn=function(e,t,r){return q(e,t,r||this)};t.onPossiblyUnhandledRejection=function(e){var r=t._getContext();f=u.contextBind(r,e)};t.onUnhandledRejectionHandled=function(e){var r=t._getContext();l=u.contextBind(r,e)};var x=function e(){};t.longStackTraces=function(){if(o.haveItemsQueued()&&!le.longStackTraces){throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n")}if(!le.longStackTraces&&ne()){var e=t.prototype._captureStackTrace;var n=t.prototype._attachExtraTrace;var i=t.prototype._dereferenceTrace;le.longStackTraces=true;x=function a(){if(o.haveItemsQueued()&&!le.longStackTraces){throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n")}t.prototype._captureStackTrace=e;t.prototype._attachExtraTrace=n;t.prototype._dereferenceTrace=i;r.deactivateLongStackTraces();le.longStackTraces=false};t.prototype._captureStackTrace=U;t.prototype._attachExtraTrace=$;t.prototype._dereferenceTrace=V;r.activateLongStackTraces()}};t.hasLongStackTraces=function(){return le.longStackTraces&&ne()};var S={unhandledrejection:{before:function e(){var t=u.global.onunhandledrejection;u.global.onunhandledrejection=null;return t},after:function e(t){u.global.onunhandledrejection=t}},rejectionhandled:{before:function e(){var t=u.global.onrejectionhandled;u.global.onrejectionhandled=null;return t},after:function e(t){u.global.onrejectionhandled=t}}};var P=function(){var e=function e(t,r){if(t){var n;try{n=t.before();return!u.global.dispatchEvent(r)}finally{t.after(n)}}else{return!u.global.dispatchEvent(r)}};try{if(typeof CustomEvent==="function"){var t=new CustomEvent("CustomEvent");u.global.dispatchEvent(t);return function(t,r){t=t.toLowerCase();var n={detail:r,cancelable:true};var i=new CustomEvent(t,n);s.defineProperty(i,"promise",{value:r.promise});s.defineProperty(i,"reason",{value:r.reason});return e(S[t],i)}}else if(typeof Event==="function"){var t=new Event("CustomEvent");u.global.dispatchEvent(t);return function(t,r){t=t.toLowerCase();var n=new Event(t,{cancelable:true});n.detail=r;s.defineProperty(n,"promise",{value:r.promise});s.defineProperty(n,"reason",{value:r.reason});return e(S[t],n)}}else{var t=document.createEvent("CustomEvent");t.initCustomEvent("testingtheevent",false,true,{});u.global.dispatchEvent(t);return function(t,r){t=t.toLowerCase();var n=document.createEvent("CustomEvent");n.initCustomEvent(t,false,true,r);return e(S[t],n)}}}catch(e){}return function(){return false}}();var C=function(){if(u.isNode){return function(){return process.emit.apply(process,arguments)}}else{if(!u.global){return function(){return false}}return function(e){var t="on"+e.toLowerCase();var r=u.global[t];if(!r)return false;r.apply(u.global,[].slice.call(arguments,1));return true}}}();function O(e,t){return{promise:t}}var E={promiseCreated:O,promiseFulfilled:O,promiseRejected:O,promiseResolved:O,promiseCancelled:O,promiseChained:function e(t,r,n){return{promise:r,child:n}},warning:function e(t,r){return{warning:r}},unhandledRejection:function e(t,r,n){return{reason:r,promise:n}},rejectionHandled:O};var A=function e(t){var r=false;try{r=C.apply(null,arguments)}catch(e){o.throwLater(e);r=true}var n=false;try{n=P(t,E[t].apply(null,arguments))}catch(e){o.throwLater(e);n=true}return n||r};t.config=function(e){e=Object(e);if("longStackTraces"in e){if(e.longStackTraces){t.longStackTraces()}else if(!e.longStackTraces&&t.hasLongStackTraces()){x()}}if("warnings"in e){var r=e.warnings;le.warnings=!!r;j=le.warnings;if(u.isObject(r)){if("wForgottenReturn"in r){j=!!r.wForgottenReturn}}}if("cancellation"in e&&e.cancellation&&!le.cancellation){if(o.haveItemsQueued()){throw new Error("cannot enable cancellation after promises are in use")}t.prototype._clearCancellationData=I;t.prototype._propagateFrom=L;t.prototype._onCancel=N;t.prototype._setOnCancel=M;t.prototype._attachCancellationCallback=F;t.prototype._execute=R;D=L;le.cancellation=true}if("monitoring"in e){if(e.monitoring&&!le.monitoring){le.monitoring=true;t.prototype._fireEvent=A}else if(!e.monitoring&&le.monitoring){le.monitoring=false;t.prototype._fireEvent=T}}if("asyncHooks"in e&&u.nodeSupportsAsyncResource){var a=le.asyncHooks;var s=!!e.asyncHooks;if(a!==s){le.asyncHooks=s;if(s){n()}else{i()}}}return t};function T(){return false}t.prototype._fireEvent=T;t.prototype._execute=function(e,t,r){try{e(t,r)}catch(e){return e}};t.prototype._onCancel=function(){};t.prototype._setOnCancel=function(e){};t.prototype._attachCancellationCallback=function(e){};t.prototype._captureStackTrace=function(){};t.prototype._attachExtraTrace=function(){};t.prototype._dereferenceTrace=function(){};t.prototype._clearCancellationData=function(){};t.prototype._propagateFrom=function(e,t){};function R(e,t,r){var n=this;try{e(t,r,function(e){if(typeof e!=="function"){throw new TypeError("onCancel must be a function, got: "+u.toString(e))}n._attachCancellationCallback(e)})}catch(e){return e}}function F(e){if(!this._isCancellable())return this;var t=this._onCancel();if(t!==undefined){if(u.isArray(t)){t.push(e)}else{this._setOnCancel([t,e])}}else{this._setOnCancel(e)}}function N(){return this._onCancelField}function M(e){this._onCancelField=e}function I(){this._cancellationParent=undefined;this._onCancelField=undefined}function L(e,t){if((t&1)!==0){this._cancellationParent=e;var r=e._branchesRemainingToCancel;if(r===undefined){r=0}e._branchesRemainingToCancel=r+1}if((t&2)!==0&&e._isBound()){this._setBoundTo(e._boundTo)}}function B(e,t){if((t&2)!==0&&e._isBound()){this._setBoundTo(e._boundTo)}}var D=B;function H(){var e=this._boundTo;if(e!==undefined){if(e instanceof t){if(e.isFulfilled()){return e.value()}else{return undefined}}}return e}function U(){this._trace=new se(this._peekContext())}function $(e,t){if(c(e)){var r=this._trace;if(r!==undefined){if(t)r=r._parent}if(r!==undefined){r.attachExtraTrace(e)}else if(!e.__stackCleaned__){var n=Q(e);u.notEnumerableProp(e,"stack",n.message+"\n"+n.stack.join("\n"));u.notEnumerableProp(e,"__stackCleaned__",true)}}}function V(){this._trace=undefined}function W(e,t,r,n,i){if(e===undefined&&t!==null&&j){if(i!==undefined&&i._returnedNonUndefined())return;if((n._bitField&65535)===0)return;if(r)r=r+" ";var o="";var a="";if(t._trace){var u=t._trace.stack.split("\n");var s=J(u);for(var c=s.length-1;c>=0;--c){var l=s[c];if(!h.test(l)){var f=l.match(d);if(f){o="at "+f[1]+":"+f[2]+":"+f[3]+" "}break}}if(s.length>0){var p=s[0];for(var c=0;c<u.length;++c){if(u[c]===p){if(c>0){a="\n"+u[c-1]}break}}}}var v="a promise was created in a "+r+"handler "+o+"but was not returned from it, "+"see http://goo.gl/rRqMUw"+a;n._warn(v,true,t)}}function z(e,t){var r=e+" is deprecated and will be removed in a future version.";if(t)r+=" Use "+t+" instead.";return q(r)}function q(e,r,n){if(!le.warnings)return;var i=new a(e);var o;if(r){n._attachExtraTrace(i)}else if(le.longStackTraces&&(o=t._peekContext())){o.attachExtraTrace(i)}else{var u=Q(i);i.stack=u.message+"\n"+u.stack.join("\n")}if(!A("warning",i)){Z(i,"",true)}}function G(e,t){for(var r=0;r<t.length-1;++r){t[r].push("From previous event:");t[r]=t[r].join("\n")}if(r<t.length){t[r]=t[r].join("\n")}return e+"\n"+t.join("\n")}function K(e){for(var t=0;t<e.length;++t){if(e[t].length===0||t+1<e.length&&e[t][0]===e[t+1][0]){e.splice(t,1);t--}}}function Y(e){var t=e[0];for(var r=1;r<e.length;++r){var n=e[r];var i=t.length-1;var o=t[i];var a=-1;for(var u=n.length-1;u>=0;--u){if(n[u]===o){a=u;break}}for(var u=a;u>=0;--u){var s=n[u];if(t[i]===s){t.pop();i--}else{break}}t=n}}function J(e){var t=[];for(var r=0;r<e.length;++r){var n=e[r];var i=" (No stack trace)"===n||v.test(n);var o=i&&ie(n);if(i&&!o){if(_&&n.charAt(0)!==" "){n=" "+n}t.push(n)}}return t}function X(e){var t=e.stack.replace(/\s+$/g,"").split("\n");for(var r=0;r<t.length;++r){var n=t[r];if(" (No stack trace)"===n||v.test(n)){break}}if(r>0&&e.name!="SyntaxError"){t=t.slice(r)}return t}function Q(e){var t=e.stack;var r=e.toString();t=typeof t==="string"&&t.length>0?X(e):[" (No stack trace)"];return{message:r,stack:e.name=="SyntaxError"?t:J(t)}}function Z(e,t,r){if(typeof console!=="undefined"){var n;if(u.isObject(e)){var i=e.stack;n=t+y(i,e)}else{n=t+String(e)}if(typeof m==="function"){m(n,r)}else if(typeof console.log==="function"||_typeof(console.log)==="object"){console.log(n)}}}function ee(e,t,r,n){var i=false;try{if(typeof t==="function"){i=true;if(e==="rejectionHandled"){t(n)}else{t(r,n)}}}catch(e){o.throwLater(e)}if(e==="unhandledRejection"){if(!A(e,r,n)&&!i){Z(r,"Unhandled rejection ")}}else{A(e,n)}}function te(e){var t;if(typeof e==="function"){t="[function "+(e.name||"anonymous")+"]"}else{t=e&&typeof e.toString==="function"?e.toString():u.toString(e);var r=/\[object [a-zA-Z0-9$_]+\]/;if(r.test(t)){try{var n=JSON.stringify(e);t=n}catch(e){}}if(t.length===0){t="(empty array)"}}return"(<"+re(t)+">, no stack trace)"}function re(e){var t=41;if(e.length<t){return e}return e.substr(0,t-3)+"..."}function ne(){return typeof ce==="function"}var ie=function e(){return false};var oe=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;function ae(e){var t=e.match(oe);if(t){return{fileName:t[1],line:parseInt(t[2],10)}}}function ue(e,t){if(!ne())return;var r=(e.stack||"").split("\n");var n=(t.stack||"").split("\n");var i=-1;var o=-1;var a;var u;for(var s=0;s<r.length;++s){var c=ae(r[s]);if(c){a=c.fileName;i=c.line;break}}for(var s=0;s<n.length;++s){var c=ae(n[s]);if(c){u=c.fileName;o=c.line;break}}if(i<0||o<0||!a||!u||a!==u||i>=o){return}ie=function e(t){if(p.test(t))return true;var r=ae(t);if(r){if(r.fileName===a&&i<=r.line&&r.line<=o){return true}}return false}}function se(e){this._parent=e;this._promisesCreated=0;var t=this._length=1+(e===undefined?0:e._length);ce(this,se);if(t>32)this.uncycle()}u.inherits(se,Error);r.CapturedTrace=se;se.prototype.uncycle=function(){var e=this._length;if(e<2)return;var t=[];var r={};for(var n=0,i=this;i!==undefined;++n){t.push(i);i=i._parent}e=this._length=n;for(var n=e-1;n>=0;--n){var o=t[n].stack;if(r[o]===undefined){r[o]=n}}for(var n=0;n<e;++n){var a=t[n].stack;var u=r[a];if(u!==undefined&&u!==n){if(u>0){t[u-1]._parent=undefined;t[u-1]._length=1}t[n]._parent=undefined;t[n]._length=1;var s=n>0?t[n-1]:this;if(u<e-1){s._parent=t[u+1];s._parent.uncycle();s._length=s._parent._length+1}else{s._parent=undefined;s._length=1}var c=s._length+1;for(var l=n-2;l>=0;--l){t[l]._length=c;c++}return}}};se.prototype.attachExtraTrace=function(e){if(e.__stackCleaned__)return;this.uncycle();var t=Q(e);var r=t.message;var n=[t.stack];var i=this;while(i!==undefined){n.push(J(i.stack.split("\n")));i=i._parent}Y(n);K(n);u.notEnumerableProp(e,"stack",G(r,n));u.notEnumerableProp(e,"__stackCleaned__",true)};var ce=function e(){var t=/^\s*at\s*/;var r=function e(t,r){if(typeof t==="string")return t;if(r.name!==undefined&&r.message!==undefined){return r.toString()}return te(r)};if(typeof Error.stackTraceLimit==="number"&&typeof Error.captureStackTrace==="function"){Error.stackTraceLimit+=6;v=t;y=r;var n=Error.captureStackTrace;ie=function e(t){return p.test(t)};return function(e,t){Error.stackTraceLimit+=6;n(e,t);Error.stackTraceLimit-=6}}var i=new Error;if(typeof i.stack==="string"&&i.stack.split("\n")[0].indexOf("stackDetection@")>=0){v=/@/;y=r;_=true;return function e(t){t.stack=(new Error).stack}}var o;try{throw new Error}catch(e){o="stack"in e}if(!("stack"in i)&&o&&typeof Error.stackTraceLimit==="number"){v=t;y=r;return function e(t){Error.stackTraceLimit+=6;try{throw new Error}catch(e){t.stack=e.stack}Error.stackTraceLimit-=6}}y=function e(t,r){if(typeof t==="string")return t;if(((typeof r==="undefined"?"undefined":_typeof(r))==="object"||typeof r==="function")&&r.name!==undefined&&r.message!==undefined){return r.toString()}return te(r)};return null}([]);if(typeof console!=="undefined"&&typeof console.warn!=="undefined"){m=function e(t){console.warn(t)};if(u.isNode&&process.stderr.isTTY){m=function e(t,r){var n=r?"\x1b[33m":"\x1b[31m";console.warn(n+t+"\x1b[0m\n")}}else if(!u.isNode&&typeof(new Error).stack==="string"){m=function e(t,r){console.warn("%c"+t,r?"color: darkorange":"color: red")}}}var le={warnings:b,longStackTraces:false,cancellation:false,monitoring:false,asyncHooks:false};if(w)t.longStackTraces();return{asyncHooks:function e(){return le.asyncHooks},longStackTraces:function e(){return le.longStackTraces},warnings:function e(){return le.warnings},cancellation:function e(){return le.cancellation},monitoring:function e(){return le.monitoring},propagateFromFunction:function e(){return D},boundValueFunction:function e(){return H},checkForgottenReturns:W,setBounds:ue,warn:q,deprecated:z,CapturedTrace:se,fireDomEvent:P,fireGlobalEvent:C}}},{"./errors":12,"./es5":13,"./util":36}],10:[function(e,t,r){"use strict";t.exports=function(e){function t(){return this.value}function r(){throw this.reason}e.prototype["return"]=e.prototype.thenReturn=function(r){if(r instanceof e)r.suppressUnhandledRejections();return this._then(t,undefined,undefined,{value:r},undefined)};e.prototype["throw"]=e.prototype.thenThrow=function(e){return this._then(r,undefined,undefined,{reason:e},undefined)};e.prototype.catchThrow=function(e){if(arguments.length<=1){return this._then(undefined,r,undefined,{reason:e},undefined)}else{var t=arguments[1];var n=function e(){throw t};return this.caught(e,n)}};e.prototype.catchReturn=function(r){if(arguments.length<=1){if(r instanceof e)r.suppressUnhandledRejections();return this._then(undefined,t,undefined,{value:r},undefined)}else{var n=arguments[1];if(n instanceof e)n.suppressUnhandledRejections();var i=function e(){return n};return this.caught(r,i)}}}},{}],11:[function(e,t,r){"use strict";t.exports=function(e,t){var r=e.reduce;var n=e.all;function i(){return n(this)}function o(e,n){return r(e,n,t,t)}e.prototype.each=function(e){return r(this,e,t,0)._then(i,undefined,undefined,this,undefined)};e.prototype.mapSeries=function(e){return r(this,e,t,t)};e.each=function(e,n){return r(e,n,t,0)._then(i,undefined,undefined,e,undefined)};e.mapSeries=o}},{}],12:[function(e,t,r){"use strict";var n=e("./es5");var i=n.freeze;var o=e("./util");var a=o.inherits;var u=o.notEnumerableProp;function s(e,t){function r(n){if(!(this instanceof r))return new r(n);u(this,"message",typeof n==="string"?n:t);u(this,"name",e);if(Error.captureStackTrace){Error.captureStackTrace(this,this.constructor)}else{Error.call(this)}}a(r,Error);return r}var c,l;var f=s("Warning","warning");var p=s("CancellationError","cancellation error");var h=s("TimeoutError","timeout error");var d=s("AggregateError","aggregate error");try{c=TypeError;l=RangeError}catch(e){c=s("TypeError","type error");l=s("RangeError","range error")}var v=("join pop push shift unshift slice filter forEach some "+"every map indexOf lastIndexOf reduce reduceRight sort reverse").split(" ");for(var y=0;y<v.length;++y){if(typeof Array.prototype[v[y]]==="function"){d.prototype[v[y]]=Array.prototype[v[y]]}}n.defineProperty(d.prototype,"length",{value:0,configurable:false,writable:true,enumerable:true});d.prototype["isOperational"]=true;var _=0;d.prototype.toString=function(){var e=Array(_*4+1).join(" ");var t="\n"+e+"AggregateError of:"+"\n";_++;e=Array(_*4+1).join(" ");for(var r=0;r<this.length;++r){var n=this[r]===this?"[Circular AggregateError]":this[r]+"";var i=n.split("\n");for(var o=0;o<i.length;++o){i[o]=e+i[o]}n=i.join("\n");t+=n+"\n"}_--;return t};function m(e){if(!(this instanceof m))return new m(e);u(this,"name","OperationalError");u(this,"message",e);this.cause=e;this["isOperational"]=true;if(e instanceof Error){u(this,"message",e.message);u(this,"stack",e.stack)}else if(Error.captureStackTrace){Error.captureStackTrace(this,this.constructor)}}a(m,Error);var g=Error["__BluebirdErrorTypes__"];if(!g){g=i({CancellationError:p,TimeoutError:h,OperationalError:m,RejectionError:m,AggregateError:d});n.defineProperty(Error,"__BluebirdErrorTypes__",{value:g,writable:false,enumerable:false,configurable:false})}t.exports={Error:Error,TypeError:c,RangeError:l,CancellationError:g.CancellationError,OperationalError:g.OperationalError,TimeoutError:g.TimeoutError,AggregateError:g.AggregateError,Warning:f}},{"./es5":13,"./util":36}],13:[function(e,t,r){var n=function(){"use strict";return this===undefined}();if(n){t.exports={freeze:Object.freeze,defineProperty:Object.defineProperty,getDescriptor:Object.getOwnPropertyDescriptor,keys:Object.keys,names:Object.getOwnPropertyNames,getPrototypeOf:Object.getPrototypeOf,isArray:Array.isArray,isES5:n,propertyIsWritable:function e(t,r){var n=Object.getOwnPropertyDescriptor(t,r);return!!(!n||n.writable||n.set)}}}else{var i={}.hasOwnProperty;var o={}.toString;var a={}.constructor.prototype;var u=function e(t){var r=[];for(var n in t){if(i.call(t,n)){r.push(n)}}return r};var s=function e(t,r){return{value:t[r]}};var c=function e(t,r,n){t[r]=n.value;return t};var l=function e(t){return t};var f=function e(t){try{return Object(t).constructor.prototype}catch(e){return a}};var p=function e(t){try{return o.call(t)==="[object Array]"}catch(e){return false}};t.exports={isArray:p,keys:u,names:u,defineProperty:c,getDescriptor:s,freeze:l,getPrototypeOf:f,isES5:n,propertyIsWritable:function e(){return true}}}},{}],14:[function(e,t,r){"use strict";t.exports=function(e,t){var r=e.map;e.prototype.filter=function(e,n){return r(this,e,n,t)};e.filter=function(e,n,i){return r(e,n,i,t)}}},{}],15:[function(e,t,r){"use strict";t.exports=function(t,r,n){var i=e("./util");var o=t.CancellationError;var a=i.errorObj;var u=e("./catch_filter")(n);function s(e,t,r){this.promise=e;this.type=t;this.handler=r;this.called=false;this.cancelPromise=null}s.prototype.isFinallyHandler=function(){return this.type===0};function c(e){this.finallyHandler=e}c.prototype._resultCancelled=function(){l(this.finallyHandler)};function l(e,t){if(e.cancelPromise!=null){if(arguments.length>1){e.cancelPromise._reject(t)}else{e.cancelPromise._cancel()}e.cancelPromise=null;return true}return false}function f(){return h.call(this,this.promise._target()._settledValue())}function p(e){if(l(this,e))return;a.e=e;return a}function h(e){var i=this.promise;var u=this.handler;if(!this.called){this.called=true;var s=this.isFinallyHandler()?u.call(i._boundValue()):u.call(i._boundValue(),e);if(s===n){return s}else if(s!==undefined){i._setReturnedNonUndefined();var h=r(s,i);if(h instanceof t){if(this.cancelPromise!=null){if(h._isCancelled()){var d=new o("late cancellation observer");i._attachExtraTrace(d);a.e=d;return a}else if(h.isPending()){h._attachCancellationCallback(new c(this))}}return h._then(f,p,undefined,this,undefined)}}}if(i.isRejected()){l(this);a.e=e;return a}else{l(this);return e}}t.prototype._passThrough=function(e,t,r,n){if(typeof e!=="function")return this.then();return this._then(r,n,undefined,new s(this,t,e),undefined)};t.prototype.lastly=t.prototype["finally"]=function(e){return this._passThrough(e,0,h,h)};t.prototype.tap=function(e){return this._passThrough(e,1,h)};t.prototype.tapCatch=function(e){var r=arguments.length;if(r===1){return this._passThrough(e,1,undefined,h)}else{var n=new Array(r-1),o=0,a;for(a=0;a<r-1;++a){var s=arguments[a];if(i.isObject(s)){n[o++]=s}else{return t.reject(new TypeError("tapCatch statement predicate: "+"expecting an object but got "+i.classString(s)))}}n.length=o;var c=arguments[a];return this._passThrough(u(n,c,this),1,undefined,h)}};return s}},{"./catch_filter":7,"./util":36}],16:[function(e,t,r){"use strict";t.exports=function(t,r,n,i,o,a){var u=e("./errors");var s=u.TypeError;var c=e("./util");var l=c.errorObj;var f=c.tryCatch;var p=[];function h(e,r,n){for(var o=0;o<r.length;++o){n._pushContext();var a=f(r[o])(e);n._popContext();if(a===l){n._pushContext();var u=t.reject(l.e);n._popContext();return u}var s=i(a,n);if(s instanceof t)return s}return null}function d(e,r,i,o){if(a.cancellation()){var u=new t(n);var s=this._finallyPromise=new t(n);this._promise=u.lastly(function(){return s});u._captureStackTrace();u._setOnCancel(this)}else{var c=this._promise=new t(n);c._captureStackTrace()}this._stack=o;this._generatorFunction=e;this._receiver=r;this._generator=undefined;this._yieldHandlers=typeof i==="function"?[i].concat(p):p;this._yieldedPromise=null;this._cancellationPhase=false}c.inherits(d,o);d.prototype._isResolved=function(){return this._promise===null};d.prototype._cleanup=function(){this._promise=this._generator=null;if(a.cancellation()&&this._finallyPromise!==null){this._finallyPromise._fulfill();this._finallyPromise=null}};d.prototype._promiseCancelled=function(){if(this._isResolved())return;var e=typeof this._generator["return"]!=="undefined";var r;if(!e){var n=new t.CancellationError("generator .return() sentinel");t.coroutine.returnSentinel=n;this._promise._attachExtraTrace(n);this._promise._pushContext();r=f(this._generator["throw"]).call(this._generator,n);this._promise._popContext()}else{this._promise._pushContext();r=f(this._generator["return"]).call(this._generator,undefined);this._promise._popContext()}this._cancellationPhase=true;this._yieldedPromise=null;this._continue(r)};d.prototype._promiseFulfilled=function(e){this._yieldedPromise=null;this._promise._pushContext();var t=f(this._generator.next).call(this._generator,e);this._promise._popContext();this._continue(t)};d.prototype._promiseRejected=function(e){this._yieldedPromise=null;this._promise._attachExtraTrace(e);this._promise._pushContext();var t=f(this._generator["throw"]).call(this._generator,e);this._promise._popContext();this._continue(t)};d.prototype._resultCancelled=function(){if(this._yieldedPromise instanceof t){var e=this._yieldedPromise;this._yieldedPromise=null;e.cancel()}};d.prototype.promise=function(){return this._promise};d.prototype._run=function(){this._generator=this._generatorFunction.call(this._receiver);this._receiver=this._generatorFunction=undefined;this._promiseFulfilled(undefined)};d.prototype._continue=function(e){var r=this._promise;if(e===l){this._cleanup();if(this._cancellation