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