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) · 48.6 KB
/
Copy pathrx.lite.min.js
File metadata and controls
2 lines (2 loc) · 48.6 KB
1
2
(function(t){function e(){}function n(t){return t}function r(t,e){return ue(t,e)}function i(t,e){return t-e}function o(t){throw t}function s(e){return"function"==typeof e.then&&e.subscribe===t}function u(){if(this.isDisposed)throw Error(L)}function c(t){var e=typeof t;return t&&("function"==e||"object"==e)||!1}function a(t){var e=[];if(!c(t))return e;se.nonEnumArgs&&t.length&&p(t)&&(t=ce.call(t));var n=se.enumPrototypes&&"function"==typeof t,r=se.enumErrorProps&&(t===te||t instanceof Error);for(var i in t)n&&"prototype"==i||r&&("message"==i||"name"==i)||e.push(i);if(se.nonEnumShadows&&t!==ee){var o=t.constructor,s=-1,u=ie.length;if(t===(o&&o.prototype))var a=t===stringProto?K:t===te?H:G.call(t),l=oe[a];for(;u>++s;)i=ie[s],l&&l[i]||!Y.call(t,i)||e.push(i)}return e}function l(t,e,n){for(var r=-1,i=n(t),o=i.length;o>++r;){var s=i[r];if(e(t[s],s,t)===!1)break}return t}function h(t,e){return l(t,e,a)}function f(t){return"function"!=typeof t.toString&&"string"==typeof(t+"")}function p(t){return t&&"object"==typeof t?G.call(t)==I:!1}function d(t){return"function"==typeof t}function b(e,n,r,i){if(e===n)return 0!==e||1/e==1/n;var o=typeof e,s=typeof n;if(e===e&&(null==e||null==n||"function"!=o&&"object"!=o&&"function"!=s&&"object"!=s))return!1;var u=G.call(e),c=G.call(n);if(u==I&&(u=X),c==I&&(c=X),u!=c)return!1;switch(u){case F:case U:return+e==+n;case $:return e!=+e?n!=+n:0==e?1/e==1/n:e==+n;case J:case K:return e==n+""}var a=u==B;if(!a){if(u!=X||!se.nodeClass&&(f(e)||f(n)))return!1;var l=!se.argsObject&&p(e)?Object:e.constructor,v=!se.argsObject&&p(n)?Object:n.constructor;if(!(l==v||Y.call(e,"constructor")&&Y.call(n,"constructor")||d(l)&&l instanceof l&&d(v)&&v instanceof v||!("constructor"in e&&"constructor"in n)))return!1}r||(r=[]),i||(i=[]);for(var m=r.length;m--;)if(r[m]==e)return i[m]==n;var y=0;if(result=!0,r.push(e),i.push(n),a){if(m=e.length,y=n.length,result=y==m)for(;y--;){var w=n[y];if(!(result=b(e[y],w,r,i)))break}}else h(n,function(n,o,s){return Y.call(s,o)?(y++,result=Y.call(e,o)&&b(e[o],n,r,i)):t}),result&&h(e,function(e,n,r){return Y.call(r,n)?result=--y>-1:t});return r.pop(),i.pop(),result}function v(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:ce.call(t)}function m(t,e){for(var n=Array(t),r=0;t>r;r++)n[r]=e();return n}function y(e,n){return new cn(function(r){var i=new ge,o=new xe;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 ge,o.setDisposable(i),i.setDisposable(s.subscribe(r))},r.onCompleted.bind(r))),o})}function w(e,n){var r=this;return new cn(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 g(t){return this.select(function(e,n){var r=t(e,n);return s(r)?en(r):r}).mergeObservable()}function x(e,n,r){return e.addListener?(e.addListener(n,r),me(function(){e.removeListener(n,r)})):e.addEventListener?(e.addEventListener(n,r,!1),me(function(){e.removeEventListener(n,r,!1)})):t}function E(t,e,n){var r=new de;if(t&&t.length)for(var i=0,o=t.length;o>i;i++)r.add(E(t[i],e,n));else t&&r.add(x(t,e,n));return r}function C(t,e){var n=De(t);return new cn(function(t){return e.scheduleWithRelative(n,function(){t.onNext(0),t.onCompleted()})})}function D(t,e,n){return t===e?new cn(function(t){return n.schedulePeriodicWithState(0,e,function(e){return t.onNext(e),e+1})}):He(function(){return observableTimerDateAndPeriod(n.now()+t,e,n)})}function S(t,e){return new cn(function(n){function r(){s&&(s=!1,n.onNext(o)),i&&n.onCompleted()}var i,o,s;return new de(t.subscribe(function(t){s=!0,o=t},n.onError.bind(n),function(){i=!0}),e.subscribe(r,n.onError.bind(n),r))})}function N(e,r,i){return new cn(function(o){function s(e,r){h[r]=e;var s;if(c[r]=!0,a||(a=c.every(n))){try{s=i.apply(null,h)}catch(u){return o.onError(u),t}o.onNext(s)}else l&&o.onCompleted()}var u=2,c=[!1,!1],a=!1,l=!1,h=Array(u);return new de(e.subscribe(function(t){s(t,0)},o.onError.bind(o),function(){l=!0,o.onCompleted()}),r.subscribe(function(t){s(t,1)},o.onError.bind(o)))})}var A={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},O=A[typeof window]&&window||this,_=A[typeof exports]&&exports&&!exports.nodeType&&exports,R=A[typeof module]&&module&&!module.nodeType&&module,j=R&&R.exports===_&&_,W=A[typeof global]&&global;!W||W.global!==W&&W.window!==W||(O=W);var k={internals:{},config:{}},q=Date.now,T="Sequence contains no elements.",P="Argument out of range",L="Object has been disposed",V="object"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";O.Set&&"function"==typeof(new O.Set)["@@iterator"]&&(V="@@iterator");var z,M={done:!0,value:t},I="[object Arguments]",B="[object Array]",F="[object Boolean]",U="[object Date]",H="[object Error]",Q="[object Function]",$="[object Number]",X="[object Object]",J="[object RegExp]",K="[object String]",G=Object.prototype.toString,Y=Object.prototype.hasOwnProperty,Z=G.call(arguments)==I,te=Error.prototype,ee=Object.prototype,ne=ee.propertyIsEnumerable;try{z=!(G.call(document)==X&&!({toString:0}+""))}catch(re){z=!0}var ie=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],oe={};oe[B]=oe[U]=oe[$]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},oe[F]=oe[K]={constructor:!0,toString:!0,valueOf:!0},oe[H]=oe[Q]=oe[J]={constructor:!0,toString:!0},oe[X]={constructor:!0};var se={};(function(){var t=function(){this.x=1},e=[];t.prototype={valueOf:1,y:1};for(var n in new t)e.push(n);for(n in arguments);se.enumErrorProps=ne.call(te,"message")||ne.call(te,"name"),se.enumPrototypes=ne.call(t,"prototype"),se.nonEnumArgs=0!=n,se.nonEnumShadows=!/valueOf/.test(e)})(1),Z||(p=function(t){return t&&"object"==typeof t?Y.call(t,"callee"):!1}),d(/x/)&&(d=function(t){return"function"==typeof t&&G.call(t)==Q});var ue=k.internals.isEqual=function(t,e){return b(t,e,[],[])},ce=Array.prototype.slice;({}).hasOwnProperty;var ae=this.inherits=k.internals.inherits=function(t,e){function n(){this.constructor=t}n.prototype=e.prototype,t.prototype=new n},le=k.internals.addProperties=function(t){for(var e=ce.call(arguments,1),n=0,r=e.length;r>n;n++){var i=e[n];for(var o in i)t[o]=i[o]}};k.internals.addRef=function(t,e){return new cn(function(n){return new de(e.getDisposable(),t.subscribe(n))})};var he=function(t,e){this.id=t,this.value=e};he.prototype.compareTo=function(t){var e=this.value.compareTo(t.value);return 0===e&&(e=this.id-t.id),e};var fe=k.internals.PriorityQueue=function(t){this.items=Array(t),this.length=0},pe=fe.prototype;pe.isHigherPriority=function(t,e){return 0>this.items[t].compareTo(this.items[e])},pe.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)}}},pe.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)}}},pe.peek=function(){return this.items[0].value},pe.removeAt=function(t){this.items[t]=this.items[--this.length],delete this.items[this.length],this.heapify()},pe.dequeue=function(){var t=this.peek();return this.removeAt(0),t},pe.enqueue=function(t){var e=this.length++;this.items[e]=new he(fe.count++,t),this.percolate(e)},pe.remove=function(t){for(var e=0;this.length>e;e++)if(this.items[e].value===t)return this.removeAt(e),!0;return!1},fe.count=0;var de=k.CompositeDisposable=function(){this.disposables=v(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},be=de.prototype;be.add=function(t){this.isDisposed?t.dispose():(this.disposables.push(t),this.length++)},be.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},be.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()}},be.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()},be.contains=function(t){return-1!==this.disposables.indexOf(t)},be.toArray=function(){return this.disposables.slice(0)};var ve=k.Disposable=function(t){this.isDisposed=!1,this.action=t||e};ve.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var me=ve.create=function(t){return new ve(t)},ye=ve.empty={dispose:e},we=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}(),ge=k.SingleAssignmentDisposable=function(t){function e(){t.call(this,!0)}return ae(e,t),e}(we),xe=k.SerialDisposable=function(t){function e(){t.call(this,!1)}return ae(e,t),e}(we);k.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?ye:new t(this)},e}();var Ee=k.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 ge};Ee.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},Ee.prototype.compareTo=function(t){return this.comparer(this.dueTime,t.dueTime)},Ee.prototype.isCancelled=function(){return this.disposable.isDisposed},Ee.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var Ce=k.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 de,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),ye});r||(i.add(s),n=!0)})};return o(n),i}function n(t,e,n){var r=e.first,i=e.second,o=new de,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),ye});u||(o.add(c),i=!0)})};return s(r),o}function r(t,e){return e(),ye}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 me(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=q,t.normalize=function(t){return 0>t&&(t=0),t},t}(),De=Ce.normalize,Se=Ce.immediate=function(){function t(t,e){return e(this,t)}function e(t,e,n){for(var r=De(r);r-this.now()>0;);return n(this,t)}function n(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new Ce(q,t,e,n)}(),Ne=Ce.currentThread=function(){function t(t){for(var e;t.length>0;)if(e=t.dequeue(),!e.isCancelled()){for(;e.dueTime-Ce.now()>0;);e.isCancelled()||e.invoke()}}function e(t,e){return this.scheduleWithRelativeAndState(t,0,e)}function n(e,n,r){var o=this.now()+Ce.normalize(n),s=new Ee(this,e,r,o);if(i)i.enqueue(s);else{i=new fe(4),i.enqueue(s);try{t(i)}catch(u){throw u}finally{i=null}}return s.disposable}function r(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}var i,o=new Ce(q,e,n,r);return o.scheduleRequired=function(){return null===i},o.ensureTrampoline=function(t){return null===i?this.schedule(t):t()},o}();k.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 ge;return this._cancel=e,e.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,t.bind(this))),e},e}();var Ae,Oe=e;(function(){function t(){if(!O.postMessage||O.importScripts)return!1;var t=!1,e=O.onmessage;return O.onmessage=function(){t=!0},O.postMessage("","*"),O.onmessage=e,t}function e(t){if("string"==typeof t.data&&t.data.substring(0,o.length)===o){var e=t.data.substring(o.length),n=s[e];n(),delete s[e]}}var n=RegExp("^"+(G+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),r="function"==typeof(r=W&&j&&W.setImmediate)&&!n.test(r)&&r,i="function"==typeof(i=W&&j&&W.clearImmediate)&&!n.test(i)&&i;if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))Ae=process.nextTick;else if("function"==typeof r)Ae=r,Oe=i;else if(t()){var o="ms.rx.schedule"+Math.random(),s={},u=0;O.addEventListener?O.addEventListener("message",e,!1):O.attachEvent("onmessage",e,!1),Ae=function(t){var e=u++;s[e]=t,O.postMessage(o+e,"*")}}else if(O.MessageChannel){var c=new O.MessageChannel,a={},l=0;c.port1.onmessage=function(t){var e=t.data,n=a[e];n(),delete a[e]},Ae=function(t){var e=l++;a[e]=t,c.port2.postMessage(e)}}else"document"in O&&"onreadystatechange"in O.document.createElement("script")?Ae=function(t){var e=O.document.createElement("script");e.onreadystatechange=function(){t(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},O.document.documentElement.appendChild(e)}:(Ae=function(t){return setTimeout(t,0)},Oe=clearTimeout)})();var _e=Ce.timeout=function(){function t(t,e){var n=this,r=new ge,i=Ae(function(){r.isDisposed||r.setDisposable(e(n,t))});return new de(r,me(function(){Oe(i)}))}function e(t,e,n){var r=this,i=Ce.normalize(e);if(0===i)return r.scheduleWithState(t,n);var o=new ge,s=setTimeout(function(){o.isDisposed||o.setDisposable(n(r,t))},i);return new de(o,me(function(){clearTimeout(s)}))}function n(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new Ce(q,t,e,n)}(),Re=k.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=Se),new cn(function(n){return t.schedule(function(){e._acceptObservable(n),"N"===e.kind&&n.onCompleted()})})},t}(),je=Re.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 Re("N",!0);return i.value=r,i._accept=t,i._acceptObservable=e,i.toString=n,i}}(),We=Re.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 Re("E");return i.exception=r,i._accept=t,i._acceptObservable=e,i.toString=n,i}}(),ke=Re.createOnCompleted=function(){function t(t,e,n){return n()}function e(t){return t.onCompleted()}function n(){return"OnCompleted()"}return function(){var r=new Re("C");return r._accept=t,r._acceptObservable=e,r.toString=n,r}}(),qe=k.internals.Enumerator=function(t){this._next=t};qe.prototype.next=function(){return this._next()},qe.prototype[V]=function(){return this};var Te=k.internals.Enumerable=function(t){this._iterator=t};Te.prototype[V]=function(){return this._iterator()},Te.prototype.concat=function(){var e=this;return new cn(function(n){var r;try{r=e[V]()}catch(i){return n.onError(),t}var o,s=new xe,u=Se.scheduleRecursive(function(e){var i;if(!o){try{i=r.next()}catch(u){return n.onError(u),t}if(i.done)return n.onCompleted(),t;var c=new ge;s.setDisposable(c),c.setDisposable(i.value.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){e()}))}});return new de(s,u,me(function(){o=!0}))})},Te.prototype.catchException=function(){var e=this;return new cn(function(n){var r;try{r=e[V]()}catch(i){return n.onError(),t}var o,s,u=new xe,c=Se.scheduleRecursive(function(e){if(!o){var i;try{i=r.next()}catch(c){return n.onError(c),t}if(i.done)return s?n.onError(s):n.onCompleted(),t;var a=new ge;u.setDisposable(a),a.setDisposable(i.value.subscribe(n.onNext.bind(n),function(t){s=t,e()},n.onCompleted.bind(n)))}});return new de(u,c,me(function(){o=!0}))})};var Pe=Te.repeat=function(t,e){return null==e&&(e=-1),new Te(function(){var n=e;return new qe(function(){return 0===n?M:(n>0&&n--,{done:!1,value:t})})})},Le=Te.forEach=function(t,e,r){return e||(e=n),new Te(function(){var n=-1;return new qe(function(){return++n<t.length?{done:!1,value:e.call(r,t[n],n,t)}:M})})},Ve=k.Observer=function(){};Ve.prototype.toNotifier=function(){var t=this;return function(e){return e.accept(t)}},Ve.prototype.asObserver=function(){return new Be(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))};var ze=Ve.create=function(t,n,r){return t||(t=e),n||(n=o),r||(r=e),new Be(t,n,r)};Ve.fromNotifier=function(t){return new Be(function(e){return t(je(e))},function(e){return t(We(e))},function(){return t(ke())})};var Me,Ie=k.internals.AbstractObserver=function(t){function e(){this.isStopped=!1,t.call(this)}return ae(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}(Ve),Be=k.AnonymousObserver=function(t){function e(e,n,r){t.call(this),this._onNext=e,this._onError=n,this._onCompleted=r}return ae(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}(Ie),Fe=k.Observable=function(){function t(t){this._subscribe=t}return Me=t.prototype,Me.finalValue=function(){var t=this;return new cn(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(T))})})},Me.subscribe=Me.forEach=function(t,e,n){var r;return r="object"==typeof t?t:ze(t,e,n),this._subscribe(r)},Me.toArray=function(){function t(t,e){var n=t.slice(0);return n.push(e),n}return this.scan([],t).startWith([]).finalValue()},t}(),Ue=k.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 xe}return ae(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}(Ie);Fe.create=Fe.createWithDisposable=function(t){return new cn(t)};var He=Fe.defer=function(t){return new cn(function(e){var n;try{n=t()}catch(r){return Ke(r).subscribe(e)}return n.subscribe(e)})},Qe=Fe.empty=function(t){return t||(t=Se),new cn(function(e){return t.schedule(function(){e.onCompleted()})})},$e=Fe.fromArray=function(t,e){return e||(e=Ne),new cn(function(n){var r=0;return e.scheduleRecursive(function(e){t.length>r?(n.onNext(t[r++]),e()):n.onCompleted()})})};Fe.fromIterable=function(e,n){return n||(n=Ne),new cn(function(r){var i;try{i=e[V]()}catch(o){return r.onError(o),t}return n.scheduleRecursive(function(e){var n;try{n=i.next()}catch(o){return r.onError(o),t}n.done?r.onCompleted():(r.onNext(n.value),e())})})},Fe.generate=function(e,n,r,i,o){return o||(o=Ne),new cn(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 Xe=Fe.never=function(){return new cn(function(){return ye})};Fe.range=function(t,e,n){return n||(n=Ne),new cn(function(r){return n.scheduleRecursiveWithState(0,function(n,i){e>n?(r.onNext(t+n),i(n+1)):r.onCompleted()})})},Fe.repeat=function(t,e,n){return n||(n=Ne),null==e&&(e=-1),Je(t,n).repeat(e)};var Je=Fe["return"]=Fe.returnValue=function(t,e){return e||(e=Se),new cn(function(n){return e.schedule(function(){n.onNext(t),n.onCompleted()})})},Ke=Fe["throw"]=Fe.throwException=function(t,e){return e||(e=Se),new cn(function(n){return e.schedule(function(){n.onError(t)})})};Me["catch"]=Me.catchException=function(t){return"function"==typeof t?y(this,t):Ge([this,t])};var Ge=Fe.catchException=Fe["catch"]=function(){var t=v(arguments,0);return Le(t).catchException()};Me.combineLatest=function(){var t=ce.call(arguments);return Array.isArray(t[0])?t[0].unshift(this):t.unshift(this),Ye.apply(this,t)};var Ye=Fe.combineLatest=function(){var e=ce.call(arguments),r=e.pop();return Array.isArray(e[0])&&(e=e[0]),new cn(function(i){function o(e){var o;if(a[e]=!0,l||(l=a.every(n))){try{o=r.apply(null,f)}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=m(c,u),l=!1,h=m(c,u),f=Array(c),p=Array(c),d=0;c>d;d++)(function(t){p[t]=new ge,p[t].setDisposable(e[t].subscribe(function(e){f[t]=e,o(t)},i.onError.bind(i),function(){s(t)}))})(d);return new de(p)})};Me.concat=function(){var t=ce.call(arguments,0);return t.unshift(this),Ze.apply(this,t)};var Ze=Fe.concat=function(){var t=v(arguments,0);return Le(t).concat()};Me.concatObservable=Me.concatAll=function(){return this.merge(1)},Me.merge=function(t){if("number"!=typeof t)return tn(this,t);var e=this;return new cn(function(n){var r=0,i=new de,o=!1,u=[],c=function(t){var e=new ge;i.add(e),s(t)&&(t=en(t)),e.setDisposable(t.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){var t;i.remove(e),u.length>0?(t=u.shift(),c(t)):(r--,o&&0===r&&n.onCompleted())}))};return i.add(e.subscribe(function(e){t>r?(r++,c(e)):u.push(e)},n.onError.bind(n),function(){o=!0,0===r&&n.onCompleted()})),i})};var tn=Fe.merge=function(){var t,e;return arguments[0]?arguments[0].now?(t=arguments[0],e=ce.call(arguments,1)):(t=Se,e=ce.call(arguments,0)):(t=Se,e=ce.call(arguments,1)),Array.isArray(e[0])&&(e=e[0]),$e(e,t).mergeObservable()};Me.mergeObservable=Me.mergeAll=function(){var t=this;return new cn(function(e){var n=new de,r=!1,i=new ge;return n.add(i),i.setDisposable(t.subscribe(function(t){var i=new ge;n.add(i),s(t)&&(t=en(t)),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})},Me.skipUntil=function(t){var e=this;return new cn(function(n){var r=!1,i=new de(e.subscribe(function(t){r&&n.onNext(t)},n.onError.bind(n),function(){r&&n.onCompleted()})),o=new ge;return i.add(o),o.setDisposable(t.subscribe(function(){r=!0,o.dispose()},n.onError.bind(n),function(){o.dispose()})),i})},Me["switch"]=Me.switchLatest=function(){var t=this;return new cn(function(e){var n=!1,r=new xe,i=!1,o=0,u=t.subscribe(function(t){var u=new ge,c=++o;n=!0,r.setDisposable(u),s(t)&&(t=en(t)),u.setDisposable(t.subscribe(function(t){o===c&&e.onNext(t)},function(t){o===c&&e.onError(t)},function(){o===c&&(n=!1,i&&e.onCompleted())}))},e.onError.bind(e),function(){i=!0,n||e.onCompleted()});return new de(u,r)})},Me.takeUntil=function(t){var n=this;return new cn(function(r){return new de(n.subscribe(r),t.subscribe(r.onCompleted.bind(r),r.onError.bind(r),e))})},Me.zip=function(){if(Array.isArray(arguments[0]))return w.apply(this,arguments);var e=this,r=ce.call(arguments),i=r.pop();return r.unshift(e),new cn(function(o){function s(t){a[t]=!0,a.every(function(t){return t})&&o.onCompleted()}for(var u=r.length,c=m(u,function(){return[]}),a=m(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),f=0;u>f;f++)(function(t){h[t]=new ge,h[t].setDisposable(r[t].subscribe(function(e){c[t].push(e),l(t)},o.onError.bind(o),function(){s(t)}))})(f);return new de(h)})},Fe.zip=function(){var t=ce.call(arguments,0),e=t.shift();return e.zip.apply(e,t)},Fe.zipArray=function(){var e=v(arguments,0);return new cn(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=m(s,function(){return[]}),c=m(s,function(){return!1}),a=Array(s),l=0;s>l;l++)(function(t){a[t]=new ge,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 de(a);return h.add(me(function(){for(var t=0,e=u.length;e>t;t++)u[t]=[]})),h})},Me.asObservable=function(){var t=this;return new cn(function(e){return t.subscribe(e)})},Me.dematerialize=function(){var t=this;return new cn(function(e){return t.subscribe(function(t){return t.accept(e)},e.onError.bind(e),e.onCompleted.bind(e))})},Me.distinctUntilChanged=function(e,i){var o=this;return e||(e=n),i||(i=r),new cn(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))})},Me["do"]=Me.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 cn(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()})})},Me["finally"]=Me.finallyAction=function(t){var e=this;return new cn(function(n){var r=e.subscribe(n);return me(function(){try{r.dispose()}catch(e){throw e}finally{t()}})})},Me.ignoreElements=function(){var t=this;return new cn(function(n){return t.subscribe(e,n.onError.bind(n),n.onCompleted.bind(n))})},Me.materialize=function(){var t=this;return new cn(function(e){return t.subscribe(function(t){e.onNext(je(t))},function(t){e.onNext(We(t)),e.onCompleted()},function(){e.onNext(ke()),e.onCompleted()})})},Me.repeat=function(t){return Pe(this,t).concat()},Me.retry=function(t){return Pe(this,t).catchException()},Me.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 cn(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()})})},Me.skipLast=function(t){var e=this;return new cn(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))})},Me.startWith=function(){var t,e,n=0;return arguments.length&&"now"in Object(arguments[0])?(e=arguments[0],n=1):e=Se,t=ce.call(arguments,n),Le([$e(t,e),this]).concat()},Me.takeLast=function(t,e){return this.takeLastBuffer(t).selectMany(function(t){return $e(t,e)})},Me.takeLastBuffer=function(t){var e=this;return new cn(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()})})},Me.select=Me.map=function(e,n){var r=this;return new cn(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))})},Me.selectMany=Me.flatMap=function(t,e){return e?this.selectMany(function(n,r){var i=t(n,r),o=s(i)?en(i):i;return o.select(function(t){return e(n,t,r)})}):"function"==typeof t?g.call(this,t):g.call(this,function(){return t})},Me.selectSwitch=Me.flatMapLatest=function(t,e){return this.select(t,e).switchLatest()},Me.skip=function(t){if(0>t)throw Error(P);var e=this;return new cn(function(n){var r=t;return e.subscribe(function(t){0>=r?n.onNext(t):r--},n.onError.bind(n),n.onCompleted.bind(n))})},Me.skipWhile=function(e,n){var r=this;return new cn(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))})},Me.take=function(t,e){if(0>t)throw Error(P);if(0===t)return Qe(e);var n=this;return new cn(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))})},Me.takeWhile=function(e,n){var r=this;return new cn(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))})},Me.where=Me.filter=function(e,n){var r=this;return new cn(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))})},Fe.fromCallback=function(e,n,r,i){return n||(n=Se),function(){var o=ce.call(arguments,0);return new cn(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)})})}},Fe.fromNodeCallback=function(e,n,r,i){return n||(n=Se),function(){var o=ce.call(arguments,0);return new cn(function(s){return n.schedule(function(){function n(e){if(e)return s.onError(e),t;
var n=ce.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)})})}},Fe.fromEvent=function(e,n,r){return new cn(function(i){return E(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()},Fe.fromEventPattern=function(e,n,r){return new cn(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 me(function(){n&&n(o,s)})}).publish().refCount()};var en=Fe.fromPromise=function(t){return new cn(function(e){t.then(function(t){e.onNext(t),e.onCompleted()},function(t){e.onError(t)})})};Me.toPromise=function(t){if(t||(t=k.config.Promise),!t)throw Error("Promise type not provided nor in Rx.config.Promise");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)})})},Fe.startAsync=function(t){var e;try{e=t()}catch(n){return Ke(n)}return en(e)},Me.multicast=function(t,e){var n=this;return"function"==typeof t?new cn(function(r){var i=n.multicast(t());return new de(e(i).subscribe(r),i.connect())}):new nn(n,t)},Me.publish=function(t){return t?this.multicast(function(){return new hn},t):this.multicast(new hn)},Me.share=function(){return this.publish(null).refCount()},Me.publishLast=function(t){return t?this.multicast(function(){return new fn},t):this.multicast(new fn)},Me.publishValue=function(t,e){return 2===arguments.length?this.multicast(function(){return new dn(e)},t):this.multicast(new dn(t))},Me.shareValue=function(t){return this.publishValue(t).refCount()},Me.replay=function(t,e,n,r){return t?this.multicast(function(){return new bn(e,n,r)},t):this.multicast(new bn(e,n,r))},Me.shareReplay=function(t,e,n){return this.replay(null,t,e,n).refCount()};var nn=k.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 de(i.source.subscribe(i.subject),me(function(){i.hasSubscription=!1}))),i.subscription},t.call(this,r)}return ae(e,t),e.prototype.connect=function(){return this.connect()},e.prototype.refCount=function(){var t=null,e=0,n=this;return new cn(function(r){var i,o;return e++,i=1===e,o=n.subscribe(r),i&&(t=n.connect()),me(function(){o.dispose(),e--,0===e&&t.dispose()})})},e}(Fe),rn=Fe.interval=function(t,e){return e||(e=_e),D(t,t,e)},on=Fe.timer=function(e,n,r){var i;return r||(r=_e),"number"==typeof n?i=n:"object"==typeof n&&"now"in n&&(r=n),i===t?C(e,r):D(e,i,r)};Me.delay=function(t,e){e||(e=_e);var n=this;return new cn(function(r){var i,o=!1,s=new xe,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 ge,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 de(i,s)})},Me.throttle=function(t,e){return e||(e=_e),this.throttleWithSelector(function(){return on(t,e)})},Me.timeInterval=function(t){var e=this;return t||(t=_e),He(function(){var n=t.now();return e.select(function(e){var r=t.now(),i=r-n;return n=r,{value:e,interval:i}})})},Me.timestamp=function(t){return t||(t=_e),this.select(function(e){return{value:e,timestamp:t.now()}})},Me.sample=function(t,e){return e||(e=_e),"number"==typeof t?S(this,rn(t,e)):S(this,t)},Me.timeout=function(t,e,n){var r,i=this;return e||(e=Ke(Error("Timeout"))),n||(n=_e),r=t instanceof Date?function(t,e){n.scheduleWithAbsolute(t,e)}:function(t,e){n.scheduleWithRelative(t,e)},new cn(function(n){var o,s=0,u=new ge,c=new xe,a=!1,l=new xe;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 de(c,l)})},Fe.generateWithTime=function(e,n,r,i,o,s){return s||(s=_e),new cn(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()})})},Me.delaySubscription=function(t,e){return e||(e=_e),this.delayWithSelector(on(t,e),function(){return Qe()})},Me.delayWithSelector=function(e,n){var r,i,o=this;return"function"==typeof e?i=e:(r=e,i=n),new cn(function(e){var n=new de,s=!1,u=function(){s&&0===n.length&&e.onCompleted()},c=new xe,a=function(){c.setDisposable(o.subscribe(function(r){var o;try{o=i(r)}catch(s){return e.onError(s),t}var c=new ge;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 de(c,n)})},Me.timeoutWithSelector=function(e,n,r){if(1===arguments.length){n=e;var e=Xe()}r||(r=Ke(Error("Timeout")));var i=this;return new cn(function(o){var s=new xe,u=new xe,c=new ge;s.setDisposable(c);var a=0,l=!1,h=function(t){var e=a,n=function(){return a===e},i=new ge;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 de(s,u)})},Me.throttleWithSelector=function(e){var n=this;return new cn(function(r){var i,o=!1,s=new xe,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 ge;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 de(c,s)})},Me.skipLastWithTime=function(t,e){e||(e=_e);var n=this;return new cn(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()})})},Me.takeLastWithTime=function(t,e,n){return this.takeLastBufferWithTime(t,e).selectMany(function(t){return $e(t,n)})},Me.takeLastBufferWithTime=function(t,e){var n=this;return e||(e=_e),new cn(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()})})},Me.takeWithTime=function(t,e){var n=this;return e||(e=_e),new cn(function(r){var i=e.scheduleWithRelative(t,function(){r.onCompleted()});return new de(i,n.subscribe(r))})},Me.skipWithTime=function(t,e){var n=this;return e||(e=_e),new cn(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 de(o,s)})},Me.skipUntilWithTime=function(t,e){e||(e=_e);var n=this;return new cn(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 de(o,s)})},Me.takeUntilWithTime=function(t,e){e||(e=_e);var n=this;return new cn(function(r){return new de(e.scheduleWithAbsolute(t,function(){r.onCompleted()}),n.subscribe(r))})},Me.pausable=function(t){var e=this;return new cn(function(n){var r=e.publish(),i=r.subscribe(n),o=ye,s=t.distinctUntilChanged().subscribe(function(t){t?o=r.connect():(o.dispose(),o=ye)});return new de(i,o,s)})},Me.pausableBuffered=function(t){var e=this;return new cn(function(n){var r=[],i=!0,o=N(e,t.distinctUntilChanged(),function(t,e){return{data:t,shouldFire:e}}).subscribe(function(t){if(t.shouldFire&&i&&n.onNext(t.data),t.shouldFire&&!i){for(;r.length>0;)n.onNext(r.shift());i=!0}else t.shouldFire||i?!t.shouldFire&&i&&(i=!1):r.push(t.data)},n.onError.bind(n),n.onCompleted.bind(n));return t.onNext(!1),o})},Me.controlled=function(t){return null==t&&(t=!0),new sn(this,t)};var sn=function(t){function e(t){return this.source.subscribe(t)}function n(n,r){t.call(this,e),this.subject=new un(r),this.source=n.multicast(this.subject).refCount()}return ae(n,t),n.prototype.request=function(t){return null==t&&(t=-1),this.subject.request(t)},n}(Fe),un=k.ControlledSubject=function(t){function e(t){return this.subject.subscribe(t)}function n(n){null==n&&(n=!0),t.call(this,e),this.subject=new hn,this.enableQueue=n,this.queue=n?[]:null,this.requestedCount=0,this.requestedDisposable=ye,this.error=null,this.hasFailed=!1,this.hasCompleted=!1,this.controlledDisposable=ye}return ae(n,t),le(n.prototype,Ve,{onCompleted:function(){u.call(this),this.hasCompleted=!0,this.enableQueue&&0!==this.queue.length||this.subject.onCompleted()},onError:function(t){u.call(this),this.hasFailed=!0,this.error=t,this.enableQueue&&0!==this.queue.length||this.subject.onError(t)},onNext:function(t){u.call(this);var e=!1;0===this.requestedCount?this.enableQueue&&this.queue.push(t):(-1!==this.requestedCount&&0===this.requestedCount--&&this.disposeCurrentRequest(),e=!0),e&&this.subject.onNext(t)},_processRequest:function(t){if(this.enableQueue){for(;this.queue.length>=t&&t>0;)this.subject.onNext(this.queue.shift()),t--;return 0!==this.queue.length?{numberOfItems:t,returnValue:!0}:{numberOfItems:t,returnValue:!1}}return this.hasFailed?(this.subject.onError(this.error),this.controlledDisposable.dispose(),this.controlledDisposable=ye):this.hasCompleted&&(this.subject.onCompleted(),this.controlledDisposable.dispose(),this.controlledDisposable=ye),{numberOfItems:t,returnValue:!1}},request:function(t){u.call(this),this.disposeCurrentRequest();var e=this,n=this._processRequest(t);return t=n.numberOfItems,n.returnValue?ye:(this.requestedCount=t,this.requestedDisposable=me(function(){e.requestedCount=0}),this.requestedDisposable)},disposeCurrentRequest:function(){this.requestedDisposable.dispose(),this.requestedDisposable=ye},dispose:function(){this.isDisposed=!0,this.error=null,this.subject.dispose(),this.requestedDisposable.dispose()}}),n}(Fe),cn=k.AnonymousObservable=function(e){function n(e){return e===t?e=ye:"function"==typeof e&&(e=me(e)),e}function r(i){function o(t){var e=new an(t);if(Ne.scheduleRequired())Ne.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 ae(r,e),r}(Fe),an=function(t){function e(e){t.call(this),this.observer=e,this.m=new ge}ae(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}(Ie),ln=function(t,e){this.subject=t,this.observer=e};ln.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 hn=k.Subject=function(t){function e(t){return u.call(this),this.isStopped?this.exception?(t.onError(this.exception),ye):(t.onCompleted(),ye):(this.observers.push(t),new ln(this,t))}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return ae(n,t),le(n.prototype,Ve,{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 pn(t,e)},n}(Fe),fn=k.AsyncSubject=function(t){function e(t){if(u.call(this),!this.isStopped)return this.observers.push(t),new ln(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(),ye}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return ae(n,t),le(n.prototype,Ve,{hasObservers:function(){return u.call(this),this.observers.length>0},onCompleted:function(){var t,e,n;if(u.call(this),!this.isStopped){this.isStopped=!0;var r=this.observers.slice(0),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}(Fe),pn=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 ae(n,t),le(n.prototype,Ve,{onCompleted:function(){this.observer.onCompleted()},onError:function(t){this.observer.onError(t)},onNext:function(t){this.observer.onNext(t)}}),n}(Fe),dn=k.BehaviorSubject=function(t){function e(t){if(u.call(this),!this.isStopped)return this.observers.push(t),t.onNext(this.value),new ln(this,t);var e=this.exception;return e?t.onError(e):t.onCompleted(),ye}function n(n){t.call(this,e),this.value=n,this.observers=[],this.isDisposed=!1,this.isStopped=!1,this.exception=null}return ae(n,t),le(n.prototype,Ve,{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}(Fe),bn=k.ReplaySubject=function(t){function e(t,e){this.subject=t,this.observer=e}function n(t){var n=new Ue(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||Ne,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)}},ae(r,t),le(r.prototype,Ve,{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}(Fe);"function"==typeof define&&"object"==typeof define.amd&&define.amd?(O.Rx=k,define(function(){return k})):_&&R?j?(R.exports=k).Rx=k:_.Rx=k:O.Rx=k}).call(this);