-
Notifications
You must be signed in to change notification settings - Fork 26
/
Rx.js
1 lines (1 loc) · 139 KB
/
Rx.js
1
"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};!function(t,e){"object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.Rx=t.Rx||{})}(void 0,function(t){function e(t,e){function i(){this.constructor=t}tt(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}function i(t){return"function"==typeof t}function n(t){return null!=t&&"object"===(void 0===t?"undefined":_typeof(t))}function r(){try{return ot.apply(this,arguments)}catch(t){return ut.e=t,ut}}function o(t){return ot=t,r}function s(t){return t.reduce(function(t,e){return t.concat(e instanceof ct?e.errors:e)},[])}function u(t){var e=t.value,i=t.subject;i.next(e),i.complete()}function c(t){var e=t.err;t.subject.error(e)}function h(t){var e=this,i=t.source,n=t.subscriber,r=t.context,s=i,u=s.callbackFunc,c=s.args,h=s.scheduler,p=i.subject;if(!p){p=i.subject=new gt;var f=function t(){for(var i=[],n=0;n<arguments.length;n++)i[n-0]=arguments[n];var r=t.source,s=r.selector,u=r.subject,c=i.shift();if(c)e.add(h.schedule(l,0,{err:c,subject:u}));else if(s){var p=o(s).apply(this,i);p===ut?e.add(h.schedule(l,0,{err:ut.e,subject:u})):e.add(h.schedule(a,0,{value:p,subject:u}))}else{var f=i.length<=1?i[0]:i;e.add(h.schedule(a,0,{value:f,subject:u}))}};f.source=i;o(u).apply(r,c.concat(f))===ut&&e.add(h.schedule(l,0,{err:ut.e,subject:p}))}e.add(p.subscribe(n))}function a(t){var e=t.value,i=t.subject;i.next(e),i.complete()}function l(t){var e=t.err;t.subject.error(e)}function p(t){return t&&"function"==typeof t.schedule}function f(t){return t&&"function"!=typeof t.subscribe&&"function"==typeof t.then}function d(t,e,i,r){var o=new jt(t,i,r);if(o.closed)return null;if(e instanceof yt)return e._isScalar?(o.next(e.value),o.complete(),null):e.subscribe(o);if(Vt(e)){for(var s=0,u=e.length;s<u&&!o.closed;s++)o.next(e[s]);o.closed||o.complete()}else{if(f(e))return e.then(function(t){o.closed||(o.next(t),o.complete())},function(t){return o.error(t)}).then(null,function(t){setTimeout(function(){throw t})}),o;if(e&&"function"==typeof e[kt])for(var c=e[kt]();;){var h=c.next();if(h.done){o.complete();break}if(o.next(h.value),o.closed)break}else if(e&&"function"==typeof e[bt]){var a=e[bt]();if("function"==typeof a.subscribe)return a.subscribe(new jt(t,i,r));o.error(new TypeError("Provided object does not correctly implement Symbol.observable"))}else{var l="You provided "+(n(e)?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.";o.error(new TypeError(l))}}return null}function b(){for(var t=[],e=0;e<arguments.length;e++)t[e-0]=arguments[e];var i=null,n=t;return p(n[t.length-1])&&(i=n.pop()),null===i&&1===t.length&&t[0]instanceof yt?t[0]:new Et(t,i).lift(new Pt(1))}function y(t){var e=t.value,i=t.subscriber;i.closed||(i.next(e),i.complete())}function v(t){var e=t.err,i=t.subscriber;i.closed||i.error(e)}function m(t){var e=+t.length;return isNaN(e)?0:0!==e&&function(t){return"number"==typeof t&&rt.isFinite(t)}(e)?(e=function(t){var e=+t;if(0===e)return e;if(isNaN(e))return e;return e<0?-1:1}(e)*Math.floor(Math.abs(e)))<=0?0:e>Jt?Jt:e:e}function w(t){return!st(t)&&t-parseFloat(t)+1>=0}function x(){for(var t=[],e=0;e<arguments.length;e++)t[e-0]=arguments[e];var i=Number.POSITIVE_INFINITY,n=null,r=t[t.length-1];return p(r)?(n=t.pop(),t.length>1&&"number"==typeof t[t.length-1]&&(i=t.pop())):"number"==typeof r&&(i=t.pop()),null===n&&1===t.length&&t[0]instanceof yt?t[0]:new Et(t,n).lift(new Pt(i))}function _(){for(var t=[],e=0;e<arguments.length;e++)t[e-0]=arguments[e];if(1===t.length){if(!st(t[0]))return t[0];t=t[0]}return new Et(t).lift(new ve)}function g(t){var e=t.obj,i=t.keys,n=t.length,r=t.index,o=t.subscriber;if(r!==n){var s=i[r];o.next([s,e[s]]),t.index=r+1,this.schedule(t)}else o.complete()}function S(t){return t instanceof Date&&!isNaN(+t)}function T(){for(var t=[],e=0;e<arguments.length;e++)t[e-0]=arguments[e];var i=t[t.length-1];return"function"==typeof i&&t.pop(),new Et(t).lift(new Oe(i))}function I(t,e){if("function"!=typeof t)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return this.lift(new qe(t,e))}function N(t,e){return void 0===e&&(e=null),new We({method:"GET",url:t,headers:e})}function E(t,e,i){return new We({method:"POST",url:t,body:e,headers:i})}function C(t,e){return new We({method:"DELETE",url:t,headers:e})}function V(t,e,i){return new We({method:"PUT",url:t,body:e,headers:i})}function k(t,e,i){return new We({method:"PATCH",url:t,body:e,headers:i})}function j(t,e){return new We({method:"GET",url:t,responseType:"json",headers:e}).lift(new qe(function(t,e){return t.response},null))}function O(t){var e=t.subscriber,i=t.context;i&&e.closeContext(i),e.closed||(t.context=e.openContext(),t.context.closeAction=this.schedule(t,t.bufferTimeSpan))}function A(t){var e=t.bufferCreationInterval,i=t.bufferTimeSpan,n=t.subscriber,r=t.scheduler,o=n.openContext();n.closed||(n.add(o.closeAction=r.schedule(F,i,{subscriber:n,context:o})),this.schedule(t,e))}function F(t){var e=t.subscriber,i=t.context;e.closeContext(i)}function P(t){var e=new ai(t),i=this.lift(e);return e.caught=i}function R(t,e,i){return void 0===i&&(i=Number.POSITIVE_INFINITY),"number"==typeof e&&(i=e,e=null),this.lift(new pi(t,e,i))}function M(t,e,i){return void 0===i&&(i=Number.POSITIVE_INFINITY),"number"==typeof e&&(i=e,e=null),this.lift(new di(t,e,i))}function q(t){t.debouncedNext()}function B(t,e){return this.lift(new Ri(t,e))}function W(t,e,i){return this.lift(new qi(t,e,i))}function z(t,e){return this.lift(new Ji(t,e))}function Y(t){return this.lift(new $i(t))}function U(t){t.clearThrottle()}function D(t){return t(this)}function L(t,e){var i;if(i="function"==typeof t?t:function(){return t},"function"==typeof e)return this.lift(new Bn(i,e));var n=Object.create(this,Pn);return n.source=this,n.subjectFactory=i,n}function H(t){var e=t.subscriber,i=t.period;e.notifyNext(),this.schedule(t,i)}function X(){return new xt}function G(){return this.lift(new _r)}function J(t){t.subscriber.clearThrottle()}function K(t){var e=t.subscriber,i=t.windowTimeSpan,n=t.window;n&&e.closeWindow(n),t.window=e.openWindow(),this.schedule(t,i)}function $(t){var e=t.windowTimeSpan,i=t.subscriber,n=t.scheduler,r=t.windowCreationInterval,o={action:this,subscription:null},s={subscriber:i,window:i.openWindow(),context:o};o.subscription=n.schedule(Q,e,s),this.add(o.subscription),this.schedule(t,r)}function Q(t){var e=t.subscriber,i=t.window,n=t.context;n&&n.action&&n.subscription&&n.action.remove(n.subscription),e.closeWindow(i)}function Z(t,e){for(var i=0,n=e.length;i<n;i++)for(var r=e[i],o=Object.getOwnPropertyNames(r.prototype),s=0,u=o.length;s<u;s++){var c=o[s];t.prototype[c]=r.prototype[c]}}var tt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},et="undefined"!=typeof window&&window,it="undefined"!=typeof self&&"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&self,nt="undefined"!=typeof global&&global,rt=et||nt||it;!function(){if(!rt)throw new Error("RxJS could not find any global context (window, self, global)")}();var ot,st=Array.isArray||function(t){return t&&"number"==typeof t.length},ut={e:{}},ct=function(t){function i(e){t.call(this),this.errors=e;var i=Error.call(this,e?e.length+" errors occurred during unsubscription:\n "+e.map(function(t,e){return e+1+") "+t.toString()}).join("\n "):"");this.name=i.name="UnsubscriptionError",this.stack=i.stack,this.message=i.message}return e(i,t),i}(Error),ht=function(){function t(t){this.closed=!1,this._parent=null,this._parents=null,this._subscriptions=null,t&&(this._unsubscribe=t)}return t.prototype.unsubscribe=function(){var t,e=!1;if(!this.closed){var r=this._parent,u=this._parents,c=this._unsubscribe,h=this._subscriptions;this.closed=!0,this._parent=null,this._parents=null,this._subscriptions=null;for(var a=-1,l=u?u.length:0;r;)r.remove(this),r=++a<l&&u[a]||null;if(i(c)){o(c).call(this)===ut&&(e=!0,t=t||(ut.e instanceof ct?s(ut.e.errors):[ut.e]))}if(st(h))for(a=-1,l=h.length;++a<l;){var p=h[a];if(n(p)){if(o(p.unsubscribe).call(p)===ut){e=!0,t=t||[];var f=ut.e;f instanceof ct?t=t.concat(s(f.errors)):t.push(f)}}}if(e)throw new ct(t)}},t.prototype.add=function(e){if(!e||e===t.EMPTY)return t.EMPTY;if(e===this)return this;var i=e;switch(void 0===e?"undefined":_typeof(e)){case"function":i=new t(e);case"object":if(i.closed||"function"!=typeof i.unsubscribe)return i;if(this.closed)return i.unsubscribe(),i;if("function"!=typeof i._addParent){var n=i;(i=new t)._subscriptions=[n]}break;default:throw new Error("unrecognized teardown "+e+" added to Subscription.")}return(this._subscriptions||(this._subscriptions=[])).push(i),i._addParent(this),i},t.prototype.remove=function(t){var e=this._subscriptions;if(e){var i=e.indexOf(t);-1!==i&&e.splice(i,1)}},t.prototype._addParent=function(t){var e=this._parent,i=this._parents;e&&e!==t?i?-1===i.indexOf(t)&&i.push(t):this._parents=[t]:this._parent=t},t.EMPTY=function(t){return t.closed=!0,t}(new t),t}(),at={closed:!0,next:function(t){},error:function(t){throw t},complete:function(){}},lt=rt.Symbol,pt="function"==typeof lt&&"function"==typeof lt.for?lt.for("rxSubscriber"):"@@rxSubscriber",ft=function(t){function i(e,n,r){switch(t.call(this),this.syncErrorValue=null,this.syncErrorThrown=!1,this.syncErrorThrowable=!1,this.isStopped=!1,arguments.length){case 0:this.destination=at;break;case 1:if(!e){this.destination=at;break}if("object"===(void 0===e?"undefined":_typeof(e))){e instanceof i?(this.destination=e,this.destination.add(this)):(this.syncErrorThrowable=!0,this.destination=new dt(this,e));break}default:this.syncErrorThrowable=!0,this.destination=new dt(this,e,n,r)}}return e(i,t),i.prototype[pt]=function(){return this},i.create=function(t,e,n){var r=new i(t,e,n);return r.syncErrorThrowable=!1,r},i.prototype.next=function(t){this.isStopped||this._next(t)},i.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},i.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},i.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this))},i.prototype._next=function(t){this.destination.next(t)},i.prototype._error=function(t){this.destination.error(t),this.unsubscribe()},i.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},i.prototype._unsubscribeAndRecycle=function(){var t=this._parent,e=this._parents;return this._parent=null,this._parents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parent=t,this._parents=e,this},i}(ht),dt=function(t){function n(e,n,r,o){t.call(this),this._parentSubscriber=e;var s,u=this;i(n)?s=n:n&&(s=n.next,r=n.error,o=n.complete,n!==at&&(i((u=Object.create(n)).unsubscribe)&&this.add(u.unsubscribe.bind(u)),u.unsubscribe=this.unsubscribe.bind(this))),this._context=u,this._next=s,this._error=r,this._complete=o}return e(n,t),n.prototype.next=function(t){if(!this.isStopped&&this._next){var e=this._parentSubscriber;e.syncErrorThrowable?this.__tryOrSetError(e,this._next,t)&&this.unsubscribe():this.__tryOrUnsub(this._next,t)}},n.prototype.error=function(t){if(!this.isStopped){var e=this._parentSubscriber;if(this._error)e.syncErrorThrowable?(this.__tryOrSetError(e,this._error,t),this.unsubscribe()):(this.__tryOrUnsub(this._error,t),this.unsubscribe());else{if(!e.syncErrorThrowable)throw this.unsubscribe(),t;e.syncErrorValue=t,e.syncErrorThrown=!0,this.unsubscribe()}}},n.prototype.complete=function(){var t=this;if(!this.isStopped){var e=this._parentSubscriber;if(this._complete){var i=function(){return t._complete.call(t._context)};e.syncErrorThrowable?(this.__tryOrSetError(e,i),this.unsubscribe()):(this.__tryOrUnsub(i),this.unsubscribe())}else this.unsubscribe()}},n.prototype.__tryOrUnsub=function(t,e){try{t.call(this._context,e)}catch(t){throw this.unsubscribe(),t}},n.prototype.__tryOrSetError=function(t,e,i){try{e.call(this._context,i)}catch(e){return t.syncErrorValue=e,t.syncErrorThrown=!0,!0}return!1},n.prototype._unsubscribe=function(){var t=this._parentSubscriber;this._context=null,this._parentSubscriber=null,t.unsubscribe()},n}(ft),bt=function(t){var e,i=t.Symbol;return"function"==typeof i?i.observable?e=i.observable:(e=i("observable"),i.observable=e):e="@@observable",e}(rt),yt=function(){function t(t){this._isScalar=!1,t&&(this._subscribe=t)}return t.prototype.lift=function(e){var i=new t;return i.source=this,i.operator=e,i},t.prototype.subscribe=function(t,e,i){var n=this.operator,r=function(t,e,i){if(t){if(t instanceof ft)return t;if(t[pt])return t[pt]()}return t||e||i?new ft(t,e,i):new ft(at)}(t,e,i);if(n?n.call(r,this.source):r.add(this.source?this._subscribe(r):this._trySubscribe(r)),r.syncErrorThrowable&&(r.syncErrorThrowable=!1,r.syncErrorThrown))throw r.syncErrorValue;return r},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.syncErrorThrown=!0,t.syncErrorValue=e,t.error(e)}},t.prototype.forEach=function(t,e){var i=this;if(e||(rt.Rx&&rt.Rx.config&&rt.Rx.config.Promise?e=rt.Rx.config.Promise:rt.Promise&&(e=rt.Promise)),!e)throw new Error("no Promise impl found");return new e(function(e,n){var r;r=i.subscribe(function(e){if(r)try{t(e)}catch(t){n(t),r.unsubscribe()}else t(e)},n,e)})},t.prototype._subscribe=function(t){return this.source.subscribe(t)},t.prototype[bt]=function(){return this},t.create=function(e){return new t(e)},t}(),vt=function(t){function i(){var e=t.call(this,"object unsubscribed");this.name=e.name="ObjectUnsubscribedError",this.stack=e.stack,this.message=e.message}return e(i,t),i}(Error),mt=function(t){function i(e,i){t.call(this),this.subject=e,this.subscriber=i,this.closed=!1}return e(i,t),i.prototype.unsubscribe=function(){if(!this.closed){this.closed=!0;var t=this.subject,e=t.observers;if(this.subject=null,e&&0!==e.length&&!t.isStopped&&!t.closed){var i=e.indexOf(this.subscriber);-1!==i&&e.splice(i,1)}}},i}(ht),wt=function(t){function i(e){t.call(this,e),this.destination=e}return e(i,t),i}(ft),xt=function(t){function i(){t.call(this),this.observers=[],this.closed=!1,this.isStopped=!1,this.hasError=!1,this.thrownError=null}return e(i,t),i.prototype[pt]=function(){return new wt(this)},i.prototype.lift=function(t){var e=new _t(this,this);return e.operator=t,e},i.prototype.next=function(t){if(this.closed)throw new vt;if(!this.isStopped)for(var e=this.observers,i=e.length,n=e.slice(),r=0;r<i;r++)n[r].next(t)},i.prototype.error=function(t){if(this.closed)throw new vt;this.hasError=!0,this.thrownError=t,this.isStopped=!0;for(var e=this.observers,i=e.length,n=e.slice(),r=0;r<i;r++)n[r].error(t);this.observers.length=0},i.prototype.complete=function(){if(this.closed)throw new vt;this.isStopped=!0;for(var t=this.observers,e=t.length,i=t.slice(),n=0;n<e;n++)i[n].complete();this.observers.length=0},i.prototype.unsubscribe=function(){this.isStopped=!0,this.closed=!0,this.observers=null},i.prototype._trySubscribe=function(e){if(this.closed)throw new vt;return t.prototype._trySubscribe.call(this,e)},i.prototype._subscribe=function(t){if(this.closed)throw new vt;return this.hasError?(t.error(this.thrownError),ht.EMPTY):this.isStopped?(t.complete(),ht.EMPTY):(this.observers.push(t),new mt(this,t))},i.prototype.asObservable=function(){var t=new yt;return t.source=this,t},i.create=function(t,e){return new _t(t,e)},i}(yt),_t=function(t){function i(e,i){t.call(this),this.destination=e,this.source=i}return e(i,t),i.prototype.next=function(t){var e=this.destination;e&&e.next&&e.next(t)},i.prototype.error=function(t){var e=this.destination;e&&e.error&&this.destination.error(t)},i.prototype.complete=function(){var t=this.destination;t&&t.complete&&this.destination.complete()},i.prototype._subscribe=function(t){return this.source?this.source.subscribe(t):ht.EMPTY},i}(xt),gt=function(t){function i(){t.apply(this,arguments),this.value=null,this.hasNext=!1,this.hasCompleted=!1}return e(i,t),i.prototype._subscribe=function(e){return this.hasError?(e.error(this.thrownError),ht.EMPTY):this.hasCompleted&&this.hasNext?(e.next(this.value),e.complete(),ht.EMPTY):t.prototype._subscribe.call(this,e)},i.prototype.next=function(t){this.hasCompleted||(this.value=t,this.hasNext=!0)},i.prototype.error=function(e){this.hasCompleted||t.prototype.error.call(this,e)},i.prototype.complete=function(){this.hasCompleted=!0,this.hasNext&&t.prototype.next.call(this,this.value),t.prototype.complete.call(this)},i}(xt),St=function(t){function i(e,i,n,r,o){t.call(this),this.callbackFunc=e,this.selector=i,this.args=n,this.context=r,this.scheduler=o}return e(i,t),i.create=function(t,e,n){return void 0===e&&(e=void 0),function(){for(var r=[],o=0;o<arguments.length;o++)r[o-0]=arguments[o];return new i(t,e,r,this,n)}},i.prototype._subscribe=function(t){var e=this.callbackFunc,n=this.args,r=this.scheduler,s=this.subject;if(r)return r.schedule(i.dispatch,0,{source:this,subscriber:t,context:this.context});if(!s){s=this.subject=new gt;var u=function t(){for(var e=[],i=0;i<arguments.length;i++)e[i-0]=arguments[i];var n=t.source,r=n.selector,s=n.subject;if(r){var u=o(r).apply(this,e);u===ut?s.error(ut.e):(s.next(u),s.complete())}else s.next(e.length<=1?e[0]:e),s.complete()};u.source=this;o(e).apply(this.context,n.concat(u))===ut&&s.error(ut.e)}return s.subscribe(t)},i.dispatch=function(t){var e=this,i=t.source,n=t.subscriber,r=t.context,s=i.callbackFunc,h=i.args,a=i.scheduler,l=i.subject;if(!l){l=i.subject=new gt;var p=function t(){for(var i=[],n=0;n<arguments.length;n++)i[n-0]=arguments[n];var r=t.source,s=r.selector,h=r.subject;if(s){var l=o(s).apply(this,i);l===ut?e.add(a.schedule(c,0,{err:ut.e,subject:h})):e.add(a.schedule(u,0,{value:l,subject:h}))}else{var p=i.length<=1?i[0]:i;e.add(a.schedule(u,0,{value:p,subject:h}))}};p.source=i;o(s).apply(r,h.concat(p))===ut&&l.error(ut.e)}e.add(l.subscribe(n))},i}(yt).create;yt.bindCallback=St;var Tt=function(t){function i(e,i,n,r,o){t.call(this),this.callbackFunc=e,this.selector=i,this.args=n,this.context=r,this.scheduler=o}return e(i,t),i.create=function(t,e,n){return void 0===e&&(e=void 0),function(){for(var r=[],o=0;o<arguments.length;o++)r[o-0]=arguments[o];return new i(t,e,r,this,n)}},i.prototype._subscribe=function(t){var e=this.callbackFunc,i=this.args,n=this.scheduler,r=this.subject;if(n)return n.schedule(h,0,{source:this,subscriber:t,context:this.context});if(!r){r=this.subject=new gt;var s=function t(){for(var e=[],i=0;i<arguments.length;i++)e[i-0]=arguments[i];var n=t.source,r=n.selector,s=n.subject,u=e.shift();if(u)s.error(u);else if(r){var c=o(r).apply(this,e);c===ut?s.error(ut.e):(s.next(c),s.complete())}else s.next(e.length<=1?e[0]:e),s.complete()};s.source=this;o(e).apply(this.context,i.concat(s))===ut&&r.error(ut.e)}return r.subscribe(t)},i}(yt).create;yt.bindNodeCallback=Tt;var It=function(t){function i(e,i){t.call(this),this.value=e,this.scheduler=i,this._isScalar=!0,i&&(this._isScalar=!1)}return e(i,t),i.create=function(t,e){return new i(t,e)},i.dispatch=function(t){var e=t.done,i=t.value,n=t.subscriber;e?n.complete():(n.next(i),n.closed||(t.done=!0,this.schedule(t)))},i.prototype._subscribe=function(t){var e=this.value,n=this.scheduler;if(n)return n.schedule(i.dispatch,0,{done:!1,value:e,subscriber:t});t.next(e),t.closed||t.complete()},i}(yt),Nt=function(t){function i(e){t.call(this),this.scheduler=e}return e(i,t),i.create=function(t){return new i(t)},i.dispatch=function(t){t.subscriber.complete()},i.prototype._subscribe=function(t){var e=this.scheduler;if(e)return e.schedule(i.dispatch,0,{subscriber:t});t.complete()},i}(yt),Et=function(t){function i(e,i){t.call(this),this.array=e,this.scheduler=i,i||1!==e.length||(this._isScalar=!0,this.value=e[0])}return e(i,t),i.create=function(t,e){return new i(t,e)},i.of=function(){for(var t=[],e=0;e<arguments.length;e++)t[e-0]=arguments[e];var n=t[t.length-1];p(n)?t.pop():n=null;var r=t.length;return r>1?new i(t,n):1===r?new It(t[0],n):new Nt(n)},i.dispatch=function(t){var e=t.array,i=t.index,n=t.count,r=t.subscriber;i>=n?r.complete():(r.next(e[i]),r.closed||(t.index=i+1,this.schedule(t)))},i.prototype._subscribe=function(t){var e=this.array,n=e.length,r=this.scheduler;if(r)return r.schedule(i.dispatch,0,{array:e,index:0,count:n,subscriber:t});for(var o=0;o<n&&!t.closed;o++)t.next(e[o]);t.complete()},i}(yt),Ct=function(t){function i(){t.apply(this,arguments)}return e(i,t),i.prototype.notifyNext=function(t,e,i,n,r){this.destination.next(e)},i.prototype.notifyError=function(t,e){this.destination.error(t)},i.prototype.notifyComplete=function(t){this.destination.complete()},i}(ft),Vt=function(t){return t&&"number"==typeof t.length},kt=function(t){var e=t.Symbol;if("function"==typeof e)return e.iterator||(e.iterator=e("iterator polyfill")),e.iterator;var i=t.Set;if(i&&"function"==typeof(new i)["@@iterator"])return"@@iterator";var n=t.Map;if(n)for(var r=Object.getOwnPropertyNames(n.prototype),o=0;o<r.length;++o){var s=r[o];if("entries"!==s&&"size"!==s&&n.prototype[s]===n.prototype.entries)return s}return"@@iterator"}(rt),jt=function(t){function i(e,i,n){t.call(this),this.parent=e,this.outerValue=i,this.outerIndex=n,this.index=0}return e(i,t),i.prototype._next=function(t){this.parent.notifyNext(this.outerValue,t,this.outerIndex,this.index++,this)},i.prototype._error=function(t){this.parent.notifyError(t,this),this.unsubscribe()},i.prototype._complete=function(){this.parent.notifyComplete(this),this.unsubscribe()},i}(ft),Ot={},At=function(){function t(t){this.project=t}return t.prototype.call=function(t,e){return e.subscribe(new Ft(t,this.project))},t}(),Ft=function(t){function i(e,i){t.call(this,e),this.project=i,this.active=0,this.values=[],this.observables=[]}return e(i,t),i.prototype._next=function(t){this.values.push(Ot),this.observables.push(t)},i.prototype._complete=function(){var t=this.observables,e=t.length;if(0===e)this.destination.complete();else{this.active=e,this.toRespond=e;for(var i=0;i<e;i++){var n=t[i];this.add(d(this,n,n,i))}}},i.prototype.notifyComplete=function(t){0==(this.active-=1)&&this.destination.complete()},i.prototype.notifyNext=function(t,e,i,n,r){var o=this.values,s=o[i],u=this.toRespond?s===Ot?--this.toRespond:this.toRespond:0;o[i]=e,0===u&&(this.project?this._tryProject(o):this.destination.next(o.slice()))},i.prototype._tryProject=function(t){var e;try{e=this.project.apply(this,t)}catch(t){return void this.destination.error(t)}this.destination.next(e)},i}(Ct);yt.combineLatest=function(){for(var t=[],e=0;e<arguments.length;e++)t[e-0]=arguments[e];var i=null,n=null;return p(t[t.length-1])&&(n=t.pop()),"function"==typeof t[t.length-1]&&(i=t.pop()),1===t.length&&st(t[0])&&(t=t[0]),new Et(t,n).lift(new At(i))};var Pt=function(){function t(t){this.concurrent=t}return t.prototype.call=function(t,e){return e.subscribe(new Rt(t,this.concurrent))},t}(),Rt=function(t){function i(e,i){t.call(this,e),this.concurrent=i,this.hasCompleted=!1,this.buffer=[],this.active=0}return e(i,t),i.prototype._next=function(t){this.active<this.concurrent?(this.active++,this.add(d(this,t))):this.buffer.push(t)},i.prototype._complete=function(){this.hasCompleted=!0,0===this.active&&0===this.buffer.length&&this.destination.complete()},i.prototype.notifyComplete=function(t){var e=this.buffer;this.remove(t),this.active--,e.length>0?this._next(e.shift()):0===this.active&&this.hasCompleted&&this.destination.complete()},i}(Ct),Mt=b;yt.concat=Mt;var qt=function(t){function i(e){t.call(this),this.observableFactory=e}return e(i,t),i.create=function(t){return new i(t)},i.prototype._subscribe=function(t){return new Bt(t,this.observableFactory)},i}(yt),Bt=function(t){function i(e,i){t.call(this,e),this.factory=i,this.tryDefer()}return e(i,t),i.prototype.tryDefer=function(){try{this._callFactory()}catch(t){this._error(t)}},i.prototype._callFactory=function(){var t=this.factory();t&&this.add(d(this,t))},i}(Ct),Wt=qt.create;yt.defer=Wt;var zt=Nt.create;yt.empty=zt;var Yt=function(t){function i(e,i){t.call(this),this.sources=e,this.resultSelector=i}return e(i,t),i.create=function(){for(var t=[],e=0;e<arguments.length;e++)t[e-0]=arguments[e];if(null===t||0===arguments.length)return new Nt;var n=null;return"function"==typeof t[t.length-1]&&(n=t.pop()),1===t.length&&st(t[0])&&(t=t[0]),0===t.length?new Nt:new i(t,n)},i.prototype._subscribe=function(t){return new Ut(t,this.sources,this.resultSelector)},i}(yt),Ut=function(t){function i(e,i,n){t.call(this,e),this.sources=i,this.resultSelector=n,this.completed=0,this.haveValues=0;var r=i.length;this.total=r,this.values=new Array(r);for(var o=0;o<r;o++){var s=d(this,i[o],null,o);s&&(s.outerIndex=o,this.add(s))}}return e(i,t),i.prototype.notifyNext=function(t,e,i,n,r){this.values[i]=e,r._hasValue||(r._hasValue=!0,this.haveValues++)},i.prototype.notifyComplete=function(t){var e=this.destination,i=this.haveValues,n=this.resultSelector,r=this.values,o=r.length;if(t._hasValue){if(this.completed++,this.completed===o){if(i===o){var s=n?n.apply(this,r):r;e.next(s)}e.complete()}}else e.complete()},i}(Ct),Dt=Yt.create;yt.forkJoin=Dt;var Lt=function(t){function i(e,i){t.call(this),this.promise=e,this.scheduler=i}return e(i,t),i.create=function(t,e){return new i(t,e)},i.prototype._subscribe=function(t){var e=this,i=this.promise,n=this.scheduler;if(null==n)this._isScalar?t.closed||(t.next(this.value),t.complete()):i.then(function(i){e.value=i,e._isScalar=!0,t.closed||(t.next(i),t.complete())},function(e){t.closed||t.error(e)}).then(null,function(t){setTimeout(function(){throw t})});else if(this._isScalar){if(!t.closed)return n.schedule(y,0,{value:this.value,subscriber:t})}else i.then(function(i){e.value=i,e._isScalar=!0,t.closed||t.add(n.schedule(y,0,{value:i,subscriber:t}))},function(e){t.closed||t.add(n.schedule(v,0,{err:e,subscriber:t}))}).then(null,function(t){setTimeout(function(){throw t})})},i}(yt),Ht=function(t){function i(e,i){if(t.call(this),this.scheduler=i,null==e)throw new Error("iterator cannot be null.");this.iterator=function(t){var e=t[kt];if(!e&&"string"==typeof t)return new Xt(t);if(!e&&void 0!==t.length)return new Gt(t);if(!e)throw new TypeError("object is not iterable");return t[kt]()}(e)}return e(i,t),i.create=function(t,e){return new i(t,e)},i.dispatch=function(t){var e=t.index,i=t.hasError,n=t.iterator,r=t.subscriber;if(i)r.error(t.error);else{var o=n.next();o.done?r.complete():(r.next(o.value),t.index=e+1,r.closed?"function"==typeof n.return&&n.return():this.schedule(t))}},i.prototype._subscribe=function(t){var e=this.iterator,n=this.scheduler;if(n)return n.schedule(i.dispatch,0,{index:0,iterator:e,subscriber:t});for(;;){var r=e.next();if(r.done){t.complete();break}if(t.next(r.value),t.closed){"function"==typeof e.return&&e.return();break}}},i}(yt),Xt=function(){function t(t,e,i){void 0===e&&(e=0),void 0===i&&(i=t.length),this.str=t,this.idx=e,this.len=i}return t.prototype[kt]=function(){return this},t.prototype.next=function(){return this.idx<this.len?{done:!1,value:this.str.charAt(this.idx++)}:{done:!0,value:void 0}},t}(),Gt=function(){function t(t,e,i){void 0===e&&(e=0),void 0===i&&(i=m(t)),this.arr=t,this.idx=e,this.len=i}return t.prototype[kt]=function(){return this},t.prototype.next=function(){return this.idx<this.len?{done:!1,value:this.arr[this.idx++]}:{done:!0,value:void 0}},t}(),Jt=Math.pow(2,53)-1,Kt=function(t){function i(e,i){t.call(this),this.arrayLike=e,this.scheduler=i,i||1!==e.length||(this._isScalar=!0,this.value=e[0])}return e(i,t),i.create=function(t,e){var n=t.length;return 0===n?new Nt:1===n?new It(t[0],e):new i(t,e)},i.dispatch=function(t){var e=t.arrayLike,i=t.index,n=t.length,r=t.subscriber;r.closed||(i>=n?r.complete():(r.next(e[i]),t.index=i+1,this.schedule(t)))},i.prototype._subscribe=function(t){var e=this.arrayLike,n=this.scheduler,r=e.length;if(n)return n.schedule(i.dispatch,0,{arrayLike:e,index:0,length:r,subscriber:t});for(var o=0;o<r&&!t.closed;o++)t.next(e[o]);t.complete()},i}(yt),$t=function(){function t(t,e,i){this.kind=t,this.value=e,this.error=i,this.hasValue="N"===t}return t.prototype.observe=function(t){switch(this.kind){case"N":return t.next&&t.next(this.value);case"E":return t.error&&t.error(this.error);case"C":return t.complete&&t.complete()}},t.prototype.do=function(t,e,i){switch(this.kind){case"N":return t&&t(this.value);case"E":return e&&e(this.error);case"C":return i&&i()}},t.prototype.accept=function(t,e,i){return t&&"function"==typeof t.next?this.observe(t):this.do(t,e,i)},t.prototype.toObservable=function(){switch(this.kind){case"N":return yt.of(this.value);case"E":return yt.throw(this.error);case"C":return yt.empty()}throw new Error("unexpected notification kind value")},t.createNext=function(e){return void 0!==e?new t("N",e):t.undefinedValueNotification},t.createError=function(e){return new t("E",void 0,e)},t.createComplete=function(){return t.completeNotification},t.completeNotification=new t("C"),t.undefinedValueNotification=new t("N",void 0),t}(),Qt=function(){function t(t,e){void 0===e&&(e=0),this.scheduler=t,this.delay=e}return t.prototype.call=function(t,e){return e.subscribe(new Zt(t,this.scheduler,this.delay))},t}(),Zt=function(t){function i(e,i,n){void 0===n&&(n=0),t.call(this,e),this.scheduler=i,this.delay=n}return e(i,t),i.dispatch=function(t){var e=t.notification,i=t.destination;e.observe(i),this.unsubscribe()},i.prototype.scheduleMessage=function(t){this.add(this.scheduler.schedule(i.dispatch,this.delay,new te(t,this.destination)))},i.prototype._next=function(t){this.scheduleMessage($t.createNext(t))},i.prototype._error=function(t){this.scheduleMessage($t.createError(t))},i.prototype._complete=function(){this.scheduleMessage($t.createComplete())},i}(ft),te=function(){return function(t,e){this.notification=t,this.destination=e}}(),ee=function(t){function i(e,i){t.call(this,null),this.ish=e,this.scheduler=i}return e(i,t),i.create=function(t,e){if(null!=t){if("function"==typeof t[bt])return t instanceof yt&&!e?t:new i(t,e);if(st(t))return new Et(t,e);if(f(t))return new Lt(t,e);if("function"==typeof t[kt]||"string"==typeof t)return new Ht(t,e);if(Vt(t))return new Kt(t,e)}throw new TypeError((null!==t&&(void 0===t?"undefined":_typeof(t))||t)+" is not observable")},i.prototype._subscribe=function(t){var e=this.ish,i=this.scheduler;return null==i?e[bt]().subscribe(t):e[bt]().subscribe(new Zt(t,i,0))},i}(yt),ie=ee.create;yt.from=ie;var ne=Object.prototype.toString,re=function(t){function n(e,i,n,r){t.call(this),this.sourceObj=e,this.eventName=i,this.selector=n,this.options=r}return e(n,t),n.create=function(t,e,r,o){return i(r)&&(o=r,r=void 0),new n(t,e,o,r)},n.setupSubscription=function(t,e,i,r,o){var s;if(function(t){return!!t&&"[object NodeList]"===ne.call(t)}(t)||function(t){return!!t&&"[object HTMLCollection]"===ne.call(t)}(t))for(var u=0,c=t.length;u<c;u++)n.setupSubscription(t[u],e,i,r,o);else if(function(t){return!!t&&"function"==typeof t.addEventListener&&"function"==typeof t.removeEventListener}(t)){var h=t;t.addEventListener(e,i,o),s=function(){return h.removeEventListener(e,i)}}else if(function(t){return!!t&&"function"==typeof t.on&&"function"==typeof t.off}(t)){var a=t;t.on(e,i),s=function(){return a.off(e,i)}}else{if(!function(t){return!!t&&"function"==typeof t.addListener&&"function"==typeof t.removeListener}(t))throw new TypeError("Invalid event target");var l=t;t.addListener(e,i),s=function(){return l.removeListener(e,i)}}r.add(new ht(s))},n.prototype._subscribe=function(t){var e=this.sourceObj,i=this.eventName,r=this.options,s=this.selector;n.setupSubscription(e,i,s?function(){for(var e=[],i=0;i<arguments.length;i++)e[i-0]=arguments[i];var n=o(s).apply(void 0,e);n===ut?t.error(ut.e):t.next(n)}:function(e){return t.next(e)},t,r)},n}(yt).create;yt.fromEvent=re;var oe=function(t){function n(e,i,n){t.call(this),this.addHandler=e,this.removeHandler=i,this.selector=n}return e(n,t),n.create=function(t,e,i){return new n(t,e,i)},n.prototype._subscribe=function(t){var e=this,n=this.removeHandler,r=this.selector?function(){for(var i=[],n=0;n<arguments.length;n++)i[n-0]=arguments[n];e._callSelector(t,i)}:function(e){t.next(e)},o=this._callAddHandler(r,t);i(n)&&t.add(new ht(function(){n(r,o)}))},n.prototype._callSelector=function(t,e){try{var i=this.selector.apply(this,e);t.next(i)}catch(e){t.error(e)}},n.prototype._callAddHandler=function(t,e){try{return this.addHandler(t)||null}catch(t){e.error(t)}},n}(yt).create;yt.fromEventPattern=oe;var se=Lt.create;yt.fromPromise=se;var ue=function(t){return t},ce=function(t){function i(e,i,n,r,o){t.call(this),this.initialState=e,this.condition=i,this.iterate=n,this.resultSelector=r,this.scheduler=o}return e(i,t),i.create=function(t,e,n,r,o){return 1==arguments.length?new i(t.initialState,t.condition,t.iterate,t.resultSelector||ue,t.scheduler):void 0===r||p(r)?new i(t,e,n,ue,r):new i(t,e,n,r,o)},i.prototype._subscribe=function(t){var e=this.initialState;if(this.scheduler)return this.scheduler.schedule(i.dispatch,0,{subscriber:t,iterate:this.iterate,condition:this.condition,resultSelector:this.resultSelector,state:e});for(var n=this.condition,r=this.resultSelector,o=this.iterate;;){if(n){var s=void 0;try{s=n(e)}catch(e){return void t.error(e)}if(!s){t.complete();break}}var u=void 0;try{u=r(e)}catch(e){return void t.error(e)}if(t.next(u),t.closed)break;try{e=o(e)}catch(e){return void t.error(e)}}},i.dispatch=function(t){var e=t.subscriber,i=t.condition;if(!e.closed){if(t.needIterate)try{t.state=t.iterate(t.state)}catch(t){return void e.error(t)}else t.needIterate=!0;if(i){var n=void 0;try{n=i(t.state)}catch(t){return void e.error(t)}if(!n)return void e.complete();if(e.closed)return}var r;try{r=t.resultSelector(t.state)}catch(t){return void e.error(t)}if(!e.closed&&(e.next(r),!e.closed))return this.schedule(t)}},i}(yt).create;yt.generate=ce;var he=function(t){function i(e,i,n){t.call(this),this.condition=e,this.thenSource=i,this.elseSource=n}return e(i,t),i.create=function(t,e,n){return new i(t,e,n)},i.prototype._subscribe=function(t){var e=this.condition,i=this.thenSource,n=this.elseSource;return new ae(t,e,i,n)},i}(yt),ae=function(t){function i(e,i,n,r){t.call(this,e),this.condition=i,this.thenSource=n,this.elseSource=r,this.tryIf()}return e(i,t),i.prototype.tryIf=function(){var t=this.condition,e=this.thenSource,i=this.elseSource;try{var n=t()?e:i;n?this.add(d(this,n)):this._complete()}catch(t){this._error(t)}},i}(Ct),le=he.create;yt.if=le;var pe=function(t){function i(e,i){t.call(this,e,i),this.scheduler=e,this.work=i,this.pending=!1}return e(i,t),i.prototype.schedule=function(t,e){if(void 0===e&&(e=0),this.closed)return this;this.state=t,this.pending=!0;var i=this.id,n=this.scheduler;return null!=i&&(this.id=this.recycleAsyncId(n,i,e)),this.delay=e,this.id=this.id||this.requestAsyncId(n,this.id,e),this},i.prototype.requestAsyncId=function(t,e,i){return void 0===i&&(i=0),setInterval(t.flush.bind(t,this),i)},i.prototype.recycleAsyncId=function(t,e,i){if(void 0===i&&(i=0),null!==i&&this.delay===i&&!1===this.pending)return e;clearInterval(e)},i.prototype.execute=function(t,e){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var i=this._execute(t,e);if(i)return i;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},i.prototype._execute=function(t,e){var i=!1,n=void 0;try{this.work(t)}catch(t){i=!0,n=!!t&&t||new Error(t)}if(i)return this.unsubscribe(),n},i.prototype._unsubscribe=function(){var t=this.id,e=this.scheduler,i=e.actions,n=i.indexOf(this);this.work=null,this.state=null,this.pending=!1,this.scheduler=null,-1!==n&&i.splice(n,1),null!=t&&(this.id=this.recycleAsyncId(e,t,null)),this.delay=null},i}(function(t){function i(e,i){t.call(this)}return e(i,t),i.prototype.schedule=function(t,e){return void 0===e&&(e=0),this},i}(ht)),fe=function(t){function i(){t.apply(this,arguments),this.actions=[],this.active=!1,this.scheduled=void 0}return e(i,t),i.prototype.flush=function(t){var e=this.actions;if(this.active)e.push(t);else{var i;this.active=!0;do{if(i=t.execute(t.state,t.delay))break}while(t=e.shift());if(this.active=!1,i){for(;t=e.shift();)t.unsubscribe();throw i}}},i}(function(){function t(e,i){void 0===i&&(i=t.now),this.SchedulerAction=e,this.now=i}return t.prototype.schedule=function(t,e,i){return void 0===e&&(e=0),new this.SchedulerAction(this,t).schedule(i,e)},t.now=Date.now?Date.now:function(){return+new Date},t}()),de=new fe(pe),be=function(t){function i(e,i){void 0===e&&(e=0),void 0===i&&(i=de),t.call(this),this.period=e,this.scheduler=i,(!w(e)||e<0)&&(this.period=0),i&&"function"==typeof i.schedule||(this.scheduler=de)}return e(i,t),i.create=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=de),new i(t,e)},i.dispatch=function(t){var e=t.index,i=t.subscriber,n=t.period;i.next(e),i.closed||(t.index+=1,this.schedule(t,n))},i.prototype._subscribe=function(t){var e=this.period,n=this.scheduler;t.add(n.schedule(i.dispatch,e,{index:0,subscriber:t,period:e}))},i}(yt).create;yt.interval=be;var ye=x;yt.merge=ye;var ve=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new me(t))},t}(),me=function(t){function i(e){t.call(this,e),this.hasFirst=!1,this.observables=[],this.subscriptions=[]}return e(i,t),i.prototype._next=function(t){this.observables.push(t)},i.prototype._complete=function(){var t=this.observables,e=t.length;if(0===e)this.destination.complete();else{for(var i=0;i<e&&!this.hasFirst;i++){var n=t[i],r=d(this,n,n,i);this.subscriptions&&this.subscriptions.push(r),this.add(r)}this.observables=null}},i.prototype.notifyNext=function(t,e,i,n,r){if(!this.hasFirst){this.hasFirst=!0;for(var o=0;o<this.subscriptions.length;o++)if(o!==i){var s=this.subscriptions[o];s.unsubscribe(),this.remove(s)}this.subscriptions=null}this.destination.next(e)},i}(Ct),we=_;yt.race=we;var xe=function(t){function i(){t.call(this)}return e(i,t),i.create=function(){return new i},i.prototype._subscribe=function(t){},i}(yt).create;yt.never=xe;var _e=Et.of;yt.of=_e;var ge=function(){function t(t){this.nextSources=t}return t.prototype.call=function(t,e){return e.subscribe(new Se(t,this.nextSources))},t}(),Se=function(t){function i(e,i){t.call(this,e),this.destination=e,this.nextSources=i}return e(i,t),i.prototype.notifyError=function(t,e){this.subscribeToNextSource()},i.prototype.notifyComplete=function(t){this.subscribeToNextSource()},i.prototype._error=function(t){this.subscribeToNextSource()},i.prototype._complete=function(){this.subscribeToNextSource()},i.prototype.subscribeToNextSource=function(){var t=this.nextSources.shift();t?this.add(d(this,t)):this.destination.complete()},i}(Ct),Te=function(){for(var t=[],e=0;e<arguments.length;e++)t[e-0]=arguments[e];var i=null;return 1===t.length&&st(t[0])&&(t=t[0]),i=t.shift(),new ee(i,null).lift(new ge(t))};yt.onErrorResumeNext=Te;var Ie=function(t){function i(e,i){t.call(this),this.obj=e,this.scheduler=i,this.keys=Object.keys(e)}return e(i,t),i.create=function(t,e){return new i(t,e)},i.prototype._subscribe=function(t){var e=this.keys,i=this.scheduler,n=e.length;if(i)return i.schedule(g,0,{obj:this.obj,keys:e,length:n,index:0,subscriber:t});for(var r=0;r<n;r++){var o=e[r];t.next([o,this.obj[o]])}t.complete()},i}(yt).create;yt.pairs=Ie;var Ne=function(t){function i(e,i,n){t.call(this),this.start=e,this._count=i,this.scheduler=n}return e(i,t),i.create=function(t,e,n){return void 0===t&&(t=0),void 0===e&&(e=0),new i(t,e,n)},i.dispatch=function(t){var e=t.start,i=t.index,n=t.count,r=t.subscriber;i>=n?r.complete():(r.next(e),r.closed||(t.index=i+1,t.start=e+1,this.schedule(t)))},i.prototype._subscribe=function(t){var e=0,n=this.start,r=this._count,o=this.scheduler;if(o)return o.schedule(i.dispatch,0,{index:e,count:r,start:n,subscriber:t});for(;;){if(e++>=r){t.complete();break}if(t.next(n++),t.closed)break}},i}(yt).create;yt.range=Ne;var Ee=function(t){function i(e,i){t.call(this),this.resourceFactory=e,this.observableFactory=i}return e(i,t),i.create=function(t,e){return new i(t,e)},i.prototype._subscribe=function(t){var e,i=this.resourceFactory,n=this.observableFactory;try{return e=i(),new Ce(t,e,n)}catch(e){t.error(e)}},i}(yt),Ce=function(t){function i(e,i,n){t.call(this,e),this.resource=i,this.observableFactory=n,e.add(i),this.tryUse()}return e(i,t),i.prototype.tryUse=function(){try{var t=this.observableFactory.call(this,this.resource);t&&this.add(d(this,t))}catch(t){this._error(t)}},i}(Ct),Ve=Ee.create;yt.using=Ve;var ke=function(t){function i(e,i){t.call(this),this.error=e,this.scheduler=i}return e(i,t),i.create=function(t,e){return new i(t,e)},i.dispatch=function(t){var e=t.error;t.subscriber.error(e)},i.prototype._subscribe=function(t){var e=this.error,n=this.scheduler;if(t.syncErrorThrowable=!0,n)return n.schedule(i.dispatch,0,{error:e,subscriber:t});t.error(e)},i}(yt).create;yt.throw=ke;var je=function(t){function i(e,i,n){void 0===e&&(e=0),t.call(this),this.period=-1,this.dueTime=0,w(i)?this.period=Number(i)<1?1:Number(i):p(i)&&(n=i),p(n)||(n=de),this.scheduler=n,this.dueTime=S(e)?+e-this.scheduler.now():e}return e(i,t),i.create=function(t,e,n){return void 0===t&&(t=0),new i(t,e,n)},i.dispatch=function(t){var e=t.index,i=t.period,n=t.subscriber;if(n.next(e),!n.closed){if(-1===i)return n.complete();t.index=e+1,this.schedule(t,i)}},i.prototype._subscribe=function(t){var e=this.period,n=this.dueTime;return this.scheduler.schedule(i.dispatch,n,{index:0,period:e,subscriber:t})},i}(yt).create;yt.timer=je;var Oe=function(){function t(t){this.project=t}return t.prototype.call=function(t,e){return e.subscribe(new Ae(t,this.project))},t}(),Ae=function(t){function i(e,i,n){void 0===n&&(n=Object.create(null)),t.call(this,e),this.iterators=[],this.active=0,this.project="function"==typeof i?i:null,this.values=n}return e(i,t),i.prototype._next=function(t){var e=this.iterators;st(t)?e.push(new Pe(t)):"function"==typeof t[kt]?e.push(new Fe(t[kt]())):e.push(new Re(this.destination,this,t))},i.prototype._complete=function(){var t=this.iterators,e=t.length;if(0!==e){this.active=e;for(var i=0;i<e;i++){var n=t[i];n.stillUnsubscribed?this.add(n.subscribe(n,i)):this.active--}}else this.destination.complete()},i.prototype.notifyInactive=function(){this.active--,0===this.active&&this.destination.complete()},i.prototype.checkIterators=function(){for(var t=this.iterators,e=t.length,i=this.destination,n=0;n<e;n++){if("function"==typeof(s=t[n]).hasValue&&!s.hasValue())return}var r=!1,o=[];for(n=0;n<e;n++){var s,u=(s=t[n]).next();if(s.hasCompleted()&&(r=!0),u.done)return void i.complete();o.push(u.value)}this.project?this._tryProject(o):i.next(o),r&&i.complete()},i.prototype._tryProject=function(t){var e;try{e=this.project.apply(this,t)}catch(t){return void this.destination.error(t)}this.destination.next(e)},i}(ft),Fe=function(){function t(t){this.iterator=t,this.nextResult=t.next()}return t.prototype.hasValue=function(){return!0},t.prototype.next=function(){var t=this.nextResult;return this.nextResult=this.iterator.next(),t},t.prototype.hasCompleted=function(){var t=this.nextResult;return t&&t.done},t}(),Pe=function(){function t(t){this.array=t,this.index=0,this.length=0,this.length=t.length}return t.prototype[kt]=function(){return this},t.prototype.next=function(t){var e=this.index++,i=this.array;return e<this.length?{value:i[e],done:!1}:{value:null,done:!0}},t.prototype.hasValue=function(){return this.array.length>this.index},t.prototype.hasCompleted=function(){return this.array.length===this.index},t}(),Re=function(t){function i(e,i,n){t.call(this,e),this.parent=i,this.observable=n,this.stillUnsubscribed=!0,this.buffer=[],this.isComplete=!1}return e(i,t),i.prototype[kt]=function(){return this},i.prototype.next=function(){var t=this.buffer;return 0===t.length&&this.isComplete?{value:null,done:!0}:{value:t.shift(),done:!1}},i.prototype.hasValue=function(){return this.buffer.length>0},i.prototype.hasCompleted=function(){return 0===this.buffer.length&&this.isComplete},i.prototype.notifyComplete=function(){this.buffer.length>0?(this.isComplete=!0,this.parent.notifyInactive()):this.destination.complete()},i.prototype.notifyNext=function(t,e,i,n,r){this.buffer.push(e),this.parent.checkIterators()},i.prototype.subscribe=function(t,e){return d(this,this.observable,this,e)},i}(Ct),Me=T;yt.zip=Me;var qe=function(){function t(t,e){this.project=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new Be(t,this.project,this.thisArg))},t}(),Be=function(t){function i(e,i,n){t.call(this,e),this.project=i,this.count=0,this.thisArg=n||this}return e(i,t),i.prototype._next=function(t){var e;try{e=this.project.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}this.destination.next(e)},i}(ft),We=function(t){function i(e){t.call(this);var i={async:!0,createXHR:function(){return this.crossDomain?function(){if(rt.XMLHttpRequest)return new rt.XMLHttpRequest;if(rt.XDomainRequest)return new rt.XDomainRequest;throw new Error("CORS is not supported by your browser")}.call(this):function(){if(rt.XMLHttpRequest)return new rt.XMLHttpRequest;var t=void 0;try{for(var e=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],i=0;i<3;i++)try{if(t=e[i],new rt.ActiveXObject(t))break}catch(t){}return new rt.ActiveXObject(t)}catch(t){throw new Error("XMLHttpRequest is not supported by your browser")}}()},crossDomain:!1,withCredentials:!1,headers:{},method:"GET",responseType:"json",timeout:0};if("string"==typeof e)i.url=e;else for(var n in e)e.hasOwnProperty(n)&&(i[n]=e[n]);this.request=i}return e(i,t),i.prototype._subscribe=function(t){return new ze(t,this.request)},i.create=function(){var t=function(t){return new i(t)};return t.get=N,t.post=E,t.delete=C,t.put=V,t.patch=k,t.getJSON=j,t}(),i}(yt),ze=function(t){function i(e,i){t.call(this,e),this.request=i,this.done=!1;var n=i.headers=i.headers||{};i.crossDomain||n["X-Requested-With"]||(n["X-Requested-With"]="XMLHttpRequest"),"Content-Type"in n||rt.FormData&&i.body instanceof rt.FormData||void 0===i.body||(n["Content-Type"]="application/x-www-form-urlencoded; charset=UTF-8"),i.body=this.serializeBody(i.body,i.headers["Content-Type"]),this.send()}return e(i,t),i.prototype.next=function(t){this.done=!0;var e=this.xhr,i=this.request,n=this.destination,r=new Ye(t,e,i);n.next(r)},i.prototype.send=function(){var t=this.request,e=this.request,i=e.user,n=e.method,r=e.url,s=e.async,u=e.password,c=e.headers,h=e.body,a=o(t.createXHR).call(t);if(a===ut)this.error(ut.e);else{this.xhr=a,this.setupEvents(a,t);if((i?o(a.open).call(a,n,r,s,i,u):o(a.open).call(a,n,r,s))===ut)return this.error(ut.e),null;if(s&&(a.timeout=t.timeout,a.responseType=t.responseType),"withCredentials"in a&&(a.withCredentials=!!t.withCredentials),this.setHeaders(a,c),(h?o(a.send).call(a,h):o(a.send).call(a))===ut)return this.error(ut.e),null}return a},i.prototype.serializeBody=function(t,e){if(!t||"string"==typeof t)return t;if(rt.FormData&&t instanceof rt.FormData)return t;if(e){var i=e.indexOf(";");-1!==i&&(e=e.substring(0,i))}switch(e){case"application/x-www-form-urlencoded":return Object.keys(t).map(function(e){return encodeURI(e)+"="+encodeURI(t[e])}).join("&");case"application/json":return JSON.stringify(t);default:return t}},i.prototype.setHeaders=function(t,e){for(var i in e)e.hasOwnProperty(i)&&t.setRequestHeader(i,e[i])},i.prototype.setupEvents=function(t,e){function i(t){var e=i.subscriber,n=i.progressSubscriber,r=i.request;n&&n.error(t),e.error(new De(this,r))}function n(t){var e=n.subscriber,i=n.progressSubscriber,r=n.request;if(4===this.readyState){var o=1223===this.status?204:this.status,s="text"===this.responseType?this.response||this.responseText:this.response;0===o&&(o=s?200:0),200<=o&&o<300?(i&&i.complete(),e.next(t),e.complete()):(i&&i.error(t),e.error(new Ue("ajax error "+o,this,r)))}}var r=e.progressSubscriber;if(t.ontimeout=i,i.request=e,i.subscriber=this,i.progressSubscriber=r,t.upload&&"withCredentials"in t){if(r){var o;o=function(t){o.progressSubscriber.next(t)},rt.XDomainRequest?t.onprogress=o:t.upload.onprogress=o,o.progressSubscriber=r}var s;s=function(t){var e=s,i=e.progressSubscriber,n=e.subscriber,r=e.request;i&&i.error(t),n.error(new Ue("ajax error",this,r))},t.onerror=s,s.request=e,s.subscriber=this,s.progressSubscriber=r}t.onreadystatechange=n,n.subscriber=this,n.progressSubscriber=r,n.request=e},i.prototype.unsubscribe=function(){var e=this.done,i=this.xhr;!e&&i&&4!==i.readyState&&"function"==typeof i.abort&&i.abort(),t.prototype.unsubscribe.call(this)},i}(ft),Ye=function(){return function(t,e,i){switch(this.originalEvent=t,this.xhr=e,this.request=i,this.status=e.status,this.responseType=e.responseType||i.responseType,this.responseType){case"json":this.response="response"in e?e.responseType?e.response:JSON.parse(e.response||e.responseText||"null"):JSON.parse(e.responseText||"null");break;case"xml":this.response=e.responseXML;break;case"text":default:this.response="response"in e?e.response:e.responseText}}}(),Ue=function(t){function i(e,i,n){t.call(this,e),this.message=e,this.xhr=i,this.request=n,this.status=i.status}return e(i,t),i}(Error),De=function(t){function i(e,i){t.call(this,"ajax timeout",e,i)}return e(i,t),i}(Ue),Le=We.create;yt.ajax=Le;var He=function(t){function i(e,i){t.call(this,e,i),this.scheduler=e,this.work=i}return e(i,t),i.prototype.schedule=function(e,i){return void 0===i&&(i=0),i>0?t.prototype.schedule.call(this,e,i):(this.delay=i,this.state=e,this.scheduler.flush(this),this)},i.prototype.execute=function(e,i){return i>0||this.closed?t.prototype.execute.call(this,e,i):this._execute(e,i)},i.prototype.requestAsyncId=function(e,i,n){return void 0===n&&(n=0),null!==n&&n>0||null===n&&this.delay>0?t.prototype.requestAsyncId.call(this,e,i,n):e.flush(this)},i}(pe),Xe=new(function(t){function i(){t.apply(this,arguments)}return e(i,t),i}(fe))(He),Ge=function(t){function i(e,i,n){void 0===e&&(e=Number.POSITIVE_INFINITY),void 0===i&&(i=Number.POSITIVE_INFINITY),t.call(this),this.scheduler=n,this._events=[],this._bufferSize=e<1?1:e,this._windowTime=i<1?1:i}return e(i,t),i.prototype.next=function(e){var i=this._getNow();this._events.push(new Je(i,e)),this._trimBufferThenGetEvents(),t.prototype.next.call(this,e)},i.prototype._subscribe=function(t){var e,i=this._trimBufferThenGetEvents(),n=this.scheduler;if(this.closed)throw new vt;this.hasError?e=ht.EMPTY:this.isStopped?e=ht.EMPTY:(this.observers.push(t),e=new mt(this,t)),n&&t.add(t=new Zt(t,n));for(var r=i.length,o=0;o<r&&!t.closed;o++)t.next(i[o].value);return this.hasError?t.error(this.thrownError):this.isStopped&&t.complete(),e},i.prototype._getNow=function(){return(this.scheduler||Xe).now()},i.prototype._trimBufferThenGetEvents=function(){for(var t=this._getNow(),e=this._bufferSize,i=this._windowTime,n=this._events,r=n.length,o=0;o<r&&!(t-n[o].time<i);)o++;return r>e&&(o=Math.max(o,r-e)),o>0&&n.splice(0,o),n},i}(xt),Je=function(){return function(t,e){this.time=t,this.value=e}}(),Ke=Object.assign||function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];for(var n=e.length,r=0;r<n;r++){var o=e[r];for(var s in o)o.hasOwnProperty(s)&&(t[s]=o[s])}return t},$e=function(t){function i(e,i){if(e instanceof yt)t.call(this,i,e);else{if(t.call(this),this.WebSocketCtor=rt.WebSocket,this._output=new xt,"string"==typeof e?this.url=e:Ke(this,e),!this.WebSocketCtor)throw new Error("no WebSocket constructor can be found");this.destination=new Ge}}return e(i,t),i.prototype.resultSelector=function(t){return JSON.parse(t.data)},i.create=function(t){return new i(t)},i.prototype.lift=function(t){var e=new i(this,this.destination);return e.operator=t,e},i.prototype._resetState=function(){this.socket=null,this.source||(this.destination=new Ge),this._output=new xt},i.prototype.multiplex=function(t,e,i){var n=this;return new yt(function(r){var s=o(t)();s===ut?r.error(ut.e):n.next(s);var u=n.subscribe(function(t){var e=o(i)(t);e===ut?r.error(ut.e):e&&r.next(t)},function(t){return r.error(t)},function(){return r.complete()});return function(){var t=o(e)();t===ut?r.error(ut.e):n.next(t),u.unsubscribe()}})},i.prototype._connectSocket=function(){var t=this,e=this.WebSocketCtor,i=this._output,n=null;try{n=this.protocol?new e(this.url,this.protocol):new e(this.url),this.socket=n,this.binaryType&&(this.socket.binaryType=this.binaryType)}catch(t){return void i.error(t)}var r=new ht(function(){t.socket=null,n&&1===n.readyState&&n.close()});n.onopen=function(e){var o=t.openObserver;o&&o.next(e);var s=t.destination;t.destination=ft.create(function(t){return 1===n.readyState&&n.send(t)},function(e){var r=t.closingObserver;r&&r.next(void 0),e&&e.code?n.close(e.code,e.reason):i.error(new TypeError("WebSocketSubject.error must be called with an object with an error code, and an optional reason: { code: number, reason: string }")),t._resetState()},function(){var e=t.closingObserver;e&&e.next(void 0),n.close(),t._resetState()}),s&&s instanceof Ge&&r.add(s.subscribe(t.destination))},n.onerror=function(e){t._resetState(),i.error(e)},n.onclose=function(e){t._resetState();var n=t.closeObserver;n&&n.next(e),e.wasClean?i.complete():i.error(e)},n.onmessage=function(e){var n=o(t.resultSelector)(e);n===ut?i.error(ut.e):i.next(n)}},i.prototype._subscribe=function(t){var e=this,i=this.source;if(i)return i.subscribe(t);this.socket||this._connectSocket();var n=new ht;return n.add(this._output.subscribe(t)),n.add(function(){var t=e.socket;0===e._output.observers.length&&(t&&1===t.readyState&&t.close(),e._resetState())}),n},i.prototype.unsubscribe=function(){var e=this.source,i=this.socket;i&&1===i.readyState&&(i.close(),this._resetState()),t.prototype.unsubscribe.call(this),e||(this.destination=new Ge)},i}(_t).create;yt.webSocket=$e;var Qe=function(){function t(t){this.closingNotifier=t}return t.prototype.call=function(t,e){return e.subscribe(new Ze(t,this.closingNotifier))},t}(),Ze=function(t){function i(e,i){t.call(this,e),this.buffer=[],this.add(d(this,i))}return e(i,t),i.prototype._next=function(t){this.buffer.push(t)},i.prototype.notifyNext=function(t,e,i,n,r){var o=this.buffer;this.buffer=[],this.destination.next(o)},i}(Ct);yt.prototype.buffer=function(t){return this.lift(new Qe(t))};var ti=function(){function t(t,e){this.bufferSize=t,this.startBufferEvery=e,this.subscriberClass=e&&t!==e?ii:ei}return t.prototype.call=function(t,e){return e.subscribe(new this.subscriberClass(t,this.bufferSize,this.startBufferEvery))},t}(),ei=function(t){function i(e,i){t.call(this,e),this.bufferSize=i,this.buffer=[]}return e(i,t),i.prototype._next=function(t){var e=this.buffer;e.push(t),e.length==this.bufferSize&&(this.destination.next(e),this.buffer=[])},i.prototype._complete=function(){var e=this.buffer;e.length>0&&this.destination.next(e),t.prototype._complete.call(this)},i}(ft),ii=function(t){function i(e,i,n){t.call(this,e),this.bufferSize=i,this.startBufferEvery=n,this.buffers=[],this.count=0}return e(i,t),i.prototype._next=function(t){var e=this.bufferSize,i=this.startBufferEvery,n=this.buffers,r=this.count;this.count++,r%i==0&&n.push([]);for(var o=n.length;o--;){var s=n[o];s.push(t),s.length===e&&(n.splice(o,1),this.destination.next(s))}},i.prototype._complete=function(){for(var e=this.buffers,i=this.destination;e.length>0;){var n=e.shift();n.length>0&&i.next(n)}t.prototype._complete.call(this)},i}(ft);yt.prototype.bufferCount=function(t,e){return void 0===e&&(e=null),this.lift(new ti(t,e))};var ni=function(){function t(t,e,i,n){this.bufferTimeSpan=t,this.bufferCreationInterval=e,this.maxBufferSize=i,this.scheduler=n}return t.prototype.call=function(t,e){return e.subscribe(new oi(t,this.bufferTimeSpan,this.bufferCreationInterval,this.maxBufferSize,this.scheduler))},t}(),ri=function(){return function(){this.buffer=[]}}(),oi=function(t){function i(e,i,n,r,o){t.call(this,e),this.bufferTimeSpan=i,this.bufferCreationInterval=n,this.maxBufferSize=r,this.scheduler=o,this.contexts=[];var s=this.openContext();if(this.timespanOnly=null==n||n<0,this.timespanOnly){var u={subscriber:this,context:s,bufferTimeSpan:i};this.add(s.closeAction=o.schedule(O,i,u))}else{var c={subscriber:this,context:s},h={bufferTimeSpan:i,bufferCreationInterval:n,subscriber:this,scheduler:o};this.add(s.closeAction=o.schedule(F,i,c)),this.add(o.schedule(A,n,h))}}return e(i,t),i.prototype._next=function(t){for(var e,i=this.contexts,n=i.length,r=0;r<n;r++){var o=i[r],s=o.buffer;s.push(t),s.length==this.maxBufferSize&&(e=o)}e&&this.onBufferFull(e)},i.prototype._error=function(e){this.contexts.length=0,t.prototype._error.call(this,e)},i.prototype._complete=function(){for(var e=this.contexts,i=this.destination;e.length>0;){var n=e.shift();i.next(n.buffer)}t.prototype._complete.call(this)},i.prototype._unsubscribe=function(){this.contexts=null},i.prototype.onBufferFull=function(t){this.closeContext(t);var e=t.closeAction;if(e.unsubscribe(),this.remove(e),!this.closed&&this.timespanOnly){t=this.openContext();var i=this.bufferTimeSpan,n={subscriber:this,context:t,bufferTimeSpan:i};this.add(t.closeAction=this.scheduler.schedule(O,i,n))}},i.prototype.openContext=function(){var t=new ri;return this.contexts.push(t),t},i.prototype.closeContext=function(t){this.destination.next(t.buffer);var e=this.contexts;(e?e.indexOf(t):-1)>=0&&e.splice(e.indexOf(t),1)},i}(ft);yt.prototype.bufferTime=function(t){var e=arguments.length,i=de;p(arguments[arguments.length-1])&&(i=arguments[arguments.length-1],e--);var n=null;e>=2&&(n=arguments[1]);var r=Number.POSITIVE_INFINITY;return e>=3&&(r=arguments[2]),this.lift(new ni(t,n,r,i))};var si=function(){function t(t,e){this.openings=t,this.closingSelector=e}return t.prototype.call=function(t,e){return e.subscribe(new ui(t,this.openings,this.closingSelector))},t}(),ui=function(t){function i(e,i,n){t.call(this,e),this.openings=i,this.closingSelector=n,this.contexts=[],this.add(d(this,i))}return e(i,t),i.prototype._next=function(t){for(var e=this.contexts,i=e.length,n=0;n<i;n++)e[n].buffer.push(t)},i.prototype._error=function(e){for(var i=this.contexts;i.length>0;){var n=i.shift();n.subscription.unsubscribe(),n.buffer=null,n.subscription=null}this.contexts=null,t.prototype._error.call(this,e)},i.prototype._complete=function(){for(var e=this.contexts;e.length>0;){var i=e.shift();this.destination.next(i.buffer),i.subscription.unsubscribe(),i.buffer=null,i.subscription=null}this.contexts=null,t.prototype._complete.call(this)},i.prototype.notifyNext=function(t,e,i,n,r){t?this.closeBuffer(t):this.openBuffer(e)},i.prototype.notifyComplete=function(t){this.closeBuffer(t.context)},i.prototype.openBuffer=function(t){try{var e=this.closingSelector.call(this,t);e&&this.trySubscribe(e)}catch(t){this._error(t)}},i.prototype.closeBuffer=function(t){var e=this.contexts;if(e&&t){var i=t.buffer,n=t.subscription;this.destination.next(i),e.splice(e.indexOf(t),1),this.remove(n),n.unsubscribe()}},i.prototype.trySubscribe=function(t){var e=this.contexts,i=new ht,n={buffer:[],subscription:i};e.push(n);var r=d(this,t,n);!r||r.closed?this.closeBuffer(n):(r.context=n,this.add(r),i.add(r))},i}(Ct);yt.prototype.bufferToggle=function(t,e){return this.lift(new si(t,e))};var ci=function(){function t(t){this.closingSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new hi(t,this.closingSelector))},t}(),hi=function(t){function i(e,i){t.call(this,e),this.closingSelector=i,this.subscribing=!1,this.openBuffer()}return e(i,t),i.prototype._next=function(t){this.buffer.push(t)},i.prototype._complete=function(){var e=this.buffer;e&&this.destination.next(e),t.prototype._complete.call(this)},i.prototype._unsubscribe=function(){this.buffer=null,this.subscribing=!1},i.prototype.notifyNext=function(t,e,i,n,r){this.openBuffer()},i.prototype.notifyComplete=function(){this.subscribing?this.complete():this.openBuffer()},i.prototype.openBuffer=function(){var t=this.closingSubscription;t&&(this.remove(t),t.unsubscribe());var e=this.buffer;this.buffer&&this.destination.next(e),this.buffer=[];var i=o(this.closingSelector)();i===ut?this.error(ut.e):(t=new ht,this.closingSubscription=t,this.add(t),this.subscribing=!0,t.add(d(this,i)),this.subscribing=!1)},i}(Ct);yt.prototype.bufferWhen=function(t){return this.lift(new ci(t))};var ai=function(){function t(t){this.selector=t}return t.prototype.call=function(t,e){return e.subscribe(new li(t,this.selector,this.caught))},t}(),li=function(t){function i(e,i,n){t.call(this,e),this.selector=i,this.caught=n}return e(i,t),i.prototype.error=function(e){if(!this.isStopped){var i=void 0;try{i=this.selector(e,this.caught)}catch(e){return void t.prototype.error.call(this,e)}this._unsubscribeAndRecycle(),this.add(d(this,i))}},i}(Ct);yt.prototype.catch=P,yt.prototype._catch=P,yt.prototype.combineAll=function(t){return this.lift(new At(t))},yt.prototype.combineLatest=function(){for(var t=[],e=0;e<arguments.length;e++)t[e-0]=arguments[e];var i=null;return"function"==typeof t[t.length-1]&&(i=t.pop()),1===t.length&&st(t[0])&&(t=t[0].slice()),t.unshift(this),this.lift.call(new Et(t),new At(i))},yt.prototype.concat=function(){for(var t=[],e=0;e<arguments.length;e++)t[e-0]=arguments[e];return this.lift.call(b.apply(void 0,[this].concat(t)))},yt.prototype.concatAll=function(){return this.lift(new Pt(1))};var pi=function(){function t(t,e,i){void 0===i&&(i=Number.POSITIVE_INFINITY),this.project=t,this.resultSelector=e,this.concurrent=i}return t.prototype.call=function(t,e){return e.subscribe(new fi(t,this.project,this.resultSelector,this.concurrent))},t}(),fi=function(t){function i(e,i,n,r){void 0===r&&(r=Number.POSITIVE_INFINITY),t.call(this,e),this.project=i,this.resultSelector=n,this.concurrent=r,this.hasCompleted=!1,this.buffer=[],this.active=0,this.index=0}return e(i,t),i.prototype._next=function(t){this.active<this.concurrent?this._tryNext(t):this.buffer.push(t)},i.prototype._tryNext=function(t){var e,i=this.index++;try{e=this.project(t,i)}catch(t){return void this.destination.error(t)}this.active++,this._innerSub(e,t,i)},i.prototype._innerSub=function(t,e,i){this.add(d(this,t,e,i))},i.prototype._complete=function(){this.hasCompleted=!0,0===this.active&&0===this.buffer.length&&this.destination.complete()},i.prototype.notifyNext=function(t,e,i,n,r){this.resultSelector?this._notifyResultSelector(t,e,i,n):this.destination.next(e)},i.prototype._notifyResultSelector=function(t,e,i,n){var r;try{r=this.resultSelector(t,e,i,n)}catch(t){return void this.destination.error(t)}this.destination.next(r)},i.prototype.notifyComplete=function(t){var e=this.buffer;this.remove(t),this.active--,e.length>0?this._next(e.shift()):0===this.active&&this.hasCompleted&&this.destination.complete()},i}(Ct);yt.prototype.concatMap=function(t,e){return this.lift(new pi(t,e,1))};var di=function(){function t(t,e,i){void 0===i&&(i=Number.POSITIVE_INFINITY),this.ish=t,this.resultSelector=e,this.concurrent=i}return t.prototype.call=function(t,e){return e.subscribe(new bi(t,this.ish,this.resultSelector,this.concurrent))},t}(),bi=function(t){function i(e,i,n,r){void 0===r&&(r=Number.POSITIVE_INFINITY),t.call(this,e),this.ish=i,this.resultSelector=n,this.concurrent=r,this.hasCompleted=!1,this.buffer=[],this.active=0,this.index=0}return e(i,t),i.prototype._next=function(t){if(this.active<this.concurrent){var e=this.resultSelector,i=this.index++,n=this.ish,r=this.destination;this.active++,this._innerSub(n,r,e,t,i)}else this.buffer.push(t)},i.prototype._innerSub=function(t,e,i,n,r){this.add(d(this,t,n,r))},i.prototype._complete=function(){this.hasCompleted=!0,0===this.active&&0===this.buffer.length&&this.destination.complete()},i.prototype.notifyNext=function(t,e,i,n,r){var o=this.resultSelector,s=this.destination;o?this.trySelectResult(t,e,i,n):s.next(e)},i.prototype.trySelectResult=function(t,e,i,n){var r,o=this.resultSelector,s=this.destination;try{r=o(t,e,i,n)}catch(t){return void s.error(t)}s.next(r)},i.prototype.notifyError=function(t){this.destination.error(t)},i.prototype.notifyComplete=function(t){var e=this.buffer;this.remove(t),this.active--,e.length>0?this._next(e.shift()):0===this.active&&this.hasCompleted&&this.destination.complete()},i}(Ct);yt.prototype.concatMapTo=function(t,e){return this.lift(new di(t,e,1))};var yi=function(){function t(t,e){this.predicate=t,this.source=e}return t.prototype.call=function(t,e){return e.subscribe(new vi(t,this.predicate,this.source))},t}(),vi=function(t){function i(e,i,n){t.call(this,e),this.predicate=i,this.source=n,this.count=0,this.index=0}return e(i,t),i.prototype._next=function(t){this.predicate?this._tryPredicate(t):this.count++},i.prototype._tryPredicate=function(t){var e;try{e=this.predicate(t,this.index++,this.source)}catch(t){return void this.destination.error(t)}e&&this.count++},i.prototype._complete=function(){this.destination.next(this.count),this.destination.complete()},i}(ft);yt.prototype.count=function(t){return this.lift(new yi(t,this))};var mi=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new wi(t))},t}(),wi=function(t){function i(e){t.call(this,e)}return e(i,t),i.prototype._next=function(t){t.observe(this.destination)},i}(ft);yt.prototype.dematerialize=function(){return this.lift(new mi)};var xi=function(){function t(t){this.durationSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new _i(t,this.durationSelector))},t}(),_i=function(t){function i(e,i){t.call(this,e),this.durationSelector=i,this.hasValue=!1,this.durationSubscription=null}return e(i,t),i.prototype._next=function(t){try{var e=this.durationSelector.call(this,t);e&&this._tryNext(t,e)}catch(t){this.destination.error(t)}},i.prototype._complete=function(){this.emitValue(),this.destination.complete()},i.prototype._tryNext=function(t,e){var i=this.durationSubscription;this.value=t,this.hasValue=!0,i&&(i.unsubscribe(),this.remove(i)),(i=d(this,e)).closed||this.add(this.durationSubscription=i)},i.prototype.notifyNext=function(t,e,i,n,r){this.emitValue()},i.prototype.notifyComplete=function(){this.emitValue()},i.prototype.emitValue=function(){if(this.hasValue){var e=this.value,i=this.durationSubscription;i&&(this.durationSubscription=null,i.unsubscribe(),this.remove(i)),this.value=null,this.hasValue=!1,t.prototype._next.call(this,e)}},i}(Ct);yt.prototype.debounce=function(t){return this.lift(new xi(t))};var gi=function(){function t(t,e){this.dueTime=t,this.scheduler=e}return t.prototype.call=function(t,e){return e.subscribe(new Si(t,this.dueTime,this.scheduler))},t}(),Si=function(t){function i(e,i,n){t.call(this,e),this.dueTime=i,this.scheduler=n,this.debouncedSubscription=null,this.lastValue=null,this.hasValue=!1}return e(i,t),i.prototype._next=function(t){this.clearDebounce(),this.lastValue=t,this.hasValue=!0,this.add(this.debouncedSubscription=this.scheduler.schedule(q,this.dueTime,this))},i.prototype._complete=function(){this.debouncedNext(),this.destination.complete()},i.prototype.debouncedNext=function(){this.clearDebounce(),this.hasValue&&(this.destination.next(this.lastValue),this.lastValue=null,this.hasValue=!1)},i.prototype.clearDebounce=function(){var t=this.debouncedSubscription;null!==t&&(this.remove(t),t.unsubscribe(),this.debouncedSubscription=null)},i}(ft);yt.prototype.debounceTime=function(t,e){return void 0===e&&(e=de),this.lift(new gi(t,e))};var Ti=function(){function t(t){this.defaultValue=t}return t.prototype.call=function(t,e){return e.subscribe(new Ii(t,this.defaultValue))},t}(),Ii=function(t){function i(e,i){t.call(this,e),this.defaultValue=i,this.isEmpty=!0}return e(i,t),i.prototype._next=function(t){this.isEmpty=!1,this.destination.next(t)},i.prototype._complete=function(){this.isEmpty&&this.destination.next(this.defaultValue),this.destination.complete()},i}(ft);yt.prototype.defaultIfEmpty=function(t){return void 0===t&&(t=null),this.lift(new Ti(t))};var Ni=function(){function t(t,e){this.delay=t,this.scheduler=e}return t.prototype.call=function(t,e){return e.subscribe(new Ei(t,this.delay,this.scheduler))},t}(),Ei=function(t){function i(e,i,n){t.call(this,e),this.delay=i,this.scheduler=n,this.queue=[],this.active=!1,this.errored=!1}return e(i,t),i.dispatch=function(t){for(var e=t.source,i=e.queue,n=t.scheduler,r=t.destination;i.length>0&&i[0].time-n.now()<=0;)i.shift().notification.observe(r);if(i.length>0){var o=Math.max(0,i[0].time-n.now());this.schedule(t,o)}else e.active=!1},i.prototype._schedule=function(t){this.active=!0,this.add(t.schedule(i.dispatch,this.delay,{source:this,destination:this.destination,scheduler:t}))},i.prototype.scheduleNotification=function(t){if(!0!==this.errored){var e=this.scheduler,i=new Ci(e.now()+this.delay,t);this.queue.push(i),!1===this.active&&this._schedule(e)}},i.prototype._next=function(t){this.scheduleNotification($t.createNext(t))},i.prototype._error=function(t){this.errored=!0,this.queue=[],this.destination.error(t)},i.prototype._complete=function(){this.scheduleNotification($t.createComplete())},i}(ft),Ci=function(){return function(t,e){this.time=t,this.notification=e}}();yt.prototype.delay=function(t,e){void 0===e&&(e=de);var i=S(t)?+t-e.now():Math.abs(t);return this.lift(new Ni(i,e))};var Vi=function(){function t(t){this.delayDurationSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new ki(t,this.delayDurationSelector))},t}(),ki=function(t){function i(e,i){t.call(this,e),this.delayDurationSelector=i,this.completed=!1,this.delayNotifierSubscriptions=[],this.values=[]}return e(i,t),i.prototype.notifyNext=function(t,e,i,n,r){this.destination.next(t),this.removeSubscription(r),this.tryComplete()},i.prototype.notifyError=function(t,e){this._error(t)},i.prototype.notifyComplete=function(t){var e=this.removeSubscription(t);e&&this.destination.next(e),this.tryComplete()},i.prototype._next=function(t){try{var e=this.delayDurationSelector(t);e&&this.tryDelay(e,t)}catch(t){this.destination.error(t)}},i.prototype._complete=function(){this.completed=!0,this.tryComplete()},i.prototype.removeSubscription=function(t){t.unsubscribe();var e=this.delayNotifierSubscriptions.indexOf(t),i=null;return-1!==e&&(i=this.values[e],this.delayNotifierSubscriptions.splice(e,1),this.values.splice(e,1)),i},i.prototype.tryDelay=function(t,e){var i=d(this,t,e);i&&!i.closed&&(this.add(i),this.delayNotifierSubscriptions.push(i)),this.values.push(e)},i.prototype.tryComplete=function(){this.completed&&0===this.delayNotifierSubscriptions.length&&this.destination.complete()},i}(Ct),ji=function(t){function i(e,i){t.call(this),this.source=e,this.subscriptionDelay=i}return e(i,t),i.prototype._subscribe=function(t){this.subscriptionDelay.subscribe(new Oi(t,this.source))},i}(yt),Oi=function(t){function i(e,i){t.call(this),this.parent=e,this.source=i,this.sourceSubscribed=!1}return e(i,t),i.prototype._next=function(t){this.subscribeToSource()},i.prototype._error=function(t){this.unsubscribe(),this.parent.error(t)},i.prototype._complete=function(){this.subscribeToSource()},i.prototype.subscribeToSource=function(){this.sourceSubscribed||(this.sourceSubscribed=!0,this.unsubscribe(),this.source.subscribe(this.parent))},i}(ft);yt.prototype.delayWhen=function(t,e){return e?new ji(this,e).lift(new Vi(t)):this.lift(new Vi(t))};var Ai=rt.Set||function(){function t(){this._values=[]}return t.prototype.add=function(t){this.has(t)||this._values.push(t)},t.prototype.has=function(t){return-1!==this._values.indexOf(t)},Object.defineProperty(t.prototype,"size",{get:function(){return this._values.length},enumerable:!0,configurable:!0}),t.prototype.clear=function(){this._values.length=0},t}(),Fi=function(){function t(t,e){this.keySelector=t,this.flushes=e}return t.prototype.call=function(t,e){return e.subscribe(new Pi(t,this.keySelector,this.flushes))},t}(),Pi=function(t){function i(e,i,n){t.call(this,e),this.keySelector=i,this.values=new Ai,n&&this.add(d(this,n))}return e(i,t),i.prototype.notifyNext=function(t,e,i,n,r){this.values.clear()},i.prototype.notifyError=function(t,e){this._error(t)},i.prototype._next=function(t){this.keySelector?this._useKeySelector(t):this._finalizeNext(t,t)},i.prototype._useKeySelector=function(t){var e,i=this.destination;try{e=this.keySelector(t)}catch(t){return void i.error(t)}this._finalizeNext(e,t)},i.prototype._finalizeNext=function(t,e){var i=this.values;i.has(t)||(i.add(t),this.destination.next(e))},i}(Ct);yt.prototype.distinct=function(t,e){return this.lift(new Fi(t,e))};var Ri=function(){function t(t,e){this.compare=t,this.keySelector=e}return t.prototype.call=function(t,e){return e.subscribe(new Mi(t,this.compare,this.keySelector))},t}(),Mi=function(t){function i(e,i,n){t.call(this,e),this.keySelector=n,this.hasKey=!1,"function"==typeof i&&(this.compare=i)}return e(i,t),i.prototype.compare=function(t,e){return t===e},i.prototype._next=function(t){var e=t;if(this.keySelector&&(e=o(this.keySelector)(t))===ut)return this.destination.error(ut.e);var i=!1;if(this.hasKey){if((i=o(this.compare)(this.key,e))===ut)return this.destination.error(ut.e)}else this.hasKey=!0;!1===Boolean(i)&&(this.key=e,this.destination.next(t))},i}(ft);yt.prototype.distinctUntilChanged=B,yt.prototype.distinctUntilKeyChanged=function(t,e){return B.call(this,function(i,n){return e?e(i[t],n[t]):i[t]===n[t]})};var qi=function(){function t(t,e,i){this.nextOrObserver=t,this.error=e,this.complete=i}return t.prototype.call=function(t,e){return e.subscribe(new Bi(t,this.nextOrObserver,this.error,this.complete))},t}(),Bi=function(t){function i(e,i,n,r){t.call(this,e);var o=new ft(i,n,r);o.syncErrorThrowable=!0,this.add(o),this.safeSubscriber=o}return e(i,t),i.prototype._next=function(t){var e=this.safeSubscriber;e.next(t),e.syncErrorThrown?this.destination.error(e.syncErrorValue):this.destination.next(t)},i.prototype._error=function(t){var e=this.safeSubscriber;e.error(t),e.syncErrorThrown?this.destination.error(e.syncErrorValue):this.destination.error(t)},i.prototype._complete=function(){var t=this.safeSubscriber;t.complete(),t.syncErrorThrown?this.destination.error(t.syncErrorValue):this.destination.complete()},i}(ft);yt.prototype.do=W,yt.prototype._do=W;var Wi=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new zi(t))},t}(),zi=function(t){function i(e){t.call(this,e),this.hasCompleted=!1,this.hasSubscription=!1}return e(i,t),i.prototype._next=function(t){this.hasSubscription||(this.hasSubscription=!0,this.add(d(this,t)))},i.prototype._complete=function(){this.hasCompleted=!0,this.hasSubscription||this.destination.complete()},i.prototype.notifyComplete=function(t){this.remove(t),this.hasSubscription=!1,this.hasCompleted&&this.destination.complete()},i}(Ct);yt.prototype.exhaust=function(){return this.lift(new Wi)};var Yi=function(){function t(t,e){this.project=t,this.resultSelector=e}return t.prototype.call=function(t,e){return e.subscribe(new Ui(t,this.project,this.resultSelector))},t}(),Ui=function(t){function i(e,i,n){t.call(this,e),this.project=i,this.resultSelector=n,this.hasSubscription=!1,this.hasCompleted=!1,this.index=0}return e(i,t),i.prototype._next=function(t){this.hasSubscription||this.tryNext(t)},i.prototype.tryNext=function(t){var e=this.index++,i=this.destination;try{var n=this.project(t,e);this.hasSubscription=!0,this.add(d(this,n,t,e))}catch(t){i.error(t)}},i.prototype._complete=function(){this.hasCompleted=!0,this.hasSubscription||this.destination.complete()},i.prototype.notifyNext=function(t,e,i,n,r){var o=this.resultSelector,s=this.destination;o?this.trySelectResult(t,e,i,n):s.next(e)},i.prototype.trySelectResult=function(t,e,i,n){var r=this.resultSelector,o=this.destination;try{var s=r(t,e,i,n);o.next(s)}catch(t){o.error(t)}},i.prototype.notifyError=function(t){this.destination.error(t)},i.prototype.notifyComplete=function(t){this.remove(t),this.hasSubscription=!1,this.hasCompleted&&this.destination.complete()},i}(Ct);yt.prototype.exhaustMap=function(t,e){return this.lift(new Yi(t,e))};var Di=function(){function t(t,e,i){this.project=t,this.concurrent=e,this.scheduler=i}return t.prototype.call=function(t,e){return e.subscribe(new Li(t,this.project,this.concurrent,this.scheduler))},t}(),Li=function(t){function i(e,i,n,r){t.call(this,e),this.project=i,this.concurrent=n,this.scheduler=r,this.index=0,this.active=0,this.hasCompleted=!1,n<Number.POSITIVE_INFINITY&&(this.buffer=[])}return e(i,t),i.dispatch=function(t){var e=t.subscriber,i=t.result,n=t.value,r=t.index;e.subscribeToProjection(i,n,r)},i.prototype._next=function(t){var e=this.destination;if(e.closed)this._complete();else{var n=this.index++;if(this.active<this.concurrent){e.next(t);var r=o(this.project)(t,n);if(r===ut)e.error(ut.e);else if(this.scheduler){var s={subscriber:this,result:r,value:t,index:n};this.add(this.scheduler.schedule(i.dispatch,0,s))}else this.subscribeToProjection(r,t,n)}else this.buffer.push(t)}},i.prototype.subscribeToProjection=function(t,e,i){this.active++,this.add(d(this,t,e,i))},i.prototype._complete=function(){this.hasCompleted=!0,this.hasCompleted&&0===this.active&&this.destination.complete()},i.prototype.notifyNext=function(t,e,i,n,r){this._next(e)},i.prototype.notifyComplete=function(t){var e=this.buffer;this.remove(t),this.active--,e&&e.length>0&&this._next(e.shift()),this.hasCompleted&&0===this.active&&this.destination.complete()},i}(Ct);yt.prototype.expand=function(t,e,i){return void 0===e&&(e=Number.POSITIVE_INFINITY),void 0===i&&(i=void 0),e=(e||0)<1?Number.POSITIVE_INFINITY:e,this.lift(new Di(t,e,i))};var Hi=function(t){function i(){var e=t.call(this,"argument out of range");this.name=e.name="ArgumentOutOfRangeError",this.stack=e.stack,this.message=e.message}return e(i,t),i}(Error),Xi=function(){function t(t,e){if(this.index=t,this.defaultValue=e,t<0)throw new Hi}return t.prototype.call=function(t,e){return e.subscribe(new Gi(t,this.index,this.defaultValue))},t}(),Gi=function(t){function i(e,i,n){t.call(this,e),this.index=i,this.defaultValue=n}return e(i,t),i.prototype._next=function(t){0==this.index--&&(this.destination.next(t),this.destination.complete())},i.prototype._complete=function(){var t=this.destination;this.index>=0&&(void 0!==this.defaultValue?t.next(this.defaultValue):t.error(new Hi)),t.complete()},i}(ft);yt.prototype.elementAt=function(t,e){return this.lift(new Xi(t,e))};var Ji=function(){function t(t,e){this.predicate=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new Ki(t,this.predicate,this.thisArg))},t}(),Ki=function(t){function i(e,i,n){t.call(this,e),this.predicate=i,this.thisArg=n,this.count=0}return e(i,t),i.prototype._next=function(t){var e;try{e=this.predicate.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}e&&this.destination.next(t)},i}(ft);yt.prototype.filter=z;var $i=function(){function t(t){this.callback=t}return t.prototype.call=function(t,e){return e.subscribe(new Qi(t,this.callback))},t}(),Qi=function(t){function i(e,i){t.call(this,e),this.add(new ht(i))}return e(i,t),i}(ft);yt.prototype.finally=Y,yt.prototype._finally=Y;var Zi=function(){function t(t,e,i,n){this.predicate=t,this.source=e,this.yieldIndex=i,this.thisArg=n}return t.prototype.call=function(t,e){return e.subscribe(new tn(t,this.predicate,this.source,this.yieldIndex,this.thisArg))},t}(),tn=function(t){function i(e,i,n,r,o){t.call(this,e),this.predicate=i,this.source=n,this.yieldIndex=r,this.thisArg=o,this.index=0}return e(i,t),i.prototype.notifyComplete=function(t){var e=this.destination;e.next(t),e.complete()},i.prototype._next=function(t){var e=this.predicate,i=this.thisArg,n=this.index++;try{e.call(i||this,t,n,this.source)&&this.notifyComplete(this.yieldIndex?n:t)}catch(t){this.destination.error(t)}},i.prototype._complete=function(){this.notifyComplete(this.yieldIndex?-1:void 0)},i}(ft);yt.prototype.find=function(t,e){if("function"!=typeof t)throw new TypeError("predicate is not a function");return this.lift(new Zi(t,this,!1,e))},yt.prototype.findIndex=function(t,e){return this.lift(new Zi(t,this,!0,e))};var en=function(t){function i(){var e=t.call(this,"no elements in sequence");this.name=e.name="EmptyError",this.stack=e.stack,this.message=e.message}return e(i,t),i}(Error),nn=function(){function t(t,e,i,n){this.predicate=t,this.resultSelector=e,this.defaultValue=i,this.source=n}return t.prototype.call=function(t,e){return e.subscribe(new rn(t,this.predicate,this.resultSelector,this.defaultValue,this.source))},t}(),rn=function(t){function i(e,i,n,r,o){t.call(this,e),this.predicate=i,this.resultSelector=n,this.defaultValue=r,this.source=o,this.index=0,this.hasCompleted=!1,this._emitted=!1}return e(i,t),i.prototype._next=function(t){var e=this.index++;this.predicate?this._tryPredicate(t,e):this._emit(t,e)},i.prototype._tryPredicate=function(t,e){var i;try{i=this.predicate(t,e,this.source)}catch(t){return void this.destination.error(t)}i&&this._emit(t,e)},i.prototype._emit=function(t,e){this.resultSelector?this._tryResultSelector(t,e):this._emitFinal(t)},i.prototype._tryResultSelector=function(t,e){var i;try{i=this.resultSelector(t,e)}catch(t){return void this.destination.error(t)}this._emitFinal(i)},i.prototype._emitFinal=function(t){var e=this.destination;this._emitted||(this._emitted=!0,e.next(t),e.complete(),this.hasCompleted=!0)},i.prototype._complete=function(){var t=this.destination;this.hasCompleted||void 0===this.defaultValue?this.hasCompleted||t.error(new en):(t.next(this.defaultValue),t.complete())},i}(ft);yt.prototype.first=function(t,e,i){return this.lift(new nn(t,e,i,this))};var on=function(){function t(){this.size=0,this._values=[],this._keys=[]}return t.prototype.get=function(t){var e=this._keys.indexOf(t);return-1===e?void 0:this._values[e]},t.prototype.set=function(t,e){var i=this._keys.indexOf(t);return-1===i?(this._keys.push(t),this._values.push(e),this.size++):this._values[i]=e,this},t.prototype.delete=function(t){var e=this._keys.indexOf(t);return-1!==e&&(this._values.splice(e,1),this._keys.splice(e,1),this.size--,!0)},t.prototype.clear=function(){this._keys.length=0,this._values.length=0,this.size=0},t.prototype.forEach=function(t,e){for(var i=0;i<this.size;i++)t.call(e,this._values[i],this._keys[i])},t}(),sn=rt.Map||on,un=function(){function t(){this.values={}}return t.prototype.delete=function(t){return this.values[t]=null,!0},t.prototype.set=function(t,e){return this.values[t]=e,this},t.prototype.get=function(t){return this.values[t]},t.prototype.forEach=function(t,e){var i=this.values;for(var n in i)i.hasOwnProperty(n)&&null!==i[n]&&t.call(e,i[n],n)},t.prototype.clear=function(){this.values={}},t}(),cn=function(){function t(t,e,i,n){this.keySelector=t,this.elementSelector=e,this.durationSelector=i,this.subjectSelector=n}return t.prototype.call=function(t,e){return e.subscribe(new hn(t,this.keySelector,this.elementSelector,this.durationSelector,this.subjectSelector))},t}(),hn=function(t){function i(e,i,n,r,o){t.call(this,e),this.keySelector=i,this.elementSelector=n,this.durationSelector=r,this.subjectSelector=o,this.groups=null,this.attemptedToUnsubscribe=!1,this.count=0}return e(i,t),i.prototype._next=function(t){var e;try{e=this.keySelector(t)}catch(t){return void this.error(t)}this._group(t,e)},i.prototype._group=function(t,e){var i=this.groups;i||(i=this.groups="string"==typeof e?new un:new sn);var n,r=i.get(e);if(this.elementSelector)try{n=this.elementSelector(t)}catch(t){this.error(t)}else n=t;if(!r){r=this.subjectSelector?this.subjectSelector():new xt,i.set(e,r);var o=new ln(e,r,this);if(this.destination.next(o),this.durationSelector){var s=void 0;try{s=this.durationSelector(new ln(e,r))}catch(t){return void this.error(t)}this.add(s.subscribe(new an(e,r,this)))}}r.closed||r.next(n)},i.prototype._error=function(t){var e=this.groups;e&&(e.forEach(function(e,i){e.error(t)}),e.clear()),this.destination.error(t)},i.prototype._complete=function(){var t=this.groups;t&&(t.forEach(function(t,e){t.complete()}),t.clear()),this.destination.complete()},i.prototype.removeGroup=function(t){this.groups.delete(t)},i.prototype.unsubscribe=function(){this.closed||(this.attemptedToUnsubscribe=!0,0===this.count&&t.prototype.unsubscribe.call(this))},i}(ft),an=function(t){function i(e,i,n){t.call(this,i),this.key=e,this.group=i,this.parent=n}return e(i,t),i.prototype._next=function(t){this.complete()},i.prototype._unsubscribe=function(){var t=this.parent,e=this.key;this.key=this.parent=null,t&&t.removeGroup(e)},i}(ft),ln=function(t){function i(e,i,n){t.call(this),this.key=e,this.groupSubject=i,this.refCountSubscription=n}return e(i,t),i.prototype._subscribe=function(t){var e=new ht,i=this.refCountSubscription,n=this.groupSubject;return i&&!i.closed&&e.add(new pn(i)),e.add(n.subscribe(t)),e},i}(yt),pn=function(t){function i(e){t.call(this),this.parent=e,e.count++}return e(i,t),i.prototype.unsubscribe=function(){var e=this.parent;e.closed||this.closed||(t.prototype.unsubscribe.call(this),e.count-=1,0===e.count&&e.attemptedToUnsubscribe&&e.unsubscribe())},i}(ht);yt.prototype.groupBy=function(t,e,i,n){return this.lift(new cn(t,e,i,n))};var fn=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new dn(t))},t}(),dn=function(t){function i(){t.apply(this,arguments)}return e(i,t),i.prototype._next=function(t){},i}(ft);yt.prototype.ignoreElements=function(){return this.lift(new fn)};var bn=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new yn(t))},t}(),yn=function(t){function i(e){t.call(this,e)}return e(i,t),i.prototype.notifyComplete=function(t){var e=this.destination;e.next(t),e.complete()},i.prototype._next=function(t){this.notifyComplete(!1)},i.prototype._complete=function(){this.notifyComplete(!0)},i}(ft);yt.prototype.isEmpty=function(){return this.lift(new bn)};var vn=function(){function t(t){this.durationSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new mn(t,this.durationSelector))},t}(),mn=function(t){function i(e,i){t.call(this,e),this.durationSelector=i,this.hasValue=!1}return e(i,t),i.prototype._next=function(t){if(this.value=t,this.hasValue=!0,!this.throttled){var e=o(this.durationSelector)(t);if(e===ut)this.destination.error(ut.e);else{var i=d(this,e);i.closed?this.clearThrottle():this.add(this.throttled=i)}}},i.prototype.clearThrottle=function(){var t=this.value,e=this.hasValue,i=this.throttled;i&&(this.remove(i),this.throttled=null,i.unsubscribe()),e&&(this.value=null,this.hasValue=!1,this.destination.next(t))},i.prototype.notifyNext=function(t,e,i,n){this.clearThrottle()},i.prototype.notifyComplete=function(){this.clearThrottle()},i}(Ct);yt.prototype.audit=function(t){return this.lift(new vn(t))};var wn=function(){function t(t,e){this.duration=t,this.scheduler=e}return t.prototype.call=function(t,e){return e.subscribe(new xn(t,this.duration,this.scheduler))},t}(),xn=function(t){function i(e,i,n){t.call(this,e),this.duration=i,this.scheduler=n,this.hasValue=!1}return e(i,t),i.prototype._next=function(t){this.value=t,this.hasValue=!0,this.throttled||this.add(this.throttled=this.scheduler.schedule(U,this.duration,this))},i.prototype.clearThrottle=function(){var t=this.value,e=this.hasValue,i=this.throttled;i&&(this.remove(i),this.throttled=null,i.unsubscribe()),e&&(this.value=null,this.hasValue=!1,this.destination.next(t))},i}(ft);yt.prototype.auditTime=function(t,e){return void 0===e&&(e=de),this.lift(new wn(t,e))};var _n=function(){function t(t,e,i,n){this.predicate=t,this.resultSelector=e,this.defaultValue=i,this.source=n}return t.prototype.call=function(t,e){return e.subscribe(new gn(t,this.predicate,this.resultSelector,this.defaultValue,this.source))},t}(),gn=function(t){function i(e,i,n,r,o){t.call(this,e),this.predicate=i,this.resultSelector=n,this.defaultValue=r,this.source=o,this.hasValue=!1,this.index=0,void 0!==r&&(this.lastValue=r,this.hasValue=!0)}return e(i,t),i.prototype._next=function(t){var e=this.index++;if(this.predicate)this._tryPredicate(t,e);else{if(this.resultSelector)return void this._tryResultSelector(t,e);this.lastValue=t,this.hasValue=!0}},i.prototype._tryPredicate=function(t,e){var i;try{i=this.predicate(t,e,this.source)}catch(t){return void this.destination.error(t)}if(i){if(this.resultSelector)return void this._tryResultSelector(t,e);this.lastValue=t,this.hasValue=!0}},i.prototype._tryResultSelector=function(t,e){var i;try{i=this.resultSelector(t,e)}catch(t){return void this.destination.error(t)}this.lastValue=i,this.hasValue=!0},i.prototype._complete=function(){var t=this.destination;this.hasValue?(t.next(this.lastValue),t.complete()):t.error(new en)},i}(ft);yt.prototype.last=function(t,e,i){return this.lift(new _n(t,e,i,this))},yt.prototype.let=D,yt.prototype.letBind=D;var Sn=function(){function t(t,e,i){this.predicate=t,this.thisArg=e,this.source=i}return t.prototype.call=function(t,e){return e.subscribe(new Tn(t,this.predicate,this.thisArg,this.source))},t}(),Tn=function(t){function i(e,i,n,r){t.call(this,e),this.predicate=i,this.thisArg=n,this.source=r,this.index=0,this.thisArg=n||this}return e(i,t),i.prototype.notifyComplete=function(t){this.destination.next(t),this.destination.complete()},i.prototype._next=function(t){var e=!1;try{e=this.predicate.call(this.thisArg,t,this.index++,this.source)}catch(t){return void this.destination.error(t)}e||this.notifyComplete(!1)},i.prototype._complete=function(){this.notifyComplete(!0)},i}(ft);yt.prototype.every=function(t,e){return this.lift(new Sn(t,e,this))},yt.prototype.map=I;var In=function(){function t(t){this.value=t}return t.prototype.call=function(t,e){return e.subscribe(new Nn(t,this.value))},t}(),Nn=function(t){function i(e,i){t.call(this,e),this.value=i}return e(i,t),i.prototype._next=function(t){this.destination.next(this.value)},i}(ft);yt.prototype.mapTo=function(t){return this.lift(new In(t))};var En=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new Cn(t))},t}(),Cn=function(t){function i(e){t.call(this,e)}return e(i,t),i.prototype._next=function(t){this.destination.next($t.createNext(t))},i.prototype._error=function(t){var e=this.destination;e.next($t.createError(t)),e.complete()},i.prototype._complete=function(){var t=this.destination;t.next($t.createComplete()),t.complete()},i}(ft);yt.prototype.materialize=function(){return this.lift(new En)};var Vn=function(){function t(t,e,i){void 0===i&&(i=!1),this.accumulator=t,this.seed=e,this.hasSeed=i}return t.prototype.call=function(t,e){return e.subscribe(new kn(t,this.accumulator,this.seed,this.hasSeed))},t}(),kn=function(t){function i(e,i,n,r){t.call(this,e),this.accumulator=i,this.hasSeed=r,this.index=0,this.hasValue=!1,this.acc=n,this.hasSeed||this.index++}return e(i,t),i.prototype._next=function(t){this.hasValue||(this.hasValue=this.hasSeed)?this._tryReduce(t):(this.acc=t,this.hasValue=!0)},i.prototype._tryReduce=function(t){var e;try{e=this.accumulator(this.acc,t,this.index++)}catch(t){return void this.destination.error(t)}this.acc=e},i.prototype._complete=function(){(this.hasValue||this.hasSeed)&&this.destination.next(this.acc),this.destination.complete()},i}(ft);yt.prototype.max=function(t){var e="function"==typeof t?function(e,i){return t(e,i)>0?e:i}:function(t,e){return t>e?t:e};return this.lift(new Vn(e))},yt.prototype.merge=function(){for(var t=[],e=0;e<arguments.length;e++)t[e-0]=arguments[e];return this.lift.call(x.apply(void 0,[this].concat(t)))},yt.prototype.mergeAll=function(t){return void 0===t&&(t=Number.POSITIVE_INFINITY),this.lift(new Pt(t))},yt.prototype.mergeMap=R,yt.prototype.flatMap=R,yt.prototype.flatMapTo=M,yt.prototype.mergeMapTo=M;var jn=function(){function t(t,e,i){this.accumulator=t,this.seed=e,this.concurrent=i}return t.prototype.call=function(t,e){return e.subscribe(new On(t,this.accumulator,this.seed,this.concurrent))},t}(),On=function(t){function i(e,i,n,r){t.call(this,e),this.accumulator=i,this.acc=n,this.concurrent=r,this.hasValue=!1,this.hasCompleted=!1,this.buffer=[],this.active=0,this.index=0}return e(i,t),i.prototype._next=function(t){if(this.active<this.concurrent){var e=this.index++,i=o(this.accumulator)(this.acc,t),n=this.destination;i===ut?n.error(ut.e):(this.active++,this._innerSub(i,t,e))}else this.buffer.push(t)},i.prototype._innerSub=function(t,e,i){this.add(d(this,t,e,i))},i.prototype._complete=function(){this.hasCompleted=!0,0===this.active&&0===this.buffer.length&&(!1===this.hasValue&&this.destination.next(this.acc),this.destination.complete())},i.prototype.notifyNext=function(t,e,i,n,r){var o=this.destination;this.acc=e,this.hasValue=!0,o.next(e)},i.prototype.notifyComplete=function(t){var e=this.buffer;this.remove(t),this.active--,e.length>0?this._next(e.shift()):0===this.active&&this.hasCompleted&&(!1===this.hasValue&&this.destination.next(this.acc),this.destination.complete())},i}(Ct);yt.prototype.mergeScan=function(t,e,i){return void 0===i&&(i=Number.POSITIVE_INFINITY),this.lift(new jn(t,e,i))},yt.prototype.min=function(t){var e="function"==typeof t?function(e,i){return t(e,i)<0?e:i}:function(t,e){return t<e?t:e};return this.lift(new Vn(e))};var An=function(t){function i(e,i){t.call(this),this.source=e,this.subjectFactory=i,this._refCount=0,this._isComplete=!1}return e(i,t),i.prototype._subscribe=function(t){return this.getSubject().subscribe(t)},i.prototype.getSubject=function(){var t=this._subject;return t&&!t.isStopped||(this._subject=this.subjectFactory()),this._subject},i.prototype.connect=function(){var t=this._connection;return t||(this._isComplete=!1,(t=this._connection=new ht).add(this.source.subscribe(new Rn(this.getSubject(),this))),t.closed?(this._connection=null,t=ht.EMPTY):this._connection=t),t},i.prototype.refCount=function(){return this.lift(new Mn(this))},i}(yt),Fn=An.prototype,Pn={operator:{value:null},_refCount:{value:0,writable:!0},_subject:{value:null,writable:!0},_connection:{value:null,writable:!0},_subscribe:{value:Fn._subscribe},_isComplete:{value:Fn._isComplete,writable:!0},getSubject:{value:Fn.getSubject},connect:{value:Fn.connect},refCount:{value:Fn.refCount}},Rn=function(t){function i(e,i){t.call(this,e),this.connectable=i}return e(i,t),i.prototype._error=function(e){this._unsubscribe(),t.prototype._error.call(this,e)},i.prototype._complete=function(){this.connectable._isComplete=!0,this._unsubscribe(),t.prototype._complete.call(this)},i.prototype._unsubscribe=function(){var t=this.connectable;if(t){this.connectable=null;var e=t._connection;t._refCount=0,t._subject=null,t._connection=null,e&&e.unsubscribe()}},i}(wt),Mn=function(){function t(t){this.connectable=t}return t.prototype.call=function(t,e){var i=this.connectable;i._refCount++;var n=new qn(t,i),r=e.subscribe(n);return n.closed||(n.connection=i.connect()),r},t}(),qn=function(t){function i(e,i){t.call(this,e),this.connectable=i}return e(i,t),i.prototype._unsubscribe=function(){var t=this.connectable;if(t){this.connectable=null;var e=t._refCount;if(e<=0)this.connection=null;else if(t._refCount=e-1,e>1)this.connection=null;else{var i=this.connection,n=t._connection;this.connection=null,!n||i&&n!==i||n.unsubscribe()}}else this.connection=null},i}(ft),Bn=function(){function t(t,e){this.subjectFactory=t,this.selector=e}return t.prototype.call=function(t,e){var i=this.selector,n=this.subjectFactory(),r=i(n).subscribe(t);return r.add(e.subscribe(n)),r},t}();yt.prototype.multicast=L,yt.prototype.observeOn=function(t,e){return void 0===e&&(e=0),this.lift(new Qt(t,e))},yt.prototype.onErrorResumeNext=function(){for(var t=[],e=0;e<arguments.length;e++)t[e-0]=arguments[e];return 1===t.length&&st(t[0])&&(t=t[0]),this.lift(new ge(t))};var Wn=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new zn(t))},t}(),zn=function(t){function i(e){t.call(this,e),this.hasPrev=!1}return e(i,t),i.prototype._next=function(t){this.hasPrev?this.destination.next([this.prev,t]):this.hasPrev=!0,this.prev=t},i}(ft);yt.prototype.pairwise=function(){return this.lift(new Wn)},yt.prototype.partition=function(t,e){return[z.call(this,t,e),z.call(this,function(t,e){function i(){return!i.pred.apply(i.thisArg,arguments)}return i.pred=t,i.thisArg=e,i}(t,e))]},yt.prototype.pluck=function(){for(var t=[],e=0;e<arguments.length;e++)t[e-0]=arguments[e];var i=t.length;if(0===i)throw new Error("list of properties cannot be empty.");return I.call(this,function(t,e){return function(i){for(var n=i,r=0;r<e;r++){var o=n[t[r]];if(void 0===o)return;n=o}return n}}(t,i))},yt.prototype.publish=function(t){return t?L.call(this,function(){return new xt},t):L.call(this,new xt)};var Yn=function(t){function i(e){t.call(this),this._value=e}return e(i,t),Object.defineProperty(i.prototype,"value",{get:function(){return this.getValue()},enumerable:!0,configurable:!0}),i.prototype._subscribe=function(e){var i=t.prototype._subscribe.call(this,e);return i&&!i.closed&&e.next(this._value),i},i.prototype.getValue=function(){if(this.hasError)throw this.thrownError;if(this.closed)throw new vt;return this._value},i.prototype.next=function(e){t.prototype.next.call(this,this._value=e)},i}(xt);yt.prototype.publishBehavior=function(t){return L.call(this,new Yn(t))},yt.prototype.publishReplay=function(t,e,i){return void 0===t&&(t=Number.POSITIVE_INFINITY),void 0===e&&(e=Number.POSITIVE_INFINITY),L.call(this,new Ge(t,e,i))},yt.prototype.publishLast=function(){return L.call(this,new gt)},yt.prototype.race=function(){for(var t=[],e=0;e<arguments.length;e++)t[e-0]=arguments[e];return 1===t.length&&st(t[0])&&(t=t[0]),this.lift.call(_.apply(void 0,[this].concat(t)))},yt.prototype.reduce=function(t,e){var i=!1;return arguments.length>=2&&(i=!0),this.lift(new Vn(t,e,i))};var Un=function(){function t(t,e){this.count=t,this.source=e}return t.prototype.call=function(t,e){return e.subscribe(new Dn(t,this.count,this.source))},t}(),Dn=function(t){function i(e,i,n){t.call(this,e),this.count=i,this.source=n}return e(i,t),i.prototype.complete=function(){if(!this.isStopped){var e=this.source,i=this.count;if(0===i)return t.prototype.complete.call(this);i>-1&&(this.count=i-1),e.subscribe(this._unsubscribeAndRecycle())}},i}(ft);yt.prototype.repeat=function(t){return void 0===t&&(t=-1),0===t?new Nt:t<0?this.lift(new Un(-1,this)):this.lift(new Un(t-1,this))};var Ln=function(){function t(t){this.notifier=t}return t.prototype.call=function(t,e){return e.subscribe(new Hn(t,this.notifier,e))},t}(),Hn=function(t){function i(e,i,n){t.call(this,e),this.notifier=i,this.source=n,this.sourceIsBeingSubscribedTo=!0}return e(i,t),i.prototype.notifyNext=function(t,e,i,n,r){this.sourceIsBeingSubscribedTo=!0,this.source.subscribe(this)},i.prototype.notifyComplete=function(e){if(!1===this.sourceIsBeingSubscribedTo)return t.prototype.complete.call(this)},i.prototype.complete=function(){if(this.sourceIsBeingSubscribedTo=!1,!this.isStopped){if(this.retries){if(this.retriesSubscription.closed)return t.prototype.complete.call(this)}else this.subscribeToRetries();this._unsubscribeAndRecycle(),this.notifications.next()}},i.prototype._unsubscribe=function(){var t=this.notifications,e=this.retriesSubscription;t&&(t.unsubscribe(),this.notifications=null),e&&(e.unsubscribe(),this.retriesSubscription=null),this.retries=null},i.prototype._unsubscribeAndRecycle=function(){var e=this.notifications,i=this.retries,n=this.retriesSubscription;return this.notifications=null,this.retries=null,this.retriesSubscription=null,t.prototype._unsubscribeAndRecycle.call(this),this.notifications=e,this.retries=i,this.retriesSubscription=n,this},i.prototype.subscribeToRetries=function(){this.notifications=new xt;var e=o(this.notifier)(this.notifications);if(e===ut)return t.prototype.complete.call(this);this.retries=e,this.retriesSubscription=d(this,e)},i}(Ct);yt.prototype.repeatWhen=function(t){return this.lift(new Ln(t))};var Xn=function(){function t(t,e){this.count=t,this.source=e}return t.prototype.call=function(t,e){return e.subscribe(new Gn(t,this.count,this.source))},t}(),Gn=function(t){function i(e,i,n){t.call(this,e),this.count=i,this.source=n}return e(i,t),i.prototype.error=function(e){if(!this.isStopped){var i=this.source,n=this.count;if(0===n)return t.prototype.error.call(this,e);n>-1&&(this.count=n-1),i.subscribe(this._unsubscribeAndRecycle())}},i}(ft);yt.prototype.retry=function(t){return void 0===t&&(t=-1),this.lift(new Xn(t,this))};var Jn=function(){function t(t,e){this.notifier=t,this.source=e}return t.prototype.call=function(t,e){return e.subscribe(new Kn(t,this.notifier,this.source))},t}(),Kn=function(t){function i(e,i,n){t.call(this,e),this.notifier=i,this.source=n}return e(i,t),i.prototype.error=function(e){if(!this.isStopped){var i=this.errors,n=this.retries,r=this.retriesSubscription;if(n)this.errors=null,this.retriesSubscription=null;else{if(i=new xt,(n=o(this.notifier)(i))===ut)return t.prototype.error.call(this,ut.e);r=d(this,n)}this._unsubscribeAndRecycle(),this.errors=i,this.retries=n,this.retriesSubscription=r,i.next(e)}},i.prototype._unsubscribe=function(){var t=this.errors,e=this.retriesSubscription;t&&(t.unsubscribe(),this.errors=null),e&&(e.unsubscribe(),this.retriesSubscription=null),this.retries=null},i.prototype.notifyNext=function(t,e,i,n,r){var o=this.errors,s=this.retries,u=this.retriesSubscription;this.errors=null,this.retries=null,this.retriesSubscription=null,this._unsubscribeAndRecycle(),this.errors=o,this.retries=s,this.retriesSubscription=u,this.source.subscribe(this)},i}(Ct);yt.prototype.retryWhen=function(t){return this.lift(new Jn(t,this))};var $n=function(){function t(t){this.notifier=t}return t.prototype.call=function(t,e){var i=new Qn(t),n=e.subscribe(i);return n.add(d(i,this.notifier)),n},t}(),Qn=function(t){function i(){t.apply(this,arguments),this.hasValue=!1}return e(i,t),i.prototype._next=function(t){this.value=t,this.hasValue=!0},i.prototype.notifyNext=function(t,e,i,n,r){this.emitValue()},i.prototype.notifyComplete=function(){this.emitValue()},i.prototype.emitValue=function(){this.hasValue&&(this.hasValue=!1,this.destination.next(this.value))},i}(Ct);yt.prototype.sample=function(t){return this.lift(new $n(t))};var Zn=function(){function t(t,e){this.period=t,this.scheduler=e}return t.prototype.call=function(t,e){return e.subscribe(new tr(t,this.period,this.scheduler))},t}(),tr=function(t){function i(e,i,n){t.call(this,e),this.period=i,this.scheduler=n,this.hasValue=!1,this.add(n.schedule(H,i,{subscriber:this,period:i}))}return e(i,t),i.prototype._next=function(t){this.lastValue=t,this.hasValue=!0},i.prototype.notifyNext=function(){this.hasValue&&(this.hasValue=!1,this.destination.next(this.lastValue))},i}(ft);yt.prototype.sampleTime=function(t,e){return void 0===e&&(e=de),this.lift(new Zn(t,e))};var er=function(){function t(t,e,i){void 0===i&&(i=!1),this.accumulator=t,this.seed=e,this.hasSeed=i}return t.prototype.call=function(t,e){return e.subscribe(new ir(t,this.accumulator,this.seed,this.hasSeed))},t}(),ir=function(t){function i(e,i,n,r){t.call(this,e),this.accumulator=i,this._seed=n,this.hasSeed=r,this.index=0}return e(i,t),Object.defineProperty(i.prototype,"seed",{get:function(){return this._seed},set:function(t){this.hasSeed=!0,this._seed=t},enumerable:!0,configurable:!0}),i.prototype._next=function(t){if(this.hasSeed)return this._tryNext(t);this.seed=t,this.destination.next(t)},i.prototype._tryNext=function(t){var e,i=this.index++;try{e=this.accumulator(this.seed,t,i)}catch(t){this.destination.error(t)}this.seed=e,this.destination.next(e)},i}(ft);yt.prototype.scan=function(t,e){var i=!1;return arguments.length>=2&&(i=!0),this.lift(new er(t,e,i))};var nr=function(){function t(t,e){this.compareTo=t,this.comparor=e}return t.prototype.call=function(t,e){return e.subscribe(new rr(t,this.compareTo,this.comparor))},t}(),rr=function(t){function i(e,i,n){t.call(this,e),this.compareTo=i,this.comparor=n,this._a=[],this._b=[],this._oneComplete=!1,this.add(i.subscribe(new or(e,this)))}return e(i,t),i.prototype._next=function(t){this._oneComplete&&0===this._b.length?this.emit(!1):(this._a.push(t),this.checkValues())},i.prototype._complete=function(){this._oneComplete?this.emit(0===this._a.length&&0===this._b.length):this._oneComplete=!0},i.prototype.checkValues=function(){for(var t=this._a,e=this._b,i=this.comparor;t.length>0&&e.length>0;){var n=t.shift(),r=e.shift(),s=!1;i?(s=o(i)(n,r))===ut&&this.destination.error(ut.e):s=n===r,s||this.emit(!1)}},i.prototype.emit=function(t){var e=this.destination;e.next(t),e.complete()},i.prototype.nextB=function(t){this._oneComplete&&0===this._a.length?this.emit(!1):(this._b.push(t),this.checkValues())},i}(ft),or=function(t){function i(e,i){t.call(this,e),this.parent=i}return e(i,t),i.prototype._next=function(t){this.parent.nextB(t)},i.prototype._error=function(t){this.parent.error(t)},i.prototype._complete=function(){this.parent._complete()},i}(ft);yt.prototype.sequenceEqual=function(t,e){return this.lift(new nr(t,e))},yt.prototype.share=function(){return L.call(this,X).refCount()},yt.prototype.shareReplay=function(t,e,i){var n;return L.call(this,function(){return this._isComplete?n:n=new Ge(t,e,i)}).refCount()};var sr=function(){function t(t,e){this.predicate=t,this.source=e}return t.prototype.call=function(t,e){return e.subscribe(new ur(t,this.predicate,this.source))},t}(),ur=function(t){function i(e,i,n){t.call(this,e),this.predicate=i,this.source=n,this.seenValue=!1,this.index=0}return e(i,t),i.prototype.applySingleValue=function(t){this.seenValue?this.destination.error("Sequence contains more than one element"):(this.seenValue=!0,this.singleValue=t)},i.prototype._next=function(t){var e=this.index++;this.predicate?this.tryNext(t,e):this.applySingleValue(t)},i.prototype.tryNext=function(t,e){try{this.predicate(t,e,this.source)&&this.applySingleValue(t)}catch(t){this.destination.error(t)}},i.prototype._complete=function(){var t=this.destination;this.index>0?(t.next(this.seenValue?this.singleValue:void 0),t.complete()):t.error(new en)},i}(ft);yt.prototype.single=function(t){return this.lift(new sr(t,this))};var cr=function(){function t(t){this.total=t}return t.prototype.call=function(t,e){return e.subscribe(new hr(t,this.total))},t}(),hr=function(t){function i(e,i){t.call(this,e),this.total=i,this.count=0}return e(i,t),i.prototype._next=function(t){++this.count>this.total&&this.destination.next(t)},i}(ft);yt.prototype.skip=function(t){return this.lift(new cr(t))};var ar=function(){function t(t){if(this._skipCount=t,this._skipCount<0)throw new Hi}return t.prototype.call=function(t,e){return 0===this._skipCount?e.subscribe(new ft(t)):e.subscribe(new lr(t,this._skipCount))},t}(),lr=function(t){function i(e,i){t.call(this,e),this._skipCount=i,this._count=0,this._ring=new Array(i)}return e(i,t),i.prototype._next=function(t){var e=this._skipCount,i=this._count++;if(i<e)this._ring[i]=t;else{var n=i%e,r=this._ring,o=r[n];r[n]=t,this.destination.next(o)}},i}(ft);yt.prototype.skipLast=function(t){return this.lift(new ar(t))};var pr=function(){function t(t){this.notifier=t}return t.prototype.call=function(t,e){return e.subscribe(new fr(t,this.notifier))},t}(),fr=function(t){function i(e,i){t.call(this,e),this.hasValue=!1,this.isInnerStopped=!1,this.add(d(this,i))}return e(i,t),i.prototype._next=function(e){this.hasValue&&t.prototype._next.call(this,e)},i.prototype._complete=function(){this.isInnerStopped?t.prototype._complete.call(this):this.unsubscribe()},i.prototype.notifyNext=function(t,e,i,n,r){this.hasValue=!0},i.prototype.notifyComplete=function(){this.isInnerStopped=!0,this.isStopped&&t.prototype._complete.call(this)},i}(Ct);yt.prototype.skipUntil=function(t){return this.lift(new pr(t))};var dr=function(){function t(t){this.predicate=t}return t.prototype.call=function(t,e){return e.subscribe(new br(t,this.predicate))},t}(),br=function(t){function i(e,i){t.call(this,e),this.predicate=i,this.skipping=!0,this.index=0}return e(i,t),i.prototype._next=function(t){var e=this.destination;this.skipping&&this.tryCallPredicate(t),this.skipping||e.next(t)},i.prototype.tryCallPredicate=function(t){try{var e=this.predicate(t,this.index++);this.skipping=Boolean(e)}catch(t){this.destination.error(t)}},i}(ft);yt.prototype.skipWhile=function(t){return this.lift(new dr(t))},yt.prototype.startWith=function(){for(var t=[],e=0;e<arguments.length;e++)t[e-0]=arguments[e];var i=t[t.length-1];p(i)?t.pop():i=null;var n=t.length;return b(1===n?new It(t[0],i):n>1?new Et(t,i):new Nt(i),this)};var yr=new(function(){function t(t){if(this.root=t,t.setImmediate&&"function"==typeof t.setImmediate)this.setImmediate=t.setImmediate.bind(t),this.clearImmediate=t.clearImmediate.bind(t);else{this.nextHandle=1,this.tasksByHandle={},this.currentlyRunningATask=!1,this.canUseProcessNextTick()?this.setImmediate=this.createProcessNextTickSetImmediate():this.canUsePostMessage()?this.setImmediate=this.createPostMessageSetImmediate():this.canUseMessageChannel()?this.setImmediate=this.createMessageChannelSetImmediate():this.canUseReadyStateChange()?this.setImmediate=this.createReadyStateChangeSetImmediate():this.setImmediate=this.createSetTimeoutSetImmediate();var e=function t(e){delete t.instance.tasksByHandle[e]};e.instance=this,this.clearImmediate=e}}return t.prototype.identify=function(t){return Object.prototype.toString.call(t)},t.prototype.canUseProcessNextTick=function(){return"[object process]"===this.identify(this.root.process)},t.prototype.canUseMessageChannel=function(){return Boolean(this.root.MessageChannel)},t.prototype.canUseReadyStateChange=function(){var t=this.root.document;return Boolean(t&&"onreadystatechange"in t.createElement("script"))},t.prototype.canUsePostMessage=function(){var t=this.root;if(t.postMessage&&!t.importScripts){var e=!0,i=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=i,e}return!1},t.prototype.partiallyApplied=function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];var n=function t(){var e=t.handler,i=t.args;"function"==typeof e?e.apply(void 0,i):new Function(""+e)()};return n.handler=t,n.args=e,n},t.prototype.addFromSetImmediateArguments=function(t){return this.tasksByHandle[this.nextHandle]=this.partiallyApplied.apply(void 0,t),this.nextHandle++},t.prototype.createProcessNextTickSetImmediate=function(){var t=function t(){var e=t.instance,i=e.addFromSetImmediateArguments(arguments);return e.root.process.nextTick(e.partiallyApplied(e.runIfPresent,i)),i};return t.instance=this,t},t.prototype.createPostMessageSetImmediate=function(){var t=this.root,e="setImmediate$"+t.Math.random()+"$",i=function i(n){var r=i.instance;n.source===t&&"string"==typeof n.data&&0===n.data.indexOf(e)&&r.runIfPresent(+n.data.slice(e.length))};i.instance=this,t.addEventListener("message",i,!1);var n=function t(){var e=t.messagePrefix,i=t.instance,n=i.addFromSetImmediateArguments(arguments);return i.root.postMessage(e+n,"*"),n};return n.instance=this,n.messagePrefix=e,n},t.prototype.runIfPresent=function(t){if(this.currentlyRunningATask)setTimeout(this.partiallyApplied(this.runIfPresent,t),0);else{var e=this.tasksByHandle[t];if(e){this.currentlyRunningATask=!0;try{e()}finally{this.clearImmediate(t),this.currentlyRunningATask=!1}}}},t.prototype.createMessageChannelSetImmediate=function(){var t=this,e=new this.root.MessageChannel;e.port1.onmessage=function(e){var i=e.data;t.runIfPresent(i)};var i=function t(){var e=t.channel,i=t.instance.addFromSetImmediateArguments(arguments);return e.port2.postMessage(i),i};return i.channel=e,i.instance=this,i},t.prototype.createReadyStateChangeSetImmediate=function(){var t=function t(){var e=t.instance,i=e.root.document,n=i.documentElement,r=e.addFromSetImmediateArguments(arguments),o=i.createElement("script");return o.onreadystatechange=function(){e.runIfPresent(r),o.onreadystatechange=null,n.removeChild(o),o=null},n.appendChild(o),r};return t.instance=this,t},t.prototype.createSetTimeoutSetImmediate=function(){var t=function t(){var e=t.instance,i=e.addFromSetImmediateArguments(arguments);return e.root.setTimeout(e.partiallyApplied(e.runIfPresent,i),0),i};return t.instance=this,t},t}())(rt),vr=function(t){function i(e,i){t.call(this,e,i),this.scheduler=e,this.work=i}return e(i,t),i.prototype.requestAsyncId=function(e,i,n){return void 0===n&&(n=0),null!==n&&n>0?t.prototype.requestAsyncId.call(this,e,i,n):(e.actions.push(this),e.scheduled||(e.scheduled=yr.setImmediate(e.flush.bind(e,null))))},i.prototype.recycleAsyncId=function(e,i,n){if(void 0===n&&(n=0),null!==n&&n>0||null===n&&this.delay>0)return t.prototype.recycleAsyncId.call(this,e,i,n);0===e.actions.length&&(yr.clearImmediate(i),e.scheduled=void 0)},i}(pe),mr=new(function(t){function i(){t.apply(this,arguments)}return e(i,t),i.prototype.flush=function(t){this.active=!0,this.scheduled=void 0;var e,i=this.actions,n=-1,r=i.length;t=t||i.shift();do{if(e=t.execute(t.state,t.delay))break}while(++n<r&&(t=i.shift()));if(this.active=!1,e){for(;++n<r&&(t=i.shift());)t.unsubscribe();throw e}},i}(fe))(vr),wr=function(t){function i(e,i,n){void 0===i&&(i=0),void 0===n&&(n=mr),t.call(this),this.source=e,this.delayTime=i,this.scheduler=n,(!w(i)||i<0)&&(this.delayTime=0),n&&"function"==typeof n.schedule||(this.scheduler=mr)}return e(i,t),i.create=function(t,e,n){return void 0===e&&(e=0),void 0===n&&(n=mr),new i(t,e,n)},i.dispatch=function(t){var e=t.source,i=t.subscriber;return this.add(e.subscribe(i))},i.prototype._subscribe=function(t){var e=this.delayTime,n=this.source;return this.scheduler.schedule(i.dispatch,e,{source:n,subscriber:t})},i}(yt),xr=function(){function t(t,e){this.scheduler=t,this.delay=e}return t.prototype.call=function(t,e){return new wr(e,this.delay,this.scheduler).subscribe(t)},t}();yt.prototype.subscribeOn=function(t,e){return void 0===e&&(e=0),this.lift(new xr(t,e))};var _r=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new gr(t))},t}(),gr=function(t){function i(e){t.call(this,e),this.active=0,this.hasCompleted=!1}return e(i,t),i.prototype._next=function(t){this.unsubscribeInner(),this.active++,this.add(this.innerSubscription=d(this,t))},i.prototype._complete=function(){this.hasCompleted=!0,0===this.active&&this.destination.complete()},i.prototype.unsubscribeInner=function(){this.active=this.active>0?this.active-1:0;var t=this.innerSubscription;t&&(t.unsubscribe(),this.remove(t))},i.prototype.notifyNext=function(t,e,i,n,r){this.destination.next(e)},i.prototype.notifyError=function(t){this.destination.error(t)},i.prototype.notifyComplete=function(){this.unsubscribeInner(),this.hasCompleted&&0===this.active&&this.destination.complete()},i}(Ct);yt.prototype.switch=G,yt.prototype._switch=G;var Sr=function(){function t(t,e){this.project=t,this.resultSelector=e}return t.prototype.call=function(t,e){return e.subscribe(new Tr(t,this.project,this.resultSelector))},t}(),Tr=function(t){function i(e,i,n){t.call(this,e),this.project=i,this.resultSelector=n,this.index=0}return e(i,t),i.prototype._next=function(t){var e,i=this.index++;try{e=this.project(t,i)}catch(t){return void this.destination.error(t)}this._innerSub(e,t,i)},i.prototype._innerSub=function(t,e,i){var n=this.innerSubscription;n&&n.unsubscribe(),this.add(this.innerSubscription=d(this,t,e,i))},i.prototype._complete=function(){var e=this.innerSubscription;e&&!e.closed||t.prototype._complete.call(this)},i.prototype._unsubscribe=function(){this.innerSubscription=null},i.prototype.notifyComplete=function(e){this.remove(e),this.innerSubscription=null,this.isStopped&&t.prototype._complete.call(this)},i.prototype.notifyNext=function(t,e,i,n,r){this.resultSelector?this._tryNotifyNext(t,e,i,n):this.destination.next(e)},i.prototype._tryNotifyNext=function(t,e,i,n){var r;try{r=this.resultSelector(t,e,i,n)}catch(t){return void this.destination.error(t)}this.destination.next(r)},i}(Ct);yt.prototype.switchMap=function(t,e){return this.lift(new Sr(t,e))};var Ir=function(){function t(t,e){this.observable=t,this.resultSelector=e}return t.prototype.call=function(t,e){return e.subscribe(new Nr(t,this.observable,this.resultSelector))},t}(),Nr=function(t){function i(e,i,n){t.call(this,e),this.inner=i,this.resultSelector=n,this.index=0}return e(i,t),i.prototype._next=function(t){var e=this.innerSubscription;e&&e.unsubscribe(),this.add(this.innerSubscription=d(this,this.inner,t,this.index++))},i.prototype._complete=function(){var e=this.innerSubscription;e&&!e.closed||t.prototype._complete.call(this)},i.prototype._unsubscribe=function(){this.innerSubscription=null},i.prototype.notifyComplete=function(e){this.remove(e),this.innerSubscription=null,this.isStopped&&t.prototype._complete.call(this)},i.prototype.notifyNext=function(t,e,i,n,r){var o=this.resultSelector,s=this.destination;o?this.tryResultSelector(t,e,i,n):s.next(e)},i.prototype.tryResultSelector=function(t,e,i,n){var r,o=this.resultSelector,s=this.destination;try{r=o(t,e,i,n)}catch(t){return void s.error(t)}s.next(r)},i}(Ct);yt.prototype.switchMapTo=function(t,e){return this.lift(new Ir(t,e))};var Er=function(){function t(t){if(this.total=t,this.total<0)throw new Hi}return t.prototype.call=function(t,e){return e.subscribe(new Cr(t,this.total))},t}(),Cr=function(t){function i(e,i){t.call(this,e),this.total=i,this.count=0}return e(i,t),i.prototype._next=function(t){var e=this.total,i=++this.count;i<=e&&(this.destination.next(t),i===e&&(this.destination.complete(),this.unsubscribe()))},i}(ft);yt.prototype.take=function(t){return 0===t?new Nt:this.lift(new Er(t))};var Vr=function(){function t(t){if(this.total=t,this.total<0)throw new Hi}return t.prototype.call=function(t,e){return e.subscribe(new kr(t,this.total))},t}(),kr=function(t){function i(e,i){t.call(this,e),this.total=i,this.ring=new Array,this.count=0}return e(i,t),i.prototype._next=function(t){var e=this.ring,i=this.total,n=this.count++;if(e.length<i)e.push(t);else{e[n%i]=t}},i.prototype._complete=function(){var t=this.destination,e=this.count;if(e>0)for(var i=this.count>=this.total?this.total:this.count,n=this.ring,r=0;r<i;r++){var o=e++%i;t.next(n[o])}t.complete()},i}(ft);yt.prototype.takeLast=function(t){return 0===t?new Nt:this.lift(new Vr(t))};var jr=function(){function t(t){this.notifier=t}return t.prototype.call=function(t,e){return e.subscribe(new Or(t,this.notifier))},t}(),Or=function(t){function i(e,i){t.call(this,e),this.notifier=i,this.add(d(this,i))}return e(i,t),i.prototype.notifyNext=function(t,e,i,n,r){this.complete()},i.prototype.notifyComplete=function(){},i}(Ct);yt.prototype.takeUntil=function(t){return this.lift(new jr(t))};var Ar=function(){function t(t){this.predicate=t}return t.prototype.call=function(t,e){return e.subscribe(new Fr(t,this.predicate))},t}(),Fr=function(t){function i(e,i){t.call(this,e),this.predicate=i,this.index=0}return e(i,t),i.prototype._next=function(t){var e,i=this.destination;try{e=this.predicate(t,this.index++)}catch(t){return void i.error(t)}this.nextOrComplete(t,e)},i.prototype.nextOrComplete=function(t,e){var i=this.destination;Boolean(e)?i.next(t):i.complete()},i}(ft);yt.prototype.takeWhile=function(t){return this.lift(new Ar(t))};var Pr={leading:!0,trailing:!1},Rr=function(){function t(t,e,i){this.durationSelector=t,this.leading=e,this.trailing=i}return t.prototype.call=function(t,e){return e.subscribe(new Mr(t,this.durationSelector,this.leading,this.trailing))},t}(),Mr=function(t){function i(e,i,n,r){t.call(this,e),this.destination=e,this.durationSelector=i,this._leading=n,this._trailing=r,this._hasTrailingValue=!1}return e(i,t),i.prototype._next=function(t){if(this.throttled)this._trailing&&(this._hasTrailingValue=!0,this._trailingValue=t);else{var e=this.tryDurationSelector(t);e&&this.add(this.throttled=d(this,e)),this._leading&&(this.destination.next(t),this._trailing&&(this._hasTrailingValue=!0,this._trailingValue=t))}},i.prototype.tryDurationSelector=function(t){try{return this.durationSelector(t)}catch(t){return this.destination.error(t),null}},i.prototype._unsubscribe=function(){var t=this.throttled;this._trailingValue,this._hasTrailingValue,this._trailing;this._trailingValue=null,this._hasTrailingValue=!1,t&&(this.remove(t),this.throttled=null,t.unsubscribe())},i.prototype._sendTrailing=function(){var t=this.destination,e=this.throttled,i=this._trailing,n=this._trailingValue,r=this._hasTrailingValue;e&&i&&r&&(t.next(n),this._trailingValue=null,this._hasTrailingValue=!1)},i.prototype.notifyNext=function(t,e,i,n,r){this._sendTrailing(),this._unsubscribe()},i.prototype.notifyComplete=function(){this._sendTrailing(),this._unsubscribe()},i}(Ct);yt.prototype.throttle=function(t,e){return void 0===e&&(e=Pr),this.lift(new Rr(t,e.leading,e.trailing))};var qr=function(){function t(t,e,i,n){this.duration=t,this.scheduler=e,this.leading=i,this.trailing=n}return t.prototype.call=function(t,e){return e.subscribe(new Br(t,this.duration,this.scheduler,this.leading,this.trailing))},t}(),Br=function(t){function i(e,i,n,r,o){t.call(this,e),this.duration=i,this.scheduler=n,this.leading=r,this.trailing=o,this._hasTrailingValue=!1,this._trailingValue=null}return e(i,t),i.prototype._next=function(t){this.throttled?this.trailing&&(this._trailingValue=t,this._hasTrailingValue=!0):(this.add(this.throttled=this.scheduler.schedule(J,this.duration,{subscriber:this})),this.leading&&this.destination.next(t))},i.prototype.clearThrottle=function(){var t=this.throttled;t&&(this.trailing&&this._hasTrailingValue&&(this.destination.next(this._trailingValue),this._trailingValue=null,this._hasTrailingValue=!1),t.unsubscribe(),this.remove(t),this.throttled=null)},i}(ft);yt.prototype.throttleTime=function(t,e,i){return void 0===e&&(e=de),void 0===i&&(i=Pr),this.lift(new qr(t,e,i.leading,i.trailing))};var Wr=function(){return function(t,e){this.value=t,this.interval=e}}(),zr=function(){function t(t){this.scheduler=t}return t.prototype.call=function(t,e){return e.subscribe(new Yr(t,this.scheduler))},t}(),Yr=function(t){function i(e,i){t.call(this,e),this.scheduler=i,this.lastTime=0,this.lastTime=i.now()}return e(i,t),i.prototype._next=function(t){var e=this.scheduler.now(),i=e-this.lastTime;this.lastTime=e,this.destination.next(new Wr(t,i))},i}(ft);yt.prototype.timeInterval=function(t){return void 0===t&&(t=de),this.lift(new zr(t))};var Ur=function(t){function i(){var e=t.call(this,"Timeout has occurred");this.name=e.name="TimeoutError",this.stack=e.stack,this.message=e.message}return e(i,t),i}(Error),Dr=function(){function t(t,e,i,n){this.waitFor=t,this.absoluteTimeout=e,this.scheduler=i,this.errorInstance=n}return t.prototype.call=function(t,e){return e.subscribe(new Lr(t,this.absoluteTimeout,this.waitFor,this.scheduler,this.errorInstance))},t}(),Lr=function(t){function i(e,i,n,r,o){t.call(this,e),this.absoluteTimeout=i,this.waitFor=n,this.scheduler=r,this.errorInstance=o,this.action=null,this.scheduleTimeout()}return e(i,t),i.dispatchTimeout=function(t){t.error(t.errorInstance)},i.prototype.scheduleTimeout=function(){var t=this.action;t?this.action=t.schedule(this,this.waitFor):this.add(this.action=this.scheduler.schedule(i.dispatchTimeout,this.waitFor,this))},i.prototype._next=function(e){this.absoluteTimeout||this.scheduleTimeout(),t.prototype._next.call(this,e)},i.prototype._unsubscribe=function(){this.action=null,this.scheduler=null,this.errorInstance=null},i}(ft);yt.prototype.timeout=function(t,e){void 0===e&&(e=de);var i=S(t),n=i?+t-e.now():Math.abs(t);return this.lift(new Dr(n,i,e,new Ur))};var Hr=function(){function t(t,e,i,n){this.waitFor=t,this.absoluteTimeout=e,this.withObservable=i,this.scheduler=n}return t.prototype.call=function(t,e){return e.subscribe(new Xr(t,this.absoluteTimeout,this.waitFor,this.withObservable,this.scheduler))},t}(),Xr=function(t){function i(e,i,n,r,o){t.call(this,e),this.absoluteTimeout=i,this.waitFor=n,this.withObservable=r,this.scheduler=o,this.action=null,this.scheduleTimeout()}return e(i,t),i.dispatchTimeout=function(t){var e=t.withObservable;t._unsubscribeAndRecycle(),t.add(d(t,e))},i.prototype.scheduleTimeout=function(){var t=this.action;t?this.action=t.schedule(this,this.waitFor):this.add(this.action=this.scheduler.schedule(i.dispatchTimeout,this.waitFor,this))},i.prototype._next=function(e){this.absoluteTimeout||this.scheduleTimeout(),t.prototype._next.call(this,e)},i.prototype._unsubscribe=function(){this.action=null,this.scheduler=null,this.withObservable=null},i}(Ct);yt.prototype.timeoutWith=function(t,e,i){void 0===i&&(i=de);var n=S(t),r=n?+t-i.now():Math.abs(t);return this.lift(new Hr(r,n,e,i))};var Gr=function(){return function(t,e){this.value=t,this.timestamp=e}}(),Jr=function(){function t(t){this.scheduler=t}return t.prototype.call=function(t,e){return e.subscribe(new Kr(t,this.scheduler))},t}(),Kr=function(t){function i(e,i){t.call(this,e),this.scheduler=i}return e(i,t),i.prototype._next=function(t){var e=this.scheduler.now();this.destination.next(new Gr(t,e))},i}(ft);yt.prototype.timestamp=function(t){return void 0===t&&(t=de),this.lift(new Jr(t))};var $r=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new Qr(t))},t}(),Qr=function(t){function i(e){t.call(this,e),this.array=[]}return e(i,t),i.prototype._next=function(t){this.array.push(t)},i.prototype._complete=function(){this.destination.next(this.array),this.destination.complete()},i}(ft);yt.prototype.toArray=function(){return this.lift(new $r)},yt.prototype.toPromise=function(t){var e=this;if(t||(rt.Rx&&rt.Rx.config&&rt.Rx.config.Promise?t=rt.Rx.config.Promise:rt.Promise&&(t=rt.Promise)),!t)throw new Error("no Promise impl found");return new t(function(t,i){var n;e.subscribe(function(t){return n=t},function(t){return i(t)},function(){return t(n)})})};var Zr=function(){function t(t){this.windowBoundaries=t}return t.prototype.call=function(t,e){var i=new to(t),n=e.subscribe(i);return n.closed||i.add(d(i,this.windowBoundaries)),n},t}(),to=function(t){function i(e){t.call(this,e),this.window=new xt,e.next(this.window)}return e(i,t),i.prototype.notifyNext=function(t,e,i,n,r){this.openWindow()},i.prototype.notifyError=function(t,e){this._error(t)},i.prototype.notifyComplete=function(t){this._complete()},i.prototype._next=function(t){this.window.next(t)},i.prototype._error=function(t){this.window.error(t),this.destination.error(t)},i.prototype._complete=function(){this.window.complete(),this.destination.complete()},i.prototype._unsubscribe=function(){this.window=null},i.prototype.openWindow=function(){var t=this.window;t&&t.complete();var e=this.destination,i=this.window=new xt;e.next(i)},i}(Ct);yt.prototype.window=function(t){return this.lift(new Zr(t))};var eo=function(){function t(t,e){this.windowSize=t,this.startWindowEvery=e}return t.prototype.call=function(t,e){return e.subscribe(new io(t,this.windowSize,this.startWindowEvery))},t}(),io=function(t){function i(e,i,n){t.call(this,e),this.destination=e,this.windowSize=i,this.startWindowEvery=n,this.windows=[new xt],this.count=0,e.next(this.windows[0])}return e(i,t),i.prototype._next=function(t){for(var e=this.startWindowEvery>0?this.startWindowEvery:this.windowSize,i=this.destination,n=this.windowSize,r=this.windows,o=r.length,s=0;s<o&&!this.closed;s++)r[s].next(t);var u=this.count-n+1;if(u>=0&&u%e==0&&!this.closed&&r.shift().complete(),++this.count%e==0&&!this.closed){var c=new xt;r.push(c),i.next(c)}},i.prototype._error=function(t){var e=this.windows;if(e)for(;e.length>0&&!this.closed;)e.shift().error(t);this.destination.error(t)},i.prototype._complete=function(){var t=this.windows;if(t)for(;t.length>0&&!this.closed;)t.shift().complete();this.destination.complete()},i.prototype._unsubscribe=function(){this.count=0,this.windows=null},i}(ft);yt.prototype.windowCount=function(t,e){return void 0===e&&(e=0),this.lift(new eo(t,e))};var no=function(){function t(t,e,i,n){this.windowTimeSpan=t,this.windowCreationInterval=e,this.maxWindowSize=i,this.scheduler=n}return t.prototype.call=function(t,e){return e.subscribe(new oo(t,this.windowTimeSpan,this.windowCreationInterval,this.maxWindowSize,this.scheduler))},t}(),ro=function(t){function i(){t.apply(this,arguments),this._numberOfNextedValues=0}return e(i,t),i.prototype.next=function(e){this._numberOfNextedValues++,t.prototype.next.call(this,e)},Object.defineProperty(i.prototype,"numberOfNextedValues",{get:function(){return this._numberOfNextedValues},enumerable:!0,configurable:!0}),i}(xt),oo=function(t){function i(e,i,n,r,o){t.call(this,e),this.destination=e,this.windowTimeSpan=i,this.windowCreationInterval=n,this.maxWindowSize=r,this.scheduler=o,this.windows=[];var s=this.openWindow();if(null!==n&&n>=0){var u={subscriber:this,window:s,context:null},c={windowTimeSpan:i,windowCreationInterval:n,subscriber:this,scheduler:o};this.add(o.schedule(Q,i,u)),this.add(o.schedule($,n,c))}else{var h={subscriber:this,window:s,windowTimeSpan:i};this.add(o.schedule(K,i,h))}}return e(i,t),i.prototype._next=function(t){for(var e=this.windows,i=e.length,n=0;n<i;n++){var r=e[n];r.closed||(r.next(t),r.numberOfNextedValues>=this.maxWindowSize&&this.closeWindow(r))}},i.prototype._error=function(t){for(var e=this.windows;e.length>0;)e.shift().error(t);this.destination.error(t)},i.prototype._complete=function(){for(var t=this.windows;t.length>0;){var e=t.shift();e.closed||e.complete()}this.destination.complete()},i.prototype.openWindow=function(){var t=new ro;this.windows.push(t);return this.destination.next(t),t},i.prototype.closeWindow=function(t){t.complete();var e=this.windows;e.splice(e.indexOf(t),1)},i}(ft);yt.prototype.windowTime=function(t){var e=de,i=null,n=Number.POSITIVE_INFINITY;return p(arguments[3])&&(e=arguments[3]),p(arguments[2])?e=arguments[2]:w(arguments[2])&&(n=arguments[2]),p(arguments[1])?e=arguments[1]:w(arguments[1])&&(i=arguments[1]),this.lift(new no(t,i,n,e))};var so=function(){function t(t,e){this.openings=t,this.closingSelector=e}return t.prototype.call=function(t,e){return e.subscribe(new uo(t,this.openings,this.closingSelector))},t}(),uo=function(t){function i(e,i,n){t.call(this,e),this.openings=i,this.closingSelector=n,this.contexts=[],this.add(this.openSubscription=d(this,i,i))}return e(i,t),i.prototype._next=function(t){var e=this.contexts;if(e)for(var i=e.length,n=0;n<i;n++)e[n].window.next(t)},i.prototype._error=function(e){var i=this.contexts;if(this.contexts=null,i)for(var n=i.length,r=-1;++r<n;){var o=i[r];o.window.error(e),o.subscription.unsubscribe()}t.prototype._error.call(this,e)},i.prototype._complete=function(){var e=this.contexts;if(this.contexts=null,e)for(var i=e.length,n=-1;++n<i;){var r=e[n];r.window.complete(),r.subscription.unsubscribe()}t.prototype._complete.call(this)},i.prototype._unsubscribe=function(){var t=this.contexts;if(this.contexts=null,t)for(var e=t.length,i=-1;++i<e;){var n=t[i];n.window.unsubscribe(),n.subscription.unsubscribe()}},i.prototype.notifyNext=function(t,e,i,n,r){if(t===this.openings){var s=o(this.closingSelector)(e);if(s===ut)return this.error(ut.e);var u=new xt,c=new ht,h={window:u,subscription:c};this.contexts.push(h);var a=d(this,s,h);a.closed?this.closeWindow(this.contexts.length-1):(a.context=h,c.add(a)),this.destination.next(u)}else this.closeWindow(this.contexts.indexOf(t))},i.prototype.notifyError=function(t){this.error(t)},i.prototype.notifyComplete=function(t){t!==this.openSubscription&&this.closeWindow(this.contexts.indexOf(t.context))},i.prototype.closeWindow=function(t){if(-1!==t){var e=this.contexts,i=e[t],n=i.window,r=i.subscription;e.splice(t,1),n.complete(),r.unsubscribe()}},i}(Ct);yt.prototype.windowToggle=function(t,e){return this.lift(new so(t,e))};var co=function(){function t(t){this.closingSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new ho(t,this.closingSelector))},t}(),ho=function(t){function i(e,i){t.call(this,e),this.destination=e,this.closingSelector=i,this.openWindow()}return e(i,t),i.prototype.notifyNext=function(t,e,i,n,r){this.openWindow(r)},i.prototype.notifyError=function(t,e){this._error(t)},i.prototype.notifyComplete=function(t){this.openWindow(t)},i.prototype._next=function(t){this.window.next(t)},i.prototype._error=function(t){this.window.error(t),this.destination.error(t),this.unsubscribeClosingNotification()},i.prototype._complete=function(){this.window.complete(),this.destination.complete(),this.unsubscribeClosingNotification()},i.prototype.unsubscribeClosingNotification=function(){this.closingNotification&&this.closingNotification.unsubscribe()},i.prototype.openWindow=function(t){void 0===t&&(t=null),t&&(this.remove(t),t.unsubscribe());var e=this.window;e&&e.complete();var i=this.window=new xt;this.destination.next(i);var n=o(this.closingSelector)();if(n===ut){var r=ut.e;this.destination.error(r),this.window.error(r)}else this.add(this.closingNotification=d(this,n))},i}(Ct);yt.prototype.windowWhen=function(t){return this.lift(new co(t))};var ao=function(){function t(t,e){this.observables=t,this.project=e}return t.prototype.call=function(t,e){return e.subscribe(new lo(t,this.observables,this.project))},t}(),lo=function(t){function i(e,i,n){t.call(this,e),this.observables=i,this.project=n,this.toRespond=[];var r=i.length;this.values=new Array(r);for(var o=0;o<r;o++)this.toRespond.push(o);for(o=0;o<r;o++){var s=i[o];this.add(d(this,s,s,o))}}return e(i,t),i.prototype.notifyNext=function(t,e,i,n,r){this.values[i]=e;var o=this.toRespond;if(o.length>0){var s=o.indexOf(i);-1!==s&&o.splice(s,1)}},i.prototype.notifyComplete=function(){},i.prototype._next=function(t){if(0===this.toRespond.length){var e=[t].concat(this.values);this.project?this._tryProject(e):this.destination.next(e)}},i.prototype._tryProject=function(t){var e;try{e=this.project.apply(this,t)}catch(t){return void this.destination.error(t)}this.destination.next(e)},i}(Ct);yt.prototype.withLatestFrom=function(){for(var t=[],e=0;e<arguments.length;e++)t[e-0]=arguments[e];var i;"function"==typeof t[t.length-1]&&(i=t.pop());var n=t;return this.lift(new ao(n,i))},yt.prototype.zip=function(){for(var t=[],e=0;e<arguments.length;e++)t[e-0]=arguments[e];return this.lift.call(T.apply(void 0,[this].concat(t)))},yt.prototype.zipAll=function(t){return this.lift(new Oe(t))};var po=function(){return function(t,e){void 0===e&&(e=Number.POSITIVE_INFINITY),this.subscribedFrame=t,this.unsubscribedFrame=e}}(),fo=function(){function t(){this.subscriptions=[]}return t.prototype.logSubscribedFrame=function(){return this.subscriptions.push(new po(this.scheduler.now())),this.subscriptions.length-1},t.prototype.logUnsubscribedFrame=function(t){var e=this.subscriptions,i=e[t];e[t]=new po(i.subscribedFrame,this.scheduler.now())},t}(),bo=function(t){function i(e,i){t.call(this,function(t){var e=this,i=e.logSubscribedFrame();return t.add(new ht(function(){e.logUnsubscribedFrame(i)})),e.scheduleMessages(t),t}),this.messages=e,this.subscriptions=[],this.scheduler=i}return e(i,t),i.prototype.scheduleMessages=function(t){for(var e=this.messages.length,i=0;i<e;i++){var n=this.messages[i];t.add(this.scheduler.schedule(function(t){var e=t.message,i=t.subscriber;e.notification.observe(i)},n.frame,{message:n,subscriber:t}))}},i}(yt);Z(bo,[fo]);var yo=function(t){function i(e,i){t.call(this),this.messages=e,this.subscriptions=[],this.scheduler=i}return e(i,t),i.prototype._subscribe=function(e){var i=this,n=i.logSubscribedFrame();return e.add(new ht(function(){i.logUnsubscribedFrame(n)})),t.prototype._subscribe.call(this,e)},i.prototype.setup=function(){for(var t=this,e=t.messages.length,i=0;i<e;i++)!function(){var e=t.messages[i];t.scheduler.schedule(function(){e.notification.observe(t)},e.frame)}()},i}(xt);Z(yo,[fo]);var vo=function(t){function i(e,i){var n=this;void 0===e&&(e=mo),void 0===i&&(i=Number.POSITIVE_INFINITY),t.call(this,e,function(){return n.frame}),this.maxFrames=i,this.frame=0,this.index=-1}return e(i,t),i.prototype.flush=function(){for(var t,e,i=this.actions,n=this.maxFrames;(e=i.shift())&&(this.frame=e.delay)<=n&&!(t=e.execute(e.state,e.delay)););if(t){for(;e=i.shift();)e.unsubscribe();throw t}},i.frameTimeFactor=10,i}(fe),mo=function(t){function i(e,i,n){void 0===n&&(n=e.index+=1),t.call(this,e,i),this.scheduler=e,this.work=i,this.index=n,this.active=!0,this.index=e.index=n}return e(i,t),i.prototype.schedule=function(e,n){if(void 0===n&&(n=0),!this.id)return t.prototype.schedule.call(this,e,n);this.active=!1;var r=new i(this.scheduler,this.work);return this.add(r),r.schedule(e,n)},i.prototype.requestAsyncId=function(t,e,n){void 0===n&&(n=0),this.delay=t.frame+n;var r=t.actions;return r.push(this),r.sort(i.sortActions),!0},i.prototype.recycleAsyncId=function(t,e,i){void 0===i&&(i=0)},i.prototype._execute=function(e,i){if(!0===this.active)return t.prototype._execute.call(this,e,i)},i.sortActions=function(t,e){return t.delay===e.delay?t.index===e.index?0:t.index>e.index?1:-1:t.delay>e.delay?1:-1},i}(pe),wo=750,xo=function(t){function i(e){t.call(this,mo,wo),this.assertDeepEqual=e,this.hotObservables=[],this.coldObservables=[],this.flushTests=[]}return e(i,t),i.prototype.createTime=function(t){var e=t.indexOf("|");if(-1===e)throw new Error('marble diagram for time should have a completion marker "|"');return e*i.frameTimeFactor},i.prototype.createColdObservable=function(t,e,n){if(-1!==t.indexOf("^"))throw new Error('cold observable cannot have subscription offset "^"');if(-1!==t.indexOf("!"))throw new Error('cold observable cannot have unsubscription marker "!"');var r=i.parseMarbles(t,e,n),o=new bo(r,this);return this.coldObservables.push(o),o},i.prototype.createHotObservable=function(t,e,n){if(-1!==t.indexOf("!"))throw new Error('hot observable cannot have unsubscription marker "!"');var r=i.parseMarbles(t,e,n),o=new yo(r,this);return this.hotObservables.push(o),o},i.prototype.materializeInnerObservable=function(t,e){var i=this,n=[];return t.subscribe(function(t){n.push({frame:i.frame-e,notification:$t.createNext(t)})},function(t){n.push({frame:i.frame-e,notification:$t.createError(t)})},function(){n.push({frame:i.frame-e,notification:$t.createComplete()})}),n},i.prototype.expectObservable=function(t,e){var n=this;void 0===e&&(e=null);var r,o=[],s={actual:o,ready:!1},u=i.parseMarblesAsSubscriptions(e).unsubscribedFrame;return this.schedule(function(){r=t.subscribe(function(t){var e=t;t instanceof yt&&(e=n.materializeInnerObservable(e,n.frame)),o.push({frame:n.frame,notification:$t.createNext(e)})},function(t){o.push({frame:n.frame,notification:$t.createError(t)})},function(){o.push({frame:n.frame,notification:$t.createComplete()})})},0),u!==Number.POSITIVE_INFINITY&&this.schedule(function(){return r.unsubscribe()},u),this.flushTests.push(s),{toBe:function(t,e,n){s.ready=!0,s.expected=i.parseMarbles(t,e,n,!0)}}},i.prototype.expectSubscriptions=function(t){var e={actual:t,ready:!1};return this.flushTests.push(e),{toBe:function(t){var n="string"==typeof t?[t]:t;e.ready=!0,e.expected=n.map(function(t){return i.parseMarblesAsSubscriptions(t)})}}},i.prototype.flush=function(){for(var e=this.hotObservables;e.length>0;)e.shift().setup();t.prototype.flush.call(this);for(var i=this.flushTests.filter(function(t){return t.ready});i.length>0;){var n=i.shift();this.assertDeepEqual(n.actual,n.expected)}},i.parseMarblesAsSubscriptions=function(t){if("string"!=typeof t)return new po(Number.POSITIVE_INFINITY);for(var e=t.length,i=-1,n=Number.POSITIVE_INFINITY,r=Number.POSITIVE_INFINITY,o=0;o<e;o++){var s=o*this.frameTimeFactor,u=t[o];switch(u){case"-":case" ":break;case"(":i=s;break;case")":i=-1;break;case"^":if(n!==Number.POSITIVE_INFINITY)throw new Error("found a second subscription point '^' in a subscription marble diagram. There can only be one.");n=i>-1?i:s;break;case"!":if(r!==Number.POSITIVE_INFINITY)throw new Error("found a second subscription point '^' in a subscription marble diagram. There can only be one.");r=i>-1?i:s;break;default:throw new Error("there can only be '^' and '!' markers in a subscription marble diagram. Found instead '"+u+"'.")}}return r<0?new po(n):new po(n,r)},i.parseMarbles=function(t,e,i,n){if(void 0===n&&(n=!1),-1!==t.indexOf("!"))throw new Error('conventional marble diagrams cannot have the unsubscription marker "!"');for(var r=t.length,o=[],s=t.indexOf("^"),u=-1===s?0:s*-this.frameTimeFactor,c="object"!==(void 0===e?"undefined":_typeof(e))?function(t){return t}:function(t){return n&&e[t]instanceof bo?e[t].messages:e[t]},h=-1,a=0;a<r;a++){var l=a*this.frameTimeFactor+u,p=void 0,f=t[a];switch(f){case"-":case" ":break;case"(":h=l;break;case")":h=-1;break;case"|":p=$t.createComplete();break;case"^":break;case"#":p=$t.createError(i||"error");break;default:p=$t.createNext(c(f))}p&&o.push({frame:h>-1?h:l,notification:p})}return o},i}(vo),_o=new(function(){return function(t){t.requestAnimationFrame?(this.cancelAnimationFrame=t.cancelAnimationFrame.bind(t),this.requestAnimationFrame=t.requestAnimationFrame.bind(t)):t.mozRequestAnimationFrame?(this.cancelAnimationFrame=t.mozCancelAnimationFrame.bind(t),this.requestAnimationFrame=t.mozRequestAnimationFrame.bind(t)):t.webkitRequestAnimationFrame?(this.cancelAnimationFrame=t.webkitCancelAnimationFrame.bind(t),this.requestAnimationFrame=t.webkitRequestAnimationFrame.bind(t)):t.msRequestAnimationFrame?(this.cancelAnimationFrame=t.msCancelAnimationFrame.bind(t),this.requestAnimationFrame=t.msRequestAnimationFrame.bind(t)):t.oRequestAnimationFrame?(this.cancelAnimationFrame=t.oCancelAnimationFrame.bind(t),this.requestAnimationFrame=t.oRequestAnimationFrame.bind(t)):(this.cancelAnimationFrame=clearTimeout.bind(t),this.requestAnimationFrame=function(t){return setTimeout(t,1e3/60)})}}())(rt),go=function(t){function i(e,i){t.call(this,e,i),this.scheduler=e,this.work=i}return e(i,t),i.prototype.requestAsyncId=function(e,i,n){return void 0===n&&(n=0),null!==n&&n>0?t.prototype.requestAsyncId.call(this,e,i,n):(e.actions.push(this),e.scheduled||(e.scheduled=_o.requestAnimationFrame(e.flush.bind(e,null))))},i.prototype.recycleAsyncId=function(e,i,n){if(void 0===n&&(n=0),null!==n&&n>0||null===n&&this.delay>0)return t.prototype.recycleAsyncId.call(this,e,i,n);0===e.actions.length&&(_o.cancelAnimationFrame(i),e.scheduled=void 0)},i}(pe),So=new(function(t){function i(){t.apply(this,arguments)}return e(i,t),i.prototype.flush=function(t){this.active=!0,this.scheduled=void 0;var e,i=this.actions,n=-1,r=i.length;t=t||i.shift();do{if(e=t.execute(t.state,t.delay))break}while(++n<r&&(t=i.shift()));if(this.active=!1,e){for(;++n<r&&(t=i.shift());)t.unsubscribe();throw e}},i}(fe))(go),To={asap:mr,queue:Xe,animationFrame:So,async:de},Io={rxSubscriber:pt,observable:bt,iterator:kt};t.Scheduler=To,t.Symbol=Io,t.Subject=xt,t.AnonymousSubject=_t,t.Observable=yt,t.Subscription=ht,t.Subscriber=ft,t.AsyncSubject=gt,t.ReplaySubject=Ge,t.BehaviorSubject=Yn,t.ConnectableObservable=An,t.Notification=$t,t.EmptyError=en,t.ArgumentOutOfRangeError=Hi,t.ObjectUnsubscribedError=vt,t.TimeoutError=Ur,t.UnsubscriptionError=ct,t.TimeInterval=Wr,t.Timestamp=Gr,t.TestScheduler=xo,t.VirtualTimeScheduler=vo,t.AjaxResponse=Ye,t.AjaxError=Ue,t.AjaxTimeoutError=De,Object.defineProperty(t,"__esModule",{value:!0})});