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.5 to 2.1.6

.jamignore

0

examples/jasmine/lib/jasmine-1.3.1/jasmine-html.js

@@ -0,0 +0,0 @@ jasmine.HtmlReporterHelpers = {};

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

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

@@ -79,2 +80,3 @@ 'src/core/internal/polyfills.js',

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

@@ -81,0 +83,0 @@ 'src/core/internal/priorityqueue.js',

5

package.json

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

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

@@ -22,2 +22,5 @@ "author": {

],
"jam": {
"main": "rx.js"
},
"dependencies": {},

@@ -24,0 +27,0 @@ "devDependencies": {

@@ -96,32 +96,4 @@ [![Build Status](https://travis-ci.org/Reactive-Extensions/RxJS.png)](https://travis-ci.org/Reactive-Extensions/RxJS)

Core:
You can find the documentation [here](https://github.com/Reactive-Extensions/RxJS/tree/master/doc) as well as examples [here](https://github.com/Reactive-Extensions/RxJS/tree/master/examples).
- [Observer](https://github.com/Reactive-Extensions/RxJS/wiki/Observer)
- [Observable](https://github.com/Reactive-Extensions/RxJS/wiki/Observable)
Subjects:
- AsyncSubject
- BehaviorSubject
- ReplaySubject
- Subject
Schedulers:
- Scheduler object
- Scheduler.currentThread
- Scheduler.immediate
- Scheduler.timeout
- VirtualTimeScheduler
Disposables:
- CompositeDisposable
- Disposable
- RefCountDisposable
- SerialDisposable
- SingleAssignmentDisposable
## Installation and Usage ##

@@ -128,0 +100,0 @@

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

CompositeDisposable = Rx.CompositeDisposable,
AnonymousObservable = Rx.Internals.AnonymousObservable;
AnonymousObservable = Rx.Internals.AnonymousObservable,
isEqual = Rx.Internals.isEqual;

@@ -34,3 +35,3 @@ // Defaults

var sequenceContainsNoElements = "Sequence contains no elements.";
function defaultComparer(x, y) { return x === y; }
function defaultComparer(x, y) { return isEqual(x, y); }
function identity(x) { return x; }

@@ -41,6 +42,6 @@ function subComparer(x, y) {

}
if (x === y) {
return 0;
if (x < y) {
return -1
}
return -1;
return 0;
}

@@ -47,0 +48,0 @@

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

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

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

/**
* Determines whether an observable collection contains values.
* Determines whether an observable collection contains values. There is an alias for this method called 'ifThen' for browsers <IE9
*
* @example
* 1 - res = Rx.Observable.ifThen(condition, obs1);
* 2 - res = Rx.Observable.ifThen(condition, obs1, obs2);
* 3 - res = Rx.Observable.ifThen(condition, obs1, scheduler);
* 1 - res = Rx.Observable.if(condition, obs1);
* 2 - res = Rx.Observable.if(condition, obs1, obs2);
* 3 - res = Rx.Observable.if(condition, obs1, scheduler);
* @static

@@ -89,3 +89,3 @@ * @memberOf Observable

*/
Observable.ifThen = function (condition, thenSource, elseSourceOrScheduler) {
Observable['if'] = Observable.ifThen = function (condition, thenSource, elseSourceOrScheduler) {
return observableDefer(function () {

@@ -103,2 +103,3 @@ elseSourceOrScheduler || (elseSourceOrScheduler = observableEmpty());

* Concatenates the observable sequences obtained by running the specified result selector for each element in source.
* There is an alias for this method called 'forIn' for browsers <IE9
* @static

@@ -110,3 +111,3 @@ * @memberOf Observable

*/
Observable.forIn = function (sources, resultSelector) {
Observable['for'] = Observable.forIn = function (sources, resultSelector) {
return enumerableForEach(sources, resultSelector).concat();

@@ -117,2 +118,3 @@ };

* Repeats source as long as condition holds emulating a while loop.
* There is an alias for this method called 'whileDo' for browsers <IE9
* @static

@@ -124,3 +126,3 @@ * @memberOf Observable

*/
var observableWhileDo = Observable.whileDo = function (condition, source) {
var observableWhileDo = Observable['while'] = Observable.whileDo = function (condition, source) {
return enumerableWhile(condition, source).concat();

@@ -143,7 +145,8 @@ };

* Uses selector to determine which source in sources to use.
* There is an alias 'switchCase' for browsers <IE9.
*
* @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);
* 1 - res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 });
* 1 - res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 }, obs0);
* 1 - res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 }, scheduler);
*

@@ -158,3 +161,3 @@ * @static

*/
Observable.switchCase = function (selector, sources, defaultSourceOrScheduler) {
Observable['case'] = Observable.switchCase = function (selector, sources, defaultSourceOrScheduler) {
return observableDefer(function () {

@@ -161,0 +164,0 @@ defaultSourceOrScheduler || (defaultSourceOrScheduler = observableEmpty());

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

(function(t,e){var n="object"==typeof exports&&exports,r=("object"==typeof module&&module&&module.exports==n&&module,"object"==typeof global&&global);r.global===r&&(window=r),"function"==typeof define&&define.amd?define(["rx","exports"],function(n,r){return t.Rx=e(t,r,n),t.Rx}):"object"==typeof module&&module&&module.exports===n?module.exports=e(t,module.exports,require("./rx")):t.Rx=e(t,{},t.Rx)})(this,function(t,e,n,r){function i(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:g.call(t)}function o(t,e){return new m(function(){var n;return v(function(){return t()?(n=e,!0):!1},function(){return n})})}var s=n.Observable,u=s.prototype,c=s.createWithDisposable,a=s.concat,h=s.defer,l=s.empty,f=n.Disposable.empty,p=(n.Internals.BinaryObserver,n.CompositeDisposable),d=n.SerialDisposable,b=n.SingleAssignmentDisposable,v=n.Internals.Enumerator.create,m=n.Internals.Enumerable,y=m.forEach,w=n.Scheduler.immediate,g=Array.prototype.slice;u.letBind=function(t){return t(this)},s.ifThen=function(t,e,n){return h(function(){if(n||(n=l()),n.now){var r=n;n=l(r)}return t()?e:n})},s.forIn=function(t,e){return y(t,e).concat()};var E=s.whileDo=function(t,e){return o(t,e).concat()};return u.doWhile=function(t){return a([this,E(t,this)])},s.switchCase=function(t,e,n){return h(function(){if(n||(n=l()),n.now){var i=n;n=l(i)}var o=e[t()];return o!==r?o:n})},u.expand=function(t,e){e||(e=w);var n=this;return c(function(i){var o=[],s=new d,u=new p(s),c=0,a=!1,h=function(){var n=!1;o.length>0&&(n=!a,a=!0),n&&s.setDisposable(e.scheduleRecursive(function(e){var n;if(!(o.length>0))return a=!1,r;n=o.shift();var s=new b;u.add(s),s.setDisposable(n.subscribe(function(e){i.onNext(e);var n=null;try{n=t(e)}catch(r){i.onError(r)}o.push(n),c++,h()},i.onError.bind(i),function(){u.remove(s),c--,0===c&&i.onCompleted()})),e()}))};return o.push(n),c++,h(),u})},s.forkJoin=function(){var t=i(arguments,0);return c(function(e){var n=t.length;if(0===n)return e.onCompleted(),f;for(var i=new p,o=!1,s=Array(n),u=Array(n),c=Array(n),a=0;n>a;a++)(function(a){var h=t[a];i.add(h.subscribe(function(t){o||(s[a]=!0,c[a]=t)},function(t){o=!0,e.onError(t),i.dispose()},function(){if(!o){if(!s[a])return e.onCompleted(),r;u[a]=!0;for(var t=0;n>t;t++)if(!u[t])return;o=!0,e.onNext(c),e.onCompleted()}}))})(a);return i})},u.forkJoin=function(t,e){var n=this;return c(function(i){var o,s,u=!1,c=!1,a=!1,h=!1,l=new b,f=new b;return l.setDisposable(n.subscribe(function(t){a=!0,o=t},function(t){f.dispose(),i.onError(t)},function(){if(u=!0,c)if(a)if(h){var t;try{t=e(o,s)}catch(n){return i.onError(n),r}i.onNext(t),i.onCompleted()}else i.onCompleted();else i.onCompleted()})),f.setDisposable(t.subscribe(function(t){h=!0,s=t},function(t){l.dispose(),i.onError(t)},function(){if(c=!0,u)if(a)if(h){var t;try{t=e(o,s)}catch(n){return i.onError(n),r}i.onNext(t),i.onCompleted()}else i.onCompleted();else i.onCompleted()})),new p(l,f)})},n});
(function(t,e){var n="object"==typeof exports&&exports,r=("object"==typeof module&&module&&module.exports==n&&module,"object"==typeof global&&global);r.global===r&&(window=r),"function"==typeof define&&define.amd?define(["rx","exports"],function(n,r){return t.Rx=e(t,r,n),t.Rx}):"object"==typeof module&&module&&module.exports===n?module.exports=e(t,module.exports,require("./rx")):t.Rx=e(t,{},t.Rx)})(this,function(t,e,n,r){function i(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:g.call(t)}function o(t,e){return new m(function(){var n;return v(function(){return t()?(n=e,!0):!1},function(){return n})})}var s=n.Observable,u=s.prototype,c=s.createWithDisposable,a=s.concat,h=s.defer,l=s.empty,f=n.Disposable.empty,p=(n.Internals.BinaryObserver,n.CompositeDisposable),d=n.SerialDisposable,b=n.SingleAssignmentDisposable,v=n.Internals.Enumerator.create,m=n.Internals.Enumerable,y=m.forEach,w=n.Scheduler.immediate,g=Array.prototype.slice;u.letBind=function(t){return t(this)},s["if"]=s.ifThen=function(t,e,n){return h(function(){if(n||(n=l()),n.now){var r=n;n=l(r)}return t()?e:n})},s["for"]=s.forIn=function(t,e){return y(t,e).concat()};var E=s["while"]=s.whileDo=function(t,e){return o(t,e).concat()};return u.doWhile=function(t){return a([this,E(t,this)])},s["case"]=s.switchCase=function(t,e,n){return h(function(){if(n||(n=l()),n.now){var i=n;n=l(i)}var o=e[t()];return o!==r?o:n})},u.expand=function(t,e){e||(e=w);var n=this;return c(function(i){var o=[],s=new d,u=new p(s),c=0,a=!1,h=function(){var n=!1;o.length>0&&(n=!a,a=!0),n&&s.setDisposable(e.scheduleRecursive(function(e){var n;if(!(o.length>0))return a=!1,r;n=o.shift();var s=new b;u.add(s),s.setDisposable(n.subscribe(function(e){i.onNext(e);var n=null;try{n=t(e)}catch(r){i.onError(r)}o.push(n),c++,h()},i.onError.bind(i),function(){u.remove(s),c--,0===c&&i.onCompleted()})),e()}))};return o.push(n),c++,h(),u})},s.forkJoin=function(){var t=i(arguments,0);return c(function(e){var n=t.length;if(0===n)return e.onCompleted(),f;for(var i=new p,o=!1,s=Array(n),u=Array(n),c=Array(n),a=0;n>a;a++)(function(a){var h=t[a];i.add(h.subscribe(function(t){o||(s[a]=!0,c[a]=t)},function(t){o=!0,e.onError(t),i.dispose()},function(){if(!o){if(!s[a])return e.onCompleted(),r;u[a]=!0;for(var t=0;n>t;t++)if(!u[t])return;o=!0,e.onNext(c),e.onCompleted()}}))})(a);return i})},u.forkJoin=function(t,e){var n=this;return c(function(i){var o,s,u=!1,c=!1,a=!1,h=!1,l=new b,f=new b;return l.setDisposable(n.subscribe(function(t){a=!0,o=t},function(t){f.dispose(),i.onError(t)},function(){if(u=!0,c)if(a)if(h){var t;try{t=e(o,s)}catch(n){return i.onError(n),r}i.onNext(t),i.onCompleted()}else i.onCompleted();else i.onCompleted()})),f.setDisposable(t.subscribe(function(t){h=!0,s=t},function(t){l.dispose(),i.onError(t)},function(){if(c=!0,u)if(a)if(h){var t;try{t=e(o,s)}catch(n){return i.onError(n),r}i.onNext(t),i.onCompleted()}else i.onCompleted();else i.onCompleted()})),new p(l,f)})},n});

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

CompositeDisposable = Rx.CompositeDisposable,
AbstractObserver = Rx.Internals.AbstractObserver;
AbstractObserver = Rx.Internals.AbstractObserver,
isEqual = Rx.Internals.isEqual;
// Defaults
function defaultComparer(x, y) { return x === y; }
function defaultComparer(x, y) { return isEqual(x, y); }
function noop() { }

@@ -38,0 +39,0 @@

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

(function(t,e){var n="object"==typeof exports&&exports,r=("object"==typeof module&&module&&module.exports==n&&module,"object"==typeof global&&global);r.global===r&&(window=r),"function"==typeof define&&define.amd?define(["rx","exports"],function(n,r){return t.Rx=e(t,r,n),t.Rx}):"object"==typeof module&&module&&module.exports===n?module.exports=e(t,module.exports,require("./rx")):t.Rx=e(t,{},t.Rx)})(this,function(t,e,n){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});
(function(t,e){var n="object"==typeof exports&&exports,r=("object"==typeof module&&module&&module.exports==n&&module,"object"==typeof global&&global);r.global===r&&(window=r),"function"==typeof define&&define.amd?define(["rx","exports"],function(n,r){return t.Rx=e(t,r,n),t.Rx}):"object"==typeof module&&module&&module.exports===n?module.exports=e(t,module.exports,require("./rx")):t.Rx=e(t,{},t.Rx)})(this,function(t,e,n){function r(){}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 w(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 g,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;n.Internals.isEqual;var m=n.Internals.inherits,y=Array.prototype.slice,g=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 w=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 g;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(x)}function h(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:C.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 M}function d(t,n){return new Se(function(r){var i=new M,o=new L;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 M,o.setDisposable(i),i.setDisposable(s.subscribe(r))},r.onCompleted.bind(r))),o})}function b(t,n){var r=this;return new Se(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,y=("object"==typeof module&&module&&module.exports==m&&module,"object"==typeof global&&global);y.global===y&&(t=y);var w={Internals:{}},g="Sequence contains no elements.",E="Argument out of range",x="Object has been disposed",C=Array.prototype.slice;({}).hasOwnProperty;var D=this.inherits=w.Internals.inherits=function(t,e){function n(){this.constructor=t}n.prototype=e.prototype,t.prototype=new n},A=w.Internals.addProperties=function(t){for(var e=C.call(arguments,1),n=0,r=e.length;r>n;n++){var i=e[n];for(var o in i)t[o]=i[o]}},S=w.Internals.addRef=function(t,e){return new Se(function(n){return new k(e.getDisposable(),t.subscribe(n))})};Function.prototype.bind||(Function.prototype.bind=function(t){var e=this,n=C.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(C.call(arguments)));return Object(s)===s?s:o}return e.apply(t,n.concat(C.call(arguments)))};return r});var _=Object("a"),N="a"!=_[0]||!(0 in _);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 O=function(t,e){this.id=t,this.value=e};O.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 O(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 k=w.CompositeDisposable=function(){this.disposables=h(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},j=k.prototype;j.add=function(t){this.isDisposed?t.dispose():(this.disposables.push(t),this.length++)},j.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},j.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()}},j.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()},j.contains=function(t){return-1!==this.disposables.indexOf(t)},j.toArray=function(){return this.disposables.slice(0)};var q=w.Disposable=function(t){this.isDisposed=!1,this.action=t||n};q.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var T=q.create=function(t){return new q(t)},I=q.empty={dispose:n},M=w.SingleAssignmentDisposable=function(){this.isDisposed=!1,this.current=null},P=M.prototype;P.disposable=function(t){return t?this.setDisposable(t):this.getDisposable()},P.getDisposable=function(){return this.current},P.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()},P.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()};var L=w.SerialDisposable=function(){this.isDisposed=!1,this.current=null};L.prototype.getDisposable=function(){return this.current},L.prototype.setDisposable=function(t){var e,n=this.isDisposed;n||(e=this.current,this.current=t),e&&e.dispose(),n&&t&&t.dispose()},L.prototype.disposable=function(t){return t?(this.setDisposable(t),e):this.getDisposable()},L.prototype.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()};var V=w.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?I: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 z=w.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 k,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),I});r||(i.add(s),n=!0)})};return o(n),i}function r(t,e,n){var r=e.first,i=e.second,o=new k,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),I});u||(o.add(c),i=!0)})};return s(r),o}function o(t,e){return e(),I}var s=e.prototype;return s.catchException=function(t){return new Q(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}(),F="Scheduler is not allowed to block the thread",B=z.immediate=function(){function t(t,e){return e(this,t)}function e(t,e,n){if(e>0)throw Error(F);return n(this,t)}function n(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new z(i,t,e,n)}(),H=z.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()+z.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-z.now()>0;);t.isCancelled()||t.invoke()}};var s=new z(i,e,n,r);return s.scheduleRequired=function(){return null===o},s.ensureTrampoline=function(t){return null===o?this.schedule(t):t()},s}(),U=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 M;return this._cancel=e,e.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,t.bind(this))),e},e}();w.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(),I}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)}D(u,t);var c=u.prototype;return c.schedulePeriodicWithState=function(t,e,n){var r=new U(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(E);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(E);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(E);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}(z),w.HistoricalScheduler=function(t){function e(e,n){var r=null==e?0:e,i=n||s;t.call(this,r,i)}D(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}(w.VirtualTimeScheduler);var G,J=n;(function(){function e(){if(!t.postMessage||t.importScripts)return!1;var e=!1,n=t.onmessage;return t.onmessage=function(){e=!0},t.postMessage("","*"),t.onmessage=n,e}function n(t){if("string"==typeof t.data&&t.data.substring(0,r.length)===r){var e=t.data.substring(r.length),n=i[e];n(),delete i[e]}}if("object"==typeof t.process&&"[object process]"===Object.prototype.toString.call(t.process))G=t.process.nextTick;else if("function"==typeof t.setImmediate)G=t.setImmediate,J=t.clearImmediate;else if(e()){var r="ms.rx.schedule"+Math.random(),i={},o=0;t.addEventListener?t.addEventListener("message",n,!1):t.attachEvent("onmessage",n,!1),G=function(e){var n=o++;i[n]=e,t.postMessage(r+n,"*")}}else if(t.MessageChannel){var s=new t.MessageChannel,u={},c=0;s.port1.onmessage=function(t){var e=t.data,n=u[e];n(),delete u[e]},G=function(t){var e=c++;u[e]=t,s.port2.postMessage(e)}}else"document"in t&&"onreadystatechange"in t.document.createElement("script")?G=function(e){var n=t.document.createElement("script");n.onreadystatechange=function(){e(),n.onreadystatechange=null,n.parentNode.removeChild(n),n=null},t.document.documentElement.appendChild(n)}:(G=function(e){return t.setTimeout(e,0)},J=t.clearTimeout)})();var K=z.timeout=function(){function e(t,e){var n=this,r=new M,i=G(function(){r.isDisposed||r.setDisposable(e(n,t))});return new k(r,T(function(){J(i)}))}function n(e,n,r){var i=this,o=z.normalize(n);if(0===o)return i.scheduleWithState(e,r);var s=new M,u=t.setTimeout(function(){s.isDisposed||s.setDisposable(r(i,e))},o);return new k(s,T(function(){t.clearTimeout(u)}))}function r(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new z(i,e,n,r)}(),Q=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 D(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 I}}},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 M;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}(z),X=w.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||B,new Se(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}(),Y=X.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 X("N",!0);return i.value=r,i._accept=t.bind(i),i._acceptObservable=e.bind(i),i.toString=n.bind(i),i}}(),Z=X.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 X("E");return i.exception=r,i._accept=t.bind(i),i._acceptObservable=e.bind(i),i.toString=n.bind(i),i}}(),$=X.createOnCompleted=function(){function t(t,e,n){return n()}function e(t){return t.onCompleted()}function n(){return"OnCompleted()"}return function(){var r=new X("C");return r._accept=t.bind(r),r._acceptObservable=e.bind(r),r.toString=n.bind(r),r}}(),te=w.Internals.Enumerator=function(t,e,n){this.moveNext=t,this.getCurrent=e,this.dispose=n},ee=te.create=function(t,e,r){var i=!1;return r||(r=n),new te(function(){if(i)return!1;var e=t();return e||(i=!0,r()),e},function(){return e()},function(){i||(r(),i=!0)})},ne=w.Internals.Enumerable=function(){function t(t){this.getEnumerator=t}return t.prototype.concat=function(){var t=this;return new Se(function(n){var r=t.getEnumerator(),i=!1,o=new L,s=B.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 M;o.setDisposable(h),h.setDisposable(s.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){t()}))}});return new k(o,s,T(function(){i=!0,r.dispose()}))})},t.prototype.catchException=function(){var t=this;return new Se(function(n){var r,i=t.getEnumerator(),o=!1,s=new L,u=B.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 M;s.setDisposable(l),l.setDisposable(u.subscribe(n.onNext.bind(n),function(e){r=e,t()},n.onCompleted.bind(n)))}});return new k(s,u,T(function(){o=!0}))})},t}(),re=ne.repeat=function(t,n){return n===e&&(n=-1),new ne(function(){var e,r=n;return ee(function(){return 0===r?!1:(r>0&&r--,e=t,!0)},function(){return e})})},ie=ne.forEach=function(t,e){return e||(e=r),new ne(function(){var n,r=-1;return ee(function(){return++r<t.length?(n=e(t[r],r),!0):!1},function(){return n})})},oe=w.Observer=function(){};oe.prototype.toNotifier=function(){var t=this;return function(e){return e.accept(t)}},oe.prototype.asObserver=function(){return new ae(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},oe.prototype.checked=function(){return new he(this)};var se=oe.create=function(t,e,r){return t||(t=n),e||(e=c),r||(r=n),new ae(t,e,r)};oe.fromNotifier=function(t){return new ae(function(e){return t(Y(e))},function(e){return t(Z(e))},function(){return t($())})};var ue,ce=w.Internals.AbstractObserver=function(t){function e(){this.isStopped=!1,t.call(this)}return D(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}(oe),ae=w.AnonymousObserver=function(t){function e(e,n,r){t.call(this),this._onNext=e,this._onError=n,this._onCompleted=r}return D(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}(ce),he=function(t){function e(e){t.call(this),this._observer=e,this._state=0}D(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}(oe),le=w.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 L}return D(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}(ce),fe=function(t){function e(){t.apply(this,arguments)}return D(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}(le),pe=w.Observable=function(){function t(t){this._subscribe=t}return ue=t.prototype,ue.finalValue=function(){var t=this;return new Se(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(g))})})},ue.subscribe=ue.forEach=function(t,e,n){var r;return r="object"==typeof t?t:se(t,e,n),this._subscribe(r)},ue.toArray=function(){function t(t,e){var n=t.slice(0);return n.push(e),n}return this.scan([],t).startWith([]).finalValue()},t}();pe.start=function(t,e){return de(t,e)()};var de=pe.toAsync=function(t,n,r){return n||(n=K),function(){var i=C.call(arguments,0),o=new Re;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()}};ue.observeOn=function(t){var e=this;return new Se(function(n){return e.subscribe(new fe(t,n))})},ue.subscribeOn=function(t){var e=this;return new Se(function(n){var r=new M,i=new L;return i.setDisposable(r),r.setDisposable(t.schedule(function(){i.setDisposable(new f(t,e.subscribe(n)))})),i})},pe.create=function(t){return new Se(function(e){return T(t(e))})},pe.createWithDisposable=function(t){return new Se(t)};var be=pe.defer=function(t){return new Se(function(e){var n;try{n=t()}catch(r){return ge(r).subscribe(e)}return n.subscribe(e)})},ve=pe.empty=function(t){return t||(t=B),new Se(function(e){return t.schedule(function(){e.onCompleted()})})},me=pe.fromArray=function(t,e){return e||(e=H),new Se(function(n){var r=0;return e.scheduleRecursive(function(e){t.length>r?(n.onNext(t[r++]),e()):n.onCompleted()})})};pe.generate=function(t,n,r,i,o){return o||(o=H),new Se(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 ye=pe.never=function(){return new Se(function(){return I})};pe.range=function(t,e,n){return n||(n=H),new Se(function(r){return n.scheduleRecursiveWithState(0,function(n,i){e>n?(r.onNext(t+n),i(n+1)):r.onCompleted()})})},pe.repeat=function(t,e,n){return n||(n=H),null==e&&(e=-1),we(t,n).repeat(e)};var we=pe.returnValue=function(t,e){return e||(e=B),new Se(function(n){return e.schedule(function(){n.onNext(t),n.onCompleted()})})},ge=pe.throwException=function(t,e){return e||(e=B),new Se(function(n){return e.schedule(function(){n.onError(t)})})};pe.using=function(t,e){return new Se(function(n){var r,i,o=I;try{r=t(),r&&(o=r),i=e(r)}catch(s){return new k(ge(s).subscribe(n),o)}return new k(i.subscribe(n),o)})},ue.amb=function(t){var e=this;return new Se(function(n){function r(){o||(o=s,a.dispose())}function i(){o||(o=u,c.dispose())}var o,s="L",u="R",c=new M,a=new M;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 k(c,a)})},pe.amb=function(){function t(t,e){return t.amb(e)}for(var e=ye(),n=h(arguments,0),r=0,i=n.length;i>r;r++)e=t(e,n[r]);return e},ue.catchException=function(t){return"function"==typeof t?d(this,t):Ee([this,t])};var Ee=pe.catchException=function(){var t=h(arguments,0);return ie(t).catchException()};ue.combineLatest=function(){var t=C.call(arguments);return Array.isArray(t[0])?t[0].unshift(this):t.unshift(this),xe.apply(this,t)};var xe=pe.combineLatest=function(){var t=C.call(arguments),n=t.pop();return Array.isArray(t[0])&&(t=t[0]),new Se(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 M,p[e].setDisposable(t[e].subscribe(function(t){f[e]=t,i(e)},r.onError.bind(r),function(){o(e)}))})(d);return new k(p)})};ue.concat=function(){var t=C.call(arguments,0);return t.unshift(this),Ce.apply(this,t)};var Ce=pe.concat=function(){var t=h(arguments,0);return ie(t).concat()};ue.concatObservable=ue.concatAll=function(){return this.merge(1)},ue.merge=function(t){if("number"!=typeof t)return De(this,t);var e=this;return new Se(function(n){var r=0,i=new k,o=!1,s=[],u=function(t){var e=new M;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 De=pe.merge=function(){var t,e;return arguments[0]?arguments[0].now?(t=arguments[0],e=C.call(arguments,1)):(t=B,e=C.call(arguments,0)):(t=B,e=C.call(arguments,1)),Array.isArray(e[0])&&(e=e[0]),me(e,t).mergeObservable()};ue.mergeObservable=ue.mergeAll=function(){var t=this;return new Se(function(e){var n=new k,r=!1,i=new M;return n.add(i),i.setDisposable(t.subscribe(function(t){var i=new M;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})},ue.onErrorResumeNext=function(t){if(!t)throw Error("Second observable is required");return Ae([this,t])};var Ae=pe.onErrorResumeNext=function(){var t=h(arguments,0);return new Se(function(e){var n=0,r=new L,i=B.scheduleRecursive(function(i){var o,s;t.length>n?(o=t[n++],s=new M,r.setDisposable(s),s.setDisposable(o.subscribe(e.onNext.bind(e),function(){i()},function(){i()}))):e.onCompleted()});return new k(r,i)})};ue.skipUntil=function(t){var e=this;return new Se(function(n){var r=!1,i=new k(e.subscribe(function(t){r&&n.onNext(t)},n.onError.bind(n),function(){r&&n.onCompleted()})),o=new M;return i.add(o),o.setDisposable(t.subscribe(function(){r=!0,o.dispose()},n.onError.bind(n),function(){o.dispose()})),i})},ue.switchLatest=function(){var t=this;return new Se(function(e){var n=!1,r=new L,i=!1,o=0,s=t.subscribe(function(t){var s=new M,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 k(s,r)})},ue.takeUntil=function(t){var e=this;return new Se(function(r){return new k(e.subscribe(r),t.subscribe(r.onCompleted.bind(r),r.onError.bind(r),n))})},ue.zip=function(){if(Array.isArray(arguments[0]))return b.apply(this,arguments);var t=this,n=C.call(arguments),i=n.pop();return n.unshift(t),new Se(function(o){function s(t){a[t]=!0,a.every(function(t){return t})&&o.onCompleted()}for(var u=n.length,c=l(u,function(){return[]}),a=l(u,function(){return!1}),h=function(n){var s,u;if(c.every(function(t){return t.length>0})){try{u=c.map(function(t){return t.shift()}),s=i.apply(t,u)}catch(h){return o.onError(h),e}o.onNext(s)}else a.filter(function(t,e){return e!==n}).every(r)&&o.onCompleted()},f=Array(u),p=0;u>p;p++)(function(t){f[t]=new M,f[t].setDisposable(n[t].subscribe(function(e){c[t].push(e),h(t)},o.onError.bind(o),function(){s(t)}))})(p);return new k(f)})},pe.zip=function(){var t=C.call(arguments,0),e=t.shift();return e.zip.apply(e,t)},pe.zipArray=function(){var t=C.call(arguments);return new Se(function(n){function i(t){if(u.every(function(t){return t.length>0})){var i=u.map(function(t){return t.shift()});n.onNext(i)}else if(c.filter(function(e,n){return n!==t}).every(r))return n.onCompleted(),e}function o(t){return c[t]=!0,c.every(r)?(n.onCompleted(),e):e}for(var s=t.length,u=l(s,function(){return[]}),c=l(s,function(){return!1}),a=Array(s),h=0;s>h;h++)(function(e){a[e]=new M,a[e].setDisposable(t[e].subscribe(function(t){u[e].push(t),i(e)},n.onError.bind(n),function(){o(e)}))})(h);var f=new k(a);return f.add(T(function(){for(var t=0,e=u.length;e>t;t++)u[t]=[]})),f})},ue.asObservable=function(){var t=this;return new Se(function(e){return t.subscribe(e)})},ue.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})},ue.dematerialize=function(){var t=this;return new Se(function(e){return t.subscribe(function(t){return t.accept(e)},e.onError.bind(e),e.onCompleted.bind(e))})},ue.distinctUntilChanged=function(t,n){var i=this;return t||(t=r),n||(n=o),new Se(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))})},ue.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 Se(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()})})},ue.finallyAction=function(t){var e=this;return new Se(function(n){var r=e.subscribe(n);return T(function(){try{r.dispose()}catch(e){throw e}finally{t()}})})},ue.ignoreElements=function(){var t=this;
return new Se(function(e){return t.subscribe(n,e.onError.bind(e),e.onCompleted.bind(e))})},ue.materialize=function(){var t=this;return new Se(function(e){return t.subscribe(function(t){e.onNext(Y(t))},function(t){e.onNext(Z(t)),e.onCompleted()},function(){e.onNext($()),e.onCompleted()})})},ue.repeat=function(t){return re(this,t).concat()},ue.retry=function(t){return re(this,t).catchException()},ue.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 be(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})})},ue.skipLast=function(t){var e=this;return new Se(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))})},ue.startWith=function(){var t,e,n=0;return arguments.length&&"now"in Object(arguments[0])?(e=arguments[0],n=1):e=B,t=C.call(arguments,n),ie([me(t,e),this]).concat()},ue.takeLast=function(t,e){return this.takeLastBuffer(t).selectMany(function(t){return me(t,e)})},ue.takeLastBuffer=function(t){var e=this;return new Se(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()})})},ue.windowWithCount=function(t,e){var n=this;if(0>=t)throw Error(E);if(null==e&&(e=t),0>=e)throw Error(E);return new Se(function(r){var i=new M,o=new V(i),s=0,u=[],c=function(){var t=new We;u.push(t),r.onNext(S(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})},ue.defaultIfEmpty=function(t){var n=this;return t===e&&(t=null),new Se(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()})})},ue.distinct=function(t,n){var i=this;return t||(t=r),n||(n=u),new Se(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))})},ue.groupBy=function(t,e,n){return this.groupByUntil(t,e,function(){return ye()},n)},ue.groupByUntil=function(t,i,o,s){var c=this;return i||(i=r),s||(s=u),new Se(function(r){var u={},a=new k,h=new V(a);return a.add(c.subscribe(function(c){var l,f,p,d,b,v,m,y,w,g;try{v=t(c),m=s(v)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}d=!1;try{w=u[m],w||(w=new We,u[m]=w,d=!0)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}if(d){b=new Ne(v,w,h),f=new Ne(v,w);try{l=o(f)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}r.onNext(b),y=new M,a.add(y);var x=function(){m in u&&(delete u[m],w.onCompleted()),a.remove(y)};y.setDisposable(l.take(1).subscribe(n,function(t){for(g in u)u[g].onError(t);r.onError(t)},function(){x()}))}try{p=i(c)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}w.onNext(p)},function(t){for(var e in u)u[e].onError(t);r.onError(t)},function(){for(var t in u)u[t].onCompleted();r.onCompleted()})),h})},ue.select=function(t,n){var r=this;return new Se(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))})},ue.map=ue.select,ue.selectMany=ue.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})},ue.skip=function(t){if(0>t)throw Error(E);var e=this;return new Se(function(n){var r=t;return e.subscribe(function(t){0>=r?n.onNext(t):r--},n.onError.bind(n),n.onCompleted.bind(n))})},ue.skipWhile=function(t){var n=this;return new Se(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))})},ue.take=function(t,e){if(0>t)throw Error(E);if(0===t)return ve(e);var n=this;return new Se(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))})},ue.takeWhile=function(t){var n=this;return new Se(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))})},ue.where=function(t,n){var r=this;return new Se(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))})},ue.filter=ue.where;var Se=w.Internals.AnonymousObservable=function(t){function n(r){function i(t){var e=new _e(t);if(H.scheduleRequired())H.schedule(function(){try{e.disposable(r(e))}catch(t){if(!e.fail(t))throw t}});else try{e.disposable(r(e))}catch(n){if(!e.fail(n))throw n}return e}return this instanceof n?(t.call(this,i),e):new n(r)}return D(n,t),n}(pe),_e=function(t){function e(e){t.call(this),this.observer=e,this.m=new M}D(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}(ce),Ne=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 Se(function(t){return new k(i.getDisposable(),r.subscribe(t))}):r}return D(n,t),n}(pe),Oe=function(t,e){this.subject=t,this.observer=e};Oe.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 We=w.Subject=function(t){function e(t){return a.call(this),this.isStopped?this.exception?(t.onError(this.exception),I):(t.onCompleted(),I):(this.observers.push(t),new Oe(this,t))}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return D(n,t),A(n.prototype,oe,{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 ke(t,e)},n}(pe),Re=w.AsyncSubject=function(t){function e(t){if(a.call(this),!this.isStopped)return this.observers.push(t),new Oe(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(),I}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return D(n,t),A(n.prototype,oe,{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}(pe),ke=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 D(n,t),A(n.prototype,oe,{onCompleted:function(){this.observer.onCompleted()},onError:function(t){this.observer.onError(t)},onNext:function(t){this.observer.onNext(t)}}),n}(pe);return"function"==typeof define&&"object"==typeof define.amd&&define.amd?(t.Rx=w,define(function(){return w})):(m?"object"==typeof module&&module&&module.exports==m?module.exports=w:m=w:t.Rx=w,e)})(this);
(function(t,e){function n(){}function r(t){return t}function i(){return(new Date).getTime()}function o(t,e){return F(t,e)}function s(t,e){return t-e}function u(t){return""+t}function c(t){throw t}function a(){if(this.isDisposed)throw Error(_)}function h(t){return"function"!=typeof t.toString&&"string"==typeof(t+"")}function l(t){return t&&"object"==typeof t?M.call(t)==O:!1}function f(t){return"function"==typeof t}function p(t,e,n,r){var i;if(t===e)return 0!==t||1/t==1/e;var o=typeof t,s=typeof e;if(!(t!==t||t&&N[o]||e&&N[s]))return!1;if(null==t||null==e)return t===e;var u=M.call(t),c=M.call(e);if(u==O&&(u=T),c==O&&(c=T),u!=c)return!1;switch(u){case W:case k:return+t==+e;case q:return t!=+t?e!=+e:0==t?1/t==1/e:t==+e;case I:case P:return t==e+""}var a=u==R;if(!a){if(u!=T||!C&&(h(t)||h(e)))return!1;var d=!V&&l(t)?Object:t.constructor,b=!V&&l(e)?Object:e.constructor;if(d!=b&&!(f(d)&&d instanceof d&&f(b)&&b instanceof b))return!1}for(var v=n.length;v--;)if(n[v]==t)return r[v]==e;var m=0;if(i=!0,n.push(t),r.push(e),a){for(v=t.length,m=e.length,i=m==t.length;m--;){var y=e[m];if(!(i=p(t[m],y,n,r)))break}return i}for(var w in e)if(L.call(e,w))return m++,i=L.call(t,w)&&p(t[w],e[w],n,r);if(i)for(var w in t)if(L.call(t,w))return i=--m>-1;return n.pop(),r.pop(),i}function d(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:B.call(t)}function b(t,e){for(var n=Array(t),r=0;t>r;r++)n[r]=e();return n}function v(t,e){this.scheduler=t,this.disposable=e,this.isDisposed=!1}function m(t,e,n,r,i){this.scheduler=t,this.state=e,this.action=n,this.dueTime=r,this.comparer=i||s,this.disposable=new re}function y(t,n){return new Ge(function(r){var i=new re,o=new oe;return o.setDisposable(i),i.setDisposable(t.subscribe(r.onNext.bind(r),function(t){var i,s;try{s=n(t)}catch(u){return r.onError(u),e}i=new re,o.setDisposable(i),i.setDisposable(s.subscribe(r))},r.onCompleted.bind(r))),o})}function w(t,n){var r=this;return new Ge(function(i){var o=0,s=t.length;return r.subscribe(function(r){if(s>o){var u,c=t[o++];try{u=n(r,c)}catch(a){return i.onError(a),e}i.onNext(u)}else i.onCompleted()},i.onError.bind(i),i.onCompleted.bind(i))})}function g(t){return this.select(t).mergeObservable()}var E="object"==typeof exports&&exports,x=("object"==typeof module&&module&&module.exports==E&&module,"object"==typeof global&&global);x.global===x&&(t=x);var C,D={Internals:{}},A="Sequence contains no elements.",S="Argument out of range",_="Object has been disposed",N={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},O="[object Arguments]",R="[object Array]",W="[object Boolean]",k="[object Date]",j="[object Function]",q="[object Number]",T="[object Object]",I="[object RegExp]",P="[object String]",M=Object.prototype.toString,L=Object.prototype.hasOwnProperty,V=M.call(arguments)==O;try{C=!(M.call(document)==T&&!({toString:0}+""))}catch(z){C=!0}V||(l=function(t){return t&&"object"==typeof t?L.call(t,"callee"):!1}),f(/x/)&&(f=function(t){return"function"==typeof t&&M.call(t)==j});var F=D.Internals.isEqual=function(t,e){return p(t,e,[],[])},B=Array.prototype.slice;({}).hasOwnProperty;var H=this.inherits=D.Internals.inherits=function(t,e){function n(){this.constructor=t}n.prototype=e.prototype,t.prototype=new n},U=D.Internals.addProperties=function(t){for(var e=B.call(arguments,1),n=0,r=e.length;r>n;n++){var i=e[n];for(var o in i)t[o]=i[o]}},G=D.Internals.addRef=function(t,e){return new Ge(function(n){return new Z(e.getDisposable(),t.subscribe(n))})};Function.prototype.bind||(Function.prototype.bind=function(t){var e=this,n=B.call(arguments,1),r=function(){function i(){}if(this instanceof r){i.prototype=e.prototype;var o=new i,s=e.apply(o,n.concat(B.call(arguments)));return Object(s)===s?s:o}return e.apply(t,n.concat(B.call(arguments)))};return r});var J=Object("a"),K="a"!=J[0]||!(0 in J);Array.prototype.every||(Array.prototype.every=function(t){var e=Object(this),n=K&&"[object String]"=={}.toString.call(this)?this.split(""):e,r=n.length>>>0,i=arguments[1];if("[object Function]"!={}.toString.call(t))throw new TypeError(t+" is not a function");for(var o=0;r>o;o++)if(o in n&&!t.call(i,n[o],o,e))return!1;return!0}),Array.prototype.map||(Array.prototype.map=function(t){var e=Object(this),n=K&&"[object String]"=={}.toString.call(this)?this.split(""):e,r=n.length>>>0,i=Array(r),o=arguments[1];if("[object Function]"!={}.toString.call(t))throw new TypeError(t+" is not a function");for(var s=0;r>s;s++)s in n&&(i[s]=t.call(o,n[s],s,e));return i}),Array.prototype.filter||(Array.prototype.filter=function(t){for(var e,n=[],r=Object(this),i=0,o=r.length>>>0;o>i;i++)e=r[i],i in r&&t.call(arguments[1],e,i,r)&&n.push(e);return n}),Array.isArray||(Array.isArray=function(t){return"[object Array]"==Object.prototype.toString.call(t)}),Array.prototype.indexOf||(Array.prototype.indexOf=function(t){var e=Object(this),n=e.length>>>0;if(0===n)return-1;var r=0;if(arguments.length>1&&(r=Number(arguments[1]),r!==r?r=0:0!==r&&1/0!=r&&r!==-1/0&&(r=(r>0||-1)*Math.floor(Math.abs(r)))),r>=n)return-1;for(var i=r>=0?r:Math.max(n-Math.abs(r),0);n>i;i++)if(i in e&&e[i]===t)return i;return-1});var Q=function(t,e){this.id=t,this.value=e};Q.prototype.compareTo=function(t){var e=this.value.compareTo(t.value);return 0===e&&(e=this.id-t.id),e};var X=function(t){this.items=Array(t),this.length=0},Y=X.prototype;Y.isHigherPriority=function(t,e){return 0>this.items[t].compareTo(this.items[e])},Y.percolate=function(t){if(!(t>=this.length||0>t)){var e=t-1>>1;if(!(0>e||e===t)&&this.isHigherPriority(t,e)){var n=this.items[t];this.items[t]=this.items[e],this.items[e]=n,this.percolate(e)}}},Y.heapify=function(t){if(t===e&&(t=0),!(t>=this.length||0>t)){var n=2*t+1,r=2*t+2,i=t;if(this.length>n&&this.isHigherPriority(n,i)&&(i=n),this.length>r&&this.isHigherPriority(r,i)&&(i=r),i!==t){var o=this.items[t];this.items[t]=this.items[i],this.items[i]=o,this.heapify(i)}}},Y.peek=function(){return this.items[0].value},Y.removeAt=function(t){this.items[t]=this.items[--this.length],delete this.items[this.length],this.heapify()},Y.dequeue=function(){var t=this.peek();return this.removeAt(0),t},Y.enqueue=function(t){var e=this.length++;this.items[e]=new Q(X.count++,t),this.percolate(e)},Y.remove=function(t){for(var e=0;this.length>e;e++)if(this.items[e].value===t)return this.removeAt(e),!0;return!1},X.count=0;var Z=D.CompositeDisposable=function(){this.disposables=d(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},$=Z.prototype;$.add=function(t){this.isDisposed?t.dispose():(this.disposables.push(t),this.length++)},$.remove=function(t){var e=!1;if(!this.isDisposed){var n=this.disposables.indexOf(t);-1!==n&&(e=!0,this.disposables.splice(n,1),this.length--,t.dispose())}return e},$.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()}},$.clear=function(){var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()},$.contains=function(t){return-1!==this.disposables.indexOf(t)},$.toArray=function(){return this.disposables.slice(0)};var te=D.Disposable=function(t){this.isDisposed=!1,this.action=t||n};te.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var ee=te.create=function(t){return new te(t)},ne=te.empty={dispose:n},re=D.SingleAssignmentDisposable=function(){this.isDisposed=!1,this.current=null},ie=re.prototype;ie.disposable=function(t){return t?this.setDisposable(t):this.getDisposable()},ie.getDisposable=function(){return this.current},ie.setDisposable=function(t){if(this.current)throw Error("Disposable has already been assigned");var e=this.isDisposed;e||(this.current=t),e&&t&&t.dispose()},ie.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()};var oe=D.SerialDisposable=function(){this.isDisposed=!1,this.current=null};oe.prototype.getDisposable=function(){return this.current},oe.prototype.setDisposable=function(t){var e,n=this.isDisposed;n||(e=this.current,this.current=t),e&&e.dispose(),n&&t&&t.dispose()},oe.prototype.disposable=function(t){return t?(this.setDisposable(t),e):this.getDisposable()},oe.prototype.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()};var se=D.RefCountDisposable=function(){function t(t){this.disposable=t,this.disposable.count++,this.isInnerDisposed=!1}function e(t){this.underlyingDisposable=t,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return t.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},e.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},e.prototype.getDisposable=function(){return this.isDisposed?ne:new t(this)},e}();v.prototype.dispose=function(){var t=this;this.scheduler.schedule(function(){t.isDisposed||(t.isDisposed=!0,t.disposable.dispose())})},m.prototype.invoke=function(){this.disposable.disposable(this.invokeCore())},m.prototype.compareTo=function(t){return this.comparer(this.dueTime,t.dueTime)},m.prototype.isCancelled=function(){return this.disposable.isDisposed},m.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var ue=D.Scheduler=function(){function e(t,e,n,r){this.now=t,this._schedule=e,this._scheduleRelative=n,this._scheduleAbsolute=r}function n(t,e){var n=e.first,r=e.second,i=new Z,o=function(e){r(e,function(e){var n=!1,r=!1,s=t.scheduleWithState(e,function(t,e){return n?i.remove(s):r=!0,o(e),ne});r||(i.add(s),n=!0)})};return o(n),i}function r(t,e,n){var r=e.first,i=e.second,o=new Z,s=function(e){i(e,function(e,r){var i=!1,u=!1,c=t[n].call(t,e,r,function(t,e){return i?o.remove(c):u=!0,s(e),ne});u||(o.add(c),i=!0)})};return s(r),o}function o(t,e){return e(),ne}var s=e.prototype;return s.catchException=function(t){return new be(this,t)},s.schedulePeriodic=function(t,e){return this.schedulePeriodicWithState(null,t,function(){e()})},s.schedulePeriodicWithState=function(e,n,r){var i=e,o=t.setInterval(function(){i=r(i)},n);return ee(function(){t.clearInterval(o)})},s.schedule=function(t){return this._schedule(t,o)},s.scheduleWithState=function(t,e){return this._schedule(t,e)},s.scheduleWithRelative=function(t,e){return this._scheduleRelative(e,t,o)},s.scheduleWithRelativeAndState=function(t,e,n){return this._scheduleRelative(t,e,n)},s.scheduleWithAbsolute=function(t,e){return this._scheduleAbsolute(e,t,o)},s.scheduleWithAbsoluteAndState=function(t,e,n){return this._scheduleAbsolute(t,e,n)},s.scheduleRecursive=function(t){return this.scheduleRecursiveWithState(t,function(t,e){t(function(){e(t)})})},s.scheduleRecursiveWithState=function(t,e){return this.scheduleWithState({first:t,second:e},function(t,e){return n(t,e)})},s.scheduleRecursiveWithRelative=function(t,e){return this.scheduleRecursiveWithRelativeAndState(e,t,function(t,e){t(function(n){e(t,n)})})},s.scheduleRecursiveWithRelativeAndState=function(t,e,n){return this._scheduleRelative({first:t,second:n},e,function(t,e){return r(t,e,"scheduleWithRelativeAndState")})},s.scheduleRecursiveWithAbsolute=function(t,e){return this.scheduleRecursiveWithAbsoluteAndState(e,t,function(t,e){t(function(n){e(t,n)})})},s.scheduleRecursiveWithAbsoluteAndState=function(t,e,n){return this._scheduleAbsolute({first:t,second:n},e,function(t,e){return r(t,e,"scheduleWithAbsoluteAndState")})},e.now=i,e.normalize=function(t){return 0>t&&(t=0),t},e}(),ce="Scheduler is not allowed to block the thread",ae=ue.immediate=function(){function t(t,e){return e(this,t)}function e(t,e,n){if(e>0)throw Error(ce);return n(this,t)}function n(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new ue(i,t,e,n)}(),he=ue.currentThread=function(){function t(){o=new X(4)}function e(t,e){return this.scheduleWithRelativeAndState(t,0,e)}function n(e,n,r){var i,s=this.now()+ue.normalize(n),u=new m(this,e,r,s);if(o)o.enqueue(u);else{i=new t;try{o.enqueue(u),i.run()}catch(c){throw c}finally{i.dispose()}}return u.disposable}function r(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}var o;t.prototype.dispose=function(){o=null},t.prototype.run=function(){for(var t;o.length>0;)if(t=o.dequeue(),!t.isCancelled()){for(;t.dueTime-ue.now()>0;);t.isCancelled()||t.invoke()}};var s=new ue(i,e,n,r);return s.scheduleRequired=function(){return null===o},s.ensureTrampoline=function(t){return null===o?this.schedule(t):t()},s}(),le=function(){function t(t,e){e(0,this._period);try{this._state=this._action(this._state)}catch(n){throw this._cancel.dispose(),n}}function e(t,e,n,r){this._scheduler=t,this._state=e,this._period=n,this._action=r}return e.prototype.start=function(){var e=new re;return this._cancel=e,e.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,t.bind(this))),e},e}();D.VirtualTimeScheduler=function(t){function n(){return this.toDateTimeOffset(this.clock)}function r(t,e){return this.scheduleAbsoluteWithState(t,this.clock,e)}function i(t,e,n){return this.scheduleRelativeWithState(t,this.toRelative(e),n)}function o(t,e,n){return this.scheduleRelativeWithState(t,this.toRelative(e-this.now()),n)}function s(t,e){return e(),ne}function u(e,s){this.clock=e,this.comparer=s,this.isEnabled=!1,this.queue=new X(1024),t.call(this,n,r,i,o)}H(u,t);var c=u.prototype;return c.schedulePeriodicWithState=function(t,e,n){var r=new le(this,t,e,n);return r.start()},c.scheduleRelativeWithState=function(t,e,n){var r=this.add(this.clock,e);return this.scheduleAbsoluteWithState(t,r,n)},c.scheduleRelative=function(t,e){return this.scheduleRelativeWithState(e,t,s)},c.start=function(){var t;if(!this.isEnabled){this.isEnabled=!0;do t=this.getNext(),null!==t?(this.comparer(t.dueTime,this.clock)>0&&(this.clock=t.dueTime),t.invoke()):this.isEnabled=!1;while(this.isEnabled)}},c.stop=function(){this.isEnabled=!1},c.advanceTo=function(t){var e,n=this.comparer(this.clock,t);if(this.comparer(this.clock,t)>0)throw Error(S);if(0!==n&&!this.isEnabled){this.isEnabled=!0;do e=this.getNext(),null!==e&&0>=this.comparer(e.dueTime,t)?(this.comparer(e.dueTime,this.clock)>0&&(this.clock=e.dueTime),e.invoke()):this.isEnabled=!1;while(this.isEnabled);this.clock=t}},c.advanceBy=function(t){var n=this.add(this.clock,t),r=this.comparer(this.clock,n);if(r>0)throw Error(S);return 0!==r?this.advanceTo(n):e},c.sleep=function(t){var e=this.add(this.clock,t);if(this.comparer(this.clock,e)>=0)throw Error(S);this.clock=e},c.getNext=function(){for(var t;this.queue.length>0;){if(t=this.queue.peek(),!t.isCancelled())return t;this.queue.dequeue()}return null},c.scheduleAbsolute=function(t,e){return this.scheduleAbsoluteWithState(e,t,s)},c.scheduleAbsoluteWithState=function(t,e,n){var r=this,i=function(t,e){return r.queue.remove(o),n(t,e)},o=new m(r,t,i,e,r.comparer);return r.queue.enqueue(o),o.disposable},u}(ue),D.HistoricalScheduler=function(t){function e(e,n){var r=null==e?0:e,i=n||s;t.call(this,r,i)}H(e,t);var n=e.prototype;return n.add=function(t,e){return t+e},n.toDateTimeOffset=function(t){return new Date(t).getTime()},n.toRelative=function(t){return t},e}(D.VirtualTimeScheduler);var fe,pe=n;(function(){function e(){if(!t.postMessage||t.importScripts)return!1;var e=!1,n=t.onmessage;return t.onmessage=function(){e=!0},t.postMessage("","*"),t.onmessage=n,e}function n(t){if("string"==typeof t.data&&t.data.substring(0,r.length)===r){var e=t.data.substring(r.length),n=i[e];n(),delete i[e]}}if("object"==typeof t.process&&"[object process]"===Object.prototype.toString.call(t.process))fe=t.process.nextTick;else if("function"==typeof t.setImmediate)fe=t.setImmediate,pe=t.clearImmediate;else if(e()){var r="ms.rx.schedule"+Math.random(),i={},o=0;t.addEventListener?t.addEventListener("message",n,!1):t.attachEvent("onmessage",n,!1),fe=function(e){var n=o++;i[n]=e,t.postMessage(r+n,"*")}}else if(t.MessageChannel){var s=new t.MessageChannel,u={},c=0;s.port1.onmessage=function(t){var e=t.data,n=u[e];n(),delete u[e]},fe=function(t){var e=c++;u[e]=t,s.port2.postMessage(e)}}else"document"in t&&"onreadystatechange"in t.document.createElement("script")?fe=function(e){var n=t.document.createElement("script");n.onreadystatechange=function(){e(),n.onreadystatechange=null,n.parentNode.removeChild(n),n=null},t.document.documentElement.appendChild(n)}:(fe=function(e){return t.setTimeout(e,0)},pe=t.clearTimeout)})();var de=ue.timeout=function(){function e(t,e){var n=this,r=new re,i=fe(function(){r.isDisposed||r.setDisposable(e(n,t))});return new Z(r,ee(function(){pe(i)}))}function n(e,n,r){var i=this,o=ue.normalize(n);if(0===o)return i.scheduleWithState(e,r);var s=new re,u=t.setTimeout(function(){s.isDisposed||s.setDisposable(r(i,e))},o);return new Z(s,ee(function(){t.clearTimeout(u)}))}function r(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new ue(i,e,n,r)}(),be=function(t){function e(){return this._scheduler.now()}function n(t,e){return this._scheduler.scheduleWithState(t,this._wrap(e))}function r(t,e,n){return this._scheduler.scheduleWithRelativeAndState(t,e,this._wrap(n))}function i(t,e,n){return this._scheduler.scheduleWithAbsoluteAndState(t,e,this._wrap(n))}function o(o,s){this._scheduler=o,this._handler=s,this._recursiveOriginal=null,this._recursiveWrapper=null,t.call(this,e,n,r,i)}return H(o,t),o.prototype._clone=function(t){return new o(t,this._handler)},o.prototype._wrap=function(t){var e=this;return function(n,r){try{return t(e._getRecursiveWrapper(n),r)}catch(i){if(!e._handler(i))throw i;return ne}}},o.prototype._getRecursiveWrapper=function(t){if(this._recursiveOriginal!==t){this._recursiveOriginal=t;var e=this._clone(t);e._recursiveOriginal=t,e._recursiveWrapper=e,this._recursiveWrapper=e}return this._recursiveWrapper},o.prototype.schedulePeriodicWithState=function(t,e,n){var r=this,i=!1,o=new re;return o.setDisposable(this._scheduler.schedulePeriodicWithState(t,e,function(t){if(i)return null;try{return n(t)}catch(e){if(i=!0,!r._handler(e))throw e;return o.dispose(),null}})),o},o}(ue),ve=D.Notification=function(){function t(t,e){this.hasValue=null==e?!1:e,this.kind=t}var e=t.prototype;return e.accept=function(t,e,n){return 1===arguments.length&&"object"==typeof t?this._acceptObservable(t):this._accept(t,e,n)},e.toObservable=function(t){var e=this;return t=t||ae,new Ge(function(n){return t.schedule(function(){e._acceptObservable(n),"N"===e.kind&&n.onCompleted()})})},t}(),me=ve.createOnNext=function(){function t(t){return t(this.value)}function e(t){return t.onNext(this.value)}function n(){return"OnNext("+this.value+")"}return function(r){var i=new ve("N",!0);return i.value=r,i._accept=t.bind(i),i._acceptObservable=e.bind(i),i.toString=n.bind(i),i}}(),ye=ve.createOnError=function(){function t(t,e){return e(this.exception)}function e(t){return t.onError(this.exception)}function n(){return"OnError("+this.exception+")"}return function(r){var i=new ve("E");return i.exception=r,i._accept=t.bind(i),i._acceptObservable=e.bind(i),i.toString=n.bind(i),i}}(),we=ve.createOnCompleted=function(){function t(t,e,n){return n()}function e(t){return t.onCompleted()}function n(){return"OnCompleted()"}return function(){var r=new ve("C");return r._accept=t.bind(r),r._acceptObservable=e.bind(r),r.toString=n.bind(r),r}}(),ge=D.Internals.Enumerator=function(t,e,n){this.moveNext=t,this.getCurrent=e,this.dispose=n},Ee=ge.create=function(t,e,r){var i=!1;return r||(r=n),new ge(function(){if(i)return!1;var e=t();return e||(i=!0,r()),e},function(){return e()},function(){i||(r(),i=!0)})},xe=D.Internals.Enumerable=function(){function t(t){this.getEnumerator=t}return t.prototype.concat=function(){var t=this;return new Ge(function(n){var r=t.getEnumerator(),i=!1,o=new oe,s=ae.scheduleRecursive(function(t){var s,u,c=!1;if(!i){try{c=r.moveNext(),c?s=r.getCurrent():r.dispose()}catch(a){u=a,r.dispose()}if(u)return n.onError(u),e;if(!c)return n.onCompleted(),e;var h=new re;o.setDisposable(h),h.setDisposable(s.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){t()}))}});return new Z(o,s,ee(function(){i=!0,r.dispose()}))})},t.prototype.catchException=function(){var t=this;return new Ge(function(n){var r,i=t.getEnumerator(),o=!1,s=new oe,u=ae.scheduleRecursive(function(t){var u,c,a;if(a=!1,!o){try{a=i.moveNext(),a&&(u=i.getCurrent())}catch(h){c=h}if(c)return n.onError(c),e;if(!a)return r?n.onError(r):n.onCompleted(),e;var l=new re;s.setDisposable(l),l.setDisposable(u.subscribe(n.onNext.bind(n),function(e){r=e,t()},n.onCompleted.bind(n)))}});return new Z(s,u,ee(function(){o=!0}))})},t}(),Ce=xe.repeat=function(t,n){return n===e&&(n=-1),new xe(function(){var e,r=n;return Ee(function(){return 0===r?!1:(r>0&&r--,e=t,!0)},function(){return e})})},De=xe.forEach=function(t,e){return e||(e=r),new xe(function(){var n,r=-1;return Ee(function(){return++r<t.length?(n=e(t[r],r),!0):!1},function(){return n})})},Ae=D.Observer=function(){};Ae.prototype.toNotifier=function(){var t=this;return function(e){return e.accept(t)}},Ae.prototype.asObserver=function(){return new Oe(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},Ae.prototype.checked=function(){return new Re(this)};var Se=Ae.create=function(t,e,r){return t||(t=n),e||(e=c),r||(r=n),new Oe(t,e,r)};Ae.fromNotifier=function(t){return new Oe(function(e){return t(me(e))},function(e){return t(ye(e))},function(){return t(we())})};var _e,Ne=D.Internals.AbstractObserver=function(t){function e(){this.isStopped=!1,t.call(this)}return H(e,t),e.prototype.onNext=function(t){this.isStopped||this.next(t)},e.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.error(t))},e.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},e.prototype.dispose=function(){this.isStopped=!0},e.prototype.fail=function(){return this.isStopped?!1:(this.isStopped=!0,this.error(!0),!0)},e}(Ae),Oe=D.AnonymousObserver=function(t){function e(e,n,r){t.call(this),this._onNext=e,this._onError=n,this._onCompleted=r}return H(e,t),e.prototype.next=function(t){this._onNext(t)},e.prototype.error=function(t){this._onError(t)},e.prototype.completed=function(){this._onCompleted()},e}(Ne),Re=function(t){function e(e){t.call(this),this._observer=e,this._state=0}H(e,t);var n=e.prototype;return n.onNext=function(t){this.checkAccess();try{this._observer.onNext(t)}catch(e){throw e}finally{this._state=0}},n.onError=function(t){this.checkAccess();try{this._observer.onError(t)}catch(e){throw e}finally{this._state=2}},n.onCompleted=function(){this.checkAccess();try{this._observer.onCompleted()}catch(t){throw t}finally{this._state=2}},n.checkAccess=function(){if(1===this._state)throw Error("Re-entrancy detected");if(2===this._state)throw Error("Observer completed");0===this._state&&(this._state=1)},e}(Ae),We=D.Internals.ScheduledObserver=function(t){function n(e,n){t.call(this),this.scheduler=e,this.observer=n,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new oe}return H(n,t),n.prototype.next=function(t){var e=this;this.queue.push(function(){e.observer.onNext(t)})},n.prototype.error=function(t){var e=this;this.queue.push(function(){e.observer.onError(t)})},n.prototype.completed=function(){var t=this;this.queue.push(function(){t.observer.onCompleted()})},n.prototype.ensureActive=function(){var t=!1,n=this;!this.hasFaulted&&this.queue.length>0&&(t=!this.isAcquired,this.isAcquired=!0),t&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(t){var r;if(!(n.queue.length>0))return n.isAcquired=!1,e;r=n.queue.shift();try{r()}catch(i){throw n.queue=[],n.hasFaulted=!0,i}t()}))},n.prototype.dispose=function(){t.prototype.dispose.call(this),this.disposable.dispose()},n}(Ne),ke=function(t){function e(){t.apply(this,arguments)}return H(e,t),e.prototype.next=function(e){t.prototype.next.call(this,e),this.ensureActive()},e.prototype.error=function(e){t.prototype.error.call(this,e),this.ensureActive()},e.prototype.completed=function(){t.prototype.completed.call(this),this.ensureActive()},e}(We),je=D.Observable=function(){function t(t){this._subscribe=t}return _e=t.prototype,_e.finalValue=function(){var t=this;return new Ge(function(e){var n,r=!1;return t.subscribe(function(t){r=!0,n=t},e.onError.bind(e),function(){r?(e.onNext(n),e.onCompleted()):e.onError(Error(A))})})},_e.subscribe=_e.forEach=function(t,e,n){var r;return r="object"==typeof t?t:Se(t,e,n),this._subscribe(r)},_e.toArray=function(){function t(t,e){var n=t.slice(0);return n.push(e),n}return this.scan([],t).startWith([]).finalValue()},t}();je.start=function(t,e){return qe(t,e)()};var qe=je.toAsync=function(t,n,r){return n||(n=de),function(){var i=B.call(arguments,0),o=new Ye;return n.schedule(function(){var n;try{n=t.apply(r,i)}catch(s){return o.onError(s),e}o.onNext(n),o.onCompleted()}),o.asObservable()}};_e.observeOn=function(t){var e=this;return new Ge(function(n){return e.subscribe(new ke(t,n))})},_e.subscribeOn=function(t){var e=this;return new Ge(function(n){var r=new re,i=new oe;return i.setDisposable(r),r.setDisposable(t.schedule(function(){i.setDisposable(new v(t,e.subscribe(n)))})),i})},je.create=function(t){return new Ge(function(e){return ee(t(e))})},je.createWithDisposable=function(t){return new Ge(t)};var Te=je.defer=function(t){return new Ge(function(e){var n;try{n=t()}catch(r){return Ve(r).subscribe(e)}return n.subscribe(e)})},Ie=je.empty=function(t){return t||(t=ae),new Ge(function(e){return t.schedule(function(){e.onCompleted()})})},Pe=je.fromArray=function(t,e){return e||(e=he),new Ge(function(n){var r=0;return e.scheduleRecursive(function(e){t.length>r?(n.onNext(t[r++]),e()):n.onCompleted()})})};je.generate=function(t,n,r,i,o){return o||(o=he),new Ge(function(s){var u=!0,c=t;return o.scheduleRecursive(function(t){var o,a;try{u?u=!1:c=r(c),o=n(c),o&&(a=i(c))}catch(h){return s.onError(h),e}o?(s.onNext(a),t()):s.onCompleted()})})};var Me=je.never=function(){return new Ge(function(){return ne})};je.range=function(t,e,n){return n||(n=he),new Ge(function(r){return n.scheduleRecursiveWithState(0,function(n,i){e>n?(r.onNext(t+n),i(n+1)):r.onCompleted()})})},je.repeat=function(t,e,n){return n||(n=he),null==e&&(e=-1),Le(t,n).repeat(e)};var Le=je["return"]=je.returnValue=function(t,e){return e||(e=ae),new Ge(function(n){return e.schedule(function(){n.onNext(t),n.onCompleted()})})},Ve=je["throw"]=je.throwException=function(t,e){return e||(e=ae),new Ge(function(n){return e.schedule(function(){n.onError(t)})})};je.using=function(t,e){return new Ge(function(n){var r,i,o=ne;try{r=t(),r&&(o=r),i=e(r)}catch(s){return new Z(Ve(s).subscribe(n),o)}return new Z(i.subscribe(n),o)})},_e.amb=function(t){var e=this;return new Ge(function(n){function r(){o||(o=s,a.dispose())}function i(){o||(o=u,c.dispose())}var o,s="L",u="R",c=new re,a=new re;return c.setDisposable(e.subscribe(function(t){r(),o===s&&n.onNext(t)},function(t){r(),o===s&&n.onError(t)},function(){r(),o===s&&n.onCompleted()})),a.setDisposable(t.subscribe(function(t){i(),o===u&&n.onNext(t)},function(t){i(),o===u&&n.onError(t)},function(){i(),o===u&&n.onCompleted()})),new Z(c,a)})},je.amb=function(){function t(t,e){return t.amb(e)}for(var e=Me(),n=d(arguments,0),r=0,i=n.length;i>r;r++)e=t(e,n[r]);return e},_e.catchException=function(t){return"function"==typeof t?y(this,t):ze([this,t])};var ze=je.catchException=function(){var t=d(arguments,0);return De(t).catchException()};_e.combineLatest=function(){var t=B.call(arguments);return Array.isArray(t[0])?t[0].unshift(this):t.unshift(this),Fe.apply(this,t)};var Fe=je.combineLatest=function(){var t=B.call(arguments),n=t.pop();return Array.isArray(t[0])&&(t=t[0]),new Ge(function(r){function i(t){var i;if(c[t]=!0,a||(a=c.every(function(t){return t}))){try{i=n.apply(null,l)}catch(o){return r.onError(o),e}r.onNext(i)}else h.filter(function(e,n){return n!==t}).every(function(t){return t})&&r.onCompleted()}function o(t){h[t]=!0,h.every(function(t){return t})&&r.onCompleted()}for(var s=function(){return!1},u=t.length,c=b(u,s),a=!1,h=b(u,s),l=Array(u),f=Array(u),p=0;u>p;p++)(function(e){f[e]=new re,f[e].setDisposable(t[e].subscribe(function(t){l[e]=t,i(e)},r.onError.bind(r),function(){o(e)}))})(p);return new Z(f)})};_e.concat=function(){var t=B.call(arguments,0);return t.unshift(this),Be.apply(this,t)};var Be=je.concat=function(){var t=d(arguments,0);return De(t).concat()};_e.concatObservable=_e.concatAll=function(){return this.merge(1)},_e.merge=function(t){if("number"!=typeof t)return He(this,t);var e=this;return new Ge(function(n){var r=0,i=new Z,o=!1,s=[],u=function(t){var e=new re;i.add(e),e.setDisposable(t.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){var t;i.remove(e),s.length>0?(t=s.shift(),u(t)):(r--,o&&0===r&&n.onCompleted())}))};return i.add(e.subscribe(function(e){t>r?(r++,u(e)):s.push(e)},n.onError.bind(n),function(){o=!0,0===r&&n.onCompleted()})),i})};var He=je.merge=function(){var t,e;return arguments[0]?arguments[0].now?(t=arguments[0],e=B.call(arguments,1)):(t=ae,e=B.call(arguments,0)):(t=ae,e=B.call(arguments,1)),Array.isArray(e[0])&&(e=e[0]),Pe(e,t).mergeObservable()};_e.mergeObservable=_e.mergeAll=function(){var t=this;return new Ge(function(e){var n=new Z,r=!1,i=new re;return n.add(i),i.setDisposable(t.subscribe(function(t){var i=new re;n.add(i),i.setDisposable(t.subscribe(function(t){e.onNext(t)},e.onError.bind(e),function(){n.remove(i),r&&1===n.length&&e.onCompleted()}))},e.onError.bind(e),function(){r=!0,1===n.length&&e.onCompleted()})),n})},_e.onErrorResumeNext=function(t){if(!t)throw Error("Second observable is required");return Ue([this,t])};var Ue=je.onErrorResumeNext=function(){var t=d(arguments,0);return new Ge(function(e){var n=0,r=new oe,i=ae.scheduleRecursive(function(i){var o,s;t.length>n?(o=t[n++],s=new re,r.setDisposable(s),s.setDisposable(o.subscribe(e.onNext.bind(e),function(){i()},function(){i()}))):e.onCompleted()});return new Z(r,i)})};_e.skipUntil=function(t){var e=this;return new Ge(function(n){var r=!1,i=new Z(e.subscribe(function(t){r&&n.onNext(t)},n.onError.bind(n),function(){r&&n.onCompleted()})),o=new re;return i.add(o),o.setDisposable(t.subscribe(function(){r=!0,o.dispose()},n.onError.bind(n),function(){o.dispose()})),i})},_e.switchLatest=function(){var t=this;return new Ge(function(e){var n=!1,r=new oe,i=!1,o=0,s=t.subscribe(function(t){var s=new re,u=++o;n=!0,r.setDisposable(s),s.setDisposable(t.subscribe(function(t){o===u&&e.onNext(t)},function(t){o===u&&e.onError(t)},function(){o===u&&(n=!1,i&&e.onCompleted())}))},e.onError.bind(e),function(){i=!0,n||e.onCompleted()});return new Z(s,r)})},_e.takeUntil=function(t){var e=this;return new Ge(function(r){return new Z(e.subscribe(r),t.subscribe(r.onCompleted.bind(r),r.onError.bind(r),n))})},_e.zip=function(){if(Array.isArray(arguments[0]))return w.apply(this,arguments);var t=this,n=B.call(arguments),i=n.pop();return n.unshift(t),new Ge(function(o){function s(t){a[t]=!0,a.every(function(t){return t})&&o.onCompleted()}for(var u=n.length,c=b(u,function(){return[]}),a=b(u,function(){return!1}),h=function(n){var s,u;if(c.every(function(t){return t.length>0})){try{u=c.map(function(t){return t.shift()}),s=i.apply(t,u)}catch(h){return o.onError(h),e}o.onNext(s)}else a.filter(function(t,e){return e!==n}).every(r)&&o.onCompleted()},l=Array(u),f=0;u>f;f++)(function(t){l[t]=new re,l[t].setDisposable(n[t].subscribe(function(e){c[t].push(e),h(t)},o.onError.bind(o),function(){s(t)}))})(f);return new Z(l)})},je.zip=function(){var t=B.call(arguments,0),e=t.shift();return e.zip.apply(e,t)},je.zipArray=function(){var t=B.call(arguments);return new Ge(function(n){function i(t){if(u.every(function(t){return t.length>0})){var i=u.map(function(t){return t.shift()});n.onNext(i)}else if(c.filter(function(e,n){return n!==t}).every(r))return n.onCompleted(),e
}function o(t){return c[t]=!0,c.every(r)?(n.onCompleted(),e):e}for(var s=t.length,u=b(s,function(){return[]}),c=b(s,function(){return!1}),a=Array(s),h=0;s>h;h++)(function(e){a[e]=new re,a[e].setDisposable(t[e].subscribe(function(t){u[e].push(t),i(e)},n.onError.bind(n),function(){o(e)}))})(h);var l=new Z(a);return l.add(ee(function(){for(var t=0,e=u.length;e>t;t++)u[t]=[]})),l})},_e.asObservable=function(){var t=this;return new Ge(function(e){return t.subscribe(e)})},_e.bufferWithCount=function(t,n){return n===e&&(n=t),this.windowWithCount(t,n).selectMany(function(t){return t.toArray()}).where(function(t){return t.length>0})},_e.dematerialize=function(){var t=this;return new Ge(function(e){return t.subscribe(function(t){return t.accept(e)},e.onError.bind(e),e.onCompleted.bind(e))})},_e.distinctUntilChanged=function(t,n){var i=this;return t||(t=r),n||(n=o),new Ge(function(r){var o,s=!1;return i.subscribe(function(i){var u,c=!1;try{u=t(i)}catch(a){return r.onError(a),e}if(s)try{c=n(o,u)}catch(a){return r.onError(a),e}s&&c||(s=!0,o=u,r.onNext(i))},r.onError.bind(r),r.onCompleted.bind(r))})},_e.doAction=function(t,e,n){var r,i=this;return"function"==typeof t?r=t:(r=t.onNext.bind(t),e=t.onError.bind(t),n=t.onCompleted.bind(t)),new Ge(function(t){return i.subscribe(function(e){try{r(e)}catch(n){t.onError(n)}t.onNext(e)},function(n){if(e){try{e(n)}catch(r){t.onError(r)}t.onError(n)}else t.onError(n)},function(){if(n){try{n()}catch(e){t.onError(e)}t.onCompleted()}else t.onCompleted()})})},_e.finallyAction=function(t){var e=this;return new Ge(function(n){var r=e.subscribe(n);return ee(function(){try{r.dispose()}catch(e){throw e}finally{t()}})})},_e.ignoreElements=function(){var t=this;return new Ge(function(e){return t.subscribe(n,e.onError.bind(e),e.onCompleted.bind(e))})},_e.materialize=function(){var t=this;return new Ge(function(e){return t.subscribe(function(t){e.onNext(me(t))},function(t){e.onNext(ye(t)),e.onCompleted()},function(){e.onNext(we()),e.onCompleted()})})},_e.repeat=function(t){return Ce(this,t).concat()},_e.retry=function(t){return Ce(this,t).catchException()},_e.scan=function(){var t,e,n=!1;2===arguments.length?(t=arguments[0],e=arguments[1],n=!0):e=arguments[0];var r=this;return Te(function(){var i,o=!1;return r.select(function(r){return o?i=e(i,r):(i=n?e(t,r):r,o=!0),i})})},_e.skipLast=function(t){var e=this;return new Ge(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&n.onNext(r.shift())},n.onError.bind(n),n.onCompleted.bind(n))})},_e.startWith=function(){var t,e,n=0;return arguments.length&&"now"in Object(arguments[0])?(e=arguments[0],n=1):e=ae,t=B.call(arguments,n),De([Pe(t,e),this]).concat()},_e.takeLast=function(t,e){return this.takeLastBuffer(t).selectMany(function(t){return Pe(t,e)})},_e.takeLastBuffer=function(t){var e=this;return new Ge(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&r.shift()},n.onError.bind(n),function(){n.onNext(r),n.onCompleted()})})},_e.windowWithCount=function(t,e){var n=this;if(0>=t)throw Error(S);if(null==e&&(e=t),0>=e)throw Error(S);return new Ge(function(r){var i=new re,o=new se(i),s=0,u=[],c=function(){var t=new Xe;u.push(t),r.onNext(G(t,o))};return c(),i.setDisposable(n.subscribe(function(n){for(var r,i=0,o=u.length;o>i;i++)u[i].onNext(n);var a=s-t+1;a>=0&&0===a%e&&(r=u.shift(),r.onCompleted()),s++,0===s%e&&c()},function(t){for(;u.length>0;)u.shift().onError(t);r.onError(t)},function(){for(;u.length>0;)u.shift().onCompleted();r.onCompleted()})),o})},_e.defaultIfEmpty=function(t){var n=this;return t===e&&(t=null),new Ge(function(e){var r=!1;return n.subscribe(function(t){r=!0,e.onNext(t)},e.onError.bind(e),function(){r||e.onNext(t),e.onCompleted()})})},_e.distinct=function(t,n){var i=this;return t||(t=r),n||(n=u),new Ge(function(r){var o={};return i.subscribe(function(i){var s,u,c,a=!1;try{s=t(i),u=n(s)}catch(h){return r.onError(h),e}for(c in o)if(u===c){a=!0;break}a||(o[u]=null,r.onNext(i))},r.onError.bind(r),r.onCompleted.bind(r))})},_e.groupBy=function(t,e,n){return this.groupByUntil(t,e,function(){return Me()},n)},_e.groupByUntil=function(t,i,o,s){var c=this;return i||(i=r),s||(s=u),new Ge(function(r){var u={},a=new Z,h=new se(a);return a.add(c.subscribe(function(c){var l,f,p,d,b,v,m,y,w,g;try{v=t(c),m=s(v)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}d=!1;try{w=u[m],w||(w=new Xe,u[m]=w,d=!0)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}if(d){b=new Ke(v,w,h),f=new Ke(v,w);try{l=o(f)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}r.onNext(b),y=new re,a.add(y);var x=function(){m in u&&(delete u[m],w.onCompleted()),a.remove(y)};y.setDisposable(l.take(1).subscribe(n,function(t){for(g in u)u[g].onError(t);r.onError(t)},function(){x()}))}try{p=i(c)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}w.onNext(p)},function(t){for(var e in u)u[e].onError(t);r.onError(t)},function(){for(var t in u)u[t].onCompleted();r.onCompleted()})),h})},_e.select=function(t,n){var r=this;return new Ge(function(i){var o=0;return r.subscribe(function(s){var u;try{u=t.call(n,s,o++,r)}catch(c){return i.onError(c),e}i.onNext(u)},i.onError.bind(i),i.onCompleted.bind(i))})},_e.map=_e.select,_e.selectMany=_e.flatMap=function(t,e){return e?this.selectMany(function(n){return t(n).select(function(t){return e(n,t)})}):"function"==typeof t?g.call(this,t):g.call(this,function(){return t})},_e.skip=function(t){if(0>t)throw Error(S);var e=this;return new Ge(function(n){var r=t;return e.subscribe(function(t){0>=r?n.onNext(t):r--},n.onError.bind(n),n.onCompleted.bind(n))})},_e.skipWhile=function(t){var n=this;return new Ge(function(r){var i=0,o=!1;return n.subscribe(function(n){if(!o)try{o=!t(n,i++)}catch(s){return r.onError(s),e}o&&r.onNext(n)},r.onError.bind(r),r.onCompleted.bind(r))})},_e.take=function(t,e){if(0>t)throw Error(S);if(0===t)return Ie(e);var n=this;return new Ge(function(e){var r=t;return n.subscribe(function(t){r>0&&(r--,e.onNext(t),0===r&&e.onCompleted())},e.onError.bind(e),e.onCompleted.bind(e))})},_e.takeWhile=function(t){var n=this;return new Ge(function(r){var i=0,o=!0;return n.subscribe(function(n){if(o){try{o=t(n,i++)}catch(s){return r.onError(s),e}o?r.onNext(n):r.onCompleted()}},r.onError.bind(r),r.onCompleted.bind(r))})},_e.where=function(t,n){var r=this;return new Ge(function(i){var o=0;return r.subscribe(function(s){var u;try{u=t.call(n,s,o++,r)}catch(c){return i.onError(c),e}u&&i.onNext(s)},i.onError.bind(i),i.onCompleted.bind(i))})},_e.filter=_e.where;var Ge=D.Internals.AnonymousObservable=function(t){function n(r){function i(t){var e=new Je(t);if(he.scheduleRequired())he.schedule(function(){try{e.disposable(r(e))}catch(t){if(!e.fail(t))throw t}});else try{e.disposable(r(e))}catch(n){if(!e.fail(n))throw n}return e}return this instanceof n?(t.call(this,i),e):new n(r)}return H(n,t),n}(je),Je=function(t){function e(e){t.call(this),this.observer=e,this.m=new re}H(e,t);var n=e.prototype;return n.next=function(t){var e=!1;try{this.observer.onNext(t),e=!0}catch(n){throw n}finally{e||this.dispose()}},n.error=function(t){try{this.observer.onError(t)}catch(e){throw e}finally{this.dispose()}},n.completed=function(){try{this.observer.onCompleted()}catch(t){throw t}finally{this.dispose()}},n.disposable=function(t){return this.m.disposable(t)},n.dispose=function(){t.prototype.dispose.call(this),this.m.dispose()},e}(Ne),Ke=function(t){function e(t){return this.underlyingObservable.subscribe(t)}function n(n,r,i){t.call(this,e),this.key=n,this.underlyingObservable=i?new Ge(function(t){return new Z(i.getDisposable(),r.subscribe(t))}):r}return H(n,t),n}(je),Qe=function(t,e){this.subject=t,this.observer=e};Qe.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1),this.observer=null}};var Xe=D.Subject=function(t){function e(t){return a.call(this),this.isStopped?this.exception?(t.onError(this.exception),ne):(t.onCompleted(),ne):(this.observers.push(t),new Qe(this,t))}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return H(n,t),U(n.prototype,Ae,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(a.call(this),!this.isStopped){var t=this.observers.slice(0);this.isStopped=!0;for(var e=0,n=t.length;n>e;e++)t[e].onCompleted();this.observers=[]}},onError:function(t){if(a.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){if(a.call(this),!this.isStopped)for(var e=this.observers.slice(0),n=0,r=e.length;r>n;n++)e[n].onNext(t)},dispose:function(){this.isDisposed=!0,this.observers=null}}),n.create=function(t,e){return new Ze(t,e)},n}(je),Ye=D.AsyncSubject=function(t){function e(t){if(a.call(this),!this.isStopped)return this.observers.push(t),new Qe(this,t);var e=this.exception,n=this.hasValue,r=this.value;return e?t.onError(e):n?(t.onNext(r),t.onCompleted()):t.onCompleted(),ne}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return H(n,t),U(n.prototype,Ae,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){var t,e,n;if(a.call(this),!this.isStopped){var r=this.observers.slice(0);this.isStopped=!0;var i=this.value,o=this.hasValue;if(o)for(e=0,n=r.length;n>e;e++)t=r[e],t.onNext(i),t.onCompleted();else for(e=0,n=r.length;n>e;e++)r[e].onCompleted();this.observers=[]}},onError:function(t){if(a.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){a.call(this),this.isStopped||(this.value=t,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),n}(je),Ze=function(t){function e(t){return this.observable.subscribe(t)}function n(n,r){t.call(this,e),this.observer=n,this.observable=r}return H(n,t),U(n.prototype,Ae,{onCompleted:function(){this.observer.onCompleted()},onError:function(t){this.observer.onError(t)},onNext:function(t){this.observer.onNext(t)}}),n}(je);return"function"==typeof define&&"object"==typeof define.amd&&define.amd?(t.Rx=D,define(function(){return D})):(E?"object"==typeof module&&module&&module.exports==E?module.exports=D:E=D:t.Rx=D,e)})(this);

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

(function(t,e){function n(){}function r(t){return t}function i(){return(new Date).getTime()}function o(t,e){return 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(x)}function h(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:C.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 j}function d(t,n){return new De(function(r){var i=new j,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 j,o.setDisposable(i),i.setDisposable(s.subscribe(r))},r.onCompleted.bind(r))),o})}function b(t,n){var r=this;return new De(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,y=("object"==typeof module&&module&&module.exports==m&&module,"object"==typeof global&&global);y.global===y&&(t=y);var w={Internals:{}},g="Sequence contains no elements.",E="Argument out of range",x="Object has been disposed",C=Array.prototype.slice;({}).hasOwnProperty;var D=this.inherits=w.Internals.inherits=function(t,e){function n(){this.constructor=t}n.prototype=e.prototype,t.prototype=new n},A=w.Internals.addProperties=function(t){for(var e=C.call(arguments,1),n=0,r=e.length;r>n;n++){var i=e[n];for(var o in i)t[o]=i[o]}},S=w.Internals.addRef=function(t,e){return new De(function(n){return new R(e.getDisposable(),t.subscribe(n))})},_=function(t,e){this.id=t,this.value=e};_.prototype.compareTo=function(t){var e=this.value.compareTo(t.value);return 0===e&&(e=this.id-t.id),e};var N=function(t){this.items=Array(t),this.length=0},W=N.prototype;W.isHigherPriority=function(t,e){return 0>this.items[t].compareTo(this.items[e])},W.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)}}},W.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)}}},W.peek=function(){return this.items[0].value},W.removeAt=function(t){this.items[t]=this.items[--this.length],delete this.items[this.length],this.heapify()},W.dequeue=function(){var t=this.peek();return this.removeAt(0),t},W.enqueue=function(t){var e=this.length++;this.items[e]=new _(N.count++,t),this.percolate(e)},W.remove=function(t){for(var e=0;this.length>e;e++)if(this.items[e].value===t)return this.removeAt(e),!0;return!1},N.count=0;var R=w.CompositeDisposable=function(){this.disposables=h(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},O=R.prototype;O.add=function(t){this.isDisposed?t.dispose():(this.disposables.push(t),this.length++)},O.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.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.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.contains=function(t){return-1!==this.disposables.indexOf(t)},O.toArray=function(){return this.disposables.slice(0)};var k=w.Disposable=function(t){this.isDisposed=!1,this.action=t||n};k.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var q=k.create=function(t){return new k(t)},T=k.empty={dispose:n},j=w.SingleAssignmentDisposable=function(){this.isDisposed=!1,this.current=null},I=j.prototype;I.disposable=function(t){return t?this.setDisposable(t):this.getDisposable()},I.getDisposable=function(){return this.current},I.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.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()};var P=w.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 M=w.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?T: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 L=w.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 R,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),T});r||(i.add(s),n=!0)})};return o(n),i}function r(t,e,n){var r=e.first,i=e.second,o=new R,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),T});u||(o.add(c),i=!0)})};return s(r),o}function o(t,e){return e(),T}var s=e.prototype;return s.catchException=function(t){return new J(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 q(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}(),V="Scheduler is not allowed to block the thread",z=L.immediate=function(){function t(t,e){return e(this,t)}function e(t,e,n){if(e>0)throw Error(V);return n(this,t)}function n(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new L(i,t,e,n)}(),B=L.currentThread=function(){function t(){o=new N(4)}function e(t,e){return this.scheduleWithRelativeAndState(t,0,e)}function n(e,n,r){var i,s=this.now()+L.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-L.now()>0;);t.isCancelled()||t.invoke()}};var s=new L(i,e,n,r);return s.scheduleRequired=function(){return null===o},s.ensureTrampoline=function(t){return null===o?this.schedule(t):t()},s}(),F=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 j;return this._cancel=e,e.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,t.bind(this))),e},e}();w.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(),T}function u(e,s){this.clock=e,this.comparer=s,this.isEnabled=!1,this.queue=new N(1024),t.call(this,n,r,i,o)}D(u,t);var c=u.prototype;return c.schedulePeriodicWithState=function(t,e,n){var r=new F(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(E);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(E);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(E);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}(L),w.HistoricalScheduler=function(t){function e(e,n){var r=null==e?0:e,i=n||s;t.call(this,r,i)}D(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}(w.VirtualTimeScheduler);var H,U=n;(function(){function e(){if(!t.postMessage||t.importScripts)return!1;var e=!1,n=t.onmessage;return t.onmessage=function(){e=!0},t.postMessage("","*"),t.onmessage=n,e}function n(t){if("string"==typeof t.data&&t.data.substring(0,r.length)===r){var e=t.data.substring(r.length),n=i[e];n(),delete i[e]}}if("object"==typeof t.process&&"[object process]"===Object.prototype.toString.call(t.process))H=t.process.nextTick;else if("function"==typeof t.setImmediate)H=t.setImmediate,U=t.clearImmediate;else if(e()){var r="ms.rx.schedule"+Math.random(),i={},o=0;t.addEventListener?t.addEventListener("message",n,!1):t.attachEvent("onmessage",n,!1),H=function(e){var n=o++;i[n]=e,t.postMessage(r+n,"*")}}else if(t.MessageChannel){var s=new t.MessageChannel,u={},c=0;s.port1.onmessage=function(t){var e=t.data,n=u[e];n(),delete u[e]},H=function(t){var e=c++;u[e]=t,s.port2.postMessage(e)}}else"document"in t&&"onreadystatechange"in t.document.createElement("script")?H=function(e){var n=t.document.createElement("script");n.onreadystatechange=function(){e(),n.onreadystatechange=null,n.parentNode.removeChild(n),n=null},t.document.documentElement.appendChild(n)}:(H=function(e){return t.setTimeout(e,0)},U=t.clearTimeout)})();var G=L.timeout=function(){function e(t,e){var n=this,r=new j,i=H(function(){r.isDisposed||r.setDisposable(e(n,t))});return new R(r,q(function(){U(i)}))}function n(e,n,r){var i=this,o=L.normalize(n);if(0===o)return i.scheduleWithState(e,r);var s=new j,u=t.setTimeout(function(){s.isDisposed||s.setDisposable(r(i,e))},o);return new R(s,q(function(){t.clearTimeout(u)}))}function r(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new L(i,e,n,r)}(),J=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 D(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 T}}},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 j;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}(L),K=w.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||z,new De(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}(),Q=K.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 K("N",!0);return i.value=r,i._accept=t.bind(i),i._acceptObservable=e.bind(i),i.toString=n.bind(i),i}}(),X=K.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 K("E");return i.exception=r,i._accept=t.bind(i),i._acceptObservable=e.bind(i),i.toString=n.bind(i),i}}(),Y=K.createOnCompleted=function(){function t(t,e,n){return n()}function e(t){return t.onCompleted()}function n(){return"OnCompleted()"}return function(){var r=new K("C");return r._accept=t.bind(r),r._acceptObservable=e.bind(r),r.toString=n.bind(r),r}}(),Z=w.Internals.Enumerator=function(t,e,n){this.moveNext=t,this.getCurrent=e,this.dispose=n},$=Z.create=function(t,e,r){var i=!1;return r||(r=n),new Z(function(){if(i)return!1;var e=t();return e||(i=!0,r()),e},function(){return e()},function(){i||(r(),i=!0)})},te=w.Internals.Enumerable=function(){function t(t){this.getEnumerator=t}return t.prototype.concat=function(){var t=this;return new De(function(n){var r=t.getEnumerator(),i=!1,o=new P,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 j;o.setDisposable(h),h.setDisposable(s.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){t()}))}});return new R(o,s,q(function(){i=!0,r.dispose()}))})},t.prototype.catchException=function(){var t=this;return new De(function(n){var r,i=t.getEnumerator(),o=!1,s=new P,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 j;s.setDisposable(l),l.setDisposable(u.subscribe(n.onNext.bind(n),function(e){r=e,t()},n.onCompleted.bind(n)))}});return new R(s,u,q(function(){o=!0}))})},t}(),ee=te.repeat=function(t,n){return n===e&&(n=-1),new te(function(){var e,r=n;return $(function(){return 0===r?!1:(r>0&&r--,e=t,!0)},function(){return e})})},ne=te.forEach=function(t,e){return e||(e=r),new te(function(){var n,r=-1;return $(function(){return++r<t.length?(n=e(t[r],r),!0):!1},function(){return n})})},re=w.Observer=function(){};re.prototype.toNotifier=function(){var t=this;return function(e){return e.accept(t)}},re.prototype.asObserver=function(){return new ue(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},re.prototype.checked=function(){return new ce(this)};var ie=re.create=function(t,e,r){return t||(t=n),e||(e=c),r||(r=n),new ue(t,e,r)};re.fromNotifier=function(t){return new ue(function(e){return t(Q(e))},function(e){return t(X(e))},function(){return t(Y())})};var oe,se=w.Internals.AbstractObserver=function(t){function e(){this.isStopped=!1,t.call(this)}return D(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}(re),ue=w.AnonymousObserver=function(t){function e(e,n,r){t.call(this),this._onNext=e,this._onError=n,this._onCompleted=r}return D(e,t),e.prototype.next=function(t){this._onNext(t)},e.prototype.error=function(t){this._onError(t)},e.prototype.completed=function(){this._onCompleted()},e}(se),ce=function(t){function e(e){t.call(this),this._observer=e,this._state=0}D(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}(re),ae=w.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 D(n,t),n.prototype.next=function(t){var e=this;this.queue.push(function(){e.observer.onNext(t)})},n.prototype.error=function(t){var e=this;this.queue.push(function(){e.observer.onError(t)})},n.prototype.completed=function(){var t=this;this.queue.push(function(){t.observer.onCompleted()})},n.prototype.ensureActive=function(){var t=!1,n=this;!this.hasFaulted&&this.queue.length>0&&(t=!this.isAcquired,this.isAcquired=!0),t&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(t){var r;if(!(n.queue.length>0))return n.isAcquired=!1,e;r=n.queue.shift();try{r()}catch(i){throw n.queue=[],n.hasFaulted=!0,i}t()}))},n.prototype.dispose=function(){t.prototype.dispose.call(this),this.disposable.dispose()},n}(se),he=function(t){function e(){t.apply(this,arguments)}return D(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}(ae),le=w.Observable=function(){function t(t){this._subscribe=t}return oe=t.prototype,oe.finalValue=function(){var t=this;return new De(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(g))})})},oe.subscribe=oe.forEach=function(t,e,n){var r;return r="object"==typeof t?t:ie(t,e,n),this._subscribe(r)},oe.toArray=function(){function t(t,e){var n=t.slice(0);return n.push(e),n}return this.scan([],t).startWith([]).finalValue()},t}();le.start=function(t,e){return fe(t,e)()};var fe=le.toAsync=function(t,n,r){return n||(n=G),function(){var i=C.call(arguments,0),o=new We;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()}};oe.observeOn=function(t){var e=this;return new De(function(n){return e.subscribe(new he(t,n))})},oe.subscribeOn=function(t){var e=this;return new De(function(n){var r=new j,i=new P;return i.setDisposable(r),r.setDisposable(t.schedule(function(){i.setDisposable(new f(t,e.subscribe(n)))})),i})},le.create=function(t){return new De(function(e){return q(t(e))})},le.createWithDisposable=function(t){return new De(t)};var pe=le.defer=function(t){return new De(function(e){var n;try{n=t()}catch(r){return ye(r).subscribe(e)}return n.subscribe(e)})},de=le.empty=function(t){return t||(t=z),new De(function(e){return t.schedule(function(){e.onCompleted()})})},be=le.fromArray=function(t,e){return e||(e=B),new De(function(n){var r=0;return e.scheduleRecursive(function(e){t.length>r?(n.onNext(t[r++]),e()):n.onCompleted()})})};le.generate=function(t,n,r,i,o){return o||(o=B),new De(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 ve=le.never=function(){return new De(function(){return T})};le.range=function(t,e,n){return n||(n=B),new De(function(r){return n.scheduleRecursiveWithState(0,function(n,i){e>n?(r.onNext(t+n),i(n+1)):r.onCompleted()})})},le.repeat=function(t,e,n){return n||(n=B),null==e&&(e=-1),me(t,n).repeat(e)};var me=le.returnValue=function(t,e){return e||(e=z),new De(function(n){return e.schedule(function(){n.onNext(t),n.onCompleted()})})},ye=le.throwException=function(t,e){return e||(e=z),new De(function(n){return e.schedule(function(){n.onError(t)})})};le.using=function(t,e){return new De(function(n){var r,i,o=T;try{r=t(),r&&(o=r),i=e(r)}catch(s){return new R(ye(s).subscribe(n),o)}return new R(i.subscribe(n),o)})},oe.amb=function(t){var e=this;return new De(function(n){function r(){o||(o=s,a.dispose())}function i(){o||(o=u,c.dispose())}var o,s="L",u="R",c=new j,a=new j;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 R(c,a)})},le.amb=function(){function t(t,e){return t.amb(e)}for(var e=ve(),n=h(arguments,0),r=0,i=n.length;i>r;r++)e=t(e,n[r]);return e},oe.catchException=function(t){return"function"==typeof t?d(this,t):we([this,t])};var we=le.catchException=function(){var t=h(arguments,0);return ne(t).catchException()};oe.combineLatest=function(){var t=C.call(arguments);return Array.isArray(t[0])?t[0].unshift(this):t.unshift(this),ge.apply(this,t)};var ge=le.combineLatest=function(){var t=C.call(arguments),n=t.pop();return Array.isArray(t[0])&&(t=t[0]),new De(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 j,p[e].setDisposable(t[e].subscribe(function(t){f[e]=t,i(e)},r.onError.bind(r),function(){o(e)}))})(d);return new R(p)})};oe.concat=function(){var t=C.call(arguments,0);return t.unshift(this),Ee.apply(this,t)};var Ee=le.concat=function(){var t=h(arguments,0);return ne(t).concat()};oe.concatObservable=oe.concatAll=function(){return this.merge(1)},oe.merge=function(t){if("number"!=typeof t)return xe(this,t);var e=this;return new De(function(n){var r=0,i=new R,o=!1,s=[],u=function(t){var e=new j;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 xe=le.merge=function(){var t,e;return arguments[0]?arguments[0].now?(t=arguments[0],e=C.call(arguments,1)):(t=z,e=C.call(arguments,0)):(t=z,e=C.call(arguments,1)),Array.isArray(e[0])&&(e=e[0]),be(e,t).mergeObservable()};oe.mergeObservable=oe.mergeAll=function(){var t=this;return new De(function(e){var n=new R,r=!1,i=new j;return n.add(i),i.setDisposable(t.subscribe(function(t){var i=new j;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})},oe.onErrorResumeNext=function(t){if(!t)throw Error("Second observable is required");return Ce([this,t])};var Ce=le.onErrorResumeNext=function(){var t=h(arguments,0);return new De(function(e){var n=0,r=new P,i=z.scheduleRecursive(function(i){var o,s;t.length>n?(o=t[n++],s=new j,r.setDisposable(s),s.setDisposable(o.subscribe(e.onNext.bind(e),function(){i()},function(){i()}))):e.onCompleted()});return new R(r,i)})};oe.skipUntil=function(t){var e=this;return new De(function(n){var r=!1,i=new R(e.subscribe(function(t){r&&n.onNext(t)},n.onError.bind(n),function(){r&&n.onCompleted()})),o=new j;return i.add(o),o.setDisposable(t.subscribe(function(){r=!0,o.dispose()},n.onError.bind(n),function(){o.dispose()})),i})},oe.switchLatest=function(){var t=this;return new De(function(e){var n=!1,r=new P,i=!1,o=0,s=t.subscribe(function(t){var s=new j,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 R(s,r)})},oe.takeUntil=function(t){var e=this;return new De(function(r){return new R(e.subscribe(r),t.subscribe(r.onCompleted.bind(r),r.onError.bind(r),n))})},oe.zip=function(){if(Array.isArray(arguments[0]))return b.apply(this,arguments);var t=this,n=C.call(arguments),i=n.pop();return n.unshift(t),new De(function(o){function s(t){a[t]=!0,a.every(function(t){return t})&&o.onCompleted()}for(var u=n.length,c=l(u,function(){return[]}),a=l(u,function(){return!1}),h=function(n){var s,u;if(c.every(function(t){return t.length>0})){try{u=c.map(function(t){return t.shift()}),s=i.apply(t,u)}catch(h){return o.onError(h),e}o.onNext(s)}else a.filter(function(t,e){return e!==n}).every(r)&&o.onCompleted()},f=Array(u),p=0;u>p;p++)(function(t){f[t]=new j,f[t].setDisposable(n[t].subscribe(function(e){c[t].push(e),h(t)},o.onError.bind(o),function(){s(t)}))})(p);return new R(f)})},le.zip=function(){var t=C.call(arguments,0),e=t.shift();return e.zip.apply(e,t)},le.zipArray=function(){var t=C.call(arguments);return new De(function(n){function i(t){if(u.every(function(t){return t.length>0})){var i=u.map(function(t){return t.shift()});n.onNext(i)}else if(c.filter(function(e,n){return n!==t}).every(r))return n.onCompleted(),e}function o(t){return c[t]=!0,c.every(r)?(n.onCompleted(),e):e}for(var s=t.length,u=l(s,function(){return[]}),c=l(s,function(){return!1}),a=Array(s),h=0;s>h;h++)(function(e){a[e]=new j,a[e].setDisposable(t[e].subscribe(function(t){u[e].push(t),i(e)},n.onError.bind(n),function(){o(e)}))})(h);var f=new R(a);return f.add(q(function(){for(var t=0,e=u.length;e>t;t++)u[t]=[]})),f})},oe.asObservable=function(){var t=this;return new De(function(e){return t.subscribe(e)})},oe.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})},oe.dematerialize=function(){var t=this;return new De(function(e){return t.subscribe(function(t){return t.accept(e)},e.onError.bind(e),e.onCompleted.bind(e))})},oe.distinctUntilChanged=function(t,n){var i=this;return t||(t=r),n||(n=o),new De(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))})},oe.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 De(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()})})},oe.finallyAction=function(t){var e=this;return new De(function(n){var r=e.subscribe(n);return q(function(){try{r.dispose()}catch(e){throw e}finally{t()}})})},oe.ignoreElements=function(){var t=this;return new De(function(e){return t.subscribe(n,e.onError.bind(e),e.onCompleted.bind(e))})},oe.materialize=function(){var t=this;return new De(function(e){return t.subscribe(function(t){e.onNext(Q(t))},function(t){e.onNext(X(t)),e.onCompleted()},function(){e.onNext(Y()),e.onCompleted()})})},oe.repeat=function(t){return ee(this,t).concat()},oe.retry=function(t){return ee(this,t).catchException()},oe.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 pe(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})})},oe.skipLast=function(t){var e=this;return new De(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))})},oe.startWith=function(){var t,e,n=0;return arguments.length&&"now"in Object(arguments[0])?(e=arguments[0],n=1):e=z,t=C.call(arguments,n),ne([be(t,e),this]).concat()},oe.takeLast=function(t,e){return this.takeLastBuffer(t).selectMany(function(t){return be(t,e)})},oe.takeLastBuffer=function(t){var e=this;return new De(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()})})},oe.windowWithCount=function(t,e){var n=this;if(0>=t)throw Error(E);if(null==e&&(e=t),0>=e)throw Error(E);return new De(function(r){var i=new j,o=new M(i),s=0,u=[],c=function(){var t=new Ne;u.push(t),r.onNext(S(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})},oe.defaultIfEmpty=function(t){var n=this;return t===e&&(t=null),new De(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()})})},oe.distinct=function(t,n){var i=this;return t||(t=r),n||(n=u),new De(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))})},oe.groupBy=function(t,e,n){return this.groupByUntil(t,e,function(){return ve()},n)},oe.groupByUntil=function(t,i,o,s){var c=this;return i||(i=r),s||(s=u),new De(function(r){var u={},a=new R,h=new M(a);return a.add(c.subscribe(function(c){var l,f,p,d,b,v,m,y,w,g;try{v=t(c),m=s(v)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}d=!1;try{w=u[m],w||(w=new Ne,u[m]=w,d=!0)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}if(d){b=new Se(v,w,h),f=new Se(v,w);try{l=o(f)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}r.onNext(b),y=new j,a.add(y);var x=function(){m in u&&(delete u[m],w.onCompleted()),a.remove(y)};y.setDisposable(l.take(1).subscribe(n,function(t){for(g in u)u[g].onError(t);r.onError(t)},function(){x()}))}try{p=i(c)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}w.onNext(p)},function(t){for(var e in u)u[e].onError(t);r.onError(t)},function(){for(var t in u)u[t].onCompleted();r.onCompleted()})),h})},oe.select=function(t,n){var r=this;return new De(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))})},oe.map=oe.select,oe.selectMany=oe.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})},oe.skip=function(t){if(0>t)throw Error(E);var e=this;return new De(function(n){var r=t;return e.subscribe(function(t){0>=r?n.onNext(t):r--},n.onError.bind(n),n.onCompleted.bind(n))})},oe.skipWhile=function(t){var n=this;return new De(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))})},oe.take=function(t,e){if(0>t)throw Error(E);if(0===t)return de(e);var n=this;return new De(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))})},oe.takeWhile=function(t){var n=this;return new De(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))})},oe.where=function(t,n){var r=this;return new De(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))})},oe.filter=oe.where;var De=w.Internals.AnonymousObservable=function(t){function n(r){function i(t){var e=new Ae(t);if(B.scheduleRequired())B.schedule(function(){try{e.disposable(r(e))}catch(t){if(!e.fail(t))throw t}});else try{e.disposable(r(e))}catch(n){if(!e.fail(n))throw n}return e}return this instanceof n?(t.call(this,i),e):new n(r)}return D(n,t),n}(le),Ae=function(t){function e(e){t.call(this),this.observer=e,this.m=new j}D(e,t);var n=e.prototype;return n.next=function(t){var e=!1;try{this.observer.onNext(t),e=!0}catch(n){throw n}finally{e||this.dispose()}},n.error=function(t){try{this.observer.onError(t)}catch(e){throw e}finally{this.dispose()}},n.completed=function(){try{this.observer.onCompleted()}catch(t){throw t}finally{this.dispose()}},n.disposable=function(t){return this.m.disposable(t)},n.dispose=function(){t.prototype.dispose.call(this),this.m.dispose()},e}(se),Se=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 De(function(t){return new R(i.getDisposable(),r.subscribe(t))}):r}return D(n,t),n}(le),_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 Ne=w.Subject=function(t){function e(t){return a.call(this),this.isStopped?this.exception?(t.onError(this.exception),T):(t.onCompleted(),T):(this.observers.push(t),new _e(this,t))}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return D(n,t),A(n.prototype,re,{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 Re(t,e)},n}(le),We=w.AsyncSubject=function(t){function e(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(),T}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return D(n,t),A(n.prototype,re,{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}(le),Re=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 D(n,t),A(n.prototype,re,{onCompleted:function(){this.observer.onCompleted()},onError:function(t){this.observer.onError(t)},onNext:function(t){this.observer.onNext(t)}}),n}(le);return"function"==typeof define&&"object"==typeof define.amd&&define.amd?(t.Rx=w,define(function(){return w})):(m?"object"==typeof module&&module&&module.exports==m?module.exports=w:m=w:t.Rx=w,e)})(this);
(function(t,e){function n(){}function r(t){return t}function i(){return(new Date).getTime()}function o(t,e){return B(t,e)}function s(t,e){return t-e}function u(t){return""+t}function c(t){throw t}function a(){if(this.isDisposed)throw Error(_)}function h(t){return"function"!=typeof t.toString&&"string"==typeof(t+"")}function l(t){return t&&"object"==typeof t?M.call(t)==O:!1}function f(t){return"function"==typeof t}function p(t,e,n,r){var i;if(t===e)return 0!==t||1/t==1/e;var o=typeof t,s=typeof e;if(!(t!==t||t&&N[o]||e&&N[s]))return!1;if(null==t||null==e)return t===e;var u=M.call(t),c=M.call(e);if(u==O&&(u=T),c==O&&(c=T),u!=c)return!1;switch(u){case W:case k:return+t==+e;case q:return t!=+t?e!=+e:0==t?1/t==1/e:t==+e;case I:case P:return t==e+""}var a=u==R;if(!a){if(u!=T||!C&&(h(t)||h(e)))return!1;var d=!V&&l(t)?Object:t.constructor,b=!V&&l(e)?Object:e.constructor;if(d!=b&&!(f(d)&&d instanceof d&&f(b)&&b instanceof b))return!1}for(var v=n.length;v--;)if(n[v]==t)return r[v]==e;var m=0;if(i=!0,n.push(t),r.push(e),a){for(v=t.length,m=e.length,i=m==t.length;m--;){var y=e[m];if(!(i=p(t[m],y,n,r)))break}return i}for(var w in e)if(L.call(e,w))return m++,i=L.call(t,w)&&p(t[w],e[w],n,r);if(i)for(var w in t)if(L.call(t,w))return i=--m>-1;return n.pop(),r.pop(),i}function d(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:F.call(t)}function b(t,e){for(var n=Array(t),r=0;t>r;r++)n[r]=e();return n}function v(t,e){this.scheduler=t,this.disposable=e,this.isDisposed=!1}function m(t,e,n,r,i){this.scheduler=t,this.state=e,this.action=n,this.dueTime=r,this.comparer=i||s,this.disposable=new ee}function y(t,n){return new He(function(r){var i=new ee,o=new re;return o.setDisposable(i),i.setDisposable(t.subscribe(r.onNext.bind(r),function(t){var i,s;try{s=n(t)}catch(u){return r.onError(u),e}i=new ee,o.setDisposable(i),i.setDisposable(s.subscribe(r))},r.onCompleted.bind(r))),o})}function w(t,n){var r=this;return new He(function(i){var o=0,s=t.length;return r.subscribe(function(r){if(s>o){var u,c=t[o++];try{u=n(r,c)}catch(a){return i.onError(a),e}i.onNext(u)}else i.onCompleted()},i.onError.bind(i),i.onCompleted.bind(i))})}function g(t){return this.select(t).mergeObservable()}var E="object"==typeof exports&&exports,x=("object"==typeof module&&module&&module.exports==E&&module,"object"==typeof global&&global);x.global===x&&(t=x);var C,D={Internals:{}},A="Sequence contains no elements.",S="Argument out of range",_="Object has been disposed",N={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},O="[object Arguments]",R="[object Array]",W="[object Boolean]",k="[object Date]",j="[object Function]",q="[object Number]",T="[object Object]",I="[object RegExp]",P="[object String]",M=Object.prototype.toString,L=Object.prototype.hasOwnProperty,V=M.call(arguments)==O;try{C=!(M.call(document)==T&&!({toString:0}+""))}catch(z){C=!0}V||(l=function(t){return t&&"object"==typeof t?L.call(t,"callee"):!1}),f(/x/)&&(f=function(t){return"function"==typeof t&&M.call(t)==j});var B=D.Internals.isEqual=function(t,e){return p(t,e,[],[])},F=Array.prototype.slice;({}).hasOwnProperty;var H=this.inherits=D.Internals.inherits=function(t,e){function n(){this.constructor=t}n.prototype=e.prototype,t.prototype=new n},U=D.Internals.addProperties=function(t){for(var e=F.call(arguments,1),n=0,r=e.length;r>n;n++){var i=e[n];for(var o in i)t[o]=i[o]}},G=D.Internals.addRef=function(t,e){return new He(function(n){return new X(e.getDisposable(),t.subscribe(n))})},J=function(t,e){this.id=t,this.value=e};J.prototype.compareTo=function(t){var e=this.value.compareTo(t.value);return 0===e&&(e=this.id-t.id),e};var K=function(t){this.items=Array(t),this.length=0},Q=K.prototype;Q.isHigherPriority=function(t,e){return 0>this.items[t].compareTo(this.items[e])},Q.percolate=function(t){if(!(t>=this.length||0>t)){var e=t-1>>1;if(!(0>e||e===t)&&this.isHigherPriority(t,e)){var n=this.items[t];this.items[t]=this.items[e],this.items[e]=n,this.percolate(e)}}},Q.heapify=function(t){if(t===e&&(t=0),!(t>=this.length||0>t)){var n=2*t+1,r=2*t+2,i=t;if(this.length>n&&this.isHigherPriority(n,i)&&(i=n),this.length>r&&this.isHigherPriority(r,i)&&(i=r),i!==t){var o=this.items[t];this.items[t]=this.items[i],this.items[i]=o,this.heapify(i)}}},Q.peek=function(){return this.items[0].value},Q.removeAt=function(t){this.items[t]=this.items[--this.length],delete this.items[this.length],this.heapify()},Q.dequeue=function(){var t=this.peek();return this.removeAt(0),t},Q.enqueue=function(t){var e=this.length++;this.items[e]=new J(K.count++,t),this.percolate(e)},Q.remove=function(t){for(var e=0;this.length>e;e++)if(this.items[e].value===t)return this.removeAt(e),!0;return!1},K.count=0;var X=D.CompositeDisposable=function(){this.disposables=d(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},Y=X.prototype;Y.add=function(t){this.isDisposed?t.dispose():(this.disposables.push(t),this.length++)},Y.remove=function(t){var e=!1;if(!this.isDisposed){var n=this.disposables.indexOf(t);-1!==n&&(e=!0,this.disposables.splice(n,1),this.length--,t.dispose())}return e},Y.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()}},Y.clear=function(){var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()},Y.contains=function(t){return-1!==this.disposables.indexOf(t)},Y.toArray=function(){return this.disposables.slice(0)};var Z=D.Disposable=function(t){this.isDisposed=!1,this.action=t||n};Z.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var $=Z.create=function(t){return new Z(t)},te=Z.empty={dispose:n},ee=D.SingleAssignmentDisposable=function(){this.isDisposed=!1,this.current=null},ne=ee.prototype;ne.disposable=function(t){return t?this.setDisposable(t):this.getDisposable()},ne.getDisposable=function(){return this.current},ne.setDisposable=function(t){if(this.current)throw Error("Disposable has already been assigned");var e=this.isDisposed;e||(this.current=t),e&&t&&t.dispose()},ne.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()};var re=D.SerialDisposable=function(){this.isDisposed=!1,this.current=null};re.prototype.getDisposable=function(){return this.current},re.prototype.setDisposable=function(t){var e,n=this.isDisposed;n||(e=this.current,this.current=t),e&&e.dispose(),n&&t&&t.dispose()},re.prototype.disposable=function(t){return t?(this.setDisposable(t),e):this.getDisposable()},re.prototype.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()};var ie=D.RefCountDisposable=function(){function t(t){this.disposable=t,this.disposable.count++,this.isInnerDisposed=!1}function e(t){this.underlyingDisposable=t,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return t.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},e.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},e.prototype.getDisposable=function(){return this.isDisposed?te:new t(this)},e}();v.prototype.dispose=function(){var t=this;this.scheduler.schedule(function(){t.isDisposed||(t.isDisposed=!0,t.disposable.dispose())})},m.prototype.invoke=function(){this.disposable.disposable(this.invokeCore())},m.prototype.compareTo=function(t){return this.comparer(this.dueTime,t.dueTime)},m.prototype.isCancelled=function(){return this.disposable.isDisposed},m.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var oe=D.Scheduler=function(){function e(t,e,n,r){this.now=t,this._schedule=e,this._scheduleRelative=n,this._scheduleAbsolute=r}function n(t,e){var n=e.first,r=e.second,i=new X,o=function(e){r(e,function(e){var n=!1,r=!1,s=t.scheduleWithState(e,function(t,e){return n?i.remove(s):r=!0,o(e),te});r||(i.add(s),n=!0)})};return o(n),i}function r(t,e,n){var r=e.first,i=e.second,o=new X,s=function(e){i(e,function(e,r){var i=!1,u=!1,c=t[n].call(t,e,r,function(t,e){return i?o.remove(c):u=!0,s(e),te});u||(o.add(c),i=!0)})};return s(r),o}function o(t,e){return e(),te}var s=e.prototype;return s.catchException=function(t){return new pe(this,t)},s.schedulePeriodic=function(t,e){return this.schedulePeriodicWithState(null,t,function(){e()})},s.schedulePeriodicWithState=function(e,n,r){var i=e,o=t.setInterval(function(){i=r(i)},n);return $(function(){t.clearInterval(o)})},s.schedule=function(t){return this._schedule(t,o)},s.scheduleWithState=function(t,e){return this._schedule(t,e)},s.scheduleWithRelative=function(t,e){return this._scheduleRelative(e,t,o)},s.scheduleWithRelativeAndState=function(t,e,n){return this._scheduleRelative(t,e,n)},s.scheduleWithAbsolute=function(t,e){return this._scheduleAbsolute(e,t,o)},s.scheduleWithAbsoluteAndState=function(t,e,n){return this._scheduleAbsolute(t,e,n)},s.scheduleRecursive=function(t){return this.scheduleRecursiveWithState(t,function(t,e){t(function(){e(t)})})},s.scheduleRecursiveWithState=function(t,e){return this.scheduleWithState({first:t,second:e},function(t,e){return n(t,e)})},s.scheduleRecursiveWithRelative=function(t,e){return this.scheduleRecursiveWithRelativeAndState(e,t,function(t,e){t(function(n){e(t,n)})})},s.scheduleRecursiveWithRelativeAndState=function(t,e,n){return this._scheduleRelative({first:t,second:n},e,function(t,e){return r(t,e,"scheduleWithRelativeAndState")})},s.scheduleRecursiveWithAbsolute=function(t,e){return this.scheduleRecursiveWithAbsoluteAndState(e,t,function(t,e){t(function(n){e(t,n)})})},s.scheduleRecursiveWithAbsoluteAndState=function(t,e,n){return this._scheduleAbsolute({first:t,second:n},e,function(t,e){return r(t,e,"scheduleWithAbsoluteAndState")})},e.now=i,e.normalize=function(t){return 0>t&&(t=0),t},e}(),se="Scheduler is not allowed to block the thread",ue=oe.immediate=function(){function t(t,e){return e(this,t)}function e(t,e,n){if(e>0)throw Error(se);return n(this,t)}function n(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new oe(i,t,e,n)}(),ce=oe.currentThread=function(){function t(){o=new K(4)}function e(t,e){return this.scheduleWithRelativeAndState(t,0,e)}function n(e,n,r){var i,s=this.now()+oe.normalize(n),u=new m(this,e,r,s);if(o)o.enqueue(u);else{i=new t;try{o.enqueue(u),i.run()}catch(c){throw c}finally{i.dispose()}}return u.disposable}function r(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}var o;t.prototype.dispose=function(){o=null},t.prototype.run=function(){for(var t;o.length>0;)if(t=o.dequeue(),!t.isCancelled()){for(;t.dueTime-oe.now()>0;);t.isCancelled()||t.invoke()}};var s=new oe(i,e,n,r);return s.scheduleRequired=function(){return null===o},s.ensureTrampoline=function(t){return null===o?this.schedule(t):t()},s}(),ae=function(){function t(t,e){e(0,this._period);try{this._state=this._action(this._state)}catch(n){throw this._cancel.dispose(),n}}function e(t,e,n,r){this._scheduler=t,this._state=e,this._period=n,this._action=r}return e.prototype.start=function(){var e=new ee;return this._cancel=e,e.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,t.bind(this))),e},e}();D.VirtualTimeScheduler=function(t){function n(){return this.toDateTimeOffset(this.clock)}function r(t,e){return this.scheduleAbsoluteWithState(t,this.clock,e)}function i(t,e,n){return this.scheduleRelativeWithState(t,this.toRelative(e),n)}function o(t,e,n){return this.scheduleRelativeWithState(t,this.toRelative(e-this.now()),n)}function s(t,e){return e(),te}function u(e,s){this.clock=e,this.comparer=s,this.isEnabled=!1,this.queue=new K(1024),t.call(this,n,r,i,o)}H(u,t);var c=u.prototype;return c.schedulePeriodicWithState=function(t,e,n){var r=new ae(this,t,e,n);return r.start()},c.scheduleRelativeWithState=function(t,e,n){var r=this.add(this.clock,e);return this.scheduleAbsoluteWithState(t,r,n)},c.scheduleRelative=function(t,e){return this.scheduleRelativeWithState(e,t,s)},c.start=function(){var t;if(!this.isEnabled){this.isEnabled=!0;do t=this.getNext(),null!==t?(this.comparer(t.dueTime,this.clock)>0&&(this.clock=t.dueTime),t.invoke()):this.isEnabled=!1;while(this.isEnabled)}},c.stop=function(){this.isEnabled=!1},c.advanceTo=function(t){var e,n=this.comparer(this.clock,t);if(this.comparer(this.clock,t)>0)throw Error(S);if(0!==n&&!this.isEnabled){this.isEnabled=!0;do e=this.getNext(),null!==e&&0>=this.comparer(e.dueTime,t)?(this.comparer(e.dueTime,this.clock)>0&&(this.clock=e.dueTime),e.invoke()):this.isEnabled=!1;while(this.isEnabled);this.clock=t}},c.advanceBy=function(t){var n=this.add(this.clock,t),r=this.comparer(this.clock,n);if(r>0)throw Error(S);return 0!==r?this.advanceTo(n):e},c.sleep=function(t){var e=this.add(this.clock,t);if(this.comparer(this.clock,e)>=0)throw Error(S);this.clock=e},c.getNext=function(){for(var t;this.queue.length>0;){if(t=this.queue.peek(),!t.isCancelled())return t;this.queue.dequeue()}return null},c.scheduleAbsolute=function(t,e){return this.scheduleAbsoluteWithState(e,t,s)},c.scheduleAbsoluteWithState=function(t,e,n){var r=this,i=function(t,e){return r.queue.remove(o),n(t,e)},o=new m(r,t,i,e,r.comparer);return r.queue.enqueue(o),o.disposable},u}(oe),D.HistoricalScheduler=function(t){function e(e,n){var r=null==e?0:e,i=n||s;t.call(this,r,i)}H(e,t);var n=e.prototype;return n.add=function(t,e){return t+e},n.toDateTimeOffset=function(t){return new Date(t).getTime()},n.toRelative=function(t){return t},e}(D.VirtualTimeScheduler);var he,le=n;(function(){function e(){if(!t.postMessage||t.importScripts)return!1;var e=!1,n=t.onmessage;return t.onmessage=function(){e=!0},t.postMessage("","*"),t.onmessage=n,e}function n(t){if("string"==typeof t.data&&t.data.substring(0,r.length)===r){var e=t.data.substring(r.length),n=i[e];n(),delete i[e]}}if("object"==typeof t.process&&"[object process]"===Object.prototype.toString.call(t.process))he=t.process.nextTick;else if("function"==typeof t.setImmediate)he=t.setImmediate,le=t.clearImmediate;else if(e()){var r="ms.rx.schedule"+Math.random(),i={},o=0;t.addEventListener?t.addEventListener("message",n,!1):t.attachEvent("onmessage",n,!1),he=function(e){var n=o++;i[n]=e,t.postMessage(r+n,"*")}}else if(t.MessageChannel){var s=new t.MessageChannel,u={},c=0;s.port1.onmessage=function(t){var e=t.data,n=u[e];n(),delete u[e]},he=function(t){var e=c++;u[e]=t,s.port2.postMessage(e)}}else"document"in t&&"onreadystatechange"in t.document.createElement("script")?he=function(e){var n=t.document.createElement("script");n.onreadystatechange=function(){e(),n.onreadystatechange=null,n.parentNode.removeChild(n),n=null},t.document.documentElement.appendChild(n)}:(he=function(e){return t.setTimeout(e,0)},le=t.clearTimeout)})();var fe=oe.timeout=function(){function e(t,e){var n=this,r=new ee,i=he(function(){r.isDisposed||r.setDisposable(e(n,t))});return new X(r,$(function(){le(i)}))}function n(e,n,r){var i=this,o=oe.normalize(n);if(0===o)return i.scheduleWithState(e,r);var s=new ee,u=t.setTimeout(function(){s.isDisposed||s.setDisposable(r(i,e))},o);return new X(s,$(function(){t.clearTimeout(u)}))}function r(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new oe(i,e,n,r)}(),pe=function(t){function e(){return this._scheduler.now()}function n(t,e){return this._scheduler.scheduleWithState(t,this._wrap(e))}function r(t,e,n){return this._scheduler.scheduleWithRelativeAndState(t,e,this._wrap(n))}function i(t,e,n){return this._scheduler.scheduleWithAbsoluteAndState(t,e,this._wrap(n))}function o(o,s){this._scheduler=o,this._handler=s,this._recursiveOriginal=null,this._recursiveWrapper=null,t.call(this,e,n,r,i)}return H(o,t),o.prototype._clone=function(t){return new o(t,this._handler)},o.prototype._wrap=function(t){var e=this;return function(n,r){try{return t(e._getRecursiveWrapper(n),r)}catch(i){if(!e._handler(i))throw i;return te}}},o.prototype._getRecursiveWrapper=function(t){if(this._recursiveOriginal!==t){this._recursiveOriginal=t;var e=this._clone(t);e._recursiveOriginal=t,e._recursiveWrapper=e,this._recursiveWrapper=e}return this._recursiveWrapper},o.prototype.schedulePeriodicWithState=function(t,e,n){var r=this,i=!1,o=new ee;return o.setDisposable(this._scheduler.schedulePeriodicWithState(t,e,function(t){if(i)return null;try{return n(t)}catch(e){if(i=!0,!r._handler(e))throw e;return o.dispose(),null}})),o},o}(oe),de=D.Notification=function(){function t(t,e){this.hasValue=null==e?!1:e,this.kind=t}var e=t.prototype;return e.accept=function(t,e,n){return 1===arguments.length&&"object"==typeof t?this._acceptObservable(t):this._accept(t,e,n)},e.toObservable=function(t){var e=this;return t=t||ue,new He(function(n){return t.schedule(function(){e._acceptObservable(n),"N"===e.kind&&n.onCompleted()})})},t}(),be=de.createOnNext=function(){function t(t){return t(this.value)}function e(t){return t.onNext(this.value)}function n(){return"OnNext("+this.value+")"}return function(r){var i=new de("N",!0);return i.value=r,i._accept=t.bind(i),i._acceptObservable=e.bind(i),i.toString=n.bind(i),i}}(),ve=de.createOnError=function(){function t(t,e){return e(this.exception)}function e(t){return t.onError(this.exception)}function n(){return"OnError("+this.exception+")"}return function(r){var i=new de("E");return i.exception=r,i._accept=t.bind(i),i._acceptObservable=e.bind(i),i.toString=n.bind(i),i}}(),me=de.createOnCompleted=function(){function t(t,e,n){return n()}function e(t){return t.onCompleted()}function n(){return"OnCompleted()"}return function(){var r=new de("C");return r._accept=t.bind(r),r._acceptObservable=e.bind(r),r.toString=n.bind(r),r}}(),ye=D.Internals.Enumerator=function(t,e,n){this.moveNext=t,this.getCurrent=e,this.dispose=n},we=ye.create=function(t,e,r){var i=!1;return r||(r=n),new ye(function(){if(i)return!1;var e=t();return e||(i=!0,r()),e},function(){return e()},function(){i||(r(),i=!0)})},ge=D.Internals.Enumerable=function(){function t(t){this.getEnumerator=t}return t.prototype.concat=function(){var t=this;return new He(function(n){var r=t.getEnumerator(),i=!1,o=new re,s=ue.scheduleRecursive(function(t){var s,u,c=!1;if(!i){try{c=r.moveNext(),c?s=r.getCurrent():r.dispose()}catch(a){u=a,r.dispose()}if(u)return n.onError(u),e;if(!c)return n.onCompleted(),e;var h=new ee;o.setDisposable(h),h.setDisposable(s.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){t()}))}});return new X(o,s,$(function(){i=!0,r.dispose()}))})},t.prototype.catchException=function(){var t=this;return new He(function(n){var r,i=t.getEnumerator(),o=!1,s=new re,u=ue.scheduleRecursive(function(t){var u,c,a;if(a=!1,!o){try{a=i.moveNext(),a&&(u=i.getCurrent())}catch(h){c=h}if(c)return n.onError(c),e;if(!a)return r?n.onError(r):n.onCompleted(),e;var l=new ee;s.setDisposable(l),l.setDisposable(u.subscribe(n.onNext.bind(n),function(e){r=e,t()},n.onCompleted.bind(n)))}});return new X(s,u,$(function(){o=!0}))})},t}(),Ee=ge.repeat=function(t,n){return n===e&&(n=-1),new ge(function(){var e,r=n;return we(function(){return 0===r?!1:(r>0&&r--,e=t,!0)},function(){return e})})},xe=ge.forEach=function(t,e){return e||(e=r),new ge(function(){var n,r=-1;return we(function(){return++r<t.length?(n=e(t[r],r),!0):!1},function(){return n})})},Ce=D.Observer=function(){};Ce.prototype.toNotifier=function(){var t=this;return function(e){return e.accept(t)}},Ce.prototype.asObserver=function(){return new _e(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},Ce.prototype.checked=function(){return new Ne(this)};var De=Ce.create=function(t,e,r){return t||(t=n),e||(e=c),r||(r=n),new _e(t,e,r)};Ce.fromNotifier=function(t){return new _e(function(e){return t(be(e))},function(e){return t(ve(e))},function(){return t(me())})};var Ae,Se=D.Internals.AbstractObserver=function(t){function e(){this.isStopped=!1,t.call(this)}return H(e,t),e.prototype.onNext=function(t){this.isStopped||this.next(t)},e.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.error(t))},e.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},e.prototype.dispose=function(){this.isStopped=!0},e.prototype.fail=function(){return this.isStopped?!1:(this.isStopped=!0,this.error(!0),!0)},e}(Ce),_e=D.AnonymousObserver=function(t){function e(e,n,r){t.call(this),this._onNext=e,this._onError=n,this._onCompleted=r}return H(e,t),e.prototype.next=function(t){this._onNext(t)},e.prototype.error=function(t){this._onError(t)},e.prototype.completed=function(){this._onCompleted()},e}(Se),Ne=function(t){function e(e){t.call(this),this._observer=e,this._state=0}H(e,t);var n=e.prototype;return n.onNext=function(t){this.checkAccess();try{this._observer.onNext(t)}catch(e){throw e}finally{this._state=0}},n.onError=function(t){this.checkAccess();try{this._observer.onError(t)}catch(e){throw e}finally{this._state=2}},n.onCompleted=function(){this.checkAccess();try{this._observer.onCompleted()}catch(t){throw t}finally{this._state=2}},n.checkAccess=function(){if(1===this._state)throw Error("Re-entrancy detected");if(2===this._state)throw Error("Observer completed");0===this._state&&(this._state=1)},e}(Ce),Oe=D.Internals.ScheduledObserver=function(t){function n(e,n){t.call(this),this.scheduler=e,this.observer=n,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new re}return H(n,t),n.prototype.next=function(t){var e=this;this.queue.push(function(){e.observer.onNext(t)})},n.prototype.error=function(t){var e=this;this.queue.push(function(){e.observer.onError(t)})},n.prototype.completed=function(){var t=this;this.queue.push(function(){t.observer.onCompleted()})},n.prototype.ensureActive=function(){var t=!1,n=this;!this.hasFaulted&&this.queue.length>0&&(t=!this.isAcquired,this.isAcquired=!0),t&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(t){var r;if(!(n.queue.length>0))return n.isAcquired=!1,e;r=n.queue.shift();try{r()}catch(i){throw n.queue=[],n.hasFaulted=!0,i}t()}))},n.prototype.dispose=function(){t.prototype.dispose.call(this),this.disposable.dispose()},n}(Se),Re=function(t){function e(){t.apply(this,arguments)}return H(e,t),e.prototype.next=function(e){t.prototype.next.call(this,e),this.ensureActive()},e.prototype.error=function(e){t.prototype.error.call(this,e),this.ensureActive()},e.prototype.completed=function(){t.prototype.completed.call(this),this.ensureActive()},e}(Oe),We=D.Observable=function(){function t(t){this._subscribe=t}return Ae=t.prototype,Ae.finalValue=function(){var t=this;return new He(function(e){var n,r=!1;return t.subscribe(function(t){r=!0,n=t},e.onError.bind(e),function(){r?(e.onNext(n),e.onCompleted()):e.onError(Error(A))})})},Ae.subscribe=Ae.forEach=function(t,e,n){var r;return r="object"==typeof t?t:De(t,e,n),this._subscribe(r)},Ae.toArray=function(){function t(t,e){var n=t.slice(0);return n.push(e),n}return this.scan([],t).startWith([]).finalValue()},t}();We.start=function(t,e){return ke(t,e)()};var ke=We.toAsync=function(t,n,r){return n||(n=fe),function(){var i=F.call(arguments,0),o=new Qe;return n.schedule(function(){var n;try{n=t.apply(r,i)}catch(s){return o.onError(s),e}o.onNext(n),o.onCompleted()}),o.asObservable()}};Ae.observeOn=function(t){var e=this;return new He(function(n){return e.subscribe(new Re(t,n))})},Ae.subscribeOn=function(t){var e=this;return new He(function(n){var r=new ee,i=new re;return i.setDisposable(r),r.setDisposable(t.schedule(function(){i.setDisposable(new v(t,e.subscribe(n)))})),i})},We.create=function(t){return new He(function(e){return $(t(e))})},We.createWithDisposable=function(t){return new He(t)};var je=We.defer=function(t){return new He(function(e){var n;try{n=t()}catch(r){return Me(r).subscribe(e)}return n.subscribe(e)})},qe=We.empty=function(t){return t||(t=ue),new He(function(e){return t.schedule(function(){e.onCompleted()})})},Te=We.fromArray=function(t,e){return e||(e=ce),new He(function(n){var r=0;return e.scheduleRecursive(function(e){t.length>r?(n.onNext(t[r++]),e()):n.onCompleted()})})};We.generate=function(t,n,r,i,o){return o||(o=ce),new He(function(s){var u=!0,c=t;return o.scheduleRecursive(function(t){var o,a;try{u?u=!1:c=r(c),o=n(c),o&&(a=i(c))}catch(h){return s.onError(h),e}o?(s.onNext(a),t()):s.onCompleted()})})};var Ie=We.never=function(){return new He(function(){return te})};We.range=function(t,e,n){return n||(n=ce),new He(function(r){return n.scheduleRecursiveWithState(0,function(n,i){e>n?(r.onNext(t+n),i(n+1)):r.onCompleted()})})},We.repeat=function(t,e,n){return n||(n=ce),null==e&&(e=-1),Pe(t,n).repeat(e)};var Pe=We["return"]=We.returnValue=function(t,e){return e||(e=ue),new He(function(n){return e.schedule(function(){n.onNext(t),n.onCompleted()})})},Me=We["throw"]=We.throwException=function(t,e){return e||(e=ue),new He(function(n){return e.schedule(function(){n.onError(t)})})};We.using=function(t,e){return new He(function(n){var r,i,o=te;try{r=t(),r&&(o=r),i=e(r)}catch(s){return new X(Me(s).subscribe(n),o)}return new X(i.subscribe(n),o)})},Ae.amb=function(t){var e=this;return new He(function(n){function r(){o||(o=s,a.dispose())}function i(){o||(o=u,c.dispose())}var o,s="L",u="R",c=new ee,a=new ee;return c.setDisposable(e.subscribe(function(t){r(),o===s&&n.onNext(t)},function(t){r(),o===s&&n.onError(t)},function(){r(),o===s&&n.onCompleted()})),a.setDisposable(t.subscribe(function(t){i(),o===u&&n.onNext(t)},function(t){i(),o===u&&n.onError(t)},function(){i(),o===u&&n.onCompleted()})),new X(c,a)})},We.amb=function(){function t(t,e){return t.amb(e)}for(var e=Ie(),n=d(arguments,0),r=0,i=n.length;i>r;r++)e=t(e,n[r]);return e},Ae.catchException=function(t){return"function"==typeof t?y(this,t):Le([this,t])};var Le=We.catchException=function(){var t=d(arguments,0);return xe(t).catchException()};Ae.combineLatest=function(){var t=F.call(arguments);return Array.isArray(t[0])?t[0].unshift(this):t.unshift(this),Ve.apply(this,t)};var Ve=We.combineLatest=function(){var t=F.call(arguments),n=t.pop();return Array.isArray(t[0])&&(t=t[0]),new He(function(r){function i(t){var i;if(c[t]=!0,a||(a=c.every(function(t){return t}))){try{i=n.apply(null,l)}catch(o){return r.onError(o),e}r.onNext(i)}else h.filter(function(e,n){return n!==t}).every(function(t){return t})&&r.onCompleted()}function o(t){h[t]=!0,h.every(function(t){return t})&&r.onCompleted()}for(var s=function(){return!1},u=t.length,c=b(u,s),a=!1,h=b(u,s),l=Array(u),f=Array(u),p=0;u>p;p++)(function(e){f[e]=new ee,f[e].setDisposable(t[e].subscribe(function(t){l[e]=t,i(e)},r.onError.bind(r),function(){o(e)}))})(p);return new X(f)})};Ae.concat=function(){var t=F.call(arguments,0);return t.unshift(this),ze.apply(this,t)};var ze=We.concat=function(){var t=d(arguments,0);return xe(t).concat()};Ae.concatObservable=Ae.concatAll=function(){return this.merge(1)},Ae.merge=function(t){if("number"!=typeof t)return Be(this,t);var e=this;return new He(function(n){var r=0,i=new X,o=!1,s=[],u=function(t){var e=new ee;i.add(e),e.setDisposable(t.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){var t;i.remove(e),s.length>0?(t=s.shift(),u(t)):(r--,o&&0===r&&n.onCompleted())}))};return i.add(e.subscribe(function(e){t>r?(r++,u(e)):s.push(e)},n.onError.bind(n),function(){o=!0,0===r&&n.onCompleted()})),i})};var Be=We.merge=function(){var t,e;return arguments[0]?arguments[0].now?(t=arguments[0],e=F.call(arguments,1)):(t=ue,e=F.call(arguments,0)):(t=ue,e=F.call(arguments,1)),Array.isArray(e[0])&&(e=e[0]),Te(e,t).mergeObservable()};Ae.mergeObservable=Ae.mergeAll=function(){var t=this;return new He(function(e){var n=new X,r=!1,i=new ee;return n.add(i),i.setDisposable(t.subscribe(function(t){var i=new ee;n.add(i),i.setDisposable(t.subscribe(function(t){e.onNext(t)},e.onError.bind(e),function(){n.remove(i),r&&1===n.length&&e.onCompleted()}))},e.onError.bind(e),function(){r=!0,1===n.length&&e.onCompleted()})),n})},Ae.onErrorResumeNext=function(t){if(!t)throw Error("Second observable is required");return Fe([this,t])};var Fe=We.onErrorResumeNext=function(){var t=d(arguments,0);return new He(function(e){var n=0,r=new re,i=ue.scheduleRecursive(function(i){var o,s;t.length>n?(o=t[n++],s=new ee,r.setDisposable(s),s.setDisposable(o.subscribe(e.onNext.bind(e),function(){i()},function(){i()}))):e.onCompleted()});return new X(r,i)})};Ae.skipUntil=function(t){var e=this;return new He(function(n){var r=!1,i=new X(e.subscribe(function(t){r&&n.onNext(t)},n.onError.bind(n),function(){r&&n.onCompleted()})),o=new ee;return i.add(o),o.setDisposable(t.subscribe(function(){r=!0,o.dispose()},n.onError.bind(n),function(){o.dispose()})),i})},Ae.switchLatest=function(){var t=this;return new He(function(e){var n=!1,r=new re,i=!1,o=0,s=t.subscribe(function(t){var s=new ee,u=++o;n=!0,r.setDisposable(s),s.setDisposable(t.subscribe(function(t){o===u&&e.onNext(t)},function(t){o===u&&e.onError(t)},function(){o===u&&(n=!1,i&&e.onCompleted())}))},e.onError.bind(e),function(){i=!0,n||e.onCompleted()});return new X(s,r)})},Ae.takeUntil=function(t){var e=this;return new He(function(r){return new X(e.subscribe(r),t.subscribe(r.onCompleted.bind(r),r.onError.bind(r),n))})},Ae.zip=function(){if(Array.isArray(arguments[0]))return w.apply(this,arguments);var t=this,n=F.call(arguments),i=n.pop();return n.unshift(t),new He(function(o){function s(t){a[t]=!0,a.every(function(t){return t})&&o.onCompleted()}for(var u=n.length,c=b(u,function(){return[]}),a=b(u,function(){return!1}),h=function(n){var s,u;if(c.every(function(t){return t.length>0})){try{u=c.map(function(t){return t.shift()}),s=i.apply(t,u)}catch(h){return o.onError(h),e}o.onNext(s)}else a.filter(function(t,e){return e!==n}).every(r)&&o.onCompleted()},l=Array(u),f=0;u>f;f++)(function(t){l[t]=new ee,l[t].setDisposable(n[t].subscribe(function(e){c[t].push(e),h(t)},o.onError.bind(o),function(){s(t)}))})(f);return new X(l)})},We.zip=function(){var t=F.call(arguments,0),e=t.shift();return e.zip.apply(e,t)},We.zipArray=function(){var t=F.call(arguments);return new He(function(n){function i(t){if(u.every(function(t){return t.length>0})){var i=u.map(function(t){return t.shift()});n.onNext(i)}else if(c.filter(function(e,n){return n!==t}).every(r))return n.onCompleted(),e}function o(t){return c[t]=!0,c.every(r)?(n.onCompleted(),e):e}for(var s=t.length,u=b(s,function(){return[]}),c=b(s,function(){return!1}),a=Array(s),h=0;s>h;h++)(function(e){a[e]=new ee,a[e].setDisposable(t[e].subscribe(function(t){u[e].push(t),i(e)},n.onError.bind(n),function(){o(e)}))})(h);var l=new X(a);return l.add($(function(){for(var t=0,e=u.length;e>t;t++)u[t]=[]})),l})},Ae.asObservable=function(){var t=this;return new He(function(e){return t.subscribe(e)})},Ae.bufferWithCount=function(t,n){return n===e&&(n=t),this.windowWithCount(t,n).selectMany(function(t){return t.toArray()}).where(function(t){return t.length>0})},Ae.dematerialize=function(){var t=this;return new He(function(e){return t.subscribe(function(t){return t.accept(e)},e.onError.bind(e),e.onCompleted.bind(e))})},Ae.distinctUntilChanged=function(t,n){var i=this;return t||(t=r),n||(n=o),new He(function(r){var o,s=!1;return i.subscribe(function(i){var u,c=!1;try{u=t(i)}catch(a){return r.onError(a),e}if(s)try{c=n(o,u)}catch(a){return r.onError(a),e}s&&c||(s=!0,o=u,r.onNext(i))},r.onError.bind(r),r.onCompleted.bind(r))})},Ae.doAction=function(t,e,n){var r,i=this;return"function"==typeof t?r=t:(r=t.onNext.bind(t),e=t.onError.bind(t),n=t.onCompleted.bind(t)),new He(function(t){return i.subscribe(function(e){try{r(e)}catch(n){t.onError(n)}t.onNext(e)},function(n){if(e){try{e(n)}catch(r){t.onError(r)}t.onError(n)}else t.onError(n)},function(){if(n){try{n()}catch(e){t.onError(e)}t.onCompleted()}else t.onCompleted()})})},Ae.finallyAction=function(t){var e=this;return new He(function(n){var r=e.subscribe(n);return $(function(){try{r.dispose()}catch(e){throw e
}finally{t()}})})},Ae.ignoreElements=function(){var t=this;return new He(function(e){return t.subscribe(n,e.onError.bind(e),e.onCompleted.bind(e))})},Ae.materialize=function(){var t=this;return new He(function(e){return t.subscribe(function(t){e.onNext(be(t))},function(t){e.onNext(ve(t)),e.onCompleted()},function(){e.onNext(me()),e.onCompleted()})})},Ae.repeat=function(t){return Ee(this,t).concat()},Ae.retry=function(t){return Ee(this,t).catchException()},Ae.scan=function(){var t,e,n=!1;2===arguments.length?(t=arguments[0],e=arguments[1],n=!0):e=arguments[0];var r=this;return je(function(){var i,o=!1;return r.select(function(r){return o?i=e(i,r):(i=n?e(t,r):r,o=!0),i})})},Ae.skipLast=function(t){var e=this;return new He(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&n.onNext(r.shift())},n.onError.bind(n),n.onCompleted.bind(n))})},Ae.startWith=function(){var t,e,n=0;return arguments.length&&"now"in Object(arguments[0])?(e=arguments[0],n=1):e=ue,t=F.call(arguments,n),xe([Te(t,e),this]).concat()},Ae.takeLast=function(t,e){return this.takeLastBuffer(t).selectMany(function(t){return Te(t,e)})},Ae.takeLastBuffer=function(t){var e=this;return new He(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&r.shift()},n.onError.bind(n),function(){n.onNext(r),n.onCompleted()})})},Ae.windowWithCount=function(t,e){var n=this;if(0>=t)throw Error(S);if(null==e&&(e=t),0>=e)throw Error(S);return new He(function(r){var i=new ee,o=new ie(i),s=0,u=[],c=function(){var t=new Ke;u.push(t),r.onNext(G(t,o))};return c(),i.setDisposable(n.subscribe(function(n){for(var r,i=0,o=u.length;o>i;i++)u[i].onNext(n);var a=s-t+1;a>=0&&0===a%e&&(r=u.shift(),r.onCompleted()),s++,0===s%e&&c()},function(t){for(;u.length>0;)u.shift().onError(t);r.onError(t)},function(){for(;u.length>0;)u.shift().onCompleted();r.onCompleted()})),o})},Ae.defaultIfEmpty=function(t){var n=this;return t===e&&(t=null),new He(function(e){var r=!1;return n.subscribe(function(t){r=!0,e.onNext(t)},e.onError.bind(e),function(){r||e.onNext(t),e.onCompleted()})})},Ae.distinct=function(t,n){var i=this;return t||(t=r),n||(n=u),new He(function(r){var o={};return i.subscribe(function(i){var s,u,c,a=!1;try{s=t(i),u=n(s)}catch(h){return r.onError(h),e}for(c in o)if(u===c){a=!0;break}a||(o[u]=null,r.onNext(i))},r.onError.bind(r),r.onCompleted.bind(r))})},Ae.groupBy=function(t,e,n){return this.groupByUntil(t,e,function(){return Ie()},n)},Ae.groupByUntil=function(t,i,o,s){var c=this;return i||(i=r),s||(s=u),new He(function(r){var u={},a=new X,h=new ie(a);return a.add(c.subscribe(function(c){var l,f,p,d,b,v,m,y,w,g;try{v=t(c),m=s(v)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}d=!1;try{w=u[m],w||(w=new Ke,u[m]=w,d=!0)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}if(d){b=new Ge(v,w,h),f=new Ge(v,w);try{l=o(f)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}r.onNext(b),y=new ee,a.add(y);var x=function(){m in u&&(delete u[m],w.onCompleted()),a.remove(y)};y.setDisposable(l.take(1).subscribe(n,function(t){for(g in u)u[g].onError(t);r.onError(t)},function(){x()}))}try{p=i(c)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}w.onNext(p)},function(t){for(var e in u)u[e].onError(t);r.onError(t)},function(){for(var t in u)u[t].onCompleted();r.onCompleted()})),h})},Ae.select=function(t,n){var r=this;return new He(function(i){var o=0;return r.subscribe(function(s){var u;try{u=t.call(n,s,o++,r)}catch(c){return i.onError(c),e}i.onNext(u)},i.onError.bind(i),i.onCompleted.bind(i))})},Ae.map=Ae.select,Ae.selectMany=Ae.flatMap=function(t,e){return e?this.selectMany(function(n){return t(n).select(function(t){return e(n,t)})}):"function"==typeof t?g.call(this,t):g.call(this,function(){return t})},Ae.skip=function(t){if(0>t)throw Error(S);var e=this;return new He(function(n){var r=t;return e.subscribe(function(t){0>=r?n.onNext(t):r--},n.onError.bind(n),n.onCompleted.bind(n))})},Ae.skipWhile=function(t){var n=this;return new He(function(r){var i=0,o=!1;return n.subscribe(function(n){if(!o)try{o=!t(n,i++)}catch(s){return r.onError(s),e}o&&r.onNext(n)},r.onError.bind(r),r.onCompleted.bind(r))})},Ae.take=function(t,e){if(0>t)throw Error(S);if(0===t)return qe(e);var n=this;return new He(function(e){var r=t;return n.subscribe(function(t){r>0&&(r--,e.onNext(t),0===r&&e.onCompleted())},e.onError.bind(e),e.onCompleted.bind(e))})},Ae.takeWhile=function(t){var n=this;return new He(function(r){var i=0,o=!0;return n.subscribe(function(n){if(o){try{o=t(n,i++)}catch(s){return r.onError(s),e}o?r.onNext(n):r.onCompleted()}},r.onError.bind(r),r.onCompleted.bind(r))})},Ae.where=function(t,n){var r=this;return new He(function(i){var o=0;return r.subscribe(function(s){var u;try{u=t.call(n,s,o++,r)}catch(c){return i.onError(c),e}u&&i.onNext(s)},i.onError.bind(i),i.onCompleted.bind(i))})},Ae.filter=Ae.where;var He=D.Internals.AnonymousObservable=function(t){function n(r){function i(t){var e=new Ue(t);if(ce.scheduleRequired())ce.schedule(function(){try{e.disposable(r(e))}catch(t){if(!e.fail(t))throw t}});else try{e.disposable(r(e))}catch(n){if(!e.fail(n))throw n}return e}return this instanceof n?(t.call(this,i),e):new n(r)}return H(n,t),n}(We),Ue=function(t){function e(e){t.call(this),this.observer=e,this.m=new ee}H(e,t);var n=e.prototype;return n.next=function(t){var e=!1;try{this.observer.onNext(t),e=!0}catch(n){throw n}finally{e||this.dispose()}},n.error=function(t){try{this.observer.onError(t)}catch(e){throw e}finally{this.dispose()}},n.completed=function(){try{this.observer.onCompleted()}catch(t){throw t}finally{this.dispose()}},n.disposable=function(t){return this.m.disposable(t)},n.dispose=function(){t.prototype.dispose.call(this),this.m.dispose()},e}(Se),Ge=function(t){function e(t){return this.underlyingObservable.subscribe(t)}function n(n,r,i){t.call(this,e),this.key=n,this.underlyingObservable=i?new He(function(t){return new X(i.getDisposable(),r.subscribe(t))}):r}return H(n,t),n}(We),Je=function(t,e){this.subject=t,this.observer=e};Je.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1),this.observer=null}};var Ke=D.Subject=function(t){function e(t){return a.call(this),this.isStopped?this.exception?(t.onError(this.exception),te):(t.onCompleted(),te):(this.observers.push(t),new Je(this,t))}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return H(n,t),U(n.prototype,Ce,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(a.call(this),!this.isStopped){var t=this.observers.slice(0);this.isStopped=!0;for(var e=0,n=t.length;n>e;e++)t[e].onCompleted();this.observers=[]}},onError:function(t){if(a.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){if(a.call(this),!this.isStopped)for(var e=this.observers.slice(0),n=0,r=e.length;r>n;n++)e[n].onNext(t)},dispose:function(){this.isDisposed=!0,this.observers=null}}),n.create=function(t,e){return new Xe(t,e)},n}(We),Qe=D.AsyncSubject=function(t){function e(t){if(a.call(this),!this.isStopped)return this.observers.push(t),new Je(this,t);var e=this.exception,n=this.hasValue,r=this.value;return e?t.onError(e):n?(t.onNext(r),t.onCompleted()):t.onCompleted(),te}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return H(n,t),U(n.prototype,Ce,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){var t,e,n;if(a.call(this),!this.isStopped){var r=this.observers.slice(0);this.isStopped=!0;var i=this.value,o=this.hasValue;if(o)for(e=0,n=r.length;n>e;e++)t=r[e],t.onNext(i),t.onCompleted();else for(e=0,n=r.length;n>e;e++)r[e].onCompleted();this.observers=[]}},onError:function(t){if(a.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){a.call(this),this.isStopped||(this.value=t,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),n}(We),Xe=function(t){function e(t){return this.observable.subscribe(t)}function n(n,r){t.call(this,e),this.observer=n,this.observable=r}return H(n,t),U(n.prototype,Ce,{onCompleted:function(){this.observer.onCompleted()},onError:function(t){this.observer.onError(t)},onNext:function(t){this.observer.onNext(t)}}),n}(We);return"function"==typeof define&&"object"==typeof define.amd&&define.amd?(t.Rx=D,define(function(){return D})):(E?"object"==typeof module&&module&&module.exports==E?module.exports=D:E=D:t.Rx=D,e)})(this);

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

slice = Array.prototype.slice,
inherits = Rx.Internals.inherits;
inherits = Rx.Internals.inherits,
isEqual = Rx.Internals.isEqual;
// Utilities
function defaultComparer(x, y) {
if (!y.equals) {
return x === y;
}
return y.equals(x);
return isEqual(x, y);
}

@@ -45,0 +43,0 @@

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

(function(t,e){var n="object"==typeof exports&&exports,r=("object"==typeof module&&module&&module.exports==n&&module,"object"==typeof global&&global);r.global===r&&(window=r),"function"==typeof define&&define.amd?define(["rx","exports"],function(n,r){return t.Rx=e(t,r,n),t.Rx}):"object"==typeof module&&module&&module.exports===n?module.exports=e(t,module.exports,require("./rx")):t.Rx=e(t,{},t.Rx)})(this,function(t,e,n){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});
(function(t,e){var n="object"==typeof exports&&exports,r=("object"==typeof module&&module&&module.exports==n&&module,"object"==typeof global&&global);r.global===r&&(window=r),"function"==typeof define&&define.amd?define(["rx","exports"],function(n,r){return t.Rx=e(t,r,n),t.Rx}):"object"==typeof module&&module&&module.exports===n?module.exports=e(t,module.exports,require("./rx")):t.Rx=e(t,{},t.Rx)})(this,function(t,e,n){function r(t,e){return m(t,e)}function i(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:b.call(t)}function o(t){this.predicate=t}function s(t){this.predicate=t}var u=n.Observer,c=n.Observable,a=n.Notification,h=n.VirtualTimeScheduler,l=n.Disposable,f=l.empty,p=l.create,d=n.CompositeDisposable,b=(n.SingleAssignmentDisposable,Array.prototype.slice),v=n.Internals.inherits,m=n.Internals.isEqual;o.prototype.equals=function(t){return t===this?!0:null==t?!1:"N"!==t.kind?!1:this.predicate(t.value)},s.prototype.equals=function(t){return t===this?!0:null==t?!1:"E"!==t.kind?!1:this.predicate(t.exception)};var y=n.ReactiveTest={created:100,subscribed:200,disposed:1e3,onNext:function(t,e){return"function"==typeof e?new g(t,new o(e)):new g(t,a.createOnNext(e))},onError:function(t,e){return"function"==typeof e?new g(t,new s(e)):new g(t,a.createOnError(e))},onCompleted:function(t){return new g(t,a.createOnCompleted())},subscribe:function(t,e){return new w(t,e)}},g=n.Recorded=function(t,e,n){this.time=t,this.value=e,this.comparer=n||r};g.prototype.equals=function(t){return this.time===t.time&&this.comparer(this.value,t.value)},g.prototype.toString=function(){return""+this.value+"@"+this.time};var w=n.Subscription=function(t,e){this.subscribe=t,this.unsubscribe=e||Number.MAX_VALUE};w.prototype.equals=function(t){return this.subscribe===t.subscribe&&this.unsubscribe===t.unsubscribe},w.prototype.toString=function(){return"("+this.subscribe+", "+this.unsubscribe===Number.MAX_VALUE?"Infinite":this.unsubscribe+")"};var E=n.MockDisposable=function(t){this.scheduler=t,this.disposes=[],this.disposes.push(this.scheduler.clock)};E.prototype.dispose=function(){this.disposes.push(this.scheduler.clock)};var x=function(t){function e(e){t.call(this),this.scheduler=e,this.messages=[]}v(e,t);var n=e.prototype;return n.onNext=function(t){this.messages.push(new g(this.scheduler.clock,a.createOnNext(t)))},n.onError=function(t){this.messages.push(new g(this.scheduler.clock,a.createOnError(t)))},n.onCompleted=function(){this.messages.push(new g(this.scheduler.clock,a.createOnCompleted()))},e}(u),C=function(t){function e(t){var e=this;this.observers.push(t),this.subscriptions.push(new w(this.scheduler.clock));var n=this.subscriptions.length-1;return p(function(){var r=e.observers.indexOf(t);e.observers.splice(r,1),e.subscriptions[n]=new w(e.subscriptions[n].subscribe,e.scheduler.clock)})}function n(n,r){t.call(this,e);var i,o,s=this;this.scheduler=n,this.messages=r,this.subscriptions=[],this.observers=[];for(var u=0,c=this.messages.length;c>u;u++)i=this.messages[u],o=i.value,function(t){n.scheduleAbsoluteWithState(null,i.time,function(){for(var e=0;s.observers.length>e;e++)t.accept(s.observers[e]);return f})}(o)}return v(n,t),n}(c),D=function(t){function e(t){var e,n,r=this;this.subscriptions.push(new w(this.scheduler.clock));for(var i=this.subscriptions.length-1,o=new d,s=0,u=this.messages.length;u>s;s++)e=this.messages[s],n=e.value,function(n){o.add(r.scheduler.scheduleRelativeWithState(null,e.time,function(){return n.accept(t),f}))}(n);return p(function(){r.subscriptions[i]=new w(r.subscriptions[i].subscribe,r.scheduler.clock),o.dispose()})}function n(n,r){t.call(this,e),this.scheduler=n,this.messages=r,this.subscriptions=[]}return v(n,t),n}(c);return n.TestScheduler=function(t){function e(){t.call(this,0,function(t,e){return t-e})}return v(e,t),e.prototype.scheduleAbsoluteWithState=function(e,n,r){return this.clock>=n&&(n=this.clock+1),t.prototype.scheduleAbsoluteWithState.call(this,e,n,r)},e.prototype.add=function(t,e){return t+e},e.prototype.toDateTimeOffset=function(t){return new Date(t).getTime()},e.prototype.toRelative=function(t){return t},e.prototype.startWithTiming=function(t,e,n,r){var i,o,s=this.createObserver();return this.scheduleAbsoluteWithState(null,e,function(){return i=t(),f}),this.scheduleAbsoluteWithState(null,n,function(){return o=i.subscribe(s),f}),this.scheduleAbsoluteWithState(null,r,function(){return o.dispose(),f}),this.start(),s},e.prototype.startWithDispose=function(t,e){return this.startWithTiming(t,y.created,y.subscribed,e)},e.prototype.startWithCreate=function(t){return this.startWithTiming(t,y.created,y.subscribed,y.disposed)},e.prototype.createHotObservable=function(){var t=i(arguments,0);return new C(this,t)},e.prototype.createColdObservable=function(){var t=i(arguments,0);return new D(this,t)},e.prototype.createObserver=function(){return new x(this)},e}(h),n});

@@ -5,3 +5,4 @@ // References

CompositeDisposable = Rx.CompositeDisposable,
AnonymousObservable = Rx.Internals.AnonymousObservable;
AnonymousObservable = Rx.Internals.AnonymousObservable,
isEqual = Rx.Internals.isEqual;

@@ -11,3 +12,3 @@ // Defaults

var sequenceContainsNoElements = "Sequence contains no elements.";
function defaultComparer(x, y) { return x === y; }
function defaultComparer(x, y) { return isEqual(x, y); }
function identity(x) { return x; }

@@ -18,7 +19,7 @@ function subComparer(x, y) {

}
if (x === y) {
return 0;
if (x < y) {
return -1
}
return -1;
return 0;
}

@@ -5,3 +5,3 @@ // Defaults

function defaultNow() { return new Date().getTime(); }
function defaultComparer(x, y) { return x === y; }
function defaultComparer(x, y) { return isEqual(x, y); }
function defaultSubComparer(x, y) { return x - y; }

@@ -8,0 +8,0 @@ function defaultKeySerializer(x) { return x.toString(); }

@@ -9,6 +9,7 @@ // Aliases

CompositeDisposable = Rx.CompositeDisposable,
AbstractObserver = Rx.Internals.AbstractObserver;
AbstractObserver = Rx.Internals.AbstractObserver,
isEqual = Rx.Internals.isEqual;
// Defaults
function defaultComparer(x, y) { return x === y; }
function defaultComparer(x, y) { return isEqual(x, y); }
function noop() { }

@@ -15,0 +16,0 @@

@@ -208,6 +208,7 @@ /**

* Returns an observable sequence that contains a single element, using the specified scheduler to send out observer messages.
* There is an alias called 'returnValue' for browsers <IE9.
*
* @example
* 1 - res = Rx.Observable.returnValue(42);
* 2 - res = Rx.Observable.returnValue(42, Rx.Scheduler.timeout);
* 1 - res = Rx.Observable.return(42);
* 2 - res = Rx.Observable.return(42, Rx.Scheduler.timeout);
* @static

@@ -219,3 +220,3 @@ * @memberOf Observable

*/
var observableReturn = Observable.returnValue = function (value, scheduler) {
var observableReturn = Observable['return'] = Observable.returnValue = function (value, scheduler) {
scheduler || (scheduler = immediateScheduler);

@@ -231,3 +232,4 @@ return new AnonymousObservable(function (observer) {

/**
* Returns an observable sequence that terminates with an exception, using the specified scheduler to send out the single OnError message.
* Returns an observable sequence that terminates with an exception, using the specified scheduler to send out the single onError message.
* There is an alias to this method called 'throwException' for browsers <IE9.
*

@@ -243,3 +245,3 @@ * @example

*/
var observableThrow = Observable.throwException = function (exception, scheduler) {
var observableThrow = Observable['throw'] = Observable.throwException = function (exception, scheduler) {
scheduler || (scheduler = immediateScheduler);

@@ -278,2 +280,2 @@ return new AnonymousObservable(function (observer) {

});
};
};

@@ -27,8 +27,8 @@ function enumerableWhile(condition, source) {

/**
* Determines whether an observable collection contains values.
* Determines whether an observable collection contains values. There is an alias for this method called 'ifThen' for browsers <IE9
*
* @example
* 1 - res = Rx.Observable.ifThen(condition, obs1);
* 2 - res = Rx.Observable.ifThen(condition, obs1, obs2);
* 3 - res = Rx.Observable.ifThen(condition, obs1, scheduler);
* 1 - res = Rx.Observable.if(condition, obs1);
* 2 - res = Rx.Observable.if(condition, obs1, obs2);
* 3 - res = Rx.Observable.if(condition, obs1, scheduler);
* @static

@@ -41,3 +41,3 @@ * @memberOf Observable

*/
Observable.ifThen = function (condition, thenSource, elseSourceOrScheduler) {
Observable['if'] = Observable.ifThen = function (condition, thenSource, elseSourceOrScheduler) {
return observableDefer(function () {

@@ -55,2 +55,3 @@ elseSourceOrScheduler || (elseSourceOrScheduler = observableEmpty());

* Concatenates the observable sequences obtained by running the specified result selector for each element in source.
* There is an alias for this method called 'forIn' for browsers <IE9
* @static

@@ -62,3 +63,3 @@ * @memberOf Observable

*/
Observable.forIn = function (sources, resultSelector) {
Observable['for'] = Observable.forIn = function (sources, resultSelector) {
return enumerableForEach(sources, resultSelector).concat();

@@ -69,2 +70,3 @@ };

* Repeats source as long as condition holds emulating a while loop.
* There is an alias for this method called 'whileDo' for browsers <IE9
* @static

@@ -76,3 +78,3 @@ * @memberOf Observable

*/
var observableWhileDo = Observable.whileDo = function (condition, source) {
var observableWhileDo = Observable['while'] = Observable.whileDo = function (condition, source) {
return enumerableWhile(condition, source).concat();

@@ -95,7 +97,8 @@ };

* Uses selector to determine which source in sources to use.
* There is an alias 'switchCase' for browsers <IE9.
*
* @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);
* 1 - res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 });
* 1 - res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 }, obs0);
* 1 - res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 }, scheduler);
*

@@ -110,3 +113,3 @@ * @static

*/
Observable.switchCase = function (selector, sources, defaultSourceOrScheduler) {
Observable['case'] = Observable.switchCase = function (selector, sources, defaultSourceOrScheduler) {
return observableDefer(function () {

@@ -113,0 +116,0 @@ defaultSourceOrScheduler || (defaultSourceOrScheduler = observableEmpty());

@@ -48,7 +48,2 @@ /**

NotificationPrototype.equals = function (other) {
var otherString = other == null ? '' : other.toString();
return this.toString() === otherString;
};
return Notification;

@@ -55,0 +50,0 @@ })();

@@ -12,10 +12,8 @@ // Defaults

slice = Array.prototype.slice,
inherits = Rx.Internals.inherits;
inherits = Rx.Internals.inherits,
isEqual = Rx.Internals.isEqual;
// Utilities
function defaultComparer(x, y) {
if (!y.equals) {
return x === y;
}
return y.equals(x);
return isEqual(x, y);
}

@@ -22,0 +20,0 @@

Sorry, the diff of this file is not supported yet

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 too big to display

Sorry, the diff of this file is too big to display

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