UNPKG

xrm-webapi-client

Version:
53 lines (51 loc) 140 kB
/*! @preserve * MIT License * * Copyright (c) 2016 Florian Krönert * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * */ /* @preserve * The Bluebird license is included below as Terser keeps removing it (https://github.com/terser/terser/issues/575) */ /* @preserve * The MIT License (MIT) * * Copyright (c) 2013-2018 Petka Antonov * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.WebApiClient=t():e.WebApiClient=t()}(this,(function(){return(()=>{var e={624:(e,t,r)=>{var n;n=function(){var e,t,n;return function e(t,r,n){function i(o,s){if(!r[o]){if(!t[o]){var l="function"==typeof _dereq_&&_dereq_;if(!s&&l)return l(o,!0);if(a)return a(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var c=r[o]={exports:{}};t[o][0].call(c.exports,(function(e){var r=t[o][1][e];return i(r||e)}),c,c.exports,e,t,r,n)}return r[o].exports}for(var a="function"==typeof _dereq_&&_dereq_,o=0;o<n.length;o++)i(n[o]);return i}({1:[function(e,t,r){"use strict";t.exports=function(e){var t=e._SomePromiseArray;function r(e){var r=new t(e),n=r.promise();return r.setHowMany(1),r.setUnwrap(),r.init(),n}e.any=function(e){return r(e)},e.prototype.any=function(){return r(this)}}},{}],2:[function(e,t,r){"use strict";var n;try{throw new Error}catch(e){n=e}var i=e("./schedule"),a=e("./queue");function o(){this._customScheduler=!1,this._isTickUsed=!1,this._lateQueue=new a(16),this._normalQueue=new a(16),this._haveDrainedQueues=!1;var e=this;this.drainQueues=function(){e._drainQueues()},this._schedule=i}function s(e){for(;e.length()>0;)l(e)}function l(e){var t=e.shift();if("function"!=typeof t)t._settlePromises();else{var r=e.shift(),n=e.shift();t.call(r,n)}}o.prototype.setScheduler=function(e){var t=this._schedule;return this._schedule=e,this._customScheduler=!0,t},o.prototype.hasCustomScheduler=function(){return this._customScheduler},o.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues},o.prototype.fatalError=function(e,t){t?(process.stderr.write("Fatal "+(e instanceof Error?e.stack:e)+"\n"),process.exit(2)):this.throwLater(e)},o.prototype.throwLater=function(e,t){if(1===arguments.length&&(t=e,e=function(){throw t}),"undefined"!=typeof setTimeout)setTimeout((function(){e(t)}),0);else try{this._schedule((function(){e(t)}))}catch(e){throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")}},o.prototype.invokeLater=function(e,t,r){this._lateQueue.push(e,t,r),this._queueTick()},o.prototype.invoke=function(e,t,r){this._normalQueue.push(e,t,r),this._queueTick()},o.prototype.settlePromises=function(e){this._normalQueue._pushOne(e),this._queueTick()},o.prototype._drainQueues=function(){s(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,s(this._lateQueue)},o.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},o.prototype._reset=function(){this._isTickUsed=!1},t.exports=o,t.exports.firstLineError=n},{"./queue":26,"./schedule":29}],3:[function(e,t,r){"use strict";t.exports=function(e,t,r,n){var i=!1,a=function(e,t){this._reject(t)},o=function(e,t){t.promiseRejectionQueued=!0,t.bindingPromise._then(a,a,null,this,e)},s=function(e,t){0==(50397184&this._bitField)&&this._resolveCallback(t.target)},l=function(e,t){t.promiseRejectionQueued||this._reject(e)};e.prototype.bind=function(a){i||(i=!0,e.prototype._propagateFrom=n.propagateFromFunction(),e.prototype._boundValue=n.boundValueFunction());var u=r(a),c=new e(t);c._propagateFrom(this,1);var p=this._target();if(c._setBoundTo(u),u instanceof e){var h={promiseRejectionQueued:!1,promise:c,target:p,bindingPromise:u};p._then(t,o,void 0,c,h),u._then(s,l,void 0,c,h),c._setOnCancel(u)}else c._resolveCallback(p);return c},e.prototype._setBoundTo=function(e){void 0!==e?(this._bitField=2097152|this._bitField,this._boundTo=e):this._bitField=-2097153&this._bitField},e.prototype._isBound=function(){return 2097152==(2097152&this._bitField)},e.bind=function(t,r){return e.resolve(r).bind(t)}}},{}],4:[function(e,t,r){"use strict";var n;"undefined"!=typeof Promise&&(n=Promise);var i=e("./promise")();i.noConflict=function(){try{Promise===i&&(Promise=n)}catch(e){}return i},t.exports=i},{"./promise":22}],5:[function(e,t,r){"use strict";var n=Object.create;if(n){var i=n(null),a=n(null);i[" size"]=a[" size"]=0}t.exports=function(t){var r=e("./util"),n=r.canEvaluate;function i(e){var n=function(e,n){var i;if(null!=e&&(i=e[n]),"function"!=typeof i){var a="Object "+r.classString(e)+" has no method '"+r.toString(n)+"'";throw new t.TypeError(a)}return i}(e,this.pop());return n.apply(e,this)}function a(e){return e[this]}function o(e){var t=+this;return t<0&&(t=Math.max(0,t+e.length)),e[t]}r.isIdentifier,t.prototype.call=function(e){var t=[].slice.call(arguments,1);return t.push(e),this._then(i,void 0,void 0,t,void 0)},t.prototype.get=function(e){var t;if("number"==typeof e)t=o;else if(n){var r=(void 0)(e);t=null!==r?r:a}else t=a;return this._then(t,void 0,void 0,e,void 0)}}},{"./util":36}],6:[function(e,t,r){"use strict";t.exports=function(t,r,n,i){var a=e("./util"),o=a.tryCatch,s=a.errorObj,l=t._async;t.prototype.break=t.prototype.cancel=function(){if(!i.cancellation())return this._warn("cancellation is disabled");for(var e=this,t=e;e._isCancellable();){if(!e._cancelBy(t)){t._isFollowing()?t._followee().cancel():t._cancelBranched();break}var r=e._cancellationParent;if(null==r||!r._isCancellable()){e._isFollowing()?e._followee().cancel():e._cancelBranched();break}e._isFollowing()&&e._followee().cancel(),e._setWillBeCancelled(),t=e,e=r}},t.prototype._branchHasCancelled=function(){this._branchesRemainingToCancel--},t.prototype._enoughBranchesHaveCancelled=function(){return void 0===this._branchesRemainingToCancel||this._branchesRemainingToCancel<=0},t.prototype._cancelBy=function(e){return e===this?(this._branchesRemainingToCancel=0,this._invokeOnCancel(),!0):(this._branchHasCancelled(),!!this._enoughBranchesHaveCancelled()&&(this._invokeOnCancel(),!0))},t.prototype._cancelBranched=function(){this._enoughBranchesHaveCancelled()&&this._cancel()},t.prototype._cancel=function(){this._isCancellable()&&(this._setCancelled(),l.invoke(this._cancelPromises,this,void 0))},t.prototype._cancelPromises=function(){this._length()>0&&this._settlePromises()},t.prototype._unsetOnCancel=function(){this._onCancelField=void 0},t.prototype._isCancellable=function(){return this.isPending()&&!this._isCancelled()},t.prototype.isCancellable=function(){return this.isPending()&&!this.isCancelled()},t.prototype._doInvokeOnCancel=function(e,t){if(a.isArray(e))for(var r=0;r<e.length;++r)this._doInvokeOnCancel(e[r],t);else if(void 0!==e)if("function"==typeof e){if(!t){var n=o(e).call(this._boundValue());n===s&&(this._attachExtraTrace(n.e),l.throwLater(n.e))}}else e._resultCancelled(this)},t.prototype._invokeOnCancel=function(){var e=this._onCancel();this._unsetOnCancel(),l.invoke(this._doInvokeOnCancel,this,e)},t.prototype._invokeInternalOnCancel=function(){this._isCancellable()&&(this._doInvokeOnCancel(this._onCancel(),!0),this._unsetOnCancel())},t.prototype._resultCancelled=function(){this.cancel()}}},{"./util":36}],7:[function(e,t,r){"use strict";t.exports=function(t){var r=e("./util"),n=e("./es5").keys,i=r.tryCatch,a=r.errorObj;return function(e,o,s){return function(l){var u=s._boundValue();e:for(var c=0;c<e.length;++c){var p=e[c];if(p===Error||null!=p&&p.prototype instanceof Error){if(l instanceof p)return i(o).call(u,l)}else if("function"==typeof p){var h=i(p).call(u,l);if(h===a)return h;if(h)return i(o).call(u,l)}else if(r.isObject(l)){for(var v=n(p),d=0;d<v.length;++d){var f=v[d];if(p[f]!=l[f])continue e}return i(o).call(u,l)}}return t}}}},{"./es5":13,"./util":36}],8:[function(e,t,r){"use strict";t.exports=function(e){var t=!1,r=[];function n(){this._trace=new n.CapturedTrace(i())}function i(){var e=r.length-1;if(e>=0)return r[e]}return e.prototype._promiseCreated=function(){},e.prototype._pushContext=function(){},e.prototype._popContext=function(){return null},e._peekContext=e.prototype._peekContext=function(){},n.prototype._pushContext=function(){void 0!==this._trace&&(this._trace._promiseCreated=null,r.push(this._trace))},n.prototype._popContext=function(){if(void 0!==this._trace){var e=r.pop(),t=e._promiseCreated;return e._promiseCreated=null,t}return null},n.CapturedTrace=null,n.create=function(){if(t)return new n},n.deactivateLongStackTraces=function(){},n.activateLongStackTraces=function(){var r=e.prototype._pushContext,a=e.prototype._popContext,o=e._peekContext,s=e.prototype._peekContext,l=e.prototype._promiseCreated;n.deactivateLongStackTraces=function(){e.prototype._pushContext=r,e.prototype._popContext=a,e._peekContext=o,e.prototype._peekContext=s,e.prototype._promiseCreated=l,t=!1},t=!0,e.prototype._pushContext=n.prototype._pushContext,e.prototype._popContext=n.prototype._popContext,e._peekContext=e.prototype._peekContext=i,e.prototype._promiseCreated=function(){var e=this._peekContext();e&&null==e._promiseCreated&&(e._promiseCreated=this)}},n}},{}],9:[function(e,t,r){"use strict";t.exports=function(t,r,n,i){var a,o,s,l,u=t._async,c=e("./errors").Warning,p=e("./util"),h=e("./es5"),v=p.canAttachTrace,d=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/,f=/\((?:timers\.js):\d+:\d+\)/,b=/[\/<\(](.+?):(\d+):(\d+)\)?\s*$/,m=null,y=null,_=!1,w=!(0==p.env("BLUEBIRD_DEBUG")),R=!(0==p.env("BLUEBIRD_WARNINGS")||!w&&!p.env("BLUEBIRD_WARNINGS")),g=!(0==p.env("BLUEBIRD_LONG_STACK_TRACES")||!w&&!p.env("BLUEBIRD_LONG_STACK_TRACES")),O=0!=p.env("BLUEBIRD_W_FORGOTTEN_RETURN")&&(R||!!p.env("BLUEBIRD_W_FORGOTTEN_RETURN"));!function(){var e=[];function r(){for(var t=0;t<e.length;++t)e[t]._notifyUnhandledRejection();n()}function n(){e.length=0}l=function(t){e.push(t),setTimeout(r,1)},h.defineProperty(t,"_unhandledRejectionCheck",{value:r}),h.defineProperty(t,"_unhandledRejectionClear",{value:n})}(),t.prototype.suppressUnhandledRejections=function(){var e=this._target();e._bitField=-1048577&e._bitField|524288},t.prototype._ensurePossibleRejectionHandled=function(){0==(524288&this._bitField)&&(this._setRejectionIsUnhandled(),l(this))},t.prototype._notifyUnhandledRejectionIsHandled=function(){W("rejectionHandled",a,void 0,this)},t.prototype._setReturnedNonUndefined=function(){this._bitField=268435456|this._bitField},t.prototype._returnedNonUndefined=function(){return 0!=(268435456&this._bitField)},t.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var e=this._settledValue();this._setUnhandledRejectionIsNotified(),W("unhandledRejection",o,e,this)}},t.prototype._setUnhandledRejectionIsNotified=function(){this._bitField=262144|this._bitField},t.prototype._unsetUnhandledRejectionIsNotified=function(){this._bitField=-262145&this._bitField},t.prototype._isUnhandledRejectionNotified=function(){return(262144&this._bitField)>0},t.prototype._setRejectionIsUnhandled=function(){this._bitField=1048576|this._bitField},t.prototype._unsetRejectionIsUnhandled=function(){this._bitField=-1048577&this._bitField,this._isUnhandledRejectionNotified()&&(this._unsetUnhandledRejectionIsNotified(),this._notifyUnhandledRejectionIsHandled())},t.prototype._isRejectionUnhandled=function(){return(1048576&this._bitField)>0},t.prototype._warn=function(e,t,r){return V(e,t,r||this)},t.onPossiblyUnhandledRejection=function(e){var r=t._getContext();o=p.contextBind(r,e)},t.onUnhandledRejectionHandled=function(e){var r=t._getContext();a=p.contextBind(r,e)};var q=function(){};t.longStackTraces=function(){if(u.haveItemsQueued()&&!te.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");if(!te.longStackTraces&&$()){var e=t.prototype._captureStackTrace,n=t.prototype._attachExtraTrace,i=t.prototype._dereferenceTrace;te.longStackTraces=!0,q=function(){if(u.haveItemsQueued()&&!te.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");t.prototype._captureStackTrace=e,t.prototype._attachExtraTrace=n,t.prototype._dereferenceTrace=i,r.deactivateLongStackTraces(),te.longStackTraces=!1},t.prototype._captureStackTrace=U,t.prototype._attachExtraTrace=B,t.prototype._dereferenceTrace=M,r.activateLongStackTraces()}},t.hasLongStackTraces=function(){return te.longStackTraces&&$()};var T={unhandledrejection:{before:function(){var e=p.global.onunhandledrejection;return p.global.onunhandledrejection=null,e},after:function(e){p.global.onunhandledrejection=e}},rejectionhandled:{before:function(){var e=p.global.onrejectionhandled;return p.global.onrejectionhandled=null,e},after:function(e){p.global.onrejectionhandled=e}}},j=function(){var e=function(e,t){if(!e)return!p.global.dispatchEvent(t);var r;try{return r=e.before(),!p.global.dispatchEvent(t)}finally{e.after(r)}};try{if("function"==typeof CustomEvent){var t=new CustomEvent("CustomEvent");return p.global.dispatchEvent(t),function(t,r){t=t.toLowerCase();var n=new CustomEvent(t,{detail:r,cancelable:!0});return h.defineProperty(n,"promise",{value:r.promise}),h.defineProperty(n,"reason",{value:r.reason}),e(T[t],n)}}return"function"==typeof Event?(t=new Event("CustomEvent"),p.global.dispatchEvent(t),function(t,r){t=t.toLowerCase();var n=new Event(t,{cancelable:!0});return n.detail=r,h.defineProperty(n,"promise",{value:r.promise}),h.defineProperty(n,"reason",{value:r.reason}),e(T[t],n)}):((t=document.createEvent("CustomEvent")).initCustomEvent("testingtheevent",!1,!0,{}),p.global.dispatchEvent(t),function(t,r){t=t.toLowerCase();var n=document.createEvent("CustomEvent");return n.initCustomEvent(t,!1,!0,r),e(T[t],n)})}catch(e){}return function(){return!1}}(),S=p.isNode?function(){return process.emit.apply(process,arguments)}:p.global?function(e){var t="on"+e.toLowerCase(),r=p.global[t];return!!r&&(r.apply(p.global,[].slice.call(arguments,1)),!0)}:function(){return!1};function P(e,t){return{promise:t}}var C={promiseCreated:P,promiseFulfilled:P,promiseRejected:P,promiseResolved:P,promiseCancelled:P,promiseChained:function(e,t,r){return{promise:t,child:r}},warning:function(e,t){return{warning:t}},unhandledRejection:function(e,t,r){return{reason:t,promise:r}},rejectionHandled:P},E=function(e){var t=!1;try{t=S.apply(null,arguments)}catch(e){u.throwLater(e),t=!0}var r=!1;try{r=j(e,C[e].apply(null,arguments))}catch(e){u.throwLater(e),r=!0}return r||t};function k(){return!1}function F(e,t,r){var n=this;try{e(t,r,(function(e){if("function"!=typeof e)throw new TypeError("onCancel must be a function, got: "+p.toString(e));n._attachCancellationCallback(e)}))}catch(e){return e}}function x(e){if(!this._isCancellable())return this;var t=this._onCancel();void 0!==t?p.isArray(t)?t.push(e):this._setOnCancel([t,e]):this._setOnCancel(e)}function A(){return this._onCancelField}function G(e){this._onCancelField=e}function I(){this._cancellationParent=void 0,this._onCancelField=void 0}function D(e,t){if(0!=(1&t)){this._cancellationParent=e;var r=e._branchesRemainingToCancel;void 0===r&&(r=0),e._branchesRemainingToCancel=r+1}0!=(2&t)&&e._isBound()&&this._setBoundTo(e._boundTo)}t.config=function(e){if("longStackTraces"in(e=Object(e))&&(e.longStackTraces?t.longStackTraces():!e.longStackTraces&&t.hasLongStackTraces()&&q()),"warnings"in e){var r=e.warnings;te.warnings=!!r,O=te.warnings,p.isObject(r)&&"wForgottenReturn"in r&&(O=!!r.wForgottenReturn)}if("cancellation"in e&&e.cancellation&&!te.cancellation){if(u.haveItemsQueued())throw new Error("cannot enable cancellation after promises are in use");t.prototype._clearCancellationData=I,t.prototype._propagateFrom=D,t.prototype._onCancel=A,t.prototype._setOnCancel=G,t.prototype._attachCancellationCallback=x,t.prototype._execute=F,N=D,te.cancellation=!0}if("monitoring"in e&&(e.monitoring&&!te.monitoring?(te.monitoring=!0,t.prototype._fireEvent=E):!e.monitoring&&te.monitoring&&(te.monitoring=!1,t.prototype._fireEvent=k)),"asyncHooks"in e&&p.nodeSupportsAsyncResource){var a=te.asyncHooks,o=!!e.asyncHooks;a!==o&&(te.asyncHooks=o,o?n():i())}return t},t.prototype._fireEvent=k,t.prototype._execute=function(e,t,r){try{e(t,r)}catch(e){return e}},t.prototype._onCancel=function(){},t.prototype._setOnCancel=function(e){},t.prototype._attachCancellationCallback=function(e){},t.prototype._captureStackTrace=function(){},t.prototype._attachExtraTrace=function(){},t.prototype._dereferenceTrace=function(){},t.prototype._clearCancellationData=function(){},t.prototype._propagateFrom=function(e,t){};var N=function(e,t){0!=(2&t)&&e._isBound()&&this._setBoundTo(e._boundTo)};function L(){var e=this._boundTo;return void 0!==e&&e instanceof t?e.isFulfilled()?e.value():void 0:e}function U(){this._trace=new Y(this._peekContext())}function B(e,t){if(v(e)){var r=this._trace;if(void 0!==r&&t&&(r=r._parent),void 0!==r)r.attachExtraTrace(e);else if(!e.__stackCleaned__){var n=Q(e);p.notEnumerableProp(e,"stack",n.message+"\n"+n.stack.join("\n")),p.notEnumerableProp(e,"__stackCleaned__",!0)}}}function M(){this._trace=void 0}function V(e,r,n){if(te.warnings){var i,a=new c(e);if(r)n._attachExtraTrace(a);else if(te.longStackTraces&&(i=t._peekContext()))i.attachExtraTrace(a);else{var o=Q(a);a.stack=o.message+"\n"+o.stack.join("\n")}E("warning",a)||K(a,"",!0)}}function H(e){for(var t=[],r=0;r<e.length;++r){var n=e[r],i=" (No stack trace)"===n||m.test(n),a=i&&z(n);i&&!a&&(_&&" "!==n.charAt(0)&&(n=" "+n),t.push(n))}return t}function Q(e){var t=e.stack,r=e.toString();return t="string"==typeof t&&t.length>0?function(e){for(var t=e.stack.replace(/\s+$/g,"").split("\n"),r=0;r<t.length;++r){var n=t[r];if(" (No stack trace)"===n||m.test(n))break}return r>0&&"SyntaxError"!=e.name&&(t=t.slice(r)),t}(e):[" (No stack trace)"],{message:r,stack:"SyntaxError"==e.name?t:H(t)}}function K(e,t,r){if("undefined"!=typeof console){var n;if(p.isObject(e)){var i=e.stack;n=t+y(i,e)}else n=t+String(e);"function"==typeof s?s(n,r):"function"!=typeof console.log&&"object"!=typeof console.log||console.log(n)}}function W(e,t,r,n){var i=!1;try{"function"==typeof t&&(i=!0,"rejectionHandled"===e?t(n):t(r,n))}catch(e){u.throwLater(e)}"unhandledRejection"===e?E(e,r,n)||i||K(r,"Unhandled rejection "):E(e,n)}function X(e){var t;if("function"==typeof e)t="[function "+(e.name||"anonymous")+"]";else{if(t=e&&"function"==typeof e.toString?e.toString():p.toString(e),/\[object [a-zA-Z0-9$_]+\]/.test(t))try{t=JSON.stringify(e)}catch(e){}0===t.length&&(t="(empty array)")}return"(<"+function(e){var t=41;return e.length<t?e:e.substr(0,t-3)+"..."}(t)+">, no stack trace)"}function $(){return"function"==typeof ee}var z=function(){return!1},J=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;function Z(e){var t=e.match(J);if(t)return{fileName:t[1],line:parseInt(t[2],10)}}function Y(e){this._parent=e,this._promisesCreated=0;var t=this._length=1+(void 0===e?0:e._length);ee(this,Y),t>32&&this.uncycle()}p.inherits(Y,Error),r.CapturedTrace=Y,Y.prototype.uncycle=function(){var e=this._length;if(!(e<2)){for(var t=[],r={},n=0,i=this;void 0!==i;++n)t.push(i),i=i._parent;for(n=(e=this._length=n)-1;n>=0;--n){var a=t[n].stack;void 0===r[a]&&(r[a]=n)}for(n=0;n<e;++n){var o=r[t[n].stack];if(void 0!==o&&o!==n){o>0&&(t[o-1]._parent=void 0,t[o-1]._length=1),t[n]._parent=void 0,t[n]._length=1;var s=n>0?t[n-1]:this;o<e-1?(s._parent=t[o+1],s._parent.uncycle(),s._length=s._parent._length+1):(s._parent=void 0,s._length=1);for(var l=s._length+1,u=n-2;u>=0;--u)t[u]._length=l,l++;return}}}},Y.prototype.attachExtraTrace=function(e){if(!e.__stackCleaned__){this.uncycle();for(var t=Q(e),r=t.message,n=[t.stack],i=this;void 0!==i;)n.push(H(i.stack.split("\n"))),i=i._parent;!function(e){for(var t=e[0],r=1;r<e.length;++r){for(var n=e[r],i=t.length-1,a=t[i],o=-1,s=n.length-1;s>=0;--s)if(n[s]===a){o=s;break}for(s=o;s>=0;--s){var l=n[s];if(t[i]!==l)break;t.pop(),i--}t=n}}(n),function(e){for(var t=0;t<e.length;++t)(0===e[t].length||t+1<e.length&&e[t][0]===e[t+1][0])&&(e.splice(t,1),t--)}(n),p.notEnumerableProp(e,"stack",function(e,t){for(var r=0;r<t.length-1;++r)t[r].push("From previous event:"),t[r]=t[r].join("\n");return r<t.length&&(t[r]=t[r].join("\n")),e+"\n"+t.join("\n")}(r,n)),p.notEnumerableProp(e,"__stackCleaned__",!0)}};var ee=function(){var e=/^\s*at\s*/,t=function(e,t){return"string"==typeof e?e:void 0!==t.name&&void 0!==t.message?t.toString():X(t)};if("number"==typeof Error.stackTraceLimit&&"function"==typeof Error.captureStackTrace){Error.stackTraceLimit+=6,m=e,y=t;var r=Error.captureStackTrace;return z=function(e){return d.test(e)},function(e,t){Error.stackTraceLimit+=6,r(e,t),Error.stackTraceLimit-=6}}var n,i=new Error;if("string"==typeof i.stack&&i.stack.split("\n")[0].indexOf("stackDetection@")>=0)return m=/@/,y=t,_=!0,function(e){e.stack=(new Error).stack};try{throw new Error}catch(e){n="stack"in e}return!("stack"in i)&&n&&"number"==typeof Error.stackTraceLimit?(m=e,y=t,function(e){Error.stackTraceLimit+=6;try{throw new Error}catch(t){e.stack=t.stack}Error.stackTraceLimit-=6}):(y=function(e,t){return"string"==typeof e?e:"object"!=typeof t&&"function"!=typeof t||void 0===t.name||void 0===t.message?X(t):t.toString()},null)}();"undefined"!=typeof console&&void 0!==console.warn&&(s=function(e){console.warn(e)},p.isNode&&process.stderr.isTTY?s=function(e,t){var r=t?"":"";console.warn(r+e+"\n")}:p.isNode||"string"!=typeof(new Error).stack||(s=function(e,t){console.warn("%c"+e,t?"color: darkorange":"color: red")}));var te={warnings:R,longStackTraces:!1,cancellation:!1,monitoring:!1,asyncHooks:!1};return g&&t.longStackTraces(),{asyncHooks:function(){return te.asyncHooks},longStackTraces:function(){return te.longStackTraces},warnings:function(){return te.warnings},cancellation:function(){return te.cancellation},monitoring:function(){return te.monitoring},propagateFromFunction:function(){return N},boundValueFunction:function(){return L},checkForgottenReturns:function(e,t,r,n,i){if(void 0===e&&null!==t&&O){if(void 0!==i&&i._returnedNonUndefined())return;if(0==(65535&n._bitField))return;r&&(r+=" ");var a="",o="";if(t._trace){for(var s=t._trace.stack.split("\n"),l=H(s),u=l.length-1;u>=0;--u){var c=l[u];if(!f.test(c)){var p=c.match(b);p&&(a="at "+p[1]+":"+p[2]+":"+p[3]+" ");break}}if(l.length>0){var h=l[0];for(u=0;u<s.length;++u)if(s[u]===h){u>0&&(o="\n"+s[u-1]);break}}}var v="a promise was created in a "+r+"handler "+a+"but was not returned from it, see http://goo.gl/rRqMUw"+o;n._warn(v,!0,t)}},setBounds:function(e,t){if($()){for(var r,n,i=(e.stack||"").split("\n"),a=(t.stack||"").split("\n"),o=-1,s=-1,l=0;l<i.length;++l)if(u=Z(i[l])){r=u.fileName,o=u.line;break}for(l=0;l<a.length;++l){var u;if(u=Z(a[l])){n=u.fileName,s=u.line;break}}o<0||s<0||!r||!n||r!==n||o>=s||(z=function(e){if(d.test(e))return!0;var t=Z(e);return!!(t&&t.fileName===r&&o<=t.line&&t.line<=s)})}},warn:V,deprecated:function(e,t){var r=e+" is deprecated and will be removed in a future version.";return t&&(r+=" Use "+t+" instead."),V(r)},CapturedTrace:Y,fireDomEvent:j,fireGlobalEvent:S}}},{"./errors":12,"./es5":13,"./util":36}],10:[function(e,t,r){"use strict";t.exports=function(e){function t(){return this.value}function r(){throw this.reason}e.prototype.return=e.prototype.thenReturn=function(r){return r instanceof e&&r.suppressUnhandledRejections(),this._then(t,void 0,void 0,{value:r},void 0)},e.prototype.throw=e.prototype.thenThrow=function(e){return this._then(r,void 0,void 0,{reason:e},void 0)},e.prototype.catchThrow=function(e){if(arguments.length<=1)return this._then(void 0,r,void 0,{reason:e},void 0);var t=arguments[1],n=function(){throw t};return this.caught(e,n)},e.prototype.catchReturn=function(r){if(arguments.length<=1)return r instanceof e&&r.suppressUnhandledRejections(),this._then(void 0,t,void 0,{value:r},void 0);var n=arguments[1];n instanceof e&&n.suppressUnhandledRejections();var i=function(){return n};return this.caught(r,i)}}},{}],11:[function(e,t,r){"use strict";t.exports=function(e,t){var r=e.reduce,n=e.all;function i(){return n(this)}e.prototype.each=function(e){return r(this,e,t,0)._then(i,void 0,void 0,this,void 0)},e.prototype.mapSeries=function(e){return r(this,e,t,t)},e.each=function(e,n){return r(e,n,t,0)._then(i,void 0,void 0,e,void 0)},e.mapSeries=function(e,n){return r(e,n,t,t)}}},{}],12:[function(e,t,r){"use strict";var n,i,a=e("./es5"),o=a.freeze,s=e("./util"),l=s.inherits,u=s.notEnumerableProp;function c(e,t){function r(n){if(!(this instanceof r))return new r(n);u(this,"message","string"==typeof n?n:t),u(this,"name",e),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):Error.call(this)}return l(r,Error),r}var p=c("Warning","warning"),h=c("CancellationError","cancellation error"),v=c("TimeoutError","timeout error"),d=c("AggregateError","aggregate error");try{n=TypeError,i=RangeError}catch(e){n=c("TypeError","type error"),i=c("RangeError","range error")}for(var f="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),b=0;b<f.length;++b)"function"==typeof Array.prototype[f[b]]&&(d.prototype[f[b]]=Array.prototype[f[b]]);a.defineProperty(d.prototype,"length",{value:0,configurable:!1,writable:!0,enumerable:!0}),d.prototype.isOperational=!0;var m=0;function y(e){if(!(this instanceof y))return new y(e);u(this,"name","OperationalError"),u(this,"message",e),this.cause=e,this.isOperational=!0,e instanceof Error?(u(this,"message",e.message),u(this,"stack",e.stack)):Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}d.prototype.toString=function(){var e=Array(4*m+1).join(" "),t="\n"+e+"AggregateError of:\n";m++,e=Array(4*m+1).join(" ");for(var r=0;r<this.length;++r){for(var n=this[r]===this?"[Circular AggregateError]":this[r]+"",i=n.split("\n"),a=0;a<i.length;++a)i[a]=e+i[a];t+=(n=i.join("\n"))+"\n"}return m--,t},l(y,Error);var _=Error.__BluebirdErrorTypes__;_||(_=o({CancellationError:h,TimeoutError:v,OperationalError:y,RejectionError:y,AggregateError:d}),a.defineProperty(Error,"__BluebirdErrorTypes__",{value:_,writable:!1,enumerable:!1,configurable:!1})),t.exports={Error,TypeError:n,RangeError:i,CancellationError:_.CancellationError,OperationalError:_.OperationalError,TimeoutError:_.TimeoutError,AggregateError:_.AggregateError,Warning:p}},{"./es5":13,"./util":36}],13:[function(e,t,r){var n=function(){"use strict";return void 0===this}();if(n)t.exports={freeze:Object.freeze,defineProperty:Object.defineProperty,getDescriptor:Object.getOwnPropertyDescriptor,keys:Object.keys,names:Object.getOwnPropertyNames,getPrototypeOf:Object.getPrototypeOf,isArray:Array.isArray,isES5:n,propertyIsWritable:function(e,t){var r=Object.getOwnPropertyDescriptor(e,t);return!(r&&!r.writable&&!r.set)}};else{var i={}.hasOwnProperty,a={}.toString,o={}.constructor.prototype,s=function(e){var t=[];for(var r in e)i.call(e,r)&&t.push(r);return t};t.exports={isArray:function(e){try{return"[object Array]"===a.call(e)}catch(e){return!1}},keys:s,names:s,defineProperty:function(e,t,r){return e[t]=r.value,e},getDescriptor:function(e,t){return{value:e[t]}},freeze:function(e){return e},getPrototypeOf:function(e){try{return Object(e).constructor.prototype}catch(e){return o}},isES5:n,propertyIsWritable:function(){return!0}}}},{}],14:[function(e,t,r){"use strict";t.exports=function(e,t){var r=e.map;e.prototype.filter=function(e,n){return r(this,e,n,t)},e.filter=function(e,n,i){return r(e,n,i,t)}}},{}],15:[function(e,t,r){"use strict";t.exports=function(t,r,n){var i=e("./util"),a=t.CancellationError,o=i.errorObj,s=e("./catch_filter")(n);function l(e,t,r){this.promise=e,this.type=t,this.handler=r,this.called=!1,this.cancelPromise=null}function u(e){this.finallyHandler=e}function c(e,t){return null!=e.cancelPromise&&(arguments.length>1?e.cancelPromise._reject(t):e.cancelPromise._cancel(),e.cancelPromise=null,!0)}function p(){return v.call(this,this.promise._target()._settledValue())}function h(e){if(!c(this,e))return o.e=e,o}function v(e){var i=this.promise,s=this.handler;if(!this.called){this.called=!0;var l=this.isFinallyHandler()?s.call(i._boundValue()):s.call(i._boundValue(),e);if(l===n)return l;if(void 0!==l){i._setReturnedNonUndefined();var v=r(l,i);if(v instanceof t){if(null!=this.cancelPromise){if(v._isCancelled()){var d=new a("late cancellation observer");return i._attachExtraTrace(d),o.e=d,o}v.isPending()&&v._attachCancellationCallback(new u(this))}return v._then(p,h,void 0,this,void 0)}}}return i.isRejected()?(c(this),o.e=e,o):(c(this),e)}return l.prototype.isFinallyHandler=function(){return 0===this.type},u.prototype._resultCancelled=function(){c(this.finallyHandler)},t.prototype._passThrough=function(e,t,r,n){return"function"!=typeof e?this.then():this._then(r,n,void 0,new l(this,t,e),void 0)},t.prototype.lastly=t.prototype.finally=function(e){return this._passThrough(e,0,v,v)},t.prototype.tap=function(e){return this._passThrough(e,1,v)},t.prototype.tapCatch=function(e){var r=arguments.length;if(1===r)return this._passThrough(e,1,void 0,v);var n,a=new Array(r-1),o=0;for(n=0;n<r-1;++n){var l=arguments[n];if(!i.isObject(l))return t.reject(new TypeError("tapCatch statement predicate: expecting an object but got "+i.classString(l)));a[o++]=l}a.length=o;var u=arguments[n];return this._passThrough(s(a,u,this),1,void 0,v)},l}},{"./catch_filter":7,"./util":36}],16:[function(e,t,r){"use strict";t.exports=function(t,r,n,i,a,o){var s=e("./errors").TypeError,l=e("./util"),u=l.errorObj,c=l.tryCatch,p=[];function h(e,r,i,a){if(o.cancellation()){var s=new t(n),l=this._finallyPromise=new t(n);this._promise=s.lastly((function(){return l})),s._captureStackTrace(),s._setOnCancel(this)}else(this._promise=new t(n))._captureStackTrace();this._stack=a,this._generatorFunction=e,this._receiver=r,this._generator=void 0,this._yieldHandlers="function"==typeof i?[i].concat(p):p,this._yieldedPromise=null,this._cancellationPhase=!1}l.inherits(h,a),h.prototype._isResolved=function(){return null===this._promise},h.prototype._cleanup=function(){this._promise=this._generator=null,o.cancellation()&&null!==this._finallyPromise&&(this._finallyPromise._fulfill(),this._finallyPromise=null)},h.prototype._promiseCancelled=function(){if(!this._isResolved()){var e;if(void 0!==this._generator.return)this._promise._pushContext(),e=c(this._generator.return).call(this._generator,void 0),this._promise._popContext();else{var r=new t.CancellationError("generator .return() sentinel");t.coroutine.returnSentinel=r,this._promise._attachExtraTrace(r),this._promise._pushContext(),e=c(this._generator.throw).call(this._generator,r),this._promise._popContext()}this._cancellationPhase=!0,this._yieldedPromise=null,this._continue(e)}},h.prototype._promiseFulfilled=function(e){this._yieldedPromise=null,this._promise._pushContext();var t=c(this._generator.next).call(this._generator,e);this._promise._popContext(),this._continue(t)},h.prototype._promiseRejected=function(e){this._yieldedPromise=null,this._promise._attachExtraTrace(e),this._promise._pushContext();var t=c(this._generator.throw).call(this._generator,e);this._promise._popContext(),this._continue(t)},h.prototype._resultCancelled=function(){if(this._yieldedPromise instanceof t){var e=this._yieldedPromise;this._yieldedPromise=null,e.cancel()}},h.prototype.promise=function(){return this._promise},h.prototype._run=function(){this._generator=this._generatorFunction.call(this._receiver),this._receiver=this._generatorFunction=void 0,this._promiseFulfilled(void 0)},h.prototype._continue=function(e){var r=this._promise;if(e===u)return this._cleanup(),this._cancellationPhase?r.cancel():r._rejectCallback(e.e,!1);var n=e.value;if(!0===e.done)return this._cleanup(),this._cancellationPhase?r.cancel():r._resolveCallback(n);var a=i(n,this._promise);if(a instanceof t||(a=function(e,r,n){for(var a=0;a<r.length;++a){n._pushContext();var o=c(r[a])(e);if(n._popContext(),o===u){n._pushContext();var s=t.reject(u.e);return n._popContext(),s}var l=i(o,n);if(l instanceof t)return l}return null}(a,this._yieldHandlers,this._promise),null!==a)){var o=(a=a._target())._bitField;0==(50397184&o)?(this._yieldedPromise=a,a._proxy(this,null)):0!=(33554432&o)?t._async.invoke(this._promiseFulfilled,this,a._value()):0!=(16777216&o)?t._async.invoke(this._promiseRejected,this,a._reason()):this._promiseCancelled()}else this._promiseRejected(new s("A value %s was yielded that could not be treated as a promise\n\n See http://goo.gl/MqrFmX\n\n".replace("%s",String(n))+"From coroutine:\n"+this._stack.split("\n").slice(1,-7).join("\n")))},t.coroutine=function(e,t){if("function"!=typeof e)throw new s("generatorFunction must be a function\n\n See http://goo.gl/MqrFmX\n");var r=Object(t).yieldHandler,n=h,i=(new Error).stack;return function(){var t=e.apply(this,arguments),a=new n(void 0,void 0,r,i),o=a.promise();return a._generator=t,a._promiseFulfilled(void 0),o}},t.coroutine.addYieldHandler=function(e){if("function"!=typeof e)throw new s("expecting a function but got "+l.classString(e));p.push(e)},t.spawn=function(e){if(o.deprecated("Promise.spawn()","Promise.coroutine()"),"function"!=typeof e)return r("generatorFunction must be a function\n\n See http://goo.gl/MqrFmX\n");var n=new h(e,this),i=n.promise();return n._run(t.spawn),i}}},{"./errors":12,"./util":36}],17:[function(e,t,r){"use strict";t.exports=function(t,r,n,i,a){var o=e("./util");o.canEvaluate,o.tryCatch,o.errorObj,t.join=function(){var e,t=arguments.length-1;t>0&&"function"==typeof arguments[t]&&(e=arguments[t]);var n=[].slice.call(arguments);e&&n.pop();var i=new r(n).promise();return void 0!==e?i.spread(e):i}}},{"./util":36}],18:[function(e,t,r){"use strict";t.exports=function(t,r,n,i,a,o){var s=e("./util"),l=s.tryCatch,u=s.errorObj,c=t._async;function p(e,r,n,i){this.constructor$(e),this._promise._captureStackTrace();var o=t._getContext();if(this._callback=s.contextBind(o,r),this._preservedValues=i===a?new Array(this.length()):null,this._limit=n,this._inFlight=0,this._queue=[],c.invoke(this._asyncInit,this,void 0),s.isArray(e))for(var l=0;l<e.length;++l){var u=e[l];u instanceof t&&u.suppressUnhandledRejections()}}function h(e,r,i,a){if("function"!=typeof r)return n("expecting a function but got "+s.classString(r));var o=0;if(void 0!==i){if("object"!=typeof i||null===i)return t.reject(new TypeError("options argument must be an object but it is "+s.classString(i)));if("number"!=typeof i.concurrency)return t.reject(new TypeError("'concurrency' must be a number but it is "+s.classString(i.concurrency)));o=i.concurrency}return new p(e,r,o="number"==typeof o&&isFinite(o)&&o>=1?o:0,a).promise()}s.inherits(p,r),p.prototype._asyncInit=function(){this._init$(void 0,-2)},p.prototype._init=function(){},p.prototype._promiseFulfilled=function(e,r){var n=this._values,a=this.length(),s=this._preservedValues,c=this._limit;if(r<0){if(n[r=-1*r-1]=e,c>=1&&(this._inFlight--,this._drainQueue(),this._isResolved()))return!0}else{if(c>=1&&this._inFlight>=c)return n[r]=e,this._queue.push(r),!1;null!==s&&(s[r]=e);var p=this._promise,h=this._callback,v=p._boundValue();p._pushContext();var d=l(h).call(v,e,r,a),f=p._popContext();if(o.checkForgottenReturns(d,f,null!==s?"Promise.filter":"Promise.map",p),d===u)return this._reject(d.e),!0;var b=i(d,this._promise);if(b instanceof t){var m=(b=b._target())._bitField;if(0==(50397184&m))return c>=1&&this._inFlight++,n[r]=b,b._proxy(this,-1*(r+1)),!1;if(0==(33554432&m))return 0!=(16777216&m)?(this._reject(b._reason()),!0):(this._cancel(),!0);d=b._value()}n[r]=d}return++this._totalResolved>=a&&(null!==s?this._filter(n,s):this._resolve(n),!0)},p.prototype._drainQueue=function(){for(var e=this._queue,t=this._limit,r=this._values;e.length>0&&this._inFlight<t;){if(this._isResolved())return;var n=e.pop();this._promiseFulfilled(r[n],n)}},p.prototype._filter=function(e,t){for(var r=t.length,n=new Array(r),i=0,a=0;a<r;++a)e[a]&&(n[i++]=t[a]);n.length=i,this._resolve(n)},p.prototype.preservedValues=function(){return this._preservedValues},t.prototype.map=function(e,t){return h(this,e,t,null)},t.map=function(e,t,r,n){return h(e,t,r,n)}}},{"./util":36}],19:[function(e,t,r){"use strict";t.exports=function(t,r,n,i,a){var o=e("./util"),s=o.tryCatch;t.method=function(e){if("function"!=typeof e)throw new t.TypeError("expecting a function but got "+o.classString(e));return function(){var n=new t(r);n._captureStackTrace(),n._pushContext();var i=s(e).apply(this,arguments),o=n._popContext();return a.checkForgottenReturns(i,o,"Promise.method",n),n._resolveFromSyncValue(i),n}},t.attempt=t.try=function(e){if("function"!=typeof e)return i("expecting a function but got "+o.classString(e));var n,l=new t(r);if(l._captureStackTrace(),l._pushContext(),arguments.length>1){a.deprecated("calling Promise.try with more than 1 argument");var u=arguments[1],c=arguments[2];n=o.isArray(u)?s(e).apply(c,u):s(e).call(c,u)}else n=s(e)();var p=l._popContext();return a.checkForgottenReturns(n,p,"Promise.try",l),l._resolveFromSyncValue(n),l},t.prototype._resolveFromSyncValue=function(e){e===o.errorObj?this._rejectCallback(e.e,!1):this._resolveCallback(e,!0)}}},{"./util":36}],20:[function(e,t,r){"use strict";var n=e("./util"),i=n.maybeWrapAsError,a=e("./errors").OperationalError,o=e("./es5"),s=/^(?:name|message|stack|cause)$/;function l(e){var t;if(function(e){return e instanceof Error&&o.getPrototypeOf(e)===Error.prototype}(e)){(t=new a(e)).name=e.name,t.message=e.message,t.stack=e.stack;for(var r=o.keys(e),i=0;i<r.length;++i){var l=r[i];s.test(l)||(t[l]=e[l])}return t}return n.markAsOriginatingFromRejection(e),e}t.exports=function(e,t){return function(r,n){if(null!==e){if(r){var a=l(i(r));e._attachExtraTrace(a),e._reject(a)}else if(t){var o=[].slice.call(arguments,1);e._fulfill(o)}else e._fulfill(n);e=null}}}},{"./errors":12,"./es5":13,"./util":36}],21:[function(e,t,r){"use strict";t.exports=function(t){var r=e("./util"),n=t._async,i=r.tryCatch,a=r.errorObj;function o(e,t){if(!r.isArray(e))return s.call(this,e,t);var o=i(t).apply(this._boundValue(),[null].concat(e));o===a&&n.throwLater(o.e)}function s(e,t){var r=this._boundValue(),o=void 0===e?i(t).call(r,null):i(t).call(r,null,e);o===a&&n.throwLater(o.e)}function l(e,t){if(!e){var r=new Error(e+"");r.cause=e,e=r}var o=i(t).call(this._boundValue(),e);o===a&&n.throwLater(o.e)}t.prototype.asCallback=t.prototype.nodeify=function(e,t){if("function"==typeof e){var r=s;void 0!==t&&Object(t).spread&&(r=o),this._then(r,l,void 0,this,e)}return this}}},{"./util":36}],22:[function(e,t,r){"use strict";t.exports=function(){var r=function(){return new m("circular promise resolution chain\n\n See http://goo.gl/MqrFmX\n")},n=function(){return new F.PromiseInspection(this._target())},i=function(e){return F.reject(new m(e))};function a(){}var o={},s=e("./util");s.setReflectHandler(n);var l=function(){var e=process.domain;return void 0===e?null:e},u=function(){return{domain:l(),async:null}},c=s.isNode&&s.nodeSupportsAsyncResource?e("async_hooks").AsyncResource:null,p=function(){return{domain:l(),async:new c("Bluebird::Promise")}},h=s.isNode?u:function(){return null};s.notEnumerableProp(F,"_getContext",h);var v=e("./es5"),d=e("./async"),f=new d;v.defineProperty(F,"_async",{value:f});var b=e("./errors"),m=F.TypeError=b.TypeError;F.RangeError=b.RangeError;var y=F.CancellationError=b.CancellationError;F.TimeoutError=b.TimeoutError,F.OperationalError=b.OperationalError,F.RejectionError=b.OperationalError,F.AggregateError=b.AggregateError;var _=function(){},w={},R={},g=e("./thenables")(F,_),O=e("./promise_array")(F,_,g,i,a),q=e("./context")(F),T=q.create,j=e("./debuggability")(F,q,(function(){h=p,s.notEnumerableProp(F,"_getContext",p)}),(function(){h=u,s.notEnumerableProp(F,"_getContext",u)})),S=(j.CapturedTrace,e("./finally")(F,g,R)),P=e("./catch_filter")(R),C=e("./nodeback"),E=s.errorObj,k=s.tryCatch;function F(e){e!==_&&function(e,t){if(null==e||e.constructor!==F)throw new m("the promise constructor cannot be invoked directly\n\n See http://goo.gl/MqrFmX\n");if("function"!=typeof t)throw new m("expecting a function but got "+s.classString(t))}(this,e),this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,this._resolveFromExecutor(e),this._promiseCreated(),this._fireEvent("promiseCreated",this)}function x(e){this.promise._resolveCallback(e)}function A(e){this.promise._rejectCallback(e,!1)}function G(e){var t=new F(_);t._fulfillmentHandler0=e,t._rejectionHandler0=e,t._promise0=e,t._receiver0=e}return F.prototype.toString=function(){return"[object Promise]"},F.prototype.caught=F.prototype.catch=function(e){var t=arguments.length;if(t>1){var r,n=new Array(t-1),a=0;for(r=0;r<t-1;++r){var o=arguments[r];if(!s.isObject(o))return i("Catch statement predicate: expecting an object but got "+s.classString(o));n[a++]=o}if(n.length=a,"function"!=typeof(e=arguments[r]))throw new m("The last argument to .catch() must be a function, got "+s.toString(e));return this.then(void 0,P(n,e,this))}return this.then(void 0,e)},F.prototype.reflect=function(){return this._then(n,n,void 0,this,void 0)},F.prototype.then=function(e,t){if(j.warnings()&&arguments.length>0&&"function"!=typeof e&&"function"!=typeof t){var r=".then() only accepts functions but was passed: "+s.classString(e);arguments.length>1&&(r+=", "+s.classString(t)),this._warn(r)}return this._then(e,t,void 0,void 0,void 0)},F.prototype.done=function(e,t){this._then(e,t,void 0,void 0,void 0)._setIsFinal()},F.prototype.spread=function(e){return"function"!=typeof e?i("expecting a function but got "+s.classString(e)):this.all()._then(e,void 0,void 0,w,void 0)},F.prototype.toJSON=function(){var e={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(e.fulfillmentValue=this.value(),e.isFulfilled=!0):this.isRejected()&&(e.rejectionReason=this.reason(),e.isRejected=!0),e},F.prototype.all=function(){return arguments.length>0&&this._warn(".all() was passed arguments but it does not take any"),new O(this).promise()},F.prototype.error=function(e){return this.caught(s.originatesFromRejection,e)},F.getNewLibraryCopy=t.exports,F.is=function(e){return e instanceof F},F.fromNode=F.fromCallback=function(e){var t=new F(_);t._captureStackTrace();var r=arguments.length>1&&!!Object(arguments[1]).multiArgs,n=k(e)(C(t,r));return n===E&&t._rejectCallback(n.e,!0),t._isFateSealed()||t._setAsyncGuaranteed(),t},F.all=function(e){return new O(e).promise()},F.cast=function(e){var t=g(e);return t instanceof F||((t=new F(_))._captureStackTrace(),t._setFulfilled(),t._rejectionHandler0=e),t},F.resolve=F.fulfilled=F.cast,F.reject=F.rejected=function(e){var t=new F(_);return t._captureStackTrace(),t._rejectCallback(e,!0),t},F.setScheduler=function(e){if("function"!=typeof e)throw new m("expecting a function but got "+s.classString(e));return f.setScheduler(e)},F.prototype._then=function(e,t,r,n,i){var a=void 0!==i,o=a?i:new F(_),l=this._target(),u=l._bitField;a||(o._propagateFrom(this,3),o._captureStackTrace(),void 0===n&&0!=(2097152&this._bitField)&&(n=0!=(50397184&u)?this._boundValue():l===this?void 0:this._boundTo),this._fireEvent("promiseChained",this,o));var c=h();if(0!=(50397184&u)){var p,v,d=l._settlePromiseCtx;0!=(33554432&u)?(v=l._rejectionHandler0,p=e):0!=(16777216&u)?(v=l._fulfillmentHandler0,p=t,l._unsetRejectionIsUnhandled()):(d=l._settlePromiseLateCancellationObserver,v=new y("late cancellation observer"),l._attachExtraTrace(v),p=t),f.invoke(d,l,{handler:s.contextBind(c,p),promise:o,receiver:n,value:v})}else l._addCallbacks(e,t,o,n,c);return o},F.prototype._length=function(){return 65535&this._bitField},F.prototype._isFateSealed=function(){return 0!=(117506048&this._bitField)},F.prototype._isFollowing=function(){return 67108864==(67108864&this._bitField)},F.prototype._setLength=function(e){this._bitField=-65536&this._bitField|65535&e},F.prototype._setFulfilled=function(){this._bitField=33554432|this._bitField,this._fireEvent("promiseFulfilled",this)},F.prototype._setRejected=function(){this._bitField=16777216|this._bitField,this._fireEvent("promiseRejected",this)},F.prototype._setFollowing=function(){this._bitField=67108864|this._bitField,this._fireEvent("promiseResolved",this)},F.prototype._setIsFinal=function(){this._bitField=4194304|this._bitField},F.prototype._isFinal=function(){return(4194304&this._bitField)>0},F.prototype._unsetCancelled=function(){this._bitField=-65537&this._bitField},F.prototype._setCancelled=function(){this._bitField=65536|this._bitField,this._fireEvent("promiseCancelled",this)},F.prototype._setWillBeCancelled=function(){this._bitField=8388608|this._bitField},F.prototype._setAsyncGuaranteed=function(){if(!f.hasCustomScheduler()){var e=this._bitField;this._bitField=e|(536870912&e)>>2^134217728}},F.prototype._setNoAsyncGuarantee=function(){this._bitField=-134217729&(536870912|this._bitField)},F.prototype._receiverAt=function(e){var t=0===e?this._receiver0:this[4*e-4+3];if(t!==o)return void 0===t&&this._isBound()?this._boundValue():t},F.prototype._promiseAt=function(e){return this[4*e-4+2]},F.prototype._fulfillmentHandlerAt=function(e){return this[4*e-4+0]},F.prototype._rejectionHandlerAt=function(e){return this[4*e-4+1]},F.prototype._boundValue=function(){},F.prototype._migrateCallback0=function(e){e._bitField;var t=e._fulfillmentHandler0,r=e._rejectionHandler0,n=e._promise0,i=e._receiverAt(0);void 0===i&&(i=o),this._addCallbacks(t,r,n,i,null)},F.prototype._migrateCallbackAt=function(e,t){var r=e._fulfillmentHandlerAt(t),n=e._rejectionHandlerAt(t),i=e._promiseAt(t),a=e._receiverAt(t);void 0===a&&(a=o),this._addCallbacks(r,n,i,a,null)},F.prototype._addCallbacks=function(e,t,r,n,i){var a=this._length();if(a>=65531&&(a=0,this._setLength(0)),0===a)this._promise0=r,this._receiver0=n,"function"==typeof e&&(this._fulfillmentHandler0=s.contextBind(i,e)),"function"==typeof t&&(this._rejectionHandler0=s.contextBind(i,t));else{var o=4*a-4;this[o+2]=r,this[o+3]=n,"function"==typeof e&&(this[o+0]=s.contextBind(i,e)),"function"==typeof t&&(this[o+1]=s.contextBind(i,t))}return this._setLength(a+1),a},F.prototype._proxy=function(e,t){this._addCallbacks(void 0,void 0,t,e,null)},F.prototype._resolveCallback=function(e,t){if(0==(117506048&this._bitField)){if(e===this)return this._rejectCallback(r(),!1);var n=g(e,this);if(!(n instanceof F))return this._fulfill(e);t&&this._propagateFrom(n,2);var i=n._target();if(i!==this){var a=i._bitField;if(0==(50397184&a)){var o=this._length();o>0&&i._migrateCallback0(this);for(var s=1;s<o;++s)i._migrateCallbackAt(this,s);this._setFollowing(),this._setLength(0),this._setFollowee(n)}else if(0!=(33554432&a))this._fulfill(i._value());else if(0!=(16777216&a))this._reject(i._reason());else{var l=new y("late cancellation observer");i._attachExtraTrace(l),this._reject(l)}}else this._reject(r())}},F.prototype._rejectCallback=function(e,t,r){var n=s.ensureErrorObject(e),i=n===e;if(!i&&!r&&j.warnings()){var a="a promise was rejected with a non-error: "+s.classString(e);this._warn(a,!0)}this._attachExtraTrace(n,!!t&&i),this._reject(e)},F.prototype._resolveFromExecutor=function(e){if(e!==_){var t=this;this._captureStackTrace(),this._pushContext();var r=!0,n=this._execute(e,(function(e){t._resolveCallback(e)}),(function(e){t._rejectCallback(e,r)}));r=!1,this._popContext(),void 0!==n&&t._rejectCallback(n,!0)}},F.prototype._settlePromiseFromHandler=function(e,t,r,n){var i=n._bitField;if(0==(65536&i)){var a;n._pushContext(),t===w?r&&"number"==typeof r.length?a=k(e).apply(this._boundValue(),r):(a=E).e=new m("cannot .spread() a non-array: "+s.classString(r)):a=k(e).call(t,r);var o=n._popContext();0==(65536&(i=n._bitField))&&(a===R?n._reject(r):a===E?n._rejectCallback(a.e,!1):(j.checkForgottenReturns(a,o,"",n,this),n._resolveCallback(a)))}},F.prototype._target=function(){for(var e=this;e._isFollowing();)e=e._followee();return e},F.prototype._followee=function()