@reactivex/rxjs
Version:
Reactive Extensions for modern JavaScript
1,367 lines (1,307 loc) • 419 kB
JavaScript
/**
@license
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2015-2016 Netflix, Inc., Microsoft Corp. and contributors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
**/
"format register";
System.register("rxjs/util/root", [], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
"use strict";
var objectTypes = {
'boolean': false,
'function': true,
'object': true,
'number': false,
'string': false,
'undefined': false
};
exports.root = (objectTypes[typeof self] && self) || (objectTypes[typeof window] && window);
var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports;
var freeModule = objectTypes[typeof module] && module && !module.nodeType && module;
var freeGlobal = objectTypes[typeof global] && global;
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) {
exports.root = freeGlobal;
}
global.define = __define;
return module.exports;
});
System.register("rxjs/symbol/observable", ["rxjs/util/root"], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
"use strict";
var root_1 = require("rxjs/util/root");
var Symbol = root_1.root.Symbol;
if (typeof Symbol === 'function') {
if (Symbol.observable) {
exports.$$observable = Symbol.observable;
} else {
if (typeof Symbol.for === 'function') {
exports.$$observable = Symbol.for('observable');
} else {
exports.$$observable = Symbol('observable');
}
Symbol.observable = exports.$$observable;
}
} else {
exports.$$observable = '@@observable';
}
global.define = __define;
return module.exports;
});
System.register("rxjs/util/isFunction", [], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
"use strict";
function isFunction(x) {
return typeof x === 'function';
}
exports.isFunction = isFunction;
global.define = __define;
return module.exports;
});
System.register("rxjs/util/isArray", [], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
"use strict";
exports.isArray = Array.isArray || (function(x) {
return x && typeof x.length === 'number';
});
global.define = __define;
return module.exports;
});
System.register("rxjs/util/isObject", [], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
"use strict";
function isObject(x) {
return x != null && typeof x === 'object';
}
exports.isObject = isObject;
global.define = __define;
return module.exports;
});
System.register("rxjs/util/errorObject", [], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
"use strict";
exports.errorObject = {e: {}};
global.define = __define;
return module.exports;
});
System.register("rxjs/util/UnsubscriptionError", [], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
"use strict";
var __extends = (this && this.__extends) || function(d, b) {
for (var p in b)
if (b.hasOwnProperty(p))
d[p] = b[p];
function __() {
this.constructor = d;
}
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var UnsubscriptionError = (function(_super) {
__extends(UnsubscriptionError, _super);
function UnsubscriptionError(errors) {
_super.call(this);
this.errors = errors;
this.name = 'UnsubscriptionError';
this.message = errors ? errors.length + " errors occurred during unsubscription:\n" + errors.map(function(err, i) {
return ((i + 1) + ") " + err.toString());
}).join('\n') : '';
}
return UnsubscriptionError;
}(Error));
exports.UnsubscriptionError = UnsubscriptionError;
global.define = __define;
return module.exports;
});
System.register("rxjs/symbol/rxSubscriber", ["rxjs/util/root"], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
"use strict";
var root_1 = require("rxjs/util/root");
var Symbol = root_1.root.Symbol;
exports.$$rxSubscriber = (typeof Symbol === 'function' && typeof Symbol.for === 'function') ? Symbol.for('rxSubscriber') : '@@rxSubscriber';
global.define = __define;
return module.exports;
});
System.register("rxjs/Observer", [], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
"use strict";
exports.empty = {
isUnsubscribed: true,
next: function(value) {},
error: function(err) {
throw err;
},
complete: function() {}
};
global.define = __define;
return module.exports;
});
System.register("rxjs/SubjectSubscription", ["rxjs/Subscription"], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
"use strict";
var __extends = (this && this.__extends) || function(d, b) {
for (var p in b)
if (b.hasOwnProperty(p))
d[p] = b[p];
function __() {
this.constructor = d;
}
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Subscription_1 = require("rxjs/Subscription");
var SubjectSubscription = (function(_super) {
__extends(SubjectSubscription, _super);
function SubjectSubscription(subject, observer) {
_super.call(this);
this.subject = subject;
this.observer = observer;
this.isUnsubscribed = false;
}
SubjectSubscription.prototype.unsubscribe = function() {
if (this.isUnsubscribed) {
return ;
}
this.isUnsubscribed = true;
var subject = this.subject;
var observers = subject.observers;
this.subject = null;
if (!observers || observers.length === 0 || subject.isUnsubscribed) {
return ;
}
var subscriberIndex = observers.indexOf(this.observer);
if (subscriberIndex !== -1) {
observers.splice(subscriberIndex, 1);
}
};
return SubjectSubscription;
}(Subscription_1.Subscription));
exports.SubjectSubscription = SubjectSubscription;
global.define = __define;
return module.exports;
});
System.register("rxjs/util/throwError", [], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
"use strict";
function throwError(e) {
throw e;
}
exports.throwError = throwError;
global.define = __define;
return module.exports;
});
System.register("rxjs/util/ObjectUnsubscribedError", [], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
"use strict";
var __extends = (this && this.__extends) || function(d, b) {
for (var p in b)
if (b.hasOwnProperty(p))
d[p] = b[p];
function __() {
this.constructor = d;
}
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var ObjectUnsubscribedError = (function(_super) {
__extends(ObjectUnsubscribedError, _super);
function ObjectUnsubscribedError() {
_super.call(this, 'object unsubscribed');
this.name = 'ObjectUnsubscribedError';
}
return ObjectUnsubscribedError;
}(Error));
exports.ObjectUnsubscribedError = ObjectUnsubscribedError;
global.define = __define;
return module.exports;
});
System.register("rxjs/AsyncSubject", ["rxjs/Subject"], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
"use strict";
var __extends = (this && this.__extends) || function(d, b) {
for (var p in b)
if (b.hasOwnProperty(p))
d[p] = b[p];
function __() {
this.constructor = d;
}
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Subject_1 = require("rxjs/Subject");
var AsyncSubject = (function(_super) {
__extends(AsyncSubject, _super);
function AsyncSubject() {
_super.apply(this, arguments);
this.value = null;
this.hasNext = false;
}
AsyncSubject.prototype._subscribe = function(subscriber) {
if (this.hasCompleted && this.hasNext) {
subscriber.next(this.value);
}
return _super.prototype._subscribe.call(this, subscriber);
};
AsyncSubject.prototype._next = function(value) {
this.value = value;
this.hasNext = true;
};
AsyncSubject.prototype._complete = function() {
var index = -1;
var observers = this.observers;
var len = observers.length;
this.isUnsubscribed = true;
if (this.hasNext) {
while (++index < len) {
var o = observers[index];
o.next(this.value);
o.complete();
}
} else {
while (++index < len) {
observers[index].complete();
}
}
this.isUnsubscribed = false;
this.unsubscribe();
};
return AsyncSubject;
}(Subject_1.Subject));
exports.AsyncSubject = AsyncSubject;
global.define = __define;
return module.exports;
});
System.register("rxjs/observable/BoundNodeCallbackObservable", ["rxjs/Observable", "rxjs/util/tryCatch", "rxjs/util/errorObject", "rxjs/AsyncSubject"], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
"use strict";
var __extends = (this && this.__extends) || function(d, b) {
for (var p in b)
if (b.hasOwnProperty(p))
d[p] = b[p];
function __() {
this.constructor = d;
}
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Observable_1 = require("rxjs/Observable");
var tryCatch_1 = require("rxjs/util/tryCatch");
var errorObject_1 = require("rxjs/util/errorObject");
var AsyncSubject_1 = require("rxjs/AsyncSubject");
var BoundNodeCallbackObservable = (function(_super) {
__extends(BoundNodeCallbackObservable, _super);
function BoundNodeCallbackObservable(callbackFunc, selector, args, scheduler) {
_super.call(this);
this.callbackFunc = callbackFunc;
this.selector = selector;
this.args = args;
this.scheduler = scheduler;
}
BoundNodeCallbackObservable.create = function(callbackFunc, selector, scheduler) {
if (selector === void 0) {
selector = undefined;
}
return function() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i - 0] = arguments[_i];
}
return new BoundNodeCallbackObservable(callbackFunc, selector, args, scheduler);
};
};
BoundNodeCallbackObservable.prototype._subscribe = function(subscriber) {
var callbackFunc = this.callbackFunc;
var args = this.args;
var scheduler = this.scheduler;
var subject = this.subject;
if (!scheduler) {
if (!subject) {
subject = this.subject = new AsyncSubject_1.AsyncSubject();
var handler = function handlerFn() {
var innerArgs = [];
for (var _i = 0; _i < arguments.length; _i++) {
innerArgs[_i - 0] = arguments[_i];
}
var source = handlerFn.source;
var selector = source.selector,
subject = source.subject;
var err = innerArgs.shift();
if (err) {
subject.error(err);
} else if (selector) {
var result_1 = tryCatch_1.tryCatch(selector).apply(this, innerArgs);
if (result_1 === errorObject_1.errorObject) {
subject.error(errorObject_1.errorObject.e);
} else {
subject.next(result_1);
subject.complete();
}
} else {
subject.next(innerArgs.length === 1 ? innerArgs[0] : innerArgs);
subject.complete();
}
};
handler.source = this;
var result = tryCatch_1.tryCatch(callbackFunc).apply(this, args.concat(handler));
if (result === errorObject_1.errorObject) {
subject.error(errorObject_1.errorObject.e);
}
}
return subject.subscribe(subscriber);
} else {
return scheduler.schedule(dispatch, 0, {
source: this,
subscriber: subscriber
});
}
};
return BoundNodeCallbackObservable;
}(Observable_1.Observable));
exports.BoundNodeCallbackObservable = BoundNodeCallbackObservable;
function dispatch(state) {
var self = this;
var source = state.source,
subscriber = state.subscriber;
var callbackFunc = source.callbackFunc,
args = source.args,
scheduler = source.scheduler;
var subject = source.subject;
if (!subject) {
subject = source.subject = new AsyncSubject_1.AsyncSubject();
var handler = function handlerFn() {
var innerArgs = [];
for (var _i = 0; _i < arguments.length; _i++) {
innerArgs[_i - 0] = arguments[_i];
}
var source = handlerFn.source;
var selector = source.selector,
subject = source.subject;
var err = innerArgs.shift();
if (err) {
subject.error(err);
} else if (selector) {
var result_2 = tryCatch_1.tryCatch(selector).apply(this, innerArgs);
if (result_2 === errorObject_1.errorObject) {
self.add(scheduler.schedule(dispatchError, 0, {
err: errorObject_1.errorObject.e,
subject: subject
}));
} else {
self.add(scheduler.schedule(dispatchNext, 0, {
value: result_2,
subject: subject
}));
}
} else {
var value = innerArgs.length === 1 ? innerArgs[0] : innerArgs;
self.add(scheduler.schedule(dispatchNext, 0, {
value: value,
subject: subject
}));
}
};
handler.source = source;
var result = tryCatch_1.tryCatch(callbackFunc).apply(this, args.concat(handler));
if (result === errorObject_1.errorObject) {
subject.error(errorObject_1.errorObject.e);
}
}
self.add(subject.subscribe(subscriber));
}
function dispatchNext(arg) {
var value = arg.value,
subject = arg.subject;
subject.next(value);
subject.complete();
}
function dispatchError(arg) {
var err = arg.err,
subject = arg.subject;
subject.error(err);
}
global.define = __define;
return module.exports;
});
System.register("rxjs/observable/ScalarObservable", ["rxjs/Observable"], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
"use strict";
var __extends = (this && this.__extends) || function(d, b) {
for (var p in b)
if (b.hasOwnProperty(p))
d[p] = b[p];
function __() {
this.constructor = d;
}
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Observable_1 = require("rxjs/Observable");
var ScalarObservable = (function(_super) {
__extends(ScalarObservable, _super);
function ScalarObservable(value, scheduler) {
_super.call(this);
this.value = value;
this.scheduler = scheduler;
this._isScalar = true;
}
ScalarObservable.create = function(value, scheduler) {
return new ScalarObservable(value, scheduler);
};
ScalarObservable.dispatch = function(state) {
var done = state.done,
value = state.value,
subscriber = state.subscriber;
if (done) {
subscriber.complete();
return ;
}
subscriber.next(value);
if (subscriber.isUnsubscribed) {
return ;
}
state.done = true;
this.schedule(state);
};
ScalarObservable.prototype._subscribe = function(subscriber) {
var value = this.value;
var scheduler = this.scheduler;
if (scheduler) {
return scheduler.schedule(ScalarObservable.dispatch, 0, {
done: false,
value: value,
subscriber: subscriber
});
} else {
subscriber.next(value);
if (!subscriber.isUnsubscribed) {
subscriber.complete();
}
}
};
return ScalarObservable;
}(Observable_1.Observable));
exports.ScalarObservable = ScalarObservable;
global.define = __define;
return module.exports;
});
System.register("rxjs/observable/EmptyObservable", ["rxjs/Observable"], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
"use strict";
var __extends = (this && this.__extends) || function(d, b) {
for (var p in b)
if (b.hasOwnProperty(p))
d[p] = b[p];
function __() {
this.constructor = d;
}
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Observable_1 = require("rxjs/Observable");
var EmptyObservable = (function(_super) {
__extends(EmptyObservable, _super);
function EmptyObservable(scheduler) {
_super.call(this);
this.scheduler = scheduler;
}
EmptyObservable.create = function(scheduler) {
return new EmptyObservable(scheduler);
};
EmptyObservable.dispatch = function(arg) {
var subscriber = arg.subscriber;
subscriber.complete();
};
EmptyObservable.prototype._subscribe = function(subscriber) {
var scheduler = this.scheduler;
if (scheduler) {
return scheduler.schedule(EmptyObservable.dispatch, 0, {subscriber: subscriber});
} else {
subscriber.complete();
}
};
return EmptyObservable;
}(Observable_1.Observable));
exports.EmptyObservable = EmptyObservable;
global.define = __define;
return module.exports;
});
System.register("rxjs/util/isScheduler", [], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
"use strict";
function isScheduler(value) {
return value && typeof value.schedule === 'function';
}
exports.isScheduler = isScheduler;
global.define = __define;
return module.exports;
});
System.register("rxjs/OuterSubscriber", ["rxjs/Subscriber"], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
"use strict";
var __extends = (this && this.__extends) || function(d, b) {
for (var p in b)
if (b.hasOwnProperty(p))
d[p] = b[p];
function __() {
this.constructor = d;
}
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Subscriber_1 = require("rxjs/Subscriber");
var OuterSubscriber = (function(_super) {
__extends(OuterSubscriber, _super);
function OuterSubscriber() {
_super.apply(this, arguments);
}
OuterSubscriber.prototype.notifyNext = function(outerValue, innerValue, outerIndex, innerIndex, innerSub) {
this.destination.next(innerValue);
};
OuterSubscriber.prototype.notifyError = function(error, innerSub) {
this.destination.error(error);
};
OuterSubscriber.prototype.notifyComplete = function(innerSub) {
this.destination.complete();
};
return OuterSubscriber;
}(Subscriber_1.Subscriber));
exports.OuterSubscriber = OuterSubscriber;
global.define = __define;
return module.exports;
});
System.register("rxjs/util/isPromise", [], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
"use strict";
function isPromise(value) {
return value && typeof value.subscribe !== 'function' && typeof value.then === 'function';
}
exports.isPromise = isPromise;
global.define = __define;
return module.exports;
});
System.register("rxjs/symbol/iterator", ["rxjs/util/root"], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
"use strict";
var root_1 = require("rxjs/util/root");
var Symbol = root_1.root.Symbol;
if (typeof Symbol === 'function') {
if (Symbol.iterator) {
exports.$$iterator = Symbol.iterator;
} else if (typeof Symbol.for === 'function') {
exports.$$iterator = Symbol.for('iterator');
}
} else {
if (root_1.root.Set && typeof new root_1.root.Set()['@@iterator'] === 'function') {
exports.$$iterator = '@@iterator';
} else if (root_1.root.Map) {
var keys = Object.getOwnPropertyNames(root_1.root.Map.prototype);
for (var i = 0; i < keys.length; ++i) {
var key = keys[i];
if (key !== 'entries' && key !== 'size' && root_1.root.Map.prototype[key] === root_1.root.Map.prototype['entries']) {
exports.$$iterator = key;
break;
}
}
} else {
exports.$$iterator = '@@iterator';
}
}
global.define = __define;
return module.exports;
});
System.register("rxjs/InnerSubscriber", ["rxjs/Subscriber"], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
"use strict";
var __extends = (this && this.__extends) || function(d, b) {
for (var p in b)
if (b.hasOwnProperty(p))
d[p] = b[p];
function __() {
this.constructor = d;
}
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Subscriber_1 = require("rxjs/Subscriber");
var InnerSubscriber = (function(_super) {
__extends(InnerSubscriber, _super);
function InnerSubscriber(parent, outerValue, outerIndex) {
_super.call(this);
this.parent = parent;
this.outerValue = outerValue;
this.outerIndex = outerIndex;
this.index = 0;
}
InnerSubscriber.prototype._next = function(value) {
this.parent.notifyNext(this.outerValue, value, this.outerIndex, this.index++, this);
};
InnerSubscriber.prototype._error = function(error) {
this.parent.notifyError(error, this);
this.unsubscribe();
};
InnerSubscriber.prototype._complete = function() {
this.parent.notifyComplete(this);
this.unsubscribe();
};
return InnerSubscriber;
}(Subscriber_1.Subscriber));
exports.InnerSubscriber = InnerSubscriber;
global.define = __define;
return module.exports;
});
System.register("rxjs/operator/mergeAll", ["rxjs/OuterSubscriber", "rxjs/util/subscribeToResult"], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
"use strict";
var __extends = (this && this.__extends) || function(d, b) {
for (var p in b)
if (b.hasOwnProperty(p))
d[p] = b[p];
function __() {
this.constructor = d;
}
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var OuterSubscriber_1 = require("rxjs/OuterSubscriber");
var subscribeToResult_1 = require("rxjs/util/subscribeToResult");
function mergeAll(concurrent) {
if (concurrent === void 0) {
concurrent = Number.POSITIVE_INFINITY;
}
return this.lift(new MergeAllOperator(concurrent));
}
exports.mergeAll = mergeAll;
var MergeAllOperator = (function() {
function MergeAllOperator(concurrent) {
this.concurrent = concurrent;
}
MergeAllOperator.prototype.call = function(observer, source) {
return source._subscribe(new MergeAllSubscriber(observer, this.concurrent));
};
return MergeAllOperator;
}());
exports.MergeAllOperator = MergeAllOperator;
var MergeAllSubscriber = (function(_super) {
__extends(MergeAllSubscriber, _super);
function MergeAllSubscriber(destination, concurrent) {
_super.call(this, destination);
this.concurrent = concurrent;
this.hasCompleted = false;
this.buffer = [];
this.active = 0;
}
MergeAllSubscriber.prototype._next = function(observable) {
if (this.active < this.concurrent) {
this.active++;
this.add(subscribeToResult_1.subscribeToResult(this, observable));
} else {
this.buffer.push(observable);
}
};
MergeAllSubscriber.prototype._complete = function() {
this.hasCompleted = true;
if (this.active === 0 && this.buffer.length === 0) {
this.destination.complete();
}
};
MergeAllSubscriber.prototype.notifyComplete = function(innerSub) {
var buffer = this.buffer;
this.remove(innerSub);
this.active--;
if (buffer.length > 0) {
this._next(buffer.shift());
} else if (this.active === 0 && this.hasCompleted) {
this.destination.complete();
}
};
return MergeAllSubscriber;
}(OuterSubscriber_1.OuterSubscriber));
exports.MergeAllSubscriber = MergeAllSubscriber;
global.define = __define;
return module.exports;
});
System.register("rxjs/observable/DeferObservable", ["rxjs/Observable", "rxjs/util/subscribeToResult", "rxjs/OuterSubscriber"], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
"use strict";
var __extends = (this && this.__extends) || function(d, b) {
for (var p in b)
if (b.hasOwnProperty(p))
d[p] = b[p];
function __() {
this.constructor = d;
}
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Observable_1 = require("rxjs/Observable");
var subscribeToResult_1 = require("rxjs/util/subscribeToResult");
var OuterSubscriber_1 = require("rxjs/OuterSubscriber");
var DeferObservable = (function(_super) {
__extends(DeferObservable, _super);
function DeferObservable(observableFactory) {
_super.call(this);
this.observableFactory = observableFactory;
}
DeferObservable.create = function(observableFactory) {
return new DeferObservable(observableFactory);
};
DeferObservable.prototype._subscribe = function(subscriber) {
return new DeferSubscriber(subscriber, this.observableFactory);
};
return DeferObservable;
}(Observable_1.Observable));
exports.DeferObservable = DeferObservable;
var DeferSubscriber = (function(_super) {
__extends(DeferSubscriber, _super);
function DeferSubscriber(destination, factory) {
_super.call(this, destination);
this.factory = factory;
this.tryDefer();
}
DeferSubscriber.prototype.tryDefer = function() {
try {
this._callFactory();
} catch (err) {
this._error(err);
}
};
DeferSubscriber.prototype._callFactory = function() {
var result = this.factory();
if (result) {
this.add(subscribeToResult_1.subscribeToResult(this, result));
}
};
return DeferSubscriber;
}(OuterSubscriber_1.OuterSubscriber));
global.define = __define;
return module.exports;
});
System.register("rxjs/observable/empty", ["rxjs/observable/EmptyObservable"], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
"use strict";
var EmptyObservable_1 = require("rxjs/observable/EmptyObservable");
exports.empty = EmptyObservable_1.EmptyObservable.create;
global.define = __define;
return module.exports;
});
System.register("rxjs/observable/ForkJoinObservable", ["rxjs/Observable", "rxjs/observable/EmptyObservable", "rxjs/util/isArray", "rxjs/util/subscribeToResult", "rxjs/OuterSubscriber"], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
"use strict";
var __extends = (this && this.__extends) || function(d, b) {
for (var p in b)
if (b.hasOwnProperty(p))
d[p] = b[p];
function __() {
this.constructor = d;
}
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Observable_1 = require("rxjs/Observable");
var EmptyObservable_1 = require("rxjs/observable/EmptyObservable");
var isArray_1 = require("rxjs/util/isArray");
var subscribeToResult_1 = require("rxjs/util/subscribeToResult");
var OuterSubscriber_1 = require("rxjs/OuterSubscriber");
var ForkJoinObservable = (function(_super) {
__extends(ForkJoinObservable, _super);
function ForkJoinObservable(sources, resultSelector) {
_super.call(this);
this.sources = sources;
this.resultSelector = resultSelector;
}
ForkJoinObservable.create = function() {
var sources = [];
for (var _i = 0; _i < arguments.length; _i++) {
sources[_i - 0] = arguments[_i];
}
if (sources === null || arguments.length === 0) {
return new EmptyObservable_1.EmptyObservable();
}
var resultSelector = null;
if (typeof sources[sources.length - 1] === 'function') {
resultSelector = sources.pop();
}
if (sources.length === 1 && isArray_1.isArray(sources[0])) {
sources = sources[0];
}
if (sources.length === 0) {
return new EmptyObservable_1.EmptyObservable();
}
return new ForkJoinObservable(sources, resultSelector);
};
ForkJoinObservable.prototype._subscribe = function(subscriber) {
return new ForkJoinSubscriber(subscriber, this.sources, this.resultSelector);
};
return ForkJoinObservable;
}(Observable_1.Observable));
exports.ForkJoinObservable = ForkJoinObservable;
var ForkJoinSubscriber = (function(_super) {
__extends(ForkJoinSubscriber, _super);
function ForkJoinSubscriber(destination, sources, resultSelector) {
_super.call(this, destination);
this.sources = sources;
this.resultSelector = resultSelector;
this.completed = 0;
this.haveValues = 0;
var len = sources.length;
this.total = len;
this.values = new Array(len);
for (var i = 0; i < len; i++) {
var source = sources[i];
var innerSubscription = subscribeToResult_1.subscribeToResult(this, source, null, i);
if (innerSubscription) {
innerSubscription.outerIndex = i;
this.add(innerSubscription);
}
}
}
ForkJoinSubscriber.prototype.notifyNext = function(outerValue, innerValue, outerIndex, innerIndex, innerSub) {
this.values[outerIndex] = innerValue;
if (!innerSub._hasValue) {
innerSub._hasValue = true;
this.haveValues++;
}
};
ForkJoinSubscriber.prototype.notifyComplete = function(innerSub) {
var destination = this.destination;
var _a = this,
haveValues = _a.haveValues,
resultSelector = _a.resultSelector,
values = _a.values;
var len = values.length;
if (!innerSub._hasValue) {
destination.complete();
return ;
}
this.completed++;
if (this.completed !== len) {
return ;
}
if (haveValues === len) {
var value = resultSelector ? resultSelector.apply(this, values) : values;
destination.next(value);
}
destination.complete();
};
return ForkJoinSubscriber;
}(OuterSubscriber_1.OuterSubscriber));
global.define = __define;
return module.exports;
});
System.register("rxjs/observable/PromiseObservable", ["rxjs/util/root", "rxjs/Observable"], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
"use strict";
var __extends = (this && this.__extends) || function(d, b) {
for (var p in b)
if (b.hasOwnProperty(p))
d[p] = b[p];
function __() {
this.constructor = d;
}
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var root_1 = require("rxjs/util/root");
var Observable_1 = require("rxjs/Observable");
var PromiseObservable = (function(_super) {
__extends(PromiseObservable, _super);
function PromiseObservable(promise, scheduler) {
if (scheduler === void 0) {
scheduler = null;
}
_super.call(this);
this.promise = promise;
this.scheduler = scheduler;
}
PromiseObservable.create = function(promise, scheduler) {
if (scheduler === void 0) {
scheduler = null;
}
return new PromiseObservable(promise, scheduler);
};
PromiseObservable.prototype._subscribe = function(subscriber) {
var _this = this;
var promise = this.promise;
var scheduler = this.scheduler;
if (scheduler == null) {
if (this._isScalar) {
if (!subscriber.isUnsubscribed) {
subscriber.next(this.value);
subscriber.complete();
}
} else {
promise.then(function(value) {
_this.value = value;
_this._isScalar = true;
if (!subscriber.isUnsubscribed) {
subscriber.next(value);
subscriber.complete();
}
}, function(err) {
if (!subscriber.isUnsubscribed) {
subscriber.error(err);
}
}).then(null, function(err) {
root_1.root.setTimeout(function() {
throw err;
});
});
}
} else {
if (this._isScalar) {
if (!subscriber.isUnsubscribed) {
return scheduler.schedule(dispatchNext, 0, {
value: this.value,
subscriber: subscriber
});
}
} else {
promise.then(function(value) {
_this.value = value;
_this._isScalar = true;
if (!subscriber.isUnsubscribed) {
subscriber.add(scheduler.schedule(dispatchNext, 0, {
value: value,
subscriber: subscriber
}));
}
}, function(err) {
if (!subscriber.isUnsubscribed) {
subscriber.add(scheduler.schedule(dispatchError, 0, {
err: err,
subscriber: subscriber
}));
}
}).then(null, function(err) {
root_1.root.setTimeout(function() {
throw err;
});
});
}
}
};
return PromiseObservable;
}(Observable_1.Observable));
exports.PromiseObservable = PromiseObservable;
function dispatchNext(arg) {
var value = arg.value,
subscriber = arg.subscriber;
if (!subscriber.isUnsubscribed) {
subscriber.next(value);
subscriber.complete();
}
}
function dispatchError(arg) {
var err = arg.err,
subscriber = arg.subscriber;
if (!subscriber.isUnsubscribed) {
subscriber.error(err);
}
}
global.define = __define;
return module.exports;
});
System.register("rxjs/observable/IteratorObservable", ["rxjs/util/root", "rxjs/util/isObject", "rxjs/util/tryCatch", "rxjs/Observable", "rxjs/util/isFunction", "rxjs/symbol/iterator", "rxjs/util/errorObject"], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
"use strict";
var __extends = (this && this.__extends) || function(d, b) {
for (var p in b)
if (b.hasOwnProperty(p))
d[p] = b[p];
function __() {
this.constructor = d;
}
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var root_1 = require("rxjs/util/root");
var isObject_1 = require("rxjs/util/isObject");
var tryCatch_1 = require("rxjs/util/tryCatch");
var Observable_1 = require("rxjs/Observable");
var isFunction_1 = require("rxjs/util/isFunction");
var iterator_1 = require("rxjs/symbol/iterator");
var errorObject_1 = require("rxjs/util/errorObject");
var IteratorObservable = (function(_super) {
__extends(IteratorObservable, _super);
function IteratorObservable(iterator, project, thisArg, scheduler) {
_super.call(this);
if (iterator == null) {
throw new Error('iterator cannot be null.');
}
if (isObject_1.isObject(project)) {
this.thisArg = project;
this.scheduler = thisArg;
} else if (isFunction_1.isFunction(project)) {
this.project = project;
this.thisArg = thisArg;
this.scheduler = scheduler;
} else if (project != null) {
throw new Error('When provided, `project` must be a function.');
}
this.iterator = getIterator(iterator);
}
IteratorObservable.create = function(iterator, project, thisArg, scheduler) {
return new IteratorObservable(iterator, project, thisArg, scheduler);
};
IteratorObservable.dispatch = function(state) {
var index = state.index,
hasError = state.hasError,
thisArg = state.thisArg,
project = state.project,
iterator = state.iterator,
subscriber = state.subscriber;
if (hasError) {
subscriber.error(state.error);
return ;
}
var result = iterator.next();
if (result.done) {
subscriber.complete();
return ;
}
if (project) {
result = tryCatch_1.tryCatch(project).call(thisArg, result.value, index);
if (result === errorObject_1.errorObject) {
state.error = errorObject_1.errorObject.e;
state.hasError = true;
} else {
subscriber.next(result);
state.index = index + 1;
}
} else {
subscriber.next(result.value);
state.index = index + 1;
}
if (subscriber.isUnsubscribed) {
return ;
}
this.schedule(state);
};
IteratorObservable.prototype._subscribe = function(subscriber) {
var index = 0;
var _a = this,
iterator = _a.iterator,
project = _a.project,
thisArg = _a.thisArg,
scheduler = _a.scheduler;
if (scheduler) {
return scheduler.schedule(IteratorObservable.dispatch, 0, {
index: index,
thisArg: thisArg,
project: project,
iterator: iterator,
subscriber: subscriber
});
} else {
do {
var result = iterator.next();
if (result.done) {
subscriber.complete();
break;
} else if (project) {