Socket
Socket
Sign inDemoInstall

rx

Package Overview
Dependencies
Maintainers
2
Versions
103
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rx - npm Package Compare versions

Comparing version 2.1.13 to 2.1.14

2

bower.json
{
"name": "Rx",
"version": "2.1.13",
"version": "2.1.14",
"main": [

@@ -5,0 +5,0 @@ "rx.js",

@@ -5,3 +5,3 @@ {

"description": "Library for composing asynchronous and event-based operations in JavaScript",
"version": "2.1.13",
"version": "2.1.14",
"homepage": "http://rx.codeplex.com",

@@ -8,0 +8,0 @@ "author": {

(function(t,e){function n(){}function r(t){return t}function i(){return(new Date).getTime()}function o(t,e){return F(t,e)}function s(t,e){return t-e}function u(t){return""+t}function c(t){throw t}function a(){if(this.isDisposed)throw Error(_)}function h(t){return"function"!=typeof t.toString&&"string"==typeof(t+"")}function l(t){return t&&"object"==typeof t?M.call(t)==O:!1}function f(t){return"function"==typeof t}function p(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&&N[o]||e&&N[s]))return!1;if(null==t||null==e)return t===e;var u=M.call(t),c=M.call(e);if(u==O&&(u=T),c==O&&(c=T),u!=c)return!1;switch(u){case W:case k:return+t==+e;case q:return t!=+t?e!=+e:0==t?1/t==1/e:t==+e;case I:case P:return t==e+""}var a=u==R;if(!a){if(u!=T||!C&&(h(t)||h(e)))return!1;var d=!V&&l(t)?Object:t.constructor,b=!V&&l(e)?Object:e.constructor;if(d!=b&&!(f(d)&&d instanceof d&&f(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),a){for(v=t.length,m=e.length,i=m==t.length;m--;){var y=e[m];if(!(i=p(t[m],y,n,r)))break}return i}for(var w in e)if(L.call(e,w))return m++,i=L.call(t,w)&&p(t[w],e[w],n,r);if(i)for(var w in t)if(L.call(t,w))return i=--m>-1;return n.pop(),r.pop(),i}function d(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:B.call(t)}function b(t,e){for(var n=Array(t),r=0;t>r;r++)n[r]=e();return n}function v(t,e){this.scheduler=t,this.disposable=e,this.isDisposed=!1}function m(t,e,n,r,i){this.scheduler=t,this.state=e,this.action=n,this.dueTime=r,this.comparer=i||s,this.disposable=new re}function y(t,n){return new Ge(function(r){var i=new re,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 re,o.setDisposable(i),i.setDisposable(s.subscribe(r))},r.onCompleted.bind(r))),o})}function w(t,n){var r=this;return new Ge(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 g(t){return this.select(t).mergeObservable()}var E="object"==typeof exports&&exports,x=("object"==typeof module&&module&&module.exports==E&&module,"object"==typeof global&&global);x.global===x&&(t=x);var C,D={Internals:{}},A="Sequence contains no elements.",S="Argument out of range",_="Object has been disposed",N={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},O="[object Arguments]",R="[object Array]",W="[object Boolean]",k="[object Date]",j="[object Function]",q="[object Number]",T="[object Object]",I="[object RegExp]",P="[object String]",M=Object.prototype.toString,L=Object.prototype.hasOwnProperty,V=M.call(arguments)==O;try{C=!(M.call(document)==T&&!({toString:0}+""))}catch(z){C=!0}V||(l=function(t){return t&&"object"==typeof t?L.call(t,"callee"):!1}),f(/x/)&&(f=function(t){return"function"==typeof t&&M.call(t)==j});var F=D.Internals.isEqual=function(t,e){return p(t,e,[],[])},B=Array.prototype.slice;({}).hasOwnProperty;var H=this.inherits=D.Internals.inherits=function(t,e){function n(){this.constructor=t}n.prototype=e.prototype,t.prototype=new n},U=D.Internals.addProperties=function(t){for(var e=B.call(arguments,1),n=0,r=e.length;r>n;n++){var i=e[n];for(var o in i)t[o]=i[o]}},G=D.Internals.addRef=function(t,e){return new Ge(function(n){return new Z(e.getDisposable(),t.subscribe(n))})};Function.prototype.bind||(Function.prototype.bind=function(t){var e=this,n=B.call(arguments,1),r=function(){function i(){}if(this instanceof r){i.prototype=e.prototype;var o=new i,s=e.apply(o,n.concat(B.call(arguments)));return Object(s)===s?s:o}return e.apply(t,n.concat(B.call(arguments)))};return r});var J=Object("a"),K="a"!=J[0]||!(0 in J);Array.prototype.every||(Array.prototype.every=function(t){var e=Object(this),n=K&&"[object String]"=={}.toString.call(this)?this.split(""):e,r=n.length>>>0,i=arguments[1];if("[object Function]"!={}.toString.call(t))throw new TypeError(t+" is not a function");for(var o=0;r>o;o++)if(o in n&&!t.call(i,n[o],o,e))return!1;return!0}),Array.prototype.map||(Array.prototype.map=function(t){var e=Object(this),n=K&&"[object String]"=={}.toString.call(this)?this.split(""):e,r=n.length>>>0,i=Array(r),o=arguments[1];if("[object Function]"!={}.toString.call(t))throw new TypeError(t+" is not a function");for(var s=0;r>s;s++)s in n&&(i[s]=t.call(o,n[s],s,e));return i}),Array.prototype.filter||(Array.prototype.filter=function(t){for(var e,n=[],r=Object(this),i=0,o=r.length>>>0;o>i;i++)e=r[i],i in r&&t.call(arguments[1],e,i,r)&&n.push(e);return n}),Array.isArray||(Array.isArray=function(t){return"[object Array]"==Object.prototype.toString.call(t)}),Array.prototype.indexOf||(Array.prototype.indexOf=function(t){var e=Object(this),n=e.length>>>0;if(0===n)return-1;var r=0;if(arguments.length>1&&(r=Number(arguments[1]),r!==r?r=0:0!==r&&1/0!=r&&r!==-1/0&&(r=(r>0||-1)*Math.floor(Math.abs(r)))),r>=n)return-1;for(var i=r>=0?r:Math.max(n-Math.abs(r),0);n>i;i++)if(i in e&&e[i]===t)return i;return-1});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 X=function(t){this.items=Array(t),this.length=0},Y=X.prototype;Y.isHigherPriority=function(t,e){return 0>this.items[t].compareTo(this.items[e])},Y.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)}}},Y.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)}}},Y.peek=function(){return this.items[0].value},Y.removeAt=function(t){this.items[t]=this.items[--this.length],delete this.items[this.length],this.heapify()},Y.dequeue=function(){var t=this.peek();return this.removeAt(0),t},Y.enqueue=function(t){var e=this.length++;this.items[e]=new Q(X.count++,t),this.percolate(e)},Y.remove=function(t){for(var e=0;this.length>e;e++)if(this.items[e].value===t)return this.removeAt(e),!0;return!1},X.count=0;var Z=D.CompositeDisposable=function(){this.disposables=d(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},$=Z.prototype;$.add=function(t){this.isDisposed?t.dispose():(this.disposables.push(t),this.length++)},$.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},$.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()}},$.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()},$.contains=function(t){return-1!==this.disposables.indexOf(t)},$.toArray=function(){return this.disposables.slice(0)};var te=D.Disposable=function(t){this.isDisposed=!1,this.action=t||n};te.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var ee=te.create=function(t){return new te(t)},ne=te.empty={dispose:n},re=D.SingleAssignmentDisposable=function(){this.isDisposed=!1,this.current=null},ie=re.prototype;ie.disposable=function(t){return t?this.setDisposable(t):this.getDisposable()},ie.getDisposable=function(){return this.current},ie.setDisposable=function(t){if(this.current)throw Error("Disposable has already been assigned");var e=this.isDisposed;e||(this.current=t),e&&t&&t.dispose()},ie.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()};var oe=D.SerialDisposable=function(){this.isDisposed=!1,this.current=null};oe.prototype.getDisposable=function(){return this.current},oe.prototype.setDisposable=function(t){var e,n=this.isDisposed;n||(e=this.current,this.current=t),e&&e.dispose(),n&&t&&t.dispose()},oe.prototype.disposable=function(t){return t?(this.setDisposable(t),e):this.getDisposable()},oe.prototype.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()};var se=D.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?ne:new t(this)},e}();v.prototype.dispose=function(){var t=this;this.scheduler.schedule(function(){t.isDisposed||(t.isDisposed=!0,t.disposable.dispose())})},m.prototype.invoke=function(){this.disposable.disposable(this.invokeCore())},m.prototype.compareTo=function(t){return this.comparer(this.dueTime,t.dueTime)},m.prototype.isCancelled=function(){return this.disposable.isDisposed},m.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var ue=D.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 Z,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),ne});r||(i.add(s),n=!0)})};return o(n),i}function r(t,e,n){var r=e.first,i=e.second,o=new Z,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),ne});u||(o.add(c),i=!0)})};return s(r),o}function o(t,e){return e(),ne}var s=e.prototype;return s.catchException=function(t){return new be(this,t)},s.schedulePeriodic=function(t,e){return this.schedulePeriodicWithState(null,t,function(){e()})},s.schedulePeriodicWithState=function(e,n,r){var i=e,o=t.setInterval(function(){i=r(i)},n);return ee(function(){t.clearInterval(o)})},s.schedule=function(t){return this._schedule(t,o)},s.scheduleWithState=function(t,e){return this._schedule(t,e)},s.scheduleWithRelative=function(t,e){return this._scheduleRelative(e,t,o)},s.scheduleWithRelativeAndState=function(t,e,n){return this._scheduleRelative(t,e,n)},s.scheduleWithAbsolute=function(t,e){return this._scheduleAbsolute(e,t,o)},s.scheduleWithAbsoluteAndState=function(t,e,n){return this._scheduleAbsolute(t,e,n)},s.scheduleRecursive=function(t){return this.scheduleRecursiveWithState(t,function(t,e){t(function(){e(t)})})},s.scheduleRecursiveWithState=function(t,e){return this.scheduleWithState({first:t,second:e},function(t,e){return n(t,e)})},s.scheduleRecursiveWithRelative=function(t,e){return this.scheduleRecursiveWithRelativeAndState(e,t,function(t,e){t(function(n){e(t,n)})})},s.scheduleRecursiveWithRelativeAndState=function(t,e,n){return this._scheduleRelative({first:t,second:n},e,function(t,e){return r(t,e,"scheduleWithRelativeAndState")})},s.scheduleRecursiveWithAbsolute=function(t,e){return this.scheduleRecursiveWithAbsoluteAndState(e,t,function(t,e){t(function(n){e(t,n)})})},s.scheduleRecursiveWithAbsoluteAndState=function(t,e,n){return this._scheduleAbsolute({first:t,second:n},e,function(t,e){return r(t,e,"scheduleWithAbsoluteAndState")})},e.now=i,e.normalize=function(t){return 0>t&&(t=0),t},e}(),ce="Scheduler is not allowed to block the thread",ae=ue.immediate=function(){function t(t,e){return e(this,t)}function e(t,e,n){if(e>0)throw Error(ce);return n(this,t)}function n(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new ue(i,t,e,n)}(),he=ue.currentThread=function(){function t(){o=new X(4)}function e(t,e){return this.scheduleWithRelativeAndState(t,0,e)}function n(e,n,r){var i,s=this.now()+ue.normalize(n),u=new m(this,e,r,s);if(o)o.enqueue(u);else{i=new t;try{o.enqueue(u),i.run()}catch(c){throw c}finally{i.dispose()}}return u.disposable}function r(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}var o;t.prototype.dispose=function(){o=null},t.prototype.run=function(){for(var t;o.length>0;)if(t=o.dequeue(),!t.isCancelled()){for(;t.dueTime-ue.now()>0;);t.isCancelled()||t.invoke()}};var s=new ue(i,e,n,r);return s.scheduleRequired=function(){return null===o},s.ensureTrampoline=function(t){return null===o?this.schedule(t):t()},s}(),le=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 re;return this._cancel=e,e.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,t.bind(this))),e},e}();D.VirtualTimeScheduler=function(t){function n(){return this.toDateTimeOffset(this.clock)}function r(t,e){return this.scheduleAbsoluteWithState(t,this.clock,e)}function i(t,e,n){return this.scheduleRelativeWithState(t,this.toRelative(e),n)}function o(t,e,n){return this.scheduleRelativeWithState(t,this.toRelative(e-this.now()),n)}function s(t,e){return e(),ne}function u(e,s){this.clock=e,this.comparer=s,this.isEnabled=!1,this.queue=new X(1024),t.call(this,n,r,i,o)}H(u,t);var c=u.prototype;return c.schedulePeriodicWithState=function(t,e,n){var r=new le(this,t,e,n);return r.start()},c.scheduleRelativeWithState=function(t,e,n){var r=this.add(this.clock,e);return this.scheduleAbsoluteWithState(t,r,n)},c.scheduleRelative=function(t,e){return this.scheduleRelativeWithState(e,t,s)},c.start=function(){var t;if(!this.isEnabled){this.isEnabled=!0;do t=this.getNext(),null!==t?(this.comparer(t.dueTime,this.clock)>0&&(this.clock=t.dueTime),t.invoke()):this.isEnabled=!1;while(this.isEnabled)}},c.stop=function(){this.isEnabled=!1},c.advanceTo=function(t){var e,n=this.comparer(this.clock,t);if(this.comparer(this.clock,t)>0)throw Error(S);if(0!==n&&!this.isEnabled){this.isEnabled=!0;do e=this.getNext(),null!==e&&0>=this.comparer(e.dueTime,t)?(this.comparer(e.dueTime,this.clock)>0&&(this.clock=e.dueTime),e.invoke()):this.isEnabled=!1;while(this.isEnabled);this.clock=t}},c.advanceBy=function(t){var n=this.add(this.clock,t),r=this.comparer(this.clock,n);if(r>0)throw Error(S);return 0!==r?this.advanceTo(n):e},c.sleep=function(t){var e=this.add(this.clock,t);if(this.comparer(this.clock,e)>=0)throw Error(S);this.clock=e},c.getNext=function(){for(var t;this.queue.length>0;){if(t=this.queue.peek(),!t.isCancelled())return t;this.queue.dequeue()}return null},c.scheduleAbsolute=function(t,e){return this.scheduleAbsoluteWithState(e,t,s)},c.scheduleAbsoluteWithState=function(t,e,n){var r=this,i=function(t,e){return r.queue.remove(o),n(t,e)},o=new m(r,t,i,e,r.comparer);return r.queue.enqueue(o),o.disposable},u}(ue),D.HistoricalScheduler=function(t){function e(e,n){var r=null==e?0:e,i=n||s;t.call(this,r,i)}H(e,t);var n=e.prototype;return n.add=function(t,e){return t+e},n.toDateTimeOffset=function(t){return new Date(t).getTime()},n.toRelative=function(t){return t},e}(D.VirtualTimeScheduler);var fe,pe=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)fe=t.setImmediate,pe=clearImmediate;else if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))fe=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),fe=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]},fe=function(t){var e=c++;u[e]=t,s.port2.postMessage(e)}}else"document"in t&&"onreadystatechange"in t.document.createElement("script")?fe=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)}:(fe=function(e){return t.setTimeout(e,0)},pe=t.clearTimeout)})();var de=ue.timeout=function(){function e(t,e){var n=this,r=new re,i=fe(function(){r.isDisposed||r.setDisposable(e(n,t))});return new Z(r,ee(function(){pe(i)}))}function n(e,n,r){var i=this,o=ue.normalize(n);if(0===o)return i.scheduleWithState(e,r);var s=new re,u=t.setTimeout(function(){s.isDisposed||s.setDisposable(r(i,e))},o);return new Z(s,ee(function(){t.clearTimeout(u)}))}function r(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new ue(i,e,n,r)}(),be=function(t){function e(){return this._scheduler.now()}function n(t,e){return this._scheduler.scheduleWithState(t,this._wrap(e))}function r(t,e,n){return this._scheduler.scheduleWithRelativeAndState(t,e,this._wrap(n))}function i(t,e,n){return this._scheduler.scheduleWithAbsoluteAndState(t,e,this._wrap(n))}function o(o,s){this._scheduler=o,this._handler=s,this._recursiveOriginal=null,this._recursiveWrapper=null,t.call(this,e,n,r,i)}return H(o,t),o.prototype._clone=function(t){return new o(t,this._handler)},o.prototype._wrap=function(t){var e=this;return function(n,r){try{return t(e._getRecursiveWrapper(n),r)}catch(i){if(!e._handler(i))throw i;return ne}}},o.prototype._getRecursiveWrapper=function(t){if(this._recursiveOriginal!==t){this._recursiveOriginal=t;var e=this._clone(t);e._recursiveOriginal=t,e._recursiveWrapper=e,this._recursiveWrapper=e}return this._recursiveWrapper},o.prototype.schedulePeriodicWithState=function(t,e,n){var r=this,i=!1,o=new re;return o.setDisposable(this._scheduler.schedulePeriodicWithState(t,e,function(t){if(i)return null;try{return n(t)}catch(e){if(i=!0,!r._handler(e))throw e;return o.dispose(),null}})),o},o}(ue),ve=D.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||ae,new Ge(function(n){return t.schedule(function(){e._acceptObservable(n),"N"===e.kind&&n.onCompleted()})})},t}(),me=ve.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 ve("N",!0);return i.value=r,i._accept=t.bind(i),i._acceptObservable=e.bind(i),i.toString=n.bind(i),i}}(),ye=ve.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 ve("E");return i.exception=r,i._accept=t.bind(i),i._acceptObservable=e.bind(i),i.toString=n.bind(i),i}}(),we=ve.createOnCompleted=function(){function t(t,e,n){return n()}function e(t){return t.onCompleted()}function n(){return"OnCompleted()"}return function(){var r=new ve("C");return r._accept=t.bind(r),r._acceptObservable=e.bind(r),r.toString=n.bind(r),r}}(),ge=D.Internals.Enumerator=function(t,e,n){this.moveNext=t,this.getCurrent=e,this.dispose=n},Ee=ge.create=function(t,e,r){var i=!1;return r||(r=n),new ge(function(){if(i)return!1;var e=t();return e||(i=!0,r()),e},function(){return e()},function(){i||(r(),i=!0)})},xe=D.Internals.Enumerable=function(){function t(t){this.getEnumerator=t}return t.prototype.concat=function(){var t=this;return new Ge(function(n){var r=t.getEnumerator(),i=!1,o=new oe,s=ae.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 h=new re;o.setDisposable(h),h.setDisposable(s.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){t()}))}});return new Z(o,s,ee(function(){i=!0,r.dispose()}))})},t.prototype.catchException=function(){var t=this;return new Ge(function(n){var r,i=t.getEnumerator(),o=!1,s=new oe,u=ae.scheduleRecursive(function(t){var u,c,a;if(a=!1,!o){try{a=i.moveNext(),a&&(u=i.getCurrent())}catch(h){c=h}if(c)return n.onError(c),e;if(!a)return r?n.onError(r):n.onCompleted(),e;var l=new re;s.setDisposable(l),l.setDisposable(u.subscribe(n.onNext.bind(n),function(e){r=e,t()},n.onCompleted.bind(n)))}});return new Z(s,u,ee(function(){o=!0}))})},t}(),Ce=xe.repeat=function(t,n){return n===e&&(n=-1),new xe(function(){var e,r=n;return Ee(function(){return 0===r?!1:(r>0&&r--,e=t,!0)},function(){return e})})},De=xe.forEach=function(t,e){return e||(e=r),new xe(function(){var n,r=-1;return Ee(function(){return++r<t.length?(n=e(t[r],r),!0):!1},function(){return n})})},Ae=D.Observer=function(){};Ae.prototype.toNotifier=function(){var t=this;return function(e){return e.accept(t)}},Ae.prototype.asObserver=function(){return new Oe(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},Ae.prototype.checked=function(){return new Re(this)};var Se=Ae.create=function(t,e,r){return t||(t=n),e||(e=c),r||(r=n),new Oe(t,e,r)};Ae.fromNotifier=function(t){return new Oe(function(e){return t(me(e))},function(e){return t(ye(e))},function(){return t(we())})};var _e,Ne=D.Internals.AbstractObserver=function(t){function e(){this.isStopped=!1,t.call(this)}return H(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(){return this.isStopped?!1:(this.isStopped=!0,this.error(!0),!0)},e}(Ae),Oe=D.AnonymousObserver=function(t){function e(e,n,r){t.call(this),this._onNext=e,this._onError=n,this._onCompleted=r}return H(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}(Ne),Re=function(t){function e(e){t.call(this),this._observer=e,this._state=0}H(e,t);var n=e.prototype;return n.onNext=function(t){this.checkAccess();try{this._observer.onNext(t)}catch(e){throw e}finally{this._state=0}},n.onError=function(t){this.checkAccess();try{this._observer.onError(t)}catch(e){throw e}finally{this._state=2}},n.onCompleted=function(){this.checkAccess();try{this._observer.onCompleted()}catch(t){throw t}finally{this._state=2}},n.checkAccess=function(){if(1===this._state)throw Error("Re-entrancy detected");if(2===this._state)throw Error("Observer completed");0===this._state&&(this._state=1)},e}(Ae),We=D.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 H(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}(Ne),ke=function(t){function e(){t.apply(this,arguments)}return H(e,t),e.prototype.next=function(e){t.prototype.next.call(this,e),this.ensureActive()},e.prototype.error=function(e){t.prototype.error.call(this,e),this.ensureActive()},e.prototype.completed=function(){t.prototype.completed.call(this),this.ensureActive()},e}(We),je=D.Observable=function(){function t(t){this._subscribe=t}return _e=t.prototype,_e.finalValue=function(){var t=this;return new Ge(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))})})},_e.subscribe=_e.forEach=function(t,e,n){var r;return r="object"==typeof t?t:Se(t,e,n),this._subscribe(r)},_e.toArray=function(){function t(t,e){var n=t.slice(0);return n.push(e),n}return this.scan([],t).startWith([]).finalValue()},t}();je.start=function(t,e,n){return qe(t,e,n)()};var qe=je.toAsync=function(t,n,r){return n||(n=de),function(){var i=B.call(arguments,0),o=new Ye;return n.schedule(function(){var n;try{n=t.apply(r,i)}catch(s){return o.onError(s),e}o.onNext(n),o.onCompleted()}),o.asObservable()}};_e.observeOn=function(t){var e=this;return new Ge(function(n){return e.subscribe(new ke(t,n))})},_e.subscribeOn=function(t){var e=this;return new Ge(function(n){var r=new re,i=new oe;return i.setDisposable(r),r.setDisposable(t.schedule(function(){i.setDisposable(new v(t,e.subscribe(n)))})),i})},je.create=function(t){return new Ge(function(e){return ee(t(e))})},je.createWithDisposable=function(t){return new Ge(t)};var Te=je.defer=function(t){return new Ge(function(e){var n;try{n=t()}catch(r){return Ve(r).subscribe(e)}return n.subscribe(e)})},Ie=je.empty=function(t){return t||(t=ae),new Ge(function(e){return t.schedule(function(){e.onCompleted()})})},Pe=je.fromArray=function(t,e){return e||(e=he),new Ge(function(n){var r=0;return e.scheduleRecursive(function(e){t.length>r?(n.onNext(t[r++]),e()):n.onCompleted()})})};je.generate=function(t,n,r,i,o){return o||(o=he),new Ge(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(h){return s.onError(h),e}o?(s.onNext(a),t()):s.onCompleted()})})};var Me=je.never=function(){return new Ge(function(){return ne})};je.range=function(t,e,n){return n||(n=he),new Ge(function(r){return n.scheduleRecursiveWithState(0,function(n,i){e>n?(r.onNext(t+n),i(n+1)):r.onCompleted()})})},je.repeat=function(t,e,n){return n||(n=he),null==e&&(e=-1),Le(t,n).repeat(e)};var Le=je["return"]=je.returnValue=function(t,e){return e||(e=ae),new Ge(function(n){return e.schedule(function(){n.onNext(t),n.onCompleted()})})},Ve=je["throw"]=je.throwException=function(t,e){return e||(e=ae),new Ge(function(n){return e.schedule(function(){n.onError(t)})})};je.using=function(t,e){return new Ge(function(n){var r,i,o=ne;try{r=t(),r&&(o=r),i=e(r)}catch(s){return new Z(Ve(s).subscribe(n),o)}return new Z(i.subscribe(n),o)})},_e.amb=function(t){var e=this;return new Ge(function(n){function r(){o||(o=s,a.dispose())}function i(){o||(o=u,c.dispose())}var o,s="L",u="R",c=new re,a=new re;return c.setDisposable(e.subscribe(function(t){r(),o===s&&n.onNext(t)},function(t){r(),o===s&&n.onError(t)},function(){r(),o===s&&n.onCompleted()})),a.setDisposable(t.subscribe(function(t){i(),o===u&&n.onNext(t)},function(t){i(),o===u&&n.onError(t)},function(){i(),o===u&&n.onCompleted()})),new Z(c,a)})},je.amb=function(){function t(t,e){return t.amb(e)}for(var e=Me(),n=d(arguments,0),r=0,i=n.length;i>r;r++)e=t(e,n[r]);return e},_e["catch"]=_e.catchException=function(t){return"function"==typeof t?y(this,t):ze([this,t])};var ze=je.catchException=je["catch"]=function(){var t=d(arguments,0);return De(t).catchException()};_e.combineLatest=function(){var t=B.call(arguments);return Array.isArray(t[0])?t[0].unshift(this):t.unshift(this),Fe.apply(this,t)};var Fe=je.combineLatest=function(){var t=B.call(arguments),n=t.pop();return Array.isArray(t[0])&&(t=t[0]),new Ge(function(r){function i(t){var i;if(c[t]=!0,a||(a=c.every(function(t){return t}))){try{i=n.apply(null,l)}catch(o){return r.onError(o),e}r.onNext(i)}else h.filter(function(e,n){return n!==t}).every(function(t){return t})&&r.onCompleted()}function o(t){h[t]=!0,h.every(function(t){return t})&&r.onCompleted()}for(var s=function(){return!1},u=t.length,c=b(u,s),a=!1,h=b(u,s),l=Array(u),f=Array(u),p=0;u>p;p++)(function(e){f[e]=new re,f[e].setDisposable(t[e].subscribe(function(t){l[e]=t,i(e)},r.onError.bind(r),function(){o(e)}))})(p);return new Z(f)})};_e.concat=function(){var t=B.call(arguments,0);return t.unshift(this),Be.apply(this,t)};var Be=je.concat=function(){var t=d(arguments,0);return De(t).concat()};_e.concatObservable=_e.concatAll=function(){return this.merge(1)},_e.merge=function(t){if("number"!=typeof t)return He(this,t);var e=this;return new Ge(function(n){var r=0,i=new Z,o=!1,s=[],u=function(t){var e=new re;i.add(e),e.setDisposable(t.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){var t;i.remove(e),s.length>0?(t=s.shift(),u(t)):(r--,o&&0===r&&n.onCompleted())}))};return i.add(e.subscribe(function(e){t>r?(r++,u(e)):s.push(e)},n.onError.bind(n),function(){o=!0,0===r&&n.onCompleted()})),i})};var He=je.merge=function(){var t,e;return arguments[0]?arguments[0].now?(t=arguments[0],e=B.call(arguments,1)):(t=ae,e=B.call(arguments,0)):(t=ae,e=B.call(arguments,1)),Array.isArray(e[0])&&(e=e[0]),Pe(e,t).mergeObservable()};_e.mergeObservable=_e.mergeAll=function(){var t=this;return new Ge(function(e){var n=new Z,r=!1,i=new re;return n.add(i),i.setDisposable(t.subscribe(function(t){var i=new re;n.add(i),i.setDisposable(t.subscribe(function(t){e.onNext(t)},e.onError.bind(e),function(){n.remove(i),r&&1===n.length&&e.onCompleted()}))},e.onError.bind(e),function(){r=!0,1===n.length&&e.onCompleted()})),n})},_e.onErrorResumeNext=function(t){if(!t)throw Error("Second observable is required");return Ue([this,t])};var Ue=je.onErrorResumeNext=function(){var t=d(arguments,0);return new Ge(function(e){var n=0,r=new oe,i=ae.scheduleRecursive(function(i){var o,s;t.length>n?(o=t[n++],s=new re,r.setDisposable(s),s.setDisposable(o.subscribe(e.onNext.bind(e),function(){i()},function(){i()}))):e.onCompleted()});return new Z(r,i)})};_e.skipUntil=function(t){var e=this;return new Ge(function(n){var r=!1,i=new Z(e.subscribe(function(t){r&&n.onNext(t)},n.onError.bind(n),function(){r&&n.onCompleted()})),o=new re;return i.add(o),o.setDisposable(t.subscribe(function(){r=!0,o.dispose()},n.onError.bind(n),function(){o.dispose()})),i})},_e.switchLatest=function(){var t=this;return new Ge(function(e){var n=!1,r=new oe,i=!1,o=0,s=t.subscribe(function(t){var s=new re,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 Z(s,r)})},_e.takeUntil=function(t){var e=this;return new Ge(function(r){return new Z(e.subscribe(r),t.subscribe(r.onCompleted.bind(r),r.onError.bind(r),n))})},_e.zip=function(){if(Array.isArray(arguments[0]))return w.apply(this,arguments);var t=this,n=B.call(arguments),i=n.pop();return n.unshift(t),new Ge(function(o){function s(t){a[t]=!0,a.every(function(t){return t})&&o.onCompleted()}for(var u=n.length,c=b(u,function(){return[]}),a=b(u,function(){return!1}),h=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(h){return o.onError(h),e}o.onNext(s)}else a.filter(function(t,e){return e!==n}).every(r)&&o.onCompleted()},l=Array(u),f=0;u>f;f++)(function(t){l[t]=new re,l[t].setDisposable(n[t].subscribe(function(e){c[t].push(e),h(t)},o.onError.bind(o),function(){s(t)}))})(f);return new Z(l)})},je.zip=function(){var t=B.call(arguments,0),e=t.shift();return e.zip.apply(e,t)},je.zipArray=function(){var t=B.call(arguments);return new Ge(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=b(s,function(){return[]}),c=b(s,function(){return!1}),a=Array(s),h=0;s>h;h++)(function(e){a[e]=new re,a[e].setDisposable(t[e].subscribe(function(t){u[e].push(t),i(e)},n.onError.bind(n),function(){o(e)}))})(h);var l=new Z(a);return l.add(ee(function(){for(var t=0,e=u.length;e>t;t++)u[t]=[]})),l})},_e.asObservable=function(){var t=this;return new Ge(function(e){return t.subscribe(e)})},_e.bufferWithCount=function(t,n){return n===e&&(n=t),this.windowWithCount(t,n).selectMany(function(t){return t.toArray()}).where(function(t){return t.length>0})},_e.dematerialize=function(){var t=this;return new Ge(function(e){return t.subscribe(function(t){return t.accept(e)},e.onError.bind(e),e.onCompleted.bind(e))})},_e.distinctUntilChanged=function(t,n){var i=this;return t||(t=r),n||(n=o),new Ge(function(r){var o,s=!1;return i.subscribe(function(i){var u,c=!1;try{u=t(i)}catch(a){return r.onError(a),e}if(s)try{c=n(o,u)}catch(a){return r.onError(a),e}s&&c||(s=!0,o=u,r.onNext(i))},r.onError.bind(r),r.onCompleted.bind(r))})},_e.doAction=function(t,e,n){var r,i=this;return"function"==typeof t?r=t:(r=t.onNext.bind(t),e=t.onError.bind(t),n=t.onCompleted.bind(t)),new Ge(function(t){return i.subscribe(function(e){try{r(e)}catch(n){t.onError(n)}t.onNext(e)},function(n){if(e){try{e(n)}catch(r){t.onError(r)}t.onError(n)}else t.onError(n)},function(){if(n){try{n()}catch(e){t.onError(e)}t.onCompleted()}else t.onCompleted()})})},_e.finallyAction=function(t){var e=this;return new Ge(function(n){var r=e.subscribe(n);return ee(function(){try{r.dispose()}catch(e){throw e}finally{t()}})})},_e.ignoreElements=function(){var t=this;return new Ge(function(e){return t.subscribe(n,e.onError.bind(e),e.onCompleted.bind(e))})},_e.materialize=function(){var t=this;return new Ge(function(e){return t.subscribe(function(t){e.onNext(me(t))},function(t){e.onNext(ye(t)),e.onCompleted()},function(){e.onNext(we()),e.onCompleted()})})},_e.repeat=function(t){return Ce(this,t).concat()},_e.retry=function(t){return Ce(this,t).catchException()},_e.scan=function(){var t,e,n=!1;2===arguments.length?(t=arguments[0],e=arguments[1],n=!0):e=arguments[0];var r=this;return Te(function(){var i,o=!1;return r.select(function(r){return o?i=e(i,r):(i=n?e(t,r):r,o=!0),i})})},_e.skipLast=function(t){var e=this;return new Ge(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&n.onNext(r.shift())},n.onError.bind(n),n.onCompleted.bind(n))})},_e.startWith=function(){var t,e,n=0;return arguments.length&&"now"in Object(arguments[0])?(e=arguments[0],n=1):e=ae,t=B.call(arguments,n),De([Pe(t,e),this]).concat()},_e.takeLast=function(t,e){return this.takeLastBuffer(t).selectMany(function(t){return Pe(t,e)})},_e.takeLastBuffer=function(t){var e=this;return new Ge(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&r.shift()},n.onError.bind(n),function(){n.onNext(r),n.onCompleted()})})},_e.windowWithCount=function(t,e){var n=this;if(0>=t)throw Error(S);if(null==e&&(e=t),0>=e)throw Error(S);return new Ge(function(r){var i=new re,o=new se(i),s=0,u=[],c=function(){var t=new Xe;u.push(t),r.onNext(G(t,o))};return c(),i.setDisposable(n.subscribe(function(n){for(var r,i=0,o=u.length;o>i;i++)u[i].onNext(n);var a=s-t+1;a>=0&&0===a%e&&(r=u.shift(),r.onCompleted()),s++,0===s%e&&c()},function(t){for(;u.length>0;)u.shift().onError(t);r.onError(t)},function(){for(;u.length>0;)u.shift().onCompleted();r.onCompleted()})),o})},_e.defaultIfEmpty=function(t){var n=this;return t===e&&(t=null),new Ge(function(e){var r=!1;return n.subscribe(function(t){r=!0,e.onNext(t)},e.onError.bind(e),function(){r||e.onNext(t),e.onCompleted()})})},_e.distinct=function(t,n){var i=this;return t||(t=r),n||(n=u),new Ge(function(r){var o={};return i.subscribe(function(i){var s,u,c,a=!1;try{s=t(i),u=n(s)}catch(h){return r.onError(h),e}for(c in o)if(u===c){a=!0;break}a||(o[u]=null,r.onNext(i))},r.onError.bind(r),r.onCompleted.bind(r))})},_e.groupBy=function(t,e,n){return this.groupByUntil(t,e,function(){return Me()},n)},_e.groupByUntil=function(t,i,o,s){var c=this;return i||(i=r),s||(s=u),new Ge(function(r){var u={},a=new Z,h=new se(a);return a.add(c.subscribe(function(c){var l,f,p,d,b,v,m,y,w,g;try{v=t(c),m=s(v)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}d=!1;try{w=u[m],w||(w=new Xe,u[m]=w,d=!0)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}if(d){b=new Ke(v,w,h),f=new Ke(v,w);try{l=o(f)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}r.onNext(b),y=new re,a.add(y);var x=function(){m in u&&(delete u[m],w.onCompleted()),a.remove(y)};y.setDisposable(l.take(1).subscribe(n,function(t){for(g in u)u[g].onError(t);r.onError(t)},function(){x()}))}try{p=i(c)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}w.onNext(p)},function(t){for(var e in u)u[e].onError(t);r.onError(t)},function(){for(var t in u)u[t].onCompleted();r.onCompleted()})),h})},_e.select=function(t,n){var r=this;return new Ge(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))})},_e.map=_e.select,_e.pluck=function(t){return this.select(function(e){return e[t]})},_e.selectMany=_e.flatMap=function(t,e){return e?this.selectMany(function(n){return t(n).select(function(t){return e(n,t)})}):"function"==typeof t?g.call(this,t):g.call(this,function(){return t})},_e.skip=function(t){if(0>t)throw Error(S);var e=this;return new Ge(function(n){var r=t;return e.subscribe(function(t){0>=r?n.onNext(t):r--},n.onError.bind(n),n.onCompleted.bind(n))})},_e.skipWhile=function(t){var n=this;return new Ge(function(r){var i=0,o=!1;return n.subscribe(function(n){if(!o)try{o=!t(n,i++)}catch(s){return r.onError(s),e}o&&r.onNext(n)},r.onError.bind(r),r.onCompleted.bind(r))})},_e.take=function(t,e){if(0>t)throw Error(S);if(0===t)return Ie(e);var n=this;return new Ge(function(e){var r=t;return n.subscribe(function(t){r>0&&(r--,e.onNext(t),0===r&&e.onCompleted())},e.onError.bind(e),e.onCompleted.bind(e))})},_e.takeWhile=function(t){var n=this;return new Ge(function(r){var i=0,o=!0;return n.subscribe(function(n){if(o){try{o=t(n,i++)}catch(s){return r.onError(s),e}o?r.onNext(n):r.onCompleted()}},r.onError.bind(r),r.onCompleted.bind(r))})},_e.where=function(t,n){var r=this;return new Ge(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))})},_e.filter=_e.where;var Ge=D.Internals.AnonymousObservable=function(t){function n(r){function i(t){var e=new Je(t);if(he.scheduleRequired())he.schedule(function(){try{e.disposable(r(e))}catch(t){if(!e.fail(t))throw t}});else try{e.disposable(r(e))}catch(n){if(!e.fail(n))throw n}return e}return this instanceof n?(t.call(this,i),e):new n(r)}return H(n,t),n}(je),Je=function(t){function e(e){t.call(this),this.observer=e,this.m=new re}H(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.disposable=function(t){return this.m.disposable(t)},n.dispose=function(){t.prototype.dispose.call(this),this.m.dispose()},e}(Ne),Ke=function(t){function e(t){return this.underlyingObservable.subscribe(t)}function n(n,r,i){t.call(this,e),this.key=n,this.underlyingObservable=i?new Ge(function(t){return new Z(i.getDisposable(),r.subscribe(t))}):r}return H(n,t),n}(je),Qe=function(t,e){this.subject=t,this.observer=e};Qe.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=D.Subject=function(t){function e(t){return a.call(this),this.isStopped?this.exception?(t.onError(this.exception),ne):(t.onCompleted(),ne):(this.observers.push(t),new Qe(this,t))}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return H(n,t),U(n.prototype,Ae,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(a.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(a.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(a.call(this),!this.isStopped)for(var e=this.observers.slice(0),n=0,r=e.length;r>n;n++)e[n].onNext(t)},dispose:function(){this.isDisposed=!0,this.observers=null}}),n.create=function(t,e){return new Ze(t,e)},n}(je),Ye=D.AsyncSubject=function(t){function e(t){if(a.call(this),!this.isStopped)return this.observers.push(t),new Qe(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(),ne}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return H(n,t),U(n.prototype,Ae,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){var t,e,n;if(a.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(a.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){a.call(this),this.isStopped||(this.value=t,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),n}(je),Ze=function(t){function e(t){return this.observable.subscribe(t)}function n(n,r){t.call(this,e),this.observer=n,this.observable=r}return H(n,t),U(n.prototype,Ae,{onCompleted:function(){this.observer.onCompleted()},onError:function(t){this.observer.onError(t)},onNext:function(t){this.observer.onNext(t)}}),n}(je);return"function"==typeof define&&"object"==typeof define.amd&&define.amd?(t.Rx=D,define(function(){return D})):(E?"object"==typeof module&&module&&module.exports==E?module.exports=D:E=D:t.Rx=D,e)})(this);
}function o(t){return c[t]=!0,c.every(r)?(n.onCompleted(),e):e}for(var s=t.length,u=b(s,function(){return[]}),c=b(s,function(){return!1}),a=Array(s),h=0;s>h;h++)(function(e){a[e]=new re,a[e].setDisposable(t[e].subscribe(function(t){u[e].push(t),i(e)},n.onError.bind(n),function(){o(e)}))})(h);var l=new Z(a);return l.add(ee(function(){for(var t=0,e=u.length;e>t;t++)u[t]=[]})),l})},_e.asObservable=function(){var t=this;return new Ge(function(e){return t.subscribe(e)})},_e.bufferWithCount=function(t,n){return n===e&&(n=t),this.windowWithCount(t,n).selectMany(function(t){return t.toArray()}).where(function(t){return t.length>0})},_e.dematerialize=function(){var t=this;return new Ge(function(e){return t.subscribe(function(t){return t.accept(e)},e.onError.bind(e),e.onCompleted.bind(e))})},_e.distinctUntilChanged=function(t,n){var i=this;return t||(t=r),n||(n=o),new Ge(function(r){var o,s=!1;return i.subscribe(function(i){var u,c=!1;try{u=t(i)}catch(a){return r.onError(a),e}if(s)try{c=n(o,u)}catch(a){return r.onError(a),e}s&&c||(s=!0,o=u,r.onNext(i))},r.onError.bind(r),r.onCompleted.bind(r))})},_e["do"]=_e.doAction=function(t,e,n){var r,i=this;return"function"==typeof t?r=t:(r=t.onNext.bind(t),e=t.onError.bind(t),n=t.onCompleted.bind(t)),new Ge(function(t){return i.subscribe(function(e){try{r(e)}catch(n){t.onError(n)}t.onNext(e)},function(n){if(e){try{e(n)}catch(r){t.onError(r)}t.onError(n)}else t.onError(n)},function(){if(n){try{n()}catch(e){t.onError(e)}t.onCompleted()}else t.onCompleted()})})},_e["finally"]=_e.finallyAction=function(t){var e=this;return new Ge(function(n){var r=e.subscribe(n);return ee(function(){try{r.dispose()}catch(e){throw e}finally{t()}})})},_e.ignoreElements=function(){var t=this;return new Ge(function(e){return t.subscribe(n,e.onError.bind(e),e.onCompleted.bind(e))})},_e.materialize=function(){var t=this;return new Ge(function(e){return t.subscribe(function(t){e.onNext(me(t))},function(t){e.onNext(ye(t)),e.onCompleted()},function(){e.onNext(we()),e.onCompleted()})})},_e.repeat=function(t){return Ce(this,t).concat()},_e.retry=function(t){return Ce(this,t).catchException()},_e.scan=function(){var t,e,n=!1;2===arguments.length?(t=arguments[0],e=arguments[1],n=!0):e=arguments[0];var r=this;return Te(function(){var i,o=!1;return r.select(function(r){return o?i=e(i,r):(i=n?e(t,r):r,o=!0),i})})},_e.skipLast=function(t){var e=this;return new Ge(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&n.onNext(r.shift())},n.onError.bind(n),n.onCompleted.bind(n))})},_e.startWith=function(){var t,e,n=0;return arguments.length&&"now"in Object(arguments[0])?(e=arguments[0],n=1):e=ae,t=B.call(arguments,n),De([Pe(t,e),this]).concat()},_e.takeLast=function(t,e){return this.takeLastBuffer(t).selectMany(function(t){return Pe(t,e)})},_e.takeLastBuffer=function(t){var e=this;return new Ge(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&r.shift()},n.onError.bind(n),function(){n.onNext(r),n.onCompleted()})})},_e.windowWithCount=function(t,e){var n=this;if(0>=t)throw Error(S);if(null==e&&(e=t),0>=e)throw Error(S);return new Ge(function(r){var i=new re,o=new se(i),s=0,u=[],c=function(){var t=new Xe;u.push(t),r.onNext(G(t,o))};return c(),i.setDisposable(n.subscribe(function(n){for(var r,i=0,o=u.length;o>i;i++)u[i].onNext(n);var a=s-t+1;a>=0&&0===a%e&&(r=u.shift(),r.onCompleted()),s++,0===s%e&&c()},function(t){for(;u.length>0;)u.shift().onError(t);r.onError(t)},function(){for(;u.length>0;)u.shift().onCompleted();r.onCompleted()})),o})},_e.defaultIfEmpty=function(t){var n=this;return t===e&&(t=null),new Ge(function(e){var r=!1;return n.subscribe(function(t){r=!0,e.onNext(t)},e.onError.bind(e),function(){r||e.onNext(t),e.onCompleted()})})},_e.distinct=function(t,n){var i=this;return t||(t=r),n||(n=u),new Ge(function(r){var o={};return i.subscribe(function(i){var s,u,c,a=!1;try{s=t(i),u=n(s)}catch(h){return r.onError(h),e}for(c in o)if(u===c){a=!0;break}a||(o[u]=null,r.onNext(i))},r.onError.bind(r),r.onCompleted.bind(r))})},_e.groupBy=function(t,e,n){return this.groupByUntil(t,e,function(){return Me()},n)},_e.groupByUntil=function(t,i,o,s){var c=this;return i||(i=r),s||(s=u),new Ge(function(r){var u={},a=new Z,h=new se(a);return a.add(c.subscribe(function(c){var l,f,p,d,b,v,m,y,w,g;try{v=t(c),m=s(v)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}d=!1;try{w=u[m],w||(w=new Xe,u[m]=w,d=!0)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}if(d){b=new Ke(v,w,h),f=new Ke(v,w);try{l=o(f)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}r.onNext(b),y=new re,a.add(y);var x=function(){m in u&&(delete u[m],w.onCompleted()),a.remove(y)};y.setDisposable(l.take(1).subscribe(n,function(t){for(g in u)u[g].onError(t);r.onError(t)},function(){x()}))}try{p=i(c)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}w.onNext(p)},function(t){for(var e in u)u[e].onError(t);r.onError(t)},function(){for(var t in u)u[t].onCompleted();r.onCompleted()})),h})},_e.select=_e.map=function(t,n){var r=this;return new Ge(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))})},_e.pluck=function(t){return this.select(function(e){return e[t]})},_e.selectMany=_e.flatMap=function(t,e){return e?this.selectMany(function(n){return t(n).select(function(t){return e(n,t)})}):"function"==typeof t?g.call(this,t):g.call(this,function(){return t})},_e.skip=function(t){if(0>t)throw Error(S);var e=this;return new Ge(function(n){var r=t;return e.subscribe(function(t){0>=r?n.onNext(t):r--},n.onError.bind(n),n.onCompleted.bind(n))})},_e.skipWhile=function(t){var n=this;return new Ge(function(r){var i=0,o=!1;return n.subscribe(function(n){if(!o)try{o=!t(n,i++)}catch(s){return r.onError(s),e}o&&r.onNext(n)},r.onError.bind(r),r.onCompleted.bind(r))})},_e.take=function(t,e){if(0>t)throw Error(S);if(0===t)return Ie(e);var n=this;return new Ge(function(e){var r=t;return n.subscribe(function(t){r>0&&(r--,e.onNext(t),0===r&&e.onCompleted())},e.onError.bind(e),e.onCompleted.bind(e))})},_e.takeWhile=function(t){var n=this;return new Ge(function(r){var i=0,o=!0;return n.subscribe(function(n){if(o){try{o=t(n,i++)}catch(s){return r.onError(s),e}o?r.onNext(n):r.onCompleted()}},r.onError.bind(r),r.onCompleted.bind(r))})},_e.where=_e.filter=function(t,n){var r=this;return new Ge(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))})};var Ge=D.Internals.AnonymousObservable=function(t){function n(r){function i(t){var e=new Je(t);if(he.scheduleRequired())he.schedule(function(){try{e.disposable(r(e))}catch(t){if(!e.fail(t))throw t}});else try{e.disposable(r(e))}catch(n){if(!e.fail(n))throw n}return e}return this instanceof n?(t.call(this,i),e):new n(r)}return H(n,t),n}(je),Je=function(t){function e(e){t.call(this),this.observer=e,this.m=new re}H(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.disposable=function(t){return this.m.disposable(t)},n.dispose=function(){t.prototype.dispose.call(this),this.m.dispose()},e}(Ne),Ke=function(t){function e(t){return this.underlyingObservable.subscribe(t)}function n(n,r,i){t.call(this,e),this.key=n,this.underlyingObservable=i?new Ge(function(t){return new Z(i.getDisposable(),r.subscribe(t))}):r}return H(n,t),n}(je),Qe=function(t,e){this.subject=t,this.observer=e};Qe.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=D.Subject=function(t){function e(t){return a.call(this),this.isStopped?this.exception?(t.onError(this.exception),ne):(t.onCompleted(),ne):(this.observers.push(t),new Qe(this,t))}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return H(n,t),U(n.prototype,Ae,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(a.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(a.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(a.call(this),!this.isStopped)for(var e=this.observers.slice(0),n=0,r=e.length;r>n;n++)e[n].onNext(t)},dispose:function(){this.isDisposed=!0,this.observers=null}}),n.create=function(t,e){return new Ze(t,e)},n}(je),Ye=D.AsyncSubject=function(t){function e(t){if(a.call(this),!this.isStopped)return this.observers.push(t),new Qe(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(),ne}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return H(n,t),U(n.prototype,Ae,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){var t,e,n;if(a.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(a.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){a.call(this),this.isStopped||(this.value=t,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),n}(je),Ze=function(t){function e(t){return this.observable.subscribe(t)}function n(n,r){t.call(this,e),this.observer=n,this.observable=r}return H(n,t),U(n.prototype,Ae,{onCompleted:function(){this.observer.onCompleted()},onError:function(t){this.observer.onError(t)},onNext:function(t){this.observer.onNext(t)}}),n}(je);return"function"==typeof define&&"object"==typeof define.amd&&define.amd?(t.Rx=D,define(function(){return D})):(E?"object"==typeof module&&module&&module.exports==E?module.exports=D:E=D:t.Rx=D,e)})(this);

@@ -1,2 +0,2 @@

(function(t,e){function n(){}function r(t){return t}function i(){return(new Date).getTime()}function o(t,e){return B(t,e)}function s(t,e){return t-e}function u(t){return""+t}function c(t){throw t}function a(){if(this.isDisposed)throw Error(_)}function h(t){return"function"!=typeof t.toString&&"string"==typeof(t+"")}function l(t){return t&&"object"==typeof t?M.call(t)==O:!1}function f(t){return"function"==typeof t}function p(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&&N[o]||e&&N[s]))return!1;if(null==t||null==e)return t===e;var u=M.call(t),c=M.call(e);if(u==O&&(u=T),c==O&&(c=T),u!=c)return!1;switch(u){case W:case k:return+t==+e;case q:return t!=+t?e!=+e:0==t?1/t==1/e:t==+e;case I:case P:return t==e+""}var a=u==R;if(!a){if(u!=T||!C&&(h(t)||h(e)))return!1;var d=!V&&l(t)?Object:t.constructor,b=!V&&l(e)?Object:e.constructor;if(d!=b&&!(f(d)&&d instanceof d&&f(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),a){for(v=t.length,m=e.length,i=m==t.length;m--;){var y=e[m];if(!(i=p(t[m],y,n,r)))break}return i}for(var w in e)if(L.call(e,w))return m++,i=L.call(t,w)&&p(t[w],e[w],n,r);if(i)for(var w in t)if(L.call(t,w))return i=--m>-1;return n.pop(),r.pop(),i}function d(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:F.call(t)}function b(t,e){for(var n=Array(t),r=0;t>r;r++)n[r]=e();return n}function v(t,e){this.scheduler=t,this.disposable=e,this.isDisposed=!1}function m(t,e,n,r,i){this.scheduler=t,this.state=e,this.action=n,this.dueTime=r,this.comparer=i||s,this.disposable=new ee}function y(t,n){return new He(function(r){var i=new ee,o=new re;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 ee,o.setDisposable(i),i.setDisposable(s.subscribe(r))},r.onCompleted.bind(r))),o})}function w(t,n){var r=this;return new He(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 g(t){return this.select(t).mergeObservable()}var E="object"==typeof exports&&exports,x=("object"==typeof module&&module&&module.exports==E&&module,"object"==typeof global&&global);x.global===x&&(t=x);var C,D={Internals:{}},A="Sequence contains no elements.",S="Argument out of range",_="Object has been disposed",N={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},O="[object Arguments]",R="[object Array]",W="[object Boolean]",k="[object Date]",j="[object Function]",q="[object Number]",T="[object Object]",I="[object RegExp]",P="[object String]",M=Object.prototype.toString,L=Object.prototype.hasOwnProperty,V=M.call(arguments)==O;try{C=!(M.call(document)==T&&!({toString:0}+""))}catch(z){C=!0}V||(l=function(t){return t&&"object"==typeof t?L.call(t,"callee"):!1}),f(/x/)&&(f=function(t){return"function"==typeof t&&M.call(t)==j});var B=D.Internals.isEqual=function(t,e){return p(t,e,[],[])},F=Array.prototype.slice;({}).hasOwnProperty;var H=this.inherits=D.Internals.inherits=function(t,e){function n(){this.constructor=t}n.prototype=e.prototype,t.prototype=new n},U=D.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]}},G=D.Internals.addRef=function(t,e){return new He(function(n){return new X(e.getDisposable(),t.subscribe(n))})},J=function(t,e){this.id=t,this.value=e};J.prototype.compareTo=function(t){var e=this.value.compareTo(t.value);return 0===e&&(e=this.id-t.id),e};var K=function(t){this.items=Array(t),this.length=0},Q=K.prototype;Q.isHigherPriority=function(t,e){return 0>this.items[t].compareTo(this.items[e])},Q.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)}}},Q.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)}}},Q.peek=function(){return this.items[0].value},Q.removeAt=function(t){this.items[t]=this.items[--this.length],delete this.items[this.length],this.heapify()},Q.dequeue=function(){var t=this.peek();return this.removeAt(0),t},Q.enqueue=function(t){var e=this.length++;this.items[e]=new J(K.count++,t),this.percolate(e)},Q.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 X=D.CompositeDisposable=function(){this.disposables=d(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},Y=X.prototype;Y.add=function(t){this.isDisposed?t.dispose():(this.disposables.push(t),this.length++)},Y.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},Y.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()}},Y.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()},Y.contains=function(t){return-1!==this.disposables.indexOf(t)},Y.toArray=function(){return this.disposables.slice(0)};var Z=D.Disposable=function(t){this.isDisposed=!1,this.action=t||n};Z.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var $=Z.create=function(t){return new Z(t)},te=Z.empty={dispose:n},ee=D.SingleAssignmentDisposable=function(){this.isDisposed=!1,this.current=null},ne=ee.prototype;ne.disposable=function(t){return t?this.setDisposable(t):this.getDisposable()},ne.getDisposable=function(){return this.current},ne.setDisposable=function(t){if(this.current)throw Error("Disposable has already been assigned");var e=this.isDisposed;e||(this.current=t),e&&t&&t.dispose()},ne.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()};var re=D.SerialDisposable=function(){this.isDisposed=!1,this.current=null};re.prototype.getDisposable=function(){return this.current},re.prototype.setDisposable=function(t){var e,n=this.isDisposed;n||(e=this.current,this.current=t),e&&e.dispose(),n&&t&&t.dispose()},re.prototype.disposable=function(t){return t?(this.setDisposable(t),e):this.getDisposable()},re.prototype.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()};var ie=D.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?te:new t(this)},e}();v.prototype.dispose=function(){var t=this;this.scheduler.schedule(function(){t.isDisposed||(t.isDisposed=!0,t.disposable.dispose())})},m.prototype.invoke=function(){this.disposable.disposable(this.invokeCore())},m.prototype.compareTo=function(t){return this.comparer(this.dueTime,t.dueTime)},m.prototype.isCancelled=function(){return this.disposable.isDisposed},m.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var oe=D.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 X,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),te});r||(i.add(s),n=!0)})};return o(n),i}function r(t,e,n){var r=e.first,i=e.second,o=new X,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),te});u||(o.add(c),i=!0)})};return s(r),o}function o(t,e){return e(),te}var s=e.prototype;return s.catchException=function(t){return new pe(this,t)},s.schedulePeriodic=function(t,e){return this.schedulePeriodicWithState(null,t,function(){e()})},s.schedulePeriodicWithState=function(e,n,r){var i=e,o=t.setInterval(function(){i=r(i)},n);return $(function(){t.clearInterval(o)})},s.schedule=function(t){return this._schedule(t,o)},s.scheduleWithState=function(t,e){return this._schedule(t,e)},s.scheduleWithRelative=function(t,e){return this._scheduleRelative(e,t,o)},s.scheduleWithRelativeAndState=function(t,e,n){return this._scheduleRelative(t,e,n)},s.scheduleWithAbsolute=function(t,e){return this._scheduleAbsolute(e,t,o)},s.scheduleWithAbsoluteAndState=function(t,e,n){return this._scheduleAbsolute(t,e,n)},s.scheduleRecursive=function(t){return this.scheduleRecursiveWithState(t,function(t,e){t(function(){e(t)})})},s.scheduleRecursiveWithState=function(t,e){return this.scheduleWithState({first:t,second:e},function(t,e){return n(t,e)})},s.scheduleRecursiveWithRelative=function(t,e){return this.scheduleRecursiveWithRelativeAndState(e,t,function(t,e){t(function(n){e(t,n)})})},s.scheduleRecursiveWithRelativeAndState=function(t,e,n){return this._scheduleRelative({first:t,second:n},e,function(t,e){return r(t,e,"scheduleWithRelativeAndState")})},s.scheduleRecursiveWithAbsolute=function(t,e){return this.scheduleRecursiveWithAbsoluteAndState(e,t,function(t,e){t(function(n){e(t,n)})})},s.scheduleRecursiveWithAbsoluteAndState=function(t,e,n){return this._scheduleAbsolute({first:t,second:n},e,function(t,e){return r(t,e,"scheduleWithAbsoluteAndState")})},e.now=i,e.normalize=function(t){return 0>t&&(t=0),t},e}(),se="Scheduler is not allowed to block the thread",ue=oe.immediate=function(){function t(t,e){return e(this,t)}function e(t,e,n){if(e>0)throw Error(se);return n(this,t)}function n(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new oe(i,t,e,n)}(),ce=oe.currentThread=function(){function t(){o=new K(4)}function e(t,e){return this.scheduleWithRelativeAndState(t,0,e)}function n(e,n,r){var i,s=this.now()+oe.normalize(n),u=new m(this,e,r,s);if(o)o.enqueue(u);else{i=new t;try{o.enqueue(u),i.run()}catch(c){throw c}finally{i.dispose()}}return u.disposable}function r(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}var o;t.prototype.dispose=function(){o=null},t.prototype.run=function(){for(var t;o.length>0;)if(t=o.dequeue(),!t.isCancelled()){for(;t.dueTime-oe.now()>0;);t.isCancelled()||t.invoke()}};var s=new oe(i,e,n,r);return s.scheduleRequired=function(){return null===o},s.ensureTrampoline=function(t){return null===o?this.schedule(t):t()},s}(),ae=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 ee;return this._cancel=e,e.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,t.bind(this))),e},e}();D.VirtualTimeScheduler=function(t){function n(){return this.toDateTimeOffset(this.clock)}function r(t,e){return this.scheduleAbsoluteWithState(t,this.clock,e)}function i(t,e,n){return this.scheduleRelativeWithState(t,this.toRelative(e),n)}function o(t,e,n){return this.scheduleRelativeWithState(t,this.toRelative(e-this.now()),n)}function s(t,e){return e(),te}function u(e,s){this.clock=e,this.comparer=s,this.isEnabled=!1,this.queue=new K(1024),t.call(this,n,r,i,o)}H(u,t);var c=u.prototype;return c.schedulePeriodicWithState=function(t,e,n){var r=new ae(this,t,e,n);return r.start()},c.scheduleRelativeWithState=function(t,e,n){var r=this.add(this.clock,e);return this.scheduleAbsoluteWithState(t,r,n)},c.scheduleRelative=function(t,e){return this.scheduleRelativeWithState(e,t,s)},c.start=function(){var t;if(!this.isEnabled){this.isEnabled=!0;do t=this.getNext(),null!==t?(this.comparer(t.dueTime,this.clock)>0&&(this.clock=t.dueTime),t.invoke()):this.isEnabled=!1;while(this.isEnabled)}},c.stop=function(){this.isEnabled=!1},c.advanceTo=function(t){var e,n=this.comparer(this.clock,t);if(this.comparer(this.clock,t)>0)throw Error(S);if(0!==n&&!this.isEnabled){this.isEnabled=!0;do e=this.getNext(),null!==e&&0>=this.comparer(e.dueTime,t)?(this.comparer(e.dueTime,this.clock)>0&&(this.clock=e.dueTime),e.invoke()):this.isEnabled=!1;while(this.isEnabled);this.clock=t}},c.advanceBy=function(t){var n=this.add(this.clock,t),r=this.comparer(this.clock,n);if(r>0)throw Error(S);return 0!==r?this.advanceTo(n):e},c.sleep=function(t){var e=this.add(this.clock,t);if(this.comparer(this.clock,e)>=0)throw Error(S);this.clock=e},c.getNext=function(){for(var t;this.queue.length>0;){if(t=this.queue.peek(),!t.isCancelled())return t;this.queue.dequeue()}return null},c.scheduleAbsolute=function(t,e){return this.scheduleAbsoluteWithState(e,t,s)},c.scheduleAbsoluteWithState=function(t,e,n){var r=this,i=function(t,e){return r.queue.remove(o),n(t,e)},o=new m(r,t,i,e,r.comparer);return r.queue.enqueue(o),o.disposable},u}(oe),D.HistoricalScheduler=function(t){function e(e,n){var r=null==e?0:e,i=n||s;t.call(this,r,i)}H(e,t);var n=e.prototype;return n.add=function(t,e){return t+e},n.toDateTimeOffset=function(t){return new Date(t).getTime()},n.toRelative=function(t){return t},e}(D.VirtualTimeScheduler);var he,le=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,le=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)},le=t.clearTimeout)})();var fe=oe.timeout=function(){function e(t,e){var n=this,r=new ee,i=he(function(){r.isDisposed||r.setDisposable(e(n,t))});return new X(r,$(function(){le(i)}))}function n(e,n,r){var i=this,o=oe.normalize(n);if(0===o)return i.scheduleWithState(e,r);var s=new ee,u=t.setTimeout(function(){s.isDisposed||s.setDisposable(r(i,e))},o);return new X(s,$(function(){t.clearTimeout(u)}))}function r(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new oe(i,e,n,r)}(),pe=function(t){function e(){return this._scheduler.now()}function n(t,e){return this._scheduler.scheduleWithState(t,this._wrap(e))}function r(t,e,n){return this._scheduler.scheduleWithRelativeAndState(t,e,this._wrap(n))}function i(t,e,n){return this._scheduler.scheduleWithAbsoluteAndState(t,e,this._wrap(n))}function o(o,s){this._scheduler=o,this._handler=s,this._recursiveOriginal=null,this._recursiveWrapper=null,t.call(this,e,n,r,i)}return H(o,t),o.prototype._clone=function(t){return new o(t,this._handler)},o.prototype._wrap=function(t){var e=this;return function(n,r){try{return t(e._getRecursiveWrapper(n),r)}catch(i){if(!e._handler(i))throw i;return te}}},o.prototype._getRecursiveWrapper=function(t){if(this._recursiveOriginal!==t){this._recursiveOriginal=t;var e=this._clone(t);e._recursiveOriginal=t,e._recursiveWrapper=e,this._recursiveWrapper=e}return this._recursiveWrapper},o.prototype.schedulePeriodicWithState=function(t,e,n){var r=this,i=!1,o=new ee;return o.setDisposable(this._scheduler.schedulePeriodicWithState(t,e,function(t){if(i)return null;try{return n(t)}catch(e){if(i=!0,!r._handler(e))throw e;return o.dispose(),null}})),o},o}(oe),de=D.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||ue,new He(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.bind(i),i._acceptObservable=e.bind(i),i.toString=n.bind(i),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.bind(i),i._acceptObservable=e.bind(i),i.toString=n.bind(i),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.bind(r),r._acceptObservable=e.bind(r),r.toString=n.bind(r),r}}(),ye=D.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=D.Internals.Enumerable=function(){function t(t){this.getEnumerator=t}return t.prototype.concat=function(){var t=this;return new He(function(n){var r=t.getEnumerator(),i=!1,o=new re,s=ue.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 h=new ee;o.setDisposable(h),h.setDisposable(s.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){t()}))}});return new X(o,s,$(function(){i=!0,r.dispose()}))})},t.prototype.catchException=function(){var t=this;return new He(function(n){var r,i=t.getEnumerator(),o=!1,s=new re,u=ue.scheduleRecursive(function(t){var u,c,a;if(a=!1,!o){try{a=i.moveNext(),a&&(u=i.getCurrent())}catch(h){c=h}if(c)return n.onError(c),e;if(!a)return r?n.onError(r):n.onCompleted(),e;var l=new ee;s.setDisposable(l),l.setDisposable(u.subscribe(n.onNext.bind(n),function(e){r=e,t()},n.onCompleted.bind(n)))}});return new X(s,u,$(function(){o=!0}))})},t}(),Ee=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})})},xe=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=D.Observer=function(){};Ce.prototype.toNotifier=function(){var t=this;return function(e){return e.accept(t)}},Ce.prototype.asObserver=function(){return new _e(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},Ce.prototype.checked=function(){return new Ne(this)};var De=Ce.create=function(t,e,r){return t||(t=n),e||(e=c),r||(r=n),new _e(t,e,r)};Ce.fromNotifier=function(t){return new _e(function(e){return t(be(e))},function(e){return t(ve(e))},function(){return t(me())})};var Ae,Se=D.Internals.AbstractObserver=function(t){function e(){this.isStopped=!1,t.call(this)}return H(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(){return this.isStopped?!1:(this.isStopped=!0,this.error(!0),!0)},e}(Ce),_e=D.AnonymousObserver=function(t){function e(e,n,r){t.call(this),this._onNext=e,this._onError=n,this._onCompleted=r}return H(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),Ne=function(t){function e(e){t.call(this),this._observer=e,this._state=0}H(e,t);var n=e.prototype;return n.onNext=function(t){this.checkAccess();try{this._observer.onNext(t)}catch(e){throw e}finally{this._state=0}},n.onError=function(t){this.checkAccess();try{this._observer.onError(t)}catch(e){throw e}finally{this._state=2}},n.onCompleted=function(){this.checkAccess();try{this._observer.onCompleted()}catch(t){throw t}finally{this._state=2}},n.checkAccess=function(){if(1===this._state)throw Error("Re-entrancy detected");if(2===this._state)throw Error("Observer completed");0===this._state&&(this._state=1)},e}(Ce),Oe=D.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 re}return H(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),Re=function(t){function e(){t.apply(this,arguments)}return H(e,t),e.prototype.next=function(e){t.prototype.next.call(this,e),this.ensureActive()},e.prototype.error=function(e){t.prototype.error.call(this,e),this.ensureActive()},e.prototype.completed=function(){t.prototype.completed.call(this),this.ensureActive()},e}(Oe),We=D.Observable=function(){function t(t){this._subscribe=t}return Ae=t.prototype,Ae.finalValue=function(){var t=this;return new He(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))})})},Ae.subscribe=Ae.forEach=function(t,e,n){var r;return r="object"==typeof t?t:De(t,e,n),this._subscribe(r)},Ae.toArray=function(){function t(t,e){var n=t.slice(0);return n.push(e),n}return this.scan([],t).startWith([]).finalValue()},t}();We.start=function(t,e,n){return ke(t,e,n)()};var ke=We.toAsync=function(t,n,r){return n||(n=fe),function(){var i=F.call(arguments,0),o=new Qe;return n.schedule(function(){var n;try{n=t.apply(r,i)}catch(s){return o.onError(s),e}o.onNext(n),o.onCompleted()}),o.asObservable()}};Ae.observeOn=function(t){var e=this;return new He(function(n){return e.subscribe(new Re(t,n))})},Ae.subscribeOn=function(t){var e=this;return new He(function(n){var r=new ee,i=new re;return i.setDisposable(r),r.setDisposable(t.schedule(function(){i.setDisposable(new v(t,e.subscribe(n)))})),i})},We.create=function(t){return new He(function(e){return $(t(e))})},We.createWithDisposable=function(t){return new He(t)};var je=We.defer=function(t){return new He(function(e){var n;try{n=t()}catch(r){return Me(r).subscribe(e)}return n.subscribe(e)})},qe=We.empty=function(t){return t||(t=ue),new He(function(e){return t.schedule(function(){e.onCompleted()})})},Te=We.fromArray=function(t,e){return e||(e=ce),new He(function(n){var r=0;return e.scheduleRecursive(function(e){t.length>r?(n.onNext(t[r++]),e()):n.onCompleted()})})};We.generate=function(t,n,r,i,o){return o||(o=ce),new He(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(h){return s.onError(h),e}o?(s.onNext(a),t()):s.onCompleted()})})};var Ie=We.never=function(){return new He(function(){return te})};We.range=function(t,e,n){return n||(n=ce),new He(function(r){return n.scheduleRecursiveWithState(0,function(n,i){e>n?(r.onNext(t+n),i(n+1)):r.onCompleted()})})},We.repeat=function(t,e,n){return n||(n=ce),null==e&&(e=-1),Pe(t,n).repeat(e)};var Pe=We["return"]=We.returnValue=function(t,e){return e||(e=ue),new He(function(n){return e.schedule(function(){n.onNext(t),n.onCompleted()})})},Me=We["throw"]=We.throwException=function(t,e){return e||(e=ue),new He(function(n){return e.schedule(function(){n.onError(t)})})};We.using=function(t,e){return new He(function(n){var r,i,o=te;try{r=t(),r&&(o=r),i=e(r)}catch(s){return new X(Me(s).subscribe(n),o)}return new X(i.subscribe(n),o)})},Ae.amb=function(t){var e=this;return new He(function(n){function r(){o||(o=s,a.dispose())}function i(){o||(o=u,c.dispose())}var o,s="L",u="R",c=new ee,a=new ee;return c.setDisposable(e.subscribe(function(t){r(),o===s&&n.onNext(t)},function(t){r(),o===s&&n.onError(t)},function(){r(),o===s&&n.onCompleted()})),a.setDisposable(t.subscribe(function(t){i(),o===u&&n.onNext(t)},function(t){i(),o===u&&n.onError(t)},function(){i(),o===u&&n.onCompleted()})),new X(c,a)})},We.amb=function(){function t(t,e){return t.amb(e)}for(var e=Ie(),n=d(arguments,0),r=0,i=n.length;i>r;r++)e=t(e,n[r]);return e},Ae["catch"]=Ae.catchException=function(t){return"function"==typeof t?y(this,t):Le([this,t])};var Le=We.catchException=We["catch"]=function(){var t=d(arguments,0);return xe(t).catchException()};Ae.combineLatest=function(){var t=F.call(arguments);return Array.isArray(t[0])?t[0].unshift(this):t.unshift(this),Ve.apply(this,t)};var Ve=We.combineLatest=function(){var t=F.call(arguments),n=t.pop();return Array.isArray(t[0])&&(t=t[0]),new He(function(r){function i(t){var i;if(c[t]=!0,a||(a=c.every(function(t){return t}))){try{i=n.apply(null,l)}catch(o){return r.onError(o),e}r.onNext(i)}else h.filter(function(e,n){return n!==t}).every(function(t){return t})&&r.onCompleted()}function o(t){h[t]=!0,h.every(function(t){return t})&&r.onCompleted()}for(var s=function(){return!1},u=t.length,c=b(u,s),a=!1,h=b(u,s),l=Array(u),f=Array(u),p=0;u>p;p++)(function(e){f[e]=new ee,f[e].setDisposable(t[e].subscribe(function(t){l[e]=t,i(e)},r.onError.bind(r),function(){o(e)}))})(p);return new X(f)})};Ae.concat=function(){var t=F.call(arguments,0);return t.unshift(this),ze.apply(this,t)};var ze=We.concat=function(){var t=d(arguments,0);return xe(t).concat()};Ae.concatObservable=Ae.concatAll=function(){return this.merge(1)},Ae.merge=function(t){if("number"!=typeof t)return Be(this,t);var e=this;return new He(function(n){var r=0,i=new X,o=!1,s=[],u=function(t){var e=new ee;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 Be=We.merge=function(){var t,e;return arguments[0]?arguments[0].now?(t=arguments[0],e=F.call(arguments,1)):(t=ue,e=F.call(arguments,0)):(t=ue,e=F.call(arguments,1)),Array.isArray(e[0])&&(e=e[0]),Te(e,t).mergeObservable()};Ae.mergeObservable=Ae.mergeAll=function(){var t=this;return new He(function(e){var n=new X,r=!1,i=new ee;return n.add(i),i.setDisposable(t.subscribe(function(t){var i=new ee;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})},Ae.onErrorResumeNext=function(t){if(!t)throw Error("Second observable is required");return Fe([this,t])};var Fe=We.onErrorResumeNext=function(){var t=d(arguments,0);return new He(function(e){var n=0,r=new re,i=ue.scheduleRecursive(function(i){var o,s;t.length>n?(o=t[n++],s=new ee,r.setDisposable(s),s.setDisposable(o.subscribe(e.onNext.bind(e),function(){i()},function(){i()}))):e.onCompleted()});return new X(r,i)})};Ae.skipUntil=function(t){var e=this;return new He(function(n){var r=!1,i=new X(e.subscribe(function(t){r&&n.onNext(t)},n.onError.bind(n),function(){r&&n.onCompleted()})),o=new ee;return i.add(o),o.setDisposable(t.subscribe(function(){r=!0,o.dispose()},n.onError.bind(n),function(){o.dispose()})),i})},Ae.switchLatest=function(){var t=this;return new He(function(e){var n=!1,r=new re,i=!1,o=0,s=t.subscribe(function(t){var s=new ee,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 X(s,r)})},Ae.takeUntil=function(t){var e=this;return new He(function(r){return new X(e.subscribe(r),t.subscribe(r.onCompleted.bind(r),r.onError.bind(r),n))})},Ae.zip=function(){if(Array.isArray(arguments[0]))return w.apply(this,arguments);var t=this,n=F.call(arguments),i=n.pop();return n.unshift(t),new He(function(o){function s(t){a[t]=!0,a.every(function(t){return t})&&o.onCompleted()}for(var u=n.length,c=b(u,function(){return[]}),a=b(u,function(){return!1}),h=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(h){return o.onError(h),e}o.onNext(s)}else a.filter(function(t,e){return e!==n}).every(r)&&o.onCompleted()},l=Array(u),f=0;u>f;f++)(function(t){l[t]=new ee,l[t].setDisposable(n[t].subscribe(function(e){c[t].push(e),h(t)},o.onError.bind(o),function(){s(t)}))})(f);return new X(l)})},We.zip=function(){var t=F.call(arguments,0),e=t.shift();return e.zip.apply(e,t)},We.zipArray=function(){var t=F.call(arguments);return new He(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=b(s,function(){return[]}),c=b(s,function(){return!1}),a=Array(s),h=0;s>h;h++)(function(e){a[e]=new ee,a[e].setDisposable(t[e].subscribe(function(t){u[e].push(t),i(e)},n.onError.bind(n),function(){o(e)}))})(h);var l=new X(a);return l.add($(function(){for(var t=0,e=u.length;e>t;t++)u[t]=[]})),l})},Ae.asObservable=function(){var t=this;return new He(function(e){return t.subscribe(e)})},Ae.bufferWithCount=function(t,n){return n===e&&(n=t),this.windowWithCount(t,n).selectMany(function(t){return t.toArray()}).where(function(t){return t.length>0})},Ae.dematerialize=function(){var t=this;return new He(function(e){return t.subscribe(function(t){return t.accept(e)},e.onError.bind(e),e.onCompleted.bind(e))})},Ae.distinctUntilChanged=function(t,n){var i=this;return t||(t=r),n||(n=o),new He(function(r){var o,s=!1;return i.subscribe(function(i){var u,c=!1;try{u=t(i)}catch(a){return r.onError(a),e}if(s)try{c=n(o,u)}catch(a){return r.onError(a),e}s&&c||(s=!0,o=u,r.onNext(i))},r.onError.bind(r),r.onCompleted.bind(r))})},Ae.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 He(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()})})},Ae.finallyAction=function(t){var e=this;return new He(function(n){var r=e.subscribe(n);return $(function(){try{r.dispose()
}catch(e){throw e}finally{t()}})})},Ae.ignoreElements=function(){var t=this;return new He(function(e){return t.subscribe(n,e.onError.bind(e),e.onCompleted.bind(e))})},Ae.materialize=function(){var t=this;return new He(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()})})},Ae.repeat=function(t){return Ee(this,t).concat()},Ae.retry=function(t){return Ee(this,t).catchException()},Ae.scan=function(){var t,e,n=!1;2===arguments.length?(t=arguments[0],e=arguments[1],n=!0):e=arguments[0];var r=this;return je(function(){var i,o=!1;return r.select(function(r){return o?i=e(i,r):(i=n?e(t,r):r,o=!0),i})})},Ae.skipLast=function(t){var e=this;return new He(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))})},Ae.startWith=function(){var t,e,n=0;return arguments.length&&"now"in Object(arguments[0])?(e=arguments[0],n=1):e=ue,t=F.call(arguments,n),xe([Te(t,e),this]).concat()},Ae.takeLast=function(t,e){return this.takeLastBuffer(t).selectMany(function(t){return Te(t,e)})},Ae.takeLastBuffer=function(t){var e=this;return new He(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()})})},Ae.windowWithCount=function(t,e){var n=this;if(0>=t)throw Error(S);if(null==e&&(e=t),0>=e)throw Error(S);return new He(function(r){var i=new ee,o=new ie(i),s=0,u=[],c=function(){var t=new Ke;u.push(t),r.onNext(G(t,o))};return c(),i.setDisposable(n.subscribe(function(n){for(var r,i=0,o=u.length;o>i;i++)u[i].onNext(n);var a=s-t+1;a>=0&&0===a%e&&(r=u.shift(),r.onCompleted()),s++,0===s%e&&c()},function(t){for(;u.length>0;)u.shift().onError(t);r.onError(t)},function(){for(;u.length>0;)u.shift().onCompleted();r.onCompleted()})),o})},Ae.defaultIfEmpty=function(t){var n=this;return t===e&&(t=null),new He(function(e){var r=!1;return n.subscribe(function(t){r=!0,e.onNext(t)},e.onError.bind(e),function(){r||e.onNext(t),e.onCompleted()})})},Ae.distinct=function(t,n){var i=this;return t||(t=r),n||(n=u),new He(function(r){var o={};return i.subscribe(function(i){var s,u,c,a=!1;try{s=t(i),u=n(s)}catch(h){return r.onError(h),e}for(c in o)if(u===c){a=!0;break}a||(o[u]=null,r.onNext(i))},r.onError.bind(r),r.onCompleted.bind(r))})},Ae.groupBy=function(t,e,n){return this.groupByUntil(t,e,function(){return Ie()},n)},Ae.groupByUntil=function(t,i,o,s){var c=this;return i||(i=r),s||(s=u),new He(function(r){var u={},a=new X,h=new ie(a);return a.add(c.subscribe(function(c){var l,f,p,d,b,v,m,y,w,g;try{v=t(c),m=s(v)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}d=!1;try{w=u[m],w||(w=new Ke,u[m]=w,d=!0)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}if(d){b=new Ge(v,w,h),f=new Ge(v,w);try{l=o(f)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}r.onNext(b),y=new ee,a.add(y);var x=function(){m in u&&(delete u[m],w.onCompleted()),a.remove(y)};y.setDisposable(l.take(1).subscribe(n,function(t){for(g in u)u[g].onError(t);r.onError(t)},function(){x()}))}try{p=i(c)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}w.onNext(p)},function(t){for(var e in u)u[e].onError(t);r.onError(t)},function(){for(var t in u)u[t].onCompleted();r.onCompleted()})),h})},Ae.select=function(t,n){var r=this;return new He(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))})},Ae.map=Ae.select,Ae.pluck=function(t){return this.select(function(e){return e[t]})},Ae.selectMany=Ae.flatMap=function(t,e){return e?this.selectMany(function(n){return t(n).select(function(t){return e(n,t)})}):"function"==typeof t?g.call(this,t):g.call(this,function(){return t})},Ae.skip=function(t){if(0>t)throw Error(S);var e=this;return new He(function(n){var r=t;return e.subscribe(function(t){0>=r?n.onNext(t):r--},n.onError.bind(n),n.onCompleted.bind(n))})},Ae.skipWhile=function(t){var n=this;return new He(function(r){var i=0,o=!1;return n.subscribe(function(n){if(!o)try{o=!t(n,i++)}catch(s){return r.onError(s),e}o&&r.onNext(n)},r.onError.bind(r),r.onCompleted.bind(r))})},Ae.take=function(t,e){if(0>t)throw Error(S);if(0===t)return qe(e);var n=this;return new He(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))})},Ae.takeWhile=function(t){var n=this;return new He(function(r){var i=0,o=!0;return n.subscribe(function(n){if(o){try{o=t(n,i++)}catch(s){return r.onError(s),e}o?r.onNext(n):r.onCompleted()}},r.onError.bind(r),r.onCompleted.bind(r))})},Ae.where=function(t,n){var r=this;return new He(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))})},Ae.filter=Ae.where;var He=D.Internals.AnonymousObservable=function(t){function n(r){function i(t){var e=new Ue(t);if(ce.scheduleRequired())ce.schedule(function(){try{e.disposable(r(e))}catch(t){if(!e.fail(t))throw t}});else try{e.disposable(r(e))}catch(n){if(!e.fail(n))throw n}return e}return this instanceof n?(t.call(this,i),e):new n(r)}return H(n,t),n}(We),Ue=function(t){function e(e){t.call(this),this.observer=e,this.m=new ee}H(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.disposable=function(t){return this.m.disposable(t)},n.dispose=function(){t.prototype.dispose.call(this),this.m.dispose()},e}(Se),Ge=function(t){function e(t){return this.underlyingObservable.subscribe(t)}function n(n,r,i){t.call(this,e),this.key=n,this.underlyingObservable=i?new He(function(t){return new X(i.getDisposable(),r.subscribe(t))}):r}return H(n,t),n}(We),Je=function(t,e){this.subject=t,this.observer=e};Je.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 Ke=D.Subject=function(t){function e(t){return a.call(this),this.isStopped?this.exception?(t.onError(this.exception),te):(t.onCompleted(),te):(this.observers.push(t),new Je(this,t))}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return H(n,t),U(n.prototype,Ce,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(a.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(a.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(a.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 Xe(t,e)},n}(We),Qe=D.AsyncSubject=function(t){function e(t){if(a.call(this),!this.isStopped)return this.observers.push(t),new Je(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(),te}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return H(n,t),U(n.prototype,Ce,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){var t,e,n;if(a.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(a.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){a.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}(We),Xe=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 H(n,t),U(n.prototype,Ce,{onCompleted:function(){this.observer.onCompleted()},onError:function(t){this.observer.onError(t)},onNext:function(t){this.observer.onNext(t)}}),n}(We);return"function"==typeof define&&"object"==typeof define.amd&&define.amd?(t.Rx=D,define(function(){return D})):(E?"object"==typeof module&&module&&module.exports==E?module.exports=D:E=D:t.Rx=D,e)})(this);
(function(t,e){function n(){}function r(t){return t}function i(){return(new Date).getTime()}function o(t,e){return B(t,e)}function s(t,e){return t-e}function u(t){return""+t}function c(t){throw t}function a(){if(this.isDisposed)throw Error(_)}function h(t){return"function"!=typeof t.toString&&"string"==typeof(t+"")}function l(t){return t&&"object"==typeof t?M.call(t)==O:!1}function f(t){return"function"==typeof t}function p(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&&N[o]||e&&N[s]))return!1;if(null==t||null==e)return t===e;var u=M.call(t),c=M.call(e);if(u==O&&(u=T),c==O&&(c=T),u!=c)return!1;switch(u){case W:case k:return+t==+e;case q:return t!=+t?e!=+e:0==t?1/t==1/e:t==+e;case I:case P:return t==e+""}var a=u==R;if(!a){if(u!=T||!C&&(h(t)||h(e)))return!1;var d=!V&&l(t)?Object:t.constructor,b=!V&&l(e)?Object:e.constructor;if(d!=b&&!(f(d)&&d instanceof d&&f(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),a){for(v=t.length,m=e.length,i=m==t.length;m--;){var y=e[m];if(!(i=p(t[m],y,n,r)))break}return i}for(var w in e)if(L.call(e,w))return m++,i=L.call(t,w)&&p(t[w],e[w],n,r);if(i)for(var w in t)if(L.call(t,w))return i=--m>-1;return n.pop(),r.pop(),i}function d(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:F.call(t)}function b(t,e){for(var n=Array(t),r=0;t>r;r++)n[r]=e();return n}function v(t,e){this.scheduler=t,this.disposable=e,this.isDisposed=!1}function m(t,e,n,r,i){this.scheduler=t,this.state=e,this.action=n,this.dueTime=r,this.comparer=i||s,this.disposable=new ee}function y(t,n){return new He(function(r){var i=new ee,o=new re;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 ee,o.setDisposable(i),i.setDisposable(s.subscribe(r))},r.onCompleted.bind(r))),o})}function w(t,n){var r=this;return new He(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 g(t){return this.select(t).mergeObservable()}var E="object"==typeof exports&&exports,x=("object"==typeof module&&module&&module.exports==E&&module,"object"==typeof global&&global);x.global===x&&(t=x);var C,D={Internals:{}},A="Sequence contains no elements.",S="Argument out of range",_="Object has been disposed",N={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},O="[object Arguments]",R="[object Array]",W="[object Boolean]",k="[object Date]",j="[object Function]",q="[object Number]",T="[object Object]",I="[object RegExp]",P="[object String]",M=Object.prototype.toString,L=Object.prototype.hasOwnProperty,V=M.call(arguments)==O;try{C=!(M.call(document)==T&&!({toString:0}+""))}catch(z){C=!0}V||(l=function(t){return t&&"object"==typeof t?L.call(t,"callee"):!1}),f(/x/)&&(f=function(t){return"function"==typeof t&&M.call(t)==j});var B=D.Internals.isEqual=function(t,e){return p(t,e,[],[])},F=Array.prototype.slice;({}).hasOwnProperty;var H=this.inherits=D.Internals.inherits=function(t,e){function n(){this.constructor=t}n.prototype=e.prototype,t.prototype=new n},U=D.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]}},G=D.Internals.addRef=function(t,e){return new He(function(n){return new X(e.getDisposable(),t.subscribe(n))})},J=function(t,e){this.id=t,this.value=e};J.prototype.compareTo=function(t){var e=this.value.compareTo(t.value);return 0===e&&(e=this.id-t.id),e};var K=function(t){this.items=Array(t),this.length=0},Q=K.prototype;Q.isHigherPriority=function(t,e){return 0>this.items[t].compareTo(this.items[e])},Q.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)}}},Q.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)}}},Q.peek=function(){return this.items[0].value},Q.removeAt=function(t){this.items[t]=this.items[--this.length],delete this.items[this.length],this.heapify()},Q.dequeue=function(){var t=this.peek();return this.removeAt(0),t},Q.enqueue=function(t){var e=this.length++;this.items[e]=new J(K.count++,t),this.percolate(e)},Q.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 X=D.CompositeDisposable=function(){this.disposables=d(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},Y=X.prototype;Y.add=function(t){this.isDisposed?t.dispose():(this.disposables.push(t),this.length++)},Y.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},Y.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()}},Y.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()},Y.contains=function(t){return-1!==this.disposables.indexOf(t)},Y.toArray=function(){return this.disposables.slice(0)};var Z=D.Disposable=function(t){this.isDisposed=!1,this.action=t||n};Z.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var $=Z.create=function(t){return new Z(t)},te=Z.empty={dispose:n},ee=D.SingleAssignmentDisposable=function(){this.isDisposed=!1,this.current=null},ne=ee.prototype;ne.disposable=function(t){return t?this.setDisposable(t):this.getDisposable()},ne.getDisposable=function(){return this.current},ne.setDisposable=function(t){if(this.current)throw Error("Disposable has already been assigned");var e=this.isDisposed;e||(this.current=t),e&&t&&t.dispose()},ne.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()};var re=D.SerialDisposable=function(){this.isDisposed=!1,this.current=null};re.prototype.getDisposable=function(){return this.current},re.prototype.setDisposable=function(t){var e,n=this.isDisposed;n||(e=this.current,this.current=t),e&&e.dispose(),n&&t&&t.dispose()},re.prototype.disposable=function(t){return t?(this.setDisposable(t),e):this.getDisposable()},re.prototype.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()};var ie=D.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?te:new t(this)},e}();v.prototype.dispose=function(){var t=this;this.scheduler.schedule(function(){t.isDisposed||(t.isDisposed=!0,t.disposable.dispose())})},m.prototype.invoke=function(){this.disposable.disposable(this.invokeCore())},m.prototype.compareTo=function(t){return this.comparer(this.dueTime,t.dueTime)},m.prototype.isCancelled=function(){return this.disposable.isDisposed},m.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var oe=D.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 X,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),te});r||(i.add(s),n=!0)})};return o(n),i}function r(t,e,n){var r=e.first,i=e.second,o=new X,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),te});u||(o.add(c),i=!0)})};return s(r),o}function o(t,e){return e(),te}var s=e.prototype;return s.catchException=function(t){return new pe(this,t)},s.schedulePeriodic=function(t,e){return this.schedulePeriodicWithState(null,t,function(){e()})},s.schedulePeriodicWithState=function(e,n,r){var i=e,o=t.setInterval(function(){i=r(i)},n);return $(function(){t.clearInterval(o)})},s.schedule=function(t){return this._schedule(t,o)},s.scheduleWithState=function(t,e){return this._schedule(t,e)},s.scheduleWithRelative=function(t,e){return this._scheduleRelative(e,t,o)},s.scheduleWithRelativeAndState=function(t,e,n){return this._scheduleRelative(t,e,n)},s.scheduleWithAbsolute=function(t,e){return this._scheduleAbsolute(e,t,o)},s.scheduleWithAbsoluteAndState=function(t,e,n){return this._scheduleAbsolute(t,e,n)},s.scheduleRecursive=function(t){return this.scheduleRecursiveWithState(t,function(t,e){t(function(){e(t)})})},s.scheduleRecursiveWithState=function(t,e){return this.scheduleWithState({first:t,second:e},function(t,e){return n(t,e)})},s.scheduleRecursiveWithRelative=function(t,e){return this.scheduleRecursiveWithRelativeAndState(e,t,function(t,e){t(function(n){e(t,n)})})},s.scheduleRecursiveWithRelativeAndState=function(t,e,n){return this._scheduleRelative({first:t,second:n},e,function(t,e){return r(t,e,"scheduleWithRelativeAndState")})},s.scheduleRecursiveWithAbsolute=function(t,e){return this.scheduleRecursiveWithAbsoluteAndState(e,t,function(t,e){t(function(n){e(t,n)})})},s.scheduleRecursiveWithAbsoluteAndState=function(t,e,n){return this._scheduleAbsolute({first:t,second:n},e,function(t,e){return r(t,e,"scheduleWithAbsoluteAndState")})},e.now=i,e.normalize=function(t){return 0>t&&(t=0),t},e}(),se="Scheduler is not allowed to block the thread",ue=oe.immediate=function(){function t(t,e){return e(this,t)}function e(t,e,n){if(e>0)throw Error(se);return n(this,t)}function n(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new oe(i,t,e,n)}(),ce=oe.currentThread=function(){function t(){o=new K(4)}function e(t,e){return this.scheduleWithRelativeAndState(t,0,e)}function n(e,n,r){var i,s=this.now()+oe.normalize(n),u=new m(this,e,r,s);if(o)o.enqueue(u);else{i=new t;try{o.enqueue(u),i.run()}catch(c){throw c}finally{i.dispose()}}return u.disposable}function r(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}var o;t.prototype.dispose=function(){o=null},t.prototype.run=function(){for(var t;o.length>0;)if(t=o.dequeue(),!t.isCancelled()){for(;t.dueTime-oe.now()>0;);t.isCancelled()||t.invoke()}};var s=new oe(i,e,n,r);return s.scheduleRequired=function(){return null===o},s.ensureTrampoline=function(t){return null===o?this.schedule(t):t()},s}(),ae=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 ee;return this._cancel=e,e.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,t.bind(this))),e},e}();D.VirtualTimeScheduler=function(t){function n(){return this.toDateTimeOffset(this.clock)}function r(t,e){return this.scheduleAbsoluteWithState(t,this.clock,e)}function i(t,e,n){return this.scheduleRelativeWithState(t,this.toRelative(e),n)}function o(t,e,n){return this.scheduleRelativeWithState(t,this.toRelative(e-this.now()),n)}function s(t,e){return e(),te}function u(e,s){this.clock=e,this.comparer=s,this.isEnabled=!1,this.queue=new K(1024),t.call(this,n,r,i,o)}H(u,t);var c=u.prototype;return c.schedulePeriodicWithState=function(t,e,n){var r=new ae(this,t,e,n);return r.start()},c.scheduleRelativeWithState=function(t,e,n){var r=this.add(this.clock,e);return this.scheduleAbsoluteWithState(t,r,n)},c.scheduleRelative=function(t,e){return this.scheduleRelativeWithState(e,t,s)},c.start=function(){var t;if(!this.isEnabled){this.isEnabled=!0;do t=this.getNext(),null!==t?(this.comparer(t.dueTime,this.clock)>0&&(this.clock=t.dueTime),t.invoke()):this.isEnabled=!1;while(this.isEnabled)}},c.stop=function(){this.isEnabled=!1},c.advanceTo=function(t){var e,n=this.comparer(this.clock,t);if(this.comparer(this.clock,t)>0)throw Error(S);if(0!==n&&!this.isEnabled){this.isEnabled=!0;do e=this.getNext(),null!==e&&0>=this.comparer(e.dueTime,t)?(this.comparer(e.dueTime,this.clock)>0&&(this.clock=e.dueTime),e.invoke()):this.isEnabled=!1;while(this.isEnabled);this.clock=t}},c.advanceBy=function(t){var n=this.add(this.clock,t),r=this.comparer(this.clock,n);if(r>0)throw Error(S);return 0!==r?this.advanceTo(n):e},c.sleep=function(t){var e=this.add(this.clock,t);if(this.comparer(this.clock,e)>=0)throw Error(S);this.clock=e},c.getNext=function(){for(var t;this.queue.length>0;){if(t=this.queue.peek(),!t.isCancelled())return t;this.queue.dequeue()}return null},c.scheduleAbsolute=function(t,e){return this.scheduleAbsoluteWithState(e,t,s)},c.scheduleAbsoluteWithState=function(t,e,n){var r=this,i=function(t,e){return r.queue.remove(o),n(t,e)},o=new m(r,t,i,e,r.comparer);return r.queue.enqueue(o),o.disposable},u}(oe),D.HistoricalScheduler=function(t){function e(e,n){var r=null==e?0:e,i=n||s;t.call(this,r,i)}H(e,t);var n=e.prototype;return n.add=function(t,e){return t+e},n.toDateTimeOffset=function(t){return new Date(t).getTime()},n.toRelative=function(t){return t},e}(D.VirtualTimeScheduler);var he,le=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,le=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)},le=t.clearTimeout)})();var fe=oe.timeout=function(){function e(t,e){var n=this,r=new ee,i=he(function(){r.isDisposed||r.setDisposable(e(n,t))});return new X(r,$(function(){le(i)}))}function n(e,n,r){var i=this,o=oe.normalize(n);if(0===o)return i.scheduleWithState(e,r);var s=new ee,u=t.setTimeout(function(){s.isDisposed||s.setDisposable(r(i,e))},o);return new X(s,$(function(){t.clearTimeout(u)}))}function r(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new oe(i,e,n,r)}(),pe=function(t){function e(){return this._scheduler.now()}function n(t,e){return this._scheduler.scheduleWithState(t,this._wrap(e))}function r(t,e,n){return this._scheduler.scheduleWithRelativeAndState(t,e,this._wrap(n))}function i(t,e,n){return this._scheduler.scheduleWithAbsoluteAndState(t,e,this._wrap(n))}function o(o,s){this._scheduler=o,this._handler=s,this._recursiveOriginal=null,this._recursiveWrapper=null,t.call(this,e,n,r,i)}return H(o,t),o.prototype._clone=function(t){return new o(t,this._handler)},o.prototype._wrap=function(t){var e=this;return function(n,r){try{return t(e._getRecursiveWrapper(n),r)}catch(i){if(!e._handler(i))throw i;return te}}},o.prototype._getRecursiveWrapper=function(t){if(this._recursiveOriginal!==t){this._recursiveOriginal=t;var e=this._clone(t);e._recursiveOriginal=t,e._recursiveWrapper=e,this._recursiveWrapper=e}return this._recursiveWrapper},o.prototype.schedulePeriodicWithState=function(t,e,n){var r=this,i=!1,o=new ee;return o.setDisposable(this._scheduler.schedulePeriodicWithState(t,e,function(t){if(i)return null;try{return n(t)}catch(e){if(i=!0,!r._handler(e))throw e;return o.dispose(),null}})),o},o}(oe),de=D.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||ue,new He(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.bind(i),i._acceptObservable=e.bind(i),i.toString=n.bind(i),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.bind(i),i._acceptObservable=e.bind(i),i.toString=n.bind(i),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.bind(r),r._acceptObservable=e.bind(r),r.toString=n.bind(r),r}}(),ye=D.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=D.Internals.Enumerable=function(){function t(t){this.getEnumerator=t}return t.prototype.concat=function(){var t=this;return new He(function(n){var r=t.getEnumerator(),i=!1,o=new re,s=ue.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 h=new ee;o.setDisposable(h),h.setDisposable(s.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){t()}))}});return new X(o,s,$(function(){i=!0,r.dispose()}))})},t.prototype.catchException=function(){var t=this;return new He(function(n){var r,i=t.getEnumerator(),o=!1,s=new re,u=ue.scheduleRecursive(function(t){var u,c,a;if(a=!1,!o){try{a=i.moveNext(),a&&(u=i.getCurrent())}catch(h){c=h}if(c)return n.onError(c),e;if(!a)return r?n.onError(r):n.onCompleted(),e;var l=new ee;s.setDisposable(l),l.setDisposable(u.subscribe(n.onNext.bind(n),function(e){r=e,t()},n.onCompleted.bind(n)))}});return new X(s,u,$(function(){o=!0}))})},t}(),Ee=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})})},xe=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=D.Observer=function(){};Ce.prototype.toNotifier=function(){var t=this;return function(e){return e.accept(t)}},Ce.prototype.asObserver=function(){return new _e(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},Ce.prototype.checked=function(){return new Ne(this)};var De=Ce.create=function(t,e,r){return t||(t=n),e||(e=c),r||(r=n),new _e(t,e,r)};Ce.fromNotifier=function(t){return new _e(function(e){return t(be(e))},function(e){return t(ve(e))},function(){return t(me())})};var Ae,Se=D.Internals.AbstractObserver=function(t){function e(){this.isStopped=!1,t.call(this)}return H(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(){return this.isStopped?!1:(this.isStopped=!0,this.error(!0),!0)},e}(Ce),_e=D.AnonymousObserver=function(t){function e(e,n,r){t.call(this),this._onNext=e,this._onError=n,this._onCompleted=r}return H(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),Ne=function(t){function e(e){t.call(this),this._observer=e,this._state=0}H(e,t);var n=e.prototype;return n.onNext=function(t){this.checkAccess();try{this._observer.onNext(t)}catch(e){throw e}finally{this._state=0}},n.onError=function(t){this.checkAccess();try{this._observer.onError(t)}catch(e){throw e}finally{this._state=2}},n.onCompleted=function(){this.checkAccess();try{this._observer.onCompleted()}catch(t){throw t}finally{this._state=2}},n.checkAccess=function(){if(1===this._state)throw Error("Re-entrancy detected");if(2===this._state)throw Error("Observer completed");0===this._state&&(this._state=1)},e}(Ce),Oe=D.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 re}return H(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),Re=function(t){function e(){t.apply(this,arguments)}return H(e,t),e.prototype.next=function(e){t.prototype.next.call(this,e),this.ensureActive()},e.prototype.error=function(e){t.prototype.error.call(this,e),this.ensureActive()},e.prototype.completed=function(){t.prototype.completed.call(this),this.ensureActive()},e}(Oe),We=D.Observable=function(){function t(t){this._subscribe=t}return Ae=t.prototype,Ae.finalValue=function(){var t=this;return new He(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))})})},Ae.subscribe=Ae.forEach=function(t,e,n){var r;return r="object"==typeof t?t:De(t,e,n),this._subscribe(r)},Ae.toArray=function(){function t(t,e){var n=t.slice(0);return n.push(e),n}return this.scan([],t).startWith([]).finalValue()},t}();We.start=function(t,e,n){return ke(t,e,n)()};var ke=We.toAsync=function(t,n,r){return n||(n=fe),function(){var i=F.call(arguments,0),o=new Qe;return n.schedule(function(){var n;try{n=t.apply(r,i)}catch(s){return o.onError(s),e}o.onNext(n),o.onCompleted()}),o.asObservable()}};Ae.observeOn=function(t){var e=this;return new He(function(n){return e.subscribe(new Re(t,n))})},Ae.subscribeOn=function(t){var e=this;return new He(function(n){var r=new ee,i=new re;return i.setDisposable(r),r.setDisposable(t.schedule(function(){i.setDisposable(new v(t,e.subscribe(n)))})),i})},We.create=function(t){return new He(function(e){return $(t(e))})},We.createWithDisposable=function(t){return new He(t)};var je=We.defer=function(t){return new He(function(e){var n;try{n=t()}catch(r){return Me(r).subscribe(e)}return n.subscribe(e)})},qe=We.empty=function(t){return t||(t=ue),new He(function(e){return t.schedule(function(){e.onCompleted()})})},Te=We.fromArray=function(t,e){return e||(e=ce),new He(function(n){var r=0;return e.scheduleRecursive(function(e){t.length>r?(n.onNext(t[r++]),e()):n.onCompleted()})})};We.generate=function(t,n,r,i,o){return o||(o=ce),new He(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(h){return s.onError(h),e}o?(s.onNext(a),t()):s.onCompleted()})})};var Ie=We.never=function(){return new He(function(){return te})};We.range=function(t,e,n){return n||(n=ce),new He(function(r){return n.scheduleRecursiveWithState(0,function(n,i){e>n?(r.onNext(t+n),i(n+1)):r.onCompleted()})})},We.repeat=function(t,e,n){return n||(n=ce),null==e&&(e=-1),Pe(t,n).repeat(e)};var Pe=We["return"]=We.returnValue=function(t,e){return e||(e=ue),new He(function(n){return e.schedule(function(){n.onNext(t),n.onCompleted()})})},Me=We["throw"]=We.throwException=function(t,e){return e||(e=ue),new He(function(n){return e.schedule(function(){n.onError(t)})})};We.using=function(t,e){return new He(function(n){var r,i,o=te;try{r=t(),r&&(o=r),i=e(r)}catch(s){return new X(Me(s).subscribe(n),o)}return new X(i.subscribe(n),o)})},Ae.amb=function(t){var e=this;return new He(function(n){function r(){o||(o=s,a.dispose())}function i(){o||(o=u,c.dispose())}var o,s="L",u="R",c=new ee,a=new ee;return c.setDisposable(e.subscribe(function(t){r(),o===s&&n.onNext(t)},function(t){r(),o===s&&n.onError(t)},function(){r(),o===s&&n.onCompleted()})),a.setDisposable(t.subscribe(function(t){i(),o===u&&n.onNext(t)},function(t){i(),o===u&&n.onError(t)},function(){i(),o===u&&n.onCompleted()})),new X(c,a)})},We.amb=function(){function t(t,e){return t.amb(e)}for(var e=Ie(),n=d(arguments,0),r=0,i=n.length;i>r;r++)e=t(e,n[r]);return e},Ae["catch"]=Ae.catchException=function(t){return"function"==typeof t?y(this,t):Le([this,t])};var Le=We.catchException=We["catch"]=function(){var t=d(arguments,0);return xe(t).catchException()};Ae.combineLatest=function(){var t=F.call(arguments);return Array.isArray(t[0])?t[0].unshift(this):t.unshift(this),Ve.apply(this,t)};var Ve=We.combineLatest=function(){var t=F.call(arguments),n=t.pop();return Array.isArray(t[0])&&(t=t[0]),new He(function(r){function i(t){var i;if(c[t]=!0,a||(a=c.every(function(t){return t}))){try{i=n.apply(null,l)}catch(o){return r.onError(o),e}r.onNext(i)}else h.filter(function(e,n){return n!==t}).every(function(t){return t})&&r.onCompleted()}function o(t){h[t]=!0,h.every(function(t){return t})&&r.onCompleted()}for(var s=function(){return!1},u=t.length,c=b(u,s),a=!1,h=b(u,s),l=Array(u),f=Array(u),p=0;u>p;p++)(function(e){f[e]=new ee,f[e].setDisposable(t[e].subscribe(function(t){l[e]=t,i(e)},r.onError.bind(r),function(){o(e)}))})(p);return new X(f)})};Ae.concat=function(){var t=F.call(arguments,0);return t.unshift(this),ze.apply(this,t)};var ze=We.concat=function(){var t=d(arguments,0);return xe(t).concat()};Ae.concatObservable=Ae.concatAll=function(){return this.merge(1)},Ae.merge=function(t){if("number"!=typeof t)return Be(this,t);var e=this;return new He(function(n){var r=0,i=new X,o=!1,s=[],u=function(t){var e=new ee;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 Be=We.merge=function(){var t,e;return arguments[0]?arguments[0].now?(t=arguments[0],e=F.call(arguments,1)):(t=ue,e=F.call(arguments,0)):(t=ue,e=F.call(arguments,1)),Array.isArray(e[0])&&(e=e[0]),Te(e,t).mergeObservable()};Ae.mergeObservable=Ae.mergeAll=function(){var t=this;return new He(function(e){var n=new X,r=!1,i=new ee;return n.add(i),i.setDisposable(t.subscribe(function(t){var i=new ee;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})},Ae.onErrorResumeNext=function(t){if(!t)throw Error("Second observable is required");return Fe([this,t])};var Fe=We.onErrorResumeNext=function(){var t=d(arguments,0);return new He(function(e){var n=0,r=new re,i=ue.scheduleRecursive(function(i){var o,s;t.length>n?(o=t[n++],s=new ee,r.setDisposable(s),s.setDisposable(o.subscribe(e.onNext.bind(e),function(){i()},function(){i()}))):e.onCompleted()});return new X(r,i)})};Ae.skipUntil=function(t){var e=this;return new He(function(n){var r=!1,i=new X(e.subscribe(function(t){r&&n.onNext(t)},n.onError.bind(n),function(){r&&n.onCompleted()})),o=new ee;return i.add(o),o.setDisposable(t.subscribe(function(){r=!0,o.dispose()},n.onError.bind(n),function(){o.dispose()})),i})},Ae.switchLatest=function(){var t=this;return new He(function(e){var n=!1,r=new re,i=!1,o=0,s=t.subscribe(function(t){var s=new ee,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 X(s,r)})},Ae.takeUntil=function(t){var e=this;return new He(function(r){return new X(e.subscribe(r),t.subscribe(r.onCompleted.bind(r),r.onError.bind(r),n))})},Ae.zip=function(){if(Array.isArray(arguments[0]))return w.apply(this,arguments);var t=this,n=F.call(arguments),i=n.pop();return n.unshift(t),new He(function(o){function s(t){a[t]=!0,a.every(function(t){return t})&&o.onCompleted()}for(var u=n.length,c=b(u,function(){return[]}),a=b(u,function(){return!1}),h=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(h){return o.onError(h),e}o.onNext(s)}else a.filter(function(t,e){return e!==n}).every(r)&&o.onCompleted()},l=Array(u),f=0;u>f;f++)(function(t){l[t]=new ee,l[t].setDisposable(n[t].subscribe(function(e){c[t].push(e),h(t)},o.onError.bind(o),function(){s(t)}))})(f);return new X(l)})},We.zip=function(){var t=F.call(arguments,0),e=t.shift();return e.zip.apply(e,t)},We.zipArray=function(){var t=F.call(arguments);return new He(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=b(s,function(){return[]}),c=b(s,function(){return!1}),a=Array(s),h=0;s>h;h++)(function(e){a[e]=new ee,a[e].setDisposable(t[e].subscribe(function(t){u[e].push(t),i(e)},n.onError.bind(n),function(){o(e)}))})(h);var l=new X(a);return l.add($(function(){for(var t=0,e=u.length;e>t;t++)u[t]=[]})),l})},Ae.asObservable=function(){var t=this;return new He(function(e){return t.subscribe(e)})},Ae.bufferWithCount=function(t,n){return n===e&&(n=t),this.windowWithCount(t,n).selectMany(function(t){return t.toArray()}).where(function(t){return t.length>0})},Ae.dematerialize=function(){var t=this;return new He(function(e){return t.subscribe(function(t){return t.accept(e)},e.onError.bind(e),e.onCompleted.bind(e))})},Ae.distinctUntilChanged=function(t,n){var i=this;return t||(t=r),n||(n=o),new He(function(r){var o,s=!1;return i.subscribe(function(i){var u,c=!1;try{u=t(i)}catch(a){return r.onError(a),e}if(s)try{c=n(o,u)}catch(a){return r.onError(a),e}s&&c||(s=!0,o=u,r.onNext(i))},r.onError.bind(r),r.onCompleted.bind(r))})},Ae["do"]=Ae.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 He(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()})})},Ae["finally"]=Ae.finallyAction=function(t){var e=this;return new He(function(n){var r=e.subscribe(n);return $(function(){try{r.dispose()
}catch(e){throw e}finally{t()}})})},Ae.ignoreElements=function(){var t=this;return new He(function(e){return t.subscribe(n,e.onError.bind(e),e.onCompleted.bind(e))})},Ae.materialize=function(){var t=this;return new He(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()})})},Ae.repeat=function(t){return Ee(this,t).concat()},Ae.retry=function(t){return Ee(this,t).catchException()},Ae.scan=function(){var t,e,n=!1;2===arguments.length?(t=arguments[0],e=arguments[1],n=!0):e=arguments[0];var r=this;return je(function(){var i,o=!1;return r.select(function(r){return o?i=e(i,r):(i=n?e(t,r):r,o=!0),i})})},Ae.skipLast=function(t){var e=this;return new He(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))})},Ae.startWith=function(){var t,e,n=0;return arguments.length&&"now"in Object(arguments[0])?(e=arguments[0],n=1):e=ue,t=F.call(arguments,n),xe([Te(t,e),this]).concat()},Ae.takeLast=function(t,e){return this.takeLastBuffer(t).selectMany(function(t){return Te(t,e)})},Ae.takeLastBuffer=function(t){var e=this;return new He(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()})})},Ae.windowWithCount=function(t,e){var n=this;if(0>=t)throw Error(S);if(null==e&&(e=t),0>=e)throw Error(S);return new He(function(r){var i=new ee,o=new ie(i),s=0,u=[],c=function(){var t=new Ke;u.push(t),r.onNext(G(t,o))};return c(),i.setDisposable(n.subscribe(function(n){for(var r,i=0,o=u.length;o>i;i++)u[i].onNext(n);var a=s-t+1;a>=0&&0===a%e&&(r=u.shift(),r.onCompleted()),s++,0===s%e&&c()},function(t){for(;u.length>0;)u.shift().onError(t);r.onError(t)},function(){for(;u.length>0;)u.shift().onCompleted();r.onCompleted()})),o})},Ae.defaultIfEmpty=function(t){var n=this;return t===e&&(t=null),new He(function(e){var r=!1;return n.subscribe(function(t){r=!0,e.onNext(t)},e.onError.bind(e),function(){r||e.onNext(t),e.onCompleted()})})},Ae.distinct=function(t,n){var i=this;return t||(t=r),n||(n=u),new He(function(r){var o={};return i.subscribe(function(i){var s,u,c,a=!1;try{s=t(i),u=n(s)}catch(h){return r.onError(h),e}for(c in o)if(u===c){a=!0;break}a||(o[u]=null,r.onNext(i))},r.onError.bind(r),r.onCompleted.bind(r))})},Ae.groupBy=function(t,e,n){return this.groupByUntil(t,e,function(){return Ie()},n)},Ae.groupByUntil=function(t,i,o,s){var c=this;return i||(i=r),s||(s=u),new He(function(r){var u={},a=new X,h=new ie(a);return a.add(c.subscribe(function(c){var l,f,p,d,b,v,m,y,w,g;try{v=t(c),m=s(v)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}d=!1;try{w=u[m],w||(w=new Ke,u[m]=w,d=!0)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}if(d){b=new Ge(v,w,h),f=new Ge(v,w);try{l=o(f)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}r.onNext(b),y=new ee,a.add(y);var x=function(){m in u&&(delete u[m],w.onCompleted()),a.remove(y)};y.setDisposable(l.take(1).subscribe(n,function(t){for(g in u)u[g].onError(t);r.onError(t)},function(){x()}))}try{p=i(c)}catch(E){for(g in u)u[g].onError(E);return r.onError(E),e}w.onNext(p)},function(t){for(var e in u)u[e].onError(t);r.onError(t)},function(){for(var t in u)u[t].onCompleted();r.onCompleted()})),h})},Ae.select=Ae.map=function(t,n){var r=this;return new He(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))})},Ae.pluck=function(t){return this.select(function(e){return e[t]})},Ae.selectMany=Ae.flatMap=function(t,e){return e?this.selectMany(function(n){return t(n).select(function(t){return e(n,t)})}):"function"==typeof t?g.call(this,t):g.call(this,function(){return t})},Ae.skip=function(t){if(0>t)throw Error(S);var e=this;return new He(function(n){var r=t;return e.subscribe(function(t){0>=r?n.onNext(t):r--},n.onError.bind(n),n.onCompleted.bind(n))})},Ae.skipWhile=function(t){var n=this;return new He(function(r){var i=0,o=!1;return n.subscribe(function(n){if(!o)try{o=!t(n,i++)}catch(s){return r.onError(s),e}o&&r.onNext(n)},r.onError.bind(r),r.onCompleted.bind(r))})},Ae.take=function(t,e){if(0>t)throw Error(S);if(0===t)return qe(e);var n=this;return new He(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))})},Ae.takeWhile=function(t){var n=this;return new He(function(r){var i=0,o=!0;return n.subscribe(function(n){if(o){try{o=t(n,i++)}catch(s){return r.onError(s),e}o?r.onNext(n):r.onCompleted()}},r.onError.bind(r),r.onCompleted.bind(r))})},Ae.where=Ae.filter=function(t,n){var r=this;return new He(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))})};var He=D.Internals.AnonymousObservable=function(t){function n(r){function i(t){var e=new Ue(t);if(ce.scheduleRequired())ce.schedule(function(){try{e.disposable(r(e))}catch(t){if(!e.fail(t))throw t}});else try{e.disposable(r(e))}catch(n){if(!e.fail(n))throw n}return e}return this instanceof n?(t.call(this,i),e):new n(r)}return H(n,t),n}(We),Ue=function(t){function e(e){t.call(this),this.observer=e,this.m=new ee}H(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.disposable=function(t){return this.m.disposable(t)},n.dispose=function(){t.prototype.dispose.call(this),this.m.dispose()},e}(Se),Ge=function(t){function e(t){return this.underlyingObservable.subscribe(t)}function n(n,r,i){t.call(this,e),this.key=n,this.underlyingObservable=i?new He(function(t){return new X(i.getDisposable(),r.subscribe(t))}):r}return H(n,t),n}(We),Je=function(t,e){this.subject=t,this.observer=e};Je.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 Ke=D.Subject=function(t){function e(t){return a.call(this),this.isStopped?this.exception?(t.onError(this.exception),te):(t.onCompleted(),te):(this.observers.push(t),new Je(this,t))}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return H(n,t),U(n.prototype,Ce,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(a.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(a.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(a.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 Xe(t,e)},n}(We),Qe=D.AsyncSubject=function(t){function e(t){if(a.call(this),!this.isStopped)return this.observers.push(t),new Je(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(),te}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return H(n,t),U(n.prototype,Ce,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){var t,e,n;if(a.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(a.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){a.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}(We),Xe=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 H(n,t),U(n.prototype,Ce,{onCompleted:function(){this.observer.onCompleted()},onError:function(t){this.observer.onError(t)},onNext:function(t){this.observer.onNext(t)}}),n}(We);return"function"==typeof define&&"object"==typeof define.amd&&define.amd?(t.Rx=D,define(function(){return D})):(E?"object"==typeof module&&module&&module.exports==E?module.exports=D:E=D:t.Rx=D,e)})(this);

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc