lunaisadev-website-old/node_modules/rx/dist/rx.lite.extras.min.js

3 lines
9.4 KiB
JavaScript

/* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.*/
(function(a){function b(a){return a&&a.Object===Object?a:null}var c={"function":!0,object:!0},d=c[typeof exports]&&exports&&!exports.nodeType?exports:null,e=c[typeof module]&&module&&!module.nodeType?module:null,f=b(d&&e&&"object"==typeof global&&global),g=b(c[typeof self]&&self),h=b(c[typeof window]&&window),i=(e&&e.exports===d?d:null,b(c[typeof this]&&this)),j=f||h!==(i&&i.window)&&h||g||i||Function("return this")();"function"==typeof define&&define.amd?define(["./rx.lite"],function(b,c){return a(j,c,b)}):"object"==typeof module&&module&&module.exports===d?module.exports=a(j,module.exports,require("rx-lite")):j.Rx=a(j,{},j.Rx)}).call(this,function(a,b,c,d){function e(a){return function(){try{return a.apply(this,arguments)}catch(b){return S.e=b,S}}}function f(a){throw a}function g(a,b){this.scheduler=a,this.disposable=b,this.isDisposed=!1}function h(a,b){b.isDisposed||(b.isDisposed=!0,b.disposable.dispose())}function i(a,b){return a.amb(b)}function j(a){return a.toArray()}function k(a){return a.length>0}function l(a,b,c){for(var d=0,e=a.length;e>d;d++)if(c(a[d],b))return d;return-1}function m(a){this.comparer=a,this.set=[]}var n=c.Observable,o=n.prototype,p=n.never,q=n["throw"],r=c.AnonymousObservable,s=c.ObservableBase,t=c.AnonymousObserver,u=c.Notification.createOnNext,v=c.Notification.createOnError,w=c.Notification.createOnCompleted,x=c.Observer,y=x.create,z=c.internals.AbstractObserver,A=c.Subject,B=c.internals,C=c.helpers,D=B.ScheduledObserver,E=c.SerialDisposable,F=c.SingleAssignmentDisposable,G=(c.CompositeDisposable,c.BinaryDisposable),H=c.RefCountDisposable,I=c.Disposable.empty,J=c.Scheduler.immediate,K=(C.defaultKeySerializer,c.internals.addRef),L=(C.identity,C.isPromise),M=C.isFunction,N=B.inherits,O=B.bindCallback,P=(C.noop,c.Scheduler.isScheduler),Q=n.fromPromise,R=c.ArgumentOutOfRangeError,S={e:{}},T=c.internals.tryCatch=function(a){if(!M(a))throw new TypeError("fn must be a function");return e(a)};g.prototype.dispose=function(){this.scheduler.schedule(this,h)};var U=function(a){function b(b){a.call(this),this._observer=b,this._state=0}N(b,a);var c=b.prototype;return c.onNext=function(a){this.checkAccess();var b=T(this._observer.onNext).call(this._observer,a);this._state=0,b===S&&f(b.e)},c.onError=function(a){this.checkAccess();var b=T(this._observer.onError).call(this._observer,a);this._state=2,b===S&&f(b.e)},c.onCompleted=function(){this.checkAccess();var a=T(this._observer.onCompleted).call(this._observer);this._state=2,a===S&&f(a.e)},c.checkAccess=function(){if(1===this._state)throw new Error("Re-entrancy detected");if(2===this._state)throw new Error("Observer completed");0===this._state&&(this._state=1)},b}(x),V=function(a){function b(b,c,d){a.call(this,b,c),this._cancel=d}return N(b,a),b.prototype.next=function(b){a.prototype.next.call(this,b),this.ensureActive()},b.prototype.error=function(b){a.prototype.error.call(this,b),this.ensureActive()},b.prototype.completed=function(){a.prototype.completed.call(this),this.ensureActive()},b.prototype.dispose=function(){a.prototype.dispose.call(this),this._cancel&&this._cancel.dispose(),this._cancel=null},b}(D);x.prototype.checked=function(){return new U(this)},x.notifyOn=function(a){return new V(a,this)},x.fromNotifier=function(a,b){var c=O(a,b,1);return new t(function(a){return c(u(a))},function(a){return c(v(a))},function(){return c(w())})},x.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},x.prototype.asObserver=function(){var a=this;return new t(function(b){a.onNext(b)},function(b){a.onError(b)},function(){a.onCompleted()})};var W=function(a){function b(b,c){this.source=b,this._s=c,a.call(this)}return N(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new V(this._s,a))},b}(s);o.observeOn=function(a){return new W(this,a)};var X=function(a){function b(b,c){this.source=b,this._s=c,a.call(this)}function c(a,b){var c=b[0],d=b[1],e=b[2];d.setDisposable(new g(a,c.subscribe(e)))}return N(b,a),b.prototype.subscribeCore=function(a){var b=new F,d=new E;return d.setDisposable(b),b.setDisposable(this._s.schedule([this.source,d,a],c)),d},b}(s);o.subscribeOn=function(a){return new X(this,a)};var Y=function(a){function b(b,c,d,e,f){this._initialState=b,this._cndFn=c,this._itrFn=d,this._resFn=e,this._s=f,a.call(this)}function c(a,b){if(a.first)a.first=!1;else if(a.newState=T(a.self._itrFn)(a.newState),a.newState===S)return a.o.onError(a.newState.e);var c=T(a.self._cndFn)(a.newState);if(c===S)return a.o.onError(c.e);if(c){var d=T(a.self._resFn)(a.newState);if(d===S)return a.o.onError(d.e);a.o.onNext(d),b(a)}else a.o.onCompleted()}return N(b,a),b.prototype.subscribeCore=function(a){var b={o:a,self:this,first:!0,newState:this._initialState};return this._s.scheduleRecursive(b,c)},b}(s);n.generate=function(a,b,c,d,e){return P(e)||(e=currentThreadScheduler),new Y(a,b,c,d,e)};var Z=function(a){function b(b,c){this._resFn=b,this._obsFn=c,a.call(this)}return N(b,a),b.prototype.subscribeCore=function(a){var b=I,c=T(this._resFn)();if(c===S)return new G(q(c.e).subscribe(a),b);c&&(b=c);var d=T(this._obsFn)(c);return d===S?new G(q(d.e).subscribe(a),b):new G(d.subscribe(a),b)},b}(s);n.using=function(a,b){return new Z(a,b)},o.amb=function(a){var b=this;return new r(function(c){function d(){f||(f=g,j.dispose())}function e(){f||(f=h,i.dispose())}var f,g="L",h="R",i=new F,j=new F;L(a)&&(a=Q(a));var k=y(function(a){d(),f===g&&c.onNext(a)},function(a){d(),f===g&&c.onError(a)},function(){d(),f===g&&c.onCompleted()}),l=y(function(a){e(),f===h&&c.onNext(a)},function(a){e(),f===h&&c.onError(a)},function(){e(),f===h&&c.onCompleted()});return i.setDisposable(b.subscribe(k)),j.setDisposable(a.subscribe(l)),new G(i,j)})},n.amb=function(){var a,b=p();if(Array.isArray(arguments[0]))a=arguments[0];else{var c=arguments.length;a=new Array(a);for(var d=0;c>d;d++)a[d]=arguments[d]}for(var d=0,c=a.length;c>d;d++)b=i(b,a[d]);return b},o.onErrorResumeNext=function(a){if(!a)throw new Error("Second observable is required");return aa([this,a])};var $=function(a){function b(b){this.sources=b,a.call(this)}function c(a,b){if(a.pos<a.sources.length){var c=a.sources[a.pos++];L(c)&&(c=Q(c));var d=new F;a.subscription.setDisposable(d),d.setDisposable(c.subscribe(new _(a,b)))}else a.o.onCompleted()}return N(b,a),b.prototype.subscribeCore=function(a){var b=new E,d={pos:0,subscription:b,o:a,sources:this.sources},e=J.scheduleRecursive(d,c);return new G(b,e)},b}(s),_=function(a){function b(b,c){this._state=b,this._recurse=c,a.call(this)}return N(b,a),b.prototype.next=function(a){this._state.o.onNext(a)},b.prototype.error=function(){this._recurse(this._state)},b.prototype.completed=function(){this._recurse(this._state)},b}(z),aa=n.onErrorResumeNext=function(){var a=[];if(Array.isArray(arguments[0]))a=arguments[0];else{var b=arguments.length;a=new Array(b);for(var c=0;b>c;c++)a[c]=arguments[c]}return new $(a)};o.bufferWithCount=o.bufferCount=function(a,b){return"number"!=typeof b&&(b=a),this.windowWithCount(a,b).flatMap(j).filter(k)},o.windowWithCount=o.windowCount=function(a,b){var c=this;if(+a||(a=0),Math.abs(a)===1/0&&(a=0),0>=a)throw new R;if(null==b&&(b=a),+b||(b=0),Math.abs(b)===1/0&&(b=0),0>=b)throw new R;return new r(function(d){function e(){var a=new A;i.push(a),d.onNext(K(a,g))}var f=new F,g=new H(f),h=0,i=[];return e(),f.setDisposable(c.subscribe(function(c){for(var d=0,f=i.length;f>d;d++)i[d].onNext(c);var g=h-a+1;g>=0&&g%b===0&&i.shift().onCompleted(),++h%b===0&&e()},function(a){for(;i.length>0;)i.shift().onError(a);d.onError(a)},function(){for(;i.length>0;)i.shift().onCompleted();d.onCompleted()})),g},c)};var ba=function(a){function b(b,c){this._o=b,this._c=c,this._q=[],a.call(this)}return N(b,a),b.prototype.next=function(a){this._q.push(a),this._q.length>this._c&&this._q.shift()},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onNext(this._q),this._o.onCompleted()},b}(z);o.takeLastBuffer=function(a){if(0>a)throw new R;var b=this;return new r(function(c){return b.subscribe(new ba(c,a))},b)};var ca=function(a){function b(b,c){this._o=b,this._d=c,this._f=!1,a.call(this)}return N(b,a),b.prototype.next=function(a){this._f=!0,this._o.onNext(a)},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){!this._f&&this._o.onNext(this._d),this._o.onCompleted()},b}(z);o.defaultIfEmpty=function(a){var b=this;return a===d&&(a=null),new r(function(c){return b.subscribe(new ca(c,a))},b)},m.prototype.push=function(a){var b=-1===l(this.set,a,this.comparer);return b&&this.set.push(a),b};var da=function(a){function b(b,c,d){this.source=b,this._keyFn=c,this._cmpFn=d,a.call(this)}return N(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new ea(a,this._keyFn,this._cmpFn))},b}(s),ea=function(a){function b(b,c,d){this._o=b,this._keyFn=c,this._h=new m(d),a.call(this)}return N(b,a),b.prototype.next=function(a){var b=a;return M(this._keyFn)&&(b=T(this._keyFn)(a),b===S)?this._o.onError(b.e):void(this._h.push(b)&&this._o.onNext(a))},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onCompleted()},b}(z);return o.distinct=function(a,b){return b||(b=defaultComparer),new da(this,a,b)},o.singleInstance=function(){function a(){return d||(d=!0,b=c["finally"](function(){d=!1}).publish().refCount()),b}var b,c=this,d=!1;return new r(function(b){return a().subscribe(b)})},c});
//# sourceMappingURL=rx.lite.extras.map