rxjs-rails 2.2.13 → 2.2.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rxjs/rails/version.rb +1 -1
  3. data/vendor/assets/javascripts/rx.aggregates.js +2 -2
  4. data/vendor/assets/javascripts/rx.aggregates.min.js +1 -1
  5. data/vendor/assets/javascripts/rx.async.compat.js +23 -47
  6. data/vendor/assets/javascripts/rx.async.compat.min.js +1 -1
  7. data/vendor/assets/javascripts/rx.async.js +23 -47
  8. data/vendor/assets/javascripts/rx.async.min.js +1 -1
  9. data/vendor/assets/javascripts/rx.backpressure.js +81 -0
  10. data/vendor/assets/javascripts/rx.backpressure.min.js +1 -0
  11. data/vendor/assets/javascripts/rx.binding.js +4 -4
  12. data/vendor/assets/javascripts/rx.binding.min.js +1 -1
  13. data/vendor/assets/javascripts/rx.coincidence.js +3 -3
  14. data/vendor/assets/javascripts/rx.coincidence.min.js +1 -1
  15. data/vendor/assets/javascripts/rx.compat.js +536 -386
  16. data/vendor/assets/javascripts/rx.compat.min.js +2 -2
  17. data/vendor/assets/javascripts/rx.experimental.js +5 -6
  18. data/vendor/assets/javascripts/rx.experimental.min.js +1 -1
  19. data/vendor/assets/javascripts/rx.joinpatterns.js +4 -4
  20. data/vendor/assets/javascripts/rx.joinpatterns.min.js +1 -1
  21. data/vendor/assets/javascripts/rx.lite.compat.js +554 -403
  22. data/vendor/assets/javascripts/rx.lite.compat.min.js +2 -2
  23. data/vendor/assets/javascripts/rx.lite.js +554 -403
  24. data/vendor/assets/javascripts/rx.lite.min.js +2 -2
  25. data/vendor/assets/javascripts/rx.min.js +2 -2
  26. data/vendor/assets/javascripts/rx.node.js +1 -0
  27. data/vendor/assets/javascripts/rx.testing.js +2 -7
  28. data/vendor/assets/javascripts/rx.testing.min.js +1 -1
  29. data/vendor/assets/javascripts/rx.time.js +2 -3
  30. data/vendor/assets/javascripts/rx.time.min.js +1 -1
  31. data/vendor/assets/javascripts/rx.virtualtime.js +5 -5
  32. data/vendor/assets/javascripts/rx.virtualtime.min.js +1 -1
  33. metadata +4 -2
@@ -1,2 +1,2 @@
1
- (function(a){function b(){}function c(a){return a}function d(a,b){return U(a,b)}function e(a,b){return a-b}function f(a){throw a}function g(){if(this.isDisposed)throw new Error(G)}function h(a){return"function"!=typeof a.toString&&"string"==typeof(a+"")}function i(a){return a&&"object"==typeof a?Q.call(a)==H:!1}function j(a){return"function"==typeof a}function k(a,b,c,d){var e;if(a===b)return 0!==a||1/a==1/b;var f=typeof a,g=typeof b;if(!(a!==a||a&&v[f]||b&&v[g]))return!1;if(null==a||null==b)return a===b;var l=Q.call(a),m=Q.call(b);if(l==H&&(l=N),m==H&&(m=N),l!=m)return!1;switch(l){case J:case K:return+a==+b;case M:return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case O:case P:return a==String(b)}var n=l==I;if(!n){if(l!=N||!B&&(h(a)||h(b)))return!1;var o=!S&&i(a)?Object:a.constructor,p=!S&&i(b)?Object:b.constructor;if(o!=p&&!(j(o)&&o instanceof o&&j(p)&&p instanceof p))return!1}for(var q=c.length;q--;)if(c[q]==a)return d[q]==b;var r=0;if(e=!0,c.push(a),d.push(b),n){for(q=a.length,r=b.length,e=r==a.length;r--;){var s=b[r];if(!(e=k(a[r],s,c,d)))break}return e}for(var t in b)if(R.call(b,t))return r++,e=R.call(a,t)&&k(a[t],b[t],c,d);if(e)for(var t in a)if(R.call(a,t))return e=--r>-1;return c.pop(),d.pop(),e}function l(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:V.call(a)}function m(a,b){for(var c=new Array(a),d=0;a>d;d++)c[d]=b();return c}function n(a,b){return new Sb(function(c){var d=new fb,e=new gb;return e.setDisposable(d),d.setDisposable(a.subscribe(c.onNext.bind(c),function(a){var d,f;try{f=b(a)}catch(g){return c.onError(g),void 0}d=new fb,e.setDisposable(d),d.setDisposable(f.subscribe(c))},c.onCompleted.bind(c))),e})}function o(a,b){var c=this;return new Sb(function(d){var e=0,f=a.length;return c.subscribe(function(c){if(f>e){var g,h=a[e++];try{g=b(c,h)}catch(i){return d.onError(i),void 0}d.onNext(g)}else d.onCompleted()},d.onError.bind(d),d.onCompleted.bind(d))})}function p(a){return this.select(a).mergeObservable()}function q(a,b,c){return a.addListener?(a.addListener(b,c),cb(function(){a.removeListener(b,c)})):a.addEventListener?(a.addEventListener(b,c,!1),cb(function(){a.removeEventListener(b,c,!1)})):void 0}function r(a,b,c){var d=new _;if(a&&a.length)for(var e=0,f=a.length;f>e;e++)d.add(r(a[e],b,c));else a&&d.add(q(a,b,c));return d}function s(a,b){var c=kb(a);return new Sb(function(a){return b.scheduleWithRelative(c,function(){a.onNext(0),a.onCompleted()})})}function t(a,b,c){return a===b?new Sb(function(a){return c.schedulePeriodicWithState(0,b,function(b){return a.onNext(b),b+1})}):Fb(function(){return observableTimerDateAndPeriod(c.now()+a,b,c)})}function u(a,b){return new Sb(function(c){function d(){g&&(g=!1,c.onNext(f)),e&&c.onCompleted()}var e,f,g;return new _(a.subscribe(function(a){g=!0,f=a},c.onError.bind(c),function(){e=!0}),b.subscribe(d,c.onError.bind(c),d))})}var v={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},w=v[typeof window]&&window||this,x=v[typeof exports]&&exports&&!exports.nodeType&&exports,y=v[typeof module]&&module&&!module.nodeType&&module,z=y&&y.exports===x&&x,A=v[typeof global]&&global;!A||A.global!==A&&A.window!==A||(w=A);var B,C={Internals:{}},D=Date.now,E="Sequence contains no elements.",F="Argument out of range",G="Object has been disposed",H="[object Arguments]",I="[object Array]",J="[object Boolean]",K="[object Date]",L="[object Function]",M="[object Number]",N="[object Object]",O="[object RegExp]",P="[object String]",Q=Object.prototype.toString,R=Object.prototype.hasOwnProperty,S=Q.call(arguments)==H;try{B=!(Q.call(document)==N&&!({toString:0}+""))}catch(T){B=!0}S||(i=function(a){return a&&"object"==typeof a?R.call(a,"callee"):!1}),j(/x/)&&(j=function(a){return"function"==typeof a&&Q.call(a)==L});var U=C.Internals.isEqual=function(a,b){return k(a,b,[],[])},V=Array.prototype.slice,W=({}.hasOwnProperty,this.inherits=C.Internals.inherits=function(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c}),X=C.Internals.addProperties=function(a){for(var b=V.call(arguments,1),c=0,d=b.length;d>c;c++){var e=b[c];for(var f in e)a[f]=e[f]}},Y=(C.Internals.addRef=function(a,b){return new Sb(function(c){return new _(b.getDisposable(),a.subscribe(c))})},function(a,b){this.id=a,this.value=b});Y.prototype.compareTo=function(a){var b=this.value.compareTo(a.value);return 0===b&&(b=this.id-a.id),b};var Z=C.Internals.PriorityQueue=function(a){this.items=new Array(a),this.length=0},$=Z.prototype;$.isHigherPriority=function(a,b){return this.items[a].compareTo(this.items[b])<0},$.percolate=function(a){if(!(a>=this.length||0>a)){var b=a-1>>1;if(!(0>b||b===a)&&this.isHigherPriority(a,b)){var c=this.items[a];this.items[a]=this.items[b],this.items[b]=c,this.percolate(b)}}},$.heapify=function(b){if(b===a&&(b=0),!(b>=this.length||0>b)){var c=2*b+1,d=2*b+2,e=b;if(c<this.length&&this.isHigherPriority(c,e)&&(e=c),d<this.length&&this.isHigherPriority(d,e)&&(e=d),e!==b){var f=this.items[b];this.items[b]=this.items[e],this.items[e]=f,this.heapify(e)}}},$.peek=function(){return this.items[0].value},$.removeAt=function(a){this.items[a]=this.items[--this.length],delete this.items[this.length],this.heapify()},$.dequeue=function(){var a=this.peek();return this.removeAt(0),a},$.enqueue=function(a){var b=this.length++;this.items[b]=new Y(Z.count++,a),this.percolate(b)},$.remove=function(a){for(var b=0;b<this.length;b++)if(this.items[b].value===a)return this.removeAt(b),!0;return!1},Z.count=0;var _=C.CompositeDisposable=function(){this.disposables=l(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},ab=_.prototype;ab.add=function(a){this.isDisposed?a.dispose():(this.disposables.push(a),this.length++)},ab.remove=function(a){var b=!1;if(!this.isDisposed){var c=this.disposables.indexOf(a);-1!==c&&(b=!0,this.disposables.splice(c,1),this.length--,a.dispose())}return b},ab.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.disposables.slice(0);this.disposables=[],this.length=0;for(var b=0,c=a.length;c>b;b++)a[b].dispose()}},ab.clear=function(){var a=this.disposables.slice(0);this.disposables=[],this.length=0;for(var b=0,c=a.length;c>b;b++)a[b].dispose()},ab.contains=function(a){return-1!==this.disposables.indexOf(a)},ab.toArray=function(){return this.disposables.slice(0)};var bb=C.Disposable=function(a){this.isDisposed=!1,this.action=a||b};bb.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var cb=bb.create=function(a){return new bb(a)},db=bb.empty={dispose:b},eb=function(){function a(a){this.isSingle=a,this.isDisposed=!1,this.current=null}var b=a.prototype;return b.getDisposable=function(){return this.current},b.setDisposable=function(a){if(this.current&&this.isSingle)throw new Error("Disposable has already been assigned");var b,c=this.isDisposed;c||(b=this.current,this.current=a),b&&b.dispose(),c&&a&&a.dispose()},b.dispose=function(){var a;this.isDisposed||(this.isDisposed=!0,a=this.current,this.current=null),a&&a.dispose()},a}(),fb=C.SingleAssignmentDisposable=function(a){function b(){a.call(this,!0)}return W(b,a),b}(eb),gb=C.SerialDisposable=function(a){function b(){a.call(this,!1)}return W(b,a),b}(eb),hb=(C.RefCountDisposable=function(){function a(a){this.disposable=a,this.disposable.count++,this.isInnerDisposed=!1}function b(a){this.underlyingDisposable=a,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return a.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()))},b.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},b.prototype.getDisposable=function(){return this.isDisposed?db:new a(this)},b}(),C.Internals.ScheduledItem=function(a,b,c,d,f){this.scheduler=a,this.state=b,this.action=c,this.dueTime=d,this.comparer=f||e,this.disposable=new fb});hb.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},hb.prototype.compareTo=function(a){return this.comparer(this.dueTime,a.dueTime)},hb.prototype.isCancelled=function(){return this.disposable.isDisposed},hb.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var ib,jb=C.Scheduler=function(){function a(a,b,c,d){this.now=a,this._schedule=b,this._scheduleRelative=c,this._scheduleAbsolute=d}function b(a,b){var c=b.first,d=b.second,e=new _,f=function(b){d(b,function(b){var c=!1,d=!1,g=a.scheduleWithState(b,function(a,b){return c?e.remove(g):d=!0,f(b),db});d||(e.add(g),c=!0)})};return f(c),e}function c(a,b,c){var d=b.first,e=b.second,f=new _,g=function(b){e(b,function(b,d){var e=!1,h=!1,i=a[c].call(a,b,d,function(a,b){return e?f.remove(i):h=!0,g(b),db});h||(f.add(i),e=!0)})};return g(d),f}function d(a,b){return b(),db}var e=a.prototype;return e.schedulePeriodic=function(a,b){return this.schedulePeriodicWithState(null,a,function(){b()})},e.schedulePeriodicWithState=function(a,b,c){var d=a,e=setInterval(function(){d=c(d)},b);return cb(function(){clearInterval(e)})},e.schedule=function(a){return this._schedule(a,d)},e.scheduleWithState=function(a,b){return this._schedule(a,b)},e.scheduleWithRelative=function(a,b){return this._scheduleRelative(b,a,d)},e.scheduleWithRelativeAndState=function(a,b,c){return this._scheduleRelative(a,b,c)},e.scheduleWithAbsolute=function(a,b){return this._scheduleAbsolute(b,a,d)},e.scheduleWithAbsoluteAndState=function(a,b,c){return this._scheduleAbsolute(a,b,c)},e.scheduleRecursive=function(a){return this.scheduleRecursiveWithState(a,function(a,b){a(function(){b(a)})})},e.scheduleRecursiveWithState=function(a,c){return this.scheduleWithState({first:a,second:c},function(a,c){return b(a,c)})},e.scheduleRecursiveWithRelative=function(a,b){return this.scheduleRecursiveWithRelativeAndState(b,a,function(a,b){a(function(c){b(a,c)})})},e.scheduleRecursiveWithRelativeAndState=function(a,b,d){return this._scheduleRelative({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithRelativeAndState")})},e.scheduleRecursiveWithAbsolute=function(a,b){return this.scheduleRecursiveWithAbsoluteAndState(b,a,function(a,b){a(function(c){b(a,c)})})},e.scheduleRecursiveWithAbsoluteAndState=function(a,b,d){return this._scheduleAbsolute({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithAbsoluteAndState")})},a.now=D,a.normalize=function(a){return 0>a&&(a=0),a},a}(),kb=jb.normalize,lb=jb.immediate=function(){function a(a,b){return b(this,a)}function b(a,b,c){for(var d=kb(d);d-this.now()>0;);return c(this,a)}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new jb(D,a,b,c)}(),mb=jb.currentThread=function(){function a(a){for(var b;a.length>0;)if(b=a.dequeue(),!b.isCancelled()){for(;b.dueTime-jb.now()>0;);b.isCancelled()||b.invoke()}}function b(a,b){return this.scheduleWithRelativeAndState(a,0,b)}function c(b,c,d){var f=this.now()+jb.normalize(c),g=new hb(this,b,d,f);if(e)e.enqueue(g);else{e=new Z(4),e.enqueue(g);try{a(e)}catch(h){throw h}finally{e=null}}return g.disposable}function d(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}var e,f=new jb(D,b,c,d);return f.scheduleRequired=function(){return null===e},f.ensureTrampoline=function(a){return null===e?this.schedule(a):a()},f}(),nb=(C.Internals.SchedulePeriodicRecursive=function(){function a(a,b){b(0,this._period);try{this._state=this._action(this._state)}catch(c){throw this._cancel.dispose(),c}}function b(a,b,c,d){this._scheduler=a,this._state=b,this._period=c,this._action=d}return b.prototype.start=function(){var b=new fb;return this._cancel=b,b.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,a.bind(this))),b},b}(),b);!function(){function a(){if(!w.postMessage||w.importScripts)return!1;var a=!1,b=w.onmessage;return w.onmessage=function(){a=!0},w.postMessage("","*"),w.onmessage=b,a}function b(a){for(var b=0,c=a.length;c>b;b++){var d=a[b].target.getAttribute("drainQueue");h[d](),delete h[d]}}function c(a){if("string"==typeof a.data&&a.data.substring(0,l.length)===l){var b=a.data.substring(l.length),c=m[b];c(),delete m[b]}}var d=RegExp("^"+String(Q).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),e="function"==typeof(e=A&&z&&A.setImmediate)&&!d.test(e)&&e,f="function"==typeof(f=A&&z&&A.clearImmediate)&&!d.test(f)&&f,g=w.MutationObserver||w.WebKitMutationObserver;if(g){var h={},i=0,j=new g(b),k=document.createElement("div");j.observe(k,{attributes:!0}),w.addEventListener("unload",function(){j.disconnect(),j=null}),ib=function(a){var b=i++;return h[b]=a,k.setAttribute("drainQueue",b),b},nb=function(a){delete h[a]}}else if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))ib=process.nextTick;else if("function"==typeof e)ib=e,nb=f;else if(a()){var l="ms.rx.schedule"+Math.random(),m={},n=0;w.addEventListener?w.addEventListener("message",c,!1):w.attachEvent("onmessage",c,!1),ib=function(a){var b=n++;m[b]=a,w.postMessage(l+b,"*")}}else if(w.MessageChannel){var o=new w.MessageChannel,p={},q=0;o.port1.onmessage=function(a){var b=a.data,c=p[b];c(),delete p[b]},ib=function(a){var b=q++;p[b]=a,o.port2.postMessage(b)}}else"document"in w&&"onreadystatechange"in w.document.createElement("script")?ib=function(a){var b=w.document.createElement("script");b.onreadystatechange=function(){a(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},w.document.documentElement.appendChild(b)}:(ib=function(a){return setTimeout(a,0)},nb=clearTimeout)}();var ob=jb.timeout=function(){function a(a,b){var c=this,d=new fb,e=ib(function(){d.isDisposed||d.setDisposable(b(c,a))});return new _(d,cb(function(){nb(e)}))}function b(a,b,c){var d=this,e=jb.normalize(b);if(0===e)return d.scheduleWithState(a,c);var f=new fb,g=setTimeout(function(){f.isDisposed||f.setDisposable(c(d,a))},e);return new _(f,cb(function(){clearTimeout(g)}))}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new jb(D,a,b,c)}(),pb=C.Notification=function(){function a(a,b){this.hasValue=null==b?!1:b,this.kind=a}var b=a.prototype;return b.accept=function(a,b,c){return 1===arguments.length&&"object"==typeof a?this._acceptObservable(a):this._accept(a,b,c)},b.toObservable=function(a){var b=this;return a||(a=lb),new Sb(function(c){return a.schedule(function(){b._acceptObservable(c),"N"===b.kind&&c.onCompleted()})})},a}(),qb=pb.createOnNext=function(){function a(a){return a(this.value)}function b(a){return a.onNext(this.value)}function c(){return"OnNext("+this.value+")"}return function(d){var e=new pb("N",!0);return e.value=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),rb=pb.createOnError=function(){function a(a,b){return b(this.exception)}function b(a){return a.onError(this.exception)}function c(){return"OnError("+this.exception+")"}return function(d){var e=new pb("E");return e.exception=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),sb=pb.createOnCompleted=function(){function a(a,b,c){return c()}function b(a){return a.onCompleted()}function c(){return"OnCompleted()"}return function(){var d=new pb("C");return d._accept=a,d._acceptObservable=b,d.toString=c,d}}(),tb=C.Internals.Enumerator=function(a,b){this.moveNext=a,this.getCurrent=b},ub=tb.create=function(a,b){var c=!1;return new tb(function(){if(c)return!1;var b=a();return b||(c=!0),b},function(){return b()})},vb=C.Internals.Enumerable=function(a){this.getEnumerator=a};vb.prototype.concat=function(){var a=this;return new Sb(function(b){var c,d=a.getEnumerator(),e=new gb,f=lb.scheduleRecursive(function(a){var f,g;if(!c){try{g=d.moveNext(),g&&(f=d.getCurrent())}catch(h){return b.onError(h),void 0}if(!g)return b.onCompleted(),void 0;var i=new fb;e.setDisposable(i),i.setDisposable(f.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){a()}))}});return new _(e,f,cb(function(){c=!0}))})},vb.prototype.catchException=function(){var a=this;return new Sb(function(b){var c,d,e=a.getEnumerator(),f=new gb,g=lb.scheduleRecursive(function(a){var g,h;if(!c){try{h=e.moveNext(),h&&(g=e.getCurrent())}catch(i){return b.onError(i),void 0}if(!h)return d?b.onError(d):b.onCompleted(),void 0;var j=new fb;f.setDisposable(j),j.setDisposable(g.subscribe(b.onNext.bind(b),function(b){d=b,a()},b.onCompleted.bind(b)))}});return new _(f,g,cb(function(){c=!0}))})};var wb=vb.repeat=function(a,b){return 1===arguments.length&&(b=-1),new vb(function(){var c,d=b;return ub(function(){return 0===d?!1:(d>0&&d--,c=a,!0)},function(){return c})})},xb=vb.forEach=function(a,b,d){return b||(b=c),new vb(function(){var c,e=-1;return ub(function(){return++e<a.length?(c=b.call(d,a[e],e,a),!0):!1},function(){return c})})},yb=C.Observer=function(){};yb.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},yb.prototype.asObserver=function(){return new Cb(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))};var zb=yb.create=function(a,c,d){return a||(a=b),c||(c=f),d||(d=b),new Cb(a,c,d)};yb.fromNotifier=function(a){return new Cb(function(b){return a(qb(b))},function(b){return a(rb(b))},function(){return a(sb())})};var Ab,Bb=C.Internals.AbstractObserver=function(a){function b(){this.isStopped=!1,a.call(this)}return W(b,a),b.prototype.onNext=function(a){this.isStopped||this.next(a)},b.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.error(a))},b.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},b.prototype.dispose=function(){this.isStopped=!0},b.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.error(a),!0)},b}(yb),Cb=C.AnonymousObserver=function(a){function b(b,c,d){a.call(this),this._onNext=b,this._onError=c,this._onCompleted=d}return W(b,a),b.prototype.next=function(a){this._onNext(a)},b.prototype.error=function(a){this._onError(a)},b.prototype.completed=function(){this._onCompleted()},b}(Bb),Db=C.Observable=function(){function a(a){this._subscribe=a}return Ab=a.prototype,Ab.finalValue=function(){var a=this;return new Sb(function(b){var c,d=!1;return a.subscribe(function(a){d=!0,c=a},b.onError.bind(b),function(){d?(b.onNext(c),b.onCompleted()):b.onError(new Error(E))})})},Ab.subscribe=Ab.forEach=function(a,b,c){var d;return d="object"==typeof a?a:zb(a,b,c),this._subscribe(d)},Ab.toArray=function(){function a(a,b){var c=a.slice(0);return c.push(b),c}return this.scan([],a).startWith([]).finalValue()},a}(),Eb=C.Internals.ScheduledObserver=function(a){function b(b,c){a.call(this),this.scheduler=b,this.observer=c,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new gb}return W(b,a),b.prototype.next=function(a){var b=this;this.queue.push(function(){b.observer.onNext(a)})},b.prototype.error=function(a){var b=this;this.queue.push(function(){b.observer.onError(a)})},b.prototype.completed=function(){var a=this;this.queue.push(function(){a.observer.onCompleted()})},b.prototype.ensureActive=function(){var a=!1,b=this;!this.hasFaulted&&this.queue.length>0&&(a=!this.isAcquired,this.isAcquired=!0),a&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(a){var c;if(!(b.queue.length>0))return b.isAcquired=!1,void 0;c=b.queue.shift();try{c()}catch(d){throw b.queue=[],b.hasFaulted=!0,d}a()}))},b.prototype.dispose=function(){a.prototype.dispose.call(this),this.disposable.dispose()},b}(Bb);Db.create=Db.createWithDisposable=function(a){return new Sb(a)};var Fb=Db.defer=function(a){return new Sb(function(b){var c;try{c=a()}catch(d){return Kb(d).subscribe(b)}return c.subscribe(b)})},Gb=Db.empty=function(a){return a||(a=lb),new Sb(function(b){return a.schedule(function(){b.onCompleted()})})},Hb=Db.fromArray=function(a,b){return b||(b=mb),new Sb(function(c){var d=0;return b.scheduleRecursive(function(b){d<a.length?(c.onNext(a[d++]),b()):c.onCompleted()})})};Db.generate=function(a,b,c,d,e){return e||(e=mb),new Sb(function(f){var g=!0,h=a;return e.scheduleRecursive(function(a){var e,i;try{g?g=!1:h=c(h),e=b(h),e&&(i=d(h))}catch(j){return f.onError(j),void 0}e?(f.onNext(i),a()):f.onCompleted()})})};var Ib=Db.never=function(){return new Sb(function(){return db})};Db.range=function(a,b,c){return c||(c=mb),new Sb(function(d){return c.scheduleRecursiveWithState(0,function(c,e){b>c?(d.onNext(a+c),e(c+1)):d.onCompleted()})})},Db.repeat=function(a,b,c){return c||(c=mb),null==b&&(b=-1),Jb(a,c).repeat(b)};var Jb=Db["return"]=Db.returnValue=function(a,b){return b||(b=lb),new Sb(function(c){return b.schedule(function(){c.onNext(a),c.onCompleted()})})},Kb=Db["throw"]=Db.throwException=function(a,b){return b||(b=lb),new Sb(function(c){return b.schedule(function(){c.onError(a)})})};Ab["catch"]=Ab.catchException=function(a){return"function"==typeof a?n(this,a):Lb([this,a])};var Lb=Db.catchException=Db["catch"]=function(){var a=l(arguments,0);return xb(a).catchException()};Ab.combineLatest=function(){var a=V.call(arguments);return Array.isArray(a[0])?a[0].unshift(this):a.unshift(this),Mb.apply(this,a)};var Mb=Db.combineLatest=function(){var a=V.call(arguments),b=a.pop();return Array.isArray(a[0])&&(a=a[0]),new Sb(function(d){function e(a){var e;if(i[a]=!0,j||(j=i.every(c))){try{e=b.apply(null,l)}catch(f){return d.onError(f),void 0}d.onNext(e)}else k.filter(function(b,c){return c!==a}).every(c)&&d.onCompleted()}function f(a){k[a]=!0,k.every(c)&&d.onCompleted()}for(var g=function(){return!1},h=a.length,i=m(h,g),j=!1,k=m(h,g),l=new Array(h),n=new Array(h),o=0;h>o;o++)!function(b){n[b]=new fb,n[b].setDisposable(a[b].subscribe(function(a){l[b]=a,e(b)},d.onError.bind(d),function(){f(b)}))}(o);return new _(n)})};Ab.concat=function(){var a=V.call(arguments,0);return a.unshift(this),Nb.apply(this,a)};var Nb=Db.concat=function(){var a=l(arguments,0);return xb(a).concat()};Ab.concatObservable=Ab.concatAll=function(){return this.merge(1)},Ab.merge=function(a){if("number"!=typeof a)return Ob(this,a);var b=this;return new Sb(function(c){var d=0,e=new _,f=!1,g=[],h=function(a){var b=new fb;e.add(b),b.setDisposable(a.subscribe(c.onNext.bind(c),c.onError.bind(c),function(){var a;e.remove(b),g.length>0?(a=g.shift(),h(a)):(d--,f&&0===d&&c.onCompleted())}))};return e.add(b.subscribe(function(b){a>d?(d++,h(b)):g.push(b)},c.onError.bind(c),function(){f=!0,0===d&&c.onCompleted()})),e})};var Ob=Db.merge=function(){var a,b;return arguments[0]?arguments[0].now?(a=arguments[0],b=V.call(arguments,1)):(a=lb,b=V.call(arguments,0)):(a=lb,b=V.call(arguments,1)),Array.isArray(b[0])&&(b=b[0]),Hb(b,a).mergeObservable()};Ab.mergeObservable=Ab.mergeAll=function(){var a=this;return new Sb(function(b){var c=new _,d=!1,e=new fb;return c.add(e),e.setDisposable(a.subscribe(function(a){var e=new fb;c.add(e),e.setDisposable(a.subscribe(function(a){b.onNext(a)},b.onError.bind(b),function(){c.remove(e),d&&1===c.length&&b.onCompleted()}))},b.onError.bind(b),function(){d=!0,1===c.length&&b.onCompleted()})),c})},Ab.skipUntil=function(a){var b=this;return new Sb(function(c){var d=!1,e=new _(b.subscribe(function(a){d&&c.onNext(a)},c.onError.bind(c),function(){d&&c.onCompleted()})),f=new fb;return e.add(f),f.setDisposable(a.subscribe(function(){d=!0,f.dispose()},c.onError.bind(c),function(){f.dispose()})),e})},Ab["switch"]=Ab.switchLatest=function(){var a=this;return new Sb(function(b){var c=!1,d=new gb,e=!1,f=0,g=a.subscribe(function(a){var g=new fb,h=++f;c=!0,d.setDisposable(g),g.setDisposable(a.subscribe(function(a){f===h&&b.onNext(a)},function(a){f===h&&b.onError(a)},function(){f===h&&(c=!1,e&&b.onCompleted())}))},b.onError.bind(b),function(){e=!0,c||b.onCompleted()});return new _(g,d)})},Ab.takeUntil=function(a){var c=this;return new Sb(function(d){return new _(c.subscribe(d),a.subscribe(d.onCompleted.bind(d),d.onError.bind(d),b))})},Ab.zip=function(){if(Array.isArray(arguments[0]))return o.apply(this,arguments);var a=this,b=V.call(arguments),d=b.pop();return b.unshift(a),new Sb(function(e){function f(a){i[a]=!0,i.every(function(a){return a})&&e.onCompleted()}for(var g=b.length,h=m(g,function(){return[]}),i=m(g,function(){return!1}),j=function(b){var f,g;if(h.every(function(a){return a.length>0})){try{g=h.map(function(a){return a.shift()}),f=d.apply(a,g)}catch(j){return e.onError(j),void 0}e.onNext(f)}else i.filter(function(a,c){return c!==b}).every(c)&&e.onCompleted()},k=new Array(g),l=0;g>l;l++)!function(a){k[a]=new fb,k[a].setDisposable(b[a].subscribe(function(b){h[a].push(b),j(a)},e.onError.bind(e),function(){f(a)}))}(l);return new _(k)})},Db.zip=function(){var a=V.call(arguments,0),b=a.shift();return b.zip.apply(b,a)},Db.zipArray=function(){var a=l(arguments,0);return new Sb(function(b){function d(a){if(g.every(function(a){return a.length>0})){var d=g.map(function(a){return a.shift()});b.onNext(d)}else if(h.filter(function(b,c){return c!==a}).every(c))return b.onCompleted(),void 0}function e(a){return h[a]=!0,h.every(c)?(b.onCompleted(),void 0):void 0}for(var f=a.length,g=m(f,function(){return[]}),h=m(f,function(){return!1}),i=new Array(f),j=0;f>j;j++)!function(c){i[c]=new fb,i[c].setDisposable(a[c].subscribe(function(a){g[c].push(a),d(c)},b.onError.bind(b),function(){e(c)}))}(j);var k=new _(i);return k.add(cb(function(){for(var a=0,b=g.length;b>a;a++)g[a]=[]})),k})},Ab.asObservable=function(){var a=this;return new Sb(function(b){return a.subscribe(b)})},Ab.dematerialize=function(){var a=this;return new Sb(function(b){return a.subscribe(function(a){return a.accept(b)},b.onError.bind(b),b.onCompleted.bind(b))})},Ab.distinctUntilChanged=function(a,b){var e=this;return a||(a=c),b||(b=d),new Sb(function(c){var d,f=!1;return e.subscribe(function(e){var g,h=!1;try{g=a(e)}catch(i){return c.onError(i),void 0}if(f)try{h=b(d,g)}catch(i){return c.onError(i),void 0}f&&h||(f=!0,d=g,c.onNext(e))},c.onError.bind(c),c.onCompleted.bind(c))})},Ab["do"]=Ab.doAction=function(a,b,c){var d,e=this;return"function"==typeof a?d=a:(d=a.onNext.bind(a),b=a.onError.bind(a),c=a.onCompleted.bind(a)),new Sb(function(a){return e.subscribe(function(b){try{d(b)}catch(c){a.onError(c)}a.onNext(b)},function(c){if(b){try{b(c)}catch(d){a.onError(d)}a.onError(c)}else a.onError(c)},function(){if(c){try{c()}catch(b){a.onError(b)}a.onCompleted()}else a.onCompleted()})})},Ab["finally"]=Ab.finallyAction=function(a){var b=this;return new Sb(function(c){var d=b.subscribe(c);return cb(function(){try{d.dispose()}catch(b){throw b}finally{a()}})})},Ab.ignoreElements=function(){var a=this;return new Sb(function(c){return a.subscribe(b,c.onError.bind(c),c.onCompleted.bind(c))})},Ab.materialize=function(){var a=this;return new Sb(function(b){return a.subscribe(function(a){b.onNext(qb(a))},function(a){b.onNext(rb(a)),b.onCompleted()},function(){b.onNext(sb()),b.onCompleted()})})},Ab.repeat=function(a){return wb(this,a).concat()},Ab.retry=function(a){return wb(this,a).catchException()},Ab.scan=function(){var a,b,c=!1,d=this;return 2===arguments.length?(c=!0,a=arguments[0],b=arguments[1]):b=arguments[0],new Sb(function(e){var f,g,h;return d.subscribe(function(d){try{h||(h=!0),f?g=b(g,d):(g=c?b(a,d):d,f=!0)}catch(i){return e.onError(i),void 0}e.onNext(g)},e.onError.bind(e),function(){!h&&c&&e.onNext(a),e.onCompleted()})})},Ab.skipLast=function(a){var b=this;return new Sb(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&c.onNext(d.shift())},c.onError.bind(c),c.onCompleted.bind(c))})},Ab.startWith=function(){var a,b,c=0;return arguments.length&&"now"in Object(arguments[0])?(b=arguments[0],c=1):b=lb,a=V.call(arguments,c),xb([Hb(a,b),this]).concat()},Ab.takeLast=function(a,b){return this.takeLastBuffer(a).selectMany(function(a){return Hb(a,b)})},Ab.takeLastBuffer=function(a){var b=this;return new Sb(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},c.onError.bind(c),function(){c.onNext(d),c.onCompleted()})})},Ab.select=Ab.map=function(a,b){var c=this;return new Sb(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return d.onError(h),void 0}d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},Ab.selectMany=Ab.flatMap=function(a,b){return b?this.selectMany(function(c){return a(c).select(function(a){return b(c,a)})}):"function"==typeof a?p.call(this,a):p.call(this,function(){return a})},Ab.selectSwitch=Ab.flatMapLatest=function(a,b){return this.select(a,b).switchLatest()},Ab.skip=function(a){if(0>a)throw new Error(F);var b=this;return new Sb(function(c){var d=a;return b.subscribe(function(a){0>=d?c.onNext(a):d--},c.onError.bind(c),c.onCompleted.bind(c))})},Ab.skipWhile=function(a,b){var c=this;return new Sb(function(d){var e=0,f=!1;return c.subscribe(function(g){if(!f)try{f=!a.call(b,g,e++,c)}catch(h){return d.onError(h),void 0}f&&d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},Ab.take=function(a,b){if(0>a)throw new Error(F);if(0===a)return Gb(b);var c=this;return new Sb(function(b){var d=a;return c.subscribe(function(a){d>0&&(d--,b.onNext(a),0===d&&b.onCompleted())},b.onError.bind(b),b.onCompleted.bind(b))})},Ab.takeWhile=function(a,b){var c=this;return new Sb(function(d){var e=0,f=!0;return c.subscribe(function(g){if(f){try{f=a.call(b,g,e++,c)}catch(h){return d.onError(h),void 0}f?d.onNext(g):d.onCompleted()}},d.onError.bind(d),d.onCompleted.bind(d))})},Ab.where=Ab.filter=function(a,b){var c=this;return new Sb(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return d.onError(h),void 0}g&&d.onNext(f)},d.onError.bind(d),d.onCompleted.bind(d))})},Db.fromCallback=function(a,b,c,d){return b||(b=lb),function(){var e=V.call(arguments,0);return new Sb(function(f){return b.schedule(function(){function b(a){var b=a;if(d)try{b=d(arguments)}catch(c){return f.onError(c),void 0}else 1===b.length&&(b=b[0]);f.onNext(b),f.onCompleted()}e.push(b),a.apply(c,e)})})}},Db.fromNodeCallback=function(a,b,c,d){return b||(b=lb),function(){var e=V.call(arguments,0);return new Sb(function(f){return b.schedule(function(){function b(a){if(a)return f.onError(a),void 0;var b=V.call(arguments,1);if(d)try{b=d(b)}catch(c){return f.onError(c),void 0}else 1===b.length&&(b=b[0]);f.onNext(b),f.onCompleted()}e.push(b),a.apply(c,e)})})}},Db.fromEvent=function(a,b,c){return new Sb(function(d){return r(a,b,function(a){var b=a;if(c)try{b=c(arguments)}catch(e){return d.onError(e),void 0}d.onNext(b)})}).publish().refCount()},Db.fromEventPattern=function(a,b,c){return new Sb(function(d){function e(a){var b=a;if(c)try{b=c(arguments)}catch(e){return d.onError(e),void 0}d.onNext(b)}var f=a(e);return cb(function(){b&&b(e,f)})}).publish().refCount()},Db.fromPromise=function(a){return new Sb(function(b){a.then(function(a){b.onNext(a),b.onCompleted()},function(a){b.onError(a)})})},Ab.toPromise=function(a){var b=this;return new a(function(a,c){var d,e=!1;b.subscribe(function(a){d=a,e=!0},function(a){c(a)},function(){e&&a(d)})})},Ab.multicast=function(a,b){var c=this;return"function"==typeof a?new Sb(function(d){var e=c.multicast(a());return new _(b(e).subscribe(d),e.connect())}):new Pb(c,a)},Ab.publish=function(a){return a?this.multicast(function(){return new Vb},a):this.multicast(new Vb)},Ab.share=function(){return this.publish(null).refCount()},Ab.publishLast=function(a){return a?this.multicast(function(){return new Wb},a):this.multicast(new Wb)},Ab.publishValue=function(a,b){return 2===arguments.length?this.multicast(function(){return new Yb(b)},a):this.multicast(new Yb(a))},Ab.shareValue=function(a){return this.publishValue(a).refCount()},Ab.replay=function(a,b,c,d){return a?this.multicast(function(){return new Zb(b,c,d)},a):this.multicast(new Zb(b,c,d))},Ab.shareReplay=function(a,b,c){return this.replay(null,a,b,c).refCount()};var Pb=C.ConnectableObservable=function(a){function b(b,c){function d(a){return e.subject.subscribe(a)}var e={subject:c,source:b.asObservable(),hasSubscription:!1,subscription:null};this.connect=function(){return e.hasSubscription||(e.hasSubscription=!0,e.subscription=new _(e.source.subscribe(e.subject),cb(function(){e.hasSubscription=!1
2
- }))),e.subscription},a.call(this,d)}return W(b,a),b.prototype.connect=function(){return this.connect()},b.prototype.refCount=function(){var a=null,b=0,c=this;return new Sb(function(d){var e,f;return b++,e=1===b,f=c.subscribe(d),e&&(a=c.connect()),cb(function(){f.dispose(),b--,0===b&&a.dispose()})})},b}(Db),Qb=Db.interval=function(a,b){return b||(b=ob),t(a,a,b)},Rb=Db.timer=function(b,c,d){var e;return d||(d=ob),"number"==typeof c?e=c:"object"==typeof c&&"now"in c&&(d=c),e===a?s(b,d):t(b,e,d)};Ab.delay=function(a,b){b||(b=ob);var c=this;return new Sb(function(d){var e,f=!1,g=new gb,h=null,i=[],j=!1;return e=c.materialize().timestamp(b).subscribe(function(c){var e,k;"E"===c.value.kind?(i=[],i.push(c),h=c.value.exception,k=!j):(i.push({value:c.value,timestamp:c.timestamp+a}),k=!f,f=!0),k&&(null!==h?d.onError(h):(e=new fb,g.setDisposable(e),e.setDisposable(b.scheduleRecursiveWithRelative(a,function(a){var c,e,g,k;if(null===h){j=!0;do g=null,i.length>0&&i[0].timestamp-b.now()<=0&&(g=i.shift().value),null!==g&&g.accept(d);while(null!==g);k=!1,e=0,i.length>0?(k=!0,e=Math.max(0,i[0].timestamp-b.now())):f=!1,c=h,j=!1,null!==c?d.onError(c):k&&a(e)}}))))}),new _(e,g)})},Ab.throttle=function(a,b){b||(b=ob);return this.throttleWithSelector(function(){return Rb(a,b)})},Ab.timeInterval=function(a){var b=this;return a||(a=ob),Fb(function(){var c=a.now();return b.select(function(b){var d=a.now(),e=d-c;return c=d,{value:b,interval:e}})})},Ab.timestamp=function(a){return a||(a=ob),this.select(function(b){return{value:b,timestamp:a.now()}})},Ab.sample=function(a,b){return b||(b=ob),"number"==typeof a?u(this,Qb(a,b)):u(this,a)},Ab.timeout=function(a,b,c){var d,e=this;return b||(b=Kb(new Error("Timeout"))),c||(c=ob),d=a instanceof Date?function(a,b){c.scheduleWithAbsolute(a,b)}:function(a,b){c.scheduleWithRelative(a,b)},new Sb(function(c){var f,g=0,h=new fb,i=new gb,j=!1,k=new gb;return i.setDisposable(h),f=function(){var e=g;k.setDisposable(d(a,function(){j=g===e;var a=j;a&&i.setDisposable(b.subscribe(c))}))},f(),h.setDisposable(e.subscribe(function(a){var b=!j;b&&(g++,c.onNext(a),f())},function(a){var b=!j;b&&(g++,c.onError(a))},function(){var a=!j;a&&(g++,c.onCompleted())})),new _(i,k)})},Db.generateWithTime=function(a,b,c,d,e,f){return f||(f=ob),new Sb(function(g){var h,i,j=!0,k=!1,l=a;return f.scheduleRecursiveWithRelative(0,function(a){k&&g.onNext(h);try{j?j=!1:l=c(l),k=b(l),k&&(h=d(l),i=e(l))}catch(f){return g.onError(f),void 0}k?a(i):g.onCompleted()})})},Ab.delaySubscription=function(a,b){return b||(b=ob),this.delayWithSelector(Rb(a,b),function(){return Gb()})},Ab.delayWithSelector=function(a,b){var c,d,e=this;return"function"==typeof a?d=a:(c=a,d=b),new Sb(function(a){var b=new _,f=!1,g=function(){f&&0===b.length&&a.onCompleted()},h=new gb,i=function(){h.setDisposable(e.subscribe(function(c){var e;try{e=d(c)}catch(f){return a.onError(f),void 0}var h=new fb;b.add(h),h.setDisposable(e.subscribe(function(){a.onNext(c),b.remove(h),g()},a.onError.bind(a),function(){a.onNext(c),b.remove(h),g()}))},a.onError.bind(a),function(){f=!0,h.dispose(),g()}))};return c?h.setDisposable(c.subscribe(function(){i()},a.onError.bind(a),function(){i()})):i(),new _(h,b)})},Ab.timeoutWithSelector=function(a,b,c){if(1===arguments.length){b=a;var a=Ib()}c||(c=Kb(new Error("Timeout")));var d=this;return new Sb(function(e){var f=new gb,g=new gb,h=new fb;f.setDisposable(h);var i=0,j=!1,k=function(a){var b=i,d=function(){return i===b},h=new fb;g.setDisposable(h),h.setDisposable(a.subscribe(function(){d()&&f.setDisposable(c.subscribe(e)),h.dispose()},function(a){d()&&e.onError(a)},function(){d()&&f.setDisposable(c.subscribe(e))}))};k(a);var l=function(){var a=!j;return a&&i++,a};return h.setDisposable(d.subscribe(function(a){if(l()){e.onNext(a);var c;try{c=b(a)}catch(d){return e.onError(d),void 0}k(c)}},function(a){l()&&e.onError(a)},function(){l()&&e.onCompleted()})),new _(f,g)})},Ab.throttleWithSelector=function(a){var b=this;return new Sb(function(c){var d,e=!1,f=new gb,g=0,h=b.subscribe(function(b){var h;try{h=a(b)}catch(i){return c.onError(i),void 0}e=!0,d=b,g++;var j=g,k=new fb;f.setDisposable(k),k.setDisposable(h.subscribe(function(){e&&g===j&&c.onNext(d),e=!1,k.dispose()},c.onError.bind(c),function(){e&&g===j&&c.onNext(d),e=!1,k.dispose()}))},function(a){f.dispose(),c.onError(a),e=!1,g++},function(){f.dispose(),e&&c.onNext(d),c.onCompleted(),e=!1,g++});return new _(h,f)})},Ab.skipLastWithTime=function(a,b){b||(b=ob);var c=this;return new Sb(function(d){var e=[];return c.subscribe(function(c){var f=b.now();for(e.push({interval:f,value:c});e.length>0&&f-e[0].interval>=a;)d.onNext(e.shift().value)},d.onError.bind(d),function(){for(var c=b.now();e.length>0&&c-e[0].interval>=a;)d.onNext(e.shift().value);d.onCompleted()})})},Ab.takeLastWithTime=function(a,b,c){return this.takeLastBufferWithTime(a,b).selectMany(function(a){return Hb(a,c)})},Ab.takeLastBufferWithTime=function(a,b){var c=this;return b||(b=ob),new Sb(function(d){var e=[];return c.subscribe(function(c){var d=b.now();for(e.push({interval:d,value:c});e.length>0&&d-e[0].interval>=a;)e.shift()},d.onError.bind(d),function(){for(var c=b.now(),f=[];e.length>0;){var g=e.shift();c-g.interval<=a&&f.push(g.value)}d.onNext(f),d.onCompleted()})})},Ab.takeWithTime=function(a,b){var c=this;return b||(b=ob),new Sb(function(d){var e=b.scheduleWithRelative(a,function(){d.onCompleted()});return new _(e,c.subscribe(d))})},Ab.skipWithTime=function(a,b){var c=this;return b||(b=ob),new Sb(function(d){var e=!1,f=b.scheduleWithRelative(a,function(){e=!0}),g=c.subscribe(function(a){e&&d.onNext(a)},d.onError.bind(d),d.onCompleted.bind(d));return new _(f,g)})},Ab.skipUntilWithTime=function(a,b){b||(b=ob);var c=this;return new Sb(function(d){var e=!1,f=b.scheduleWithAbsolute(a,function(){e=!0}),g=c.subscribe(function(a){e&&d.onNext(a)},d.onError.bind(d),d.onCompleted.bind(d));return new _(f,g)})},Ab.takeUntilWithTime=function(a,b){b||(b=ob);var c=this;return new Sb(function(d){return new _(b.scheduleWithAbsolute(a,function(){d.onCompleted()}),c.subscribe(d))})};var Sb=C.Internals.AnonymousObservable=function(a){function b(a){return"undefined"==typeof a?a=db:"function"==typeof a&&(a=cb(a)),a}function c(d){function e(a){var c=new Tb(a);if(mb.scheduleRequired())mb.schedule(function(){try{c.setDisposable(b(d(c)))}catch(a){if(!c.fail(a))throw a}});else try{c.setDisposable(b(d(c)))}catch(e){if(!c.fail(e))throw e}return c}return this instanceof c?(a.call(this,e),void 0):new c(d)}return W(c,a),c}(Db),Tb=function(a){function b(b){a.call(this),this.observer=b,this.m=new fb}W(b,a);var c=b.prototype;return c.next=function(a){var b=!1;try{this.observer.onNext(a),b=!0}catch(c){throw c}finally{b||this.dispose()}},c.error=function(a){try{this.observer.onError(a)}catch(b){throw b}finally{this.dispose()}},c.completed=function(){try{this.observer.onCompleted()}catch(a){throw a}finally{this.dispose()}},c.setDisposable=function(a){this.m.setDisposable(a)},c.getDisposable=function(){return this.m.getDisposable()},c.disposable=function(a){return arguments.length?this.getDisposable():setDisposable(a)},c.dispose=function(){a.prototype.dispose.call(this),this.m.dispose()},b}(Bb),Ub=function(a,b){this.subject=a,this.observer=b};Ub.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var a=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(a,1),this.observer=null}};var Vb=C.Subject=function(a){function b(a){return g.call(this),this.isStopped?this.exception?(a.onError(this.exception),db):(a.onCompleted(),db):(this.observers.push(a),new Ub(this,a))}function c(){a.call(this,b),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return W(c,a),X(c.prototype,yb,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(g.call(this),!this.isStopped){var a=this.observers.slice(0);this.isStopped=!0;for(var b=0,c=a.length;c>b;b++)a[b].onCompleted();this.observers=[]}},onError:function(a){if(g.call(this),!this.isStopped){var b=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var c=0,d=b.length;d>c;c++)b[c].onError(a);this.observers=[]}},onNext:function(a){if(g.call(this),!this.isStopped)for(var b=this.observers.slice(0),c=0,d=b.length;d>c;c++)b[c].onNext(a)},dispose:function(){this.isDisposed=!0,this.observers=null}}),c.create=function(a,b){return new Xb(a,b)},c}(Db),Wb=C.AsyncSubject=function(a){function b(a){if(g.call(this),!this.isStopped)return this.observers.push(a),new Ub(this,a);var b=this.exception,c=this.hasValue,d=this.value;return b?a.onError(b):c?(a.onNext(d),a.onCompleted()):a.onCompleted(),db}function c(){a.call(this,b),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return W(c,a),X(c.prototype,yb,{hasObservers:function(){return g.call(this),this.observers.length>0},onCompleted:function(){var a,b,c;if(g.call(this),!this.isStopped){this.isStopped=!0;var d=this.observers.slice(0),e=this.value,f=this.hasValue;if(f)for(b=0,c=d.length;c>b;b++)a=d[b],a.onNext(e),a.onCompleted();else for(b=0,c=d.length;c>b;b++)d[b].onCompleted();this.observers=[]}},onError:function(a){if(g.call(this),!this.isStopped){var b=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var c=0,d=b.length;d>c;c++)b[c].onError(a);this.observers=[]}},onNext:function(a){g.call(this),this.isStopped||(this.value=a,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),c}(Db),Xb=function(a){function b(a){return this.observable.subscribe(a)}function c(c,d){a.call(this,b),this.observer=c,this.observable=d}return W(c,a),X(c.prototype,yb,{onCompleted:function(){this.observer.onCompleted()},onError:function(a){this.observer.onError(a)},onNext:function(a){this.observer.onNext(a)}}),c}(Db),Yb=C.BehaviorSubject=function(a){function b(a){if(g.call(this),!this.isStopped)return this.observers.push(a),a.onNext(this.value),new Ub(this,a);var b=this.exception;return b?a.onError(b):a.onCompleted(),db}function c(c){a.call(this,b),this.value=c,this.observers=[],this.isDisposed=!1,this.isStopped=!1,this.exception=null}return W(c,a),X(c.prototype,yb,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(g.call(this),!this.isStopped){var a=this.observers.slice(0);this.isStopped=!0;for(var b=0,c=a.length;c>b;b++)a[b].onCompleted();this.observers=[]}},onError:function(a){if(g.call(this),!this.isStopped){var b=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var c=0,d=b.length;d>c;c++)b[c].onError(a);this.observers=[]}},onNext:function(a){if(g.call(this),!this.isStopped){this.value=a;for(var b=this.observers.slice(0),c=0,d=b.length;d>c;c++)b[c].onNext(a)}},dispose:function(){this.isDisposed=!0,this.observers=null,this.value=null,this.exception=null}}),c}(Db),Zb=C.ReplaySubject=function(a){function b(a,b){this.subject=a,this.observer=b}function c(a){var c=new Eb(this.scheduler,a),d=new b(this,c);g.call(this),this._trim(this.scheduler.now()),this.observers.push(c);for(var e=this.q.length,f=0,h=this.q.length;h>f;f++)c.onNext(this.q[f].value);return this.hasError?(e++,c.onError(this.error)):this.isStopped&&(e++,c.onCompleted()),c.ensureActive(e),d}function d(b,d,e){this.bufferSize=null==b?Number.MAX_VALUE:b,this.windowSize=null==d?Number.MAX_VALUE:d,this.scheduler=e||mb,this.q=[],this.observers=[],this.isStopped=!1,this.isDisposed=!1,this.hasError=!1,this.error=null,a.call(this,c)}return b.prototype.dispose=function(){if(this.observer.dispose(),!this.subject.isDisposed){var a=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(a,1)}},W(d,a),X(d.prototype,yb,{hasObservers:function(){return this.observers.length>0},_trim:function(a){for(;this.q.length>this.bufferSize;)this.q.shift();for(;this.q.length>0&&a-this.q[0].interval>this.windowSize;)this.q.shift()},onNext:function(a){var b;if(g.call(this),!this.isStopped){var c=this.scheduler.now();this.q.push({interval:c,value:a}),this._trim(c);for(var d=this.observers.slice(0),e=0,f=d.length;f>e;e++)b=d[e],b.onNext(a),b.ensureActive()}},onError:function(a){var b;if(g.call(this),!this.isStopped){this.isStopped=!0,this.error=a,this.hasError=!0;var c=this.scheduler.now();this._trim(c);for(var d=this.observers.slice(0),e=0,f=d.length;f>e;e++)b=d[e],b.onError(a),b.ensureActive();this.observers=[]}},onCompleted:function(){var a;if(g.call(this),!this.isStopped){this.isStopped=!0;var b=this.scheduler.now();this._trim(b);for(var c=this.observers.slice(0),d=0,e=c.length;e>d;d++)a=c[d],a.onCompleted(),a.ensureActive();this.observers=[]}},dispose:function(){this.isDisposed=!0,this.observers=null}}),d}(Db);"function"==typeof define&&"object"==typeof define.amd&&define.amd?(w.Rx=C,define(function(){return C})):x&&y?z?(y.exports=C).Rx=C:x.Rx=C:w.Rx=C}).call(this);
1
+ (function(a){function b(){}function c(a){return a}function d(a,b){return eb(a,b)}function e(a,b){return a-b}function f(a){throw a}function g(a){return"function"==typeof a.then}function h(){if(this.isDisposed)throw new Error(L)}function i(a){var b=typeof a;return a&&("function"==b||"object"==b)||!1}function j(a){var b=[];if(!i(a))return b;db.nonEnumArgs&&a.length&&n(a)&&(a=fb.call(a));var c=db.enumPrototypes&&"function"==typeof a,d=db.enumErrorProps&&(a===Z||a instanceof Error);for(var e in a)c&&"prototype"==e||d&&("message"==e||"name"==e)||b.push(e);if(db.nonEnumShadows&&a!==$){var f=a.constructor,g=-1,h=bb.length;if(a===(f&&f.prototype))var j=a===stringProto?V:a===Z?Q:W.call(a),k=cb[j];for(;++g<h;)e=bb[g],k&&k[e]||!X.call(a,e)||b.push(e)}return b}function k(a,b,c){for(var d=-1,e=c(a),f=e.length;++d<f;){var g=e[d];if(b(a[g],g,a)===!1)break}return a}function l(a,b){return k(a,b,j)}function m(a){return"function"!=typeof a.toString&&"string"==typeof(a+"")}function n(a){return a&&"object"==typeof a?W.call(a)==M:!1}function o(a){return"function"==typeof a}function p(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;var e=typeof a,f=typeof b;if(a===a&&(null==a||null==b||"function"!=e&&"object"!=e&&"function"!=f&&"object"!=f))return!1;var g=W.call(a),h=W.call(b);if(g==M&&(g=T),h==M&&(h=T),g!=h)return!1;switch(g){case O:case P:return+a==+b;case S:return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case U:case V:return a==String(b)}var i=g==N;if(!i){if(g!=T||!db.nodeClass&&(m(a)||m(b)))return!1;var j=!db.argsObject&&n(a)?Object:a.constructor,k=!db.argsObject&&n(b)?Object:b.constructor;if(!(j==k||X.call(a,"constructor")&&X.call(b,"constructor")||o(j)&&j instanceof j&&o(k)&&k instanceof k||!("constructor"in a&&"constructor"in b)))return!1}c||(c=[]),d||(d=[]);for(var q=c.length;q--;)if(c[q]==a)return d[q]==b;var r=0;if(result=!0,c.push(a),d.push(b),i){if(q=a.length,r=b.length,result=r==q)for(;r--;){var s=b[r];if(!(result=p(a[r],s,c,d)))break}}else l(b,function(b,e,f){return X.call(f,e)?(r++,result=X.call(a,e)&&p(a[e],b,c,d)):void 0}),result&&l(a,function(a,b,c){return X.call(c,b)?result=--r>-1:void 0});return c.pop(),d.pop(),result}function q(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:fb.call(a)}function r(a,b){for(var c=new Array(a),d=0;a>d;d++)c[d]=b();return c}function s(a,b){return new dc(function(c){var d=new rb,e=new sb;return e.setDisposable(d),d.setDisposable(a.subscribe(c.onNext.bind(c),function(a){var d,f;try{f=b(a)}catch(g){return c.onError(g),void 0}d=new rb,e.setDisposable(d),d.setDisposable(f.subscribe(c))},c.onCompleted.bind(c))),e})}function t(a,b){var c=this;return new dc(function(d){var e=0,f=a.length;return c.subscribe(function(c){if(f>e){var g,h=a[e++];try{g=b(c,h)}catch(i){return d.onError(i),void 0}d.onNext(g)}else d.onCompleted()},d.onError.bind(d),d.onCompleted.bind(d))})}function u(a){return this.select(function(b,c){var d=a(b,c);return g(d)?_b(d):d}).mergeObservable()}function v(a,b,c){return a.addListener?(a.addListener(b,c),ob(function(){a.removeListener(b,c)})):a.addEventListener?(a.addEventListener(b,c,!1),ob(function(){a.removeEventListener(b,c,!1)})):void 0}function w(a,b,c){var d=new lb;if(a&&a.length)for(var e=0,f=a.length;f>e;e++)d.add(w(a[e],b,c));else a&&d.add(v(a,b,c));return d}function x(a,b){var c=wb(a);return new dc(function(a){return b.scheduleWithRelative(c,function(){a.onNext(0),a.onCompleted()})})}function y(a,b,c){return a===b?new dc(function(a){return c.schedulePeriodicWithState(0,b,function(b){return a.onNext(b),b+1})}):Rb(function(){return observableTimerDateAndPeriod(c.now()+a,b,c)})}function z(a,b){return new dc(function(c){function d(){g&&(g=!1,c.onNext(f)),e&&c.onCompleted()}var e,f,g;return new lb(a.subscribe(function(a){g=!0,f=a},c.onError.bind(c),function(){e=!0}),b.subscribe(d,c.onError.bind(c),d))})}var A={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},B=A[typeof window]&&window||this,C=A[typeof exports]&&exports&&!exports.nodeType&&exports,D=A[typeof module]&&module&&!module.nodeType&&module,E=D&&D.exports===C&&C,F=A[typeof global]&&global;!F||F.global!==F&&F.window!==F||(B=F);var G,H={internals:{},config:{}},I=Date.now,J="Sequence contains no elements.",K="Argument out of range",L="Object has been disposed",M="[object Arguments]",N="[object Array]",O="[object Boolean]",P="[object Date]",Q="[object Error]",R="[object Function]",S="[object Number]",T="[object Object]",U="[object RegExp]",V="[object String]",W=Object.prototype.toString,X=Object.prototype.hasOwnProperty,Y=W.call(arguments)==M,Z=Error.prototype,$=Object.prototype,_=$.propertyIsEnumerable;try{G=!(W.call(document)==T&&!({toString:0}+""))}catch(ab){G=!0}var bb=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],cb={};cb[N]=cb[P]=cb[S]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},cb[O]=cb[V]={constructor:!0,toString:!0,valueOf:!0},cb[Q]=cb[R]=cb[U]={constructor:!0,toString:!0},cb[T]={constructor:!0};var db={};!function(){var a=function(){this.x=1},b=[];a.prototype={valueOf:1,y:1};for(var c in new a)b.push(c);for(c in arguments);db.enumErrorProps=_.call(Z,"message")||_.call(Z,"name"),db.enumPrototypes=_.call(a,"prototype"),db.nonEnumArgs=0!=c,db.nonEnumShadows=!/valueOf/.test(b)}(1),Y||(n=function(a){return a&&"object"==typeof a?X.call(a,"callee"):!1}),o(/x/)&&(o=function(a){return"function"==typeof a&&W.call(a)==R});var eb=H.internals.isEqual=function(a,b){return p(a,b,[],[])},fb=Array.prototype.slice,gb=({}.hasOwnProperty,this.inherits=H.internals.inherits=function(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c}),hb=H.internals.addProperties=function(a){for(var b=fb.call(arguments,1),c=0,d=b.length;d>c;c++){var e=b[c];for(var f in e)a[f]=e[f]}},ib=(H.internals.addRef=function(a,b){return new dc(function(c){return new lb(b.getDisposable(),a.subscribe(c))})},function(a,b){this.id=a,this.value=b});ib.prototype.compareTo=function(a){var b=this.value.compareTo(a.value);return 0===b&&(b=this.id-a.id),b};var jb=H.internals.PriorityQueue=function(a){this.items=new Array(a),this.length=0},kb=jb.prototype;kb.isHigherPriority=function(a,b){return this.items[a].compareTo(this.items[b])<0},kb.percolate=function(a){if(!(a>=this.length||0>a)){var b=a-1>>1;if(!(0>b||b===a)&&this.isHigherPriority(a,b)){var c=this.items[a];this.items[a]=this.items[b],this.items[b]=c,this.percolate(b)}}},kb.heapify=function(b){if(b===a&&(b=0),!(b>=this.length||0>b)){var c=2*b+1,d=2*b+2,e=b;if(c<this.length&&this.isHigherPriority(c,e)&&(e=c),d<this.length&&this.isHigherPriority(d,e)&&(e=d),e!==b){var f=this.items[b];this.items[b]=this.items[e],this.items[e]=f,this.heapify(e)}}},kb.peek=function(){return this.items[0].value},kb.removeAt=function(a){this.items[a]=this.items[--this.length],delete this.items[this.length],this.heapify()},kb.dequeue=function(){var a=this.peek();return this.removeAt(0),a},kb.enqueue=function(a){var b=this.length++;this.items[b]=new ib(jb.count++,a),this.percolate(b)},kb.remove=function(a){for(var b=0;b<this.length;b++)if(this.items[b].value===a)return this.removeAt(b),!0;return!1},jb.count=0;var lb=H.CompositeDisposable=function(){this.disposables=q(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},mb=lb.prototype;mb.add=function(a){this.isDisposed?a.dispose():(this.disposables.push(a),this.length++)},mb.remove=function(a){var b=!1;if(!this.isDisposed){var c=this.disposables.indexOf(a);-1!==c&&(b=!0,this.disposables.splice(c,1),this.length--,a.dispose())}return b},mb.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.disposables.slice(0);this.disposables=[],this.length=0;for(var b=0,c=a.length;c>b;b++)a[b].dispose()}},mb.clear=function(){var a=this.disposables.slice(0);this.disposables=[],this.length=0;for(var b=0,c=a.length;c>b;b++)a[b].dispose()},mb.contains=function(a){return-1!==this.disposables.indexOf(a)},mb.toArray=function(){return this.disposables.slice(0)};var nb=H.Disposable=function(a){this.isDisposed=!1,this.action=a||b};nb.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var ob=nb.create=function(a){return new nb(a)},pb=nb.empty={dispose:b},qb=function(){function a(a){this.isSingle=a,this.isDisposed=!1,this.current=null}var b=a.prototype;return b.getDisposable=function(){return this.current},b.setDisposable=function(a){if(this.current&&this.isSingle)throw new Error("Disposable has already been assigned");var b,c=this.isDisposed;c||(b=this.current,this.current=a),b&&b.dispose(),c&&a&&a.dispose()},b.dispose=function(){var a;this.isDisposed||(this.isDisposed=!0,a=this.current,this.current=null),a&&a.dispose()},a}(),rb=H.SingleAssignmentDisposable=function(a){function b(){a.call(this,!0)}return gb(b,a),b}(qb),sb=H.SerialDisposable=function(a){function b(){a.call(this,!1)}return gb(b,a),b}(qb),tb=(H.RefCountDisposable=function(){function a(a){this.disposable=a,this.disposable.count++,this.isInnerDisposed=!1}function b(a){this.underlyingDisposable=a,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return a.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()))},b.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},b.prototype.getDisposable=function(){return this.isDisposed?pb:new a(this)},b}(),H.internals.ScheduledItem=function(a,b,c,d,f){this.scheduler=a,this.state=b,this.action=c,this.dueTime=d,this.comparer=f||e,this.disposable=new rb});tb.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},tb.prototype.compareTo=function(a){return this.comparer(this.dueTime,a.dueTime)},tb.prototype.isCancelled=function(){return this.disposable.isDisposed},tb.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var ub,vb=H.Scheduler=function(){function a(a,b,c,d){this.now=a,this._schedule=b,this._scheduleRelative=c,this._scheduleAbsolute=d}function b(a,b){var c=b.first,d=b.second,e=new lb,f=function(b){d(b,function(b){var c=!1,d=!1,g=a.scheduleWithState(b,function(a,b){return c?e.remove(g):d=!0,f(b),pb});d||(e.add(g),c=!0)})};return f(c),e}function c(a,b,c){var d=b.first,e=b.second,f=new lb,g=function(b){e(b,function(b,d){var e=!1,h=!1,i=a[c].call(a,b,d,function(a,b){return e?f.remove(i):h=!0,g(b),pb});h||(f.add(i),e=!0)})};return g(d),f}function d(a,b){return b(),pb}var e=a.prototype;return e.schedulePeriodic=function(a,b){return this.schedulePeriodicWithState(null,a,function(){b()})},e.schedulePeriodicWithState=function(a,b,c){var d=a,e=setInterval(function(){d=c(d)},b);return ob(function(){clearInterval(e)})},e.schedule=function(a){return this._schedule(a,d)},e.scheduleWithState=function(a,b){return this._schedule(a,b)},e.scheduleWithRelative=function(a,b){return this._scheduleRelative(b,a,d)},e.scheduleWithRelativeAndState=function(a,b,c){return this._scheduleRelative(a,b,c)},e.scheduleWithAbsolute=function(a,b){return this._scheduleAbsolute(b,a,d)},e.scheduleWithAbsoluteAndState=function(a,b,c){return this._scheduleAbsolute(a,b,c)},e.scheduleRecursive=function(a){return this.scheduleRecursiveWithState(a,function(a,b){a(function(){b(a)})})},e.scheduleRecursiveWithState=function(a,c){return this.scheduleWithState({first:a,second:c},function(a,c){return b(a,c)})},e.scheduleRecursiveWithRelative=function(a,b){return this.scheduleRecursiveWithRelativeAndState(b,a,function(a,b){a(function(c){b(a,c)})})},e.scheduleRecursiveWithRelativeAndState=function(a,b,d){return this._scheduleRelative({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithRelativeAndState")})},e.scheduleRecursiveWithAbsolute=function(a,b){return this.scheduleRecursiveWithAbsoluteAndState(b,a,function(a,b){a(function(c){b(a,c)})})},e.scheduleRecursiveWithAbsoluteAndState=function(a,b,d){return this._scheduleAbsolute({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithAbsoluteAndState")})},a.now=I,a.normalize=function(a){return 0>a&&(a=0),a},a}(),wb=vb.normalize,xb=vb.immediate=function(){function a(a,b){return b(this,a)}function b(a,b,c){for(var d=wb(d);d-this.now()>0;);return c(this,a)}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new vb(I,a,b,c)}(),yb=vb.currentThread=function(){function a(a){for(var b;a.length>0;)if(b=a.dequeue(),!b.isCancelled()){for(;b.dueTime-vb.now()>0;);b.isCancelled()||b.invoke()}}function b(a,b){return this.scheduleWithRelativeAndState(a,0,b)}function c(b,c,d){var f=this.now()+vb.normalize(c),g=new tb(this,b,d,f);if(e)e.enqueue(g);else{e=new jb(4),e.enqueue(g);try{a(e)}catch(h){throw h}finally{e=null}}return g.disposable}function d(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}var e,f=new vb(I,b,c,d);return f.scheduleRequired=function(){return null===e},f.ensureTrampoline=function(a){return null===e?this.schedule(a):a()},f}(),zb=(H.internals.SchedulePeriodicRecursive=function(){function a(a,b){b(0,this._period);try{this._state=this._action(this._state)}catch(c){throw this._cancel.dispose(),c}}function b(a,b,c,d){this._scheduler=a,this._state=b,this._period=c,this._action=d}return b.prototype.start=function(){var b=new rb;return this._cancel=b,b.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,a.bind(this))),b},b}(),b);!function(){function a(){if(!B.postMessage||B.importScripts)return!1;var a=!1,b=B.onmessage;return B.onmessage=function(){a=!0},B.postMessage("","*"),B.onmessage=b,a}function b(a){if("string"==typeof a.data&&a.data.substring(0,f.length)===f){var b=a.data.substring(f.length),c=g[b];c(),delete g[b]}}var c=RegExp("^"+String(W).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),d="function"==typeof(d=F&&E&&F.setImmediate)&&!c.test(d)&&d,e="function"==typeof(e=F&&E&&F.clearImmediate)&&!c.test(e)&&e;if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))ub=process.nextTick;else if("function"==typeof d)ub=d,zb=e;else if(a()){var f="ms.rx.schedule"+Math.random(),g={},h=0;B.addEventListener?B.addEventListener("message",b,!1):B.attachEvent("onmessage",b,!1),ub=function(a){var b=h++;g[b]=a,B.postMessage(f+b,"*")}}else if(B.MessageChannel){var i=new B.MessageChannel,j={},k=0;i.port1.onmessage=function(a){var b=a.data,c=j[b];c(),delete j[b]},ub=function(a){var b=k++;j[b]=a,i.port2.postMessage(b)}}else"document"in B&&"onreadystatechange"in B.document.createElement("script")?ub=function(a){var b=B.document.createElement("script");b.onreadystatechange=function(){a(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},B.document.documentElement.appendChild(b)}:(ub=function(a){return setTimeout(a,0)},zb=clearTimeout)}();var Ab=vb.timeout=function(){function a(a,b){var c=this,d=new rb,e=ub(function(){d.isDisposed||d.setDisposable(b(c,a))});return new lb(d,ob(function(){zb(e)}))}function b(a,b,c){var d=this,e=vb.normalize(b);if(0===e)return d.scheduleWithState(a,c);var f=new rb,g=setTimeout(function(){f.isDisposed||f.setDisposable(c(d,a))},e);return new lb(f,ob(function(){clearTimeout(g)}))}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new vb(I,a,b,c)}(),Bb=H.Notification=function(){function a(a,b){this.hasValue=null==b?!1:b,this.kind=a}var b=a.prototype;return b.accept=function(a,b,c){return 1===arguments.length&&"object"==typeof a?this._acceptObservable(a):this._accept(a,b,c)},b.toObservable=function(a){var b=this;return a||(a=xb),new dc(function(c){return a.schedule(function(){b._acceptObservable(c),"N"===b.kind&&c.onCompleted()})})},a}(),Cb=Bb.createOnNext=function(){function a(a){return a(this.value)}function b(a){return a.onNext(this.value)}function c(){return"OnNext("+this.value+")"}return function(d){var e=new Bb("N",!0);return e.value=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),Db=Bb.createOnError=function(){function a(a,b){return b(this.exception)}function b(a){return a.onError(this.exception)}function c(){return"OnError("+this.exception+")"}return function(d){var e=new Bb("E");return e.exception=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),Eb=Bb.createOnCompleted=function(){function a(a,b,c){return c()}function b(a){return a.onCompleted()}function c(){return"OnCompleted()"}return function(){var d=new Bb("C");return d._accept=a,d._acceptObservable=b,d.toString=c,d}}(),Fb=H.internals.Enumerator=function(a,b){this.moveNext=a,this.getCurrent=b},Gb=Fb.create=function(a,b){var c=!1;return new Fb(function(){if(c)return!1;var b=a();return b||(c=!0),b},function(){return b()})},Hb=H.internals.Enumerable=function(a){this.getEnumerator=a};Hb.prototype.concat=function(){var a=this;return new dc(function(b){var c,d=a.getEnumerator(),e=new sb,f=xb.scheduleRecursive(function(a){var f,g;if(!c){try{g=d.moveNext(),g&&(f=d.getCurrent())}catch(h){return b.onError(h),void 0}if(!g)return b.onCompleted(),void 0;var i=new rb;e.setDisposable(i),i.setDisposable(f.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){a()}))}});return new lb(e,f,ob(function(){c=!0}))})},Hb.prototype.catchException=function(){var a=this;return new dc(function(b){var c,d,e=a.getEnumerator(),f=new sb,g=xb.scheduleRecursive(function(a){var g,h;if(!c){try{h=e.moveNext(),h&&(g=e.getCurrent())}catch(i){return b.onError(i),void 0}if(!h)return d?b.onError(d):b.onCompleted(),void 0;var j=new rb;f.setDisposable(j),j.setDisposable(g.subscribe(b.onNext.bind(b),function(b){d=b,a()},b.onCompleted.bind(b)))}});return new lb(f,g,ob(function(){c=!0}))})};var Ib=Hb.repeat=function(a,b){return 1===arguments.length&&(b=-1),new Hb(function(){var c,d=b;return Gb(function(){return 0===d?!1:(d>0&&d--,c=a,!0)},function(){return c})})},Jb=Hb.forEach=function(a,b,d){return b||(b=c),new Hb(function(){var c,e=-1;return Gb(function(){return++e<a.length?(c=b.call(d,a[e],e,a),!0):!1},function(){return c})})},Kb=H.Observer=function(){};Kb.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},Kb.prototype.asObserver=function(){return new Ob(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))};var Lb=Kb.create=function(a,c,d){return a||(a=b),c||(c=f),d||(d=b),new Ob(a,c,d)};Kb.fromNotifier=function(a){return new Ob(function(b){return a(Cb(b))},function(b){return a(Db(b))},function(){return a(Eb())})};var Mb,Nb=H.internals.AbstractObserver=function(a){function b(){this.isStopped=!1,a.call(this)}return gb(b,a),b.prototype.onNext=function(a){this.isStopped||this.next(a)},b.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.error(a))},b.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},b.prototype.dispose=function(){this.isStopped=!0},b.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.error(a),!0)},b}(Kb),Ob=H.AnonymousObserver=function(a){function b(b,c,d){a.call(this),this._onNext=b,this._onError=c,this._onCompleted=d}return gb(b,a),b.prototype.next=function(a){this._onNext(a)},b.prototype.error=function(a){this._onError(a)},b.prototype.completed=function(){this._onCompleted()},b}(Nb),Pb=H.Observable=function(){function a(a){this._subscribe=a}return Mb=a.prototype,Mb.finalValue=function(){var a=this;return new dc(function(b){var c,d=!1;return a.subscribe(function(a){d=!0,c=a},b.onError.bind(b),function(){d?(b.onNext(c),b.onCompleted()):b.onError(new Error(J))})})},Mb.subscribe=Mb.forEach=function(a,b,c){var d;return d="object"==typeof a?a:Lb(a,b,c),this._subscribe(d)},Mb.toArray=function(){function a(a,b){var c=a.slice(0);return c.push(b),c}return this.scan([],a).startWith([]).finalValue()},a}(),Qb=H.internals.ScheduledObserver=function(a){function b(b,c){a.call(this),this.scheduler=b,this.observer=c,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new sb}return gb(b,a),b.prototype.next=function(a){var b=this;this.queue.push(function(){b.observer.onNext(a)})},b.prototype.error=function(a){var b=this;this.queue.push(function(){b.observer.onError(a)})},b.prototype.completed=function(){var a=this;this.queue.push(function(){a.observer.onCompleted()})},b.prototype.ensureActive=function(){var a=!1,b=this;!this.hasFaulted&&this.queue.length>0&&(a=!this.isAcquired,this.isAcquired=!0),a&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(a){var c;if(!(b.queue.length>0))return b.isAcquired=!1,void 0;c=b.queue.shift();try{c()}catch(d){throw b.queue=[],b.hasFaulted=!0,d}a()}))},b.prototype.dispose=function(){a.prototype.dispose.call(this),this.disposable.dispose()},b}(Nb);Pb.create=Pb.createWithDisposable=function(a){return new dc(a)};var Rb=Pb.defer=function(a){return new dc(function(b){var c;try{c=a()}catch(d){return Wb(d).subscribe(b)}return c.subscribe(b)})},Sb=Pb.empty=function(a){return a||(a=xb),new dc(function(b){return a.schedule(function(){b.onCompleted()})})},Tb=Pb.fromArray=function(a,b){return b||(b=yb),new dc(function(c){var d=0;return b.scheduleRecursive(function(b){d<a.length?(c.onNext(a[d++]),b()):c.onCompleted()})})};Mb.fromGenerator=function(a,b){return b||(b=yb),new dc(function(c){var d;try{d=a()}catch(e){return c.onError(e),void 0}return b.scheduleRecursive(function(a){var b=d.next();b.done?c.onCompleted():(c.onNext(b.value),a())})})},Pb.generate=function(a,b,c,d,e){return e||(e=yb),new dc(function(f){var g=!0,h=a;return e.scheduleRecursive(function(a){var e,i;try{g?g=!1:h=c(h),e=b(h),e&&(i=d(h))}catch(j){return f.onError(j),void 0}e?(f.onNext(i),a()):f.onCompleted()})})};var Ub=Pb.never=function(){return new dc(function(){return pb})};Pb.range=function(a,b,c){return c||(c=yb),new dc(function(d){return c.scheduleRecursiveWithState(0,function(c,e){b>c?(d.onNext(a+c),e(c+1)):d.onCompleted()})})},Pb.repeat=function(a,b,c){return c||(c=yb),null==b&&(b=-1),Vb(a,c).repeat(b)};var Vb=Pb["return"]=Pb.returnValue=function(a,b){return b||(b=xb),new dc(function(c){return b.schedule(function(){c.onNext(a),c.onCompleted()})})},Wb=Pb["throw"]=Pb.throwException=function(a,b){return b||(b=xb),new dc(function(c){return b.schedule(function(){c.onError(a)})})};Mb["catch"]=Mb.catchException=function(a){return"function"==typeof a?s(this,a):Xb([this,a])};var Xb=Pb.catchException=Pb["catch"]=function(){var a=q(arguments,0);return Jb(a).catchException()};Mb.combineLatest=function(){var a=fb.call(arguments);return Array.isArray(a[0])?a[0].unshift(this):a.unshift(this),Yb.apply(this,a)};var Yb=Pb.combineLatest=function(){var a=fb.call(arguments),b=a.pop();return Array.isArray(a[0])&&(a=a[0]),new dc(function(d){function e(a){var e;if(i[a]=!0,j||(j=i.every(c))){try{e=b.apply(null,l)}catch(f){return d.onError(f),void 0}d.onNext(e)}else k.filter(function(b,c){return c!==a}).every(c)&&d.onCompleted()}function f(a){k[a]=!0,k.every(c)&&d.onCompleted()}for(var g=function(){return!1},h=a.length,i=r(h,g),j=!1,k=r(h,g),l=new Array(h),m=new Array(h),n=0;h>n;n++)!function(b){m[b]=new rb,m[b].setDisposable(a[b].subscribe(function(a){l[b]=a,e(b)},d.onError.bind(d),function(){f(b)}))}(n);return new lb(m)})};Mb.concat=function(){var a=fb.call(arguments,0);return a.unshift(this),Zb.apply(this,a)};var Zb=Pb.concat=function(){var a=q(arguments,0);return Jb(a).concat()};Mb.concatObservable=Mb.concatAll=function(){return this.merge(1)},Mb.merge=function(a){if("number"!=typeof a)return $b(this,a);var b=this;return new dc(function(c){var d=0,e=new lb,f=!1,h=[],i=function(a){var b=new rb;e.add(b),g(a)&&(a=_b(a)),b.setDisposable(a.subscribe(c.onNext.bind(c),c.onError.bind(c),function(){var a;e.remove(b),h.length>0?(a=h.shift(),i(a)):(d--,f&&0===d&&c.onCompleted())}))};return e.add(b.subscribe(function(b){a>d?(d++,i(b)):h.push(b)},c.onError.bind(c),function(){f=!0,0===d&&c.onCompleted()})),e})};var $b=Pb.merge=function(){var a,b;return arguments[0]?arguments[0].now?(a=arguments[0],b=fb.call(arguments,1)):(a=xb,b=fb.call(arguments,0)):(a=xb,b=fb.call(arguments,1)),Array.isArray(b[0])&&(b=b[0]),Tb(b,a).mergeObservable()};Mb.mergeObservable=Mb.mergeAll=function(){var a=this;return new dc(function(b){var c=new lb,d=!1,e=new rb;return c.add(e),e.setDisposable(a.subscribe(function(a){var e=new rb;c.add(e),g(a)&&(a=_b(a)),e.setDisposable(a.subscribe(function(a){b.onNext(a)},b.onError.bind(b),function(){c.remove(e),d&&1===c.length&&b.onCompleted()}))},b.onError.bind(b),function(){d=!0,1===c.length&&b.onCompleted()})),c})},Mb.skipUntil=function(a){var b=this;return new dc(function(c){var d=!1,e=new lb(b.subscribe(function(a){d&&c.onNext(a)},c.onError.bind(c),function(){d&&c.onCompleted()})),f=new rb;return e.add(f),f.setDisposable(a.subscribe(function(){d=!0,f.dispose()},c.onError.bind(c),function(){f.dispose()})),e})},Mb["switch"]=Mb.switchLatest=function(){var a=this;return new dc(function(b){var c=!1,d=new sb,e=!1,f=0,h=a.subscribe(function(a){var h=new rb,i=++f;c=!0,d.setDisposable(h),g(a)&&(a=_b(a)),h.setDisposable(a.subscribe(function(a){f===i&&b.onNext(a)},function(a){f===i&&b.onError(a)},function(){f===i&&(c=!1,e&&b.onCompleted())}))},b.onError.bind(b),function(){e=!0,c||b.onCompleted()});return new lb(h,d)})},Mb.takeUntil=function(a){var c=this;return new dc(function(d){return new lb(c.subscribe(d),a.subscribe(d.onCompleted.bind(d),d.onError.bind(d),b))})},Mb.zip=function(){if(Array.isArray(arguments[0]))return t.apply(this,arguments);var a=this,b=fb.call(arguments),d=b.pop();return b.unshift(a),new dc(function(e){function f(a){i[a]=!0,i.every(function(a){return a})&&e.onCompleted()}for(var g=b.length,h=r(g,function(){return[]}),i=r(g,function(){return!1}),j=function(b){var f,g;if(h.every(function(a){return a.length>0})){try{g=h.map(function(a){return a.shift()}),f=d.apply(a,g)}catch(j){return e.onError(j),void 0}e.onNext(f)}else i.filter(function(a,c){return c!==b}).every(c)&&e.onCompleted()},k=new Array(g),l=0;g>l;l++)!function(a){k[a]=new rb,k[a].setDisposable(b[a].subscribe(function(b){h[a].push(b),j(a)},e.onError.bind(e),function(){f(a)}))}(l);return new lb(k)})},Pb.zip=function(){var a=fb.call(arguments,0),b=a.shift();return b.zip.apply(b,a)},Pb.zipArray=function(){var a=q(arguments,0);return new dc(function(b){function d(a){if(g.every(function(a){return a.length>0})){var d=g.map(function(a){return a.shift()});b.onNext(d)}else if(h.filter(function(b,c){return c!==a}).every(c))return b.onCompleted(),void 0}function e(a){return h[a]=!0,h.every(c)?(b.onCompleted(),void 0):void 0}for(var f=a.length,g=r(f,function(){return[]}),h=r(f,function(){return!1}),i=new Array(f),j=0;f>j;j++)!function(c){i[c]=new rb,i[c].setDisposable(a[c].subscribe(function(a){g[c].push(a),d(c)},b.onError.bind(b),function(){e(c)}))}(j);var k=new lb(i);return k.add(ob(function(){for(var a=0,b=g.length;b>a;a++)g[a]=[]})),k})},Mb.asObservable=function(){var a=this;return new dc(function(b){return a.subscribe(b)})},Mb.dematerialize=function(){var a=this;return new dc(function(b){return a.subscribe(function(a){return a.accept(b)},b.onError.bind(b),b.onCompleted.bind(b))})},Mb.distinctUntilChanged=function(a,b){var e=this;return a||(a=c),b||(b=d),new dc(function(c){var d,f=!1;return e.subscribe(function(e){var g,h=!1;try{g=a(e)}catch(i){return c.onError(i),void 0}if(f)try{h=b(d,g)}catch(i){return c.onError(i),void 0}f&&h||(f=!0,d=g,c.onNext(e))},c.onError.bind(c),c.onCompleted.bind(c))})},Mb["do"]=Mb.doAction=function(a,b,c){var d,e=this;return"function"==typeof a?d=a:(d=a.onNext.bind(a),b=a.onError.bind(a),c=a.onCompleted.bind(a)),new dc(function(a){return e.subscribe(function(b){try{d(b)}catch(c){a.onError(c)}a.onNext(b)},function(c){if(b){try{b(c)}catch(d){a.onError(d)}a.onError(c)}else a.onError(c)},function(){if(c){try{c()}catch(b){a.onError(b)}a.onCompleted()}else a.onCompleted()})})},Mb["finally"]=Mb.finallyAction=function(a){var b=this;return new dc(function(c){var d=b.subscribe(c);return ob(function(){try{d.dispose()}catch(b){throw b}finally{a()}})})},Mb.ignoreElements=function(){var a=this;return new dc(function(c){return a.subscribe(b,c.onError.bind(c),c.onCompleted.bind(c))})},Mb.materialize=function(){var a=this;return new dc(function(b){return a.subscribe(function(a){b.onNext(Cb(a))},function(a){b.onNext(Db(a)),b.onCompleted()},function(){b.onNext(Eb()),b.onCompleted()})})},Mb.repeat=function(a){return Ib(this,a).concat()},Mb.retry=function(a){return Ib(this,a).catchException()},Mb.scan=function(){var a,b,c=!1,d=this;return 2===arguments.length?(c=!0,a=arguments[0],b=arguments[1]):b=arguments[0],new dc(function(e){var f,g,h;return d.subscribe(function(d){try{h||(h=!0),f?g=b(g,d):(g=c?b(a,d):d,f=!0)}catch(i){return e.onError(i),void 0}e.onNext(g)},e.onError.bind(e),function(){!h&&c&&e.onNext(a),e.onCompleted()})})},Mb.skipLast=function(a){var b=this;return new dc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&c.onNext(d.shift())},c.onError.bind(c),c.onCompleted.bind(c))})},Mb.startWith=function(){var a,b,c=0;return arguments.length&&"now"in Object(arguments[0])?(b=arguments[0],c=1):b=xb,a=fb.call(arguments,c),Jb([Tb(a,b),this]).concat()},Mb.takeLast=function(a,b){return this.takeLastBuffer(a).selectMany(function(a){return Tb(a,b)})},Mb.takeLastBuffer=function(a){var b=this;return new dc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},c.onError.bind(c),function(){c.onNext(d),c.onCompleted()})})},Mb.select=Mb.map=function(a,b){var c=this;return new dc(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return d.onError(h),void 0}d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},Mb.selectMany=Mb.flatMap=function(a,b){return b?this.selectMany(function(c,d){var e=a(c,d),f=g(e)?_b(e):e;return f.select(function(a){return b(c,a,d)})}):"function"==typeof a?u.call(this,a):u.call(this,function(){return a})},Mb.selectSwitch=Mb.flatMapLatest=function(a,b){return this.select(a,b).switchLatest()},Mb.skip=function(a){if(0>a)throw new Error(K);var b=this;return new dc(function(c){var d=a;return b.subscribe(function(a){0>=d?c.onNext(a):d--},c.onError.bind(c),c.onCompleted.bind(c))})},Mb.skipWhile=function(a,b){var c=this;return new dc(function(d){var e=0,f=!1;return c.subscribe(function(g){if(!f)try{f=!a.call(b,g,e++,c)}catch(h){return d.onError(h),void 0}f&&d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},Mb.take=function(a,b){if(0>a)throw new Error(K);if(0===a)return Sb(b);var c=this;return new dc(function(b){var d=a;return c.subscribe(function(a){d>0&&(d--,b.onNext(a),0===d&&b.onCompleted())},b.onError.bind(b),b.onCompleted.bind(b))})},Mb.takeWhile=function(a,b){var c=this;return new dc(function(d){var e=0,f=!0;return c.subscribe(function(g){if(f){try{f=a.call(b,g,e++,c)}catch(h){return d.onError(h),void 0}f?d.onNext(g):d.onCompleted()}},d.onError.bind(d),d.onCompleted.bind(d))})},Mb.where=Mb.filter=function(a,b){var c=this;return new dc(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return d.onError(h),void 0}g&&d.onNext(f)},d.onError.bind(d),d.onCompleted.bind(d))})},Pb.fromCallback=function(a,b,c,d){return b||(b=xb),function(){var e=fb.call(arguments,0);return new dc(function(f){return b.schedule(function(){function b(a){var b=a;if(d)try{b=d(arguments)}catch(c){return f.onError(c),void 0}else 1===b.length&&(b=b[0]);f.onNext(b),f.onCompleted()}e.push(b),a.apply(c,e)})})}},Pb.fromNodeCallback=function(a,b,c,d){return b||(b=xb),function(){var e=fb.call(arguments,0);return new dc(function(f){return b.schedule(function(){function b(a){if(a)return f.onError(a),void 0;var b=fb.call(arguments,1);if(d)try{b=d(b)}catch(c){return f.onError(c),void 0}else 1===b.length&&(b=b[0]);f.onNext(b),f.onCompleted()}e.push(b),a.apply(c,e)})})}},Pb.fromEvent=function(a,b,c){return new dc(function(d){return w(a,b,function(a){var b=a;if(c)try{b=c(arguments)}catch(e){return d.onError(e),void 0}d.onNext(b)})}).publish().refCount()},Pb.fromEventPattern=function(a,b,c){return new dc(function(d){function e(a){var b=a;
2
+ if(c)try{b=c(arguments)}catch(e){return d.onError(e),void 0}d.onNext(b)}var f=a(e);return ob(function(){b&&b(e,f)})}).publish().refCount()};var _b=Pb.fromPromise=function(a){return new dc(function(b){a.then(function(a){b.onNext(a),b.onCompleted()},function(a){b.onError(a)})})};Mb.toPromise=function(a){if(a||(a=H.config.Promise),!a)throw new Error("Promise type not provided nor in Rx.config.Promise");var b=this;return new a(function(a,c){var d,e=!1;b.subscribe(function(a){d=a,e=!0},function(a){c(a)},function(){e&&a(d)})})},Pb.startAsync=function(a){var b;try{b=a()}catch(c){return Wb(c)}return _b(b)},Mb.multicast=function(a,b){var c=this;return"function"==typeof a?new dc(function(d){var e=c.multicast(a());return new lb(b(e).subscribe(d),e.connect())}):new ac(c,a)},Mb.publish=function(a){return a?this.multicast(function(){return new gc},a):this.multicast(new gc)},Mb.share=function(){return this.publish(null).refCount()},Mb.publishLast=function(a){return a?this.multicast(function(){return new hc},a):this.multicast(new hc)},Mb.publishValue=function(a,b){return 2===arguments.length?this.multicast(function(){return new jc(b)},a):this.multicast(new jc(a))},Mb.shareValue=function(a){return this.publishValue(a).refCount()},Mb.replay=function(a,b,c,d){return a?this.multicast(function(){return new kc(b,c,d)},a):this.multicast(new kc(b,c,d))},Mb.shareReplay=function(a,b,c){return this.replay(null,a,b,c).refCount()};var ac=H.ConnectableObservable=function(a){function b(b,c){function d(a){return e.subject.subscribe(a)}var e={subject:c,source:b.asObservable(),hasSubscription:!1,subscription:null};this.connect=function(){return e.hasSubscription||(e.hasSubscription=!0,e.subscription=new lb(e.source.subscribe(e.subject),ob(function(){e.hasSubscription=!1}))),e.subscription},a.call(this,d)}return gb(b,a),b.prototype.connect=function(){return this.connect()},b.prototype.refCount=function(){var a=null,b=0,c=this;return new dc(function(d){var e,f;return b++,e=1===b,f=c.subscribe(d),e&&(a=c.connect()),ob(function(){f.dispose(),b--,0===b&&a.dispose()})})},b}(Pb),bc=Pb.interval=function(a,b){return b||(b=Ab),y(a,a,b)},cc=Pb.timer=function(b,c,d){var e;return d||(d=Ab),"number"==typeof c?e=c:"object"==typeof c&&"now"in c&&(d=c),e===a?x(b,d):y(b,e,d)};Mb.delay=function(a,b){b||(b=Ab);var c=this;return new dc(function(d){var e,f=!1,g=new sb,h=null,i=[],j=!1;return e=c.materialize().timestamp(b).subscribe(function(c){var e,k;"E"===c.value.kind?(i=[],i.push(c),h=c.value.exception,k=!j):(i.push({value:c.value,timestamp:c.timestamp+a}),k=!f,f=!0),k&&(null!==h?d.onError(h):(e=new rb,g.setDisposable(e),e.setDisposable(b.scheduleRecursiveWithRelative(a,function(a){var c,e,g,k;if(null===h){j=!0;do g=null,i.length>0&&i[0].timestamp-b.now()<=0&&(g=i.shift().value),null!==g&&g.accept(d);while(null!==g);k=!1,e=0,i.length>0?(k=!0,e=Math.max(0,i[0].timestamp-b.now())):f=!1,c=h,j=!1,null!==c?d.onError(c):k&&a(e)}}))))}),new lb(e,g)})},Mb.throttle=function(a,b){b||(b=Ab);return this.throttleWithSelector(function(){return cc(a,b)})},Mb.timeInterval=function(a){var b=this;return a||(a=Ab),Rb(function(){var c=a.now();return b.select(function(b){var d=a.now(),e=d-c;return c=d,{value:b,interval:e}})})},Mb.timestamp=function(a){return a||(a=Ab),this.select(function(b){return{value:b,timestamp:a.now()}})},Mb.sample=function(a,b){return b||(b=Ab),"number"==typeof a?z(this,bc(a,b)):z(this,a)},Mb.timeout=function(a,b,c){var d,e=this;return b||(b=Wb(new Error("Timeout"))),c||(c=Ab),d=a instanceof Date?function(a,b){c.scheduleWithAbsolute(a,b)}:function(a,b){c.scheduleWithRelative(a,b)},new dc(function(c){var f,g=0,h=new rb,i=new sb,j=!1,k=new sb;return i.setDisposable(h),f=function(){var e=g;k.setDisposable(d(a,function(){j=g===e;var a=j;a&&i.setDisposable(b.subscribe(c))}))},f(),h.setDisposable(e.subscribe(function(a){var b=!j;b&&(g++,c.onNext(a),f())},function(a){var b=!j;b&&(g++,c.onError(a))},function(){var a=!j;a&&(g++,c.onCompleted())})),new lb(i,k)})},Pb.generateWithTime=function(a,b,c,d,e,f){return f||(f=Ab),new dc(function(g){var h,i,j=!0,k=!1,l=a;return f.scheduleRecursiveWithRelative(0,function(a){k&&g.onNext(h);try{j?j=!1:l=c(l),k=b(l),k&&(h=d(l),i=e(l))}catch(f){return g.onError(f),void 0}k?a(i):g.onCompleted()})})},Mb.delaySubscription=function(a,b){return b||(b=Ab),this.delayWithSelector(cc(a,b),function(){return Sb()})},Mb.delayWithSelector=function(a,b){var c,d,e=this;return"function"==typeof a?d=a:(c=a,d=b),new dc(function(a){var b=new lb,f=!1,g=function(){f&&0===b.length&&a.onCompleted()},h=new sb,i=function(){h.setDisposable(e.subscribe(function(c){var e;try{e=d(c)}catch(f){return a.onError(f),void 0}var h=new rb;b.add(h),h.setDisposable(e.subscribe(function(){a.onNext(c),b.remove(h),g()},a.onError.bind(a),function(){a.onNext(c),b.remove(h),g()}))},a.onError.bind(a),function(){f=!0,h.dispose(),g()}))};return c?h.setDisposable(c.subscribe(function(){i()},a.onError.bind(a),function(){i()})):i(),new lb(h,b)})},Mb.timeoutWithSelector=function(a,b,c){if(1===arguments.length){b=a;var a=Ub()}c||(c=Wb(new Error("Timeout")));var d=this;return new dc(function(e){var f=new sb,g=new sb,h=new rb;f.setDisposable(h);var i=0,j=!1,k=function(a){var b=i,d=function(){return i===b},h=new rb;g.setDisposable(h),h.setDisposable(a.subscribe(function(){d()&&f.setDisposable(c.subscribe(e)),h.dispose()},function(a){d()&&e.onError(a)},function(){d()&&f.setDisposable(c.subscribe(e))}))};k(a);var l=function(){var a=!j;return a&&i++,a};return h.setDisposable(d.subscribe(function(a){if(l()){e.onNext(a);var c;try{c=b(a)}catch(d){return e.onError(d),void 0}k(c)}},function(a){l()&&e.onError(a)},function(){l()&&e.onCompleted()})),new lb(f,g)})},Mb.throttleWithSelector=function(a){var b=this;return new dc(function(c){var d,e=!1,f=new sb,g=0,h=b.subscribe(function(b){var h;try{h=a(b)}catch(i){return c.onError(i),void 0}e=!0,d=b,g++;var j=g,k=new rb;f.setDisposable(k),k.setDisposable(h.subscribe(function(){e&&g===j&&c.onNext(d),e=!1,k.dispose()},c.onError.bind(c),function(){e&&g===j&&c.onNext(d),e=!1,k.dispose()}))},function(a){f.dispose(),c.onError(a),e=!1,g++},function(){f.dispose(),e&&c.onNext(d),c.onCompleted(),e=!1,g++});return new lb(h,f)})},Mb.skipLastWithTime=function(a,b){b||(b=Ab);var c=this;return new dc(function(d){var e=[];return c.subscribe(function(c){var f=b.now();for(e.push({interval:f,value:c});e.length>0&&f-e[0].interval>=a;)d.onNext(e.shift().value)},d.onError.bind(d),function(){for(var c=b.now();e.length>0&&c-e[0].interval>=a;)d.onNext(e.shift().value);d.onCompleted()})})},Mb.takeLastWithTime=function(a,b,c){return this.takeLastBufferWithTime(a,b).selectMany(function(a){return Tb(a,c)})},Mb.takeLastBufferWithTime=function(a,b){var c=this;return b||(b=Ab),new dc(function(d){var e=[];return c.subscribe(function(c){var d=b.now();for(e.push({interval:d,value:c});e.length>0&&d-e[0].interval>=a;)e.shift()},d.onError.bind(d),function(){for(var c=b.now(),f=[];e.length>0;){var g=e.shift();c-g.interval<=a&&f.push(g.value)}d.onNext(f),d.onCompleted()})})},Mb.takeWithTime=function(a,b){var c=this;return b||(b=Ab),new dc(function(d){var e=b.scheduleWithRelative(a,function(){d.onCompleted()});return new lb(e,c.subscribe(d))})},Mb.skipWithTime=function(a,b){var c=this;return b||(b=Ab),new dc(function(d){var e=!1,f=b.scheduleWithRelative(a,function(){e=!0}),g=c.subscribe(function(a){e&&d.onNext(a)},d.onError.bind(d),d.onCompleted.bind(d));return new lb(f,g)})},Mb.skipUntilWithTime=function(a,b){b||(b=Ab);var c=this;return new dc(function(d){var e=!1,f=b.scheduleWithAbsolute(a,function(){e=!0}),g=c.subscribe(function(a){e&&d.onNext(a)},d.onError.bind(d),d.onCompleted.bind(d));return new lb(f,g)})},Mb.takeUntilWithTime=function(a,b){b||(b=Ab);var c=this;return new dc(function(d){return new lb(b.scheduleWithAbsolute(a,function(){d.onCompleted()}),c.subscribe(d))})},Mb.pausable=function(a){var b=this;return new dc(function(c){var d=b.publish(),e=d.subscribe(c),f=pb,g=a.distinctUntilChanged().subscribe(function(a){a?f=d.connect():(f.dispose(),f=pb)});return new lb(e,f,g)})};var dc=H.AnonymousObservable=function(a){function b(a){return"undefined"==typeof a?a=pb:"function"==typeof a&&(a=ob(a)),a}function c(d){function e(a){var c=new ec(a);if(yb.scheduleRequired())yb.schedule(function(){try{c.setDisposable(b(d(c)))}catch(a){if(!c.fail(a))throw a}});else try{c.setDisposable(b(d(c)))}catch(e){if(!c.fail(e))throw e}return c}return this instanceof c?(a.call(this,e),void 0):new c(d)}return gb(c,a),c}(Pb),ec=function(a){function b(b){a.call(this),this.observer=b,this.m=new rb}gb(b,a);var c=b.prototype;return c.next=function(a){var b=!1;try{this.observer.onNext(a),b=!0}catch(c){throw c}finally{b||this.dispose()}},c.error=function(a){try{this.observer.onError(a)}catch(b){throw b}finally{this.dispose()}},c.completed=function(){try{this.observer.onCompleted()}catch(a){throw a}finally{this.dispose()}},c.setDisposable=function(a){this.m.setDisposable(a)},c.getDisposable=function(){return this.m.getDisposable()},c.disposable=function(a){return arguments.length?this.getDisposable():setDisposable(a)},c.dispose=function(){a.prototype.dispose.call(this),this.m.dispose()},b}(Nb),fc=function(a,b){this.subject=a,this.observer=b};fc.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var a=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(a,1),this.observer=null}};var gc=H.Subject=function(a){function b(a){return h.call(this),this.isStopped?this.exception?(a.onError(this.exception),pb):(a.onCompleted(),pb):(this.observers.push(a),new fc(this,a))}function c(){a.call(this,b),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return gb(c,a),hb(c.prototype,Kb,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(h.call(this),!this.isStopped){var a=this.observers.slice(0);this.isStopped=!0;for(var b=0,c=a.length;c>b;b++)a[b].onCompleted();this.observers=[]}},onError:function(a){if(h.call(this),!this.isStopped){var b=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var c=0,d=b.length;d>c;c++)b[c].onError(a);this.observers=[]}},onNext:function(a){if(h.call(this),!this.isStopped)for(var b=this.observers.slice(0),c=0,d=b.length;d>c;c++)b[c].onNext(a)},dispose:function(){this.isDisposed=!0,this.observers=null}}),c.create=function(a,b){return new ic(a,b)},c}(Pb),hc=H.AsyncSubject=function(a){function b(a){if(h.call(this),!this.isStopped)return this.observers.push(a),new fc(this,a);var b=this.exception,c=this.hasValue,d=this.value;return b?a.onError(b):c?(a.onNext(d),a.onCompleted()):a.onCompleted(),pb}function c(){a.call(this,b),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return gb(c,a),hb(c.prototype,Kb,{hasObservers:function(){return h.call(this),this.observers.length>0},onCompleted:function(){var a,b,c;if(h.call(this),!this.isStopped){this.isStopped=!0;var d=this.observers.slice(0),e=this.value,f=this.hasValue;if(f)for(b=0,c=d.length;c>b;b++)a=d[b],a.onNext(e),a.onCompleted();else for(b=0,c=d.length;c>b;b++)d[b].onCompleted();this.observers=[]}},onError:function(a){if(h.call(this),!this.isStopped){var b=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var c=0,d=b.length;d>c;c++)b[c].onError(a);this.observers=[]}},onNext:function(a){h.call(this),this.isStopped||(this.value=a,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),c}(Pb),ic=function(a){function b(a){return this.observable.subscribe(a)}function c(c,d){a.call(this,b),this.observer=c,this.observable=d}return gb(c,a),hb(c.prototype,Kb,{onCompleted:function(){this.observer.onCompleted()},onError:function(a){this.observer.onError(a)},onNext:function(a){this.observer.onNext(a)}}),c}(Pb),jc=H.BehaviorSubject=function(a){function b(a){if(h.call(this),!this.isStopped)return this.observers.push(a),a.onNext(this.value),new fc(this,a);var b=this.exception;return b?a.onError(b):a.onCompleted(),pb}function c(c){a.call(this,b),this.value=c,this.observers=[],this.isDisposed=!1,this.isStopped=!1,this.exception=null}return gb(c,a),hb(c.prototype,Kb,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(h.call(this),!this.isStopped){var a=this.observers.slice(0);this.isStopped=!0;for(var b=0,c=a.length;c>b;b++)a[b].onCompleted();this.observers=[]}},onError:function(a){if(h.call(this),!this.isStopped){var b=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var c=0,d=b.length;d>c;c++)b[c].onError(a);this.observers=[]}},onNext:function(a){if(h.call(this),!this.isStopped){this.value=a;for(var b=this.observers.slice(0),c=0,d=b.length;d>c;c++)b[c].onNext(a)}},dispose:function(){this.isDisposed=!0,this.observers=null,this.value=null,this.exception=null}}),c}(Pb),kc=H.ReplaySubject=function(a){function b(a,b){this.subject=a,this.observer=b}function c(a){var c=new Qb(this.scheduler,a),d=new b(this,c);h.call(this),this._trim(this.scheduler.now()),this.observers.push(c);for(var e=this.q.length,f=0,g=this.q.length;g>f;f++)c.onNext(this.q[f].value);return this.hasError?(e++,c.onError(this.error)):this.isStopped&&(e++,c.onCompleted()),c.ensureActive(e),d}function d(b,d,e){this.bufferSize=null==b?Number.MAX_VALUE:b,this.windowSize=null==d?Number.MAX_VALUE:d,this.scheduler=e||yb,this.q=[],this.observers=[],this.isStopped=!1,this.isDisposed=!1,this.hasError=!1,this.error=null,a.call(this,c)}return b.prototype.dispose=function(){if(this.observer.dispose(),!this.subject.isDisposed){var a=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(a,1)}},gb(d,a),hb(d.prototype,Kb,{hasObservers:function(){return this.observers.length>0},_trim:function(a){for(;this.q.length>this.bufferSize;)this.q.shift();for(;this.q.length>0&&a-this.q[0].interval>this.windowSize;)this.q.shift()},onNext:function(a){var b;if(h.call(this),!this.isStopped){var c=this.scheduler.now();this.q.push({interval:c,value:a}),this._trim(c);for(var d=this.observers.slice(0),e=0,f=d.length;f>e;e++)b=d[e],b.onNext(a),b.ensureActive()}},onError:function(a){var b;if(h.call(this),!this.isStopped){this.isStopped=!0,this.error=a,this.hasError=!0;var c=this.scheduler.now();this._trim(c);for(var d=this.observers.slice(0),e=0,f=d.length;f>e;e++)b=d[e],b.onError(a),b.ensureActive();this.observers=[]}},onCompleted:function(){var a;if(h.call(this),!this.isStopped){this.isStopped=!0;var b=this.scheduler.now();this._trim(b);for(var c=this.observers.slice(0),d=0,e=c.length;e>d;d++)a=c[d],a.onCompleted(),a.ensureActive();this.observers=[]}},dispose:function(){this.isDisposed=!0,this.observers=null}}),d}(Pb);"function"==typeof define&&"object"==typeof define.amd&&define.amd?(B.Rx=H,define(function(){return H})):C&&D?E?(D.exports=H).Rx=H:C.Rx=H:B.Rx=H}).call(this);
@@ -1,2 +1,2 @@
1
- (function(a){function b(){}function c(a){return a}function d(a,b){return R(a,b)}function e(a,b){return a-b}function f(a){return a.toString()}function g(a){throw a}function h(){if(this.isDisposed)throw new Error(D)}function i(a){return"function"!=typeof a.toString&&"string"==typeof(a+"")}function j(a){return a&&"object"==typeof a?N.call(a)==E:!1}function k(a){return"function"==typeof a}function l(a,b,c,d){var e;if(a===b)return 0!==a||1/a==1/b;var f=typeof a,g=typeof b;if(!(a!==a||a&&s[f]||b&&s[g]))return!1;if(null==a||null==b)return a===b;var h=N.call(a),m=N.call(b);if(h==E&&(h=K),m==E&&(m=K),h!=m)return!1;switch(h){case G:case H:return+a==+b;case J:return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case L:case M:return a==String(b)}var n=h==F;if(!n){if(h!=K||!y&&(i(a)||i(b)))return!1;var o=!P&&j(a)?Object:a.constructor,p=!P&&j(b)?Object:b.constructor;if(o!=p&&!(k(o)&&o instanceof o&&k(p)&&p instanceof p))return!1}for(var q=c.length;q--;)if(c[q]==a)return d[q]==b;var r=0;if(e=!0,c.push(a),d.push(b),n){for(q=a.length,r=b.length,e=r==a.length;r--;){var t=b[r];if(!(e=l(a[r],t,c,d)))break}return e}for(var u in b)if(O.call(b,u))return r++,e=O.call(a,u)&&l(a[u],b[u],c,d);if(e)for(var u in a)if(O.call(a,u))return e=--r>-1;return c.pop(),d.pop(),e}function m(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:S.call(a)}function n(a,b){for(var c=new Array(a),d=0;a>d;d++)c[d]=b();return c}function o(a,b){this.scheduler=a,this.disposable=b,this.isDisposed=!1}function p(a,b){return new Qb(function(c){var d=new db,e=new eb;return e.setDisposable(d),d.setDisposable(a.subscribe(c.onNext.bind(c),function(a){var d,f;try{f=b(a)}catch(g){return c.onError(g),void 0}d=new db,e.setDisposable(d),d.setDisposable(f.subscribe(c))},c.onCompleted.bind(c))),e})}function q(a,b){var c=this;return new Qb(function(d){var e=0,f=a.length;return c.subscribe(function(c){if(f>e){var g,h=a[e++];try{g=b(c,h)}catch(i){return d.onError(i),void 0}d.onNext(g)}else d.onCompleted()},d.onError.bind(d),d.onCompleted.bind(d))})}function r(a){return this.select(a).mergeObservable()}var s={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},t=s[typeof window]&&window||this,u=s[typeof exports]&&exports&&!exports.nodeType&&exports,v=s[typeof module]&&module&&!module.nodeType&&module,w=v&&v.exports===u&&u,x=s[typeof global]&&global;!x||x.global!==x&&x.window!==x||(t=x);var y,z={Internals:{}},A=Date.now,B="Sequence contains no elements.",C="Argument out of range",D="Object has been disposed",E="[object Arguments]",F="[object Array]",G="[object Boolean]",H="[object Date]",I="[object Function]",J="[object Number]",K="[object Object]",L="[object RegExp]",M="[object String]",N=Object.prototype.toString,O=Object.prototype.hasOwnProperty,P=N.call(arguments)==E;try{y=!(N.call(document)==K&&!({toString:0}+""))}catch(Q){y=!0}P||(j=function(a){return a&&"object"==typeof a?O.call(a,"callee"):!1}),k(/x/)&&(k=function(a){return"function"==typeof a&&N.call(a)==I});var R=z.Internals.isEqual=function(a,b){return l(a,b,[],[])},S=Array.prototype.slice,T=({}.hasOwnProperty,this.inherits=z.Internals.inherits=function(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c}),U=z.Internals.addProperties=function(a){for(var b=S.call(arguments,1),c=0,d=b.length;d>c;c++){var e=b[c];for(var f in e)a[f]=e[f]}},V=z.Internals.addRef=function(a,b){return new Qb(function(c){return new Z(b.getDisposable(),a.subscribe(c))})},W=function(a,b){this.id=a,this.value=b};W.prototype.compareTo=function(a){var b=this.value.compareTo(a.value);return 0===b&&(b=this.id-a.id),b};var X=z.Internals.PriorityQueue=function(a){this.items=new Array(a),this.length=0},Y=X.prototype;Y.isHigherPriority=function(a,b){return this.items[a].compareTo(this.items[b])<0},Y.percolate=function(a){if(!(a>=this.length||0>a)){var b=a-1>>1;if(!(0>b||b===a)&&this.isHigherPriority(a,b)){var c=this.items[a];this.items[a]=this.items[b],this.items[b]=c,this.percolate(b)}}},Y.heapify=function(b){if(b===a&&(b=0),!(b>=this.length||0>b)){var c=2*b+1,d=2*b+2,e=b;if(c<this.length&&this.isHigherPriority(c,e)&&(e=c),d<this.length&&this.isHigherPriority(d,e)&&(e=d),e!==b){var f=this.items[b];this.items[b]=this.items[e],this.items[e]=f,this.heapify(e)}}},Y.peek=function(){return this.items[0].value},Y.removeAt=function(a){this.items[a]=this.items[--this.length],delete this.items[this.length],this.heapify()},Y.dequeue=function(){var a=this.peek();return this.removeAt(0),a},Y.enqueue=function(a){var b=this.length++;this.items[b]=new W(X.count++,a),this.percolate(b)},Y.remove=function(a){for(var b=0;b<this.length;b++)if(this.items[b].value===a)return this.removeAt(b),!0;return!1},X.count=0;var Z=z.CompositeDisposable=function(){this.disposables=m(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},$=Z.prototype;$.add=function(a){this.isDisposed?a.dispose():(this.disposables.push(a),this.length++)},$.remove=function(a){var b=!1;if(!this.isDisposed){var c=this.disposables.indexOf(a);-1!==c&&(b=!0,this.disposables.splice(c,1),this.length--,a.dispose())}return b},$.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.disposables.slice(0);this.disposables=[],this.length=0;for(var b=0,c=a.length;c>b;b++)a[b].dispose()}},$.clear=function(){var a=this.disposables.slice(0);this.disposables=[],this.length=0;for(var b=0,c=a.length;c>b;b++)a[b].dispose()},$.contains=function(a){return-1!==this.disposables.indexOf(a)},$.toArray=function(){return this.disposables.slice(0)};var _=z.Disposable=function(a){this.isDisposed=!1,this.action=a||b};_.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var ab=_.create=function(a){return new _(a)},bb=_.empty={dispose:b},cb=function(){function a(a){this.isSingle=a,this.isDisposed=!1,this.current=null}var b=a.prototype;return b.getDisposable=function(){return this.current},b.setDisposable=function(a){if(this.current&&this.isSingle)throw new Error("Disposable has already been assigned");var b,c=this.isDisposed;c||(b=this.current,this.current=a),b&&b.dispose(),c&&a&&a.dispose()},b.dispose=function(){var a;this.isDisposed||(this.isDisposed=!0,a=this.current,this.current=null),a&&a.dispose()},a}(),db=z.SingleAssignmentDisposable=function(a){function b(){a.call(this,!0)}return T(b,a),b}(cb),eb=z.SerialDisposable=function(a){function b(){a.call(this,!1)}return T(b,a),b}(cb),fb=z.RefCountDisposable=function(){function a(a){this.disposable=a,this.disposable.count++,this.isInnerDisposed=!1}function b(a){this.underlyingDisposable=a,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return a.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()))},b.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},b.prototype.getDisposable=function(){return this.isDisposed?bb:new a(this)},b}();o.prototype.dispose=function(){var a=this;this.scheduler.schedule(function(){a.isDisposed||(a.isDisposed=!0,a.disposable.dispose())})};var gb=z.Internals.ScheduledItem=function(a,b,c,d,f){this.scheduler=a,this.state=b,this.action=c,this.dueTime=d,this.comparer=f||e,this.disposable=new db};gb.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},gb.prototype.compareTo=function(a){return this.comparer(this.dueTime,a.dueTime)},gb.prototype.isCancelled=function(){return this.disposable.isDisposed},gb.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var hb,ib=z.Scheduler=function(){function a(a,b,c,d){this.now=a,this._schedule=b,this._scheduleRelative=c,this._scheduleAbsolute=d}function b(a,b){var c=b.first,d=b.second,e=new Z,f=function(b){d(b,function(b){var c=!1,d=!1,g=a.scheduleWithState(b,function(a,b){return c?e.remove(g):d=!0,f(b),bb});d||(e.add(g),c=!0)})};return f(c),e}function c(a,b,c){var d=b.first,e=b.second,f=new Z,g=function(b){e(b,function(b,d){var e=!1,h=!1,i=a[c].call(a,b,d,function(a,b){return e?f.remove(i):h=!0,g(b),bb});h||(f.add(i),e=!0)})};return g(d),f}function d(a,b){return b(),bb}var e=a.prototype;return e.catchException=e["catch"]=function(a){return new nb(this,a)},e.schedulePeriodic=function(a,b){return this.schedulePeriodicWithState(null,a,function(){b()})},e.schedulePeriodicWithState=function(a,b,c){var d=a,e=setInterval(function(){d=c(d)},b);return ab(function(){clearInterval(e)})},e.schedule=function(a){return this._schedule(a,d)},e.scheduleWithState=function(a,b){return this._schedule(a,b)},e.scheduleWithRelative=function(a,b){return this._scheduleRelative(b,a,d)},e.scheduleWithRelativeAndState=function(a,b,c){return this._scheduleRelative(a,b,c)},e.scheduleWithAbsolute=function(a,b){return this._scheduleAbsolute(b,a,d)},e.scheduleWithAbsoluteAndState=function(a,b,c){return this._scheduleAbsolute(a,b,c)},e.scheduleRecursive=function(a){return this.scheduleRecursiveWithState(a,function(a,b){a(function(){b(a)})})},e.scheduleRecursiveWithState=function(a,c){return this.scheduleWithState({first:a,second:c},function(a,c){return b(a,c)})},e.scheduleRecursiveWithRelative=function(a,b){return this.scheduleRecursiveWithRelativeAndState(b,a,function(a,b){a(function(c){b(a,c)})})},e.scheduleRecursiveWithRelativeAndState=function(a,b,d){return this._scheduleRelative({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithRelativeAndState")})},e.scheduleRecursiveWithAbsolute=function(a,b){return this.scheduleRecursiveWithAbsoluteAndState(b,a,function(a,b){a(function(c){b(a,c)})})},e.scheduleRecursiveWithAbsoluteAndState=function(a,b,d){return this._scheduleAbsolute({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithAbsoluteAndState")})},a.now=A,a.normalize=function(a){return 0>a&&(a=0),a},a}(),jb=ib.normalize,kb=(z.Internals.SchedulePeriodicRecursive=function(){function a(a,b){b(0,this._period);try{this._state=this._action(this._state)}catch(c){throw this._cancel.dispose(),c}}function b(a,b,c,d){this._scheduler=a,this._state=b,this._period=c,this._action=d}return b.prototype.start=function(){var b=new db;return this._cancel=b,b.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,a.bind(this))),b},b}(),ib.immediate=function(){function a(a,b){return b(this,a)}function b(a,b,c){for(var d=jb(d);d-this.now()>0;);return c(this,a)}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new ib(A,a,b,c)}()),lb=ib.currentThread=function(){function a(a){for(var b;a.length>0;)if(b=a.dequeue(),!b.isCancelled()){for(;b.dueTime-ib.now()>0;);b.isCancelled()||b.invoke()}}function b(a,b){return this.scheduleWithRelativeAndState(a,0,b)}function c(b,c,d){var f=this.now()+ib.normalize(c),g=new gb(this,b,d,f);if(e)e.enqueue(g);else{e=new X(4),e.enqueue(g);try{a(e)}catch(h){throw h}finally{e=null}}return g.disposable}function d(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}var e,f=new ib(A,b,c,d);return f.scheduleRequired=function(){return null===e},f.ensureTrampoline=function(a){return null===e?this.schedule(a):a()},f}(),mb=b;!function(){function a(){if(!t.postMessage||t.importScripts)return!1;var a=!1,b=t.onmessage;return t.onmessage=function(){a=!0},t.postMessage("","*"),t.onmessage=b,a}function b(a){for(var b=0,c=a.length;c>b;b++){var d=a[b].target.getAttribute("drainQueue");h[d](),delete h[d]}}function c(a){if("string"==typeof a.data&&a.data.substring(0,l.length)===l){var b=a.data.substring(l.length),c=m[b];c(),delete m[b]}}var d=RegExp("^"+String(N).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),e="function"==typeof(e=x&&w&&x.setImmediate)&&!d.test(e)&&e,f="function"==typeof(f=x&&w&&x.clearImmediate)&&!d.test(f)&&f,g=t.MutationObserver||t.WebKitMutationObserver;if(g){var h={},i=0,j=new g(b),k=document.createElement("div");j.observe(k,{attributes:!0}),t.addEventListener("unload",function(){j.disconnect(),j=null}),hb=function(a){var b=i++;return h[b]=a,k.setAttribute("drainQueue",b),b},mb=function(a){delete h[a]}}else if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))hb=process.nextTick;else if("function"==typeof e)hb=e,mb=f;else if(a()){var l="ms.rx.schedule"+Math.random(),m={},n=0;t.addEventListener?t.addEventListener("message",c,!1):t.attachEvent("onmessage",c,!1),hb=function(a){var b=n++;m[b]=a,t.postMessage(l+b,"*")}}else if(t.MessageChannel){var o=new t.MessageChannel,p={},q=0;o.port1.onmessage=function(a){var b=a.data,c=p[b];c(),delete p[b]},hb=function(a){var b=q++;p[b]=a,o.port2.postMessage(b)}}else"document"in t&&"onreadystatechange"in t.document.createElement("script")?hb=function(a){var b=t.document.createElement("script");b.onreadystatechange=function(){a(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},t.document.documentElement.appendChild(b)}:(hb=function(a){return setTimeout(a,0)},mb=clearTimeout)}();var nb=(ib.timeout=function(){function a(a,b){var c=this,d=new db,e=hb(function(){d.isDisposed||d.setDisposable(b(c,a))});return new Z(d,ab(function(){mb(e)}))}function b(a,b,c){var d=this,e=ib.normalize(b);if(0===e)return d.scheduleWithState(a,c);var f=new db,g=setTimeout(function(){f.isDisposed||f.setDisposable(c(d,a))},e);return new Z(f,ab(function(){clearTimeout(g)}))}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new ib(A,a,b,c)}(),function(a){function b(){return this._scheduler.now()}function c(a,b){return this._scheduler.scheduleWithState(a,this._wrap(b))}function d(a,b,c){return this._scheduler.scheduleWithRelativeAndState(a,b,this._wrap(c))}function e(a,b,c){return this._scheduler.scheduleWithAbsoluteAndState(a,b,this._wrap(c))}function f(f,g){this._scheduler=f,this._handler=g,this._recursiveOriginal=null,this._recursiveWrapper=null,a.call(this,b,c,d,e)}return T(f,a),f.prototype._clone=function(a){return new f(a,this._handler)},f.prototype._wrap=function(a){var b=this;return function(c,d){try{return a(b._getRecursiveWrapper(c),d)}catch(e){if(!b._handler(e))throw e;return bb}}},f.prototype._getRecursiveWrapper=function(a){if(this._recursiveOriginal!==a){this._recursiveOriginal=a;var b=this._clone(a);b._recursiveOriginal=a,b._recursiveWrapper=b,this._recursiveWrapper=b}return this._recursiveWrapper},f.prototype.schedulePeriodicWithState=function(a,b,c){var d=this,e=!1,f=new db;return f.setDisposable(this._scheduler.schedulePeriodicWithState(a,b,function(a){if(e)return null;try{return c(a)}catch(b){if(e=!0,!d._handler(b))throw b;return f.dispose(),null}})),f},f}(ib)),ob=z.Notification=function(){function a(a,b){this.hasValue=null==b?!1:b,this.kind=a}var b=a.prototype;return b.accept=function(a,b,c){return 1===arguments.length&&"object"==typeof a?this._acceptObservable(a):this._accept(a,b,c)},b.toObservable=function(a){var b=this;return a||(a=kb),new Qb(function(c){return a.schedule(function(){b._acceptObservable(c),"N"===b.kind&&c.onCompleted()})})},a}(),pb=ob.createOnNext=function(){function a(a){return a(this.value)}function b(a){return a.onNext(this.value)}function c(){return"OnNext("+this.value+")"}return function(d){var e=new ob("N",!0);return e.value=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),qb=ob.createOnError=function(){function a(a,b){return b(this.exception)}function b(a){return a.onError(this.exception)}function c(){return"OnError("+this.exception+")"}return function(d){var e=new ob("E");return e.exception=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),rb=ob.createOnCompleted=function(){function a(a,b,c){return c()}function b(a){return a.onCompleted()}function c(){return"OnCompleted()"}return function(){var d=new ob("C");return d._accept=a,d._acceptObservable=b,d.toString=c,d}}(),sb=z.Internals.Enumerator=function(a,b){this.moveNext=a,this.getCurrent=b},tb=sb.create=function(a,b){var c=!1;return new sb(function(){if(c)return!1;var b=a();return b||(c=!0),b},function(){return b()})},ub=z.Internals.Enumerable=function(a){this.getEnumerator=a};ub.prototype.concat=function(){var a=this;return new Qb(function(b){var c,d=a.getEnumerator(),e=new eb,f=kb.scheduleRecursive(function(a){var f,g;if(!c){try{g=d.moveNext(),g&&(f=d.getCurrent())}catch(h){return b.onError(h),void 0}if(!g)return b.onCompleted(),void 0;var i=new db;e.setDisposable(i),i.setDisposable(f.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){a()}))}});return new Z(e,f,ab(function(){c=!0}))})},ub.prototype.catchException=function(){var a=this;return new Qb(function(b){var c,d,e=a.getEnumerator(),f=new eb,g=kb.scheduleRecursive(function(a){var g,h;if(!c){try{h=e.moveNext(),h&&(g=e.getCurrent())}catch(i){return b.onError(i),void 0}if(!h)return d?b.onError(d):b.onCompleted(),void 0;var j=new db;f.setDisposable(j),j.setDisposable(g.subscribe(b.onNext.bind(b),function(b){d=b,a()},b.onCompleted.bind(b)))}});return new Z(f,g,ab(function(){c=!0}))})};var vb=ub.repeat=function(a,b){return 1===arguments.length&&(b=-1),new ub(function(){var c,d=b;return tb(function(){return 0===d?!1:(d>0&&d--,c=a,!0)},function(){return c})})},wb=ub.forEach=function(a,b,d){return b||(b=c),new ub(function(){var c,e=-1;return tb(function(){return++e<a.length?(c=b.call(d,a[e],e,a),!0):!1},function(){return c})})},xb=z.Observer=function(){};xb.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},xb.prototype.asObserver=function(){return new Bb(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},xb.prototype.checked=function(){return new Cb(this)};var yb=xb.create=function(a,c,d){return a||(a=b),c||(c=g),d||(d=b),new Bb(a,c,d)};xb.fromNotifier=function(a){return new Bb(function(b){return a(pb(b))},function(b){return a(qb(b))},function(){return a(rb())})},xb.notifyOn=function(a){return new Eb(a,this)};var zb,Ab=z.Internals.AbstractObserver=function(a){function b(){this.isStopped=!1,a.call(this)}return T(b,a),b.prototype.onNext=function(a){this.isStopped||this.next(a)},b.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.error(a))},b.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},b.prototype.dispose=function(){this.isStopped=!0},b.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.error(a),!0)},b}(xb),Bb=z.AnonymousObserver=function(a){function b(b,c,d){a.call(this),this._onNext=b,this._onError=c,this._onCompleted=d}return T(b,a),b.prototype.next=function(a){this._onNext(a)},b.prototype.error=function(a){this._onError(a)},b.prototype.completed=function(){this._onCompleted()},b}(Ab),Cb=function(a){function b(b){a.call(this),this._observer=b,this._state=0}T(b,a);var c=b.prototype;return c.onNext=function(a){this.checkAccess();try{this._observer.onNext(a)}catch(b){throw b}finally{this._state=0}},c.onError=function(a){this.checkAccess();try{this._observer.onError(a)}catch(b){throw b}finally{this._state=2}},c.onCompleted=function(){this.checkAccess();try{this._observer.onCompleted()}catch(a){throw a}finally{this._state=2}},c.checkAccess=function(){if(1===this._state)throw new Error("Re-entrancy detected");if(2===this._state)throw new Error("Observer completed");0===this._state&&(this._state=1)},b}(xb),Db=z.Internals.ScheduledObserver=function(a){function b(b,c){a.call(this),this.scheduler=b,this.observer=c,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new eb}return T(b,a),b.prototype.next=function(a){var b=this;this.queue.push(function(){b.observer.onNext(a)})},b.prototype.error=function(a){var b=this;this.queue.push(function(){b.observer.onError(a)})},b.prototype.completed=function(){var a=this;this.queue.push(function(){a.observer.onCompleted()})},b.prototype.ensureActive=function(){var a=!1,b=this;!this.hasFaulted&&this.queue.length>0&&(a=!this.isAcquired,this.isAcquired=!0),a&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(a){var c;if(!(b.queue.length>0))return b.isAcquired=!1,void 0;c=b.queue.shift();try{c()}catch(d){throw b.queue=[],b.hasFaulted=!0,d}a()}))},b.prototype.dispose=function(){a.prototype.dispose.call(this),this.disposable.dispose()},b}(Ab),Eb=function(a){function b(){a.apply(this,arguments)}return T(b,a),b.prototype.next=function(b){a.prototype.next.call(this,b),this.ensureActive()},b.prototype.error=function(b){a.prototype.error.call(this,b),this.ensureActive()},b.prototype.completed=function(){a.prototype.completed.call(this),this.ensureActive()},b}(Db),Fb=z.Observable=function(){function a(a){this._subscribe=a}return zb=a.prototype,zb.finalValue=function(){var a=this;return new Qb(function(b){var c,d=!1;return a.subscribe(function(a){d=!0,c=a},b.onError.bind(b),function(){d?(b.onNext(c),b.onCompleted()):b.onError(new Error(B))})})},zb.subscribe=zb.forEach=function(a,b,c){var d;return d="object"==typeof a?a:yb(a,b,c),this._subscribe(d)},zb.toArray=function(){function a(a,b){var c=a.slice(0);return c.push(b),c}return this.scan([],a).startWith([]).finalValue()},a}();zb.observeOn=function(a){var b=this;return new Qb(function(c){return b.subscribe(new Eb(a,c))})},zb.subscribeOn=function(a){var b=this;return new Qb(function(c){var d=new db,e=new eb;return e.setDisposable(d),d.setDisposable(a.schedule(function(){e.setDisposable(new o(a,b.subscribe(c)))})),e})},Fb.create=Fb.createWithDisposable=function(a){return new Qb(a)};var Gb=(Fb.defer=function(a){return new Qb(function(b){var c;try{c=a()}catch(d){return Kb(d).subscribe(b)}return c.subscribe(b)})},Fb.empty=function(a){return a||(a=kb),new Qb(function(b){return a.schedule(function(){b.onCompleted()})})}),Hb=Fb.fromArray=function(a,b){return b||(b=lb),new Qb(function(c){var d=0;return b.scheduleRecursive(function(b){d<a.length?(c.onNext(a[d++]),b()):c.onCompleted()})})};Fb.generate=function(a,b,c,d,e){return e||(e=lb),new Qb(function(f){var g=!0,h=a;return e.scheduleRecursive(function(a){var e,i;try{g?g=!1:h=c(h),e=b(h),e&&(i=d(h))}catch(j){return f.onError(j),void 0}e?(f.onNext(i),a()):f.onCompleted()})})};var Ib=Fb.never=function(){return new Qb(function(){return bb})};Fb.range=function(a,b,c){return c||(c=lb),new Qb(function(d){return c.scheduleRecursiveWithState(0,function(c,e){b>c?(d.onNext(a+c),e(c+1)):d.onCompleted()})})},Fb.repeat=function(a,b,c){return c||(c=lb),null==b&&(b=-1),Jb(a,c).repeat(b)};var Jb=Fb["return"]=Fb.returnValue=function(a,b){return b||(b=kb),new Qb(function(c){return b.schedule(function(){c.onNext(a),c.onCompleted()})})},Kb=Fb["throw"]=Fb.throwException=function(a,b){return b||(b=kb),new Qb(function(c){return b.schedule(function(){c.onError(a)})})};Fb.using=function(a,b){return new Qb(function(c){var d,e,f=bb;try{d=a(),d&&(f=d),e=b(d)}catch(g){return new Z(Kb(g).subscribe(c),f)}return new Z(e.subscribe(c),f)})},zb.amb=function(a){var b=this;return new Qb(function(c){function d(){f||(f=g,j.dispose())}function e(){f||(f=h,i.dispose())}var f,g="L",h="R",i=new db,j=new db;return i.setDisposable(b.subscribe(function(a){d(),f===g&&c.onNext(a)},function(a){d(),f===g&&c.onError(a)},function(){d(),f===g&&c.onCompleted()})),j.setDisposable(a.subscribe(function(a){e(),f===h&&c.onNext(a)},function(a){e(),f===h&&c.onError(a)},function(){e(),f===h&&c.onCompleted()})),new Z(i,j)})},Fb.amb=function(){function a(a,b){return a.amb(b)}for(var b=Ib(),c=m(arguments,0),d=0,e=c.length;e>d;d++)b=a(b,c[d]);return b},zb["catch"]=zb.catchException=function(a){return"function"==typeof a?p(this,a):Lb([this,a])};var Lb=Fb.catchException=Fb["catch"]=function(){var a=m(arguments,0);return wb(a).catchException()};zb.combineLatest=function(){var a=S.call(arguments);return Array.isArray(a[0])?a[0].unshift(this):a.unshift(this),Mb.apply(this,a)};var Mb=Fb.combineLatest=function(){var a=S.call(arguments),b=a.pop();return Array.isArray(a[0])&&(a=a[0]),new Qb(function(d){function e(a){var e;if(i[a]=!0,j||(j=i.every(c))){try{e=b.apply(null,l)}catch(f){return d.onError(f),void 0}d.onNext(e)}else k.filter(function(b,c){return c!==a}).every(c)&&d.onCompleted()}function f(a){k[a]=!0,k.every(c)&&d.onCompleted()}for(var g=function(){return!1},h=a.length,i=n(h,g),j=!1,k=n(h,g),l=new Array(h),m=new Array(h),o=0;h>o;o++)!function(b){m[b]=new db,m[b].setDisposable(a[b].subscribe(function(a){l[b]=a,e(b)},d.onError.bind(d),function(){f(b)}))}(o);return new Z(m)})};zb.concat=function(){var a=S.call(arguments,0);return a.unshift(this),Nb.apply(this,a)};var Nb=Fb.concat=function(){var a=m(arguments,0);return wb(a).concat()};zb.concatObservable=zb.concatAll=function(){return this.merge(1)},zb.merge=function(a){if("number"!=typeof a)return Ob(this,a);var b=this;return new Qb(function(c){var d=0,e=new Z,f=!1,g=[],h=function(a){var b=new db;e.add(b),b.setDisposable(a.subscribe(c.onNext.bind(c),c.onError.bind(c),function(){var a;e.remove(b),g.length>0?(a=g.shift(),h(a)):(d--,f&&0===d&&c.onCompleted())}))};return e.add(b.subscribe(function(b){a>d?(d++,h(b)):g.push(b)},c.onError.bind(c),function(){f=!0,0===d&&c.onCompleted()})),e})};var Ob=Fb.merge=function(){var a,b;return arguments[0]?arguments[0].now?(a=arguments[0],b=S.call(arguments,1)):(a=kb,b=S.call(arguments,0)):(a=kb,b=S.call(arguments,1)),Array.isArray(b[0])&&(b=b[0]),Hb(b,a).mergeObservable()};zb.mergeObservable=zb.mergeAll=function(){var a=this;return new Qb(function(b){var c=new Z,d=!1,e=new db;return c.add(e),e.setDisposable(a.subscribe(function(a){var e=new db;c.add(e),e.setDisposable(a.subscribe(function(a){b.onNext(a)},b.onError.bind(b),function(){c.remove(e),d&&1===c.length&&b.onCompleted()}))},b.onError.bind(b),function(){d=!0,1===c.length&&b.onCompleted()})),c})},zb.onErrorResumeNext=function(a){if(!a)throw new Error("Second observable is required");return Pb([this,a])};var Pb=Fb.onErrorResumeNext=function(){var a=m(arguments,0);return new Qb(function(b){var c=0,d=new eb,e=kb.scheduleRecursive(function(e){var f,g;c<a.length?(f=a[c++],g=new db,d.setDisposable(g),g.setDisposable(f.subscribe(b.onNext.bind(b),function(){e()},function(){e()}))):b.onCompleted()});return new Z(d,e)})};zb.skipUntil=function(a){var b=this;return new Qb(function(c){var d=!1,e=new Z(b.subscribe(function(a){d&&c.onNext(a)},c.onError.bind(c),function(){d&&c.onCompleted()})),f=new db;return e.add(f),f.setDisposable(a.subscribe(function(){d=!0,f.dispose()},c.onError.bind(c),function(){f.dispose()})),e})},zb["switch"]=zb.switchLatest=function(){var a=this;return new Qb(function(b){var c=!1,d=new eb,e=!1,f=0,g=a.subscribe(function(a){var g=new db,h=++f;c=!0,d.setDisposable(g),g.setDisposable(a.subscribe(function(a){f===h&&b.onNext(a)},function(a){f===h&&b.onError(a)},function(){f===h&&(c=!1,e&&b.onCompleted())}))},b.onError.bind(b),function(){e=!0,c||b.onCompleted()});return new Z(g,d)})},zb.takeUntil=function(a){var c=this;return new Qb(function(d){return new Z(c.subscribe(d),a.subscribe(d.onCompleted.bind(d),d.onError.bind(d),b))})},zb.zip=function(){if(Array.isArray(arguments[0]))return q.apply(this,arguments);var a=this,b=S.call(arguments),d=b.pop();return b.unshift(a),new Qb(function(e){function f(a){i[a]=!0,i.every(function(a){return a})&&e.onCompleted()}for(var g=b.length,h=n(g,function(){return[]}),i=n(g,function(){return!1}),j=function(b){var f,g;if(h.every(function(a){return a.length>0})){try{g=h.map(function(a){return a.shift()}),f=d.apply(a,g)}catch(j){return e.onError(j),void 0}e.onNext(f)}else i.filter(function(a,c){return c!==b}).every(c)&&e.onCompleted()},k=new Array(g),l=0;g>l;l++)!function(a){k[a]=new db,k[a].setDisposable(b[a].subscribe(function(b){h[a].push(b),j(a)},e.onError.bind(e),function(){f(a)}))}(l);return new Z(k)})},Fb.zip=function(){var a=S.call(arguments,0),b=a.shift();return b.zip.apply(b,a)},Fb.zipArray=function(){var a=m(arguments,0);return new Qb(function(b){function d(a){if(g.every(function(a){return a.length>0})){var d=g.map(function(a){return a.shift()});b.onNext(d)}else if(h.filter(function(b,c){return c!==a}).every(c))return b.onCompleted(),void 0}function e(a){return h[a]=!0,h.every(c)?(b.onCompleted(),void 0):void 0}for(var f=a.length,g=n(f,function(){return[]}),h=n(f,function(){return!1}),i=new Array(f),j=0;f>j;j++)!function(c){i[c]=new db,i[c].setDisposable(a[c].subscribe(function(a){g[c].push(a),d(c)},b.onError.bind(b),function(){e(c)}))}(j);var k=new Z(i);return k.add(ab(function(){for(var a=0,b=g.length;b>a;a++)g[a]=[]})),k})},zb.asObservable=function(){var a=this;return new Qb(function(b){return a.subscribe(b)})},zb.bufferWithCount=function(a,b){return 1===arguments.length&&(b=a),this.windowWithCount(a,b).selectMany(function(a){return a.toArray()}).where(function(a){return a.length>0})},zb.dematerialize=function(){var a=this;return new Qb(function(b){return a.subscribe(function(a){return a.accept(b)},b.onError.bind(b),b.onCompleted.bind(b))})},zb.distinctUntilChanged=function(a,b){var e=this;return a||(a=c),b||(b=d),new Qb(function(c){var d,f=!1;return e.subscribe(function(e){var g,h=!1;try{g=a(e)}catch(i){return c.onError(i),void 0}if(f)try{h=b(d,g)}catch(i){return c.onError(i),void 0}f&&h||(f=!0,d=g,c.onNext(e))},c.onError.bind(c),c.onCompleted.bind(c))})},zb["do"]=zb.doAction=function(a,b,c){var d,e=this;return"function"==typeof a?d=a:(d=a.onNext.bind(a),b=a.onError.bind(a),c=a.onCompleted.bind(a)),new Qb(function(a){return e.subscribe(function(b){try{d(b)}catch(c){a.onError(c)}a.onNext(b)},function(c){if(b){try{b(c)}catch(d){a.onError(d)}a.onError(c)}else a.onError(c)},function(){if(c){try{c()}catch(b){a.onError(b)}a.onCompleted()}else a.onCompleted()})})},zb["finally"]=zb.finallyAction=function(a){var b=this;return new Qb(function(c){var d=b.subscribe(c);return ab(function(){try{d.dispose()}catch(b){throw b}finally{a()}})})},zb.ignoreElements=function(){var a=this;return new Qb(function(c){return a.subscribe(b,c.onError.bind(c),c.onCompleted.bind(c))})},zb.materialize=function(){var a=this;return new Qb(function(b){return a.subscribe(function(a){b.onNext(pb(a))},function(a){b.onNext(qb(a)),b.onCompleted()},function(){b.onNext(rb()),b.onCompleted()})})},zb.repeat=function(a){return vb(this,a).concat()},zb.retry=function(a){return vb(this,a).catchException()},zb.scan=function(){var a,b,c=!1,d=this;return 2===arguments.length?(c=!0,a=arguments[0],b=arguments[1]):b=arguments[0],new Qb(function(e){var f,g,h;return d.subscribe(function(d){try{h||(h=!0),f?g=b(g,d):(g=c?b(a,d):d,f=!0)}catch(i){return e.onError(i),void 0}e.onNext(g)},e.onError.bind(e),function(){!h&&c&&e.onNext(a),e.onCompleted()})})},zb.skipLast=function(a){var b=this;return new Qb(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&c.onNext(d.shift())},c.onError.bind(c),c.onCompleted.bind(c))})},zb.startWith=function(){var a,b,c=0;return arguments.length&&"now"in Object(arguments[0])?(b=arguments[0],c=1):b=kb,a=S.call(arguments,c),wb([Hb(a,b),this]).concat()},zb.takeLast=function(a,b){return this.takeLastBuffer(a).selectMany(function(a){return Hb(a,b)})},zb.takeLastBuffer=function(a){var b=this;return new Qb(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},c.onError.bind(c),function(){c.onNext(d),c.onCompleted()})})},zb.windowWithCount=function(a,b){var c=this;if(0>=a)throw new Error(C);if(1===arguments.length&&(b=a),0>=b)throw new Error(C);return new Qb(function(d){var e=new db,f=new fb(e),g=0,h=[],i=function(){var a=new Ub;h.push(a),d.onNext(V(a,f))};return i(),e.setDisposable(c.subscribe(function(c){for(var d,e=0,f=h.length;f>e;e++)h[e].onNext(c);var j=g-a+1;j>=0&&j%b===0&&(d=h.shift(),d.onCompleted()),g++,g%b===0&&i()},function(a){for(;h.length>0;)h.shift().onError(a);d.onError(a)},function(){for(;h.length>0;)h.shift().onCompleted();d.onCompleted()})),f})},zb.defaultIfEmpty=function(b){var c=this;return b===a&&(b=null),new Qb(function(a){var d=!1;return c.subscribe(function(b){d=!0,a.onNext(b)},a.onError.bind(a),function(){d||a.onNext(b),a.onCompleted()})})},zb.distinct=function(a,b){var d=this;return a||(a=c),b||(b=f),new Qb(function(c){var e={};return d.subscribe(function(d){var f,g,h,i=!1;
2
- try{f=a(d),g=b(f)}catch(j){return c.onError(j),void 0}for(h in e)if(g===h){i=!0;break}i||(e[g]=null,c.onNext(d))},c.onError.bind(c),c.onCompleted.bind(c))})},zb.groupBy=function(a,b,c){return this.groupByUntil(a,b,function(){return Ib()},c)},zb.groupByUntil=function(a,d,e,g){var h=this;return d||(d=c),g||(g=f),new Qb(function(c){var f={},i=new Z,j=new fb(i);return i.add(h.subscribe(function(h){var k,l,m,n,o,p,q,r,s,t;try{p=a(h),q=g(p)}catch(u){for(t in f)f[t].onError(u);return c.onError(u),void 0}n=!1;try{s=f[q],s||(s=new Ub,f[q]=s,n=!0)}catch(u){for(t in f)f[t].onError(u);return c.onError(u),void 0}if(n){o=new Sb(p,s,j),l=new Sb(p,s);try{k=e(l)}catch(u){for(t in f)f[t].onError(u);return c.onError(u),void 0}c.onNext(o),r=new db,i.add(r);var v=function(){q in f&&(delete f[q],s.onCompleted()),i.remove(r)};r.setDisposable(k.take(1).subscribe(b,function(a){for(t in f)f[t].onError(a);c.onError(a)},function(){v()}))}try{m=d(h)}catch(u){for(t in f)f[t].onError(u);return c.onError(u),void 0}s.onNext(m)},function(a){for(var b in f)f[b].onError(a);c.onError(a)},function(){for(var a in f)f[a].onCompleted();c.onCompleted()})),j})},zb.select=zb.map=function(a,b){var c=this;return new Qb(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return d.onError(h),void 0}d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},zb.pluck=function(a){return this.select(function(b){return b[a]})},zb.selectMany=zb.flatMap=function(a,b){return b?this.selectMany(function(c){return a(c).select(function(a){return b(c,a)})}):"function"==typeof a?r.call(this,a):r.call(this,function(){return a})},zb.selectSwitch=zb.flatMapLatest=function(a,b){return this.select(a,b).switchLatest()},zb.skip=function(a){if(0>a)throw new Error(C);var b=this;return new Qb(function(c){var d=a;return b.subscribe(function(a){0>=d?c.onNext(a):d--},c.onError.bind(c),c.onCompleted.bind(c))})},zb.skipWhile=function(a,b){var c=this;return new Qb(function(d){var e=0,f=!1;return c.subscribe(function(g){if(!f)try{f=!a.call(b,g,e++,c)}catch(h){return d.onError(h),void 0}f&&d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},zb.take=function(a,b){if(0>a)throw new Error(C);if(0===a)return Gb(b);var c=this;return new Qb(function(b){var d=a;return c.subscribe(function(a){d>0&&(d--,b.onNext(a),0===d&&b.onCompleted())},b.onError.bind(b),b.onCompleted.bind(b))})},zb.takeWhile=function(a,b){var c=this;return new Qb(function(d){var e=0,f=!0;return c.subscribe(function(g){if(f){try{f=a.call(b,g,e++,c)}catch(h){return d.onError(h),void 0}f?d.onNext(g):d.onCompleted()}},d.onError.bind(d),d.onCompleted.bind(d))})},zb.where=zb.filter=function(a,b){var c=this;return new Qb(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return d.onError(h),void 0}g&&d.onNext(f)},d.onError.bind(d),d.onCompleted.bind(d))})};var Qb=z.Internals.AnonymousObservable=function(a){function b(a){return"undefined"==typeof a?a=bb:"function"==typeof a&&(a=ab(a)),a}function c(d){function e(a){var c=new Rb(a);if(lb.scheduleRequired())lb.schedule(function(){try{c.setDisposable(b(d(c)))}catch(a){if(!c.fail(a))throw a}});else try{c.setDisposable(b(d(c)))}catch(e){if(!c.fail(e))throw e}return c}return this instanceof c?(a.call(this,e),void 0):new c(d)}return T(c,a),c}(Fb),Rb=function(a){function b(b){a.call(this),this.observer=b,this.m=new db}T(b,a);var c=b.prototype;return c.next=function(a){var b=!1;try{this.observer.onNext(a),b=!0}catch(c){throw c}finally{b||this.dispose()}},c.error=function(a){try{this.observer.onError(a)}catch(b){throw b}finally{this.dispose()}},c.completed=function(){try{this.observer.onCompleted()}catch(a){throw a}finally{this.dispose()}},c.setDisposable=function(a){this.m.setDisposable(a)},c.getDisposable=function(){return this.m.getDisposable()},c.disposable=function(a){return arguments.length?this.getDisposable():setDisposable(a)},c.dispose=function(){a.prototype.dispose.call(this),this.m.dispose()},b}(Ab),Sb=function(a){function b(a){return this.underlyingObservable.subscribe(a)}function c(c,d,e){a.call(this,b),this.key=c,this.underlyingObservable=e?new Qb(function(a){return new Z(e.getDisposable(),d.subscribe(a))}):d}return T(c,a),c}(Fb),Tb=function(a,b){this.subject=a,this.observer=b};Tb.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var a=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(a,1),this.observer=null}};var Ub=z.Subject=function(a){function b(a){return h.call(this),this.isStopped?this.exception?(a.onError(this.exception),bb):(a.onCompleted(),bb):(this.observers.push(a),new Tb(this,a))}function c(){a.call(this,b),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return T(c,a),U(c.prototype,xb,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(h.call(this),!this.isStopped){var a=this.observers.slice(0);this.isStopped=!0;for(var b=0,c=a.length;c>b;b++)a[b].onCompleted();this.observers=[]}},onError:function(a){if(h.call(this),!this.isStopped){var b=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var c=0,d=b.length;d>c;c++)b[c].onError(a);this.observers=[]}},onNext:function(a){if(h.call(this),!this.isStopped)for(var b=this.observers.slice(0),c=0,d=b.length;d>c;c++)b[c].onNext(a)},dispose:function(){this.isDisposed=!0,this.observers=null}}),c.create=function(a,b){return new Vb(a,b)},c}(Fb),Vb=(z.AsyncSubject=function(a){function b(a){if(h.call(this),!this.isStopped)return this.observers.push(a),new Tb(this,a);var b=this.exception,c=this.hasValue,d=this.value;return b?a.onError(b):c?(a.onNext(d),a.onCompleted()):a.onCompleted(),bb}function c(){a.call(this,b),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return T(c,a),U(c.prototype,xb,{hasObservers:function(){return h.call(this),this.observers.length>0},onCompleted:function(){var a,b,c;if(h.call(this),!this.isStopped){this.isStopped=!0;var d=this.observers.slice(0),e=this.value,f=this.hasValue;if(f)for(b=0,c=d.length;c>b;b++)a=d[b],a.onNext(e),a.onCompleted();else for(b=0,c=d.length;c>b;b++)d[b].onCompleted();this.observers=[]}},onError:function(a){if(h.call(this),!this.isStopped){var b=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var c=0,d=b.length;d>c;c++)b[c].onError(a);this.observers=[]}},onNext:function(a){h.call(this),this.isStopped||(this.value=a,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),c}(Fb),function(a){function b(a){return this.observable.subscribe(a)}function c(c,d){a.call(this,b),this.observer=c,this.observable=d}return T(c,a),U(c.prototype,xb,{onCompleted:function(){this.observer.onCompleted()},onError:function(a){this.observer.onError(a)},onNext:function(a){this.observer.onNext(a)}}),c}(Fb));"function"==typeof define&&"object"==typeof define.amd&&define.amd?(t.Rx=z,define(function(){return z})):u&&v?w?(v.exports=z).Rx=z:u.Rx=z:t.Rx=z}).call(this);
1
+ (function(a){function b(){}function c(a){return a}function d(a,b){return bb(a,b)}function e(a,b){return a-b}function f(a){return a.toString()}function g(a){throw a}function h(a){return"function"==typeof a.then}function i(){if(this.isDisposed)throw new Error(I)}function j(a){var b=typeof a;return a&&("function"==b||"object"==b)||!1}function k(a){var b=[];if(!j(a))return b;ab.nonEnumArgs&&a.length&&o(a)&&(a=cb.call(a));var c=ab.enumPrototypes&&"function"==typeof a,d=ab.enumErrorProps&&(a===W||a instanceof Error);for(var e in a)c&&"prototype"==e||d&&("message"==e||"name"==e)||b.push(e);if(ab.nonEnumShadows&&a!==X){var f=a.constructor,g=-1,h=$.length;if(a===(f&&f.prototype))var i=a===stringProto?S:a===W?N:T.call(a),k=_[i];for(;++g<h;)e=$[g],k&&k[e]||!U.call(a,e)||b.push(e)}return b}function l(a,b,c){for(var d=-1,e=c(a),f=e.length;++d<f;){var g=e[d];if(b(a[g],g,a)===!1)break}return a}function m(a,b){return l(a,b,k)}function n(a){return"function"!=typeof a.toString&&"string"==typeof(a+"")}function o(a){return a&&"object"==typeof a?T.call(a)==J:!1}function p(a){return"function"==typeof a}function q(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;var e=typeof a,f=typeof b;if(a===a&&(null==a||null==b||"function"!=e&&"object"!=e&&"function"!=f&&"object"!=f))return!1;var g=T.call(a),h=T.call(b);if(g==J&&(g=Q),h==J&&(h=Q),g!=h)return!1;switch(g){case L:case M:return+a==+b;case P:return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case R:case S:return a==String(b)}var i=g==K;if(!i){if(g!=Q||!ab.nodeClass&&(n(a)||n(b)))return!1;var j=!ab.argsObject&&o(a)?Object:a.constructor,k=!ab.argsObject&&o(b)?Object:b.constructor;if(!(j==k||U.call(a,"constructor")&&U.call(b,"constructor")||p(j)&&j instanceof j&&p(k)&&k instanceof k||!("constructor"in a&&"constructor"in b)))return!1}c||(c=[]),d||(d=[]);for(var l=c.length;l--;)if(c[l]==a)return d[l]==b;var r=0;if(result=!0,c.push(a),d.push(b),i){if(l=a.length,r=b.length,result=r==l)for(;r--;){var s=b[r];if(!(result=q(a[r],s,c,d)))break}}else m(b,function(b,e,f){return U.call(f,e)?(r++,result=U.call(a,e)&&q(a[e],b,c,d)):void 0}),result&&m(a,function(a,b,c){return U.call(c,b)?result=--r>-1:void 0});return c.pop(),d.pop(),result}function r(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:cb.call(a)}function s(a,b){for(var c=new Array(a),d=0;a>d;d++)c[d]=b();return c}function t(a,b){this.scheduler=a,this.disposable=b,this.isDisposed=!1}function u(a,b){return new bc(function(c){var d=new pb,e=new qb;return e.setDisposable(d),d.setDisposable(a.subscribe(c.onNext.bind(c),function(a){var d,f;try{f=b(a)}catch(g){return c.onError(g),void 0}d=new pb,e.setDisposable(d),d.setDisposable(f.subscribe(c))},c.onCompleted.bind(c))),e})}function v(a,b){var c=this;return new bc(function(d){var e=0,f=a.length;return c.subscribe(function(c){if(f>e){var g,h=a[e++];try{g=b(c,h)}catch(i){return d.onError(i),void 0}d.onNext(g)}else d.onCompleted()},d.onError.bind(d),d.onCompleted.bind(d))})}function w(a){return this.select(function(b,c){var d=a(b,c);return h(d)?Sb(d):d}).mergeObservable()}var x={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},y=x[typeof window]&&window||this,z=x[typeof exports]&&exports&&!exports.nodeType&&exports,A=x[typeof module]&&module&&!module.nodeType&&module,B=A&&A.exports===z&&z,C=x[typeof global]&&global;!C||C.global!==C&&C.window!==C||(y=C);var D,E={internals:{},config:{}},F=Date.now,G="Sequence contains no elements.",H="Argument out of range",I="Object has been disposed",J="[object Arguments]",K="[object Array]",L="[object Boolean]",M="[object Date]",N="[object Error]",O="[object Function]",P="[object Number]",Q="[object Object]",R="[object RegExp]",S="[object String]",T=Object.prototype.toString,U=Object.prototype.hasOwnProperty,V=T.call(arguments)==J,W=Error.prototype,X=Object.prototype,Y=X.propertyIsEnumerable;try{D=!(T.call(document)==Q&&!({toString:0}+""))}catch(Z){D=!0}var $=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],_={};_[K]=_[M]=_[P]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},_[L]=_[S]={constructor:!0,toString:!0,valueOf:!0},_[N]=_[O]=_[R]={constructor:!0,toString:!0},_[Q]={constructor:!0};var ab={};!function(){var a=function(){this.x=1},b=[];a.prototype={valueOf:1,y:1};for(var c in new a)b.push(c);for(c in arguments);ab.enumErrorProps=Y.call(W,"message")||Y.call(W,"name"),ab.enumPrototypes=Y.call(a,"prototype"),ab.nonEnumArgs=0!=c,ab.nonEnumShadows=!/valueOf/.test(b)}(1),V||(o=function(a){return a&&"object"==typeof a?U.call(a,"callee"):!1}),p(/x/)&&(p=function(a){return"function"==typeof a&&T.call(a)==O});var bb=E.internals.isEqual=function(a,b){return q(a,b,[],[])},cb=Array.prototype.slice,db=({}.hasOwnProperty,this.inherits=E.internals.inherits=function(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c}),eb=E.internals.addProperties=function(a){for(var b=cb.call(arguments,1),c=0,d=b.length;d>c;c++){var e=b[c];for(var f in e)a[f]=e[f]}},fb=E.internals.addRef=function(a,b){return new bc(function(c){return new jb(b.getDisposable(),a.subscribe(c))})},gb=function(a,b){this.id=a,this.value=b};gb.prototype.compareTo=function(a){var b=this.value.compareTo(a.value);return 0===b&&(b=this.id-a.id),b};var hb=E.internals.PriorityQueue=function(a){this.items=new Array(a),this.length=0},ib=hb.prototype;ib.isHigherPriority=function(a,b){return this.items[a].compareTo(this.items[b])<0},ib.percolate=function(a){if(!(a>=this.length||0>a)){var b=a-1>>1;if(!(0>b||b===a)&&this.isHigherPriority(a,b)){var c=this.items[a];this.items[a]=this.items[b],this.items[b]=c,this.percolate(b)}}},ib.heapify=function(b){if(b===a&&(b=0),!(b>=this.length||0>b)){var c=2*b+1,d=2*b+2,e=b;if(c<this.length&&this.isHigherPriority(c,e)&&(e=c),d<this.length&&this.isHigherPriority(d,e)&&(e=d),e!==b){var f=this.items[b];this.items[b]=this.items[e],this.items[e]=f,this.heapify(e)}}},ib.peek=function(){return this.items[0].value},ib.removeAt=function(a){this.items[a]=this.items[--this.length],delete this.items[this.length],this.heapify()},ib.dequeue=function(){var a=this.peek();return this.removeAt(0),a},ib.enqueue=function(a){var b=this.length++;this.items[b]=new gb(hb.count++,a),this.percolate(b)},ib.remove=function(a){for(var b=0;b<this.length;b++)if(this.items[b].value===a)return this.removeAt(b),!0;return!1},hb.count=0;var jb=E.CompositeDisposable=function(){this.disposables=r(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},kb=jb.prototype;kb.add=function(a){this.isDisposed?a.dispose():(this.disposables.push(a),this.length++)},kb.remove=function(a){var b=!1;if(!this.isDisposed){var c=this.disposables.indexOf(a);-1!==c&&(b=!0,this.disposables.splice(c,1),this.length--,a.dispose())}return b},kb.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.disposables.slice(0);this.disposables=[],this.length=0;for(var b=0,c=a.length;c>b;b++)a[b].dispose()}},kb.clear=function(){var a=this.disposables.slice(0);this.disposables=[],this.length=0;for(var b=0,c=a.length;c>b;b++)a[b].dispose()},kb.contains=function(a){return-1!==this.disposables.indexOf(a)},kb.toArray=function(){return this.disposables.slice(0)};var lb=E.Disposable=function(a){this.isDisposed=!1,this.action=a||b};lb.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var mb=lb.create=function(a){return new lb(a)},nb=lb.empty={dispose:b},ob=function(){function a(a){this.isSingle=a,this.isDisposed=!1,this.current=null}var b=a.prototype;return b.getDisposable=function(){return this.current},b.setDisposable=function(a){if(this.current&&this.isSingle)throw new Error("Disposable has already been assigned");var b,c=this.isDisposed;c||(b=this.current,this.current=a),b&&b.dispose(),c&&a&&a.dispose()},b.dispose=function(){var a;this.isDisposed||(this.isDisposed=!0,a=this.current,this.current=null),a&&a.dispose()},a}(),pb=E.SingleAssignmentDisposable=function(a){function b(){a.call(this,!0)}return db(b,a),b}(ob),qb=E.SerialDisposable=function(a){function b(){a.call(this,!1)}return db(b,a),b}(ob),rb=E.RefCountDisposable=function(){function a(a){this.disposable=a,this.disposable.count++,this.isInnerDisposed=!1}function b(a){this.underlyingDisposable=a,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return a.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()))},b.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},b.prototype.getDisposable=function(){return this.isDisposed?nb:new a(this)},b}();t.prototype.dispose=function(){var a=this;this.scheduler.schedule(function(){a.isDisposed||(a.isDisposed=!0,a.disposable.dispose())})};var sb=E.internals.ScheduledItem=function(a,b,c,d,f){this.scheduler=a,this.state=b,this.action=c,this.dueTime=d,this.comparer=f||e,this.disposable=new pb};sb.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},sb.prototype.compareTo=function(a){return this.comparer(this.dueTime,a.dueTime)},sb.prototype.isCancelled=function(){return this.disposable.isDisposed},sb.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var tb,ub=E.Scheduler=function(){function a(a,b,c,d){this.now=a,this._schedule=b,this._scheduleRelative=c,this._scheduleAbsolute=d}function b(a,b){var c=b.first,d=b.second,e=new jb,f=function(b){d(b,function(b){var c=!1,d=!1,g=a.scheduleWithState(b,function(a,b){return c?e.remove(g):d=!0,f(b),nb});d||(e.add(g),c=!0)})};return f(c),e}function c(a,b,c){var d=b.first,e=b.second,f=new jb,g=function(b){e(b,function(b,d){var e=!1,h=!1,i=a[c].call(a,b,d,function(a,b){return e?f.remove(i):h=!0,g(b),nb});h||(f.add(i),e=!0)})};return g(d),f}function d(a,b){return b(),nb}var e=a.prototype;return e.catchException=e["catch"]=function(a){return new zb(this,a)},e.schedulePeriodic=function(a,b){return this.schedulePeriodicWithState(null,a,function(){b()})},e.schedulePeriodicWithState=function(a,b,c){var d=a,e=setInterval(function(){d=c(d)},b);return mb(function(){clearInterval(e)})},e.schedule=function(a){return this._schedule(a,d)},e.scheduleWithState=function(a,b){return this._schedule(a,b)},e.scheduleWithRelative=function(a,b){return this._scheduleRelative(b,a,d)},e.scheduleWithRelativeAndState=function(a,b,c){return this._scheduleRelative(a,b,c)},e.scheduleWithAbsolute=function(a,b){return this._scheduleAbsolute(b,a,d)},e.scheduleWithAbsoluteAndState=function(a,b,c){return this._scheduleAbsolute(a,b,c)},e.scheduleRecursive=function(a){return this.scheduleRecursiveWithState(a,function(a,b){a(function(){b(a)})})},e.scheduleRecursiveWithState=function(a,c){return this.scheduleWithState({first:a,second:c},function(a,c){return b(a,c)})},e.scheduleRecursiveWithRelative=function(a,b){return this.scheduleRecursiveWithRelativeAndState(b,a,function(a,b){a(function(c){b(a,c)})})},e.scheduleRecursiveWithRelativeAndState=function(a,b,d){return this._scheduleRelative({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithRelativeAndState")})},e.scheduleRecursiveWithAbsolute=function(a,b){return this.scheduleRecursiveWithAbsoluteAndState(b,a,function(a,b){a(function(c){b(a,c)})})},e.scheduleRecursiveWithAbsoluteAndState=function(a,b,d){return this._scheduleAbsolute({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithAbsoluteAndState")})},a.now=F,a.normalize=function(a){return 0>a&&(a=0),a},a}(),vb=ub.normalize,wb=(E.internals.SchedulePeriodicRecursive=function(){function a(a,b){b(0,this._period);try{this._state=this._action(this._state)}catch(c){throw this._cancel.dispose(),c}}function b(a,b,c,d){this._scheduler=a,this._state=b,this._period=c,this._action=d}return b.prototype.start=function(){var b=new pb;return this._cancel=b,b.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,a.bind(this))),b},b}(),ub.immediate=function(){function a(a,b){return b(this,a)}function b(a,b,c){for(var d=vb(d);d-this.now()>0;);return c(this,a)}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new ub(F,a,b,c)}()),xb=ub.currentThread=function(){function a(a){for(var b;a.length>0;)if(b=a.dequeue(),!b.isCancelled()){for(;b.dueTime-ub.now()>0;);b.isCancelled()||b.invoke()}}function b(a,b){return this.scheduleWithRelativeAndState(a,0,b)}function c(b,c,d){var f=this.now()+ub.normalize(c),g=new sb(this,b,d,f);if(e)e.enqueue(g);else{e=new hb(4),e.enqueue(g);try{a(e)}catch(h){throw h}finally{e=null}}return g.disposable}function d(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}var e,f=new ub(F,b,c,d);return f.scheduleRequired=function(){return null===e},f.ensureTrampoline=function(a){return null===e?this.schedule(a):a()},f}(),yb=b;!function(){function a(){if(!y.postMessage||y.importScripts)return!1;var a=!1,b=y.onmessage;return y.onmessage=function(){a=!0},y.postMessage("","*"),y.onmessage=b,a}function b(a){if("string"==typeof a.data&&a.data.substring(0,f.length)===f){var b=a.data.substring(f.length),c=g[b];c(),delete g[b]}}var c=RegExp("^"+String(T).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),d="function"==typeof(d=C&&B&&C.setImmediate)&&!c.test(d)&&d,e="function"==typeof(e=C&&B&&C.clearImmediate)&&!c.test(e)&&e;if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))tb=process.nextTick;else if("function"==typeof d)tb=d,yb=e;else if(a()){var f="ms.rx.schedule"+Math.random(),g={},h=0;y.addEventListener?y.addEventListener("message",b,!1):y.attachEvent("onmessage",b,!1),tb=function(a){var b=h++;g[b]=a,y.postMessage(f+b,"*")}}else if(y.MessageChannel){var i=new y.MessageChannel,j={},k=0;i.port1.onmessage=function(a){var b=a.data,c=j[b];c(),delete j[b]},tb=function(a){var b=k++;j[b]=a,i.port2.postMessage(b)}}else"document"in y&&"onreadystatechange"in y.document.createElement("script")?tb=function(a){var b=y.document.createElement("script");b.onreadystatechange=function(){a(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},y.document.documentElement.appendChild(b)}:(tb=function(a){return setTimeout(a,0)},yb=clearTimeout)}();var zb=(ub.timeout=function(){function a(a,b){var c=this,d=new pb,e=tb(function(){d.isDisposed||d.setDisposable(b(c,a))});return new jb(d,mb(function(){yb(e)}))}function b(a,b,c){var d=this,e=ub.normalize(b);if(0===e)return d.scheduleWithState(a,c);var f=new pb,g=setTimeout(function(){f.isDisposed||f.setDisposable(c(d,a))},e);return new jb(f,mb(function(){clearTimeout(g)}))}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new ub(F,a,b,c)}(),function(a){function b(){return this._scheduler.now()}function c(a,b){return this._scheduler.scheduleWithState(a,this._wrap(b))}function d(a,b,c){return this._scheduler.scheduleWithRelativeAndState(a,b,this._wrap(c))}function e(a,b,c){return this._scheduler.scheduleWithAbsoluteAndState(a,b,this._wrap(c))}function f(f,g){this._scheduler=f,this._handler=g,this._recursiveOriginal=null,this._recursiveWrapper=null,a.call(this,b,c,d,e)}return db(f,a),f.prototype._clone=function(a){return new f(a,this._handler)},f.prototype._wrap=function(a){var b=this;return function(c,d){try{return a(b._getRecursiveWrapper(c),d)}catch(e){if(!b._handler(e))throw e;return nb}}},f.prototype._getRecursiveWrapper=function(a){if(this._recursiveOriginal!==a){this._recursiveOriginal=a;var b=this._clone(a);b._recursiveOriginal=a,b._recursiveWrapper=b,this._recursiveWrapper=b}return this._recursiveWrapper},f.prototype.schedulePeriodicWithState=function(a,b,c){var d=this,e=!1,f=new pb;return f.setDisposable(this._scheduler.schedulePeriodicWithState(a,b,function(a){if(e)return null;try{return c(a)}catch(b){if(e=!0,!d._handler(b))throw b;return f.dispose(),null}})),f},f}(ub)),Ab=E.Notification=function(){function a(a,b){this.hasValue=null==b?!1:b,this.kind=a}var b=a.prototype;return b.accept=function(a,b,c){return 1===arguments.length&&"object"==typeof a?this._acceptObservable(a):this._accept(a,b,c)},b.toObservable=function(a){var b=this;return a||(a=wb),new bc(function(c){return a.schedule(function(){b._acceptObservable(c),"N"===b.kind&&c.onCompleted()})})},a}(),Bb=Ab.createOnNext=function(){function a(a){return a(this.value)}function b(a){return a.onNext(this.value)}function c(){return"OnNext("+this.value+")"}return function(d){var e=new Ab("N",!0);return e.value=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),Cb=Ab.createOnError=function(){function a(a,b){return b(this.exception)}function b(a){return a.onError(this.exception)}function c(){return"OnError("+this.exception+")"}return function(d){var e=new Ab("E");return e.exception=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),Db=Ab.createOnCompleted=function(){function a(a,b,c){return c()}function b(a){return a.onCompleted()}function c(){return"OnCompleted()"}return function(){var d=new Ab("C");return d._accept=a,d._acceptObservable=b,d.toString=c,d}}(),Eb=E.internals.Enumerator=function(a,b){this.moveNext=a,this.getCurrent=b},Fb=Eb.create=function(a,b){var c=!1;return new Eb(function(){if(c)return!1;var b=a();return b||(c=!0),b},function(){return b()})},Gb=E.internals.Enumerable=function(a){this.getEnumerator=a};Gb.prototype.concat=function(){var a=this;return new bc(function(b){var c,d=a.getEnumerator(),e=new qb,f=wb.scheduleRecursive(function(a){var f,g;if(!c){try{g=d.moveNext(),g&&(f=d.getCurrent())}catch(h){return b.onError(h),void 0}if(!g)return b.onCompleted(),void 0;var i=new pb;e.setDisposable(i),i.setDisposable(f.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){a()}))}});return new jb(e,f,mb(function(){c=!0}))})},Gb.prototype.catchException=function(){var a=this;return new bc(function(b){var c,d,e=a.getEnumerator(),f=new qb,g=wb.scheduleRecursive(function(a){var g,h;if(!c){try{h=e.moveNext(),h&&(g=e.getCurrent())}catch(i){return b.onError(i),void 0}if(!h)return d?b.onError(d):b.onCompleted(),void 0;var j=new pb;f.setDisposable(j),j.setDisposable(g.subscribe(b.onNext.bind(b),function(b){d=b,a()},b.onCompleted.bind(b)))}});return new jb(f,g,mb(function(){c=!0}))})};var Hb=Gb.repeat=function(a,b){return 1===arguments.length&&(b=-1),new Gb(function(){var c,d=b;return Fb(function(){return 0===d?!1:(d>0&&d--,c=a,!0)},function(){return c})})},Ib=Gb.forEach=function(a,b,d){return b||(b=c),new Gb(function(){var c,e=-1;return Fb(function(){return++e<a.length?(c=b.call(d,a[e],e,a),!0):!1},function(){return c})})},Jb=E.Observer=function(){};Jb.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},Jb.prototype.asObserver=function(){return new Nb(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},Jb.prototype.checked=function(){return new Ob(this)};var Kb=Jb.create=function(a,c,d){return a||(a=b),c||(c=g),d||(d=b),new Nb(a,c,d)};Jb.fromNotifier=function(a){return new Nb(function(b){return a(Bb(b))},function(b){return a(Cb(b))},function(){return a(Db())})},Jb.notifyOn=function(a){return new Qb(a,this)};var Lb,Mb=E.internals.AbstractObserver=function(a){function b(){this.isStopped=!1,a.call(this)}return db(b,a),b.prototype.onNext=function(a){this.isStopped||this.next(a)},b.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.error(a))},b.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},b.prototype.dispose=function(){this.isStopped=!0},b.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.error(a),!0)},b}(Jb),Nb=E.AnonymousObserver=function(a){function b(b,c,d){a.call(this),this._onNext=b,this._onError=c,this._onCompleted=d}return db(b,a),b.prototype.next=function(a){this._onNext(a)},b.prototype.error=function(a){this._onError(a)},b.prototype.completed=function(){this._onCompleted()},b}(Mb),Ob=function(a){function b(b){a.call(this),this._observer=b,this._state=0}db(b,a);var c=b.prototype;return c.onNext=function(a){this.checkAccess();try{this._observer.onNext(a)}catch(b){throw b}finally{this._state=0}},c.onError=function(a){this.checkAccess();try{this._observer.onError(a)}catch(b){throw b}finally{this._state=2}},c.onCompleted=function(){this.checkAccess();try{this._observer.onCompleted()}catch(a){throw a}finally{this._state=2}},c.checkAccess=function(){if(1===this._state)throw new Error("Re-entrancy detected");if(2===this._state)throw new Error("Observer completed");0===this._state&&(this._state=1)},b}(Jb),Pb=E.internals.ScheduledObserver=function(a){function b(b,c){a.call(this),this.scheduler=b,this.observer=c,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new qb}return db(b,a),b.prototype.next=function(a){var b=this;this.queue.push(function(){b.observer.onNext(a)})},b.prototype.error=function(a){var b=this;this.queue.push(function(){b.observer.onError(a)})},b.prototype.completed=function(){var a=this;this.queue.push(function(){a.observer.onCompleted()})},b.prototype.ensureActive=function(){var a=!1,b=this;!this.hasFaulted&&this.queue.length>0&&(a=!this.isAcquired,this.isAcquired=!0),a&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(a){var c;if(!(b.queue.length>0))return b.isAcquired=!1,void 0;c=b.queue.shift();try{c()}catch(d){throw b.queue=[],b.hasFaulted=!0,d}a()}))},b.prototype.dispose=function(){a.prototype.dispose.call(this),this.disposable.dispose()},b}(Mb),Qb=function(a){function b(){a.apply(this,arguments)}return db(b,a),b.prototype.next=function(b){a.prototype.next.call(this,b),this.ensureActive()},b.prototype.error=function(b){a.prototype.error.call(this,b),this.ensureActive()},b.prototype.completed=function(){a.prototype.completed.call(this),this.ensureActive()},b}(Pb),Rb=E.Observable=function(){function a(a){this._subscribe=a}return Lb=a.prototype,Lb.finalValue=function(){var a=this;return new bc(function(b){var c,d=!1;return a.subscribe(function(a){d=!0,c=a},b.onError.bind(b),function(){d?(b.onNext(c),b.onCompleted()):b.onError(new Error(G))})})},Lb.subscribe=Lb.forEach=function(a,b,c){var d;return d="object"==typeof a?a:Kb(a,b,c),this._subscribe(d)},Lb.toArray=function(){function a(a,b){var c=a.slice(0);return c.push(b),c}return this.scan([],a).startWith([]).finalValue()},a}();Lb.observeOn=function(a){var b=this;return new bc(function(c){return b.subscribe(new Qb(a,c))})},Lb.subscribeOn=function(a){var b=this;return new bc(function(c){var d=new pb,e=new qb;return e.setDisposable(d),d.setDisposable(a.schedule(function(){e.setDisposable(new t(a,b.subscribe(c)))})),e})};var Sb=Rb.fromPromise=function(a){return new bc(function(b){a.then(function(a){b.onNext(a),b.onCompleted()},function(a){b.onError(a)})})};Lb.toPromise=function(a){if(a||(a=E.config.Promise),!a)throw new Error("Promise type not provided nor in Rx.config.Promise");var b=this;return new a(function(a,c){var d,e=!1;b.subscribe(function(a){d=a,e=!0},function(a){c(a)},function(){e&&a(d)})})},Rb.create=Rb.createWithDisposable=function(a){return new bc(a)};var Tb=(Rb.defer=function(a){return new bc(function(b){var c;try{c=a()}catch(d){return Xb(d).subscribe(b)}return c.subscribe(b)})},Rb.empty=function(a){return a||(a=wb),new bc(function(b){return a.schedule(function(){b.onCompleted()})})}),Ub=Rb.fromArray=function(a,b){return b||(b=xb),new bc(function(c){var d=0;return b.scheduleRecursive(function(b){d<a.length?(c.onNext(a[d++]),b()):c.onCompleted()})})};Lb.fromGenerator=function(a,b){return b||(b=xb),new bc(function(c){var d;try{d=a()}catch(e){return c.onError(e),void 0}return b.scheduleRecursive(function(a){var b=d.next();b.done?c.onCompleted():(c.onNext(b.value),a())})})},Rb.generate=function(a,b,c,d,e){return e||(e=xb),new bc(function(f){var g=!0,h=a;return e.scheduleRecursive(function(a){var e,i;try{g?g=!1:h=c(h),e=b(h),e&&(i=d(h))}catch(j){return f.onError(j),void 0}e?(f.onNext(i),a()):f.onCompleted()})})};var Vb=Rb.never=function(){return new bc(function(){return nb})};Rb.range=function(a,b,c){return c||(c=xb),new bc(function(d){return c.scheduleRecursiveWithState(0,function(c,e){b>c?(d.onNext(a+c),e(c+1)):d.onCompleted()})})},Rb.repeat=function(a,b,c){return c||(c=xb),null==b&&(b=-1),Wb(a,c).repeat(b)};var Wb=Rb["return"]=Rb.returnValue=function(a,b){return b||(b=wb),new bc(function(c){return b.schedule(function(){c.onNext(a),c.onCompleted()})})},Xb=Rb["throw"]=Rb.throwException=function(a,b){return b||(b=wb),new bc(function(c){return b.schedule(function(){c.onError(a)})})};Rb.using=function(a,b){return new bc(function(c){var d,e,f=nb;try{d=a(),d&&(f=d),e=b(d)}catch(g){return new jb(Xb(g).subscribe(c),f)}return new jb(e.subscribe(c),f)})},Lb.amb=function(a){var b=this;return new bc(function(c){function d(){f||(f=g,j.dispose())}function e(){f||(f=h,i.dispose())}var f,g="L",h="R",i=new pb,j=new pb;return i.setDisposable(b.subscribe(function(a){d(),f===g&&c.onNext(a)},function(a){d(),f===g&&c.onError(a)},function(){d(),f===g&&c.onCompleted()})),j.setDisposable(a.subscribe(function(a){e(),f===h&&c.onNext(a)},function(a){e(),f===h&&c.onError(a)},function(){e(),f===h&&c.onCompleted()})),new jb(i,j)})},Rb.amb=function(){function a(a,b){return a.amb(b)}for(var b=Vb(),c=r(arguments,0),d=0,e=c.length;e>d;d++)b=a(b,c[d]);return b},Lb["catch"]=Lb.catchException=function(a){return"function"==typeof a?u(this,a):Yb([this,a])};var Yb=Rb.catchException=Rb["catch"]=function(){var a=r(arguments,0);return Ib(a).catchException()};Lb.combineLatest=function(){var a=cb.call(arguments);return Array.isArray(a[0])?a[0].unshift(this):a.unshift(this),Zb.apply(this,a)};var Zb=Rb.combineLatest=function(){var a=cb.call(arguments),b=a.pop();return Array.isArray(a[0])&&(a=a[0]),new bc(function(d){function e(a){var e;if(i[a]=!0,j||(j=i.every(c))){try{e=b.apply(null,l)}catch(f){return d.onError(f),void 0}d.onNext(e)}else k.filter(function(b,c){return c!==a}).every(c)&&d.onCompleted()}function f(a){k[a]=!0,k.every(c)&&d.onCompleted()}for(var g=function(){return!1},h=a.length,i=s(h,g),j=!1,k=s(h,g),l=new Array(h),m=new Array(h),n=0;h>n;n++)!function(b){m[b]=new pb,m[b].setDisposable(a[b].subscribe(function(a){l[b]=a,e(b)},d.onError.bind(d),function(){f(b)}))}(n);return new jb(m)})};Lb.concat=function(){var a=cb.call(arguments,0);return a.unshift(this),$b.apply(this,a)};var $b=Rb.concat=function(){var a=r(arguments,0);return Ib(a).concat()};Lb.concatObservable=Lb.concatAll=function(){return this.merge(1)},Lb.merge=function(a){if("number"!=typeof a)return _b(this,a);var b=this;return new bc(function(c){var d=0,e=new jb,f=!1,g=[],i=function(a){var b=new pb;e.add(b),h(a)&&(a=Sb(a)),b.setDisposable(a.subscribe(c.onNext.bind(c),c.onError.bind(c),function(){var a;e.remove(b),g.length>0?(a=g.shift(),i(a)):(d--,f&&0===d&&c.onCompleted())}))};return e.add(b.subscribe(function(b){a>d?(d++,i(b)):g.push(b)},c.onError.bind(c),function(){f=!0,0===d&&c.onCompleted()})),e})};var _b=Rb.merge=function(){var a,b;return arguments[0]?arguments[0].now?(a=arguments[0],b=cb.call(arguments,1)):(a=wb,b=cb.call(arguments,0)):(a=wb,b=cb.call(arguments,1)),Array.isArray(b[0])&&(b=b[0]),Ub(b,a).mergeObservable()};Lb.mergeObservable=Lb.mergeAll=function(){var a=this;return new bc(function(b){var c=new jb,d=!1,e=new pb;return c.add(e),e.setDisposable(a.subscribe(function(a){var e=new pb;c.add(e),h(a)&&(a=Sb(a)),e.setDisposable(a.subscribe(function(a){b.onNext(a)},b.onError.bind(b),function(){c.remove(e),d&&1===c.length&&b.onCompleted()}))},b.onError.bind(b),function(){d=!0,1===c.length&&b.onCompleted()})),c})},Lb.onErrorResumeNext=function(a){if(!a)throw new Error("Second observable is required");return ac([this,a])};var ac=Rb.onErrorResumeNext=function(){var a=r(arguments,0);return new bc(function(b){var c=0,d=new qb,e=wb.scheduleRecursive(function(e){var f,g;c<a.length?(f=a[c++],g=new pb,d.setDisposable(g),g.setDisposable(f.subscribe(b.onNext.bind(b),function(){e()},function(){e()}))):b.onCompleted()});return new jb(d,e)})};Lb.skipUntil=function(a){var b=this;return new bc(function(c){var d=!1,e=new jb(b.subscribe(function(a){d&&c.onNext(a)},c.onError.bind(c),function(){d&&c.onCompleted()})),f=new pb;return e.add(f),f.setDisposable(a.subscribe(function(){d=!0,f.dispose()},c.onError.bind(c),function(){f.dispose()})),e})},Lb["switch"]=Lb.switchLatest=function(){var a=this;return new bc(function(b){var c=!1,d=new qb,e=!1,f=0,g=a.subscribe(function(a){var g=new pb,i=++f;c=!0,d.setDisposable(g),h(a)&&(a=Sb(a)),g.setDisposable(a.subscribe(function(a){f===i&&b.onNext(a)},function(a){f===i&&b.onError(a)},function(){f===i&&(c=!1,e&&b.onCompleted())}))},b.onError.bind(b),function(){e=!0,c||b.onCompleted()});return new jb(g,d)})},Lb.takeUntil=function(a){var c=this;return new bc(function(d){return new jb(c.subscribe(d),a.subscribe(d.onCompleted.bind(d),d.onError.bind(d),b))})},Lb.zip=function(){if(Array.isArray(arguments[0]))return v.apply(this,arguments);var a=this,b=cb.call(arguments),d=b.pop();return b.unshift(a),new bc(function(e){function f(a){i[a]=!0,i.every(function(a){return a})&&e.onCompleted()}for(var g=b.length,h=s(g,function(){return[]}),i=s(g,function(){return!1}),j=function(b){var f,g;if(h.every(function(a){return a.length>0})){try{g=h.map(function(a){return a.shift()}),f=d.apply(a,g)}catch(j){return e.onError(j),void 0}e.onNext(f)}else i.filter(function(a,c){return c!==b}).every(c)&&e.onCompleted()},k=new Array(g),l=0;g>l;l++)!function(a){k[a]=new pb,k[a].setDisposable(b[a].subscribe(function(b){h[a].push(b),j(a)},e.onError.bind(e),function(){f(a)}))}(l);return new jb(k)})},Rb.zip=function(){var a=cb.call(arguments,0),b=a.shift();return b.zip.apply(b,a)},Rb.zipArray=function(){var a=r(arguments,0);return new bc(function(b){function d(a){if(g.every(function(a){return a.length>0})){var d=g.map(function(a){return a.shift()});b.onNext(d)}else if(h.filter(function(b,c){return c!==a}).every(c))return b.onCompleted(),void 0}function e(a){return h[a]=!0,h.every(c)?(b.onCompleted(),void 0):void 0}for(var f=a.length,g=s(f,function(){return[]}),h=s(f,function(){return!1}),i=new Array(f),j=0;f>j;j++)!function(c){i[c]=new pb,i[c].setDisposable(a[c].subscribe(function(a){g[c].push(a),d(c)},b.onError.bind(b),function(){e(c)}))}(j);var k=new jb(i);return k.add(mb(function(){for(var a=0,b=g.length;b>a;a++)g[a]=[]})),k})},Lb.asObservable=function(){var a=this;return new bc(function(b){return a.subscribe(b)})},Lb.bufferWithCount=function(a,b){return 1===arguments.length&&(b=a),this.windowWithCount(a,b).selectMany(function(a){return a.toArray()}).where(function(a){return a.length>0})},Lb.dematerialize=function(){var a=this;return new bc(function(b){return a.subscribe(function(a){return a.accept(b)},b.onError.bind(b),b.onCompleted.bind(b))})},Lb.distinctUntilChanged=function(a,b){var e=this;return a||(a=c),b||(b=d),new bc(function(c){var d,f=!1;return e.subscribe(function(e){var g,h=!1;try{g=a(e)}catch(i){return c.onError(i),void 0}if(f)try{h=b(d,g)}catch(i){return c.onError(i),void 0}f&&h||(f=!0,d=g,c.onNext(e))},c.onError.bind(c),c.onCompleted.bind(c))})},Lb["do"]=Lb.doAction=function(a,b,c){var d,e=this;return"function"==typeof a?d=a:(d=a.onNext.bind(a),b=a.onError.bind(a),c=a.onCompleted.bind(a)),new bc(function(a){return e.subscribe(function(b){try{d(b)}catch(c){a.onError(c)}a.onNext(b)},function(c){if(b){try{b(c)}catch(d){a.onError(d)}a.onError(c)}else a.onError(c)},function(){if(c){try{c()}catch(b){a.onError(b)}a.onCompleted()}else a.onCompleted()})})},Lb["finally"]=Lb.finallyAction=function(a){var b=this;return new bc(function(c){var d=b.subscribe(c);return mb(function(){try{d.dispose()}catch(b){throw b}finally{a()}})})},Lb.ignoreElements=function(){var a=this;return new bc(function(c){return a.subscribe(b,c.onError.bind(c),c.onCompleted.bind(c))})},Lb.materialize=function(){var a=this;return new bc(function(b){return a.subscribe(function(a){b.onNext(Bb(a))},function(a){b.onNext(Cb(a)),b.onCompleted()},function(){b.onNext(Db()),b.onCompleted()
2
+ })})},Lb.repeat=function(a){return Hb(this,a).concat()},Lb.retry=function(a){return Hb(this,a).catchException()},Lb.scan=function(){var a,b,c=!1,d=this;return 2===arguments.length?(c=!0,a=arguments[0],b=arguments[1]):b=arguments[0],new bc(function(e){var f,g,h;return d.subscribe(function(d){try{h||(h=!0),f?g=b(g,d):(g=c?b(a,d):d,f=!0)}catch(i){return e.onError(i),void 0}e.onNext(g)},e.onError.bind(e),function(){!h&&c&&e.onNext(a),e.onCompleted()})})},Lb.skipLast=function(a){var b=this;return new bc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&c.onNext(d.shift())},c.onError.bind(c),c.onCompleted.bind(c))})},Lb.startWith=function(){var a,b,c=0;return arguments.length&&"now"in Object(arguments[0])?(b=arguments[0],c=1):b=wb,a=cb.call(arguments,c),Ib([Ub(a,b),this]).concat()},Lb.takeLast=function(a,b){return this.takeLastBuffer(a).selectMany(function(a){return Ub(a,b)})},Lb.takeLastBuffer=function(a){var b=this;return new bc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},c.onError.bind(c),function(){c.onNext(d),c.onCompleted()})})},Lb.windowWithCount=function(a,b){var c=this;if(0>=a)throw new Error(H);if(1===arguments.length&&(b=a),0>=b)throw new Error(H);return new bc(function(d){var e=new pb,f=new rb(e),g=0,h=[],i=function(){var a=new fc;h.push(a),d.onNext(fb(a,f))};return i(),e.setDisposable(c.subscribe(function(c){for(var d,e=0,f=h.length;f>e;e++)h[e].onNext(c);var j=g-a+1;j>=0&&j%b===0&&(d=h.shift(),d.onCompleted()),g++,g%b===0&&i()},function(a){for(;h.length>0;)h.shift().onError(a);d.onError(a)},function(){for(;h.length>0;)h.shift().onCompleted();d.onCompleted()})),f})},Lb.defaultIfEmpty=function(b){var c=this;return b===a&&(b=null),new bc(function(a){var d=!1;return c.subscribe(function(b){d=!0,a.onNext(b)},a.onError.bind(a),function(){d||a.onNext(b),a.onCompleted()})})},Lb.distinct=function(a,b){var d=this;return a||(a=c),b||(b=f),new bc(function(c){var e={};return d.subscribe(function(d){var f,g,h,i=!1;try{f=a(d),g=b(f)}catch(j){return c.onError(j),void 0}for(h in e)if(g===h){i=!0;break}i||(e[g]=null,c.onNext(d))},c.onError.bind(c),c.onCompleted.bind(c))})},Lb.groupBy=function(a,b,c){return this.groupByUntil(a,b,function(){return Vb()},c)},Lb.groupByUntil=function(a,d,e,g){var h=this;return d||(d=c),g||(g=f),new bc(function(c){var f={},i=new jb,j=new rb(i);return i.add(h.subscribe(function(h){var k,l,m,n,o,p,q,r,s,t;try{p=a(h),q=g(p)}catch(u){for(t in f)f[t].onError(u);return c.onError(u),void 0}n=!1;try{s=f[q],s||(s=new fc,f[q]=s,n=!0)}catch(u){for(t in f)f[t].onError(u);return c.onError(u),void 0}if(n){o=new dc(p,s,j),l=new dc(p,s);try{k=e(l)}catch(u){for(t in f)f[t].onError(u);return c.onError(u),void 0}c.onNext(o),r=new pb,i.add(r);var v=function(){q in f&&(delete f[q],s.onCompleted()),i.remove(r)};r.setDisposable(k.take(1).subscribe(b,function(a){for(t in f)f[t].onError(a);c.onError(a)},function(){v()}))}try{m=d(h)}catch(u){for(t in f)f[t].onError(u);return c.onError(u),void 0}s.onNext(m)},function(a){for(var b in f)f[b].onError(a);c.onError(a)},function(){for(var a in f)f[a].onCompleted();c.onCompleted()})),j})},Lb.select=Lb.map=function(a,b){var c=this;return new bc(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return d.onError(h),void 0}d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},Lb.pluck=function(a){return this.select(function(b){return b[a]})},Lb.selectMany=Lb.flatMap=function(a,b){return b?this.selectMany(function(c,d){var e=a(c,d),f=h(e)?Sb(e):e;return f.select(function(a){return b(c,a,d)})}):"function"==typeof a?w.call(this,a):w.call(this,function(){return a})},Lb.selectSwitch=Lb.flatMapLatest=function(a,b){return this.select(a,b).switchLatest()},Lb.skip=function(a){if(0>a)throw new Error(H);var b=this;return new bc(function(c){var d=a;return b.subscribe(function(a){0>=d?c.onNext(a):d--},c.onError.bind(c),c.onCompleted.bind(c))})},Lb.skipWhile=function(a,b){var c=this;return new bc(function(d){var e=0,f=!1;return c.subscribe(function(g){if(!f)try{f=!a.call(b,g,e++,c)}catch(h){return d.onError(h),void 0}f&&d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},Lb.take=function(a,b){if(0>a)throw new Error(H);if(0===a)return Tb(b);var c=this;return new bc(function(b){var d=a;return c.subscribe(function(a){d>0&&(d--,b.onNext(a),0===d&&b.onCompleted())},b.onError.bind(b),b.onCompleted.bind(b))})},Lb.takeWhile=function(a,b){var c=this;return new bc(function(d){var e=0,f=!0;return c.subscribe(function(g){if(f){try{f=a.call(b,g,e++,c)}catch(h){return d.onError(h),void 0}f?d.onNext(g):d.onCompleted()}},d.onError.bind(d),d.onCompleted.bind(d))})},Lb.where=Lb.filter=function(a,b){var c=this;return new bc(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return d.onError(h),void 0}g&&d.onNext(f)},d.onError.bind(d),d.onCompleted.bind(d))})};var bc=E.AnonymousObservable=function(a){function b(a){return"undefined"==typeof a?a=nb:"function"==typeof a&&(a=mb(a)),a}function c(d){function e(a){var c=new cc(a);if(xb.scheduleRequired())xb.schedule(function(){try{c.setDisposable(b(d(c)))}catch(a){if(!c.fail(a))throw a}});else try{c.setDisposable(b(d(c)))}catch(e){if(!c.fail(e))throw e}return c}return this instanceof c?(a.call(this,e),void 0):new c(d)}return db(c,a),c}(Rb),cc=function(a){function b(b){a.call(this),this.observer=b,this.m=new pb}db(b,a);var c=b.prototype;return c.next=function(a){var b=!1;try{this.observer.onNext(a),b=!0}catch(c){throw c}finally{b||this.dispose()}},c.error=function(a){try{this.observer.onError(a)}catch(b){throw b}finally{this.dispose()}},c.completed=function(){try{this.observer.onCompleted()}catch(a){throw a}finally{this.dispose()}},c.setDisposable=function(a){this.m.setDisposable(a)},c.getDisposable=function(){return this.m.getDisposable()},c.disposable=function(a){return arguments.length?this.getDisposable():setDisposable(a)},c.dispose=function(){a.prototype.dispose.call(this),this.m.dispose()},b}(Mb),dc=function(a){function b(a){return this.underlyingObservable.subscribe(a)}function c(c,d,e){a.call(this,b),this.key=c,this.underlyingObservable=e?new bc(function(a){return new jb(e.getDisposable(),d.subscribe(a))}):d}return db(c,a),c}(Rb),ec=function(a,b){this.subject=a,this.observer=b};ec.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var a=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(a,1),this.observer=null}};var fc=E.Subject=function(a){function b(a){return i.call(this),this.isStopped?this.exception?(a.onError(this.exception),nb):(a.onCompleted(),nb):(this.observers.push(a),new ec(this,a))}function c(){a.call(this,b),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return db(c,a),eb(c.prototype,Jb,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(i.call(this),!this.isStopped){var a=this.observers.slice(0);this.isStopped=!0;for(var b=0,c=a.length;c>b;b++)a[b].onCompleted();this.observers=[]}},onError:function(a){if(i.call(this),!this.isStopped){var b=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var c=0,d=b.length;d>c;c++)b[c].onError(a);this.observers=[]}},onNext:function(a){if(i.call(this),!this.isStopped)for(var b=this.observers.slice(0),c=0,d=b.length;d>c;c++)b[c].onNext(a)},dispose:function(){this.isDisposed=!0,this.observers=null}}),c.create=function(a,b){return new gc(a,b)},c}(Rb),gc=(E.AsyncSubject=function(a){function b(a){if(i.call(this),!this.isStopped)return this.observers.push(a),new ec(this,a);var b=this.exception,c=this.hasValue,d=this.value;return b?a.onError(b):c?(a.onNext(d),a.onCompleted()):a.onCompleted(),nb}function c(){a.call(this,b),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return db(c,a),eb(c.prototype,Jb,{hasObservers:function(){return i.call(this),this.observers.length>0},onCompleted:function(){var a,b,c;if(i.call(this),!this.isStopped){this.isStopped=!0;var d=this.observers.slice(0),e=this.value,f=this.hasValue;if(f)for(b=0,c=d.length;c>b;b++)a=d[b],a.onNext(e),a.onCompleted();else for(b=0,c=d.length;c>b;b++)d[b].onCompleted();this.observers=[]}},onError:function(a){if(i.call(this),!this.isStopped){var b=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var c=0,d=b.length;d>c;c++)b[c].onError(a);this.observers=[]}},onNext:function(a){i.call(this),this.isStopped||(this.value=a,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),c}(Rb),function(a){function b(a){return this.observable.subscribe(a)}function c(c,d){a.call(this,b),this.observer=c,this.observable=d}return db(c,a),eb(c.prototype,Jb,{onCompleted:function(){this.observer.onCompleted()},onError:function(a){this.observer.onError(a)},onNext:function(a){this.observer.onNext(a)}}),c}(Rb));"function"==typeof define&&"object"==typeof define.amd&&define.amd?(y.Rx=E,define(function(){return E})):z&&A?B?(A.exports=E).Rx=E:z.Rx=E:y.Rx=E}).call(this);
@@ -1,5 +1,6 @@
1
1
  var Rx = require('./rx');
2
2
  require('./rx.aggregates');
3
+ require('./rx.backpressure');
3
4
  require('./rx.async');
4
5
  require('./rx.binding');
5
6
  require('./rx.coincidence');
@@ -44,13 +44,8 @@
44
44
  CompositeDisposable = Rx.CompositeDisposable,
45
45
  SingleAssignmentDisposable = Rx.SingleAssignmentDisposable,
46
46
  slice = Array.prototype.slice,
47
- inherits = Rx.Internals.inherits,
48
- isEqual = Rx.Internals.isEqual;
49
-
50
- // Utilities
51
- function defaultComparer(x, y) {
52
- return isEqual(x, y);
53
- }
47
+ inherits = Rx.internals.inherits,
48
+ defaultComparer = Rx.internals.isEqual;
54
49
 
55
50
  function argsOrArray(args, idx) {
56
51
  return args.length === 1 && Array.isArray(args[idx]) ?
@@ -1 +1 @@
1
- (function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx.virtualtime","exports"],function(b,d){return c.Rx=a(c,d,b),c.Rx}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c){function d(a,b){return r(a,b)}function e(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:p.call(a)}function f(a){this.predicate=a}function g(a){this.predicate=a}var h=c.Observer,i=c.Observable,j=c.Notification,k=c.VirtualTimeScheduler,l=c.Disposable,m=l.empty,n=l.create,o=c.CompositeDisposable,p=(c.SingleAssignmentDisposable,Array.prototype.slice),q=c.Internals.inherits,r=c.Internals.isEqual;f.prototype.equals=function(a){return a===this?!0:null==a?!1:"N"!==a.kind?!1:this.predicate(a.value)},g.prototype.equals=function(a){return a===this?!0:null==a?!1:"E"!==a.kind?!1:this.predicate(a.exception)};var s=c.ReactiveTest={created:100,subscribed:200,disposed:1e3,onNext:function(a,b){return"function"==typeof b?new t(a,new f(b)):new t(a,j.createOnNext(b))},onError:function(a,b){return"function"==typeof b?new t(a,new g(b)):new t(a,j.createOnError(b))},onCompleted:function(a){return new t(a,j.createOnCompleted())},subscribe:function(a,b){return new u(a,b)}},t=c.Recorded=function(a,b,c){this.time=a,this.value=b,this.comparer=c||d};t.prototype.equals=function(a){return this.time===a.time&&this.comparer(this.value,a.value)},t.prototype.toString=function(){return this.value.toString()+"@"+this.time};var u=c.Subscription=function(a,b){this.subscribe=a,this.unsubscribe=b||Number.MAX_VALUE};u.prototype.equals=function(a){return this.subscribe===a.subscribe&&this.unsubscribe===a.unsubscribe},u.prototype.toString=function(){return"("+this.subscribe+", "+this.unsubscribe===Number.MAX_VALUE?"Infinite":this.unsubscribe+")"};var v=c.MockDisposable=function(a){this.scheduler=a,this.disposes=[],this.disposes.push(this.scheduler.clock)};v.prototype.dispose=function(){this.disposes.push(this.scheduler.clock)};var w=function(a){function b(b){a.call(this),this.scheduler=b,this.messages=[]}q(b,a);var c=b.prototype;return c.onNext=function(a){this.messages.push(new t(this.scheduler.clock,j.createOnNext(a)))},c.onError=function(a){this.messages.push(new t(this.scheduler.clock,j.createOnError(a)))},c.onCompleted=function(){this.messages.push(new t(this.scheduler.clock,j.createOnCompleted()))},b}(h),x=function(a){function b(a){var b=this;this.observers.push(a),this.subscriptions.push(new u(this.scheduler.clock));var c=this.subscriptions.length-1;return n(function(){var d=b.observers.indexOf(a);b.observers.splice(d,1),b.subscriptions[c]=new u(b.subscriptions[c].subscribe,b.scheduler.clock)})}function c(c,d){a.call(this,b);var e,f,g=this;this.scheduler=c,this.messages=d,this.subscriptions=[],this.observers=[];for(var h=0,i=this.messages.length;i>h;h++)e=this.messages[h],f=e.value,function(a){c.scheduleAbsoluteWithState(null,e.time,function(){for(var b=g.observers.slice(0),c=0,d=b.length;d>c;c++)a.accept(b[c]);return m})}(f)}return q(c,a),c}(i),y=function(a){function b(a){var b,c,d=this;this.subscriptions.push(new u(this.scheduler.clock));for(var e=this.subscriptions.length-1,f=new o,g=0,h=this.messages.length;h>g;g++)b=this.messages[g],c=b.value,function(c){f.add(d.scheduler.scheduleRelativeWithState(null,b.time,function(){return c.accept(a),m}))}(c);return n(function(){d.subscriptions[e]=new u(d.subscriptions[e].subscribe,d.scheduler.clock),f.dispose()})}function c(c,d){a.call(this,b),this.scheduler=c,this.messages=d,this.subscriptions=[]}return q(c,a),c}(i);return c.TestScheduler=function(a){function b(a,b){return a>b?1:b>a?-1:0}function c(){a.call(this,0,b)}return q(c,a),c.prototype.scheduleAbsoluteWithState=function(b,c,d){return c<=this.clock&&(c=this.clock+1),a.prototype.scheduleAbsoluteWithState.call(this,b,c,d)},c.prototype.add=function(a,b){return a+b},c.prototype.toDateTimeOffset=function(a){return new Date(a).getTime()},c.prototype.toRelative=function(a){return a},c.prototype.startWithTiming=function(a,b,c,d){var e,f,g=this.createObserver();return this.scheduleAbsoluteWithState(null,b,function(){return e=a(),m}),this.scheduleAbsoluteWithState(null,c,function(){return f=e.subscribe(g),m}),this.scheduleAbsoluteWithState(null,d,function(){return f.dispose(),m}),this.start(),g},c.prototype.startWithDispose=function(a,b){return this.startWithTiming(a,s.created,s.subscribed,b)},c.prototype.startWithCreate=function(a){return this.startWithTiming(a,s.created,s.subscribed,s.disposed)},c.prototype.createHotObservable=function(){var a=e(arguments,0);return new x(this,a)},c.prototype.createColdObservable=function(){var a=e(arguments,0);return new y(this,a)},c.prototype.createObserver=function(){return new w(this)},c}(k),c});
1
+ (function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx.virtualtime","exports"],function(b,d){return c.Rx=a(c,d,b),c.Rx}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c){function d(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:o.call(a)}function e(a){this.predicate=a}function f(a){this.predicate=a}var g=c.Observer,h=c.Observable,i=c.Notification,j=c.VirtualTimeScheduler,k=c.Disposable,l=k.empty,m=k.create,n=c.CompositeDisposable,o=(c.SingleAssignmentDisposable,Array.prototype.slice),p=c.internals.inherits,q=c.internals.isEqual;e.prototype.equals=function(a){return a===this?!0:null==a?!1:"N"!==a.kind?!1:this.predicate(a.value)},f.prototype.equals=function(a){return a===this?!0:null==a?!1:"E"!==a.kind?!1:this.predicate(a.exception)};var r=c.ReactiveTest={created:100,subscribed:200,disposed:1e3,onNext:function(a,b){return"function"==typeof b?new s(a,new e(b)):new s(a,i.createOnNext(b))},onError:function(a,b){return"function"==typeof b?new s(a,new f(b)):new s(a,i.createOnError(b))},onCompleted:function(a){return new s(a,i.createOnCompleted())},subscribe:function(a,b){return new t(a,b)}},s=c.Recorded=function(a,b,c){this.time=a,this.value=b,this.comparer=c||q};s.prototype.equals=function(a){return this.time===a.time&&this.comparer(this.value,a.value)},s.prototype.toString=function(){return this.value.toString()+"@"+this.time};var t=c.Subscription=function(a,b){this.subscribe=a,this.unsubscribe=b||Number.MAX_VALUE};t.prototype.equals=function(a){return this.subscribe===a.subscribe&&this.unsubscribe===a.unsubscribe},t.prototype.toString=function(){return"("+this.subscribe+", "+this.unsubscribe===Number.MAX_VALUE?"Infinite":this.unsubscribe+")"};var u=c.MockDisposable=function(a){this.scheduler=a,this.disposes=[],this.disposes.push(this.scheduler.clock)};u.prototype.dispose=function(){this.disposes.push(this.scheduler.clock)};var v=function(a){function b(b){a.call(this),this.scheduler=b,this.messages=[]}p(b,a);var c=b.prototype;return c.onNext=function(a){this.messages.push(new s(this.scheduler.clock,i.createOnNext(a)))},c.onError=function(a){this.messages.push(new s(this.scheduler.clock,i.createOnError(a)))},c.onCompleted=function(){this.messages.push(new s(this.scheduler.clock,i.createOnCompleted()))},b}(g),w=function(a){function b(a){var b=this;this.observers.push(a),this.subscriptions.push(new t(this.scheduler.clock));var c=this.subscriptions.length-1;return m(function(){var d=b.observers.indexOf(a);b.observers.splice(d,1),b.subscriptions[c]=new t(b.subscriptions[c].subscribe,b.scheduler.clock)})}function c(c,d){a.call(this,b);var e,f,g=this;this.scheduler=c,this.messages=d,this.subscriptions=[],this.observers=[];for(var h=0,i=this.messages.length;i>h;h++)e=this.messages[h],f=e.value,function(a){c.scheduleAbsoluteWithState(null,e.time,function(){for(var b=g.observers.slice(0),c=0,d=b.length;d>c;c++)a.accept(b[c]);return l})}(f)}return p(c,a),c}(h),x=function(a){function b(a){var b,c,d=this;this.subscriptions.push(new t(this.scheduler.clock));for(var e=this.subscriptions.length-1,f=new n,g=0,h=this.messages.length;h>g;g++)b=this.messages[g],c=b.value,function(c){f.add(d.scheduler.scheduleRelativeWithState(null,b.time,function(){return c.accept(a),l}))}(c);return m(function(){d.subscriptions[e]=new t(d.subscriptions[e].subscribe,d.scheduler.clock),f.dispose()})}function c(c,d){a.call(this,b),this.scheduler=c,this.messages=d,this.subscriptions=[]}return p(c,a),c}(h);return c.TestScheduler=function(a){function b(a,b){return a>b?1:b>a?-1:0}function c(){a.call(this,0,b)}return p(c,a),c.prototype.scheduleAbsoluteWithState=function(b,c,d){return c<=this.clock&&(c=this.clock+1),a.prototype.scheduleAbsoluteWithState.call(this,b,c,d)},c.prototype.add=function(a,b){return a+b},c.prototype.toDateTimeOffset=function(a){return new Date(a).getTime()},c.prototype.toRelative=function(a){return a},c.prototype.startWithTiming=function(a,b,c,d){var e,f,g=this.createObserver();return this.scheduleAbsoluteWithState(null,b,function(){return e=a(),l}),this.scheduleAbsoluteWithState(null,c,function(){return f=e.subscribe(g),l}),this.scheduleAbsoluteWithState(null,d,function(){return f.dispose(),l}),this.start(),g},c.prototype.startWithDispose=function(a,b){return this.startWithTiming(a,r.created,r.subscribed,b)},c.prototype.startWithCreate=function(a){return this.startWithTiming(a,r.created,r.subscribed,r.disposed)},c.prototype.createHotObservable=function(){var a=d(arguments,0);return new w(this,a)},c.prototype.createColdObservable=function(){var a=d(arguments,0);return new x(this,a)},c.prototype.createObserver=function(){return new v(this)},c}(j),c});
@@ -36,7 +36,7 @@
36
36
  // Refernces
37
37
  var Observable = Rx.Observable,
38
38
  observableProto = Observable.prototype,
39
- AnonymousObservable = Rx.Internals.AnonymousObservable,
39
+ AnonymousObservable = Rx.AnonymousObservable,
40
40
  observableDefer = Observable.defer,
41
41
  observableEmpty = Observable.empty,
42
42
  observableNever = Observable.never,
@@ -48,8 +48,7 @@
48
48
  CompositeDisposable = Rx.CompositeDisposable,
49
49
  RefCountDisposable = Rx.RefCountDisposable,
50
50
  Subject = Rx.Subject,
51
- BinaryObserver = Rx.Internals.BinaryObserver,
52
- addRef = Rx.Internals.addRef,
51
+ addRef = Rx.internals.addRef,
53
52
  normalizeTime = Rx.Scheduler.normalize;
54
53
 
55
54
  function observableTimerDate(dueTime, scheduler) {
@@ -1 +1 @@
1
- (function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx","exports"],function(b,d){return c.Rx=a(c,d,b),c.Rx}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c,d){function e(a,b){return new n(function(c){return b.scheduleWithAbsolute(a,function(){c.onNext(0),c.onCompleted()})})}function f(a,b,c){var d=A(b);return new n(function(b){var e=0,f=a;return c.scheduleRecursiveWithAbsolute(f,function(a){var g;d>0&&(g=c.now(),f+=d,g>=f&&(f=g+d)),b.onNext(e++),a(f)})})}function g(a,b){var c=A(a);return new n(function(a){return b.scheduleWithRelative(c,function(){a.onNext(0),a.onCompleted()})})}function h(a,b,c){return a===b?new n(function(a){return c.schedulePeriodicWithState(0,b,function(b){return a.onNext(b),b+1})}):o(function(){return f(c.now()+a,b,c)})}function i(a,b){var c=this;return new n(function(d){var e,f=!1,g=new v,h=null,i=[],j=!1;return e=c.materialize().timestamp(b).subscribe(function(c){var e,k;"E"===c.value.kind?(i=[],i.push(c),h=c.value.exception,k=!j):(i.push({value:c.value,timestamp:c.timestamp+a}),k=!f,f=!0),k&&(null!==h?d.onError(h):(e=new u,g.setDisposable(e),e.setDisposable(b.scheduleRecursiveWithRelative(a,function(a){var c,e,g,k;if(null===h){j=!0;do g=null,i.length>0&&i[0].timestamp-b.now()<=0&&(g=i.shift().value),null!==g&&g.accept(d);while(null!==g);k=!1,e=0,i.length>0?(k=!0,e=Math.max(0,i[0].timestamp-b.now())):f=!1,c=h,j=!1,null!==c?d.onError(c):k&&a(e)}}))))}),new w(e,g)})}function j(a,b){var c=this;return o(function(){var d=a-b.now();return i.call(c,d,b)})}function k(a,b){return new n(function(c){function d(){g&&(g=!1,c.onNext(f)),e&&c.onCompleted()}var e,f,g;return new w(a.subscribe(function(a){g=!0,f=a},c.onError.bind(c),function(){e=!0}),b.subscribe(d,c.onError.bind(c),d))})}var l=c.Observable,m=l.prototype,n=c.Internals.AnonymousObservable,o=l.defer,p=l.empty,q=l.never,r=l.throwException,s=l.fromArray,t=c.Scheduler.timeout,u=c.SingleAssignmentDisposable,v=c.SerialDisposable,w=c.CompositeDisposable,x=c.RefCountDisposable,y=c.Subject,z=(c.Internals.BinaryObserver,c.Internals.addRef),A=c.Scheduler.normalize,B=l.interval=function(a,b){return b||(b=t),h(a,a,b)},C=l.timer=function(a,b,c){var i;return c||(c=t),b!==d&&"number"==typeof b?i=b:b!==d&&"object"==typeof b&&(c=b),a instanceof Date&&i===d?e(a.getTime(),c):a instanceof Date&&i!==d?(i=b,f(a.getTime(),i,c)):i===d?g(a,c):h(a,i,c)};return m.delay=function(a,b){return b||(b=t),a instanceof Date?j.call(this,a.getTime(),b):i.call(this,a,b)},m.throttle=function(a,b){b||(b=t);return this.throttleWithSelector(function(){return C(a,b)})},m.windowWithTime=function(a,b,c){var e,f=this;return b===d&&(e=a),c===d&&(c=t),"number"==typeof b?e=b:"object"==typeof b&&(e=a,c=b),new n(function(b){function d(){var a=new u,f=!1,g=!1;l.setDisposable(a),j===i?(f=!0,g=!0):i>j?f=!0:g=!0;var n=f?j:i,o=n-m;m=n,f&&(j+=e),g&&(i+=e),a.setDisposable(c.scheduleWithRelative(o,function(){var a;g&&(a=new y,k.push(a),b.onNext(z(a,h))),f&&(a=k.shift(),a.onCompleted()),d()}))}var g,h,i=e,j=a,k=[],l=new v,m=0;return g=new w(l),h=new x(g),k.push(new y),b.onNext(z(k[0],h)),d(),g.add(f.subscribe(function(a){var b,c;for(b=0;b<k.length;b++)c=k[b],c.onNext(a)},function(a){var c,d;for(c=0;c<k.length;c++)d=k[c],d.onError(a);b.onError(a)},function(){var a,c;for(a=0;a<k.length;a++)c=k[a],c.onCompleted();b.onCompleted()})),h})},m.windowWithTimeOrCount=function(a,b,c){var d=this;return c||(c=t),new n(function(e){var f,g,h,i,j=0,k=new v,l=0;return g=new w(k),h=new x(g),f=function(b){var d=new u;k.setDisposable(d),d.setDisposable(c.scheduleWithRelative(a,function(){var a;b===l&&(j=0,a=++l,i.onCompleted(),i=new y,e.onNext(z(i,h)),f(a))}))},i=new y,e.onNext(z(i,h)),f(0),g.add(d.subscribe(function(a){var c=0,d=!1;i.onNext(a),j++,j===b&&(d=!0,j=0,c=++l,i.onCompleted(),i=new y,e.onNext(z(i,h))),d&&f(c)},function(a){i.onError(a),e.onError(a)},function(){i.onCompleted(),e.onCompleted()})),h})},m.bufferWithTime=function(){return this.windowWithTime.apply(this,arguments).selectMany(function(a){return a.toArray()})},m.bufferWithTimeOrCount=function(a,b,c){return this.windowWithTimeOrCount(a,b,c).selectMany(function(a){return a.toArray()})},m.timeInterval=function(a){var b=this;return a||(a=t),o(function(){var c=a.now();return b.select(function(b){var d=a.now(),e=d-c;return c=d,{value:b,interval:e}})})},m.timestamp=function(a){return a||(a=t),this.select(function(b){return{value:b,timestamp:a.now()}})},m.sample=function(a,b){return b||(b=t),"number"==typeof a?k(this,B(a,b)):k(this,a)},m.timeout=function(a,b,c){var d,e=this;return b||(b=r(new Error("Timeout"))),c||(c=t),d=a instanceof Date?function(a,b){c.scheduleWithAbsolute(a,b)}:function(a,b){c.scheduleWithRelative(a,b)},new n(function(c){var f,g=0,h=new u,i=new v,j=!1,k=new v;return i.setDisposable(h),f=function(){var e=g;k.setDisposable(d(a,function(){j=g===e;var a=j;a&&i.setDisposable(b.subscribe(c))}))},f(),h.setDisposable(e.subscribe(function(a){var b=!j;b&&(g++,c.onNext(a),f())},function(a){var b=!j;b&&(g++,c.onError(a))},function(){var a=!j;a&&(g++,c.onCompleted())})),new w(i,k)})},l.generateWithAbsoluteTime=function(a,b,c,d,e,f){return f||(f=t),new n(function(g){var h,i,j=!0,k=!1,l=a;return f.scheduleRecursiveWithAbsolute(f.now(),function(a){k&&g.onNext(h);try{j?j=!1:l=c(l),k=b(l),k&&(h=d(l),i=e(l))}catch(f){return g.onError(f),void 0}k?a(i):g.onCompleted()})})},l.generateWithRelativeTime=function(a,b,c,d,e,f){return f||(f=t),new n(function(g){var h,i,j=!0,k=!1,l=a;return f.scheduleRecursiveWithRelative(0,function(a){k&&g.onNext(h);try{j?j=!1:l=c(l),k=b(l),k&&(h=d(l),i=e(l))}catch(f){return g.onError(f),void 0}k?a(i):g.onCompleted()})})},m.delaySubscription=function(a,b){return b||(b=t),this.delayWithSelector(C(a,b),function(){return p()})},m.delayWithSelector=function(a,b){var c,d,e=this;return"function"==typeof a?d=a:(c=a,d=b),new n(function(a){var b=new w,f=!1,g=function(){f&&0===b.length&&a.onCompleted()},h=new v,i=function(){h.setDisposable(e.subscribe(function(c){var e;try{e=d(c)}catch(f){return a.onError(f),void 0}var h=new u;b.add(h),h.setDisposable(e.subscribe(function(){a.onNext(c),b.remove(h),g()},a.onError.bind(a),function(){a.onNext(c),b.remove(h),g()}))},a.onError.bind(a),function(){f=!0,h.dispose(),g()}))};return c?h.setDisposable(c.subscribe(function(){i()},a.onError.bind(a),function(){i()})):i(),new w(h,b)})},m.timeoutWithSelector=function(a,b,c){if(1===arguments.length){b=a;var a=q()}c||(c=r(new Error("Timeout")));var d=this;return new n(function(e){var f=new v,g=new v,h=new u;f.setDisposable(h);var i=0,j=!1,k=function(a){var b=i,d=function(){return i===b},h=new u;g.setDisposable(h),h.setDisposable(a.subscribe(function(){d()&&f.setDisposable(c.subscribe(e)),h.dispose()},function(a){d()&&e.onError(a)},function(){d()&&f.setDisposable(c.subscribe(e))}))};k(a);var l=function(){var a=!j;return a&&i++,a};return h.setDisposable(d.subscribe(function(a){if(l()){e.onNext(a);var c;try{c=b(a)}catch(d){return e.onError(d),void 0}k(c)}},function(a){l()&&e.onError(a)},function(){l()&&e.onCompleted()})),new w(f,g)})},m.throttleWithSelector=function(a){var b=this;return new n(function(c){var d,e=!1,f=new v,g=0,h=b.subscribe(function(b){var h;try{h=a(b)}catch(i){return c.onError(i),void 0}e=!0,d=b,g++;var j=g,k=new u;f.setDisposable(k),k.setDisposable(h.subscribe(function(){e&&g===j&&c.onNext(d),e=!1,k.dispose()},c.onError.bind(c),function(){e&&g===j&&c.onNext(d),e=!1,k.dispose()}))},function(a){f.dispose(),c.onError(a),e=!1,g++},function(){f.dispose(),e&&c.onNext(d),c.onCompleted(),e=!1,g++});return new w(h,f)})},m.skipLastWithTime=function(a,b){b||(b=t);var c=this;return new n(function(d){var e=[];return c.subscribe(function(c){var f=b.now();for(e.push({interval:f,value:c});e.length>0&&f-e[0].interval>=a;)d.onNext(e.shift().value)},d.onError.bind(d),function(){for(var c=b.now();e.length>0&&c-e[0].interval>=a;)d.onNext(e.shift().value);d.onCompleted()})})},m.takeLastWithTime=function(a,b,c){return this.takeLastBufferWithTime(a,b).selectMany(function(a){return s(a,c)})},m.takeLastBufferWithTime=function(a,b){var c=this;return b||(b=t),new n(function(d){var e=[];return c.subscribe(function(c){var d=b.now();for(e.push({interval:d,value:c});e.length>0&&d-e[0].interval>=a;)e.shift()},d.onError.bind(d),function(){for(var c=b.now(),f=[];e.length>0;){var g=e.shift();c-g.interval<=a&&f.push(g.value)}d.onNext(f),d.onCompleted()})})},m.takeWithTime=function(a,b){var c=this;return b||(b=t),new n(function(d){var e=b.scheduleWithRelative(a,function(){d.onCompleted()});return new w(e,c.subscribe(d))})},m.skipWithTime=function(a,b){var c=this;return b||(b=t),new n(function(d){var e=!1,f=b.scheduleWithRelative(a,function(){e=!0}),g=c.subscribe(function(a){e&&d.onNext(a)},d.onError.bind(d),d.onCompleted.bind(d));return new w(f,g)})},m.skipUntilWithTime=function(a,b){b||(b=t);var c=this;return new n(function(d){var e=!1,f=b.scheduleWithAbsolute(a,function(){e=!0}),g=c.subscribe(function(a){e&&d.onNext(a)},d.onError.bind(d),d.onCompleted.bind(d));return new w(f,g)})},m.takeUntilWithTime=function(a,b){b||(b=t);var c=this;return new n(function(d){return new w(b.scheduleWithAbsolute(a,function(){d.onCompleted()}),c.subscribe(d))})},c});
1
+ (function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx","exports"],function(b,d){return c.Rx=a(c,d,b),c.Rx}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c,d){function e(a,b){return new n(function(c){return b.scheduleWithAbsolute(a,function(){c.onNext(0),c.onCompleted()})})}function f(a,b,c){var d=A(b);return new n(function(b){var e=0,f=a;return c.scheduleRecursiveWithAbsolute(f,function(a){var g;d>0&&(g=c.now(),f+=d,g>=f&&(f=g+d)),b.onNext(e++),a(f)})})}function g(a,b){var c=A(a);return new n(function(a){return b.scheduleWithRelative(c,function(){a.onNext(0),a.onCompleted()})})}function h(a,b,c){return a===b?new n(function(a){return c.schedulePeriodicWithState(0,b,function(b){return a.onNext(b),b+1})}):o(function(){return f(c.now()+a,b,c)})}function i(a,b){var c=this;return new n(function(d){var e,f=!1,g=new v,h=null,i=[],j=!1;return e=c.materialize().timestamp(b).subscribe(function(c){var e,k;"E"===c.value.kind?(i=[],i.push(c),h=c.value.exception,k=!j):(i.push({value:c.value,timestamp:c.timestamp+a}),k=!f,f=!0),k&&(null!==h?d.onError(h):(e=new u,g.setDisposable(e),e.setDisposable(b.scheduleRecursiveWithRelative(a,function(a){var c,e,g,k;if(null===h){j=!0;do g=null,i.length>0&&i[0].timestamp-b.now()<=0&&(g=i.shift().value),null!==g&&g.accept(d);while(null!==g);k=!1,e=0,i.length>0?(k=!0,e=Math.max(0,i[0].timestamp-b.now())):f=!1,c=h,j=!1,null!==c?d.onError(c):k&&a(e)}}))))}),new w(e,g)})}function j(a,b){var c=this;return o(function(){var d=a-b.now();return i.call(c,d,b)})}function k(a,b){return new n(function(c){function d(){g&&(g=!1,c.onNext(f)),e&&c.onCompleted()}var e,f,g;return new w(a.subscribe(function(a){g=!0,f=a},c.onError.bind(c),function(){e=!0}),b.subscribe(d,c.onError.bind(c),d))})}var l=c.Observable,m=l.prototype,n=c.AnonymousObservable,o=l.defer,p=l.empty,q=l.never,r=l.throwException,s=l.fromArray,t=c.Scheduler.timeout,u=c.SingleAssignmentDisposable,v=c.SerialDisposable,w=c.CompositeDisposable,x=c.RefCountDisposable,y=c.Subject,z=c.internals.addRef,A=c.Scheduler.normalize,B=l.interval=function(a,b){return b||(b=t),h(a,a,b)},C=l.timer=function(a,b,c){var i;return c||(c=t),b!==d&&"number"==typeof b?i=b:b!==d&&"object"==typeof b&&(c=b),a instanceof Date&&i===d?e(a.getTime(),c):a instanceof Date&&i!==d?(i=b,f(a.getTime(),i,c)):i===d?g(a,c):h(a,i,c)};return m.delay=function(a,b){return b||(b=t),a instanceof Date?j.call(this,a.getTime(),b):i.call(this,a,b)},m.throttle=function(a,b){b||(b=t);return this.throttleWithSelector(function(){return C(a,b)})},m.windowWithTime=function(a,b,c){var e,f=this;return b===d&&(e=a),c===d&&(c=t),"number"==typeof b?e=b:"object"==typeof b&&(e=a,c=b),new n(function(b){function d(){var a=new u,f=!1,g=!1;l.setDisposable(a),j===i?(f=!0,g=!0):i>j?f=!0:g=!0;var n=f?j:i,o=n-m;m=n,f&&(j+=e),g&&(i+=e),a.setDisposable(c.scheduleWithRelative(o,function(){var a;g&&(a=new y,k.push(a),b.onNext(z(a,h))),f&&(a=k.shift(),a.onCompleted()),d()}))}var g,h,i=e,j=a,k=[],l=new v,m=0;return g=new w(l),h=new x(g),k.push(new y),b.onNext(z(k[0],h)),d(),g.add(f.subscribe(function(a){var b,c;for(b=0;b<k.length;b++)c=k[b],c.onNext(a)},function(a){var c,d;for(c=0;c<k.length;c++)d=k[c],d.onError(a);b.onError(a)},function(){var a,c;for(a=0;a<k.length;a++)c=k[a],c.onCompleted();b.onCompleted()})),h})},m.windowWithTimeOrCount=function(a,b,c){var d=this;return c||(c=t),new n(function(e){var f,g,h,i,j=0,k=new v,l=0;return g=new w(k),h=new x(g),f=function(b){var d=new u;k.setDisposable(d),d.setDisposable(c.scheduleWithRelative(a,function(){var a;b===l&&(j=0,a=++l,i.onCompleted(),i=new y,e.onNext(z(i,h)),f(a))}))},i=new y,e.onNext(z(i,h)),f(0),g.add(d.subscribe(function(a){var c=0,d=!1;i.onNext(a),j++,j===b&&(d=!0,j=0,c=++l,i.onCompleted(),i=new y,e.onNext(z(i,h))),d&&f(c)},function(a){i.onError(a),e.onError(a)},function(){i.onCompleted(),e.onCompleted()})),h})},m.bufferWithTime=function(){return this.windowWithTime.apply(this,arguments).selectMany(function(a){return a.toArray()})},m.bufferWithTimeOrCount=function(a,b,c){return this.windowWithTimeOrCount(a,b,c).selectMany(function(a){return a.toArray()})},m.timeInterval=function(a){var b=this;return a||(a=t),o(function(){var c=a.now();return b.select(function(b){var d=a.now(),e=d-c;return c=d,{value:b,interval:e}})})},m.timestamp=function(a){return a||(a=t),this.select(function(b){return{value:b,timestamp:a.now()}})},m.sample=function(a,b){return b||(b=t),"number"==typeof a?k(this,B(a,b)):k(this,a)},m.timeout=function(a,b,c){var d,e=this;return b||(b=r(new Error("Timeout"))),c||(c=t),d=a instanceof Date?function(a,b){c.scheduleWithAbsolute(a,b)}:function(a,b){c.scheduleWithRelative(a,b)},new n(function(c){var f,g=0,h=new u,i=new v,j=!1,k=new v;return i.setDisposable(h),f=function(){var e=g;k.setDisposable(d(a,function(){j=g===e;var a=j;a&&i.setDisposable(b.subscribe(c))}))},f(),h.setDisposable(e.subscribe(function(a){var b=!j;b&&(g++,c.onNext(a),f())},function(a){var b=!j;b&&(g++,c.onError(a))},function(){var a=!j;a&&(g++,c.onCompleted())})),new w(i,k)})},l.generateWithAbsoluteTime=function(a,b,c,d,e,f){return f||(f=t),new n(function(g){var h,i,j=!0,k=!1,l=a;return f.scheduleRecursiveWithAbsolute(f.now(),function(a){k&&g.onNext(h);try{j?j=!1:l=c(l),k=b(l),k&&(h=d(l),i=e(l))}catch(f){return g.onError(f),void 0}k?a(i):g.onCompleted()})})},l.generateWithRelativeTime=function(a,b,c,d,e,f){return f||(f=t),new n(function(g){var h,i,j=!0,k=!1,l=a;return f.scheduleRecursiveWithRelative(0,function(a){k&&g.onNext(h);try{j?j=!1:l=c(l),k=b(l),k&&(h=d(l),i=e(l))}catch(f){return g.onError(f),void 0}k?a(i):g.onCompleted()})})},m.delaySubscription=function(a,b){return b||(b=t),this.delayWithSelector(C(a,b),function(){return p()})},m.delayWithSelector=function(a,b){var c,d,e=this;return"function"==typeof a?d=a:(c=a,d=b),new n(function(a){var b=new w,f=!1,g=function(){f&&0===b.length&&a.onCompleted()},h=new v,i=function(){h.setDisposable(e.subscribe(function(c){var e;try{e=d(c)}catch(f){return a.onError(f),void 0}var h=new u;b.add(h),h.setDisposable(e.subscribe(function(){a.onNext(c),b.remove(h),g()},a.onError.bind(a),function(){a.onNext(c),b.remove(h),g()}))},a.onError.bind(a),function(){f=!0,h.dispose(),g()}))};return c?h.setDisposable(c.subscribe(function(){i()},a.onError.bind(a),function(){i()})):i(),new w(h,b)})},m.timeoutWithSelector=function(a,b,c){if(1===arguments.length){b=a;var a=q()}c||(c=r(new Error("Timeout")));var d=this;return new n(function(e){var f=new v,g=new v,h=new u;f.setDisposable(h);var i=0,j=!1,k=function(a){var b=i,d=function(){return i===b},h=new u;g.setDisposable(h),h.setDisposable(a.subscribe(function(){d()&&f.setDisposable(c.subscribe(e)),h.dispose()},function(a){d()&&e.onError(a)},function(){d()&&f.setDisposable(c.subscribe(e))}))};k(a);var l=function(){var a=!j;return a&&i++,a};return h.setDisposable(d.subscribe(function(a){if(l()){e.onNext(a);var c;try{c=b(a)}catch(d){return e.onError(d),void 0}k(c)}},function(a){l()&&e.onError(a)},function(){l()&&e.onCompleted()})),new w(f,g)})},m.throttleWithSelector=function(a){var b=this;return new n(function(c){var d,e=!1,f=new v,g=0,h=b.subscribe(function(b){var h;try{h=a(b)}catch(i){return c.onError(i),void 0}e=!0,d=b,g++;var j=g,k=new u;f.setDisposable(k),k.setDisposable(h.subscribe(function(){e&&g===j&&c.onNext(d),e=!1,k.dispose()},c.onError.bind(c),function(){e&&g===j&&c.onNext(d),e=!1,k.dispose()}))},function(a){f.dispose(),c.onError(a),e=!1,g++},function(){f.dispose(),e&&c.onNext(d),c.onCompleted(),e=!1,g++});return new w(h,f)})},m.skipLastWithTime=function(a,b){b||(b=t);var c=this;return new n(function(d){var e=[];return c.subscribe(function(c){var f=b.now();for(e.push({interval:f,value:c});e.length>0&&f-e[0].interval>=a;)d.onNext(e.shift().value)},d.onError.bind(d),function(){for(var c=b.now();e.length>0&&c-e[0].interval>=a;)d.onNext(e.shift().value);d.onCompleted()})})},m.takeLastWithTime=function(a,b,c){return this.takeLastBufferWithTime(a,b).selectMany(function(a){return s(a,c)})},m.takeLastBufferWithTime=function(a,b){var c=this;return b||(b=t),new n(function(d){var e=[];return c.subscribe(function(c){var d=b.now();for(e.push({interval:d,value:c});e.length>0&&d-e[0].interval>=a;)e.shift()},d.onError.bind(d),function(){for(var c=b.now(),f=[];e.length>0;){var g=e.shift();c-g.interval<=a&&f.push(g.value)}d.onNext(f),d.onCompleted()})})},m.takeWithTime=function(a,b){var c=this;return b||(b=t),new n(function(d){var e=b.scheduleWithRelative(a,function(){d.onCompleted()});return new w(e,c.subscribe(d))})},m.skipWithTime=function(a,b){var c=this;return b||(b=t),new n(function(d){var e=!1,f=b.scheduleWithRelative(a,function(){e=!0}),g=c.subscribe(function(a){e&&d.onNext(a)},d.onError.bind(d),d.onCompleted.bind(d));return new w(f,g)})},m.skipUntilWithTime=function(a,b){b||(b=t);var c=this;return new n(function(d){var e=!1,f=b.scheduleWithAbsolute(a,function(){e=!0}),g=c.subscribe(function(a){e&&d.onNext(a)},d.onError.bind(d),d.onCompleted.bind(d));return new w(f,g)})},m.takeUntilWithTime=function(a,b){b||(b=t);var c=this;return new n(function(d){return new w(b.scheduleWithAbsolute(a,function(){d.onCompleted()}),c.subscribe(d))})},c});
@@ -35,13 +35,13 @@
35
35
 
36
36
  // Aliases
37
37
  var Scheduler = Rx.Scheduler,
38
- PriorityQueue = Rx.Internals.PriorityQueue,
39
- ScheduledItem = Rx.Internals.ScheduledItem,
40
- SchedulePeriodicRecursive = Rx.Internals.SchedulePeriodicRecursive,
38
+ PriorityQueue = Rx.internals.PriorityQueue,
39
+ ScheduledItem = Rx.internals.ScheduledItem,
40
+ SchedulePeriodicRecursive = Rx.internals.SchedulePeriodicRecursive,
41
41
  disposableEmpty = Rx.Disposable.empty,
42
- inherits = Rx.Internals.inherits;
42
+ inherits = Rx.internals.inherits;
43
43
 
44
- function defaultSubComparer(x, y) { return x - y; }
44
+ function defaultSubComparer(x, y) { return x > y ? 1 : (x < y ? -1 : 0); }
45
45
 
46
46
  /** Provides a set of extension methods for virtual time scheduling. */
47
47
  Rx.VirtualTimeScheduler = (function (_super) {
@@ -1 +1 @@
1
- (function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx","exports"],function(b,d){return c.Rx=a(c,d,b),c.Rx}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c){function d(a,b){return a-b}var e=c.Scheduler,f=c.Internals.PriorityQueue,g=c.Internals.ScheduledItem,h=c.Internals.SchedulePeriodicRecursive,i=c.Disposable.empty,j=c.Internals.inherits;return c.VirtualTimeScheduler=function(a){function b(){throw new Error("Not implemented")}function c(){return this.toDateTimeOffset(this.clock)}function d(a,b){return this.scheduleAbsoluteWithState(a,this.clock,b)}function e(a,b,c){return this.scheduleRelativeWithState(a,this.toRelative(b),c)}function k(a,b,c){return this.scheduleRelativeWithState(a,this.toRelative(b-this.now()),c)}function l(a,b){return b(),i}function m(b,g){this.clock=b,this.comparer=g,this.isEnabled=!1,this.queue=new f(1024),a.call(this,c,d,e,k)}j(m,a);var n=m.prototype;return n.add=b,n.toDateTimeOffset=b,n.toRelative=b,n.schedulePeriodicWithState=function(a,b,c){var d=new h(this,a,b,c);return d.start()},n.scheduleRelativeWithState=function(a,b,c){var d=this.add(this.clock,b);return this.scheduleAbsoluteWithState(a,d,c)},n.scheduleRelative=function(a,b){return this.scheduleRelativeWithState(b,a,l)},n.start=function(){var a;if(!this.isEnabled){this.isEnabled=!0;do a=this.getNext(),null!==a?(this.comparer(a.dueTime,this.clock)>0&&(this.clock=a.dueTime),a.invoke()):this.isEnabled=!1;while(this.isEnabled)}},n.stop=function(){this.isEnabled=!1},n.advanceTo=function(a){var b,c=this.comparer(this.clock,a);if(this.comparer(this.clock,a)>0)throw new Error(argumentOutOfRange);if(0!==c&&!this.isEnabled){this.isEnabled=!0;do b=this.getNext(),null!==b&&this.comparer(b.dueTime,a)<=0?(this.comparer(b.dueTime,this.clock)>0&&(this.clock=b.dueTime),b.invoke()):this.isEnabled=!1;while(this.isEnabled);this.clock=a}},n.advanceBy=function(a){var b=this.add(this.clock,a),c=this.comparer(this.clock,b);if(c>0)throw new Error(argumentOutOfRange);0!==c&&this.advanceTo(b)},n.sleep=function(a){var b=this.add(this.clock,a);if(this.comparer(this.clock,b)>=0)throw new Error(argumentOutOfRange);this.clock=b},n.getNext=function(){for(var a;this.queue.length>0;){if(a=this.queue.peek(),!a.isCancelled())return a;this.queue.dequeue()}return null},n.scheduleAbsolute=function(a,b){return this.scheduleAbsoluteWithState(b,a,l)},n.scheduleAbsoluteWithState=function(a,b,c){var d=this,e=function(a,b){return d.queue.remove(f),c(a,b)},f=new g(d,a,e,b,d.comparer);return d.queue.enqueue(f),f.disposable},m}(e),c.HistoricalScheduler=function(a){function b(b,c){var e=null==b?0:b,f=c||d;a.call(this,e,f)}j(b,a);var c=b.prototype;return c.add=function(a,b){return a+b},c.toDateTimeOffset=function(a){return new Date(a).getTime()},c.toRelative=function(a){return a},b}(c.VirtualTimeScheduler),c});
1
+ (function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx","exports"],function(b,d){return c.Rx=a(c,d,b),c.Rx}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c){function d(a,b){return a>b?1:b>a?-1:0}var e=c.Scheduler,f=c.internals.PriorityQueue,g=c.internals.ScheduledItem,h=c.internals.SchedulePeriodicRecursive,i=c.Disposable.empty,j=c.internals.inherits;return c.VirtualTimeScheduler=function(a){function b(){throw new Error("Not implemented")}function c(){return this.toDateTimeOffset(this.clock)}function d(a,b){return this.scheduleAbsoluteWithState(a,this.clock,b)}function e(a,b,c){return this.scheduleRelativeWithState(a,this.toRelative(b),c)}function k(a,b,c){return this.scheduleRelativeWithState(a,this.toRelative(b-this.now()),c)}function l(a,b){return b(),i}function m(b,g){this.clock=b,this.comparer=g,this.isEnabled=!1,this.queue=new f(1024),a.call(this,c,d,e,k)}j(m,a);var n=m.prototype;return n.add=b,n.toDateTimeOffset=b,n.toRelative=b,n.schedulePeriodicWithState=function(a,b,c){var d=new h(this,a,b,c);return d.start()},n.scheduleRelativeWithState=function(a,b,c){var d=this.add(this.clock,b);return this.scheduleAbsoluteWithState(a,d,c)},n.scheduleRelative=function(a,b){return this.scheduleRelativeWithState(b,a,l)},n.start=function(){var a;if(!this.isEnabled){this.isEnabled=!0;do a=this.getNext(),null!==a?(this.comparer(a.dueTime,this.clock)>0&&(this.clock=a.dueTime),a.invoke()):this.isEnabled=!1;while(this.isEnabled)}},n.stop=function(){this.isEnabled=!1},n.advanceTo=function(a){var b,c=this.comparer(this.clock,a);if(this.comparer(this.clock,a)>0)throw new Error(argumentOutOfRange);if(0!==c&&!this.isEnabled){this.isEnabled=!0;do b=this.getNext(),null!==b&&this.comparer(b.dueTime,a)<=0?(this.comparer(b.dueTime,this.clock)>0&&(this.clock=b.dueTime),b.invoke()):this.isEnabled=!1;while(this.isEnabled);this.clock=a}},n.advanceBy=function(a){var b=this.add(this.clock,a),c=this.comparer(this.clock,b);if(c>0)throw new Error(argumentOutOfRange);0!==c&&this.advanceTo(b)},n.sleep=function(a){var b=this.add(this.clock,a);if(this.comparer(this.clock,b)>=0)throw new Error(argumentOutOfRange);this.clock=b},n.getNext=function(){for(var a;this.queue.length>0;){if(a=this.queue.peek(),!a.isCancelled())return a;this.queue.dequeue()}return null},n.scheduleAbsolute=function(a,b){return this.scheduleAbsoluteWithState(b,a,l)},n.scheduleAbsoluteWithState=function(a,b,c){var d=this,e=function(a,b){return d.queue.remove(f),c(a,b)},f=new g(d,a,e,b,d.comparer);return d.queue.enqueue(f),f.disposable},m}(e),c.HistoricalScheduler=function(a){function b(b,c){var e=null==b?0:b,f=c||d;a.call(this,e,f)}j(b,a);var c=b.prototype;return c.add=function(a,b){return a+b},c.toDateTimeOffset=function(a){return new Date(a).getTime()},c.toRelative=function(a){return a},b}(c.VirtualTimeScheduler),c});