6 lines
95 KiB
JavaScript
6 lines
95 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(){if(this.isDisposed)throw new Error(Fb)}function c(a,b){if(Gb&&b.stack&&"object"==typeof a&&null!==a&&a.stack&&-1===a.stack.indexOf(Kb)){for(var c=[],e=b;e;e=e.source)e.stack&&c.unshift(e.stack);c.unshift(a.stack);var f=c.join("\n"+Kb+"\n");a.stack=d(f)}}function d(a){for(var b=a.split("\n"),c=[],d=0,g=b.length;g>d;d++){var h=b[d];e(h)||f(h)||!h||c.push(h)}return c.join("\n")}function e(a){var b=h(a);if(!b)return!1;var c=b[0],d=b[1];return c===Ib&&d>=Jb&&Td>=d}function f(a){return-1!==a.indexOf("(module.js:")||-1!==a.indexOf("(node.js:")}function g(){if(Gb)try{throw new Error}catch(a){var b=a.stack.split("\n"),c=b[0].indexOf("@")>0?b[1]:b[2],d=h(c);if(!d)return;return Ib=d[0],d[1]}}function h(a){var b=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(a);if(b)return[b[1],Number(b[2])];var c=/at ([^ ]+):(\d+):(?:\d+)$/.exec(a);if(c)return[c[1],Number(c[2])];var d=/.*@(.+):(\d+)$/.exec(a);return d?[d[1],Number(d[2])]:void 0}function i(a){var b=[];if(!kc(a))return b;jc.nonEnumArgs&&a.length&&lc(a)&&(a=nc.call(a));var c=jc.enumPrototypes&&"function"==typeof a,d=jc.enumErrorProps&&(a===ec||a instanceof Error);for(var e in a)c&&"prototype"==e||d&&("message"==e||"name"==e)||b.push(e);if(jc.nonEnumShadows&&a!==fc){var f=a.constructor,g=-1,h=Sb;if(a===(f&&f.prototype))var i=a===gc?ac:a===ec?Xb:bc.call(a),j=ic[i];for(;++g<h;)e=Rb[g],j&&j[e]||!cc.call(a,e)||b.push(e)}return b}function j(a,b,c){for(var d=-1,e=c(a),f=e.length;++d<f;){var g=e[d];if(b(a[g],g,a)===!1)break}return a}function k(a,b){return j(a,b,i)}function l(a){return"function"!=typeof a.toString&&"string"==typeof(a+"")}function m(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;var e=typeof a,f=typeof b;if(a===a&&(null==a||null==b||"function"!=e&&"object"!=e&&"function"!=f&&"object"!=f))return!1;var g=bc.call(a),h=bc.call(b);if(g==Tb&&(g=$b),h==Tb&&(h=$b),g!=h)return!1;switch(g){case Vb:case Wb:return+a==+b;case Zb:return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case _b:case ac:return a==String(b)}var i=g==Ub;if(!i){if(g!=$b||!jc.nodeClass&&(l(a)||l(b)))return!1;var j=!jc.argsObject&&lc(a)?Object:a.constructor,n=!jc.argsObject&&lc(b)?Object:b.constructor;if(!(j==n||cc.call(a,"constructor")&&cc.call(b,"constructor")||Cb(j)&&j instanceof j&&Cb(n)&&n instanceof n||!("constructor"in a&&"constructor"in b)))return!1}c||(c=[]),d||(d=[]);for(var o=c.length;o--;)if(c[o]==a)return d[o]==b;var p=0,q=!0;if(c.push(a),d.push(b),i){if(o=a.length,p=b.length,q=p==o)for(;p--;){var r=b[p];if(!(q=m(a[p],r,c,d)))break}}else k(b,function(b,e,f){return cc.call(f,e)?(p++,q=cc.call(a,e)&&m(a[e],b,c,d)):void 0}),q&&k(a,function(a,b,c){return cc.call(c,b)?q=--p>-1:void 0});return c.pop(),d.pop(),q}function n(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:nc.call(a)}function o(a,b){for(var c=new Array(a),d=0;a>d;d++)c[d]=b();return c}function p(a,b){this.id=a,this.value=b}function q(a,b){this.scheduler=a,this.disposable=b,this.isDisposed=!1}function r(){this._s=s}function t(){this._s=s,this._l=s.length,this._i=0}function u(a){this._a=a}function v(a){this._a=a,this._l=z(a),this._i=0}function w(a){return"number"==typeof a&&nb.isFinite(a)}function x(b){var c,d=b[Lb];if(!d&&"string"==typeof b)return c=new r(b),c[Lb]();if(!d&&b.length!==a)return c=new u(b),c[Lb]();if(!d)throw new TypeError("Object is not iterable");return b[Lb]()}function y(a){var b=+a;return 0===b?b:isNaN(b)?b:0>b?-1:1}function z(a){var b=+a.length;return isNaN(b)?0:0!==b&&w(b)?(b=y(b)*Math.floor(Math.abs(b)),0>=b?0:b>gd?gd:b):b}function A(a,b){return ub(a)||(a=Hc),new Nd(function(c){var d=0,e=b.length;return a.scheduleRecursive(function(a){e>d?(c.onNext(b[d++]),a()):c.onCompleted()})})}function B(a,b){return new Nd(function(c){var d=new yc,e=new zc;return e.setDisposable(d),d.setDisposable(a.subscribe(c.onNext.bind(c),function(a){var d,f;try{f=b(a)}catch(g){return void c.onError(g)}Ab(f)&&(f=dd(f)),d=new yc,e.setDisposable(d),d.setDisposable(f.subscribe(c))},c.onCompleted.bind(c))),e},a)}function C(a,b){var c=this;return new Nd(function(d){var e=0,f=a.length;return c.subscribe(function(c){if(f>e){var g,h=a[e++];try{g=b(c,h)}catch(i){r
|
||
|
}a()}))},b.prototype.dispose=function(){a.prototype.dispose.call(this),this.disposable.dispose()},b}(Zc),bd=function(a){function b(b,c,d){a.call(this,b,c),this._cancel=d}return oc(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}(ad),cd=sb.Observable=function(){function a(a){if(sb.config.longStackSupport&&Gb){try{throw new Error}catch(b){this.stack=b.stack.substring(b.stack.indexOf("\n")+1)}var d=this;this._subscribe=function(b){var e=b.onError.bind(b);return b.onError=function(a){c(a,d),e(a)},a.call(d,b)}}else this._subscribe=a}return Yc=a.prototype,Yc.subscribe=Yc.forEach=function(a,b,c){return this._subscribe("object"==typeof a?a:Xc(a,b,c))},Yc.subscribeOnNext=function(a,b){return this._subscribe(Xc(2===arguments.length?function(c){a.call(b,c)}:a))},Yc.subscribeOnError=function(a,b){return this._subscribe(Xc(null,2===arguments.length?function(c){a.call(b,c)}:a))},Yc.subscribeOnCompleted=function(a,b){return this._subscribe(Xc(null,null,2===arguments.length?function(){a.call(b)}:a))},a}();Yc.observeOn=function(a){var b=this;return new Nd(function(c){return b.subscribe(new bd(a,c))},b)},Yc.subscribeOn=function(a){var b=this;return new Nd(function(c){var d=new yc,e=new zc;return e.setDisposable(d),d.setDisposable(a.schedule(function(){e.setDisposable(new q(a,b.subscribe(c)))})),e},b)};var dd=cd.fromPromise=function(a){return ed(function(){var b=new sb.AsyncSubject;return a.then(function(a){b.onNext(a),b.onCompleted()},b.onError.bind(b)),b})};Yc.toPromise=function(a){if(a||(a=sb.config.Promise),!a)throw new TypeError("Promise type not provided nor in Rx.config.Promise");var b=this;return new a(function(a,c){var d,e=!1;b.subscribe(function(a){d=a,e=!0},c,function(){e&&a(d)})})},Yc.toArray=function(){var a=this;return new Nd(function(b){var c=[];return a.subscribe(function(a){c.push(a)},function(a){b.onError(a)},function(){b.onNext(c),b.onCompleted()})},a)},cd.create=cd.createWithDisposable=function(a,b){return new Nd(a,b)};var ed=cd.defer=function(a){return new Nd(function(b){var c;try{c=a()}catch(d){return ld(d).subscribe(b)}return Ab(c)&&(c=dd(c)),c.subscribe(b)})},fd=cd.empty=function(a){return ub(a)||(a=Gc),new Nd(function(b){return a.schedule(function(){b.onCompleted()})})},gd=Math.pow(2,53)-1;r.prototype[Lb]=function(){return new t(this._s)},t.prototype[Lb]=function(){return this},t.prototype.next=function(){if(this._i<this._l){var a=this._s.charAt(this._i++);return{done:!1,value:a}}return Mb},u.prototype[Lb]=function(){return new v(this._a)},v.prototype[Lb]=function(){return this},v.prototype.next=function(){if(this._i<this._l){var a=this._a[this._i++];return{done:!1,value:a}}return Mb};var hd=cd.from=function(a,b,c,d){if(null==a)throw new Error("iterable cannot be null.");if(b&&!Cb(b))throw new Error("mapFn when provided must be a function");if(b)var e=Qb(b,c,2);ub(d)||(d=Hc);var f=Object(a),g=x(f);return new Nd(function(a){var b=0;return d.scheduleRecursive(function(c){var d;try{d=g.next()}catch(f){return void a.onError(f)}if(d.done)return void a.onCompleted();var h=d.value;if(e)try{h=e(h,b)}catch(f){return void a.onError(f)}a.onNext(h),b++,c()})})},id=cd.fromArray=function(a,b){return ub(b)||(b=Hc),new Nd(function(c){var d=0,e=a.length;return b.scheduleRecursive(function(b){e>d?(c.onNext(a[d++]),b()):c.onCompleted()})})};cd.generate=function(a,b,c,d,e){return ub(e)||(e=Hc),new Nd(function(f){var g=!0,h=a;return e.scheduleRecursive(function(a){var e,i;try{g?g=!1:h=c(h),e=b(h),e&&(i=d(h))}catch(j){return void f.onError(j)}e?(f.onNext(i),a()):f.onCompleted()})})},cd.of=function(){return A(null,arguments)},cd.ofWithScheduler=function(a){return A(a,nc.call(arguments,1))};var jd=cd.never=function(){return new Nd(function(){return xc})};cd.pairs=function(a,b){return b||(b=sb.Scheduler.currentThread),
|
||
|
var b=this;return Mc.schedule(function(){b.source.request(b.windowSize)}),this.subscription}function c(c,d){a.call(this,b,c),this.source=c,this.windowSize=d}oc(c,a);var d=function(a){function b(a,b,c){this.observer=a,this.observable=b,this.cancel=c,this.received=0}oc(b,a);var c=b.prototype;return c.completed=function(){this.observer.onCompleted(),this.dispose()},c.error=function(a){this.observer.onError(a),this.dispose()},c.next=function(a){if(this.observer.onNext(a),this.received=++this.received%this.observable.windowSize,0===this.received){var b=this;Mc.schedule(function(){b.observable.source.request(b.observable.windowSize)})}},c.dispose=function(){this.observer=null,this.cancel&&(this.cancel.dispose(),this.cancel=null),a.prototype.dispose.call(this)},b}(Zc);return c}(cd);yd.prototype.windowed=function(a){return new Bd(this,a)},Yc.multicast=function(a,b){var c=this;return"function"==typeof a?new Nd(function(d){var e=c.multicast(a());return new tc(b(e).subscribe(d),e.connect())},c):new Fd(c,a)},Yc.publish=function(a){return a&&Cb(a)?this.multicast(function(){return new Qd},a):this.multicast(new Qd)},Yc.share=function(){return this.publish().refCount()},Yc.publishLast=function(a){return a&&Cb(a)?this.multicast(function(){return new Rd},a):this.multicast(new Rd)},Yc.publishValue=function(a,b){return 2===arguments.length?this.multicast(function(){return new Dd(b)},a):this.multicast(new Dd(a))},Yc.shareValue=function(a){return this.publishValue(a).refCount()},Yc.replay=function(a,b,c,d){return a&&Cb(a)?this.multicast(function(){return new Ed(b,c,d)},a):this.multicast(new Ed(b,c,d))},Yc.shareReplay=function(a,b,c){return this.replay(null,a,b,c).refCount()};var Cd=function(a,b){this.subject=a,this.observer=b};Cd.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var a=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(a,1),this.observer=null}};var Dd=sb.BehaviorSubject=function(a){function c(a){return b.call(this),this.isStopped?(this.hasError?a.onError(this.error):a.onCompleted(),xc):(this.observers.push(a),a.onNext(this.value),new Cd(this,a))}function d(b){a.call(this,c),this.value=b,this.observers=[],this.isDisposed=!1,this.isStopped=!1,this.hasError=!1}return oc(d,a),pc(d.prototype,Wc,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(b.call(this),!this.isStopped){this.isStopped=!0;for(var a=0,c=this.observers.slice(0),d=c.length;d>a;a++)c[a].onCompleted();this.observers.length=0}},onError:function(a){if(b.call(this),!this.isStopped){this.isStopped=!0,this.hasError=!0,this.error=a;for(var c=0,d=this.observers.slice(0),e=d.length;e>c;c++)d[c].onError(a);this.observers.length=0}},onNext:function(a){if(b.call(this),!this.isStopped){this.value=a;for(var c=0,d=this.observers.slice(0),e=d.length;e>c;c++)d[c].onNext(a)}},dispose:function(){this.isDisposed=!0,this.observers=null,this.value=null,this.exception=null}}),d}(cd),Ed=sb.ReplaySubject=function(a){function c(a,b){return wc(function(){b.dispose(),!a.isDisposed&&a.observers.splice(a.observers.indexOf(b),1)})}function d(a){var d=new ad(this.scheduler,a),e=c(this,d);b.call(this),this._trim(this.scheduler.now()),this.observers.push(d);for(var f=0,g=this.q.length;g>f;f++)d.onNext(this.q[f].value);return this.hasError?d.onError(this.error):this.isStopped&&d.onCompleted(),d.ensureActive(),e}function e(b,c,e){this.bufferSize=null==b?Number.MAX_VALUE:b,this.windowSize=null==c?Number.MAX_VALUE:c,this.scheduler=e||Hc,this.q=[],this.observers=[],this.isStopped=!1,this.isDisposed=!1,this.hasError=!1,this.error=null,a.call(this,d)}return oc(e,a),pc(e.prototype,Wc.prototype,{hasObservers:function(){return this.observers.length>0},_trim:function(a){for(;this.q.length>this.bufferSize;)this.q.shift();for(;this.q.length>0&&a-this.q[0].interval>this.windowSize;)this.q.shift()},onNext:function(a){if(b.call(this),!this.isStopped){var c=this.scheduler.now();this.q.push({interval:c,value:a}),this._trim(c);for(var d=this.observers.slice(0),e=0,f=d.length;f>e;e++){var g=d[e];g.onNext(a),g.ensureActive()}}},onErr
|
||
|
var d=this.observers.slice(0),c=d.length;if(this.hasValue)for(a=0;c>a;a++){var e=d[a];e.onNext(this.value),e.onCompleted()}else for(a=0;c>a;a++)d[a].onCompleted();this.observers.length=0}},onError:function(a){if(b.call(this),!this.isStopped){var c=this.observers.slice(0);this.isStopped=!0,this.hasError=!0,this.error=a;for(var d=0,e=c.length;e>d;d++)c[d].onError(a);this.observers.length=0}},onNext:function(a){b.call(this),this.isStopped||(this.value=a,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),d}(cd),Sd=sb.AnonymousSubject=function(a){function b(a){this.observable.subscribe(a)}function c(c,d){this.observer=c,this.observable=d,a.call(this,b)}return oc(c,a),pc(c.prototype,Wc.prototype,{onCompleted:function(){this.observer.onCompleted()},onError:function(a){this.observer.onError(a)},onNext:function(a){this.observer.onNext(a)}}),c}(cd);sb.Pauser=function(a){function b(){a.call(this)}return oc(b,a),b.prototype.pause=function(){this.onNext(!1)},b.prototype.resume=function(){this.onNext(!0)},b}(Qd),"function"==typeof define&&"object"==typeof define.amd&&define.amd?(nb.Rx=sb,define(function(){return sb})):ob&&pb?qb?(pb.exports=sb).Rx=sb:ob.Rx=sb:nb.Rx=sb;var Td=g()}).call(this);
|
||
|
//# sourceMappingURL=rx.all.map
|