Bones/node_modules/bluebird/js/browser/bluebird.min.js

31 lines
66 KiB
JavaScript
Raw Normal View History

2017-05-17 13:45:25 -04:00
/* @preserve
* The MIT License (MIT)
*
* Copyright (c) 2014 Petka Antonov
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:</p>
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*/
/**
* bluebird build version 2.9.6
* Features enabled: core, race, call_get, generators, map, nodeify, promisify, props, reduce, settle, some, progress, cancel, using, filter, any, each, timers
*/
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.Promise=t()}}(function(){var t,e,r;return function n(t,e,r){function i(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 r=t[s][1][e];return i(r?r:e)},l,l.exports,n,t,e,r)}return e[s].exports}for(var o="function"==typeof _dereq_&&_dereq_,s=0;s<r.length;s++)i(r[s]);return i}({1:[function(t,e){"use strict";e.exports=function(t){function e(t){var e=new r(t),n=e.promise();return e.setHowMany(1),e.setUnwrap(),e.init(),n}var r=t._SomePromiseArray;t.any=function(t){return e(t)},t.prototype.any=function(){return e(this)}}},{}],2:[function(t,e){"use strict";function r(){this._isTickUsed=!1,this._lateQueue=new s(16),this._normalQueue=new s(16);var t=this;this.drainQueues=function(){t._drainQueues()},this._schedule=o.isStatic?o(this.drainQueues):o}var n;try{throw new Error}catch(i){n=i}var o=t("./schedule.js"),s=t("./queue.js"),a="undefined"!=typeof process?process:void 0;r.prototype.haveItemsQueued=function(){return this._normalQueue.length()>0},r.prototype._withDomain=function(t){return void 0===a||null==a.domain||t.domain||(t=a.domain.bind(t)),t},r.prototype.throwLater=function(t,e){if(1===arguments.length&&(e=t,t=function(){throw e}),t=this._withDomain(t),"undefined"!=typeof setTimeout)setTimeout(function(){t(e)},0);else try{this._schedule(function(){t(e)})}catch(r){throw new Error("No async scheduler available\n\n See http://goo.gl/m3OTXk\n")}},r.prototype.invokeLater=function(t,e,r){t=this._withDomain(t),this._lateQueue.push(t,e,r),this._queueTick()},r.prototype.invokeFirst=function(t,e,r){t=this._withDomain(t),this._normalQueue.unshift(t,e,r),this._queueTick()},r.prototype.invoke=function(t,e,r){t=this._withDomain(t),this._normalQueue.push(t,e,r),this._queueTick()},r.prototype.settlePromises=function(t){this._normalQueue._pushOne(t),this._queueTick()},r.prototype._drainQueue=function(t){for(;t.length()>0;){var e=t.shift();if("function"==typeof e){var r=t.shift(),n=t.shift();e.call(r,n)}else e._settlePromises()}},r.prototype._drainQueues=function(){this._drainQueue(this._normalQueue),this._reset(),this._drainQueue(this._lateQueue)},r.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},r.prototype._reset=function(){this._isTickUsed=!1},e.exports=new r,e.exports.firstLineError=n},{"./queue.js":28,"./schedule.js":31}],3:[function(t,e){"use strict";e.exports=function(t,e,r){function n(){return this.value}function i(){throw this.reason}function o(t){return this._then(n,null,null,{value:t},void 0)}function s(t){return this._then(i,i,null,{reason:t},void 0)}function a(t){this._setBoundTo(t)}t.prototype.bind=function(e){var n=r(e);if(n instanceof t){if(!n.isFulfilled()){if(n.isRejected())return t.reject(n.reason());var i=this.then(),u=i;return i=i._then(o,s,null,n,void 0),n._then(a,i._reject,null,i,null),i._cancellable()||i._setPendingCancellationParent(u),i}e=n.value()}var i=this.then();return i._setBoundTo(e),i},t.bind=function(e,r){return t.resolve(r).bind(e)},t.prototype._setPendingCancellationParent=function(t){this._settledValue=t},t.prototype._pendingCancellationParent=function(){if(this.isPending()&&void 0!==this._settledValue){var t=this._settledValue;return t.cancellable(),this._settledValue=void 0,t}},t.prototype._setIsMigratingBinding=function(){this._bitField=8388608|this._bitField},t.prototype._unsetIsMigratingBinding=function(){this._bitField=-8388609&this._bitField},t.prototype._isMigratingBinding=function(){return 8388608===(8388608&this._bitField)},t.prototype._setBoundTo=function(t){this._boundTo=t},t.prototype._isBound=function(){return void 0!==this._boundTo}}},{}],4:[function(t,e){"use strict"
return l._isResolved()&&!l._isSettlePromisesQueued()&&s.invoke(l._settlePromiseAtPostResolution,l,h),u},e.prototype._settlePromiseAtPostResolution=function(t){this._isRejectionUnhandled()&&this._unsetRejectionIsUnhandled(),this._settlePromiseAt(t)},e.prototype._length=function(){return 131071&this._bitField},e.prototype._isFollowingOrFulfilledOrRejected=function(){return(939524096&this._bitField)>0},e.prototype._isFollowing=function(){return 536870912===(536870912&this._bitField)},e.prototype._setLength=function(t){this._bitField=-131072&this._bitField|131071&t},e.prototype._setFulfilled=function(){this._bitField=268435456|this._bitField},e.prototype._setRejected=function(){this._bitField=134217728|this._bitField},e.prototype._setFollowing=function(){this._bitField=536870912|this._bitField},e.prototype._setIsFinal=function(){this._bitField=33554432|this._bitField},e.prototype._isFinal=function(){return(33554432&this._bitField)>0},e.prototype._cancellable=function(){return(67108864&this._bitField)>0},e.prototype._setCancellable=function(){this._bitField=67108864|this._bitField},e.prototype._unsetCancellable=function(){this._bitField=-67108865&this._bitField},e.prototype._isSpreadable=function(){return(131072&this._bitField)>0},e.prototype._setIsSpreadable=function(){this._bitField=131072|this._bitField},e.prototype._setIsMigrated=function(){this._bitField=4194304|this._bitField},e.prototype._unsetIsMigrated=function(){this._bitField=-4194305&this._bitField},e.prototype._isMigrated=function(){return(4194304&this._bitField)>0},e.prototype._receiverAt=function(t){var e=0===t?this._receiver0:this[5*t-5+4];return this._isBound()&&void 0===e?this._boundTo:e},e.prototype._promiseAt=function(t){return 0===t?this._promise0:this[5*t-5+3]},e.prototype._fulfillmentHandlerAt=function(t){return 0===t?this._fulfillmentHandler0:this[5*t-5+0]},e.prototype._rejectionHandlerAt=function(t){return 0===t?this._rejectionHandler0:this[5*t-5+1]},e.prototype._migrateCallbacks=function(t,r){var n=t._fulfillmentHandlerAt(r),i=t._rejectionHandlerAt(r),o=t._progressHandlerAt(r),s=t._promiseAt(r),a=t._receiverAt(r);s instanceof e&&(s._setIsMigrated(),void 0===a&&(a=t,s._setIsMigratingBinding())),this._addCallbacks(n,i,o,s,a)},e.prototype._addCallbacks=function(t,e,r,n,i){var o=this._length();if(o>=131066&&(o=0,this._setLength(0)),0===o)this._promise0=n,void 0!==i&&(this._receiver0=i),"function"!=typeof t||this._isCarryingStackTrace()||(this._fulfillmentHandler0=t),"function"==typeof e&&(this._rejectionHandler0=e),"function"==typeof r&&(this._progressHandler0=r);else{var s=5*o-5;this[s+3]=n,this[s+4]=i,"function"==typeof t&&(this[s+0]=t),"function"==typeof e&&(this[s+1]=e),"function"==typeof r&&(this[s+2]=r)}return this._setLength(o+1),o},e.prototype._setProxyHandlers=function(t,e){var r=this._length();if(r>=131066&&(r=0,this._setLength(0)),0===r)this._promise0=e,this._receiver0=t;else{var n=5*r-5;this[n+3]=e,this[n+4]=t}this._setLength(r+1)},e.prototype._proxyPromiseArray=function(t,e){this._setProxyHandlers(t,e)},e.prototype._resolveCallback=function(t,n){if(!this._isFollowingOrFulfilledOrRejected()){if(t===this)return this._rejectCallback(r(),!1,!0);var i=p(t,this);if(!(i instanceof e))return this._fulfill(t);var o=1|(n?4:0);this._propagateFrom(i,o);var s=i._target();if(s._isPending()){for(var a=this._length(),u=0;a>u;++u)s._migrateCallbacks(this,u);this._setFollowing(),this._setLength(0),this._setFollowee(s)}else s._isFulfilled()?this._fulfillUnchecked(s._value()):this._rejectUnchecked(s._reason(),s._getCarriedStackTrace())}},e.prototype._rejectCallback=function(t,e,r){r||o.markAsOriginatingFromRejection(t);var n=o.ensureErrorObject(t),i=o.canAttachTrace(t)&&"string"==typeof n.stack&&n.stack.length>0;this._attachExtraTrace(n,e?i:!1),this._reject(t,n===t?void 0:n)},e.prototype._resolveFromResolver=function(t){var e=this;this._captureStackTrace(),this._pushContext();var r=!0,n=b(t)(function(t){null!==e&&(e._resolveCallback(t),e=null)},function(t){null!==e&&(e._rejectCallback(t,r),e=null)});r=!1,this._popContext(),void 0!==n&&n===j&&null!==e&&(e._reje
}function b(t){return{}.toString.call(t)}var w=t("./es5.js"),k="undefined"==typeof navigator,E=function(){try{var t={};return w.defineProperty(t,"f",{get:function(){return 3}}),3===t.f}catch(e){return!1}}(),F={e:{}},C,T=function(t,e){function r(){this.constructor=t,this.constructor$=e;for(var r in e.prototype)n.call(e.prototype,r)&&"$"!==r.charAt(r.length-1)&&(this[r+"$"]=e.prototype[r])}var n={}.hasOwnProperty;return r.prototype=e.prototype,t.prototype=new r,t.prototype},x=function(){return"string"!==this}.call("string"),P=function(){return w.isES5?function(t,e){for(var r=[],n=Object.create(null),i=Object(e).includeHidden?Object.getOwnPropertyNames:Object.keys;null!=t;){var o;try{o=i(t)}catch(s){return r}for(var a=0;a<o.length;++a){var u=o[a];if(!n[u]){n[u]=!0;var c=Object.getOwnPropertyDescriptor(t,u);null!=c&&null==c.get&&null==c.set&&r.push(u)}}t=w.getPrototypeOf(t)}return r}:function(t){var e=[];for(var r in t)e.push(r);return e}}(),S=/^[a-z$_][a-z$_0-9]*$/i,R=function(){return"stack"in new Error?function(t){return j(t)?t:new Error(y(t))}:function(t){if(j(t))return t;try{throw new Error(y(t))}catch(e){return e}}}(),A={isClass:f,isIdentifier:d,inheritedDataKeys:P,getDataPropertyOrDefault:l,thrower:p,isArray:w.isArray,haveGetters:E,notEnumerableProp:h,isPrimitive:s,isObject:a,canEvaluate:k,errorObj:F,tryCatch:i,inherits:T,withAppended:c,asString:o,maybeWrapAsError:u,wrapsPrimitiveReceiver:x,toFastProperties:_,filledRange:v,toString:y,canAttachTrace:j,ensureErrorObject:R,originatesFromRejection:m,markAsOriginatingFromRejection:g,classString:b,isNode:"undefined"!=typeof process&&"[object process]"===b(process).toLowerCase()};try{throw new Error}catch(O){A.lastLineError=O}e.exports=A},{"./es5.js":14}]},{},[4])(4)}),"undefined"!=typeof window&&null!==window?window.P=window.Promise:"undefined"!=typeof self&&null!==self&&(self.P=self.Promise);