Socket
Socket
Sign inDemoInstall

rx

Package Overview
Dependencies
Maintainers
2
Versions
103
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rx - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

rx.modern.js

57

Gruntfile.js

@@ -27,2 +27,3 @@ module.exports = function (grunt) {

'src/core/basicheader.js',
'src/core/internal/util.js',
'src/core/internal/polyfills.js',

@@ -73,2 +74,52 @@ 'src/core/internal/priorityqueue.js',

},
modern: {
src: [
'src/core/license.js',
'src/core/intro.js',
'src/core/basicheader.js',
'src/core/internal/util.js',
'src/core/internal/priorityqueue.js',
'src/core/disposables/compositedisposable.js',
'src/core/disposables/disposable.js',
'src/core/disposables/singleassignmentdisposable.js',
'src/core/disposables/serialdisposable.js',
'src/core/disposables/refcountdisposable.js',
'src/core/disposables/scheduleddisposable.js',
'src/core/concurrency/scheduleditem.js',
'src/core/concurrency/scheduler.js',
'src/core/concurrency/immediatescheduler.js',
'src/core/concurrency/currentthreadscheduler.js',
'src/core/concurrency/scheduleperiodicrecursive.js',
'src/core/concurrency/virtualtimescheduler.js',
'src/core/concurrency/historicalscheduler.js',
'src/core/concurrency/timeoutscheduler.js',
'src/core/concurrency/catchscheduler.js',
'src/core/notification.js',
'src/core/internal/enumerator.js',
'src/core/internal/enumerable.js',
'src/core/observer.js',
'src/core/abstractobserver.js',
'src/core/anonymousobserver.js',
'src/core/checkedobserver.js',
'src/core/scheduledobserver.js',
'src/core/observeonobserver.js',
'src/core/observable.js',
'src/core/linq/observable.async.js',
'src/core/linq/observable.concurrency.js',
'src/core/linq/observable.creation.js',
'src/core/linq/observable.multiple.js',
'src/core/linq/observable.single.js',
'src/core/linq/observable.standardsequenceoperators.js',
'src/core/anonymousobservable.js',
'src/core/autodetachobserver.js',
'src/core/linq/groupedobservable.js',
'src/core/subjects/innersubscription.js',
'src/core/subjects/subject.js',
'src/core/subjects/asyncsubject.js',
'src/core/subjects/anonymoussubject.js',
'src/core/exports.js',
'src/core/outro.js'
],
dest: 'rx.modern.js'
},
aggregates: {

@@ -166,2 +217,6 @@ src: [

},
modern: {
src: ['<banner>', 'rx.modern.js'],
dest: 'rx.modern.min.js'
},
aggregates: {

@@ -209,2 +264,3 @@ src: ['<banner>', 'rx.aggregates.js'],

'concat:basic',
'concat:modern',
'concat:aggregates',

@@ -219,2 +275,3 @@ 'concat:binding',

'uglify:basic',
'uglify:modern',
'uglify:aggregates',

@@ -221,0 +278,0 @@ 'uglify:binding',

2

package.json

@@ -5,3 +5,3 @@ {

"description": "Library for composing asynchronous and event-based operations in JavaScript",
"version": "2.1.0",
"version": "2.1.1",
"homepage": "http://rx.codeplex.com",

@@ -8,0 +8,0 @@ "author": {

@@ -18,9 +18,9 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.

}
}(this, function (global, exp, root, undefined) {
}(this, function (global, exp, Rx, undefined) {
// References
var Observable = root.Observable,
var Observable = Rx.Observable,
observableProto = Observable.prototype,
CompositeDisposable = root.CompositeDisposable,
AnonymousObservable = root.Internals.AnonymousObservable;
CompositeDisposable = Rx.CompositeDisposable,
AnonymousObservable = Rx.Internals.AnonymousObservable;

@@ -86,4 +86,2 @@ // Defaults

// Aggregation methods
/**

@@ -93,8 +91,9 @@ * Applies an accumulator function over an observable sequence, returning the result of the aggregation as a single element in the result sequence. The specified seed value is used as the initial accumulator value.

*
* @example
* 1 - res = source.aggregate(function (acc, x) { return acc + x; });
* 2 - res = source.aggregate(0, function (acc, x) { return acc + x; });
* @param [seed] The initial accumulator value.
* @param accumulator An accumulator function to be invoked on each element.
* @return An observable sequence containing a single element with the final accumulator value.
* @memberOf Observable#
* @param {Mixed} [seed] The initial accumulator value.
* @param {Function} accumulator An accumulator function to be invoked on each element.
* @returns {Observable} An observable sequence containing a single element with the final accumulator value.
*/

@@ -113,2 +112,14 @@ observableProto.aggregate = function () {

/**
* Applies an accumulator function over an observable sequence, returning the result of the aggregation as a single element in the result sequence. The specified seed value is used as the initial accumulator value.
* For aggregation behavior with incremental intermediate results, see Observable.scan.
*
* @example
* 1 - res = source.reduce(function (acc, x) { return acc + x; });
* 2 - res = source.reduce(function (acc, x) { return acc + x; }, 0);
* @memberOf Observable#
* @param {Mixed} [seed] The initial accumulator value.
* @param {Function} accumulator An accumulator function to be invoked on each element.
* @returns {Observable} An observable sequence containing a single element with the final accumulator value.
*/
observableProto.reduce = function () {

@@ -128,10 +139,10 @@ var seed, hasSeed, accumulator = arguments[0];

* 2 - source.any(function (x) { return x > 3; });
*
* @memberOf Observable#
* @param {Function} [predicate] A function to test each element for a condition.
* @return An observable sequence containing a single element determining whether any elements in the source sequence pass the test in the specified predicate if given, else if any items are in the sequence.
* @returns {Observable} An observable sequence containing a single element determining whether any elements in the source sequence pass the test in the specified predicate if given, else if any items are in the sequence.
*/
observableProto.any = observableProto.some = function (predicate) {
observableProto.any = function (predicate, thisArg) {
var source = this;
return predicate
? source.where(predicate).any()
? source.where(predicate, thisArg).any()
: new AnonymousObservable(function (observer) {

@@ -147,7 +158,9 @@ return source.subscribe(function () {

};
observableProto.some = observableProto.any;
/**
* Determines whether an observable sequence is empty.
*
* @return An observable sequence containing a single element determining whether the source sequence is empty.
*
* @memberOf Observable#
* @returns {Observable} An observable sequence containing a single element determining whether the source sequence is empty.
*/

@@ -162,13 +175,15 @@ observableProto.isEmpty = function () {

* 1 - res = source.all(function (value) { return value.length > 3; });
*
* @memberOf Observable#
* @param {Function} [predicate] A function to test each element for a condition.
* @return An observable sequence containing a single element determining whether all elements in the source sequence pass the test in the specified predicate.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence containing a single element determining whether all elements in the source sequence pass the test in the specified predicate.
*/
observableProto.all = observableProto.every = function (predicate) {
observableProto.all = function (predicate, thisArg) {
return this.where(function (v) {
return !predicate(v);
}).any().select(function (b) {
}, thisArg).any().select(function (b) {
return !b;
});
};
observableProto.every = observableProto.all;

@@ -180,6 +195,6 @@ /**

* 2 - res = source.contains({ value: 42 }, function (x, y) { return x.value === y.value; });
*
* @memberOf Observable#
* @param value The value to locate in the source sequence.</param>
* @param {Function} [comparer] An equality comparer to compare elements.
* @return An observable sequence containing a single element determining whether the source sequence contains an element that has the specified value.
* @returns {Observable} An observable sequence containing a single element determining whether the source sequence contains an element that has the specified value.
*/

@@ -198,5 +213,5 @@ observableProto.contains = function (value, comparer) {

* 2 - res = source.count(function (x) { return x > 3; });
*
* @memberOf Observable#
* @param {Function} [predicate]A function to test each element for a condition.
* @return 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.
* @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.
*/

@@ -216,5 +231,5 @@ observableProto.count = function (predicate) {

* 2 - res = source.sum(function (x) { return x.value; });
*
* @memberOf Observable#
* @param {Function} [selector]A transform function to apply to each element.
* @return An observable sequence containing a single element with the sum of the values in the source sequence.
* @returns {Observable} An observable sequence containing a single element with the sum of the values in the source sequence.
*/

@@ -234,6 +249,6 @@ observableProto.sum = function (keySelector) {

* 2 - source.minBy(function (x) { return x.value; }, function (x, y) { return x - y; });
*
* @memberOf Observable#
* @param {Function} keySelector Key selector function.</param>
* @param {Function} [comparer] Comparer used to compare key values.</param>
* @return An observable sequence containing a list of zero or more elements that have a minimum key value.
* @returns {Observable} An observable sequence containing a list of zero or more elements that have a minimum key value.
*/

@@ -252,5 +267,5 @@ observableProto.minBy = function (keySelector, comparer) {

* 2 - source.min(function (x, y) { return x.value - y.value; });
*
* @memberOf Observable#
* @param {Function} [comparer] Comparer used to compare elements.
* @return An observable sequence containing a single element with the minimum element in the source sequence.
* @returns {Observable} An observable sequence containing a single element with the minimum element in the source sequence.
*/

@@ -266,8 +281,9 @@ observableProto.min = function (comparer) {

*
* @example
* 1 - source.maxBy(function (x) { return x.value; });
* 2 - source.maxBy(function (x) { return x.value; }, function (x, y) { return x - y;; });
*
* @memberOf Observable#
* @param {Function} keySelector Key selector function.
* @param {Function} [comparer] Comparer used to compare key values.
* @return An observable sequence containing a list of zero or more elements that have a maximum key value.
* @returns {Observable} An observable sequence containing a list of zero or more elements that have a maximum key value.
*/

@@ -279,11 +295,12 @@ observableProto.maxBy = function (keySelector, comparer) {

/**
* Returns the maximum value in an observable sequence according to the specified comparer.
*
* 1 - source.max();
* 2 - source.max(function (x, y) { return x.value - y.value; });
*
* @param {Function} [comparer] Comparer used to compare elements.
* @return An observable sequence containing a single element with the maximum element in the source sequence.
*/
/**
* Returns the maximum value in an observable sequence according to the specified comparer.
*
* @example
* 1 - source.max();
* 2 - source.max(function (x, y) { return x.value - y.value; });
* @memberOf Observable#
* @param {Function} [comparer] Comparer used to compare elements.
* @returns {Observable} An observable sequence containing a single element with the maximum element in the source sequence.
*/
observableProto.max = function (comparer) {

@@ -298,7 +315,8 @@ return this.maxBy(identity, comparer).select(function (x) {

*
* @example
* 1 - res = source.average();
* 2 - res = source.average(function (x) { return x.value; });
*
* @memberOf Observable#
* @param {Function} [selector] A transform function to apply to each element.
* @return An observable sequence containing a single element with the average of the sequence of values.
* @returns {Observable} An observable sequence containing a single element with the average of the sequence of values.
*/

@@ -348,2 +366,3 @@ observableProto.average = function (keySelector) {

*
* @example
* 1 - res = source.sequenceEqual([1,2,3]);

@@ -353,6 +372,6 @@ * 2 - res = source.sequenceEqual([{ value: 42 }], function (x, y) { return x.value === y.value; });

* 4 - res = source.sequenceEqual(Rx.Observable.returnValue({ value: 42 }), function (x, y) { return x.value === y.value; });
*
* @param second Second observable sequence or array to compare.
* @memberOf Observable#
* @param {Observable} second Second observable sequence or array to compare.
* @param {Function} [comparer] Comparer used to compare elements of both sequences.
* @return An observable sequence that contains a single element which indicates whether both sequences are of equal length and their corresponding elements are equal according to the specified equality comparer.
* @returns {Observable} An observable sequence that contains a single element which indicates whether both sequences are of equal length and their corresponding elements are equal according to the specified equality comparer.
*/

@@ -461,6 +480,7 @@ observableProto.sequenceEqual = function (second, comparer) {

*
* @example
* source.elementAt(5);
*
* @memberOf Observable#
* @param {Number} index The zero-based index of the element to retrieve.
* @return An observable sequence that produces the element at the specified position in the source sequence.
* @returns {Observable} An observable sequence that produces the element at the specified position in the source sequence.
*/

@@ -474,8 +494,9 @@ observableProto.elementAt = function (index) {

*
* @example
* source.elementAtOrDefault(5);
* source.elementAtOrDefault(5, 0);
*
* @memberOf Observable#
* @param {Number} index The zero-based index of the element to retrieve.
* @param [defaultValue] The default value if the index is outside the bounds of the source sequence.
* @return An observable sequence that produces the element at the specified position in the source sequence, or a default value if the index is outside the bounds of the source sequence.
* @returns {Observable} An observable sequence that produces the element at the specified position in the source sequence, or a default value if the index is outside the bounds of the source sequence.
*/

@@ -510,7 +531,8 @@ observableProto.elementAtOrDefault = function (index, defaultValue) {

*
* @example
* 1 - res = source.single();
* 2 - res = source.single(function (x) { return x === 42; });
*
* @memberOf Observable#
* @param {Function} [predicate] A predicate function to evaluate for elements in the source sequence.
* @return Sequence containing the single element in the observable sequence that satisfies the condition in the predicate.
* @returns {Observable} Sequence containing the single element in the observable sequence that satisfies the condition in the predicate.
*/

@@ -527,2 +549,3 @@ observableProto.single = function (predicate) {

*
* @example
* 1 - res = source.singleOrDefault();

@@ -532,6 +555,6 @@ * 2 - res = source.singleOrDefault(function (x) { return x === 42; });

* 4 - res = source.singleOrDefault(null, 0);
*
* @memberOf Observable#
* @param {Function} predicate A predicate function to evaluate for elements in the source sequence.
* @param [defaultValue] The default value if the index is outside the bounds of the source sequence.
* @return 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.
* @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.
*/

@@ -564,7 +587,8 @@ observableProto.singleOrDefault = function (predicate, defaultValue) {

*
* @example
* 1 - res = source.first();
* 2 - res = source.first(function (x) { return x > 3; });
*
* @memberOf Observable#
* @param {Function} [predicate] A predicate function to evaluate for elements in the source sequence.
* @return 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.
* @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.
*/

@@ -580,2 +604,4 @@ observableProto.first = function (predicate) {

* Returns the first element of an observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.
*
* @example
* 1 - res = source.firstOrDefault();

@@ -585,6 +611,6 @@ * 2 - res = source.firstOrDefault(function (x) { return x > 3; });

* 4 - res = source.firstOrDefault(null, 0);
*
* @memberOf Observable#
* @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.
* @return 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.
* @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.
*/

@@ -618,7 +644,8 @@ observableProto.firstOrDefault = function (predicate, defaultValue) {

*
* @example
* 1 - res = source.last();
* 2 - res = source.last(function (x) { return x > 3; });
*
* @memberOf Observable#
* @param {Function} [predicate] A predicate function to evaluate for elements in the source sequence.
* @return Sequence containing the last element in the observable sequence that satisfies the condition in the predicate.
* @returns {Observable} Sequence containing the last element in the observable sequence that satisfies the condition in the predicate.
*/

@@ -635,2 +662,3 @@ observableProto.last = function (predicate) {

*
* @example
* 1 - res = source.lastOrDefault();

@@ -640,6 +668,6 @@ * 2 - res = source.lastOrDefault(function (x) { return x > 3; });

* 4 - res = source.lastOrDefault(null, 0);
*
* @memberOf Observable#
* @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.
* @return 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.
* @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.
*/

@@ -653,3 +681,41 @@ observableProto.lastOrDefault = function (predicate, defaultValue) {

return root;
function findValue (source, predicate, thisArg, yieldIndex) {
return new AnonymousObservable(function (observer) {
return source.subscribe(function (x) {
if (predicate.call(thisArg, x, i, source)) {
observer.onNext(yieldIndex ? i : x);
observer.onCompleted();
} else {
i++;
}
}, observer.onError.bind(observer), function () {
observer.onNext(yieldIndex ? -1 : undefined);
observer.onCompleted();
});
});
}
/**
* Searches for an element that matches the conditions defined by the specified predicate, and returns the first occurrence within the entire Observable sequence.
*
* @memberOf Observable#
* @param {Function} predicate The predicate that defines the conditions of the element to search for.
* @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);
};
/**
* Searches for an element that matches the conditions defined by the specified predicate, and returns
* an Observable sequence with the zero-based index of the first occurrence within the entire Observable sequence.
*
* @memberOf Observable#
* @param {Function} predicate The predicate that defines the conditions of the element to search for.
* @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);
};
return Rx;
}));

@@ -1,1 +0,1 @@

(function(t,e){var n="object"==typeof exports&&exports&&("object"==typeof t&&t&&t==t.global&&(window=t),exports);"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 t===e}function i(t){return t}function o(t,e){return t>e?1:t===e?0:-1}function s(t,e,n){return new v(function(r){var i=!1,o=null,s=[];return t.subscribe(function(t){var u,c;try{c=e(t)}catch(a){return r.onError(a),undefined}if(u=0,i)try{u=n(c,o)}catch(h){return r.onError(h),undefined}else i=!0,o=c;u>0&&(o=c,s=[]),u>=0&&s.push(t)},r.onError.bind(r),function(){r.onNext(s),r.onCompleted()})})}function u(t){if(0==t.length)throw Error(y);return t[0]}function c(t,e,n){return new v(function(r){var i=0,o=e.length;return t.subscribe(function(t){var s=!1;try{o>i&&(s=n(t,e[i++]))}catch(u){return r.onError(u),undefined}s||(r.onNext(!1),r.onCompleted())},r.onError.bind(r),function(){r.onNext(i===o),r.onCompleted()})})}function a(t,e,n,r){if(0>e)throw Error(m);return new v(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(m))})})}function h(t,e,n){return new v(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(y))})})}function l(t,e,n){return new v(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(y))})})}function f(t,e,n){return new v(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(y))})})}var p=n.Observable,d=p.prototype,b=n.CompositeDisposable,v=n.Internals.AnonymousObservable,m="Argument out of range",y="Sequence contains no elements.";return d.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()},d.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()},d.any=d.some=function(t){var e=this;return t?e.where(t).any():new v(function(t){return e.subscribe(function(){t.onNext(!0),t.onCompleted()},t.onError.bind(t),function(){t.onNext(!1),t.onCompleted()})})},d.isEmpty=function(){return this.any().select(function(t){return!t})},d.all=d.every=function(t){return this.where(function(e){return!t(e)}).any().select(function(t){return!t})},d.contains=function(t,e){return e||(e=r),this.where(function(n){return e(n,t)}).any()},d.count=function(t){return t?this.where(t).count():this.aggregate(0,function(t){return t+1})},d.sum=function(t){return t?this.select(t).sum():this.aggregate(0,function(t,e){return t+e})},d.minBy=function(t,e){return e||(e=o),s(this,t,function(t,n){return-1*e(t,n)})},d.min=function(t){return this.minBy(i,t).select(function(t){return u(t)})},d.maxBy=function(t,e){return e||(e=o),s(this,t,e)},d.max=function(t){return this.maxBy(i,t).select(function(t){return u(t)})},d.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})},d.sequenceEqual=function(t,e){var n=this;return e||(e=r),Array.isArray(t)?c(n,t,e):new v(function(r){var i=!1,o=!1,s=[],u=[],c=n.subscribe(function(t){var n,i;if(u.length>0){i=u.shift();try{n=e(i,t)}catch(c){return r.onError(c),undefined}n||(r.onNext(!1),r.onCompleted())}else o?(r.onNext(!1),r.onCompleted()):s.push(t)},r.onError.bind(r),function(){i=!0,0===s.length&&(u.length>0?(r.onNext(!1),r.onCompleted()):o&&(r.onNext(!0),r.onCompleted()))}),a=t.subscribe(function(t){var n,o;if(s.length>0){o=s.shift();try{n=e(o,t)}catch(c){return r.onError(c),undefined}n||(r.onNext(!1),r.onCompleted())}else i?(r.onNext(!1),r.onCompleted()):u.push(t)},r.onError.bind(r),function(){o=!0,0===u.length&&(s.length>0?(r.onNext(!1),r.onCompleted()):i&&(r.onNext(!0),r.onCompleted()))});return new b(c,a)})},d.elementAt=function(t){return a(this,t,!1)},d.elementAtOrDefault=function(t,e){return a(this,t,!0,e)},d.single=function(t){return t?this.where(t).single():h(this,!1)},d.singleOrDefault=function(t,e){return t?this.where(t).singleOrDefault(null,e):h(this,!0,e)},d.first=function(t){return t?this.where(t).first():l(this,!1)},d.firstOrDefault=function(t,e){return t?this.where(t).firstOrDefault(null,e):l(this,!0,e)},d.last=function(t){return t?this.where(t).last():f(this,!1)},d.lastOrDefault=function(t,e){return t?this.where(t).lastOrDefault(null,e):f(this,!0,e)},n});
(function(t,e){var n="object"==typeof exports&&exports&&("object"==typeof t&&t&&t==t.global&&(window=t),exports);"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 o(t,e){return t===e}function s(t){return t}function u(t,e){return t>e?1:t===e?0:-1}function c(t,e,n){return new w(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 a(t){if(0==t.length)throw Error(E);return t[0]}function h(t,e,n){return new w(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 l(t,e,n,r){if(0>e)throw Error(g);return new w(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 f(t,e,n){return new w(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 p(t,e,n){return new w(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 d(t,e,n){return new w(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 b(t,e,n,o){return new w(function(s){return t.subscribe(function(r){e.call(n,r,i,t)?(s.onNext(o?i:r),s.onCompleted()):i++},s.onError.bind(s),function(){s.onNext(o?-1:r),s.onCompleted()})})}var v=n.Observable,m=v.prototype,y=n.CompositeDisposable,w=n.Internals.AnonymousObservable,g="Argument out of range",E="Sequence contains no elements.";return m.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()},m.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()},m.any=function(t,e){var n=this;return t?n.where(t,e).any():new w(function(t){return n.subscribe(function(){t.onNext(!0),t.onCompleted()},t.onError.bind(t),function(){t.onNext(!1),t.onCompleted()})})},m.some=m.any,m.isEmpty=function(){return this.any().select(function(t){return!t})},m.all=function(t,e){return this.where(function(e){return!t(e)},e).any().select(function(t){return!t})},m.every=m.all,m.contains=function(t,e){return e||(e=o),this.where(function(n){return e(n,t)}).any()},m.count=function(t){return t?this.where(t).count():this.aggregate(0,function(t){return t+1})},m.sum=function(t){return t?this.select(t).sum():this.aggregate(0,function(t,e){return t+e})},m.minBy=function(t,e){return e||(e=u),c(this,t,function(t,n){return-1*e(t,n)})},m.min=function(t){return this.minBy(s,t).select(function(t){return a(t)})},m.maxBy=function(t,e){return e||(e=u),c(this,t,e)},m.max=function(t){return this.maxBy(s,t).select(function(t){return a(t)})},m.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})},m.sequenceEqual=function(t,e){var n=this;return e||(e=o),Array.isArray(t)?h(n,t,e):new w(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 y(a,h)})},m.elementAt=function(t){return l(this,t,!1)},m.elementAtOrDefault=function(t,e){return l(this,t,!0,e)},m.single=function(t){return t?this.where(t).single():f(this,!1)},m.singleOrDefault=function(t,e){return t?this.where(t).singleOrDefault(null,e):f(this,!0,e)},m.first=function(t){return t?this.where(t).first():p(this,!1)},m.firstOrDefault=function(t,e){return t?this.where(t).firstOrDefault(null,e):p(this,!0,e)},m.last=function(t){return t?this.where(t).last():d(this,!1)},m.lastOrDefault=function(t,e){return t?this.where(t).lastOrDefault(null,e):d(this,!0,e)},m.find=function(t){return b(this,t,arguments[1],!1)},m.findIndex=function(t){return b(this,t,arguments[1],!0)},n});

@@ -18,17 +18,17 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.

}
}(this, function (global, exp, root, undefined) {
}(this, function (global, exp, Rx, undefined) {
var Observable = root.Observable,
var Observable = Rx.Observable,
observableProto = Observable.prototype,
AnonymousObservable = root.Internals.AnonymousObservable,
Subject = root.Subject,
AsyncSubject = root.AsyncSubject,
Observer = root.Observer,
ScheduledObserver = root.Internals.ScheduledObserver,
disposableCreate = root.Disposable.create,
disposableEmpty = root.Disposable.empty,
CompositeDisposable = root.CompositeDisposable,
currentThreadScheduler = root.Scheduler.currentThread,
inherits = root.Internals.inherits,
addProperties = root.Internals.addProperties;
AnonymousObservable = Rx.Internals.AnonymousObservable,
Subject = Rx.Subject,
AsyncSubject = Rx.AsyncSubject,
Observer = Rx.Observer,
ScheduledObserver = Rx.Internals.ScheduledObserver,
disposableCreate = Rx.Disposable.create,
disposableEmpty = Rx.Disposable.empty,
CompositeDisposable = Rx.CompositeDisposable,
currentThreadScheduler = Rx.Scheduler.currentThread,
inherits = Rx.Internals.inherits,
addProperties = Rx.Internals.addProperties;

@@ -48,6 +48,7 @@ // Utilities

*
* @example
* 1 - res = source.multicast(observable);
* 2 - res = source.multicast(function () { return new Subject(); }, function (x) { return x; });
*
* @param subjectOrSubjectSelector
* @param {Mixed} subjectOrSubjectSelector
* Factory function to create an intermediate subject through which the source sequence's elements will be multicast to the selector function.

@@ -57,4 +58,4 @@ * Or:

*
* @param selector [Optional] Selector function which can use the multicasted source sequence subject to the policies enforced by the created subject. Specified only if <paramref name="subjectOrSubjectSelector" is a factory function.
* @return An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
* @param {Function} [selector] Optional selector function which can use the multicasted source sequence subject to the policies enforced by the created subject. Specified only if <paramref name="subjectOrSubjectSelector" is a factory function.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/

@@ -75,7 +76,8 @@ observableProto.multicast = function (subjectOrSubjectSelector, selector) {

*
* @example
* 1 - res = source.publish();
* 2 - res = source.publish(function (x) { return x; });
*
* @param selector [Optional] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all notifications of the source from the time of the subscription on.
* @return An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
* @param {Function} [selector] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all notifications of the source from the time of the subscription on.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/

@@ -94,2 +96,3 @@ observableProto.publish = function (selector) {

*
* @example
* 1 - res = source.publishLast();

@@ -99,3 +102,3 @@ * 2 - res = source.publishLast(function (x) { return x; });

* @param selector [Optional] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will only receive the last notification of the source.
* @return An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/

@@ -114,8 +117,9 @@ observableProto.publishLast = function (selector) {

*
* @example
* 1 - res = source.publishValue(42);
* 2 - res = source.publishLast(function (x) { return x.select(function (y) { return y * y; }) }, 42);
*
* @param selector [Optional] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive immediately receive the initial value, followed by all notifications of the source from the time of the subscription on.
* @param initialValue Initial value received by observers upon subscription.
* @return An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
* @param {Function} [selector] Optional selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive immediately receive the initial value, followed by all notifications of the source from the time of the subscription on.
* @param {Mixed} initialValue Initial value received by observers upon subscription.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/

@@ -134,2 +138,3 @@ observableProto.publishValue = function (initialValueOrSelector, initialValue) {

*
* @example
* 1 - res = source.replay(null, 3);

@@ -144,3 +149,3 @@ * 2 - res = source.replay(null, 3, 500);

* @param scheduler [Optional] Scheduler where connected observers within the selector function will be invoked on.
* @return An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/

@@ -155,2 +160,3 @@ observableProto.replay = function (selector, bufferSize, window, scheduler) {

/** @private */
var InnerSubscription = function (subject, observer) {

@@ -160,2 +166,7 @@ this.subject = subject;

};
/**
* @private
* @memberOf InnerSubscription
*/
InnerSubscription.prototype.dispose = function () {

@@ -173,3 +184,3 @@ if (!this.subject.isDisposed && this.observer !== null) {

*/
var BehaviorSubject = root.BehaviorSubject = (function () {
var BehaviorSubject = Rx.BehaviorSubject = (function (_super) {
function subscribe(observer) {

@@ -192,3 +203,3 @@ var ex;

inherits(BehaviorSubject, Observable);
inherits(BehaviorSubject, _super);

@@ -201,3 +212,3 @@ /**

function BehaviorSubject(value) {
BehaviorSubject.super_.constructor.call(this, subscribe);
_super.call(this, subscribe);

@@ -212,2 +223,16 @@ this.value = value,

addProperties(BehaviorSubject.prototype, Observer, {
/**
* Indicates whether the subject has observers subscribed to it.
*
* @memberOf BehaviorSubject#
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () {
return this.observers.length > 0;
},
/**
* Notifies all subscribed observers about the end of the sequence.
*
* @memberOf BehaviorSubject#
*/
onCompleted: function () {

@@ -225,2 +250,8 @@ checkDisposed.call(this);

},
/**
* Notifies all subscribed observers about the exception.
*
* @memberOf BehaviorSubject#
* @param {Mixed} error The exception to send to all observers.
*/
onError: function (error) {

@@ -240,2 +271,8 @@ checkDisposed.call(this);

},
/**
* Notifies all subscribed observers about the arrival of the specified element in the sequence.
*
* @memberOf BehaviorSubject#
* @param {Mixed} value The value to send to all observers.
*/
onNext: function (value) {

@@ -251,2 +288,7 @@ checkDisposed.call(this);

},
/**
* Unsubscribe all observers and release resources.
*
* @memberOf BehaviorSubject#
*/
dispose: function () {

@@ -261,5 +303,4 @@ this.isDisposed = true;

return BehaviorSubject;
}());
}(Observable));
// Replay Subject
/**

@@ -269,3 +310,7 @@ * Represents an object that is both an observable sequence as well as an observer.

*/
var ReplaySubject = root.ReplaySubject = (function (base) {
var ReplaySubject = Rx.ReplaySubject = (function (_super) {
/**
* @private
* @constructor
*/
var RemovableDisposable = function (subject, observer) {

@@ -276,2 +321,6 @@ this.subject = subject;

/*
* @private
* @memberOf RemovableDisposable#
*/
RemovableDisposable.prototype.dispose = function () {

@@ -310,3 +359,3 @@ this.observer.dispose();

inherits(ReplaySubject, Observable);
inherits(ReplaySubject, _super);

@@ -318,3 +367,3 @@ /**

* @param {Number} [window] Maximum time length of the replay buffer.
* @param [scheduler] Scheduler the observers are invoked on.
* @param {Scheduler} [scheduler] Scheduler the observers are invoked on.
*/

@@ -331,6 +380,19 @@ function ReplaySubject(bufferSize, window, scheduler) {

this.error = null;
ReplaySubject.super_.constructor.call(this, subscribe);
_super.call(this, subscribe);
}
addProperties(ReplaySubject.prototype, Observer, {
/**
* Indicates whether the subject has observers subscribed to it.
*
* @memberOf ReplaySubject#
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () {
return this.observers.length > 0;
},
/*
* @private
* @memberOf ReplaySubject#
*/
_trim: function (now) {

@@ -344,2 +406,8 @@ while (this.q.length > this.bufferSize) {

},
/**
* Notifies all subscribed observers about the arrival of the specified element in the sequence.
*
* @memberOf ReplaySubject#
* @param {Mixed} value The value to send to all observers.
*/
onNext: function (value) {

@@ -361,2 +429,8 @@ var observer;

},
/**
* Notifies all subscribed observers about the exception.
*
* @memberOf ReplaySubject#
* @param {Mixed} error The exception to send to all observers.
*/
onError: function (error) {

@@ -380,2 +454,7 @@ var observer;

},
/**
* Notifies all subscribed observers about the end of the sequence.
*
* @memberOf ReplaySubject#
*/
onCompleted: function () {

@@ -397,2 +476,7 @@ var observer;

},
/**
* Unsubscribe all observers and release resources.
*
* @memberOf ReplaySubject#
*/
dispose: function () {

@@ -405,6 +489,12 @@ this.isDisposed = true;

return ReplaySubject;
}());
}(Observable));
var ConnectableObservable = (function () {
inherits(ConnectableObservable, Observable);
/** @private */
var ConnectableObservable = (function (_super) {
inherits(ConnectableObservable, _super);
/**
* @constructor
* @private
*/
function ConnectableObservable(source, subject) {

@@ -428,13 +518,21 @@ var state = {

var subscribe = function (observer) {
function subscribe(observer) {
return state.subject.subscribe(observer);
};
ConnectableObservable.super_.constructor.call(this, subscribe);
}
_super.call(this, subscribe);
}
/**
* @private
* @memberOf ConnectableObservable
*/
ConnectableObservable.prototype.connect = function () { return this.connect(); };
/**
* @private
* @memberOf ConnectableObservable
*/
ConnectableObservable.prototype.refCount = function () {
var connectableSubscription = null,
count = 0,
source = this;
var connectableSubscription = null, count = 0, source = this;
return new AnonymousObservable(function (observer) {

@@ -459,5 +557,5 @@ var shouldConnect, subscription;

return ConnectableObservable;
}());
}(Observable));
return root;
return Rx;
}));

@@ -1,1 +0,1 @@

(function(t,e){var n="object"==typeof exports&&exports&&("object"==typeof t&&t&&t==t.global&&(window=t),exports);"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(){if(this.isDisposed)throw Error(m)}var i=n.Observable,o=i.prototype,s=n.Internals.AnonymousObservable,u=n.Subject,c=n.AsyncSubject,a=n.Observer,h=n.Internals.ScheduledObserver,l=n.Disposable.create,f=n.Disposable.empty,p=n.CompositeDisposable,d=n.Scheduler.currentThread,b=n.Internals.inherits,v=n.Internals.addProperties,m="Object has been disposed";o.multicast=function(t,e){var n=this;return"function"==typeof t?new s(function(r){var i=n.multicast(t());return new p(e(i).subscribe(r),i.connect())}):new E(n,t)},o.publish=function(t){return t?this.multicast(function(){return new u},t):this.multicast(new u)},o.publishLast=function(t){return t?this.multicast(function(){return new c},t):this.multicast(new c)},o.publishValue=function(t,e){return 2===arguments.length?this.multicast(function(){return new w(e)},t):this.multicast(new w(t))},o.replay=function(t,e,n,r){return t?this.multicast(function(){return new g(e,n,r)},t):this.multicast(new g(e,n,r))};var y=function(t,e){this.subject=t,this.observer=e};y.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 w=n.BehaviorSubject=function(){function t(t){var e;return r.call(this),this.isStopped?(e=this.exception,e?t.onError(e):t.onCompleted(),f):(this.observers.push(t),t.onNext(this.value),new y(this,t))}function e(n){e.super_.constructor.call(this,t),this.value=n,this.observers=[],this.isDisposed=!1,this.isStopped=!1,this.exception=null}return b(e,i),v(e.prototype,a,{onCompleted:function(){if(r.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(r.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,i=e.length;i>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){if(r.call(this),!this.isStopped){this.value=t;for(var e=this.observers.slice(0),n=0,i=e.length;i>n;n++)e[n].onNext(t)}},dispose:function(){this.isDisposed=!0,this.observers=null,this.value=null,this.exception=null}}),e}(),g=n.ReplaySubject=function(){function t(t){var e=new h(this.scheduler,t),i=new n(this,e);r.call(this),this._trim(this.scheduler.now()),this.observers.push(e);for(var o=this.q.length,s=0,u=this.q.length;u>s;s++)e.onNext(this.q[s].value);return this.hasError?(o++,e.onError(this.error)):this.isStopped&&(o++,e.onCompleted()),e.ensureActive(o),i}function e(n,r,i){this.bufferSize=null==n?Number.MAX_VALUE:n,this.window=null==r?Number.MAX_VALUE:r,this.scheduler=i||d,this.q=[],this.observers=[],this.isStopped=!1,this.isDisposed=!1,this.hasError=!1,this.error=null,e.super_.constructor.call(this,t)}var n=function(t,e){this.subject=t,this.observer=e};return n.prototype.dispose=function(){if(this.observer.dispose(),!this.subject.isDisposed){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1)}},b(e,i),v(e.prototype,a,{_trim:function(t){for(;this.q.length>this.bufferSize;)this.q.shift();for(;this.q.length>0&&t-this.q[0].interval>this.window;)this.q.shift()},onNext:function(t){var e;if(r.call(this),!this.isStopped){var n=this.scheduler.now();this.q.push({interval:n,value:t}),this._trim(n);for(var i=this.observers.slice(0),o=0,s=i.length;s>o;o++)e=i[o],e.onNext(t),e.ensureActive()}},onError:function(t){var e;if(r.call(this),!this.isStopped){this.isStopped=!0,this.error=t,this.hasError=!0;var n=this.scheduler.now();this._trim(n);for(var i=this.observers.slice(0),o=0,s=i.length;s>o;o++)e=i[o],e.onError(t),e.ensureActive();this.observers=[]}},onCompleted:function(){var t;if(r.call(this),!this.isStopped){this.isStopped=!0;var e=this.scheduler.now();this._trim(e);for(var n=this.observers.slice(0),i=0,o=n.length;o>i;i++)t=n[i],t.onCompleted(),t.ensureActive();this.observers=[]}},dispose:function(){this.isDisposed=!0,this.observers=null}}),e}(),E=function(){function t(e,n){var r={subject:n,source:e.asObservable(),hasSubscription:!1,subscription:null};this.connect=function(){return r.hasSubscription||(r.hasSubscription=!0,r.subscription=new p(r.source.subscribe(r.subject),l(function(){r.hasSubscription=!1}))),r.subscription};var i=function(t){return r.subject.subscribe(t)};t.super_.constructor.call(this,i)}return b(t,i),t.prototype.connect=function(){return this.connect()},t.prototype.refCount=function(){var t=null,e=0,n=this;return new s(function(r){var i,o;return e++,i=1===e,o=n.subscribe(r),i&&(t=n.connect()),l(function(){o.dispose(),e--,0===e&&t.dispose()})})},t}();return n});
(function(t,e){var n="object"==typeof exports&&exports&&("object"==typeof t&&t&&t==t.global&&(window=t),exports);"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(){if(this.isDisposed)throw Error(m)}var i=n.Observable,o=i.prototype,s=n.Internals.AnonymousObservable,u=n.Subject,c=n.AsyncSubject,a=n.Observer,h=n.Internals.ScheduledObserver,l=n.Disposable.create,f=n.Disposable.empty,p=n.CompositeDisposable,d=n.Scheduler.currentThread,b=n.Internals.inherits,v=n.Internals.addProperties,m="Object has been disposed";o.multicast=function(t,e){var n=this;return"function"==typeof t?new s(function(r){var i=n.multicast(t());return new p(e(i).subscribe(r),i.connect())}):new E(n,t)},o.publish=function(t){return t?this.multicast(function(){return new u},t):this.multicast(new u)},o.publishLast=function(t){return t?this.multicast(function(){return new c},t):this.multicast(new c)},o.publishValue=function(t,e){return 2===arguments.length?this.multicast(function(){return new w(e)},t):this.multicast(new w(t))},o.replay=function(t,e,n,r){return t?this.multicast(function(){return new g(e,n,r)},t):this.multicast(new g(e,n,r))};var y=function(t,e){this.subject=t,this.observer=e};y.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 w=n.BehaviorSubject=function(t){function e(t){var e;return r.call(this),this.isStopped?(e=this.exception,e?t.onError(e):t.onCompleted(),f):(this.observers.push(t),t.onNext(this.value),new y(this,t))}function n(n){t.call(this,e),this.value=n,this.observers=[],this.isDisposed=!1,this.isStopped=!1,this.exception=null}return b(n,t),v(n.prototype,a,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(r.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(r.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,i=e.length;i>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){if(r.call(this),!this.isStopped){this.value=t;for(var e=this.observers.slice(0),n=0,i=e.length;i>n;n++)e[n].onNext(t)}},dispose:function(){this.isDisposed=!0,this.observers=null,this.value=null,this.exception=null}}),n}(i),g=n.ReplaySubject=function(t){function e(t){var e=new h(this.scheduler,t),n=new i(this,e);r.call(this),this._trim(this.scheduler.now()),this.observers.push(e);for(var o=this.q.length,s=0,u=this.q.length;u>s;s++)e.onNext(this.q[s].value);return this.hasError?(o++,e.onError(this.error)):this.isStopped&&(o++,e.onCompleted()),e.ensureActive(o),n}function n(n,r,i){this.bufferSize=null==n?Number.MAX_VALUE:n,this.window=null==r?Number.MAX_VALUE:r,this.scheduler=i||d,this.q=[],this.observers=[],this.isStopped=!1,this.isDisposed=!1,this.hasError=!1,this.error=null,t.call(this,e)}var i=function(t,e){this.subject=t,this.observer=e};return i.prototype.dispose=function(){if(this.observer.dispose(),!this.subject.isDisposed){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1)}},b(n,t),v(n.prototype,a,{hasObservers:function(){return this.observers.length>0},_trim:function(t){for(;this.q.length>this.bufferSize;)this.q.shift();for(;this.q.length>0&&t-this.q[0].interval>this.window;)this.q.shift()},onNext:function(t){var e;if(r.call(this),!this.isStopped){var n=this.scheduler.now();this.q.push({interval:n,value:t}),this._trim(n);for(var i=this.observers.slice(0),o=0,s=i.length;s>o;o++)e=i[o],e.onNext(t),e.ensureActive()}},onError:function(t){var e;if(r.call(this),!this.isStopped){this.isStopped=!0,this.error=t,this.hasError=!0;var n=this.scheduler.now();this._trim(n);for(var i=this.observers.slice(0),o=0,s=i.length;s>o;o++)e=i[o],e.onError(t),e.ensureActive();this.observers=[]}},onCompleted:function(){var t;if(r.call(this),!this.isStopped){this.isStopped=!0;var e=this.scheduler.now();this._trim(e);for(var n=this.observers.slice(0),i=0,o=n.length;o>i;i++)t=n[i],t.onCompleted(),t.ensureActive();this.observers=[]}},dispose:function(){this.isDisposed=!0,this.observers=null}}),n}(i),E=function(t){function e(e,n){function r(t){return i.subject.subscribe(t)}var i={subject:n,source:e.asObservable(),hasSubscription:!1,subscription:null};this.connect=function(){return i.hasSubscription||(i.hasSubscription=!0,i.subscription=new p(i.source.subscribe(i.subject),l(function(){i.hasSubscription=!1}))),i.subscription},t.call(this,r)}return b(e,t),e.prototype.connect=function(){return this.connect()},e.prototype.refCount=function(){var t=null,e=0,n=this;return new s(function(r){var i,o;return e++,i=1===e,o=n.subscribe(r),i&&(t=n.connect()),l(function(){o.dispose(),e--,0===e&&t.dispose()})})},e}(i);return n});

@@ -18,15 +18,15 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.

}
}(this, function (global, exp, root, undefined) {
}(this, function (global, exp, Rx, undefined) {
var Observable = root.Observable,
CompositeDisposable = root.CompositeDisposable,
RefCountDisposable = root.RefCountDisposable,
SingleAssignmentDisposable = root.SingleAssignmentDisposable,
SerialDisposable = root.SerialDisposable,
Subject = root.Subject,
var Observable = Rx.Observable,
CompositeDisposable = Rx.CompositeDisposable,
RefCountDisposable = Rx.RefCountDisposable,
SingleAssignmentDisposable = Rx.SingleAssignmentDisposable,
SerialDisposable = Rx.SerialDisposable,
Subject = Rx.Subject,
observableProto = Observable.prototype,
observableEmpty = Observable.empty,
AnonymousObservable = root.Internals.AnonymousObservable,
observerCreate = root.Observer.create,
addRef = root.Internals.addRef;
AnonymousObservable = Rx.Internals.AnonymousObservable,
observerCreate = Rx.Observer.create,
addRef = Rx.Internals.addRef;

@@ -265,11 +265,10 @@ // defaults

// Joins
/**
* Correlates the elements of two sequences based on overlapping durations.
*
* @param right The right observable sequence to join elements for.
* @param leftDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the left observable sequence, used to determine overlap.
* @param rightDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the right observable sequence, used to determine overlap.
* @param resultSelector A function invoked to compute a result element for any two overlapping elements of the left and right observable sequences. The parameters passed to the function correspond with the elements from the left and right source sequences for which overlap occurs.
* @return An observable sequence that contains result elements computed from source elements that have an overlapping duration.
* @param {Observable} right The right observable sequence to join elements for.
* @param {Function} leftDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the left observable sequence, used to determine overlap.
* @param {Function} rightDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the right observable sequence, used to determine overlap.
* @param {Function} resultSelector A function invoked to compute a result element for any two overlapping elements of the left and right observable sequences. The parameters passed to the function correspond with the elements from the left and right source sequences for which overlap occurs.
* @returns {Observable} An observable sequence that contains result elements computed from source elements that have an overlapping duration.
*/

@@ -366,11 +365,10 @@ observableProto.join = function (right, leftDurationSelector, rightDurationSelector, resultSelector) {

// Group Join
/**
* Correlates the elements of two sequences based on overlapping durations, and groups the results.
*
* @param right The right observable sequence to join elements for.
* @param leftDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the left observable sequence, used to determine overlap.
* @param rightDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the right observable sequence, used to determine overlap.
* @param resultSelector A function invoked to compute a result element for any element of the left sequence with overlapping elements from the right observable sequence. The first parameter passed to the function is an element of the left sequence. The second parameter passed to the function is an observable sequence with elements from the right sequence that overlap with the left sequence's element.
* @return An observable sequence that contains result elements computed from source elements that have an overlapping duration.
* @param {Observable} right The right observable sequence to join elements for.
* @param {Function} leftDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the left observable sequence, used to determine overlap.
* @param {Function} rightDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the right observable sequence, used to determine overlap.
* @param {Function} resultSelector A function invoked to compute a result element for any element of the left sequence with overlapping elements from the right observable sequence. The first parameter passed to the function is an element of the left sequence. The second parameter passed to the function is an observable sequence with elements from the right sequence that overlap with the left sequence's element.
* @returns {Observable} An observable sequence that contains result elements computed from source elements that have an overlapping duration.
*/

@@ -494,5 +492,5 @@ observableProto.groupJoin = function (right, leftDurationSelector, rightDurationSelector, resultSelector) {

*
* @param bufferOpeningsOrClosingSelector Observable sequence whose elements denote the creation of new windows, or, a function invoked to define the boundaries of the produced windows (a new window is started when the previous one is closed, resulting in non-overlapping windows).
* @param [bufferClosingSelector] A function invoked to define the closing of each produced window. If a closing selector function is specified for the first parameter, this parameter is ignored.
* @return An observable sequence of windows.
* @param {Mixed} bufferOpeningsOrClosingSelector Observable sequence whose elements denote the creation of new windows, or, a function invoked to define the boundaries of the produced windows (a new window is started when the previous one is closed, resulting in non-overlapping windows).
* @param {Function} [bufferClosingSelector] A function invoked to define the closing of each produced window. If a closing selector function is specified for the first parameter, this parameter is ignored.
* @returns {Observable} An observable sequence of windows.
*/

@@ -517,5 +515,5 @@ observableProto.buffer = function (bufferOpeningsOrClosingSelector, bufferClosingSelector) {

*
* @param windowOpeningsOrClosingSelector Observable sequence whose elements denote the creation of new windows, or, a function invoked to define the boundaries of the produced windows (a new window is started when the previous one is closed, resulting in non-overlapping windows).
* @param [windowClosingSelector] A function invoked to define the closing of each produced window. If a closing selector function is specified for the first parameter, this parameter is ignored.
* @return An observable sequence of windows.
* @param {Mixed} windowOpeningsOrClosingSelector Observable sequence whose elements denote the creation of new windows, or, a function invoked to define the boundaries of the produced windows (a new window is started when the previous one is closed, resulting in non-overlapping windows).
* @param {Function} [windowClosingSelector] A function invoked to define the closing of each produced window. If a closing selector function is specified for the first parameter, this parameter is ignored.
* @returns {Observable} An observable sequence of windows.
*/

@@ -617,3 +615,3 @@ observableProto.window = function (windowOpeningsOrClosingSelector, windowClosingSelector) {

return root;
return Rx;
}));

@@ -1,1 +0,1 @@

(function(t,e){var n="object"==typeof exports&&exports&&("object"==typeof t&&t&&t==t.global&&(window=t),exports);"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){var e,n;if(false&t)return 2===t;for(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;x.length>e;++e)if(n=x[e],n>=t)return n;for(r=1|t;x[x.length-1]>r;){if(s(r))return r;r+=2}return t}function c(){return{key:null,value:null,next:0,hashCode:0}}function h(t,e){return t.groupJoin(this,e,function(){return w()},function(t,e){return e})}function a(t){var e=this;return new g(function(n){var r=new m,i=new p,o=new d(i);return n.onNext(E(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 m,n.onNext(E(r,o))},function(t){r.onError(t),n.onError(t)},function(){r.onCompleted(),n.onCompleted()})),o})}function l(t){var e=this;return new g(function(n){var o,s=new v,u=new p(s),c=new d(u),h=new m;return n.onNext(E(h,c)),u.add(e.subscribe(function(t){h.onNext(t)},function(t){h.onError(t),n.onError(t)},function(){h.onCompleted(),n.onCompleted()})),o=function(){var e,u;try{u=t()}catch(a){return n.onError(a),r}e=new b,s.disposable(e),e.disposable(u.take(1).subscribe(i,function(t){h.onError(t),n.onError(t)},function(){h.onCompleted(),h=new m,n.onNext(E(h,c)),o()}))},o(),c})}var f=n.Observable,p=n.CompositeDisposable,d=n.RefCountDisposable,b=n.SingleAssignmentDisposable,v=n.SerialDisposable,m=n.Subject,y=f.prototype,w=f.empty,g=n.Internals.AnonymousObservable,E=(n.Observer.create,n.Internals.addRef),x=[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],C="no such key",A="duplicate key",_=function(){var t=0;return function(e){var n;if(e===r)throw Error(C);return e.getHashCode!==r?e.getHashCode():(n=17*t++,e.getHashCode=function(){return n},n)}}(),D=function(t,e){this._initialize(t),this.comparer=e||o,this.freeCount=0,this.size=0,this.freeList=-1};return D.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]=c();this.freeList=-1},D.prototype.count=function(){return this.size},D.prototype.add=function(t,e){return this._insert(t,e,!0)},D.prototype._insert=function(t,e,n){this.buckets===r&&this._initialize(0);for(var i=2147483647&_(t),o=i%this.buckets.length,s=this.buckets[o];s>=0;s=this.entries[s].next)if(this.entries[s].hashCode===i&&this.comparer(this.entries[s].key,t)){if(n)throw A;return this.entries[s].value=e,r}if(this.freeCount>0){var u=this.freeList;this.freeList=this.entries[u].next,--this.freeCount}else this.size===this.entries.length&&(this._resize(),o=i%this.buckets.length),u=this.size,++this.size;this.entries[u].hashCode=i,this.entries[u].next=this.buckets[o],this.entries[u].key=t,this.entries[u].value=e,this.buckets[o]=u},D.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]=c();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},D.prototype.remove=function(t){if(this.buckets!==r)for(var e=2147483647&_(t),n=e%this.buckets.length,i=-1,o=this.buckets[n];o>=0;o=this.entries[o].next){if(this.entries[o].hashCode===e&&this.comparer(this.entries[o].key,t))return 0>i?this.buckets[n]=this.entries[o].next:this.entries[i].next=this.entries[o].next,this.entries[o].hashCode=-1,this.entries[o].next=this.freeList,this.entries[o].key=null,this.entries[o].value=null,this.freeList=o,++this.freeCount,!0;i=o}return!1},D.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]=c();this.freeList=-1,this.size=0}},D.prototype._findEntry=function(t){if(this.buckets!==r)for(var e=2147483647&_(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},D.prototype.count=function(){return this.size-this.freeCount},D.prototype.tryGetEntry=function(t){var e=this._findEntry(t);return e>=0?{key:this.entries[e].key,value:this.entries[e].value}:r},D.prototype.getValues=function(){var t=0,e=[];if(this.entries!==r)for(var n=0;this.size>n;n++)this.entries[n].hashCode>=0&&(e[t++]=this.entries[n].value);return e},D.prototype.get=function(t){var e=this._findEntry(t);if(e>=0)return this.entries[e].value;throw Error(C)},D.prototype.set=function(t,e){this._insert(t,e,!1)},D.prototype.containskey=function(t){return this._findEntry(t)>=0},y.join=function(t,e,n,o){var s=this;return new g(function(u){var c=new p,h=!1,a=0,l=new D,f=!1,d=0,v=new D;return c.add(s.subscribe(function(t){var n,s,f,p,d=a++,m=new b;l.add(d,t),c.add(m),s=function(){return l.remove(d)&&0===l.count()&&h&&u.onCompleted(),c.remove(m)};try{n=e(t)}catch(y){return u.onError(y),r}m.disposable(n.take(1).subscribe(i,u.onError.bind(u),function(){s()})),p=v.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(){h=!0,(f||0===l.count())&&u.onCompleted()})),c.add(t.subscribe(function(t){var e,s,h,a,p=d++,m=new b;v.add(p,t),c.add(m),s=function(){return v.remove(p)&&0===v.count()&&f&&u.onCompleted(),c.remove(m)};try{e=n(t)}catch(y){return u.onError(y),r}m.disposable(e.take(1).subscribe(i,u.onError.bind(u),function(){s()})),a=l.getValues();for(var w=0;a.length>w;w++){try{h=o(a[w],t)}catch(y){return u.onError(y),r}u.onNext(h)}},u.onError.bind(u),function(){f=!0,(h||0===v.count())&&u.onCompleted()})),c})},y.groupJoin=function(t,e,n,o){var s=this;return new g(function(u){var c=new p,h=new d(c),a=0,l=new D,f=0,v=new D;return c.add(s.subscribe(function(t){var n,s,f,p,d,y,w=a++,g=new m;l.add(w,g);try{d=o(t,E(g,h))}catch(x){for(p=l.getValues(),f=0;p.length>f;f++)p[f].onError(x);return u.onError(x),r}for(u.onNext(d),y=v.getValues(),f=0;y.length>f;f++)g.onNext(y[f]);var C=new b;c.add(C),s=function(){l.remove(w)&&g.onCompleted(),c.remove(C)};try{n=e(t)}catch(x){for(p=l.getValues(),f=0;p.length>f;f++)p[f].onError(x);return u.onError(x),r}C.disposable(n.take(1).subscribe(i,function(t){p=l.getValues();for(var e=0,n=p.length;n>e;e++)p[e].onError(t);u.onError(t)},function(){s()}))},function(t){var e,n;for(n=l.getValues(),e=0;n.length>e;e++)n[e].onError(t);u.onError(t)},u.onCompleted.bind(u))),c.add(t.subscribe(function(t){var e,o,s,h=f++;v.add(h,t);var a=new b;c.add(a);var p=function(){v.remove(h),c.remove(a)};try{e=n(t)}catch(d){for(s=l.getValues(),o=0;s.length>o;o++)s[o].onError(d);return u.onError(d),r}for(a.disposable(e.take(1).subscribe(i,function(t){s=l.getValues();for(var e=0;s.length>e;e++)s[e].onError(t);u.onError(t)},function(){p()})),s=l.getValues(),o=0;s.length>o;o++)s[o].onNext(t)},function(t){var e,n;for(n=l.getValues(),e=0;n.length>e;e++)n[e].onError(t);u.onError(t)})),h})},y.buffer=function(t,e){return 1===arguments.length&&"function"!=typeof arguments[0]?a.call(this,t).selectMany(function(t){return t.toArray()}):"function"==typeof t?l(t).selectMany(function(t){return t.toArray()}):h(this,t,e).selectMany(function(t){return t.toArray()})},y.window=function(t,e){return 1===arguments.length&&"function"!=typeof arguments[0]?a.call(this,t):"function"==typeof t?l.call(this,t):h.call(this,t,e)},n});
(function(t,e){var n="object"==typeof exports&&exports&&("object"==typeof t&&t&&t==t.global&&(window=t),exports);"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){var e,n;if(false&t)return 2===t;for(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;x.length>e;++e)if(n=x[e],n>=t)return n;for(r=1|t;x[x.length-1]>r;){if(s(r))return r;r+=2}return t}function c(){return{key:null,value:null,next:0,hashCode:0}}function a(t,e){return t.groupJoin(this,e,function(){return w()},function(t,e){return e})}function h(t){var e=this;return new g(function(n){var r=new m,i=new p,o=new d(i);return n.onNext(E(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 m,n.onNext(E(r,o))},function(t){r.onError(t),n.onError(t)},function(){r.onCompleted(),n.onCompleted()})),o})}function l(t){var e=this;return new g(function(n){var o,s=new v,u=new p(s),c=new d(u),a=new m;return n.onNext(E(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 b,s.disposable(e),e.disposable(u.take(1).subscribe(i,function(t){a.onError(t),n.onError(t)},function(){a.onCompleted(),a=new m,n.onNext(E(a,c)),o()}))},o(),c})}var f=n.Observable,p=n.CompositeDisposable,d=n.RefCountDisposable,b=n.SingleAssignmentDisposable,v=n.SerialDisposable,m=n.Subject,y=f.prototype,w=f.empty,g=n.Internals.AnonymousObservable,E=(n.Observer.create,n.Internals.addRef),x=[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],C="no such key",D="duplicate key",A=function(){var t=0;return function(e){var n;if(e===r)throw Error(C);return e.getHashCode!==r?e.getHashCode():(n=17*t++,e.getHashCode=function(){return n},n)}}(),S=function(t,e){this._initialize(t),this.comparer=e||o,this.freeCount=0,this.size=0,this.freeList=-1};return S.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]=c();this.freeList=-1},S.prototype.count=function(){return this.size},S.prototype.add=function(t,e){return this._insert(t,e,!0)},S.prototype._insert=function(t,e,n){this.buckets===r&&this._initialize(0);for(var i=2147483647&A(t),o=i%this.buckets.length,s=this.buckets[o];s>=0;s=this.entries[s].next)if(this.entries[s].hashCode===i&&this.comparer(this.entries[s].key,t)){if(n)throw D;return this.entries[s].value=e,r}if(this.freeCount>0){var u=this.freeList;this.freeList=this.entries[u].next,--this.freeCount}else this.size===this.entries.length&&(this._resize(),o=i%this.buckets.length),u=this.size,++this.size;this.entries[u].hashCode=i,this.entries[u].next=this.buckets[o],this.entries[u].key=t,this.entries[u].value=e,this.buckets[o]=u},S.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]=c();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},S.prototype.remove=function(t){if(this.buckets!==r)for(var e=2147483647&A(t),n=e%this.buckets.length,i=-1,o=this.buckets[n];o>=0;o=this.entries[o].next){if(this.entries[o].hashCode===e&&this.comparer(this.entries[o].key,t))return 0>i?this.buckets[n]=this.entries[o].next:this.entries[i].next=this.entries[o].next,this.entries[o].hashCode=-1,this.entries[o].next=this.freeList,this.entries[o].key=null,this.entries[o].value=null,this.freeList=o,++this.freeCount,!0;i=o}return!1},S.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]=c();this.freeList=-1,this.size=0}},S.prototype._findEntry=function(t){if(this.buckets!==r)for(var e=2147483647&A(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},S.prototype.count=function(){return this.size-this.freeCount},S.prototype.tryGetEntry=function(t){var e=this._findEntry(t);return e>=0?{key:this.entries[e].key,value:this.entries[e].value}:r},S.prototype.getValues=function(){var t=0,e=[];if(this.entries!==r)for(var n=0;this.size>n;n++)this.entries[n].hashCode>=0&&(e[t++]=this.entries[n].value);return e},S.prototype.get=function(t){var e=this._findEntry(t);if(e>=0)return this.entries[e].value;throw Error(C)},S.prototype.set=function(t,e){this._insert(t,e,!1)},S.prototype.containskey=function(t){return this._findEntry(t)>=0},y.join=function(t,e,n,o){var s=this;return new g(function(u){var c=new p,a=!1,h=0,l=new S,f=!1,d=0,v=new S;return c.add(s.subscribe(function(t){var n,s,f,p,d=h++,m=new b;l.add(d,t),c.add(m),s=function(){return l.remove(d)&&0===l.count()&&a&&u.onCompleted(),c.remove(m)};try{n=e(t)}catch(y){return u.onError(y),r}m.disposable(n.take(1).subscribe(i,u.onError.bind(u),function(){s()})),p=v.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,p=d++,m=new b;v.add(p,t),c.add(m),s=function(){return v.remove(p)&&0===v.count()&&f&&u.onCompleted(),c.remove(m)};try{e=n(t)}catch(y){return u.onError(y),r}m.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===v.count())&&u.onCompleted()})),c})},y.groupJoin=function(t,e,n,o){var s=this;return new g(function(u){var c=new p,a=new d(c),h=0,l=new S,f=0,v=new S;return c.add(s.subscribe(function(t){var n,s,f,p,d,y,w=h++,g=new m;l.add(w,g);try{d=o(t,E(g,a))}catch(x){for(p=l.getValues(),f=0;p.length>f;f++)p[f].onError(x);return u.onError(x),r}for(u.onNext(d),y=v.getValues(),f=0;y.length>f;f++)g.onNext(y[f]);var C=new b;c.add(C),s=function(){l.remove(w)&&g.onCompleted(),c.remove(C)};try{n=e(t)}catch(x){for(p=l.getValues(),f=0;p.length>f;f++)p[f].onError(x);return u.onError(x),r}C.disposable(n.take(1).subscribe(i,function(t){p=l.getValues();for(var e=0,n=p.length;n>e;e++)p[e].onError(t);u.onError(t)},function(){s()}))},function(t){var e,n;for(n=l.getValues(),e=0;n.length>e;e++)n[e].onError(t);u.onError(t)},u.onCompleted.bind(u))),c.add(t.subscribe(function(t){var e,o,s,a=f++;v.add(a,t);var h=new b;c.add(h);var p=function(){v.remove(a),c.remove(h)};try{e=n(t)}catch(d){for(s=l.getValues(),o=0;s.length>o;o++)s[o].onError(d);return u.onError(d),r}for(h.disposable(e.take(1).subscribe(i,function(t){s=l.getValues();for(var e=0;s.length>e;e++)s[e].onError(t);u.onError(t)},function(){p()})),s=l.getValues(),o=0;s.length>o;o++)s[o].onNext(t)},function(t){var e,n;for(n=l.getValues(),e=0;n.length>e;e++)n[e].onError(t);u.onError(t)})),a})},y.buffer=function(t,e){return 1===arguments.length&&"function"!=typeof arguments[0]?h.call(this,t).selectMany(function(t){return t.toArray()}):"function"==typeof t?l(t).selectMany(function(t){return t.toArray()}):a(this,t,e).selectMany(function(t){return t.toArray()})},y.window=function(t,e){return 1===arguments.length&&"function"!=typeof arguments[0]?h.call(this,t):"function"==typeof t?l.call(this,t):a.call(this,t,e)},n});

@@ -18,6 +18,6 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.

}
}(this, function (global, exp, root, undefined) {
}(this, function (global, exp, Rx, undefined) {
// Aliases
var Observable = root.Observable,
var Observable = Rx.Observable,
observableProto = Observable.prototype,

@@ -28,11 +28,11 @@ observableCreateWithDisposable = Observable.createWithDisposable,

observableEmpty = Observable.empty,
disposableEmpty = root.Disposable.empty,
BinaryObserver = root.Internals.BinaryObserver,
CompositeDisposable = root.CompositeDisposable,
SerialDisposable = root.SerialDisposable,
SingleAssignmentDisposable = root.SingleAssignmentDisposable,
enumeratorCreate = root.Internals.Enumerator.create,
Enumerable = root.Internals.Enumerable,
disposableEmpty = Rx.Disposable.empty,
BinaryObserver = Rx.Internals.BinaryObserver,
CompositeDisposable = Rx.CompositeDisposable,
SerialDisposable = Rx.SerialDisposable,
SingleAssignmentDisposable = Rx.SingleAssignmentDisposable,
enumeratorCreate = Rx.Internals.Enumerator.create,
Enumerable = Rx.Internals.Enumerable,
enumerableForEach = Enumerable.forEach,
immediateScheduler = root.Scheduler.immediate,
immediateScheduler = Rx.Scheduler.immediate,
slice = Array.prototype.slice;

@@ -64,5 +64,5 @@

*
* @param source Source sequence that will be shared in the selector function.
* @param selector Selector function which can use the source sequence as many times as needed, without sharing subscriptions to the source sequence.
* @return An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
* @memberOf Observable#
* @param {Function} selector Selector function which can use the source sequence as many times as needed, without sharing subscriptions to the source sequence.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/

@@ -76,12 +76,12 @@ observableProto.letBind = function (func) {

*
* @example
* 1 - res = Rx.Observable.ifThen(condition, obs1);
* 2 - res = Rx.Observable.ifThen(condition, obs1, obs2);
* 3 - res = Rx.Observable.ifThen(condition, obs1, scheduler);
*
* @param condition The condition which determines if the thenSource or elseSource will be run.
* @param thenSource The observable sequence that will be run if the condition function returns true.
* @param elseSource
* [Optional] The observable sequence that will be run if the condition function returns false. If this is not provided, it defaults to Rx.Observabe.Empty with the specified scheduler.
*
* @return An observable sequence which is either the thenSource or elseSource.
* 3 - res = Rx.Observable.ifThen(condition, obs1, scheduler);
* @static
* @memberOf Observable
* @param {Function} condition The condition which determines if the thenSource or elseSource will be run.
* @param {Observable} thenSource The observable sequence that will be run if the condition function returns true.
* @param {Observable} [elseSource] The observable sequence that will be run if the condition function returns false. If this is not provided, it defaults to Rx.Observabe.Empty with the specified scheduler.
* @returns {Observable} An observable sequence which is either the thenSource or elseSource.
*/

@@ -101,6 +101,7 @@ Observable.ifThen = function (condition, thenSource, elseSourceOrScheduler) {

* Concatenates the observable sequences obtained by running the specified result selector for each element in source.
*
* @param sources An array of values to turn into an observable sequence.
* @param resultSelector A function to apply to each item in the sources array to turn it into an observable sequence.
* @return An observable sequence from the concatenated observable sequences.
* @static
* @memberOf Observable
* @param {Array} sources An array of values to turn into an observable sequence.
* @param {Function} resultSelector A function to apply to each item in the sources array to turn it into an observable sequence.
* @returns {Observable} An observable sequence from the concatenated observable sequences.
*/

@@ -113,6 +114,7 @@ Observable.forIn = function (sources, resultSelector) {

* Repeats source as long as condition holds emulating a while loop.
*
* @param condition The condition which determines if the source will be repeated.
* @param source The observable sequence that will be run if the condition function returns true.
* @return An observable sequence which is repeated as long as the condition holds.
* @static
* @memberOf Observable
* @param {Function} condition The condition which determines if the source will be repeated.
* @param {Observable} source The observable sequence that will be run if the condition function returns true.
* @returns {Observable} An observable sequence which is repeated as long as the condition holds.
*/

@@ -125,6 +127,7 @@ var observableWhileDo = Observable.whileDo = function (condition, source) {

* Repeats source as long as condition holds emulating a do while loop.
*
* @param condition The condition which determines if the source will be repeated.
* @param source The observable sequence that will be run if the condition function returns true.
* @return An observable sequence which is repeated as long as the condition holds.
*
* @memberOf Observable#
* @param {Function} condition The condition which determines if the source will be repeated.
* @param {Observable} source The observable sequence that will be run if the condition function returns true.
* @returns {Observable} An observable sequence which is repeated as long as the condition holds.
*/

@@ -138,12 +141,14 @@ observableProto.doWhile = function (condition) {

*
* @example
* 1 - res = Rx.Observable.switchCase(selector, { '1': obs1, '2': obs2 });
* 1 - res = Rx.Observable.switchCase(selector, { '1': obs1, '2': obs2 }, obs0);
* 1 - res = Rx.Observable.switchCase(selector, { '1': obs1, '2': obs2 }, scheduler);
*
* @param selector The function which extracts the value for to test in a case statement.
* @param sources A object which has keys which correspond to the case statement labels.
* @param elseSource
* [Optional] The observable sequence that will be run if the sources are not matched. If this is not provided, it defaults to Rx.Observabe.Empty with the specified scheduler.
* 1 - res = Rx.Observable.switchCase(selector, { '1': obs1, '2': obs2 }, scheduler);
*
* @static
* @memberOf Observable
* @param {Function} selector The function which extracts the value for to test in a case statement.
* @param {Array} sources A object which has keys which correspond to the case statement labels.
* @param {Observable} [elseSource] The observable sequence that will be run if the sources are not matched. If this is not provided, it defaults to Rx.Observabe.Empty with the specified scheduler.
*
* @return An observable sequence which is determined by a case statement.
* @returns {Observable} An observable sequence which is determined by a case statement.
*/

@@ -165,5 +170,6 @@ Observable.switchCase = function (selector, sources, defaultSourceOrScheduler) {

*
* @param selector Selector function to invoke for each produced element, resulting in another sequence to which the selector will be invoked recursively again.
* @param scheduler [Optional] Scheduler on which to perform the expansion. If not provided, this defaults to the current thread scheduler.
* @return An observable sequence containing all the elements produced by the recursive expansion.
* @memberOf Observable#
* @param {Function} selector Selector function to invoke for each produced element, resulting in another sequence to which the selector will be invoked recursively again.
* @param {Scheduler} [scheduler] Scheduler on which to perform the expansion. If not provided, this defaults to the current thread scheduler.
* @returns {Observable} An observable sequence containing all the elements produced by the recursive expansion.
*/

@@ -230,6 +236,8 @@ observableProto.expand = function (selector, scheduler) {

*
* @example
* 1 - res = Rx.Observable.forkJoin([obs1, obs2]);
* 1 - res = Rx.Observable.forkJoin(obs1, obs2, ...);
*
* @return An observable sequence with an array collecting the last elements of all the input sequences.
* 1 - res = Rx.Observable.forkJoin(obs1, obs2, ...);
* @static
* @memberOf Observable
* @returns {Observable} An observable sequence with an array collecting the last elements of all the input sequences.
*/

@@ -289,5 +297,6 @@ Observable.forkJoin = function () {

*
* @param second Second observable sequence.
* @param resultSelector Result selector function to invoke with the last elements of both sequences.
* @return An observable sequence with the result of calling the selector function with the last elements of both input sequences.
* @memberOf Observable#
* @param {Observable} second Second observable sequence.
* @param {Function} resultSelector Result selector function to invoke with the last elements of both sequences.
* @returns {Observable} An observable sequence with the result of calling the selector function with the last elements of both input sequences.
*/

@@ -365,3 +374,3 @@ observableProto.forkJoin = function (second, resultSelector) {

return root;
return Rx;
}));

@@ -18,13 +18,13 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.

}
}(this, function (global, exp, root, undefined) {
}(this, function (global, exp, Rx, undefined) {
// Aliases
var Observable = root.Observable,
var Observable = Rx.Observable,
observableProto = Observable.prototype,
AnonymousObservable = root.Internals.AnonymousObservable,
AnonymousObservable = Rx.Internals.AnonymousObservable,
observableThrow = Observable.throwException,
observerCreate = root.Observer.create,
SingleAssignmentDisposable = root.SingleAssignmentDisposable,
CompositeDisposable = root.CompositeDisposable,
AbstractObserver = root.Internals.AbstractObserver;
observerCreate = Rx.Observer.create,
SingleAssignmentDisposable = Rx.SingleAssignmentDisposable,
CompositeDisposable = Rx.CompositeDisposable,
AbstractObserver = Rx.Internals.AbstractObserver;

@@ -36,3 +36,3 @@ // Defaults

// Utilities
var inherits = root.Internals.inherits;
var inherits = Rx.Internals.inherits;
var slice = Array.prototype.slice;

@@ -45,4 +45,9 @@ function argsOrArray(args, idx) {

// TODO: Replace with a real Map once finalized
/** @private */
var Map = (function () {
/**
* @constructor
* @private
*/
function Map() {

@@ -53,2 +58,6 @@ this.keys = [];

/**
* @private
* @memberOf Map#
*/
Map.prototype['delete'] = function (key) {

@@ -63,2 +72,6 @@ var i = this.keys.indexOf(key);

/**
* @private
* @memberOf Map#
*/
Map.prototype.get = function (key, fallback) {

@@ -69,2 +82,6 @@ var i = this.keys.indexOf(key);

/**
* @private
* @memberOf Map#
*/
Map.prototype.set = function (key, value) {

@@ -78,7 +95,26 @@ var i = this.keys.indexOf(key);

/**
* @private
* @memberOf Map#
*/
Map.prototype.size = function () { return this.keys.length; };
/**
* @private
* @memberOf Map#
*/
Map.prototype.has = function (key) {
return this.keys.indexOf(key) !== -1;
};
/**
* @private
* @memberOf Map#
*/
Map.prototype.getKeys = function () { return this.keys.slice(0); };
/**
* @private
* @memberOf Map#
*/
Map.prototype.getValues = function () { return this.values.slice(0); };

@@ -210,9 +246,13 @@

// Join Observer
var JoinObserver = (function () {
/** @private */
var JoinObserver = (function (_super) {
inherits(JoinObserver, AbstractObserver);
inherits(JoinObserver, _super);
/**
* @constructor
* @private
*/
function JoinObserver(source, onError) {
JoinObserver.super_.constructor.call(this);
_super.call(this);
this.source = source;

@@ -226,3 +266,9 @@ this.onError = onError;

JoinObserver.prototype.next = function (notification) {
var JoinObserverPrototype = JoinObserver.prototype;
/**
* @memberOf JoinObserver#
* @private
*/
JoinObserverPrototype.next = function (notification) {
if (!this.isDisposed) {

@@ -240,12 +286,36 @@ if (notification.kind === 'E') {

};
JoinObserver.prototype.error = noop;
JoinObserver.prototype.completed = noop;
JoinObserver.prototype.addActivePlan = function (activePlan) {
/**
* @memberOf JoinObserver#
* @private
*/
JoinObserverPrototype.error = noop;
/**
* @memberOf JoinObserver#
* @private
*/
JoinObserverPrototype.completed = noop;
/**
* @memberOf JoinObserver#
* @private
*/
JoinObserverPrototype.addActivePlan = function (activePlan) {
this.activePlans.push(activePlan);
};
JoinObserver.prototype.subscribe = function () {
/**
* @memberOf JoinObserver#
* @private
*/
JoinObserverPrototype.subscribe = function () {
this.subscription.disposable(this.source.materialize().subscribe(this));
};
JoinObserver.prototype.removeActivePlan = function (activePlan) {
/**
* @memberOf JoinObserver#
* @private
*/
JoinObserverPrototype.removeActivePlan = function (activePlan) {
var idx = this.activePlans.indexOf(activePlan);

@@ -257,4 +327,9 @@ this.activePlans.splice(idx, 1);

};
JoinObserver.prototype.dispose = function () {
JoinObserver.super_.dispose.call(this);
/**
* @memberOf JoinObserver#
* @private
*/
JoinObserverPrototype.dispose = function () {
_super.prototype.dispose.call(this);
if (!this.isDisposed) {

@@ -265,4 +340,5 @@ this.isDisposed = true;

};
return JoinObserver;
} ());
} (AbstractObserver));

@@ -275,3 +351,3 @@ // Observable extensions

* @param right Observable sequence to match with the current sequence.</param>
* @return Pattern object that matches when both observable sequences have an available value.
* @return {Pattern} Pattern object that matches when both observable sequences have an available value.
*/

@@ -286,3 +362,3 @@ observableProto.and = function (right) {

* @param selector Selector that will be invoked for values in the source sequence.</param>
* @return Plan that produces the projected values, to be fed (with other plans) to the when operator.
* @returns {Plan} Plan that produces the projected values, to be fed (with other plans) to the when operator.
*/

@@ -297,3 +373,3 @@ observableProto.then = function (selector) {

* @param plans A series of plans (specified as an Array of as a series of arguments) created by use of the Then operator on patterns.</param>
* @return Observable sequence with the results form matching several patterns.
* @returns {Observable} Observable sequence with the results form matching several patterns.
*/

@@ -341,3 +417,3 @@ Observable.when = function () {

return root;
return Rx;
}));

@@ -1,1 +0,1 @@

(function(t,e){var n="object"==typeof exports&&exports&&("object"==typeof t&&t&&t==t.global&&(window=t),exports);"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(){}function i(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:y.call(t)}function o(t){this.patterns=t}function s(t,e){this.expression=t,this.selector=e}function u(t,e,n){var r=t.get(e);if(!r){var i=new g(e,n);return t.set(e,i),i}return r}function c(t,e,n){var r,i;for(this.joinObserverArray=t,this.onNext=e,this.onCompleted=n,this.joinObservers=new w,r=0;this.joinObserverArray.length>r;r++)i=this.joinObserverArray[r],this.joinObservers.set(i,i)}var a=n.Observable,h=a.prototype,l=n.Internals.AnonymousObservable,f=a.throwException,p=n.Observer.create,d=n.SingleAssignmentDisposable,b=n.CompositeDisposable,v=n.Internals.AbstractObserver,m=n.Internals.inherits,y=Array.prototype.slice,w=function(){function t(){this.keys=[],this.values=[]}return t.prototype["delete"]=function(t){var e=this.keys.indexOf(t);return-1!==e&&(this.keys.splice(e,1),this.values.splice(e,1)),-1!==e},t.prototype.get=function(t,e){var n=this.keys.indexOf(t);return-1!==n?this.values[n]:e},t.prototype.set=function(t,e){var n=this.keys.indexOf(t);-1!==n&&(this.values[n]=e),this.values[this.keys.push(t)-1]=e},t.prototype.size=function(){return this.keys.length},t.prototype.has=function(t){return-1!==this.keys.indexOf(t)},t.prototype.getKeys=function(){return this.keys.slice(0)},t.prototype.getValues=function(){return this.values.slice(0)},t}();o.prototype.and=function(t){var e=this.patterns.slice(0);return e.push(t),new o(e)},o.prototype.then=function(t){return new s(this,t)},s.prototype.activate=function(t,e,n){for(var r=this,i=[],o=0,s=this.expression.patterns.length;s>o;o++)i.push(u(t,this.expression.patterns[o],e.onError.bind(e)));var a=new c(i,function(){var t;try{t=r.selector.apply(r,arguments)}catch(n){return e.onError(n),undefined}e.onNext(t)},function(){for(var t=0,e=i.length;e>t;t++)i[t].removeActivePlan(a);n(a)});for(o=0,s=i.length;s>o;o++)i[o].addActivePlan(a);return a},c.prototype.dequeue=function(){for(var t=this.joinObservers.getValues(),e=0,n=t.length;n>e;e++)t[e].queue.shift()},c.prototype.match=function(){var t,e,n,r,i,o=!0;for(e=0,n=this.joinObserverArray.length;n>e;e++)if(0===this.joinObserverArray[e].queue.length){o=!1;break}if(o){for(t=[],r=!1,e=0,n=this.joinObserverArray.length;n>e;e++)t.push(this.joinObserverArray[e].queue[0]),"C"===this.joinObserverArray[e].queue[0].kind&&(r=!0);if(r)this.onCompleted();else{for(this.dequeue(),i=[],e=0;t.length>e;e++)i.push(t[e].value);this.onNext.apply(this,i)}}};var g=function(){function t(e,n){t.super_.constructor.call(this),this.source=e,this.onError=n,this.queue=[],this.activePlans=[],this.subscription=new d,this.isDisposed=!1}return m(t,v),t.prototype.next=function(t){if(!this.isDisposed){if("E"===t.kind)return this.onError(t.exception),undefined;this.queue.push(t);for(var e=this.activePlans.slice(0),n=0,r=e.length;r>n;n++)e[n].match()}},t.prototype.error=r,t.prototype.completed=r,t.prototype.addActivePlan=function(t){this.activePlans.push(t)},t.prototype.subscribe=function(){this.subscription.disposable(this.source.materialize().subscribe(this))},t.prototype.removeActivePlan=function(t){var e=this.activePlans.indexOf(t);this.activePlans.splice(e,1),0===this.activePlans.length&&this.dispose()},t.prototype.dispose=function(){t.super_.dispose.call(this),this.isDisposed||(this.isDisposed=!0,this.subscription.dispose())},t}();return h.and=function(t){return new o([this,t])},h.then=function(t){return new o([this]).then(t)},a.when=function(){var t=i(arguments,0);return new l(function(e){var n,r,i,o,s,u,c=[],a=new w;u=p(e.onNext.bind(e),function(t){for(var n=a.getValues(),r=0,i=n.length;i>r;r++)n[r].onError(t);e.onError(t)},e.onCompleted.bind(e));try{for(r=0,i=t.length;i>r;r++)c.push(t[r].activate(a,u,function(t){var e=c.indexOf(t);c.splice(e,1),0===c.length&&u.onCompleted()}))}catch(h){f(h).subscribe(e)}for(n=new b,s=a.getValues(),r=0,i=s.length;i>r;r++)o=s[r],o.subscribe(),n.add(o);return n})},n});
(function(t,e){var n="object"==typeof exports&&exports&&("object"==typeof t&&t&&t==t.global&&(window=t),exports);"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(){}function i(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:y.call(t)}function o(t){this.patterns=t}function s(t,e){this.expression=t,this.selector=e}function u(t,e,n){var r=t.get(e);if(!r){var i=new g(e,n);return t.set(e,i),i}return r}function c(t,e,n){var r,i;for(this.joinObserverArray=t,this.onNext=e,this.onCompleted=n,this.joinObservers=new w,r=0;this.joinObserverArray.length>r;r++)i=this.joinObserverArray[r],this.joinObservers.set(i,i)}var a=n.Observable,h=a.prototype,l=n.Internals.AnonymousObservable,f=a.throwException,p=n.Observer.create,d=n.SingleAssignmentDisposable,b=n.CompositeDisposable,v=n.Internals.AbstractObserver,m=n.Internals.inherits,y=Array.prototype.slice,w=function(){function t(){this.keys=[],this.values=[]}return t.prototype["delete"]=function(t){var e=this.keys.indexOf(t);return-1!==e&&(this.keys.splice(e,1),this.values.splice(e,1)),-1!==e},t.prototype.get=function(t,e){var n=this.keys.indexOf(t);return-1!==n?this.values[n]:e},t.prototype.set=function(t,e){var n=this.keys.indexOf(t);-1!==n&&(this.values[n]=e),this.values[this.keys.push(t)-1]=e},t.prototype.size=function(){return this.keys.length},t.prototype.has=function(t){return-1!==this.keys.indexOf(t)},t.prototype.getKeys=function(){return this.keys.slice(0)},t.prototype.getValues=function(){return this.values.slice(0)},t}();o.prototype.and=function(t){var e=this.patterns.slice(0);return e.push(t),new o(e)},o.prototype.then=function(t){return new s(this,t)},s.prototype.activate=function(t,e,n){for(var r=this,i=[],o=0,s=this.expression.patterns.length;s>o;o++)i.push(u(t,this.expression.patterns[o],e.onError.bind(e)));var a=new c(i,function(){var t;try{t=r.selector.apply(r,arguments)}catch(n){return e.onError(n),undefined}e.onNext(t)},function(){for(var t=0,e=i.length;e>t;t++)i[t].removeActivePlan(a);n(a)});for(o=0,s=i.length;s>o;o++)i[o].addActivePlan(a);return a},c.prototype.dequeue=function(){for(var t=this.joinObservers.getValues(),e=0,n=t.length;n>e;e++)t[e].queue.shift()},c.prototype.match=function(){var t,e,n,r,i,o=!0;for(e=0,n=this.joinObserverArray.length;n>e;e++)if(0===this.joinObserverArray[e].queue.length){o=!1;break}if(o){for(t=[],r=!1,e=0,n=this.joinObserverArray.length;n>e;e++)t.push(this.joinObserverArray[e].queue[0]),"C"===this.joinObserverArray[e].queue[0].kind&&(r=!0);if(r)this.onCompleted();else{for(this.dequeue(),i=[],e=0;t.length>e;e++)i.push(t[e].value);this.onNext.apply(this,i)}}};var g=function(t){function e(e,n){t.call(this),this.source=e,this.onError=n,this.queue=[],this.activePlans=[],this.subscription=new d,this.isDisposed=!1}m(e,t);var n=e.prototype;return n.next=function(t){if(!this.isDisposed){if("E"===t.kind)return this.onError(t.exception),undefined;this.queue.push(t);for(var e=this.activePlans.slice(0),n=0,r=e.length;r>n;n++)e[n].match()}},n.error=r,n.completed=r,n.addActivePlan=function(t){this.activePlans.push(t)},n.subscribe=function(){this.subscription.disposable(this.source.materialize().subscribe(this))},n.removeActivePlan=function(t){var e=this.activePlans.indexOf(t);this.activePlans.splice(e,1),0===this.activePlans.length&&this.dispose()},n.dispose=function(){t.prototype.dispose.call(this),this.isDisposed||(this.isDisposed=!0,this.subscription.dispose())},e}(v);return h.and=function(t){return new o([this,t])},h.then=function(t){return new o([this]).then(t)},a.when=function(){var t=i(arguments,0);return new l(function(e){var n,r,i,o,s,u,c=[],a=new w;u=p(e.onNext.bind(e),function(t){for(var n=a.getValues(),r=0,i=n.length;i>r;r++)n[r].onError(t);e.onError(t)},e.onCompleted.bind(e));try{for(r=0,i=t.length;i>r;r++)c.push(t[r].activate(a,u,function(t){var e=c.indexOf(t);c.splice(e,1),0===c.length&&u.onCompleted()}))}catch(h){f(h).subscribe(e)}for(n=new b,s=a.getValues(),r=0,i=s.length;i>r;r++)o=s[r],o.subscribe(),n.add(o);return n})},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 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(E)}function h(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:x.call(t)}function l(t,e){for(var n=Array(t),r=0;t>r;r++)n[r]=e();return n}function f(t,e){this.scheduler=t,this.disposable=e,this.isDisposed=!1}function p(t,e,n,r,i){this.scheduler=t,this.state=e,this.action=n,this.dueTime=r,this.comparer=i||s,this.disposable=new I}function d(t,n){return new xe(function(r){var i=new I,o=new F;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 I,o.setDisposable(i),i.setDisposable(s.subscribe(r))},r.onCompleted.bind(r))),o})}function b(t,n){var r=this;return new xe(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 v(t){return this.select(t).mergeObservable()}var m="object"==typeof exports&&exports&&("object"==typeof global&&global&&global==global.global&&(t=global),exports),y={Internals:{}},w="Sequence contains no elements.",g="Argument out of range",E="Object has been disposed";Function.prototype.bind||(Function.prototype.bind=function(t){var e=this,n=x.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(x.call(arguments)));return Object(s)===s?s:o}return e.apply(t,n.concat(x.call(arguments)))};return r});var x=Array.prototype.slice,A={}.hasOwnProperty,C=y.Internals.inherits=function(t,e){function n(){this.constructor=t}for(var r in e)"prototype"!==r&&A.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.super_=e.prototype,t},_=y.Internals.addProperties=function(t){for(var e=x.call(arguments,1),n=0,r=e.length;r>n;n++){var i=e[n];for(var o in i)t[o]=i[o]}},D=y.Internals.addRef=function(t,e){return new xe(function(n){return new O(e.getDisposable(),t.subscribe(n))})},S=Object("a"),N="a"!=S[0]||!(0 in S);Array.prototype.every||(Array.prototype.every=function(t){var e=Object(this),n=N&&"[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=N&&"[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 R=function(t,e){this.id=t,this.value=e};R.prototype.compareTo=function(t){var e=this.value.compareTo(t.value);return 0===e&&(e=this.id-t.id),e};var W=function(t){this.items=Array(t),this.length=0},k=W.prototype;k.isHigherPriority=function(t,e){return 0>this.items[t].compareTo(this.items[e])},k.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)}}},k.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)}}},k.peek=function(){return this.items[0].value},k.removeAt=function(t){this.items[t]=this.items[--this.length],delete this.items[this.length],this.heapify()},k.dequeue=function(){var t=this.peek();return this.removeAt(0),t},k.enqueue=function(t){var e=this.length++;this.items[e]=new R(W.count++,t),this.percolate(e)},k.remove=function(t){for(var e=0;this.length>e;e++)if(this.items[e].value===t)return this.removeAt(e),!0;return!1},W.count=0;var O=y.CompositeDisposable=function(){this.disposables=h(arguments,0),this.isDisposed=!1,this.length=this.disposables.length};O.prototype.add=function(t){this.isDisposed?t.dispose():(this.disposables.push(t),this.length++)},O.prototype.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},O.prototype.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()}},O.prototype.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()},O.prototype.contains=function(t){return-1!==this.disposables.indexOf(t)},O.prototype.toArray=function(){return this.disposables.slice(0)};var q=y.Disposable=function(t){this.isDisposed=!1,this.action=t};q.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var T=q.create=function(t){return new q(t)},j=q.empty={dispose:n},I=y.SingleAssignmentDisposable=function(){this.isDisposed=!1,this.current=null};I.prototype.disposable=function(t){return t?this.setDisposable(t):this.getDisposable()},I.prototype.getDisposable=function(){return this.current},I.prototype.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()},I.prototype.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()};var F=y.SerialDisposable=function(){this.isDisposed=!1,this.current=null};F.prototype.getDisposable=function(){return this.current},F.prototype.setDisposable=function(t){var e,n=this.isDisposed;n||(e=this.current,this.current=t),e&&e.dispose(),n&&t&&t.dispose()},F.prototype.disposable=function(t){return t?(this.setDisposable(t),e):this.getDisposable()},F.prototype.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()};var P=y.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?j:new t(this)},e}();f.prototype.dispose=function(){var t=this;this.scheduler.schedule(function(){t.isDisposed||(t.isDisposed=!0,t.disposable.dispose())})},p.prototype.invoke=function(){this.disposable.disposable(this.invokeCore())},p.prototype.compareTo=function(t){return this.comparer(this.dueTime,t.dueTime)},p.prototype.isCancelled=function(){return this.disposable.isDisposed},p.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var V=y.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 O,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),j});r||(i.add(s),n=!0)})};return o(n),i}function r(t,e,n){var r=e.first,i=e.second,o=new O,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),j});u||(o.add(c),i=!0)})};return s(r),o}function o(t,e){return e(),j}var s=e.prototype;return s.catchException=function(t){return new U(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 T(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}(),M="Scheduler is not allowed to block the thread",z=V.immediate=function(){function t(t,e){return e(this,t)}function e(t,e,n){if(e>0)throw Error(M);return n(this,t)}function n(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new V(i,t,e,n)}(),L=V.currentThread=function(){function t(){o=new W(4)}function e(t,e){return this.scheduleWithRelativeAndState(t,0,e)}function n(e,n,r){var i,s=this.now()+V.normalize(n),u=new p(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-V.now()>0;);t.isCancelled()||t.invoke()}};var s=new V(i,e,n,r);return s.scheduleRequired=function(){return null===o},s.ensureTrampoline=function(t){return null===o?this.schedule(t):t()},s}(),B=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 I;return this._cancel=e,e.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,t.bind(this))),e},e}();y.VirtualTimeScheduler=function(){function t(){return this.toDateTimeOffset(this.clock)}function n(t,e){return this.scheduleAbsoluteWithState(t,this.clock,e)}function r(t,e,n){return this.scheduleRelativeWithState(t,this.toRelative(e),n)}function i(t,e,n){return this.scheduleRelativeWithState(t,this.toRelative(e-this.now()),n)}function o(t,e){return e(),j}function s(e,o){this.clock=e,this.comparer=o,this.isEnabled=!1,this.queue=new W(1024),s.super_.constructor.call(this,t,n,r,i)}return C(s,V),_(s.prototype,{schedulePeriodicWithState:function(t,e,n){var r=new B(this,t,e,n);return r.start()},scheduleRelativeWithState:function(t,e,n){var r=this.add(this.clock,e);return this.scheduleAbsoluteWithState(t,r,n)},scheduleRelative:function(t,e){return this.scheduleRelativeWithState(e,t,o)},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)}},stop:function(){this.isEnabled=!1},advanceTo:function(t){var e,n=this.comparer(this.clock,t);if(this.comparer(this.clock,t)>0)throw Error(g);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}},advanceBy:function(t){var n=this.add(this.clock,t),r=this.comparer(this.clock,n);if(r>0)throw Error(g);return 0!==r?this.advanceTo(n):e},sleep:function(t){var e=this.add(this.clock,t);if(this.comparer(this.clock,e)>=0)throw Error(g);this.clock=e},getNext:function(){for(var t;this.queue.length>0;){if(t=this.queue.peek(),!t.isCancelled())return t;this.queue.dequeue()}return null},scheduleAbsolute:function(t,e){return this.scheduleAbsoluteWithState(e,t,o)},scheduleAbsoluteWithState:function(t,e,n){var r=this,i=function(t,e){return r.queue.remove(o),n(t,e)},o=new p(r,t,i,e,r.comparer);return r.queue.enqueue(o),o.disposable}}),s}(),y.HistoricalScheduler=function(){function t(e,n){var r=null==e?0:e,i=n||s;t.super_.constructor.call(this,r,i)}C(t,y.VirtualTimeScheduler);var e=t.prototype;return e.add=function(t,e){return t+e},e.toDateTimeOffset=function(t){return new Date(t).getTime()},e.toRelative=function(t){return t},t}();var H=V.timeout=function(){function r(t,e){var n=this,r=new I,i=u(function(){r.setDisposable(e(n,t))});return new O(r,T(function(){c(i)}))}function o(e,n,r){var i=this,o=V.normalize(n);if(0===o)return i.scheduleWithState(e,r);var s=new I,u=t.setTimeout(function(){s.setDisposable(r(i,e))},o);return new O(s,T(function(){t.clearTimeout(u)}))}function s(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}var u,c,a=t.requestAnimationFrame||t.webkitRequestAnimationFrame||t.mozRequestAnimationFrame||t.oRequestAnimationFrame||t.msRequestAnimationFrame,h=t.cancelAnimationFrame||t.webkitCancelAnimationFrame||t.mozCancelAnimationFrame||t.oCancelAnimationFrame||t.msCancelAnimationFrame;return t.process!==e&&"function"==typeof t.process.nextTick?(u=t.process.nextTick,c=n):"function"==typeof t.setImmediate?(u=t.setImmediate,c=t.clearImmediate):"function"==typeof a?(u=a,c=h):(u=function(e){return t.setTimeout(e,0)},c=t.clearTimeout),new V(i,r,o,s)}(),U=function(){function t(){return this._scheduler.now()}function e(t,e){return this._scheduler.scheduleWithState(t,this._wrap(e))}function n(t,e,n){return this._scheduler.scheduleWithRelativeAndState(t,e,this._wrap(n))}function r(t,e,n){return this._scheduler.scheduleWithAbsoluteAndState(t,e,this._wrap(n))}function i(o,s){this._scheduler=o,this._handler=s,this._recursiveOriginal=null,this._recursiveWrapper=null,i.super_.constructor.call(this,t,e,n,r)}return C(i,V),i.prototype._clone=function(t){return new i(t,this._handler)},i.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 j}}},i.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},i.prototype.schedulePeriodicWithState=function(t,e,n){var r=this,i=!1,o=new I;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},i}(),G=y.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 arguments.length>1||"function"==typeof t?this._accept(t,e,n):this._acceptObservable(t)},e.toObservable=function(t){var e=this;return t=t||z,new xe(function(n){return t.schedule(function(){e._acceptObservable(n),"N"===e.kind&&n.onCompleted()})})},e.equals=function(t){var e=null==t?"":""+t;return""+this===e},t}(),J=G.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 G("N",!0);return i.value=r,i._accept=t.bind(i),i._acceptObservable=e.bind(i),i.toString=n.bind(i),i}}(),K=G.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 G("E");return i.exception=r,i._accept=t.bind(i),i._acceptObservable=e.bind(i),i.toString=n.bind(i),i}}(),Q=G.createOnCompleted=function(){function t(t,e,n){return n()}function e(t){return t.onCompleted()}function n(){return"OnCompleted()"}return function(){var r=new G("C");return r._accept=t.bind(r),r._acceptObservable=e.bind(r),r.toString=n.bind(r),r}}(),X=y.Internals.Enumerator=function(t,e,n){this.moveNext=t,this.getCurrent=e,this.dispose=n},Y=X.create=function(t,e,r){var i=!1;return r||(r=n),new X(function(){if(i)return!1;var e=t();return e||(i=!0,r()),e},function(){return e()},function(){i||(r(),i=!0)})},Z=y.Internals.Enumerable=function(){function t(t){this.getEnumerator=t}return t.prototype.concat=function(){var t=this;return new xe(function(n){var r=t.getEnumerator(),i=!1,o=new F,s=z.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 I;o.setDisposable(h),h.setDisposable(s.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){t()}))}});return new O(o,s,T(function(){i=!0,r.dispose()}))})},t.prototype.catchException=function(){var t=this;return new xe(function(n){var r,i=t.getEnumerator(),o=!1,s=new F,u=z.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 I;s.setDisposable(l),l.setDisposable(u.subscribe(n.onNext.bind(n),function(e){r=e,t()},n.onCompleted.bind(n)))}});return new O(s,u,T(function(){o=!0}))})},t}(),$=Z.repeat=function(t,n){return n===e&&(n=-1),new Z(function(){var e,r=n;return Y(function(){return 0===r?!1:(r>0&&r--,e=t,!0)},function(){return e})})},te=Z.forEach=function(t,e){return e||(e=r),new Z(function(){var n,r=-1;return Y(function(){return++r<t.length?(n=e(t[r],r),!0):!1},function(){return n})})},ee=y.Observer=function(){};ee.prototype.toNotifier=function(){var t=this;return function(e){return e.accept(t)}},ee.prototype.asObserver=function(){return new oe(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},ee.prototype.checked=function(){return new se(this)};var ne=ee.create=function(t,e,r){return t||(t=n),e||(e=c),r||(r=n),new oe(t,e,r)};ee.fromNotifier=function(t){return new oe(function(e){return t(J(e))},function(e){return t(K(e))},function(){return t(Q())})};var re,ie=y.Internals.AbstractObserver=function(){function t(){this.isStopped=!1}return C(t,ee),t.prototype.onNext=function(t){this.isStopped||this.next(t)},t.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.error(t))},t.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},t.prototype.dispose=function(){this.isStopped=!0},t.prototype.fail=function(){return this.isStopped?!1:(this.isStopped=!0,this.error(!0),!0)},t}(),oe=y.AnonymousObserver=function(){function t(e,n,r){t.super_.constructor.call(this),this._onNext=e,this._onError=n,this._onCompleted=r}return C(t,ie),t.prototype.next=function(t){this._onNext(t)},t.prototype.error=function(t){this._onError(t)},t.prototype.completed=function(){this._onCompleted()},t}(),se=function(){function t(t){this._observer=t,this._state=0}return C(t,ee),t.prototype.onNext=function(t){this.checkAccess();try{this._observer.onNext(t)}catch(e){throw e}finally{this._state=0}},t.prototype.onError=function(t){this.checkAccess();try{this._observer.onError(t)}catch(e){throw e}finally{this._state=2}},t.prototype.onCompleted=function(){this.checkAccess();try{this._observer.onCompleted()}catch(t){throw t}finally{this._state=2}},t.prototype.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)},t}(),ue=y.Internals.ScheduledObserver=function(){function t(e,n){t.super_.constructor.call(this),this.scheduler=e,this.observer=n,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new F}return C(t,ie),t.prototype.next=function(t){var e=this;this.queue.push(function(){e.observer.onNext(t)})},t.prototype.error=function(t){var e=this;this.queue.push(function(){e.observer.onError(t)})},t.prototype.completed=function(){var t=this;this.queue.push(function(){t.observer.onCompleted()})},t.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()}))},t.prototype.dispose=function(){t.super_.dispose.call(this),this.disposable.dispose()},t}(),ce=function(){function t(){t.super_.constructor.apply(this,arguments)}return C(t,ue),t.prototype.next=function(e){t.super_.next.call(this,e),this.ensureActive()},t.prototype.error=function(e){t.super_.error.call(this,e),this.ensureActive()},t.prototype.completed=function(){t.super_.completed.call(this),this.ensureActive()},t}(),ae=y.Observable=function(){function t(t){this._subscribe=t}return re=t.prototype,re.finalValue=function(){var t=this;return new xe(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(w))})})},re.subscribe=re.forEach=function(t,e,n){var r;return r=0===arguments.length||arguments.length>1||"function"==typeof t?ne(t,e,n):t,this._subscribe(r)},re.toArray=function(){function t(t,e){return t.push(e),t.slice(0)}return this.scan([],t).startWith([]).finalValue()},t}();ae.start=function(t,e){return he(t,e)()};var he=ae.toAsync=function(t,n,r){return n||(n=H),function(){var i=x.call(arguments,0),o=new Se;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()}};re.observeOn=function(t){var e=this;return new xe(function(n){return e.subscribe(new ce(t,n))})},re.subscribeOn=function(t){var e=this;return new xe(function(n){var r=new I,i=new F;return i.setDisposable(r),r.setDisposable(t.schedule(function(){i.setDisposable(new f(t,e.subscribe(n)))})),i})},ae.create=function(t){return new xe(function(e){return T(t(e))})},ae.createWithDisposable=function(t){return new xe(t)};var le=ae.defer=function(t){return new xe(function(e){var n;try{n=t()}catch(r){return ve(r).subscribe(e)}return n.subscribe(e)})},fe=ae.empty=function(t){return t||(t=z),new xe(function(e){return t.schedule(function(){e.onCompleted()})})},pe=ae.fromArray=function(t,e){return e||(e=L),new xe(function(n){var r=0;return e.scheduleRecursive(function(e){t.length>r?(n.onNext(t[r++]),e()):n.onCompleted()})})};ae.generate=function(t,n,r,i,o){return o||(o=L),new xe(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 de=ae.never=function(){return new xe(function(){return j})};ae.range=function(t,e,n){return n||(n=L),new xe(function(r){return n.scheduleRecursiveWithState(0,function(n,i){e>n?(r.onNext(t+n),i(n+1)):r.onCompleted()})})},ae.repeat=function(t,n,r){return r||(r=L),n==e&&(n=-1),be(t,r).repeat(n)};var be=ae.returnValue=function(t,e){return e||(e=z),new xe(function(n){return e.schedule(function(){n.onNext(t),n.onCompleted()})})},ve=ae.throwException=function(t,e){return e||(e=z),new xe(function(n){return e.schedule(function(){n.onError(t)})})};ae.using=function(t,e){return new xe(function(n){var r,i,o=j;try{r=t(),r&&(o=r),i=e(r)}catch(s){return new O(ve(s).subscribe(n),o)}return new O(i.subscribe(n),o)})},re.amb=function(t){var e=this;return new xe(function(n){function r(){o||(o=s,a.dispose())}function i(){o||(o=u,c.dispose())}var o,s="L",u="R",c=new I,a=new I;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 O(c,a)})},ae.amb=function(){function t(t,e){return t.amb(e)}for(var e=de(),n=h(arguments,0),r=0,i=n.length;i>r;r++)e=t(e,n[r]);return e},re.catchException=function(t){return"function"==typeof t?d(this,t):me([this,t])};var me=ae.catchException=function(){var t=h(arguments,0);return te(t).catchException()};re.combineLatest=function(){var t=x.call(arguments);return Array.isArray(t[0])?t[0].unshift(this):t.unshift(this),ye.apply(this,t)};var ye=ae.combineLatest=function(){var t=x.call(arguments),n=t.pop();return Array.isArray(t[0])&&(t=t[0]),new xe(function(r){function i(t){var i;if(c[t]=!0,a||(a=c.every(function(t){return t}))){try{i=n.apply(null,f)}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=l(u,s),a=!1,h=l(u,s),f=Array(u),p=Array(u),d=0;u>d;d++)(function(e){p[e]=new I,p[e].setDisposable(t[e].subscribe(function(t){f[e]=t,i(e)},r.onError.bind(r),function(){o(e)}))})(d);return new O(p)})};re.concat=function(){var t=x.call(arguments,0);return t.unshift(this),we.apply(this,t)};var we=ae.concat=function(){var t=h(arguments,0);return te(t).concat()};re.concatObservable=re.concatAll=function(){return this.merge(1)},re.merge=function(t){if("number"!=typeof t)return ge(this,t);var e=this;return new xe(function(n){var r=0,i=new O,o=!1,s=[],u=function(t){var e=new I;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 ge=ae.merge=function(){var t,e;return arguments[0]?arguments[0].now?(t=arguments[0],e=x.call(arguments,1)):(t=z,e=x.call(arguments,0)):(t=z,e=x.call(arguments,1)),Array.isArray(e[0])&&(e=e[0]),pe(e,t).mergeObservable()};re.mergeObservable=re.mergeAll=function(){var t=this;return new xe(function(e){var n=new O,r=!1,i=new I;return n.add(i),i.setDisposable(t.subscribe(function(t){var i=new I;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})},re.onErrorResumeNext=function(t){if(!t)throw Error("Second observable is required");return Ee([this,t])};var Ee=ae.onErrorResumeNext=function(){var t=h(arguments,0);return new xe(function(e){var n=0,r=new F,i=z.scheduleRecursive(function(i){var o,s;t.length>n?(o=t[n++],s=new I,r.setDisposable(s),s.setDisposable(o.subscribe(e.onNext.bind(e),function(){i()},function(){i()}))):e.onCompleted()});return new O(r,i)})};re.skipUntil=function(t){var e=this;return new xe(function(n){var r=!1,i=new O(e.subscribe(function(t){r&&n.onNext(t)},n.onError.bind(n),function(){r&&n.onCompleted()})),o=new I;return i.add(o),o.setDisposable(t.subscribe(function(){r=!0,o.dispose()},n.onError.bind(n),function(){o.dispose()})),i})},re.switchLatest=function(){var t=this;return new xe(function(e){var n=!1,r=new F,i=!1,o=0,s=t.subscribe(function(t){var s=new I,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 O(s,r)})},re.takeUntil=function(t){var e=this;return new xe(function(r){return new O(e.subscribe(r),t.subscribe(r.onCompleted.bind(r),r.onError.bind(r),n))})},re.zip=function(){if(Array.isArray(arguments[0]))return b.apply(this,arguments);var t=this,n=x.call(arguments),r=n.pop();return n.unshift(t),new xe(function(i){function o(t){c[t]=!0,c.every(function(t){return t})&&i.onCompleted()}for(var s=n.length,u=l(s,function(){return[]}),c=l(s,function(){return!1}),a=function(n){var o,s;if(u.every(function(t){return t.length>0})){try{s=u.map(function(t){return t.shift()}),o=r.apply(t,s)}catch(a){return i.onError(a),e}i.onNext(o)}else c.filter(function(t,e){return e!==n}).every(function(t){return t})&&i.onCompleted()},h=Array(s),f=0;s>f;f++)(function(t){h[t]=new I,h[t].setDisposable(n[t].subscribe(function(e){u[t].push(e),a(t)},i.onError.bind(i),function(){o(t)}))})(f);return new O(h)})},re.asObservable=function(){var t=this;return new xe(function(e){return t.subscribe(e)})},re.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})},re.dematerialize=function(){var t=this;return new xe(function(e){return t.subscribe(function(t){return t.accept(e)},e.onError.bind(e),e.onCompleted.bind(e))})},re.distinctUntilChanged=function(t,n){var i=this;return t||(t=r),n||(n=o),new xe(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))})},re.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 xe(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()})})},re.finallyAction=function(t){var e=this;return new xe(function(n){var r=e.subscribe(n);return T(function(){try{r.dispose()}catch(e){throw e}finally{t()}})})},re.ignoreElements=function(){var t=this;return new xe(function(e){return t.subscribe(n,e.onError.bind(e),e.onCompleted.bind(e))})},re.materialize=function(){var t=this;return new xe(function(e){return t.subscribe(function(t){e.onNext(J(t))},function(t){e.onNext(K(t)),e.onCompleted()},function(){e.onNext(Q()),e.onCompleted()})})},re.repeat=function(t){return $(this,t).concat()},re.retry=function(t){return $(this,t).catchException()},re.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 le(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})})},re.skipLast=function(t){var e=this;return new xe(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))})},re.startWith=function(){var t,n,r=0;return arguments.length>0&&null!=arguments[0]&&arguments[0].now!==e?(n=arguments[0],r=1):n=z,t=x.call(arguments,r),te([pe(t,n),this]).concat()},re.takeLast=function(t,e){return this.takeLastBuffer(t).selectMany(function(t){return pe(t,e)})},re.takeLastBuffer=function(t){var e=this;return new xe(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()
})})},re.windowWithCount=function(t,e){var n=this;if(0>=t)throw Error(g);if(null==e&&(e=t),0>=e)throw Error(g);return new xe(function(r){var i=new I,o=new P(i),s=0,u=[],c=function(){var t=new De;u.push(t),r.onNext(D(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})},re.defaultIfEmpty=function(t){var n=this;return t===e&&(t=null),new xe(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()})})},re.distinct=function(t,n){var i=this;return t||(t=r),n||(n=u),new xe(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))})},re.groupBy=function(t,e,n){return this.groupByUntil(t,e,function(){return de()},n)},re.groupByUntil=function(t,i,o,s){var c=this;return i||(i=r),s||(s=u),new xe(function(r){var u={},a=new O,h=new P(a);return a.add(c.subscribe(function(c){var l,f,p,d,b,v,m,y,w,g,E;try{m=t(c),y=s(m)}catch(x){for(E in u)u[E].onError(x);return r.onError(x),e}b=!1;try{g=u[y],g||(g=new De,u[y]=g,b=!0)}catch(x){for(E in u)u[E].onError(x);return r.onError(x),e}if(b){v=new Ce(m,g,h),f=new Ce(m,g);try{l=o(f)}catch(x){for(E in u)u[E].onError(x);return r.onError(x),e}r.onNext(v),w=new I,a.add(w),d=function(){y in u&&(delete u[y],g.onCompleted()),a.remove(w)},w.setDisposable(l.take(1).subscribe(n,function(t){for(E in u)u[E].onError(t);r.onError(t)},function(){d()}))}try{p=i(c)}catch(x){for(E in u)u[E].onError(x);return r.onError(x),e}g.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})},re.select=re.map=function(t){var n=this;return new xe(function(r){var i=0;return n.subscribe(function(n){var o;try{o=t(n,i++)}catch(s){return r.onError(s),e}r.onNext(o)},r.onError.bind(r),r.onCompleted.bind(r))})},re.selectMany=re.flatMap=function(t,e){return e?this.selectMany(function(n){return t(n).select(function(t){return e(n,t)})}):"function"==typeof t?v.call(this,t):v.call(this,function(){return t})},re.skip=function(t){if(0>t)throw Error(g);var e=this;return new xe(function(n){var r=t;return e.subscribe(function(t){0>=r?n.onNext(t):r--},n.onError.bind(n),n.onCompleted.bind(n))})},re.skipWhile=function(t){var n=this;return new xe(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))})},re.take=function(t,e){if(0>t)throw Error(g);if(0===t)return fe(e);var n=this;return new xe(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))})},re.takeWhile=function(t){var n=this;return new xe(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))})},re.where=re.filter=function(t){var n=this;return new xe(function(r){var i=0;return n.subscribe(function(n){var 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))})};var xe=y.Internals.AnonymousObservable=function(){function t(e){var n=function(t){var n=new Ae(t);if(L.scheduleRequired())L.schedule(function(){try{n.disposable(e(n))}catch(t){if(!n.fail(t))throw t}});else try{n.disposable(e(n))}catch(r){if(!n.fail(r))throw r}return n};t.super_.constructor.call(this,n)}return C(t,ae),t}(),Ae=function(){function t(e){t.super_.constructor.call(this),this.observer=e,this.m=new I}return C(t,ie),t.prototype.next=function(t){var e=!1;try{this.observer.onNext(t),e=!0}catch(n){throw n}finally{e||this.dispose()}},t.prototype.error=function(t){try{this.observer.onError(t)}catch(e){throw e}finally{this.dispose()}},t.prototype.completed=function(){try{this.observer.onCompleted()}catch(t){throw t}finally{this.dispose()}},t.prototype.disposable=function(t){return this.m.disposable(t)},t.prototype.dispose=function(){t.super_.dispose.call(this),this.m.dispose()},t}(),Ce=function(){function t(t){return this.underlyingObservable.subscribe(t)}function e(n,r,i){e.super_.constructor.call(this,t),this.key=n,this.underlyingObservable=i?new xe(function(t){return new O(i.getDisposable(),r.subscribe(t))}):r}return C(e,ae),e}(),_e=function(t,e){this.subject=t,this.observer=e};_e.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 De=y.Subject=function(){function t(t){return a.call(this),this.isStopped?this.exception?(t.onError(this.exception),j):(t.onCompleted(),j):(this.observers.push(t),new _e(this,t))}function e(){e.super_.constructor.call(this,t),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return C(e,ae),_(e.prototype,ee,{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}}),e.create=function(t,e){return new Ne(t,e)},e}(),Se=y.AsyncSubject=function(){function t(t){if(a.call(this),!this.isStopped)return this.observers.push(t),new _e(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(),j}function e(){e.super_.constructor.call(this,t),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return C(e,ae),_(e.prototype,ee,{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}}),e}(),Ne=function(){function t(t){return this.observable.subscribe(t)}function e(n,r){e.super_.constructor.call(this,t),this.observer=n,this.observable=r}return C(e,ae),_(e.prototype,ee,{onCompleted:function(){this.observer.onCompleted()},onError:function(t){this.observer.onError(t)},onNext:function(t){this.observer.onNext(t)}}),e}();return"function"==typeof define&&"object"==typeof define.amd&&define.amd?(t.Rx=y,define(function(){return y})):(m?"object"==typeof module&&module&&module.exports==m?module.exports=y:m=y:t.Rx=y,e)})(this);
(function(t,e){function n(){}function r(t){return t}function i(){return(new Date).getTime()}function o(t,e){return 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(E)}function h(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:x.call(t)}function l(t,e){for(var n=Array(t),r=0;t>r;r++)n[r]=e();return n}function f(t,e){this.scheduler=t,this.disposable=e,this.isDisposed=!1}function p(t,e,n,r,i){this.scheduler=t,this.state=e,this.action=n,this.dueTime=r,this.comparer=i||s,this.disposable=new I}function d(t,n){return new Ce(function(r){var i=new I,o=new P;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 I,o.setDisposable(i),i.setDisposable(s.subscribe(r))},r.onCompleted.bind(r))),o})}function b(t,n){var r=this;return new Ce(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 v(t){return this.select(t).mergeObservable()}var m="object"==typeof exports&&exports&&("object"==typeof global&&global&&global==global.global&&(t=global),exports),y={Internals:{}},w="Sequence contains no elements.",g="Argument out of range",E="Object has been disposed",x=Array.prototype.slice;({}).hasOwnProperty;var C=this.inherits=y.Internals.inherits=function(t,e){function n(){this.constructor=t}n.prototype=e.prototype,t.prototype=new n},D=y.Internals.addProperties=function(t){for(var e=x.call(arguments,1),n=0,r=e.length;r>n;n++){var i=e[n];for(var o in i)t[o]=i[o]}},A=y.Internals.addRef=function(t,e){return new Ce(function(n){return new O(e.getDisposable(),t.subscribe(n))})};Function.prototype.bind||(Function.prototype.bind=function(t){var e=this,n=x.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(x.call(arguments)));return Object(s)===s?s:o}return e.apply(t,n.concat(x.call(arguments)))};return r});var S=Object("a"),_="a"!=S[0]||!(0 in S);Array.prototype.every||(Array.prototype.every=function(t){var e=Object(this),n=_&&"[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=_&&"[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 N=function(t,e){this.id=t,this.value=e};N.prototype.compareTo=function(t){var e=this.value.compareTo(t.value);return 0===e&&(e=this.id-t.id),e};var W=function(t){this.items=Array(t),this.length=0},R=W.prototype;R.isHigherPriority=function(t,e){return 0>this.items[t].compareTo(this.items[e])},R.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)}}},R.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)}}},R.peek=function(){return this.items[0].value},R.removeAt=function(t){this.items[t]=this.items[--this.length],delete this.items[this.length],this.heapify()},R.dequeue=function(){var t=this.peek();return this.removeAt(0),t},R.enqueue=function(t){var e=this.length++;this.items[e]=new N(W.count++,t),this.percolate(e)},R.remove=function(t){for(var e=0;this.length>e;e++)if(this.items[e].value===t)return this.removeAt(e),!0;return!1},W.count=0;var O=y.CompositeDisposable=function(){this.disposables=h(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},k=O.prototype;k.add=function(t){this.isDisposed?t.dispose():(this.disposables.push(t),this.length++)},k.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},k.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()}},k.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()},k.contains=function(t){return-1!==this.disposables.indexOf(t)},k.toArray=function(){return this.disposables.slice(0)};var q=y.Disposable=function(t){this.isDisposed=!1,this.action=t};q.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var T=q.create=function(t){return new q(t)},j=q.empty={dispose:n},I=y.SingleAssignmentDisposable=function(){this.isDisposed=!1,this.current=null},M=I.prototype;M.disposable=function(t){return t?this.setDisposable(t):this.getDisposable()},M.getDisposable=function(){return this.current},M.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()},M.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()};var P=y.SerialDisposable=function(){this.isDisposed=!1,this.current=null};P.prototype.getDisposable=function(){return this.current},P.prototype.setDisposable=function(t){var e,n=this.isDisposed;n||(e=this.current,this.current=t),e&&e.dispose(),n&&t&&t.dispose()},P.prototype.disposable=function(t){return t?(this.setDisposable(t),e):this.getDisposable()},P.prototype.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()};var L=y.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?j:new t(this)},e}();f.prototype.dispose=function(){var t=this;this.scheduler.schedule(function(){t.isDisposed||(t.isDisposed=!0,t.disposable.dispose())})},p.prototype.invoke=function(){this.disposable.disposable(this.invokeCore())},p.prototype.compareTo=function(t){return this.comparer(this.dueTime,t.dueTime)},p.prototype.isCancelled=function(){return this.disposable.isDisposed},p.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var V=y.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 O,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),j});r||(i.add(s),n=!0)})};return o(n),i}function r(t,e,n){var r=e.first,i=e.second,o=new O,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),j});u||(o.add(c),i=!0)})};return s(r),o}function o(t,e){return e(),j}var s=e.prototype;return s.catchException=function(t){return new G(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 T(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}(),z="Scheduler is not allowed to block the thread",F=V.immediate=function(){function t(t,e){return e(this,t)}function e(t,e,n){if(e>0)throw Error(z);return n(this,t)}function n(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new V(i,t,e,n)}(),B=V.currentThread=function(){function t(){o=new W(4)}function e(t,e){return this.scheduleWithRelativeAndState(t,0,e)}function n(e,n,r){var i,s=this.now()+V.normalize(n),u=new p(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-V.now()>0;);t.isCancelled()||t.invoke()}};var s=new V(i,e,n,r);return s.scheduleRequired=function(){return null===o},s.ensureTrampoline=function(t){return null===o?this.schedule(t):t()},s}(),H=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 I;return this._cancel=e,e.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,t.bind(this))),e},e}();y.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(),j}function u(e,s){this.clock=e,this.comparer=s,this.isEnabled=!1,this.queue=new W(1024),t.call(this,n,r,i,o)}C(u,t);var c=u.prototype;return c.schedulePeriodicWithState=function(t,e,n){var r=new H(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(g);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(g);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(g);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 p(r,t,i,e,r.comparer);return r.queue.enqueue(o),o.disposable},u}(V),y.HistoricalScheduler=function(t){function e(e,n){var r=null==e?0:e,i=n||s;t.call(this,r,i)}C(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}(y.VirtualTimeScheduler);var U=V.timeout=function(){function r(){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 o(t){if("string"==typeof t.data&&t.data.substring(0,l.length)===l){var e=t.data.substring(l.length),n=f[e];n(),delete f[e]}}function s(t,e){var n=this,r=new I,i=a(function(){r.isDisposed||r.setDisposable(e(n,t))});return new O(r,T(function(){h(i)}))}function u(e,n,r){var i=this,o=V.normalize(n);if(0===o)return i.scheduleWithState(e,r);var s=new I,u=t.setTimeout(function(){s.isDisposed||s.setDisposable(r(i,e))},o);return new O(s,T(function(){t.clearTimeout(u)}))}function c(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}var a,h=n;if(t.process!==e&&"[object process]"==typeof t.process)a=t.process.nextTick;else if("function"==typeof t.setImmediate)a=t.setImmediate,h=t.clearImmediate;else if(r()){var l="ms.rx.schedule"+Math.random(),f={},p=0;t.addEventListener?t.addEventListener("message",o,!1):t.attachEvent("onmessage",o,!1),a=function(e){var n=p++;f[n]=e,t.postMessage(l+n,"*")}}else if(t.MessageChannel)a=function(e){var n=new t.MessageChannel;n.port1.onmessage=function(){e()},n.port2.postMessage()};else if("document"in t&&"onreadystatechange"in t.document.createElement("script")){var d=t.document.createElement("script");d.onreadystatechange=function(){action(),d.onreadystatechange=null,d.parentNode.removeChild(d),d=null},t.document.documentElement.appendChild(d)}else a=function(e){return t.setTimeout(e,0)},h=t.clearTimeout;return new V(i,s,u,c)}(),G=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 C(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 j}}},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 I;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}(V),J=y.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||F,new Ce(function(n){return t.schedule(function(){e._acceptObservable(n),"N"===e.kind&&n.onCompleted()})})},e.equals=function(t){var e=null==t?"":""+t;return""+this===e},t}(),K=J.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 J("N",!0);return i.value=r,i._accept=t.bind(i),i._acceptObservable=e.bind(i),i.toString=n.bind(i),i}}(),Q=J.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 J("E");return i.exception=r,i._accept=t.bind(i),i._acceptObservable=e.bind(i),i.toString=n.bind(i),i}}(),X=J.createOnCompleted=function(){function t(t,e,n){return n()}function e(t){return t.onCompleted()}function n(){return"OnCompleted()"}return function(){var r=new J("C");return r._accept=t.bind(r),r._acceptObservable=e.bind(r),r.toString=n.bind(r),r}}(),Y=y.Internals.Enumerator=function(t,e,n){this.moveNext=t,this.getCurrent=e,this.dispose=n},Z=Y.create=function(t,e,r){var i=!1;return r||(r=n),new Y(function(){if(i)return!1;var e=t();return e||(i=!0,r()),e},function(){return e()},function(){i||(r(),i=!0)})},$=y.Internals.Enumerable=function(){function t(t){this.getEnumerator=t}return t.prototype.concat=function(){var t=this;return new Ce(function(n){var r=t.getEnumerator(),i=!1,o=new P,s=F.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 I;o.setDisposable(h),h.setDisposable(s.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){t()}))}});return new O(o,s,T(function(){i=!0,r.dispose()}))})},t.prototype.catchException=function(){var t=this;return new Ce(function(n){var r,i=t.getEnumerator(),o=!1,s=new P,u=F.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 I;s.setDisposable(l),l.setDisposable(u.subscribe(n.onNext.bind(n),function(e){r=e,t()},n.onCompleted.bind(n)))}});return new O(s,u,T(function(){o=!0}))})},t}(),te=$.repeat=function(t,n){return n===e&&(n=-1),new $(function(){var e,r=n;return Z(function(){return 0===r?!1:(r>0&&r--,e=t,!0)},function(){return e})})},ee=$.forEach=function(t,e){return e||(e=r),new $(function(){var n,r=-1;return Z(function(){return++r<t.length?(n=e(t[r],r),!0):!1},function(){return n})})},ne=y.Observer=function(){};ne.prototype.toNotifier=function(){var t=this;return function(e){return e.accept(t)}},ne.prototype.asObserver=function(){return new se(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},ne.prototype.checked=function(){return new ue(this)};var re=ne.create=function(t,e,r){return t||(t=n),e||(e=c),r||(r=n),new se(t,e,r)};ne.fromNotifier=function(t){return new se(function(e){return t(K(e))},function(e){return t(Q(e))},function(){return t(X())})};var ie,oe=y.Internals.AbstractObserver=function(t){function e(){this.isStopped=!1,t.call(this)}return C(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}(ne),se=y.AnonymousObserver=function(t){function e(e,n,r){t.call(this),this._onNext=e,this._onError=n,this._onCompleted=r}return C(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}(oe),ue=function(t){function e(e){t.call(this),this._observer=e,this._state=0}C(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}(ne),ce=y.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 P}return C(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}(oe),ae=function(t){function e(){t.apply(this,arguments)}return C(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}(ce),he=y.Observable=function(){function t(t){this._subscribe=t}return ie=t.prototype,ie.finalValue=function(){var t=this;return new Ce(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(w))})})},ie.subscribe=ie.forEach=function(t,e,n){var r;return r="object"==typeof t?t:re(t,e,n),this._subscribe(r)},ie.toArray=function(){function t(t,e){var n=t.slice(0);return n.push(e),n}return this.scan([],t).startWith([]).finalValue()},t}();he.start=function(t,e){return le(t,e)()};var le=he.toAsync=function(t,n,r){return n||(n=U),function(){var i=x.call(arguments,0),o=new Ne;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()}};ie.observeOn=function(t){var e=this;return new Ce(function(n){return e.subscribe(new ae(t,n))})},ie.subscribeOn=function(t){var e=this;return new Ce(function(n){var r=new I,i=new P;return i.setDisposable(r),r.setDisposable(t.schedule(function(){i.setDisposable(new f(t,e.subscribe(n)))})),i})},he.create=function(t){return new Ce(function(e){return T(t(e))})},he.createWithDisposable=function(t){return new Ce(t)};var fe=he.defer=function(t){return new Ce(function(e){var n;try{n=t()}catch(r){return me(r).subscribe(e)}return n.subscribe(e)})},pe=he.empty=function(t){return t||(t=F),new Ce(function(e){return t.schedule(function(){e.onCompleted()})})},de=he.fromArray=function(t,e){return e||(e=B),new Ce(function(n){var r=0;return e.scheduleRecursive(function(e){t.length>r?(n.onNext(t[r++]),e()):n.onCompleted()})})};he.generate=function(t,n,r,i,o){return o||(o=B),new Ce(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 be=he.never=function(){return new Ce(function(){return j})};he.range=function(t,e,n){return n||(n=B),new Ce(function(r){return n.scheduleRecursiveWithState(0,function(n,i){e>n?(r.onNext(t+n),i(n+1)):r.onCompleted()})})},he.repeat=function(t,n,r){return r||(r=B),n==e&&(n=-1),ve(t,r).repeat(n)};var ve=he.returnValue=function(t,e){return e||(e=F),new Ce(function(n){return e.schedule(function(){n.onNext(t),n.onCompleted()})})},me=he.throwException=function(t,e){return e||(e=F),new Ce(function(n){return e.schedule(function(){n.onError(t)})})};he.using=function(t,e){return new Ce(function(n){var r,i,o=j;try{r=t(),r&&(o=r),i=e(r)}catch(s){return new O(me(s).subscribe(n),o)}return new O(i.subscribe(n),o)})},ie.amb=function(t){var e=this;return new Ce(function(n){function r(){o||(o=s,a.dispose())}function i(){o||(o=u,c.dispose())}var o,s="L",u="R",c=new I,a=new I;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 O(c,a)})},he.amb=function(){function t(t,e){return t.amb(e)}for(var e=be(),n=h(arguments,0),r=0,i=n.length;i>r;r++)e=t(e,n[r]);return e},ie.catchException=function(t){return"function"==typeof t?d(this,t):ye([this,t])};var ye=he.catchException=function(){var t=h(arguments,0);return ee(t).catchException()};ie.combineLatest=function(){var t=x.call(arguments);return Array.isArray(t[0])?t[0].unshift(this):t.unshift(this),we.apply(this,t)};var we=he.combineLatest=function(){var t=x.call(arguments),n=t.pop();return Array.isArray(t[0])&&(t=t[0]),new Ce(function(r){function i(t){var i;if(c[t]=!0,a||(a=c.every(function(t){return t}))){try{i=n.apply(null,f)}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=l(u,s),a=!1,h=l(u,s),f=Array(u),p=Array(u),d=0;u>d;d++)(function(e){p[e]=new I,p[e].setDisposable(t[e].subscribe(function(t){f[e]=t,i(e)},r.onError.bind(r),function(){o(e)}))})(d);return new O(p)})};ie.concat=function(){var t=x.call(arguments,0);return t.unshift(this),ge.apply(this,t)};var ge=he.concat=function(){var t=h(arguments,0);return ee(t).concat()};ie.concatObservable=ie.concatAll=function(){return this.merge(1)},ie.merge=function(t){if("number"!=typeof t)return Ee(this,t);var e=this;return new Ce(function(n){var r=0,i=new O,o=!1,s=[],u=function(t){var e=new I;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 Ee=he.merge=function(){var t,e;return arguments[0]?arguments[0].now?(t=arguments[0],e=x.call(arguments,1)):(t=F,e=x.call(arguments,0)):(t=F,e=x.call(arguments,1)),Array.isArray(e[0])&&(e=e[0]),de(e,t).mergeObservable()};ie.mergeObservable=ie.mergeAll=function(){var t=this;return new Ce(function(e){var n=new O,r=!1,i=new I;return n.add(i),i.setDisposable(t.subscribe(function(t){var i=new I;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})},ie.onErrorResumeNext=function(t){if(!t)throw Error("Second observable is required");return xe([this,t])};var xe=he.onErrorResumeNext=function(){var t=h(arguments,0);return new Ce(function(e){var n=0,r=new P,i=F.scheduleRecursive(function(i){var o,s;t.length>n?(o=t[n++],s=new I,r.setDisposable(s),s.setDisposable(o.subscribe(e.onNext.bind(e),function(){i()},function(){i()}))):e.onCompleted()});return new O(r,i)})};ie.skipUntil=function(t){var e=this;return new Ce(function(n){var r=!1,i=new O(e.subscribe(function(t){r&&n.onNext(t)},n.onError.bind(n),function(){r&&n.onCompleted()})),o=new I;return i.add(o),o.setDisposable(t.subscribe(function(){r=!0,o.dispose()},n.onError.bind(n),function(){o.dispose()})),i})},ie.switchLatest=function(){var t=this;return new Ce(function(e){var n=!1,r=new P,i=!1,o=0,s=t.subscribe(function(t){var s=new I,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 O(s,r)})},ie.takeUntil=function(t){var e=this;return new Ce(function(r){return new O(e.subscribe(r),t.subscribe(r.onCompleted.bind(r),r.onError.bind(r),n))})},ie.zip=function(){if(Array.isArray(arguments[0]))return b.apply(this,arguments);var t=this,n=x.call(arguments),r=n.pop();return n.unshift(t),new Ce(function(i){function o(t){c[t]=!0,c.every(function(t){return t})&&i.onCompleted()}for(var s=n.length,u=l(s,function(){return[]}),c=l(s,function(){return!1}),a=function(n){var o,s;if(u.every(function(t){return t.length>0})){try{s=u.map(function(t){return t.shift()}),o=r.apply(t,s)}catch(a){return i.onError(a),e}i.onNext(o)}else c.filter(function(t,e){return e!==n}).every(function(t){return t})&&i.onCompleted()},h=Array(s),f=0;s>f;f++)(function(t){h[t]=new I,h[t].setDisposable(n[t].subscribe(function(e){u[t].push(e),a(t)},i.onError.bind(i),function(){o(t)}))})(f);return new O(h)})},he.zip=function(t,e){var n=t[0],r=t.slice(1);return r.push(e),n.zip.apply(n,r)},ie.asObservable=function(){var t=this;return new Ce(function(e){return t.subscribe(e)})},ie.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})},ie.dematerialize=function(){var t=this;return new Ce(function(e){return t.subscribe(function(t){return t.accept(e)},e.onError.bind(e),e.onCompleted.bind(e))})},ie.distinctUntilChanged=function(t,n){var i=this;return t||(t=r),n||(n=o),new Ce(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))})},ie.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 Ce(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()})})},ie.finallyAction=function(t){var e=this;return new Ce(function(n){var r=e.subscribe(n);return T(function(){try{r.dispose()}catch(e){throw e}finally{t()}})})},ie.ignoreElements=function(){var t=this;return new Ce(function(e){return t.subscribe(n,e.onError.bind(e),e.onCompleted.bind(e))})},ie.materialize=function(){var t=this;return new Ce(function(e){return t.subscribe(function(t){e.onNext(K(t))},function(t){e.onNext(Q(t)),e.onCompleted()},function(){e.onNext(X()),e.onCompleted()})})},ie.repeat=function(t){return te(this,t).concat()},ie.retry=function(t){return te(this,t).catchException()},ie.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 fe(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})})},ie.skipLast=function(t){var e=this;return new Ce(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))
})},ie.startWith=function(){var t,n,r=0;return arguments.length>0&&null!=arguments[0]&&arguments[0].now!==e?(n=arguments[0],r=1):n=F,t=x.call(arguments,r),ee([de(t,n),this]).concat()},ie.takeLast=function(t,e){return this.takeLastBuffer(t).selectMany(function(t){return de(t,e)})},ie.takeLastBuffer=function(t){var e=this;return new Ce(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()})})},ie.windowWithCount=function(t,e){var n=this;if(0>=t)throw Error(g);if(null==e&&(e=t),0>=e)throw Error(g);return new Ce(function(r){var i=new I,o=new L(i),s=0,u=[],c=function(){var t=new _e;u.push(t),r.onNext(A(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})},ie.defaultIfEmpty=function(t){var n=this;return t===e&&(t=null),new Ce(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()})})},ie.distinct=function(t,n){var i=this;return t||(t=r),n||(n=u),new Ce(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))})},ie.groupBy=function(t,e,n){return this.groupByUntil(t,e,function(){return be()},n)},ie.groupByUntil=function(t,i,o,s){var c=this;return i||(i=r),s||(s=u),new Ce(function(r){var u={},a=new O,h=new L(a);return a.add(c.subscribe(function(c){var l,f,p,d,b,v,m,y,w,g,E;try{m=t(c),y=s(m)}catch(x){for(E in u)u[E].onError(x);return r.onError(x),e}b=!1;try{g=u[y],g||(g=new _e,u[y]=g,b=!0)}catch(x){for(E in u)u[E].onError(x);return r.onError(x),e}if(b){v=new Ae(m,g,h),f=new Ae(m,g);try{l=o(f)}catch(x){for(E in u)u[E].onError(x);return r.onError(x),e}r.onNext(v),w=new I,a.add(w),d=function(){y in u&&(delete u[y],g.onCompleted()),a.remove(w)},w.setDisposable(l.take(1).subscribe(n,function(t){for(E in u)u[E].onError(t);r.onError(t)},function(){d()}))}try{p=i(c)}catch(x){for(E in u)u[E].onError(x);return r.onError(x),e}g.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})},ie.select=function(t,n){var r=this;return new Ce(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))})},ie.map=ie.select,ie.selectMany=ie.flatMap=function(t,e){return e?this.selectMany(function(n){return t(n).select(function(t){return e(n,t)})}):"function"==typeof t?v.call(this,t):v.call(this,function(){return t})},ie.skip=function(t){if(0>t)throw Error(g);var e=this;return new Ce(function(n){var r=t;return e.subscribe(function(t){0>=r?n.onNext(t):r--},n.onError.bind(n),n.onCompleted.bind(n))})},ie.skipWhile=function(t){var n=this;return new Ce(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))})},ie.take=function(t,e){if(0>t)throw Error(g);if(0===t)return pe(e);var n=this;return new Ce(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))})},ie.takeWhile=function(t){var n=this;return new Ce(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))})},ie.where=function(t,n){var r=this;return new Ce(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))})},ie.filter=ie.where;var Ce=y.Internals.AnonymousObservable=function(t){function e(e){function n(t){var n=new De(t);if(B.scheduleRequired())B.schedule(function(){try{n.disposable(e(n))}catch(t){if(!n.fail(t))throw t}});else try{n.disposable(e(n))}catch(r){if(!n.fail(r))throw r}return n}t.call(this,n)}return C(e,t),e}(he),De=function(t){function e(e){t.call(this),this.observer=e,this.m=new I}C(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}(oe),Ae=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 Ce(function(t){return new O(i.getDisposable(),r.subscribe(t))}):r}return C(n,t),n}(he),Se=function(t,e){this.subject=t,this.observer=e};Se.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 _e=y.Subject=function(t){function e(t){return a.call(this),this.isStopped?this.exception?(t.onError(this.exception),j):(t.onCompleted(),j):(this.observers.push(t),new Se(this,t))}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return C(n,t),D(n.prototype,ne,{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 We(t,e)},n}(he),Ne=y.AsyncSubject=function(t){function e(t){if(a.call(this),!this.isStopped)return this.observers.push(t),new Se(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(),j}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return C(n,t),D(n.prototype,ne,{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}(he),We=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 C(n,t),D(n.prototype,ne,{onCompleted:function(){this.observer.onCompleted()},onError:function(t){this.observer.onError(t)},onNext:function(t){this.observer.onNext(t)}}),n}(he);return"function"==typeof define&&"object"==typeof define.amd&&define.amd?(t.Rx=y,define(function(){return y})):(m?"object"==typeof module&&module&&module.exports==m?module.exports=y:m=y:t.Rx=y,e)})(this);

@@ -1,2 +0,2 @@

var Rx = require('./rx');
var Rx = require('./rx.modern');
require('./rx.aggregates');

@@ -3,0 +3,0 @@ require('./rx.binding');

@@ -18,16 +18,16 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.

}
}(this, function (global, exp, root, undefined) {
}(this, function (global, exp, Rx, undefined) {
// Defaults
var Observer = root.Observer,
Observable = root.Observable,
Notification = root.Notification,
VirtualTimeScheduler = root.VirtualTimeScheduler,
Disposable = root.Disposable,
var Observer = Rx.Observer,
Observable = Rx.Observable,
Notification = Rx.Notification,
VirtualTimeScheduler = Rx.VirtualTimeScheduler,
Disposable = Rx.Disposable,
disposableEmpty = Disposable.empty,
disposableCreate = Disposable.create,
CompositeDisposable = root.CompositeDisposable,
SingleAssignmentDisposable = root.SingleAssignmentDisposable,
CompositeDisposable = Rx.CompositeDisposable,
SingleAssignmentDisposable = Rx.SingleAssignmentDisposable,
slice = Array.prototype.slice,
inherits = root.Internals.inherits;
inherits = Rx.Internals.inherits;

@@ -48,6 +48,14 @@ // Utilities

// New predicate tests
/**
* @private
* @constructor
*/
function OnNextPredicate(predicate) {
this.predicate = predicate;
};
/**
* @private
* @memberOf OnNextPredicate#
*/
OnNextPredicate.prototype.equals = function (other) {

@@ -60,5 +68,14 @@ if (other === this) { return true; }

/**
* @private
* @constructor
*/
function OnErrorPredicate(predicate) {
this.predicate = predicate;
};
/**
* @private
* @memberOf OnErrorPredicate#
*/
OnErrorPredicate.prototype.equals = function (other) {

@@ -71,3 +88,7 @@ if (other === this) { return true; }

var ReactiveTest = root.ReactiveTest = {
/**
* @static
* type Object
*/
var ReactiveTest = Rx.ReactiveTest = {
/** Default virtual time used for creation of observable sequences in unit tests. */

@@ -134,10 +155,10 @@ created: 100,

/**
* Creates a new object recording the production of the specified value at the given virtual time.
*
* @constructor
* Creates a new object recording the production of the specified value at the given virtual time.
*
* @param time Virtual time the value was produced on.
* @param value Value that was produced.
* @param comparer An optional comparer.
* @param {Number} time Virtual time the value was produced on.
* @param {Mixed} value Value that was produced.
* @param {Function} comparer An optional comparer.
*/
var Recorded = root.Recorded = function (time, value, comparer) {
var Recorded = Rx.Recorded = function (time, value, comparer) {
this.time = time;

@@ -150,4 +171,5 @@ this.value = value;

* Checks whether the given recorded object is equal to the current instance.
* @param other Recorded object to check for equality.
* @return true if both objects are equal; false otherwise.
*
* @param {Recorded} other Recorded object to check for equality.
* @returns {Boolean} true if both objects are equal; false otherwise.
*/

@@ -160,3 +182,4 @@ Recorded.prototype.equals = function (other) {

* Returns a string representation of the current Recorded value.
* @return String representation of the current Recorded value.
*
* @returns {String} String representation of the current Recorded value.
*/

@@ -168,8 +191,9 @@ Recorded.prototype.toString = function () {

/**
* Creates a new subscription object with the given virtual subscription and unsubscription time.
*
* @constructor
* Creates a new subscription object with the given virtual subscription and unsubscription time.
* @param subscribe Virtual time at which the subscription occurred.
* @param unsubscribe Virtual time at which the unsubscription occurred.
* @param {Number} subscribe Virtual time at which the subscription occurred.
* @param {Number} unsubscribe Virtual time at which the unsubscription occurred.
*/
var Subscription = root.Subscription = function (start, end) {
var Subscription = Rx.Subscription = function (start, end) {
this.subscribe = start;

@@ -182,3 +206,3 @@ this.unsubscribe = end || Number.MAX_VALUE;

* @param other Subscription object to check for equality.
* @return true if both objects are equal; false otherwise.
* @returns {Boolean} true if both objects are equal; false otherwise.
*/

@@ -191,3 +215,3 @@ Subscription.prototype.equals = function (other) {

* Returns a string representation of the current Subscription value.
* @return String representation of the current Subscription value.
* @returns {String} String representation of the current Subscription value.
*/

@@ -198,3 +222,4 @@ Subscription.prototype.toString = function () {

var MockDisposable = root.MockDisposable = function (scheduler) {
/** @private */
var MockDisposable = Rx.MockDisposable = function (scheduler) {
this.scheduler = scheduler;

@@ -204,2 +229,7 @@ this.disposes = [];

};
/*
* @memberOf MockDisposable#
* @prviate
*/
MockDisposable.prototype.dispose = function () {

@@ -209,21 +239,48 @@ this.disposes.push(this.scheduler.clock);

var MockObserver = (function () {
inherits(MockObserver, Observer);
/** @private */
var MockObserver = (function (_super) {
inherits(MockObserver, _super);
/*
* @constructor
* @prviate
*/
function MockObserver(scheduler) {
_super.call(this);
this.scheduler = scheduler;
this.messages = [];
}
MockObserver.prototype.onNext = function (value) {
var MockObserverPrototype = MockObserver.prototype;
/*
* @memberOf MockObserverPrototype#
* @prviate
*/
MockObserverPrototype.onNext = function (value) {
this.messages.push(new Recorded(this.scheduler.clock, Notification.createOnNext(value)));
};
MockObserver.prototype.onError = function (exception) {
/*
* @memberOf MockObserverPrototype#
* @prviate
*/
MockObserverPrototype.onError = function (exception) {
this.messages.push(new Recorded(this.scheduler.clock, Notification.createOnError(exception)));
};
MockObserver.prototype.onCompleted = function () {
/*
* @memberOf MockObserverPrototype#
* @prviate
*/
MockObserverPrototype.onCompleted = function () {
this.messages.push(new Recorded(this.scheduler.clock, Notification.createOnCompleted()));
};
return MockObserver;
})();
})(Observer);
var HotObservable = (function () {
/** @private */
var HotObservable = (function (_super) {
function subscribe(observer) {

@@ -241,5 +298,10 @@ var observable = this;

inherits(HotObservable, Observable);
inherits(HotObservable, _super);
/**
* @private
* @constructor
*/
function HotObservable(scheduler, messages) {
HotObservable.super_.constructor.call(this, subscribe);
_super.call(this, subscribe);
var message, notification, observable = this;

@@ -265,5 +327,7 @@ this.scheduler = scheduler;

return HotObservable;
})();
})(Observable);
var ColdObservable = (function () {
/** @private */
var ColdObservable = (function (_super) {
function subscribe(observer) {

@@ -290,5 +354,10 @@ var message, notification, observable = this;

inherits(ColdObservable, Observable);
inherits(ColdObservable, _super);
/**
* @private
* @constructor
*/
function ColdObservable(scheduler, messages) {
ColdObservable.super_.constructor.call(this, subscribe);
_super.call(this, subscribe);
this.scheduler = scheduler;

@@ -300,11 +369,11 @@ this.messages = messages;

return ColdObservable;
})();
})(Observable);
/** Virtual time scheduler used for testing applications and libraries built using Reactive Extensions. */
root.TestScheduler = (function () {
inherits(TestScheduler, VirtualTimeScheduler);
Rx.TestScheduler = (function (_super) {
inherits(TestScheduler, _super);
/** @constructor */
function TestScheduler() {
TestScheduler.super_.constructor.call(this, 0, function (a, b) { return a - b; });
_super.call(this, 0, function (a, b) { return a - b; });
}

@@ -324,3 +393,3 @@

}
return TestScheduler.super_.scheduleAbsoluteWithState.call(this, state, dueTime, action);
return _super.prototype.scheduleAbsoluteWithState.call(this, state, dueTime, action);
};

@@ -431,5 +500,5 @@ /**

return TestScheduler;
})();
})(VirtualTimeScheduler);
return root;
return Rx;
}));

@@ -1,1 +0,1 @@

(function(t,e){var n="object"==typeof exports&&exports&&("object"==typeof t&&t&&t==t.global&&(window=t),exports);"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 e.equals?e.equals(t):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;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 m=n.ReactiveTest={created:100,subscribed:200,disposed:1e3,onNext:function(t,e){return"function"==typeof e?new y(t,new o(e)):new y(t,a.createOnNext(e))},onError:function(t,e){return"function"==typeof e?new y(t,new s(e)):new y(t,a.createOnError(e))},onCompleted:function(t){return new y(t,a.createOnCompleted())},subscribe:function(t,e){return new w(t,e)}},y=n.Recorded=function(t,e,n){this.time=t,this.value=e,this.comparer=n||r};y.prototype.equals=function(t){return this.time===t.time&&this.comparer(this.value,t.value)},y.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 g=n.MockDisposable=function(t){this.scheduler=t,this.disposes=[],this.disposes.push(this.scheduler.clock)};g.prototype.dispose=function(){this.disposes.push(this.scheduler.clock)};var x=function(){function t(t){this.scheduler=t,this.messages=[]}return v(t,u),t.prototype.onNext=function(t){this.messages.push(new y(this.scheduler.clock,a.createOnNext(t)))},t.prototype.onError=function(t){this.messages.push(new y(this.scheduler.clock,a.createOnError(t)))},t.prototype.onCompleted=function(){this.messages.push(new y(this.scheduler.clock,a.createOnCompleted()))},t}(),E=function(){function t(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 e(n,r){e.super_.constructor.call(this,t);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(e,c),e}(),C=function(){function t(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 e(n,r){e.super_.constructor.call(this,t),this.scheduler=n,this.messages=r,this.subscriptions=[]}return v(e,c),e}();return n.TestScheduler=function(){function t(){t.super_.constructor.call(this,0,function(t,e){return t-e})}return v(t,h),t.prototype.scheduleAbsoluteWithState=function(e,n,r){return this.clock>=n&&(n=this.clock+1),t.super_.scheduleAbsoluteWithState.call(this,e,n,r)},t.prototype.add=function(t,e){return t+e},t.prototype.toDateTimeOffset=function(t){return new Date(t).getTime()},t.prototype.toRelative=function(t){return t},t.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},t.prototype.startWithDispose=function(t,e){return this.startWithTiming(t,m.created,m.subscribed,e)},t.prototype.startWithCreate=function(t){return this.startWithTiming(t,m.created,m.subscribed,m.disposed)},t.prototype.createHotObservable=function(){var t=i(arguments,0);return new E(this,t)},t.prototype.createColdObservable=function(){var t=i(arguments,0);return new C(this,t)},t.prototype.createObserver=function(){return new x(this)},t}(),n});
(function(t,e){var n="object"==typeof exports&&exports&&("object"==typeof t&&t&&t==t.global&&(window=t),exports);"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 e.equals?e.equals(t):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;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 m=n.ReactiveTest={created:100,subscribed:200,disposed:1e3,onNext:function(t,e){return"function"==typeof e?new y(t,new o(e)):new y(t,a.createOnNext(e))},onError:function(t,e){return"function"==typeof e?new y(t,new s(e)):new y(t,a.createOnError(e))},onCompleted:function(t){return new y(t,a.createOnCompleted())},subscribe:function(t,e){return new w(t,e)}},y=n.Recorded=function(t,e,n){this.time=t,this.value=e,this.comparer=n||r};y.prototype.equals=function(t){return this.time===t.time&&this.comparer(this.value,t.value)},y.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 g=n.MockDisposable=function(t){this.scheduler=t,this.disposes=[],this.disposes.push(this.scheduler.clock)};g.prototype.dispose=function(){this.disposes.push(this.scheduler.clock)};var E=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 y(this.scheduler.clock,a.createOnNext(t)))},n.onError=function(t){this.messages.push(new y(this.scheduler.clock,a.createOnError(t)))},n.onCompleted=function(){this.messages.push(new y(this.scheduler.clock,a.createOnCompleted()))},e}(u),x=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),C=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,m.created,m.subscribed,e)},e.prototype.startWithCreate=function(t){return this.startWithTiming(t,m.created,m.subscribed,m.disposed)},e.prototype.createHotObservable=function(){var t=i(arguments,0);return new x(this,t)},e.prototype.createColdObservable=function(){var t=i(arguments,0);return new C(this,t)},e.prototype.createObserver=function(){return new E(this)},e}(h),n});

@@ -18,8 +18,8 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.

}
}(this, function (global, exp, root, undefined) {
}(this, function (global, exp, Rx, undefined) {
// Refernces
var Observable = root.Observable,
var Observable = Rx.Observable,
observableProto = Observable.prototype,
AnonymousObservable = root.Internals.AnonymousObservable,
AnonymousObservable = Rx.Internals.AnonymousObservable,
observableDefer = Observable.defer,

@@ -29,11 +29,11 @@ observableEmpty = Observable.empty,

observableFromArray = Observable.fromArray,
timeoutScheduler = root.Scheduler.timeout,
SingleAssignmentDisposable = root.SingleAssignmentDisposable,
SerialDisposable = root.SerialDisposable,
CompositeDisposable = root.CompositeDisposable,
RefCountDisposable = root.RefCountDisposable,
Subject = root.Subject,
BinaryObserver = root.Internals.BinaryObserver,
addRef = root.Internals.addRef,
normalizeTime = root.Scheduler.normalize;
timeoutScheduler = Rx.Scheduler.timeout,
SingleAssignmentDisposable = Rx.SingleAssignmentDisposable,
SerialDisposable = Rx.SerialDisposable,
CompositeDisposable = Rx.CompositeDisposable,
RefCountDisposable = Rx.RefCountDisposable,
Subject = Rx.Subject,
BinaryObserver = Rx.Internals.BinaryObserver,
addRef = Rx.Internals.addRef,
normalizeTime = Rx.Scheduler.normalize;

@@ -95,8 +95,11 @@ function observableTimerDate(dueTime, scheduler) {

*
* @example
* 1 - res = Rx.Observable.interval(1000);
* 2 - res = Rx.Observable.interval(1000, Rx.Scheduler.timeout);
*
* @param period Period for producing the values in the resulting sequence (specified as an integer denoting milliseconds).
* @param [scheduler] Scheduler to run the timer on. If not specified, Rx.Scheduler.timeout is used.
* @return An observable sequence that produces a value after each period.
*
* @static
* @memberOf Observable
* @param {Number} period Period for producing the values in the resulting sequence (specified as an integer denoting milliseconds).
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, Rx.Scheduler.timeout is used.
* @returns {Observable} An observable sequence that produces a value after each period.
*/

@@ -111,2 +114,3 @@ var observableinterval = Observable.interval = function (period, scheduler) {

*
* @example
* 1 - res = Rx.Observable.timer(new Date());

@@ -122,6 +126,8 @@ * 2 - res = Rx.Observable.timer(new Date(), 1000);

*
* @param dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) at which to produce the first value.
* @param [periodOrScheduler] Period to produce subsequent values (specified as an integer denoting milliseconds), or the scheduler to run the timer on. If not specified, the resulting timer is not recurring.
* @param [scheduler] Scheduler to run the timer on. If not specified, the timeout scheduler is used.
* @return An observable sequence that produces a value after due time has elapsed and then each period.
* @static
* @memberOf Observable
* @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) at which to produce the first value.
* @param {Mixed} [periodOrScheduler] Period to produce subsequent values (specified as an integer denoting milliseconds), or the scheduler to run the timer on. If not specified, the resulting timer is not recurring.
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence that produces a value after due time has elapsed and then each period.
*/

@@ -225,2 +231,3 @@ var observableTimer = Observable.timer = function (dueTime, periodOrScheduler, scheduler) {

*
* @example
* 1 - res = Rx.Observable.timer(new Date());

@@ -231,6 +238,6 @@ * 2 - res = Rx.Observable.timer(new Date(), Rx.Scheduler.timeout);

* 4 - res = Rx.Observable.delay(5000, 1000, Rx.Scheduler.timeout);
*
* @param dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) by which to shift the observable sequence.
* @param [scheduler] Scheduler to run the delay timers on. If not specified, the timeout scheduler is used.
* @return Time-shifted sequence.
* @memberOf Observable#
* @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) by which to shift the observable sequence.
* @param {Scheduler} [scheduler] Scheduler to run the delay timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} Time-shifted sequence.
*/

@@ -247,8 +254,10 @@ observableProto.delay = function (dueTime, scheduler) {

*
* @example
* 1 - res = source.throttle(5000); // 5 seconds
* 2 - res = source.throttle(5000, scheduler);
*
* @param dueTime Duration of the throttle period for each value (specified as an integer denoting milliseconds).
* @param [scheduler] Scheduler to run the throttle timers on. If not specified, the timeout scheduler is used.
* @return The throttled sequence.
*
* @memberOf Observable
* @param {Number} dueTime Duration of the throttle period for each value (specified as an integer denoting milliseconds).
* @param {Scheduler} [scheduler] Scheduler to run the throttle timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} The throttled sequence.
*/

@@ -295,9 +304,11 @@ observableProto.throttle = function (dueTime, scheduler) {

*
* @example
* 1 - res = xs.windowWithTime(1000, scheduler); // non-overlapping segments of 1 second
* 2 - res = xs.windowWithTime(1000, 500 , scheduler); // segments of 1 second with time shift 0.5 seconds
*
* @param timeSpan Length of each window (specified as an integer denoting milliseconds).
* @param [timeShiftOrScheduler] Interval between creation of consecutive windows (specified as an integer denoting milliseconds), or an optional scheduler parameter. If not specified, the time shift corresponds to the timeSpan parameter, resulting in non-overlapping adjacent windows.
* @param [scheduler] Scheduler to run windowing timers on. If not specified, the timeout scheduler is used.
* @return An observable sequence of windows.
*
* @memberOf Observable#
* @param {Number} timeSpan Length of each window (specified as an integer denoting milliseconds).
* @param {Mixed} [timeShiftOrScheduler] Interval between creation of consecutive windows (specified as an integer denoting milliseconds), or an optional scheduler parameter. If not specified, the time shift corresponds to the timeSpan parameter, resulting in non-overlapping adjacent windows.
* @param {Scheduler} [scheduler] Scheduler to run windowing timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence of windows.
*/

@@ -396,10 +407,11 @@ observableProto.windowWithTime = function (timeSpan, timeShiftOrScheduler, scheduler) {

* Projects each element of an observable sequence into a window that is completed when either it's full or a given amount of time has elapsed.
*
* @example
* 1 - res = source.windowWithTimeOrCount(5000, 50); // 5s or 50 items
* 2 - res = source.windowWithTimeOrCount(5000, 50, scheduler); //5s or 50 items
*
* @param timeSpan Maximum time length of a window.
* @param count Maximum element count of a window.
* @param [scheduler] Scheduler to run windowing timers on. If not specified, the timeout scheduler is used.
* @return An observable sequence of windows.
*
* @memberOf Observable#
* @param {Number} timeSpan Maximum time length of a window.
* @param {Number} count Maximum element count of a window.
* @param {Scheduler} [scheduler] Scheduler to run windowing timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence of windows.
*/

@@ -467,9 +479,11 @@ observableProto.windowWithTimeOrCount = function (timeSpan, count, scheduler) {

*
* @example
* 1 - res = xs.bufferWithTime(1000, scheduler); // non-overlapping segments of 1 second
* 2 - res = xs.bufferWithTime(1000, 500, scheduler; // segments of 1 second with time shift 0.5 seconds
*
* @param timeSpan Length of each buffer (specified as an integer denoting milliseconds).
* @param [timeShiftOrScheduler] Interval between creation of consecutive buffers (specified as an integer denoting milliseconds), or an optional scheduler parameter. If not specified, the time shift corresponds to the timeSpan parameter, resulting in non-overlapping adjacent buffers.
* @param [scheduler] Scheduler to run buffer timers on. If not specified, the timeout scheduler is used.
* @return An observable sequence of buffers.
*
* @memberOf Observable#
* @param {Number} timeSpan Length of each buffer (specified as an integer denoting milliseconds).
* @param {Mixed} [timeShiftOrScheduler] Interval between creation of consecutive buffers (specified as an integer denoting milliseconds), or an optional scheduler parameter. If not specified, the time shift corresponds to the timeSpan parameter, resulting in non-overlapping adjacent buffers.
* @param {Scheduler} [scheduler] Scheduler to run buffer timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence of buffers.
*/

@@ -496,9 +510,11 @@ observableProto.bufferWithTime = function (timeSpan, timeShiftOrScheduler, scheduler) {

*
* @example
* 1 - res = source.bufferWithTimeOrCount(5000, 50); // 5s or 50 items in an array
* 2 - res = source.bufferWithTimeOrCount(5000, 50, scheduler); // 5s or 50 items in an array
*
* @param timeSpan Maximum time length of a buffer.
* @param count Maximum element count of a buffer.
* @param [scheduler] Scheduler to run bufferin timers on. If not specified, the timeout scheduler is used.
* @return An observable sequence of buffers.
*
* @memberOf Observable#
* @param {Number} timeSpan Maximum time length of a buffer.
* @param {Number} count Maximum element count of a buffer.
* @param {Scheduler} [scheduler] Scheduler to run bufferin timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence of buffers.
*/

@@ -515,7 +531,9 @@ observableProto.bufferWithTimeOrCount = function (timeSpan, count, scheduler) {

*
* @example
* 1 - res = source.timeInterval();
* 2 - res = source.timeInterval(Rx.Scheduler.timeout);
*
* @param [scheduler] Scheduler used to compute time intervals. If not specified, the timeout scheduler is used.
* @return An observable sequence with time interval information on values.
*
* @memberOf Observable#
* @param [scheduler] Scheduler used to compute time intervals. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence with time interval information on values.
*/

@@ -541,7 +559,9 @@ observableProto.timeInterval = function (scheduler) {

*
* @example
* 1 - res = source.timestamp(); // produces { value: x, timestamp: ts }
* 2 - res = source.timestamp(Rx.Scheduler.timeout);
*
* @param [scheduler] Scheduler used to compute timestamps. If not specified, the timeout scheduler is used.
* @return An observable sequence with timestamp information on values.
*
* @memberOf Observable#
* @param {Scheduler} [scheduler] Scheduler used to compute timestamps. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence with timestamp information on values.
*/

@@ -588,10 +608,11 @@ observableProto.timestamp = function (scheduler) {

*
* @example
* 1 - res = source.sample(sampleObservable); // Sampler tick sequence
* 2 - res = source.sample(5000); // 5 seconds
* 2 - res = source.sample(5000, Rx.Scheduler.timeout); // 5 seconds
*
* @param source Source sequence to sample.
* @param interval Interval at which to sample (specified as an integer denoting milliseconds).
* @param [scheduler] Scheduler to run the sampling timer on. If not specified, the timeout scheduler is used.
* @return Sampled observable sequence.
*
* @memberOf Observable#
* @param {Mixed} intervalOrSampler Interval at which to sample (specified as an integer denoting milliseconds) or Sampler Observable.
* @param {Scheduler} [scheduler] Scheduler to run the sampling timer on. If not specified, the timeout scheduler is used.
* @returns {Observable} Sampled observable sequence.
*/

@@ -609,2 +630,3 @@ observableProto.sample = function (intervalOrSampler, scheduler) {

*
* @example
* 1 - res = source.timeout(new Date()); // As a date

@@ -616,7 +638,8 @@ * 2 - res = source.timeout(5000); // 5 seconds

* 6 - res = source.timeout(5000, Rx.Observable.returnValue(42), Rx.Scheduler.timeout); // 5 seconds and timeout observable
*
* @param dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) when a timeout occurs.
* @param [other] Sequence to return in case of a timeout. If not specified, a timeout error throwing sequence will be used.
* @param [scheduler] Scheduler to run the timeout timers on. If not specified, the timeout scheduler is used.
* @return The source sequence switching to the other sequence in case of a timeout.
*
* @memberOf Observable#
* @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) when a timeout occurs.
* @param {Observable} [other] Sequence to return in case of a timeout. If not specified, a timeout error throwing sequence will be used.
* @param {Scheduler} [scheduler] Scheduler to run the timeout timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} The source sequence switching to the other sequence in case of a timeout.
*/

@@ -682,2 +705,3 @@ observableProto.timeout = function (dueTime, other, scheduler) {

*
* @example
* res = source.generateWithAbsoluteTime(0,

@@ -689,10 +713,12 @@ * function (x) { return return true; },

* });
*
* @param initialState Initial state.
* @param condition Condition to terminate generation (upon returning false).
* @param iterate Iteration step function.
* @param resultSelector Selector function for results produced in the sequence.
* @param timeSelector Time selector function to control the speed of values being produced each iteration, returning Date values.
* @param [scheduler] Scheduler on which to run the generator loop. If not specified, the timeout scheduler is used.
* @return The generated sequence.
*
* @static
* @memberOf Observable
* @param {Mixed} initialState Initial state.
* @param {Function} condition Condition to terminate generation (upon returning false).
* @param {Function} iterate Iteration step function.
* @param {Function} resultSelector Selector function for results produced in the sequence.
* @param {Function} timeSelector Time selector function to control the speed of values being produced each iteration, returning Date values.
* @param {Scheduler} [scheduler] Scheduler on which to run the generator loop. If not specified, the timeout scheduler is used.
* @returns {Observable} The generated sequence.
*/

@@ -737,4 +763,5 @@ Observable.generateWithAbsoluteTime = function (initialState, condition, iterate, resultSelector, timeSelector, scheduler) {

* Generates an observable sequence by iterating a state from an initial state until the condition fails.
*
* res = source.generateWithRelativeTime(0,
*
* @example
* res = source.generateWithRelativeTime(0,
* function (x) { return return true; },

@@ -745,10 +772,12 @@ * function (x) { return x + 1; },

* );
*
* @param initialState Initial state.
* @param condition Condition to terminate generation (upon returning false).
* @param iterate Iteration step function.
* @param resultSelector Selector function for results produced in the sequence.
* @param timeSelector Time selector function to control the speed of values being produced each iteration, returning integer values denoting milliseconds.
* @param [scheduler] Scheduler on which to run the generator loop. If not specified, the timeout scheduler is used.
* @return The generated sequence.
*
* @static
* @memberOf Observable
* @param {Mixed} initialState Initial state.
* @param {Function} condition Condition to terminate generation (upon returning false).
* @param {Function} iterate Iteration step function.
* @param {Function} resultSelector Selector function for results produced in the sequence.
* @param {Function} timeSelector Time selector function to control the speed of values being produced each iteration, returning integer values denoting milliseconds.
* @param {Scheduler} [scheduler] Scheduler on which to run the generator loop. If not specified, the timeout scheduler is used.
* @returns {Observable} The generated sequence.
*/

@@ -794,8 +823,10 @@ Observable.generateWithRelativeTime = function (initialState, condition, iterate, resultSelector, timeSelector, scheduler) {

*
* @example
* 1 - res = source.delaySubscription(5000); // 5s
* 2 - res = source.delaySubscription(5000, Rx.Scheduler.timeout); // 5 seconds
*
* @param dueTime Absolute or relative time to perform the subscription at.
* @param [scheduler] Scheduler to run the subscription delay timer on. If not specified, the timeout scheduler is used.
* @return Time-shifted sequence.
*
* @memberOf Observable#
* @param {Number} dueTime Absolute or relative time to perform the subscription at.
* @param {Scheduler} [scheduler] Scheduler to run the subscription delay timer on. If not specified, the timeout scheduler is used.
* @returns {Observable} Time-shifted sequence.
*/

@@ -810,8 +841,10 @@ observableProto.delaySubscription = function (dueTime, scheduler) {

*
* @example
* 1 - res = source.delayWithSelector(function (x) { return Rx.Scheduler.timer(5000); }); // with selector only
* 1 - res = source.delayWithSelector(Rx.Observable.timer(2000), function (x) { return Rx.Observable.timer(x); }); // with delay and selector
*
* @param [subscriptionDelay] Sequence indicating the delay for the subscription to the source.
* @param delayDurationSelector Selector function to retrieve a sequence indicating the delay for each given element.
* @return Time-shifted sequence.
*
* @memberOf Observable#
* @param {Observable} [subscriptionDelay] Sequence indicating the delay for the subscription to the source.
* @param {Function} delayDurationSelector Selector function to retrieve a sequence indicating the delay for each given element.
* @returns {Observable} Time-shifted sequence.
*/

@@ -863,3 +896,3 @@ observableProto.delayWithSelector = function (subscriptionDelay, delayDurationSelector) {

start();
}, observer.onError.bind(onError), function () { start(); }));
}, observer.onError.bind(observer), function () { start(); }));
}

@@ -874,10 +907,12 @@

*
* @example
* 1 - res = source.timeoutWithSelector(Rx.Observable.timer(500));
* 2 - res = source.timeoutWithSelector(Rx.Observable.timer(500), function (x) { return Rx.Observable.timer(200); });
* 3 - res = source.timeoutWithSelector(Rx.Observable.timer(500), function (x) { return Rx.Observable.timer(200); }, Rx.Observable.returnValue(42));
*
* @param [firstTimeout] Observable sequence that represents the timeout for the first element. If not provided, this defaults to Observable.never().
* @param [timeoutDurationSelector] Selector to retrieve an observable sequence that represents the timeout between the current element and the next element.
* @param [other] Sequence to return in case of a timeout. If not provided, this is set to Observable.throwException().
* @return The source sequence switching to the other sequence in case of a timeout.
*
* @memberOf Observable#
* @param {Observable} [firstTimeout] Observable sequence that represents the timeout for the first element. If not provided, this defaults to Observable.never().
* @param {Function} [timeoutDurationSelector] Selector to retrieve an observable sequence that represents the timeout between the current element and the next element.
* @param {Observable} [other] Sequence to return in case of a timeout. If not provided, this is set to Observable.throwException().
* @returns {Observable} The source sequence switching to the other sequence in case of a timeout.
*/

@@ -952,6 +987,8 @@ observableProto.timeoutWithSelector = function (firstTimeout, timeoutdurationSelector, other) {

*
* @example
* 1 - res = source.delayWithSelector(function (x) { return Rx.Scheduler.timer(x + x); });
*
* @param throttleDurationSelector Selector function to retrieve a sequence indicating the throttle duration for each given element.
* @return The throttled sequence.
*
* @memberOf Observable#
* @param {Function} throttleDurationSelector Selector function to retrieve a sequence indicating the throttle duration for each given element.
* @returns {Observable} The throttled sequence.
*/

@@ -1010,11 +1047,11 @@ observableProto.throttleWithSelector = function (throttleDurationSelector) {

* 2 - res = source.skipLastWithTime(5000, scheduler);
*
* @param duration Duration for skipping elements from the end of the sequence.
* @param [scheduler] Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout
* @return An observable sequence with the elements skipped during the specified duration from the end of the source sequence.
*
*
* @description
* This operator accumulates a queue with a length enough to store elements received during the initial duration window.
* As more elements are received, elements older than the specified duration are taken from the queue and produced on the
* result sequence. This causes elements to be delayed with duration.
*
* result sequence. This causes elements to be delayed with duration.
* @memberOf Observable#
* @param {Number} duration Duration for skipping elements from the end of the sequence.
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout
* @returns {Observable} An observable sequence with the elements skipped during the specified duration from the end of the source sequence.
*/

@@ -1045,13 +1082,13 @@ observableProto.skipLastWithTime = function (duration, scheduler) {

*
* @example
* 1 - res = source.takeLastWithTime(5000, [optional timer scheduler], [optional loop scheduler]);
*
* @param duration Duration for taking elements from the end of the sequence.
* @param [timerScheduler] Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @param [loopScheduler] Scheduler to drain the collected elements. If not specified, defaults to Rx.Scheduler.immediate.
* @return An observable sequence with the elements taken during the specified duration from the end of the source sequence.
*
* This operator accumulates a buffer with a length enough to store elements for any duration window during the lifetime of
* the source sequence. Upon completion of the source sequence, this buffer is drained on the result sequence. This causes the result elements
* to be delayed with duration.
*
* @description
* This operator accumulates a queue with a length enough to store elements received during the initial duration window.
* As more elements are received, elements older than the specified duration are taken from the queue and produced on the
* result sequence. This causes elements to be delayed with duration.
* @memberOf Observable#
* @param {Number} duration Duration for taking elements from the end of the sequence.
* @param {Scheduler} [timerScheduler] Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @param {Scheduler} [loopScheduler] Scheduler to drain the collected elements. If not specified, defaults to Rx.Scheduler.immediate.
* @returns {Observable} An observable sequence with the elements taken during the specified duration from the end of the source sequence.
*/

@@ -1065,11 +1102,12 @@ observableProto.takeLastWithTime = function (duration, timerScheduler, loopScheduler) {

*
* @example
* 1 - res = source.takeLastBufferWithTime(5000, [optional scheduler]);
*
* @param duration Duration for taking elements from the end of the sequence.
* @param scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @return An observable sequence containing a single array with the elements taken during the specified duration from the end of the source sequence.
*
* This operator accumulates a buffer with a length enough to store elements for any duration window during the lifetime of
* the source sequence. Upon completion of the source sequence, this buffer is produced on the result sequence.
*
* @description
* This operator accumulates a queue with a length enough to store elements received during the initial duration window.
* As more elements are received, elements older than the specified duration are taken from the queue and produced on the
* result sequence. This causes elements to be delayed with duration.
* @memberOf Observable#
* @param {Number} duration Duration for taking elements from the end of the sequence.
* @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @returns {Observable} An observable sequence containing a single array with the elements taken during the specified duration from the end of the source sequence.
*/

@@ -1106,12 +1144,12 @@ observableProto.takeLastBufferWithTime = function (duration, scheduler) {

*
* @example
* 1 - res = source.takeWithTime(5000, [optional scheduler]);
*
* @param duration Duration for taking elements from the start of the sequence.
* @param scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @return An observable sequence with the elements taken during the specified duration from the start of the source sequence.
*
* Specifying a zero value for duration doesn't guarantee an empty sequence will be returned. This is a side-effect
* of the asynchrony introduced by the scheduler, where the action that stops forwarding callbacks from the source sequence may not execute
* immediately, despite the zero due time.
*
* @description
* This operator accumulates a queue with a length enough to store elements received during the initial duration window.
* As more elements are received, elements older than the specified duration are taken from the queue and produced on the
* result sequence. This causes elements to be delayed with duration.
* @memberOf Observable#
* @param {Number} duration Duration for taking elements from the start of the sequence.
* @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @returns {Observable} An observable sequence with the elements taken during the specified duration from the start of the source sequence.
*/

@@ -1133,8 +1171,6 @@ observableProto.takeWithTime = function (duration, scheduler) {

*
* @example
* 1 - res = source.skipWithTime(5000, [optional scheduler]);
*
* @param duration Duration for skipping elements from the start of the sequence.
* @param scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @return An observable sequence with the elements skipped during the specified duration from the start of the source sequence.
*
* @description
* Specifying a zero value for duration doesn't guarantee no elements will be dropped from the start of the source sequence.

@@ -1144,4 +1180,7 @@ * This is a side-effect of the asynchrony introduced by the scheduler, where the action that causes callbacks from the source sequence to be forwarded

*
* Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the duration.
*
* Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the duration.
* @memberOf Observable#
* @param {Number} duration Duration for skipping elements from the start of the sequence.
* @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @returns {Observable} An observable sequence with the elements skipped during the specified duration from the start of the source sequence.
*/

@@ -1166,11 +1205,10 @@ observableProto.skipWithTime = function (duration, scheduler) {

* Skips elements from the observable source sequence until the specified start time, using the specified scheduler to run timers.
* Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the start time>.
*
* @examples
* 1 - res = source.skipUntilWithTime(new Date(), [optional scheduler]);
*
* @param startTime Time to start taking elements from the source sequence. If this value is less than or equal to Date(), no elements will be skipped.
* @param scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @return An observable sequence with the elements skipped until the specified start time.
*
* Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the <paramref name="startTime"/>.
*
* @memberOf Obseravble#
* @param startTime Time to start taking elements from the source sequence. If this value is less than or equal to Date(), no elements will be skipped.
* @param scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @returns {Observable} An observable sequence with the elements skipped until the specified start time.
*/

@@ -1196,7 +1234,8 @@ observableProto.skipUntilWithTime = function (startTime, scheduler) {

*
* @example
* 1 - res = source.takeUntilWithTime(new Date(), [optional scheduler]);
*
* @param endTime Time to stop taking elements from the source sequence. If this value is less than or equal to new Date(), the result stream will complete immediately.
* @param scheduler Scheduler to run the timer on.
* @return An observable sequence with the elements taken until the specified end time.
* @memberOf Observable#
* @param {Number} endTime Time to stop taking elements from the source sequence. If this value is less than or equal to new Date(), the result stream will complete immediately.
* @param {Scheduler} scheduler Scheduler to run the timer on.
* @returns {Observable} An observable sequence with the elements taken until the specified end time.
*/

@@ -1213,3 +1252,3 @@ observableProto.takeUntilWithTime = function (endTime, scheduler) {

return root;
return Rx;
}));

@@ -1,1 +0,1 @@

(function(t,e){var n="object"==typeof exports&&exports&&("object"==typeof t&&t&&t==t.global&&(window=t),exports);"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=D(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=D(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,A=(n.Internals.BinaryObserver,n.Internals.addRef),D=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(A(n,u))),o&&(n=h.shift(),n.onCompleted()),r()}))},h.push(new C),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=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(A(c,u)),o(t))}))},c=new C,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 C,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(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(onError),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&&("object"==typeof t&&t&&t==t.global&&(window=t),exports);"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});
/**
* Abstract base class for implementations of the IObserver&lt;T&gt; interface.
*
* This base class enforces the grammar of observers where OnError and OnCompleted are terminal messages.
* Abstract base class for implementations of the Observer class.
* This base class enforces the grammar of observers where OnError and OnCompleted are terminal messages.
*/
var AbstractObserver = root.Internals.AbstractObserver = (function () {
inherits(AbstractObserver, Observer);
var AbstractObserver = Rx.Internals.AbstractObserver = (function (_super) {
inherits(AbstractObserver, _super);
/**
* Creates a new observer in a non-stopped state.
*
* @constructor
* Creates a new observer in a non-stopped state.
*/
function AbstractObserver() {
this.isStopped = false;
_super.call(this);
}
/**
* Notifies the observer of a new element in the sequence.
* Notifies the observer of a new element in the sequence.
*
* @param value Next element in the sequence.
* @memberOf AbstractObserver
* @param {Any} value Next element in the sequence.
*/

@@ -29,5 +31,6 @@ AbstractObserver.prototype.onNext = function (value) {

/**
* Notifies the observer that an exception has occurred.
*
* @param error The error that has occurred.
* Notifies the observer that an exception has occurred.
*
* @memberOf AbstractObserver
* @param {Any} error The error that has occurred.
*/

@@ -42,3 +45,3 @@ AbstractObserver.prototype.onError = function (error) {

/**
* Notifies the observer of the end of the sequence.
* Notifies the observer of the end of the sequence.
*/

@@ -53,3 +56,3 @@ AbstractObserver.prototype.onCompleted = function () {

/**
* Disposes the observer, causing it to transition to the stopped state.
* Disposes the observer, causing it to transition to the stopped state.
*/

@@ -71,2 +74,2 @@ AbstractObserver.prototype.dispose = function () {

return AbstractObserver;
}());
}(Observer));
// References
var Observable = root.Observable,
var Observable = Rx.Observable,
observableProto = Observable.prototype,
CompositeDisposable = root.CompositeDisposable,
AnonymousObservable = root.Internals.AnonymousObservable;
CompositeDisposable = Rx.CompositeDisposable,
AnonymousObservable = Rx.Internals.AnonymousObservable;

@@ -7,0 +7,0 @@ // Defaults

@@ -1,6 +0,12 @@

var AnonymousObservable = root.Internals.AnonymousObservable = (function () {
inherits(AnonymousObservable, Observable);
/** @private */
var AnonymousObservable = Rx.Internals.AnonymousObservable = (function (_super) {
inherits(AnonymousObservable, _super);
/**
* @private
* @constructor
*/
function AnonymousObservable(subscribe) {
var s = function (observer) {
function s(observer) {
var autoDetachObserver = new AutoDetachObserver(observer);

@@ -28,7 +34,9 @@ if (currentThreadScheduler.scheduleRequired()) {

return autoDetachObserver;
};
AnonymousObservable.super_.constructor.call(this, s);
}
_super.call(this, s);
}
return AnonymousObservable;
}());
}(Observable));
/**
* Class to create an Observer instance from delegate-based implementations of the on* methods.
*/
var AnonymousObserver = root.AnonymousObserver = (function () {
inherits(AnonymousObserver, AbstractObserver);
var AnonymousObserver = Rx.AnonymousObserver = (function (_super) {
inherits(AnonymousObserver, _super);
/**
* Creates an observer from the specified OnNext, OnError, and OnCompleted actions.
*
* @constructor
* Creates an observer from the specified OnNext, OnError, and OnCompleted actions.
*
* @param onNext Observer's OnNext action implementation.
* @param onError Observer's OnError action implementation.
* @param onCompleted Observer's OnCompleted action implementation.
* @param {Any} onNext Observer's OnNext action implementation.
* @param {Any} onError Observer's OnError action implementation.
* @param {Any} onCompleted Observer's OnCompleted action implementation.
*/
function AnonymousObserver(onNext, onError, onCompleted) {
AnonymousObserver.super_.constructor.call(this);
_super.call(this);
this._onNext = onNext;

@@ -23,5 +23,6 @@ this._onError = onError;

/**
* Calls the onNext action.
*
* @param value Next element in the sequence.
* Calls the onNext action.
*
* @memberOf AnonymousObserver
* @param {Any} value Next element in the sequence.
*/

@@ -33,5 +34,6 @@ AnonymousObserver.prototype.next = function (value) {

/**
* Calls the onError action.
*
* @param error The error that has occurred.
* Calls the onError action.
*
* @memberOf AnonymousObserver
* @param {Any{ error The error that has occurred.
*/

@@ -44,2 +46,4 @@ AnonymousObserver.prototype.error = function (exception) {

* Calls the onCompleted action.
*
* @memberOf AnonymousObserver
*/

@@ -51,2 +55,2 @@ AnonymousObserver.prototype.completed = function () {

return AnonymousObserver;
}());
}(AbstractObserver));

@@ -1,6 +0,11 @@

var AutoDetachObserver = (function () {
/** @private */
var AutoDetachObserver = (function (_super) {
inherits(AutoDetachObserver, _super);
inherits(AutoDetachObserver, AbstractObserver);
/**
* @private
* @constructor
*/
function AutoDetachObserver(observer) {
AutoDetachObserver.super_.constructor.call(this);
_super.call(this);
this.observer = observer;

@@ -10,3 +15,9 @@ this.m = new SingleAssignmentDisposable();

AutoDetachObserver.prototype.next = function (value) {
var AutoDetachObserverPrototype = AutoDetachObserver.prototype
/**
* @private
* @memberOf AutoDetachObserver#
*/
AutoDetachObserverPrototype.next = function (value) {
var noError = false;

@@ -24,3 +35,8 @@ try {

};
AutoDetachObserver.prototype.error = function (exn) {
/**
* @private
* @memberOf AutoDetachObserver#
*/
AutoDetachObserverPrototype.error = function (exn) {
try {

@@ -34,3 +50,8 @@ this.observer.onError(exn);

};
AutoDetachObserver.prototype.completed = function () {
/**
* @private
* @memberOf AutoDetachObserver#
*/
AutoDetachObserverPrototype.completed = function () {
try {

@@ -44,7 +65,17 @@ this.observer.onCompleted();

};
AutoDetachObserver.prototype.disposable = function (value) {
/**
* @private
* @memberOf AutoDetachObserver#
*/
AutoDetachObserverPrototype.disposable = function (value) {
return this.m.disposable(value);
};
AutoDetachObserver.prototype.dispose = function () {
AutoDetachObserver.super_.dispose.call(this);
/**
* @private
* @memberOf AutoDetachObserver#
*/
AutoDetachObserverPrototype.dispose = function () {
_super.prototype.dispose.call(this);
this.m.dispose();

@@ -54,2 +85,2 @@ };

return AutoDetachObserver;
}());
}(AbstractObserver));

@@ -1,4 +0,6 @@

var CheckedObserver = (function () {
inherits(CheckedObserver, Observer);
var CheckedObserver = (function (_super) {
inherits(CheckedObserver, _super);
function CheckedObserver(observer) {
_super.call(this);
this._observer = observer;

@@ -8,3 +10,5 @@ this._state = 0; // 0 - idle, 1 - busy, 2 - done

CheckedObserver.prototype.onNext = function (value) {
var CheckedObserverPrototype = CheckedObserver.prototype;
CheckedObserverPrototype.onNext = function (value) {
this.checkAccess();

@@ -20,3 +24,3 @@ try {

CheckedObserver.prototype.onError = function (err) {
CheckedObserverPrototype.onError = function (err) {
this.checkAccess();

@@ -32,3 +36,3 @@ try {

CheckedObserver.prototype.onCompleted = function () {
CheckedObserverPrototype.onCompleted = function () {
this.checkAccess();

@@ -44,3 +48,3 @@ try {

CheckedObserver.prototype.checkAccess = function () {
CheckedObserverPrototype.checkAccess = function () {
if (this._state === 1) { throw new Error('Re-entrancy detected'); }

@@ -52,2 +56,2 @@ if (this._state === 2) { throw new Error('Observer completed'); }

return CheckedObserver;
}());
}(Observer));

@@ -1,12 +0,12 @@

var Observable = root.Observable,
CompositeDisposable = root.CompositeDisposable,
RefCountDisposable = root.RefCountDisposable,
SingleAssignmentDisposable = root.SingleAssignmentDisposable,
SerialDisposable = root.SerialDisposable,
Subject = root.Subject,
var Observable = Rx.Observable,
CompositeDisposable = Rx.CompositeDisposable,
RefCountDisposable = Rx.RefCountDisposable,
SingleAssignmentDisposable = Rx.SingleAssignmentDisposable,
SerialDisposable = Rx.SerialDisposable,
Subject = Rx.Subject,
observableProto = Observable.prototype,
observableEmpty = Observable.empty,
AnonymousObservable = root.Internals.AnonymousObservable,
observerCreate = root.Observer.create,
addRef = root.Internals.addRef;
AnonymousObservable = Rx.Internals.AnonymousObservable,
observerCreate = Rx.Observer.create,
addRef = Rx.Internals.addRef;

@@ -13,0 +13,0 @@ // defaults

@@ -1,3 +0,3 @@

// CatchScheduler
var CatchScheduler = (function () {
/** @private */
var CatchScheduler = (function (_super) {

@@ -20,3 +20,5 @@ function localNow() {

inherits(CatchScheduler, Scheduler);
inherits(CatchScheduler, _super);
/** @private */
function CatchScheduler(scheduler, handler) {

@@ -27,5 +29,6 @@ this._scheduler = scheduler;

this._recursiveWrapper = null;
CatchScheduler.super_.constructor.call(this, localNow, scheduleNow, scheduleRelative, scheduleAbsolute);
_super.call(this, localNow, scheduleNow, scheduleRelative, scheduleAbsolute);
}
/** @private */
CatchScheduler.prototype._clone = function (scheduler) {

@@ -35,2 +38,3 @@ return new CatchScheduler(scheduler, this._handler);

/** @private */
CatchScheduler.prototype._wrap = function (action) {

@@ -48,2 +52,3 @@ var parent = this;

/** @private */
CatchScheduler.prototype._getRecursiveWrapper = function (scheduler) {

@@ -60,2 +65,3 @@ if (!this._recursiveOriginal !== scheduler) {

/** @private */
CatchScheduler.prototype.schedulePeriodicWithState = function (state, period, action) {

@@ -80,2 +86,2 @@ var self = this, failed = false, d = new SingleAssignmentDisposable();

return CatchScheduler;
}());
}(Scheduler));

@@ -1,5 +0,11 @@

// Current Thread Scheduler
/**
* Gets a scheduler that schedules work as soon as possible on the current thread.
*/
var currentThreadScheduler = Scheduler.currentThread = (function () {
var queue;
/**
* @private
* @constructor
*/
function Trampoline() {

@@ -9,2 +15,6 @@ queue = new PriorityQueue(4);

/**
* @private
* @memberOf Trampoline
*/
Trampoline.prototype.dispose = function () {

@@ -14,2 +24,6 @@ queue = null;

/**
* @private
* @memberOf Trampoline
*/
Trampoline.prototype.run = function () {

@@ -16,0 +30,0 @@ var item;

/** Provides a virtual time scheduler that uses Date for absolute time and number for relative time. */
root.HistoricalScheduler = (function () {
inherits(HistoricalScheduler, root.VirtualTimeScheduler);
Rx.HistoricalScheduler = (function (_super) {
inherits(HistoricalScheduler, _super);
/**
* @constructor
* Creates a new historical scheduler with the specified initial clock value.
*
* @param initialClock Initial value for the clock.
* @param comparer Comparer to determine causality of events based on absolute time.
* @constructor
* @param {Number} initialClock Initial value for the clock.
* @param {Function} comparer Comparer to determine causality of events based on absolute time.
*/

@@ -15,3 +15,3 @@ function HistoricalScheduler(initialClock, comparer) {

var cmp = comparer || defaultSubComparer;
HistoricalScheduler.super_.constructor.call(this, clock, cmp);
_super.call(this, clock, cmp);
}

@@ -24,5 +24,6 @@

*
* @param absolute Absolute virtual time value.
* @param relative Relative virtual time value to add.
* @return Resulting absolute virtual time sum value.
* @memberOf HistoricalScheduler
* @param {Number} absolute Absolute virtual time value.
* @param {Number} relative Relative virtual time value to add.
* @return {Number} Resulting absolute virtual time sum value.
*/

@@ -33,2 +34,6 @@ HistoricalSchedulerProto.add = function (absolute, relative) {

/**
* @private
* @memberOf HistoricalScheduler
*/
HistoricalSchedulerProto.toDateTimeOffset = function (absolute) {

@@ -41,4 +46,5 @@ return new Date(absolute).getTime();

*
* @param timeSpan TimeSpan value to convert.
* @return Corresponding relative virtual time value.
* @memberOf HistoricalScheduler
* @param {Number} timeSpan TimeSpan value to convert.
* @return {Number} Corresponding relative virtual time value.
*/

@@ -50,2 +56,2 @@ HistoricalSchedulerProto.toRelative = function (timeSpan) {

return HistoricalScheduler;
}());
}(Rx.VirtualTimeScheduler));

@@ -1,3 +0,8 @@

// Immediate Scheduler
var schedulerNoBlockError = 'Scheduler is not allowed to block the thread';
/**
* Gets a scheduler that schedules work immediately on the current thread.
*
* @memberOf Scheduler
*/
var immediateScheduler = Scheduler.immediate = (function () {

@@ -4,0 +9,0 @@

@@ -0,1 +1,5 @@

/**
* @private
* @constructor
*/
function ScheduledItem(scheduler, state, action, dueTime, comparer) {

@@ -9,13 +13,33 @@ this.scheduler = scheduler;

}
/**
* @private
* @memberOf ScheduledItem#
*/
ScheduledItem.prototype.invoke = function () {
this.disposable.disposable(this.invokeCore());
};
/**
* @private
* @memberOf ScheduledItem#
*/
ScheduledItem.prototype.compareTo = function (other) {
return this.comparer(this.dueTime, other.dueTime);
};
/**
* @private
* @memberOf ScheduledItem#
*/
ScheduledItem.prototype.isCancelled = function () {
return this.disposable.isDisposed;
};
/**
* @private
* @memberOf ScheduledItem#
*/
ScheduledItem.prototype.invokeCore = function () {
return this.action(this.scheduler, this.state);
};

@@ -0,1 +1,4 @@

/**
* @private
*/
var SchedulePeriodicRecursive = (function () {

@@ -12,2 +15,6 @@ function tick(command, recurse) {

/**
* @constructor
* @private
*/
function SchedulePeriodicRecursive(scheduler, state, period, action) {

@@ -14,0 +21,0 @@ this._scheduler = scheduler;

/** Provides a set of static properties to access commonly used schedulers. */
var Scheduler = root.Scheduler = (function () {
var Scheduler = Rx.Scheduler = (function () {
/** @constructor */
/**
* @constructor
* @private
*/
function Scheduler(now, schedule, scheduleRelative, scheduleAbsolute) {

@@ -70,5 +73,5 @@ this.now = now;

*
* @param scheduler Scheduler to apply an exception filter for.
* @param handler Handler that's run if an exception is caught. The exception will be rethrown if the handler returns false.
* @return Wrapper around the original scheduler, enforcing exception handling.
* @memberOf Scheduler#
* @param {Function} handler Handler that's run if an exception is caught. The exception will be rethrown if the handler returns false.
* @returns {Scheduler} Wrapper around the original scheduler, enforcing exception handling.
*/

@@ -82,5 +85,6 @@ schedulerProto.catchException = function (handler) {

*
* @param period Period for running the work periodically.
* @param action Action to be executed.
* @return The disposable object used to cancel the scheduled recurring action (best effort).
* @memberOf Scheduler#
* @param {Number} period Period for running the work periodically.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort).
*/

@@ -96,6 +100,7 @@ schedulerProto.schedulePeriodic = function (period, action) {

*
* @param state Initial state passed to the action upon the first iteration.
* @param period Period for running the work periodically.
* @param action Action to be executed, potentially updating the state.
* @return The disposable object used to cancel the scheduled recurring action (best effort).
* @memberOf Scheduler#
* @param {Mixed} state Initial state passed to the action upon the first iteration.
* @param {Number} period Period for running the work periodically.
* @param {Function} action Action to be executed, potentially updating the state.
* @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort).
*/

@@ -114,4 +119,5 @@ schedulerProto.schedulePeriodicWithState = function (state, period, action) {

*
* @param action Action to execute.
* @return The disposable object used to cancel the scheduled action (best effort).
* @memberOf Scheduler#
* @param {Function} action Action to execute.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/

@@ -125,5 +131,6 @@ schedulerProto.schedule = function (action) {

*
* @memberOf Scheduler#
* @param state State passed to the action to be executed.
* @param action Action to be executed.
* @return The disposable object used to cancel the scheduled action (best effort).
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/

@@ -137,5 +144,6 @@ schedulerProto.scheduleWithState = function (state, action) {

*
* @param action Action to execute.
* @param dueTime Relative time after which to execute the action.
* @return The disposable object used to cancel the scheduled action (best effort).
* @memberOf Scheduler#
* @param {Function} action Action to execute.
* @param {Number}dueTime Relative time after which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/

@@ -149,6 +157,7 @@ schedulerProto.scheduleWithRelative = function (dueTime, action) {

*
* @memberOf Scheduler#
* @param state State passed to the action to be executed.
* @param action Action to be executed.
* @param dueTime Relative time after which to execute the action.
* @return The disposable object used to cancel the scheduled action (best effort).
* @param {Function} action Action to be executed.
* @param {Number}dueTime Relative time after which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/

@@ -162,5 +171,6 @@ schedulerProto.scheduleWithRelativeAndState = function (state, dueTime, action) {

*
* @param action Action to execute.
* @param dueTime Absolute time at which to execute the action.
* @return The disposable object used to cancel the scheduled action (best effort).
* @memberOf Scheduler#
* @param {Function} action Action to execute.
* @param {Number}dueTime Absolute time at which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/

@@ -174,6 +184,7 @@ schedulerProto.scheduleWithAbsolute = function (dueTime, action) {

*
* @param state State passed to the action to be executed.
* @param action Action to be executed.
* @param dueTime Absolute time at which to execute the action.
* @return The disposable object used to cancel the scheduled action (best effort).
* @memberOf Scheduler#
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @param {Number}dueTime Absolute time at which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/

@@ -187,4 +198,5 @@ schedulerProto.scheduleWithAbsoluteAndState = function (state, dueTime, action) {

*
* @param action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action.
* @return The disposable object used to cancel the scheduled action (best effort).
* @memberOf Scheduler#
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/

@@ -202,5 +214,6 @@ schedulerProto.scheduleRecursive = function (action) {

*
* @param state State passed to the action to be executed.
* @param action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in recursive invocation state.
* @return The disposable object used to cancel the scheduled action (best effort).
* @memberOf Scheduler#
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in recursive invocation state.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/

@@ -216,5 +229,6 @@ schedulerProto.scheduleRecursiveWithState = function (state, action) {

*
* @param action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action at the specified relative time.
* @param dueTime Relative time after which to execute the action for the first time.
* @return The disposable object used to cancel the scheduled action (best effort).
* @memberOf Scheduler
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action at the specified relative time.
* @param {Number}dueTime Relative time after which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/

@@ -232,6 +246,7 @@ schedulerProto.scheduleRecursiveWithRelative = function (dueTime, action) {

*
* @param state State passed to the action to be executed.
* @param action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state.
* @param dueTime Relative time after which to execute the action for the first time.
* @return The disposable object used to cancel the scheduled action (best effort).
* @memberOf Scheduler
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state.
* @param {Number}dueTime Relative time after which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/

@@ -247,5 +262,6 @@ schedulerProto.scheduleRecursiveWithRelativeAndState = function (state, dueTime, action) {

*
* @param action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action at the specified absolute time.
* @param dueTime Absolute time at which to execute the action for the first time.
* @return The disposable object used to cancel the scheduled action (best effort).
* @memberOf Scheduler
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action at the specified absolute time.
* @param {Number}dueTime Absolute time at which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/

@@ -263,6 +279,7 @@ schedulerProto.scheduleRecursiveWithAbsolute = function (dueTime, action) {

*
* @param state State passed to the action to be executed.
* @param action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state.
* @param dueTime Absolute time at which to execute the action for the first time.
* @return The disposable object used to cancel the scheduled action (best effort).
* @memberOf Scheduler
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state.
* @param {Number}dueTime Absolute time at which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/

@@ -281,4 +298,6 @@ schedulerProto.scheduleRecursiveWithAbsoluteAndState = function (state, dueTime, action) {

*
* @static
* @memberOf Scheduler
* @param {Number} timeSpan The time span value to normalize.
* @return The specified TimeSpan value if it is zero or positive; otherwise, 0
* @returns {Number} The specified TimeSpan value if it is zero or positive; otherwise, 0
*/

@@ -285,0 +304,0 @@ Scheduler.normalize = function (timeSpan) {

@@ -1,26 +0,70 @@

// Timeout Scheduler
/**
* Gets a scheduler that schedules work via a timed callback based upon platform.
*
* @memberOf Scheduler
*/
var timeoutScheduler = Scheduler.timeout = (function () {
// Optimize for speed
var reqAnimFrame = window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame,
clearAnimFrame = window.cancelAnimationFrame ||
window.webkitCancelAnimationFrame ||
window.mozCancelAnimationFrame ||
window.oCancelAnimationFrame ||
window.msCancelAnimationFrame;
function postMessageSupported () {
// Ensure not in a worker
if (!window.postMessage || window.importScripts) { return false; }
var isAsync = false,
oldHandler = window.onmessage;
// Test for async
window.onmessage = function () { isAsync = true; };
window.postMessage('','*');
window.onmessage = oldHandler;
var scheduleMethod, clearMethod;
if (typeof window.process !== 'undefined' && typeof window.process.nextTick === 'function') {
return isAsync;
}
var scheduleMethod, clearMethod = noop;
if (typeof window.process !== 'undefined' && typeof window.process === '[object process]') {
scheduleMethod = window.process.nextTick;
clearMethod = noop;
} else if (typeof window.setImmediate === 'function') {
scheduleMethod = window.setImmediate;
clearMethod = window.clearImmediate;
} else if (typeof reqAnimFrame === 'function') {
scheduleMethod = reqAnimFrame;
clearMethod = clearAnimFrame;
} else if (postMessageSupported()) {
var MSG_PREFIX = 'ms.rx.schedule' + Math.random(),
tasks = {},
taskId = 0;
function onGlobalPostMessage(event) {
// Only if we're a match to avoid any other global events
if (typeof event.data === 'string' && event.data.substring(0, MSG_PREFIX.length) === MSG_PREFIX) {
var handleId = event.data.substring(MSG_PREFIX.length),
action = tasks[handleId];
action();
delete tasks[handleId];
}
}
if (window.addEventListener) {
window.addEventListener('message', onGlobalPostMessage, false);
} else {
window.attachEvent('onmessage', onGlobalPostMessage, false);
}
scheduleMethod = function (action) {
var currentId = taskId++;
tasks[currentId] = action;
window.postMessage(MSG_PREFIX + currentId, '*');
};
} else if (!!window.MessageChannel) {
scheduleMethod = function (action) {
var channel = new window.MessageChannel();
channel.port1.onmessage = function (event) {
action();
};
channel.port2.postMessage();
};
} else if ('document' in window && 'onreadystatechange' in window.document.createElement('script')) {
var scriptElement = window.document.createElement('script');
scriptElement.onreadystatechange = function () {
action();
scriptElement.onreadystatechange = null;
scriptElement.parentNode.removeChild(scriptElement);
scriptElement = null;
};
window.document.documentElement.appendChild(scriptElement);
} else {

@@ -32,6 +76,8 @@ scheduleMethod = function (action) { return window.setTimeout(action, 0); };

function scheduleNow(state, action) {
var scheduler = this;
var disposable = new SingleAssignmentDisposable();
var scheduler = this,
disposable = new SingleAssignmentDisposable();
var id = scheduleMethod(function () {
disposable.setDisposable(action(scheduler, state));
if (!disposable.isDisposed) {
disposable.setDisposable(action(scheduler, state));
}
});

@@ -44,4 +90,4 @@ return new CompositeDisposable(disposable, disposableCreate(function () {

function scheduleRelative(state, dueTime, action) {
var scheduler = this;
var dt = Scheduler.normalize(dueTime);
var scheduler = this,
dt = Scheduler.normalize(dueTime);
if (dt === 0) {

@@ -52,3 +98,5 @@ return scheduler.scheduleWithState(state, action);

var id = window.setTimeout(function () {
disposable.setDisposable(action(scheduler, state));
if (!disposable.isDisposed) {
disposable.setDisposable(action(scheduler, state));
}
}, dt);

@@ -55,0 +103,0 @@ return new CompositeDisposable(disposable, disposableCreate(function () {

/** Provides a set of extension methods for virtual time scheduling. */
root.VirtualTimeScheduler = (function () {
Rx.VirtualTimeScheduler = (function (_super) {

@@ -25,8 +25,10 @@ function localNow() {

inherits(VirtualTimeScheduler, Scheduler);
inherits(VirtualTimeScheduler, _super);
/**
* Creates a new virtual time scheduler with the specified initial clock value and absolute time comparer.
* @param initialClock Initial value for the clock.
* @param comparer Comparer to determine causality of events based on absolute time.
*
* @constructor
* @param {Number} initialClock Initial value for the clock.
* @param {Function} comparer Comparer to determine causality of events based on absolute time.
*/

@@ -38,165 +40,197 @@ function VirtualTimeScheduler(initialClock, comparer) {

this.queue = new PriorityQueue(1024);
VirtualTimeScheduler.super_.constructor.call(this, localNow, scheduleNow, scheduleRelative, scheduleAbsolute);
_super.call(this, localNow, scheduleNow, scheduleRelative, scheduleAbsolute);
}
addProperties(VirtualTimeScheduler.prototype, {
/**
* Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be emulated using recursive scheduling.
*
* @param state Initial state passed to the action upon the first iteration.
* @param period Period for running the work periodically.
* @param action Action to be executed, potentially updating the state.
* @return The disposable object used to cancel the scheduled recurring action (best effort).
*/
schedulePeriodicWithState: function (state, period, action) {
var s = new SchedulePeriodicRecursive(this, state, period, action);
return s.start();
},
/**
* Schedules an action to be executed after dueTime.
*
* @param state State passed to the action to be executed.
* @param dueTime Relative time after which to execute the action.
* @param action Action to be executed.
* @return The disposable object used to cancel the scheduled action (best effort).
*/
scheduleRelativeWithState: function (state, dueTime, action) {
var runAt = this.add(this.clock, dueTime);
return this.scheduleAbsoluteWithState(state, runAt, action);
},
/**
* Schedules an action to be executed at dueTime.
*
* @param dueTime Relative time after which to execute the action.
* @param action Action to be executed.
* @return The disposable object used to cancel the scheduled action (best effort).
*/
scheduleRelative: function (dueTime, action) {
return this.scheduleRelativeWithState(action, dueTime, invokeAction);
},
/** Starts the virtual time scheduler. */
start: function () {
var next;
if (!this.isEnabled) {
this.isEnabled = true;
do {
next = this.getNext();
if (next !== null) {
if (this.comparer(next.dueTime, this.clock) > 0) {
this.clock = next.dueTime;
}
next.invoke();
} else {
this.isEnabled = false;
var VirtualTimeSchedulerPrototype = VirtualTimeScheduler.prototype;
/**
* Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be emulated using recursive scheduling.
*
* @memberOf VirtualTimeScheduler#
* @param {Mixed} state Initial state passed to the action upon the first iteration.
* @param {Number} period Period for running the work periodically.
* @param {Function} action Action to be executed, potentially updating the state.
* @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort).
*/
VirtualTimeSchedulerPrototype.schedulePeriodicWithState = function (state, period, action) {
var s = new SchedulePeriodicRecursive(this, state, period, action);
return s.start();
};
/**
* Schedules an action to be executed after dueTime.
*
* @memberOf VirtualTimeScheduler#
* @param {Mixed} state State passed to the action to be executed.
* @param {Number} dueTime Relative time after which to execute the action.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
VirtualTimeSchedulerPrototype.scheduleRelativeWithState = function (state, dueTime, action) {
var runAt = this.add(this.clock, dueTime);
return this.scheduleAbsoluteWithState(state, runAt, action);
};
/**
* Schedules an action to be executed at dueTime.
*
* @memberOf VirtualTimeScheduler#
* @param {Number} dueTime Relative time after which to execute the action.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
VirtualTimeSchedulerPrototype.scheduleRelative = function (dueTime, action) {
return this.scheduleRelativeWithState(action, dueTime, invokeAction);
};
/**
* Starts the virtual time scheduler.
*
* @memberOf VirtualTimeScheduler#
*/
VirtualTimeSchedulerPrototype.start = function () {
var next;
if (!this.isEnabled) {
this.isEnabled = true;
do {
next = this.getNext();
if (next !== null) {
if (this.comparer(next.dueTime, this.clock) > 0) {
this.clock = next.dueTime;
}
} while (this.isEnabled);
}
},
/** Stops the virtual time scheduler. */
stop: function () {
this.isEnabled = false;
},
/**
* Advances the scheduler's clock to the specified time, running all work till that point.
* @param time Absolute time to advance the scheduler's clock to.
*/
advanceTo: function (time) {
var next;
var dueToClock = this.comparer(this.clock, time);
if (this.comparer(this.clock, time) > 0) {
throw new Error(argumentOutOfRange);
}
if (dueToClock === 0) {
return;
}
if (!this.isEnabled) {
this.isEnabled = true;
do {
next = this.getNext();
if (next !== null && this.comparer(next.dueTime, time) <= 0) {
if (this.comparer(next.dueTime, this.clock) > 0) {
this.clock = next.dueTime;
}
next.invoke();
} else {
this.isEnabled = false;
}
} while (this.isEnabled)
this.clock = time;
}
},
/**
* Advances the scheduler's clock by the specified relative time, running all work scheduled for that timespan.
* @param time Relative time to advance the scheduler's clock by.
*/
advanceBy: function (time) {
var dt = this.add(this.clock, time);
var dueToClock = this.comparer(this.clock, dt);
if (dueToClock > 0) {
throw new Error(argumentOutOfRange);
}
if (dueToClock === 0) {
return;
}
return this.advanceTo(dt);
},
/**
* Advances the scheduler's clock by the specified relative time.
* @param time Relative time to advance the scheduler's clock by.
*/
sleep: function (time) {
var dt = this.add(this.clock, time);
next.invoke();
} else {
this.isEnabled = false;
}
} while (this.isEnabled);
}
};
if (this.comparer(this.clock, dt) >= 0) {
throw new Error(argumentOutOfRange);
}
/**
* Stops the virtual time scheduler.
*
* @memberOf VirtualTimeScheduler#
*/
VirtualTimeSchedulerPrototype.stop = function () {
this.isEnabled = false;
};
this.clock = dt;
},
/**
* Gets the next scheduled item to be executed.
* @return The next scheduled item.
*/
getNext: function () {
var next;
while (this.queue.length > 0) {
next = this.queue.peek();
if (next.isCancelled()) {
this.queue.dequeue();
/**
* Advances the scheduler's clock to the specified time, running all work till that point.
*
* @param {Number} time Absolute time to advance the scheduler's clock to.
*/
VirtualTimeSchedulerPrototype.advanceTo = function (time) {
var next;
var dueToClock = this.comparer(this.clock, time);
if (this.comparer(this.clock, time) > 0) {
throw new Error(argumentOutOfRange);
}
if (dueToClock === 0) {
return;
}
if (!this.isEnabled) {
this.isEnabled = true;
do {
next = this.getNext();
if (next !== null && this.comparer(next.dueTime, time) <= 0) {
if (this.comparer(next.dueTime, this.clock) > 0) {
this.clock = next.dueTime;
}
next.invoke();
} else {
return next;
this.isEnabled = false;
}
} while (this.isEnabled)
this.clock = time;
}
};
/**
* Advances the scheduler's clock by the specified relative time, running all work scheduled for that timespan.
*
* @memberOf VirtualTimeScheduler#
* @param {Number} time Relative time to advance the scheduler's clock by.
*/
VirtualTimeSchedulerPrototype.advanceBy = function (time) {
var dt = this.add(this.clock, time);
var dueToClock = this.comparer(this.clock, dt);
if (dueToClock > 0) {
throw new Error(argumentOutOfRange);
}
if (dueToClock === 0) {
return;
}
return this.advanceTo(dt);
};
/**
* Advances the scheduler's clock by the specified relative time.
*
* @memberOf VirtualTimeScheduler#
* @param {Number} time Relative time to advance the scheduler's clock by.
*/
VirtualTimeSchedulerPrototype.sleep = function (time) {
var dt = this.add(this.clock, time);
if (this.comparer(this.clock, dt) >= 0) {
throw new Error(argumentOutOfRange);
}
this.clock = dt;
};
/**
* Gets the next scheduled item to be executed.
*
* @memberOf VirtualTimeScheduler#
* @returns {ScheduledItem} The next scheduled item.
*/
VirtualTimeSchedulerPrototype.getNext = function () {
var next;
while (this.queue.length > 0) {
next = this.queue.peek();
if (next.isCancelled()) {
this.queue.dequeue();
} else {
return next;
}
return null;
},
/**
* Schedules an action to be executed at dueTime.
* @param scheduler Scheduler to execute the action on.
* @param dueTime Absolute time at which to execute the action.
* @param action Action to be executed.
* @return The disposable object used to cancel the scheduled action (best effort).
*/
scheduleAbsolute: function (dueTime, action) {
return this.scheduleAbsoluteWithState(action, dueTime, invokeAction);
},
/**
* Schedules an action to be executed at dueTime.
* @param state State passed to the action to be executed.
* @param dueTime Absolute time at which to execute the action.
* @param action Action to be executed.
* @return The disposable object used to cancel the scheduled action (best effort).
*/
scheduleAbsoluteWithState: function (state, dueTime, action) {
var self = this,
run = function (scheduler, state1) {
self.queue.remove(si);
return action(scheduler, state1);
},
si = new ScheduledItem(self, state, run, dueTime, self.comparer);
self.queue.enqueue(si);
return si.disposable;
}
});
return null;
};
/**
* Schedules an action to be executed at dueTime.
*
* @memberOf VirtualTimeScheduler#
* @param {Scheduler} scheduler Scheduler to execute the action on.
* @param {Number} dueTime Absolute time at which to execute the action.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
VirtualTimeSchedulerPrototype.scheduleAbsolute = function (dueTime, action) {
return this.scheduleAbsoluteWithState(action, dueTime, invokeAction);
};
/**
* Schedules an action to be executed at dueTime.
*
* @memberOf VirtualTimeScheduler#
* @param {Mixed} state State passed to the action to be executed.
* @param {Number} dueTime Absolute time at which to execute the action.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
VirtualTimeSchedulerPrototype.scheduleAbsoluteWithState = function (state, dueTime, action) {
var self = this,
run = function (scheduler, state1) {
self.queue.remove(si);
return action(scheduler, state1);
},
si = new ScheduledItem(self, state, run, dueTime, self.comparer);
self.queue.enqueue(si);
return si.disposable;
}
return VirtualTimeScheduler;
}());
}(Scheduler));
/**
* Represents a group of disposable resources that are disposed together.
*
* @constructor
* Represents a group of disposable resources that are disposed together.
*/
var CompositeDisposable = root.CompositeDisposable = function () {
var CompositeDisposable = Rx.CompositeDisposable = function () {
this.disposables = argsOrArray(arguments, 0);

@@ -11,8 +12,10 @@ this.isDisposed = false;

var CompositeDisposablePrototype = CompositeDisposable.prototype;
/**
* Adds a disposable to the CompositeDisposable or disposes the disposable if the CompositeDisposable is disposed.
*
* @param item Disposable to add.
* @param {Mixed} item Disposable to add.
*/
CompositeDisposable.prototype.add = function (item) {
CompositeDisposablePrototype.add = function (item) {
if (this.isDisposed) {

@@ -29,6 +32,7 @@ item.dispose();

*
* @param item Disposable to remove.
* @return true if found; false otherwise.
* @memberOf CompositeDisposable#
* @param {Mixed} item Disposable to remove.
* @returns {Boolean} true if found; false otherwise.
*/
CompositeDisposable.prototype.remove = function (item) {
CompositeDisposablePrototype.remove = function (item) {
var shouldDispose = false;

@@ -50,4 +54,6 @@ if (!this.isDisposed) {

* Disposes all disposables in the group and removes them from the group.
*
* @memberOf CompositeDisposable#
*/
CompositeDisposable.prototype.dispose = function () {
CompositeDisposablePrototype.dispose = function () {
if (!this.isDisposed) {

@@ -67,4 +73,6 @@ this.isDisposed = true;

* Removes and disposes all disposables from the CompositeDisposable, but does not dispose the CompositeDisposable.
*
* @memberOf CompositeDisposable#
*/
CompositeDisposable.prototype.clear = function () {
CompositeDisposablePrototype.clear = function () {
var currentDisposables = this.disposables.slice(0);

@@ -81,6 +89,7 @@ this.disposables = [];

*
* @param item Disposable to search for.
* @return true if the disposable was found; otherwise, false.
* @memberOf CompositeDisposable#
* @param {Mixed} item Disposable to search for.
* @returns {Boolean} true if the disposable was found; otherwise, false.
*/
CompositeDisposable.prototype.contains = function (item) {
CompositeDisposablePrototype.contains = function (item) {
return this.disposables.indexOf(item) !== -1;

@@ -92,7 +101,8 @@ };

*
* @return An array of disposable objects.
* @memberOf CompositeDisposable#
* @returns {Array} An array of disposable objects.
*/
CompositeDisposable.prototype.toArray = function () {
CompositeDisposablePrototype.toArray = function () {
return this.disposables.slice(0);
};
/**
* @constructor
* Provides a set of static methods for creating Disposables.
* @param dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once.
*
* @constructor
* @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once.
*/
var Disposable = root.Disposable = function (action) {
var Disposable = Rx.Disposable = function (action) {
this.isDisposed = false;

@@ -11,3 +12,7 @@ this.action = action;

/** Performs the task of cleaning up resources. */
/**
* Performs the task of cleaning up resources.
*
* @memberOf Disposable#
*/
Disposable.prototype.dispose = function () {

@@ -23,8 +28,15 @@ if (!this.isDisposed) {

*
* @param dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once.
* @return The disposable object that runs the given action upon disposal.
* @static
* @memberOf Disposable
* @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once.
* @return {Disposable} The disposable object that runs the given action upon disposal.
*/
var disposableCreate = Disposable.create = function (action) { return new Disposable(action); };
/** Gets the disposable that does nothing when disposed. */
/**
* Gets the disposable that does nothing when disposed.
*
* @static
* @memberOf Disposable
*/
var disposableEmpty = Disposable.empty = { dispose: noop };
/**
* Represents a disposable resource that only disposes its underlying disposable resource when all <see cref="GetDisposable">dependent disposable objects</see> have been disposed.
* Represents a disposable resource that only disposes its underlying disposable resource when all dependent disposable objects have been disposed.
*/
var RefCountDisposable = root.RefCountDisposable = (function () {
var RefCountDisposable = Rx.RefCountDisposable = (function () {
/**
* @constructor
* @private
*/
function InnerDisposable(disposable) {

@@ -12,2 +16,3 @@ this.disposable = disposable;

/** @private */
InnerDisposable.prototype.dispose = function () {

@@ -28,3 +33,5 @@ if (!this.disposable.isDisposed) {

* Initializes a new instance of the RefCountDisposable with the specified disposable.
* @param disposable Underlying disposable.
*
* @constructor
* @param {Disposable} disposable Underlying disposable.
*/

@@ -38,3 +45,7 @@ function RefCountDisposable(disposable) {

/** Disposes the underlying disposable only when all dependent disposables have been disposed */
/**
* Disposes the underlying disposable only when all dependent disposables have been disposed
*
* @memberOf RefCountDisposable#
*/
RefCountDisposable.prototype.dispose = function () {

@@ -54,3 +65,5 @@ if (!this.isDisposed) {

* Returns a dependent disposable that when disposed decreases the refcount on the underlying disposable.
* @return A dependent disposable contributing to the reference count that manages the underlying disposable's lifetime.H
*
* @memberOf RefCountDisposable#
* @returns {Disposable} A dependent disposable contributing to the reference count that manages the underlying disposable's lifetime.H
*/

@@ -57,0 +70,0 @@ RefCountDisposable.prototype.getDisposable = function () {

@@ -0,4 +1,13 @@

/**
* @constructor
* @private
*/
function ScheduledDisposable(scheduler, disposable) {
this.scheduler = scheduler, this.disposable = disposable, this.isDisposed = false;
}
/**
* @private
* @memberOf ScheduledDisposable#
*/
ScheduledDisposable.prototype.dispose = function () {

@@ -5,0 +14,0 @@ var parent = this;

/**
* @constructor
* Represents a disposable resource whose underlying disposable resource can be replaced by another disposable resource, causing automatic disposal of the previous underlying disposable resource.
*
* @constructor
*/
var SerialDisposable = root.SerialDisposable = function () {
var SerialDisposable = Rx.SerialDisposable = function () {
this.isDisposed = false;

@@ -20,3 +21,5 @@ this.current = null;

* Sets the underlying disposable.
* @param value The new underlying disposable.
*
* @memberOf SerialDisposable#
* @param {Disposable} value The new underlying disposable.
*/

@@ -40,2 +43,6 @@ SerialDisposable.prototype.setDisposable = function (value) {

* If the SerialDisposable has already been disposed, assignment to this property causes immediate disposal of the given disposable object. Assigning this property disposes the previous disposable object.
*
* @memberOf SerialDisposable#
* @param {Disposable} [value] The new underlying disposable.
* @returns {Disposable} The underlying disposable.
*/

@@ -50,3 +57,7 @@ SerialDisposable.prototype.disposable = function (value) {

/** Disposes the underlying disposable as well as all future replacements. */
/**
* Disposes the underlying disposable as well as all future replacements.
*
* @memberOf SerialDisposable#
*/
SerialDisposable.prototype.dispose = function () {

@@ -53,0 +64,0 @@ var old;

/**
* Represents a disposable resource which only allows a single assignment of its underlying disposable resource.
* If an underlying disposable resource has already been set, future attempts to set the underlying disposable resource will throw an Error.
*
* @constructor
* Represents a disposable resource which only allows a single assignment of its underlying disposable resource.
* If an underlying disposable resource has already been set, future attempts to set the underlying disposable resource will throw an Error.
*/
var SingleAssignmentDisposable = root.SingleAssignmentDisposable = function () {
var SingleAssignmentDisposable = Rx.SingleAssignmentDisposable = function () {
this.isDisposed = false;

@@ -11,9 +12,12 @@ this.current = null;

var SingleAssignmentDisposablePrototype = SingleAssignmentDisposable.prototype;
/**
* Gets or sets the underlying disposable. After disposal, the result of getting this method is undefined.
*
* @param [value] The new underlying disposable.
* @return The underlying disposable.
* @memberOf SingleAssignmentDisposable#
* @param {Disposable} [value] The new underlying disposable.
* @returns {Disposable} The underlying disposable.
*/
SingleAssignmentDisposable.prototype.disposable = function (value) {
SingleAssignmentDisposablePrototype.disposable = function (value) {
return !value ? this.getDisposable() : this.setDisposable(value);

@@ -24,5 +28,7 @@ };

* Gets the underlying disposable. After disposal, the result of getting this method is undefined.
* @return The underlying disposable.
*
* @memberOf SingleAssignmentDisposable#
* @returns {Disposable} The underlying disposable.
*/
SingleAssignmentDisposable.prototype.getDisposable = function () {
SingleAssignmentDisposablePrototype.getDisposable = function () {
return this.current;

@@ -33,5 +39,7 @@ };

* Sets the underlying disposable.
* @param value The new underlying disposable.
*
* @memberOf SingleAssignmentDisposable#
* @param {Disposable} value The new underlying disposable.
*/
SingleAssignmentDisposable.prototype.setDisposable = function (value) {
SingleAssignmentDisposablePrototype.setDisposable = function (value) {
if (this.current) {

@@ -49,4 +57,8 @@ throw new Error('Disposable has already been assigned');

/** Disposes the underlying disposable. */
SingleAssignmentDisposable.prototype.dispose = function () {
/**
* Disposes the underlying disposable.
*
* @memberOf SingleAssignmentDisposable#
*/
SingleAssignmentDisposablePrototype.dispose = function () {
var old;

@@ -53,0 +65,0 @@ if (!this.isDisposed) {

// Aliases
var Observable = root.Observable,
var Observable = Rx.Observable,
observableProto = Observable.prototype,

@@ -8,11 +8,11 @@ observableCreateWithDisposable = Observable.createWithDisposable,

observableEmpty = Observable.empty,
disposableEmpty = root.Disposable.empty,
BinaryObserver = root.Internals.BinaryObserver,
CompositeDisposable = root.CompositeDisposable,
SerialDisposable = root.SerialDisposable,
SingleAssignmentDisposable = root.SingleAssignmentDisposable,
enumeratorCreate = root.Internals.Enumerator.create,
Enumerable = root.Internals.Enumerable,
disposableEmpty = Rx.Disposable.empty,
BinaryObserver = Rx.Internals.BinaryObserver,
CompositeDisposable = Rx.CompositeDisposable,
SerialDisposable = Rx.SerialDisposable,
SingleAssignmentDisposable = Rx.SingleAssignmentDisposable,
enumeratorCreate = Rx.Internals.Enumerator.create,
Enumerable = Rx.Internals.Enumerable,
enumerableForEach = Enumerable.forEach,
immediateScheduler = root.Scheduler.immediate,
immediateScheduler = Rx.Scheduler.immediate,
slice = Array.prototype.slice;

@@ -19,0 +19,0 @@

// Check for AMD
if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
window.Rx = root;
window.Rx = Rx;
return define(function () {
return root;
return Rx;
});
} else if (freeExports) {
if (typeof module == 'object' && module && module.exports == freeExports) {
module.exports = root;
module.exports = Rx;
} else {
freeExports = root;
freeExports = Rx;
}
} else {
window.Rx = root;
window.Rx = Rx;
}

@@ -1,3 +0,8 @@

// Enumerable
var Enumerable = root.Internals.Enumerable = (function () {
/** @private */
var Enumerable = Rx.Internals.Enumerable = (function () {
/**
* @constructor
* @private
*/
function Enumerable(getEnumerator) {

@@ -7,2 +12,6 @@ this.getEnumerator = getEnumerator;

/**
* @private
* @memberOf Enumerable#
*/
Enumerable.prototype.concat = function () {

@@ -52,2 +61,6 @@ var sources = this;

/**
* @private
* @memberOf Enumerable#
*/
Enumerable.prototype.catchException = function () {

@@ -104,3 +117,7 @@ var sources = this;

// Enumerable properties
/**
* @static
* @private
* @memberOf Enumerable
*/
var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) {

@@ -124,2 +141,8 @@ if (repeatCount === undefined) {

};
/**
* @static
* @private
* @memberOf Enumerable
*/
var enumerableFor = Enumerable.forEach = function (source, selector) {

@@ -126,0 +149,0 @@ selector || (selector = identity);

@@ -1,4 +0,6 @@

// Enumerator
var Enumerator = root.Internals.Enumerator = function (moveNext, getCurrent, dispose) {
/**
* @constructor
* @private
*/
var Enumerator = Rx.Internals.Enumerator = function (moveNext, getCurrent, dispose) {
this.moveNext = moveNext;

@@ -8,2 +10,8 @@ this.getCurrent = getCurrent;

};
/**
* @static
* @memberOf Enumerator
* @private
*/
var enumeratorCreate = Enumerator.create = function (moveNext, getCurrent, dispose) {

@@ -10,0 +18,0 @@ var done = false;

@@ -1,3 +0,8 @@

// TODO: Replace with a real Map once finalized
/** @private */
var Map = (function () {
/**
* @constructor
* @private
*/
function Map() {

@@ -8,2 +13,6 @@ this.keys = [];

/**
* @private
* @memberOf Map#
*/
Map.prototype['delete'] = function (key) {

@@ -18,2 +27,6 @@ var i = this.keys.indexOf(key);

/**
* @private
* @memberOf Map#
*/
Map.prototype.get = function (key, fallback) {

@@ -24,2 +37,6 @@ var i = this.keys.indexOf(key);

/**
* @private
* @memberOf Map#
*/
Map.prototype.set = function (key, value) {

@@ -33,7 +50,26 @@ var i = this.keys.indexOf(key);

/**
* @private
* @memberOf Map#
*/
Map.prototype.size = function () { return this.keys.length; };
/**
* @private
* @memberOf Map#
*/
Map.prototype.has = function (key) {
return this.keys.indexOf(key) !== -1;
};
/**
* @private
* @memberOf Map#
*/
Map.prototype.getKeys = function () { return this.keys.slice(0); };
/**
* @private
* @memberOf Map#
*/
Map.prototype.getValues = function () { return this.values.slice(0); };

@@ -40,0 +76,0 @@

@@ -24,45 +24,3 @@ // Utilities

}
var slice = Array.prototype.slice;
function argsOrArray(args, idx) {
return args.length === 1 && Array.isArray(args[idx]) ?
args[idx] :
slice.call(args);
}
var hasProp = {}.hasOwnProperty;
var inherits = root.Internals.inherits = function (child, parent) {
for (var key in parent) { // Enumerable bug in WebKit Mobile 4.0
if (key !== 'prototype' && hasProp.call(parent, key)) child[key] = parent[key];
}
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor();
child.super_ = parent.prototype;
return child;
};
var addProperties = root.Internals.addProperties = function (obj) {
var sources = slice.call(arguments, 1);
for (var i = 0, len = sources.length; i < len; i++) {
var source = sources[i];
for (var prop in source) {
obj[prop] = source[prop];
}
}
};
// Rx Utils
var addRef = root.Internals.addRef = function (xs, r) {
return new AnonymousObservable(function (observer) {
return new CompositeDisposable(r.getDisposable(), xs.subscribe(observer));
});
};
// Collection polyfills
function arrayInitialize(count, factory) {
var a = new Array(count);
for (var i = 0; i < count; i++) {
a[i] = factory();
}
return a;
}
var boxedString = Object("a"),

@@ -91,2 +49,3 @@ splitString = boxedString[0] != "a" || !(0 in boxedString);

}
if (!Array.prototype.map) {

@@ -113,2 +72,3 @@ Array.prototype.map = function map(fun /*, thisp*/) {

}
if (!Array.prototype.filter) {

@@ -126,2 +86,3 @@ Array.prototype.filter = function (predicate) {

}
if (!Array.isArray) {

@@ -132,2 +93,3 @@ Array.isArray = function (arg) {

}
if (!Array.prototype.indexOf) {

@@ -134,0 +96,0 @@ Array.prototype.indexOf = function indexOf(searchElement) {

@@ -5,3 +5,7 @@ (function (window, undefined) {

var root = { Internals: {} };
/**
* @name Rx
* @type Object
*/
var Rx = { Internals: {} };
// Aliases
var Observable = root.Observable,
var Observable = Rx.Observable,
observableProto = Observable.prototype,
AnonymousObservable = root.Internals.AnonymousObservable,
AnonymousObservable = Rx.Internals.AnonymousObservable,
observableThrow = Observable.throwException,
observerCreate = root.Observer.create,
SingleAssignmentDisposable = root.SingleAssignmentDisposable,
CompositeDisposable = root.CompositeDisposable,
AbstractObserver = root.Internals.AbstractObserver;
observerCreate = Rx.Observer.create,
SingleAssignmentDisposable = Rx.SingleAssignmentDisposable,
CompositeDisposable = Rx.CompositeDisposable,
AbstractObserver = Rx.Internals.AbstractObserver;

@@ -16,3 +16,3 @@ // Defaults

// Utilities
var inherits = root.Internals.inherits;
var inherits = Rx.Internals.inherits;
var slice = Array.prototype.slice;

@@ -19,0 +19,0 @@ function argsOrArray(args, idx) {

@@ -1,8 +0,12 @@

// Join Observer
var JoinObserver = (function () {
/** @private */
var JoinObserver = (function (_super) {
inherits(JoinObserver, AbstractObserver);
inherits(JoinObserver, _super);
/**
* @constructor
* @private
*/
function JoinObserver(source, onError) {
JoinObserver.super_.constructor.call(this);
_super.call(this);
this.source = source;

@@ -16,3 +20,9 @@ this.onError = onError;

JoinObserver.prototype.next = function (notification) {
var JoinObserverPrototype = JoinObserver.prototype;
/**
* @memberOf JoinObserver#
* @private
*/
JoinObserverPrototype.next = function (notification) {
if (!this.isDisposed) {

@@ -30,12 +40,36 @@ if (notification.kind === 'E') {

};
JoinObserver.prototype.error = noop;
JoinObserver.prototype.completed = noop;
JoinObserver.prototype.addActivePlan = function (activePlan) {
/**
* @memberOf JoinObserver#
* @private
*/
JoinObserverPrototype.error = noop;
/**
* @memberOf JoinObserver#
* @private
*/
JoinObserverPrototype.completed = noop;
/**
* @memberOf JoinObserver#
* @private
*/
JoinObserverPrototype.addActivePlan = function (activePlan) {
this.activePlans.push(activePlan);
};
JoinObserver.prototype.subscribe = function () {
/**
* @memberOf JoinObserver#
* @private
*/
JoinObserverPrototype.subscribe = function () {
this.subscription.disposable(this.source.materialize().subscribe(this));
};
JoinObserver.prototype.removeActivePlan = function (activePlan) {
/**
* @memberOf JoinObserver#
* @private
*/
JoinObserverPrototype.removeActivePlan = function (activePlan) {
var idx = this.activePlans.indexOf(activePlan);

@@ -47,4 +81,9 @@ this.activePlans.splice(idx, 1);

};
JoinObserver.prototype.dispose = function () {
JoinObserver.super_.dispose.call(this);
/**
* @memberOf JoinObserver#
* @private
*/
JoinObserverPrototype.dispose = function () {
_super.prototype.dispose.call(this);
if (!this.isDisposed) {

@@ -55,3 +94,4 @@ this.isDisposed = true;

};
return JoinObserver;
} ());
} (AbstractObserver));

@@ -1,3 +0,9 @@

var ConnectableObservable = (function () {
inherits(ConnectableObservable, Observable);
/** @private */
var ConnectableObservable = (function (_super) {
inherits(ConnectableObservable, _super);
/**
* @constructor
* @private
*/
function ConnectableObservable(source, subject) {

@@ -21,13 +27,21 @@ var state = {

var subscribe = function (observer) {
function subscribe(observer) {
return state.subject.subscribe(observer);
};
ConnectableObservable.super_.constructor.call(this, subscribe);
}
_super.call(this, subscribe);
}
/**
* @private
* @memberOf ConnectableObservable
*/
ConnectableObservable.prototype.connect = function () { return this.connect(); };
/**
* @private
* @memberOf ConnectableObservable
*/
ConnectableObservable.prototype.refCount = function () {
var connectableSubscription = null,
count = 0,
source = this;
var connectableSubscription = null, count = 0, source = this;
return new AnonymousObservable(function (observer) {

@@ -52,2 +66,2 @@ var shouldConnect, subscription;

return ConnectableObservable;
}());
}(Observable));

@@ -1,2 +0,5 @@

var GroupedObservable = (function () {
/** @private */
var GroupedObservable = (function (_super) {
inherits(GroupedObservable, _super);
function subscribe(observer) {

@@ -6,5 +9,8 @@ return this.underlyingObservable.subscribe(observer);

inherits(GroupedObservable, Observable);
/**
* @constructor
* @private
*/
function GroupedObservable(key, underlyingObservable, mergedDisposable) {
GroupedObservable.super_.constructor.call(this, subscribe);
_super.call(this, subscribe);
this.key = key;

@@ -17,3 +23,4 @@ this.underlyingObservable = !mergedDisposable ?

}
return GroupedObservable;
}());
}(Observable));

@@ -45,4 +45,2 @@ function extremaBy(source, keySelector, comparer) {

// Aggregation methods
/**

@@ -52,8 +50,9 @@ * Applies an accumulator function over an observable sequence, returning the result of the aggregation as a single element in the result sequence. The specified seed value is used as the initial accumulator value.

*
* @example
* 1 - res = source.aggregate(function (acc, x) { return acc + x; });
* 2 - res = source.aggregate(0, function (acc, x) { return acc + x; });
* @param [seed] The initial accumulator value.
* @param accumulator An accumulator function to be invoked on each element.
* @return An observable sequence containing a single element with the final accumulator value.
* @memberOf Observable#
* @param {Mixed} [seed] The initial accumulator value.
* @param {Function} accumulator An accumulator function to be invoked on each element.
* @returns {Observable} An observable sequence containing a single element with the final accumulator value.
*/

@@ -72,2 +71,14 @@ observableProto.aggregate = function () {

/**
* Applies an accumulator function over an observable sequence, returning the result of the aggregation as a single element in the result sequence. The specified seed value is used as the initial accumulator value.
* For aggregation behavior with incremental intermediate results, see Observable.scan.
*
* @example
* 1 - res = source.reduce(function (acc, x) { return acc + x; });
* 2 - res = source.reduce(function (acc, x) { return acc + x; }, 0);
* @memberOf Observable#
* @param {Mixed} [seed] The initial accumulator value.
* @param {Function} accumulator An accumulator function to be invoked on each element.
* @returns {Observable} An observable sequence containing a single element with the final accumulator value.
*/
observableProto.reduce = function () {

@@ -87,10 +98,10 @@ var seed, hasSeed, accumulator = arguments[0];

* 2 - source.any(function (x) { return x > 3; });
*
* @memberOf Observable#
* @param {Function} [predicate] A function to test each element for a condition.
* @return An observable sequence containing a single element determining whether any elements in the source sequence pass the test in the specified predicate if given, else if any items are in the sequence.
* @returns {Observable} An observable sequence containing a single element determining whether any elements in the source sequence pass the test in the specified predicate if given, else if any items are in the sequence.
*/
observableProto.any = observableProto.some = function (predicate) {
observableProto.any = function (predicate, thisArg) {
var source = this;
return predicate
? source.where(predicate).any()
? source.where(predicate, thisArg).any()
: new AnonymousObservable(function (observer) {

@@ -106,7 +117,9 @@ return source.subscribe(function () {

};
observableProto.some = observableProto.any;
/**
* Determines whether an observable sequence is empty.
*
* @return An observable sequence containing a single element determining whether the source sequence is empty.
*
* @memberOf Observable#
* @returns {Observable} An observable sequence containing a single element determining whether the source sequence is empty.
*/

@@ -121,13 +134,15 @@ observableProto.isEmpty = function () {

* 1 - res = source.all(function (value) { return value.length > 3; });
*
* @memberOf Observable#
* @param {Function} [predicate] A function to test each element for a condition.
* @return An observable sequence containing a single element determining whether all elements in the source sequence pass the test in the specified predicate.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence containing a single element determining whether all elements in the source sequence pass the test in the specified predicate.
*/
observableProto.all = observableProto.every = function (predicate) {
observableProto.all = function (predicate, thisArg) {
return this.where(function (v) {
return !predicate(v);
}).any().select(function (b) {
}, thisArg).any().select(function (b) {
return !b;
});
};
observableProto.every = observableProto.all;

@@ -139,6 +154,6 @@ /**

* 2 - res = source.contains({ value: 42 }, function (x, y) { return x.value === y.value; });
*
* @memberOf Observable#
* @param value The value to locate in the source sequence.</param>
* @param {Function} [comparer] An equality comparer to compare elements.
* @return An observable sequence containing a single element determining whether the source sequence contains an element that has the specified value.
* @returns {Observable} An observable sequence containing a single element determining whether the source sequence contains an element that has the specified value.
*/

@@ -157,5 +172,5 @@ observableProto.contains = function (value, comparer) {

* 2 - res = source.count(function (x) { return x > 3; });
*
* @memberOf Observable#
* @param {Function} [predicate]A function to test each element for a condition.
* @return 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.
* @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.
*/

@@ -175,5 +190,5 @@ observableProto.count = function (predicate) {

* 2 - res = source.sum(function (x) { return x.value; });
*
* @memberOf Observable#
* @param {Function} [selector]A transform function to apply to each element.
* @return An observable sequence containing a single element with the sum of the values in the source sequence.
* @returns {Observable} An observable sequence containing a single element with the sum of the values in the source sequence.
*/

@@ -193,6 +208,6 @@ observableProto.sum = function (keySelector) {

* 2 - source.minBy(function (x) { return x.value; }, function (x, y) { return x - y; });
*
* @memberOf Observable#
* @param {Function} keySelector Key selector function.</param>
* @param {Function} [comparer] Comparer used to compare key values.</param>
* @return An observable sequence containing a list of zero or more elements that have a minimum key value.
* @returns {Observable} An observable sequence containing a list of zero or more elements that have a minimum key value.
*/

@@ -211,5 +226,5 @@ observableProto.minBy = function (keySelector, comparer) {

* 2 - source.min(function (x, y) { return x.value - y.value; });
*
* @memberOf Observable#
* @param {Function} [comparer] Comparer used to compare elements.
* @return An observable sequence containing a single element with the minimum element in the source sequence.
* @returns {Observable} An observable sequence containing a single element with the minimum element in the source sequence.
*/

@@ -225,8 +240,9 @@ observableProto.min = function (comparer) {

*
* @example
* 1 - source.maxBy(function (x) { return x.value; });
* 2 - source.maxBy(function (x) { return x.value; }, function (x, y) { return x - y;; });
*
* @memberOf Observable#
* @param {Function} keySelector Key selector function.
* @param {Function} [comparer] Comparer used to compare key values.
* @return An observable sequence containing a list of zero or more elements that have a maximum key value.
* @returns {Observable} An observable sequence containing a list of zero or more elements that have a maximum key value.
*/

@@ -238,11 +254,12 @@ observableProto.maxBy = function (keySelector, comparer) {

/**
* Returns the maximum value in an observable sequence according to the specified comparer.
*
* 1 - source.max();
* 2 - source.max(function (x, y) { return x.value - y.value; });
*
* @param {Function} [comparer] Comparer used to compare elements.
* @return An observable sequence containing a single element with the maximum element in the source sequence.
*/
/**
* Returns the maximum value in an observable sequence according to the specified comparer.
*
* @example
* 1 - source.max();
* 2 - source.max(function (x, y) { return x.value - y.value; });
* @memberOf Observable#
* @param {Function} [comparer] Comparer used to compare elements.
* @returns {Observable} An observable sequence containing a single element with the maximum element in the source sequence.
*/
observableProto.max = function (comparer) {

@@ -257,7 +274,8 @@ return this.maxBy(identity, comparer).select(function (x) {

*
* @example
* 1 - res = source.average();
* 2 - res = source.average(function (x) { return x.value; });
*
* @memberOf Observable#
* @param {Function} [selector] A transform function to apply to each element.
* @return An observable sequence containing a single element with the average of the sequence of values.
* @returns {Observable} An observable sequence containing a single element with the average of the sequence of values.
*/

@@ -307,2 +325,3 @@ observableProto.average = function (keySelector) {

*
* @example
* 1 - res = source.sequenceEqual([1,2,3]);

@@ -312,6 +331,6 @@ * 2 - res = source.sequenceEqual([{ value: 42 }], function (x, y) { return x.value === y.value; });

* 4 - res = source.sequenceEqual(Rx.Observable.returnValue({ value: 42 }), function (x, y) { return x.value === y.value; });
*
* @param second Second observable sequence or array to compare.
* @memberOf Observable#
* @param {Observable} second Second observable sequence or array to compare.
* @param {Function} [comparer] Comparer used to compare elements of both sequences.
* @return An observable sequence that contains a single element which indicates whether both sequences are of equal length and their corresponding elements are equal according to the specified equality comparer.
* @returns {Observable} An observable sequence that contains a single element which indicates whether both sequences are of equal length and their corresponding elements are equal according to the specified equality comparer.
*/

@@ -420,6 +439,7 @@ observableProto.sequenceEqual = function (second, comparer) {

*
* @example
* source.elementAt(5);
*
* @memberOf Observable#
* @param {Number} index The zero-based index of the element to retrieve.
* @return An observable sequence that produces the element at the specified position in the source sequence.
* @returns {Observable} An observable sequence that produces the element at the specified position in the source sequence.
*/

@@ -433,8 +453,9 @@ observableProto.elementAt = function (index) {

*
* @example
* source.elementAtOrDefault(5);
* source.elementAtOrDefault(5, 0);
*
* @memberOf Observable#
* @param {Number} index The zero-based index of the element to retrieve.
* @param [defaultValue] The default value if the index is outside the bounds of the source sequence.
* @return An observable sequence that produces the element at the specified position in the source sequence, or a default value if the index is outside the bounds of the source sequence.
* @returns {Observable} An observable sequence that produces the element at the specified position in the source sequence, or a default value if the index is outside the bounds of the source sequence.
*/

@@ -469,7 +490,8 @@ observableProto.elementAtOrDefault = function (index, defaultValue) {

*
* @example
* 1 - res = source.single();
* 2 - res = source.single(function (x) { return x === 42; });
*
* @memberOf Observable#
* @param {Function} [predicate] A predicate function to evaluate for elements in the source sequence.
* @return Sequence containing the single element in the observable sequence that satisfies the condition in the predicate.
* @returns {Observable} Sequence containing the single element in the observable sequence that satisfies the condition in the predicate.
*/

@@ -486,2 +508,3 @@ observableProto.single = function (predicate) {

*
* @example
* 1 - res = source.singleOrDefault();

@@ -491,6 +514,6 @@ * 2 - res = source.singleOrDefault(function (x) { return x === 42; });

* 4 - res = source.singleOrDefault(null, 0);
*
* @memberOf Observable#
* @param {Function} predicate A predicate function to evaluate for elements in the source sequence.
* @param [defaultValue] The default value if the index is outside the bounds of the source sequence.
* @return 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.
* @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.
*/

@@ -523,7 +546,8 @@ observableProto.singleOrDefault = function (predicate, defaultValue) {

*
* @example
* 1 - res = source.first();
* 2 - res = source.first(function (x) { return x > 3; });
*
* @memberOf Observable#
* @param {Function} [predicate] A predicate function to evaluate for elements in the source sequence.
* @return 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.
* @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.
*/

@@ -539,2 +563,4 @@ observableProto.first = function (predicate) {

* Returns the first element of an observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.
*
* @example
* 1 - res = source.firstOrDefault();

@@ -544,6 +570,6 @@ * 2 - res = source.firstOrDefault(function (x) { return x > 3; });

* 4 - res = source.firstOrDefault(null, 0);
*
* @memberOf Observable#
* @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.
* @return 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.
* @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.
*/

@@ -577,7 +603,8 @@ observableProto.firstOrDefault = function (predicate, defaultValue) {

*
* @example
* 1 - res = source.last();
* 2 - res = source.last(function (x) { return x > 3; });
*
* @memberOf Observable#
* @param {Function} [predicate] A predicate function to evaluate for elements in the source sequence.
* @return Sequence containing the last element in the observable sequence that satisfies the condition in the predicate.
* @returns {Observable} Sequence containing the last element in the observable sequence that satisfies the condition in the predicate.
*/

@@ -594,2 +621,3 @@ observableProto.last = function (predicate) {

*
* @example
* 1 - res = source.lastOrDefault();

@@ -599,6 +627,6 @@ * 2 - res = source.lastOrDefault(function (x) { return x > 3; });

* 4 - res = source.lastOrDefault(null, 0);
*
* @memberOf Observable#
* @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.
* @return 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.
* @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.
*/

@@ -611,1 +639,40 @@ observableProto.lastOrDefault = function (predicate, defaultValue) {

};
function findValue (source, predicate, thisArg, yieldIndex) {
return new AnonymousObservable(function (observer) {
return source.subscribe(function (x) {
if (predicate.call(thisArg, x, i, source)) {
observer.onNext(yieldIndex ? i : x);
observer.onCompleted();
} else {
i++;
}
}, observer.onError.bind(observer), function () {
observer.onNext(yieldIndex ? -1 : undefined);
observer.onCompleted();
});
});
}
/**
* Searches for an element that matches the conditions defined by the specified predicate, and returns the first occurrence within the entire Observable sequence.
*
* @memberOf Observable#
* @param {Function} predicate The predicate that defines the conditions of the element to search for.
* @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);
};
/**
* Searches for an element that matches the conditions defined by the specified predicate, and returns
* an Observable sequence with the zero-based index of the first occurrence within the entire Observable sequence.
*
* @memberOf Observable#
* @param {Function} predicate The predicate that defines the conditions of the element to search for.
* @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);
};
/**
* Invokes the specified function asynchronously on the specified scheduler, surfacing the result through an observable sequence.
*
* @example
* 1 - res = Rx.Observable.start(function () { console.log('hello'); });

@@ -8,6 +9,6 @@ * 2 - res = Rx.Observable.start(function () { console.log('hello'); }, Rx.Scheduler.timeout);

*
* @param func Function to run asynchronously.
* @param [scheduler] Scheduler to run the function on. If not specified, defaults to Scheduler.timeout.
* @param {Function} func Function to run asynchronously.
* @param {Scheduler} [scheduler] Scheduler to run the function on. If not specified, defaults to Scheduler.timeout.
* @param [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @return An observable sequence exposing the function's result value, or an exception.
* @returns {Observable} An observable sequence exposing the function's result value, or an exception.
*

@@ -25,2 +26,3 @@ * Remarks

*
* @example
* 1 - res = Rx.Observable.toAsync(function (x, y) { return x + y; })(4, 3);

@@ -31,5 +33,5 @@ * 2 - res = Rx.Observable.toAsync(function (x, y) { return x + y; }, Rx.Scheduler.timeout)(4, 3);

* @param function Function to convert to an asynchronous function.
* @param [scheduler] Scheduler to run the function on. If not specified, defaults to Scheduler.timeout.
* @param [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @return Asynchronous function.
* @param {Scheduler} [scheduler] Scheduler to run the function on. If not specified, defaults to Scheduler.timeout.
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @returns {Function} Asynchronous function.
*/

@@ -36,0 +38,0 @@ var observableToAsync = Observable.toAsync = function (func, scheduler, context) {

@@ -1,14 +0,14 @@

var Observable = root.Observable,
var Observable = Rx.Observable,
observableProto = Observable.prototype,
AnonymousObservable = root.Internals.AnonymousObservable,
Subject = root.Subject,
AsyncSubject = root.AsyncSubject,
Observer = root.Observer,
ScheduledObserver = root.Internals.ScheduledObserver,
disposableCreate = root.Disposable.create,
disposableEmpty = root.Disposable.empty,
CompositeDisposable = root.CompositeDisposable,
currentThreadScheduler = root.Scheduler.currentThread,
inherits = root.Internals.inherits,
addProperties = root.Internals.addProperties;
AnonymousObservable = Rx.Internals.AnonymousObservable,
Subject = Rx.Subject,
AsyncSubject = Rx.AsyncSubject,
Observer = Rx.Observer,
ScheduledObserver = Rx.Internals.ScheduledObserver,
disposableCreate = Rx.Disposable.create,
disposableEmpty = Rx.Disposable.empty,
CompositeDisposable = Rx.CompositeDisposable,
currentThreadScheduler = Rx.Scheduler.currentThread,
inherits = Rx.Internals.inherits,
addProperties = Rx.Internals.addProperties;

@@ -28,6 +28,7 @@ // Utilities

*
* @example
* 1 - res = source.multicast(observable);
* 2 - res = source.multicast(function () { return new Subject(); }, function (x) { return x; });
*
* @param subjectOrSubjectSelector
* @param {Mixed} subjectOrSubjectSelector
* Factory function to create an intermediate subject through which the source sequence's elements will be multicast to the selector function.

@@ -37,4 +38,4 @@ * Or:

*
* @param selector [Optional] Selector function which can use the multicasted source sequence subject to the policies enforced by the created subject. Specified only if <paramref name="subjectOrSubjectSelector" is a factory function.
* @return An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
* @param {Function} [selector] Optional selector function which can use the multicasted source sequence subject to the policies enforced by the created subject. Specified only if <paramref name="subjectOrSubjectSelector" is a factory function.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/

@@ -55,7 +56,8 @@ observableProto.multicast = function (subjectOrSubjectSelector, selector) {

*
* @example
* 1 - res = source.publish();
* 2 - res = source.publish(function (x) { return x; });
*
* @param selector [Optional] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all notifications of the source from the time of the subscription on.
* @return An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
* @param {Function} [selector] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all notifications of the source from the time of the subscription on.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/

@@ -74,2 +76,3 @@ observableProto.publish = function (selector) {

*
* @example
* 1 - res = source.publishLast();

@@ -79,3 +82,3 @@ * 2 - res = source.publishLast(function (x) { return x; });

* @param selector [Optional] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will only receive the last notification of the source.
* @return An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/

@@ -94,8 +97,9 @@ observableProto.publishLast = function (selector) {

*
* @example
* 1 - res = source.publishValue(42);
* 2 - res = source.publishLast(function (x) { return x.select(function (y) { return y * y; }) }, 42);
*
* @param selector [Optional] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive immediately receive the initial value, followed by all notifications of the source from the time of the subscription on.
* @param initialValue Initial value received by observers upon subscription.
* @return An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
* @param {Function} [selector] Optional selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive immediately receive the initial value, followed by all notifications of the source from the time of the subscription on.
* @param {Mixed} initialValue Initial value received by observers upon subscription.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/

@@ -114,2 +118,3 @@ observableProto.publishValue = function (initialValueOrSelector, initialValue) {

*
* @example
* 1 - res = source.replay(null, 3);

@@ -124,3 +129,3 @@ * 2 - res = source.replay(null, 3, 500);

* @param scheduler [Optional] Scheduler where connected observers within the selector function will be invoked on.
* @return An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/

@@ -127,0 +132,0 @@ observableProto.replay = function (selector, bufferSize, window, scheduler) {

@@ -1,10 +0,9 @@

// Joins
/**
* Correlates the elements of two sequences based on overlapping durations.
*
* @param right The right observable sequence to join elements for.
* @param leftDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the left observable sequence, used to determine overlap.
* @param rightDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the right observable sequence, used to determine overlap.
* @param resultSelector A function invoked to compute a result element for any two overlapping elements of the left and right observable sequences. The parameters passed to the function correspond with the elements from the left and right source sequences for which overlap occurs.
* @return An observable sequence that contains result elements computed from source elements that have an overlapping duration.
* @param {Observable} right The right observable sequence to join elements for.
* @param {Function} leftDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the left observable sequence, used to determine overlap.
* @param {Function} rightDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the right observable sequence, used to determine overlap.
* @param {Function} resultSelector A function invoked to compute a result element for any two overlapping elements of the left and right observable sequences. The parameters passed to the function correspond with the elements from the left and right source sequences for which overlap occurs.
* @returns {Observable} An observable sequence that contains result elements computed from source elements that have an overlapping duration.
*/

@@ -101,11 +100,10 @@ observableProto.join = function (right, leftDurationSelector, rightDurationSelector, resultSelector) {

// Group Join
/**
* Correlates the elements of two sequences based on overlapping durations, and groups the results.
*
* @param right The right observable sequence to join elements for.
* @param leftDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the left observable sequence, used to determine overlap.
* @param rightDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the right observable sequence, used to determine overlap.
* @param resultSelector A function invoked to compute a result element for any element of the left sequence with overlapping elements from the right observable sequence. The first parameter passed to the function is an element of the left sequence. The second parameter passed to the function is an observable sequence with elements from the right sequence that overlap with the left sequence's element.
* @return An observable sequence that contains result elements computed from source elements that have an overlapping duration.
* @param {Observable} right The right observable sequence to join elements for.
* @param {Function} leftDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the left observable sequence, used to determine overlap.
* @param {Function} rightDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the right observable sequence, used to determine overlap.
* @param {Function} resultSelector A function invoked to compute a result element for any element of the left sequence with overlapping elements from the right observable sequence. The first parameter passed to the function is an element of the left sequence. The second parameter passed to the function is an observable sequence with elements from the right sequence that overlap with the left sequence's element.
* @returns {Observable} An observable sequence that contains result elements computed from source elements that have an overlapping duration.
*/

@@ -229,5 +227,5 @@ observableProto.groupJoin = function (right, leftDurationSelector, rightDurationSelector, resultSelector) {

*
* @param bufferOpeningsOrClosingSelector Observable sequence whose elements denote the creation of new windows, or, a function invoked to define the boundaries of the produced windows (a new window is started when the previous one is closed, resulting in non-overlapping windows).
* @param [bufferClosingSelector] A function invoked to define the closing of each produced window. If a closing selector function is specified for the first parameter, this parameter is ignored.
* @return An observable sequence of windows.
* @param {Mixed} bufferOpeningsOrClosingSelector Observable sequence whose elements denote the creation of new windows, or, a function invoked to define the boundaries of the produced windows (a new window is started when the previous one is closed, resulting in non-overlapping windows).
* @param {Function} [bufferClosingSelector] A function invoked to define the closing of each produced window. If a closing selector function is specified for the first parameter, this parameter is ignored.
* @returns {Observable} An observable sequence of windows.
*/

@@ -252,5 +250,5 @@ observableProto.buffer = function (bufferOpeningsOrClosingSelector, bufferClosingSelector) {

*
* @param windowOpeningsOrClosingSelector Observable sequence whose elements denote the creation of new windows, or, a function invoked to define the boundaries of the produced windows (a new window is started when the previous one is closed, resulting in non-overlapping windows).
* @param [windowClosingSelector] A function invoked to define the closing of each produced window. If a closing selector function is specified for the first parameter, this parameter is ignored.
* @return An observable sequence of windows.
* @param {Mixed} windowOpeningsOrClosingSelector Observable sequence whose elements denote the creation of new windows, or, a function invoked to define the boundaries of the produced windows (a new window is started when the previous one is closed, resulting in non-overlapping windows).
* @param {Function} [windowClosingSelector] A function invoked to define the closing of each produced window. If a closing selector function is specified for the first parameter, this parameter is ignored.
* @returns {Observable} An observable sequence of windows.
*/

@@ -257,0 +255,0 @@ observableProto.window = function (windowOpeningsOrClosingSelector, windowClosingSelector) {

/**
* Wraps the source sequence in order to run its observer callbacks on the specified scheduler.
*
* @param scheduler Scheduler to notify observers on.</param>
* @return The source sequence whose observations happen on the specified scheduler.</returns>
*
*
* This only invokes observer callbacks on a scheduler. In case the subscription and/or unsubscription actions have side-effects
* that require to be run on a scheduler, use subscribeOn.
*
* @param {Scheduler} scheduler Scheduler to notify observers on.
* @returns {Observable} The source sequence whose observations happen on the specified scheduler.
*/

@@ -21,9 +20,8 @@ observableProto.observeOn = function (scheduler) {

* see the remarks section for more information on the distinction between subscribeOn and observeOn.
*
* @param scheduler Scheduler to perform subscription and unsubscription actions on.</param>
* @return The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler.</returns>
*
* This only performs the side-effects of subscription and unsubscription on the specified scheduler. In order to invoke observer
* callbacks on a scheduler, use observeOn.
*
* @param {Scheduler} scheduler Scheduler to perform subscription and unsubscription actions on.
* @returns {Observable} The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler.
*/

@@ -30,0 +28,0 @@ observableProto.subscribeOn = function (scheduler) {

/**
* Creates an observable sequence from a specified subscribe method implementation.
*
* @example
* 1 - res = Rx.Observable.create(function (observer) { return function () { } );
*
* @param subscribe Implementation of the resulting observable sequence's subscribe method, returning a function that will be wrapped in a Disposable.
* @return The observable sequence with the specified implementation for the Subscribe method.
* @param {Function} subscribe Implementation of the resulting observable sequence's subscribe method, returning a function that will be wrapped in a Disposable.
* @returns {Observable} The observable sequence with the specified implementation for the Subscribe method.
*/

@@ -18,6 +19,8 @@ Observable.create = function (subscribe) {

*
* @example
* 1 - res = Rx.Observable.create(function (observer) { return Rx.Disposable.empty; } );
*
* @param subscribe Implementation of the resulting observable sequence's subscribe method.
* @return The observable sequence with the specified implementation for the Subscribe method.
* @static
* @memberOf Observable
* @param {Function} subscribe Implementation of the resulting observable sequence's subscribe method.
* @returns {Observable} The observable sequence with the specified implementation for the Subscribe method.
*/

@@ -31,6 +34,8 @@ Observable.createWithDisposable = function (subscribe) {

*
* @example
* 1 - res = Rx.Observable.defer(function () { return Rx.Observable.fromArray([1,2,3]); });
*
* @param observableFactory Observable factory function to invoke for each observer that subscribes to the resulting sequence.
* @return An observable sequence whose observers trigger an invocation of the given observable factory function.
* @static
* @memberOf Observable
* @param {Function} observableFactory Observable factory function to invoke for each observer that subscribes to the resulting sequence.
* @returns {Observable} An observable sequence whose observers trigger an invocation of the given observable factory function.
*/

@@ -52,7 +57,9 @@ var observableDefer = Observable.defer = function (observableFactory) {

*
* @example
* 1 - res = Rx.Observable.empty();
* 2 - res = Rx.Observable.empty(Rx.Scheduler.timeout);
*
* @param scheduler Scheduler to send the termination call on.
* @return An observable sequence with no elements.
* @static
* @memberOf Observable
* @param {Scheduler} [scheduler] Scheduler to send the termination call on.
* @returns {Observable} An observable sequence with no elements.
*/

@@ -71,7 +78,9 @@ var observableEmpty = Observable.empty = function (scheduler) {

*
* @example
* 1 - res = Rx.Observable.fromArray([1,2,3]);
* 2 - res = Rx.Observable.fromArray([1,2,3], Rx.Scheduler.timeout);
*
* @param scheduler [Optional] Scheduler to run the enumeration of the input sequence on.
* @return The observable sequence whose elements are pulled from the given enumerable sequence.
* @static
* @memberOf Observable
* @param {Scheduler} [scheduler] Scheduler to run the enumeration of the input sequence on.
* @returns {Observable} The observable sequence whose elements are pulled from the given enumerable sequence.
*/

@@ -96,11 +105,13 @@ var observableFromArray = Observable.fromArray = function (array, scheduler) {

*
* @example
* 1 - res = Rx.Observable.generate(0, function (x) { return x < 10; }, function (x) { return x + 1; }, function (x) { return x; });
* 2 - res = Rx.Observable.generate(0, function (x) { return x < 10; }, function (x) { return x + 1; }, function (x) { return x; }, Rx.Scheduler.timeout);
*
* @param initialState Initial state.
* @param condition Condition to terminate generation (upon returning false).
* @param iterate Iteration step function.
* @param resultSelector Selector function for results produced in the sequence.
* @param scheduler [Optional] Scheduler on which to run the generator loop. If not provided, defaults to Scheduler.currentThread.
* @return The generated sequence.
* @static
* @memberOf Observable
* @param {Mixed} initialState Initial state.
* @param {Function} condition Condition to terminate generation (upon returning false).
* @param {Function} iterate Iteration step function.
* @param {Function} resultSelector Selector function for results produced in the sequence.
* @param {Scheduler} [scheduler] Scheduler on which to run the generator loop. If not provided, defaults to Scheduler.currentThread.
* @returns {Observable} The generated sequence.
*/

@@ -139,4 +150,6 @@ Observable.generate = function (initialState, condition, iterate, resultSelector, scheduler) {

* Returns a non-terminating observable sequence, which can be used to denote an infinite duration (e.g. when using reactive joins).
*
* @return An observable sequence whose observers will never get called.
*
* @static
* @memberOf Observable
* @returns {Observable} An observable sequence whose observers will never get called.
*/

@@ -152,9 +165,11 @@ var observableNever = Observable.never = function () {

*
* @example
* 1 - res = Rx.Observable.range(0, 10);
* 2 - res = Rx.Observable.range(0, 10, Rx.Scheduler.timeout);
*
* @param start The value of the first integer in the sequence.
* @param count The number of sequential integers to generate.
* @param scheduler [Optional] Scheduler to run the generator loop on. If not specified, defaults to Scheduler.currentThread.
* @return An observable sequence that contains a range of sequential integral numbers.
* @static
* @memberOf Observable
* @param {Number} start The value of the first integer in the sequence.
* @param {Number} count The number of sequential integers to generate.
* @param {Scheduler} [scheduler] Scheduler to run the generator loop on. If not specified, defaults to Scheduler.currentThread.
* @returns {Observable} An observable sequence that contains a range of sequential integral numbers.
*/

@@ -178,2 +193,3 @@ Observable.range = function (start, count, scheduler) {

*
* @example
* 1 - res = Rx.Observable.repeat(42);

@@ -183,7 +199,8 @@ * 2 - res = Rx.Observable.repeat(42, 4);

* 4 - res = Rx.Observable.repeat(42, null, Rx.Scheduler.timeout);
*
* @param value Element to repeat.
* @param repeatCount [Optiona] Number of times to repeat the element. If not specified, repeats indefinitely.
* @param scheduler Scheduler to run the producer loop on. If not specified, defaults to Scheduler.immediate.
* @return An observable sequence that repeats the given element the specified number of times.
* @static
* @memberOf Observable
* @param {Mixed} value Element to repeat.
* @param {Number} repeatCount [Optiona] Number of times to repeat the element. If not specified, repeats indefinitely.
* @param {Scheduler} scheduler Scheduler to run the producer loop on. If not specified, defaults to Scheduler.immediate.
* @returns {Observable} An observable sequence that repeats the given element the specified number of times.
*/

@@ -201,8 +218,10 @@ Observable.repeat = function (value, repeatCount, scheduler) {

*
* @example
* 1 - res = Rx.Observable.returnValue(42);
* 2 - res = Rx.Observable.returnValue(42, Rx.Scheduler.timeout);
*
* @param value Single element in the resulting observable sequence.
* @param scheduler Scheduler to send the single element on. If not specified, defaults to Scheduler.immediate.
* @return An observable sequence containing the single specified element.
* @static
* @memberOf Observable
* @param {Mixed} value Single element in the resulting observable sequence.
* @param {Scheduler} scheduler Scheduler to send the single element on. If not specified, defaults to Scheduler.immediate.
* @returns {Observable} An observable sequence containing the single specified element.
*/

@@ -222,8 +241,10 @@ var observableReturn = Observable.returnValue = function (value, scheduler) {

*
* @example
* 1 - res = Rx.Observable.throwException(new Error('Error'));
* 2 - res = Rx.Observable.throwException(new Error('Error'), Rx.Scheduler.timeout);
*
* @param exception An object used for the sequence's termination.
* @param scheduler Scheduler to send the exceptional termination call on. If not specified, defaults to Scheduler.immediate.
* @return The observable sequence that terminates exceptionally with the specified exception object.
* @static
* @memberOf Observable
* @param {Mixed} exception An object used for the sequence's termination.
* @param {Scheduler} scheduler Scheduler to send the exceptional termination call on. If not specified, defaults to Scheduler.immediate.
* @returns {Observable} The observable sequence that terminates exceptionally with the specified exception object.
*/

@@ -242,7 +263,9 @@ var observableThrow = Observable.throwException = function (exception, scheduler) {

*
* @example
* 1 - res = Rx.Observable.using(function () { return new AsyncSubject(); }, function (s) { return s; });
*
* @param resourceFactory Factory function to obtain a resource object.
* @param observableFactory Factory function to obtain an observable sequence that depends on the obtained resource.
* @return An observable sequence whose lifetime controls the lifetime of the dependent resource object.
* @static
* @memberOf Observable
* @param {Function} resourceFactory Factory function to obtain a resource object.
* @param {Function} observableFactory Factory function to obtain an observable sequence that depends on the obtained resource.
* @returns {Observable} An observable sequence whose lifetime controls the lifetime of the dependent resource object.
*/

@@ -249,0 +272,0 @@ Observable.using = function (resourceFactory, observableFactory) {

@@ -18,5 +18,5 @@ function enumerableWhile(condition, source) {

*
* @param source Source sequence that will be shared in the selector function.
* @param selector Selector function which can use the source sequence as many times as needed, without sharing subscriptions to the source sequence.
* @return An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
* @memberOf Observable#
* @param {Function} selector Selector function which can use the source sequence as many times as needed, without sharing subscriptions to the source sequence.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/

@@ -30,12 +30,12 @@ observableProto.letBind = function (func) {

*
* @example
* 1 - res = Rx.Observable.ifThen(condition, obs1);
* 2 - res = Rx.Observable.ifThen(condition, obs1, obs2);
* 3 - res = Rx.Observable.ifThen(condition, obs1, scheduler);
*
* @param condition The condition which determines if the thenSource or elseSource will be run.
* @param thenSource The observable sequence that will be run if the condition function returns true.
* @param elseSource
* [Optional] The observable sequence that will be run if the condition function returns false. If this is not provided, it defaults to Rx.Observabe.Empty with the specified scheduler.
*
* @return An observable sequence which is either the thenSource or elseSource.
* 3 - res = Rx.Observable.ifThen(condition, obs1, scheduler);
* @static
* @memberOf Observable
* @param {Function} condition The condition which determines if the thenSource or elseSource will be run.
* @param {Observable} thenSource The observable sequence that will be run if the condition function returns true.
* @param {Observable} [elseSource] The observable sequence that will be run if the condition function returns false. If this is not provided, it defaults to Rx.Observabe.Empty with the specified scheduler.
* @returns {Observable} An observable sequence which is either the thenSource or elseSource.
*/

@@ -55,6 +55,7 @@ Observable.ifThen = function (condition, thenSource, elseSourceOrScheduler) {

* Concatenates the observable sequences obtained by running the specified result selector for each element in source.
*
* @param sources An array of values to turn into an observable sequence.
* @param resultSelector A function to apply to each item in the sources array to turn it into an observable sequence.
* @return An observable sequence from the concatenated observable sequences.
* @static
* @memberOf Observable
* @param {Array} sources An array of values to turn into an observable sequence.
* @param {Function} resultSelector A function to apply to each item in the sources array to turn it into an observable sequence.
* @returns {Observable} An observable sequence from the concatenated observable sequences.
*/

@@ -67,6 +68,7 @@ Observable.forIn = function (sources, resultSelector) {

* Repeats source as long as condition holds emulating a while loop.
*
* @param condition The condition which determines if the source will be repeated.
* @param source The observable sequence that will be run if the condition function returns true.
* @return An observable sequence which is repeated as long as the condition holds.
* @static
* @memberOf Observable
* @param {Function} condition The condition which determines if the source will be repeated.
* @param {Observable} source The observable sequence that will be run if the condition function returns true.
* @returns {Observable} An observable sequence which is repeated as long as the condition holds.
*/

@@ -79,6 +81,7 @@ var observableWhileDo = Observable.whileDo = function (condition, source) {

* Repeats source as long as condition holds emulating a do while loop.
*
* @param condition The condition which determines if the source will be repeated.
* @param source The observable sequence that will be run if the condition function returns true.
* @return An observable sequence which is repeated as long as the condition holds.
*
* @memberOf Observable#
* @param {Function} condition The condition which determines if the source will be repeated.
* @param {Observable} source The observable sequence that will be run if the condition function returns true.
* @returns {Observable} An observable sequence which is repeated as long as the condition holds.
*/

@@ -92,12 +95,14 @@ observableProto.doWhile = function (condition) {

*
* @example
* 1 - res = Rx.Observable.switchCase(selector, { '1': obs1, '2': obs2 });
* 1 - res = Rx.Observable.switchCase(selector, { '1': obs1, '2': obs2 }, obs0);
* 1 - res = Rx.Observable.switchCase(selector, { '1': obs1, '2': obs2 }, scheduler);
*
* @param selector The function which extracts the value for to test in a case statement.
* @param sources A object which has keys which correspond to the case statement labels.
* @param elseSource
* [Optional] The observable sequence that will be run if the sources are not matched. If this is not provided, it defaults to Rx.Observabe.Empty with the specified scheduler.
* 1 - res = Rx.Observable.switchCase(selector, { '1': obs1, '2': obs2 }, scheduler);
*
* @static
* @memberOf Observable
* @param {Function} selector The function which extracts the value for to test in a case statement.
* @param {Array} sources A object which has keys which correspond to the case statement labels.
* @param {Observable} [elseSource] The observable sequence that will be run if the sources are not matched. If this is not provided, it defaults to Rx.Observabe.Empty with the specified scheduler.
*
* @return An observable sequence which is determined by a case statement.
* @returns {Observable} An observable sequence which is determined by a case statement.
*/

@@ -119,5 +124,6 @@ Observable.switchCase = function (selector, sources, defaultSourceOrScheduler) {

*
* @param selector Selector function to invoke for each produced element, resulting in another sequence to which the selector will be invoked recursively again.
* @param scheduler [Optional] Scheduler on which to perform the expansion. If not provided, this defaults to the current thread scheduler.
* @return An observable sequence containing all the elements produced by the recursive expansion.
* @memberOf Observable#
* @param {Function} selector Selector function to invoke for each produced element, resulting in another sequence to which the selector will be invoked recursively again.
* @param {Scheduler} [scheduler] Scheduler on which to perform the expansion. If not provided, this defaults to the current thread scheduler.
* @returns {Observable} An observable sequence containing all the elements produced by the recursive expansion.
*/

@@ -184,6 +190,8 @@ observableProto.expand = function (selector, scheduler) {

*
* @example
* 1 - res = Rx.Observable.forkJoin([obs1, obs2]);
* 1 - res = Rx.Observable.forkJoin(obs1, obs2, ...);
*
* @return An observable sequence with an array collecting the last elements of all the input sequences.
* 1 - res = Rx.Observable.forkJoin(obs1, obs2, ...);
* @static
* @memberOf Observable
* @returns {Observable} An observable sequence with an array collecting the last elements of all the input sequences.
*/

@@ -243,5 +251,6 @@ Observable.forkJoin = function () {

*
* @param second Second observable sequence.
* @param resultSelector Result selector function to invoke with the last elements of both sequences.
* @return An observable sequence with the result of calling the selector function with the last elements of both input sequences.
* @memberOf Observable#
* @param {Observable} second Second observable sequence.
* @param {Function} resultSelector Result selector function to invoke with the last elements of both sequences.
* @returns {Observable} An observable sequence with the result of calling the selector function with the last elements of both input sequences.
*/

@@ -248,0 +257,0 @@ observableProto.forkJoin = function (second, resultSelector) {

@@ -7,3 +7,3 @@ // Observable extensions

* @param right Observable sequence to match with the current sequence.</param>
* @return Pattern object that matches when both observable sequences have an available value.
* @return {Pattern} Pattern object that matches when both observable sequences have an available value.
*/

@@ -18,3 +18,3 @@ observableProto.and = function (right) {

* @param selector Selector that will be invoked for values in the source sequence.</param>
* @return Plan that produces the projected values, to be fed (with other plans) to the when operator.
* @returns {Plan} Plan that produces the projected values, to be fed (with other plans) to the when operator.
*/

@@ -29,3 +29,3 @@ observableProto.then = function (selector) {

* @param plans A series of plans (specified as an Array of as a series of arguments) created by use of the Then operator on patterns.</param>
* @return Observable sequence with the results form matching several patterns.
* @returns {Observable} Observable sequence with the results form matching several patterns.
*/

@@ -32,0 +32,0 @@ Observable.when = function () {

@@ -5,4 +5,5 @@

*
* @param rightSource Second observable sequence.
* @return An observable sequence that surfaces either of the given sequences, whichever reacted first.
* @memberOf Observable#
* @param {Observable} rightSource Second observable sequence.
* @returns {Observable} {Observable} An observable sequence that surfaces either of the given sequences, whichever reacted first.
*/

@@ -72,6 +73,8 @@ observableProto.amb = function (rightSource) {

* Propagates the observable sequence that reacts first.
*
*
* @example
* E.g. winner = Rx.Observable.amb(xs, ys, zs);
*
* @return An observable sequence that surfaces any of the given sequences, whichever reacted first.
* @static
* @memberOf Observable
* @returns {Observable} An observable sequence that surfaces any of the given sequences, whichever reacted first.
*/

@@ -112,8 +115,8 @@ Observable.amb = function () {

* Continues an observable sequence that is terminated by an exception with the next observable sequence.
*
* @example
* 1 - xs.catchException(ys)
* 2 - xs.catchException(function (ex) { return ys(ex); })
*
* @memberOf Observable#
* @param {Mixed} handlerOrSecond Exception handler function that returns an observable sequence given the error that occurred in the first sequence, or a second observable sequence used to produce results when an error occurred in the first sequence.
* @return An observable sequence containing the first sequence's elements, followed by the elements of the handler sequence in case an exception occurred.
* @returns {Observable} An observable sequence containing the first sequence's elements, followed by the elements of the handler sequence in case an exception occurred.
*/

@@ -130,6 +133,8 @@ observableProto.catchException = function (handlerOrSecond) {

*
* @example
* 1 - res = Rx.Observable.catchException(xs, ys, zs);
* 2 - res = Rx.Observable.catchException([xs, ys, zs]);
*
* @return An observable sequence containing elements from consecutive source sequences until a source sequence terminates successfully.
* @static
* @memberOf Observable
* @returns {Observable} An observable sequence containing elements from consecutive source sequences until a source sequence terminates successfully.
*/

@@ -144,7 +149,8 @@ var observableCatch = Observable.catchException = function () {

* This can be in the form of an argument list of observables or an array.
*
*
* @example
* 1 - obs = observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });
* 2 - obs = observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; });
*
* @return An observable sequence containing the result of combining elements of the sources using the specified result selector function.
* @memberOf Observable#
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/

@@ -164,6 +170,8 @@ observableProto.combineLatest = function () {

*
* @example
* 1 - obs = Rx.Observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });
* 2 - obs = Rx.Observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; });
*
* @return An observable sequence containing the result of combining elements of the sources using the specified result selector function.
* @static
* @memberOf Observable
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/

@@ -228,6 +236,7 @@ var combineLatest = Observable.combineLatest = function () {

*
* @example
* 1 - concatenated = xs.concat(ys, zs);
* 2 - concatenated = xs.concat([ys, zs]);
*
* @return An observable sequence that contains the elements of each given sequence, in sequential order.
* @memberOf Observable#
* @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order.
*/

@@ -243,6 +252,8 @@ observableProto.concat = function () {

*
* @example
* 1 - res = Rx.Observable.concat(xs, ys, zs);
* 2 - res = Rx.Observable.concat([xs, ys, zs]);
*
* @return An observable sequence that contains the elements of each given sequence, in sequential order.
* @static
* @memberOf Observable
* @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order.
*/

@@ -257,3 +268,4 @@ var observableConcat = Observable.concat = function () {

*
* @return An observable sequence that contains the elements of each observed inner sequence, in sequential order.
* @memberOf Observable#
* @returns {Observable} An observable sequence that contains the elements of each observed inner sequence, in sequential order.
*/

@@ -268,7 +280,8 @@ observableProto.concatObservable = observableProto.concatAll =function () {

*
* @example
* 1 - merged = sources.merge(1);
* 2 - merged = source.merge(otherSource);
*
* @param [maxConcurrentOrOther] Maximum number of inner observable sequences being subscribed to concurrently or the second observable sequence.
* @return The observable sequence that merges the elements of the inner sequences.
* @memberOf Observable#
* @param {Mixed} [maxConcurrentOrOther] Maximum number of inner observable sequences being subscribed to concurrently or the second observable sequence.
* @returns {Observable} The observable sequence that merges the elements of the inner sequences.
*/

@@ -323,2 +336,3 @@ observableProto.merge = function (maxConcurrentOrOther) {

*
* @example
* 1 - merged = Rx.Observable.merge(xs, ys, zs);

@@ -329,4 +343,5 @@ * 2 - merged = Rx.Observable.merge([xs, ys, zs]);

*
*
* @return The observable sequence that merges the elements of the observable sequences.
* @static
* @memberOf Observable
* @returns {Observable} The observable sequence that merges the elements of the observable sequences.
*/

@@ -354,3 +369,4 @@ var observableMerge = Observable.merge = function () {

*
* @return The observable sequence that merges the elements of the inner sequences.
* @memberOf Observable#
* @returns {Observable} The observable sequence that merges the elements of the inner sequences.
*/

@@ -388,4 +404,5 @@ observableProto.mergeObservable = observableProto.mergeAll =function () {

*
* @param second Second observable sequence used to produce results after the first sequence terminates.
* @return An observable sequence that concatenates the first and second sequence, even if the first sequence terminates exceptionally.
* @memberOf Observable
* @param {Observable} second Second observable sequence used to produce results after the first sequence terminates.
* @returns {Observable} An observable sequence that concatenates the first and second sequence, even if the first sequence terminates exceptionally.
*/

@@ -402,6 +419,8 @@ observableProto.onErrorResumeNext = function (second) {

*
* @example
* 1 - res = Rx.Observable.onErrorResumeNext(xs, ys, zs);
* 1 - res = Rx.Observable.onErrorResumeNext([xs, ys, zs]);
*
* @return An observable sequence that concatenates the source sequences, even if a sequence terminates exceptionally.
* @static
* @memberOf Observable
* @returns {Observable} An observable sequence that concatenates the source sequences, even if a sequence terminates exceptionally.
*/

@@ -434,4 +453,5 @@ var onErrorResumeNext = Observable.onErrorResumeNext = function () {

*
* @param other The observable sequence that triggers propagation of elements of the source sequence.
* @return An observable sequence containing the elements of the source sequence starting from the point the other sequence triggered propagation.
* @memberOf Observable#
* @param {Observable} other The observable sequence that triggers propagation of elements of the source sequence.
* @returns {Observable} An observable sequence containing the elements of the source sequence starting from the point the other sequence triggered propagation.
*/

@@ -468,3 +488,4 @@ observableProto.skipUntil = function (other) {

*
* @return The observable sequence that at any point in time produces the elements of the most recent inner observable sequence that has been received.
* @memberOf Observable#
* @returns {Observable} The observable sequence that at any point in time produces the elements of the most recent inner observable sequence that has been received.
*/

@@ -511,4 +532,5 @@ observableProto.switchLatest = function () {

*
* @param other Observable sequence that terminates propagation of elements of the source sequence.
* @return An observable sequence containing the elements of the source sequence up to the point the other sequence interrupted further propagation.
* @memberOf Observable#
* @param {Observable} other Observable sequence that terminates propagation of elements of the source sequence.
* @returns {Observable} An observable sequence containing the elements of the source sequence up to the point the other sequence interrupted further propagation.
*/

@@ -549,6 +571,8 @@ observableProto.takeUntil = function (other) {

* The last element in the arguments must be a function to invoke for each series of elements at corresponding indexes in the sources.
*
* @example
* 1 - res = obs1.zip(obs2, fn);
* 1 - res = x1.zip([1,2,3], fn);
*
* @return An observable sequence containing the result of combining elements of the sources using the specified result selector function.
* @memberOf Observable#
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/

@@ -603,2 +627,19 @@ observableProto.zip = function () {

});
};
};
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
*
* @static
* @memberOf Observable
* @param {Array} sources Observable sources.
* @param {Function} resultSelector Function to invoke for each series of elements at corresponding indexes in the sources.
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
Observable.zip = function (sources, resultSelector) {
var first = sources[0],
rest = sources.slice(1);
rest.push(resultSelector);
return first.zip.apply(first, rest);
};
/**
* Hides the identity of an observable sequence.
*
* @return An observable sequence that hides the identity of the source sequence.
* @returns {Observable} An observable sequence that hides the identity of the source sequence.
*/

@@ -16,8 +16,10 @@ observableProto.asObservable = function () {

*
* @example
* 1 - xs.bufferWithCount(10);
* 2 - xs.bufferWithCount(10, 1);
*
* @param count Length of each buffer.
* @param [skip] Number of elements to skip between creation of consecutive buffers. If not provided, defaults to the count.
* @return An observable sequence of buffers.
* @memberOf Observable#
* @param {Number} count Length of each buffer.
* @param {Number} [skip] Number of elements to skip between creation of consecutive buffers. If not provided, defaults to the count.
* @returns {Observable} An observable sequence of buffers.
*/

@@ -38,3 +40,4 @@ observableProto.bufferWithCount = function (count, skip) {

*
* @return An observable sequence exhibiting the behavior corresponding to the source sequence's notification values.
* @memberOf Observable#
* @returns {Observable} An observable sequence exhibiting the behavior corresponding to the source sequence's notification values.
*/

@@ -57,5 +60,6 @@ observableProto.dematerialize = function () {

*
* @param {Function} [keySelector] A function to compute the comparison key for each element. If not provided, it projects the value.
* @param {Function} [comparer] Equality comparer for computed key values. If not provided, defaults to an equality comparer function.
* @return An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence.
* @memberOf Observable#
* @param {Function} [keySelector] A function to compute the comparison key for each element. If not provided, it projects the value.
* @param {Function} [comparer] Equality comparer for computed key values. If not provided, defaults to an equality comparer function.
* @returns {Observable} An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence.
*/

@@ -97,2 +101,3 @@ observableProto.distinctUntilChanged = function (keySelector, comparer) {

*
* @example
* 1 - observable.doAction(observer);

@@ -103,6 +108,7 @@ * 2 - observable.doAction(onNext);

*
* @param observerOrOnNext Action to invoke for each element in the observable sequence or an observer.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.
* @return The source sequence with the side-effecting behavior applied.
* @memberOf Observable#
* @param {Mixed} observerOrOnNext Action to invoke for each element in the observable sequence or an observer.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.
* @returns {Observable} The source sequence with the side-effecting behavior applied.
*/

@@ -155,6 +161,8 @@ observableProto.doAction = function (observerOrOnNext, onError, onCompleted) {

*
* @example
* 1 - obs = observable.finallyAction(function () { console.log('sequence ended'; });
*
* @param finallyAction Action to invoke after the source observable sequence terminates.
* @return Source sequence with the action-invoking termination behavior applied.
* @memberOf Observable#
* @param {Function} finallyAction Action to invoke after the source observable sequence terminates.
* @returns {Observable} Source sequence with the action-invoking termination behavior applied.
*/

@@ -180,3 +188,4 @@ observableProto.finallyAction = function (action) {

*
* @return An empty observable sequence that signals termination, successful or exceptional, of the source sequence.
* @memberOf Observable#
* @returns {Observable} An empty observable sequence that signals termination, successful or exceptional, of the source sequence.
*/

@@ -193,3 +202,4 @@ observableProto.ignoreElements = function () {

*
* @return An observable sequence containing the materialized notification values from the source sequence.
* @memberOf Observable#
* @returns {Observable} An observable sequence containing the materialized notification values from the source sequence.
*/

@@ -214,7 +224,9 @@ observableProto.materialize = function () {

*
* @example
* 1 - repeated = source.repeat();
* 2 - repeated = source.repeat(42);
*
* @param {Number} [repeatCount] Number of times to repeat the sequence. If not provided, repeats the sequence indefinitely.
* @return The observable sequence producing the elements of the given sequence repeatedly.
* @memberOf Observable#
* @param {Number} [repeatCount] Number of times to repeat the sequence. If not provided, repeats the sequence indefinitely.
* @returns {Observable} The observable sequence producing the elements of the given sequence repeatedly.
*/

@@ -228,7 +240,9 @@ observableProto.repeat = function (repeatCount) {

*
* @example
* 1 - retried = retry.repeat();
* 2 - retried = retry.repeat(42);
*
* @param {Number} [retryCount] Number of times to retry the sequence. If not provided, retry the sequence indefinitely.
* @return An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully.
* @memberOf Observable#
* @param {Number} [retryCount] Number of times to retry the sequence. If not provided, retry the sequence indefinitely.
* @returns {Observable} An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully.
*/

@@ -246,5 +260,6 @@ observableProto.retry = function (retryCount) {

*
* @param [seed] The initial accumulator value.
* @param accumulator An accumulator function to be invoked on each element.
* @return An observable sequence containing the accumulated values.
* @memberOf Observable#
* @param {Mixed} [seed] The initial accumulator value.
* @param {Function} accumulator An accumulator function to be invoked on each element.
* @returns {Observable} An observable sequence containing the accumulated values.
*/

@@ -278,8 +293,8 @@ observableProto.scan = function () {

*
* @param count Number of elements to bypass at the end of the source sequence.
* @return An observable sequence containing the source sequence elements except for the bypassed ones at the end.
*
* @memberOf Observable#
* @description
* This operator accumulates a queue with a length enough to store the first <paramref name="count"/> elements. As more elements are
* received, elements are taken from the front of the queue and produced on the result sequence. This causes elements to be delayed.
*
* received, elements are taken from the front of the queue and produced on the result sequence. This causes elements to be delayed.
* @param count Number of elements to bypass at the end of the source sequence.
* @returns {Observable} An observable sequence containing the source sequence elements except for the bypassed ones at the end.
*/

@@ -305,3 +320,4 @@ observableProto.skipLast = function (count) {

*
* @return The source sequence prepended with the specified values.
* @memberOf Observable#
* @returns {Observable} The source sequence prepended with the specified values.
*/

@@ -323,12 +339,14 @@ observableProto.startWith = function () {

*
* @example
* 1 - obs = source.takeLast(5);
* 2 - obs = source.takeLast(5, Rx.Scheduler.timeout);
*
* @param count Number of elements to take from the end of the source sequence.
* @param [scheduler] Scheduler used to drain the queue upon completion of the source sequence.
* @return An observable sequence containing the specified number of elements from the end of the source sequence.
*
* This operator accumulates a buffer with a length enough to store elements <paramref name="count"/> elements. Upon completion of
* @description
* This operator accumulates a buffer with a length enough to store elements count elements. Upon completion of
* the source sequence, this buffer is drained on the result sequence. This causes the elements to be delayed.
*
*
* @memberOf Observable#
* @param {Number} count Number of elements to take from the end of the source sequence.
* @param {Scheduler} [scheduler] Scheduler used to drain the queue upon completion of the source sequence.
* @returns {Observable} An observable sequence containing the specified number of elements from the end of the source sequence.
*/

@@ -342,8 +360,9 @@ observableProto.takeLast = function (count, scheduler) {

*
* @param count Number of elements to take from the end of the source sequence.
* @return An observable sequence containing a single array with the specified number of elements from the end of the source sequence.
*
* This operator accumulates a buffer with a length enough to store <paramref name="count"/> elements. Upon completion of the
* source sequence, this buffer is produced on the result sequence.
*
* @description
* This operator accumulates a buffer with a length enough to store count elements. Upon completion of the
* source sequence, this buffer is produced on the result sequence.
*
* @memberOf Observable#
* @param {Number} count Number of elements to take from the end of the source sequence.
* @returns {Observable} An observable sequence containing a single array with the specified number of elements from the end of the source sequence.
*/

@@ -371,6 +390,7 @@ observableProto.takeLastBuffer = function (count) {

* 2 - xs.windowWithCount(10, 1);
*
* @param count Length of each window.
* @param [skip] Number of elements to skip between creation of consecutive windows. If not specified, defaults to the count.
* @return An observable sequence of windows.
*
* @memberOf Observable#
* @param {Number} count Length of each window.
* @param {Number} [skip] Number of elements to skip between creation of consecutive windows. If not specified, defaults to the count.
* @returns {Observable} An observable sequence of windows.
*/

@@ -377,0 +397,0 @@ observableProto.windowWithCount = function (count, skip) {

@@ -6,5 +6,6 @@ /**

* 2 - obs = xs.defaultIfEmpty(false);
*
* @param defaultValue The value to return if the sequence is empty. If not provided, this defaults to null.
* @return An observable sequence that contains the specified default value if the source is empty; otherwise, the elements of the source itself.
*
* @memberOf Observable#
* @param defaultValue The value to return if the sequence is empty. If not provided, this defaults to null.
* @returns {Observable} An observable sequence that contains the specified default value if the source is empty; otherwise, the elements of the source itself.
*/

@@ -32,11 +33,13 @@ observableProto.defaultIfEmpty = function (defaultValue) {

* Returns an observable sequence that contains only distinct elements according to the keySelector and the comparer.
*
* Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large.
*
* @example
* 1 - obs = xs.distinct();
* 2 - obs = xs.distinct(function (x) { return x.id; });
* 2 - obs = xs.distinct(function (x) { return x.id; }, function (x) { return x.toString(); });
*
* @param {Function} [keySelector] A function to compute the comparison key for each element.
* @param {Function} [keySerializer] Used to serialize the given object into a string for object comparison.
* @return An observable sequence only containing the distinct elements, based on a computed key value, from the source sequence.
* Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large.
*
* @memberOf Observable#
* @param {Function} [keySelector] A function to compute the comparison key for each element.
* @param {Function} [keySerializer] Used to serialize the given object into a string for object comparison.
* @returns {Observable} An observable sequence only containing the distinct elements, based on a computed key value, from the source sequence.
*/

@@ -75,10 +78,12 @@ observableProto.distinct = function (keySelector, keySerializer) {

*
* @example
* 1 - observable.groupBy(function (x) { return x.id; });
* 2 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; });
* 3 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; }, function (x) { return x.toString(); });
*
* @param keySelector A function to extract the key for each element.
* @param {Function} [elementSelector] A function to map each source element to an element in an observable group.
* @param {Function} [keySerializer] Used to serialize the given object into a string for object comparison.
* @return A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
*
* @memberOf Observable#
* @param {Function} keySelector A function to extract the key for each element.
* @param {Function} [elementSelector] A function to map each source element to an element in an observable group.
* @param {Function} [keySerializer] Used to serialize the given object into a string for object comparison.
* @returns {Observable} A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
*/

@@ -96,10 +101,12 @@ observableProto.groupBy = function (keySelector, elementSelector, keySerializer) {

*
* @example
* 1 - observable.groupByUntil(function (x) { return x.id; }, null, function () { return Rx.Observable.never(); });
* 2 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; }, function () { return Rx.Observable.never(); });
* 3 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; }, function () { return Rx.Observable.never(); }, function (x) { return x.toString(); });
*
* @param keySelector A function to extract the key for each element.
* @param durationSelector A function to signal the expiration of a group.
* @param {Function} [keySerializer] Used to serialize the given object into a string for object comparison.
* @return
*
* @memberOf Observable#
* @param {Function} keySelector A function to extract the key for each element.
* @param {Function} durationSelector A function to signal the expiration of a group.
* @param {Function} [keySerializer] Used to serialize the given object into a string for object comparison.
* @returns {Observable}
* A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.

@@ -203,9 +210,11 @@ * If a group's lifetime expires, a new group with the same key value can be created once an element with such a key value is encoutered.

*
* 1 - source.select(function (value) { return value * value; });
* 2 - source.select(function (value, index) { return value * value + index; });
*
* @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
* @return An observable sequence whose elements are the result of invoking the transform function on each element of source.
* @example
* source.select(function (value, index) { return value * value + index; });
*
* @memberOf Observable#
* @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source.
*/
observableProto.select = observableProto.map = function (selector) {
observableProto.select = function (selector, thisArg) {
var parent = this;

@@ -217,3 +226,3 @@ return new AnonymousObservable(function (observer) {

try {
result = selector(value, count++);
result = selector.call(thisArg, value, count++, parent);
} catch (exception) {

@@ -228,2 +237,4 @@ observer.onError(exception);

observableProto.map = observableProto.select;
function selectMany(selector) {

@@ -237,2 +248,3 @@ return this.select(selector).mergeObservable();

*
* @example
* 1 - source.selectMany(function (x) { return Rx.Observable.range(0, x); });

@@ -247,6 +259,7 @@ * Or:

* 1 - source.selectMany(Rx.Observable.fromArray([1,2,3]));
*
* @param selector A transform function to apply to each element or an observable sequence to project each element from the source sequence onto.
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
* @return An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
*
* @memberOf Observable#
* @param selector A transform function to apply to each element or an observable sequence to project each element from the source sequence onto.
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
*/

@@ -271,5 +284,6 @@ observableProto.selectMany = observableProto.flatMap = function (selector, resultSelector) {

* Bypasses a specified number of elements in an observable sequence and then returns the remaining elements.
*
* @param count The number of elements to skip before returning the remaining elements.
* @return An observable sequence that contains the elements that occur after the specified index in the input sequence.
*
* @memberOf Observable#
* @param {Number} count The number of elements to skip before returning the remaining elements.
* @returns {Observable} An observable sequence that contains the elements that occur after the specified index in the input sequence.
*/

@@ -299,5 +313,6 @@ observableProto.skip = function (count) {

* 1 - source.skipWhile(function (value, index) { return value < 10 || index < 10; });
*
* @param predicate A function to test each element for a condition; the second parameter of the function represents the index of the source element.
* @return An observable sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate.
*
* @memberOf Observable#
* @param {Function} predicate A function to test each element for a condition; the second parameter of the function represents the index of the source element.
* @returns {Observable} An observable sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate.
*/

@@ -329,6 +344,7 @@ observableProto.skipWhile = function (predicate) {

* 2 - source.take(0, Rx.Scheduler.timeout);
*
* @param {Number} count The number of elements to return.
* @param [scheduler] Scheduler used to produce an OnCompleted message in case <paramref name="count count</paramref> is set to 0.
* @return An observable sequence that contains the specified number of elements from the start of the input sequence.
*
* @memberOf Observable#
* @param {Number} count The number of elements to return.
* @param {Scheduler} [scheduler] Scheduler used to produce an OnCompleted message in case <paramref name="count count</paramref> is set to 0.
* @returns {Observable} An observable sequence that contains the specified number of elements from the start of the input sequence.
*/

@@ -361,7 +377,9 @@ observableProto.take = function (count, scheduler) {

*
* @example
* 1 - source.takeWhile(function (value) { return value < 10; });
* 1 - source.takeWhile(function (value, index) { return value < 10 || index < 10; });
*
* @param {Function} predicate A function to test each element for a condition; the second parameter of the function represents the index of the source element.
* @return An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes.
*
* @memberOf Observable#
* @param {Function} predicate A function to test each element for a condition; the second parameter of the function represents the index of the source element.
* @returns {Observable} An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes.
*/

@@ -393,9 +411,12 @@ observableProto.takeWhile = function (predicate) {

*
* @example
* 1 - source.where(function (value) { return value < 10; });
* 1 - source.where(function (value, index) { return value < 10 || index < 10; });
*
* @param {Function} predicate A function to test each source element for a conditio; the second parameter of the function represents the index of the source element.
* @return An observable sequence that contains elements from the input sequence that satisfy the condition.
*
* @memberOf Observable#
* @param {Function} predicate A function to test each source element for a condition; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence that contains elements from the input sequence that satisfy the condition.
*/
observableProto.where = observableProto.filter = function (predicate) {
observableProto.where = function (predicate, thisArg) {
var parent = this;

@@ -407,3 +428,3 @@ return new AnonymousObservable(function (observer) {

try {
shouldRun = predicate(value, count++);
shouldRun = predicate.call(thisArg, value, count++, parent);
} catch (exception) {

@@ -418,2 +439,4 @@ observer.onError(exception);

});
};
};
observableProto.filter = observableProto.where;

@@ -56,8 +56,11 @@ function observableTimerDate(dueTime, scheduler) {

*
* @example
* 1 - res = Rx.Observable.interval(1000);
* 2 - res = Rx.Observable.interval(1000, Rx.Scheduler.timeout);
*
* @param period Period for producing the values in the resulting sequence (specified as an integer denoting milliseconds).
* @param [scheduler] Scheduler to run the timer on. If not specified, Rx.Scheduler.timeout is used.
* @return An observable sequence that produces a value after each period.
*
* @static
* @memberOf Observable
* @param {Number} period Period for producing the values in the resulting sequence (specified as an integer denoting milliseconds).
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, Rx.Scheduler.timeout is used.
* @returns {Observable} An observable sequence that produces a value after each period.
*/

@@ -72,2 +75,3 @@ var observableinterval = Observable.interval = function (period, scheduler) {

*
* @example
* 1 - res = Rx.Observable.timer(new Date());

@@ -83,6 +87,8 @@ * 2 - res = Rx.Observable.timer(new Date(), 1000);

*
* @param dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) at which to produce the first value.
* @param [periodOrScheduler] Period to produce subsequent values (specified as an integer denoting milliseconds), or the scheduler to run the timer on. If not specified, the resulting timer is not recurring.
* @param [scheduler] Scheduler to run the timer on. If not specified, the timeout scheduler is used.
* @return An observable sequence that produces a value after due time has elapsed and then each period.
* @static
* @memberOf Observable
* @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) at which to produce the first value.
* @param {Mixed} [periodOrScheduler] Period to produce subsequent values (specified as an integer denoting milliseconds), or the scheduler to run the timer on. If not specified, the resulting timer is not recurring.
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence that produces a value after due time has elapsed and then each period.
*/

@@ -186,2 +192,3 @@ var observableTimer = Observable.timer = function (dueTime, periodOrScheduler, scheduler) {

*
* @example
* 1 - res = Rx.Observable.timer(new Date());

@@ -192,6 +199,6 @@ * 2 - res = Rx.Observable.timer(new Date(), Rx.Scheduler.timeout);

* 4 - res = Rx.Observable.delay(5000, 1000, Rx.Scheduler.timeout);
*
* @param dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) by which to shift the observable sequence.
* @param [scheduler] Scheduler to run the delay timers on. If not specified, the timeout scheduler is used.
* @return Time-shifted sequence.
* @memberOf Observable#
* @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) by which to shift the observable sequence.
* @param {Scheduler} [scheduler] Scheduler to run the delay timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} Time-shifted sequence.
*/

@@ -208,8 +215,10 @@ observableProto.delay = function (dueTime, scheduler) {

*
* @example
* 1 - res = source.throttle(5000); // 5 seconds
* 2 - res = source.throttle(5000, scheduler);
*
* @param dueTime Duration of the throttle period for each value (specified as an integer denoting milliseconds).
* @param [scheduler] Scheduler to run the throttle timers on. If not specified, the timeout scheduler is used.
* @return The throttled sequence.
*
* @memberOf Observable
* @param {Number} dueTime Duration of the throttle period for each value (specified as an integer denoting milliseconds).
* @param {Scheduler} [scheduler] Scheduler to run the throttle timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} The throttled sequence.
*/

@@ -256,9 +265,11 @@ observableProto.throttle = function (dueTime, scheduler) {

*
* @example
* 1 - res = xs.windowWithTime(1000, scheduler); // non-overlapping segments of 1 second
* 2 - res = xs.windowWithTime(1000, 500 , scheduler); // segments of 1 second with time shift 0.5 seconds
*
* @param timeSpan Length of each window (specified as an integer denoting milliseconds).
* @param [timeShiftOrScheduler] Interval between creation of consecutive windows (specified as an integer denoting milliseconds), or an optional scheduler parameter. If not specified, the time shift corresponds to the timeSpan parameter, resulting in non-overlapping adjacent windows.
* @param [scheduler] Scheduler to run windowing timers on. If not specified, the timeout scheduler is used.
* @return An observable sequence of windows.
*
* @memberOf Observable#
* @param {Number} timeSpan Length of each window (specified as an integer denoting milliseconds).
* @param {Mixed} [timeShiftOrScheduler] Interval between creation of consecutive windows (specified as an integer denoting milliseconds), or an optional scheduler parameter. If not specified, the time shift corresponds to the timeSpan parameter, resulting in non-overlapping adjacent windows.
* @param {Scheduler} [scheduler] Scheduler to run windowing timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence of windows.
*/

@@ -357,10 +368,11 @@ observableProto.windowWithTime = function (timeSpan, timeShiftOrScheduler, scheduler) {

* Projects each element of an observable sequence into a window that is completed when either it's full or a given amount of time has elapsed.
*
* @example
* 1 - res = source.windowWithTimeOrCount(5000, 50); // 5s or 50 items
* 2 - res = source.windowWithTimeOrCount(5000, 50, scheduler); //5s or 50 items
*
* @param timeSpan Maximum time length of a window.
* @param count Maximum element count of a window.
* @param [scheduler] Scheduler to run windowing timers on. If not specified, the timeout scheduler is used.
* @return An observable sequence of windows.
*
* @memberOf Observable#
* @param {Number} timeSpan Maximum time length of a window.
* @param {Number} count Maximum element count of a window.
* @param {Scheduler} [scheduler] Scheduler to run windowing timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence of windows.
*/

@@ -428,9 +440,11 @@ observableProto.windowWithTimeOrCount = function (timeSpan, count, scheduler) {

*
* @example
* 1 - res = xs.bufferWithTime(1000, scheduler); // non-overlapping segments of 1 second
* 2 - res = xs.bufferWithTime(1000, 500, scheduler; // segments of 1 second with time shift 0.5 seconds
*
* @param timeSpan Length of each buffer (specified as an integer denoting milliseconds).
* @param [timeShiftOrScheduler] Interval between creation of consecutive buffers (specified as an integer denoting milliseconds), or an optional scheduler parameter. If not specified, the time shift corresponds to the timeSpan parameter, resulting in non-overlapping adjacent buffers.
* @param [scheduler] Scheduler to run buffer timers on. If not specified, the timeout scheduler is used.
* @return An observable sequence of buffers.
*
* @memberOf Observable#
* @param {Number} timeSpan Length of each buffer (specified as an integer denoting milliseconds).
* @param {Mixed} [timeShiftOrScheduler] Interval between creation of consecutive buffers (specified as an integer denoting milliseconds), or an optional scheduler parameter. If not specified, the time shift corresponds to the timeSpan parameter, resulting in non-overlapping adjacent buffers.
* @param {Scheduler} [scheduler] Scheduler to run buffer timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence of buffers.
*/

@@ -457,9 +471,11 @@ observableProto.bufferWithTime = function (timeSpan, timeShiftOrScheduler, scheduler) {

*
* @example
* 1 - res = source.bufferWithTimeOrCount(5000, 50); // 5s or 50 items in an array
* 2 - res = source.bufferWithTimeOrCount(5000, 50, scheduler); // 5s or 50 items in an array
*
* @param timeSpan Maximum time length of a buffer.
* @param count Maximum element count of a buffer.
* @param [scheduler] Scheduler to run bufferin timers on. If not specified, the timeout scheduler is used.
* @return An observable sequence of buffers.
*
* @memberOf Observable#
* @param {Number} timeSpan Maximum time length of a buffer.
* @param {Number} count Maximum element count of a buffer.
* @param {Scheduler} [scheduler] Scheduler to run bufferin timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence of buffers.
*/

@@ -476,7 +492,9 @@ observableProto.bufferWithTimeOrCount = function (timeSpan, count, scheduler) {

*
* @example
* 1 - res = source.timeInterval();
* 2 - res = source.timeInterval(Rx.Scheduler.timeout);
*
* @param [scheduler] Scheduler used to compute time intervals. If not specified, the timeout scheduler is used.
* @return An observable sequence with time interval information on values.
*
* @memberOf Observable#
* @param [scheduler] Scheduler used to compute time intervals. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence with time interval information on values.
*/

@@ -502,7 +520,9 @@ observableProto.timeInterval = function (scheduler) {

*
* @example
* 1 - res = source.timestamp(); // produces { value: x, timestamp: ts }
* 2 - res = source.timestamp(Rx.Scheduler.timeout);
*
* @param [scheduler] Scheduler used to compute timestamps. If not specified, the timeout scheduler is used.
* @return An observable sequence with timestamp information on values.
*
* @memberOf Observable#
* @param {Scheduler} [scheduler] Scheduler used to compute timestamps. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence with timestamp information on values.
*/

@@ -549,10 +569,11 @@ observableProto.timestamp = function (scheduler) {

*
* @example
* 1 - res = source.sample(sampleObservable); // Sampler tick sequence
* 2 - res = source.sample(5000); // 5 seconds
* 2 - res = source.sample(5000, Rx.Scheduler.timeout); // 5 seconds
*
* @param source Source sequence to sample.
* @param interval Interval at which to sample (specified as an integer denoting milliseconds).
* @param [scheduler] Scheduler to run the sampling timer on. If not specified, the timeout scheduler is used.
* @return Sampled observable sequence.
*
* @memberOf Observable#
* @param {Mixed} intervalOrSampler Interval at which to sample (specified as an integer denoting milliseconds) or Sampler Observable.
* @param {Scheduler} [scheduler] Scheduler to run the sampling timer on. If not specified, the timeout scheduler is used.
* @returns {Observable} Sampled observable sequence.
*/

@@ -570,2 +591,3 @@ observableProto.sample = function (intervalOrSampler, scheduler) {

*
* @example
* 1 - res = source.timeout(new Date()); // As a date

@@ -577,7 +599,8 @@ * 2 - res = source.timeout(5000); // 5 seconds

* 6 - res = source.timeout(5000, Rx.Observable.returnValue(42), Rx.Scheduler.timeout); // 5 seconds and timeout observable
*
* @param dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) when a timeout occurs.
* @param [other] Sequence to return in case of a timeout. If not specified, a timeout error throwing sequence will be used.
* @param [scheduler] Scheduler to run the timeout timers on. If not specified, the timeout scheduler is used.
* @return The source sequence switching to the other sequence in case of a timeout.
*
* @memberOf Observable#
* @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) when a timeout occurs.
* @param {Observable} [other] Sequence to return in case of a timeout. If not specified, a timeout error throwing sequence will be used.
* @param {Scheduler} [scheduler] Scheduler to run the timeout timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} The source sequence switching to the other sequence in case of a timeout.
*/

@@ -643,2 +666,3 @@ observableProto.timeout = function (dueTime, other, scheduler) {

*
* @example
* res = source.generateWithAbsoluteTime(0,

@@ -650,10 +674,12 @@ * function (x) { return return true; },

* });
*
* @param initialState Initial state.
* @param condition Condition to terminate generation (upon returning false).
* @param iterate Iteration step function.
* @param resultSelector Selector function for results produced in the sequence.
* @param timeSelector Time selector function to control the speed of values being produced each iteration, returning Date values.
* @param [scheduler] Scheduler on which to run the generator loop. If not specified, the timeout scheduler is used.
* @return The generated sequence.
*
* @static
* @memberOf Observable
* @param {Mixed} initialState Initial state.
* @param {Function} condition Condition to terminate generation (upon returning false).
* @param {Function} iterate Iteration step function.
* @param {Function} resultSelector Selector function for results produced in the sequence.
* @param {Function} timeSelector Time selector function to control the speed of values being produced each iteration, returning Date values.
* @param {Scheduler} [scheduler] Scheduler on which to run the generator loop. If not specified, the timeout scheduler is used.
* @returns {Observable} The generated sequence.
*/

@@ -698,4 +724,5 @@ Observable.generateWithAbsoluteTime = function (initialState, condition, iterate, resultSelector, timeSelector, scheduler) {

* Generates an observable sequence by iterating a state from an initial state until the condition fails.
*
* res = source.generateWithRelativeTime(0,
*
* @example
* res = source.generateWithRelativeTime(0,
* function (x) { return return true; },

@@ -706,10 +733,12 @@ * function (x) { return x + 1; },

* );
*
* @param initialState Initial state.
* @param condition Condition to terminate generation (upon returning false).
* @param iterate Iteration step function.
* @param resultSelector Selector function for results produced in the sequence.
* @param timeSelector Time selector function to control the speed of values being produced each iteration, returning integer values denoting milliseconds.
* @param [scheduler] Scheduler on which to run the generator loop. If not specified, the timeout scheduler is used.
* @return The generated sequence.
*
* @static
* @memberOf Observable
* @param {Mixed} initialState Initial state.
* @param {Function} condition Condition to terminate generation (upon returning false).
* @param {Function} iterate Iteration step function.
* @param {Function} resultSelector Selector function for results produced in the sequence.
* @param {Function} timeSelector Time selector function to control the speed of values being produced each iteration, returning integer values denoting milliseconds.
* @param {Scheduler} [scheduler] Scheduler on which to run the generator loop. If not specified, the timeout scheduler is used.
* @returns {Observable} The generated sequence.
*/

@@ -755,8 +784,10 @@ Observable.generateWithRelativeTime = function (initialState, condition, iterate, resultSelector, timeSelector, scheduler) {

*
* @example
* 1 - res = source.delaySubscription(5000); // 5s
* 2 - res = source.delaySubscription(5000, Rx.Scheduler.timeout); // 5 seconds
*
* @param dueTime Absolute or relative time to perform the subscription at.
* @param [scheduler] Scheduler to run the subscription delay timer on. If not specified, the timeout scheduler is used.
* @return Time-shifted sequence.
*
* @memberOf Observable#
* @param {Number} dueTime Absolute or relative time to perform the subscription at.
* @param {Scheduler} [scheduler] Scheduler to run the subscription delay timer on. If not specified, the timeout scheduler is used.
* @returns {Observable} Time-shifted sequence.
*/

@@ -771,8 +802,10 @@ observableProto.delaySubscription = function (dueTime, scheduler) {

*
* @example
* 1 - res = source.delayWithSelector(function (x) { return Rx.Scheduler.timer(5000); }); // with selector only
* 1 - res = source.delayWithSelector(Rx.Observable.timer(2000), function (x) { return Rx.Observable.timer(x); }); // with delay and selector
*
* @param [subscriptionDelay] Sequence indicating the delay for the subscription to the source.
* @param delayDurationSelector Selector function to retrieve a sequence indicating the delay for each given element.
* @return Time-shifted sequence.
*
* @memberOf Observable#
* @param {Observable} [subscriptionDelay] Sequence indicating the delay for the subscription to the source.
* @param {Function} delayDurationSelector Selector function to retrieve a sequence indicating the delay for each given element.
* @returns {Observable} Time-shifted sequence.
*/

@@ -824,3 +857,3 @@ observableProto.delayWithSelector = function (subscriptionDelay, delayDurationSelector) {

start();
}, observer.onError.bind(onError), function () { start(); }));
}, observer.onError.bind(observer), function () { start(); }));
}

@@ -835,10 +868,12 @@

*
* @example
* 1 - res = source.timeoutWithSelector(Rx.Observable.timer(500));
* 2 - res = source.timeoutWithSelector(Rx.Observable.timer(500), function (x) { return Rx.Observable.timer(200); });
* 3 - res = source.timeoutWithSelector(Rx.Observable.timer(500), function (x) { return Rx.Observable.timer(200); }, Rx.Observable.returnValue(42));
*
* @param [firstTimeout] Observable sequence that represents the timeout for the first element. If not provided, this defaults to Observable.never().
* @param [timeoutDurationSelector] Selector to retrieve an observable sequence that represents the timeout between the current element and the next element.
* @param [other] Sequence to return in case of a timeout. If not provided, this is set to Observable.throwException().
* @return The source sequence switching to the other sequence in case of a timeout.
*
* @memberOf Observable#
* @param {Observable} [firstTimeout] Observable sequence that represents the timeout for the first element. If not provided, this defaults to Observable.never().
* @param {Function} [timeoutDurationSelector] Selector to retrieve an observable sequence that represents the timeout between the current element and the next element.
* @param {Observable} [other] Sequence to return in case of a timeout. If not provided, this is set to Observable.throwException().
* @returns {Observable} The source sequence switching to the other sequence in case of a timeout.
*/

@@ -913,6 +948,8 @@ observableProto.timeoutWithSelector = function (firstTimeout, timeoutdurationSelector, other) {

*
* @example
* 1 - res = source.delayWithSelector(function (x) { return Rx.Scheduler.timer(x + x); });
*
* @param throttleDurationSelector Selector function to retrieve a sequence indicating the throttle duration for each given element.
* @return The throttled sequence.
*
* @memberOf Observable#
* @param {Function} throttleDurationSelector Selector function to retrieve a sequence indicating the throttle duration for each given element.
* @returns {Observable} The throttled sequence.
*/

@@ -971,11 +1008,11 @@ observableProto.throttleWithSelector = function (throttleDurationSelector) {

* 2 - res = source.skipLastWithTime(5000, scheduler);
*
* @param duration Duration for skipping elements from the end of the sequence.
* @param [scheduler] Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout
* @return An observable sequence with the elements skipped during the specified duration from the end of the source sequence.
*
*
* @description
* This operator accumulates a queue with a length enough to store elements received during the initial duration window.
* As more elements are received, elements older than the specified duration are taken from the queue and produced on the
* result sequence. This causes elements to be delayed with duration.
*
* result sequence. This causes elements to be delayed with duration.
* @memberOf Observable#
* @param {Number} duration Duration for skipping elements from the end of the sequence.
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout
* @returns {Observable} An observable sequence with the elements skipped during the specified duration from the end of the source sequence.
*/

@@ -1006,13 +1043,13 @@ observableProto.skipLastWithTime = function (duration, scheduler) {

*
* @example
* 1 - res = source.takeLastWithTime(5000, [optional timer scheduler], [optional loop scheduler]);
*
* @param duration Duration for taking elements from the end of the sequence.
* @param [timerScheduler] Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @param [loopScheduler] Scheduler to drain the collected elements. If not specified, defaults to Rx.Scheduler.immediate.
* @return An observable sequence with the elements taken during the specified duration from the end of the source sequence.
*
* This operator accumulates a buffer with a length enough to store elements for any duration window during the lifetime of
* the source sequence. Upon completion of the source sequence, this buffer is drained on the result sequence. This causes the result elements
* to be delayed with duration.
*
* @description
* This operator accumulates a queue with a length enough to store elements received during the initial duration window.
* As more elements are received, elements older than the specified duration are taken from the queue and produced on the
* result sequence. This causes elements to be delayed with duration.
* @memberOf Observable#
* @param {Number} duration Duration for taking elements from the end of the sequence.
* @param {Scheduler} [timerScheduler] Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @param {Scheduler} [loopScheduler] Scheduler to drain the collected elements. If not specified, defaults to Rx.Scheduler.immediate.
* @returns {Observable} An observable sequence with the elements taken during the specified duration from the end of the source sequence.
*/

@@ -1026,11 +1063,12 @@ observableProto.takeLastWithTime = function (duration, timerScheduler, loopScheduler) {

*
* @example
* 1 - res = source.takeLastBufferWithTime(5000, [optional scheduler]);
*
* @param duration Duration for taking elements from the end of the sequence.
* @param scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @return An observable sequence containing a single array with the elements taken during the specified duration from the end of the source sequence.
*
* This operator accumulates a buffer with a length enough to store elements for any duration window during the lifetime of
* the source sequence. Upon completion of the source sequence, this buffer is produced on the result sequence.
*
* @description
* This operator accumulates a queue with a length enough to store elements received during the initial duration window.
* As more elements are received, elements older than the specified duration are taken from the queue and produced on the
* result sequence. This causes elements to be delayed with duration.
* @memberOf Observable#
* @param {Number} duration Duration for taking elements from the end of the sequence.
* @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @returns {Observable} An observable sequence containing a single array with the elements taken during the specified duration from the end of the source sequence.
*/

@@ -1067,12 +1105,12 @@ observableProto.takeLastBufferWithTime = function (duration, scheduler) {

*
* @example
* 1 - res = source.takeWithTime(5000, [optional scheduler]);
*
* @param duration Duration for taking elements from the start of the sequence.
* @param scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @return An observable sequence with the elements taken during the specified duration from the start of the source sequence.
*
* Specifying a zero value for duration doesn't guarantee an empty sequence will be returned. This is a side-effect
* of the asynchrony introduced by the scheduler, where the action that stops forwarding callbacks from the source sequence may not execute
* immediately, despite the zero due time.
*
* @description
* This operator accumulates a queue with a length enough to store elements received during the initial duration window.
* As more elements are received, elements older than the specified duration are taken from the queue and produced on the
* result sequence. This causes elements to be delayed with duration.
* @memberOf Observable#
* @param {Number} duration Duration for taking elements from the start of the sequence.
* @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @returns {Observable} An observable sequence with the elements taken during the specified duration from the start of the source sequence.
*/

@@ -1094,8 +1132,6 @@ observableProto.takeWithTime = function (duration, scheduler) {

*
* @example
* 1 - res = source.skipWithTime(5000, [optional scheduler]);
*
* @param duration Duration for skipping elements from the start of the sequence.
* @param scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @return An observable sequence with the elements skipped during the specified duration from the start of the source sequence.
*
* @description
* Specifying a zero value for duration doesn't guarantee no elements will be dropped from the start of the source sequence.

@@ -1105,4 +1141,7 @@ * This is a side-effect of the asynchrony introduced by the scheduler, where the action that causes callbacks from the source sequence to be forwarded

*
* Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the duration.
*
* Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the duration.
* @memberOf Observable#
* @param {Number} duration Duration for skipping elements from the start of the sequence.
* @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @returns {Observable} An observable sequence with the elements skipped during the specified duration from the start of the source sequence.
*/

@@ -1127,11 +1166,10 @@ observableProto.skipWithTime = function (duration, scheduler) {

* Skips elements from the observable source sequence until the specified start time, using the specified scheduler to run timers.
* Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the start time>.
*
* @examples
* 1 - res = source.skipUntilWithTime(new Date(), [optional scheduler]);
*
* @param startTime Time to start taking elements from the source sequence. If this value is less than or equal to Date(), no elements will be skipped.
* @param scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @return An observable sequence with the elements skipped until the specified start time.
*
* Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the <paramref name="startTime"/>.
*
* @memberOf Obseravble#
* @param startTime Time to start taking elements from the source sequence. If this value is less than or equal to Date(), no elements will be skipped.
* @param scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @returns {Observable} An observable sequence with the elements skipped until the specified start time.
*/

@@ -1157,7 +1195,8 @@ observableProto.skipUntilWithTime = function (startTime, scheduler) {

*
* @example
* 1 - res = source.takeUntilWithTime(new Date(), [optional scheduler]);
*
* @param endTime Time to stop taking elements from the source sequence. If this value is less than or equal to new Date(), the result stream will complete immediately.
* @param scheduler Scheduler to run the timer on.
* @return An observable sequence with the elements taken until the specified end time.
* @memberOf Observable#
* @param {Number} endTime Time to stop taking elements from the source sequence. If this value is less than or equal to new Date(), the result stream will complete immediately.
* @param {Scheduler} scheduler Scheduler to run the timer on.
* @returns {Observable} An observable sequence with the elements taken until the specified end time.
*/

@@ -1164,0 +1203,0 @@ observableProto.takeUntilWithTime = function (endTime, scheduler) {

/**
* Represents a notification to an observer.
*/
var Notification = root.Notification = (function () {
var Notification = Rx.Notification = (function () {
function Notification(kind, hasValue) {

@@ -12,10 +12,25 @@ this.hasValue = hasValue == null ? false : hasValue;

/**
* Invokes the delegate corresponding to the notification or the observer's method corresponding to the notification and returns the produced result.
*
* @memberOf Notification
* @param {Any} observerOrOnNext Delegate to invoke for an OnNext notification or Observer to invoke the notification on..
* @param {Function} onError Delegate to invoke for an OnError notification.
* @param {Function} onCompleted Delegate to invoke for an OnCompleted notification.
* @returns {Any} Result produced by the observation.
*/
NotificationPrototype.accept = function (observerOrOnNext, onError, onCompleted) {
if (arguments.length > 1 || typeof observerOrOnNext === 'function') {
return this._accept(observerOrOnNext, onError, onCompleted);
} else {
if (arguments.length === 1 && typeof observerOrOnNext === 'object') {
return this._acceptObservable(observerOrOnNext);
}
return this._accept(observerOrOnNext, onError, onCompleted);
};
/**
* Returns an observable sequence with a single notification.
*
* @memberOf Notification
* @param {Scheduler} [scheduler] Scheduler to send out the notification calls on.
* @returns {Observable} The observable sequence that surfaces the behavior of the notification upon subscription.
*/
NotificationPrototype.toObservable = function (scheduler) {

@@ -43,6 +58,8 @@ var notification = this;

/**
* Creates an object that represents an OnNext notification to an observer.
*
* @param value The value contained in the notification.
* @return The OnNext notification containing the value.
* Creates an object that represents an OnNext notification to an observer.
*
* @static
* @memberOf Notification
* @param {Any} value The value contained in the notification.
* @returns {Notification} The OnNext notification containing the value.
*/

@@ -76,4 +93,6 @@ var notificationCreateOnNext = Notification.createOnNext = (function () {

*
* @param error The exception contained in the notification.
* @return The OnError notification containing the exception.
* @static s
* @memberOf Notification
* @param {Any} error The exception contained in the notification.
* @returns {Notification} The OnError notification containing the exception.
*/

@@ -106,3 +125,6 @@ var notificationCreateOnError = Notification.createOnError = (function () {

* Creates an object that represents an OnCompleted notification to an observer.
* @return The OnCompleted notification.
*
* @static
* @memberOf Notification
* @returns {Notification} The OnCompleted notification.
*/

@@ -109,0 +131,0 @@ var notificationCreateOnCompleted = Notification.createOnCompleted = (function () {

@@ -6,6 +6,7 @@ var observableProto;

*/
var Observable = root.Observable = (function () {
var Observable = Rx.Observable = (function () {
/**
* @constructor
* @private
*/

@@ -39,2 +40,3 @@ function Observable(subscribe) {

*
* @example
* 1 - source.subscribe();

@@ -45,15 +47,15 @@ * 2 - source.subscribe(observer);

* 5 - source.subscribe(function (x) { console.log(x); }, function (err) { console.log(err); }, function () { console.log('done'); });
*
* @param {Mixed} [observerOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @return The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler.
* @returns {Diposable} The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler.
*/
observableProto.subscribe = observableProto.forEach = function (observerOrOnNext, onError, onCompleted) {
var subscriber;
if (arguments.length === 0 || arguments.length > 1 || typeof observerOrOnNext === 'function') {
if (typeof observerOrOnNext === 'object') {
subscriber = observerOrOnNext;
} else {
subscriber = observerCreate(observerOrOnNext, onError, onCompleted);
} else {
subscriber = observerOrOnNext;
}
return this._subscribe(subscriber);

@@ -65,8 +67,10 @@ };

*
* @return An observable sequence containing a single element with a list containing all the elements of the source sequence.
* @memberOf Observable
* @returns An observable sequence containing a single element with a list containing all the elements of the source sequence.
*/
observableProto.toArray = function () {
function accumulator(list, i) {
list.push(i);
return list.slice(0);
var newList = list.slice(0);
newList.push(i);
return newList;
}

@@ -73,0 +77,0 @@ return this.scan([], accumulator).startWith([]).finalValue();

@@ -1,16 +0,25 @@

var ObserveOnObserver = (function () {
inherits(ObserveOnObserver, ScheduledObserver);
/** @private */
var ObserveOnObserver = (function (_super) {
inherits(ObserveOnObserver, _super);
/** @private */
function ObserveOnObserver() {
ObserveOnObserver.super_.constructor.apply(this, arguments);
_super.apply(this, arguments);
}
/** @private */
ObserveOnObserver.prototype.next = function (value) {
ObserveOnObserver.super_.next.call(this, value);
_super.prototype.next.call(this, value);
this.ensureActive();
};
/** @private */
ObserveOnObserver.prototype.error = function (e) {
ObserveOnObserver.super_.error.call(this, e);
_super.prototype.error.call(this, e);
this.ensureActive();
};
/** @private */
ObserveOnObserver.prototype.completed = function () {
ObserveOnObserver.super_.completed.call(this);
_super.prototype.completed.call(this);
this.ensureActive();

@@ -20,2 +29,2 @@ };

return ObserveOnObserver;
})();
})(ScheduledObserver);
/**
* Supports push-style iteration over an observable sequence.
*/
var Observer = root.Observer = function () { };
var Observer = Rx.Observer = function () { };

@@ -9,4 +9,4 @@ /**

*
* @param observer Observer object.
* @return The action that forwards its input notification to the underlying observer.
* @param observer Observer object.
* @returns The action that forwards its input notification to the underlying observer.
*/

@@ -22,5 +22,4 @@ Observer.prototype.toNotifier = function () {

* Hides the identity of an observer.
*
* @param observer An observer whose identity to hide.
* @return An observer that hides the identity of the specified observer.
* @returns An observer that hides the identity of the specified observer.
*/

@@ -35,4 +34,3 @@ Observer.prototype.asObserver = function () {

*
* @param observer The observer whose callback invocations should be checked for grammar violations.
* @return An observer that checks callbacks invocations against the observer grammar and, if the checks pass, forwards those to the specified observer.
* @returns An observer that checks callbacks invocations against the observer grammar and, if the checks pass, forwards those to the specified observer.
*/

@@ -44,6 +42,8 @@ Observer.prototype.checked = function () { return new CheckedObserver(this); };

*
* @param {Function} [onNext] Observer's OnNext action implementation.
* @param {Function} [onError] Observer's OnError action implementation.
* @param {Function} [onCompleted] Observer's OnCompleted action implementation.
* @return The observer object implemented using the given actions.
* @static
* @memberOf Observer
* @param {Function} [onNext] Observer's OnNext action implementation.
* @param {Function} [onError] Observer's OnError action implementation.
* @param {Function} [onCompleted] Observer's OnCompleted action implementation.
* @returns {Observer} The observer object implemented using the given actions.
*/

@@ -60,4 +60,6 @@ var observerCreate = Observer.create = function (onNext, onError, onCompleted) {

*
* @param handler Action that handles a notification.
* @return The observer object that invokes the specified handler using a notification corresponding to each message it receives.
* @static
* @memberOf Observer
* @param {Function} handler Action that handles a notification.
* @returns The observer object that invokes the specified handler using a notification corresponding to each message it receives.
*/

@@ -64,0 +66,0 @@ Observer.fromNotifier = function (handler) {

@@ -1,5 +0,7 @@

var ScheduledObserver = root.Internals.ScheduledObserver = (function () {
inherits(ScheduledObserver, AbstractObserver);
/** @private */
var ScheduledObserver = Rx.Internals.ScheduledObserver = (function (_super) {
inherits(ScheduledObserver, _super);
function ScheduledObserver(scheduler, observer) {
ScheduledObserver.super_.constructor.call(this);
_super.call(this);
this.scheduler = scheduler;

@@ -13,2 +15,3 @@ this.observer = observer;

/** @private */
ScheduledObserver.prototype.next = function (value) {

@@ -20,2 +23,4 @@ var self = this;

};
/** @private */
ScheduledObserver.prototype.error = function (exception) {

@@ -27,2 +32,4 @@ var self = this;

};
/** @private */
ScheduledObserver.prototype.completed = function () {

@@ -34,2 +41,4 @@ var self = this;

};
/** @private */
ScheduledObserver.prototype.ensureActive = function () {

@@ -61,4 +70,6 @@ var isOwner = false, parent = this;

};
/** @private */
ScheduledObserver.prototype.dispose = function () {
ScheduledObserver.super_.dispose.call(this);
_super.prototype.dispose.call(this);
this.disposable.dispose();

@@ -68,2 +79,2 @@ };

return ScheduledObserver;
}());
}(AbstractObserver));

@@ -16,3 +16,3 @@ (function (root, factory) {

}
}(this, function (global, exp, root, undefined) {
}(this, function (global, exp, Rx, undefined) {

@@ -1,2 +0,5 @@

var AnonymousSubject = (function () {
/** @private */
var AnonymousSubject = (function (_super) {
inherits(AnonymousSubject, _super);
function subscribe(observer) {

@@ -6,5 +9,8 @@ return this.observable.subscribe(observer);

inherits(AnonymousSubject, Observable);
/**
* @private
* @constructor
*/
function AnonymousSubject(observer, observable) {
AnonymousSubject.super_.constructor.call(this, subscribe);
_super.call(this, subscribe);
this.observer = observer;

@@ -15,8 +21,20 @@ this.observable = observable;

addProperties(AnonymousSubject.prototype, Observer, {
/**
* @private
* @memberOf AnonymousSubject#
*/
onCompleted: function () {
this.observer.onCompleted();
},
/**
* @private
* @memberOf AnonymousSubject#
*/
onError: function (exception) {
this.observer.onError(exception);
},
/**
* @private
* @memberOf AnonymousSubject#
*/
onNext: function (value) {

@@ -28,2 +46,2 @@ this.observer.onNext(value);

return AnonymousSubject;
}());
}(Observable));

@@ -5,3 +5,3 @@ /**

*/
var AsyncSubject = root.AsyncSubject = (function () {
var AsyncSubject = Rx.AsyncSubject = (function (_super) {

@@ -28,10 +28,11 @@ function subscribe(observer) {

inherits(AsyncSubject, Observable);
inherits(AsyncSubject, _super);
/**
* Creates a subject that can only receive one value and that value is cached for all future observations.
*
* @constructor
* Creates a subject that can only receive one value and that value is cached for all future observations.
*/
function AsyncSubject() {
AsyncSubject.super_.constructor.call(this, subscribe);
_super.call(this, subscribe);

@@ -47,2 +48,16 @@ this.isDisposed = false,

addProperties(AsyncSubject.prototype, Observer, {
/**
* Indicates whether the subject has observers subscribed to it.
*
* @memberOf AsyncSubject#
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () {
return this.observers.length > 0;
},
/**
* Notifies all subscribed observers about the end of the sequence, also causing the last received value to be sent out (if any).
*
* @memberOf AsyncSubject#
*/
onCompleted: function () {

@@ -72,2 +87,8 @@ var o, i, len;

},
/**
* Notifies all subscribed observers about the exception.
*
* @memberOf AsyncSubject#
* @param {Mixed} error The exception to send to all observers.
*/
onError: function (exception) {

@@ -87,2 +108,8 @@ checkDisposed.call(this);

},
/**
* Sends a value to the subject. The last value received before successful termination will be sent to all subscribed and future observers.
*
* @memberOf AsyncSubject#
* @param {Mixed} value The value to store in the subject.
*/
onNext: function (value) {

@@ -95,2 +122,7 @@ checkDisposed.call(this);

},
/**
* Unsubscribe all observers and release resources.
*
* @memberOf AsyncSubject#
*/
dispose: function () {

@@ -105,2 +137,2 @@ this.isDisposed = true;

return AsyncSubject;
}());
}(Observable));

@@ -5,3 +5,3 @@ /**

*/
var BehaviorSubject = root.BehaviorSubject = (function () {
var BehaviorSubject = Rx.BehaviorSubject = (function (_super) {
function subscribe(observer) {

@@ -24,3 +24,3 @@ var ex;

inherits(BehaviorSubject, Observable);
inherits(BehaviorSubject, _super);

@@ -33,3 +33,3 @@ /**

function BehaviorSubject(value) {
BehaviorSubject.super_.constructor.call(this, subscribe);
_super.call(this, subscribe);

@@ -44,2 +44,16 @@ this.value = value,

addProperties(BehaviorSubject.prototype, Observer, {
/**
* Indicates whether the subject has observers subscribed to it.
*
* @memberOf BehaviorSubject#
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () {
return this.observers.length > 0;
},
/**
* Notifies all subscribed observers about the end of the sequence.
*
* @memberOf BehaviorSubject#
*/
onCompleted: function () {

@@ -57,2 +71,8 @@ checkDisposed.call(this);

},
/**
* Notifies all subscribed observers about the exception.
*
* @memberOf BehaviorSubject#
* @param {Mixed} error The exception to send to all observers.
*/
onError: function (error) {

@@ -72,2 +92,8 @@ checkDisposed.call(this);

},
/**
* Notifies all subscribed observers about the arrival of the specified element in the sequence.
*
* @memberOf BehaviorSubject#
* @param {Mixed} value The value to send to all observers.
*/
onNext: function (value) {

@@ -83,2 +109,7 @@ checkDisposed.call(this);

},
/**
* Unsubscribe all observers and release resources.
*
* @memberOf BehaviorSubject#
*/
dispose: function () {

@@ -93,2 +124,2 @@ this.isDisposed = true;

return BehaviorSubject;
}());
}(Observable));

@@ -0,1 +1,2 @@

/** @private */
var InnerSubscription = function (subject, observer) {

@@ -5,2 +6,7 @@ this.subject = subject;

};
/**
* @private
* @memberOf InnerSubscription
*/
InnerSubscription.prototype.dispose = function () {

@@ -7,0 +13,0 @@ if (!this.subject.isDisposed && this.observer !== null) {

@@ -1,2 +0,1 @@

// Replay Subject
/**

@@ -6,3 +5,7 @@ * Represents an object that is both an observable sequence as well as an observer.

*/
var ReplaySubject = root.ReplaySubject = (function (base) {
var ReplaySubject = Rx.ReplaySubject = (function (_super) {
/**
* @private
* @constructor
*/
var RemovableDisposable = function (subject, observer) {

@@ -13,2 +16,6 @@ this.subject = subject;

/*
* @private
* @memberOf RemovableDisposable#
*/
RemovableDisposable.prototype.dispose = function () {

@@ -47,3 +54,3 @@ this.observer.dispose();

inherits(ReplaySubject, Observable);
inherits(ReplaySubject, _super);

@@ -55,3 +62,3 @@ /**

* @param {Number} [window] Maximum time length of the replay buffer.
* @param [scheduler] Scheduler the observers are invoked on.
* @param {Scheduler} [scheduler] Scheduler the observers are invoked on.
*/

@@ -68,6 +75,19 @@ function ReplaySubject(bufferSize, window, scheduler) {

this.error = null;
ReplaySubject.super_.constructor.call(this, subscribe);
_super.call(this, subscribe);
}
addProperties(ReplaySubject.prototype, Observer, {
/**
* Indicates whether the subject has observers subscribed to it.
*
* @memberOf ReplaySubject#
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () {
return this.observers.length > 0;
},
/*
* @private
* @memberOf ReplaySubject#
*/
_trim: function (now) {

@@ -81,2 +101,8 @@ while (this.q.length > this.bufferSize) {

},
/**
* Notifies all subscribed observers about the arrival of the specified element in the sequence.
*
* @memberOf ReplaySubject#
* @param {Mixed} value The value to send to all observers.
*/
onNext: function (value) {

@@ -98,2 +124,8 @@ var observer;

},
/**
* Notifies all subscribed observers about the exception.
*
* @memberOf ReplaySubject#
* @param {Mixed} error The exception to send to all observers.
*/
onError: function (error) {

@@ -117,2 +149,7 @@ var observer;

},
/**
* Notifies all subscribed observers about the end of the sequence.
*
* @memberOf ReplaySubject#
*/
onCompleted: function () {

@@ -134,2 +171,7 @@ var observer;

},
/**
* Unsubscribe all observers and release resources.
*
* @memberOf ReplaySubject#
*/
dispose: function () {

@@ -142,2 +184,2 @@ this.isDisposed = true;

return ReplaySubject;
}());
}(Observable));

@@ -5,3 +5,3 @@ /**

*/
var Subject = root.Subject = (function () {
var Subject = Rx.Subject = (function (_super) {
function subscribe(observer) {

@@ -21,10 +21,11 @@ checkDisposed.call(this);

inherits(Subject, Observable);
inherits(Subject, _super);
/**
* Creates a subject.
*
* @constructor
* Creates a subject.
*/
function Subject() {
Subject.super_.constructor.call(this, subscribe);
_super.call(this, subscribe);
this.isDisposed = false,

@@ -36,2 +37,16 @@ this.isStopped = false,

addProperties(Subject.prototype, Observer, {
/**
* Indicates whether the subject has observers subscribed to it.
*
* @memberOf ReplaySubject#
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () {
return this.observers.length > 0;
},
/**
* Notifies all subscribed observers about the end of the sequence.
*
* @memberOf ReplaySubject#
*/
onCompleted: function () {

@@ -49,2 +64,8 @@ checkDisposed.call(this);

},
/**
* Notifies all subscribed observers about the exception.
*
* @memberOf ReplaySubject#
* @param {Mixed} error The exception to send to all observers.
*/
onError: function (exception) {

@@ -63,2 +84,8 @@ checkDisposed.call(this);

},
/**
* Notifies all subscribed observers about the arrival of the specified element in the sequence.
*
* @memberOf ReplaySubject#
* @param {Mixed} value The value to send to all observers.
*/
onNext: function (value) {

@@ -73,2 +100,7 @@ checkDisposed.call(this);

},
/**
* Unsubscribe all observers and release resources.
*
* @memberOf ReplaySubject#
*/
dispose: function () {

@@ -80,2 +112,11 @@ this.isDisposed = true;

/**
* Creates a subject from the specified observer and observable.
*
* @static
* @memberOf Subject
* @param {Observer} observer The observer used to send messages to the subject.
* @param {Observable} observable The observable used to subscribe to messages sent from the subject.
* @returns {Subject} Subject implemented using the given observer and observable.
*/
Subject.create = function (observer, observable) {

@@ -86,2 +127,2 @@ return new AnonymousSubject(observer, observable);

return Subject;
}());
}(Observable));

@@ -1,2 +0,2 @@

return root;
return Rx;
}));
// Defaults
var Observer = root.Observer,
Observable = root.Observable,
Notification = root.Notification,
VirtualTimeScheduler = root.VirtualTimeScheduler,
Disposable = root.Disposable,
var Observer = Rx.Observer,
Observable = Rx.Observable,
Notification = Rx.Notification,
VirtualTimeScheduler = Rx.VirtualTimeScheduler,
Disposable = Rx.Disposable,
disposableEmpty = Disposable.empty,
disposableCreate = Disposable.create,
CompositeDisposable = root.CompositeDisposable,
SingleAssignmentDisposable = root.SingleAssignmentDisposable,
CompositeDisposable = Rx.CompositeDisposable,
SingleAssignmentDisposable = Rx.SingleAssignmentDisposable,
slice = Array.prototype.slice,
inherits = root.Internals.inherits;
inherits = Rx.Internals.inherits;

@@ -14,0 +14,0 @@ // Utilities

@@ -1,2 +0,4 @@

var ColdObservable = (function () {
/** @private */
var ColdObservable = (function (_super) {
function subscribe(observer) {

@@ -23,5 +25,10 @@ var message, notification, observable = this;

inherits(ColdObservable, Observable);
inherits(ColdObservable, _super);
/**
* @private
* @constructor
*/
function ColdObservable(scheduler, messages) {
ColdObservable.super_.constructor.call(this, subscribe);
_super.call(this, subscribe);
this.scheduler = scheduler;

@@ -33,2 +40,2 @@ this.messages = messages;

return ColdObservable;
})();
})(Observable);

@@ -1,2 +0,4 @@

var HotObservable = (function () {
/** @private */
var HotObservable = (function (_super) {
function subscribe(observer) {

@@ -14,5 +16,10 @@ var observable = this;

inherits(HotObservable, Observable);
inherits(HotObservable, _super);
/**
* @private
* @constructor
*/
function HotObservable(scheduler, messages) {
HotObservable.super_.constructor.call(this, subscribe);
_super.call(this, subscribe);
var message, notification, observable = this;

@@ -38,2 +45,2 @@ this.scheduler = scheduler;

return HotObservable;
})();
})(Observable);

@@ -1,2 +0,3 @@

var MockDisposable = root.MockDisposable = function (scheduler) {
/** @private */
var MockDisposable = Rx.MockDisposable = function (scheduler) {
this.scheduler = scheduler;

@@ -6,4 +7,9 @@ this.disposes = [];

};
/*
* @memberOf MockDisposable#
* @prviate
*/
MockDisposable.prototype.dispose = function () {
this.disposes.push(this.scheduler.clock);
};

@@ -1,17 +0,42 @@

var MockObserver = (function () {
inherits(MockObserver, Observer);
/** @private */
var MockObserver = (function (_super) {
inherits(MockObserver, _super);
/*
* @constructor
* @prviate
*/
function MockObserver(scheduler) {
_super.call(this);
this.scheduler = scheduler;
this.messages = [];
}
MockObserver.prototype.onNext = function (value) {
var MockObserverPrototype = MockObserver.prototype;
/*
* @memberOf MockObserverPrototype#
* @prviate
*/
MockObserverPrototype.onNext = function (value) {
this.messages.push(new Recorded(this.scheduler.clock, Notification.createOnNext(value)));
};
MockObserver.prototype.onError = function (exception) {
/*
* @memberOf MockObserverPrototype#
* @prviate
*/
MockObserverPrototype.onError = function (exception) {
this.messages.push(new Recorded(this.scheduler.clock, Notification.createOnError(exception)));
};
MockObserver.prototype.onCompleted = function () {
/*
* @memberOf MockObserverPrototype#
* @prviate
*/
MockObserverPrototype.onCompleted = function () {
this.messages.push(new Recorded(this.scheduler.clock, Notification.createOnCompleted()));
};
return MockObserver;
})();
})(Observer);

@@ -1,5 +0,13 @@

// New predicate tests
/**
* @private
* @constructor
*/
function OnNextPredicate(predicate) {
this.predicate = predicate;
};
/**
* @private
* @memberOf OnNextPredicate#
*/
OnNextPredicate.prototype.equals = function (other) {

@@ -12,5 +20,14 @@ if (other === this) { return true; }

/**
* @private
* @constructor
*/
function OnErrorPredicate(predicate) {
this.predicate = predicate;
};
/**
* @private
* @memberOf OnErrorPredicate#
*/
OnErrorPredicate.prototype.equals = function (other) {

@@ -23,3 +40,7 @@ if (other === this) { return true; }

var ReactiveTest = root.ReactiveTest = {
/**
* @static
* type Object
*/
var ReactiveTest = Rx.ReactiveTest = {
/** Default virtual time used for creation of observable sequences in unit tests. */

@@ -26,0 +47,0 @@ created: 100,

/**
* Creates a new object recording the production of the specified value at the given virtual time.
*
* @constructor
* Creates a new object recording the production of the specified value at the given virtual time.
*
* @param time Virtual time the value was produced on.
* @param value Value that was produced.
* @param comparer An optional comparer.
* @param {Number} time Virtual time the value was produced on.
* @param {Mixed} value Value that was produced.
* @param {Function} comparer An optional comparer.
*/
var Recorded = root.Recorded = function (time, value, comparer) {
var Recorded = Rx.Recorded = function (time, value, comparer) {
this.time = time;

@@ -17,4 +17,5 @@ this.value = value;

* Checks whether the given recorded object is equal to the current instance.
* @param other Recorded object to check for equality.
* @return true if both objects are equal; false otherwise.
*
* @param {Recorded} other Recorded object to check for equality.
* @returns {Boolean} true if both objects are equal; false otherwise.
*/

@@ -27,3 +28,4 @@ Recorded.prototype.equals = function (other) {

* Returns a string representation of the current Recorded value.
* @return String representation of the current Recorded value.
*
* @returns {String} String representation of the current Recorded value.
*/

@@ -30,0 +32,0 @@ Recorded.prototype.toString = function () {

/**
* Creates a new subscription object with the given virtual subscription and unsubscription time.
*
* @constructor
* Creates a new subscription object with the given virtual subscription and unsubscription time.
* @param subscribe Virtual time at which the subscription occurred.
* @param unsubscribe Virtual time at which the unsubscription occurred.
* @param {Number} subscribe Virtual time at which the subscription occurred.
* @param {Number} unsubscribe Virtual time at which the unsubscription occurred.
*/
var Subscription = root.Subscription = function (start, end) {
var Subscription = Rx.Subscription = function (start, end) {
this.subscribe = start;

@@ -15,3 +16,3 @@ this.unsubscribe = end || Number.MAX_VALUE;

* @param other Subscription object to check for equality.
* @return true if both objects are equal; false otherwise.
* @returns {Boolean} true if both objects are equal; false otherwise.
*/

@@ -24,3 +25,3 @@ Subscription.prototype.equals = function (other) {

* Returns a string representation of the current Subscription value.
* @return String representation of the current Subscription value.
* @returns {String} String representation of the current Subscription value.
*/

@@ -27,0 +28,0 @@ Subscription.prototype.toString = function () {

/** Virtual time scheduler used for testing applications and libraries built using Reactive Extensions. */
root.TestScheduler = (function () {
inherits(TestScheduler, VirtualTimeScheduler);
Rx.TestScheduler = (function (_super) {
inherits(TestScheduler, _super);
/** @constructor */
function TestScheduler() {
TestScheduler.super_.constructor.call(this, 0, function (a, b) { return a - b; });
_super.call(this, 0, function (a, b) { return a - b; });
}

@@ -22,3 +22,3 @@

}
return TestScheduler.super_.scheduleAbsoluteWithState.call(this, state, dueTime, action);
return _super.prototype.scheduleAbsoluteWithState.call(this, state, dueTime, action);
};

@@ -129,2 +129,2 @@ /**

return TestScheduler;
})();
})(VirtualTimeScheduler);
// Refernces
var Observable = root.Observable,
var Observable = Rx.Observable,
observableProto = Observable.prototype,
AnonymousObservable = root.Internals.AnonymousObservable,
AnonymousObservable = Rx.Internals.AnonymousObservable,
observableDefer = Observable.defer,

@@ -9,10 +9,10 @@ observableEmpty = Observable.empty,

observableFromArray = Observable.fromArray,
timeoutScheduler = root.Scheduler.timeout,
SingleAssignmentDisposable = root.SingleAssignmentDisposable,
SerialDisposable = root.SerialDisposable,
CompositeDisposable = root.CompositeDisposable,
RefCountDisposable = root.RefCountDisposable,
Subject = root.Subject,
BinaryObserver = root.Internals.BinaryObserver,
addRef = root.Internals.addRef,
normalizeTime = root.Scheduler.normalize;
timeoutScheduler = Rx.Scheduler.timeout,
SingleAssignmentDisposable = Rx.SingleAssignmentDisposable,
SerialDisposable = Rx.SerialDisposable,
CompositeDisposable = Rx.CompositeDisposable,
RefCountDisposable = Rx.RefCountDisposable,
Subject = Rx.Subject,
BinaryObserver = Rx.Internals.BinaryObserver,
addRef = Rx.Internals.addRef,
normalizeTime = Rx.Scheduler.normalize;

@@ -21,3 +21,3 @@ /// <reference path="../reactiveassert.js" />

var ConnectableObservable = (function () {
var ConnectableObservable = (function (_super) {

@@ -28,7 +28,7 @@ function subscribe(observer) {

inherits(ConnectableObservable, Observable);
inherits(ConnectableObservable, _super);
function ConnectableObservable(o, s) {
_super.call(this, subscribe);
this._o = o.multicast(s);
ConnectableObservable.super_.constructor.call(this, subscribe);
}

@@ -45,5 +45,5 @@

return ConnectableObservable;
}());
}(Observable));
var MySubject = (function () {
var MySubject = (function (_super) {

@@ -61,8 +61,8 @@ function subscribe(observer) {

inherits(MySubject, Observable);
inherits(MySubject, _super);
function MySubject() {
_super.call(this, subscribe);
this.disposeOnMap = {};
this.subscribeCount = 0;
this.disposed = false;
MySubject.super_.constructor.call(this, subscribe);
this.disposed = false;
}

@@ -86,3 +86,3 @@ MySubject.prototype.disposeOn = function (value, disposable) {

return MySubject;
})();
})(Observable);

@@ -89,0 +89,0 @@ test('ConnectableObservable_Creation', function () {

@@ -11,37 +11,34 @@ (function (window) {

});
asyncTest('Timeout_ScheduleAction', function () {
var ran = false;
asyncTest('Timeout_ScheduleAction', 1, function () {
expect(1);
TimeoutScheduler.schedule(function () {
ran = true;
ok(true);
start();
});
setTimeout(function () {
ok(ran);
start();
}, 5);
});
asyncTest('ThreadPool_ScheduleActionDue', function () {
expect(1);
var startTime = new Date().getTime(), endTime;
TimeoutScheduler.scheduleWithRelative(200, function () {
endTime = new Date().getTime();
});
setTimeout(function () {
ok(endTime - startTime > 180, endTime - startTime);
start();
}, 400);
});
});
asyncTest('Timeout_ScheduleActionCancel', function () {
var set = false
, d = TimeoutScheduler.scheduleWithRelative(200, function () {
set = true;
});
asyncTest('Timeout_ScheduleActionCancel', 1, function () {
var set = false;
var d = TimeoutScheduler.scheduleWithRelative(200, function () {
set = true;
});
d.dispose();
setTimeout(function () {
ok(!set);
start();
}, 400);
}, 400);
});

@@ -48,0 +45,0 @@

@@ -85,5 +85,2 @@ /// <reference path="../reactiveassert.js" />

// must call `QUnit.start()` if using QUnit < 1.3.0 with Node.js or any
// version of QUnit with Narwhal, Rhino, or RingoJS
}(typeof global == 'object' && global || this));

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc