Comparing version 2.2.7 to 2.2.8
{ | ||
"name": "rxjs", | ||
"version": "2.2.7", | ||
"version": "2.2.8s", | ||
"main": [ | ||
@@ -5,0 +5,0 @@ "rx.js", |
module.exports = function (grunt) { | ||
var browsers = [{ | ||
browserName: 'firefox', | ||
version: '19', | ||
platform: 'XP' | ||
}, { | ||
browserName: 'chrome', | ||
platform: 'XP' | ||
}, { | ||
browserName: 'chrome', | ||
platform: 'linux' | ||
}, { | ||
browserName: 'internet explorer', | ||
platform: 'WIN8', | ||
version: '10' | ||
}, { | ||
browserName: 'internet explorer', | ||
platform: 'VISTA', | ||
version: '9' | ||
}, { | ||
browserName: 'opera', | ||
platform: 'Windows 2008', | ||
version: '12' | ||
}]; | ||
grunt.initConfig({ | ||
@@ -34,2 +58,3 @@ pkg: grunt.file.readJSON('package.json'), | ||
'src/core/disposables/disposable.js', | ||
'src/core/disposables/booleandisposable.js', | ||
'src/core/disposables/singleassignmentdisposable.js', | ||
@@ -149,2 +174,3 @@ 'src/core/disposables/serialdisposable.js', | ||
'src/core/disposables/disposable.js', | ||
'src/core/disposables/booleandisposable.js', | ||
'src/core/disposables/singleassignmentdisposable.js', | ||
@@ -268,2 +294,4 @@ 'src/core/disposables/serialdisposable.js', | ||
'src/core/disposables/booleandisposable.js', | ||
'src/core/disposables/singleassignmentdisposable.js', | ||
'src/core/disposables/serialdisposable.js', | ||
'src/core/disposables/refcountdisposable.js', | ||
@@ -273,3 +301,4 @@ | ||
'src/core/concurrency/scheduler-lite.js', | ||
'src/core/concurrency/currentthreadscheduler-lite.js', | ||
'src/core/concurrency/immediatescheduler.js', | ||
'src/core/concurrency/currentthreadscheduler.js', | ||
'src/core/concurrency/scheduleperiodicrecursive.js', | ||
@@ -409,2 +438,4 @@ 'src/core/concurrency/timeoutscheduler.js', | ||
'src/core/disposables/booleandisposable.js', | ||
'src/core/disposables/singleassignmentdisposable.js', | ||
'src/core/disposables/serialdisposable.js', | ||
'src/core/disposables/refcountdisposable.js', | ||
@@ -414,3 +445,4 @@ | ||
'src/core/concurrency/scheduler-lite.js', | ||
'src/core/concurrency/currentthreadscheduler-lite.js', | ||
'src/core/concurrency/immediatescheduler.js', | ||
'src/core/concurrency/currentthreadscheduler.js', | ||
'src/core/concurrency/scheduleperiodicrecursive.js', | ||
@@ -832,4 +864,26 @@ 'src/core/concurrency/timeoutscheduler.js', | ||
'saucelabs-qunit': { | ||
options: { | ||
all: { | ||
options: { | ||
urls: [ | ||
'http://127.0.0.1:9999/tests/rx.aggregates.html', | ||
'http://127.0.0.1:9999/tests/rx.async.html', | ||
'http://127.0.0.1:9999/tests/rx.async.compat.html', | ||
'http://127.0.0.1:9999/tests/rx.binding.html', | ||
'http://127.0.0.1:9999/tests/rx.coincidence.html', | ||
'http://127.0.0.1:9999/tests/rx.experimental.html', | ||
'http://127.0.0.1:9999/tests/rx.experimental.html', | ||
'http://127.0.0.1:9999/tests/rx.html', | ||
'http://127.0.0.1:9999/tests/rx.modern.html', | ||
'http://127.0.0.1:9999/tests/rx.lite.html', | ||
'http://127.0.0.1:9999/tests/rx.lite.compat.html', | ||
'http://127.0.0.1:9999/tests/rx.joinpatterns.html', | ||
'http://127.0.0.1:9999/tests/rx.time.html', | ||
'http://127.0.0.1:9999/tests/rx.virtualtime.html', | ||
], | ||
tunnelTimeout: 5, | ||
build: process.env.TRAVIS_JOB_ID, | ||
concurrency: 3, | ||
browsers: browsers, | ||
testname: "qunit tests" | ||
} | ||
} | ||
@@ -836,0 +890,0 @@ } |
@@ -5,3 +5,3 @@ { | ||
"description": "Library for composing asynchronous and event-based operations in JavaScript", | ||
"version": "2.2.7", | ||
"version": "2.2.8", | ||
"homepage": "https://github.com/Reactive-Extensions/RxJS", | ||
@@ -8,0 +8,0 @@ "author": { |
@@ -16,3 +16,3 @@ [![Build Status](https://travis-ci.org/Reactive-Extensions/RxJS.png)](https://travis-ci.org/Reactive-Extensions/RxJS) | ||
The Reactive Extensions for JavaScript (RxJS) is a set of libraries for composing asynchronous and event-based programs using observable sequences and fluent query operators modeled after Language Integrated Queries ([LINQ](http://en.wikipedia.org/wiki/LINQ)). Using RxJS, developers represent asynchronous data streams with Observables, query asynchronous data streams using our many operators, and parameterize the concurrency in the asynchronous data streams using Schedulers. Simply put, RxJS = Observables + Operators + Schedulers. | ||
The Reactive Extensions for JavaScript (RxJS) is a set of libraries for composing asynchronous and event-based programs using observable sequences and fluent query operators that many of you already know by Array#extras in JavaScript. Using RxJS, developers represent asynchronous data streams with Observables, query asynchronous data streams using our many operators, and parameterize the concurrency in the asynchronous data streams using Schedulers. Simply put, RxJS = Observables + Operators + Schedulers. | ||
@@ -33,3 +33,3 @@ Whether you are authoring a web-based application in JavaScript or a server-side application in Node.js, you have to deal with asynchronous and event-based programming as a matter of course. Although some patterns are emerging such as the Promise pattern, handling exceptions, cancellation, and synchronization is difficult and error-prone. | ||
.filter(function (quote) { | ||
return quote.symbol === 'MSFT'; | ||
return quote.price > 30; | ||
}) | ||
@@ -40,3 +40,3 @@ .map(function (quote) { | ||
.forEach(function (price) { | ||
console.log('MSFT Stock Prices: $' + price); | ||
console.log('Prices higher than $30: $' + price); | ||
}); | ||
@@ -53,3 +53,3 @@ ``` | ||
.filter(function (quote) { | ||
return quote.symbol === 'MSFT'; | ||
return quote.price > 30; | ||
}) | ||
@@ -61,3 +61,3 @@ .map(function (quote) { | ||
function (price) { | ||
console.log('MSFT Stock Prices: $' + price); | ||
console.log('Prices higher than $30: $' + price); | ||
}, | ||
@@ -78,16 +78,13 @@ function (err) { | ||
- **rx.js** - core library for ES5 compliant browsers and runtimes | ||
- **rx.compat.js** - core library for older non-ES5 compliant browsers. | ||
- **rx.aggregates.js** - aggregation event processing query operations | ||
- **rx.async.js** - async operationrs such as events, callbacks and promises | ||
- **rx.async.compat.js** - async operationrs such as events, callbacks and promises with support back to IE6 | ||
- **rx.binding.js** - binding operators including multicast, publish, publishLast, publishValue, and replay | ||
- **rx.coincidence.js** - reactive coincidence join event processing query operations | ||
- **rx.experimental.js** - experimental operators including imperative operators and forkJoin | ||
- **rx.joinpatterns.js** - join patterns event processing query operations | ||
- **rx.lite.js** - lite version with event bindings, creation, time and standard query operators | ||
- **rx.lite.compat.js** - lite version with event bindings, creation, time and standard query operators with compatibility back to IE6 | ||
- **rx.testing.js** - used to write unit tests for complex event processing queries | ||
- **rx.time.js** - time-based event processing query operations | ||
- **rx.virtualtime.js** - virtual-time-based schedulers | ||
- [rx.lite.js](doc/libraries/rx.lite.md) - lite version with event bindings, creation, time and standard query operators with a compat file for older browsers. | ||
- [rx.js](doc/libraries/rx.md) - core library for ES5 compliant browsers and runtimes plus compatibility for older browsers. | ||
- [rx.aggregates.js](doc/libraries/rx.aggregates.md) - aggregation event processing query operations | ||
- [rx.async.js](doc/libraries/rx.async.md) - async operationrs such as events, callbacks and promises plus a compat file for older browsers. | ||
- [rx.binding.js](doc/libraries/rx.binding.md) - binding operators including multicast, publish, publishLast, publishValue, and replay | ||
- [rx.coincidence.js](doc/libraries/rx.coincidence.md) - reactive coincidence join event processing query operations | ||
- [rx.experimental.js](doc/libraries/rx.experimental.md) - experimental operators including imperative operators and forkJoin | ||
- [rx.joinpatterns.js](doc/libraries/rx.joinpatterns.md) - join patterns event processing query operations | ||
- [rx.testing.js](doc/libraries/rx.testing.md) - used to write unit tests for complex event processing queries | ||
- [rx.time.js](doc/libraries/rx.time.md) - time-based event processing query operations | ||
- [rx.virtualtime.js](doc/libraries/rx.virtualtime.md) - virtual-time-based schedulers | ||
@@ -94,0 +91,0 @@ ## Why RxJS? ## |
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. | ||
(function (root, factory) { | ||
var freeExports = typeof exports == 'object' && exports, | ||
freeModule = typeof module == 'object' && module && module.exports == freeExports && module, | ||
freeGlobal = typeof global == 'object' && global; | ||
if (freeGlobal.global === freeGlobal) { | ||
window = freeGlobal; | ||
(function (factory) { | ||
var objectTypes = { | ||
'boolean': false, | ||
'function': true, | ||
'object': true, | ||
'number': false, | ||
'string': false, | ||
'undefined': false | ||
}; | ||
var root = (objectTypes[typeof window] && window) || this, | ||
freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports, | ||
freeModule = objectTypes[typeof module] && module && !module.nodeType && module, | ||
moduleExports = freeModule && freeModule.exports === freeExports && freeExports, | ||
freeGlobal = objectTypes[typeof global] && global; | ||
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) { | ||
root = freeGlobal; | ||
} | ||
@@ -22,3 +34,3 @@ | ||
} | ||
}(this, function (global, exp, Rx, undefined) { | ||
}.call(this, function (root, exp, Rx, undefined) { | ||
@@ -25,0 +37,0 @@ // References |
@@ -1,1 +0,1 @@ | ||
(function(t,e){var n="object"==typeof exports&&exports,r=("object"==typeof module&&module&&module.exports==n&&module,"object"==typeof global&&global);r.global===r&&(window=r),"function"==typeof define&&define.amd?define(["rx","exports"],function(n,r){return t.Rx=e(t,r,n),t.Rx}):"object"==typeof module&&module&&module.exports===n?module.exports=e(t,module.exports,require("./rx")):t.Rx=e(t,{},t.Rx)})(this,function(t,e,n,r){function i(t,e){return w(t,e)}function o(t){return t}function s(t,e){return t>e?1:e>t?-1:0}function u(t,e,n){return new y(function(i){var o=!1,s=null,u=[];return t.subscribe(function(t){var c,a;try{a=e(t)}catch(h){return i.onError(h),r}if(c=0,o)try{c=n(a,s)}catch(f){return i.onError(f),r}else o=!0,s=a;c>0&&(s=a,u=[]),c>=0&&u.push(t)},i.onError.bind(i),function(){i.onNext(u),i.onCompleted()})})}function c(t){if(0===t.length)throw Error(E);return t[0]}function a(t,e,n){return new y(function(i){var o=0,s=e.length;return t.subscribe(function(t){var u=!1;try{s>o&&(u=n(t,e[o++]))}catch(c){return i.onError(c),r}u||(i.onNext(!1),i.onCompleted())},i.onError.bind(i),function(){i.onNext(o===s),i.onCompleted()})})}function h(t,e,n,r){if(0>e)throw Error(g);return new y(function(i){var o=e;return t.subscribe(function(t){0===o&&(i.onNext(t),i.onCompleted()),o--},i.onError.bind(i),function(){n?(i.onNext(r),i.onCompleted()):i.onError(Error(g))})})}function f(t,e,n){return new y(function(r){var i=n,o=!1;return t.subscribe(function(t){o?r.onError(Error("Sequence contains more than one element")):(i=t,o=!0)},r.onError.bind(r),function(){o||e?(r.onNext(i),r.onCompleted()):r.onError(Error(E))})})}function l(t,e,n){return new y(function(r){return t.subscribe(function(t){r.onNext(t),r.onCompleted()},r.onError.bind(r),function(){e?(r.onNext(n),r.onCompleted()):r.onError(Error(E))})})}function p(t,e,n){return new y(function(r){var i=n,o=!1;return t.subscribe(function(t){i=t,o=!0},r.onError.bind(r),function(){o||e?(r.onNext(i),r.onCompleted()):r.onError(Error(E))})})}function d(t,e,n,i){return new y(function(o){var s=0;return t.subscribe(function(u){var c;try{c=e.call(n,u,s,t)}catch(a){return o.onError(a),r}c?(o.onNext(i?s:u),o.onCompleted()):s++},o.onError.bind(o),function(){o.onNext(i?-1:r),o.onCompleted()})})}var b=n.Observable,v=b.prototype,m=n.CompositeDisposable,y=n.Internals.AnonymousObservable,w=n.Internals.isEqual,g="Argument out of range",E="Sequence contains no elements.";return v.aggregate=function(){var t,e,n;return 2===arguments.length?(t=arguments[0],e=!0,n=arguments[1]):n=arguments[0],e?this.scan(t,n).startWith(t).finalValue():this.scan(n).finalValue()},v.reduce=function(t){var e,n;return 2===arguments.length&&(n=!0,e=arguments[1]),n?this.scan(e,t).startWith(e).finalValue():this.scan(t).finalValue()},v.some=v.any=function(t,e){var n=this;return t?n.where(t,e).any():new y(function(t){return n.subscribe(function(){t.onNext(!0),t.onCompleted()},t.onError.bind(t),function(){t.onNext(!1),t.onCompleted()})})},v.isEmpty=function(){return this.any().select(function(t){return!t})},v.every=v.all=function(t,e){return this.where(function(e){return!t(e)},e).any().select(function(t){return!t})},v.contains=function(t,e){return e||(e=i),this.where(function(n){return e(n,t)}).any()},v.count=function(t,e){return t?this.where(t,e).count():this.aggregate(0,function(t){return t+1})},v.sum=function(t,e){return t?this.select(t,e).sum():this.aggregate(0,function(t,e){return t+e})},v.minBy=function(t,e){return e||(e=s),u(this,t,function(t,n){return-1*e(t,n)})},v.min=function(t){return this.minBy(o,t).select(function(t){return c(t)})},v.maxBy=function(t,e){return e||(e=s),u(this,t,e)},v.max=function(t){return this.maxBy(o,t).select(function(t){return c(t)})},v.average=function(t,e){return t?this.select(t,e).average():this.scan({sum:0,count:0},function(t,e){return{sum:t.sum+e,count:t.count+1}}).finalValue().select(function(t){if(0===t.count)throw Error("The input sequence was empty");return t.sum/t.count})},v.sequenceEqual=function(t,e){var n=this;return e||(e=i),Array.isArray(t)?a(n,t,e):new y(function(i){var o=!1,s=!1,u=[],c=[],a=n.subscribe(function(t){var n,o;if(c.length>0){o=c.shift();try{n=e(o,t)}catch(a){return i.onError(a),r}n||(i.onNext(!1),i.onCompleted())}else s?(i.onNext(!1),i.onCompleted()):u.push(t)},i.onError.bind(i),function(){o=!0,0===u.length&&(c.length>0?(i.onNext(!1),i.onCompleted()):s&&(i.onNext(!0),i.onCompleted()))}),h=t.subscribe(function(t){var n,s;if(u.length>0){s=u.shift();try{n=e(s,t)}catch(a){return i.onError(a),r}n||(i.onNext(!1),i.onCompleted())}else o?(i.onNext(!1),i.onCompleted()):c.push(t)},i.onError.bind(i),function(){s=!0,0===c.length&&(u.length>0?(i.onNext(!1),i.onCompleted()):o&&(i.onNext(!0),i.onCompleted()))});return new m(a,h)})},v.elementAt=function(t){return h(this,t,!1)},v.elementAtOrDefault=function(t,e){return h(this,t,!0,e)},v.single=function(t,e){return t?this.where(t,e).single():f(this,!1)},v.singleOrDefault=function(t,e,n){return t?this.where(t,n).singleOrDefault(null,e):f(this,!0,e)},v.first=function(t,e){return t?this.where(t,e).first():l(this,!1)},v.firstOrDefault=function(t,e){return t?this.where(t).firstOrDefault(null,e):l(this,!0,e)},v.last=function(t,e){return t?this.where(t,e).last():p(this,!1)},v.lastOrDefault=function(t,e,n){return t?this.where(t,n).lastOrDefault(null,e):p(this,!0,e)},v.find=function(t,e){return d(this,t,e,!1)},v.findIndex=function(t,e){return d(this,t,e,!0)},n}); | ||
(function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx","exports"],function(b,d){return c.Rx=a(c,d,b),c.Rx}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c,d){function e(a,b){return t(a,b)}function f(a){return a}function g(a,b){return a>b?1:b>a?-1:0}function h(a,b,c){return new s(function(d){var e=!1,f=null,g=[];return a.subscribe(function(a){var h,i;try{i=b(a)}catch(j){return d.onError(j),void 0}if(h=0,e)try{h=c(i,f)}catch(k){return d.onError(k),void 0}else e=!0,f=i;h>0&&(f=i,g=[]),h>=0&&g.push(a)},d.onError.bind(d),function(){d.onNext(g),d.onCompleted()})})}function i(a){if(0===a.length)throw new Error(v);return a[0]}function j(a,b,c){return new s(function(d){var e=0,f=b.length;return a.subscribe(function(a){var g=!1;try{f>e&&(g=c(a,b[e++]))}catch(h){return d.onError(h),void 0}g||(d.onNext(!1),d.onCompleted())},d.onError.bind(d),function(){d.onNext(e===f),d.onCompleted()})})}function k(a,b,c,d){if(0>b)throw new Error(u);return new s(function(e){var f=b;return a.subscribe(function(a){0===f&&(e.onNext(a),e.onCompleted()),f--},e.onError.bind(e),function(){c?(e.onNext(d),e.onCompleted()):e.onError(new Error(u))})})}function l(a,b,c){return new s(function(d){var e=c,f=!1;return a.subscribe(function(a){f?d.onError(new Error("Sequence contains more than one element")):(e=a,f=!0)},d.onError.bind(d),function(){f||b?(d.onNext(e),d.onCompleted()):d.onError(new Error(v))})})}function m(a,b,c){return new s(function(d){return a.subscribe(function(a){d.onNext(a),d.onCompleted()},d.onError.bind(d),function(){b?(d.onNext(c),d.onCompleted()):d.onError(new Error(v))})})}function n(a,b,c){return new s(function(d){var e=c,f=!1;return a.subscribe(function(a){e=a,f=!0},d.onError.bind(d),function(){f||b?(d.onNext(e),d.onCompleted()):d.onError(new Error(v))})})}function o(a,b,c,e){return new s(function(f){var g=0;return a.subscribe(function(d){var h;try{h=b.call(c,d,g,a)}catch(i){return f.onError(i),void 0}h?(f.onNext(e?g:d),f.onCompleted()):g++},f.onError.bind(f),function(){f.onNext(e?-1:d),f.onCompleted()})})}var p=c.Observable,q=p.prototype,r=c.CompositeDisposable,s=c.Internals.AnonymousObservable,t=c.Internals.isEqual,u="Argument out of range",v="Sequence contains no elements.";return q.aggregate=function(){var a,b,c;return 2===arguments.length?(a=arguments[0],b=!0,c=arguments[1]):c=arguments[0],b?this.scan(a,c).startWith(a).finalValue():this.scan(c).finalValue()},q.reduce=function(a){var b,c;return 2===arguments.length&&(c=!0,b=arguments[1]),c?this.scan(b,a).startWith(b).finalValue():this.scan(a).finalValue()},q.some=q.any=function(a,b){var c=this;return a?c.where(a,b).any():new s(function(a){return c.subscribe(function(){a.onNext(!0),a.onCompleted()},a.onError.bind(a),function(){a.onNext(!1),a.onCompleted()})})},q.isEmpty=function(){return this.any().select(function(a){return!a})},q.every=q.all=function(a,b){return this.where(function(b){return!a(b)},b).any().select(function(a){return!a})},q.contains=function(a,b){return b||(b=e),this.where(function(c){return b(c,a)}).any()},q.count=function(a,b){return a?this.where(a,b).count():this.aggregate(0,function(a){return a+1})},q.sum=function(a,b){return a?this.select(a,b).sum():this.aggregate(0,function(a,b){return a+b})},q.minBy=function(a,b){return b||(b=g),h(this,a,function(a,c){return-1*b(a,c)})},q.min=function(a){return this.minBy(f,a).select(function(a){return i(a)})},q.maxBy=function(a,b){return b||(b=g),h(this,a,b)},q.max=function(a){return this.maxBy(f,a).select(function(a){return i(a)})},q.average=function(a,b){return a?this.select(a,b).average():this.scan({sum:0,count:0},function(a,b){return{sum:a.sum+b,count:a.count+1}}).finalValue().select(function(a){if(0===a.count)throw new Error("The input sequence was empty");return a.sum/a.count})},q.sequenceEqual=function(a,b){var c=this;return b||(b=e),Array.isArray(a)?j(c,a,b):new s(function(d){var e=!1,f=!1,g=[],h=[],i=c.subscribe(function(a){var c,e;if(h.length>0){e=h.shift();try{c=b(e,a)}catch(i){return d.onError(i),void 0}c||(d.onNext(!1),d.onCompleted())}else f?(d.onNext(!1),d.onCompleted()):g.push(a)},d.onError.bind(d),function(){e=!0,0===g.length&&(h.length>0?(d.onNext(!1),d.onCompleted()):f&&(d.onNext(!0),d.onCompleted()))}),j=a.subscribe(function(a){var c,f;if(g.length>0){f=g.shift();try{c=b(f,a)}catch(i){return d.onError(i),void 0}c||(d.onNext(!1),d.onCompleted())}else e?(d.onNext(!1),d.onCompleted()):h.push(a)},d.onError.bind(d),function(){f=!0,0===h.length&&(g.length>0?(d.onNext(!1),d.onCompleted()):e&&(d.onNext(!0),d.onCompleted()))});return new r(i,j)})},q.elementAt=function(a){return k(this,a,!1)},q.elementAtOrDefault=function(a,b){return k(this,a,!0,b)},q.single=function(a,b){return a?this.where(a,b).single():l(this,!1)},q.singleOrDefault=function(a,b,c){return a?this.where(a,c).singleOrDefault(null,b):l(this,!0,b)},q.first=function(a,b){return a?this.where(a,b).first():m(this,!1)},q.firstOrDefault=function(a,b){return a?this.where(a).firstOrDefault(null,b):m(this,!0,b)},q.last=function(a,b){return a?this.where(a,b).last():n(this,!1)},q.lastOrDefault=function(a,b,c){return a?this.where(a,c).lastOrDefault(null,b):n(this,!0,b)},q.find=function(a,b){return o(this,a,b,!1)},q.findIndex=function(a,b){return o(this,a,b,!0)},c}); |
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. | ||
(function (root, factory) { | ||
var freeExports = typeof exports == 'object' && exports, | ||
freeModule = typeof module == 'object' && module && module.exports == freeExports && module, | ||
freeGlobal = typeof global == 'object' && global; | ||
if (freeGlobal.global === freeGlobal) { | ||
window = freeGlobal; | ||
(function (factory) { | ||
var objectTypes = { | ||
'boolean': false, | ||
'function': true, | ||
'object': true, | ||
'number': false, | ||
'string': false, | ||
'undefined': false | ||
}; | ||
var root = (objectTypes[typeof window] && window) || this, | ||
freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports, | ||
freeModule = objectTypes[typeof module] && module && !module.nodeType && module, | ||
moduleExports = freeModule && freeModule.exports === freeExports && freeExports, | ||
freeGlobal = objectTypes[typeof global] && global; | ||
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) { | ||
root = freeGlobal; | ||
} | ||
@@ -22,3 +34,3 @@ | ||
} | ||
}(this, function (global, exp, Rx, undefined) { | ||
}.call(this, function (root, exp, Rx, undefined) { | ||
@@ -25,0 +37,0 @@ // Aliases |
@@ -1,1 +0,1 @@ | ||
(function(t,e){var n="object"==typeof exports&&exports,r=("object"==typeof module&&module&&module.exports==n&&module,"object"==typeof global&&global);r.global===r&&(window=r),"function"==typeof define&&define.amd?define(["rx","exports"],function(n,r){return t.Rx=e(t,r,n),t.Rx}):"object"==typeof module&&module&&module.exports===n?module.exports=e(t,module.exports,require("./rx")):t.Rx=e(t,{},t.Rx)})(this,function(t,e,n){function r(t){var e=function(){this.cancelBubble=!0},n=function(){if(this.bubbledKeyCode=this.keyCode,this.ctrlKey)try{this.keyCode=0}catch(t){}this.defaultPrevented=!0,this.returnValue=!1,this.modified=!0};if(t||(t=window.event),!t.target)switch(t.target=t.target||t.srcElement,"mouseover"==t.type&&(t.relatedTarget=t.fromElement),"mouseout"==t.type&&(t.relatedTarget=t.toElement),t.stopPropagation||(t.stopPropagation=e,t.preventDefault=n),t.type){case"keypress":var r="charCode"in t?t.charCode:t.keyCode;10==r?(r=0,t.keyCode=13):13==r||27==r?r=0:3==r&&(r=99),t.charCode=r,t.keyChar=t.charCode?String.fromCharCode(t.charCode):""}return t}function i(t,e,n){if(t.addListener)return t.addListener(e,n),a(function(){t.removeListener(e,n)});if(t.addEventListener)return t.addEventListener(e,n,!1),a(function(){t.removeEventListener(e,n,!1)});if(t.attachEvent){var i=function(t){n(r(t))};return t.attachEvent("on"+e,i),a(function(){t.detachEvent("on"+e,i)})}return t["on"+e]=n,a(function(){t["on"+e]=null})}function o(t,e,n){var r=new h;if(t&&t.length)for(var s=0,u=t.length;u>s;s++)r.add(o(t[s],e,n));else t&&r.add(i(t,e,n));return r}var s=n.Observable,u=n.Internals.AnonymousObservable,c=n.AsyncSubject,a=n.Disposable.create,h=n.CompositeDisposable,c=n.AsyncSubject;timeoutScheduler=n.Scheduler.timeout,slice=Array.prototype.slice,s.start=function(t,e,n){return f(t,e,n)()};var f=s.toAsync=function(t,e,n){return e||(e=timeoutScheduler),function(){var r=arguments,i=new c;return e.schedule(function(){var e;try{e=t.apply(n,r)}catch(o){return i.onError(o),undefined}i.onNext(e),i.onCompleted()}),i.asObservable()}};return s.fromCallback=function(t,e,n,r){return e||(e=timeoutScheduler),function(){var i=slice.call(arguments,0),o=new c;return e.schedule(function(){function e(t){var e=t;if(r)try{e=r(arguments)}catch(n){return o.onError(n),undefined}else 1===e.length&&(e=e[0]);o.onNext(e),o.onCompleted()}i.push(e),t.apply(n,i)}),o.asObservable()}},s.fromNodeCallback=function(t,e,n,r){return e||(e=timeoutScheduler),function(){var i=slice.call(arguments,0),o=new c;return e.schedule(function(){function e(t){if(t)return o.onError(t),undefined;var e=slice.call(arguments,1);if(r)try{e=r(e)}catch(n){return o.onError(n),undefined}else 1===e.length&&(e=e[0]);o.onNext(e),o.onCompleted()}i.push(e),t.apply(n,i)}),o.asObservable()}},s.fromEvent=function(t,e,n){return new u(function(r){return o(t,e,function(t){var e=t;if(n)try{e=n(arguments)}catch(i){return r.onError(i),undefined}r.onNext(e)})}).publish().refCount()},s.fromEventPattern=function(t,e,n){return new u(function(r){function i(t){var e=t;if(n)try{e=n(arguments)}catch(i){return r.onError(i),undefined}r.onNext(e)}var o=t(i);return a(function(){e&&e(i,o)})}).publish().refCount()},s.fromPromise=function(t){var e=new c;return t.then(function(t){e.onNext(t),e.onCompleted()},function(t){e.onError(t)}),e.asObservable()},n}); | ||
(function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx","exports"],function(b,d){return c.Rx=a(c,d,b),c.Rx}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c){function d(a){var b=function(){this.cancelBubble=!0},c=function(){if(this.bubbledKeyCode=this.keyCode,this.ctrlKey)try{this.keyCode=0}catch(a){}this.defaultPrevented=!0,this.returnValue=!1,this.modified=!0};if(a||(a=window.event),!a.target)switch(a.target=a.target||a.srcElement,"mouseover"==a.type&&(a.relatedTarget=a.fromElement),"mouseout"==a.type&&(a.relatedTarget=a.toElement),a.stopPropagation||(a.stopPropagation=b,a.preventDefault=c),a.type){case"keypress":var d="charCode"in a?a.charCode:a.keyCode;10==d?(d=0,a.keyCode=13):13==d||27==d?d=0:3==d&&(d=99),a.charCode=d,a.keyChar=a.charCode?String.fromCharCode(a.charCode):""}return a}function e(a,b,c){if(a.addListener)return a.addListener(b,c),j(function(){a.removeListener(b,c)});if(a.addEventListener)return a.addEventListener(b,c,!1),j(function(){a.removeEventListener(b,c,!1)});if(a.attachEvent){var e=function(a){c(d(a))};return a.attachEvent("on"+b,e),j(function(){a.detachEvent("on"+b,e)})}return a["on"+b]=c,j(function(){a["on"+b]=null})}function f(a,b,c){var d=new k;if(a&&a.length)for(var g=0,h=a.length;h>g;g++)d.add(f(a[g],b,c));else a&&d.add(e(a,b,c));return d}var g=c.Observable,h=c.Internals.AnonymousObservable,i=c.AsyncSubject,j=c.Disposable.create,k=c.CompositeDisposable,i=c.AsyncSubject;timeoutScheduler=c.Scheduler.timeout,slice=Array.prototype.slice,g.start=function(a,b,c){return l(a,b,c)()};var l=g.toAsync=function(a,b,c){return b||(b=timeoutScheduler),function(){var d=arguments,e=new i;return b.schedule(function(){var b;try{b=a.apply(c,d)}catch(f){return e.onError(f),void 0}e.onNext(b),e.onCompleted()}),e.asObservable()}};return g.fromCallback=function(a,b,c,d){return b||(b=timeoutScheduler),function(){var e=slice.call(arguments,0),f=new i;return b.schedule(function(){function b(a){var b=a;if(d)try{b=d(arguments)}catch(c){return f.onError(c),void 0}else 1===b.length&&(b=b[0]);f.onNext(b),f.onCompleted()}e.push(b),a.apply(c,e)}),f.asObservable()}},g.fromNodeCallback=function(a,b,c,d){return b||(b=timeoutScheduler),function(){var e=slice.call(arguments,0),f=new i;return b.schedule(function(){function b(a){if(a)return f.onError(a),void 0;var b=slice.call(arguments,1);if(d)try{b=d(b)}catch(c){return f.onError(c),void 0}else 1===b.length&&(b=b[0]);f.onNext(b),f.onCompleted()}e.push(b),a.apply(c,e)}),f.asObservable()}},g.fromEvent=function(a,b,c){return new h(function(d){return f(a,b,function(a){var b=a;if(c)try{b=c(arguments)}catch(e){return d.onError(e),void 0}d.onNext(b)})}).publish().refCount()},g.fromEventPattern=function(a,b,c){return new h(function(d){function e(a){var b=a;if(c)try{b=c(arguments)}catch(e){return d.onError(e),void 0}d.onNext(b)}var f=a(e);return j(function(){b&&b(e,f)})}).publish().refCount()},g.fromPromise=function(a){var b=new i;return a.then(function(a){b.onNext(a),b.onCompleted()},function(a){b.onError(a)}),b.asObservable()},c}); |
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. | ||
(function (root, factory) { | ||
var freeExports = typeof exports == 'object' && exports, | ||
freeModule = typeof module == 'object' && module && module.exports == freeExports && module, | ||
freeGlobal = typeof global == 'object' && global; | ||
if (freeGlobal.global === freeGlobal) { | ||
window = freeGlobal; | ||
(function (factory) { | ||
var objectTypes = { | ||
'boolean': false, | ||
'function': true, | ||
'object': true, | ||
'number': false, | ||
'string': false, | ||
'undefined': false | ||
}; | ||
var root = (objectTypes[typeof window] && window) || this, | ||
freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports, | ||
freeModule = objectTypes[typeof module] && module && !module.nodeType && module, | ||
moduleExports = freeModule && freeModule.exports === freeExports && freeExports, | ||
freeGlobal = objectTypes[typeof global] && global; | ||
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) { | ||
root = freeGlobal; | ||
} | ||
@@ -22,3 +34,3 @@ | ||
} | ||
}(this, function (global, exp, Rx, undefined) { | ||
}.call(this, function (root, exp, Rx, undefined) { | ||
@@ -25,0 +37,0 @@ // Aliases |
@@ -1,1 +0,1 @@ | ||
(function(t,e){var n="object"==typeof exports&&exports,r=("object"==typeof module&&module&&module.exports==n&&module,"object"==typeof global&&global);r.global===r&&(window=r),"function"==typeof define&&define.amd?define(["rx","exports"],function(n,r){return t.Rx=e(t,r,n),t.Rx}):"object"==typeof module&&module&&module.exports===n?module.exports=e(t,module.exports,require("./rx")):t.Rx=e(t,{},t.Rx)})(this,function(t,e,n){function r(t,e,n){return t.addListener?(t.addListener(e,n),c(function(){t.removeListener(e,n)})):t.addEventListener?(t.addEventListener(e,n,!1),c(function(){t.removeEventListener(e,n,!1)})):undefined}function i(t,e,n){var o=new a;if(t&&t.length)for(var s=0,u=t.length;u>s;s++)o.add(i(t[s],e,n));else t&&o.add(r(t,e,n));return o}var o=n.Observable,s=n.Internals.AnonymousObservable,u=n.AsyncSubject,c=n.Disposable.create,a=n.CompositeDisposable,u=n.AsyncSubject;timeoutScheduler=n.Scheduler.timeout,slice=Array.prototype.slice,o.start=function(t,e,n){return l(t,e,n)()};var l=o.toAsync=function(t,e,n){return e||(e=timeoutScheduler),function(){var r=arguments,i=new u;return e.schedule(function(){var e;try{e=t.apply(n,r)}catch(o){return i.onError(o),undefined}i.onNext(e),i.onCompleted()}),i.asObservable()}};return o.fromCallback=function(t,e,n,r){return e||(e=timeoutScheduler),function(){var i=slice.call(arguments,0),o=new u;return e.schedule(function(){function e(t){var e=t;if(r)try{e=r(arguments)}catch(n){return o.onError(n),undefined}else 1===e.length&&(e=e[0]);o.onNext(e),o.onCompleted()}i.push(e),t.apply(n,i)}),o.asObservable()}},o.fromNodeCallback=function(t,e,n,r){return e||(e=timeoutScheduler),function(){var i=slice.call(arguments,0),o=new u;return e.schedule(function(){function e(t){if(t)return o.onError(t),undefined;var e=slice.call(arguments,1);if(r)try{e=r(e)}catch(n){return o.onError(n),undefined}else 1===e.length&&(e=e[0]);o.onNext(e),o.onCompleted()}i.push(e),t.apply(n,i)}),o.asObservable()}},o.fromEvent=function(t,e,n){return new s(function(r){return i(t,e,function(t){var e=t;if(n)try{e=n(arguments)}catch(i){return r.onError(i),undefined}r.onNext(e)})}).publish().refCount()},o.fromEventPattern=function(t,e,n){return new s(function(r){function i(t){var e=t;if(n)try{e=n(arguments)}catch(i){return r.onError(i),undefined}r.onNext(e)}var o=t(i);return c(function(){e&&e(i,o)})}).publish().refCount()},o.fromPromise=function(t){var e=new u;return t.then(function(t){e.onNext(t),e.onCompleted()},function(t){e.onError(t)}),e.asObservable()},n}); | ||
(function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx","exports"],function(b,d){return c.Rx=a(c,d,b),c.Rx}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c){function d(a,b,c){return a.addListener?(a.addListener(b,c),i(function(){a.removeListener(b,c)})):a.addEventListener?(a.addEventListener(b,c,!1),i(function(){a.removeEventListener(b,c,!1)})):void 0}function e(a,b,c){var f=new j;if(a&&a.length)for(var g=0,h=a.length;h>g;g++)f.add(e(a[g],b,c));else a&&f.add(d(a,b,c));return f}var f=c.Observable,g=c.Internals.AnonymousObservable,h=c.AsyncSubject,i=c.Disposable.create,j=c.CompositeDisposable,h=c.AsyncSubject;timeoutScheduler=c.Scheduler.timeout,slice=Array.prototype.slice,f.start=function(a,b,c){return k(a,b,c)()};var k=f.toAsync=function(a,b,c){return b||(b=timeoutScheduler),function(){var d=arguments,e=new h;return b.schedule(function(){var b;try{b=a.apply(c,d)}catch(f){return e.onError(f),void 0}e.onNext(b),e.onCompleted()}),e.asObservable()}};return f.fromCallback=function(a,b,c,d){return b||(b=timeoutScheduler),function(){var e=slice.call(arguments,0),f=new h;return b.schedule(function(){function b(a){var b=a;if(d)try{b=d(arguments)}catch(c){return f.onError(c),void 0}else 1===b.length&&(b=b[0]);f.onNext(b),f.onCompleted()}e.push(b),a.apply(c,e)}),f.asObservable()}},f.fromNodeCallback=function(a,b,c,d){return b||(b=timeoutScheduler),function(){var e=slice.call(arguments,0),f=new h;return b.schedule(function(){function b(a){if(a)return f.onError(a),void 0;var b=slice.call(arguments,1);if(d)try{b=d(b)}catch(c){return f.onError(c),void 0}else 1===b.length&&(b=b[0]);f.onNext(b),f.onCompleted()}e.push(b),a.apply(c,e)}),f.asObservable()}},f.fromEvent=function(a,b,c){return new g(function(d){return e(a,b,function(a){var b=a;if(c)try{b=c(arguments)}catch(e){return d.onError(e),void 0}d.onNext(b)})}).publish().refCount()},f.fromEventPattern=function(a,b,c){return new g(function(d){function e(a){var b=a;if(c)try{b=c(arguments)}catch(e){return d.onError(e),void 0}d.onNext(b)}var f=a(e);return i(function(){b&&b(e,f)})}).publish().refCount()},f.fromPromise=function(a){var b=new h;return a.then(function(a){b.onNext(a),b.onCompleted()},function(a){b.onError(a)}),b.asObservable()},c}); |
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. | ||
(function (root, factory) { | ||
var freeExports = typeof exports == 'object' && exports, | ||
freeModule = typeof module == 'object' && module && module.exports == freeExports && module, | ||
freeGlobal = typeof global == 'object' && global; | ||
if (freeGlobal.global === freeGlobal) { | ||
window = freeGlobal; | ||
(function (factory) { | ||
var objectTypes = { | ||
'boolean': false, | ||
'function': true, | ||
'object': true, | ||
'number': false, | ||
'string': false, | ||
'undefined': false | ||
}; | ||
var root = (objectTypes[typeof window] && window) || this, | ||
freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports, | ||
freeModule = objectTypes[typeof module] && module && !module.nodeType && module, | ||
moduleExports = freeModule && freeModule.exports === freeExports && freeExports, | ||
freeGlobal = objectTypes[typeof global] && global; | ||
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) { | ||
root = freeGlobal; | ||
} | ||
@@ -22,3 +34,3 @@ | ||
} | ||
}(this, function (global, exp, Rx, undefined) { | ||
}.call(this, function (root, exp, Rx, undefined) { | ||
@@ -25,0 +37,0 @@ var Observable = Rx.Observable, |
@@ -1,1 +0,1 @@ | ||
(function(t,e){var n="object"==typeof exports&&exports,r=("object"==typeof module&&module&&module.exports==n&&module,"object"==typeof global&&global);r.global===r&&(window=r),"function"==typeof define&&define.amd?define(["rx","exports"],function(n,r){return t.Rx=e(t,r,n),t.Rx}):"object"==typeof module&&module&&module.exports===n?module.exports=e(t,module.exports,require("./rx")):t.Rx=e(t,{},t.Rx)})(this,function(t,e,n){function r(){if(this.isDisposed)throw Error(m)}var i=n.Observable,o=i.prototype,s=n.Internals.AnonymousObservable,u=n.Subject,c=n.AsyncSubject,a=n.Observer,h=n.Internals.ScheduledObserver,l=n.Disposable.create,f=n.Disposable.empty,p=n.CompositeDisposable,d=n.Scheduler.currentThread,b=n.Internals.inherits,v=n.Internals.addProperties,m="Object has been disposed";o.multicast=function(t,e){var n=this;return"function"==typeof t?new s(function(r){var i=n.multicast(t());return new p(e(i).subscribe(r),i.connect())}):new E(n,t)},o.publish=function(t){return t?this.multicast(function(){return new u},t):this.multicast(new u)},o.publishLast=function(t){return t?this.multicast(function(){return new c},t):this.multicast(new c)},o.publishValue=function(t,e){return 2===arguments.length?this.multicast(function(){return new g(e)},t):this.multicast(new g(t))},o.replay=function(t,e,n,r){return t?this.multicast(function(){return new w(e,n,r)},t):this.multicast(new w(e,n,r))};var y=function(t,e){this.subject=t,this.observer=e};y.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1),this.observer=null}};var g=n.BehaviorSubject=function(t){function e(t){if(r.call(this),!this.isStopped)return this.observers.push(t),t.onNext(this.value),new y(this,t);var e=this.exception;return e?t.onError(e):t.onCompleted(),f}function n(n){t.call(this,e),this.value=n,this.observers=[],this.isDisposed=!1,this.isStopped=!1,this.exception=null}return b(n,t),v(n.prototype,a,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(r.call(this),!this.isStopped){var t=this.observers.slice(0);this.isStopped=!0;for(var e=0,n=t.length;n>e;e++)t[e].onCompleted();this.observers=[]}},onError:function(t){if(r.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,i=e.length;i>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){if(r.call(this),!this.isStopped){this.value=t;for(var e=this.observers.slice(0),n=0,i=e.length;i>n;n++)e[n].onNext(t)}},dispose:function(){this.isDisposed=!0,this.observers=null,this.value=null,this.exception=null}}),n}(i),w=n.ReplaySubject=function(t){function e(t,e){this.subject=t,this.observer=e}function n(t){var n=new h(this.scheduler,t),i=new e(this,n);r.call(this),this._trim(this.scheduler.now()),this.observers.push(n);for(var o=this.q.length,s=0,u=this.q.length;u>s;s++)n.onNext(this.q[s].value);return this.hasError?(o++,n.onError(this.error)):this.isStopped&&(o++,n.onCompleted()),n.ensureActive(o),i}function i(e,r,i){this.bufferSize=null==e?Number.MAX_VALUE:e,this.windowSize=null==r?Number.MAX_VALUE:r,this.scheduler=i||d,this.q=[],this.observers=[],this.isStopped=!1,this.isDisposed=!1,this.hasError=!1,this.error=null,t.call(this,n)}return e.prototype.dispose=function(){if(this.observer.dispose(),!this.subject.isDisposed){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1)}},b(i,t),v(i.prototype,a,{hasObservers:function(){return this.observers.length>0},_trim:function(t){for(;this.q.length>this.bufferSize;)this.q.shift();for(;this.q.length>0&&t-this.q[0].interval>this.windowSize;)this.q.shift()},onNext:function(t){var e;if(r.call(this),!this.isStopped){var n=this.scheduler.now();this.q.push({interval:n,value:t}),this._trim(n);for(var i=this.observers.slice(0),o=0,s=i.length;s>o;o++)e=i[o],e.onNext(t),e.ensureActive()}},onError:function(t){var e;if(r.call(this),!this.isStopped){this.isStopped=!0,this.error=t,this.hasError=!0;var n=this.scheduler.now();this._trim(n);for(var i=this.observers.slice(0),o=0,s=i.length;s>o;o++)e=i[o],e.onError(t),e.ensureActive();this.observers=[]}},onCompleted:function(){var t;if(r.call(this),!this.isStopped){this.isStopped=!0;var e=this.scheduler.now();this._trim(e);for(var n=this.observers.slice(0),i=0,o=n.length;o>i;i++)t=n[i],t.onCompleted(),t.ensureActive();this.observers=[]}},dispose:function(){this.isDisposed=!0,this.observers=null}}),i}(i),E=function(t){function e(e,n){function r(t){return i.subject.subscribe(t)}var i={subject:n,source:e.asObservable(),hasSubscription:!1,subscription:null};this.connect=function(){return i.hasSubscription||(i.hasSubscription=!0,i.subscription=new p(i.source.subscribe(i.subject),l(function(){i.hasSubscription=!1}))),i.subscription},t.call(this,r)}return b(e,t),e.prototype.connect=function(){return this.connect()},e.prototype.refCount=function(){var t=null,e=0,n=this;return new s(function(r){var i,o;return e++,i=1===e,o=n.subscribe(r),i&&(t=n.connect()),l(function(){o.dispose(),e--,0===e&&t.dispose()})})},e}(i);return n}); | ||
(function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx","exports"],function(b,d){return c.Rx=a(c,d,b),c.Rx}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c){function d(){if(this.isDisposed)throw new Error(r)}var e=c.Observable,f=e.prototype,g=c.Internals.AnonymousObservable,h=c.Subject,i=c.AsyncSubject,j=c.Observer,k=c.Internals.ScheduledObserver,l=c.Disposable.create,m=c.Disposable.empty,n=c.CompositeDisposable,o=c.Scheduler.currentThread,p=c.Internals.inherits,q=c.Internals.addProperties,r="Object has been disposed";f.multicast=function(a,b){var c=this;return"function"==typeof a?new g(function(d){var e=c.multicast(a());return new n(b(e).subscribe(d),e.connect())}):new v(c,a)},f.publish=function(a){return a?this.multicast(function(){return new h},a):this.multicast(new h)},f.publishLast=function(a){return a?this.multicast(function(){return new i},a):this.multicast(new i)},f.publishValue=function(a,b){return 2===arguments.length?this.multicast(function(){return new t(b)},a):this.multicast(new t(a))},f.replay=function(a,b,c,d){return a?this.multicast(function(){return new u(b,c,d)},a):this.multicast(new u(b,c,d))};var s=function(a,b){this.subject=a,this.observer=b};s.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 t=c.BehaviorSubject=function(a){function b(a){if(d.call(this),!this.isStopped)return this.observers.push(a),a.onNext(this.value),new s(this,a);var b=this.exception;return b?a.onError(b):a.onCompleted(),m}function c(c){a.call(this,b),this.value=c,this.observers=[],this.isDisposed=!1,this.isStopped=!1,this.exception=null}return p(c,a),q(c.prototype,j,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(d.call(this),!this.isStopped){var a=this.observers.slice(0);this.isStopped=!0;for(var b=0,c=a.length;c>b;b++)a[b].onCompleted();this.observers=[]}},onError:function(a){if(d.call(this),!this.isStopped){var b=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var c=0,e=b.length;e>c;c++)b[c].onError(a);this.observers=[]}},onNext:function(a){if(d.call(this),!this.isStopped){this.value=a;for(var b=this.observers.slice(0),c=0,e=b.length;e>c;c++)b[c].onNext(a)}},dispose:function(){this.isDisposed=!0,this.observers=null,this.value=null,this.exception=null}}),c}(e),u=c.ReplaySubject=function(a){function b(a,b){this.subject=a,this.observer=b}function c(a){var c=new k(this.scheduler,a),e=new b(this,c);d.call(this),this._trim(this.scheduler.now()),this.observers.push(c);for(var f=this.q.length,g=0,h=this.q.length;h>g;g++)c.onNext(this.q[g].value);return this.hasError?(f++,c.onError(this.error)):this.isStopped&&(f++,c.onCompleted()),c.ensureActive(f),e}function e(b,d,e){this.bufferSize=null==b?Number.MAX_VALUE:b,this.windowSize=null==d?Number.MAX_VALUE:d,this.scheduler=e||o,this.q=[],this.observers=[],this.isStopped=!1,this.isDisposed=!1,this.hasError=!1,this.error=null,a.call(this,c)}return b.prototype.dispose=function(){if(this.observer.dispose(),!this.subject.isDisposed){var a=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(a,1)}},p(e,a),q(e.prototype,j,{hasObservers:function(){return this.observers.length>0},_trim:function(a){for(;this.q.length>this.bufferSize;)this.q.shift();for(;this.q.length>0&&a-this.q[0].interval>this.windowSize;)this.q.shift()},onNext:function(a){var b;if(d.call(this),!this.isStopped){var c=this.scheduler.now();this.q.push({interval:c,value:a}),this._trim(c);for(var e=this.observers.slice(0),f=0,g=e.length;g>f;f++)b=e[f],b.onNext(a),b.ensureActive()}},onError:function(a){var b;if(d.call(this),!this.isStopped){this.isStopped=!0,this.error=a,this.hasError=!0;var c=this.scheduler.now();this._trim(c);for(var e=this.observers.slice(0),f=0,g=e.length;g>f;f++)b=e[f],b.onError(a),b.ensureActive();this.observers=[]}},onCompleted:function(){var a;if(d.call(this),!this.isStopped){this.isStopped=!0;var b=this.scheduler.now();this._trim(b);for(var c=this.observers.slice(0),e=0,f=c.length;f>e;e++)a=c[e],a.onCompleted(),a.ensureActive();this.observers=[]}},dispose:function(){this.isDisposed=!0,this.observers=null}}),e}(e),v=function(a){function b(b,c){function d(a){return e.subject.subscribe(a)}var e={subject:c,source:b.asObservable(),hasSubscription:!1,subscription:null};this.connect=function(){return e.hasSubscription||(e.hasSubscription=!0,e.subscription=new n(e.source.subscribe(e.subject),l(function(){e.hasSubscription=!1}))),e.subscription},a.call(this,d)}return p(b,a),b.prototype.connect=function(){return this.connect()},b.prototype.refCount=function(){var a=null,b=0,c=this;return new g(function(d){var e,f;return b++,e=1===b,f=c.subscribe(d),e&&(a=c.connect()),l(function(){f.dispose(),b--,0===b&&a.dispose()})})},b}(e);return c}); |
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. | ||
(function (root, factory) { | ||
var freeExports = typeof exports == 'object' && exports, | ||
freeModule = typeof module == 'object' && module && module.exports == freeExports && module, | ||
freeGlobal = typeof global == 'object' && global; | ||
if (freeGlobal.global === freeGlobal) { | ||
window = freeGlobal; | ||
(function (factory) { | ||
var objectTypes = { | ||
'boolean': false, | ||
'function': true, | ||
'object': true, | ||
'number': false, | ||
'string': false, | ||
'undefined': false | ||
}; | ||
var root = (objectTypes[typeof window] && window) || this, | ||
freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports, | ||
freeModule = objectTypes[typeof module] && module && !module.nodeType && module, | ||
moduleExports = freeModule && freeModule.exports === freeExports && freeExports, | ||
freeGlobal = objectTypes[typeof global] && global; | ||
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) { | ||
root = freeGlobal; | ||
} | ||
@@ -22,3 +34,3 @@ | ||
} | ||
}(this, function (global, exp, Rx, undefined) { | ||
}.call(this, function (root, exp, Rx, undefined) { | ||
@@ -25,0 +37,0 @@ var Observable = Rx.Observable, |
@@ -1,1 +0,1 @@ | ||
(function(t,e){var n="object"==typeof exports&&exports,r=("object"==typeof module&&module&&module.exports==n&&module,"object"==typeof global&&global);r.global===r&&(window=r),"function"==typeof define&&define.amd?define(["rx","exports"],function(n,r){return t.Rx=e(t,r,n),t.Rx}):"object"==typeof module&&module&&module.exports===n?module.exports=e(t,module.exports,require("./rx")):t.Rx=e(t,{},t.Rx)})(this,function(t,e,n,r){function i(){}function o(t,e){return t===e}function s(t){if(false&t)return 2===t;for(var e=Math.sqrt(t),n=3;e>=n;){if(0===t%n)return!1;n+=2}return!0}function u(t){var e,n,r;for(e=0;D.length>e;++e)if(n=D[e],n>=t)return n;for(r=1|t;D[D.length-1]>r;){if(s(r))return r;r+=2}return t}function c(t){var e=757602046;if(!t.length)return e;for(var n=0,r=t.length;r>n;n++){var i=t.charCodeAt(n);e=(e<<5)-e+i,e&=e}return e}function a(t){var e=668265261;return t=61^t^t>>>16,t+=t<<3,t^=t>>>4,t*=e,t^=t>>>15}function h(){return{key:null,value:null,next:0,hashCode:0}}function l(t,e){return t.groupJoin(this,e,function(){return E()},function(t,e){return e})}function f(t){var e=this;return new x(function(n){var r=new g,i=new b,o=new v(i);return n.onNext(C(r,o)),i.add(e.subscribe(function(t){r.onNext(t)},function(t){r.onError(t),n.onError(t)},function(){r.onCompleted(),n.onCompleted()})),i.add(t.subscribe(function(){r.onCompleted(),r=new g,n.onNext(C(r,o))},function(t){r.onError(t),n.onError(t)},function(){r.onCompleted(),n.onCompleted()})),o})}function p(t){var e=this;return new x(function(n){var o,s=new y,u=new b(s),c=new v(u),a=new g;return n.onNext(C(a,c)),u.add(e.subscribe(function(t){a.onNext(t)},function(t){a.onError(t),n.onError(t)},function(){a.onCompleted(),n.onCompleted()})),o=function(){var e,u;try{u=t()}catch(h){return n.onError(h),r}e=new m,s.setDisposable(e),e.setDisposable(u.take(1).subscribe(i,function(t){a.onError(t),n.onError(t)},function(){a.onCompleted(),a=new g,n.onNext(C(a,c)),o()}))},o(),c})}var d=n.Observable,b=n.CompositeDisposable,v=n.RefCountDisposable,m=n.SingleAssignmentDisposable,y=n.SerialDisposable,g=n.Subject,w=d.prototype,E=d.empty,x=n.Internals.AnonymousObservable,C=(n.Observer.create,n.Internals.addRef),D=[1,3,7,13,31,61,127,251,509,1021,2039,4093,8191,16381,32749,65521,131071,262139,524287,1048573,2097143,4194301,8388593,16777213,33554393,67108859,134217689,268435399,536870909,1073741789,2147483647],N="no such key",A="duplicate key",S=function(){var t=0;return function(e){if(null==e)throw Error(N);if("string"==typeof e)return c(e);if("number"==typeof e)return a(e);if("boolean"==typeof e)return e===!0?1:0;if(e instanceof Date)return e.getTime();if(e.getHashCode)return e.getHashCode();var n=17*t++;return e.getHashCode=function(){return n},n}}(),_=function(t,e){if(0>t)throw Error("out of range");t>0&&this._initialize(t),this.comparer=e||o,this.freeCount=0,this.size=0,this.freeList=-1};return _.prototype._initialize=function(t){var e,n=u(t);for(this.buckets=Array(n),this.entries=Array(n),e=0;n>e;e++)this.buckets[e]=-1,this.entries[e]=h();this.freeList=-1},_.prototype.count=function(){return this.size},_.prototype.add=function(t,e){return this._insert(t,e,!0)},_.prototype._insert=function(t,e,n){this.buckets||this._initialize(0);for(var i,o=2147483647&S(t),s=o%this.buckets.length,u=this.buckets[s];u>=0;u=this.entries[u].next)if(this.entries[u].hashCode===o&&this.comparer(this.entries[u].key,t)){if(n)throw Error(A);return this.entries[u].value=e,r}this.freeCount>0?(i=this.freeList,this.freeList=this.entries[i].next,--this.freeCount):(this.size===this.entries.length&&(this._resize(),s=o%this.buckets.length),i=this.size,++this.size),this.entries[i].hashCode=o,this.entries[i].next=this.buckets[s],this.entries[i].key=t,this.entries[i].value=e,this.buckets[s]=i},_.prototype._resize=function(){var t=u(2*this.size),e=Array(t);for(r=0;e.length>r;++r)e[r]=-1;var n=Array(t);for(r=0;this.size>r;++r)n[r]=this.entries[r];for(var r=this.size;t>r;++r)n[r]=h();for(var i=0;this.size>i;++i){var o=n[i].hashCode%t;n[i].next=e[o],e[o]=i}this.buckets=e,this.entries=n},_.prototype.remove=function(t){if(this.buckets)for(var e=2147483647&S(t),n=e%this.buckets.length,r=-1,i=this.buckets[n];i>=0;i=this.entries[i].next){if(this.entries[i].hashCode===e&&this.comparer(this.entries[i].key,t))return 0>r?this.buckets[n]=this.entries[i].next:this.entries[r].next=this.entries[i].next,this.entries[i].hashCode=-1,this.entries[i].next=this.freeList,this.entries[i].key=null,this.entries[i].value=null,this.freeList=i,++this.freeCount,!0;r=i}return!1},_.prototype.clear=function(){var t,e;if(!(0>=this.size)){for(t=0,e=this.buckets.length;e>t;++t)this.buckets[t]=-1;for(t=0;this.size>t;++t)this.entries[t]=h();this.freeList=-1,this.size=0}},_.prototype._findEntry=function(t){if(this.buckets)for(var e=2147483647&S(t),n=this.buckets[e%this.buckets.length];n>=0;n=this.entries[n].next)if(this.entries[n].hashCode===e&&this.comparer(this.entries[n].key,t))return n;return-1},_.prototype.count=function(){return this.size-this.freeCount},_.prototype.tryGetValue=function(t){var e=this._findEntry(t);return e>=0?this.entries[e].value:r},_.prototype.getValues=function(){var t=0,e=[];if(this.entries)for(var n=0;this.size>n;n++)this.entries[n].hashCode>=0&&(e[t++]=this.entries[n].value);return e},_.prototype.get=function(t){var e=this._findEntry(t);if(e>=0)return this.entries[e].value;throw Error(N)},_.prototype.set=function(t,e){this._insert(t,e,!1)},_.prototype.containskey=function(t){return this._findEntry(t)>=0},w.join=function(t,e,n,o){var s=this;return new x(function(u){var c=new b,a=!1,h=0,l=new _,f=!1,p=0,d=new _;return c.add(s.subscribe(function(t){var n,s,f,p,b=h++,v=new m;l.add(b,t),c.add(v),s=function(){return l.remove(b)&&0===l.count()&&a&&u.onCompleted(),c.remove(v)};try{n=e(t)}catch(y){return u.onError(y),r}v.setDisposable(n.take(1).subscribe(i,u.onError.bind(u),function(){s()})),p=d.getValues();for(var g=0;p.length>g;g++){try{f=o(t,p[g])}catch(w){return u.onError(w),r}u.onNext(f)}},u.onError.bind(u),function(){a=!0,(f||0===l.count())&&u.onCompleted()})),c.add(t.subscribe(function(t){var e,s,a,h,b=p++,v=new m;d.add(b,t),c.add(v),s=function(){return d.remove(b)&&0===d.count()&&f&&u.onCompleted(),c.remove(v)};try{e=n(t)}catch(y){return u.onError(y),r}v.setDisposable(e.take(1).subscribe(i,u.onError.bind(u),function(){s()})),h=l.getValues();for(var g=0;h.length>g;g++){try{a=o(h[g],t)}catch(y){return u.onError(y),r}u.onNext(a)}},u.onError.bind(u),function(){f=!0,(a||0===d.count())&&u.onCompleted()})),c})},w.groupJoin=function(t,e,n,i){var o=this;return new x(function(s){var u=function(){},c=new b,a=new v(c),h=new _,l=new _,f=0,p=0;return c.add(o.subscribe(function(t){var n=new g,o=f++;h.add(o,n);var p,d,b,v,y;try{y=i(t,C(n,a))}catch(w){for(b=h.getValues(),p=0,d=b.length;d>p;p++)b[p].onError(w);return s.onError(w),r}for(s.onNext(y),v=l.getValues(),p=0,d=v.length;d>p;p++)n.onNext(v[p]);var E=new m;c.add(E);var x,D=function(){h.remove(o)&&n.onCompleted(),c.remove(E)};try{x=e(t)}catch(w){for(b=h.getValues(),p=0,d=h.length;d>p;p++)b[p].onError(w);return s.onError(w),r}E.setDisposable(x.take(1).subscribe(u,function(t){for(b=h.getValues(),p=0,d=b.length;d>p;p++)b[p].onError(t);s.onError(t)},D))},function(t){for(var e=h.getValues(),n=0,r=e.length;r>n;n++)e[n].onError(t);s.onError(t)},s.onCompleted.bind(s))),c.add(t.subscribe(function(t){var e,i,o,a=p++;l.add(a,t);var f=new m;c.add(f);var d,b=function(){l.remove(a),c.remove(f)};try{d=n(t)}catch(v){for(e=h.getValues(),i=0,o=h.length;o>i;i++)e[i].onError(v);return s.onError(v),r}for(f.setDisposable(d.take(1).subscribe(u,function(t){for(e=h.getValues(),i=0,o=h.length;o>i;i++)e[i].onError(t);s.onError(t)},b)),e=h.getValues(),i=0,o=e.length;o>i;i++)e[i].onNext(t)},function(t){for(var e=h.getValues(),n=0,r=e.length;r>n;n++)e[n].onError(t);s.onError(t)})),a})},w.buffer=function(){return this.window.apply(this,arguments).selectMany(function(t){return t.toArray()})},w.window=function(t,e){return 1===arguments.length&&"function"!=typeof arguments[0]?f.call(this,t):"function"==typeof t?p.call(this,t):l.call(this,t,e)},n}); | ||
(function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx","exports"],function(b,d){return c.Rx=a(c,d,b),c.Rx}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c,d){function e(){}function f(a,b){return a===b}function g(a){if(a&!1)return 2===a;for(var b=Math.sqrt(a),c=3;b>=c;){if(0===a%c)return!1;c+=2}return!0}function h(a){var b,c,d;for(b=0;b<y.length;++b)if(c=y[b],c>=a)return c;for(d=1|a;d<y[y.length-1];){if(g(d))return d;d+=2}return a}function i(a){var b=757602046;if(!a.length)return b;for(var c=0,d=a.length;d>c;c++){var e=a.charCodeAt(c);b=(b<<5)-b+e,b&=b}return b}function j(a){var b=668265261;return a=61^a^a>>>16,a+=a<<3,a^=a>>>4,a*=b,a^=a>>>15}function k(){return{key:null,value:null,next:0,hashCode:0}}function l(a,b){return a.groupJoin(this,b,function(){return v()},function(a,b){return b})}function m(a){var b=this;return new w(function(c){var d=new t,e=new p,f=new q(e);return c.onNext(x(d,f)),e.add(b.subscribe(function(a){d.onNext(a)},function(a){d.onError(a),c.onError(a)},function(){d.onCompleted(),c.onCompleted()})),e.add(a.subscribe(function(){d.onCompleted(),d=new t,c.onNext(x(d,f))},function(a){d.onError(a),c.onError(a)},function(){d.onCompleted(),c.onCompleted()})),f})}function n(a){var b=this;return new w(function(c){var d,f=new s,g=new p(f),h=new q(g),i=new t;return c.onNext(x(i,h)),g.add(b.subscribe(function(a){i.onNext(a)},function(a){i.onError(a),c.onError(a)},function(){i.onCompleted(),c.onCompleted()})),d=function(){var b,g;try{g=a()}catch(j){return c.onError(j),void 0}b=new r,f.setDisposable(b),b.setDisposable(g.take(1).subscribe(e,function(a){i.onError(a),c.onError(a)},function(){i.onCompleted(),i=new t,c.onNext(x(i,h)),d()}))},d(),h})}var o=c.Observable,p=c.CompositeDisposable,q=c.RefCountDisposable,r=c.SingleAssignmentDisposable,s=c.SerialDisposable,t=c.Subject,u=o.prototype,v=o.empty,w=c.Internals.AnonymousObservable,x=(c.Observer.create,c.Internals.addRef),y=[1,3,7,13,31,61,127,251,509,1021,2039,4093,8191,16381,32749,65521,131071,262139,524287,1048573,2097143,4194301,8388593,16777213,33554393,67108859,134217689,268435399,536870909,1073741789,2147483647],z="no such key",A="duplicate key",B=function(){var a=0;return function(b){if(null==b)throw new Error(z);if("string"==typeof b)return i(b);if("number"==typeof b)return j(b);if("boolean"==typeof b)return b===!0?1:0;if(b instanceof Date)return b.getTime();if(b.getHashCode)return b.getHashCode();var c=17*a++;return b.getHashCode=function(){return c},c}}(),C=function(a,b){if(0>a)throw new Error("out of range");a>0&&this._initialize(a),this.comparer=b||f,this.freeCount=0,this.size=0,this.freeList=-1};return C.prototype._initialize=function(a){var b,c=h(a);for(this.buckets=new Array(c),this.entries=new Array(c),b=0;c>b;b++)this.buckets[b]=-1,this.entries[b]=k();this.freeList=-1},C.prototype.count=function(){return this.size},C.prototype.add=function(a,b){return this._insert(a,b,!0)},C.prototype._insert=function(a,b,c){this.buckets||this._initialize(0);for(var d,e=2147483647&B(a),f=e%this.buckets.length,g=this.buckets[f];g>=0;g=this.entries[g].next)if(this.entries[g].hashCode===e&&this.comparer(this.entries[g].key,a)){if(c)throw new Error(A);return this.entries[g].value=b,void 0}this.freeCount>0?(d=this.freeList,this.freeList=this.entries[d].next,--this.freeCount):(this.size===this.entries.length&&(this._resize(),f=e%this.buckets.length),d=this.size,++this.size),this.entries[d].hashCode=e,this.entries[d].next=this.buckets[f],this.entries[d].key=a,this.entries[d].value=b,this.buckets[f]=d},C.prototype._resize=function(){var a=h(2*this.size),b=new Array(a);for(d=0;d<b.length;++d)b[d]=-1;var c=new Array(a);for(d=0;d<this.size;++d)c[d]=this.entries[d];for(var d=this.size;a>d;++d)c[d]=k();for(var e=0;e<this.size;++e){var f=c[e].hashCode%a;c[e].next=b[f],b[f]=e}this.buckets=b,this.entries=c},C.prototype.remove=function(a){if(this.buckets)for(var b=2147483647&B(a),c=b%this.buckets.length,d=-1,e=this.buckets[c];e>=0;e=this.entries[e].next){if(this.entries[e].hashCode===b&&this.comparer(this.entries[e].key,a))return 0>d?this.buckets[c]=this.entries[e].next:this.entries[d].next=this.entries[e].next,this.entries[e].hashCode=-1,this.entries[e].next=this.freeList,this.entries[e].key=null,this.entries[e].value=null,this.freeList=e,++this.freeCount,!0;d=e}return!1},C.prototype.clear=function(){var a,b;if(!(this.size<=0)){for(a=0,b=this.buckets.length;b>a;++a)this.buckets[a]=-1;for(a=0;a<this.size;++a)this.entries[a]=k();this.freeList=-1,this.size=0}},C.prototype._findEntry=function(a){if(this.buckets)for(var b=2147483647&B(a),c=this.buckets[b%this.buckets.length];c>=0;c=this.entries[c].next)if(this.entries[c].hashCode===b&&this.comparer(this.entries[c].key,a))return c;return-1},C.prototype.count=function(){return this.size-this.freeCount},C.prototype.tryGetValue=function(a){var b=this._findEntry(a);return b>=0?this.entries[b].value:d},C.prototype.getValues=function(){var a=0,b=[];if(this.entries)for(var c=0;c<this.size;c++)this.entries[c].hashCode>=0&&(b[a++]=this.entries[c].value);return b},C.prototype.get=function(a){var b=this._findEntry(a);if(b>=0)return this.entries[b].value;throw new Error(z)},C.prototype.set=function(a,b){this._insert(a,b,!1)},C.prototype.containskey=function(a){return this._findEntry(a)>=0},u.join=function(a,b,c,d){var f=this;return new w(function(g){var h=new p,i=!1,j=0,k=new C,l=!1,m=0,n=new C;return h.add(f.subscribe(function(a){var c,f,l,m,o=j++,p=new r;k.add(o,a),h.add(p),f=function(){return k.remove(o)&&0===k.count()&&i&&g.onCompleted(),h.remove(p)};try{c=b(a)}catch(q){return g.onError(q),void 0}p.setDisposable(c.take(1).subscribe(e,g.onError.bind(g),function(){f()})),m=n.getValues();for(var s=0;s<m.length;s++){try{l=d(a,m[s])}catch(t){return g.onError(t),void 0}g.onNext(l)}},g.onError.bind(g),function(){i=!0,(l||0===k.count())&&g.onCompleted()})),h.add(a.subscribe(function(a){var b,f,i,j,o=m++,p=new r;n.add(o,a),h.add(p),f=function(){return n.remove(o)&&0===n.count()&&l&&g.onCompleted(),h.remove(p)};try{b=c(a)}catch(q){return g.onError(q),void 0}p.setDisposable(b.take(1).subscribe(e,g.onError.bind(g),function(){f()})),j=k.getValues();for(var s=0;s<j.length;s++){try{i=d(j[s],a)}catch(q){return g.onError(q),void 0}g.onNext(i)}},g.onError.bind(g),function(){l=!0,(i||0===n.count())&&g.onCompleted()})),h})},u.groupJoin=function(a,b,c,d){var e=this;return new w(function(f){var g=function(){},h=new p,i=new q(h),j=new C,k=new C,l=0,m=0;return h.add(e.subscribe(function(a){var c=new t,e=l++;j.add(e,c);var m,n,o,p,q;try{q=d(a,x(c,i))}catch(s){for(o=j.getValues(),m=0,n=o.length;n>m;m++)o[m].onError(s);return f.onError(s),void 0}for(f.onNext(q),p=k.getValues(),m=0,n=p.length;n>m;m++)c.onNext(p[m]);var u=new r;h.add(u);var v,w=function(){j.remove(e)&&c.onCompleted(),h.remove(u)};try{v=b(a)}catch(s){for(o=j.getValues(),m=0,n=j.length;n>m;m++)o[m].onError(s);return f.onError(s),void 0}u.setDisposable(v.take(1).subscribe(g,function(a){for(o=j.getValues(),m=0,n=o.length;n>m;m++)o[m].onError(a);f.onError(a)},w))},function(a){for(var b=j.getValues(),c=0,d=b.length;d>c;c++)b[c].onError(a);f.onError(a)},f.onCompleted.bind(f))),h.add(a.subscribe(function(a){var b,d,e,i=m++;k.add(i,a);var l=new r;h.add(l);var n,o=function(){k.remove(i),h.remove(l)};try{n=c(a)}catch(p){for(b=j.getValues(),d=0,e=j.length;e>d;d++)b[d].onError(p);return f.onError(p),void 0}for(l.setDisposable(n.take(1).subscribe(g,function(a){for(b=j.getValues(),d=0,e=j.length;e>d;d++)b[d].onError(a);f.onError(a)},o)),b=j.getValues(),d=0,e=b.length;e>d;d++)b[d].onNext(a)},function(a){for(var b=j.getValues(),c=0,d=b.length;d>c;c++)b[c].onError(a);f.onError(a)})),i})},u.buffer=function(){return this.window.apply(this,arguments).selectMany(function(a){return a.toArray()})},u.window=function(a,b){return 1===arguments.length&&"function"!=typeof arguments[0]?m.call(this,a):"function"==typeof a?n.call(this,a):l.call(this,a,b)},c}); |
@@ -1,2 +0,2 @@ | ||
(function(t,e){function n(){}function r(t){return t}function i(t,e){return F(t,e)}function o(t,e){return t-e}function s(t){return""+t}function u(t){throw t}function c(){if(this.isDisposed)throw Error(S)}function a(t){return"function"!=typeof t.toString&&"string"==typeof(t+"")}function h(t){return t&&"object"==typeof t?M.call(t)==N:!1}function l(t){return"function"==typeof t}function f(t,e,n,r){var i;if(t===e)return 0!==t||1/t==1/e;var o=typeof t,s=typeof e;if(!(t!==t||t&&_[o]||e&&_[s]))return!1;if(null==t||null==e)return t===e;var u=M.call(t),c=M.call(e);if(u==N&&(u=I),c==N&&(c=I),u!=c)return!1;switch(u){case R:case j:return+t==+e;case k:return t!=+t?e!=+e:0==t?1/t==1/e:t==+e;case q:case P:return t==e+""}var p=u==O;if(!p){if(u!=I||!E&&(a(t)||a(e)))return!1;var d=!L&&h(t)?Object:t.constructor,b=!L&&h(e)?Object:e.constructor;if(d!=b&&!(l(d)&&d instanceof d&&l(b)&&b instanceof b))return!1}for(var v=n.length;v--;)if(n[v]==t)return r[v]==e;var m=0;if(i=!0,n.push(t),r.push(e),p){for(v=t.length,m=e.length,i=m==t.length;m--;){var y=e[m];if(!(i=f(t[m],y,n,r)))break}return i}for(var g in e)if(T.call(e,g))return m++,i=T.call(t,g)&&f(t[g],e[g],n,r);if(i)for(var g in t)if(T.call(t,g))return i=--m>-1;return n.pop(),r.pop(),i}function p(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:V.call(t)}function d(t,e){for(var n=Array(t),r=0;t>r;r++)n[r]=e();return n}function b(t,e){this.scheduler=t,this.disposable=e,this.isDisposed=!1}function v(t,n){return new Be(function(r){var i=new ne,o=new ie;return o.setDisposable(i),i.setDisposable(t.subscribe(r.onNext.bind(r),function(t){var i,s;try{s=n(t)}catch(u){return r.onError(u),e}i=new ne,o.setDisposable(i),i.setDisposable(s.subscribe(r))},r.onCompleted.bind(r))),o})}function m(t,n){var r=this;return new Be(function(i){var o=0,s=t.length;return r.subscribe(function(r){if(s>o){var u,c=t[o++];try{u=n(r,c)}catch(a){return i.onError(a),e}i.onNext(u)}else i.onCompleted()},i.onError.bind(i),i.onCompleted.bind(i))})}function y(t){return this.select(t).mergeObservable()}var g="object"==typeof exports&&exports,w=("object"==typeof module&&module&&module.exports==g&&module,"object"==typeof global&&global);w.global===w&&(t=w);var E,x={Internals:{}},D=function(){return Date.now?Date.now:function(){return+new Date}}(),C="Sequence contains no elements.",A="Argument out of range",S="Object has been disposed",_={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},N="[object Arguments]",O="[object Array]",R="[object Boolean]",j="[object Date]",W="[object Function]",k="[object Number]",I="[object Object]",q="[object RegExp]",P="[object String]",M=Object.prototype.toString,T=Object.prototype.hasOwnProperty,L=M.call(arguments)==N;try{E=!(M.call(document)==I&&!({toString:0}+""))}catch(z){E=!0}L||(h=function(t){return t&&"object"==typeof t?T.call(t,"callee"):!1}),l(/x/)&&(l=function(t){return"function"==typeof t&&M.call(t)==W});var F=x.Internals.isEqual=function(t,e){return f(t,e,[],[])},V=Array.prototype.slice;({}).hasOwnProperty;var B=this.inherits=x.Internals.inherits=function(t,e){function n(){this.constructor=t}n.prototype=e.prototype,t.prototype=new n},U=x.Internals.addProperties=function(t){for(var e=V.call(arguments,1),n=0,r=e.length;r>n;n++){var i=e[n];for(var o in i)t[o]=i[o]}},H=x.Internals.addRef=function(t,e){return new Be(function(n){return new Y(e.getDisposable(),t.subscribe(n))})};Function.prototype.bind||(Function.prototype.bind=function(t){var e=this,n=V.call(arguments,1),r=function(){function i(){}if(this instanceof r){i.prototype=e.prototype;var o=new i,s=e.apply(o,n.concat(V.call(arguments)));return Object(s)===s?s:o}return e.apply(t,n.concat(V.call(arguments)))};return r});var Q=Object("a"),G="a"!=Q[0]||!(0 in Q);Array.prototype.every||(Array.prototype.every=function(t){var e=Object(this),n=G&&"[object String]"=={}.toString.call(this)?this.split(""):e,r=n.length>>>0,i=arguments[1];if("[object Function]"!={}.toString.call(t))throw new TypeError(t+" is not a function");for(var o=0;r>o;o++)if(o in n&&!t.call(i,n[o],o,e))return!1;return!0}),Array.prototype.map||(Array.prototype.map=function(t){var e=Object(this),n=G&&"[object String]"=={}.toString.call(this)?this.split(""):e,r=n.length>>>0,i=Array(r),o=arguments[1];if("[object Function]"!={}.toString.call(t))throw new TypeError(t+" is not a function");for(var s=0;r>s;s++)s in n&&(i[s]=t.call(o,n[s],s,e));return i}),Array.prototype.filter||(Array.prototype.filter=function(t){for(var e,n=[],r=Object(this),i=0,o=r.length>>>0;o>i;i++)e=r[i],i in r&&t.call(arguments[1],e,i,r)&&n.push(e);return n}),Array.isArray||(Array.isArray=function(t){return"[object Array]"==Object.prototype.toString.call(t)}),Array.prototype.indexOf||(Array.prototype.indexOf=function(t){var e=Object(this),n=e.length>>>0;if(0===n)return-1;var r=0;if(arguments.length>1&&(r=Number(arguments[1]),r!==r?r=0:0!==r&&1/0!=r&&r!==-1/0&&(r=(r>0||-1)*Math.floor(Math.abs(r)))),r>=n)return-1;for(var i=r>=0?r:Math.max(n-Math.abs(r),0);n>i;i++)if(i in e&&e[i]===t)return i;return-1});var J=function(t,e){this.id=t,this.value=e};J.prototype.compareTo=function(t){var e=this.value.compareTo(t.value);return 0===e&&(e=this.id-t.id),e};var K=x.Internals.PriorityQueue=function(t){this.items=Array(t),this.length=0},X=K.prototype;X.isHigherPriority=function(t,e){return 0>this.items[t].compareTo(this.items[e])},X.percolate=function(t){if(!(t>=this.length||0>t)){var e=t-1>>1;if(!(0>e||e===t)&&this.isHigherPriority(t,e)){var n=this.items[t];this.items[t]=this.items[e],this.items[e]=n,this.percolate(e)}}},X.heapify=function(t){if(t===e&&(t=0),!(t>=this.length||0>t)){var n=2*t+1,r=2*t+2,i=t;if(this.length>n&&this.isHigherPriority(n,i)&&(i=n),this.length>r&&this.isHigherPriority(r,i)&&(i=r),i!==t){var o=this.items[t];this.items[t]=this.items[i],this.items[i]=o,this.heapify(i)}}},X.peek=function(){return this.items[0].value},X.removeAt=function(t){this.items[t]=this.items[--this.length],delete this.items[this.length],this.heapify()},X.dequeue=function(){var t=this.peek();return this.removeAt(0),t},X.enqueue=function(t){var e=this.length++;this.items[e]=new J(K.count++,t),this.percolate(e)},X.remove=function(t){for(var e=0;this.length>e;e++)if(this.items[e].value===t)return this.removeAt(e),!0;return!1},K.count=0;var Y=x.CompositeDisposable=function(){this.disposables=p(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},Z=Y.prototype;Z.add=function(t){this.isDisposed?t.dispose():(this.disposables.push(t),this.length++)},Z.remove=function(t){var e=!1;if(!this.isDisposed){var n=this.disposables.indexOf(t);-1!==n&&(e=!0,this.disposables.splice(n,1),this.length--,t.dispose())}return e},Z.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()}},Z.clear=function(){var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()},Z.contains=function(t){return-1!==this.disposables.indexOf(t)},Z.toArray=function(){return this.disposables.slice(0)};var $=x.Disposable=function(t){this.isDisposed=!1,this.action=t||n};$.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var te=$.create=function(t){return new $(t)},ee=$.empty={dispose:n},ne=x.SingleAssignmentDisposable=function(){this.isDisposed=!1,this.current=null},re=ne.prototype;re.getDisposable=function(){return this.current},ne.disposable=function(t){return arguments.length?this.getDisposable():this.setDisposable(t)},re.setDisposable=function(t){if(this.current)throw Error("Disposable has already been assigned");var e=this.isDisposed;e||(this.current=t),e&&t&&t.dispose()},re.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()};var ie=x.SerialDisposable=function(){this.isDisposed=!1,this.current=null},oe=ie.prototype;oe.getDisposable=function(){return this.current},oe.setDisposable=function(t){var e,n=this.isDisposed;n||(e=this.current,this.current=t),e&&e.dispose(),n&&t&&t.dispose()},oe.disposable=function(t){return t?(this.setDisposable(t),e):this.getDisposable()},oe.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()};var se=x.RefCountDisposable=function(){function t(t){this.disposable=t,this.disposable.count++,this.isInnerDisposed=!1}function e(t){this.underlyingDisposable=t,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return t.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},e.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},e.prototype.getDisposable=function(){return this.isDisposed?ee:new t(this)},e}();b.prototype.dispose=function(){var t=this;this.scheduler.schedule(function(){t.isDisposed||(t.isDisposed=!0,t.disposable.dispose())})};var ue=x.Internals.ScheduledItem=function(t,e,n,r,i){this.scheduler=t,this.state=e,this.action=n,this.dueTime=r,this.comparer=i||o,this.disposable=new ne};ue.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},ue.prototype.compareTo=function(t){return this.comparer(this.dueTime,t.dueTime)},ue.prototype.isCancelled=function(){return this.disposable.isDisposed},ue.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var ce=x.Scheduler=function(){function e(t,e,n,r){this.now=t,this._schedule=e,this._scheduleRelative=n,this._scheduleAbsolute=r}function n(t,e){var n=e.first,r=e.second,i=new Y,o=function(e){r(e,function(e){var n=!1,r=!1,s=t.scheduleWithState(e,function(t,e){return n?i.remove(s):r=!0,o(e),ee});r||(i.add(s),n=!0)})};return o(n),i}function r(t,e,n){var r=e.first,i=e.second,o=new Y,s=function(e){i(e,function(e,r){var i=!1,u=!1,c=t[n].call(t,e,r,function(t,e){return i?o.remove(c):u=!0,s(e),ee});u||(o.add(c),i=!0)})};return s(r),o}function i(t,e){return e(),ee}var o=e.prototype;return o.catchException=o["catch"]=function(t){return new de(this,t)},o.schedulePeriodic=function(t,e){return this.schedulePeriodicWithState(null,t,function(){e()})},o.schedulePeriodicWithState=function(e,n,r){var i=e,o=t.setInterval(function(){i=r(i)},n);return te(function(){t.clearInterval(o)})},o.schedule=function(t){return this._schedule(t,i)},o.scheduleWithState=function(t,e){return this._schedule(t,e)},o.scheduleWithRelative=function(t,e){return this._scheduleRelative(e,t,i)},o.scheduleWithRelativeAndState=function(t,e,n){return this._scheduleRelative(t,e,n)},o.scheduleWithAbsolute=function(t,e){return this._scheduleAbsolute(e,t,i)},o.scheduleWithAbsoluteAndState=function(t,e,n){return this._scheduleAbsolute(t,e,n)},o.scheduleRecursive=function(t){return this.scheduleRecursiveWithState(t,function(t,e){t(function(){e(t)})})},o.scheduleRecursiveWithState=function(t,e){return this.scheduleWithState({first:t,second:e},function(t,e){return n(t,e)})},o.scheduleRecursiveWithRelative=function(t,e){return this.scheduleRecursiveWithRelativeAndState(e,t,function(t,e){t(function(n){e(t,n)})})},o.scheduleRecursiveWithRelativeAndState=function(t,e,n){return this._scheduleRelative({first:t,second:n},e,function(t,e){return r(t,e,"scheduleWithRelativeAndState")})},o.scheduleRecursiveWithAbsolute=function(t,e){return this.scheduleRecursiveWithAbsoluteAndState(e,t,function(t,e){t(function(n){e(t,n)})})},o.scheduleRecursiveWithAbsoluteAndState=function(t,e,n){return this._scheduleAbsolute({first:t,second:n},e,function(t,e){return r(t,e,"scheduleWithAbsoluteAndState")})},e.now=D,e.normalize=function(t){return 0>t&&(t=0),t},e}();x.Internals.SchedulePeriodicRecursive=function(){function t(t,e){e(0,this._period);try{this._state=this._action(this._state)}catch(n){throw this._cancel.dispose(),n}}function e(t,e,n,r){this._scheduler=t,this._state=e,this._period=n,this._action=r}return e.prototype.start=function(){var e=new ne;return this._cancel=e,e.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,t.bind(this))),e},e}();var ae,he="Scheduler is not allowed to block the thread",le=ce.immediate=function(){function t(t,e){return e(this,t)}function e(t,e,n){if(e>0)throw Error(he);return n(this,t)}function n(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new ce(D,t,e,n)}(),fe=ce.currentThread=function(){function t(){i=new K(4)}function e(t,e){return this.scheduleWithRelativeAndState(t,0,e)}function n(e,n,r){var o,s=this.now()+ce.normalize(n),u=new ue(this,e,r,s);if(i)i.enqueue(u);else{o=new t;try{i.enqueue(u),o.run()}catch(c){throw c}finally{o.dispose()}}return u.disposable}function r(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}var i;t.prototype.dispose=function(){i=null},t.prototype.run=function(){for(var t;i.length>0;)if(t=i.dequeue(),!t.isCancelled()){for(;t.dueTime-ce.now()>0;);t.isCancelled()||t.invoke()}};var o=new ce(D,e,n,r);return o.scheduleRequired=function(){return null===i},o.ensureTrampoline=function(t){return null===i?this.schedule(t):t()},o}(),pe=n;(function(){function e(){if(!t.postMessage||t.importScripts)return!1;var e=!1,n=t.onmessage;return t.onmessage=function(){e=!0},t.postMessage("","*"),t.onmessage=n,e}function n(t){if("string"==typeof t.data&&t.data.substring(0,r.length)===r){var e=t.data.substring(r.length),n=i[e];n(),delete i[e]}}if("function"==typeof t.setImmediate)ae=t.setImmediate,pe=clearImmediate;else if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))ae=process.nextTick;else if(e()){var r="ms.rx.schedule"+Math.random(),i={},o=0;t.addEventListener?t.addEventListener("message",n,!1):t.attachEvent("onmessage",n,!1),ae=function(e){var n=o++;i[n]=e,t.postMessage(r+n,"*")}}else if(t.MessageChannel){var s=new t.MessageChannel,u={},c=0;s.port1.onmessage=function(t){var e=t.data,n=u[e];n(),delete u[e]},ae=function(t){var e=c++;u[e]=t,s.port2.postMessage(e)}}else"document"in t&&"onreadystatechange"in t.document.createElement("script")?ae=function(e){var n=t.document.createElement("script");n.onreadystatechange=function(){e(),n.onreadystatechange=null,n.parentNode.removeChild(n),n=null},t.document.documentElement.appendChild(n)}:(ae=function(e){return t.setTimeout(e,0)},pe=t.clearTimeout)})(),ce.timeout=function(){function e(t,e){var n=this,r=new ne,i=ae(function(){r.isDisposed||r.setDisposable(e(n,t))});return new Y(r,te(function(){pe(i)}))}function n(e,n,r){var i=this,o=ce.normalize(n);if(0===o)return i.scheduleWithState(e,r);var s=new ne,u=t.setTimeout(function(){s.isDisposed||s.setDisposable(r(i,e))},o);return new Y(s,te(function(){t.clearTimeout(u)}))}function r(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new ce(D,e,n,r)}();var de=function(t){function e(){return this._scheduler.now()}function n(t,e){return this._scheduler.scheduleWithState(t,this._wrap(e))}function r(t,e,n){return this._scheduler.scheduleWithRelativeAndState(t,e,this._wrap(n))}function i(t,e,n){return this._scheduler.scheduleWithAbsoluteAndState(t,e,this._wrap(n))}function o(o,s){this._scheduler=o,this._handler=s,this._recursiveOriginal=null,this._recursiveWrapper=null,t.call(this,e,n,r,i)}return B(o,t),o.prototype._clone=function(t){return new o(t,this._handler)},o.prototype._wrap=function(t){var e=this;return function(n,r){try{return t(e._getRecursiveWrapper(n),r)}catch(i){if(!e._handler(i))throw i;return ee}}},o.prototype._getRecursiveWrapper=function(t){if(this._recursiveOriginal!==t){this._recursiveOriginal=t;var e=this._clone(t);e._recursiveOriginal=t,e._recursiveWrapper=e,this._recursiveWrapper=e}return this._recursiveWrapper},o.prototype.schedulePeriodicWithState=function(t,e,n){var r=this,i=!1,o=new ne;return o.setDisposable(this._scheduler.schedulePeriodicWithState(t,e,function(t){if(i)return null;try{return n(t)}catch(e){if(i=!0,!r._handler(e))throw e;return o.dispose(),null}})),o},o}(ce),be=x.Notification=function(){function t(t,e){this.hasValue=null==e?!1:e,this.kind=t}var e=t.prototype;return e.accept=function(t,e,n){return 1===arguments.length&&"object"==typeof t?this._acceptObservable(t):this._accept(t,e,n)},e.toObservable=function(t){var e=this;return t||(t=le),new Be(function(n){return t.schedule(function(){e._acceptObservable(n),"N"===e.kind&&n.onCompleted()})})},t}(),ve=be.createOnNext=function(){function t(t){return t(this.value)}function e(t){return t.onNext(this.value)}function n(){return"OnNext("+this.value+")"}return function(r){var i=new be("N",!0);return i.value=r,i._accept=t,i._acceptObservable=e,i.toString=n,i}}(),me=be.createOnError=function(){function t(t,e){return e(this.exception)}function e(t){return t.onError(this.exception)}function n(){return"OnError("+this.exception+")"}return function(r){var i=new be("E");return i.exception=r,i._accept=t,i._acceptObservable=e,i.toString=n,i}}(),ye=be.createOnCompleted=function(){function t(t,e,n){return n()}function e(t){return t.onCompleted()}function n(){return"OnCompleted()"}return function(){var r=new be("C");return r._accept=t,r._acceptObservable=e,r.toString=n,r}}(),ge=x.Internals.Enumerator=function(t,e,n){this.moveNext=t,this.getCurrent=e,this.dispose=n},we=ge.create=function(t,e,r){var i=!1;return r||(r=n),new ge(function(){if(i)return!1;var e=t();return e||(i=!0,r()),e},function(){return e()},function(){i||(r(),i=!0)})},Ee=x.Internals.Enumerable=function(){function t(t){this.getEnumerator=t}return t.prototype.concat=function(){var t=this;return new Be(function(n){var r=t.getEnumerator(),i=!1,o=new ie,s=le.scheduleRecursive(function(t){var s,u,c=!1;if(!i){try{c=r.moveNext(),c?s=r.getCurrent():r.dispose()}catch(a){u=a,r.dispose()}if(u)return n.onError(u),e;if(!c)return n.onCompleted(),e;var h=new ne;o.setDisposable(h),h.setDisposable(s.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){t()}))}});return new Y(o,s,te(function(){i=!0,r.dispose()}))})},t.prototype.catchException=function(){var t=this;return new Be(function(n){var r,i=t.getEnumerator(),o=!1,s=new ie,u=le.scheduleRecursive(function(t){var u,c,a;if(a=!1,!o){try{a=i.moveNext(),a&&(u=i.getCurrent())}catch(h){c=h}if(c)return n.onError(c),e;if(!a)return r?n.onError(r):n.onCompleted(),e;var l=new ne;s.setDisposable(l),l.setDisposable(u.subscribe(n.onNext.bind(n),function(e){r=e,t()},n.onCompleted.bind(n)))}});return new Y(s,u,te(function(){o=!0}))})},t}(),xe=Ee.repeat=function(t,n){return n===e&&(n=-1),new Ee(function(){var e,r=n;return we(function(){return 0===r?!1:(r>0&&r--,e=t,!0)},function(){return e})})},De=Ee.forEach=function(t,e){return e||(e=r),new Ee(function(){var n,r=-1;return we(function(){return++r<t.length?(n=e(t[r],r),!0):!1},function(){return n})})},Ce=x.Observer=function(){};Ce.prototype.toNotifier=function(){var t=this;return function(e){return e.accept(t)}},Ce.prototype.asObserver=function(){return new Ne(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},Ce.prototype.checked=function(){return new Oe(this)};var Ae=Ce.create=function(t,e,r){return t||(t=n),e||(e=u),r||(r=n),new Ne(t,e,r)};Ce.fromNotifier=function(t){return new Ne(function(e){return t(ve(e))},function(e){return t(me(e))},function(){return t(ye())})},Ce.notifyOn=function(t){return new je(t,this)};var Se,_e=x.Internals.AbstractObserver=function(t){function e(){this.isStopped=!1,t.call(this)}return B(e,t),e.prototype.onNext=function(t){this.isStopped||this.next(t)},e.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.error(t))},e.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},e.prototype.dispose=function(){this.isStopped=!0},e.prototype.fail=function(t){return this.isStopped?!1:(this.isStopped=!0,this.error(t),!0)},e}(Ce),Ne=x.AnonymousObserver=function(t){function e(e,n,r){t.call(this),this._onNext=e,this._onError=n,this._onCompleted=r}return B(e,t),e.prototype.next=function(t){this._onNext(t)},e.prototype.error=function(t){this._onError(t)},e.prototype.completed=function(){this._onCompleted()},e}(_e),Oe=function(t){function e(e){t.call(this),this._observer=e,this._state=0}B(e,t);var n=e.prototype;return n.onNext=function(t){this.checkAccess();try{this._observer.onNext(t)}catch(e){throw e}finally{this._state=0}},n.onError=function(t){this.checkAccess();try{this._observer.onError(t)}catch(e){throw e}finally{this._state=2}},n.onCompleted=function(){this.checkAccess();try{this._observer.onCompleted()}catch(t){throw t}finally{this._state=2}},n.checkAccess=function(){if(1===this._state)throw Error("Re-entrancy detected");if(2===this._state)throw Error("Observer completed");0===this._state&&(this._state=1)},e}(Ce),Re=x.Internals.ScheduledObserver=function(t){function n(e,n){t.call(this),this.scheduler=e,this.observer=n,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new ie}return B(n,t),n.prototype.next=function(t){var e=this;this.queue.push(function(){e.observer.onNext(t)})},n.prototype.error=function(t){var e=this;this.queue.push(function(){e.observer.onError(t)})},n.prototype.completed=function(){var t=this;this.queue.push(function(){t.observer.onCompleted()})},n.prototype.ensureActive=function(){var t=!1,n=this;!this.hasFaulted&&this.queue.length>0&&(t=!this.isAcquired,this.isAcquired=!0),t&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(t){var r;if(!(n.queue.length>0))return n.isAcquired=!1,e;r=n.queue.shift();try{r()}catch(i){throw n.queue=[],n.hasFaulted=!0,i}t()}))},n.prototype.dispose=function(){t.prototype.dispose.call(this),this.disposable.dispose()},n}(_e),je=function(t){function e(){t.apply(this,arguments)}return B(e,t),e.prototype.next=function(e){t.prototype.next.call(this,e),this.ensureActive()},e.prototype.error=function(e){t.prototype.error.call(this,e),this.ensureActive()},e.prototype.completed=function(){t.prototype.completed.call(this),this.ensureActive()},e}(Re),We=x.Observable=function(){function t(t){this._subscribe=t}return Se=t.prototype,Se.finalValue=function(){var t=this;return new Be(function(e){var n,r=!1;return t.subscribe(function(t){r=!0,n=t},e.onError.bind(e),function(){r?(e.onNext(n),e.onCompleted()):e.onError(Error(C))})})},Se.subscribe=Se.forEach=function(t,e,n){var r;return r="object"==typeof t?t:Ae(t,e,n),this._subscribe(r)},Se.toArray=function(){function t(t,e){var n=t.slice(0);return n.push(e),n}return this.scan([],t).startWith([]).finalValue()},t}();Se.observeOn=function(t){var e=this;return new Be(function(n){return e.subscribe(new je(t,n))})},Se.subscribeOn=function(t){var e=this;return new Be(function(n){var r=new ne,i=new ie;return i.setDisposable(r),r.setDisposable(t.schedule(function(){i.setDisposable(new b(t,e.subscribe(n)))})),i})},We.create=We.createWithDisposable=function(t){return new Be(t)},We.defer=function(t){return new Be(function(e){var n;try{n=t()}catch(r){return Me(r).subscribe(e)}return n.subscribe(e)})};var ke=We.empty=function(t){return t||(t=le),new Be(function(e){return t.schedule(function(){e.onCompleted()})})},Ie=We.fromArray=function(t,e){return e||(e=fe),new Be(function(n){var r=0;return e.scheduleRecursive(function(e){t.length>r?(n.onNext(t[r++]),e()):n.onCompleted()})})};We.generate=function(t,n,r,i,o){return o||(o=fe),new Be(function(s){var u=!0,c=t;return o.scheduleRecursive(function(t){var o,a;try{u?u=!1:c=r(c),o=n(c),o&&(a=i(c))}catch(h){return s.onError(h),e}o?(s.onNext(a),t()):s.onCompleted()})})};var qe=We.never=function(){return new Be(function(){return ee})};We.range=function(t,e,n){return n||(n=fe),new Be(function(r){return n.scheduleRecursiveWithState(0,function(n,i){e>n?(r.onNext(t+n),i(n+1)):r.onCompleted()})})},We.repeat=function(t,e,n){return n||(n=fe),null==e&&(e=-1),Pe(t,n).repeat(e)};var Pe=We["return"]=We.returnValue=function(t,e){return e||(e=le),new Be(function(n){return e.schedule(function(){n.onNext(t),n.onCompleted()})})},Me=We["throw"]=We.throwException=function(t,e){return e||(e=le),new Be(function(n){return e.schedule(function(){n.onError(t)})})};We.using=function(t,e){return new Be(function(n){var r,i,o=ee;try{r=t(),r&&(o=r),i=e(r)}catch(s){return new Y(Me(s).subscribe(n),o)}return new Y(i.subscribe(n),o)})},Se.amb=function(t){var e=this;return new Be(function(n){function r(){o||(o=s,a.dispose())}function i(){o||(o=u,c.dispose())}var o,s="L",u="R",c=new ne,a=new ne;return c.setDisposable(e.subscribe(function(t){r(),o===s&&n.onNext(t)},function(t){r(),o===s&&n.onError(t)},function(){r(),o===s&&n.onCompleted()})),a.setDisposable(t.subscribe(function(t){i(),o===u&&n.onNext(t)},function(t){i(),o===u&&n.onError(t)},function(){i(),o===u&&n.onCompleted()})),new Y(c,a)})},We.amb=function(){function t(t,e){return t.amb(e)}for(var e=qe(),n=p(arguments,0),r=0,i=n.length;i>r;r++)e=t(e,n[r]);return e},Se["catch"]=Se.catchException=function(t){return"function"==typeof t?v(this,t):Te([this,t])};var Te=We.catchException=We["catch"]=function(){var t=p(arguments,0);return De(t).catchException()};Se.combineLatest=function(){var t=V.call(arguments);return Array.isArray(t[0])?t[0].unshift(this):t.unshift(this),Le.apply(this,t)};var Le=We.combineLatest=function(){var t=V.call(arguments),n=t.pop();return Array.isArray(t[0])&&(t=t[0]),new Be(function(i){function o(t){var o;if(a[t]=!0,h||(h=a.every(r))){try{o=n.apply(null,f)}catch(s){return i.onError(s),e}i.onNext(o)}else l.filter(function(e,n){return n!==t}).every(r)&&i.onCompleted()}function s(t){l[t]=!0,l.every(r)&&i.onCompleted()}for(var u=function(){return!1},c=t.length,a=d(c,u),h=!1,l=d(c,u),f=Array(c),p=Array(c),b=0;c>b;b++)(function(e){p[e]=new ne,p[e].setDisposable(t[e].subscribe(function(t){f[e]=t,o(e)},i.onError.bind(i),function(){s(e)}))})(b);return new Y(p)})};Se.concat=function(){var t=V.call(arguments,0);return t.unshift(this),ze.apply(this,t)};var ze=We.concat=function(){var t=p(arguments,0);return De(t).concat()};Se.concatObservable=Se.concatAll=function(){return this.merge(1)},Se.merge=function(t){if("number"!=typeof t)return Fe(this,t);var e=this;return new Be(function(n){var r=0,i=new Y,o=!1,s=[],u=function(t){var e=new ne;i.add(e),e.setDisposable(t.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){var t;i.remove(e),s.length>0?(t=s.shift(),u(t)):(r--,o&&0===r&&n.onCompleted())}))};return i.add(e.subscribe(function(e){t>r?(r++,u(e)):s.push(e)},n.onError.bind(n),function(){o=!0,0===r&&n.onCompleted()})),i})};var Fe=We.merge=function(){var t,e;return arguments[0]?arguments[0].now?(t=arguments[0],e=V.call(arguments,1)):(t=le,e=V.call(arguments,0)):(t=le,e=V.call(arguments,1)),Array.isArray(e[0])&&(e=e[0]),Ie(e,t).mergeObservable()};Se.mergeObservable=Se.mergeAll=function(){var t=this;return new Be(function(e){var n=new Y,r=!1,i=new ne;return n.add(i),i.setDisposable(t.subscribe(function(t){var i=new ne;n.add(i),i.setDisposable(t.subscribe(function(t){e.onNext(t)},e.onError.bind(e),function(){n.remove(i),r&&1===n.length&&e.onCompleted()}))},e.onError.bind(e),function(){r=!0,1===n.length&&e.onCompleted()})),n})},Se.onErrorResumeNext=function(t){if(!t)throw Error("Second observable is required");return Ve([this,t])};var Ve=We.onErrorResumeNext=function(){var t=p(arguments,0);return new Be(function(e){var n=0,r=new ie,i=le.scheduleRecursive(function(i){var o,s;t.length>n?(o=t[n++],s=new ne,r.setDisposable(s),s.setDisposable(o.subscribe(e.onNext.bind(e),function(){i()},function(){i()}))):e.onCompleted()});return new Y(r,i)})};Se.skipUntil=function(t){var e=this;return new Be(function(n){var r=!1,i=new Y(e.subscribe(function(t){r&&n.onNext(t)},n.onError.bind(n),function(){r&&n.onCompleted()})),o=new ne;return i.add(o),o.setDisposable(t.subscribe(function(){r=!0,o.dispose()},n.onError.bind(n),function(){o.dispose()})),i})},Se["switch"]=Se.switchLatest=function(){var t=this;return new Be(function(e){var n=!1,r=new ie,i=!1,o=0,s=t.subscribe(function(t){var s=new ne,u=++o;n=!0,r.setDisposable(s),s.setDisposable(t.subscribe(function(t){o===u&&e.onNext(t)},function(t){o===u&&e.onError(t)},function(){o===u&&(n=!1,i&&e.onCompleted())}))},e.onError.bind(e),function(){i=!0,n||e.onCompleted()});return new Y(s,r)})},Se.takeUntil=function(t){var e=this;return new Be(function(r){return new Y(e.subscribe(r),t.subscribe(r.onCompleted.bind(r),r.onError.bind(r),n))})},Se.zip=function(){if(Array.isArray(arguments[0]))return m.apply(this,arguments);var t=this,n=V.call(arguments),i=n.pop();return n.unshift(t),new Be(function(o){function s(t){a[t]=!0,a.every(function(t){return t})&&o.onCompleted()}for(var u=n.length,c=d(u,function(){return[]}),a=d(u,function(){return!1}),h=function(n){var s,u;if(c.every(function(t){return t.length>0})){try{u=c.map(function(t){return t.shift()}),s=i.apply(t,u)}catch(h){return o.onError(h),e}o.onNext(s)}else a.filter(function(t,e){return e!==n}).every(r)&&o.onCompleted()},l=Array(u),f=0;u>f;f++)(function(t){l[t]=new ne,l[t].setDisposable(n[t].subscribe(function(e){c[t].push(e),h(t)},o.onError.bind(o),function(){s(t)}))})(f);return new Y(l)})},We.zip=function(){var t=V.call(arguments,0),e=t.shift();return e.zip.apply(e,t)},We.zipArray=function(){var t=V.call(arguments);return new Be(function(n){function i(t){if(u.every(function(t){return t.length>0})){var i=u.map(function(t){return t.shift()});n.onNext(i)}else if(c.filter(function(e,n){return n!==t}).every(r))return n.onCompleted(),e}function o(t){return c[t]=!0,c.every(r)?(n.onCompleted(),e):e}for(var s=t.length,u=d(s,function(){return[]}),c=d(s,function(){return!1}),a=Array(s),h=0;s>h;h++)(function(e){a[e]=new ne,a[e].setDisposable(t[e].subscribe(function(t){u[e].push(t),i(e)},n.onError.bind(n),function(){o(e)}))})(h);var l=new Y(a);return l.add(te(function(){for(var t=0,e=u.length;e>t;t++)u[t]=[]})),l})},Se.asObservable=function(){var t=this;return new Be(function(e){return t.subscribe(e)})},Se.bufferWithCount=function(t,e){return 1===arguments.length&&(e=t),this.windowWithCount(t,e).selectMany(function(t){return t.toArray()}).where(function(t){return t.length>0})},Se.dematerialize=function(){var t=this;return new Be(function(e){return t.subscribe(function(t){return t.accept(e)},e.onError.bind(e),e.onCompleted.bind(e))})},Se.distinctUntilChanged=function(t,n){var o=this;return t||(t=r),n||(n=i),new Be(function(r){var i,s=!1;return o.subscribe(function(o){var u,c=!1;try{u=t(o)}catch(a){return r.onError(a),e}if(s)try{c=n(i,u)}catch(a){return r.onError(a),e}s&&c||(s=!0,i=u,r.onNext(o))},r.onError.bind(r),r.onCompleted.bind(r))})},Se["do"]=Se.doAction=function(t,e,n){var r,i=this;return"function"==typeof t?r=t:(r=t.onNext.bind(t),e=t.onError.bind(t),n=t.onCompleted.bind(t)),new Be(function(t){return i.subscribe(function(e){try{r(e)}catch(n){t.onError(n)}t.onNext(e)},function(n){if(e){try{e(n)}catch(r){t.onError(r)}t.onError(n)}else t.onError(n)},function(){if(n){try{n()}catch(e){t.onError(e)}t.onCompleted()}else t.onCompleted()})})},Se["finally"]=Se.finallyAction=function(t){var e=this;return new Be(function(n){var r=e.subscribe(n);return te(function(){try{r.dispose()}catch(e){throw e}finally{t()}})})},Se.ignoreElements=function(){var t=this;return new Be(function(e){return t.subscribe(n,e.onError.bind(e),e.onCompleted.bind(e))})},Se.materialize=function(){var t=this;return new Be(function(e){return t.subscribe(function(t){e.onNext(ve(t))},function(t){e.onNext(me(t)),e.onCompleted()},function(){e.onNext(ye()),e.onCompleted()})})},Se.repeat=function(t){return xe(this,t).concat()},Se.retry=function(t){return xe(this,t).catchException()},Se.scan=function(){var t,n,r=!1,i=this;return 2===arguments.length?(r=!0,t=arguments[0],n=arguments[1]):n=arguments[0],new Be(function(o){var s,u,c;return i.subscribe(function(i){try{c||(c=!0),s?u=n(u,i):(u=r?n(t,i):i,s=!0)}catch(a){return o.onError(a),e}o.onNext(u)},o.onError.bind(o),function(){!c&&r&&o.onNext(t),o.onCompleted()})})},Se.skipLast=function(t){var e=this;return new Be(function(n){var r=[]; | ||
return e.subscribe(function(e){r.push(e),r.length>t&&n.onNext(r.shift())},n.onError.bind(n),n.onCompleted.bind(n))})},Se.startWith=function(){var t,e,n=0;return arguments.length&&"now"in Object(arguments[0])?(e=arguments[0],n=1):e=le,t=V.call(arguments,n),De([Ie(t,e),this]).concat()},Se.takeLast=function(t,e){return this.takeLastBuffer(t).selectMany(function(t){return Ie(t,e)})},Se.takeLastBuffer=function(t){var e=this;return new Be(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&r.shift()},n.onError.bind(n),function(){n.onNext(r),n.onCompleted()})})},Se.windowWithCount=function(t,e){var n=this;if(0>=t)throw Error(A);if(1===arguments.length&&(e=t),0>=e)throw Error(A);return new Be(function(r){var i=new ne,o=new se(i),s=0,u=[],c=function(){var t=new Ge;u.push(t),r.onNext(H(t,o))};return c(),i.setDisposable(n.subscribe(function(n){for(var r,i=0,o=u.length;o>i;i++)u[i].onNext(n);var a=s-t+1;a>=0&&0===a%e&&(r=u.shift(),r.onCompleted()),s++,0===s%e&&c()},function(t){for(;u.length>0;)u.shift().onError(t);r.onError(t)},function(){for(;u.length>0;)u.shift().onCompleted();r.onCompleted()})),o})},Se.defaultIfEmpty=function(t){var n=this;return t===e&&(t=null),new Be(function(e){var r=!1;return n.subscribe(function(t){r=!0,e.onNext(t)},e.onError.bind(e),function(){r||e.onNext(t),e.onCompleted()})})},Se.distinct=function(t,n){var i=this;return t||(t=r),n||(n=s),new Be(function(r){var o={};return i.subscribe(function(i){var s,u,c,a=!1;try{s=t(i),u=n(s)}catch(h){return r.onError(h),e}for(c in o)if(u===c){a=!0;break}a||(o[u]=null,r.onNext(i))},r.onError.bind(r),r.onCompleted.bind(r))})},Se.groupBy=function(t,e,n){return this.groupByUntil(t,e,function(){return qe()},n)},Se.groupByUntil=function(t,i,o,u){var c=this;return i||(i=r),u||(u=s),new Be(function(r){var s={},a=new Y,h=new se(a);return a.add(c.subscribe(function(c){var l,f,p,d,b,v,m,y,g,w;try{v=t(c),m=u(v)}catch(E){for(w in s)s[w].onError(E);return r.onError(E),e}d=!1;try{g=s[m],g||(g=new Ge,s[m]=g,d=!0)}catch(E){for(w in s)s[w].onError(E);return r.onError(E),e}if(d){b=new He(v,g,h),f=new He(v,g);try{l=o(f)}catch(E){for(w in s)s[w].onError(E);return r.onError(E),e}r.onNext(b),y=new ne,a.add(y);var x=function(){m in s&&(delete s[m],g.onCompleted()),a.remove(y)};y.setDisposable(l.take(1).subscribe(n,function(t){for(w in s)s[w].onError(t);r.onError(t)},function(){x()}))}try{p=i(c)}catch(E){for(w in s)s[w].onError(E);return r.onError(E),e}g.onNext(p)},function(t){for(var e in s)s[e].onError(t);r.onError(t)},function(){for(var t in s)s[t].onCompleted();r.onCompleted()})),h})},Se.select=Se.map=function(t,n){var r=this;return new Be(function(i){var o=0;return r.subscribe(function(s){var u;try{u=t.call(n,s,o++,r)}catch(c){return i.onError(c),e}i.onNext(u)},i.onError.bind(i),i.onCompleted.bind(i))})},Se.pluck=function(t){return this.select(function(e){return e[t]})},Se.selectMany=Se.flatMap=function(t,e){return e?this.selectMany(function(n){return t(n).select(function(t){return e(n,t)})}):"function"==typeof t?y.call(this,t):y.call(this,function(){return t})},Se.selectSwitch=Se.flatMapLatest=function(t,e){return this.select(t,e).switchLatest()},Se.skip=function(t){if(0>t)throw Error(A);var e=this;return new Be(function(n){var r=t;return e.subscribe(function(t){0>=r?n.onNext(t):r--},n.onError.bind(n),n.onCompleted.bind(n))})},Se.skipWhile=function(t,n){var r=this;return new Be(function(i){var o=0,s=!1;return r.subscribe(function(u){if(!s)try{s=!t.call(n,u,o++,r)}catch(c){return i.onError(c),e}s&&i.onNext(u)},i.onError.bind(i),i.onCompleted.bind(i))})},Se.take=function(t,e){if(0>t)throw Error(A);if(0===t)return ke(e);var n=this;return new Be(function(e){var r=t;return n.subscribe(function(t){r>0&&(r--,e.onNext(t),0===r&&e.onCompleted())},e.onError.bind(e),e.onCompleted.bind(e))})},Se.takeWhile=function(t,n){var r=this;return new Be(function(i){var o=0,s=!0;return r.subscribe(function(u){if(s){try{s=t.call(n,u,o++,r)}catch(c){return i.onError(c),e}s?i.onNext(u):i.onCompleted()}},i.onError.bind(i),i.onCompleted.bind(i))})},Se.where=Se.filter=function(t,n){var r=this;return new Be(function(i){var o=0;return r.subscribe(function(s){var u;try{u=t.call(n,s,o++,r)}catch(c){return i.onError(c),e}u&&i.onNext(s)},i.onError.bind(i),i.onCompleted.bind(i))})};var Be=x.Internals.AnonymousObservable=function(t){function n(t){return t===e?t=ee:"function"==typeof t&&(t=te(t)),t}function r(i){function o(t){var e=new Ue(t);if(fe.scheduleRequired())fe.schedule(function(){try{e.setDisposable(n(i(e)))}catch(t){if(!e.fail(t))throw t}});else try{e.setDisposable(n(i(e)))}catch(r){if(!e.fail(r))throw r}return e}return this instanceof r?(t.call(this,o),e):new r(i)}return B(r,t),r}(We),Ue=function(t){function e(e){t.call(this),this.observer=e,this.m=new ne}B(e,t);var n=e.prototype;return n.next=function(t){var e=!1;try{this.observer.onNext(t),e=!0}catch(n){throw n}finally{e||this.dispose()}},n.error=function(t){try{this.observer.onError(t)}catch(e){throw e}finally{this.dispose()}},n.completed=function(){try{this.observer.onCompleted()}catch(t){throw t}finally{this.dispose()}},n.setDisposable=function(t){this.m.setDisposable(t)},n.getDisposable=function(){return this.m.getDisposable()},n.disposable=function(t){return arguments.length?this.getDisposable():setDisposable(t)},n.dispose=function(){t.prototype.dispose.call(this),this.m.dispose()},e}(_e),He=function(t){function e(t){return this.underlyingObservable.subscribe(t)}function n(n,r,i){t.call(this,e),this.key=n,this.underlyingObservable=i?new Be(function(t){return new Y(i.getDisposable(),r.subscribe(t))}):r}return B(n,t),n}(We),Qe=function(t,e){this.subject=t,this.observer=e};Qe.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1),this.observer=null}};var Ge=x.Subject=function(t){function e(t){return c.call(this),this.isStopped?this.exception?(t.onError(this.exception),ee):(t.onCompleted(),ee):(this.observers.push(t),new Qe(this,t))}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return B(n,t),U(n.prototype,Ce,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(c.call(this),!this.isStopped){var t=this.observers.slice(0);this.isStopped=!0;for(var e=0,n=t.length;n>e;e++)t[e].onCompleted();this.observers=[]}},onError:function(t){if(c.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){if(c.call(this),!this.isStopped)for(var e=this.observers.slice(0),n=0,r=e.length;r>n;n++)e[n].onNext(t)},dispose:function(){this.isDisposed=!0,this.observers=null}}),n.create=function(t,e){return new Je(t,e)},n}(We);x.AsyncSubject=function(t){function e(t){if(c.call(this),!this.isStopped)return this.observers.push(t),new Qe(this,t);var e=this.exception,n=this.hasValue,r=this.value;return e?t.onError(e):n?(t.onNext(r),t.onCompleted()):t.onCompleted(),ee}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return B(n,t),U(n.prototype,Ce,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){var t,e,n;if(c.call(this),!this.isStopped){var r=this.observers.slice(0);this.isStopped=!0;var i=this.value,o=this.hasValue;if(o)for(e=0,n=r.length;n>e;e++)t=r[e],t.onNext(i),t.onCompleted();else for(e=0,n=r.length;n>e;e++)r[e].onCompleted();this.observers=[]}},onError:function(t){if(c.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){c.call(this),this.isStopped||(this.value=t,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),n}(We);var Je=function(t){function e(t){return this.observable.subscribe(t)}function n(n,r){t.call(this,e),this.observer=n,this.observable=r}return B(n,t),U(n.prototype,Ce,{onCompleted:function(){this.observer.onCompleted()},onError:function(t){this.observer.onError(t)},onNext:function(t){this.observer.onNext(t)}}),n}(We);return"function"==typeof define&&"object"==typeof define.amd&&define.amd?(t.Rx=x,define(function(){return x})):(g?"object"==typeof module&&module&&module.exports==g?module.exports=x:g=x:t.Rx=x,e)})(this); | ||
(function(a){function b(){}function c(a){return a}function d(a,b){return R(a,b)}function e(a,b){return a-b}function f(a){return a.toString()}function g(a){throw a}function h(){if(this.isDisposed)throw new Error(D)}function i(a){return"function"!=typeof a.toString&&"string"==typeof(a+"")}function j(a){return a&&"object"==typeof a?N.call(a)==E:!1}function k(a){return"function"==typeof a}function l(a,b,c,d){var e;if(a===b)return 0!==a||1/a==1/b;var f=typeof a,g=typeof b;if(!(a!==a||a&&s[f]||b&&s[g]))return!1;if(null==a||null==b)return a===b;var h=N.call(a),m=N.call(b);if(h==E&&(h=K),m==E&&(m=K),h!=m)return!1;switch(h){case G:case H:return+a==+b;case J:return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case L:case M:return a==String(b)}var n=h==F;if(!n){if(h!=K||!y&&(i(a)||i(b)))return!1;var o=!P&&j(a)?Object:a.constructor,p=!P&&j(b)?Object:b.constructor;if(o!=p&&!(k(o)&&o instanceof o&&k(p)&&p instanceof p))return!1}for(var q=c.length;q--;)if(c[q]==a)return d[q]==b;var r=0;if(e=!0,c.push(a),d.push(b),n){for(q=a.length,r=b.length,e=r==a.length;r--;){var t=b[r];if(!(e=l(a[r],t,c,d)))break}return e}for(var u in b)if(O.call(b,u))return r++,e=O.call(a,u)&&l(a[u],b[u],c,d);if(e)for(var u in a)if(O.call(a,u))return e=--r>-1;return c.pop(),d.pop(),e}function m(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:S.call(a)}function n(a,b){for(var c=new Array(a),d=0;a>d;d++)c[d]=b();return c}function o(a,b){this.scheduler=a,this.disposable=b,this.isDisposed=!1}function p(a,b){return new Vb(function(c){var d=new fb,e=new gb;return e.setDisposable(d),d.setDisposable(a.subscribe(c.onNext.bind(c),function(a){var d,f;try{f=b(a)}catch(g){return c.onError(g),void 0}d=new fb,e.setDisposable(d),d.setDisposable(f.subscribe(c))},c.onCompleted.bind(c))),e})}function q(a,b){var c=this;return new Vb(function(d){var e=0,f=a.length;return c.subscribe(function(c){if(f>e){var g,h=a[e++];try{g=b(c,h)}catch(i){return d.onError(i),void 0}d.onNext(g)}else d.onCompleted()},d.onError.bind(d),d.onCompleted.bind(d))})}function r(a){return this.select(a).mergeObservable()}var s={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},t=s[typeof window]&&window||this,u=s[typeof exports]&&exports&&!exports.nodeType&&exports,v=s[typeof module]&&module&&!module.nodeType&&module,w=v&&v.exports===u&&u,x=s[typeof global]&&global;!x||x.global!==x&&x.window!==x||(t=x);var y,z={Internals:{}},A=function(){return Date.now?Date.now:function(){return+new Date}}(),B="Sequence contains no elements.",C="Argument out of range",D="Object has been disposed",s={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},E="[object Arguments]",F="[object Array]",G="[object Boolean]",H="[object Date]",I="[object Function]",J="[object Number]",K="[object Object]",L="[object RegExp]",M="[object String]",N=Object.prototype.toString,O=Object.prototype.hasOwnProperty,P=N.call(arguments)==E;try{y=!(N.call(document)==K&&!({toString:0}+""))}catch(Q){y=!0}P||(j=function(a){return a&&"object"==typeof a?O.call(a,"callee"):!1}),k(/x/)&&(k=function(a){return"function"==typeof a&&N.call(a)==I});var R=z.Internals.isEqual=function(a,b){return l(a,b,[],[])},S=Array.prototype.slice;({}).hasOwnProperty;var T=this.inherits=z.Internals.inherits=function(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c},U=z.Internals.addProperties=function(a){for(var b=S.call(arguments,1),c=0,d=b.length;d>c;c++){var e=b[c];for(var f in e)a[f]=e[f]}},V=z.Internals.addRef=function(a,b){return new Vb(function(c){return new _(b.getDisposable(),a.subscribe(c))})};Function.prototype.bind||(Function.prototype.bind=function(a){var b=this,c=S.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(S.call(arguments)));return Object(g)===g?g:f}return b.apply(a,c.concat(S.call(arguments)))};return d});var W=Object("a"),X="a"!=W[0]||!(0 in W);Array.prototype.every||(Array.prototype.every=function(a){var b=Object(this),c=X&&"[object String]"=={}.toString.call(this)?this.split(""):b,d=c.length>>>0,e=arguments[1];if("[object Function]"!={}.toString.call(a))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=X&&"[object String]"=={}.toString.call(this)?this.split(""):b,d=c.length>>>0,e=Array(d),f=arguments[1];if("[object Function]"!={}.toString.call(a))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"[object Array]"==Object.prototype.toString.call(a)}),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});var Y=function(a,b){this.id=a,this.value=b};Y.prototype.compareTo=function(a){var b=this.value.compareTo(a.value);return 0===b&&(b=this.id-a.id),b};var Z=z.Internals.PriorityQueue=function(a){this.items=new Array(a),this.length=0},$=Z.prototype;$.isHigherPriority=function(a,b){return this.items[a].compareTo(this.items[b])<0},$.percolate=function(a){if(!(a>=this.length||0>a)){var b=a-1>>1;if(!(0>b||b===a)&&this.isHigherPriority(a,b)){var c=this.items[a];this.items[a]=this.items[b],this.items[b]=c,this.percolate(b)}}},$.heapify=function(b){if(b===a&&(b=0),!(b>=this.length||0>b)){var c=2*b+1,d=2*b+2,e=b;if(c<this.length&&this.isHigherPriority(c,e)&&(e=c),d<this.length&&this.isHigherPriority(d,e)&&(e=d),e!==b){var f=this.items[b];this.items[b]=this.items[e],this.items[e]=f,this.heapify(e)}}},$.peek=function(){return this.items[0].value},$.removeAt=function(a){this.items[a]=this.items[--this.length],delete this.items[this.length],this.heapify()},$.dequeue=function(){var a=this.peek();return this.removeAt(0),a},$.enqueue=function(a){var b=this.length++;this.items[b]=new Y(Z.count++,a),this.percolate(b)},$.remove=function(a){for(var b=0;b<this.length;b++)if(this.items[b].value===a)return this.removeAt(b),!0;return!1},Z.count=0;var _=z.CompositeDisposable=function(){this.disposables=m(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},ab=_.prototype;ab.add=function(a){this.isDisposed?a.dispose():(this.disposables.push(a),this.length++)},ab.remove=function(a){var b=!1;if(!this.isDisposed){var c=this.disposables.indexOf(a);-1!==c&&(b=!0,this.disposables.splice(c,1),this.length--,a.dispose())}return b},ab.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.disposables.slice(0);this.disposables=[],this.length=0;for(var b=0,c=a.length;c>b;b++)a[b].dispose()}},ab.clear=function(){var a=this.disposables.slice(0);this.disposables=[],this.length=0;for(var b=0,c=a.length;c>b;b++)a[b].dispose()},ab.contains=function(a){return-1!==this.disposables.indexOf(a)},ab.toArray=function(){return this.disposables.slice(0)};var bb=z.Disposable=function(a){this.isDisposed=!1,this.action=a||b};bb.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var cb=bb.create=function(a){return new bb(a)},db=bb.empty={dispose:b},eb=function(){function a(a){this.isSingle=a,this.isDisposed=!1,this.current=null}var b=a.prototype;return b.getDisposable=function(){return this.current},b.setDisposable=function(a){if(this.current&&this.isSingle)throw new Error("Disposable has already been assigned");var b,c=this.isDisposed;c||(b=this.current,this.current=a),b&&b.dispose(),c&&a&&a.dispose()},b.dispose=function(){var a;this.isDisposed||(this.isDisposed=!0,a=this.current,this.current=null),a&&a.dispose()},a}(),fb=z.SingleAssignmentDisposable=function(a){function b(){a.call(this,!0)}return T(b,a),b}(eb),gb=z.SerialDisposable=function(a){function b(){a.call(this,!1)}return T(b,a),b}(eb),hb=z.RefCountDisposable=function(){function a(a){this.disposable=a,this.disposable.count++,this.isInnerDisposed=!1}function b(a){this.underlyingDisposable=a,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return a.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},b.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},b.prototype.getDisposable=function(){return this.isDisposed?db:new a(this)},b}();o.prototype.dispose=function(){var a=this;this.scheduler.schedule(function(){a.isDisposed||(a.isDisposed=!0,a.disposable.dispose())})};var ib=z.Internals.ScheduledItem=function(a,b,c,d,f){this.scheduler=a,this.state=b,this.action=c,this.dueTime=d,this.comparer=f||e,this.disposable=new fb};ib.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},ib.prototype.compareTo=function(a){return this.comparer(this.dueTime,a.dueTime)},ib.prototype.isCancelled=function(){return this.disposable.isDisposed},ib.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var jb=z.Scheduler=function(){function a(a,b,c,d){this.now=a,this._schedule=b,this._scheduleRelative=c,this._scheduleAbsolute=d}function b(a,b){var c=b.first,d=b.second,e=new _,f=function(b){d(b,function(b){var c=!1,d=!1,g=a.scheduleWithState(b,function(a,b){return c?e.remove(g):d=!0,f(b),db});d||(e.add(g),c=!0)})};return f(c),e}function c(a,b,c){var d=b.first,e=b.second,f=new _,g=function(b){e(b,function(b,d){var e=!1,h=!1,i=a[c].call(a,b,d,function(a,b){return e?f.remove(i):h=!0,g(b),db});h||(f.add(i),e=!0)})};return g(d),f}function d(a,b){return b(),db}var e=a.prototype;return e.catchException=e["catch"]=function(a){return new sb(this,a)},e.schedulePeriodic=function(a,b){return this.schedulePeriodicWithState(null,a,function(){b()})},e.schedulePeriodicWithState=function(a,b,c){var d=a,e=setInterval(function(){d=c(d)},b);return cb(function(){clearInterval(e)})},e.schedule=function(a){return this._schedule(a,d)},e.scheduleWithState=function(a,b){return this._schedule(a,b)},e.scheduleWithRelative=function(a,b){return this._scheduleRelative(b,a,d)},e.scheduleWithRelativeAndState=function(a,b,c){return this._scheduleRelative(a,b,c)},e.scheduleWithAbsolute=function(a,b){return this._scheduleAbsolute(b,a,d)},e.scheduleWithAbsoluteAndState=function(a,b,c){return this._scheduleAbsolute(a,b,c)},e.scheduleRecursive=function(a){return this.scheduleRecursiveWithState(a,function(a,b){a(function(){b(a)})})},e.scheduleRecursiveWithState=function(a,c){return this.scheduleWithState({first:a,second:c},function(a,c){return b(a,c)})},e.scheduleRecursiveWithRelative=function(a,b){return this.scheduleRecursiveWithRelativeAndState(b,a,function(a,b){a(function(c){b(a,c)})})},e.scheduleRecursiveWithRelativeAndState=function(a,b,d){return this._scheduleRelative({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithRelativeAndState")})},e.scheduleRecursiveWithAbsolute=function(a,b){return this.scheduleRecursiveWithAbsoluteAndState(b,a,function(a,b){a(function(c){b(a,c)})})},e.scheduleRecursiveWithAbsoluteAndState=function(a,b,d){return this._scheduleAbsolute({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithAbsoluteAndState")})},a.now=A,a.normalize=function(a){return 0>a&&(a=0),a},a}(),kb=jb.normalize;z.Internals.SchedulePeriodicRecursive=function(){function a(a,b){b(0,this._period);try{this._state=this._action(this._state)}catch(c){throw this._cancel.dispose(),c}}function b(a,b,c,d){this._scheduler=a,this._state=b,this._period=c,this._action=d}return b.prototype.start=function(){var b=new fb;return this._cancel=b,b.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,a.bind(this))),b},b}();var lb,mb=jb.immediate=function(){function a(a,b){return b(this,a)}function b(a,b,c){for(var d=kb(d);d-this.now()>0;);return c(this,a)}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new jb(A,a,b,c)}(),nb=jb.currentThread=function(){function a(){e=new Z(4)}function b(a,b){return this.scheduleWithRelativeAndState(a,0,b)}function c(b,c,d){var f,g=this.now()+kb(c),h=new ib(this,b,d,g);if(e)e.enqueue(h);else{f=new a;try{e.enqueue(h),f.run()}catch(i){throw i}finally{f.dispose()}}return h.disposable}function d(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}var e;a.prototype.dispose=function(){e=null},a.prototype.run=function(){for(var a;e.length>0;)if(a=e.dequeue(),!a.isCancelled()){for(;a.dueTime-jb.now()>0;);a.isCancelled()||a.invoke()}};var f=new jb(A,b,c,d);return f.scheduleRequired=function(){return null===e},f.ensureTrampoline=function(a){return null===e?this.schedule(a):a()},f}(),ob=RegExp("^"+String(N).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),pb="function"==typeof(pb=x&&w&&x.setImmediate)&&!ob.test(pb)&&pb,qb="function"==typeof(qb=x&&w&&x.clearImmediate)&&!ob.test(qb)&&qb,rb=b;!function(){function a(){if(!t.postMessage||t.importScripts)return!1;var a=!1,b=t.onmessage;return t.onmessage=function(){a=!0},t.postMessage("","*"),t.onmessage=b,a}function b(a){if("string"==typeof a.data&&a.data.substring(0,c.length)===c){var b=a.data.substring(c.length),e=d[b];e(),delete d[b]}}if("function"==typeof pb)lb=pb,rb=qb;else if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))lb=process.nextTick;else if(a()){var c="ms.rx.schedule"+Math.random(),d={},e=0;t.addEventListener?t.addEventListener("message",b,!1):t.attachEvent("onmessage",b,!1),lb=function(a){var b=e++;d[b]=a,t.postMessage(c+b,"*")}}else if(t.MessageChannel){var f=new t.MessageChannel,g={},h=0;f.port1.onmessage=function(a){var b=a.data,c=g[b];c(),delete g[b]},lb=function(a){var b=h++;g[b]=a,f.port2.postMessage(b)}}else"document"in t&&"onreadystatechange"in t.document.createElement("script")?lb=function(a){var b=t.document.createElement("script");b.onreadystatechange=function(){a(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},t.document.documentElement.appendChild(b)}:(lb=function(a){return setTimeout(a,0)},rb=clearTimeout)}(),jb.timeout=function(){function a(a,b){var c=this,d=new fb,e=lb(function(){d.isDisposed||d.setDisposable(b(c,a))});return new _(d,cb(function(){rb(e)}))}function b(a,b,c){var d=this,e=jb.normalize(b);if(0===e)return d.scheduleWithState(a,c);var f=new fb,g=setTimeout(function(){f.isDisposed||f.setDisposable(c(d,a))},e);return new _(f,cb(function(){clearTimeout(g)}))}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new jb(A,a,b,c)}();var sb=function(a){function b(){return this._scheduler.now()}function c(a,b){return this._scheduler.scheduleWithState(a,this._wrap(b))}function d(a,b,c){return this._scheduler.scheduleWithRelativeAndState(a,b,this._wrap(c))}function e(a,b,c){return this._scheduler.scheduleWithAbsoluteAndState(a,b,this._wrap(c))}function f(f,g){this._scheduler=f,this._handler=g,this._recursiveOriginal=null,this._recursiveWrapper=null,a.call(this,b,c,d,e)}return T(f,a),f.prototype._clone=function(a){return new f(a,this._handler)},f.prototype._wrap=function(a){var b=this;return function(c,d){try{return a(b._getRecursiveWrapper(c),d)}catch(e){if(!b._handler(e))throw e;return db}}},f.prototype._getRecursiveWrapper=function(a){if(this._recursiveOriginal!==a){this._recursiveOriginal=a;var b=this._clone(a);b._recursiveOriginal=a,b._recursiveWrapper=b,this._recursiveWrapper=b}return this._recursiveWrapper},f.prototype.schedulePeriodicWithState=function(a,b,c){var d=this,e=!1,f=new fb;return f.setDisposable(this._scheduler.schedulePeriodicWithState(a,b,function(a){if(e)return null;try{return c(a)}catch(b){if(e=!0,!d._handler(b))throw b;return f.dispose(),null}})),f},f}(jb),tb=z.Notification=function(){function a(a,b){this.hasValue=null==b?!1:b,this.kind=a}var b=a.prototype;return b.accept=function(a,b,c){return 1===arguments.length&&"object"==typeof a?this._acceptObservable(a):this._accept(a,b,c)},b.toObservable=function(a){var b=this;return a||(a=mb),new Vb(function(c){return a.schedule(function(){b._acceptObservable(c),"N"===b.kind&&c.onCompleted()})})},a}(),ub=tb.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 tb("N",!0);return e.value=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),vb=tb.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 tb("E");return e.exception=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),wb=tb.createOnCompleted=function(){function a(a,b,c){return c()}function b(a){return a.onCompleted()}function c(){return"OnCompleted()"}return function(){var d=new tb("C");return d._accept=a,d._acceptObservable=b,d.toString=c,d}}(),xb=z.Internals.Enumerator=function(a,b){this.moveNext=a,this.getCurrent=b},yb=xb.create=function(a,b){var c=!1;return new xb(function(){if(c)return!1;var b=a();return b||(c=!0),b},function(){return b()})},zb=z.Internals.Enumerable=function(a){this.getEnumerator=a};zb.prototype.concat=function(){var a=this;return new Vb(function(b){var c,d=a.getEnumerator(),e=new gb,f=mb.scheduleRecursive(function(a){var f,g;if(!c){try{g=d.moveNext(),g&&(f=d.getCurrent())}catch(h){return b.onError(h),void 0}if(!g)return b.onCompleted(),void 0;var i=new fb;e.setDisposable(i),i.setDisposable(f.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){a()}))}});return new _(e,f,cb(function(){c=!0}))})},zb.prototype.catchException=function(){var a=this;return new Vb(function(b){var c,d,e=a.getEnumerator(),f=new gb,g=mb.scheduleRecursive(function(a){var g,h;if(!c){try{h=e.moveNext(),h&&(g=e.getCurrent())}catch(i){return b.onError(i),void 0}if(!h)return d?b.onError(d):b.onCompleted(),void 0;var j=new fb;f.setDisposable(j),j.setDisposable(g.subscribe(b.onNext.bind(b),function(b){d=b,a()},b.onCompleted.bind(b)))}});return new _(f,g,cb(function(){c=!0}))})};var Ab=zb.repeat=function(a,b){return 1===arguments.length&&(b=-1),new zb(function(){var c,d=b;return yb(function(){return 0===d?!1:(d>0&&d--,c=a,!0)},function(){return c})})},Bb=zb.forEach=function(a,b,d){return b||(b=c),new zb(function(){var c,e=-1;return yb(function(){return++e<a.length?(c=b.call(d,a[e],e,a),!0):!1},function(){return c})})},Cb=z.Observer=function(){};Cb.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},Cb.prototype.asObserver=function(){return new Gb(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},Cb.prototype.checked=function(){return new Hb(this)};var Db=Cb.create=function(a,c,d){return a||(a=b),c||(c=g),d||(d=b),new Gb(a,c,d)};Cb.fromNotifier=function(a){return new Gb(function(b){return a(ub(b))},function(b){return a(vb(b))},function(){return a(wb())})},Cb.notifyOn=function(a){return new Jb(a,this)};var Eb,Fb=z.Internals.AbstractObserver=function(a){function b(){this.isStopped=!1,a.call(this)}return T(b,a),b.prototype.onNext=function(a){this.isStopped||this.next(a)},b.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.error(a))},b.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},b.prototype.dispose=function(){this.isStopped=!0},b.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.error(a),!0)},b}(Cb),Gb=z.AnonymousObserver=function(a){function b(b,c,d){a.call(this),this._onNext=b,this._onError=c,this._onCompleted=d}return T(b,a),b.prototype.next=function(a){this._onNext(a)},b.prototype.error=function(a){this._onError(a)},b.prototype.completed=function(){this._onCompleted()},b}(Fb),Hb=function(a){function b(b){a.call(this),this._observer=b,this._state=0}T(b,a);var c=b.prototype;return c.onNext=function(a){this.checkAccess();try{this._observer.onNext(a)}catch(b){throw b}finally{this._state=0}},c.onError=function(a){this.checkAccess();try{this._observer.onError(a)}catch(b){throw b}finally{this._state=2}},c.onCompleted=function(){this.checkAccess();try{this._observer.onCompleted()}catch(a){throw a}finally{this._state=2}},c.checkAccess=function(){if(1===this._state)throw new Error("Re-entrancy detected");if(2===this._state)throw new Error("Observer completed");0===this._state&&(this._state=1)},b}(Cb),Ib=z.Internals.ScheduledObserver=function(a){function b(b,c){a.call(this),this.scheduler=b,this.observer=c,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new gb}return T(b,a),b.prototype.next=function(a){var b=this;this.queue.push(function(){b.observer.onNext(a)})},b.prototype.error=function(a){var b=this;this.queue.push(function(){b.observer.onError(a)})},b.prototype.completed=function(){var a=this;this.queue.push(function(){a.observer.onCompleted()})},b.prototype.ensureActive=function(){var a=!1,b=this;!this.hasFaulted&&this.queue.length>0&&(a=!this.isAcquired,this.isAcquired=!0),a&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(a){var c;if(!(b.queue.length>0))return b.isAcquired=!1,void 0;c=b.queue.shift();try{c()}catch(d){throw b.queue=[],b.hasFaulted=!0,d}a()}))},b.prototype.dispose=function(){a.prototype.dispose.call(this),this.disposable.dispose()},b}(Fb),Jb=function(a){function b(){a.apply(this,arguments)}return T(b,a),b.prototype.next=function(b){a.prototype.next.call(this,b),this.ensureActive()},b.prototype.error=function(b){a.prototype.error.call(this,b),this.ensureActive()},b.prototype.completed=function(){a.prototype.completed.call(this),this.ensureActive()},b}(Ib),Kb=z.Observable=function(){function a(a){this._subscribe=a}return Eb=a.prototype,Eb.finalValue=function(){var a=this;return new Vb(function(b){var c,d=!1;return a.subscribe(function(a){d=!0,c=a},b.onError.bind(b),function(){d?(b.onNext(c),b.onCompleted()):b.onError(new Error(B))})})},Eb.subscribe=Eb.forEach=function(a,b,c){var d;return d="object"==typeof a?a:Db(a,b,c),this._subscribe(d)},Eb.toArray=function(){function a(a,b){var c=a.slice(0);return c.push(b),c}return this.scan([],a).startWith([]).finalValue()},a}();Eb.observeOn=function(a){var b=this;return new Vb(function(c){return b.subscribe(new Jb(a,c))})},Eb.subscribeOn=function(a){var b=this;return new Vb(function(c){var d=new fb,e=new gb;return e.setDisposable(d),d.setDisposable(a.schedule(function(){e.setDisposable(new o(a,b.subscribe(c)))})),e})},Kb.create=Kb.createWithDisposable=function(a){return new Vb(a)},Kb.defer=function(a){return new Vb(function(b){var c;try{c=a()}catch(d){return Pb(d).subscribe(b)}return c.subscribe(b)})};var Lb=Kb.empty=function(a){return a||(a=mb),new Vb(function(b){return a.schedule(function(){b.onCompleted()})})},Mb=Kb.fromArray=function(a,b){return b||(b=nb),new Vb(function(c){var d=0;return b.scheduleRecursive(function(b){d<a.length?(c.onNext(a[d++]),b()):c.onCompleted()})})};Kb.generate=function(a,b,c,d,e){return e||(e=nb),new Vb(function(f){var g=!0,h=a;return e.scheduleRecursive(function(a){var e,i;try{g?g=!1:h=c(h),e=b(h),e&&(i=d(h))}catch(j){return f.onError(j),void 0}e?(f.onNext(i),a()):f.onCompleted()})})};var Nb=Kb.never=function(){return new Vb(function(){return db})};Kb.range=function(a,b,c){return c||(c=nb),new Vb(function(d){return c.scheduleRecursiveWithState(0,function(c,e){b>c?(d.onNext(a+c),e(c+1)):d.onCompleted()})})},Kb.repeat=function(a,b,c){return c||(c=nb),null==b&&(b=-1),Ob(a,c).repeat(b)};var Ob=Kb["return"]=Kb.returnValue=function(a,b){return b||(b=mb),new Vb(function(c){return b.schedule(function(){c.onNext(a),c.onCompleted()})})},Pb=Kb["throw"]=Kb.throwException=function(a,b){return b||(b=mb),new Vb(function(c){return b.schedule(function(){c.onError(a)})})};Kb.using=function(a,b){return new Vb(function(c){var d,e,f=db;try{d=a(),d&&(f=d),e=b(d)}catch(g){return new _(Pb(g).subscribe(c),f)}return new _(e.subscribe(c),f)})},Eb.amb=function(a){var b=this;return new Vb(function(c){function d(){f||(f=g,j.dispose())}function e(){f||(f=h,i.dispose())}var f,g="L",h="R",i=new fb,j=new fb;return i.setDisposable(b.subscribe(function(a){d(),f===g&&c.onNext(a)},function(a){d(),f===g&&c.onError(a)},function(){d(),f===g&&c.onCompleted()})),j.setDisposable(a.subscribe(function(a){e(),f===h&&c.onNext(a)},function(a){e(),f===h&&c.onError(a)},function(){e(),f===h&&c.onCompleted()})),new _(i,j)})},Kb.amb=function(){function a(a,b){return a.amb(b)}for(var b=Nb(),c=m(arguments,0),d=0,e=c.length;e>d;d++)b=a(b,c[d]);return b},Eb["catch"]=Eb.catchException=function(a){return"function"==typeof a?p(this,a):Qb([this,a])};var Qb=Kb.catchException=Kb["catch"]=function(){var a=m(arguments,0);return Bb(a).catchException()};Eb.combineLatest=function(){var a=S.call(arguments);return Array.isArray(a[0])?a[0].unshift(this):a.unshift(this),Rb.apply(this,a)};var Rb=Kb.combineLatest=function(){var a=S.call(arguments),b=a.pop();return Array.isArray(a[0])&&(a=a[0]),new Vb(function(d){function e(a){var e;if(i[a]=!0,j||(j=i.every(c))){try{e=b.apply(null,l)}catch(f){return d.onError(f),void 0}d.onNext(e)}else k.filter(function(b,c){return c!==a}).every(c)&&d.onCompleted()}function f(a){k[a]=!0,k.every(c)&&d.onCompleted()}for(var g=function(){return!1},h=a.length,i=n(h,g),j=!1,k=n(h,g),l=new Array(h),m=new Array(h),o=0;h>o;o++)!function(b){m[b]=new fb,m[b].setDisposable(a[b].subscribe(function(a){l[b]=a,e(b)},d.onError.bind(d),function(){f(b)}))}(o);return new _(m)})};Eb.concat=function(){var a=S.call(arguments,0);return a.unshift(this),Sb.apply(this,a)};var Sb=Kb.concat=function(){var a=m(arguments,0);return Bb(a).concat()};Eb.concatObservable=Eb.concatAll=function(){return this.merge(1)},Eb.merge=function(a){if("number"!=typeof a)return Tb(this,a);var b=this;return new Vb(function(c){var d=0,e=new _,f=!1,g=[],h=function(a){var b=new fb;e.add(b),b.setDisposable(a.subscribe(c.onNext.bind(c),c.onError.bind(c),function(){var a;e.remove(b),g.length>0?(a=g.shift(),h(a)):(d--,f&&0===d&&c.onCompleted())}))};return e.add(b.subscribe(function(b){a>d?(d++,h(b)):g.push(b)},c.onError.bind(c),function(){f=!0,0===d&&c.onCompleted()})),e})};var Tb=Kb.merge=function(){var a,b;return arguments[0]?arguments[0].now?(a=arguments[0],b=S.call(arguments,1)):(a=mb,b=S.call(arguments,0)):(a=mb,b=S.call(arguments,1)),Array.isArray(b[0])&&(b=b[0]),Mb(b,a).mergeObservable()};Eb.mergeObservable=Eb.mergeAll=function(){var a=this;return new Vb(function(b){var c=new _,d=!1,e=new fb;return c.add(e),e.setDisposable(a.subscribe(function(a){var e=new fb;c.add(e),e.setDisposable(a.subscribe(function(a){b.onNext(a)},b.onError.bind(b),function(){c.remove(e),d&&1===c.length&&b.onCompleted()}))},b.onError.bind(b),function(){d=!0,1===c.length&&b.onCompleted()})),c})},Eb.onErrorResumeNext=function(a){if(!a)throw new Error("Second observable is required");return Ub([this,a])};var Ub=Kb.onErrorResumeNext=function(){var a=m(arguments,0);return new Vb(function(b){var c=0,d=new gb,e=mb.scheduleRecursive(function(e){var f,g;c<a.length?(f=a[c++],g=new fb,d.setDisposable(g),g.setDisposable(f.subscribe(b.onNext.bind(b),function(){e()},function(){e()}))):b.onCompleted()});return new _(d,e)})};Eb.skipUntil=function(a){var b=this;return new Vb(function(c){var d=!1,e=new _(b.subscribe(function(a){d&&c.onNext(a)},c.onError.bind(c),function(){d&&c.onCompleted()})),f=new fb;return e.add(f),f.setDisposable(a.subscribe(function(){d=!0,f.dispose()},c.onError.bind(c),function(){f.dispose()})),e})},Eb["switch"]=Eb.switchLatest=function(){var a=this;return new Vb(function(b){var c=!1,d=new gb,e=!1,f=0,g=a.subscribe(function(a){var g=new fb,h=++f;c=!0,d.setDisposable(g),g.setDisposable(a.subscribe(function(a){f===h&&b.onNext(a)},function(a){f===h&&b.onError(a)},function(){f===h&&(c=!1,e&&b.onCompleted())}))},b.onError.bind(b),function(){e=!0,c||b.onCompleted()});return new _(g,d)})},Eb.takeUntil=function(a){var c=this;return new Vb(function(d){return new _(c.subscribe(d),a.subscribe(d.onCompleted.bind(d),d.onError.bind(d),b))})},Eb.zip=function(){if(Array.isArray(arguments[0]))return q.apply(this,arguments);var a=this,b=S.call(arguments),d=b.pop();return b.unshift(a),new Vb(function(e){function f(a){i[a]=!0,i.every(function(a){return a})&&e.onCompleted()}for(var g=b.length,h=n(g,function(){return[]}),i=n(g,function(){return!1}),j=function(b){var f,g;if(h.every(function(a){return a.length>0})){try{g=h.map(function(a){return a.shift()}),f=d.apply(a,g)}catch(j){return e.onError(j),void 0}e.onNext(f)}else i.filter(function(a,c){return c!==b}).every(c)&&e.onCompleted()},k=new Array(g),l=0;g>l;l++)!function(a){k[a]=new fb,k[a].setDisposable(b[a].subscribe(function(b){h[a].push(b),j(a)},e.onError.bind(e),function(){f(a)}))}(l);return new _(k)})},Kb.zip=function(){var a=S.call(arguments,0),b=a.shift();return b.zip.apply(b,a)},Kb.zipArray=function(){var a=S.call(arguments);return new Vb(function(b){function d(a){if(g.every(function(a){return a.length>0})){var d=g.map(function(a){return a.shift()});b.onNext(d)}else if(h.filter(function(b,c){return c!==a}).every(c))return b.onCompleted(),void 0}function e(a){return h[a]=!0,h.every(c)?(b.onCompleted(),void 0):void 0}for(var f=a.length,g=n(f,function(){return[]}),h=n(f,function(){return!1}),i=new Array(f),j=0;f>j;j++)!function(c){i[c]=new fb,i[c].setDisposable(a[c].subscribe(function(a){g[c].push(a),d(c)},b.onError.bind(b),function(){e(c)}))}(j);var k=new _(i);return k.add(cb(function(){for(var a=0,b=g.length;b>a;a++)g[a]=[]})),k})},Eb.asObservable=function(){var a=this;return new Vb(function(b){return a.subscribe(b)})},Eb.bufferWithCount=function(a,b){return 1===arguments.length&&(b=a),this.windowWithCount(a,b).selectMany(function(a){return a.toArray()}).where(function(a){return a.length>0})},Eb.dematerialize=function(){var a=this;return new Vb(function(b){return a.subscribe(function(a){return a.accept(b)},b.onError.bind(b),b.onCompleted.bind(b))})},Eb.distinctUntilChanged=function(a,b){var e=this;return a||(a=c),b||(b=d),new Vb(function(c){var d,f=!1;return e.subscribe(function(e){var g,h=!1;try{g=a(e)}catch(i){return c.onError(i),void 0}if(f)try{h=b(d,g)}catch(i){return c.onError(i),void 0}f&&h||(f=!0,d=g,c.onNext(e))},c.onError.bind(c),c.onCompleted.bind(c))})},Eb["do"]=Eb.doAction=function(a,b,c){var d,e=this;return"function"==typeof a?d=a:(d=a.onNext.bind(a),b=a.onError.bind(a),c=a.onCompleted.bind(a)),new Vb(function(a){return e.subscribe(function(b){try{d(b)}catch(c){a.onError(c)}a.onNext(b)},function(c){if(b){try{b(c)}catch(d){a.onError(d)}a.onError(c)}else a.onError(c)},function(){if(c){try{c()}catch(b){a.onError(b)}a.onCompleted()}else a.onCompleted()})})},Eb["finally"]=Eb.finallyAction=function(a){var b=this;return new Vb(function(c){var d=b.subscribe(c);return cb(function(){try{d.dispose()}catch(b){throw b}finally{a()}})})},Eb.ignoreElements=function(){var a=this;return new Vb(function(c){return a.subscribe(b,c.onError.bind(c),c.onCompleted.bind(c))})},Eb.materialize=function(){var a=this;return new Vb(function(b){return a.subscribe(function(a){b.onNext(ub(a))},function(a){b.onNext(vb(a)),b.onCompleted()},function(){b.onNext(wb()),b.onCompleted()})})},Eb.repeat=function(a){return Ab(this,a).concat()},Eb.retry=function(a){return Ab(this,a).catchException()},Eb.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 Vb(function(e){var f,g,h;return d.subscribe(function(d){try{h||(h=!0),f?g=b(g,d):(g=c?b(a,d):d,f=!0)}catch(i){return e.onError(i),void 0}e.onNext(g)},e.onError.bind(e),function(){!h&&c&&e.onNext(a),e.onCompleted()})})},Eb.skipLast=function(a){var b=this;return new Vb(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))})},Eb.startWith=function(){var a,b,c=0;return arguments.length&&"now"in Object(arguments[0])?(b=arguments[0],c=1):b=mb,a=S.call(arguments,c),Bb([Mb(a,b),this]).concat()},Eb.takeLast=function(a,b){return this.takeLastBuffer(a).selectMany(function(a){return Mb(a,b)})},Eb.takeLastBuffer=function(a){var b=this;return new Vb(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()})})},Eb.windowWithCount=function(a,b){var c=this;if(0>=a)throw new Error(C);if(1===arguments.length&&(b=a),0>=b)throw new Error(C);return new Vb(function(d){var e=new fb,f=new hb(e),g=0,h=[],i=function(){var a=new Zb;h.push(a),d.onNext(V(a,f))};return i(),e.setDisposable(c.subscribe(function(c){for(var d,e=0,f=h.length;f>e;e++)h[e].onNext(c);var j=g-a+1;j>=0&&0===j%b&&(d=h.shift(),d.onCompleted()),g++,0===g%b&&i()},function(a){for(;h.length>0;)h.shift().onError(a);d.onError(a)},function(){for(;h.length>0;)h.shift().onCompleted();d.onCompleted()})),f})},Eb.defaultIfEmpty=function(b){var c=this;return b===a&&(b=null),new Vb(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()})})},Eb.distinct=function(a,b){var d=this;return a||(a=c),b||(b=f),new Vb(function(c){var e={};return d.subscribe(function(d){var f,g,h,i=!1;try{f=a(d),g=b(f)}catch(j){return c.onError(j),void 0}for(h in e)if(g===h){i=!0;break}i||(e[g]=null,c.onNext(d))},c.onError.bind(c),c.onCompleted.bind(c))})},Eb.groupBy=function(a,b,c){return this.groupByUntil(a,b,function(){return Nb()},c)},Eb.groupByUntil=function(a,d,e,g){var h=this;return d||(d=c),g||(g=f),new Vb(function(c){var f={},i=new _,j=new hb(i);return i.add(h.subscribe(function(h){var k,l,m,n,o,p,q,r,s,t;try{p=a(h),q=g(p)}catch(u){for(t in f)f[t].onError(u);return c.onError(u),void 0}n=!1;try{s=f[q],s||(s=new Zb,f[q]=s,n=!0)}catch(u){for(t in f)f[t].onError(u);return c.onError(u),void 0}if(n){o=new Xb(p,s,j),l=new Xb(p,s);try{k=e(l)}catch(u){for(t in f)f[t].onError(u);return c.onError(u),void 0}c.onNext(o),r=new fb,i.add(r);var v=function(){q in f&&(delete f[q],s.onCompleted()),i.remove(r)};r.setDisposable(k.take(1).subscribe(b,function(a){for(t in f)f[t].onError(a);c.onError(a)},function(){v()}))}try{m=d(h)}catch(u){for(t in f)f[t].onError(u);return c.onError(u),void 0}s.onNext(m)},function(a){for(var b in f)f[b].onError(a);c.onError(a)},function(){for(var a in f)f[a].onCompleted();c.onCompleted()})),j})},Eb.select=Eb.map=function(a,b){var c=this;return new Vb(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return d.onError(h),void 0}d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},Eb.pluck=function(a){return this.select(function(b){return b[a]})},Eb.selectMany=Eb.flatMap=function(a,b){return b?this.selectMany(function(c){return a(c).select(function(a){return b(c,a)})}):"function"==typeof a?r.call(this,a):r.call(this,function(){return a})},Eb.selectSwitch=Eb.flatMapLatest=function(a,b){return this.select(a,b).switchLatest()},Eb.skip=function(a){if(0>a)throw new Error(C);var b=this;return new Vb(function(c){var d=a;return b.subscribe(function(a){0>=d?c.onNext(a):d--},c.onError.bind(c),c.onCompleted.bind(c))})},Eb.skipWhile=function(a,b){var c=this;return new Vb(function(d){var e=0,f=!1;return c.subscribe(function(g){if(!f)try{f=!a.call(b,g,e++,c)}catch(h){return d.onError(h),void 0}f&&d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},Eb.take=function(a,b){if(0>a)throw new Error(C);if(0===a)return Lb(b);var c=this;return new Vb(function(b){var d=a;return c.subscribe(function(a){d>0&&(d--,b.onNext(a),0===d&&b.onCompleted())},b.onError.bind(b),b.onCompleted.bind(b))})},Eb.takeWhile=function(a,b){var c=this;return new Vb(function(d){var e=0,f=!0;return c.subscribe(function(g){if(f){try{f=a.call(b,g,e++,c)}catch(h){return d.onError(h),void 0}f?d.onNext(g):d.onCompleted()}},d.onError.bind(d),d.onCompleted.bind(d))})},Eb.where=Eb.filter=function(a,b){var c=this;return new Vb(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return d.onError(h),void 0}g&&d.onNext(f)},d.onError.bind(d),d.onCompleted.bind(d))})};var Vb=z.Internals.AnonymousObservable=function(a){function b(a){return"undefined"==typeof a?a=db:"function"==typeof a&&(a=cb(a)),a}function c(d){function e(a){var c=new Wb(a);if(nb.scheduleRequired())nb.schedule(function(){try{c.setDisposable(b(d(c)))}catch(a){if(!c.fail(a))throw a}});else try{c.setDisposable(b(d(c)))}catch(e){if(!c.fail(e))throw e}return c}return this instanceof c?(a.call(this,e),void 0):new c(d)}return T(c,a),c}(Kb),Wb=function(a){function b(b){a.call(this),this.observer=b,this.m=new fb}T(b,a);var c=b.prototype;return c.next=function(a){var b=!1;try{this.observer.onNext(a),b=!0}catch(c){throw c}finally{b||this.dispose()}},c.error=function(a){try{this.observer.onError(a)}catch(b){throw b}finally{this.dispose()}},c.completed=function(){try{this.observer.onCompleted()}catch(a){throw a}finally{this.dispose()}},c.setDisposable=function(a){this.m.setDisposable(a)},c.getDisposable=function(){return this.m.getDisposable()},c.disposable=function(a){return arguments.length?this.getDisposable():setDisposable(a)},c.dispose=function(){a.prototype.dispose.call(this),this.m.dispose()},b}(Fb),Xb=function(a){function b(a){return this.underlyingObservable.subscribe(a)}function c(c,d,e){a.call(this,b),this.key=c,this.underlyingObservable=e?new Vb(function(a){return new _(e.getDisposable(),d.subscribe(a))}):d}return T(c,a),c}(Kb),Yb=function(a,b){this.subject=a,this.observer=b};Yb.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 Zb=z.Subject=function(a){function b(a){return h.call(this),this.isStopped?this.exception?(a.onError(this.exception),db):(a.onCompleted(),db):(this.observers.push(a),new Yb(this,a))}function c(){a.call(this,b),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return T(c,a),U(c.prototype,Cb,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(h.call(this),!this.isStopped){var a=this.observers.slice(0);this.isStopped=!0;for(var b=0,c=a.length;c>b;b++)a[b].onCompleted();this.observers=[]}},onError:function(a){if(h.call(this),!this.isStopped){var b=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var c=0,d=b.length;d>c;c++)b[c].onError(a);this.observers=[]}},onNext:function(a){if(h.call(this),!this.isStopped)for(var b=this.observers.slice(0),c=0,d=b.length;d>c;c++)b[c].onNext(a)},dispose:function(){this.isDisposed=!0,this.observers=null}}),c.create=function(a,b){return new $b(a,b)},c}(Kb);z.AsyncSubject=function(a){function b(a){if(h.call(this),!this.isStopped)return this.observers.push(a),new Yb(this,a);var b=this.exception,c=this.hasValue,d=this.value;return b?a.onError(b):c?(a.onNext(d),a.onCompleted()):a.onCompleted(),db}function c(){a.call(this,b),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return T(c,a),U(c.prototype,Cb,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){var a,b,c;if(h.call(this),!this.isStopped){var d=this.observers.slice(0);this.isStopped=!0;var e=this.value,f=this.hasValue;if(f)for(b=0,c=d.length;c>b;b++)a=d[b],a.onNext(e),a.onCompleted();else for(b=0,c=d.length;c>b;b++)d[b].onCompleted();this.observers=[]}},onError:function(a){if(h.call(this),!this.isStopped){var b=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var c=0,d=b.length;d>c;c++)b[c].onError(a);this.observers=[]}},onNext:function(a){h.call(this),this.isStopped||(this.value=a,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),c}(Kb);var $b=function(a){function b(a){return this.observable.subscribe(a)}function c(c,d){a.call(this,b),this.observer=c,this.observable=d}return T(c,a),U(c.prototype,Cb,{onCompleted:function(){this.observer.onCompleted()},onError:function(a){this.observer.onError(a)},onNext:function(a){this.observer.onNext(a)}}),c}(Kb);"function"==typeof define&&"object"==typeof define.amd&&define.amd?(t.Rx=z,define(function(){return z})):u&&v?w?(v.exports=z).Rx=z:u.Rx=z:t.Rx=z}).call(this); |
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. | ||
(function (root, factory) { | ||
var freeExports = typeof exports == 'object' && exports, | ||
freeModule = typeof module == 'object' && module && module.exports == freeExports && module, | ||
freeGlobal = typeof global == 'object' && global; | ||
if (freeGlobal.global === freeGlobal) { | ||
window = freeGlobal; | ||
(function (factory) { | ||
var objectTypes = { | ||
'boolean': false, | ||
'function': true, | ||
'object': true, | ||
'number': false, | ||
'string': false, | ||
'undefined': false | ||
}; | ||
var root = (objectTypes[typeof window] && window) || this, | ||
freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports, | ||
freeModule = objectTypes[typeof module] && module && !module.nodeType && module, | ||
moduleExports = freeModule && freeModule.exports === freeExports && freeExports, | ||
freeGlobal = objectTypes[typeof global] && global; | ||
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) { | ||
root = freeGlobal; | ||
} | ||
@@ -22,3 +34,3 @@ | ||
} | ||
}(this, function (global, exp, Rx, undefined) { | ||
}.call(this, function (root, exp, Rx, undefined) { | ||
@@ -25,0 +37,0 @@ // Aliases |
@@ -1,1 +0,1 @@ | ||
(function(t,e){var n="object"==typeof exports&&exports,r=("object"==typeof module&&module&&module.exports==n&&module,"object"==typeof global&&global);r.global===r&&(window=r),"function"==typeof define&&define.amd?define(["rx","exports"],function(n,r){return t.Rx=e(t,r,n),t.Rx}):"object"==typeof module&&module&&module.exports===n?module.exports=e(t,module.exports,require("./rx")):t.Rx=e(t,{},t.Rx)})(this,function(t,e,n,r){function i(){}function o(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:x.call(t)}function s(t,e){return new y(function(){var n;return m(function(){return t()?(n=e,!0):!1},function(){return n})})}var u=n.Observable,c=u.prototype,a=n.Internals.AnonymousObservable,h=u.concat,l=u.defer,f=u.empty,p=n.Disposable.empty,d=(n.Internals.BinaryObserver,n.CompositeDisposable),b=n.SerialDisposable,v=n.SingleAssignmentDisposable,m=n.Internals.Enumerator.create,y=n.Internals.Enumerable,g=y.forEach,w=n.Scheduler.immediate,E=n.Scheduler.currentThread,x=Array.prototype.slice,C=n.AsyncSubject,D=n.Observer,N=n.Internals.inherits,A=n.Internals.addProperties;c.letBind=c.let=function(t){return t(this)},u["if"]=u.ifThen=function(t,e,n){return l(function(){if(n||(n=f()),n.now){var r=n;n=f(r)}return t()?e:n})},u["for"]=u.forIn=function(t,e){return g(t,e).concat()};var S=u["while"]=u.whileDo=function(t,e){return s(t,e).concat()};c.doWhile=function(t){return h([this,S(t,this)])},u["case"]=u.switchCase=function(t,e,n){return l(function(){if(n||(n=f()),n.now){var i=n;n=f(i)}var o=e[t()];return o!==r?o:n})},c.expand=function(t,e){e||(e=w);var n=this;return new a(function(i){var o=[],s=new b,u=new d(s),c=0,a=!1,h=function(){var n=!1;o.length>0&&(n=!a,a=!0),n&&s.setDisposable(e.scheduleRecursive(function(e){var n;if(!(o.length>0))return a=!1,r;n=o.shift();var s=new v;u.add(s),s.setDisposable(n.subscribe(function(e){i.onNext(e);var n=null;try{n=t(e)}catch(r){i.onError(r)}o.push(n),c++,h()},i.onError.bind(i),function(){u.remove(s),c--,0===c&&i.onCompleted()})),e()}))};return o.push(n),c++,h(),u})},u.forkJoin=function(){var t=o(arguments,0);return new a(function(e){var n=t.length;if(0===n)return e.onCompleted(),p;for(var i=new d,o=!1,s=Array(n),u=Array(n),c=Array(n),a=0;n>a;a++)(function(a){var h=t[a];i.add(h.subscribe(function(t){o||(s[a]=!0,c[a]=t)},function(t){o=!0,e.onError(t),i.dispose()},function(){if(!o){if(!s[a])return e.onCompleted(),r;u[a]=!0;for(var t=0;n>t;t++)if(!u[t])return;o=!0,e.onNext(c),e.onCompleted()}}))})(a);return i})},c.forkJoin=function(t,e){var n=this;return new a(function(i){var o,s,u=!1,c=!1,a=!1,h=!1,l=new v,f=new v;return l.setDisposable(n.subscribe(function(t){a=!0,o=t},function(t){f.dispose(),i.onError(t)},function(){if(u=!0,c)if(a)if(h){var t;try{t=e(o,s)}catch(n){return i.onError(n),r}i.onNext(t),i.onCompleted()}else i.onCompleted();else i.onCompleted()})),f.setDisposable(t.subscribe(function(t){h=!0,s=t},function(t){l.dispose(),i.onError(t)},function(){if(c=!0,u)if(a)if(h){var t;try{t=e(o,s)}catch(n){return i.onError(n),r}i.onNext(t),i.onCompleted()}else i.onCompleted();else i.onCompleted()})),new d(l,f)})},c.manySelect=function(t,e){e||(e=w);var n=this;return l(function(){var r;return n.select(function(t){var e=new _(t);return r&&r.onNext(t),r=e,e}).doAction(i,function(t){r&&r.onError(t)},function(){r&&r.onCompleted()}).observeOn(e).select(function(e,n,r){return t(e,n,r)})})};var _=function(t){function e(t){var e=this,n=new d;return n.add(E.schedule(function(){t.onNext(e.head),n.add(e.tail.mergeObservable().subscribe(t))})),n}function n(n){t.call(this,e),this.head=n,this.tail=new C}return N(n,t),A(n.prototype,D,{onCompleted:function(){this.onNext(u.empty())},onError:function(t){this.onNext(u.throwException(t))},onNext:function(t){this.tail.onNext(t),this.tail.onCompleted()}}),n}(u);return n}); | ||
(function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx","exports"],function(b,d){return c.Rx=a(c,d,b),c.Rx}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c,d){function e(){}function f(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:w.call(a)}function g(a,b){return new s(function(){var c;return r(function(){return a()?(c=b,!0):!1},function(){return c})})}var h=c.Observable,i=h.prototype,j=c.Internals.AnonymousObservable,k=h.concat,l=h.defer,m=h.empty,n=c.Disposable.empty,o=(c.Internals.BinaryObserver,c.CompositeDisposable),p=c.SerialDisposable,q=c.SingleAssignmentDisposable,r=c.Internals.Enumerator.create,s=c.Internals.Enumerable,t=s.forEach,u=c.Scheduler.immediate,v=c.Scheduler.currentThread,w=Array.prototype.slice,x=c.AsyncSubject,y=c.Observer,z=c.Internals.inherits,A=c.Internals.addProperties;i.letBind=i.let=function(a){return a(this)},h["if"]=h.ifThen=function(a,b,c){return l(function(){if(c||(c=m()),c.now){var d=c;c=m(d)}return a()?b:c})},h["for"]=h.forIn=function(a,b){return t(a,b).concat()};var B=h["while"]=h.whileDo=function(a,b){return g(a,b).concat()};i.doWhile=function(a){return k([this,B(a,this)])},h["case"]=h.switchCase=function(a,b,c){return l(function(){if(c||(c=m()),c.now){var e=c;c=m(e)}var f=b[a()];return f!==d?f:c})},i.expand=function(a,b){b||(b=u);var c=this;return new j(function(d){var e=[],f=new p,g=new o(f),h=0,i=!1,j=function(){var c=!1;e.length>0&&(c=!i,i=!0),c&&f.setDisposable(b.scheduleRecursive(function(b){var c;if(!(e.length>0))return i=!1,void 0;c=e.shift();var f=new q;g.add(f),f.setDisposable(c.subscribe(function(b){d.onNext(b);var c=null;try{c=a(b)}catch(f){d.onError(f)}e.push(c),h++,j()},d.onError.bind(d),function(){g.remove(f),h--,0===h&&d.onCompleted()})),b()}))};return e.push(c),h++,j(),g})},h.forkJoin=function(){var a=f(arguments,0);return new j(function(b){var c=a.length;if(0===c)return b.onCompleted(),n;for(var d=new o,e=!1,f=new Array(c),g=new Array(c),h=new Array(c),i=0;c>i;i++)!function(i){var j=a[i];d.add(j.subscribe(function(a){e||(f[i]=!0,h[i]=a)},function(a){e=!0,b.onError(a),d.dispose()},function(){if(!e){if(!f[i])return b.onCompleted(),void 0;g[i]=!0;for(var a=0;c>a;a++)if(!g[a])return;e=!0,b.onNext(h),b.onCompleted()}}))}(i);return d})},i.forkJoin=function(a,b){var c=this;return new j(function(d){var e,f,g=!1,h=!1,i=!1,j=!1,k=new q,l=new q;return k.setDisposable(c.subscribe(function(a){i=!0,e=a},function(a){l.dispose(),d.onError(a)},function(){if(g=!0,h)if(i)if(j){var a;try{a=b(e,f)}catch(c){return d.onError(c),void 0}d.onNext(a),d.onCompleted()}else d.onCompleted();else d.onCompleted()})),l.setDisposable(a.subscribe(function(a){j=!0,f=a},function(a){k.dispose(),d.onError(a)},function(){if(h=!0,g)if(i)if(j){var a;try{a=b(e,f)}catch(c){return d.onError(c),void 0}d.onNext(a),d.onCompleted()}else d.onCompleted();else d.onCompleted()})),new o(k,l)})},i.manySelect=function(a,b){b||(b=u);var c=this;return l(function(){var d;return c.select(function(a){var b=new C(a);return d&&d.onNext(a),d=b,b}).doAction(e,function(a){d&&d.onError(a)},function(){d&&d.onCompleted()}).observeOn(b).select(function(b,c,d){return a(b,c,d)})})};var C=function(a){function b(a){var b=this,c=new o;return c.add(v.schedule(function(){a.onNext(b.head),c.add(b.tail.mergeObservable().subscribe(a))})),c}function c(c){a.call(this,b),this.head=c,this.tail=new x}return z(c,a),A(c.prototype,y,{onCompleted:function(){this.onNext(h.empty())},onError:function(a){this.onNext(h.throwException(a))},onNext:function(a){this.tail.onNext(a),this.tail.onCompleted()}}),c}(h);return c}); |
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. | ||
(function (root, factory) { | ||
var freeExports = typeof exports == 'object' && exports, | ||
freeModule = typeof module == 'object' && module && module.exports == freeExports && module, | ||
freeGlobal = typeof global == 'object' && global; | ||
if (freeGlobal.global === freeGlobal) { | ||
window = freeGlobal; | ||
(function (factory) { | ||
var objectTypes = { | ||
'boolean': false, | ||
'function': true, | ||
'object': true, | ||
'number': false, | ||
'string': false, | ||
'undefined': false | ||
}; | ||
var root = (objectTypes[typeof window] && window) || this, | ||
freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports, | ||
freeModule = objectTypes[typeof module] && module && !module.nodeType && module, | ||
moduleExports = freeModule && freeModule.exports === freeExports && freeExports, | ||
freeGlobal = objectTypes[typeof global] && global; | ||
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) { | ||
root = freeGlobal; | ||
} | ||
@@ -22,3 +34,3 @@ | ||
} | ||
}(this, function (global, exp, Rx, undefined) { | ||
}.call(this, function (root, exp, Rx, undefined) { | ||
@@ -25,0 +37,0 @@ // Aliases |
@@ -1,1 +0,1 @@ | ||
(function(t,e){var n="object"==typeof exports&&exports,r=("object"==typeof module&&module&&module.exports==n&&module,"object"==typeof global&&global);r.global===r&&(window=r),"function"==typeof define&&define.amd?define(["rx","exports"],function(n,r){return t.Rx=e(t,r,n),t.Rx}):"object"==typeof module&&module&&module.exports===n?module.exports=e(t,module.exports,require("./rx")):t.Rx=e(t,{},t.Rx)})(this,function(t,e,n){function r(){}function i(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:y.call(t)}function o(t){this.patterns=t}function s(t,e){this.expression=t,this.selector=e}function u(t,e,n){var r=t.get(e);if(!r){var i=new w(e,n);return t.set(e,i),i}return r}function c(t,e,n){var r,i;for(this.joinObserverArray=t,this.onNext=e,this.onCompleted=n,this.joinObservers=new g,r=0;this.joinObserverArray.length>r;r++)i=this.joinObserverArray[r],this.joinObservers.set(i,i)}var a=n.Observable,h=a.prototype,l=n.Internals.AnonymousObservable,f=a.throwException,p=n.Observer.create,d=n.SingleAssignmentDisposable,b=n.CompositeDisposable,v=n.Internals.AbstractObserver;n.Internals.isEqual;var m=n.Internals.inherits,y=Array.prototype.slice,g=function(){function t(){this.keys=[],this.values=[]}return t.prototype["delete"]=function(t){var e=this.keys.indexOf(t);return-1!==e&&(this.keys.splice(e,1),this.values.splice(e,1)),-1!==e},t.prototype.get=function(t,e){var n=this.keys.indexOf(t);return-1!==n?this.values[n]:e},t.prototype.set=function(t,e){var n=this.keys.indexOf(t);-1!==n&&(this.values[n]=e),this.values[this.keys.push(t)-1]=e},t.prototype.size=function(){return this.keys.length},t.prototype.has=function(t){return-1!==this.keys.indexOf(t)},t.prototype.getKeys=function(){return this.keys.slice(0)},t.prototype.getValues=function(){return this.values.slice(0)},t}();o.prototype.and=function(t){var e=this.patterns.slice(0);return e.push(t),new o(e)},o.prototype.then=function(t){return new s(this,t)},s.prototype.activate=function(t,e,n){for(var r=this,i=[],o=0,s=this.expression.patterns.length;s>o;o++)i.push(u(t,this.expression.patterns[o],e.onError.bind(e)));var a=new c(i,function(){var t;try{t=r.selector.apply(r,arguments)}catch(n){return e.onError(n),undefined}e.onNext(t)},function(){for(var t=0,e=i.length;e>t;t++)i[t].removeActivePlan(a);n(a)});for(o=0,s=i.length;s>o;o++)i[o].addActivePlan(a);return a},c.prototype.dequeue=function(){for(var t=this.joinObservers.getValues(),e=0,n=t.length;n>e;e++)t[e].queue.shift()},c.prototype.match=function(){var t,e,n,r,i,o=!0;for(e=0,n=this.joinObserverArray.length;n>e;e++)if(0===this.joinObserverArray[e].queue.length){o=!1;break}if(o){for(t=[],r=!1,e=0,n=this.joinObserverArray.length;n>e;e++)t.push(this.joinObserverArray[e].queue[0]),"C"===this.joinObserverArray[e].queue[0].kind&&(r=!0);if(r)this.onCompleted();else{for(this.dequeue(),i=[],e=0;t.length>e;e++)i.push(t[e].value);this.onNext.apply(this,i)}}};var w=function(t){function e(e,n){t.call(this),this.source=e,this.onError=n,this.queue=[],this.activePlans=[],this.subscription=new d,this.isDisposed=!1}m(e,t);var n=e.prototype;return n.next=function(t){if(!this.isDisposed){if("E"===t.kind)return this.onError(t.exception),undefined;this.queue.push(t);for(var e=this.activePlans.slice(0),n=0,r=e.length;r>n;n++)e[n].match()}},n.error=r,n.completed=r,n.addActivePlan=function(t){this.activePlans.push(t)},n.subscribe=function(){this.subscription.setDisposable(this.source.materialize().subscribe(this))},n.removeActivePlan=function(t){var e=this.activePlans.indexOf(t);this.activePlans.splice(e,1),0===this.activePlans.length&&this.dispose()},n.dispose=function(){t.prototype.dispose.call(this),this.isDisposed||(this.isDisposed=!0,this.subscription.dispose())},e}(v);return h.and=function(t){return new o([this,t])},h.then=function(t){return new o([this]).then(t)},a.when=function(){var t=i(arguments,0);return new l(function(e){var n,r,i,o,s,u,c=[],a=new g;u=p(e.onNext.bind(e),function(t){for(var n=a.getValues(),r=0,i=n.length;i>r;r++)n[r].onError(t);e.onError(t)},e.onCompleted.bind(e));try{for(r=0,i=t.length;i>r;r++)c.push(t[r].activate(a,u,function(t){var e=c.indexOf(t);c.splice(e,1),0===c.length&&u.onCompleted()}))}catch(h){f(h).subscribe(e)}for(n=new b,s=a.getValues(),r=0,i=s.length;i>r;r++)o=s[r],o.subscribe(),n.add(o);return n})},n}); | ||
(function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx","exports"],function(b,d){return c.Rx=a(c,d,b),c.Rx}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c){function d(){}function e(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:s.call(a)}function f(a){this.patterns=a}function g(a,b){this.expression=a,this.selector=b}function h(a,b,c){var d=a.get(b);if(!d){var e=new u(b,c);return a.set(b,e),e}return d}function i(a,b,c){var d,e;for(this.joinObserverArray=a,this.onNext=b,this.onCompleted=c,this.joinObservers=new t,d=0;d<this.joinObserverArray.length;d++)e=this.joinObserverArray[d],this.joinObservers.set(e,e)}var j=c.Observable,k=j.prototype,l=c.Internals.AnonymousObservable,m=j.throwException,n=c.Observer.create,o=c.SingleAssignmentDisposable,p=c.CompositeDisposable,q=c.Internals.AbstractObserver;c.Internals.isEqual;var r=c.Internals.inherits,s=Array.prototype.slice,t=function(){function a(){this.keys=[],this.values=[]}return a.prototype["delete"]=function(a){var b=this.keys.indexOf(a);return-1!==b&&(this.keys.splice(b,1),this.values.splice(b,1)),-1!==b},a.prototype.get=function(a,b){var c=this.keys.indexOf(a);return-1!==c?this.values[c]:b},a.prototype.set=function(a,b){var c=this.keys.indexOf(a);-1!==c&&(this.values[c]=b),this.values[this.keys.push(a)-1]=b},a.prototype.size=function(){return this.keys.length},a.prototype.has=function(a){return-1!==this.keys.indexOf(a)},a.prototype.getKeys=function(){return this.keys.slice(0)},a.prototype.getValues=function(){return this.values.slice(0)},a}();f.prototype.and=function(a){var b=this.patterns.slice(0);return b.push(a),new f(b)},f.prototype.then=function(a){return new g(this,a)},g.prototype.activate=function(a,b,c){for(var d=this,e=[],f=0,g=this.expression.patterns.length;g>f;f++)e.push(h(a,this.expression.patterns[f],b.onError.bind(b)));var j=new i(e,function(){var a;try{a=d.selector.apply(d,arguments)}catch(c){return b.onError(c),void 0}b.onNext(a)},function(){for(var a=0,b=e.length;b>a;a++)e[a].removeActivePlan(j);c(j)});for(f=0,g=e.length;g>f;f++)e[f].addActivePlan(j);return j},i.prototype.dequeue=function(){for(var a=this.joinObservers.getValues(),b=0,c=a.length;c>b;b++)a[b].queue.shift()},i.prototype.match=function(){var a,b,c,d,e,f=!0;for(b=0,c=this.joinObserverArray.length;c>b;b++)if(0===this.joinObserverArray[b].queue.length){f=!1;break}if(f){for(a=[],d=!1,b=0,c=this.joinObserverArray.length;c>b;b++)a.push(this.joinObserverArray[b].queue[0]),"C"===this.joinObserverArray[b].queue[0].kind&&(d=!0);if(d)this.onCompleted();else{for(this.dequeue(),e=[],b=0;b<a.length;b++)e.push(a[b].value);this.onNext.apply(this,e)}}};var u=function(a){function b(b,c){a.call(this),this.source=b,this.onError=c,this.queue=[],this.activePlans=[],this.subscription=new o,this.isDisposed=!1}r(b,a);var c=b.prototype;return c.next=function(a){if(!this.isDisposed){if("E"===a.kind)return this.onError(a.exception),void 0;this.queue.push(a);for(var b=this.activePlans.slice(0),c=0,d=b.length;d>c;c++)b[c].match()}},c.error=d,c.completed=d,c.addActivePlan=function(a){this.activePlans.push(a)},c.subscribe=function(){this.subscription.setDisposable(this.source.materialize().subscribe(this))},c.removeActivePlan=function(a){var b=this.activePlans.indexOf(a);this.activePlans.splice(b,1),0===this.activePlans.length&&this.dispose()},c.dispose=function(){a.prototype.dispose.call(this),this.isDisposed||(this.isDisposed=!0,this.subscription.dispose())},b}(q);return k.and=function(a){return new f([this,a])},k.then=function(a){return new f([this]).then(a)},j.when=function(){var a=e(arguments,0);return new l(function(b){var c,d,e,f,g,h,i=[],j=new t;h=n(b.onNext.bind(b),function(a){for(var c=j.getValues(),d=0,e=c.length;e>d;d++)c[d].onError(a);b.onError(a)},b.onCompleted.bind(b));try{for(d=0,e=a.length;e>d;d++)i.push(a[d].activate(j,h,function(a){var b=i.indexOf(a);i.splice(b,1),0===i.length&&h.onCompleted()}))}catch(k){m(k).subscribe(b)}for(c=new p,g=j.getValues(),d=0,e=g.length;e>d;d++)f=g[d],f.subscribe(),c.add(f);return c})},c}); |
@@ -1,2 +0,2 @@ | ||
(function(t,e){function n(){}function r(t){return t}function i(t,e){return H(t,e)}function o(t,e){return t-e}function s(t){throw t}function u(){if(this.isDisposed)throw Error(R)}function c(t){return"function"!=typeof t.toString&&"string"==typeof(t+"")}function a(t){return t&&"object"==typeof t?V.call(t)==j:!1}function l(t){return"function"==typeof t}function h(t,e,n,r){var i;if(t===e)return 0!==t||1/t==1/e;var o=typeof t,s=typeof e;if(!(t!==t||t&&W[o]||e&&W[s]))return!1;if(null==t||null==e)return t===e;var u=V.call(t),f=V.call(e);if(u==j&&(u=L),f==j&&(f=L),u!=f)return!1;switch(u){case q:case T:return+t==+e;case P:return t!=+t?e!=+e:0==t?1/t==1/e:t==+e;case M:case z:return t==e+""}var p=u==k;if(!p){if(u!=L||!S&&(c(t)||c(e)))return!1;var d=!U&&a(t)?Object:t.constructor,b=!U&&a(e)?Object:e.constructor;if(d!=b&&!(l(d)&&d instanceof d&&l(b)&&b instanceof b))return!1}for(var v=n.length;v--;)if(n[v]==t)return r[v]==e;var m=0;if(i=!0,n.push(t),r.push(e),p){for(v=t.length,m=e.length,i=m==t.length;m--;){var y=e[m];if(!(i=h(t[m],y,n,r)))break}return i}for(var w in e)if(B.call(e,w))return m++,i=B.call(t,w)&&h(t[w],e[w],n,r);if(i)for(var w in t)if(B.call(t,w))return i=--m>-1;return n.pop(),r.pop(),i}function f(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:X.call(t)}function p(t,e){for(var n=Array(t),r=0;t>r;r++)n[r]=e();return n}function d(t,n){return new Xe(function(r){var i=new ue,o=new ce;return o.setDisposable(i),i.setDisposable(t.subscribe(r.onNext.bind(r),function(t){var i,s;try{s=n(t)}catch(u){return r.onError(u),e}i=new ue,o.setDisposable(i),i.setDisposable(s.subscribe(r))},r.onCompleted.bind(r))),o})}function b(t,n){var r=this;return new Xe(function(i){var o=0,s=t.length;return r.subscribe(function(r){if(s>o){var u,c=t[o++];try{u=n(r,c)}catch(a){return i.onError(a),e}i.onNext(u)}else i.onCompleted()},i.onError.bind(i),i.onCompleted.bind(i))})}function v(t){return this.select(t).mergeObservable()}function m(e){var n=function(){this.cancelBubble=!0},r=function(){if(this.bubbledKeyCode=this.keyCode,this.ctrlKey)try{this.keyCode=0}catch(t){}this.defaultPrevented=!0,this.returnValue=!1,this.modified=!0};if(e||(e=t.event),!e.target)switch(e.target=e.target||e.srcElement,"mouseover"==e.type&&(e.relatedTarget=e.fromElement),"mouseout"==e.type&&(e.relatedTarget=e.toElement),e.stopPropagation||(e.stopPropagation=n,e.preventDefault=r),e.type){case"keypress":var i="charCode"in e?e.charCode:e.keyCode;10==i?(i=0,e.keyCode=13):13==i||27==i?i=0:3==i&&(i=99),e.charCode=i,e.keyChar=e.charCode?String.fromCharCode(e.charCode):""}return e}function y(t,e,n){if(t.addListener)return t.addListener(e,n),re(function(){t.removeListener(e,n)});if(t.addEventListener)return t.addEventListener(e,n,!1),re(function(){t.removeEventListener(e,n,!1)});if(t.attachEvent){var r=function(t){n(m(t))};return t.attachEvent("on"+e,r),re(function(){t.detachEvent("on"+e,r)})}return t["on"+e]=n,re(function(){t["on"+e]=null})}function w(t,e,n){var r=new te;if(t&&t.length)for(var i=0,o=t.length;o>i;i++)r.add(w(t[i],e,n));else t&&r.add(y(t,e,n));return r}function g(t,e){var n=he(t);return new Xe(function(t){return e.scheduleWithRelative(n,function(){t.onNext(0),t.onCompleted()})})}function E(t,e,n){return t===e?new Xe(function(t){return n.schedulePeriodicWithState(0,e,function(e){return t.onNext(e),e+1})}):ke(function(){return observableTimerDateAndPeriod(n.now()+t,e,n)})}function x(t,e){return new Xe(function(n){function r(){s&&(s=!1,n.onNext(o)),i&&n.onCompleted()}var i,o,s;return new te(t.subscribe(function(t){s=!0,o=t},n.onError.bind(n),function(){i=!0}),e.subscribe(r,n.onError.bind(n),r))})}var C="object"==typeof exports&&exports,D=("object"==typeof module&&module&&module.exports==C&&module,"object"==typeof global&&global);D.global===D&&(t=D);var S,N={Internals:{}},A=function(){return Date.now?Date.now:function(){return+new Date}}(),O="Sequence contains no elements.",_="Argument out of range",R="Object has been disposed",W={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},j="[object Arguments]",k="[object Array]",q="[object Boolean]",T="[object Date]",I="[object Function]",P="[object Number]",L="[object Object]",M="[object RegExp]",z="[object String]",V=Object.prototype.toString,B=Object.prototype.hasOwnProperty,U=V.call(arguments)==j;try{S=!(V.call(document)==L&&!({toString:0}+""))}catch(F){S=!0}U||(a=function(t){return t&&"object"==typeof t?B.call(t,"callee"):!1}),l(/x/)&&(l=function(t){return"function"==typeof t&&V.call(t)==I});var H=N.Internals.isEqual=function(t,e){return h(t,e,[],[])},X=Array.prototype.slice;({}).hasOwnProperty;var Q=this.inherits=N.Internals.inherits=function(t,e){function n(){this.constructor=t}n.prototype=e.prototype,t.prototype=new n},K=N.Internals.addProperties=function(t){for(var e=X.call(arguments,1),n=0,r=e.length;r>n;n++){var i=e[n];for(var o in i)t[o]=i[o]}};N.Internals.addRef=function(t,e){return new Xe(function(n){return new te(e.getDisposable(),t.subscribe(n))})},Function.prototype.bind||(Function.prototype.bind=function(t){var e=this,n=X.call(arguments,1),r=function(){function i(){}if(this instanceof r){i.prototype=e.prototype;var o=new i,s=e.apply(o,n.concat(X.call(arguments)));return Object(s)===s?s:o}return e.apply(t,n.concat(X.call(arguments)))};return r});var J=Object("a"),G="a"!=J[0]||!(0 in J);Array.prototype.every||(Array.prototype.every=function(t){var e=Object(this),n=G&&"[object String]"=={}.toString.call(this)?this.split(""):e,r=n.length>>>0,i=arguments[1];if("[object Function]"!={}.toString.call(t))throw new TypeError(t+" is not a function");for(var o=0;r>o;o++)if(o in n&&!t.call(i,n[o],o,e))return!1;return!0}),Array.prototype.map||(Array.prototype.map=function(t){var e=Object(this),n=G&&"[object String]"=={}.toString.call(this)?this.split(""):e,r=n.length>>>0,i=Array(r),o=arguments[1];if("[object Function]"!={}.toString.call(t))throw new TypeError(t+" is not a function");for(var s=0;r>s;s++)s in n&&(i[s]=t.call(o,n[s],s,e));return i}),Array.prototype.filter||(Array.prototype.filter=function(t){for(var e,n=[],r=Object(this),i=0,o=r.length>>>0;o>i;i++)e=r[i],i in r&&t.call(arguments[1],e,i,r)&&n.push(e);return n}),Array.isArray||(Array.isArray=function(t){return"[object Array]"==Object.prototype.toString.call(t)}),Array.prototype.indexOf||(Array.prototype.indexOf=function(t){var e=Object(this),n=e.length>>>0;if(0===n)return-1;var r=0;if(arguments.length>1&&(r=Number(arguments[1]),r!==r?r=0:0!==r&&1/0!=r&&r!==-1/0&&(r=(r>0||-1)*Math.floor(Math.abs(r)))),r>=n)return-1;for(var i=r>=0?r:Math.max(n-Math.abs(r),0);n>i;i++)if(i in e&&e[i]===t)return i;return-1});var Y=function(t,e){this.id=t,this.value=e};Y.prototype.compareTo=function(t){var e=this.value.compareTo(t.value);return 0===e&&(e=this.id-t.id),e};var Z=N.Internals.PriorityQueue=function(t){this.items=Array(t),this.length=0},$=Z.prototype;$.isHigherPriority=function(t,e){return 0>this.items[t].compareTo(this.items[e])},$.percolate=function(t){if(!(t>=this.length||0>t)){var e=t-1>>1;if(!(0>e||e===t)&&this.isHigherPriority(t,e)){var n=this.items[t];this.items[t]=this.items[e],this.items[e]=n,this.percolate(e)}}},$.heapify=function(t){if(t===e&&(t=0),!(t>=this.length||0>t)){var n=2*t+1,r=2*t+2,i=t;if(this.length>n&&this.isHigherPriority(n,i)&&(i=n),this.length>r&&this.isHigherPriority(r,i)&&(i=r),i!==t){var o=this.items[t];this.items[t]=this.items[i],this.items[i]=o,this.heapify(i)}}},$.peek=function(){return this.items[0].value},$.removeAt=function(t){this.items[t]=this.items[--this.length],delete this.items[this.length],this.heapify()},$.dequeue=function(){var t=this.peek();return this.removeAt(0),t},$.enqueue=function(t){var e=this.length++;this.items[e]=new Y(Z.count++,t),this.percolate(e)},$.remove=function(t){for(var e=0;this.length>e;e++)if(this.items[e].value===t)return this.removeAt(e),!0;return!1},Z.count=0;var te=N.CompositeDisposable=function(){this.disposables=f(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},ee=te.prototype;ee.add=function(t){this.isDisposed?t.dispose():(this.disposables.push(t),this.length++)},ee.remove=function(t){var e=!1;if(!this.isDisposed){var n=this.disposables.indexOf(t);-1!==n&&(e=!0,this.disposables.splice(n,1),this.length--,t.dispose())}return e},ee.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()}},ee.clear=function(){var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()},ee.contains=function(t){return-1!==this.disposables.indexOf(t)},ee.toArray=function(){return this.disposables.slice(0)};var ne=N.Disposable=function(t){this.isDisposed=!1,this.action=t||n};ne.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var re=ne.create=function(t){return new ne(t)},ie=ne.empty={dispose:n},oe=N.BooleanDisposable=function(){this.isDisposed=!1,this.current=null};N.SingleAssignmentDisposable=N.SerialDisposable=oe;var se=oe.prototype,ue=oe,ce=oe;se.getDisposable=function(){return this.current},se.setDisposable=function(t){var e,n=this.isDisposed;n||(e=this.current,this.current=t),e&&e.dispose(),n&&t&&t.dispose()},se.disposable=function(t){return t?(this.setDisposable(t),e):this.getDisposable()},se.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()},N.RefCountDisposable=function(){function t(t){this.disposable=t,this.disposable.count++,this.isInnerDisposed=!1}function e(t){this.underlyingDisposable=t,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return t.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},e.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},e.prototype.getDisposable=function(){return this.isDisposed?ie:new t(this)},e}();var ae=N.Internals.ScheduledItem=function(t,e,n,r,i){this.scheduler=t,this.state=e,this.action=n,this.dueTime=r,this.comparer=i||o,this.disposable=new ue};ae.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},ae.prototype.compareTo=function(t){return this.comparer(this.dueTime,t.dueTime)},ae.prototype.isCancelled=function(){return this.disposable.isDisposed},ae.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var le=N.Scheduler=function(){function e(t,e,n,r){this.now=t,this._schedule=e,this._scheduleRelative=n,this._scheduleAbsolute=r}function n(t,e){var n=e.first,r=e.second,i=new te,o=function(e){r(e,function(e){var n=!1,r=!1,s=t.scheduleWithState(e,function(t,e){return n?i.remove(s):r=!0,o(e),ie});r||(i.add(s),n=!0)})};return o(n),i}function r(t,e,n){var r=e.first,i=e.second,o=new te,s=function(e){i(e,function(e,r){var i=!1,u=!1,c=t[n].call(t,e,r,function(t,e){return i?o.remove(c):u=!0,s(e),ie});u||(o.add(c),i=!0)})};return s(r),o}function i(t,e){return e(),ie}var o=e.prototype;return o.schedulePeriodic=function(t,e){return this.schedulePeriodicWithState(null,t,function(){e()})},o.schedulePeriodicWithState=function(e,n,r){var i=e,o=t.setInterval(function(){i=r(i)},n);return re(function(){t.clearInterval(o)})},o.schedule=function(t){return this._schedule(t,i)},o.scheduleWithState=function(t,e){return this._schedule(t,e)},o.scheduleWithRelative=function(t,e){return this._scheduleRelative(e,t,i)},o.scheduleWithRelativeAndState=function(t,e,n){return this._scheduleRelative(t,e,n)},o.scheduleWithAbsolute=function(t,e){return this._scheduleAbsolute(e,t,i)},o.scheduleWithAbsoluteAndState=function(t,e,n){return this._scheduleAbsolute(t,e,n)},o.scheduleRecursive=function(t){return this.scheduleRecursiveWithState(t,function(t,e){t(function(){e(t)})})},o.scheduleRecursiveWithState=function(t,e){return this.scheduleWithState({first:t,second:e},function(t,e){return n(t,e)})},o.scheduleRecursiveWithRelative=function(t,e){return this.scheduleRecursiveWithRelativeAndState(e,t,function(t,e){t(function(n){e(t,n)})})},o.scheduleRecursiveWithRelativeAndState=function(t,e,n){return this._scheduleRelative({first:t,second:n},e,function(t,e){return r(t,e,"scheduleWithRelativeAndState")})},o.scheduleRecursiveWithAbsolute=function(t,e){return this.scheduleRecursiveWithAbsoluteAndState(e,t,function(t,e){t(function(n){e(t,n)})})},o.scheduleRecursiveWithAbsoluteAndState=function(t,e,n){return this._scheduleAbsolute({first:t,second:n},e,function(t,e){return r(t,e,"scheduleWithAbsoluteAndState")})},e.now=A,e.normalize=function(t){return 0>t&&(t=0),t},e}(),he=le.normalize,fe=le.currentThread=le.immediate=function(){function t(){i=new Z(4)}function e(t,e){return this.scheduleWithRelativeAndState(t,0,e)}function n(e,n,r){var o,s=this.now()+le.normalize(n),u=new ae(this,e,r,s);if(i)i.enqueue(u);else{o=new t;try{i.enqueue(u),o.run()}catch(c){throw c}finally{o.dispose()}}return u.disposable}function r(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}var i;t.prototype.dispose=function(){i=null},t.prototype.run=function(){for(var t;i.length>0;)if(t=i.dequeue(),!t.isCancelled()){for(;t.dueTime-le.now()>0;);t.isCancelled()||t.invoke()}};var o=new le(A,e,n,r);return o.scheduleRequired=function(){return null===i},o.ensureTrampoline=function(t){return null===i?this.schedule(t):t()},o}(),pe=fe;N.Internals.SchedulePeriodicRecursive=function(){function t(t,e){e(0,this._period);try{this._state=this._action(this._state)}catch(n){throw this._cancel.dispose(),n}}function e(t,e,n,r){this._scheduler=t,this._state=e,this._period=n,this._action=r}return e.prototype.start=function(){var e=new ue;return this._cancel=e,e.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,t.bind(this))),e},e}();var de,be=n;(function(){function e(){if(!t.postMessage||t.importScripts)return!1;var e=!1,n=t.onmessage;return t.onmessage=function(){e=!0},t.postMessage("","*"),t.onmessage=n,e}function n(t){if("string"==typeof t.data&&t.data.substring(0,r.length)===r){var e=t.data.substring(r.length),n=i[e];n(),delete i[e]}}if("function"==typeof t.setImmediate)de=t.setImmediate,be=clearImmediate;else if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))de=process.nextTick;else if(e()){var r="ms.rx.schedule"+Math.random(),i={},o=0;t.addEventListener?t.addEventListener("message",n,!1):t.attachEvent("onmessage",n,!1),de=function(e){var n=o++;i[n]=e,t.postMessage(r+n,"*")}}else if(t.MessageChannel){var s=new t.MessageChannel,u={},c=0;s.port1.onmessage=function(t){var e=t.data,n=u[e];n(),delete u[e]},de=function(t){var e=c++;u[e]=t,s.port2.postMessage(e)}}else"document"in t&&"onreadystatechange"in t.document.createElement("script")?de=function(e){var n=t.document.createElement("script");n.onreadystatechange=function(){e(),n.onreadystatechange=null,n.parentNode.removeChild(n),n=null},t.document.documentElement.appendChild(n)}:(de=function(e){return t.setTimeout(e,0)},be=t.clearTimeout)})();var ve=le.timeout=function(){function e(t,e){var n=this,r=new ue,i=de(function(){r.isDisposed||r.setDisposable(e(n,t))});return new te(r,re(function(){be(i)}))}function n(e,n,r){var i=this,o=le.normalize(n);if(0===o)return i.scheduleWithState(e,r);var s=new ue,u=t.setTimeout(function(){s.isDisposed||s.setDisposable(r(i,e))},o);return new te(s,re(function(){t.clearTimeout(u)}))}function r(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new le(A,e,n,r)}(),me=N.Notification=function(){function t(t,e){this.hasValue=null==e?!1:e,this.kind=t}var e=t.prototype;return e.accept=function(t,e,n){return 1===arguments.length&&"object"==typeof t?this._acceptObservable(t):this._accept(t,e,n)},e.toObservable=function(t){var e=this;return t||(t=pe),new Xe(function(n){return t.schedule(function(){e._acceptObservable(n),"N"===e.kind&&n.onCompleted()})})},t}(),ye=me.createOnNext=function(){function t(t){return t(this.value)}function e(t){return t.onNext(this.value)}function n(){return"OnNext("+this.value+")"}return function(r){var i=new me("N",!0);return i.value=r,i._accept=t,i._acceptObservable=e,i.toString=n,i}}(),we=me.createOnError=function(){function t(t,e){return e(this.exception)}function e(t){return t.onError(this.exception)}function n(){return"OnError("+this.exception+")"}return function(r){var i=new me("E");return i.exception=r,i._accept=t,i._acceptObservable=e,i.toString=n,i}}(),ge=me.createOnCompleted=function(){function t(t,e,n){return n()}function e(t){return t.onCompleted()}function n(){return"OnCompleted()"}return function(){var r=new me("C");return r._accept=t,r._acceptObservable=e,r.toString=n,r}}(),Ee=N.Internals.Enumerator=function(t,e,n){this.moveNext=t,this.getCurrent=e,this.dispose=n},xe=Ee.create=function(t,e,r){var i=!1;return r||(r=n),new Ee(function(){if(i)return!1;var e=t();return e||(i=!0,r()),e},function(){return e()},function(){i||(r(),i=!0)})},Ce=N.Internals.Enumerable=function(){function t(t){this.getEnumerator=t}return t.prototype.concat=function(){var t=this;return new Xe(function(n){var r=t.getEnumerator(),i=!1,o=new ce,s=pe.scheduleRecursive(function(t){var s,u,c=!1;if(!i){try{c=r.moveNext(),c?s=r.getCurrent():r.dispose()}catch(a){u=a,r.dispose()}if(u)return n.onError(u),e;if(!c)return n.onCompleted(),e;var l=new ue;o.setDisposable(l),l.setDisposable(s.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){t()}))}});return new te(o,s,re(function(){i=!0,r.dispose()}))})},t.prototype.catchException=function(){var t=this;return new Xe(function(n){var r,i=t.getEnumerator(),o=!1,s=new ce,u=pe.scheduleRecursive(function(t){var u,c,a;if(a=!1,!o){try{a=i.moveNext(),a&&(u=i.getCurrent())}catch(l){c=l}if(c)return n.onError(c),e;if(!a)return r?n.onError(r):n.onCompleted(),e;var h=new ue;s.setDisposable(h),h.setDisposable(u.subscribe(n.onNext.bind(n),function(e){r=e,t()},n.onCompleted.bind(n)))}});return new te(s,u,re(function(){o=!0}))})},t}(),De=Ce.repeat=function(t,n){return n===e&&(n=-1),new Ce(function(){var e,r=n;return xe(function(){return 0===r?!1:(r>0&&r--,e=t,!0)},function(){return e})})},Se=Ce.forEach=function(t,e){return e||(e=r),new Ce(function(){var n,r=-1;return xe(function(){return++r<t.length?(n=e(t[r],r),!0):!1},function(){return n})})},Ne=N.Observer=function(){};Ne.prototype.toNotifier=function(){var t=this;return function(e){return e.accept(t)}},Ne.prototype.asObserver=function(){return new Re(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))};var Ae=Ne.create=function(t,e,r){return t||(t=n),e||(e=s),r||(r=n),new Re(t,e,r)};Ne.fromNotifier=function(t){return new Re(function(e){return t(ye(e))},function(e){return t(we(e))},function(){return t(ge())})};var Oe,_e=N.Internals.AbstractObserver=function(t){function e(){this.isStopped=!1,t.call(this)}return Q(e,t),e.prototype.onNext=function(t){this.isStopped||this.next(t)},e.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.error(t))},e.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},e.prototype.dispose=function(){this.isStopped=!0},e.prototype.fail=function(t){return this.isStopped?!1:(this.isStopped=!0,this.error(t),!0)},e}(Ne),Re=N.AnonymousObserver=function(t){function e(e,n,r){t.call(this),this._onNext=e,this._onError=n,this._onCompleted=r}return Q(e,t),e.prototype.next=function(t){this._onNext(t)},e.prototype.error=function(t){this._onError(t)},e.prototype.completed=function(){this._onCompleted()},e}(_e),We=N.Observable=function(){function t(t){this._subscribe=t}return Oe=t.prototype,Oe.finalValue=function(){var t=this;return new Xe(function(e){var n,r=!1;return t.subscribe(function(t){r=!0,n=t},e.onError.bind(e),function(){r?(e.onNext(n),e.onCompleted()):e.onError(Error(O))})})},Oe.subscribe=Oe.forEach=function(t,e,n){var r;return r="object"==typeof t?t:Ae(t,e,n),this._subscribe(r)},Oe.toArray=function(){function t(t,e){var n=t.slice(0);return n.push(e),n}return this.scan([],t).startWith([]).finalValue()},t}(),je=N.Internals.ScheduledObserver=function(t){function n(e,n){t.call(this),this.scheduler=e,this.observer=n,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new ce}return Q(n,t),n.prototype.next=function(t){var e=this;this.queue.push(function(){e.observer.onNext(t)})},n.prototype.error=function(t){var e=this;this.queue.push(function(){e.observer.onError(t)})},n.prototype.completed=function(){var t=this;this.queue.push(function(){t.observer.onCompleted()})},n.prototype.ensureActive=function(){var t=!1,n=this;!this.hasFaulted&&this.queue.length>0&&(t=!this.isAcquired,this.isAcquired=!0),t&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(t){var r;if(!(n.queue.length>0))return n.isAcquired=!1,e;r=n.queue.shift();try{r()}catch(i){throw n.queue=[],n.hasFaulted=!0,i}t()}))},n.prototype.dispose=function(){t.prototype.dispose.call(this),this.disposable.dispose()},n}(_e);We.create=We.createWithDisposable=function(t){return new Xe(t)};var ke=We.defer=function(t){return new Xe(function(e){var n;try{n=t()}catch(r){return Le(r).subscribe(e)}return n.subscribe(e)})},qe=We.empty=function(t){return t||(t=pe),new Xe(function(e){return t.schedule(function(){e.onCompleted()})})},Te=We.fromArray=function(t,e){return e||(e=fe),new Xe(function(n){var r=0;return e.scheduleRecursive(function(e){t.length>r?(n.onNext(t[r++]),e()):n.onCompleted()})})};We.generate=function(t,n,r,i,o){return o||(o=fe),new Xe(function(s){var u=!0,c=t;return o.scheduleRecursive(function(t){var o,a;try{u?u=!1:c=r(c),o=n(c),o&&(a=i(c))}catch(l){return s.onError(l),e}o?(s.onNext(a),t()):s.onCompleted()})})};var Ie=We.never=function(){return new Xe(function(){return ie})};We.range=function(t,e,n){return n||(n=fe),new Xe(function(r){return n.scheduleRecursiveWithState(0,function(n,i){e>n?(r.onNext(t+n),i(n+1)):r.onCompleted()})})},We.repeat=function(t,e,n){return n||(n=fe),null==e&&(e=-1),Pe(t,n).repeat(e)};var Pe=We["return"]=We.returnValue=function(t,e){return e||(e=pe),new Xe(function(n){return e.schedule(function(){n.onNext(t),n.onCompleted()})})},Le=We["throw"]=We.throwException=function(t,e){return e||(e=pe),new Xe(function(n){return e.schedule(function(){n.onError(t)})})};Oe["catch"]=Oe.catchException=function(t){return"function"==typeof t?d(this,t):Me([this,t])};var Me=We.catchException=We["catch"]=function(){var t=f(arguments,0);return Se(t).catchException()};Oe.combineLatest=function(){var t=X.call(arguments);return Array.isArray(t[0])?t[0].unshift(this):t.unshift(this),ze.apply(this,t)};var ze=We.combineLatest=function(){var t=X.call(arguments),n=t.pop();return Array.isArray(t[0])&&(t=t[0]),new Xe(function(i){function o(t){var o;if(a[t]=!0,l||(l=a.every(r))){try{o=n.apply(null,f)}catch(s){return i.onError(s),e}i.onNext(o)}else h.filter(function(e,n){return n!==t}).every(r)&&i.onCompleted()}function s(t){h[t]=!0,h.every(r)&&i.onCompleted()}for(var u=function(){return!1},c=t.length,a=p(c,u),l=!1,h=p(c,u),f=Array(c),d=Array(c),b=0;c>b;b++)(function(e){d[e]=new ue,d[e].setDisposable(t[e].subscribe(function(t){f[e]=t,o(e)},i.onError.bind(i),function(){s(e)}))})(b);return new te(d)})};Oe.concat=function(){var t=X.call(arguments,0);return t.unshift(this),Ve.apply(this,t)};var Ve=We.concat=function(){var t=f(arguments,0);return Se(t).concat()};Oe.concatObservable=Oe.concatAll=function(){return this.merge(1)},Oe.merge=function(t){if("number"!=typeof t)return Be(this,t);var e=this;return new Xe(function(n){var r=0,i=new te,o=!1,s=[],u=function(t){var e=new ue;i.add(e),e.setDisposable(t.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){var t;i.remove(e),s.length>0?(t=s.shift(),u(t)):(r--,o&&0===r&&n.onCompleted())}))};return i.add(e.subscribe(function(e){t>r?(r++,u(e)):s.push(e)},n.onError.bind(n),function(){o=!0,0===r&&n.onCompleted()})),i})};var Be=We.merge=function(){var t,e;return arguments[0]?arguments[0].now?(t=arguments[0],e=X.call(arguments,1)):(t=pe,e=X.call(arguments,0)):(t=pe,e=X.call(arguments,1)),Array.isArray(e[0])&&(e=e[0]),Te(e,t).mergeObservable()};Oe.mergeObservable=Oe.mergeAll=function(){var t=this;return new Xe(function(e){var n=new te,r=!1,i=new ue;return n.add(i),i.setDisposable(t.subscribe(function(t){var i=new ue;n.add(i),i.setDisposable(t.subscribe(function(t){e.onNext(t)},e.onError.bind(e),function(){n.remove(i),r&&1===n.length&&e.onCompleted()}))},e.onError.bind(e),function(){r=!0,1===n.length&&e.onCompleted()})),n})},Oe.skipUntil=function(t){var e=this;return new Xe(function(n){var r=!1,i=new te(e.subscribe(function(t){r&&n.onNext(t)},n.onError.bind(n),function(){r&&n.onCompleted()})),o=new ue;return i.add(o),o.setDisposable(t.subscribe(function(){r=!0,o.dispose()},n.onError.bind(n),function(){o.dispose()})),i})},Oe["switch"]=Oe.switchLatest=function(){var t=this;return new Xe(function(e){var n=!1,r=new ce,i=!1,o=0,s=t.subscribe(function(t){var s=new ue,u=++o;n=!0,r.setDisposable(s),s.setDisposable(t.subscribe(function(t){o===u&&e.onNext(t)},function(t){o===u&&e.onError(t)},function(){o===u&&(n=!1,i&&e.onCompleted())}))},e.onError.bind(e),function(){i=!0,n||e.onCompleted()});return new te(s,r)})},Oe.takeUntil=function(t){var e=this;return new Xe(function(r){return new te(e.subscribe(r),t.subscribe(r.onCompleted.bind(r),r.onError.bind(r),n))})},Oe.zip=function(){if(Array.isArray(arguments[0]))return b.apply(this,arguments);var t=this,n=X.call(arguments),i=n.pop();return n.unshift(t),new Xe(function(o){function s(t){a[t]=!0,a.every(function(t){return t})&&o.onCompleted()}for(var u=n.length,c=p(u,function(){return[]}),a=p(u,function(){return!1}),l=function(n){var s,u;if(c.every(function(t){return t.length>0})){try{u=c.map(function(t){return t.shift()}),s=i.apply(t,u)}catch(l){return o.onError(l),e}o.onNext(s)}else a.filter(function(t,e){return e!==n}).every(r)&&o.onCompleted()},h=Array(u),f=0;u>f;f++)(function(t){h[t]=new ue,h[t].setDisposable(n[t].subscribe(function(e){c[t].push(e),l(t)},o.onError.bind(o),function(){s(t)}))})(f);return new te(h)})},We.zip=function(){var t=X.call(arguments,0),e=t.shift();return e.zip.apply(e,t)},We.zipArray=function(){var t=X.call(arguments);return new Xe(function(n){function i(t){if(u.every(function(t){return t.length>0})){var i=u.map(function(t){return t.shift()});n.onNext(i)}else if(c.filter(function(e,n){return n!==t}).every(r))return n.onCompleted(),e}function o(t){return c[t]=!0,c.every(r)?(n.onCompleted(),e):e}for(var s=t.length,u=p(s,function(){return[]}),c=p(s,function(){return!1}),a=Array(s),l=0;s>l;l++)(function(e){a[e]=new ue,a[e].setDisposable(t[e].subscribe(function(t){u[e].push(t),i(e)},n.onError.bind(n),function(){o(e)}))})(l);var h=new te(a);return h.add(re(function(){for(var t=0,e=u.length;e>t;t++)u[t]=[]})),h})},Oe.asObservable=function(){var t=this;return new Xe(function(e){return t.subscribe(e)})},Oe.dematerialize=function(){var t=this;return new Xe(function(e){return t.subscribe(function(t){return t.accept(e)},e.onError.bind(e),e.onCompleted.bind(e))})},Oe.distinctUntilChanged=function(t,n){var o=this;return t||(t=r),n||(n=i),new Xe(function(r){var i,s=!1;return o.subscribe(function(o){var u,c=!1;try{u=t(o)}catch(a){return r.onError(a),e}if(s)try{c=n(i,u)}catch(a){return r.onError(a),e}s&&c||(s=!0,i=u,r.onNext(o))},r.onError.bind(r),r.onCompleted.bind(r))})},Oe["do"]=Oe.doAction=function(t,e,n){var r,i=this;return"function"==typeof t?r=t:(r=t.onNext.bind(t),e=t.onError.bind(t),n=t.onCompleted.bind(t)),new Xe(function(t){return i.subscribe(function(e){try{r(e)}catch(n){t.onError(n)}t.onNext(e)},function(n){if(e){try{e(n)}catch(r){t.onError(r)}t.onError(n)}else t.onError(n)},function(){if(n){try{n()}catch(e){t.onError(e)}t.onCompleted()}else t.onCompleted()})})},Oe["finally"]=Oe.finallyAction=function(t){var e=this;return new Xe(function(n){var r=e.subscribe(n);return re(function(){try{r.dispose()}catch(e){throw e}finally{t()}})})},Oe.ignoreElements=function(){var t=this;return new Xe(function(e){return t.subscribe(n,e.onError.bind(e),e.onCompleted.bind(e))})},Oe.materialize=function(){var t=this;return new Xe(function(e){return t.subscribe(function(t){e.onNext(ye(t))},function(t){e.onNext(we(t)),e.onCompleted()},function(){e.onNext(ge()),e.onCompleted()})})},Oe.repeat=function(t){return De(this,t).concat()},Oe.retry=function(t){return De(this,t).catchException()},Oe.scan=function(){var t,n,r=!1,i=this;return 2===arguments.length?(r=!0,t=arguments[0],n=arguments[1]):n=arguments[0],new Xe(function(o){var s,u,c;return i.subscribe(function(i){try{c||(c=!0),s?u=n(u,i):(u=r?n(t,i):i,s=!0)}catch(a){return o.onError(a),e}o.onNext(u)},o.onError.bind(o),function(){!c&&r&&o.onNext(t),o.onCompleted()})})},Oe.skipLast=function(t){var e=this;return new Xe(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&n.onNext(r.shift())},n.onError.bind(n),n.onCompleted.bind(n))})},Oe.startWith=function(){var t,e,n=0;return arguments.length&&"now"in Object(arguments[0])?(e=arguments[0],n=1):e=pe,t=X.call(arguments,n),Se([Te(t,e),this]).concat()},Oe.takeLast=function(t,e){return this.takeLastBuffer(t).selectMany(function(t){return Te(t,e)})},Oe.takeLastBuffer=function(t){var e=this;return new Xe(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&r.shift()},n.onError.bind(n),function(){n.onNext(r),n.onCompleted()})})},Oe.select=Oe.map=function(t,n){var r=this;return new Xe(function(i){var o=0;return r.subscribe(function(s){var u;try{u=t.call(n,s,o++,r)}catch(c){return i.onError(c),e}i.onNext(u)},i.onError.bind(i),i.onCompleted.bind(i))})},Oe.selectMany=Oe.flatMap=function(t,e){return e?this.selectMany(function(n){return t(n).select(function(t){return e(n,t)})}):"function"==typeof t?v.call(this,t):v.call(this,function(){return t})},Oe.selectSwitch=Oe.flatMapLatest=function(t,e){return this.select(t,e).switchLatest()},Oe.skip=function(t){if(0>t)throw Error(_);var e=this;return new Xe(function(n){var r=t;return e.subscribe(function(t){0>=r?n.onNext(t):r--},n.onError.bind(n),n.onCompleted.bind(n))})},Oe.skipWhile=function(t,n){var r=this;return new Xe(function(i){var o=0,s=!1;return r.subscribe(function(u){if(!s)try{s=!t.call(n,u,o++,r)}catch(c){return i.onError(c),e}s&&i.onNext(u)},i.onError.bind(i),i.onCompleted.bind(i))})},Oe.take=function(t,e){if(0>t)throw Error(_);if(0===t)return qe(e);var n=this;return new Xe(function(e){var r=t;return n.subscribe(function(t){r>0&&(r--,e.onNext(t),0===r&&e.onCompleted())},e.onError.bind(e),e.onCompleted.bind(e))})},Oe.takeWhile=function(t,n){var r=this;return new Xe(function(i){var o=0,s=!0;return r.subscribe(function(u){if(s){try{s=t.call(n,u,o++,r)}catch(c){return i.onError(c),e}s?i.onNext(u):i.onCompleted()}},i.onError.bind(i),i.onCompleted.bind(i))})},Oe.where=Oe.filter=function(t,n){var r=this;return new Xe(function(i){var o=0;return r.subscribe(function(s){var u;try{u=t.call(n,s,o++,r)}catch(c){return i.onError(c),e}u&&i.onNext(s)},i.onError.bind(i),i.onCompleted.bind(i))})},We.fromCallback=function(t,n,r,i){return n||(n=ve),function(){var o=X.call(arguments,0),s=new Ge;return n.schedule(function(){function n(t){var n=t;if(i)try{n=i(arguments)}catch(r){return s.onError(r),e}else 1===n.length&&(n=n[0]);s.onNext(n),s.onCompleted()}o.push(n),t.apply(r,o)}),s.asObservable()}},We.fromNodeCallback=function(t,n,r,i){return n||(n=ve),function(){var o=X.call(arguments,0),s=new Ge;return n.schedule(function(){function n(t){if(t)return s.onError(t),e;var n=X.call(arguments,1);if(i)try{n=i(n)}catch(r){return s.onError(r),e}else 1===n.length&&(n=n[0]);s.onNext(n),s.onCompleted()}o.push(n),t.apply(r,o)}),s.asObservable()}},We.fromEvent=function(t,n,r){return new Xe(function(i){return w(t,n,function(t){var n=t;if(r)try{n=r(arguments)}catch(o){return i.onError(o),e}i.onNext(n)})}).publish().refCount()},We.fromEventPattern=function(t,n,r){return new Xe(function(i){function o(t){var n=t; | ||
if(r)try{n=r(arguments)}catch(o){return i.onError(o),e}i.onNext(n)}var s=t(o);return re(function(){n&&n(o,s)})}).publish().refCount()},We.fromPromise=function(t){var e=new Ge;return t.then(function(t){e.onNext(t),e.onCompleted()},function(t){e.onError(t)}),e.asObservable()},Oe.multicast=function(t,e){var n=this;return"function"==typeof t?new Xe(function(r){var i=n.multicast(t());return new te(e(i).subscribe(r),i.connect())}):new Ue(n,t)},Oe.publish=function(t){return t?this.multicast(function(){return new Je},t):this.multicast(new Je)},Oe.publishLast=function(t){return t?this.multicast(function(){return new Ge},t):this.multicast(new Ge)},Oe.publishValue=function(t,e){return 2===arguments.length?this.multicast(function(){return new Ze(e)},t):this.multicast(new Ze(t))},Oe.replay=function(t,e,n,r){return t?this.multicast(function(){return new $e(e,n,r)},t):this.multicast(new $e(e,n,r))};var Ue=function(t){function e(e,n){function r(t){return i.subject.subscribe(t)}var i={subject:n,source:e.asObservable(),hasSubscription:!1,subscription:null};this.connect=function(){return i.hasSubscription||(i.hasSubscription=!0,i.subscription=new te(i.source.subscribe(i.subject),re(function(){i.hasSubscription=!1}))),i.subscription},t.call(this,r)}return Q(e,t),e.prototype.connect=function(){return this.connect()},e.prototype.refCount=function(){var t=null,e=0,n=this;return new Xe(function(r){var i,o;return e++,i=1===e,o=n.subscribe(r),i&&(t=n.connect()),re(function(){o.dispose(),e--,0===e&&t.dispose()})})},e}(We),Fe=We.interval=function(t,e){return e||(e=ve),E(t,t,e)},He=We.timer=function(t,n,r){var i;return r||(r=ve),"number"==typeof n?i=n:"object"==typeof n&&"now"in n&&(r=n),i===e?g(t,r):E(t,i,r)};Oe.delay=function(t,e){e||(e=ve);var n=this;return new Xe(function(r){var i,o=!1,s=new ce,u=null,c=[],a=!1;return i=n.materialize().timestamp(e).subscribe(function(n){var i,l;"E"===n.value.kind?(c=[],c.push(n),u=n.value.exception,l=!a):(c.push({value:n.value,timestamp:n.timestamp+t}),l=!o,o=!0),l&&(null!==u?r.onError(u):(i=new ue,s.setDisposable(i),i.setDisposable(e.scheduleRecursiveWithRelative(t,function(t){var n,i,s,l;if(null===u){a=!0;do s=null,c.length>0&&0>=c[0].timestamp-e.now()&&(s=c.shift().value),null!==s&&s.accept(r);while(null!==s);l=!1,i=0,c.length>0?(l=!0,i=Math.max(0,c[0].timestamp-e.now())):o=!1,n=u,a=!1,null!==n?r.onError(n):l&&t(i)}}))))}),new te(i,s)})},Oe.throttle=function(t,e){return e||(e=ve),this.throttleWithSelector(function(){return He(t,e)})},Oe.timeInterval=function(t){var e=this;return t||(t=ve),ke(function(){var n=t.now();return e.select(function(e){var r=t.now(),i=r-n;return n=r,{value:e,interval:i}})})},Oe.timestamp=function(t){return t||(t=ve),this.select(function(e){return{value:e,timestamp:t.now()}})},Oe.sample=function(t,e){return e||(e=ve),"number"==typeof t?x(this,Fe(t,e)):x(this,t)},Oe.timeout=function(t,e,n){var r,i=this;return e||(e=Le(Error("Timeout"))),n||(n=ve),r=t instanceof Date?function(t,e){n.scheduleWithAbsolute(t,e)}:function(t,e){n.scheduleWithRelative(t,e)},new Xe(function(n){var o,s=0,u=new ue,c=new ce,a=!1,l=new ce;return c.setDisposable(u),o=function(){var i=s;l.setDisposable(r(t,function(){a=s===i;var t=a;t&&c.setDisposable(e.subscribe(n))}))},o(),u.setDisposable(i.subscribe(function(t){var e=!a;e&&(s++,n.onNext(t),o())},function(t){var e=!a;e&&(s++,n.onError(t))},function(){var t=!a;t&&(s++,n.onCompleted())})),new te(c,l)})},We.generateWithTime=function(t,n,r,i,o,s){return s||(s=ve),new Xe(function(u){var c,a,l=!0,h=!1,f=t;return s.scheduleRecursiveWithRelative(0,function(t){h&&u.onNext(c);try{l?l=!1:f=r(f),h=n(f),h&&(c=i(f),a=o(f))}catch(s){return u.onError(s),e}h?t(a):u.onCompleted()})})},Oe.delaySubscription=function(t,e){return e||(e=ve),this.delayWithSelector(He(t,e),function(){return qe()})},Oe.delayWithSelector=function(t,n){var r,i,o=this;return"function"==typeof t?i=t:(r=t,i=n),new Xe(function(t){var n=new te,s=!1,u=function(){s&&0===n.length&&t.onCompleted()},c=new ce,a=function(){c.setDisposable(o.subscribe(function(r){var o;try{o=i(r)}catch(s){return t.onError(s),e}var c=new ue;n.add(c),c.setDisposable(o.subscribe(function(){t.onNext(r),n.remove(c),u()},t.onError.bind(t),function(){t.onNext(r),n.remove(c),u()}))},t.onError.bind(t),function(){s=!0,c.dispose(),u()}))};return r?c.setDisposable(r.subscribe(function(){a()},t.onError.bind(t),function(){a()})):a(),new te(c,n)})},Oe.timeoutWithSelector=function(t,n,r){if(1===arguments.length){n=t;var t=Ie()}r||(r=Le(Error("Timeout")));var i=this;return new Xe(function(o){var s=new ce,u=new ce,c=new ue;s.setDisposable(c);var a=0,l=!1,h=function(t){var e=a,n=function(){return a===e},i=new ue;u.setDisposable(i),i.setDisposable(t.subscribe(function(){n()&&s.setDisposable(r.subscribe(o)),i.dispose()},function(t){n()&&o.onError(t)},function(){n()&&s.setDisposable(r.subscribe(o))}))};h(t);var f=function(){var t=!l;return t&&a++,t};return c.setDisposable(i.subscribe(function(t){if(f()){o.onNext(t);var r;try{r=n(t)}catch(i){return o.onError(i),e}h(r)}},function(t){f()&&o.onError(t)},function(){f()&&o.onCompleted()})),new te(s,u)})},Oe.throttleWithSelector=function(t){var n=this;return new Xe(function(r){var i,o=!1,s=new ce,u=0,c=n.subscribe(function(n){var c;try{c=t(n)}catch(a){return r.onError(a),e}o=!0,i=n,u++;var l=u,h=new ue;s.setDisposable(h),h.setDisposable(c.subscribe(function(){o&&u===l&&r.onNext(i),o=!1,h.dispose()},r.onError.bind(r),function(){o&&u===l&&r.onNext(i),o=!1,h.dispose()}))},function(t){s.dispose(),r.onError(t),o=!1,u++},function(){s.dispose(),o&&r.onNext(i),r.onCompleted(),o=!1,u++});return new te(c,s)})},Oe.skipLastWithTime=function(t,e){e||(e=ve);var n=this;return new Xe(function(r){var i=[];return n.subscribe(function(n){var o=e.now();for(i.push({interval:o,value:n});i.length>0&&o-i[0].interval>=t;)r.onNext(i.shift().value)},r.onError.bind(r),function(){for(var n=e.now();i.length>0&&n-i[0].interval>=t;)r.onNext(i.shift().value);r.onCompleted()})})},Oe.takeLastWithTime=function(t,e,n){return this.takeLastBufferWithTime(t,e).selectMany(function(t){return Te(t,n)})},Oe.takeLastBufferWithTime=function(t,e){var n=this;return e||(e=ve),new Xe(function(r){var i=[];return n.subscribe(function(n){var r=e.now();for(i.push({interval:r,value:n});i.length>0&&r-i[0].interval>=t;)i.shift()},r.onError.bind(r),function(){for(var n=e.now(),o=[];i.length>0;){var s=i.shift();t>=n-s.interval&&o.push(s.value)}r.onNext(o),r.onCompleted()})})},Oe.takeWithTime=function(t,e){var n=this;return e||(e=ve),new Xe(function(r){var i=e.scheduleWithRelative(t,function(){r.onCompleted()});return new te(i,n.subscribe(r))})},Oe.skipWithTime=function(t,e){var n=this;return e||(e=ve),new Xe(function(r){var i=!1,o=e.scheduleWithRelative(t,function(){i=!0}),s=n.subscribe(function(t){i&&r.onNext(t)},r.onError.bind(r),r.onCompleted.bind(r));return new te(o,s)})},Oe.skipUntilWithTime=function(t,e){e||(e=ve);var n=this;return new Xe(function(r){var i=!1,o=e.scheduleWithAbsolute(t,function(){i=!0}),s=n.subscribe(function(t){i&&r.onNext(t)},r.onError.bind(r),r.onCompleted.bind(r));return new te(o,s)})},Oe.takeUntilWithTime=function(t,e){e||(e=ve);var n=this;return new Xe(function(r){return new te(e.scheduleWithAbsolute(t,function(){r.onCompleted()}),n.subscribe(r))})};var Xe=N.Internals.AnonymousObservable=function(t){function n(t){return t===e?t=ie:"function"==typeof t&&(t=re(t)),t}function r(i){function o(t){var e=new Qe(t);if(fe.scheduleRequired())fe.schedule(function(){try{e.setDisposable(n(i(e)))}catch(t){if(!e.fail(t))throw t}});else try{e.setDisposable(n(i(e)))}catch(r){if(!e.fail(r))throw r}return e}return this instanceof r?(t.call(this,o),e):new r(i)}return Q(r,t),r}(We),Qe=function(t){function e(e){t.call(this),this.observer=e,this.m=new ue}Q(e,t);var n=e.prototype;return n.next=function(t){var e=!1;try{this.observer.onNext(t),e=!0}catch(n){throw n}finally{e||this.dispose()}},n.error=function(t){try{this.observer.onError(t)}catch(e){throw e}finally{this.dispose()}},n.completed=function(){try{this.observer.onCompleted()}catch(t){throw t}finally{this.dispose()}},n.setDisposable=function(t){this.m.setDisposable(t)},n.getDisposable=function(){return this.m.getDisposable()},n.disposable=function(t){return arguments.length?this.getDisposable():setDisposable(t)},n.dispose=function(){t.prototype.dispose.call(this),this.m.dispose()},e}(_e),Ke=function(t,e){this.subject=t,this.observer=e};Ke.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1),this.observer=null}};var Je=N.Subject=function(t){function e(t){return u.call(this),this.isStopped?this.exception?(t.onError(this.exception),ie):(t.onCompleted(),ie):(this.observers.push(t),new Ke(this,t))}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return Q(n,t),K(n.prototype,Ne,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(u.call(this),!this.isStopped){var t=this.observers.slice(0);this.isStopped=!0;for(var e=0,n=t.length;n>e;e++)t[e].onCompleted();this.observers=[]}},onError:function(t){if(u.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){if(u.call(this),!this.isStopped)for(var e=this.observers.slice(0),n=0,r=e.length;r>n;n++)e[n].onNext(t)},dispose:function(){this.isDisposed=!0,this.observers=null}}),n.create=function(t,e){return new Ye(t,e)},n}(We),Ge=N.AsyncSubject=function(t){function e(t){if(u.call(this),!this.isStopped)return this.observers.push(t),new Ke(this,t);var e=this.exception,n=this.hasValue,r=this.value;return e?t.onError(e):n?(t.onNext(r),t.onCompleted()):t.onCompleted(),ie}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return Q(n,t),K(n.prototype,Ne,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){var t,e,n;if(u.call(this),!this.isStopped){var r=this.observers.slice(0);this.isStopped=!0;var i=this.value,o=this.hasValue;if(o)for(e=0,n=r.length;n>e;e++)t=r[e],t.onNext(i),t.onCompleted();else for(e=0,n=r.length;n>e;e++)r[e].onCompleted();this.observers=[]}},onError:function(t){if(u.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){u.call(this),this.isStopped||(this.value=t,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),n}(We),Ye=function(t){function e(t){return this.observable.subscribe(t)}function n(n,r){t.call(this,e),this.observer=n,this.observable=r}return Q(n,t),K(n.prototype,Ne,{onCompleted:function(){this.observer.onCompleted()},onError:function(t){this.observer.onError(t)},onNext:function(t){this.observer.onNext(t)}}),n}(We),Ze=N.BehaviorSubject=function(t){function e(t){if(u.call(this),!this.isStopped)return this.observers.push(t),t.onNext(this.value),new Ke(this,t);var e=this.exception;return e?t.onError(e):t.onCompleted(),ie}function n(n){t.call(this,e),this.value=n,this.observers=[],this.isDisposed=!1,this.isStopped=!1,this.exception=null}return Q(n,t),K(n.prototype,Ne,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(u.call(this),!this.isStopped){var t=this.observers.slice(0);this.isStopped=!0;for(var e=0,n=t.length;n>e;e++)t[e].onCompleted();this.observers=[]}},onError:function(t){if(u.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){if(u.call(this),!this.isStopped){this.value=t;for(var e=this.observers.slice(0),n=0,r=e.length;r>n;n++)e[n].onNext(t)}},dispose:function(){this.isDisposed=!0,this.observers=null,this.value=null,this.exception=null}}),n}(We),$e=N.ReplaySubject=function(t){function e(t,e){this.subject=t,this.observer=e}function n(t){var n=new je(this.scheduler,t),r=new e(this,n);u.call(this),this._trim(this.scheduler.now()),this.observers.push(n);for(var i=this.q.length,o=0,s=this.q.length;s>o;o++)n.onNext(this.q[o].value);return this.hasError?(i++,n.onError(this.error)):this.isStopped&&(i++,n.onCompleted()),n.ensureActive(i),r}function r(e,r,i){this.bufferSize=null==e?Number.MAX_VALUE:e,this.windowSize=null==r?Number.MAX_VALUE:r,this.scheduler=i||fe,this.q=[],this.observers=[],this.isStopped=!1,this.isDisposed=!1,this.hasError=!1,this.error=null,t.call(this,n)}return e.prototype.dispose=function(){if(this.observer.dispose(),!this.subject.isDisposed){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1)}},Q(r,t),K(r.prototype,Ne,{hasObservers:function(){return this.observers.length>0},_trim:function(t){for(;this.q.length>this.bufferSize;)this.q.shift();for(;this.q.length>0&&t-this.q[0].interval>this.windowSize;)this.q.shift()},onNext:function(t){var e;if(u.call(this),!this.isStopped){var n=this.scheduler.now();this.q.push({interval:n,value:t}),this._trim(n);for(var r=this.observers.slice(0),i=0,o=r.length;o>i;i++)e=r[i],e.onNext(t),e.ensureActive()}},onError:function(t){var e;if(u.call(this),!this.isStopped){this.isStopped=!0,this.error=t,this.hasError=!0;var n=this.scheduler.now();this._trim(n);for(var r=this.observers.slice(0),i=0,o=r.length;o>i;i++)e=r[i],e.onError(t),e.ensureActive();this.observers=[]}},onCompleted:function(){var t;if(u.call(this),!this.isStopped){this.isStopped=!0;var e=this.scheduler.now();this._trim(e);for(var n=this.observers.slice(0),r=0,i=n.length;i>r;r++)t=n[r],t.onCompleted(),t.ensureActive();this.observers=[]}},dispose:function(){this.isDisposed=!0,this.observers=null}}),r}(We);return"function"==typeof define&&"object"==typeof define.amd&&define.amd?(t.Rx=N,define(function(){return N})):(C?"object"==typeof module&&module&&module.exports==C?module.exports=N:C=N:t.Rx=N,e)})(this); | ||
(function(a){function b(){}function c(a){return a}function d(a,b){return V(a,b)}function e(a,b){return a-b}function f(a){throw a}function g(){if(this.isDisposed)throw new Error(H)}function h(a){return"function"!=typeof a.toString&&"string"==typeof(a+"")}function i(a){return a&&"object"==typeof a?R.call(a)==I:!1}function j(a){return"function"==typeof a}function k(a,b,c,d){var e;if(a===b)return 0!==a||1/a==1/b;var f=typeof a,g=typeof b;if(!(a!==a||a&&w[f]||b&&w[g]))return!1;if(null==a||null==b)return a===b;var l=R.call(a),m=R.call(b);if(l==I&&(l=O),m==I&&(m=O),l!=m)return!1;switch(l){case K:case L:return+a==+b;case N:return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case P:case Q:return a==String(b)}var n=l==J;if(!n){if(l!=O||!C&&(h(a)||h(b)))return!1;var o=!T&&i(a)?Object:a.constructor,p=!T&&i(b)?Object:b.constructor;if(o!=p&&!(j(o)&&o instanceof o&&j(p)&&p instanceof p))return!1}for(var q=c.length;q--;)if(c[q]==a)return d[q]==b;var r=0;if(e=!0,c.push(a),d.push(b),n){for(q=a.length,r=b.length,e=r==a.length;r--;){var s=b[r];if(!(e=k(a[r],s,c,d)))break}return e}for(var t in b)if(S.call(b,t))return r++,e=S.call(a,t)&&k(a[t],b[t],c,d);if(e)for(var t in a)if(S.call(a,t))return e=--r>-1;return c.pop(),d.pop(),e}function l(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:W.call(a)}function m(a,b){for(var c=new Array(a),d=0;a>d;d++)c[d]=b();return c}function n(a,b){return new Yb(function(c){var d=new ib,e=new jb;return e.setDisposable(d),d.setDisposable(a.subscribe(c.onNext.bind(c),function(a){var d,f;try{f=b(a)}catch(g){return c.onError(g),void 0}d=new ib,e.setDisposable(d),d.setDisposable(f.subscribe(c))},c.onCompleted.bind(c))),e})}function o(a,b){var c=this;return new Yb(function(d){var e=0,f=a.length;return c.subscribe(function(c){if(f>e){var g,h=a[e++];try{g=b(c,h)}catch(i){return d.onError(i),void 0}d.onNext(g)}else d.onCompleted()},d.onError.bind(d),d.onCompleted.bind(d))})}function p(a){return this.select(a).mergeObservable()}function q(a){var b=function(){this.cancelBubble=!0},c=function(){if(this.bubbledKeyCode=this.keyCode,this.ctrlKey)try{this.keyCode=0}catch(a){}this.defaultPrevented=!0,this.returnValue=!1,this.modified=!0};if(a||(a=window.event),!a.target)switch(a.target=a.target||a.srcElement,"mouseover"==a.type&&(a.relatedTarget=a.fromElement),"mouseout"==a.type&&(a.relatedTarget=a.toElement),a.stopPropagation||(a.stopPropagation=b,a.preventDefault=c),a.type){case"keypress":var d="charCode"in a?a.charCode:a.keyCode;10==d?(d=0,a.keyCode=13):13==d||27==d?d=0:3==d&&(d=99),a.charCode=d,a.keyChar=a.charCode?String.fromCharCode(a.charCode):""}return a}function r(a,b,c){if(a.addListener)return a.addListener(b,c),fb(function(){a.removeListener(b,c)});if(a.addEventListener)return a.addEventListener(b,c,!1),fb(function(){a.removeEventListener(b,c,!1)});if(a.attachEvent){var d=function(a){c(q(a))};return a.attachEvent("on"+b,d),fb(function(){a.detachEvent("on"+b,d)})}return a["on"+b]=c,fb(function(){a["on"+b]=null})}function s(a,b,c){var d=new cb;if(a&&a.length)for(var e=0,f=a.length;f>e;e++)d.add(s(a[e],b,c));else a&&d.add(r(a,b,c));return d}function t(a,b){var c=mb(a);return new Yb(function(a){return b.scheduleWithRelative(c,function(){a.onNext(0),a.onCompleted()})})}function u(a,b,c){return a===b?new Yb(function(a){return c.schedulePeriodicWithState(0,b,function(b){return a.onNext(b),b+1})}):Lb(function(){return observableTimerDateAndPeriod(c.now()+a,b,c)})}function v(a,b){return new Yb(function(c){function d(){g&&(g=!1,c.onNext(f)),e&&c.onCompleted()}var e,f,g;return new cb(a.subscribe(function(a){g=!0,f=a},c.onError.bind(c),function(){e=!0}),b.subscribe(d,c.onError.bind(c),d))})}var w={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},x=w[typeof window]&&window||this,y=w[typeof exports]&&exports&&!exports.nodeType&&exports,z=w[typeof module]&&module&&!module.nodeType&&module,A=z&&z.exports===y&&y,B=w[typeof global]&&global;!B||B.global!==B&&B.window!==B||(x=B);var C,D={Internals:{}},E=function(){return Date.now?Date.now:function(){return+new Date}}(),F="Sequence contains no elements.",G="Argument out of range",H="Object has been disposed",w={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},I="[object Arguments]",J="[object Array]",K="[object Boolean]",L="[object Date]",M="[object Function]",N="[object Number]",O="[object Object]",P="[object RegExp]",Q="[object String]",R=Object.prototype.toString,S=Object.prototype.hasOwnProperty,T=R.call(arguments)==I;try{C=!(R.call(document)==O&&!({toString:0}+""))}catch(U){C=!0}T||(i=function(a){return a&&"object"==typeof a?S.call(a,"callee"):!1}),j(/x/)&&(j=function(a){return"function"==typeof a&&R.call(a)==M});var V=D.Internals.isEqual=function(a,b){return k(a,b,[],[])},W=Array.prototype.slice;({}).hasOwnProperty;var X=this.inherits=D.Internals.inherits=function(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c},Y=D.Internals.addProperties=function(a){for(var b=W.call(arguments,1),c=0,d=b.length;d>c;c++){var e=b[c];for(var f in e)a[f]=e[f]}};D.Internals.addRef=function(a,b){return new Yb(function(c){return new cb(b.getDisposable(),a.subscribe(c))})},Function.prototype.bind||(Function.prototype.bind=function(a){var b=this,c=W.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(W.call(arguments)));return Object(g)===g?g:f}return b.apply(a,c.concat(W.call(arguments)))};return d});var Z=Object("a"),$="a"!=Z[0]||!(0 in Z);Array.prototype.every||(Array.prototype.every=function(a){var b=Object(this),c=$&&"[object String]"=={}.toString.call(this)?this.split(""):b,d=c.length>>>0,e=arguments[1];if("[object Function]"!={}.toString.call(a))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=$&&"[object String]"=={}.toString.call(this)?this.split(""):b,d=c.length>>>0,e=Array(d),f=arguments[1];if("[object Function]"!={}.toString.call(a))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"[object Array]"==Object.prototype.toString.call(a)}),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});var _=function(a,b){this.id=a,this.value=b};_.prototype.compareTo=function(a){var b=this.value.compareTo(a.value);return 0===b&&(b=this.id-a.id),b};var ab=D.Internals.PriorityQueue=function(a){this.items=new Array(a),this.length=0},bb=ab.prototype;bb.isHigherPriority=function(a,b){return this.items[a].compareTo(this.items[b])<0},bb.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)}}},bb.heapify=function(b){if(b===a&&(b=0),!(b>=this.length||0>b)){var c=2*b+1,d=2*b+2,e=b;if(c<this.length&&this.isHigherPriority(c,e)&&(e=c),d<this.length&&this.isHigherPriority(d,e)&&(e=d),e!==b){var f=this.items[b];this.items[b]=this.items[e],this.items[e]=f,this.heapify(e)}}},bb.peek=function(){return this.items[0].value},bb.removeAt=function(a){this.items[a]=this.items[--this.length],delete this.items[this.length],this.heapify()},bb.dequeue=function(){var a=this.peek();return this.removeAt(0),a},bb.enqueue=function(a){var b=this.length++;this.items[b]=new _(ab.count++,a),this.percolate(b)},bb.remove=function(a){for(var b=0;b<this.length;b++)if(this.items[b].value===a)return this.removeAt(b),!0;return!1},ab.count=0;var cb=D.CompositeDisposable=function(){this.disposables=l(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},db=cb.prototype;db.add=function(a){this.isDisposed?a.dispose():(this.disposables.push(a),this.length++)},db.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},db.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()}},db.clear=function(){var a=this.disposables.slice(0);this.disposables=[],this.length=0;for(var b=0,c=a.length;c>b;b++)a[b].dispose()},db.contains=function(a){return-1!==this.disposables.indexOf(a)},db.toArray=function(){return this.disposables.slice(0)};var eb=D.Disposable=function(a){this.isDisposed=!1,this.action=a||b};eb.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var fb=eb.create=function(a){return new eb(a)},gb=eb.empty={dispose:b},hb=function(){function a(a){this.isSingle=a,this.isDisposed=!1,this.current=null}var b=a.prototype;return b.getDisposable=function(){return this.current},b.setDisposable=function(a){if(this.current&&this.isSingle)throw new Error("Disposable has already been assigned");var b,c=this.isDisposed;c||(b=this.current,this.current=a),b&&b.dispose(),c&&a&&a.dispose()},b.dispose=function(){var a;this.isDisposed||(this.isDisposed=!0,a=this.current,this.current=null),a&&a.dispose()},a}(),ib=D.SingleAssignmentDisposable=function(a){function b(){a.call(this,!0)}return X(b,a),b}(hb),jb=D.SerialDisposable=function(a){function b(){a.call(this,!1)}return X(b,a),b}(hb);D.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?gb:new a(this)},b}();var kb=D.Internals.ScheduledItem=function(a,b,c,d,f){this.scheduler=a,this.state=b,this.action=c,this.dueTime=d,this.comparer=f||e,this.disposable=new ib};kb.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},kb.prototype.compareTo=function(a){return this.comparer(this.dueTime,a.dueTime)},kb.prototype.isCancelled=function(){return this.disposable.isDisposed},kb.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var lb=D.Scheduler=function(){function a(a,b,c,d){this.now=a,this._schedule=b,this._scheduleRelative=c,this._scheduleAbsolute=d}function b(a,b){var c=b.first,d=b.second,e=new cb,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),gb});d||(e.add(g),c=!0)})};return f(c),e}function c(a,b,c){var d=b.first,e=b.second,f=new cb,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),gb});h||(f.add(i),e=!0)})};return g(d),f}function d(a,b){return b(),gb}var e=a.prototype;return e.schedulePeriodic=function(a,b){return this.schedulePeriodicWithState(null,a,function(){b()})},e.schedulePeriodicWithState=function(a,b,c){var d=a,e=setInterval(function(){d=c(d)},b);return fb(function(){clearInterval(e)})},e.schedule=function(a){return this._schedule(a,d)},e.scheduleWithState=function(a,b){return this._schedule(a,b)},e.scheduleWithRelative=function(a,b){return this._scheduleRelative(b,a,d)},e.scheduleWithRelativeAndState=function(a,b,c){return this._scheduleRelative(a,b,c)},e.scheduleWithAbsolute=function(a,b){return this._scheduleAbsolute(b,a,d)},e.scheduleWithAbsoluteAndState=function(a,b,c){return this._scheduleAbsolute(a,b,c)},e.scheduleRecursive=function(a){return this.scheduleRecursiveWithState(a,function(a,b){a(function(){b(a)})})},e.scheduleRecursiveWithState=function(a,c){return this.scheduleWithState({first:a,second:c},function(a,c){return b(a,c)})},e.scheduleRecursiveWithRelative=function(a,b){return this.scheduleRecursiveWithRelativeAndState(b,a,function(a,b){a(function(c){b(a,c)})})},e.scheduleRecursiveWithRelativeAndState=function(a,b,d){return this._scheduleRelative({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithRelativeAndState")})},e.scheduleRecursiveWithAbsolute=function(a,b){return this.scheduleRecursiveWithAbsoluteAndState(b,a,function(a,b){a(function(c){b(a,c)})})},e.scheduleRecursiveWithAbsoluteAndState=function(a,b,d){return this._scheduleAbsolute({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithAbsoluteAndState")})},a.now=E,a.normalize=function(a){return 0>a&&(a=0),a},a}(),mb=lb.normalize,nb=lb.immediate=function(){function a(a,b){return b(this,a)}function b(a,b,c){for(var d=mb(d);d-this.now()>0;);return c(this,a)}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new lb(E,a,b,c)}(),ob=lb.currentThread=function(){function a(){e=new ab(4)}function b(a,b){return this.scheduleWithRelativeAndState(a,0,b)}function c(b,c,d){var f,g=this.now()+mb(c),h=new kb(this,b,d,g);if(e)e.enqueue(h);else{f=new a;try{e.enqueue(h),f.run()}catch(i){throw i}finally{f.dispose()}}return h.disposable}function d(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}var e;a.prototype.dispose=function(){e=null},a.prototype.run=function(){for(var a;e.length>0;)if(a=e.dequeue(),!a.isCancelled()){for(;a.dueTime-lb.now()>0;);a.isCancelled()||a.invoke()}};var f=new lb(E,b,c,d);return f.scheduleRequired=function(){return null===e},f.ensureTrampoline=function(a){return null===e?this.schedule(a):a()},f}();D.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 ib;return this._cancel=b,b.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,a.bind(this))),b},b}();var pb,qb=RegExp("^"+String(R).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),rb="function"==typeof(rb=B&&A&&B.setImmediate)&&!qb.test(rb)&&rb,sb="function"==typeof(sb=B&&A&&B.clearImmediate)&&!qb.test(sb)&&sb,tb=b;!function(){function a(){if(!x.postMessage||x.importScripts)return!1;var a=!1,b=x.onmessage;return x.onmessage=function(){a=!0},x.postMessage("","*"),x.onmessage=b,a}function b(a){if("string"==typeof a.data&&a.data.substring(0,c.length)===c){var b=a.data.substring(c.length),e=d[b];e(),delete d[b]}}if("function"==typeof rb)pb=rb,tb=sb;else if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))pb=process.nextTick;else if(a()){var c="ms.rx.schedule"+Math.random(),d={},e=0;x.addEventListener?x.addEventListener("message",b,!1):x.attachEvent("onmessage",b,!1),pb=function(a){var b=e++;d[b]=a,x.postMessage(c+b,"*")}}else if(x.MessageChannel){var f=new x.MessageChannel,g={},h=0;f.port1.onmessage=function(a){var b=a.data,c=g[b];c(),delete g[b]},pb=function(a){var b=h++;g[b]=a,f.port2.postMessage(b)}}else"document"in x&&"onreadystatechange"in x.document.createElement("script")?pb=function(a){var b=x.document.createElement("script");b.onreadystatechange=function(){a(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},x.document.documentElement.appendChild(b)}:(pb=function(a){return setTimeout(a,0)},tb=clearTimeout)}();var ub=lb.timeout=function(){function a(a,b){var c=this,d=new ib,e=pb(function(){d.isDisposed||d.setDisposable(b(c,a))});return new cb(d,fb(function(){tb(e)}))}function b(a,b,c){var d=this,e=lb.normalize(b);if(0===e)return d.scheduleWithState(a,c);var f=new ib,g=setTimeout(function(){f.isDisposed||f.setDisposable(c(d,a))},e);return new cb(f,fb(function(){clearTimeout(g)}))}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new lb(E,a,b,c)}(),vb=D.Notification=function(){function a(a,b){this.hasValue=null==b?!1:b,this.kind=a}var b=a.prototype;return b.accept=function(a,b,c){return 1===arguments.length&&"object"==typeof a?this._acceptObservable(a):this._accept(a,b,c)},b.toObservable=function(a){var b=this;return a||(a=nb),new Yb(function(c){return a.schedule(function(){b._acceptObservable(c),"N"===b.kind&&c.onCompleted()})})},a}(),wb=vb.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 vb("N",!0);return e.value=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),xb=vb.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 vb("E");return e.exception=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),yb=vb.createOnCompleted=function(){function a(a,b,c){return c()}function b(a){return a.onCompleted()}function c(){return"OnCompleted()"}return function(){var d=new vb("C");return d._accept=a,d._acceptObservable=b,d.toString=c,d}}(),zb=D.Internals.Enumerator=function(a,b){this.moveNext=a,this.getCurrent=b},Ab=zb.create=function(a,b){var c=!1;return new zb(function(){if(c)return!1;var b=a();return b||(c=!0),b},function(){return b()})},Bb=D.Internals.Enumerable=function(a){this.getEnumerator=a};Bb.prototype.concat=function(){var a=this;return new Yb(function(b){var c,d=a.getEnumerator(),e=new jb,f=nb.scheduleRecursive(function(a){var f,g;if(!c){try{g=d.moveNext(),g&&(f=d.getCurrent())}catch(h){return b.onError(h),void 0}if(!g)return b.onCompleted(),void 0;var i=new ib;e.setDisposable(i),i.setDisposable(f.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){a()}))}});return new cb(e,f,fb(function(){c=!0}))})},Bb.prototype.catchException=function(){var a=this;return new Yb(function(b){var c,d,e=a.getEnumerator(),f=new jb,g=nb.scheduleRecursive(function(a){var g,h;if(!c){try{h=e.moveNext(),h&&(g=e.getCurrent())}catch(i){return b.onError(i),void 0}if(!h)return d?b.onError(d):b.onCompleted(),void 0;var j=new ib;f.setDisposable(j),j.setDisposable(g.subscribe(b.onNext.bind(b),function(b){d=b,a()},b.onCompleted.bind(b)))}});return new cb(f,g,fb(function(){c=!0}))})};var Cb=Bb.repeat=function(a,b){return 1===arguments.length&&(b=-1),new Bb(function(){var c,d=b;return Ab(function(){return 0===d?!1:(d>0&&d--,c=a,!0)},function(){return c})})},Db=Bb.forEach=function(a,b,d){return b||(b=c),new Bb(function(){var c,e=-1;return Ab(function(){return++e<a.length?(c=b.call(d,a[e],e,a),!0):!1},function(){return c})})},Eb=D.Observer=function(){};Eb.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},Eb.prototype.asObserver=function(){return new Ib(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))};var Fb=Eb.create=function(a,c,d){return a||(a=b),c||(c=f),d||(d=b),new Ib(a,c,d)};Eb.fromNotifier=function(a){return new Ib(function(b){return a(wb(b))},function(b){return a(xb(b))},function(){return a(yb())})};var Gb,Hb=D.Internals.AbstractObserver=function(a){function b(){this.isStopped=!1,a.call(this)}return X(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}(Eb),Ib=D.AnonymousObserver=function(a){function b(b,c,d){a.call(this),this._onNext=b,this._onError=c,this._onCompleted=d}return X(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}(Hb),Jb=D.Observable=function(){function a(a){this._subscribe=a}return Gb=a.prototype,Gb.finalValue=function(){var a=this;return new Yb(function(b){var c,d=!1;return a.subscribe(function(a){d=!0,c=a},b.onError.bind(b),function(){d?(b.onNext(c),b.onCompleted()):b.onError(new Error(F))})})},Gb.subscribe=Gb.forEach=function(a,b,c){var d;return d="object"==typeof a?a:Fb(a,b,c),this._subscribe(d)},Gb.toArray=function(){function a(a,b){var c=a.slice(0);return c.push(b),c}return this.scan([],a).startWith([]).finalValue()},a}(),Kb=D.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 jb}return X(b,a),b.prototype.next=function(a){var b=this;this.queue.push(function(){b.observer.onNext(a)})},b.prototype.error=function(a){var b=this;this.queue.push(function(){b.observer.onError(a)})},b.prototype.completed=function(){var a=this;this.queue.push(function(){a.observer.onCompleted()})},b.prototype.ensureActive=function(){var a=!1,b=this;!this.hasFaulted&&this.queue.length>0&&(a=!this.isAcquired,this.isAcquired=!0),a&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(a){var c;if(!(b.queue.length>0))return b.isAcquired=!1,void 0;c=b.queue.shift();try{c()}catch(d){throw b.queue=[],b.hasFaulted=!0,d}a()}))},b.prototype.dispose=function(){a.prototype.dispose.call(this),this.disposable.dispose()},b}(Hb);Jb.create=Jb.createWithDisposable=function(a){return new Yb(a)};var Lb=Jb.defer=function(a){return new Yb(function(b){var c;try{c=a()}catch(d){return Qb(d).subscribe(b)}return c.subscribe(b)})},Mb=Jb.empty=function(a){return a||(a=nb),new Yb(function(b){return a.schedule(function(){b.onCompleted()})})},Nb=Jb.fromArray=function(a,b){return b||(b=ob),new Yb(function(c){var d=0;return b.scheduleRecursive(function(b){d<a.length?(c.onNext(a[d++]),b()):c.onCompleted()})})};Jb.generate=function(a,b,c,d,e){return e||(e=ob),new Yb(function(f){var g=!0,h=a;return e.scheduleRecursive(function(a){var e,i;try{g?g=!1:h=c(h),e=b(h),e&&(i=d(h))}catch(j){return f.onError(j),void 0}e?(f.onNext(i),a()):f.onCompleted()})})};var Ob=Jb.never=function(){return new Yb(function(){return gb})};Jb.range=function(a,b,c){return c||(c=ob),new Yb(function(d){return c.scheduleRecursiveWithState(0,function(c,e){b>c?(d.onNext(a+c),e(c+1)):d.onCompleted()})})},Jb.repeat=function(a,b,c){return c||(c=ob),null==b&&(b=-1),Pb(a,c).repeat(b)};var Pb=Jb["return"]=Jb.returnValue=function(a,b){return b||(b=nb),new Yb(function(c){return b.schedule(function(){c.onNext(a),c.onCompleted()})})},Qb=Jb["throw"]=Jb.throwException=function(a,b){return b||(b=nb),new Yb(function(c){return b.schedule(function(){c.onError(a)})})};Gb["catch"]=Gb.catchException=function(a){return"function"==typeof a?n(this,a):Rb([this,a])};var Rb=Jb.catchException=Jb["catch"]=function(){var a=l(arguments,0);return Db(a).catchException()};Gb.combineLatest=function(){var a=W.call(arguments);return Array.isArray(a[0])?a[0].unshift(this):a.unshift(this),Sb.apply(this,a)};var Sb=Jb.combineLatest=function(){var a=W.call(arguments),b=a.pop();return Array.isArray(a[0])&&(a=a[0]),new Yb(function(d){function e(a){var e;if(i[a]=!0,j||(j=i.every(c))){try{e=b.apply(null,l)}catch(f){return d.onError(f),void 0}d.onNext(e)}else k.filter(function(b,c){return c!==a}).every(c)&&d.onCompleted()}function f(a){k[a]=!0,k.every(c)&&d.onCompleted()}for(var g=function(){return!1},h=a.length,i=m(h,g),j=!1,k=m(h,g),l=new Array(h),n=new Array(h),o=0;h>o;o++)!function(b){n[b]=new ib,n[b].setDisposable(a[b].subscribe(function(a){l[b]=a,e(b)},d.onError.bind(d),function(){f(b)}))}(o);return new cb(n)})};Gb.concat=function(){var a=W.call(arguments,0);return a.unshift(this),Tb.apply(this,a)};var Tb=Jb.concat=function(){var a=l(arguments,0);return Db(a).concat()};Gb.concatObservable=Gb.concatAll=function(){return this.merge(1)},Gb.merge=function(a){if("number"!=typeof a)return Ub(this,a);var b=this;return new Yb(function(c){var d=0,e=new cb,f=!1,g=[],h=function(a){var b=new ib;e.add(b),b.setDisposable(a.subscribe(c.onNext.bind(c),c.onError.bind(c),function(){var a;e.remove(b),g.length>0?(a=g.shift(),h(a)):(d--,f&&0===d&&c.onCompleted())}))};return e.add(b.subscribe(function(b){a>d?(d++,h(b)):g.push(b)},c.onError.bind(c),function(){f=!0,0===d&&c.onCompleted()})),e})};var Ub=Jb.merge=function(){var a,b;return arguments[0]?arguments[0].now?(a=arguments[0],b=W.call(arguments,1)):(a=nb,b=W.call(arguments,0)):(a=nb,b=W.call(arguments,1)),Array.isArray(b[0])&&(b=b[0]),Nb(b,a).mergeObservable()};Gb.mergeObservable=Gb.mergeAll=function(){var a=this;return new Yb(function(b){var c=new cb,d=!1,e=new ib;return c.add(e),e.setDisposable(a.subscribe(function(a){var e=new ib;c.add(e),e.setDisposable(a.subscribe(function(a){b.onNext(a)},b.onError.bind(b),function(){c.remove(e),d&&1===c.length&&b.onCompleted()}))},b.onError.bind(b),function(){d=!0,1===c.length&&b.onCompleted()})),c})},Gb.skipUntil=function(a){var b=this;return new Yb(function(c){var d=!1,e=new cb(b.subscribe(function(a){d&&c.onNext(a)},c.onError.bind(c),function(){d&&c.onCompleted()})),f=new ib;return e.add(f),f.setDisposable(a.subscribe(function(){d=!0,f.dispose()},c.onError.bind(c),function(){f.dispose()})),e})},Gb["switch"]=Gb.switchLatest=function(){var a=this;return new Yb(function(b){var c=!1,d=new jb,e=!1,f=0,g=a.subscribe(function(a){var g=new ib,h=++f;c=!0,d.setDisposable(g),g.setDisposable(a.subscribe(function(a){f===h&&b.onNext(a)},function(a){f===h&&b.onError(a)},function(){f===h&&(c=!1,e&&b.onCompleted())}))},b.onError.bind(b),function(){e=!0,c||b.onCompleted()});return new cb(g,d)})},Gb.takeUntil=function(a){var c=this;return new Yb(function(d){return new cb(c.subscribe(d),a.subscribe(d.onCompleted.bind(d),d.onError.bind(d),b))})},Gb.zip=function(){if(Array.isArray(arguments[0]))return o.apply(this,arguments);var a=this,b=W.call(arguments),d=b.pop();return b.unshift(a),new Yb(function(e){function f(a){i[a]=!0,i.every(function(a){return a})&&e.onCompleted()}for(var g=b.length,h=m(g,function(){return[]}),i=m(g,function(){return!1}),j=function(b){var f,g;if(h.every(function(a){return a.length>0})){try{g=h.map(function(a){return a.shift()}),f=d.apply(a,g)}catch(j){return e.onError(j),void 0}e.onNext(f)}else i.filter(function(a,c){return c!==b}).every(c)&&e.onCompleted()},k=new Array(g),l=0;g>l;l++)!function(a){k[a]=new ib,k[a].setDisposable(b[a].subscribe(function(b){h[a].push(b),j(a)},e.onError.bind(e),function(){f(a)}))}(l);return new cb(k)})},Jb.zip=function(){var a=W.call(arguments,0),b=a.shift();return b.zip.apply(b,a)},Jb.zipArray=function(){var a=W.call(arguments);return new Yb(function(b){function d(a){if(g.every(function(a){return a.length>0})){var d=g.map(function(a){return a.shift()});b.onNext(d)}else if(h.filter(function(b,c){return c!==a}).every(c))return b.onCompleted(),void 0}function e(a){return h[a]=!0,h.every(c)?(b.onCompleted(),void 0):void 0}for(var f=a.length,g=m(f,function(){return[]}),h=m(f,function(){return!1}),i=new Array(f),j=0;f>j;j++)!function(c){i[c]=new ib,i[c].setDisposable(a[c].subscribe(function(a){g[c].push(a),d(c)},b.onError.bind(b),function(){e(c)}))}(j);var k=new cb(i);return k.add(fb(function(){for(var a=0,b=g.length;b>a;a++)g[a]=[]})),k})},Gb.asObservable=function(){var a=this;return new Yb(function(b){return a.subscribe(b)})},Gb.dematerialize=function(){var a=this;return new Yb(function(b){return a.subscribe(function(a){return a.accept(b)},b.onError.bind(b),b.onCompleted.bind(b))})},Gb.distinctUntilChanged=function(a,b){var e=this;return a||(a=c),b||(b=d),new Yb(function(c){var d,f=!1;return e.subscribe(function(e){var g,h=!1;try{g=a(e)}catch(i){return c.onError(i),void 0}if(f)try{h=b(d,g)}catch(i){return c.onError(i),void 0}f&&h||(f=!0,d=g,c.onNext(e))},c.onError.bind(c),c.onCompleted.bind(c))})},Gb["do"]=Gb.doAction=function(a,b,c){var d,e=this;return"function"==typeof a?d=a:(d=a.onNext.bind(a),b=a.onError.bind(a),c=a.onCompleted.bind(a)),new Yb(function(a){return e.subscribe(function(b){try{d(b)}catch(c){a.onError(c)}a.onNext(b)},function(c){if(b){try{b(c)}catch(d){a.onError(d)}a.onError(c)}else a.onError(c)},function(){if(c){try{c()}catch(b){a.onError(b)}a.onCompleted()}else a.onCompleted()})})},Gb["finally"]=Gb.finallyAction=function(a){var b=this;return new Yb(function(c){var d=b.subscribe(c);return fb(function(){try{d.dispose()}catch(b){throw b}finally{a()}})})},Gb.ignoreElements=function(){var a=this;return new Yb(function(c){return a.subscribe(b,c.onError.bind(c),c.onCompleted.bind(c))})},Gb.materialize=function(){var a=this;return new Yb(function(b){return a.subscribe(function(a){b.onNext(wb(a))},function(a){b.onNext(xb(a)),b.onCompleted()},function(){b.onNext(yb()),b.onCompleted()})})},Gb.repeat=function(a){return Cb(this,a).concat()},Gb.retry=function(a){return Cb(this,a).catchException()},Gb.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 Yb(function(e){var f,g,h;return d.subscribe(function(d){try{h||(h=!0),f?g=b(g,d):(g=c?b(a,d):d,f=!0)}catch(i){return e.onError(i),void 0}e.onNext(g)},e.onError.bind(e),function(){!h&&c&&e.onNext(a),e.onCompleted()})})},Gb.skipLast=function(a){var b=this;return new Yb(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))})},Gb.startWith=function(){var a,b,c=0;return arguments.length&&"now"in Object(arguments[0])?(b=arguments[0],c=1):b=nb,a=W.call(arguments,c),Db([Nb(a,b),this]).concat()},Gb.takeLast=function(a,b){return this.takeLastBuffer(a).selectMany(function(a){return Nb(a,b)})},Gb.takeLastBuffer=function(a){var b=this;return new Yb(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()})})},Gb.select=Gb.map=function(a,b){var c=this;return new Yb(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return d.onError(h),void 0}d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},Gb.selectMany=Gb.flatMap=function(a,b){return b?this.selectMany(function(c){return a(c).select(function(a){return b(c,a)})}):"function"==typeof a?p.call(this,a):p.call(this,function(){return a})},Gb.selectSwitch=Gb.flatMapLatest=function(a,b){return this.select(a,b).switchLatest()},Gb.skip=function(a){if(0>a)throw new Error(G);var b=this;return new Yb(function(c){var d=a;return b.subscribe(function(a){0>=d?c.onNext(a):d--},c.onError.bind(c),c.onCompleted.bind(c))})},Gb.skipWhile=function(a,b){var c=this;return new Yb(function(d){var e=0,f=!1;return c.subscribe(function(g){if(!f)try{f=!a.call(b,g,e++,c)}catch(h){return d.onError(h),void 0}f&&d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},Gb.take=function(a,b){if(0>a)throw new Error(G);if(0===a)return Mb(b);var c=this;return new Yb(function(b){var d=a;return c.subscribe(function(a){d>0&&(d--,b.onNext(a),0===d&&b.onCompleted())},b.onError.bind(b),b.onCompleted.bind(b))})},Gb.takeWhile=function(a,b){var c=this;return new Yb(function(d){var e=0,f=!0;return c.subscribe(function(g){if(f){try{f=a.call(b,g,e++,c)}catch(h){return d.onError(h),void 0}f?d.onNext(g):d.onCompleted()}},d.onError.bind(d),d.onCompleted.bind(d))})},Gb.where=Gb.filter=function(a,b){var c=this;return new Yb(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return d.onError(h),void 0}g&&d.onNext(f)},d.onError.bind(d),d.onCompleted.bind(d))})},Jb.fromCallback=function(a,b,c,d){return b||(b=ub),function(){var e=W.call(arguments,0),f=new ac;return b.schedule(function(){function b(a){var b=a;if(d)try{b=d(arguments)}catch(c){return f.onError(c),void 0 | ||
}else 1===b.length&&(b=b[0]);f.onNext(b),f.onCompleted()}e.push(b),a.apply(c,e)}),f.asObservable()}},Jb.fromNodeCallback=function(a,b,c,d){return b||(b=ub),function(){var e=W.call(arguments,0),f=new ac;return b.schedule(function(){function b(a){if(a)return f.onError(a),void 0;var b=W.call(arguments,1);if(d)try{b=d(b)}catch(c){return f.onError(c),void 0}else 1===b.length&&(b=b[0]);f.onNext(b),f.onCompleted()}e.push(b),a.apply(c,e)}),f.asObservable()}},Jb.fromEvent=function(a,b,c){return new Yb(function(d){return s(a,b,function(a){var b=a;if(c)try{b=c(arguments)}catch(e){return d.onError(e),void 0}d.onNext(b)})}).publish().refCount()},Jb.fromEventPattern=function(a,b,c){return new Yb(function(d){function e(a){var b=a;if(c)try{b=c(arguments)}catch(e){return d.onError(e),void 0}d.onNext(b)}var f=a(e);return fb(function(){b&&b(e,f)})}).publish().refCount()},Jb.fromPromise=function(a){var b=new ac;return a.then(function(a){b.onNext(a),b.onCompleted()},function(a){b.onError(a)}),b.asObservable()},Gb.multicast=function(a,b){var c=this;return"function"==typeof a?new Yb(function(d){var e=c.multicast(a());return new cb(b(e).subscribe(d),e.connect())}):new Vb(c,a)},Gb.publish=function(a){return a?this.multicast(function(){return new _b},a):this.multicast(new _b)},Gb.publishLast=function(a){return a?this.multicast(function(){return new ac},a):this.multicast(new ac)},Gb.publishValue=function(a,b){return 2===arguments.length?this.multicast(function(){return new cc(b)},a):this.multicast(new cc(a))},Gb.replay=function(a,b,c,d){return a?this.multicast(function(){return new dc(b,c,d)},a):this.multicast(new dc(b,c,d))};var Vb=function(a){function b(b,c){function d(a){return e.subject.subscribe(a)}var e={subject:c,source:b.asObservable(),hasSubscription:!1,subscription:null};this.connect=function(){return e.hasSubscription||(e.hasSubscription=!0,e.subscription=new cb(e.source.subscribe(e.subject),fb(function(){e.hasSubscription=!1}))),e.subscription},a.call(this,d)}return X(b,a),b.prototype.connect=function(){return this.connect()},b.prototype.refCount=function(){var a=null,b=0,c=this;return new Yb(function(d){var e,f;return b++,e=1===b,f=c.subscribe(d),e&&(a=c.connect()),fb(function(){f.dispose(),b--,0===b&&a.dispose()})})},b}(Jb),Wb=Jb.interval=function(a,b){return b||(b=ub),u(a,a,b)},Xb=Jb.timer=function(b,c,d){var e;return d||(d=ub),"number"==typeof c?e=c:"object"==typeof c&&"now"in c&&(d=c),e===a?t(b,d):u(b,e,d)};Gb.delay=function(a,b){b||(b=ub);var c=this;return new Yb(function(d){var e,f=!1,g=new jb,h=null,i=[],j=!1;return e=c.materialize().timestamp(b).subscribe(function(c){var e,k;"E"===c.value.kind?(i=[],i.push(c),h=c.value.exception,k=!j):(i.push({value:c.value,timestamp:c.timestamp+a}),k=!f,f=!0),k&&(null!==h?d.onError(h):(e=new ib,g.setDisposable(e),e.setDisposable(b.scheduleRecursiveWithRelative(a,function(a){var c,e,g,k;if(null===h){j=!0;do g=null,i.length>0&&i[0].timestamp-b.now()<=0&&(g=i.shift().value),null!==g&&g.accept(d);while(null!==g);k=!1,e=0,i.length>0?(k=!0,e=Math.max(0,i[0].timestamp-b.now())):f=!1,c=h,j=!1,null!==c?d.onError(c):k&&a(e)}}))))}),new cb(e,g)})},Gb.throttle=function(a,b){return b||(b=ub),this.throttleWithSelector(function(){return Xb(a,b)})},Gb.timeInterval=function(a){var b=this;return a||(a=ub),Lb(function(){var c=a.now();return b.select(function(b){var d=a.now(),e=d-c;return c=d,{value:b,interval:e}})})},Gb.timestamp=function(a){return a||(a=ub),this.select(function(b){return{value:b,timestamp:a.now()}})},Gb.sample=function(a,b){return b||(b=ub),"number"==typeof a?v(this,Wb(a,b)):v(this,a)},Gb.timeout=function(a,b,c){var d,e=this;return b||(b=Qb(new Error("Timeout"))),c||(c=ub),d=a instanceof Date?function(a,b){c.scheduleWithAbsolute(a,b)}:function(a,b){c.scheduleWithRelative(a,b)},new Yb(function(c){var f,g=0,h=new ib,i=new jb,j=!1,k=new jb;return i.setDisposable(h),f=function(){var e=g;k.setDisposable(d(a,function(){j=g===e;var a=j;a&&i.setDisposable(b.subscribe(c))}))},f(),h.setDisposable(e.subscribe(function(a){var b=!j;b&&(g++,c.onNext(a),f())},function(a){var b=!j;b&&(g++,c.onError(a))},function(){var a=!j;a&&(g++,c.onCompleted())})),new cb(i,k)})},Jb.generateWithTime=function(a,b,c,d,e,f){return f||(f=ub),new Yb(function(g){var h,i,j=!0,k=!1,l=a;return f.scheduleRecursiveWithRelative(0,function(a){k&&g.onNext(h);try{j?j=!1:l=c(l),k=b(l),k&&(h=d(l),i=e(l))}catch(f){return g.onError(f),void 0}k?a(i):g.onCompleted()})})},Gb.delaySubscription=function(a,b){return b||(b=ub),this.delayWithSelector(Xb(a,b),function(){return Mb()})},Gb.delayWithSelector=function(a,b){var c,d,e=this;return"function"==typeof a?d=a:(c=a,d=b),new Yb(function(a){var b=new cb,f=!1,g=function(){f&&0===b.length&&a.onCompleted()},h=new jb,i=function(){h.setDisposable(e.subscribe(function(c){var e;try{e=d(c)}catch(f){return a.onError(f),void 0}var h=new ib;b.add(h),h.setDisposable(e.subscribe(function(){a.onNext(c),b.remove(h),g()},a.onError.bind(a),function(){a.onNext(c),b.remove(h),g()}))},a.onError.bind(a),function(){f=!0,h.dispose(),g()}))};return c?h.setDisposable(c.subscribe(function(){i()},a.onError.bind(a),function(){i()})):i(),new cb(h,b)})},Gb.timeoutWithSelector=function(a,b,c){if(1===arguments.length){b=a;var a=Ob()}c||(c=Qb(new Error("Timeout")));var d=this;return new Yb(function(e){var f=new jb,g=new jb,h=new ib;f.setDisposable(h);var i=0,j=!1,k=function(a){var b=i,d=function(){return i===b},h=new ib;g.setDisposable(h),h.setDisposable(a.subscribe(function(){d()&&f.setDisposable(c.subscribe(e)),h.dispose()},function(a){d()&&e.onError(a)},function(){d()&&f.setDisposable(c.subscribe(e))}))};k(a);var l=function(){var a=!j;return a&&i++,a};return h.setDisposable(d.subscribe(function(a){if(l()){e.onNext(a);var c;try{c=b(a)}catch(d){return e.onError(d),void 0}k(c)}},function(a){l()&&e.onError(a)},function(){l()&&e.onCompleted()})),new cb(f,g)})},Gb.throttleWithSelector=function(a){var b=this;return new Yb(function(c){var d,e=!1,f=new jb,g=0,h=b.subscribe(function(b){var h;try{h=a(b)}catch(i){return c.onError(i),void 0}e=!0,d=b,g++;var j=g,k=new ib;f.setDisposable(k),k.setDisposable(h.subscribe(function(){e&&g===j&&c.onNext(d),e=!1,k.dispose()},c.onError.bind(c),function(){e&&g===j&&c.onNext(d),e=!1,k.dispose()}))},function(a){f.dispose(),c.onError(a),e=!1,g++},function(){f.dispose(),e&&c.onNext(d),c.onCompleted(),e=!1,g++});return new cb(h,f)})},Gb.skipLastWithTime=function(a,b){b||(b=ub);var c=this;return new Yb(function(d){var e=[];return c.subscribe(function(c){var f=b.now();for(e.push({interval:f,value:c});e.length>0&&f-e[0].interval>=a;)d.onNext(e.shift().value)},d.onError.bind(d),function(){for(var c=b.now();e.length>0&&c-e[0].interval>=a;)d.onNext(e.shift().value);d.onCompleted()})})},Gb.takeLastWithTime=function(a,b,c){return this.takeLastBufferWithTime(a,b).selectMany(function(a){return Nb(a,c)})},Gb.takeLastBufferWithTime=function(a,b){var c=this;return b||(b=ub),new Yb(function(d){var e=[];return c.subscribe(function(c){var d=b.now();for(e.push({interval:d,value:c});e.length>0&&d-e[0].interval>=a;)e.shift()},d.onError.bind(d),function(){for(var c=b.now(),f=[];e.length>0;){var g=e.shift();c-g.interval<=a&&f.push(g.value)}d.onNext(f),d.onCompleted()})})},Gb.takeWithTime=function(a,b){var c=this;return b||(b=ub),new Yb(function(d){var e=b.scheduleWithRelative(a,function(){d.onCompleted()});return new cb(e,c.subscribe(d))})},Gb.skipWithTime=function(a,b){var c=this;return b||(b=ub),new Yb(function(d){var e=!1,f=b.scheduleWithRelative(a,function(){e=!0}),g=c.subscribe(function(a){e&&d.onNext(a)},d.onError.bind(d),d.onCompleted.bind(d));return new cb(f,g)})},Gb.skipUntilWithTime=function(a,b){b||(b=ub);var c=this;return new Yb(function(d){var e=!1,f=b.scheduleWithAbsolute(a,function(){e=!0}),g=c.subscribe(function(a){e&&d.onNext(a)},d.onError.bind(d),d.onCompleted.bind(d));return new cb(f,g)})},Gb.takeUntilWithTime=function(a,b){b||(b=ub);var c=this;return new Yb(function(d){return new cb(b.scheduleWithAbsolute(a,function(){d.onCompleted()}),c.subscribe(d))})};var Yb=D.Internals.AnonymousObservable=function(a){function b(a){return"undefined"==typeof a?a=gb:"function"==typeof a&&(a=fb(a)),a}function c(d){function e(a){var c=new Zb(a);if(ob.scheduleRequired())ob.schedule(function(){try{c.setDisposable(b(d(c)))}catch(a){if(!c.fail(a))throw a}});else try{c.setDisposable(b(d(c)))}catch(e){if(!c.fail(e))throw e}return c}return this instanceof c?(a.call(this,e),void 0):new c(d)}return X(c,a),c}(Jb),Zb=function(a){function b(b){a.call(this),this.observer=b,this.m=new ib}X(b,a);var c=b.prototype;return c.next=function(a){var b=!1;try{this.observer.onNext(a),b=!0}catch(c){throw c}finally{b||this.dispose()}},c.error=function(a){try{this.observer.onError(a)}catch(b){throw b}finally{this.dispose()}},c.completed=function(){try{this.observer.onCompleted()}catch(a){throw a}finally{this.dispose()}},c.setDisposable=function(a){this.m.setDisposable(a)},c.getDisposable=function(){return this.m.getDisposable()},c.disposable=function(a){return arguments.length?this.getDisposable():setDisposable(a)},c.dispose=function(){a.prototype.dispose.call(this),this.m.dispose()},b}(Hb),$b=function(a,b){this.subject=a,this.observer=b};$b.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 _b=D.Subject=function(a){function b(a){return g.call(this),this.isStopped?this.exception?(a.onError(this.exception),gb):(a.onCompleted(),gb):(this.observers.push(a),new $b(this,a))}function c(){a.call(this,b),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return X(c,a),Y(c.prototype,Eb,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(g.call(this),!this.isStopped){var a=this.observers.slice(0);this.isStopped=!0;for(var b=0,c=a.length;c>b;b++)a[b].onCompleted();this.observers=[]}},onError:function(a){if(g.call(this),!this.isStopped){var b=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var c=0,d=b.length;d>c;c++)b[c].onError(a);this.observers=[]}},onNext:function(a){if(g.call(this),!this.isStopped)for(var b=this.observers.slice(0),c=0,d=b.length;d>c;c++)b[c].onNext(a)},dispose:function(){this.isDisposed=!0,this.observers=null}}),c.create=function(a,b){return new bc(a,b)},c}(Jb),ac=D.AsyncSubject=function(a){function b(a){if(g.call(this),!this.isStopped)return this.observers.push(a),new $b(this,a);var b=this.exception,c=this.hasValue,d=this.value;return b?a.onError(b):c?(a.onNext(d),a.onCompleted()):a.onCompleted(),gb}function c(){a.call(this,b),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return X(c,a),Y(c.prototype,Eb,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){var a,b,c;if(g.call(this),!this.isStopped){var d=this.observers.slice(0);this.isStopped=!0;var e=this.value,f=this.hasValue;if(f)for(b=0,c=d.length;c>b;b++)a=d[b],a.onNext(e),a.onCompleted();else for(b=0,c=d.length;c>b;b++)d[b].onCompleted();this.observers=[]}},onError:function(a){if(g.call(this),!this.isStopped){var b=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var c=0,d=b.length;d>c;c++)b[c].onError(a);this.observers=[]}},onNext:function(a){g.call(this),this.isStopped||(this.value=a,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),c}(Jb),bc=function(a){function b(a){return this.observable.subscribe(a)}function c(c,d){a.call(this,b),this.observer=c,this.observable=d}return X(c,a),Y(c.prototype,Eb,{onCompleted:function(){this.observer.onCompleted()},onError:function(a){this.observer.onError(a)},onNext:function(a){this.observer.onNext(a)}}),c}(Jb),cc=D.BehaviorSubject=function(a){function b(a){if(g.call(this),!this.isStopped)return this.observers.push(a),a.onNext(this.value),new $b(this,a);var b=this.exception;return b?a.onError(b):a.onCompleted(),gb}function c(c){a.call(this,b),this.value=c,this.observers=[],this.isDisposed=!1,this.isStopped=!1,this.exception=null}return X(c,a),Y(c.prototype,Eb,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(g.call(this),!this.isStopped){var a=this.observers.slice(0);this.isStopped=!0;for(var b=0,c=a.length;c>b;b++)a[b].onCompleted();this.observers=[]}},onError:function(a){if(g.call(this),!this.isStopped){var b=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var c=0,d=b.length;d>c;c++)b[c].onError(a);this.observers=[]}},onNext:function(a){if(g.call(this),!this.isStopped){this.value=a;for(var b=this.observers.slice(0),c=0,d=b.length;d>c;c++)b[c].onNext(a)}},dispose:function(){this.isDisposed=!0,this.observers=null,this.value=null,this.exception=null}}),c}(Jb),dc=D.ReplaySubject=function(a){function b(a,b){this.subject=a,this.observer=b}function c(a){var c=new Kb(this.scheduler,a),d=new b(this,c);g.call(this),this._trim(this.scheduler.now()),this.observers.push(c);for(var e=this.q.length,f=0,h=this.q.length;h>f;f++)c.onNext(this.q[f].value);return this.hasError?(e++,c.onError(this.error)):this.isStopped&&(e++,c.onCompleted()),c.ensureActive(e),d}function d(b,d,e){this.bufferSize=null==b?Number.MAX_VALUE:b,this.windowSize=null==d?Number.MAX_VALUE:d,this.scheduler=e||ob,this.q=[],this.observers=[],this.isStopped=!1,this.isDisposed=!1,this.hasError=!1,this.error=null,a.call(this,c)}return b.prototype.dispose=function(){if(this.observer.dispose(),!this.subject.isDisposed){var a=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(a,1)}},X(d,a),Y(d.prototype,Eb,{hasObservers:function(){return this.observers.length>0},_trim:function(a){for(;this.q.length>this.bufferSize;)this.q.shift();for(;this.q.length>0&&a-this.q[0].interval>this.windowSize;)this.q.shift()},onNext:function(a){var b;if(g.call(this),!this.isStopped){var c=this.scheduler.now();this.q.push({interval:c,value:a}),this._trim(c);for(var d=this.observers.slice(0),e=0,f=d.length;f>e;e++)b=d[e],b.onNext(a),b.ensureActive()}},onError:function(a){var b;if(g.call(this),!this.isStopped){this.isStopped=!0,this.error=a,this.hasError=!0;var c=this.scheduler.now();this._trim(c);for(var d=this.observers.slice(0),e=0,f=d.length;f>e;e++)b=d[e],b.onError(a),b.ensureActive();this.observers=[]}},onCompleted:function(){var a;if(g.call(this),!this.isStopped){this.isStopped=!0;var b=this.scheduler.now();this._trim(b);for(var c=this.observers.slice(0),d=0,e=c.length;e>d;d++)a=c[d],a.onCompleted(),a.ensureActive();this.observers=[]}},dispose:function(){this.isDisposed=!0,this.observers=null}}),d}(Jb);"function"==typeof define&&"object"==typeof define.amd&&define.amd?(x.Rx=D,define(function(){return D})):y&&z?A?(z.exports=D).Rx=D:y.Rx=D:x.Rx=D}).call(this); |
@@ -1,2 +0,2 @@ | ||
(function(t,e){function n(){}function r(t){return t}function i(t,e){return H(t,e)}function o(t,e){return t-e}function s(t){throw t}function u(){if(this.isDisposed)throw Error(_)}function c(t){return"function"!=typeof t.toString&&"string"==typeof(t+"")}function a(t){return t&&"object"==typeof t?V.call(t)==W:!1}function l(t){return"function"==typeof t}function h(t,e,n,r){var i;if(t===e)return 0!==t||1/t==1/e;var o=typeof t,s=typeof e;if(!(t!==t||t&&R[o]||e&&R[s]))return!1;if(null==t||null==e)return t===e;var u=V.call(t),f=V.call(e);if(u==W&&(u=P),f==W&&(f=P),u!=f)return!1;switch(u){case k:case q:return+t==+e;case I:return t!=+t?e!=+e:0==t?1/t==1/e:t==+e;case L:case z:return t==e+""}var p=u==j;if(!p){if(u!=P||!D&&(c(t)||c(e)))return!1;var d=!B&&a(t)?Object:t.constructor,b=!B&&a(e)?Object:e.constructor;if(d!=b&&!(l(d)&&d instanceof d&&l(b)&&b instanceof b))return!1}for(var v=n.length;v--;)if(n[v]==t)return r[v]==e;var m=0;if(i=!0,n.push(t),r.push(e),p){for(v=t.length,m=e.length,i=m==t.length;m--;){var y=e[m];if(!(i=h(t[m],y,n,r)))break}return i}for(var w in e)if(M.call(e,w))return m++,i=M.call(t,w)&&h(t[w],e[w],n,r);if(i)for(var w in t)if(M.call(t,w))return i=--m>-1;return n.pop(),r.pop(),i}function f(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:F.call(t)}function p(t,e){for(var n=Array(t),r=0;t>r;r++)n[r]=e();return n}function d(t,n){return new Ue(function(r){var i=new ie,o=new oe;return o.setDisposable(i),i.setDisposable(t.subscribe(r.onNext.bind(r),function(t){var i,s;try{s=n(t)}catch(u){return r.onError(u),e}i=new ie,o.setDisposable(i),i.setDisposable(s.subscribe(r))},r.onCompleted.bind(r))),o})}function b(t,n){var r=this;return new Ue(function(i){var o=0,s=t.length;return r.subscribe(function(r){if(s>o){var u,c=t[o++];try{u=n(r,c)}catch(a){return i.onError(a),e}i.onNext(u)}else i.onCompleted()},i.onError.bind(i),i.onCompleted.bind(i))})}function v(t){return this.select(t).mergeObservable()}function m(t,n,r){return t.addListener?(t.addListener(n,r),te(function(){t.removeListener(n,r)})):t.addEventListener?(t.addEventListener(n,r,!1),te(function(){t.removeEventListener(n,r,!1)})):e}function y(t,e,n){var r=new Y;if(t&&t.length)for(var i=0,o=t.length;o>i;i++)r.add(y(t[i],e,n));else t&&r.add(m(t,e,n));return r}function w(t,e){var n=ce(t);return new Ue(function(t){return e.scheduleWithRelative(n,function(){t.onNext(0),t.onCompleted()})})}function g(t,e,n){return t===e?new Ue(function(t){return n.schedulePeriodicWithState(0,e,function(e){return t.onNext(e),e+1})}):Re(function(){return observableTimerDateAndPeriod(n.now()+t,e,n)})}function x(t,e){return new Ue(function(n){function r(){s&&(s=!1,n.onNext(o)),i&&n.onCompleted()}var i,o,s;return new Y(t.subscribe(function(t){s=!0,o=t},n.onError.bind(n),function(){i=!0}),e.subscribe(r,n.onError.bind(n),r))})}var E="object"==typeof exports&&exports,C=("object"==typeof module&&module&&module.exports==E&&module,"object"==typeof global&&global);C.global===C&&(t=C);var D,N={Internals:{}},S=Date.now,A="Sequence contains no elements.",O="Argument out of range",_="Object has been disposed",R={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},W="[object Arguments]",j="[object Array]",k="[object Boolean]",q="[object Date]",T="[object Function]",I="[object Number]",P="[object Object]",L="[object RegExp]",z="[object String]",V=Object.prototype.toString,M=Object.prototype.hasOwnProperty,B=V.call(arguments)==W;try{D=!(V.call(document)==P&&!({toString:0}+""))}catch(U){D=!0}B||(a=function(t){return t&&"object"==typeof t?M.call(t,"callee"):!1}),l(/x/)&&(l=function(t){return"function"==typeof t&&V.call(t)==T});var H=N.Internals.isEqual=function(t,e){return h(t,e,[],[])},F=Array.prototype.slice;({}).hasOwnProperty;var X=this.inherits=N.Internals.inherits=function(t,e){function n(){this.constructor=t}n.prototype=e.prototype,t.prototype=new n},J=N.Internals.addProperties=function(t){for(var e=F.call(arguments,1),n=0,r=e.length;r>n;n++){var i=e[n];for(var o in i)t[o]=i[o]}};N.Internals.addRef=function(t,e){return new Ue(function(n){return new Y(e.getDisposable(),t.subscribe(n))})};var Q=function(t,e){this.id=t,this.value=e};Q.prototype.compareTo=function(t){var e=this.value.compareTo(t.value);return 0===e&&(e=this.id-t.id),e};var K=N.Internals.PriorityQueue=function(t){this.items=Array(t),this.length=0},G=K.prototype;G.isHigherPriority=function(t,e){return 0>this.items[t].compareTo(this.items[e])},G.percolate=function(t){if(!(t>=this.length||0>t)){var e=t-1>>1;if(!(0>e||e===t)&&this.isHigherPriority(t,e)){var n=this.items[t];this.items[t]=this.items[e],this.items[e]=n,this.percolate(e)}}},G.heapify=function(t){if(t===e&&(t=0),!(t>=this.length||0>t)){var n=2*t+1,r=2*t+2,i=t;if(this.length>n&&this.isHigherPriority(n,i)&&(i=n),this.length>r&&this.isHigherPriority(r,i)&&(i=r),i!==t){var o=this.items[t];this.items[t]=this.items[i],this.items[i]=o,this.heapify(i)}}},G.peek=function(){return this.items[0].value},G.removeAt=function(t){this.items[t]=this.items[--this.length],delete this.items[this.length],this.heapify()},G.dequeue=function(){var t=this.peek();return this.removeAt(0),t},G.enqueue=function(t){var e=this.length++;this.items[e]=new Q(K.count++,t),this.percolate(e)},G.remove=function(t){for(var e=0;this.length>e;e++)if(this.items[e].value===t)return this.removeAt(e),!0;return!1},K.count=0;var Y=N.CompositeDisposable=function(){this.disposables=f(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},Z=Y.prototype;Z.add=function(t){this.isDisposed?t.dispose():(this.disposables.push(t),this.length++)},Z.remove=function(t){var e=!1;if(!this.isDisposed){var n=this.disposables.indexOf(t);-1!==n&&(e=!0,this.disposables.splice(n,1),this.length--,t.dispose())}return e},Z.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()}},Z.clear=function(){var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()},Z.contains=function(t){return-1!==this.disposables.indexOf(t)},Z.toArray=function(){return this.disposables.slice(0)};var $=N.Disposable=function(t){this.isDisposed=!1,this.action=t||n};$.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var te=$.create=function(t){return new $(t)},ee=$.empty={dispose:n},ne=N.BooleanDisposable=function(){this.isDisposed=!1,this.current=null};N.SingleAssignmentDisposable=N.SerialDisposable=ne;var re=ne.prototype,ie=ne,oe=ne;re.getDisposable=function(){return this.current},re.setDisposable=function(t){var e,n=this.isDisposed;n||(e=this.current,this.current=t),e&&e.dispose(),n&&t&&t.dispose()},re.disposable=function(t){return t?(this.setDisposable(t),e):this.getDisposable()},re.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()},N.RefCountDisposable=function(){function t(t){this.disposable=t,this.disposable.count++,this.isInnerDisposed=!1}function e(t){this.underlyingDisposable=t,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return t.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},e.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},e.prototype.getDisposable=function(){return this.isDisposed?ee:new t(this)},e}();var se=N.Internals.ScheduledItem=function(t,e,n,r,i){this.scheduler=t,this.state=e,this.action=n,this.dueTime=r,this.comparer=i||o,this.disposable=new ie};se.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},se.prototype.compareTo=function(t){return this.comparer(this.dueTime,t.dueTime)},se.prototype.isCancelled=function(){return this.disposable.isDisposed},se.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var ue=N.Scheduler=function(){function e(t,e,n,r){this.now=t,this._schedule=e,this._scheduleRelative=n,this._scheduleAbsolute=r}function n(t,e){var n=e.first,r=e.second,i=new Y,o=function(e){r(e,function(e){var n=!1,r=!1,s=t.scheduleWithState(e,function(t,e){return n?i.remove(s):r=!0,o(e),ee});r||(i.add(s),n=!0)})};return o(n),i}function r(t,e,n){var r=e.first,i=e.second,o=new Y,s=function(e){i(e,function(e,r){var i=!1,u=!1,c=t[n].call(t,e,r,function(t,e){return i?o.remove(c):u=!0,s(e),ee});u||(o.add(c),i=!0)})};return s(r),o}function i(t,e){return e(),ee}var o=e.prototype;return o.schedulePeriodic=function(t,e){return this.schedulePeriodicWithState(null,t,function(){e()})},o.schedulePeriodicWithState=function(e,n,r){var i=e,o=t.setInterval(function(){i=r(i)},n);return te(function(){t.clearInterval(o)})},o.schedule=function(t){return this._schedule(t,i)},o.scheduleWithState=function(t,e){return this._schedule(t,e)},o.scheduleWithRelative=function(t,e){return this._scheduleRelative(e,t,i)},o.scheduleWithRelativeAndState=function(t,e,n){return this._scheduleRelative(t,e,n)},o.scheduleWithAbsolute=function(t,e){return this._scheduleAbsolute(e,t,i)},o.scheduleWithAbsoluteAndState=function(t,e,n){return this._scheduleAbsolute(t,e,n)},o.scheduleRecursive=function(t){return this.scheduleRecursiveWithState(t,function(t,e){t(function(){e(t)})})},o.scheduleRecursiveWithState=function(t,e){return this.scheduleWithState({first:t,second:e},function(t,e){return n(t,e)})},o.scheduleRecursiveWithRelative=function(t,e){return this.scheduleRecursiveWithRelativeAndState(e,t,function(t,e){t(function(n){e(t,n)})})},o.scheduleRecursiveWithRelativeAndState=function(t,e,n){return this._scheduleRelative({first:t,second:n},e,function(t,e){return r(t,e,"scheduleWithRelativeAndState")})},o.scheduleRecursiveWithAbsolute=function(t,e){return this.scheduleRecursiveWithAbsoluteAndState(e,t,function(t,e){t(function(n){e(t,n)})})},o.scheduleRecursiveWithAbsoluteAndState=function(t,e,n){return this._scheduleAbsolute({first:t,second:n},e,function(t,e){return r(t,e,"scheduleWithAbsoluteAndState")})},e.now=S,e.normalize=function(t){return 0>t&&(t=0),t},e}(),ce=ue.normalize,ae=ue.currentThread=ue.immediate=function(){function t(){i=new K(4)}function e(t,e){return this.scheduleWithRelativeAndState(t,0,e)}function n(e,n,r){var o,s=this.now()+ue.normalize(n),u=new se(this,e,r,s);if(i)i.enqueue(u);else{o=new t;try{i.enqueue(u),o.run()}catch(c){throw c}finally{o.dispose()}}return u.disposable}function r(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}var i;t.prototype.dispose=function(){i=null},t.prototype.run=function(){for(var t;i.length>0;)if(t=i.dequeue(),!t.isCancelled()){for(;t.dueTime-ue.now()>0;);t.isCancelled()||t.invoke()}};var o=new ue(S,e,n,r);return o.scheduleRequired=function(){return null===i},o.ensureTrampoline=function(t){return null===i?this.schedule(t):t()},o}(),le=ae;N.Internals.SchedulePeriodicRecursive=function(){function t(t,e){e(0,this._period);try{this._state=this._action(this._state)}catch(n){throw this._cancel.dispose(),n}}function e(t,e,n,r){this._scheduler=t,this._state=e,this._period=n,this._action=r}return e.prototype.start=function(){var e=new ie;return this._cancel=e,e.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,t.bind(this))),e},e}();var he,fe=n;(function(){function e(){if(!t.postMessage||t.importScripts)return!1;var e=!1,n=t.onmessage;return t.onmessage=function(){e=!0},t.postMessage("","*"),t.onmessage=n,e}function n(t){if("string"==typeof t.data&&t.data.substring(0,r.length)===r){var e=t.data.substring(r.length),n=i[e];n(),delete i[e]}}if("function"==typeof t.setImmediate)he=t.setImmediate,fe=clearImmediate;else if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))he=process.nextTick;else if(e()){var r="ms.rx.schedule"+Math.random(),i={},o=0;t.addEventListener?t.addEventListener("message",n,!1):t.attachEvent("onmessage",n,!1),he=function(e){var n=o++;i[n]=e,t.postMessage(r+n,"*")}}else if(t.MessageChannel){var s=new t.MessageChannel,u={},c=0;s.port1.onmessage=function(t){var e=t.data,n=u[e];n(),delete u[e]},he=function(t){var e=c++;u[e]=t,s.port2.postMessage(e)}}else"document"in t&&"onreadystatechange"in t.document.createElement("script")?he=function(e){var n=t.document.createElement("script");n.onreadystatechange=function(){e(),n.onreadystatechange=null,n.parentNode.removeChild(n),n=null},t.document.documentElement.appendChild(n)}:(he=function(e){return t.setTimeout(e,0)},fe=t.clearTimeout)})();var pe=ue.timeout=function(){function e(t,e){var n=this,r=new ie,i=he(function(){r.isDisposed||r.setDisposable(e(n,t))});return new Y(r,te(function(){fe(i)}))}function n(e,n,r){var i=this,o=ue.normalize(n);if(0===o)return i.scheduleWithState(e,r);var s=new ie,u=t.setTimeout(function(){s.isDisposed||s.setDisposable(r(i,e))},o);return new Y(s,te(function(){t.clearTimeout(u)}))}function r(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new ue(S,e,n,r)}(),de=N.Notification=function(){function t(t,e){this.hasValue=null==e?!1:e,this.kind=t}var e=t.prototype;return e.accept=function(t,e,n){return 1===arguments.length&&"object"==typeof t?this._acceptObservable(t):this._accept(t,e,n)},e.toObservable=function(t){var e=this;return t||(t=le),new Ue(function(n){return t.schedule(function(){e._acceptObservable(n),"N"===e.kind&&n.onCompleted()})})},t}(),be=de.createOnNext=function(){function t(t){return t(this.value)}function e(t){return t.onNext(this.value)}function n(){return"OnNext("+this.value+")"}return function(r){var i=new de("N",!0);return i.value=r,i._accept=t,i._acceptObservable=e,i.toString=n,i}}(),ve=de.createOnError=function(){function t(t,e){return e(this.exception)}function e(t){return t.onError(this.exception)}function n(){return"OnError("+this.exception+")"}return function(r){var i=new de("E");return i.exception=r,i._accept=t,i._acceptObservable=e,i.toString=n,i}}(),me=de.createOnCompleted=function(){function t(t,e,n){return n()}function e(t){return t.onCompleted()}function n(){return"OnCompleted()"}return function(){var r=new de("C");return r._accept=t,r._acceptObservable=e,r.toString=n,r}}(),ye=N.Internals.Enumerator=function(t,e,n){this.moveNext=t,this.getCurrent=e,this.dispose=n},we=ye.create=function(t,e,r){var i=!1;return r||(r=n),new ye(function(){if(i)return!1;var e=t();return e||(i=!0,r()),e},function(){return e()},function(){i||(r(),i=!0)})},ge=N.Internals.Enumerable=function(){function t(t){this.getEnumerator=t}return t.prototype.concat=function(){var t=this;return new Ue(function(n){var r=t.getEnumerator(),i=!1,o=new oe,s=le.scheduleRecursive(function(t){var s,u,c=!1;if(!i){try{c=r.moveNext(),c?s=r.getCurrent():r.dispose()}catch(a){u=a,r.dispose()}if(u)return n.onError(u),e;if(!c)return n.onCompleted(),e;var l=new ie;o.setDisposable(l),l.setDisposable(s.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){t()}))}});return new Y(o,s,te(function(){i=!0,r.dispose()}))})},t.prototype.catchException=function(){var t=this;return new Ue(function(n){var r,i=t.getEnumerator(),o=!1,s=new oe,u=le.scheduleRecursive(function(t){var u,c,a;if(a=!1,!o){try{a=i.moveNext(),a&&(u=i.getCurrent())}catch(l){c=l}if(c)return n.onError(c),e;if(!a)return r?n.onError(r):n.onCompleted(),e;var h=new ie;s.setDisposable(h),h.setDisposable(u.subscribe(n.onNext.bind(n),function(e){r=e,t()},n.onCompleted.bind(n)))}});return new Y(s,u,te(function(){o=!0}))})},t}(),xe=ge.repeat=function(t,n){return n===e&&(n=-1),new ge(function(){var e,r=n;return we(function(){return 0===r?!1:(r>0&&r--,e=t,!0)},function(){return e})})},Ee=ge.forEach=function(t,e){return e||(e=r),new ge(function(){var n,r=-1;return we(function(){return++r<t.length?(n=e(t[r],r),!0):!1},function(){return n})})},Ce=N.Observer=function(){};Ce.prototype.toNotifier=function(){var t=this;return function(e){return e.accept(t)}},Ce.prototype.asObserver=function(){return new Ae(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))};var De=Ce.create=function(t,e,r){return t||(t=n),e||(e=s),r||(r=n),new Ae(t,e,r)};Ce.fromNotifier=function(t){return new Ae(function(e){return t(be(e))},function(e){return t(ve(e))},function(){return t(me())})};var Ne,Se=N.Internals.AbstractObserver=function(t){function e(){this.isStopped=!1,t.call(this)}return X(e,t),e.prototype.onNext=function(t){this.isStopped||this.next(t)},e.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.error(t))},e.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},e.prototype.dispose=function(){this.isStopped=!0},e.prototype.fail=function(t){return this.isStopped?!1:(this.isStopped=!0,this.error(t),!0)},e}(Ce),Ae=N.AnonymousObserver=function(t){function e(e,n,r){t.call(this),this._onNext=e,this._onError=n,this._onCompleted=r}return X(e,t),e.prototype.next=function(t){this._onNext(t)},e.prototype.error=function(t){this._onError(t)},e.prototype.completed=function(){this._onCompleted()},e}(Se),Oe=N.Observable=function(){function t(t){this._subscribe=t}return Ne=t.prototype,Ne.finalValue=function(){var t=this;return new Ue(function(e){var n,r=!1;return t.subscribe(function(t){r=!0,n=t},e.onError.bind(e),function(){r?(e.onNext(n),e.onCompleted()):e.onError(Error(A))})})},Ne.subscribe=Ne.forEach=function(t,e,n){var r;return r="object"==typeof t?t:De(t,e,n),this._subscribe(r)},Ne.toArray=function(){function t(t,e){var n=t.slice(0);return n.push(e),n}return this.scan([],t).startWith([]).finalValue()},t}(),_e=N.Internals.ScheduledObserver=function(t){function n(e,n){t.call(this),this.scheduler=e,this.observer=n,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new oe}return X(n,t),n.prototype.next=function(t){var e=this;this.queue.push(function(){e.observer.onNext(t)})},n.prototype.error=function(t){var e=this;this.queue.push(function(){e.observer.onError(t)})},n.prototype.completed=function(){var t=this;this.queue.push(function(){t.observer.onCompleted()})},n.prototype.ensureActive=function(){var t=!1,n=this;!this.hasFaulted&&this.queue.length>0&&(t=!this.isAcquired,this.isAcquired=!0),t&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(t){var r;if(!(n.queue.length>0))return n.isAcquired=!1,e;r=n.queue.shift();try{r()}catch(i){throw n.queue=[],n.hasFaulted=!0,i}t()}))},n.prototype.dispose=function(){t.prototype.dispose.call(this),this.disposable.dispose()},n}(Se);Oe.create=Oe.createWithDisposable=function(t){return new Ue(t)};var Re=Oe.defer=function(t){return new Ue(function(e){var n;try{n=t()}catch(r){return Te(r).subscribe(e)}return n.subscribe(e)})},We=Oe.empty=function(t){return t||(t=le),new Ue(function(e){return t.schedule(function(){e.onCompleted()})})},je=Oe.fromArray=function(t,e){return e||(e=ae),new Ue(function(n){var r=0;return e.scheduleRecursive(function(e){t.length>r?(n.onNext(t[r++]),e()):n.onCompleted()})})};Oe.generate=function(t,n,r,i,o){return o||(o=ae),new Ue(function(s){var u=!0,c=t;return o.scheduleRecursive(function(t){var o,a;try{u?u=!1:c=r(c),o=n(c),o&&(a=i(c))}catch(l){return s.onError(l),e}o?(s.onNext(a),t()):s.onCompleted()})})};var ke=Oe.never=function(){return new Ue(function(){return ee})};Oe.range=function(t,e,n){return n||(n=ae),new Ue(function(r){return n.scheduleRecursiveWithState(0,function(n,i){e>n?(r.onNext(t+n),i(n+1)):r.onCompleted()})})},Oe.repeat=function(t,e,n){return n||(n=ae),null==e&&(e=-1),qe(t,n).repeat(e)};var qe=Oe["return"]=Oe.returnValue=function(t,e){return e||(e=le),new Ue(function(n){return e.schedule(function(){n.onNext(t),n.onCompleted()})})},Te=Oe["throw"]=Oe.throwException=function(t,e){return e||(e=le),new Ue(function(n){return e.schedule(function(){n.onError(t)})})};Ne["catch"]=Ne.catchException=function(t){return"function"==typeof t?d(this,t):Ie([this,t])};var Ie=Oe.catchException=Oe["catch"]=function(){var t=f(arguments,0);return Ee(t).catchException()};Ne.combineLatest=function(){var t=F.call(arguments);return Array.isArray(t[0])?t[0].unshift(this):t.unshift(this),Pe.apply(this,t)};var Pe=Oe.combineLatest=function(){var t=F.call(arguments),n=t.pop();return Array.isArray(t[0])&&(t=t[0]),new Ue(function(i){function o(t){var o;if(a[t]=!0,l||(l=a.every(r))){try{o=n.apply(null,f)}catch(s){return i.onError(s),e}i.onNext(o)}else h.filter(function(e,n){return n!==t}).every(r)&&i.onCompleted()}function s(t){h[t]=!0,h.every(r)&&i.onCompleted()}for(var u=function(){return!1},c=t.length,a=p(c,u),l=!1,h=p(c,u),f=Array(c),d=Array(c),b=0;c>b;b++)(function(e){d[e]=new ie,d[e].setDisposable(t[e].subscribe(function(t){f[e]=t,o(e)},i.onError.bind(i),function(){s(e)}))})(b);return new Y(d)})};Ne.concat=function(){var t=F.call(arguments,0);return t.unshift(this),Le.apply(this,t)};var Le=Oe.concat=function(){var t=f(arguments,0);return Ee(t).concat()};Ne.concatObservable=Ne.concatAll=function(){return this.merge(1)},Ne.merge=function(t){if("number"!=typeof t)return ze(this,t);var e=this;return new Ue(function(n){var r=0,i=new Y,o=!1,s=[],u=function(t){var e=new ie;i.add(e),e.setDisposable(t.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){var t;i.remove(e),s.length>0?(t=s.shift(),u(t)):(r--,o&&0===r&&n.onCompleted())}))};return i.add(e.subscribe(function(e){t>r?(r++,u(e)):s.push(e)},n.onError.bind(n),function(){o=!0,0===r&&n.onCompleted()})),i})};var ze=Oe.merge=function(){var t,e;return arguments[0]?arguments[0].now?(t=arguments[0],e=F.call(arguments,1)):(t=le,e=F.call(arguments,0)):(t=le,e=F.call(arguments,1)),Array.isArray(e[0])&&(e=e[0]),je(e,t).mergeObservable()};Ne.mergeObservable=Ne.mergeAll=function(){var t=this;return new Ue(function(e){var n=new Y,r=!1,i=new ie;return n.add(i),i.setDisposable(t.subscribe(function(t){var i=new ie;n.add(i),i.setDisposable(t.subscribe(function(t){e.onNext(t)},e.onError.bind(e),function(){n.remove(i),r&&1===n.length&&e.onCompleted()}))},e.onError.bind(e),function(){r=!0,1===n.length&&e.onCompleted()})),n})},Ne.skipUntil=function(t){var e=this;return new Ue(function(n){var r=!1,i=new Y(e.subscribe(function(t){r&&n.onNext(t)},n.onError.bind(n),function(){r&&n.onCompleted()})),o=new ie;return i.add(o),o.setDisposable(t.subscribe(function(){r=!0,o.dispose()},n.onError.bind(n),function(){o.dispose()})),i})},Ne["switch"]=Ne.switchLatest=function(){var t=this;return new Ue(function(e){var n=!1,r=new oe,i=!1,o=0,s=t.subscribe(function(t){var s=new ie,u=++o;n=!0,r.setDisposable(s),s.setDisposable(t.subscribe(function(t){o===u&&e.onNext(t)},function(t){o===u&&e.onError(t)},function(){o===u&&(n=!1,i&&e.onCompleted())}))},e.onError.bind(e),function(){i=!0,n||e.onCompleted()});return new Y(s,r)})},Ne.takeUntil=function(t){var e=this;return new Ue(function(r){return new Y(e.subscribe(r),t.subscribe(r.onCompleted.bind(r),r.onError.bind(r),n))})},Ne.zip=function(){if(Array.isArray(arguments[0]))return b.apply(this,arguments);var t=this,n=F.call(arguments),i=n.pop();return n.unshift(t),new Ue(function(o){function s(t){a[t]=!0,a.every(function(t){return t})&&o.onCompleted()}for(var u=n.length,c=p(u,function(){return[]}),a=p(u,function(){return!1}),l=function(n){var s,u;if(c.every(function(t){return t.length>0})){try{u=c.map(function(t){return t.shift()}),s=i.apply(t,u)}catch(l){return o.onError(l),e}o.onNext(s)}else a.filter(function(t,e){return e!==n}).every(r)&&o.onCompleted()},h=Array(u),f=0;u>f;f++)(function(t){h[t]=new ie,h[t].setDisposable(n[t].subscribe(function(e){c[t].push(e),l(t)},o.onError.bind(o),function(){s(t)}))})(f);return new Y(h)})},Oe.zip=function(){var t=F.call(arguments,0),e=t.shift();return e.zip.apply(e,t)},Oe.zipArray=function(){var t=F.call(arguments);return new Ue(function(n){function i(t){if(u.every(function(t){return t.length>0})){var i=u.map(function(t){return t.shift()});n.onNext(i)}else if(c.filter(function(e,n){return n!==t}).every(r))return n.onCompleted(),e}function o(t){return c[t]=!0,c.every(r)?(n.onCompleted(),e):e}for(var s=t.length,u=p(s,function(){return[]}),c=p(s,function(){return!1}),a=Array(s),l=0;s>l;l++)(function(e){a[e]=new ie,a[e].setDisposable(t[e].subscribe(function(t){u[e].push(t),i(e)},n.onError.bind(n),function(){o(e)}))})(l);var h=new Y(a);return h.add(te(function(){for(var t=0,e=u.length;e>t;t++)u[t]=[]})),h})},Ne.asObservable=function(){var t=this;return new Ue(function(e){return t.subscribe(e)})},Ne.dematerialize=function(){var t=this;return new Ue(function(e){return t.subscribe(function(t){return t.accept(e)},e.onError.bind(e),e.onCompleted.bind(e))})},Ne.distinctUntilChanged=function(t,n){var o=this;return t||(t=r),n||(n=i),new Ue(function(r){var i,s=!1;return o.subscribe(function(o){var u,c=!1;try{u=t(o)}catch(a){return r.onError(a),e}if(s)try{c=n(i,u)}catch(a){return r.onError(a),e}s&&c||(s=!0,i=u,r.onNext(o))},r.onError.bind(r),r.onCompleted.bind(r))})},Ne["do"]=Ne.doAction=function(t,e,n){var r,i=this;return"function"==typeof t?r=t:(r=t.onNext.bind(t),e=t.onError.bind(t),n=t.onCompleted.bind(t)),new Ue(function(t){return i.subscribe(function(e){try{r(e)}catch(n){t.onError(n)}t.onNext(e)},function(n){if(e){try{e(n)}catch(r){t.onError(r)}t.onError(n)}else t.onError(n)},function(){if(n){try{n()}catch(e){t.onError(e)}t.onCompleted()}else t.onCompleted()})})},Ne["finally"]=Ne.finallyAction=function(t){var e=this;return new Ue(function(n){var r=e.subscribe(n);return te(function(){try{r.dispose()}catch(e){throw e}finally{t()}})})},Ne.ignoreElements=function(){var t=this;return new Ue(function(e){return t.subscribe(n,e.onError.bind(e),e.onCompleted.bind(e))})},Ne.materialize=function(){var t=this;return new Ue(function(e){return t.subscribe(function(t){e.onNext(be(t))},function(t){e.onNext(ve(t)),e.onCompleted()},function(){e.onNext(me()),e.onCompleted()})})},Ne.repeat=function(t){return xe(this,t).concat()},Ne.retry=function(t){return xe(this,t).catchException()},Ne.scan=function(){var t,n,r=!1,i=this;return 2===arguments.length?(r=!0,t=arguments[0],n=arguments[1]):n=arguments[0],new Ue(function(o){var s,u,c;return i.subscribe(function(i){try{c||(c=!0),s?u=n(u,i):(u=r?n(t,i):i,s=!0)}catch(a){return o.onError(a),e}o.onNext(u)},o.onError.bind(o),function(){!c&&r&&o.onNext(t),o.onCompleted()})})},Ne.skipLast=function(t){var e=this;return new Ue(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&n.onNext(r.shift())},n.onError.bind(n),n.onCompleted.bind(n))})},Ne.startWith=function(){var t,e,n=0;return arguments.length&&"now"in Object(arguments[0])?(e=arguments[0],n=1):e=le,t=F.call(arguments,n),Ee([je(t,e),this]).concat()},Ne.takeLast=function(t,e){return this.takeLastBuffer(t).selectMany(function(t){return je(t,e)})},Ne.takeLastBuffer=function(t){var e=this;return new Ue(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&r.shift()},n.onError.bind(n),function(){n.onNext(r),n.onCompleted()})})},Ne.select=Ne.map=function(t,n){var r=this;return new Ue(function(i){var o=0;return r.subscribe(function(s){var u;try{u=t.call(n,s,o++,r)}catch(c){return i.onError(c),e}i.onNext(u)},i.onError.bind(i),i.onCompleted.bind(i))})},Ne.selectMany=Ne.flatMap=function(t,e){return e?this.selectMany(function(n){return t(n).select(function(t){return e(n,t)})}):"function"==typeof t?v.call(this,t):v.call(this,function(){return t})},Ne.selectSwitch=Ne.flatMapLatest=function(t,e){return this.select(t,e).switchLatest()},Ne.skip=function(t){if(0>t)throw Error(O);var e=this;return new Ue(function(n){var r=t;return e.subscribe(function(t){0>=r?n.onNext(t):r--},n.onError.bind(n),n.onCompleted.bind(n))})},Ne.skipWhile=function(t,n){var r=this;return new Ue(function(i){var o=0,s=!1;return r.subscribe(function(u){if(!s)try{s=!t.call(n,u,o++,r)}catch(c){return i.onError(c),e}s&&i.onNext(u)},i.onError.bind(i),i.onCompleted.bind(i))})},Ne.take=function(t,e){if(0>t)throw Error(O);if(0===t)return We(e);var n=this;return new Ue(function(e){var r=t;return n.subscribe(function(t){r>0&&(r--,e.onNext(t),0===r&&e.onCompleted())},e.onError.bind(e),e.onCompleted.bind(e))})},Ne.takeWhile=function(t,n){var r=this;return new Ue(function(i){var o=0,s=!0;return r.subscribe(function(u){if(s){try{s=t.call(n,u,o++,r)}catch(c){return i.onError(c),e}s?i.onNext(u):i.onCompleted()}},i.onError.bind(i),i.onCompleted.bind(i))})},Ne.where=Ne.filter=function(t,n){var r=this;return new Ue(function(i){var o=0;return r.subscribe(function(s){var u;try{u=t.call(n,s,o++,r)}catch(c){return i.onError(c),e}u&&i.onNext(s)},i.onError.bind(i),i.onCompleted.bind(i))})},Oe.fromCallback=function(t,n,r,i){return n||(n=pe),function(){var o=F.call(arguments,0),s=new Je;return n.schedule(function(){function n(t){var n=t;if(i)try{n=i(arguments)}catch(r){return s.onError(r),e}else 1===n.length&&(n=n[0]);s.onNext(n),s.onCompleted()}o.push(n),t.apply(r,o)}),s.asObservable()}},Oe.fromNodeCallback=function(t,n,r,i){return n||(n=pe),function(){var o=F.call(arguments,0),s=new Je;return n.schedule(function(){function n(t){if(t)return s.onError(t),e;var n=F.call(arguments,1);if(i)try{n=i(n)}catch(r){return s.onError(r),e}else 1===n.length&&(n=n[0]);s.onNext(n),s.onCompleted()}o.push(n),t.apply(r,o)}),s.asObservable()}},Oe.fromEvent=function(t,n,r){return new Ue(function(i){return y(t,n,function(t){var n=t;if(r)try{n=r(arguments)}catch(o){return i.onError(o),e}i.onNext(n)})}).publish().refCount()},Oe.fromEventPattern=function(t,n,r){return new Ue(function(i){function o(t){var n=t;if(r)try{n=r(arguments)}catch(o){return i.onError(o),e}i.onNext(n)}var s=t(o);return te(function(){n&&n(o,s)})}).publish().refCount()},Oe.fromPromise=function(t){var e=new Je;return t.then(function(t){e.onNext(t),e.onCompleted()},function(t){e.onError(t)}),e.asObservable()},Ne.multicast=function(t,e){var n=this;return"function"==typeof t?new Ue(function(r){var i=n.multicast(t());return new Y(e(i).subscribe(r),i.connect())}):new Ve(n,t)},Ne.publish=function(t){return t?this.multicast(function(){return new Xe},t):this.multicast(new Xe)},Ne.publishLast=function(t){return t?this.multicast(function(){return new Je},t):this.multicast(new Je)},Ne.publishValue=function(t,e){return 2===arguments.length?this.multicast(function(){return new Ke(e)},t):this.multicast(new Ke(t))},Ne.replay=function(t,e,n,r){return t?this.multicast(function(){return new Ge(e,n,r)},t):this.multicast(new Ge(e,n,r))};var Ve=function(t){function e(e,n){function r(t){return i.subject.subscribe(t)}var i={subject:n,source:e.asObservable(),hasSubscription:!1,subscription:null};this.connect=function(){return i.hasSubscription||(i.hasSubscription=!0,i.subscription=new Y(i.source.subscribe(i.subject),te(function(){i.hasSubscription=!1}))),i.subscription},t.call(this,r)}return X(e,t),e.prototype.connect=function(){return this.connect()},e.prototype.refCount=function(){var t=null,e=0,n=this;return new Ue(function(r){var i,o;return e++,i=1===e,o=n.subscribe(r),i&&(t=n.connect()),te(function(){o.dispose(),e--,0===e&&t.dispose()})})},e}(Oe),Me=Oe.interval=function(t,e){return e||(e=pe),g(t,t,e)},Be=Oe.timer=function(t,n,r){var i;return r||(r=pe),"number"==typeof n?i=n:"object"==typeof n&&"now"in n&&(r=n),i===e?w(t,r):g(t,i,r)};Ne.delay=function(t,e){e||(e=pe);var n=this;return new Ue(function(r){var i,o=!1,s=new oe,u=null,c=[],a=!1;return i=n.materialize().timestamp(e).subscribe(function(n){var i,l;"E"===n.value.kind?(c=[],c.push(n),u=n.value.exception,l=!a):(c.push({value:n.value,timestamp:n.timestamp+t}),l=!o,o=!0),l&&(null!==u?r.onError(u):(i=new ie,s.setDisposable(i),i.setDisposable(e.scheduleRecursiveWithRelative(t,function(t){var n,i,s,l;if(null===u){a=!0;do s=null,c.length>0&&0>=c[0].timestamp-e.now()&&(s=c.shift().value),null!==s&&s.accept(r);while(null!==s);l=!1,i=0,c.length>0?(l=!0,i=Math.max(0,c[0].timestamp-e.now())):o=!1,n=u,a=!1,null!==n?r.onError(n):l&&t(i)}}))))}),new Y(i,s)})},Ne.throttle=function(t,e){return e||(e=pe),this.throttleWithSelector(function(){return Be(t,e)})},Ne.timeInterval=function(t){var e=this;return t||(t=pe),Re(function(){var n=t.now(); | ||
return e.select(function(e){var r=t.now(),i=r-n;return n=r,{value:e,interval:i}})})},Ne.timestamp=function(t){return t||(t=pe),this.select(function(e){return{value:e,timestamp:t.now()}})},Ne.sample=function(t,e){return e||(e=pe),"number"==typeof t?x(this,Me(t,e)):x(this,t)},Ne.timeout=function(t,e,n){var r,i=this;return e||(e=Te(Error("Timeout"))),n||(n=pe),r=t instanceof Date?function(t,e){n.scheduleWithAbsolute(t,e)}:function(t,e){n.scheduleWithRelative(t,e)},new Ue(function(n){var o,s=0,u=new ie,c=new oe,a=!1,l=new oe;return c.setDisposable(u),o=function(){var i=s;l.setDisposable(r(t,function(){a=s===i;var t=a;t&&c.setDisposable(e.subscribe(n))}))},o(),u.setDisposable(i.subscribe(function(t){var e=!a;e&&(s++,n.onNext(t),o())},function(t){var e=!a;e&&(s++,n.onError(t))},function(){var t=!a;t&&(s++,n.onCompleted())})),new Y(c,l)})},Oe.generateWithTime=function(t,n,r,i,o,s){return s||(s=pe),new Ue(function(u){var c,a,l=!0,h=!1,f=t;return s.scheduleRecursiveWithRelative(0,function(t){h&&u.onNext(c);try{l?l=!1:f=r(f),h=n(f),h&&(c=i(f),a=o(f))}catch(s){return u.onError(s),e}h?t(a):u.onCompleted()})})},Ne.delaySubscription=function(t,e){return e||(e=pe),this.delayWithSelector(Be(t,e),function(){return We()})},Ne.delayWithSelector=function(t,n){var r,i,o=this;return"function"==typeof t?i=t:(r=t,i=n),new Ue(function(t){var n=new Y,s=!1,u=function(){s&&0===n.length&&t.onCompleted()},c=new oe,a=function(){c.setDisposable(o.subscribe(function(r){var o;try{o=i(r)}catch(s){return t.onError(s),e}var c=new ie;n.add(c),c.setDisposable(o.subscribe(function(){t.onNext(r),n.remove(c),u()},t.onError.bind(t),function(){t.onNext(r),n.remove(c),u()}))},t.onError.bind(t),function(){s=!0,c.dispose(),u()}))};return r?c.setDisposable(r.subscribe(function(){a()},t.onError.bind(t),function(){a()})):a(),new Y(c,n)})},Ne.timeoutWithSelector=function(t,n,r){if(1===arguments.length){n=t;var t=ke()}r||(r=Te(Error("Timeout")));var i=this;return new Ue(function(o){var s=new oe,u=new oe,c=new ie;s.setDisposable(c);var a=0,l=!1,h=function(t){var e=a,n=function(){return a===e},i=new ie;u.setDisposable(i),i.setDisposable(t.subscribe(function(){n()&&s.setDisposable(r.subscribe(o)),i.dispose()},function(t){n()&&o.onError(t)},function(){n()&&s.setDisposable(r.subscribe(o))}))};h(t);var f=function(){var t=!l;return t&&a++,t};return c.setDisposable(i.subscribe(function(t){if(f()){o.onNext(t);var r;try{r=n(t)}catch(i){return o.onError(i),e}h(r)}},function(t){f()&&o.onError(t)},function(){f()&&o.onCompleted()})),new Y(s,u)})},Ne.throttleWithSelector=function(t){var n=this;return new Ue(function(r){var i,o=!1,s=new oe,u=0,c=n.subscribe(function(n){var c;try{c=t(n)}catch(a){return r.onError(a),e}o=!0,i=n,u++;var l=u,h=new ie;s.setDisposable(h),h.setDisposable(c.subscribe(function(){o&&u===l&&r.onNext(i),o=!1,h.dispose()},r.onError.bind(r),function(){o&&u===l&&r.onNext(i),o=!1,h.dispose()}))},function(t){s.dispose(),r.onError(t),o=!1,u++},function(){s.dispose(),o&&r.onNext(i),r.onCompleted(),o=!1,u++});return new Y(c,s)})},Ne.skipLastWithTime=function(t,e){e||(e=pe);var n=this;return new Ue(function(r){var i=[];return n.subscribe(function(n){var o=e.now();for(i.push({interval:o,value:n});i.length>0&&o-i[0].interval>=t;)r.onNext(i.shift().value)},r.onError.bind(r),function(){for(var n=e.now();i.length>0&&n-i[0].interval>=t;)r.onNext(i.shift().value);r.onCompleted()})})},Ne.takeLastWithTime=function(t,e,n){return this.takeLastBufferWithTime(t,e).selectMany(function(t){return je(t,n)})},Ne.takeLastBufferWithTime=function(t,e){var n=this;return e||(e=pe),new Ue(function(r){var i=[];return n.subscribe(function(n){var r=e.now();for(i.push({interval:r,value:n});i.length>0&&r-i[0].interval>=t;)i.shift()},r.onError.bind(r),function(){for(var n=e.now(),o=[];i.length>0;){var s=i.shift();t>=n-s.interval&&o.push(s.value)}r.onNext(o),r.onCompleted()})})},Ne.takeWithTime=function(t,e){var n=this;return e||(e=pe),new Ue(function(r){var i=e.scheduleWithRelative(t,function(){r.onCompleted()});return new Y(i,n.subscribe(r))})},Ne.skipWithTime=function(t,e){var n=this;return e||(e=pe),new Ue(function(r){var i=!1,o=e.scheduleWithRelative(t,function(){i=!0}),s=n.subscribe(function(t){i&&r.onNext(t)},r.onError.bind(r),r.onCompleted.bind(r));return new Y(o,s)})},Ne.skipUntilWithTime=function(t,e){e||(e=pe);var n=this;return new Ue(function(r){var i=!1,o=e.scheduleWithAbsolute(t,function(){i=!0}),s=n.subscribe(function(t){i&&r.onNext(t)},r.onError.bind(r),r.onCompleted.bind(r));return new Y(o,s)})},Ne.takeUntilWithTime=function(t,e){e||(e=pe);var n=this;return new Ue(function(r){return new Y(e.scheduleWithAbsolute(t,function(){r.onCompleted()}),n.subscribe(r))})};var Ue=N.Internals.AnonymousObservable=function(t){function n(t){return t===e?t=ee:"function"==typeof t&&(t=te(t)),t}function r(i){function o(t){var e=new He(t);if(ae.scheduleRequired())ae.schedule(function(){try{e.setDisposable(n(i(e)))}catch(t){if(!e.fail(t))throw t}});else try{e.setDisposable(n(i(e)))}catch(r){if(!e.fail(r))throw r}return e}return this instanceof r?(t.call(this,o),e):new r(i)}return X(r,t),r}(Oe),He=function(t){function e(e){t.call(this),this.observer=e,this.m=new ie}X(e,t);var n=e.prototype;return n.next=function(t){var e=!1;try{this.observer.onNext(t),e=!0}catch(n){throw n}finally{e||this.dispose()}},n.error=function(t){try{this.observer.onError(t)}catch(e){throw e}finally{this.dispose()}},n.completed=function(){try{this.observer.onCompleted()}catch(t){throw t}finally{this.dispose()}},n.setDisposable=function(t){this.m.setDisposable(t)},n.getDisposable=function(){return this.m.getDisposable()},n.disposable=function(t){return arguments.length?this.getDisposable():setDisposable(t)},n.dispose=function(){t.prototype.dispose.call(this),this.m.dispose()},e}(Se),Fe=function(t,e){this.subject=t,this.observer=e};Fe.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1),this.observer=null}};var Xe=N.Subject=function(t){function e(t){return u.call(this),this.isStopped?this.exception?(t.onError(this.exception),ee):(t.onCompleted(),ee):(this.observers.push(t),new Fe(this,t))}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return X(n,t),J(n.prototype,Ce,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(u.call(this),!this.isStopped){var t=this.observers.slice(0);this.isStopped=!0;for(var e=0,n=t.length;n>e;e++)t[e].onCompleted();this.observers=[]}},onError:function(t){if(u.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){if(u.call(this),!this.isStopped)for(var e=this.observers.slice(0),n=0,r=e.length;r>n;n++)e[n].onNext(t)},dispose:function(){this.isDisposed=!0,this.observers=null}}),n.create=function(t,e){return new Qe(t,e)},n}(Oe),Je=N.AsyncSubject=function(t){function e(t){if(u.call(this),!this.isStopped)return this.observers.push(t),new Fe(this,t);var e=this.exception,n=this.hasValue,r=this.value;return e?t.onError(e):n?(t.onNext(r),t.onCompleted()):t.onCompleted(),ee}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return X(n,t),J(n.prototype,Ce,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){var t,e,n;if(u.call(this),!this.isStopped){var r=this.observers.slice(0);this.isStopped=!0;var i=this.value,o=this.hasValue;if(o)for(e=0,n=r.length;n>e;e++)t=r[e],t.onNext(i),t.onCompleted();else for(e=0,n=r.length;n>e;e++)r[e].onCompleted();this.observers=[]}},onError:function(t){if(u.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){u.call(this),this.isStopped||(this.value=t,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),n}(Oe),Qe=function(t){function e(t){return this.observable.subscribe(t)}function n(n,r){t.call(this,e),this.observer=n,this.observable=r}return X(n,t),J(n.prototype,Ce,{onCompleted:function(){this.observer.onCompleted()},onError:function(t){this.observer.onError(t)},onNext:function(t){this.observer.onNext(t)}}),n}(Oe),Ke=N.BehaviorSubject=function(t){function e(t){if(u.call(this),!this.isStopped)return this.observers.push(t),t.onNext(this.value),new Fe(this,t);var e=this.exception;return e?t.onError(e):t.onCompleted(),ee}function n(n){t.call(this,e),this.value=n,this.observers=[],this.isDisposed=!1,this.isStopped=!1,this.exception=null}return X(n,t),J(n.prototype,Ce,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(u.call(this),!this.isStopped){var t=this.observers.slice(0);this.isStopped=!0;for(var e=0,n=t.length;n>e;e++)t[e].onCompleted();this.observers=[]}},onError:function(t){if(u.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){if(u.call(this),!this.isStopped){this.value=t;for(var e=this.observers.slice(0),n=0,r=e.length;r>n;n++)e[n].onNext(t)}},dispose:function(){this.isDisposed=!0,this.observers=null,this.value=null,this.exception=null}}),n}(Oe),Ge=N.ReplaySubject=function(t){function e(t,e){this.subject=t,this.observer=e}function n(t){var n=new _e(this.scheduler,t),r=new e(this,n);u.call(this),this._trim(this.scheduler.now()),this.observers.push(n);for(var i=this.q.length,o=0,s=this.q.length;s>o;o++)n.onNext(this.q[o].value);return this.hasError?(i++,n.onError(this.error)):this.isStopped&&(i++,n.onCompleted()),n.ensureActive(i),r}function r(e,r,i){this.bufferSize=null==e?Number.MAX_VALUE:e,this.windowSize=null==r?Number.MAX_VALUE:r,this.scheduler=i||ae,this.q=[],this.observers=[],this.isStopped=!1,this.isDisposed=!1,this.hasError=!1,this.error=null,t.call(this,n)}return e.prototype.dispose=function(){if(this.observer.dispose(),!this.subject.isDisposed){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1)}},X(r,t),J(r.prototype,Ce,{hasObservers:function(){return this.observers.length>0},_trim:function(t){for(;this.q.length>this.bufferSize;)this.q.shift();for(;this.q.length>0&&t-this.q[0].interval>this.windowSize;)this.q.shift()},onNext:function(t){var e;if(u.call(this),!this.isStopped){var n=this.scheduler.now();this.q.push({interval:n,value:t}),this._trim(n);for(var r=this.observers.slice(0),i=0,o=r.length;o>i;i++)e=r[i],e.onNext(t),e.ensureActive()}},onError:function(t){var e;if(u.call(this),!this.isStopped){this.isStopped=!0,this.error=t,this.hasError=!0;var n=this.scheduler.now();this._trim(n);for(var r=this.observers.slice(0),i=0,o=r.length;o>i;i++)e=r[i],e.onError(t),e.ensureActive();this.observers=[]}},onCompleted:function(){var t;if(u.call(this),!this.isStopped){this.isStopped=!0;var e=this.scheduler.now();this._trim(e);for(var n=this.observers.slice(0),r=0,i=n.length;i>r;r++)t=n[r],t.onCompleted(),t.ensureActive();this.observers=[]}},dispose:function(){this.isDisposed=!0,this.observers=null}}),r}(Oe);return"function"==typeof define&&"object"==typeof define.amd&&define.amd?(t.Rx=N,define(function(){return N})):(E?"object"==typeof module&&module&&module.exports==E?module.exports=N:E=N:t.Rx=N,e)})(this); | ||
(function(a){function b(){}function c(a){return a}function d(a,b){return U(a,b)}function e(a,b){return a-b}function f(a){throw a}function g(){if(this.isDisposed)throw new Error(G)}function h(a){return"function"!=typeof a.toString&&"string"==typeof(a+"")}function i(a){return a&&"object"==typeof a?Q.call(a)==H:!1}function j(a){return"function"==typeof a}function k(a,b,c,d){var e;if(a===b)return 0!==a||1/a==1/b;var f=typeof a,g=typeof b;if(!(a!==a||a&&v[f]||b&&v[g]))return!1;if(null==a||null==b)return a===b;var l=Q.call(a),m=Q.call(b);if(l==H&&(l=N),m==H&&(m=N),l!=m)return!1;switch(l){case J:case K:return+a==+b;case M:return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case O:case P:return a==String(b)}var n=l==I;if(!n){if(l!=N||!B&&(h(a)||h(b)))return!1;var o=!S&&i(a)?Object:a.constructor,p=!S&&i(b)?Object:b.constructor;if(o!=p&&!(j(o)&&o instanceof o&&j(p)&&p instanceof p))return!1}for(var q=c.length;q--;)if(c[q]==a)return d[q]==b;var r=0;if(e=!0,c.push(a),d.push(b),n){for(q=a.length,r=b.length,e=r==a.length;r--;){var s=b[r];if(!(e=k(a[r],s,c,d)))break}return e}for(var t in b)if(R.call(b,t))return r++,e=R.call(a,t)&&k(a[t],b[t],c,d);if(e)for(var t in a)if(R.call(a,t))return e=--r>-1;return c.pop(),d.pop(),e}function l(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:V.call(a)}function m(a,b){for(var c=new Array(a),d=0;a>d;d++)c[d]=b();return c}function n(a,b){return new Vb(function(c){var d=new fb,e=new gb;return e.setDisposable(d),d.setDisposable(a.subscribe(c.onNext.bind(c),function(a){var d,f;try{f=b(a)}catch(g){return c.onError(g),void 0}d=new fb,e.setDisposable(d),d.setDisposable(f.subscribe(c))},c.onCompleted.bind(c))),e})}function o(a,b){var c=this;return new Vb(function(d){var e=0,f=a.length;return c.subscribe(function(c){if(f>e){var g,h=a[e++];try{g=b(c,h)}catch(i){return d.onError(i),void 0}d.onNext(g)}else d.onCompleted()},d.onError.bind(d),d.onCompleted.bind(d))})}function p(a){return this.select(a).mergeObservable()}function q(a,b,c){return a.addListener?(a.addListener(b,c),cb(function(){a.removeListener(b,c)})):a.addEventListener?(a.addEventListener(b,c,!1),cb(function(){a.removeEventListener(b,c,!1)})):void 0}function r(a,b,c){var d=new _;if(a&&a.length)for(var e=0,f=a.length;f>e;e++)d.add(r(a[e],b,c));else a&&d.add(q(a,b,c));return d}function s(a,b){var c=jb(a);return new Vb(function(a){return b.scheduleWithRelative(c,function(){a.onNext(0),a.onCompleted()})})}function t(a,b,c){return a===b?new Vb(function(a){return c.schedulePeriodicWithState(0,b,function(b){return a.onNext(b),b+1})}):Ib(function(){return observableTimerDateAndPeriod(c.now()+a,b,c)})}function u(a,b){return new Vb(function(c){function d(){g&&(g=!1,c.onNext(f)),e&&c.onCompleted()}var e,f,g;return new _(a.subscribe(function(a){g=!0,f=a},c.onError.bind(c),function(){e=!0}),b.subscribe(d,c.onError.bind(c),d))})}var v={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},w=v[typeof window]&&window||this,x=v[typeof exports]&&exports&&!exports.nodeType&&exports,y=v[typeof module]&&module&&!module.nodeType&&module,z=y&&y.exports===x&&x,A=v[typeof global]&&global;!A||A.global!==A&&A.window!==A||(w=A);var B,C={Internals:{}},D=Date.now,E="Sequence contains no elements.",F="Argument out of range",G="Object has been disposed",v={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},H="[object Arguments]",I="[object Array]",J="[object Boolean]",K="[object Date]",L="[object Function]",M="[object Number]",N="[object Object]",O="[object RegExp]",P="[object String]",Q=Object.prototype.toString,R=Object.prototype.hasOwnProperty,S=Q.call(arguments)==H;try{B=!(Q.call(document)==N&&!({toString:0}+""))}catch(T){B=!0}S||(i=function(a){return a&&"object"==typeof a?R.call(a,"callee"):!1}),j(/x/)&&(j=function(a){return"function"==typeof a&&Q.call(a)==L});var U=C.Internals.isEqual=function(a,b){return k(a,b,[],[])},V=Array.prototype.slice;({}).hasOwnProperty;var W=this.inherits=C.Internals.inherits=function(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c},X=C.Internals.addProperties=function(a){for(var b=V.call(arguments,1),c=0,d=b.length;d>c;c++){var e=b[c];for(var f in e)a[f]=e[f]}};C.Internals.addRef=function(a,b){return new Vb(function(c){return new _(b.getDisposable(),a.subscribe(c))})};var Y=function(a,b){this.id=a,this.value=b};Y.prototype.compareTo=function(a){var b=this.value.compareTo(a.value);return 0===b&&(b=this.id-a.id),b};var Z=C.Internals.PriorityQueue=function(a){this.items=new Array(a),this.length=0},$=Z.prototype;$.isHigherPriority=function(a,b){return this.items[a].compareTo(this.items[b])<0},$.percolate=function(a){if(!(a>=this.length||0>a)){var b=a-1>>1;if(!(0>b||b===a)&&this.isHigherPriority(a,b)){var c=this.items[a];this.items[a]=this.items[b],this.items[b]=c,this.percolate(b)}}},$.heapify=function(b){if(b===a&&(b=0),!(b>=this.length||0>b)){var c=2*b+1,d=2*b+2,e=b;if(c<this.length&&this.isHigherPriority(c,e)&&(e=c),d<this.length&&this.isHigherPriority(d,e)&&(e=d),e!==b){var f=this.items[b];this.items[b]=this.items[e],this.items[e]=f,this.heapify(e)}}},$.peek=function(){return this.items[0].value},$.removeAt=function(a){this.items[a]=this.items[--this.length],delete this.items[this.length],this.heapify()},$.dequeue=function(){var a=this.peek();return this.removeAt(0),a},$.enqueue=function(a){var b=this.length++;this.items[b]=new Y(Z.count++,a),this.percolate(b)},$.remove=function(a){for(var b=0;b<this.length;b++)if(this.items[b].value===a)return this.removeAt(b),!0;return!1},Z.count=0;var _=C.CompositeDisposable=function(){this.disposables=l(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},ab=_.prototype;ab.add=function(a){this.isDisposed?a.dispose():(this.disposables.push(a),this.length++)},ab.remove=function(a){var b=!1;if(!this.isDisposed){var c=this.disposables.indexOf(a);-1!==c&&(b=!0,this.disposables.splice(c,1),this.length--,a.dispose())}return b},ab.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.disposables.slice(0);this.disposables=[],this.length=0;for(var b=0,c=a.length;c>b;b++)a[b].dispose()}},ab.clear=function(){var a=this.disposables.slice(0);this.disposables=[],this.length=0;for(var b=0,c=a.length;c>b;b++)a[b].dispose()},ab.contains=function(a){return-1!==this.disposables.indexOf(a)},ab.toArray=function(){return this.disposables.slice(0)};var bb=C.Disposable=function(a){this.isDisposed=!1,this.action=a||b};bb.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var cb=bb.create=function(a){return new bb(a)},db=bb.empty={dispose:b},eb=function(){function a(a){this.isSingle=a,this.isDisposed=!1,this.current=null}var b=a.prototype;return b.getDisposable=function(){return this.current},b.setDisposable=function(a){if(this.current&&this.isSingle)throw new Error("Disposable has already been assigned");var b,c=this.isDisposed;c||(b=this.current,this.current=a),b&&b.dispose(),c&&a&&a.dispose()},b.dispose=function(){var a;this.isDisposed||(this.isDisposed=!0,a=this.current,this.current=null),a&&a.dispose()},a}(),fb=C.SingleAssignmentDisposable=function(a){function b(){a.call(this,!0)}return W(b,a),b}(eb),gb=C.SerialDisposable=function(a){function b(){a.call(this,!1)}return W(b,a),b}(eb);C.RefCountDisposable=function(){function a(a){this.disposable=a,this.disposable.count++,this.isInnerDisposed=!1}function b(a){this.underlyingDisposable=a,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return a.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},b.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},b.prototype.getDisposable=function(){return this.isDisposed?db:new a(this)},b}();var hb=C.Internals.ScheduledItem=function(a,b,c,d,f){this.scheduler=a,this.state=b,this.action=c,this.dueTime=d,this.comparer=f||e,this.disposable=new fb};hb.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},hb.prototype.compareTo=function(a){return this.comparer(this.dueTime,a.dueTime)},hb.prototype.isCancelled=function(){return this.disposable.isDisposed},hb.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var ib=C.Scheduler=function(){function a(a,b,c,d){this.now=a,this._schedule=b,this._scheduleRelative=c,this._scheduleAbsolute=d}function b(a,b){var c=b.first,d=b.second,e=new _,f=function(b){d(b,function(b){var c=!1,d=!1,g=a.scheduleWithState(b,function(a,b){return c?e.remove(g):d=!0,f(b),db});d||(e.add(g),c=!0)})};return f(c),e}function c(a,b,c){var d=b.first,e=b.second,f=new _,g=function(b){e(b,function(b,d){var e=!1,h=!1,i=a[c].call(a,b,d,function(a,b){return e?f.remove(i):h=!0,g(b),db});h||(f.add(i),e=!0)})};return g(d),f}function d(a,b){return b(),db}var e=a.prototype;return e.schedulePeriodic=function(a,b){return this.schedulePeriodicWithState(null,a,function(){b()})},e.schedulePeriodicWithState=function(a,b,c){var d=a,e=setInterval(function(){d=c(d)},b);return cb(function(){clearInterval(e)})},e.schedule=function(a){return this._schedule(a,d)},e.scheduleWithState=function(a,b){return this._schedule(a,b)},e.scheduleWithRelative=function(a,b){return this._scheduleRelative(b,a,d)},e.scheduleWithRelativeAndState=function(a,b,c){return this._scheduleRelative(a,b,c)},e.scheduleWithAbsolute=function(a,b){return this._scheduleAbsolute(b,a,d)},e.scheduleWithAbsoluteAndState=function(a,b,c){return this._scheduleAbsolute(a,b,c)},e.scheduleRecursive=function(a){return this.scheduleRecursiveWithState(a,function(a,b){a(function(){b(a)})})},e.scheduleRecursiveWithState=function(a,c){return this.scheduleWithState({first:a,second:c},function(a,c){return b(a,c)})},e.scheduleRecursiveWithRelative=function(a,b){return this.scheduleRecursiveWithRelativeAndState(b,a,function(a,b){a(function(c){b(a,c)})})},e.scheduleRecursiveWithRelativeAndState=function(a,b,d){return this._scheduleRelative({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithRelativeAndState")})},e.scheduleRecursiveWithAbsolute=function(a,b){return this.scheduleRecursiveWithAbsoluteAndState(b,a,function(a,b){a(function(c){b(a,c)})})},e.scheduleRecursiveWithAbsoluteAndState=function(a,b,d){return this._scheduleAbsolute({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithAbsoluteAndState")})},a.now=D,a.normalize=function(a){return 0>a&&(a=0),a},a}(),jb=ib.normalize,kb=ib.immediate=function(){function a(a,b){return b(this,a)}function b(a,b,c){for(var d=jb(d);d-this.now()>0;);return c(this,a)}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new ib(D,a,b,c)}(),lb=ib.currentThread=function(){function a(){e=new Z(4)}function b(a,b){return this.scheduleWithRelativeAndState(a,0,b)}function c(b,c,d){var f,g=this.now()+jb(c),h=new hb(this,b,d,g);if(e)e.enqueue(h);else{f=new a;try{e.enqueue(h),f.run()}catch(i){throw i}finally{f.dispose()}}return h.disposable}function d(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}var e;a.prototype.dispose=function(){e=null},a.prototype.run=function(){for(var a;e.length>0;)if(a=e.dequeue(),!a.isCancelled()){for(;a.dueTime-ib.now()>0;);a.isCancelled()||a.invoke()}};var f=new ib(D,b,c,d);return f.scheduleRequired=function(){return null===e},f.ensureTrampoline=function(a){return null===e?this.schedule(a):a()},f}();C.Internals.SchedulePeriodicRecursive=function(){function a(a,b){b(0,this._period);try{this._state=this._action(this._state)}catch(c){throw this._cancel.dispose(),c}}function b(a,b,c,d){this._scheduler=a,this._state=b,this._period=c,this._action=d}return b.prototype.start=function(){var b=new fb;return this._cancel=b,b.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,a.bind(this))),b},b}();var mb,nb=RegExp("^"+String(Q).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),ob="function"==typeof(ob=A&&z&&A.setImmediate)&&!nb.test(ob)&&ob,pb="function"==typeof(pb=A&&z&&A.clearImmediate)&&!nb.test(pb)&&pb,qb=b;!function(){function a(){if(!w.postMessage||w.importScripts)return!1;var a=!1,b=w.onmessage;return w.onmessage=function(){a=!0},w.postMessage("","*"),w.onmessage=b,a}function b(a){if("string"==typeof a.data&&a.data.substring(0,c.length)===c){var b=a.data.substring(c.length),e=d[b];e(),delete d[b]}}if("function"==typeof ob)mb=ob,qb=pb;else if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))mb=process.nextTick;else if(a()){var c="ms.rx.schedule"+Math.random(),d={},e=0;w.addEventListener?w.addEventListener("message",b,!1):w.attachEvent("onmessage",b,!1),mb=function(a){var b=e++;d[b]=a,w.postMessage(c+b,"*")}}else if(w.MessageChannel){var f=new w.MessageChannel,g={},h=0;f.port1.onmessage=function(a){var b=a.data,c=g[b];c(),delete g[b]},mb=function(a){var b=h++;g[b]=a,f.port2.postMessage(b)}}else"document"in w&&"onreadystatechange"in w.document.createElement("script")?mb=function(a){var b=w.document.createElement("script");b.onreadystatechange=function(){a(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},w.document.documentElement.appendChild(b)}:(mb=function(a){return setTimeout(a,0)},qb=clearTimeout)}();var rb=ib.timeout=function(){function a(a,b){var c=this,d=new fb,e=mb(function(){d.isDisposed||d.setDisposable(b(c,a))});return new _(d,cb(function(){qb(e)}))}function b(a,b,c){var d=this,e=ib.normalize(b);if(0===e)return d.scheduleWithState(a,c);var f=new fb,g=setTimeout(function(){f.isDisposed||f.setDisposable(c(d,a))},e);return new _(f,cb(function(){clearTimeout(g)}))}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new ib(D,a,b,c)}(),sb=C.Notification=function(){function a(a,b){this.hasValue=null==b?!1:b,this.kind=a}var b=a.prototype;return b.accept=function(a,b,c){return 1===arguments.length&&"object"==typeof a?this._acceptObservable(a):this._accept(a,b,c)},b.toObservable=function(a){var b=this;return a||(a=kb),new Vb(function(c){return a.schedule(function(){b._acceptObservable(c),"N"===b.kind&&c.onCompleted()})})},a}(),tb=sb.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 sb("N",!0);return e.value=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),ub=sb.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 sb("E");return e.exception=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),vb=sb.createOnCompleted=function(){function a(a,b,c){return c()}function b(a){return a.onCompleted()}function c(){return"OnCompleted()"}return function(){var d=new sb("C");return d._accept=a,d._acceptObservable=b,d.toString=c,d}}(),wb=C.Internals.Enumerator=function(a,b){this.moveNext=a,this.getCurrent=b},xb=wb.create=function(a,b){var c=!1;return new wb(function(){if(c)return!1;var b=a();return b||(c=!0),b},function(){return b()})},yb=C.Internals.Enumerable=function(a){this.getEnumerator=a};yb.prototype.concat=function(){var a=this;return new Vb(function(b){var c,d=a.getEnumerator(),e=new gb,f=kb.scheduleRecursive(function(a){var f,g;if(!c){try{g=d.moveNext(),g&&(f=d.getCurrent())}catch(h){return b.onError(h),void 0}if(!g)return b.onCompleted(),void 0;var i=new fb;e.setDisposable(i),i.setDisposable(f.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){a()}))}});return new _(e,f,cb(function(){c=!0}))})},yb.prototype.catchException=function(){var a=this;return new Vb(function(b){var c,d,e=a.getEnumerator(),f=new gb,g=kb.scheduleRecursive(function(a){var g,h;if(!c){try{h=e.moveNext(),h&&(g=e.getCurrent())}catch(i){return b.onError(i),void 0}if(!h)return d?b.onError(d):b.onCompleted(),void 0;var j=new fb;f.setDisposable(j),j.setDisposable(g.subscribe(b.onNext.bind(b),function(b){d=b,a()},b.onCompleted.bind(b)))}});return new _(f,g,cb(function(){c=!0}))})};var zb=yb.repeat=function(a,b){return 1===arguments.length&&(b=-1),new yb(function(){var c,d=b;return xb(function(){return 0===d?!1:(d>0&&d--,c=a,!0)},function(){return c})})},Ab=yb.forEach=function(a,b,d){return b||(b=c),new yb(function(){var c,e=-1;return xb(function(){return++e<a.length?(c=b.call(d,a[e],e,a),!0):!1},function(){return c})})},Bb=C.Observer=function(){};Bb.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},Bb.prototype.asObserver=function(){return new Fb(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))};var Cb=Bb.create=function(a,c,d){return a||(a=b),c||(c=f),d||(d=b),new Fb(a,c,d)};Bb.fromNotifier=function(a){return new Fb(function(b){return a(tb(b))},function(b){return a(ub(b))},function(){return a(vb())})};var Db,Eb=C.Internals.AbstractObserver=function(a){function b(){this.isStopped=!1,a.call(this)}return W(b,a),b.prototype.onNext=function(a){this.isStopped||this.next(a)},b.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.error(a))},b.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},b.prototype.dispose=function(){this.isStopped=!0},b.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.error(a),!0)},b}(Bb),Fb=C.AnonymousObserver=function(a){function b(b,c,d){a.call(this),this._onNext=b,this._onError=c,this._onCompleted=d}return W(b,a),b.prototype.next=function(a){this._onNext(a)},b.prototype.error=function(a){this._onError(a)},b.prototype.completed=function(){this._onCompleted()},b}(Eb),Gb=C.Observable=function(){function a(a){this._subscribe=a}return Db=a.prototype,Db.finalValue=function(){var a=this;return new Vb(function(b){var c,d=!1;return a.subscribe(function(a){d=!0,c=a},b.onError.bind(b),function(){d?(b.onNext(c),b.onCompleted()):b.onError(new Error(E))})})},Db.subscribe=Db.forEach=function(a,b,c){var d;return d="object"==typeof a?a:Cb(a,b,c),this._subscribe(d)},Db.toArray=function(){function a(a,b){var c=a.slice(0);return c.push(b),c}return this.scan([],a).startWith([]).finalValue()},a}(),Hb=C.Internals.ScheduledObserver=function(a){function b(b,c){a.call(this),this.scheduler=b,this.observer=c,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new gb}return W(b,a),b.prototype.next=function(a){var b=this;this.queue.push(function(){b.observer.onNext(a)})},b.prototype.error=function(a){var b=this;this.queue.push(function(){b.observer.onError(a)})},b.prototype.completed=function(){var a=this;this.queue.push(function(){a.observer.onCompleted()})},b.prototype.ensureActive=function(){var a=!1,b=this;!this.hasFaulted&&this.queue.length>0&&(a=!this.isAcquired,this.isAcquired=!0),a&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(a){var c;if(!(b.queue.length>0))return b.isAcquired=!1,void 0;c=b.queue.shift();try{c()}catch(d){throw b.queue=[],b.hasFaulted=!0,d}a()}))},b.prototype.dispose=function(){a.prototype.dispose.call(this),this.disposable.dispose()},b}(Eb);Gb.create=Gb.createWithDisposable=function(a){return new Vb(a)};var Ib=Gb.defer=function(a){return new Vb(function(b){var c;try{c=a()}catch(d){return Nb(d).subscribe(b)}return c.subscribe(b)})},Jb=Gb.empty=function(a){return a||(a=kb),new Vb(function(b){return a.schedule(function(){b.onCompleted()})})},Kb=Gb.fromArray=function(a,b){return b||(b=lb),new Vb(function(c){var d=0;return b.scheduleRecursive(function(b){d<a.length?(c.onNext(a[d++]),b()):c.onCompleted()})})};Gb.generate=function(a,b,c,d,e){return e||(e=lb),new Vb(function(f){var g=!0,h=a;return e.scheduleRecursive(function(a){var e,i;try{g?g=!1:h=c(h),e=b(h),e&&(i=d(h))}catch(j){return f.onError(j),void 0}e?(f.onNext(i),a()):f.onCompleted()})})};var Lb=Gb.never=function(){return new Vb(function(){return db})};Gb.range=function(a,b,c){return c||(c=lb),new Vb(function(d){return c.scheduleRecursiveWithState(0,function(c,e){b>c?(d.onNext(a+c),e(c+1)):d.onCompleted()})})},Gb.repeat=function(a,b,c){return c||(c=lb),null==b&&(b=-1),Mb(a,c).repeat(b)};var Mb=Gb["return"]=Gb.returnValue=function(a,b){return b||(b=kb),new Vb(function(c){return b.schedule(function(){c.onNext(a),c.onCompleted()})})},Nb=Gb["throw"]=Gb.throwException=function(a,b){return b||(b=kb),new Vb(function(c){return b.schedule(function(){c.onError(a)})})};Db["catch"]=Db.catchException=function(a){return"function"==typeof a?n(this,a):Ob([this,a])};var Ob=Gb.catchException=Gb["catch"]=function(){var a=l(arguments,0);return Ab(a).catchException()};Db.combineLatest=function(){var a=V.call(arguments);return Array.isArray(a[0])?a[0].unshift(this):a.unshift(this),Pb.apply(this,a)};var Pb=Gb.combineLatest=function(){var a=V.call(arguments),b=a.pop();return Array.isArray(a[0])&&(a=a[0]),new Vb(function(d){function e(a){var e;if(i[a]=!0,j||(j=i.every(c))){try{e=b.apply(null,l)}catch(f){return d.onError(f),void 0}d.onNext(e)}else k.filter(function(b,c){return c!==a}).every(c)&&d.onCompleted()}function f(a){k[a]=!0,k.every(c)&&d.onCompleted()}for(var g=function(){return!1},h=a.length,i=m(h,g),j=!1,k=m(h,g),l=new Array(h),n=new Array(h),o=0;h>o;o++)!function(b){n[b]=new fb,n[b].setDisposable(a[b].subscribe(function(a){l[b]=a,e(b)},d.onError.bind(d),function(){f(b)}))}(o);return new _(n)})};Db.concat=function(){var a=V.call(arguments,0);return a.unshift(this),Qb.apply(this,a)};var Qb=Gb.concat=function(){var a=l(arguments,0);return Ab(a).concat()};Db.concatObservable=Db.concatAll=function(){return this.merge(1)},Db.merge=function(a){if("number"!=typeof a)return Rb(this,a);var b=this;return new Vb(function(c){var d=0,e=new _,f=!1,g=[],h=function(a){var b=new fb;e.add(b),b.setDisposable(a.subscribe(c.onNext.bind(c),c.onError.bind(c),function(){var a;e.remove(b),g.length>0?(a=g.shift(),h(a)):(d--,f&&0===d&&c.onCompleted())}))};return e.add(b.subscribe(function(b){a>d?(d++,h(b)):g.push(b)},c.onError.bind(c),function(){f=!0,0===d&&c.onCompleted()})),e})};var Rb=Gb.merge=function(){var a,b;return arguments[0]?arguments[0].now?(a=arguments[0],b=V.call(arguments,1)):(a=kb,b=V.call(arguments,0)):(a=kb,b=V.call(arguments,1)),Array.isArray(b[0])&&(b=b[0]),Kb(b,a).mergeObservable()};Db.mergeObservable=Db.mergeAll=function(){var a=this;return new Vb(function(b){var c=new _,d=!1,e=new fb;return c.add(e),e.setDisposable(a.subscribe(function(a){var e=new fb;c.add(e),e.setDisposable(a.subscribe(function(a){b.onNext(a)},b.onError.bind(b),function(){c.remove(e),d&&1===c.length&&b.onCompleted()}))},b.onError.bind(b),function(){d=!0,1===c.length&&b.onCompleted()})),c})},Db.skipUntil=function(a){var b=this;return new Vb(function(c){var d=!1,e=new _(b.subscribe(function(a){d&&c.onNext(a)},c.onError.bind(c),function(){d&&c.onCompleted()})),f=new fb;return e.add(f),f.setDisposable(a.subscribe(function(){d=!0,f.dispose()},c.onError.bind(c),function(){f.dispose()})),e})},Db["switch"]=Db.switchLatest=function(){var a=this;return new Vb(function(b){var c=!1,d=new gb,e=!1,f=0,g=a.subscribe(function(a){var g=new fb,h=++f;c=!0,d.setDisposable(g),g.setDisposable(a.subscribe(function(a){f===h&&b.onNext(a)},function(a){f===h&&b.onError(a)},function(){f===h&&(c=!1,e&&b.onCompleted())}))},b.onError.bind(b),function(){e=!0,c||b.onCompleted()});return new _(g,d)})},Db.takeUntil=function(a){var c=this;return new Vb(function(d){return new _(c.subscribe(d),a.subscribe(d.onCompleted.bind(d),d.onError.bind(d),b))})},Db.zip=function(){if(Array.isArray(arguments[0]))return o.apply(this,arguments);var a=this,b=V.call(arguments),d=b.pop();return b.unshift(a),new Vb(function(e){function f(a){i[a]=!0,i.every(function(a){return a})&&e.onCompleted()}for(var g=b.length,h=m(g,function(){return[]}),i=m(g,function(){return!1}),j=function(b){var f,g;if(h.every(function(a){return a.length>0})){try{g=h.map(function(a){return a.shift()}),f=d.apply(a,g)}catch(j){return e.onError(j),void 0}e.onNext(f)}else i.filter(function(a,c){return c!==b}).every(c)&&e.onCompleted()},k=new Array(g),l=0;g>l;l++)!function(a){k[a]=new fb,k[a].setDisposable(b[a].subscribe(function(b){h[a].push(b),j(a)},e.onError.bind(e),function(){f(a)}))}(l);return new _(k)})},Gb.zip=function(){var a=V.call(arguments,0),b=a.shift();return b.zip.apply(b,a)},Gb.zipArray=function(){var a=V.call(arguments);return new Vb(function(b){function d(a){if(g.every(function(a){return a.length>0})){var d=g.map(function(a){return a.shift()});b.onNext(d)}else if(h.filter(function(b,c){return c!==a}).every(c))return b.onCompleted(),void 0}function e(a){return h[a]=!0,h.every(c)?(b.onCompleted(),void 0):void 0}for(var f=a.length,g=m(f,function(){return[]}),h=m(f,function(){return!1}),i=new Array(f),j=0;f>j;j++)!function(c){i[c]=new fb,i[c].setDisposable(a[c].subscribe(function(a){g[c].push(a),d(c)},b.onError.bind(b),function(){e(c)}))}(j);var k=new _(i);return k.add(cb(function(){for(var a=0,b=g.length;b>a;a++)g[a]=[]})),k})},Db.asObservable=function(){var a=this;return new Vb(function(b){return a.subscribe(b)})},Db.dematerialize=function(){var a=this;return new Vb(function(b){return a.subscribe(function(a){return a.accept(b)},b.onError.bind(b),b.onCompleted.bind(b))})},Db.distinctUntilChanged=function(a,b){var e=this;return a||(a=c),b||(b=d),new Vb(function(c){var d,f=!1;return e.subscribe(function(e){var g,h=!1;try{g=a(e)}catch(i){return c.onError(i),void 0}if(f)try{h=b(d,g)}catch(i){return c.onError(i),void 0}f&&h||(f=!0,d=g,c.onNext(e))},c.onError.bind(c),c.onCompleted.bind(c))})},Db["do"]=Db.doAction=function(a,b,c){var d,e=this;return"function"==typeof a?d=a:(d=a.onNext.bind(a),b=a.onError.bind(a),c=a.onCompleted.bind(a)),new Vb(function(a){return e.subscribe(function(b){try{d(b)}catch(c){a.onError(c)}a.onNext(b)},function(c){if(b){try{b(c)}catch(d){a.onError(d)}a.onError(c)}else a.onError(c)},function(){if(c){try{c()}catch(b){a.onError(b)}a.onCompleted()}else a.onCompleted()})})},Db["finally"]=Db.finallyAction=function(a){var b=this;return new Vb(function(c){var d=b.subscribe(c);return cb(function(){try{d.dispose()}catch(b){throw b}finally{a()}})})},Db.ignoreElements=function(){var a=this;return new Vb(function(c){return a.subscribe(b,c.onError.bind(c),c.onCompleted.bind(c))})},Db.materialize=function(){var a=this;return new Vb(function(b){return a.subscribe(function(a){b.onNext(tb(a))},function(a){b.onNext(ub(a)),b.onCompleted()},function(){b.onNext(vb()),b.onCompleted()})})},Db.repeat=function(a){return zb(this,a).concat()},Db.retry=function(a){return zb(this,a).catchException()},Db.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 Vb(function(e){var f,g,h;return d.subscribe(function(d){try{h||(h=!0),f?g=b(g,d):(g=c?b(a,d):d,f=!0)}catch(i){return e.onError(i),void 0}e.onNext(g)},e.onError.bind(e),function(){!h&&c&&e.onNext(a),e.onCompleted()})})},Db.skipLast=function(a){var b=this;return new Vb(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))})},Db.startWith=function(){var a,b,c=0;return arguments.length&&"now"in Object(arguments[0])?(b=arguments[0],c=1):b=kb,a=V.call(arguments,c),Ab([Kb(a,b),this]).concat()},Db.takeLast=function(a,b){return this.takeLastBuffer(a).selectMany(function(a){return Kb(a,b)})},Db.takeLastBuffer=function(a){var b=this;return new Vb(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()})})},Db.select=Db.map=function(a,b){var c=this;return new Vb(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return d.onError(h),void 0}d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},Db.selectMany=Db.flatMap=function(a,b){return b?this.selectMany(function(c){return a(c).select(function(a){return b(c,a)})}):"function"==typeof a?p.call(this,a):p.call(this,function(){return a})},Db.selectSwitch=Db.flatMapLatest=function(a,b){return this.select(a,b).switchLatest()},Db.skip=function(a){if(0>a)throw new Error(F);var b=this;return new Vb(function(c){var d=a;return b.subscribe(function(a){0>=d?c.onNext(a):d--},c.onError.bind(c),c.onCompleted.bind(c))})},Db.skipWhile=function(a,b){var c=this;return new Vb(function(d){var e=0,f=!1;return c.subscribe(function(g){if(!f)try{f=!a.call(b,g,e++,c)}catch(h){return d.onError(h),void 0}f&&d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},Db.take=function(a,b){if(0>a)throw new Error(F);if(0===a)return Jb(b);var c=this;return new Vb(function(b){var d=a;return c.subscribe(function(a){d>0&&(d--,b.onNext(a),0===d&&b.onCompleted())},b.onError.bind(b),b.onCompleted.bind(b))})},Db.takeWhile=function(a,b){var c=this;return new Vb(function(d){var e=0,f=!0;return c.subscribe(function(g){if(f){try{f=a.call(b,g,e++,c)}catch(h){return d.onError(h),void 0}f?d.onNext(g):d.onCompleted()}},d.onError.bind(d),d.onCompleted.bind(d))})},Db.where=Db.filter=function(a,b){var c=this;return new Vb(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return d.onError(h),void 0}g&&d.onNext(f)},d.onError.bind(d),d.onCompleted.bind(d))})},Gb.fromCallback=function(a,b,c,d){return b||(b=rb),function(){var e=V.call(arguments,0),f=new Zb;return b.schedule(function(){function b(a){var b=a;if(d)try{b=d(arguments)}catch(c){return f.onError(c),void 0}else 1===b.length&&(b=b[0]);f.onNext(b),f.onCompleted()}e.push(b),a.apply(c,e)}),f.asObservable()}},Gb.fromNodeCallback=function(a,b,c,d){return b||(b=rb),function(){var e=V.call(arguments,0),f=new Zb;return b.schedule(function(){function b(a){if(a)return f.onError(a),void 0;var b=V.call(arguments,1);if(d)try{b=d(b)}catch(c){return f.onError(c),void 0}else 1===b.length&&(b=b[0]);f.onNext(b),f.onCompleted()}e.push(b),a.apply(c,e)}),f.asObservable()}},Gb.fromEvent=function(a,b,c){return new Vb(function(d){return r(a,b,function(a){var b=a;if(c)try{b=c(arguments)}catch(e){return d.onError(e),void 0}d.onNext(b)})}).publish().refCount()},Gb.fromEventPattern=function(a,b,c){return new Vb(function(d){function e(a){var b=a;if(c)try{b=c(arguments)}catch(e){return d.onError(e),void 0}d.onNext(b)}var f=a(e);return cb(function(){b&&b(e,f)})}).publish().refCount()},Gb.fromPromise=function(a){var b=new Zb;return a.then(function(a){b.onNext(a),b.onCompleted()},function(a){b.onError(a)}),b.asObservable()},Db.multicast=function(a,b){var c=this;return"function"==typeof a?new Vb(function(d){var e=c.multicast(a());return new _(b(e).subscribe(d),e.connect())}):new Sb(c,a)},Db.publish=function(a){return a?this.multicast(function(){return new Yb},a):this.multicast(new Yb)},Db.publishLast=function(a){return a?this.multicast(function(){return new Zb},a):this.multicast(new Zb)},Db.publishValue=function(a,b){return 2===arguments.length?this.multicast(function(){return new _b(b)},a):this.multicast(new _b(a))},Db.replay=function(a,b,c,d){return a?this.multicast(function(){return new ac(b,c,d)},a):this.multicast(new ac(b,c,d))};var Sb=function(a){function b(b,c){function d(a){return e.subject.subscribe(a)}var e={subject:c,source:b.asObservable(),hasSubscription:!1,subscription:null};this.connect=function(){return e.hasSubscription||(e.hasSubscription=!0,e.subscription=new _(e.source.subscribe(e.subject),cb(function(){e.hasSubscription=!1}))),e.subscription},a.call(this,d)}return W(b,a),b.prototype.connect=function(){return this.connect()},b.prototype.refCount=function(){var a=null,b=0,c=this;return new Vb(function(d){var e,f;return b++,e=1===b,f=c.subscribe(d),e&&(a=c.connect()),cb(function(){f.dispose(),b--,0===b&&a.dispose()})})},b}(Gb),Tb=Gb.interval=function(a,b){return b||(b=rb),t(a,a,b)},Ub=Gb.timer=function(b,c,d){var e;return d||(d=rb),"number"==typeof c?e=c:"object"==typeof c&&"now"in c&&(d=c),e===a?s(b,d):t(b,e,d)};Db.delay=function(a,b){b||(b=rb);var c=this;return new Vb(function(d){var e,f=!1,g=new gb,h=null,i=[],j=!1; | ||
return e=c.materialize().timestamp(b).subscribe(function(c){var e,k;"E"===c.value.kind?(i=[],i.push(c),h=c.value.exception,k=!j):(i.push({value:c.value,timestamp:c.timestamp+a}),k=!f,f=!0),k&&(null!==h?d.onError(h):(e=new fb,g.setDisposable(e),e.setDisposable(b.scheduleRecursiveWithRelative(a,function(a){var c,e,g,k;if(null===h){j=!0;do g=null,i.length>0&&i[0].timestamp-b.now()<=0&&(g=i.shift().value),null!==g&&g.accept(d);while(null!==g);k=!1,e=0,i.length>0?(k=!0,e=Math.max(0,i[0].timestamp-b.now())):f=!1,c=h,j=!1,null!==c?d.onError(c):k&&a(e)}}))))}),new _(e,g)})},Db.throttle=function(a,b){return b||(b=rb),this.throttleWithSelector(function(){return Ub(a,b)})},Db.timeInterval=function(a){var b=this;return a||(a=rb),Ib(function(){var c=a.now();return b.select(function(b){var d=a.now(),e=d-c;return c=d,{value:b,interval:e}})})},Db.timestamp=function(a){return a||(a=rb),this.select(function(b){return{value:b,timestamp:a.now()}})},Db.sample=function(a,b){return b||(b=rb),"number"==typeof a?u(this,Tb(a,b)):u(this,a)},Db.timeout=function(a,b,c){var d,e=this;return b||(b=Nb(new Error("Timeout"))),c||(c=rb),d=a instanceof Date?function(a,b){c.scheduleWithAbsolute(a,b)}:function(a,b){c.scheduleWithRelative(a,b)},new Vb(function(c){var f,g=0,h=new fb,i=new gb,j=!1,k=new gb;return i.setDisposable(h),f=function(){var e=g;k.setDisposable(d(a,function(){j=g===e;var a=j;a&&i.setDisposable(b.subscribe(c))}))},f(),h.setDisposable(e.subscribe(function(a){var b=!j;b&&(g++,c.onNext(a),f())},function(a){var b=!j;b&&(g++,c.onError(a))},function(){var a=!j;a&&(g++,c.onCompleted())})),new _(i,k)})},Gb.generateWithTime=function(a,b,c,d,e,f){return f||(f=rb),new Vb(function(g){var h,i,j=!0,k=!1,l=a;return f.scheduleRecursiveWithRelative(0,function(a){k&&g.onNext(h);try{j?j=!1:l=c(l),k=b(l),k&&(h=d(l),i=e(l))}catch(f){return g.onError(f),void 0}k?a(i):g.onCompleted()})})},Db.delaySubscription=function(a,b){return b||(b=rb),this.delayWithSelector(Ub(a,b),function(){return Jb()})},Db.delayWithSelector=function(a,b){var c,d,e=this;return"function"==typeof a?d=a:(c=a,d=b),new Vb(function(a){var b=new _,f=!1,g=function(){f&&0===b.length&&a.onCompleted()},h=new gb,i=function(){h.setDisposable(e.subscribe(function(c){var e;try{e=d(c)}catch(f){return a.onError(f),void 0}var h=new fb;b.add(h),h.setDisposable(e.subscribe(function(){a.onNext(c),b.remove(h),g()},a.onError.bind(a),function(){a.onNext(c),b.remove(h),g()}))},a.onError.bind(a),function(){f=!0,h.dispose(),g()}))};return c?h.setDisposable(c.subscribe(function(){i()},a.onError.bind(a),function(){i()})):i(),new _(h,b)})},Db.timeoutWithSelector=function(a,b,c){if(1===arguments.length){b=a;var a=Lb()}c||(c=Nb(new Error("Timeout")));var d=this;return new Vb(function(e){var f=new gb,g=new gb,h=new fb;f.setDisposable(h);var i=0,j=!1,k=function(a){var b=i,d=function(){return i===b},h=new fb;g.setDisposable(h),h.setDisposable(a.subscribe(function(){d()&&f.setDisposable(c.subscribe(e)),h.dispose()},function(a){d()&&e.onError(a)},function(){d()&&f.setDisposable(c.subscribe(e))}))};k(a);var l=function(){var a=!j;return a&&i++,a};return h.setDisposable(d.subscribe(function(a){if(l()){e.onNext(a);var c;try{c=b(a)}catch(d){return e.onError(d),void 0}k(c)}},function(a){l()&&e.onError(a)},function(){l()&&e.onCompleted()})),new _(f,g)})},Db.throttleWithSelector=function(a){var b=this;return new Vb(function(c){var d,e=!1,f=new gb,g=0,h=b.subscribe(function(b){var h;try{h=a(b)}catch(i){return c.onError(i),void 0}e=!0,d=b,g++;var j=g,k=new fb;f.setDisposable(k),k.setDisposable(h.subscribe(function(){e&&g===j&&c.onNext(d),e=!1,k.dispose()},c.onError.bind(c),function(){e&&g===j&&c.onNext(d),e=!1,k.dispose()}))},function(a){f.dispose(),c.onError(a),e=!1,g++},function(){f.dispose(),e&&c.onNext(d),c.onCompleted(),e=!1,g++});return new _(h,f)})},Db.skipLastWithTime=function(a,b){b||(b=rb);var c=this;return new Vb(function(d){var e=[];return c.subscribe(function(c){var f=b.now();for(e.push({interval:f,value:c});e.length>0&&f-e[0].interval>=a;)d.onNext(e.shift().value)},d.onError.bind(d),function(){for(var c=b.now();e.length>0&&c-e[0].interval>=a;)d.onNext(e.shift().value);d.onCompleted()})})},Db.takeLastWithTime=function(a,b,c){return this.takeLastBufferWithTime(a,b).selectMany(function(a){return Kb(a,c)})},Db.takeLastBufferWithTime=function(a,b){var c=this;return b||(b=rb),new Vb(function(d){var e=[];return c.subscribe(function(c){var d=b.now();for(e.push({interval:d,value:c});e.length>0&&d-e[0].interval>=a;)e.shift()},d.onError.bind(d),function(){for(var c=b.now(),f=[];e.length>0;){var g=e.shift();c-g.interval<=a&&f.push(g.value)}d.onNext(f),d.onCompleted()})})},Db.takeWithTime=function(a,b){var c=this;return b||(b=rb),new Vb(function(d){var e=b.scheduleWithRelative(a,function(){d.onCompleted()});return new _(e,c.subscribe(d))})},Db.skipWithTime=function(a,b){var c=this;return b||(b=rb),new Vb(function(d){var e=!1,f=b.scheduleWithRelative(a,function(){e=!0}),g=c.subscribe(function(a){e&&d.onNext(a)},d.onError.bind(d),d.onCompleted.bind(d));return new _(f,g)})},Db.skipUntilWithTime=function(a,b){b||(b=rb);var c=this;return new Vb(function(d){var e=!1,f=b.scheduleWithAbsolute(a,function(){e=!0}),g=c.subscribe(function(a){e&&d.onNext(a)},d.onError.bind(d),d.onCompleted.bind(d));return new _(f,g)})},Db.takeUntilWithTime=function(a,b){b||(b=rb);var c=this;return new Vb(function(d){return new _(b.scheduleWithAbsolute(a,function(){d.onCompleted()}),c.subscribe(d))})};var Vb=C.Internals.AnonymousObservable=function(a){function b(a){return"undefined"==typeof a?a=db:"function"==typeof a&&(a=cb(a)),a}function c(d){function e(a){var c=new Wb(a);if(lb.scheduleRequired())lb.schedule(function(){try{c.setDisposable(b(d(c)))}catch(a){if(!c.fail(a))throw a}});else try{c.setDisposable(b(d(c)))}catch(e){if(!c.fail(e))throw e}return c}return this instanceof c?(a.call(this,e),void 0):new c(d)}return W(c,a),c}(Gb),Wb=function(a){function b(b){a.call(this),this.observer=b,this.m=new fb}W(b,a);var c=b.prototype;return c.next=function(a){var b=!1;try{this.observer.onNext(a),b=!0}catch(c){throw c}finally{b||this.dispose()}},c.error=function(a){try{this.observer.onError(a)}catch(b){throw b}finally{this.dispose()}},c.completed=function(){try{this.observer.onCompleted()}catch(a){throw a}finally{this.dispose()}},c.setDisposable=function(a){this.m.setDisposable(a)},c.getDisposable=function(){return this.m.getDisposable()},c.disposable=function(a){return arguments.length?this.getDisposable():setDisposable(a)},c.dispose=function(){a.prototype.dispose.call(this),this.m.dispose()},b}(Eb),Xb=function(a,b){this.subject=a,this.observer=b};Xb.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 Yb=C.Subject=function(a){function b(a){return g.call(this),this.isStopped?this.exception?(a.onError(this.exception),db):(a.onCompleted(),db):(this.observers.push(a),new Xb(this,a))}function c(){a.call(this,b),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return W(c,a),X(c.prototype,Bb,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(g.call(this),!this.isStopped){var a=this.observers.slice(0);this.isStopped=!0;for(var b=0,c=a.length;c>b;b++)a[b].onCompleted();this.observers=[]}},onError:function(a){if(g.call(this),!this.isStopped){var b=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var c=0,d=b.length;d>c;c++)b[c].onError(a);this.observers=[]}},onNext:function(a){if(g.call(this),!this.isStopped)for(var b=this.observers.slice(0),c=0,d=b.length;d>c;c++)b[c].onNext(a)},dispose:function(){this.isDisposed=!0,this.observers=null}}),c.create=function(a,b){return new $b(a,b)},c}(Gb),Zb=C.AsyncSubject=function(a){function b(a){if(g.call(this),!this.isStopped)return this.observers.push(a),new Xb(this,a);var b=this.exception,c=this.hasValue,d=this.value;return b?a.onError(b):c?(a.onNext(d),a.onCompleted()):a.onCompleted(),db}function c(){a.call(this,b),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return W(c,a),X(c.prototype,Bb,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){var a,b,c;if(g.call(this),!this.isStopped){var d=this.observers.slice(0);this.isStopped=!0;var e=this.value,f=this.hasValue;if(f)for(b=0,c=d.length;c>b;b++)a=d[b],a.onNext(e),a.onCompleted();else for(b=0,c=d.length;c>b;b++)d[b].onCompleted();this.observers=[]}},onError:function(a){if(g.call(this),!this.isStopped){var b=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var c=0,d=b.length;d>c;c++)b[c].onError(a);this.observers=[]}},onNext:function(a){g.call(this),this.isStopped||(this.value=a,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),c}(Gb),$b=function(a){function b(a){return this.observable.subscribe(a)}function c(c,d){a.call(this,b),this.observer=c,this.observable=d}return W(c,a),X(c.prototype,Bb,{onCompleted:function(){this.observer.onCompleted()},onError:function(a){this.observer.onError(a)},onNext:function(a){this.observer.onNext(a)}}),c}(Gb),_b=C.BehaviorSubject=function(a){function b(a){if(g.call(this),!this.isStopped)return this.observers.push(a),a.onNext(this.value),new Xb(this,a);var b=this.exception;return b?a.onError(b):a.onCompleted(),db}function c(c){a.call(this,b),this.value=c,this.observers=[],this.isDisposed=!1,this.isStopped=!1,this.exception=null}return W(c,a),X(c.prototype,Bb,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(g.call(this),!this.isStopped){var a=this.observers.slice(0);this.isStopped=!0;for(var b=0,c=a.length;c>b;b++)a[b].onCompleted();this.observers=[]}},onError:function(a){if(g.call(this),!this.isStopped){var b=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var c=0,d=b.length;d>c;c++)b[c].onError(a);this.observers=[]}},onNext:function(a){if(g.call(this),!this.isStopped){this.value=a;for(var b=this.observers.slice(0),c=0,d=b.length;d>c;c++)b[c].onNext(a)}},dispose:function(){this.isDisposed=!0,this.observers=null,this.value=null,this.exception=null}}),c}(Gb),ac=C.ReplaySubject=function(a){function b(a,b){this.subject=a,this.observer=b}function c(a){var c=new Hb(this.scheduler,a),d=new b(this,c);g.call(this),this._trim(this.scheduler.now()),this.observers.push(c);for(var e=this.q.length,f=0,h=this.q.length;h>f;f++)c.onNext(this.q[f].value);return this.hasError?(e++,c.onError(this.error)):this.isStopped&&(e++,c.onCompleted()),c.ensureActive(e),d}function d(b,d,e){this.bufferSize=null==b?Number.MAX_VALUE:b,this.windowSize=null==d?Number.MAX_VALUE:d,this.scheduler=e||lb,this.q=[],this.observers=[],this.isStopped=!1,this.isDisposed=!1,this.hasError=!1,this.error=null,a.call(this,c)}return b.prototype.dispose=function(){if(this.observer.dispose(),!this.subject.isDisposed){var a=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(a,1)}},W(d,a),X(d.prototype,Bb,{hasObservers:function(){return this.observers.length>0},_trim:function(a){for(;this.q.length>this.bufferSize;)this.q.shift();for(;this.q.length>0&&a-this.q[0].interval>this.windowSize;)this.q.shift()},onNext:function(a){var b;if(g.call(this),!this.isStopped){var c=this.scheduler.now();this.q.push({interval:c,value:a}),this._trim(c);for(var d=this.observers.slice(0),e=0,f=d.length;f>e;e++)b=d[e],b.onNext(a),b.ensureActive()}},onError:function(a){var b;if(g.call(this),!this.isStopped){this.isStopped=!0,this.error=a,this.hasError=!0;var c=this.scheduler.now();this._trim(c);for(var d=this.observers.slice(0),e=0,f=d.length;f>e;e++)b=d[e],b.onError(a),b.ensureActive();this.observers=[]}},onCompleted:function(){var a;if(g.call(this),!this.isStopped){this.isStopped=!0;var b=this.scheduler.now();this._trim(b);for(var c=this.observers.slice(0),d=0,e=c.length;e>d;d++)a=c[d],a.onCompleted(),a.ensureActive();this.observers=[]}},dispose:function(){this.isDisposed=!0,this.observers=null}}),d}(Gb);"function"==typeof define&&"object"==typeof define.amd&&define.amd?(w.Rx=C,define(function(){return C})):x&&y?z?(y.exports=C).Rx=C:x.Rx=C:w.Rx=C}).call(this); |
@@ -1,2 +0,2 @@ | ||
(function(t,e){function n(){}function r(t){return t}function i(t,e){return V(t,e)}function o(t,e){return t-e}function s(t){return""+t}function u(t){throw t}function c(){if(this.isDisposed)throw Error(_)}function a(t){return"function"!=typeof t.toString&&"string"==typeof(t+"")}function h(t){return t&&"object"==typeof t?T.call(t)==N:!1}function l(t){return"function"==typeof t}function f(t,e,n,r){var i;if(t===e)return 0!==t||1/t==1/e;var o=typeof t,s=typeof e;if(!(t!==t||t&&S[o]||e&&S[s]))return!1;if(null==t||null==e)return t===e;var u=T.call(t),c=T.call(e);if(u==N&&(u=I),c==N&&(c=I),u!=c)return!1;switch(u){case R:case W:return+t==+e;case k:return t!=+t?e!=+e:0==t?1/t==1/e:t==+e;case q:case P:return t==e+""}var p=u==O;if(!p){if(u!=I||!E&&(a(t)||a(e)))return!1;var d=!L&&h(t)?Object:t.constructor,b=!L&&h(e)?Object:e.constructor;if(d!=b&&!(l(d)&&d instanceof d&&l(b)&&b instanceof b))return!1}for(var v=n.length;v--;)if(n[v]==t)return r[v]==e;var m=0;if(i=!0,n.push(t),r.push(e),p){for(v=t.length,m=e.length,i=m==t.length;m--;){var y=e[m];if(!(i=f(t[m],y,n,r)))break}return i}for(var w in e)if(M.call(e,w))return m++,i=M.call(t,w)&&f(t[w],e[w],n,r);if(i)for(var w in t)if(M.call(t,w))return i=--m>-1;return n.pop(),r.pop(),i}function p(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:F.call(t)}function d(t,e){for(var n=Array(t),r=0;t>r;r++)n[r]=e();return n}function b(t,e){this.scheduler=t,this.disposable=e,this.isDisposed=!1}function v(t,n){return new Ve(function(r){var i=new te,o=new ne;return o.setDisposable(i),i.setDisposable(t.subscribe(r.onNext.bind(r),function(t){var i,s;try{s=n(t)}catch(u){return r.onError(u),e}i=new te,o.setDisposable(i),i.setDisposable(s.subscribe(r))},r.onCompleted.bind(r))),o})}function m(t,n){var r=this;return new Ve(function(i){var o=0,s=t.length;return r.subscribe(function(r){if(s>o){var u,c=t[o++];try{u=n(r,c)}catch(a){return i.onError(a),e}i.onNext(u)}else i.onCompleted()},i.onError.bind(i),i.onCompleted.bind(i))})}function y(t){return this.select(t).mergeObservable()}var w="object"==typeof exports&&exports,g=("object"==typeof module&&module&&module.exports==w&&module,"object"==typeof global&&global);g.global===g&&(t=g);var E,D={Internals:{}},x=Date.now,C="Sequence contains no elements.",A="Argument out of range",_="Object has been disposed",S={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},N="[object Arguments]",O="[object Array]",R="[object Boolean]",W="[object Date]",j="[object Function]",k="[object Number]",I="[object Object]",q="[object RegExp]",P="[object String]",T=Object.prototype.toString,M=Object.prototype.hasOwnProperty,L=T.call(arguments)==N;try{E=!(T.call(document)==I&&!({toString:0}+""))}catch(z){E=!0}L||(h=function(t){return t&&"object"==typeof t?M.call(t,"callee"):!1}),l(/x/)&&(l=function(t){return"function"==typeof t&&T.call(t)==j});var V=D.Internals.isEqual=function(t,e){return f(t,e,[],[])},F=Array.prototype.slice;({}).hasOwnProperty;var B=this.inherits=D.Internals.inherits=function(t,e){function n(){this.constructor=t}n.prototype=e.prototype,t.prototype=new n},U=D.Internals.addProperties=function(t){for(var e=F.call(arguments,1),n=0,r=e.length;r>n;n++){var i=e[n];for(var o in i)t[o]=i[o]}},H=D.Internals.addRef=function(t,e){return new Ve(function(n){return new K(e.getDisposable(),t.subscribe(n))})},Q=function(t,e){this.id=t,this.value=e};Q.prototype.compareTo=function(t){var e=this.value.compareTo(t.value);return 0===e&&(e=this.id-t.id),e};var G=D.Internals.PriorityQueue=function(t){this.items=Array(t),this.length=0},J=G.prototype;J.isHigherPriority=function(t,e){return 0>this.items[t].compareTo(this.items[e])},J.percolate=function(t){if(!(t>=this.length||0>t)){var e=t-1>>1;if(!(0>e||e===t)&&this.isHigherPriority(t,e)){var n=this.items[t];this.items[t]=this.items[e],this.items[e]=n,this.percolate(e)}}},J.heapify=function(t){if(t===e&&(t=0),!(t>=this.length||0>t)){var n=2*t+1,r=2*t+2,i=t;if(this.length>n&&this.isHigherPriority(n,i)&&(i=n),this.length>r&&this.isHigherPriority(r,i)&&(i=r),i!==t){var o=this.items[t];this.items[t]=this.items[i],this.items[i]=o,this.heapify(i)}}},J.peek=function(){return this.items[0].value},J.removeAt=function(t){this.items[t]=this.items[--this.length],delete this.items[this.length],this.heapify()},J.dequeue=function(){var t=this.peek();return this.removeAt(0),t},J.enqueue=function(t){var e=this.length++;this.items[e]=new Q(G.count++,t),this.percolate(e)},J.remove=function(t){for(var e=0;this.length>e;e++)if(this.items[e].value===t)return this.removeAt(e),!0;return!1},G.count=0;var K=D.CompositeDisposable=function(){this.disposables=p(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},X=K.prototype;X.add=function(t){this.isDisposed?t.dispose():(this.disposables.push(t),this.length++)},X.remove=function(t){var e=!1;if(!this.isDisposed){var n=this.disposables.indexOf(t);-1!==n&&(e=!0,this.disposables.splice(n,1),this.length--,t.dispose())}return e},X.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()}},X.clear=function(){var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()},X.contains=function(t){return-1!==this.disposables.indexOf(t)},X.toArray=function(){return this.disposables.slice(0)};var Y=D.Disposable=function(t){this.isDisposed=!1,this.action=t||n};Y.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var Z=Y.create=function(t){return new Y(t)},$=Y.empty={dispose:n},te=D.SingleAssignmentDisposable=function(){this.isDisposed=!1,this.current=null},ee=te.prototype;ee.getDisposable=function(){return this.current},te.disposable=function(t){return arguments.length?this.getDisposable():this.setDisposable(t)},ee.setDisposable=function(t){if(this.current)throw Error("Disposable has already been assigned");var e=this.isDisposed;e||(this.current=t),e&&t&&t.dispose()},ee.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()};var ne=D.SerialDisposable=function(){this.isDisposed=!1,this.current=null},re=ne.prototype;re.getDisposable=function(){return this.current},re.setDisposable=function(t){var e,n=this.isDisposed;n||(e=this.current,this.current=t),e&&e.dispose(),n&&t&&t.dispose()},re.disposable=function(t){return t?(this.setDisposable(t),e):this.getDisposable()},re.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()};var ie=D.RefCountDisposable=function(){function t(t){this.disposable=t,this.disposable.count++,this.isInnerDisposed=!1}function e(t){this.underlyingDisposable=t,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return t.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},e.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},e.prototype.getDisposable=function(){return this.isDisposed?$:new t(this)},e}();b.prototype.dispose=function(){var t=this;this.scheduler.schedule(function(){t.isDisposed||(t.isDisposed=!0,t.disposable.dispose())})};var oe=D.Internals.ScheduledItem=function(t,e,n,r,i){this.scheduler=t,this.state=e,this.action=n,this.dueTime=r,this.comparer=i||o,this.disposable=new te};oe.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},oe.prototype.compareTo=function(t){return this.comparer(this.dueTime,t.dueTime)},oe.prototype.isCancelled=function(){return this.disposable.isDisposed},oe.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var se=D.Scheduler=function(){function e(t,e,n,r){this.now=t,this._schedule=e,this._scheduleRelative=n,this._scheduleAbsolute=r}function n(t,e){var n=e.first,r=e.second,i=new K,o=function(e){r(e,function(e){var n=!1,r=!1,s=t.scheduleWithState(e,function(t,e){return n?i.remove(s):r=!0,o(e),$});r||(i.add(s),n=!0)})};return o(n),i}function r(t,e,n){var r=e.first,i=e.second,o=new K,s=function(e){i(e,function(e,r){var i=!1,u=!1,c=t[n].call(t,e,r,function(t,e){return i?o.remove(c):u=!0,s(e),$});u||(o.add(c),i=!0)})};return s(r),o}function i(t,e){return e(),$}var o=e.prototype;return o.catchException=o["catch"]=function(t){return new fe(this,t)},o.schedulePeriodic=function(t,e){return this.schedulePeriodicWithState(null,t,function(){e()})},o.schedulePeriodicWithState=function(e,n,r){var i=e,o=t.setInterval(function(){i=r(i)},n);return Z(function(){t.clearInterval(o)})},o.schedule=function(t){return this._schedule(t,i)},o.scheduleWithState=function(t,e){return this._schedule(t,e)},o.scheduleWithRelative=function(t,e){return this._scheduleRelative(e,t,i)},o.scheduleWithRelativeAndState=function(t,e,n){return this._scheduleRelative(t,e,n)},o.scheduleWithAbsolute=function(t,e){return this._scheduleAbsolute(e,t,i)},o.scheduleWithAbsoluteAndState=function(t,e,n){return this._scheduleAbsolute(t,e,n)},o.scheduleRecursive=function(t){return this.scheduleRecursiveWithState(t,function(t,e){t(function(){e(t)})})},o.scheduleRecursiveWithState=function(t,e){return this.scheduleWithState({first:t,second:e},function(t,e){return n(t,e)})},o.scheduleRecursiveWithRelative=function(t,e){return this.scheduleRecursiveWithRelativeAndState(e,t,function(t,e){t(function(n){e(t,n)})})},o.scheduleRecursiveWithRelativeAndState=function(t,e,n){return this._scheduleRelative({first:t,second:n},e,function(t,e){return r(t,e,"scheduleWithRelativeAndState")})},o.scheduleRecursiveWithAbsolute=function(t,e){return this.scheduleRecursiveWithAbsoluteAndState(e,t,function(t,e){t(function(n){e(t,n)})})},o.scheduleRecursiveWithAbsoluteAndState=function(t,e,n){return this._scheduleAbsolute({first:t,second:n},e,function(t,e){return r(t,e,"scheduleWithAbsoluteAndState")})},e.now=x,e.normalize=function(t){return 0>t&&(t=0),t},e}();D.Internals.SchedulePeriodicRecursive=function(){function t(t,e){e(0,this._period);try{this._state=this._action(this._state)}catch(n){throw this._cancel.dispose(),n}}function e(t,e,n,r){this._scheduler=t,this._state=e,this._period=n,this._action=r}return e.prototype.start=function(){var e=new te;return this._cancel=e,e.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,t.bind(this))),e},e}();var ue,ce="Scheduler is not allowed to block the thread",ae=se.immediate=function(){function t(t,e){return e(this,t)}function e(t,e,n){if(e>0)throw Error(ce);return n(this,t)}function n(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new se(x,t,e,n)}(),he=se.currentThread=function(){function t(){i=new G(4)}function e(t,e){return this.scheduleWithRelativeAndState(t,0,e)}function n(e,n,r){var o,s=this.now()+se.normalize(n),u=new oe(this,e,r,s);if(i)i.enqueue(u);else{o=new t;try{i.enqueue(u),o.run()}catch(c){throw c}finally{o.dispose()}}return u.disposable}function r(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}var i;t.prototype.dispose=function(){i=null},t.prototype.run=function(){for(var t;i.length>0;)if(t=i.dequeue(),!t.isCancelled()){for(;t.dueTime-se.now()>0;);t.isCancelled()||t.invoke()}};var o=new se(x,e,n,r);return o.scheduleRequired=function(){return null===i},o.ensureTrampoline=function(t){return null===i?this.schedule(t):t()},o}(),le=n;(function(){function e(){if(!t.postMessage||t.importScripts)return!1;var e=!1,n=t.onmessage;return t.onmessage=function(){e=!0},t.postMessage("","*"),t.onmessage=n,e}function n(t){if("string"==typeof t.data&&t.data.substring(0,r.length)===r){var e=t.data.substring(r.length),n=i[e];n(),delete i[e]}}if("function"==typeof t.setImmediate)ue=t.setImmediate,le=clearImmediate;else if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))ue=process.nextTick;else if(e()){var r="ms.rx.schedule"+Math.random(),i={},o=0;t.addEventListener?t.addEventListener("message",n,!1):t.attachEvent("onmessage",n,!1),ue=function(e){var n=o++;i[n]=e,t.postMessage(r+n,"*")}}else if(t.MessageChannel){var s=new t.MessageChannel,u={},c=0;s.port1.onmessage=function(t){var e=t.data,n=u[e];n(),delete u[e]},ue=function(t){var e=c++;u[e]=t,s.port2.postMessage(e)}}else"document"in t&&"onreadystatechange"in t.document.createElement("script")?ue=function(e){var n=t.document.createElement("script");n.onreadystatechange=function(){e(),n.onreadystatechange=null,n.parentNode.removeChild(n),n=null},t.document.documentElement.appendChild(n)}:(ue=function(e){return t.setTimeout(e,0)},le=t.clearTimeout)})(),se.timeout=function(){function e(t,e){var n=this,r=new te,i=ue(function(){r.isDisposed||r.setDisposable(e(n,t))});return new K(r,Z(function(){le(i)}))}function n(e,n,r){var i=this,o=se.normalize(n);if(0===o)return i.scheduleWithState(e,r);var s=new te,u=t.setTimeout(function(){s.isDisposed||s.setDisposable(r(i,e))},o);return new K(s,Z(function(){t.clearTimeout(u)}))}function r(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new se(x,e,n,r)}();var fe=function(t){function e(){return this._scheduler.now()}function n(t,e){return this._scheduler.scheduleWithState(t,this._wrap(e))}function r(t,e,n){return this._scheduler.scheduleWithRelativeAndState(t,e,this._wrap(n))}function i(t,e,n){return this._scheduler.scheduleWithAbsoluteAndState(t,e,this._wrap(n))}function o(o,s){this._scheduler=o,this._handler=s,this._recursiveOriginal=null,this._recursiveWrapper=null,t.call(this,e,n,r,i)}return B(o,t),o.prototype._clone=function(t){return new o(t,this._handler)},o.prototype._wrap=function(t){var e=this;return function(n,r){try{return t(e._getRecursiveWrapper(n),r)}catch(i){if(!e._handler(i))throw i;return $}}},o.prototype._getRecursiveWrapper=function(t){if(this._recursiveOriginal!==t){this._recursiveOriginal=t;var e=this._clone(t);e._recursiveOriginal=t,e._recursiveWrapper=e,this._recursiveWrapper=e}return this._recursiveWrapper},o.prototype.schedulePeriodicWithState=function(t,e,n){var r=this,i=!1,o=new te;return o.setDisposable(this._scheduler.schedulePeriodicWithState(t,e,function(t){if(i)return null;try{return n(t)}catch(e){if(i=!0,!r._handler(e))throw e;return o.dispose(),null}})),o},o}(se),pe=D.Notification=function(){function t(t,e){this.hasValue=null==e?!1:e,this.kind=t}var e=t.prototype;return e.accept=function(t,e,n){return 1===arguments.length&&"object"==typeof t?this._acceptObservable(t):this._accept(t,e,n)},e.toObservable=function(t){var e=this;return t||(t=ae),new Ve(function(n){return t.schedule(function(){e._acceptObservable(n),"N"===e.kind&&n.onCompleted()})})},t}(),de=pe.createOnNext=function(){function t(t){return t(this.value)}function e(t){return t.onNext(this.value)}function n(){return"OnNext("+this.value+")"}return function(r){var i=new pe("N",!0);return i.value=r,i._accept=t,i._acceptObservable=e,i.toString=n,i}}(),be=pe.createOnError=function(){function t(t,e){return e(this.exception)}function e(t){return t.onError(this.exception)}function n(){return"OnError("+this.exception+")"}return function(r){var i=new pe("E");return i.exception=r,i._accept=t,i._acceptObservable=e,i.toString=n,i}}(),ve=pe.createOnCompleted=function(){function t(t,e,n){return n()}function e(t){return t.onCompleted()}function n(){return"OnCompleted()"}return function(){var r=new pe("C");return r._accept=t,r._acceptObservable=e,r.toString=n,r}}(),me=D.Internals.Enumerator=function(t,e,n){this.moveNext=t,this.getCurrent=e,this.dispose=n},ye=me.create=function(t,e,r){var i=!1;return r||(r=n),new me(function(){if(i)return!1;var e=t();return e||(i=!0,r()),e},function(){return e()},function(){i||(r(),i=!0)})},we=D.Internals.Enumerable=function(){function t(t){this.getEnumerator=t}return t.prototype.concat=function(){var t=this;return new Ve(function(n){var r=t.getEnumerator(),i=!1,o=new ne,s=ae.scheduleRecursive(function(t){var s,u,c=!1;if(!i){try{c=r.moveNext(),c?s=r.getCurrent():r.dispose()}catch(a){u=a,r.dispose()}if(u)return n.onError(u),e;if(!c)return n.onCompleted(),e;var h=new te;o.setDisposable(h),h.setDisposable(s.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){t()}))}});return new K(o,s,Z(function(){i=!0,r.dispose()}))})},t.prototype.catchException=function(){var t=this;return new Ve(function(n){var r,i=t.getEnumerator(),o=!1,s=new ne,u=ae.scheduleRecursive(function(t){var u,c,a;if(a=!1,!o){try{a=i.moveNext(),a&&(u=i.getCurrent())}catch(h){c=h}if(c)return n.onError(c),e;if(!a)return r?n.onError(r):n.onCompleted(),e;var l=new te;s.setDisposable(l),l.setDisposable(u.subscribe(n.onNext.bind(n),function(e){r=e,t()},n.onCompleted.bind(n)))}});return new K(s,u,Z(function(){o=!0}))})},t}(),ge=we.repeat=function(t,n){return n===e&&(n=-1),new we(function(){var e,r=n;return ye(function(){return 0===r?!1:(r>0&&r--,e=t,!0)},function(){return e})})},Ee=we.forEach=function(t,e){return e||(e=r),new we(function(){var n,r=-1;return ye(function(){return++r<t.length?(n=e(t[r],r),!0):!1},function(){return n})})},De=D.Observer=function(){};De.prototype.toNotifier=function(){var t=this;return function(e){return e.accept(t)}},De.prototype.asObserver=function(){return new _e(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},De.prototype.checked=function(){return new Se(this)};var xe=De.create=function(t,e,r){return t||(t=n),e||(e=u),r||(r=n),new _e(t,e,r)};De.fromNotifier=function(t){return new _e(function(e){return t(de(e))},function(e){return t(be(e))},function(){return t(ve())})},De.notifyOn=function(t){return new Oe(t,this)};var Ce,Ae=D.Internals.AbstractObserver=function(t){function e(){this.isStopped=!1,t.call(this)}return B(e,t),e.prototype.onNext=function(t){this.isStopped||this.next(t)},e.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.error(t))},e.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},e.prototype.dispose=function(){this.isStopped=!0},e.prototype.fail=function(t){return this.isStopped?!1:(this.isStopped=!0,this.error(t),!0)},e}(De),_e=D.AnonymousObserver=function(t){function e(e,n,r){t.call(this),this._onNext=e,this._onError=n,this._onCompleted=r}return B(e,t),e.prototype.next=function(t){this._onNext(t)},e.prototype.error=function(t){this._onError(t)},e.prototype.completed=function(){this._onCompleted()},e}(Ae),Se=function(t){function e(e){t.call(this),this._observer=e,this._state=0}B(e,t);var n=e.prototype;return n.onNext=function(t){this.checkAccess();try{this._observer.onNext(t)}catch(e){throw e}finally{this._state=0}},n.onError=function(t){this.checkAccess();try{this._observer.onError(t)}catch(e){throw e}finally{this._state=2}},n.onCompleted=function(){this.checkAccess();try{this._observer.onCompleted()}catch(t){throw t}finally{this._state=2}},n.checkAccess=function(){if(1===this._state)throw Error("Re-entrancy detected");if(2===this._state)throw Error("Observer completed");0===this._state&&(this._state=1)},e}(De),Ne=D.Internals.ScheduledObserver=function(t){function n(e,n){t.call(this),this.scheduler=e,this.observer=n,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new ne}return B(n,t),n.prototype.next=function(t){var e=this;this.queue.push(function(){e.observer.onNext(t)})},n.prototype.error=function(t){var e=this;this.queue.push(function(){e.observer.onError(t)})},n.prototype.completed=function(){var t=this;this.queue.push(function(){t.observer.onCompleted()})},n.prototype.ensureActive=function(){var t=!1,n=this;!this.hasFaulted&&this.queue.length>0&&(t=!this.isAcquired,this.isAcquired=!0),t&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(t){var r;if(!(n.queue.length>0))return n.isAcquired=!1,e;r=n.queue.shift();try{r()}catch(i){throw n.queue=[],n.hasFaulted=!0,i}t()}))},n.prototype.dispose=function(){t.prototype.dispose.call(this),this.disposable.dispose()},n}(Ae),Oe=function(t){function e(){t.apply(this,arguments)}return B(e,t),e.prototype.next=function(e){t.prototype.next.call(this,e),this.ensureActive()},e.prototype.error=function(e){t.prototype.error.call(this,e),this.ensureActive()},e.prototype.completed=function(){t.prototype.completed.call(this),this.ensureActive()},e}(Ne),Re=D.Observable=function(){function t(t){this._subscribe=t}return Ce=t.prototype,Ce.finalValue=function(){var t=this;return new Ve(function(e){var n,r=!1;return t.subscribe(function(t){r=!0,n=t},e.onError.bind(e),function(){r?(e.onNext(n),e.onCompleted()):e.onError(Error(C))})})},Ce.subscribe=Ce.forEach=function(t,e,n){var r;return r="object"==typeof t?t:xe(t,e,n),this._subscribe(r)},Ce.toArray=function(){function t(t,e){var n=t.slice(0);return n.push(e),n}return this.scan([],t).startWith([]).finalValue()},t}();Ce.observeOn=function(t){var e=this;return new Ve(function(n){return e.subscribe(new Oe(t,n))})},Ce.subscribeOn=function(t){var e=this;return new Ve(function(n){var r=new te,i=new ne;return i.setDisposable(r),r.setDisposable(t.schedule(function(){i.setDisposable(new b(t,e.subscribe(n)))})),i})},Re.create=Re.createWithDisposable=function(t){return new Ve(t)},Re.defer=function(t){return new Ve(function(e){var n;try{n=t()}catch(r){return qe(r).subscribe(e)}return n.subscribe(e)})};var We=Re.empty=function(t){return t||(t=ae),new Ve(function(e){return t.schedule(function(){e.onCompleted()})})},je=Re.fromArray=function(t,e){return e||(e=he),new Ve(function(n){var r=0;return e.scheduleRecursive(function(e){t.length>r?(n.onNext(t[r++]),e()):n.onCompleted()})})};Re.generate=function(t,n,r,i,o){return o||(o=he),new Ve(function(s){var u=!0,c=t;return o.scheduleRecursive(function(t){var o,a;try{u?u=!1:c=r(c),o=n(c),o&&(a=i(c))}catch(h){return s.onError(h),e}o?(s.onNext(a),t()):s.onCompleted()})})};var ke=Re.never=function(){return new Ve(function(){return $})};Re.range=function(t,e,n){return n||(n=he),new Ve(function(r){return n.scheduleRecursiveWithState(0,function(n,i){e>n?(r.onNext(t+n),i(n+1)):r.onCompleted()})})},Re.repeat=function(t,e,n){return n||(n=he),null==e&&(e=-1),Ie(t,n).repeat(e)};var Ie=Re["return"]=Re.returnValue=function(t,e){return e||(e=ae),new Ve(function(n){return e.schedule(function(){n.onNext(t),n.onCompleted()})})},qe=Re["throw"]=Re.throwException=function(t,e){return e||(e=ae),new Ve(function(n){return e.schedule(function(){n.onError(t)})})};Re.using=function(t,e){return new Ve(function(n){var r,i,o=$;try{r=t(),r&&(o=r),i=e(r)}catch(s){return new K(qe(s).subscribe(n),o)}return new K(i.subscribe(n),o)})},Ce.amb=function(t){var e=this;return new Ve(function(n){function r(){o||(o=s,a.dispose())}function i(){o||(o=u,c.dispose())}var o,s="L",u="R",c=new te,a=new te;return c.setDisposable(e.subscribe(function(t){r(),o===s&&n.onNext(t)},function(t){r(),o===s&&n.onError(t)},function(){r(),o===s&&n.onCompleted()})),a.setDisposable(t.subscribe(function(t){i(),o===u&&n.onNext(t)},function(t){i(),o===u&&n.onError(t)},function(){i(),o===u&&n.onCompleted()})),new K(c,a)})},Re.amb=function(){function t(t,e){return t.amb(e)}for(var e=ke(),n=p(arguments,0),r=0,i=n.length;i>r;r++)e=t(e,n[r]);return e},Ce["catch"]=Ce.catchException=function(t){return"function"==typeof t?v(this,t):Pe([this,t])};var Pe=Re.catchException=Re["catch"]=function(){var t=p(arguments,0);return Ee(t).catchException()};Ce.combineLatest=function(){var t=F.call(arguments);return Array.isArray(t[0])?t[0].unshift(this):t.unshift(this),Te.apply(this,t)};var Te=Re.combineLatest=function(){var t=F.call(arguments),n=t.pop();return Array.isArray(t[0])&&(t=t[0]),new Ve(function(i){function o(t){var o;if(a[t]=!0,h||(h=a.every(r))){try{o=n.apply(null,f)}catch(s){return i.onError(s),e}i.onNext(o)}else l.filter(function(e,n){return n!==t}).every(r)&&i.onCompleted()}function s(t){l[t]=!0,l.every(r)&&i.onCompleted()}for(var u=function(){return!1},c=t.length,a=d(c,u),h=!1,l=d(c,u),f=Array(c),p=Array(c),b=0;c>b;b++)(function(e){p[e]=new te,p[e].setDisposable(t[e].subscribe(function(t){f[e]=t,o(e)},i.onError.bind(i),function(){s(e)}))})(b);return new K(p)})};Ce.concat=function(){var t=F.call(arguments,0);return t.unshift(this),Me.apply(this,t)};var Me=Re.concat=function(){var t=p(arguments,0);return Ee(t).concat()};Ce.concatObservable=Ce.concatAll=function(){return this.merge(1)},Ce.merge=function(t){if("number"!=typeof t)return Le(this,t);var e=this;return new Ve(function(n){var r=0,i=new K,o=!1,s=[],u=function(t){var e=new te;i.add(e),e.setDisposable(t.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){var t;i.remove(e),s.length>0?(t=s.shift(),u(t)):(r--,o&&0===r&&n.onCompleted())}))};return i.add(e.subscribe(function(e){t>r?(r++,u(e)):s.push(e)},n.onError.bind(n),function(){o=!0,0===r&&n.onCompleted()})),i})};var Le=Re.merge=function(){var t,e;return arguments[0]?arguments[0].now?(t=arguments[0],e=F.call(arguments,1)):(t=ae,e=F.call(arguments,0)):(t=ae,e=F.call(arguments,1)),Array.isArray(e[0])&&(e=e[0]),je(e,t).mergeObservable()};Ce.mergeObservable=Ce.mergeAll=function(){var t=this;return new Ve(function(e){var n=new K,r=!1,i=new te;return n.add(i),i.setDisposable(t.subscribe(function(t){var i=new te;n.add(i),i.setDisposable(t.subscribe(function(t){e.onNext(t)},e.onError.bind(e),function(){n.remove(i),r&&1===n.length&&e.onCompleted()}))},e.onError.bind(e),function(){r=!0,1===n.length&&e.onCompleted()})),n})},Ce.onErrorResumeNext=function(t){if(!t)throw Error("Second observable is required");return ze([this,t])};var ze=Re.onErrorResumeNext=function(){var t=p(arguments,0);return new Ve(function(e){var n=0,r=new ne,i=ae.scheduleRecursive(function(i){var o,s;t.length>n?(o=t[n++],s=new te,r.setDisposable(s),s.setDisposable(o.subscribe(e.onNext.bind(e),function(){i()},function(){i()}))):e.onCompleted()});return new K(r,i)})};Ce.skipUntil=function(t){var e=this;return new Ve(function(n){var r=!1,i=new K(e.subscribe(function(t){r&&n.onNext(t)},n.onError.bind(n),function(){r&&n.onCompleted()})),o=new te;return i.add(o),o.setDisposable(t.subscribe(function(){r=!0,o.dispose()},n.onError.bind(n),function(){o.dispose()})),i})},Ce["switch"]=Ce.switchLatest=function(){var t=this;return new Ve(function(e){var n=!1,r=new ne,i=!1,o=0,s=t.subscribe(function(t){var s=new te,u=++o;n=!0,r.setDisposable(s),s.setDisposable(t.subscribe(function(t){o===u&&e.onNext(t)},function(t){o===u&&e.onError(t)},function(){o===u&&(n=!1,i&&e.onCompleted())}))},e.onError.bind(e),function(){i=!0,n||e.onCompleted()});return new K(s,r)})},Ce.takeUntil=function(t){var e=this;return new Ve(function(r){return new K(e.subscribe(r),t.subscribe(r.onCompleted.bind(r),r.onError.bind(r),n))})},Ce.zip=function(){if(Array.isArray(arguments[0]))return m.apply(this,arguments);var t=this,n=F.call(arguments),i=n.pop();return n.unshift(t),new Ve(function(o){function s(t){a[t]=!0,a.every(function(t){return t})&&o.onCompleted()}for(var u=n.length,c=d(u,function(){return[]}),a=d(u,function(){return!1}),h=function(n){var s,u;if(c.every(function(t){return t.length>0})){try{u=c.map(function(t){return t.shift()}),s=i.apply(t,u)}catch(h){return o.onError(h),e}o.onNext(s)}else a.filter(function(t,e){return e!==n}).every(r)&&o.onCompleted()},l=Array(u),f=0;u>f;f++)(function(t){l[t]=new te,l[t].setDisposable(n[t].subscribe(function(e){c[t].push(e),h(t)},o.onError.bind(o),function(){s(t)}))})(f);return new K(l)})},Re.zip=function(){var t=F.call(arguments,0),e=t.shift();return e.zip.apply(e,t)},Re.zipArray=function(){var t=F.call(arguments);return new Ve(function(n){function i(t){if(u.every(function(t){return t.length>0})){var i=u.map(function(t){return t.shift()});n.onNext(i)}else if(c.filter(function(e,n){return n!==t}).every(r))return n.onCompleted(),e}function o(t){return c[t]=!0,c.every(r)?(n.onCompleted(),e):e}for(var s=t.length,u=d(s,function(){return[]}),c=d(s,function(){return!1}),a=Array(s),h=0;s>h;h++)(function(e){a[e]=new te,a[e].setDisposable(t[e].subscribe(function(t){u[e].push(t),i(e)},n.onError.bind(n),function(){o(e)}))})(h);var l=new K(a);return l.add(Z(function(){for(var t=0,e=u.length;e>t;t++)u[t]=[]})),l})},Ce.asObservable=function(){var t=this;return new Ve(function(e){return t.subscribe(e)})},Ce.bufferWithCount=function(t,e){return 1===arguments.length&&(e=t),this.windowWithCount(t,e).selectMany(function(t){return t.toArray()}).where(function(t){return t.length>0})},Ce.dematerialize=function(){var t=this;return new Ve(function(e){return t.subscribe(function(t){return t.accept(e)},e.onError.bind(e),e.onCompleted.bind(e))})},Ce.distinctUntilChanged=function(t,n){var o=this;return t||(t=r),n||(n=i),new Ve(function(r){var i,s=!1;return o.subscribe(function(o){var u,c=!1;try{u=t(o)}catch(a){return r.onError(a),e}if(s)try{c=n(i,u)}catch(a){return r.onError(a),e}s&&c||(s=!0,i=u,r.onNext(o))},r.onError.bind(r),r.onCompleted.bind(r))})},Ce["do"]=Ce.doAction=function(t,e,n){var r,i=this;return"function"==typeof t?r=t:(r=t.onNext.bind(t),e=t.onError.bind(t),n=t.onCompleted.bind(t)),new Ve(function(t){return i.subscribe(function(e){try{r(e)}catch(n){t.onError(n)}t.onNext(e)},function(n){if(e){try{e(n)}catch(r){t.onError(r)}t.onError(n)}else t.onError(n)},function(){if(n){try{n()}catch(e){t.onError(e)}t.onCompleted()}else t.onCompleted()})})},Ce["finally"]=Ce.finallyAction=function(t){var e=this;return new Ve(function(n){var r=e.subscribe(n);return Z(function(){try{r.dispose()}catch(e){throw e}finally{t()}})})},Ce.ignoreElements=function(){var t=this;return new Ve(function(e){return t.subscribe(n,e.onError.bind(e),e.onCompleted.bind(e))})},Ce.materialize=function(){var t=this;return new Ve(function(e){return t.subscribe(function(t){e.onNext(de(t))},function(t){e.onNext(be(t)),e.onCompleted()},function(){e.onNext(ve()),e.onCompleted()})})},Ce.repeat=function(t){return ge(this,t).concat()},Ce.retry=function(t){return ge(this,t).catchException()},Ce.scan=function(){var t,n,r=!1,i=this;return 2===arguments.length?(r=!0,t=arguments[0],n=arguments[1]):n=arguments[0],new Ve(function(o){var s,u,c;return i.subscribe(function(i){try{c||(c=!0),s?u=n(u,i):(u=r?n(t,i):i,s=!0)}catch(a){return o.onError(a),e}o.onNext(u)},o.onError.bind(o),function(){!c&&r&&o.onNext(t),o.onCompleted()})})},Ce.skipLast=function(t){var e=this;return new Ve(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&n.onNext(r.shift())},n.onError.bind(n),n.onCompleted.bind(n))})},Ce.startWith=function(){var t,e,n=0;return arguments.length&&"now"in Object(arguments[0])?(e=arguments[0],n=1):e=ae,t=F.call(arguments,n),Ee([je(t,e),this]).concat()},Ce.takeLast=function(t,e){return this.takeLastBuffer(t).selectMany(function(t){return je(t,e)})},Ce.takeLastBuffer=function(t){var e=this;return new Ve(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&r.shift()},n.onError.bind(n),function(){n.onNext(r),n.onCompleted()})})},Ce.windowWithCount=function(t,e){var n=this;if(0>=t)throw Error(A);if(1===arguments.length&&(e=t),0>=e)throw Error(A);return new Ve(function(r){var i=new te,o=new ie(i),s=0,u=[],c=function(){var t=new He;u.push(t),r.onNext(H(t,o))};return c(),i.setDisposable(n.subscribe(function(n){for(var r,i=0,o=u.length;o>i;i++)u[i].onNext(n);var a=s-t+1;a>=0&&0===a%e&&(r=u.shift(),r.onCompleted()),s++,0===s%e&&c()},function(t){for(;u.length>0;)u.shift().onError(t);r.onError(t)},function(){for(;u.length>0;)u.shift().onCompleted();r.onCompleted()})),o})},Ce.defaultIfEmpty=function(t){var n=this;return t===e&&(t=null),new Ve(function(e){var r=!1;return n.subscribe(function(t){r=!0,e.onNext(t)},e.onError.bind(e),function(){r||e.onNext(t),e.onCompleted()})})},Ce.distinct=function(t,n){var i=this;return t||(t=r),n||(n=s),new Ve(function(r){var o={};return i.subscribe(function(i){var s,u,c,a=!1;try{s=t(i),u=n(s)}catch(h){return r.onError(h),e}for(c in o)if(u===c){a=!0;break}a||(o[u]=null,r.onNext(i))},r.onError.bind(r),r.onCompleted.bind(r))})},Ce.groupBy=function(t,e,n){return this.groupByUntil(t,e,function(){return ke()},n)},Ce.groupByUntil=function(t,i,o,u){var c=this; | ||
return i||(i=r),u||(u=s),new Ve(function(r){var s={},a=new K,h=new ie(a);return a.add(c.subscribe(function(c){var l,f,p,d,b,v,m,y,w,g;try{v=t(c),m=u(v)}catch(E){for(g in s)s[g].onError(E);return r.onError(E),e}d=!1;try{w=s[m],w||(w=new He,s[m]=w,d=!0)}catch(E){for(g in s)s[g].onError(E);return r.onError(E),e}if(d){b=new Be(v,w,h),f=new Be(v,w);try{l=o(f)}catch(E){for(g in s)s[g].onError(E);return r.onError(E),e}r.onNext(b),y=new te,a.add(y);var D=function(){m in s&&(delete s[m],w.onCompleted()),a.remove(y)};y.setDisposable(l.take(1).subscribe(n,function(t){for(g in s)s[g].onError(t);r.onError(t)},function(){D()}))}try{p=i(c)}catch(E){for(g in s)s[g].onError(E);return r.onError(E),e}w.onNext(p)},function(t){for(var e in s)s[e].onError(t);r.onError(t)},function(){for(var t in s)s[t].onCompleted();r.onCompleted()})),h})},Ce.select=Ce.map=function(t,n){var r=this;return new Ve(function(i){var o=0;return r.subscribe(function(s){var u;try{u=t.call(n,s,o++,r)}catch(c){return i.onError(c),e}i.onNext(u)},i.onError.bind(i),i.onCompleted.bind(i))})},Ce.pluck=function(t){return this.select(function(e){return e[t]})},Ce.selectMany=Ce.flatMap=function(t,e){return e?this.selectMany(function(n){return t(n).select(function(t){return e(n,t)})}):"function"==typeof t?y.call(this,t):y.call(this,function(){return t})},Ce.selectSwitch=Ce.flatMapLatest=function(t,e){return this.select(t,e).switchLatest()},Ce.skip=function(t){if(0>t)throw Error(A);var e=this;return new Ve(function(n){var r=t;return e.subscribe(function(t){0>=r?n.onNext(t):r--},n.onError.bind(n),n.onCompleted.bind(n))})},Ce.skipWhile=function(t,n){var r=this;return new Ve(function(i){var o=0,s=!1;return r.subscribe(function(u){if(!s)try{s=!t.call(n,u,o++,r)}catch(c){return i.onError(c),e}s&&i.onNext(u)},i.onError.bind(i),i.onCompleted.bind(i))})},Ce.take=function(t,e){if(0>t)throw Error(A);if(0===t)return We(e);var n=this;return new Ve(function(e){var r=t;return n.subscribe(function(t){r>0&&(r--,e.onNext(t),0===r&&e.onCompleted())},e.onError.bind(e),e.onCompleted.bind(e))})},Ce.takeWhile=function(t,n){var r=this;return new Ve(function(i){var o=0,s=!0;return r.subscribe(function(u){if(s){try{s=t.call(n,u,o++,r)}catch(c){return i.onError(c),e}s?i.onNext(u):i.onCompleted()}},i.onError.bind(i),i.onCompleted.bind(i))})},Ce.where=Ce.filter=function(t,n){var r=this;return new Ve(function(i){var o=0;return r.subscribe(function(s){var u;try{u=t.call(n,s,o++,r)}catch(c){return i.onError(c),e}u&&i.onNext(s)},i.onError.bind(i),i.onCompleted.bind(i))})};var Ve=D.Internals.AnonymousObservable=function(t){function n(t){return t===e?t=$:"function"==typeof t&&(t=Z(t)),t}function r(i){function o(t){var e=new Fe(t);if(he.scheduleRequired())he.schedule(function(){try{e.setDisposable(n(i(e)))}catch(t){if(!e.fail(t))throw t}});else try{e.setDisposable(n(i(e)))}catch(r){if(!e.fail(r))throw r}return e}return this instanceof r?(t.call(this,o),e):new r(i)}return B(r,t),r}(Re),Fe=function(t){function e(e){t.call(this),this.observer=e,this.m=new te}B(e,t);var n=e.prototype;return n.next=function(t){var e=!1;try{this.observer.onNext(t),e=!0}catch(n){throw n}finally{e||this.dispose()}},n.error=function(t){try{this.observer.onError(t)}catch(e){throw e}finally{this.dispose()}},n.completed=function(){try{this.observer.onCompleted()}catch(t){throw t}finally{this.dispose()}},n.setDisposable=function(t){this.m.setDisposable(t)},n.getDisposable=function(){return this.m.getDisposable()},n.disposable=function(t){return arguments.length?this.getDisposable():setDisposable(t)},n.dispose=function(){t.prototype.dispose.call(this),this.m.dispose()},e}(Ae),Be=function(t){function e(t){return this.underlyingObservable.subscribe(t)}function n(n,r,i){t.call(this,e),this.key=n,this.underlyingObservable=i?new Ve(function(t){return new K(i.getDisposable(),r.subscribe(t))}):r}return B(n,t),n}(Re),Ue=function(t,e){this.subject=t,this.observer=e};Ue.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1),this.observer=null}};var He=D.Subject=function(t){function e(t){return c.call(this),this.isStopped?this.exception?(t.onError(this.exception),$):(t.onCompleted(),$):(this.observers.push(t),new Ue(this,t))}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return B(n,t),U(n.prototype,De,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(c.call(this),!this.isStopped){var t=this.observers.slice(0);this.isStopped=!0;for(var e=0,n=t.length;n>e;e++)t[e].onCompleted();this.observers=[]}},onError:function(t){if(c.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){if(c.call(this),!this.isStopped)for(var e=this.observers.slice(0),n=0,r=e.length;r>n;n++)e[n].onNext(t)},dispose:function(){this.isDisposed=!0,this.observers=null}}),n.create=function(t,e){return new Qe(t,e)},n}(Re);D.AsyncSubject=function(t){function e(t){if(c.call(this),!this.isStopped)return this.observers.push(t),new Ue(this,t);var e=this.exception,n=this.hasValue,r=this.value;return e?t.onError(e):n?(t.onNext(r),t.onCompleted()):t.onCompleted(),$}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return B(n,t),U(n.prototype,De,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){var t,e,n;if(c.call(this),!this.isStopped){var r=this.observers.slice(0);this.isStopped=!0;var i=this.value,o=this.hasValue;if(o)for(e=0,n=r.length;n>e;e++)t=r[e],t.onNext(i),t.onCompleted();else for(e=0,n=r.length;n>e;e++)r[e].onCompleted();this.observers=[]}},onError:function(t){if(c.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){c.call(this),this.isStopped||(this.value=t,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),n}(Re);var Qe=function(t){function e(t){return this.observable.subscribe(t)}function n(n,r){t.call(this,e),this.observer=n,this.observable=r}return B(n,t),U(n.prototype,De,{onCompleted:function(){this.observer.onCompleted()},onError:function(t){this.observer.onError(t)},onNext:function(t){this.observer.onNext(t)}}),n}(Re);return"function"==typeof define&&"object"==typeof define.amd&&define.amd?(t.Rx=D,define(function(){return D})):(w?"object"==typeof module&&module&&module.exports==w?module.exports=D:w=D:t.Rx=D,e)})(this); | ||
(function(a){function b(){}function c(a){return a}function d(a,b){return R(a,b)}function e(a,b){return a-b}function f(a){return a.toString()}function g(a){throw a}function h(){if(this.isDisposed)throw new Error(D)}function i(a){return"function"!=typeof a.toString&&"string"==typeof(a+"")}function j(a){return a&&"object"==typeof a?N.call(a)==E:!1}function k(a){return"function"==typeof a}function l(a,b,c,d){var e;if(a===b)return 0!==a||1/a==1/b;var f=typeof a,g=typeof b;if(!(a!==a||a&&s[f]||b&&s[g]))return!1;if(null==a||null==b)return a===b;var h=N.call(a),m=N.call(b);if(h==E&&(h=K),m==E&&(m=K),h!=m)return!1;switch(h){case G:case H:return+a==+b;case J:return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case L:case M:return a==String(b)}var n=h==F;if(!n){if(h!=K||!y&&(i(a)||i(b)))return!1;var o=!P&&j(a)?Object:a.constructor,p=!P&&j(b)?Object:b.constructor;if(o!=p&&!(k(o)&&o instanceof o&&k(p)&&p instanceof p))return!1}for(var q=c.length;q--;)if(c[q]==a)return d[q]==b;var r=0;if(e=!0,c.push(a),d.push(b),n){for(q=a.length,r=b.length,e=r==a.length;r--;){var t=b[r];if(!(e=l(a[r],t,c,d)))break}return e}for(var u in b)if(O.call(b,u))return r++,e=O.call(a,u)&&l(a[u],b[u],c,d);if(e)for(var u in a)if(O.call(a,u))return e=--r>-1;return c.pop(),d.pop(),e}function m(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:S.call(a)}function n(a,b){for(var c=new Array(a),d=0;a>d;d++)c[d]=b();return c}function o(a,b){this.scheduler=a,this.disposable=b,this.isDisposed=!1}function p(a,b){return new Tb(function(c){var d=new db,e=new eb;return e.setDisposable(d),d.setDisposable(a.subscribe(c.onNext.bind(c),function(a){var d,f;try{f=b(a)}catch(g){return c.onError(g),void 0}d=new db,e.setDisposable(d),d.setDisposable(f.subscribe(c))},c.onCompleted.bind(c))),e})}function q(a,b){var c=this;return new Tb(function(d){var e=0,f=a.length;return c.subscribe(function(c){if(f>e){var g,h=a[e++];try{g=b(c,h)}catch(i){return d.onError(i),void 0}d.onNext(g)}else d.onCompleted()},d.onError.bind(d),d.onCompleted.bind(d))})}function r(a){return this.select(a).mergeObservable()}var s={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},t=s[typeof window]&&window||this,u=s[typeof exports]&&exports&&!exports.nodeType&&exports,v=s[typeof module]&&module&&!module.nodeType&&module,w=v&&v.exports===u&&u,x=s[typeof global]&&global;!x||x.global!==x&&x.window!==x||(t=x);var y,z={Internals:{}},A=Date.now,B="Sequence contains no elements.",C="Argument out of range",D="Object has been disposed",s={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},E="[object Arguments]",F="[object Array]",G="[object Boolean]",H="[object Date]",I="[object Function]",J="[object Number]",K="[object Object]",L="[object RegExp]",M="[object String]",N=Object.prototype.toString,O=Object.prototype.hasOwnProperty,P=N.call(arguments)==E;try{y=!(N.call(document)==K&&!({toString:0}+""))}catch(Q){y=!0}P||(j=function(a){return a&&"object"==typeof a?O.call(a,"callee"):!1}),k(/x/)&&(k=function(a){return"function"==typeof a&&N.call(a)==I});var R=z.Internals.isEqual=function(a,b){return l(a,b,[],[])},S=Array.prototype.slice;({}).hasOwnProperty;var T=this.inherits=z.Internals.inherits=function(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c},U=z.Internals.addProperties=function(a){for(var b=S.call(arguments,1),c=0,d=b.length;d>c;c++){var e=b[c];for(var f in e)a[f]=e[f]}},V=z.Internals.addRef=function(a,b){return new Tb(function(c){return new Z(b.getDisposable(),a.subscribe(c))})},W=function(a,b){this.id=a,this.value=b};W.prototype.compareTo=function(a){var b=this.value.compareTo(a.value);return 0===b&&(b=this.id-a.id),b};var X=z.Internals.PriorityQueue=function(a){this.items=new Array(a),this.length=0},Y=X.prototype;Y.isHigherPriority=function(a,b){return this.items[a].compareTo(this.items[b])<0},Y.percolate=function(a){if(!(a>=this.length||0>a)){var b=a-1>>1;if(!(0>b||b===a)&&this.isHigherPriority(a,b)){var c=this.items[a];this.items[a]=this.items[b],this.items[b]=c,this.percolate(b)}}},Y.heapify=function(b){if(b===a&&(b=0),!(b>=this.length||0>b)){var c=2*b+1,d=2*b+2,e=b;if(c<this.length&&this.isHigherPriority(c,e)&&(e=c),d<this.length&&this.isHigherPriority(d,e)&&(e=d),e!==b){var f=this.items[b];this.items[b]=this.items[e],this.items[e]=f,this.heapify(e)}}},Y.peek=function(){return this.items[0].value},Y.removeAt=function(a){this.items[a]=this.items[--this.length],delete this.items[this.length],this.heapify()},Y.dequeue=function(){var a=this.peek();return this.removeAt(0),a},Y.enqueue=function(a){var b=this.length++;this.items[b]=new W(X.count++,a),this.percolate(b)},Y.remove=function(a){for(var b=0;b<this.length;b++)if(this.items[b].value===a)return this.removeAt(b),!0;return!1},X.count=0;var Z=z.CompositeDisposable=function(){this.disposables=m(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},$=Z.prototype;$.add=function(a){this.isDisposed?a.dispose():(this.disposables.push(a),this.length++)},$.remove=function(a){var b=!1;if(!this.isDisposed){var c=this.disposables.indexOf(a);-1!==c&&(b=!0,this.disposables.splice(c,1),this.length--,a.dispose())}return b},$.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.disposables.slice(0);this.disposables=[],this.length=0;for(var b=0,c=a.length;c>b;b++)a[b].dispose()}},$.clear=function(){var a=this.disposables.slice(0);this.disposables=[],this.length=0;for(var b=0,c=a.length;c>b;b++)a[b].dispose()},$.contains=function(a){return-1!==this.disposables.indexOf(a)},$.toArray=function(){return this.disposables.slice(0)};var _=z.Disposable=function(a){this.isDisposed=!1,this.action=a||b};_.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var ab=_.create=function(a){return new _(a)},bb=_.empty={dispose:b},cb=function(){function a(a){this.isSingle=a,this.isDisposed=!1,this.current=null}var b=a.prototype;return b.getDisposable=function(){return this.current},b.setDisposable=function(a){if(this.current&&this.isSingle)throw new Error("Disposable has already been assigned");var b,c=this.isDisposed;c||(b=this.current,this.current=a),b&&b.dispose(),c&&a&&a.dispose()},b.dispose=function(){var a;this.isDisposed||(this.isDisposed=!0,a=this.current,this.current=null),a&&a.dispose()},a}(),db=z.SingleAssignmentDisposable=function(a){function b(){a.call(this,!0)}return T(b,a),b}(cb),eb=z.SerialDisposable=function(a){function b(){a.call(this,!1)}return T(b,a),b}(cb),fb=z.RefCountDisposable=function(){function a(a){this.disposable=a,this.disposable.count++,this.isInnerDisposed=!1}function b(a){this.underlyingDisposable=a,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return a.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},b.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},b.prototype.getDisposable=function(){return this.isDisposed?bb:new a(this)},b}();o.prototype.dispose=function(){var a=this;this.scheduler.schedule(function(){a.isDisposed||(a.isDisposed=!0,a.disposable.dispose())})};var gb=z.Internals.ScheduledItem=function(a,b,c,d,f){this.scheduler=a,this.state=b,this.action=c,this.dueTime=d,this.comparer=f||e,this.disposable=new db};gb.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},gb.prototype.compareTo=function(a){return this.comparer(this.dueTime,a.dueTime)},gb.prototype.isCancelled=function(){return this.disposable.isDisposed},gb.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var hb=z.Scheduler=function(){function a(a,b,c,d){this.now=a,this._schedule=b,this._scheduleRelative=c,this._scheduleAbsolute=d}function b(a,b){var c=b.first,d=b.second,e=new Z,f=function(b){d(b,function(b){var c=!1,d=!1,g=a.scheduleWithState(b,function(a,b){return c?e.remove(g):d=!0,f(b),bb});d||(e.add(g),c=!0)})};return f(c),e}function c(a,b,c){var d=b.first,e=b.second,f=new Z,g=function(b){e(b,function(b,d){var e=!1,h=!1,i=a[c].call(a,b,d,function(a,b){return e?f.remove(i):h=!0,g(b),bb});h||(f.add(i),e=!0)})};return g(d),f}function d(a,b){return b(),bb}var e=a.prototype;return e.catchException=e["catch"]=function(a){return new qb(this,a)},e.schedulePeriodic=function(a,b){return this.schedulePeriodicWithState(null,a,function(){b()})},e.schedulePeriodicWithState=function(a,b,c){var d=a,e=setInterval(function(){d=c(d)},b);return ab(function(){clearInterval(e)})},e.schedule=function(a){return this._schedule(a,d)},e.scheduleWithState=function(a,b){return this._schedule(a,b)},e.scheduleWithRelative=function(a,b){return this._scheduleRelative(b,a,d)},e.scheduleWithRelativeAndState=function(a,b,c){return this._scheduleRelative(a,b,c)},e.scheduleWithAbsolute=function(a,b){return this._scheduleAbsolute(b,a,d)},e.scheduleWithAbsoluteAndState=function(a,b,c){return this._scheduleAbsolute(a,b,c)},e.scheduleRecursive=function(a){return this.scheduleRecursiveWithState(a,function(a,b){a(function(){b(a)})})},e.scheduleRecursiveWithState=function(a,c){return this.scheduleWithState({first:a,second:c},function(a,c){return b(a,c)})},e.scheduleRecursiveWithRelative=function(a,b){return this.scheduleRecursiveWithRelativeAndState(b,a,function(a,b){a(function(c){b(a,c)})})},e.scheduleRecursiveWithRelativeAndState=function(a,b,d){return this._scheduleRelative({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithRelativeAndState")})},e.scheduleRecursiveWithAbsolute=function(a,b){return this.scheduleRecursiveWithAbsoluteAndState(b,a,function(a,b){a(function(c){b(a,c)})})},e.scheduleRecursiveWithAbsoluteAndState=function(a,b,d){return this._scheduleAbsolute({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithAbsoluteAndState")})},a.now=A,a.normalize=function(a){return 0>a&&(a=0),a},a}(),ib=hb.normalize;z.Internals.SchedulePeriodicRecursive=function(){function a(a,b){b(0,this._period);try{this._state=this._action(this._state)}catch(c){throw this._cancel.dispose(),c}}function b(a,b,c,d){this._scheduler=a,this._state=b,this._period=c,this._action=d}return b.prototype.start=function(){var b=new db;return this._cancel=b,b.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,a.bind(this))),b},b}();var jb,kb=hb.immediate=function(){function a(a,b){return b(this,a)}function b(a,b,c){for(var d=ib(d);d-this.now()>0;);return c(this,a)}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new hb(A,a,b,c)}(),lb=hb.currentThread=function(){function a(){e=new X(4)}function b(a,b){return this.scheduleWithRelativeAndState(a,0,b)}function c(b,c,d){var f,g=this.now()+ib(c),h=new gb(this,b,d,g);if(e)e.enqueue(h);else{f=new a;try{e.enqueue(h),f.run()}catch(i){throw i}finally{f.dispose()}}return h.disposable}function d(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}var e;a.prototype.dispose=function(){e=null},a.prototype.run=function(){for(var a;e.length>0;)if(a=e.dequeue(),!a.isCancelled()){for(;a.dueTime-hb.now()>0;);a.isCancelled()||a.invoke()}};var f=new hb(A,b,c,d);return f.scheduleRequired=function(){return null===e},f.ensureTrampoline=function(a){return null===e?this.schedule(a):a()},f}(),mb=RegExp("^"+String(N).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),nb="function"==typeof(nb=x&&w&&x.setImmediate)&&!mb.test(nb)&&nb,ob="function"==typeof(ob=x&&w&&x.clearImmediate)&&!mb.test(ob)&&ob,pb=b;!function(){function a(){if(!t.postMessage||t.importScripts)return!1;var a=!1,b=t.onmessage;return t.onmessage=function(){a=!0},t.postMessage("","*"),t.onmessage=b,a}function b(a){if("string"==typeof a.data&&a.data.substring(0,c.length)===c){var b=a.data.substring(c.length),e=d[b];e(),delete d[b]}}if("function"==typeof nb)jb=nb,pb=ob;else if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))jb=process.nextTick;else if(a()){var c="ms.rx.schedule"+Math.random(),d={},e=0;t.addEventListener?t.addEventListener("message",b,!1):t.attachEvent("onmessage",b,!1),jb=function(a){var b=e++;d[b]=a,t.postMessage(c+b,"*")}}else if(t.MessageChannel){var f=new t.MessageChannel,g={},h=0;f.port1.onmessage=function(a){var b=a.data,c=g[b];c(),delete g[b]},jb=function(a){var b=h++;g[b]=a,f.port2.postMessage(b)}}else"document"in t&&"onreadystatechange"in t.document.createElement("script")?jb=function(a){var b=t.document.createElement("script");b.onreadystatechange=function(){a(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},t.document.documentElement.appendChild(b)}:(jb=function(a){return setTimeout(a,0)},pb=clearTimeout)}(),hb.timeout=function(){function a(a,b){var c=this,d=new db,e=jb(function(){d.isDisposed||d.setDisposable(b(c,a))});return new Z(d,ab(function(){pb(e)}))}function b(a,b,c){var d=this,e=hb.normalize(b);if(0===e)return d.scheduleWithState(a,c);var f=new db,g=setTimeout(function(){f.isDisposed||f.setDisposable(c(d,a))},e);return new Z(f,ab(function(){clearTimeout(g)}))}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new hb(A,a,b,c)}();var qb=function(a){function b(){return this._scheduler.now()}function c(a,b){return this._scheduler.scheduleWithState(a,this._wrap(b))}function d(a,b,c){return this._scheduler.scheduleWithRelativeAndState(a,b,this._wrap(c))}function e(a,b,c){return this._scheduler.scheduleWithAbsoluteAndState(a,b,this._wrap(c))}function f(f,g){this._scheduler=f,this._handler=g,this._recursiveOriginal=null,this._recursiveWrapper=null,a.call(this,b,c,d,e)}return T(f,a),f.prototype._clone=function(a){return new f(a,this._handler)},f.prototype._wrap=function(a){var b=this;return function(c,d){try{return a(b._getRecursiveWrapper(c),d)}catch(e){if(!b._handler(e))throw e;return bb}}},f.prototype._getRecursiveWrapper=function(a){if(this._recursiveOriginal!==a){this._recursiveOriginal=a;var b=this._clone(a);b._recursiveOriginal=a,b._recursiveWrapper=b,this._recursiveWrapper=b}return this._recursiveWrapper},f.prototype.schedulePeriodicWithState=function(a,b,c){var d=this,e=!1,f=new db;return f.setDisposable(this._scheduler.schedulePeriodicWithState(a,b,function(a){if(e)return null;try{return c(a)}catch(b){if(e=!0,!d._handler(b))throw b;return f.dispose(),null}})),f},f}(hb),rb=z.Notification=function(){function a(a,b){this.hasValue=null==b?!1:b,this.kind=a}var b=a.prototype;return b.accept=function(a,b,c){return 1===arguments.length&&"object"==typeof a?this._acceptObservable(a):this._accept(a,b,c)},b.toObservable=function(a){var b=this;return a||(a=kb),new Tb(function(c){return a.schedule(function(){b._acceptObservable(c),"N"===b.kind&&c.onCompleted()})})},a}(),sb=rb.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 rb("N",!0);return e.value=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),tb=rb.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 rb("E");return e.exception=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),ub=rb.createOnCompleted=function(){function a(a,b,c){return c()}function b(a){return a.onCompleted()}function c(){return"OnCompleted()"}return function(){var d=new rb("C");return d._accept=a,d._acceptObservable=b,d.toString=c,d}}(),vb=z.Internals.Enumerator=function(a,b){this.moveNext=a,this.getCurrent=b},wb=vb.create=function(a,b){var c=!1;return new vb(function(){if(c)return!1;var b=a();return b||(c=!0),b},function(){return b()})},xb=z.Internals.Enumerable=function(a){this.getEnumerator=a};xb.prototype.concat=function(){var a=this;return new Tb(function(b){var c,d=a.getEnumerator(),e=new eb,f=kb.scheduleRecursive(function(a){var f,g;if(!c){try{g=d.moveNext(),g&&(f=d.getCurrent())}catch(h){return b.onError(h),void 0}if(!g)return b.onCompleted(),void 0;var i=new db;e.setDisposable(i),i.setDisposable(f.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){a()}))}});return new Z(e,f,ab(function(){c=!0}))})},xb.prototype.catchException=function(){var a=this;return new Tb(function(b){var c,d,e=a.getEnumerator(),f=new eb,g=kb.scheduleRecursive(function(a){var g,h;if(!c){try{h=e.moveNext(),h&&(g=e.getCurrent())}catch(i){return b.onError(i),void 0}if(!h)return d?b.onError(d):b.onCompleted(),void 0;var j=new db;f.setDisposable(j),j.setDisposable(g.subscribe(b.onNext.bind(b),function(b){d=b,a()},b.onCompleted.bind(b)))}});return new Z(f,g,ab(function(){c=!0}))})};var yb=xb.repeat=function(a,b){return 1===arguments.length&&(b=-1),new xb(function(){var c,d=b;return wb(function(){return 0===d?!1:(d>0&&d--,c=a,!0)},function(){return c})})},zb=xb.forEach=function(a,b,d){return b||(b=c),new xb(function(){var c,e=-1;return wb(function(){return++e<a.length?(c=b.call(d,a[e],e,a),!0):!1},function(){return c})})},Ab=z.Observer=function(){};Ab.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},Ab.prototype.asObserver=function(){return new Eb(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},Ab.prototype.checked=function(){return new Fb(this)};var Bb=Ab.create=function(a,c,d){return a||(a=b),c||(c=g),d||(d=b),new Eb(a,c,d)};Ab.fromNotifier=function(a){return new Eb(function(b){return a(sb(b))},function(b){return a(tb(b))},function(){return a(ub())})},Ab.notifyOn=function(a){return new Hb(a,this)};var Cb,Db=z.Internals.AbstractObserver=function(a){function b(){this.isStopped=!1,a.call(this)}return T(b,a),b.prototype.onNext=function(a){this.isStopped||this.next(a)},b.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.error(a))},b.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},b.prototype.dispose=function(){this.isStopped=!0},b.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.error(a),!0)},b}(Ab),Eb=z.AnonymousObserver=function(a){function b(b,c,d){a.call(this),this._onNext=b,this._onError=c,this._onCompleted=d}return T(b,a),b.prototype.next=function(a){this._onNext(a)},b.prototype.error=function(a){this._onError(a)},b.prototype.completed=function(){this._onCompleted()},b}(Db),Fb=function(a){function b(b){a.call(this),this._observer=b,this._state=0}T(b,a);var c=b.prototype;return c.onNext=function(a){this.checkAccess();try{this._observer.onNext(a)}catch(b){throw b}finally{this._state=0}},c.onError=function(a){this.checkAccess();try{this._observer.onError(a)}catch(b){throw b}finally{this._state=2}},c.onCompleted=function(){this.checkAccess();try{this._observer.onCompleted()}catch(a){throw a}finally{this._state=2}},c.checkAccess=function(){if(1===this._state)throw new Error("Re-entrancy detected");if(2===this._state)throw new Error("Observer completed");0===this._state&&(this._state=1)},b}(Ab),Gb=z.Internals.ScheduledObserver=function(a){function b(b,c){a.call(this),this.scheduler=b,this.observer=c,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new eb}return T(b,a),b.prototype.next=function(a){var b=this;this.queue.push(function(){b.observer.onNext(a)})},b.prototype.error=function(a){var b=this;this.queue.push(function(){b.observer.onError(a)})},b.prototype.completed=function(){var a=this;this.queue.push(function(){a.observer.onCompleted()})},b.prototype.ensureActive=function(){var a=!1,b=this;!this.hasFaulted&&this.queue.length>0&&(a=!this.isAcquired,this.isAcquired=!0),a&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(a){var c;if(!(b.queue.length>0))return b.isAcquired=!1,void 0;c=b.queue.shift();try{c()}catch(d){throw b.queue=[],b.hasFaulted=!0,d}a()}))},b.prototype.dispose=function(){a.prototype.dispose.call(this),this.disposable.dispose()},b}(Db),Hb=function(a){function b(){a.apply(this,arguments)}return T(b,a),b.prototype.next=function(b){a.prototype.next.call(this,b),this.ensureActive()},b.prototype.error=function(b){a.prototype.error.call(this,b),this.ensureActive()},b.prototype.completed=function(){a.prototype.completed.call(this),this.ensureActive()},b}(Gb),Ib=z.Observable=function(){function a(a){this._subscribe=a}return Cb=a.prototype,Cb.finalValue=function(){var a=this;return new Tb(function(b){var c,d=!1;return a.subscribe(function(a){d=!0,c=a},b.onError.bind(b),function(){d?(b.onNext(c),b.onCompleted()):b.onError(new Error(B))})})},Cb.subscribe=Cb.forEach=function(a,b,c){var d;return d="object"==typeof a?a:Bb(a,b,c),this._subscribe(d)},Cb.toArray=function(){function a(a,b){var c=a.slice(0);return c.push(b),c}return this.scan([],a).startWith([]).finalValue()},a}();Cb.observeOn=function(a){var b=this;return new Tb(function(c){return b.subscribe(new Hb(a,c))})},Cb.subscribeOn=function(a){var b=this;return new Tb(function(c){var d=new db,e=new eb;return e.setDisposable(d),d.setDisposable(a.schedule(function(){e.setDisposable(new o(a,b.subscribe(c)))})),e})},Ib.create=Ib.createWithDisposable=function(a){return new Tb(a)},Ib.defer=function(a){return new Tb(function(b){var c;try{c=a()}catch(d){return Nb(d).subscribe(b)}return c.subscribe(b)})};var Jb=Ib.empty=function(a){return a||(a=kb),new Tb(function(b){return a.schedule(function(){b.onCompleted()})})},Kb=Ib.fromArray=function(a,b){return b||(b=lb),new Tb(function(c){var d=0;return b.scheduleRecursive(function(b){d<a.length?(c.onNext(a[d++]),b()):c.onCompleted()})})};Ib.generate=function(a,b,c,d,e){return e||(e=lb),new Tb(function(f){var g=!0,h=a;return e.scheduleRecursive(function(a){var e,i;try{g?g=!1:h=c(h),e=b(h),e&&(i=d(h))}catch(j){return f.onError(j),void 0}e?(f.onNext(i),a()):f.onCompleted()})})};var Lb=Ib.never=function(){return new Tb(function(){return bb})};Ib.range=function(a,b,c){return c||(c=lb),new Tb(function(d){return c.scheduleRecursiveWithState(0,function(c,e){b>c?(d.onNext(a+c),e(c+1)):d.onCompleted()})})},Ib.repeat=function(a,b,c){return c||(c=lb),null==b&&(b=-1),Mb(a,c).repeat(b)};var Mb=Ib["return"]=Ib.returnValue=function(a,b){return b||(b=kb),new Tb(function(c){return b.schedule(function(){c.onNext(a),c.onCompleted()})})},Nb=Ib["throw"]=Ib.throwException=function(a,b){return b||(b=kb),new Tb(function(c){return b.schedule(function(){c.onError(a)})})};Ib.using=function(a,b){return new Tb(function(c){var d,e,f=bb;try{d=a(),d&&(f=d),e=b(d)}catch(g){return new Z(Nb(g).subscribe(c),f)}return new Z(e.subscribe(c),f)})},Cb.amb=function(a){var b=this;return new Tb(function(c){function d(){f||(f=g,j.dispose())}function e(){f||(f=h,i.dispose())}var f,g="L",h="R",i=new db,j=new db;return i.setDisposable(b.subscribe(function(a){d(),f===g&&c.onNext(a)},function(a){d(),f===g&&c.onError(a)},function(){d(),f===g&&c.onCompleted()})),j.setDisposable(a.subscribe(function(a){e(),f===h&&c.onNext(a)},function(a){e(),f===h&&c.onError(a)},function(){e(),f===h&&c.onCompleted()})),new Z(i,j)})},Ib.amb=function(){function a(a,b){return a.amb(b)}for(var b=Lb(),c=m(arguments,0),d=0,e=c.length;e>d;d++)b=a(b,c[d]);return b},Cb["catch"]=Cb.catchException=function(a){return"function"==typeof a?p(this,a):Ob([this,a])};var Ob=Ib.catchException=Ib["catch"]=function(){var a=m(arguments,0);return zb(a).catchException()};Cb.combineLatest=function(){var a=S.call(arguments);return Array.isArray(a[0])?a[0].unshift(this):a.unshift(this),Pb.apply(this,a)};var Pb=Ib.combineLatest=function(){var a=S.call(arguments),b=a.pop();return Array.isArray(a[0])&&(a=a[0]),new Tb(function(d){function e(a){var e;if(i[a]=!0,j||(j=i.every(c))){try{e=b.apply(null,l)}catch(f){return d.onError(f),void 0}d.onNext(e)}else k.filter(function(b,c){return c!==a}).every(c)&&d.onCompleted()}function f(a){k[a]=!0,k.every(c)&&d.onCompleted()}for(var g=function(){return!1},h=a.length,i=n(h,g),j=!1,k=n(h,g),l=new Array(h),m=new Array(h),o=0;h>o;o++)!function(b){m[b]=new db,m[b].setDisposable(a[b].subscribe(function(a){l[b]=a,e(b)},d.onError.bind(d),function(){f(b)}))}(o);return new Z(m)})};Cb.concat=function(){var a=S.call(arguments,0);return a.unshift(this),Qb.apply(this,a)};var Qb=Ib.concat=function(){var a=m(arguments,0);return zb(a).concat()};Cb.concatObservable=Cb.concatAll=function(){return this.merge(1)},Cb.merge=function(a){if("number"!=typeof a)return Rb(this,a);var b=this;return new Tb(function(c){var d=0,e=new Z,f=!1,g=[],h=function(a){var b=new db;e.add(b),b.setDisposable(a.subscribe(c.onNext.bind(c),c.onError.bind(c),function(){var a;e.remove(b),g.length>0?(a=g.shift(),h(a)):(d--,f&&0===d&&c.onCompleted())}))};return e.add(b.subscribe(function(b){a>d?(d++,h(b)):g.push(b)},c.onError.bind(c),function(){f=!0,0===d&&c.onCompleted()})),e})};var Rb=Ib.merge=function(){var a,b;return arguments[0]?arguments[0].now?(a=arguments[0],b=S.call(arguments,1)):(a=kb,b=S.call(arguments,0)):(a=kb,b=S.call(arguments,1)),Array.isArray(b[0])&&(b=b[0]),Kb(b,a).mergeObservable()};Cb.mergeObservable=Cb.mergeAll=function(){var a=this;return new Tb(function(b){var c=new Z,d=!1,e=new db;return c.add(e),e.setDisposable(a.subscribe(function(a){var e=new db;c.add(e),e.setDisposable(a.subscribe(function(a){b.onNext(a)},b.onError.bind(b),function(){c.remove(e),d&&1===c.length&&b.onCompleted()}))},b.onError.bind(b),function(){d=!0,1===c.length&&b.onCompleted()})),c})},Cb.onErrorResumeNext=function(a){if(!a)throw new Error("Second observable is required");return Sb([this,a])};var Sb=Ib.onErrorResumeNext=function(){var a=m(arguments,0);return new Tb(function(b){var c=0,d=new eb,e=kb.scheduleRecursive(function(e){var f,g;c<a.length?(f=a[c++],g=new db,d.setDisposable(g),g.setDisposable(f.subscribe(b.onNext.bind(b),function(){e()},function(){e()}))):b.onCompleted()});return new Z(d,e)})};Cb.skipUntil=function(a){var b=this;return new Tb(function(c){var d=!1,e=new Z(b.subscribe(function(a){d&&c.onNext(a)},c.onError.bind(c),function(){d&&c.onCompleted()})),f=new db;return e.add(f),f.setDisposable(a.subscribe(function(){d=!0,f.dispose()},c.onError.bind(c),function(){f.dispose()})),e})},Cb["switch"]=Cb.switchLatest=function(){var a=this;return new Tb(function(b){var c=!1,d=new eb,e=!1,f=0,g=a.subscribe(function(a){var g=new db,h=++f;c=!0,d.setDisposable(g),g.setDisposable(a.subscribe(function(a){f===h&&b.onNext(a)},function(a){f===h&&b.onError(a)},function(){f===h&&(c=!1,e&&b.onCompleted())}))},b.onError.bind(b),function(){e=!0,c||b.onCompleted()});return new Z(g,d)})},Cb.takeUntil=function(a){var c=this;return new Tb(function(d){return new Z(c.subscribe(d),a.subscribe(d.onCompleted.bind(d),d.onError.bind(d),b))})},Cb.zip=function(){if(Array.isArray(arguments[0]))return q.apply(this,arguments);var a=this,b=S.call(arguments),d=b.pop();return b.unshift(a),new Tb(function(e){function f(a){i[a]=!0,i.every(function(a){return a})&&e.onCompleted()}for(var g=b.length,h=n(g,function(){return[]}),i=n(g,function(){return!1}),j=function(b){var f,g;if(h.every(function(a){return a.length>0})){try{g=h.map(function(a){return a.shift()}),f=d.apply(a,g)}catch(j){return e.onError(j),void 0}e.onNext(f)}else i.filter(function(a,c){return c!==b}).every(c)&&e.onCompleted()},k=new Array(g),l=0;g>l;l++)!function(a){k[a]=new db,k[a].setDisposable(b[a].subscribe(function(b){h[a].push(b),j(a)},e.onError.bind(e),function(){f(a)}))}(l);return new Z(k)})},Ib.zip=function(){var a=S.call(arguments,0),b=a.shift();return b.zip.apply(b,a)},Ib.zipArray=function(){var a=S.call(arguments);return new Tb(function(b){function d(a){if(g.every(function(a){return a.length>0})){var d=g.map(function(a){return a.shift()});b.onNext(d)}else if(h.filter(function(b,c){return c!==a}).every(c))return b.onCompleted(),void 0}function e(a){return h[a]=!0,h.every(c)?(b.onCompleted(),void 0):void 0}for(var f=a.length,g=n(f,function(){return[]}),h=n(f,function(){return!1}),i=new Array(f),j=0;f>j;j++)!function(c){i[c]=new db,i[c].setDisposable(a[c].subscribe(function(a){g[c].push(a),d(c)},b.onError.bind(b),function(){e(c)}))}(j);var k=new Z(i);return k.add(ab(function(){for(var a=0,b=g.length;b>a;a++)g[a]=[]})),k})},Cb.asObservable=function(){var a=this;return new Tb(function(b){return a.subscribe(b)})},Cb.bufferWithCount=function(a,b){return 1===arguments.length&&(b=a),this.windowWithCount(a,b).selectMany(function(a){return a.toArray()}).where(function(a){return a.length>0})},Cb.dematerialize=function(){var a=this;return new Tb(function(b){return a.subscribe(function(a){return a.accept(b)},b.onError.bind(b),b.onCompleted.bind(b))})},Cb.distinctUntilChanged=function(a,b){var e=this;return a||(a=c),b||(b=d),new Tb(function(c){var d,f=!1;return e.subscribe(function(e){var g,h=!1;try{g=a(e)}catch(i){return c.onError(i),void 0}if(f)try{h=b(d,g)}catch(i){return c.onError(i),void 0}f&&h||(f=!0,d=g,c.onNext(e))},c.onError.bind(c),c.onCompleted.bind(c))})},Cb["do"]=Cb.doAction=function(a,b,c){var d,e=this;return"function"==typeof a?d=a:(d=a.onNext.bind(a),b=a.onError.bind(a),c=a.onCompleted.bind(a)),new Tb(function(a){return e.subscribe(function(b){try{d(b)}catch(c){a.onError(c)}a.onNext(b)},function(c){if(b){try{b(c)}catch(d){a.onError(d)}a.onError(c)}else a.onError(c)},function(){if(c){try{c()}catch(b){a.onError(b)}a.onCompleted()}else a.onCompleted()})})},Cb["finally"]=Cb.finallyAction=function(a){var b=this;return new Tb(function(c){var d=b.subscribe(c);return ab(function(){try{d.dispose()}catch(b){throw b}finally{a()}})})},Cb.ignoreElements=function(){var a=this;return new Tb(function(c){return a.subscribe(b,c.onError.bind(c),c.onCompleted.bind(c))})},Cb.materialize=function(){var a=this;return new Tb(function(b){return a.subscribe(function(a){b.onNext(sb(a))},function(a){b.onNext(tb(a)),b.onCompleted()},function(){b.onNext(ub()),b.onCompleted()})})},Cb.repeat=function(a){return yb(this,a).concat()},Cb.retry=function(a){return yb(this,a).catchException()},Cb.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 Tb(function(e){var f,g,h;return d.subscribe(function(d){try{h||(h=!0),f?g=b(g,d):(g=c?b(a,d):d,f=!0)}catch(i){return e.onError(i),void 0}e.onNext(g)},e.onError.bind(e),function(){!h&&c&&e.onNext(a),e.onCompleted()})})},Cb.skipLast=function(a){var b=this;return new Tb(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))})},Cb.startWith=function(){var a,b,c=0;return arguments.length&&"now"in Object(arguments[0])?(b=arguments[0],c=1):b=kb,a=S.call(arguments,c),zb([Kb(a,b),this]).concat()},Cb.takeLast=function(a,b){return this.takeLastBuffer(a).selectMany(function(a){return Kb(a,b)})},Cb.takeLastBuffer=function(a){var b=this;return new Tb(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()})})},Cb.windowWithCount=function(a,b){var c=this;if(0>=a)throw new Error(C);if(1===arguments.length&&(b=a),0>=b)throw new Error(C);return new Tb(function(d){var e=new db,f=new fb(e),g=0,h=[],i=function(){var a=new Xb;h.push(a),d.onNext(V(a,f))};return i(),e.setDisposable(c.subscribe(function(c){for(var d,e=0,f=h.length;f>e;e++)h[e].onNext(c);var j=g-a+1;j>=0&&0===j%b&&(d=h.shift(),d.onCompleted()),g++,0===g%b&&i()},function(a){for(;h.length>0;)h.shift().onError(a);d.onError(a)},function(){for(;h.length>0;)h.shift().onCompleted();d.onCompleted()})),f})},Cb.defaultIfEmpty=function(b){var c=this;return b===a&&(b=null),new Tb(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()})})},Cb.distinct=function(a,b){var d=this;return a||(a=c),b||(b=f),new Tb(function(c){var e={};return d.subscribe(function(d){var f,g,h,i=!1;try{f=a(d),g=b(f)}catch(j){return c.onError(j),void 0}for(h in e)if(g===h){i=!0;break}i||(e[g]=null,c.onNext(d))},c.onError.bind(c),c.onCompleted.bind(c))})},Cb.groupBy=function(a,b,c){return this.groupByUntil(a,b,function(){return Lb() | ||
},c)},Cb.groupByUntil=function(a,d,e,g){var h=this;return d||(d=c),g||(g=f),new Tb(function(c){var f={},i=new Z,j=new fb(i);return i.add(h.subscribe(function(h){var k,l,m,n,o,p,q,r,s,t;try{p=a(h),q=g(p)}catch(u){for(t in f)f[t].onError(u);return c.onError(u),void 0}n=!1;try{s=f[q],s||(s=new Xb,f[q]=s,n=!0)}catch(u){for(t in f)f[t].onError(u);return c.onError(u),void 0}if(n){o=new Vb(p,s,j),l=new Vb(p,s);try{k=e(l)}catch(u){for(t in f)f[t].onError(u);return c.onError(u),void 0}c.onNext(o),r=new db,i.add(r);var v=function(){q in f&&(delete f[q],s.onCompleted()),i.remove(r)};r.setDisposable(k.take(1).subscribe(b,function(a){for(t in f)f[t].onError(a);c.onError(a)},function(){v()}))}try{m=d(h)}catch(u){for(t in f)f[t].onError(u);return c.onError(u),void 0}s.onNext(m)},function(a){for(var b in f)f[b].onError(a);c.onError(a)},function(){for(var a in f)f[a].onCompleted();c.onCompleted()})),j})},Cb.select=Cb.map=function(a,b){var c=this;return new Tb(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return d.onError(h),void 0}d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},Cb.pluck=function(a){return this.select(function(b){return b[a]})},Cb.selectMany=Cb.flatMap=function(a,b){return b?this.selectMany(function(c){return a(c).select(function(a){return b(c,a)})}):"function"==typeof a?r.call(this,a):r.call(this,function(){return a})},Cb.selectSwitch=Cb.flatMapLatest=function(a,b){return this.select(a,b).switchLatest()},Cb.skip=function(a){if(0>a)throw new Error(C);var b=this;return new Tb(function(c){var d=a;return b.subscribe(function(a){0>=d?c.onNext(a):d--},c.onError.bind(c),c.onCompleted.bind(c))})},Cb.skipWhile=function(a,b){var c=this;return new Tb(function(d){var e=0,f=!1;return c.subscribe(function(g){if(!f)try{f=!a.call(b,g,e++,c)}catch(h){return d.onError(h),void 0}f&&d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},Cb.take=function(a,b){if(0>a)throw new Error(C);if(0===a)return Jb(b);var c=this;return new Tb(function(b){var d=a;return c.subscribe(function(a){d>0&&(d--,b.onNext(a),0===d&&b.onCompleted())},b.onError.bind(b),b.onCompleted.bind(b))})},Cb.takeWhile=function(a,b){var c=this;return new Tb(function(d){var e=0,f=!0;return c.subscribe(function(g){if(f){try{f=a.call(b,g,e++,c)}catch(h){return d.onError(h),void 0}f?d.onNext(g):d.onCompleted()}},d.onError.bind(d),d.onCompleted.bind(d))})},Cb.where=Cb.filter=function(a,b){var c=this;return new Tb(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return d.onError(h),void 0}g&&d.onNext(f)},d.onError.bind(d),d.onCompleted.bind(d))})};var Tb=z.Internals.AnonymousObservable=function(a){function b(a){return"undefined"==typeof a?a=bb:"function"==typeof a&&(a=ab(a)),a}function c(d){function e(a){var c=new Ub(a);if(lb.scheduleRequired())lb.schedule(function(){try{c.setDisposable(b(d(c)))}catch(a){if(!c.fail(a))throw a}});else try{c.setDisposable(b(d(c)))}catch(e){if(!c.fail(e))throw e}return c}return this instanceof c?(a.call(this,e),void 0):new c(d)}return T(c,a),c}(Ib),Ub=function(a){function b(b){a.call(this),this.observer=b,this.m=new db}T(b,a);var c=b.prototype;return c.next=function(a){var b=!1;try{this.observer.onNext(a),b=!0}catch(c){throw c}finally{b||this.dispose()}},c.error=function(a){try{this.observer.onError(a)}catch(b){throw b}finally{this.dispose()}},c.completed=function(){try{this.observer.onCompleted()}catch(a){throw a}finally{this.dispose()}},c.setDisposable=function(a){this.m.setDisposable(a)},c.getDisposable=function(){return this.m.getDisposable()},c.disposable=function(a){return arguments.length?this.getDisposable():setDisposable(a)},c.dispose=function(){a.prototype.dispose.call(this),this.m.dispose()},b}(Db),Vb=function(a){function b(a){return this.underlyingObservable.subscribe(a)}function c(c,d,e){a.call(this,b),this.key=c,this.underlyingObservable=e?new Tb(function(a){return new Z(e.getDisposable(),d.subscribe(a))}):d}return T(c,a),c}(Ib),Wb=function(a,b){this.subject=a,this.observer=b};Wb.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 Xb=z.Subject=function(a){function b(a){return h.call(this),this.isStopped?this.exception?(a.onError(this.exception),bb):(a.onCompleted(),bb):(this.observers.push(a),new Wb(this,a))}function c(){a.call(this,b),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return T(c,a),U(c.prototype,Ab,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(h.call(this),!this.isStopped){var a=this.observers.slice(0);this.isStopped=!0;for(var b=0,c=a.length;c>b;b++)a[b].onCompleted();this.observers=[]}},onError:function(a){if(h.call(this),!this.isStopped){var b=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var c=0,d=b.length;d>c;c++)b[c].onError(a);this.observers=[]}},onNext:function(a){if(h.call(this),!this.isStopped)for(var b=this.observers.slice(0),c=0,d=b.length;d>c;c++)b[c].onNext(a)},dispose:function(){this.isDisposed=!0,this.observers=null}}),c.create=function(a,b){return new Yb(a,b)},c}(Ib);z.AsyncSubject=function(a){function b(a){if(h.call(this),!this.isStopped)return this.observers.push(a),new Wb(this,a);var b=this.exception,c=this.hasValue,d=this.value;return b?a.onError(b):c?(a.onNext(d),a.onCompleted()):a.onCompleted(),bb}function c(){a.call(this,b),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return T(c,a),U(c.prototype,Ab,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){var a,b,c;if(h.call(this),!this.isStopped){var d=this.observers.slice(0);this.isStopped=!0;var e=this.value,f=this.hasValue;if(f)for(b=0,c=d.length;c>b;b++)a=d[b],a.onNext(e),a.onCompleted();else for(b=0,c=d.length;c>b;b++)d[b].onCompleted();this.observers=[]}},onError:function(a){if(h.call(this),!this.isStopped){var b=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var c=0,d=b.length;d>c;c++)b[c].onError(a);this.observers=[]}},onNext:function(a){h.call(this),this.isStopped||(this.value=a,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),c}(Ib);var Yb=function(a){function b(a){return this.observable.subscribe(a)}function c(c,d){a.call(this,b),this.observer=c,this.observable=d}return T(c,a),U(c.prototype,Ab,{onCompleted:function(){this.observer.onCompleted()},onError:function(a){this.observer.onError(a)},onNext:function(a){this.observer.onNext(a)}}),c}(Ib);"function"==typeof define&&"object"==typeof define.amd&&define.amd?(t.Rx=z,define(function(){return z})):u&&v?w?(v.exports=z).Rx=z:u.Rx=z:t.Rx=z}).call(this); |
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. | ||
(function (root, factory) { | ||
var freeExports = typeof exports == 'object' && exports, | ||
freeModule = typeof module == 'object' && module && module.exports == freeExports && module, | ||
freeGlobal = typeof global == 'object' && global; | ||
if (freeGlobal.global === freeGlobal) { | ||
window = freeGlobal; | ||
(function (factory) { | ||
var objectTypes = { | ||
'boolean': false, | ||
'function': true, | ||
'object': true, | ||
'number': false, | ||
'string': false, | ||
'undefined': false | ||
}; | ||
var root = (objectTypes[typeof window] && window) || this, | ||
freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports, | ||
freeModule = objectTypes[typeof module] && module && !module.nodeType && module, | ||
moduleExports = freeModule && freeModule.exports === freeExports && freeExports, | ||
freeGlobal = objectTypes[typeof global] && global; | ||
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) { | ||
root = freeGlobal; | ||
} | ||
@@ -22,3 +34,3 @@ | ||
} | ||
}(this, function (global, exp, Rx, undefined) { | ||
}.call(this, function (root, exp, Rx, undefined) { | ||
@@ -25,0 +37,0 @@ // Defaults |
@@ -1,1 +0,1 @@ | ||
(function(t,e){var n="object"==typeof exports&&exports,r=("object"==typeof module&&module&&module.exports==n&&module,"object"==typeof global&&global);r.global===r&&(window=r),"function"==typeof define&&define.amd?define(["rx","exports"],function(n,r){return t.Rx=e(t,r,n),t.Rx}):"object"==typeof module&&module&&module.exports===n?module.exports=e(t,module.exports,require("./rx")):t.Rx=e(t,{},t.Rx)})(this,function(t,e,n){function r(t,e){return m(t,e)}function i(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:b.call(t)}function o(t){this.predicate=t}function s(t){this.predicate=t}var u=n.Observer,c=n.Observable,a=n.Notification,h=n.VirtualTimeScheduler,l=n.Disposable,f=l.empty,p=l.create,d=n.CompositeDisposable,b=(n.SingleAssignmentDisposable,Array.prototype.slice),v=n.Internals.inherits,m=n.Internals.isEqual;o.prototype.equals=function(t){return t===this?!0:null==t?!1:"N"!==t.kind?!1:this.predicate(t.value)},s.prototype.equals=function(t){return t===this?!0:null==t?!1:"E"!==t.kind?!1:this.predicate(t.exception)};var y=n.ReactiveTest={created:100,subscribed:200,disposed:1e3,onNext:function(t,e){return"function"==typeof e?new g(t,new o(e)):new g(t,a.createOnNext(e))},onError:function(t,e){return"function"==typeof e?new g(t,new s(e)):new g(t,a.createOnError(e))},onCompleted:function(t){return new g(t,a.createOnCompleted())},subscribe:function(t,e){return new w(t,e)}},g=n.Recorded=function(t,e,n){this.time=t,this.value=e,this.comparer=n||r};g.prototype.equals=function(t){return this.time===t.time&&this.comparer(this.value,t.value)},g.prototype.toString=function(){return""+this.value+"@"+this.time};var w=n.Subscription=function(t,e){this.subscribe=t,this.unsubscribe=e||Number.MAX_VALUE};w.prototype.equals=function(t){return this.subscribe===t.subscribe&&this.unsubscribe===t.unsubscribe},w.prototype.toString=function(){return"("+this.subscribe+", "+this.unsubscribe===Number.MAX_VALUE?"Infinite":this.unsubscribe+")"};var x=n.MockDisposable=function(t){this.scheduler=t,this.disposes=[],this.disposes.push(this.scheduler.clock)};x.prototype.dispose=function(){this.disposes.push(this.scheduler.clock)};var E=function(t){function e(e){t.call(this),this.scheduler=e,this.messages=[]}v(e,t);var n=e.prototype;return n.onNext=function(t){this.messages.push(new g(this.scheduler.clock,a.createOnNext(t)))},n.onError=function(t){this.messages.push(new g(this.scheduler.clock,a.createOnError(t)))},n.onCompleted=function(){this.messages.push(new g(this.scheduler.clock,a.createOnCompleted()))},e}(u),C=function(t){function e(t){var e=this;this.observers.push(t),this.subscriptions.push(new w(this.scheduler.clock));var n=this.subscriptions.length-1;return p(function(){var r=e.observers.indexOf(t);e.observers.splice(r,1),e.subscriptions[n]=new w(e.subscriptions[n].subscribe,e.scheduler.clock)})}function n(n,r){t.call(this,e);var i,o,s=this;this.scheduler=n,this.messages=r,this.subscriptions=[],this.observers=[];for(var u=0,c=this.messages.length;c>u;u++)i=this.messages[u],o=i.value,function(t){n.scheduleAbsoluteWithState(null,i.time,function(){for(var e=0;s.observers.length>e;e++)t.accept(s.observers[e]);return f})}(o)}return v(n,t),n}(c),D=function(t){function e(t){var e,n,r=this;this.subscriptions.push(new w(this.scheduler.clock));for(var i=this.subscriptions.length-1,o=new d,s=0,u=this.messages.length;u>s;s++)e=this.messages[s],n=e.value,function(n){o.add(r.scheduler.scheduleRelativeWithState(null,e.time,function(){return n.accept(t),f}))}(n);return p(function(){r.subscriptions[i]=new w(r.subscriptions[i].subscribe,r.scheduler.clock),o.dispose()})}function n(n,r){t.call(this,e),this.scheduler=n,this.messages=r,this.subscriptions=[]}return v(n,t),n}(c);return n.TestScheduler=function(t){function e(t,e){return t>e?1:e>t?-1:0}function n(){t.call(this,0,e)}return v(n,t),n.prototype.scheduleAbsoluteWithState=function(e,n,r){return this.clock>=n&&(n=this.clock+1),t.prototype.scheduleAbsoluteWithState.call(this,e,n,r)},n.prototype.add=function(t,e){return t+e},n.prototype.toDateTimeOffset=function(t){return new Date(t).getTime()},n.prototype.toRelative=function(t){return t},n.prototype.startWithTiming=function(t,e,n,r){var i,o,s=this.createObserver();return this.scheduleAbsoluteWithState(null,e,function(){return i=t(),f}),this.scheduleAbsoluteWithState(null,n,function(){return o=i.subscribe(s),f}),this.scheduleAbsoluteWithState(null,r,function(){return o.dispose(),f}),this.start(),s},n.prototype.startWithDispose=function(t,e){return this.startWithTiming(t,y.created,y.subscribed,e)},n.prototype.startWithCreate=function(t){return this.startWithTiming(t,y.created,y.subscribed,y.disposed)},n.prototype.createHotObservable=function(){var t=i(arguments,0);return new C(this,t)},n.prototype.createColdObservable=function(){var t=i(arguments,0);return new D(this,t)},n.prototype.createObserver=function(){return new E(this)},n}(h),n}); | ||
(function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx","exports"],function(b,d){return c.Rx=a(c,d,b),c.Rx}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c){function d(a,b){return r(a,b)}function e(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:p.call(a)}function f(a){this.predicate=a}function g(a){this.predicate=a}var h=c.Observer,i=c.Observable,j=c.Notification,k=c.VirtualTimeScheduler,l=c.Disposable,m=l.empty,n=l.create,o=c.CompositeDisposable,p=(c.SingleAssignmentDisposable,Array.prototype.slice),q=c.Internals.inherits,r=c.Internals.isEqual;f.prototype.equals=function(a){return a===this?!0:null==a?!1:"N"!==a.kind?!1:this.predicate(a.value)},g.prototype.equals=function(a){return a===this?!0:null==a?!1:"E"!==a.kind?!1:this.predicate(a.exception)};var s=c.ReactiveTest={created:100,subscribed:200,disposed:1e3,onNext:function(a,b){return"function"==typeof b?new t(a,new f(b)):new t(a,j.createOnNext(b))},onError:function(a,b){return"function"==typeof b?new t(a,new g(b)):new t(a,j.createOnError(b))},onCompleted:function(a){return new t(a,j.createOnCompleted())},subscribe:function(a,b){return new u(a,b)}},t=c.Recorded=function(a,b,c){this.time=a,this.value=b,this.comparer=c||d};t.prototype.equals=function(a){return this.time===a.time&&this.comparer(this.value,a.value)},t.prototype.toString=function(){return this.value.toString()+"@"+this.time};var u=c.Subscription=function(a,b){this.subscribe=a,this.unsubscribe=b||Number.MAX_VALUE};u.prototype.equals=function(a){return this.subscribe===a.subscribe&&this.unsubscribe===a.unsubscribe},u.prototype.toString=function(){return"("+this.subscribe+", "+this.unsubscribe===Number.MAX_VALUE?"Infinite":this.unsubscribe+")"};var v=c.MockDisposable=function(a){this.scheduler=a,this.disposes=[],this.disposes.push(this.scheduler.clock)};v.prototype.dispose=function(){this.disposes.push(this.scheduler.clock)};var w=function(a){function b(b){a.call(this),this.scheduler=b,this.messages=[]}q(b,a);var c=b.prototype;return c.onNext=function(a){this.messages.push(new t(this.scheduler.clock,j.createOnNext(a)))},c.onError=function(a){this.messages.push(new t(this.scheduler.clock,j.createOnError(a)))},c.onCompleted=function(){this.messages.push(new t(this.scheduler.clock,j.createOnCompleted()))},b}(h),x=function(a){function b(a){var b=this;this.observers.push(a),this.subscriptions.push(new u(this.scheduler.clock));var c=this.subscriptions.length-1;return n(function(){var d=b.observers.indexOf(a);b.observers.splice(d,1),b.subscriptions[c]=new u(b.subscriptions[c].subscribe,b.scheduler.clock)})}function c(c,d){a.call(this,b);var e,f,g=this;this.scheduler=c,this.messages=d,this.subscriptions=[],this.observers=[];for(var h=0,i=this.messages.length;i>h;h++)e=this.messages[h],f=e.value,function(a){c.scheduleAbsoluteWithState(null,e.time,function(){for(var b=0;b<g.observers.length;b++)a.accept(g.observers[b]);return m})}(f)}return q(c,a),c}(i),y=function(a){function b(a){var b,c,d=this;this.subscriptions.push(new u(this.scheduler.clock));for(var e=this.subscriptions.length-1,f=new o,g=0,h=this.messages.length;h>g;g++)b=this.messages[g],c=b.value,function(c){f.add(d.scheduler.scheduleRelativeWithState(null,b.time,function(){return c.accept(a),m}))}(c);return n(function(){d.subscriptions[e]=new u(d.subscriptions[e].subscribe,d.scheduler.clock),f.dispose()})}function c(c,d){a.call(this,b),this.scheduler=c,this.messages=d,this.subscriptions=[]}return q(c,a),c}(i);return c.TestScheduler=function(a){function b(a,b){return a>b?1:b>a?-1:0}function c(){a.call(this,0,b)}return q(c,a),c.prototype.scheduleAbsoluteWithState=function(b,c,d){return c<=this.clock&&(c=this.clock+1),a.prototype.scheduleAbsoluteWithState.call(this,b,c,d)},c.prototype.add=function(a,b){return a+b},c.prototype.toDateTimeOffset=function(a){return new Date(a).getTime()},c.prototype.toRelative=function(a){return a},c.prototype.startWithTiming=function(a,b,c,d){var e,f,g=this.createObserver();return this.scheduleAbsoluteWithState(null,b,function(){return e=a(),m}),this.scheduleAbsoluteWithState(null,c,function(){return f=e.subscribe(g),m}),this.scheduleAbsoluteWithState(null,d,function(){return f.dispose(),m}),this.start(),g},c.prototype.startWithDispose=function(a,b){return this.startWithTiming(a,s.created,s.subscribed,b)},c.prototype.startWithCreate=function(a){return this.startWithTiming(a,s.created,s.subscribed,s.disposed)},c.prototype.createHotObservable=function(){var a=e(arguments,0);return new x(this,a)},c.prototype.createColdObservable=function(){var a=e(arguments,0);return new y(this,a)},c.prototype.createObserver=function(){return new w(this)},c}(k),c}); |
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. | ||
(function (root, factory) { | ||
var freeExports = typeof exports == 'object' && exports, | ||
freeModule = typeof module == 'object' && module && module.exports == freeExports && module, | ||
freeGlobal = typeof global == 'object' && global; | ||
if (freeGlobal.global === freeGlobal) { | ||
window = freeGlobal; | ||
(function (factory) { | ||
var objectTypes = { | ||
'boolean': false, | ||
'function': true, | ||
'object': true, | ||
'number': false, | ||
'string': false, | ||
'undefined': false | ||
}; | ||
var root = (objectTypes[typeof window] && window) || this, | ||
freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports, | ||
freeModule = objectTypes[typeof module] && module && !module.nodeType && module, | ||
moduleExports = freeModule && freeModule.exports === freeExports && freeExports, | ||
freeGlobal = objectTypes[typeof global] && global; | ||
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) { | ||
root = freeGlobal; | ||
} | ||
@@ -22,3 +34,3 @@ | ||
} | ||
}(this, function (global, exp, Rx, undefined) { | ||
}.call(this, function (root, exp, Rx, undefined) { | ||
@@ -25,0 +37,0 @@ // Refernces |
@@ -1,1 +0,1 @@ | ||
(function(t,e){var n="object"==typeof exports&&exports,r=("object"==typeof module&&module&&module.exports==n&&module,"object"==typeof global&&global);r.global===r&&(window=r),"function"==typeof define&&define.amd?define(["rx","exports"],function(n,r){return t.Rx=e(t,r,n),t.Rx}):"object"==typeof module&&module&&module.exports===n?module.exports=e(t,module.exports,require("./rx")):t.Rx=e(t,{},t.Rx)})(this,function(t,e,n,r){function i(t,e){return new p(function(n){return e.scheduleWithAbsolute(t,function(){n.onNext(0),n.onCompleted()})})}function o(t,e,n){var r=N(e);return new p(function(e){var i=0,o=t;return n.scheduleRecursiveWithAbsolute(o,function(t){var s;r>0&&(s=n.now(),o+=r,s>=o&&(o=s+r)),e.onNext(i++),t(o)})})}function s(t,e){var n=N(t);return new p(function(t){return e.scheduleWithRelative(n,function(){t.onNext(0),t.onCompleted()})})}function u(t,e,n){return t===e?new p(function(t){return n.schedulePeriodicWithState(0,e,function(e){return t.onNext(e),e+1})}):d(function(){return o(n.now()+t,e,n)})}function c(t,e){var n=this;return new p(function(r){var i,o=!1,s=new x,u=null,c=[],a=!1;return i=n.materialize().timestamp(e).subscribe(function(n){var i,l;"E"===n.value.kind?(c=[],c.push(n),u=n.value.exception,l=!a):(c.push({value:n.value,timestamp:n.timestamp+t}),l=!o,o=!0),l&&(null!==u?r.onError(u):(i=new g,s.setDisposable(i),i.setDisposable(e.scheduleRecursiveWithRelative(t,function(t){var n,i,s,l;if(null===u){a=!0;do s=null,c.length>0&&0>=c[0].timestamp-e.now()&&(s=c.shift().value),null!==s&&s.accept(r);while(null!==s);l=!1,i=0,c.length>0?(l=!0,i=Math.max(0,c[0].timestamp-e.now())):o=!1,n=u,a=!1,null!==n?r.onError(n):l&&t(i)}}))))}),new E(i,s)})}function a(t,e){var n=this;return d(function(){var r=t-e.now();return c.call(n,r,e)})}function l(t,e){return new p(function(n){function r(){s&&(s=!1,n.onNext(o)),i&&n.onCompleted()}var i,o,s;return new E(t.subscribe(function(t){s=!0,o=t},n.onError.bind(n),function(){i=!0}),e.subscribe(r,n.onError.bind(n),r))})}var h=n.Observable,f=h.prototype,p=n.Internals.AnonymousObservable,d=h.defer,b=h.empty,v=h.never,m=h.throwException,y=h.fromArray,w=n.Scheduler.timeout,g=n.SingleAssignmentDisposable,x=n.SerialDisposable,E=n.CompositeDisposable,C=n.RefCountDisposable,D=n.Subject,A=(n.Internals.BinaryObserver,n.Internals.addRef),N=n.Scheduler.normalize,S=h.interval=function(t,e){return e||(e=w),u(t,t,e)},O=h.timer=function(t,e,n){var c;return n||(n=w),e!==r&&"number"==typeof e?c=e:e!==r&&"object"==typeof e&&(n=e),t instanceof Date&&c===r?i(t.getTime(),n):t instanceof Date&&c!==r?(c=e,o(t.getTime(),c,n)):c===r?s(t,n):u(t,c,n)};return f.delay=function(t,e){return e||(e=w),t instanceof Date?a.call(this,t.getTime(),e):c.call(this,t,e)},f.throttle=function(t,e){return e||(e=w),this.throttleWithSelector(function(){return O(t,e)})},f.windowWithTime=function(t,e,n){var i,o=this;return e===r&&(i=t),n===r&&(n=w),"number"==typeof e?i=e:"object"==typeof e&&(i=t,n=e),new p(function(e){function r(){var t=new g,o=!1,s=!1;h.setDisposable(t),a===c?(o=!0,s=!0):c>a?o=!0:s=!0;var p=o?a:c,d=p-f;f=p,o&&(a+=i),s&&(c+=i),t.setDisposable(n.scheduleWithRelative(d,function(){var t;s&&(t=new D,l.push(t),e.onNext(A(t,u))),o&&(t=l.shift(),t.onCompleted()),r()}))}var s,u,c=i,a=t,l=[],h=new x,f=0;return s=new E(h),u=new C(s),l.push(new D),e.onNext(A(l[0],u)),r(),s.add(o.subscribe(function(t){var e,n;for(e=0;l.length>e;e++)n=l[e],n.onNext(t)},function(t){var n,r;for(n=0;l.length>n;n++)r=l[n],r.onError(t);e.onError(t)},function(){var t,n;for(t=0;l.length>t;t++)n=l[t],n.onCompleted();e.onCompleted()})),u})},f.windowWithTimeOrCount=function(t,e,n){var r=this;return n||(n=w),new p(function(i){var o,s,u,c,a=0,l=new x,h=0;return s=new E(l),u=new C(s),o=function(e){var r=new g;l.setDisposable(r),r.setDisposable(n.scheduleWithRelative(t,function(){var t;e===h&&(a=0,t=++h,c.onCompleted(),c=new D,i.onNext(A(c,u)),o(t))}))},c=new D,i.onNext(A(c,u)),o(0),s.add(r.subscribe(function(t){var n=0,r=!1;c.onNext(t),a++,a===e&&(r=!0,a=0,n=++h,c.onCompleted(),c=new D,i.onNext(A(c,u))),r&&o(n)},function(t){c.onError(t),i.onError(t)},function(){c.onCompleted(),i.onCompleted()})),u})},f.bufferWithTime=function(){return this.windowWithTime.apply(this,arguments).selectMany(function(t){return t.toArray()})},f.bufferWithTimeOrCount=function(t,e,n){return this.windowWithTimeOrCount(t,e,n).selectMany(function(t){return t.toArray()})},f.timeInterval=function(t){var e=this;return t||(t=w),d(function(){var n=t.now();return e.select(function(e){var r=t.now(),i=r-n;return n=r,{value:e,interval:i}})})},f.timestamp=function(t){return t||(t=w),this.select(function(e){return{value:e,timestamp:t.now()}})},f.sample=function(t,e){return e||(e=w),"number"==typeof t?l(this,S(t,e)):l(this,t)},f.timeout=function(t,e,n){var r,i=this;return e||(e=m(Error("Timeout"))),n||(n=w),r=t instanceof Date?function(t,e){n.scheduleWithAbsolute(t,e)}:function(t,e){n.scheduleWithRelative(t,e)},new p(function(n){var o,s=0,u=new g,c=new x,a=!1,l=new x;return c.setDisposable(u),o=function(){var i=s;l.setDisposable(r(t,function(){a=s===i;var t=a;t&&c.setDisposable(e.subscribe(n))}))},o(),u.setDisposable(i.subscribe(function(t){var e=!a;e&&(s++,n.onNext(t),o())},function(t){var e=!a;e&&(s++,n.onError(t))},function(){var t=!a;t&&(s++,n.onCompleted())})),new E(c,l)})},h.generateWithAbsoluteTime=function(t,e,n,i,o,s){return s||(s=w),new p(function(u){var c,a,l=!0,h=!1,f=t;return s.scheduleRecursiveWithAbsolute(s.now(),function(t){h&&u.onNext(c);try{l?l=!1:f=n(f),h=e(f),h&&(c=i(f),a=o(f))}catch(s){return u.onError(s),r}h?t(a):u.onCompleted()})})},h.generateWithRelativeTime=function(t,e,n,i,o,s){return s||(s=w),new p(function(u){var c,a,l=!0,h=!1,f=t;return s.scheduleRecursiveWithRelative(0,function(t){h&&u.onNext(c);try{l?l=!1:f=n(f),h=e(f),h&&(c=i(f),a=o(f))}catch(s){return u.onError(s),r}h?t(a):u.onCompleted()})})},f.delaySubscription=function(t,e){return e||(e=w),this.delayWithSelector(O(t,e),function(){return b()})},f.delayWithSelector=function(t,e){var n,i,o=this;return"function"==typeof t?i=t:(n=t,i=e),new p(function(t){var e=new E,s=!1,u=function(){s&&0===e.length&&t.onCompleted()},c=new x,a=function(){c.setDisposable(o.subscribe(function(n){var o;try{o=i(n)}catch(s){return t.onError(s),r}var c=new g;e.add(c),c.setDisposable(o.subscribe(function(){t.onNext(n),e.remove(c),u()},t.onError.bind(t),function(){t.onNext(n),e.remove(c),u()}))},t.onError.bind(t),function(){s=!0,c.dispose(),u()}))};return n?c.setDisposable(n.subscribe(function(){a()},t.onError.bind(t),function(){a()})):a(),new E(c,e)})},f.timeoutWithSelector=function(t,e,n){if(1===arguments.length){e=t;var t=v()}n||(n=m(Error("Timeout")));var i=this;return new p(function(o){var s=new x,u=new x,c=new g;s.setDisposable(c);var a=0,l=!1,h=function(t){var e=a,r=function(){return a===e},i=new g;u.setDisposable(i),i.setDisposable(t.subscribe(function(){r()&&s.setDisposable(n.subscribe(o)),i.dispose()},function(t){r()&&o.onError(t)},function(){r()&&s.setDisposable(n.subscribe(o))}))};h(t);var f=function(){var t=!l;return t&&a++,t};return c.setDisposable(i.subscribe(function(t){if(f()){o.onNext(t);var n;try{n=e(t)}catch(i){return o.onError(i),r}h(n)}},function(t){f()&&o.onError(t)},function(){f()&&o.onCompleted()})),new E(s,u)})},f.throttleWithSelector=function(t){var e=this;return new p(function(n){var i,o=!1,s=new x,u=0,c=e.subscribe(function(e){var c;try{c=t(e)}catch(a){return n.onError(a),r}o=!0,i=e,u++;var l=u,h=new g;s.setDisposable(h),h.setDisposable(c.subscribe(function(){o&&u===l&&n.onNext(i),o=!1,h.dispose()},n.onError.bind(n),function(){o&&u===l&&n.onNext(i),o=!1,h.dispose()}))},function(t){s.dispose(),n.onError(t),o=!1,u++},function(){s.dispose(),o&&n.onNext(i),n.onCompleted(),o=!1,u++});return new E(c,s)})},f.skipLastWithTime=function(t,e){e||(e=w);var n=this;return new p(function(r){var i=[];return n.subscribe(function(n){var o=e.now();for(i.push({interval:o,value:n});i.length>0&&o-i[0].interval>=t;)r.onNext(i.shift().value)},r.onError.bind(r),function(){for(var n=e.now();i.length>0&&n-i[0].interval>=t;)r.onNext(i.shift().value);r.onCompleted()})})},f.takeLastWithTime=function(t,e,n){return this.takeLastBufferWithTime(t,e).selectMany(function(t){return y(t,n)})},f.takeLastBufferWithTime=function(t,e){var n=this;return e||(e=w),new p(function(r){var i=[];return n.subscribe(function(n){var r=e.now();for(i.push({interval:r,value:n});i.length>0&&r-i[0].interval>=t;)i.shift()},r.onError.bind(r),function(){for(var n=e.now(),o=[];i.length>0;){var s=i.shift();t>=n-s.interval&&o.push(s.value)}r.onNext(o),r.onCompleted()})})},f.takeWithTime=function(t,e){var n=this;return e||(e=w),new p(function(r){var i=e.scheduleWithRelative(t,function(){r.onCompleted()});return new E(i,n.subscribe(r))})},f.skipWithTime=function(t,e){var n=this;return e||(e=w),new p(function(r){var i=!1,o=e.scheduleWithRelative(t,function(){i=!0}),s=n.subscribe(function(t){i&&r.onNext(t)},r.onError.bind(r),r.onCompleted.bind(r));return new E(o,s)})},f.skipUntilWithTime=function(t,e){e||(e=w);var n=this;return new p(function(r){var i=!1,o=e.scheduleWithAbsolute(t,function(){i=!0}),s=n.subscribe(function(t){i&&r.onNext(t)},r.onError.bind(r),r.onCompleted.bind(r));return new E(o,s)})},f.takeUntilWithTime=function(t,e){e||(e=w);var n=this;return new p(function(r){return new E(e.scheduleWithAbsolute(t,function(){r.onCompleted()}),n.subscribe(r))})},n}); | ||
(function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx","exports"],function(b,d){return c.Rx=a(c,d,b),c.Rx}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c,d){function e(a,b){return new n(function(c){return b.scheduleWithAbsolute(a,function(){c.onNext(0),c.onCompleted()})})}function f(a,b,c){var d=A(b);return new n(function(b){var e=0,f=a;return c.scheduleRecursiveWithAbsolute(f,function(a){var g;d>0&&(g=c.now(),f+=d,g>=f&&(f=g+d)),b.onNext(e++),a(f)})})}function g(a,b){var c=A(a);return new n(function(a){return b.scheduleWithRelative(c,function(){a.onNext(0),a.onCompleted()})})}function h(a,b,c){return a===b?new n(function(a){return c.schedulePeriodicWithState(0,b,function(b){return a.onNext(b),b+1})}):o(function(){return f(c.now()+a,b,c)})}function i(a,b){var c=this;return new n(function(d){var e,f=!1,g=new v,h=null,i=[],j=!1;return e=c.materialize().timestamp(b).subscribe(function(c){var e,k;"E"===c.value.kind?(i=[],i.push(c),h=c.value.exception,k=!j):(i.push({value:c.value,timestamp:c.timestamp+a}),k=!f,f=!0),k&&(null!==h?d.onError(h):(e=new u,g.setDisposable(e),e.setDisposable(b.scheduleRecursiveWithRelative(a,function(a){var c,e,g,k;if(null===h){j=!0;do g=null,i.length>0&&i[0].timestamp-b.now()<=0&&(g=i.shift().value),null!==g&&g.accept(d);while(null!==g);k=!1,e=0,i.length>0?(k=!0,e=Math.max(0,i[0].timestamp-b.now())):f=!1,c=h,j=!1,null!==c?d.onError(c):k&&a(e)}}))))}),new w(e,g)})}function j(a,b){var c=this;return o(function(){var d=a-b.now();return i.call(c,d,b)})}function k(a,b){return new n(function(c){function d(){g&&(g=!1,c.onNext(f)),e&&c.onCompleted()}var e,f,g;return new w(a.subscribe(function(a){g=!0,f=a},c.onError.bind(c),function(){e=!0}),b.subscribe(d,c.onError.bind(c),d))})}var l=c.Observable,m=l.prototype,n=c.Internals.AnonymousObservable,o=l.defer,p=l.empty,q=l.never,r=l.throwException,s=l.fromArray,t=c.Scheduler.timeout,u=c.SingleAssignmentDisposable,v=c.SerialDisposable,w=c.CompositeDisposable,x=c.RefCountDisposable,y=c.Subject,z=(c.Internals.BinaryObserver,c.Internals.addRef),A=c.Scheduler.normalize,B=l.interval=function(a,b){return b||(b=t),h(a,a,b)},C=l.timer=function(a,b,c){var i;return c||(c=t),b!==d&&"number"==typeof b?i=b:b!==d&&"object"==typeof b&&(c=b),a instanceof Date&&i===d?e(a.getTime(),c):a instanceof Date&&i!==d?(i=b,f(a.getTime(),i,c)):i===d?g(a,c):h(a,i,c)};return m.delay=function(a,b){return b||(b=t),a instanceof Date?j.call(this,a.getTime(),b):i.call(this,a,b)},m.throttle=function(a,b){return b||(b=t),this.throttleWithSelector(function(){return C(a,b)})},m.windowWithTime=function(a,b,c){var e,f=this;return b===d&&(e=a),c===d&&(c=t),"number"==typeof b?e=b:"object"==typeof b&&(e=a,c=b),new n(function(b){function d(){var a=new u,f=!1,g=!1;l.setDisposable(a),j===i?(f=!0,g=!0):i>j?f=!0:g=!0;var n=f?j:i,o=n-m;m=n,f&&(j+=e),g&&(i+=e),a.setDisposable(c.scheduleWithRelative(o,function(){var a;g&&(a=new y,k.push(a),b.onNext(z(a,h))),f&&(a=k.shift(),a.onCompleted()),d()}))}var g,h,i=e,j=a,k=[],l=new v,m=0;return g=new w(l),h=new x(g),k.push(new y),b.onNext(z(k[0],h)),d(),g.add(f.subscribe(function(a){var b,c;for(b=0;b<k.length;b++)c=k[b],c.onNext(a)},function(a){var c,d;for(c=0;c<k.length;c++)d=k[c],d.onError(a);b.onError(a)},function(){var a,c;for(a=0;a<k.length;a++)c=k[a],c.onCompleted();b.onCompleted()})),h})},m.windowWithTimeOrCount=function(a,b,c){var d=this;return c||(c=t),new n(function(e){var f,g,h,i,j=0,k=new v,l=0;return g=new w(k),h=new x(g),f=function(b){var d=new u;k.setDisposable(d),d.setDisposable(c.scheduleWithRelative(a,function(){var a;b===l&&(j=0,a=++l,i.onCompleted(),i=new y,e.onNext(z(i,h)),f(a))}))},i=new y,e.onNext(z(i,h)),f(0),g.add(d.subscribe(function(a){var c=0,d=!1;i.onNext(a),j++,j===b&&(d=!0,j=0,c=++l,i.onCompleted(),i=new y,e.onNext(z(i,h))),d&&f(c)},function(a){i.onError(a),e.onError(a)},function(){i.onCompleted(),e.onCompleted()})),h})},m.bufferWithTime=function(){return this.windowWithTime.apply(this,arguments).selectMany(function(a){return a.toArray()})},m.bufferWithTimeOrCount=function(a,b,c){return this.windowWithTimeOrCount(a,b,c).selectMany(function(a){return a.toArray()})},m.timeInterval=function(a){var b=this;return a||(a=t),o(function(){var c=a.now();return b.select(function(b){var d=a.now(),e=d-c;return c=d,{value:b,interval:e}})})},m.timestamp=function(a){return a||(a=t),this.select(function(b){return{value:b,timestamp:a.now()}})},m.sample=function(a,b){return b||(b=t),"number"==typeof a?k(this,B(a,b)):k(this,a)},m.timeout=function(a,b,c){var d,e=this;return b||(b=r(new Error("Timeout"))),c||(c=t),d=a instanceof Date?function(a,b){c.scheduleWithAbsolute(a,b)}:function(a,b){c.scheduleWithRelative(a,b)},new n(function(c){var f,g=0,h=new u,i=new v,j=!1,k=new v;return i.setDisposable(h),f=function(){var e=g;k.setDisposable(d(a,function(){j=g===e;var a=j;a&&i.setDisposable(b.subscribe(c))}))},f(),h.setDisposable(e.subscribe(function(a){var b=!j;b&&(g++,c.onNext(a),f())},function(a){var b=!j;b&&(g++,c.onError(a))},function(){var a=!j;a&&(g++,c.onCompleted())})),new w(i,k)})},l.generateWithAbsoluteTime=function(a,b,c,d,e,f){return f||(f=t),new n(function(g){var h,i,j=!0,k=!1,l=a;return f.scheduleRecursiveWithAbsolute(f.now(),function(a){k&&g.onNext(h);try{j?j=!1:l=c(l),k=b(l),k&&(h=d(l),i=e(l))}catch(f){return g.onError(f),void 0}k?a(i):g.onCompleted()})})},l.generateWithRelativeTime=function(a,b,c,d,e,f){return f||(f=t),new n(function(g){var h,i,j=!0,k=!1,l=a;return f.scheduleRecursiveWithRelative(0,function(a){k&&g.onNext(h);try{j?j=!1:l=c(l),k=b(l),k&&(h=d(l),i=e(l))}catch(f){return g.onError(f),void 0}k?a(i):g.onCompleted()})})},m.delaySubscription=function(a,b){return b||(b=t),this.delayWithSelector(C(a,b),function(){return p()})},m.delayWithSelector=function(a,b){var c,d,e=this;return"function"==typeof a?d=a:(c=a,d=b),new n(function(a){var b=new w,f=!1,g=function(){f&&0===b.length&&a.onCompleted()},h=new v,i=function(){h.setDisposable(e.subscribe(function(c){var e;try{e=d(c)}catch(f){return a.onError(f),void 0}var h=new u;b.add(h),h.setDisposable(e.subscribe(function(){a.onNext(c),b.remove(h),g()},a.onError.bind(a),function(){a.onNext(c),b.remove(h),g()}))},a.onError.bind(a),function(){f=!0,h.dispose(),g()}))};return c?h.setDisposable(c.subscribe(function(){i()},a.onError.bind(a),function(){i()})):i(),new w(h,b)})},m.timeoutWithSelector=function(a,b,c){if(1===arguments.length){b=a;var a=q()}c||(c=r(new Error("Timeout")));var d=this;return new n(function(e){var f=new v,g=new v,h=new u;f.setDisposable(h);var i=0,j=!1,k=function(a){var b=i,d=function(){return i===b},h=new u;g.setDisposable(h),h.setDisposable(a.subscribe(function(){d()&&f.setDisposable(c.subscribe(e)),h.dispose()},function(a){d()&&e.onError(a)},function(){d()&&f.setDisposable(c.subscribe(e))}))};k(a);var l=function(){var a=!j;return a&&i++,a};return h.setDisposable(d.subscribe(function(a){if(l()){e.onNext(a);var c;try{c=b(a)}catch(d){return e.onError(d),void 0}k(c)}},function(a){l()&&e.onError(a)},function(){l()&&e.onCompleted()})),new w(f,g)})},m.throttleWithSelector=function(a){var b=this;return new n(function(c){var d,e=!1,f=new v,g=0,h=b.subscribe(function(b){var h;try{h=a(b)}catch(i){return c.onError(i),void 0}e=!0,d=b,g++;var j=g,k=new u;f.setDisposable(k),k.setDisposable(h.subscribe(function(){e&&g===j&&c.onNext(d),e=!1,k.dispose()},c.onError.bind(c),function(){e&&g===j&&c.onNext(d),e=!1,k.dispose()}))},function(a){f.dispose(),c.onError(a),e=!1,g++},function(){f.dispose(),e&&c.onNext(d),c.onCompleted(),e=!1,g++});return new w(h,f)})},m.skipLastWithTime=function(a,b){b||(b=t);var c=this;return new n(function(d){var e=[];return c.subscribe(function(c){var f=b.now();for(e.push({interval:f,value:c});e.length>0&&f-e[0].interval>=a;)d.onNext(e.shift().value)},d.onError.bind(d),function(){for(var c=b.now();e.length>0&&c-e[0].interval>=a;)d.onNext(e.shift().value);d.onCompleted()})})},m.takeLastWithTime=function(a,b,c){return this.takeLastBufferWithTime(a,b).selectMany(function(a){return s(a,c)})},m.takeLastBufferWithTime=function(a,b){var c=this;return b||(b=t),new n(function(d){var e=[];return c.subscribe(function(c){var d=b.now();for(e.push({interval:d,value:c});e.length>0&&d-e[0].interval>=a;)e.shift()},d.onError.bind(d),function(){for(var c=b.now(),f=[];e.length>0;){var g=e.shift();c-g.interval<=a&&f.push(g.value)}d.onNext(f),d.onCompleted()})})},m.takeWithTime=function(a,b){var c=this;return b||(b=t),new n(function(d){var e=b.scheduleWithRelative(a,function(){d.onCompleted()});return new w(e,c.subscribe(d))})},m.skipWithTime=function(a,b){var c=this;return b||(b=t),new n(function(d){var e=!1,f=b.scheduleWithRelative(a,function(){e=!0}),g=c.subscribe(function(a){e&&d.onNext(a)},d.onError.bind(d),d.onCompleted.bind(d));return new w(f,g)})},m.skipUntilWithTime=function(a,b){b||(b=t);var c=this;return new n(function(d){var e=!1,f=b.scheduleWithAbsolute(a,function(){e=!0}),g=c.subscribe(function(a){e&&d.onNext(a)},d.onError.bind(d),d.onCompleted.bind(d));return new w(f,g)})},m.takeUntilWithTime=function(a,b){b||(b=t);var c=this;return new n(function(d){return new w(b.scheduleWithAbsolute(a,function(){d.onCompleted()}),c.subscribe(d))})},c}); |
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. | ||
(function (root, factory) { | ||
var freeExports = typeof exports == 'object' && exports, | ||
freeModule = typeof module == 'object' && module && module.exports == freeExports && module, | ||
freeGlobal = typeof global == 'object' && global; | ||
if (freeGlobal.global === freeGlobal) { | ||
window = freeGlobal; | ||
(function (factory) { | ||
var objectTypes = { | ||
'boolean': false, | ||
'function': true, | ||
'object': true, | ||
'number': false, | ||
'string': false, | ||
'undefined': false | ||
}; | ||
var root = (objectTypes[typeof window] && window) || this, | ||
freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports, | ||
freeModule = objectTypes[typeof module] && module && !module.nodeType && module, | ||
moduleExports = freeModule && freeModule.exports === freeExports && freeExports, | ||
freeGlobal = objectTypes[typeof global] && global; | ||
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) { | ||
root = freeGlobal; | ||
} | ||
@@ -22,3 +34,3 @@ | ||
} | ||
}(this, function (global, exp, Rx, undefined) { | ||
}.call(this, function (root, exp, Rx, undefined) { | ||
@@ -25,0 +37,0 @@ // Aliases |
@@ -1,1 +0,1 @@ | ||
(function(t,e){var n="object"==typeof exports&&exports,r=("object"==typeof module&&module&&module.exports==n&&module,"object"==typeof global&&global);r.global===r&&(window=r),"function"==typeof define&&define.amd?define(["rx","exports"],function(n,r){return t.Rx=e(t,r,n),t.Rx}):"object"==typeof module&&module&&module.exports===n?module.exports=e(t,module.exports,require("./rx")):t.Rx=e(t,{},t.Rx)})(this,function(t,e,n){function r(t,e){return t-e}var i=n.Scheduler,o=n.Internals.PriorityQueue,s=n.Internals.ScheduledItem,u=n.Internals.SchedulePeriodicRecursive,c=n.Disposable.empty,a=n.Internals.inherits;return n.VirtualTimeScheduler=function(t){function e(){throw Error("Not implemented")}function n(){return this.toDateTimeOffset(this.clock)}function r(t,e){return this.scheduleAbsoluteWithState(t,this.clock,e)}function i(t,e,n){return this.scheduleRelativeWithState(t,this.toRelative(e),n)}function l(t,e,n){return this.scheduleRelativeWithState(t,this.toRelative(e-this.now()),n)}function h(t,e){return e(),c}function f(e,s){this.clock=e,this.comparer=s,this.isEnabled=!1,this.queue=new o(1024),t.call(this,n,r,i,l)}a(f,t);var p=f.prototype;return p.add=e,p.toDateTimeOffset=e,p.toRelative=e,p.schedulePeriodicWithState=function(t,e,n){var r=new u(this,t,e,n);return r.start()},p.scheduleRelativeWithState=function(t,e,n){var r=this.add(this.clock,e);return this.scheduleAbsoluteWithState(t,r,n)},p.scheduleRelative=function(t,e){return this.scheduleRelativeWithState(e,t,h)},p.start=function(){var t;if(!this.isEnabled){this.isEnabled=!0;do t=this.getNext(),null!==t?(this.comparer(t.dueTime,this.clock)>0&&(this.clock=t.dueTime),t.invoke()):this.isEnabled=!1;while(this.isEnabled)}},p.stop=function(){this.isEnabled=!1},p.advanceTo=function(t){var e,n=this.comparer(this.clock,t);if(this.comparer(this.clock,t)>0)throw Error(argumentOutOfRange);if(0!==n&&!this.isEnabled){this.isEnabled=!0;do e=this.getNext(),null!==e&&0>=this.comparer(e.dueTime,t)?(this.comparer(e.dueTime,this.clock)>0&&(this.clock=e.dueTime),e.invoke()):this.isEnabled=!1;while(this.isEnabled);this.clock=t}},p.advanceBy=function(t){var e=this.add(this.clock,t),n=this.comparer(this.clock,e);if(n>0)throw Error(argumentOutOfRange);0!==n&&this.advanceTo(e)},p.sleep=function(t){var e=this.add(this.clock,t);if(this.comparer(this.clock,e)>=0)throw Error(argumentOutOfRange);this.clock=e},p.getNext=function(){for(var t;this.queue.length>0;){if(t=this.queue.peek(),!t.isCancelled())return t;this.queue.dequeue()}return null},p.scheduleAbsolute=function(t,e){return this.scheduleAbsoluteWithState(e,t,h)},p.scheduleAbsoluteWithState=function(t,e,n){var r=this,i=function(t,e){return r.queue.remove(o),n(t,e)},o=new s(r,t,i,e,r.comparer);return r.queue.enqueue(o),o.disposable},f}(i),n.HistoricalScheduler=function(t){function e(e,n){var i=null==e?0:e,o=n||r;t.call(this,i,o)}a(e,t);var n=e.prototype;return n.add=function(t,e){return t+e},n.toDateTimeOffset=function(t){return new Date(t).getTime()},n.toRelative=function(t){return t},e}(n.VirtualTimeScheduler),n}); | ||
(function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx","exports"],function(b,d){return c.Rx=a(c,d,b),c.Rx}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c){function d(a,b){return a-b}var e=c.Scheduler,f=c.Internals.PriorityQueue,g=c.Internals.ScheduledItem,h=c.Internals.SchedulePeriodicRecursive,i=c.Disposable.empty,j=c.Internals.inherits;return c.VirtualTimeScheduler=function(a){function b(){throw new Error("Not implemented")}function c(){return this.toDateTimeOffset(this.clock)}function d(a,b){return this.scheduleAbsoluteWithState(a,this.clock,b)}function e(a,b,c){return this.scheduleRelativeWithState(a,this.toRelative(b),c)}function k(a,b,c){return this.scheduleRelativeWithState(a,this.toRelative(b-this.now()),c)}function l(a,b){return b(),i}function m(b,g){this.clock=b,this.comparer=g,this.isEnabled=!1,this.queue=new f(1024),a.call(this,c,d,e,k)}j(m,a);var n=m.prototype;return n.add=b,n.toDateTimeOffset=b,n.toRelative=b,n.schedulePeriodicWithState=function(a,b,c){var d=new h(this,a,b,c);return d.start()},n.scheduleRelativeWithState=function(a,b,c){var d=this.add(this.clock,b);return this.scheduleAbsoluteWithState(a,d,c)},n.scheduleRelative=function(a,b){return this.scheduleRelativeWithState(b,a,l)},n.start=function(){var a;if(!this.isEnabled){this.isEnabled=!0;do a=this.getNext(),null!==a?(this.comparer(a.dueTime,this.clock)>0&&(this.clock=a.dueTime),a.invoke()):this.isEnabled=!1;while(this.isEnabled)}},n.stop=function(){this.isEnabled=!1},n.advanceTo=function(a){var b,c=this.comparer(this.clock,a);if(this.comparer(this.clock,a)>0)throw new Error(argumentOutOfRange);if(0!==c&&!this.isEnabled){this.isEnabled=!0;do b=this.getNext(),null!==b&&this.comparer(b.dueTime,a)<=0?(this.comparer(b.dueTime,this.clock)>0&&(this.clock=b.dueTime),b.invoke()):this.isEnabled=!1;while(this.isEnabled);this.clock=a}},n.advanceBy=function(a){var b=this.add(this.clock,a),c=this.comparer(this.clock,b);if(c>0)throw new Error(argumentOutOfRange);0!==c&&this.advanceTo(b)},n.sleep=function(a){var b=this.add(this.clock,a);if(this.comparer(this.clock,b)>=0)throw new Error(argumentOutOfRange);this.clock=b},n.getNext=function(){for(var a;this.queue.length>0;){if(a=this.queue.peek(),!a.isCancelled())return a;this.queue.dequeue()}return null},n.scheduleAbsolute=function(a,b){return this.scheduleAbsoluteWithState(b,a,l)},n.scheduleAbsoluteWithState=function(a,b,c){var d=this,e=function(a,b){return d.queue.remove(f),c(a,b)},f=new g(d,a,e,b,d.comparer);return d.queue.enqueue(f),f.disposable},m}(e),c.HistoricalScheduler=function(a){function b(b,c){var e=null==b?0:b,f=c||d;a.call(this,e,f)}j(b,a);var c=b.prototype;return c.add=function(a,b){return a+b},c.toDateTimeOffset=function(a){return new Date(a).getTime()},c.toRelative=function(a){return a},b}(c.VirtualTimeScheduler),c}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1321383
23648
324