/* ***************************************************************************** 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(k,h){"object"===typeof exports&&"undefined"!==typeof module?h(exports):"function"===typeof define&&define.amd?define("rxjs",["exports"],h):h(k.rxjs={})})(this,function(k){function h(c,a){function b(){this.constructor=c}Ob(c,a);c.prototype=null===a?Object.create(a):(b.prototype=a.prototype,new b)}function T(c){return"function"===typeof c}function U(c){setTimeout(function(){throw c;})}function Ja(c){Error.call(this);this.message=c?c.length+" errors occurred during unsubscription:\n"+c.map(function(a, b){return b+1+") "+a.toString()}).join("\n "):"";this.name="UnsubscriptionError";this.errors=c;return this}function Ka(c){return c.reduce(function(a,b){return a.concat(b instanceof aa?b.errors:b)},[])}function pa(c){for(;c;){var a=c.destination,b=c.isStopped;if(c.closed||b)return!1;c=a&&a instanceof m?a:null}return!0}function E(){}function qa(){for(var c=[],a=0;a=b.length?b[0]:b);g.complete()}]))}catch(x){pa(g)?g.error(x):console.warn(x)}}return g.subscribe(d)})}}function Tb(c){var a=this,b=c.args,d=c.subscriber;c=c.params;var e=c.callbackFunc,f=c.context,g=c.scheduler,l=c.subject;if(!l){l=c.subject=new V;try{e.apply(f,b.concat([function(){for(var b=[],c=0;c=b.length?b[0]:b,subject:l}))}]))}catch(v){l.error(v)}}this.add(l.subscribe(d))}function Ub(c){var a=c.subject;a.next(c.value);a.complete()}function Qa(c,a,b){if(a)if(z(a))b=a;else return function(){for(var d=[],e=0;e=b.length?b[0]:b),g.complete())}]))}catch(x){pa(g)?g.error(x):console.warn(x)}}return g.subscribe(d)})}}function Vb(c){var a=this,b=c.params,d=c.subscriber;c=c.context;var e=b.callbackFunc,f=b.args,g=b.scheduler,l=b.subject;if(!l){l= b.subject=new V;try{e.apply(c,f.concat([function(){for(var b=[],c=0;c=b.length?b[0]:b,subject:l}))}]))}catch(v){this.add(g.schedule(Ra,0,{err:v,subject:l}))}}this.add(l.subscribe(d))}function Wb(c){var a=c.subject;a.next(c.value);a.complete()}function Ra(c){c.subject.error(c.err)}function Sa(c){return!!c&&"function"!==typeof c.subscribe&&"function"===typeof c.then}function p(c, a,b,d,e){void 0===e&&(e=new J(c,b,d));if(!e.closed)return Ta(a)(e)}function Xb(c,a){return a?new n(function(b){var d=new t;d.add(a.schedule(function(){return c.then(function(c){d.add(a.schedule(function(){b.next(c);d.add(a.schedule(function(){return b.complete()}))}))},function(c){d.add(a.schedule(function(){return b.error(c)}))})}));return d}):new n(Ua(c))}function Yb(c,a){if(!c)throw Error("Iterable cannot be null");return a?new n(function(b){var d=new t,e;d.add(function(){e&&"function"===typeof e.return&& e.return()});d.add(a.schedule(function(){e=c[I]();d.add(a.schedule(function(){if(!b.closed){var a,c;try{var d=e.next();a=d.value;c=d.done}catch(v){b.error(v);return}c?b.complete():(b.next(a),this.schedule())}}))}));return d}):new n(Va(c))}function Zb(c,a){return a?new n(function(b){var d=new t;d.add(a.schedule(function(){var e=c[W]();d.add(e.subscribe({next:function(c){d.add(a.schedule(function(){return b.next(c)}))},error:function(c){d.add(a.schedule(function(){return b.error(c)}))},complete:function(){d.add(a.schedule(function(){return b.complete()}))}}))})); return d}):new n(Wa(c))}function K(c,a){if(!a)return c instanceof n?c:new n(Ta(c));if(null!=c){if(c&&"function"===typeof c[W])return Zb(c,a);if(Sa(c))return Xb(c,a);if(Xa(c))return H(c,a);if(c&&"function"===typeof c[I]||"string"===typeof c)return Yb(c,a)}throw new TypeError((null!==c&&typeof c||c)+" is not observable");}function P(c,a,b){void 0===b&&(b=Number.POSITIVE_INFINITY);if("function"===typeof a)return function(d){return d.pipe(P(function(b,d){return K(c(b,d)).pipe(C(function(c,e){return a(b, c,d,e)}))},b))};"number"===typeof a&&(b=a);return function(a){return a.lift(new $b(c,b))}}function wa(c){void 0===c&&(c=Number.POSITIVE_INFINITY);return P(N,c)}function Ya(){return wa(1)}function L(){for(var c=[],a=0;a=c.count?d.complete():(d.next(a),d.closed||(c.index=b+1,c.start=a+1,this.schedule(c)))}function eb(c,a,b){void 0===c&&(c=0);var d=-1;X(a)?d=1>Number(a)&&1||Number(a):z(a)&&(b= a);z(b)||(b=y);return new n(function(a){var e=X(c)?c:+c-b.now();return b.schedule(gc,e,{index:0,period:d,subscriber:a})})}function gc(c){var a=c.index,b=c.period,d=c.subscriber;d.next(a);if(!d.closed){if(-1===b)return d.complete();c.index=a+1;this.schedule(c,b)}}function fb(){for(var c=[],a=0;a=a?this.connection=null:(b._refCount=a-1,1=a?this.connection=null:(b._refCount=a-1,1b?1:b;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,c);a.prototype.nextInfiniteTimeWindow=function(b){var a=this._events;a.push(b);a.length>this._bufferSize&&a.shift();c.prototype.next.call(this, b)};a.prototype.nextTimeWindow=function(b){this._events.push(new Zc(this._getNow(),b));this._trimBufferThenGetEvents();c.prototype.next.call(this,b)};a.prototype._subscribe=function(b){var a=this._infiniteTimeWindow,c=a?this._events:this._trimBufferThenGetEvents(),f=this.scheduler,g=c.length,l;if(this.closed)throw new F;this.isStopped||this.hasError?l=t.EMPTY:(this.observers.push(b),l=new ub(this,b));f&&b.add(b=new Ab(b,f));if(a)for(a=0;aa&&(l=Math.max(l,g-a));0a.index?1:-1:b.delay>a.delay?1:-1};return a}(fa);O.prototype=Object.create(Error.prototype);Oa.prototype=Object.create(Error.prototype);var ca=Oa;va.prototype=Object.create(Error.prototype);var Sb=function(){function c(a,b){this.project=a;this.thisArg=b}c.prototype.call=function(a, b){return b.subscribe(new dd(a,this.project,this.thisArg))};return c}(),dd=function(c){function a(b,a,e){b=c.call(this,b)||this;b.project=a;b.count=0;b.thisArg=e||b;return b}h(a,c);a.prototype._next=function(b){var a;try{a=this.project.call(this.thisArg,b,this.count++)}catch(e){this.destination.error(e);return}this.destination.next(a)};return a}(m),q=function(c){function a(){return null!==c&&c.apply(this,arguments)||this}h(a,c);a.prototype.notifyNext=function(b,a,c,f,g){this.destination.next(a)}; a.prototype.notifyError=function(b,a){this.destination.error(b)};a.prototype.notifyComplete=function(b){this.destination.complete()};return a}(m),J=function(c){function a(b,a,e){var d=c.call(this)||this;d.parent=b;d.outerValue=a;d.outerIndex=e;d.index=0;return d}h(a,c);a.prototype._next=function(b){this.parent.notifyNext(this.outerValue,b,this.outerIndex,this.index++,this)};a.prototype._error=function(b){this.parent.notifyError(b,this);this.unsubscribe()};a.prototype._complete=function(){this.parent.notifyComplete(this); this.unsubscribe()};return a}(m),Ua=function(c){return function(a){c.then(function(b){a.closed||(a.next(b),a.complete())},function(b){return a.error(b)}).then(null,U);return a}},I;I="function"===typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";var Va=function(c){return function(a){var b=c[I]();do{var d=b.next();if(d.done){a.complete();break}a.next(d.value);if(a.closed)break}while(1);"function"===typeof b.return&&a.add(function(){b.return&&b.return()});return a}},Wa=function(c){return function(a){var b= c[W]();if("function"!==typeof b.subscribe)throw new TypeError("Provided object does not correctly implement Symbol.observable");return b.subscribe(a)}},Xa=function(c){return c&&"number"===typeof c.length&&"function"!==typeof c},Ta=function(c){if(c instanceof n)return function(a){if(c._isScalar)a.next(c.value),a.complete();else return c.subscribe(a)};if(c&&"function"===typeof c[W])return Wa(c);if(Xa(c))return Na(c);if(Sa(c))return Ua(c);if(c&&"function"===typeof c[I])return Va(c);throw new TypeError("You provided "+ (null!==c&&"object"===typeof c?"an invalid object":"'"+c+"'")+" where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.");},Db={},Ga=function(){function c(a){this.resultSelector=a}c.prototype.call=function(a,b){return b.subscribe(new ed(a,this.resultSelector))};return c}(),ed=function(c){function a(b,a){b=c.call(this,b)||this;b.resultSelector=a;b.active=0;b.values=[];b.observables=[];return b}h(a,c);a.prototype._next=function(b){this.values.push(Db);this.observables.push(b)}; a.prototype._complete=function(){var b=this.observables,a=b.length;if(0===a)this.destination.complete();else{this.toRespond=this.active=a;for(var c=0;cthis.index};c.prototype.hasCompleted=function(){return this.array.length===this.index};return c}(),kd=function(c){function a(b,a,e){b=c.call(this,b)||this;b.parent=a;b.observable=e;b.stillUnsubscribed=!0;b.buffer=[];b.isComplete=!1;return b}h(a,c);a.prototype[I]=function(){return this};a.prototype.next=function(){var b=this.buffer;return 0===b.length&&this.isComplete?{value:null,done:!0}:{value:b.shift(),done:!1}};a.prototype.hasValue=function(){return 0< this.buffer.length};a.prototype.hasCompleted=function(){return 0===this.buffer.length&&this.isComplete};a.prototype.notifyComplete=function(){0e;if(b.timespanOnly)b.add(f.closeAction=g.schedule(ib,a,{subscriber:b,context:f,bufferTimeSpan:a}));else{var d={bufferTimeSpan:a,bufferCreationInterval:e,subscriber:b,scheduler:g};b.add(f.closeAction=g.schedule(jb,a,{subscriber:b, context:f}));b.add(g.schedule(ic,e,d))}return b}h(a,c);a.prototype._next=function(b){for(var a=this.contexts,c=a.length,f,g=0;g=c[0].time-f.now();)c.shift().notification.observe(g);0this.total)throw new O;}c.prototype.call=function(a,b){return b.subscribe(new Ud(a,this.total))};return c}(),Ud=function(c){function a(b,a){b=c.call(this,b)||this;b.total=a;b.count=0;return b}h(a,c);a.prototype._next=function(b){var a=this.total,c=++this.count; c<=a&&(this.destination.next(b),c===a&&(this.destination.complete(),this.unsubscribe()))};return a}(m),Wd=function(){function c(a,b,c){this.predicate=a;this.thisArg=b;this.source=c}c.prototype.call=function(a,b){return b.subscribe(new Vd(a,this.predicate,this.thisArg,this.source))};return c}(),Vd=function(c){function a(b,a,e,f){b=c.call(this,b)||this;b.predicate=a;b.thisArg=e;b.source=f;b.index=0;b.thisArg=e||b;return b}h(a,c);a.prototype.notifyComplete=function(b){this.destination.next(b);this.destination.complete()}; a.prototype._next=function(b){var a=!1;try{a=this.predicate.call(this.thisArg,b,this.index++,this.source)}catch(e){this.destination.error(e);return}a||this.notifyComplete(!1)};a.prototype._complete=function(){this.notifyComplete(!0)};return a}(m),Yd=function(){function c(){}c.prototype.call=function(a,b){return b.subscribe(new Xd(a))};return c}(),Xd=function(c){function a(b){b=c.call(this,b)||this;b.hasCompleted=!1;b.hasSubscription=!1;return b}h(a,c);a.prototype._next=function(b){this.hasSubscription|| (this.hasSubscription=!0,this.add(p(this,b)))};a.prototype._complete=function(){this.hasCompleted=!0;this.hasSubscription||this.destination.complete()};a.prototype.notifyComplete=function(b){this.remove(b);this.hasSubscription=!1;this.hasCompleted&&this.destination.complete()};return a}(q),qc=function(){function c(a){this.project=a}c.prototype.call=function(a,b){return b.subscribe(new Zd(a,this.project))};return c}(),Zd=function(c){function a(b,a){b=c.call(this,b)||this;b.project=a;b.hasSubscription= !1;b.hasCompleted=!1;b.index=0;return b}h(a,c);a.prototype._next=function(b){this.hasSubscription||this.tryNext(b)};a.prototype.tryNext=function(b){var a,c=this.index++;try{a=this.project(b,c)}catch(f){this.destination.error(f);return}this.hasSubscription=!0;this._innerSub(a,b,c)};a.prototype._innerSub=function(b,a,c){var d=new J(this,void 0,void 0);this.destination.add(d);p(this,b,a,c,d)};a.prototype._complete=function(){this.hasCompleted=!0;this.hasSubscription||this.destination.complete();this.unsubscribe()}; a.prototype.notifyNext=function(b,a,c,f,g){this.destination.next(a)};a.prototype.notifyError=function(b){this.destination.error(b)};a.prototype.notifyComplete=function(b){this.destination.remove(b);this.hasSubscription=!1;this.hasCompleted&&this.destination.complete()};return a}(q),ae=function(){function c(a,b,c){this.project=a;this.concurrent=b;this.scheduler=c}c.prototype.call=function(a,b){return b.subscribe(new $d(a,this.project,this.concurrent,this.scheduler))};return c}(),$d=function(c){function a(b, a,e,f){b=c.call(this,b)||this;b.project=a;b.concurrent=e;b.scheduler=f;b.index=0;b.active=0;b.hasCompleted=!1;ethis.total)throw new O;}c.prototype.call=function(a,b){return b.subscribe(new ie(a,this.total))};return c}(),ie=function(c){function a(b,a){b=c.call(this,b)||this;b.total=a;b.ring=[];b.count=0;return b}h(a,c);a.prototype._next=function(b){var a=this.ring,c=this.total,f= this.count++;a.length=this.total?this.total:this.count,f=this.ring,g=0;gthis.total&&this.destination.next(a)};return a}(m),Ne=function(){function c(a){this._skipCount= a;if(0>this._skipCount)throw new O;}c.prototype.call=function(a,b){return 0===this._skipCount?b.subscribe(new m(a)):b.subscribe(new Me(a,this._skipCount))};return c}(),Me=function(c){function a(a,d){a=c.call(this,a)||this;a._skipCount=d;a._count=0;a._ring=Array(d);return a}h(a,c);a.prototype._next=function(a){var b=this._skipCount,c=this._count++;if(cd)b.delayTime=0;e&&"function"===typeof e.schedule||(b.scheduler=ma);return b}h(a,c);a.create=function(b,c,e){void 0===c&&(c=0);void 0===e&&(e=ma);return new a(b,c,e)};a.dispatch=function(a){return this.add(a.source.subscribe(a.subscriber))};a.prototype._subscribe=function(b){return this.scheduler.schedule(a.dispatch,this.delayTime,{source:this.source,subscriber:b})};return a}(n),Te=function(){function c(a, b){this.scheduler=a;this.delay=b}c.prototype.call=function(a,b){return(new Se(b,this.delay,this.scheduler)).subscribe(a)};return c}(),Cc=function(){function c(a){this.project=a}c.prototype.call=function(a,b){return b.subscribe(new Ue(a,this.project))};return c}(),Ue=function(c){function a(a,d){a=c.call(this,a)||this;a.project=d;a.index=0;return a}h(a,c);a.prototype._next=function(a){var b,c=this.index++;try{b=this.project(a,c)}catch(f){this.destination.error(f);return}this._innerSub(b,a,c)};a.prototype._innerSub= function(a,c,e){var b=this.innerSubscription;b&&b.unsubscribe();b=new J(this,void 0,void 0);this.destination.add(b);this.innerSubscription=p(this,a,c,e,b)};a.prototype._complete=function(){var a=this.innerSubscription;a&&!a.closed||c.prototype._complete.call(this);this.unsubscribe()};a.prototype._unsubscribe=function(){this.innerSubscription=null};a.prototype.notifyComplete=function(a){this.destination.remove(a);this.innerSubscription=null;this.isStopped&&c.prototype._complete.call(this)};a.prototype.notifyNext= function(a,c,e,f,g){this.destination.next(c)};return a}(q),We=function(){function c(a){this.notifier=a}c.prototype.call=function(a,b){a=new Ve(a);var c=p(a,this.notifier);return c&&!a.seenValue?(a.add(c),b.subscribe(a)):a};return c}(),Ve=function(c){function a(a){a=c.call(this,a)||this;a.seenValue=!1;return a}h(a,c);a.prototype.notifyNext=function(a,c,e,f,g){this.seenValue=!0;this.complete()};a.prototype.notifyComplete=function(){};return a}(q),Ye=function(){function c(a,b){this.predicate=a;this.inclusive= b}c.prototype.call=function(a,b){return b.subscribe(new Xe(a,this.predicate,this.inclusive))};return c}(),Xe=function(c){function a(a,d,e){a=c.call(this,a)||this;a.predicate=d;a.inclusive=e;a.index=0;return a}h(a,c);a.prototype._next=function(a){var b=this.destination,c;try{c=this.predicate(a,this.index++)}catch(f){b.error(f);return}this.nextOrComplete(a,c)};a.prototype.nextOrComplete=function(a,c){var b=this.destination;c?b.next(a):(this.inclusive&&b.next(a),b.complete())};return a}(m),Ib={leading:!0, trailing:!1},$e=function(){function c(a,b,c){this.durationSelector=a;this.leading=b;this.trailing=c}c.prototype.call=function(a,b){return b.subscribe(new Ze(a,this.durationSelector,this.leading,this.trailing))};return c}(),Ze=function(c){function a(a,d,e,f){var b=c.call(this,a)||this;b.destination=a;b.durationSelector=d;b._leading=e;b._trailing=f;b._hasValue=!1;return b}h(a,c);a.prototype._next=function(a){this._hasValue=!0;this._sendValue=a;this._throttled||(this._leading?this.send():this.throttle(a))}; a.prototype.send=function(){var a=this._sendValue;this._hasValue&&(this.destination.next(a),this.throttle(a));this._hasValue=!1;this._sendValue=null};a.prototype.throttle=function(a){(a=this.tryDurationSelector(a))&&this.add(this._throttled=p(this,a))};a.prototype.tryDurationSelector=function(a){try{return this.durationSelector(a)}catch(d){return this.destination.error(d),null}};a.prototype.throttlingDone=function(){var a=this._throttled,c=this._trailing;a&&a.unsubscribe();this._throttled=null;c&& this.send()};a.prototype.notifyNext=function(a,c,e,f,g){this.throttlingDone()};a.prototype.notifyComplete=function(){this.throttlingDone()};return a}(q),bf=function(){function c(a,b,c,e){this.duration=a;this.scheduler=b;this.leading=c;this.trailing=e}c.prototype.call=function(a,b){return b.subscribe(new af(a,this.duration,this.scheduler,this.leading,this.trailing))};return c}(),af=function(c){function a(a,d,e,f,g){a=c.call(this,a)||this;a.duration=d;a.scheduler=e;a.leading=f;a.trailing=g;a._hasTrailingValue= !1;a._trailingValue=null;return a}h(a,c);a.prototype._next=function(a){this.throttled?this.trailing&&(this._trailingValue=a,this._hasTrailingValue=!0):(this.add(this.throttled=this.scheduler.schedule(Dc,this.duration,{subscriber:this})),this.leading&&this.destination.next(a))};a.prototype._complete=function(){this._hasTrailingValue&&this.destination.next(this._trailingValue);this.destination.complete()};a.prototype.clearThrottle=function(){var a=this.throttled;a&&(this.trailing&&this._hasTrailingValue&& (this.destination.next(this._trailingValue),this._trailingValue=null,this._hasTrailingValue=!1),a.unsubscribe(),this.remove(a),this.throttled=null)};return a}(m),cf=function(){return function(c,a){this.value=c;this.interval=a}}(),Ec=function(){function c(a,b,c,e){this.waitFor=a;this.absoluteTimeout=b;this.withObservable=c;this.scheduler=e}c.prototype.call=function(a,b){return b.subscribe(new df(a,this.absoluteTimeout,this.waitFor,this.withObservable,this.scheduler))};return c}(),df=function(c){function a(a, d,e,f,g){a=c.call(this,a)||this;a.absoluteTimeout=d;a.waitFor=e;a.withObservable=f;a.scheduler=g;a.action=null;a.scheduleTimeout();return a}h(a,c);a.dispatchTimeout=function(a){var b=a.withObservable;a._unsubscribeAndRecycle();a.add(p(a,b))};a.prototype.scheduleTimeout=function(){var b=this.action;b?this.action=b.schedule(this,this.waitFor):this.add(this.action=this.scheduler.schedule(a.dispatchTimeout,this.waitFor,this))};a.prototype._next=function(a){this.absoluteTimeout||this.scheduleTimeout(); c.prototype._next.call(this,a)};a.prototype._unsubscribe=function(){this.withObservable=this.scheduler=this.action=null};return a}(q),ef=function(){return function(c,a){this.value=c;this.timestamp=a}}(),gf=function(){function c(a){this.windowBoundaries=a}c.prototype.call=function(a,b){a=new ff(a);b=b.subscribe(a);b.closed||a.add(p(a,this.windowBoundaries));return b};return c}(),ff=function(c){function a(a){var b=c.call(this,a)||this;b.window=new u;a.next(b.window);return b}h(a,c);a.prototype.notifyNext= function(a,c,e,f,g){this.openWindow()};a.prototype.notifyError=function(a,c){this._error(a)};a.prototype.notifyComplete=function(a){this._complete()};a.prototype._next=function(a){this.window.next(a)};a.prototype._error=function(a){this.window.error(a);this.destination.error(a)};a.prototype._complete=function(){this.window.complete();this.destination.complete()};a.prototype._unsubscribe=function(){this.window=null};a.prototype.openWindow=function(){var a=this.window;a&&a.complete();var a=this.destination, c=this.window=new u;a.next(c)};return a}(q),jf=function(){function c(a,b){this.windowSize=a;this.startWindowEvery=b}c.prototype.call=function(a,b){return b.subscribe(new hf(a,this.windowSize,this.startWindowEvery))};return c}(),hf=function(c){function a(a,d,e){var b=c.call(this,a)||this;b.destination=a;b.windowSize=d;b.startWindowEvery=e;b.windows=[new u];b.count=0;a.next(b.windows[0]);return b}h(a,c);a.prototype._next=function(a){for(var b=0=this.maxWindowSize&&this.closeWindow(g))}};a.prototype._error=function(a){for(var b=this.windows;0c)throw new O; var b=2<=arguments.length;return function(d){return d.pipe(Y(function(a,b){return b===c}),za(1),b?ba(a):na(function(){return new O}))}},endWith:function(){for(var c=[],a=0;a(a||0)?Number.POSITIVE_INFINITY:a;return function(d){return d.lift(new ae(c,a,b))}},filter:Y,finalize:function(c){return function(a){return a.lift(new ce(c))}},find:function(c,a){if("function"!==typeof c)throw new TypeError("predicate is not a function");return function(b){return b.lift(new Gb(c,b,!1,a))}},findIndex:function(c,a){return function(b){return b.lift(new Gb(c,b,!0,a))}},first:function(c,a){var b=2<=arguments.length; return function(d){return d.pipe(c?Y(function(a,b){return c(a,b,d)}):N,za(1),b?ba(a):na(function(){return new ca}))}},groupBy:function(c,a,b,d){return function(e){return e.lift(new Tc(c,a,b,d))}},ignoreElements:function(){return function(c){return c.lift(new fe)}},isEmpty:function(){return function(c){return c.lift(new he)}},last:function(c,a){var b=2<=arguments.length;return function(d){return d.pipe(c?Y(function(a,b){return c(a,b,d)}):N,ha(1),b?ba(a):na(function(){return new ca}))}},map:C,mapTo:function(c){return function(a){return a.lift(new ke(c))}}, materialize:function(){return function(c){return c.lift(new me)}},max:function(c){return ja("function"===typeof c?function(a,b){return 0b?a:b})},merge:function(){for(var c=[],a=0;ac(a,b)?a:b}:function(a,b){return ac?a.lift(new Hb(-1,a)):a.lift(new Hb(c-1,a))}},repeatWhen:function(c){return function(a){return a.lift(new we(c))}}, retry:function(c){void 0===c&&(c=-1);return function(a){return a.lift(new ye(c,a))}},retryWhen:function(c){return function(a){return a.lift(new Ae(c,a))}},refCount:ra,sample:function(c){return function(a){return a.lift(new Ce(c))}},sampleTime:function(c,a){void 0===a&&(a=y);return function(b){return b.lift(new Ee(c,a))}},scan:ia,sequenceEqual:function(c,a){return function(b){return b.lift(new Ge(c,a))}},share:function(){return function(c){return ra()(Q(yc)(c))}},shareReplay:function(c,a,b){var d; d=c&&"object"===typeof c?c:{bufferSize:c,windowTime:a,refCount:!1,scheduler:b};return function(a){return a.lift(zc(d))}},single:function(c){return function(a){return a.lift(new Je(c,a))}},skip:function(c){return function(a){return a.lift(new Le(c))}},skipLast:function(c){return function(a){return a.lift(new Ne(c))}},skipUntil:function(c){return function(a){return a.lift(new Pe(c))}},skipWhile:function(c){return function(a){return a.lift(new Re(c))}},startWith:function(){for(var c=[],a=0;ak?new ga(h):new ga(h,k)};a.parseMarbles=function(a,c, e,f,g){var b=this;void 0===f&&(f=!1);void 0===g&&(g=!1);if(-1!==a.indexOf("!"))throw Error('conventional marble diagrams cannot have the unsubscription marker "!"');for(var d=a.length,h=[],k=g?a.replace(/^[ ]+/,"").indexOf("^"):a.indexOf("^"),m=-1===k?0:k*-this.frameTimeFactor,n="object"!==typeof c?function(a){return a}:function(a){return f&&c[a]instanceof Ha?c[a].messages:c[a]},p=-1,k=function(c){var d=m,f=function(a){d+=a*b.frameTimeFactor},l=void 0,k=a[c];switch(k){case " ":g||f(1);break;case "-":f(1); break;case "(":p=m;f(1);break;case ")":p=-1;f(1);break;case "|":l=w.createComplete();f(1);break;case "^":f(1);break;case "#":l=w.createError(e||"error");f(1);break;default:if(g&&k.match(/^[0-9]$/)&&(0===c||" "===a[c-1])){var r=a.slice(c).match(/^([0-9]+(?:\.[0-9]+)?)(ms|s|m) /);if(r){c+=r[0].length-1;var k=parseFloat(r[1]),v=void 0;switch(r[2]){case "ms":v=k;break;case "s":v=1E3*k;break;case "m":v=6E4*k}f(v/q.frameTimeFactor);break}}l=w.createNext(n(k));f(1)}l&&h.push({frame:-1d;d++)try{b=c[d];new B.ActiveXObject(b);break}catch(r){}a=new B.ActiveXObject(b)}catch(r){throw Error("XMLHttpRequest is not supported by your browser");}}return a},crossDomain:!0,withCredentials:!1, headers:{},method:"GET",responseType:"json",timeout:0};if("string"===typeof a)e.url=a;else for(var f in a)a.hasOwnProperty(f)&&(e[f]=a[f]);b.request=e;return b}h(a,c);a.prototype._subscribe=function(a){return new Af(a,this.request)};a.create=function(){var b=function(b){return new a(b)};b.get=Ic;b.post=Jc;b.delete=Kc;b.put=Lc;b.patch=Mc;b.getJSON=Nc;return b}();return a}(n),Af=function(c){function a(a,d){a=c.call(this,a)||this;a.request=d;a.done=!1;var b=d.headers=d.headers||{};d.crossDomain||a.getHeader(b, "X-Requested-With")||(b["X-Requested-With"]="XMLHttpRequest");a.getHeader(b,"Content-Type")||B.FormData&&d.body instanceof B.FormData||"undefined"===typeof d.body||(b["Content-Type"]="application/x-www-form-urlencoded; charset\x3dUTF-8");d.body=a.serializeBody(d.body,a.getHeader(d.headers,"Content-Type"));a.send();return a}h(a,c);a.prototype.next=function(a){this.done=!0;var b=this.xhr,c=this.request,f=this.destination,g;try{g=new Lb(a,b,c)}catch(l){return f.error(l)}f.next(g)};a.prototype.send=function(){var a= this.request,c=this.request,e=c.user,f=c.method,g=c.url,h=c.async,k=c.password,m=c.headers,c=c.body;try{var r=this.xhr=a.createXHR();this.setupEvents(r,a);e?r.open(f,g,h,e,k):r.open(f,g,h);h&&(r.timeout=a.timeout,r.responseType=a.responseType);"withCredentials"in r&&(r.withCredentials=!!a.withCredentials);this.setHeaders(r,m);c?r.send(c):r.send()}catch(Ac){this.error(Ac)}};a.prototype.serializeBody=function(a,c){if(!a||"string"===typeof a||B.FormData&&a instanceof B.FormData)return a;if(c){var b= c.indexOf(";");-1!==b&&(c=c.substring(0,b))}switch(c){case "application/x-www-form-urlencoded":return Object.keys(a).map(function(b){return encodeURIComponent(b)+"\x3d"+encodeURIComponent(a[b])}).join("\x26");case "application/json":return JSON.stringify(a);default:return a}};a.prototype.setHeaders=function(a,c){for(var b in c)c.hasOwnProperty(b)&&a.setRequestHeader(b,c[b])};a.prototype.getHeader=function(a,c){for(var b in a)if(b.toLowerCase()===c.toLowerCase())return a[b]};a.prototype.setupEvents= function(a,c){function b(a){var c=b.subscriber,d=b.progressSubscriber,e=b.request;d&&d.error(a);var f;try{f=new Mb(this,e)}catch(Ia){f=Ia}c.error(f)}function d(a){}function g(a){var b=g.subscriber,c=g.progressSubscriber,d=g.request;if(4===this.readyState){var e=1223===this.status?204:this.status,f="text"===this.responseType?this.response||this.responseText:this.response;0===e&&(e=f?200:0);if(400>e)c&&c.complete(),b.next(a),b.complete();else{c&&c.error(a);a=void 0;try{a=new oa("ajax error "+e,this, d)}catch(vf){a=vf}b.error(a)}}}var h=c.progressSubscriber;a.ontimeout=b;b.request=c;b.subscriber=this;b.progressSubscriber=h;if(a.upload&&"withCredentials"in a){if(h){var k;k=function(a){k.progressSubscriber.next(a)};B.XDomainRequest?a.onprogress=k:a.upload.onprogress=k;k.progressSubscriber=h}var m;m=function(a){var b=m.progressSubscriber,c=m.subscriber,d=m.request;b&&b.error(a);var e;try{e=new oa("ajax error",this,d)}catch(Ia){e=Ia}c.error(e)};a.onerror=m;m.request=c;m.subscriber=this;m.progressSubscriber= h}a.onreadystatechange=d;d.subscriber=this;d.progressSubscriber=h;d.request=c;a.onload=g;g.subscriber=this;g.progressSubscriber=h;g.request=c};a.prototype.unsubscribe=function(){var a=this.xhr;!this.done&&a&&4!==a.readyState&&"function"===typeof a.abort&&a.abort();c.prototype.unsubscribe.call(this)};return a}(m),Lb=function(){return function(c,a,b){this.originalEvent=c;this.xhr=a;this.request=b;this.status=a.status;this.responseType=a.responseType||b.responseType;this.response=sb(this.responseType, a)}}();rb.prototype=Object.create(Error.prototype);var oa=rb,Mb=function(c,a){oa.call(this,"ajax timeout",c,a);this.name="AjaxTimeoutError";return this},Bf=Object.freeze({ajax:R.create,AjaxResponse:Lb,AjaxError:oa,AjaxTimeoutError:Mb}),Cf={url:"",deserializer:function(c){return JSON.parse(c.data)},serializer:function(c){return JSON.stringify(c)}},Nb=function(c){function a(a,d){var b=c.call(this)||this;if(a instanceof n)b.destination=d,b.source=a;else{d=b._config=Pc({},Cf);b._output=new u;if("string"=== typeof a)d.url=a;else for(var f in a)a.hasOwnProperty(f)&&(d[f]=a[f]);if(!d.WebSocketCtor&&WebSocket)d.WebSocketCtor=WebSocket;else if(!d.WebSocketCtor)throw Error("no WebSocket constructor can be found");b.destination=new Z}return b}h(a,c);a.prototype.lift=function(b){var c=new a(this._config,this.destination);c.operator=b;c.source=this;return c};a.prototype._resetState=function(){this._socket=null;this.source||(this.destination=new Z);this._output=new u};a.prototype.multiplex=function(a,c,e){var b= this;return new n(function(d){try{b.next(a())}catch(v){d.error(v)}var f=b.subscribe(function(a){try{e(a)&&d.next(a)}catch(x){d.error(x)}},function(a){return d.error(a)},function(){return d.complete()});return function(){try{b.next(c())}catch(v){d.error(v)}f.unsubscribe()}})};a.prototype._connectSocket=function(){var a=this,c=this._config,e=c.WebSocketCtor,f=c.protocol,g=c.url,c=c.binaryType,h=this._output,k=null;try{this._socket=k=f?new e(g,f):new e(g),c&&(this._socket.binaryType=c)}catch(r){h.error(r); return}var n=new t(function(){a._socket=null;k&&1===k.readyState&&k.close()});k.onopen=function(b){if(a._socket){var c=a._config.openObserver;c&&c.next(b);b=a.destination;a.destination=m.create(function(b){if(1===k.readyState)try{var c=a._config.serializer;k.send(c(b))}catch(uf){a.destination.error(uf)}},function(b){var c=a._config.closingObserver;c&&c.next(void 0);b&&b.code?k.close(b.code,b.reason):h.error(new TypeError("WebSocketSubject.error must be called with an object with an error code, and an optional reason: { code: number, reason: string }")); a._resetState()},function(){var b=a._config.closingObserver;b&&b.next(void 0);k.close();a._resetState()});b&&b instanceof Z&&n.add(b.subscribe(a.destination))}else k.close(),a._resetState()};k.onerror=function(b){a._resetState();h.error(b)};k.onclose=function(b){a._resetState();var c=a._config.closeObserver;c&&c.next(b);b.wasClean?h.complete():h.error(b)};k.onmessage=function(b){try{var c=a._config.deserializer;h.next(c(b))}catch(Bc){h.error(Bc)}}};a.prototype._subscribe=function(a){var b=this,c= this.source;if(c)return c.subscribe(a);this._socket||this._connectSocket();this._output.subscribe(a);a.add(function(){var a=b._socket;0===b._output.observers.length&&(a&&1===a.readyState&&a.close(),b._resetState())});return a};a.prototype.unsubscribe=function(){var a=this._socket;a&&1===a.readyState&&a.close();this._resetState();c.prototype.unsubscribe.call(this)};return a}(Ba),Df=Object.freeze({webSocket:function(c){return new Nb(c)},WebSocketSubject:Nb});k.operators=tf;k.testing=xf;k.ajax=Bf;k.webSocket= Df;k.Observable=n;k.ConnectableObservable=wb;k.GroupedObservable=Ca;k.observable=W;k.Subject=u;k.BehaviorSubject=xb;k.ReplaySubject=Z;k.AsyncSubject=V;k.asapScheduler=ma;k.asyncScheduler=y;k.queueScheduler=yb;k.animationFrameScheduler=cd;k.VirtualTimeScheduler=Cb;k.VirtualAction=Fa;k.Scheduler=Da;k.Subscription=t;k.Subscriber=m;k.Notification=w;k.pipe=qa;k.noop=E;k.identity=N;k.isObservable=function(c){return!!c&&(c instanceof n||"function"===typeof c.lift&&"function"===typeof c.subscribe)};k.ArgumentOutOfRangeError= O;k.EmptyError=ca;k.ObjectUnsubscribedError=F;k.UnsubscriptionError=aa;k.TimeoutError=va;k.bindCallback=Pa;k.bindNodeCallback=Qa;k.combineLatest=function(){for(var c=[],a=0;ac)c=0;a&&"function"===typeof a.schedule||(a=y);return new n(function(b){b.add(a.schedule(cc,c,{subscriber:b,counter:0,period:c}));return b})};k.merge=cb;k.never=function(){return Eb};k.of=ta;k.onErrorResumeNext=ya;k.pairs=function(c,a){return a?new n(function(b){var d=Object.keys(c),e=new t;e.add(a.schedule(dc,0,{keys:d,index:0,subscriber:b,subscription:e,obj:c})); return e}):new n(function(a){for(var b=Object.keys(c),e=0;e=a){d.complete();break}d.next(f++);if(d.closed)break}while(1)})};k.throwError=ua;k.timer=eb;k.using=function(c,a){return new n(function(b){var d;try{d=c()}catch(g){b.error(g); return}var e;try{e=a(d)}catch(g){b.error(g);return}var f=(e?K(e):M).subscribe(b);return function(){f.unsubscribe();d&&d.unsubscribe()}})};k.zip=fb;k.EMPTY=M;k.NEVER=Eb;k.config=D;Object.defineProperty(k,"__esModule",{value:!0})}); //# sourceMappingURL=rxjs.umd.min.js.map