rxjs-rails 2.3.20 → 2.3.22

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  /* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.*/
2
- (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"],function(b,d){return a(c,d,b)}):"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(){if(this.isDisposed)throw new Error(r)}function f(a,b,c){return new i(function(d){function e(a,b){k[b]=a;var e;if(g[b]=!0,h||(h=g.every(q))){if(f)return void d.onError(f);try{e=c.apply(null,k)}catch(j){return void d.onError(j)}d.onNext(e)}i&&k[1]&&d.onCompleted()}var f,g=[!1,!1],h=!1,i=!1,k=new Array(2);return new j(a.subscribe(function(a){e(a,0)},function(a){k[1]?d.onError(a):f=a},function(){i=!0,k[1]&&d.onCompleted()}),b.subscribe(function(a){e(a,1)},d.onError.bind(d),function(){i=!0,e(!0,1)}))})}var g=c.Observable,h=g.prototype,i=c.AnonymousObservable,j=c.CompositeDisposable,k=c.Subject,l=c.Observer,m=c.Disposable.empty,n=c.Disposable.create,o=c.internals.inherits,p=c.internals.addProperties,q=(c.Scheduler.timeout,c.helpers.identity),r="Object has been disposed",s=function(a){function b(a){var b=this.source.publish(),c=b.subscribe(a),d=m,e=this.pauser.distinctUntilChanged().subscribe(function(a){a?d=b.connect():(d.dispose(),d=m)});return new j(c,d,e)}function c(c,d){this.source=c,this.controller=new k,this.pauser=d&&d.subscribe?this.controller.merge(d):this.controller,a.call(this,b)}return o(c,a),c.prototype.pause=function(){this.controller.onNext(!1)},c.prototype.resume=function(){this.controller.onNext(!0)},c}(g);h.pausable=function(a){return new s(this,a)};var t=function(a){function b(a){var b,c=[],e=f(this.source,this.pauser.distinctUntilChanged().startWith(!1),function(a,b){return{data:a,shouldFire:b}}).subscribe(function(e){if(b!==d&&e.shouldFire!=b){if(b=e.shouldFire,e.shouldFire)for(;c.length>0;)a.onNext(c.shift())}else b=e.shouldFire,e.shouldFire?a.onNext(e.data):c.push(e.data)},function(b){for(;c.length>0;)a.onNext(c.shift());a.onError(b)},function(){for(;c.length>0;)a.onNext(c.shift());a.onCompleted()});return e}function c(c,d){this.source=c,this.controller=new k,this.pauser=d&&d.subscribe?this.controller.merge(d):this.controller,a.call(this,b)}return o(c,a),c.prototype.pause=function(){this.controller.onNext(!1)},c.prototype.resume=function(){this.controller.onNext(!0)},c}(g);h.pausableBuffered=function(a){return new t(this,a)},h.controlled=function(a){return null==a&&(a=!0),new u(this,a)};var u=function(a){function b(a){return this.source.subscribe(a)}function c(c,d){a.call(this,b),this.subject=new v(d),this.source=c.multicast(this.subject).refCount()}return o(c,a),c.prototype.request=function(a){return null==a&&(a=-1),this.subject.request(a)},c}(g),v=c.ControlledSubject=function(a){function b(a){return this.subject.subscribe(a)}function c(c){null==c&&(c=!0),a.call(this,b),this.subject=new k,this.enableQueue=c,this.queue=c?[]:null,this.requestedCount=0,this.requestedDisposable=m,this.error=null,this.hasFailed=!1,this.hasCompleted=!1,this.controlledDisposable=m}return o(c,a),p(c.prototype,l,{onCompleted:function(){e.call(this),this.hasCompleted=!0,this.enableQueue&&0!==this.queue.length||this.subject.onCompleted()},onError:function(a){e.call(this),this.hasFailed=!0,this.error=a,this.enableQueue&&0!==this.queue.length||this.subject.onError(a)},onNext:function(a){e.call(this);var b=!1;0===this.requestedCount?this.enableQueue&&this.queue.push(a):(-1!==this.requestedCount&&0===this.requestedCount--&&this.disposeCurrentRequest(),b=!0),b&&this.subject.onNext(a)},_processRequest:function(a){if(this.enableQueue){for(;this.queue.length>=a&&a>0;)this.subject.onNext(this.queue.shift()),a--;return 0!==this.queue.length?{numberOfItems:a,returnValue:!0}:{numberOfItems:a,returnValue:!1}}return this.hasFailed?(this.subject.onError(this.error),this.controlledDisposable.dispose(),this.controlledDisposable=m):this.hasCompleted&&(this.subject.onCompleted(),this.controlledDisposable.dispose(),this.controlledDisposable=m),{numberOfItems:a,returnValue:!1}},request:function(a){e.call(this),this.disposeCurrentRequest();var b=this,c=this._processRequest(a);return a=c.numberOfItems,c.returnValue?m:(this.requestedCount=a,this.requestedDisposable=n(function(){b.requestedCount=0}),this.requestedDisposable)},disposeCurrentRequest:function(){this.requestedDisposable.dispose(),this.requestedDisposable=m},dispose:function(){this.isDisposed=!0,this.error=null,this.subject.dispose(),this.requestedDisposable.dispose()}}),c}(g);return c});
2
+ (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"],function(b,d){return a(c,d,b)}):"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,c){return new h(function(d){function e(a,b){k[b]=a;var e;if(g[b]=!0,h||(h=g.every(r))){if(f)return void d.onError(f);try{e=c.apply(null,k)}catch(j){return void d.onError(j)}d.onNext(e)}i&&k[1]&&d.onCompleted()}var f,g=[!1,!1],h=!1,i=!1,k=new Array(2);return new j(a.subscribe(function(a){e(a,0)},function(a){k[1]?d.onError(a):f=a},function(){i=!0,k[1]&&d.onCompleted()}),b.subscribe(function(a){e(a,1)},d.onError.bind(d),function(){i=!0,e(!0,1)}))},a)}var f=c.Observable,g=f.prototype,h=c.AnonymousObservable,i=c.internals.AbstractObserver,j=c.CompositeDisposable,k=c.Subject,l=c.Observer,m=c.Disposable.empty,n=c.Disposable.create,o=c.internals.inherits,p=c.internals.addProperties,q=c.Scheduler.timeout,r=(c.Scheduler.currentThread,c.helpers.identity),s=function(a){function b(a){var b=this.source.publish(),c=b.subscribe(a),d=m,e=this.pauser.distinctUntilChanged().subscribe(function(a){a?d=b.connect():(d.dispose(),d=m)});return new j(c,d,e)}function c(c,d){this.source=c,this.controller=new k,this.pauser=d&&d.subscribe?this.controller.merge(d):this.controller,a.call(this,b,c)}return o(c,a),c.prototype.pause=function(){this.controller.onNext(!1)},c.prototype.resume=function(){this.controller.onNext(!0)},c}(f);g.pausable=function(a){return new s(this,a)};var t=function(a){function b(a){var b,c=[],f=e(this.source,this.pauser.distinctUntilChanged().startWith(!1),function(a,b){return{data:a,shouldFire:b}}).subscribe(function(e){if(b!==d&&e.shouldFire!=b){if(b=e.shouldFire,e.shouldFire)for(;c.length>0;)a.onNext(c.shift())}else b=e.shouldFire,e.shouldFire?a.onNext(e.data):c.push(e.data)},function(b){for(;c.length>0;)a.onNext(c.shift());a.onError(b)},function(){for(;c.length>0;)a.onNext(c.shift());a.onCompleted()});return f}function c(c,d){this.source=c,this.controller=new k,this.pauser=d&&d.subscribe?this.controller.merge(d):this.controller,a.call(this,b,c)}return o(c,a),c.prototype.pause=function(){this.controller.onNext(!1)},c.prototype.resume=function(){this.controller.onNext(!0)},c}(f);g.pausableBuffered=function(a){return new t(this,a)};var u=function(a){function b(a){return this.source.subscribe(a)}function c(c,d){a.call(this,b,c),this.subject=new v(d),this.source=c.multicast(this.subject).refCount()}return o(c,a),c.prototype.request=function(a){return null==a&&(a=-1),this.subject.request(a)},c}(f),v=function(a){function b(a){return this.subject.subscribe(a)}function c(c){null==c&&(c=!0),a.call(this,b),this.subject=new k,this.enableQueue=c,this.queue=c?[]:null,this.requestedCount=0,this.requestedDisposable=m,this.error=null,this.hasFailed=!1,this.hasCompleted=!1,this.controlledDisposable=m}return o(c,a),p(c.prototype,l,{onCompleted:function(){this.hasCompleted=!0,(!this.enableQueue||0===this.queue.length)&&this.subject.onCompleted()},onError:function(a){this.hasFailed=!0,this.error=a,(!this.enableQueue||0===this.queue.length)&&this.subject.onError(a)},onNext:function(a){var b=!1;0===this.requestedCount?this.enableQueue&&this.queue.push(a):(-1!==this.requestedCount&&0===this.requestedCount--&&this.disposeCurrentRequest(),b=!0),b&&this.subject.onNext(a)},_processRequest:function(a){if(this.enableQueue){for(;this.queue.length>=a&&a>0;)this.subject.onNext(this.queue.shift()),a--;return 0!==this.queue.length?{numberOfItems:a,returnValue:!0}:{numberOfItems:a,returnValue:!1}}return this.hasFailed?(this.subject.onError(this.error),this.controlledDisposable.dispose(),this.controlledDisposable=m):this.hasCompleted&&(this.subject.onCompleted(),this.controlledDisposable.dispose(),this.controlledDisposable=m),{numberOfItems:a,returnValue:!1}},request:function(a){this.disposeCurrentRequest();var b=this,c=this._processRequest(a),a=c.numberOfItems;return c.returnValue?m:(this.requestedCount=a,this.requestedDisposable=n(function(){b.requestedCount=0}),this.requestedDisposable)},disposeCurrentRequest:function(){this.requestedDisposable.dispose(),this.requestedDisposable=m}}),c}(f);g.controlled=function(a){return null==a&&(a=!0),new u(this,a)};var w=function(a){function b(a){this.subscription=this.source.subscribe(new d(a,this,this.subscription));var b=this;return q.schedule(function(){b.source.request(1)}),this.subscription}function c(c){a.call(this,b,c),this.source=c}o(c,a);var d=function(a){function b(b,c,d){a.call(this),this.observer=b,this.observable=c,this.cancel=d}o(b,a);var c=b.prototype;return c.completed=function(){this.observer.onCompleted(),this.dispose()},c.error=function(a){this.observer.onError(a),this.dispose()},c.next=function(a){this.observer.onNext(a);var b=this;q.schedule(function(){b.observable.source.request(1)})},c.dispose=function(){this.observer=null,this.cancel&&(this.cancel.dispose(),this.cancel=null),a.prototype.dispose.call(this)},b}(i);return c}(f);u.prototype.stopAndWait=function(){return new w(this)};var x=function(a){function b(a){this.subscription=this.source.subscribe(new d(a,this,this.subscription));var b=this;return q.schedule(function(){b.source.request(b.windowSize)}),this.subscription}function c(c,d){a.call(this,b,c),this.source=c,this.windowSize=d}o(c,a);var d=function(a){function b(a,b,c){this.observer=a,this.observable=b,this.cancel=c,this.received=0}o(b,a);var c=b.prototype;return c.completed=function(){this.observer.onCompleted(),this.dispose()},c.error=function(a){this.observer.onError(a),this.dispose()},c.next=function(a){if(this.observer.onNext(a),this.received=++this.received%this.observable.windowSize,0===this.received){var b=this;q.schedule(function(){b.observable.source.request(b.observable.windowSize)})}},c.dispose=function(){this.observer=null,this.cancel&&(this.cancel.dispose(),this.cancel=null),a.prototype.dispose.call(this)},b}(i);return c}(f);return u.prototype.windowed=function(a){return new x(this,a)},c});
3
3
  //# sourceMappingURL=rx.backpressure.map
@@ -122,8 +122,6 @@
122
122
  }
123
123
  var fileName = fileNameAndLineNumber[0], lineNumber = fileNameAndLineNumber[1];
124
124
 
125
- console.log(rFileName, rStartingLine, rEndingLine);
126
-
127
125
  return fileName === rFileName &&
128
126
  lineNumber >= rStartingLine &&
129
127
  lineNumber <= rEndingLine;
@@ -211,6 +209,14 @@
211
209
  stringProto = String.prototype,
212
210
  propertyIsEnumerable = objectProto.propertyIsEnumerable;
213
211
 
212
+ // Fix for Tessel
213
+ if (!propertyIsEnumerable) {
214
+ propertyIsEnumerable = objectProto.propertyIsEnumerable = function (key) {
215
+ for (var k in this) { if (k === key) { return true; } }
216
+ return false;
217
+ };
218
+ }
219
+
214
220
  try {
215
221
  supportNodeClass = !(toString.call(document) == objectClass && !({ 'toString': 0 } + ''));
216
222
  } catch (e) {
@@ -2191,16 +2197,18 @@ if (!Array.prototype.forEach) {
2191
2197
 
2192
2198
  var self = this;
2193
2199
  this._subscribe = function (observer) {
2200
+ var oldOnError = observer.onError.bind(observer);
2201
+
2194
2202
  observer.onError = function (err) {
2195
- makeStackTraceLong(self, err);
2196
- observer.onError(err);
2203
+ makeStackTraceLong(err, self);
2204
+ oldOnError(err);
2197
2205
  };
2198
2206
 
2199
- subscribe(observer);
2207
+ return subscribe(observer);
2200
2208
  };
2209
+ } else {
2210
+ this._subscribe = subscribe;
2201
2211
  }
2202
-
2203
- this._subscribe = subscribe;
2204
2212
  }
2205
2213
 
2206
2214
  observableProto = Observable.prototype;
@@ -4285,7 +4293,7 @@ if (!Array.prototype.forEach) {
4285
4293
  return source.subscribe(function (value) {
4286
4294
  var shouldRun;
4287
4295
  try {
4288
- shouldRun = predicate.call(thisArg, value, count++, parent);
4296
+ shouldRun = predicate.call(thisArg, value, count++, source);
4289
4297
  } catch (e) {
4290
4298
  observer.onError(e);
4291
4299
  return;
@@ -1,4 +1,4 @@
1
1
  /* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.*/
2
- (function(a){function b(){if(this.isDisposed)throw new Error(Z)}function c(a,b){if($&&b.stack&&"object"==typeof a&&null!==a&&a.stack&&-1===a.stack.indexOf(cb)){for(var c=[],e=b;e;e=e.source)e.stack&&c.unshift(e.stack);c.unshift(a.stack);var f=c.join("\n"+cb+"\n");a.stack=d(f)}}function d(a){for(var b=a.split("\n"),c=[],d=0,g=b.length;g>d;d++){var h=b[d];e(h)||f(h)||!h||c.push(h)}return c.join("\n")}function e(a){var b=h(a);if(!b)return!1;var c=b[0],d=b[1];return console.log(ab,bb,Oc),c===ab&&d>=bb&&Oc>=d}function f(a){return-1!==a.indexOf("(module.js:")||-1!==a.indexOf("(node.js:")}function g(){if($)try{throw new Error}catch(a){var b=a.stack.split("\n"),c=b[0].indexOf("@")>0?b[1]:b[2],d=h(c);if(!d)return;return ab=d[0],d[1]}}function h(a){var b=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(a);if(b)return[b[1],Number(b[2])];var c=/at ([^ ]+):(\d+):(?:\d+)$/.exec(a);if(c)return[c[1],Number(c[2])];var d=/.*@(.+):(\d+)$/.exec(a);return d?[d[1],Number(d[2])]:void 0}function i(a){var b=typeof a;return a&&("function"==b||"object"==b)||!1}function j(a){var b=[];if(!i(a))return b;Cb.nonEnumArgs&&a.length&&Db(a)&&(a=Fb.call(a));var c=Cb.enumPrototypes&&"function"==typeof a,d=Cb.enumErrorProps&&(a===wb||a instanceof Error);for(var e in a)c&&"prototype"==e||d&&("message"==e||"name"==e)||b.push(e);if(Cb.nonEnumShadows&&a!==xb){var f=a.constructor,g=-1,h=Ab.length;if(a===(f&&f.prototype))var j=a===yb?sb:a===wb?nb:tb.call(a),k=Bb[j];for(;++g<h;)e=Ab[g],k&&k[e]||!ub.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,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=tb.call(a),h=tb.call(b);if(g==jb&&(g=qb),h==jb&&(h=qb),g!=h)return!1;switch(g){case lb:case mb:return+a==+b;case pb:return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case rb:case sb:return a==String(b)}var i=g==kb;if(!i){if(g!=qb||!Cb.nodeClass&&(m(a)||m(b)))return!1;var j=!Cb.argsObject&&Db(a)?Object:a.constructor,k=!Cb.argsObject&&Db(b)?Object:b.constructor;if(!(j==k||ub.call(a,"constructor")&&ub.call(b,"constructor")||X(j)&&j instanceof j&&X(k)&&k instanceof k||!("constructor"in a&&"constructor"in b)))return!1}c||(c=[]),d||(d=[]);for(var o=c.length;o--;)if(c[o]==a)return d[o]==b;var p=0,q=!0;if(c.push(a),d.push(b),i){if(o=a.length,p=b.length,q=p==o)for(;p--;){var r=b[p];if(!(q=n(a[p],r,c,d)))break}}else l(b,function(b,e,f){return ub.call(f,e)?(p++,q=ub.call(a,e)&&n(a[e],b,c,d)):void 0}),q&&l(a,function(a,b,c){return ub.call(c,b)?q=--p>-1:void 0});return c.pop(),d.pop(),q}function o(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:Fb.call(a)}function p(a,b){for(var c=new Array(a),d=0;a>d;d++)c[d]=b();return c}function q(a,b){this.id=a,this.value=b}function r(a,b){this.scheduler=a,this.disposable=b,this.isDisposed=!1}function t(){this._s=s}function u(){this._s=s,this._l=s.length,this._i=0}function v(a){this._a=a}function w(a){this._a=a,this._l=A(a),this._i=0}function x(a){return"number"==typeof a&&J.isFinite(a)}function y(b){var c,d=b[db];if(!d&&"string"==typeof b)return c=new t(b),c[db]();if(!d&&b.length!==a)return c=new v(b),c[db]();if(!d)throw new TypeError("Object is not iterable");return b[db]()}function z(a){var b=+a;return 0===b?b:isNaN(b)?b:0>b?-1:1}function A(a){var b=+a.length;return isNaN(b)?0:0!==b&&x(b)?(b=z(b)*Math.floor(Math.abs(b)),0>=b?0:b>yc?yc:b):b}function B(a,b){return Q(a)||(a=$b),new Jc(function(c){var d=0,e=b.length;return a.scheduleRecursive(function(a){e>d?(c.onNext(b[d++]),a()):c.onCompleted()})})}function C(a,b){return new Jc(function(c){var d=new Sb,e=new Tb;return e.setDisposable(d),d.setDisposable(a.subscribe(c.onNext.bind(c),function(a){var d,f;try{f=b(a)}catch(g){return void c.onError(g)}W(f)&&(f=vc(f)),d=new Sb,e.setDisposable(d),d.setDisposable(f.subscribe(c))},c.onCompleted.bind(c))),e},a)}function D(a,b){var c=this;return new Jc(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 void d.onError(i)}d.onNext(g)}else d.onCompleted()},d.onError.bind(d),d.onCompleted.bind(d))},c)}function E(a,b,c){return a.map(function(d,e){var f=b.call(c,d,e,a);return W(f)&&(f=vc(f)),(gb(f)||fb(f))&&(f=zc(f)),f}).concatAll()}function F(a,b,c){for(var d=0,e=a.length;e>d;d++)if(c(a[d],b))return d;return-1}function G(a){this.comparer=a,this.set=[]}function H(a,b,c){return a.map(function(d,e){var f=b.call(c,d,e,a);return W(f)&&(f=vc(f)),(gb(f)||fb(f))&&(f=zc(f)),f}).mergeAll()}var I={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},J=I[typeof window]&&window||this,K=I[typeof exports]&&exports&&!exports.nodeType&&exports,L=I[typeof module]&&module&&!module.nodeType&&module,M=L&&L.exports===K&&K,N=I[typeof global]&&global;!N||N.global!==N&&N.window!==N||(J=N);var O={internals:{},config:{Promise:J.Promise},helpers:{}},P=O.helpers.noop=function(){},Q=(O.helpers.notDefined=function(a){return"undefined"==typeof a},O.helpers.isScheduler=function(a){return a instanceof O.Scheduler}),R=O.helpers.identity=function(a){return a},S=(O.helpers.pluck=function(a){return function(b){return b[a]}},O.helpers.just=function(a){return function(){return a}},O.helpers.defaultNow=function(){return Date.now?Date.now:function(){return+new Date}}()),T=O.helpers.defaultComparer=function(a,b){return Eb(a,b)},U=O.helpers.defaultSubComparer=function(a,b){return a>b?1:b>a?-1:0},V=(O.helpers.defaultKeySerializer=function(a){return a.toString()},O.helpers.defaultError=function(a){throw a}),W=O.helpers.isPromise=function(a){return!!a&&"function"==typeof a.then},X=(O.helpers.asArray=function(){return Array.prototype.slice.call(arguments)},O.helpers.not=function(a){return!a},O.helpers.isFunction=function(){var a=function(a){return"function"==typeof a||!1};return a(/x/)&&(a=function(a){return"function"==typeof a&&"[object Function]"==tb.call(a)}),a}()),Y="Argument out of range",Z="Object has been disposed";O.config.longStackSupport=!1;var $=!1;try{throw new Error}catch(_){$=!!_.stack}var ab,bb=g(),cb="From previous event:",db="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";J.Set&&"function"==typeof(new J.Set)["@@iterator"]&&(db="@@iterator");var eb=O.doneEnumerator={done:!0,value:a},fb=O.helpers.isIterable=function(b){return b[db]!==a},gb=O.helpers.isArrayLike=function(b){return b&&b.length!==a};O.helpers.iterator=db;var hb,ib=O.helpers.deprecate=function(){},jb="[object Arguments]",kb="[object Array]",lb="[object Boolean]",mb="[object Date]",nb="[object Error]",ob="[object Function]",pb="[object Number]",qb="[object Object]",rb="[object RegExp]",sb="[object String]",tb=Object.prototype.toString,ub=Object.prototype.hasOwnProperty,vb=tb.call(arguments)==jb,wb=Error.prototype,xb=Object.prototype,yb=String.prototype,zb=xb.propertyIsEnumerable;try{hb=!(tb.call(document)==qb&&!({toString:0}+""))}catch(_){hb=!0}var Ab=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Bb={};Bb[kb]=Bb[mb]=Bb[pb]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},Bb[lb]=Bb[sb]={constructor:!0,toString:!0,valueOf:!0},Bb[nb]=Bb[ob]=Bb[rb]={constructor:!0,toString:!0},Bb[qb]={constructor:!0};var Cb={};!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);Cb.enumErrorProps=zb.call(wb,"message")||zb.call(wb,"name"),Cb.enumPrototypes=zb.call(a,"prototype"),Cb.nonEnumArgs=0!=c,Cb.nonEnumShadows=!/valueOf/.test(b)}(1);var Db=function(a){return a&&"object"==typeof a?tb.call(a)==jb:!1};vb||(Db=function(a){return a&&"object"==typeof a?ub.call(a,"callee"):!1});var Eb=O.internals.isEqual=function(a,b){return n(a,b,[],[])},Fb=Array.prototype.slice,Gb=({}.hasOwnProperty,this.inherits=O.internals.inherits=function(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c}),Hb=O.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=O.internals.addRef=function(a,b){return new Jc(function(c){return new Nb(b.getDisposable(),a.subscribe(c))})};Function.prototype.bind||(Function.prototype.bind=function(a){var b=this,c=Fb.call(arguments,1),d=function(){function e(){}if(this instanceof d){e.prototype=b.prototype;var f=new e,g=b.apply(f,c.concat(Fb.call(arguments)));return Object(g)===g?g:f}return b.apply(a,c.concat(Fb.call(arguments)))};return d}),Array.prototype.forEach||(Array.prototype.forEach=function(a,b){var c,d;if(null==this)throw new TypeError(" this is null or not defined");var e=Object(this),f=e.length>>>0;if("function"!=typeof a)throw new TypeError(a+" is not a function");for(arguments.length>1&&(c=b),d=0;f>d;){var g;d in e&&(g=e[d],a.call(c,g,d,e)),d++}});var Jb=Object("a"),Kb="a"!=Jb[0]||!(0 in Jb);Array.prototype.every||(Array.prototype.every=function(a){var b=Object(this),c=Kb&&{}.toString.call(this)==sb?this.split(""):b,d=c.length>>>0,e=arguments[1];if({}.toString.call(a)!=ob)throw new TypeError(a+" is not a function");for(var f=0;d>f;f++)if(f in c&&!a.call(e,c[f],f,b))return!1;return!0}),Array.prototype.map||(Array.prototype.map=function(a){var b=Object(this),c=Kb&&{}.toString.call(this)==sb?this.split(""):b,d=c.length>>>0,e=Array(d),f=arguments[1];if({}.toString.call(a)!=ob)throw new TypeError(a+" is not a function");for(var g=0;d>g;g++)g in c&&(e[g]=a.call(f,c[g],g,b));return e}),Array.prototype.filter||(Array.prototype.filter=function(a){for(var b,c=[],d=new Object(this),e=0,f=d.length>>>0;f>e;e++)b=d[e],e in d&&a.call(arguments[1],b,e,d)&&c.push(b);return c}),Array.isArray||(Array.isArray=function(a){return{}.toString.call(a)==kb}),Array.prototype.indexOf||(Array.prototype.indexOf=function(a){var b=Object(this),c=b.length>>>0;if(0===c)return-1;var d=0;if(arguments.length>1&&(d=Number(arguments[1]),d!==d?d=0:0!==d&&1/0!=d&&d!==-1/0&&(d=(d>0||-1)*Math.floor(Math.abs(d)))),d>=c)return-1;for(var e=d>=0?d:Math.max(c-Math.abs(d),0);c>e;e++)if(e in b&&b[e]===a)return e;return-1}),q.prototype.compareTo=function(a){var b=this.value.compareTo(a.value);return 0===b&&(b=this.id-a.id),b};var Lb=O.internals.PriorityQueue=function(a){this.items=new Array(a),this.length=0},Mb=Lb.prototype;Mb.isHigherPriority=function(a,b){return this.items[a].compareTo(this.items[b])<0},Mb.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)}}},Mb.heapify=function(a){if(+a||(a=0),!(a>=this.length||0>a)){var b=2*a+1,c=2*a+2,d=a;if(b<this.length&&this.isHigherPriority(b,d)&&(d=b),c<this.length&&this.isHigherPriority(c,d)&&(d=c),d!==a){var e=this.items[a];this.items[a]=this.items[d],this.items[d]=e,this.heapify(d)}}},Mb.peek=function(){return this.items[0].value},Mb.removeAt=function(a){this.items[a]=this.items[--this.length],delete this.items[this.length],this.heapify()},Mb.dequeue=function(){var a=this.peek();return this.removeAt(0),a},Mb.enqueue=function(a){var b=this.length++;this.items[b]=new q(Lb.count++,a),this.percolate(b)},Mb.remove=function(a){for(var b=0;b<this.length;b++)if(this.items[b].value===a)return this.removeAt(b),!0;return!1},Lb.count=0;var Nb=O.CompositeDisposable=function(){this.disposables=o(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},Ob=Nb.prototype;Ob.add=function(a){this.isDisposed?a.dispose():(this.disposables.push(a),this.length++)},Ob.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},Ob.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()}},Ob.toArray=function(){return this.disposables.slice(0)};var Pb=O.Disposable=function(a){this.isDisposed=!1,this.action=a||P};Pb.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var Qb=Pb.create=function(a){return new Pb(a)},Rb=Pb.empty={dispose:P},Sb=O.SingleAssignmentDisposable=function(){function a(){this.isDisposed=!1,this.current=null}var b=a.prototype;return b.getDisposable=function(){return this.current},b.setDisposable=function(a){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}(),Tb=O.SerialDisposable=Sb,Ub=O.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?Rb:new a(this)},b}();r.prototype.dispose=function(){var a=this;this.scheduler.schedule(function(){a.isDisposed||(a.isDisposed=!0,a.disposable.dispose())})};var Vb=O.internals.ScheduledItem=function(a,b,c,d,e){this.scheduler=a,this.state=b,this.action=c,this.dueTime=d,this.comparer=e||U,this.disposable=new Sb};Vb.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},Vb.prototype.compareTo=function(a){return this.comparer(this.dueTime,a.dueTime)},Vb.prototype.isCancelled=function(){return this.disposable.isDisposed},Vb.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var Wb=O.Scheduler=function(){function a(a,b,c,d){this.now=a,this._schedule=b,this._scheduleRelative=c,this._scheduleAbsolute=d}function b(a,b){return b(),Rb}var c=a.prototype;return c.schedule=function(a){return this._schedule(a,b)},c.scheduleWithState=function(a,b){return this._schedule(a,b)},c.scheduleWithRelative=function(a,c){return this._scheduleRelative(c,a,b)},c.scheduleWithRelativeAndState=function(a,b,c){return this._scheduleRelative(a,b,c)},c.scheduleWithAbsolute=function(a,c){return this._scheduleAbsolute(c,a,b)},c.scheduleWithAbsoluteAndState=function(a,b,c){return this._scheduleAbsolute(a,b,c)},a.now=S,a.normalize=function(a){return 0>a&&(a=0),a},a}(),Xb=Wb.normalize;!function(a){function b(a,b){var c=b.first,d=b.second,e=new Nb,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),Rb});d||(e.add(g),c=!0)})};return f(c),e}function c(a,b,c){var d=b.first,e=b.second,f=new Nb,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),Rb});h||(f.add(i),e=!0)})};return g(d),f}function d(a,b){a(function(c){b(a,c)})}a.scheduleRecursive=function(a){return this.scheduleRecursiveWithState(a,function(a,b){a(function(){b(a)})})},a.scheduleRecursiveWithState=function(a,c){return this.scheduleWithState({first:a,second:c},b)},a.scheduleRecursiveWithRelative=function(a,b){return this.scheduleRecursiveWithRelativeAndState(b,a,d)},a.scheduleRecursiveWithRelativeAndState=function(a,b,d){return this._scheduleRelative({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithRelativeAndState")})},a.scheduleRecursiveWithAbsolute=function(a,b){return this.scheduleRecursiveWithAbsoluteAndState(b,a,d)},a.scheduleRecursiveWithAbsoluteAndState=function(a,b,d){return this._scheduleAbsolute({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithAbsoluteAndState")})}}(Wb.prototype),function(){Wb.prototype.schedulePeriodic=function(a,b){return this.schedulePeriodicWithState(null,a,b)},Wb.prototype.schedulePeriodicWithState=function(a,b,c){if("undefined"==typeof J.setInterval)throw new Error("Periodic scheduling not supported.");var d=a,e=J.setInterval(function(){d=c(d)},b);return Qb(function(){J.clearInterval(e)})}}(Wb.prototype),function(a){a.catchError=a["catch"]=function(a){return new dc(this,a)}}(Wb.prototype);var Yb,Zb=(O.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 Sb;return this._cancel=b,b.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,a.bind(this))),b},b}(),Wb.immediate=function(){function a(a,b){return b(this,a)}function b(a,b,c){for(var d=Xb(b);d-this.now()>0;);return c(this,a)}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new Wb(S,a,b,c)}()),$b=Wb.currentThread=function(){function a(a){for(var b;a.length>0;)if(b=a.dequeue(),!b.isCancelled()){for(;b.dueTime-Wb.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()+Wb.normalize(c),g=new Vb(this,b,d,f);if(e)e.enqueue(g);else{e=new Lb(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 Wb(S,b,c,d);return f.scheduleRequired=function(){return!e},f.ensureTrampoline=function(a){e?a():this.schedule(a)},f}(),_b=P,ac=function(){var a,b=P;if("WScript"in this)a=function(a,b){WScript.Sleep(b),a()};else{if(!J.setTimeout)throw new Error("No concurrency detected!");a=J.setTimeout,b=J.clearTimeout}return{setTimeout:a,clearTimeout:b}}(),bc=ac.setTimeout,cc=ac.clearTimeout;!function(){function a(){if(!J.postMessage||J.importScripts)return!1;var a=!1,b=J.onmessage;return J.onmessage=function(){a=!0},J.postMessage("","*"),J.onmessage=b,a}var b=RegExp("^"+String(tb).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),c="function"==typeof(c=N&&M&&N.setImmediate)&&!b.test(c)&&c,d="function"==typeof(d=N&&M&&N.clearImmediate)&&!b.test(d)&&d;if("function"==typeof c)Yb=c,_b=d;else if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))Yb=process.nextTick;else if(a()){var e="ms.rx.schedule"+Math.random(),f={},g=0,h=function(a){if("string"==typeof a.data&&a.data.substring(0,e.length)===e){var b=a.data.substring(e.length),c=f[b];c(),delete f[b]}};J.addEventListener?J.addEventListener("message",h,!1):J.attachEvent("onmessage",h,!1),Yb=function(a){var b=g++;f[b]=a,J.postMessage(e+b,"*")}}else if(J.MessageChannel){var i=new J.MessageChannel,j={},k=0;i.port1.onmessage=function(a){var b=a.data,c=j[b];c(),delete j[b]},Yb=function(a){var b=k++;j[b]=a,i.port2.postMessage(b)}}else"document"in J&&"onreadystatechange"in J.document.createElement("script")?Yb=function(a){var b=J.document.createElement("script");b.onreadystatechange=function(){a(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},J.document.documentElement.appendChild(b)}:(Yb=function(a){return bc(a,0)},_b=cc)}();var dc=(Wb.timeout=function(){function a(a,b){var c=this,d=new Sb,e=Yb(function(){d.isDisposed||d.setDisposable(b(c,a))});return new Nb(d,Qb(function(){_b(e)}))}function b(a,b,c){var d=this,e=Wb.normalize(b);if(0===e)return d.scheduleWithState(a,c);var f=new Sb,g=bc(function(){f.isDisposed||f.setDisposable(c(d,a))},e);return new Nb(f,Qb(function(){cc(g)}))}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new Wb(S,a,b,c)}(),function(a){function b(a,b){return this._scheduler.scheduleWithState(a,this._wrap(b))}function c(a,b,c){return this._scheduler.scheduleWithRelativeAndState(a,b,this._wrap(c))}function d(a,b,c){return this._scheduler.scheduleWithAbsoluteAndState(a,b,this._wrap(c))}function e(e,f){this._scheduler=e,this._handler=f,this._recursiveOriginal=null,this._recursiveWrapper=null,a.call(this,this._scheduler.now.bind(this._scheduler),b,c,d)}return Gb(e,a),e.prototype._clone=function(a){return new e(a,this._handler)},e.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 Rb}}},e.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},e.prototype.schedulePeriodicWithState=function(a,b,c){var d=this,e=!1,f=new Sb;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},e}(Wb)),ec=O.Notification=function(){function a(a,b){this.hasValue=null==b?!1:b,this.kind=a}return a.prototype.accept=function(a,b,c){return a&&"object"==typeof a?this._acceptObservable(a):this._accept(a,b,c)},a.prototype.toObservable=function(a){var b=this;return Q(a)||(a=Zb),new Jc(function(c){return a.schedule(function(){b._acceptObservable(c),"N"===b.kind&&c.onCompleted()})})},a}(),fc=ec.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 ec("N",!0);return e.value=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),gc=ec.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 ec("E");return e.exception=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),hc=ec.createOnCompleted=function(){function a(a,b,c){return c()}function b(a){return a.onCompleted()}function c(){return"OnCompleted()"}return function(){var d=new ec("C");return d._accept=a,d._acceptObservable=b,d.toString=c,d}}(),ic=O.internals.Enumerator=function(a){this._next=a};ic.prototype.next=function(){return this._next()},ic.prototype[db]=function(){return this};var jc=O.internals.Enumerable=function(a){this._iterator=a};jc.prototype[db]=function(){return this._iterator()},jc.prototype.concat=function(){var a=this;return new Jc(function(b){var c;try{c=a[db]()}catch(d){return void b.onError(d)}var e,f=new Tb,g=Zb.scheduleRecursive(function(a){var d;if(!e){try{d=c.next()}catch(g){return void b.onError(g)}if(d.done)return void b.onCompleted();var h=d.value;W(h)&&(h=vc(h));var i=new Sb;f.setDisposable(i),i.setDisposable(h.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){a()}))}});return new Nb(f,g,Qb(function(){e=!0}))})},jc.prototype.catchError=function(){var a=this;return new Jc(function(b){var c;try{c=a[db]()}catch(d){return void b.onError(d)}var e,f,g=new Tb,h=Zb.scheduleRecursive(function(a){if(!e){var d;try{d=c.next()}catch(h){return void b.onError(h)}if(d.done)return void(f?b.onError(f):b.onCompleted());var i=d.value;W(i)&&(i=vc(i));var j=new Sb;g.setDisposable(j),j.setDisposable(i.subscribe(b.onNext.bind(b),function(b){f=b,a()},b.onCompleted.bind(b)))}});return new Nb(g,h,Qb(function(){e=!0}))})};var kc=jc.repeat=function(a,b){return null==b&&(b=-1),new jc(function(){var c=b;return new ic(function(){return 0===c?eb:(c>0&&c--,{done:!1,value:a})})})},lc=jc.of=function(a,b,c){return b||(b=R),new jc(function(){var d=-1;return new ic(function(){return++d<a.length?{done:!1,value:b.call(c,a[d],d,a)}:eb})})},mc=O.Observer=function(){};mc.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},mc.prototype.asObserver=function(){return new qc(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},mc.prototype.checked=function(){return new rc(this)};var nc=mc.create=function(a,b,c){return a||(a=P),b||(b=V),c||(c=P),new qc(a,b,c)};mc.fromNotifier=function(a,b){return new qc(function(c){return a.call(b,fc(c))},function(c){return a.call(b,gc(c))},function(){return a.call(b,hc())})},mc.prototype.notifyOn=function(a){return new tc(a,this)};var oc,pc=O.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}(mc),qc=O.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}(pc),rc=function(a){function b(b){a.call(this),this._observer=b,this._state=0}Gb(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}(mc),sc=O.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 Tb}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 void(b.isAcquired=!1);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}(pc),tc=function(a){function b(b,c,d){a.call(this,b,c),this._cancel=d}return Gb(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.prototype.dispose=function(){a.prototype.dispose.call(this),this._cancel&&this._cancel.dispose(),this._cancel=null},b}(sc),uc=O.Observable=function(){function a(a){if(O.config.longStackSupport&&$){try{throw new Error}catch(b){this.stack=b.stack.substring(b.stack.indexOf("\n")+1)}var d=this;this._subscribe=function(b){b.onError=function(a){c(d,a),b.onError(a)},a(b)}}this._subscribe=a}return oc=a.prototype,oc.subscribe=oc.forEach=function(a,b,c){return this._subscribe("object"==typeof a?a:nc(a,b,c))},oc.subscribeOnNext=function(a,b){return this._subscribe(nc(2===arguments.length?function(c){a.call(b,c)}:a))},oc.subscribeOnError=function(a,b){return this._subscribe(nc(null,2===arguments.length?function(c){a.call(b,c)}:a))},oc.subscribeOnCompleted=function(a,b){return this._subscribe(nc(null,null,2===arguments.length?function(){a.call(b)}:a))},a}();oc.observeOn=function(a){var b=this;return new Jc(function(c){return b.subscribe(new tc(a,c))},b)},oc.subscribeOn=function(a){var b=this;return new Jc(function(c){var d=new Sb,e=new Tb;return e.setDisposable(d),d.setDisposable(a.schedule(function(){e.setDisposable(new r(a,b.subscribe(c)))})),e},b)};var vc=uc.fromPromise=function(a){return wc(function(){var b=new O.AsyncSubject;return a.then(function(a){b.onNext(a),b.onCompleted()},b.onError.bind(b)),b})};oc.toPromise=function(a){if(a||(a=O.config.Promise),!a)throw new TypeError("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},c,function(){e&&a(d)})})},oc.toArray=function(){var a=this;return new Jc(function(b){var c=[];return a.subscribe(c.push.bind(c),b.onError.bind(b),function(){b.onNext(c),b.onCompleted()})},a)},uc.create=uc.createWithDisposable=function(a,b){return new Jc(a,b)};var wc=uc.defer=function(a){return new Jc(function(b){var c;try{c=a()}catch(d){return Dc(d).subscribe(b)}return W(c)&&(c=vc(c)),c.subscribe(b)})},xc=uc.empty=function(a){return Q(a)||(a=Zb),new Jc(function(b){return a.schedule(function(){b.onCompleted()})})},yc=Math.pow(2,53)-1;t.prototype[db]=function(){return new u(this._s)},u.prototype[db]=function(){return this},u.prototype.next=function(){if(this._i<this._l){var a=this._s.charAt(this._i++);return{done:!1,value:a}}return eb},v.prototype[db]=function(){return new w(this._a)},w.prototype[db]=function(){return this},w.prototype.next=function(){if(this._i<this._l){var a=this._a[this._i++];return{done:!1,value:a}}return eb};var zc=uc.from=function(a,b,c,d){if(null==a)throw new Error("iterable cannot be null.");if(b&&!X(b))throw new Error("mapFn when provided must be a function");Q(d)||(d=$b);var e=Object(a),f=y(e);return new Jc(function(a){var e=0;return d.scheduleRecursive(function(d){var g;try{g=f.next()}catch(h){return void a.onError(h)}if(g.done)return void a.onCompleted();var i=g.value;if(b&&X(b))try{i=b.call(c,i,e)}catch(h){return void a.onError(h)}a.onNext(i),e++,d()})})},Ac=uc.fromArray=function(a,b){return ib("fromArray","from"),Q(b)||(b=$b),new Jc(function(c){var d=0,e=a.length;return b.scheduleRecursive(function(b){e>d?(c.onNext(a[d++]),b()):c.onCompleted()})})};uc.generate=function(a,b,c,d,e){return Q(e)||(e=$b),new Jc(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 void f.onError(j)}e?(f.onNext(i),a()):f.onCompleted()})})};var Bc=uc.never=function(){return new Jc(function(){return Rb})};uc.of=function(){return B(null,arguments)},uc.ofWithScheduler=function(a){return B(a,Fb.call(arguments,1))},uc.range=function(a,b,c){return Q(c)||(c=$b),new Jc(function(d){return c.scheduleRecursiveWithState(0,function(c,e){b>c?(d.onNext(a+c),e(c+1)):d.onCompleted()})})},uc.repeat=function(a,b,c){return Q(c)||(c=$b),Cc(a,c).repeat(null==b?-1:b)};var Cc=uc["return"]=uc.just=function(a,b){return Q(b)||(b=Zb),new Jc(function(c){return b.schedule(function(){c.onNext(a),c.onCompleted()})})};uc.returnValue=function(){return ib("returnValue","return or just"),Cc.apply(null,arguments)};var Dc=uc["throw"]=uc.throwException=uc.throwError=function(a,b){return Q(b)||(b=Zb),new Jc(function(c){return b.schedule(function(){c.onError(a)})})};uc.using=function(a,b){return new Jc(function(c){var d,e,f=Rb;try{d=a(),d&&(f=d),e=b(d)}catch(g){return new Nb(Dc(g).subscribe(c),f)}return new Nb(e.subscribe(c),f)})},oc.amb=function(a){var b=this;return new Jc(function(c){function d(){f||(f=g,j.dispose())}function e(){f||(f=h,i.dispose())}var f,g="L",h="R",i=new Sb,j=new Sb;return W(a)&&(a=vc(a)),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 Nb(i,j)})},uc.amb=function(){function a(a,b){return a.amb(b)}for(var b=Bc(),c=o(arguments,0),d=0,e=c.length;e>d;d++)b=a(b,c[d]);return b},oc["catch"]=oc.catchError=function(a){return"function"==typeof a?C(this,a):Ec([this,a])},oc.catchException=function(a){return ib("catchException","catch or catchError"),this.catchError(a)};var Ec=uc.catchError=uc["catch"]=function(){return lc(o(arguments,0)).catchError()
3
- };uc.catchException=function(){return ib("catchException","catch or catchError"),Ec.apply(null,arguments)},oc.combineLatest=function(){var a=Fb.call(arguments);return Array.isArray(a[0])?a[0].unshift(this):a.unshift(this),Fc.apply(this,a)};var Fc=uc.combineLatest=function(){var a=Fb.call(arguments),b=a.pop();return Array.isArray(a[0])&&(a=a[0]),new Jc(function(c){function d(a){var d;if(h[a]=!0,i||(i=h.every(R))){try{d=b.apply(null,k)}catch(e){return void c.onError(e)}c.onNext(d)}else j.filter(function(b,c){return c!==a}).every(R)&&c.onCompleted()}function e(a){j[a]=!0,j.every(R)&&c.onCompleted()}for(var f=function(){return!1},g=a.length,h=p(g,f),i=!1,j=p(g,f),k=new Array(g),l=new Array(g),m=0;g>m;m++)!function(b){var f=a[b],g=new Sb;W(f)&&(f=vc(f)),g.setDisposable(f.subscribe(function(a){k[b]=a,d(b)},c.onError.bind(c),function(){e(b)})),l[b]=g}(m);return new Nb(l)},this)};oc.concat=function(){var a=Fb.call(arguments,0);return a.unshift(this),Gc.apply(this,a)};var Gc=uc.concat=function(){return lc(o(arguments,0)).concat()};oc.concatAll=function(){return this.merge(1)},oc.concatObservable=function(){return ib("concatObservable","concatAll"),this.merge(1)},oc.merge=function(a){if("number"!=typeof a)return Hc(this,a);var b=this;return new Jc(function(c){function d(a){var b=new Sb;f.add(b),W(a)&&(a=vc(a)),b.setDisposable(a.subscribe(c.onNext.bind(c),c.onError.bind(c),function(){f.remove(b),h.length>0?d(h.shift()):(e--,g&&0===e&&c.onCompleted())}))}var e=0,f=new Nb,g=!1,h=[];return f.add(b.subscribe(function(b){a>e?(e++,d(b)):h.push(b)},c.onError.bind(c),function(){g=!0,0===e&&c.onCompleted()})),f},b)};var Hc=uc.merge=function(){var a,b;return arguments[0]?Q(arguments[0])?(a=arguments[0],b=Fb.call(arguments,1)):(a=Zb,b=Fb.call(arguments,0)):(a=Zb,b=Fb.call(arguments,1)),Array.isArray(b[0])&&(b=b[0]),B(a,b).mergeAll()};oc.mergeAll=function(){var a=this;return new Jc(function(b){var c=new Nb,d=!1,e=new Sb;return c.add(e),e.setDisposable(a.subscribe(function(a){var e=new Sb;c.add(e),W(a)&&(a=vc(a)),e.setDisposable(a.subscribe(b.onNext.bind(b),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},a)},oc.mergeObservable=function(){return ib("mergeObservable","mergeAll"),this.mergeAll.apply(this,arguments)},oc.onErrorResumeNext=function(a){if(!a)throw new Error("Second observable is required");return Ic([this,a])};var Ic=uc.onErrorResumeNext=function(){var a=o(arguments,0);return new Jc(function(b){var c=0,d=new Tb,e=Zb.scheduleRecursive(function(e){var f,g;c<a.length?(f=a[c++],W(f)&&(f=vc(f)),g=new Sb,d.setDisposable(g),g.setDisposable(f.subscribe(b.onNext.bind(b),e,e))):b.onCompleted()});return new Nb(d,e)})};oc.skipUntil=function(a){var b=this;return new Jc(function(c){var d=!1,e=new Nb(b.subscribe(function(a){d&&c.onNext(a)},c.onError.bind(c),function(){d&&c.onCompleted()}));W(a)&&(a=vc(a));var f=new Sb;return e.add(f),f.setDisposable(a.subscribe(function(){d=!0,f.dispose()},c.onError.bind(c),function(){f.dispose()})),e},b)},oc["switch"]=oc.switchLatest=function(){var a=this;return new Jc(function(b){var c=!1,d=new Tb,e=!1,f=0,g=a.subscribe(function(a){var g=new Sb,h=++f;c=!0,d.setDisposable(g),W(a)&&(a=vc(a)),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 Nb(g,d)},a)},oc.takeUntil=function(a){var b=this;return new Jc(function(c){return W(a)&&(a=vc(a)),new Nb(b.subscribe(c),a.subscribe(c.onCompleted.bind(c),c.onError.bind(c),P))},b)},oc.zip=function(){if(Array.isArray(arguments[0]))return D.apply(this,arguments);var a=this,b=Fb.call(arguments),c=b.pop();return b.unshift(a),new Jc(function(d){function e(b){var e,f;if(h.every(function(a){return a.length>0})){try{f=h.map(function(a){return a.shift()}),e=c.apply(a,f)}catch(g){return void d.onError(g)}d.onNext(e)}else i.filter(function(a,c){return c!==b}).every(R)&&d.onCompleted()}function f(a){i[a]=!0,i.every(function(a){return a})&&d.onCompleted()}for(var g=b.length,h=p(g,function(){return[]}),i=p(g,function(){return!1}),j=new Array(g),k=0;g>k;k++)!function(a){var c=b[a],g=new Sb;W(c)&&(c=vc(c)),g.setDisposable(c.subscribe(function(b){h[a].push(b),e(a)},d.onError.bind(d),function(){f(a)})),j[a]=g}(k);return new Nb(j)},a)},uc.zip=function(){var a=Fb.call(arguments,0),b=a.shift();return b.zip.apply(b,a)},uc.zipArray=function(){var a=o(arguments,0);return new Jc(function(b){function c(a){if(f.every(function(a){return a.length>0})){var c=f.map(function(a){return a.shift()});b.onNext(c)}else if(g.filter(function(b,c){return c!==a}).every(R))return void b.onCompleted()}function d(a){return g[a]=!0,g.every(R)?void b.onCompleted():void 0}for(var e=a.length,f=p(e,function(){return[]}),g=p(e,function(){return!1}),h=new Array(e),i=0;e>i;i++)!function(e){h[e]=new Sb,h[e].setDisposable(a[e].subscribe(function(a){f[e].push(a),c(e)},b.onError.bind(b),function(){d(e)}))}(i);var j=new Nb(h);return j.add(Qb(function(){for(var a=0,b=f.length;b>a;a++)f[a]=[]})),j})},oc.asObservable=function(){return new Jc(this.subscribe.bind(this),this)},oc.bufferWithCount=function(a,b){return"number"!=typeof b&&(b=a),this.windowWithCount(a,b).selectMany(function(a){return a.toArray()}).where(function(a){return a.length>0})},oc.dematerialize=function(){var a=this;return new Jc(function(b){return a.subscribe(function(a){return a.accept(b)},b.onError.bind(b),b.onCompleted.bind(b))},this)},oc.distinctUntilChanged=function(a,b){var c=this;return a||(a=R),b||(b=T),new Jc(function(d){var e,f=!1;return c.subscribe(function(c){var g,h=!1;try{g=a(c)}catch(i){return void d.onError(i)}if(f)try{h=b(e,g)}catch(i){return void d.onError(i)}f&&h||(f=!0,e=g,d.onNext(c))},d.onError.bind(d),d.onCompleted.bind(d))},this)},oc["do"]=oc.tap=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 Jc(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)},function(){if(c)try{c()}catch(b){a.onError(b)}a.onCompleted()})},this)},oc.doAction=function(){return ib("doAction","do or tap"),this.tap.apply(this,arguments)},oc.doOnNext=oc.tapOnNext=function(a,b){return this.tap(2===arguments.length?function(c){a.call(b,c)}:a)},oc.doOnError=oc.tapOnError=function(a,b){return this.tap(P,2===arguments.length?function(c){a.call(b,c)}:a)},oc.doOnCompleted=oc.tapOnCompleted=function(a,b){return this.tap(P,null,2===arguments.length?function(){a.call(b)}:a)},oc["finally"]=oc.ensure=function(a){var b=this;return new Jc(function(c){var d;try{d=b.subscribe(c)}catch(e){throw a(),e}return Qb(function(){try{d.dispose()}catch(b){throw b}finally{a()}})},this)},oc.finallyAction=function(a){return ib("finallyAction","finally or ensure"),this.ensure(a)},oc.ignoreElements=function(){var a=this;return new Jc(function(b){return a.subscribe(P,b.onError.bind(b),b.onCompleted.bind(b))},a)},oc.materialize=function(){var a=this;return new Jc(function(b){return a.subscribe(function(a){b.onNext(fc(a))},function(a){b.onNext(gc(a)),b.onCompleted()},function(){b.onNext(hc()),b.onCompleted()})},a)},oc.repeat=function(a){return kc(this,a).concat()},oc.retry=function(a){return kc(this,a).catchError()},oc.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 Jc(function(e){var f,g,h;return d.subscribe(function(d){!h&&(h=!0);try{f?g=b(g,d):(g=c?b(a,d):d,f=!0)}catch(i){return void e.onError(i)}e.onNext(g)},e.onError.bind(e),function(){!h&&c&&e.onNext(a),e.onCompleted()})},d)},oc.skipLast=function(a){var b=this;return new Jc(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))},b)},oc.startWith=function(){var a,b,c=0;return arguments.length&&Q(arguments[0])?(b=arguments[0],c=1):b=Zb,a=Fb.call(arguments,c),lc([Ac(a,b),this]).concat()},oc.takeLast=function(a){var b=this;return new Jc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},c.onError.bind(c),function(){for(;d.length>0;)c.onNext(d.shift());c.onCompleted()})},b)},oc.takeLastBuffer=function(a){var b=this;return new Jc(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()})},b)},oc.windowWithCount=function(a,b){var c=this;if(+a||(a=0),1/0===Math.abs(a)&&(a=0),0>=a)throw new Error(Y);if(null==b&&(b=a),+b||(b=0),1/0===Math.abs(b)&&(b=0),0>=b)throw new Error(Y);return new Jc(function(d){function e(){var a=new Mc;i.push(a),d.onNext(Ib(a,g))}var f=new Sb,g=new Ub(f),h=0,i=[];return e(),f.setDisposable(c.subscribe(function(c){for(var d=0,f=i.length;f>d;d++)i[d].onNext(c);var g=h-a+1;g>=0&&g%b===0&&i.shift().onCompleted(),++h%b===0&&e()},function(a){for(;i.length>0;)i.shift().onError(a);d.onError(a)},function(){for(;i.length>0;)i.shift().onCompleted();d.onCompleted()})),g},c)},oc.selectConcat=oc.concatMap=function(a,b,c){return X(a)&&X(b)?this.concatMap(function(c,d){var e=a(c,d);return W(e)&&(e=vc(e)),(gb(e)||fb(e))&&(e=zc(e)),e.map(function(a,e){return b(c,a,d,e)})}):X(a)?E(this,a,c):E(this,function(){return a})},oc.concatMapObserver=oc.selectConcatObserver=function(a,b,c,d){var e=this;return new Jc(function(f){var g=0;return e.subscribe(function(b){var c;try{c=a.call(d,b,g++)}catch(e){return void f.onError(e)}W(c)&&(c=vc(c)),f.onNext(c)},function(a){var c;try{c=b.call(d,a)}catch(e){return void f.onError(e)}W(c)&&(c=vc(c)),f.onNext(c),f.onCompleted()},function(){var a;try{a=c.call(d)}catch(b){return void f.onError(b)}W(a)&&(a=vc(a)),f.onNext(a),f.onCompleted()})},this).concatAll()},oc.defaultIfEmpty=function(b){var c=this;return b===a&&(b=null),new Jc(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()})},this)},G.prototype.push=function(a){var b=-1===F(this.set,a,this.comparer);return b&&this.set.push(a),b},oc.distinct=function(a,b){var c=this;return b||(b=T),new Jc(function(d){var e=new G(b);return c.subscribe(function(b){var c=b;if(a)try{c=a(b)}catch(f){return void d.onError(f)}e.push(c)&&d.onNext(b)},d.onError.bind(d),d.onCompleted.bind(d))},this)},oc.select=oc.map=function(a,b){var c=X(a)?a:function(){return a},d=this;return new Jc(function(a){var e=0;return d.subscribe(function(f){var g;try{g=c.call(b,f,e++,d)}catch(h){return void a.onError(h)}a.onNext(g)},a.onError.bind(a),a.onCompleted.bind(a))},d)},oc.pluck=function(a){return this.map(function(b){return b[a]})},oc.selectMany=oc.flatMap=function(a,b,c){return X(a)&&X(b)?this.flatMap(function(c,d){var e=a(c,d);return W(e)&&(e=vc(e)),(gb(e)||fb(e))&&(e=zc(e)),e.map(function(a,e){return b(c,a,d,e)})},c):X(a)?H(this,a,c):H(this,function(){return a})},oc.flatMapObserver=oc.selectManyObserver=function(a,b,c,d){var e=this;return new Jc(function(f){var g=0;return e.subscribe(function(b){var c;try{c=a.call(d,b,g++)}catch(e){return void f.onError(e)}W(c)&&(c=vc(c)),f.onNext(c)},function(a){var c;try{c=b.call(d,a)}catch(e){return void f.onError(e)}W(c)&&(c=vc(c)),f.onNext(c),f.onCompleted()},function(){var a;try{a=c.call(d)}catch(b){return void f.onError(b)}W(a)&&(a=vc(a)),f.onNext(a),f.onCompleted()})},e).mergeAll()},oc.selectSwitch=oc.flatMapLatest=oc.switchMap=function(a,b){return this.select(a,b).switchLatest()},oc.skip=function(a){if(0>a)throw new Error(Y);var b=this;return new Jc(function(c){var d=a;return b.subscribe(function(a){0>=d?c.onNext(a):d--},c.onError.bind(c),c.onCompleted.bind(c))},b)},oc.skipWhile=function(a,b){var c=this;return new Jc(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 void d.onError(h)}f&&d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))},c)},oc.take=function(a,b){if(0>a)throw new RangeError(Y);if(0===a)return xc(b);var c=this;return new Jc(function(b){var d=a;return c.subscribe(function(a){d-->0&&(b.onNext(a),0===d&&b.onCompleted())},b.onError.bind(b),b.onCompleted.bind(b))},c)},oc.takeWhile=function(a,b){var c=this;return new Jc(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 void d.onError(h)}f?d.onNext(g):d.onCompleted()}},d.onError.bind(d),d.onCompleted.bind(d))},c)},oc.where=oc.filter=function(a,b){var c=this;return new Jc(function(d){var e=0;return c.subscribe(function(c){var f;try{f=a.call(b,c,e++,parent)}catch(g){return void d.onError(g)}f&&d.onNext(c)},d.onError.bind(d),d.onCompleted.bind(d))},c)},oc.transduce=function(a){function b(a){return{init:function(){return a},step:function(a,b){return a.onNext(b)},result:function(a){return a.onCompleted()}}}var c=this;return new Jc(function(d){var e=a(b(d));return c.subscribe(function(a){try{e.step(d,a)}catch(b){d.onError(b)}},d.onError.bind(d),function(){e.result(d)})},c)};var Jc=O.AnonymousObservable=function(a){function b(a){return a&&"function"==typeof a.dispose?a:"function"==typeof a?Qb(a):Rb}function c(d,e){function f(a){var c=function(){try{e.setDisposable(b(d(e)))}catch(a){if(!e.fail(a))throw a}},e=new Kc(a);return $b.scheduleRequired()?$b.schedule(c):c(),e}return this.source=e,this instanceof c?void a.call(this,f):new c(d)}return Gb(c,a),c}(uc),Kc=function(a){function b(b){a.call(this),this.observer=b,this.m=new Sb}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.dispose=function(){a.prototype.dispose.call(this),this.m.dispose()},b}(pc),Lc=function(a,b){this.subject=a,this.observer=b};Lc.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 Mc=O.Subject=function(a){function c(a){return b.call(this),this.isStopped?this.exception?(a.onError(this.exception),Rb):(a.onCompleted(),Rb):(this.observers.push(a),new Lc(this,a))}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return Gb(d,a),Hb(d.prototype,mc,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(b.call(this),!this.isStopped){var a=this.observers.slice(0);this.isStopped=!0;for(var c=0,d=a.length;d>c;c++)a[c].onCompleted();this.observers=[]}},onError:function(a){if(b.call(this),!this.isStopped){var c=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var d=0,e=c.length;e>d;d++)c[d].onError(a);this.observers=[]}},onNext:function(a){if(b.call(this),!this.isStopped)for(var c=this.observers.slice(0),d=0,e=c.length;e>d;d++)c[d].onNext(a)},dispose:function(){this.isDisposed=!0,this.observers=null}}),d.create=function(a,b){return new Nc(a,b)},d}(uc),Nc=(O.AsyncSubject=function(a){function c(a){if(b.call(this),!this.isStopped)return this.observers.push(a),new Lc(this,a);var c=this.exception,d=this.hasValue,e=this.value;return c?a.onError(c):d?(a.onNext(e),a.onCompleted()):a.onCompleted(),Rb}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return Gb(d,a),Hb(d.prototype,mc,{hasObservers:function(){return b.call(this),this.observers.length>0},onCompleted:function(){var a,c,d;if(b.call(this),!this.isStopped){this.isStopped=!0;var e=this.observers.slice(0),f=this.value,g=this.hasValue;if(g)for(c=0,d=e.length;d>c;c++)a=e[c],a.onNext(f),a.onCompleted();else for(c=0,d=e.length;d>c;c++)e[c].onCompleted();this.observers=[]}},onError:function(a){if(b.call(this),!this.isStopped){var c=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var d=0,e=c.length;e>d;d++)c[d].onError(a);this.observers=[]}},onNext:function(a){b.call(this),this.isStopped||(this.value=a,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),d}(uc),O.AnonymousSubject=function(a){function b(b,c){this.observer=b,this.observable=c,a.call(this,this.observable.subscribe.bind(this.observable))}return Gb(b,a),Hb(b.prototype,mc,{onCompleted:function(){this.observer.onCompleted()},onError:function(a){this.observer.onError(a)},onNext:function(a){this.observer.onNext(a)}}),b}(uc));"function"==typeof define&&"object"==typeof define.amd&&define.amd?(J.Rx=O,define(function(){return O})):K&&L?M?(L.exports=O).Rx=O:K.Rx=O:J.Rx=O;var Oc=g()}).call(this);
2
+ (function(a){function b(){if(this.isDisposed)throw new Error(Z)}function c(a,b){if($&&b.stack&&"object"==typeof a&&null!==a&&a.stack&&-1===a.stack.indexOf(cb)){for(var c=[],e=b;e;e=e.source)e.stack&&c.unshift(e.stack);c.unshift(a.stack);var f=c.join("\n"+cb+"\n");a.stack=d(f)}}function d(a){for(var b=a.split("\n"),c=[],d=0,g=b.length;g>d;d++){var h=b[d];e(h)||f(h)||!h||c.push(h)}return c.join("\n")}function e(a){var b=h(a);if(!b)return!1;var c=b[0],d=b[1];return c===ab&&d>=bb&&Oc>=d}function f(a){return-1!==a.indexOf("(module.js:")||-1!==a.indexOf("(node.js:")}function g(){if($)try{throw new Error}catch(a){var b=a.stack.split("\n"),c=b[0].indexOf("@")>0?b[1]:b[2],d=h(c);if(!d)return;return ab=d[0],d[1]}}function h(a){var b=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(a);if(b)return[b[1],Number(b[2])];var c=/at ([^ ]+):(\d+):(?:\d+)$/.exec(a);if(c)return[c[1],Number(c[2])];var d=/.*@(.+):(\d+)$/.exec(a);return d?[d[1],Number(d[2])]:void 0}function i(a){var b=typeof a;return a&&("function"==b||"object"==b)||!1}function j(a){var b=[];if(!i(a))return b;Cb.nonEnumArgs&&a.length&&Db(a)&&(a=Fb.call(a));var c=Cb.enumPrototypes&&"function"==typeof a,d=Cb.enumErrorProps&&(a===wb||a instanceof Error);for(var e in a)c&&"prototype"==e||d&&("message"==e||"name"==e)||b.push(e);if(Cb.nonEnumShadows&&a!==xb){var f=a.constructor,g=-1,h=Ab.length;if(a===(f&&f.prototype))var j=a===yb?sb:a===wb?nb:tb.call(a),k=Bb[j];for(;++g<h;)e=Ab[g],k&&k[e]||!ub.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,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=tb.call(a),h=tb.call(b);if(g==jb&&(g=qb),h==jb&&(h=qb),g!=h)return!1;switch(g){case lb:case mb:return+a==+b;case pb:return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case rb:case sb:return a==String(b)}var i=g==kb;if(!i){if(g!=qb||!Cb.nodeClass&&(m(a)||m(b)))return!1;var j=!Cb.argsObject&&Db(a)?Object:a.constructor,k=!Cb.argsObject&&Db(b)?Object:b.constructor;if(!(j==k||ub.call(a,"constructor")&&ub.call(b,"constructor")||X(j)&&j instanceof j&&X(k)&&k instanceof k||!("constructor"in a&&"constructor"in b)))return!1}c||(c=[]),d||(d=[]);for(var o=c.length;o--;)if(c[o]==a)return d[o]==b;var p=0,q=!0;if(c.push(a),d.push(b),i){if(o=a.length,p=b.length,q=p==o)for(;p--;){var r=b[p];if(!(q=n(a[p],r,c,d)))break}}else l(b,function(b,e,f){return ub.call(f,e)?(p++,q=ub.call(a,e)&&n(a[e],b,c,d)):void 0}),q&&l(a,function(a,b,c){return ub.call(c,b)?q=--p>-1:void 0});return c.pop(),d.pop(),q}function o(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:Fb.call(a)}function p(a,b){for(var c=new Array(a),d=0;a>d;d++)c[d]=b();return c}function q(a,b){this.id=a,this.value=b}function r(a,b){this.scheduler=a,this.disposable=b,this.isDisposed=!1}function t(){this._s=s}function u(){this._s=s,this._l=s.length,this._i=0}function v(a){this._a=a}function w(a){this._a=a,this._l=A(a),this._i=0}function x(a){return"number"==typeof a&&J.isFinite(a)}function y(b){var c,d=b[db];if(!d&&"string"==typeof b)return c=new t(b),c[db]();if(!d&&b.length!==a)return c=new v(b),c[db]();if(!d)throw new TypeError("Object is not iterable");return b[db]()}function z(a){var b=+a;return 0===b?b:isNaN(b)?b:0>b?-1:1}function A(a){var b=+a.length;return isNaN(b)?0:0!==b&&x(b)?(b=z(b)*Math.floor(Math.abs(b)),0>=b?0:b>yc?yc:b):b}function B(a,b){return Q(a)||(a=$b),new Jc(function(c){var d=0,e=b.length;return a.scheduleRecursive(function(a){e>d?(c.onNext(b[d++]),a()):c.onCompleted()})})}function C(a,b){return new Jc(function(c){var d=new Sb,e=new Tb;return e.setDisposable(d),d.setDisposable(a.subscribe(c.onNext.bind(c),function(a){var d,f;try{f=b(a)}catch(g){return void c.onError(g)}W(f)&&(f=vc(f)),d=new Sb,e.setDisposable(d),d.setDisposable(f.subscribe(c))},c.onCompleted.bind(c))),e},a)}function D(a,b){var c=this;return new Jc(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 void d.onError(i)}d.onNext(g)}else d.onCompleted()},d.onError.bind(d),d.onCompleted.bind(d))},c)}function E(a,b,c){return a.map(function(d,e){var f=b.call(c,d,e,a);return W(f)&&(f=vc(f)),(gb(f)||fb(f))&&(f=zc(f)),f}).concatAll()}function F(a,b,c){for(var d=0,e=a.length;e>d;d++)if(c(a[d],b))return d;return-1}function G(a){this.comparer=a,this.set=[]}function H(a,b,c){return a.map(function(d,e){var f=b.call(c,d,e,a);return W(f)&&(f=vc(f)),(gb(f)||fb(f))&&(f=zc(f)),f}).mergeAll()}var I={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},J=I[typeof window]&&window||this,K=I[typeof exports]&&exports&&!exports.nodeType&&exports,L=I[typeof module]&&module&&!module.nodeType&&module,M=L&&L.exports===K&&K,N=I[typeof global]&&global;!N||N.global!==N&&N.window!==N||(J=N);var O={internals:{},config:{Promise:J.Promise},helpers:{}},P=O.helpers.noop=function(){},Q=(O.helpers.notDefined=function(a){return"undefined"==typeof a},O.helpers.isScheduler=function(a){return a instanceof O.Scheduler}),R=O.helpers.identity=function(a){return a},S=(O.helpers.pluck=function(a){return function(b){return b[a]}},O.helpers.just=function(a){return function(){return a}},O.helpers.defaultNow=function(){return Date.now?Date.now:function(){return+new Date}}()),T=O.helpers.defaultComparer=function(a,b){return Eb(a,b)},U=O.helpers.defaultSubComparer=function(a,b){return a>b?1:b>a?-1:0},V=(O.helpers.defaultKeySerializer=function(a){return a.toString()},O.helpers.defaultError=function(a){throw a}),W=O.helpers.isPromise=function(a){return!!a&&"function"==typeof a.then},X=(O.helpers.asArray=function(){return Array.prototype.slice.call(arguments)},O.helpers.not=function(a){return!a},O.helpers.isFunction=function(){var a=function(a){return"function"==typeof a||!1};return a(/x/)&&(a=function(a){return"function"==typeof a&&"[object Function]"==tb.call(a)}),a}()),Y="Argument out of range",Z="Object has been disposed";O.config.longStackSupport=!1;var $=!1;try{throw new Error}catch(_){$=!!_.stack}var ab,bb=g(),cb="From previous event:",db="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";J.Set&&"function"==typeof(new J.Set)["@@iterator"]&&(db="@@iterator");var eb=O.doneEnumerator={done:!0,value:a},fb=O.helpers.isIterable=function(b){return b[db]!==a},gb=O.helpers.isArrayLike=function(b){return b&&b.length!==a};O.helpers.iterator=db;var hb,ib=O.helpers.deprecate=function(){},jb="[object Arguments]",kb="[object Array]",lb="[object Boolean]",mb="[object Date]",nb="[object Error]",ob="[object Function]",pb="[object Number]",qb="[object Object]",rb="[object RegExp]",sb="[object String]",tb=Object.prototype.toString,ub=Object.prototype.hasOwnProperty,vb=tb.call(arguments)==jb,wb=Error.prototype,xb=Object.prototype,yb=String.prototype,zb=xb.propertyIsEnumerable;zb||(zb=xb.propertyIsEnumerable=function(a){for(var b in this)if(b===a)return!0;return!1});try{hb=!(tb.call(document)==qb&&!({toString:0}+""))}catch(_){hb=!0}var Ab=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Bb={};Bb[kb]=Bb[mb]=Bb[pb]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},Bb[lb]=Bb[sb]={constructor:!0,toString:!0,valueOf:!0},Bb[nb]=Bb[ob]=Bb[rb]={constructor:!0,toString:!0},Bb[qb]={constructor:!0};var Cb={};!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);Cb.enumErrorProps=zb.call(wb,"message")||zb.call(wb,"name"),Cb.enumPrototypes=zb.call(a,"prototype"),Cb.nonEnumArgs=0!=c,Cb.nonEnumShadows=!/valueOf/.test(b)}(1);var Db=function(a){return a&&"object"==typeof a?tb.call(a)==jb:!1};vb||(Db=function(a){return a&&"object"==typeof a?ub.call(a,"callee"):!1});var Eb=O.internals.isEqual=function(a,b){return n(a,b,[],[])},Fb=Array.prototype.slice,Gb=({}.hasOwnProperty,this.inherits=O.internals.inherits=function(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c}),Hb=O.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=O.internals.addRef=function(a,b){return new Jc(function(c){return new Nb(b.getDisposable(),a.subscribe(c))})};Function.prototype.bind||(Function.prototype.bind=function(a){var b=this,c=Fb.call(arguments,1),d=function(){function e(){}if(this instanceof d){e.prototype=b.prototype;var f=new e,g=b.apply(f,c.concat(Fb.call(arguments)));return Object(g)===g?g:f}return b.apply(a,c.concat(Fb.call(arguments)))};return d}),Array.prototype.forEach||(Array.prototype.forEach=function(a,b){var c,d;if(null==this)throw new TypeError(" this is null or not defined");var e=Object(this),f=e.length>>>0;if("function"!=typeof a)throw new TypeError(a+" is not a function");for(arguments.length>1&&(c=b),d=0;f>d;){var g;d in e&&(g=e[d],a.call(c,g,d,e)),d++}});var Jb=Object("a"),Kb="a"!=Jb[0]||!(0 in Jb);Array.prototype.every||(Array.prototype.every=function(a){var b=Object(this),c=Kb&&{}.toString.call(this)==sb?this.split(""):b,d=c.length>>>0,e=arguments[1];if({}.toString.call(a)!=ob)throw new TypeError(a+" is not a function");for(var f=0;d>f;f++)if(f in c&&!a.call(e,c[f],f,b))return!1;return!0}),Array.prototype.map||(Array.prototype.map=function(a){var b=Object(this),c=Kb&&{}.toString.call(this)==sb?this.split(""):b,d=c.length>>>0,e=Array(d),f=arguments[1];if({}.toString.call(a)!=ob)throw new TypeError(a+" is not a function");for(var g=0;d>g;g++)g in c&&(e[g]=a.call(f,c[g],g,b));return e}),Array.prototype.filter||(Array.prototype.filter=function(a){for(var b,c=[],d=new Object(this),e=0,f=d.length>>>0;f>e;e++)b=d[e],e in d&&a.call(arguments[1],b,e,d)&&c.push(b);return c}),Array.isArray||(Array.isArray=function(a){return{}.toString.call(a)==kb}),Array.prototype.indexOf||(Array.prototype.indexOf=function(a){var b=Object(this),c=b.length>>>0;if(0===c)return-1;var d=0;if(arguments.length>1&&(d=Number(arguments[1]),d!==d?d=0:0!==d&&1/0!=d&&d!==-1/0&&(d=(d>0||-1)*Math.floor(Math.abs(d)))),d>=c)return-1;for(var e=d>=0?d:Math.max(c-Math.abs(d),0);c>e;e++)if(e in b&&b[e]===a)return e;return-1}),q.prototype.compareTo=function(a){var b=this.value.compareTo(a.value);return 0===b&&(b=this.id-a.id),b};var Lb=O.internals.PriorityQueue=function(a){this.items=new Array(a),this.length=0},Mb=Lb.prototype;Mb.isHigherPriority=function(a,b){return this.items[a].compareTo(this.items[b])<0},Mb.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)}}},Mb.heapify=function(a){if(+a||(a=0),!(a>=this.length||0>a)){var b=2*a+1,c=2*a+2,d=a;if(b<this.length&&this.isHigherPriority(b,d)&&(d=b),c<this.length&&this.isHigherPriority(c,d)&&(d=c),d!==a){var e=this.items[a];this.items[a]=this.items[d],this.items[d]=e,this.heapify(d)}}},Mb.peek=function(){return this.items[0].value},Mb.removeAt=function(a){this.items[a]=this.items[--this.length],delete this.items[this.length],this.heapify()},Mb.dequeue=function(){var a=this.peek();return this.removeAt(0),a},Mb.enqueue=function(a){var b=this.length++;this.items[b]=new q(Lb.count++,a),this.percolate(b)},Mb.remove=function(a){for(var b=0;b<this.length;b++)if(this.items[b].value===a)return this.removeAt(b),!0;return!1},Lb.count=0;var Nb=O.CompositeDisposable=function(){this.disposables=o(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},Ob=Nb.prototype;Ob.add=function(a){this.isDisposed?a.dispose():(this.disposables.push(a),this.length++)},Ob.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},Ob.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()}},Ob.toArray=function(){return this.disposables.slice(0)};var Pb=O.Disposable=function(a){this.isDisposed=!1,this.action=a||P};Pb.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var Qb=Pb.create=function(a){return new Pb(a)},Rb=Pb.empty={dispose:P},Sb=O.SingleAssignmentDisposable=function(){function a(){this.isDisposed=!1,this.current=null}var b=a.prototype;return b.getDisposable=function(){return this.current},b.setDisposable=function(a){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}(),Tb=O.SerialDisposable=Sb,Ub=O.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?Rb:new a(this)},b}();r.prototype.dispose=function(){var a=this;this.scheduler.schedule(function(){a.isDisposed||(a.isDisposed=!0,a.disposable.dispose())})};var Vb=O.internals.ScheduledItem=function(a,b,c,d,e){this.scheduler=a,this.state=b,this.action=c,this.dueTime=d,this.comparer=e||U,this.disposable=new Sb};Vb.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},Vb.prototype.compareTo=function(a){return this.comparer(this.dueTime,a.dueTime)},Vb.prototype.isCancelled=function(){return this.disposable.isDisposed},Vb.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var Wb=O.Scheduler=function(){function a(a,b,c,d){this.now=a,this._schedule=b,this._scheduleRelative=c,this._scheduleAbsolute=d}function b(a,b){return b(),Rb}var c=a.prototype;return c.schedule=function(a){return this._schedule(a,b)},c.scheduleWithState=function(a,b){return this._schedule(a,b)},c.scheduleWithRelative=function(a,c){return this._scheduleRelative(c,a,b)},c.scheduleWithRelativeAndState=function(a,b,c){return this._scheduleRelative(a,b,c)},c.scheduleWithAbsolute=function(a,c){return this._scheduleAbsolute(c,a,b)},c.scheduleWithAbsoluteAndState=function(a,b,c){return this._scheduleAbsolute(a,b,c)},a.now=S,a.normalize=function(a){return 0>a&&(a=0),a},a}(),Xb=Wb.normalize;!function(a){function b(a,b){var c=b.first,d=b.second,e=new Nb,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),Rb});d||(e.add(g),c=!0)})};return f(c),e}function c(a,b,c){var d=b.first,e=b.second,f=new Nb,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),Rb});h||(f.add(i),e=!0)})};return g(d),f}function d(a,b){a(function(c){b(a,c)})}a.scheduleRecursive=function(a){return this.scheduleRecursiveWithState(a,function(a,b){a(function(){b(a)})})},a.scheduleRecursiveWithState=function(a,c){return this.scheduleWithState({first:a,second:c},b)},a.scheduleRecursiveWithRelative=function(a,b){return this.scheduleRecursiveWithRelativeAndState(b,a,d)},a.scheduleRecursiveWithRelativeAndState=function(a,b,d){return this._scheduleRelative({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithRelativeAndState")})},a.scheduleRecursiveWithAbsolute=function(a,b){return this.scheduleRecursiveWithAbsoluteAndState(b,a,d)},a.scheduleRecursiveWithAbsoluteAndState=function(a,b,d){return this._scheduleAbsolute({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithAbsoluteAndState")})}}(Wb.prototype),function(){Wb.prototype.schedulePeriodic=function(a,b){return this.schedulePeriodicWithState(null,a,b)},Wb.prototype.schedulePeriodicWithState=function(a,b,c){if("undefined"==typeof J.setInterval)throw new Error("Periodic scheduling not supported.");var d=a,e=J.setInterval(function(){d=c(d)},b);return Qb(function(){J.clearInterval(e)})}}(Wb.prototype),function(a){a.catchError=a["catch"]=function(a){return new dc(this,a)}}(Wb.prototype);var Yb,Zb=(O.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 Sb;return this._cancel=b,b.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,a.bind(this))),b},b}(),Wb.immediate=function(){function a(a,b){return b(this,a)}function b(a,b,c){for(var d=Xb(b);d-this.now()>0;);return c(this,a)}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new Wb(S,a,b,c)}()),$b=Wb.currentThread=function(){function a(a){for(var b;a.length>0;)if(b=a.dequeue(),!b.isCancelled()){for(;b.dueTime-Wb.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()+Wb.normalize(c),g=new Vb(this,b,d,f);if(e)e.enqueue(g);else{e=new Lb(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 Wb(S,b,c,d);return f.scheduleRequired=function(){return!e},f.ensureTrampoline=function(a){e?a():this.schedule(a)},f}(),_b=P,ac=function(){var a,b=P;if("WScript"in this)a=function(a,b){WScript.Sleep(b),a()};else{if(!J.setTimeout)throw new Error("No concurrency detected!");a=J.setTimeout,b=J.clearTimeout}return{setTimeout:a,clearTimeout:b}}(),bc=ac.setTimeout,cc=ac.clearTimeout;!function(){function a(){if(!J.postMessage||J.importScripts)return!1;var a=!1,b=J.onmessage;return J.onmessage=function(){a=!0},J.postMessage("","*"),J.onmessage=b,a}var b=RegExp("^"+String(tb).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),c="function"==typeof(c=N&&M&&N.setImmediate)&&!b.test(c)&&c,d="function"==typeof(d=N&&M&&N.clearImmediate)&&!b.test(d)&&d;if("function"==typeof c)Yb=c,_b=d;else if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))Yb=process.nextTick;else if(a()){var e="ms.rx.schedule"+Math.random(),f={},g=0,h=function(a){if("string"==typeof a.data&&a.data.substring(0,e.length)===e){var b=a.data.substring(e.length),c=f[b];c(),delete f[b]}};J.addEventListener?J.addEventListener("message",h,!1):J.attachEvent("onmessage",h,!1),Yb=function(a){var b=g++;f[b]=a,J.postMessage(e+b,"*")}}else if(J.MessageChannel){var i=new J.MessageChannel,j={},k=0;i.port1.onmessage=function(a){var b=a.data,c=j[b];c(),delete j[b]},Yb=function(a){var b=k++;j[b]=a,i.port2.postMessage(b)}}else"document"in J&&"onreadystatechange"in J.document.createElement("script")?Yb=function(a){var b=J.document.createElement("script");b.onreadystatechange=function(){a(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},J.document.documentElement.appendChild(b)}:(Yb=function(a){return bc(a,0)},_b=cc)}();var dc=(Wb.timeout=function(){function a(a,b){var c=this,d=new Sb,e=Yb(function(){d.isDisposed||d.setDisposable(b(c,a))});return new Nb(d,Qb(function(){_b(e)}))}function b(a,b,c){var d=this,e=Wb.normalize(b);if(0===e)return d.scheduleWithState(a,c);var f=new Sb,g=bc(function(){f.isDisposed||f.setDisposable(c(d,a))},e);return new Nb(f,Qb(function(){cc(g)}))}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new Wb(S,a,b,c)}(),function(a){function b(a,b){return this._scheduler.scheduleWithState(a,this._wrap(b))}function c(a,b,c){return this._scheduler.scheduleWithRelativeAndState(a,b,this._wrap(c))}function d(a,b,c){return this._scheduler.scheduleWithAbsoluteAndState(a,b,this._wrap(c))}function e(e,f){this._scheduler=e,this._handler=f,this._recursiveOriginal=null,this._recursiveWrapper=null,a.call(this,this._scheduler.now.bind(this._scheduler),b,c,d)}return Gb(e,a),e.prototype._clone=function(a){return new e(a,this._handler)},e.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 Rb}}},e.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},e.prototype.schedulePeriodicWithState=function(a,b,c){var d=this,e=!1,f=new Sb;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},e}(Wb)),ec=O.Notification=function(){function a(a,b){this.hasValue=null==b?!1:b,this.kind=a}return a.prototype.accept=function(a,b,c){return a&&"object"==typeof a?this._acceptObservable(a):this._accept(a,b,c)},a.prototype.toObservable=function(a){var b=this;return Q(a)||(a=Zb),new Jc(function(c){return a.schedule(function(){b._acceptObservable(c),"N"===b.kind&&c.onCompleted()})})},a}(),fc=ec.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 ec("N",!0);return e.value=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),gc=ec.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 ec("E");return e.exception=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),hc=ec.createOnCompleted=function(){function a(a,b,c){return c()}function b(a){return a.onCompleted()}function c(){return"OnCompleted()"}return function(){var d=new ec("C");return d._accept=a,d._acceptObservable=b,d.toString=c,d}}(),ic=O.internals.Enumerator=function(a){this._next=a};ic.prototype.next=function(){return this._next()},ic.prototype[db]=function(){return this};var jc=O.internals.Enumerable=function(a){this._iterator=a};jc.prototype[db]=function(){return this._iterator()},jc.prototype.concat=function(){var a=this;return new Jc(function(b){var c;try{c=a[db]()}catch(d){return void b.onError(d)}var e,f=new Tb,g=Zb.scheduleRecursive(function(a){var d;if(!e){try{d=c.next()}catch(g){return void b.onError(g)}if(d.done)return void b.onCompleted();var h=d.value;W(h)&&(h=vc(h));var i=new Sb;f.setDisposable(i),i.setDisposable(h.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){a()}))}});return new Nb(f,g,Qb(function(){e=!0}))})},jc.prototype.catchError=function(){var a=this;return new Jc(function(b){var c;try{c=a[db]()}catch(d){return void b.onError(d)}var e,f,g=new Tb,h=Zb.scheduleRecursive(function(a){if(!e){var d;try{d=c.next()}catch(h){return void b.onError(h)}if(d.done)return void(f?b.onError(f):b.onCompleted());var i=d.value;W(i)&&(i=vc(i));var j=new Sb;g.setDisposable(j),j.setDisposable(i.subscribe(b.onNext.bind(b),function(b){f=b,a()},b.onCompleted.bind(b)))}});return new Nb(g,h,Qb(function(){e=!0}))})};var kc=jc.repeat=function(a,b){return null==b&&(b=-1),new jc(function(){var c=b;return new ic(function(){return 0===c?eb:(c>0&&c--,{done:!1,value:a})})})},lc=jc.of=function(a,b,c){return b||(b=R),new jc(function(){var d=-1;return new ic(function(){return++d<a.length?{done:!1,value:b.call(c,a[d],d,a)}:eb})})},mc=O.Observer=function(){};mc.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},mc.prototype.asObserver=function(){return new qc(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},mc.prototype.checked=function(){return new rc(this)};var nc=mc.create=function(a,b,c){return a||(a=P),b||(b=V),c||(c=P),new qc(a,b,c)};mc.fromNotifier=function(a,b){return new qc(function(c){return a.call(b,fc(c))},function(c){return a.call(b,gc(c))},function(){return a.call(b,hc())})},mc.prototype.notifyOn=function(a){return new tc(a,this)};var oc,pc=O.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}(mc),qc=O.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}(pc),rc=function(a){function b(b){a.call(this),this._observer=b,this._state=0}Gb(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}(mc),sc=O.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 Tb}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 void(b.isAcquired=!1);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}(pc),tc=function(a){function b(b,c,d){a.call(this,b,c),this._cancel=d}return Gb(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.prototype.dispose=function(){a.prototype.dispose.call(this),this._cancel&&this._cancel.dispose(),this._cancel=null},b}(sc),uc=O.Observable=function(){function a(a){if(O.config.longStackSupport&&$){try{throw new Error}catch(b){this.stack=b.stack.substring(b.stack.indexOf("\n")+1)}var d=this;this._subscribe=function(b){var e=b.onError.bind(b);return b.onError=function(a){c(a,d),e(a)},a(b)}}else this._subscribe=a}return oc=a.prototype,oc.subscribe=oc.forEach=function(a,b,c){return this._subscribe("object"==typeof a?a:nc(a,b,c))},oc.subscribeOnNext=function(a,b){return this._subscribe(nc(2===arguments.length?function(c){a.call(b,c)}:a))},oc.subscribeOnError=function(a,b){return this._subscribe(nc(null,2===arguments.length?function(c){a.call(b,c)}:a))},oc.subscribeOnCompleted=function(a,b){return this._subscribe(nc(null,null,2===arguments.length?function(){a.call(b)}:a))},a}();oc.observeOn=function(a){var b=this;return new Jc(function(c){return b.subscribe(new tc(a,c))},b)},oc.subscribeOn=function(a){var b=this;return new Jc(function(c){var d=new Sb,e=new Tb;return e.setDisposable(d),d.setDisposable(a.schedule(function(){e.setDisposable(new r(a,b.subscribe(c)))})),e},b)};var vc=uc.fromPromise=function(a){return wc(function(){var b=new O.AsyncSubject;return a.then(function(a){b.onNext(a),b.onCompleted()},b.onError.bind(b)),b})};oc.toPromise=function(a){if(a||(a=O.config.Promise),!a)throw new TypeError("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},c,function(){e&&a(d)})})},oc.toArray=function(){var a=this;return new Jc(function(b){var c=[];return a.subscribe(c.push.bind(c),b.onError.bind(b),function(){b.onNext(c),b.onCompleted()})},a)},uc.create=uc.createWithDisposable=function(a,b){return new Jc(a,b)};var wc=uc.defer=function(a){return new Jc(function(b){var c;try{c=a()}catch(d){return Dc(d).subscribe(b)}return W(c)&&(c=vc(c)),c.subscribe(b)})},xc=uc.empty=function(a){return Q(a)||(a=Zb),new Jc(function(b){return a.schedule(function(){b.onCompleted()})})},yc=Math.pow(2,53)-1;t.prototype[db]=function(){return new u(this._s)},u.prototype[db]=function(){return this},u.prototype.next=function(){if(this._i<this._l){var a=this._s.charAt(this._i++);return{done:!1,value:a}}return eb},v.prototype[db]=function(){return new w(this._a)},w.prototype[db]=function(){return this},w.prototype.next=function(){if(this._i<this._l){var a=this._a[this._i++];return{done:!1,value:a}}return eb};var zc=uc.from=function(a,b,c,d){if(null==a)throw new Error("iterable cannot be null.");if(b&&!X(b))throw new Error("mapFn when provided must be a function");Q(d)||(d=$b);var e=Object(a),f=y(e);return new Jc(function(a){var e=0;return d.scheduleRecursive(function(d){var g;try{g=f.next()}catch(h){return void a.onError(h)}if(g.done)return void a.onCompleted();var i=g.value;if(b&&X(b))try{i=b.call(c,i,e)}catch(h){return void a.onError(h)}a.onNext(i),e++,d()})})},Ac=uc.fromArray=function(a,b){return ib("fromArray","from"),Q(b)||(b=$b),new Jc(function(c){var d=0,e=a.length;return b.scheduleRecursive(function(b){e>d?(c.onNext(a[d++]),b()):c.onCompleted()})})};uc.generate=function(a,b,c,d,e){return Q(e)||(e=$b),new Jc(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 void f.onError(j)}e?(f.onNext(i),a()):f.onCompleted()})})};var Bc=uc.never=function(){return new Jc(function(){return Rb})};uc.of=function(){return B(null,arguments)},uc.ofWithScheduler=function(a){return B(a,Fb.call(arguments,1))},uc.range=function(a,b,c){return Q(c)||(c=$b),new Jc(function(d){return c.scheduleRecursiveWithState(0,function(c,e){b>c?(d.onNext(a+c),e(c+1)):d.onCompleted()})})},uc.repeat=function(a,b,c){return Q(c)||(c=$b),Cc(a,c).repeat(null==b?-1:b)};var Cc=uc["return"]=uc.just=function(a,b){return Q(b)||(b=Zb),new Jc(function(c){return b.schedule(function(){c.onNext(a),c.onCompleted()})})};uc.returnValue=function(){return ib("returnValue","return or just"),Cc.apply(null,arguments)};var Dc=uc["throw"]=uc.throwException=uc.throwError=function(a,b){return Q(b)||(b=Zb),new Jc(function(c){return b.schedule(function(){c.onError(a)})})};uc.using=function(a,b){return new Jc(function(c){var d,e,f=Rb;try{d=a(),d&&(f=d),e=b(d)}catch(g){return new Nb(Dc(g).subscribe(c),f)}return new Nb(e.subscribe(c),f)})},oc.amb=function(a){var b=this;return new Jc(function(c){function d(){f||(f=g,j.dispose())}function e(){f||(f=h,i.dispose())}var f,g="L",h="R",i=new Sb,j=new Sb;return W(a)&&(a=vc(a)),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 Nb(i,j)})},uc.amb=function(){function a(a,b){return a.amb(b)}for(var b=Bc(),c=o(arguments,0),d=0,e=c.length;e>d;d++)b=a(b,c[d]);return b},oc["catch"]=oc.catchError=function(a){return"function"==typeof a?C(this,a):Ec([this,a])},oc.catchException=function(a){return ib("catchException","catch or catchError"),this.catchError(a)
3
+ };var Ec=uc.catchError=uc["catch"]=function(){return lc(o(arguments,0)).catchError()};uc.catchException=function(){return ib("catchException","catch or catchError"),Ec.apply(null,arguments)},oc.combineLatest=function(){var a=Fb.call(arguments);return Array.isArray(a[0])?a[0].unshift(this):a.unshift(this),Fc.apply(this,a)};var Fc=uc.combineLatest=function(){var a=Fb.call(arguments),b=a.pop();return Array.isArray(a[0])&&(a=a[0]),new Jc(function(c){function d(a){var d;if(h[a]=!0,i||(i=h.every(R))){try{d=b.apply(null,k)}catch(e){return void c.onError(e)}c.onNext(d)}else j.filter(function(b,c){return c!==a}).every(R)&&c.onCompleted()}function e(a){j[a]=!0,j.every(R)&&c.onCompleted()}for(var f=function(){return!1},g=a.length,h=p(g,f),i=!1,j=p(g,f),k=new Array(g),l=new Array(g),m=0;g>m;m++)!function(b){var f=a[b],g=new Sb;W(f)&&(f=vc(f)),g.setDisposable(f.subscribe(function(a){k[b]=a,d(b)},c.onError.bind(c),function(){e(b)})),l[b]=g}(m);return new Nb(l)},this)};oc.concat=function(){var a=Fb.call(arguments,0);return a.unshift(this),Gc.apply(this,a)};var Gc=uc.concat=function(){return lc(o(arguments,0)).concat()};oc.concatAll=function(){return this.merge(1)},oc.concatObservable=function(){return ib("concatObservable","concatAll"),this.merge(1)},oc.merge=function(a){if("number"!=typeof a)return Hc(this,a);var b=this;return new Jc(function(c){function d(a){var b=new Sb;f.add(b),W(a)&&(a=vc(a)),b.setDisposable(a.subscribe(c.onNext.bind(c),c.onError.bind(c),function(){f.remove(b),h.length>0?d(h.shift()):(e--,g&&0===e&&c.onCompleted())}))}var e=0,f=new Nb,g=!1,h=[];return f.add(b.subscribe(function(b){a>e?(e++,d(b)):h.push(b)},c.onError.bind(c),function(){g=!0,0===e&&c.onCompleted()})),f},b)};var Hc=uc.merge=function(){var a,b;return arguments[0]?Q(arguments[0])?(a=arguments[0],b=Fb.call(arguments,1)):(a=Zb,b=Fb.call(arguments,0)):(a=Zb,b=Fb.call(arguments,1)),Array.isArray(b[0])&&(b=b[0]),B(a,b).mergeAll()};oc.mergeAll=function(){var a=this;return new Jc(function(b){var c=new Nb,d=!1,e=new Sb;return c.add(e),e.setDisposable(a.subscribe(function(a){var e=new Sb;c.add(e),W(a)&&(a=vc(a)),e.setDisposable(a.subscribe(b.onNext.bind(b),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},a)},oc.mergeObservable=function(){return ib("mergeObservable","mergeAll"),this.mergeAll.apply(this,arguments)},oc.onErrorResumeNext=function(a){if(!a)throw new Error("Second observable is required");return Ic([this,a])};var Ic=uc.onErrorResumeNext=function(){var a=o(arguments,0);return new Jc(function(b){var c=0,d=new Tb,e=Zb.scheduleRecursive(function(e){var f,g;c<a.length?(f=a[c++],W(f)&&(f=vc(f)),g=new Sb,d.setDisposable(g),g.setDisposable(f.subscribe(b.onNext.bind(b),e,e))):b.onCompleted()});return new Nb(d,e)})};oc.skipUntil=function(a){var b=this;return new Jc(function(c){var d=!1,e=new Nb(b.subscribe(function(a){d&&c.onNext(a)},c.onError.bind(c),function(){d&&c.onCompleted()}));W(a)&&(a=vc(a));var f=new Sb;return e.add(f),f.setDisposable(a.subscribe(function(){d=!0,f.dispose()},c.onError.bind(c),function(){f.dispose()})),e},b)},oc["switch"]=oc.switchLatest=function(){var a=this;return new Jc(function(b){var c=!1,d=new Tb,e=!1,f=0,g=a.subscribe(function(a){var g=new Sb,h=++f;c=!0,d.setDisposable(g),W(a)&&(a=vc(a)),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 Nb(g,d)},a)},oc.takeUntil=function(a){var b=this;return new Jc(function(c){return W(a)&&(a=vc(a)),new Nb(b.subscribe(c),a.subscribe(c.onCompleted.bind(c),c.onError.bind(c),P))},b)},oc.zip=function(){if(Array.isArray(arguments[0]))return D.apply(this,arguments);var a=this,b=Fb.call(arguments),c=b.pop();return b.unshift(a),new Jc(function(d){function e(b){var e,f;if(h.every(function(a){return a.length>0})){try{f=h.map(function(a){return a.shift()}),e=c.apply(a,f)}catch(g){return void d.onError(g)}d.onNext(e)}else i.filter(function(a,c){return c!==b}).every(R)&&d.onCompleted()}function f(a){i[a]=!0,i.every(function(a){return a})&&d.onCompleted()}for(var g=b.length,h=p(g,function(){return[]}),i=p(g,function(){return!1}),j=new Array(g),k=0;g>k;k++)!function(a){var c=b[a],g=new Sb;W(c)&&(c=vc(c)),g.setDisposable(c.subscribe(function(b){h[a].push(b),e(a)},d.onError.bind(d),function(){f(a)})),j[a]=g}(k);return new Nb(j)},a)},uc.zip=function(){var a=Fb.call(arguments,0),b=a.shift();return b.zip.apply(b,a)},uc.zipArray=function(){var a=o(arguments,0);return new Jc(function(b){function c(a){if(f.every(function(a){return a.length>0})){var c=f.map(function(a){return a.shift()});b.onNext(c)}else if(g.filter(function(b,c){return c!==a}).every(R))return void b.onCompleted()}function d(a){return g[a]=!0,g.every(R)?void b.onCompleted():void 0}for(var e=a.length,f=p(e,function(){return[]}),g=p(e,function(){return!1}),h=new Array(e),i=0;e>i;i++)!function(e){h[e]=new Sb,h[e].setDisposable(a[e].subscribe(function(a){f[e].push(a),c(e)},b.onError.bind(b),function(){d(e)}))}(i);var j=new Nb(h);return j.add(Qb(function(){for(var a=0,b=f.length;b>a;a++)f[a]=[]})),j})},oc.asObservable=function(){return new Jc(this.subscribe.bind(this),this)},oc.bufferWithCount=function(a,b){return"number"!=typeof b&&(b=a),this.windowWithCount(a,b).selectMany(function(a){return a.toArray()}).where(function(a){return a.length>0})},oc.dematerialize=function(){var a=this;return new Jc(function(b){return a.subscribe(function(a){return a.accept(b)},b.onError.bind(b),b.onCompleted.bind(b))},this)},oc.distinctUntilChanged=function(a,b){var c=this;return a||(a=R),b||(b=T),new Jc(function(d){var e,f=!1;return c.subscribe(function(c){var g,h=!1;try{g=a(c)}catch(i){return void d.onError(i)}if(f)try{h=b(e,g)}catch(i){return void d.onError(i)}f&&h||(f=!0,e=g,d.onNext(c))},d.onError.bind(d),d.onCompleted.bind(d))},this)},oc["do"]=oc.tap=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 Jc(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)},function(){if(c)try{c()}catch(b){a.onError(b)}a.onCompleted()})},this)},oc.doAction=function(){return ib("doAction","do or tap"),this.tap.apply(this,arguments)},oc.doOnNext=oc.tapOnNext=function(a,b){return this.tap(2===arguments.length?function(c){a.call(b,c)}:a)},oc.doOnError=oc.tapOnError=function(a,b){return this.tap(P,2===arguments.length?function(c){a.call(b,c)}:a)},oc.doOnCompleted=oc.tapOnCompleted=function(a,b){return this.tap(P,null,2===arguments.length?function(){a.call(b)}:a)},oc["finally"]=oc.ensure=function(a){var b=this;return new Jc(function(c){var d;try{d=b.subscribe(c)}catch(e){throw a(),e}return Qb(function(){try{d.dispose()}catch(b){throw b}finally{a()}})},this)},oc.finallyAction=function(a){return ib("finallyAction","finally or ensure"),this.ensure(a)},oc.ignoreElements=function(){var a=this;return new Jc(function(b){return a.subscribe(P,b.onError.bind(b),b.onCompleted.bind(b))},a)},oc.materialize=function(){var a=this;return new Jc(function(b){return a.subscribe(function(a){b.onNext(fc(a))},function(a){b.onNext(gc(a)),b.onCompleted()},function(){b.onNext(hc()),b.onCompleted()})},a)},oc.repeat=function(a){return kc(this,a).concat()},oc.retry=function(a){return kc(this,a).catchError()},oc.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 Jc(function(e){var f,g,h;return d.subscribe(function(d){!h&&(h=!0);try{f?g=b(g,d):(g=c?b(a,d):d,f=!0)}catch(i){return void e.onError(i)}e.onNext(g)},e.onError.bind(e),function(){!h&&c&&e.onNext(a),e.onCompleted()})},d)},oc.skipLast=function(a){var b=this;return new Jc(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))},b)},oc.startWith=function(){var a,b,c=0;return arguments.length&&Q(arguments[0])?(b=arguments[0],c=1):b=Zb,a=Fb.call(arguments,c),lc([Ac(a,b),this]).concat()},oc.takeLast=function(a){var b=this;return new Jc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},c.onError.bind(c),function(){for(;d.length>0;)c.onNext(d.shift());c.onCompleted()})},b)},oc.takeLastBuffer=function(a){var b=this;return new Jc(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()})},b)},oc.windowWithCount=function(a,b){var c=this;if(+a||(a=0),1/0===Math.abs(a)&&(a=0),0>=a)throw new Error(Y);if(null==b&&(b=a),+b||(b=0),1/0===Math.abs(b)&&(b=0),0>=b)throw new Error(Y);return new Jc(function(d){function e(){var a=new Mc;i.push(a),d.onNext(Ib(a,g))}var f=new Sb,g=new Ub(f),h=0,i=[];return e(),f.setDisposable(c.subscribe(function(c){for(var d=0,f=i.length;f>d;d++)i[d].onNext(c);var g=h-a+1;g>=0&&g%b===0&&i.shift().onCompleted(),++h%b===0&&e()},function(a){for(;i.length>0;)i.shift().onError(a);d.onError(a)},function(){for(;i.length>0;)i.shift().onCompleted();d.onCompleted()})),g},c)},oc.selectConcat=oc.concatMap=function(a,b,c){return X(a)&&X(b)?this.concatMap(function(c,d){var e=a(c,d);return W(e)&&(e=vc(e)),(gb(e)||fb(e))&&(e=zc(e)),e.map(function(a,e){return b(c,a,d,e)})}):X(a)?E(this,a,c):E(this,function(){return a})},oc.concatMapObserver=oc.selectConcatObserver=function(a,b,c,d){var e=this;return new Jc(function(f){var g=0;return e.subscribe(function(b){var c;try{c=a.call(d,b,g++)}catch(e){return void f.onError(e)}W(c)&&(c=vc(c)),f.onNext(c)},function(a){var c;try{c=b.call(d,a)}catch(e){return void f.onError(e)}W(c)&&(c=vc(c)),f.onNext(c),f.onCompleted()},function(){var a;try{a=c.call(d)}catch(b){return void f.onError(b)}W(a)&&(a=vc(a)),f.onNext(a),f.onCompleted()})},this).concatAll()},oc.defaultIfEmpty=function(b){var c=this;return b===a&&(b=null),new Jc(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()})},this)},G.prototype.push=function(a){var b=-1===F(this.set,a,this.comparer);return b&&this.set.push(a),b},oc.distinct=function(a,b){var c=this;return b||(b=T),new Jc(function(d){var e=new G(b);return c.subscribe(function(b){var c=b;if(a)try{c=a(b)}catch(f){return void d.onError(f)}e.push(c)&&d.onNext(b)},d.onError.bind(d),d.onCompleted.bind(d))},this)},oc.select=oc.map=function(a,b){var c=X(a)?a:function(){return a},d=this;return new Jc(function(a){var e=0;return d.subscribe(function(f){var g;try{g=c.call(b,f,e++,d)}catch(h){return void a.onError(h)}a.onNext(g)},a.onError.bind(a),a.onCompleted.bind(a))},d)},oc.pluck=function(a){return this.map(function(b){return b[a]})},oc.selectMany=oc.flatMap=function(a,b,c){return X(a)&&X(b)?this.flatMap(function(c,d){var e=a(c,d);return W(e)&&(e=vc(e)),(gb(e)||fb(e))&&(e=zc(e)),e.map(function(a,e){return b(c,a,d,e)})},c):X(a)?H(this,a,c):H(this,function(){return a})},oc.flatMapObserver=oc.selectManyObserver=function(a,b,c,d){var e=this;return new Jc(function(f){var g=0;return e.subscribe(function(b){var c;try{c=a.call(d,b,g++)}catch(e){return void f.onError(e)}W(c)&&(c=vc(c)),f.onNext(c)},function(a){var c;try{c=b.call(d,a)}catch(e){return void f.onError(e)}W(c)&&(c=vc(c)),f.onNext(c),f.onCompleted()},function(){var a;try{a=c.call(d)}catch(b){return void f.onError(b)}W(a)&&(a=vc(a)),f.onNext(a),f.onCompleted()})},e).mergeAll()},oc.selectSwitch=oc.flatMapLatest=oc.switchMap=function(a,b){return this.select(a,b).switchLatest()},oc.skip=function(a){if(0>a)throw new Error(Y);var b=this;return new Jc(function(c){var d=a;return b.subscribe(function(a){0>=d?c.onNext(a):d--},c.onError.bind(c),c.onCompleted.bind(c))},b)},oc.skipWhile=function(a,b){var c=this;return new Jc(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 void d.onError(h)}f&&d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))},c)},oc.take=function(a,b){if(0>a)throw new RangeError(Y);if(0===a)return xc(b);var c=this;return new Jc(function(b){var d=a;return c.subscribe(function(a){d-->0&&(b.onNext(a),0===d&&b.onCompleted())},b.onError.bind(b),b.onCompleted.bind(b))},c)},oc.takeWhile=function(a,b){var c=this;return new Jc(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 void d.onError(h)}f?d.onNext(g):d.onCompleted()}},d.onError.bind(d),d.onCompleted.bind(d))},c)},oc.where=oc.filter=function(a,b){var c=this;return new Jc(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return void d.onError(h)}g&&d.onNext(f)},d.onError.bind(d),d.onCompleted.bind(d))},c)},oc.transduce=function(a){function b(a){return{init:function(){return a},step:function(a,b){return a.onNext(b)},result:function(a){return a.onCompleted()}}}var c=this;return new Jc(function(d){var e=a(b(d));return c.subscribe(function(a){try{e.step(d,a)}catch(b){d.onError(b)}},d.onError.bind(d),function(){e.result(d)})},c)};var Jc=O.AnonymousObservable=function(a){function b(a){return a&&"function"==typeof a.dispose?a:"function"==typeof a?Qb(a):Rb}function c(d,e){function f(a){var c=function(){try{e.setDisposable(b(d(e)))}catch(a){if(!e.fail(a))throw a}},e=new Kc(a);return $b.scheduleRequired()?$b.schedule(c):c(),e}return this.source=e,this instanceof c?void a.call(this,f):new c(d)}return Gb(c,a),c}(uc),Kc=function(a){function b(b){a.call(this),this.observer=b,this.m=new Sb}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.dispose=function(){a.prototype.dispose.call(this),this.m.dispose()},b}(pc),Lc=function(a,b){this.subject=a,this.observer=b};Lc.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 Mc=O.Subject=function(a){function c(a){return b.call(this),this.isStopped?this.exception?(a.onError(this.exception),Rb):(a.onCompleted(),Rb):(this.observers.push(a),new Lc(this,a))}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return Gb(d,a),Hb(d.prototype,mc,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(b.call(this),!this.isStopped){var a=this.observers.slice(0);this.isStopped=!0;for(var c=0,d=a.length;d>c;c++)a[c].onCompleted();this.observers=[]}},onError:function(a){if(b.call(this),!this.isStopped){var c=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var d=0,e=c.length;e>d;d++)c[d].onError(a);this.observers=[]}},onNext:function(a){if(b.call(this),!this.isStopped)for(var c=this.observers.slice(0),d=0,e=c.length;e>d;d++)c[d].onNext(a)},dispose:function(){this.isDisposed=!0,this.observers=null}}),d.create=function(a,b){return new Nc(a,b)},d}(uc),Nc=(O.AsyncSubject=function(a){function c(a){if(b.call(this),!this.isStopped)return this.observers.push(a),new Lc(this,a);var c=this.exception,d=this.hasValue,e=this.value;return c?a.onError(c):d?(a.onNext(e),a.onCompleted()):a.onCompleted(),Rb}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return Gb(d,a),Hb(d.prototype,mc,{hasObservers:function(){return b.call(this),this.observers.length>0},onCompleted:function(){var a,c,d;if(b.call(this),!this.isStopped){this.isStopped=!0;var e=this.observers.slice(0),f=this.value,g=this.hasValue;if(g)for(c=0,d=e.length;d>c;c++)a=e[c],a.onNext(f),a.onCompleted();else for(c=0,d=e.length;d>c;c++)e[c].onCompleted();this.observers=[]}},onError:function(a){if(b.call(this),!this.isStopped){var c=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var d=0,e=c.length;e>d;d++)c[d].onError(a);this.observers=[]}},onNext:function(a){b.call(this),this.isStopped||(this.value=a,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),d}(uc),O.AnonymousSubject=function(a){function b(b,c){this.observer=b,this.observable=c,a.call(this,this.observable.subscribe.bind(this.observable))}return Gb(b,a),Hb(b.prototype,mc,{onCompleted:function(){this.observer.onCompleted()},onError:function(a){this.observer.onError(a)},onNext:function(a){this.observer.onNext(a)}}),b}(uc));"function"==typeof define&&"object"==typeof define.amd&&define.amd?(J.Rx=O,define(function(){return O})):K&&L?M?(L.exports=O).Rx=O:K.Rx=O:J.Rx=O;var Oc=g()}).call(this);
4
4
  //# sourceMappingURL=rx.compat.map
@@ -122,8 +122,6 @@
122
122
  }
123
123
  var fileName = fileNameAndLineNumber[0], lineNumber = fileNameAndLineNumber[1];
124
124
 
125
- console.log(rFileName, rStartingLine, rEndingLine);
126
-
127
125
  return fileName === rFileName &&
128
126
  lineNumber >= rStartingLine &&
129
127
  lineNumber <= rEndingLine;
@@ -211,6 +209,14 @@
211
209
  stringProto = String.prototype,
212
210
  propertyIsEnumerable = objectProto.propertyIsEnumerable;
213
211
 
212
+ // Fix for Tessel
213
+ if (!propertyIsEnumerable) {
214
+ propertyIsEnumerable = objectProto.propertyIsEnumerable = function (key) {
215
+ for (var k in this) { if (k === key) { return true; } }
216
+ return false;
217
+ };
218
+ }
219
+
214
220
  try {
215
221
  supportNodeClass = !(toString.call(document) == objectClass && !({ 'toString': 0 } + ''));
216
222
  } catch (e) {
@@ -2040,16 +2046,18 @@
2040
2046
 
2041
2047
  var self = this;
2042
2048
  this._subscribe = function (observer) {
2049
+ var oldOnError = observer.onError.bind(observer);
2050
+
2043
2051
  observer.onError = function (err) {
2044
- makeStackTraceLong(self, err);
2045
- observer.onError(err);
2052
+ makeStackTraceLong(err, self);
2053
+ oldOnError(err);
2046
2054
  };
2047
2055
 
2048
- subscribe(observer);
2056
+ return subscribe(observer);
2049
2057
  };
2058
+ } else {
2059
+ this._subscribe = subscribe;
2050
2060
  }
2051
-
2052
- this._subscribe = subscribe;
2053
2061
  }
2054
2062
 
2055
2063
  observableProto = Observable.prototype;
@@ -4134,7 +4142,7 @@
4134
4142
  return source.subscribe(function (value) {
4135
4143
  var shouldRun;
4136
4144
  try {
4137
- shouldRun = predicate.call(thisArg, value, count++, parent);
4145
+ shouldRun = predicate.call(thisArg, value, count++, source);
4138
4146
  } catch (e) {
4139
4147
  observer.onError(e);
4140
4148
  return;
@@ -122,8 +122,6 @@
122
122
  }
123
123
  var fileName = fileNameAndLineNumber[0], lineNumber = fileNameAndLineNumber[1];
124
124
 
125
- console.log(rFileName, rStartingLine, rEndingLine);
126
-
127
125
  return fileName === rFileName &&
128
126
  lineNumber >= rStartingLine &&
129
127
  lineNumber <= rEndingLine;
@@ -211,6 +209,14 @@
211
209
  stringProto = String.prototype,
212
210
  propertyIsEnumerable = objectProto.propertyIsEnumerable;
213
211
 
212
+ // Fix for Tessel
213
+ if (!propertyIsEnumerable) {
214
+ propertyIsEnumerable = objectProto.propertyIsEnumerable = function (key) {
215
+ for (var k in this) { if (k === key) { return true; } }
216
+ return false;
217
+ };
218
+ }
219
+
214
220
  try {
215
221
  supportNodeClass = !(toString.call(document) == objectClass && !({ 'toString': 0 } + ''));
216
222
  } catch (e) {
@@ -1925,16 +1931,18 @@ if (!Array.prototype.forEach) {
1925
1931
 
1926
1932
  var self = this;
1927
1933
  this._subscribe = function (observer) {
1934
+ var oldOnError = observer.onError.bind(observer);
1935
+
1928
1936
  observer.onError = function (err) {
1929
- makeStackTraceLong(self, err);
1930
- observer.onError(err);
1937
+ makeStackTraceLong(err, self);
1938
+ oldOnError(err);
1931
1939
  };
1932
1940
 
1933
- subscribe(observer);
1941
+ return subscribe(observer);
1934
1942
  };
1943
+ } else {
1944
+ this._subscribe = subscribe;
1935
1945
  }
1936
-
1937
- this._subscribe = subscribe;
1938
1946
  }
1939
1947
 
1940
1948
  observableProto = Observable.prototype;
@@ -3531,7 +3539,7 @@ if (!Array.prototype.forEach) {
3531
3539
  return source.subscribe(function (value) {
3532
3540
  var shouldRun;
3533
3541
  try {
3534
- shouldRun = predicate.call(thisArg, value, count++, parent);
3542
+ shouldRun = predicate.call(thisArg, value, count++, source);
3535
3543
  } catch (e) {
3536
3544
  observer.onError(e);
3537
3545
  return;
@@ -4445,9 +4453,9 @@ if (!Array.prototype.forEach) {
4445
4453
  }, source);
4446
4454
  };
4447
4455
 
4448
- var PausableObservable = (function (_super) {
4456
+ var PausableObservable = (function (__super__) {
4449
4457
 
4450
- inherits(PausableObservable, _super);
4458
+ inherits(PausableObservable, __super__);
4451
4459
 
4452
4460
  function subscribe(observer) {
4453
4461
  var conn = this.source.publish(),
@@ -4476,7 +4484,7 @@ if (!Array.prototype.forEach) {
4476
4484
  this.pauser = this.controller;
4477
4485
  }
4478
4486
 
4479
- _super.call(this, subscribe);
4487
+ __super__.call(this, subscribe, source);
4480
4488
  }
4481
4489
 
4482
4490
  PausableObservable.prototype.pause = function () {
@@ -4560,7 +4568,7 @@ if (!Array.prototype.forEach) {
4560
4568
  next(true, 1);
4561
4569
  })
4562
4570
  );
4563
- });
4571
+ }, source);
4564
4572
  }
4565
4573
 
4566
4574
  var PausableBufferedObservable = (function (__super__) {
@@ -4625,7 +4633,7 @@ if (!Array.prototype.forEach) {
4625
4633
  this.pauser = this.controller;
4626
4634
  }
4627
4635
 
4628
- __super__.call(this, subscribe);
4636
+ __super__.call(this, subscribe, source);
4629
4637
  }
4630
4638
 
4631
4639
  PausableBufferedObservable.prototype.pause = function () {
@@ -4653,29 +4661,16 @@ if (!Array.prototype.forEach) {
4653
4661
  return new PausableBufferedObservable(this, subject);
4654
4662
  };
4655
4663
 
4656
- /**
4657
- * Attaches a controller to the observable sequence with the ability to queue.
4658
- * @example
4659
- * var source = Rx.Observable.interval(100).controlled();
4660
- * source.request(3); // Reads 3 values
4661
- * @param {Observable} pauser The observable sequence used to pause the underlying sequence.
4662
- * @returns {Observable} The observable sequence which is paused based upon the pauser.
4663
- */
4664
- observableProto.controlled = function (enableQueue) {
4665
- if (enableQueue == null) { enableQueue = true; }
4666
- return new ControlledObservable(this, enableQueue);
4667
- };
4668
-
4669
- var ControlledObservable = (function (_super) {
4664
+ var ControlledObservable = (function (__super__) {
4670
4665
 
4671
- inherits(ControlledObservable, _super);
4666
+ inherits(ControlledObservable, __super__);
4672
4667
 
4673
4668
  function subscribe (observer) {
4674
4669
  return this.source.subscribe(observer);
4675
4670
  }
4676
4671
 
4677
4672
  function ControlledObservable (source, enableQueue) {
4678
- _super.call(this, subscribe);
4673
+ __super__.call(this, subscribe, source);
4679
4674
  this.subject = new ControlledSubject(enableQueue);
4680
4675
  this.source = source.multicast(this.subject).refCount();
4681
4676
  }
@@ -4689,132 +4684,111 @@ if (!Array.prototype.forEach) {
4689
4684
 
4690
4685
  }(Observable));
4691
4686
 
4692
- var ControlledSubject = Rx.ControlledSubject = (function (_super) {
4687
+ var ControlledSubject = (function (__super__) {
4693
4688
 
4694
- function subscribe (observer) {
4695
- return this.subject.subscribe(observer);
4696
- }
4697
-
4698
- inherits(ControlledSubject, _super);
4699
-
4700
- function ControlledSubject(enableQueue) {
4701
- if (enableQueue == null) {
4702
- enableQueue = true;
4703
- }
4689
+ function subscribe (observer) {
4690
+ return this.subject.subscribe(observer);
4691
+ }
4704
4692
 
4705
- _super.call(this, subscribe);
4706
- this.subject = new Subject();
4707
- this.enableQueue = enableQueue;
4708
- this.queue = enableQueue ? [] : null;
4709
- this.requestedCount = 0;
4710
- this.requestedDisposable = disposableEmpty;
4711
- this.error = null;
4712
- this.hasFailed = false;
4713
- this.hasCompleted = false;
4714
- this.controlledDisposable = disposableEmpty;
4715
- }
4693
+ inherits(ControlledSubject, __super__);
4716
4694
 
4717
- addProperties(ControlledSubject.prototype, Observer, {
4718
- onCompleted: function () {
4719
- checkDisposed.call(this);
4720
- this.hasCompleted = true;
4695
+ function ControlledSubject(enableQueue) {
4696
+ enableQueue == null && (enableQueue = true);
4721
4697
 
4722
- if (!this.enableQueue || this.queue.length === 0) {
4723
- this.subject.onCompleted();
4724
- }
4725
- },
4726
- onError: function (error) {
4727
- checkDisposed.call(this);
4728
- this.hasFailed = true;
4729
- this.error = error;
4698
+ __super__.call(this, subscribe);
4699
+ this.subject = new Subject();
4700
+ this.enableQueue = enableQueue;
4701
+ this.queue = enableQueue ? [] : null;
4702
+ this.requestedCount = 0;
4703
+ this.requestedDisposable = disposableEmpty;
4704
+ this.error = null;
4705
+ this.hasFailed = false;
4706
+ this.hasCompleted = false;
4707
+ this.controlledDisposable = disposableEmpty;
4708
+ }
4730
4709
 
4731
- if (!this.enableQueue || this.queue.length === 0) {
4732
- this.subject.onError(error);
4733
- }
4734
- },
4735
- onNext: function (value) {
4736
- checkDisposed.call(this);
4737
- var hasRequested = false;
4710
+ addProperties(ControlledSubject.prototype, Observer, {
4711
+ onCompleted: function () {
4712
+ this.hasCompleted = true;
4713
+ (!this.enableQueue || this.queue.length === 0) && this.subject.onCompleted();
4714
+ },
4715
+ onError: function (error) {
4716
+ this.hasFailed = true;
4717
+ this.error = error;
4718
+ (!this.enableQueue || this.queue.length === 0) && this.subject.onError(error);
4719
+ },
4720
+ onNext: function (value) {
4721
+ var hasRequested = false;
4738
4722
 
4739
- if (this.requestedCount === 0) {
4740
- if (this.enableQueue) {
4741
- this.queue.push(value);
4742
- }
4743
- } else {
4744
- if (this.requestedCount !== -1) {
4745
- if (this.requestedCount-- === 0) {
4746
- this.disposeCurrentRequest();
4747
- }
4748
- }
4749
- hasRequested = true;
4750
- }
4723
+ if (this.requestedCount === 0) {
4724
+ this.enableQueue && this.queue.push(value);
4725
+ } else {
4726
+ (this.requestedCount !== -1 && this.requestedCount-- === 0) && this.disposeCurrentRequest();
4727
+ hasRequested = true;
4728
+ }
4729
+ hasRequested && this.subject.onNext(value);
4730
+ },
4731
+ _processRequest: function (numberOfItems) {
4732
+ if (this.enableQueue) {
4733
+ while (this.queue.length >= numberOfItems && numberOfItems > 0) {
4734
+ this.subject.onNext(this.queue.shift());
4735
+ numberOfItems--;
4736
+ }
4751
4737
 
4752
- if (hasRequested) {
4753
- this.subject.onNext(value);
4754
- }
4755
- },
4756
- _processRequest: function (numberOfItems) {
4757
- if (this.enableQueue) {
4758
- //console.log('queue length', this.queue.length);
4759
-
4760
- while (this.queue.length >= numberOfItems && numberOfItems > 0) {
4761
- //console.log('number of items', numberOfItems);
4762
- this.subject.onNext(this.queue.shift());
4763
- numberOfItems--;
4764
- }
4738
+ return this.queue.length !== 0 ?
4739
+ { numberOfItems: numberOfItems, returnValue: true } :
4740
+ { numberOfItems: numberOfItems, returnValue: false };
4741
+ }
4765
4742
 
4766
- if (this.queue.length !== 0) {
4767
- return { numberOfItems: numberOfItems, returnValue: true };
4768
- } else {
4769
- return { numberOfItems: numberOfItems, returnValue: false };
4770
- }
4771
- }
4743
+ if (this.hasFailed) {
4744
+ this.subject.onError(this.error);
4745
+ this.controlledDisposable.dispose();
4746
+ this.controlledDisposable = disposableEmpty;
4747
+ } else if (this.hasCompleted) {
4748
+ this.subject.onCompleted();
4749
+ this.controlledDisposable.dispose();
4750
+ this.controlledDisposable = disposableEmpty;
4751
+ }
4772
4752
 
4773
- if (this.hasFailed) {
4774
- this.subject.onError(this.error);
4775
- this.controlledDisposable.dispose();
4776
- this.controlledDisposable = disposableEmpty;
4777
- } else if (this.hasCompleted) {
4778
- this.subject.onCompleted();
4779
- this.controlledDisposable.dispose();
4780
- this.controlledDisposable = disposableEmpty;
4781
- }
4753
+ return { numberOfItems: numberOfItems, returnValue: false };
4754
+ },
4755
+ request: function (number) {
4756
+ this.disposeCurrentRequest();
4757
+ var self = this, r = this._processRequest(number);
4758
+
4759
+ var number = r.numberOfItems;
4760
+ if (!r.returnValue) {
4761
+ this.requestedCount = number;
4762
+ this.requestedDisposable = disposableCreate(function () {
4763
+ self.requestedCount = 0;
4764
+ });
4782
4765
 
4783
- return { numberOfItems: numberOfItems, returnValue: false };
4784
- },
4785
- request: function (number) {
4786
- checkDisposed.call(this);
4787
- this.disposeCurrentRequest();
4788
- var self = this,
4789
- r = this._processRequest(number);
4790
-
4791
- number = r.numberOfItems;
4792
- if (!r.returnValue) {
4793
- this.requestedCount = number;
4794
- this.requestedDisposable = disposableCreate(function () {
4795
- self.requestedCount = 0;
4796
- });
4797
-
4798
- return this.requestedDisposable
4799
- } else {
4800
- return disposableEmpty;
4801
- }
4802
- },
4803
- disposeCurrentRequest: function () {
4804
- this.requestedDisposable.dispose();
4805
- this.requestedDisposable = disposableEmpty;
4806
- },
4766
+ return this.requestedDisposable
4767
+ } else {
4768
+ return disposableEmpty;
4769
+ }
4770
+ },
4771
+ disposeCurrentRequest: function () {
4772
+ this.requestedDisposable.dispose();
4773
+ this.requestedDisposable = disposableEmpty;
4774
+ }
4775
+ });
4807
4776
 
4808
- dispose: function () {
4809
- this.isDisposed = true;
4810
- this.error = null;
4811
- this.subject.dispose();
4812
- this.requestedDisposable.dispose();
4813
- }
4814
- });
4777
+ return ControlledSubject;
4778
+ }(Observable));
4815
4779
 
4816
- return ControlledSubject;
4817
- }(Observable));
4780
+ /**
4781
+ * Attaches a controller to the observable sequence with the ability to queue.
4782
+ * @example
4783
+ * var source = Rx.Observable.interval(100).controlled();
4784
+ * source.request(3); // Reads 3 values
4785
+ * @param {Observable} pauser The observable sequence used to pause the underlying sequence.
4786
+ * @returns {Observable} The observable sequence which is paused based upon the pauser.
4787
+ */
4788
+ observableProto.controlled = function (enableQueue) {
4789
+ if (enableQueue == null) { enableQueue = true; }
4790
+ return new ControlledObservable(this, enableQueue);
4791
+ };
4818
4792
 
4819
4793
  /**
4820
4794
  * Executes a transducer to transform the observable sequence