/* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.*/ (function(a){function b(a){return a&&a.Object===Object?a:null}function c(a){for(var b=[],c=0,d=a.length;d>c;c++)b.push(a[c]);return b}function d(a){return function(){try{return a.apply(this,arguments)}catch(b){return Za.e=b,Za}}}function e(a){throw a}function f(a,b){if(_a&&b.stack&&"object"==typeof a&&null!==a&&a.stack&&-1===a.stack.indexOf(db)){for(var c=[],d=b;d;d=d.source)d.stack&&c.unshift(d.stack);c.unshift(a.stack);var e=c.join("\n"+db+"\n");a.stack=g(e)}}function g(a){for(var b=a.split("\n"),c=[],d=0,e=b.length;e>d;d++){var f=b[d];h(f)||i(f)||!f||c.push(f)}return c.join("\n")}function h(a){var b=k(a);if(!b)return!1;var c=b[0],d=b[1];return c===bb&&d>=cb&&Gg>=d}function i(a){return-1!==a.indexOf("(module.js:")||-1!==a.indexOf("(node.js:")}function j(){if(_a)try{throw new Error}catch(a){var b=a.stack.split("\n"),c=b[0].indexOf("@")>0?b[1]:b[2],d=k(c);if(!d)return;return bb=d[0],d[1]}}function k(a){var b=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(a);if(b)return[b[1],Number(b[2])];var c=/at ([^ ]+):(\d+):(?:\d+)$/.exec(a);if(c)return[c[1],Number(c[2])];var d=/.*@(.+):(\d+)$/.exec(a);return d?[d[1],Number(d[2])]:void 0}function l(b,c,d,e,f,g){var h=Sb(b),i=h.length,j=Sb(c),k=j.length;if(i!==k&&!e)return!1;for(var l,m=i;m--;)if(l=h[m],!(e?l in c:Pb.call(c,l)))return!1;for(var n=e;++m<i;){l=h[m];var o,p=b[l],q=c[l];if(!(o===a?d(p,q,e,f,g):o))return!1;n||(n="constructor"===l)}if(!n){var r=b.constructor,s=c.constructor;if(r!==s&&"constructor"in b&&"constructor"in c&&!("function"==typeof r&&r instanceof r&&"function"==typeof s&&s instanceof s))return!1}return!0}function m(a,b,c){switch(c){case sb:case tb:return+a===+b;case ub:return a.name===b.name&&a.message===b.message;case xb:return a!==+a?b!==+b:a===+b;case zb:case Bb:return a===b+""}return!1}function n(a){return!!a&&"object"==typeof a}function o(a){return"number"==typeof a&&a>-1&&a%1===0&&Rb>=a}function p(a){return n(a)&&o(a.length)&&!!Nb[Qb.call(a)]}function q(a,b){for(var c=-1,d=a.length;++c<d;)if(b(a[c],c,a))return!0;return!1}function r(b,c,d,e,f,g){var h=-1,i=b.length,j=c.length;if(i!==j&&!(e&&j>i))return!1;for(;++h<i;){var k,l=b[h],m=c[h];if(k!==a){if(k)continue;return!1}if(e){if(!q(c,function(a){return l===a||d(l,a,e,f,g)}))return!1}else if(l!==m&&!d(l,m,e,f,g))return!1}return!0}function s(a,b,c,d,e,f){var g=Ub(a),h=Ub(b),i=rb,j=rb;g||(i=Qb.call(a),i===qb?i=yb:i!==yb&&(g=p(a))),h||(j=Qb.call(b),j===qb&&(j=yb));var k=i===yb&&!Tb(a),n=j===yb&&!Tb(b),o=i===j;if(o&&!g&&!k)return m(a,b,i);if(!d){var q=k&&Pb.call(a,"__wrapped__"),s=n&&Pb.call(b,"__wrapped__");if(q||s)return c(q?a.value():a,s?b.value():b,d,e,f)}if(!o)return!1;e||(e=[]),f||(f=[]);for(var t=e.length;t--;)if(e[t]===a)return f[t]===b;e.push(a),f.push(b);var u=(g?r:l)(a,b,c,d,e,f);return e.pop(),f.pop(),u}function t(a,b,c,d,e){return a===b?!0:null==a||null==b||!ba(a)&&!n(b)?a!==a&&b!==b:s(a,b,t,c,d,e)}function u(a,b){for(var c=new Array(a),d=0;a>d;d++)c[d]=b();return c}function v(a,b){this.id=a,this.value=b}function w(a,b){this.scheduler=a,this.disposable=b,this.isDisposed=!1}function x(a,b){b.isDisposed||(b.isDisposed=!0,b.disposable.dispose())}function y(a){this._s=a,this.isDisposed=!1}function z(a){this._s=a}function A(a){this._s=a,this._l=a.length,this._i=0}function B(a){this._a=a}function C(a){this._a=a,this._l=G(a),this._i=0}function D(a){return"number"==typeof a&&Pa.isFinite(a)}function E(b){var c,d=b[kb];if(!d&&"string"==typeof b)return c=new z(b),c[kb]();if(!d&&b.length!==a)return c=new B(b),c[kb]();if(!d)throw new TypeError("Object is not iterable");return b[kb]()}function F(a){var b=+a;return 0===b?b:isNaN(b)?b:0>b?-1:1}function G(a){var b=+a.length;return isNaN(b)?0:0!==b&&D(b)?(b=F(b)*Math.floor(Math.abs(b)),0>=b?0:b>ld?ld:b):b}function H(a,b){return pc(a)||(a=wc),new nd(b,a)}function I(a,b){this.observer=a,this.parent=b}function J(a,b){return a.amb(b)}function K(){return!1}function L(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];return b}function K(){return!1}function L(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];return b}function K(){return!1}function M(){return[]}function K(){return!1}function M(){return[]}function L(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];return b}function N(a){return function(b){return a.subscribe(b)}}function O(a){return a.toArray()}function P(a){return a.length>0}function Q(a){return{"@@iterator":function(){return{next:function(){return{done:!1,value:a}}}}}}function Q(a){return{"@@iterator":function(){return{next:function(){return{done:!1,value:a}}}}}}function R(a,b,c){var d=ob(b,c,3);return a.map(function(b,c){var e=d(b,c,a);return Xa(e)&&(e=dd(e)),(nb(e)||mb(e))&&(e=md(e)),e}).concatAll()}function S(a,b,c){for(var d=0,e=a.length;e>d;d++)if(c(a[d],b))return d;return-1}function T(a){this.comparer=a,this.set=[]}function U(b,c){return function(d){for(var e=d,f=0;c>f;f++){var g=e[b[f]];if("undefined"==typeof g)return a;e=g}return e}}function V(a){if(0===a.length)throw new eb;return a[0]}function W(a,b,c,d){var e=ob(b,c,3);return new xg(function(b){return a.subscribe(new gf(b,a,e,d))},a)}function X(a){return a?Sc.isObservable(a)?a:Xa(a)?Sc.fromPromise(a):aa(a)||_(a)?qf.call(this,a):Ya(a)?$.call(this,a):nb(a)||mb(a)?Y.call(this,a):ba(a)?Z.call(this,a):a:a}function Y(a){return Sc.from(a).concatMap(function(a){return Sc.isObservable(a)||ba(a)?X.call(null,a):Qa.Observable.just(a)}).toArray()}function Z(b){function c(b,c){d[c]=a,f.push(b.map(function(a){d[c]=a}))}for(var d=new b.constructor,e=Object.keys(b),f=[],g=0,h=e.length;h>g;g++){var i=e[g],j=X.call(this,b[i]);j&&Sc.isObservable(j)?c(j,i):d[i]=b[i]}return Sc.forkJoin.apply(Sc,f).map(function(){return d})}function $(a){var b=this;return new xg(function(c){a.call(b,function(){var a=arguments[0],b=arguments[1];if(a)return c.onError(a);if(arguments.length>2){for(var d=[],e=1,f=arguments.length;f>e;e++)d.push(arguments[e]);b=d}c.onNext(b),c.onCompleted()})})}function _(a){return Ya(a.next)&&Ya(a["throw"])}function aa(a){var b=a.constructor;return b?"GeneratorFunction"===b.name||"GeneratorFunction"===b.displayName?!0:_(b.prototype):!1}function ba(a){return Object==a.constructor}function ca(a,b,c,d){var e=new Cg;return d.push(da(e,b,c)),a.apply(b,d),e.asObservable()}function da(a,b,c){return function(){for(var d=arguments.length,e=new Array(d),f=0;d>f;f++)e[f]=arguments[f];if(Ya(c)){if(e=$a(c).apply(b,e),e===Za)return a.onError(e.e);a.onNext(e)}else e.length<=1?a.onNext(e[0]):a.onNext(e);a.onCompleted()}}function ea(a,b,c,d){var e=new Cg;return d.push(fa(e,b,c)),a.apply(b,d),e.asObservable()}function fa(a,b,c){return function(){var d=arguments[0];if(d)return a.onError(d);for(var e=arguments.length,f=[],g=1;e>g;g++)f[g-1]=arguments[g];if(Ya(c)){var f=$a(c).apply(b,f);if(f===Za)return a.onError(f.e);a.onNext(f)}else f.length<=1?a.onNext(f[0]):a.onNext(f);a.onCompleted()}}function ga(a){return Pa.StaticNodeList?a instanceof Pa.StaticNodeList||a instanceof Pa.NodeList:"[object NodeList]"===Object.prototype.toString.call(a)}function ha(a,b,c){this._e=a,this._n=b,this._fn=c,this._e.addEventListener(this._n,this._fn,!1),this.isDisposed=!1}function ia(a,b,c){var d=new _b,e=Object.prototype.toString.call(a);if(ga(a)||"[object HTMLCollection]"===e)for(var f=0,g=a.length;g>f;f++)d.add(ia(a.item(f),b,c));else a&&d.add(new ha(a,b,c));return d}function ja(a,b,c){return new xg(function(d){function e(a,b){if(j[b]=a,g[b]=!0,h||(h=g.every(Sa))){if(f)return d.onError(f);var e=$a(c).apply(null,j);if(e===Za)return d.onError(e.e);d.onNext(e)}i&&j[1]&&d.onCompleted()}var f,g=[!1,!1],h=!1,i=!1,j=new Array(2);return new jc(a.subscribe(function(a){e(a,0)},function(a){j[1]?d.onError(a):f=a},function(){i=!0,j[1]&&d.onCompleted()}),b.subscribe(function(a){e(a,1)},function(a){d.onError(a)},function(){i=!0,e(!0,1)}))},a)}function O(a){return a.toArray()}function ka(a,b){return a.groupJoin(this,b,jd,function(a,b){return b})}function la(a){var b=this;return new xg(function(c){var d=new Bg,e=new _b,f=new lc(e);return c.onNext(Yb(d,f)),e.add(b.subscribe(function(a){d.onNext(a)},function(a){d.onError(a),c.onError(a)},function(){d.onCompleted(),c.onCompleted()})),Xa(a)&&(a=dd(a)),e.add(a.subscribe(function(a){d.onCompleted(),d=new Bg,c.onNext(Yb(d,f))},function(a){d.onError(a),c.onError(a)},function(){d.onCompleted(),c.onCompleted()})),f},b)}function ma(a){var b=this;return new xg(function(c){function d(){var b;try{b=a()}catch(f){return void c.onError(f)}Xa(b)&&(b=dd(b));var i=new hc;e.setDisposable(i),i.setDisposable(b.take(1).subscribe(Ra,function(a){h.onError(a),c.onError(a)},function(){h.onCompleted(),h=new Bg,c.onNext(Yb(h,g)),d()}))}var e=new ic,f=new _b(e),g=new lc(f),h=new Bg;return c.onNext(Yb(h,g)),f.add(b.subscribe(function(a){h.onNext(a)},function(a){h.onError(a),c.onError(a)},function(){h.onCompleted(),c.onCompleted()})),d(),g},b)}function na(a,b){return new Hf(a,b)}function L(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];return b}function oa(a){this.patterns=a}function pa(a,b){this.expression=a,this.selector=b}function qa(a){return function(b){a.onError(b)}}function ra(a,b){return function(){var c=$a(a.selector).apply(a,arguments);return c===Za?b.onError(c.e):void b.onNext(c)}}function sa(a,b,c){var d=a.get(b);if(!d){var e=new Pf(b,c);return a.set(b,e),e}return d}function ta(a,b,c){this.joinObserverArray=a,this.onNext=b,this.onCompleted=c,this.joinObservers=new Of;for(var d=0,e=this.joinObserverArray.length;e>d;d++){var f=this.joinObserverArray[d];this.joinObservers.set(f,f)}}function ua(a,b){return new Qf(a,b)}function va(a,b,c){return new xg(function(d){var e=a,f=oc(b);return c.scheduleRecursiveFuture(0,e,function(a,b){if(f>0){var g=c.now();e=new Date(e.getTime()+f),e.getTime()<=g&&(e=new Date(g+f))}d.onNext(a),b(a+1,new Date(e))})})}function wa(a,b,c){return a===b?new xg(function(a){return c.schedulePeriodic(0,b,function(b){return a.onNext(b),b+1})}):gd(function(){return va(new Date(c.now()+a),b,c)})}function xa(a,b,c){return new xg(function(d){var e,f=!1,g=new ic,h=null,i=[],j=!1;return e=a.materialize().timestamp(c).subscribe(function(a){var e,k;"E"===a.value.kind?(i=[],i.push(a),h=a.value.error,k=!j):(i.push({value:a.value,timestamp:a.timestamp+b}),k=!f,f=!0),k&&(null!==h?d.onError(h):(e=new hc,g.setDisposable(e),e.setDisposable(c.scheduleRecursiveFuture(null,b,function(a,b){var e,g,k,l;if(null===h){j=!0;do k=null,i.length>0&&i[0].timestamp-c.now()<=0&&(k=i.shift().value),null!==k&&k.accept(d);while(null!==k);l=!1,g=0,i.length>0?(l=!0,g=Math.max(0,i[0].timestamp-c.now())):f=!1,e=h,j=!1,null!==e?d.onError(e):l&&b(null,g)}}))))}),new jc(e,g)},a)}function ya(a,b,c){return gd(function(){return xa(a,b-c.now(),c)})}function za(a,b,c){var d,e;return Ya(b)?e=b:(d=b,e=c),new xg(function(b){function c(){i.setDisposable(a.subscribe(function(a){var c=$a(e)(a);if(c===Za)return b.onError(c.e);var d=new hc;g.add(d),d.setDisposable(c.subscribe(function(){b.onNext(a),g.remove(d),f()},function(a){b.onError(a)},function(){b.onNext(a),g.remove(d),f()}))},function(a){b.onError(a)},function(){h=!0,i.dispose(),f()}))}function f(){h&&0===g.length&&b.onCompleted()}var g=new _b,h=!1,i=new ic;return d?i.setDisposable(d.subscribe(c,function(a){b.onError(a)},c)):c(),new jc(i,g)},a)}function Aa(a,b){return new xg(function(c){var d,e=!1,f=new ic,g=0,h=a.subscribe(function(a){var h=$a(b)(a);if(h===Za)return c.onError(h.e);Xa(h)&&(h=dd(h)),e=!0,d=a,g++;var i=g,j=new hc;f.setDisposable(j),j.setDisposable(h.subscribe(function(){e&&g===i&&c.onNext(d),e=!1,j.dispose()},function(a){c.onError(a)},function(){e&&g===i&&c.onNext(d),e=!1,j.dispose()}))},function(a){f.dispose(),c.onError(a),e=!1,g++},function(){f.dispose(),e&&c.onNext(d),c.onCompleted(),e=!1,g++});return new jc(h,f)},a)}function O(a){return a.toArray()}function O(a){return a.toArray()}function Ba(a,b,c,d){return Ya(b)&&(d=c,c=b,b=sd()),Sc.isObservable(d)||(d=yd(new _f)),new xg(function(e){function f(a){function b(){return l=c===k}var c=k,f=new hc;i.setDisposable(f),f.setDisposable(a.subscribe(function(){b()&&h.setDisposable(d.subscribe(e)),f.dispose()},function(a){b()&&e.onError(a)},function(){b()&&h.setDisposable(d.subscribe(e))}))}function g(){var a=!l;return a&&k++,a}var h=new ic,i=new ic,j=new hc;h.setDisposable(j);var k=0,l=!1;return f(b),j.setDisposable(a.subscribe(function(a){if(g()){e.onNext(a);var b=$a(c)(a);if(b===Za)return e.onError(b.e);f(Xa(b)?dd(b):b)}},function(a){g()&&e.onError(a)},function(){g()&&e.onCompleted()})),new jc(h,i)},a)}function Ca(a,b,c,d){return pc(c)&&(d=c,c=yd(new _f)),c instanceof Error&&(c=yd(c)),pc(d)||(d=Bc),Sc.isObservable(c)||(c=yd(new _f)),new xg(function(e){function f(){var a=g;k.setDisposable(d.scheduleFuture(null,b,function(){j=g===a,j&&(Xa(c)&&(c=dd(c)),i.setDisposable(c.subscribe(e)))}))}var g=0,h=new hc,i=new ic,j=!1,k=new ic;return i.setDisposable(h),f(),h.setDisposable(a.subscribe(function(a){j||(g++,e.onNext(a),f())},function(a){j||(g++,e.onError(a))},function(){j||(g++,e.onCompleted())})),new jc(i,k)},a)}function Da(a){return{"@@transducer/init":function(){return a},"@@transducer/step":function(a,b){return a.onNext(b)},"@@transducer/result":function(a){return a.onCompleted()}}}function Ea(a){this.predicate=a}function Fa(a){this.predicate=a}function Ga(a,b){var c=this;this.scheduler=a,this.messages=b,this.subscriptions=[],this.observers=[];for(var d=0,e=this.messages.length;e>d;d++){var f=this.messages[d],g=f.value;!function(b){a.scheduleAbsolute(null,f.time,function(){for(var a=c.observers.slice(0),d=0,e=a.length;e>d;d++)b.accept(a[d]);return dc})}(g)}}var Ha={"function":!0,object:!0},Ia=Ha[typeof exports]&&exports&&!exports.nodeType?exports:null,Ja=Ha[typeof module]&&module&&!module.nodeType?module:null,Ka=b(Ia&&Ja&&"object"==typeof global&&global),La=b(Ha[typeof self]&&self),Ma=b(Ha[typeof window]&&window),Na=Ja&&Ja.exports===Ia?Ia:null,Oa=b(Ha[typeof this]&&this),Pa=Ka||Ma!==(Oa&&Oa.window)&&Ma||La||Oa||Function("return this")(),Qa={internals:{},config:{Promise:Pa.Promise},helpers:{}},Ra=Qa.helpers.noop=function(){},Sa=Qa.helpers.identity=function(a){return a},Ta=Qa.helpers.defaultNow=Date.now,Ua=Qa.helpers.defaultComparer=function(a,b){return Vb(a,b)},Va=Qa.helpers.defaultSubComparer=function(a,b){return a>b?1:b>a?-1:0},Wa=(Qa.helpers.defaultKeySerializer=function(a){return a.toString()},Qa.helpers.defaultError=function(a){throw a}),Xa=Qa.helpers.isPromise=function(a){return!!a&&"function"!=typeof a.subscribe&&"function"==typeof a.then},Ya=Qa.helpers.isFunction=function(){var a=function(a){return"function"==typeof a||!1};return a(/x/)&&(a=function(a){return"function"==typeof a&&"[object Function]"==toString.call(a)}),a}(),Za={e:{}},$a=Qa.internals.tryCatch=function(a){if(!Ya(a))throw new TypeError("fn must be a function");return d(a)};Qa.config.longStackSupport=!1;var _a=!1,ab=$a(function(){throw new Error})();_a=!!ab.e&&!!ab.e.stack;var bb,cb=j(),db="From previous event:",eb=Qa.EmptyError=function(){this.message="Sequence contains no elements.",Error.call(this)};eb.prototype=Object.create(Error.prototype),eb.prototype.name="EmptyError";var fb=Qa.ObjectDisposedError=function(){this.message="Object has been disposed",Error.call(this)};fb.prototype=Object.create(Error.prototype),fb.prototype.name="ObjectDisposedError";var gb=Qa.ArgumentOutOfRangeError=function(){this.message="Argument out of range",Error.call(this)};gb.prototype=Object.create(Error.prototype),gb.prototype.name="ArgumentOutOfRangeError";var hb=Qa.NotSupportedError=function(a){this.message=a||"This operation is not supported",Error.call(this)};hb.prototype=Object.create(Error.prototype),hb.prototype.name="NotSupportedError";var ib=Qa.NotImplementedError=function(a){this.message=a||"This operation is not implemented",Error.call(this)};ib.prototype=Object.create(Error.prototype),ib.prototype.name="NotImplementedError";var jb=Qa.helpers.notImplemented=function(){throw new ib},kb=(Qa.helpers.notSupported=function(){throw new hb},"function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_");Pa.Set&&"function"==typeof(new Pa.Set)["@@iterator"]&&(kb="@@iterator");var lb=Qa.doneEnumerator={done:!0,value:a},mb=Qa.helpers.isIterable=function(b){return b&&b[kb]!==a},nb=Qa.helpers.isArrayLike=function(b){return b&&b.length!==a};Qa.helpers.iterator=kb;var ob=Qa.internals.bindCallback=function(a,b,c){if("undefined"==typeof b)return a;switch(c){case 0:return function(){return a.call(b)};case 1:return function(c){return a.call(b,c)};case 2:return function(c,d){return a.call(b,c,d)};case 3:return function(c,d,e){return a.call(b,c,d,e)}}return function(){return a.apply(b,arguments)}},pb=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],qb=(pb.length,"[object Arguments]"),rb="[object Array]",sb="[object Boolean]",tb="[object Date]",ub="[object Error]",vb="[object Function]",wb="[object Map]",xb="[object Number]",yb="[object Object]",zb="[object RegExp]",Ab="[object Set]",Bb="[object String]",Cb="[object WeakMap]",Db="[object ArrayBuffer]",Eb="[object Float32Array]",Fb="[object Float64Array]",Gb="[object Int8Array]",Hb="[object Int16Array]",Ib="[object Int32Array]",Jb="[object Uint8Array]",Kb="[object Uint8ClampedArray]",Lb="[object Uint16Array]",Mb="[object Uint32Array]",Nb={};Nb[Eb]=Nb[Fb]=Nb[Gb]=Nb[Hb]=Nb[Ib]=Nb[Jb]=Nb[Kb]=Nb[Lb]=Nb[Mb]=!0,Nb[qb]=Nb[rb]=Nb[Db]=Nb[sb]=Nb[tb]=Nb[ub]=Nb[vb]=Nb[wb]=Nb[xb]=Nb[yb]=Nb[zb]=Nb[Ab]=Nb[Bb]=Nb[Cb]=!1;var Ob=Object.prototype,Pb=Ob.hasOwnProperty,Qb=Ob.toString,Rb=Math.pow(2,53)-1,Sb=Object.keys||function(){var a=Object.prototype.hasOwnProperty,b=!{toString:null}.propertyIsEnumerable("toString"),c=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],d=c.length;return function(e){if("object"!=typeof e&&("function"!=typeof e||null===e))throw new TypeError("Object.keys called on non-object");var f,g,h=[];for(f in e)a.call(e,f)&&h.push(f);if(b)for(g=0;d>g;g++)a.call(e,c[g])&&h.push(c[g]);return h}}(),ba=Qa.internals.isObject=function(a){var b=typeof a;return!!a&&("object"===b||"function"===b)},Tb=function(){try{Object({toString:0}+"")}catch(a){return function(){return!1}}return function(a){return"function"!=typeof a.toString&&"string"==typeof(a+"")}}(),Ub=Array.isArray||function(a){return n(a)&&o(a.length)&&Qb.call(a)===rb},Vb=Qa.internals.isEqual=function(a,b){return t(a,b)},Wb=({}.hasOwnProperty,Array.prototype.slice,Qa.internals.inherits=function(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c}),Xb=Qa.internals.addProperties=function(a){for(var b=[],c=1,d=arguments.length;d>c;c++)b.push(arguments[c]);for(var e=0,f=b.length;f>e;e++){var g=b[e];for(var h in g)a[h]=g[h]}},Yb=Qa.internals.addRef=function(a,b){return new xg(function(c){return new jc(b.getDisposable(),a.subscribe(c))})};v.prototype.compareTo=function(a){var b=this.value.compareTo(a.value);return 0===b&&(b=this.id-a.id),b};var Zb=Qa.internals.PriorityQueue=function(a){this.items=new Array(a),this.length=0},$b=Zb.prototype;$b.isHigherPriority=function(a,b){return this.items[a].compareTo(this.items[b])<0},$b.percolate=function(a){if(!(a>=this.length||0>a)){var b=a-1>>1;if(!(0>b||b===a)&&this.isHigherPriority(a,b)){var c=this.items[a];this.items[a]=this.items[b],this.items[b]=c,this.percolate(b)}}},$b.heapify=function(a){if(+a||(a=0),!(a>=this.length||0>a)){var b=2*a+1,c=2*a+2,d=a;if(b<this.length&&this.isHigherPriority(b,d)&&(d=b),c<this.length&&this.isHigherPriority(c,d)&&(d=c),d!==a){var e=this.items[a];this.items[a]=this.items[d],this.items[d]=e,this.heapify(d)}}},$b.peek=function(){return this.items[0].value},$b.removeAt=function(b){this.items[b]=this.items[--this.length],this.items[this.length]=a,this.heapify()},$b.dequeue=function(){var a=this.peek();return this.removeAt(0),a},$b.enqueue=function(a){var b=this.length++;this.items[b]=new v(Zb.count++,a),this.percolate(b)},$b.remove=function(a){for(var b=0;b<this.length;b++)if(this.items[b].value===a)return this.removeAt(b),!0;return!1},Zb.count=0;var _b=Qa.CompositeDisposable=function(){var a,b,c=[];if(Array.isArray(arguments[0]))c=arguments[0];else for(b=arguments.length,c=new Array(b),a=0;b>a;a++)c[a]=arguments[a];this.disposables=c,this.isDisposed=!1,this.length=c.length},ac=_b.prototype;ac.add=function(a){this.isDisposed?a.dispose():(this.disposables.push(a),this.length++)},ac.remove=function(a){var b=!1;if(!this.isDisposed){var c=this.disposables.indexOf(a);-1!==c&&(b=!0,this.disposables.splice(c,1),this.length--,a.dispose())}return b},ac.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;for(var a=this.disposables.length,b=new Array(a),c=0;a>c;c++)b[c]=this.disposables[c];for(this.disposables=[],this.length=0,c=0;a>c;c++)b[c].dispose()}};var bc=Qa.Disposable=function(a){this.isDisposed=!1,this.action=a||Ra};bc.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var cc=bc.create=function(a){return new bc(a)},dc=bc.empty={dispose:Ra},ec=bc.isDisposable=function(a){return a&&Ya(a.dispose)},fc=bc.checkDisposed=function(a){if(a.isDisposed)throw new fb},gc=bc._fixup=function(a){return ec(a)?a:dc},hc=Qa.SingleAssignmentDisposable=function(){this.isDisposed=!1,this.current=null};hc.prototype.getDisposable=function(){return this.current},hc.prototype.setDisposable=function(a){if(this.current)throw new Error("Disposable has already been assigned");var b=this.isDisposed;!b&&(this.current=a),b&&a&&a.dispose()},hc.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.current;this.current=null,a&&a.dispose()}};var ic=Qa.SerialDisposable=function(){this.isDisposed=!1,this.current=null};ic.prototype.getDisposable=function(){return this.current},ic.prototype.setDisposable=function(a){var b=this.isDisposed;if(!b){var c=this.current;this.current=a}c&&c.dispose(),b&&a&&a.dispose()},ic.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.current;this.current=null}a&&a.dispose()};var jc=Qa.BinaryDisposable=function(a,b){this._first=a,this._second=b,this.isDisposed=!1};jc.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this._first;this._first=null,a&&a.dispose();var b=this._second;this._second=null,b&&b.dispose()}};var kc=Qa.NAryDisposable=function(a){this._disposables=a,this.isDisposed=!1};kc.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;for(var a=0,b=this._disposables.length;b>a;a++)this._disposables[a].dispose();this._disposables.length=0}};var lc=Qa.RefCountDisposable=function(){function a(a){this.disposable=a,this.disposable.count++,this.isInnerDisposed=!1}function b(a){this.underlyingDisposable=a,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return a.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},b.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},b.prototype.getDisposable=function(){return this.isDisposed?dc:new a(this)},b}();w.prototype.dispose=function(){this.scheduler.schedule(this,x)};var mc=Qa.internals.ScheduledItem=function(a,b,c,d,e){this.scheduler=a,this.state=b,this.action=c,this.dueTime=d,this.comparer=e||Va,this.disposable=new hc};mc.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},mc.prototype.compareTo=function(a){return this.comparer(this.dueTime,a.dueTime)},mc.prototype.isCancelled=function(){return this.disposable.isDisposed},mc.prototype.invokeCore=function(){return gc(this.action(this.scheduler,this.state))};var nc=Qa.Scheduler=function(){function a(){}a.isScheduler=function(b){return b instanceof a};var b=a.prototype;return b.schedule=function(a,b){throw new ib},b.scheduleFuture=function(b,c,d){var e=c;return e instanceof Date&&(e-=this.now()),e=a.normalize(e),0===e?this.schedule(b,d):this._scheduleFuture(b,e,d)},b._scheduleFuture=function(a,b,c){throw new ib},a.now=Ta,a.prototype.now=Ta,a.normalize=function(a){return 0>a&&(a=0),a},a}(),oc=nc.normalize,pc=nc.isScheduler;!function(a){function b(a,b){function c(b){function d(a,b){return g?f.remove(i):h=!0,e(b,c),dc}var g=!1,h=!1,i=a.schedule(b,d);h||(f.add(i),g=!0)}var d=b[0],e=b[1],f=new _b;return e(d,c),f}function c(a,b){function c(b,d){function g(a,b){return h?f.remove(j):i=!0,e(b,c),dc}var h=!1,i=!1,j=a.scheduleFuture(b,d,g);i||(f.add(j),h=!0)}var d=b[0],e=b[1],f=new _b;return e(d,c),f}a.scheduleRecursive=function(a,c){return this.schedule([a,c],b)},a.scheduleRecursiveFuture=function(a,b,d){return this.scheduleFuture([a,d],b,c)}}(nc.prototype),function(a){a.schedulePeriodic=function(a,b,c){if("undefined"==typeof Pa.setInterval)throw new hb;b=oc(b);var d=a,e=Pa.setInterval(function(){d=c(d)},b);return cc(function(){Pa.clearInterval(e)})}}(nc.prototype),function(a){a.catchError=a["catch"]=function(a){return new Cc(this,a)}}(nc.prototype);var qc,rc,sc=Qa.internals.SchedulePeriodicRecursive=function(){function a(a){return function(b,c){c(0,a._period);var d=$a(a._action)(a._state);d===Za&&(a._cancel.dispose(),e(d.e)),a._state=d}}function b(a,b,c,d){this._scheduler=a,this._state=b,this._period=c,this._action=d}return b.prototype.start=function(){var b=new hc;return this._cancel=b,b.setDisposable(this._scheduler.scheduleRecursiveFuture(0,this._period,a(this))),b},b}(),tc=function(a){function b(){a.call(this)}return Wb(b,a),b.prototype.schedule=function(a,b){return gc(b(this,a))},b}(nc),uc=nc.immediate=new tc,vc=function(a){function b(){for(;d.length>0;){var a=d.dequeue();!a.isCancelled()&&a.invoke()}}function c(){a.call(this)}var d;return Wb(c,a),c.prototype.schedule=function(a,c){var f=new mc(this,a,c,this.now());if(d)d.enqueue(f);else{d=new Zb(4),d.enqueue(f);var g=$a(b)();d=null,g===Za&&e(g.e)}return f.disposable},c.prototype.scheduleRequired=function(){return!d},c}(nc),wc=nc.currentThread=new vc,xc=function(){var a,b=Ra;if(Pa.setTimeout)a=Pa.setTimeout,b=Pa.clearTimeout;else{if(!Pa.WScript)throw new hb;a=function(a,b){Pa.WScript.Sleep(b),a()}}return{setTimeout:a,clearTimeout:b}}(),yc=xc.setTimeout,zc=xc.clearTimeout;!function(){function a(b){if(f)yc(function(){a(b)},0);else{var c=d[b];if(c){f=!0;var g=$a(c)();rc(b),f=!1,g===Za&&e(g.e)}}}function b(){if(!Pa.postMessage||Pa.importScripts)return!1;var a=!1,b=Pa.onmessage;return Pa.onmessage=function(){a=!0},Pa.postMessage("","*"),Pa.onmessage=b,a}var c=1,d={},f=!1;rc=function(a){delete d[a]};var g=new RegExp("^"+String(toString).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),h="function"==typeof(h=Ka&&Na&&Ka.setImmediate)&&!g.test(h)&&h;if(Ya(h))qc=function(b){var e=c++;return d[e]=b,h(function(){a(e)}),e};else if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))qc=function(b){var e=c++;return d[e]=b,process.nextTick(function(){a(e)}),e};else if(b()){var i="ms.rx.schedule"+Math.random(),j=function(b){"string"==typeof b.data&&b.data.substring(0,i.length)===i&&a(b.data.substring(i.length))};Pa.addEventListener("message",j,!1),qc=function(a){var b=c++;return d[b]=a,Pa.postMessage(i+b,"*"),b}}else if(Pa.MessageChannel){var k=new Pa.MessageChannel;k.port1.onmessage=function(b){a(b.data)},qc=function(a){var b=c++;return d[b]=a,k.port2.postMessage(b),b}}else qc="document"in Pa&&"onreadystatechange"in Pa.document.createElement("script")?function(b){var e=Pa.document.createElement("script"),f=c++;return d[f]=b,e.onreadystatechange=function(){a(f),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},Pa.document.documentElement.appendChild(e),f}:function(b){var e=c++;return d[e]=b,yc(function(){a(e)},0),e}}();var Ac=function(a){function b(){a.call(this)}function c(a,b,c,d){return function(){a.setDisposable(bc._fixup(b(c,d)))}}function d(a){this._id=a,this.isDisposed=!1}function e(a){this._id=a,this.isDisposed=!1}function f(a,b,c){return function(){b(a,c)}}return Wb(b,a),d.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,rc(this._id))},e.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,zc(this._id))},b.prototype.schedule=function(a,b){var e=new hc,f=qc(c(e,b,this,a));return new jc(e,new d(f))},b.prototype._scheduleFuture=function(a,b,d){if(0===b)return this.schedule(a,d);var f=new hc,g=yc(c(f,d,this,a),b);return new jc(f,new e(g))},b.prototype.scheduleLongRunning=function(a,b){var c=cc(Ra);return qc(f(a,b,c)),c},b}(nc),Bc=nc["default"]=nc.async=new Ac,Cc=function(a){function b(b,c){this._scheduler=b,this._handler=c,this._recursiveOriginal=null,this._recursiveWrapper=null,a.call(this)}return Wb(b,a),b.prototype.schedule=function(a,b){return this._scheduler.schedule(a,this._wrap(b))},b.prototype._scheduleFuture=function(a,b,c){return this._scheduler.schedule(a,b,this._wrap(c))},b.prototype.now=function(){return this._scheduler.now()},b.prototype._clone=function(a){return new b(a,this._handler)},b.prototype._wrap=function(a){var b=this;return function(c,d){var f=$a(a)(b._getRecursiveWrapper(c),d);return f===Za?(b._handler(f.e)||e(f.e),dc):gc(f)}},b.prototype._getRecursiveWrapper=function(a){if(this._recursiveOriginal!==a){this._recursiveOriginal=a;var b=this._clone(a);b._recursiveOriginal=a,b._recursiveWrapper=b,this._recursiveWrapper=b}return this._recursiveWrapper},b.prototype.schedulePeriodic=function(a,b,c){var d=this,f=!1,g=new hc;return g.setDisposable(this._scheduler.schedulePeriodic(a,b,function(a){if(f)return null;var b=$a(c)(a);return b===Za?(f=!0,d._handler(b.e)||e(b.e),g.dispose(),null):b})),g},b}(nc),Dc=Qa.Notification=function(){function a(){}return a.prototype._accept=function(a,b,c){throw new ib},a.prototype._acceptObserver=function(a,b,c){throw new ib},a.prototype.accept=function(a,b,c){return a&&"object"==typeof a?this._acceptObserver(a):this._accept(a,b,c)},a.prototype.toObservable=function(a){var b=this;return pc(a)||(a=uc),new xg(function(c){return a.schedule(b,function(a,b){b._acceptObserver(c),"N"===b.kind&&c.onCompleted()})})},a}(),Ec=function(a){function b(a){this.value=a,this.kind="N"}return Wb(b,a),b.prototype._accept=function(a){return a(this.value)},b.prototype._acceptObserver=function(a){return a.onNext(this.value)},b.prototype.toString=function(){return"OnNext("+this.value+")"},b}(Dc),Fc=function(a){function b(a){this.error=a,this.kind="E"}return Wb(b,a),b.prototype._accept=function(a,b){return b(this.error)},b.prototype._acceptObserver=function(a){return a.onError(this.error)},b.prototype.toString=function(){return"OnError("+this.error+")"},b}(Dc),Gc=function(a){function b(){this.kind="C"}return Wb(b,a),b.prototype._accept=function(a,b,c){return c()},b.prototype._acceptObserver=function(a){return a.onCompleted()},b.prototype.toString=function(){return"OnCompleted()"},b}(Dc),Hc=Dc.createOnNext=function(a){return new Ec(a)},Ic=Dc.createOnError=function(a){return new Fc(a)},Jc=Dc.createOnCompleted=function(){return new Gc},Kc=Qa.Observer=function(){};Kc.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},Kc.prototype.asObserver=function(){var a=this;return new Oc(function(b){a.onNext(b)},function(b){a.onError(b)},function(){a.onCompleted()})},Kc.prototype.checked=function(){return new Pc(this)};var Lc=Kc.create=function(a,b,c){return a||(a=Ra),b||(b=Wa),c||(c=Ra),new Oc(a,b,c)};Kc.fromNotifier=function(a,b){var c=ob(a,b,1);return new Oc(function(a){return c(Hc(a))},function(a){return c(Ic(a))},function(){return c(Jc())})},Kc.prototype.notifyOn=function(a){return new Rc(a,this)},Kc.prototype.makeSafe=function(a){return new AnonymousSafeObserver(this._onNext,this._onError,this._onCompleted,a)};var Mc,Nc=Qa.internals.AbstractObserver=function(a){function b(){this.isStopped=!1}return Wb(b,a),b.prototype.next=jb,b.prototype.error=jb,b.prototype.completed=jb,b.prototype.onNext=function(a){!this.isStopped&&this.next(a); },b.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.error(a))},b.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},b.prototype.dispose=function(){this.isStopped=!0},b.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.error(a),!0)},b}(Kc),Oc=Qa.AnonymousObserver=function(a){function b(b,c,d){a.call(this),this._onNext=b,this._onError=c,this._onCompleted=d}return Wb(b,a),b.prototype.next=function(a){this._onNext(a)},b.prototype.error=function(a){this._onError(a)},b.prototype.completed=function(){this._onCompleted()},b}(Nc),Pc=function(a){function b(b){a.call(this),this._observer=b,this._state=0}Wb(b,a);var c=b.prototype;return c.onNext=function(a){this.checkAccess();var b=$a(this._observer.onNext).call(this._observer,a);this._state=0,b===Za&&e(b.e)},c.onError=function(a){this.checkAccess();var b=$a(this._observer.onError).call(this._observer,a);this._state=2,b===Za&&e(b.e)},c.onCompleted=function(){this.checkAccess();var a=$a(this._observer.onCompleted).call(this._observer);this._state=2,a===Za&&e(a.e)},c.checkAccess=function(){if(1===this._state)throw new Error("Re-entrancy detected");if(2===this._state)throw new Error("Observer completed");0===this._state&&(this._state=1)},b}(Kc),Qc=Qa.internals.ScheduledObserver=function(a){function b(b,c){a.call(this),this.scheduler=b,this.observer=c,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new ic}function c(a,b){return function(){a.onNext(b)}}function d(a,b){return function(){a.onError(b)}}function f(a){return function(){a.onCompleted()}}function g(a,b){var c;if(!(a.queue.length>0))return void(a.isAcquired=!1);c=a.queue.shift();var d=$a(c)();return d===Za?(a.queue=[],a.hasFaulted=!0,e(d.e)):void b(a)}return Wb(b,a),b.prototype.next=function(a){this.queue.push(c(this.observer,a))},b.prototype.error=function(a){this.queue.push(d(this.observer,a))},b.prototype.completed=function(){this.queue.push(f(this.observer))},b.prototype.ensureActive=function(){var a=!1;!this.hasFaulted&&this.queue.length>0&&(a=!this.isAcquired,this.isAcquired=!0),a&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(this,g))},b.prototype.dispose=function(){a.prototype.dispose.call(this),this.disposable.dispose()},b}(Nc),Rc=function(a){function b(b,c,d){a.call(this,b,c),this._cancel=d}return Wb(b,a),b.prototype.next=function(b){a.prototype.next.call(this,b),this.ensureActive()},b.prototype.error=function(b){a.prototype.error.call(this,b),this.ensureActive()},b.prototype.completed=function(){a.prototype.completed.call(this),this.ensureActive()},b.prototype.dispose=function(){a.prototype.dispose.call(this),this._cancel&&this._cancel.dispose(),this._cancel=null},b}(Qc),Sc=Qa.Observable=function(){function a(a,b){return function(c){var d=c.onError;return c.onError=function(b){f(b,a),d.call(c,b)},b.call(a,c)}}function b(){if(Qa.config.longStackSupport&&_a){var b=this._subscribe,c=$a(e)(new Error).e;this.stack=c.stack.substring(c.stack.indexOf("\n")+1),this._subscribe=a(this,b)}}return Mc=b.prototype,b.isObservable=function(a){return a&&Ya(a.subscribe)},Mc.subscribe=Mc.forEach=function(a,b,c){return this._subscribe("object"==typeof a?a:Lc(a,b,c))},Mc.subscribeOnNext=function(a,b){return this._subscribe(Lc("undefined"!=typeof b?function(c){a.call(b,c)}:a))},Mc.subscribeOnError=function(a,b){return this._subscribe(Lc(null,"undefined"!=typeof b?function(c){a.call(b,c)}:a))},Mc.subscribeOnCompleted=function(a,b){return this._subscribe(Lc(null,null,"undefined"!=typeof b?function(){a.call(b)}:a))},b}(),Tc=Qa.ObservableBase=function(a){function b(a){return a&&Ya(a.dispose)?a:Ya(a)?cc(a):dc}function c(a,c){var d=c[0],f=c[1],g=$a(f.subscribeCore).call(f,d);g!==Za||d.fail(Za.e)||e(Za.e),d.setDisposable(b(g))}function d(){a.call(this)}return Wb(d,a),d.prototype._subscribe=function(a){var b=new yg(a),d=[b,this];return wc.scheduleRequired()?wc.schedule(d,c):c(null,d),b},d.prototype.subscribeCore=jb,d}(Sc),Uc=Qa.FlatMapObservable=function(a){function b(b,c,d,e){this.resultSelector=Ya(d)?d:null,this.selector=ob(Ya(c)?c:function(){return c},e,3),this.source=b,a.call(this)}function c(a,b,c,d){this.i=0,this.selector=b,this.resultSelector=c,this.source=d,this.o=a,Nc.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new c(a,this.selector,this.resultSelector,this))},Wb(c,Nc),c.prototype._wrapResult=function(a,b,c){return this.resultSelector?a.map(function(a,d){return this.resultSelector(b,a,c,d)},this):a},c.prototype.next=function(a){var b=this.i++,c=$a(this.selector)(a,b,this.source);return c===Za?this.o.onError(c.e):(Xa(c)&&(c=dd(c)),(nb(c)||mb(c))&&(c=Sc.from(c)),void this.o.onNext(this._wrapResult(c,a,b)))},c.prototype.error=function(a){this.o.onError(a)},c.prototype.completed=function(){this.o.onCompleted()},b}(Tc),Vc=Qa.internals.Enumerable=function(){};y.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this._s.isDisposed=!0)};var Wc=function(a){function b(b){this.sources=b,a.call(this)}function c(a,b){if(!a.isDisposed){var c=$a(a.e.next).call(a.e);if(c===Za)return a.o.onError(c.e);if(c.done)return a.o.onCompleted();var e=c.value;Xa(e)&&(e=dd(e));var f=new hc;a.subscription.setDisposable(f),f.setDisposable(e.subscribe(new d(a,b)))}}function d(a,b){this._state=a,this._recurse=b,Nc.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){var b=new ic,d={isDisposed:!1,o:a,subscription:b,e:this.sources[kb]()},e=wc.scheduleRecursive(d,c);return new kc([b,e,new y(d)])},Wb(d,Nc),d.prototype.next=function(a){this._state.o.onNext(a)},d.prototype.error=function(a){this._state.o.onError(a)},d.prototype.completed=function(){this._recurse(this._state)},b}(Tc);Vc.prototype.concat=function(){return new Wc(this)};var Xc=function(a){function b(b){this.sources=b,a.call(this)}function c(a,b){if(!a.isDisposed){var c=$a(a.e.next).call(a.e);if(c===Za)return a.o.onError(c.e);if(c.done)return null!==a.lastError?a.o.onError(a.lastError):a.o.onCompleted();var e=c.value;Xa(e)&&(e=dd(e));var f=new hc;a.subscription.setDisposable(f),f.setDisposable(e.subscribe(new d(a,b)))}}function d(a,b){this._state=a,this._recurse=b,Nc.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){var b=new ic,d={isDisposed:!1,e:this.sources[kb](),subscription:b,lastError:null,o:a},e=wc.scheduleRecursive(d,c);return new kc([b,e,new y(d)])},Wb(d,Nc),d.prototype.next=function(a){this._state.o.onNext(a)},d.prototype.error=function(a){this._state.lastError=a,this._recurse(this._state)},d.prototype.completed=function(){this._state.o.onCompleted()},b}(Tc);Vc.prototype.catchError=function(){return new Xc(this)};var Yc=function(a){function b(a,b){this.v=a,this.c=null==b?-1:b}function c(a){this.v=a.v,this.l=a.c}return Wb(b,a),b.prototype[kb]=function(){return new c(this)},c.prototype.next=function(){return 0===this.l?lb:(this.l>0&&this.l--,{done:!1,value:this.v})},b}(Vc),Zc=Vc.repeat=function(a,b){return new Yc(a,b)},$c=function(a){function b(a,b,c){this.s=a,this.fn=b?ob(b,c,3):null}function c(a){this.i=-1,this.s=a.s,this.l=this.s.length,this.fn=a.fn}return Wb(b,a),b.prototype[kb]=function(){return new c(this)},c.prototype.next=function(){return++this.i<this.l?{done:!1,value:this.fn?this.fn(this.s[this.i],this.i,this.s):this.s[this.i]}:lb},b}(Vc),_c=Vc.of=function(a,b,c){return new $c(a,b,c)},ad=function(a){function b(b,c){this.source=b,this._s=c,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new Rc(this._s,a))},b}(Tc);Mc.observeOn=function(a){return new ad(this,a)};var bd=function(a){function b(b,c){this.source=b,this._s=c,a.call(this)}function c(a,b){var c=b[0],d=b[1],e=b[2];d.setDisposable(new w(a,c.subscribe(e)))}return Wb(b,a),b.prototype.subscribeCore=function(a){var b=new hc,d=new ic;return d.setDisposable(b),b.setDisposable(this._s.schedule([this.source,d,a],c)),d},b}(Tc);Mc.subscribeOn=function(a){return new bd(this,a)};var cd=function(a){function b(b,c){this._p=b,this._s=c,a.call(this)}function c(a,b){var c=b[0],d=b[1];c.onNext(d),c.onCompleted()}function d(a,b){var c=b[0],d=b[1];c.onError(d)}return Wb(b,a),b.prototype.subscribeCore=function(a){var b=new hc,e=this,f=this._p;return Ya(f)&&(f=$a(f)(),f===Za)?(a.onError(f.e),b):(f.then(function(d){b.setDisposable(e._s.schedule([a,d],c))},function(c){b.setDisposable(e._s.schedule([a,c],d))}),b)},b}(Tc),dd=Sc.fromPromise=function(a,b){return b||(b=Bc),new cd(a,b)};Mc.toPromise=function(a){if(a||(a=Qa.config.Promise),!a)throw new hb("Promise type not provided nor in Rx.config.Promise");var b=this;return new a(function(a,c){var d;b.subscribe(function(a){d=a},c,function(){a(d)})})};var ed=function(a){function b(b){this.source=b,a.call(this)}function c(a){this.o=a,this.a=[],Nc.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new c(a))},Wb(c,Nc),c.prototype.next=function(a){this.a.push(a)},c.prototype.error=function(a){this.o.onError(a)},c.prototype.completed=function(){this.o.onNext(this.a),this.o.onCompleted()},b}(Tc);Mc.toArray=function(){return new ed(this)},Sc.create=function(a,b){return new xg(a,b)};var fd=function(a){function b(b){this._f=b,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){var b=$a(this._f)();return b===Za?yd(b.e).subscribe(a):(Xa(b)&&(b=dd(b)),b.subscribe(a))},b}(Tc),gd=Sc.defer=function(a){return new fd(a)},hd=function(a){function b(b){this.scheduler=b,a.call(this)}function c(a,b){this.observer=a,this.scheduler=b}function d(a,b){return b.onCompleted(),dc}return Wb(b,a),b.prototype.subscribeCore=function(a){var b=new c(a,this.scheduler);return b.run()},c.prototype.run=function(){var a=this.observer;return this.scheduler===uc?d(null,a):this.scheduler.schedule(a,d)},b}(Tc),id=new hd(uc),jd=Sc.empty=function(a){return pc(a)||(a=uc),a===uc?id:new hd(a)},kd=function(a){function b(b,c,d){this._iterable=b,this._fn=c,this._scheduler=d,a.call(this)}function c(a,b,c){return function(d,e){var f=$a(b.next).call(b);if(f===Za)return a.onError(f.e);if(f.done)return a.onCompleted();var g=f.value;return Ya(c)&&(g=$a(c)(g,d),g===Za)?a.onError(g.e):(a.onNext(g),void e(d+1))}}return Wb(b,a),b.prototype.subscribeCore=function(a){var b=Object(this._iterable),d=E(b);return this._scheduler.scheduleRecursive(0,c(a,d,this._fn))},b}(Tc),ld=Math.pow(2,53)-1;z.prototype[kb]=function(){return new A(this._s)},A.prototype[kb]=function(){return this},A.prototype.next=function(){return this._i<this._l?{done:!1,value:this._s.charAt(this._i++)}:lb},B.prototype[kb]=function(){return new C(this._a)},C.prototype[kb]=function(){return this},C.prototype.next=function(){return this._i<this._l?{done:!1,value:this._a[this._i++]}:lb};var md=Sc.from=function(a,b,c,d){if(null==a)throw new Error("iterable cannot be null.");if(b&&!Ya(b))throw new Error("mapFn when provided must be a function");if(b)var e=ob(b,c,2);return pc(d)||(d=wc),new kd(a,e,d)},nd=function(a){function b(b,c){this._args=b,this._scheduler=c,a.call(this)}function c(a,b){var c=b.length;return function(d,e){c>d?(a.onNext(b[d]),e(d+1)):a.onCompleted()}}return Wb(b,a),b.prototype.subscribeCore=function(a){return this._scheduler.scheduleRecursive(0,c(a,this._args))},b}(Tc),od=Sc.fromArray=function(a,b){return pc(b)||(b=wc),new nd(a,b)},pd=function(a){function b(b,c,d,e,f){this._initialState=b,this._cndFn=c,this._itrFn=d,this._resFn=e,this._s=f,a.call(this)}function c(a,b){if(a.first)a.first=!1;else if(a.newState=$a(a.self._itrFn)(a.newState),a.newState===Za)return a.o.onError(a.newState.e);var c=$a(a.self._cndFn)(a.newState);if(c===Za)return a.o.onError(c.e);if(c){var d=$a(a.self._resFn)(a.newState);if(d===Za)return a.o.onError(d.e);a.o.onNext(d),b(a)}else a.o.onCompleted()}return Wb(b,a),b.prototype.subscribeCore=function(a){var b={o:a,self:this,first:!0,newState:this._initialState};return this._s.scheduleRecursive(b,c)},b}(Tc);Sc.generate=function(a,b,c,d,e){return pc(e)||(e=wc),new pd(a,b,c,d,e)},Sc.of=function(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];return new nd(b,wc)},Sc.ofWithScheduler=function(a){for(var b=arguments.length,c=new Array(b-1),d=1;b>d;d++)c[d-1]=arguments[d];return new nd(c,a)},Sc.ofArrayChanges=function(a){if(!Array.isArray(a))throw new TypeError("Array.observe only accepts arrays.");if("function"!=typeof Array.observe&&"function"!=typeof Array.unobserve)throw new TypeError("Array.observe is not supported on your platform");return new xg(function(b){function c(a){for(var c=0,d=a.length;d>c;c++)b.onNext(a[c])}return Array.observe(a,c),function(){Array.unobserve(a,c)}})},Sc.ofObjectChanges=function(a){if(null==a)throw new TypeError("object must not be null or undefined.");if("function"!=typeof Object.observe&&"function"!=typeof Object.unobserve)throw new TypeError("Object.observe is not supported on your platform");return new xg(function(b){function c(a){for(var c=0,d=a.length;d>c;c++)b.onNext(a[c])}return Object.observe(a,c),function(){Object.unobserve(a,c)}})};var qd=function(a){function b(){a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){return dc},b}(Tc),rd=new qd,sd=Sc.never=function(){return rd},td=function(a){function b(b,c){this._o=b,this._keys=Object.keys(b),this._scheduler=c,a.call(this)}function c(a,b,c){return function(d,e){if(d<c.length){var f=c[d];a.onNext([f,b[f]]),e(d+1)}else a.onCompleted()}}return Wb(b,a),b.prototype.subscribeCore=function(a){return this._scheduler.scheduleRecursive(0,c(a,this._o,this._keys))},b}(Tc);Sc.pairs=function(a,b){return b||(b=wc),new td(a,b)};var ud=function(a){function b(b,c,d){this.start=b,this.rangeCount=c,this.scheduler=d,a.call(this)}function c(a,b,c){return function(d,e){b>d?(c.onNext(a+d),e(d+1)):c.onCompleted()}}return Wb(b,a),b.prototype.subscribeCore=function(a){return this.scheduler.scheduleRecursive(0,c(this.start,this.rangeCount,a))},b}(Tc);Sc.range=function(a,b,c){return pc(c)||(c=wc),new ud(a,b,c)};var vd=function(a){function b(b,c,d){this.value=b,this.repeatCount=null==c?-1:c,this.scheduler=d,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){var b=new I(a,this);return b.run()},b}(Tc);I.prototype.run=function(){function a(a,d){return(-1===a||a>0)&&(b.onNext(c),a>0&&a--),0===a?b.onCompleted():void d(a)}var b=this.observer,c=this.parent.value;return this.parent.scheduler.scheduleRecursive(this.parent.repeatCount,a)},Sc.repeat=function(a,b,c){return pc(c)||(c=wc),new vd(a,b,c)};var wd=function(a){function b(b,c){this._value=b,this._scheduler=c,a.call(this)}function c(a,b){var c=b[0],d=b[1];return d.onNext(c),d.onCompleted(),dc}return Wb(b,a),b.prototype.subscribeCore=function(a){var b=[this._value,a];return this._scheduler===uc?c(null,b):this._scheduler.schedule(b,c)},b}(Tc),xd=(Sc["return"]=Sc.just=function(a,b){return pc(b)||(b=uc),new wd(a,b)},function(a){function b(b,c){this._error=b,this._scheduler=c,a.call(this)}function c(a,b){var c=b[0],d=b[1];return d.onError(c),dc}return Wb(b,a),b.prototype.subscribeCore=function(a){var b=[this._error,a];return this._scheduler===uc?c(null,b):this._scheduler.schedule(b,c)},b}(Tc)),yd=Sc["throw"]=function(a,b){return pc(b)||(b=uc),new xd(a,b)},zd=function(a){function b(b,c){this._resFn=b,this._obsFn=c,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){var b=dc,c=$a(this._resFn)();if(c===Za)return new jc(yd(c.e).subscribe(a),b);c&&(b=c);var d=$a(this._obsFn)(c);return d===Za?new jc(yd(d.e).subscribe(a),b):new jc(d.subscribe(a),b)},b}(Tc);Sc.using=function(a,b){return new zd(a,b)},Mc.amb=function(a){var b=this;return new xg(function(c){function d(){f||(f=g,j.dispose())}function e(){f||(f=h,i.dispose())}var f,g="L",h="R",i=new hc,j=new hc;Xa(a)&&(a=dd(a));var k=Lc(function(a){d(),f===g&&c.onNext(a)},function(a){d(),f===g&&c.onError(a)},function(){d(),f===g&&c.onCompleted()}),l=Lc(function(a){e(),f===h&&c.onNext(a)},function(a){e(),f===h&&c.onError(a)},function(){e(),f===h&&c.onCompleted()});return i.setDisposable(b.subscribe(k)),j.setDisposable(a.subscribe(l)),new jc(i,j)})},Sc.amb=function(){var a,b=sd();if(Array.isArray(arguments[0]))a=arguments[0];else{var c=arguments.length;a=new Array(a);for(var d=0;c>d;d++)a[d]=arguments[d]}for(var d=0,c=a.length;c>d;d++)b=J(b,a[d]);return b};var Ad=function(a){function b(b,c){this.source=b,this._fn=c,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){var b=new hc,c=new ic;return c.setDisposable(b),b.setDisposable(this.source.subscribe(new Bd(a,c,this._fn))),c},b}(Tc),Bd=function(a){function b(b,c,d){this._o=b,this._s=c,this._fn=d,a.call(this)}return Wb(b,a),b.prototype.next=function(a){this._o.onNext(a)},b.prototype.completed=function(){return this._o.onCompleted()},b.prototype.error=function(a){var b=$a(this._fn)(a);if(b===Za)return this._o.onError(b.e);Xa(b)&&(b=dd(b));var c=new hc;this._s.setDisposable(c),c.setDisposable(b.subscribe(this._o))},b}(Nc);Mc["catch"]=function(a){return Ya(a)?new Ad(this,a):Cd([this,a])};var Cd=Sc["catch"]=function(){var a;if(Array.isArray(arguments[0]))a=arguments[0];else{var b=arguments.length;a=new Array(b);for(var c=0;b>c;c++)a[c]=arguments[c]}return _c(a).catchError()};Mc.combineLatest=function(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];return Array.isArray(b[0])?b[0].unshift(this):b.unshift(this),Fd.apply(this,b)};var Dd=function(a){function b(b,c){this._params=b,this._cb=c,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){for(var b=this._params.length,c=new Array(b),d={hasValue:u(b,K),hasValueAll:!1,isDone:u(b,K),values:new Array(b)},e=0;b>e;e++){var f=this._params[e],g=new hc;c[e]=g,Xa(f)&&(f=dd(f)),g.setDisposable(f.subscribe(new Ed(a,e,this._cb,d)))}return new kc(c)},b}(Tc),Ed=function(a){function b(b,c,d,e){this._o=b,this._i=c,this._cb=d,this._state=e,a.call(this)}function c(a){return function(b,c){return c!==a}}return Wb(b,a),b.prototype.next=function(a){if(this._state.values[this._i]=a,this._state.hasValue[this._i]=!0,this._state.hasValueAll||(this._state.hasValueAll=this._state.hasValue.every(Sa))){var b=$a(this._cb).apply(null,this._state.values);if(b===Za)return this._o.onError(b.e);this._o.onNext(b)}else this._state.isDone.filter(c(this._i)).every(Sa)&&this._o.onCompleted()},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._state.isDone[this._i]=!0,this._state.isDone.every(Sa)&&this._o.onCompleted()},b}(Nc),Fd=Sc.combineLatest=function(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];var d=Ya(b[a-1])?b.pop():L;return Array.isArray(b[0])&&(b=b[0]),new Dd(b,d)};Mc.concat=function(){for(var a=[],b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);return a.unshift(this),Id.apply(null,a)};var Gd=function(a){function b(b,c){this._s=b,this._fn=c,a.call(this)}return Wb(b,a),b.prototype.next=function(a){this._s.o.onNext(a)},b.prototype.error=function(a){this._s.o.onError(a)},b.prototype.completed=function(){this._s.i++,this._fn(this._s)},b}(Nc),Hd=function(a){function b(b){this._sources=b,a.call(this)}function c(a,b){if(!a.disposable.isDisposed){if(a.i===a.sources.length)return a.o.onCompleted();var c=a.sources[a.i];Xa(c)&&(c=dd(c));var d=new hc;a.subscription.setDisposable(d),d.setDisposable(c.subscribe(new Gd(a,b)))}}return Wb(b,a),b.prototype.subscribeCore=function(a){var b=new ic,d=cc(Ra),e={o:a,i:0,subscription:b,disposable:d,sources:this._sources},f=uc.scheduleRecursive(e,c);return new kc([b,d,f])},b}(Tc),Id=Sc.concat=function(){var a;if(Array.isArray(arguments[0]))a=arguments[0];else{a=new Array(arguments.length);for(var b=0,c=arguments.length;c>b;b++)a[b]=arguments[b]}return new Hd(a)};Mc.concatAll=function(){return this.merge(1)};var Jd=function(a){function b(b,c){this.source=b,this.maxConcurrent=c,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){var b=new _b;return b.add(this.source.subscribe(new Kd(a,this.maxConcurrent,b))),b},b}(Tc),Kd=function(a){function b(b,c,d){this.o=b,this.max=c,this.g=d,this.done=!1,this.q=[],this.activeCount=0,a.call(this)}function c(b,c){this.parent=b,this.sad=c,a.call(this)}return Wb(b,a),b.prototype.handleSubscribe=function(a){var b=new hc;this.g.add(b),Xa(a)&&(a=dd(a)),b.setDisposable(a.subscribe(new c(this,b)))},b.prototype.next=function(a){this.activeCount<this.max?(this.activeCount++,this.handleSubscribe(a)):this.q.push(a)},b.prototype.error=function(a){this.o.onError(a)},b.prototype.completed=function(){this.done=!0,0===this.activeCount&&this.o.onCompleted()},Wb(c,a),c.prototype.next=function(a){this.parent.o.onNext(a)},c.prototype.error=function(a){this.parent.o.onError(a)},c.prototype.completed=function(){this.parent.g.remove(this.sad),this.parent.q.length>0?this.parent.handleSubscribe(this.parent.q.shift()):(this.parent.activeCount--,this.parent.done&&0===this.parent.activeCount&&this.parent.o.onCompleted())},b}(Nc);Mc.merge=function(a){return"number"!=typeof a?Ld(this,a):new Jd(this,a)};var Ld=Sc.merge=function(){var a,b,c=[],d=arguments.length;if(arguments[0])if(pc(arguments[0]))for(a=arguments[0],b=1;d>b;b++)c.push(arguments[b]);else for(a=uc,b=0;d>b;b++)c.push(arguments[b]);else for(a=uc,b=1;d>b;b++)c.push(arguments[b]);return Array.isArray(c[0])&&(c=c[0]),H(a,c).mergeAll()},Md=function(a){function b(b){this.source=b,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){var b=new _b,c=new hc;return b.add(c),c.setDisposable(this.source.subscribe(new Nd(a,b))),b},b}(Tc),Nd=function(a){function b(b,c){this.o=b,this.g=c,this.done=!1,a.call(this)}function c(b,c){this.parent=b,this.sad=c,a.call(this)}return Wb(b,a),b.prototype.next=function(a){var b=new hc;this.g.add(b),Xa(a)&&(a=dd(a)),b.setDisposable(a.subscribe(new c(this,b)))},b.prototype.error=function(a){this.o.onError(a)},b.prototype.completed=function(){this.done=!0,1===this.g.length&&this.o.onCompleted()},Wb(c,a),c.prototype.next=function(a){this.parent.o.onNext(a)},c.prototype.error=function(a){this.parent.o.onError(a)},c.prototype.completed=function(){this.parent.g.remove(this.sad),this.parent.done&&1===this.parent.g.length&&this.parent.o.onCompleted()},b}(Nc);Mc.mergeAll=function(){return new Md(this)};var Od=Qa.CompositeError=function(a){this.innerErrors=a,this.message="This contains multiple errors. Check the innerErrors",Error.call(this)};Od.prototype=Object.create(Error.prototype),Od.prototype.name="CompositeError";var Pd=function(a){function b(b){this.source=b,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){var b=new _b,c=new hc,d={isStopped:!1,errors:[],o:a};return b.add(c),c.setDisposable(this.source.subscribe(new Qd(b,d))),b},b}(Tc),Qd=function(a){function b(b,c){this._group=b,this._state=c,a.call(this)}function c(a,b){0===b.length?a.onCompleted():1===b.length?a.onError(b[0]):a.onError(new Od(b))}function d(b,c,d){this._inner=b,this._group=c,this._state=d,a.call(this)}return Wb(b,a),b.prototype.next=function(a){var b=new hc;this._group.add(b),Xa(a)&&(a=dd(a)),b.setDisposable(a.subscribe(new d(b,this._group,this._state)))},b.prototype.error=function(a){this._state.errors.push(a),this._state.isStopped=!0,1===this._group.length&&c(this._state.o,this._state.errors)},b.prototype.completed=function(){this._state.isStopped=!0,1===this._group.length&&c(this._state.o,this._state.errors)},Wb(d,a),d.prototype.next=function(a){this._state.o.onNext(a)},d.prototype.error=function(a){this._state.errors.push(a),this._group.remove(this._inner),this._state.isStopped&&1===this._group.length&&c(this._state.o,this._state.errors)},d.prototype.completed=function(){this._group.remove(this._inner),this._state.isStopped&&1===this._group.length&&c(this._state.o,this._state.errors)},b}(Nc);Sc.mergeDelayError=function(){var a;if(Array.isArray(arguments[0]))a=arguments[0];else{var b=arguments.length;a=new Array(b);for(var c=0;b>c;c++)a[c]=arguments[c]}var d=H(null,a);return new Pd(d)},Mc.onErrorResumeNext=function(a){if(!a)throw new Error("Second observable is required");return Td([this,a])};var Rd=function(a){function b(b){this.sources=b,a.call(this)}function c(a,b){if(a.pos<a.sources.length){var c=a.sources[a.pos++];Xa(c)&&(c=dd(c));var d=new hc;a.subscription.setDisposable(d),d.setDisposable(c.subscribe(new Sd(a,b)))}else a.o.onCompleted()}return Wb(b,a),b.prototype.subscribeCore=function(a){var b=new ic,d={pos:0,subscription:b,o:a,sources:this.sources},e=uc.scheduleRecursive(d,c);return new jc(b,e)},b}(Tc),Sd=function(a){function b(b,c){this._state=b,this._recurse=c,a.call(this)}return Wb(b,a),b.prototype.next=function(a){this._state.o.onNext(a)},b.prototype.error=function(){this._recurse(this._state)},b.prototype.completed=function(){this._recurse(this._state)},b}(Nc),Td=Sc.onErrorResumeNext=function(){var a=[];if(Array.isArray(arguments[0]))a=arguments[0];else{var b=arguments.length;a=new Array(b);for(var c=0;b>c;c++)a[c]=arguments[c]}return new Rd(a)},Ud=function(a){function b(b,c){this._s=b,this._o=Xa(c)?dd(c):c,this._open=!1,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){var b=new hc;b.setDisposable(this._s.subscribe(new Vd(a,this))),Xa(this._o)&&(this._o=dd(this._o));var c=new hc;return c.setDisposable(this._o.subscribe(new Wd(a,this,c))),new jc(b,c)},b}(Tc),Vd=function(a){function b(b,c){this._o=b,this._p=c,a.call(this)}return Wb(b,a),b.prototype.next=function(a){this._p._open&&this._o.onNext(a)},b.prototype.error=function(a){this._o.onError(a)},b.prototype.onCompleted=function(){this._p._open&&this._o.onCompleted()},b}(Nc),Wd=function(a){function b(b,c,d){this._o=b,this._p=c,this._r=d,a.call(this)}return Wb(b,a),b.prototype.next=function(){this._p._open=!0,this._r.dispose()},b.prototype.error=function(a){this._o.onError(a)},b.prototype.onCompleted=function(){this._r.dispose()},b}(Nc);Mc.skipUntil=function(a){return new Ud(this,a)};var Xd=function(a){function b(b){this.source=b,a.call(this)}function c(a,b){this.o=a,this.inner=b,this.stopped=!1,this.latest=0,this.hasLatest=!1,Nc.call(this)}function d(a,b){this.parent=a,this.id=b,Nc.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){var b=new ic,d=this.source.subscribe(new c(a,b));return new jc(d,b)},Wb(c,Nc),c.prototype.next=function(a){var b=new hc,c=++this.latest;this.hasLatest=!0,this.inner.setDisposable(b),Xa(a)&&(a=dd(a)),b.setDisposable(a.subscribe(new d(this,c)))},c.prototype.error=function(a){this.o.onError(a)},c.prototype.completed=function(){this.stopped=!0,!this.hasLatest&&this.o.onCompleted()},Wb(d,Nc),d.prototype.next=function(a){this.parent.latest===this.id&&this.parent.o.onNext(a)},d.prototype.error=function(a){this.parent.latest===this.id&&this.parent.o.onError(a)},d.prototype.completed=function(){this.parent.latest===this.id&&(this.parent.hasLatest=!1,this.parent.stopped&&this.parent.o.onCompleted())},b}(Tc);Mc["switch"]=Mc.switchLatest=function(){return new Xd(this)};var Yd=function(a){function b(b,c){this.source=b,this.other=Xa(c)?dd(c):c,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){return new jc(this.source.subscribe(a),this.other.subscribe(new Zd(a)))},b}(Tc),Zd=function(a){function b(b){this._o=b,a.call(this)}return Wb(b,a),b.prototype.next=function(){this._o.onCompleted()},b.prototype.error=function(a){this._o.onError(a)},b.prototype.onCompleted=Ra,b}(Nc);Mc.takeUntil=function(a){return new Yd(this,a)};var $d=function(a){function b(b,c,d){this._s=b,this._ss=c,this._cb=d,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){for(var b=this._ss.length,c={hasValue:u(b,K),hasValueAll:!1,values:new Array(b)},d=this._ss.length,e=new Array(d+1),f=0;d>f;f++){var g=this._ss[f],h=new hc;Xa(g)&&(g=dd(g)),h.setDisposable(g.subscribe(new _d(a,f,c))),e[f]=h}var i=new hc;return i.setDisposable(this._s.subscribe(new ae(a,this._cb,c))),e[d]=i,new kc(e)},b}(Tc),_d=function(a){function b(b,c,d){this._o=b,this._i=c,this._state=d,a.call(this)}return Wb(b,a),b.prototype.next=function(a){this._state.values[this._i]=a,this._state.hasValue[this._i]=!0,this._state.hasValueAll=this._state.hasValue.every(Sa)},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=Ra,b}(Nc),ae=function(a){function b(b,c,d){this._o=b,this._cb=c,this._state=d,a.call(this)}return Wb(b,a),b.prototype.next=function(a){var b=[a].concat(this._state.values);if(this._state.hasValueAll){var c=$a(this._cb).apply(null,b);return c===Za?this._o.onError(c.e):void this._o.onNext(c)}},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onCompleted()},b}(Nc);Mc.withLatestFrom=function(){if(0===arguments.length)throw new Error("invalid arguments");for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];var d=Ya(b[a-1])?b.pop():L;return Array.isArray(b[0])&&(b=b[0]),new $d(this,b,d)};var be=function(a){function b(b,c){this._s=b,this._cb=c,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){for(var b=this._s.length,c=new Array(b),d=u(b,K),e=u(b,M),f=0;b>f;f++){var g=this._s[f],h=new hc;c[f]=h,Xa(g)&&(g=dd(g)),h.setDisposable(g.subscribe(new ce(a,f,this,e,d)))}return new kc(c)},b}(Tc),ce=function(a){function b(b,c,d,e,f){this._o=b,this._i=c,this._p=d,this._q=e,this._d=f,a.call(this)}function c(a){return a.length>0}function d(a){return a.shift()}function e(a){return function(b,c){return c!==a}}return Wb(b,a),b.prototype.next=function(a){if(this._q[this._i].push(a),this._q.every(c)){var b=this._q.map(d),f=$a(this._p._cb).apply(null,b);if(f===Za)return this._o.onError(f.e);this._o.onNext(f)}else this._d.filter(e(this._i)).every(Sa)&&this._o.onCompleted()},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._d[this._i]=!0,this._d.every(Sa)&&this._o.onCompleted()},b}(Nc);Mc.zip=function(){if(0===arguments.length)throw new Error("invalid arguments");for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];var d=Ya(b[a-1])?b.pop():L;Array.isArray(b[0])&&(b=b[0]);var e=this;return b.unshift(e),new be(b,d)},Sc.zip=function(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];Array.isArray(b[0])&&(b=Ya(b[1])?b[0].concat(b[1]):b[0]);var d=b.shift();return d.zip.apply(d,b)};var de=function(a){function b(b,c){this.sources=b,this._cb=c,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){for(var b=this.sources,c=b.length,d=new Array(c),e={q:u(c,M),done:u(c,K),cb:this._cb,o:a},f=0;c>f;f++)!function(a){var c=b[a],f=new hc;(nb(c)||mb(c))&&(c=md(c)),d[a]=f,f.setDisposable(c.subscribe(new ee(e,a)))}(f);return new kc(d)},b}(Tc),ee=function(a){function b(b,c){this._s=b,this._i=c,a.call(this)}function c(a){return a.length>0}function d(a){return a.shift()}function e(a){return function(b,c){return c!==a}}return Wb(b,a),b.prototype.next=function(a){if(this._s.q[this._i].push(a),this._s.q.every(c)){var b=this._s.q.map(d),f=$a(this._s.cb).apply(null,b);if(f===Za)return this._s.o.onError(f.e);this._s.o.onNext(f)}else this._s.done.filter(e(this._i)).every(Sa)&&this._s.o.onCompleted()},b.prototype.error=function(a){this._s.o.onError(a)},b.prototype.completed=function(){this._s.done[this._i]=!0,this._s.done.every(Sa)&&this._s.o.onCompleted()},b}(Nc);Mc.zipIterable=function(){if(0===arguments.length)throw new Error("invalid arguments");for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];var d=Ya(b[a-1])?b.pop():L,e=this;return b.unshift(e),new de(b,d)},Mc.asObservable=function(){return new xg(N(this),this)},Mc.bufferWithCount=Mc.bufferCount=function(a,b){return"number"!=typeof b&&(b=a),this.windowWithCount(a,b).flatMap(O).filter(P)};var fe=function(a){function b(b){this.source=b,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new ge(a))},b}(Tc),ge=function(a){function b(b){this._o=b,a.call(this)}return Wb(b,a),b.prototype.next=function(a){a.accept(this._o)},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onCompleted()},b}(Nc);Mc.dematerialize=function(){return new fe(this)};var he=function(a){function b(b,c,d){this.source=b,this.keyFn=c,this.comparer=d,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){ return this.source.subscribe(new ie(a,this.keyFn,this.comparer))},b}(Tc),ie=function(a){function b(b,c,d){this.o=b,this.keyFn=c,this.comparer=d,this.hasCurrentKey=!1,this.currentKey=null,a.call(this)}return Wb(b,a),b.prototype.next=function(a){var b,c=a;return Ya(this.keyFn)&&(c=$a(this.keyFn)(a),c===Za)?this.o.onError(c.e):this.hasCurrentKey&&(b=$a(this.comparer)(this.currentKey,c),b===Za)?this.o.onError(b.e):void(this.hasCurrentKey&&b||(this.hasCurrentKey=!0,this.currentKey=c,this.o.onNext(a)))},b.prototype.error=function(a){this.o.onError(a)},b.prototype.completed=function(){this.o.onCompleted()},b}(Nc);Mc.distinctUntilChanged=function(a,b){return b||(b=Ua),new he(this,a,b)};var je=function(a){function b(b,c,d,e){this.source=b,this._oN=c,this._oE=d,this._oC=e,a.call(this)}function c(a,b){this.o=a,this.t=!b._oN||Ya(b._oN)?Lc(b._oN||Ra,b._oE||Ra,b._oC||Ra):b._oN,this.isStopped=!1,Nc.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new c(a,this))},Wb(c,Nc),c.prototype.next=function(a){var b=$a(this.t.onNext).call(this.t,a);b===Za&&this.o.onError(b.e),this.o.onNext(a)},c.prototype.error=function(a){var b=$a(this.t.onError).call(this.t,a);return b===Za?this.o.onError(b.e):void this.o.onError(a)},c.prototype.completed=function(){var a=$a(this.t.onCompleted).call(this.t);return a===Za?this.o.onError(a.e):void this.o.onCompleted()},b}(Tc);Mc["do"]=Mc.tap=Mc.doAction=function(a,b,c){return new je(this,a,b,c)},Mc.doOnNext=Mc.tapOnNext=function(a,b){return this.tap("undefined"!=typeof b?function(c){a.call(b,c)}:a)},Mc.doOnError=Mc.tapOnError=function(a,b){return this.tap(Ra,"undefined"!=typeof b?function(c){a.call(b,c)}:a)},Mc.doOnCompleted=Mc.tapOnCompleted=function(a,b){return this.tap(Ra,null,"undefined"!=typeof b?function(){a.call(b)}:a)};var ke=function(a){function b(b,c,d){this.source=b,this._fn=ob(c,d,0),a.call(this)}function c(a,b){this.isDisposed=!1,this._s=a,this._fn=b}return Wb(b,a),b.prototype.subscribeCore=function(a){var b=$a(this.source.subscribe).call(this.source,a);return b===Za&&(this._fn(),e(b.e)),new c(b,this._fn)},c.prototype.dispose=function(){if(!this.isDisposed){var a=$a(this._s.dispose).call(this._s);this._fn(),a===Za&&e(a.e)}},b}(Tc);Mc["finally"]=function(a,b){return new ke(this,a,b)};var le=function(a){function b(b){this.source=b,a.call(this)}function c(a){this.o=a,this.isStopped=!1}return Wb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new c(a))},c.prototype.onNext=Ra,c.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.o.onError(a))},c.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.o.onCompleted())},c.prototype.dispose=function(){this.isStopped=!0},c.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.observer.onError(a),!0)},b}(Tc);Mc.ignoreElements=function(){return new le(this)};var me=function(a){function b(b,c){this.source=b,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new ne(a))},b}(Tc),ne=function(a){function b(b){this._o=b,a.call(this)}return Wb(b,a),b.prototype.next=function(a){this._o.onNext(Hc(a))},b.prototype.error=function(a){this._o.onNext(Ic(a)),this._o.onCompleted()},b.prototype.completed=function(){this._o.onNext(Jc()),this._o.onCompleted()},b}(Nc);Mc.materialize=function(){return new me(this)},Mc.repeat=function(a){return Zc(this,a).concat()},Mc.retry=function(a){return Zc(this,a).catchError()};var oe=function(a){function b(a){return{isDisposed:!1,dispose:function(){this.isDisposed||(this.isDisposed=!0,a.isDisposed=!0)}}}function c(b,c){this.source=b,this._notifier=c,a.call(this)}return Wb(c,a),c.prototype.subscribeCore=function(a){var c,d=new Bg,e=new Bg,f=this._notifier(d),g=f.subscribe(e),h=this.source["@@iterator"](),i={isDisposed:!1},j=new ic,k=wc.scheduleRecursive(null,function(b,f){if(!i.isDisposed){var g=h.next();if(g.done)return void(c?a.onError(c):a.onCompleted());var k=g.value;Xa(k)&&(k=dd(k));var l=new hc,m=new hc;j.setDisposable(new jc(m,l)),l.setDisposable(k.subscribe(function(b){a.onNext(b)},function(b){m.setDisposable(e.subscribe(f,function(b){a.onError(b)},function(){a.onCompleted()})),d.onNext(b),l.dispose()},function(){a.onCompleted()}))}});return new kc([g,j,k,b(i)])},c}(Tc);Mc.retryWhen=function(a){return new oe(Q(this),a)};var pe=function(a){function b(a){return{isDisposed:!1,dispose:function(){this.isDisposed||(this.isDisposed=!0,a.isDisposed=!0)}}}function c(b,c){this.source=b,this._notifier=c,a.call(this)}return Wb(c,a),c.prototype.subscribeCore=function(a){var c,d=new Bg,e=new Bg,f=this._notifier(d),g=f.subscribe(e),h=this.source["@@iterator"](),i={isDisposed:!1},j=new ic,k=wc.scheduleRecursive(null,function(b,f){if(!i.isDisposed){var g=h.next();if(g.done)return void(c?a.onError(c):a.onCompleted());var k=g.value;Xa(k)&&(k=dd(k));var l=new hc,m=new hc;j.setDisposable(new jc(m,l)),l.setDisposable(k.subscribe(function(b){a.onNext(b)},function(b){a.onError(b)},function(){m.setDisposable(e.subscribe(f,function(b){a.onError(b)},function(){a.onCompleted()})),d.onNext(null),l.dispose()}))}});return new kc([g,j,k,b(i)])},c}(Tc);Mc.repeatWhen=function(a){return new pe(Q(this),a)};var qe=function(a){function b(b,c,d,e){this.source=b,this.accumulator=c,this.hasSeed=d,this.seed=e,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new re(a,this))},b}(Tc),re=function(a){function b(b,c){this._o=b,this._p=c,this._fn=c.accumulator,this._hs=c.hasSeed,this._s=c.seed,this._ha=!1,this._a=null,this._hv=!1,this._i=0,a.call(this)}return Wb(b,a),b.prototype.next=function(a){return!this._hv&&(this._hv=!0),this._ha?this._a=$a(this._fn)(this._a,a,this._i,this._p):(this._a=this._hs?$a(this._fn)(this._s,a,this._i,this._p):a,this._ha=!0),this._a===Za?this._o.onError(this._a.e):(this._o.onNext(this._a),void this._i++)},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){!this._hv&&this._hs&&this._o.onNext(this._s),this._o.onCompleted()},b}(Nc);Mc.scan=function(){var a,b=!1,c=arguments[0];return 2===arguments.length&&(b=!0,a=arguments[1]),new qe(this,c,b,a)};var se=function(a){function b(b,c){this.source=b,this._c=c,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new te(a,this._c))},b}(Tc),te=function(a){function b(b,c){this._o=b,this._c=c,this._q=[],a.call(this)}return Wb(b,a),b.prototype.next=function(a){this._q.push(a),this._q.length>this._c&&this._o.onNext(this._q.shift())},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onCompleted()},b}(Nc);Mc.skipLast=function(a){if(0>a)throw new gb;return new se(this,a)},Mc.startWith=function(){var a,b=0;arguments.length&&pc(arguments[0])?(a=arguments[0],b=1):a=uc;for(var c=[],d=b,e=arguments.length;e>d;d++)c.push(arguments[d]);return Id.apply(null,[od(c,a),this])};var ue=function(a){function b(b,c){this._o=b,this._c=c,this._q=[],a.call(this)}return Wb(b,a),b.prototype.next=function(a){this._q.push(a),this._q.length>this._c&&this._q.shift()},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){for(;this._q.length>0;)this._o.onNext(this._q.shift());this._o.onCompleted()},b}(Nc);Mc.takeLast=function(a){if(0>a)throw new gb;var b=this;return new xg(function(c){return b.subscribe(new ue(c,a))},b)};var ve=function(a){function b(b,c){this._o=b,this._c=c,this._q=[],a.call(this)}return Wb(b,a),b.prototype.next=function(a){this._q.push(a),this._q.length>this._c&&this._q.shift()},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onNext(this._q),this._o.onCompleted()},b}(Nc);Mc.takeLastBuffer=function(a){if(0>a)throw new gb;var b=this;return new xg(function(c){return b.subscribe(new ve(c,a))},b)},Mc.windowWithCount=Mc.windowCount=function(a,b){var c=this;if(+a||(a=0),Math.abs(a)===1/0&&(a=0),0>=a)throw new gb;if(null==b&&(b=a),+b||(b=0),Math.abs(b)===1/0&&(b=0),0>=b)throw new gb;return new xg(function(d){function e(){var a=new Bg;i.push(a),d.onNext(Yb(a,g))}var f=new hc,g=new lc(f),h=0,i=[];return e(),f.setDisposable(c.subscribe(function(c){for(var d=0,f=i.length;f>d;d++)i[d].onNext(c);var g=h-a+1;g>=0&&g%b===0&&i.shift().onCompleted(),++h%b===0&&e()},function(a){for(;i.length>0;)i.shift().onError(a);d.onError(a)},function(){for(;i.length>0;)i.shift().onCompleted();d.onCompleted()})),g},c)},Mc.selectConcat=Mc.concatMap=function(a,b,c){return Ya(a)&&Ya(b)?this.concatMap(function(c,d){var e=a(c,d);return Xa(e)&&(e=dd(e)),(nb(e)||mb(e))&&(e=md(e)),e.map(function(a,e){return b(c,a,d,e)})}):Ya(a)?R(this,a,c):R(this,function(){return a})},Mc.concatMapObserver=Mc.selectConcatObserver=function(a,b,c,d){var e=this,f=ob(a,d,2),g=ob(b,d,1),h=ob(c,d,0);return new xg(function(a){var b=0;return e.subscribe(function(c){var d;try{d=f(c,b++)}catch(e){return void a.onError(e)}Xa(d)&&(d=dd(d)),a.onNext(d)},function(b){var c;try{c=g(b)}catch(d){return void a.onError(d)}Xa(c)&&(c=dd(c)),a.onNext(c),a.onCompleted()},function(){var b;try{b=h()}catch(c){return void a.onError(c)}Xa(b)&&(b=dd(b)),a.onNext(b),a.onCompleted()})},this).concatAll()};var we=function(a){function b(b,c){this._o=b,this._d=c,this._f=!1,a.call(this)}return Wb(b,a),b.prototype.next=function(a){this._f=!0,this._o.onNext(a)},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){!this._f&&this._o.onNext(this._d),this._o.onCompleted()},b}(Nc);Mc.defaultIfEmpty=function(b){var c=this;return b===a&&(b=null),new xg(function(a){return c.subscribe(new we(a,b))},c)},T.prototype.push=function(a){var b=-1===S(this.set,a,this.comparer);return b&&this.set.push(a),b};var xe=function(a){function b(b,c,d){this.source=b,this._keyFn=c,this._cmpFn=d,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new ye(a,this._keyFn,this._cmpFn))},b}(Tc),ye=function(a){function b(b,c,d){this._o=b,this._keyFn=c,this._h=new T(d),a.call(this)}return Wb(b,a),b.prototype.next=function(a){var b=a;return Ya(this._keyFn)&&(b=$a(this._keyFn)(a),b===Za)?this._o.onError(b.e):void(this._h.push(b)&&this._o.onNext(a))},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onCompleted()},b}(Nc);Mc.distinct=function(a,b){return b||(b=Ua),new xe(this,a,b)},Mc.groupBy=function(a,b){return this.groupByUntil(a,b,sd)},Mc.groupByUntil=function(b,c,d){var e=this;return new xg(function(f){var g=new Of,h=new _b,i=new lc(h),j=function(a){return function(b){b.onError(a)}};return h.add(e.subscribe(function(e){var k=$a(b)(e);if(k===Za)return g.forEach(j(k.e)),f.onError(k.e);var l=!1,m=g.get(k);if(m===a&&(m=new Bg,g.set(k,m),l=!0),l){var n=new Ag(k,m,i),o=new Ag(k,m),p=$a(d)(o);if(p===Za)return g.forEach(j(p.e)),f.onError(p.e);f.onNext(n);var q=new hc;h.add(q),q.setDisposable(p.take(1).subscribe(Ra,function(a){g.forEach(j(a)),f.onError(a)},function(){g["delete"](k)&&m.onCompleted(),h.remove(q)}))}var r=e;return Ya(c)&&(r=$a(c)(e),r===Za)?(g.forEach(j(r.e)),f.onError(r.e)):void m.onNext(r)},function(a){g.forEach(j(a)),f.onError(a)},function(){g.forEach(function(a){a.onCompleted()}),f.onCompleted()})),i},e)};var ze=function(a){function b(b,c,d){this.source=b,this.selector=ob(c,d,3),a.call(this)}function c(a,b){return function(c,d,e){return a.call(this,b.selector(c,d,e),d,e)}}function d(a,b,c){this.o=a,this.selector=b,this.source=c,this.i=0,Nc.call(this)}return Wb(b,a),b.prototype.internalMap=function(a,d){return new b(this.source,c(a,this),d)},b.prototype.subscribeCore=function(a){return this.source.subscribe(new d(a,this.selector,this))},Wb(d,Nc),d.prototype.next=function(a){var b=$a(this.selector)(a,this.i++,this.source);return b===Za?this.o.onError(b.e):void this.o.onNext(b)},d.prototype.error=function(a){this.o.onError(a)},d.prototype.completed=function(){this.o.onCompleted()},b}(Tc);Mc.map=Mc.select=function(a,b){var c="function"==typeof a?a:function(){return a};return this instanceof ze?this.internalMap(c,b):new ze(this,c,b)},Mc.pluck=function(){var a=arguments.length,b=new Array(a);if(0===a)throw new Error("List of properties cannot be empty.");for(var c=0;a>c;c++)b[c]=arguments[c];return this.map(U(b,a))},Mc.flatMap=Mc.selectMany=Mc.mergeMap=function(a,b,c){return new Uc(this,a,b,c).mergeAll()},Mc.flatMapObserver=Mc.selectManyObserver=function(a,b,c,d){var e=this;return new xg(function(f){var g=0;return e.subscribe(function(b){var c;try{c=a.call(d,b,g++)}catch(e){return void f.onError(e)}Xa(c)&&(c=dd(c)),f.onNext(c)},function(a){var c;try{c=b.call(d,a)}catch(e){return void f.onError(e)}Xa(c)&&(c=dd(c)),f.onNext(c),f.onCompleted()},function(){var a;try{a=c.call(d)}catch(b){return void f.onError(b)}Xa(a)&&(a=dd(a)),f.onNext(a),f.onCompleted()})},e).mergeAll()},Mc.flatMapLatest=Mc.switchMap=function(a,b,c){return new Uc(this,a,b,c).switchLatest()};var Ae=function(a){function b(b,c){this.source=b,this._count=c,a.call(this)}function c(a,b){this._o=a,this._r=b,Nc.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new c(a,this._count))},Wb(c,Nc),c.prototype.next=function(a){this._r<=0?this._o.onNext(a):this._r--},c.prototype.error=function(a){this._o.onError(a)},c.prototype.completed=function(){this._o.onCompleted()},b}(Tc);Mc.skip=function(a){if(0>a)throw new gb;return new Ae(this,a)};var Be=function(a){function b(b,c){this.source=b,this._fn=c,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new Ce(a,this))},b}(Tc),Ce=function(a){function b(b,c){this._o=b,this._p=c,this._i=0,this._r=!1,a.call(this)}return Wb(b,a),b.prototype.next=function(a){if(!this._r){var b=$a(this._p._fn)(a,this._i++,this._p);if(b===Za)return this._o.onError(b.e);this._r=!b}this._r&&this._o.onNext(a)},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onCompleted()},b}(Nc);Mc.skipWhile=function(a,b){var c=ob(a,b,3);return new Be(this,c)};var De=function(a){function b(b,c){this.source=b,this._count=c,a.call(this)}function c(a,b){this._o=a,this._c=b,this._r=b,Nc.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new c(a,this._count))},Wb(c,Nc),c.prototype.next=function(a){this._r-->0&&(this._o.onNext(a),this._r<=0&&this._o.onCompleted())},c.prototype.error=function(a){this._o.onError(a)},c.prototype.completed=function(){this._o.onCompleted()},b}(Tc);Mc.take=function(a,b){if(0>a)throw new gb;return 0===a?jd(b):new De(this,a)};var Ee=function(a){function b(b,c){this.source=b,this._fn=c,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new Fe(a,this))},b}(Tc),Fe=function(a){function b(b,c){this._o=b,this._p=c,this._i=0,this._r=!0,a.call(this)}return Wb(b,a),b.prototype.next=function(a){return this._r&&(this._r=$a(this._p._fn)(a,this._i++,this._p),this._r===Za)?this._o.onError(this._r.e):void(this._r?this._o.onNext(a):this._o.onCompleted())},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onCompleted()},b}(Nc);Mc.takeWhile=function(a,b){var c=ob(a,b,3);return new Ee(this,c)};var Ge=function(a){function b(b,c,d){this.source=b,this.predicate=ob(c,d,3),a.call(this)}function c(a,b){return function(c,d,e){return b.predicate(c,d,e)&&a.call(this,c,d,e)}}function d(a,b,c){this.o=a,this.predicate=b,this.source=c,this.i=0,Nc.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new d(a,this.predicate,this))},b.prototype.internalFilter=function(a,d){return new b(this.source,c(a,this),d)},Wb(d,Nc),d.prototype.next=function(a){var b=$a(this.predicate)(a,this.i++,this.source);return b===Za?this.o.onError(b.e):void(b&&this.o.onNext(a))},d.prototype.error=function(a){this.o.onError(a)},d.prototype.completed=function(){this.o.onCompleted()},b}(Tc);Mc.filter=Mc.where=function(a,b){return this instanceof Ge?this.internalFilter(a,b):new Ge(this,a,b)};var He=function(a){function b(b,c,d){this.source=b,this._k=c,this._c=d,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new Ie(a,this._k,this._c))},b}(Tc),Ie=function(a){function b(b,c,d){this._o=b,this._k=c,this._c=d,this._v=null,this._hv=!1,this._l=[],a.call(this)}return Wb(b,a),b.prototype.next=function(a){var b=$a(this._k)(a);if(b===Za)return this._o.onError(b.e);var c=0;if(this._hv){if(c=$a(this._c)(b,this._v),c===Za)return this._o.onError(c.e)}else this._hv=!0,this._v=b;c>0&&(this._v=b,this._l=[]),c>=0&&this._l.push(a)},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onNext(this._l),this._o.onCompleted()},b}(Nc),Je=function(a){function b(b,c,d,e){this.source=b,this.accumulator=c,this.hasSeed=d,this.seed=e,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new Ke(a,this))},b}(Tc),Ke=function(a){function b(b,c){this._o=b,this._p=c,this._fn=c.accumulator,this._hs=c.hasSeed,this._s=c.seed,this._ha=!1,this._a=null,this._hv=!1,this._i=0,a.call(this)}return Wb(b,a),b.prototype.next=function(a){return!this._hv&&(this._hv=!0),this._ha?this._a=$a(this._fn)(this._a,a,this._i,this._p):(this._a=this._hs?$a(this._fn)(this._s,a,this._i,this._p):a,this._ha=!0),this._a===Za?this._o.onError(this._a.e):void this._i++},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._hv&&this._o.onNext(this._a),!this._hv&&this._hs&&this._o.onNext(this._s),!this._hv&&!this._hs&&this._o.onError(new eb),this._o.onCompleted()},b}(Nc);Mc.reduce=function(){var a,b=!1,c=arguments[0];return 2===arguments.length&&(b=!0,a=arguments[1]),new Je(this,c,b,a)};var Le=function(a){function b(b,c){this.source=b,this._fn=c,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new Me(a,this._fn,this.source))},b}(Tc),Me=function(a){function b(b,c,d){this._o=b,this._fn=c,this._s=d,this._i=0,a.call(this)}return Wb(b,a),b.prototype.next=function(a){var b=$a(this._fn)(a,this._i++,this._s);return b===Za?this._o.onError(b.e):void(Boolean(b)&&(this._o.onNext(!0),this._o.onCompleted()))},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onNext(!1),this._o.onCompleted()},b}(Nc);Mc.some=function(a,b){var c=ob(a,b,3);return new Le(this,c)};var Ne=function(a){function b(b){this.source=b,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new Oe(a))},b}(Tc),Oe=function(a){function b(b){this._o=b,a.call(this)}return Wb(b,a),b.prototype.next=function(){this._o.onNext(!1),this._o.onCompleted()},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onNext(!0),this._o.onCompleted()},b}(Nc);Mc.isEmpty=function(){return new Ne(this)};var Pe=function(a){function b(b,c){this.source=b,this._fn=c,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new Qe(a,this._fn,this.source))},b}(Tc),Qe=function(a){function b(b,c,d){this._o=b,this._fn=c,this._s=d,this._i=0,a.call(this)}return Wb(b,a),b.prototype.next=function(a){var b=$a(this._fn)(a,this._i++,this._s);return b===Za?this._o.onError(b.e):void(Boolean(b)||(this._o.onNext(!1),this._o.onCompleted()))},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onNext(!0),this._o.onCompleted()},b}(Nc);Mc.every=function(a,b){var c=ob(a,b,3);return new Pe(this,c)};var Re=function(a){function b(b,c,d){var e=+d||0;Math.abs(e)===1/0&&(e=0),this.source=b,this._elem=c,this._n=e,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){return this._n<0?(a.onNext(!1),a.onCompleted(),dc):this.source.subscribe(new Se(a,this._elem,this._n))},b}(Tc),Se=function(a){function b(b,c,d){this._o=b,this._elem=c,this._n=d,this._i=0,a.call(this)}function c(a,b){return 0===a&&0===b||a===b||isNaN(a)&&isNaN(b)}return Wb(b,a),b.prototype.next=function(a){this._i++>=this._n&&c(a,this._elem)&&(this._o.onNext(!0),this._o.onCompleted())},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onNext(!1),this._o.onCompleted()},b}(Nc);Mc.includes=function(a,b){return new Re(this,a,b)};var Te=function(a){function b(b,c){this.source=b,this._fn=c,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new Ue(a,this._fn,this.source))},b}(Tc),Ue=function(a){function b(b,c,d){this._o=b,this._fn=c,this._s=d,this._i=0,this._c=0,a.call(this)}return Wb(b,a),b.prototype.next=function(a){if(this._fn){var b=$a(this._fn)(a,this._i++,this._s);if(b===Za)return this._o.onError(b.e);Boolean(b)&&this._c++}else this._c++},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onNext(this._c),this._o.onCompleted()},b}(Nc);Mc.count=function(a,b){var c=ob(a,b,3);return new Te(this,c)};var Ve=function(a){function b(b,c,d){this.source=b,this._e=c,this._n=d,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){return this._n<0?(a.onNext(-1),a.onCompleted(),dc):this.source.subscribe(new We(a,this._e,this._n))},b}(Tc),We=function(a){function b(b,c,d){this._o=b,this._e=c,this._n=d,this._i=0,a.call(this)}return Wb(b,a),b.prototype.next=function(a){this._i>=this._n&&a===this._e&&(this._o.onNext(this._i),this._o.onCompleted()),this._i++},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onNext(-1),this._o.onCompleted()},b}(Nc);Mc.indexOf=function(a,b){var c=+b||0;return Math.abs(c)===1/0&&(c=0),new Ve(this,a,c)};var Xe=function(a){function b(b,c){this.source=b,this._fn=c,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new Ye(a,this._fn,this.source))},b}(Tc),Ye=function(a){function b(b,c,d){this._o=b,this._fn=c,this._s=d,this._i=0,this._c=0,a.call(this)}return Wb(b,a),b.prototype.next=function(a){if(this._fn){var b=$a(this._fn)(a,this._i++,this._s);if(b===Za)return this._o.onError(b.e);this._c+=b}else this._c+=a},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onNext(this._c),this._o.onCompleted()},b}(Nc);Mc.sum=function(a,b){var c=ob(a,b,3);return new Xe(this,c)},Mc.minBy=function(a,b){return b||(b=Va),new He(this,a,function(a,c){return-1*b(a,c)})},Mc.min=function(a){return this.minBy(Sa,a).map(V)},Mc.maxBy=function(a,b){return b||(b=Va),new He(this,a,b)},Mc.max=function(a){return this.maxBy(Sa,a).map(V)};var Ze=function(a){function b(b,c){this.source=b,this._fn=c,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new $e(a,this._fn,this.source))},b}(Tc),$e=function(a){function b(b,c,d){this._o=b,this._fn=c,this._s=d,this._c=0,this._t=0,a.call(this)}return Wb(b,a),b.prototype.next=function(a){if(this._fn){var b=$a(this._fn)(a,this._c++,this._s);if(b===Za)return this._o.onError(b.e);this._t+=b}else this._c++,this._t+=a},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){return 0===this._c?this._o.onError(new eb):(this._o.onNext(this._t/this._c),void this._o.onCompleted())},b}(Nc);Mc.average=function(a,b){var c,d=this;return Ya(a)&&(c=ob(a,b,3)),new Ze(d,c)},Mc.sequenceEqual=function(a,b){var c=this;return b||(b=Ua),new xg(function(d){var e=!1,f=!1,g=[],h=[],i=c.subscribe(function(a){if(h.length>0){var c=h.shift(),e=$a(b)(c,a);if(e===Za)return d.onError(e.e);e||(d.onNext(!1),d.onCompleted())}else f?(d.onNext(!1),d.onCompleted()):g.push(a)},function(a){d.onError(a)},function(){e=!0,0===g.length&&(h.length>0?(d.onNext(!1),d.onCompleted()):f&&(d.onNext(!0),d.onCompleted()))});(nb(a)||mb(a))&&(a=md(a)),Xa(a)&&(a=dd(a));var j=a.subscribe(function(a){if(g.length>0){var c=g.shift(),f=$a(b)(c,a);if(f===Za)return d.onError(f.e);f||(d.onNext(!1),d.onCompleted())}else e?(d.onNext(!1),d.onCompleted()):h.push(a)},function(a){d.onError(a)},function(){f=!0,0===h.length&&(g.length>0?(d.onNext(!1),d.onCompleted()):e&&(d.onNext(!0),d.onCompleted()))});return new jc(i,j)},c)};var _e=function(a){function b(b,c,d){this.source=b,this._i=c,this._d=d,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new af(a,this._i,this._d))},b}(Tc),af=function(b){function c(a,c,d){this._o=a,this._i=c,this._d=d,b.call(this)}return Wb(c,b),c.prototype.next=function(a){0===this._i--&&(this._o.onNext(a),this._o.onCompleted())},c.prototype.error=function(a){this._o.onError(a)},c.prototype.completed=function(){this._d===a?this._o.onError(new gb):(this._o.onNext(this._d),this._o.onCompleted())},c}(Nc);Mc.elementAt=function(a,b){if(0>a)throw new gb;return new _e(this,a,b)};var bf=function(b){function c(a,c,d){this._o=a,this._obj=c,this._s=d,this._i=0,this._hv=!1,this._v=null,b.call(this)}return Wb(c,b),c.prototype.next=function(a){var b=!1;if(this._obj.predicate){var c=$a(this._obj.predicate)(a,this._i++,this._s);if(c===Za)return this._o.onError(c.e);Boolean(c)&&(b=!0)}else this._obj.predicate||(b=!0);if(b){if(this._hv)return this._o.onError(new Error("Sequence contains more than one matching element"));this._hv=!0,this._v=a}},c.prototype.error=function(a){this._o.onError(a)},c.prototype.completed=function(){this._hv?(this._o.onNext(this._v),this._o.onCompleted()):this._obj.defaultValue===a?this._o.onError(new eb):(this._o.onNext(this._obj.defaultValue),this._o.onCompleted())},c}(Nc);Mc.single=function(a,b){var c={},d=this;if(c="object"==typeof arguments[0]?arguments[0]:{predicate:arguments[0],thisArg:arguments[1],defaultValue:arguments[2]},Ya(c.predicate)){var e=c.predicate;c.predicate=ob(e,c.thisArg,3)}return new xg(function(a){return d.subscribe(new bf(a,c,d))},d)};var cf=function(a){function b(b,c){this.source=b,this._obj=c,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new df(a,this._obj,this.source))},b}(Tc),df=function(b){function c(a,c,d){this._o=a,this._obj=c,this._s=d,this._i=0,b.call(this)}return Wb(c,b),c.prototype.next=function(a){if(this._obj.predicate){var b=$a(this._obj.predicate)(a,this._i++,this._s);if(b===Za)return this._o.onError(b.e);Boolean(b)&&(this._o.onNext(a),this._o.onCompleted())}else this._obj.predicate||(this._o.onNext(a),this._o.onCompleted())},c.prototype.error=function(a){this._o.onError(a)},c.prototype.completed=function(){this._obj.defaultValue===a?this._o.onError(new eb):(this._o.onNext(this._obj.defaultValue),this._o.onCompleted())},c}(Nc);Mc.first=function(){var a={};if(a="object"==typeof arguments[0]?arguments[0]:{predicate:arguments[0],thisArg:arguments[1],defaultValue:arguments[2]},Ya(a.predicate)){var b=a.predicate;a.predicate=ob(b,a.thisArg,3)}return new cf(this,a)};var ef=function(a){function b(b,c){this.source=b,this._obj=c,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new ff(a,this._obj,this.source))},b}(Tc),ff=function(b){function c(a,c,d){this._o=a,this._obj=c,this._s=d,this._i=0,this._hv=!1,this._v=null,b.call(this)}return Wb(c,b),c.prototype.next=function(a){var b=!1;if(this._obj.predicate){var c=$a(this._obj.predicate)(a,this._i++,this._s);if(c===Za)return this._o.onError(c.e);Boolean(c)&&(b=!0)}else this._obj.predicate||(b=!0);b&&(this._hv=!0,this._v=a)},c.prototype.error=function(a){this._o.onError(a)},c.prototype.completed=function(){this._hv?(this._o.onNext(this._v),this._o.onCompleted()):this._obj.defaultValue===a?this._o.onError(new eb):(this._o.onNext(this._obj.defaultValue),this._o.onCompleted())},c}(Nc);Mc.last=function(){var a={};if(a="object"==typeof arguments[0]?arguments[0]:{predicate:arguments[0],thisArg:arguments[1],defaultValue:arguments[2]},Ya(a.predicate)){var b=a.predicate;a.predicate=ob(b,a.thisArg,3)}return new ef(this,a)};var gf=function(a){function b(b,c,d,e){this._o=b,this._s=c,this._cb=d,this._y=e,this._i=0,a.call(this)}return Wb(b,a),b.prototype.next=function(a){var b=$a(this._cb)(a,this._i,this._s);return b===Za?this._o.onError(b.e):void(b?(this._o.onNext(this._y?this._i:a),this._o.onCompleted()):this._i++)},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._y&&this._o.onNext(-1),this._o.onCompleted()},b}(Nc);Mc.find=function(a,b){return W(this,a,b,!1)},Mc.findIndex=function(a,b){return W(this,a,b,!0)};var hf=function(a){function b(b){this.source=b,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new jf(a))},b}(Tc),jf=function(a){function b(b){this._o=b,this._s=new Pa.Set,a.call(this)}return Wb(b,a),b.prototype.next=function(a){this._s.add(a)},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onNext(this._s),this._o.onCompleted()},b}(Nc);Mc.toSet=function(){if("undefined"==typeof Pa.Set)throw new TypeError;return new hf(this)};var kf=function(a){function b(b,c,d){this.source=b,this._k=c,this._e=d,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new lf(a,this._k,this._e))},b}(Tc),lf=function(a){function b(b,c,d){this._o=b,this._k=c,this._e=d,this._m=new Pa.Map,a.call(this)}return Wb(b,a),b.prototype.next=function(a){var b=$a(this._k)(a);if(b===Za)return this._o.onError(b.e);var c=a;return this._e&&(c=$a(this._e)(a),c===Za)?this._o.onError(c.e):void this._m.set(b,c)},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onNext(this._m),this._o.onCompleted()},b}(Nc);Mc.toMap=function(a,b){if("undefined"==typeof Pa.Map)throw new TypeError;return new kf(this,a,b)};var mf=function(a){function b(b,c,d){this.source=b,this._b=c,this._e=d,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new nf(a,this._b,this._e))},b}(Tc),nf=function(a){function b(b,c,d){this._o=b,this._b=c,this._e=d,this._i=0,a.call(this)}return Wb(b,a),b.prototype.next=function(a){this._i>=this._b&&(this._e===this._i?this._o.onCompleted():this._o.onNext(a)),this._i++},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onCompleted()},b}(Nc);Mc.slice=function(a,b){var c=a||0;if(0>c)throw new Qa.ArgumentOutOfRangeError;if("number"==typeof b&&c>b)throw new Qa.ArgumentOutOfRangeError;return new mf(this,c,b)};var of=function(a){function b(b,c,d){this.source=b,this._e=c,this._n=d,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){return this._n<0?(a.onNext(-1),a.onCompleted(),dc):this.source.subscribe(new pf(a,this._e,this._n))},b}(Tc),pf=function(a){function b(b,c,d){this._o=b,this._e=c,this._n=d,this._v=0,this._hv=!1,this._i=0,a.call(this)}return Wb(b,a),b.prototype.next=function(a){this._i>=this._n&&a===this._e&&(this._hv=!0,this._v=this._i),this._i++},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._hv?this._o.onNext(this._v):this._o.onNext(-1),this._o.onCompleted()},b}(Nc);Mc.lastIndexOf=function(a,b){var c=+b||0;return Math.abs(c)===1/0&&(c=0),new of(this,a,c)},Sc.wrap=function(a){function b(){return Sc.spawn.call(this,a.apply(this,arguments))}return b.__generatorFunction__=a,b};var qf=Sc.spawn=function(){for(var a=arguments[0],b=this,c=[],d=1,e=arguments.length;e>d;d++)c.push(arguments[d]);return new xg(function(d){function e(b){var c=$a(a.next).call(a,b);return c===Za?d.onError(c.e):void g(c)}function f(b){var c=$a(a.next).call(a,b);return c===Za?d.onError(c.e):void g(c)}function g(a){if(a.done)return d.onNext(a.value),void d.onCompleted();var c=X.call(b,a.value),g=null,i=!1;Sc.isObservable(c)?h.add(c.subscribe(function(a){i=!0,g=a},f,function(){i&&e(g)})):f(new TypeError("type not supported"))}var h=new _b;return Ya(a)&&(a=a.apply(b,c)),a&&Ya(a.next)?(e(),h):(d.onNext(a),d.onCompleted())})};Sc.start=function(a,b,c){return rf(a,b,c)()};var rf=Sc.toAsync=function(a,b,c){return pc(c)||(c=Bc),function(){var d=arguments,e=new Cg;return c.schedule(null,function(){var c;try{c=a.apply(b,d)}catch(f){return void e.onError(f)}e.onNext(c),e.onCompleted()}),e.asObservable()}};Sc.fromCallback=function(a,b,c){return function(){"undefined"==typeof b&&(b=this); for(var d=arguments.length,e=new Array(d),f=0;d>f;f++)e[f]=arguments[f];return ca(a,b,c,e)}},Sc.fromNodeCallback=function(a,b,c){return function(){"undefined"==typeof b&&(b=this);for(var d=arguments.length,e=new Array(d),f=0;d>f;f++)e[f]=arguments[f];return ea(a,b,c,e)}},ha.prototype.dispose=function(){this.isDisposed||(this._e.removeEventListener(this._n,this._fn,!1),this.isDisposed=!0)},Qa.config.useNativeEvents=!1;var sf=function(a){function b(b,c,d){this._el=b,this._n=c,this._fn=d,a.call(this)}function c(a,b){return function(){var c=arguments[0];return Ya(b)&&(c=$a(b).apply(null,arguments),c===Za)?a.onError(c.e):void a.onNext(c)}}return Wb(b,a),b.prototype.subscribeCore=function(a){return ia(this._el,this._n,c(a,this._fn))},b}(Tc);Sc.fromEvent=function(a,b,c){return a.addListener?uf(function(c){a.addListener(b,c)},function(c){a.removeListener(b,c)},c):Qa.config.useNativeEvents||"function"!=typeof a.on||"function"!=typeof a.off?new sf(a,b,c).publish().refCount():uf(function(c){a.on(b,c)},function(c){a.off(b,c)},c)};var tf=function(a){function b(b,c,d){this._add=b,this._del=c,this._fn=d,a.call(this)}function c(a,b){return function(){var c=arguments[0];return Ya(b)&&(c=$a(b).apply(null,arguments),c===Za)?a.onError(c.e):void a.onNext(c)}}function d(a,b,c){this._del=a,this._fn=b,this._ret=c,this.isDisposed=!1}return Wb(b,a),b.prototype.subscribeCore=function(a){var b=c(a,this._fn),e=this._add(b);return new d(this._del,b,e)},d.prototype.dispose=function(){this.isDisposed||(Ya(this._del)&&this._del(this._fn,this._ret),this.isDisposed=!0)},b}(Tc),uf=Sc.fromEventPattern=function(a,b,c){return new tf(a,b,c).publish().refCount()};Sc.startAsync=function(a){var b=$a(a)();return b===Za?yd(b.e):dd(b)};var vf=function(a){function b(b,c){this.source=b,this.controller=new Bg,this.paused=!0,c&&c.subscribe?this.pauser=this.controller.merge(c):this.pauser=this.controller,a.call(this)}return Wb(b,a),b.prototype._subscribe=function(a){var b=this.source.publish(),c=b.subscribe(a),d=dc,e=this.pauser.startWith(!this.paused).distinctUntilChanged().subscribe(function(a){a?d=b.connect():(d.dispose(),d=dc)});return new kc([c,d,e])},b.prototype.pause=function(){this.paused=!0,this.controller.onNext(!1)},b.prototype.resume=function(){this.paused=!1,this.controller.onNext(!0)},b}(Sc);Mc.pausable=function(a){return new vf(this,a)};var wf=function(b){function c(a,c){this.source=a,this.controller=new Bg,this.paused=!0,c&&c.subscribe?this.pauser=this.controller.merge(c):this.pauser=this.controller,b.call(this)}return Wb(c,b),c.prototype._subscribe=function(b){function c(){for(;e.length>0;)b.onNext(e.shift())}var d,e=[],f=ja(this.source,this.pauser.startWith(!this.paused).distinctUntilChanged(),function(a,b){return{data:a,shouldFire:b}}).subscribe(function(f){d!==a&&f.shouldFire!==d?(d=f.shouldFire,f.shouldFire&&c()):(d=f.shouldFire,f.shouldFire?b.onNext(f.data):e.push(f.data))},function(a){c(),b.onError(a)},function(){c(),b.onCompleted()});return f},c.prototype.pause=function(){this.paused=!0,this.controller.onNext(!1)},c.prototype.resume=function(){this.paused=!1,this.controller.onNext(!0)},c}(Sc);Mc.pausableBuffered=function(a){return new wf(this,a)};var xf=function(a){function b(b,c,d){a.call(this),this.subject=new yf(c,d),this.source=b.multicast(this.subject).refCount()}return Wb(b,a),b.prototype._subscribe=function(a){return this.source.subscribe(a)},b.prototype.request=function(a){return this.subject.request(null==a?-1:a)},b}(Sc),yf=function(a){function b(b,c){null==b&&(b=!0),a.call(this),this.subject=new Bg,this.enableQueue=b,this.queue=b?[]:null,this.requestedCount=0,this.requestedDisposable=null,this.error=null,this.hasFailed=!1,this.hasCompleted=!1,this.scheduler=c||wc}return Wb(b,a),Xb(b.prototype,Kc,{_subscribe:function(a){return this.subject.subscribe(a)},onCompleted:function(){this.hasCompleted=!0,this.enableQueue&&0!==this.queue.length?this.queue.push(Dc.createOnCompleted()):(this.subject.onCompleted(),this.disposeCurrentRequest())},onError:function(a){this.hasFailed=!0,this.error=a,this.enableQueue&&0!==this.queue.length?this.queue.push(Dc.createOnError(a)):(this.subject.onError(a),this.disposeCurrentRequest())},onNext:function(a){this.requestedCount<=0?this.enableQueue&&this.queue.push(Dc.createOnNext(a)):(0===this.requestedCount--&&this.disposeCurrentRequest(),this.subject.onNext(a))},_processRequest:function(a){if(this.enableQueue)for(;this.queue.length>0&&(a>0||"N"!==this.queue[0].kind);){var b=this.queue.shift();b.accept(this.subject),"N"===b.kind?a--:(this.disposeCurrentRequest(),this.queue=[])}return a},request:function(a){this.disposeCurrentRequest();var b=this;return this.requestedDisposable=this.scheduler.schedule(a,function(a,c){var d=b._processRequest(c),e=b.hasCompleted||b.hasFailed;return!e&&d>0?(b.requestedCount=d,cc(function(){b.requestedCount=0})):void 0}),this.requestedDisposable},disposeCurrentRequest:function(){this.requestedDisposable&&(this.requestedDisposable.dispose(),this.requestedDisposable=null)}}),b}(Sc);Mc.controlled=function(a,b){return a&&pc(a)&&(b=a,a=!0),null==a&&(a=!0),new xf(this,a,b)};var zf=function(a){function b(b){a.call(this),this.source=b}function c(a,b){return b.source.request(1)}Wb(b,a),b.prototype._subscribe=function(a){return this.subscription=this.source.subscribe(new d(a,this,this.subscription)),new jc(this.subscription,Bc.schedule(this,c))};var d=function(a){function b(b,c,d){a.call(this),this.observer=b,this.observable=c,this.cancel=d,this.scheduleDisposable=null}function c(a,b){return b.observable.source.request(1)}return Wb(b,a),b.prototype.completed=function(){this.observer.onCompleted(),this.dispose()},b.prototype.error=function(a){this.observer.onError(a),this.dispose()},b.prototype.next=function(a){this.observer.onNext(a),this.scheduleDisposable=Bc.schedule(this,c)},b.dispose=function(){this.observer=null,this.cancel&&(this.cancel.dispose(),this.cancel=null),this.scheduleDisposable&&(this.scheduleDisposable.dispose(),this.scheduleDisposable=null),a.prototype.dispose.call(this)},b}(Nc);return b}(Sc);xf.prototype.stopAndWait=function(){return new zf(this)};var Af=function(a){function b(b,c){a.call(this),this.source=b,this.windowSize=c}function c(a,b){return b.source.request(b.windowSize)}Wb(b,a),b.prototype._subscribe=function(a){return this.subscription=this.source.subscribe(new d(a,this,this.subscription)),new jc(this.subscription,Bc.schedule(this,c))};var d=function(a){function b(b,c,d){this.observer=b,this.observable=c,this.cancel=d,this.received=0,this.scheduleDisposable=null,a.call(this)}function c(a,b){return b.observable.source.request(b.observable.windowSize)}return Wb(b,a),b.prototype.completed=function(){this.observer.onCompleted(),this.dispose()},b.prototype.error=function(a){this.observer.onError(a),this.dispose()},b.prototype.next=function(a){this.observer.onNext(a),this.received=++this.received%this.observable.windowSize,0===this.received&&(this.scheduleDisposable=Bc.schedule(this,c))},b.prototype.dispose=function(){this.observer=null,this.cancel&&(this.cancel.dispose(),this.cancel=null),this.scheduleDisposable&&(this.scheduleDisposable.dispose(),this.scheduleDisposable=null),a.prototype.dispose.call(this)},b}(Nc);return b}(Sc);xf.prototype.windowed=function(a){return new Af(this,a)},Mc.pipe=function(a){function b(){c.resume()}var c=this.pausableBuffered();return a.addListener("drain",b),c.subscribe(function(b){!a.write(b)&&c.pause()},function(b){a.emit("error",b)},function(){!a._isStdio&&a.end(),a.removeListener("drain",b)}),c.resume(),a};var Bf=function(a){function b(b,c,d){this.source=b,this._fn1=c,this._fn2=d,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){var b=this.source.multicast(this._fn1());return new jc(this._fn2(b).subscribe(a),b.connect())},b}(Tc);Mc.multicast=function(a,b){return Ya(a)?new Bf(this,a,b):new Ef(this,a)},Mc.publish=function(a){return a&&Ya(a)?this.multicast(function(){return new Bg},a):this.multicast(new Bg)},Mc.share=function(){return this.publish().refCount()},Mc.publishLast=function(a){return a&&Ya(a)?this.multicast(function(){return new Cg},a):this.multicast(new Cg)},Mc.publishValue=function(a,b){return 2===arguments.length?this.multicast(function(){return new Dg(b)},a):this.multicast(new Dg(a))},Mc.shareValue=function(a){return this.publishValue(a).refCount()},Mc.replay=function(a,b,c,d){return a&&Ya(a)?this.multicast(function(){return new Eg(b,c,d)},a):this.multicast(new Eg(b,c,d))},Mc.shareReplay=function(a,b,c){return this.replay(null,a,b,c).refCount()};var Cf=function(a,b){this._s=a,this._o=b};Cf.prototype.dispose=function(){if(!this._s.isDisposed&&null!==this._o){var a=this._s.observers.indexOf(this._o);this._s.observers.splice(a,1),this._o=null}};var Df=function(a){function b(b){this.source=b,this._count=0,this._connectableSubscription=null,a.call(this)}function c(a,b){this._p=a,this._s=b,this.isDisposed=!1}return Wb(b,a),b.prototype.subscribeCore=function(a){var b=this.source.subscribe(a);return 1===++this._count&&(this._connectableSubscription=this.source.connect()),new c(this,b)},c.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this._s.dispose(),0===--this._p._count&&this._p._connectableSubscription.dispose())},b}(Tc),Ef=Qa.ConnectableObservable=function(a){function b(b,c){this.source=b,this._connection=null,this._source=b.asObservable(),this._subject=c,a.call(this)}function c(a,b){this._p=a,this._s=b}return Wb(b,a),c.prototype.dispose=function(){this._s&&(this._s.dispose(),this._s=null,this._p._connection=null)},b.prototype.connect=function(){if(!this._connection){if(this._subject.isStopped)return dc;var a=this._source.subscribe(this._subject);this._connection=new c(this,a)}return this._connection},b.prototype._subscribe=function(a){return this._subject.subscribe(a)},b.prototype.refCount=function(){return new Df(this)},b}(Sc);Mc.singleInstance=function(){function a(){return d||(d=!0,b=c["finally"](function(){d=!1}).publish().refCount()),b}var b,c=this,d=!1;return new xg(function(b){return a().subscribe(b)})},Mc.join=function(a,b,c,d){var e=this;return new xg(function(f){var g=new _b,h=!1,i=!1,j=0,k=0,l=new Of,m=new Of,n=function(a){f.onError(a)};return g.add(e.subscribe(function(a){var c=j++,e=new hc;l.set(c,a),g.add(e);var i=$a(b)(a);return i===Za?f.onError(i.e):(e.setDisposable(i.take(1).subscribe(Ra,n,function(){l["delete"](c)&&0===l.size&&h&&f.onCompleted(),g.remove(e)})),void m.forEach(function(b){var c=$a(d)(a,b);return c===Za?f.onError(c.e):void f.onNext(c)}))},n,function(){h=!0,(i||0===l.size)&&f.onCompleted()})),g.add(a.subscribe(function(a){var b=k++,e=new hc;m.set(b,a),g.add(e);var h=$a(c)(a);return h===Za?f.onError(h.e):(e.setDisposable(h.take(1).subscribe(Ra,n,function(){m["delete"](b)&&0===m.size&&i&&f.onCompleted(),g.remove(e)})),void l.forEach(function(b){var c=$a(d)(b,a);return c===Za?f.onError(c.e):void f.onNext(c)}))},n,function(){i=!0,(h||0===m.size)&&f.onCompleted()})),g},e)},Mc.groupJoin=function(a,b,c,d){var e=this;return new xg(function(f){function g(a){}var h=new _b,i=new lc(h),j=new Of,k=new Of,l=0,m=0,g=function(a){return function(b){b.onError(a)}};return h.add(e.subscribe(function(a){var c=new Bg,e=l++;j.set(e,c);var m=$a(d)(a,Yb(c,i));if(m===Za)return j.forEach(g(m.e)),f.onError(m.e);f.onNext(m),k.forEach(function(a){c.onNext(a)});var n=new hc;h.add(n);var o=$a(b)(a);return o===Za?(j.forEach(g(o.e)),f.onError(o.e)):void n.setDisposable(o.take(1).subscribe(Ra,function(a){j.forEach(g(a)),f.onError(a)},function(){j["delete"](e)&&c.onCompleted(),h.remove(n)}))},function(a){j.forEach(g(a)),f.onError(a)},function(){f.onCompleted()})),h.add(a.subscribe(function(a){var b=m++;k.set(b,a);var d=new hc;h.add(d);var e=$a(c)(a);return e===Za?(j.forEach(g(e.e)),f.onError(e.e)):(d.setDisposable(e.take(1).subscribe(Ra,function(a){j.forEach(g(a)),f.onError(a)},function(){k["delete"](b),h.remove(d)})),void j.forEach(function(b){b.onNext(a)}))},function(a){j.forEach(g(a)),f.onError(a)})),i},e)},Mc.buffer=function(){return this.window.apply(this,arguments).flatMap(O)},Mc.window=function(a,b){return 1===arguments.length&&"function"!=typeof arguments[0]?la.call(this,a):"function"==typeof a?ma.call(this,a):ka.call(this,a,b)};var Ff=function(a){function b(b){this.source=b,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new Gf(a))},b}(Tc),Gf=function(a){function b(b){this._o=b,this._p=null,this._hp=!1,a.call(this)}return Wb(b,a),b.prototype.next=function(a){this._hp?this._o.onNext([this._p,a]):this._hp=!0,this._p=a},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onCompleted()},b}(Nc);Mc.pairwise=function(){return new Ff(this)},Mc.partition=function(a,b){var c=ob(a,b,3);return[this.filter(a,b),this.filter(function(a,b,d){return!c(a,b,d)})]};var Hf=function(a){function b(a,b){this.c=a,this.s=b}return Wb(b,a),b.prototype[kb]=function(){var a=this;return{next:function(){return a.c()?{done:!1,value:a.s}:{done:!0,value:void 0}}}},b}(Vc);Mc.letBind=Mc.let=function(a){return a(this)},Sc["if"]=function(a,b,c){return gd(function(){return c||(c=jd()),Xa(b)&&(b=dd(b)),Xa(c)&&(c=dd(c)),"function"==typeof c.now&&(c=jd(c)),a()?b:c})},Sc["for"]=Sc.forIn=function(a,b,c){return _c(a,b,c).concat()};var If=Sc["while"]=Sc.whileDo=function(a,b){return Xa(b)&&(b=dd(b)),na(a,b).concat()};Mc.doWhile=function(a){return Id([this,If(a,this)])},Sc["case"]=function(a,b,c){return gd(function(){Xa(c)&&(c=dd(c)),c||(c=jd()),pc(c)&&(c=jd(c));var d=b[a()];return Xa(d)&&(d=dd(d)),d||c})};var Jf=function(a){function b(b,c,d){this.source=b,this._fn=c,this._scheduler=d,a.call(this)}function c(a,b){var c,d=a[0],e=a[1];if(!(d.q.length>0))return void(d.isAcquired=!1);c=d.q.shift();var f=new hc;d.d.add(f),f.setDisposable(c.subscribe(new Kf(d,e,f))),b([d,e])}return Wb(b,a),b.prototype._ensureActive=function(a){var b=!1;a.q.length>0&&(b=!a.isAcquired,a.isAcquired=!0),b&&a.m.setDisposable(this._scheduler.scheduleRecursive([a,this],c))},b.prototype.subscribeCore=function(a){var b=new ic,c=new _b(b),d={q:[],m:b,d:c,activeCount:0,isAcquired:!1,o:a};return d.q.push(this.source),d.activeCount++,this._ensureActive(d),c},b}(Tc),Kf=function(a){function b(b,c,d){this._s=b,this._p=c,this._m1=d,a.call(this)}return Wb(b,a),b.prototype.next=function(a){this._s.o.onNext(a);var b=$a(this._p._fn)(a);return b===Za?this._s.o.onError(b.e):(this._s.q.push(b),this._s.activeCount++,void this._p._ensureActive(this._s))},b.prototype.error=function(a){this._s.o.onError(a)},b.prototype.completed=function(){this._s.d.remove(this._m1),this._s.activeCount--,0===this._s.activeCount&&this._s.o.onCompleted()},b}(Nc);Mc.expand=function(a,b){return pc(b)||(b=wc),new Jf(this,a,b)};var Lf=function(a){function b(b,c){this._sources=b,this._cb=c,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){if(0===this._sources.length)return a.onCompleted(),dc;for(var b=this._sources.length,c={finished:!1,hasResults:new Array(b),hasCompleted:new Array(b),results:new Array(b)},d=new _b,e=0,f=this._sources.length;f>e;e++){var g=this._sources[e];Xa(g)&&(g=dd(g)),d.add(g.subscribe(new Mf(a,c,e,this._cb,d)))}return d},b}(Tc),Mf=function(a){function b(b,c,d,e,f){this._o=b,this._s=c,this._i=d,this._cb=e,this._subs=f,a.call(this)}return Wb(b,a),b.prototype.next=function(a){this._s.finished||(this._s.hasResults[this._i]=!0,this._s.results[this._i]=a)},b.prototype.error=function(a){this._s.finished=!0,this._o.onError(a),this._subs.dispose()},b.prototype.completed=function(){if(!this._s.finished){if(!this._s.hasResults[this._i])return this._o.onCompleted();this._s.hasCompleted[this._i]=!0;for(var a=0;a<this._s.results.length;a++)if(!this._s.hasCompleted[a])return;this._s.finished=!0;var b=$a(this._cb).apply(null,this._s.results);if(b===Za)return this._o.onError(b.e);this._o.onNext(b),this._o.onCompleted()}},b}(Nc);Sc.forkJoin=function(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];var d=Ya(b[a-1])?b.pop():L;return Array.isArray(b[0])&&(b=b[0]),new Lf(b,d)},Mc.forkJoin=function(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];return Array.isArray(b[0])?b[0].unshift(this):b.unshift(this),Sc.forkJoin.apply(null,b)},Mc.manySelect=Mc.extend=function(a,b){pc(b)||(b=Qa.Scheduler.immediate);var c=this;return gd(function(){var d;return c.map(function(a){var b=new Nf(a);return d&&d.onNext(a),d=b,b}).tap(Ra,function(a){d&&d.onError(a)},function(){d&&d.onCompleted()}).observeOn(b).map(a)},c)};var Nf=function(a){function b(b){a.call(this),this.head=b,this.tail=new Cg}return Wb(b,a),Xb(b.prototype,Kc,{_subscribe:function(a){var b=new _b;return b.add(wc.schedule(this,function(c,d){a.onNext(d.head),b.add(d.tail.mergeAll().subscribe(a))})),b},onCompleted:function(){this.onNext(Sc.empty())},onError:function(a){this.onNext(Sc["throw"](a))},onNext:function(a){this.tail.onNext(a),this.tail.onCompleted()}}),b}(Sc),Of=Pa.Map||function(){function b(){this.size=0,this._values=[],this._keys=[]}return b.prototype["delete"]=function(a){var b=this._keys.indexOf(a);return-1===b?!1:(this._values.splice(b,1),this._keys.splice(b,1),this.size--,!0)},b.prototype.get=function(b){var c=this._keys.indexOf(b);return-1===c?a:this._values[c]},b.prototype.set=function(a,b){var c=this._keys.indexOf(a);return-1===c?(this._keys.push(a),this._values.push(b),this.size++):this._values[c]=b,this},b.prototype.forEach=function(a,b){for(var c=0;c<this.size;c++)a.call(b,this._values[c],this._keys[c])},b}();oa.prototype.and=function(a){return new oa(this.patterns.concat(a))},oa.prototype.thenDo=function(a){return new pa(this,a)},pa.prototype.activate=function(a,b,c){for(var d=[],e=qa(b),f=0,g=this.expression.patterns.length;g>f;f++)d.push(sa(a,this.expression.patterns[f],e));var h=new ta(d,ra(this,b),function(){for(var a=0,b=d.length;b>a;a++)d[a].removeActivePlan(h);c(h)});for(f=0,g=d.length;g>f;f++)d[f].addActivePlan(h);return h},ta.prototype.dequeue=function(){this.joinObservers.forEach(function(a){a.queue.shift()})},ta.prototype.match=function(){var a,b,c=!0;for(a=0,b=this.joinObserverArray.length;b>a;a++)if(0===this.joinObserverArray[a].queue.length){c=!1;break}if(c){var d=[],e=!1;for(a=0,b=this.joinObserverArray.length;b>a;a++)d.push(this.joinObserverArray[a].queue[0]),"C"===this.joinObserverArray[a].queue[0].kind&&(e=!0);if(e)this.onCompleted();else{this.dequeue();var f=[];for(a=0,b=d.length;a<d.length;a++)f.push(d[a].value);this.onNext.apply(this,f)}}};var Pf=function(a){function b(b,c){a.call(this),this.source=b,this.onError=c,this.queue=[],this.activePlans=[],this.subscription=new hc,this.isDisposed=!1}Wb(b,a);var c=b.prototype;return c.next=function(a){if(!this.isDisposed){if("E"===a.kind)return this.onError(a.error);this.queue.push(a);for(var b=this.activePlans.slice(0),c=0,d=b.length;d>c;c++)b[c].match()}},c.error=Ra,c.completed=Ra,c.addActivePlan=function(a){this.activePlans.push(a)},c.subscribe=function(){this.subscription.setDisposable(this.source.materialize().subscribe(this))},c.removeActivePlan=function(a){this.activePlans.splice(this.activePlans.indexOf(a),1),0===this.activePlans.length&&this.dispose()},c.dispose=function(){a.prototype.dispose.call(this),this.isDisposed||(this.isDisposed=!0,this.subscription.dispose())},b}(Nc);Mc.and=function(a){return new oa([this,a])},Mc.thenDo=function(a){return new oa([this]).thenDo(a)},Sc.when=function(){var a,b=arguments.length;if(Array.isArray(arguments[0]))a=arguments[0];else{a=new Array(b);for(var c=0;b>c;c++)a[c]=arguments[c]}return new xg(function(b){var c=[],d=new Of,e=Lc(function(a){b.onNext(a)},function(a){d.forEach(function(b){b.onError(a)}),b.onError(a)},function(a){b.onCompleted()});try{for(var f=0,g=a.length;g>f;f++)c.push(a[f].activate(d,e,function(a){var d=c.indexOf(a);c.splice(d,1),0===c.length&&b.onCompleted()}))}catch(h){return yd(h).subscribe(b)}var i=new _b;return d.forEach(function(a){a.subscribe(),i.add(a)}),i})};var Qf=function(a){function b(b,c){this._dt=b,this._s=c,a.call(this)}function c(a,b){b.onNext(0),b.onCompleted()}return Wb(b,a),b.prototype.subscribeCore=function(a){return this._s.scheduleFuture(a,this._dt,c)},b}(Tc),Rf=Sc.interval=function(a,b){return wa(a,a,pc(b)?b:Bc)};Sc.timer=function(b,c,d){var e;return pc(d)||(d=Bc),null!=c&&"number"==typeof c?e=c:pc(c)&&(d=c),(b instanceof Date||"number"==typeof b)&&e===a?ua(b,d):b instanceof Date&&e!==a?va(b,c,d):wa(b,e,d)};Mc.delay=function(){var a=arguments[0];if("number"==typeof a||a instanceof Date){var b=a,c=arguments[1];return pc(c)||(c=Bc),b instanceof Date?ya(this,b,c):xa(this,b,c)}if(Sc.isObservable(a)||Ya(a))return za(this,a,arguments[1]);throw new Error("Invalid arguments")};var Sf=function(a){function b(b,c,d){pc(d)||(d=Bc),this.source=b,this._dt=c,this._s=d,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){var b=new ic;return new jc(this.source.subscribe(new Tf(a,this._dt,this._s,b)),b)},b}(Tc),Tf=function(a){function b(b,c,d,e){this._o=b,this._d=c,this._scheduler=d,this._c=e,this._v=null,this._hv=!1,this._id=0,a.call(this)}return Wb(b,a),b.prototype.next=function(a){this._hv=!0,this._v=a;var b=++this._id,c=new hc;this._c.setDisposable(c),c.setDisposable(this._scheduler.scheduleFuture(this,this._d,function(c,d){d._hv&&d._id===b&&d._o.onNext(a),d._hv=!1}))},b.prototype.error=function(a){this._c.dispose(),this._o.onError(a),this._hv=!1,this._id++},b.prototype.completed=function(){this._c.dispose(),this._hv&&this._o.onNext(this._v),this._o.onCompleted(),this._hv=!1,this._id++},b}(Nc);Mc.debounce=function(){if(Ya(arguments[0]))return Aa(this,arguments[0]);if("number"==typeof arguments[0])return new Sf(this,arguments[0],arguments[1]);throw new Error("Invalid arguments")},Mc.windowWithTime=Mc.windowTime=function(a,b,c){var d,e=this;return null==b&&(d=a),pc(c)||(c=Bc),"number"==typeof b?d=b:pc(b)&&(d=a,c=b),new xg(function(b){function f(){var a=new hc,e=!1,g=!1;l.setDisposable(a),j===i?(e=!0,g=!0):i>j?e=!0:g=!0;var n=e?j:i,o=n-m;m=n,e&&(j+=d),g&&(i+=d),a.setDisposable(c.scheduleFuture(null,o,function(){if(g){var a=new Bg;k.push(a),b.onNext(Yb(a,h))}e&&k.shift().onCompleted(),f()}))}var g,h,i=d,j=a,k=[],l=new ic,m=0;return g=new _b(l),h=new lc(g),k.push(new Bg),b.onNext(Yb(k[0],h)),f(),g.add(e.subscribe(function(a){for(var b=0,c=k.length;c>b;b++)k[b].onNext(a)},function(a){for(var c=0,d=k.length;d>c;c++)k[c].onError(a);b.onError(a)},function(){for(var a=0,c=k.length;c>a;a++)k[a].onCompleted();b.onCompleted()})),h},e)},Mc.windowWithTimeOrCount=Mc.windowTimeOrCount=function(a,b,c){var d=this;return pc(c)||(c=Bc),new xg(function(e){function f(b){var d=new hc;g.setDisposable(d),d.setDisposable(c.scheduleFuture(null,a,function(){if(b===k){j=0;var a=++k;l.onCompleted(),l=new Bg,e.onNext(Yb(l,i)),f(a)}}))}var g=new ic,h=new _b(g),i=new lc(h),j=0,k=0,l=new Bg;return e.onNext(Yb(l,i)),f(0),h.add(d.subscribe(function(a){var c=0,d=!1;l.onNext(a),++j===b&&(d=!0,j=0,c=++k,l.onCompleted(),l=new Bg,e.onNext(Yb(l,i))),d&&f(c)},function(a){l.onError(a),e.onError(a)},function(){l.onCompleted(),e.onCompleted()})),i},d)},Mc.bufferWithTime=Mc.bufferTime=function(a,b,c){return this.windowWithTime(a,b,c).flatMap(O)},Mc.bufferWithTimeOrCount=Mc.bufferTimeOrCount=function(a,b,c){return this.windowWithTimeOrCount(a,b,c).flatMap(O)};var Uf=function(a){function b(b,c){this.source=b,this._s=c,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new Vf(a,this._s))},b}(Tc),Vf=function(a){function b(b,c){this._o=b,this._s=c,this._l=c.now(),a.call(this)}return Wb(b,a),b.prototype.next=function(a){var b=this._s.now(),c=b-this._l;this._l=b,this._o.onNext({value:a,interval:c})},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onCompleted()},b}(Nc);Mc.timeInterval=function(a){return pc(a)||(a=Bc),new Uf(this,a)};var Wf=function(a){function b(b,c){this.source=b,this._s=c,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new Xf(a,this._s))},b}(Tc),Xf=function(a){function b(b,c){this._o=b,this._s=c,a.call(this)}return Wb(b,a),b.prototype.next=function(a){this._o.onNext({value:a,timestamp:this._s.now()})},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onCompleted()},b}(Nc);Mc.timestamp=function(a){return pc(a)||(a=Bc),new Wf(this,a)};var Yf=function(a){function b(b,c){this.source=b,this._sampler=c,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){var b={o:a,atEnd:!1,value:null,hasValue:!1,sourceSubscription:new hc};return b.sourceSubscription.setDisposable(this.source.subscribe(new $f(b))),new jc(b.sourceSubscription,this._sampler.subscribe(new Zf(b)))},b}(Tc),Zf=function(a){function b(b){this._s=b,a.call(this)}return Wb(b,a),b.prototype._handleMessage=function(){this._s.hasValue&&(this._s.hasValue=!1,this._s.o.onNext(this._s.value)),this._s.atEnd&&this._s.o.onCompleted()},b.prototype.next=function(){this._handleMessage()},b.prototype.error=function(a){this._s.onError(a)},b.prototype.completed=function(){this._handleMessage()},b}(Nc),$f=function(a){function b(b){this._s=b,a.call(this)}return Wb(b,a),b.prototype.next=function(a){this._s.hasValue=!0,this._s.value=a},b.prototype.error=function(a){this._s.o.onError(a)},b.prototype.completed=function(){this._s.atEnd=!0,this._s.sourceSubscription.dispose()},b}(Nc);Mc.sample=function(a,b){return pc(b)||(b=Bc),"number"==typeof a?new Yf(this,Rf(a,b)):new Yf(this,a)};var _f=Qa.TimeoutError=function(a){this.message=a||"Timeout has occurred",this.name="TimeoutError",Error.call(this)};_f.prototype=Object.create(Error.prototype),Mc.timeout=function(){var a=arguments[0];if(a instanceof Date||"number"==typeof a)return Ca(this,a,arguments[1],arguments[2]);if(Sc.isObservable(a)||Ya(a))return Ba(this,a,arguments[1],arguments[2]);throw new Error("Invalid arguments")};var ag=function(a){function b(b,c,d,e,f,g){this._state=b,this._cndFn=c,this._itrFn=d,this._resFn=e,this._timeFn=f,this._s=g,a.call(this)}function c(a,b){if(a.hasResult&&a.o.onNext(a.result),a.first)a.first=!1;else if(a.newState=$a(a.self._itrFn)(a.newState),a.newState===Za)return a.o.onError(a.newState.e);if(a.hasResult=$a(a.self._cndFn)(a.newState),a.hasResult===Za)return a.o.onError(a.hasResult.e);if(a.hasResult){if(a.result=$a(a.self._resFn)(a.newState),a.result===Za)return a.o.onError(a.result.e);var c=$a(a.self._timeFn)(a.newState);if(c===Za)return a.o.onError(c.e);b(a,c)}else a.o.onCompleted()}return Wb(b,a),b.prototype.subscribeCore=function(a){var b={o:a,self:this,newState:this._state,first:!0,hasResult:!1};return this._s.scheduleRecursiveFuture(b,new Date(this._s.now()),c)},b}(Tc);Sc.generateWithAbsoluteTime=function(a,b,c,d,e,f){return pc(f)||(f=Bc),new ag(a,b,c,d,e,f)};var bg=function(a){function b(b,c,d,e,f,g){this._state=b,this._cndFn=c,this._itrFn=d,this._resFn=e,this._timeFn=f,this._s=g,a.call(this)}function c(a,b){if(a.hasResult&&a.o.onNext(a.result),a.first)a.first=!1;else if(a.newState=$a(a.self._itrFn)(a.newState),a.newState===Za)return a.o.onError(a.newState.e);if(a.hasResult=$a(a.self._cndFn)(a.newState),a.hasResult===Za)return a.o.onError(a.hasResult.e);if(a.hasResult){if(a.result=$a(a.self._resFn)(a.newState),a.result===Za)return a.o.onError(a.result.e);var c=$a(a.self._timeFn)(a.newState);if(c===Za)return a.o.onError(c.e);b(a,c)}else a.o.onCompleted()}return Wb(b,a),b.prototype.subscribeCore=function(a){var b={o:a,self:this,newState:this._state,first:!0,hasResult:!1};return this._s.scheduleRecursiveFuture(b,0,c)},b}(Tc);Sc.generateWithRelativeTime=function(a,b,c,d,e,f){return pc(f)||(f=Bc),new bg(a,b,c,d,e,f)};var cg=function(a){function b(b,c,d){this.source=b,this._dt=c,this._s=d,a.call(this)}function c(a,b){var c=b[0],d=b[1],e=b[2];e.setDisposable(c.subscribe(d))}return Wb(b,a),b.prototype.subscribeCore=function(a){var b=new ic;return b.setDisposable(this._s.scheduleFuture([this.source,a,b],this._dt,c)),b},b}(Tc);Mc.delaySubscription=function(a,b){return pc(b)||(b=Bc),new cg(this,a,b)};var dg=function(a){function b(b,c,d){this.source=b,this._d=c,this._s=d,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new eg(a,this))},b}(Tc),eg=function(a){function b(b,c){this._o=b,this._s=c._s,this._d=c._d,this._q=[],a.call(this)}return Wb(b,a),b.prototype.next=function(a){var b=this._s.now();for(this._q.push({interval:b,value:a});this._q.length>0&&b-this._q[0].interval>=this._d;)this._o.onNext(this._q.shift().value)},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){for(var a=this._s.now();this._q.length>0&&a-this._q[0].interval>=this._d;)this._o.onNext(this._q.shift().value);this._o.onCompleted()},b}(Nc);Mc.skipLastWithTime=function(a,b){return pc(b)||(b=Bc),new dg(this,a,b)};var fg=function(a){function b(b,c,d){this.source=b,this._d=c,this._s=d,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new gg(a,this._d,this._s))},b}(Tc),gg=function(a){function b(b,c,d){this._o=b,this._d=c,this._s=d,this._q=[],a.call(this)}return Wb(b,a),b.prototype.next=function(a){var b=this._s.now();for(this._q.push({interval:b,value:a});this._q.length>0&&b-this._q[0].interval>=this._d;)this._q.shift()},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){for(var a=this._s.now();this._q.length>0;){var b=this._q.shift();a-b.interval<=this._d&&this._o.onNext(b.value)}this._o.onCompleted()},b}(Nc);Mc.takeLastWithTime=function(a,b){return pc(b)||(b=Bc),new fg(this,a,b)},Mc.takeLastBufferWithTime=function(a,b){var c=this;return pc(b)||(b=Bc),new xg(function(d){var e=[];return c.subscribe(function(c){var d=b.now();for(e.push({interval:d,value:c});e.length>0&&d-e[0].interval>=a;)e.shift()},function(a){d.onError(a)},function(){for(var c=b.now(),f=[];e.length>0;){var g=e.shift();c-g.interval<=a&&f.push(g.value)}d.onNext(f),d.onCompleted()})},c)};var hg=function(a){function b(b,c,d){this.source=b,this._d=c,this._s=d,a.call(this)}function c(a,b){b.onCompleted()}return Wb(b,a),b.prototype.subscribeCore=function(a){return new jc(this._s.scheduleFuture(a,this._d,c),this.source.subscribe(a))},b}(Tc);Mc.takeWithTime=function(a,b){return pc(b)||(b=Bc),new hg(this,a,b)};var ig=function(a){function b(b,c,d){this.source=b,this._d=c,this._s=d,this._open=!1,a.call(this)}function c(a,b){b._open=!0}return Wb(b,a),b.prototype.subscribeCore=function(a){return new jc(this._s.scheduleFuture(this,this._d,c),this.source.subscribe(new jg(a,this)))},b}(Tc),jg=function(a){function b(b,c){this._o=b,this._p=c,a.call(this)}return Wb(b,a),b.prototype.next=function(a){this._p._open&&this._o.onNext(a)},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onCompleted()},b}(Nc);Mc.skipWithTime=function(a,b){return pc(b)||(b=Bc),new ig(this,a,b)};var kg=function(a){function b(b,c,d){this.source=b,this._st=c,this._s=d,a.call(this)}function c(a,b){b._open=!0}return Wb(b,a),b.prototype.subscribeCore=function(a){return this._open=!1,new jc(this._s.scheduleFuture(this,this._st,c),this.source.subscribe(new lg(a,this)))},b}(Tc),lg=function(a){function b(b,c){this._o=b,this._p=c,a.call(this)}return Wb(b,a),b.prototype.next=function(a){this._p._open&&this._o.onNext(a)},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onCompleted()},b}(Nc);Mc.skipUntilWithTime=function(a,b){return pc(b)||(b=Bc),new kg(this,a,b)},Mc.takeUntilWithTime=function(a,b){pc(b)||(b=Bc);var c=this;return new xg(function(d){return new jc(b.scheduleFuture(d,a,function(a,b){b.onCompleted()}),c.subscribe(d))},c)},Mc.throttle=function(a,b){pc(b)||(b=Bc);var c=+a||0;if(0>=c)throw new RangeError("windowDuration cannot be less or equal zero.");var d=this;return new xg(function(a){var e=0;return d.subscribe(function(d){var f=b.now();(0===e||f-e>=c)&&(e=f,a.onNext(d))},function(b){a.onError(b)},function(){a.onCompleted()})},d)};var mg=function(a){function b(b,c){this._o=b,this._xform=c,a.call(this)}return Wb(b,a),b.prototype.next=function(a){ var b=$a(this._xform["@@transducer/step"]).call(this._xform,this._o,a);b===Za&&this._o.onError(b.e)},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._xform["@@transducer/result"](this._o)},b}(Nc);Mc.transduce=function(a){var b=this;return new xg(function(c){var d=a(Da(c));return b.subscribe(new mg(c,d))},b)};var ng=function(a){function b(b){this.source=b,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){var b=new hc,c=new _b,d={hasCurrent:!1,isStopped:!1,o:a,g:c};return c.add(b),b.setDisposable(this.source.subscribe(new og(d))),c},b}(Tc),og=function(a){function b(b){this._s=b,a.call(this)}function c(b,c){this._s=b,this._i=c,a.call(this)}return Wb(b,a),b.prototype.next=function(a){if(!this._s.hasCurrent){this._s.hasCurrent=!0,Xa(a)&&(a=dd(a));var b=new hc;this._s.g.add(b),b.setDisposable(a.subscribe(new c(this._s,b)))}},b.prototype.error=function(a){this._s.o.onError(a)},b.prototype.completed=function(){this._s.isStopped=!0,!this._s.hasCurrent&&1===this._s.g.length&&this._s.o.onCompleted()},Wb(c,a),c.prototype.next=function(a){this._s.o.onNext(a)},c.prototype.error=function(a){this._s.o.onError(a)},c.prototype.completed=function(){this._s.g.remove(this._i),this._s.hasCurrent=!1,this._s.isStopped&&1===this._s.g.length&&this._s.o.onCompleted()},b}(Nc);Mc.switchFirst=function(){return new ng(this)},Mc.flatMapFirst=Mc.exhaustMap=function(a,b,c){return new Uc(this,a,b,c).switchFirst()},Mc.flatMapWithMaxConcurrent=Mc.flatMapMaxConcurrent=function(a,b,c,d){return new Uc(this,b,c,d).merge(a)};var pg=Qa.VirtualTimeScheduler=function(a){function b(b,c){this.clock=b,this.comparer=c,this.isEnabled=!1,this.queue=new Zb(1024),a.call(this)}Wb(b,a);var c=b.prototype;return c.now=function(){return this.toAbsoluteTime(this.clock)},c.schedule=function(a,b){return this.scheduleAbsolute(a,this.clock,b)},c.scheduleFuture=function(a,b,c){var d=b instanceof Date?this.toRelativeTime(b-this.now()):this.toRelativeTime(b);return this.scheduleRelative(a,d,c)},c.add=jb,c.toAbsoluteTime=jb,c.toRelativeTime=jb,c.schedulePeriodic=function(a,b,c){var d=new sc(this,a,b,c);return d.start()},c.scheduleRelative=function(a,b,c){var d=this.add(this.clock,b);return this.scheduleAbsolute(a,d,c)},c.start=function(){if(!this.isEnabled){this.isEnabled=!0;do{var a=this.getNext();null!==a?(this.comparer(a.dueTime,this.clock)>0&&(this.clock=a.dueTime),a.invoke()):this.isEnabled=!1}while(this.isEnabled)}},c.stop=function(){this.isEnabled=!1},c.advanceTo=function(a){var b=this.comparer(this.clock,a);if(this.comparer(this.clock,a)>0)throw new gb;if(0!==b&&!this.isEnabled){this.isEnabled=!0;do{var c=this.getNext();null!==c&&this.comparer(c.dueTime,a)<=0?(this.comparer(c.dueTime,this.clock)>0&&(this.clock=c.dueTime),c.invoke()):this.isEnabled=!1}while(this.isEnabled);this.clock=a}},c.advanceBy=function(a){var b=this.add(this.clock,a),c=this.comparer(this.clock,b);if(c>0)throw new gb;0!==c&&this.advanceTo(b)},c.sleep=function(a){var b=this.add(this.clock,a);if(this.comparer(this.clock,b)>=0)throw new gb;this.clock=b},c.getNext=function(){for(;this.queue.length>0;){var a=this.queue.peek();if(!a.isCancelled())return a;this.queue.dequeue()}return null},c.scheduleAbsolute=function(a,b,c){function d(a,b){return e.queue.remove(f),c(a,b)}var e=this,f=new mc(this,a,d,b,this.comparer);return this.queue.enqueue(f),f.disposable},b}(nc);Qa.HistoricalScheduler=function(a){function b(b,c){var d=null==b?0:b,e=c||Va;a.call(this,d,e)}Wb(b,a);var c=b.prototype;return c.add=function(a,b){return a+b},c.toAbsoluteTime=function(a){return new Date(a).getTime()},c.toRelativeTime=function(a){return a},b}(Qa.VirtualTimeScheduler),Ea.prototype.equals=function(a){return a===this?!0:null==a?!1:"N"!==a.kind?!1:this.predicate(a.value)},Fa.prototype.equals=function(a){return a===this?!0:null==a?!1:"E"!==a.kind?!1:this.predicate(a.error)};var qg=Qa.ReactiveTest={created:100,subscribed:200,disposed:1e3,onNext:function(a,b){return"function"==typeof b?new rg(a,new Ea(b)):new rg(a,Dc.createOnNext(b))},onError:function(a,b){return"function"==typeof b?new rg(a,new Fa(b)):new rg(a,Dc.createOnError(b))},onCompleted:function(a){return new rg(a,Dc.createOnCompleted())},subscribe:function(a,b){return new sg(a,b)}},rg=Qa.Recorded=function(a,b,c){this.time=a,this.value=b,this.comparer=c||Ua};rg.prototype.equals=function(a){return this.time===a.time&&this.comparer(this.value,a.value)},rg.prototype.toString=function(){return this.value.toString()+"@"+this.time};var sg=Qa.Subscription=function(a,b){this.subscribe=a,this.unsubscribe=b||Number.MAX_VALUE};sg.prototype.equals=function(a){return this.subscribe===a.subscribe&&this.unsubscribe===a.unsubscribe},sg.prototype.toString=function(){return"("+this.subscribe+", "+(this.unsubscribe===Number.MAX_VALUE?"Infinite":this.unsubscribe)+")"};var tg=Qa.MockDisposable=function(a){this.scheduler=a,this.disposes=[],this.disposes.push(this.scheduler.clock)};tg.prototype.dispose=function(){this.disposes.push(this.scheduler.clock)};var ug=function(a){function b(b){a.call(this),this.scheduler=b,this.messages=[]}Wb(b,a);var c=b.prototype;return c.onNext=function(a){this.messages.push(new rg(this.scheduler.clock,Dc.createOnNext(a)))},c.onError=function(a){this.messages.push(new rg(this.scheduler.clock,Dc.createOnError(a)))},c.onCompleted=function(){this.messages.push(new rg(this.scheduler.clock,Dc.createOnCompleted()))},b}(Kc);Ga.prototype.then=function(b,c){var d=this;this.subscriptions.push(new sg(this.scheduler.clock));var e,f=this.subscriptions.length-1,g=Qa.Observer.create(function(c){var h=b(c);if(h&&"function"==typeof h.then)e=h;else{var i=d.scheduler.clock;e=new Ga(d.scheduler,[Qa.ReactiveTest.onNext(i,a),Qa.ReactiveTest.onCompleted(i)])}var j=d.observers.indexOf(g);d.observers.splice(j,1),d.subscriptions[f]=new sg(d.subscriptions[f].subscribe,d.scheduler.clock)},function(a){c(a);var b=d.observers.indexOf(g);d.observers.splice(b,1),d.subscriptions[f]=new sg(d.subscriptions[f].subscribe,d.scheduler.clock)});return this.observers.push(g),e||new Ga(this.scheduler,this.messages)};var vg=function(a){function b(b,c){a.call(this);var d,e,f=this;this.scheduler=b,this.messages=c,this.subscriptions=[],this.observers=[];for(var g=0,h=this.messages.length;h>g;g++)d=this.messages[g],e=d.value,function(a){b.scheduleAbsolute(null,d.time,function(){for(var b=f.observers.slice(0),c=0,d=b.length;d>c;c++)a.accept(b[c]);return dc})}(e)}return Wb(b,a),b.prototype._subscribe=function(a){var b=this;this.observers.push(a),this.subscriptions.push(new sg(this.scheduler.clock));var c=this.subscriptions.length-1;return cc(function(){var d=b.observers.indexOf(a);b.observers.splice(d,1),b.subscriptions[c]=new sg(b.subscriptions[c].subscribe,b.scheduler.clock)})},b}(Sc),wg=function(a){function b(b,c){a.call(this),this.scheduler=b,this.messages=c,this.subscriptions=[]}return Wb(b,a),b.prototype._subscribe=function(a){var b,c,d=this;this.subscriptions.push(new sg(this.scheduler.clock));for(var e=this.subscriptions.length-1,f=new _b,g=0,h=this.messages.length;h>g;g++)b=this.messages[g],c=b.value,function(c){f.add(d.scheduler.scheduleRelative(null,b.time,function(){return c.accept(a),dc}))}(c);return cc(function(){d.subscriptions[e]=new sg(d.subscriptions[e].subscribe,d.scheduler.clock),f.dispose()})},b}(Sc);Qa.TestScheduler=function(a){function b(a,b){return a>b?1:b>a?-1:0}function c(){a.call(this,0,b)}return Wb(c,a),c.prototype.scheduleAbsolute=function(b,c,d){return c<=this.clock&&(c=this.clock+1),a.prototype.scheduleAbsolute.call(this,b,c,d)},c.prototype.add=function(a,b){return a+b},c.prototype.toAbsoluteTime=function(a){return new Date(a).getTime()},c.prototype.toRelativeTime=function(a){return a},c.prototype.startScheduler=function(a,b){b||(b={}),null==b.created&&(b.created=qg.created),null==b.subscribed&&(b.subscribed=qg.subscribed),null==b.disposed&&(b.disposed=qg.disposed);var c,d,e=this.createObserver();return this.scheduleAbsolute(null,b.created,function(){return c=a(),dc}),this.scheduleAbsolute(null,b.subscribed,function(){return d=c.subscribe(e),dc}),this.scheduleAbsolute(null,b.disposed,function(){return d.dispose(),dc}),this.start(),e},c.prototype.createHotObservable=function(){var a,b=arguments.length;if(Array.isArray(arguments[0]))a=arguments[0];else{a=new Array(b);for(var c=0;b>c;c++)a[c]=arguments[c]}return new vg(this,a)},c.prototype.createColdObservable=function(){var a,b=arguments.length;if(Array.isArray(arguments[0]))a=arguments[0];else{a=new Array(b);for(var c=0;b>c;c++)a[c]=arguments[c]}return new wg(this,a)},c.prototype.createResolvedPromise=function(a,b){return new Ga(this,[Qa.ReactiveTest.onNext(a,b),Qa.ReactiveTest.onCompleted(a)])},c.prototype.createRejectedPromise=function(a,b){return new Ga(this,[Qa.ReactiveTest.onError(a,b)])},c.prototype.createObserver=function(){return new ug(this)},c}(pg);var xg=Qa.AnonymousObservable=function(a){function b(a){return a&&Ya(a.dispose)?a:Ya(a)?cc(a):dc}function c(a,c){var d=c[0],f=c[1],g=$a(f.__subscribe).call(f,d);g!==Za||d.fail(Za.e)||e(Za.e),d.setDisposable(b(g))}function d(b,c){this.source=c,this.__subscribe=b,a.call(this)}return Wb(d,a),d.prototype._subscribe=function(a){var b=new yg(a),d=[b,this];return wc.scheduleRequired()?wc.schedule(d,c):c(null,d),b},d}(Sc),yg=function(a){function b(b){a.call(this),this.observer=b,this.m=new hc}Wb(b,a);var c=b.prototype;return c.next=function(a){var b=$a(this.observer.onNext).call(this.observer,a);b===Za&&(this.dispose(),e(b.e))},c.error=function(a){var b=$a(this.observer.onError).call(this.observer,a);this.dispose(),b===Za&&e(b.e)},c.completed=function(){var a=$a(this.observer.onCompleted).call(this.observer);this.dispose(),a===Za&&e(a.e)},c.setDisposable=function(a){this.m.setDisposable(a)},c.getDisposable=function(){return this.m.getDisposable()},c.dispose=function(){a.prototype.dispose.call(this),this.m.dispose()},b}(Nc),zg=function(a){function b(b,c){this._m=b,this._u=c,a.call(this)}return Wb(b,a),b.prototype.subscribeCore=function(a){return new jc(this._m.getDisposable(),this._u.subscribe(a))},b}(Tc),Ag=function(a){function b(b,c,d){a.call(this),this.key=b,this.underlyingObservable=d?new zg(d,c):c}return Wb(b,a),b.prototype._subscribe=function(a){return this.underlyingObservable.subscribe(a)},b}(Sc),Bg=Qa.Subject=function(a){function b(){a.call(this),this.isDisposed=!1,this.isStopped=!1,this.observers=[],this.hasError=!1}return Wb(b,a),Xb(b.prototype,Kc.prototype,{_subscribe:function(a){return fc(this),this.isStopped?this.hasError?(a.onError(this.error),dc):(a.onCompleted(),dc):(this.observers.push(a),new Cf(this,a))},hasObservers:function(){return fc(this),this.observers.length>0},onCompleted:function(){if(fc(this),!this.isStopped){this.isStopped=!0;for(var a=0,b=c(this.observers),d=b.length;d>a;a++)b[a].onCompleted();this.observers.length=0}},onError:function(a){if(fc(this),!this.isStopped){this.isStopped=!0,this.error=a,this.hasError=!0;for(var b=0,d=c(this.observers),e=d.length;e>b;b++)d[b].onError(a);this.observers.length=0}},onNext:function(a){if(fc(this),!this.isStopped)for(var b=0,d=c(this.observers),e=d.length;e>b;b++)d[b].onNext(a)},dispose:function(){this.isDisposed=!0,this.observers=null}}),b.create=function(a,b){return new Fg(a,b)},b}(Sc),Cg=Qa.AsyncSubject=function(a){function b(){a.call(this),this.isDisposed=!1,this.isStopped=!1,this.hasValue=!1,this.observers=[],this.hasError=!1}return Wb(b,a),Xb(b.prototype,Kc.prototype,{_subscribe:function(a){return fc(this),this.isStopped?(this.hasError?a.onError(this.error):this.hasValue?(a.onNext(this.value),a.onCompleted()):a.onCompleted(),dc):(this.observers.push(a),new Cf(this,a))},hasObservers:function(){return fc(this),this.observers.length>0},onCompleted:function(){var a,b;if(fc(this),!this.isStopped){this.isStopped=!0;var d=c(this.observers),b=d.length;if(this.hasValue)for(a=0;b>a;a++){var e=d[a];e.onNext(this.value),e.onCompleted()}else for(a=0;b>a;a++)d[a].onCompleted();this.observers.length=0}},onError:function(a){if(fc(this),!this.isStopped){this.isStopped=!0,this.hasError=!0,this.error=a;for(var b=0,d=c(this.observers),e=d.length;e>b;b++)d[b].onError(a);this.observers.length=0}},onNext:function(a){fc(this),this.isStopped||(this.value=a,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.error=null,this.value=null}}),b}(Sc),Dg=Qa.BehaviorSubject=function(a){function b(b){a.call(this),this.value=b,this.observers=[],this.isDisposed=!1,this.isStopped=!1,this.hasError=!1}return Wb(b,a),Xb(b.prototype,Kc.prototype,{_subscribe:function(a){return fc(this),this.isStopped?(this.hasError?a.onError(this.error):a.onCompleted(),dc):(this.observers.push(a),a.onNext(this.value),new Cf(this,a))},getValue:function(){return fc(this),this.hasError&&e(this.error),this.value},hasObservers:function(){return fc(this),this.observers.length>0},onCompleted:function(){if(fc(this),!this.isStopped){this.isStopped=!0;for(var a=0,b=c(this.observers),d=b.length;d>a;a++)b[a].onCompleted();this.observers.length=0}},onError:function(a){if(fc(this),!this.isStopped){this.isStopped=!0,this.hasError=!0,this.error=a;for(var b=0,d=c(this.observers),e=d.length;e>b;b++)d[b].onError(a);this.observers.length=0}},onNext:function(a){if(fc(this),!this.isStopped){this.value=a;for(var b=0,d=c(this.observers),e=d.length;e>b;b++)d[b].onNext(a)}},dispose:function(){this.isDisposed=!0,this.observers=null,this.value=null,this.error=null}}),b}(Sc),Eg=Qa.ReplaySubject=function(a){function b(a,b){return cc(function(){b.dispose(),!a.isDisposed&&a.observers.splice(a.observers.indexOf(b),1)})}function d(b,c,d){this.bufferSize=null==b?e:b,this.windowSize=null==c?e:c,this.scheduler=d||wc,this.q=[],this.observers=[],this.isStopped=!1,this.isDisposed=!1,this.hasError=!1,this.error=null,a.call(this)}var e=Math.pow(2,53)-1;return Wb(d,a),Xb(d.prototype,Kc.prototype,{_subscribe:function(a){fc(this);var c=new Qc(this.scheduler,a),d=b(this,c);this._trim(this.scheduler.now()),this.observers.push(c);for(var e=0,f=this.q.length;f>e;e++)c.onNext(this.q[e].value);return this.hasError?c.onError(this.error):this.isStopped&&c.onCompleted(),c.ensureActive(),d},hasObservers:function(){return fc(this),this.observers.length>0},_trim:function(a){for(;this.q.length>this.bufferSize;)this.q.shift();for(;this.q.length>0&&a-this.q[0].interval>this.windowSize;)this.q.shift()},onNext:function(a){if(fc(this),!this.isStopped){var b=this.scheduler.now();this.q.push({interval:b,value:a}),this._trim(b);for(var d=0,e=c(this.observers),f=e.length;f>d;d++){var g=e[d];g.onNext(a),g.ensureActive()}}},onError:function(a){if(fc(this),!this.isStopped){this.isStopped=!0,this.error=a,this.hasError=!0;var b=this.scheduler.now();this._trim(b);for(var d=0,e=c(this.observers),f=e.length;f>d;d++){var g=e[d];g.onError(a),g.ensureActive()}this.observers.length=0}},onCompleted:function(){if(fc(this),!this.isStopped){this.isStopped=!0;var a=this.scheduler.now();this._trim(a);for(var b=0,d=c(this.observers),e=d.length;e>b;b++){var f=d[b];f.onCompleted(),f.ensureActive()}this.observers.length=0}},dispose:function(){this.isDisposed=!0,this.observers=null}}),d}(Sc),Fg=Qa.AnonymousSubject=function(a){function b(b,c){this.observer=b,this.observable=c,a.call(this)}return Wb(b,a),Xb(b.prototype,Kc.prototype,{_subscribe:function(a){return this.observable.subscribe(a)},onCompleted:function(){this.observer.onCompleted()},onError:function(a){this.observer.onError(a)},onNext:function(a){this.observer.onNext(a)}}),b}(Sc);Qa.Pauser=function(a){function b(){a.call(this)}return Wb(b,a),b.prototype.pause=function(){this.onNext(!1)},b.prototype.resume=function(){this.onNext(!0)},b}(Bg),"function"==typeof define&&"object"==typeof define.amd&&define.amd?(Pa.Rx=Qa,define(function(){return Qa})):Ia&&Ja?Na?(Ja.exports=Qa).Rx=Qa:Ia.Rx=Qa:Pa.Rx=Qa;var Gg=j()}).call(this); //# sourceMappingURL=rx.all.map