forked from Reactive-Extensions/RxJS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rx.lite.min.js
2 lines (2 loc) · 43.3 KB
/
rx.lite.min.js
1
2
(function(t){function e(){}function n(t){return t}function r(t,e){return X(t,e)}function i(t,e){return t-e}function o(t){throw t}function s(){if(this.isDisposed)throw Error(j)}function u(t){return"function"!=typeof t.toString&&"string"==typeof(t+"")}function c(t){return t&&"object"==typeof t?U.call(t)==T:!1}function a(t){return"function"==typeof t}function l(t,e,n,r){var i;if(t===e)return 0!==t||1/t==1/e;var o=typeof t,s=typeof e;if(!(t!==t||t&&E[o]||e&&E[s]))return!1;if(null==t||null==e)return t===e;var h=U.call(t),f=U.call(e);if(h==T&&(h=z),f==T&&(f=z),h!=f)return!1;switch(h){case I:case P:return+t==+e;case V:return t!=+t?e!=+e:0==t?1/t==1/e:t==+e;case M:case B:return t==e+""}var p=h==q;if(!p){if(h!=z||!O&&(u(t)||u(e)))return!1;var d=!F&&c(t)?Object:t.constructor,b=!F&&c(e)?Object:e.constructor;if(d!=b&&!(a(d)&&d instanceof d&&a(b)&&b instanceof b))return!1}for(var v=n.length;v--;)if(n[v]==t)return r[v]==e;var m=0;if(i=!0,n.push(t),r.push(e),p){for(v=t.length,m=e.length,i=m==t.length;m--;){var y=e[m];if(!(i=l(t[m],y,n,r)))break}return i}for(var w in e)if(H.call(e,w))return m++,i=H.call(t,w)&&l(t[w],e[w],n,r);if(i)for(var w in t)if(H.call(t,w))return i=--m>-1;return n.pop(),r.pop(),i}function h(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:J.call(t)}function f(t,e){for(var n=Array(t),r=0;t>r;r++)n[r]=e();return n}function p(e,n){return new Je(function(r){var i=new se,o=new ue;return o.setDisposable(i),i.setDisposable(e.subscribe(r.onNext.bind(r),function(e){var i,s;try{s=n(e)}catch(u){return r.onError(u),t}i=new se,o.setDisposable(i),i.setDisposable(s.subscribe(r))},r.onCompleted.bind(r))),o})}function d(e,n){var r=this;return new Je(function(i){var o=0,s=e.length;return r.subscribe(function(r){if(s>o){var u,c=e[o++];try{u=n(r,c)}catch(a){return i.onError(a),t}i.onNext(u)}else i.onCompleted()},i.onError.bind(i),i.onCompleted.bind(i))})}function b(t){return this.select(t).mergeObservable()}function m(e,n,r){return e.addListener?(e.addListener(n,r),re(function(){e.removeListener(n,r)})):e.addEventListener?(e.addEventListener(n,r,!1),re(function(){e.removeEventListener(n,r,!1)})):t}function y(t,e,n){var r=new te;if(t&&t.length)for(var i=0,o=t.length;o>i;i++)r.add(y(t[i],e,n));else t&&r.add(m(t,e,n));return r}function w(t,e){var n=le(t);return new Je(function(t){return e.scheduleWithRelative(n,function(){t.onNext(0),t.onCompleted()})})}function g(t,e,n){return t===e?new Je(function(t){return n.schedulePeriodicWithState(0,e,function(e){return t.onNext(e),e+1})}):qe(function(){return observableTimerDateAndPeriod(n.now()+t,e,n)})}function x(t,e){return new Je(function(n){function r(){s&&(s=!1,n.onNext(o)),i&&n.onCompleted()}var i,o,s;return new te(t.subscribe(function(t){s=!0,o=t},n.onError.bind(n),function(){i=!0}),e.subscribe(r,n.onError.bind(n),r))})}var E={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},C=E[typeof window]&&window||this,D=E[typeof exports]&&exports&&!exports.nodeType&&exports,N=E[typeof module]&&module&&!module.nodeType&&module,S=N&&N.exports===D&&D,A=E[typeof global]&&global;!A||A.global!==A&&A.window!==A||(C=A);var O,R={Internals:{}},_=Date.now,W="Sequence contains no elements.",k="Argument out of range",j="Object has been disposed",T="[object Arguments]",q="[object Array]",I="[object Boolean]",P="[object Date]",L="[object Function]",V="[object Number]",z="[object Object]",M="[object RegExp]",B="[object String]",U=Object.prototype.toString,H=Object.prototype.hasOwnProperty,F=U.call(arguments)==T;try{O=!(U.call(document)==z&&!({toString:0}+""))}catch($){O=!0}F||(c=function(t){return t&&"object"==typeof t?H.call(t,"callee"):!1}),a(/x/)&&(a=function(t){return"function"==typeof t&&U.call(t)==L});var X=R.Internals.isEqual=function(t,e){return l(t,e,[],[])},J=Array.prototype.slice;({}).hasOwnProperty;var Q=this.inherits=R.Internals.inherits=function(t,e){function n(){this.constructor=t}n.prototype=e.prototype,t.prototype=new n},K=R.Internals.addProperties=function(t){for(var e=J.call(arguments,1),n=0,r=e.length;r>n;n++){var i=e[n];for(var o in i)t[o]=i[o]}};R.Internals.addRef=function(t,e){return new Je(function(n){return new te(e.getDisposable(),t.subscribe(n))})};var G=function(t,e){this.id=t,this.value=e};G.prototype.compareTo=function(t){var e=this.value.compareTo(t.value);return 0===e&&(e=this.id-t.id),e};var Y=R.Internals.PriorityQueue=function(t){this.items=Array(t),this.length=0},Z=Y.prototype;Z.isHigherPriority=function(t,e){return 0>this.items[t].compareTo(this.items[e])},Z.percolate=function(t){if(!(t>=this.length||0>t)){var e=t-1>>1;if(!(0>e||e===t)&&this.isHigherPriority(t,e)){var n=this.items[t];this.items[t]=this.items[e],this.items[e]=n,this.percolate(e)}}},Z.heapify=function(e){if(e===t&&(e=0),!(e>=this.length||0>e)){var n=2*e+1,r=2*e+2,i=e;if(this.length>n&&this.isHigherPriority(n,i)&&(i=n),this.length>r&&this.isHigherPriority(r,i)&&(i=r),i!==e){var o=this.items[e];this.items[e]=this.items[i],this.items[i]=o,this.heapify(i)}}},Z.peek=function(){return this.items[0].value},Z.removeAt=function(t){this.items[t]=this.items[--this.length],delete this.items[this.length],this.heapify()},Z.dequeue=function(){var t=this.peek();return this.removeAt(0),t},Z.enqueue=function(t){var e=this.length++;this.items[e]=new G(Y.count++,t),this.percolate(e)},Z.remove=function(t){for(var e=0;this.length>e;e++)if(this.items[e].value===t)return this.removeAt(e),!0;return!1},Y.count=0;var te=R.CompositeDisposable=function(){this.disposables=h(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},ee=te.prototype;ee.add=function(t){this.isDisposed?t.dispose():(this.disposables.push(t),this.length++)},ee.remove=function(t){var e=!1;if(!this.isDisposed){var n=this.disposables.indexOf(t);-1!==n&&(e=!0,this.disposables.splice(n,1),this.length--,t.dispose())}return e},ee.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()}},ee.clear=function(){var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()},ee.contains=function(t){return-1!==this.disposables.indexOf(t)},ee.toArray=function(){return this.disposables.slice(0)};var ne=R.Disposable=function(t){this.isDisposed=!1,this.action=t||e};ne.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var re=ne.create=function(t){return new ne(t)},ie=ne.empty={dispose:e},oe=function(){function t(t){this.isSingle=t,this.isDisposed=!1,this.current=null}var e=t.prototype;return e.getDisposable=function(){return this.current},e.setDisposable=function(t){if(this.current&&this.isSingle)throw Error("Disposable has already been assigned");var e,n=this.isDisposed;n||(e=this.current,this.current=t),e&&e.dispose(),n&&t&&t.dispose()},e.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()},t}(),se=R.SingleAssignmentDisposable=function(t){function e(){t.call(this,!0)}return Q(e,t),e}(oe),ue=R.SerialDisposable=function(t){function e(){t.call(this,!1)}return Q(e,t),e}(oe);R.RefCountDisposable=function(){function t(t){this.disposable=t,this.disposable.count++,this.isInnerDisposed=!1}function e(t){this.underlyingDisposable=t,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return t.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},e.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},e.prototype.getDisposable=function(){return this.isDisposed?ie:new t(this)},e}();var ce=R.Internals.ScheduledItem=function(t,e,n,r,o){this.scheduler=t,this.state=e,this.action=n,this.dueTime=r,this.comparer=o||i,this.disposable=new se};ce.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},ce.prototype.compareTo=function(t){return this.comparer(this.dueTime,t.dueTime)},ce.prototype.isCancelled=function(){return this.disposable.isDisposed},ce.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var ae=R.Scheduler=function(){function t(t,e,n,r){this.now=t,this._schedule=e,this._scheduleRelative=n,this._scheduleAbsolute=r}function e(t,e){var n=e.first,r=e.second,i=new te,o=function(e){r(e,function(e){var n=!1,r=!1,s=t.scheduleWithState(e,function(t,e){return n?i.remove(s):r=!0,o(e),ie});r||(i.add(s),n=!0)})};return o(n),i}function n(t,e,n){var r=e.first,i=e.second,o=new te,s=function(e){i(e,function(e,r){var i=!1,u=!1,c=t[n].call(t,e,r,function(t,e){return i?o.remove(c):u=!0,s(e),ie});u||(o.add(c),i=!0)})};return s(r),o}function r(t,e){return e(),ie}var i=t.prototype;return i.schedulePeriodic=function(t,e){return this.schedulePeriodicWithState(null,t,function(){e()})},i.schedulePeriodicWithState=function(t,e,n){var r=t,i=setInterval(function(){r=n(r)},e);return re(function(){clearInterval(i)})},i.schedule=function(t){return this._schedule(t,r)},i.scheduleWithState=function(t,e){return this._schedule(t,e)},i.scheduleWithRelative=function(t,e){return this._scheduleRelative(e,t,r)},i.scheduleWithRelativeAndState=function(t,e,n){return this._scheduleRelative(t,e,n)},i.scheduleWithAbsolute=function(t,e){return this._scheduleAbsolute(e,t,r)},i.scheduleWithAbsoluteAndState=function(t,e,n){return this._scheduleAbsolute(t,e,n)},i.scheduleRecursive=function(t){return this.scheduleRecursiveWithState(t,function(t,e){t(function(){e(t)})})},i.scheduleRecursiveWithState=function(t,n){return this.scheduleWithState({first:t,second:n},function(t,n){return e(t,n)})},i.scheduleRecursiveWithRelative=function(t,e){return this.scheduleRecursiveWithRelativeAndState(e,t,function(t,e){t(function(n){e(t,n)})})},i.scheduleRecursiveWithRelativeAndState=function(t,e,r){return this._scheduleRelative({first:t,second:r},e,function(t,e){return n(t,e,"scheduleWithRelativeAndState")})},i.scheduleRecursiveWithAbsolute=function(t,e){return this.scheduleRecursiveWithAbsoluteAndState(e,t,function(t,e){t(function(n){e(t,n)})})},i.scheduleRecursiveWithAbsoluteAndState=function(t,e,r){return this._scheduleAbsolute({first:t,second:r},e,function(t,e){return n(t,e,"scheduleWithAbsoluteAndState")})},t.now=_,t.normalize=function(t){return 0>t&&(t=0),t},t}(),le=ae.normalize,he=ae.immediate=function(){function t(t,e){return e(this,t)}function e(t,e,n){for(var r=le(r);r-this.now()>0;);return n(this,t)}function n(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new ae(_,t,e,n)}(),fe=ae.currentThread=function(){function t(){i=new Y(4)}function e(t,e){return this.scheduleWithRelativeAndState(t,0,e)}function n(e,n,r){var o,s=this.now()+le(n),u=new ce(this,e,r,s);if(i)i.enqueue(u);else{o=new t;try{i.enqueue(u),o.run()}catch(c){throw c}finally{o.dispose()}}return u.disposable}function r(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}var i;t.prototype.dispose=function(){i=null},t.prototype.run=function(){for(var t;i.length>0;)if(t=i.dequeue(),!t.isCancelled()){for(;t.dueTime-ae.now()>0;);t.isCancelled()||t.invoke()}};var o=new ae(_,e,n,r);return o.scheduleRequired=function(){return null===i},o.ensureTrampoline=function(t){return null===i?this.schedule(t):t()},o}();R.Internals.SchedulePeriodicRecursive=function(){function t(t,e){e(0,this._period);try{this._state=this._action(this._state)}catch(n){throw this._cancel.dispose(),n}}function e(t,e,n,r){this._scheduler=t,this._state=e,this._period=n,this._action=r}return e.prototype.start=function(){var e=new se;return this._cancel=e,e.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,t.bind(this))),e},e}();var pe,de=RegExp("^"+(U+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),be="function"==typeof(be=A&&S&&A.setImmediate)&&!de.test(be)&&be,ve="function"==typeof(ve=A&&S&&A.clearImmediate)&&!de.test(ve)&&ve,me=e;(function(){function t(){if(!C.postMessage||C.importScripts)return!1;var t=!1,e=C.onmessage;return C.onmessage=function(){t=!0},C.postMessage("","*"),C.onmessage=e,t}function e(t){if("string"==typeof t.data&&t.data.substring(0,n.length)===n){var e=t.data.substring(n.length),i=r[e];i(),delete r[e]}}if("function"==typeof be)pe=be,me=ve;else if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))pe=process.nextTick;else if(t()){var n="ms.rx.schedule"+Math.random(),r={},i=0;C.addEventListener?C.addEventListener("message",e,!1):C.attachEvent("onmessage",e,!1),pe=function(t){var e=i++;r[e]=t,C.postMessage(n+e,"*")}}else if(C.MessageChannel){var o=new C.MessageChannel,s={},u=0;o.port1.onmessage=function(t){var e=t.data,n=s[e];n(),delete s[e]},pe=function(t){var e=u++;s[e]=t,o.port2.postMessage(e)}}else"document"in C&&"onreadystatechange"in C.document.createElement("script")?pe=function(t){var e=C.document.createElement("script");e.onreadystatechange=function(){t(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},C.document.documentElement.appendChild(e)}:(pe=function(t){return setTimeout(t,0)},me=clearTimeout)})();var ye=ae.timeout=function(){function t(t,e){var n=this,r=new se,i=pe(function(){r.isDisposed||r.setDisposable(e(n,t))});return new te(r,re(function(){me(i)}))}function e(t,e,n){var r=this,i=ae.normalize(e);if(0===i)return r.scheduleWithState(t,n);var o=new se,s=setTimeout(function(){o.isDisposed||o.setDisposable(n(r,t))},i);return new te(o,re(function(){clearTimeout(s)}))}function n(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new ae(_,t,e,n)}(),we=R.Notification=function(){function t(t,e){this.hasValue=null==e?!1:e,this.kind=t}var e=t.prototype;return e.accept=function(t,e,n){return 1===arguments.length&&"object"==typeof t?this._acceptObservable(t):this._accept(t,e,n)},e.toObservable=function(t){var e=this;return t||(t=he),new Je(function(n){return t.schedule(function(){e._acceptObservable(n),"N"===e.kind&&n.onCompleted()})})},t}(),ge=we.createOnNext=function(){function t(t){return t(this.value)}function e(t){return t.onNext(this.value)}function n(){return"OnNext("+this.value+")"}return function(r){var i=new we("N",!0);return i.value=r,i._accept=t,i._acceptObservable=e,i.toString=n,i}}(),xe=we.createOnError=function(){function t(t,e){return e(this.exception)}function e(t){return t.onError(this.exception)}function n(){return"OnError("+this.exception+")"}return function(r){var i=new we("E");return i.exception=r,i._accept=t,i._acceptObservable=e,i.toString=n,i}}(),Ee=we.createOnCompleted=function(){function t(t,e,n){return n()}function e(t){return t.onCompleted()}function n(){return"OnCompleted()"}return function(){var r=new we("C");return r._accept=t,r._acceptObservable=e,r.toString=n,r}}(),Ce=R.Internals.Enumerator=function(t,e){this.moveNext=t,this.getCurrent=e},De=Ce.create=function(t,e){var n=!1;return new Ce(function(){if(n)return!1;var e=t();return e||(n=!0),e},function(){return e()})},Ne=R.Internals.Enumerable=function(t){this.getEnumerator=t};Ne.prototype.concat=function(){var e=this;return new Je(function(n){var r,i=e.getEnumerator(),o=new ue,s=he.scheduleRecursive(function(e){var s,u;if(!r){try{u=i.moveNext(),u&&(s=i.getCurrent())}catch(c){return n.onError(c),t}if(!u)return n.onCompleted(),t;var a=new se;o.setDisposable(a),a.setDisposable(s.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){e()}))}});return new te(o,s,re(function(){r=!0}))})},Ne.prototype.catchException=function(){var e=this;return new Je(function(n){var r,i,o=e.getEnumerator(),s=new ue,u=he.scheduleRecursive(function(e){var u,c;if(!r){try{c=o.moveNext(),c&&(u=o.getCurrent())}catch(a){return n.onError(a),t}if(!c)return i?n.onError(i):n.onCompleted(),t;var l=new se;s.setDisposable(l),l.setDisposable(u.subscribe(n.onNext.bind(n),function(t){i=t,e()},n.onCompleted.bind(n)))}});return new te(s,u,re(function(){r=!0}))})};var Se=Ne.repeat=function(t,e){return 1===arguments.length&&(e=-1),new Ne(function(){var n,r=e;return De(function(){return 0===r?!1:(r>0&&r--,n=t,!0)},function(){return n})})},Ae=Ne.forEach=function(t,e,r){return e||(e=n),new Ne(function(){var n,i=-1;return De(function(){return++i<t.length?(n=e.call(r,t[i],i,t),!0):!1},function(){return n})})},Oe=R.Observer=function(){};Oe.prototype.toNotifier=function(){var t=this;return function(e){return e.accept(t)}},Oe.prototype.asObserver=function(){return new ke(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))};var Re=Oe.create=function(t,n,r){return t||(t=e),n||(n=o),r||(r=e),new ke(t,n,r)};Oe.fromNotifier=function(t){return new ke(function(e){return t(ge(e))},function(e){return t(xe(e))},function(){return t(Ee())})};var _e,We=R.Internals.AbstractObserver=function(t){function e(){this.isStopped=!1,t.call(this)}return Q(e,t),e.prototype.onNext=function(t){this.isStopped||this.next(t)},e.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.error(t))},e.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},e.prototype.dispose=function(){this.isStopped=!0},e.prototype.fail=function(t){return this.isStopped?!1:(this.isStopped=!0,this.error(t),!0)},e}(Oe),ke=R.AnonymousObserver=function(t){function e(e,n,r){t.call(this),this._onNext=e,this._onError=n,this._onCompleted=r}return Q(e,t),e.prototype.next=function(t){this._onNext(t)},e.prototype.error=function(t){this._onError(t)},e.prototype.completed=function(){this._onCompleted()},e}(We),je=R.Observable=function(){function t(t){this._subscribe=t}return _e=t.prototype,_e.finalValue=function(){var t=this;return new Je(function(e){var n,r=!1;return t.subscribe(function(t){r=!0,n=t},e.onError.bind(e),function(){r?(e.onNext(n),e.onCompleted()):e.onError(Error(W))})})},_e.subscribe=_e.forEach=function(t,e,n){var r;return r="object"==typeof t?t:Re(t,e,n),this._subscribe(r)},_e.toArray=function(){function t(t,e){var n=t.slice(0);return n.push(e),n}return this.scan([],t).startWith([]).finalValue()},t}(),Te=R.Internals.ScheduledObserver=function(e){function n(t,n){e.call(this),this.scheduler=t,this.observer=n,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new ue}return Q(n,e),n.prototype.next=function(t){var e=this;this.queue.push(function(){e.observer.onNext(t)})},n.prototype.error=function(t){var e=this;this.queue.push(function(){e.observer.onError(t)})},n.prototype.completed=function(){var t=this;this.queue.push(function(){t.observer.onCompleted()})},n.prototype.ensureActive=function(){var e=!1,n=this;!this.hasFaulted&&this.queue.length>0&&(e=!this.isAcquired,this.isAcquired=!0),e&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(e){var r;if(!(n.queue.length>0))return n.isAcquired=!1,t;r=n.queue.shift();try{r()}catch(i){throw n.queue=[],n.hasFaulted=!0,i}e()}))},n.prototype.dispose=function(){e.prototype.dispose.call(this),this.disposable.dispose()},n}(We);je.create=je.createWithDisposable=function(t){return new Je(t)};var qe=je.defer=function(t){return new Je(function(e){var n;try{n=t()}catch(r){return ze(r).subscribe(e)}return n.subscribe(e)})},Ie=je.empty=function(t){return t||(t=he),new Je(function(e){return t.schedule(function(){e.onCompleted()})})},Pe=je.fromArray=function(t,e){return e||(e=fe),new Je(function(n){var r=0;return e.scheduleRecursive(function(e){t.length>r?(n.onNext(t[r++]),e()):n.onCompleted()})})};je.generate=function(e,n,r,i,o){return o||(o=fe),new Je(function(s){var u=!0,c=e;return o.scheduleRecursive(function(e){var o,a;try{u?u=!1:c=r(c),o=n(c),o&&(a=i(c))}catch(l){return s.onError(l),t}o?(s.onNext(a),e()):s.onCompleted()})})};var Le=je.never=function(){return new Je(function(){return ie})};je.range=function(t,e,n){return n||(n=fe),new Je(function(r){return n.scheduleRecursiveWithState(0,function(n,i){e>n?(r.onNext(t+n),i(n+1)):r.onCompleted()})})},je.repeat=function(t,e,n){return n||(n=fe),null==e&&(e=-1),Ve(t,n).repeat(e)};var Ve=je["return"]=je.returnValue=function(t,e){return e||(e=he),new Je(function(n){return e.schedule(function(){n.onNext(t),n.onCompleted()})})},ze=je["throw"]=je.throwException=function(t,e){return e||(e=he),new Je(function(n){return e.schedule(function(){n.onError(t)})})};_e["catch"]=_e.catchException=function(t){return"function"==typeof t?p(this,t):Me([this,t])};var Me=je.catchException=je["catch"]=function(){var t=h(arguments,0);return Ae(t).catchException()};_e.combineLatest=function(){var t=J.call(arguments);return Array.isArray(t[0])?t[0].unshift(this):t.unshift(this),Be.apply(this,t)};var Be=je.combineLatest=function(){var e=J.call(arguments),r=e.pop();return Array.isArray(e[0])&&(e=e[0]),new Je(function(i){function o(e){var o;if(a[e]=!0,l||(l=a.every(n))){try{o=r.apply(null,p)}catch(s){return i.onError(s),t}i.onNext(o)}else h.filter(function(t,n){return n!==e}).every(n)&&i.onCompleted()}function s(t){h[t]=!0,h.every(n)&&i.onCompleted()}for(var u=function(){return!1},c=e.length,a=f(c,u),l=!1,h=f(c,u),p=Array(c),d=Array(c),b=0;c>b;b++)(function(t){d[t]=new se,d[t].setDisposable(e[t].subscribe(function(e){p[t]=e,o(t)},i.onError.bind(i),function(){s(t)}))})(b);return new te(d)})};_e.concat=function(){var t=J.call(arguments,0);return t.unshift(this),Ue.apply(this,t)};var Ue=je.concat=function(){var t=h(arguments,0);return Ae(t).concat()};_e.concatObservable=_e.concatAll=function(){return this.merge(1)},_e.merge=function(t){if("number"!=typeof t)return He(this,t);var e=this;return new Je(function(n){var r=0,i=new te,o=!1,s=[],u=function(t){var e=new se;i.add(e),e.setDisposable(t.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){var t;i.remove(e),s.length>0?(t=s.shift(),u(t)):(r--,o&&0===r&&n.onCompleted())}))};return i.add(e.subscribe(function(e){t>r?(r++,u(e)):s.push(e)},n.onError.bind(n),function(){o=!0,0===r&&n.onCompleted()})),i})};var He=je.merge=function(){var t,e;return arguments[0]?arguments[0].now?(t=arguments[0],e=J.call(arguments,1)):(t=he,e=J.call(arguments,0)):(t=he,e=J.call(arguments,1)),Array.isArray(e[0])&&(e=e[0]),Pe(e,t).mergeObservable()};_e.mergeObservable=_e.mergeAll=function(){var t=this;return new Je(function(e){var n=new te,r=!1,i=new se;return n.add(i),i.setDisposable(t.subscribe(function(t){var i=new se;n.add(i),i.setDisposable(t.subscribe(function(t){e.onNext(t)},e.onError.bind(e),function(){n.remove(i),r&&1===n.length&&e.onCompleted()}))},e.onError.bind(e),function(){r=!0,1===n.length&&e.onCompleted()})),n})},_e.skipUntil=function(t){var e=this;return new Je(function(n){var r=!1,i=new te(e.subscribe(function(t){r&&n.onNext(t)},n.onError.bind(n),function(){r&&n.onCompleted()})),o=new se;return i.add(o),o.setDisposable(t.subscribe(function(){r=!0,o.dispose()},n.onError.bind(n),function(){o.dispose()})),i})},_e["switch"]=_e.switchLatest=function(){var t=this;return new Je(function(e){var n=!1,r=new ue,i=!1,o=0,s=t.subscribe(function(t){var s=new se,u=++o;n=!0,r.setDisposable(s),s.setDisposable(t.subscribe(function(t){o===u&&e.onNext(t)},function(t){o===u&&e.onError(t)},function(){o===u&&(n=!1,i&&e.onCompleted())}))},e.onError.bind(e),function(){i=!0,n||e.onCompleted()});return new te(s,r)})},_e.takeUntil=function(t){var n=this;return new Je(function(r){return new te(n.subscribe(r),t.subscribe(r.onCompleted.bind(r),r.onError.bind(r),e))})},_e.zip=function(){if(Array.isArray(arguments[0]))return d.apply(this,arguments);var e=this,r=J.call(arguments),i=r.pop();return r.unshift(e),new Je(function(o){function s(t){a[t]=!0,a.every(function(t){return t})&&o.onCompleted()}for(var u=r.length,c=f(u,function(){return[]}),a=f(u,function(){return!1}),l=function(r){var s,u;if(c.every(function(t){return t.length>0})){try{u=c.map(function(t){return t.shift()}),s=i.apply(e,u)}catch(l){return o.onError(l),t}o.onNext(s)}else a.filter(function(t,e){return e!==r}).every(n)&&o.onCompleted()},h=Array(u),p=0;u>p;p++)(function(t){h[t]=new se,h[t].setDisposable(r[t].subscribe(function(e){c[t].push(e),l(t)},o.onError.bind(o),function(){s(t)}))})(p);return new te(h)})},je.zip=function(){var t=J.call(arguments,0),e=t.shift();return e.zip.apply(e,t)},je.zipArray=function(){var e=h(arguments,0);return new Je(function(r){function i(e){if(u.every(function(t){return t.length>0})){var i=u.map(function(t){return t.shift()});r.onNext(i)}else if(c.filter(function(t,n){return n!==e}).every(n))return r.onCompleted(),t}function o(e){return c[e]=!0,c.every(n)?(r.onCompleted(),t):t}for(var s=e.length,u=f(s,function(){return[]}),c=f(s,function(){return!1}),a=Array(s),l=0;s>l;l++)(function(t){a[t]=new se,a[t].setDisposable(e[t].subscribe(function(e){u[t].push(e),i(t)},r.onError.bind(r),function(){o(t)}))})(l);var h=new te(a);return h.add(re(function(){for(var t=0,e=u.length;e>t;t++)u[t]=[]})),h})},_e.asObservable=function(){var t=this;return new Je(function(e){return t.subscribe(e)})},_e.dematerialize=function(){var t=this;return new Je(function(e){return t.subscribe(function(t){return t.accept(e)},e.onError.bind(e),e.onCompleted.bind(e))})},_e.distinctUntilChanged=function(e,i){var o=this;return e||(e=n),i||(i=r),new Je(function(n){var r,s=!1;return o.subscribe(function(o){var u,c=!1;try{u=e(o)}catch(a){return n.onError(a),t}if(s)try{c=i(r,u)}catch(a){return n.onError(a),t}s&&c||(s=!0,r=u,n.onNext(o))},n.onError.bind(n),n.onCompleted.bind(n))})},_e["do"]=_e.doAction=function(t,e,n){var r,i=this;return"function"==typeof t?r=t:(r=t.onNext.bind(t),e=t.onError.bind(t),n=t.onCompleted.bind(t)),new Je(function(t){return i.subscribe(function(e){try{r(e)}catch(n){t.onError(n)}t.onNext(e)},function(n){if(e){try{e(n)}catch(r){t.onError(r)}t.onError(n)}else t.onError(n)},function(){if(n){try{n()}catch(e){t.onError(e)}t.onCompleted()}else t.onCompleted()})})},_e["finally"]=_e.finallyAction=function(t){var e=this;return new Je(function(n){var r=e.subscribe(n);return re(function(){try{r.dispose()}catch(e){throw e}finally{t()}})})},_e.ignoreElements=function(){var t=this;return new Je(function(n){return t.subscribe(e,n.onError.bind(n),n.onCompleted.bind(n))})},_e.materialize=function(){var t=this;return new Je(function(e){return t.subscribe(function(t){e.onNext(ge(t))},function(t){e.onNext(xe(t)),e.onCompleted()},function(){e.onNext(Ee()),e.onCompleted()})})},_e.repeat=function(t){return Se(this,t).concat()},_e.retry=function(t){return Se(this,t).catchException()},_e.scan=function(){var e,n,r=!1,i=this;return 2===arguments.length?(r=!0,e=arguments[0],n=arguments[1]):n=arguments[0],new Je(function(o){var s,u,c;return i.subscribe(function(i){try{c||(c=!0),s?u=n(u,i):(u=r?n(e,i):i,s=!0)}catch(a){return o.onError(a),t}o.onNext(u)},o.onError.bind(o),function(){!c&&r&&o.onNext(e),o.onCompleted()})})},_e.skipLast=function(t){var e=this;return new Je(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&n.onNext(r.shift())},n.onError.bind(n),n.onCompleted.bind(n))})},_e.startWith=function(){var t,e,n=0;return arguments.length&&"now"in Object(arguments[0])?(e=arguments[0],n=1):e=he,t=J.call(arguments,n),Ae([Pe(t,e),this]).concat()},_e.takeLast=function(t,e){return this.takeLastBuffer(t).selectMany(function(t){return Pe(t,e)})},_e.takeLastBuffer=function(t){var e=this;return new Je(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&r.shift()},n.onError.bind(n),function(){n.onNext(r),n.onCompleted()})})},_e.select=_e.map=function(e,n){var r=this;return new Je(function(i){var o=0;return r.subscribe(function(s){var u;try{u=e.call(n,s,o++,r)}catch(c){return i.onError(c),t}i.onNext(u)},i.onError.bind(i),i.onCompleted.bind(i))})},_e.selectMany=_e.flatMap=function(t,e){return e?this.selectMany(function(n){return t(n).select(function(t){return e(n,t)})}):"function"==typeof t?b.call(this,t):b.call(this,function(){return t})},_e.selectSwitch=_e.flatMapLatest=function(t,e){return this.select(t,e).switchLatest()},_e.skip=function(t){if(0>t)throw Error(k);var e=this;return new Je(function(n){var r=t;return e.subscribe(function(t){0>=r?n.onNext(t):r--},n.onError.bind(n),n.onCompleted.bind(n))})},_e.skipWhile=function(e,n){var r=this;return new Je(function(i){var o=0,s=!1;return r.subscribe(function(u){if(!s)try{s=!e.call(n,u,o++,r)}catch(c){return i.onError(c),t}s&&i.onNext(u)},i.onError.bind(i),i.onCompleted.bind(i))})},_e.take=function(t,e){if(0>t)throw Error(k);if(0===t)return Ie(e);var n=this;return new Je(function(e){var r=t;return n.subscribe(function(t){r>0&&(r--,e.onNext(t),0===r&&e.onCompleted())},e.onError.bind(e),e.onCompleted.bind(e))})},_e.takeWhile=function(e,n){var r=this;return new Je(function(i){var o=0,s=!0;return r.subscribe(function(u){if(s){try{s=e.call(n,u,o++,r)}catch(c){return i.onError(c),t}s?i.onNext(u):i.onCompleted()}},i.onError.bind(i),i.onCompleted.bind(i))})},_e.where=_e.filter=function(e,n){var r=this;return new Je(function(i){var o=0;return r.subscribe(function(s){var u;try{u=e.call(n,s,o++,r)}catch(c){return i.onError(c),t}u&&i.onNext(s)},i.onError.bind(i),i.onCompleted.bind(i))})},je.fromCallback=function(e,n,r,i){return n||(n=he),function(){var o=J.call(arguments,0);return new Je(function(s){return n.schedule(function(){function n(e){var n=e;if(i)try{n=i(arguments)}catch(r){return s.onError(r),t}else 1===n.length&&(n=n[0]);s.onNext(n),s.onCompleted()}o.push(n),e.apply(r,o)})})}},je.fromNodeCallback=function(e,n,r,i){return n||(n=he),function(){var o=J.call(arguments,0);return new Je(function(s){return n.schedule(function(){function n(e){if(e)return s.onError(e),t;var n=J.call(arguments,1);if(i)try{n=i(n)}catch(r){return s.onError(r),t}else 1===n.length&&(n=n[0]);s.onNext(n),s.onCompleted()}o.push(n),e.apply(r,o)})})}},je.fromEvent=function(e,n,r){return new Je(function(i){return y(e,n,function(e){var n=e;if(r)try{n=r(arguments)}catch(o){return i.onError(o),t}i.onNext(n)})}).publish().refCount()},je.fromEventPattern=function(e,n,r){return new Je(function(i){function o(e){var n=e;if(r)try{n=r(arguments)}catch(o){return i.onError(o),t}i.onNext(n)}var s=e(o);return re(function(){n&&n(o,s)})}).publish().refCount()},je.fromPromise=function(t){return new Je(function(e){t.then(function(t){e.onNext(t),e.onCompleted()},function(t){e.onError(t)})})},_e.toPromise=function(t){var e=this;return new t(function(t,n){var r,i=!1;e.subscribe(function(t){r=t,i=!0},function(t){n(t)},function(){i&&t(r)})})},_e.multicast=function(t,e){var n=this;return"function"==typeof t?new Je(function(r){var i=n.multicast(t());return new te(e(i).subscribe(r),i.connect())}):new Fe(n,t)},_e.publish=function(t){return t?this.multicast(function(){return new Ge},t):this.multicast(new Ge)},_e.share=function(){return this.publish(null).refCount()},_e.publishLast=function(t){return t?this.multicast(function(){return new Ye},t):this.multicast(new Ye)},_e.publishValue=function(t,e){return 2===arguments.length?this.multicast(function(){return new tn(e)},t):this.multicast(new tn(t))},_e.shareValue=function(t){return this.publishValue(t).refCount()},_e.replay=function(t,e,n,r){return t?this.multicast(function(){return new en(e,n,r)},t):this.multicast(new en(e,n,r))},_e.shareReplay=function(t,e,n){return this.replay(null,t,e,n).refCount()};var Fe=R.ConnectableObservable=function(t){function e(e,n){function r(t){return i.subject.subscribe(t)}var i={subject:n,source:e.asObservable(),hasSubscription:!1,subscription:null};this.connect=function(){return i.hasSubscription||(i.hasSubscription=!0,i.subscription=new te(i.source.subscribe(i.subject),re(function(){i.hasSubscription=!1}))),i.subscription},t.call(this,r)}return Q(e,t),e.prototype.connect=function(){return this.connect()},e.prototype.refCount=function(){var t=null,e=0,n=this;return new Je(function(r){var i,o;return e++,i=1===e,o=n.subscribe(r),i&&(t=n.connect()),re(function(){o.dispose(),e--,0===e&&t.dispose()})})},e}(je),$e=je.interval=function(t,e){return e||(e=ye),g(t,t,e)},Xe=je.timer=function(e,n,r){var i;return r||(r=ye),"number"==typeof n?i=n:"object"==typeof n&&"now"in n&&(r=n),i===t?w(e,r):g(e,i,r)
};_e.delay=function(t,e){e||(e=ye);var n=this;return new Je(function(r){var i,o=!1,s=new ue,u=null,c=[],a=!1;return i=n.materialize().timestamp(e).subscribe(function(n){var i,l;"E"===n.value.kind?(c=[],c.push(n),u=n.value.exception,l=!a):(c.push({value:n.value,timestamp:n.timestamp+t}),l=!o,o=!0),l&&(null!==u?r.onError(u):(i=new se,s.setDisposable(i),i.setDisposable(e.scheduleRecursiveWithRelative(t,function(t){var n,i,s,l;if(null===u){a=!0;do s=null,c.length>0&&0>=c[0].timestamp-e.now()&&(s=c.shift().value),null!==s&&s.accept(r);while(null!==s);l=!1,i=0,c.length>0?(l=!0,i=Math.max(0,c[0].timestamp-e.now())):o=!1,n=u,a=!1,null!==n?r.onError(n):l&&t(i)}}))))}),new te(i,s)})},_e.throttle=function(t,e){return e||(e=ye),this.throttleWithSelector(function(){return Xe(t,e)})},_e.timeInterval=function(t){var e=this;return t||(t=ye),qe(function(){var n=t.now();return e.select(function(e){var r=t.now(),i=r-n;return n=r,{value:e,interval:i}})})},_e.timestamp=function(t){return t||(t=ye),this.select(function(e){return{value:e,timestamp:t.now()}})},_e.sample=function(t,e){return e||(e=ye),"number"==typeof t?x(this,$e(t,e)):x(this,t)},_e.timeout=function(t,e,n){var r,i=this;return e||(e=ze(Error("Timeout"))),n||(n=ye),r=t instanceof Date?function(t,e){n.scheduleWithAbsolute(t,e)}:function(t,e){n.scheduleWithRelative(t,e)},new Je(function(n){var o,s=0,u=new se,c=new ue,a=!1,l=new ue;return c.setDisposable(u),o=function(){var i=s;l.setDisposable(r(t,function(){a=s===i;var t=a;t&&c.setDisposable(e.subscribe(n))}))},o(),u.setDisposable(i.subscribe(function(t){var e=!a;e&&(s++,n.onNext(t),o())},function(t){var e=!a;e&&(s++,n.onError(t))},function(){var t=!a;t&&(s++,n.onCompleted())})),new te(c,l)})},je.generateWithTime=function(e,n,r,i,o,s){return s||(s=ye),new Je(function(u){var c,a,l=!0,h=!1,f=e;return s.scheduleRecursiveWithRelative(0,function(e){h&&u.onNext(c);try{l?l=!1:f=r(f),h=n(f),h&&(c=i(f),a=o(f))}catch(s){return u.onError(s),t}h?e(a):u.onCompleted()})})},_e.delaySubscription=function(t,e){return e||(e=ye),this.delayWithSelector(Xe(t,e),function(){return Ie()})},_e.delayWithSelector=function(e,n){var r,i,o=this;return"function"==typeof e?i=e:(r=e,i=n),new Je(function(e){var n=new te,s=!1,u=function(){s&&0===n.length&&e.onCompleted()},c=new ue,a=function(){c.setDisposable(o.subscribe(function(r){var o;try{o=i(r)}catch(s){return e.onError(s),t}var c=new se;n.add(c),c.setDisposable(o.subscribe(function(){e.onNext(r),n.remove(c),u()},e.onError.bind(e),function(){e.onNext(r),n.remove(c),u()}))},e.onError.bind(e),function(){s=!0,c.dispose(),u()}))};return r?c.setDisposable(r.subscribe(function(){a()},e.onError.bind(e),function(){a()})):a(),new te(c,n)})},_e.timeoutWithSelector=function(e,n,r){if(1===arguments.length){n=e;var e=Le()}r||(r=ze(Error("Timeout")));var i=this;return new Je(function(o){var s=new ue,u=new ue,c=new se;s.setDisposable(c);var a=0,l=!1,h=function(t){var e=a,n=function(){return a===e},i=new se;u.setDisposable(i),i.setDisposable(t.subscribe(function(){n()&&s.setDisposable(r.subscribe(o)),i.dispose()},function(t){n()&&o.onError(t)},function(){n()&&s.setDisposable(r.subscribe(o))}))};h(e);var f=function(){var t=!l;return t&&a++,t};return c.setDisposable(i.subscribe(function(e){if(f()){o.onNext(e);var r;try{r=n(e)}catch(i){return o.onError(i),t}h(r)}},function(t){f()&&o.onError(t)},function(){f()&&o.onCompleted()})),new te(s,u)})},_e.throttleWithSelector=function(e){var n=this;return new Je(function(r){var i,o=!1,s=new ue,u=0,c=n.subscribe(function(n){var c;try{c=e(n)}catch(a){return r.onError(a),t}o=!0,i=n,u++;var l=u,h=new se;s.setDisposable(h),h.setDisposable(c.subscribe(function(){o&&u===l&&r.onNext(i),o=!1,h.dispose()},r.onError.bind(r),function(){o&&u===l&&r.onNext(i),o=!1,h.dispose()}))},function(t){s.dispose(),r.onError(t),o=!1,u++},function(){s.dispose(),o&&r.onNext(i),r.onCompleted(),o=!1,u++});return new te(c,s)})},_e.skipLastWithTime=function(t,e){e||(e=ye);var n=this;return new Je(function(r){var i=[];return n.subscribe(function(n){var o=e.now();for(i.push({interval:o,value:n});i.length>0&&o-i[0].interval>=t;)r.onNext(i.shift().value)},r.onError.bind(r),function(){for(var n=e.now();i.length>0&&n-i[0].interval>=t;)r.onNext(i.shift().value);r.onCompleted()})})},_e.takeLastWithTime=function(t,e,n){return this.takeLastBufferWithTime(t,e).selectMany(function(t){return Pe(t,n)})},_e.takeLastBufferWithTime=function(t,e){var n=this;return e||(e=ye),new Je(function(r){var i=[];return n.subscribe(function(n){var r=e.now();for(i.push({interval:r,value:n});i.length>0&&r-i[0].interval>=t;)i.shift()},r.onError.bind(r),function(){for(var n=e.now(),o=[];i.length>0;){var s=i.shift();t>=n-s.interval&&o.push(s.value)}r.onNext(o),r.onCompleted()})})},_e.takeWithTime=function(t,e){var n=this;return e||(e=ye),new Je(function(r){var i=e.scheduleWithRelative(t,function(){r.onCompleted()});return new te(i,n.subscribe(r))})},_e.skipWithTime=function(t,e){var n=this;return e||(e=ye),new Je(function(r){var i=!1,o=e.scheduleWithRelative(t,function(){i=!0}),s=n.subscribe(function(t){i&&r.onNext(t)},r.onError.bind(r),r.onCompleted.bind(r));return new te(o,s)})},_e.skipUntilWithTime=function(t,e){e||(e=ye);var n=this;return new Je(function(r){var i=!1,o=e.scheduleWithAbsolute(t,function(){i=!0}),s=n.subscribe(function(t){i&&r.onNext(t)},r.onError.bind(r),r.onCompleted.bind(r));return new te(o,s)})},_e.takeUntilWithTime=function(t,e){e||(e=ye);var n=this;return new Je(function(r){return new te(e.scheduleWithAbsolute(t,function(){r.onCompleted()}),n.subscribe(r))})};var Je=R.Internals.AnonymousObservable=function(e){function n(e){return e===t?e=ie:"function"==typeof e&&(e=re(e)),e}function r(i){function o(t){var e=new Qe(t);if(fe.scheduleRequired())fe.schedule(function(){try{e.setDisposable(n(i(e)))}catch(t){if(!e.fail(t))throw t}});else try{e.setDisposable(n(i(e)))}catch(r){if(!e.fail(r))throw r}return e}return this instanceof r?(e.call(this,o),t):new r(i)}return Q(r,e),r}(je),Qe=function(t){function e(e){t.call(this),this.observer=e,this.m=new se}Q(e,t);var n=e.prototype;return n.next=function(t){var e=!1;try{this.observer.onNext(t),e=!0}catch(n){throw n}finally{e||this.dispose()}},n.error=function(t){try{this.observer.onError(t)}catch(e){throw e}finally{this.dispose()}},n.completed=function(){try{this.observer.onCompleted()}catch(t){throw t}finally{this.dispose()}},n.setDisposable=function(t){this.m.setDisposable(t)},n.getDisposable=function(){return this.m.getDisposable()},n.disposable=function(t){return arguments.length?this.getDisposable():setDisposable(t)},n.dispose=function(){t.prototype.dispose.call(this),this.m.dispose()},e}(We),Ke=function(t,e){this.subject=t,this.observer=e};Ke.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1),this.observer=null}};var Ge=R.Subject=function(t){function e(t){return s.call(this),this.isStopped?this.exception?(t.onError(this.exception),ie):(t.onCompleted(),ie):(this.observers.push(t),new Ke(this,t))}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return Q(n,t),K(n.prototype,Oe,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(s.call(this),!this.isStopped){var t=this.observers.slice(0);this.isStopped=!0;for(var e=0,n=t.length;n>e;e++)t[e].onCompleted();this.observers=[]}},onError:function(t){if(s.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){if(s.call(this),!this.isStopped)for(var e=this.observers.slice(0),n=0,r=e.length;r>n;n++)e[n].onNext(t)},dispose:function(){this.isDisposed=!0,this.observers=null}}),n.create=function(t,e){return new Ze(t,e)},n}(je),Ye=R.AsyncSubject=function(t){function e(t){if(s.call(this),!this.isStopped)return this.observers.push(t),new Ke(this,t);var e=this.exception;return hv=this.hasValue,v=this.value,e?t.onError(e):hv?(t.onNext(v),t.onCompleted()):t.onCompleted(),ie}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return Q(n,t),K(n.prototype,Oe,{hasObservers:function(){return s.call(this),this.observers.length>0},onCompleted:function(){var t,e,n;if(s.call(this),!this.isStopped){var r=this.observers.slice(0);this.isStopped=!0;var i=this.value,o=this.hasValue;if(o)for(e=0,n=r.length;n>e;e++)t=r[e],t.onNext(i),t.onCompleted();else for(e=0,n=r.length;n>e;e++)r[e].onCompleted();this.observers=[]}},onError:function(t){if(s.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){s.call(this),this.isStopped||(this.value=t,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),n}(je),Ze=function(t){function e(t){return this.observable.subscribe(t)}function n(n,r){t.call(this,e),this.observer=n,this.observable=r}return Q(n,t),K(n.prototype,Oe,{onCompleted:function(){this.observer.onCompleted()},onError:function(t){this.observer.onError(t)},onNext:function(t){this.observer.onNext(t)}}),n}(je),tn=R.BehaviorSubject=function(t){function e(t){if(s.call(this),!this.isStopped)return this.observers.push(t),t.onNext(this.value),new Ke(this,t);var e=this.exception;return e?t.onError(e):t.onCompleted(),ie}function n(n){t.call(this,e),this.value=n,this.observers=[],this.isDisposed=!1,this.isStopped=!1,this.exception=null}return Q(n,t),K(n.prototype,Oe,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(s.call(this),!this.isStopped){var t=this.observers.slice(0);this.isStopped=!0;for(var e=0,n=t.length;n>e;e++)t[e].onCompleted();this.observers=[]}},onError:function(t){if(s.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){if(s.call(this),!this.isStopped){this.value=t;for(var e=this.observers.slice(0),n=0,r=e.length;r>n;n++)e[n].onNext(t)}},dispose:function(){this.isDisposed=!0,this.observers=null,this.value=null,this.exception=null}}),n}(je),en=R.ReplaySubject=function(t){function e(t,e){this.subject=t,this.observer=e}function n(t){var n=new Te(this.scheduler,t),r=new e(this,n);s.call(this),this._trim(this.scheduler.now()),this.observers.push(n);for(var i=this.q.length,o=0,u=this.q.length;u>o;o++)n.onNext(this.q[o].value);return this.hasError?(i++,n.onError(this.error)):this.isStopped&&(i++,n.onCompleted()),n.ensureActive(i),r}function r(e,r,i){this.bufferSize=null==e?Number.MAX_VALUE:e,this.windowSize=null==r?Number.MAX_VALUE:r,this.scheduler=i||fe,this.q=[],this.observers=[],this.isStopped=!1,this.isDisposed=!1,this.hasError=!1,this.error=null,t.call(this,n)}return e.prototype.dispose=function(){if(this.observer.dispose(),!this.subject.isDisposed){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1)}},Q(r,t),K(r.prototype,Oe,{hasObservers:function(){return this.observers.length>0},_trim:function(t){for(;this.q.length>this.bufferSize;)this.q.shift();for(;this.q.length>0&&t-this.q[0].interval>this.windowSize;)this.q.shift()},onNext:function(t){var e;if(s.call(this),!this.isStopped){var n=this.scheduler.now();this.q.push({interval:n,value:t}),this._trim(n);for(var r=this.observers.slice(0),i=0,o=r.length;o>i;i++)e=r[i],e.onNext(t),e.ensureActive()}},onError:function(t){var e;if(s.call(this),!this.isStopped){this.isStopped=!0,this.error=t,this.hasError=!0;var n=this.scheduler.now();this._trim(n);for(var r=this.observers.slice(0),i=0,o=r.length;o>i;i++)e=r[i],e.onError(t),e.ensureActive();this.observers=[]}},onCompleted:function(){var t;if(s.call(this),!this.isStopped){this.isStopped=!0;var e=this.scheduler.now();this._trim(e);for(var n=this.observers.slice(0),r=0,i=n.length;i>r;r++)t=n[r],t.onCompleted(),t.ensureActive();this.observers=[]}},dispose:function(){this.isDisposed=!0,this.observers=null}}),r}(je);"function"==typeof define&&"object"==typeof define.amd&&define.amd?(C.Rx=R,define(function(){return R})):D&&N?S?(N.exports=R).Rx=R:D.Rx=R:C.Rx=R}).call(this);