Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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.2.0 to 2.2.2

2

bower.json
{
"name": "rxjs",
"version": "2.2.0",
"version": "2.2.2",
"main": [

@@ -5,0 +5,0 @@ "rx.js",

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

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

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

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

$.each(res, function (_, value) {
$('<li>' + value + '</li>').appendTo(results);
$('<li>' + value + '</li>').appendTo($results);
});

@@ -119,3 +119,3 @@ }, function (e) {

$('<li>Error: ' + error + '</li>').appendTo(results);
$('<li>Error: ' + error + '</li>').appendTo($results);
});

@@ -128,3 +128,3 @@ ```

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).
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) and plenty of [unit tests](https://github.com/Reactive-Extensions/RxJS/tree/master/tests).

@@ -131,0 +131,0 @@ ## RESOURCES

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

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

@@ -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){var e=function(){this.cancelBubble=!0},n=function(){if(this.bubbledKeyCode=this.keyCode,this.ctrlKey)try{this.keyCode=0}catch(t){}this.defaultPrevented=!0,this.returnValue=!1,this.modified=!0};if(t||(t=window.event),!t.target)switch(t.target=t.target||t.srcElement,"mouseover"==t.type&&(t.relatedTarget=t.fromElement),"mouseout"==t.type&&(t.relatedTarget=t.toElement),t.stopPropagation||(t.stopPropagation=e,t.preventDefault=n),t.type){case"keypress":var r="charCode"in t?t.charCode:t.keyCode;10==r?(r=0,t.keyCode=13):13==r||27==r?r=0:3==r&&(r=99),t.charCode=r,t.keyChar=t.charCode?String.fromCharCode(t.charCode):""}return t}function i(t,e,n){if(t.addListener)return t.addListener(e,n),a(function(){t.removeListener(e,n)});if(t.addEventListener)return t.addEventListener(e,n,!1),a(function(){t.removeEventListener(e,n,!1)});if(t.attachEvent){var i=function(t){n(r(t))};return t.attachEvent("on"+e,i),a(function(){t.detachEvent("on"+e,i)})}return t["on"+e]=n,a(function(){t["on"+e]=null})}function o(t,e,n){var r=new h;if(t&&t.length)for(var s=0,u=t.length;u>s;s++)r.add(o(t[s],e,n));else t&&r.add(i(t,e,n));return r}var s=n.Observable,u=n.Internals.AnonymousObservable,c=n.AsyncSubject,a=n.Disposable.create,h=n.CompositeDisposable,c=n.AsyncSubject;timeoutScheduler=n.Scheduler.timeout,slice=Array.prototype.slice,s.start=function(t,e,n){return l(t,e,n)()};var l=s.toAsync=function(t,e,n){return e||(e=timeoutScheduler),function(){var r=arguments,i=new c;return e.schedule(function(){var e;try{e=t.apply(n,r)}catch(o){return i.onError(o),undefined}i.onNext(e),i.onCompleted()}),i.asObservable()}};return s.fromCallback=function(t,e,n){return e||(e=timeoutScheduler),function(){var r=slice.call(arguments,0),i=new c;return e.schedule(function(){function e(){i.onNext(arguments),i.onCompleted()}r.push(e),t.apply(n,r)}),i.asObservable()}},s.fromNodeCallback=function(t,e,n){return e||(e=timeoutScheduler),function(){var r=slice.call(arguments,0),i=new c;return e.schedule(function(){function e(t){var e=slice.call(arguments,1);return t?(i.onError(t),undefined):(i.onNext(e),i.onCompleted(),undefined)}r.push(e),t.apply(n,r)}),i.asObservable()}},s.fromEvent=function(t,e){return new u(function(n){return o(t,e,function(t){n.onNext(t)})}).publish().refCount()},s.fromEventPattern=function(t,e){return new u(function(n){function r(t){n.onNext(t)}var i=t(r);return a(function(){e&&e(r,i)})}).publish().refCount()},s.fromPromise=function(t){var e=new c;return t.then(function(t){e.onNext(t),e.onCompleted()},function(t){e.onError(t)}),e.asObservable()},n});
!function(a,b){var c="object"==typeof exports&&exports,d=("object"==typeof module&&module&&module.exports==c&&module,"object"==typeof global&&global);d.global===d&&(window=d),"function"==typeof define&&define.amd?define(["rx","exports"],function(c,d){return a.Rx=b(a,d,c),a.Rx}):"object"==typeof module&&module&&module.exports===c?module.exports=b(a,module.exports,require("./rx")):a.Rx=b(a,{},a.Rx)}(this,function(a,b,c){function d(a){var b=function(){this.cancelBubble=!0},c=function(){if(this.bubbledKeyCode=this.keyCode,this.ctrlKey)try{this.keyCode=0}catch(a){}this.defaultPrevented=!0,this.returnValue=!1,this.modified=!0};if(a||(a=window.event),!a.target)switch(a.target=a.target||a.srcElement,"mouseover"==a.type&&(a.relatedTarget=a.fromElement),"mouseout"==a.type&&(a.relatedTarget=a.toElement),a.stopPropagation||(a.stopPropagation=b,a.preventDefault=c),a.type){case"keypress":var d="charCode"in a?a.charCode:a.keyCode;10==d?(d=0,a.keyCode=13):13==d||27==d?d=0:3==d&&(d=99),a.charCode=d,a.keyChar=a.charCode?String.fromCharCode(a.charCode):""}return a}function e(a,b,c){if(a.addListener)return a.addListener(b,c),j(function(){a.removeListener(b,c)});if(a.addEventListener)return a.addEventListener(b,c,!1),j(function(){a.removeEventListener(b,c,!1)});if(a.attachEvent){var e=function(a){c(d(a))};return a.attachEvent("on"+b,e),j(function(){a.detachEvent("on"+b,e)})}return a["on"+b]=c,j(function(){a["on"+b]=null})}function f(a,b,c){var d=new k;if(a&&a.length)for(var g=0,h=a.length;h>g;g++)d.add(f(a[g],b,c));else a&&d.add(e(a,b,c));return d}var g=c.Observable,h=c.Internals.AnonymousObservable,i=c.AsyncSubject,j=c.Disposable.create,k=c.CompositeDisposable,i=c.AsyncSubject;timeoutScheduler=c.Scheduler.timeout,slice=Array.prototype.slice,g.start=function(a,b,c){return l(a,b,c)()};var l=g.toAsync=function(a,b,c){return b||(b=timeoutScheduler),function(){var d=arguments,e=new i;return b.schedule(function(){var b;try{b=a.apply(c,d)}catch(f){return e.onError(f),void 0}e.onNext(b),e.onCompleted()}),e.asObservable()}};return g.fromCallback=function(a,b,c){return b||(b=timeoutScheduler),function(){var d=slice.call(arguments,0),e=new i;return b.schedule(function(){function b(){e.onNext(arguments),e.onCompleted()}d.push(b),a.apply(c,d)}),e.asObservable()}},g.fromNodeCallback=function(a,b,c){return b||(b=timeoutScheduler),function(){var d=slice.call(arguments,0),e=new i;return b.schedule(function(){function b(a){var b=slice.call(arguments,1);return a?(e.onError(a),void 0):(e.onNext(b),e.onCompleted(),void 0)}d.push(b),a.apply(c,d)}),e.asObservable()}},g.fromEvent=function(a,b){return new h(function(c){return f(a,b,function(a){c.onNext(a)})}).publish().refCount()},g.fromEventPattern=function(a,b){return new h(function(c){function d(a){c.onNext(a)}var e=a(d);return j(function(){b&&b(d,e)})}).publish().refCount()},g.fromPromise=function(a){var b=new i;return a.then(function(a){b.onNext(a),b.onCompleted()},function(a){b.onError(a)}),b.asObservable()},c});

@@ -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,n){return t.addListener?(t.addListener(e,n),c(function(){t.removeListener(e,n)})):t.addEventListener?(t.addEventListener(e,n,!1),c(function(){t.removeEventListener(e,n,!1)})):undefined}function i(t,e,n){var o=new a;if(t&&t.length)for(var s=0,u=t.length;u>s;s++)o.add(i(t[s],e,n));else t&&o.add(r(t,e,n));return o}var o=n.Observable,s=n.Internals.AnonymousObservable,u=n.AsyncSubject,c=n.Disposable.create,a=n.CompositeDisposable,u=n.AsyncSubject;timeoutScheduler=n.Scheduler.timeout,slice=Array.prototype.slice,o.start=function(t,e,n){return l(t,e,n)()};var l=o.toAsync=function(t,e,n){return e||(e=timeoutScheduler),function(){var r=arguments,i=new u;return e.schedule(function(){var e;try{e=t.apply(n,r)}catch(o){return i.onError(o),undefined}i.onNext(e),i.onCompleted()}),i.asObservable()}};return o.fromCallback=function(t,e,n){return e||(e=timeoutScheduler),function(){var r=slice.call(arguments,0),i=new u;return e.schedule(function(){function e(){i.onNext(arguments),i.onCompleted()}r.push(e),t.apply(n,r)}),i.asObservable()}},o.fromNodeCallback=function(t,e,n){return e||(e=timeoutScheduler),function(){var r=slice.call(arguments,0),i=new u;return e.schedule(function(){function e(t){var e=slice.call(arguments,1);return t?(i.onError(t),undefined):(i.onNext(e),i.onCompleted(),undefined)}r.push(e),t.apply(n,r)}),i.asObservable()}},o.fromEvent=function(t,e){return new s(function(n){return i(t,e,function(t){n.onNext(t)})}).publish().refCount()},o.fromEventPattern=function(t,e){return new s(function(n){function r(t){n.onNext(t)}var i=t(r);return c(function(){e&&e(r,i)})}).publish().refCount()},o.fromPromise=function(t){var e=new u;return t.then(function(t){e.onNext(t),e.onCompleted()},function(t){e.onError(t)}),e.asObservable()},n});
!function(a,b){var c="object"==typeof exports&&exports,d=("object"==typeof module&&module&&module.exports==c&&module,"object"==typeof global&&global);d.global===d&&(window=d),"function"==typeof define&&define.amd?define(["rx","exports"],function(c,d){return a.Rx=b(a,d,c),a.Rx}):"object"==typeof module&&module&&module.exports===c?module.exports=b(a,module.exports,require("./rx")):a.Rx=b(a,{},a.Rx)}(this,function(a,b,c){function d(a,b,c){return a.addListener?(a.addListener(b,c),i(function(){a.removeListener(b,c)})):a.addEventListener?(a.addEventListener(b,c,!1),i(function(){a.removeEventListener(b,c,!1)})):void 0}function e(a,b,c){var f=new j;if(a&&a.length)for(var g=0,h=a.length;h>g;g++)f.add(e(a[g],b,c));else a&&f.add(d(a,b,c));return f}var f=c.Observable,g=c.Internals.AnonymousObservable,h=c.AsyncSubject,i=c.Disposable.create,j=c.CompositeDisposable,h=c.AsyncSubject;timeoutScheduler=c.Scheduler.timeout,slice=Array.prototype.slice,f.start=function(a,b,c){return k(a,b,c)()};var k=f.toAsync=function(a,b,c){return b||(b=timeoutScheduler),function(){var d=arguments,e=new h;return b.schedule(function(){var b;try{b=a.apply(c,d)}catch(f){return e.onError(f),void 0}e.onNext(b),e.onCompleted()}),e.asObservable()}};return f.fromCallback=function(a,b,c){return b||(b=timeoutScheduler),function(){var d=slice.call(arguments,0),e=new h;return b.schedule(function(){function b(){e.onNext(arguments),e.onCompleted()}d.push(b),a.apply(c,d)}),e.asObservable()}},f.fromNodeCallback=function(a,b,c){return b||(b=timeoutScheduler),function(){var d=slice.call(arguments,0),e=new h;return b.schedule(function(){function b(a){var b=slice.call(arguments,1);return a?(e.onError(a),void 0):(e.onNext(b),e.onCompleted(),void 0)}d.push(b),a.apply(c,d)}),e.asObservable()}},f.fromEvent=function(a,b){return new g(function(c){return e(a,b,function(a){c.onNext(a)})}).publish().refCount()},f.fromEventPattern=function(a,b){return new g(function(c){function d(a){c.onNext(a)}var e=a(d);return i(function(){b&&b(d,e)})}).publish().refCount()},f.fromPromise=function(a){var b=new h;return a.then(function(a){b.onNext(a),b.onCompleted()},function(a){b.onError(a)}),b.asObservable()},c});

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

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

(function(t,e){var n="object"==typeof exports&&exports,r=("object"==typeof module&&module&&module.exports==n&&module,"object"==typeof global&&global);r.global===r&&(window=r),"function"==typeof define&&define.amd?define(["rx","exports"],function(n,r){return t.Rx=e(t,r,n),t.Rx}):"object"==typeof module&&module&&module.exports===n?module.exports=e(t,module.exports,require("./rx")):t.Rx=e(t,{},t.Rx)})(this,function(t,e,n,r){function i(){}function o(t,e){return t===e}function s(t){if(false&t)return 2===t;for(var e=Math.sqrt(t),n=3;e>=n;){if(0===t%n)return!1;n+=2}return!0}function u(t){var e,n,r;for(e=0;D.length>e;++e)if(n=D[e],n>=t)return n;for(r=1|t;D[D.length-1]>r;){if(s(r))return r;r+=2}return t}function c(t){var e=757602046;if(!t.length)return e;for(var n=0,r=t.length;r>n;n++){var i=t.charCodeAt(n);e=(e<<5)-e+i,e&=e}return e}function a(t){var e=668265261;return t=61^t^t>>>16,t+=t<<3,t^=t>>>4,t*=e,t^=t>>>15}function h(){return{key:null,value:null,next:0,hashCode:0}}function l(t,e){return t.groupJoin(this,e,function(){return E()},function(t,e){return e})}function f(t){var e=this;return new x(function(n){var r=new g,i=new b,o=new v(i);return n.onNext(C(r,o)),i.add(e.subscribe(function(t){r.onNext(t)},function(t){r.onError(t),n.onError(t)},function(){r.onCompleted(),n.onCompleted()})),i.add(t.subscribe(function(){r.onCompleted(),r=new g,n.onNext(C(r,o))},function(t){r.onError(t),n.onError(t)},function(){r.onCompleted(),n.onCompleted()})),o})}function p(t){var e=this;return new x(function(n){var o,s=new y,u=new b(s),c=new v(u),a=new g;return n.onNext(C(a,c)),u.add(e.subscribe(function(t){a.onNext(t)},function(t){a.onError(t),n.onError(t)},function(){a.onCompleted(),n.onCompleted()})),o=function(){var e,u;try{u=t()}catch(h){return n.onError(h),r}e=new m,s.setDisposable(e),e.setDisposable(u.take(1).subscribe(i,function(t){a.onError(t),n.onError(t)},function(){a.onCompleted(),a=new g,n.onNext(C(a,c)),o()}))},o(),c})}var d=n.Observable,b=n.CompositeDisposable,v=n.RefCountDisposable,m=n.SingleAssignmentDisposable,y=n.SerialDisposable,g=n.Subject,w=d.prototype,E=d.empty,x=n.Internals.AnonymousObservable,C=(n.Observer.create,n.Internals.addRef),D=[1,3,7,13,31,61,127,251,509,1021,2039,4093,8191,16381,32749,65521,131071,262139,524287,1048573,2097143,4194301,8388593,16777213,33554393,67108859,134217689,268435399,536870909,1073741789,2147483647],A="no such key",S="duplicate key",N=function(){var t=0;return function(e){if(null==e)throw Error(A);if("string"==typeof e)return c(e);if("number"==typeof e)return a(e);if("boolean"==typeof e)return e===!0?1:0;if(e instanceof Date)return e.getTime();if(e.getHashCode)return e.getHashCode();var n=17*t++;return e.getHashCode=function(){return n},n}}(),_=function(t,e){if(0>t)throw Error("out of range");t>0&&this._initialize(t),this.comparer=e||o,this.freeCount=0,this.size=0,this.freeList=-1};return _.prototype._initialize=function(t){var e,n=u(t);for(this.buckets=Array(n),this.entries=Array(n),e=0;n>e;e++)this.buckets[e]=-1,this.entries[e]=h();this.freeList=-1},_.prototype.count=function(){return this.size},_.prototype.add=function(t,e){return this._insert(t,e,!0)},_.prototype._insert=function(t,e,n){this.buckets||this._initialize(0);for(var i,o=2147483647&N(t),s=o%this.buckets.length,u=this.buckets[s];u>=0;u=this.entries[u].next)if(this.entries[u].hashCode===o&&this.comparer(this.entries[u].key,t)){if(n)throw Error(S);return this.entries[u].value=e,r}this.freeCount>0?(i=this.freeList,this.freeList=this.entries[i].next,--this.freeCount):(this.size===this.entries.length&&(this._resize(),s=o%this.buckets.length),i=this.size,++this.size),this.entries[i].hashCode=o,this.entries[i].next=this.buckets[s],this.entries[i].key=t,this.entries[i].value=e,this.buckets[s]=i},_.prototype._resize=function(){var t=u(2*this.size),e=Array(t);for(r=0;e.length>r;++r)e[r]=-1;var n=Array(t);for(r=0;this.size>r;++r)n[r]=this.entries[r];for(var r=this.size;t>r;++r)n[r]=h();for(var i=0;this.size>i;++i){var o=n[i].hashCode%t;n[i].next=e[o],e[o]=i}this.buckets=e,this.entries=n},_.prototype.remove=function(t){if(this.buckets)for(var e=2147483647&N(t),n=e%this.buckets.length,r=-1,i=this.buckets[n];i>=0;i=this.entries[i].next){if(this.entries[i].hashCode===e&&this.comparer(this.entries[i].key,t))return 0>r?this.buckets[n]=this.entries[i].next:this.entries[r].next=this.entries[i].next,this.entries[i].hashCode=-1,this.entries[i].next=this.freeList,this.entries[i].key=null,this.entries[i].value=null,this.freeList=i,++this.freeCount,!0;r=i}return!1},_.prototype.clear=function(){var t,e;if(!(0>=this.size)){for(t=0,e=this.buckets.length;e>t;++t)this.buckets[t]=-1;for(t=0;this.size>t;++t)this.entries[t]=h();this.freeList=-1,this.size=0}},_.prototype._findEntry=function(t){if(this.buckets)for(var e=2147483647&N(t),n=this.buckets[e%this.buckets.length];n>=0;n=this.entries[n].next)if(this.entries[n].hashCode===e&&this.comparer(this.entries[n].key,t))return n;return-1},_.prototype.count=function(){return this.size-this.freeCount},_.prototype.tryGetValue=function(t){var e=this._findEntry(t);return e>=0?this.entries[e].value:r},_.prototype.getValues=function(){var t=0,e=[];if(this.entries)for(var n=0;this.size>n;n++)this.entries[n].hashCode>=0&&(e[t++]=this.entries[n].value);return e},_.prototype.get=function(t){var e=this._findEntry(t);if(e>=0)return this.entries[e].value;throw Error(A)},_.prototype.set=function(t,e){this._insert(t,e,!1)},_.prototype.containskey=function(t){return this._findEntry(t)>=0},w.join=function(t,e,n,o){var s=this;return new x(function(u){var c=new b,a=!1,h=0,l=new _,f=!1,p=0,d=new _;return c.add(s.subscribe(function(t){var n,s,f,p,b=h++,v=new m;l.add(b,t),c.add(v),s=function(){return l.remove(b)&&0===l.count()&&a&&u.onCompleted(),c.remove(v)};try{n=e(t)}catch(y){return u.onError(y),r}v.setDisposable(n.take(1).subscribe(i,u.onError.bind(u),function(){s()})),p=d.getValues();for(var g=0;p.length>g;g++){try{f=o(t,p[g])}catch(w){return u.onError(w),r}u.onNext(f)}},u.onError.bind(u),function(){a=!0,(f||0===l.count())&&u.onCompleted()})),c.add(t.subscribe(function(t){var e,s,a,h,b=p++,v=new m;d.add(b,t),c.add(v),s=function(){return d.remove(b)&&0===d.count()&&f&&u.onCompleted(),c.remove(v)};try{e=n(t)}catch(y){return u.onError(y),r}v.setDisposable(e.take(1).subscribe(i,u.onError.bind(u),function(){s()})),h=l.getValues();for(var g=0;h.length>g;g++){try{a=o(h[g],t)}catch(y){return u.onError(y),r}u.onNext(a)}},u.onError.bind(u),function(){f=!0,(a||0===d.count())&&u.onCompleted()})),c})},w.groupJoin=function(t,e,n,i){var o=this;return new x(function(s){var u=function(){},c=new b,a=new v(c),h=new _,l=new _,f=0,p=0;return c.add(o.subscribe(function(t){var n=new g,o=f++;h.add(o,n);var p,d,b,v,y;try{y=i(t,C(n,a))}catch(w){for(b=h.getValues(),p=0,d=b.length;d>p;p++)b[p].onError(w);return s.onError(w),r}for(s.onNext(y),v=l.getValues(),p=0,d=v.length;d>p;p++)n.onNext(v[p]);var E=new m;c.add(E);var x,D=function(){h.remove(o)&&n.onCompleted(),c.remove(E)};try{x=e(t)}catch(w){for(b=h.getValues(),p=0,d=h.length;d>p;p++)b[p].onError(w);return s.onError(w),r}E.setDisposable(x.take(1).subscribe(u,function(t){for(b=h.getValues(),p=0,d=b.length;d>p;p++)b[p].onError(t);s.onError(t)},D))},function(t){for(var e=h.getValues(),n=0,r=e.length;r>n;n++)e[n].onError(t);s.onError(t)},s.onCompleted.bind(s))),c.add(t.subscribe(function(t){var e,i,o,a=p++;l.add(a,t);var f=new m;c.add(f);var d,b=function(){l.remove(a),c.remove(f)};try{d=n(t)}catch(v){for(e=h.getValues(),i=0,o=h.length;o>i;i++)e[i].onError(v);return s.onError(v),r}for(f.setDisposable(d.take(1).subscribe(u,function(t){for(e=h.getValues(),i=0,o=h.length;o>i;i++)e[i].onError(t);s.onError(t)},b)),e=h.getValues(),i=0,o=e.length;o>i;i++)e[i].onNext(t)},function(t){for(var e=h.getValues(),n=0,r=e.length;r>n;n++)e[n].onError(t);s.onError(t)})),a})},w.buffer=function(){return this.window.apply(this,arguments).selectMany(function(t){return t.toArray()})},w.window=function(t,e){return 1===arguments.length&&"function"!=typeof arguments[0]?f.call(this,t):"function"==typeof t?p.call(this,t):l.call(this,t,e)},n});
!function(a,b){var c="object"==typeof exports&&exports,d=("object"==typeof module&&module&&module.exports==c&&module,"object"==typeof global&&global);d.global===d&&(window=d),"function"==typeof define&&define.amd?define(["rx","exports"],function(c,d){return a.Rx=b(a,d,c),a.Rx}):"object"==typeof module&&module&&module.exports===c?module.exports=b(a,module.exports,require("./rx")):a.Rx=b(a,{},a.Rx)}(this,function(a,b,c,d){function e(){}function f(a,b){return a===b}function g(a){if(a&!1)return 2===a;for(var b=Math.sqrt(a),c=3;b>=c;){if(0===a%c)return!1;c+=2}return!0}function h(a){var b,c,d;for(b=0;b<y.length;++b)if(c=y[b],c>=a)return c;for(d=1|a;d<y[y.length-1];){if(g(d))return d;d+=2}return a}function i(a){var b=757602046;if(!a.length)return b;for(var c=0,d=a.length;d>c;c++){var e=a.charCodeAt(c);b=(b<<5)-b+e,b&=b}return b}function j(a){var b=668265261;return a=61^a^a>>>16,a+=a<<3,a^=a>>>4,a*=b,a^=a>>>15}function k(){return{key:null,value:null,next:0,hashCode:0}}function l(a,b){return a.groupJoin(this,b,function(){return v()},function(a,b){return b})}function m(a){var b=this;return new w(function(c){var d=new t,e=new p,f=new q(e);return c.onNext(x(d,f)),e.add(b.subscribe(function(a){d.onNext(a)},function(a){d.onError(a),c.onError(a)},function(){d.onCompleted(),c.onCompleted()})),e.add(a.subscribe(function(){d.onCompleted(),d=new t,c.onNext(x(d,f))},function(a){d.onError(a),c.onError(a)},function(){d.onCompleted(),c.onCompleted()})),f})}function n(a){var b=this;return new w(function(c){var d,f=new s,g=new p(f),h=new q(g),i=new t;return c.onNext(x(i,h)),g.add(b.subscribe(function(a){i.onNext(a)},function(a){i.onError(a),c.onError(a)},function(){i.onCompleted(),c.onCompleted()})),d=function(){var b,g;try{g=a()}catch(j){return c.onError(j),void 0}b=new r,f.setDisposable(b),b.setDisposable(g.take(1).subscribe(e,function(a){i.onError(a),c.onError(a)},function(){i.onCompleted(),i=new t,c.onNext(x(i,h)),d()}))},d(),h})}var o=c.Observable,p=c.CompositeDisposable,q=c.RefCountDisposable,r=c.SingleAssignmentDisposable,s=c.SerialDisposable,t=c.Subject,u=o.prototype,v=o.empty,w=c.Internals.AnonymousObservable,x=(c.Observer.create,c.Internals.addRef),y=[1,3,7,13,31,61,127,251,509,1021,2039,4093,8191,16381,32749,65521,131071,262139,524287,1048573,2097143,4194301,8388593,16777213,33554393,67108859,134217689,268435399,536870909,1073741789,2147483647],z="no such key",A="duplicate key",B=function(){var a=0;return function(b){if(null==b)throw new Error(z);if("string"==typeof b)return i(b);if("number"==typeof b)return j(b);if("boolean"==typeof b)return b===!0?1:0;if(b instanceof Date)return b.getTime();if(b.getHashCode)return b.getHashCode();var c=17*a++;return b.getHashCode=function(){return c},c}}(),C=function(a,b){if(0>a)throw new Error("out of range");a>0&&this._initialize(a),this.comparer=b||f,this.freeCount=0,this.size=0,this.freeList=-1};return C.prototype._initialize=function(a){var b,c=h(a);for(this.buckets=new Array(c),this.entries=new Array(c),b=0;c>b;b++)this.buckets[b]=-1,this.entries[b]=k();this.freeList=-1},C.prototype.count=function(){return this.size},C.prototype.add=function(a,b){return this._insert(a,b,!0)},C.prototype._insert=function(a,b,c){this.buckets||this._initialize(0);for(var d,e=2147483647&B(a),f=e%this.buckets.length,g=this.buckets[f];g>=0;g=this.entries[g].next)if(this.entries[g].hashCode===e&&this.comparer(this.entries[g].key,a)){if(c)throw new Error(A);return this.entries[g].value=b,void 0}this.freeCount>0?(d=this.freeList,this.freeList=this.entries[d].next,--this.freeCount):(this.size===this.entries.length&&(this._resize(),f=e%this.buckets.length),d=this.size,++this.size),this.entries[d].hashCode=e,this.entries[d].next=this.buckets[f],this.entries[d].key=a,this.entries[d].value=b,this.buckets[f]=d},C.prototype._resize=function(){var a=h(2*this.size),b=new Array(a);for(d=0;d<b.length;++d)b[d]=-1;var c=new Array(a);for(d=0;d<this.size;++d)c[d]=this.entries[d];for(var d=this.size;a>d;++d)c[d]=k();for(var e=0;e<this.size;++e){var f=c[e].hashCode%a;c[e].next=b[f],b[f]=e}this.buckets=b,this.entries=c},C.prototype.remove=function(a){if(this.buckets)for(var b=2147483647&B(a),c=b%this.buckets.length,d=-1,e=this.buckets[c];e>=0;e=this.entries[e].next){if(this.entries[e].hashCode===b&&this.comparer(this.entries[e].key,a))return 0>d?this.buckets[c]=this.entries[e].next:this.entries[d].next=this.entries[e].next,this.entries[e].hashCode=-1,this.entries[e].next=this.freeList,this.entries[e].key=null,this.entries[e].value=null,this.freeList=e,++this.freeCount,!0;d=e}return!1},C.prototype.clear=function(){var a,b;if(!(this.size<=0)){for(a=0,b=this.buckets.length;b>a;++a)this.buckets[a]=-1;for(a=0;a<this.size;++a)this.entries[a]=k();this.freeList=-1,this.size=0}},C.prototype._findEntry=function(a){if(this.buckets)for(var b=2147483647&B(a),c=this.buckets[b%this.buckets.length];c>=0;c=this.entries[c].next)if(this.entries[c].hashCode===b&&this.comparer(this.entries[c].key,a))return c;return-1},C.prototype.count=function(){return this.size-this.freeCount},C.prototype.tryGetValue=function(a){var b=this._findEntry(a);return b>=0?this.entries[b].value:d},C.prototype.getValues=function(){var a=0,b=[];if(this.entries)for(var c=0;c<this.size;c++)this.entries[c].hashCode>=0&&(b[a++]=this.entries[c].value);return b},C.prototype.get=function(a){var b=this._findEntry(a);if(b>=0)return this.entries[b].value;throw new Error(z)},C.prototype.set=function(a,b){this._insert(a,b,!1)},C.prototype.containskey=function(a){return this._findEntry(a)>=0},u.join=function(a,b,c,d){var f=this;return new w(function(g){var h=new p,i=!1,j=0,k=new C,l=!1,m=0,n=new C;return h.add(f.subscribe(function(a){var c,f,l,m,o=j++,p=new r;k.add(o,a),h.add(p),f=function(){return k.remove(o)&&0===k.count()&&i&&g.onCompleted(),h.remove(p)};try{c=b(a)}catch(q){return g.onError(q),void 0}p.setDisposable(c.take(1).subscribe(e,g.onError.bind(g),function(){f()})),m=n.getValues();for(var s=0;s<m.length;s++){try{l=d(a,m[s])}catch(t){return g.onError(t),void 0}g.onNext(l)}},g.onError.bind(g),function(){i=!0,(l||0===k.count())&&g.onCompleted()})),h.add(a.subscribe(function(a){var b,f,i,j,o=m++,p=new r;n.add(o,a),h.add(p),f=function(){return n.remove(o)&&0===n.count()&&l&&g.onCompleted(),h.remove(p)};try{b=c(a)}catch(q){return g.onError(q),void 0}p.setDisposable(b.take(1).subscribe(e,g.onError.bind(g),function(){f()})),j=k.getValues();for(var s=0;s<j.length;s++){try{i=d(j[s],a)}catch(q){return g.onError(q),void 0}g.onNext(i)}},g.onError.bind(g),function(){l=!0,(i||0===n.count())&&g.onCompleted()})),h})},u.groupJoin=function(a,b,c,d){var e=this;return new w(function(f){var g=function(){},h=new p,i=new q(h),j=new C,k=new C,l=0,m=0;return h.add(e.subscribe(function(a){var c=new t,e=l++;j.add(e,c);var m,n,o,p,q;try{q=d(a,x(c,i))}catch(s){for(o=j.getValues(),m=0,n=o.length;n>m;m++)o[m].onError(s);return f.onError(s),void 0}for(f.onNext(q),p=k.getValues(),m=0,n=p.length;n>m;m++)c.onNext(p[m]);var u=new r;h.add(u);var v,w=function(){j.remove(e)&&c.onCompleted(),h.remove(u)};try{v=b(a)}catch(s){for(o=j.getValues(),m=0,n=j.length;n>m;m++)o[m].onError(s);return f.onError(s),void 0}u.setDisposable(v.take(1).subscribe(g,function(a){for(o=j.getValues(),m=0,n=o.length;n>m;m++)o[m].onError(a);f.onError(a)},w))},function(a){for(var b=j.getValues(),c=0,d=b.length;d>c;c++)b[c].onError(a);f.onError(a)},f.onCompleted.bind(f))),h.add(a.subscribe(function(a){var b,d,e,i=m++;k.add(i,a);var l=new r;h.add(l);var n,o=function(){k.remove(i),h.remove(l)};try{n=c(a)}catch(p){for(b=j.getValues(),d=0,e=j.length;e>d;d++)b[d].onError(p);return f.onError(p),void 0}for(l.setDisposable(n.take(1).subscribe(g,function(a){for(b=j.getValues(),d=0,e=j.length;e>d;d++)b[d].onError(a);f.onError(a)},o)),b=j.getValues(),d=0,e=b.length;e>d;d++)b[d].onNext(a)},function(a){for(var b=j.getValues(),c=0,d=b.length;d>c;c++)b[c].onError(a);f.onError(a)})),i})},u.buffer=function(){return this.window.apply(this,arguments).selectMany(function(a){return a.toArray()})},u.window=function(a,b){return 1===arguments.length&&"function"!=typeof arguments[0]?m.call(this,a):"function"==typeof a?n.call(this,a):l.call(this,a,b)},c});

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

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

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

*/
observableProto.letBind = function (func) {
observableProto.letBind = observableProto['let'] = function (func) {
return func(this);

@@ -79,0 +79,0 @@ };

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

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

@@ -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 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.setDisposable(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});
!function(a,b){var c="object"==typeof exports&&exports,d=("object"==typeof module&&module&&module.exports==c&&module,"object"==typeof global&&global);d.global===d&&(window=d),"function"==typeof define&&define.amd?define(["rx","exports"],function(c,d){return a.Rx=b(a,d,c),a.Rx}):"object"==typeof module&&module&&module.exports===c?module.exports=b(a,module.exports,require("./rx")):a.Rx=b(a,{},a.Rx)}(this,function(a,b,c){function d(){}function e(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:s.call(a)}function f(a){this.patterns=a}function g(a,b){this.expression=a,this.selector=b}function h(a,b,c){var d=a.get(b);if(!d){var e=new u(b,c);return a.set(b,e),e}return d}function i(a,b,c){var d,e;for(this.joinObserverArray=a,this.onNext=b,this.onCompleted=c,this.joinObservers=new t,d=0;d<this.joinObserverArray.length;d++)e=this.joinObserverArray[d],this.joinObservers.set(e,e)}var j=c.Observable,k=j.prototype,l=c.Internals.AnonymousObservable,m=j.throwException,n=c.Observer.create,o=c.SingleAssignmentDisposable,p=c.CompositeDisposable,q=c.Internals.AbstractObserver;c.Internals.isEqual;var r=c.Internals.inherits,s=Array.prototype.slice,t=function(){function a(){this.keys=[],this.values=[]}return a.prototype["delete"]=function(a){var b=this.keys.indexOf(a);return-1!==b&&(this.keys.splice(b,1),this.values.splice(b,1)),-1!==b},a.prototype.get=function(a,b){var c=this.keys.indexOf(a);return-1!==c?this.values[c]:b},a.prototype.set=function(a,b){var c=this.keys.indexOf(a);-1!==c&&(this.values[c]=b),this.values[this.keys.push(a)-1]=b},a.prototype.size=function(){return this.keys.length},a.prototype.has=function(a){return-1!==this.keys.indexOf(a)},a.prototype.getKeys=function(){return this.keys.slice(0)},a.prototype.getValues=function(){return this.values.slice(0)},a}();f.prototype.and=function(a){var b=this.patterns.slice(0);return b.push(a),new f(b)},f.prototype.then=function(a){return new g(this,a)},g.prototype.activate=function(a,b,c){for(var d=this,e=[],f=0,g=this.expression.patterns.length;g>f;f++)e.push(h(a,this.expression.patterns[f],b.onError.bind(b)));var j=new i(e,function(){var a;try{a=d.selector.apply(d,arguments)}catch(c){return b.onError(c),void 0}b.onNext(a)},function(){for(var a=0,b=e.length;b>a;a++)e[a].removeActivePlan(j);c(j)});for(f=0,g=e.length;g>f;f++)e[f].addActivePlan(j);return j},i.prototype.dequeue=function(){for(var a=this.joinObservers.getValues(),b=0,c=a.length;c>b;b++)a[b].queue.shift()},i.prototype.match=function(){var a,b,c,d,e,f=!0;for(b=0,c=this.joinObserverArray.length;c>b;b++)if(0===this.joinObserverArray[b].queue.length){f=!1;break}if(f){for(a=[],d=!1,b=0,c=this.joinObserverArray.length;c>b;b++)a.push(this.joinObserverArray[b].queue[0]),"C"===this.joinObserverArray[b].queue[0].kind&&(d=!0);if(d)this.onCompleted();else{for(this.dequeue(),e=[],b=0;b<a.length;b++)e.push(a[b].value);this.onNext.apply(this,e)}}};var u=function(a){function b(b,c){a.call(this),this.source=b,this.onError=c,this.queue=[],this.activePlans=[],this.subscription=new o,this.isDisposed=!1}r(b,a);var c=b.prototype;return c.next=function(a){if(!this.isDisposed){if("E"===a.kind)return this.onError(a.exception),void 0;this.queue.push(a);for(var b=this.activePlans.slice(0),c=0,d=b.length;d>c;c++)b[c].match()}},c.error=d,c.completed=d,c.addActivePlan=function(a){this.activePlans.push(a)},c.subscribe=function(){this.subscription.setDisposable(this.source.materialize().subscribe(this))},c.removeActivePlan=function(a){var b=this.activePlans.indexOf(a);this.activePlans.splice(b,1),0===this.activePlans.length&&this.dispose()},c.dispose=function(){a.prototype.dispose.call(this),this.isDisposed||(this.isDisposed=!0,this.subscription.dispose())},b}(q);return k.and=function(a){return new f([this,a])},k.then=function(a){return new f([this]).then(a)},j.when=function(){var a=e(arguments,0);return new l(function(b){var c,d,e,f,g,h,i=[],j=new t;h=n(b.onNext.bind(b),function(a){for(var c=j.getValues(),d=0,e=c.length;e>d;d++)c[d].onError(a);b.onError(a)},b.onCompleted.bind(b));try{for(d=0,e=a.length;e>d;d++)i.push(a[d].activate(j,h,function(a){var b=i.indexOf(a);i.splice(b,1),0===i.length&&h.onCompleted()}))}catch(k){m(k).subscribe(b)}for(c=new p,g=j.getValues(),d=0,e=g.length;e>d;d++)f=g[d],f.subscribe(),c.add(f);return c})},c});

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

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

@@ -46,4 +46,2 @@ var Rx = require('./rx');

/**
* @deprecated Use Rx.Observable.fromEvent from rx.async.js instead.
*
* Handles an event from the given EventEmitter as an observable sequence.

@@ -53,6 +51,17 @@ *

* @param {String} eventName The event name to subscribe
* @returns {Observable} An observable sequence generated from the named event from the given EventEmitter.
* @returns {Observable} An observable sequence generated from the named event from the given EventEmitter. The data will be returned as an array of arguments to the handler.
*/
fromEvent: function (eventEmitter, eventName) {
return Observable.fromEvent(eventEmitter, eventName);
return Observable.create(function (observer) {
function handler () {
observer.onNext(arguments);
}
eventEmitter.addListener(eventName, handler);
return function () {
eventEmitter.removeListener(eventName, handler);
};
});
},

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

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

* @example
* 1 - res = Rx.Observable.timer(new Date());
* 2 - res = Rx.Observable.timer(new Date(), Rx.Scheduler.timeout);
* 1 - res = Rx.Observable.delay(new Date());
* 2 - res = Rx.Observable.delay(new Date(), Rx.Scheduler.timeout);
*

@@ -236,0 +236,0 @@ * 3 - res = Rx.Observable.delay(5000);

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

(function(t,e){var n="object"==typeof exports&&exports,r=("object"==typeof module&&module&&module.exports==n&&module,"object"==typeof global&&global);r.global===r&&(window=r),"function"==typeof define&&define.amd?define(["rx","exports"],function(n,r){return t.Rx=e(t,r,n),t.Rx}):"object"==typeof module&&module&&module.exports===n?module.exports=e(t,module.exports,require("./rx")):t.Rx=e(t,{},t.Rx)})(this,function(t,e,n,r){function i(t,e){return new p(function(n){return e.scheduleWithAbsolute(t,function(){n.onNext(0),n.onCompleted()})})}function o(t,e,n){var r=N(e);return new p(function(e){var i=0,o=t;return n.scheduleRecursiveWithAbsolute(o,function(t){var s;r>0&&(s=n.now(),o+=r,s>=o&&(o=s+r)),e.onNext(i++),t(o)})})}function s(t,e){var n=N(t);return new p(function(t){return e.scheduleWithRelative(n,function(){t.onNext(0),t.onCompleted()})})}function u(t,e,n){return t===e?new p(function(t){return n.schedulePeriodicWithState(0,e,function(e){return t.onNext(e),e+1})}):d(function(){return o(n.now()+t,e,n)})}function c(t,e){var n=this;return new p(function(r){var i,o=!1,s=new x,u=null,c=[],a=!1;return i=n.materialize().timestamp(e).subscribe(function(n){var i,l;"E"===n.value.kind?(c=[],c.push(n),u=n.value.exception,l=!a):(c.push({value:n.value,timestamp:n.timestamp+t}),l=!o,o=!0),l&&(null!==u?r.onError(u):(i=new g,s.setDisposable(i),i.setDisposable(e.scheduleRecursiveWithRelative(t,function(t){var n,i,s,l;if(null===u){a=!0;do s=null,c.length>0&&0>=c[0].timestamp-e.now()&&(s=c.shift().value),null!==s&&s.accept(r);while(null!==s);l=!1,i=0,c.length>0?(l=!0,i=Math.max(0,c[0].timestamp-e.now())):o=!1,n=u,a=!1,null!==n?r.onError(n):l&&t(i)}}))))}),new E(i,s)})}function a(t,e){var n=this;return d(function(){var r=t-e.now();return c.call(n,r,e)})}function l(t,e){return new p(function(n){function r(){s&&(s=!1,n.onNext(o)),i&&n.onCompleted()}var i,o,s;return new E(t.subscribe(function(t){s=!0,o=t},n.onError.bind(n),function(){i=!0}),e.subscribe(r,n.onError.bind(n),r))})}var h=n.Observable,f=h.prototype,p=n.Internals.AnonymousObservable,d=h.defer,b=h.empty,v=h.never,m=h.throwException,y=h.fromArray,w=n.Scheduler.timeout,g=n.SingleAssignmentDisposable,x=n.SerialDisposable,E=n.CompositeDisposable,C=n.RefCountDisposable,D=n.Subject,A=(n.Internals.BinaryObserver,n.Internals.addRef),N=n.Scheduler.normalize,S=h.interval=function(t,e){return e||(e=w),u(t,t,e)},O=h.timer=function(t,e,n){var c;return n||(n=w),e!==r&&"number"==typeof e?c=e:e!==r&&"object"==typeof e&&(n=e),t instanceof Date&&c===r?i(t.getTime(),n):t instanceof Date&&c!==r?(c=e,o(t.getTime(),c,n)):c===r?s(t,n):u(t,c,n)};return f.delay=function(t,e){return e||(e=w),t instanceof Date?a.call(this,t.getTime(),e):c.call(this,t,e)},f.throttle=function(t,e){e||(e=w);var n=this;return new p(function(r){var i,o=new x,s=!1,u=0,c=null;return i=n.subscribe(function(n){var i,a;s=!0,c=n,u++,i=u,a=new g,o.setDisposable(a),a.setDisposable(e.scheduleWithRelative(t,function(){s&&u===i&&r.onNext(c),s=!1}))},function(t){o.dispose(),r.onError(t),s=!1,u++},function(){o.dispose(),s&&r.onNext(c),r.onCompleted(),s=!1,u++}),new E(i,o)})},f.windowWithTime=function(t,e,n){var i,o=this;return e===r&&(i=t),n===r&&(n=w),"number"==typeof e?i=e:"object"==typeof e&&(i=t,n=e),new p(function(e){function r(){var t=new g,o=!1,s=!1;h.setDisposable(t),a===c?(o=!0,s=!0):c>a?o=!0:s=!0;var p=o?a:c,d=p-f;f=p,o&&(a+=i),s&&(c+=i),t.setDisposable(n.scheduleWithRelative(d,function(){var t;s&&(t=new D,l.push(t),e.onNext(A(t,u))),o&&(t=l.shift(),t.onCompleted()),r()}))}var s,u,c=i,a=t,l=[],h=new x,f=0;return s=new E(h),u=new C(s),l.push(new D),e.onNext(A(l[0],u)),r(),s.add(o.subscribe(function(t){var e,n;for(e=0;l.length>e;e++)n=l[e],n.onNext(t)},function(t){var n,r;for(n=0;l.length>n;n++)r=l[n],r.onError(t);e.onError(t)},function(){var t,n;for(t=0;l.length>t;t++)n=l[t],n.onCompleted();e.onCompleted()})),u})},f.windowWithTimeOrCount=function(t,e,n){var r=this;return n||(n=w),new p(function(i){var o,s,u,c,a=0,l=new x,h=0;return s=new E(l),u=new C(s),o=function(e){var r=new g;l.setDisposable(r),r.setDisposable(n.scheduleWithRelative(t,function(){var t;e===h&&(a=0,t=++h,c.onCompleted(),c=new D,i.onNext(A(c,u)),o(t))}))},c=new D,i.onNext(A(c,u)),o(0),s.add(r.subscribe(function(t){var n=0,r=!1;c.onNext(t),a++,a===e&&(r=!0,a=0,n=++h,c.onCompleted(),c=new D,i.onNext(A(c,u))),r&&o(n)},function(t){c.onError(t),i.onError(t)},function(){c.onCompleted(),i.onCompleted()})),u})},f.bufferWithTime=function(){return this.windowWithTime.apply(this,arguments).selectMany(function(t){return t.toArray()})},f.bufferWithTimeOrCount=function(t,e,n){return this.windowWithTimeOrCount(t,e,n).selectMany(function(t){return t.toArray()})},f.timeInterval=function(t){var e=this;return t||(t=w),d(function(){var n=t.now();return e.select(function(e){var r=t.now(),i=r-n;return n=r,{value:e,interval:i}})})},f.timestamp=function(t){return t||(t=w),this.select(function(e){return{value:e,timestamp:t.now()}})},f.sample=function(t,e){return e||(e=w),"number"==typeof t?l(this,S(t,e)):l(this,t)},f.timeout=function(t,e,n){var r,i=this;return e||(e=m(Error("Timeout"))),n||(n=w),r=t instanceof Date?function(t,e){n.scheduleWithAbsolute(t,e)}:function(t,e){n.scheduleWithRelative(t,e)},new p(function(n){var o,s=0,u=new g,c=new x,a=!1,l=new x;return c.setDisposable(u),o=function(){var i=s;l.setDisposable(r(t,function(){a=s===i;var t=a;t&&c.setDisposable(e.subscribe(n))}))},o(),u.setDisposable(i.subscribe(function(t){var e=!a;e&&(s++,n.onNext(t),o())},function(t){var e=!a;e&&(s++,n.onError(t))},function(){var t=!a;t&&(s++,n.onCompleted())})),new E(c,l)})},h.generateWithAbsoluteTime=function(t,e,n,i,o,s){return s||(s=w),new p(function(u){var c,a,l=!0,h=!1,f=t;return s.scheduleRecursiveWithAbsolute(s.now(),function(t){h&&u.onNext(c);try{l?l=!1:f=n(f),h=e(f),h&&(c=i(f),a=o(f))}catch(s){return u.onError(s),r}h?t(a):u.onCompleted()})})},h.generateWithRelativeTime=function(t,e,n,i,o,s){return s||(s=w),new p(function(u){var c,a,l=!0,h=!1,f=t;return s.scheduleRecursiveWithRelative(0,function(t){h&&u.onNext(c);try{l?l=!1:f=n(f),h=e(f),h&&(c=i(f),a=o(f))}catch(s){return u.onError(s),r}h?t(a):u.onCompleted()})})},f.delaySubscription=function(t,e){return e||(e=w),this.delayWithSelector(O(t,e),function(){return b()})},f.delayWithSelector=function(t,e){var n,i,o=this;return"function"==typeof t?i=t:(n=t,i=e),new p(function(t){var e=new E,s=!1,u=function(){s&&0===e.length&&t.onCompleted()},c=new x,a=function(){c.setDisposable(o.subscribe(function(n){var o;try{o=i(n)}catch(s){return t.onError(s),r}var c=new g;e.add(c),c.setDisposable(o.subscribe(function(){t.onNext(n),e.remove(c),u()},t.onError.bind(t),function(){t.onNext(n),e.remove(c),u()}))},t.onError.bind(t),function(){s=!0,c.dispose(),u()}))};return n?c.setDisposable(n.subscribe(function(){a()},t.onError.bind(t),function(){a()})):a(),new E(c,e)})},f.timeoutWithSelector=function(t,e,n){if(1===arguments.length){e=t;var t=v()}n||(n=m(Error("Timeout")));var i=this;return new p(function(o){var s=new x,u=new x,c=new g;s.setDisposable(c);var a=0,l=!1,h=function(t){var e=a,r=function(){return a===e},i=new g;u.setDisposable(i),i.setDisposable(t.subscribe(function(){r()&&s.setDisposable(n.subscribe(o)),i.dispose()},function(t){r()&&o.onError(t)},function(){r()&&s.setDisposable(n.subscribe(o))}))};h(t);var f=function(){var t=!l;return t&&a++,t};return c.setDisposable(i.subscribe(function(t){if(f()){o.onNext(t);var n;try{n=e(t)}catch(i){return o.onError(i),r}h(n)}},function(t){f()&&o.onError(t)},function(){f()&&o.onCompleted()})),new E(s,u)})},f.throttleWithSelector=function(t){var e=this;return new p(function(n){var i,o=!1,s=new x,u=0,c=e.subscribe(function(e){var c;try{c=t(e)}catch(a){return n.onError(a),r}o=!0,i=e,u++;var l=u,h=new g;s.setDisposable(h),h.setDisposable(c.subscribe(function(){o&&u===l&&n.onNext(i),o=!1,h.dispose()},n.onError.bind(n),function(){o&&u===l&&n.onNext(i),o=!1,h.dispose()}))},function(t){s.dispose(),n.onError(t),o=!1,u++},function(){s.dispose(),o&&n.onNext(i),n.onCompleted(),o=!1,u++});return new E(c,s)})},f.skipLastWithTime=function(t,e){e||(e=w);var n=this;return new p(function(r){var i=[];return n.subscribe(function(n){var o=e.now();for(i.push({interval:o,value:n});i.length>0&&o-i[0].interval>=t;)r.onNext(i.shift().value)},r.onError.bind(r),function(){for(var n=e.now();i.length>0&&n-i[0].interval>=t;)r.onNext(i.shift().value);r.onCompleted()})})},f.takeLastWithTime=function(t,e,n){return this.takeLastBufferWithTime(t,e).selectMany(function(t){return y(t,n)})},f.takeLastBufferWithTime=function(t,e){var n=this;return e||(e=w),new p(function(r){var i=[];return n.subscribe(function(n){var r=e.now();for(i.push({interval:r,value:n});i.length>0&&r-i[0].interval>=t;)i.shift()},r.onError.bind(r),function(){for(var n=e.now(),o=[];i.length>0;){var s=i.shift();t>=n-s.interval&&o.push(s.value)}r.onNext(o),r.onCompleted()})})},f.takeWithTime=function(t,e){var n=this;return e||(e=w),new p(function(r){var i=e.scheduleWithRelative(t,function(){r.onCompleted()});return new E(i,n.subscribe(r))})},f.skipWithTime=function(t,e){var n=this;return e||(e=w),new p(function(r){var i=!1,o=e.scheduleWithRelative(t,function(){i=!0}),s=n.subscribe(function(t){i&&r.onNext(t)},r.onError.bind(r),r.onCompleted.bind(r));return new E(o,s)})},f.skipUntilWithTime=function(t,e){e||(e=w);var n=this;return new p(function(r){var i=!1,o=e.scheduleWithAbsolute(t,function(){i=!0}),s=n.subscribe(function(t){i&&r.onNext(t)},r.onError.bind(r),r.onCompleted.bind(r));return new E(o,s)})},f.takeUntilWithTime=function(t,e){e||(e=w);var n=this;return new p(function(r){return new E(e.scheduleWithAbsolute(t,function(){r.onCompleted()}),n.subscribe(r))})},n});
!function(a,b){var c="object"==typeof exports&&exports,d=("object"==typeof module&&module&&module.exports==c&&module,"object"==typeof global&&global);d.global===d&&(window=d),"function"==typeof define&&define.amd?define(["rx","exports"],function(c,d){return a.Rx=b(a,d,c),a.Rx}):"object"==typeof module&&module&&module.exports===c?module.exports=b(a,module.exports,require("./rx")):a.Rx=b(a,{},a.Rx)}(this,function(a,b,c,d){function e(a,b){return new n(function(c){return b.scheduleWithAbsolute(a,function(){c.onNext(0),c.onCompleted()})})}function f(a,b,c){var d=A(b);return new n(function(b){var e=0,f=a;return c.scheduleRecursiveWithAbsolute(f,function(a){var g;d>0&&(g=c.now(),f+=d,g>=f&&(f=g+d)),b.onNext(e++),a(f)})})}function g(a,b){var c=A(a);return new n(function(a){return b.scheduleWithRelative(c,function(){a.onNext(0),a.onCompleted()})})}function h(a,b,c){return a===b?new n(function(a){return c.schedulePeriodicWithState(0,b,function(b){return a.onNext(b),b+1})}):o(function(){return f(c.now()+a,b,c)})}function i(a,b){var c=this;return new n(function(d){var e,f=!1,g=new v,h=null,i=[],j=!1;return e=c.materialize().timestamp(b).subscribe(function(c){var e,k;"E"===c.value.kind?(i=[],i.push(c),h=c.value.exception,k=!j):(i.push({value:c.value,timestamp:c.timestamp+a}),k=!f,f=!0),k&&(null!==h?d.onError(h):(e=new u,g.setDisposable(e),e.setDisposable(b.scheduleRecursiveWithRelative(a,function(a){var c,e,g,k;if(null===h){j=!0;do g=null,i.length>0&&i[0].timestamp-b.now()<=0&&(g=i.shift().value),null!==g&&g.accept(d);while(null!==g);k=!1,e=0,i.length>0?(k=!0,e=Math.max(0,i[0].timestamp-b.now())):f=!1,c=h,j=!1,null!==c?d.onError(c):k&&a(e)}}))))}),new w(e,g)})}function j(a,b){var c=this;return o(function(){var d=a-b.now();return i.call(c,d,b)})}function k(a,b){return new n(function(c){function d(){g&&(g=!1,c.onNext(f)),e&&c.onCompleted()}var e,f,g;return new w(a.subscribe(function(a){g=!0,f=a},c.onError.bind(c),function(){e=!0}),b.subscribe(d,c.onError.bind(c),d))})}var l=c.Observable,m=l.prototype,n=c.Internals.AnonymousObservable,o=l.defer,p=l.empty,q=l.never,r=l.throwException,s=l.fromArray,t=c.Scheduler.timeout,u=c.SingleAssignmentDisposable,v=c.SerialDisposable,w=c.CompositeDisposable,x=c.RefCountDisposable,y=c.Subject,z=(c.Internals.BinaryObserver,c.Internals.addRef),A=c.Scheduler.normalize,B=l.interval=function(a,b){return b||(b=t),h(a,a,b)},C=l.timer=function(a,b,c){var i;return c||(c=t),b!==d&&"number"==typeof b?i=b:b!==d&&"object"==typeof b&&(c=b),a instanceof Date&&i===d?e(a.getTime(),c):a instanceof Date&&i!==d?(i=b,f(a.getTime(),i,c)):i===d?g(a,c):h(a,i,c)};return m.delay=function(a,b){return b||(b=t),a instanceof Date?j.call(this,a.getTime(),b):i.call(this,a,b)},m.throttle=function(a,b){b||(b=t);var c=this;return new n(function(d){var e,f=new v,g=!1,h=0,i=null;return e=c.subscribe(function(c){var e,j;g=!0,i=c,h++,e=h,j=new u,f.setDisposable(j),j.setDisposable(b.scheduleWithRelative(a,function(){g&&h===e&&d.onNext(i),g=!1}))},function(a){f.dispose(),d.onError(a),g=!1,h++},function(){f.dispose(),g&&d.onNext(i),d.onCompleted(),g=!1,h++}),new w(e,f)})},m.windowWithTime=function(a,b,c){var e,f=this;return b===d&&(e=a),c===d&&(c=t),"number"==typeof b?e=b:"object"==typeof b&&(e=a,c=b),new n(function(b){function d(){var a=new u,f=!1,g=!1;l.setDisposable(a),j===i?(f=!0,g=!0):i>j?f=!0:g=!0;var n=f?j:i,o=n-m;m=n,f&&(j+=e),g&&(i+=e),a.setDisposable(c.scheduleWithRelative(o,function(){var a;g&&(a=new y,k.push(a),b.onNext(z(a,h))),f&&(a=k.shift(),a.onCompleted()),d()}))}var g,h,i=e,j=a,k=[],l=new v,m=0;return g=new w(l),h=new x(g),k.push(new y),b.onNext(z(k[0],h)),d(),g.add(f.subscribe(function(a){var b,c;for(b=0;b<k.length;b++)c=k[b],c.onNext(a)},function(a){var c,d;for(c=0;c<k.length;c++)d=k[c],d.onError(a);b.onError(a)},function(){var a,c;for(a=0;a<k.length;a++)c=k[a],c.onCompleted();b.onCompleted()})),h})},m.windowWithTimeOrCount=function(a,b,c){var d=this;return c||(c=t),new n(function(e){var f,g,h,i,j=0,k=new v,l=0;return g=new w(k),h=new x(g),f=function(b){var d=new u;k.setDisposable(d),d.setDisposable(c.scheduleWithRelative(a,function(){var a;b===l&&(j=0,a=++l,i.onCompleted(),i=new y,e.onNext(z(i,h)),f(a))}))},i=new y,e.onNext(z(i,h)),f(0),g.add(d.subscribe(function(a){var c=0,d=!1;i.onNext(a),j++,j===b&&(d=!0,j=0,c=++l,i.onCompleted(),i=new y,e.onNext(z(i,h))),d&&f(c)},function(a){i.onError(a),e.onError(a)},function(){i.onCompleted(),e.onCompleted()})),h})},m.bufferWithTime=function(){return this.windowWithTime.apply(this,arguments).selectMany(function(a){return a.toArray()})},m.bufferWithTimeOrCount=function(a,b,c){return this.windowWithTimeOrCount(a,b,c).selectMany(function(a){return a.toArray()})},m.timeInterval=function(a){var b=this;return a||(a=t),o(function(){var c=a.now();return b.select(function(b){var d=a.now(),e=d-c;return c=d,{value:b,interval:e}})})},m.timestamp=function(a){return a||(a=t),this.select(function(b){return{value:b,timestamp:a.now()}})},m.sample=function(a,b){return b||(b=t),"number"==typeof a?k(this,B(a,b)):k(this,a)},m.timeout=function(a,b,c){var d,e=this;return b||(b=r(new Error("Timeout"))),c||(c=t),d=a instanceof Date?function(a,b){c.scheduleWithAbsolute(a,b)}:function(a,b){c.scheduleWithRelative(a,b)},new n(function(c){var f,g=0,h=new u,i=new v,j=!1,k=new v;return i.setDisposable(h),f=function(){var e=g;k.setDisposable(d(a,function(){j=g===e;var a=j;a&&i.setDisposable(b.subscribe(c))}))},f(),h.setDisposable(e.subscribe(function(a){var b=!j;b&&(g++,c.onNext(a),f())},function(a){var b=!j;b&&(g++,c.onError(a))},function(){var a=!j;a&&(g++,c.onCompleted())})),new w(i,k)})},l.generateWithAbsoluteTime=function(a,b,c,d,e,f){return f||(f=t),new n(function(g){var h,i,j=!0,k=!1,l=a;return f.scheduleRecursiveWithAbsolute(f.now(),function(a){k&&g.onNext(h);try{j?j=!1:l=c(l),k=b(l),k&&(h=d(l),i=e(l))}catch(f){return g.onError(f),void 0}k?a(i):g.onCompleted()})})},l.generateWithRelativeTime=function(a,b,c,d,e,f){return f||(f=t),new n(function(g){var h,i,j=!0,k=!1,l=a;return f.scheduleRecursiveWithRelative(0,function(a){k&&g.onNext(h);try{j?j=!1:l=c(l),k=b(l),k&&(h=d(l),i=e(l))}catch(f){return g.onError(f),void 0}k?a(i):g.onCompleted()})})},m.delaySubscription=function(a,b){return b||(b=t),this.delayWithSelector(C(a,b),function(){return p()})},m.delayWithSelector=function(a,b){var c,d,e=this;return"function"==typeof a?d=a:(c=a,d=b),new n(function(a){var b=new w,f=!1,g=function(){f&&0===b.length&&a.onCompleted()},h=new v,i=function(){h.setDisposable(e.subscribe(function(c){var e;try{e=d(c)}catch(f){return a.onError(f),void 0}var h=new u;b.add(h),h.setDisposable(e.subscribe(function(){a.onNext(c),b.remove(h),g()},a.onError.bind(a),function(){a.onNext(c),b.remove(h),g()}))},a.onError.bind(a),function(){f=!0,h.dispose(),g()}))};return c?h.setDisposable(c.subscribe(function(){i()},a.onError.bind(a),function(){i()})):i(),new w(h,b)})},m.timeoutWithSelector=function(a,b,c){if(1===arguments.length){b=a;var a=q()}c||(c=r(new Error("Timeout")));var d=this;return new n(function(e){var f=new v,g=new v,h=new u;f.setDisposable(h);var i=0,j=!1,k=function(a){var b=i,d=function(){return i===b},h=new u;g.setDisposable(h),h.setDisposable(a.subscribe(function(){d()&&f.setDisposable(c.subscribe(e)),h.dispose()},function(a){d()&&e.onError(a)},function(){d()&&f.setDisposable(c.subscribe(e))}))};k(a);var l=function(){var a=!j;return a&&i++,a};return h.setDisposable(d.subscribe(function(a){if(l()){e.onNext(a);var c;try{c=b(a)}catch(d){return e.onError(d),void 0}k(c)}},function(a){l()&&e.onError(a)},function(){l()&&e.onCompleted()})),new w(f,g)})},m.throttleWithSelector=function(a){var b=this;return new n(function(c){var d,e=!1,f=new v,g=0,h=b.subscribe(function(b){var h;try{h=a(b)}catch(i){return c.onError(i),void 0}e=!0,d=b,g++;var j=g,k=new u;f.setDisposable(k),k.setDisposable(h.subscribe(function(){e&&g===j&&c.onNext(d),e=!1,k.dispose()},c.onError.bind(c),function(){e&&g===j&&c.onNext(d),e=!1,k.dispose()}))},function(a){f.dispose(),c.onError(a),e=!1,g++},function(){f.dispose(),e&&c.onNext(d),c.onCompleted(),e=!1,g++});return new w(h,f)})},m.skipLastWithTime=function(a,b){b||(b=t);var c=this;return new n(function(d){var e=[];return c.subscribe(function(c){var f=b.now();for(e.push({interval:f,value:c});e.length>0&&f-e[0].interval>=a;)d.onNext(e.shift().value)},d.onError.bind(d),function(){for(var c=b.now();e.length>0&&c-e[0].interval>=a;)d.onNext(e.shift().value);d.onCompleted()})})},m.takeLastWithTime=function(a,b,c){return this.takeLastBufferWithTime(a,b).selectMany(function(a){return s(a,c)})},m.takeLastBufferWithTime=function(a,b){var c=this;return b||(b=t),new n(function(d){var e=[];return c.subscribe(function(c){var d=b.now();for(e.push({interval:d,value:c});e.length>0&&d-e[0].interval>=a;)e.shift()},d.onError.bind(d),function(){for(var c=b.now(),f=[];e.length>0;){var g=e.shift();c-g.interval<=a&&f.push(g.value)}d.onNext(f),d.onCompleted()})})},m.takeWithTime=function(a,b){var c=this;return b||(b=t),new n(function(d){var e=b.scheduleWithRelative(a,function(){d.onCompleted()});return new w(e,c.subscribe(d))})},m.skipWithTime=function(a,b){var c=this;return b||(b=t),new n(function(d){var e=!1,f=b.scheduleWithRelative(a,function(){e=!0}),g=c.subscribe(function(a){e&&d.onNext(a)},d.onError.bind(d),d.onCompleted.bind(d));return new w(f,g)})},m.skipUntilWithTime=function(a,b){b||(b=t);var c=this;return new n(function(d){var e=!1,f=b.scheduleWithAbsolute(a,function(){e=!0}),g=c.subscribe(function(a){e&&d.onNext(a)},d.onError.bind(d),d.onCompleted.bind(d));return new w(f,g)})},m.takeUntilWithTime=function(a,b){b||(b=t);var c=this;return new n(function(d){return new w(b.scheduleWithAbsolute(a,function(){d.onCompleted()}),c.subscribe(d))})},c});

@@ -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 t-e}var i=n.Scheduler,o=n.Internals.PriorityQueue,s=n.Internals.ScheduledItem,u=n.Internals.SchedulePeriodicRecursive,c=n.Disposable.empty,a=n.Internals.inherits;return n.VirtualTimeScheduler=function(t){function e(){throw Error("Not implemented")}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 l(t,e,n){return this.scheduleRelativeWithState(t,this.toRelative(e-this.now()),n)}function h(t,e){return e(),c}function f(e,s){this.clock=e,this.comparer=s,this.isEnabled=!1,this.queue=new o(1024),t.call(this,n,r,i,l)}a(f,t);var p=f.prototype;return p.add=e,p.toDateTimeOffset=e,p.toRelative=e,p.schedulePeriodicWithState=function(t,e,n){var r=new u(this,t,e,n);return r.start()},p.scheduleRelativeWithState=function(t,e,n){var r=this.add(this.clock,e);return this.scheduleAbsoluteWithState(t,r,n)},p.scheduleRelative=function(t,e){return this.scheduleRelativeWithState(e,t,h)},p.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)}},p.stop=function(){this.isEnabled=!1},p.advanceTo=function(t){var e,n=this.comparer(this.clock,t);if(this.comparer(this.clock,t)>0)throw Error(argumentOutOfRange);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}},p.advanceBy=function(t){var e=this.add(this.clock,t),n=this.comparer(this.clock,e);if(n>0)throw Error(argumentOutOfRange);0!==n&&this.advanceTo(e)},p.sleep=function(t){var e=this.add(this.clock,t);if(this.comparer(this.clock,e)>=0)throw Error(argumentOutOfRange);this.clock=e},p.getNext=function(){for(var t;this.queue.length>0;){if(t=this.queue.peek(),!t.isCancelled())return t;this.queue.dequeue()}return null},p.scheduleAbsolute=function(t,e){return this.scheduleAbsoluteWithState(e,t,h)},p.scheduleAbsoluteWithState=function(t,e,n){var r=this,i=function(t,e){return r.queue.remove(o),n(t,e)},o=new s(r,t,i,e,r.comparer);return r.queue.enqueue(o),o.disposable},f}(i),n.HistoricalScheduler=function(t){function e(e,n){var i=null==e?0:e,o=n||r;t.call(this,i,o)}a(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}(n.VirtualTimeScheduler),n});
!function(a,b){var c="object"==typeof exports&&exports,d=("object"==typeof module&&module&&module.exports==c&&module,"object"==typeof global&&global);d.global===d&&(window=d),"function"==typeof define&&define.amd?define(["rx","exports"],function(c,d){return a.Rx=b(a,d,c),a.Rx}):"object"==typeof module&&module&&module.exports===c?module.exports=b(a,module.exports,require("./rx")):a.Rx=b(a,{},a.Rx)}(this,function(a,b,c){function d(a,b){return a-b}var e=c.Scheduler,f=c.Internals.PriorityQueue,g=c.Internals.ScheduledItem,h=c.Internals.SchedulePeriodicRecursive,i=c.Disposable.empty,j=c.Internals.inherits;return c.VirtualTimeScheduler=function(a){function b(){throw new Error("Not implemented")}function c(){return this.toDateTimeOffset(this.clock)}function d(a,b){return this.scheduleAbsoluteWithState(a,this.clock,b)}function e(a,b,c){return this.scheduleRelativeWithState(a,this.toRelative(b),c)}function k(a,b,c){return this.scheduleRelativeWithState(a,this.toRelative(b-this.now()),c)}function l(a,b){return b(),i}function m(b,g){this.clock=b,this.comparer=g,this.isEnabled=!1,this.queue=new f(1024),a.call(this,c,d,e,k)}j(m,a);var n=m.prototype;return n.add=b,n.toDateTimeOffset=b,n.toRelative=b,n.schedulePeriodicWithState=function(a,b,c){var d=new h(this,a,b,c);return d.start()},n.scheduleRelativeWithState=function(a,b,c){var d=this.add(this.clock,b);return this.scheduleAbsoluteWithState(a,d,c)},n.scheduleRelative=function(a,b){return this.scheduleRelativeWithState(b,a,l)},n.start=function(){var a;if(!this.isEnabled){this.isEnabled=!0;do a=this.getNext(),null!==a?(this.comparer(a.dueTime,this.clock)>0&&(this.clock=a.dueTime),a.invoke()):this.isEnabled=!1;while(this.isEnabled)}},n.stop=function(){this.isEnabled=!1},n.advanceTo=function(a){var b,c=this.comparer(this.clock,a);if(this.comparer(this.clock,a)>0)throw new Error(argumentOutOfRange);if(0!==c&&!this.isEnabled){this.isEnabled=!0;do b=this.getNext(),null!==b&&this.comparer(b.dueTime,a)<=0?(this.comparer(b.dueTime,this.clock)>0&&(this.clock=b.dueTime),b.invoke()):this.isEnabled=!1;while(this.isEnabled);this.clock=a}},n.advanceBy=function(a){var b=this.add(this.clock,a),c=this.comparer(this.clock,b);if(c>0)throw new Error(argumentOutOfRange);0!==c&&this.advanceTo(b)},n.sleep=function(a){var b=this.add(this.clock,a);if(this.comparer(this.clock,b)>=0)throw new Error(argumentOutOfRange);this.clock=b},n.getNext=function(){for(var a;this.queue.length>0;){if(a=this.queue.peek(),!a.isCancelled())return a;this.queue.dequeue()}return null},n.scheduleAbsolute=function(a,b){return this.scheduleAbsoluteWithState(b,a,l)},n.scheduleAbsoluteWithState=function(a,b,c){var d=this,e=function(a,b){return d.queue.remove(f),c(a,b)},f=new g(d,a,e,b,d.comparer);return d.queue.enqueue(f),f.disposable},m}(e),c.HistoricalScheduler=function(a){function b(b,c){var e=null==b?0:b,f=c||d;a.call(this,e,f)}j(b,a);var c=b.prototype;return c.add=function(a,b){return a+b},c.toDateTimeOffset=function(a){return new Date(a).getTime()},c.toRelative=function(a){return a},b}(c.VirtualTimeScheduler),c});
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