Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding node.js components and updating documentation

  • Loading branch information...
commit ee74162fd0d599bd4cc98f5ba9b9bdc9c1f73068 1 parent 328e236
@mattpodwysocki mattpodwysocki authored
Showing with 7,030 additions and 6,913 deletions.
  1. +1 −0  license.md
  2. +26 −25 package.json
  3. +80 −0 readme.md
  4. +3,885 −3,872 rx-vsdoc.js
  5. +3,023 −3,010 rx.js
  6. +6 −6 rx.min.js
  7. +9 −0 rx.node.js
View
1  license.md
@@ -0,0 +1 @@
+<div class="inner"> <div class="Clear"> </div> <div class="BreadCrumb"><div class="BreadCrumbInner EyebrowContainer"><span class="EyebrowElement">Rx EULA</span> </div></div> <a name="MainContent"></a> <p><strong>MICROSOFT SOFTWARE LICENSE TERMS</strong></p><p><strong>MICROSOFT REACTIVE EXTENSIONS FOR JAVASCRIPT AND .NET LIBRARIES</strong></p><hr><p>These license terms are an agreement between Microsoft Corporation (or based on where you live, one of its affiliates) and you. Please read them. They apply to the software named above, which includes the media on which you received it, if any. The terms also apply to any Microsoft</p><ul><li>updates,</li><li>supplements,</li><li>Internet-based services, and</li><li>support services</li></ul><p>for this software, unless other terms accompany those items. If so, those terms apply.</p><p><strong>BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS. IF YOU DO NOT ACCEPT THEM, DO NOT USE THE SOFTWARE.</strong></p><hr><p><strong>If you comply with these license terms, you have the rights below.</strong></p><ol><li><strong>INSTALLATION AND USE RIGHTS.</strong> You may install and use any number of copies of the software on your devices to design, develop and test your programs.&nbsp;</li><li><strong>ADDITIONAL LICENSING REQUIREMENTS AND/OR USE RIGHTS.</strong></li><ol style="list-style-type: lower-alpha;"><li><strong>Distributable Code.</strong> The software contains code that you are permitted to distribute in programs you develop if you comply with the terms below.</li><ol style="list-style-type: lower-roman;"><li><strong>Right to Use and Distribute. The code and text files listed in the software REDIST.TXT files are "Distributable Code."</strong><ul><li><u>REDIST.TXT Files.</u> You may copy and distribute the object code form of the Distributable Code.&nbsp;You may also combine the object code form of the Distributable Code with your programs to develop a unified web solution and permit others via online methods to access and use that unified web solution, provided that the Distributable Code is only used as part of and in conjunction with your programs.</li><li><u>Third Party Distribution.</u> You may permit distributors of your programs to copy and distribute the Distributable Code as part of those programs.</li></ul></li><li><strong>Distributable Code Requirements. For any Distributable Code, you must</strong><ul><li>add significant primary functionality to it in your programs;</li><li>require distributors and external end users to agree to terms that protect it at least as much as this agreement;</li><li>display your valid copyright notice on your programs; and</li><li>indemnify, defend, and hold harmless Microsoft from any claims, including attorneys’ fees, related to the distribution or use of your programs.</li></ul></li><li><strong>Distributable Code Restrictions. You may not</strong><ul><li>alter any copyright, trademark or patent notice in the Distributable Code;</li><li>use Microsoft’s trademarks in your programs’ names or in a way that suggests your programs come from or are endorsed by Microsoft;</li><li>include Distributable Code in malicious, deceptive or unlawful programs; or</li><li>modify or distribute the source code of any Distributable Code so that any part of it becomes subject to an Excluded License. An Excluded License is one that requires, as a condition of use, modification or distribution, that</li><ul><li>the code be disclosed or distributed in source code form; or</li><li>others have the right to modify it.</li></ul></ul></li></ol></ol><li><strong>SCOPE OF LICENSE.</strong> The software is licensed, not sold. This agreement only gives you some rights to use the software. Microsoft reserves all other rights. Unless applicable law gives you more rights despite this limitation, you may use the software only as expressly permitted in this agreement. In doing so, you must comply with any technical limitations in the software that only allow you to use it in certain ways. You may not <ul><li>work around any technical limitations in the software;</li><li>reverse engineer, decompile or disassemble the software, except and only to the extent that applicable law expressly permits, despite this limitation;</li><li>make more copies of the software than specified in this agreement or allowed by applicable law, despite this limitation;</li><li>publish the software for others to copy;</li><li>rent, lease or lend the software;</li><li>transfer the software or this agreement to any third party; or</li><li>use the software for commercial software hosting services except as expressly provided above.</li></ul></li><li><strong>BACKUP COPY.</strong> You may make one backup copy of the software. You may use it only to reinstall the software.</li><li><strong>DOCUMENTATION.</strong> Any person that has valid access to your computer or internal network may copy and use the documentation for your internal, reference purposes.</li><li><strong>EXPORT RESTRICTIONS.</strong> The software is subject to United States export laws and regulations. You must comply with all domestic and international export laws and regulations that apply to the software. These laws include restrictions on destinations, end users and end use. For additional information, see www.microsoft.com/exporting.</li><li><strong>SUPPORT SERVICES.</strong> Because this software is “as is,” we may not provide support services for it.</li><li><strong>ENTIRE AGREEMENT.</strong> This agreement, and the terms for supplements, updates, Internet-based services and support services that you use, are the entire agreement for the software and support services.</li><li><strong>APPLICABLE LAW.</strong></li><ol style="list-style-type: lower-latin;"><li><strong>United States.</strong>If you acquired the software in the United States, Washington state law governs the interpretation of this agreement and applies to claims for breach of it, regardless of conflict of laws principles. The laws of the state where you live govern all other claims, including claims under state consumer protection laws, unfair competition laws, and in tort.</li><li><strong>Outside the United States.</strong> If you acquired the software in any other country, the laws of that country apply.</li></ol><li><strong>LEGAL EFFECT.</strong> This agreement describes certain legal rights. You may have other rights under the laws of your country. You may also have rights with respect to the party from whom you acquired the software. This agreement does not change your rights under the laws of your country if the laws of your country do not permit it to do so.</li><li><strong>DISCLAIMER OF WARRANTY. THE SOFTWARE IS LICENSED “AS-IS.” YOU BEAR THE RISK OF USING IT. MICROSOFT GIVES NO EXPRESS WARRANTIES, GUARANTEES OR CONDITIONS. YOU MAY HAVE ADDITIONAL CONSUMER RIGHTS UNDER YOUR LOCAL LAWS WHICH THIS AGREEMENT CANNOT CHANGE. TO THE EXTENT PERMITTED UNDER YOUR LOCAL LAWS, MICROSOFT EXCLUDES THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.</strong></li><li><strong>LIMITATION ON AND EXCLUSION OF REMEDIES AND DAMAGES. YOU CAN RECOVER FROM MICROSOFT AND ITS SUPPLIERS ONLY DIRECT DAMAGES UP TO U.S. $5.00. YOU CANNOT RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL, LOST PROFITS, SPECIAL, INDIRECT OR INCIDENTAL DAMAGES.</strong></li></ol><p style="padding-left: 30px;">This limitation applies to</p><ul style="padding-left: 40px;"><li>anything related to the software, services, content (including code) on third party Internet sites, or third party programs; and</li><li>claims for breach of contract, breach of warranty, guarantee or condition, strict liability, negligence, or other tort to the extent permitted by applicable law.</li></ul><p style="padding-left: 30px;">It also applies even if Microsoft knew or should have known about the possibility of the damages. The above limitation or exclusion may not apply to you because your country may not allow the exclusion or limitation of incidental, consequential or other damages.</p><p><strong>Please note: As this software is distributed in Quebec, Canada, some of the clauses in this agreement are provided below in French.</strong></p><p><strong>Remarque: Ce logiciel étant distribué au Québec, Canada, certaines des clauses dans ce contrat sont fournies ci-dessous en français.</strong></p><p><strong>EXONÉRATION DE GARANTIE.</strong> Le logiciel visé par une licence est offert « tel quel ». Toute utilisation de ce logiciel est à votre seule risque et péril. Microsoft n’accorde aucune autre garantie expresse. Vous pouvez bénéficier de droits additionnels en vertu du droit local sur la protection des consommateurs, que ce contrat ne peut modifier. La ou elles sont permises par le droit locale, les garanties implicites de qualité marchande, d’adéquation à un usage particulier et d’absence de contrefaçon sont exclues.</p><p><strong>LIMITATION DES DOMMAGES-INTÉRÊTS ET EXCLUSION DE RESPONSABILITÉ POUR LES DOMMAGES.</strong> Vous pouvez obtenir de Microsoft et de ses fournisseurs une indemnisation en cas de dommages directs uniquement à hauteur de 5,00 $ US. Vous ne pouvez prétendre à aucune indemnisation pour les autres dommages, y compris les dommages spéciaux, indirects ou accessoires et pertes de bénéfices.</p><p>Cette limitation concerne:</p><ul><li>tout ce qui est relié au logiciel, aux services ou au contenu (y compris le code) figurant sur des sites Internet tiers ou dans des programmes tiers; et</li><li>les réclamations au titre de violation de contrat ou de garantie, ou au titre de responsabilité stricte, de négligence ou d’une autre faute dans la limite autorisée par la loi en vigueur.</li></ul><p>Elle s’applique également, même si Microsoft connaissait ou devrait connaître l’éventualité d’un tel dommage. Si votre pays n’autorise pas l’exclusion ou la limitation de responsabilité pour les dommages indirects, accessoires ou de quelque nature que ce soit, il se peut que la limitation ou l’exclusion ci-dessus ne s’appliquera pas à votre égard.</p><p><strong>EFFET JURIDIQUE.</strong> Le présent contrat décrit certains droits juridiques. Vous pourriez avoir d’autres droits prévus par les lois de votre pays. Le présent contrat ne modifie pas les droits que vous confèrent les lois de votre pays si celles-ci ne le permettent pas.</p></div> </div> </div>
View
51 package.json
@@ -1,26 +1,27 @@
-{
- "name": "rxjs",
- "title": "Reactive Extensions for JavaScript (RxJS)",
- "description": "Library for composing asynchronous and event-based operations in JavaScript",
- "version": "2",
- "homepage": "http://msdn.microsoft.com/en-us/data/gg577609.aspx",
- "author": {
- "name": "Cloud Programmability Team",
- "url": "https://github.com/Reactive-Extensions/Rx.JS/blob/master/AUTHORS.txt"
- },
- "repository": {
- "type": "git",
- "url": "https://github.com/Reactive-Extensions/Rx.JS.git"
- },
- "licenses": [
- {
- "type": "MIT",
- "url": "https://github.com/Reactive-Extensions/Rx.JS/blob/master/license.txt"
- }
- ],
- "dependencies": {},
- "devDependencies": {
- "grunt": "~0.3.9"
- },
- "keywords": []
+{
+ "name": "rx",
+ "title": "Reactive Extensions for JavaScript (RxJS)",
+ "description": "Library for composing asynchronous and event-based operations in JavaScript",
+ "version": "2.0.0",
+ "homepage": "http://msdn.microsoft.com/en-us/data/gg577609.aspx",
+ "author": {
+ "name": "Cloud Programmability Team",
+ "url": "https://github.com/Reactive-Extensions/RxJS/blob/master/authors.txt"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/Reactive-Extensions/RxJS.git"
+ },
+ "licenses": [
+ {
+ "type": "MICROSOFT REACTIVE EXTENSIONS FOR JAVASCRIPT AND .NET LIBRARIES",
+ "url": "https://github.com/Reactive-Extensions/RxJS/blob/master/license.txt"
+ }
+ ],
+ "dependencies": {},
+ "devDependencies": {
+ "grunt": "~0.3.9"
+ },
+ "keywords": [],
+ "main": "rx.node.js"
}
View
80 readme.md
@@ -0,0 +1,80 @@
+# RxJS - Reactive Extensions for JavaScript #
+
+----------
+
+The Reactive Extensions for JavaScript (RxJS) are a set of libraries for composing and coordinating asynchronous and event-based programming that works across many JavaScript runtimes including all browsers and Node.js.
+
+This set of libraries include:
+
+- **rx.js** - Core library
+- **rx.aggregates.js** - aggregation event processing query operations
+- **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.testing.js** - used to write unit tests for complex event processing queries.
+- **rx.time.js** - time-based event processing query operations.
+
+
+## Installation and Usage ##
+
+----------
+There are multiple ways of getting started with the Reactive Extensions including:
+
+In a Browser:
+
+ <script src="rx.js><script>
+
+Along with a number of our extras for RxJS:
+
+ <script src="rx.aggregates.js><script>
+ <script src="rx.binding.js><script>
+ <script src="rx.coincidencejs><script>
+ <script src="rx.experimental.js><script>
+ <script src="rx.joinpatterns.js><script>
+ <script src="rx.testing.js><script>
+ <script src="rx.time.js><script>
+
+Installing via NPM:
+
+ npm install rxjs
+ npm install -g rxjs
+
+Using in Node.js:
+
+ var Rx = require('rx');
+
+Installing all of RxJS via NuGet:
+
+ Install-Package RxJS-All
+
+Or install via NuGet individual packages:
+
+ Install-Package RxJS-Main
+ Install-Package RxJS-Aggregates
+ Install-Package RxJS-Binding
+ Install-Package RxJS-Coincidence
+ Install-Package RxJS-Experimental
+ Install-Package RxJS-JoinPatterns
+ Install-Package RxJS-Testing
+ Install-Package RxJS-Time
+
+Using RxJS with an AMD loader such as Require.js
+
+ require({
+ 'paths': {
+ 'rx': 'path/to/rx.js'
+ }
+ },
+ ['rx'], function(Rx) {
+ var obs = Rx.Observable.returnValue(42);
+ obs.subscribe(function (x) { console.log(x); });
+ });
+
+## License ##
+
+----------
+
+Source files are licensed under the [Microsoft Reference Source License (MS-RSL)](http://referencesource.microsoft.com/referencesourcelicense.aspx)
+
+Minimized files are licensed under the [Reactive Extensions for .NET and JavaScript License](https://github.com/Reactive-Extensions/RxJS/blob/master/license.txt).
View
7,757 rx-vsdoc.js
3,885 additions, 3,872 deletions not shown
View
6,033 rx.js
3,023 additions, 3,010 deletions not shown
View
12 rx.min.js
@@ -1,6 +1,6 @@
-/*** @preserve Copyright (c) Microsoft Corporation. All rights reserved.
-* This code is licensed by Microsoft Corporation under the terms
-* of the MICROSOFT REACTIVE EXTENSIONS FOR JAVASCRIPT AND .NET LIBRARIES License.
-* See http://go.microsoft.com/fwlink/?LinkID=220762.
-*/
-(function(e,t){function i(){}function s(e){return e}function o(){return(new Date).getTime()}function u(e,t){return e===t}function a(e,t){return e-t}function f(e){return e.toString()}function l(e){throw e}function d(){if(this.isDisposed)throw new Error(p)}function m(e,t){return e.length===1&&Array.isArray(e[t])?e[t]:v.call(e)}function E(e,t){var n=new Array(e);for(var r=0;r<e;r++)n[r]=t();return n}function _(e,t){this.scheduler=e,this.disposable=t,this.isDisposed=!1}function D(e,t,n,r,i){this.scheduler=e,this.state=t,this.action=n,this.dueTime=r,this.comparer=i||a,this.disposable=new A}function ht(e,t){return new bt(function(n){var r=new A,i=new O;return i.setDisposable(r),r.setDisposable(e.subscribe(n.onNext.bind(n),function(e){var r,s;try{s=t(e)}catch(o){n.onError(o);return}r=new A,i.setDisposable(r),r.setDisposable(s.subscribe(n))},n.onCompleted.bind(n))),i})}function gt(e,t){var n=this;return new bt(function(r){var i=0,s=e.length;return n.subscribe(function(n){if(i<s){var o=e[i++],u;try{u=t(n,o)}catch(a){r.onError(a);return}r.onNext(u)}else r.onCompleted()},r.onError.bind(r),r.onCompleted.bind(r))})}function yt(e){return this.select(e).mergeObservable()}var n=typeof exports=="object"&&exports&&(typeof global=="object"&&global&&global==global.global&&(e=global),exports),r={Internals:{}},c="Sequence contains no elements.",h="Argument out of range",p="Object has been disposed";Function.prototype.bind||(Function.prototype.bind=function(e){var t=this,n=v.call(arguments,1),r=function(){if(this instanceof r){function e(){}e.prototype=t.prototype;var i=new e,s=t.apply(i,n.concat(v.call(arguments)));return Object(s)===s?s:i}return t.apply(that,n.concat(v.call(arguments)))};return r});var v=Array.prototype.slice,g={}.hasOwnProperty,y=r.Internals.inherits=function(e,t){function r(){this.constructor=e}for(var n in t)n!=="prototype"&&g.call(t,n)&&(e[n]=t[n]);return r.prototype=t.prototype,e.prototype=new r,e.super_=t.prototype,e},b=r.Internals.addProperties=function(e){var t=v.call(arguments,1);for(var n=0,r=t.length;n<r;n++){var i=t[n];for(var s in i)e[s]=i[s]}},w=r.Internals.addRef=function(e,t){return new bt(function(n){return new N(t.getDisposable(),e.subscribe(n))})};Array.prototype.every||(Array.prototype.every=function(e){var t=new Object(this);for(var n=0,r=t.length>>>0;n<r;n++)if(n in t&&!e.call(arguments[1],t[n],n,t))return!1;return!0}),Array.prototype.map||(Array.prototype.map=function(e){var t=[],n=new Object(this);for(var r=0,i=n.length>>>0;r<i;r++)r in n&&t.push(e.call(arguments[1],n[r],r,n));return t}),Array.prototype.filter||(Array.prototype.filter=function(e){var t=[],n,r=new Object(this);for(var i=0,s=r.length>>>0;i<s;i++)n=r[i],i in r&&e.call(arguments[1],n,i,r)&&t.push(n);return t}),Array.isArray||(Array.isArray=function(e){return Object.prototype.toString.call(e)=="[object Array]"}),Array.prototype.indexOf||(Array.prototype.indexOf=function(t){var n=new Object(this),r=n.length>>>0;if(!r)return-1;var i=0;arguments.length>1&&(i=arguments[1]),i=i>=0?i:Math.max(0,r+i);for(;i<r;i++)if(i in n&&n[i]===t)return i;return-1});var S=function(e,t){this.id=e,this.value=t};S.prototype.compareTo=function(e){var t=this.value.compareTo(e.value);return t===0&&(t=this.id-e.id),t};var x=function(e){this.items=new Array(e),this.length=0},T=x.prototype;T.isHigherPriority=function(e,t){return this.items[e].compareTo(this.items[t])<0},T.percolate=function(e){if(e>=this.length||e<0)return;var t=e-1>>1;if(t<0||t===e)return;if(this.isHigherPriority(e,t)){var n=this.items[e];this.items[e]=this.items[t],this.items[t]=n,this.percolate(t)}},T.heapify=function(e){e===t&&(e=0);if(e>=this.length||e<0)return;var n=2*e+1,r=2*e+2,i=e;n<this.length&&this.isHigherPriority(n,i)&&(i=n),r<this.length&&this.isHigherPriority(r,i)&&(i=r);if(i!==e){var s=this.items[e];this.items[e]=this.items[i],this.items[i]=s,this.heapify(i)}},T.peek=function(){return this.items[0].value},T.removeAt=function(e){this.items[e]=this.items[--this.length],delete this.items[this.length],this.heapify()},T.dequeue=function(){var e=this.peek();return this.removeAt(0),e},T.enqueue=function(e){var t=this.length++;this.items[t]=new S(x.count++,e),this.percolate(t)},T.remove=function(e){for(var t=0;t<this.length;t++)if(this.items[t].value===e)return this.removeAt(t),!0;return!1},x.count=0;var N=r.CompositeDisposable=function(){this.disposables=m(arguments,0),this.isDisposed=!1,this.length=this.disposables.length};N.prototype.add=function(e){this.isDisposed?e.dispose():(this.disposables.push(e),this.length++)},N.prototype.remove=function(e){var t=!1;if(!this.isDisposed){var n=this.disposables.indexOf(e);n!==-1&&(t=!0,this.disposables.splice(n,1),this.length--,e.dispose())}return t},N.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var e=this.disposables.slice(0);this.disposables=[],this.length=0;for(var t=0,n=e.length;t<n;t++)e[t].dispose()}},N.prototype.clear=function(){var e=this.disposables.slice(0);this.disposables=[],this.length=0;for(var t=0,n=e.length;t<n;t++)e[t].dispose()},N.prototype.contains=function(e){return this.disposables.indexOf(e)!==-1},N.prototype.toArray=function(){return this.disposables.slice(0)};var C=r.Disposable=function(e){this.isDisposed=!1,this.action=e};C.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var k=C.create=function(e){return new C(e)},L=C.empty={dispose:i},A=r.SingleAssignmentDisposable=function(){this.isDisposed=!1,this.current=null};A.prototype.disposable=function(e){return e?this.setDisposable(e):this.getDisposable()},A.prototype.getDisposable=function(){return this.current},A.prototype.setDisposable=function(e){if(this.current)throw new Error("Disposable has already been assigned");var t=this.isDisposed;t||(this.current=e),t&&e&&e.dispose()},A.prototype.dispose=function(){var e;this.isDisposed||(this.isDisposed=!0,e=this.current,this.current=null),e&&e.dispose()};var O=r.SerialDisposable=function(){this.isDisposed=!1,this.current=null};O.prototype.getDisposable=function(){return this.current},O.prototype.setDisposable=function(e){var t=this.isDisposed,n;t||(n=this.current,this.current=e),n&&n.dispose(),t&&e&&e.dispose()},O.prototype.disposable=function(e){if(!e)return this.getDisposable();this.setDisposable(e)},O.prototype.dispose=function(){var e;this.isDisposed||(this.isDisposed=!0,e=this.current,this.current=null),e&&e.dispose()};var M=r.RefCountDisposable=function(){function e(e){this.disposable=e,this.disposable.count++,this.isInnerDisposed=!1}function t(e){this.underlyingDisposable=e,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return e.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,this.disposable.count===0&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},t.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,this.count===0&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},t.prototype.getDisposable=function(){return this.isDisposed?L:new e(this)},t}();_.prototype.dispose=function(){var e=this;this.scheduler.schedule(function(){e.isDisposed||(e.isDisposed=!0,e.disposable.dispose())})},D.prototype.invoke=function(){this.disposable.disposable(this.invokeCore())},D.prototype.compareTo=function(e){return this.comparer(this.dueTime,e.dueTime)},D.prototype.isCancelled=function(){return this.disposable.isDisposed},D.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var P=r.Scheduler=function(){function t(e,t,n,r){this.now=e,this._schedule=t,this._scheduleRelative=n,this._scheduleAbsolute=r}function n(e,t){var n=t.first,r=t.second,i=new N,s=function(t){r(t,function(t){var n=!1,r=!1,o=e.scheduleWithState(t,function(e,t){return n?i.remove(o):r=!0,s(t),L});r||(i.add(o),n=!0)})};return s(n),i}function r(e,t,n){var r=t.first,i=t.second,s=new N,o=function(t){i(t,function(t,r){var i=!1,u=!1,a=e[n].call(e,t,r,function(e,t){return i?s.remove(a):u=!0,o(t),L});u||(s.add(a),i=!0)})};return o(r),s}function i(e,t){return t(),L}return b(t.prototype,{catchException:function(e){return new q(this,e)},schedulePeriodic:function(e,t){return this.schedulePeriodicWithState(null,e,function(){t()})},schedulePeriodicWithState:function(t,n,r){var i=t,s=e.setInterval(function(){i=r(i)},n);return k(function(){e.clearInterval(s)})},schedule:function(e){return this._schedule(e,i)},scheduleWithState:function(e,t){return this._schedule(e,t)},scheduleWithRelative:scheduleWithRelative=function(e,t){return this._scheduleRelative(t,e,i)},scheduleWithRelativeAndState:function(e,t,n){return this._scheduleRelative(e,t,n)},scheduleWithAbsolute:scheduleWithAbsolute=function(e,t){return this._scheduleAbsolute(t,e,i)},scheduleWithAbsoluteAndState:function(e,t,n){return this._scheduleAbsolute(e,t,n)},scheduleRecursive:function(e){return this.scheduleRecursiveWithState(e,function(e,t){e(function(){t(e)})})},scheduleRecursiveWithState:function(e,t){return this.scheduleWithState({first:e,second:t},function(e,t){return n(e,t)})},scheduleRecursiveWithRelative:function(e,t){return this.scheduleRecursiveWithRelativeAndState(t,e,function(e,t){e(function(n){t(e,n)})})},scheduleRecursiveWithRelativeAndState:function(e,t,n){return this._scheduleRelative({first:e,second:n},t,function(e,t){return r(e,t,"scheduleWithRelativeAndState")})},scheduleRecursiveWithAbsolute:function(e,t){return this.scheduleRecursiveWithAbsoluteAndState(t,e,function(e,t){e(function(n){t(e,n)})})},scheduleRecursiveWithAbsoluteAndState:function(e,t,n){return this._scheduleAbsolute({first:e,second:n},t,function(e,t){return r(e,t,"scheduleWithAbsoluteAndState")})}}),t.now=o,t.normalize=function(e){return e<0&&(e=0),e},t}(),H="Scheduler is not allowed to block the thread",B=P.immediate=function(){function e(e,t){return t(this,e)}function t(e,t,n){if(t>0)throw new Error(H);return n(this,e)}function n(e,t,n){return this.scheduleWithRelativeAndState(e,t-this.now(),n)}return new P(o,e,t,n)}(),j=P.currentThread=function(){function t(){e=new x(4)}function n(e,t){return this.scheduleWithRelativeAndState(e,0,t)}function r(n,r,i){var s=this.now()+P.normalize(r),o=new D(this,n,i,s),u;if(!e){u=new t;try{e.enqueue(o),u.run()}finally{u.dispose()}}else e.enqueue(o);return o.disposable}function i(e,t,n){return this.scheduleWithRelativeAndState(e,t-this.now(),n)}var e;t.prototype.dispose=function(){e=null},t.prototype.run=function(){var t;while(e.length>0){t=e.dequeue();if(!t.isCancelled()){while(t.dueTime-P.now()>0);t.isCancelled()||t.invoke()}}};var s=new P(o,n,r,i);return s.scheduleRequired=function(){return e===null},s.ensureTrampoline=function(t){return e===null?this.schedule(t):t()},s}(),F=function(){function e(e,t){t(0,this._period);try{this._state=this._action(this._state)}catch(n){throw this._cancel.dispose(),n}}function t(e,t,n,r){this._scheduler=e,this._state=t,this._period=n,this._action=r}return t.prototype.start=function(){var t=new A;return this._cancel=t,t.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,e.bind(this))),t},t}();r.VirtualTimeScheduler=function(){function e(){return this.toDateTimeOffset(this.clock)}function t(e,t){return this.scheduleAbsoluteWithState(e,this.clock,t)}function n(e,t,n){return this.scheduleRelativeWithState(e,this.toRelative(t),n)}function r(e,t,n){return this.scheduleRelativeWithState(e,this.toRelative(t-this.now()),n)}function i(e,t){return t(),L}function s(i,o){this.clock=i,this.comparer=o,this.isEnabled=!1,this.queue=new x(1024),s.super_.constructor.call(this,e,t,n,r)}return y(s,P),b(s.prototype,{schedulePeriodicWithState:function(e,t,n){var r=new F(this,e,t,n);return r.start()},scheduleRelativeWithState:function(e,t,n){var r=this.add(this.clock,t);return this.scheduleAbsoluteWithState(e,r,n)},scheduleRelative:function(e,t){return this.scheduleRelativeWithState(t,e,i)},start:function(){var e;if(!this.isEnabled){this.isEnabled=!0;do e=this.getNext(),e!==null?(this.comparer(e.dueTime,this.clock)>0&&(this.clock=e.dueTime),e.invoke()):this.isEnabled=!1;while(this.isEnabled)}},stop:function(){this.isEnabled=!1},advanceTo:function(e){var t;if(this.comparer(this.clock,e)>=0)throw new Error(h);if(!this.isEnabled){this.isEnabled=!0;do t=this.getNext(),t!==null&&this.comparer(t.dueTime,e)<=0?(this.comparer(t.dueTime,this.clock)>0&&(this.clock=t.dueTime),t.invoke()):this.isEnabled=!1;while(this.isEnabled);this.clock=e}},advanceBy:function(e){var t=this.add(this.clock,e);if(this.comparer(this.clock,t)>=0)throw new Error(h);return this.advanceTo(t)},sleep:function(e){var t=this.add(this.clock,e);if(this.comparer(this.clock,t)>=0)throw new Error(h);this.clock=t},getNext:function(){var e;while(this.queue.length>0){e=this.queue.peek();if(!e.isCancelled())return e;this.queue.dequeue()}return null},scheduleAbsolute:function(e,t){return this.scheduleAbsoluteWithState(t,e,i)},scheduleAbsoluteWithState:function(e,t,n){var r=this,i=function(e,t){return r.queue.remove(s),n(e,t)},s=new D(r,e,i,t,r.comparer);return r.queue.enqueue(s),s.disposable}}),s}();var I=P.timeout=function(){function u(e,t){var n=this,i=new A,o=r(function(){i.setDisposable(t(n,e))});return new N(i,k(function(){s(o)}))}function a(t,n,r){var i=this,s=P.normalize(n);if(s===0)return i.scheduleWithState(t,r);var o=new A,u=e.setTimeout(function(){o.setDisposable(r(i,t))},s);return new N(o,k(function(){e.clearTimeout(u)}))}function f(e,t,n){return this.scheduleWithRelativeAndState(e,t-this.now(),n)}var t=e.requestAnimationFrame||e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.oRequestAnimationFrame||e.msRequestAnimationFrame,n=e.cancelAnimationFrame||e.webkitCancelAnimationFrame||e.mozCancelAnimationFrame||e.oCancelAnimationFrame||e.msCancelAnimationFrame,r,s;return typeof e.process!="undefined"&&typeof e.process.nextTick=="function"?(r=e.process.nextTick,s=i):typeof e.setImmediate=="function"?(r=e.setImmediate,s=e.clearImmediate):typeof t=="function"?(r=t,s=n):(r=function(t){return e.setTimeout(t,0)},s=e.clearTimeout),new P(o,u,a,f)}(),q=function(){function e(){return this._scheduler.now()}function t(e,t){return this._scheduler.scheduleWithState(e,this._wrap(t))}function n(e,t,n){return this._scheduler.scheduleWithRelativeAndState(e,t,this._wrap(n))}function r(e,t,n){return this._scheduler.scheduleWithAbsoluteAndState(e,t,this._wrap(n))}function i(s,o){this._scheduler=s,this._handler=o,this._recursiveOriginal=null,this._recursiveWrapper=null,i.super_.constructor.call(this,e,t,n,r)}return y(i,P),i.prototype._clone=function(e){return new i(e,this._handler)},i.prototype._wrap=function(e){var t=this;return function(n,r){try{return e(t._getRecursiveWrapper(n),r)}catch(i){if(!t._handler(i))throw i;return L}}},i.prototype._getRecursiveWrapper=function(e){if(!this._recursiveOriginal!==e){this._recursiveOriginal=e;var t=this._clone(e);t._recursiveOriginal=e,t._recursiveWrapper=t,this._recursiveWrapper=t}return this._recursiveWrapper},i.prototype.schedulePeriodicWithState=function(e,t,n){var r=this,i=!1,s=new A;return s.setDisposable(this._scheduler.schedulePeriodicWithState(e,t,function(e){if(i)return null;try{return n(e)}catch(t){i=!0;if(!r._handler(t))throw t;return s.dispose(),null}})),s},i}(),R=r.Notification=function(){function e(){}return b(e.prototype,{accept:function(e,t,n){return arguments.length>1||typeof e=="function"?this._accept(e,t,n):this._acceptObservable(e)},toObservable:function(e){var t=this;return e=e||B,new bt(function(n){return e.schedule(function(){t._acceptObservable(n),t.kind==="N"&&n.onCompleted()})})},hasValue:!1,equals:function(e){var t=e==null?"":e.toString();return this.toString()===t}}),e}(),U=R.createOnNext=function(){function e(e){this.value=e,this.hasValue=!0,this.kind="N"}return y(e,R),b(e.prototype,{_accept:function(e){return e(this.value)},_acceptObservable:function(e){return e.onNext(this.value)},toString:function(){return"OnNext("+this.value+")"}}),function(t){return new e(t)}}(),z=R.createOnError=function(){function e(e){this.exception=e,this.kind="E"}return y(e,R),b(e.prototype,{_accept:function(e,t){return t(this.exception)},_acceptObservable:function(e){return e.onError(this.exception)},toString:function(){return"OnError("+this.exception+")"}}),function(t){return new e(t)}}(),W=R.createOnCompleted=function(){function e(){this.kind="C"}return y(e,R),b(e.prototype,{_accept:function(e,t,n){return n()},_acceptObservable:function(e){return e.onCompleted()},toString:function(){return"OnCompleted()"}}),function(){return new e}}(),X=r.Internals.Enumerator=function(e,t,n){this.moveNext=e,this.getCurrent=t,this.dispose=n},V=X.create=function(e,t,n){var r=!1;return n||(n=i),new X(function(){if(r)return!1;var t=e();return t||(r=!0,n()),t},function(){return t()},function(){r||(n(),r=!0)})},$=r.Internals.Enumerable=function(){function e(e){this.getEnumerator=e}return e.prototype.concat=function(){var e=this;return new bt(function(t){var n=e.getEnumerator(),r=!1,i=new O,s=B.scheduleRecursive(function(e){var s,o,u=!1;if(!!r)return;try{u=n.moveNext(),u?s=n.getCurrent():n.dispose()}catch(a){o=a,n.dispose()}if(o){t.onError(o);return}if(!u){t.onCompleted();return}var f=new A;i.setDisposable(f),f.setDisposable(s.subscribe(t.onNext.bind(t),t.onError.bind(t),function(){e()}))});return new N(i,s,k(function(){r=!0,n.dispose()}))})},e.prototype.catchException=function(){var e=this;return new bt(function(t){var n=e.getEnumerator(),r=!1,i,s=new O,o=B.scheduleRecursive(function(e){var o,u,a;a=!1;if(!!r)return;try{a=n.moveNext(),a&&(o=n.getCurrent())}catch(f){u=f}if(u){t.onError(u);return}if(!a){i?t.onError(i):t.onCompleted();return}var l=new A;s.setDisposable(l),l.setDisposable(o.subscribe(t.onNext.bind(t),function(t){i=t,e()},t.onCompleted.bind(t)))});return new N(s,o,k(function(){r=!0}))})},e}(),J=$.repeat=function(e,n){return n===t&&(n=-1),new $(function(){var t,r=n;return V(function(){return r===0?!1:(r>0&&r--,t=e,!0)},function(){return t})})},K=$.forEach=function(e,t){return t||(t=s),new $(function(){var n,r=-1;return V(function(){return++r<e.length?(n=t(e[r],r),!0):!1},function(){return n})})},Q=r.Observer=function(){};Q.prototype.toNotifier=function(){var e=this;return function(t){return t.accept(e)}},Q.prototype.asObserver=function(){return new Z(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},Q.prototype.checked=function(){return new et(this)};var G=Q.create=function(e,t,n){return e||(e=i),t||(t=l),n||(n=i),new Z(e,t,n)};Q.fromNotifier=function(e){return new Z(function(t){return e(U(t))},function(t){return e(z(t))},function(){return e(W())})};var Y=r.Internals.AbstractObserver=function(){function e(){this.isStopped=!1}return y(e,Q),e.prototype.onNext=function(e){this.isStopped||this.next(e)},e.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.error(e))},e.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},e.prototype.dispose=function(){this.isStopped=!0},e.prototype.fail=function(){return this.isStopped?!1:(this.isStopped=!0,this.error(!0),!0)},e}(),Z=r.AnonymousObserver=function(){function e(t,n,r){e.super_.constructor.call(this),this._onNext=t,this._onError=n,this._onCompleted=r}return y(e,Y),e.prototype.next=function(e){this._onNext(e)},e.prototype.error=function(e){this._onError(e)},e.prototype.completed=function(){this._onCompleted()},e}(),et=function(){function e(e){this._observer=e,this._state=0}return y(e,Q),e.prototype.onNext=function(e){this.checkAccess();try{this._observer.onNext(e)}finally{this._state=0}},e.prototype.onError=function(e){this.checkAccess();try{this._observer.onError(e)}finally{this._state=2}},e.prototype.onCompleted=function(){this.checkAccess();try{this._observer.onCompleted()}finally{this._state=2}},e.prototype.checkAccess=function(){if(this._state===1)throw new Error("Re-entrancy detected");if(this._state===2)throw new Error("Observer completed");this._state===0&&(this._state=1)},e}(),tt=r.Internals.ScheduledObserver=function(){function e(t,n){e.super_.constructor.call(this),this.scheduler=t,this.observer=n,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new O}return y(e,Y),e.prototype.next=function(e){var t=this;this.queue.push(function(){t.observer.onNext(e)})},e.prototype.error=function(e){var t=this;this.queue.push(function(){t.observer.onError(e)})},e.prototype.completed=function(){var e=this;this.queue.push(function(){e.observer.onCompleted()})},e.prototype.ensureActive=function(){var e=!1,t=this;!this.hasFaulted&&this.queue.length>0&&(e=!this.isAcquired,this.isAcquired=!0),e&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(e){var n;if(!(t.queue.length>0)){t.isAcquired=!1;return}n=t.queue.shift();try{n()}catch(r){throw t.queue=[],t.hasFaulted=!0,r}e()}))},e.prototype.dispose=function(){e.super_.dispose.call(this),this.disposable.dispose()},e}(),nt=function(){function e(){e.super_.constructor.apply(this,arguments)}return y(e,tt),e.prototype.next=function(t){e.super_.next.call(this,t),this.ensureActive()},e.prototype.error=function(t){e.super_.error.call(this,t),this.ensureActive()},e.prototype.completed=function(){e.super_.completed.call(this),this.ensureActive()},e}(),rt,it=r.Observable=function(){function e(e){this._subscribe=e}return rt=e.prototype,rt.finalValue=function(){var e=this;return new bt(function(t){var n=!1,r;return e.subscribe(function(e){n=!0,r=e},t.onError.bind(t),function(){n?(t.onNext(r),t.onCompleted()):t.onError(new Error(c))})})},rt.subscribe=function(e,t,n){var r;return arguments.length===0||arguments.length>1||typeof e=="function"?r=G(e,t,n):r=e,this._subscribe(r)},rt.toArray=function(){function e(e,t){return e.push(t),e.slice(0)}return this.scan([],e).startWith([]).finalValue()},e}();it.start=function(e,t,n){return st(e,t)()};var st=it.toAsync=function(e,t,n){return t||(t=I),function(){var r=v.call(arguments,0),i=new Tt;return t.schedule(function(){var t;try{t=e.apply(n,r)}catch(s){i.onError(s);return}i.onNext(t),i.onCompleted()}),i.asObservable()}};rt.observeOn=function(e){var t=this;return new bt(function(n){return t.subscribe(new nt(e,n))})},rt.subscribeOn=function(e){var t=this;return new bt(function(n){var r=new A,i=new O;return i.setDisposable(r),r.setDisposable(e.schedule(function(){i.setDisposable(new _(e,t.subscribe(n)))})),i})},it.create=function(e){return new bt(function(t){return k(e(t))})},it.createWithDisposable=function(e){return new bt(e)};var ot=it.defer=function(e){return new bt(function(t){var n;try{n=e()}catch(r){return ct(r).subscribe(t)}return n.subscribe(t)})},ut=it.empty=function(e){return e||(e=B),new bt(function(t){return e.schedule(function(){t.onCompleted()})})},at=it.fromArray=function(e,t){return t||(t=j),new bt(function(n){var r=0;return t.scheduleRecursive(function(t){r<e.length?(n.onNext(e[r++]),t()):n.onCompleted()})})};it.generate=function(e,t,n,r,i){return i||(i=j),new bt(function(s){var o=!0,u=e;return i.scheduleRecursive(function(e){var i,a;try{o?o=!1:u=n(u),i=t(u),i&&(a=r(u))}catch(f){s.onError(f);return}i?(s.onNext(a),e()):s.onCompleted()})})};var ft=it.never=function(){return new bt(function(){return L})};it.range=function(e,t,n){return n||(n=j),new bt(function(r){return n.scheduleRecursiveWithState(0,function(n,i){n<t?(r.onNext(e+n),i(n+1)):r.onCompleted()})})},it.repeat=function(e,n,r){return r||(r=j),n==t&&(n=-1),lt(e,r).repeat(n)};var lt=it.returnValue=function(e,t){return t||(t=B),new bt(function(n){return t.schedule(function(){n.onNext(e),n.onCompleted()})})},ct=it.throwException=function(e,t){return t||(t=B),new bt(function(n){return t.schedule(function(){n.onError(e)})})};it.using=function(e,t){return new bt(function(n){var r=L,i,s;try{i=e(),i&&(r=i),s=t(i)}catch(o){return new N(ct(o).subscribe(n),r)}return new N(s.subscribe(n),r)})},rt.amb=function(e){var t=this;return new bt(function(n){function o(){r||(r="L",s.dispose())}function u(){r||(r="R",i.dispose())}var r,i=new A,s=new A;return i.setDisposable(t.subscribe(function(e){o(),r==="L"&&n.onNext(e)},function(e){o(),r==="L"&&n.onError(e)},function(){o(),r==="L"&&n.onCompleted()})),s.setDisposable(e.subscribe(function(e){u(),r==="R"&&n.onNext(e)},function(e){u(),r==="R"&&n.onError(e)},function(){u(),r==="R"&&n.onCompleted()})),new N(i,s)})},it.amb=function(){function n(e,t){return e.amb(t)}var e=ft(),t=m(arguments,0);for(var r=0,i=t.length;r<i;r++)e=n(e,t[r]);return e},rt.catchException=function(e){return typeof e=="function"?ht(this,e):pt([this,e])};var pt=it.catchException=function(){var e=m(arguments,0);return K(e).catchException()};rt.combineLatest=function(){var e=this,t=v.call(arguments),n=t.pop();return t.unshift(this),new bt(function(r){function l(t){var i;o[t]=!0;if(u||(u=o.every(function(e){return e}))){try{i=n.apply(e,f)}catch(s){r.onError(s);return}r.onNext(i)}else a.filter(function(e,n){return n!==t}).every(function(e){return e})&&r.onCompleted()}function c(e){a[e]=!0,a.every(function(e){return e})&&r.onCompleted()}var i=function(){return!1},s=t.length,o=E(s,i),u=!1,a=E(s,i),f=new Array(s),h=new Array(s);for(var p=0;p<s;p++)(function(e){h[e]=new A,h[e].setDisposable(t[e].subscribe(function(t){f[e]=t,l(e)},r.onError.bind(r),function(){c(e)}))})(p);return new N(h)})},rt.concat=function(){var e=v.call(arguments,0);return e.unshift(this),dt.apply(this,e)};var dt=it.concat=function(){var e=m(arguments,0);return K(e).concat()};rt.concatObservable=function(){return this.merge(1)},rt.merge=function(e){if(typeof e!="number")return vt(this,e);var t=this;return new bt(function(n){var r=0,i=new N,s=!1,o=[],u=function(e){var t=new A;i.add(t),t.setDisposable(e.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){var e;i.remove(t),o.length>0?(e=o.shift(),u(e)):(r--,s&&r===0&&n.onCompleted())}))};return i.add(t.subscribe(function(t){r<e?(r++,u(t)):o.push(t)},n.onError.bind(n),function(){s=!0,r===0&&n.onCompleted()})),i})};var vt=it.merge=function(){var e,t;return arguments[0]?arguments[0].now?(e=arguments[0],t=v.call(arguments,1)):(e=B,t=v.call(arguments,0)):(e=B,t=v.call(arguments,1)),Array.isArray(t[0])&&(t=t[0]),at(t,e).mergeObservable()};rt.mergeObservable=function(){var e=this;return new bt(function(t){var n=new N,r=!1,i=new A;return n.add(i),i.setDisposable(e.subscribe(function(e){var i=new A;n.add(i),i.setDisposable(e.subscribe(function(e){t.onNext(e)},t.onError.bind(t),function(){n.remove(i),r&&n.length===1&&t.onCompleted()}))},t.onError.bind(t),function(){r=!0,n.length===1&&t.onCompleted()})),n})},rt.onErrorResumeNext=function(e){if(!e)throw new Error("Second observable is required");return mt([this,e])};var mt=it.onErrorResumeNext=function(){var e=m(arguments,0);return new bt(function(t){var n=0,r=new O,i=B.scheduleRecursive(function(i){var s,o;n<e.length?(s=e[n++],o=new A,r.setDisposable(o),o.setDisposable(s.subscribe(t.onNext.bind(t),function(){i()},function(){i()}))):t.onCompleted()});return new N(r,i)})};rt.skipUntil=function(e){var t=this;return new bt(function(n){var r=!1,i=new N(t.subscribe(function(e){r&&n.onNext(e)},n.onError.bind(n),function(){r&&n.onCompleted()})),s=new A;return i.add(s),s.setDisposable(e.subscribe(function(){r=!0,s.dispose()},n.onError.bind(n),function(){s.dispose()})),i})},rt.switchLatest=function(){var e=this;return new bt(function(t){var n=!1,r=new O,i=!1,s=0,o=e.subscribe(function(e){var o=new A,u=++s;n=!0,r.setDisposable(o),o.setDisposable(e.subscribe(function(e){s===u&&t.onNext(e)},function(e){s===u&&t.onError(e)},function(){s===u&&(n=!1,i&&t.onCompleted())}))},t.onError.bind(t),function(){i=!0,n||t.onCompleted()});return new N(o,r)})},rt.takeUntil=function(e){var t=this;return new bt(function(n){return new N(t.subscribe(n),e.subscribe(n.onCompleted.bind(n),n.onError.bind(n),i))})},rt.zip=function(){if(Array.isArray(arguments[0]))return gt.apply(this,arguments);var e=this,t=v.call(arguments),n=t.pop();return t.unshift(e),new bt(function(r){function a(e){o[e]=!0,o.every(function(e){return e})&&r.onCompleted()}var i=t.length,s=E(i,function(){return[]}),o=E(i,function(){return!1}),u=function(t){var i,u;if(s.every(function(e){return e.length>0})){try{u=s.map(function(e){return e.shift()}),i=n.apply(e,u)}catch(a){r.onError(a);return}r.onNext(i)}else o.filter(function(e,n){return n!==t}).every(function(e){return e})&&r.onCompleted()},f=new Array(i);for(var l=0;l<i;l++)(function(e){f[e]=new A,f[e].setDisposable(t[e].subscribe(function(t){s[e].push(t),u(e)},r.onError.bind(r),function(){a(e)}))})(l);return new N(f)})},rt.asObservable=function(){var e=this;return new bt(function(t){return e.subscribe(t)})},rt.bufferWithCount=function(e,n){return n===t&&(n=e),this.windowWithCount(e,n).selectMany(function(e){return e.toArray()}).where(function(e){return e.length>0})},rt.dematerialize=function(){var e=this;return new bt(function(t){return e.subscribe(function(e){return e.accept(t)},t.onError.bind(t),t.onCompleted.bind(t))})},rt.distinctUntilChanged=function(e,t){var n=this;return e||(e=s),t||(t=u),new bt(function(r){var i=!1,s;return n.subscribe(function(n){var o=!1,u;try{u=e(n)}catch(a){r.onError(a);return}if(i)try{o=t(s,u)}catch(a){r.onError(a);return}if(!i||!o)i=!0,s=u,r.onNext(n)},r.onError.bind(r),r.onCompleted.bind(r))})},rt.doAction=function(e,t,n){var r=this,i;return typeof e=="function"?i=e:(i=e.onNext.bind(e),t=e.onError.bind(e),n=e.onCompleted.bind(e)),new bt(function(e){return r.subscribe(function(t){try{i(t)}catch(n){e.onError(n)}e.onNext(t)},function(n){if(!t)e.onError(n);else{try{t(n)}catch(r){e.onError(r)}e.onError(n)}},function(){if(!n)e.onCompleted();else{try{n()}catch(t){e.onError(t)}e.onCompleted()}})})},rt.finallyAction=function(e){var t=this;return new bt(function(n){var r=t.subscribe(n);return k(function(){try{r.dispose()}finally{e()}})})},rt.ignoreElements=function(){var e=this;return new bt(function(t){return e.subscribe(i,t.onError.bind(t),t.onCompleted.bind(t))})},rt.materialize=function(){var e=this;return new bt(function(t){return e.subscribe(function(e){t.onNext(U(e))},function(e){t.onNext(z(e)),t.onCompleted()},function(){t.onNext(W()),t.onCompleted()})})},rt.repeat=function(e){return J(this,e).concat()},rt.retry=function(e){return J(this,e).catchException()},rt.scan=function(){var e,t=!1,n;arguments.length===2?(e=arguments[0],n=arguments[1],t=!0):n=arguments[0];var r=this;return ot(function(){var i=!1,s;return r.select(function(r){return i?s=n(s,r):(s=t?n(e,r):r,i=!0),s})})},rt.skipLast=function(e){var t=this;return new bt(function(n){var r=[];return t.subscribe(function(t){r.push(t),r.length>e&&n.onNext(r.shift())},n.onError.bind(n),n.onCompleted.bind(n))})},rt.startWith=function(){var e,n,r=0;return arguments.length>0&&arguments[0]!=null&&arguments[0].now!==t?(n=arguments[0],r=1):n=B,e=v.call(arguments,r),K([at(e,n),this]).concat()},rt.takeLast=function(e,t){return this.takeLastBuffer(e).selectMany(function(e){return at(e,t)})},rt.takeLastBuffer=function(e){var t=this;return new bt(function(n){var r=[];return t.subscribe(function(t){r.push(t),r.length>e&&r.shift()},n.onError.bind(n),function(){n.onNext(r),n.onCompleted()})})},rt.windowWithCount=function(e,n){var r=this;if(e<=0)throw new Error(h);n===t&&(n=e);if(n<=0)throw new Error(h);return new bt(function(t){var i=new A,s=new M(i),o=0,u=[],a=function(){var e=new xt;u.push(e),t.onNext(w(e,s))};return a(),i.setDisposable(r.subscribe(function(t){var r;for(var i=0,s=u.length;i<s;i++)u[i].onNext(t);var f=o-e+1;f>=0&&f%n===0&&(r=u.shift(),r.onCompleted()),o++,o%n===0&&a()},function(e){while(u.length>0)u.shift().onError(e);t.onError(e)},function(){while(u.length>0)u.shift().onCompleted();t.onCompleted()})),s})},rt.defaultIfEmpty=function(e){var n=this;return e===t&&(e=null),new bt(function(t){var r=!1;return n.subscribe(function(e){r=!0,t.onNext(e)},t.onError.bind(t),function(){r||t.onNext(e),t.onCompleted()})})},rt.distinct=function(e,t){var n=this;return e||(e=s),t||(t=f),new bt(function(r){var i={};return n.subscribe(function(n){var s,o,u,a=!1;try{s=e(n),o=t(s)}catch(f){r.onError(f);return}for(u in i)if(o===u){a=!0;break}a||(i[o]=null,r.onNext(n))},r.onError.bind(r),r.onCompleted.bind(r))})},rt.groupBy=function(e,t,n){return this.groupByUntil(e,t,function(){return ft()},n)},rt.groupByUntil=function(e,n,r,i){var o=this;return n||(n=s),i||(i=f),new bt(function(s){var u={},a=new N,f=new M(a);return a.add(o.subscribe(function(o){var l,c,h,p,d,v,m,g,y,b,w;try{m=e(o),g=i(m)}catch(E){for(w in u)u[w].onError(E);s.onError(E);return}d=!1;try{b=u[g],b||(b=new xt,u[g]=b,d=!0)}catch(E){for(w in u)u[w].onError(E);s.onError(E);return}if(d){v=new Et(m,b,f),c=new Et(m,b);try{l=r(c)}catch(E){for(w in u)u[w].onError(E);s.onError(E);return}s.onNext(v),y=new A,a.add(y),p=function(){u[g]!==t&&(delete u[g],b.onCompleted()),a.remove(y)},y.setDisposable(l.take(1).subscribe(function(){},function(e){for(w in u)u[w].onError(e);s.onError(e)},function(){p()}))}try{h=n(o)}catch(E){for(w in u)u[w].onError(E);s.onError(E);return}b.onNext(h)},function(e){for(var t in u)u[t].onError(e);s.onError(e)},function(){for(var e in u)u[e].onCompleted();s.onCompleted()})),f})},rt.select=function(e){var t=this;return new bt(function(n){var r=0;return t.subscribe(function(t){var i;try{i=e(t,r++)}catch(s){n.onError(s);return}n.onNext(i)},n.onError.bind(n),n.onCompleted.bind(n))})},rt.selectMany=function(e,t){return t?this.selectMany(function(n){return e(n).select(function(e){return t(n,e)})}):typeof e=="function"?yt.call(this,e):yt.call(this,function(){return e})},rt.skip=function(e){if(e<0)throw new Error(h);var t=this;return new bt(function(n){var r=e;return t.subscribe(function(e){r<=0?n.onNext(e):r--},n.onError.bind(n),n.onCompleted.bind(n))})},rt.skipWhile=function(e){var t=this;return new bt(function(n){var r=0,i=!1;return t.subscribe(function(t){if(!i)try{i=!e(t,r++)}catch(s){n.onError(s);return}i&&n.onNext(t)},n.onError.bind(n),n.onCompleted.bind(n))})},rt.take=function(e,t){if(e<0)throw new Error(h);if(e===0)return ut(t);var n=this;return new bt(function(t){var r=e;return n.subscribe(function(e){r>0&&(r--,t.onNext(e),r===0&&t.onCompleted())},t.onError.bind(t),t.onCompleted.bind(t))})},rt.takeWhile=function(e){var t=this;return new bt(function(n){var r=0,i=!0;return t.subscribe(function(t){if(i){try{i=e(t,r++)}catch(s){n.onError(s);return}i?n.onNext(t):n.onCompleted()}},n.onError.bind(n),n.onCompleted.bind(n))})},rt.where=function(e){var t=this;return new bt(function(n){var r=0;return t.subscribe(function(t){var i;try{i=e(t,r++)}catch(s){n.onError(s);return}i&&n.onNext(t)},n.onError.bind(n),n.onCompleted.bind(n))})};var bt=r.Internals.AnonymousObservable=function(){function e(t){var n=function(e){var n=new wt(e);if(j.scheduleRequired())j.schedule(function(){try{n.disposable(t(n))}catch(e){if(!n.fail(e))throw e}});else try{n.disposable(t(n))}catch(r){if(!n.fail(r))throw r}return n};e.super_.constructor.call(this,n)}return y(e,it),e}(),wt=function(){function e(t){e.super_.constructor.call(this),this.observer=t,this.m=new A}return y(e,Y),e.prototype.next=function(e){var t=!1;try{this.observer.onNext(e),t=!0}finally{t||this.dispose()}},e.prototype.error=function(e){try{this.observer.onError(e)}finally{this.dispose()}},e.prototype.completed=function(){try{this.observer.onCompleted()}finally{this.dispose()}},e.prototype.disposable=function(e){return this.m.disposable(e)},e.prototype.dispose=function(){e.super_.dispose.call(this),this.m.dispose()},e}(),Et=function(){function e(e){return this.underlyingObservable.subscribe(e)}function t(n,r,i){t.super_.constructor.call(this,e),this.key=n,this.underlyingObservable=i?new bt(function(e){return new N(i.getDisposable(),r.subscribe(e))}):r}return y(t,it),t}(),St=function(e,t){this.subject=e,this.observer=t};St.prototype.dispose=function(){if(!this.subject.isDisposed&&this.observer!==null){var e=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(e,1),this.observer=null}};var xt=r.Subject=function(){function e(e){return d.call(this),this.isStopped?this.exception?(e.onError(this.exception),L):(e.onCompleted(),L):(this.observers.push(e),new St(this,e))}function t(){t.super_.constructor.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return y(t,it),b(t.prototype,Q,{onCompleted:function(){d.call(this);if(!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0;for(var t=0,n=e.length;t<n;t++)e[t].onCompleted();this.observers=[]}},onError:function(e){d.call(this);if(!this.isStopped){var t=this.observers.slice(0);this.isStopped=!0,this.exception=e;for(var n=0,r=t.length;n<r;n++)t[n].onError(e);this.observers=[]}},onNext:function(e){d.call(this);if(!this.isStopped){var t=this.observers.slice(0);for(var n=0,r=t.length;n<r;n++)t[n].onNext(e)}},dispose:function(){this.isDisposed=!0,this.observers=null}}),t.create=function(e,t){return new Nt(e,t)},t}(),Tt=r.AsyncSubject=function(){function e(e){d.call(this);if(!this.isStopped)return this.observers.push(e),new St(this,e);var t=this.exception,n=this.hasValue,r=this.value;return t?e.onError(t):n?(e.onNext(r),e.onCompleted()):e.onCompleted(),L}function t(){t.super_.constructor.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return y(t,it),b(t.prototype,Q,{onCompleted:function(){var e,t,n;d.call(this);if(!this.isStopped){var r=this.observers.slice(0);this.isStopped=!0;var i=this.value,s=this.hasValue;if(s)for(t=0,n=r.length;t<n;t++)e=r[t],e.onNext(i),e.onCompleted();else for(t=0,n=r.length;t<n;t++)r[t].onCompleted();this.observers=[]}},onError:function(e){d.call(this);if(!this.isStopped){var t=this.observers.slice(0);this.isStopped=!0,this.exception=e;for(var n=0,r=t.length;n<r;n++)t[n].onError(e);this.observers=[]}},onNext:function(e){d.call(this),this.isStopped||(this.value=e,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),t}(),Nt=function(){function e(e){return this.observable.subscribe(e)}function t(n,r){t.super_.constructor.call(this,e),this.observer=n,this.observable=r}return y(t,it),b(t.prototype,Q,{onCompleted:function(){this.observer.onCompleted()},onError:function(e){this.observer.onError(e)},onNext:function(e){this.observer.onNext(e)}}),t}();if(typeof define=="function"&&typeof define.amd=="object"&&define.amd)return e.Rx=r,define(function(){return r});n?typeof module=="object"&&module&&module.exports==n?module.exports=r:n=r:e.Rx=r})(this);
+/*** @preserve Copyright (c) Microsoft Corporation. All rights reserved.
+* This code is licensed by Microsoft Corporation under the terms
+* of the MICROSOFT REACTIVE EXTENSIONS FOR JAVASCRIPT AND .NET LIBRARIES License.
+* See http://go.microsoft.com/fwlink/?LinkID=220762.
+*/
+(function(e,t){function i(){}function s(e){return e}function o(){return(new Date).getTime()}function u(e,t){return e===t}function a(e,t){return e-t}function f(e){return e.toString()}function l(e){throw e}function d(){if(this.isDisposed)throw new Error(p)}function m(e,t){return e.length===1&&Array.isArray(e[t])?e[t]:v.call(e)}function E(e,t){var n=new Array(e);for(var r=0;r<e;r++)n[r]=t();return n}function _(e,t){this.scheduler=e,this.disposable=t,this.isDisposed=!1}function D(e,t,n,r,i){this.scheduler=e,this.state=t,this.action=n,this.dueTime=r,this.comparer=i||a,this.disposable=new A}function ht(e,t){return new bt(function(n){var r=new A,i=new O;return i.setDisposable(r),r.setDisposable(e.subscribe(n.onNext.bind(n),function(e){var r,s;try{s=t(e)}catch(o){n.onError(o);return}r=new A,i.setDisposable(r),r.setDisposable(s.subscribe(n))},n.onCompleted.bind(n))),i})}function gt(e,t){var n=this;return new bt(function(r){var i=0,s=e.length;return n.subscribe(function(n){if(i<s){var o=e[i++],u;try{u=t(n,o)}catch(a){r.onError(a);return}r.onNext(u)}else r.onCompleted()},r.onError.bind(r),r.onCompleted.bind(r))})}function yt(e){return this.select(e).mergeObservable()}var n=typeof exports=="object"&&exports&&(typeof global=="object"&&global&&global==global.global&&(e=global),exports),r={Internals:{}},c="Sequence contains no elements.",h="Argument out of range",p="Object has been disposed";Function.prototype.bind||(Function.prototype.bind=function(e){var t=this,n=v.call(arguments,1),r=function(){if(this instanceof r){function e(){}e.prototype=t.prototype;var i=new e,s=t.apply(i,n.concat(v.call(arguments)));return Object(s)===s?s:i}return t.apply(that,n.concat(v.call(arguments)))};return r});var v=Array.prototype.slice,g={}.hasOwnProperty,y=r.Internals.inherits=function(e,t){function r(){this.constructor=e}for(var n in t)n!=="prototype"&&g.call(t,n)&&(e[n]=t[n]);return r.prototype=t.prototype,e.prototype=new r,e.super_=t.prototype,e},b=r.Internals.addProperties=function(e){var t=v.call(arguments,1);for(var n=0,r=t.length;n<r;n++){var i=t[n];for(var s in i)e[s]=i[s]}},w=r.Internals.addRef=function(e,t){return new bt(function(n){return new N(t.getDisposable(),e.subscribe(n))})};Array.prototype.every||(Array.prototype.every=function(e){var t=new Object(this);for(var n=0,r=t.length>>>0;n<r;n++)if(n in t&&!e.call(arguments[1],t[n],n,t))return!1;return!0}),Array.prototype.map||(Array.prototype.map=function(e){var t=[],n=new Object(this);for(var r=0,i=n.length>>>0;r<i;r++)r in n&&t.push(e.call(arguments[1],n[r],r,n));return t}),Array.prototype.filter||(Array.prototype.filter=function(e){var t=[],n,r=new Object(this);for(var i=0,s=r.length>>>0;i<s;i++)n=r[i],i in r&&e.call(arguments[1],n,i,r)&&t.push(n);return t}),Array.isArray||(Array.isArray=function(e){return Object.prototype.toString.call(e)=="[object Array]"}),Array.prototype.indexOf||(Array.prototype.indexOf=function(t){var n=new Object(this),r=n.length>>>0;if(!r)return-1;var i=0;arguments.length>1&&(i=arguments[1]),i=i>=0?i:Math.max(0,r+i);for(;i<r;i++)if(i in n&&n[i]===t)return i;return-1});var S=function(e,t){this.id=e,this.value=t};S.prototype.compareTo=function(e){var t=this.value.compareTo(e.value);return t===0&&(t=this.id-e.id),t};var x=function(e){this.items=new Array(e),this.length=0},T=x.prototype;T.isHigherPriority=function(e,t){return this.items[e].compareTo(this.items[t])<0},T.percolate=function(e){if(e>=this.length||e<0)return;var t=e-1>>1;if(t<0||t===e)return;if(this.isHigherPriority(e,t)){var n=this.items[e];this.items[e]=this.items[t],this.items[t]=n,this.percolate(t)}},T.heapify=function(e){e===t&&(e=0);if(e>=this.length||e<0)return;var n=2*e+1,r=2*e+2,i=e;n<this.length&&this.isHigherPriority(n,i)&&(i=n),r<this.length&&this.isHigherPriority(r,i)&&(i=r);if(i!==e){var s=this.items[e];this.items[e]=this.items[i],this.items[i]=s,this.heapify(i)}},T.peek=function(){return this.items[0].value},T.removeAt=function(e){this.items[e]=this.items[--this.length],delete this.items[this.length],this.heapify()},T.dequeue=function(){var e=this.peek();return this.removeAt(0),e},T.enqueue=function(e){var t=this.length++;this.items[t]=new S(x.count++,e),this.percolate(t)},T.remove=function(e){for(var t=0;t<this.length;t++)if(this.items[t].value===e)return this.removeAt(t),!0;return!1},x.count=0;var N=r.CompositeDisposable=function(){this.disposables=m(arguments,0),this.isDisposed=!1,this.length=this.disposables.length};N.prototype.add=function(e){this.isDisposed?e.dispose():(this.disposables.push(e),this.length++)},N.prototype.remove=function(e){var t=!1;if(!this.isDisposed){var n=this.disposables.indexOf(e);n!==-1&&(t=!0,this.disposables.splice(n,1),this.length--,e.dispose())}return t},N.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var e=this.disposables.slice(0);this.disposables=[],this.length=0;for(var t=0,n=e.length;t<n;t++)e[t].dispose()}},N.prototype.clear=function(){var e=this.disposables.slice(0);this.disposables=[],this.length=0;for(var t=0,n=e.length;t<n;t++)e[t].dispose()},N.prototype.contains=function(e){return this.disposables.indexOf(e)!==-1},N.prototype.toArray=function(){return this.disposables.slice(0)};var C=r.Disposable=function(e){this.isDisposed=!1,this.action=e};C.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var k=C.create=function(e){return new C(e)},L=C.empty={dispose:i},A=r.SingleAssignmentDisposable=function(){this.isDisposed=!1,this.current=null};A.prototype.disposable=function(e){return e?this.setDisposable(e):this.getDisposable()},A.prototype.getDisposable=function(){return this.current},A.prototype.setDisposable=function(e){if(this.current)throw new Error("Disposable has already been assigned");var t=this.isDisposed;t||(this.current=e),t&&e&&e.dispose()},A.prototype.dispose=function(){var e;this.isDisposed||(this.isDisposed=!0,e=this.current,this.current=null),e&&e.dispose()};var O=r.SerialDisposable=function(){this.isDisposed=!1,this.current=null};O.prototype.getDisposable=function(){return this.current},O.prototype.setDisposable=function(e){var t=this.isDisposed,n;t||(n=this.current,this.current=e),n&&n.dispose(),t&&e&&e.dispose()},O.prototype.disposable=function(e){if(!e)return this.getDisposable();this.setDisposable(e)},O.prototype.dispose=function(){var e;this.isDisposed||(this.isDisposed=!0,e=this.current,this.current=null),e&&e.dispose()};var M=r.RefCountDisposable=function(){function e(e){this.disposable=e,this.disposable.count++,this.isInnerDisposed=!1}function t(e){this.underlyingDisposable=e,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return e.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,this.disposable.count===0&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},t.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,this.count===0&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},t.prototype.getDisposable=function(){return this.isDisposed?L:new e(this)},t}();_.prototype.dispose=function(){var e=this;this.scheduler.schedule(function(){e.isDisposed||(e.isDisposed=!0,e.disposable.dispose())})},D.prototype.invoke=function(){this.disposable.disposable(this.invokeCore())},D.prototype.compareTo=function(e){return this.comparer(this.dueTime,e.dueTime)},D.prototype.isCancelled=function(){return this.disposable.isDisposed},D.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var P=r.Scheduler=function(){function t(e,t,n,r){this.now=e,this._schedule=t,this._scheduleRelative=n,this._scheduleAbsolute=r}function n(e,t){var n=t.first,r=t.second,i=new N,s=function(t){r(t,function(t){var n=!1,r=!1,o=e.scheduleWithState(t,function(e,t){return n?i.remove(o):r=!0,s(t),L});r||(i.add(o),n=!0)})};return s(n),i}function r(e,t,n){var r=t.first,i=t.second,s=new N,o=function(t){i(t,function(t,r){var i=!1,u=!1,a=e[n].call(e,t,r,function(e,t){return i?s.remove(a):u=!0,o(t),L});u||(s.add(a),i=!0)})};return o(r),s}function i(e,t){return t(),L}var s=t.prototype;return s.catchException=function(e){return new q(this,e)},s.schedulePeriodic=function(e,t){return this.schedulePeriodicWithState(null,e,function(){t()})},s.schedulePeriodicWithState=function(t,n,r){var i=t,s=e.setInterval(function(){i=r(i)},n);return k(function(){e.clearInterval(s)})},s.schedule=function(e){return this._schedule(e,i)},s.scheduleWithState=function(e,t){return this._schedule(e,t)},s.scheduleWithRelative=function(e,t){return this._scheduleRelative(t,e,i)},s.scheduleWithRelativeAndState=function(e,t,n){return this._scheduleRelative(e,t,n)},s.scheduleWithAbsolute=function(e,t){return this._scheduleAbsolute(t,e,i)},s.scheduleWithAbsoluteAndState=function(e,t,n){return this._scheduleAbsolute(e,t,n)},s.scheduleRecursive=function(e){return this.scheduleRecursiveWithState(e,function(e,t){e(function(){t(e)})})},s.scheduleRecursiveWithState=function(e,t){return this.scheduleWithState({first:e,second:t},function(e,t){return n(e,t)})},s.scheduleRecursiveWithRelative=function(e,t){return this.scheduleRecursiveWithRelativeAndState(t,e,function(e,t){e(function(n){t(e,n)})})},s.scheduleRecursiveWithRelativeAndState=function(e,t,n){return this._scheduleRelative({first:e,second:n},t,function(e,t){return r(e,t,"scheduleWithRelativeAndState")})},s.scheduleRecursiveWithAbsolute=function(e,t){return this.scheduleRecursiveWithAbsoluteAndState(t,e,function(e,t){e(function(n){t(e,n)})})},s.scheduleRecursiveWithAbsoluteAndState=function(e,t,n){return this._scheduleAbsolute({first:e,second:n},t,function(e,t){return r(e,t,"scheduleWithAbsoluteAndState")})},t.now=o,t.normalize=function(e){return e<0&&(e=0),e},t}(),H="Scheduler is not allowed to block the thread",B=P.immediate=function(){function e(e,t){return t(this,e)}function t(e,t,n){if(t>0)throw new Error(H);return n(this,e)}function n(e,t,n){return this.scheduleWithRelativeAndState(e,t-this.now(),n)}return new P(o,e,t,n)}(),j=P.currentThread=function(){function t(){e=new x(4)}function n(e,t){return this.scheduleWithRelativeAndState(e,0,t)}function r(n,r,i){var s=this.now()+P.normalize(r),o=new D(this,n,i,s),u;if(!e){u=new t;try{e.enqueue(o),u.run()}finally{u.dispose()}}else e.enqueue(o);return o.disposable}function i(e,t,n){return this.scheduleWithRelativeAndState(e,t-this.now(),n)}var e;t.prototype.dispose=function(){e=null},t.prototype.run=function(){var t;while(e.length>0){t=e.dequeue();if(!t.isCancelled()){while(t.dueTime-P.now()>0);t.isCancelled()||t.invoke()}}};var s=new P(o,n,r,i);return s.scheduleRequired=function(){return e===null},s.ensureTrampoline=function(t){return e===null?this.schedule(t):t()},s}(),F=function(){function e(e,t){t(0,this._period);try{this._state=this._action(this._state)}catch(n){throw this._cancel.dispose(),n}}function t(e,t,n,r){this._scheduler=e,this._state=t,this._period=n,this._action=r}return t.prototype.start=function(){var t=new A;return this._cancel=t,t.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,e.bind(this))),t},t}();r.VirtualTimeScheduler=function(){function e(){return this.toDateTimeOffset(this.clock)}function t(e,t){return this.scheduleAbsoluteWithState(e,this.clock,t)}function n(e,t,n){return this.scheduleRelativeWithState(e,this.toRelative(t),n)}function r(e,t,n){return this.scheduleRelativeWithState(e,this.toRelative(t-this.now()),n)}function i(e,t){return t(),L}function s(i,o){this.clock=i,this.comparer=o,this.isEnabled=!1,this.queue=new x(1024),s.super_.constructor.call(this,e,t,n,r)}return y(s,P),b(s.prototype,{schedulePeriodicWithState:function(e,t,n){var r=new F(this,e,t,n);return r.start()},scheduleRelativeWithState:function(e,t,n){var r=this.add(this.clock,t);return this.scheduleAbsoluteWithState(e,r,n)},scheduleRelative:function(e,t){return this.scheduleRelativeWithState(t,e,i)},start:function(){var e;if(!this.isEnabled){this.isEnabled=!0;do e=this.getNext(),e!==null?(this.comparer(e.dueTime,this.clock)>0&&(this.clock=e.dueTime),e.invoke()):this.isEnabled=!1;while(this.isEnabled)}},stop:function(){this.isEnabled=!1},advanceTo:function(e){var t;if(this.comparer(this.clock,e)>=0)throw new Error(h);if(!this.isEnabled){this.isEnabled=!0;do t=this.getNext(),t!==null&&this.comparer(t.dueTime,e)<=0?(this.comparer(t.dueTime,this.clock)>0&&(this.clock=t.dueTime),t.invoke()):this.isEnabled=!1;while(this.isEnabled);this.clock=e}},advanceBy:function(e){var t=this.add(this.clock,e);if(this.comparer(this.clock,t)>=0)throw new Error(h);return this.advanceTo(t)},sleep:function(e){var t=this.add(this.clock,e);if(this.comparer(this.clock,t)>=0)throw new Error(h);this.clock=t},getNext:function(){var e;while(this.queue.length>0){e=this.queue.peek();if(!e.isCancelled())return e;this.queue.dequeue()}return null},scheduleAbsolute:function(e,t){return this.scheduleAbsoluteWithState(t,e,i)},scheduleAbsoluteWithState:function(e,t,n){var r=this,i=function(e,t){return r.queue.remove(s),n(e,t)},s=new D(r,e,i,t,r.comparer);return r.queue.enqueue(s),s.disposable}}),s}();var I=P.timeout=function(){function u(e,t){var n=this,i=new A,o=r(function(){i.setDisposable(t(n,e))});return new N(i,k(function(){s(o)}))}function a(t,n,r){var i=this,s=P.normalize(n);if(s===0)return i.scheduleWithState(t,r);var o=new A,u=e.setTimeout(function(){o.setDisposable(r(i,t))},s);return new N(o,k(function(){e.clearTimeout(u)}))}function f(e,t,n){return this.scheduleWithRelativeAndState(e,t-this.now(),n)}var t=e.requestAnimationFrame||e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.oRequestAnimationFrame||e.msRequestAnimationFrame,n=e.cancelAnimationFrame||e.webkitCancelAnimationFrame||e.mozCancelAnimationFrame||e.oCancelAnimationFrame||e.msCancelAnimationFrame,r,s;return typeof e.process!="undefined"&&typeof e.process.nextTick=="function"?(r=e.process.nextTick,s=i):typeof e.setImmediate=="function"?(r=e.setImmediate,s=e.clearImmediate):typeof t=="function"?(r=t,s=n):(r=function(t){return e.setTimeout(t,0)},s=e.clearTimeout),new P(o,u,a,f)}(),q=function(){function e(){return this._scheduler.now()}function t(e,t){return this._scheduler.scheduleWithState(e,this._wrap(t))}function n(e,t,n){return this._scheduler.scheduleWithRelativeAndState(e,t,this._wrap(n))}function r(e,t,n){return this._scheduler.scheduleWithAbsoluteAndState(e,t,this._wrap(n))}function i(s,o){this._scheduler=s,this._handler=o,this._recursiveOriginal=null,this._recursiveWrapper=null,i.super_.constructor.call(this,e,t,n,r)}return y(i,P),i.prototype._clone=function(e){return new i(e,this._handler)},i.prototype._wrap=function(e){var t=this;return function(n,r){try{return e(t._getRecursiveWrapper(n),r)}catch(i){if(!t._handler(i))throw i;return L}}},i.prototype._getRecursiveWrapper=function(e){if(!this._recursiveOriginal!==e){this._recursiveOriginal=e;var t=this._clone(e);t._recursiveOriginal=e,t._recursiveWrapper=t,this._recursiveWrapper=t}return this._recursiveWrapper},i.prototype.schedulePeriodicWithState=function(e,t,n){var r=this,i=!1,s=new A;return s.setDisposable(this._scheduler.schedulePeriodicWithState(e,t,function(e){if(i)return null;try{return n(e)}catch(t){i=!0;if(!r._handler(t))throw t;return s.dispose(),null}})),s},i}(),R=r.Notification=function(){function e(){}return b(e.prototype,{accept:function(e,t,n){return arguments.length>1||typeof e=="function"?this._accept(e,t,n):this._acceptObservable(e)},toObservable:function(e){var t=this;return e=e||B,new bt(function(n){return e.schedule(function(){t._acceptObservable(n),t.kind==="N"&&n.onCompleted()})})},hasValue:!1,equals:function(e){var t=e==null?"":e.toString();return this.toString()===t}}),e}(),U=R.createOnNext=function(){function e(e){this.value=e,this.hasValue=!0,this.kind="N"}return y(e,R),b(e.prototype,{_accept:function(e){return e(this.value)},_acceptObservable:function(e){return e.onNext(this.value)},toString:function(){return"OnNext("+this.value+")"}}),function(t){return new e(t)}}(),z=R.createOnError=function(){function e(e){this.exception=e,this.kind="E"}return y(e,R),b(e.prototype,{_accept:function(e,t){return t(this.exception)},_acceptObservable:function(e){return e.onError(this.exception)},toString:function(){return"OnError("+this.exception+")"}}),function(t){return new e(t)}}(),W=R.createOnCompleted=function(){function e(){this.kind="C"}return y(e,R),b(e.prototype,{_accept:function(e,t,n){return n()},_acceptObservable:function(e){return e.onCompleted()},toString:function(){return"OnCompleted()"}}),function(){return new e}}(),X=r.Internals.Enumerator=function(e,t,n){this.moveNext=e,this.getCurrent=t,this.dispose=n},V=X.create=function(e,t,n){var r=!1;return n||(n=i),new X(function(){if(r)return!1;var t=e();return t||(r=!0,n()),t},function(){return t()},function(){r||(n(),r=!0)})},$=r.Internals.Enumerable=function(){function e(e){this.getEnumerator=e}return e.prototype.concat=function(){var e=this;return new bt(function(t){var n=e.getEnumerator(),r=!1,i=new O,s=B.scheduleRecursive(function(e){var s,o,u=!1;if(!!r)return;try{u=n.moveNext(),u?s=n.getCurrent():n.dispose()}catch(a){o=a,n.dispose()}if(o){t.onError(o);return}if(!u){t.onCompleted();return}var f=new A;i.setDisposable(f),f.setDisposable(s.subscribe(t.onNext.bind(t),t.onError.bind(t),function(){e()}))});return new N(i,s,k(function(){r=!0,n.dispose()}))})},e.prototype.catchException=function(){var e=this;return new bt(function(t){var n=e.getEnumerator(),r=!1,i,s=new O,o=B.scheduleRecursive(function(e){var o,u,a;a=!1;if(!!r)return;try{a=n.moveNext(),a&&(o=n.getCurrent())}catch(f){u=f}if(u){t.onError(u);return}if(!a){i?t.onError(i):t.onCompleted();return}var l=new A;s.setDisposable(l),l.setDisposable(o.subscribe(t.onNext.bind(t),function(t){i=t,e()},t.onCompleted.bind(t)))});return new N(s,o,k(function(){r=!0}))})},e}(),J=$.repeat=function(e,n){return n===t&&(n=-1),new $(function(){var t,r=n;return V(function(){return r===0?!1:(r>0&&r--,t=e,!0)},function(){return t})})},K=$.forEach=function(e,t){return t||(t=s),new $(function(){var n,r=-1;return V(function(){return++r<e.length?(n=t(e[r],r),!0):!1},function(){return n})})},Q=r.Observer=function(){};Q.prototype.toNotifier=function(){var e=this;return function(t){return t.accept(e)}},Q.prototype.asObserver=function(){return new Z(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},Q.prototype.checked=function(){return new et(this)};var G=Q.create=function(e,t,n){return e||(e=i),t||(t=l),n||(n=i),new Z(e,t,n)};Q.fromNotifier=function(e){return new Z(function(t){return e(U(t))},function(t){return e(z(t))},function(){return e(W())})};var Y=r.Internals.AbstractObserver=function(){function e(){this.isStopped=!1}return y(e,Q),e.prototype.onNext=function(e){this.isStopped||this.next(e)},e.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.error(e))},e.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},e.prototype.dispose=function(){this.isStopped=!0},e.prototype.fail=function(){return this.isStopped?!1:(this.isStopped=!0,this.error(!0),!0)},e}(),Z=r.AnonymousObserver=function(){function e(t,n,r){e.super_.constructor.call(this),this._onNext=t,this._onError=n,this._onCompleted=r}return y(e,Y),e.prototype.next=function(e){this._onNext(e)},e.prototype.error=function(e){this._onError(e)},e.prototype.completed=function(){this._onCompleted()},e}(),et=function(){function e(e){this._observer=e,this._state=0}return y(e,Q),e.prototype.onNext=function(e){this.checkAccess();try{this._observer.onNext(e)}finally{this._state=0}},e.prototype.onError=function(e){this.checkAccess();try{this._observer.onError(e)}finally{this._state=2}},e.prototype.onCompleted=function(){this.checkAccess();try{this._observer.onCompleted()}finally{this._state=2}},e.prototype.checkAccess=function(){if(this._state===1)throw new Error("Re-entrancy detected");if(this._state===2)throw new Error("Observer completed");this._state===0&&(this._state=1)},e}(),tt=r.Internals.ScheduledObserver=function(){function e(t,n){e.super_.constructor.call(this),this.scheduler=t,this.observer=n,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new O}return y(e,Y),e.prototype.next=function(e){var t=this;this.queue.push(function(){t.observer.onNext(e)})},e.prototype.error=function(e){var t=this;this.queue.push(function(){t.observer.onError(e)})},e.prototype.completed=function(){var e=this;this.queue.push(function(){e.observer.onCompleted()})},e.prototype.ensureActive=function(){var e=!1,t=this;!this.hasFaulted&&this.queue.length>0&&(e=!this.isAcquired,this.isAcquired=!0),e&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(e){var n;if(!(t.queue.length>0)){t.isAcquired=!1;return}n=t.queue.shift();try{n()}catch(r){throw t.queue=[],t.hasFaulted=!0,r}e()}))},e.prototype.dispose=function(){e.super_.dispose.call(this),this.disposable.dispose()},e}(),nt=function(){function e(){e.super_.constructor.apply(this,arguments)}return y(e,tt),e.prototype.next=function(t){e.super_.next.call(this,t),this.ensureActive()},e.prototype.error=function(t){e.super_.error.call(this,t),this.ensureActive()},e.prototype.completed=function(){e.super_.completed.call(this),this.ensureActive()},e}(),rt,it=r.Observable=function(){function e(e){this._subscribe=e}return rt=e.prototype,rt.finalValue=function(){var e=this;return new bt(function(t){var n=!1,r;return e.subscribe(function(e){n=!0,r=e},t.onError.bind(t),function(){n?(t.onNext(r),t.onCompleted()):t.onError(new Error(c))})})},rt.subscribe=function(e,t,n){var r;return arguments.length===0||arguments.length>1||typeof e=="function"?r=G(e,t,n):r=e,this._subscribe(r)},rt.toArray=function(){function e(e,t){return e.push(t),e.slice(0)}return this.scan([],e).startWith([]).finalValue()},e}();it.start=function(e,t,n){return st(e,t)()};var st=it.toAsync=function(e,t,n){return t||(t=I),function(){var r=v.call(arguments,0),i=new Tt;return t.schedule(function(){var t;try{t=e.apply(n,r)}catch(s){i.onError(s);return}i.onNext(t),i.onCompleted()}),i.asObservable()}};rt.observeOn=function(e){var t=this;return new bt(function(n){return t.subscribe(new nt(e,n))})},rt.subscribeOn=function(e){var t=this;return new bt(function(n){var r=new A,i=new O;return i.setDisposable(r),r.setDisposable(e.schedule(function(){i.setDisposable(new _(e,t.subscribe(n)))})),i})},it.create=function(e){return new bt(function(t){return k(e(t))})},it.createWithDisposable=function(e){return new bt(e)};var ot=it.defer=function(e){return new bt(function(t){var n;try{n=e()}catch(r){return ct(r).subscribe(t)}return n.subscribe(t)})},ut=it.empty=function(e){return e||(e=B),new bt(function(t){return e.schedule(function(){t.onCompleted()})})},at=it.fromArray=function(e,t){return t||(t=j),new bt(function(n){var r=0;return t.scheduleRecursive(function(t){r<e.length?(n.onNext(e[r++]),t()):n.onCompleted()})})};it.generate=function(e,t,n,r,i){return i||(i=j),new bt(function(s){var o=!0,u=e;return i.scheduleRecursive(function(e){var i,a;try{o?o=!1:u=n(u),i=t(u),i&&(a=r(u))}catch(f){s.onError(f);return}i?(s.onNext(a),e()):s.onCompleted()})})};var ft=it.never=function(){return new bt(function(){return L})};it.range=function(e,t,n){return n||(n=j),new bt(function(r){return n.scheduleRecursiveWithState(0,function(n,i){n<t?(r.onNext(e+n),i(n+1)):r.onCompleted()})})},it.repeat=function(e,n,r){return r||(r=j),n==t&&(n=-1),lt(e,r).repeat(n)};var lt=it.returnValue=function(e,t){return t||(t=B),new bt(function(n){return t.schedule(function(){n.onNext(e),n.onCompleted()})})},ct=it.throwException=function(e,t){return t||(t=B),new bt(function(n){return t.schedule(function(){n.onError(e)})})};it.using=function(e,t){return new bt(function(n){var r=L,i,s;try{i=e(),i&&(r=i),s=t(i)}catch(o){return new N(ct(o).subscribe(n),r)}return new N(s.subscribe(n),r)})},rt.amb=function(e){var t=this;return new bt(function(n){function o(){r||(r="L",s.dispose())}function u(){r||(r="R",i.dispose())}var r,i=new A,s=new A;return i.setDisposable(t.subscribe(function(e){o(),r==="L"&&n.onNext(e)},function(e){o(),r==="L"&&n.onError(e)},function(){o(),r==="L"&&n.onCompleted()})),s.setDisposable(e.subscribe(function(e){u(),r==="R"&&n.onNext(e)},function(e){u(),r==="R"&&n.onError(e)},function(){u(),r==="R"&&n.onCompleted()})),new N(i,s)})},it.amb=function(){function n(e,t){return e.amb(t)}var e=ft(),t=m(arguments,0);for(var r=0,i=t.length;r<i;r++)e=n(e,t[r]);return e},rt.catchException=function(e){return typeof e=="function"?ht(this,e):pt([this,e])};var pt=it.catchException=function(){var e=m(arguments,0);return K(e).catchException()};rt.combineLatest=function(){var e=this,t=v.call(arguments),n=t.pop();return t.unshift(this),new bt(function(r){function l(t){var i;o[t]=!0;if(u||(u=o.every(function(e){return e}))){try{i=n.apply(e,f)}catch(s){r.onError(s);return}r.onNext(i)}else a.filter(function(e,n){return n!==t}).every(function(e){return e})&&r.onCompleted()}function c(e){a[e]=!0,a.every(function(e){return e})&&r.onCompleted()}var i=function(){return!1},s=t.length,o=E(s,i),u=!1,a=E(s,i),f=new Array(s),h=new Array(s);for(var p=0;p<s;p++)(function(e){h[e]=new A,h[e].setDisposable(t[e].subscribe(function(t){f[e]=t,l(e)},r.onError.bind(r),function(){c(e)}))})(p);return new N(h)})},rt.concat=function(){var e=v.call(arguments,0);return e.unshift(this),dt.apply(this,e)};var dt=it.concat=function(){var e=m(arguments,0);return K(e).concat()};rt.concatObservable=function(){return this.merge(1)},rt.merge=function(e){if(typeof e!="number")return vt(this,e);var t=this;return new bt(function(n){var r=0,i=new N,s=!1,o=[],u=function(e){var t=new A;i.add(t),t.setDisposable(e.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){var e;i.remove(t),o.length>0?(e=o.shift(),u(e)):(r--,s&&r===0&&n.onCompleted())}))};return i.add(t.subscribe(function(t){r<e?(r++,u(t)):o.push(t)},n.onError.bind(n),function(){s=!0,r===0&&n.onCompleted()})),i})};var vt=it.merge=function(){var e,t;return arguments[0]?arguments[0].now?(e=arguments[0],t=v.call(arguments,1)):(e=B,t=v.call(arguments,0)):(e=B,t=v.call(arguments,1)),Array.isArray(t[0])&&(t=t[0]),at(t,e).mergeObservable()};rt.mergeObservable=function(){var e=this;return new bt(function(t){var n=new N,r=!1,i=new A;return n.add(i),i.setDisposable(e.subscribe(function(e){var i=new A;n.add(i),i.setDisposable(e.subscribe(function(e){t.onNext(e)},t.onError.bind(t),function(){n.remove(i),r&&n.length===1&&t.onCompleted()}))},t.onError.bind(t),function(){r=!0,n.length===1&&t.onCompleted()})),n})},rt.onErrorResumeNext=function(e){if(!e)throw new Error("Second observable is required");return mt([this,e])};var mt=it.onErrorResumeNext=function(){var e=m(arguments,0);return new bt(function(t){var n=0,r=new O,i=B.scheduleRecursive(function(i){var s,o;n<e.length?(s=e[n++],o=new A,r.setDisposable(o),o.setDisposable(s.subscribe(t.onNext.bind(t),function(){i()},function(){i()}))):t.onCompleted()});return new N(r,i)})};rt.skipUntil=function(e){var t=this;return new bt(function(n){var r=!1,i=new N(t.subscribe(function(e){r&&n.onNext(e)},n.onError.bind(n),function(){r&&n.onCompleted()})),s=new A;return i.add(s),s.setDisposable(e.subscribe(function(){r=!0,s.dispose()},n.onError.bind(n),function(){s.dispose()})),i})},rt.switchLatest=function(){var e=this;return new bt(function(t){var n=!1,r=new O,i=!1,s=0,o=e.subscribe(function(e){var o=new A,u=++s;n=!0,r.setDisposable(o),o.setDisposable(e.subscribe(function(e){s===u&&t.onNext(e)},function(e){s===u&&t.onError(e)},function(){s===u&&(n=!1,i&&t.onCompleted())}))},t.onError.bind(t),function(){i=!0,n||t.onCompleted()});return new N(o,r)})},rt.takeUntil=function(e){var t=this;return new bt(function(n){return new N(t.subscribe(n),e.subscribe(n.onCompleted.bind(n),n.onError.bind(n),i))})},rt.zip=function(){if(Array.isArray(arguments[0]))return gt.apply(this,arguments);var e=this,t=v.call(arguments),n=t.pop();return t.unshift(e),new bt(function(r){function a(e){o[e]=!0,o.every(function(e){return e})&&r.onCompleted()}var i=t.length,s=E(i,function(){return[]}),o=E(i,function(){return!1}),u=function(t){var i,u;if(s.every(function(e){return e.length>0})){try{u=s.map(function(e){return e.shift()}),i=n.apply(e,u)}catch(a){r.onError(a);return}r.onNext(i)}else o.filter(function(e,n){return n!==t}).every(function(e){return e})&&r.onCompleted()},f=new Array(i);for(var l=0;l<i;l++)(function(e){f[e]=new A,f[e].setDisposable(t[e].subscribe(function(t){s[e].push(t),u(e)},r.onError.bind(r),function(){a(e)}))})(l);return new N(f)})},rt.asObservable=function(){var e=this;return new bt(function(t){return e.subscribe(t)})},rt.bufferWithCount=function(e,n){return n===t&&(n=e),this.windowWithCount(e,n).selectMany(function(e){return e.toArray()}).where(function(e){return e.length>0})},rt.dematerialize=function(){var e=this;return new bt(function(t){return e.subscribe(function(e){return e.accept(t)},t.onError.bind(t),t.onCompleted.bind(t))})},rt.distinctUntilChanged=function(e,t){var n=this;return e||(e=s),t||(t=u),new bt(function(r){var i=!1,s;return n.subscribe(function(n){var o=!1,u;try{u=e(n)}catch(a){r.onError(a);return}if(i)try{o=t(s,u)}catch(a){r.onError(a);return}if(!i||!o)i=!0,s=u,r.onNext(n)},r.onError.bind(r),r.onCompleted.bind(r))})},rt.doAction=function(e,t,n){var r=this,i;return typeof e=="function"?i=e:(i=e.onNext.bind(e),t=e.onError.bind(e),n=e.onCompleted.bind(e)),new bt(function(e){return r.subscribe(function(t){try{i(t)}catch(n){e.onError(n)}e.onNext(t)},function(n){if(!t)e.onError(n);else{try{t(n)}catch(r){e.onError(r)}e.onError(n)}},function(){if(!n)e.onCompleted();else{try{n()}catch(t){e.onError(t)}e.onCompleted()}})})},rt.finallyAction=function(e){var t=this;return new bt(function(n){var r=t.subscribe(n);return k(function(){try{r.dispose()}finally{e()}})})},rt.ignoreElements=function(){var e=this;return new bt(function(t){return e.subscribe(i,t.onError.bind(t),t.onCompleted.bind(t))})},rt.materialize=function(){var e=this;return new bt(function(t){return e.subscribe(function(e){t.onNext(U(e))},function(e){t.onNext(z(e)),t.onCompleted()},function(){t.onNext(W()),t.onCompleted()})})},rt.repeat=function(e){return J(this,e).concat()},rt.retry=function(e){return J(this,e).catchException()},rt.scan=function(){var e,t=!1,n;arguments.length===2?(e=arguments[0],n=arguments[1],t=!0):n=arguments[0];var r=this;return ot(function(){var i=!1,s;return r.select(function(r){return i?s=n(s,r):(s=t?n(e,r):r,i=!0),s})})},rt.skipLast=function(e){var t=this;return new bt(function(n){var r=[];return t.subscribe(function(t){r.push(t),r.length>e&&n.onNext(r.shift())},n.onError.bind(n),n.onCompleted.bind(n))})},rt.startWith=function(){var e,n,r=0;return arguments.length>0&&arguments[0]!=null&&arguments[0].now!==t?(n=arguments[0],r=1):n=B,e=v.call(arguments,r),K([at(e,n),this]).concat()},rt.takeLast=function(e,t){return this.takeLastBuffer(e).selectMany(function(e){return at(e,t)})},rt.takeLastBuffer=function(e){var t=this;return new bt(function(n){var r=[];return t.subscribe(function(t){r.push(t),r.length>e&&r.shift()},n.onError.bind(n),function(){n.onNext(r),n.onCompleted()})})},rt.windowWithCount=function(e,n){var r=this;if(e<=0)throw new Error(h);n===t&&(n=e);if(n<=0)throw new Error(h);return new bt(function(t){var i=new A,s=new M(i),o=0,u=[],a=function(){var e=new xt;u.push(e),t.onNext(w(e,s))};return a(),i.setDisposable(r.subscribe(function(t){var r;for(var i=0,s=u.length;i<s;i++)u[i].onNext(t);var f=o-e+1;f>=0&&f%n===0&&(r=u.shift(),r.onCompleted()),o++,o%n===0&&a()},function(e){while(u.length>0)u.shift().onError(e);t.onError(e)},function(){while(u.length>0)u.shift().onCompleted();t.onCompleted()})),s})},rt.defaultIfEmpty=function(e){var n=this;return e===t&&(e=null),new bt(function(t){var r=!1;return n.subscribe(function(e){r=!0,t.onNext(e)},t.onError.bind(t),function(){r||t.onNext(e),t.onCompleted()})})},rt.distinct=function(e,t){var n=this;return e||(e=s),t||(t=f),new bt(function(r){var i={};return n.subscribe(function(n){var s,o,u,a=!1;try{s=e(n),o=t(s)}catch(f){r.onError(f);return}for(u in i)if(o===u){a=!0;break}a||(i[o]=null,r.onNext(n))},r.onError.bind(r),r.onCompleted.bind(r))})},rt.groupBy=function(e,t,n){return this.groupByUntil(e,t,function(){return ft()},n)},rt.groupByUntil=function(e,n,r,i){var o=this;return n||(n=s),i||(i=f),new bt(function(s){var u={},a=new N,f=new M(a);return a.add(o.subscribe(function(o){var l,c,h,p,d,v,m,g,y,b,w;try{m=e(o),g=i(m)}catch(E){for(w in u)u[w].onError(E);s.onError(E);return}d=!1;try{b=u[g],b||(b=new xt,u[g]=b,d=!0)}catch(E){for(w in u)u[w].onError(E);s.onError(E);return}if(d){v=new Et(m,b,f),c=new Et(m,b);try{l=r(c)}catch(E){for(w in u)u[w].onError(E);s.onError(E);return}s.onNext(v),y=new A,a.add(y),p=function(){u[g]!==t&&(delete u[g],b.onCompleted()),a.remove(y)},y.setDisposable(l.take(1).subscribe(function(){},function(e){for(w in u)u[w].onError(e);s.onError(e)},function(){p()}))}try{h=n(o)}catch(E){for(w in u)u[w].onError(E);s.onError(E);return}b.onNext(h)},function(e){for(var t in u)u[t].onError(e);s.onError(e)},function(){for(var e in u)u[e].onCompleted();s.onCompleted()})),f})},rt.select=function(e){var t=this;return new bt(function(n){var r=0;return t.subscribe(function(t){var i;try{i=e(t,r++)}catch(s){n.onError(s);return}n.onNext(i)},n.onError.bind(n),n.onCompleted.bind(n))})},rt.selectMany=function(e,t){return t?this.selectMany(function(n){return e(n).select(function(e){return t(n,e)})}):typeof e=="function"?yt.call(this,e):yt.call(this,function(){return e})},rt.skip=function(e){if(e<0)throw new Error(h);var t=this;return new bt(function(n){var r=e;return t.subscribe(function(e){r<=0?n.onNext(e):r--},n.onError.bind(n),n.onCompleted.bind(n))})},rt.skipWhile=function(e){var t=this;return new bt(function(n){var r=0,i=!1;return t.subscribe(function(t){if(!i)try{i=!e(t,r++)}catch(s){n.onError(s);return}i&&n.onNext(t)},n.onError.bind(n),n.onCompleted.bind(n))})},rt.take=function(e,t){if(e<0)throw new Error(h);if(e===0)return ut(t);var n=this;return new bt(function(t){var r=e;return n.subscribe(function(e){r>0&&(r--,t.onNext(e),r===0&&t.onCompleted())},t.onError.bind(t),t.onCompleted.bind(t))})},rt.takeWhile=function(e){var t=this;return new bt(function(n){var r=0,i=!0;return t.subscribe(function(t){if(i){try{i=e(t,r++)}catch(s){n.onError(s);return}i?n.onNext(t):n.onCompleted()}},n.onError.bind(n),n.onCompleted.bind(n))})},rt.where=function(e){var t=this;return new bt(function(n){var r=0;return t.subscribe(function(t){var i;try{i=e(t,r++)}catch(s){n.onError(s);return}i&&n.onNext(t)},n.onError.bind(n),n.onCompleted.bind(n))})};var bt=r.Internals.AnonymousObservable=function(){function e(t){var n=function(e){var n=new wt(e);if(j.scheduleRequired())j.schedule(function(){try{n.disposable(t(n))}catch(e){if(!n.fail(e))throw e}});else try{n.disposable(t(n))}catch(r){if(!n.fail(r))throw r}return n};e.super_.constructor.call(this,n)}return y(e,it),e}(),wt=function(){function e(t){e.super_.constructor.call(this),this.observer=t,this.m=new A}return y(e,Y),e.prototype.next=function(e){var t=!1;try{this.observer.onNext(e),t=!0}finally{t||this.dispose()}},e.prototype.error=function(e){try{this.observer.onError(e)}finally{this.dispose()}},e.prototype.completed=function(){try{this.observer.onCompleted()}finally{this.dispose()}},e.prototype.disposable=function(e){return this.m.disposable(e)},e.prototype.dispose=function(){e.super_.dispose.call(this),this.m.dispose()},e}(),Et=function(){function e(e){return this.underlyingObservable.subscribe(e)}function t(n,r,i){t.super_.constructor.call(this,e),this.key=n,this.underlyingObservable=i?new bt(function(e){return new N(i.getDisposable(),r.subscribe(e))}):r}return y(t,it),t}(),St=function(e,t){this.subject=e,this.observer=t};St.prototype.dispose=function(){if(!this.subject.isDisposed&&this.observer!==null){var e=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(e,1),this.observer=null}};var xt=r.Subject=function(){function e(e){return d.call(this),this.isStopped?this.exception?(e.onError(this.exception),L):(e.onCompleted(),L):(this.observers.push(e),new St(this,e))}function t(){t.super_.constructor.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return y(t,it),b(t.prototype,Q,{onCompleted:function(){d.call(this);if(!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0;for(var t=0,n=e.length;t<n;t++)e[t].onCompleted();this.observers=[]}},onError:function(e){d.call(this);if(!this.isStopped){var t=this.observers.slice(0);this.isStopped=!0,this.exception=e;for(var n=0,r=t.length;n<r;n++)t[n].onError(e);this.observers=[]}},onNext:function(e){d.call(this);if(!this.isStopped){var t=this.observers.slice(0);for(var n=0,r=t.length;n<r;n++)t[n].onNext(e)}},dispose:function(){this.isDisposed=!0,this.observers=null}}),t.create=function(e,t){return new Nt(e,t)},t}(),Tt=r.AsyncSubject=function(){function e(e){d.call(this);if(!this.isStopped)return this.observers.push(e),new St(this,e);var t=this.exception,n=this.hasValue,r=this.value;return t?e.onError(t):n?(e.onNext(r),e.onCompleted()):e.onCompleted(),L}function t(){t.super_.constructor.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return y(t,it),b(t.prototype,Q,{onCompleted:function(){var e,t,n;d.call(this);if(!this.isStopped){var r=this.observers.slice(0);this.isStopped=!0;var i=this.value,s=this.hasValue;if(s)for(t=0,n=r.length;t<n;t++)e=r[t],e.onNext(i),e.onCompleted();else for(t=0,n=r.length;t<n;t++)r[t].onCompleted();this.observers=[]}},onError:function(e){d.call(this);if(!this.isStopped){var t=this.observers.slice(0);this.isStopped=!0,this.exception=e;for(var n=0,r=t.length;n<r;n++)t[n].onError(e);this.observers=[]}},onNext:function(e){d.call(this),this.isStopped||(this.value=e,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),t}(),Nt=function(){function e(e){return this.observable.subscribe(e)}function t(n,r){t.super_.constructor.call(this,e),this.observer=n,this.observable=r}return y(t,it),b(t.prototype,Q,{onCompleted:function(){this.observer.onCompleted()},onError:function(e){this.observer.onError(e)},onNext:function(e){this.observer.onNext(e)}}),t}();if(typeof define=="function"&&typeof define.amd=="object"&&define.amd)return e.Rx=r,define(function(){return r});n?typeof module=="object"&&module&&module.exports==n?module.exports=r:n=r:e.Rx=r})(this);
View
9 rx.node.js
@@ -0,0 +1,9 @@
+var Rx = require('./rx');
+require('./rx.aggregates');
+require('./rx.binding');
+require('./rx.coincidence');
+require('./rx.experimental');
+require('./rx.joinpatterns');
+require('./rx.testing');
+require('./rx.time');
+module.exports = Rx;
Please sign in to comment.
Something went wrong with that request. Please try again.