UNPKG

rxjs-compat

Version:

<img src="doc/asset/Rx_Logo_S.png" alt="RxJS Logo" width="86" height="86"> RxJS: Reactive Extensions For JavaScript ======================================

111 lines (109 loc) 133 kB
/* ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. *****************************************************************************/ (function(m,h){"object"===typeof exports&&"undefined"!==typeof module?h(exports):"function"===typeof define&&define.amd?define("rxjs",["exports"],h):h(m.rxjs={})})(this,function(m){function h(b,a){function c(){this.constructor=b}xd(b,a);b.prototype=null===a?Object.create(a):(c.prototype=a.prototype,new c)}function P(b){return"function"===typeof b}function Q(b){setTimeout(function(){throw b;},0)}function xa(b){return null!==b&&"object"===typeof b}function Ta(b){Error.call(this);this.message=b?b.length+ " errors occurred during unsubscription:\n"+b.map(function(a,c){return c+1+") "+a.toString()}).join("\n "):"";this.name="UnsubscriptionError";this.errors=b;return this}function Ua(b){return b.reduce(function(a,c){return a.concat(c instanceof ca?c.errors:c)},[])}function ya(b){for(;b;){var a=b.destination,c=b.isStopped;if(b.closed||c)return!1;b=a&&a instanceof l?a:null}return!0}function D(){}function za(){for(var b=[],a=0;a<arguments.length;a++)b[a]=arguments[a];return Va(b)}function Va(b){return b? 1===b.length?b[0]:function(a){return b.reduce(function(c,a){return a(c)},a)}:D}function Wa(b){b||(b=C.Promise||Promise);if(!b)throw Error("no Promise impl found");return b}function G(){Error.call(this);this.message="object unsubscribed";this.name="ObjectUnsubscribedError";return this}function Aa(){return function(b){return b.lift(new yd(b))}}function Xa(b,a,c,d){return function(e){return e.lift(new zd(b,a,c,d))}}function R(b){return b?Ad(b):da}function Ad(b){return new g(function(a){return b.schedule(function(){return a.complete()})})} function w(b){return b&&"function"===typeof b.schedule}function Ba(b,a){return new g(function(c){var d=new r,e=0;d.add(a.schedule(function(){e===b.length?c.complete():(c.next(b[e++]),c.closed||d.add(this.schedule()))}));return d})}function ea(b,a){return a?Ba(b,a):new g(Ya(b))}function fa(){for(var b=[],a=0;a<arguments.length;a++)b[a]=arguments[a];a=b[b.length-1];return w(a)?(b.pop(),Ba(b,a)):ea(b)}function na(b,a){return a?new g(function(c){return a.schedule(Bd,0,{error:b,subscriber:c})}):new g(function(c){return c.error(b)})} function Bd(b){b.subscriber.error(b.error)}function Za(b,a){void 0===a&&(a=0);return function(c){return c.lift(new Cd(b,a))}}function S(b){return b}function $a(){Error.call(this);this.message="argument out of range";this.name="ArgumentOutOfRangeError";return this}function ab(){Error.call(this);this.message="no elements in sequence";this.name="EmptyError";return this}function bb(){Error.call(this);this.message="Timeout has occurred";this.name="TimeoutError";return this}function A(b,a){return function(c){if("function"!== typeof b)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return c.lift(new Dd(b,a))}}function cb(b,a,c){if(a)if(w(a))c=a;else return function(){for(var d=[],e=0;e<arguments.length;e++)d[e]=arguments[e];return cb(b,c).apply(void 0,d).pipe(A(function(c){return x(c)?a.apply(void 0,c):a(c)}))};return function(){for(var a=[],e=0;e<arguments.length;e++)a[e]=arguments[e];var f=this,k,y={context:f,subject:k,callbackFunc:b,scheduler:c};return new g(function(d){if(c)return c.schedule(Ed, 0,{args:a,subscriber:d,params:y});if(!k){k=new T;try{b.apply(f,a.concat([function(){for(var c=[],a=0;a<arguments.length;a++)c[a]=arguments[a];k.next(1>=c.length?c[0]:c);k.complete()}]))}catch(L){ya(k)?k.error(L):console.warn(L)}}return k.subscribe(d)})}}function Ed(b){var a=this,c=b.args,d=b.subscriber;b=b.params;var e=b.callbackFunc,f=b.context,k=b.scheduler,g=b.subject;if(!g){g=b.subject=new T;try{e.apply(f,c.concat([function(){for(var c=[],b=0;b<arguments.length;b++)c[b]=arguments[b];a.add(k.schedule(Fd, 0,{value:1>=c.length?c[0]:c,subject:g}))}]))}catch(z){g.error(z)}}this.add(g.subscribe(d))}function Fd(b){var a=b.subject;a.next(b.value);a.complete()}function db(b,a,c){if(a)if(w(a))c=a;else return function(){for(var d=[],e=0;e<arguments.length;e++)d[e]=arguments[e];return db(b,c).apply(void 0,d).pipe(A(function(c){return x(c)?a.apply(void 0,c):a(c)}))};return function(){for(var a=[],e=0;e<arguments.length;e++)a[e]=arguments[e];var f={subject:void 0,args:a,callbackFunc:b,scheduler:c,context:this}; return new g(function(d){var e=f.context,k=f.subject;if(c)return c.schedule(Gd,0,{params:f,subscriber:d,context:e});if(!k){k=f.subject=new T;try{b.apply(e,a.concat([function(){for(var c=[],a=0;a<arguments.length;a++)c[a]=arguments[a];(a=c.shift())?k.error(a):(k.next(1>=c.length?c[0]:c),k.complete())}]))}catch(L){ya(k)?k.error(L):console.warn(L)}}return k.subscribe(d)})}}function Gd(b){var a=this,c=b.params,d=b.subscriber;b=b.context;var e=c.callbackFunc,f=c.args,k=c.scheduler,g=c.subject;if(!g){g= c.subject=new T;try{e.apply(b,f.concat([function(){for(var c=[],b=0;b<arguments.length;b++)c[b]=arguments[b];(b=c.shift())?a.add(k.schedule(eb,0,{err:b,subject:g})):a.add(k.schedule(Hd,0,{value:1>=c.length?c[0]:c,subject:g}))}]))}catch(z){this.add(k.schedule(eb,0,{err:z,subject:g}))}}this.add(g.subscribe(d))}function Hd(b){var a=b.subject;a.next(b.value);a.complete()}function eb(b){b.subject.error(b.err)}function fb(b){return!!b&&"function"!==typeof b.subscribe&&"function"===typeof b.then}function n(b, a,c,d,e){void 0===e&&(e=new H(b,c,d));if(!e.closed)return a instanceof g?a.subscribe(e):gb(a)(e)}function Id(b,a){return new g(function(c){var d=new r;d.add(a.schedule(function(){var e=b[U]();d.add(e.subscribe({next:function(b){d.add(a.schedule(function(){return c.next(b)}))},error:function(b){d.add(a.schedule(function(){return c.error(b)}))},complete:function(){d.add(a.schedule(function(){return c.complete()}))}}))}));return d})}function Jd(b,a){return new g(function(c){var d=new r;d.add(a.schedule(function(){return b.then(function(b){d.add(a.schedule(function(){c.next(b); d.add(a.schedule(function(){return c.complete()}))}))},function(b){d.add(a.schedule(function(){return c.error(b)}))})}));return d})}function Kd(b,a){if(!b)throw Error("Iterable cannot be null");return new g(function(c){var d=new r,e;d.add(function(){e&&"function"===typeof e.return&&e.return()});d.add(a.schedule(function(){e=b[E]();d.add(a.schedule(function(){if(!c.closed){var a,b;try{var d=e.next();a=d.value;b=d.done}catch(z){c.error(z);return}b?c.complete():(c.next(a),this.schedule())}}))}));return d})} function Ld(b,a){if(null!=b){if(b&&"function"===typeof b[U])return Id(b,a);if(fb(b))return Jd(b,a);if(hb(b))return Ba(b,a);if(b&&"function"===typeof b[E]||"string"===typeof b)return Kd(b,a)}throw new TypeError((null!==b&&typeof b||b)+" is not observable");}function F(b,a){return a?Ld(b,a):b instanceof g?b:new g(gb(b))}function I(b,a,c){void 0===c&&(c=Number.POSITIVE_INFINITY);if("function"===typeof a)return function(d){return d.pipe(I(function(c,d){return F(b(c,d)).pipe(A(function(b,e){return a(c, b,d,e)}))},c))};"number"===typeof a&&(c=a);return function(a){return a.lift(new Md(b,c))}}function oa(b){void 0===b&&(b=Number.POSITIVE_INFINITY);return I(S,b)}function Ca(){return oa(1)}function V(){for(var b=[],a=0;a<arguments.length;a++)b[a]=arguments[a];return Ca()(fa.apply(void 0,b))}function Da(b){return new g(function(a){var c;try{c=b()}catch(d){a.error(d);return}return(c?F(c):R()).subscribe(a)})}function pa(b,a){return new g(function(c){var d=b.length;if(0===d)c.complete();else for(var e= Array(d),f=0,k=0,g=function(g){var y=F(b[g]),h=!1;c.add(y.subscribe({next:function(c){h||(h=!0,k++);e[g]=c},error:function(a){return c.error(a)},complete:function(){f++;f!==d&&h||(k===d&&c.next(a?a.reduce(function(c,a,b){return c[a]=e[b],c},{}):e),c.complete())}}))},h=0;h<d;h++)g(h)})}function ib(b,a,c,d){P(c)&&(d=c,c=void 0);return d?ib(b,a,c).pipe(A(function(c){return x(c)?d.apply(void 0,c):d(c)})):new g(function(d){jb(b,a,function(c){1<arguments.length?d.next(Array.prototype.slice.call(arguments)): d.next(c)},d,c)})}function jb(b,a,c,d,e){var f;if(b&&"function"===typeof b.addEventListener&&"function"===typeof b.removeEventListener)b.addEventListener(a,c,e),f=function(){return b.removeEventListener(a,c,e)};else if(b&&"function"===typeof b.on&&"function"===typeof b.off)b.on(a,c),f=function(){return b.off(a,c)};else if(b&&"function"===typeof b.addListener&&"function"===typeof b.removeListener)b.addListener(a,c),f=function(){return b.removeListener(a,c)};else if(b&&b.length)for(var k=0,g=b.length;k< g;k++)jb(b[k],a,c,d,e);else throw new TypeError("Invalid event target");d.add(f)}function kb(b,a,c){return c?kb(b,a).pipe(A(function(a){return x(a)?c.apply(void 0,a):c(a)})):new g(function(c){var d=function(){for(var a=[],b=0;b<arguments.length;b++)a[b]=arguments[b];return c.next(1===a.length?a[0]:a)},f;try{f=b(d)}catch(k){c.error(k);return}if(P(a))return function(){return a(d,f)}})}function Qd(b){var a=b.subscriber,c=b.condition;if(!a.closed){if(b.needIterate)try{b.state=b.iterate(b.state)}catch(f){a.error(f); return}else b.needIterate=!0;if(c){var d=void 0;try{d=c(b.state)}catch(f){a.error(f);return}if(!d){a.complete();return}if(a.closed)return}var e;try{e=b.resultSelector(b.state)}catch(f){a.error(f);return}if(!a.closed&&(a.next(e),!a.closed))return this.schedule(b)}}function J(b){return!x(b)&&0<=b-parseFloat(b)+1}function Rd(b){var a=b.subscriber,c=b.counter;b=b.period;a.next(c);this.schedule({subscriber:a,counter:c+1,period:b},b)}function Ea(){for(var b=[],a=0;a<arguments.length;a++)b[a]=arguments[a]; var a=Number.POSITIVE_INFINITY,c=null,d=b[b.length-1];w(d)?(c=b.pop(),1<b.length&&"number"===typeof b[b.length-1]&&(a=b.pop())):"number"===typeof d&&(a=b.pop());return null===c&&1===b.length&&b[0]instanceof g?b[0]:oa(a)(ea(b,c))}function Fa(){for(var b=[],a=0;a<arguments.length;a++)b[a]=arguments[a];if(0===b.length)return da;var c=b[0],d=b.slice(1);return 1===b.length&&x(c)?Fa.apply(void 0,c):new g(function(a){var b=function(){return a.add(Fa.apply(void 0,d).subscribe(a))};return F(c).subscribe({next:function(c){a.next(c)}, error:b,complete:b})})}function Sd(b){var a=b.keys,c=b.index,d=b.subscriber,e=b.subscription;b=b.obj;if(!d.closed)if(c<a.length){var f=a[c];d.next([f,b[f]]);e.add(this.schedule({keys:a,index:c+1,subscriber:d,subscription:e,obj:b}))}else d.complete()}function Td(b,a){function c(){return!c.pred.apply(c.thisArg,arguments)}c.pred=b;c.thisArg=a;return c}function M(b,a){return function(c){return c.lift(new Ud(b,a))}}function lb(){for(var b=[],a=0;a<arguments.length;a++)b[a]=arguments[a];if(1===b.length)if(x(b[0]))b= b[0];else return b[0];return ea(b,void 0).lift(new Vd)}function Wd(b){var a=b.start,c=b.index,d=b.subscriber;c>=b.count?d.complete():(d.next(a),d.closed||(b.index=c+1,b.start=a+1,this.schedule(b)))}function mb(b,a,c){void 0===b&&(b=0);var d=-1;J(a)?d=1>Number(a)&&1||Number(a):w(a)&&(c=a);w(c)||(c=q);return new g(function(a){var e=J(b)?b:+b-c.now();return c.schedule(Xd,e,{index:0,period:d,subscriber:a})})}function Xd(b){var a=b.index,c=b.period,d=b.subscriber;d.next(a);if(!d.closed){if(-1===c)return d.complete(); b.index=a+1;this.schedule(b,c)}}function Ga(){for(var b=[],a=0;a<arguments.length;a++)b[a]=arguments[a];a=b[b.length-1];"function"===typeof a&&b.pop();return ea(b,void 0).lift(new nb(a))}function Yd(b,a){void 0===a&&(a=null);return new N({method:"GET",url:b,headers:a})}function Zd(b,a,c){return new N({method:"POST",url:b,body:a,headers:c})}function $d(b,a){return new N({method:"DELETE",url:b,headers:a})}function ae(b,a,c){return new N({method:"PUT",url:b,body:a,headers:c})}function be(b,a,c){return new N({method:"PATCH", url:b,body:a,headers:c})}function ce(b,a){return de(new N({method:"GET",url:b,responseType:"json",headers:a}))}function ob(b,a,c){Error.call(this);this.message=b;this.name="AjaxError";this.xhr=a;this.request=c;this.status=a.status;this.responseType=a.responseType||c.responseType;this.response=pb(this.responseType,a);return this}function pb(b,a){switch(b){case "json":return b="response"in a?a.responseType?a.response:JSON.parse(a.response||a.responseText||"null"):JSON.parse(a.responseText||"null"), b;case "xml":return a.responseXML;default:return"response"in a?a.response:a.responseText}}function qb(b){return new rb(b)}function sb(b){void 0===b&&(b=q);return A(function(a){return new tb(a,b.now())})}function W(b,a){var c=!1;2<=arguments.length&&(c=!0);return function(d){return d.lift(new ee(b,a,c))}}function ub(b){void 0===b&&(b=q);return function(a){return Da(function(){return a.pipe(W(function(c,a){c=c.current;return{value:a,current:b.now(),last:c}},{current:b.now(),value:void 0,last:void 0}), A(function(c){return new vb(c.value,c.current-c.last)}))})}}function wb(b,a){void 0===a&&(a=qa);return function(c){return c.lift(new fe(b,a.leading,a.trailing))}}function xb(b,a){for(var c=0,d=a.length;c<d;c++)for(var e=a[c],f=Object.getOwnPropertyNames(e.prototype),k=0,g=f.length;k<g;k++){var h=f[k];b.prototype[h]=e.prototype[h]}}function Ha(b){return function(a){return a.lift(new ge(b))}}function yb(b,a){void 0===a&&(a=q);return Ha(function(){return mb(b,a)})}function zb(b){return function(a){return a.lift(new he(b))}} function Ab(b,a){void 0===a&&(a=null);return function(c){return c.lift(new ie(b,a))}}function Bb(b){var a=arguments.length,c=q;w(arguments[arguments.length-1])&&(c=arguments[arguments.length-1],a--);var d=null;2<=a&&(d=arguments[1]);var e=Number.POSITIVE_INFINITY;3<=a&&(e=arguments[2]);return function(a){return a.lift(new je(b,d,e,c))}}function Cb(b){var a=b.subscriber,c=b.context;c&&a.closeContext(c);a.closed||(b.context=a.openContext(),b.context.closeAction=this.schedule(b,b.bufferTimeSpan))}function ke(b){var a= b.bufferCreationInterval,c=b.bufferTimeSpan,d=b.subscriber,e=b.scheduler,f=d.openContext();d.closed||(d.add(f.closeAction=e.schedule(Db,c,{subscriber:d,context:f})),this.schedule(b,a))}function Db(b){b.subscriber.closeContext(b.context)}function Eb(b,a){return function(c){return c.lift(new le(b,a))}}function Fb(b){return function(a){return a.lift(new me(b))}}function Gb(b){return function(a){var c=new ne(b);a=a.lift(c);return c.caught=a}}function Hb(b){return function(a){return a.lift(new ra(b))}} function Ia(b,a){return I(b,a,1)}function Ib(b,a){return Ia(function(){return b},a)}function Jb(b){return function(a){return a.lift(new oe(b,a))}}function Kb(b){return function(a){return a.lift(new pe(b))}}function Lb(b,a){void 0===a&&(a=q);return function(c){return c.lift(new qe(b,a))}}function re(b){b.debouncedNext()}function X(b){void 0===b&&(b=null);return function(a){return a.lift(new se(b))}}function Mb(b,a){void 0===a&&(a=q);var c=b instanceof Date&&!isNaN(+b)?+b-a.now():Math.abs(b);return function(b){return b.lift(new te(c, a))}}function Nb(b,a){return a?function(c){return(new ue(c,a)).lift(new Ob(b))}:function(c){return c.lift(new Ob(b))}}function Pb(){return function(b){return b.lift(new ve)}}function Qb(b,a){return function(c){return c.lift(new we(b,a))}}function Ja(b,a){return function(c){return c.lift(new xe(b,a))}}function Rb(b,a){return Ja(function(c,d){return a?a(c[b],d[b]):c[b]===d[b]})}function sa(b){void 0===b&&(b=ye);return function(a){return a.lift(new ze(b))}}function ye(){return new ga}function ta(b){return function(a){return 0=== b?R():a.lift(new Ae(b))}}function Sb(b,a){if(0>b)throw new Y;var c=2<=arguments.length;return function(d){return d.pipe(M(function(c,a){return a===b}),ta(1),c?X(a):sa(function(){return new Y}))}}function Tb(b,a){return function(c){return c.lift(new Be(b,a,c))}}function Ub(){return function(b){return b.lift(new Ce)}}function Ka(b,a){return a?function(c){return c.pipe(Ka(function(c,e){return F(b(c,e)).pipe(A(function(b,d){return a(c,b,e,d)}))}))}:function(c){return c.lift(new De(b))}}function Vb(b, a,c){void 0===a&&(a=Number.POSITIVE_INFINITY);void 0===c&&(c=void 0);a=1>(a||0)?Number.POSITIVE_INFINITY:a;return function(d){return d.lift(new Ee(b,a,c))}}function Wb(b){return function(a){return a.lift(new Fe(b))}}function Xb(b,a){if("function"!==typeof b)throw new TypeError("predicate is not a function");return function(c){return c.lift(new Yb(b,c,!1,a))}}function Zb(b,a){return function(c){return c.lift(new Yb(b,c,!0,a))}}function $b(b,a){var c=2<=arguments.length;return function(d){return d.pipe(b? M(function(c,a){return b(c,a,d)}):S,ta(1),c?X(a):sa(function(){return new ga}))}}function ac(){return function(b){return b.lift(new Ge)}}function bc(){return function(b){return b.lift(new He)}}function ha(b){return function(a){return 0===b?R():a.lift(new Ie(b))}}function cc(b,a){var c=2<=arguments.length;return function(d){return d.pipe(b?M(function(c,a){return b(c,a,d)}):S,ha(1),c?X(a):sa(function(){return new ga}))}}function dc(b){return function(a){return a.lift(new Je(b))}}function ec(){return function(b){return b.lift(new Ke)}} function Z(b,a){return 2<=arguments.length?function(c){return za(W(b,a),ha(1),X(a))(c)}:function(c){return za(W(function(c,a,f){return b(c,a,f+1)}),ha(1))(c)}}function fc(b){return Z("function"===typeof b?function(a,c){return 0<b(a,c)?a:c}:function(a,c){return a>c?a:c})}function gc(b,a,c){void 0===c&&(c=Number.POSITIVE_INFINITY);if("function"===typeof a)return I(function(){return b},a,c);"number"===typeof a&&(c=a);return I(function(){return b},c)}function hc(b,a,c){void 0===c&&(c=Number.POSITIVE_INFINITY); return function(d){return d.lift(new Le(b,a,c))}}function ic(b){return Z("function"===typeof b?function(a,c){return 0>b(a,c)?a:c}:function(a,c){return a<c?a:c})}function K(b,a){return function(c){var d;d="function"===typeof b?b:function(){return b};if("function"===typeof a)return c.lift(new Me(d,a));var e=Object.create(c,Ne);e.source=c;e.subjectFactory=d;return e}}function jc(){for(var b=[],a=0;a<arguments.length;a++)b[a]=arguments[a];1===b.length&&x(b[0])&&(b=b[0]);return function(c){return c.lift(new Oe(b))}} function kc(){return function(b){return b.lift(new Pe)}}function lc(b,a){return function(c){return[M(b,a)(c),M(Td(b,a))(c)]}}function mc(){for(var b=[],a=0;a<arguments.length;a++)b[a]=arguments[a];var c=b.length;if(0===c)throw Error("list of properties cannot be empty.");return function(a){return A(Qe(b,c))(a)}}function Qe(b,a){return function(c){var d=c;for(c=0;c<a;c++)if(d=d[b[c]],"undefined"===typeof d)return;return d}}function nc(b){return b?K(function(){return new u},b):K(new u)}function oc(b){return function(a){return K(new pc(b))(a)}} function qc(){return function(b){return K(new T)(b)}}function rc(b,a,c,d){c&&"function"!==typeof c&&(d=c);var e="function"===typeof c?c:void 0,f=new aa(b,a,d);return function(c){return K(function(){return f},e)(c)}}function sc(){for(var b=[],a=0;a<arguments.length;a++)b[a]=arguments[a];return function(c){1===b.length&&x(b[0])&&(b=b[0]);return c.lift.call(lb.apply(void 0,[c].concat(b)))}}function tc(b){void 0===b&&(b=-1);return function(a){return 0===b?R():0>b?a.lift(new uc(-1,a)):a.lift(new uc(b- 1,a))}}function vc(b){return function(a){return a.lift(new Re(b))}}function wc(b){void 0===b&&(b=-1);return function(a){return a.lift(new Se(b,a))}}function xc(b){return function(a){return a.lift(new Te(b,a))}}function yc(b){return function(a){return a.lift(new Ue(b))}}function zc(b,a){void 0===a&&(a=q);return function(c){return c.lift(new Ve(b,a))}}function We(b){var a=b.period;b.subscriber.notifyNext();this.schedule(b,a)}function Ac(b,a){return function(c){return c.lift(new Xe(b,a))}}function Ye(){return new u} function Bc(){return function(b){return Aa()(K(Ye)(b))}}function La(b,a,c){var d;d=b&&"object"===typeof b?b:{bufferSize:b,windowTime:a,refCount:!1,scheduler:c};return function(c){return c.lift(Ze(d))}}function Ze(b){var a=b.bufferSize,c=void 0===a?Number.POSITIVE_INFINITY:a,a=b.windowTime,d=void 0===a?Number.POSITIVE_INFINITY:a,e=b.refCount,f=b.scheduler,k,g=0,h,l=!1,t=!1;return function(a){g++;if(!k||l)l=!1,k=new aa(c,d,f),h=a.subscribe({next:function(c){k.next(c)},error:function(c){l=!0;k.error(c)}, complete:function(){t=!0;k.complete()}});var b=k.subscribe(this);this.add(function(){g--;b.unsubscribe();h&&!t&&e&&0===g&&(h.unsubscribe(),k=h=void 0)})}}function Cc(b){return function(a){return a.lift(new $e(b,a))}}function Dc(b){return function(a){return a.lift(new af(b))}}function Ec(b){return function(a){return a.lift(new bf(b))}}function Fc(b){return function(a){return a.lift(new cf(b))}}function Gc(b){return function(a){return a.lift(new df(b))}}function Hc(){for(var b=[],a=0;a<arguments.length;a++)b[a]= arguments[a];var c=b[b.length-1];return w(c)?(b.pop(),function(a){return V(b,a,c)}):function(c){return V(b,c)}}function Ic(b,a){void 0===a&&(a=0);return function(c){return c.lift(new ef(b,a))}}function ba(b,a){return"function"===typeof a?function(c){return c.pipe(ba(function(c,e){return F(b(c,e)).pipe(A(function(b,d){return a(c,b,e,d)}))}))}:function(c){return c.lift(new ff(b))}}function Jc(){return ba(S)}function Kc(b,a){return a?ba(function(){return b},a):ba(function(){return b})}function Lc(b){return function(a){return a.lift(new gf(b))}} function Mc(b,a){void 0===a&&(a=!1);return function(c){return c.lift(new hf(b,a))}}function Nc(b,a,c){return function(d){return d.lift(new jf(b,a,c))}}function Oc(b,a,c){void 0===a&&(a=q);void 0===c&&(c=qa);return function(d){return d.lift(new kf(b,a,c.leading,c.trailing))}}function lf(b){b.subscriber.clearThrottle()}function Ma(b,a,c){void 0===c&&(c=q);return function(d){var e=b instanceof Date&&!isNaN(+b),f=e?+b-c.now():Math.abs(b);return d.lift(new mf(f,e,a,c))}}function Pc(b,a){void 0===a&&(a= q);return Ma(b,na(new Qc),a)}function nf(b,a,c){if(0===c)return[a];b.push(a);return b}function Rc(){return Z(nf,[])}function Sc(b){return function(a){return a.lift(new of(b))}}function Tc(b,a){void 0===a&&(a=0);return function(c){return c.lift(new pf(b,a))}}function Uc(b,a,c,d){var e=q,f=null,k=Number.POSITIVE_INFINITY;w(d)&&(e=d);w(c)?e=c:J(c)&&(k=c);w(a)?e=a:J(a)&&(f=a);return function(c){return c.lift(new qf(b,f,k,e))}}function rf(b){var a=b.subscriber,c=b.windowTimeSpan,d=b.window;d&&a.closeWindow(d); b.window=a.openWindow();this.schedule(b,c)}function sf(b){var a=b.windowTimeSpan,c=b.subscriber,d=b.scheduler,e=b.windowCreationInterval,f=c.openWindow(),k={action:this,subscription:null};k.subscription=d.schedule(Vc,a,{subscriber:c,window:f,context:k});this.add(k.subscription);this.schedule(b,e)}function Vc(b){var a=b.subscriber,c=b.window;(b=b.context)&&b.action&&b.subscription&&b.action.remove(b.subscription);a.closeWindow(c)}function Wc(b,a){return function(c){return c.lift(new tf(b,a))}}function Xc(b){return function(a){return a.lift(new uf(b))}} function Yc(){for(var b=[],a=0;a<arguments.length;a++)b[a]=arguments[a];return function(c){var a;"function"===typeof b[b.length-1]&&(a=b.pop());return c.lift(new vf(b,a))}}function Zc(b){return function(a){return a.lift(new nb(b))}}function $c(b){return Gb(b)(this)}function ad(b,a,c){return Nc(b,a,c)(this)}function bd(b){return Wb(b)(this)}function cd(b){return b(this)}function dd(b,a){void 0===a&&(a=Number.POSITIVE_INFINITY);return I(b,a)(this)}function ed(b,a){void 0===a&&(a=Number.POSITIVE_INFINITY); return gc(b,a)(this)}function fd(){return Jc()(this)}var xd=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(b,a){b.__proto__=a}||function(b,a){for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c])},wf=Object.assign||function(b){for(var a,c=1,d=arguments.length;c<d;c++){a=arguments[c];for(var e in a)Object.prototype.hasOwnProperty.call(a,e)&&(b[e]=a[e])}return b},Na=!1,C={Promise:void 0,set useDeprecatedSynchronousErrorHandling(b){b?console.warn("DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \n"+ Error().stack):Na&&console.log("RxJS: Back to a better error behavior. Thank you. \x3c3");Na=b},get useDeprecatedSynchronousErrorHandling(){return Na}},ua={closed:!0,next:function(b){},error:function(b){if(C.useDeprecatedSynchronousErrorHandling)throw b;Q(b)},complete:function(){}},x=Array.isArray||function(b){return b&&"number"===typeof b.length};Ta.prototype=Object.create(Error.prototype);var ca=Ta,r=function(){function b(a){this.closed=!1;this._subscriptions=this._parentOrParents=null;a&&(this._unsubscribe= a)}b.prototype.unsubscribe=function(){var a;if(!this.closed){var c=this._parentOrParents,d=this._unsubscribe,e=this._subscriptions;this.closed=!0;this._subscriptions=this._parentOrParents=null;if(c instanceof b)c.remove(this);else if(null!==c)for(var f=0;f<c.length;++f)c[f].remove(this);if(P(d))try{d.call(this)}catch(k){a=k instanceof ca?Ua(k.errors):[k]}if(x(e))for(f=-1,c=e.length;++f<c;)if(d=e[f],xa(d))try{d.unsubscribe()}catch(k){a=a||[],k instanceof ca?a=a.concat(Ua(k.errors)):a.push(k)}if(a)throw new ca(a); }};b.prototype.add=function(a){var c=a;if(!a)return b.EMPTY;switch(typeof a){case "function":c=new b(a);case "object":if(c===this||c.closed||"function"!==typeof c.unsubscribe)return c;if(this.closed)return c.unsubscribe(),c;c instanceof b||(a=c,c=new b,c._subscriptions=[a]);break;default:throw Error("unrecognized teardown "+a+" added to Subscription.");}a=c._parentOrParents;if(null===a)c._parentOrParents=this;else if(a instanceof b){if(a===this)return c;c._parentOrParents=[a,this]}else if(-1===a.indexOf(this))a.push(this); else return c;a=this._subscriptions;null===a?this._subscriptions=[c]:a.push(c);return c};b.prototype.remove=function(a){var c=this._subscriptions;c&&(a=c.indexOf(a),-1!==a&&c.splice(a,1))};b.EMPTY=function(a){a.closed=!0;return a}(new b);return b}(),ia="function"===typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random(),l=function(b){function a(c,d,e){var f=b.call(this)||this;f.syncErrorValue=null;f.syncErrorThrown=!1;f.syncErrorThrowable=!1;f.isStopped=!1;switch(arguments.length){case 0:f.destination= ua;break;case 1:if(!c){f.destination=ua;break}if("object"===typeof c){c instanceof a?(f.syncErrorThrowable=c.syncErrorThrowable,f.destination=c,c.add(f)):(f.syncErrorThrowable=!0,f.destination=new gd(f,c));break}default:f.syncErrorThrowable=!0,f.destination=new gd(f,c,d,e)}return f}h(a,b);a.prototype[ia]=function(){return this};a.create=function(c,b,e){c=new a(c,b,e);c.syncErrorThrowable=!1;return c};a.prototype.next=function(c){this.isStopped||this._next(c)};a.prototype.error=function(c){this.isStopped|| (this.isStopped=!0,this._error(c))};a.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())};a.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,b.prototype.unsubscribe.call(this))};a.prototype._next=function(c){this.destination.next(c)};a.prototype._error=function(c){this.destination.error(c);this.unsubscribe()};a.prototype._complete=function(){this.destination.complete();this.unsubscribe()};a.prototype._unsubscribeAndRecycle=function(){var c=this._parentOrParents; this._parentOrParents=null;this.unsubscribe();this.isStopped=this.closed=!1;this._parentOrParents=c;return this};return a}(r),gd=function(b){function a(c,a,e,f){var d=b.call(this)||this;d._parentSubscriber=c;var g;c=d;P(a)?g=a:a&&(g=a.next,e=a.error,f=a.complete,a!==ua&&(c=Object.create(a),P(c.unsubscribe)&&d.add(c.unsubscribe.bind(c)),c.unsubscribe=d.unsubscribe.bind(d)));d._context=c;d._next=g;d._error=e;d._complete=f;return d}h(a,b);a.prototype.next=function(c){if(!this.isStopped&&this._next){var a= this._parentSubscriber;C.useDeprecatedSynchronousErrorHandling&&a.syncErrorThrowable?this.__tryOrSetError(a,this._next,c)&&this.unsubscribe():this.__tryOrUnsub(this._next,c)}};a.prototype.error=function(c){if(!this.isStopped){var a=this._parentSubscriber,b=C.useDeprecatedSynchronousErrorHandling;if(this._error)b&&a.syncErrorThrowable?this.__tryOrSetError(a,this._error,c):this.__tryOrUnsub(this._error,c),this.unsubscribe();else if(a.syncErrorThrowable)b?(a.syncErrorValue=c,a.syncErrorThrown=!0):Q(c), this.unsubscribe();else{this.unsubscribe();if(b)throw c;Q(c)}}};a.prototype.complete=function(){var c=this;if(!this.isStopped){var a=this._parentSubscriber;if(this._complete){var b=function(){return c._complete.call(c._context)};C.useDeprecatedSynchronousErrorHandling&&a.syncErrorThrowable?this.__tryOrSetError(a,b):this.__tryOrUnsub(b)}this.unsubscribe()}};a.prototype.__tryOrUnsub=function(c,a){try{c.call(this._context,a)}catch(e){this.unsubscribe();if(C.useDeprecatedSynchronousErrorHandling)throw e; Q(e)}};a.prototype.__tryOrSetError=function(c,a,b){if(!C.useDeprecatedSynchronousErrorHandling)throw Error("bad call");try{a.call(this._context,b)}catch(f){return C.useDeprecatedSynchronousErrorHandling?(c.syncErrorValue=f,c.syncErrorThrown=!0):Q(f),!0}return!1};a.prototype._unsubscribe=function(){var c=this._parentSubscriber;this._parentSubscriber=this._context=null;c.unsubscribe()};return a}(l),U="function"===typeof Symbol&&Symbol.observable||"@@observable",g=function(){function b(a){this._isScalar= !1;a&&(this._subscribe=a)}b.prototype.lift=function(a){var c=new b;c.source=this;c.operator=a;return c};b.prototype.subscribe=function(a,c,b){var d=this.operator;a:{if(a){if(a instanceof l)break a;if(a[ia]){a=a[ia]();break a}}a=a||c||b?new l(a,c,b):new l(ua)}d?a.add(d.call(a,this.source)):a.add(this.source||C.useDeprecatedSynchronousErrorHandling&&!a.syncErrorThrowable?this._subscribe(a):this._trySubscribe(a));if(C.useDeprecatedSynchronousErrorHandling&&a.syncErrorThrowable&&(a.syncErrorThrowable= !1,a.syncErrorThrown))throw a.syncErrorValue;return a};b.prototype._trySubscribe=function(a){try{return this._subscribe(a)}catch(c){C.useDeprecatedSynchronousErrorHandling&&(a.syncErrorThrown=!0,a.syncErrorValue=c),ya(a)?a.error(c):console.warn(c)}};b.prototype.forEach=function(a,c){var b=this;c=Wa(c);return new c(function(c,d){var e;e=b.subscribe(function(c){try{a(c)}catch(z){d(z),e&&e.unsubscribe()}},d,c)})};b.prototype._subscribe=function(a){var c=this.source;return c&&c.subscribe(a)};b.prototype[U]= function(){return this};b.prototype.pipe=function(){for(var a=[],c=0;c<arguments.length;c++)a[c]=arguments[c];return 0===a.length?this:Va(a)(this)};b.prototype.toPromise=function(a){var c=this;a=Wa(a);return new a(function(a,b){var d;c.subscribe(function(c){return d=c},function(c){return b(c)},function(){return a(d)})})};b.create=function(a){return new b(a)};return b}();G.prototype=Object.create(Error.prototype);var hd=function(b){function a(c,a){var d=b.call(this)||this;d.subject=c;d.subscriber= a;d.closed=!1;return d}h(a,b);a.prototype.unsubscribe=function(){if(!this.closed){this.closed=!0;var c=this.subject,a=c.observers;this.subject=null;!a||0===a.length||c.isStopped||c.closed||(c=a.indexOf(this.subscriber),-1!==c&&a.splice(c,1))}};return a}(r),id=function(b){function a(c){var a=b.call(this,c)||this;a.destination=c;return a}h(a,b);return a}(l),u=function(b){function a(){var c=b.call(this)||this;c.observers=[];c.closed=!1;c.isStopped=!1;c.hasError=!1;c.thrownError=null;return c}h(a,b); a.prototype[ia]=function(){return new id(this)};a.prototype.lift=function(c){var a=new va(this,this);a.operator=c;return a};a.prototype.next=function(c){if(this.closed)throw new G;if(!this.isStopped)for(var a=this.observers,b=a.length,a=a.slice(),f=0;f<b;f++)a[f].next(c)};a.prototype.error=function(c){if(this.closed)throw new G;this.hasError=!0;this.thrownError=c;this.isStopped=!0;for(var a=this.observers,b=a.length,a=a.slice(),f=0;f<b;f++)a[f].error(c);this.observers.length=0};a.prototype.complete= function(){if(this.closed)throw new G;this.isStopped=!0;for(var c=this.observers,a=c.length,c=c.slice(),b=0;b<a;b++)c[b].complete();this.observers.length=0};a.prototype.unsubscribe=function(){this.closed=this.isStopped=!0;this.observers=null};a.prototype._trySubscribe=function(c){if(this.closed)throw new G;return b.prototype._trySubscribe.call(this,c)};a.prototype._subscribe=function(c){if(this.closed)throw new G;if(this.hasError)return c.error(this.thrownError),r.EMPTY;if(this.isStopped)return c.complete(), r.EMPTY;this.observers.push(c);return new hd(this,c)};a.prototype.asObservable=function(){var c=new g;c.source=this;return c};a.create=function(c,a){return new va(c,a)};return a}(g),va=function(b){function a(c,a){var d=b.call(this)||this;d.destination=c;d.source=a;return d}h(a,b);a.prototype.next=function(c){var a=this.destination;a&&a.next&&a.next(c)};a.prototype.error=function(c){var a=this.destination;a&&a.error&&this.destination.error(c)};a.prototype.complete=function(){var c=this.destination; c&&c.complete&&this.destination.complete()};a.prototype._subscribe=function(c){return this.source?this.source.subscribe(c):r.EMPTY};return a}(u),yd=function(){function b(a){this.connectable=a}b.prototype.call=function(a,c){var b=this.connectable;b._refCount++;a=new xf(a,b);c=c.subscribe(a);a.closed||(a.connection=b.connect());return c};return b}(),xf=function(b){function a(c,a){c=b.call(this,c)||this;c.connectable=a;return c}h(a,b);a.prototype._unsubscribe=function(){var c=this.connectable;if(c){this.connectable= null;var a=c._refCount;0>=a?this.connection=null:(c._refCount=a-1,1<a?this.connection=null:(a=this.connection,c=c._connection,this.connection=null,!c||a&&c!==a||c.unsubscribe()))}else this.connection=null};return a}(l),jd=function(b){function a(c,a){var d=b.call(this)||this;d.source=c;d.subjectFactory=a;d._refCount=0;d._isComplete=!1;return d}h(a,b);a.prototype._subscribe=function(c){return this.getSubject().subscribe(c)};a.prototype.getSubject=function(){var c=this._subject;if(!c||c.isStopped)this._subject= this.subjectFactory();return this._subject};a.prototype.connect=function(){var c=this._connection;c||(this._isComplete=!1,c=this._connection=new r,c.add(this.source.subscribe(new yf(this.getSubject(),this))),c.closed&&(this._connection=null,c=r.EMPTY));return c};a.prototype.refCount=function(){return Aa()(this)};return a}(g),ja=jd.prototype,Ne={operator:{value:null},_refCount:{value:0,writable:!0},_subject:{value:null,writable:!0},_connection:{value:null,writable:!0},_subscribe:{value:ja._subscribe}, _isComplete:{value:ja._isComplete,writable:!0},getSubject:{value:ja.getSubject},connect:{value:ja.connect},refCount:{value:ja.refCount}},yf=function(b){function a(c,a){c=b.call(this,c)||this;c.connectable=a;return c}h(a,b);a.prototype._error=function(c){this._unsubscribe();b.prototype._error.call(this,c)};a.prototype._complete=function(){this.connectable._isComplete=!0;this._unsubscribe();b.prototype._complete.call(this)};a.prototype._unsubscribe=function(){var c=this.connectable;if(c){this.connectable= null;var a=c._connection;c._refCount=0;c._subject=null;c._connection=null;a&&a.unsubscribe()}};return a}(id);(function(b){function a(c,a){c=b.call(this,c)||this;c.connectable=a;return c}h(a,b);a.prototype._unsubscribe=function(){var c=this.connectable;if(c){this.connectable=null;var a=c._refCount;0>=a?this.connection=null:(c._refCount=a-1,1<a?this.connection=null:(a=this.connection,c=c._connection,this.connection=null,!c||a&&c!==a||c.unsubscribe()))}else this.connection=null};return a})(l);var zd= function(){function b(a,c,b,e){this.keySelector=a;this.elementSelector=c;this.durationSelector=b;this.subjectSelector=e}b.prototype.call=function(a,c){return c.subscribe(new zf(a,this.keySelector,this.elementSelector,this.durationSelector,this.subjectSelector))};return b}(),zf=function(b){function a(c,a,e,f,k){c=b.call(this,c)||this;c.keySelector=a;c.elementSelector=e;c.durationSelector=f;c.subjectSelector=k;c.groups=null;c.attemptedToUnsubscribe=!1;c.count=0;return c}h(a,b);a.prototype._next=function(c){var a; try{a=this.keySelector(c)}catch(e){this.error(e);return}this._group(c,a)};a.prototype._group=function(c,a){var b=this.groups;b||(b=this.groups=new Map);var d=b.get(a),k;if(this.elementSelector)try{k=this.elementSelector(c)}catch(y){this.error(y)}else k=c;if(!d&&(d=this.subjectSelector?this.subjectSelector():new u,b.set(a,d),c=new kd(a,d,this),this.destination.next(c),this.durationSelector)){c=void 0;try{c=this.durationSelector(new kd(a,d))}catch(y){this.error(y);return}this.add(c.subscribe(new Af(a, d,this)))}d.closed||d.next(k)};a.prototype._error=function(c){var a=this.groups;a&&(a.forEach(function(a,b){a.error(c)}),a.clear());this.destination.error(c)};a.prototype._complete=function(){var c=this.groups;c&&(c.forEach(function(c,a){c.complete()}),c.clear());this.destination.complete()};a.prototype.removeGroup=function(c){this.groups.delete(c)};a.prototype.unsubscribe=function(){this.closed||(this.attemptedToUnsubscribe=!0,0===this.count&&b.prototype.unsubscribe.call(this))};return a}(l),Af= function(b){function a(c,a,e){var d=b.call(this,a)||this;d.key=c;d.group=a;d.parent=e;return d}h(a,b);a.prototype._next=function(c){this.complete()};a.prototype._unsubscribe=function(){var c=this.parent,a=this.key;this.key=this.parent=null;c&&c.removeGroup(a)};return a}(l),kd=function(b){function a(c,a,e){var d=b.call(this)||this;d.key=c;d.groupSubject=a;d.refCountSubscription=e;return d}h(a,b);a.prototype._subscribe=function(c){var a=new r,b=this.refCountSubscription,f=this.groupSubject;b&&!b.closed&& a.add(new Bf(b));a.add(f.subscribe(c));return a};return a}(g),Bf=function(b){function a(c){var a=b.call(this)||this;a.parent=c;c.count++;return a}h(a,b);a.prototype.unsubscribe=function(){var c=this.parent;c.closed||this.closed||(b.prototype.unsubscribe.call(this),--c.count,0===c.count&&c.attemptedToUnsubscribe&&c.unsubscribe())};return a}(r),pc=function(b){function a(c){var a=b.call(this)||this;a._value=c;return a}h(a,b);Object.defineProperty(a.prototype,"value",{get:function(){return this.getValue()}, enumerable:!0,configurable:!0});a.prototype._subscribe=function(c){var a=b.prototype._subscribe.call(this,c);a&&!a.closed&&c.next(this._value);return a};a.prototype.getValue=function(){if(this.hasError)throw this.thrownError;if(this.closed)throw new G;return this._value};a.prototype.next=function(c){b.prototype.next.call(this,this._value=c)};return a}(u),ka=function(b){function a(c,a){var d=b.call(this,c,a)||this;d.scheduler=c;d.work=a;d.pending=!1;return d}h(a,b);a.prototype.schedule=function(c, a){void 0===a&&(a=0);if(this.closed)return this;this.state=c;c=this.id;var b=this.scheduler;null!=c&&(this.id=this.recycleAsyncId(b,c,a));this.pending=!0;this.delay=a;this.id=this.id||this.requestAsyncId(b,this.id,a);return this};a.prototype.requestAsyncId=function(c,a,b){void 0===b&&(b=0);return setInterval(c.flush.bind(c,this),b)};a.prototype.recycleAsyncId=function(c,a,b){void 0===b&&(b=0);if(null!==b&&this.delay===b&&!1===this.pending)return a;clearInterval(a)};a.prototype.execute=function(c, a){if(this.closed)return Error("executing a cancelled action");this.pending=!1;if(c=this._execute(c,a))return c;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))};a.prototype._execute=function(c,a){a=!1;var b=void 0;try{this.work(c)}catch(f){a=!0,b=!!f&&f||Error(f)}if(a)return this.unsubscribe(),b};a.prototype._unsubscribe=function(){var c=this.id,a=this.scheduler,b=a.actions,f=b.indexOf(this);this.state=this.work=null;this.pending=!1;this.scheduler=null; -1!==f&&b.splice(f,1);null!=c&&(this.id=this.recycleAsyncId(a,c,null));this.delay=null};return a}(function(b){function a(c,a){return b.call(this)||this}h(a,b);a.prototype.schedule=function(c,a){return this};return a}(r)),Cf=function(b){function a(c,a){var d=b.call(this,c,a)||this;d.scheduler=c;d.work=a;return d}h(a,b);a.prototype.schedule=function(c,a){void 0===a&&(a=0);if(0<a)return b.prototype.schedule.call(this,c,a);this.delay=a;this.state=c;this.scheduler.flush(this);return this};a.prototype.execute= function(c,a){return 0<a||this.closed?b.prototype.execute.call(this,c,a):this._execute(c,a)};a.prototype.requestAsyncId=function(c,a,e){void 0===e&&(e=0);return null!==e&&0<e||null===e&&0<this.delay?b.prototype.requestAsyncId.call(this,c,a,e):c.flush(this)};return a}(ka),ld=function(){function b(a,c){void 0===c&&(c=b.now);this.SchedulerAction=a;this.now=c}b.prototype.schedule=function(a,c,b){void 0===c&&(c=0);return(new this.SchedulerAction(this,a)).schedule(b,c)};b.now=function(){return Date.now()}; return b}(),O=function(b){function a(c,d){void 0===d&&(d=ld.now);var e=b.call(this,c,function(){return a.delegate&&a.delegate!==e?a.delegate.now():d()})||this;e.actions=[];e.active=!1;e.scheduled=void 0;return e}h(a,b);a.prototype.schedule=function(c,d,e){void 0===d&&(d=0);return a.delegate&&a.delegate!==this?a.delegate.schedule(c,d,e):b.prototype.schedule.call(this,c,d,e)};a.prototype.flush=function(c){var a=this.actions;if(this.active)a.push(c);else{var b;this.active=!0;do if(b=c.execute(c.state, c.delay))break;while(c=a.shift());this.active=!1;if(b){for(;c=a.shift();)c.unsubscribe();throw b;}}};return a}(ld),md=new (function(b){function a(){return null!==b&&b.apply(this,arguments)||this}h(a,b);return a}(O))(Cf),da=new g(function(b){return b.complete()}),Ya=function(b){return function(a){for(var c=0,d=b.length;c<d&&!a.closed;c++)a.next(b[c]);a.complete()}},nd;(function(b){b.NEXT="N";b.ERROR="E";b.COMPLETE="C"})(nd||(nd={}));var v=function(){function b(a,c,b){this.kind=a;this.value=c;this.error= b;this.hasValue="N"===a}b.prototype.observe=function(a){switch(this.kind){case "N":return a.next&&a.next(this.value);case "E":return a.error&&a.error(this.error);case "C":return a.complete&&a.complete()}};b.prototype.do=function(a,c,b){switch(this.kind){case "N":return a&&a(this.value);case "E":return c&&c(this.error);case "C":return b&&b()}};b.prototype.accept=function(a,c,b){return a&&"function"===typeof a.next?this.observe(a):this.do(a,c,b)};b.prototype.toObservable=function(){switch(this.kind){case "N":return fa(this.value); case "E":return na(this.error);case "C":return R()}throw Error("unexpected notification kind value");};b.createNext=function(a){return"undefined"!==typeof a?new b("N",a):b.undefinedValueNotification};b.createError=function(a){return new b("E",void 0,a)};b.createComplete=function(){return b.completeNotification};b.completeNotification=new b("C");b.undefinedValueNotification=new b("N",void 0);return b}(),Cd=function(){function b(a,c){void 0===c&&(c=0);this.scheduler=a;this.delay=c}b.prototype.call= function(a,c){return c.subscribe(new od(a,this.scheduler,this.delay))};return b}(),od=function(b){function a(c,a,e){void 0===e&&(e=0);c=b.call(this,c)||this;c.scheduler=a;c.delay=e;return c}h(a,b);a.dispatch=function(c){c.notification.observe(c.destination);this.unsubscribe()};a.prototype.scheduleMessage=function(c){this.destination.add(this.scheduler.schedule(a.dispatch,this.delay,new Df(c,this.destination)))};a.prototype._next=function(c){this.scheduleMessage(v.createNext(c))};a.prototype._error= function(c){this.scheduleMessage(v.createError(c));this.unsubscribe()};a.prototype._complete=function(){this.scheduleMessage(v.createComplete());this.unsubscribe()};return a}(l),Df=function(){return function(b,a){this.notification=b;this.destination=a}}(),aa=function(b){function a(c,a,e){void 0===c&&(c=Number.POSITIVE_INFINITY);void 0===a&&(a=Number.POSITIVE_INFINITY);var d=b.call(this)||this;d.scheduler=e;d._events=[];d._infiniteTimeWindow=!1;d._bufferSize=1>c?1:c;d._windowTime=1>a?1:a;a===Number.POSITIVE_INFINITY? (d._infiniteTimeWindow=!0,d.next=d.nextInfiniteTimeWindow):d.next=d.nextTimeWindow;return d}h(a,b);a.prototype.nextInfiniteTimeWindow=function(c){var a=this._events;a.push(c);a.length>this._bufferSize&&a.shift();b.prototype.next.call(this,c)};a.prototype.nextTimeWindow=function(c){this._events.push(new Ef(this._getNow(),c));this._trimBufferThenGetEvents();b.prototype.next.call(this,c)};a.prototype._subscribe=function(c){var a=this._infiniteTimeWindow,b=a?this._events:this._trimBufferThenGetEvents(), f=this.scheduler,k=b.length,g;if(this.closed)throw new G;this.isStopped||this.hasError?g=r.EMPTY:(this.observers.push(c),g=new hd(this,c));f&&c.add(c=new od(c,f));if(a)for(a=0;a<k&&!c.closed;a++)c.next(b[a]);else for(a=0;a<k&&!c.closed;a++)c.next(b[a].value);this.hasError?c.error(this.thrownError):this.isStopped&&c.complete();return g};a.prototype._getNow=function(){return(this.scheduler||md).now()};a.prototype._trimBufferThenGetEvents=function(){for(var c=this._getNow(),a=this._bufferSize,b=this._windowTime, f=this._events,k=f.length,g=0;g<k&&!(c-f[g].time<b);)g++;k>a&&(g=Math.max(g,k-a));0<g&&f.splice(0,g);return f};return a}(u),Ef=function(){return function(b,a){this.time=b;this.value=a}}(),T=function(b){function a(){var c=null!==b&&b.apply(this,arguments)||this;c.value=null;c.hasNext=!1;c.hasCompleted=!1;return c}h(a,b);a.prototype._subscribe=function(c){return this.hasError?(c.error(this.thrownError),r.EMPTY):this.hasCompleted&&this.hasNext?(c.next(this.value),c.complete(),r.EMPTY):b.prototype._subscribe.call(this, c)};a.prototype.next=function(c){this.hasCompleted||(this.value=c,this.hasNext=!0)};a.prototype.error=function(c){this.hasCompleted||b.prototype.error.call(this,c)};a.prototype.complete=function(){this.hasCompleted=!0;this.hasNext&&b.prototype.next.call(this,this.value);b.prototype.complete.call(this)};return a}(u),Ff=1,Oa={},pd={setImmediate:function(b){var a=Ff++;Oa[a]=b;Promise.resolve().then(function(){var c=Oa[a];c&&c()});return a},clearImmediate:function(b){delete Oa[b]}},Gf=function(b){function a(c, a){var d=b.call(this,c,a)||this;d.scheduler=c;d.work=a;return d}h(a,b);a.prototype.requestAsyncId=function(c,a,e){void 0===e&&(e=0);if(null!==e&&0<e)return b.prototype.requestAsyncId.call(this,c,a,e);c.actions.push(this);return c.scheduled||(c.scheduled=pd.setImmediate(c.flush.bind(c,null)))};a.prototype.recycleAsyncId=function(c,a,e){void 0===e&&(e=0);if(null!==e&&0<e||null===e&&0<this.delay)return b.prototype.recycleAsyncId.call(this,c,a,e);0===c.actions.length&&(pd.clearImmediate(a),c.scheduled= void 0)};return a}(ka),wa=new (function(b){function a(){return null!==b&&b.apply(this,arguments)||this}h(a,b);a.prototype.flush=function(c){this.active=!0;this.scheduled=void 0;var a=this.actions,b,f=-1,k=a.length;c=c||a.shift();do if(b=c.execute(c.state,c.delay))break;while(++f<k&&(c=a.shift()));this.active=!1;if(b){for(;++f<k&&(c=a.shift());)c.unsubscribe();throw b;}};return a}(O))(Gf),q=new O(ka),Hf=function(b){function a(c,a){var d=b.call(this,c,a)||this;d.scheduler=c;d.work=a;return d}h(a,b); a.prototype.requestAsyncId=function(c,a,e){void 0===e&&(e=0);if(null!==e&&0<e)return b.prototype.requestAsyncId.call(this,c,a,e);c.actions.push(this);return c.scheduled||(c.scheduled=requestAnimationFrame(function(){return c.flush(null)}))};a.prototype.recycleAsyncId=function(c,a,e){void 0===e&&(e=0);if(null!==e&&0<e||null===e&&0<this.delay)return b.prototype.recycleAsyncId.call(this,c,a,e);0===c.actions.length&&(cancelAnimationFrame(a),c.scheduled=void 0)};return a}(ka),If=new (function(b){function a(){return null!== b&&b.apply(this,arguments)||this}h(a,b);a.prototype.flush=function(c){this.active=!0;this.scheduled=void 0;var a=this.actions,b,f=-1,k=a.length;c=c||a.shift();do if(b=c.execute(c.state,c.delay))break;while(++f<k&&(c=a.shift()));this.active=!1;if(b){for(;++f<k&&(c=a.shift());)c.unsubscribe();throw b;}};return a}(O))(Hf),rd=function(b){function a(c,a){void 0===c&&(c=qd);void 0===a&&(a=Number.POSITIVE_INFINITY);var d=b.call(this,c,function(){return d.frame})||this;d.maxFrames=a;d.frame=0;d.index=-1; return d}h(a,b);a.prototype.flush=function(){for(var c=this.actions,a=this.maxFrames,b,f;(f=c[0])&&f.delay<=a&&!(c.shift(),this.frame=f.delay,b=f.execute(f.state,f.delay)););if(b){for(;f=c.shift();)f.unsubscribe();throw b;}};a.frameTimeFactor=10;return a}(O),qd=function(b){function a(c,a,e){void 0===e&&(e=c.index+=1);var d=b.call(this,c,a)||this;d.scheduler=c;d.work=a;d.index=e;d.active=!0;d.index=c.index=e;return d}h(a,b);a.prototype.schedule=function(c,d){void 0===d&&(d=0);if(!this.id)return b.prototype.schedule.call(this, c,d);this.active=!1;var e=new a(this.scheduler,this.work);this.add(e);return e.schedule(c,d)};a.prototype.requestAsyncId=function(c,b,e){void 0===e&&(e=0);this.delay=c.frame+e;c=c.actions;c.push(this);c.sort(a.sortActions);return!0};a.prototype.recycleAsyncId=function(c,a,b){};a.prototype._execute=function(c,a){if(!0===this.active)return b.prototype._execute.call(this,c,a)};a.sortActions=function(c,a){return c.delay===a.delay?c.index===a.index?0:c.index>a.index?1:-1:c.delay>a.delay?1:-1};return a}(ka); $a.prototype=Object.create(Error.prototype);var Y=$a;ab.prototype=Object.create(Error.prototype);var ga=ab;bb.prototype=Object.create(Error.prototype);var Qc=bb,Dd=function(){function b(a,c){this.project=a;this.thisArg=c}b.prototype.call=function(a,c){return c.subscribe(new Jf(a,this.project,this.thisArg))};return b}(),Jf=function(b){function a(c,a,e){c=b.call(this,c)||this;c.project=a;c.count=0;c.thisArg=e||c;return c}h(a,b);a.prototype._next=function(c){var a;try{a=this.project.call(this.thisArg, c,this.count++)}catch(e){this.destination.error(e);return}this.destination.next(a)};return a}(l),p=function(b){function a(){return null!==b&&b.apply(this,arguments)||this}h(a,b);a.prototype.notifyNext=function(c,a,b,f,k){this.destination.next(a)};a.prototype.notifyError=function(c,a){this.destination.error(c)};a.prototype.notifyComplete=function(c){this.destination.complete()};return a}(l),H=function(b){function a(c,a,e){var d=b.call(this)||this;d.parent=c;d.outerValue=a;d.outerIndex=e;d.index=0; return d}h(a,b);a.prototype._next=function(c){this.parent.notifyNext(this.outerValue,c,this.outerIndex,this.index++,this)};a.prototype._error=function(c){this.parent.notifyError(c,this);this.unsubscribe()};a.prototype._complete=function(){this.parent.notifyComplete(this);this.unsubscribe()}