+ PromiseInspection.prototype._settledValue = function() {
+ return this._settledValueField;
+ };
+ var value = PromiseInspection.prototype.value = function() {
+ if (!this.isFulfilled()) {
+ throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\n\n See http://goo.gl/MqrFmX\n");
+ }
+ return this._settledValue();
+ };
+ var reason = PromiseInspection.prototype.error = PromiseInspection.prototype.reason = function() {
+ if (!this.isRejected()) {
+ throw new TypeError("cannot get rejection reason of a non-rejected promise\n\n See http://goo.gl/MqrFmX\n");
+ }
+ return this._settledValue();
+ };
+ var isFulfilled = PromiseInspection.prototype.isFulfilled = function() {
+ return (this._bitField & 33554432) !== 0;
+ };
+ var isRejected = PromiseInspection.prototype.isRejected = function() {
+ return (this._bitField & 16777216) !== 0;
+ };
+ var isPending = PromiseInspection.prototype.isPending = function() {
+ return (this._bitField & 50397184) === 0;
+ };
+ var isResolved = PromiseInspection.prototype.isResolved = function() {
+ return (this._bitField & 50331648) !== 0;
+ };
+ PromiseInspection.prototype.isCancelled = function() {
+ return (this._bitField & 8454144) !== 0;
+ };
+ Promise2.prototype.__isCancelled = function() {
+ return (this._bitField & 65536) === 65536;
+ };
+ Promise2.prototype._isCancelled = function() {
+ return this._target().__isCancelled();
+ };
+ Promise2.prototype.isCancelled = function() {
+ return (this._target()._bitField & 8454144) !== 0;
+ };
+ Promise2.prototype.isPending = function() {
+ return isPending.call(this._target());
+ };
+ Promise2.prototype.isRejected = function() {
+ return isRejected.call(this._target());
+ };
+ Promise2.prototype.isFulfilled = function() {
+ return isFulfilled.call(this._target());
+ };
+ Promise2.prototype.isResolved = function() {
+ return isResolved.call(this._target());
+ };
+ Promise2.prototype.value = function() {
+ return value.call(this._target());
+ };
+ Promise2.prototype.reason = function() {
+ var target = this._target();
+ target._unsetRejectionIsUnhandled();
+ return reason.call(target);
+ };
+ Promise2.prototype._value = function() {
+ return this._settledValue();
+ };
+ Promise2.prototype._reason = function() {
+ this._unsetRejectionIsUnhandled();
+ return this._settledValue();
+ };
+ Promise2.PromiseInspection = PromiseInspection;
+ };
+ }
+});
+
+// node_modules/bluebird/js/release/join.js
+var require_join = __commonJS({
+ "node_modules/bluebird/js/release/join.js"(exports2, module2) {
+ "use strict";
+ module2.exports = function(Promise2, PromiseArray, tryConvertToPromise, INTERNAL2, async, getDomain) {
+ var util = require_util();
+ var canEvaluate2 = util.canEvaluate;
+ var tryCatch2 = util.tryCatch;
+ var errorObj2 = util.errorObj;
+ var reject;
+ if (true) {
+ if (canEvaluate2) {
+ var thenCallback = function(i2) {
+ return new Function("value", "holder", " \n 'use strict'; \n holder.pIndex = value; \n holder.checkFulfillment(this); \n ".replace(/Index/g, i2));
+ };
+ var promiseSetter = function(i2) {
+ return new Function("promise", "holder", " \n 'use strict'; \n holder.pIndex = promise; \n ".replace(/Index/g, i2));
+ };
+ var generateHolderClass = function(total) {
+ var props = new Array(total);
+ for (var i2 = 0; i2 < props.length; ++i2) {
+ props[i2] = "this.p" + (i2 + 1);
+ }
+ var assignment = props.join(" = ") + " = null;";
+ var cancellationCode = "var promise;\n" + props.map(function(prop) {
+ return " \n promise = " + prop + "; \n if (promise instanceof Promise) { \n promise.cancel(); \n } \n ";
+ }).join("\n");
+ var passedArguments = props.join(", ");
+ var name = "Holder$" + total;
+ var code = "return function(tryCatch, errorObj, Promise, async) { \n 'use strict'; \n function [TheName](fn) { \n [TheProperties] \n this.fn = fn; \n this.asyncNeeded = true; \n this.now = 0; \n } \n \n [TheName].prototype._callFunction = function(promise) { \n promise._pushContext(); \n var ret = tryCatch(this.fn)([ThePassedArguments]); \n promise._popContext(); \n if (ret === errorObj) { \n promise._rejectCallback(ret.e, false); \n } else { \n promise._resolveCallback(ret); \n } \n }; \n \n [TheName].prototype.checkFulfillment = function(promise) { \n var now = ++this.now; \n if (now === [TheTotal]) { \n if (this.asyncNeeded) { \n async.invoke(this._callFunction, this, promise); \n } else { \n this._callFunction(promise); \n } \n \n } \n }; \n \n [TheName].prototype._resultCancelled = function() { \n [CancellationCode] \n }; \n \n return [TheName]; \n }(tryCatch, errorObj, Promise, async); \n ";
+ code = code.replace(/\[TheName\]/g, name).replace(/\[TheTotal\]/g, total).replace(/\[ThePassedArguments\]/g, passedArguments).replace(/\[TheProperties\]/g, assignment).replace(/\[CancellationCode\]/g, cancellationCode);
+ return new Function("tryCatch", "errorObj", "Promise", "async", code)(tryCatch2, errorObj2, Promise2, async);
+ };
+ var holderClasses = [];
+ var thenCallbacks = [];
+ var promiseSetters = [];
+ for (var i = 0; i < 8; ++i) {
+ holderClasses.push(generateHolderClass(i + 1));
+ thenCallbacks.push(thenCallback(i + 1));
+ promiseSetters.push(promiseSetter(i + 1));
+ }
+ reject = function(reason) {
+ this._reject(reason);
+ };
+ }
+ }
+ Promise2.join = function() {
+ var last = arguments.length - 1;
+ var fn;
+ if (last > 0 && typeof arguments[last] === "function") {
+ fn = arguments[last];
+ if (true) {
+ if (last <= 8 && canEvaluate2) {
+ var ret2 = new Promise2(INTERNAL2);
+ ret2._captureStackTrace();
+ var HolderClass = holderClasses[last - 1];
+ var holder = new HolderClass(fn);
+ var callbacks = thenCallbacks;
+ for (var i2 = 0; i2 < last; ++i2) {
+ var maybePromise = tryConvertToPromise(arguments[i2], ret2);
+ if (maybePromise instanceof Promise2) {
+ maybePromise = maybePromise._target();
+ var bitField = maybePromise._bitField;
+ ;
+ if ((bitField & 50397184) === 0) {
+ maybePromise._then(callbacks[i2], reject, void 0, ret2, holder);
+ promiseSetters[i2](maybePromise, holder);
+ holder.asyncNeeded = false;
+ } else if ((bitField & 33554432) !== 0) {
+ callbacks[i2].call(ret2, maybePromise._value(), holder);
+ } else if ((bitField & 16777216) !== 0) {
+ ret2._reject(maybePromise._reason());
+ } else {
+ ret2._cancel();
+ }
+ } else {
+ callbacks[i2].call(ret2, maybePromise, holder);
+ }
+ }
+ if (!ret2._isFateSealed()) {
+ if (holder.asyncNeeded) {
+ var domain = getDomain();
+ if (domain !== null) {
+ holder.fn = util.domainBind(domain, holder.fn);
+ }
+ }
+ ret2._setAsyncGuaranteed();
+ ret2._setOnCancel(holder);
+ }
+ return ret2;
+ }
+ }
+ }
+ var $_len = arguments.length;
+ var args = new Array($_len);
+ for (var $_i = 0; $_i < $_len; ++$_i) {
+ args[$_i] = arguments[$_i];
+ }
+ ;
+ if (fn)
+ args.pop();
+ var ret2 = new PromiseArray(args).promise();
+ return fn !== void 0 ? ret2.spread(fn) : ret2;
+ };
+ };
+ }
+});
+
+// node_modules/bluebird/js/release/map.js
+var require_map = __commonJS({
+ "node_modules/bluebird/js/release/map.js"(exports2, module2) {
+ "use strict";
+ module2.exports = function(Promise2, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL2, debug) {
+ var getDomain = Promise2._getDomain;
+ var util = require_util();
+ var tryCatch2 = util.tryCatch;
+ var errorObj2 = util.errorObj;
+ var async = Promise2._async;
+ function MappingPromiseArray(promises, fn, limit, _filter) {
+ this.constructor$(promises);
+ this._promise._captureStackTrace();
+ var domain = getDomain();
+ this._callback = domain === null ? fn : util.domainBind(domain, fn);
+ this._preservedValues = _filter === INTERNAL2 ? new Array(this.length()) : null;
+ this._limit = limit;
+ this._inFlight = 0;
+ this._queue = [];
+ async.invoke(this._asyncInit, this, void 0);
+ }
+ util.inherits(MappingPromiseArray, PromiseArray);
+ MappingPromiseArray.prototype._asyncInit = function() {
+ this._init$(void 0, -2);
+ };
+ MappingPromiseArray.prototype._init = function() {
+ };
+ MappingPromiseArray.prototype._promiseFulfilled = function(value, index) {
+ var values = this._values;
+ var length = this.length();
+ var preservedValues = this._preservedValues;
+ var limit = this._limit;
+ if (index < 0) {
+ index = index * -1 - 1;
+ values[index] = value;
+ if (limit >= 1) {
+ this._inFlight--;
+ this._drainQueue();
+ if (this._isResolved())
+ return true;
+ }
+ } else {
+ if (limit >= 1 && this._inFlight >= limit) {
+ values[index] = value;
+ this._queue.push(index);
+ return false;
+ }
+ if (preservedValues !== null)
+ preservedValues[index] = value;
+ var promise = this._promise;
+ var callback = this._callback;
+ var receiver = promise._boundValue();
+ promise._pushContext();
+ var ret2 = tryCatch2(callback).call(receiver, value, index, length);
+ var promiseCreated = promise._popContext();
+ debug.checkForgottenReturns(ret2, promiseCreated, preservedValues !== null ? "Promise.filter" : "Promise.map", promise);
+ if (ret2 === errorObj2) {
+ this._reject(ret2.e);
+ return true;
+ }
+ var maybePromise = tryConvertToPromise(ret2, this._promise);
+ if (maybePromise instanceof Promise2) {
+ maybePromise = maybePromise._target();
+ var bitField = maybePromise._bitField;
+ ;
+ if ((bitField & 50397184) === 0) {
+ if (limit >= 1)
+ this._inFlight++;
+ values[index] = maybePromise;
+ maybePromise._proxy(this, (index + 1) * -1);
+ return false;
+ } else if ((bitField & 33554432) !== 0) {
+ ret2 = maybePromise._value();
+ } else if ((bitField & 16777216) !== 0) {
+ this._reject(maybePromise._reason());
+ return true;
+ } else {
+ this._cancel();
+ return true;
+ }
+ }
+ values[index] = ret2;
+ }
+ var totalResolved = ++this._totalResolved;
+ if (totalResolved >= length) {
+ if (preservedValues !== null) {
+ this._filter(values, preservedValues);
+ } else {
+ this._resolve(values);
+ }
+ return true;
+ }
+ return false;
+ };
+ MappingPromiseArray.prototype._drainQueue = function() {
+ var queue = this._queue;
+ var limit = this._limit;
+ var values = this._values;
+ while (queue.length > 0 && this._inFlight < limit) {
+ if (this._isResolved())
+ return;
+ var index = queue.pop();
+ this._promiseFulfilled(values[index], index);
+ }
+ };
+ MappingPromiseArray.prototype._filter = function(booleans, values) {
+ var len = values.length;
+ var ret2 = new Array(len);
+ var j = 0;
+ for (var i = 0; i < len; ++i) {
+ if (booleans[i])
+ ret2[j++] = values[i];
+ }
+ ret2.length = j;
+ this._resolve(ret2);
+ };
+ MappingPromiseArray.prototype.preservedValues = function() {
+ return this._preservedValues;
+ };
+ function map(promises, fn, options, _filter) {
+ if (typeof fn !== "function") {
+ return apiRejection("expecting a function but got " + util.classString(fn));
+ }
+ var limit = 0;
+ if (options !== void 0) {
+ if (typeof options === "object" && options !== null) {
+ if (typeof options.concurrency !== "number") {
+ return Promise2.reject(new TypeError("'concurrency' must be a number but it is " + util.classString(options.concurrency)));
+ }
+ limit = options.concurrency;
+ } else {
+ return Promise2.reject(new TypeError("options argument must be an object but it is " + util.classString(options)));
+ }
+ }
+ limit = typeof limit === "number" && isFinite(limit) && limit >= 1 ? limit : 0;
+ return new MappingPromiseArray(promises, fn, limit, _filter).promise();
+ }
+ Promise2.prototype.map = function(fn, options) {
+ return map(this, fn, options, null);
+ };
+ Promise2.map = function(promises, fn, options, _filter) {
+ return map(promises, fn, options, _filter);
+ };
+ };
+ }
+});
+
+// node_modules/bluebird/js/release/call_get.js
+var require_call_get = __commonJS({
+ "node_modules/bluebird/js/release/call_get.js"(exports2, module2) {
+ "use strict";
+ var cr = Object.create;
+ if (cr) {
+ callerCache = cr(null);
+ getterCache = cr(null);
+ callerCache[" size"] = getterCache[" size"] = 0;
+ }
+ var callerCache;
+ var getterCache;
+ module2.exports = function(Promise2) {
+ var util = require_util();
+ var canEvaluate2 = util.canEvaluate;
+ var isIdentifier2 = util.isIdentifier;
+ var getMethodCaller;
+ var getGetter;
+ if (true) {
+ var makeMethodCaller = function(methodName) {
+ 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, methodName))(ensureMethod);
+ };
+ var makeGetter = function(propertyName) {
+ return new Function("obj", " \n 'use strict'; \n return obj.propertyName; \n ".replace("propertyName", propertyName));
+ };
+ var getCompiled = function(name, compiler, cache) {
+ var ret2 = cache[name];
+ if (typeof ret2 !== "function") {
+ if (!isIdentifier2(name)) {
+ return null;
+ }
+ ret2 = compiler(name);
+ cache[name] = ret2;
+ cache[" size"]++;
+ if (cache[" size"] > 512) {
+ var keys = Object.keys(cache);
+ for (var i = 0; i < 256; ++i)
+ delete cache[keys[i]];
+ cache[" size"] = keys.length - 256;
+ }
+ }
+ return ret2;
+ };
+ getMethodCaller = function(name) {
+ return getCompiled(name, makeMethodCaller, callerCache);
+ };
+ getGetter = function(name) {
+ return getCompiled(name, makeGetter, getterCache);
+ };
+ }
+ function ensureMethod(obj2, methodName) {
+ var fn;
+ if (obj2 != null)
+ fn = obj2[methodName];
+ if (typeof fn !== "function") {
+ var message = "Object " + util.classString(obj2) + " has no method '" + util.toString(methodName) + "'";
+ throw new Promise2.TypeError(message);
+ }
+ return fn;
+ }
+ function caller(obj2) {
+ var methodName = this.pop();
+ var fn = ensureMethod(obj2, methodName);
+ return fn.apply(obj2, this);
+ }
+ Promise2.prototype.call = function(methodName) {
+ var $_len = arguments.length;
+ var args = new Array(Math.max($_len - 1, 0));
+ for (var $_i = 1; $_i < $_len; ++$_i) {
+ args[$_i - 1] = arguments[$_i];
+ }
+ ;
+ if (true) {
+ if (canEvaluate2) {
+ var maybeCaller = getMethodCaller(methodName);
+ if (maybeCaller !== null) {
+ return this._then(maybeCaller, void 0, void 0, args, void 0);
+ }
+ }
+ }
+ args.push(methodName);
+ return this._then(caller, void 0, void 0, args, void 0);
+ };
+ function namedGetter(obj2) {
+ return obj2[this];
+ }
+ function indexedGetter(obj2) {
+ var index = +this;
+ if (index < 0)
+ index = Math.max(0, index + obj2.length);
+ return obj2[index];
+ }
+ Promise2.prototype.get = function(propertyName) {
+ var isIndex = typeof propertyName === "number";
+ var getter;
+ if (!isIndex) {
+ if (canEvaluate2) {
+ var maybeGetter = getGetter(propertyName);
+ getter = maybeGetter !== null ? maybeGetter : namedGetter;
+ } else {
+ getter = namedGetter;
+ }
+ } else {
+ getter = indexedGetter;
+ }
+ return this._then(getter, void 0, void 0, propertyName, void 0);
+ };
+ };
+ }
+});
+
+// node_modules/bluebird/js/release/using.js
+var require_using = __commonJS({
+ "node_modules/bluebird/js/release/using.js"(exports2, module2) {
+ "use strict";
+ module2.exports = function(Promise2, apiRejection, tryConvertToPromise, createContext, INTERNAL2, debug) {
+ var util = require_util();
+ var TypeError2 = require_errors().TypeError;
+ var inherits2 = require_util().inherits;
+ var errorObj2 = util.errorObj;
+ var tryCatch2 = util.tryCatch;
+ var NULL = {};
+ function thrower2(e) {
+ setTimeout(function() {
+ throw e;
+ }, 0);
+ }
+ function castPreservingDisposable(thenable) {
+ var maybePromise = tryConvertToPromise(thenable);
+ if (maybePromise !== thenable && typeof thenable._isDisposable === "function" && typeof thenable._getDisposer === "function" && thenable._isDisposable()) {
+ maybePromise._setDisposable(thenable._getDisposer());
+ }
+ return maybePromise;
+ }
+ function dispose(resources, inspection) {
+ var i = 0;
+ var len = resources.length;
+ var ret2 = new Promise2(INTERNAL2);
+ function iterator() {
+ if (i >= len)
+ return ret2._fulfill();
+ var maybePromise = castPreservingDisposable(resources[i++]);
+ if (maybePromise instanceof Promise2 && maybePromise._isDisposable()) {
+ try {
+ maybePromise = tryConvertToPromise(maybePromise._getDisposer().tryDispose(inspection), resources.promise);
+ } catch (e) {
+ return thrower2(e);
+ }
+ if (maybePromise instanceof Promise2) {
+ return maybePromise._then(iterator, thrower2, null, null, null);
+ }
+ }
+ iterator();
+ }
+ iterator();
+ return ret2;
+ }
+ function Disposer(data, promise, context) {
+ this._data = data;
+ this._promise = promise;
+ this._context = context;
+ }
+ Disposer.prototype.data = function() {
+ return this._data;
+ };
+ Disposer.prototype.promise = function() {
+ return this._promise;
+ };
+ Disposer.prototype.resource = function() {
+ if (this.promise().isFulfilled()) {
+ return this.promise().value();
+ }
+ return NULL;
+ };
+ Disposer.prototype.tryDispose = function(inspection) {
+ var resource = this.resource();
+ var context = this._context;
+ if (context !== void 0)
+ context._pushContext();
+ var ret2 = resource !== NULL ? this.doDispose(resource, inspection) : null;
+ if (context !== void 0)
+ context._popContext();
+ this._promise._unsetDisposable();
+ this._data = null;
+ return ret2;
+ };
+ Disposer.isDisposer = function(d) {
+ return d != null && typeof d.resource === "function" && typeof d.tryDispose === "function";
+ };
+ function FunctionDisposer(fn, promise, context) {
+ this.constructor$(fn, promise, context);
+ }
+ inherits2(FunctionDisposer, Disposer);
+ FunctionDisposer.prototype.doDispose = function(resource, inspection) {
+ var fn = this.data();
+ return fn.call(resource, resource, inspection);
+ };
+ function maybeUnwrapDisposer(value) {
+ if (Disposer.isDisposer(value)) {
+ this.resources[this.index]._setDisposable(value);
+ return value.promise();
+ }
+ return value;
+ }
+ function ResourceList(length) {
+ this.length = length;
+ this.promise = null;
+ this[length - 1] = null;
+ }
+ ResourceList.prototype._resultCancelled = function() {
+ var len = this.length;
+ for (var i = 0; i < len; ++i) {
+ var item = this[i];
+ if (item instanceof Promise2) {
+ item.cancel();
+ }
+ }
+ };
+ Promise2.using = function() {
+ var len = arguments.length;
+ if (len < 2)
+ return apiRejection("you must pass at least 2 arguments to Promise.using");
+ var fn = arguments[len - 1];
+ if (typeof fn !== "function") {
+ return apiRejection("expecting a function but got " + util.classString(fn));
+ }
+ var input;
+ var spreadArgs = true;
+ if (len === 2 && Array.isArray(arguments[0])) {
+ input = arguments[0];
+ len = input.length;
+ spreadArgs = false;
+ } else {
+ input = arguments;
+ len--;
+ }
+ var resources = new ResourceList(len);
+ for (var i = 0; i < len; ++i) {
+ var resource = input[i];
+ if (Disposer.isDisposer(resource)) {
+ var disposer = resource;
+ resource = resource.promise();
+ resource._setDisposable(disposer);
+ } else {
+ var maybePromise = tryConvertToPromise(resource);
+ if (maybePromise instanceof Promise2) {
+ resource = maybePromise._then(maybeUnwrapDisposer, null, null, {
+ resources,
+ index: i
+ }, void 0);
+ }
+ }
+ resources[i] = resource;
+ }
+ var reflectedResources = new Array(resources.length);
+ for (var i = 0; i < reflectedResources.length; ++i) {
+ reflectedResources[i] = Promise2.resolve(resources[i]).reflect();
+ }
+ var resultPromise = Promise2.all(reflectedResources).then(function(inspections) {
+ for (var i2 = 0; i2 < inspections.length; ++i2) {
+ var inspection = inspections[i2];
+ if (inspection.isRejected()) {
+ errorObj2.e = inspection.error();
+ return errorObj2;
+ } else if (!inspection.isFulfilled()) {
+ resultPromise.cancel();
+ return;
+ }
+ inspections[i2] = inspection.value();
+ }
+ promise._pushContext();
+ fn = tryCatch2(fn);
+ var ret2 = spreadArgs ? fn.apply(void 0, inspections) : fn(inspections);
+ var promiseCreated = promise._popContext();
+ debug.checkForgottenReturns(ret2, promiseCreated, "Promise.using", promise);
+ return ret2;
+ });
+ var promise = resultPromise.lastly(function() {
+ var inspection = new Promise2.PromiseInspection(resultPromise);
+ return dispose(resources, inspection);
+ });
+ resources.promise = promise;
+ promise._setOnCancel(resources);
+ return promise;
+ };
+ Promise2.prototype._setDisposable = function(disposer) {
+ this._bitField = this._bitField | 131072;
+ this._disposer = disposer;
+ };
+ Promise2.prototype._isDisposable = function() {
+ return (this._bitField & 131072) > 0;
+ };
+ Promise2.prototype._getDisposer = function() {
+ return this._disposer;
+ };
+ Promise2.prototype._unsetDisposable = function() {
+ this._bitField = this._bitField & ~131072;
+ this._disposer = void 0;
+ };
+ Promise2.prototype.disposer = function(fn) {
+ if (typeof fn === "function") {
+ return new FunctionDisposer(fn, this, createContext());
+ }
+ throw new TypeError2();
+ };
+ };
+ }
+});
+
+// node_modules/bluebird/js/release/timers.js
+var require_timers = __commonJS({
+ "node_modules/bluebird/js/release/timers.js"(exports2, module2) {
+ "use strict";
+ module2.exports = function(Promise2, INTERNAL2, debug) {
+ var util = require_util();
+ var TimeoutError = Promise2.TimeoutError;
+ function HandleWrapper(handle) {
+ this.handle = handle;
+ }
+ HandleWrapper.prototype._resultCancelled = function() {
+ clearTimeout(this.handle);
+ };
+ var afterValue = function(value) {
+ return delay(+this).thenReturn(value);
+ };
+ var delay = Promise2.delay = function(ms, value) {
+ var ret2;
+ var handle;
+ if (value !== void 0) {
+ ret2 = Promise2.resolve(value)._then(afterValue, null, null, ms, void 0);
+ if (debug.cancellation() && value instanceof Promise2) {
+ ret2._setOnCancel(value);
+ }
+ } else {
+ ret2 = new Promise2(INTERNAL2);
+ handle = setTimeout(function() {
+ ret2._fulfill();
+ }, +ms);
+ if (debug.cancellation()) {
+ ret2._setOnCancel(new HandleWrapper(handle));
+ }
+ ret2._captureStackTrace();
+ }
+ ret2._setAsyncGuaranteed();
+ return ret2;
+ };
+ Promise2.prototype.delay = function(ms) {
+ return delay(ms, this);
+ };
+ var afterTimeout = function(promise, message, parent) {
+ var err;
+ if (typeof message !== "string") {
+ if (message instanceof Error) {
+ err = message;
+ } else {
+ err = new TimeoutError("operation timed out");
+ }
+ } else {
+ err = new TimeoutError(message);
+ }
+ util.markAsOriginatingFromRejection(err);
+ promise._attachExtraTrace(err);
+ promise._reject(err);
+ if (parent != null) {
+ parent.cancel();
+ }
+ };
+ function successClear(value) {
+ clearTimeout(this.handle);
+ return value;
+ }
+ function failureClear(reason) {
+ clearTimeout(this.handle);
+ throw reason;
+ }
+ Promise2.prototype.timeout = function(ms, message) {
+ ms = +ms;
+ var ret2, parent;
+ var handleWrapper = new HandleWrapper(setTimeout(function timeoutTimeout() {
+ if (ret2.isPending()) {
+ afterTimeout(ret2, message, parent);
+ }
+ }, ms));
+ if (debug.cancellation()) {
+ parent = this.then();
+ ret2 = parent._then(successClear, failureClear, void 0, handleWrapper, void 0);
+ ret2._setOnCancel(handleWrapper);
+ } else {
+ ret2 = this._then(successClear, failureClear, void 0, handleWrapper, void 0);
+ }
+ return ret2;
+ };
+ };
+ }
+});
+
+// node_modules/bluebird/js/release/generators.js
+var require_generators = __commonJS({
+ "node_modules/bluebird/js/release/generators.js"(exports2, module2) {
+ "use strict";
+ module2.exports = function(Promise2, apiRejection, INTERNAL2, tryConvertToPromise, Proxyable, debug) {
+ var errors = require_errors();
+ var TypeError2 = errors.TypeError;
+ var util = require_util();
+ var errorObj2 = util.errorObj;
+ var tryCatch2 = util.tryCatch;
+ var yieldHandlers = [];
+ function promiseFromYieldHandler(value, yieldHandlers2, traceParent) {
+ for (var i = 0; i < yieldHandlers2.length; ++i) {
+ traceParent._pushContext();
+ var result = tryCatch2(yieldHandlers2[i])(value);
+ traceParent._popContext();
+ if (result === errorObj2) {
+ traceParent._pushContext();
+ var ret2 = Promise2.reject(errorObj2.e);
+ traceParent._popContext();
+ return ret2;
+ }
+ var maybePromise = tryConvertToPromise(result, traceParent);
+ if (maybePromise instanceof Promise2)
+ return maybePromise;
+ }
+ return null;
+ }
+ function PromiseSpawn(generatorFunction, receiver, yieldHandler, stack) {
+ if (debug.cancellation()) {
+ var internal = new Promise2(INTERNAL2);
+ var _finallyPromise = this._finallyPromise = new Promise2(INTERNAL2);
+ this._promise = internal.lastly(function() {
+ return _finallyPromise;
+ });
+ internal._captureStackTrace();
+ internal._setOnCancel(this);
+ } else {
+ var promise = this._promise = new Promise2(INTERNAL2);
+ promise._captureStackTrace();
+ }
+ this._stack = stack;
+ this._generatorFunction = generatorFunction;
+ this._receiver = receiver;
+ this._generator = void 0;
+ this._yieldHandlers = typeof yieldHandler === "function" ? [yieldHandler].concat(yieldHandlers) : yieldHandlers;
+ this._yieldedPromise = null;
+ this._cancellationPhase = false;
+ }
+ util.inherits(PromiseSpawn, Proxyable);
+ PromiseSpawn.prototype._isResolved = function() {
+ return this._promise === null;
+ };
+ PromiseSpawn.prototype._cleanup = function() {
+ this._promise = this._generator = null;
+ if (debug.cancellation() && this._finallyPromise !== null) {
+ this._finallyPromise._fulfill();
+ this._finallyPromise = null;
+ }
+ };
+ PromiseSpawn.prototype._promiseCancelled = function() {
+ if (this._isResolved())
+ return;
+ var implementsReturn = typeof this._generator["return"] !== "undefined";
+ var result;
+ if (!implementsReturn) {
+ var reason = new Promise2.CancellationError("generator .return() sentinel");
+ Promise2.coroutine.returnSentinel = reason;
+ this._promise._attachExtraTrace(reason);
+ this._promise._pushContext();
+ result = tryCatch2(this._generator["throw"]).call(this._generator, reason);
+ this._promise._popContext();
+ } else {
+ this._promise._pushContext();
+ result = tryCatch2(this._generator["return"]).call(this._generator, void 0);
+ this._promise._popContext();
+ }
+ this._cancellationPhase = true;
+ this._yieldedPromise = null;
+ this._continue(result);
+ };
+ PromiseSpawn.prototype._promiseFulfilled = function(value) {
+ this._yieldedPromise = null;
+ this._promise._pushContext();
+ var result = tryCatch2(this._generator.next).call(this._generator, value);
+ this._promise._popContext();
+ this._continue(result);
+ };
+ PromiseSpawn.prototype._promiseRejected = function(reason) {
+ this._yieldedPromise = null;
+ this._promise._attachExtraTrace(reason);
+ this._promise._pushContext();
+ var result = tryCatch2(this._generator["throw"]).call(this._generator, reason);
+ this._promise._popContext();
+ this._continue(result);
+ };
+ PromiseSpawn.prototype._resultCancelled = function() {
+ if (this._yieldedPromise instanceof Promise2) {
+ var promise = this._yieldedPromise;
+ this._yieldedPromise = null;
+ promise.cancel();
+ }
+ };
+ PromiseSpawn.prototype.promise = function() {
+ return this._promise;
+ };
+ PromiseSpawn.prototype._run = function() {
+ this._generator = this._generatorFunction.call(this._receiver);
+ this._receiver = this._generatorFunction = void 0;
+ this._promiseFulfilled(void 0);
+ };
+ PromiseSpawn.prototype._continue = function(result) {
+ var promise = this._promise;
+ if (result === errorObj2) {
+ this._cleanup();
+ if (this._cancellationPhase) {
+ return promise.cancel();
+ } else {
+ return promise._rejectCallback(result.e, false);
+ }
+ }
+ var value = result.value;
+ if (result.done === true) {
+ this._cleanup();
+ if (this._cancellationPhase) {
+ return promise.cancel();
+ } else {
+ return promise._resolveCallback(value);
+ }
+ } else {
+ var maybePromise = tryConvertToPromise(value, this._promise);
+ if (!(maybePromise instanceof Promise2)) {
+ maybePromise = promiseFromYieldHandler(maybePromise, this._yieldHandlers, this._promise);
+ if (maybePromise === null) {
+ this._promiseRejected(new TypeError2("A value %s was yielded that could not be treated as a promise\n\n See http://goo.gl/MqrFmX\n\n".replace("%s", value) + "From coroutine:\n" + this._stack.split("\n").slice(1, -7).join("\n")));
+ return;
+ }
+ }
+ maybePromise = maybePromise._target();
+ var bitField = maybePromise._bitField;
+ ;
+ if ((bitField & 50397184) === 0) {
+ this._yieldedPromise = maybePromise;
+ maybePromise._proxy(this, null);
+ } else if ((bitField & 33554432) !== 0) {
+ Promise2._async.invoke(this._promiseFulfilled, this, maybePromise._value());
+ } else if ((bitField & 16777216) !== 0) {
+ Promise2._async.invoke(this._promiseRejected, this, maybePromise._reason());
+ } else {
+ this._promiseCancelled();
+ }
+ }
+ };
+ Promise2.coroutine = function(generatorFunction, options) {
+ if (typeof generatorFunction !== "function") {
+ throw new TypeError2("generatorFunction must be a function\n\n See http://goo.gl/MqrFmX\n");
+ }
+ var yieldHandler = Object(options).yieldHandler;
+ var PromiseSpawn$ = PromiseSpawn;
+ var stack = new Error().stack;
+ return function() {
+ var generator = generatorFunction.apply(this, arguments);
+ var spawn = new PromiseSpawn$(void 0, void 0, yieldHandler, stack);
+ var ret2 = spawn.promise();
+ spawn._generator = generator;
+ spawn._promiseFulfilled(void 0);
+ return ret2;
+ };
+ };
+ Promise2.coroutine.addYieldHandler = function(fn) {
+ if (typeof fn !== "function") {
+ throw new TypeError2("expecting a function but got " + util.classString(fn));
+ }
+ yieldHandlers.push(fn);
+ };
+ Promise2.spawn = function(generatorFunction) {
+ debug.deprecated("Promise.spawn()", "Promise.coroutine()");
+ if (typeof generatorFunction !== "function") {
+ return apiRejection("generatorFunction must be a function\n\n See http://goo.gl/MqrFmX\n");
+ }
+ var spawn = new PromiseSpawn(generatorFunction, this);
+ var ret2 = spawn.promise();
+ spawn._run(Promise2.spawn);
+ return ret2;
+ };
+ };
+ }
+});
+
+// node_modules/bluebird/js/release/nodeify.js
+var require_nodeify = __commonJS({
+ "node_modules/bluebird/js/release/nodeify.js"(exports2, module2) {
+ "use strict";
+ module2.exports = function(Promise2) {
+ var util = require_util();
+ var async = Promise2._async;
+ var tryCatch2 = util.tryCatch;
+ var errorObj2 = util.errorObj;
+ function spreadAdapter(val, nodeback) {
+ var promise = this;
+ if (!util.isArray(val))
+ return successAdapter.call(promise, val, nodeback);
+ var ret2 = tryCatch2(nodeback).apply(promise._boundValue(), [null].concat(val));
+ if (ret2 === errorObj2) {
+ async.throwLater(ret2.e);
+ }
+ }
+ function successAdapter(val, nodeback) {
+ var promise = this;
+ var receiver = promise._boundValue();
+ var ret2 = val === void 0 ? tryCatch2(nodeback).call(receiver, null) : tryCatch2(nodeback).call(receiver, null, val);
+ if (ret2 === errorObj2) {
+ async.throwLater(ret2.e);
+ }
+ }
+ function errorAdapter(reason, nodeback) {
+ var promise = this;
+ if (!reason) {
+ var newReason = new Error(reason + "");
+ newReason.cause = reason;
+ reason = newReason;
+ }
+ var ret2 = tryCatch2(nodeback).call(promise._boundValue(), reason);
+ if (ret2 === errorObj2) {
+ async.throwLater(ret2.e);
+ }
+ }
+ Promise2.prototype.asCallback = Promise2.prototype.nodeify = function(nodeback, options) {
+ if (typeof nodeback == "function") {
+ var adapter = successAdapter;
+ if (options !== void 0 && Object(options).spread) {
+ adapter = spreadAdapter;
+ }
+ this._then(adapter, errorAdapter, void 0, this, nodeback);
+ }
+ return this;
+ };
+ };
+ }
+});
+
+// node_modules/bluebird/js/release/promisify.js
+var require_promisify = __commonJS({
+ "node_modules/bluebird/js/release/promisify.js"(exports2, module2) {
+ "use strict";
+ module2.exports = function(Promise2, INTERNAL2) {
+ var THIS = {};
+ var util = require_util();
+ var nodebackForPromise = require_nodeback();
+ var withAppended2 = util.withAppended;
+ var maybeWrapAsError2 = util.maybeWrapAsError;
+ var canEvaluate2 = util.canEvaluate;
+ var TypeError2 = require_errors().TypeError;
+ var defaultSuffix = "Async";
+ var defaultPromisified = { __isPromisified__: true };
+ var noCopyProps = [
+ "arity",
+ "length",
+ "name",
+ "arguments",
+ "caller",
+ "callee",
+ "prototype",
+ "__isPromisified__"
+ ];
+ var noCopyPropsPattern = new RegExp("^(?:" + noCopyProps.join("|") + ")$");
+ var defaultFilter = function(name) {
+ return util.isIdentifier(name) && name.charAt(0) !== "_" && name !== "constructor";
+ };
+ function propsFilter(key) {
+ return !noCopyPropsPattern.test(key);
+ }
+ function isPromisified(fn) {
+ try {
+ return fn.__isPromisified__ === true;
+ } catch (e) {
+ return false;
+ }
+ }
+ function hasPromisified(obj2, key, suffix) {
+ var val = util.getDataPropertyOrDefault(obj2, key + suffix, defaultPromisified);
+ return val ? isPromisified(val) : false;
+ }
+ function checkValid(ret2, suffix, suffixRegexp) {
+ for (var i = 0; i < ret2.length; i += 2) {
+ var key = ret2[i];
+ if (suffixRegexp.test(key)) {
+ var keyWithoutAsyncSuffix = key.replace(suffixRegexp, "");
+ for (var j = 0; j < ret2.length; j += 2) {
+ if (ret2[j] === keyWithoutAsyncSuffix) {
+ throw new TypeError2("Cannot promisify an API that has normal methods with '%s'-suffix\n\n See http://goo.gl/MqrFmX\n".replace("%s", suffix));
+ }
+ }
+ }
+ }
+ }
+ function promisifiableMethods(obj2, suffix, suffixRegexp, filter) {
+ var keys = util.inheritedDataKeys(obj2);
+ var ret2 = [];
+ for (var i = 0; i < keys.length; ++i) {
+ var key = keys[i];
+ var value = obj2[key];
+ var passesDefaultFilter = filter === defaultFilter ? true : defaultFilter(key, value, obj2);
+ if (typeof value === "function" && !isPromisified(value) && !hasPromisified(obj2, key, suffix) && filter(key, value, obj2, passesDefaultFilter)) {
+ ret2.push(key, value);
+ }
+ }
+ checkValid(ret2, suffix, suffixRegexp);
+ return ret2;
+ }
+ var escapeIdentRegex = function(str) {
+ return str.replace(/([$])/, "\\$");
+ };
+ var makeNodePromisifiedEval;
+ if (true) {
+ var switchCaseArgumentOrder = function(likelyArgumentCount) {
+ var ret2 = [likelyArgumentCount];
+ var min = Math.max(0, likelyArgumentCount - 1 - 3);
+ for (var i = likelyArgumentCount - 1; i >= min; --i) {
+ ret2.push(i);
+ }
+ for (var i = likelyArgumentCount + 1; i <= 3; ++i) {
+ ret2.push(i);
+ }
+ return ret2;
+ };
+ var argumentSequence = function(argumentCount) {
+ return util.filledRange(argumentCount, "_arg", "");
+ };
+ var parameterDeclaration = function(parameterCount2) {
+ return util.filledRange(Math.max(parameterCount2, 3), "_arg", "");
+ };
+ var parameterCount = function(fn) {
+ if (typeof fn.length === "number") {
+ return Math.max(Math.min(fn.length, 1023 + 1), 0);
+ }
+ return 0;
+ };
+ makeNodePromisifiedEval = function(callback, receiver, originalName, fn, _, multiArgs) {
+ var newParameterCount = Math.max(0, parameterCount(fn) - 1);
+ var argumentOrder = switchCaseArgumentOrder(newParameterCount);
+ var shouldProxyThis = typeof callback === "string" || receiver === THIS;
+ function generateCallForArgumentCount(count) {
+ var args = argumentSequence(count).join(", ");
+ var comma = count > 0 ? ", " : "";
+ var ret2;
+ if (shouldProxyThis) {
+ ret2 = "ret = callback.call(this, {{args}}, nodeback); break;\n";
+ } else {
+ ret2 = receiver === void 0 ? "ret = callback({{args}}, nodeback); break;\n" : "ret = callback.call(receiver, {{args}}, nodeback); break;\n";
+ }
+ return ret2.replace("{{args}}", args).replace(", ", comma);
+ }
+ function generateArgumentSwitchCase() {
+ var ret2 = "";
+ for (var i = 0; i < argumentOrder.length; ++i) {
+ ret2 += "case " + argumentOrder[i] + ":" + generateCallForArgumentCount(argumentOrder[i]);
+ }
+ ret2 += " \n default: \n var args = new Array(len + 1); \n var i = 0; \n for (var i = 0; i < len; ++i) { \n args[i] = arguments[i]; \n } \n args[i] = nodeback; \n [CodeForCall] \n break; \n ".replace("[CodeForCall]", shouldProxyThis ? "ret = callback.apply(this, args);\n" : "ret = callback.apply(receiver, args);\n");
+ return ret2;
+ }
+ var getFunctionCode = typeof callback === "string" ? "this != null ? this['" + callback + "'] : fn" : "fn";
+ var body = "'use strict'; \n var ret = function (Parameters) { \n 'use strict'; \n var len = arguments.length; \n var promise = new Promise(INTERNAL); \n promise._captureStackTrace(); \n var nodeback = nodebackForPromise(promise, " + multiArgs + "); \n var ret; \n var callback = tryCatch([GetFunctionCode]); \n switch(len) { \n [CodeForSwitchCase] \n } \n if (ret === errorObj) { \n promise._rejectCallback(maybeWrapAsError(ret.e), true, true);\n } \n if (!promise._isFateSealed()) promise._setAsyncGuaranteed(); \n return promise; \n }; \n notEnumerableProp(ret, '__isPromisified__', true); \n return ret; \n ".replace("[CodeForSwitchCase]", generateArgumentSwitchCase()).replace("[GetFunctionCode]", getFunctionCode);
+ body = body.replace("Parameters", parameterDeclaration(newParameterCount));
+ return new Function("Promise", "fn", "receiver", "withAppended", "maybeWrapAsError", "nodebackForPromise", "tryCatch", "errorObj", "notEnumerableProp", "INTERNAL", body)(Promise2, fn, receiver, withAppended2, maybeWrapAsError2, nodebackForPromise, util.tryCatch, util.errorObj, util.notEnumerableProp, INTERNAL2);
+ };
+ }
+ function makeNodePromisifiedClosure(callback, receiver, _, fn, __, multiArgs) {
+ var defaultThis = function() {
+ return this;
+ }();
+ var method = callback;
+ if (typeof method === "string") {
+ callback = fn;
+ }
+ function promisified() {
+ var _receiver = receiver;
+ if (receiver === THIS)
+ _receiver = this;
+ var promise = new Promise2(INTERNAL2);
+ promise._captureStackTrace();
+ var cb = typeof method === "string" && this !== defaultThis ? this[method] : callback;
+ var fn2 = nodebackForPromise(promise, multiArgs);
+ try {
+ cb.apply(_receiver, withAppended2(arguments, fn2));
+ } catch (e) {
+ promise._rejectCallback(maybeWrapAsError2(e), true, true);
+ }
+ if (!promise._isFateSealed())
+ promise._setAsyncGuaranteed();
+ return promise;
+ }
+ util.notEnumerableProp(promisified, "__isPromisified__", true);
+ return promisified;
+ }
+ var makeNodePromisified = canEvaluate2 ? makeNodePromisifiedEval : makeNodePromisifiedClosure;
+ function promisifyAll(obj2, suffix, filter, promisifier, multiArgs) {
+ var suffixRegexp = new RegExp(escapeIdentRegex(suffix) + "$");
+ var methods = promisifiableMethods(obj2, suffix, suffixRegexp, filter);
+ for (var i = 0, len = methods.length; i < len; i += 2) {
+ var key = methods[i];
+ var fn = methods[i + 1];
+ var promisifiedKey = key + suffix;
+ if (promisifier === makeNodePromisified) {
+ obj2[promisifiedKey] = makeNodePromisified(key, THIS, key, fn, suffix, multiArgs);
+ } else {
+ var promisified = promisifier(fn, function() {
+ return makeNodePromisified(key, THIS, key, fn, suffix, multiArgs);
+ });
+ util.notEnumerableProp(promisified, "__isPromisified__", true);
+ obj2[promisifiedKey] = promisified;
+ }
+ }
+ util.toFastProperties(obj2);
+ return obj2;
+ }
+ function promisify(callback, receiver, multiArgs) {
+ return makeNodePromisified(callback, receiver, void 0, callback, null, multiArgs);
+ }
+ Promise2.promisify = function(fn, options) {
+ if (typeof fn !== "function") {
+ throw new TypeError2("expecting a function but got " + util.classString(fn));
+ }
+ if (isPromisified(fn)) {
+ return fn;
+ }
+ options = Object(options);
+ var receiver = options.context === void 0 ? THIS : options.context;
+ var multiArgs = !!options.multiArgs;
+ var ret2 = promisify(fn, receiver, multiArgs);
+ util.copyDescriptors(fn, ret2, propsFilter);
+ return ret2;
+ };
+ Promise2.promisifyAll = function(target, options) {
+ if (typeof target !== "function" && typeof target !== "object") {
+ throw new TypeError2("the target of promisifyAll must be an object or a function\n\n See http://goo.gl/MqrFmX\n");
+ }
+ options = Object(options);
+ var multiArgs = !!options.multiArgs;
+ var suffix = options.suffix;
+ if (typeof suffix !== "string")
+ suffix = defaultSuffix;
+ var filter = options.filter;
+ if (typeof filter !== "function")
+ filter = defaultFilter;
+ var promisifier = options.promisifier;
+ if (typeof promisifier !== "function")
+ promisifier = makeNodePromisified;
+ if (!util.isIdentifier(suffix)) {
+ throw new RangeError("suffix must be a valid identifier\n\n See http://goo.gl/MqrFmX\n");
+ }
+ var keys = util.inheritedDataKeys(target);
+ for (var i = 0; i < keys.length; ++i) {
+ var value = target[keys[i]];
+ if (keys[i] !== "constructor" && util.isClass(value)) {
+ promisifyAll(value.prototype, suffix, filter, promisifier, multiArgs);
+ promisifyAll(value, suffix, filter, promisifier, multiArgs);
+ }
+ }
+ return promisifyAll(target, suffix, filter, promisifier, multiArgs);
+ };
+ };
+ }
+});
+
+// node_modules/bluebird/js/release/props.js
+var require_props = __commonJS({
+ "node_modules/bluebird/js/release/props.js"(exports2, module2) {
+ "use strict";
+ module2.exports = function(Promise2, PromiseArray, tryConvertToPromise, apiRejection) {
+ var util = require_util();
+ var isObject2 = util.isObject;
+ var es52 = require_es5();
+ var Es6Map;
+ if (typeof Map === "function")
+ Es6Map = Map;
+ var mapToEntries = function() {
+ var index = 0;
+ var size = 0;
+ function extractEntry(value, key) {
+ this[index] = value;
+ this[index + size] = key;
+ index++;
+ }
+ return function mapToEntries2(map) {
+ size = map.size;
+ index = 0;
+ var ret2 = new Array(map.size * 2);
+ map.forEach(extractEntry, ret2);
+ return ret2;
+ };
+ }();
+ var entriesToMap = function(entries) {
+ var ret2 = new Es6Map();
+ var length = entries.length / 2 | 0;
+ for (var i = 0; i < length; ++i) {
+ var key = entries[length + i];
+ var value = entries[i];
+ ret2.set(key, value);
+ }
+ return ret2;
+ };
+ function PropertiesPromiseArray(obj2) {
+ var isMap = false;
+ var entries;
+ if (Es6Map !== void 0 && obj2 instanceof Es6Map) {
+ entries = mapToEntries(obj2);
+ isMap = true;
+ } else {
+ var keys = es52.keys(obj2);
+ var len = keys.length;
+ entries = new Array(len * 2);
+ for (var i = 0; i < len; ++i) {
+ var key = keys[i];
+ entries[i] = obj2[key];
+ entries[i + len] = key;
+ }
+ }
+ this.constructor$(entries);
+ this._isMap = isMap;
+ this._init$(void 0, -3);
+ }
+ util.inherits(PropertiesPromiseArray, PromiseArray);
+ PropertiesPromiseArray.prototype._init = function() {
+ };
+ PropertiesPromiseArray.prototype._promiseFulfilled = function(value, index) {
+ this._values[index] = value;
+ var totalResolved = ++this._totalResolved;
+ if (totalResolved >= this._length) {
+ var val;
+ if (this._isMap) {
+ val = entriesToMap(this._values);
+ } else {
+ val = {};
+ var keyOffset = this.length();
+ for (var i = 0, len = this.length(); i < len; ++i) {
+ val[this._values[i + keyOffset]] = this._values[i];
+ }
+ }
+ this._resolve(val);
+ return true;
+ }
+ return false;
+ };
+ PropertiesPromiseArray.prototype.shouldCopyValues = function() {
+ return false;
+ };
+ PropertiesPromiseArray.prototype.getActualLength = function(len) {
+ return len >> 1;
+ };
+ function props(promises) {
+ var ret2;
+ var castValue = tryConvertToPromise(promises);
+ if (!isObject2(castValue)) {
+ return apiRejection("cannot await properties of a non-object\n\n See http://goo.gl/MqrFmX\n");
+ } else if (castValue instanceof Promise2) {
+ ret2 = castValue._then(Promise2.props, void 0, void 0, void 0, void 0);
+ } else {
+ ret2 = new PropertiesPromiseArray(castValue).promise();
+ }
+ if (castValue instanceof Promise2) {
+ ret2._propagateFrom(castValue, 2);
+ }
+ return ret2;
+ }
+ Promise2.prototype.props = function() {
+ return props(this);
+ };
+ Promise2.props = function(promises) {
+ return props(promises);
+ };
+ };
+ }
+});
+
+// node_modules/bluebird/js/release/race.js
+var require_race = __commonJS({
+ "node_modules/bluebird/js/release/race.js"(exports2, module2) {
+ "use strict";
+ module2.exports = function(Promise2, INTERNAL2, tryConvertToPromise, apiRejection) {
+ var util = require_util();
+ var raceLater = function(promise) {
+ return promise.then(function(array) {
+ return race(array, promise);
+ });
+ };
+ function race(promises, parent) {
+ var maybePromise = tryConvertToPromise(promises);
+ if (maybePromise instanceof Promise2) {
+ return raceLater(maybePromise);
+ } else {
+ promises = util.asArray(promises);
+ if (promises === null)
+ return apiRejection("expecting an array or an iterable object but got " + util.classString(promises));
+ }
+ var ret2 = new Promise2(INTERNAL2);
+ if (parent !== void 0) {
+ ret2._propagateFrom(parent, 3);
+ }
+ var fulfill = ret2._fulfill;
+ var reject = ret2._reject;
+ for (var i = 0, len = promises.length; i < len; ++i) {
+ var val = promises[i];
+ if (val === void 0 && !(i in promises)) {
+ continue;
+ }
+ Promise2.cast(val)._then(fulfill, reject, void 0, ret2, null);
+ }
+ return ret2;
+ }
+ Promise2.race = function(promises) {
+ return race(promises, void 0);
+ };
+ Promise2.prototype.race = function() {
+ return race(this, void 0);
+ };
+ };
+ }
+});
+
+// node_modules/bluebird/js/release/reduce.js
+var require_reduce = __commonJS({
+ "node_modules/bluebird/js/release/reduce.js"(exports2, module2) {
+ "use strict";
+ module2.exports = function(Promise2, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL2, debug) {
+ var getDomain = Promise2._getDomain;
+ var util = require_util();
+ var tryCatch2 = util.tryCatch;
+ function ReductionPromiseArray(promises, fn, initialValue, _each) {
+ this.constructor$(promises);
+ var domain = getDomain();
+ this._fn = domain === null ? fn : util.domainBind(domain, fn);
+ if (initialValue !== void 0) {
+ initialValue = Promise2.resolve(initialValue);
+ initialValue._attachCancellationCallback(this);
+ }
+ this._initialValue = initialValue;
+ this._currentCancellable = null;
+ if (_each === INTERNAL2) {
+ this._eachValues = Array(this._length);
+ } else if (_each === 0) {
+ this._eachValues = null;
+ } else {
+ this._eachValues = void 0;
+ }
+ this._promise._captureStackTrace();
+ this._init$(void 0, -5);
+ }
+ util.inherits(ReductionPromiseArray, PromiseArray);
+ ReductionPromiseArray.prototype._gotAccum = function(accum) {
+ if (this._eachValues !== void 0 && this._eachValues !== null && accum !== INTERNAL2) {
+ this._eachValues.push(accum);
+ }
+ };
+ ReductionPromiseArray.prototype._eachComplete = function(value) {
+ if (this._eachValues !== null) {
+ this._eachValues.push(value);
+ }
+ return this._eachValues;
+ };
+ ReductionPromiseArray.prototype._init = function() {
+ };
+ ReductionPromiseArray.prototype._resolveEmptyArray = function() {
+ this._resolve(this._eachValues !== void 0 ? this._eachValues : this._initialValue);
+ };
+ ReductionPromiseArray.prototype.shouldCopyValues = function() {
+ return false;
+ };
+ ReductionPromiseArray.prototype._resolve = function(value) {
+ this._promise._resolveCallback(value);
+ this._values = null;
+ };
+ ReductionPromiseArray.prototype._resultCancelled = function(sender) {
+ if (sender === this._initialValue)
+ return this._cancel();
+ if (this._isResolved())
+ return;
+ this._resultCancelled$();
+ if (this._currentCancellable instanceof Promise2) {
+ this._currentCancellable.cancel();
+ }
+ if (this._initialValue instanceof Promise2) {
+ this._initialValue.cancel();
+ }
+ };
+ ReductionPromiseArray.prototype._iterate = function(values) {
+ this._values = values;
+ var value;
+ var i;
+ var length = values.length;
+ if (this._initialValue !== void 0) {
+ value = this._initialValue;
+ i = 0;
+ } else {
+ value = Promise2.resolve(values[0]);
+ i = 1;
+ }
+ this._currentCancellable = value;
+ if (!value.isRejected()) {
+ for (; i < length; ++i) {
+ var ctx = {
+ accum: null,
+ value: values[i],
+ index: i,
+ length,
+ array: this
+ };
+ value = value._then(gotAccum, void 0, void 0, ctx, void 0);
+ }
+ }
+ if (this._eachValues !== void 0) {
+ value = value._then(this._eachComplete, void 0, void 0, this, void 0);
+ }
+ value._then(completed, completed, void 0, value, this);
+ };
+ Promise2.prototype.reduce = function(fn, initialValue) {
+ return reduce(this, fn, initialValue, null);
+ };
+ Promise2.reduce = function(promises, fn, initialValue, _each) {
+ return reduce(promises, fn, initialValue, _each);
+ };
+ function completed(valueOrReason, array) {
+ if (this.isFulfilled()) {
+ array._resolve(valueOrReason);
+ } else {
+ array._reject(valueOrReason);
+ }
+ }
+ function reduce(promises, fn, initialValue, _each) {
+ if (typeof fn !== "function") {
+ return apiRejection("expecting a function but got " + util.classString(fn));
+ }
+ var array = new ReductionPromiseArray(promises, fn, initialValue, _each);
+ return array.promise();
+ }
+ function gotAccum(accum) {
+ this.accum = accum;
+ this.array._gotAccum(accum);
+ var value = tryConvertToPromise(this.value, this.array._promise);
+ if (value instanceof Promise2) {
+ this.array._currentCancellable = value;
+ return value._then(gotValue, void 0, void 0, this, void 0);
+ } else {
+ return gotValue.call(this, value);
+ }
+ }
+ function gotValue(value) {
+ var array = this.array;
+ var promise = array._promise;
+ var fn = tryCatch2(array._fn);
+ promise._pushContext();
+ var ret2;
+ if (array._eachValues !== void 0) {
+ ret2 = fn.call(promise._boundValue(), value, this.index, this.length);