Skip to content
Snippets Groups Projects
index.js 8.81 MiB
Newer Older
  • Learn to ignore specific revisions
  • Romain CREY's avatar
    Romain CREY committed
    
    
    Promise.prototype._then = function (
        didFulfill,
        didReject,
        _,    receiver,
        internalData
    ) {
        var haveInternalData = internalData !== undefined;
        var promise = haveInternalData ? internalData : new Promise(INTERNAL);
        var target = this._target();
        var bitField = target._bitField;
    
    Romain CREY's avatar
    Romain CREY committed
    
    
        if (!haveInternalData) {
            promise._propagateFrom(this, 3);
            promise._captureStackTrace();
            if (receiver === undefined &&
                ((this._bitField & 2097152) !== 0)) {
                if (!((bitField & 50397184) === 0)) {
                    receiver = this._boundValue();
                } else {
                    receiver = target === this ? undefined : this._boundTo;
                }
            }
            this._fireEvent("promiseChained", this, promise);
        }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
        var context = getContext();
        if (!((bitField & 50397184) === 0)) {
            var handler, value, settler = target._settlePromiseCtx;
            if (((bitField & 33554432) !== 0)) {
                value = target._rejectionHandler0;
                handler = didFulfill;
            } else if (((bitField & 16777216) !== 0)) {
                value = target._fulfillmentHandler0;
                handler = didReject;
                target._unsetRejectionIsUnhandled();
            } else {
                settler = target._settlePromiseLateCancellationObserver;
                value = new CancellationError("late cancellation observer");
                target._attachExtraTrace(value);
                handler = didReject;
            }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
            async.invoke(settler, target, {
                handler: util.contextBind(context, handler),
                promise: promise,
                receiver: receiver,
                value: value
            });
        } else {
            target._addCallbacks(didFulfill, didReject, promise,
                    receiver, context);
        }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    Promise.prototype._length = function () {
        return this._bitField & 65535;
    };
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    Promise.prototype._isFateSealed = function () {
        return (this._bitField & 117506048) !== 0;
    };
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    Promise.prototype._isFollowing = function () {
        return (this._bitField & 67108864) === 67108864;
    };
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    Promise.prototype._setLength = function (len) {
        this._bitField = (this._bitField & -65536) |
            (len & 65535);
    };
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    Promise.prototype._setFulfilled = function () {
        this._bitField = this._bitField | 33554432;
        this._fireEvent("promiseFulfilled", this);
    };
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    Promise.prototype._setRejected = function () {
        this._bitField = this._bitField | 16777216;
        this._fireEvent("promiseRejected", this);
    };
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    Promise.prototype._setFollowing = function () {
        this._bitField = this._bitField | 67108864;
        this._fireEvent("promiseResolved", this);
    };
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    Promise.prototype._setIsFinal = function () {
        this._bitField = this._bitField | 4194304;
    };
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    Promise.prototype._isFinal = function () {
        return (this._bitField & 4194304) > 0;
    };
    
    Promise.prototype._unsetCancelled = function() {
        this._bitField = this._bitField & (~65536);
    };
    
    Promise.prototype._setCancelled = function() {
        this._bitField = this._bitField | 65536;
        this._fireEvent("promiseCancelled", this);
    };
    
    Promise.prototype._setWillBeCancelled = function() {
        this._bitField = this._bitField | 8388608;
    
    Romain CREY's avatar
    Romain CREY committed
    };
    
    
    Promise.prototype._setAsyncGuaranteed = function() {
        if (async.hasCustomScheduler()) return;
        var bitField = this._bitField;
        this._bitField = bitField |
            (((bitField & 536870912) >> 2) ^
            134217728);
    };
    
    Promise.prototype._setNoAsyncGuarantee = function() {
        this._bitField = (this._bitField | 536870912) &
            (~134217728);
    };
    
    Promise.prototype._receiverAt = function (index) {
        var ret = index === 0 ? this._receiver0 : this[
                index * 4 - 4 + 3];
        if (ret === UNDEFINED_BINDING) {
            return undefined;
        } else if (ret === undefined && this._isBound()) {
            return this._boundValue();
        }
        return ret;
    };
    
    Promise.prototype._promiseAt = function (index) {
        return this[
                index * 4 - 4 + 2];
    
    Romain CREY's avatar
    Romain CREY committed
    };
    
    
    Promise.prototype._fulfillmentHandlerAt = function (index) {
        return this[
                index * 4 - 4 + 0];
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    Promise.prototype._rejectionHandlerAt = function (index) {
        return this[
                index * 4 - 4 + 1];
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    Promise.prototype._boundValue = function() {};
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    Promise.prototype._migrateCallback0 = function (follower) {
        var bitField = follower._bitField;
        var fulfill = follower._fulfillmentHandler0;
        var reject = follower._rejectionHandler0;
        var promise = follower._promise0;
        var receiver = follower._receiverAt(0);
        if (receiver === undefined) receiver = UNDEFINED_BINDING;
        this._addCallbacks(fulfill, reject, promise, receiver, null);
    };
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    Promise.prototype._migrateCallbackAt = function (follower, index) {
        var fulfill = follower._fulfillmentHandlerAt(index);
        var reject = follower._rejectionHandlerAt(index);
        var promise = follower._promiseAt(index);
        var receiver = follower._receiverAt(index);
        if (receiver === undefined) receiver = UNDEFINED_BINDING;
        this._addCallbacks(fulfill, reject, promise, receiver, null);
    };
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    Promise.prototype._addCallbacks = function (
        fulfill,
        reject,
        promise,
        receiver,
        context
    ) {
        var index = this._length();
    
    Romain CREY's avatar
    Romain CREY committed
    
    
        if (index >= 65535 - 4) {
            index = 0;
            this._setLength(0);
        }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
        if (index === 0) {
            this._promise0 = promise;
            this._receiver0 = receiver;
            if (typeof fulfill === "function") {
                this._fulfillmentHandler0 = util.contextBind(context, fulfill);
            }
            if (typeof reject === "function") {
                this._rejectionHandler0 = util.contextBind(context, reject);
            }
        } else {
            var base = index * 4 - 4;
            this[base + 2] = promise;
            this[base + 3] = receiver;
            if (typeof fulfill === "function") {
                this[base + 0] =
                    util.contextBind(context, fulfill);
            }
            if (typeof reject === "function") {
                this[base + 1] =
                    util.contextBind(context, reject);
            }
        }
        this._setLength(index + 1);
        return index;
    };
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    Promise.prototype._proxy = function (proxyable, arg) {
        this._addCallbacks(undefined, undefined, arg, proxyable, null);
    };
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    Promise.prototype._resolveCallback = function(value, shouldBind) {
        if (((this._bitField & 117506048) !== 0)) return;
        if (value === this)
            return this._rejectCallback(makeSelfResolutionError(), false);
        var maybePromise = tryConvertToPromise(value, this);
        if (!(maybePromise instanceof Promise)) return this._fulfill(value);
    
    Romain CREY's avatar
    Romain CREY committed
    
    
        if (shouldBind) this._propagateFrom(maybePromise, 2);
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    
        var promise = maybePromise._target();
    
    Romain CREY's avatar
    Romain CREY committed
    
    
        if (promise === this) {
            this._reject(makeSelfResolutionError());
            return;
        }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
        var bitField = promise._bitField;
        if (((bitField & 50397184) === 0)) {
            var len = this._length();
            if (len > 0) promise._migrateCallback0(this);
            for (var i = 1; i < len; ++i) {
                promise._migrateCallbackAt(this, i);
            }
            this._setFollowing();
            this._setLength(0);
            this._setFollowee(maybePromise);
        } else if (((bitField & 33554432) !== 0)) {
            this._fulfill(promise._value());
        } else if (((bitField & 16777216) !== 0)) {
            this._reject(promise._reason());
        } else {
            var reason = new CancellationError("late cancellation observer");
            promise._attachExtraTrace(reason);
            this._reject(reason);
        }
    };
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    Promise.prototype._rejectCallback =
    function(reason, synchronous, ignoreNonErrorWarnings) {
        var trace = util.ensureErrorObject(reason);
        var hasStack = trace === reason;
        if (!hasStack && !ignoreNonErrorWarnings && debug.warnings()) {
            var message = "a promise was rejected with a non-error: " +
                util.classString(reason);
            this._warn(message, true);
        }
        this._attachExtraTrace(trace, synchronous ? hasStack : false);
        this._reject(reason);
    };
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    Promise.prototype._resolveFromExecutor = function (executor) {
        if (executor === INTERNAL) return;
        var promise = this;
        this._captureStackTrace();
        this._pushContext();
        var synchronous = true;
        var r = this._execute(executor, function(value) {
            promise._resolveCallback(value);
        }, function (reason) {
            promise._rejectCallback(reason, synchronous);
        });
        synchronous = false;
        this._popContext();
    
        if (r !== undefined) {
            promise._rejectCallback(r, true);
        }
    };
    
    Promise.prototype._settlePromiseFromHandler = function (
        handler, receiver, value, promise
    ) {
        var bitField = promise._bitField;
        if (((bitField & 65536) !== 0)) return;
        promise._pushContext();
        var x;
        if (receiver === APPLY) {
            if (!value || typeof value.length !== "number") {
                x = errorObj;
                x.e = new TypeError("cannot .spread() a non-array: " +
                                        util.classString(value));
            } else {
                x = tryCatch(handler).apply(this._boundValue(), value);
            }
        } else {
            x = tryCatch(handler).call(receiver, value);
        }
        var promiseCreated = promise._popContext();
        bitField = promise._bitField;
        if (((bitField & 65536) !== 0)) return;
    
        if (x === NEXT_FILTER) {
            promise._reject(value);
        } else if (x === errorObj) {
            promise._rejectCallback(x.e, false);
        } else {
            debug.checkForgottenReturns(x, promiseCreated, "",  promise, this);
            promise._resolveCallback(x);
        }
    };
    
    Promise.prototype._target = function() {
        var ret = this;
        while (ret._isFollowing()) ret = ret._followee();
        return ret;
    };
    
    Promise.prototype._followee = function() {
        return this._rejectionHandler0;
    };
    
    Promise.prototype._setFollowee = function(promise) {
        this._rejectionHandler0 = promise;
    };
    
    Promise.prototype._settlePromise = function(promise, handler, receiver, value) {
        var isPromise = promise instanceof Promise;
        var bitField = this._bitField;
        var asyncGuaranteed = ((bitField & 134217728) !== 0);
        if (((bitField & 65536) !== 0)) {
            if (isPromise) promise._invokeInternalOnCancel();
    
            if (receiver instanceof PassThroughHandlerContext &&
                receiver.isFinallyHandler()) {
                receiver.cancelPromise = promise;
                if (tryCatch(handler).call(receiver, value) === errorObj) {
                    promise._reject(errorObj.e);
                }
            } else if (handler === reflectHandler) {
                promise._fulfill(reflectHandler.call(receiver));
            } else if (receiver instanceof Proxyable) {
                receiver._promiseCancelled(promise);
            } else if (isPromise || promise instanceof PromiseArray) {
                promise._cancel();
            } else {
                receiver.cancel();
            }
        } else if (typeof handler === "function") {
            if (!isPromise) {
                handler.call(receiver, value, promise);
            } else {
                if (asyncGuaranteed) promise._setAsyncGuaranteed();
                this._settlePromiseFromHandler(handler, receiver, value, promise);
            }
        } else if (receiver instanceof Proxyable) {
            if (!receiver._isResolved()) {
                if (((bitField & 33554432) !== 0)) {
                    receiver._promiseFulfilled(value, promise);
                } else {
                    receiver._promiseRejected(value, promise);
                }
            }
        } else if (isPromise) {
            if (asyncGuaranteed) promise._setAsyncGuaranteed();
            if (((bitField & 33554432) !== 0)) {
                promise._fulfill(value);
            } else {
                promise._reject(value);
            }
        }
    };
    
    Promise.prototype._settlePromiseLateCancellationObserver = function(ctx) {
        var handler = ctx.handler;
        var promise = ctx.promise;
        var receiver = ctx.receiver;
        var value = ctx.value;
        if (typeof handler === "function") {
            if (!(promise instanceof Promise)) {
                handler.call(receiver, value, promise);
            } else {
                this._settlePromiseFromHandler(handler, receiver, value, promise);
            }
        } else if (promise instanceof Promise) {
            promise._reject(value);
        }
    };
    
    Promise.prototype._settlePromiseCtx = function(ctx) {
        this._settlePromise(ctx.promise, ctx.handler, ctx.receiver, ctx.value);
    };
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    Promise.prototype._settlePromise0 = function(handler, value, bitField) {
        var promise = this._promise0;
        var receiver = this._receiverAt(0);
        this._promise0 = undefined;
        this._receiver0 = undefined;
        this._settlePromise(promise, handler, receiver, value);
    
    Romain CREY's avatar
    Romain CREY committed
    };
    
    
    Promise.prototype._clearCallbackDataAtIndex = function(index) {
        var base = index * 4 - 4;
        this[base + 2] =
        this[base + 3] =
        this[base + 0] =
        this[base + 1] = undefined;
    };
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    Promise.prototype._fulfill = function (value) {
        var bitField = this._bitField;
        if (((bitField & 117506048) >>> 16)) return;
        if (value === this) {
            var err = makeSelfResolutionError();
            this._attachExtraTrace(err);
            return this._reject(err);
        }
        this._setFulfilled();
        this._rejectionHandler0 = value;
    
    Romain CREY's avatar
    Romain CREY committed
    
    
        if ((bitField & 65535) > 0) {
            if (((bitField & 134217728) !== 0)) {
                this._settlePromises();
            } else {
                async.settlePromises(this);
            }
            this._dereferenceTrace();
        }
    };
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    Promise.prototype._reject = function (reason) {
        var bitField = this._bitField;
        if (((bitField & 117506048) >>> 16)) return;
        this._setRejected();
        this._fulfillmentHandler0 = reason;
    
    Romain CREY's avatar
    Romain CREY committed
    
    
        if (this._isFinal()) {
            return async.fatalError(reason, util.isNode);
        }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
        if ((bitField & 65535) > 0) {
            async.settlePromises(this);
        } else {
            this._ensurePossibleRejectionHandled();
        }
    };
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    Promise.prototype._fulfillPromises = function (len, value) {
        for (var i = 1; i < len; i++) {
            var handler = this._fulfillmentHandlerAt(i);
            var promise = this._promiseAt(i);
            var receiver = this._receiverAt(i);
            this._clearCallbackDataAtIndex(i);
            this._settlePromise(promise, handler, receiver, value);
        }
    };
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    Promise.prototype._rejectPromises = function (len, reason) {
        for (var i = 1; i < len; i++) {
            var handler = this._rejectionHandlerAt(i);
            var promise = this._promiseAt(i);
            var receiver = this._receiverAt(i);
            this._clearCallbackDataAtIndex(i);
            this._settlePromise(promise, handler, receiver, reason);
        }
    };
    
    Promise.prototype._settlePromises = function () {
        var bitField = this._bitField;
        var len = (bitField & 65535);
    
        if (len > 0) {
            if (((bitField & 16842752) !== 0)) {
                var reason = this._fulfillmentHandler0;
                this._settlePromise0(this._rejectionHandler0, reason, bitField);
                this._rejectPromises(len, reason);
            } else {
                var value = this._rejectionHandler0;
                this._settlePromise0(this._fulfillmentHandler0, value, bitField);
                this._fulfillPromises(len, value);
            }
            this._setLength(0);
        }
        this._clearCancellationData();
    };
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    Promise.prototype._settledValue = function() {
        var bitField = this._bitField;
        if (((bitField & 33554432) !== 0)) {
            return this._rejectionHandler0;
        } else if (((bitField & 16777216) !== 0)) {
            return this._fulfillmentHandler0;
        }
    };
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
        es5.defineProperty(Promise.prototype, Symbol.toStringTag, {
            get: function () {
                return "Object";
            }
        });
    }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    function deferResolve(v) {this.promise._resolveCallback(v);}
    function deferReject(v) {this.promise._rejectCallback(v, false);}
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    Promise.defer = Promise.pending = function() {
        debug.deprecated("Promise.defer", "new Promise");
        var promise = new Promise(INTERNAL);
        return {
            promise: promise,
            resolve: deferResolve,
            reject: deferReject
        };
    };
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    util.notEnumerableProp(Promise,
                           "_makeSelfResolutionError",
                           makeSelfResolutionError);
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    __webpack_require__(21)(Promise, INTERNAL, tryConvertToPromise, apiRejection,
        debug);
    __webpack_require__(22)(Promise, INTERNAL, tryConvertToPromise, debug);
    __webpack_require__(23)(Promise, PromiseArray, apiRejection, debug);
    __webpack_require__(24)(Promise);
    __webpack_require__(25)(Promise);
    __webpack_require__(26)(
        Promise, PromiseArray, tryConvertToPromise, INTERNAL, async);
    Promise.Promise = Promise;
    Promise.version = "3.7.2";
    __webpack_require__(27)(Promise);
    __webpack_require__(28)(Promise, apiRejection, INTERNAL, tryConvertToPromise, Proxyable, debug);
    __webpack_require__(29)(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug);
    __webpack_require__(30)(Promise);
    __webpack_require__(31)(Promise, INTERNAL);
    __webpack_require__(32)(Promise, PromiseArray, tryConvertToPromise, apiRejection);
    __webpack_require__(33)(Promise, INTERNAL, tryConvertToPromise, apiRejection);
    __webpack_require__(34)(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug);
    __webpack_require__(35)(Promise, PromiseArray, debug);
    __webpack_require__(36)(Promise, PromiseArray, apiRejection);
    __webpack_require__(37)(Promise, INTERNAL, debug);
    __webpack_require__(38)(Promise, apiRejection, tryConvertToPromise, createContext, INTERNAL, debug);
    __webpack_require__(39)(Promise);
    __webpack_require__(40)(Promise, INTERNAL);
    __webpack_require__(41)(Promise, INTERNAL);
                                                             
        util.toFastProperties(Promise);                                          
        util.toFastProperties(Promise.prototype);                                
        function fillTypes(value) {                                              
            var p = new Promise(INTERNAL);                                       
            p._fulfillmentHandler0 = value;                                      
            p._rejectionHandler0 = value;                                        
            p._promise0 = value;                                                 
            p._receiver0 = value;                                                
        }                                                                        
        // Complete slack tracking, opt out of field-type tracking and           
        // stabilize map                                                         
        fillTypes({a: 1});                                                       
        fillTypes({b: 2});                                                       
        fillTypes({c: 3});                                                       
        fillTypes(1);                                                            
        fillTypes(function(){});                                                 
        fillTypes(undefined);                                                    
        fillTypes(false);                                                        
        fillTypes(new Promise(INTERNAL));                                        
        debug.setBounds(Async.firstLineError, util.lastLineError);               
        return Promise;                                                          
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    
    /***/ }),
    /* 7 */
    /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    var es5 = __webpack_require__(8);
    var canEvaluate = typeof navigator == "undefined";
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    var errorObj = {e: {}};
    var tryCatchTarget;
    var globalObject = typeof self !== "undefined" ? self :
        typeof window !== "undefined" ? window :
        typeof global !== "undefined" ? global :
        this !== undefined ? this : null;
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    function tryCatcher() {
        try {
            var target = tryCatchTarget;
            tryCatchTarget = null;
            return target.apply(this, arguments);
        } catch (e) {
            errorObj.e = e;
            return errorObj;
        }
    }
    function tryCatch(fn) {
        tryCatchTarget = fn;
        return tryCatcher;
    }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    var inherits = function(Child, Parent) {
        var hasProp = {}.hasOwnProperty;
    
    Romain CREY's avatar
    Romain CREY committed
    
    
        function T() {
            this.constructor = Child;
            this.constructor$ = Parent;
            for (var propertyName in Parent.prototype) {
                if (hasProp.call(Parent.prototype, propertyName) &&
                    propertyName.charAt(propertyName.length-1) !== "$"
               ) {
                    this[propertyName + "$"] = Parent.prototype[propertyName];
                }
            }
        }
        T.prototype = Parent.prototype;
        Child.prototype = new T();
        return Child.prototype;
    };
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    
    function isPrimitive(val) {
        return val == null || val === true || val === false ||
            typeof val === "string" || typeof val === "number";
    
    function isObject(value) {
        return typeof value === "function" ||
               typeof value === "object" && value !== null;
    }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    function maybeWrapAsError(maybeError) {
        if (!isPrimitive(maybeError)) return maybeError;
    
    Romain CREY's avatar
    Romain CREY committed
    
    
        return new Error(safeToString(maybeError));
    
    Romain CREY's avatar
    Romain CREY committed
    }
    
    
    function withAppended(target, appendee) {
        var len = target.length;
        var ret = new Array(len + 1);
        var i;
        for (i = 0; i < len; ++i) {
            ret[i] = target[i];
        }
        ret[i] = appendee;
        return ret;
    }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    function getDataPropertyOrDefault(obj, key, defaultValue) {
        if (es5.isES5) {
            var desc = Object.getOwnPropertyDescriptor(obj, key);
    
    Romain CREY's avatar
    Romain CREY committed
    
    
            if (desc != null) {
                return desc.get == null && desc.set == null
                        ? desc.value
                        : defaultValue;
            }
        } else {
            return {}.hasOwnProperty.call(obj, key) ? obj[key] : undefined;
        }
    }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    function notEnumerableProp(obj, name, value) {
        if (isPrimitive(obj)) return obj;
        var descriptor = {
            value: value,
            configurable: true,
            enumerable: false,
            writable: true
        };
        es5.defineProperty(obj, name, descriptor);
        return obj;
    }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    function thrower(r) {
        throw r;
    }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    var inheritedDataKeys = (function() {
        var excludedPrototypes = [
            Array.prototype,
            Object.prototype,
            Function.prototype
        ];
    
    Romain CREY's avatar
    Romain CREY committed
    
    
        var isExcludedProto = function(val) {
            for (var i = 0; i < excludedPrototypes.length; ++i) {
                if (excludedPrototypes[i] === val) {
                    return true;
                }
            }
            return false;
        };
    
    Romain CREY's avatar
    Romain CREY committed
    
    
        if (es5.isES5) {
            var getKeys = Object.getOwnPropertyNames;
            return function(obj) {
                var ret = [];
                var visitedKeys = Object.create(null);
                while (obj != null && !isExcludedProto(obj)) {
                    var keys;
                    try {
                        keys = getKeys(obj);
                    } catch (e) {
                        return ret;
                    }
                    for (var i = 0; i < keys.length; ++i) {
                        var key = keys[i];
                        if (visitedKeys[key]) continue;
                        visitedKeys[key] = true;
                        var desc = Object.getOwnPropertyDescriptor(obj, key);
                        if (desc != null && desc.get == null && desc.set == null) {
                            ret.push(key);
                        }
                    }
                    obj = es5.getPrototypeOf(obj);
                }
                return ret;
            };
        } else {
            var hasProp = {}.hasOwnProperty;
            return function(obj) {
                if (isExcludedProto(obj)) return [];
                var ret = [];
    
    Romain CREY's avatar
    Romain CREY committed
    
    
                /*jshint forin:false */
                enumeration: for (var key in obj) {
                    if (hasProp.call(obj, key)) {
                        ret.push(key);
                    } else {
                        for (var i = 0; i < excludedPrototypes.length; ++i) {
                            if (hasProp.call(excludedPrototypes[i], key)) {
                                continue enumeration;
                            }
                        }
                        ret.push(key);
                    }
                }
                return ret;
            };
        }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    var thisAssignmentPattern = /this\s*\.\s*\S+\s*=/;
    function isClass(fn) {
        try {
            if (typeof fn === "function") {
                var keys = es5.names(fn.prototype);
    
    Romain CREY's avatar
    Romain CREY committed
    
    
                var hasMethods = es5.isES5 && keys.length > 1;
                var hasMethodsOtherThanConstructor = keys.length > 0 &&
                    !(keys.length === 1 && keys[0] === "constructor");
                var hasThisAssignmentAndStaticMethods =
                    thisAssignmentPattern.test(fn + "") && es5.names(fn).length > 0;
    
    Romain CREY's avatar
    Romain CREY committed
    
    
                if (hasMethods || hasMethodsOtherThanConstructor ||
                    hasThisAssignmentAndStaticMethods) {
                    return true;
                }
            }
            return false;
        } catch (e) {
            return false;
        }
    }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    function toFastProperties(obj) {
        /*jshint -W027,-W055,-W031*/
        function FakeConstructor() {}
        FakeConstructor.prototype = obj;
        var receiver = new FakeConstructor();
        function ic() {
            return typeof receiver.foo;
        }
        ic();
        ic();
        return obj;
        eval(obj);
    }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    var rident = /^[a-z$_][a-z$_0-9]*$/i;
    function isIdentifier(str) {
        return rident.test(str);
    }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    function filledRange(count, prefix, suffix) {
        var ret = new Array(count);
        for(var i = 0; i < count; ++i) {
            ret[i] = prefix + i + suffix;
        }
        return ret;
    }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    function safeToString(obj) {
        try {
            return obj + "";
        } catch (e) {
            return "[no string representation]";
        }
    }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    function isError(obj) {
        return obj instanceof Error ||
            (obj !== null &&
               typeof obj === "object" &&
               typeof obj.message === "string" &&
               typeof obj.name === "string");
    }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    function markAsOriginatingFromRejection(e) {
        try {
            notEnumerableProp(e, "isOperational", true);
        }
        catch(ignore) {}
    
    function originatesFromRejection(e) {
        if (e == null) return false;
        return ((e instanceof Error["__BluebirdErrorTypes__"].OperationalError) ||
            e["isOperational"] === true);
    }
    
    function canAttachTrace(obj) {
        return isError(obj) && es5.propertyIsWritable(obj, "stack");
    }
    
    var ensureErrorObject = (function() {
        if (!("stack" in new Error())) {
            return function(value) {
                if (canAttachTrace(value)) return value;
                try {throw new Error(safeToString(value));}
                catch(err) {return err;}
            };
        } else {
            return function(value) {
                if (canAttachTrace(value)) return value;
                return new Error(safeToString(value));
            };
        }
    })();
    
    function classString(obj) {
        return {}.toString.call(obj);
    }
    
    function copyDescriptors(from, to, filter) {
        var keys = es5.names(from);
        for (var i = 0; i < keys.length; ++i) {
            var key = keys[i];
            if (filter(key)) {
                try {
                    es5.defineProperty(to, key, es5.getDescriptor(from, key));
                } catch (ignore) {}
            }
        }
    }
    
    var asArray = function(v) {
        if (es5.isArray(v)) {
            return v;
        }
        return null;
    
    if (typeof Symbol !== "undefined" && Symbol.iterator) {
        var ArrayFrom = typeof Array.from === "function" ? function(v) {
            return Array.from(v);
        } : function(v) {
            var ret = [];
            var it = v[Symbol.iterator]();
            var itResult;
            while (!((itResult = it.next()).done)) {
                ret.push(itResult.value);
            }
            return ret;
        };
    
        asArray = function(v) {
            if (es5.isArray(v)) {
                return v;
            } else if (v != null && typeof v[Symbol.iterator] === "function") {
                return ArrayFrom(v);
            }
            return null;
        };
    }
    
    var isNode = typeof process !== "undefined" &&
            classString(process).toLowerCase() === "[object process]";
    
    var hasEnvVariables = typeof process !== "undefined" &&
        typeof process.env !== "undefined";
    
    function env(key) {
        return hasEnvVariables ? process.env[key] : undefined;
    }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    function getNativePromise() {
        if (typeof Promise === "function") {
            try {
                var promise = new Promise(function(){});
                if (classString(promise) === "[object Promise]") {
                    return Promise;
                }
            } catch (e) {}
        }
    }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    var reflectHandler;
    function contextBind(ctx, cb) {
        if (ctx === null ||
            typeof cb !== "function" ||
            cb === reflectHandler) {
            return cb;
        }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
        if (ctx.domain !== null) {
            cb = ctx.domain.bind(cb);
        }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
        var async = ctx.async;
        if (async !== null) {
            var old = cb;
            cb = function() {
                var $_len = arguments.length + 2;var args = new Array($_len); for(var $_i = 2; $_i < $_len ; ++$_i) {args[$_i] = arguments[$_i  - 2];};
                args[0] = old;
                args[1] = this;
                return async.runInAsyncScope.apply(async, args);
            };
        }
        return cb;
    }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    var ret = {
        setReflectHandler: function(fn) {
            reflectHandler = fn;
        },
        isClass: isClass,
        isIdentifier: isIdentifier,
        inheritedDataKeys: inheritedDataKeys,
        getDataPropertyOrDefault: getDataPropertyOrDefault,
        thrower: thrower,
        isArray: es5.isArray,
        asArray: asArray,
        notEnumerableProp: notEnumerableProp,
        isPrimitive: isPrimitive,
        isObject: isObject,
        isError: isError,
        canEvaluate: canEvaluate,
        errorObj: errorObj,
        tryCatch: tryCatch,
        inherits: inherits,
        withAppended: withAppended,
        maybeWrapAsError: maybeWrapAsError,
        toFastProperties: toFastProperties,
        filledRange: filledRange,
        toString: safeToString,
        canAttachTrace: canAttachTrace,
        ensureErrorObject: ensureErrorObject,
        originatesFromRejection: originatesFromRejection,
        markAsOriginatingFromRejection: markAsOriginatingFromRejection,
        classString: classString,
        copyDescriptors: copyDescriptors,
        isNode: isNode,
        hasEnvVariables: hasEnvVariables,
        env: env,
        global: globalObject,
        getNativePromise: getNativePromise,
        contextBind: contextBind
    
    Romain CREY's avatar
    Romain CREY committed
    };
    
    ret.isRecentNode = ret.isNode && (function() {
        var version;
        if (process.versions && process.versions.node) {
            version = process.versions.node.split(".").map(Number);
        } else if (process.version) {
            version = process.version.split(".").map(Number);
        }
        return (version[0] === 0 && version[1] > 10) || (version[0] > 0);
    })();
    ret.nodeSupportsAsyncResource = ret.isNode && (function() {
        var supportsAsync = false;
        try {
    
            var res = (__webpack_require__(9).AsyncResource);
    
            supportsAsync = typeof res.prototype.runInAsyncScope === "function";
        } catch (e) {
            supportsAsync = false;
        }
        return supportsAsync;
    })();
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    if (ret.isNode) ret.toFastProperties(process);
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    try {throw new Error(); } catch (e) {ret.lastLineError = e;}