ciril
Version:
A javascript data binding library
2 lines • 188 kB
JavaScript
!function t(e,n,r){function o(s,a){if(!n[s]){if(!e[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(i)return i(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[s]={exports:{}};e[s][0].call(l.exports,function(t){var n=e[s][1][t];return o(n?n:t)},l,l.exports,t,e,n,r)}return n[s].exports}for(var i="function"==typeof require&&require,s=0;s<r.length;s++)o(r[s]);return o}({1:[function(t,e,n){(function(n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}var o=t("./core/flowgraph"),i=r(o),s=t("./core/flownode"),a=r(s),u=t("./factory/classes"),c=r(u);n._babelPolyfill||t("babel-polyfill");var l={FlowNode:a["default"],Transformer:s.Transformer,wrap:s.wrap,FlowGraph:i["default"],_nodes:i["default"].nodes,_bindings:i["default"].bindings,_inputs:i["default"].inputs,register:i["default"].register.bind(i["default"]),isRegistered:i["default"].isRegistered.bind(i["default"]),remove:i["default"].remove.bind(i["default"]),removeAll:i["default"].removeAll.bind(i["default"]),bind:i["default"].bind.bind(i["default"]),bindAll:i["default"].bindAll.bind(i["default"]),bindInputs:i["default"].bindInputs.bind(i["default"]),bindAllInputs:i["default"].bindAllInputs.bind(i["default"]),unbind:i["default"].unbind.bind(i["default"]),unbindAll:i["default"].unbindAll.bind(i["default"]),synchronize:i["default"].synchronize.bind(i["default"]),synchronizeAll:i["default"].synchronizeAll.bind(i["default"]),desynchronize:i["default"].desynchronize.bind(i["default"]),desynchronizeAll:i["default"].desynchronizeAll.bind(i["default"]),nodeFromUuid:i["default"].nodeFromUuid.bind(i["default"]),getNodeState:i["default"].getNodeState.bind(i["default"]),update:i["default"].update.bind(i["default"]),updateAll:i["default"].updateAll.bind(i["default"]),updateSync:i["default"].updateSync.bind(i["default"]),updateAllSync:i["default"].updateAllSync.bind(i["default"]),flush:i["default"].flush.bind(i["default"]),clear:i["default"].clear.bind(i["default"]),createClass:c["default"],createMixin:u.createMixin};e.exports=l}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./core/flowgraph":2,"./core/flownode":3,"./factory/classes":4,"babel-polyfill":5}],2:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();Object.defineProperty(n,"__esModule",{value:!0});var a=t("bluebird"),u=r(a),c=t("lodash/array/remove"),l=r(c),f=t("lodash/lang/cloneDeep"),p=r(f),h=t("lodash/object/has"),d=function(){function t(){i(this,t),this.nodes=new Map([]),this.bindings=new Map([]),this.inputs=new Map([]),this.pending=new Set([])}return s(t,[{key:"register",value:function(t){if(!h(t,"uuid"))throw new Error("register(node): node must have a uuid.");var e=t.uuid;if(this.nodes.has(e))throw new Error("register(node): a node with the given uuid is already registered, try generating a new one.");this.nodes.set(e,t),this.bindings.set(e,new Set([])),this.inputs.set(e,[])}},{key:"remove",value:function(){for(var t=arguments.length,e=Array(t),n=0;t>n;n++)e[n]=arguments[n];this.removeAll(e)}},{key:"removeAll",value:function(t){var e=this;t.forEach(function(t){var n=t.uuid;e.inputs.get(n).map(function(t){return e.nodeFromUuid(t)}).forEach(function(t){return e.unbind(t,e)});var r=!0,o=!1,i=void 0;try{for(var s,a=e.bindings.get(n)[Symbol.iterator]();!(r=(s=a.next()).done);r=!0){var u=s.value,c=e.nodeFromUuid(u);e.unbind(t,c)}}catch(l){o=!0,i=l}finally{try{!r&&a["return"]&&a["return"]()}finally{if(o)throw i}}t.onRemove(),e.nodes["delete"](n)})}},{key:"bind",value:function(t){for(var e=arguments.length,n=Array(e>1?e-1:0),r=1;e>r;r++)n[r-1]=arguments[r];return this.bindAll(t,n)}},{key:"bindAll",value:function(t,e){if(!this.isRegistered(t))throw new Error("bindAll(...): source not registered.");var n=!0,r=!1,o=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done);n=!0){var a=i.value;if(!this.isRegistered(a))throw new Error("bindAll(...): destination not registered.")}}catch(u){r=!0,o=u}finally{try{!n&&s["return"]&&s["return"]()}finally{if(r)throw o}}var c=!0,l=!1,f=void 0;try{for(var p,h=e[Symbol.iterator]();!(c=(p=h.next()).done);c=!0){var a=p.value;this.inputs.get(a.uuid).push(t.uuid),this.bindings.get(t.uuid).add(a.uuid),a.onBindInput(t),t.onBind(a)}}catch(u){l=!0,f=u}finally{try{!c&&h["return"]&&h["return"]()}finally{if(l)throw f}}return!0}},{key:"bindInputs",value:function(t){for(var e=arguments.length,n=Array(e>1?e-1:0),r=1;e>r;r++)n[r-1]=arguments[r];this.bindAllInputs(t,n)}},{key:"bindAllInputs",value:function(t,e){var n=this,r=t.uuid,o=this.inputs.get(r);o.length>0&&(console.warn("bindAllInputs(...): Overwriting existing inputs"),o.map(function(t){return n.nodeFromUuid(t)}).forEach(function(e){return n.unbind(e,t)}));var i=!0,s=!1,a=void 0;try{for(var u,c=e[Symbol.iterator]();!(i=(u=c.next()).done);i=!0){var l=u.value;this.bind(l,t)}}catch(f){s=!0,a=f}finally{try{!i&&c["return"]&&c["return"]()}finally{if(s)throw a}}}},{key:"unbind",value:function(t){for(var e=arguments.length,n=Array(e>1?e-1:0),r=1;e>r;r++)n[r-1]=arguments[r];return this.unbindAll(t,n)}},{key:"unbindAll",value:function(t,e){if(!this.nodes.has(t.uuid))return!1;var n=!0,r=!1,o=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done);n=!0){var a=i.value;this.nodes.has(a.uuid)?(a.onUnbindInput(t),t.onUnbind(a),(0,l["default"])(this.inputs.get(a.uuid),function(e){return e===t.uuid}),this.bindings.get(t.uuid)["delete"](a.uuid),a.state=(0,p["default"])(a.state)):console.warn("unbindAll(...): Attempting to unbind unregistered node.")}}catch(u){r=!0,o=u}finally{try{!n&&s["return"]&&s["return"]()}finally{if(r)throw o}}return!0}},{key:"synchronize",value:function(){for(var t=arguments.length,e=Array(t),n=0;t>n;n++)e[n]=arguments[n];this.synchronizeAll(e)}},{key:"synchronizeAll",value:function(t){var e=this;return t.length<=1?!1:void t.reduce(function(n,r,o,i){var s=(o+1)%t.length;return e.bind(r,i[s])})}},{key:"desynchronize",value:function(){for(var t=arguments.length,e=Array(t),n=0;t>n;n++)e[n]=arguments[n];this.desynchronizeAll(e)}},{key:"desynchronizeAll",value:function(t){var e=this;t.length<=1||t.reduce(function(t,n,r,o){return e.unbind(t,n),n},t[t.length-1])}},{key:"nodeFromUuid",value:function(t){return this.nodes.has(t)?this.nodes.get(t):null}},{key:"getNodeState",value:function(t){return this.nodeFromUuid(t).getState()}},{key:"update",value:function(){for(var t=arguments.length,e=Array(t),n=0;t>n;n++)e[n]=arguments[n];return this.updateAll(e)}},{key:"updateAll",value:function(t){var e=this,n=u["default"].map(t,function(t){var n=t.uuid;return new u["default"](function(t,r){t(e._terminalsFrom(n))}).map(function(t){return e._update(t)}).all()}).all();return this.pending.add(n),n.then(function(t){return e.pending["delete"](n)})}},{key:"updateSync",value:function(){for(var t=arguments.length,e=Array(t),n=0;t>n;n++)e[n]=arguments[n];this.updateAllSync(e)}},{key:"updateAllSync",value:function(t){var e=this;t.forEach(function(t){var n=t.uuid;e._terminalsFrom(n).forEach(function(t){return e._updateSync(t)})})}},{key:"clear",value:function(){var t=this,e=arguments.length<=0||void 0===arguments[0]?!0:arguments[0];return e?this.flush().then(function(e){return t._clear()}).caught(function(e){console.warn(e.stack),t._clear()}):void this._clear()}},{key:"flush",value:function(){return u["default"].all(Array.from(this.pending))}},{key:"_clear",value:function(){this.nodes.clear(),this.bindings.clear(),this.inputs.clear(),this.pending.clear()}},{key:"_update",value:function(t){var e=this,n=this.nodeFromUuid(t);return n.isDirty()?(n.markDirty(!1),u["default"].map(this.inputs.get(t).filter(function(t){return e.nodeFromUuid(t).isDirty()}),function(t){return e._update(t)}).all().then(function(r){var o=e.inputs.get(t),i=o.length>0?o.reduce(function(t,n,r,o){return t||e.nodeFromUuid(n).changed}):!1;if(i){var s=o.map(function(t){return e.getNodeState(t)});return u["default"].resolve(n.setState.apply(n,s))}return n.changed=!1,u["default"].resolve(!1)})):u["default"].resolve(!1)}},{key:"_updateSync",value:function(t){var e=this,n=this.nodeFromUuid(t);if(!n.isDirty())return!1;n.markDirty(!1);var r=(this.inputs.get(t).filter(function(t){return e.nodeFromUuid(t).isDirty()}).map(function(t){return e._updateSync(t)}),this.inputs.get(t)),i=r.length>0?r.reduce(function(t,n,r,o){return t||e.nodeFromUuid(n).changed}):!1;if(i){var s=r.map(function(t){return e.getNodeState(t)});return n.setState.apply(n,o(s))}return n.changed=!1,!1}},{key:"_terminalsFrom",value:function(t){for(var e=new Set,n=[t],r=[];n.length>0;){var o=n.pop(),i=!0;e.add(o);var s=!0,a=!1,u=void 0;try{for(var c,l=this.bindings.get(o)[Symbol.iterator]();!(s=(c=l.next()).done);s=!0){var f=c.value;e.has(f)||(i=!1,n.push(f),this.nodeFromUuid(f).markDirty(!0))}}catch(p){a=!0,u=p}finally{try{!s&&l["return"]&&l["return"]()}finally{if(a)throw u}}i&&r.push(o)}return r}},{key:"isRegistered",value:function(t){return this.nodes.has(t.uuid)}}]),t}(),v=new d;n["default"]=v},{bluebird:7,"lodash/array/remove":196,"lodash/lang/cloneDeep":238,"lodash/object/has":246}],3:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t){for(var e=arguments.length,n=Array(e>1?e-1:0),r=1;e>r;r++)n[r-1]=arguments[r];n.forEach(function(e){Object.getOwnPropertyNames(e).forEach(function(n){"constructor"===n||t[n]||Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})})}function u(t){return new j(t)}function c(t){var e=new $(t);return e}function l(t){if(!t.hasOwnProperty("state"))return c(t);var e=new $(null,!1);return a(t,e,$.prototype),t.register(),t}function f(t){if(t instanceof $)return t.register();switch("undefined"==typeof t?"undefined":d(t)){case"function":return u(t);case"object":return l(t);default:return c(t)}}function p(){var t=arguments.length<=0||void 0===arguments[0]?null:arguments[0],e=arguments.length<=1||void 0===arguments[1]?!0:arguments[1];Object.defineProperty(this,"dirty",{writable:!0,value:!1}),Object.defineProperty(this,"uuid",{value:m["default"].v4()}),Object.defineProperty(this,"state",{writable:!0,value:t}),Object.defineProperty(this,"changed",{writable:!0,value:!1}),e&&y["default"].register(this)}var h=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t};Object.defineProperty(n,"__esModule",{value:!0}),n.Transformer=void 0,n.wrap=f,n.NodeConstructor=p;var v=t("./flowgraph"),y=r(v),g=t("uuid"),m=r(g),_=t("lodash/lang/isEqual"),b=r(_),$=function(){function t(){var e=arguments.length<=0||void 0===arguments[0]?null:arguments[0],n=arguments.length<=1||void 0===arguments[1]?!0:arguments[1];s(this,t),p.call(this,e,n)}return h(t,[{key:"register",value:function(){return y["default"].register(this),this}},{key:"isRegistered",value:function(){return y["default"].isRegistered(this)}},{key:"transform",value:function(t){var e=new j(t);return y["default"].bind(this,e),e}},{key:"bind",value:function(){for(var t=arguments.length,e=Array(t),n=0;t>n;n++)e[n]=arguments[n];return this.bindAll(e)}},{key:"bindAll",value:function(t){var e=t.map(function(t){return y["default"].isRegistered(t)?t:f(t)});return y["default"].bindAll(this,e),e[e.length-1]}},{key:"synchronize",value:function(){for(var t=arguments.length,e=Array(t),n=0;t>n;n++)e[n]=arguments[n];return e.reduce(function(t,e,n,r){return t.bind(e)},this),this}},{key:"synchronizeAll",value:function(t){return t.reduce(function(t,e,n,r){return t.bind(e)},this),this}},{key:"unbind",value:function(){for(var t=arguments.length,e=Array(t),n=0;t>n;n++)e[n]=arguments[n];y["default"].unbindAll(this,e)}},{key:"unbindAll",value:function(t){y["default"].unbindAll(this,t)}},{key:"update",value:function(){return y["default"].update(this)}},{key:"updateSync",value:function(){y["default"].updateSync(this)}},{key:"isDirty",value:function(){return this.dirty}},{key:"markDirty",value:function(t){this.dirty=t}},{key:"bindInputs",value:function(){for(var t=arguments.length,e=Array(t),n=0;t>n;n++)e[n]=arguments[n];return y["default"].bindAllInputs(this,e),this}},{key:"bindAllInputs",value:function(t){return y["default"].bindAllInputs(this,t),this}},{key:"remove",value:function(){y["default"].remove(this)}},{key:"getState",value:function(){return this.state}},{key:"setState",value:function(){for(var t=arguments.length,e=Array(t),n=0;t>n;n++)e[n]=arguments[n];return e.reduce(function(t,e,n,r){return t&&(0,b["default"])(r[0],r[n])})||console.warn("setState(...): Inconsistent state detected, make sure transforms are correct.\n inputs: "+e),(0,b["default"])(this.state,e[0])?(this.changed=!1,!1):(this.state=e[0],this.changed=!0,!0)}},{key:"onRemove",value:function(){}},{key:"onUnbindInput",value:function(t){}},{key:"onBindInput",value:function(t){}},{key:"onUnbind",value:function(t){}},{key:"onBind",value:function(t){}}]),t}();n["default"]=$;var j=n.Transformer=function(t){function e(t){s(this,e);var n=o(this,Object.getPrototypeOf(e).call(this));return n.fn=t,n}return i(e,t),h(e,[{key:"setState",value:function(){for(var t=arguments.length,e=Array(t),n=0;t>n;n++)e[n]=arguments[n];var r=this.fn.apply(this,e);return(0,b["default"])(this.state,r)?(this.changed=!1,!1):(this.state=r,this.changed=!0,!0)}}]),e}($)},{"./flowgraph":2,"lodash/lang/isEqual":241,uuid:255}],4:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function a(t,e){Object.getOwnPropertyNames(e).forEach(function(n){"constructor"===n||t[n]||Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}function u(t){for(var e=t.prototype,n=arguments.length,r=Array(n>1?n-1:0),o=1;n>o;o++)r[o-1]=arguments[o];return r.forEach(function(t){t=t.prototype,a(e,t)}),t}function c(t){if("function"!=typeof t)throw new Error("createMixin(...): argument should be function, got "+("undefined"==typeof t?"undefined":f(t)));var e=t.prototype.getInitialState,n="function"==typeof e?e.apply(this):null,r=t.prototype.registerOnCreate||!0,a=function(t){function e(){return o(this,e),i(this,Object.getPrototypeOf(e).apply(this,arguments))}return s(e,t),e}(t);u(a,h["default"]);var c=a.prototype;return a=function(){p.NodeConstructor.call(this,n,r),t.apply(this,arguments)},a.prototype=c,a}function l(t){if("object"!==("undefined"==typeof t?"undefined":f(t)))throw new Error("createClass(...): class specification must be an object, got "+("undefined"==typeof t?"undefined":f(t)));var e=function(t){function e(){return o(this,e),i(this,Object.getPrototypeOf(e).apply(this,arguments))}return s(e,t),e}(h["default"]);return d(e.prototype,t),e}var f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t};Object.defineProperty(n,"__esModule",{value:!0}),n.createMixin=c,n["default"]=l;var p=t("../core/flownode"),h=r(p),d=t("object-assign")},{"../core/flownode":3,"object-assign":252}],5:[function(t,e,n){(function(e){"use strict";if(t("core-js/shim"),t("babel-regenerator-runtime"),e._babelPolyfill)throw new Error("only one instance of babel-polyfill is allowed");e._babelPolyfill=!0}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"babel-regenerator-runtime":6,"core-js/shim":194}],6:[function(t,e,n){(function(t,n){!function(n){"use strict";function r(t,e,n,r){var o=Object.create((e||i).prototype),s=new d(r||[]);return o._invoke=f(t,n,s),o}function o(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(r){return{type:"throw",arg:r}}}function i(){}function s(){}function a(){}function u(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function c(t){this.arg=t}function l(e){function n(t,n){var r=e[t](n),o=r.value;return o instanceof c?Promise.resolve(o.arg).then(i,s):Promise.resolve(o).then(function(t){return r.value=t,r})}function r(t,e){function r(){return n(t,e)}return o=o?o.then(r,r):new Promise(function(t){t(r())})}"object"==typeof t&&t.domain&&(n=t.domain.bind(n));var o,i=n.bind(e,"next"),s=n.bind(e,"throw");n.bind(e,"return");this._invoke=r}function f(t,e,n){var r=j;return function(i,s){if(r===x)throw new Error("Generator is already running");if(r===k){if("throw"===i)throw s;return y()}for(;;){var a=n.delegate;if(a){if("return"===i||"throw"===i&&a.iterator[i]===g){n.delegate=null;var u=a.iterator["return"];if(u){var c=o(u,a.iterator,s);if("throw"===c.type){i="throw",s=c.arg;continue}}if("return"===i)continue}var c=o(a.iterator[i],a.iterator,s);if("throw"===c.type){n.delegate=null,i="throw",s=c.arg;continue}i="next",s=g;var l=c.arg;if(!l.done)return r=w,l;n[a.resultName]=l.value,n.next=a.nextLoc,n.delegate=null}if("next"===i)n._sent=s,r===w?n.sent=s:n.sent=g;else if("throw"===i){if(r===j)throw r=k,s;n.dispatchException(s)&&(i="next",s=g)}else"return"===i&&n.abrupt("return",s);r=x;var c=o(t,e,n);if("normal"===c.type){r=n.done?k:w;var l={value:c.arg,done:n.done};if(c.arg!==S)return l;n.delegate&&"next"===i&&(s=g)}else"throw"===c.type&&(r=k,i="throw",s=c.arg)}}}function p(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function h(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function d(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(p,this),this.reset(!0)}function v(t){if(t){var e=t[_];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,r=function o(){for(;++n<t.length;)if(m.call(t,n))return o.value=t[n],o.done=!1,o;return o.value=g,o.done=!0,o};return r.next=r}}return{next:y}}function y(){return{value:g,done:!0}}var g,m=Object.prototype.hasOwnProperty,_="function"==typeof Symbol&&Symbol.iterator||"@@iterator",b="object"==typeof e,$=n.regeneratorRuntime;if($)return void(b&&(e.exports=$));$=n.regeneratorRuntime=b?e.exports:{},$.wrap=r;var j="suspendedStart",w="suspendedYield",x="executing",k="completed",S={},O=a.prototype=i.prototype;s.prototype=O.constructor=a,a.constructor=s,s.displayName="GeneratorFunction",$.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return e?e===s||"GeneratorFunction"===(e.displayName||e.name):!1},$.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,a):t.__proto__=a,t.prototype=Object.create(O),t},$.awrap=function(t){return new c(t)},u(l.prototype),$.async=function(t,e,n,o){var i=new l(r(t,e,n,o));return $.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},u(O),O[_]=function(){return this},O.toString=function(){return"[object Generator]"},$.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},$.values=v,d.prototype={constructor:d,reset:function(t){if(this.prev=0,this.next=0,this.sent=g,this.done=!1,this.delegate=null,this.tryEntries.forEach(h),!t)for(var e in this)"t"===e.charAt(0)&&m.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=g)},stop:function(){this.done=!0;var t=this.tryEntries[0],e=t.completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){function e(e,r){return i.type="throw",i.arg=t,n.next=e,!!r}if(this.done)throw t;for(var n=this,r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r],i=o.completion;if("root"===o.tryLoc)return e("end");if(o.tryLoc<=this.prev){var s=m.call(o,"catchLoc"),a=m.call(o,"finallyLoc");if(s&&a){if(this.prev<o.catchLoc)return e(o.catchLoc,!0);if(this.prev<o.finallyLoc)return e(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return e(o.catchLoc,!0)}else{if(!a)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return e(o.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&m.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=t,i.arg=e,o?this.next=o.finallyLoc:this.complete(i),S},complete:function(t,e){if("throw"===t.type)throw t.arg;"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=t.arg,this.next="end"):"normal"===t.type&&e&&(this.next=e)},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),h(n),S}},"catch":function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;h(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:v(t),resultName:e,nextLoc:n},S}}}("object"==typeof n?n:"object"==typeof window?window:"object"==typeof self?self:this)}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:253}],7:[function(t,e,n){(function(t,r){!function(t){if("object"==typeof n&&"undefined"!=typeof e)e.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var o;"undefined"!=typeof window?o=window:"undefined"!=typeof r?o=r:"undefined"!=typeof self&&(o=self),o.Promise=t()}}(function(){var e,n,o;return function i(t,e,n){function r(s,a){if(!e[s]){if(!t[s]){var u="function"==typeof _dereq_&&_dereq_;if(!a&&u)return u(s,!0);if(o)return o(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var l=e[s]={exports:{}};t[s][0].call(l.exports,function(e){var n=t[s][1][e];return r(n?n:e)},l,l.exports,i,t,e,n)}return e[s].exports}for(var o="function"==typeof _dereq_&&_dereq_,s=0;s<n.length;s++)r(n[s]);return r}({1:[function(t,e,n){"use strict";e.exports=function(t){function e(t){var e=new n(t),r=e.promise();return e.setHowMany(1),e.setUnwrap(),e.init(),r}var n=t._SomePromiseArray;t.any=function(t){return e(t)},t.prototype.any=function(){return e(this)}}},{}],2:[function(e,n,r){"use strict";function o(){this._isTickUsed=!1,this._lateQueue=new f(16),this._normalQueue=new f(16),this._haveDrainedQueues=!1,this._trampolineEnabled=!0;var t=this;this.drainQueues=function(){t._drainQueues()},this._schedule=l}function i(t,e,n){this._lateQueue.push(t,e,n),this._queueTick()}function s(t,e,n){this._normalQueue.push(t,e,n),this._queueTick()}function a(t){this._normalQueue._pushOne(t),this._queueTick()}var u;try{throw new Error}catch(c){u=c}var l=e("./schedule"),f=e("./queue"),p=e("./util");o.prototype.enableTrampoline=function(){this._trampolineEnabled=!0},o.prototype.disableTrampolineIfNecessary=function(){p.hasDevTools&&(this._trampolineEnabled=!1)},o.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues},o.prototype.fatalError=function(e,n){n?(t.stderr.write("Fatal "+(e instanceof Error?e.stack:e)),t.exit(2)):this.throwLater(e)},o.prototype.throwLater=function(t,e){if(1===arguments.length&&(e=t,t=function(){throw e}),"undefined"!=typeof setTimeout)setTimeout(function(){t(e)},0);else try{this._schedule(function(){t(e)})}catch(n){throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")}},p.hasDevTools?(o.prototype.invokeLater=function(t,e,n){this._trampolineEnabled?i.call(this,t,e,n):this._schedule(function(){setTimeout(function(){t.call(e,n)},100)})},o.prototype.invoke=function(t,e,n){this._trampolineEnabled?s.call(this,t,e,n):this._schedule(function(){t.call(e,n)})},o.prototype.settlePromises=function(t){this._trampolineEnabled?a.call(this,t):this._schedule(function(){t._settlePromises()})}):(o.prototype.invokeLater=i,o.prototype.invoke=s,o.prototype.settlePromises=a),o.prototype.invokeFirst=function(t,e,n){this._normalQueue.unshift(t,e,n),this._queueTick()},o.prototype._drainQueue=function(t){for(;t.length()>0;){var e=t.shift();if("function"==typeof e){var n=t.shift(),r=t.shift();e.call(n,r)}else e._settlePromises()}},o.prototype._drainQueues=function(){this._drainQueue(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,this._drainQueue(this._lateQueue)},o.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},o.prototype._reset=function(){this._isTickUsed=!1},n.exports=o,n.exports.firstLineError=u},{"./queue":26,"./schedule":29,"./util":36}],3:[function(t,e,n){"use strict";e.exports=function(t,e,n,r){var o=!1,i=function(t,e){this._reject(e)},s=function(t,e){e.promiseRejectionQueued=!0,e.bindingPromise._then(i,i,null,this,t)},a=function(t,e){0===(50397184&this._bitField)&&this._resolveCallback(e.target)},u=function(t,e){e.promiseRejectionQueued||this._reject(t)};t.prototype.bind=function(i){o||(o=!0,t.prototype._propagateFrom=r.propagateFromFunction(),t.prototype._boundValue=r.boundValueFunction());var c=n(i),l=new t(e);l._propagateFrom(this,1);var f=this._target();if(l._setBoundTo(c),c instanceof t){var p={promiseRejectionQueued:!1,promise:l,target:f,bindingPromise:c};f._then(e,s,void 0,l,p),c._then(a,u,void 0,l,p),l._setOnCancel(c)}else l._resolveCallback(f);return l},t.prototype._setBoundTo=function(t){void 0!==t?(this._bitField=2097152|this._bitField,this._boundTo=t):this._bitField=-2097153&this._bitField},t.prototype._isBound=function(){return 2097152===(2097152&this._bitField)},t.bind=function(e,n){return t.resolve(n).bind(e)}}},{}],4:[function(t,e,n){"use strict";function r(){try{Promise===i&&(Promise=o)}catch(t){}return i}var o;"undefined"!=typeof Promise&&(o=Promise);var i=t("./promise")();i.noConflict=r,e.exports=i},{"./promise":22}],5:[function(t,e,n){"use strict";var r=Object.create;if(r){var o=r(null),i=r(null);o[" size"]=i[" size"]=0}e.exports=function(e){function n(t,n){var r;if(null!=t&&(r=t[n]),"function"!=typeof r){var o="Object "+a.classString(t)+" has no method '"+a.toString(n)+"'";throw new e.TypeError(o)}return r}function r(t){var e=this.pop(),r=n(t,e);return r.apply(t,this)}function o(t){return t[this]}function i(t){var e=+this;return 0>e&&(e=Math.max(0,e+t.length)),t[e]}var s,a=t("./util"),u=a.canEvaluate;a.isIdentifier;e.prototype.call=function(t){var e=[].slice.call(arguments,1);return e.push(t),this._then(r,void 0,void 0,e,void 0)},e.prototype.get=function(t){var e,n="number"==typeof t;if(n)e=i;else if(u){var r=s(t);e=null!==r?r:o}else e=o;return this._then(e,void 0,void 0,t,void 0)}}},{"./util":36}],6:[function(t,e,n){"use strict";e.exports=function(e,n,r,o){var i=t("./util"),s=i.tryCatch,a=i.errorObj,u=e._async;e.prototype["break"]=e.prototype.cancel=function(){if(!o.cancellation())return this._warn("cancellation is disabled");for(var t=this,e=t;t.isCancellable();){if(!t._cancelBy(e)){e._isFollowing()?e._followee().cancel():e._cancelBranched();break}var n=t._cancellationParent;if(null==n||!n.isCancellable()){t._isFollowing()?t._followee().cancel():t._cancelBranched();break}t._isFollowing()&&t._followee().cancel(),e=t,t=n}},e.prototype._branchHasCancelled=function(){this._branchesRemainingToCancel--},e.prototype._enoughBranchesHaveCancelled=function(){return void 0===this._branchesRemainingToCancel||this._branchesRemainingToCancel<=0},e.prototype._cancelBy=function(t){return t===this?(this._branchesRemainingToCancel=0,this._invokeOnCancel(),!0):(this._branchHasCancelled(),this._enoughBranchesHaveCancelled()?(this._invokeOnCancel(),!0):!1)},e.prototype._cancelBranched=function(){this._enoughBranchesHaveCancelled()&&this._cancel()},e.prototype._cancel=function(){this.isCancellable()&&(this._setCancelled(),u.invoke(this._cancelPromises,this,void 0))},e.prototype._cancelPromises=function(){this._length()>0&&this._settlePromises()},e.prototype._unsetOnCancel=function(){this._onCancelField=void 0},e.prototype.isCancellable=function(){return this.isPending()&&!this.isCancelled()},e.prototype._doInvokeOnCancel=function(t,e){if(i.isArray(t))for(var n=0;n<t.length;++n)this._doInvokeOnCancel(t[n],e);else if(void 0!==t)if("function"==typeof t){if(!e){var r=s(t).call(this._boundValue());r===a&&(this._attachExtraTrace(r.e),u.throwLater(r.e))}}else t._resultCancelled(this)},e.prototype._invokeOnCancel=function(){var t=this._onCancel();this._unsetOnCancel(),u.invoke(this._doInvokeOnCancel,this,t)},e.prototype._invokeInternalOnCancel=function(){this.isCancellable()&&(this._doInvokeOnCancel(this._onCancel(),!0),this._unsetOnCancel())},e.prototype._resultCancelled=function(){this.cancel()}}},{"./util":36}],7:[function(t,e,n){"use strict";e.exports=function(e){function n(t,n,a){return function(u){var c=a._boundValue();t: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(n).call(c,u)}else if("function"==typeof f){var p=i(f).call(c,u);if(p===s)return p;if(p)return i(n).call(c,u)}else if(r.isObject(u)){for(var h=o(f),d=0;d<h.length;++d){var v=h[d];if(f[v]!=u[v])continue t}return i(n).call(c,u)}}return e}}var r=t("./util"),o=t("./es5").keys,i=r.tryCatch,s=r.errorObj;return n}},{"./es5":13,"./util":36}],8:[function(t,e,n){"use strict";e.exports=function(t){function e(){this._trace=new e.CapturedTrace(r())}function n(){return o?new e:void 0}function r(){var t=i.length-1;return t>=0?i[t]:void 0}var o=!1,i=[];return t.prototype._promiseCreated=function(){},t.prototype._pushContext=function(){},t.prototype._popContext=function(){return null},t._peekContext=t.prototype._peekContext=function(){},e.prototype._pushContext=function(){void 0!==this._trace&&(this._trace._promiseCreated=null,i.push(this._trace))},e.prototype._popContext=function(){if(void 0!==this._trace){var t=i.pop(),e=t._promiseCreated;return t._promiseCreated=null,e}return null},e.CapturedTrace=null,e.create=n,e.deactivateLongStackTraces=function(){},e.activateLongStackTraces=function(){var n=t.prototype._pushContext,i=t.prototype._popContext,s=t._peekContext,a=t.prototype._peekContext,u=t.prototype._promiseCreated;e.deactivateLongStackTraces=function(){t.prototype._pushContext=n,t.prototype._popContext=i,t._peekContext=s,t.prototype._peekContext=a,t.prototype._promiseCreated=u,o=!1},o=!0,t.prototype._pushContext=e.prototype._pushContext,
t.prototype._popContext=e.prototype._popContext,t._peekContext=t.prototype._peekContext=r,t.prototype._promiseCreated=function(){var t=this._peekContext();t&&null==t._promiseCreated&&(t._promiseCreated=this)}},e}},{}],9:[function(e,n,o){"use strict";n.exports=function(n,o){function i(t,e,n){var r=this;try{t(e,n,function(t){if("function"!=typeof t)throw new TypeError("onCancel must be a function, got: "+D.toString(t));r._attachCancellationCallback(t)})}catch(o){return o}}function s(t){if(!this.isCancellable())return this;var e=this._onCancel();void 0!==e?D.isArray(e)?e.push(t):this._setOnCancel([e,t]):this._setOnCancel(t)}function a(){return this._onCancelField}function u(t){this._onCancelField=t}function c(){this._cancellationParent=void 0,this._onCancelField=void 0}function l(t,e){if(0!==(1&e)){this._cancellationParent=t;var n=t._branchesRemainingToCancel;void 0===n&&(n=0),t._branchesRemainingToCancel=n+1}0!==(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)}function f(t,e){0!==(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)}function p(){var t=this._boundTo;return void 0!==t&&t instanceof n?t.isFulfilled()?t.value():void 0:t}function h(){this._trace=new F(this._peekContext())}function d(t,e){if(L(t)){var n=this._trace;if(void 0!==n&&e&&(n=n._parent),void 0!==n)n.attachExtraTrace(t);else if(!t.__stackCleaned__){var r=w(t);D.notEnumerableProp(t,"stack",r.message+"\n"+r.stack.join("\n")),D.notEnumerableProp(t,"__stackCleaned__",!0)}}}function v(t,e,n,r,o){if(void 0===t&&null!==e&&W){if(void 0!==o&&o._returnedNonUndefined())return;n&&(n+=" ");var i="a promise was created in a "+n+"handler but was not returned from it";r._warn(i,!0,e)}}function y(t,e){var n=t+" is deprecated and will be removed in a future version.";return e&&(n+=" Use "+e+" instead."),g(n)}function g(t,e,r){if(et.warnings){var o,i=new N(t);if(e)r._attachExtraTrace(i);else if(et.longStackTraces&&(o=n._peekContext()))o.attachExtraTrace(i);else{var s=w(i);i.stack=s.message+"\n"+s.stack.join("\n")}x(i,"",!0)}}function m(t,e){for(var n=0;n<e.length-1;++n)e[n].push("From previous event:"),e[n]=e[n].join("\n");return n<e.length&&(e[n]=e[n].join("\n")),t+"\n"+e.join("\n")}function _(t){for(var e=0;e<t.length;++e)(0===t[e].length||e+1<t.length&&t[e][0]===t[e+1][0])&&(t.splice(e,1),e--)}function b(t){for(var e=t[0],n=1;n<t.length;++n){for(var r=t[n],o=e.length-1,i=e[o],s=-1,a=r.length-1;a>=0;--a)if(r[a]===i){s=a;break}for(var a=s;a>=0;--a){var u=r[a];if(e[o]!==u)break;e.pop(),o--}e=r}}function $(t){for(var e=[],n=0;n<t.length;++n){var r=t[n],o=" (No stack trace)"===r||V.test(r),i=o&&X(r);o&&!i&&(H&&" "!==r.charAt(0)&&(r=" "+r),e.push(r))}return e}function j(t){for(var e=t.stack.replace(/\s+$/g,"").split("\n"),n=0;n<e.length;++n){var r=e[n];if(" (No stack trace)"===r||V.test(r))break}return n>0&&(e=e.slice(n)),e}function w(t){var e=t.stack,n=t.toString();return e="string"==typeof e&&e.length>0?j(t):[" (No stack trace)"],{message:n,stack:$(e)}}function x(t,e,n){if("undefined"!=typeof console){var r;if(D.isObject(t)){var o=t.stack;r=e+B(o,t)}else r=e+String(t);"function"==typeof R?R(r,n):("function"==typeof console.log||"object"==typeof console.log)&&console.log(r)}}function k(t,e,n,r){var o=!1;try{"function"==typeof e&&(o=!0,"rejectionHandled"===t?e(r):e(n,r))}catch(i){I.throwLater(i)}var s=!1;try{s=tt(t,n,r)}catch(i){s=!0,I.throwLater(i)}var a=!1;if(Y)try{a=Y(t.toLowerCase(),{reason:n,promise:r})}catch(i){a=!0,I.throwLater(i)}s||o||a||"unhandledRejection"!==t||x(n,"Unhandled rejection ")}function S(t){var e;if("function"==typeof t)e="[function "+(t.name||"anonymous")+"]";else{e=t&&"function"==typeof t.toString?t.toString():D.toString(t);var n=/\[object [a-zA-Z0-9$_]+\]/;if(n.test(e))try{var r=JSON.stringify(t);e=r}catch(o){}0===e.length&&(e="(empty array)")}return"(<"+O(e)+">, no stack trace)"}function O(t){var e=41;return t.length<e?t:t.substr(0,e-3)+"..."}function E(){return"function"==typeof Z}function A(t){var e=t.match(J);return e?{fileName:e[1],line:parseInt(e[2],10)}:void 0}function C(t,e){if(E()){for(var n,r,o=t.stack.split("\n"),i=e.stack.split("\n"),s=-1,a=-1,u=0;u<o.length;++u){var c=A(o[u]);if(c){n=c.fileName,s=c.line;break}}for(var u=0;u<i.length;++u){var c=A(i[u]);if(c){r=c.fileName,a=c.line;break}}0>s||0>a||!n||!r||n!==r||s>=a||(X=function(t){if(U.test(t))return!0;var e=A(t);return e&&e.fileName===n&&s<=e.line&&e.line<=a?!0:!1})}}function F(t){this._parent=t,this._promisesCreated=0;var e=this._length=1+(void 0===t?0:t._length);Z(this,F),e>32&&this.uncycle()}var P,T,R,M=n._getDomain,I=n._async,N=e("./errors").Warning,D=e("./util"),L=D.canAttachTrace,U=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/,V=null,B=null,H=!1,q=!(0==D.env("BLUEBIRD_DEBUG")),z=!(0==D.env("BLUEBIRD_WARNINGS")||!q&&!D.env("BLUEBIRD_WARNINGS")),G=!(0==D.env("BLUEBIRD_LONG_STACK_TRACES")||!q&&!D.env("BLUEBIRD_LONG_STACK_TRACES")),W=0!=D.env("BLUEBIRD_W_FORGOTTEN_RETURN")&&(z||!!D.env("BLUEBIRD_W_FORGOTTEN_RETURN"));n.prototype.suppressUnhandledRejections=function(){var t=this._target();t._bitField=-1048577&t._bitField|524288},n.prototype._ensurePossibleRejectionHandled=function(){0===(524288&this._bitField)&&(this._setRejectionIsUnhandled(),I.invokeLater(this._notifyUnhandledRejection,this,void 0))},n.prototype._notifyUnhandledRejectionIsHandled=function(){k("rejectionHandled",P,void 0,this)},n.prototype._setReturnedNonUndefined=function(){this._bitField=268435456|this._bitField},n.prototype._returnedNonUndefined=function(){return 0!==(268435456&this._bitField)},n.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var t=this._settledValue();this._setUnhandledRejectionIsNotified(),k("unhandledRejection",T,t,this)}},n.prototype._setUnhandledRejectionIsNotified=function(){this._bitField=262144|this._bitField},n.prototype._unsetUnhandledRejectionIsNotified=function(){this._bitField=-262145&this._bitField},n.prototype._isUnhandledRejectionNotified=function(){return(262144&this._bitField)>0},n.prototype._setRejectionIsUnhandled=function(){this._bitField=1048576|this._bitField},n.prototype._unsetRejectionIsUnhandled=function(){this._bitField=-1048577&this._bitField,this._isUnhandledRejectionNotified()&&(this._unsetUnhandledRejectionIsNotified(),this._notifyUnhandledRejectionIsHandled())},n.prototype._isRejectionUnhandled=function(){return(1048576&this._bitField)>0},n.prototype._warn=function(t,e,n){return g(t,e,n||this)},n.onPossiblyUnhandledRejection=function(t){var e=M();T="function"==typeof t?null===e?t:e.bind(t):void 0},n.onUnhandledRejectionHandled=function(t){var e=M();P="function"==typeof t?null===e?t:e.bind(t):void 0};var Q=function(){};n.longStackTraces=function(){if(I.haveItemsQueued()&&!et.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");if(!et.longStackTraces&&E()){var t=n.prototype._captureStackTrace,e=n.prototype._attachExtraTrace;et.longStackTraces=!0,Q=function(){if(I.haveItemsQueued()&&!et.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");n.prototype._captureStackTrace=t,n.prototype._attachExtraTrace=e,o.deactivateLongStackTraces(),I.enableTrampoline(),et.longStackTraces=!1},n.prototype._captureStackTrace=h,n.prototype._attachExtraTrace=d,o.activateLongStackTraces(),I.disableTrampolineIfNecessary()}},n.hasLongStackTraces=function(){return et.longStackTraces&&E()},n.config=function(t){if(t=Object(t),"longStackTraces"in t&&(t.longStackTraces?n.longStackTraces():!t.longStackTraces&&n.hasLongStackTraces()&&Q()),"warnings"in t){var e=t.warnings;et.warnings=!!e,W=et.warnings,D.isObject(e)&&"wForgottenReturn"in e&&(W=!!e.wForgottenReturn)}if("cancellation"in t&&t.cancellation&&!et.cancellation){if(I.haveItemsQueued())throw new Error("cannot enable cancellation after promises are in use");n.prototype._clearCancellationData=c,n.prototype._propagateFrom=l,n.prototype._onCancel=a,n.prototype._setOnCancel=u,n.prototype._attachCancellationCallback=s,n.prototype._execute=i,K=l,et.cancellation=!0}},n.prototype._execute=function(t,e,n){try{t(e,n)}catch(r){return r}},n.prototype._onCancel=function(){},n.prototype._setOnCancel=function(t){},n.prototype._attachCancellationCallback=function(t){},n.prototype._captureStackTrace=function(){},n.prototype._attachExtraTrace=function(){},n.prototype._clearCancellationData=function(){},n.prototype._propagateFrom=function(t,e){};var K=f,X=function(){return!1},J=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;D.inherits(F,Error),o.CapturedTrace=F,F.prototype.uncycle=function(){var t=this._length;if(!(2>t)){for(var e=[],n={},r=0,o=this;void 0!==o;++r)e.push(o),o=o._parent;t=this._length=r;for(var r=t-1;r>=0;--r){var i=e[r].stack;void 0===n[i]&&(n[i]=r)}for(var r=0;t>r;++r){var s=e[r].stack,a=n[s];if(void 0!==a&&a!==r){a>0&&(e[a-1]._parent=void 0,e[a-1]._length=1),e[r]._parent=void 0,e[r]._length=1;var u=r>0?e[r-1]:this;t-1>a?(u._parent=e[a+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)e[l]._length=c,c++;return}}}},F.prototype.attachExtraTrace=function(t){if(!t.__stackCleaned__){this.uncycle();for(var e=w(t),n=e.message,r=[e.stack],o=this;void 0!==o;)r.push($(o.stack.split("\n"))),o=o._parent;b(r),_(r),D.notEnumerableProp(t,"stack",m(n,r)),D.notEnumerableProp(t,"__stackCleaned__",!0)}};var Y,Z=function(){var t=/^\s*at\s*/,e=function(t,e){return"string"==typeof t?t:void 0!==e.name&&void 0!==e.message?e.toString():S(e)};if("number"==typeof Error.stackTraceLimit&&"function"==typeof Error.captureStackTrace){Error.stackTraceLimit+=6,V=t,B=e;var n=Error.captureStackTrace;return X=function(t){return U.test(t)},function(t,e){Error.stackTraceLimit+=6,n(t,e),Error.stackTraceLimit-=6}}var r=new Error;if("string"==typeof r.stack&&r.stack.split("\n")[0].indexOf("stackDetection@")>=0)return V=/@/,B=e,H=!0,function(t){t.stack=(new Error).stack};var o;try{throw new Error}catch(i){o="stack"in i}return"stack"in r||!o||"number"!=typeof Error.stackTraceLimit?(B=function(t,e){return"string"==typeof t?t:"object"!=typeof e&&"function"!=typeof e||void 0===e.name||void 0===e.message?S(e):e.toString()},null):(V=t,B=e,function(t){Error.stackTraceLimit+=6;try{throw new Error}catch(e){t.stack=e.stack}Error.stackTraceLimit-=6})}([]),tt=function(){if(D.isNode)return function(e,n,r){return"rejectionHandled"===e?t.emit(e,r):t.emit(e,n,r)};var e="undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof r?r:void 0!==this?this:null;if(!e)return function(){return!1};try{var n=document.createEvent("CustomEvent");n.initCustomEvent("testingtheevent",!1,!0,{}),e.dispatchEvent(n),Y=function(t,n){var r=document.createEvent("CustomEvent");return r.initCustomEvent(t,!1,!0,n),!e.dispatchEvent(r)}}catch(o){}var i={};return i.unhandledRejection="onunhandledRejection".toLowerCase(),i.rejectionHandled="onrejectionHandled".toLowerCase(),function(t,n,r){var o=i[t],s=e[o];return s?("rejectionHandled"===t?s.call(e,r):s.call(e,n,r),!0):!1}}();"undefined"!=typeof console&&"undefined"!=typeof console.warn&&(R=function(t){console.warn(t)},D.isNode&&t.stderr.isTTY?R=function(t,e){var n=e?"[33m":"[31m";console.warn(n+t+"[0m\n")}:D.isNode||"string"!=typeof(new Error).stack||(R=function(t,e){console.warn("%c"+t,e?"color: darkorange":"color: red")}));var et={warnings:z,longStackTraces:!1,cancellation:!1};return G&&n.longStackTraces(),{longStackTraces:function(){return et.longStackTraces},warnings:function(){return et.warnings},cancellation:function(){return et.cancellation},propagateFromFunction:function(){return K},boundValueFunction:function(){return p},checkForgottenReturns:v,setBounds:C,warn:g,deprecated:y,CapturedTrace:F}}},{"./errors":12,"./util":36}],10:[function(t,e,n){"use strict";e.exports=function(t){function e(){return this.value}function n(){throw this.reason}t.prototype["return"]=t.prototype.thenReturn=function(n){return n instanceof t&&n.suppressUnhandledRejections(),this._then(e,void 0,void 0,{value:n},void 0)},t.prototype["throw"]=t.prototype.thenThrow=function(t){return this._then(n,void 0,void 0,{reason:t},void 0)},t.prototype.catchThrow=function(t){if(arguments.length<=1)return this._then(void 0,n,void 0,{reason:t},void 0);var e=arguments[1],r=function(){throw e};return this.caught(t,r)},t.prototype.catchReturn=function(n){if(arguments.length<=1)return n instanceof t&&n.suppressUnhandledRejections(),this._then(void 0,e,void 0,{value:n},void 0);var r=arguments[1];r instanceof t&&r.suppressUnhandledRejections();var o=function(){return r};return this.caught(n,o)}}},{}],11:[function(t,e,n){"use strict";e.exports=function(t,e){function n(){return i(this)}function r(t,n){return o(t,n,e,e)}var o=t.reduce,i=t.all;t.prototype.each=function(t){return this.mapSeries(t)._then(n,void 0,void 0,this,void 0)},t.prototype.mapSeries=function(t){return o(this,t,e,e)},t.each=function(t,e){return r(t,e)._then(n,void 0,void 0,t,void 0)},t.mapSeries=r}},{}],12:[function(t,e,n){"use strict";function r(t,e){function n(r){return this instanceof n?(f(this,"message","string"==typeof r?r:e),f(this,"name",t),void(Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):Error.call(this))):new n(r)}return l(n,Error),n}function o(t){return this instanceof o?(f(this,"name","OperationalError"),f(this,"message",t),this.cause=t,this.isOperational=!0,void(t instanceof Error?(f(this,"message",t.message),f(this,"stack",t.stack)):Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor))):new o(t)}var i,s,a=t("./es5"),u=a.freeze,c=t("./util"),l=c.inherits,f=c.notEnumerableProp,p=r("Warning","warning"),h=r("CancellationError","cancellation error"),d=r("TimeoutError","timeout error"),v=r("AggregateError","aggregate error");try{i=TypeError,s=RangeError}catch(y){i=r("TypeError","type error"),s=r("RangeError","range error")}for(var g="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),m=0;m<g.length;++m)"function"==typeof Array.prototype[g[m]]&&(v.prototype[g[m]]=Array.prototype[g[m]]);a.defineProperty(v.prototype,"length",{value:0,configurable:!1,writable:!0,enumerable:!0}),v.prototype.isOperational=!0;var _=0;v.prototype.toString=function(){var t=Array(4*_+1).join(" "),e="\n"+t+"AggregateError of:\n";_++,t=Array(4*_+1).join(" ");for(var n=0;n<this.length;++n){for(var r=this[n]===this?"[Circular AggregateError]":this[n]+"",o=r.split("\n"),i=0;i<o.length;++i)o[i]=t+o[i];r=o.join("\n"),e+=r+"\n"}return _--,e},l(o,Error);var b=Error.__BluebirdErrorTypes__;b||(b=u({CancellationError:h,TimeoutError:d,OperationalError:o,RejectionError:o,AggregateError:v}),f(Error,"__BluebirdErrorTypes__",b)),e.exports={Error:Error,TypeError:i,RangeError:s,CancellationError:b.CancellationError,OperationalError:b.OperationalError,TimeoutError:b.TimeoutError,AggregateError:b.AggregateError,Warning:p}},{"./es5":13,"./util":36}],13:[function(t,e,n){var r=function(){"use strict";return void 0===this}();if(r)e.exports={freeze:Object.freeze,defineProperty:Object.defineProperty,getDescriptor:Object.getOwnPropertyDescriptor,keys:Object.keys,names:Object.getOwnPropertyNames,getPrototypeOf:Object.getPrototypeOf,isArray:Array.isArray,isES5:r,propertyIsWritable:function(t,e){var n=Object.getOwnPropertyDescriptor(t,e);return!(n&&!n.writable&&!n.set)}};else{var o={}.hasOwnProperty,i={}.toString,s={}.constructor.prototype,a=function(t){var e=[];for(var n in t)o.call(t,n)&&e.push(n);return e},u=function(t,e){return{value:t[e]}},c=function(t,e,n){return t[e]=n.value,t},l=function(t){return t},f=function(t){try{return Object(t).constructor.prototype}catch(e){return s}},p=function(t){try{return"[object Array]"===i.call(t)}catch(e){return!1}};e.exports={isArray:p,keys:a,names:a,defineProperty:c,getDescriptor:u,freeze:l,getPrototypeOf:f,isES5:r,propertyIsWritable:function(){return!0}}}},{}],14:[function(t,e,n){"use strict";e.exports=function(t,e){var n=t.map;t.prototype.filter=function(t,r){return n(this,t,r,e)},t.filter=function(t,r,o){return n(t,r,o,e)}}},{}],15:[function(t,e,n){"use strict";e.exports=function(e,n){function r(t){this.finallyHandler=t}function o(t,e){return null!=t.cancelPromise?(arguments.length>1?t.cancelPromise._reject(e):t.cancelPromise._cancel(),t.cancelPromise=null,!0):!1}function i(){return a.call(this,this.promise._target()._settledValue())}function s(t){return o(this,t)?void 0:(l.e=t,l)}function a(t){var a=this.promise,u=this.handler;if(!this.called){this.called=!0;var f=0===this.type?u.call(a._boundValue()):u.call(a._boundValue(),t);if(void 0!==f){a._setReturnedNonUndefined();var p=n(f,a);if(p instanceof e){if(null!=this.cancelPromise){if(p.isCancelled()){var h=new c("late cancellation observer");return a._attachExtraTrace(h),l.e=h,l}p.isPending()&&p._attachCancellationCallback(new r(this))}return p._then(i,s,void 0,this,void 0)}}}return a.isRejected()?(o(this),l.e=t,l):(o(this),t)}var u=t("./util"),c=e.CancellationError,l=u.errorObj;return r.prototype._resultCancelled=function(){o(this.finallyHandler)},e.prototype._passThrough=function(t,e,n,r){return"function"!=typeof t?this.then():this._then(n,r,void 0,{promise:this,handler:t,called:!1,cancelPromise:null,type:e},void 0)},e.prototype.lastly=e.prototype["finally"]=function(t){return this._passThrough(t,0,a,a)},e.prototype.tap=function(t){return this._passThrough(t,1,a)},a}},{"./util":36}],16:[function(t,e,n){"use strict";e.exports=function(e,n,r,o,i,s){function a(t,n,r){for(var i=0;i<n.length;++i){r._pushContext();var s=h(n[i])(t);if(r._popContext(),s===p){r._pushContext();var a=e.reject(p.e);return r._popContext(),a}var u=o(s,r);if(u instanceof e)return u}return null}function u(t,n,o,i){var s=this._promise=new e(r);s._captureStackTrace(),s._setOnCancel(this),this._stack=i,this._generatorFunction=t,this._receiver=n,this._generator=void 0,this._yieldHandlers="function"==typeof o?[o].concat(d):d,this._yield