Comparing version 2.1.14 to 2.1.15
{ | ||
"name": "Rx", | ||
"version": "2.1.14", | ||
"version": "2.1.15", | ||
"main": [ | ||
@@ -5,0 +5,0 @@ "rx.js", |
@@ -5,3 +5,3 @@ { | ||
"description": "Library for composing asynchronous and event-based operations in JavaScript", | ||
"version": "2.1.14", | ||
"version": "2.1.15", | ||
"homepage": "http://rx.codeplex.com", | ||
@@ -8,0 +8,0 @@ "author": { |
@@ -48,6 +48,6 @@ [![Build Status](https://travis-ci.org/Reactive-Extensions/RxJS.png)](https://travis-ci.org/Reactive-Extensions/RxJS) | ||
var keyups = Rx.DOM.fromEvent(input, 'keyup') | ||
.select(function (e) { | ||
.map(function (e) { | ||
return e.target.value; | ||
}) | ||
.where(function (text) { | ||
.filter(function (text) { | ||
return text.length > 2; | ||
@@ -60,3 +60,3 @@ }); | ||
/* Now get only distinct values, so we eliminate the arrows */ | ||
/* Now get only distinct values, so we eliminate the arrows and other control characters */ | ||
var distinct = keyups | ||
@@ -77,12 +77,12 @@ .distinctUntilChanged(); | ||
Once that is created, now we can tie together the distinct throttled input and then query the service. In this case, we'll call select to get the value, and then calling switchLatest to ensure that we're not introducing any out of order sequence calls. We'll filter the results to make sure we get values. | ||
Once that is created, now we can tie together the distinct throttled input and then query the service. In this case, we'll call select to get the value, and then calling `switch` or its alias `switchLatest` to ensure that we're not introducing any out of order sequence calls. We'll filter the results to make sure we get values. | ||
```js | ||
var suggestions = distinct | ||
.select(function (text) { | ||
.map(function (text) { | ||
return searchWikipedia(text); | ||
}) | ||
.switchLatest() | ||
.where(function (data) { | ||
return data.length == 2 && data[1].length > 0; | ||
.filter(function (data) { | ||
return data[1] && data[1].length > 0; | ||
}); | ||
@@ -108,43 +108,48 @@ ``` | ||
## Installation and Usage ## | ||
## RESOURCES | ||
There are multiple ways of getting started with the Reactive Extensions including: | ||
- Blogs | ||
- [Rx Team Blog](http://blogs.msdn.com/b/rxteam) | ||
In a Browser: | ||
- Videos | ||
- [Hello RxJS - Channel 9](http://channel9.msdn.com/Blogs/Charles/Introducing-RxJS-Reactive-Extensions-for-JavaScript) | ||
- [MIX 2011](http://channel9.msdn.com/events/MIX/MIX11/HTM07) | ||
- [RxJS Today and Tomorrow - Channel 9](http://channel9.msdn.com/Blogs/Charles/Matthew-Podwysocki-and-Bart-J-F-De-Smet-RxJS-Today-and-Tomorrow) | ||
- [Cascadia.js 2012](http://www.youtube.com/watch?v=FqBq4uoiG0M) | ||
<script src="rx.js"></script> | ||
- Reference Material | ||
- [Intro to Rx](http://introtorx.com/) | ||
- [101 Rx Samples Wiki](http://rxwiki.wikidot.com/101samples) | ||
Along with a number of our extras for RxJS: | ||
<script src="rx.aggregates.js"></script> | ||
<script src="rx.binding.js"></script> | ||
<script src="rx.coincidencejs"></script> | ||
<script src="rx.experimental.js"></script> | ||
<script src="rx.joinpatterns.js"></script> | ||
<script src="rx.testing.js"></script> | ||
<script src="rx.time.js"></script> | ||
## GETTING STARTED | ||
Installing via [NPM](https://npmjs.org/): | ||
There are a number of ways to get started with RxJS. The files are available on [cdnjs](http://cdnjs.com/) and [jsDelivr](http://www.jsdelivr.com/#!rxjs). | ||
### Download the Source | ||
git clone https://github.com/Reactive-Extensions/rxjs.git | ||
cd ./rxjs | ||
### Installing with [NPM](https://npmjs.org/) | ||
npm install rx | ||
npm install -g rx | ||
### Using with Node.js and Ringo.js | ||
Installing via [Bower](http://bower.io/): | ||
var Rx = require('rx'); | ||
bower install rx | ||
### Installing with [Bower](http://bower.io/) | ||
Installing via [Jam](http://jamjs.org/): | ||
bower install rx | ||
jam install rx | ||
### Installing with [Jam](http://jamjs.org/) | ||
jam install rx | ||
Using in Node.js: | ||
### Installing All of RxJS via [NuGet](http://nuget.org/) | ||
var Rx = require('rx'); | ||
Installing all of RxJS via [NuGet](http://nuget.org/): | ||
Install-Package RxJS-All | ||
Or install via [NuGet](http://nuget.org/) individual packages: | ||
### Install individual packages via [NuGet](http://nuget.org/): | ||
@@ -160,3 +165,18 @@ Install-Package RxJS-Main | ||
Using RxJS with an AMD loader such as Require.js | ||
### In a Browser: | ||
<script src="rx.js"></script> | ||
### Along with a number of our extras for RxJS: | ||
<script src="rx.aggregates.js"></script> | ||
<script src="rx.binding.js"></script> | ||
<script src="rx.coincidencejs"></script> | ||
<script src="rx.experimental.js"></script> | ||
<script src="rx.joinpatterns.js"></script> | ||
<script src="rx.testing.js"></script> | ||
<script src="rx.time.js"></script> | ||
### Using RxJS with an AMD loader such as Require.js | ||
```js | ||
@@ -163,0 +183,0 @@ require({ |
@@ -212,7 +212,8 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. | ||
* @param {Function} [predicate]A function to test each element for a condition. | ||
* @param {Any} [thisArg] Object to use as this when executing callback. | ||
* @returns {Observable} An observable sequence containing a single element with a number that represents how many elements in the input sequence satisfy the condition in the predicate function if provided, else the count of items in the sequence. | ||
*/ | ||
observableProto.count = function (predicate) { | ||
observableProto.count = function (predicate, thisArg) { | ||
return predicate ? | ||
this.where(predicate).count() : | ||
this.where(predicate, thisArg).count() : | ||
this.aggregate(0, function (count) { | ||
@@ -229,8 +230,9 @@ return count + 1; | ||
* @memberOf Observable# | ||
* @param {Function} [selector]A transform function to apply to each element. | ||
* @param {Function} [selector] A transform function to apply to each element.\ | ||
* @param {Any} [thisArg] Object to use as this when executing callback. | ||
* @returns {Observable} An observable sequence containing a single element with the sum of the values in the source sequence. | ||
*/ | ||
observableProto.sum = function (keySelector) { | ||
observableProto.sum = function (keySelector, thisArg) { | ||
return keySelector ? | ||
this.select(keySelector).sum() : | ||
this.select(keySelector, thisArg).sum() : | ||
this.aggregate(0, function (prev, curr) { | ||
@@ -313,7 +315,8 @@ return prev + curr; | ||
* @param {Function} [selector] A transform function to apply to each element. | ||
* @param {Any} [thisArg] Object to use as this when executing callback. | ||
* @returns {Observable} An observable sequence containing a single element with the average of the sequence of values. | ||
*/ | ||
observableProto.average = function (keySelector) { | ||
observableProto.average = function (keySelector, thisArg) { | ||
return keySelector ? | ||
this.select(keySelector).average() : | ||
this.select(keySelector, thisArg).average() : | ||
this.scan({ | ||
@@ -525,7 +528,8 @@ sum: 0, | ||
* @param {Function} [predicate] A predicate function to evaluate for elements in the source sequence. | ||
* @param {Any} [thisArg] Object to use as `this` when executing the predicate. | ||
* @returns {Observable} Sequence containing the single element in the observable sequence that satisfies the condition in the predicate. | ||
*/ | ||
observableProto.single = function (predicate) { | ||
observableProto.single = function (predicate, thisArg) { | ||
if (predicate) { | ||
return this.where(predicate).single(); | ||
return this.where(predicate, thisArg).single(); | ||
} | ||
@@ -546,7 +550,8 @@ return singleOrDefaultAsync(this, false); | ||
* @param [defaultValue] The default value if the index is outside the bounds of the source sequence. | ||
* @param {Any} [thisArg] Object to use as `this` when executing the predicate. | ||
* @returns {Observable} Sequence containing the single element in the observable sequence that satisfies the condition in the predicate, or a default value if no such element exists. | ||
*/ | ||
observableProto.singleOrDefault = function (predicate, defaultValue) { | ||
observableProto.singleOrDefault = function (predicate, defaultValue, thisArg) { | ||
if (predicate) { | ||
return this.where(predicate).singleOrDefault(null, defaultValue); | ||
return this.where(predicate, thisArg).singleOrDefault(null, defaultValue); | ||
} | ||
@@ -580,7 +585,8 @@ return singleOrDefaultAsync(this, true, defaultValue); | ||
* @param {Function} [predicate] A predicate function to evaluate for elements in the source sequence. | ||
* @param {Any} [thisArg] Object to use as `this` when executing the predicate. | ||
* @returns {Observable} Sequence containing the first element in the observable sequence that satisfies the condition in the predicate if provided, else the first item in the sequence. | ||
*/ | ||
observableProto.first = function (predicate) { | ||
observableProto.first = function (predicate, thisArg) { | ||
if (predicate) { | ||
return this.where(predicate).first(); | ||
return this.where(predicate, thisArg).first(); | ||
} | ||
@@ -600,6 +606,7 @@ return firstOrDefaultAsync(this, false); | ||
* @param {Function} [predicate] A predicate function to evaluate for elements in the source sequence. | ||
* @param [defaultValue] The default value if no such element exists. If not specified, defaults to null. | ||
* @param {Any} [defaultValue] The default value if no such element exists. If not specified, defaults to null. | ||
* @param {Any} [thisArg] Object to use as `this` when executing the predicate. | ||
* @returns {Observable} Sequence containing the first element in the observable sequence that satisfies the condition in the predicate, or a default value if no such element exists. | ||
*/ | ||
observableProto.firstOrDefault = function (predicate, defaultValue) { | ||
observableProto.firstOrDefault = function (predicate, defaultValue, thisArg) { | ||
if (predicate) { | ||
@@ -636,7 +643,8 @@ return this.where(predicate).firstOrDefault(null, defaultValue); | ||
* @param {Function} [predicate] A predicate function to evaluate for elements in the source sequence. | ||
* @param {Any} [thisArg] Object to use as `this` when executing the predicate. | ||
* @returns {Observable} Sequence containing the last element in the observable sequence that satisfies the condition in the predicate. | ||
*/ | ||
observableProto.last = function (predicate) { | ||
observableProto.last = function (predicate, thisArg) { | ||
if (predicate) { | ||
return this.where(predicate).last(); | ||
return this.where(predicate, thisArg).last(); | ||
} | ||
@@ -657,7 +665,8 @@ return lastOrDefaultAsync(this, false); | ||
* @param [defaultValue] The default value if no such element exists. If not specified, defaults to null. | ||
* @param {Any} [thisArg] Object to use as `this` when executing the predicate. | ||
* @returns {Observable} Sequence containing the last element in the observable sequence that satisfies the condition in the predicate, or a default value if no such element exists. | ||
*/ | ||
observableProto.lastOrDefault = function (predicate, defaultValue) { | ||
observableProto.lastOrDefault = function (predicate, defaultValue, thisArg) { | ||
if (predicate) { | ||
return this.where(predicate).lastOrDefault(null, defaultValue); | ||
return this.where(predicate, thisArg).lastOrDefault(null, defaultValue); | ||
} | ||
@@ -696,6 +705,7 @@ return lastOrDefaultAsync(this, true, defaultValue); | ||
* @param {Function} predicate The predicate that defines the conditions of the element to search for. | ||
* @param {Any} [thisArg] Object to use as `this` when executing the predicate. | ||
* @returns {Observable} An Observable sequence with the first element that matches the conditions defined by the specified predicate, if found; otherwise, undefined. | ||
*/ | ||
observableProto.find = function (predicate) { | ||
return findValue(this, predicate, arguments[1], false); | ||
observableProto.find = function (predicate, thisArg) { | ||
return findValue(this, predicate, thisArg, false); | ||
}; | ||
@@ -709,8 +719,9 @@ | ||
* @param {Function} predicate The predicate that defines the conditions of the element to search for. | ||
* @param {Any} [thisArg] Object to use as `this` when executing the predicate. | ||
* @returns {Observable} An Observable sequence with the zero-based index of the first occurrence of an element that matches the conditions defined by match, if found; otherwise, –1. | ||
*/ | ||
observableProto.findIndex = function (predicate) { | ||
return findValue(this, predicate, arguments[1], true); | ||
observableProto.findIndex = function (predicate, thisArg) { | ||
return findValue(this, predicate, thisArg, true); | ||
}; | ||
return Rx; | ||
})); |
@@ -1,1 +0,1 @@ | ||
(function(t,e){var n="object"==typeof exports&&exports,r=("object"==typeof module&&module&&module.exports==n&&module,"object"==typeof global&&global);r.global===r&&(window=r),"function"==typeof define&&define.amd?define(["rx","exports"],function(n,r){return t.Rx=e(t,r,n),t.Rx}):"object"==typeof module&&module&&module.exports===n?module.exports=e(t,module.exports,require("./rx")):t.Rx=e(t,{},t.Rx)})(this,function(t,e,n,r){function i(t,e){return w(t,e)}function o(t){return t}function s(t,e){return t>e?1:e>t?-1:0}function u(t,e,n){return new y(function(i){var o=!1,s=null,u=[];return t.subscribe(function(t){var c,a;try{a=e(t)}catch(h){return i.onError(h),r}if(c=0,o)try{c=n(a,s)}catch(l){return i.onError(l),r}else o=!0,s=a;c>0&&(s=a,u=[]),c>=0&&u.push(t)},i.onError.bind(i),function(){i.onNext(u),i.onCompleted()})})}function c(t){if(0===t.length)throw Error(E);return t[0]}function a(t,e,n){return new y(function(i){var o=0,s=e.length;return t.subscribe(function(t){var u=!1;try{s>o&&(u=n(t,e[o++]))}catch(c){return i.onError(c),r}u||(i.onNext(!1),i.onCompleted())},i.onError.bind(i),function(){i.onNext(o===s),i.onCompleted()})})}function h(t,e,n,r){if(0>e)throw Error(g);return new y(function(i){var o=e;return t.subscribe(function(t){0===o&&(i.onNext(t),i.onCompleted()),o--},i.onError.bind(i),function(){n?(i.onNext(r),i.onCompleted()):i.onError(Error(g))})})}function l(t,e,n){return new y(function(r){var i=n,o=!1;return t.subscribe(function(t){o?r.onError(Error("Sequence contains more than one element")):(i=t,o=!0)},r.onError.bind(r),function(){o||e?(r.onNext(i),r.onCompleted()):r.onError(Error(E))})})}function f(t,e,n){return new y(function(r){return t.subscribe(function(t){r.onNext(t),r.onCompleted()},r.onError.bind(r),function(){e?(r.onNext(n),r.onCompleted()):r.onError(Error(E))})})}function p(t,e,n){return new y(function(r){var i=n,o=!1;return t.subscribe(function(t){i=t,o=!0},r.onError.bind(r),function(){o||e?(r.onNext(i),r.onCompleted()):r.onError(Error(E))})})}function d(t,e,n,i){return new y(function(o){var s=0;return t.subscribe(function(u){var c;try{c=e.call(n,u,s,t)}catch(a){return o.onError(a),r}c?(o.onNext(i?s:u),o.onCompleted()):s++},o.onError.bind(o),function(){o.onNext(i?-1:r),o.onCompleted()})})}var b=n.Observable,v=b.prototype,m=n.CompositeDisposable,y=n.Internals.AnonymousObservable,w=n.Internals.isEqual,g="Argument out of range",E="Sequence contains no elements.";return v.aggregate=function(){var t,e,n;return 2===arguments.length?(t=arguments[0],e=!0,n=arguments[1]):n=arguments[0],e?this.scan(t,n).startWith(t).finalValue():this.scan(n).finalValue()},v.reduce=function(){var t,e,n=arguments[0];return 2===arguments.length&&(e=!0,t=arguments[1]),e?this.scan(t,n).startWith(t).finalValue():this.scan(n).finalValue()},v.any=function(t,e){var n=this;return t?n.where(t,e).any():new y(function(t){return n.subscribe(function(){t.onNext(!0),t.onCompleted()},t.onError.bind(t),function(){t.onNext(!1),t.onCompleted()})})},v.some=v.any,v.isEmpty=function(){return this.any().select(function(t){return!t})},v.all=function(t,e){return this.where(function(e){return!t(e)},e).any().select(function(t){return!t})},v.every=v.all,v.contains=function(t,e){return e||(e=i),this.where(function(n){return e(n,t)}).any()},v.count=function(t){return t?this.where(t).count():this.aggregate(0,function(t){return t+1})},v.sum=function(t){return t?this.select(t).sum():this.aggregate(0,function(t,e){return t+e})},v.minBy=function(t,e){return e||(e=s),u(this,t,function(t,n){return-1*e(t,n)})},v.min=function(t){return this.minBy(o,t).select(function(t){return c(t)})},v.maxBy=function(t,e){return e||(e=s),u(this,t,e)},v.max=function(t){return this.maxBy(o,t).select(function(t){return c(t)})},v.average=function(t){return t?this.select(t).average():this.scan({sum:0,count:0},function(t,e){return{sum:t.sum+e,count:t.count+1}}).finalValue().select(function(t){return t.sum/t.count})},v.sequenceEqual=function(t,e){var n=this;return e||(e=i),Array.isArray(t)?a(n,t,e):new y(function(i){var o=!1,s=!1,u=[],c=[],a=n.subscribe(function(t){var n,o;if(c.length>0){o=c.shift();try{n=e(o,t)}catch(a){return i.onError(a),r}n||(i.onNext(!1),i.onCompleted())}else s?(i.onNext(!1),i.onCompleted()):u.push(t)},i.onError.bind(i),function(){o=!0,0===u.length&&(c.length>0?(i.onNext(!1),i.onCompleted()):s&&(i.onNext(!0),i.onCompleted()))}),h=t.subscribe(function(t){var n,s;if(u.length>0){s=u.shift();try{n=e(s,t)}catch(a){return i.onError(a),r}n||(i.onNext(!1),i.onCompleted())}else o?(i.onNext(!1),i.onCompleted()):c.push(t)},i.onError.bind(i),function(){s=!0,0===c.length&&(u.length>0?(i.onNext(!1),i.onCompleted()):o&&(i.onNext(!0),i.onCompleted()))});return new m(a,h)})},v.elementAt=function(t){return h(this,t,!1)},v.elementAtOrDefault=function(t,e){return h(this,t,!0,e)},v.single=function(t){return t?this.where(t).single():l(this,!1)},v.singleOrDefault=function(t,e){return t?this.where(t).singleOrDefault(null,e):l(this,!0,e)},v.first=function(t){return t?this.where(t).first():f(this,!1)},v.firstOrDefault=function(t,e){return t?this.where(t).firstOrDefault(null,e):f(this,!0,e)},v.last=function(t){return t?this.where(t).last():p(this,!1)},v.lastOrDefault=function(t,e){return t?this.where(t).lastOrDefault(null,e):p(this,!0,e)},v.find=function(t){return d(this,t,arguments[1],!1)},v.findIndex=function(t){return d(this,t,arguments[1],!0)},n}); | ||
(function(t,e){var n="object"==typeof exports&&exports,r=("object"==typeof module&&module&&module.exports==n&&module,"object"==typeof global&&global);r.global===r&&(window=r),"function"==typeof define&&define.amd?define(["rx","exports"],function(n,r){return t.Rx=e(t,r,n),t.Rx}):"object"==typeof module&&module&&module.exports===n?module.exports=e(t,module.exports,require("./rx")):t.Rx=e(t,{},t.Rx)})(this,function(t,e,n,r){function i(t,e){return w(t,e)}function o(t){return t}function s(t,e){return t>e?1:e>t?-1:0}function u(t,e,n){return new y(function(i){var o=!1,s=null,u=[];return t.subscribe(function(t){var c,a;try{a=e(t)}catch(h){return i.onError(h),r}if(c=0,o)try{c=n(a,s)}catch(l){return i.onError(l),r}else o=!0,s=a;c>0&&(s=a,u=[]),c>=0&&u.push(t)},i.onError.bind(i),function(){i.onNext(u),i.onCompleted()})})}function c(t){if(0===t.length)throw Error(E);return t[0]}function a(t,e,n){return new y(function(i){var o=0,s=e.length;return t.subscribe(function(t){var u=!1;try{s>o&&(u=n(t,e[o++]))}catch(c){return i.onError(c),r}u||(i.onNext(!1),i.onCompleted())},i.onError.bind(i),function(){i.onNext(o===s),i.onCompleted()})})}function h(t,e,n,r){if(0>e)throw Error(g);return new y(function(i){var o=e;return t.subscribe(function(t){0===o&&(i.onNext(t),i.onCompleted()),o--},i.onError.bind(i),function(){n?(i.onNext(r),i.onCompleted()):i.onError(Error(g))})})}function l(t,e,n){return new y(function(r){var i=n,o=!1;return t.subscribe(function(t){o?r.onError(Error("Sequence contains more than one element")):(i=t,o=!0)},r.onError.bind(r),function(){o||e?(r.onNext(i),r.onCompleted()):r.onError(Error(E))})})}function f(t,e,n){return new y(function(r){return t.subscribe(function(t){r.onNext(t),r.onCompleted()},r.onError.bind(r),function(){e?(r.onNext(n),r.onCompleted()):r.onError(Error(E))})})}function p(t,e,n){return new y(function(r){var i=n,o=!1;return t.subscribe(function(t){i=t,o=!0},r.onError.bind(r),function(){o||e?(r.onNext(i),r.onCompleted()):r.onError(Error(E))})})}function d(t,e,n,i){return new y(function(o){var s=0;return t.subscribe(function(u){var c;try{c=e.call(n,u,s,t)}catch(a){return o.onError(a),r}c?(o.onNext(i?s:u),o.onCompleted()):s++},o.onError.bind(o),function(){o.onNext(i?-1:r),o.onCompleted()})})}var b=n.Observable,v=b.prototype,m=n.CompositeDisposable,y=n.Internals.AnonymousObservable,w=n.Internals.isEqual,g="Argument out of range",E="Sequence contains no elements.";return v.aggregate=function(){var t,e,n;return 2===arguments.length?(t=arguments[0],e=!0,n=arguments[1]):n=arguments[0],e?this.scan(t,n).startWith(t).finalValue():this.scan(n).finalValue()},v.reduce=function(){var t,e,n=arguments[0];return 2===arguments.length&&(e=!0,t=arguments[1]),e?this.scan(t,n).startWith(t).finalValue():this.scan(n).finalValue()},v.any=function(t,e){var n=this;return t?n.where(t,e).any():new y(function(t){return n.subscribe(function(){t.onNext(!0),t.onCompleted()},t.onError.bind(t),function(){t.onNext(!1),t.onCompleted()})})},v.some=v.any,v.isEmpty=function(){return this.any().select(function(t){return!t})},v.all=function(t,e){return this.where(function(e){return!t(e)},e).any().select(function(t){return!t})},v.every=v.all,v.contains=function(t,e){return e||(e=i),this.where(function(n){return e(n,t)}).any()},v.count=function(t,e){return t?this.where(t,e).count():this.aggregate(0,function(t){return t+1})},v.sum=function(t,e){return t?this.select(t,e).sum():this.aggregate(0,function(t,e){return t+e})},v.minBy=function(t,e){return e||(e=s),u(this,t,function(t,n){return-1*e(t,n)})},v.min=function(t){return this.minBy(o,t).select(function(t){return c(t)})},v.maxBy=function(t,e){return e||(e=s),u(this,t,e)},v.max=function(t){return this.maxBy(o,t).select(function(t){return c(t)})},v.average=function(t,e){return t?this.select(t,e).average():this.scan({sum:0,count:0},function(t,e){return{sum:t.sum+e,count:t.count+1}}).finalValue().select(function(t){return t.sum/t.count})},v.sequenceEqual=function(t,e){var n=this;return e||(e=i),Array.isArray(t)?a(n,t,e):new y(function(i){var o=!1,s=!1,u=[],c=[],a=n.subscribe(function(t){var n,o;if(c.length>0){o=c.shift();try{n=e(o,t)}catch(a){return i.onError(a),r}n||(i.onNext(!1),i.onCompleted())}else s?(i.onNext(!1),i.onCompleted()):u.push(t)},i.onError.bind(i),function(){o=!0,0===u.length&&(c.length>0?(i.onNext(!1),i.onCompleted()):s&&(i.onNext(!0),i.onCompleted()))}),h=t.subscribe(function(t){var n,s;if(u.length>0){s=u.shift();try{n=e(s,t)}catch(a){return i.onError(a),r}n||(i.onNext(!1),i.onCompleted())}else o?(i.onNext(!1),i.onCompleted()):c.push(t)},i.onError.bind(i),function(){s=!0,0===c.length&&(u.length>0?(i.onNext(!1),i.onCompleted()):o&&(i.onNext(!0),i.onCompleted()))});return new m(a,h)})},v.elementAt=function(t){return h(this,t,!1)},v.elementAtOrDefault=function(t,e){return h(this,t,!0,e)},v.single=function(t,e){return t?this.where(t,e).single():l(this,!1)},v.singleOrDefault=function(t,e,n){return t?this.where(t,n).singleOrDefault(null,e):l(this,!0,e)},v.first=function(t,e){return t?this.where(t,e).first():f(this,!1)},v.firstOrDefault=function(t,e){return t?this.where(t).firstOrDefault(null,e):f(this,!0,e)},v.last=function(t,e){return t?this.where(t,e).last():p(this,!1)},v.lastOrDefault=function(t,e,n){return t?this.where(t,n).lastOrDefault(null,e):p(this,!0,e)},v.find=function(t,e){return d(this,t,e,!1)},v.findIndex=function(t,e){return d(this,t,e,!0)},n}); |
@@ -573,14 +573,3 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. | ||
observableProto.buffer = function (bufferOpeningsOrClosingSelector, bufferClosingSelector) { | ||
if (arguments.length === 1 && typeof arguments[0] !== 'function') { | ||
return observableWindowWithBounaries.call(this, bufferOpeningsOrClosingSelector).selectMany(function (item) { | ||
return item.toArray(); | ||
}); | ||
} | ||
return typeof bufferOpeningsOrClosingSelector === 'function' ? | ||
observableWindowWithClosingSelector.call(this, bufferOpeningsOrClosingSelector).selectMany(function (item) { | ||
return item.toArray(); | ||
}) : | ||
observableWindowWithOpenings.call(this, bufferOpeningsOrClosingSelector, bufferClosingSelector).selectMany(function (item) { | ||
return item.toArray(); | ||
}); | ||
return this.window.apply(this, arguments).selectMany(function (x) { return x.toArray(); }); | ||
}; | ||
@@ -587,0 +576,0 @@ |
@@ -1,1 +0,1 @@ | ||
(function(t,e){var n="object"==typeof exports&&exports,r=("object"==typeof module&&module&&module.exports==n&&module,"object"==typeof global&&global);r.global===r&&(window=r),"function"==typeof define&&define.amd?define(["rx","exports"],function(n,r){return t.Rx=e(t,r,n),t.Rx}):"object"==typeof module&&module&&module.exports===n?module.exports=e(t,module.exports,require("./rx")):t.Rx=e(t,{},t.Rx)})(this,function(t,e,n,r){function i(){}function o(t,e){return t===e}function s(t){if(false&t)return 2===t;for(var e=Math.sqrt(t),n=3;e>=n;){if(0===t%n)return!1;n+=2}return!0}function u(t){var e,n,r;for(e=0;D.length>e;++e)if(n=D[e],n>=t)return n;for(r=1|t;D[D.length-1]>r;){if(s(r))return r;r+=2}return t}function c(t){var e=757602046;if(!t.length)return e;for(var n=0,r=t.length;r>n;n++){var i=t.charCodeAt(n);e=(e<<5)-e+i,e&=e}return e}function a(t){var e=668265261;return t=61^t^t>>>16,t+=t<<3,t^=t>>>4,t*=e,t^=t>>>15}function h(){return{key:null,value:null,next:0,hashCode:0}}function l(t,e){return t.groupJoin(this,e,function(){return E()},function(t,e){return e})}function f(t){var e=this;return new x(function(n){var r=new w,i=new b,o=new v(i);return n.onNext(C(r,o)),i.add(e.subscribe(function(t){r.onNext(t)},function(t){r.onError(t),n.onError(t)},function(){r.onCompleted(),n.onCompleted()})),i.add(t.subscribe(function(){r.onCompleted(),r=new w,n.onNext(C(r,o))},function(t){r.onError(t),n.onError(t)},function(){r.onCompleted(),n.onCompleted()})),o})}function p(t){var e=this;return new x(function(n){var o,s=new y,u=new b(s),c=new v(u),a=new w;return n.onNext(C(a,c)),u.add(e.subscribe(function(t){a.onNext(t)},function(t){a.onError(t),n.onError(t)},function(){a.onCompleted(),n.onCompleted()})),o=function(){var e,u;try{u=t()}catch(h){return n.onError(h),r}e=new m,s.disposable(e),e.disposable(u.take(1).subscribe(i,function(t){a.onError(t),n.onError(t)},function(){a.onCompleted(),a=new w,n.onNext(C(a,c)),o()}))},o(),c})}var d=n.Observable,b=n.CompositeDisposable,v=n.RefCountDisposable,m=n.SingleAssignmentDisposable,y=n.SerialDisposable,w=n.Subject,g=d.prototype,E=d.empty,x=n.Internals.AnonymousObservable,C=(n.Observer.create,n.Internals.addRef),D=[1,3,7,13,31,61,127,251,509,1021,2039,4093,8191,16381,32749,65521,131071,262139,524287,1048573,2097143,4194301,8388593,16777213,33554393,67108859,134217689,268435399,536870909,1073741789,2147483647],A="no such key",S="duplicate key",N=function(){var t=0;return function(e){if(null==e)throw Error(A);if("string"==typeof e)return c(e);if("number"==typeof e)return a(e);if("boolean"==typeof e)return e===!0?1:0;if(e instanceof Date)return e.getTime();if(e.getHashCode)return e.getHashCode();var n=17*t++;return e.getHashCode=function(){return n},n}}(),_=function(t,e){if(0>t)throw Error("out of range");t>0&&this._initialize(t),this.comparer=e||o,this.freeCount=0,this.size=0,this.freeList=-1};return _.prototype._initialize=function(t){var e,n=u(t);for(this.buckets=Array(n),this.entries=Array(n),e=0;n>e;e++)this.buckets[e]=-1,this.entries[e]=h();this.freeList=-1},_.prototype.count=function(){return this.size},_.prototype.add=function(t,e){return this._insert(t,e,!0)},_.prototype._insert=function(t,e,n){this.buckets||this._initialize(0);for(var i,o=2147483647&N(t),s=o%this.buckets.length,u=this.buckets[s];u>=0;u=this.entries[u].next)if(this.entries[u].hashCode===o&&this.comparer(this.entries[u].key,t)){if(n)throw Error(S);return this.entries[u].value=e,r}this.freeCount>0?(i=this.freeList,this.freeList=this.entries[i].next,--this.freeCount):(this.size===this.entries.length&&(this._resize(),s=o%this.buckets.length),i=this.size,++this.size),this.entries[i].hashCode=o,this.entries[i].next=this.buckets[s],this.entries[i].key=t,this.entries[i].value=e,this.buckets[s]=i},_.prototype._resize=function(){var t=u(2*this.size),e=Array(t);for(r=0;e.length>r;++r)e[r]=-1;var n=Array(t);for(r=0;this.size>r;++r)n[r]=this.entries[r];for(var r=this.size;t>r;++r)n[r]=h();for(var i=0;this.size>i;++i){var o=n[i].hashCode%t;n[i].next=e[o],e[o]=i}this.buckets=e,this.entries=n},_.prototype.remove=function(t){if(this.buckets)for(var e=2147483647&N(t),n=e%this.buckets.length,r=-1,i=this.buckets[n];i>=0;i=this.entries[i].next){if(this.entries[i].hashCode===e&&this.comparer(this.entries[i].key,t))return 0>r?this.buckets[n]=this.entries[i].next:this.entries[r].next=this.entries[i].next,this.entries[i].hashCode=-1,this.entries[i].next=this.freeList,this.entries[i].key=null,this.entries[i].value=null,this.freeList=i,++this.freeCount,!0;r=i}return!1},_.prototype.clear=function(){var t,e;if(!(0>=this.size)){for(t=0,e=this.buckets.length;e>t;++t)this.buckets[t]=-1;for(t=0;this.size>t;++t)this.entries[t]=h();this.freeList=-1,this.size=0}},_.prototype._findEntry=function(t){if(this.buckets)for(var e=2147483647&N(t),n=this.buckets[e%this.buckets.length];n>=0;n=this.entries[n].next)if(this.entries[n].hashCode===e&&this.comparer(this.entries[n].key,t))return n;return-1},_.prototype.count=function(){return this.size-this.freeCount},_.prototype.tryGetValue=function(t){var e=this._findEntry(t);return e>=0?this.entries[e].value:r},_.prototype.getValues=function(){var t=0,e=[];if(this.entries)for(var n=0;this.size>n;n++)this.entries[n].hashCode>=0&&(e[t++]=this.entries[n].value);return e},_.prototype.get=function(t){var e=this._findEntry(t);if(e>=0)return this.entries[e].value;throw Error(A)},_.prototype.set=function(t,e){this._insert(t,e,!1)},_.prototype.containskey=function(t){return this._findEntry(t)>=0},g.join=function(t,e,n,o){var s=this;return new x(function(u){var c=new b,a=!1,h=0,l=new _,f=!1,p=0,d=new _;return c.add(s.subscribe(function(t){var n,s,f,p,b=h++,v=new m;l.add(b,t),c.add(v),s=function(){return l.remove(b)&&0===l.count()&&a&&u.onCompleted(),c.remove(v)};try{n=e(t)}catch(y){return u.onError(y),r}v.disposable(n.take(1).subscribe(i,u.onError.bind(u),function(){s()})),p=d.getValues();for(var w=0;p.length>w;w++){try{f=o(t,p[w])}catch(g){return u.onError(g),r}u.onNext(f)}},u.onError.bind(u),function(){a=!0,(f||0===l.count())&&u.onCompleted()})),c.add(t.subscribe(function(t){var e,s,a,h,b=p++,v=new m;d.add(b,t),c.add(v),s=function(){return d.remove(b)&&0===d.count()&&f&&u.onCompleted(),c.remove(v)};try{e=n(t)}catch(y){return u.onError(y),r}v.disposable(e.take(1).subscribe(i,u.onError.bind(u),function(){s()})),h=l.getValues();for(var w=0;h.length>w;w++){try{a=o(h[w],t)}catch(y){return u.onError(y),r}u.onNext(a)}},u.onError.bind(u),function(){f=!0,(a||0===d.count())&&u.onCompleted()})),c})},g.groupJoin=function(t,e,n,i){var o=this;return new x(function(s){var u=function(){},c=new b,a=new v(c),h=new _,l=new _,f=0,p=0;return c.add(o.subscribe(function(t){var n=new w,o=f++;h.add(o,n);var p,d,b,v,y;try{y=i(t,C(n,a))}catch(g){for(b=h.getValues(),p=0,d=b.length;d>p;p++)b[p].onError(g);return s.onError(g),r}for(s.onNext(y),v=l.getValues(),p=0,d=v.length;d>p;p++)n.onNext(v[p]);var E=new m;c.add(E);var x,D=function(){h.remove(o)&&n.onCompleted(),c.remove(E)};try{x=e(t)}catch(g){for(b=h.getValues(),p=0,d=h.length;d>p;p++)b[p].onError(g);return s.onError(g),r}E.setDisposable(x.take(1).subscribe(u,function(t){for(b=h.getValues(),p=0,d=b.length;d>p;p++)b[p].onError(t);s.onError(t)},D))},function(t){for(var e=h.getValues(),n=0,r=e.length;r>n;n++)e[n].onError(t);s.onError(t)},s.onCompleted.bind(s))),c.add(t.subscribe(function(t){var e,i,o,a=p++;l.add(a,t);var f=new m;c.add(f);var d,b=function(){l.remove(a),c.remove(f)};try{d=n(t)}catch(v){for(e=h.getValues(),i=0,o=h.length;o>i;i++)e[i].onError(v);return s.onError(v),r}for(f.setDisposable(d.take(1).subscribe(u,function(t){for(e=h.getValues(),i=0,o=h.length;o>i;i++)e[i].onError(t);s.onError(t)},b)),e=h.getValues(),i=0,o=e.length;o>i;i++)e[i].onNext(t)},function(t){for(var e=h.getValues(),n=0,r=e.length;r>n;n++)e[n].onError(t);s.onError(t)})),a})},g.buffer=function(t,e){return 1===arguments.length&&"function"!=typeof arguments[0]?f.call(this,t).selectMany(function(t){return t.toArray()}):"function"==typeof t?p.call(this,t).selectMany(function(t){return t.toArray()}):l.call(this,t,e).selectMany(function(t){return t.toArray()})},g.window=function(t,e){return 1===arguments.length&&"function"!=typeof arguments[0]?f.call(this,t):"function"==typeof t?p.call(this,t):l.call(this,t,e)},n}); | ||
(function(t,e){var n="object"==typeof exports&&exports,r=("object"==typeof module&&module&&module.exports==n&&module,"object"==typeof global&&global);r.global===r&&(window=r),"function"==typeof define&&define.amd?define(["rx","exports"],function(n,r){return t.Rx=e(t,r,n),t.Rx}):"object"==typeof module&&module&&module.exports===n?module.exports=e(t,module.exports,require("./rx")):t.Rx=e(t,{},t.Rx)})(this,function(t,e,n,r){function i(){}function o(t,e){return t===e}function s(t){if(false&t)return 2===t;for(var e=Math.sqrt(t),n=3;e>=n;){if(0===t%n)return!1;n+=2}return!0}function u(t){var e,n,r;for(e=0;D.length>e;++e)if(n=D[e],n>=t)return n;for(r=1|t;D[D.length-1]>r;){if(s(r))return r;r+=2}return t}function c(t){var e=757602046;if(!t.length)return e;for(var n=0,r=t.length;r>n;n++){var i=t.charCodeAt(n);e=(e<<5)-e+i,e&=e}return e}function a(t){var e=668265261;return t=61^t^t>>>16,t+=t<<3,t^=t>>>4,t*=e,t^=t>>>15}function h(){return{key:null,value:null,next:0,hashCode:0}}function l(t,e){return t.groupJoin(this,e,function(){return E()},function(t,e){return e})}function f(t){var e=this;return new x(function(n){var r=new w,i=new b,o=new v(i);return n.onNext(C(r,o)),i.add(e.subscribe(function(t){r.onNext(t)},function(t){r.onError(t),n.onError(t)},function(){r.onCompleted(),n.onCompleted()})),i.add(t.subscribe(function(){r.onCompleted(),r=new w,n.onNext(C(r,o))},function(t){r.onError(t),n.onError(t)},function(){r.onCompleted(),n.onCompleted()})),o})}function p(t){var e=this;return new x(function(n){var o,s=new y,u=new b(s),c=new v(u),a=new w;return n.onNext(C(a,c)),u.add(e.subscribe(function(t){a.onNext(t)},function(t){a.onError(t),n.onError(t)},function(){a.onCompleted(),n.onCompleted()})),o=function(){var e,u;try{u=t()}catch(h){return n.onError(h),r}e=new m,s.disposable(e),e.disposable(u.take(1).subscribe(i,function(t){a.onError(t),n.onError(t)},function(){a.onCompleted(),a=new w,n.onNext(C(a,c)),o()}))},o(),c})}var d=n.Observable,b=n.CompositeDisposable,v=n.RefCountDisposable,m=n.SingleAssignmentDisposable,y=n.SerialDisposable,w=n.Subject,g=d.prototype,E=d.empty,x=n.Internals.AnonymousObservable,C=(n.Observer.create,n.Internals.addRef),D=[1,3,7,13,31,61,127,251,509,1021,2039,4093,8191,16381,32749,65521,131071,262139,524287,1048573,2097143,4194301,8388593,16777213,33554393,67108859,134217689,268435399,536870909,1073741789,2147483647],A="no such key",S="duplicate key",N=function(){var t=0;return function(e){if(null==e)throw Error(A);if("string"==typeof e)return c(e);if("number"==typeof e)return a(e);if("boolean"==typeof e)return e===!0?1:0;if(e instanceof Date)return e.getTime();if(e.getHashCode)return e.getHashCode();var n=17*t++;return e.getHashCode=function(){return n},n}}(),_=function(t,e){if(0>t)throw Error("out of range");t>0&&this._initialize(t),this.comparer=e||o,this.freeCount=0,this.size=0,this.freeList=-1};return _.prototype._initialize=function(t){var e,n=u(t);for(this.buckets=Array(n),this.entries=Array(n),e=0;n>e;e++)this.buckets[e]=-1,this.entries[e]=h();this.freeList=-1},_.prototype.count=function(){return this.size},_.prototype.add=function(t,e){return this._insert(t,e,!0)},_.prototype._insert=function(t,e,n){this.buckets||this._initialize(0);for(var i,o=2147483647&N(t),s=o%this.buckets.length,u=this.buckets[s];u>=0;u=this.entries[u].next)if(this.entries[u].hashCode===o&&this.comparer(this.entries[u].key,t)){if(n)throw Error(S);return this.entries[u].value=e,r}this.freeCount>0?(i=this.freeList,this.freeList=this.entries[i].next,--this.freeCount):(this.size===this.entries.length&&(this._resize(),s=o%this.buckets.length),i=this.size,++this.size),this.entries[i].hashCode=o,this.entries[i].next=this.buckets[s],this.entries[i].key=t,this.entries[i].value=e,this.buckets[s]=i},_.prototype._resize=function(){var t=u(2*this.size),e=Array(t);for(r=0;e.length>r;++r)e[r]=-1;var n=Array(t);for(r=0;this.size>r;++r)n[r]=this.entries[r];for(var r=this.size;t>r;++r)n[r]=h();for(var i=0;this.size>i;++i){var o=n[i].hashCode%t;n[i].next=e[o],e[o]=i}this.buckets=e,this.entries=n},_.prototype.remove=function(t){if(this.buckets)for(var e=2147483647&N(t),n=e%this.buckets.length,r=-1,i=this.buckets[n];i>=0;i=this.entries[i].next){if(this.entries[i].hashCode===e&&this.comparer(this.entries[i].key,t))return 0>r?this.buckets[n]=this.entries[i].next:this.entries[r].next=this.entries[i].next,this.entries[i].hashCode=-1,this.entries[i].next=this.freeList,this.entries[i].key=null,this.entries[i].value=null,this.freeList=i,++this.freeCount,!0;r=i}return!1},_.prototype.clear=function(){var t,e;if(!(0>=this.size)){for(t=0,e=this.buckets.length;e>t;++t)this.buckets[t]=-1;for(t=0;this.size>t;++t)this.entries[t]=h();this.freeList=-1,this.size=0}},_.prototype._findEntry=function(t){if(this.buckets)for(var e=2147483647&N(t),n=this.buckets[e%this.buckets.length];n>=0;n=this.entries[n].next)if(this.entries[n].hashCode===e&&this.comparer(this.entries[n].key,t))return n;return-1},_.prototype.count=function(){return this.size-this.freeCount},_.prototype.tryGetValue=function(t){var e=this._findEntry(t);return e>=0?this.entries[e].value:r},_.prototype.getValues=function(){var t=0,e=[];if(this.entries)for(var n=0;this.size>n;n++)this.entries[n].hashCode>=0&&(e[t++]=this.entries[n].value);return e},_.prototype.get=function(t){var e=this._findEntry(t);if(e>=0)return this.entries[e].value;throw Error(A)},_.prototype.set=function(t,e){this._insert(t,e,!1)},_.prototype.containskey=function(t){return this._findEntry(t)>=0},g.join=function(t,e,n,o){var s=this;return new x(function(u){var c=new b,a=!1,h=0,l=new _,f=!1,p=0,d=new _;return c.add(s.subscribe(function(t){var n,s,f,p,b=h++,v=new m;l.add(b,t),c.add(v),s=function(){return l.remove(b)&&0===l.count()&&a&&u.onCompleted(),c.remove(v)};try{n=e(t)}catch(y){return u.onError(y),r}v.disposable(n.take(1).subscribe(i,u.onError.bind(u),function(){s()})),p=d.getValues();for(var w=0;p.length>w;w++){try{f=o(t,p[w])}catch(g){return u.onError(g),r}u.onNext(f)}},u.onError.bind(u),function(){a=!0,(f||0===l.count())&&u.onCompleted()})),c.add(t.subscribe(function(t){var e,s,a,h,b=p++,v=new m;d.add(b,t),c.add(v),s=function(){return d.remove(b)&&0===d.count()&&f&&u.onCompleted(),c.remove(v)};try{e=n(t)}catch(y){return u.onError(y),r}v.disposable(e.take(1).subscribe(i,u.onError.bind(u),function(){s()})),h=l.getValues();for(var w=0;h.length>w;w++){try{a=o(h[w],t)}catch(y){return u.onError(y),r}u.onNext(a)}},u.onError.bind(u),function(){f=!0,(a||0===d.count())&&u.onCompleted()})),c})},g.groupJoin=function(t,e,n,i){var o=this;return new x(function(s){var u=function(){},c=new b,a=new v(c),h=new _,l=new _,f=0,p=0;return c.add(o.subscribe(function(t){var n=new w,o=f++;h.add(o,n);var p,d,b,v,y;try{y=i(t,C(n,a))}catch(g){for(b=h.getValues(),p=0,d=b.length;d>p;p++)b[p].onError(g);return s.onError(g),r}for(s.onNext(y),v=l.getValues(),p=0,d=v.length;d>p;p++)n.onNext(v[p]);var E=new m;c.add(E);var x,D=function(){h.remove(o)&&n.onCompleted(),c.remove(E)};try{x=e(t)}catch(g){for(b=h.getValues(),p=0,d=h.length;d>p;p++)b[p].onError(g);return s.onError(g),r}E.setDisposable(x.take(1).subscribe(u,function(t){for(b=h.getValues(),p=0,d=b.length;d>p;p++)b[p].onError(t);s.onError(t)},D))},function(t){for(var e=h.getValues(),n=0,r=e.length;r>n;n++)e[n].onError(t);s.onError(t)},s.onCompleted.bind(s))),c.add(t.subscribe(function(t){var e,i,o,a=p++;l.add(a,t);var f=new m;c.add(f);var d,b=function(){l.remove(a),c.remove(f)};try{d=n(t)}catch(v){for(e=h.getValues(),i=0,o=h.length;o>i;i++)e[i].onError(v);return s.onError(v),r}for(f.setDisposable(d.take(1).subscribe(u,function(t){for(e=h.getValues(),i=0,o=h.length;o>i;i++)e[i].onError(t);s.onError(t)},b)),e=h.getValues(),i=0,o=e.length;o>i;i++)e[i].onNext(t)},function(t){for(var e=h.getValues(),n=0,r=e.length;r>n;n++)e[n].onError(t);s.onError(t)})),a})},g.buffer=function(){return this.window.apply(this,arguments).selectMany(function(t){return t.toArray()})},g.window=function(t,e){return 1===arguments.length&&"function"!=typeof arguments[0]?f.call(this,t):"function"==typeof t?p.call(this,t):l.call(this,t,e)},n}); |
@@ -40,2 +40,3 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. | ||
immediateScheduler = Rx.Scheduler.immediate, | ||
currentThreadScheduler = Rx.Scheduler.currentThread, | ||
slice = Array.prototype.slice, | ||
@@ -420,5 +421,5 @@ AsyncSubject = Rx.AsyncSubject, | ||
var self = this, g = new CompositeDisposable(); | ||
g.add(Scheduler.currentThread.schedule(function () { | ||
g.add(currentThreadScheduler.schedule(function () { | ||
observer.onNext(self.head); | ||
g.add(tail.mergeObservable().subscribe(observer)); | ||
g.add(self.tail.mergeObservable().subscribe(observer)); | ||
})); | ||
@@ -425,0 +426,0 @@ |
@@ -1,1 +0,1 @@ | ||
(function(t,e){var n="object"==typeof exports&&exports,r=("object"==typeof module&&module&&module.exports==n&&module,"object"==typeof global&&global);r.global===r&&(window=r),"function"==typeof define&&define.amd?define(["rx","exports"],function(n,r){return t.Rx=e(t,r,n),t.Rx}):"object"==typeof module&&module&&module.exports===n?module.exports=e(t,module.exports,require("./rx")):t.Rx=e(t,{},t.Rx)})(this,function(t,e,n,r){function i(){}function o(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:E.call(t)}function s(t,e){return new y(function(){var n;return m(function(){return t()?(n=e,!0):!1},function(){return n})})}var u=n.Observable,c=u.prototype,a=u.createWithDisposable,h=u.concat,l=u.defer,f=u.empty,p=n.Disposable.empty,d=(n.Internals.BinaryObserver,n.CompositeDisposable),b=n.SerialDisposable,v=n.SingleAssignmentDisposable,m=n.Internals.Enumerator.create,y=n.Internals.Enumerable,w=y.forEach,g=n.Scheduler.immediate,E=Array.prototype.slice,x=n.AsyncSubject,C=n.Observer,D=n.Internals.inherits,A=n.Internals.addProperties;c.letBind=function(t){return t(this)},u["if"]=u.ifThen=function(t,e,n){return l(function(){if(n||(n=f()),n.now){var r=n;n=f(r)}return t()?e:n})},u["for"]=u.forIn=function(t,e){return w(t,e).concat()};var S=u["while"]=u.whileDo=function(t,e){return s(t,e).concat()};c.doWhile=function(t){return h([this,S(t,this)])},u["case"]=u.switchCase=function(t,e,n){return l(function(){if(n||(n=f()),n.now){var i=n;n=f(i)}var o=e[t()];return o!==r?o:n})},c.expand=function(t,e){e||(e=g);var n=this;return a(function(i){var o=[],s=new b,u=new d(s),c=0,a=!1,h=function(){var n=!1;o.length>0&&(n=!a,a=!0),n&&s.setDisposable(e.scheduleRecursive(function(e){var n;if(!(o.length>0))return a=!1,r;n=o.shift();var s=new v;u.add(s),s.setDisposable(n.subscribe(function(e){i.onNext(e);var n=null;try{n=t(e)}catch(r){i.onError(r)}o.push(n),c++,h()},i.onError.bind(i),function(){u.remove(s),c--,0===c&&i.onCompleted()})),e()}))};return o.push(n),c++,h(),u})},u.forkJoin=function(){var t=o(arguments,0);return a(function(e){var n=t.length;if(0===n)return e.onCompleted(),p;for(var i=new d,o=!1,s=Array(n),u=Array(n),c=Array(n),a=0;n>a;a++)(function(a){var h=t[a];i.add(h.subscribe(function(t){o||(s[a]=!0,c[a]=t)},function(t){o=!0,e.onError(t),i.dispose()},function(){if(!o){if(!s[a])return e.onCompleted(),r;u[a]=!0;for(var t=0;n>t;t++)if(!u[t])return;o=!0,e.onNext(c),e.onCompleted()}}))})(a);return i})},c.forkJoin=function(t,e){var n=this;return a(function(i){var o,s,u=!1,c=!1,a=!1,h=!1,l=new v,f=new v;return l.setDisposable(n.subscribe(function(t){a=!0,o=t},function(t){f.dispose(),i.onError(t)},function(){if(u=!0,c)if(a)if(h){var t;try{t=e(o,s)}catch(n){return i.onError(n),r}i.onNext(t),i.onCompleted()}else i.onCompleted();else i.onCompleted()})),f.setDisposable(t.subscribe(function(t){h=!0,s=t},function(t){l.dispose(),i.onError(t)},function(){if(c=!0,u)if(a)if(h){var t;try{t=e(o,s)}catch(n){return i.onError(n),r}i.onNext(t),i.onCompleted()}else i.onCompleted();else i.onCompleted()})),new d(l,f)})},c.manySelect=function(t,e){e||(e=g);var n=this;return u.defer(function(){var r;return n.select(function(t){var e=new N(t);return r&&r.onNext(t),r=e,e}).doAction(i,function(t){r&&r.onError(t)},function(){r&&r.onCompleted()}).observeOn(e).select(function(e,n,r){return t(e,n,r)})})};var N=function(t){function e(t){var e=this,n=new d;return n.add(Scheduler.currentThread.schedule(function(){t.onNext(e.head),n.add(tail.mergeObservable().subscribe(t))})),n}function n(n){t.call(this,e),this.head=n,this.tail=new x}return D(n,t),A(n.prototype,C,{onCompleted:function(){this.onNext(u.empty())},onError:function(t){this.onNext(u.throwException(t))},onNext:function(t){this.tail.onNext(t),this.tail.onCompleted()}}),n}(u);return n}); | ||
(function(t,e){var n="object"==typeof exports&&exports,r=("object"==typeof module&&module&&module.exports==n&&module,"object"==typeof global&&global);r.global===r&&(window=r),"function"==typeof define&&define.amd?define(["rx","exports"],function(n,r){return t.Rx=e(t,r,n),t.Rx}):"object"==typeof module&&module&&module.exports===n?module.exports=e(t,module.exports,require("./rx")):t.Rx=e(t,{},t.Rx)})(this,function(t,e,n,r){function i(){}function o(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:x.call(t)}function s(t,e){return new y(function(){var n;return m(function(){return t()?(n=e,!0):!1},function(){return n})})}var u=n.Observable,c=u.prototype,a=u.createWithDisposable,h=u.concat,l=u.defer,f=u.empty,p=n.Disposable.empty,d=(n.Internals.BinaryObserver,n.CompositeDisposable),b=n.SerialDisposable,v=n.SingleAssignmentDisposable,m=n.Internals.Enumerator.create,y=n.Internals.Enumerable,w=y.forEach,g=n.Scheduler.immediate,E=n.Scheduler.currentThread,x=Array.prototype.slice,C=n.AsyncSubject,D=n.Observer,A=n.Internals.inherits,S=n.Internals.addProperties;c.letBind=function(t){return t(this)},u["if"]=u.ifThen=function(t,e,n){return l(function(){if(n||(n=f()),n.now){var r=n;n=f(r)}return t()?e:n})},u["for"]=u.forIn=function(t,e){return w(t,e).concat()};var N=u["while"]=u.whileDo=function(t,e){return s(t,e).concat()};c.doWhile=function(t){return h([this,N(t,this)])},u["case"]=u.switchCase=function(t,e,n){return l(function(){if(n||(n=f()),n.now){var i=n;n=f(i)}var o=e[t()];return o!==r?o:n})},c.expand=function(t,e){e||(e=g);var n=this;return a(function(i){var o=[],s=new b,u=new d(s),c=0,a=!1,h=function(){var n=!1;o.length>0&&(n=!a,a=!0),n&&s.setDisposable(e.scheduleRecursive(function(e){var n;if(!(o.length>0))return a=!1,r;n=o.shift();var s=new v;u.add(s),s.setDisposable(n.subscribe(function(e){i.onNext(e);var n=null;try{n=t(e)}catch(r){i.onError(r)}o.push(n),c++,h()},i.onError.bind(i),function(){u.remove(s),c--,0===c&&i.onCompleted()})),e()}))};return o.push(n),c++,h(),u})},u.forkJoin=function(){var t=o(arguments,0);return a(function(e){var n=t.length;if(0===n)return e.onCompleted(),p;for(var i=new d,o=!1,s=Array(n),u=Array(n),c=Array(n),a=0;n>a;a++)(function(a){var h=t[a];i.add(h.subscribe(function(t){o||(s[a]=!0,c[a]=t)},function(t){o=!0,e.onError(t),i.dispose()},function(){if(!o){if(!s[a])return e.onCompleted(),r;u[a]=!0;for(var t=0;n>t;t++)if(!u[t])return;o=!0,e.onNext(c),e.onCompleted()}}))})(a);return i})},c.forkJoin=function(t,e){var n=this;return a(function(i){var o,s,u=!1,c=!1,a=!1,h=!1,l=new v,f=new v;return l.setDisposable(n.subscribe(function(t){a=!0,o=t},function(t){f.dispose(),i.onError(t)},function(){if(u=!0,c)if(a)if(h){var t;try{t=e(o,s)}catch(n){return i.onError(n),r}i.onNext(t),i.onCompleted()}else i.onCompleted();else i.onCompleted()})),f.setDisposable(t.subscribe(function(t){h=!0,s=t},function(t){l.dispose(),i.onError(t)},function(){if(c=!0,u)if(a)if(h){var t;try{t=e(o,s)}catch(n){return i.onError(n),r}i.onNext(t),i.onCompleted()}else i.onCompleted();else i.onCompleted()})),new d(l,f)})},c.manySelect=function(t,e){e||(e=g);var n=this;return u.defer(function(){var r;return n.select(function(t){var e=new _(t);return r&&r.onNext(t),r=e,e}).doAction(i,function(t){r&&r.onError(t)},function(){r&&r.onCompleted()}).observeOn(e).select(function(e,n,r){return t(e,n,r)})})};var _=function(t){function e(t){var e=this,n=new d;return n.add(E.schedule(function(){t.onNext(e.head),n.add(e.tail.mergeObservable().subscribe(t))})),n}function n(n){t.call(this,e),this.head=n,this.tail=new C}return A(n,t),S(n.prototype,D,{onCompleted:function(){this.onNext(u.empty())},onError:function(t){this.onNext(u.throwException(t))},onNext:function(t){this.tail.onNext(t),this.tail.onCompleted()}}),n}(u);return n}); |
@@ -1,2 +0,2 @@ | ||
(function(t,e){function n(){}function r(t){return t}function i(){return(new Date).getTime()}function o(t,e){return F(t,e)}function s(t,e){return t-e}function u(t){return""+t}function c(t){throw t}function a(){if(this.isDisposed)throw Error(_)}function h(t){return"function"!=typeof t.toString&&"string"==typeof(t+"")}function l(t){return t&&"object"==typeof t?M.call(t)==O:!1}function f(t){return"function"==typeof t}function p(t,e,n,r){var i;if(t===e)return 0!==t||1/t==1/e;var o=typeof t,s=typeof e;if(!(t!==t||t&&N[o]||e&&N[s]))return!1;if(null==t||null==e)return t===e;var u=M.call(t),c=M.call(e);if(u==O&&(u=T),c==O&&(c=T),u!=c)return!1;switch(u){case W:case k:return+t==+e;case q:return t!=+t?e!=+e:0==t?1/t==1/e:t==+e;case I:case P:return t==e+""}var a=u==R;if(!a){if(u!=T||!C&&(h(t)||h(e)))return!1;var d=!V&&l(t)?Object:t.constructor,b=!V&&l(e)?Object:e.constructor;if(d!=b&&!(f(d)&&d instanceof d&&f(b)&&b instanceof b))return!1}for(var v=n.length;v--;)if(n[v]==t)return r[v]==e;var m=0;if(i=!0,n.push(t),r.push(e),a){for(v=t.length,m=e.length,i=m==t.length;m--;){var y=e[m];if(!(i=p(t[m],y,n,r)))break}return i}for(var w in e)if(L.call(e,w))return m++,i=L.call(t,w)&&p(t[w],e[w],n,r);if(i)for(var w in t)if(L.call(t,w))return i=--m>-1;return n.pop(),r.pop(),i}function d(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:B.call(t)}function b(t,e){for(var n=Array(t),r=0;t>r;r++)n[r]=e();return n}function v(t,e){this.scheduler=t,this.disposable=e,this.isDisposed=!1}function m(t,e,n,r,i){this.scheduler=t,this.state=e,this.action=n,this.dueTime=r,this.comparer=i||s,this.disposable=new re}function y(t,n){return new Ge(function(r){var i=new re,o=new oe;return o.setDisposable(i),i.setDisposable(t.subscribe(r.onNext.bind(r),function(t){var i,s;try{s=n(t)}catch(u){return r.onError(u),e}i=new re,o.setDisposable(i),i.setDisposable(s.subscribe(r))},r.onCompleted.bind(r))),o})}function w(t,n){var r=this;return new Ge(function(i){var o=0,s=t.length;return r.subscribe(function(r){if(s>o){var u,c=t[o++];try{u=n(r,c)}catch(a){return i.onError(a),e}i.onNext(u)}else i.onCompleted()},i.onError.bind(i),i.onCompleted.bind(i))})}function g(t){return this.select(t).mergeObservable()}var E="object"==typeof exports&&exports,x=("object"==typeof module&&module&&module.exports==E&&module,"object"==typeof global&&global);x.global===x&&(t=x);var C,D={Internals:{}},A="Sequence contains no elements.",S="Argument out of range",_="Object has been disposed",N={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},O="[object Arguments]",R="[object Array]",W="[object Boolean]",k="[object Date]",j="[object Function]",q="[object Number]",T="[object Object]",I="[object RegExp]",P="[object String]",M=Object.prototype.toString,L=Object.prototype.hasOwnProperty,V=M.call(arguments)==O;try{C=!(M.call(document)==T&&!({toString:0}+""))}catch(z){C=!0}V||(l=function(t){return t&&"object"==typeof t?L.call(t,"callee"):!1}),f(/x/)&&(f=function(t){return"function"==typeof t&&M.call(t)==j});var F=D.Internals.isEqual=function(t,e){return p(t,e,[],[])},B=Array.prototype.slice;({}).hasOwnProperty;var H=this.inherits=D.Internals.inherits=function(t,e){function n(){this.constructor=t}n.prototype=e.prototype,t.prototype=new n},U=D.Internals.addProperties=function(t){for(var e=B.call(arguments,1),n=0,r=e.length;r>n;n++){var i=e[n];for(var o in i)t[o]=i[o]}},G=D.Internals.addRef=function(t,e){return new Ge(function(n){return new Z(e.getDisposable(),t.subscribe(n))})};Function.prototype.bind||(Function.prototype.bind=function(t){var e=this,n=B.call(arguments,1),r=function(){function i(){}if(this instanceof r){i.prototype=e.prototype;var o=new i,s=e.apply(o,n.concat(B.call(arguments)));return Object(s)===s?s:o}return e.apply(t,n.concat(B.call(arguments)))};return r});var J=Object("a"),K="a"!=J[0]||!(0 in J);Array.prototype.every||(Array.prototype.every=function(t){var e=Object(this),n=K&&"[object String]"=={}.toString.call(this)?this.split(""):e,r=n.length>>>0,i=arguments[1];if("[object Function]"!={}.toString.call(t))throw new TypeError(t+" is not a function");for(var o=0;r>o;o++)if(o in n&&!t.call(i,n[o],o,e))return!1;return!0}),Array.prototype.map||(Array.prototype.map=function(t){var e=Object(this),n=K&&"[object String]"=={}.toString.call(this)?this.split(""):e,r=n.length>>>0,i=Array(r),o=arguments[1];if("[object Function]"!={}.toString.call(t))throw new TypeError(t+" is not a function");for(var s=0;r>s;s++)s in n&&(i[s]=t.call(o,n[s],s,e));return i}),Array.prototype.filter||(Array.prototype.filter=function(t){for(var e,n=[],r=Object(this),i=0,o=r.length>>>0;o>i;i++)e=r[i],i in r&&t.call(arguments[1],e,i,r)&&n.push(e);return n}),Array.isArray||(Array.isArray=function(t){return"[object Array]"==Object.prototype.toString.call(t)}),Array.prototype.indexOf||(Array.prototype.indexOf=function(t){var e=Object(this),n=e.length>>>0;if(0===n)return-1;var r=0;if(arguments.length>1&&(r=Number(arguments[1]),r!==r?r=0:0!==r&&1/0!=r&&r!==-1/0&&(r=(r>0||-1)*Math.floor(Math.abs(r)))),r>=n)return-1;for(var i=r>=0?r:Math.max(n-Math.abs(r),0);n>i;i++)if(i in e&&e[i]===t)return i;return-1});var Q=function(t,e){this.id=t,this.value=e};Q.prototype.compareTo=function(t){var e=this.value.compareTo(t.value);return 0===e&&(e=this.id-t.id),e};var X=function(t){this.items=Array(t),this.length=0},Y=X.prototype;Y.isHigherPriority=function(t,e){return 0>this.items[t].compareTo(this.items[e])},Y.percolate=function(t){if(!(t>=this.length||0>t)){var e=t-1>>1;if(!(0>e||e===t)&&this.isHigherPriority(t,e)){var n=this.items[t];this.items[t]=this.items[e],this.items[e]=n,this.percolate(e)}}},Y.heapify=function(t){if(t===e&&(t=0),!(t>=this.length||0>t)){var n=2*t+1,r=2*t+2,i=t;if(this.length>n&&this.isHigherPriority(n,i)&&(i=n),this.length>r&&this.isHigherPriority(r,i)&&(i=r),i!==t){var o=this.items[t];this.items[t]=this.items[i],this.items[i]=o,this.heapify(i)}}},Y.peek=function(){return this.items[0].value},Y.removeAt=function(t){this.items[t]=this.items[--this.length],delete this.items[this.length],this.heapify()},Y.dequeue=function(){var t=this.peek();return this.removeAt(0),t},Y.enqueue=function(t){var e=this.length++;this.items[e]=new Q(X.count++,t),this.percolate(e)},Y.remove=function(t){for(var e=0;this.length>e;e++)if(this.items[e].value===t)return this.removeAt(e),!0;return!1},X.count=0;var Z=D.CompositeDisposable=function(){this.disposables=d(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},$=Z.prototype;$.add=function(t){this.isDisposed?t.dispose():(this.disposables.push(t),this.length++)},$.remove=function(t){var e=!1;if(!this.isDisposed){var n=this.disposables.indexOf(t);-1!==n&&(e=!0,this.disposables.splice(n,1),this.length--,t.dispose())}return e},$.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()}},$.clear=function(){var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()},$.contains=function(t){return-1!==this.disposables.indexOf(t)},$.toArray=function(){return this.disposables.slice(0)};var te=D.Disposable=function(t){this.isDisposed=!1,this.action=t||n};te.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var ee=te.create=function(t){return new te(t)},ne=te.empty={dispose:n},re=D.SingleAssignmentDisposable=function(){this.isDisposed=!1,this.current=null},ie=re.prototype;ie.disposable=function(t){return t?this.setDisposable(t):this.getDisposable()},ie.getDisposable=function(){return this.current},ie.setDisposable=function(t){if(this.current)throw Error("Disposable has already been assigned");var e=this.isDisposed;e||(this.current=t),e&&t&&t.dispose()},ie.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()};var oe=D.SerialDisposable=function(){this.isDisposed=!1,this.current=null};oe.prototype.getDisposable=function(){return this.current},oe.prototype.setDisposable=function(t){var e,n=this.isDisposed;n||(e=this.current,this.current=t),e&&e.dispose(),n&&t&&t.dispose()},oe.prototype.disposable=function(t){return t?(this.setDisposable(t),e):this.getDisposable()},oe.prototype.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()};var se=D.RefCountDisposable=function(){function t(t){this.disposable=t,this.disposable.count++,this.isInnerDisposed=!1}function e(t){this.underlyingDisposable=t,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return t.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},e.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},e.prototype.getDisposable=function(){return this.isDisposed?ne:new t(this)},e}();v.prototype.dispose=function(){var t=this;this.scheduler.schedule(function(){t.isDisposed||(t.isDisposed=!0,t.disposable.dispose())})},m.prototype.invoke=function(){this.disposable.disposable(this.invokeCore())},m.prototype.compareTo=function(t){return this.comparer(this.dueTime,t.dueTime)},m.prototype.isCancelled=function(){return this.disposable.isDisposed},m.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var ue=D.Scheduler=function(){function e(t,e,n,r){this.now=t,this._schedule=e,this._scheduleRelative=n,this._scheduleAbsolute=r}function n(t,e){var n=e.first,r=e.second,i=new Z,o=function(e){r(e,function(e){var n=!1,r=!1,s=t.scheduleWithState(e,function(t,e){return n?i.remove(s):r=!0,o(e),ne});r||(i.add(s),n=!0)})};return o(n),i}function r(t,e,n){var r=e.first,i=e.second,o=new Z,s=function(e){i(e,function(e,r){var i=!1,u=!1,c=t[n].call(t,e,r,function(t,e){return i?o.remove(c):u=!0,s(e),ne});u||(o.add(c),i=!0)})};return s(r),o}function o(t,e){return e(),ne}var s=e.prototype;return s.catchException=function(t){return new be(this,t)},s.schedulePeriodic=function(t,e){return this.schedulePeriodicWithState(null,t,function(){e()})},s.schedulePeriodicWithState=function(e,n,r){var i=e,o=t.setInterval(function(){i=r(i)},n);return ee(function(){t.clearInterval(o)})},s.schedule=function(t){return this._schedule(t,o)},s.scheduleWithState=function(t,e){return this._schedule(t,e)},s.scheduleWithRelative=function(t,e){return this._scheduleRelative(e,t,o)},s.scheduleWithRelativeAndState=function(t,e,n){return this._scheduleRelative(t,e,n)},s.scheduleWithAbsolute=function(t,e){return this._scheduleAbsolute(e,t,o)},s.scheduleWithAbsoluteAndState=function(t,e,n){return this._scheduleAbsolute(t,e,n)},s.scheduleRecursive=function(t){return this.scheduleRecursiveWithState(t,function(t,e){t(function(){e(t)})})},s.scheduleRecursiveWithState=function(t,e){return this.scheduleWithState({first:t,second:e},function(t,e){return n(t,e)})},s.scheduleRecursiveWithRelative=function(t,e){return this.scheduleRecursiveWithRelativeAndState(e,t,function(t,e){t(function(n){e(t,n)})})},s.scheduleRecursiveWithRelativeAndState=function(t,e,n){return this._scheduleRelative({first:t,second:n},e,function(t,e){return r(t,e,"scheduleWithRelativeAndState")})},s.scheduleRecursiveWithAbsolute=function(t,e){return this.scheduleRecursiveWithAbsoluteAndState(e,t,function(t,e){t(function(n){e(t,n)})})},s.scheduleRecursiveWithAbsoluteAndState=function(t,e,n){return this._scheduleAbsolute({first:t,second:n},e,function(t,e){return r(t,e,"scheduleWithAbsoluteAndState")})},e.now=i,e.normalize=function(t){return 0>t&&(t=0),t},e}(),ce="Scheduler is not allowed to block the thread",ae=ue.immediate=function(){function t(t,e){return e(this,t)}function e(t,e,n){if(e>0)throw Error(ce);return n(this,t)}function n(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new ue(i,t,e,n)}(),he=ue.currentThread=function(){function t(){o=new X(4)}function e(t,e){return this.scheduleWithRelativeAndState(t,0,e)}function n(e,n,r){var i,s=this.now()+ue.normalize(n),u=new m(this,e,r,s);if(o)o.enqueue(u);else{i=new t;try{o.enqueue(u),i.run()}catch(c){throw c}finally{i.dispose()}}return u.disposable}function r(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}var o;t.prototype.dispose=function(){o=null},t.prototype.run=function(){for(var t;o.length>0;)if(t=o.dequeue(),!t.isCancelled()){for(;t.dueTime-ue.now()>0;);t.isCancelled()||t.invoke()}};var s=new ue(i,e,n,r);return s.scheduleRequired=function(){return null===o},s.ensureTrampoline=function(t){return null===o?this.schedule(t):t()},s}(),le=function(){function t(t,e){e(0,this._period);try{this._state=this._action(this._state)}catch(n){throw this._cancel.dispose(),n}}function e(t,e,n,r){this._scheduler=t,this._state=e,this._period=n,this._action=r}return e.prototype.start=function(){var e=new re;return this._cancel=e,e.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,t.bind(this))),e},e}();D.VirtualTimeScheduler=function(t){function n(){return this.toDateTimeOffset(this.clock)}function r(t,e){return this.scheduleAbsoluteWithState(t,this.clock,e)}function i(t,e,n){return this.scheduleRelativeWithState(t,this.toRelative(e),n)}function o(t,e,n){return this.scheduleRelativeWithState(t,this.toRelative(e-this.now()),n)}function s(t,e){return e(),ne}function u(e,s){this.clock=e,this.comparer=s,this.isEnabled=!1,this.queue=new X(1024),t.call(this,n,r,i,o)}H(u,t);var c=u.prototype;return c.schedulePeriodicWithState=function(t,e,n){var r=new le(this,t,e,n);return r.start()},c.scheduleRelativeWithState=function(t,e,n){var r=this.add(this.clock,e);return this.scheduleAbsoluteWithState(t,r,n)},c.scheduleRelative=function(t,e){return this.scheduleRelativeWithState(e,t,s)},c.start=function(){var t;if(!this.isEnabled){this.isEnabled=!0;do t=this.getNext(),null!==t?(this.comparer(t.dueTime,this.clock)>0&&(this.clock=t.dueTime),t.invoke()):this.isEnabled=!1;while(this.isEnabled)}},c.stop=function(){this.isEnabled=!1},c.advanceTo=function(t){var e,n=this.comparer(this.clock,t);if(this.comparer(this.clock,t)>0)throw Error(S);if(0!==n&&!this.isEnabled){this.isEnabled=!0;do e=this.getNext(),null!==e&&0>=this.comparer(e.dueTime,t)?(this.comparer(e.dueTime,this.clock)>0&&(this.clock=e.dueTime),e.invoke()):this.isEnabled=!1;while(this.isEnabled);this.clock=t}},c.advanceBy=function(t){var n=this.add(this.clock,t),r=this.comparer(this.clock,n);if(r>0)throw Error(S);return 0!==r?this.advanceTo(n):e},c.sleep=function(t){var e=this.add(this.clock,t);if(this.comparer(this.clock,e)>=0)throw Error(S);this.clock=e},c.getNext=function(){for(var t;this.queue.length>0;){if(t=this.queue.peek(),!t.isCancelled())return t;this.queue.dequeue()}return null},c.scheduleAbsolute=function(t,e){return this.scheduleAbsoluteWithState(e,t,s)},c.scheduleAbsoluteWithState=function(t,e,n){var r=this,i=function(t,e){return r.queue.remove(o),n(t,e)},o=new m(r,t,i,e,r.comparer);return r.queue.enqueue(o),o.disposable},u}(ue),D.HistoricalScheduler=function(t){function e(e,n){var r=null==e?0:e,i=n||s;t.call(this,r,i)}H(e,t);var n=e.prototype;return n.add=function(t,e){return t+e},n.toDateTimeOffset=function(t){return new Date(t).getTime()},n.toRelative=function(t){return t},e}(D.VirtualTimeScheduler);var fe,pe=n;(function(){function e(){if(!t.postMessage||t.importScripts)return!1;var e=!1,n=t.onmessage;return t.onmessage=function(){e=!0},t.postMessage("","*"),t.onmessage=n,e}function n(t){if("string"==typeof t.data&&t.data.substring(0,r.length)===r){var e=t.data.substring(r.length),n=i[e];n(),delete i[e]}}if("function"==typeof t.setImmediate)fe=t.setImmediate,pe=clearImmediate;else if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))fe=process.nextTick;else if(e()){var r="ms.rx.schedule"+Math.random(),i={},o=0;t.addEventListener?t.addEventListener("message",n,!1):t.attachEvent("onmessage",n,!1),fe=function(e){var n=o++;i[n]=e,t.postMessage(r+n,"*")}}else if(t.MessageChannel){var s=new t.MessageChannel,u={},c=0;s.port1.onmessage=function(t){var e=t.data,n=u[e];n(),delete u[e]},fe=function(t){var e=c++;u[e]=t,s.port2.postMessage(e)}}else"document"in t&&"onreadystatechange"in t.document.createElement("script")?fe=function(e){var n=t.document.createElement("script");n.onreadystatechange=function(){e(),n.onreadystatechange=null,n.parentNode.removeChild(n),n=null},t.document.documentElement.appendChild(n)}:(fe=function(e){return t.setTimeout(e,0)},pe=t.clearTimeout)})();var de=ue.timeout=function(){function e(t,e){var n=this,r=new re,i=fe(function(){r.isDisposed||r.setDisposable(e(n,t))});return new Z(r,ee(function(){pe(i)}))}function n(e,n,r){var i=this,o=ue.normalize(n);if(0===o)return i.scheduleWithState(e,r);var s=new re,u=t.setTimeout(function(){s.isDisposed||s.setDisposable(r(i,e))},o);return new Z(s,ee(function(){t.clearTimeout(u)}))}function r(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new ue(i,e,n,r)}(),be=function(t){function e(){return this._scheduler.now()}function n(t,e){return this._scheduler.scheduleWithState(t,this._wrap(e))}function r(t,e,n){return this._scheduler.scheduleWithRelativeAndState(t,e,this._wrap(n))}function i(t,e,n){return this._scheduler.scheduleWithAbsoluteAndState(t,e,this._wrap(n))}function o(o,s){this._scheduler=o,this._handler=s,this._recursiveOriginal=null,this._recursiveWrapper=null,t.call(this,e,n,r,i)}return H(o,t),o.prototype._clone=function(t){return new o(t,this._handler)},o.prototype._wrap=function(t){var e=this;return function(n,r){try{return t(e._getRecursiveWrapper(n),r)}catch(i){if(!e._handler(i))throw i;return ne}}},o.prototype._getRecursiveWrapper=function(t){if(this._recursiveOriginal!==t){this._recursiveOriginal=t;var e=this._clone(t);e._recursiveOriginal=t,e._recursiveWrapper=e,this._recursiveWrapper=e}return this._recursiveWrapper},o.prototype.schedulePeriodicWithState=function(t,e,n){var r=this,i=!1,o=new re;return o.setDisposable(this._scheduler.schedulePeriodicWithState(t,e,function(t){if(i)return null;try{return n(t)}catch(e){if(i=!0,!r._handler(e))throw e;return o.dispose(),null}})),o},o}(ue),ve=D.Notification=function(){function t(t,e){this.hasValue=null==e?!1:e,this.kind=t}var e=t.prototype;return e.accept=function(t,e,n){return 1===arguments.length&&"object"==typeof t?this._acceptObservable(t):this._accept(t,e,n)},e.toObservable=function(t){var e=this;return t=t||ae,new Ge(function(n){return t.schedule(function(){e._acceptObservable(n),"N"===e.kind&&n.onCompleted()})})},t}(),me=ve.createOnNext=function(){function t(t){return t(this.value)}function e(t){return t.onNext(this.value)}function n(){return"OnNext("+this.value+")"}return function(r){var i=new ve("N",!0);return i.value=r,i._accept=t.bind(i),i._acceptObservable=e.bind(i),i.toString=n.bind(i),i}}(),ye=ve.createOnError=function(){function t(t,e){return e(this.exception)}function e(t){return t.onError(this.exception)}function n(){return"OnError("+this.exception+")"}return function(r){var i=new ve("E");return i.exception=r,i._accept=t.bind(i),i._acceptObservable=e.bind(i),i.toString=n.bind(i),i}}(),we=ve.createOnCompleted=function(){function t(t,e,n){return n()}function e(t){return t.onCompleted()}function n(){return"OnCompleted()"}return function(){var r=new ve("C");return r._accept=t.bind(r),r._acceptObservable=e.bind(r),r.toString=n.bind(r),r}}(),ge=D.Internals.Enumerator=function(t,e,n){this.moveNext=t,this.getCurrent=e,this.dispose=n},Ee=ge.create=function(t,e,r){var i=!1;return r||(r=n),new ge(function(){if(i)return!1;var e=t();return e||(i=!0,r()),e},function(){return e()},function(){i||(r(),i=!0)})},xe=D.Internals.Enumerable=function(){function t(t){this.getEnumerator=t}return t.prototype.concat=function(){var t=this;return new Ge(function(n){var r=t.getEnumerator(),i=!1,o=new oe,s=ae.scheduleRecursive(function(t){var s,u,c=!1;if(!i){try{c=r.moveNext(),c?s=r.getCurrent():r.dispose()}catch(a){u=a,r.dispose()}if(u)return n.onError(u),e;if(!c)return n.onCompleted(),e;var h=new re;o.setDisposable(h),h.setDisposable(s.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){t()}))}});return new Z(o,s,ee(function(){i=!0,r.dispose()}))})},t.prototype.catchException=function(){var t=this;return new Ge(function(n){var r,i=t.getEnumerator(),o=!1,s=new oe,u=ae.scheduleRecursive(function(t){var u,c,a;if(a=!1,!o){try{a=i.moveNext(),a&&(u=i.getCurrent())}catch(h){c=h}if(c)return n.onError(c),e;if(!a)return r?n.onError(r):n.onCompleted(),e;var l=new re;s.setDisposable(l),l.setDisposable(u.subscribe(n.onNext.bind(n),function(e){r=e,t()},n.onCompleted.bind(n)))}});return new Z(s,u,ee(function(){o=!0}))})},t}(),Ce=xe.repeat=function(t,n){return n===e&&(n=-1),new xe(function(){var e,r=n;return Ee(function(){return 0===r?!1:(r>0&&r--,e=t,!0)},function(){return e})})},De=xe.forEach=function(t,e){return e||(e=r),new xe(function(){var n,r=-1;return Ee(function(){return++r<t.length?(n=e(t[r],r),!0):!1},function(){return n})})},Ae=D.Observer=function(){};Ae.prototype.toNotifier=function(){var t=this;return function(e){return e.accept(t)}},Ae.prototype.asObserver=function(){return new Oe(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},Ae.prototype.checked=function(){return new Re(this)};var Se=Ae.create=function(t,e,r){return t||(t=n),e||(e=c),r||(r=n),new Oe(t,e,r)};Ae.fromNotifier=function(t){return new Oe(function(e){return t(me(e))},function(e){return t(ye(e))},function(){return t(we())})};var _e,Ne=D.Internals.AbstractObserver=function(t){function e(){this.isStopped=!1,t.call(this)}return H(e,t),e.prototype.onNext=function(t){this.isStopped||this.next(t)},e.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.error(t))},e.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},e.prototype.dispose=function(){this.isStopped=!0},e.prototype.fail=function(){return this.isStopped?!1:(this.isStopped=!0,this.error(!0),!0)},e}(Ae),Oe=D.AnonymousObserver=function(t){function e(e,n,r){t.call(this),this._onNext=e,this._onError=n,this._onCompleted=r}return H(e,t),e.prototype.next=function(t){this._onNext(t)},e.prototype.error=function(t){this._onError(t)},e.prototype.completed=function(){this._onCompleted()},e}(Ne),Re=function(t){function e(e){t.call(this),this._observer=e,this._state=0}H(e,t);var n=e.prototype;return n.onNext=function(t){this.checkAccess();try{this._observer.onNext(t)}catch(e){throw e}finally{this._state=0}},n.onError=function(t){this.checkAccess();try{this._observer.onError(t)}catch(e){throw e}finally{this._state=2}},n.onCompleted=function(){this.checkAccess();try{this._observer.onCompleted()}catch(t){throw t}finally{this._state=2}},n.checkAccess=function(){if(1===this._state)throw Error("Re-entrancy detected");if(2===this._state)throw Error("Observer completed");0===this._state&&(this._state=1)},e}(Ae),We=D.Internals.ScheduledObserver=function(t){function n(e,n){t.call(this),this.scheduler=e,this.observer=n,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new oe}return H(n,t),n.prototype.next=function(t){var e=this;this.queue.push(function(){e.observer.onNext(t)})},n.prototype.error=function(t){var e=this;this.queue.push(function(){e.observer.onError(t)})},n.prototype.completed=function(){var t=this;this.queue.push(function(){t.observer.onCompleted()})},n.prototype.ensureActive=function(){var t=!1,n=this;!this.hasFaulted&&this.queue.length>0&&(t=!this.isAcquired,this.isAcquired=!0),t&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(t){var r;if(!(n.queue.length>0))return n.isAcquired=!1,e;r=n.queue.shift();try{r()}catch(i){throw n.queue=[],n.hasFaulted=!0,i}t()}))},n.prototype.dispose=function(){t.prototype.dispose.call(this),this.disposable.dispose()},n}(Ne),ke=function(t){function e(){t.apply(this,arguments)}return H(e,t),e.prototype.next=function(e){t.prototype.next.call(this,e),this.ensureActive()},e.prototype.error=function(e){t.prototype.error.call(this,e),this.ensureActive()},e.prototype.completed=function(){t.prototype.completed.call(this),this.ensureActive()},e}(We),je=D.Observable=function(){function t(t){this._subscribe=t}return _e=t.prototype,_e.finalValue=function(){var t=this;return new Ge(function(e){var n,r=!1;return t.subscribe(function(t){r=!0,n=t},e.onError.bind(e),function(){r?(e.onNext(n),e.onCompleted()):e.onError(Error(A))})})},_e.subscribe=_e.forEach=function(t,e,n){var r;return r="object"==typeof t?t:Se(t,e,n),this._subscribe(r)},_e.toArray=function(){function t(t,e){var n=t.slice(0);return n.push(e),n}return this.scan([],t).startWith([]).finalValue()},t}();je.start=function(t,e,n){return qe(t,e,n)()};var qe=je.toAsync=function(t,n,r){return n||(n=de),function(){var i=B.call(arguments,0),o=new Ye;return n.schedule(function(){var n;try{n=t.apply(r,i)}catch(s){return o.onError(s),e}o.onNext(n),o.onCompleted()}),o.asObservable()}};_e.observeOn=function(t){var e=this;return new Ge(function(n){return e.subscribe(new ke(t,n))})},_e.subscribeOn=function(t){var e=this;return new Ge(function(n){var r=new re,i=new oe;return i.setDisposable(r),r.setDisposable(t.schedule(function(){i.setDisposable(new v(t,e.subscribe(n)))})),i})},je.create=function(t){return new Ge(function(e){return ee(t(e))})},je.createWithDisposable=function(t){return new Ge(t)};var Te=je.defer=function(t){return new Ge(function(e){var n;try{n=t()}catch(r){return Ve(r).subscribe(e)}return n.subscribe(e)})},Ie=je.empty=function(t){return t||(t=ae),new Ge(function(e){return t.schedule(function(){e.onCompleted()})})},Pe=je.fromArray=function(t,e){return e||(e=he),new Ge(function(n){var r=0;return e.scheduleRecursive(function(e){t.length>r?(n.onNext(t[r++]),e()):n.onCompleted()})})};je.generate=function(t,n,r,i,o){return o||(o=he),new Ge(function(s){var u=!0,c=t;return o.scheduleRecursive(function(t){var o,a;try{u?u=!1:c=r(c),o=n(c),o&&(a=i(c))}catch(h){return s.onError(h),e}o?(s.onNext(a),t()):s.onCompleted()})})};var Me=je.never=function(){return new Ge(function(){return ne})};je.range=function(t,e,n){return n||(n=he),new Ge(function(r){return n.scheduleRecursiveWithState(0,function(n,i){e>n?(r.onNext(t+n),i(n+1)):r.onCompleted()})})},je.repeat=function(t,e,n){return n||(n=he),null==e&&(e=-1),Le(t,n).repeat(e)};var Le=je["return"]=je.returnValue=function(t,e){return e||(e=ae),new Ge(function(n){return e.schedule(function(){n.onNext(t),n.onCompleted()})})},Ve=je["throw"]=je.throwException=function(t,e){return e||(e=ae),new Ge(function(n){return e.schedule(function(){n.onError(t)})})};je.using=function(t,e){return new Ge(function(n){var r,i,o=ne;try{r=t(),r&&(o=r),i=e(r)}catch(s){return new Z(Ve(s).subscribe(n),o)}return new Z(i.subscribe(n),o)})},_e.amb=function(t){var e=this;return new Ge(function(n){function r(){o||(o=s,a.dispose())}function i(){o||(o=u,c.dispose())}var o,s="L",u="R",c=new re,a=new re;return c.setDisposable(e.subscribe(function(t){r(),o===s&&n.onNext(t)},function(t){r(),o===s&&n.onError(t)},function(){r(),o===s&&n.onCompleted()})),a.setDisposable(t.subscribe(function(t){i(),o===u&&n.onNext(t)},function(t){i(),o===u&&n.onError(t)},function(){i(),o===u&&n.onCompleted()})),new Z(c,a)})},je.amb=function(){function t(t,e){return t.amb(e)}for(var e=Me(),n=d(arguments,0),r=0,i=n.length;i>r;r++)e=t(e,n[r]);return e},_e["catch"]=_e.catchException=function(t){return"function"==typeof t?y(this,t):ze([this,t])};var ze=je.catchException=je["catch"]=function(){var t=d(arguments,0);return De(t).catchException()};_e.combineLatest=function(){var t=B.call(arguments);return Array.isArray(t[0])?t[0].unshift(this):t.unshift(this),Fe.apply(this,t)};var Fe=je.combineLatest=function(){var t=B.call(arguments),n=t.pop();return Array.isArray(t[0])&&(t=t[0]),new Ge(function(r){function i(t){var i;if(c[t]=!0,a||(a=c.every(function(t){return t}))){try{i=n.apply(null,l)}catch(o){return r.onError(o),e}r.onNext(i)}else h.filter(function(e,n){return n!==t}).every(function(t){return t})&&r.onCompleted()}function o(t){h[t]=!0,h.every(function(t){return t})&&r.onCompleted()}for(var s=function(){return!1},u=t.length,c=b(u,s),a=!1,h=b(u,s),l=Array(u),f=Array(u),p=0;u>p;p++)(function(e){f[e]=new re,f[e].setDisposable(t[e].subscribe(function(t){l[e]=t,i(e)},r.onError.bind(r),function(){o(e)}))})(p);return new Z(f)})};_e.concat=function(){var t=B.call(arguments,0);return t.unshift(this),Be.apply(this,t)};var Be=je.concat=function(){var t=d(arguments,0);return De(t).concat()};_e.concatObservable=_e.concatAll=function(){return this.merge(1)},_e.merge=function(t){if("number"!=typeof t)return He(this,t);var e=this;return new Ge(function(n){var r=0,i=new Z,o=!1,s=[],u=function(t){var e=new re;i.add(e),e.setDisposable(t.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){var t;i.remove(e),s.length>0?(t=s.shift(),u(t)):(r--,o&&0===r&&n.onCompleted())}))};return i.add(e.subscribe(function(e){t>r?(r++,u(e)):s.push(e)},n.onError.bind(n),function(){o=!0,0===r&&n.onCompleted()})),i})};var He=je.merge=function(){var t,e;return arguments[0]?arguments[0].now?(t=arguments[0],e=B.call(arguments,1)):(t=ae,e=B.call(arguments,0)):(t=ae,e=B.call(arguments,1)),Array.isArray(e[0])&&(e=e[0]),Pe(e,t).mergeObservable()};_e.mergeObservable=_e.mergeAll=function(){var t=this;return new Ge(function(e){var n=new Z,r=!1,i=new re;return n.add(i),i.setDisposable(t.subscribe(function(t){var i=new re;n.add(i),i.setDisposable(t.subscribe(function(t){e.onNext(t)},e.onError.bind(e),function(){n.remove(i),r&&1===n.length&&e.onCompleted()}))},e.onError.bind(e),function(){r=!0,1===n.length&&e.onCompleted()})),n})},_e.onErrorResumeNext=function(t){if(!t)throw Error("Second observable is required");return Ue([this,t])};var Ue=je.onErrorResumeNext=function(){var t=d(arguments,0);return new Ge(function(e){var n=0,r=new oe,i=ae.scheduleRecursive(function(i){var o,s;t.length>n?(o=t[n++],s=new re,r.setDisposable(s),s.setDisposable(o.subscribe(e.onNext.bind(e),function(){i()},function(){i()}))):e.onCompleted()});return new Z(r,i)})};_e.skipUntil=function(t){var e=this;return new Ge(function(n){var r=!1,i=new Z(e.subscribe(function(t){r&&n.onNext(t)},n.onError.bind(n),function(){r&&n.onCompleted()})),o=new re;return i.add(o),o.setDisposable(t.subscribe(function(){r=!0,o.dispose()},n.onError.bind(n),function(){o.dispose()})),i})},_e.switchLatest=function(){var t=this;return new Ge(function(e){var n=!1,r=new oe,i=!1,o=0,s=t.subscribe(function(t){var s=new re,u=++o;n=!0,r.setDisposable(s),s.setDisposable(t.subscribe(function(t){o===u&&e.onNext(t)},function(t){o===u&&e.onError(t)},function(){o===u&&(n=!1,i&&e.onCompleted())}))},e.onError.bind(e),function(){i=!0,n||e.onCompleted()});return new Z(s,r)})},_e.takeUntil=function(t){var e=this;return new Ge(function(r){return new Z(e.subscribe(r),t.subscribe(r.onCompleted.bind(r),r.onError.bind(r),n))})},_e.zip=function(){if(Array.isArray(arguments[0]))return w.apply(this,arguments);var t=this,n=B.call(arguments),i=n.pop();return n.unshift(t),new Ge(function(o){function s(t){a[t]=!0,a.every(function(t){return t})&&o.onCompleted()}for(var u=n.length,c=b(u,function(){return[]}),a=b(u,function(){return!1}),h=function(n){var s,u;if(c.every(function(t){return t.length>0})){try{u=c.map(function(t){return t.shift()}),s=i.apply(t,u)}catch(h){return o.onError(h),e}o.onNext(s)}else a.filter(function(t,e){return e!==n}).every(r)&&o.onCompleted()},l=Array(u),f=0;u>f;f++)(function(t){l[t]=new re,l[t].setDisposable(n[t].subscribe(function(e){c[t].push(e),h(t)},o.onError.bind(o),function(){s(t)}))})(f);return new Z(l)})},je.zip=function(){var t=B.call(arguments,0),e=t.shift();return e.zip.apply(e,t)},je.zipArray=function(){var t=B.call(arguments);return new Ge(function(n){function i(t){if(u.every(function(t){return t.length>0})){var i=u.map(function(t){return t.shift()});n.onNext(i)}else if(c.filter(function(e,n){return n!==t}).every(r))return n.onCompleted(),e | ||
}function o(t){return c[t]=!0,c.every(r)?(n.onCompleted(),e):e}for(var s=t.length,u=b(s,function(){return[]}),c=b(s,function(){return!1}),a=Array(s),h=0;s>h;h++)(function(e){a[e]=new re,a[e].setDisposable(t[e].subscribe(function(t){u[e].push(t),i(e)},n.onError.bind(n),function(){o(e)}))})(h);var l=new Z(a);return l.add(ee(function(){for(var t=0,e=u.length;e>t;t++)u[t]=[]})),l})},_e.asObservable=function(){var t=this;return new Ge(function(e){return t.subscribe(e)})},_e.bufferWithCount=function(t,n){return n===e&&(n=t),this.windowWithCount(t,n).selectMany(function(t){return t.toArray()}).where(function(t){return t.length>0})},_e.dematerialize=function(){var t=this;return new Ge(function(e){return t.subscribe(function(t){return t.accept(e)},e.onError.bind(e),e.onCompleted.bind(e))})},_e.distinctUntilChanged=function(t,n){var i=this;return t||(t=r),n||(n=o),new Ge(function(r){var o,s=!1;return i.subscribe(function(i){var u,c=!1;try{u=t(i)}catch(a){return r.onError(a),e}if(s)try{c=n(o,u)}catch(a){return r.onError(a),e}s&&c||(s=!0,o=u,r.onNext(i))},r.onError.bind(r),r.onCompleted.bind(r))})},_e["do"]=_e.doAction=function(t,e,n){var r,i=this;return"function"==typeof t?r=t:(r=t.onNext.bind(t),e=t.onError.bind(t),n=t.onCompleted.bind(t)),new Ge(function(t){return i.subscribe(function(e){try{r(e)}catch(n){t.onError(n)}t.onNext(e)},function(n){if(e){try{e(n)}catch(r){t.onError(r)}t.onError(n)}else t.onError(n)},function(){if(n){try{n()}catch(e){t.onError(e)}t.onCompleted()}else t.onCompleted()})})},_e["finally"]=_e.finallyAction=function(t){var e=this;return new Ge(function(n){var r=e.subscribe(n);return ee(function(){try{r.dispose()}catch(e){throw e}finally{t()}})})},_e.ignoreElements=function(){var t=this;return new Ge(function(e){return t.subscribe(n,e.onError.bind(e),e.onCompleted.bind(e))})},_e.materialize=function(){var t=this;return new Ge(function(e){return t.subscribe(function(t){e.onNext(me(t))},function(t){e.onNext(ye(t)),e.onCompleted()},function(){e.onNext(we()),e.onCompleted()})})},_e.repeat=function(t){return Ce(this,t).concat()},_e.retry=function(t){return Ce(this,t).catchException()},_e.scan=function(){var t,e,n=!1;2===arguments.length?(t=arguments[0],e=arguments[1],n=!0):e=arguments[0];var r=this;return Te(function(){var i,o=!1;return r.select(function(r){return o?i=e(i,r):(i=n?e(t,r):r,o=!0),i})})},_e.skipLast=function(t){var e=this;return new Ge(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&n.onNext(r.shift())},n.onError.bind(n),n.onCompleted.bind(n))})},_e.startWith=function(){var t,e,n=0;return arguments.length&&"now"in Object(arguments[0])?(e=arguments[0],n=1):e=ae,t=B.call(arguments,n),De([Pe(t,e),this]).concat()},_e.takeLast=function(t,e){return this.takeLastBuffer(t).selectMany(function(t){return Pe(t,e)})},_e.takeLastBuffer=function(t){var e=this;return new Ge(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&r.shift()},n.onError.bind(n),function(){n.onNext(r),n.onCompleted()})})},_e.windowWithCount=function(t,e){var n=this;if(0>=t)throw Error(S);if(null==e&&(e=t),0>=e)throw Error(S);return new Ge(function(r){var i=new re,o=new se(i),s=0,u=[],c=function(){var t=new Xe;u.push(t),r.onNext(G(t,o))};return c(),i.setDisposable(n.subscribe(function(n){for(var r,i=0,o=u.length;o>i;i++)u[i].onNext(n);var a=s-t+1;a>=0&&0===a%e&&(r=u.shift(),r.onCompleted()),s++,0===s%e&&c()},function(t){for(;u.length>0;)u.shift().onError(t);r.onError(t)},function(){for(;u.length>0;)u.shift().onCompleted();r.onCompleted()})),o})},_e.defaultIfEmpty=function(t){var n=this;return t===e&&(t=null),new Ge(function(e){var r=!1;return n.subscribe(function(t){r=!0,e.onNext(t)},e.onError.bind(e),function(){r||e.onNext(t),e.onCompleted()})})},_e.distinct=function(t,n){var i=this;return t||(t=r),n||(n=u),new Ge(function(r){var o={};return i.subscribe(function(i){var s,u,c,a=!1;try{s=t(i),u=n(s)}catch(h){return r.onError(h),e}for(c in o)if(u===c){a=!0;break}a||(o[u]=null,r.onNext(i))},r.onError.bind(r),r.onCompleted.bind(r))})},_e.groupBy=function(t,e,n){return this.groupByUntil(t,e,function(){return Me()},n)},_e.groupByUntil=function(t,i,o,s){var c=this;return i||(i=r),s||(s=u),new Ge(function(r){var u={},a=new Z,h=new se(a);return a.add(c.subscribe(function(c){var l,f,p,d,b,v,m,y,w,g;try{v=t(c),m=s(v)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}d=!1;try{w=u[m],w||(w=new Xe,u[m]=w,d=!0)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}if(d){b=new Ke(v,w,h),f=new Ke(v,w);try{l=o(f)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}r.onNext(b),y=new re,a.add(y);var x=function(){m in u&&(delete u[m],w.onCompleted()),a.remove(y)};y.setDisposable(l.take(1).subscribe(n,function(t){for(g in u)u[g].onError(t);r.onError(t)},function(){x()}))}try{p=i(c)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}w.onNext(p)},function(t){for(var e in u)u[e].onError(t);r.onError(t)},function(){for(var t in u)u[t].onCompleted();r.onCompleted()})),h})},_e.select=_e.map=function(t,n){var r=this;return new Ge(function(i){var o=0;return r.subscribe(function(s){var u;try{u=t.call(n,s,o++,r)}catch(c){return i.onError(c),e}i.onNext(u)},i.onError.bind(i),i.onCompleted.bind(i))})},_e.pluck=function(t){return this.select(function(e){return e[t]})},_e.selectMany=_e.flatMap=function(t,e){return e?this.selectMany(function(n){return t(n).select(function(t){return e(n,t)})}):"function"==typeof t?g.call(this,t):g.call(this,function(){return t})},_e.skip=function(t){if(0>t)throw Error(S);var e=this;return new Ge(function(n){var r=t;return e.subscribe(function(t){0>=r?n.onNext(t):r--},n.onError.bind(n),n.onCompleted.bind(n))})},_e.skipWhile=function(t){var n=this;return new Ge(function(r){var i=0,o=!1;return n.subscribe(function(n){if(!o)try{o=!t(n,i++)}catch(s){return r.onError(s),e}o&&r.onNext(n)},r.onError.bind(r),r.onCompleted.bind(r))})},_e.take=function(t,e){if(0>t)throw Error(S);if(0===t)return Ie(e);var n=this;return new Ge(function(e){var r=t;return n.subscribe(function(t){r>0&&(r--,e.onNext(t),0===r&&e.onCompleted())},e.onError.bind(e),e.onCompleted.bind(e))})},_e.takeWhile=function(t){var n=this;return new Ge(function(r){var i=0,o=!0;return n.subscribe(function(n){if(o){try{o=t(n,i++)}catch(s){return r.onError(s),e}o?r.onNext(n):r.onCompleted()}},r.onError.bind(r),r.onCompleted.bind(r))})},_e.where=_e.filter=function(t,n){var r=this;return new Ge(function(i){var o=0;return r.subscribe(function(s){var u;try{u=t.call(n,s,o++,r)}catch(c){return i.onError(c),e}u&&i.onNext(s)},i.onError.bind(i),i.onCompleted.bind(i))})};var Ge=D.Internals.AnonymousObservable=function(t){function n(r){function i(t){var e=new Je(t);if(he.scheduleRequired())he.schedule(function(){try{e.disposable(r(e))}catch(t){if(!e.fail(t))throw t}});else try{e.disposable(r(e))}catch(n){if(!e.fail(n))throw n}return e}return this instanceof n?(t.call(this,i),e):new n(r)}return H(n,t),n}(je),Je=function(t){function e(e){t.call(this),this.observer=e,this.m=new re}H(e,t);var n=e.prototype;return n.next=function(t){var e=!1;try{this.observer.onNext(t),e=!0}catch(n){throw n}finally{e||this.dispose()}},n.error=function(t){try{this.observer.onError(t)}catch(e){throw e}finally{this.dispose()}},n.completed=function(){try{this.observer.onCompleted()}catch(t){throw t}finally{this.dispose()}},n.disposable=function(t){return this.m.disposable(t)},n.dispose=function(){t.prototype.dispose.call(this),this.m.dispose()},e}(Ne),Ke=function(t){function e(t){return this.underlyingObservable.subscribe(t)}function n(n,r,i){t.call(this,e),this.key=n,this.underlyingObservable=i?new Ge(function(t){return new Z(i.getDisposable(),r.subscribe(t))}):r}return H(n,t),n}(je),Qe=function(t,e){this.subject=t,this.observer=e};Qe.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1),this.observer=null}};var Xe=D.Subject=function(t){function e(t){return a.call(this),this.isStopped?this.exception?(t.onError(this.exception),ne):(t.onCompleted(),ne):(this.observers.push(t),new Qe(this,t))}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return H(n,t),U(n.prototype,Ae,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(a.call(this),!this.isStopped){var t=this.observers.slice(0);this.isStopped=!0;for(var e=0,n=t.length;n>e;e++)t[e].onCompleted();this.observers=[]}},onError:function(t){if(a.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){if(a.call(this),!this.isStopped)for(var e=this.observers.slice(0),n=0,r=e.length;r>n;n++)e[n].onNext(t)},dispose:function(){this.isDisposed=!0,this.observers=null}}),n.create=function(t,e){return new Ze(t,e)},n}(je),Ye=D.AsyncSubject=function(t){function e(t){if(a.call(this),!this.isStopped)return this.observers.push(t),new Qe(this,t);var e=this.exception,n=this.hasValue,r=this.value;return e?t.onError(e):n?(t.onNext(r),t.onCompleted()):t.onCompleted(),ne}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return H(n,t),U(n.prototype,Ae,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){var t,e,n;if(a.call(this),!this.isStopped){var r=this.observers.slice(0);this.isStopped=!0;var i=this.value,o=this.hasValue;if(o)for(e=0,n=r.length;n>e;e++)t=r[e],t.onNext(i),t.onCompleted();else for(e=0,n=r.length;n>e;e++)r[e].onCompleted();this.observers=[]}},onError:function(t){if(a.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){a.call(this),this.isStopped||(this.value=t,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),n}(je),Ze=function(t){function e(t){return this.observable.subscribe(t)}function n(n,r){t.call(this,e),this.observer=n,this.observable=r}return H(n,t),U(n.prototype,Ae,{onCompleted:function(){this.observer.onCompleted()},onError:function(t){this.observer.onError(t)},onNext:function(t){this.observer.onNext(t)}}),n}(je);return"function"==typeof define&&"object"==typeof define.amd&&define.amd?(t.Rx=D,define(function(){return D})):(E?"object"==typeof module&&module&&module.exports==E?module.exports=D:E=D:t.Rx=D,e)})(this); | ||
(function(t,e){function n(){}function r(t){return t}function i(){return(new Date).getTime()}function o(t,e){return F(t,e)}function s(t,e){return t-e}function u(t){return""+t}function c(t){throw t}function a(){if(this.isDisposed)throw Error(_)}function h(t){return"function"!=typeof t.toString&&"string"==typeof(t+"")}function l(t){return t&&"object"==typeof t?M.call(t)==O:!1}function f(t){return"function"==typeof t}function p(t,e,n,r){var i;if(t===e)return 0!==t||1/t==1/e;var o=typeof t,s=typeof e;if(!(t!==t||t&&N[o]||e&&N[s]))return!1;if(null==t||null==e)return t===e;var u=M.call(t),c=M.call(e);if(u==O&&(u=T),c==O&&(c=T),u!=c)return!1;switch(u){case W:case k:return+t==+e;case q:return t!=+t?e!=+e:0==t?1/t==1/e:t==+e;case I:case P:return t==e+""}var a=u==R;if(!a){if(u!=T||!C&&(h(t)||h(e)))return!1;var d=!V&&l(t)?Object:t.constructor,b=!V&&l(e)?Object:e.constructor;if(d!=b&&!(f(d)&&d instanceof d&&f(b)&&b instanceof b))return!1}for(var v=n.length;v--;)if(n[v]==t)return r[v]==e;var m=0;if(i=!0,n.push(t),r.push(e),a){for(v=t.length,m=e.length,i=m==t.length;m--;){var y=e[m];if(!(i=p(t[m],y,n,r)))break}return i}for(var w in e)if(L.call(e,w))return m++,i=L.call(t,w)&&p(t[w],e[w],n,r);if(i)for(var w in t)if(L.call(t,w))return i=--m>-1;return n.pop(),r.pop(),i}function d(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:B.call(t)}function b(t,e){for(var n=Array(t),r=0;t>r;r++)n[r]=e();return n}function v(t,e){this.scheduler=t,this.disposable=e,this.isDisposed=!1}function m(t,e,n,r,i){this.scheduler=t,this.state=e,this.action=n,this.dueTime=r,this.comparer=i||s,this.disposable=new re}function y(t,n){return new Ge(function(r){var i=new re,o=new oe;return o.setDisposable(i),i.setDisposable(t.subscribe(r.onNext.bind(r),function(t){var i,s;try{s=n(t)}catch(u){return r.onError(u),e}i=new re,o.setDisposable(i),i.setDisposable(s.subscribe(r))},r.onCompleted.bind(r))),o})}function w(t,n){var r=this;return new Ge(function(i){var o=0,s=t.length;return r.subscribe(function(r){if(s>o){var u,c=t[o++];try{u=n(r,c)}catch(a){return i.onError(a),e}i.onNext(u)}else i.onCompleted()},i.onError.bind(i),i.onCompleted.bind(i))})}function g(t){return this.select(t).mergeObservable()}var E="object"==typeof exports&&exports,x=("object"==typeof module&&module&&module.exports==E&&module,"object"==typeof global&&global);x.global===x&&(t=x);var C,D={Internals:{}},A="Sequence contains no elements.",S="Argument out of range",_="Object has been disposed",N={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},O="[object Arguments]",R="[object Array]",W="[object Boolean]",k="[object Date]",j="[object Function]",q="[object Number]",T="[object Object]",I="[object RegExp]",P="[object String]",M=Object.prototype.toString,L=Object.prototype.hasOwnProperty,V=M.call(arguments)==O;try{C=!(M.call(document)==T&&!({toString:0}+""))}catch(z){C=!0}V||(l=function(t){return t&&"object"==typeof t?L.call(t,"callee"):!1}),f(/x/)&&(f=function(t){return"function"==typeof t&&M.call(t)==j});var F=D.Internals.isEqual=function(t,e){return p(t,e,[],[])},B=Array.prototype.slice;({}).hasOwnProperty;var H=this.inherits=D.Internals.inherits=function(t,e){function n(){this.constructor=t}n.prototype=e.prototype,t.prototype=new n},U=D.Internals.addProperties=function(t){for(var e=B.call(arguments,1),n=0,r=e.length;r>n;n++){var i=e[n];for(var o in i)t[o]=i[o]}},G=D.Internals.addRef=function(t,e){return new Ge(function(n){return new Z(e.getDisposable(),t.subscribe(n))})};Function.prototype.bind||(Function.prototype.bind=function(t){var e=this,n=B.call(arguments,1),r=function(){function i(){}if(this instanceof r){i.prototype=e.prototype;var o=new i,s=e.apply(o,n.concat(B.call(arguments)));return Object(s)===s?s:o}return e.apply(t,n.concat(B.call(arguments)))};return r});var J=Object("a"),K="a"!=J[0]||!(0 in J);Array.prototype.every||(Array.prototype.every=function(t){var e=Object(this),n=K&&"[object String]"=={}.toString.call(this)?this.split(""):e,r=n.length>>>0,i=arguments[1];if("[object Function]"!={}.toString.call(t))throw new TypeError(t+" is not a function");for(var o=0;r>o;o++)if(o in n&&!t.call(i,n[o],o,e))return!1;return!0}),Array.prototype.map||(Array.prototype.map=function(t){var e=Object(this),n=K&&"[object String]"=={}.toString.call(this)?this.split(""):e,r=n.length>>>0,i=Array(r),o=arguments[1];if("[object Function]"!={}.toString.call(t))throw new TypeError(t+" is not a function");for(var s=0;r>s;s++)s in n&&(i[s]=t.call(o,n[s],s,e));return i}),Array.prototype.filter||(Array.prototype.filter=function(t){for(var e,n=[],r=Object(this),i=0,o=r.length>>>0;o>i;i++)e=r[i],i in r&&t.call(arguments[1],e,i,r)&&n.push(e);return n}),Array.isArray||(Array.isArray=function(t){return"[object Array]"==Object.prototype.toString.call(t)}),Array.prototype.indexOf||(Array.prototype.indexOf=function(t){var e=Object(this),n=e.length>>>0;if(0===n)return-1;var r=0;if(arguments.length>1&&(r=Number(arguments[1]),r!==r?r=0:0!==r&&1/0!=r&&r!==-1/0&&(r=(r>0||-1)*Math.floor(Math.abs(r)))),r>=n)return-1;for(var i=r>=0?r:Math.max(n-Math.abs(r),0);n>i;i++)if(i in e&&e[i]===t)return i;return-1});var Q=function(t,e){this.id=t,this.value=e};Q.prototype.compareTo=function(t){var e=this.value.compareTo(t.value);return 0===e&&(e=this.id-t.id),e};var X=function(t){this.items=Array(t),this.length=0},Y=X.prototype;Y.isHigherPriority=function(t,e){return 0>this.items[t].compareTo(this.items[e])},Y.percolate=function(t){if(!(t>=this.length||0>t)){var e=t-1>>1;if(!(0>e||e===t)&&this.isHigherPriority(t,e)){var n=this.items[t];this.items[t]=this.items[e],this.items[e]=n,this.percolate(e)}}},Y.heapify=function(t){if(t===e&&(t=0),!(t>=this.length||0>t)){var n=2*t+1,r=2*t+2,i=t;if(this.length>n&&this.isHigherPriority(n,i)&&(i=n),this.length>r&&this.isHigherPriority(r,i)&&(i=r),i!==t){var o=this.items[t];this.items[t]=this.items[i],this.items[i]=o,this.heapify(i)}}},Y.peek=function(){return this.items[0].value},Y.removeAt=function(t){this.items[t]=this.items[--this.length],delete this.items[this.length],this.heapify()},Y.dequeue=function(){var t=this.peek();return this.removeAt(0),t},Y.enqueue=function(t){var e=this.length++;this.items[e]=new Q(X.count++,t),this.percolate(e)},Y.remove=function(t){for(var e=0;this.length>e;e++)if(this.items[e].value===t)return this.removeAt(e),!0;return!1},X.count=0;var Z=D.CompositeDisposable=function(){this.disposables=d(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},$=Z.prototype;$.add=function(t){this.isDisposed?t.dispose():(this.disposables.push(t),this.length++)},$.remove=function(t){var e=!1;if(!this.isDisposed){var n=this.disposables.indexOf(t);-1!==n&&(e=!0,this.disposables.splice(n,1),this.length--,t.dispose())}return e},$.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()}},$.clear=function(){var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()},$.contains=function(t){return-1!==this.disposables.indexOf(t)},$.toArray=function(){return this.disposables.slice(0)};var te=D.Disposable=function(t){this.isDisposed=!1,this.action=t||n};te.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var ee=te.create=function(t){return new te(t)},ne=te.empty={dispose:n},re=D.SingleAssignmentDisposable=function(){this.isDisposed=!1,this.current=null},ie=re.prototype;ie.disposable=function(t){return t?this.setDisposable(t):this.getDisposable()},ie.getDisposable=function(){return this.current},ie.setDisposable=function(t){if(this.current)throw Error("Disposable has already been assigned");var e=this.isDisposed;e||(this.current=t),e&&t&&t.dispose()},ie.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()};var oe=D.SerialDisposable=function(){this.isDisposed=!1,this.current=null};oe.prototype.getDisposable=function(){return this.current},oe.prototype.setDisposable=function(t){var e,n=this.isDisposed;n||(e=this.current,this.current=t),e&&e.dispose(),n&&t&&t.dispose()},oe.prototype.disposable=function(t){return t?(this.setDisposable(t),e):this.getDisposable()},oe.prototype.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()};var se=D.RefCountDisposable=function(){function t(t){this.disposable=t,this.disposable.count++,this.isInnerDisposed=!1}function e(t){this.underlyingDisposable=t,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return t.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},e.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},e.prototype.getDisposable=function(){return this.isDisposed?ne:new t(this)},e}();v.prototype.dispose=function(){var t=this;this.scheduler.schedule(function(){t.isDisposed||(t.isDisposed=!0,t.disposable.dispose())})},m.prototype.invoke=function(){this.disposable.disposable(this.invokeCore())},m.prototype.compareTo=function(t){return this.comparer(this.dueTime,t.dueTime)},m.prototype.isCancelled=function(){return this.disposable.isDisposed},m.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var ue=D.Scheduler=function(){function e(t,e,n,r){this.now=t,this._schedule=e,this._scheduleRelative=n,this._scheduleAbsolute=r}function n(t,e){var n=e.first,r=e.second,i=new Z,o=function(e){r(e,function(e){var n=!1,r=!1,s=t.scheduleWithState(e,function(t,e){return n?i.remove(s):r=!0,o(e),ne});r||(i.add(s),n=!0)})};return o(n),i}function r(t,e,n){var r=e.first,i=e.second,o=new Z,s=function(e){i(e,function(e,r){var i=!1,u=!1,c=t[n].call(t,e,r,function(t,e){return i?o.remove(c):u=!0,s(e),ne});u||(o.add(c),i=!0)})};return s(r),o}function o(t,e){return e(),ne}var s=e.prototype;return s.catchException=function(t){return new be(this,t)},s.schedulePeriodic=function(t,e){return this.schedulePeriodicWithState(null,t,function(){e()})},s.schedulePeriodicWithState=function(e,n,r){var i=e,o=t.setInterval(function(){i=r(i)},n);return ee(function(){t.clearInterval(o)})},s.schedule=function(t){return this._schedule(t,o)},s.scheduleWithState=function(t,e){return this._schedule(t,e)},s.scheduleWithRelative=function(t,e){return this._scheduleRelative(e,t,o)},s.scheduleWithRelativeAndState=function(t,e,n){return this._scheduleRelative(t,e,n)},s.scheduleWithAbsolute=function(t,e){return this._scheduleAbsolute(e,t,o)},s.scheduleWithAbsoluteAndState=function(t,e,n){return this._scheduleAbsolute(t,e,n)},s.scheduleRecursive=function(t){return this.scheduleRecursiveWithState(t,function(t,e){t(function(){e(t)})})},s.scheduleRecursiveWithState=function(t,e){return this.scheduleWithState({first:t,second:e},function(t,e){return n(t,e)})},s.scheduleRecursiveWithRelative=function(t,e){return this.scheduleRecursiveWithRelativeAndState(e,t,function(t,e){t(function(n){e(t,n)})})},s.scheduleRecursiveWithRelativeAndState=function(t,e,n){return this._scheduleRelative({first:t,second:n},e,function(t,e){return r(t,e,"scheduleWithRelativeAndState")})},s.scheduleRecursiveWithAbsolute=function(t,e){return this.scheduleRecursiveWithAbsoluteAndState(e,t,function(t,e){t(function(n){e(t,n)})})},s.scheduleRecursiveWithAbsoluteAndState=function(t,e,n){return this._scheduleAbsolute({first:t,second:n},e,function(t,e){return r(t,e,"scheduleWithAbsoluteAndState")})},e.now=i,e.normalize=function(t){return 0>t&&(t=0),t},e}(),ce="Scheduler is not allowed to block the thread",ae=ue.immediate=function(){function t(t,e){return e(this,t)}function e(t,e,n){if(e>0)throw Error(ce);return n(this,t)}function n(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new ue(i,t,e,n)}(),he=ue.currentThread=function(){function t(){o=new X(4)}function e(t,e){return this.scheduleWithRelativeAndState(t,0,e)}function n(e,n,r){var i,s=this.now()+ue.normalize(n),u=new m(this,e,r,s);if(o)o.enqueue(u);else{i=new t;try{o.enqueue(u),i.run()}catch(c){throw c}finally{i.dispose()}}return u.disposable}function r(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}var o;t.prototype.dispose=function(){o=null},t.prototype.run=function(){for(var t;o.length>0;)if(t=o.dequeue(),!t.isCancelled()){for(;t.dueTime-ue.now()>0;);t.isCancelled()||t.invoke()}};var s=new ue(i,e,n,r);return s.scheduleRequired=function(){return null===o},s.ensureTrampoline=function(t){return null===o?this.schedule(t):t()},s}(),le=function(){function t(t,e){e(0,this._period);try{this._state=this._action(this._state)}catch(n){throw this._cancel.dispose(),n}}function e(t,e,n,r){this._scheduler=t,this._state=e,this._period=n,this._action=r}return e.prototype.start=function(){var e=new re;return this._cancel=e,e.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,t.bind(this))),e},e}();D.VirtualTimeScheduler=function(t){function n(){return this.toDateTimeOffset(this.clock)}function r(t,e){return this.scheduleAbsoluteWithState(t,this.clock,e)}function i(t,e,n){return this.scheduleRelativeWithState(t,this.toRelative(e),n)}function o(t,e,n){return this.scheduleRelativeWithState(t,this.toRelative(e-this.now()),n)}function s(t,e){return e(),ne}function u(e,s){this.clock=e,this.comparer=s,this.isEnabled=!1,this.queue=new X(1024),t.call(this,n,r,i,o)}H(u,t);var c=u.prototype;return c.schedulePeriodicWithState=function(t,e,n){var r=new le(this,t,e,n);return r.start()},c.scheduleRelativeWithState=function(t,e,n){var r=this.add(this.clock,e);return this.scheduleAbsoluteWithState(t,r,n)},c.scheduleRelative=function(t,e){return this.scheduleRelativeWithState(e,t,s)},c.start=function(){var t;if(!this.isEnabled){this.isEnabled=!0;do t=this.getNext(),null!==t?(this.comparer(t.dueTime,this.clock)>0&&(this.clock=t.dueTime),t.invoke()):this.isEnabled=!1;while(this.isEnabled)}},c.stop=function(){this.isEnabled=!1},c.advanceTo=function(t){var e,n=this.comparer(this.clock,t);if(this.comparer(this.clock,t)>0)throw Error(S);if(0!==n&&!this.isEnabled){this.isEnabled=!0;do e=this.getNext(),null!==e&&0>=this.comparer(e.dueTime,t)?(this.comparer(e.dueTime,this.clock)>0&&(this.clock=e.dueTime),e.invoke()):this.isEnabled=!1;while(this.isEnabled);this.clock=t}},c.advanceBy=function(t){var n=this.add(this.clock,t),r=this.comparer(this.clock,n);if(r>0)throw Error(S);return 0!==r?this.advanceTo(n):e},c.sleep=function(t){var e=this.add(this.clock,t);if(this.comparer(this.clock,e)>=0)throw Error(S);this.clock=e},c.getNext=function(){for(var t;this.queue.length>0;){if(t=this.queue.peek(),!t.isCancelled())return t;this.queue.dequeue()}return null},c.scheduleAbsolute=function(t,e){return this.scheduleAbsoluteWithState(e,t,s)},c.scheduleAbsoluteWithState=function(t,e,n){var r=this,i=function(t,e){return r.queue.remove(o),n(t,e)},o=new m(r,t,i,e,r.comparer);return r.queue.enqueue(o),o.disposable},u}(ue),D.HistoricalScheduler=function(t){function e(e,n){var r=null==e?0:e,i=n||s;t.call(this,r,i)}H(e,t);var n=e.prototype;return n.add=function(t,e){return t+e},n.toDateTimeOffset=function(t){return new Date(t).getTime()},n.toRelative=function(t){return t},e}(D.VirtualTimeScheduler);var fe,pe=n;(function(){function e(){if(!t.postMessage||t.importScripts)return!1;var e=!1,n=t.onmessage;return t.onmessage=function(){e=!0},t.postMessage("","*"),t.onmessage=n,e}function n(t){if("string"==typeof t.data&&t.data.substring(0,r.length)===r){var e=t.data.substring(r.length),n=i[e];n(),delete i[e]}}if("function"==typeof t.setImmediate)fe=t.setImmediate,pe=clearImmediate;else if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))fe=process.nextTick;else if(e()){var r="ms.rx.schedule"+Math.random(),i={},o=0;t.addEventListener?t.addEventListener("message",n,!1):t.attachEvent("onmessage",n,!1),fe=function(e){var n=o++;i[n]=e,t.postMessage(r+n,"*")}}else if(t.MessageChannel){var s=new t.MessageChannel,u={},c=0;s.port1.onmessage=function(t){var e=t.data,n=u[e];n(),delete u[e]},fe=function(t){var e=c++;u[e]=t,s.port2.postMessage(e)}}else"document"in t&&"onreadystatechange"in t.document.createElement("script")?fe=function(e){var n=t.document.createElement("script");n.onreadystatechange=function(){e(),n.onreadystatechange=null,n.parentNode.removeChild(n),n=null},t.document.documentElement.appendChild(n)}:(fe=function(e){return t.setTimeout(e,0)},pe=t.clearTimeout)})();var de=ue.timeout=function(){function e(t,e){var n=this,r=new re,i=fe(function(){r.isDisposed||r.setDisposable(e(n,t))});return new Z(r,ee(function(){pe(i)}))}function n(e,n,r){var i=this,o=ue.normalize(n);if(0===o)return i.scheduleWithState(e,r);var s=new re,u=t.setTimeout(function(){s.isDisposed||s.setDisposable(r(i,e))},o);return new Z(s,ee(function(){t.clearTimeout(u)}))}function r(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new ue(i,e,n,r)}(),be=function(t){function e(){return this._scheduler.now()}function n(t,e){return this._scheduler.scheduleWithState(t,this._wrap(e))}function r(t,e,n){return this._scheduler.scheduleWithRelativeAndState(t,e,this._wrap(n))}function i(t,e,n){return this._scheduler.scheduleWithAbsoluteAndState(t,e,this._wrap(n))}function o(o,s){this._scheduler=o,this._handler=s,this._recursiveOriginal=null,this._recursiveWrapper=null,t.call(this,e,n,r,i)}return H(o,t),o.prototype._clone=function(t){return new o(t,this._handler)},o.prototype._wrap=function(t){var e=this;return function(n,r){try{return t(e._getRecursiveWrapper(n),r)}catch(i){if(!e._handler(i))throw i;return ne}}},o.prototype._getRecursiveWrapper=function(t){if(this._recursiveOriginal!==t){this._recursiveOriginal=t;var e=this._clone(t);e._recursiveOriginal=t,e._recursiveWrapper=e,this._recursiveWrapper=e}return this._recursiveWrapper},o.prototype.schedulePeriodicWithState=function(t,e,n){var r=this,i=!1,o=new re;return o.setDisposable(this._scheduler.schedulePeriodicWithState(t,e,function(t){if(i)return null;try{return n(t)}catch(e){if(i=!0,!r._handler(e))throw e;return o.dispose(),null}})),o},o}(ue),ve=D.Notification=function(){function t(t,e){this.hasValue=null==e?!1:e,this.kind=t}var e=t.prototype;return e.accept=function(t,e,n){return 1===arguments.length&&"object"==typeof t?this._acceptObservable(t):this._accept(t,e,n)},e.toObservable=function(t){var e=this;return t=t||ae,new Ge(function(n){return t.schedule(function(){e._acceptObservable(n),"N"===e.kind&&n.onCompleted()})})},t}(),me=ve.createOnNext=function(){function t(t){return t(this.value)}function e(t){return t.onNext(this.value)}function n(){return"OnNext("+this.value+")"}return function(r){var i=new ve("N",!0);return i.value=r,i._accept=t.bind(i),i._acceptObservable=e.bind(i),i.toString=n.bind(i),i}}(),ye=ve.createOnError=function(){function t(t,e){return e(this.exception)}function e(t){return t.onError(this.exception)}function n(){return"OnError("+this.exception+")"}return function(r){var i=new ve("E");return i.exception=r,i._accept=t.bind(i),i._acceptObservable=e.bind(i),i.toString=n.bind(i),i}}(),we=ve.createOnCompleted=function(){function t(t,e,n){return n()}function e(t){return t.onCompleted()}function n(){return"OnCompleted()"}return function(){var r=new ve("C");return r._accept=t.bind(r),r._acceptObservable=e.bind(r),r.toString=n.bind(r),r}}(),ge=D.Internals.Enumerator=function(t,e,n){this.moveNext=t,this.getCurrent=e,this.dispose=n},Ee=ge.create=function(t,e,r){var i=!1;return r||(r=n),new ge(function(){if(i)return!1;var e=t();return e||(i=!0,r()),e},function(){return e()},function(){i||(r(),i=!0)})},xe=D.Internals.Enumerable=function(){function t(t){this.getEnumerator=t}return t.prototype.concat=function(){var t=this;return new Ge(function(n){var r=t.getEnumerator(),i=!1,o=new oe,s=ae.scheduleRecursive(function(t){var s,u,c=!1;if(!i){try{c=r.moveNext(),c?s=r.getCurrent():r.dispose()}catch(a){u=a,r.dispose()}if(u)return n.onError(u),e;if(!c)return n.onCompleted(),e;var h=new re;o.setDisposable(h),h.setDisposable(s.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){t()}))}});return new Z(o,s,ee(function(){i=!0,r.dispose()}))})},t.prototype.catchException=function(){var t=this;return new Ge(function(n){var r,i=t.getEnumerator(),o=!1,s=new oe,u=ae.scheduleRecursive(function(t){var u,c,a;if(a=!1,!o){try{a=i.moveNext(),a&&(u=i.getCurrent())}catch(h){c=h}if(c)return n.onError(c),e;if(!a)return r?n.onError(r):n.onCompleted(),e;var l=new re;s.setDisposable(l),l.setDisposable(u.subscribe(n.onNext.bind(n),function(e){r=e,t()},n.onCompleted.bind(n)))}});return new Z(s,u,ee(function(){o=!0}))})},t}(),Ce=xe.repeat=function(t,n){return n===e&&(n=-1),new xe(function(){var e,r=n;return Ee(function(){return 0===r?!1:(r>0&&r--,e=t,!0)},function(){return e})})},De=xe.forEach=function(t,e){return e||(e=r),new xe(function(){var n,r=-1;return Ee(function(){return++r<t.length?(n=e(t[r],r),!0):!1},function(){return n})})},Ae=D.Observer=function(){};Ae.prototype.toNotifier=function(){var t=this;return function(e){return e.accept(t)}},Ae.prototype.asObserver=function(){return new Oe(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},Ae.prototype.checked=function(){return new Re(this)};var Se=Ae.create=function(t,e,r){return t||(t=n),e||(e=c),r||(r=n),new Oe(t,e,r)};Ae.fromNotifier=function(t){return new Oe(function(e){return t(me(e))},function(e){return t(ye(e))},function(){return t(we())})};var _e,Ne=D.Internals.AbstractObserver=function(t){function e(){this.isStopped=!1,t.call(this)}return H(e,t),e.prototype.onNext=function(t){this.isStopped||this.next(t)},e.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.error(t))},e.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},e.prototype.dispose=function(){this.isStopped=!0},e.prototype.fail=function(t){return this.isStopped?!1:(this.isStopped=!0,this.error(t),!0)},e}(Ae),Oe=D.AnonymousObserver=function(t){function e(e,n,r){t.call(this),this._onNext=e,this._onError=n,this._onCompleted=r}return H(e,t),e.prototype.next=function(t){this._onNext(t)},e.prototype.error=function(t){this._onError(t)},e.prototype.completed=function(){this._onCompleted()},e}(Ne),Re=function(t){function e(e){t.call(this),this._observer=e,this._state=0}H(e,t);var n=e.prototype;return n.onNext=function(t){this.checkAccess();try{this._observer.onNext(t)}catch(e){throw e}finally{this._state=0}},n.onError=function(t){this.checkAccess();try{this._observer.onError(t)}catch(e){throw e}finally{this._state=2}},n.onCompleted=function(){this.checkAccess();try{this._observer.onCompleted()}catch(t){throw t}finally{this._state=2}},n.checkAccess=function(){if(1===this._state)throw Error("Re-entrancy detected");if(2===this._state)throw Error("Observer completed");0===this._state&&(this._state=1)},e}(Ae),We=D.Internals.ScheduledObserver=function(t){function n(e,n){t.call(this),this.scheduler=e,this.observer=n,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new oe}return H(n,t),n.prototype.next=function(t){var e=this;this.queue.push(function(){e.observer.onNext(t)})},n.prototype.error=function(t){var e=this;this.queue.push(function(){e.observer.onError(t)})},n.prototype.completed=function(){var t=this;this.queue.push(function(){t.observer.onCompleted()})},n.prototype.ensureActive=function(){var t=!1,n=this;!this.hasFaulted&&this.queue.length>0&&(t=!this.isAcquired,this.isAcquired=!0),t&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(t){var r;if(!(n.queue.length>0))return n.isAcquired=!1,e;r=n.queue.shift();try{r()}catch(i){throw n.queue=[],n.hasFaulted=!0,i}t()}))},n.prototype.dispose=function(){t.prototype.dispose.call(this),this.disposable.dispose()},n}(Ne),ke=function(t){function e(){t.apply(this,arguments)}return H(e,t),e.prototype.next=function(e){t.prototype.next.call(this,e),this.ensureActive()},e.prototype.error=function(e){t.prototype.error.call(this,e),this.ensureActive()},e.prototype.completed=function(){t.prototype.completed.call(this),this.ensureActive()},e}(We),je=D.Observable=function(){function t(t){this._subscribe=t}return _e=t.prototype,_e.finalValue=function(){var t=this;return new Ge(function(e){var n,r=!1;return t.subscribe(function(t){r=!0,n=t},e.onError.bind(e),function(){r?(e.onNext(n),e.onCompleted()):e.onError(Error(A))})})},_e.subscribe=_e.forEach=function(t,e,n){var r;return r="object"==typeof t?t:Se(t,e,n),this._subscribe(r)},_e.toArray=function(){function t(t,e){var n=t.slice(0);return n.push(e),n}return this.scan([],t).startWith([]).finalValue()},t}();je.start=function(t,e,n){return qe(t,e,n)()};var qe=je.toAsync=function(t,n,r){return n||(n=de),function(){var i=B.call(arguments,0),o=new Ye;return n.schedule(function(){var n;try{n=t.apply(r,i)}catch(s){return o.onError(s),e}o.onNext(n),o.onCompleted()}),o.asObservable()}};_e.observeOn=function(t){var e=this;return new Ge(function(n){return e.subscribe(new ke(t,n))})},_e.subscribeOn=function(t){var e=this;return new Ge(function(n){var r=new re,i=new oe;return i.setDisposable(r),r.setDisposable(t.schedule(function(){i.setDisposable(new v(t,e.subscribe(n)))})),i})},je.create=function(t){return new Ge(function(e){return ee(t(e))})},je.createWithDisposable=function(t){return new Ge(t)};var Te=je.defer=function(t){return new Ge(function(e){var n;try{n=t()}catch(r){return Ve(r).subscribe(e)}return n.subscribe(e)})},Ie=je.empty=function(t){return t||(t=ae),new Ge(function(e){return t.schedule(function(){e.onCompleted()})})},Pe=je.fromArray=function(t,e){return e||(e=he),new Ge(function(n){var r=0;return e.scheduleRecursive(function(e){t.length>r?(n.onNext(t[r++]),e()):n.onCompleted()})})};je.generate=function(t,n,r,i,o){return o||(o=he),new Ge(function(s){var u=!0,c=t;return o.scheduleRecursive(function(t){var o,a;try{u?u=!1:c=r(c),o=n(c),o&&(a=i(c))}catch(h){return s.onError(h),e}o?(s.onNext(a),t()):s.onCompleted()})})};var Me=je.never=function(){return new Ge(function(){return ne})};je.range=function(t,e,n){return n||(n=he),new Ge(function(r){return n.scheduleRecursiveWithState(0,function(n,i){e>n?(r.onNext(t+n),i(n+1)):r.onCompleted()})})},je.repeat=function(t,e,n){return n||(n=he),null==e&&(e=-1),Le(t,n).repeat(e)};var Le=je["return"]=je.returnValue=function(t,e){return e||(e=ae),new Ge(function(n){return e.schedule(function(){n.onNext(t),n.onCompleted()})})},Ve=je["throw"]=je.throwException=function(t,e){return e||(e=ae),new Ge(function(n){return e.schedule(function(){n.onError(t)})})};je.using=function(t,e){return new Ge(function(n){var r,i,o=ne;try{r=t(),r&&(o=r),i=e(r)}catch(s){return new Z(Ve(s).subscribe(n),o)}return new Z(i.subscribe(n),o)})},_e.amb=function(t){var e=this;return new Ge(function(n){function r(){o||(o=s,a.dispose())}function i(){o||(o=u,c.dispose())}var o,s="L",u="R",c=new re,a=new re;return c.setDisposable(e.subscribe(function(t){r(),o===s&&n.onNext(t)},function(t){r(),o===s&&n.onError(t)},function(){r(),o===s&&n.onCompleted()})),a.setDisposable(t.subscribe(function(t){i(),o===u&&n.onNext(t)},function(t){i(),o===u&&n.onError(t)},function(){i(),o===u&&n.onCompleted()})),new Z(c,a)})},je.amb=function(){function t(t,e){return t.amb(e)}for(var e=Me(),n=d(arguments,0),r=0,i=n.length;i>r;r++)e=t(e,n[r]);return e},_e["catch"]=_e.catchException=function(t){return"function"==typeof t?y(this,t):ze([this,t])};var ze=je.catchException=je["catch"]=function(){var t=d(arguments,0);return De(t).catchException()};_e.combineLatest=function(){var t=B.call(arguments);return Array.isArray(t[0])?t[0].unshift(this):t.unshift(this),Fe.apply(this,t)};var Fe=je.combineLatest=function(){var t=B.call(arguments),n=t.pop();return Array.isArray(t[0])&&(t=t[0]),new Ge(function(r){function i(t){var i;if(c[t]=!0,a||(a=c.every(function(t){return t}))){try{i=n.apply(null,l)}catch(o){return r.onError(o),e}r.onNext(i)}else h.filter(function(e,n){return n!==t}).every(function(t){return t})&&r.onCompleted()}function o(t){h[t]=!0,h.every(function(t){return t})&&r.onCompleted()}for(var s=function(){return!1},u=t.length,c=b(u,s),a=!1,h=b(u,s),l=Array(u),f=Array(u),p=0;u>p;p++)(function(e){f[e]=new re,f[e].setDisposable(t[e].subscribe(function(t){l[e]=t,i(e)},r.onError.bind(r),function(){o(e)}))})(p);return new Z(f)})};_e.concat=function(){var t=B.call(arguments,0);return t.unshift(this),Be.apply(this,t)};var Be=je.concat=function(){var t=d(arguments,0);return De(t).concat()};_e.concatObservable=_e.concatAll=function(){return this.merge(1)},_e.merge=function(t){if("number"!=typeof t)return He(this,t);var e=this;return new Ge(function(n){var r=0,i=new Z,o=!1,s=[],u=function(t){var e=new re;i.add(e),e.setDisposable(t.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){var t;i.remove(e),s.length>0?(t=s.shift(),u(t)):(r--,o&&0===r&&n.onCompleted())}))};return i.add(e.subscribe(function(e){t>r?(r++,u(e)):s.push(e)},n.onError.bind(n),function(){o=!0,0===r&&n.onCompleted()})),i})};var He=je.merge=function(){var t,e;return arguments[0]?arguments[0].now?(t=arguments[0],e=B.call(arguments,1)):(t=ae,e=B.call(arguments,0)):(t=ae,e=B.call(arguments,1)),Array.isArray(e[0])&&(e=e[0]),Pe(e,t).mergeObservable()};_e.mergeObservable=_e.mergeAll=function(){var t=this;return new Ge(function(e){var n=new Z,r=!1,i=new re;return n.add(i),i.setDisposable(t.subscribe(function(t){var i=new re;n.add(i),i.setDisposable(t.subscribe(function(t){e.onNext(t)},e.onError.bind(e),function(){n.remove(i),r&&1===n.length&&e.onCompleted()}))},e.onError.bind(e),function(){r=!0,1===n.length&&e.onCompleted()})),n})},_e.onErrorResumeNext=function(t){if(!t)throw Error("Second observable is required");return Ue([this,t])};var Ue=je.onErrorResumeNext=function(){var t=d(arguments,0);return new Ge(function(e){var n=0,r=new oe,i=ae.scheduleRecursive(function(i){var o,s;t.length>n?(o=t[n++],s=new re,r.setDisposable(s),s.setDisposable(o.subscribe(e.onNext.bind(e),function(){i()},function(){i()}))):e.onCompleted()});return new Z(r,i)})};_e.skipUntil=function(t){var e=this;return new Ge(function(n){var r=!1,i=new Z(e.subscribe(function(t){r&&n.onNext(t)},n.onError.bind(n),function(){r&&n.onCompleted()})),o=new re;return i.add(o),o.setDisposable(t.subscribe(function(){r=!0,o.dispose()},n.onError.bind(n),function(){o.dispose()})),i})},_e["switch"]=_e.switchLatest=function(){var t=this;return new Ge(function(e){var n=!1,r=new oe,i=!1,o=0,s=t.subscribe(function(t){var s=new re,u=++o;n=!0,r.setDisposable(s),s.setDisposable(t.subscribe(function(t){o===u&&e.onNext(t)},function(t){o===u&&e.onError(t)},function(){o===u&&(n=!1,i&&e.onCompleted())}))},e.onError.bind(e),function(){i=!0,n||e.onCompleted()});return new Z(s,r)})},_e.takeUntil=function(t){var e=this;return new Ge(function(r){return new Z(e.subscribe(r),t.subscribe(r.onCompleted.bind(r),r.onError.bind(r),n))})},_e.zip=function(){if(Array.isArray(arguments[0]))return w.apply(this,arguments);var t=this,n=B.call(arguments),i=n.pop();return n.unshift(t),new Ge(function(o){function s(t){a[t]=!0,a.every(function(t){return t})&&o.onCompleted()}for(var u=n.length,c=b(u,function(){return[]}),a=b(u,function(){return!1}),h=function(n){var s,u;if(c.every(function(t){return t.length>0})){try{u=c.map(function(t){return t.shift()}),s=i.apply(t,u)}catch(h){return o.onError(h),e}o.onNext(s)}else a.filter(function(t,e){return e!==n}).every(r)&&o.onCompleted()},l=Array(u),f=0;u>f;f++)(function(t){l[t]=new re,l[t].setDisposable(n[t].subscribe(function(e){c[t].push(e),h(t)},o.onError.bind(o),function(){s(t)}))})(f);return new Z(l)})},je.zip=function(){var t=B.call(arguments,0),e=t.shift();return e.zip.apply(e,t)},je.zipArray=function(){var t=B.call(arguments);return new Ge(function(n){function i(t){if(u.every(function(t){return t.length>0})){var i=u.map(function(t){return t.shift()});n.onNext(i)}else if(c.filter(function(e,n){return n!==t | ||
}).every(r))return n.onCompleted(),e}function o(t){return c[t]=!0,c.every(r)?(n.onCompleted(),e):e}for(var s=t.length,u=b(s,function(){return[]}),c=b(s,function(){return!1}),a=Array(s),h=0;s>h;h++)(function(e){a[e]=new re,a[e].setDisposable(t[e].subscribe(function(t){u[e].push(t),i(e)},n.onError.bind(n),function(){o(e)}))})(h);var l=new Z(a);return l.add(ee(function(){for(var t=0,e=u.length;e>t;t++)u[t]=[]})),l})},_e.asObservable=function(){var t=this;return new Ge(function(e){return t.subscribe(e)})},_e.bufferWithCount=function(t,n){return n===e&&(n=t),this.windowWithCount(t,n).selectMany(function(t){return t.toArray()}).where(function(t){return t.length>0})},_e.dematerialize=function(){var t=this;return new Ge(function(e){return t.subscribe(function(t){return t.accept(e)},e.onError.bind(e),e.onCompleted.bind(e))})},_e.distinctUntilChanged=function(t,n){var i=this;return t||(t=r),n||(n=o),new Ge(function(r){var o,s=!1;return i.subscribe(function(i){var u,c=!1;try{u=t(i)}catch(a){return r.onError(a),e}if(s)try{c=n(o,u)}catch(a){return r.onError(a),e}s&&c||(s=!0,o=u,r.onNext(i))},r.onError.bind(r),r.onCompleted.bind(r))})},_e["do"]=_e.doAction=function(t,e,n){var r,i=this;return"function"==typeof t?r=t:(r=t.onNext.bind(t),e=t.onError.bind(t),n=t.onCompleted.bind(t)),new Ge(function(t){return i.subscribe(function(e){try{r(e)}catch(n){t.onError(n)}t.onNext(e)},function(n){if(e){try{e(n)}catch(r){t.onError(r)}t.onError(n)}else t.onError(n)},function(){if(n){try{n()}catch(e){t.onError(e)}t.onCompleted()}else t.onCompleted()})})},_e["finally"]=_e.finallyAction=function(t){var e=this;return new Ge(function(n){var r=e.subscribe(n);return ee(function(){try{r.dispose()}catch(e){throw e}finally{t()}})})},_e.ignoreElements=function(){var t=this;return new Ge(function(e){return t.subscribe(n,e.onError.bind(e),e.onCompleted.bind(e))})},_e.materialize=function(){var t=this;return new Ge(function(e){return t.subscribe(function(t){e.onNext(me(t))},function(t){e.onNext(ye(t)),e.onCompleted()},function(){e.onNext(we()),e.onCompleted()})})},_e.repeat=function(t){return Ce(this,t).concat()},_e.retry=function(t){return Ce(this,t).catchException()},_e.scan=function(){var t,e,n=!1;2===arguments.length?(t=arguments[0],e=arguments[1],n=!0):e=arguments[0];var r=this;return Te(function(){var i,o=!1;return r.select(function(r){return o?i=e(i,r):(i=n?e(t,r):r,o=!0),i})})},_e.skipLast=function(t){var e=this;return new Ge(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&n.onNext(r.shift())},n.onError.bind(n),n.onCompleted.bind(n))})},_e.startWith=function(){var t,e,n=0;return arguments.length&&"now"in Object(arguments[0])?(e=arguments[0],n=1):e=ae,t=B.call(arguments,n),De([Pe(t,e),this]).concat()},_e.takeLast=function(t,e){return this.takeLastBuffer(t).selectMany(function(t){return Pe(t,e)})},_e.takeLastBuffer=function(t){var e=this;return new Ge(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&r.shift()},n.onError.bind(n),function(){n.onNext(r),n.onCompleted()})})},_e.windowWithCount=function(t,e){var n=this;if(0>=t)throw Error(S);if(null==e&&(e=t),0>=e)throw Error(S);return new Ge(function(r){var i=new re,o=new se(i),s=0,u=[],c=function(){var t=new Xe;u.push(t),r.onNext(G(t,o))};return c(),i.setDisposable(n.subscribe(function(n){for(var r,i=0,o=u.length;o>i;i++)u[i].onNext(n);var a=s-t+1;a>=0&&0===a%e&&(r=u.shift(),r.onCompleted()),s++,0===s%e&&c()},function(t){for(;u.length>0;)u.shift().onError(t);r.onError(t)},function(){for(;u.length>0;)u.shift().onCompleted();r.onCompleted()})),o})},_e.defaultIfEmpty=function(t){var n=this;return t===e&&(t=null),new Ge(function(e){var r=!1;return n.subscribe(function(t){r=!0,e.onNext(t)},e.onError.bind(e),function(){r||e.onNext(t),e.onCompleted()})})},_e.distinct=function(t,n){var i=this;return t||(t=r),n||(n=u),new Ge(function(r){var o={};return i.subscribe(function(i){var s,u,c,a=!1;try{s=t(i),u=n(s)}catch(h){return r.onError(h),e}for(c in o)if(u===c){a=!0;break}a||(o[u]=null,r.onNext(i))},r.onError.bind(r),r.onCompleted.bind(r))})},_e.groupBy=function(t,e,n){return this.groupByUntil(t,e,function(){return Me()},n)},_e.groupByUntil=function(t,i,o,s){var c=this;return i||(i=r),s||(s=u),new Ge(function(r){var u={},a=new Z,h=new se(a);return a.add(c.subscribe(function(c){var l,f,p,d,b,v,m,y,w,g;try{v=t(c),m=s(v)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}d=!1;try{w=u[m],w||(w=new Xe,u[m]=w,d=!0)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}if(d){b=new Ke(v,w,h),f=new Ke(v,w);try{l=o(f)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}r.onNext(b),y=new re,a.add(y);var x=function(){m in u&&(delete u[m],w.onCompleted()),a.remove(y)};y.setDisposable(l.take(1).subscribe(n,function(t){for(g in u)u[g].onError(t);r.onError(t)},function(){x()}))}try{p=i(c)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}w.onNext(p)},function(t){for(var e in u)u[e].onError(t);r.onError(t)},function(){for(var t in u)u[t].onCompleted();r.onCompleted()})),h})},_e.select=_e.map=function(t,n){var r=this;return new Ge(function(i){var o=0;return r.subscribe(function(s){var u;try{u=t.call(n,s,o++,r)}catch(c){return i.onError(c),e}i.onNext(u)},i.onError.bind(i),i.onCompleted.bind(i))})},_e.pluck=function(t){return this.select(function(e){return e[t]})},_e.selectMany=_e.flatMap=function(t,e){return e?this.selectMany(function(n){return t(n).select(function(t){return e(n,t)})}):"function"==typeof t?g.call(this,t):g.call(this,function(){return t})},_e.skip=function(t){if(0>t)throw Error(S);var e=this;return new Ge(function(n){var r=t;return e.subscribe(function(t){0>=r?n.onNext(t):r--},n.onError.bind(n),n.onCompleted.bind(n))})},_e.skipWhile=function(t,n){var r=this;return new Ge(function(i){var o=0,s=!1;return r.subscribe(function(u){if(!s)try{s=!t.call(n,u,o++,r)}catch(c){return i.onError(c),e}s&&i.onNext(u)},i.onError.bind(i),i.onCompleted.bind(i))})},_e.take=function(t,e){if(0>t)throw Error(S);if(0===t)return Ie(e);var n=this;return new Ge(function(e){var r=t;return n.subscribe(function(t){r>0&&(r--,e.onNext(t),0===r&&e.onCompleted())},e.onError.bind(e),e.onCompleted.bind(e))})},_e.takeWhile=function(t,n){var r=this;return new Ge(function(i){var o=0,s=!0;return r.subscribe(function(u){if(s){try{s=t.call(n,u,o++,r)}catch(c){return i.onError(c),e}s?i.onNext(u):i.onCompleted()}},i.onError.bind(i),i.onCompleted.bind(i))})},_e.where=_e.filter=function(t,n){var r=this;return new Ge(function(i){var o=0;return r.subscribe(function(s){var u;try{u=t.call(n,s,o++,r)}catch(c){return i.onError(c),e}u&&i.onNext(s)},i.onError.bind(i),i.onCompleted.bind(i))})};var Ge=D.Internals.AnonymousObservable=function(t){function n(r){function i(t){var e=new Je(t);if(he.scheduleRequired())he.schedule(function(){try{e.disposable(r(e))}catch(t){if(!e.fail(t))throw t}});else try{e.disposable(r(e))}catch(n){if(!e.fail(n))throw n}return e}return this instanceof n?(t.call(this,i),e):new n(r)}return H(n,t),n}(je),Je=function(t){function e(e){t.call(this),this.observer=e,this.m=new re}H(e,t);var n=e.prototype;return n.next=function(t){var e=!1;try{this.observer.onNext(t),e=!0}catch(n){throw n}finally{e||this.dispose()}},n.error=function(t){try{this.observer.onError(t)}catch(e){throw e}finally{this.dispose()}},n.completed=function(){try{this.observer.onCompleted()}catch(t){throw t}finally{this.dispose()}},n.disposable=function(t){return this.m.disposable(t)},n.dispose=function(){t.prototype.dispose.call(this),this.m.dispose()},e}(Ne),Ke=function(t){function e(t){return this.underlyingObservable.subscribe(t)}function n(n,r,i){t.call(this,e),this.key=n,this.underlyingObservable=i?new Ge(function(t){return new Z(i.getDisposable(),r.subscribe(t))}):r}return H(n,t),n}(je),Qe=function(t,e){this.subject=t,this.observer=e};Qe.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1),this.observer=null}};var Xe=D.Subject=function(t){function e(t){return a.call(this),this.isStopped?this.exception?(t.onError(this.exception),ne):(t.onCompleted(),ne):(this.observers.push(t),new Qe(this,t))}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return H(n,t),U(n.prototype,Ae,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(a.call(this),!this.isStopped){var t=this.observers.slice(0);this.isStopped=!0;for(var e=0,n=t.length;n>e;e++)t[e].onCompleted();this.observers=[]}},onError:function(t){if(a.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){if(a.call(this),!this.isStopped)for(var e=this.observers.slice(0),n=0,r=e.length;r>n;n++)e[n].onNext(t)},dispose:function(){this.isDisposed=!0,this.observers=null}}),n.create=function(t,e){return new Ze(t,e)},n}(je),Ye=D.AsyncSubject=function(t){function e(t){if(a.call(this),!this.isStopped)return this.observers.push(t),new Qe(this,t);var e=this.exception,n=this.hasValue,r=this.value;return e?t.onError(e):n?(t.onNext(r),t.onCompleted()):t.onCompleted(),ne}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return H(n,t),U(n.prototype,Ae,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){var t,e,n;if(a.call(this),!this.isStopped){var r=this.observers.slice(0);this.isStopped=!0;var i=this.value,o=this.hasValue;if(o)for(e=0,n=r.length;n>e;e++)t=r[e],t.onNext(i),t.onCompleted();else for(e=0,n=r.length;n>e;e++)r[e].onCompleted();this.observers=[]}},onError:function(t){if(a.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){a.call(this),this.isStopped||(this.value=t,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),n}(je),Ze=function(t){function e(t){return this.observable.subscribe(t)}function n(n,r){t.call(this,e),this.observer=n,this.observable=r}return H(n,t),U(n.prototype,Ae,{onCompleted:function(){this.observer.onCompleted()},onError:function(t){this.observer.onError(t)},onNext:function(t){this.observer.onNext(t)}}),n}(je);return"function"==typeof define&&"object"==typeof define.amd&&define.amd?(t.Rx=D,define(function(){return D})):(E?"object"==typeof module&&module&&module.exports==E?module.exports=D:E=D:t.Rx=D,e)})(this); |
@@ -1,2 +0,2 @@ | ||
(function(t,e){function n(){}function r(t){return t}function i(){return(new Date).getTime()}function o(t,e){return B(t,e)}function s(t,e){return t-e}function u(t){return""+t}function c(t){throw t}function a(){if(this.isDisposed)throw Error(_)}function h(t){return"function"!=typeof t.toString&&"string"==typeof(t+"")}function l(t){return t&&"object"==typeof t?M.call(t)==O:!1}function f(t){return"function"==typeof t}function p(t,e,n,r){var i;if(t===e)return 0!==t||1/t==1/e;var o=typeof t,s=typeof e;if(!(t!==t||t&&N[o]||e&&N[s]))return!1;if(null==t||null==e)return t===e;var u=M.call(t),c=M.call(e);if(u==O&&(u=T),c==O&&(c=T),u!=c)return!1;switch(u){case W:case k:return+t==+e;case q:return t!=+t?e!=+e:0==t?1/t==1/e:t==+e;case I:case P:return t==e+""}var a=u==R;if(!a){if(u!=T||!C&&(h(t)||h(e)))return!1;var d=!V&&l(t)?Object:t.constructor,b=!V&&l(e)?Object:e.constructor;if(d!=b&&!(f(d)&&d instanceof d&&f(b)&&b instanceof b))return!1}for(var v=n.length;v--;)if(n[v]==t)return r[v]==e;var m=0;if(i=!0,n.push(t),r.push(e),a){for(v=t.length,m=e.length,i=m==t.length;m--;){var y=e[m];if(!(i=p(t[m],y,n,r)))break}return i}for(var w in e)if(L.call(e,w))return m++,i=L.call(t,w)&&p(t[w],e[w],n,r);if(i)for(var w in t)if(L.call(t,w))return i=--m>-1;return n.pop(),r.pop(),i}function d(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:F.call(t)}function b(t,e){for(var n=Array(t),r=0;t>r;r++)n[r]=e();return n}function v(t,e){this.scheduler=t,this.disposable=e,this.isDisposed=!1}function m(t,e,n,r,i){this.scheduler=t,this.state=e,this.action=n,this.dueTime=r,this.comparer=i||s,this.disposable=new ee}function y(t,n){return new He(function(r){var i=new ee,o=new re;return o.setDisposable(i),i.setDisposable(t.subscribe(r.onNext.bind(r),function(t){var i,s;try{s=n(t)}catch(u){return r.onError(u),e}i=new ee,o.setDisposable(i),i.setDisposable(s.subscribe(r))},r.onCompleted.bind(r))),o})}function w(t,n){var r=this;return new He(function(i){var o=0,s=t.length;return r.subscribe(function(r){if(s>o){var u,c=t[o++];try{u=n(r,c)}catch(a){return i.onError(a),e}i.onNext(u)}else i.onCompleted()},i.onError.bind(i),i.onCompleted.bind(i))})}function g(t){return this.select(t).mergeObservable()}var E="object"==typeof exports&&exports,x=("object"==typeof module&&module&&module.exports==E&&module,"object"==typeof global&&global);x.global===x&&(t=x);var C,D={Internals:{}},A="Sequence contains no elements.",S="Argument out of range",_="Object has been disposed",N={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},O="[object Arguments]",R="[object Array]",W="[object Boolean]",k="[object Date]",j="[object Function]",q="[object Number]",T="[object Object]",I="[object RegExp]",P="[object String]",M=Object.prototype.toString,L=Object.prototype.hasOwnProperty,V=M.call(arguments)==O;try{C=!(M.call(document)==T&&!({toString:0}+""))}catch(z){C=!0}V||(l=function(t){return t&&"object"==typeof t?L.call(t,"callee"):!1}),f(/x/)&&(f=function(t){return"function"==typeof t&&M.call(t)==j});var B=D.Internals.isEqual=function(t,e){return p(t,e,[],[])},F=Array.prototype.slice;({}).hasOwnProperty;var H=this.inherits=D.Internals.inherits=function(t,e){function n(){this.constructor=t}n.prototype=e.prototype,t.prototype=new n},U=D.Internals.addProperties=function(t){for(var e=F.call(arguments,1),n=0,r=e.length;r>n;n++){var i=e[n];for(var o in i)t[o]=i[o]}},G=D.Internals.addRef=function(t,e){return new He(function(n){return new X(e.getDisposable(),t.subscribe(n))})},J=function(t,e){this.id=t,this.value=e};J.prototype.compareTo=function(t){var e=this.value.compareTo(t.value);return 0===e&&(e=this.id-t.id),e};var K=function(t){this.items=Array(t),this.length=0},Q=K.prototype;Q.isHigherPriority=function(t,e){return 0>this.items[t].compareTo(this.items[e])},Q.percolate=function(t){if(!(t>=this.length||0>t)){var e=t-1>>1;if(!(0>e||e===t)&&this.isHigherPriority(t,e)){var n=this.items[t];this.items[t]=this.items[e],this.items[e]=n,this.percolate(e)}}},Q.heapify=function(t){if(t===e&&(t=0),!(t>=this.length||0>t)){var n=2*t+1,r=2*t+2,i=t;if(this.length>n&&this.isHigherPriority(n,i)&&(i=n),this.length>r&&this.isHigherPriority(r,i)&&(i=r),i!==t){var o=this.items[t];this.items[t]=this.items[i],this.items[i]=o,this.heapify(i)}}},Q.peek=function(){return this.items[0].value},Q.removeAt=function(t){this.items[t]=this.items[--this.length],delete this.items[this.length],this.heapify()},Q.dequeue=function(){var t=this.peek();return this.removeAt(0),t},Q.enqueue=function(t){var e=this.length++;this.items[e]=new J(K.count++,t),this.percolate(e)},Q.remove=function(t){for(var e=0;this.length>e;e++)if(this.items[e].value===t)return this.removeAt(e),!0;return!1},K.count=0;var X=D.CompositeDisposable=function(){this.disposables=d(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},Y=X.prototype;Y.add=function(t){this.isDisposed?t.dispose():(this.disposables.push(t),this.length++)},Y.remove=function(t){var e=!1;if(!this.isDisposed){var n=this.disposables.indexOf(t);-1!==n&&(e=!0,this.disposables.splice(n,1),this.length--,t.dispose())}return e},Y.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()}},Y.clear=function(){var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()},Y.contains=function(t){return-1!==this.disposables.indexOf(t)},Y.toArray=function(){return this.disposables.slice(0)};var Z=D.Disposable=function(t){this.isDisposed=!1,this.action=t||n};Z.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var $=Z.create=function(t){return new Z(t)},te=Z.empty={dispose:n},ee=D.SingleAssignmentDisposable=function(){this.isDisposed=!1,this.current=null},ne=ee.prototype;ne.disposable=function(t){return t?this.setDisposable(t):this.getDisposable()},ne.getDisposable=function(){return this.current},ne.setDisposable=function(t){if(this.current)throw Error("Disposable has already been assigned");var e=this.isDisposed;e||(this.current=t),e&&t&&t.dispose()},ne.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()};var re=D.SerialDisposable=function(){this.isDisposed=!1,this.current=null};re.prototype.getDisposable=function(){return this.current},re.prototype.setDisposable=function(t){var e,n=this.isDisposed;n||(e=this.current,this.current=t),e&&e.dispose(),n&&t&&t.dispose()},re.prototype.disposable=function(t){return t?(this.setDisposable(t),e):this.getDisposable()},re.prototype.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()};var ie=D.RefCountDisposable=function(){function t(t){this.disposable=t,this.disposable.count++,this.isInnerDisposed=!1}function e(t){this.underlyingDisposable=t,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return t.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},e.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},e.prototype.getDisposable=function(){return this.isDisposed?te:new t(this)},e}();v.prototype.dispose=function(){var t=this;this.scheduler.schedule(function(){t.isDisposed||(t.isDisposed=!0,t.disposable.dispose())})},m.prototype.invoke=function(){this.disposable.disposable(this.invokeCore())},m.prototype.compareTo=function(t){return this.comparer(this.dueTime,t.dueTime)},m.prototype.isCancelled=function(){return this.disposable.isDisposed},m.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var oe=D.Scheduler=function(){function e(t,e,n,r){this.now=t,this._schedule=e,this._scheduleRelative=n,this._scheduleAbsolute=r}function n(t,e){var n=e.first,r=e.second,i=new X,o=function(e){r(e,function(e){var n=!1,r=!1,s=t.scheduleWithState(e,function(t,e){return n?i.remove(s):r=!0,o(e),te});r||(i.add(s),n=!0)})};return o(n),i}function r(t,e,n){var r=e.first,i=e.second,o=new X,s=function(e){i(e,function(e,r){var i=!1,u=!1,c=t[n].call(t,e,r,function(t,e){return i?o.remove(c):u=!0,s(e),te});u||(o.add(c),i=!0)})};return s(r),o}function o(t,e){return e(),te}var s=e.prototype;return s.catchException=function(t){return new pe(this,t)},s.schedulePeriodic=function(t,e){return this.schedulePeriodicWithState(null,t,function(){e()})},s.schedulePeriodicWithState=function(e,n,r){var i=e,o=t.setInterval(function(){i=r(i)},n);return $(function(){t.clearInterval(o)})},s.schedule=function(t){return this._schedule(t,o)},s.scheduleWithState=function(t,e){return this._schedule(t,e)},s.scheduleWithRelative=function(t,e){return this._scheduleRelative(e,t,o)},s.scheduleWithRelativeAndState=function(t,e,n){return this._scheduleRelative(t,e,n)},s.scheduleWithAbsolute=function(t,e){return this._scheduleAbsolute(e,t,o)},s.scheduleWithAbsoluteAndState=function(t,e,n){return this._scheduleAbsolute(t,e,n)},s.scheduleRecursive=function(t){return this.scheduleRecursiveWithState(t,function(t,e){t(function(){e(t)})})},s.scheduleRecursiveWithState=function(t,e){return this.scheduleWithState({first:t,second:e},function(t,e){return n(t,e)})},s.scheduleRecursiveWithRelative=function(t,e){return this.scheduleRecursiveWithRelativeAndState(e,t,function(t,e){t(function(n){e(t,n)})})},s.scheduleRecursiveWithRelativeAndState=function(t,e,n){return this._scheduleRelative({first:t,second:n},e,function(t,e){return r(t,e,"scheduleWithRelativeAndState")})},s.scheduleRecursiveWithAbsolute=function(t,e){return this.scheduleRecursiveWithAbsoluteAndState(e,t,function(t,e){t(function(n){e(t,n)})})},s.scheduleRecursiveWithAbsoluteAndState=function(t,e,n){return this._scheduleAbsolute({first:t,second:n},e,function(t,e){return r(t,e,"scheduleWithAbsoluteAndState")})},e.now=i,e.normalize=function(t){return 0>t&&(t=0),t},e}(),se="Scheduler is not allowed to block the thread",ue=oe.immediate=function(){function t(t,e){return e(this,t)}function e(t,e,n){if(e>0)throw Error(se);return n(this,t)}function n(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new oe(i,t,e,n)}(),ce=oe.currentThread=function(){function t(){o=new K(4)}function e(t,e){return this.scheduleWithRelativeAndState(t,0,e)}function n(e,n,r){var i,s=this.now()+oe.normalize(n),u=new m(this,e,r,s);if(o)o.enqueue(u);else{i=new t;try{o.enqueue(u),i.run()}catch(c){throw c}finally{i.dispose()}}return u.disposable}function r(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}var o;t.prototype.dispose=function(){o=null},t.prototype.run=function(){for(var t;o.length>0;)if(t=o.dequeue(),!t.isCancelled()){for(;t.dueTime-oe.now()>0;);t.isCancelled()||t.invoke()}};var s=new oe(i,e,n,r);return s.scheduleRequired=function(){return null===o},s.ensureTrampoline=function(t){return null===o?this.schedule(t):t()},s}(),ae=function(){function t(t,e){e(0,this._period);try{this._state=this._action(this._state)}catch(n){throw this._cancel.dispose(),n}}function e(t,e,n,r){this._scheduler=t,this._state=e,this._period=n,this._action=r}return e.prototype.start=function(){var e=new ee;return this._cancel=e,e.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,t.bind(this))),e},e}();D.VirtualTimeScheduler=function(t){function n(){return this.toDateTimeOffset(this.clock)}function r(t,e){return this.scheduleAbsoluteWithState(t,this.clock,e)}function i(t,e,n){return this.scheduleRelativeWithState(t,this.toRelative(e),n)}function o(t,e,n){return this.scheduleRelativeWithState(t,this.toRelative(e-this.now()),n)}function s(t,e){return e(),te}function u(e,s){this.clock=e,this.comparer=s,this.isEnabled=!1,this.queue=new K(1024),t.call(this,n,r,i,o)}H(u,t);var c=u.prototype;return c.schedulePeriodicWithState=function(t,e,n){var r=new ae(this,t,e,n);return r.start()},c.scheduleRelativeWithState=function(t,e,n){var r=this.add(this.clock,e);return this.scheduleAbsoluteWithState(t,r,n)},c.scheduleRelative=function(t,e){return this.scheduleRelativeWithState(e,t,s)},c.start=function(){var t;if(!this.isEnabled){this.isEnabled=!0;do t=this.getNext(),null!==t?(this.comparer(t.dueTime,this.clock)>0&&(this.clock=t.dueTime),t.invoke()):this.isEnabled=!1;while(this.isEnabled)}},c.stop=function(){this.isEnabled=!1},c.advanceTo=function(t){var e,n=this.comparer(this.clock,t);if(this.comparer(this.clock,t)>0)throw Error(S);if(0!==n&&!this.isEnabled){this.isEnabled=!0;do e=this.getNext(),null!==e&&0>=this.comparer(e.dueTime,t)?(this.comparer(e.dueTime,this.clock)>0&&(this.clock=e.dueTime),e.invoke()):this.isEnabled=!1;while(this.isEnabled);this.clock=t}},c.advanceBy=function(t){var n=this.add(this.clock,t),r=this.comparer(this.clock,n);if(r>0)throw Error(S);return 0!==r?this.advanceTo(n):e},c.sleep=function(t){var e=this.add(this.clock,t);if(this.comparer(this.clock,e)>=0)throw Error(S);this.clock=e},c.getNext=function(){for(var t;this.queue.length>0;){if(t=this.queue.peek(),!t.isCancelled())return t;this.queue.dequeue()}return null},c.scheduleAbsolute=function(t,e){return this.scheduleAbsoluteWithState(e,t,s)},c.scheduleAbsoluteWithState=function(t,e,n){var r=this,i=function(t,e){return r.queue.remove(o),n(t,e)},o=new m(r,t,i,e,r.comparer);return r.queue.enqueue(o),o.disposable},u}(oe),D.HistoricalScheduler=function(t){function e(e,n){var r=null==e?0:e,i=n||s;t.call(this,r,i)}H(e,t);var n=e.prototype;return n.add=function(t,e){return t+e},n.toDateTimeOffset=function(t){return new Date(t).getTime()},n.toRelative=function(t){return t},e}(D.VirtualTimeScheduler);var he,le=n;(function(){function e(){if(!t.postMessage||t.importScripts)return!1;var e=!1,n=t.onmessage;return t.onmessage=function(){e=!0},t.postMessage("","*"),t.onmessage=n,e}function n(t){if("string"==typeof t.data&&t.data.substring(0,r.length)===r){var e=t.data.substring(r.length),n=i[e];n(),delete i[e]}}if("function"==typeof t.setImmediate)he=t.setImmediate,le=clearImmediate;else if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))he=process.nextTick;else if(e()){var r="ms.rx.schedule"+Math.random(),i={},o=0;t.addEventListener?t.addEventListener("message",n,!1):t.attachEvent("onmessage",n,!1),he=function(e){var n=o++;i[n]=e,t.postMessage(r+n,"*")}}else if(t.MessageChannel){var s=new t.MessageChannel,u={},c=0;s.port1.onmessage=function(t){var e=t.data,n=u[e];n(),delete u[e]},he=function(t){var e=c++;u[e]=t,s.port2.postMessage(e)}}else"document"in t&&"onreadystatechange"in t.document.createElement("script")?he=function(e){var n=t.document.createElement("script");n.onreadystatechange=function(){e(),n.onreadystatechange=null,n.parentNode.removeChild(n),n=null},t.document.documentElement.appendChild(n)}:(he=function(e){return t.setTimeout(e,0)},le=t.clearTimeout)})();var fe=oe.timeout=function(){function e(t,e){var n=this,r=new ee,i=he(function(){r.isDisposed||r.setDisposable(e(n,t))});return new X(r,$(function(){le(i)}))}function n(e,n,r){var i=this,o=oe.normalize(n);if(0===o)return i.scheduleWithState(e,r);var s=new ee,u=t.setTimeout(function(){s.isDisposed||s.setDisposable(r(i,e))},o);return new X(s,$(function(){t.clearTimeout(u)}))}function r(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new oe(i,e,n,r)}(),pe=function(t){function e(){return this._scheduler.now()}function n(t,e){return this._scheduler.scheduleWithState(t,this._wrap(e))}function r(t,e,n){return this._scheduler.scheduleWithRelativeAndState(t,e,this._wrap(n))}function i(t,e,n){return this._scheduler.scheduleWithAbsoluteAndState(t,e,this._wrap(n))}function o(o,s){this._scheduler=o,this._handler=s,this._recursiveOriginal=null,this._recursiveWrapper=null,t.call(this,e,n,r,i)}return H(o,t),o.prototype._clone=function(t){return new o(t,this._handler)},o.prototype._wrap=function(t){var e=this;return function(n,r){try{return t(e._getRecursiveWrapper(n),r)}catch(i){if(!e._handler(i))throw i;return te}}},o.prototype._getRecursiveWrapper=function(t){if(this._recursiveOriginal!==t){this._recursiveOriginal=t;var e=this._clone(t);e._recursiveOriginal=t,e._recursiveWrapper=e,this._recursiveWrapper=e}return this._recursiveWrapper},o.prototype.schedulePeriodicWithState=function(t,e,n){var r=this,i=!1,o=new ee;return o.setDisposable(this._scheduler.schedulePeriodicWithState(t,e,function(t){if(i)return null;try{return n(t)}catch(e){if(i=!0,!r._handler(e))throw e;return o.dispose(),null}})),o},o}(oe),de=D.Notification=function(){function t(t,e){this.hasValue=null==e?!1:e,this.kind=t}var e=t.prototype;return e.accept=function(t,e,n){return 1===arguments.length&&"object"==typeof t?this._acceptObservable(t):this._accept(t,e,n)},e.toObservable=function(t){var e=this;return t=t||ue,new He(function(n){return t.schedule(function(){e._acceptObservable(n),"N"===e.kind&&n.onCompleted()})})},t}(),be=de.createOnNext=function(){function t(t){return t(this.value)}function e(t){return t.onNext(this.value)}function n(){return"OnNext("+this.value+")"}return function(r){var i=new de("N",!0);return i.value=r,i._accept=t.bind(i),i._acceptObservable=e.bind(i),i.toString=n.bind(i),i}}(),ve=de.createOnError=function(){function t(t,e){return e(this.exception)}function e(t){return t.onError(this.exception)}function n(){return"OnError("+this.exception+")"}return function(r){var i=new de("E");return i.exception=r,i._accept=t.bind(i),i._acceptObservable=e.bind(i),i.toString=n.bind(i),i}}(),me=de.createOnCompleted=function(){function t(t,e,n){return n()}function e(t){return t.onCompleted()}function n(){return"OnCompleted()"}return function(){var r=new de("C");return r._accept=t.bind(r),r._acceptObservable=e.bind(r),r.toString=n.bind(r),r}}(),ye=D.Internals.Enumerator=function(t,e,n){this.moveNext=t,this.getCurrent=e,this.dispose=n},we=ye.create=function(t,e,r){var i=!1;return r||(r=n),new ye(function(){if(i)return!1;var e=t();return e||(i=!0,r()),e},function(){return e()},function(){i||(r(),i=!0)})},ge=D.Internals.Enumerable=function(){function t(t){this.getEnumerator=t}return t.prototype.concat=function(){var t=this;return new He(function(n){var r=t.getEnumerator(),i=!1,o=new re,s=ue.scheduleRecursive(function(t){var s,u,c=!1;if(!i){try{c=r.moveNext(),c?s=r.getCurrent():r.dispose()}catch(a){u=a,r.dispose()}if(u)return n.onError(u),e;if(!c)return n.onCompleted(),e;var h=new ee;o.setDisposable(h),h.setDisposable(s.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){t()}))}});return new X(o,s,$(function(){i=!0,r.dispose()}))})},t.prototype.catchException=function(){var t=this;return new He(function(n){var r,i=t.getEnumerator(),o=!1,s=new re,u=ue.scheduleRecursive(function(t){var u,c,a;if(a=!1,!o){try{a=i.moveNext(),a&&(u=i.getCurrent())}catch(h){c=h}if(c)return n.onError(c),e;if(!a)return r?n.onError(r):n.onCompleted(),e;var l=new ee;s.setDisposable(l),l.setDisposable(u.subscribe(n.onNext.bind(n),function(e){r=e,t()},n.onCompleted.bind(n)))}});return new X(s,u,$(function(){o=!0}))})},t}(),Ee=ge.repeat=function(t,n){return n===e&&(n=-1),new ge(function(){var e,r=n;return we(function(){return 0===r?!1:(r>0&&r--,e=t,!0)},function(){return e})})},xe=ge.forEach=function(t,e){return e||(e=r),new ge(function(){var n,r=-1;return we(function(){return++r<t.length?(n=e(t[r],r),!0):!1},function(){return n})})},Ce=D.Observer=function(){};Ce.prototype.toNotifier=function(){var t=this;return function(e){return e.accept(t)}},Ce.prototype.asObserver=function(){return new _e(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},Ce.prototype.checked=function(){return new Ne(this)};var De=Ce.create=function(t,e,r){return t||(t=n),e||(e=c),r||(r=n),new _e(t,e,r)};Ce.fromNotifier=function(t){return new _e(function(e){return t(be(e))},function(e){return t(ve(e))},function(){return t(me())})};var Ae,Se=D.Internals.AbstractObserver=function(t){function e(){this.isStopped=!1,t.call(this)}return H(e,t),e.prototype.onNext=function(t){this.isStopped||this.next(t)},e.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.error(t))},e.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},e.prototype.dispose=function(){this.isStopped=!0},e.prototype.fail=function(){return this.isStopped?!1:(this.isStopped=!0,this.error(!0),!0)},e}(Ce),_e=D.AnonymousObserver=function(t){function e(e,n,r){t.call(this),this._onNext=e,this._onError=n,this._onCompleted=r}return H(e,t),e.prototype.next=function(t){this._onNext(t)},e.prototype.error=function(t){this._onError(t)},e.prototype.completed=function(){this._onCompleted()},e}(Se),Ne=function(t){function e(e){t.call(this),this._observer=e,this._state=0}H(e,t);var n=e.prototype;return n.onNext=function(t){this.checkAccess();try{this._observer.onNext(t)}catch(e){throw e}finally{this._state=0}},n.onError=function(t){this.checkAccess();try{this._observer.onError(t)}catch(e){throw e}finally{this._state=2}},n.onCompleted=function(){this.checkAccess();try{this._observer.onCompleted()}catch(t){throw t}finally{this._state=2}},n.checkAccess=function(){if(1===this._state)throw Error("Re-entrancy detected");if(2===this._state)throw Error("Observer completed");0===this._state&&(this._state=1)},e}(Ce),Oe=D.Internals.ScheduledObserver=function(t){function n(e,n){t.call(this),this.scheduler=e,this.observer=n,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new re}return H(n,t),n.prototype.next=function(t){var e=this;this.queue.push(function(){e.observer.onNext(t)})},n.prototype.error=function(t){var e=this;this.queue.push(function(){e.observer.onError(t)})},n.prototype.completed=function(){var t=this;this.queue.push(function(){t.observer.onCompleted()})},n.prototype.ensureActive=function(){var t=!1,n=this;!this.hasFaulted&&this.queue.length>0&&(t=!this.isAcquired,this.isAcquired=!0),t&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(t){var r;if(!(n.queue.length>0))return n.isAcquired=!1,e;r=n.queue.shift();try{r()}catch(i){throw n.queue=[],n.hasFaulted=!0,i}t()}))},n.prototype.dispose=function(){t.prototype.dispose.call(this),this.disposable.dispose()},n}(Se),Re=function(t){function e(){t.apply(this,arguments)}return H(e,t),e.prototype.next=function(e){t.prototype.next.call(this,e),this.ensureActive()},e.prototype.error=function(e){t.prototype.error.call(this,e),this.ensureActive()},e.prototype.completed=function(){t.prototype.completed.call(this),this.ensureActive()},e}(Oe),We=D.Observable=function(){function t(t){this._subscribe=t}return Ae=t.prototype,Ae.finalValue=function(){var t=this;return new He(function(e){var n,r=!1;return t.subscribe(function(t){r=!0,n=t},e.onError.bind(e),function(){r?(e.onNext(n),e.onCompleted()):e.onError(Error(A))})})},Ae.subscribe=Ae.forEach=function(t,e,n){var r;return r="object"==typeof t?t:De(t,e,n),this._subscribe(r)},Ae.toArray=function(){function t(t,e){var n=t.slice(0);return n.push(e),n}return this.scan([],t).startWith([]).finalValue()},t}();We.start=function(t,e,n){return ke(t,e,n)()};var ke=We.toAsync=function(t,n,r){return n||(n=fe),function(){var i=F.call(arguments,0),o=new Qe;return n.schedule(function(){var n;try{n=t.apply(r,i)}catch(s){return o.onError(s),e}o.onNext(n),o.onCompleted()}),o.asObservable()}};Ae.observeOn=function(t){var e=this;return new He(function(n){return e.subscribe(new Re(t,n))})},Ae.subscribeOn=function(t){var e=this;return new He(function(n){var r=new ee,i=new re;return i.setDisposable(r),r.setDisposable(t.schedule(function(){i.setDisposable(new v(t,e.subscribe(n)))})),i})},We.create=function(t){return new He(function(e){return $(t(e))})},We.createWithDisposable=function(t){return new He(t)};var je=We.defer=function(t){return new He(function(e){var n;try{n=t()}catch(r){return Me(r).subscribe(e)}return n.subscribe(e)})},qe=We.empty=function(t){return t||(t=ue),new He(function(e){return t.schedule(function(){e.onCompleted()})})},Te=We.fromArray=function(t,e){return e||(e=ce),new He(function(n){var r=0;return e.scheduleRecursive(function(e){t.length>r?(n.onNext(t[r++]),e()):n.onCompleted()})})};We.generate=function(t,n,r,i,o){return o||(o=ce),new He(function(s){var u=!0,c=t;return o.scheduleRecursive(function(t){var o,a;try{u?u=!1:c=r(c),o=n(c),o&&(a=i(c))}catch(h){return s.onError(h),e}o?(s.onNext(a),t()):s.onCompleted()})})};var Ie=We.never=function(){return new He(function(){return te})};We.range=function(t,e,n){return n||(n=ce),new He(function(r){return n.scheduleRecursiveWithState(0,function(n,i){e>n?(r.onNext(t+n),i(n+1)):r.onCompleted()})})},We.repeat=function(t,e,n){return n||(n=ce),null==e&&(e=-1),Pe(t,n).repeat(e)};var Pe=We["return"]=We.returnValue=function(t,e){return e||(e=ue),new He(function(n){return e.schedule(function(){n.onNext(t),n.onCompleted()})})},Me=We["throw"]=We.throwException=function(t,e){return e||(e=ue),new He(function(n){return e.schedule(function(){n.onError(t)})})};We.using=function(t,e){return new He(function(n){var r,i,o=te;try{r=t(),r&&(o=r),i=e(r)}catch(s){return new X(Me(s).subscribe(n),o)}return new X(i.subscribe(n),o)})},Ae.amb=function(t){var e=this;return new He(function(n){function r(){o||(o=s,a.dispose())}function i(){o||(o=u,c.dispose())}var o,s="L",u="R",c=new ee,a=new ee;return c.setDisposable(e.subscribe(function(t){r(),o===s&&n.onNext(t)},function(t){r(),o===s&&n.onError(t)},function(){r(),o===s&&n.onCompleted()})),a.setDisposable(t.subscribe(function(t){i(),o===u&&n.onNext(t)},function(t){i(),o===u&&n.onError(t)},function(){i(),o===u&&n.onCompleted()})),new X(c,a)})},We.amb=function(){function t(t,e){return t.amb(e)}for(var e=Ie(),n=d(arguments,0),r=0,i=n.length;i>r;r++)e=t(e,n[r]);return e},Ae["catch"]=Ae.catchException=function(t){return"function"==typeof t?y(this,t):Le([this,t])};var Le=We.catchException=We["catch"]=function(){var t=d(arguments,0);return xe(t).catchException()};Ae.combineLatest=function(){var t=F.call(arguments);return Array.isArray(t[0])?t[0].unshift(this):t.unshift(this),Ve.apply(this,t)};var Ve=We.combineLatest=function(){var t=F.call(arguments),n=t.pop();return Array.isArray(t[0])&&(t=t[0]),new He(function(r){function i(t){var i;if(c[t]=!0,a||(a=c.every(function(t){return t}))){try{i=n.apply(null,l)}catch(o){return r.onError(o),e}r.onNext(i)}else h.filter(function(e,n){return n!==t}).every(function(t){return t})&&r.onCompleted()}function o(t){h[t]=!0,h.every(function(t){return t})&&r.onCompleted()}for(var s=function(){return!1},u=t.length,c=b(u,s),a=!1,h=b(u,s),l=Array(u),f=Array(u),p=0;u>p;p++)(function(e){f[e]=new ee,f[e].setDisposable(t[e].subscribe(function(t){l[e]=t,i(e)},r.onError.bind(r),function(){o(e)}))})(p);return new X(f)})};Ae.concat=function(){var t=F.call(arguments,0);return t.unshift(this),ze.apply(this,t)};var ze=We.concat=function(){var t=d(arguments,0);return xe(t).concat()};Ae.concatObservable=Ae.concatAll=function(){return this.merge(1)},Ae.merge=function(t){if("number"!=typeof t)return Be(this,t);var e=this;return new He(function(n){var r=0,i=new X,o=!1,s=[],u=function(t){var e=new ee;i.add(e),e.setDisposable(t.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){var t;i.remove(e),s.length>0?(t=s.shift(),u(t)):(r--,o&&0===r&&n.onCompleted())}))};return i.add(e.subscribe(function(e){t>r?(r++,u(e)):s.push(e)},n.onError.bind(n),function(){o=!0,0===r&&n.onCompleted()})),i})};var Be=We.merge=function(){var t,e;return arguments[0]?arguments[0].now?(t=arguments[0],e=F.call(arguments,1)):(t=ue,e=F.call(arguments,0)):(t=ue,e=F.call(arguments,1)),Array.isArray(e[0])&&(e=e[0]),Te(e,t).mergeObservable()};Ae.mergeObservable=Ae.mergeAll=function(){var t=this;return new He(function(e){var n=new X,r=!1,i=new ee;return n.add(i),i.setDisposable(t.subscribe(function(t){var i=new ee;n.add(i),i.setDisposable(t.subscribe(function(t){e.onNext(t)},e.onError.bind(e),function(){n.remove(i),r&&1===n.length&&e.onCompleted()}))},e.onError.bind(e),function(){r=!0,1===n.length&&e.onCompleted()})),n})},Ae.onErrorResumeNext=function(t){if(!t)throw Error("Second observable is required");return Fe([this,t])};var Fe=We.onErrorResumeNext=function(){var t=d(arguments,0);return new He(function(e){var n=0,r=new re,i=ue.scheduleRecursive(function(i){var o,s;t.length>n?(o=t[n++],s=new ee,r.setDisposable(s),s.setDisposable(o.subscribe(e.onNext.bind(e),function(){i()},function(){i()}))):e.onCompleted()});return new X(r,i)})};Ae.skipUntil=function(t){var e=this;return new He(function(n){var r=!1,i=new X(e.subscribe(function(t){r&&n.onNext(t)},n.onError.bind(n),function(){r&&n.onCompleted()})),o=new ee;return i.add(o),o.setDisposable(t.subscribe(function(){r=!0,o.dispose()},n.onError.bind(n),function(){o.dispose()})),i})},Ae.switchLatest=function(){var t=this;return new He(function(e){var n=!1,r=new re,i=!1,o=0,s=t.subscribe(function(t){var s=new ee,u=++o;n=!0,r.setDisposable(s),s.setDisposable(t.subscribe(function(t){o===u&&e.onNext(t)},function(t){o===u&&e.onError(t)},function(){o===u&&(n=!1,i&&e.onCompleted())}))},e.onError.bind(e),function(){i=!0,n||e.onCompleted()});return new X(s,r)})},Ae.takeUntil=function(t){var e=this;return new He(function(r){return new X(e.subscribe(r),t.subscribe(r.onCompleted.bind(r),r.onError.bind(r),n))})},Ae.zip=function(){if(Array.isArray(arguments[0]))return w.apply(this,arguments);var t=this,n=F.call(arguments),i=n.pop();return n.unshift(t),new He(function(o){function s(t){a[t]=!0,a.every(function(t){return t})&&o.onCompleted()}for(var u=n.length,c=b(u,function(){return[]}),a=b(u,function(){return!1}),h=function(n){var s,u;if(c.every(function(t){return t.length>0})){try{u=c.map(function(t){return t.shift()}),s=i.apply(t,u)}catch(h){return o.onError(h),e}o.onNext(s)}else a.filter(function(t,e){return e!==n}).every(r)&&o.onCompleted()},l=Array(u),f=0;u>f;f++)(function(t){l[t]=new ee,l[t].setDisposable(n[t].subscribe(function(e){c[t].push(e),h(t)},o.onError.bind(o),function(){s(t)}))})(f);return new X(l)})},We.zip=function(){var t=F.call(arguments,0),e=t.shift();return e.zip.apply(e,t)},We.zipArray=function(){var t=F.call(arguments);return new He(function(n){function i(t){if(u.every(function(t){return t.length>0})){var i=u.map(function(t){return t.shift()});n.onNext(i)}else if(c.filter(function(e,n){return n!==t}).every(r))return n.onCompleted(),e}function o(t){return c[t]=!0,c.every(r)?(n.onCompleted(),e):e}for(var s=t.length,u=b(s,function(){return[]}),c=b(s,function(){return!1}),a=Array(s),h=0;s>h;h++)(function(e){a[e]=new ee,a[e].setDisposable(t[e].subscribe(function(t){u[e].push(t),i(e)},n.onError.bind(n),function(){o(e)}))})(h);var l=new X(a);return l.add($(function(){for(var t=0,e=u.length;e>t;t++)u[t]=[]})),l})},Ae.asObservable=function(){var t=this;return new He(function(e){return t.subscribe(e)})},Ae.bufferWithCount=function(t,n){return n===e&&(n=t),this.windowWithCount(t,n).selectMany(function(t){return t.toArray()}).where(function(t){return t.length>0})},Ae.dematerialize=function(){var t=this;return new He(function(e){return t.subscribe(function(t){return t.accept(e)},e.onError.bind(e),e.onCompleted.bind(e))})},Ae.distinctUntilChanged=function(t,n){var i=this;return t||(t=r),n||(n=o),new He(function(r){var o,s=!1;return i.subscribe(function(i){var u,c=!1;try{u=t(i)}catch(a){return r.onError(a),e}if(s)try{c=n(o,u)}catch(a){return r.onError(a),e}s&&c||(s=!0,o=u,r.onNext(i))},r.onError.bind(r),r.onCompleted.bind(r))})},Ae["do"]=Ae.doAction=function(t,e,n){var r,i=this;return"function"==typeof t?r=t:(r=t.onNext.bind(t),e=t.onError.bind(t),n=t.onCompleted.bind(t)),new He(function(t){return i.subscribe(function(e){try{r(e)}catch(n){t.onError(n)}t.onNext(e)},function(n){if(e){try{e(n)}catch(r){t.onError(r)}t.onError(n)}else t.onError(n)},function(){if(n){try{n()}catch(e){t.onError(e)}t.onCompleted()}else t.onCompleted()})})},Ae["finally"]=Ae.finallyAction=function(t){var e=this;return new He(function(n){var r=e.subscribe(n);return $(function(){try{r.dispose() | ||
}catch(e){throw e}finally{t()}})})},Ae.ignoreElements=function(){var t=this;return new He(function(e){return t.subscribe(n,e.onError.bind(e),e.onCompleted.bind(e))})},Ae.materialize=function(){var t=this;return new He(function(e){return t.subscribe(function(t){e.onNext(be(t))},function(t){e.onNext(ve(t)),e.onCompleted()},function(){e.onNext(me()),e.onCompleted()})})},Ae.repeat=function(t){return Ee(this,t).concat()},Ae.retry=function(t){return Ee(this,t).catchException()},Ae.scan=function(){var t,e,n=!1;2===arguments.length?(t=arguments[0],e=arguments[1],n=!0):e=arguments[0];var r=this;return je(function(){var i,o=!1;return r.select(function(r){return o?i=e(i,r):(i=n?e(t,r):r,o=!0),i})})},Ae.skipLast=function(t){var e=this;return new He(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&n.onNext(r.shift())},n.onError.bind(n),n.onCompleted.bind(n))})},Ae.startWith=function(){var t,e,n=0;return arguments.length&&"now"in Object(arguments[0])?(e=arguments[0],n=1):e=ue,t=F.call(arguments,n),xe([Te(t,e),this]).concat()},Ae.takeLast=function(t,e){return this.takeLastBuffer(t).selectMany(function(t){return Te(t,e)})},Ae.takeLastBuffer=function(t){var e=this;return new He(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&r.shift()},n.onError.bind(n),function(){n.onNext(r),n.onCompleted()})})},Ae.windowWithCount=function(t,e){var n=this;if(0>=t)throw Error(S);if(null==e&&(e=t),0>=e)throw Error(S);return new He(function(r){var i=new ee,o=new ie(i),s=0,u=[],c=function(){var t=new Ke;u.push(t),r.onNext(G(t,o))};return c(),i.setDisposable(n.subscribe(function(n){for(var r,i=0,o=u.length;o>i;i++)u[i].onNext(n);var a=s-t+1;a>=0&&0===a%e&&(r=u.shift(),r.onCompleted()),s++,0===s%e&&c()},function(t){for(;u.length>0;)u.shift().onError(t);r.onError(t)},function(){for(;u.length>0;)u.shift().onCompleted();r.onCompleted()})),o})},Ae.defaultIfEmpty=function(t){var n=this;return t===e&&(t=null),new He(function(e){var r=!1;return n.subscribe(function(t){r=!0,e.onNext(t)},e.onError.bind(e),function(){r||e.onNext(t),e.onCompleted()})})},Ae.distinct=function(t,n){var i=this;return t||(t=r),n||(n=u),new He(function(r){var o={};return i.subscribe(function(i){var s,u,c,a=!1;try{s=t(i),u=n(s)}catch(h){return r.onError(h),e}for(c in o)if(u===c){a=!0;break}a||(o[u]=null,r.onNext(i))},r.onError.bind(r),r.onCompleted.bind(r))})},Ae.groupBy=function(t,e,n){return this.groupByUntil(t,e,function(){return Ie()},n)},Ae.groupByUntil=function(t,i,o,s){var c=this;return i||(i=r),s||(s=u),new He(function(r){var u={},a=new X,h=new ie(a);return a.add(c.subscribe(function(c){var l,f,p,d,b,v,m,y,w,g;try{v=t(c),m=s(v)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}d=!1;try{w=u[m],w||(w=new Ke,u[m]=w,d=!0)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}if(d){b=new Ge(v,w,h),f=new Ge(v,w);try{l=o(f)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}r.onNext(b),y=new ee,a.add(y);var x=function(){m in u&&(delete u[m],w.onCompleted()),a.remove(y)};y.setDisposable(l.take(1).subscribe(n,function(t){for(g in u)u[g].onError(t);r.onError(t)},function(){x()}))}try{p=i(c)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}w.onNext(p)},function(t){for(var e in u)u[e].onError(t);r.onError(t)},function(){for(var t in u)u[t].onCompleted();r.onCompleted()})),h})},Ae.select=Ae.map=function(t,n){var r=this;return new He(function(i){var o=0;return r.subscribe(function(s){var u;try{u=t.call(n,s,o++,r)}catch(c){return i.onError(c),e}i.onNext(u)},i.onError.bind(i),i.onCompleted.bind(i))})},Ae.pluck=function(t){return this.select(function(e){return e[t]})},Ae.selectMany=Ae.flatMap=function(t,e){return e?this.selectMany(function(n){return t(n).select(function(t){return e(n,t)})}):"function"==typeof t?g.call(this,t):g.call(this,function(){return t})},Ae.skip=function(t){if(0>t)throw Error(S);var e=this;return new He(function(n){var r=t;return e.subscribe(function(t){0>=r?n.onNext(t):r--},n.onError.bind(n),n.onCompleted.bind(n))})},Ae.skipWhile=function(t){var n=this;return new He(function(r){var i=0,o=!1;return n.subscribe(function(n){if(!o)try{o=!t(n,i++)}catch(s){return r.onError(s),e}o&&r.onNext(n)},r.onError.bind(r),r.onCompleted.bind(r))})},Ae.take=function(t,e){if(0>t)throw Error(S);if(0===t)return qe(e);var n=this;return new He(function(e){var r=t;return n.subscribe(function(t){r>0&&(r--,e.onNext(t),0===r&&e.onCompleted())},e.onError.bind(e),e.onCompleted.bind(e))})},Ae.takeWhile=function(t){var n=this;return new He(function(r){var i=0,o=!0;return n.subscribe(function(n){if(o){try{o=t(n,i++)}catch(s){return r.onError(s),e}o?r.onNext(n):r.onCompleted()}},r.onError.bind(r),r.onCompleted.bind(r))})},Ae.where=Ae.filter=function(t,n){var r=this;return new He(function(i){var o=0;return r.subscribe(function(s){var u;try{u=t.call(n,s,o++,r)}catch(c){return i.onError(c),e}u&&i.onNext(s)},i.onError.bind(i),i.onCompleted.bind(i))})};var He=D.Internals.AnonymousObservable=function(t){function n(r){function i(t){var e=new Ue(t);if(ce.scheduleRequired())ce.schedule(function(){try{e.disposable(r(e))}catch(t){if(!e.fail(t))throw t}});else try{e.disposable(r(e))}catch(n){if(!e.fail(n))throw n}return e}return this instanceof n?(t.call(this,i),e):new n(r)}return H(n,t),n}(We),Ue=function(t){function e(e){t.call(this),this.observer=e,this.m=new ee}H(e,t);var n=e.prototype;return n.next=function(t){var e=!1;try{this.observer.onNext(t),e=!0}catch(n){throw n}finally{e||this.dispose()}},n.error=function(t){try{this.observer.onError(t)}catch(e){throw e}finally{this.dispose()}},n.completed=function(){try{this.observer.onCompleted()}catch(t){throw t}finally{this.dispose()}},n.disposable=function(t){return this.m.disposable(t)},n.dispose=function(){t.prototype.dispose.call(this),this.m.dispose()},e}(Se),Ge=function(t){function e(t){return this.underlyingObservable.subscribe(t)}function n(n,r,i){t.call(this,e),this.key=n,this.underlyingObservable=i?new He(function(t){return new X(i.getDisposable(),r.subscribe(t))}):r}return H(n,t),n}(We),Je=function(t,e){this.subject=t,this.observer=e};Je.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1),this.observer=null}};var Ke=D.Subject=function(t){function e(t){return a.call(this),this.isStopped?this.exception?(t.onError(this.exception),te):(t.onCompleted(),te):(this.observers.push(t),new Je(this,t))}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return H(n,t),U(n.prototype,Ce,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(a.call(this),!this.isStopped){var t=this.observers.slice(0);this.isStopped=!0;for(var e=0,n=t.length;n>e;e++)t[e].onCompleted();this.observers=[]}},onError:function(t){if(a.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){if(a.call(this),!this.isStopped)for(var e=this.observers.slice(0),n=0,r=e.length;r>n;n++)e[n].onNext(t)},dispose:function(){this.isDisposed=!0,this.observers=null}}),n.create=function(t,e){return new Xe(t,e)},n}(We),Qe=D.AsyncSubject=function(t){function e(t){if(a.call(this),!this.isStopped)return this.observers.push(t),new Je(this,t);var e=this.exception,n=this.hasValue,r=this.value;return e?t.onError(e):n?(t.onNext(r),t.onCompleted()):t.onCompleted(),te}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return H(n,t),U(n.prototype,Ce,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){var t,e,n;if(a.call(this),!this.isStopped){var r=this.observers.slice(0);this.isStopped=!0;var i=this.value,o=this.hasValue;if(o)for(e=0,n=r.length;n>e;e++)t=r[e],t.onNext(i),t.onCompleted();else for(e=0,n=r.length;n>e;e++)r[e].onCompleted();this.observers=[]}},onError:function(t){if(a.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){a.call(this),this.isStopped||(this.value=t,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),n}(We),Xe=function(t){function e(t){return this.observable.subscribe(t)}function n(n,r){t.call(this,e),this.observer=n,this.observable=r}return H(n,t),U(n.prototype,Ce,{onCompleted:function(){this.observer.onCompleted()},onError:function(t){this.observer.onError(t)},onNext:function(t){this.observer.onNext(t)}}),n}(We);return"function"==typeof define&&"object"==typeof define.amd&&define.amd?(t.Rx=D,define(function(){return D})):(E?"object"==typeof module&&module&&module.exports==E?module.exports=D:E=D:t.Rx=D,e)})(this); | ||
(function(t,e){function n(){}function r(t){return t}function i(){return(new Date).getTime()}function o(t,e){return B(t,e)}function s(t,e){return t-e}function u(t){return""+t}function c(t){throw t}function a(){if(this.isDisposed)throw Error(_)}function h(t){return"function"!=typeof t.toString&&"string"==typeof(t+"")}function l(t){return t&&"object"==typeof t?M.call(t)==O:!1}function f(t){return"function"==typeof t}function p(t,e,n,r){var i;if(t===e)return 0!==t||1/t==1/e;var o=typeof t,s=typeof e;if(!(t!==t||t&&N[o]||e&&N[s]))return!1;if(null==t||null==e)return t===e;var u=M.call(t),c=M.call(e);if(u==O&&(u=T),c==O&&(c=T),u!=c)return!1;switch(u){case W:case k:return+t==+e;case q:return t!=+t?e!=+e:0==t?1/t==1/e:t==+e;case I:case P:return t==e+""}var a=u==R;if(!a){if(u!=T||!C&&(h(t)||h(e)))return!1;var d=!V&&l(t)?Object:t.constructor,b=!V&&l(e)?Object:e.constructor;if(d!=b&&!(f(d)&&d instanceof d&&f(b)&&b instanceof b))return!1}for(var v=n.length;v--;)if(n[v]==t)return r[v]==e;var m=0;if(i=!0,n.push(t),r.push(e),a){for(v=t.length,m=e.length,i=m==t.length;m--;){var y=e[m];if(!(i=p(t[m],y,n,r)))break}return i}for(var w in e)if(L.call(e,w))return m++,i=L.call(t,w)&&p(t[w],e[w],n,r);if(i)for(var w in t)if(L.call(t,w))return i=--m>-1;return n.pop(),r.pop(),i}function d(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:F.call(t)}function b(t,e){for(var n=Array(t),r=0;t>r;r++)n[r]=e();return n}function v(t,e){this.scheduler=t,this.disposable=e,this.isDisposed=!1}function m(t,e,n,r,i){this.scheduler=t,this.state=e,this.action=n,this.dueTime=r,this.comparer=i||s,this.disposable=new ee}function y(t,n){return new He(function(r){var i=new ee,o=new re;return o.setDisposable(i),i.setDisposable(t.subscribe(r.onNext.bind(r),function(t){var i,s;try{s=n(t)}catch(u){return r.onError(u),e}i=new ee,o.setDisposable(i),i.setDisposable(s.subscribe(r))},r.onCompleted.bind(r))),o})}function w(t,n){var r=this;return new He(function(i){var o=0,s=t.length;return r.subscribe(function(r){if(s>o){var u,c=t[o++];try{u=n(r,c)}catch(a){return i.onError(a),e}i.onNext(u)}else i.onCompleted()},i.onError.bind(i),i.onCompleted.bind(i))})}function g(t){return this.select(t).mergeObservable()}var E="object"==typeof exports&&exports,x=("object"==typeof module&&module&&module.exports==E&&module,"object"==typeof global&&global);x.global===x&&(t=x);var C,D={Internals:{}},A="Sequence contains no elements.",S="Argument out of range",_="Object has been disposed",N={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},O="[object Arguments]",R="[object Array]",W="[object Boolean]",k="[object Date]",j="[object Function]",q="[object Number]",T="[object Object]",I="[object RegExp]",P="[object String]",M=Object.prototype.toString,L=Object.prototype.hasOwnProperty,V=M.call(arguments)==O;try{C=!(M.call(document)==T&&!({toString:0}+""))}catch(z){C=!0}V||(l=function(t){return t&&"object"==typeof t?L.call(t,"callee"):!1}),f(/x/)&&(f=function(t){return"function"==typeof t&&M.call(t)==j});var B=D.Internals.isEqual=function(t,e){return p(t,e,[],[])},F=Array.prototype.slice;({}).hasOwnProperty;var H=this.inherits=D.Internals.inherits=function(t,e){function n(){this.constructor=t}n.prototype=e.prototype,t.prototype=new n},U=D.Internals.addProperties=function(t){for(var e=F.call(arguments,1),n=0,r=e.length;r>n;n++){var i=e[n];for(var o in i)t[o]=i[o]}},G=D.Internals.addRef=function(t,e){return new He(function(n){return new X(e.getDisposable(),t.subscribe(n))})},J=function(t,e){this.id=t,this.value=e};J.prototype.compareTo=function(t){var e=this.value.compareTo(t.value);return 0===e&&(e=this.id-t.id),e};var K=function(t){this.items=Array(t),this.length=0},Q=K.prototype;Q.isHigherPriority=function(t,e){return 0>this.items[t].compareTo(this.items[e])},Q.percolate=function(t){if(!(t>=this.length||0>t)){var e=t-1>>1;if(!(0>e||e===t)&&this.isHigherPriority(t,e)){var n=this.items[t];this.items[t]=this.items[e],this.items[e]=n,this.percolate(e)}}},Q.heapify=function(t){if(t===e&&(t=0),!(t>=this.length||0>t)){var n=2*t+1,r=2*t+2,i=t;if(this.length>n&&this.isHigherPriority(n,i)&&(i=n),this.length>r&&this.isHigherPriority(r,i)&&(i=r),i!==t){var o=this.items[t];this.items[t]=this.items[i],this.items[i]=o,this.heapify(i)}}},Q.peek=function(){return this.items[0].value},Q.removeAt=function(t){this.items[t]=this.items[--this.length],delete this.items[this.length],this.heapify()},Q.dequeue=function(){var t=this.peek();return this.removeAt(0),t},Q.enqueue=function(t){var e=this.length++;this.items[e]=new J(K.count++,t),this.percolate(e)},Q.remove=function(t){for(var e=0;this.length>e;e++)if(this.items[e].value===t)return this.removeAt(e),!0;return!1},K.count=0;var X=D.CompositeDisposable=function(){this.disposables=d(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},Y=X.prototype;Y.add=function(t){this.isDisposed?t.dispose():(this.disposables.push(t),this.length++)},Y.remove=function(t){var e=!1;if(!this.isDisposed){var n=this.disposables.indexOf(t);-1!==n&&(e=!0,this.disposables.splice(n,1),this.length--,t.dispose())}return e},Y.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()}},Y.clear=function(){var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()},Y.contains=function(t){return-1!==this.disposables.indexOf(t)},Y.toArray=function(){return this.disposables.slice(0)};var Z=D.Disposable=function(t){this.isDisposed=!1,this.action=t||n};Z.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var $=Z.create=function(t){return new Z(t)},te=Z.empty={dispose:n},ee=D.SingleAssignmentDisposable=function(){this.isDisposed=!1,this.current=null},ne=ee.prototype;ne.disposable=function(t){return t?this.setDisposable(t):this.getDisposable()},ne.getDisposable=function(){return this.current},ne.setDisposable=function(t){if(this.current)throw Error("Disposable has already been assigned");var e=this.isDisposed;e||(this.current=t),e&&t&&t.dispose()},ne.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()};var re=D.SerialDisposable=function(){this.isDisposed=!1,this.current=null};re.prototype.getDisposable=function(){return this.current},re.prototype.setDisposable=function(t){var e,n=this.isDisposed;n||(e=this.current,this.current=t),e&&e.dispose(),n&&t&&t.dispose()},re.prototype.disposable=function(t){return t?(this.setDisposable(t),e):this.getDisposable()},re.prototype.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()};var ie=D.RefCountDisposable=function(){function t(t){this.disposable=t,this.disposable.count++,this.isInnerDisposed=!1}function e(t){this.underlyingDisposable=t,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return t.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},e.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},e.prototype.getDisposable=function(){return this.isDisposed?te:new t(this)},e}();v.prototype.dispose=function(){var t=this;this.scheduler.schedule(function(){t.isDisposed||(t.isDisposed=!0,t.disposable.dispose())})},m.prototype.invoke=function(){this.disposable.disposable(this.invokeCore())},m.prototype.compareTo=function(t){return this.comparer(this.dueTime,t.dueTime)},m.prototype.isCancelled=function(){return this.disposable.isDisposed},m.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var oe=D.Scheduler=function(){function e(t,e,n,r){this.now=t,this._schedule=e,this._scheduleRelative=n,this._scheduleAbsolute=r}function n(t,e){var n=e.first,r=e.second,i=new X,o=function(e){r(e,function(e){var n=!1,r=!1,s=t.scheduleWithState(e,function(t,e){return n?i.remove(s):r=!0,o(e),te});r||(i.add(s),n=!0)})};return o(n),i}function r(t,e,n){var r=e.first,i=e.second,o=new X,s=function(e){i(e,function(e,r){var i=!1,u=!1,c=t[n].call(t,e,r,function(t,e){return i?o.remove(c):u=!0,s(e),te});u||(o.add(c),i=!0)})};return s(r),o}function o(t,e){return e(),te}var s=e.prototype;return s.catchException=function(t){return new pe(this,t)},s.schedulePeriodic=function(t,e){return this.schedulePeriodicWithState(null,t,function(){e()})},s.schedulePeriodicWithState=function(e,n,r){var i=e,o=t.setInterval(function(){i=r(i)},n);return $(function(){t.clearInterval(o)})},s.schedule=function(t){return this._schedule(t,o)},s.scheduleWithState=function(t,e){return this._schedule(t,e)},s.scheduleWithRelative=function(t,e){return this._scheduleRelative(e,t,o)},s.scheduleWithRelativeAndState=function(t,e,n){return this._scheduleRelative(t,e,n)},s.scheduleWithAbsolute=function(t,e){return this._scheduleAbsolute(e,t,o)},s.scheduleWithAbsoluteAndState=function(t,e,n){return this._scheduleAbsolute(t,e,n)},s.scheduleRecursive=function(t){return this.scheduleRecursiveWithState(t,function(t,e){t(function(){e(t)})})},s.scheduleRecursiveWithState=function(t,e){return this.scheduleWithState({first:t,second:e},function(t,e){return n(t,e)})},s.scheduleRecursiveWithRelative=function(t,e){return this.scheduleRecursiveWithRelativeAndState(e,t,function(t,e){t(function(n){e(t,n)})})},s.scheduleRecursiveWithRelativeAndState=function(t,e,n){return this._scheduleRelative({first:t,second:n},e,function(t,e){return r(t,e,"scheduleWithRelativeAndState")})},s.scheduleRecursiveWithAbsolute=function(t,e){return this.scheduleRecursiveWithAbsoluteAndState(e,t,function(t,e){t(function(n){e(t,n)})})},s.scheduleRecursiveWithAbsoluteAndState=function(t,e,n){return this._scheduleAbsolute({first:t,second:n},e,function(t,e){return r(t,e,"scheduleWithAbsoluteAndState")})},e.now=i,e.normalize=function(t){return 0>t&&(t=0),t},e}(),se="Scheduler is not allowed to block the thread",ue=oe.immediate=function(){function t(t,e){return e(this,t)}function e(t,e,n){if(e>0)throw Error(se);return n(this,t)}function n(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new oe(i,t,e,n)}(),ce=oe.currentThread=function(){function t(){o=new K(4)}function e(t,e){return this.scheduleWithRelativeAndState(t,0,e)}function n(e,n,r){var i,s=this.now()+oe.normalize(n),u=new m(this,e,r,s);if(o)o.enqueue(u);else{i=new t;try{o.enqueue(u),i.run()}catch(c){throw c}finally{i.dispose()}}return u.disposable}function r(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}var o;t.prototype.dispose=function(){o=null},t.prototype.run=function(){for(var t;o.length>0;)if(t=o.dequeue(),!t.isCancelled()){for(;t.dueTime-oe.now()>0;);t.isCancelled()||t.invoke()}};var s=new oe(i,e,n,r);return s.scheduleRequired=function(){return null===o},s.ensureTrampoline=function(t){return null===o?this.schedule(t):t()},s}(),ae=function(){function t(t,e){e(0,this._period);try{this._state=this._action(this._state)}catch(n){throw this._cancel.dispose(),n}}function e(t,e,n,r){this._scheduler=t,this._state=e,this._period=n,this._action=r}return e.prototype.start=function(){var e=new ee;return this._cancel=e,e.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,t.bind(this))),e},e}();D.VirtualTimeScheduler=function(t){function n(){return this.toDateTimeOffset(this.clock)}function r(t,e){return this.scheduleAbsoluteWithState(t,this.clock,e)}function i(t,e,n){return this.scheduleRelativeWithState(t,this.toRelative(e),n)}function o(t,e,n){return this.scheduleRelativeWithState(t,this.toRelative(e-this.now()),n)}function s(t,e){return e(),te}function u(e,s){this.clock=e,this.comparer=s,this.isEnabled=!1,this.queue=new K(1024),t.call(this,n,r,i,o)}H(u,t);var c=u.prototype;return c.schedulePeriodicWithState=function(t,e,n){var r=new ae(this,t,e,n);return r.start()},c.scheduleRelativeWithState=function(t,e,n){var r=this.add(this.clock,e);return this.scheduleAbsoluteWithState(t,r,n)},c.scheduleRelative=function(t,e){return this.scheduleRelativeWithState(e,t,s)},c.start=function(){var t;if(!this.isEnabled){this.isEnabled=!0;do t=this.getNext(),null!==t?(this.comparer(t.dueTime,this.clock)>0&&(this.clock=t.dueTime),t.invoke()):this.isEnabled=!1;while(this.isEnabled)}},c.stop=function(){this.isEnabled=!1},c.advanceTo=function(t){var e,n=this.comparer(this.clock,t);if(this.comparer(this.clock,t)>0)throw Error(S);if(0!==n&&!this.isEnabled){this.isEnabled=!0;do e=this.getNext(),null!==e&&0>=this.comparer(e.dueTime,t)?(this.comparer(e.dueTime,this.clock)>0&&(this.clock=e.dueTime),e.invoke()):this.isEnabled=!1;while(this.isEnabled);this.clock=t}},c.advanceBy=function(t){var n=this.add(this.clock,t),r=this.comparer(this.clock,n);if(r>0)throw Error(S);return 0!==r?this.advanceTo(n):e},c.sleep=function(t){var e=this.add(this.clock,t);if(this.comparer(this.clock,e)>=0)throw Error(S);this.clock=e},c.getNext=function(){for(var t;this.queue.length>0;){if(t=this.queue.peek(),!t.isCancelled())return t;this.queue.dequeue()}return null},c.scheduleAbsolute=function(t,e){return this.scheduleAbsoluteWithState(e,t,s)},c.scheduleAbsoluteWithState=function(t,e,n){var r=this,i=function(t,e){return r.queue.remove(o),n(t,e)},o=new m(r,t,i,e,r.comparer);return r.queue.enqueue(o),o.disposable},u}(oe),D.HistoricalScheduler=function(t){function e(e,n){var r=null==e?0:e,i=n||s;t.call(this,r,i)}H(e,t);var n=e.prototype;return n.add=function(t,e){return t+e},n.toDateTimeOffset=function(t){return new Date(t).getTime()},n.toRelative=function(t){return t},e}(D.VirtualTimeScheduler);var he,le=n;(function(){function e(){if(!t.postMessage||t.importScripts)return!1;var e=!1,n=t.onmessage;return t.onmessage=function(){e=!0},t.postMessage("","*"),t.onmessage=n,e}function n(t){if("string"==typeof t.data&&t.data.substring(0,r.length)===r){var e=t.data.substring(r.length),n=i[e];n(),delete i[e]}}if("function"==typeof t.setImmediate)he=t.setImmediate,le=clearImmediate;else if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))he=process.nextTick;else if(e()){var r="ms.rx.schedule"+Math.random(),i={},o=0;t.addEventListener?t.addEventListener("message",n,!1):t.attachEvent("onmessage",n,!1),he=function(e){var n=o++;i[n]=e,t.postMessage(r+n,"*")}}else if(t.MessageChannel){var s=new t.MessageChannel,u={},c=0;s.port1.onmessage=function(t){var e=t.data,n=u[e];n(),delete u[e]},he=function(t){var e=c++;u[e]=t,s.port2.postMessage(e)}}else"document"in t&&"onreadystatechange"in t.document.createElement("script")?he=function(e){var n=t.document.createElement("script");n.onreadystatechange=function(){e(),n.onreadystatechange=null,n.parentNode.removeChild(n),n=null},t.document.documentElement.appendChild(n)}:(he=function(e){return t.setTimeout(e,0)},le=t.clearTimeout)})();var fe=oe.timeout=function(){function e(t,e){var n=this,r=new ee,i=he(function(){r.isDisposed||r.setDisposable(e(n,t))});return new X(r,$(function(){le(i)}))}function n(e,n,r){var i=this,o=oe.normalize(n);if(0===o)return i.scheduleWithState(e,r);var s=new ee,u=t.setTimeout(function(){s.isDisposed||s.setDisposable(r(i,e))},o);return new X(s,$(function(){t.clearTimeout(u)}))}function r(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new oe(i,e,n,r)}(),pe=function(t){function e(){return this._scheduler.now()}function n(t,e){return this._scheduler.scheduleWithState(t,this._wrap(e))}function r(t,e,n){return this._scheduler.scheduleWithRelativeAndState(t,e,this._wrap(n))}function i(t,e,n){return this._scheduler.scheduleWithAbsoluteAndState(t,e,this._wrap(n))}function o(o,s){this._scheduler=o,this._handler=s,this._recursiveOriginal=null,this._recursiveWrapper=null,t.call(this,e,n,r,i)}return H(o,t),o.prototype._clone=function(t){return new o(t,this._handler)},o.prototype._wrap=function(t){var e=this;return function(n,r){try{return t(e._getRecursiveWrapper(n),r)}catch(i){if(!e._handler(i))throw i;return te}}},o.prototype._getRecursiveWrapper=function(t){if(this._recursiveOriginal!==t){this._recursiveOriginal=t;var e=this._clone(t);e._recursiveOriginal=t,e._recursiveWrapper=e,this._recursiveWrapper=e}return this._recursiveWrapper},o.prototype.schedulePeriodicWithState=function(t,e,n){var r=this,i=!1,o=new ee;return o.setDisposable(this._scheduler.schedulePeriodicWithState(t,e,function(t){if(i)return null;try{return n(t)}catch(e){if(i=!0,!r._handler(e))throw e;return o.dispose(),null}})),o},o}(oe),de=D.Notification=function(){function t(t,e){this.hasValue=null==e?!1:e,this.kind=t}var e=t.prototype;return e.accept=function(t,e,n){return 1===arguments.length&&"object"==typeof t?this._acceptObservable(t):this._accept(t,e,n)},e.toObservable=function(t){var e=this;return t=t||ue,new He(function(n){return t.schedule(function(){e._acceptObservable(n),"N"===e.kind&&n.onCompleted()})})},t}(),be=de.createOnNext=function(){function t(t){return t(this.value)}function e(t){return t.onNext(this.value)}function n(){return"OnNext("+this.value+")"}return function(r){var i=new de("N",!0);return i.value=r,i._accept=t.bind(i),i._acceptObservable=e.bind(i),i.toString=n.bind(i),i}}(),ve=de.createOnError=function(){function t(t,e){return e(this.exception)}function e(t){return t.onError(this.exception)}function n(){return"OnError("+this.exception+")"}return function(r){var i=new de("E");return i.exception=r,i._accept=t.bind(i),i._acceptObservable=e.bind(i),i.toString=n.bind(i),i}}(),me=de.createOnCompleted=function(){function t(t,e,n){return n()}function e(t){return t.onCompleted()}function n(){return"OnCompleted()"}return function(){var r=new de("C");return r._accept=t.bind(r),r._acceptObservable=e.bind(r),r.toString=n.bind(r),r}}(),ye=D.Internals.Enumerator=function(t,e,n){this.moveNext=t,this.getCurrent=e,this.dispose=n},we=ye.create=function(t,e,r){var i=!1;return r||(r=n),new ye(function(){if(i)return!1;var e=t();return e||(i=!0,r()),e},function(){return e()},function(){i||(r(),i=!0)})},ge=D.Internals.Enumerable=function(){function t(t){this.getEnumerator=t}return t.prototype.concat=function(){var t=this;return new He(function(n){var r=t.getEnumerator(),i=!1,o=new re,s=ue.scheduleRecursive(function(t){var s,u,c=!1;if(!i){try{c=r.moveNext(),c?s=r.getCurrent():r.dispose()}catch(a){u=a,r.dispose()}if(u)return n.onError(u),e;if(!c)return n.onCompleted(),e;var h=new ee;o.setDisposable(h),h.setDisposable(s.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){t()}))}});return new X(o,s,$(function(){i=!0,r.dispose()}))})},t.prototype.catchException=function(){var t=this;return new He(function(n){var r,i=t.getEnumerator(),o=!1,s=new re,u=ue.scheduleRecursive(function(t){var u,c,a;if(a=!1,!o){try{a=i.moveNext(),a&&(u=i.getCurrent())}catch(h){c=h}if(c)return n.onError(c),e;if(!a)return r?n.onError(r):n.onCompleted(),e;var l=new ee;s.setDisposable(l),l.setDisposable(u.subscribe(n.onNext.bind(n),function(e){r=e,t()},n.onCompleted.bind(n)))}});return new X(s,u,$(function(){o=!0}))})},t}(),Ee=ge.repeat=function(t,n){return n===e&&(n=-1),new ge(function(){var e,r=n;return we(function(){return 0===r?!1:(r>0&&r--,e=t,!0)},function(){return e})})},xe=ge.forEach=function(t,e){return e||(e=r),new ge(function(){var n,r=-1;return we(function(){return++r<t.length?(n=e(t[r],r),!0):!1},function(){return n})})},Ce=D.Observer=function(){};Ce.prototype.toNotifier=function(){var t=this;return function(e){return e.accept(t)}},Ce.prototype.asObserver=function(){return new _e(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},Ce.prototype.checked=function(){return new Ne(this)};var De=Ce.create=function(t,e,r){return t||(t=n),e||(e=c),r||(r=n),new _e(t,e,r)};Ce.fromNotifier=function(t){return new _e(function(e){return t(be(e))},function(e){return t(ve(e))},function(){return t(me())})};var Ae,Se=D.Internals.AbstractObserver=function(t){function e(){this.isStopped=!1,t.call(this)}return H(e,t),e.prototype.onNext=function(t){this.isStopped||this.next(t)},e.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.error(t))},e.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},e.prototype.dispose=function(){this.isStopped=!0},e.prototype.fail=function(t){return this.isStopped?!1:(this.isStopped=!0,this.error(t),!0)},e}(Ce),_e=D.AnonymousObserver=function(t){function e(e,n,r){t.call(this),this._onNext=e,this._onError=n,this._onCompleted=r}return H(e,t),e.prototype.next=function(t){this._onNext(t)},e.prototype.error=function(t){this._onError(t)},e.prototype.completed=function(){this._onCompleted()},e}(Se),Ne=function(t){function e(e){t.call(this),this._observer=e,this._state=0}H(e,t);var n=e.prototype;return n.onNext=function(t){this.checkAccess();try{this._observer.onNext(t)}catch(e){throw e}finally{this._state=0}},n.onError=function(t){this.checkAccess();try{this._observer.onError(t)}catch(e){throw e}finally{this._state=2}},n.onCompleted=function(){this.checkAccess();try{this._observer.onCompleted()}catch(t){throw t}finally{this._state=2}},n.checkAccess=function(){if(1===this._state)throw Error("Re-entrancy detected");if(2===this._state)throw Error("Observer completed");0===this._state&&(this._state=1)},e}(Ce),Oe=D.Internals.ScheduledObserver=function(t){function n(e,n){t.call(this),this.scheduler=e,this.observer=n,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new re}return H(n,t),n.prototype.next=function(t){var e=this;this.queue.push(function(){e.observer.onNext(t)})},n.prototype.error=function(t){var e=this;this.queue.push(function(){e.observer.onError(t)})},n.prototype.completed=function(){var t=this;this.queue.push(function(){t.observer.onCompleted()})},n.prototype.ensureActive=function(){var t=!1,n=this;!this.hasFaulted&&this.queue.length>0&&(t=!this.isAcquired,this.isAcquired=!0),t&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(t){var r;if(!(n.queue.length>0))return n.isAcquired=!1,e;r=n.queue.shift();try{r()}catch(i){throw n.queue=[],n.hasFaulted=!0,i}t()}))},n.prototype.dispose=function(){t.prototype.dispose.call(this),this.disposable.dispose()},n}(Se),Re=function(t){function e(){t.apply(this,arguments)}return H(e,t),e.prototype.next=function(e){t.prototype.next.call(this,e),this.ensureActive()},e.prototype.error=function(e){t.prototype.error.call(this,e),this.ensureActive()},e.prototype.completed=function(){t.prototype.completed.call(this),this.ensureActive()},e}(Oe),We=D.Observable=function(){function t(t){this._subscribe=t}return Ae=t.prototype,Ae.finalValue=function(){var t=this;return new He(function(e){var n,r=!1;return t.subscribe(function(t){r=!0,n=t},e.onError.bind(e),function(){r?(e.onNext(n),e.onCompleted()):e.onError(Error(A))})})},Ae.subscribe=Ae.forEach=function(t,e,n){var r;return r="object"==typeof t?t:De(t,e,n),this._subscribe(r)},Ae.toArray=function(){function t(t,e){var n=t.slice(0);return n.push(e),n}return this.scan([],t).startWith([]).finalValue()},t}();We.start=function(t,e,n){return ke(t,e,n)()};var ke=We.toAsync=function(t,n,r){return n||(n=fe),function(){var i=F.call(arguments,0),o=new Qe;return n.schedule(function(){var n;try{n=t.apply(r,i)}catch(s){return o.onError(s),e}o.onNext(n),o.onCompleted()}),o.asObservable()}};Ae.observeOn=function(t){var e=this;return new He(function(n){return e.subscribe(new Re(t,n))})},Ae.subscribeOn=function(t){var e=this;return new He(function(n){var r=new ee,i=new re;return i.setDisposable(r),r.setDisposable(t.schedule(function(){i.setDisposable(new v(t,e.subscribe(n)))})),i})},We.create=function(t){return new He(function(e){return $(t(e))})},We.createWithDisposable=function(t){return new He(t)};var je=We.defer=function(t){return new He(function(e){var n;try{n=t()}catch(r){return Me(r).subscribe(e)}return n.subscribe(e)})},qe=We.empty=function(t){return t||(t=ue),new He(function(e){return t.schedule(function(){e.onCompleted()})})},Te=We.fromArray=function(t,e){return e||(e=ce),new He(function(n){var r=0;return e.scheduleRecursive(function(e){t.length>r?(n.onNext(t[r++]),e()):n.onCompleted()})})};We.generate=function(t,n,r,i,o){return o||(o=ce),new He(function(s){var u=!0,c=t;return o.scheduleRecursive(function(t){var o,a;try{u?u=!1:c=r(c),o=n(c),o&&(a=i(c))}catch(h){return s.onError(h),e}o?(s.onNext(a),t()):s.onCompleted()})})};var Ie=We.never=function(){return new He(function(){return te})};We.range=function(t,e,n){return n||(n=ce),new He(function(r){return n.scheduleRecursiveWithState(0,function(n,i){e>n?(r.onNext(t+n),i(n+1)):r.onCompleted()})})},We.repeat=function(t,e,n){return n||(n=ce),null==e&&(e=-1),Pe(t,n).repeat(e)};var Pe=We["return"]=We.returnValue=function(t,e){return e||(e=ue),new He(function(n){return e.schedule(function(){n.onNext(t),n.onCompleted()})})},Me=We["throw"]=We.throwException=function(t,e){return e||(e=ue),new He(function(n){return e.schedule(function(){n.onError(t)})})};We.using=function(t,e){return new He(function(n){var r,i,o=te;try{r=t(),r&&(o=r),i=e(r)}catch(s){return new X(Me(s).subscribe(n),o)}return new X(i.subscribe(n),o)})},Ae.amb=function(t){var e=this;return new He(function(n){function r(){o||(o=s,a.dispose())}function i(){o||(o=u,c.dispose())}var o,s="L",u="R",c=new ee,a=new ee;return c.setDisposable(e.subscribe(function(t){r(),o===s&&n.onNext(t)},function(t){r(),o===s&&n.onError(t)},function(){r(),o===s&&n.onCompleted()})),a.setDisposable(t.subscribe(function(t){i(),o===u&&n.onNext(t)},function(t){i(),o===u&&n.onError(t)},function(){i(),o===u&&n.onCompleted()})),new X(c,a)})},We.amb=function(){function t(t,e){return t.amb(e)}for(var e=Ie(),n=d(arguments,0),r=0,i=n.length;i>r;r++)e=t(e,n[r]);return e},Ae["catch"]=Ae.catchException=function(t){return"function"==typeof t?y(this,t):Le([this,t])};var Le=We.catchException=We["catch"]=function(){var t=d(arguments,0);return xe(t).catchException()};Ae.combineLatest=function(){var t=F.call(arguments);return Array.isArray(t[0])?t[0].unshift(this):t.unshift(this),Ve.apply(this,t)};var Ve=We.combineLatest=function(){var t=F.call(arguments),n=t.pop();return Array.isArray(t[0])&&(t=t[0]),new He(function(r){function i(t){var i;if(c[t]=!0,a||(a=c.every(function(t){return t}))){try{i=n.apply(null,l)}catch(o){return r.onError(o),e}r.onNext(i)}else h.filter(function(e,n){return n!==t}).every(function(t){return t})&&r.onCompleted()}function o(t){h[t]=!0,h.every(function(t){return t})&&r.onCompleted()}for(var s=function(){return!1},u=t.length,c=b(u,s),a=!1,h=b(u,s),l=Array(u),f=Array(u),p=0;u>p;p++)(function(e){f[e]=new ee,f[e].setDisposable(t[e].subscribe(function(t){l[e]=t,i(e)},r.onError.bind(r),function(){o(e)}))})(p);return new X(f)})};Ae.concat=function(){var t=F.call(arguments,0);return t.unshift(this),ze.apply(this,t)};var ze=We.concat=function(){var t=d(arguments,0);return xe(t).concat()};Ae.concatObservable=Ae.concatAll=function(){return this.merge(1)},Ae.merge=function(t){if("number"!=typeof t)return Be(this,t);var e=this;return new He(function(n){var r=0,i=new X,o=!1,s=[],u=function(t){var e=new ee;i.add(e),e.setDisposable(t.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){var t;i.remove(e),s.length>0?(t=s.shift(),u(t)):(r--,o&&0===r&&n.onCompleted())}))};return i.add(e.subscribe(function(e){t>r?(r++,u(e)):s.push(e)},n.onError.bind(n),function(){o=!0,0===r&&n.onCompleted()})),i})};var Be=We.merge=function(){var t,e;return arguments[0]?arguments[0].now?(t=arguments[0],e=F.call(arguments,1)):(t=ue,e=F.call(arguments,0)):(t=ue,e=F.call(arguments,1)),Array.isArray(e[0])&&(e=e[0]),Te(e,t).mergeObservable()};Ae.mergeObservable=Ae.mergeAll=function(){var t=this;return new He(function(e){var n=new X,r=!1,i=new ee;return n.add(i),i.setDisposable(t.subscribe(function(t){var i=new ee;n.add(i),i.setDisposable(t.subscribe(function(t){e.onNext(t)},e.onError.bind(e),function(){n.remove(i),r&&1===n.length&&e.onCompleted()}))},e.onError.bind(e),function(){r=!0,1===n.length&&e.onCompleted()})),n})},Ae.onErrorResumeNext=function(t){if(!t)throw Error("Second observable is required");return Fe([this,t])};var Fe=We.onErrorResumeNext=function(){var t=d(arguments,0);return new He(function(e){var n=0,r=new re,i=ue.scheduleRecursive(function(i){var o,s;t.length>n?(o=t[n++],s=new ee,r.setDisposable(s),s.setDisposable(o.subscribe(e.onNext.bind(e),function(){i()},function(){i()}))):e.onCompleted()});return new X(r,i)})};Ae.skipUntil=function(t){var e=this;return new He(function(n){var r=!1,i=new X(e.subscribe(function(t){r&&n.onNext(t)},n.onError.bind(n),function(){r&&n.onCompleted()})),o=new ee;return i.add(o),o.setDisposable(t.subscribe(function(){r=!0,o.dispose()},n.onError.bind(n),function(){o.dispose()})),i})},Ae["switch"]=Ae.switchLatest=function(){var t=this;return new He(function(e){var n=!1,r=new re,i=!1,o=0,s=t.subscribe(function(t){var s=new ee,u=++o;n=!0,r.setDisposable(s),s.setDisposable(t.subscribe(function(t){o===u&&e.onNext(t)},function(t){o===u&&e.onError(t)},function(){o===u&&(n=!1,i&&e.onCompleted())}))},e.onError.bind(e),function(){i=!0,n||e.onCompleted()});return new X(s,r)})},Ae.takeUntil=function(t){var e=this;return new He(function(r){return new X(e.subscribe(r),t.subscribe(r.onCompleted.bind(r),r.onError.bind(r),n))})},Ae.zip=function(){if(Array.isArray(arguments[0]))return w.apply(this,arguments);var t=this,n=F.call(arguments),i=n.pop();return n.unshift(t),new He(function(o){function s(t){a[t]=!0,a.every(function(t){return t})&&o.onCompleted()}for(var u=n.length,c=b(u,function(){return[]}),a=b(u,function(){return!1}),h=function(n){var s,u;if(c.every(function(t){return t.length>0})){try{u=c.map(function(t){return t.shift()}),s=i.apply(t,u)}catch(h){return o.onError(h),e}o.onNext(s)}else a.filter(function(t,e){return e!==n}).every(r)&&o.onCompleted()},l=Array(u),f=0;u>f;f++)(function(t){l[t]=new ee,l[t].setDisposable(n[t].subscribe(function(e){c[t].push(e),h(t)},o.onError.bind(o),function(){s(t)}))})(f);return new X(l)})},We.zip=function(){var t=F.call(arguments,0),e=t.shift();return e.zip.apply(e,t)},We.zipArray=function(){var t=F.call(arguments);return new He(function(n){function i(t){if(u.every(function(t){return t.length>0})){var i=u.map(function(t){return t.shift()});n.onNext(i)}else if(c.filter(function(e,n){return n!==t}).every(r))return n.onCompleted(),e}function o(t){return c[t]=!0,c.every(r)?(n.onCompleted(),e):e}for(var s=t.length,u=b(s,function(){return[]}),c=b(s,function(){return!1}),a=Array(s),h=0;s>h;h++)(function(e){a[e]=new ee,a[e].setDisposable(t[e].subscribe(function(t){u[e].push(t),i(e)},n.onError.bind(n),function(){o(e)}))})(h);var l=new X(a);return l.add($(function(){for(var t=0,e=u.length;e>t;t++)u[t]=[]})),l})},Ae.asObservable=function(){var t=this;return new He(function(e){return t.subscribe(e)})},Ae.bufferWithCount=function(t,n){return n===e&&(n=t),this.windowWithCount(t,n).selectMany(function(t){return t.toArray()}).where(function(t){return t.length>0})},Ae.dematerialize=function(){var t=this;return new He(function(e){return t.subscribe(function(t){return t.accept(e)},e.onError.bind(e),e.onCompleted.bind(e))})},Ae.distinctUntilChanged=function(t,n){var i=this;return t||(t=r),n||(n=o),new He(function(r){var o,s=!1;return i.subscribe(function(i){var u,c=!1;try{u=t(i)}catch(a){return r.onError(a),e}if(s)try{c=n(o,u)}catch(a){return r.onError(a),e}s&&c||(s=!0,o=u,r.onNext(i))},r.onError.bind(r),r.onCompleted.bind(r))})},Ae["do"]=Ae.doAction=function(t,e,n){var r,i=this;return"function"==typeof t?r=t:(r=t.onNext.bind(t),e=t.onError.bind(t),n=t.onCompleted.bind(t)),new He(function(t){return i.subscribe(function(e){try{r(e)}catch(n){t.onError(n)}t.onNext(e)},function(n){if(e){try{e(n)}catch(r){t.onError(r)}t.onError(n)}else t.onError(n)},function(){if(n){try{n()}catch(e){t.onError(e)}t.onCompleted()}else t.onCompleted()})})},Ae["finally"]=Ae.finallyAction=function(t){var e=this;return new He(function(n){var r=e.subscribe(n); | ||
return $(function(){try{r.dispose()}catch(e){throw e}finally{t()}})})},Ae.ignoreElements=function(){var t=this;return new He(function(e){return t.subscribe(n,e.onError.bind(e),e.onCompleted.bind(e))})},Ae.materialize=function(){var t=this;return new He(function(e){return t.subscribe(function(t){e.onNext(be(t))},function(t){e.onNext(ve(t)),e.onCompleted()},function(){e.onNext(me()),e.onCompleted()})})},Ae.repeat=function(t){return Ee(this,t).concat()},Ae.retry=function(t){return Ee(this,t).catchException()},Ae.scan=function(){var t,e,n=!1;2===arguments.length?(t=arguments[0],e=arguments[1],n=!0):e=arguments[0];var r=this;return je(function(){var i,o=!1;return r.select(function(r){return o?i=e(i,r):(i=n?e(t,r):r,o=!0),i})})},Ae.skipLast=function(t){var e=this;return new He(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&n.onNext(r.shift())},n.onError.bind(n),n.onCompleted.bind(n))})},Ae.startWith=function(){var t,e,n=0;return arguments.length&&"now"in Object(arguments[0])?(e=arguments[0],n=1):e=ue,t=F.call(arguments,n),xe([Te(t,e),this]).concat()},Ae.takeLast=function(t,e){return this.takeLastBuffer(t).selectMany(function(t){return Te(t,e)})},Ae.takeLastBuffer=function(t){var e=this;return new He(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&r.shift()},n.onError.bind(n),function(){n.onNext(r),n.onCompleted()})})},Ae.windowWithCount=function(t,e){var n=this;if(0>=t)throw Error(S);if(null==e&&(e=t),0>=e)throw Error(S);return new He(function(r){var i=new ee,o=new ie(i),s=0,u=[],c=function(){var t=new Ke;u.push(t),r.onNext(G(t,o))};return c(),i.setDisposable(n.subscribe(function(n){for(var r,i=0,o=u.length;o>i;i++)u[i].onNext(n);var a=s-t+1;a>=0&&0===a%e&&(r=u.shift(),r.onCompleted()),s++,0===s%e&&c()},function(t){for(;u.length>0;)u.shift().onError(t);r.onError(t)},function(){for(;u.length>0;)u.shift().onCompleted();r.onCompleted()})),o})},Ae.defaultIfEmpty=function(t){var n=this;return t===e&&(t=null),new He(function(e){var r=!1;return n.subscribe(function(t){r=!0,e.onNext(t)},e.onError.bind(e),function(){r||e.onNext(t),e.onCompleted()})})},Ae.distinct=function(t,n){var i=this;return t||(t=r),n||(n=u),new He(function(r){var o={};return i.subscribe(function(i){var s,u,c,a=!1;try{s=t(i),u=n(s)}catch(h){return r.onError(h),e}for(c in o)if(u===c){a=!0;break}a||(o[u]=null,r.onNext(i))},r.onError.bind(r),r.onCompleted.bind(r))})},Ae.groupBy=function(t,e,n){return this.groupByUntil(t,e,function(){return Ie()},n)},Ae.groupByUntil=function(t,i,o,s){var c=this;return i||(i=r),s||(s=u),new He(function(r){var u={},a=new X,h=new ie(a);return a.add(c.subscribe(function(c){var l,f,p,d,b,v,m,y,w,g;try{v=t(c),m=s(v)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}d=!1;try{w=u[m],w||(w=new Ke,u[m]=w,d=!0)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}if(d){b=new Ge(v,w,h),f=new Ge(v,w);try{l=o(f)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}r.onNext(b),y=new ee,a.add(y);var x=function(){m in u&&(delete u[m],w.onCompleted()),a.remove(y)};y.setDisposable(l.take(1).subscribe(n,function(t){for(g in u)u[g].onError(t);r.onError(t)},function(){x()}))}try{p=i(c)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}w.onNext(p)},function(t){for(var e in u)u[e].onError(t);r.onError(t)},function(){for(var t in u)u[t].onCompleted();r.onCompleted()})),h})},Ae.select=Ae.map=function(t,n){var r=this;return new He(function(i){var o=0;return r.subscribe(function(s){var u;try{u=t.call(n,s,o++,r)}catch(c){return i.onError(c),e}i.onNext(u)},i.onError.bind(i),i.onCompleted.bind(i))})},Ae.pluck=function(t){return this.select(function(e){return e[t]})},Ae.selectMany=Ae.flatMap=function(t,e){return e?this.selectMany(function(n){return t(n).select(function(t){return e(n,t)})}):"function"==typeof t?g.call(this,t):g.call(this,function(){return t})},Ae.skip=function(t){if(0>t)throw Error(S);var e=this;return new He(function(n){var r=t;return e.subscribe(function(t){0>=r?n.onNext(t):r--},n.onError.bind(n),n.onCompleted.bind(n))})},Ae.skipWhile=function(t,n){var r=this;return new He(function(i){var o=0,s=!1;return r.subscribe(function(u){if(!s)try{s=!t.call(n,u,o++,r)}catch(c){return i.onError(c),e}s&&i.onNext(u)},i.onError.bind(i),i.onCompleted.bind(i))})},Ae.take=function(t,e){if(0>t)throw Error(S);if(0===t)return qe(e);var n=this;return new He(function(e){var r=t;return n.subscribe(function(t){r>0&&(r--,e.onNext(t),0===r&&e.onCompleted())},e.onError.bind(e),e.onCompleted.bind(e))})},Ae.takeWhile=function(t,n){var r=this;return new He(function(i){var o=0,s=!0;return r.subscribe(function(u){if(s){try{s=t.call(n,u,o++,r)}catch(c){return i.onError(c),e}s?i.onNext(u):i.onCompleted()}},i.onError.bind(i),i.onCompleted.bind(i))})},Ae.where=Ae.filter=function(t,n){var r=this;return new He(function(i){var o=0;return r.subscribe(function(s){var u;try{u=t.call(n,s,o++,r)}catch(c){return i.onError(c),e}u&&i.onNext(s)},i.onError.bind(i),i.onCompleted.bind(i))})};var He=D.Internals.AnonymousObservable=function(t){function n(r){function i(t){var e=new Ue(t);if(ce.scheduleRequired())ce.schedule(function(){try{e.disposable(r(e))}catch(t){if(!e.fail(t))throw t}});else try{e.disposable(r(e))}catch(n){if(!e.fail(n))throw n}return e}return this instanceof n?(t.call(this,i),e):new n(r)}return H(n,t),n}(We),Ue=function(t){function e(e){t.call(this),this.observer=e,this.m=new ee}H(e,t);var n=e.prototype;return n.next=function(t){var e=!1;try{this.observer.onNext(t),e=!0}catch(n){throw n}finally{e||this.dispose()}},n.error=function(t){try{this.observer.onError(t)}catch(e){throw e}finally{this.dispose()}},n.completed=function(){try{this.observer.onCompleted()}catch(t){throw t}finally{this.dispose()}},n.disposable=function(t){return this.m.disposable(t)},n.dispose=function(){t.prototype.dispose.call(this),this.m.dispose()},e}(Se),Ge=function(t){function e(t){return this.underlyingObservable.subscribe(t)}function n(n,r,i){t.call(this,e),this.key=n,this.underlyingObservable=i?new He(function(t){return new X(i.getDisposable(),r.subscribe(t))}):r}return H(n,t),n}(We),Je=function(t,e){this.subject=t,this.observer=e};Je.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1),this.observer=null}};var Ke=D.Subject=function(t){function e(t){return a.call(this),this.isStopped?this.exception?(t.onError(this.exception),te):(t.onCompleted(),te):(this.observers.push(t),new Je(this,t))}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return H(n,t),U(n.prototype,Ce,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(a.call(this),!this.isStopped){var t=this.observers.slice(0);this.isStopped=!0;for(var e=0,n=t.length;n>e;e++)t[e].onCompleted();this.observers=[]}},onError:function(t){if(a.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){if(a.call(this),!this.isStopped)for(var e=this.observers.slice(0),n=0,r=e.length;r>n;n++)e[n].onNext(t)},dispose:function(){this.isDisposed=!0,this.observers=null}}),n.create=function(t,e){return new Xe(t,e)},n}(We),Qe=D.AsyncSubject=function(t){function e(t){if(a.call(this),!this.isStopped)return this.observers.push(t),new Je(this,t);var e=this.exception,n=this.hasValue,r=this.value;return e?t.onError(e):n?(t.onNext(r),t.onCompleted()):t.onCompleted(),te}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return H(n,t),U(n.prototype,Ce,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){var t,e,n;if(a.call(this),!this.isStopped){var r=this.observers.slice(0);this.isStopped=!0;var i=this.value,o=this.hasValue;if(o)for(e=0,n=r.length;n>e;e++)t=r[e],t.onNext(i),t.onCompleted();else for(e=0,n=r.length;n>e;e++)r[e].onCompleted();this.observers=[]}},onError:function(t){if(a.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){a.call(this),this.isStopped||(this.value=t,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),n}(We),Xe=function(t){function e(t){return this.observable.subscribe(t)}function n(n,r){t.call(this,e),this.observer=n,this.observable=r}return H(n,t),U(n.prototype,Ce,{onCompleted:function(){this.observer.onCompleted()},onError:function(t){this.observer.onError(t)},onNext:function(t){this.observer.onNext(t)}}),n}(We);return"function"==typeof define&&"object"==typeof define.amd&&define.amd?(t.Rx=D,define(function(){return D})):(E?"object"==typeof module&&module&&module.exports==E?module.exports=D:E=D:t.Rx=D,e)})(this); |
@@ -1,1 +0,1 @@ | ||
(function(t,e){var n="object"==typeof exports&&exports,r=("object"==typeof module&&module&&module.exports==n&&module,"object"==typeof global&&global);r.global===r&&(window=r),"function"==typeof define&&define.amd?define(["rx","exports"],function(n,r){return t.Rx=e(t,r,n),t.Rx}):"object"==typeof module&&module&&module.exports===n?module.exports=e(t,module.exports,require("./rx")):t.Rx=e(t,{},t.Rx)})(this,function(t,e,n){function r(t,e){return m(t,e)}function i(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:b.call(t)}function o(t){this.predicate=t}function s(t){this.predicate=t}var u=n.Observer,c=n.Observable,a=n.Notification,h=n.VirtualTimeScheduler,l=n.Disposable,f=l.empty,p=l.create,d=n.CompositeDisposable,b=(n.SingleAssignmentDisposable,Array.prototype.slice),v=n.Internals.inherits,m=n.Internals.isEqual;o.prototype.equals=function(t){return t===this?!0:null==t?!1:"N"!==t.kind?!1:this.predicate(t.value)},s.prototype.equals=function(t){return t===this?!0:null==t?!1:"E"!==t.kind?!1:this.predicate(t.exception)};var y=n.ReactiveTest={created:100,subscribed:200,disposed:1e3,onNext:function(t,e){return"function"==typeof e?new g(t,new o(e)):new g(t,a.createOnNext(e))},onError:function(t,e){return"function"==typeof e?new g(t,new s(e)):new g(t,a.createOnError(e))},onCompleted:function(t){return new g(t,a.createOnCompleted())},subscribe:function(t,e){return new w(t,e)}},g=n.Recorded=function(t,e,n){this.time=t,this.value=e,this.comparer=n||r};g.prototype.equals=function(t){return this.time===t.time&&this.comparer(this.value,t.value)},g.prototype.toString=function(){return""+this.value+"@"+this.time};var w=n.Subscription=function(t,e){this.subscribe=t,this.unsubscribe=e||Number.MAX_VALUE};w.prototype.equals=function(t){return this.subscribe===t.subscribe&&this.unsubscribe===t.unsubscribe},w.prototype.toString=function(){return"("+this.subscribe+", "+this.unsubscribe===Number.MAX_VALUE?"Infinite":this.unsubscribe+")"};var E=n.MockDisposable=function(t){this.scheduler=t,this.disposes=[],this.disposes.push(this.scheduler.clock)};E.prototype.dispose=function(){this.disposes.push(this.scheduler.clock)};var x=function(t){function e(e){t.call(this),this.scheduler=e,this.messages=[]}v(e,t);var n=e.prototype;return n.onNext=function(t){this.messages.push(new g(this.scheduler.clock,a.createOnNext(t)))},n.onError=function(t){this.messages.push(new g(this.scheduler.clock,a.createOnError(t)))},n.onCompleted=function(){this.messages.push(new g(this.scheduler.clock,a.createOnCompleted()))},e}(u),C=function(t){function e(t){var e=this;this.observers.push(t),this.subscriptions.push(new w(this.scheduler.clock));var n=this.subscriptions.length-1;return p(function(){var r=e.observers.indexOf(t);e.observers.splice(r,1),e.subscriptions[n]=new w(e.subscriptions[n].subscribe,e.scheduler.clock)})}function n(n,r){t.call(this,e);var i,o,s=this;this.scheduler=n,this.messages=r,this.subscriptions=[],this.observers=[];for(var u=0,c=this.messages.length;c>u;u++)i=this.messages[u],o=i.value,function(t){n.scheduleAbsoluteWithState(null,i.time,function(){for(var e=0;s.observers.length>e;e++)t.accept(s.observers[e]);return f})}(o)}return v(n,t),n}(c),D=function(t){function e(t){var e,n,r=this;this.subscriptions.push(new w(this.scheduler.clock));for(var i=this.subscriptions.length-1,o=new d,s=0,u=this.messages.length;u>s;s++)e=this.messages[s],n=e.value,function(n){o.add(r.scheduler.scheduleRelativeWithState(null,e.time,function(){return n.accept(t),f}))}(n);return p(function(){r.subscriptions[i]=new w(r.subscriptions[i].subscribe,r.scheduler.clock),o.dispose()})}function n(n,r){t.call(this,e),this.scheduler=n,this.messages=r,this.subscriptions=[]}return v(n,t),n}(c);return n.TestScheduler=function(t){function e(){t.call(this,0,function(t,e){return t-e})}return v(e,t),e.prototype.scheduleAbsoluteWithState=function(e,n,r){return this.clock>=n&&(n=this.clock+1),t.prototype.scheduleAbsoluteWithState.call(this,e,n,r)},e.prototype.add=function(t,e){return t+e},e.prototype.toDateTimeOffset=function(t){return new Date(t).getTime()},e.prototype.toRelative=function(t){return t},e.prototype.startWithTiming=function(t,e,n,r){var i,o,s=this.createObserver();return this.scheduleAbsoluteWithState(null,e,function(){return i=t(),f}),this.scheduleAbsoluteWithState(null,n,function(){return o=i.subscribe(s),f}),this.scheduleAbsoluteWithState(null,r,function(){return o.dispose(),f}),this.start(),s},e.prototype.startWithDispose=function(t,e){return this.startWithTiming(t,y.created,y.subscribed,e)},e.prototype.startWithCreate=function(t){return this.startWithTiming(t,y.created,y.subscribed,y.disposed)},e.prototype.createHotObservable=function(){var t=i(arguments,0);return new C(this,t)},e.prototype.createColdObservable=function(){var t=i(arguments,0);return new D(this,t)},e.prototype.createObserver=function(){return new x(this)},e}(h),n}); | ||
(function(t,e){var n="object"==typeof exports&&exports,r=("object"==typeof module&&module&&module.exports==n&&module,"object"==typeof global&&global);r.global===r&&(window=r),"function"==typeof define&&define.amd?define(["rx","exports"],function(n,r){return t.Rx=e(t,r,n),t.Rx}):"object"==typeof module&&module&&module.exports===n?module.exports=e(t,module.exports,require("./rx")):t.Rx=e(t,{},t.Rx)})(this,function(t,e,n){function r(t,e){return m(t,e)}function i(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:b.call(t)}function o(t){this.predicate=t}function s(t){this.predicate=t}var u=n.Observer,c=n.Observable,a=n.Notification,h=n.VirtualTimeScheduler,l=n.Disposable,f=l.empty,p=l.create,d=n.CompositeDisposable,b=(n.SingleAssignmentDisposable,Array.prototype.slice),v=n.Internals.inherits,m=n.Internals.isEqual;o.prototype.equals=function(t){return t===this?!0:null==t?!1:"N"!==t.kind?!1:this.predicate(t.value)},s.prototype.equals=function(t){return t===this?!0:null==t?!1:"E"!==t.kind?!1:this.predicate(t.exception)};var y=n.ReactiveTest={created:100,subscribed:200,disposed:1e3,onNext:function(t,e){return"function"==typeof e?new w(t,new o(e)):new w(t,a.createOnNext(e))},onError:function(t,e){return"function"==typeof e?new w(t,new s(e)):new w(t,a.createOnError(e))},onCompleted:function(t){return new w(t,a.createOnCompleted())},subscribe:function(t,e){return new g(t,e)}},w=n.Recorded=function(t,e,n){this.time=t,this.value=e,this.comparer=n||r};w.prototype.equals=function(t){return this.time===t.time&&this.comparer(this.value,t.value)},w.prototype.toString=function(){return""+this.value+"@"+this.time};var g=n.Subscription=function(t,e){this.subscribe=t,this.unsubscribe=e||Number.MAX_VALUE};g.prototype.equals=function(t){return this.subscribe===t.subscribe&&this.unsubscribe===t.unsubscribe},g.prototype.toString=function(){return"("+this.subscribe+", "+this.unsubscribe===Number.MAX_VALUE?"Infinite":this.unsubscribe+")"};var E=n.MockDisposable=function(t){this.scheduler=t,this.disposes=[],this.disposes.push(this.scheduler.clock)};E.prototype.dispose=function(){this.disposes.push(this.scheduler.clock)};var x=function(t){function e(e){t.call(this),this.scheduler=e,this.messages=[]}v(e,t);var n=e.prototype;return n.onNext=function(t){this.messages.push(new w(this.scheduler.clock,a.createOnNext(t)))},n.onError=function(t){this.messages.push(new w(this.scheduler.clock,a.createOnError(t)))},n.onCompleted=function(){this.messages.push(new w(this.scheduler.clock,a.createOnCompleted()))},e}(u),C=function(t){function e(t){var e=this;this.observers.push(t),this.subscriptions.push(new g(this.scheduler.clock));var n=this.subscriptions.length-1;return p(function(){var r=e.observers.indexOf(t);e.observers.splice(r,1),e.subscriptions[n]=new g(e.subscriptions[n].subscribe,e.scheduler.clock)})}function n(n,r){t.call(this,e);var i,o,s=this;this.scheduler=n,this.messages=r,this.subscriptions=[],this.observers=[];for(var u=0,c=this.messages.length;c>u;u++)i=this.messages[u],o=i.value,function(t){n.scheduleAbsoluteWithState(null,i.time,function(){for(var e=0;s.observers.length>e;e++)t.accept(s.observers[e]);return f})}(o)}return v(n,t),n}(c),D=function(t){function e(t){var e,n,r=this;this.subscriptions.push(new g(this.scheduler.clock));for(var i=this.subscriptions.length-1,o=new d,s=0,u=this.messages.length;u>s;s++)e=this.messages[s],n=e.value,function(n){o.add(r.scheduler.scheduleRelativeWithState(null,e.time,function(){return n.accept(t),f}))}(n);return p(function(){r.subscriptions[i]=new g(r.subscriptions[i].subscribe,r.scheduler.clock),o.dispose()})}function n(n,r){t.call(this,e),this.scheduler=n,this.messages=r,this.subscriptions=[]}return v(n,t),n}(c);return n.TestScheduler=function(t){function e(){t.call(this,0,function(t,e){return t-e})}return v(e,t),e.prototype.scheduleAbsoluteWithState=function(e,n,r){return this.clock>=n&&(n=this.clock+1),t.prototype.scheduleAbsoluteWithState.call(this,e,n,r)},e.prototype.add=function(t,e){return t+e},e.prototype.toDateTimeOffset=function(t){return new Date(t).getTime()},e.prototype.toRelative=function(t){return t},e.prototype.startWithTiming=function(t,e,n,r){var i,o,s=this.createObserver();return this.scheduleAbsoluteWithState(null,e,function(){return i=t(),f}),this.scheduleAbsoluteWithState(null,n,function(){return o=i.subscribe(s),f}),this.scheduleAbsoluteWithState(null,r,function(){return o.dispose(),f}),this.start(),s},e.prototype.startWithDispose=function(t,e){return this.startWithTiming(t,y.created,y.subscribed,e)},e.prototype.startWithCreate=function(t){return this.startWithTiming(t,y.created,y.subscribed,y.disposed)},e.prototype.createHotObservable=function(){var t=i(arguments,0);return new C(this,t)},e.prototype.createColdObservable=function(){var t=i(arguments,0);return new D(this,t)},e.prototype.createObserver=function(){return new x(this)},e}(h),n}); |
@@ -30,2 +30,3 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. | ||
observableEmpty = Observable.empty, | ||
observableNever = Observable.never, | ||
observableThrow = Observable.throwException, | ||
@@ -485,16 +486,3 @@ observableFromArray = Observable.fromArray, | ||
observableProto.bufferWithTime = function (timeSpan, timeShiftOrScheduler, scheduler) { | ||
var timeShift; | ||
if (timeShiftOrScheduler === undefined) { | ||
timeShift = timeSpan; | ||
} | ||
scheduler || (scheduler = timeoutScheduler); | ||
if (typeof timeShiftOrScheduler === 'number') { | ||
timeShift = timeShiftOrScheduler; | ||
} else if (typeof timeShiftOrScheduler === 'object') { | ||
timeShift = timeSpan; | ||
scheduler = timeShiftOrScheduler; | ||
} | ||
return this.windowWithTime(timeSpan, timeShift, scheduler).selectMany(function (x) { | ||
return x.toArray(); | ||
}); | ||
return this.windowWithTime.apply(this, arguments).selectMany(function (x) { return x.toArray(); }); | ||
}; | ||
@@ -516,3 +504,2 @@ | ||
observableProto.bufferWithTimeOrCount = function (timeSpan, count, scheduler) { | ||
scheduler || (scheduler = timeoutScheduler); | ||
return this.windowWithTimeOrCount(timeSpan, count, scheduler).selectMany(function (x) { | ||
@@ -902,3 +889,6 @@ return x.toArray(); | ||
observableProto.timeoutWithSelector = function (firstTimeout, timeoutdurationSelector, other) { | ||
firstTimeout || (firstTimeout = observableNever()); | ||
if (arguments.length === 1) { | ||
timeoutdurationSelector = firstTimeout; | ||
var firstTimeout = observableNever(); | ||
} | ||
other || (other = observableThrow(new Error('Timeout'))); | ||
@@ -905,0 +895,0 @@ var source = this; |
@@ -1,1 +0,1 @@ | ||
(function(t,e){var n="object"==typeof exports&&exports,r=("object"==typeof module&&module&&module.exports==n&&module,"object"==typeof global&&global);r.global===r&&(window=r),"function"==typeof define&&define.amd?define(["rx","exports"],function(n,r){return t.Rx=e(t,r,n),t.Rx}):"object"==typeof module&&module&&module.exports===n?module.exports=e(t,module.exports,require("./rx")):t.Rx=e(t,{},t.Rx)})(this,function(t,e,n,r){function i(t,e){return new p(function(n){return e.scheduleWithAbsolute(t,function(){n.onNext(0),n.onCompleted()})})}function o(t,e,n){var r=A(e);return new p(function(e){var i=0,o=t;return n.scheduleRecursiveWithAbsolute(o,function(t){var s;r>0&&(s=n.now(),o+=r,s>=o&&(o=s+r)),e.onNext(i++),t(o)})})}function s(t,e){var n=A(t);return new p(function(t){return e.scheduleWithRelative(n,function(){t.onNext(0),t.onCompleted()})})}function u(t,e,n){return t===e?new p(function(t){return n.schedulePeriodicWithState(0,e,function(e){return t.onNext(e),e+1})}):d(function(){return o(n.now()+t,e,n)})}function c(t,e){var n=this;return new p(function(r){var i,o=!1,s=new g,u=null,c=[],a=!1;return i=n.materialize().timestamp(e).subscribe(function(n){var i,h;"E"===n.value.kind?(c=[],c.push(n),u=n.value.exception,h=!a):(c.push({value:n.value,timestamp:n.timestamp+t}),h=!o,o=!0),h&&(null!==u?r.onError(u):(i=new w,s.disposable(i),i.disposable(e.scheduleRecursiveWithRelative(t,function(t){var n,i,s,h;if(null===u){a=!0;do s=null,c.length>0&&0>=c[0].timestamp-e.now()&&(s=c.shift().value),null!==s&&s.accept(r);while(null!==s);h=!1,i=0,c.length>0?(h=!0,i=Math.max(0,c[0].timestamp-e.now())):o=!1,n=u,a=!1,null!==n?r.onError(n):h&&t(i)}}))))}),new x(i,s)})}function a(t,e){var n=this;return d(function(){var r=t-e.now();return c.call(n,r,e)})}function h(t,e){return new p(function(n){function r(){s&&(s=!1,n.onNext(o)),i&&n.onCompleted()}var i,o,s;return new x(t.subscribe(function(t){s=!0,o=t},n.onError.bind(n),function(){i=!0}),e.subscribe(r,n.onError.bind(n),r))})}var l=n.Observable,f=l.prototype,p=n.Internals.AnonymousObservable,d=l.defer,b=l.empty,v=l.throwException,m=l.fromArray,y=n.Scheduler.timeout,w=n.SingleAssignmentDisposable,g=n.SerialDisposable,x=n.CompositeDisposable,E=n.RefCountDisposable,C=n.Subject,D=(n.Internals.BinaryObserver,n.Internals.addRef),A=n.Scheduler.normalize,N=l.interval=function(t,e){return e||(e=y),u(t,t,e)},S=l.timer=function(t,e,n){var c;return n||(n=y),e!==r&&"number"==typeof e?c=e:e!==r&&"object"==typeof e&&(n=e),t instanceof Date&&c===r?i(t.getTime(),n):t instanceof Date&&c!==r?(c=e,o(t.getTime(),c,n)):c===r?s(t,n):u(t,c,n)};return f.delay=function(t,e){return e||(e=y),t instanceof Date?a.call(this,t.getTime(),e):c.call(this,t,e)},f.throttle=function(t,e){e||(e=y);var n=this;return new p(function(r){var i,o=new g,s=!1,u=0,c=null;return i=n.subscribe(function(n){var i,a;s=!0,c=n,u++,i=u,a=new w,o.disposable(a),a.disposable(e.scheduleWithRelative(t,function(){s&&u===i&&r.onNext(c),s=!1}))},function(t){o.dispose(),r.onError(t),s=!1,u++},function(){o.dispose(),s&&r.onNext(c),r.onCompleted(),s=!1,u++}),new x(i,o)})},f.windowWithTime=function(t,e,n){var i,o=this;return e===r&&(i=t),n===r&&(n=y),"number"==typeof e?i=e:"object"==typeof e&&(i=t,n=e),new p(function(e){var r,s,u,c=i,a=t,h=[],l=new g,f=0;return s=new x(l),u=new E(s),r=function(){var t,o,s,p,d;s=new w,l.disposable(s),o=!1,t=!1,a===c?(o=!0,t=!0):c>a?o=!0:t=!0,p=o?a:c,d=p-f,f=p,o&&(a+=i),t&&(c+=i),s.disposable(n.scheduleWithRelative(d,function(){var n;t&&(n=new C,h.push(n),e.onNext(D(n,u))),o&&(n=h.shift(),n.onCompleted()),r()}))},h.push(new C),e.onNext(D(h[0],u)),r(),s.add(o.subscribe(function(t){var e,n;for(e=0;h.length>e;e++)n=h[e],n.onNext(t)},function(t){var n,r;for(n=0;h.length>n;n++)r=h[n],r.onError(t);e.onError(t)},function(){var t,n;for(t=0;h.length>t;t++)n=h[t],n.onCompleted();e.onCompleted()})),u})},f.windowWithTimeOrCount=function(t,e,n){var r=this;return n||(n=y),new p(function(i){var o,s,u,c,a=0,h=new g,l=0;return s=new x(h),u=new E(s),o=function(e){var r=new w;h.disposable(r),r.disposable(n.scheduleWithRelative(t,function(){var t;e===l&&(a=0,t=++l,c.onCompleted(),c=new C,i.onNext(D(c,u)),o(t))}))},c=new C,i.onNext(D(c,u)),o(0),s.add(r.subscribe(function(t){var n=0,r=!1;c.onNext(t),a++,a===e&&(r=!0,a=0,n=++l,c.onCompleted(),c=new C,i.onNext(D(c,u))),r&&o(n)},function(t){c.onError(t),i.onError(t)},function(){c.onCompleted(),i.onCompleted()})),u})},f.bufferWithTime=function(t,e,n){var i;return e===r&&(i=t),n||(n=y),"number"==typeof e?i=e:"object"==typeof e&&(i=t,n=e),this.windowWithTime(t,i,n).selectMany(function(t){return t.toArray()})},f.bufferWithTimeOrCount=function(t,e,n){return n||(n=y),this.windowWithTimeOrCount(t,e,n).selectMany(function(t){return t.toArray()})},f.timeInterval=function(t){var e=this;return t||(t=y),d(function(){var n=t.now();return e.select(function(e){var r=t.now(),i=r-n;return n=r,{value:e,interval:i}})})},f.timestamp=function(t){return t||(t=y),this.select(function(e){return{value:e,timestamp:t.now()}})},f.sample=function(t,e){return e||(e=y),"number"==typeof t?h(this,N(t,e)):h(this,t)},f.timeout=function(t,e,n){var r,i=this;return e||(e=v(Error("Timeout"))),n||(n=y),r=t instanceof Date?function(t,e){n.scheduleWithAbsolute(t,e)}:function(t,e){n.scheduleWithRelative(t,e)},new p(function(n){var o,s=0,u=new w,c=new g,a=!1,h=new g;return c.disposable(u),o=function(){var i=s;h.disposable(r(t,function(){a=s===i;var t=a;t&&c.disposable(e.subscribe(n))}))},o(),u.disposable(i.subscribe(function(t){var e=!a;e&&(s++,n.onNext(t),o())},function(t){var e=!a;e&&(s++,n.onError(t))},function(){var t=!a;t&&(s++,n.onCompleted())})),new x(c,h)})},l.generateWithAbsoluteTime=function(t,e,n,i,o,s){return s||(s=y),new p(function(u){var c,a,h=!0,l=!1,f=t;return s.scheduleRecursiveWithAbsolute(s.now(),function(t){l&&u.onNext(c);try{h?h=!1:f=n(f),l=e(f),l&&(c=i(f),a=o(f))}catch(s){return u.onError(s),r}l?t(a):u.onCompleted()})})},l.generateWithRelativeTime=function(t,e,n,i,o,s){return s||(s=y),new p(function(u){var c,a,h=!0,l=!1,f=t;return s.scheduleRecursiveWithRelative(0,function(t){l&&u.onNext(c);try{h?h=!1:f=n(f),l=e(f),l&&(c=i(f),a=o(f))}catch(s){return u.onError(s),r}l?t(a):u.onCompleted()})})},f.delaySubscription=function(t,e){return e||(e=y),this.delayWithSelector(S(t,e),function(){return b()})},f.delayWithSelector=function(t,e){var n,i,o=this;return"function"==typeof t?i=t:(n=t,i=e),new p(function(t){var e=new x,s=!1,u=function(){s&&0===e.length&&t.onCompleted()},c=new g,a=function(){c.setDisposable(o.subscribe(function(n){var o;try{o=i(n)}catch(s){return t.onError(s),r}var c=new w;e.add(c),c.setDisposable(o.subscribe(function(){t.onNext(n),e.remove(c),u()},t.onError.bind(t),function(){t.onNext(n),e.remove(c),u()}))},t.onError.bind(t),function(){s=!0,c.dispose(),u()}))};return n?c.setDisposable(n.subscribe(function(){a()},t.onError.bind(t),function(){a()})):a(),new x(c,e)})},f.timeoutWithSelector=function(t,e,n){t||(t=observableNever()),n||(n=v(Error("Timeout")));var i=this;return new p(function(o){var s=new g,u=new g,c=new w;s.setDisposable(c);var a=0,h=!1,l=function(t){var e=a,r=function(){return a===e},i=new w;u.setDisposable(i),i.setDisposable(t.subscribe(function(){r()&&s.setDisposable(n.subscribe(o)),i.dispose()},function(t){r()&&o.onError(t)},function(){r()&&s.setDisposable(n.subscribe(o))}))};l(t);var f=function(){var t=!h;return t&&a++,t};return c.setDisposable(i.subscribe(function(t){if(f()){o.onNext(t);var n;try{n=e(t)}catch(i){return o.onError(i),r}l(n)}},function(t){f()&&o.onError(t)},function(){f()&&o.onCompleted()})),new x(s,u)})},f.throttleWithSelector=function(t){var e=this;return new p(function(n){var i,o=!1,s=new g,u=0,c=e.subscribe(function(e){var c;try{c=t(e)}catch(a){return n.onError(a),r}o=!0,i=e,u++;var h=u,l=new w;s.setDisposable(l),l.setDisposable(c.subscribe(function(){o&&u===h&&n.onNext(i),o=!1,l.dispose()},n.onError.bind(n),function(){o&&u===h&&n.onNext(i),o=!1,l.dispose()}))},function(t){s.dispose(),n.onError(t),o=!1,u++},function(){s.dispose(),o&&n.onNext(i),n.onCompleted(),o=!1,u++});return new x(c,s)})},f.skipLastWithTime=function(t,e){e||(e=y);var n=this;return new p(function(r){var i=[];return n.subscribe(function(n){var o=e.now();for(i.push({interval:o,value:n});i.length>0&&o-i[0].interval>=t;)r.onNext(i.shift().value)},r.onError.bind(r),function(){for(var n=e.now();i.length>0&&n-i[0].interval>=t;)r.onNext(i.shift().value);r.onCompleted()})})},f.takeLastWithTime=function(t,e,n){return this.takeLastBufferWithTime(t,e).selectMany(function(t){return m(t,n)})},f.takeLastBufferWithTime=function(t,e){var n=this;return e||(e=y),new p(function(r){var i=[];return n.subscribe(function(n){var r=e.now();for(i.push({interval:r,value:n});i.length>0&&r-i[0].interval>=t;)i.shift()},r.onError.bind(r),function(){for(var n=e.now(),o=[];i.length>0;){var s=i.shift();t>=n-s.interval&&o.push(s.value)}r.onNext(o),r.onCompleted()})})},f.takeWithTime=function(t,e){var n=this;return e||(e=y),new p(function(r){var i=e.scheduleWithRelative(t,function(){r.onCompleted()});return new x(i,n.subscribe(r))})},f.skipWithTime=function(t,e){var n=this;return e||(e=y),new p(function(r){var i=!1,o=e.scheduleWithRelative(t,function(){i=!0}),s=n.subscribe(function(t){i&&r.onNext(t)},r.onError.bind(r),r.onCompleted.bind(r));return new x(o,s)})},f.skipUntilWithTime=function(t,e){e||(e=y);var n=this;return new p(function(r){var i=!1,o=e.scheduleWithAbsolute(t,function(){i=!0}),s=n.subscribe(function(t){i&&r.onNext(t)},r.onError.bind(r),r.onCompleted.bind(r));return new x(o,s)})},f.takeUntilWithTime=function(t,e){e||(e=y);var n=this;return new p(function(r){return new x(e.scheduleWithAbsolute(t,function(){r.onCompleted()}),n.subscribe(r))})},n}); | ||
(function(t,e){var n="object"==typeof exports&&exports,r=("object"==typeof module&&module&&module.exports==n&&module,"object"==typeof global&&global);r.global===r&&(window=r),"function"==typeof define&&define.amd?define(["rx","exports"],function(n,r){return t.Rx=e(t,r,n),t.Rx}):"object"==typeof module&&module&&module.exports===n?module.exports=e(t,module.exports,require("./rx")):t.Rx=e(t,{},t.Rx)})(this,function(t,e,n,r){function i(t,e){return new p(function(n){return e.scheduleWithAbsolute(t,function(){n.onNext(0),n.onCompleted()})})}function o(t,e,n){var r=N(e);return new p(function(e){var i=0,o=t;return n.scheduleRecursiveWithAbsolute(o,function(t){var s;r>0&&(s=n.now(),o+=r,s>=o&&(o=s+r)),e.onNext(i++),t(o)})})}function s(t,e){var n=N(t);return new p(function(t){return e.scheduleWithRelative(n,function(){t.onNext(0),t.onCompleted()})})}function u(t,e,n){return t===e?new p(function(t){return n.schedulePeriodicWithState(0,e,function(e){return t.onNext(e),e+1})}):d(function(){return o(n.now()+t,e,n)})}function c(t,e){var n=this;return new p(function(r){var i,o=!1,s=new x,u=null,c=[],a=!1;return i=n.materialize().timestamp(e).subscribe(function(n){var i,h;"E"===n.value.kind?(c=[],c.push(n),u=n.value.exception,h=!a):(c.push({value:n.value,timestamp:n.timestamp+t}),h=!o,o=!0),h&&(null!==u?r.onError(u):(i=new g,s.disposable(i),i.disposable(e.scheduleRecursiveWithRelative(t,function(t){var n,i,s,h;if(null===u){a=!0;do s=null,c.length>0&&0>=c[0].timestamp-e.now()&&(s=c.shift().value),null!==s&&s.accept(r);while(null!==s);h=!1,i=0,c.length>0?(h=!0,i=Math.max(0,c[0].timestamp-e.now())):o=!1,n=u,a=!1,null!==n?r.onError(n):h&&t(i)}}))))}),new E(i,s)})}function a(t,e){var n=this;return d(function(){var r=t-e.now();return c.call(n,r,e)})}function h(t,e){return new p(function(n){function r(){s&&(s=!1,n.onNext(o)),i&&n.onCompleted()}var i,o,s;return new E(t.subscribe(function(t){s=!0,o=t},n.onError.bind(n),function(){i=!0}),e.subscribe(r,n.onError.bind(n),r))})}var l=n.Observable,f=l.prototype,p=n.Internals.AnonymousObservable,d=l.defer,b=l.empty,v=l.never,m=l.throwException,y=l.fromArray,w=n.Scheduler.timeout,g=n.SingleAssignmentDisposable,x=n.SerialDisposable,E=n.CompositeDisposable,C=n.RefCountDisposable,D=n.Subject,A=(n.Internals.BinaryObserver,n.Internals.addRef),N=n.Scheduler.normalize,S=l.interval=function(t,e){return e||(e=w),u(t,t,e)},_=l.timer=function(t,e,n){var c;return n||(n=w),e!==r&&"number"==typeof e?c=e:e!==r&&"object"==typeof e&&(n=e),t instanceof Date&&c===r?i(t.getTime(),n):t instanceof Date&&c!==r?(c=e,o(t.getTime(),c,n)):c===r?s(t,n):u(t,c,n)};return f.delay=function(t,e){return e||(e=w),t instanceof Date?a.call(this,t.getTime(),e):c.call(this,t,e)},f.throttle=function(t,e){e||(e=w);var n=this;return new p(function(r){var i,o=new x,s=!1,u=0,c=null;return i=n.subscribe(function(n){var i,a;s=!0,c=n,u++,i=u,a=new g,o.disposable(a),a.disposable(e.scheduleWithRelative(t,function(){s&&u===i&&r.onNext(c),s=!1}))},function(t){o.dispose(),r.onError(t),s=!1,u++},function(){o.dispose(),s&&r.onNext(c),r.onCompleted(),s=!1,u++}),new E(i,o)})},f.windowWithTime=function(t,e,n){var i,o=this;return e===r&&(i=t),n===r&&(n=w),"number"==typeof e?i=e:"object"==typeof e&&(i=t,n=e),new p(function(e){var r,s,u,c=i,a=t,h=[],l=new x,f=0;return s=new E(l),u=new C(s),r=function(){var t,o,s,p,d;s=new g,l.disposable(s),o=!1,t=!1,a===c?(o=!0,t=!0):c>a?o=!0:t=!0,p=o?a:c,d=p-f,f=p,o&&(a+=i),t&&(c+=i),s.disposable(n.scheduleWithRelative(d,function(){var n;t&&(n=new D,h.push(n),e.onNext(A(n,u))),o&&(n=h.shift(),n.onCompleted()),r()}))},h.push(new D),e.onNext(A(h[0],u)),r(),s.add(o.subscribe(function(t){var e,n;for(e=0;h.length>e;e++)n=h[e],n.onNext(t)},function(t){var n,r;for(n=0;h.length>n;n++)r=h[n],r.onError(t);e.onError(t)},function(){var t,n;for(t=0;h.length>t;t++)n=h[t],n.onCompleted();e.onCompleted()})),u})},f.windowWithTimeOrCount=function(t,e,n){var r=this;return n||(n=w),new p(function(i){var o,s,u,c,a=0,h=new x,l=0;return s=new E(h),u=new C(s),o=function(e){var r=new g;h.disposable(r),r.disposable(n.scheduleWithRelative(t,function(){var t;e===l&&(a=0,t=++l,c.onCompleted(),c=new D,i.onNext(A(c,u)),o(t))}))},c=new D,i.onNext(A(c,u)),o(0),s.add(r.subscribe(function(t){var n=0,r=!1;c.onNext(t),a++,a===e&&(r=!0,a=0,n=++l,c.onCompleted(),c=new D,i.onNext(A(c,u))),r&&o(n)},function(t){c.onError(t),i.onError(t)},function(){c.onCompleted(),i.onCompleted()})),u})},f.bufferWithTime=function(){return this.windowWithTime.apply(this,arguments).selectMany(function(t){return t.toArray()})},f.bufferWithTimeOrCount=function(t,e,n){return this.windowWithTimeOrCount(t,e,n).selectMany(function(t){return t.toArray()})},f.timeInterval=function(t){var e=this;return t||(t=w),d(function(){var n=t.now();return e.select(function(e){var r=t.now(),i=r-n;return n=r,{value:e,interval:i}})})},f.timestamp=function(t){return t||(t=w),this.select(function(e){return{value:e,timestamp:t.now()}})},f.sample=function(t,e){return e||(e=w),"number"==typeof t?h(this,S(t,e)):h(this,t)},f.timeout=function(t,e,n){var r,i=this;return e||(e=m(Error("Timeout"))),n||(n=w),r=t instanceof Date?function(t,e){n.scheduleWithAbsolute(t,e)}:function(t,e){n.scheduleWithRelative(t,e)},new p(function(n){var o,s=0,u=new g,c=new x,a=!1,h=new x;return c.disposable(u),o=function(){var i=s;h.disposable(r(t,function(){a=s===i;var t=a;t&&c.disposable(e.subscribe(n))}))},o(),u.disposable(i.subscribe(function(t){var e=!a;e&&(s++,n.onNext(t),o())},function(t){var e=!a;e&&(s++,n.onError(t))},function(){var t=!a;t&&(s++,n.onCompleted())})),new E(c,h)})},l.generateWithAbsoluteTime=function(t,e,n,i,o,s){return s||(s=w),new p(function(u){var c,a,h=!0,l=!1,f=t;return s.scheduleRecursiveWithAbsolute(s.now(),function(t){l&&u.onNext(c);try{h?h=!1:f=n(f),l=e(f),l&&(c=i(f),a=o(f))}catch(s){return u.onError(s),r}l?t(a):u.onCompleted()})})},l.generateWithRelativeTime=function(t,e,n,i,o,s){return s||(s=w),new p(function(u){var c,a,h=!0,l=!1,f=t;return s.scheduleRecursiveWithRelative(0,function(t){l&&u.onNext(c);try{h?h=!1:f=n(f),l=e(f),l&&(c=i(f),a=o(f))}catch(s){return u.onError(s),r}l?t(a):u.onCompleted()})})},f.delaySubscription=function(t,e){return e||(e=w),this.delayWithSelector(_(t,e),function(){return b()})},f.delayWithSelector=function(t,e){var n,i,o=this;return"function"==typeof t?i=t:(n=t,i=e),new p(function(t){var e=new E,s=!1,u=function(){s&&0===e.length&&t.onCompleted()},c=new x,a=function(){c.setDisposable(o.subscribe(function(n){var o;try{o=i(n)}catch(s){return t.onError(s),r}var c=new g;e.add(c),c.setDisposable(o.subscribe(function(){t.onNext(n),e.remove(c),u()},t.onError.bind(t),function(){t.onNext(n),e.remove(c),u()}))},t.onError.bind(t),function(){s=!0,c.dispose(),u()}))};return n?c.setDisposable(n.subscribe(function(){a()},t.onError.bind(t),function(){a()})):a(),new E(c,e)})},f.timeoutWithSelector=function(t,e,n){if(1===arguments.length){e=t;var t=v()}n||(n=m(Error("Timeout")));var i=this;return new p(function(o){var s=new x,u=new x,c=new g;s.setDisposable(c);var a=0,h=!1,l=function(t){var e=a,r=function(){return a===e},i=new g;u.setDisposable(i),i.setDisposable(t.subscribe(function(){r()&&s.setDisposable(n.subscribe(o)),i.dispose()},function(t){r()&&o.onError(t)},function(){r()&&s.setDisposable(n.subscribe(o))}))};l(t);var f=function(){var t=!h;return t&&a++,t};return c.setDisposable(i.subscribe(function(t){if(f()){o.onNext(t);var n;try{n=e(t)}catch(i){return o.onError(i),r}l(n)}},function(t){f()&&o.onError(t)},function(){f()&&o.onCompleted()})),new E(s,u)})},f.throttleWithSelector=function(t){var e=this;return new p(function(n){var i,o=!1,s=new x,u=0,c=e.subscribe(function(e){var c;try{c=t(e)}catch(a){return n.onError(a),r}o=!0,i=e,u++;var h=u,l=new g;s.setDisposable(l),l.setDisposable(c.subscribe(function(){o&&u===h&&n.onNext(i),o=!1,l.dispose()},n.onError.bind(n),function(){o&&u===h&&n.onNext(i),o=!1,l.dispose()}))},function(t){s.dispose(),n.onError(t),o=!1,u++},function(){s.dispose(),o&&n.onNext(i),n.onCompleted(),o=!1,u++});return new E(c,s)})},f.skipLastWithTime=function(t,e){e||(e=w);var n=this;return new p(function(r){var i=[];return n.subscribe(function(n){var o=e.now();for(i.push({interval:o,value:n});i.length>0&&o-i[0].interval>=t;)r.onNext(i.shift().value)},r.onError.bind(r),function(){for(var n=e.now();i.length>0&&n-i[0].interval>=t;)r.onNext(i.shift().value);r.onCompleted()})})},f.takeLastWithTime=function(t,e,n){return this.takeLastBufferWithTime(t,e).selectMany(function(t){return y(t,n)})},f.takeLastBufferWithTime=function(t,e){var n=this;return e||(e=w),new p(function(r){var i=[];return n.subscribe(function(n){var r=e.now();for(i.push({interval:r,value:n});i.length>0&&r-i[0].interval>=t;)i.shift()},r.onError.bind(r),function(){for(var n=e.now(),o=[];i.length>0;){var s=i.shift();t>=n-s.interval&&o.push(s.value)}r.onNext(o),r.onCompleted()})})},f.takeWithTime=function(t,e){var n=this;return e||(e=w),new p(function(r){var i=e.scheduleWithRelative(t,function(){r.onCompleted()});return new E(i,n.subscribe(r))})},f.skipWithTime=function(t,e){var n=this;return e||(e=w),new p(function(r){var i=!1,o=e.scheduleWithRelative(t,function(){i=!0}),s=n.subscribe(function(t){i&&r.onNext(t)},r.onError.bind(r),r.onCompleted.bind(r));return new E(o,s)})},f.skipUntilWithTime=function(t,e){e||(e=w);var n=this;return new p(function(r){var i=!1,o=e.scheduleWithAbsolute(t,function(){i=!0}),s=n.subscribe(function(t){i&&r.onNext(t)},r.onError.bind(r),r.onCompleted.bind(r));return new E(o,s)})},f.takeUntilWithTime=function(t,e){e||(e=w);var n=this;return new p(function(r){return new E(e.scheduleWithAbsolute(t,function(){r.onCompleted()}),n.subscribe(r))})},n}); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
738689
209
13880