+
+ if (start > end) return [];
+ return arr.slice(start, end - start + 1);
+ }
+
+ var fromParts = trim(from.split('/'));
+ var toParts = trim(to.split('/'));
+
+ var length = Math.min(fromParts.length, toParts.length);
+ var samePartsLength = length;
+ for (var i = 0; i < length; i++) {
+ if (fromParts[i] !== toParts[i]) {
+ samePartsLength = i;
+ break;
+ }
+ }
+
+ var outputParts = [];
+ for (var i = samePartsLength; i < fromParts.length; i++) {
+ outputParts.push('..');
+ }
+
+ outputParts = outputParts.concat(toParts.slice(samePartsLength));
+
+ return outputParts.join('/');
+};
+
+exports.sep = '/';
+exports.delimiter = ':';
+
+exports.dirname = function(path) {
+ var result = splitPath(path),
+ root = result[0],
+ dir = result[1];
+
+ if (!root && !dir) {
+ // No dirname whatsoever
+ return '.';
+ }
+
+ if (dir) {
+ // It has a dirname, strip trailing slash
+ dir = dir.substr(0, dir.length - 1);
+ }
+
+ return root + dir;
+};
+
+
+exports.basename = function(path, ext) {
+ var f = splitPath(path)[2];
+ // TODO: make this comparison case-insensitive on windows?
+ if (ext && f.substr(-1 * ext.length) === ext) {
+ f = f.substr(0, f.length - ext.length);
+ }
+ return f;
+};
+
+
+exports.extname = function(path) {
+ return splitPath(path)[3];
+};
+
+function filter (xs, f) {
+ if (xs.filter) return xs.filter(f);
+ var res = [];
+ for (var i = 0; i < xs.length; i++) {
+ if (f(xs[i], i, xs)) res.push(xs[i]);
+ }
+ return res;
+}
+
+// String.prototype.substr - negative index don't work in IE8
+var substr = 'ab'.substr(-1) === 'b'
+ ? function (str, start, len) { return str.substr(start, len) }
+ : function (str, start, len) {
+ if (start < 0) start = str.length + start;
+ return str.substr(start, len);
+ }
+;
+
+}).call(this,require('_process'))
+
+},{"_process":7}],40:[function(require,module,exports){
+'use strict';
+
+module.exports = Pbf;
+
+var ieee754 = require('ieee754');
+
+function Pbf(buf) {
+ this.buf = ArrayBuffer.isView && ArrayBuffer.isView(buf) ? buf : new Uint8Array(buf || 0);
+ this.pos = 0;
+ this.type = 0;
+ this.length = this.buf.length;
+}
+
+Pbf.Varint = 0; // varint: int32, int64, uint32, uint64, sint32, sint64, bool, enum
+Pbf.Fixed64 = 1; // 64-bit: double, fixed64, sfixed64
+Pbf.Bytes = 2; // length-delimited: string, bytes, embedded messages, packed repeated fields
+Pbf.Fixed32 = 5; // 32-bit: float, fixed32, sfixed32
+
+var SHIFT_LEFT_32 = (1 << 16) * (1 << 16),
+ SHIFT_RIGHT_32 = 1 / SHIFT_LEFT_32;
+
+// Threshold chosen based on both benchmarking and knowledge about browser string
+// data structures (which currently switch structure types at 12 bytes or more)
+var TEXT_DECODER_MIN_LENGTH = 12;
+var utf8TextDecoder = typeof TextDecoder === 'undefined' ? null : new TextDecoder('utf8');
+
+Pbf.prototype = {
+
+ destroy: function() {
+ this.buf = null;
+ },
+
+ // === READING =================================================================
+
+ readFields: function(readField, result, end) {
+ end = end || this.length;
+
+ while (this.pos < end) {
+ var val = this.readVarint(),
+ tag = val >> 3,
+ startPos = this.pos;
+
+ this.type = val & 0x7;
+ readField(tag, result, this);
+
+ if (this.pos === startPos) this.skip(val);
+ }
+ return result;
+ },
+
+ readMessage: function(readField, result) {
+ return this.readFields(readField, result, this.readVarint() + this.pos);
+ },
+
+ readFixed32: function() {
+ var val = readUInt32(this.buf, this.pos);
+ this.pos += 4;
+ return val;
+ },
+
+ readSFixed32: function() {
+ var val = readInt32(this.buf, this.pos);
+ this.pos += 4;
+ return val;
+ },
+
+ // 64-bit int handling is based on github.com/dpw/node-buffer-more-ints (MIT-licensed)
+
+ readFixed64: function() {
+ var val = readUInt32(this.buf, this.pos) + readUInt32(this.buf, this.pos + 4) * SHIFT_LEFT_32;
+ this.pos += 8;
+ return val;
+ },
+
+ readSFixed64: function() {
+ var val = readUInt32(this.buf, this.pos) + readInt32(this.buf, this.pos + 4) * SHIFT_LEFT_32;
+ this.pos += 8;
+ return val;
+ },
+
+ readFloat: function() {
+ var val = ieee754.read(this.buf, this.pos, true, 23, 4);
+ this.pos += 4;
+ return val;
+ },
+
+ readDouble: function() {
+ var val = ieee754.read(this.buf, this.pos, true, 52, 8);
+ this.pos += 8;
+ return val;
+ },
+
+ readVarint: function(isSigned) {
+ var buf = this.buf,
+ val, b;
+
+ b = buf[this.pos++]; val = b & 0x7f; if (b < 0x80) return val;
+ b = buf[this.pos++]; val |= (b & 0x7f) << 7; if (b < 0x80) return val;
+ b = buf[this.pos++]; val |= (b & 0x7f) << 14; if (b < 0x80) return val;
+ b = buf[this.pos++]; val |= (b & 0x7f) << 21; if (b < 0x80) return val;
+ b = buf[this.pos]; val |= (b & 0x0f) << 28;
+
+ return readVarintRemainder(val, isSigned, this);
+ },
+
+ readVarint64: function() { // for compatibility with v2.0.1
+ return this.readVarint(true);
+ },
+
+ readSVarint: function() {
+ var num = this.readVarint();
+ return num % 2 === 1 ? (num + 1) / -2 : num / 2; // zigzag encoding
+ },
+
+ readBoolean: function() {
+ return Boolean(this.readVarint());
+ },
+
+ readString: function() {
+ var end = this.readVarint() + this.pos;
+ var pos = this.pos;
+ this.pos = end;
+
+ if (end - pos >= TEXT_DECODER_MIN_LENGTH && utf8TextDecoder) {
+ // longer strings are fast with the built-in browser TextDecoder API
+ return readUtf8TextDecoder(this.buf, pos, end);
+ }
+ // short strings are fast with our custom implementation
+ return readUtf8(this.buf, pos, end);
+ },
+
+ readBytes: function() {
+ var end = this.readVarint() + this.pos,
+ buffer = this.buf.subarray(this.pos, end);
+ this.pos = end;
+ return buffer;
+ },
+
+ // verbose for performance reasons; doesn't affect gzipped size
+
+ readPackedVarint: function(arr, isSigned) {
+ if (this.type !== Pbf.Bytes) return arr.push(this.readVarint(isSigned));
+ var end = readPackedEnd(this);
+ arr = arr || [];
+ while (this.pos < end) arr.push(this.readVarint(isSigned));
+ return arr;
+ },
+ readPackedSVarint: function(arr) {
+ if (this.type !== Pbf.Bytes) return arr.push(this.readSVarint());
+ var end = readPackedEnd(this);
+ arr = arr || [];
+ while (this.pos < end) arr.push(this.readSVarint());
+ return arr;
+ },
+ readPackedBoolean: function(arr) {
+ if (this.type !== Pbf.Bytes) return arr.push(this.readBoolean());
+ var end = readPackedEnd(this);
+ arr = arr || [];
+ while (this.pos < end) arr.push(this.readBoolean());
+ return arr;
+ },
+ readPackedFloat: function(arr) {
+ if (this.type !== Pbf.Bytes) return arr.push(this.readFloat());
+ var end = readPackedEnd(this);
+ arr = arr || [];
+ while (this.pos < end) arr.push(this.readFloat());
+ return arr;
+ },
+ readPackedDouble: function(arr) {
+ if (this.type !== Pbf.Bytes) return arr.push(this.readDouble());
+ var end = readPackedEnd(this);
+ arr = arr || [];
+ while (this.pos < end) arr.push(this.readDouble());
+ return arr;
+ },
+ readPackedFixed32: function(arr) {
+ if (this.type !== Pbf.Bytes) return arr.push(this.readFixed32());
+ var end = readPackedEnd(this);
+ arr = arr || [];
+ while (this.pos < end) arr.push(this.readFixed32());
+ return arr;
+ },
+ readPackedSFixed32: function(arr) {
+ if (this.type !== Pbf.Bytes) return arr.push(this.readSFixed32());
+ var end = readPackedEnd(this);
+ arr = arr || [];
+ while (this.pos < end) arr.push(this.readSFixed32());
+ return arr;
+ },
+ readPackedFixed64: function(arr) {
+ if (this.type !== Pbf.Bytes) return arr.push(this.readFixed64());
+ var end = readPackedEnd(this);
+ arr = arr || [];
+ while (this.pos < end) arr.push(this.readFixed64());
+ return arr;
+ },
+ readPackedSFixed64: function(arr) {
+ if (this.type !== Pbf.Bytes) return arr.push(this.readSFixed64());
+ var end = readPackedEnd(this);
+ arr = arr || [];
+ while (this.pos < end) arr.push(this.readSFixed64());
+ return arr;
+ },
+
+ skip: function(val) {
+ var type = val & 0x7;
+ if (type === Pbf.Varint) while (this.buf[this.pos++] > 0x7f) {}
+ else if (type === Pbf.Bytes) this.pos = this.readVarint() + this.pos;
+ else if (type === Pbf.Fixed32) this.pos += 4;
+ else if (type === Pbf.Fixed64) this.pos += 8;
+ else throw new Error('Unimplemented type: ' + type);
+ },
+
+ // === WRITING =================================================================
+
+ writeTag: function(tag, type) {
+ this.writeVarint((tag << 3) | type);
+ },
+
+ realloc: function(min) {
+ var length = this.length || 16;
+
+ while (length < this.pos + min) length *= 2;
+
+ if (length !== this.length) {
+ var buf = new Uint8Array(length);
+ buf.set(this.buf);
+ this.buf = buf;
+ this.length = length;
+ }
+ },
+
+ finish: function() {
+ this.length = this.pos;
+ this.pos = 0;
+ return this.buf.subarray(0, this.length);
+ },
+
+ writeFixed32: function(val) {
+ this.realloc(4);
+ writeInt32(this.buf, val, this.pos);
+ this.pos += 4;
+ },
+
+ writeSFixed32: function(val) {
+ this.realloc(4);
+ writeInt32(this.buf, val, this.pos);
+ this.pos += 4;
+ },
+
+ writeFixed64: function(val) {
+ this.realloc(8);
+ writeInt32(this.buf, val & -1, this.pos);
+ writeInt32(this.buf, Math.floor(val * SHIFT_RIGHT_32), this.pos + 4);
+ this.pos += 8;
+ },
+
+ writeSFixed64: function(val) {
+ this.realloc(8);
+ writeInt32(this.buf, val & -1, this.pos);
+ writeInt32(this.buf, Math.floor(val * SHIFT_RIGHT_32), this.pos + 4);
+ this.pos += 8;
+ },
+
+ writeVarint: function(val) {
+ val = +val || 0;
+
+ if (val > 0xfffffff || val < 0) {
+ writeBigVarint(val, this);
+ return;
+ }
+
+ this.realloc(4);
+
+ this.buf[this.pos++] = val & 0x7f | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return;
+ this.buf[this.pos++] = ((val >>>= 7) & 0x7f) | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return;
+ this.buf[this.pos++] = ((val >>>= 7) & 0x7f) | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return;
+ this.buf[this.pos++] = (val >>> 7) & 0x7f;
+ },
+
+ writeSVarint: function(val) {
+ this.writeVarint(val < 0 ? -val * 2 - 1 : val * 2);
+ },
+
+ writeBoolean: function(val) {
+ this.writeVarint(Boolean(val));
+ },
+
+ writeString: function(str) {
+ str = String(str);
+ this.realloc(str.length * 4);
+
+ this.pos++; // reserve 1 byte for short string length
+
+ var startPos = this.pos;
+ // write the string directly to the buffer and see how much was written
+ this.pos = writeUtf8(this.buf, str, this.pos);
+ var len = this.pos - startPos;
+
+ if (len >= 0x80) makeRoomForExtraLength(startPos, len, this);
+
+ // finally, write the message length in the reserved place and restore the position
+ this.pos = startPos - 1;
+ this.writeVarint(len);
+ this.pos += len;
+ },
+
+ writeFloat: function(val) {
+ this.realloc(4);
+ ieee754.write(this.buf, val, this.pos, true, 23, 4);
+ this.pos += 4;
+ },
+
+ writeDouble: function(val) {
+ this.realloc(8);
+ ieee754.write(this.buf, val, this.pos, true, 52, 8);
+ this.pos += 8;
+ },
+
+ writeBytes: function(buffer) {
+ var len = buffer.length;
+ this.writeVarint(len);
+ this.realloc(len);
+ for (var i = 0; i < len; i++) this.buf[this.pos++] = buffer[i];
+ },
+
+ writeRawMessage: function(fn, obj) {
+ this.pos++; // reserve 1 byte for short message length
+
+ // write the message directly to the buffer and see how much was written
+ var startPos = this.pos;
+ fn(obj, this);
+ var len = this.pos - startPos;
+
+ if (len >= 0x80) makeRoomForExtraLength(startPos, len, this);
+
+ // finally, write the message length in the reserved place and restore the position
+ this.pos = startPos - 1;
+ this.writeVarint(len);
+ this.pos += len;
+ },
+
+ writeMessage: function(tag, fn, obj) {
+ this.writeTag(tag, Pbf.Bytes);
+ this.writeRawMessage(fn, obj);
+ },
+
+ writePackedVarint: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedVarint, arr); },
+ writePackedSVarint: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedSVarint, arr); },
+ writePackedBoolean: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedBoolean, arr); },
+ writePackedFloat: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedFloat, arr); },
+ writePackedDouble: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedDouble, arr); },
+ writePackedFixed32: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedFixed32, arr); },
+ writePackedSFixed32: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedSFixed32, arr); },
+ writePackedFixed64: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedFixed64, arr); },
+ writePackedSFixed64: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedSFixed64, arr); },
+
+ writeBytesField: function(tag, buffer) {
+ this.writeTag(tag, Pbf.Bytes);
+ this.writeBytes(buffer);
+ },
+ writeFixed32Field: function(tag, val) {
+ this.writeTag(tag, Pbf.Fixed32);
+ this.writeFixed32(val);
+ },
+ writeSFixed32Field: function(tag, val) {
+ this.writeTag(tag, Pbf.Fixed32);
+ this.writeSFixed32(val);
+ },
+ writeFixed64Field: function(tag, val) {
+ this.writeTag(tag, Pbf.Fixed64);
+ this.writeFixed64(val);
+ },
+ writeSFixed64Field: function(tag, val) {
+ this.writeTag(tag, Pbf.Fixed64);
+ this.writeSFixed64(val);
+ },
+ writeVarintField: function(tag, val) {
+ this.writeTag(tag, Pbf.Varint);
+ this.writeVarint(val);
+ },
+ writeSVarintField: function(tag, val) {
+ this.writeTag(tag, Pbf.Varint);
+ this.writeSVarint(val);
+ },
+ writeStringField: function(tag, str) {
+ this.writeTag(tag, Pbf.Bytes);
+ this.writeString(str);
+ },
+ writeFloatField: function(tag, val) {
+ this.writeTag(tag, Pbf.Fixed32);
+ this.writeFloat(val);
+ },
+ writeDoubleField: function(tag, val) {
+ this.writeTag(tag, Pbf.Fixed64);
+ this.writeDouble(val);
+ },
+ writeBooleanField: function(tag, val) {
+ this.writeVarintField(tag, Boolean(val));
+ }
+};
+
+function readVarintRemainder(l, s, p) {
+ var buf = p.buf,
+ h, b;
+
+ b = buf[p.pos++]; h = (b & 0x70) >> 4; if (b < 0x80) return toNum(l, h, s);
+ b = buf[p.pos++]; h |= (b & 0x7f) << 3; if (b < 0x80) return toNum(l, h, s);
+ b = buf[p.pos++]; h |= (b & 0x7f) << 10; if (b < 0x80) return toNum(l, h, s);
+ b = buf[p.pos++]; h |= (b & 0x7f) << 17; if (b < 0x80) return toNum(l, h, s);
+ b = buf[p.pos++]; h |= (b & 0x7f) << 24; if (b < 0x80) return toNum(l, h, s);
+ b = buf[p.pos++]; h |= (b & 0x01) << 31; if (b < 0x80) return toNum(l, h, s);
+
+ throw new Error('Expected varint not more than 10 bytes');
+}
+
+function readPackedEnd(pbf) {
+ return pbf.type === Pbf.Bytes ?
+ pbf.readVarint() + pbf.pos : pbf.pos + 1;
+}
+
+function toNum(low, high, isSigned) {
+ if (isSigned) {
+ return high * 0x100000000 + (low >>> 0);
+ }
+
+ return ((high >>> 0) * 0x100000000) + (low >>> 0);
+}
+
+function writeBigVarint(val, pbf) {
+ var low, high;
+
+ if (val >= 0) {
+ low = (val % 0x100000000) | 0;
+ high = (val / 0x100000000) | 0;
+ } else {
+ low = ~(-val % 0x100000000);
+ high = ~(-val / 0x100000000);
+
+ if (low ^ 0xffffffff) {
+ low = (low + 1) | 0;
+ } else {
+ low = 0;
+ high = (high + 1) | 0;
+ }
+ }
+
+ if (val >= 0x10000000000000000 || val < -0x10000000000000000) {
+ throw new Error('Given varint doesn\'t fit into 10 bytes');
+ }
+
+ pbf.realloc(10);
+
+ writeBigVarintLow(low, high, pbf);
+ writeBigVarintHigh(high, pbf);
+}
+
+function writeBigVarintLow(low, high, pbf) {
+ pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;
+ pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;
+ pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;
+ pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;
+ pbf.buf[pbf.pos] = low & 0x7f;
+}
+
+function writeBigVarintHigh(high, pbf) {
+ var lsb = (high & 0x07) << 4;
+
+ pbf.buf[pbf.pos++] |= lsb | ((high >>>= 3) ? 0x80 : 0); if (!high) return;
+ pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;
+ pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;
+ pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;
+ pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;
+ pbf.buf[pbf.pos++] = high & 0x7f;
+}
+
+function makeRoomForExtraLength(startPos, len, pbf) {
+ var extraLen =
+ len <= 0x3fff ? 1 :
+ len <= 0x1fffff ? 2 :
+ len <= 0xfffffff ? 3 : Math.floor(Math.log(len) / (Math.LN2 * 7));
+
+ // if 1 byte isn't enough for encoding message length, shift the data to the right
+ pbf.realloc(extraLen);
+ for (var i = pbf.pos - 1; i >= startPos; i--) pbf.buf[i + extraLen] = pbf.buf[i];
+}
+
+function writePackedVarint(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeVarint(arr[i]); }
+function writePackedSVarint(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSVarint(arr[i]); }
+function writePackedFloat(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeFloat(arr[i]); }
+function writePackedDouble(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeDouble(arr[i]); }
+function writePackedBoolean(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeBoolean(arr[i]); }
+function writePackedFixed32(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeFixed32(arr[i]); }
+function writePackedSFixed32(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSFixed32(arr[i]); }
+function writePackedFixed64(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeFixed64(arr[i]); }
+function writePackedSFixed64(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSFixed64(arr[i]); }
+
+// Buffer code below from https://github.com/feross/buffer, MIT-licensed
+
+function readUInt32(buf, pos) {
+ return ((buf[pos]) |
+ (buf[pos + 1] << 8) |
+ (buf[pos + 2] << 16)) +
+ (buf[pos + 3] * 0x1000000);
+}
+
+function writeInt32(buf, val, pos) {
+ buf[pos] = val;
+ buf[pos + 1] = (val >>> 8);
+ buf[pos + 2] = (val >>> 16);
+ buf[pos + 3] = (val >>> 24);
+}
+
+function readInt32(buf, pos) {
+ return ((buf[pos]) |
+ (buf[pos + 1] << 8) |
+ (buf[pos + 2] << 16)) +
+ (buf[pos + 3] << 24);
+}
+
+function readUtf8(buf, pos, end) {
+ var str = '';
+ var i = pos;
+
+ while (i < end) {
+ var b0 = buf[i];
+ var c = null; // codepoint
+ var bytesPerSequence =
+ b0 > 0xEF ? 4 :
+ b0 > 0xDF ? 3 :
+ b0 > 0xBF ? 2 : 1;
+
+ if (i + bytesPerSequence > end) break;
+
+ var b1, b2, b3;
+
+ if (bytesPerSequence === 1) {
+ if (b0 < 0x80) {
+ c = b0;
+ }
+ } else if (bytesPerSequence === 2) {
+ b1 = buf[i + 1];
+ if ((b1 & 0xC0) === 0x80) {
+ c = (b0 & 0x1F) << 0x6 | (b1 & 0x3F);
+ if (c <= 0x7F) {
+ c = null;
+ }
+ }
+ } else if (bytesPerSequence === 3) {
+ b1 = buf[i + 1];
+ b2 = buf[i + 2];
+ if ((b1 & 0xC0) === 0x80 && (b2 & 0xC0) === 0x80) {
+ c = (b0 & 0xF) << 0xC | (b1 & 0x3F) << 0x6 | (b2 & 0x3F);
+ if (c <= 0x7FF || (c >= 0xD800 && c <= 0xDFFF)) {
+ c = null;
+ }
+ }
+ } else if (bytesPerSequence === 4) {
+ b1 = buf[i + 1];
+ b2 = buf[i + 2];
+ b3 = buf[i + 3];
+ if ((b1 & 0xC0) === 0x80 && (b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80) {
+ c = (b0 & 0xF) << 0x12 | (b1 & 0x3F) << 0xC | (b2 & 0x3F) << 0x6 | (b3 & 0x3F);
+ if (c <= 0xFFFF || c >= 0x110000) {
+ c = null;
+ }
+ }
+ }
+
+ if (c === null) {
+ c = 0xFFFD;
+ bytesPerSequence = 1;
+
+ } else if (c > 0xFFFF) {
+ c -= 0x10000;
+ str += String.fromCharCode(c >>> 10 & 0x3FF | 0xD800);
+ c = 0xDC00 | c & 0x3FF;
+ }
+
+ str += String.fromCharCode(c);
+ i += bytesPerSequence;
+ }
+
+ return str;
+}
+
+function readUtf8TextDecoder(buf, pos, end) {
+ return utf8TextDecoder.decode(buf.subarray(pos, end));
+}
+
+function writeUtf8(buf, str, pos) {
+ for (var i = 0, c, lead; i < str.length; i++) {
+ c = str.charCodeAt(i); // code point
+
+ if (c > 0xD7FF && c < 0xE000) {
+ if (lead) {
+ if (c < 0xDC00) {
+ buf[pos++] = 0xEF;
+ buf[pos++] = 0xBF;
+ buf[pos++] = 0xBD;
+ lead = c;
+ continue;
+ } else {
+ c = lead - 0xD800 << 10 | c - 0xDC00 | 0x10000;
+ lead = null;
+ }
+ } else {
+ if (c > 0xDBFF || (i + 1 === str.length)) {
+ buf[pos++] = 0xEF;
+ buf[pos++] = 0xBF;
+ buf[pos++] = 0xBD;
+ } else {
+ lead = c;
+ }
+ continue;
+ }
+ } else if (lead) {
+ buf[pos++] = 0xEF;
+ buf[pos++] = 0xBF;
+ buf[pos++] = 0xBD;
+ lead = null;
+ }
+
+ if (c < 0x80) {
+ buf[pos++] = c;
+ } else {
+ if (c < 0x800) {
+ buf[pos++] = c >> 0x6 | 0xC0;
+ } else {
+ if (c < 0x10000) {
+ buf[pos++] = c >> 0xC | 0xE0;
+ } else {
+ buf[pos++] = c >> 0x12 | 0xF0;
+ buf[pos++] = c >> 0xC & 0x3F | 0x80;
+ }
+ buf[pos++] = c >> 0x6 & 0x3F | 0x80;
+ }
+ buf[pos++] = c & 0x3F | 0x80;
+ }
+ }
+ return pos;
+}
+
+},{"ieee754":41}],41:[function(require,module,exports){
+exports.read = function (buffer, offset, isLE, mLen, nBytes) {
+ var e, m
+ var eLen = (nBytes * 8) - mLen - 1
+ var eMax = (1 << eLen) - 1
+ var eBias = eMax >> 1
+ var nBits = -7
+ var i = isLE ? (nBytes - 1) : 0
+ var d = isLE ? -1 : 1
+ var s = buffer[offset + i]
+
+ i += d
+
+ e = s & ((1 << (-nBits)) - 1)
+ s >>= (-nBits)
+ nBits += eLen
+ for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
+
+ m = e & ((1 << (-nBits)) - 1)
+ e >>= (-nBits)
+ nBits += mLen
+ for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
+
+ if (e === 0) {
+ e = 1 - eBias
+ } else if (e === eMax) {
+ return m ? NaN : ((s ? -1 : 1) * Infinity)
+ } else {
+ m = m + Math.pow(2, mLen)
+ e = e - eBias
+ }
+ return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
+}
+
+exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
+ var e, m, c
+ var eLen = (nBytes * 8) - mLen - 1
+ var eMax = (1 << eLen) - 1
+ var eBias = eMax >> 1
+ var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
+ var i = isLE ? 0 : (nBytes - 1)
+ var d = isLE ? 1 : -1
+ var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
+
+ value = Math.abs(value)
+
+ if (isNaN(value) || value === Infinity) {
+ m = isNaN(value) ? 1 : 0
+ e = eMax
+ } else {
+ e = Math.floor(Math.log(value) / Math.LN2)
+ if (value * (c = Math.pow(2, -e)) < 1) {
+ e--
+ c *= 2
+ }
+ if (e + eBias >= 1) {
+ value += rt / c
+ } else {
+ value += rt * Math.pow(2, 1 - eBias)
+ }
+ if (value * c >= 2) {
+ e++
+ c /= 2
+ }
+
+ if (e + eBias >= eMax) {
+ m = 0
+ e = eMax
+ } else if (e + eBias >= 1) {
+ m = ((value * c) - 1) * Math.pow(2, mLen)
+ e = e + eBias
+ } else {
+ m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
+ e = 0
+ }
+ }
+
+ for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
+
+ e = (e << mLen) | m
+ eLen += mLen
+ for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
+
+ buffer[offset + i - d] |= s * 128
+}
+
+},{}],42:[function(require,module,exports){
+!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):(t=t||self).RBush=i()}(this,function(){"use strict";function t(t,r,e,a,h){!function t(n,r,e,a,h){for(;a>e;){if(a-e>600){var o=a-e+1,s=r-e+1,l=Math.log(o),f=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*f*(o-f)/o)*(s-o/2<0?-1:1),m=Math.max(e,Math.floor(r-s*f/o+u)),c=Math.min(a,Math.floor(r+(o-s)*f/o+u));t(n,r,m,c,h)}var p=n[r],d=e,x=a;for(i(n,e,r),h(n[a],p)>0&&i(n,e,a);d<x;){for(i(n,d,x),d++,x--;h(n[d],p)<0;)d++;for(;h(n[x],p)>0;)x--}0===h(n[e],p)?i(n,e,x):i(n,++x,a),x<=r&&(e=x+1),r<=x&&(a=x-1)}}(t,r,e||0,a||t.length-1,h||n)}function i(t,i,n){var r=t[i];t[i]=t[n],t[n]=r}function n(t,i){return t<i?-1:t>i?1:0}var r=function(t){void 0===t&&(t=9),this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function e(t,i,n){if(!n)return i.indexOf(t);for(var r=0;r<i.length;r++)if(n(t,i[r]))return r;return-1}function a(t,i){h(t,0,t.children.length,i,t)}function h(t,i,n,r,e){e||(e=p(null)),e.minX=1/0,e.minY=1/0,e.maxX=-1/0,e.maxY=-1/0;for(var a=i;a<n;a++){var h=t.children[a];o(e,t.leaf?r(h):h)}return e}function o(t,i){return t.minX=Math.min(t.minX,i.minX),t.minY=Math.min(t.minY,i.minY),t.maxX=Math.max(t.maxX,i.maxX),t.maxY=Math.max(t.maxY,i.maxY),t}function s(t,i){return t.minX-i.minX}function l(t,i){return t.minY-i.minY}function f(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function u(t){return t.maxX-t.minX+(t.maxY-t.minY)}function m(t,i){return t.minX<=i.minX&&t.minY<=i.minY&&i.maxX<=t.maxX&&i.maxY<=t.maxY}function c(t,i){return i.minX<=t.maxX&&i.minY<=t.maxY&&i.maxX>=t.minX&&i.maxY>=t.minY}function p(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function d(i,n,r,e,a){for(var h=[n,r];h.length;)if(!((r=h.pop())-(n=h.pop())<=e)){var o=n+Math.ceil((r-n)/e/2)*e;t(i,o,n,r,a),h.push(n,o,o,r)}}return r.prototype.all=function(){return this._all(this.data,[])},r.prototype.search=function(t){var i=this.data,n=[];if(!c(t,i))return n;for(var r=this.toBBox,e=[];i;){for(var a=0;a<i.children.length;a++){var h=i.children[a],o=i.leaf?r(h):h;c(t,o)&&(i.leaf?n.push(h):m(t,o)?this._all(h,n):e.push(h))}i=e.pop()}return n},r.prototype.collides=function(t){var i=this.data;if(!c(t,i))return!1;for(var n=[];i;){for(var r=0;r<i.children.length;r++){var e=i.children[r],a=i.leaf?this.toBBox(e):e;if(c(t,a)){if(i.leaf||m(t,a))return!0;n.push(e)}}i=n.pop()}return!1},r.prototype.load=function(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(var i=0;i<t.length;i++)this.insert(t[i]);return this}var n=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===n.height)this._splitRoot(this.data,n);else{if(this.data.height<n.height){var r=this.data;this.data=n,n=r}this._insert(n,this.data.height-n.height-1,!0)}else this.data=n;return this},r.prototype.insert=function(t){return t&&this._insert(t,this.data.height-1),this},r.prototype.clear=function(){return this.data=p([]),this},r.prototype.remove=function(t,i){if(!t)return this;for(var n,r,a,h=this.data,o=this.toBBox(t),s=[],l=[];h||s.length;){if(h||(h=s.pop(),r=s[s.length-1],n=l.pop(),a=!0),h.leaf){var f=e(t,h.children,i);if(-1!==f)return h.children.splice(f,1),s.push(h),this._condense(s),this}a||h.leaf||!m(h,o)?r?(n++,h=r.children[n],a=!1):h=null:(s.push(h),l.push(n),n=0,r=h,h=h.children[0])}return this},r.prototype.toBBox=function(t){return t},r.prototype.compareMinX=function(t,i){return t.minX-i.minX},r.prototype.compareMinY=function(t,i){return t.minY-i.minY},r.prototype.toJSON=function(){return this.data},r.prototype.fromJSON=function(t){return this.data=t,this},r.prototype._all=function(t,i){for(var n=[];t;)t.leaf?i.push.apply(i,t.children):n.push.apply(n,t.children),t=n.pop();return i},r.prototype._build=function(t,i,n,r){var e,h=n-i+1,o=this._maxEntries;if(h<=o)return a(e=p(t.slice(i,n+1)),this.toBBox),e;r||(r=Math.ceil(Math.log(h)/Math.log(o)),o=Math.ceil(h/Math.pow(o,r-1))),(e=p([])).leaf=!1,e.height=r;var s=Math.ceil(h/o),l=s*Math.ceil(Math.sqrt(o));d(t,i,n,l,this.compareMinX);for(var f=i;f<=n;f+=l){var u=Math.min(f+l-1,n);d(t,f,u,s,this.compareMinY);for(var m=f;m<=u;m+=s){var c=Math.min(m+s-1,u);e.children.push(this._build(t,m,c,r-1))}}return a(e,this.toBBox),e},r.prototype._chooseSubtree=function(t,i,n,r){for(;r.push(i),!i.leaf&&r.length-1!==n;){for(var e=1/0,a=1/0,h=void 0,o=0;o<i.children.length;o++){var s=i.children[o],l=f(s),u=(m=t,c=s,(Math.max(c.maxX,m.maxX)-Math.min(c.minX,m.minX))*(Math.max(c.maxY,m.maxY)-Math.min(c.minY,m.minY))-l);u<a?(a=u,e=l<e?l:e,h=s):u===a&&l<e&&(e=l,h=s)}i=h||i.children[0]}var m,c;return i},r.prototype._insert=function(t,i,n){var r=n?t:this.toBBox(t),e=[],a=this._chooseSubtree(r,this.data,i,e);for(a.children.push(t),o(a,r);i>=0&&e[i].children.length>this._maxEntries;)this._split(e,i),i--;this._adjustParentBBoxes(r,e,i)},r.prototype._split=function(t,i){var n=t[i],r=n.children.length,e=this._minEntries;this._chooseSplitAxis(n,e,r);var h=this._chooseSplitIndex(n,e,r),o=p(n.children.splice(h,n.children.length-h));o.height=n.height,o.leaf=n.leaf,a(n,this.toBBox),a(o,this.toBBox),i?t[i-1].children.push(o):this._splitRoot(n,o)},r.prototype._splitRoot=function(t,i){this.data=p([t,i]),this.data.height=t.height+1,this.data.leaf=!1,a(this.data,this.toBBox)},r.prototype._chooseSplitIndex=function(t,i,n){for(var r,e,a,o,s,l,u,m=1/0,c=1/0,p=i;p<=n-i;p++){var d=h(t,0,p,this.toBBox),x=h(t,p,n,this.toBBox),v=(e=d,a=x,o=void 0,s=void 0,l=void 0,u=void 0,o=Math.max(e.minX,a.minX),s=Math.max(e.minY,a.minY),l=Math.min(e.maxX,a.maxX),u=Math.min(e.maxY,a.maxY),Math.max(0,l-o)*Math.max(0,u-s)),M=f(d)+f(x);v<m?(m=v,r=p,c=M<c?M:c):v===m&&M<c&&(c=M,r=p)}return r||n-i},r.prototype._chooseSplitAxis=function(t,i,n){var r=t.leaf?this.compareMinX:s,e=t.leaf?this.compareMinY:l;this._allDistMargin(t,i,n,r)<this._allDistMargin(t,i,n,e)&&t.children.sort(r)},r.prototype._allDistMargin=function(t,i,n,r){t.children.sort(r);for(var e=this.toBBox,a=h(t,0,i,e),s=h(t,n-i,n,e),l=u(a)+u(s),f=i;f<n-i;f++){var m=t.children[f];o(a,t.leaf?e(m):m),l+=u(a)}for(var c=n-i-1;c>=i;c--){var p=t.children[c];o(s,t.leaf?e(p):p),l+=u(s)}return l},r.prototype._adjustParentBBoxes=function(t,i,n){for(var r=n;r>=0;r--)o(i[r],t)},r.prototype._condense=function(t){for(var i=t.length-1,n=void 0;i>=0;i--)0===t[i].children.length?i>0?(n=t[i-1].children).splice(n.indexOf(t[i]),1):this.clear():a(t[i],this.toBBox)},r});
+
+},{}],43:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var Observable_1 = require("./internal/Observable");
+exports.Observable = Observable_1.Observable;
+var ConnectableObservable_1 = require("./internal/observable/ConnectableObservable");
+exports.ConnectableObservable = ConnectableObservable_1.ConnectableObservable;
+var groupBy_1 = require("./internal/operators/groupBy");
+exports.GroupedObservable = groupBy_1.GroupedObservable;
+var observable_1 = require("./internal/symbol/observable");
+exports.observable = observable_1.observable;
+var Subject_1 = require("./internal/Subject");
+exports.Subject = Subject_1.Subject;
+var BehaviorSubject_1 = require("./internal/BehaviorSubject");
+exports.BehaviorSubject = BehaviorSubject_1.BehaviorSubject;
+var ReplaySubject_1 = require("./internal/ReplaySubject");
+exports.ReplaySubject = ReplaySubject_1.ReplaySubject;
+var AsyncSubject_1 = require("./internal/AsyncSubject");
+exports.AsyncSubject = AsyncSubject_1.AsyncSubject;
+var asap_1 = require("./internal/scheduler/asap");
+exports.asapScheduler = asap_1.asap;
+var async_1 = require("./internal/scheduler/async");
+exports.asyncScheduler = async_1.async;
+var queue_1 = require("./internal/scheduler/queue");
+exports.queueScheduler = queue_1.queue;
+var animationFrame_1 = require("./internal/scheduler/animationFrame");
+exports.animationFrameScheduler = animationFrame_1.animationFrame;
+var VirtualTimeScheduler_1 = require("./internal/scheduler/VirtualTimeScheduler");
+exports.VirtualTimeScheduler = VirtualTimeScheduler_1.VirtualTimeScheduler;
+exports.VirtualAction = VirtualTimeScheduler_1.VirtualAction;
+var Scheduler_1 = require("./internal/Scheduler");
+exports.Scheduler = Scheduler_1.Scheduler;
+var Subscription_1 = require("./internal/Subscription");
+exports.Subscription = Subscription_1.Subscription;
+var Subscriber_1 = require("./internal/Subscriber");
+exports.Subscriber = Subscriber_1.Subscriber;
+var Notification_1 = require("./internal/Notification");
+exports.Notification = Notification_1.Notification;
+exports.NotificationKind = Notification_1.NotificationKind;
+var pipe_1 = require("./internal/util/pipe");
+exports.pipe = pipe_1.pipe;
+var noop_1 = require("./internal/util/noop");
+exports.noop = noop_1.noop;
+var identity_1 = require("./internal/util/identity");
+exports.identity = identity_1.identity;
+var isObservable_1 = require("./internal/util/isObservable");
+exports.isObservable = isObservable_1.isObservable;
+var ArgumentOutOfRangeError_1 = require("./internal/util/ArgumentOutOfRangeError");
+exports.ArgumentOutOfRangeError = ArgumentOutOfRangeError_1.ArgumentOutOfRangeError;
+var EmptyError_1 = require("./internal/util/EmptyError");
+exports.EmptyError = EmptyError_1.EmptyError;
+var ObjectUnsubscribedError_1 = require("./internal/util/ObjectUnsubscribedError");
+exports.ObjectUnsubscribedError = ObjectUnsubscribedError_1.ObjectUnsubscribedError;
+var UnsubscriptionError_1 = require("./internal/util/UnsubscriptionError");
+exports.UnsubscriptionError = UnsubscriptionError_1.UnsubscriptionError;
+var TimeoutError_1 = require("./internal/util/TimeoutError");
+exports.TimeoutError = TimeoutError_1.TimeoutError;
+var bindCallback_1 = require("./internal/observable/bindCallback");
+exports.bindCallback = bindCallback_1.bindCallback;
+var bindNodeCallback_1 = require("./internal/observable/bindNodeCallback");
+exports.bindNodeCallback = bindNodeCallback_1.bindNodeCallback;
+var combineLatest_1 = require("./internal/observable/combineLatest");
+exports.combineLatest = combineLatest_1.combineLatest;
+var concat_1 = require("./internal/observable/concat");
+exports.concat = concat_1.concat;
+var defer_1 = require("./internal/observable/defer");
+exports.defer = defer_1.defer;
+var empty_1 = require("./internal/observable/empty");
+exports.empty = empty_1.empty;
+var forkJoin_1 = require("./internal/observable/forkJoin");
+exports.forkJoin = forkJoin_1.forkJoin;
+var from_1 = require("./internal/observable/from");
+exports.from = from_1.from;
+var fromEvent_1 = require("./internal/observable/fromEvent");
+exports.fromEvent = fromEvent_1.fromEvent;
+var fromEventPattern_1 = require("./internal/observable/fromEventPattern");
+exports.fromEventPattern = fromEventPattern_1.fromEventPattern;
+var generate_1 = require("./internal/observable/generate");
+exports.generate = generate_1.generate;
+var iif_1 = require("./internal/observable/iif");
+exports.iif = iif_1.iif;
+var interval_1 = require("./internal/observable/interval");
+exports.interval = interval_1.interval;
+var merge_1 = require("./internal/observable/merge");
+exports.merge = merge_1.merge;
+var never_1 = require("./internal/observable/never");
+exports.never = never_1.never;
+var of_1 = require("./internal/observable/of");
+exports.of = of_1.of;
+var onErrorResumeNext_1 = require("./internal/observable/onErrorResumeNext");
+exports.onErrorResumeNext = onErrorResumeNext_1.onErrorResumeNext;
+var pairs_1 = require("./internal/observable/pairs");
+exports.pairs = pairs_1.pairs;
+var partition_1 = require("./internal/observable/partition");
+exports.partition = partition_1.partition;
+var race_1 = require("./internal/observable/race");
+exports.race = race_1.race;
+var range_1 = require("./internal/observable/range");
+exports.range = range_1.range;
+var throwError_1 = require("./internal/observable/throwError");
+exports.throwError = throwError_1.throwError;
+var timer_1 = require("./internal/observable/timer");
+exports.timer = timer_1.timer;
+var using_1 = require("./internal/observable/using");
+exports.using = using_1.using;
+var zip_1 = require("./internal/observable/zip");
+exports.zip = zip_1.zip;
+var scheduled_1 = require("./internal/scheduled/scheduled");
+exports.scheduled = scheduled_1.scheduled;
+var empty_2 = require("./internal/observable/empty");
+exports.EMPTY = empty_2.EMPTY;
+var never_2 = require("./internal/observable/never");
+exports.NEVER = never_2.NEVER;
+var config_1 = require("./internal/config");
+exports.config = config_1.config;
+
+},{"./internal/AsyncSubject":44,"./internal/BehaviorSubject":45,"./internal/Notification":47,"./internal/Observable":48,"./internal/ReplaySubject":51,"./internal/Scheduler":52,"./internal/Subject":53,"./internal/Subscriber":55,"./internal/Subscription":56,"./internal/config":57,"./internal/observable/ConnectableObservable":58,"./internal/observable/bindCallback":60,"./internal/observable/bindNodeCallback":61,"./internal/observable/combineLatest":62,"./internal/observable/concat":63,"./internal/observable/defer":64,"./internal/observable/empty":65,"./internal/observable/forkJoin":66,"./internal/observable/from":67,"./internal/observable/fromEvent":69,"./internal/observable/fromEventPattern":70,"./internal/observable/generate":71,"./internal/observable/iif":72,"./internal/observable/interval":73,"./internal/observable/merge":74,"./internal/observable/never":75,"./internal/observable/of":76,"./internal/observable/onErrorResumeNext":77,"./internal/observable/pairs":78,"./internal/observable/partition":79,"./internal/observable/race":80,"./internal/observable/range":81,"./internal/observable/throwError":82,"./internal/observable/timer":83,"./internal/observable/using":84,"./internal/observable/zip":85,"./internal/operators/groupBy":121,"./internal/scheduled/scheduled":193,"./internal/scheduler/VirtualTimeScheduler":203,"./internal/scheduler/animationFrame":204,"./internal/scheduler/asap":205,"./internal/scheduler/async":206,"./internal/scheduler/queue":207,"./internal/symbol/observable":209,"./internal/util/ArgumentOutOfRangeError":211,"./internal/util/EmptyError":212,"./internal/util/ObjectUnsubscribedError":214,"./internal/util/TimeoutError":215,"./internal/util/UnsubscriptionError":216,"./internal/util/identity":219,"./internal/util/isObservable":228,"./internal/util/noop":231,"./internal/util/pipe":233}],44:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var Subject_1 = require("./Subject");
+var Subscription_1 = require("./Subscription");
+var AsyncSubject = (function (_super) {
+ __extends(AsyncSubject, _super);
+ function AsyncSubject() {
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this.value = null;
+ _this.hasNext = false;
+ _this.hasCompleted = false;
+ return _this;
+ }
+ AsyncSubject.prototype._subscribe = function (subscriber) {
+ if (this.hasError) {
+ subscriber.error(this.thrownError);
+ return Subscription_1.Subscription.EMPTY;
+ }
+ else if (this.hasCompleted && this.hasNext) {
+ subscriber.next(this.value);
+ subscriber.complete();
+ return Subscription_1.Subscription.EMPTY;
+ }
+ return _super.prototype._subscribe.call(this, subscriber);
+ };
+ AsyncSubject.prototype.next = function (value) {
+ if (!this.hasCompleted) {
+ this.value = value;
+ this.hasNext = true;
+ }
+ };
+ AsyncSubject.prototype.error = function (error) {
+ if (!this.hasCompleted) {
+ _super.prototype.error.call(this, error);
+ }
+ };
+ AsyncSubject.prototype.complete = function () {
+ this.hasCompleted = true;
+ if (this.hasNext) {
+ _super.prototype.next.call(this, this.value);
+ }
+ _super.prototype.complete.call(this);
+ };
+ return AsyncSubject;
+}(Subject_1.Subject));
+exports.AsyncSubject = AsyncSubject;
+
+},{"./Subject":53,"./Subscription":56}],45:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var Subject_1 = require("./Subject");
+var ObjectUnsubscribedError_1 = require("./util/ObjectUnsubscribedError");
+var BehaviorSubject = (function (_super) {
+ __extends(BehaviorSubject, _super);
+ function BehaviorSubject(_value) {
+ var _this = _super.call(this) || this;
+ _this._value = _value;
+ return _this;
+ }
+ Object.defineProperty(BehaviorSubject.prototype, "value", {
+ get: function () {
+ return this.getValue();
+ },
+ enumerable: true,
+ configurable: true
+ });
+ BehaviorSubject.prototype._subscribe = function (subscriber) {
+ var subscription = _super.prototype._subscribe.call(this, subscriber);
+ if (subscription && !subscription.closed) {
+ subscriber.next(this._value);
+ }
+ return subscription;
+ };
+ BehaviorSubject.prototype.getValue = function () {
+ if (this.hasError) {
+ throw this.thrownError;
+ }
+ else if (this.closed) {
+ throw new ObjectUnsubscribedError_1.ObjectUnsubscribedError();
+ }
+ else {
+ return this._value;
+ }
+ };
+ BehaviorSubject.prototype.next = function (value) {
+ _super.prototype.next.call(this, this._value = value);
+ };
+ return BehaviorSubject;
+}(Subject_1.Subject));
+exports.BehaviorSubject = BehaviorSubject;
+
+},{"./Subject":53,"./util/ObjectUnsubscribedError":214}],46:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var Subscriber_1 = require("./Subscriber");
+var InnerSubscriber = (function (_super) {
+ __extends(InnerSubscriber, _super);
+ function InnerSubscriber(parent, outerValue, outerIndex) {
+ var _this = _super.call(this) || this;
+ _this.parent = parent;
+ _this.outerValue = outerValue;
+ _this.outerIndex = outerIndex;
+ _this.index = 0;
+ return _this;
+ }
+ 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;
+
+},{"./Subscriber":55}],47:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var empty_1 = require("./observable/empty");
+var of_1 = require("./observable/of");
+var throwError_1 = require("./observable/throwError");
+var NotificationKind;
+(function (NotificationKind) {
+ NotificationKind["NEXT"] = "N";
+ NotificationKind["ERROR"] = "E";
+ NotificationKind["COMPLETE"] = "C";
+})(NotificationKind = exports.NotificationKind || (exports.NotificationKind = {}));
+var Notification = (function () {
+ function Notification(kind, value, error) {
+ this.kind = kind;
+ this.value = value;
+ this.error = error;
+ this.hasValue = kind === 'N';
+ }
+ Notification.prototype.observe = function (observer) {
+ switch (this.kind) {
+ case 'N':
+ return observer.next && observer.next(this.value);
+ case 'E':
+ return observer.error && observer.error(this.error);
+ case 'C':
+ return observer.complete && observer.complete();
+ }
+ };
+ Notification.prototype.do = function (next, error, complete) {
+ var kind = this.kind;
+ switch (kind) {
+ case 'N':
+ return next && next(this.value);
+ case 'E':
+ return error && error(this.error);
+ case 'C':
+ return complete && complete();
+ }
+ };
+ Notification.prototype.accept = function (nextOrObserver, error, complete) {
+ if (nextOrObserver && typeof nextOrObserver.next === 'function') {
+ return this.observe(nextOrObserver);
+ }
+ else {
+ return this.do(nextOrObserver, error, complete);
+ }
+ };
+ Notification.prototype.toObservable = function () {
+ var kind = this.kind;
+ switch (kind) {
+ case 'N':
+ return of_1.of(this.value);
+ case 'E':
+ return throwError_1.throwError(this.error);
+ case 'C':
+ return empty_1.empty();
+ }
+ throw new Error('unexpected notification kind value');
+ };
+ Notification.createNext = function (value) {
+ if (typeof value !== 'undefined') {
+ return new Notification('N', value);
+ }
+ return Notification.undefinedValueNotification;
+ };
+ Notification.createError = function (err) {
+ return new Notification('E', undefined, err);
+ };
+ Notification.createComplete = function () {
+ return Notification.completeNotification;
+ };
+ Notification.completeNotification = new Notification('C');
+ Notification.undefinedValueNotification = new Notification('N', undefined);
+ return Notification;
+}());
+exports.Notification = Notification;
+
+},{"./observable/empty":65,"./observable/of":76,"./observable/throwError":82}],48:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var canReportError_1 = require("./util/canReportError");
+var toSubscriber_1 = require("./util/toSubscriber");
+var observable_1 = require("./symbol/observable");
+var pipe_1 = require("./util/pipe");
+var config_1 = require("./config");
+var Observable = (function () {
+ function Observable(subscribe) {
+ this._isScalar = false;
+ if (subscribe) {
+ this._subscribe = subscribe;
+ }
+ }
+ Observable.prototype.lift = function (operator) {
+ var observable = new Observable();
+ observable.source = this;
+ observable.operator = operator;
+ return observable;
+ };
+ Observable.prototype.subscribe = function (observerOrNext, error, complete) {
+ var operator = this.operator;
+ var sink = toSubscriber_1.toSubscriber(observerOrNext, error, complete);
+ if (operator) {
+ sink.add(operator.call(sink, this.source));
+ }
+ else {
+ sink.add(this.source || (config_1.config.useDeprecatedSynchronousErrorHandling && !sink.syncErrorThrowable) ?
+ this._subscribe(sink) :
+ this._trySubscribe(sink));
+ }
+ if (config_1.config.useDeprecatedSynchronousErrorHandling) {
+ if (sink.syncErrorThrowable) {
+ sink.syncErrorThrowable = false;
+ if (sink.syncErrorThrown) {
+ throw sink.syncErrorValue;
+ }
+ }
+ }
+ return sink;
+ };
+ Observable.prototype._trySubscribe = function (sink) {
+ try {
+ return this._subscribe(sink);
+ }
+ catch (err) {
+ if (config_1.config.useDeprecatedSynchronousErrorHandling) {
+ sink.syncErrorThrown = true;
+ sink.syncErrorValue = err;
+ }
+ if (canReportError_1.canReportError(sink)) {
+ sink.error(err);
+ }
+ else {
+ console.warn(err);
+ }
+ }
+ };
+ Observable.prototype.forEach = function (next, promiseCtor) {
+ var _this = this;
+ promiseCtor = getPromiseCtor(promiseCtor);
+ return new promiseCtor(function (resolve, reject) {
+ var subscription;
+ subscription = _this.subscribe(function (value) {
+ try {
+ next(value);
+ }
+ catch (err) {
+ reject(err);
+ if (subscription) {
+ subscription.unsubscribe();
+ }
+ }
+ }, reject, resolve);
+ });
+ };
+ Observable.prototype._subscribe = function (subscriber) {
+ var source = this.source;
+ return source && source.subscribe(subscriber);
+ };
+ Observable.prototype[observable_1.observable] = function () {
+ return this;
+ };
+ Observable.prototype.pipe = function () {
+ var operations = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ operations[_i] = arguments[_i];
+ }
+ if (operations.length === 0) {
+ return this;
+ }
+ return pipe_1.pipeFromArray(operations)(this);
+ };
+ Observable.prototype.toPromise = function (promiseCtor) {
+ var _this = this;
+ promiseCtor = getPromiseCtor(promiseCtor);
+ return new promiseCtor(function (resolve, reject) {
+ var value;
+ _this.subscribe(function (x) { return value = x; }, function (err) { return reject(err); }, function () { return resolve(value); });
+ });
+ };
+ Observable.create = function (subscribe) {
+ return new Observable(subscribe);
+ };
+ return Observable;
+}());
+exports.Observable = Observable;
+function getPromiseCtor(promiseCtor) {
+ if (!promiseCtor) {
+ promiseCtor = config_1.config.Promise || Promise;
+ }
+ if (!promiseCtor) {
+ throw new Error('no Promise impl found');
+ }
+ return promiseCtor;
+}
+
+},{"./config":57,"./symbol/observable":209,"./util/canReportError":217,"./util/pipe":233,"./util/toSubscriber":240}],49:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var config_1 = require("./config");
+var hostReportError_1 = require("./util/hostReportError");
+exports.empty = {
+ closed: true,
+ next: function (value) { },
+ error: function (err) {
+ if (config_1.config.useDeprecatedSynchronousErrorHandling) {
+ throw err;
+ }
+ else {
+ hostReportError_1.hostReportError(err);
+ }
+ },
+ complete: function () { }
+};
+
+},{"./config":57,"./util/hostReportError":218}],50:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var Subscriber_1 = require("./Subscriber");
+var OuterSubscriber = (function (_super) {
+ __extends(OuterSubscriber, _super);
+ function OuterSubscriber() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ 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;
+
+},{"./Subscriber":55}],51:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var Subject_1 = require("./Subject");
+var queue_1 = require("./scheduler/queue");
+var Subscription_1 = require("./Subscription");
+var observeOn_1 = require("./operators/observeOn");
+var ObjectUnsubscribedError_1 = require("./util/ObjectUnsubscribedError");
+var SubjectSubscription_1 = require("./SubjectSubscription");
+var ReplaySubject = (function (_super) {
+ __extends(ReplaySubject, _super);
+ function ReplaySubject(bufferSize, windowTime, scheduler) {
+ if (bufferSize === void 0) { bufferSize = Number.POSITIVE_INFINITY; }
+ if (windowTime === void 0) { windowTime = Number.POSITIVE_INFINITY; }
+ var _this = _super.call(this) || this;
+ _this.scheduler = scheduler;
+ _this._events = [];
+ _this._infiniteTimeWindow = false;
+ _this._bufferSize = bufferSize < 1 ? 1 : bufferSize;
+ _this._windowTime = windowTime < 1 ? 1 : windowTime;
+ if (windowTime === Number.POSITIVE_INFINITY) {
+ _this._infiniteTimeWindow = true;
+ _this.next = _this.nextInfiniteTimeWindow;
+ }
+ else {
+ _this.next = _this.nextTimeWindow;
+ }
+ return _this;
+ }
+ ReplaySubject.prototype.nextInfiniteTimeWindow = function (value) {
+ var _events = this._events;
+ _events.push(value);
+ if (_events.length > this._bufferSize) {
+ _events.shift();
+ }
+ _super.prototype.next.call(this, value);
+ };
+ ReplaySubject.prototype.nextTimeWindow = function (value) {
+ this._events.push(new ReplayEvent(this._getNow(), value));
+ this._trimBufferThenGetEvents();
+ _super.prototype.next.call(this, value);
+ };
+ ReplaySubject.prototype._subscribe = function (subscriber) {
+ var _infiniteTimeWindow = this._infiniteTimeWindow;
+ var _events = _infiniteTimeWindow ? this._events : this._trimBufferThenGetEvents();
+ var scheduler = this.scheduler;
+ var len = _events.length;
+ var subscription;
+ if (this.closed) {
+ throw new ObjectUnsubscribedError_1.ObjectUnsubscribedError();
+ }
+ else if (this.isStopped || this.hasError) {
+ subscription = Subscription_1.Subscription.EMPTY;
+ }
+ else {
+ this.observers.push(subscriber);
+ subscription = new SubjectSubscription_1.SubjectSubscription(this, subscriber);
+ }
+ if (scheduler) {
+ subscriber.add(subscriber = new observeOn_1.ObserveOnSubscriber(subscriber, scheduler));
+ }
+ if (_infiniteTimeWindow) {
+ for (var i = 0; i < len && !subscriber.closed; i++) {
+ subscriber.next(_events[i]);
+ }
+ }
+ else {
+ for (var i = 0; i < len && !subscriber.closed; i++) {
+ subscriber.next(_events[i].value);
+ }
+ }
+ if (this.hasError) {
+ subscriber.error(this.thrownError);
+ }
+ else if (this.isStopped) {
+ subscriber.complete();
+ }
+ return subscription;
+ };
+ ReplaySubject.prototype._getNow = function () {
+ return (this.scheduler || queue_1.queue).now();
+ };
+ ReplaySubject.prototype._trimBufferThenGetEvents = function () {
+ var now = this._getNow();
+ var _bufferSize = this._bufferSize;
+ var _windowTime = this._windowTime;
+ var _events = this._events;
+ var eventsCount = _events.length;
+ var spliceCount = 0;
+ while (spliceCount < eventsCount) {
+ if ((now - _events[spliceCount].time) < _windowTime) {
+ break;
+ }
+ spliceCount++;
+ }
+ if (eventsCount > _bufferSize) {
+ spliceCount = Math.max(spliceCount, eventsCount - _bufferSize);
+ }
+ if (spliceCount > 0) {
+ _events.splice(0, spliceCount);
+ }
+ return _events;
+ };
+ return ReplaySubject;
+}(Subject_1.Subject));
+exports.ReplaySubject = ReplaySubject;
+var ReplayEvent = (function () {
+ function ReplayEvent(time, value) {
+ this.time = time;
+ this.value = value;
+ }
+ return ReplayEvent;
+}());
+
+},{"./Subject":53,"./SubjectSubscription":54,"./Subscription":56,"./operators/observeOn":136,"./scheduler/queue":207,"./util/ObjectUnsubscribedError":214}],52:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var Scheduler = (function () {
+ function Scheduler(SchedulerAction, now) {
+ if (now === void 0) { now = Scheduler.now; }
+ this.SchedulerAction = SchedulerAction;
+ this.now = now;
+ }
+ Scheduler.prototype.schedule = function (work, delay, state) {
+ if (delay === void 0) { delay = 0; }
+ return new this.SchedulerAction(this, work).schedule(state, delay);
+ };
+ Scheduler.now = function () { return Date.now(); };
+ return Scheduler;
+}());
+exports.Scheduler = Scheduler;
+
+},{}],53:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var Observable_1 = require("./Observable");
+var Subscriber_1 = require("./Subscriber");
+var Subscription_1 = require("./Subscription");
+var ObjectUnsubscribedError_1 = require("./util/ObjectUnsubscribedError");
+var SubjectSubscription_1 = require("./SubjectSubscription");
+var rxSubscriber_1 = require("../internal/symbol/rxSubscriber");
+var SubjectSubscriber = (function (_super) {
+ __extends(SubjectSubscriber, _super);
+ function SubjectSubscriber(destination) {
+ var _this = _super.call(this, destination) || this;
+ _this.destination = destination;
+ return _this;
+ }
+ return SubjectSubscriber;
+}(Subscriber_1.Subscriber));
+exports.SubjectSubscriber = SubjectSubscriber;
+var Subject = (function (_super) {
+ __extends(Subject, _super);
+ function Subject() {
+ var _this = _super.call(this) || this;
+ _this.observers = [];
+ _this.closed = false;
+ _this.isStopped = false;
+ _this.hasError = false;
+ _this.thrownError = null;
+ return _this;
+ }
+ Subject.prototype[rxSubscriber_1.rxSubscriber] = function () {
+ return new SubjectSubscriber(this);
+ };
+ Subject.prototype.lift = function (operator) {
+ var subject = new AnonymousSubject(this, this);
+ subject.operator = operator;
+ return subject;
+ };
+ Subject.prototype.next = function (value) {
+ if (this.closed) {
+ throw new ObjectUnsubscribedError_1.ObjectUnsubscribedError();
+ }
+ if (!this.isStopped) {
+ var observers = this.observers;
+ var len = observers.length;
+ var copy = observers.slice();
+ for (var i = 0; i < len; i++) {
+ copy[i].next(value);
+ }
+ }
+ };
+ Subject.prototype.error = function (err) {
+ if (this.closed) {
+ throw new ObjectUnsubscribedError_1.ObjectUnsubscribedError();
+ }
+ this.hasError = true;
+ this.thrownError = err;
+ this.isStopped = true;
+ var observers = this.observers;
+ var len = observers.length;
+ var copy = observers.slice();
+ for (var i = 0; i < len; i++) {
+ copy[i].error(err);
+ }
+ this.observers.length = 0;
+ };
+ Subject.prototype.complete = function () {
+ if (this.closed) {
+ throw new ObjectUnsubscribedError_1.ObjectUnsubscribedError();
+ }
+ this.isStopped = true;
+ var observers = this.observers;
+ var len = observers.length;
+ var copy = observers.slice();
+ for (var i = 0; i < len; i++) {
+ copy[i].complete();
+ }
+ this.observers.length = 0;
+ };
+ Subject.prototype.unsubscribe = function () {
+ this.isStopped = true;
+ this.closed = true;
+ this.observers = null;
+ };
+ Subject.prototype._trySubscribe = function (subscriber) {
+ if (this.closed) {
+ throw new ObjectUnsubscribedError_1.ObjectUnsubscribedError();
+ }
+ else {
+ return _super.prototype._trySubscribe.call(this, subscriber);
+ }
+ };
+ Subject.prototype._subscribe = function (subscriber) {
+ if (this.closed) {
+ throw new ObjectUnsubscribedError_1.ObjectUnsubscribedError();
+ }
+ else if (this.hasError) {
+ subscriber.error(this.thrownError);
+ return Subscription_1.Subscription.EMPTY;
+ }
+ else if (this.isStopped) {
+ subscriber.complete();
+ return Subscription_1.Subscription.EMPTY;
+ }
+ else {
+ this.observers.push(subscriber);
+ return new SubjectSubscription_1.SubjectSubscription(this, subscriber);
+ }
+ };
+ Subject.prototype.asObservable = function () {
+ var observable = new Observable_1.Observable();
+ observable.source = this;
+ return observable;
+ };
+ Subject.create = function (destination, source) {
+ return new AnonymousSubject(destination, source);
+ };
+ return Subject;
+}(Observable_1.Observable));
+exports.Subject = Subject;
+var AnonymousSubject = (function (_super) {
+ __extends(AnonymousSubject, _super);
+ function AnonymousSubject(destination, source) {
+ var _this = _super.call(this) || this;
+ _this.destination = destination;
+ _this.source = source;
+ return _this;
+ }
+ AnonymousSubject.prototype.next = function (value) {
+ var destination = this.destination;
+ if (destination && destination.next) {
+ destination.next(value);
+ }
+ };
+ AnonymousSubject.prototype.error = function (err) {
+ var destination = this.destination;
+ if (destination && destination.error) {
+ this.destination.error(err);
+ }
+ };
+ AnonymousSubject.prototype.complete = function () {
+ var destination = this.destination;
+ if (destination && destination.complete) {
+ this.destination.complete();
+ }
+ };
+ AnonymousSubject.prototype._subscribe = function (subscriber) {
+ var source = this.source;
+ if (source) {
+ return this.source.subscribe(subscriber);
+ }
+ else {
+ return Subscription_1.Subscription.EMPTY;
+ }
+ };
+ return AnonymousSubject;
+}(Subject));
+exports.AnonymousSubject = AnonymousSubject;
+
+},{"../internal/symbol/rxSubscriber":210,"./Observable":48,"./SubjectSubscription":54,"./Subscriber":55,"./Subscription":56,"./util/ObjectUnsubscribedError":214}],54:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var Subscription_1 = require("./Subscription");
+var SubjectSubscription = (function (_super) {
+ __extends(SubjectSubscription, _super);
+ function SubjectSubscription(subject, subscriber) {
+ var _this = _super.call(this) || this;
+ _this.subject = subject;
+ _this.subscriber = subscriber;
+ _this.closed = false;
+ return _this;
+ }
+ SubjectSubscription.prototype.unsubscribe = function () {
+ if (this.closed) {
+ return;
+ }
+ this.closed = true;
+ var subject = this.subject;
+ var observers = subject.observers;
+ this.subject = null;
+ if (!observers || observers.length === 0 || subject.isStopped || subject.closed) {
+ return;
+ }
+ var subscriberIndex = observers.indexOf(this.subscriber);
+ if (subscriberIndex !== -1) {
+ observers.splice(subscriberIndex, 1);
+ }
+ };
+ return SubjectSubscription;
+}(Subscription_1.Subscription));
+exports.SubjectSubscription = SubjectSubscription;
+
+},{"./Subscription":56}],55:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var isFunction_1 = require("./util/isFunction");
+var Observer_1 = require("./Observer");
+var Subscription_1 = require("./Subscription");
+var rxSubscriber_1 = require("../internal/symbol/rxSubscriber");
+var config_1 = require("./config");
+var hostReportError_1 = require("./util/hostReportError");
+var Subscriber = (function (_super) {
+ __extends(Subscriber, _super);
+ function Subscriber(destinationOrNext, error, complete) {
+ var _this = _super.call(this) || this;
+ _this.syncErrorValue = null;
+ _this.syncErrorThrown = false;
+ _this.syncErrorThrowable = false;
+ _this.isStopped = false;
+ switch (arguments.length) {
+ case 0:
+ _this.destination = Observer_1.empty;
+ break;
+ case 1:
+ if (!destinationOrNext) {
+ _this.destination = Observer_1.empty;
+ break;
+ }
+ if (typeof destinationOrNext === 'object') {
+ if (destinationOrNext instanceof Subscriber) {
+ _this.syncErrorThrowable = destinationOrNext.syncErrorThrowable;
+ _this.destination = destinationOrNext;
+ destinationOrNext.add(_this);
+ }
+ else {
+ _this.syncErrorThrowable = true;
+ _this.destination = new SafeSubscriber(_this, destinationOrNext);
+ }
+ break;
+ }
+ default:
+ _this.syncErrorThrowable = true;
+ _this.destination = new SafeSubscriber(_this, destinationOrNext, error, complete);
+ break;
+ }
+ return _this;
+ }
+ Subscriber.prototype[rxSubscriber_1.rxSubscriber] = function () { return this; };
+ Subscriber.create = function (next, error, complete) {
+ var subscriber = new Subscriber(next, error, complete);
+ subscriber.syncErrorThrowable = false;
+ return subscriber;
+ };
+ Subscriber.prototype.next = function (value) {
+ if (!this.isStopped) {
+ this._next(value);
+ }
+ };
+ Subscriber.prototype.error = function (err) {
+ if (!this.isStopped) {
+ this.isStopped = true;
+ this._error(err);
+ }
+ };
+ Subscriber.prototype.complete = function () {
+ if (!this.isStopped) {
+ this.isStopped = true;
+ this._complete();
+ }
+ };
+ Subscriber.prototype.unsubscribe = function () {
+ if (this.closed) {
+ return;
+ }
+ this.isStopped = true;
+ _super.prototype.unsubscribe.call(this);
+ };
+ Subscriber.prototype._next = function (value) {
+ this.destination.next(value);
+ };
+ Subscriber.prototype._error = function (err) {
+ this.destination.error(err);
+ this.unsubscribe();
+ };
+ Subscriber.prototype._complete = function () {
+ this.destination.complete();
+ this.unsubscribe();
+ };
+ Subscriber.prototype._unsubscribeAndRecycle = function () {
+ var _parentOrParents = this._parentOrParents;
+ this._parentOrParents = null;
+ this.unsubscribe();
+ this.closed = false;
+ this.isStopped = false;
+ this._parentOrParents = _parentOrParents;
+ return this;
+ };
+ return Subscriber;
+}(Subscription_1.Subscription));
+exports.Subscriber = Subscriber;
+var SafeSubscriber = (function (_super) {
+ __extends(SafeSubscriber, _super);
+ function SafeSubscriber(_parentSubscriber, observerOrNext, error, complete) {
+ var _this = _super.call(this) || this;
+ _this._parentSubscriber = _parentSubscriber;
+ var next;
+ var context = _this;
+ if (isFunction_1.isFunction(observerOrNext)) {
+ next = observerOrNext;
+ }
+ else if (observerOrNext) {
+ next = observerOrNext.next;
+ error = observerOrNext.error;
+ complete = observerOrNext.complete;
+ if (observerOrNext !== Observer_1.empty) {
+ context = Object.create(observerOrNext);
+ if (isFunction_1.isFunction(context.unsubscribe)) {
+ _this.add(context.unsubscribe.bind(context));
+ }
+ context.unsubscribe = _this.unsubscribe.bind(_this);
+ }
+ }
+ _this._context = context;
+ _this._next = next;
+ _this._error = error;
+ _this._complete = complete;
+ return _this;
+ }
+ SafeSubscriber.prototype.next = function (value) {
+ if (!this.isStopped && this._next) {
+ var _parentSubscriber = this._parentSubscriber;
+ if (!config_1.config.useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
+ this.__tryOrUnsub(this._next, value);
+ }
+ else if (this.__tryOrSetError(_parentSubscriber, this._next, value)) {
+ this.unsubscribe();
+ }
+ }
+ };
+ SafeSubscriber.prototype.error = function (err) {
+ if (!this.isStopped) {
+ var _parentSubscriber = this._parentSubscriber;
+ var useDeprecatedSynchronousErrorHandling = config_1.config.useDeprecatedSynchronousErrorHandling;
+ if (this._error) {
+ if (!useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
+ this.__tryOrUnsub(this._error, err);
+ this.unsubscribe();
+ }
+ else {
+ this.__tryOrSetError(_parentSubscriber, this._error, err);
+ this.unsubscribe();
+ }
+ }
+ else if (!_parentSubscriber.syncErrorThrowable) {
+ this.unsubscribe();
+ if (useDeprecatedSynchronousErrorHandling) {
+ throw err;
+ }
+ hostReportError_1.hostReportError(err);
+ }
+ else {
+ if (useDeprecatedSynchronousErrorHandling) {
+ _parentSubscriber.syncErrorValue = err;
+ _parentSubscriber.syncErrorThrown = true;
+ }
+ else {
+ hostReportError_1.hostReportError(err);
+ }
+ this.unsubscribe();
+ }
+ }
+ };
+ SafeSubscriber.prototype.complete = function () {
+ var _this = this;
+ if (!this.isStopped) {
+ var _parentSubscriber = this._parentSubscriber;
+ if (this._complete) {
+ var wrappedComplete = function () { return _this._complete.call(_this._context); };
+ if (!config_1.config.useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
+ this.__tryOrUnsub(wrappedComplete);
+ this.unsubscribe();
+ }
+ else {
+ this.__tryOrSetError(_parentSubscriber, wrappedComplete);
+ this.unsubscribe();
+ }
+ }
+ else {
+ this.unsubscribe();
+ }
+ }
+ };
+ SafeSubscriber.prototype.__tryOrUnsub = function (fn, value) {
+ try {
+ fn.call(this._context, value);
+ }
+ catch (err) {
+ this.unsubscribe();
+ if (config_1.config.useDeprecatedSynchronousErrorHandling) {
+ throw err;
+ }
+ else {
+ hostReportError_1.hostReportError(err);
+ }
+ }
+ };
+ SafeSubscriber.prototype.__tryOrSetError = function (parent, fn, value) {
+ if (!config_1.config.useDeprecatedSynchronousErrorHandling) {
+ throw new Error('bad call');
+ }
+ try {
+ fn.call(this._context, value);
+ }
+ catch (err) {
+ if (config_1.config.useDeprecatedSynchronousErrorHandling) {
+ parent.syncErrorValue = err;
+ parent.syncErrorThrown = true;
+ return true;
+ }
+ else {
+ hostReportError_1.hostReportError(err);
+ return true;
+ }
+ }
+ return false;
+ };
+ SafeSubscriber.prototype._unsubscribe = function () {
+ var _parentSubscriber = this._parentSubscriber;
+ this._context = null;
+ this._parentSubscriber = null;
+ _parentSubscriber.unsubscribe();
+ };
+ return SafeSubscriber;
+}(Subscriber));
+exports.SafeSubscriber = SafeSubscriber;
+
+},{"../internal/symbol/rxSubscriber":210,"./Observer":49,"./Subscription":56,"./config":57,"./util/hostReportError":218,"./util/isFunction":223}],56:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var isArray_1 = require("./util/isArray");
+var isObject_1 = require("./util/isObject");
+var isFunction_1 = require("./util/isFunction");
+var UnsubscriptionError_1 = require("./util/UnsubscriptionError");
+var Subscription = (function () {
+ function Subscription(unsubscribe) {
+ this.closed = false;
+ this._parentOrParents = null;
+ this._subscriptions = null;
+ if (unsubscribe) {
+ this._unsubscribe = unsubscribe;
+ }
+ }
+ Subscription.prototype.unsubscribe = function () {
+ var errors;
+ if (this.closed) {
+ return;
+ }
+ var _a = this, _parentOrParents = _a._parentOrParents, _unsubscribe = _a._unsubscribe, _subscriptions = _a._subscriptions;
+ this.closed = true;
+ this._parentOrParents = null;
+ this._subscriptions = null;
+ if (_parentOrParents instanceof Subscription) {
+ _parentOrParents.remove(this);
+ }
+ else if (_parentOrParents !== null) {
+ for (var index = 0; index < _parentOrParents.length; ++index) {
+ var parent_1 = _parentOrParents[index];
+ parent_1.remove(this);
+ }
+ }
+ if (isFunction_1.isFunction(_unsubscribe)) {
+ try {
+ _unsubscribe.call(this);
+ }
+ catch (e) {
+ errors = e instanceof UnsubscriptionError_1.UnsubscriptionError ? flattenUnsubscriptionErrors(e.errors) : [e];
+ }
+ }
+ if (isArray_1.isArray(_subscriptions)) {
+ var index = -1;
+ var len = _subscriptions.length;
+ while (++index < len) {
+ var sub = _subscriptions[index];
+ if (isObject_1.isObject(sub)) {
+ try {
+ sub.unsubscribe();
+ }
+ catch (e) {
+ errors = errors || [];
+ if (e instanceof UnsubscriptionError_1.UnsubscriptionError) {
+ errors = errors.concat(flattenUnsubscriptionErrors(e.errors));
+ }
+ else {
+ errors.push(e);
+ }
+ }
+ }
+ }
+ }
+ if (errors) {
+ throw new UnsubscriptionError_1.UnsubscriptionError(errors);
+ }
+ };
+ Subscription.prototype.add = function (teardown) {
+ var subscription = teardown;
+ if (!teardown) {
+ return Subscription.EMPTY;
+ }
+ switch (typeof teardown) {
+ case 'function':
+ subscription = new Subscription(teardown);
+ case 'object':
+ if (subscription === this || subscription.closed || typeof subscription.unsubscribe !== 'function') {
+ return subscription;
+ }
+ else if (this.closed) {
+ subscription.unsubscribe();
+ return subscription;
+ }
+ else if (!(subscription instanceof Subscription)) {
+ var tmp = subscription;
+ subscription = new Subscription();
+ subscription._subscriptions = [tmp];
+ }
+ break;
+ default: {
+ throw new Error('unrecognized teardown ' + teardown + ' added to Subscription.');
+ }
+ }
+ var _parentOrParents = subscription._parentOrParents;
+ if (_parentOrParents === null) {
+ subscription._parentOrParents = this;
+ }
+ else if (_parentOrParents instanceof Subscription) {
+ if (_parentOrParents === this) {
+ return subscription;
+ }
+ subscription._parentOrParents = [_parentOrParents, this];
+ }
+ else if (_parentOrParents.indexOf(this) === -1) {
+ _parentOrParents.push(this);
+ }
+ else {
+ return subscription;
+ }
+ var subscriptions = this._subscriptions;
+ if (subscriptions === null) {
+ this._subscriptions = [subscription];
+ }
+ else {
+ subscriptions.push(subscription);
+ }
+ return subscription;
+ };
+ Subscription.prototype.remove = function (subscription) {
+ var subscriptions = this._subscriptions;
+ if (subscriptions) {
+ var subscriptionIndex = subscriptions.indexOf(subscription);
+ if (subscriptionIndex !== -1) {
+ subscriptions.splice(subscriptionIndex, 1);
+ }
+ }
+ };
+ Subscription.EMPTY = (function (empty) {
+ empty.closed = true;
+ return empty;
+ }(new Subscription()));
+ return Subscription;
+}());
+exports.Subscription = Subscription;
+function flattenUnsubscriptionErrors(errors) {
+ return errors.reduce(function (errs, err) { return errs.concat((err instanceof UnsubscriptionError_1.UnsubscriptionError) ? err.errors : err); }, []);
+}
+
+},{"./util/UnsubscriptionError":216,"./util/isArray":220,"./util/isFunction":223,"./util/isObject":227}],57:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var _enable_super_gross_mode_that_will_cause_bad_things = false;
+exports.config = {
+ Promise: undefined,
+ set useDeprecatedSynchronousErrorHandling(value) {
+ if (value) {
+ var error = new Error();
+ console.warn('DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \n' + error.stack);
+ }
+ else if (_enable_super_gross_mode_that_will_cause_bad_things) {
+ console.log('RxJS: Back to a better error behavior. Thank you. <3');
+ }
+ _enable_super_gross_mode_that_will_cause_bad_things = value;
+ },
+ get useDeprecatedSynchronousErrorHandling() {
+ return _enable_super_gross_mode_that_will_cause_bad_things;
+ },
+};
+
+},{}],58:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var Subject_1 = require("../Subject");
+var Observable_1 = require("../Observable");
+var Subscriber_1 = require("../Subscriber");
+var Subscription_1 = require("../Subscription");
+var refCount_1 = require("../operators/refCount");
+var ConnectableObservable = (function (_super) {
+ __extends(ConnectableObservable, _super);
+ function ConnectableObservable(source, subjectFactory) {
+ var _this = _super.call(this) || this;
+ _this.source = source;
+ _this.subjectFactory = subjectFactory;
+ _this._refCount = 0;
+ _this._isComplete = false;
+ return _this;
+ }
+ ConnectableObservable.prototype._subscribe = function (subscriber) {
+ return this.getSubject().subscribe(subscriber);
+ };
+ ConnectableObservable.prototype.getSubject = function () {
+ var subject = this._subject;
+ if (!subject || subject.isStopped) {
+ this._subject = this.subjectFactory();
+ }
+ return this._subject;
+ };
+ ConnectableObservable.prototype.connect = function () {
+ var connection = this._connection;
+ if (!connection) {
+ this._isComplete = false;
+ connection = this._connection = new Subscription_1.Subscription();
+ connection.add(this.source
+ .subscribe(new ConnectableSubscriber(this.getSubject(), this)));
+ if (connection.closed) {
+ this._connection = null;
+ connection = Subscription_1.Subscription.EMPTY;
+ }
+ }
+ return connection;
+ };
+ ConnectableObservable.prototype.refCount = function () {
+ return refCount_1.refCount()(this);
+ };
+ return ConnectableObservable;
+}(Observable_1.Observable));
+exports.ConnectableObservable = ConnectableObservable;
+exports.connectableObservableDescriptor = (function () {
+ var connectableProto = ConnectableObservable.prototype;
+ return {
+ operator: { value: null },
+ _refCount: { value: 0, writable: true },
+ _subject: { value: null, writable: true },
+ _connection: { value: null, writable: true },
+ _subscribe: { value: connectableProto._subscribe },
+ _isComplete: { value: connectableProto._isComplete, writable: true },
+ getSubject: { value: connectableProto.getSubject },
+ connect: { value: connectableProto.connect },
+ refCount: { value: connectableProto.refCount }
+ };
+})();
+var ConnectableSubscriber = (function (_super) {
+ __extends(ConnectableSubscriber, _super);
+ function ConnectableSubscriber(destination, connectable) {
+ var _this = _super.call(this, destination) || this;
+ _this.connectable = connectable;
+ return _this;
+ }
+ ConnectableSubscriber.prototype._error = function (err) {
+ this._unsubscribe();
+ _super.prototype._error.call(this, err);
+ };
+ ConnectableSubscriber.prototype._complete = function () {
+ this.connectable._isComplete = true;
+ this._unsubscribe();
+ _super.prototype._complete.call(this);
+ };
+ ConnectableSubscriber.prototype._unsubscribe = function () {
+ var connectable = this.connectable;
+ if (connectable) {
+ this.connectable = null;
+ var connection = connectable._connection;
+ connectable._refCount = 0;
+ connectable._subject = null;
+ connectable._connection = null;
+ if (connection) {
+ connection.unsubscribe();
+ }
+ }
+ };
+ return ConnectableSubscriber;
+}(Subject_1.SubjectSubscriber));
+var RefCountOperator = (function () {
+ function RefCountOperator(connectable) {
+ this.connectable = connectable;
+ }
+ RefCountOperator.prototype.call = function (subscriber, source) {
+ var connectable = this.connectable;
+ connectable._refCount++;
+ var refCounter = new RefCountSubscriber(subscriber, connectable);
+ var subscription = source.subscribe(refCounter);
+ if (!refCounter.closed) {
+ refCounter.connection = connectable.connect();
+ }
+ return subscription;
+ };
+ return RefCountOperator;
+}());
+var RefCountSubscriber = (function (_super) {
+ __extends(RefCountSubscriber, _super);
+ function RefCountSubscriber(destination, connectable) {
+ var _this = _super.call(this, destination) || this;
+ _this.connectable = connectable;
+ return _this;
+ }
+ RefCountSubscriber.prototype._unsubscribe = function () {
+ var connectable = this.connectable;
+ if (!connectable) {
+ this.connection = null;
+ return;
+ }
+ this.connectable = null;
+ var refCount = connectable._refCount;
+ if (refCount <= 0) {
+ this.connection = null;
+ return;
+ }
+ connectable._refCount = refCount - 1;
+ if (refCount > 1) {
+ this.connection = null;
+ return;
+ }
+ var connection = this.connection;
+ var sharedConnection = connectable._connection;
+ this.connection = null;
+ if (sharedConnection && (!connection || sharedConnection === connection)) {
+ sharedConnection.unsubscribe();
+ }
+ };
+ return RefCountSubscriber;
+}(Subscriber_1.Subscriber));
+
+},{"../Observable":48,"../Subject":53,"../Subscriber":55,"../Subscription":56,"../operators/refCount":147}],59:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var Observable_1 = require("../Observable");
+var asap_1 = require("../scheduler/asap");
+var isNumeric_1 = require("../util/isNumeric");
+var SubscribeOnObservable = (function (_super) {
+ __extends(SubscribeOnObservable, _super);
+ function SubscribeOnObservable(source, delayTime, scheduler) {
+ if (delayTime === void 0) { delayTime = 0; }
+ if (scheduler === void 0) { scheduler = asap_1.asap; }
+ var _this = _super.call(this) || this;
+ _this.source = source;
+ _this.delayTime = delayTime;
+ _this.scheduler = scheduler;
+ if (!isNumeric_1.isNumeric(delayTime) || delayTime < 0) {
+ _this.delayTime = 0;
+ }
+ if (!scheduler || typeof scheduler.schedule !== 'function') {
+ _this.scheduler = asap_1.asap;
+ }
+ return _this;
+ }
+ SubscribeOnObservable.create = function (source, delay, scheduler) {
+ if (delay === void 0) { delay = 0; }
+ if (scheduler === void 0) { scheduler = asap_1.asap; }
+ return new SubscribeOnObservable(source, delay, scheduler);
+ };
+ SubscribeOnObservable.dispatch = function (arg) {
+ var source = arg.source, subscriber = arg.subscriber;
+ return this.add(source.subscribe(subscriber));
+ };
+ SubscribeOnObservable.prototype._subscribe = function (subscriber) {
+ var delay = this.delayTime;
+ var source = this.source;
+ var scheduler = this.scheduler;
+ return scheduler.schedule(SubscribeOnObservable.dispatch, delay, {
+ source: source, subscriber: subscriber
+ });
+ };
+ return SubscribeOnObservable;
+}(Observable_1.Observable));
+exports.SubscribeOnObservable = SubscribeOnObservable;
+
+},{"../Observable":48,"../scheduler/asap":205,"../util/isNumeric":226}],60:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var Observable_1 = require("../Observable");
+var AsyncSubject_1 = require("../AsyncSubject");
+var map_1 = require("../operators/map");
+var canReportError_1 = require("../util/canReportError");
+var isArray_1 = require("../util/isArray");
+var isScheduler_1 = require("../util/isScheduler");
+function bindCallback(callbackFunc, resultSelector, scheduler) {
+ if (resultSelector) {
+ if (isScheduler_1.isScheduler(resultSelector)) {
+ scheduler = resultSelector;
+ }
+ else {
+ return function () {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ return bindCallback(callbackFunc, scheduler).apply(void 0, args).pipe(map_1.map(function (args) { return isArray_1.isArray(args) ? resultSelector.apply(void 0, args) : resultSelector(args); }));
+ };
+ }
+ }
+ return function () {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ var context = this;
+ var subject;
+ var params = {
+ context: context,
+ subject: subject,
+ callbackFunc: callbackFunc,
+ scheduler: scheduler,
+ };
+ return new Observable_1.Observable(function (subscriber) {
+ if (!scheduler) {
+ if (!subject) {
+ subject = new AsyncSubject_1.AsyncSubject();
+ var handler = function () {
+ var innerArgs = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ innerArgs[_i] = arguments[_i];
+ }
+ subject.next(innerArgs.length <= 1 ? innerArgs[0] : innerArgs);
+ subject.complete();
+ };
+ try {
+ callbackFunc.apply(context, args.concat([handler]));
+ }
+ catch (err) {
+ if (canReportError_1.canReportError(subject)) {
+ subject.error(err);
+ }
+ else {
+ console.warn(err);
+ }
+ }
+ }
+ return subject.subscribe(subscriber);
+ }
+ else {
+ var state = {
+ args: args, subscriber: subscriber, params: params,
+ };
+ return scheduler.schedule(dispatch, 0, state);
+ }
+ });
+ };
+}
+exports.bindCallback = bindCallback;
+function dispatch(state) {
+ var _this = this;
+ var self = this;
+ var args = state.args, subscriber = state.subscriber, params = state.params;
+ var callbackFunc = params.callbackFunc, context = params.context, scheduler = params.scheduler;
+ var subject = params.subject;
+ if (!subject) {
+ subject = params.subject = new AsyncSubject_1.AsyncSubject();
+ var handler = function () {
+ var innerArgs = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ innerArgs[_i] = arguments[_i];
+ }
+ var value = innerArgs.length <= 1 ? innerArgs[0] : innerArgs;
+ _this.add(scheduler.schedule(dispatchNext, 0, { value: value, subject: subject }));
+ };
+ try {
+ callbackFunc.apply(context, args.concat([handler]));
+ }
+ catch (err) {
+ subject.error(err);
+ }
+ }
+ this.add(subject.subscribe(subscriber));
+}
+function dispatchNext(state) {
+ var value = state.value, subject = state.subject;
+ subject.next(value);
+ subject.complete();
+}
+function dispatchError(state) {
+ var err = state.err, subject = state.subject;
+ subject.error(err);
+}
+
+},{"../AsyncSubject":44,"../Observable":48,"../operators/map":125,"../util/canReportError":217,"../util/isArray":220,"../util/isScheduler":230}],61:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var Observable_1 = require("../Observable");
+var AsyncSubject_1 = require("../AsyncSubject");
+var map_1 = require("../operators/map");
+var canReportError_1 = require("../util/canReportError");
+var isScheduler_1 = require("../util/isScheduler");
+var isArray_1 = require("../util/isArray");
+function bindNodeCallback(callbackFunc, resultSelector, scheduler) {
+ if (resultSelector) {
+ if (isScheduler_1.isScheduler(resultSelector)) {
+ scheduler = resultSelector;
+ }
+ else {
+ return function () {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ return bindNodeCallback(callbackFunc, scheduler).apply(void 0, args).pipe(map_1.map(function (args) { return isArray_1.isArray(args) ? resultSelector.apply(void 0, args) : resultSelector(args); }));
+ };
+ }
+ }
+ return function () {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ var params = {
+ subject: undefined,
+ args: args,
+ callbackFunc: callbackFunc,
+ scheduler: scheduler,
+ context: this,
+ };
+ return new Observable_1.Observable(function (subscriber) {
+ var context = params.context;
+ var subject = params.subject;
+ if (!scheduler) {
+ if (!subject) {
+ subject = params.subject = new AsyncSubject_1.AsyncSubject();
+ var handler = function () {
+ var innerArgs = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ innerArgs[_i] = arguments[_i];
+ }
+ var err = innerArgs.shift();
+ if (err) {
+ subject.error(err);
+ return;
+ }
+ subject.next(innerArgs.length <= 1 ? innerArgs[0] : innerArgs);
+ subject.complete();
+ };
+ try {
+ callbackFunc.apply(context, args.concat([handler]));
+ }
+ catch (err) {
+ if (canReportError_1.canReportError(subject)) {
+ subject.error(err);
+ }
+ else {
+ console.warn(err);
+ }
+ }
+ }
+ return subject.subscribe(subscriber);
+ }
+ else {
+ return scheduler.schedule(dispatch, 0, { params: params, subscriber: subscriber, context: context });
+ }
+ });
+ };
+}
+exports.bindNodeCallback = bindNodeCallback;
+function dispatch(state) {
+ var _this = this;
+ var params = state.params, subscriber = state.subscriber, context = state.context;
+ var callbackFunc = params.callbackFunc, args = params.args, scheduler = params.scheduler;
+ var subject = params.subject;
+ if (!subject) {
+ subject = params.subject = new AsyncSubject_1.AsyncSubject();
+ var handler = function () {
+ var innerArgs = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ innerArgs[_i] = arguments[_i];
+ }
+ var err = innerArgs.shift();
+ if (err) {
+ _this.add(scheduler.schedule(dispatchError, 0, { err: err, subject: subject }));
+ }
+ else {
+ var value = innerArgs.length <= 1 ? innerArgs[0] : innerArgs;
+ _this.add(scheduler.schedule(dispatchNext, 0, { value: value, subject: subject }));
+ }
+ };
+ try {
+ callbackFunc.apply(context, args.concat([handler]));
+ }
+ catch (err) {
+ this.add(scheduler.schedule(dispatchError, 0, { err: err, subject: subject }));
+ }
+ }
+ this.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);
+}
+
+},{"../AsyncSubject":44,"../Observable":48,"../operators/map":125,"../util/canReportError":217,"../util/isArray":220,"../util/isScheduler":230}],62:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var isScheduler_1 = require("../util/isScheduler");
+var isArray_1 = require("../util/isArray");
+var OuterSubscriber_1 = require("../OuterSubscriber");
+var subscribeToResult_1 = require("../util/subscribeToResult");
+var fromArray_1 = require("./fromArray");
+var NONE = {};
+function combineLatest() {
+ var observables = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ observables[_i] = arguments[_i];
+ }
+ var resultSelector = null;
+ var scheduler = null;
+ if (isScheduler_1.isScheduler(observables[observables.length - 1])) {
+ scheduler = observables.pop();
+ }
+ if (typeof observables[observables.length - 1] === 'function') {
+ resultSelector = observables.pop();
+ }
+ if (observables.length === 1 && isArray_1.isArray(observables[0])) {
+ observables = observables[0];
+ }
+ return fromArray_1.fromArray(observables, scheduler).lift(new CombineLatestOperator(resultSelector));
+}
+exports.combineLatest = combineLatest;
+var CombineLatestOperator = (function () {
+ function CombineLatestOperator(resultSelector) {
+ this.resultSelector = resultSelector;
+ }
+ CombineLatestOperator.prototype.call = function (subscriber, source) {
+ return source.subscribe(new CombineLatestSubscriber(subscriber, this.resultSelector));
+ };
+ return CombineLatestOperator;
+}());
+exports.CombineLatestOperator = CombineLatestOperator;
+var CombineLatestSubscriber = (function (_super) {
+ __extends(CombineLatestSubscriber, _super);
+ function CombineLatestSubscriber(destination, resultSelector) {
+ var _this = _super.call(this, destination) || this;
+ _this.resultSelector = resultSelector;
+ _this.active = 0;
+ _this.values = [];
+ _this.observables = [];
+ return _this;
+ }
+ CombineLatestSubscriber.prototype._next = function (observable) {
+ this.values.push(NONE);
+ this.observables.push(observable);
+ };
+ CombineLatestSubscriber.prototype._complete = function () {
+ var observables = this.observables;
+ var len = observables.length;
+ if (len === 0) {
+ this.destination.complete();
+ }
+ else {
+ this.active = len;
+ this.toRespond = len;
+ for (var i = 0; i < len; i++) {
+ var observable = observables[i];
+ this.add(subscribeToResult_1.subscribeToResult(this, observable, observable, i));
+ }
+ }
+ };
+ CombineLatestSubscriber.prototype.notifyComplete = function (unused) {
+ if ((this.active -= 1) === 0) {
+ this.destination.complete();
+ }
+ };
+ CombineLatestSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
+ var values = this.values;
+ var oldVal = values[outerIndex];
+ var toRespond = !this.toRespond
+ ? 0
+ : oldVal === NONE ? --this.toRespond : this.toRespond;
+ values[outerIndex] = innerValue;
+ if (toRespond === 0) {
+ if (this.resultSelector) {
+ this._tryResultSelector(values);
+ }
+ else {
+ this.destination.next(values.slice());
+ }
+ }
+ };
+ CombineLatestSubscriber.prototype._tryResultSelector = function (values) {
+ var result;
+ try {
+ result = this.resultSelector.apply(this, values);
+ }
+ catch (err) {
+ this.destination.error(err);
+ return;
+ }
+ this.destination.next(result);
+ };
+ return CombineLatestSubscriber;
+}(OuterSubscriber_1.OuterSubscriber));
+exports.CombineLatestSubscriber = CombineLatestSubscriber;
+
+},{"../OuterSubscriber":50,"../util/isArray":220,"../util/isScheduler":230,"../util/subscribeToResult":239,"./fromArray":68}],63:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var of_1 = require("./of");
+var concatAll_1 = require("../operators/concatAll");
+function concat() {
+ var observables = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ observables[_i] = arguments[_i];
+ }
+ return concatAll_1.concatAll()(of_1.of.apply(void 0, observables));
+}
+exports.concat = concat;
+
+},{"../operators/concatAll":97,"./of":76}],64:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var Observable_1 = require("../Observable");
+var from_1 = require("./from");
+var empty_1 = require("./empty");
+function defer(observableFactory) {
+ return new Observable_1.Observable(function (subscriber) {
+ var input;
+ try {
+ input = observableFactory();
+ }
+ catch (err) {
+ subscriber.error(err);
+ return undefined;
+ }
+ var source = input ? from_1.from(input) : empty_1.empty();
+ return source.subscribe(subscriber);
+ });
+}
+exports.defer = defer;
+
+},{"../Observable":48,"./empty":65,"./from":67}],65:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var Observable_1 = require("../Observable");
+exports.EMPTY = new Observable_1.Observable(function (subscriber) { return subscriber.complete(); });
+function empty(scheduler) {
+ return scheduler ? emptyScheduled(scheduler) : exports.EMPTY;
+}
+exports.empty = empty;
+function emptyScheduled(scheduler) {
+ return new Observable_1.Observable(function (subscriber) { return scheduler.schedule(function () { return subscriber.complete(); }); });
+}
+
+},{"../Observable":48}],66:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var Observable_1 = require("../Observable");
+var isArray_1 = require("../util/isArray");
+var map_1 = require("../operators/map");
+var isObject_1 = require("../util/isObject");
+var from_1 = require("./from");
+function forkJoin() {
+ var sources = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ sources[_i] = arguments[_i];
+ }
+ if (sources.length === 1) {
+ var first_1 = sources[0];
+ if (isArray_1.isArray(first_1)) {
+ return forkJoinInternal(first_1, null);
+ }
+ if (isObject_1.isObject(first_1) && Object.getPrototypeOf(first_1) === Object.prototype) {
+ var keys = Object.keys(first_1);
+ return forkJoinInternal(keys.map(function (key) { return first_1[key]; }), keys);
+ }
+ }
+ if (typeof sources[sources.length - 1] === 'function') {
+ var resultSelector_1 = sources.pop();
+ sources = (sources.length === 1 && isArray_1.isArray(sources[0])) ? sources[0] : sources;
+ return forkJoinInternal(sources, null).pipe(map_1.map(function (args) { return resultSelector_1.apply(void 0, args); }));
+ }
+ return forkJoinInternal(sources, null);
+}
+exports.forkJoin = forkJoin;
+function forkJoinInternal(sources, keys) {
+ return new Observable_1.Observable(function (subscriber) {
+ var len = sources.length;
+ if (len === 0) {
+ subscriber.complete();
+ return;
+ }
+ var values = new Array(len);
+ var completed = 0;
+ var emitted = 0;
+ var _loop_1 = function (i) {
+ var source = from_1.from(sources[i]);
+ var hasValue = false;
+ subscriber.add(source.subscribe({
+ next: function (value) {
+ if (!hasValue) {
+ hasValue = true;
+ emitted++;
+ }
+ values[i] = value;
+ },
+ error: function (err) { return subscriber.error(err); },
+ complete: function () {
+ completed++;
+ if (completed === len || !hasValue) {
+ if (emitted === len) {
+ subscriber.next(keys ?
+ keys.reduce(function (result, key, i) { return (result[key] = values[i], result); }, {}) :
+ values);
+ }
+ subscriber.complete();
+ }
+ }
+ }));
+ };
+ for (var i = 0; i < len; i++) {
+ _loop_1(i);
+ }
+ });
+}
+
+},{"../Observable":48,"../operators/map":125,"../util/isArray":220,"../util/isObject":227,"./from":67}],67:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var Observable_1 = require("../Observable");
+var subscribeTo_1 = require("../util/subscribeTo");
+var scheduled_1 = require("../scheduled/scheduled");
+function from(input, scheduler) {
+ if (!scheduler) {
+ if (input instanceof Observable_1.Observable) {
+ return input;
+ }
+ return new Observable_1.Observable(subscribeTo_1.subscribeTo(input));
+ }
+ else {
+ return scheduled_1.scheduled(input, scheduler);
+ }
+}
+exports.from = from;
+
+},{"../Observable":48,"../scheduled/scheduled":193,"../util/subscribeTo":234}],68:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var Observable_1 = require("../Observable");
+var subscribeToArray_1 = require("../util/subscribeToArray");
+var scheduleArray_1 = require("../scheduled/scheduleArray");
+function fromArray(input, scheduler) {
+ if (!scheduler) {
+ return new Observable_1.Observable(subscribeToArray_1.subscribeToArray(input));
+ }
+ else {
+ return scheduleArray_1.scheduleArray(input, scheduler);
+ }
+}
+exports.fromArray = fromArray;
+
+},{"../Observable":48,"../scheduled/scheduleArray":189,"../util/subscribeToArray":235}],69:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var Observable_1 = require("../Observable");
+var isArray_1 = require("../util/isArray");
+var isFunction_1 = require("../util/isFunction");
+var map_1 = require("../operators/map");
+var toString = (function () { return Object.prototype.toString; })();
+function fromEvent(target, eventName, options, resultSelector) {
+ if (isFunction_1.isFunction(options)) {
+ resultSelector = options;
+ options = undefined;
+ }
+ if (resultSelector) {
+ return fromEvent(target, eventName, options).pipe(map_1.map(function (args) { return isArray_1.isArray(args) ? resultSelector.apply(void 0, args) : resultSelector(args); }));
+ }
+ return new Observable_1.Observable(function (subscriber) {
+ function handler(e) {
+ if (arguments.length > 1) {
+ subscriber.next(Array.prototype.slice.call(arguments));
+ }
+ else {
+ subscriber.next(e);
+ }
+ }
+ setupSubscription(target, eventName, handler, subscriber, options);
+ });
+}
+exports.fromEvent = fromEvent;
+function setupSubscription(sourceObj, eventName, handler, subscriber, options) {
+ var unsubscribe;
+ if (isEventTarget(sourceObj)) {
+ var source_1 = sourceObj;
+ sourceObj.addEventListener(eventName, handler, options);
+ unsubscribe = function () { return source_1.removeEventListener(eventName, handler, options); };
+ }
+ else if (isJQueryStyleEventEmitter(sourceObj)) {
+ var source_2 = sourceObj;
+ sourceObj.on(eventName, handler);
+ unsubscribe = function () { return source_2.off(eventName, handler); };
+ }
+ else if (isNodeStyleEventEmitter(sourceObj)) {
+ var source_3 = sourceObj;
+ sourceObj.addListener(eventName, handler);
+ unsubscribe = function () { return source_3.removeListener(eventName, handler); };
+ }
+ else if (sourceObj && sourceObj.length) {
+ for (var i = 0, len = sourceObj.length; i < len; i++) {
+ setupSubscription(sourceObj[i], eventName, handler, subscriber, options);
+ }
+ }
+ else {
+ throw new TypeError('Invalid event target');
+ }
+ subscriber.add(unsubscribe);
+}
+function isNodeStyleEventEmitter(sourceObj) {
+ return sourceObj && typeof sourceObj.addListener === 'function' && typeof sourceObj.removeListener === 'function';
+}
+function isJQueryStyleEventEmitter(sourceObj) {
+ return sourceObj && typeof sourceObj.on === 'function' && typeof sourceObj.off === 'function';
+}
+function isEventTarget(sourceObj) {
+ return sourceObj && typeof sourceObj.addEventListener === 'function' && typeof sourceObj.removeEventListener === 'function';
+}
+
+},{"../Observable":48,"../operators/map":125,"../util/isArray":220,"../util/isFunction":223}],70:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var Observable_1 = require("../Observable");
+var isArray_1 = require("../util/isArray");
+var isFunction_1 = require("../util/isFunction");
+var map_1 = require("../operators/map");
+function fromEventPattern(addHandler, removeHandler, resultSelector) {
+ if (resultSelector) {
+ return fromEventPattern(addHandler, removeHandler).pipe(map_1.map(function (args) { return isArray_1.isArray(args) ? resultSelector.apply(void 0, args) : resultSelector(args); }));
+ }
+ return new Observable_1.Observable(function (subscriber) {
+ var handler = function () {
+ var e = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ e[_i] = arguments[_i];
+ }
+ return subscriber.next(e.length === 1 ? e[0] : e);
+ };
+ var retValue;
+ try {
+ retValue = addHandler(handler);
+ }
+ catch (err) {
+ subscriber.error(err);
+ return undefined;
+ }
+ if (!isFunction_1.isFunction(removeHandler)) {
+ return undefined;
+ }
+ return function () { return removeHandler(handler, retValue); };
+ });
+}
+exports.fromEventPattern = fromEventPattern;
+
+},{"../Observable":48,"../operators/map":125,"../util/isArray":220,"../util/isFunction":223}],71:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var Observable_1 = require("../Observable");
+var identity_1 = require("../util/identity");
+var isScheduler_1 = require("../util/isScheduler");
+function generate(initialStateOrOptions, condition, iterate, resultSelectorOrObservable, scheduler) {
+ var resultSelector;
+ var initialState;
+ if (arguments.length == 1) {
+ var options = initialStateOrOptions;
+ initialState = options.initialState;
+ condition = options.condition;
+ iterate = options.iterate;
+ resultSelector = options.resultSelector || identity_1.identity;
+ scheduler = options.scheduler;
+ }
+ else if (resultSelectorOrObservable === undefined || isScheduler_1.isScheduler(resultSelectorOrObservable)) {
+ initialState = initialStateOrOptions;
+ resultSelector = identity_1.identity;
+ scheduler = resultSelectorOrObservable;
+ }
+ else {
+ initialState = initialStateOrOptions;
+ resultSelector = resultSelectorOrObservable;
+ }
+ return new Observable_1.Observable(function (subscriber) {
+ var state = initialState;
+ if (scheduler) {
+ return scheduler.schedule(dispatch, 0, {
+ subscriber: subscriber,
+ iterate: iterate,
+ condition: condition,
+ resultSelector: resultSelector,
+ state: state
+ });
+ }
+ do {
+ if (condition) {
+ var conditionResult = void 0;
+ try {
+ conditionResult = condition(state);
+ }
+ catch (err) {
+ subscriber.error(err);
+ return undefined;
+ }
+ if (!conditionResult) {
+ subscriber.complete();
+ break;
+ }
+ }
+ var value = void 0;
+ try {
+ value = resultSelector(state);
+ }
+ catch (err) {
+ subscriber.error(err);
+ return undefined;
+ }
+ subscriber.next(value);
+ if (subscriber.closed) {
+ break;
+ }
+ try {
+ state = iterate(state);
+ }
+ catch (err) {
+ subscriber.error(err);
+ return undefined;
+ }
+ } while (true);
+ return undefined;
+ });
+}
+exports.generate = generate;
+function dispatch(state) {
+ var subscriber = state.subscriber, condition = state.condition;
+ if (subscriber.closed) {
+ return undefined;
+ }
+ if (state.needIterate) {
+ try {
+ state.state = state.iterate(state.state);
+ }
+ catch (err) {
+ subscriber.error(err);
+ return undefined;
+ }
+ }
+ else {
+ state.needIterate = true;
+ }
+ if (condition) {
+ var conditionResult = void 0;
+ try {
+ conditionResult = condition(state.state);
+ }
+ catch (err) {
+ subscriber.error(err);
+ return undefined;
+ }
+ if (!conditionResult) {
+ subscriber.complete();
+ return undefined;
+ }
+ if (subscriber.closed) {
+ return undefined;
+ }
+ }
+ var value;
+ try {
+ value = state.resultSelector(state.state);
+ }
+ catch (err) {
+ subscriber.error(err);
+ return undefined;
+ }
+ if (subscriber.closed) {
+ return undefined;
+ }
+ subscriber.next(value);
+ if (subscriber.closed) {
+ return undefined;
+ }
+ return this.schedule(state);
+}
+
+},{"../Observable":48,"../util/identity":219,"../util/isScheduler":230}],72:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var defer_1 = require("./defer");
+var empty_1 = require("./empty");
+function iif(condition, trueResult, falseResult) {
+ if (trueResult === void 0) { trueResult = empty_1.EMPTY; }
+ if (falseResult === void 0) { falseResult = empty_1.EMPTY; }
+ return defer_1.defer(function () { return condition() ? trueResult : falseResult; });
+}
+exports.iif = iif;
+
+},{"./defer":64,"./empty":65}],73:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var Observable_1 = require("../Observable");
+var async_1 = require("../scheduler/async");
+var isNumeric_1 = require("../util/isNumeric");
+function interval(period, scheduler) {
+ if (period === void 0) { period = 0; }
+ if (scheduler === void 0) { scheduler = async_1.async; }
+ if (!isNumeric_1.isNumeric(period) || period < 0) {
+ period = 0;
+ }
+ if (!scheduler || typeof scheduler.schedule !== 'function') {
+ scheduler = async_1.async;
+ }
+ return new Observable_1.Observable(function (subscriber) {
+ subscriber.add(scheduler.schedule(dispatch, period, { subscriber: subscriber, counter: 0, period: period }));
+ return subscriber;
+ });
+}
+exports.interval = interval;
+function dispatch(state) {
+ var subscriber = state.subscriber, counter = state.counter, period = state.period;
+ subscriber.next(counter);
+ this.schedule({ subscriber: subscriber, counter: counter + 1, period: period }, period);
+}
+
+},{"../Observable":48,"../scheduler/async":206,"../util/isNumeric":226}],74:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var Observable_1 = require("../Observable");
+var isScheduler_1 = require("../util/isScheduler");
+var mergeAll_1 = require("../operators/mergeAll");
+var fromArray_1 = require("./fromArray");
+function merge() {
+ var observables = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ observables[_i] = arguments[_i];
+ }
+ var concurrent = Number.POSITIVE_INFINITY;
+ var scheduler = null;
+ var last = observables[observables.length - 1];
+ if (isScheduler_1.isScheduler(last)) {
+ scheduler = observables.pop();
+ if (observables.length > 1 && typeof observables[observables.length - 1] === 'number') {
+ concurrent = observables.pop();
+ }
+ }
+ else if (typeof last === 'number') {
+ concurrent = observables.pop();
+ }
+ if (scheduler === null && observables.length === 1 && observables[0] instanceof Observable_1.Observable) {
+ return observables[0];
+ }
+ return mergeAll_1.mergeAll(concurrent)(fromArray_1.fromArray(observables, scheduler));
+}
+exports.merge = merge;
+
+},{"../Observable":48,"../operators/mergeAll":130,"../util/isScheduler":230,"./fromArray":68}],75:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var Observable_1 = require("../Observable");
+var noop_1 = require("../util/noop");
+exports.NEVER = new Observable_1.Observable(noop_1.noop);
+function never() {
+ return exports.NEVER;
+}
+exports.never = never;
+
+},{"../Observable":48,"../util/noop":231}],76:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var isScheduler_1 = require("../util/isScheduler");
+var fromArray_1 = require("./fromArray");
+var scheduleArray_1 = require("../scheduled/scheduleArray");
+function of() {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ var scheduler = args[args.length - 1];
+ if (isScheduler_1.isScheduler(scheduler)) {
+ args.pop();
+ return scheduleArray_1.scheduleArray(args, scheduler);
+ }
+ else {
+ return fromArray_1.fromArray(args);
+ }
+}
+exports.of = of;
+
+},{"../scheduled/scheduleArray":189,"../util/isScheduler":230,"./fromArray":68}],77:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var Observable_1 = require("../Observable");
+var from_1 = require("./from");
+var isArray_1 = require("../util/isArray");
+var empty_1 = require("./empty");
+function onErrorResumeNext() {
+ var sources = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ sources[_i] = arguments[_i];
+ }
+ if (sources.length === 0) {
+ return empty_1.EMPTY;
+ }
+ var first = sources[0], remainder = sources.slice(1);
+ if (sources.length === 1 && isArray_1.isArray(first)) {
+ return onErrorResumeNext.apply(void 0, first);
+ }
+ return new Observable_1.Observable(function (subscriber) {
+ var subNext = function () { return subscriber.add(onErrorResumeNext.apply(void 0, remainder).subscribe(subscriber)); };
+ return from_1.from(first).subscribe({
+ next: function (value) { subscriber.next(value); },
+ error: subNext,
+ complete: subNext,
+ });
+ });
+}
+exports.onErrorResumeNext = onErrorResumeNext;
+
+},{"../Observable":48,"../util/isArray":220,"./empty":65,"./from":67}],78:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var Observable_1 = require("../Observable");
+var Subscription_1 = require("../Subscription");
+function pairs(obj, scheduler) {
+ if (!scheduler) {
+ return new Observable_1.Observable(function (subscriber) {
+ var keys = Object.keys(obj);
+ for (var i = 0; i < keys.length && !subscriber.closed; i++) {
+ var key = keys[i];
+ if (obj.hasOwnProperty(key)) {
+ subscriber.next([key, obj[key]]);
+ }
+ }
+ subscriber.complete();
+ });
+ }
+ else {
+ return new Observable_1.Observable(function (subscriber) {
+ var keys = Object.keys(obj);
+ var subscription = new Subscription_1.Subscription();
+ subscription.add(scheduler.schedule(dispatch, 0, { keys: keys, index: 0, subscriber: subscriber, subscription: subscription, obj: obj }));
+ return subscription;
+ });
+ }
+}
+exports.pairs = pairs;
+function dispatch(state) {
+ var keys = state.keys, index = state.index, subscriber = state.subscriber, subscription = state.subscription, obj = state.obj;
+ if (!subscriber.closed) {
+ if (index < keys.length) {
+ var key = keys[index];
+ subscriber.next([key, obj[key]]);
+ subscription.add(this.schedule({ keys: keys, index: index + 1, subscriber: subscriber, subscription: subscription, obj: obj }));
+ }
+ else {
+ subscriber.complete();
+ }
+ }
+}
+exports.dispatch = dispatch;
+
+},{"../Observable":48,"../Subscription":56}],79:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var not_1 = require("../util/not");
+var subscribeTo_1 = require("../util/subscribeTo");
+var filter_1 = require("../operators/filter");
+var Observable_1 = require("../Observable");
+function partition(source, predicate, thisArg) {
+ return [
+ filter_1.filter(predicate, thisArg)(new Observable_1.Observable(subscribeTo_1.subscribeTo(source))),
+ filter_1.filter(not_1.not(predicate, thisArg))(new Observable_1.Observable(subscribeTo_1.subscribeTo(source)))
+ ];
+}
+exports.partition = partition;
+
+},{"../Observable":48,"../operators/filter":116,"../util/not":232,"../util/subscribeTo":234}],80:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var isArray_1 = require("../util/isArray");
+var fromArray_1 = require("./fromArray");
+var OuterSubscriber_1 = require("../OuterSubscriber");
+var subscribeToResult_1 = require("../util/subscribeToResult");
+function race() {
+ var observables = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ observables[_i] = arguments[_i];
+ }
+ if (observables.length === 1) {
+ if (isArray_1.isArray(observables[0])) {
+ observables = observables[0];
+ }
+ else {
+ return observables[0];
+ }
+ }
+ return fromArray_1.fromArray(observables, undefined).lift(new RaceOperator());
+}
+exports.race = race;
+var RaceOperator = (function () {
+ function RaceOperator() {
+ }
+ RaceOperator.prototype.call = function (subscriber, source) {
+ return source.subscribe(new RaceSubscriber(subscriber));
+ };
+ return RaceOperator;
+}());
+exports.RaceOperator = RaceOperator;
+var RaceSubscriber = (function (_super) {
+ __extends(RaceSubscriber, _super);
+ function RaceSubscriber(destination) {
+ var _this = _super.call(this, destination) || this;
+ _this.hasFirst = false;
+ _this.observables = [];
+ _this.subscriptions = [];
+ return _this;
+ }
+ RaceSubscriber.prototype._next = function (observable) {
+ this.observables.push(observable);
+ };
+ RaceSubscriber.prototype._complete = function () {
+ var observables = this.observables;
+ var len = observables.length;
+ if (len === 0) {
+ this.destination.complete();
+ }
+ else {
+ for (var i = 0; i < len && !this.hasFirst; i++) {
+ var observable = observables[i];
+ var subscription = subscribeToResult_1.subscribeToResult(this, observable, observable, i);
+ if (this.subscriptions) {
+ this.subscriptions.push(subscription);
+ }
+ this.add(subscription);
+ }
+ this.observables = null;
+ }
+ };
+ RaceSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
+ if (!this.hasFirst) {
+ this.hasFirst = true;
+ for (var i = 0; i < this.subscriptions.length; i++) {
+ if (i !== outerIndex) {
+ var subscription = this.subscriptions[i];
+ subscription.unsubscribe();
+ this.remove(subscription);
+ }
+ }
+ this.subscriptions = null;
+ }
+ this.destination.next(innerValue);
+ };
+ return RaceSubscriber;
+}(OuterSubscriber_1.OuterSubscriber));
+exports.RaceSubscriber = RaceSubscriber;
+
+},{"../OuterSubscriber":50,"../util/isArray":220,"../util/subscribeToResult":239,"./fromArray":68}],81:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var Observable_1 = require("../Observable");
+function range(start, count, scheduler) {
+ if (start === void 0) { start = 0; }
+ return new Observable_1.Observable(function (subscriber) {
+ if (count === undefined) {
+ count = start;
+ start = 0;
+ }
+ var index = 0;
+ var current = start;
+ if (scheduler) {
+ return scheduler.schedule(dispatch, 0, {
+ index: index, count: count, start: start, subscriber: subscriber
+ });
+ }
+ else {
+ do {
+ if (index++ >= count) {
+ subscriber.complete();
+ break;
+ }
+ subscriber.next(current++);
+ if (subscriber.closed) {
+ break;
+ }
+ } while (true);
+ }
+ return undefined;
+ });
+}
+exports.range = range;
+function dispatch(state) {
+ var start = state.start, index = state.index, count = state.count, subscriber = state.subscriber;
+ if (index >= count) {
+ subscriber.complete();
+ return;
+ }
+ subscriber.next(start);
+ if (subscriber.closed) {
+ return;
+ }
+ state.index = index + 1;
+ state.start = start + 1;
+ this.schedule(state);
+}
+exports.dispatch = dispatch;
+
+},{"../Observable":48}],82:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var Observable_1 = require("../Observable");
+function throwError(error, scheduler) {
+ if (!scheduler) {
+ return new Observable_1.Observable(function (subscriber) { return subscriber.error(error); });
+ }
+ else {
+ return new Observable_1.Observable(function (subscriber) { return scheduler.schedule(dispatch, 0, { error: error, subscriber: subscriber }); });
+ }
+}
+exports.throwError = throwError;
+function dispatch(_a) {
+ var error = _a.error, subscriber = _a.subscriber;
+ subscriber.error(error);
+}
+
+},{"../Observable":48}],83:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var Observable_1 = require("../Observable");
+var async_1 = require("../scheduler/async");
+var isNumeric_1 = require("../util/isNumeric");
+var isScheduler_1 = require("../util/isScheduler");
+function timer(dueTime, periodOrScheduler, scheduler) {
+ if (dueTime === void 0) { dueTime = 0; }
+ var period = -1;
+ if (isNumeric_1.isNumeric(periodOrScheduler)) {
+ period = Number(periodOrScheduler) < 1 && 1 || Number(periodOrScheduler);
+ }
+ else if (isScheduler_1.isScheduler(periodOrScheduler)) {
+ scheduler = periodOrScheduler;
+ }
+ if (!isScheduler_1.isScheduler(scheduler)) {
+ scheduler = async_1.async;
+ }
+ return new Observable_1.Observable(function (subscriber) {
+ var due = isNumeric_1.isNumeric(dueTime)
+ ? dueTime
+ : (+dueTime - scheduler.now());
+ return scheduler.schedule(dispatch, due, {
+ index: 0, period: period, subscriber: subscriber
+ });
+ });
+}
+exports.timer = timer;
+function dispatch(state) {
+ var index = state.index, period = state.period, subscriber = state.subscriber;
+ subscriber.next(index);
+ if (subscriber.closed) {
+ return;
+ }
+ else if (period === -1) {
+ return subscriber.complete();
+ }
+ state.index = index + 1;
+ this.schedule(state, period);
+}
+
+},{"../Observable":48,"../scheduler/async":206,"../util/isNumeric":226,"../util/isScheduler":230}],84:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var Observable_1 = require("../Observable");
+var from_1 = require("./from");
+var empty_1 = require("./empty");
+function using(resourceFactory, observableFactory) {
+ return new Observable_1.Observable(function (subscriber) {
+ var resource;
+ try {
+ resource = resourceFactory();
+ }
+ catch (err) {
+ subscriber.error(err);
+ return undefined;
+ }
+ var result;
+ try {
+ result = observableFactory(resource);
+ }
+ catch (err) {
+ subscriber.error(err);
+ return undefined;
+ }
+ var source = result ? from_1.from(result) : empty_1.EMPTY;
+ var subscription = source.subscribe(subscriber);
+ return function () {
+ subscription.unsubscribe();
+ if (resource) {
+ resource.unsubscribe();
+ }
+ };
+ });
+}
+exports.using = using;
+
+},{"../Observable":48,"./empty":65,"./from":67}],85:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var fromArray_1 = require("./fromArray");
+var isArray_1 = require("../util/isArray");
+var Subscriber_1 = require("../Subscriber");
+var OuterSubscriber_1 = require("../OuterSubscriber");
+var subscribeToResult_1 = require("../util/subscribeToResult");
+var iterator_1 = require("../../internal/symbol/iterator");
+function zip() {
+ var observables = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ observables[_i] = arguments[_i];
+ }
+ var resultSelector = observables[observables.length - 1];
+ if (typeof resultSelector === 'function') {
+ observables.pop();
+ }
+ return fromArray_1.fromArray(observables, undefined).lift(new ZipOperator(resultSelector));
+}
+exports.zip = zip;
+var ZipOperator = (function () {
+ function ZipOperator(resultSelector) {
+ this.resultSelector = resultSelector;
+ }
+ ZipOperator.prototype.call = function (subscriber, source) {
+ return source.subscribe(new ZipSubscriber(subscriber, this.resultSelector));
+ };
+ return ZipOperator;
+}());
+exports.ZipOperator = ZipOperator;
+var ZipSubscriber = (function (_super) {
+ __extends(ZipSubscriber, _super);
+ function ZipSubscriber(destination, resultSelector, values) {
+ if (values === void 0) { values = Object.create(null); }
+ var _this = _super.call(this, destination) || this;
+ _this.iterators = [];
+ _this.active = 0;
+ _this.resultSelector = (typeof resultSelector === 'function') ? resultSelector : null;
+ _this.values = values;
+ return _this;
+ }
+ ZipSubscriber.prototype._next = function (value) {
+ var iterators = this.iterators;
+ if (isArray_1.isArray(value)) {
+ iterators.push(new StaticArrayIterator(value));
+ }
+ else if (typeof value[iterator_1.iterator] === 'function') {
+ iterators.push(new StaticIterator(value[iterator_1.iterator]()));
+ }
+ else {
+ iterators.push(new ZipBufferIterator(this.destination, this, value));
+ }
+ };
+ ZipSubscriber.prototype._complete = function () {
+ var iterators = this.iterators;
+ var len = iterators.length;
+ this.unsubscribe();
+ if (len === 0) {
+ this.destination.complete();
+ return;
+ }
+ this.active = len;
+ for (var i = 0; i < len; i++) {
+ var iterator = iterators[i];
+ if (iterator.stillUnsubscribed) {
+ var destination = this.destination;
+ destination.add(iterator.subscribe(iterator, i));
+ }
+ else {
+ this.active--;
+ }
+ }
+ };
+ ZipSubscriber.prototype.notifyInactive = function () {
+ this.active--;
+ if (this.active === 0) {
+ this.destination.complete();
+ }
+ };
+ ZipSubscriber.prototype.checkIterators = function () {
+ var iterators = this.iterators;
+ var len = iterators.length;
+ var destination = this.destination;
+ for (var i = 0; i < len; i++) {
+ var iterator = iterators[i];
+ if (typeof iterator.hasValue === 'function' && !iterator.hasValue()) {
+ return;
+ }
+ }
+ var shouldComplete = false;
+ var args = [];
+ for (var i = 0; i < len; i++) {
+ var iterator = iterators[i];
+ var result = iterator.next();
+ if (iterator.hasCompleted()) {
+ shouldComplete = true;
+ }
+ if (result.done) {
+ destination.complete();
+ return;
+ }
+ args.push(result.value);
+ }
+ if (this.resultSelector) {
+ this._tryresultSelector(args);
+ }
+ else {
+ destination.next(args);
+ }
+ if (shouldComplete) {
+ destination.complete();
+ }
+ };
+ ZipSubscriber.prototype._tryresultSelector = function (args) {
+ var result;
+ try {
+ result = this.resultSelector.apply(this, args);
+ }
+ catch (err) {
+ this.destination.error(err);
+ return;
+ }
+ this.destination.next(result);
+ };
+ return ZipSubscriber;
+}(Subscriber_1.Subscriber));
+exports.ZipSubscriber = ZipSubscriber;
+var StaticIterator = (function () {
+ function StaticIterator(iterator) {
+ this.iterator = iterator;
+ this.nextResult = iterator.next();
+ }
+ StaticIterator.prototype.hasValue = function () {
+ return true;
+ };
+ StaticIterator.prototype.next = function () {
+ var result = this.nextResult;
+ this.nextResult = this.iterator.next();
+ return result;
+ };
+ StaticIterator.prototype.hasCompleted = function () {
+ var nextResult = this.nextResult;
+ return nextResult && nextResult.done;
+ };
+ return StaticIterator;
+}());
+var StaticArrayIterator = (function () {
+ function StaticArrayIterator(array) {
+ this.array = array;
+ this.index = 0;
+ this.length = 0;
+ this.length = array.length;
+ }
+ StaticArrayIterator.prototype[iterator_1.iterator] = function () {
+ return this;
+ };
+ StaticArrayIterator.prototype.next = function (value) {
+ var i = this.index++;
+ var array = this.array;
+ return i < this.length ? { value: array[i], done: false } : { value: null, done: true };
+ };
+ StaticArrayIterator.prototype.hasValue = function () {
+ return this.array.length > this.index;
+ };
+ StaticArrayIterator.prototype.hasCompleted = function () {
+ return this.array.length === this.index;
+ };
+ return StaticArrayIterator;
+}());
+var ZipBufferIterator = (function (_super) {
+ __extends(ZipBufferIterator, _super);
+ function ZipBufferIterator(destination, parent, observable) {
+ var _this = _super.call(this, destination) || this;
+ _this.parent = parent;
+ _this.observable = observable;
+ _this.stillUnsubscribed = true;
+ _this.buffer = [];
+ _this.isComplete = false;
+ return _this;
+ }
+ ZipBufferIterator.prototype[iterator_1.iterator] = function () {
+ return this;
+ };
+ ZipBufferIterator.prototype.next = function () {
+ var buffer = this.buffer;
+ if (buffer.length === 0 && this.isComplete) {
+ return { value: null, done: true };
+ }
+ else {
+ return { value: buffer.shift(), done: false };
+ }
+ };
+ ZipBufferIterator.prototype.hasValue = function () {
+ return this.buffer.length > 0;
+ };
+ ZipBufferIterator.prototype.hasCompleted = function () {
+ return this.buffer.length === 0 && this.isComplete;
+ };
+ ZipBufferIterator.prototype.notifyComplete = function () {
+ if (this.buffer.length > 0) {
+ this.isComplete = true;
+ this.parent.notifyInactive();
+ }
+ else {
+ this.destination.complete();
+ }
+ };
+ ZipBufferIterator.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
+ this.buffer.push(innerValue);
+ this.parent.checkIterators();
+ };
+ ZipBufferIterator.prototype.subscribe = function (value, index) {
+ return subscribeToResult_1.subscribeToResult(this, this.observable, this, index);
+ };
+ return ZipBufferIterator;
+}(OuterSubscriber_1.OuterSubscriber));
+
+},{"../../internal/symbol/iterator":208,"../OuterSubscriber":50,"../Subscriber":55,"../util/isArray":220,"../util/subscribeToResult":239,"./fromArray":68}],86:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var OuterSubscriber_1 = require("../OuterSubscriber");
+var subscribeToResult_1 = require("../util/subscribeToResult");
+function audit(durationSelector) {
+ return function auditOperatorFunction(source) {
+ return source.lift(new AuditOperator(durationSelector));
+ };
+}
+exports.audit = audit;
+var AuditOperator = (function () {
+ function AuditOperator(durationSelector) {
+ this.durationSelector = durationSelector;
+ }
+ AuditOperator.prototype.call = function (subscriber, source) {
+ return source.subscribe(new AuditSubscriber(subscriber, this.durationSelector));
+ };
+ return AuditOperator;
+}());
+var AuditSubscriber = (function (_super) {
+ __extends(AuditSubscriber, _super);
+ function AuditSubscriber(destination, durationSelector) {
+ var _this = _super.call(this, destination) || this;
+ _this.durationSelector = durationSelector;
+ _this.hasValue = false;
+ return _this;
+ }
+ AuditSubscriber.prototype._next = function (value) {
+ this.value = value;
+ this.hasValue = true;
+ if (!this.throttled) {
+ var duration = void 0;
+ try {
+ var durationSelector = this.durationSelector;
+ duration = durationSelector(value);
+ }
+ catch (err) {
+ return this.destination.error(err);
+ }
+ var innerSubscription = subscribeToResult_1.subscribeToResult(this, duration);
+ if (!innerSubscription || innerSubscription.closed) {
+ this.clearThrottle();
+ }
+ else {
+ this.add(this.throttled = innerSubscription);
+ }
+ }
+ };
+ AuditSubscriber.prototype.clearThrottle = function () {
+ var _a = this, value = _a.value, hasValue = _a.hasValue, throttled = _a.throttled;
+ if (throttled) {
+ this.remove(throttled);
+ this.throttled = null;
+ throttled.unsubscribe();
+ }
+ if (hasValue) {
+ this.value = null;
+ this.hasValue = false;
+ this.destination.next(value);
+ }
+ };
+ AuditSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex) {
+ this.clearThrottle();
+ };
+ AuditSubscriber.prototype.notifyComplete = function () {
+ this.clearThrottle();
+ };
+ return AuditSubscriber;
+}(OuterSubscriber_1.OuterSubscriber));
+
+},{"../OuterSubscriber":50,"../util/subscribeToResult":239}],87:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var async_1 = require("../scheduler/async");
+var audit_1 = require("./audit");
+var timer_1 = require("../observable/timer");
+function auditTime(duration, scheduler) {
+ if (scheduler === void 0) { scheduler = async_1.async; }
+ return audit_1.audit(function () { return timer_1.timer(duration, scheduler); });
+}
+exports.auditTime = auditTime;
+
+},{"../observable/timer":83,"../scheduler/async":206,"./audit":86}],88:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var OuterSubscriber_1 = require("../OuterSubscriber");
+var subscribeToResult_1 = require("../util/subscribeToResult");
+function buffer(closingNotifier) {
+ return function bufferOperatorFunction(source) {
+ return source.lift(new BufferOperator(closingNotifier));
+ };
+}
+exports.buffer = buffer;
+var BufferOperator = (function () {
+ function BufferOperator(closingNotifier) {
+ this.closingNotifier = closingNotifier;
+ }
+ BufferOperator.prototype.call = function (subscriber, source) {
+ return source.subscribe(new BufferSubscriber(subscriber, this.closingNotifier));
+ };
+ return BufferOperator;
+}());
+var BufferSubscriber = (function (_super) {
+ __extends(BufferSubscriber, _super);
+ function BufferSubscriber(destination, closingNotifier) {
+ var _this = _super.call(this, destination) || this;
+ _this.buffer = [];
+ _this.add(subscribeToResult_1.subscribeToResult(_this, closingNotifier));
+ return _this;
+ }
+ BufferSubscriber.prototype._next = function (value) {
+ this.buffer.push(value);
+ };
+ BufferSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
+ var buffer = this.buffer;
+ this.buffer = [];
+ this.destination.next(buffer);
+ };
+ return BufferSubscriber;
+}(OuterSubscriber_1.OuterSubscriber));
+
+},{"../OuterSubscriber":50,"../util/subscribeToResult":239}],89:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var Subscriber_1 = require("../Subscriber");
+function bufferCount(bufferSize, startBufferEvery) {
+ if (startBufferEvery === void 0) { startBufferEvery = null; }
+ return function bufferCountOperatorFunction(source) {
+ return source.lift(new BufferCountOperator(bufferSize, startBufferEvery));
+ };
+}
+exports.bufferCount = bufferCount;
+var BufferCountOperator = (function () {
+ function BufferCountOperator(bufferSize, startBufferEvery) {
+ this.bufferSize = bufferSize;
+ this.startBufferEvery = startBufferEvery;
+ if (!startBufferEvery || bufferSize === startBufferEvery) {
+ this.subscriberClass = BufferCountSubscriber;
+ }
+ else {
+ this.subscriberClass = BufferSkipCountSubscriber;
+ }
+ }
+ BufferCountOperator.prototype.call = function (subscriber, source) {
+ return source.subscribe(new this.subscriberClass(subscriber, this.bufferSize, this.startBufferEvery));
+ };
+ return BufferCountOperator;
+}());
+var BufferCountSubscriber = (function (_super) {
+ __extends(BufferCountSubscriber, _super);
+ function BufferCountSubscriber(destination, bufferSize) {
+ var _this = _super.call(this, destination) || this;
+ _this.bufferSize = bufferSize;
+ _this.buffer = [];
+ return _this;
+ }
+ BufferCountSubscriber.prototype._next = function (value) {
+ var buffer = this.buffer;
+ buffer.push(value);
+ if (buffer.length == this.bufferSize) {
+ this.destination.next(buffer);
+ this.buffer = [];
+ }
+ };
+ BufferCountSubscriber.prototype._complete = function () {
+ var buffer = this.buffer;
+ if (buffer.length > 0) {
+ this.destination.next(buffer);
+ }
+ _super.prototype._complete.call(this);
+ };
+ return BufferCountSubscriber;
+}(Subscriber_1.Subscriber));
+var BufferSkipCountSubscriber = (function (_super) {
+ __extends(BufferSkipCountSubscriber, _super);
+ function BufferSkipCountSubscriber(destination, bufferSize, startBufferEvery) {
+ var _this = _super.call(this, destination) || this;
+ _this.bufferSize = bufferSize;
+ _this.startBufferEvery = startBufferEvery;
+ _this.buffers = [];
+ _this.count = 0;
+ return _this;
+ }
+ BufferSkipCountSubscriber.prototype._next = function (value) {
+ var _a = this, bufferSize = _a.bufferSize, startBufferEvery = _a.startBufferEvery, buffers = _a.buffers, count = _a.count;
+ this.count++;
+ if (count % startBufferEvery === 0) {
+ buffers.push([]);
+ }
+ for (var i = buffers.length; i--;) {
+ var buffer = buffers[i];
+ buffer.push(value);
+ if (buffer.length === bufferSize) {
+ buffers.splice(i, 1);
+ this.destination.next(buffer);
+ }
+ }
+ };
+ BufferSkipCountSubscriber.prototype._complete = function () {
+ var _a = this, buffers = _a.buffers, destination = _a.destination;
+ while (buffers.length > 0) {
+ var buffer = buffers.shift();
+ if (buffer.length > 0) {
+ destination.next(buffer);
+ }
+ }
+ _super.prototype._complete.call(this);
+ };
+ return BufferSkipCountSubscriber;
+}(Subscriber_1.Subscriber));
+
+},{"../Subscriber":55}],90:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var async_1 = require("../scheduler/async");
+var Subscriber_1 = require("../Subscriber");
+var isScheduler_1 = require("../util/isScheduler");
+function bufferTime(bufferTimeSpan) {
+ var length = arguments.length;
+ var scheduler = async_1.async;
+ if (isScheduler_1.isScheduler(arguments[arguments.length - 1])) {
+ scheduler = arguments[arguments.length - 1];
+ length--;
+ }
+ var bufferCreationInterval = null;
+ if (length >= 2) {
+ bufferCreationInterval = arguments[1];
+ }
+ var maxBufferSize = Number.POSITIVE_INFINITY;
+ if (length >= 3) {
+ maxBufferSize = arguments[2];
+ }
+ return function bufferTimeOperatorFunction(source) {
+ return source.lift(new BufferTimeOperator(bufferTimeSpan, bufferCreationInterval, maxBufferSize, scheduler));
+ };
+}
+exports.bufferTime = bufferTime;
+var BufferTimeOperator = (function () {
+ function BufferTimeOperator(bufferTimeSpan, bufferCreationInterval, maxBufferSize, scheduler) {
+ this.bufferTimeSpan = bufferTimeSpan;
+ this.bufferCreationInterval = bufferCreationInterval;
+ this.maxBufferSize = maxBufferSize;
+ this.scheduler = scheduler;
+ }
+ BufferTimeOperator.prototype.call = function (subscriber, source) {
+ return source.subscribe(new BufferTimeSubscriber(subscriber, this.bufferTimeSpan, this.bufferCreationInterval, this.maxBufferSize, this.scheduler));
+ };
+ return BufferTimeOperator;
+}());
+var Context = (function () {
+ function Context() {
+ this.buffer = [];
+ }
+ return Context;
+}());
+var BufferTimeSubscriber = (function (_super) {
+ __extends(BufferTimeSubscriber, _super);
+ function BufferTimeSubscriber(destination, bufferTimeSpan, bufferCreationInterval, maxBufferSize, scheduler) {
+ var _this = _super.call(this, destination) || this;
+ _this.bufferTimeSpan = bufferTimeSpan;
+ _this.bufferCreationInterval = bufferCreationInterval;
+ _this.maxBufferSize = maxBufferSize;
+ _this.scheduler = scheduler;
+ _this.contexts = [];
+ var context = _this.openContext();
+ _this.timespanOnly = bufferCreationInterval == null || bufferCreationInterval < 0;
+ if (_this.timespanOnly) {
+ var timeSpanOnlyState = { subscriber: _this, context: context, bufferTimeSpan: bufferTimeSpan };
+ _this.add(context.closeAction = scheduler.schedule(dispatchBufferTimeSpanOnly, bufferTimeSpan, timeSpanOnlyState));
+ }
+ else {
+ var closeState = { subscriber: _this, context: context };
+ var creationState = { bufferTimeSpan: bufferTimeSpan, bufferCreationInterval: bufferCreationInterval, subscriber: _this, scheduler: scheduler };
+ _this.add(context.closeAction = scheduler.schedule(dispatchBufferClose, bufferTimeSpan, closeState));
+ _this.add(scheduler.schedule(dispatchBufferCreation, bufferCreationInterval, creationState));
+ }
+ return _this;
+ }
+ BufferTimeSubscriber.prototype._next = function (value) {
+ var contexts = this.contexts;
+ var len = contexts.length;
+ var filledBufferContext;
+ for (var i = 0; i < len; i++) {
+ var context_1 = contexts[i];
+ var buffer = context_1.buffer;
+ buffer.push(value);
+ if (buffer.length == this.maxBufferSize) {
+ filledBufferContext = context_1;
+ }
+ }
+ if (filledBufferContext) {
+ this.onBufferFull(filledBufferContext);
+ }
+ };
+ BufferTimeSubscriber.prototype._error = function (err) {
+ this.contexts.length = 0;
+ _super.prototype._error.call(this, err);
+ };
+ BufferTimeSubscriber.prototype._complete = function () {
+ var _a = this, contexts = _a.contexts, destination = _a.destination;
+ while (contexts.length > 0) {
+ var context_2 = contexts.shift();
+ destination.next(context_2.buffer);
+ }
+ _super.prototype._complete.call(this);
+ };
+ BufferTimeSubscriber.prototype._unsubscribe = function () {
+ this.contexts = null;
+ };
+ BufferTimeSubscriber.prototype.onBufferFull = function (context) {
+ this.closeContext(context);
+ var closeAction = context.closeAction;
+ closeAction.unsubscribe();
+ this.remove(closeAction);
+ if (!this.closed && this.timespanOnly) {
+ context = this.openContext();
+ var bufferTimeSpan = this.bufferTimeSpan;
+ var timeSpanOnlyState = { subscriber: this, context: context, bufferTimeSpan: bufferTimeSpan };
+ this.add(context.closeAction = this.scheduler.schedule(dispatchBufferTimeSpanOnly, bufferTimeSpan, timeSpanOnlyState));
+ }
+ };
+ BufferTimeSubscriber.prototype.openContext = function () {
+ var context = new Context();
+ this.contexts.push(context);
+ return context;
+ };
+ BufferTimeSubscriber.prototype.closeContext = function (context) {
+ this.destination.next(context.buffer);
+ var contexts = this.contexts;
+ var spliceIndex = contexts ? contexts.indexOf(context) : -1;
+ if (spliceIndex >= 0) {
+ contexts.splice(contexts.indexOf(context), 1);
+ }
+ };
+ return BufferTimeSubscriber;
+}(Subscriber_1.Subscriber));
+function dispatchBufferTimeSpanOnly(state) {
+ var subscriber = state.subscriber;
+ var prevContext = state.context;
+ if (prevContext) {
+ subscriber.closeContext(prevContext);
+ }
+ if (!subscriber.closed) {
+ state.context = subscriber.openContext();
+ state.context.closeAction = this.schedule(state, state.bufferTimeSpan);
+ }
+}
+function dispatchBufferCreation(state) {
+ var bufferCreationInterval = state.bufferCreationInterval, bufferTimeSpan = state.bufferTimeSpan, subscriber = state.subscriber, scheduler = state.scheduler;
+ var context = subscriber.openContext();
+ var action = this;
+ if (!subscriber.closed) {
+ subscriber.add(context.closeAction = scheduler.schedule(dispatchBufferClose, bufferTimeSpan, { subscriber: subscriber, context: context }));
+ action.schedule(state, bufferCreationInterval);
+ }
+}
+function dispatchBufferClose(arg) {
+ var subscriber = arg.subscriber, context = arg.context;
+ subscriber.closeContext(context);
+}
+
+},{"../Subscriber":55,"../scheduler/async":206,"../util/isScheduler":230}],91:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var Subscription_1 = require("../Subscription");
+var subscribeToResult_1 = require("../util/subscribeToResult");
+var OuterSubscriber_1 = require("../OuterSubscriber");
+function bufferToggle(openings, closingSelector) {
+ return function bufferToggleOperatorFunction(source) {
+ return source.lift(new BufferToggleOperator(openings, closingSelector));
+ };
+}
+exports.bufferToggle = bufferToggle;
+var BufferToggleOperator = (function () {
+ function BufferToggleOperator(openings, closingSelector) {
+ this.openings = openings;
+ this.closingSelector = closingSelector;
+ }
+ BufferToggleOperator.prototype.call = function (subscriber, source) {
+ return source.subscribe(new BufferToggleSubscriber(subscriber, this.openings, this.closingSelector));
+ };
+ return BufferToggleOperator;
+}());
+var BufferToggleSubscriber = (function (_super) {
+ __extends(BufferToggleSubscriber, _super);
+ function BufferToggleSubscriber(destination, openings, closingSelector) {
+ var _this = _super.call(this, destination) || this;
+ _this.openings = openings;
+ _this.closingSelector = closingSelector;
+ _this.contexts = [];
+ _this.add(subscribeToResult_1.subscribeToResult(_this, openings));
+ return _this;
+ }
+ BufferToggleSubscriber.prototype._next = function (value) {
+ var contexts = this.contexts;
+ var len = contexts.length;
+ for (var i = 0; i < len; i++) {
+ contexts[i].buffer.push(value);
+ }
+ };
+ BufferToggleSubscriber.prototype._error = function (err) {
+ var contexts = this.contexts;
+ while (contexts.length > 0) {
+ var context_1 = contexts.shift();
+ context_1.subscription.unsubscribe();
+ context_1.buffer = null;
+ context_1.subscription = null;
+ }
+ this.contexts = null;
+ _super.prototype._error.call(this, err);
+ };
+ BufferToggleSubscriber.prototype._complete = function () {
+ var contexts = this.contexts;
+ while (contexts.length > 0) {
+ var context_2 = contexts.shift();
+ this.destination.next(context_2.buffer);
+ context_2.subscription.unsubscribe();
+ context_2.buffer = null;
+ context_2.subscription = null;
+ }
+ this.contexts = null;
+ _super.prototype._complete.call(this);
+ };
+ BufferToggleSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
+ outerValue ? this.closeBuffer(outerValue) : this.openBuffer(innerValue);
+ };
+ BufferToggleSubscriber.prototype.notifyComplete = function (innerSub) {
+ this.closeBuffer(innerSub.context);
+ };
+ BufferToggleSubscriber.prototype.openBuffer = function (value) {
+ try {
+ var closingSelector = this.closingSelector;
+ var closingNotifier = closingSelector.call(this, value);
+ if (closingNotifier) {
+ this.trySubscribe(closingNotifier);
+ }
+ }
+ catch (err) {
+ this._error(err);
+ }
+ };
+ BufferToggleSubscriber.prototype.closeBuffer = function (context) {
+ var contexts = this.contexts;
+ if (contexts && context) {
+ var buffer = context.buffer, subscription = context.subscription;
+ this.destination.next(buffer);
+ contexts.splice(contexts.indexOf(context), 1);
+ this.remove(subscription);
+ subscription.unsubscribe();
+ }
+ };
+ BufferToggleSubscriber.prototype.trySubscribe = function (closingNotifier) {
+ var contexts = this.contexts;
+ var buffer = [];
+ var subscription = new Subscription_1.Subscription();
+ var context = { buffer: buffer, subscription: subscription };
+ contexts.push(context);
+ var innerSubscription = subscribeToResult_1.subscribeToResult(this, closingNotifier, context);
+ if (!innerSubscription || innerSubscription.closed) {
+ this.closeBuffer(context);
+ }
+ else {
+ innerSubscription.context = context;
+ this.add(innerSubscription);
+ subscription.add(innerSubscription);
+ }
+ };
+ return BufferToggleSubscriber;
+}(OuterSubscriber_1.OuterSubscriber));
+
+},{"../OuterSubscriber":50,"../Subscription":56,"../util/subscribeToResult":239}],92:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var Subscription_1 = require("../Subscription");
+var OuterSubscriber_1 = require("../OuterSubscriber");
+var subscribeToResult_1 = require("../util/subscribeToResult");
+function bufferWhen(closingSelector) {
+ return function (source) {
+ return source.lift(new BufferWhenOperator(closingSelector));
+ };
+}
+exports.bufferWhen = bufferWhen;
+var BufferWhenOperator = (function () {
+ function BufferWhenOperator(closingSelector) {
+ this.closingSelector = closingSelector;
+ }
+ BufferWhenOperator.prototype.call = function (subscriber, source) {
+ return source.subscribe(new BufferWhenSubscriber(subscriber, this.closingSelector));
+ };
+ return BufferWhenOperator;
+}());
+var BufferWhenSubscriber = (function (_super) {
+ __extends(BufferWhenSubscriber, _super);
+ function BufferWhenSubscriber(destination, closingSelector) {
+ var _this = _super.call(this, destination) || this;
+ _this.closingSelector = closingSelector;
+ _this.subscribing = false;
+ _this.openBuffer();
+ return _this;
+ }
+ BufferWhenSubscriber.prototype._next = function (value) {
+ this.buffer.push(value);
+ };
+ BufferWhenSubscriber.prototype._complete = function () {
+ var buffer = this.buffer;
+ if (buffer) {
+ this.destination.next(buffer);
+ }
+ _super.prototype._complete.call(this);
+ };
+ BufferWhenSubscriber.prototype._unsubscribe = function () {
+ this.buffer = null;
+ this.subscribing = false;
+ };
+ BufferWhenSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
+ this.openBuffer();
+ };
+ BufferWhenSubscriber.prototype.notifyComplete = function () {
+ if (this.subscribing) {
+ this.complete();
+ }
+ else {
+ this.openBuffer();
+ }
+ };
+ BufferWhenSubscriber.prototype.openBuffer = function () {
+ var closingSubscription = this.closingSubscription;
+ if (closingSubscription) {
+ this.remove(closingSubscription);
+ closingSubscription.unsubscribe();
+ }
+ var buffer = this.buffer;
+ if (this.buffer) {
+ this.destination.next(buffer);
+ }
+ this.buffer = [];
+ var closingNotifier;
+ try {
+ var closingSelector = this.closingSelector;
+ closingNotifier = closingSelector();
+ }
+ catch (err) {
+ return this.error(err);
+ }
+ closingSubscription = new Subscription_1.Subscription();
+ this.closingSubscription = closingSubscription;
+ this.add(closingSubscription);
+ this.subscribing = true;
+ closingSubscription.add(subscribeToResult_1.subscribeToResult(this, closingNotifier));
+ this.subscribing = false;
+ };
+ return BufferWhenSubscriber;
+}(OuterSubscriber_1.OuterSubscriber));
+
+},{"../OuterSubscriber":50,"../Subscription":56,"../util/subscribeToResult":239}],93:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var OuterSubscriber_1 = require("../OuterSubscriber");
+var InnerSubscriber_1 = require("../InnerSubscriber");
+var subscribeToResult_1 = require("../util/subscribeToResult");
+function catchError(selector) {
+ return function catchErrorOperatorFunction(source) {
+ var operator = new CatchOperator(selector);
+ var caught = source.lift(operator);
+ return (operator.caught = caught);
+ };
+}
+exports.catchError = catchError;
+var CatchOperator = (function () {
+ function CatchOperator(selector) {
+ this.selector = selector;
+ }
+ CatchOperator.prototype.call = function (subscriber, source) {
+ return source.subscribe(new CatchSubscriber(subscriber, this.selector, this.caught));
+ };
+ return CatchOperator;
+}());
+var CatchSubscriber = (function (_super) {
+ __extends(CatchSubscriber, _super);
+ function CatchSubscriber(destination, selector, caught) {
+ var _this = _super.call(this, destination) || this;
+ _this.selector = selector;
+ _this.caught = caught;
+ return _this;
+ }
+ CatchSubscriber.prototype.error = function (err) {
+ if (!this.isStopped) {
+ var result = void 0;
+ try {
+ result = this.selector(err, this.caught);
+ }
+ catch (err2) {
+ _super.prototype.error.call(this, err2);
+ return;
+ }
+ this._unsubscribeAndRecycle();
+ var innerSubscriber = new InnerSubscriber_1.InnerSubscriber(this, undefined, undefined);
+ this.add(innerSubscriber);
+ var innerSubscription = subscribeToResult_1.subscribeToResult(this, result, undefined, undefined, innerSubscriber);
+ if (innerSubscription !== innerSubscriber) {
+ this.add(innerSubscription);
+ }
+ }
+ };
+ return CatchSubscriber;
+}(OuterSubscriber_1.OuterSubscriber));
+
+},{"../InnerSubscriber":46,"../OuterSubscriber":50,"../util/subscribeToResult":239}],94:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var combineLatest_1 = require("../observable/combineLatest");
+function combineAll(project) {
+ return function (source) { return source.lift(new combineLatest_1.CombineLatestOperator(project)); };
+}
+exports.combineAll = combineAll;
+
+},{"../observable/combineLatest":62}],95:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var isArray_1 = require("../util/isArray");
+var combineLatest_1 = require("../observable/combineLatest");
+var from_1 = require("../observable/from");
+var none = {};
+function combineLatest() {
+ var observables = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ observables[_i] = arguments[_i];
+ }
+ var project = null;
+ if (typeof observables[observables.length - 1] === 'function') {
+ project = observables.pop();
+ }
+ if (observables.length === 1 && isArray_1.isArray(observables[0])) {
+ observables = observables[0].slice();
+ }
+ return function (source) { return source.lift.call(from_1.from([source].concat(observables)), new combineLatest_1.CombineLatestOperator(project)); };
+}
+exports.combineLatest = combineLatest;
+
+},{"../observable/combineLatest":62,"../observable/from":67,"../util/isArray":220}],96:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var concat_1 = require("../observable/concat");
+function concat() {
+ var observables = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ observables[_i] = arguments[_i];
+ }
+ return function (source) { return source.lift.call(concat_1.concat.apply(void 0, [source].concat(observables))); };
+}
+exports.concat = concat;
+
+},{"../observable/concat":63}],97:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var mergeAll_1 = require("./mergeAll");
+function concatAll() {
+ return mergeAll_1.mergeAll(1);
+}
+exports.concatAll = concatAll;
+
+},{"./mergeAll":130}],98:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var mergeMap_1 = require("./mergeMap");
+function concatMap(project, resultSelector) {
+ return mergeMap_1.mergeMap(project, resultSelector, 1);
+}
+exports.concatMap = concatMap;
+
+},{"./mergeMap":131}],99:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var concatMap_1 = require("./concatMap");
+function concatMapTo(innerObservable, resultSelector) {
+ return concatMap_1.concatMap(function () { return innerObservable; }, resultSelector);
+}
+exports.concatMapTo = concatMapTo;
+
+},{"./concatMap":98}],100:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var Subscriber_1 = require("../Subscriber");
+function count(predicate) {
+ return function (source) { return source.lift(new CountOperator(predicate, source)); };
+}
+exports.count = count;
+var CountOperator = (function () {
+ function CountOperator(predicate, source) {
+ this.predicate = predicate;
+ this.source = source;
+ }
+ CountOperator.prototype.call = function (subscriber, source) {
+ return source.subscribe(new CountSubscriber(subscriber, this.predicate, this.source));
+ };
+ return CountOperator;
+}());
+var CountSubscriber = (function (_super) {
+ __extends(CountSubscriber, _super);
+ function CountSubscriber(destination, predicate, source) {
+ var _this = _super.call(this, destination) || this;
+ _this.predicate = predicate;
+ _this.source = source;
+ _this.count = 0;
+ _this.index = 0;
+ return _this;
+ }
+ CountSubscriber.prototype._next = function (value) {
+ if (this.predicate) {
+ this._tryPredicate(value);
+ }
+ else {
+ this.count++;
+ }
+ };
+ CountSubscriber.prototype._tryPredicate = function (value) {
+ var result;
+ try {
+ result = this.predicate(value, this.index++, this.source);
+ }
+ catch (err) {
+ this.destination.error(err);
+ return;
+ }
+ if (result) {
+ this.count++;
+ }
+ };
+ CountSubscriber.prototype._complete = function () {
+ this.destination.next(this.count);
+ this.destination.complete();
+ };
+ return CountSubscriber;
+}(Subscriber_1.Subscriber));
+
+},{"../Subscriber":55}],101:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var OuterSubscriber_1 = require("../OuterSubscriber");
+var subscribeToResult_1 = require("../util/subscribeToResult");
+function debounce(durationSelector) {
+ return function (source) { return source.lift(new DebounceOperator(durationSelector)); };
+}
+exports.debounce = debounce;
+var DebounceOperator = (function () {
+ function DebounceOperator(durationSelector) {
+ this.durationSelector = durationSelector;
+ }
+ DebounceOperator.prototype.call = function (subscriber, source) {
+ return source.subscribe(new DebounceSubscriber(subscriber, this.durationSelector));
+ };
+ return DebounceOperator;
+}());
+var DebounceSubscriber = (function (_super) {
+ __extends(DebounceSubscriber, _super);
+ function DebounceSubscriber(destination, durationSelector) {
+ var _this = _super.call(this, destination) || this;
+ _this.durationSelector = durationSelector;
+ _this.hasValue = false;
+ _this.durationSubscription = null;
+ return _this;
+ }
+ DebounceSubscriber.prototype._next = function (value) {
+ try {
+ var result = this.durationSelector.call(this, value);
+ if (result) {
+ this._tryNext(value, result);
+ }
+ }
+ catch (err) {
+ this.destination.error(err);
+ }
+ };
+ DebounceSubscriber.prototype._complete = function () {
+ this.emitValue();
+ this.destination.complete();
+ };
+ DebounceSubscriber.prototype._tryNext = function (value, duration) {
+ var subscription = this.durationSubscription;
+ this.value = value;
+ this.hasValue = true;
+ if (subscription) {
+ subscription.unsubscribe();
+ this.remove(subscription);
+ }
+ subscription = subscribeToResult_1.subscribeToResult(this, duration);
+ if (subscription && !subscription.closed) {
+ this.add(this.durationSubscription = subscription);
+ }
+ };
+ DebounceSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
+ this.emitValue();
+ };
+ DebounceSubscriber.prototype.notifyComplete = function () {
+ this.emitValue();
+ };
+ DebounceSubscriber.prototype.emitValue = function () {
+ if (this.hasValue) {
+ var value = this.value;
+ var subscription = this.durationSubscription;
+ if (subscription) {
+ this.durationSubscription = null;
+ subscription.unsubscribe();
+ this.remove(subscription);
+ }
+ this.value = null;
+ this.hasValue = false;
+ _super.prototype._next.call(this, value);
+ }
+ };
+ return DebounceSubscriber;
+}(OuterSubscriber_1.OuterSubscriber));
+
+},{"../OuterSubscriber":50,"../util/subscribeToResult":239}],102:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var Subscriber_1 = require("../Subscriber");
+var async_1 = require("../scheduler/async");
+function debounceTime(dueTime, scheduler) {
+ if (scheduler === void 0) { scheduler = async_1.async; }
+ return function (source) { return source.lift(new DebounceTimeOperator(dueTime, scheduler)); };
+}
+exports.debounceTime = debounceTime;
+var DebounceTimeOperator = (function () {
+ function DebounceTimeOperator(dueTime, scheduler) {
+ this.dueTime = dueTime;
+ this.scheduler = scheduler;
+ }
+ DebounceTimeOperator.prototype.call = function (subscriber, source) {
+ return source.subscribe(new DebounceTimeSubscriber(subscriber, this.dueTime, this.scheduler));
+ };
+ return DebounceTimeOperator;
+}());
+var DebounceTimeSubscriber = (function (_super) {
+ __extends(DebounceTimeSubscriber, _super);
+ function DebounceTimeSubscriber(destination, dueTime, scheduler) {
+ var _this = _super.call(this, destination) || this;
+ _this.dueTime = dueTime;
+ _this.scheduler = scheduler;
+ _this.debouncedSubscription = null;
+ _this.lastValue = null;
+ _this.hasValue = false;
+ return _this;
+ }
+ DebounceTimeSubscriber.prototype._next = function (value) {
+ this.clearDebounce();
+ this.lastValue = value;
+ this.hasValue = true;
+ this.add(this.debouncedSubscription = this.scheduler.schedule(dispatchNext, this.dueTime, this));
+ };
+ DebounceTimeSubscriber.prototype._complete = function () {
+ this.debouncedNext();
+ this.destination.complete();
+ };
+ DebounceTimeSubscriber.prototype.debouncedNext = function () {
+ this.clearDebounce();
+ if (this.hasValue) {
+ var lastValue = this.lastValue;
+ this.lastValue = null;
+ this.hasValue = false;
+ this.destination.next(lastValue);
+ }
+ };
+ DebounceTimeSubscriber.prototype.clearDebounce = function () {
+ var debouncedSubscription = this.debouncedSubscription;
+ if (debouncedSubscription !== null) {
+ this.remove(debouncedSubscription);
+ debouncedSubscription.unsubscribe();
+ this.debouncedSubscription = null;
+ }
+ };
+ return DebounceTimeSubscriber;
+}(Subscriber_1.Subscriber));
+function dispatchNext(subscriber) {
+ subscriber.debouncedNext();
+}
+
+},{"../Subscriber":55,"../scheduler/async":206}],103:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var Subscriber_1 = require("../Subscriber");
+function defaultIfEmpty(defaultValue) {
+ if (defaultValue === void 0) { defaultValue = null; }
+ return function (source) { return source.lift(new DefaultIfEmptyOperator(defaultValue)); };
+}
+exports.defaultIfEmpty = defaultIfEmpty;
+var DefaultIfEmptyOperator = (function () {
+ function DefaultIfEmptyOperator(defaultValue) {
+ this.defaultValue = defaultValue;
+ }
+ DefaultIfEmptyOperator.prototype.call = function (subscriber, source) {
+ return source.subscribe(new DefaultIfEmptySubscriber(subscriber, this.defaultValue));
+ };
+ return DefaultIfEmptyOperator;
+}());
+var DefaultIfEmptySubscriber = (function (_super) {
+ __extends(DefaultIfEmptySubscriber, _super);
+ function DefaultIfEmptySubscriber(destination, defaultValue) {
+ var _this = _super.call(this, destination) || this;
+ _this.defaultValue = defaultValue;
+ _this.isEmpty = true;
+ return _this;
+ }
+ DefaultIfEmptySubscriber.prototype._next = function (value) {
+ this.isEmpty = false;
+ this.destination.next(value);
+ };
+ DefaultIfEmptySubscriber.prototype._complete = function () {
+ if (this.isEmpty) {
+ this.destination.next(this.defaultValue);
+ }
+ this.destination.complete();
+ };
+ return DefaultIfEmptySubscriber;
+}(Subscriber_1.Subscriber));
+
+},{"../Subscriber":55}],104:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var async_1 = require("../scheduler/async");
+var isDate_1 = require("../util/isDate");
+var Subscriber_1 = require("../Subscriber");
+var Notification_1 = require("../Notification");
+function delay(delay, scheduler) {
+ if (scheduler === void 0) { scheduler = async_1.async; }
+ var absoluteDelay = isDate_1.isDate(delay);
+ var delayFor = absoluteDelay ? (+delay - scheduler.now()) : Math.abs(delay);
+ return function (source) { return source.lift(new DelayOperator(delayFor, scheduler)); };
+}
+exports.delay = delay;
+var DelayOperator = (function () {
+ function DelayOperator(delay, scheduler) {
+ this.delay = delay;
+ this.scheduler = scheduler;
+ }
+ DelayOperator.prototype.call = function (subscriber, source) {
+ return source.subscribe(new DelaySubscriber(subscriber, this.delay, this.scheduler));
+ };
+ return DelayOperator;
+}());
+var DelaySubscriber = (function (_super) {
+ __extends(DelaySubscriber, _super);
+ function DelaySubscriber(destination, delay, scheduler) {
+ var _this = _super.call(this, destination) || this;
+ _this.delay = delay;
+ _this.scheduler = scheduler;
+ _this.queue = [];
+ _this.active = false;
+ _this.errored = false;
+ return _this;
+ }
+ DelaySubscriber.dispatch = function (state) {
+ var source = state.source;
+ var queue = source.queue;
+ var scheduler = state.scheduler;
+ var destination = state.destination;
+ while (queue.length > 0 && (queue[0].time - scheduler.now()) <= 0) {
+ queue.shift().notification.observe(destination);
+ }
+ if (queue.length > 0) {
+ var delay_1 = Math.max(0, queue[0].time - scheduler.now());
+ this.schedule(state, delay_1);
+ }
+ else {
+ this.unsubscribe();
+ source.active = false;
+ }
+ };
+ DelaySubscriber.prototype._schedule = function (scheduler) {
+ this.active = true;
+ var destination = this.destination;
+ destination.add(scheduler.schedule(DelaySubscriber.dispatch, this.delay, {
+ source: this, destination: this.destination, scheduler: scheduler
+ }));
+ };
+ DelaySubscriber.prototype.scheduleNotification = function (notification) {
+ if (this.errored === true) {
+ return;
+ }
+ var scheduler = this.scheduler;
+ var message = new DelayMessage(scheduler.now() + this.delay, notification);
+ this.queue.push(message);
+ if (this.active === false) {
+ this._schedule(scheduler);
+ }
+ };
+ DelaySubscriber.prototype._next = function (value) {
+ this.scheduleNotification(Notification_1.Notification.createNext(value));
+ };
+ DelaySubscriber.prototype._error = function (err) {
+ this.errored = true;
+ this.queue = [];
+ this.destination.error(err);
+ this.unsubscribe();
+ };
+ DelaySubscriber.prototype._complete = function () {
+ this.scheduleNotification(Notification_1.Notification.createComplete());
+ this.unsubscribe();
+ };
+ return DelaySubscriber;
+}(Subscriber_1.Subscriber));
+var DelayMessage = (function () {
+ function DelayMessage(time, notification) {
+ this.time = time;
+ this.notification = notification;
+ }
+ return DelayMessage;
+}());
+
+},{"../Notification":47,"../Subscriber":55,"../scheduler/async":206,"../util/isDate":222}],105:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var Subscriber_1 = require("../Subscriber");
+var Observable_1 = require("../Observable");
+var OuterSubscriber_1 = require("../OuterSubscriber");
+var subscribeToResult_1 = require("../util/subscribeToResult");
+function delayWhen(delayDurationSelector, subscriptionDelay) {
+ if (subscriptionDelay) {
+ return function (source) {
+ return new SubscriptionDelayObservable(source, subscriptionDelay)
+ .lift(new DelayWhenOperator(delayDurationSelector));
+ };
+ }
+ return function (source) { return source.lift(new DelayWhenOperator(delayDurationSelector)); };
+}
+exports.delayWhen = delayWhen;
+var DelayWhenOperator = (function () {
+ function DelayWhenOperator(delayDurationSelector) {
+ this.delayDurationSelector = delayDurationSelector;
+ }
+ DelayWhenOperator.prototype.call = function (subscriber, source) {
+ return source.subscribe(new DelayWhenSubscriber(subscriber, this.delayDurationSelector));
+ };
+ return DelayWhenOperator;
+}());
+var DelayWhenSubscriber = (function (_super) {
+ __extends(DelayWhenSubscriber, _super);
+ function DelayWhenSubscriber(destination, delayDurationSelector) {
+ var _this = _super.call(this, destination) || this;
+ _this.delayDurationSelector = delayDurationSelector;
+ _this.completed = false;
+ _this.delayNotifierSubscriptions = [];
+ _this.index = 0;
+ return _this;
+ }
+ DelayWhenSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
+ this.destination.next(outerValue);
+ this.removeSubscription(innerSub);
+ this.tryComplete();
+ };
+ DelayWhenSubscriber.prototype.notifyError = function (error, innerSub) {
+ this._error(error);
+ };
+ DelayWhenSubscriber.prototype.notifyComplete = function (innerSub) {
+ var value = this.removeSubscription(innerSub);
+ if (value) {
+ this.destination.next(value);
+ }
+ this.tryComplete();
+ };
+ DelayWhenSubscriber.prototype._next = function (value) {
+ var index = this.index++;
+ try {
+ var delayNotifier = this.delayDurationSelector(value, index);
+ if (delayNotifier) {
+ this.tryDelay(delayNotifier, value);
+ }
+ }
+ catch (err) {
+ this.destination.error(err);
+ }
+ };
+ DelayWhenSubscriber.prototype._complete = function () {
+ this.completed = true;
+ this.tryComplete();
+ this.unsubscribe();
+ };
+ DelayWhenSubscriber.prototype.removeSubscription = function (subscription) {
+ subscription.unsubscribe();
+ var subscriptionIdx = this.delayNotifierSubscriptions.indexOf(subscription);
+ if (subscriptionIdx !== -1) {
+ this.delayNotifierSubscriptions.splice(subscriptionIdx, 1);
+ }
+ return subscription.outerValue;
+ };
+ DelayWhenSubscriber.prototype.tryDelay = function (delayNotifier, value) {
+ var notifierSubscription = subscribeToResult_1.subscribeToResult(this, delayNotifier, value);
+ if (notifierSubscription && !notifierSubscription.closed) {
+ var destination = this.destination;
+ destination.add(notifierSubscription);
+ this.delayNotifierSubscriptions.push(notifierSubscription);
+ }
+ };
+ DelayWhenSubscriber.prototype.tryComplete = function () {
+ if (this.completed && this.delayNotifierSubscriptions.length === 0) {
+ this.destination.complete();
+ }
+ };
+ return DelayWhenSubscriber;
+}(OuterSubscriber_1.OuterSubscriber));
+var SubscriptionDelayObservable = (function (_super) {
+ __extends(SubscriptionDelayObservable, _super);
+ function SubscriptionDelayObservable(source, subscriptionDelay) {
+ var _this = _super.call(this) || this;
+ _this.source = source;
+ _this.subscriptionDelay = subscriptionDelay;
+ return _this;
+ }
+ SubscriptionDelayObservable.prototype._subscribe = function (subscriber) {
+ this.subscriptionDelay.subscribe(new SubscriptionDelaySubscriber(subscriber, this.source));
+ };
+ return SubscriptionDelayObservable;
+}(Observable_1.Observable));
+var SubscriptionDelaySubscriber = (function (_super) {
+ __extends(SubscriptionDelaySubscriber, _super);
+ function SubscriptionDelaySubscriber(parent, source) {
+ var _this = _super.call(this) || this;
+ _this.parent = parent;
+ _this.source = source;
+ _this.sourceSubscribed = false;
+ return _this;
+ }
+ SubscriptionDelaySubscriber.prototype._next = function (unused) {
+ this.subscribeToSource();
+ };
+ SubscriptionDelaySubscriber.prototype._error = function (err) {
+ this.unsubscribe();
+ this.parent.error(err);
+ };
+ SubscriptionDelaySubscriber.prototype._complete = function () {
+ this.unsubscribe();
+ this.subscribeToSource();
+ };
+ SubscriptionDelaySubscriber.prototype.subscribeToSource = function () {
+ if (!this.sourceSubscribed) {
+ this.sourceSubscribed = true;
+ this.unsubscribe();
+ this.source.subscribe(this.parent);
+ }
+ };
+ return SubscriptionDelaySubscriber;
+}(Subscriber_1.Subscriber));
+
+},{"../Observable":48,"../OuterSubscriber":50,"../Subscriber":55,"../util/subscribeToResult":239}],106:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var Subscriber_1 = require("../Subscriber");
+function dematerialize() {
+ return function dematerializeOperatorFunction(source) {
+ return source.lift(new DeMaterializeOperator());
+ };
+}
+exports.dematerialize = dematerialize;
+var DeMaterializeOperator = (function () {
+ function DeMaterializeOperator() {
+ }
+ DeMaterializeOperator.prototype.call = function (subscriber, source) {
+ return source.subscribe(new DeMaterializeSubscriber(subscriber));
+ };
+ return DeMaterializeOperator;
+}());
+var DeMaterializeSubscriber = (function (_super) {
+ __extends(DeMaterializeSubscriber, _super);
+ function DeMaterializeSubscriber(destination) {
+ return _super.call(this, destination) || this;
+ }
+ DeMaterializeSubscriber.prototype._next = function (value) {
+ value.observe(this.destination);
+ };
+ return DeMaterializeSubscriber;
+}(Subscriber_1.Subscriber));
+
+},{"../Subscriber":55}],107:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var OuterSubscriber_1 = require("../OuterSubscriber");
+var subscribeToResult_1 = require("../util/subscribeToResult");
+function distinct(keySelector, flushes) {
+ return function (source) { return source.lift(new DistinctOperator(keySelector, flushes)); };
+}
+exports.distinct = distinct;
+var DistinctOperator = (function () {
+ function DistinctOperator(keySelector, flushes) {
+ this.keySelector = keySelector;
+ this.flushes = flushes;
+ }
+ DistinctOperator.prototype.call = function (subscriber, source) {
+ return source.subscribe(new DistinctSubscriber(subscriber, this.keySelector, this.flushes));
+ };
+ return DistinctOperator;
+}());
+var DistinctSubscriber = (function (_super) {
+ __extends(DistinctSubscriber, _super);
+ function DistinctSubscriber(destination, keySelector, flushes) {
+ var _this = _super.call(this, destination) || this;
+ _this.keySelector = keySelector;
+ _this.values = new Set();
+ if (flushes) {
+ _this.add(subscribeToResult_1.subscribeToResult(_this, flushes));
+ }
+ return _this;
+ }
+ DistinctSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
+ this.values.clear();
+ };
+ DistinctSubscriber.prototype.notifyError = function (error, innerSub) {
+ this._error(error);
+ };
+ DistinctSubscriber.prototype._next = function (value) {
+ if (this.keySelector) {
+ this._useKeySelector(value);
+ }
+ else {
+ this._finalizeNext(value, value);
+ }
+ };
+ DistinctSubscriber.prototype._useKeySelector = function (value) {
+ var key;
+ var destination = this.destination;
+ try {
+ key = this.keySelector(value);
+ }
+ catch (err) {
+ destination.error(err);
+ return;
+ }
+ this._finalizeNext(key, value);
+ };
+ DistinctSubscriber.prototype._finalizeNext = function (key, value) {
+ var values = this.values;
+ if (!values.has(key)) {
+ values.add(key);
+ this.destination.next(value);
+ }
+ };
+ return DistinctSubscriber;
+}(OuterSubscriber_1.OuterSubscriber));
+exports.DistinctSubscriber = DistinctSubscriber;
+
+},{"../OuterSubscriber":50,"../util/subscribeToResult":239}],108:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var Subscriber_1 = require("../Subscriber");
+function distinctUntilChanged(compare, keySelector) {
+ return function (source) { return source.lift(new DistinctUntilChangedOperator(compare, keySelector)); };
+}
+exports.distinctUntilChanged = distinctUntilChanged;
+var DistinctUntilChangedOperator = (function () {
+ function DistinctUntilChangedOperator(compare, keySelector) {
+ this.compare = compare;
+ this.keySelector = keySelector;
+ }
+ DistinctUntilChangedOperator.prototype.call = function (subscriber, source) {
+ return source.subscribe(new DistinctUntilChangedSubscriber(subscriber, this.compare, this.keySelector));
+ };
+ return DistinctUntilChangedOperator;
+}());
+var DistinctUntilChangedSubscriber = (function (_super) {
+ __extends(DistinctUntilChangedSubscriber, _super);
+ function DistinctUntilChangedSubscriber(destination, compare, keySelector) {
+ var _this = _super.call(this, destination) || this;
+ _this.keySelector = keySelector;
+ _this.hasKey = false;
+ if (typeof compare === 'function') {
+ _this.compare = compare;
+ }
+ return _this;
+ }
+ DistinctUntilChangedSubscriber.prototype.compare = function (x, y) {
+ return x === y;
+ };
+ DistinctUntilChangedSubscriber.prototype._next = function (value) {
+ var key;
+ try {
+ var keySelector = this.keySelector;
+ key = keySelector ? keySelector(value) : value;
+ }
+ catch (err) {
+ return this.destination.error(err);
+ }
+ var result = false;
+ if (this.hasKey) {
+ try {
+ var compare = this.compare;
+ result = compare(this.key, key);
+ }
+ catch (err) {
+ return this.destination.error(err);
+ }
+ }
+ else {
+ this.hasKey = true;
+ }
+ if (!result) {
+ this.key = key;
+ this.destination.next(value);
+ }
+ };
+ return DistinctUntilChangedSubscriber;
+}(Subscriber_1.Subscriber));
+
+},{"../Subscriber":55}],109:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var distinctUntilChanged_1 = require("./distinctUntilChanged");
+function distinctUntilKeyChanged(key, compare) {
+ return distinctUntilChanged_1.distinctUntilChanged(function (x, y) { return compare ? compare(x[key], y[key]) : x[key] === y[key]; });
+}
+exports.distinctUntilKeyChanged = distinctUntilKeyChanged;
+
+},{"./distinctUntilChanged":108}],110:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var ArgumentOutOfRangeError_1 = require("../util/ArgumentOutOfRangeError");
+var filter_1 = require("./filter");
+var throwIfEmpty_1 = require("./throwIfEmpty");
+var defaultIfEmpty_1 = require("./defaultIfEmpty");
+var take_1 = require("./take");
+function elementAt(index, defaultValue) {
+ if (index < 0) {
+ throw new ArgumentOutOfRangeError_1.ArgumentOutOfRangeError();
+ }
+ var hasDefaultValue = arguments.length >= 2;
+ return function (source) { return source.pipe(filter_1.filter(function (v, i) { return i === index; }), take_1.take(1), hasDefaultValue
+ ? defaultIfEmpty_1.defaultIfEmpty(defaultValue)
+ : throwIfEmpty_1.throwIfEmpty(function () { return new ArgumentOutOfRangeError_1.ArgumentOutOfRangeError(); })); };
+}
+exports.elementAt = elementAt;
+
+},{"../util/ArgumentOutOfRangeError":211,"./defaultIfEmpty":103,"./filter":116,"./take":168,"./throwIfEmpty":175}],111:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var concat_1 = require("../observable/concat");
+var of_1 = require("../observable/of");
+function endWith() {
+ var array = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ array[_i] = arguments[_i];
+ }
+ return function (source) { return concat_1.concat(source, of_1.of.apply(void 0, array)); };
+}
+exports.endWith = endWith;
+
+},{"../observable/concat":63,"../observable/of":76}],112:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var Subscriber_1 = require("../Subscriber");
+function every(predicate, thisArg) {
+ return function (source) { return source.lift(new EveryOperator(predicate, thisArg, source)); };
+}
+exports.every = every;
+var EveryOperator = (function () {
+ function EveryOperator(predicate, thisArg, source) {
+ this.predicate = predicate;
+ this.thisArg = thisArg;
+ this.source = source;
+ }
+ EveryOperator.prototype.call = function (observer, source) {
+ return source.subscribe(new EverySubscriber(observer, this.predicate, this.thisArg, this.source));
+ };
+ return EveryOperator;
+}());
+var EverySubscriber = (function (_super) {
+ __extends(EverySubscriber, _super);
+ function EverySubscriber(destination, predicate, thisArg, source) {
+ var _this = _super.call(this, destination) || this;
+ _this.predicate = predicate;
+ _this.thisArg = thisArg;
+ _this.source = source;
+ _this.index = 0;
+ _this.thisArg = thisArg || _this;
+ return _this;
+ }
+ EverySubscriber.prototype.notifyComplete = function (everyValueMatch) {
+ this.destination.next(everyValueMatch);
+ this.destination.complete();
+ };
+ EverySubscriber.prototype._next = function (value) {
+ var result = false;
+ try {
+ result = this.predicate.call(this.thisArg, value, this.index++, this.source);
+ }
+ catch (err) {
+ this.destination.error(err);
+ return;
+ }
+ if (!result) {
+ this.notifyComplete(false);
+ }
+ };
+ EverySubscriber.prototype._complete = function () {
+ this.notifyComplete(true);
+ };
+ return EverySubscriber;
+}(Subscriber_1.Subscriber));
+
+},{"../Subscriber":55}],113:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var OuterSubscriber_1 = require("../OuterSubscriber");
+var subscribeToResult_1 = require("../util/subscribeToResult");
+function exhaust() {
+ return function (source) { return source.lift(new SwitchFirstOperator()); };
+}
+exports.exhaust = exhaust;
+var SwitchFirstOperator = (function () {
+ function SwitchFirstOperator() {
+ }
+ SwitchFirstOperator.prototype.call = function (subscriber, source) {
+ return source.subscribe(new SwitchFirstSubscriber(subscriber));
+ };
+ return SwitchFirstOperator;
+}());
+var SwitchFirstSubscriber = (function (_super) {
+ __extends(SwitchFirstSubscriber, _super);
+ function SwitchFirstSubscriber(destination) {
+ var _this = _super.call(this, destination) || this;
+ _this.hasCompleted = false;
+ _this.hasSubscription = false;
+ return _this;
+ }
+ SwitchFirstSubscriber.prototype._next = function (value) {
+ if (!this.hasSubscription) {
+ this.hasSubscription = true;
+ this.add(subscribeToResult_1.subscribeToResult(this, value));
+ }
+ };
+ SwitchFirstSubscriber.prototype._complete = function () {
+ this.hasCompleted = true;
+ if (!this.hasSubscription) {
+ this.destination.complete();
+ }
+ };
+ SwitchFirstSubscriber.prototype.notifyComplete = function (innerSub) {
+ this.remove(innerSub);
+ this.hasSubscription = false;
+ if (this.hasCompleted) {
+ this.destination.complete();
+ }
+ };
+ return SwitchFirstSubscriber;
+}(OuterSubscriber_1.OuterSubscriber));
+
+},{"../OuterSubscriber":50,"../util/subscribeToResult":239}],114:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var OuterSubscriber_1 = require("../OuterSubscriber");
+var InnerSubscriber_1 = require("../InnerSubscriber");
+var subscribeToResult_1 = require("../util/subscribeToResult");
+var map_1 = require("./map");
+var from_1 = require("../observable/from");
+function exhaustMap(project, resultSelector) {
+ if (resultSelector) {
+ return function (source) { return source.pipe(exhaustMap(function (a, i) { return from_1.from(project(a, i)).pipe(map_1.map(function (b, ii) { return resultSelector(a, b, i, ii); })); })); };
+ }
+ return function (source) {
+ return source.lift(new ExhaustMapOperator(project));
+ };
+}
+exports.exhaustMap = exhaustMap;
+var ExhaustMapOperator = (function () {
+ function ExhaustMapOperator(project) {
+ this.project = project;
+ }
+ ExhaustMapOperator.prototype.call = function (subscriber, source) {
+ return source.subscribe(new ExhaustMapSubscriber(subscriber, this.project));
+ };
+ return ExhaustMapOperator;
+}());
+var ExhaustMapSubscriber = (function (_super) {
+ __extends(ExhaustMapSubscriber, _super);
+ function ExhaustMapSubscriber(destination, project) {
+ var _this = _super.call(this, destination) || this;
+ _this.project = project;
+ _this.hasSubscription = false;
+ _this.hasCompleted = false;
+ _this.index = 0;
+ return _this;
+ }
+ ExhaustMapSubscriber.prototype._next = function (value) {
+ if (!this.hasSubscription) {
+ this.tryNext(value);
+ }
+ };
+ ExhaustMapSubscriber.prototype.tryNext = function (value) {
+ var result;
+ var index = this.index++;
+ try {
+ result = this.project(value, index);
+ }
+ catch (err) {
+ this.destination.error(err);
+ return;
+ }
+ this.hasSubscription = true;
+ this._innerSub(result, value, index);
+ };
+ ExhaustMapSubscriber.prototype._innerSub = function (result, value, index) {
+ var innerSubscriber = new InnerSubscriber_1.InnerSubscriber(this, value, index);
+ var destination = this.destination;
+ destination.add(innerSubscriber);
+ var innerSubscription = subscribeToResult_1.subscribeToResult(this, result, undefined, undefined, innerSubscriber);
+ if (innerSubscription !== innerSubscriber) {
+ destination.add(innerSubscription);
+ }
+ };
+ ExhaustMapSubscriber.prototype._complete = function () {
+ this.hasCompleted = true;
+ if (!this.hasSubscription) {
+ this.destination.complete();
+ }
+ this.unsubscribe();
+ };
+ ExhaustMapSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
+ this.destination.next(innerValue);
+ };
+ ExhaustMapSubscriber.prototype.notifyError = function (err) {
+ this.destination.error(err);
+ };
+ ExhaustMapSubscriber.prototype.notifyComplete = function (innerSub) {
+ var destination = this.destination;
+ destination.remove(innerSub);
+ this.hasSubscription = false;
+ if (this.hasCompleted) {
+ this.destination.complete();
+ }
+ };
+ return ExhaustMapSubscriber;
+}(OuterSubscriber_1.OuterSubscriber));
+
+},{"../InnerSubscriber":46,"../OuterSubscriber":50,"../observable/from":67,"../util/subscribeToResult":239,"./map":125}],115:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var OuterSubscriber_1 = require("../OuterSubscriber");
+var subscribeToResult_1 = require("../util/subscribeToResult");
+function expand(project, concurrent, scheduler) {
+ if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; }
+ if (scheduler === void 0) { scheduler = undefined; }
+ concurrent = (concurrent || 0) < 1 ? Number.POSITIVE_INFINITY : concurrent;
+ return function (source) { return source.lift(new ExpandOperator(project, concurrent, scheduler)); };
+}
+exports.expand = expand;
+var ExpandOperator = (function () {
+ function ExpandOperator(project, concurrent, scheduler) {
+ this.project = project;
+ this.concurrent = concurrent;
+ this.scheduler = scheduler;
+ }
+ ExpandOperator.prototype.call = function (subscriber, source) {
+ return source.subscribe(new ExpandSubscriber(subscriber, this.project, this.concurrent, this.scheduler));
+ };
+ return ExpandOperator;
+}());
+exports.ExpandOperator = ExpandOperator;
+var ExpandSubscriber = (function (_super) {
+ __extends(ExpandSubscriber, _super);
+ function ExpandSubscriber(destination, project, concurrent, scheduler) {
+ var _this = _super.call(this, destination) || this;
+ _this.project = project;
+ _this.concurrent = concurrent;
+ _this.scheduler = scheduler;
+ _this.index = 0;
+ _this.active = 0;
+ _this.hasCompleted = false;
+ if (concurrent < Number.POSITIVE_INFINITY) {
+ _this.buffer = [];
+ }
+ return _this;
+ }
+ ExpandSubscriber.dispatch = function (arg) {
+ var subscriber = arg.subscriber, result = arg.result, value = arg.value, index = arg.index;
+ subscriber.subscribeToProjection(result, value, index);
+ };
+ ExpandSubscriber.prototype._next = function (value) {
+ var destination = this.destination;
+ if (destination.closed) {
+ this._complete();
+ return;
+ }
+ var index = this.index++;
+ if (this.active < this.concurrent) {
+ destination.next(value);
+ try {
+ var project = this.project;
+ var result = project(value, index);
+ if (!this.scheduler) {
+ this.subscribeToProjection(result, value, index);
+ }
+ else {
+ var state = { subscriber: this, result: result, value: value, index: index };
+ var destination_1 = this.destination;
+ destination_1.add(this.scheduler.schedule(ExpandSubscriber.dispatch, 0, state));
+ }
+ }
+ catch (e) {
+ destination.error(e);
+ }
+ }
+ else {
+ this.buffer.push(value);
+ }
+ };
+ ExpandSubscriber.prototype.subscribeToProjection = function (result, value, index) {
+ this.active++;
+ var destination = this.destination;
+ destination.add(subscribeToResult_1.subscribeToResult(this, result, value, index));
+ };
+ ExpandSubscriber.prototype._complete = function () {
+ this.hasCompleted = true;
+ if (this.hasCompleted && this.active === 0) {
+ this.destination.complete();
+ }
+ this.unsubscribe();
+ };
+ ExpandSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
+ this._next(innerValue);
+ };
+ ExpandSubscriber.prototype.notifyComplete = function (innerSub) {
+ var buffer = this.buffer;
+ var destination = this.destination;
+ destination.remove(innerSub);
+ this.active--;
+ if (buffer && buffer.length > 0) {
+ this._next(buffer.shift());
+ }
+ if (this.hasCompleted && this.active === 0) {
+ this.destination.complete();
+ }
+ };
+ return ExpandSubscriber;
+}(OuterSubscriber_1.OuterSubscriber));
+exports.ExpandSubscriber = ExpandSubscriber;
+
+},{"../OuterSubscriber":50,"../util/subscribeToResult":239}],116:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var Subscriber_1 = require("../Subscriber");
+function filter(predicate, thisArg) {
+ return function filterOperatorFunction(source) {
+ return source.lift(new FilterOperator(predicate, thisArg));
+ };
+}
+exports.filter = filter;
+var FilterOperator = (function () {
+ function FilterOperator(predicate, thisArg) {
+ this.predicate = predicate;
+ this.thisArg = thisArg;
+ }
+ FilterOperator.prototype.call = function (subscriber, source) {
+ return source.subscribe(new FilterSubscriber(subscriber, this.predicate, this.thisArg));
+ };
+ return FilterOperator;
+}());
+var FilterSubscriber = (function (_super) {
+ __extends(FilterSubscriber, _super);
+ function FilterSubscriber(destination, predicate, thisArg) {
+ var _this = _super.call(this, destination) || this;
+ _this.predicate = predicate;
+ _this.thisArg = thisArg;
+ _this.count = 0;
+ return _this;
+ }
+ FilterSubscriber.prototype._next = function (value) {
+ var result;
+ try {
+ result = this.predicate.call(this.thisArg, value, this.count++);
+ }
+ catch (err) {
+ this.destination.error(err);
+ return;
+ }
+ if (result) {
+ this.destination.next(value);
+ }
+ };
+ return FilterSubscriber;
+}(Subscriber_1.Subscriber));
+
+},{"../Subscriber":55}],117:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var Subscriber_1 = require("../Subscriber");
+var Subscription_1 = require("../Subscription");
+function finalize(callback) {
+ return function (source) { return source.lift(new FinallyOperator(callback)); };
+}
+exports.finalize = finalize;
+var FinallyOperator = (function () {
+ function FinallyOperator(callback) {
+ this.callback = callback;
+ }
+ FinallyOperator.prototype.call = function (subscriber, source) {
+ return source.subscribe(new FinallySubscriber(subscriber, this.callback));
+ };
+ return FinallyOperator;
+}());
+var FinallySubscriber = (function (_super) {
+ __extends(FinallySubscriber, _super);
+ function FinallySubscriber(destination, callback) {
+ var _this = _super.call(this, destination) || this;
+ _this.add(new Subscription_1.Subscription(callback));
+ return _this;
+ }
+ return FinallySubscriber;
+}(Subscriber_1.Subscriber));
+
+},{"../Subscriber":55,"../Subscription":56}],118:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var Subscriber_1 = require("../Subscriber");
+function find(predicate, thisArg) {
+ if (typeof predicate !== 'function') {
+ throw new TypeError('predicate is not a function');
+ }
+ return function (source) { return source.lift(new FindValueOperator(predicate, source, false, thisArg)); };
+}
+exports.find = find;
+var FindValueOperator = (function () {
+ function FindValueOperator(predicate, source, yieldIndex, thisArg) {
+ this.predicate = predicate;
+ this.source = source;
+ this.yieldIndex = yieldIndex;
+ this.thisArg = thisArg;
+ }
+ FindValueOperator.prototype.call = function (observer, source) {
+ return source.subscribe(new FindValueSubscriber(observer, this.predicate, this.source, this.yieldIndex, this.thisArg));
+ };
+ return FindValueOperator;
+}());
+exports.FindValueOperator = FindValueOperator;
+var FindValueSubscriber = (function (_super) {
+ __extends(FindValueSubscriber, _super);
+ function FindValueSubscriber(destination, predicate, source, yieldIndex, thisArg) {
+ var _this = _super.call(this, destination) || this;
+ _this.predicate = predicate;
+ _this.source = source;
+ _this.yieldIndex = yieldIndex;
+ _this.thisArg = thisArg;
+ _this.index = 0;
+ return _this;
+ }
+ FindValueSubscriber.prototype.notifyComplete = function (value) {
+ var destination = this.destination;
+ destination.next(value);
+ destination.complete();
+ this.unsubscribe();
+ };
+ FindValueSubscriber.prototype._next = function (value) {
+ var _a = this, predicate = _a.predicate, thisArg = _a.thisArg;
+ var index = this.index++;
+ try {
+ var result = predicate.call(thisArg || this, value, index, this.source);
+ if (result) {
+ this.notifyComplete(this.yieldIndex ? index : value);
+ }
+ }
+ catch (err) {
+ this.destination.error(err);
+ }
+ };
+ FindValueSubscriber.prototype._complete = function () {
+ this.notifyComplete(this.yieldIndex ? -1 : undefined);
+ };
+ return FindValueSubscriber;
+}(Subscriber_1.Subscriber));
+exports.FindValueSubscriber = FindValueSubscriber;
+
+},{"../Subscriber":55}],119:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var find_1 = require("../operators/find");
+function findIndex(predicate, thisArg) {
+ return function (source) { return source.lift(new find_1.FindValueOperator(predicate, source, true, thisArg)); };
+}
+exports.findIndex = findIndex;
+
+},{"../operators/find":118}],120:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var EmptyError_1 = require("../util/EmptyError");
+var filter_1 = require("./filter");
+var take_1 = require("./take");
+var defaultIfEmpty_1 = require("./defaultIfEmpty");
+var throwIfEmpty_1 = require("./throwIfEmpty");
+var identity_1 = require("../util/identity");
+function first(predicate, defaultValue) {
+ var hasDefaultValue = arguments.length >= 2;
+ return function (source) { return source.pipe(predicate ? filter_1.filter(function (v, i) { return predicate(v, i, source); }) : identity_1.identity, take_1.take(1), hasDefaultValue ? defaultIfEmpty_1.defaultIfEmpty(defaultValue) : throwIfEmpty_1.throwIfEmpty(function () { return new EmptyError_1.EmptyError(); })); };
+}
+exports.first = first;
+
+},{"../util/EmptyError":212,"../util/identity":219,"./defaultIfEmpty":103,"./filter":116,"./take":168,"./throwIfEmpty":175}],121:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var Subscriber_1 = require("../Subscriber");
+var Subscription_1 = require("../Subscription");
+var Observable_1 = require("../Observable");
+var Subject_1 = require("../Subject");
+function groupBy(keySelector, elementSelector, durationSelector, subjectSelector) {
+ return function (source) {
+ return source.lift(new GroupByOperator(keySelector, elementSelector, durationSelector, subjectSelector));
+ };
+}
+exports.groupBy = groupBy;
+var GroupByOperator = (function () {
+ function GroupByOperator(keySelector, elementSelector, durationSelector, subjectSelector) {
+ this.keySelector = keySelector;
+ this.elementSelector = elementSelector;
+ this.durationSelector = durationSelector;
+ this.subjectSelector = subjectSelector;
+ }
+ GroupByOperator.prototype.call = function (subscriber, source) {
+ return source.subscribe(new GroupBySubscriber(subscriber, this.keySelector, this.elementSelector, this.durationSelector, this.subjectSelector));
+ };
+ return GroupByOperator;
+}());
+var GroupBySubscriber = (function (_super) {
+ __extends(GroupBySubscriber, _super);
+ function GroupBySubscriber(destination, keySelector, elementSelector, durationSelector, subjectSelector) {
+ var _this = _super.call(this, destination) || this;
+ _this.keySelector = keySelector;
+ _this.elementSelector = elementSelector;
+ _this.durationSelector = durationSelector;
+ _this.subjectSelector = subjectSelector;
+ _this.groups = null;
+ _this.attemptedToUnsubscribe = false;
+ _this.count = 0;
+ return _this;
+ }
+ GroupBySubscriber.prototype._next = function (value) {
+ var key;
+ try {
+ key = this.keySelector(value);
+ }
+ catch (err) {
+ this.error(err);
+ return;
+ }
+ this._group(value, key);
+ };
+ GroupBySubscriber.prototype._group = function (value, key) {
+ var groups = this.groups;
+ if (!groups) {
+ groups = this.groups = new Map();
+ }
+ var group = groups.get(key);
+ var element;
+ if (this.elementSelector) {
+ try {
+ element = this.elementSelector(value);
+ }
+ catch (err) {
+ this.error(err);
+ }
+ }
+ else {
+ element = value;
+ }
+ if (!group) {
+ group = (this.subjectSelector ? this.subjectSelector() : new Subject_1.Subject());
+ groups.set(key, group);
+ var groupedObservable = new GroupedObservable(key, group, this);
+ this.destination.next(groupedObservable);
+ if (this.durationSelector) {
+ var duration = void 0;
+ try {
+ duration = this.durationSelector(new GroupedObservable(key, group));
+ }
+ catch (err) {
+ this.error(err);
+ return;
+ }
+ this.add(duration.subscribe(new GroupDurationSubscriber(key, group, this)));
+ }
+ }
+ if (!group.closed) {
+ group.next(element);
+ }
+ };
+ GroupBySubscriber.prototype._error = function (err) {
+ var groups = this.groups;
+ if (groups) {
+ groups.forEach(function (group, key) {
+ group.error(err);
+ });
+ groups.clear();
+ }
+ this.destination.error(err);
+ };
+ GroupBySubscriber.prototype._complete = function () {
+ var groups = this.groups;
+ if (groups) {
+ groups.forEach(function (group, key) {
+ group.complete();
+ });
+ groups.clear();
+ }
+ this.destination.complete();
+ };
+ GroupBySubscriber.prototype.removeGroup = function (key) {
+ this.groups.delete(key);
+ };
+ GroupBySubscriber.prototype.unsubscribe = function () {
+ if (!this.closed) {
+ this.attemptedToUnsubscribe = true;
+ if (this.count === 0) {
+ _super.prototype.unsubscribe.call(this);
+ }
+ }
+ };
+ return GroupBySubscriber;
+}(Subscriber_1.Subscriber));
+var GroupDurationSubscriber = (function (_super) {
+ __extends(GroupDurationSubscriber, _super);
+ function GroupDurationSubscriber(key, group, parent) {
+ var _this = _super.call(this, group) || this;
+ _this.key = key;
+ _this.group = group;
+ _this.parent = parent;
+ return _this;
+ }
+ GroupDurationSubscriber.prototype._next = function (value) {
+ this.complete();
+ };
+ GroupDurationSubscriber.prototype._unsubscribe = function () {
+ var _a = this, parent = _a.parent, key = _a.key;
+ this.key = this.parent = null;
+ if (parent) {
+ parent.removeGroup(key);
+ }
+ };
+ return GroupDurationSubscriber;
+}(Subscriber_1.Subscriber));
+var GroupedObservable = (function (_super) {
+ __extends(GroupedObservable, _super);
+ function GroupedObservable(key, groupSubject, refCountSubscription) {
+ var _this = _super.call(this) || this;
+ _this.key = key;
+ _this.groupSubject = groupSubject;
+ _this.refCountSubscription = refCountSubscription;
+ return _this;
+ }
+ GroupedObservable.prototype._subscribe = function (subscriber) {
+ var subscription = new Subscription_1.Subscription();
+ var _a = this, refCountSubscription = _a.refCountSubscription, groupSubject = _a.groupSubject;
+ if (refCountSubscription && !refCountSubscription.closed) {
+ subscription.add(new InnerRefCountSubscription(refCountSubscription));
+ }
+ subscription.add(groupSubject.subscribe(subscriber));
+ return subscription;
+ };
+ return GroupedObservable;
+}(Observable_1.Observable));
+exports.GroupedObservable = GroupedObservable;
+var InnerRefCountSubscription = (function (_super) {
+ __extends(InnerRefCountSubscription, _super);
+ function InnerRefCountSubscription(parent) {
+ var _this = _super.call(this) || this;
+ _this.parent = parent;
+ parent.count++;
+ return _this;
+ }
+ InnerRefCountSubscription.prototype.unsubscribe = function () {
+ var parent = this.parent;
+ if (!parent.closed && !this.closed) {
+ _super.prototype.unsubscribe.call(this);
+ parent.count -= 1;
+ if (parent.count === 0 && parent.attemptedToUnsubscribe) {
+ parent.unsubscribe();
+ }
+ }
+ };
+ return InnerRefCountSubscription;
+}(Subscription_1.Subscription));
+
+},{"../Observable":48,"../Subject":53,"../Subscriber":55,"../Subscription":56}],122:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var Subscriber_1 = require("../Subscriber");
+function ignoreElements() {
+ return function ignoreElementsOperatorFunction(source) {
+ return source.lift(new IgnoreElementsOperator());
+ };
+}
+exports.ignoreElements = ignoreElements;
+var IgnoreElementsOperator = (function () {
+ function IgnoreElementsOperator() {
+ }
+ IgnoreElementsOperator.prototype.call = function (subscriber, source) {
+ return source.subscribe(new IgnoreElementsSubscriber(subscriber));
+ };
+ return IgnoreElementsOperator;
+}());
+var IgnoreElementsSubscriber = (function (_super) {
+ __extends(IgnoreElementsSubscriber, _super);
+ function IgnoreElementsSubscriber() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ IgnoreElementsSubscriber.prototype._next = function (unused) {
+ };
+ return IgnoreElementsSubscriber;
+}(Subscriber_1.Subscriber));
+
+},{"../Subscriber":55}],123:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var Subscriber_1 = require("../Subscriber");
+function isEmpty() {
+ return function (source) { return source.lift(new IsEmptyOperator()); };
+}
+exports.isEmpty = isEmpty;
+var IsEmptyOperator = (function () {
+ function IsEmptyOperator() {
+ }
+ IsEmptyOperator.prototype.call = function (observer, source) {
+ return source.subscribe(new IsEmptySubscriber(observer));
+ };
+ return IsEmptyOperator;
+}());
+var IsEmptySubscriber = (function (_super) {
+ __extends(IsEmptySubscriber, _super);
+ function IsEmptySubscriber(destination) {
+ return _super.call(this, destination) || this;
+ }
+ IsEmptySubscriber.prototype.notifyComplete = function (isEmpty) {
+ var destination = this.destination;
+ destination.next(isEmpty);
+ destination.complete();
+ };
+ IsEmptySubscriber.prototype._next = function (value) {
+ this.notifyComplete(false);
+ };
+ IsEmptySubscriber.prototype._complete = function () {
+ this.notifyComplete(true);
+ };
+ return IsEmptySubscriber;
+}(Subscriber_1.Subscriber));
+
+},{"../Subscriber":55}],124:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var EmptyError_1 = require("../util/EmptyError");
+var filter_1 = require("./filter");
+var takeLast_1 = require("./takeLast");
+var throwIfEmpty_1 = require("./throwIfEmpty");
+var defaultIfEmpty_1 = require("./defaultIfEmpty");
+var identity_1 = require("../util/identity");
+function last(predicate, defaultValue) {
+ var hasDefaultValue = arguments.length >= 2;
+ return function (source) { return source.pipe(predicate ? filter_1.filter(function (v, i) { return predicate(v, i, source); }) : identity_1.identity, takeLast_1.takeLast(1), hasDefaultValue ? defaultIfEmpty_1.defaultIfEmpty(defaultValue) : throwIfEmpty_1.throwIfEmpty(function () { return new EmptyError_1.EmptyError(); })); };
+}
+exports.last = last;
+
+},{"../util/EmptyError":212,"../util/identity":219,"./defaultIfEmpty":103,"./filter":116,"./takeLast":169,"./throwIfEmpty":175}],125:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var Subscriber_1 = require("../Subscriber");
+function map(project, thisArg) {
+ return function mapOperation(source) {
+ if (typeof project !== 'function') {
+ throw new TypeError('argument is not a function. Are you looking for `mapTo()`?');
+ }
+ return source.lift(new MapOperator(project, thisArg));
+ };
+}
+exports.map = map;
+var MapOperator = (function () {
+ function MapOperator(project, thisArg) {
+ this.project = project;
+ this.thisArg = thisArg;
+ }
+ MapOperator.prototype.call = function (subscriber, source) {
+ return source.subscribe(new MapSubscriber(subscriber, this.project, this.thisArg));
+ };
+ return MapOperator;
+}());
+exports.MapOperator = MapOperator;
+var MapSubscriber = (function (_super) {
+ __extends(MapSubscriber, _super);
+ function MapSubscriber(destination, project, thisArg) {
+ var _this = _super.call(this, destination) || this;
+ _this.project = project;
+ _this.count = 0;
+ _this.thisArg = thisArg || _this;
+ return _this;
+ }
+ MapSubscriber.prototype._next = function (value) {
+ var result;
+ try {
+ result = this.project.call(this.thisArg, value, this.count++);
+ }
+ catch (err) {
+ this.destination.error(err);
+ return;
+ }
+ this.destination.next(result);
+ };
+ return MapSubscriber;
+}(Subscriber_1.Subscriber));
+
+},{"../Subscriber":55}],126:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var Subscriber_1 = require("../Subscriber");
+function mapTo(value) {
+ return function (source) { return source.lift(new MapToOperator(value)); };
+}
+exports.mapTo = mapTo;
+var MapToOperator = (function () {
+ function MapToOperator(value) {
+ this.value = value;
+ }
+ MapToOperator.prototype.call = function (subscriber, source) {
+ return source.subscribe(new MapToSubscriber(subscriber, this.value));
+ };
+ return MapToOperator;
+}());
+var MapToSubscriber = (function (_super) {
+ __extends(MapToSubscriber, _super);
+ function MapToSubscriber(destination, value) {
+ var _this = _super.call(this, destination) || this;
+ _this.value = value;
+ return _this;
+ }
+ MapToSubscriber.prototype._next = function (x) {
+ this.destination.next(this.value);
+ };
+ return MapToSubscriber;
+}(Subscriber_1.Subscriber));
+
+},{"../Subscriber":55}],127:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var Subscriber_1 = require("../Subscriber");
+var Notification_1 = require("../Notification");
+function materialize() {
+ return function materializeOperatorFunction(source) {
+ return source.lift(new MaterializeOperator());
+ };
+}
+exports.materialize = materialize;
+var MaterializeOperator = (function () {
+ function MaterializeOperator() {
+ }
+ MaterializeOperator.prototype.call = function (subscriber, source) {
+ return source.subscribe(new MaterializeSubscriber(subscriber));
+ };
+ return MaterializeOperator;
+}());
+var MaterializeSubscriber = (function (_super) {
+ __extends(MaterializeSubscriber, _super);
+ function MaterializeSubscriber(destination) {
+ return _super.call(this, destination) || this;
+ }
+ MaterializeSubscriber.prototype._next = function (value) {
+ this.destination.next(Notification_1.Notification.createNext(value));
+ };
+ MaterializeSubscriber.prototype._error = function (err) {
+ var destination = this.destination;
+ destination.next(Notification_1.Notification.createError(err));
+ destination.complete();
+ };
+ MaterializeSubscriber.prototype._complete = function () {
+ var destination = this.destination;
+ destination.next(Notification_1.Notification.createComplete());
+ destination.complete();
+ };
+ return MaterializeSubscriber;
+}(Subscriber_1.Subscriber));
+
+},{"../Notification":47,"../Subscriber":55}],128:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var reduce_1 = require("./reduce");
+function max(comparer) {
+ var max = (typeof comparer === 'function')
+ ? function (x, y) { return comparer(x, y) > 0 ? x : y; }
+ : function (x, y) { return x > y ? x : y; };
+ return reduce_1.reduce(max);
+}
+exports.max = max;
+
+},{"./reduce":146}],129:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var merge_1 = require("../observable/merge");
+function merge() {
+ var observables = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ observables[_i] = arguments[_i];
+ }
+ return function (source) { return source.lift.call(merge_1.merge.apply(void 0, [source].concat(observables))); };
+}
+exports.merge = merge;
+
+},{"../observable/merge":74}],130:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var mergeMap_1 = require("./mergeMap");
+var identity_1 = require("../util/identity");
+function mergeAll(concurrent) {
+ if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; }
+ return mergeMap_1.mergeMap(identity_1.identity, concurrent);
+}
+exports.mergeAll = mergeAll;
+
+},{"../util/identity":219,"./mergeMap":131}],131:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var subscribeToResult_1 = require("../util/subscribeToResult");
+var OuterSubscriber_1 = require("../OuterSubscriber");
+var InnerSubscriber_1 = require("../InnerSubscriber");
+var map_1 = require("./map");
+var from_1 = require("../observable/from");
+function mergeMap(project, resultSelector, concurrent) {
+ if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; }
+ if (typeof resultSelector === 'function') {
+ return function (source) { return source.pipe(mergeMap(function (a, i) { return from_1.from(project(a, i)).pipe(map_1.map(function (b, ii) { return resultSelector(a, b, i, ii); })); }, concurrent)); };
+ }
+ else if (typeof resultSelector === 'number') {
+ concurrent = resultSelector;
+ }
+ return function (source) { return source.lift(new MergeMapOperator(project, concurrent)); };
+}
+exports.mergeMap = mergeMap;
+var MergeMapOperator = (function () {
+ function MergeMapOperator(project, concurrent) {
+ if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; }
+ this.project = project;
+ this.concurrent = concurrent;
+ }
+ MergeMapOperator.prototype.call = function (observer, source) {
+ return source.subscribe(new MergeMapSubscriber(observer, this.project, this.concurrent));
+ };
+ return MergeMapOperator;
+}());
+exports.MergeMapOperator = MergeMapOperator;
+var MergeMapSubscriber = (function (_super) {
+ __extends(MergeMapSubscriber, _super);
+ function MergeMapSubscriber(destination, project, concurrent) {
+ if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; }
+ var _this = _super.call(this, destination) || this;
+ _this.project = project;
+ _this.concurrent = concurrent;
+ _this.hasCompleted = false;
+ _this.buffer = [];
+ _this.active = 0;
+ _this.index = 0;
+ return _this;
+ }
+ MergeMapSubscriber.prototype._next = function (value) {
+ if (this.active < this.concurrent) {
+ this._tryNext(value);
+ }
+ else {
+ this.buffer.push(value);
+ }
+ };
+ MergeMapSubscriber.prototype._tryNext = function (value) {
+ var result;
+ var index = this.index++;
+ try {
+ result = this.project(value, index);
+ }
+ catch (err) {
+ this.destination.error(err);
+ return;
+ }
+ this.active++;
+ this._innerSub(result, value, index);
+ };
+ MergeMapSubscriber.prototype._innerSub = function (ish, value, index) {
+ var innerSubscriber = new InnerSubscriber_1.InnerSubscriber(this, value, index);
+ var destination = this.destination;
+ destination.add(innerSubscriber);
+ var innerSubscription = subscribeToResult_1.subscribeToResult(this, ish, undefined, undefined, innerSubscriber);
+ if (innerSubscription !== innerSubscriber) {
+ destination.add(innerSubscription);
+ }
+ };
+ MergeMapSubscriber.prototype._complete = function () {
+ this.hasCompleted = true;
+ if (this.active === 0 && this.buffer.length === 0) {
+ this.destination.complete();
+ }
+ this.unsubscribe();
+ };
+ MergeMapSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
+ this.destination.next(innerValue);
+ };
+ MergeMapSubscriber.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 MergeMapSubscriber;
+}(OuterSubscriber_1.OuterSubscriber));
+exports.MergeMapSubscriber = MergeMapSubscriber;
+
+},{"../InnerSubscriber":46,"../OuterSubscriber":50,"../observable/from":67,"../util/subscribeToResult":239,"./map":125}],132:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var mergeMap_1 = require("./mergeMap");
+function mergeMapTo(innerObservable, resultSelector, concurrent) {
+ if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; }
+ if (typeof resultSelector === 'function') {
+ return mergeMap_1.mergeMap(function () { return innerObservable; }, resultSelector, concurrent);
+ }
+ if (typeof resultSelector === 'number') {
+ concurrent = resultSelector;
+ }
+ return mergeMap_1.mergeMap(function () { return innerObservable; }, concurrent);
+}
+exports.mergeMapTo = mergeMapTo;
+
+},{"./mergeMap":131}],133:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var subscribeToResult_1 = require("../util/subscribeToResult");
+var OuterSubscriber_1 = require("../OuterSubscriber");
+var InnerSubscriber_1 = require("../InnerSubscriber");
+function mergeScan(accumulator, seed, concurrent) {
+ if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; }
+ return function (source) { return source.lift(new MergeScanOperator(accumulator, seed, concurrent)); };
+}
+exports.mergeScan = mergeScan;
+var MergeScanOperator = (function () {
+ function MergeScanOperator(accumulator, seed, concurrent) {
+ this.accumulator = accumulator;
+ this.seed = seed;
+ this.concurrent = concurrent;
+ }
+ MergeScanOperator.prototype.call = function (subscriber, source) {
+ return source.subscribe(new MergeScanSubscriber(subscriber, this.accumulator, this.seed, this.concurrent));
+ };
+ return MergeScanOperator;
+}());
+exports.MergeScanOperator = MergeScanOperator;
+var MergeScanSubscriber = (function (_super) {
+ __extends(MergeScanSubscriber, _super);
+ function MergeScanSubscriber(destination, accumulator, acc, concurrent) {
+ var _this = _super.call(this, destination) || this;
+ _this.accumulator = accumulator;
+ _this.acc = acc;
+ _this.concurrent = concurrent;
+ _this.hasValue = false;
+ _this.hasCompleted = false;
+ _this.buffer = [];
+ _this.active = 0;
+ _this.index = 0;
+ return _this;
+ }
+ MergeScanSubscriber.prototype._next = function (value) {
+ if (this.active < this.concurrent) {
+ var index = this.index++;
+ var destination = this.destination;
+ var ish = void 0;
+ try {
+ var accumulator = this.accumulator;
+ ish = accumulator(this.acc, value, index);
+ }
+ catch (e) {
+ return destination.error(e);
+ }
+ this.active++;
+ this._innerSub(ish, value, index);
+ }
+ else {
+ this.buffer.push(value);
+ }
+ };
+ MergeScanSubscriber.prototype._innerSub = function (ish, value, index) {
+ var innerSubscriber = new InnerSubscriber_1.InnerSubscriber(this, value, index);
+ var destination = this.destination;
+ destination.add(innerSubscriber);
+ var innerSubscription = subscribeToResult_1.subscribeToResult(this, ish, undefined, undefined, innerSubscriber);
+ if (innerSubscription !== innerSubscriber) {
+ destination.add(innerSubscription);
+ }
+ };
+ MergeScanSubscriber.prototype._complete = function () {
+ this.hasCompleted = true;
+ if (this.active === 0 && this.buffer.length === 0) {
+ if (this.hasValue === false) {
+ this.destination.next(this.acc);
+ }
+ this.destination.complete();
+ }
+ this.unsubscribe();
+ };
+ MergeScanSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
+ var destination = this.destination;
+ this.acc = innerValue;
+ this.hasValue = true;
+ destination.next(innerValue);
+ };
+ MergeScanSubscriber.prototype.notifyComplete = function (innerSub) {
+ var buffer = this.buffer;
+ var destination = this.destination;
+ destination.remove(innerSub);
+ this.active--;
+ if (buffer.length > 0) {
+ this._next(buffer.shift());
+ }
+ else if (this.active === 0 && this.hasCompleted) {
+ if (this.hasValue === false) {
+ this.destination.next(this.acc);
+ }
+ this.destination.complete();
+ }
+ };
+ return MergeScanSubscriber;
+}(OuterSubscriber_1.OuterSubscriber));
+exports.MergeScanSubscriber = MergeScanSubscriber;
+
+},{"../InnerSubscriber":46,"../OuterSubscriber":50,"../util/subscribeToResult":239}],134:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var reduce_1 = require("./reduce");
+function min(comparer) {
+ var min = (typeof comparer === 'function')
+ ? function (x, y) { return comparer(x, y) < 0 ? x : y; }
+ : function (x, y) { return x < y ? x : y; };
+ return reduce_1.reduce(min);
+}
+exports.min = min;
+
+},{"./reduce":146}],135:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var ConnectableObservable_1 = require("../observable/ConnectableObservable");
+function multicast(subjectOrSubjectFactory, selector) {
+ return function multicastOperatorFunction(source) {
+ var subjectFactory;
+ if (typeof subjectOrSubjectFactory === 'function') {
+ subjectFactory = subjectOrSubjectFactory;
+ }
+ else {
+ subjectFactory = function subjectFactory() {
+ return subjectOrSubjectFactory;
+ };
+ }
+ if (typeof selector === 'function') {
+ return source.lift(new MulticastOperator(subjectFactory, selector));
+ }
+ var connectable = Object.create(source, ConnectableObservable_1.connectableObservableDescriptor);
+ connectable.source = source;
+ connectable.subjectFactory = subjectFactory;
+ return connectable;
+ };
+}
+exports.multicast = multicast;
+var MulticastOperator = (function () {
+ function MulticastOperator(subjectFactory, selector) {
+ this.subjectFactory = subjectFactory;
+ this.selector = selector;
+ }
+ MulticastOperator.prototype.call = function (subscriber, source) {
+ var selector = this.selector;
+ var subject = this.subjectFactory();
+ var subscription = selector(subject).subscribe(subscriber);
+ subscription.add(source.subscribe(subject));
+ return subscription;
+ };
+ return MulticastOperator;
+}());
+exports.MulticastOperator = MulticastOperator;
+
+},{"../observable/ConnectableObservable":58}],136:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var Subscriber_1 = require("../Subscriber");
+var Notification_1 = require("../Notification");
+function observeOn(scheduler, delay) {
+ if (delay === void 0) { delay = 0; }
+ return function observeOnOperatorFunction(source) {
+ return source.lift(new ObserveOnOperator(scheduler, delay));
+ };
+}
+exports.observeOn = observeOn;
+var ObserveOnOperator = (function () {
+ function ObserveOnOperator(scheduler, delay) {
+ if (delay === void 0) { delay = 0; }
+ this.scheduler = scheduler;
+ this.delay = delay;
+ }
+ ObserveOnOperator.prototype.call = function (subscriber, source) {
+ return source.subscribe(new ObserveOnSubscriber(subscriber, this.scheduler, this.delay));
+ };
+ return ObserveOnOperator;
+}());
+exports.ObserveOnOperator = ObserveOnOperator;
+var ObserveOnSubscriber = (function (_super) {
+ __extends(ObserveOnSubscriber, _super);
+ function ObserveOnSubscriber(destination, scheduler, delay) {
+ if (delay === void 0) { delay = 0; }
+ var _this = _super.call(this, destination) || this;
+ _this.scheduler = scheduler;
+ _this.delay = delay;
+ return _this;
+ }
+ ObserveOnSubscriber.dispatch = function (arg) {
+ var notification = arg.notification, destination = arg.destination;
+ notification.observe(destination);
+ this.unsubscribe();
+ };
+ ObserveOnSubscriber.prototype.scheduleMessage = function (notification) {
+ var destination = this.destination;
+ destination.add(this.scheduler.schedule(ObserveOnSubscriber.dispatch, this.delay, new ObserveOnMessage(notification, this.destination)));
+ };
+ ObserveOnSubscriber.prototype._next = function (value) {
+ this.scheduleMessage(Notification_1.Notification.createNext(value));
+ };
+ ObserveOnSubscriber.prototype._error = function (err) {
+ this.scheduleMessage(Notification_1.Notification.createError(err));
+ this.unsubscribe();
+ };
+ ObserveOnSubscriber.prototype._complete = function () {
+ this.scheduleMessage(Notification_1.Notification.createComplete());
+ this.unsubscribe();
+ };
+ return ObserveOnSubscriber;
+}(Subscriber_1.Subscriber));
+exports.ObserveOnSubscriber = ObserveOnSubscriber;
+var ObserveOnMessage = (function () {
+ function ObserveOnMessage(notification, destination) {
+ this.notification = notification;
+ this.destination = destination;
+ }
+ return ObserveOnMessage;
+}());
+exports.ObserveOnMessage = ObserveOnMessage;
+
+},{"../Notification":47,"../Subscriber":55}],137:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var from_1 = require("../observable/from");
+var isArray_1 = require("../util/isArray");
+var OuterSubscriber_1 = require("../OuterSubscriber");
+var InnerSubscriber_1 = require("../InnerSubscriber");
+var subscribeToResult_1 = require("../util/subscribeToResult");
+function onErrorResumeNext() {
+ var nextSources = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ nextSources[_i] = arguments[_i];
+ }
+ if (nextSources.length === 1 && isArray_1.isArray(nextSources[0])) {
+ nextSources = nextSources[0];
+ }
+ return function (source) { return source.lift(new OnErrorResumeNextOperator(nextSources)); };
+}
+exports.onErrorResumeNext = onErrorResumeNext;
+function onErrorResumeNextStatic() {
+ var nextSources = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ nextSources[_i] = arguments[_i];
+ }
+ var source = null;
+ if (nextSources.length === 1 && isArray_1.isArray(nextSources[0])) {
+ nextSources = nextSources[0];
+ }
+ source = nextSources.shift();
+ return from_1.from(source, null).lift(new OnErrorResumeNextOperator(nextSources));
+}
+exports.onErrorResumeNextStatic = onErrorResumeNextStatic;
+var OnErrorResumeNextOperator = (function () {
+ function OnErrorResumeNextOperator(nextSources) {
+ this.nextSources = nextSources;
+ }
+ OnErrorResumeNextOperator.prototype.call = function (subscriber, source) {
+ return source.subscribe(new OnErrorResumeNextSubscriber(subscriber, this.nextSources));
+ };
+ return OnErrorResumeNextOperator;
+}());
+var OnErrorResumeNextSubscriber = (function (_super) {
+ __extends(OnErrorResumeNextSubscriber, _super);
+ function OnErrorResumeNextSubscriber(destination, nextSources) {
+ var _this = _super.call(this, destination) || this;
+ _this.destination = destination;
+ _this.nextSources = nextSources;
+ return _this;
+ }
+ OnErrorResumeNextSubscriber.prototype.notifyError = function (error, innerSub) {
+ this.subscribeToNextSource();
+ };
+ OnErrorResumeNextSubscriber.prototype.notifyComplete = function (innerSub) {
+ this.subscribeToNextSource();
+ };
+ OnErrorResumeNextSubscriber.prototype._error = function (err) {
+ this.subscribeToNextSource();
+ this.unsubscribe();
+ };
+ OnErrorResumeNextSubscriber.prototype._complete = function () {
+ this.subscribeToNextSource();
+ this.unsubscribe();
+ };
+ OnErrorResumeNextSubscriber.prototype.subscribeToNextSource = function () {
+ var next = this.nextSources.shift();
+ if (!!next) {
+ var innerSubscriber = new InnerSubscriber_1.InnerSubscriber(this, undefined, undefined);
+ var destination = this.destination;
+ destination.add(innerSubscriber);
+ var innerSubscription = subscribeToResult_1.subscribeToResult(this, next, undefined, undefined, innerSubscriber);
+ if (innerSubscription !== innerSubscriber) {
+ destination.add(innerSubscription);
+ }
+ }
+ else {
+ this.destination.complete();
+ }
+ };
+ return OnErrorResumeNextSubscriber;
+}(OuterSubscriber_1.OuterSubscriber));
+
+},{"../InnerSubscriber":46,"../OuterSubscriber":50,"../observable/from":67,"../util/isArray":220,"../util/subscribeToResult":239}],138:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var Subscriber_1 = require("../Subscriber");
+function pairwise() {
+ return function (source) { return source.lift(new PairwiseOperator()); };
+}
+exports.pairwise = pairwise;
+var PairwiseOperator = (function () {
+ function PairwiseOperator() {
+ }
+ PairwiseOperator.prototype.call = function (subscriber, source) {
+ return source.subscribe(new PairwiseSubscriber(subscriber));
+ };
+ return PairwiseOperator;
+}());
+var PairwiseSubscriber = (function (_super) {
+ __extends(PairwiseSubscriber, _super);
+ function PairwiseSubscriber(destination) {
+ var _this = _super.call(this, destination) || this;
+ _this.hasPrev = false;
+ return _this;
+ }
+ PairwiseSubscriber.prototype._next = function (value) {
+ var pair;
+ if (this.hasPrev) {
+ pair = [this.prev, value];
+ }
+ else {
+ this.hasPrev = true;
+ }
+ this.prev = value;
+ if (pair) {
+ this.destination.next(pair);
+ }
+ };
+ return PairwiseSubscriber;
+}(Subscriber_1.Subscriber));
+
+},{"../Subscriber":55}],139:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var not_1 = require("../util/not");
+var filter_1 = require("./filter");
+function partition(predicate, thisArg) {
+ return function (source) { return [
+ filter_1.filter(predicate, thisArg)(source),
+ filter_1.filter(not_1.not(predicate, thisArg))(source)
+ ]; };
+}
+exports.partition = partition;
+
+},{"../util/not":232,"./filter":116}],140:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var map_1 = require("./map");
+function pluck() {
+ var properties = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ properties[_i] = arguments[_i];
+ }
+ var length = properties.length;
+ if (length === 0) {
+ throw new Error('list of properties cannot be empty.');
+ }
+ return function (source) { return map_1.map(plucker(properties, length))(source); };
+}
+exports.pluck = pluck;
+function plucker(props, length) {
+ var mapper = function (x) {
+ var currentProp = x;
+ for (var i = 0; i < length; i++) {
+ var p = currentProp[props[i]];
+ if (typeof p !== 'undefined') {
+ currentProp = p;
+ }
+ else {
+ return undefined;
+ }
+ }
+ return currentProp;
+ };
+ return mapper;
+}
+
+},{"./map":125}],141:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var Subject_1 = require("../Subject");
+var multicast_1 = require("./multicast");
+function publish(selector) {
+ return selector ?
+ multicast_1.multicast(function () { return new Subject_1.Subject(); }, selector) :
+ multicast_1.multicast(new Subject_1.Subject());
+}
+exports.publish = publish;
+
+},{"../Subject":53,"./multicast":135}],142:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var BehaviorSubject_1 = require("../BehaviorSubject");
+var multicast_1 = require("./multicast");
+function publishBehavior(value) {
+ return function (source) { return multicast_1.multicast(new BehaviorSubject_1.BehaviorSubject(value))(source); };
+}
+exports.publishBehavior = publishBehavior;
+
+},{"../BehaviorSubject":45,"./multicast":135}],143:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var AsyncSubject_1 = require("../AsyncSubject");
+var multicast_1 = require("./multicast");
+function publishLast() {
+ return function (source) { return multicast_1.multicast(new AsyncSubject_1.AsyncSubject())(source); };
+}
+exports.publishLast = publishLast;
+
+},{"../AsyncSubject":44,"./multicast":135}],144:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var ReplaySubject_1 = require("../ReplaySubject");
+var multicast_1 = require("./multicast");
+function publishReplay(bufferSize, windowTime, selectorOrScheduler, scheduler) {
+ if (selectorOrScheduler && typeof selectorOrScheduler !== 'function') {
+ scheduler = selectorOrScheduler;
+ }
+ var selector = typeof selectorOrScheduler === 'function' ? selectorOrScheduler : undefined;
+ var subject = new ReplaySubject_1.ReplaySubject(bufferSize, windowTime, scheduler);
+ return function (source) { return multicast_1.multicast(function () { return subject; }, selector)(source); };
+}
+exports.publishReplay = publishReplay;
+
+},{"../ReplaySubject":51,"./multicast":135}],145:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var isArray_1 = require("../util/isArray");
+var race_1 = require("../observable/race");
+function race() {
+ var observables = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ observables[_i] = arguments[_i];
+ }
+ return function raceOperatorFunction(source) {
+ if (observables.length === 1 && isArray_1.isArray(observables[0])) {
+ observables = observables[0];
+ }
+ return source.lift.call(race_1.race.apply(void 0, [source].concat(observables)));
+ };
+}
+exports.race = race;
+
+},{"../observable/race":80,"../util/isArray":220}],146:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var scan_1 = require("./scan");
+var takeLast_1 = require("./takeLast");
+var defaultIfEmpty_1 = require("./defaultIfEmpty");
+var pipe_1 = require("../util/pipe");
+function reduce(accumulator, seed) {
+ if (arguments.length >= 2) {
+ return function reduceOperatorFunctionWithSeed(source) {
+ return pipe_1.pipe(scan_1.scan(accumulator, seed), takeLast_1.takeLast(1), defaultIfEmpty_1.defaultIfEmpty(seed))(source);
+ };
+ }
+ return function reduceOperatorFunction(source) {
+ return pipe_1.pipe(scan_1.scan(function (acc, value, index) { return accumulator(acc, value, index + 1); }), takeLast_1.takeLast(1))(source);
+ };
+}
+exports.reduce = reduce;
+
+},{"../util/pipe":233,"./defaultIfEmpty":103,"./scan":154,"./takeLast":169}],147:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var Subscriber_1 = require("../Subscriber");
+function refCount() {
+ return function refCountOperatorFunction(source) {
+ return source.lift(new RefCountOperator(source));
+ };
+}
+exports.refCount = refCount;
+var RefCountOperator = (function () {
+ function RefCountOperator(connectable) {
+ this.connectable = connectable;
+ }
+ RefCountOperator.prototype.call = function (subscriber, source) {
+ var connectable = this.connectable;
+ connectable._refCount++;
+ var refCounter = new RefCountSubscriber(subscriber, connectable);
+ var subscription = source.subscribe(refCounter);
+ if (!refCounter.closed) {
+ refCounter.connection = connectable.connect();
+ }
+ return subscription;
+ };
+ return RefCountOperator;
+}());
+var RefCountSubscriber = (function (_super) {
+ __extends(RefCountSubscriber, _super);
+ function RefCountSubscriber(destination, connectable) {
+ var _this = _super.call(this, destination) || this;
+ _this.connectable = connectable;
+ return _this;
+ }
+ RefCountSubscriber.prototype._unsubscribe = function () {
+ var connectable = this.connectable;
+ if (!connectable) {
+ this.connection = null;
+ return;
+ }
+ this.connectable = null;
+ var refCount = connectable._refCount;
+ if (refCount <= 0) {
+ this.connection = null;
+ return;
+ }
+ connectable._refCount = refCount - 1;
+ if (refCount > 1) {
+ this.connection = null;
+ return;
+ }
+ var connection = this.connection;
+ var sharedConnection = connectable._connection;
+ this.connection = null;
+ if (sharedConnection && (!connection || sharedConnection === connection)) {
+ sharedConnection.unsubscribe();
+ }
+ };
+ return RefCountSubscriber;
+}(Subscriber_1.Subscriber));
+
+},{"../Subscriber":55}],148:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var Subscriber_1 = require("../Subscriber");
+var empty_1 = require("../observable/empty");
+function repeat(count) {
+ if (count === void 0) { count = -1; }
+ return function (source) {
+ if (count === 0) {
+ return empty_1.empty();
+ }
+ else if (count < 0) {
+ return source.lift(new RepeatOperator(-1, source));
+ }
+ else {
+ return source.lift(new RepeatOperator(count - 1, source));
+ }
+ };
+}
+exports.repeat = repeat;
+var RepeatOperator = (function () {
+ function RepeatOperator(count, source) {
+ this.count = count;
+ this.source = source;
+ }
+ RepeatOperator.prototype.call = function (subscriber, source) {
+ return source.subscribe(new RepeatSubscriber(subscriber, this.count, this.source));
+ };
+ return RepeatOperator;
+}());
+var RepeatSubscriber = (function (_super) {
+ __extends(RepeatSubscriber, _super);
+ function RepeatSubscriber(destination, count, source) {
+ var _this = _super.call(this, destination) || this;
+ _this.count = count;
+ _this.source = source;
+ return _this;
+ }
+ RepeatSubscriber.prototype.complete = function () {
+ if (!this.isStopped) {
+ var _a = this, source = _a.source, count = _a.count;
+ if (count === 0) {
+ return _super.prototype.complete.call(this);
+ }
+ else if (count > -1) {
+ this.count = count - 1;
+ }
+ source.subscribe(this._unsubscribeAndRecycle());
+ }
+ };
+ return RepeatSubscriber;
+}(Subscriber_1.Subscriber));
+
+},{"../Subscriber":55,"../observable/empty":65}],149:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var Subject_1 = require("../Subject");
+var OuterSubscriber_1 = require("../OuterSubscriber");
+var subscribeToResult_1 = require("../util/subscribeToResult");
+function repeatWhen(notifier) {
+ return function (source) { return source.lift(new RepeatWhenOperator(notifier)); };
+}
+exports.repeatWhen = repeatWhen;
+var RepeatWhenOperator = (function () {
+ function RepeatWhenOperator(notifier) {
+ this.notifier = notifier;
+ }
+ RepeatWhenOperator.prototype.call = function (subscriber, source) {
+ return source.subscribe(new RepeatWhenSubscriber(subscriber, this.notifier, source));
+ };
+ return RepeatWhenOperator;
+}());
+var RepeatWhenSubscriber = (function (_super) {
+ __extends(RepeatWhenSubscriber, _super);
+ function RepeatWhenSubscriber(destination, notifier, source) {
+ var _this = _super.call(this, destination) || this;
+ _this.notifier = notifier;
+ _this.source = source;
+ _this.sourceIsBeingSubscribedTo = true;
+ return _this;
+ }
+ RepeatWhenSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
+ this.sourceIsBeingSubscribedTo = true;
+ this.source.subscribe(this);
+ };
+ RepeatWhenSubscriber.prototype.notifyComplete = function (innerSub) {
+ if (this.sourceIsBeingSubscribedTo === false) {
+ return _super.prototype.complete.call(this);
+ }
+ };
+ RepeatWhenSubscriber.prototype.complete = function () {
+ this.sourceIsBeingSubscribedTo = false;
+ if (!this.isStopped) {
+ if (!this.retries) {
+ this.subscribeToRetries();
+ }
+ if (!this.retriesSubscription || this.retriesSubscription.closed) {
+ return _super.prototype.complete.call(this);
+ }
+ this._unsubscribeAndRecycle();
+ this.notifications.next();
+ }
+ };
+ RepeatWhenSubscriber.prototype._unsubscribe = function () {
+ var _a = this, notifications = _a.notifications, retriesSubscription = _a.retriesSubscription;
+ if (notifications) {
+ notifications.unsubscribe();
+ this.notifications = null;
+ }
+ if (retriesSubscription) {
+ retriesSubscription.unsubscribe();
+ this.retriesSubscription = null;
+ }
+ this.retries = null;
+ };
+ RepeatWhenSubscriber.prototype._unsubscribeAndRecycle = function () {
+ var _unsubscribe = this._unsubscribe;
+ this._unsubscribe = null;
+ _super.prototype._unsubscribeAndRecycle.call(this);
+ this._unsubscribe = _unsubscribe;
+ return this;
+ };
+ RepeatWhenSubscriber.prototype.subscribeToRetries = function () {
+ this.notifications = new Subject_1.Subject();
+ var retries;
+ try {
+ var notifier = this.notifier;
+ retries = notifier(this.notifications);
+ }
+ catch (e) {
+ return _super.prototype.complete.call(this);
+ }
+ this.retries = retries;
+ this.retriesSubscription = subscribeToResult_1.subscribeToResult(this, retries);
+ };
+ return RepeatWhenSubscriber;
+}(OuterSubscriber_1.OuterSubscriber));
+
+},{"../OuterSubscriber":50,"../Subject":53,"../util/subscribeToResult":239}],150:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var Subscriber_1 = require("../Subscriber");
+function retry(count) {
+ if (count === void 0) { count = -1; }
+ return function (source) { return source.lift(new RetryOperator(count, source)); };
+}
+exports.retry = retry;
+var RetryOperator = (function () {
+ function RetryOperator(count, source) {
+ this.count = count;
+ this.source = source;
+ }
+ RetryOperator.prototype.call = function (subscriber, source) {
+ return source.subscribe(new RetrySubscriber(subscriber, this.count, this.source));
+ };
+ return RetryOperator;
+}());
+var RetrySubscriber = (function (_super) {
+ __extends(RetrySubscriber, _super);
+ function RetrySubscriber(destination, count, source) {
+ var _this = _super.call(this, destination) || this;
+ _this.count = count;
+ _this.source = source;
+ return _this;
+ }
+ RetrySubscriber.prototype.error = function (err) {
+ if (!this.isStopped) {
+ var _a = this, source = _a.source, count = _a.count;
+ if (count === 0) {
+ return _super.prototype.error.call(this, err);
+ }
+ else if (count > -1) {
+ this.count = count - 1;
+ }
+ source.subscribe(this._unsubscribeAndRecycle());
+ }
+ };
+ return RetrySubscriber;
+}(Subscriber_1.Subscriber));
+
+},{"../Subscriber":55}],151:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var Subject_1 = require("../Subject");
+var OuterSubscriber_1 = require("../OuterSubscriber");
+var subscribeToResult_1 = require("../util/subscribeToResult");
+function retryWhen(notifier) {
+ return function (source) { return source.lift(new RetryWhenOperator(notifier, source)); };
+}
+exports.retryWhen = retryWhen;
+var RetryWhenOperator = (function () {
+ function RetryWhenOperator(notifier, source) {
+ this.notifier = notifier;
+ this.source = source;
+ }
+ RetryWhenOperator.prototype.call = function (subscriber, source) {
+ return source.subscribe(new RetryWhenSubscriber(subscriber, this.notifier, this.source));
+ };
+ return RetryWhenOperator;
+}());
+var RetryWhenSubscriber = (function (_super) {
+ __extends(RetryWhenSubscriber, _super);
+ function RetryWhenSubscriber(destination, notifier, source) {
+ var _this = _super.call(this, destination) || this;
+ _this.notifier = notifier;
+ _this.source = source;
+ return _this;
+ }
+ RetryWhenSubscriber.prototype.error = function (err) {
+ if (!this.isStopped) {
+ var errors = this.errors;
+ var retries = this.retries;
+ var retriesSubscription = this.retriesSubscription;
+ if (!retries) {
+ errors = new Subject_1.Subject();
+ try {
+ var notifier = this.notifier;
+ retries = notifier(errors);
+ }
+ catch (e) {
+ return _super.prototype.error.call(this, e);
+ }
+ retriesSubscription = subscribeToResult_1.subscribeToResult(this, retries);
+ }
+ else {
+ this.errors = null;
+ this.retriesSubscription = null;
+ }
+ this._unsubscribeAndRecycle();
+ this.errors = errors;
+ this.retries = retries;
+ this.retriesSubscription = retriesSubscription;
+ errors.next(err);
+ }
+ };
+ RetryWhenSubscriber.prototype._unsubscribe = function () {
+ var _a = this, errors = _a.errors, retriesSubscription = _a.retriesSubscription;
+ if (errors) {
+ errors.unsubscribe();
+ this.errors = null;
+ }
+ if (retriesSubscription) {
+ retriesSubscription.unsubscribe();
+ this.retriesSubscription = null;
+ }
+ this.retries = null;
+ };
+ RetryWhenSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
+ var _unsubscribe = this._unsubscribe;
+ this._unsubscribe = null;
+ this._unsubscribeAndRecycle();
+ this._unsubscribe = _unsubscribe;
+ this.source.subscribe(this);
+ };
+ return RetryWhenSubscriber;
+}(OuterSubscriber_1.OuterSubscriber));
+
+},{"../OuterSubscriber":50,"../Subject":53,"../util/subscribeToResult":239}],152:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var OuterSubscriber_1 = require("../OuterSubscriber");
+var subscribeToResult_1 = require("../util/subscribeToResult");
+function sample(notifier) {
+ return function (source) { return source.lift(new SampleOperator(notifier)); };
+}
+exports.sample = sample;
+var SampleOperator = (function () {
+ function SampleOperator(notifier) {
+ this.notifier = notifier;
+ }
+ SampleOperator.prototype.call = function (subscriber, source) {
+ var sampleSubscriber = new SampleSubscriber(subscriber);
+ var subscription = source.subscribe(sampleSubscriber);
+ subscription.add(subscribeToResult_1.subscribeToResult(sampleSubscriber, this.notifier));
+ return subscription;
+ };
+ return SampleOperator;
+}());
+var SampleSubscriber = (function (_super) {
+ __extends(SampleSubscriber, _super);
+ function SampleSubscriber() {
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this.hasValue = false;
+ return _this;
+ }
+ SampleSubscriber.prototype._next = function (value) {
+ this.value = value;
+ this.hasValue = true;
+ };
+ SampleSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
+ this.emitValue();
+ };
+ SampleSubscriber.prototype.notifyComplete = function () {
+ this.emitValue();
+ };
+ SampleSubscriber.prototype.emitValue = function () {
+ if (this.hasValue) {
+ this.hasValue = false;
+ this.destination.next(this.value);
+ }
+ };
+ return SampleSubscriber;
+}(OuterSubscriber_1.OuterSubscriber));
+
+},{"../OuterSubscriber":50,"../util/subscribeToResult":239}],153:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var Subscriber_1 = require("../Subscriber");
+var async_1 = require("../scheduler/async");
+function sampleTime(period, scheduler) {
+ if (scheduler === void 0) { scheduler = async_1.async; }
+ return function (source) { return source.lift(new SampleTimeOperator(period, scheduler)); };
+}
+exports.sampleTime = sampleTime;
+var SampleTimeOperator = (function () {
+ function SampleTimeOperator(period, scheduler) {
+ this.period = period;
+ this.scheduler = scheduler;
+ }
+ SampleTimeOperator.prototype.call = function (subscriber, source) {
+ return source.subscribe(new SampleTimeSubscriber(subscriber, this.period, this.scheduler));
+ };
+ return SampleTimeOperator;
+}());
+var SampleTimeSubscriber = (function (_super) {
+ __extends(SampleTimeSubscriber, _super);
+ function SampleTimeSubscriber(destination, period, scheduler) {
+ var _this = _super.call(this, destination) || this;
+ _this.period = period;
+ _this.scheduler = scheduler;
+ _this.hasValue = false;
+ _this.add(scheduler.schedule(dispatchNotification, period, { subscriber: _this, period: period }));
+ return _this;
+ }
+ SampleTimeSubscriber.prototype._next = function (value) {
+ this.lastValue = value;
+ this.hasValue = true;
+ };
+ SampleTimeSubscriber.prototype.notifyNext = function () {
+ if (this.hasValue) {
+ this.hasValue = false;
+ this.destination.next(this.lastValue);
+ }
+ };
+ return SampleTimeSubscriber;
+}(Subscriber_1.Subscriber));
+function dispatchNotification(state) {
+ var subscriber = state.subscriber, period = state.period;
+ subscriber.notifyNext();
+ this.schedule(state, period);
+}
+
+},{"../Subscriber":55,"../scheduler/async":206}],154:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var Subscriber_1 = require("../Subscriber");
+function scan(accumulator, seed) {
+ var hasSeed = false;
+ if (arguments.length >= 2) {
+ hasSeed = true;
+ }
+ return function scanOperatorFunction(source) {
+ return source.lift(new ScanOperator(accumulator, seed, hasSeed));
+ };
+}
+exports.scan = scan;
+var ScanOperator = (function () {
+ function ScanOperator(accumulator, seed, hasSeed) {
+ if (hasSeed === void 0) { hasSeed = false; }
+ this.accumulator = accumulator;
+ this.seed = seed;
+ this.hasSeed = hasSeed;
+ }
+ ScanOperator.prototype.call = function (subscriber, source) {
+ return source.subscribe(new ScanSubscriber(subscriber, this.accumulator, this.seed, this.hasSeed));
+ };
+ return ScanOperator;
+}());
+var ScanSubscriber = (function (_super) {
+ __extends(ScanSubscriber, _super);
+ function ScanSubscriber(destination, accumulator, _seed, hasSeed) {
+ var _this = _super.call(this, destination) || this;
+ _this.accumulator = accumulator;
+ _this._seed = _seed;
+ _this.hasSeed = hasSeed;
+ _this.index = 0;
+ return _this;
+ }
+ Object.defineProperty(ScanSubscriber.prototype, "seed", {
+ get: function () {
+ return this._seed;
+ },
+ set: function (value) {
+ this.hasSeed = true;
+ this._seed = value;
+ },
+ enumerable: true,
+ configurable: true
+ });
+ ScanSubscriber.prototype._next = function (value) {
+ if (!this.hasSeed) {
+ this.seed = value;
+ this.destination.next(value);
+ }
+ else {
+ return this._tryNext(value);
+ }
+ };
+ ScanSubscriber.prototype._tryNext = function (value) {
+ var index = this.index++;
+ var result;
+ try {
+ result = this.accumulator(this.seed, value, index);
+ }
+ catch (err) {
+ this.destination.error(err);
+ }
+ this.seed = result;
+ this.destination.next(result);
+ };
+ return ScanSubscriber;
+}(Subscriber_1.Subscriber));
+
+},{"../Subscriber":55}],155:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var Subscriber_1 = require("../Subscriber");
+function sequenceEqual(compareTo, comparator) {
+ return function (source) { return source.lift(new SequenceEqualOperator(compareTo, comparator)); };
+}
+exports.sequenceEqual = sequenceEqual;
+var SequenceEqualOperator = (function () {
+ function SequenceEqualOperator(compareTo, comparator) {
+ this.compareTo = compareTo;
+ this.comparator = comparator;
+ }
+ SequenceEqualOperator.prototype.call = function (subscriber, source) {
+ return source.subscribe(new SequenceEqualSubscriber(subscriber, this.compareTo, this.comparator));
+ };
+ return SequenceEqualOperator;
+}());
+exports.SequenceEqualOperator = SequenceEqualOperator;
+var SequenceEqualSubscriber = (function (_super) {
+ __extends(SequenceEqualSubscriber, _super);
+ function SequenceEqualSubscriber(destination, compareTo, comparator) {
+ var _this = _super.call(this, destination) || this;
+ _this.compareTo = compareTo;
+ _this.comparator = comparator;
+ _this._a = [];
+ _this._b = [];
+ _this._oneComplete = false;
+ _this.destination.add(compareTo.subscribe(new SequenceEqualCompareToSubscriber(destination, _this)));
+ return _this;
+ }
+ SequenceEqualSubscriber.prototype._next = function (value) {
+ if (this._oneComplete && this._b.length === 0) {
+ this.emit(false);
+ }
+ else {
+ this._a.push(value);
+ this.checkValues();
+ }
+ };
+ SequenceEqualSubscriber.prototype._complete = function () {
+ if (this._oneComplete) {
+ this.emit(this._a.length === 0 && this._b.length === 0);
+ }
+ else {
+ this._oneComplete = true;
+ }
+ this.unsubscribe();
+ };
+ SequenceEqualSubscriber.prototype.checkValues = function () {
+ var _c = this, _a = _c._a, _b = _c._b, comparator = _c.comparator;
+ while (_a.length > 0 && _b.length > 0) {
+ var a = _a.shift();
+ var b = _b.shift();
+ var areEqual = false;
+ try {
+ areEqual = comparator ? comparator(a, b) : a === b;
+ }
+ catch (e) {
+ this.destination.error(e);
+ }
+ if (!areEqual) {
+ this.emit(false);
+ }
+ }
+ };
+ SequenceEqualSubscriber.prototype.emit = function (value) {
+ var destination = this.destination;
+ destination.next(value);
+ destination.complete();
+ };
+ SequenceEqualSubscriber.prototype.nextB = function (value) {
+ if (this._oneComplete && this._a.length === 0) {
+ this.emit(false);
+ }
+ else {
+ this._b.push(value);
+ this.checkValues();
+ }
+ };
+ SequenceEqualSubscriber.prototype.completeB = function () {
+ if (this._oneComplete) {
+ this.emit(this._a.length === 0 && this._b.length === 0);
+ }
+ else {
+ this._oneComplete = true;
+ }
+ };
+ return SequenceEqualSubscriber;
+}(Subscriber_1.Subscriber));
+exports.SequenceEqualSubscriber = SequenceEqualSubscriber;
+var SequenceEqualCompareToSubscriber = (function (_super) {
+ __extends(SequenceEqualCompareToSubscriber, _super);
+ function SequenceEqualCompareToSubscriber(destination, parent) {
+ var _this = _super.call(this, destination) || this;
+ _this.parent = parent;
+ return _this;
+ }
+ SequenceEqualCompareToSubscriber.prototype._next = function (value) {
+ this.parent.nextB(value);
+ };
+ SequenceEqualCompareToSubscriber.prototype._error = function (err) {
+ this.parent.error(err);
+ this.unsubscribe();
+ };
+ SequenceEqualCompareToSubscriber.prototype._complete = function () {
+ this.parent.completeB();
+ this.unsubscribe();
+ };
+ return SequenceEqualCompareToSubscriber;
+}(Subscriber_1.Subscriber));
+
+},{"../Subscriber":55}],156:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var multicast_1 = require("./multicast");
+var refCount_1 = require("./refCount");
+var Subject_1 = require("../Subject");
+function shareSubjectFactory() {
+ return new Subject_1.Subject();
+}
+function share() {
+ return function (source) { return refCount_1.refCount()(multicast_1.multicast(shareSubjectFactory)(source)); };
+}
+exports.share = share;
+
+},{"../Subject":53,"./multicast":135,"./refCount":147}],157:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var ReplaySubject_1 = require("../ReplaySubject");
+function shareReplay(configOrBufferSize, windowTime, scheduler) {
+ var config;
+ if (configOrBufferSize && typeof configOrBufferSize === 'object') {
+ config = configOrBufferSize;
+ }
+ else {
+ config = {
+ bufferSize: configOrBufferSize,
+ windowTime: windowTime,
+ refCount: false,
+ scheduler: scheduler
+ };
+ }
+ return function (source) { return source.lift(shareReplayOperator(config)); };
+}
+exports.shareReplay = shareReplay;
+function shareReplayOperator(_a) {
+ var _b = _a.bufferSize, bufferSize = _b === void 0 ? Number.POSITIVE_INFINITY : _b, _c = _a.windowTime, windowTime = _c === void 0 ? Number.POSITIVE_INFINITY : _c, useRefCount = _a.refCount, scheduler = _a.scheduler;
+ var subject;
+ var refCount = 0;
+ var subscription;
+ var hasError = false;
+ var isComplete = false;
+ return function shareReplayOperation(source) {
+ refCount++;
+ if (!subject || hasError) {
+ hasError = false;
+ subject = new ReplaySubject_1.ReplaySubject(bufferSize, windowTime, scheduler);
+ subscription = source.subscribe({
+ next: function (value) { subject.next(value); },
+ error: function (err) {
+ hasError = true;
+ subject.error(err);
+ },
+ complete: function () {
+ isComplete = true;
+ subscription = undefined;
+ subject.complete();
+ },
+ });
+ }
+ var innerSub = subject.subscribe(this);
+ this.add(function () {
+ refCount--;
+ innerSub.unsubscribe();
+ if (subscription && !isComplete && useRefCount && refCount === 0) {
+ subscription.unsubscribe();
+ subscription = undefined;
+ subject = undefined;
+ }
+ });
+ };
+}
+
+},{"../ReplaySubject":51}],158:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var Subscriber_1 = require("../Subscriber");
+var EmptyError_1 = require("../util/EmptyError");
+function single(predicate) {
+ return function (source) { return source.lift(new SingleOperator(predicate, source)); };
+}
+exports.single = single;
+var SingleOperator = (function () {
+ function SingleOperator(predicate, source) {
+ this.predicate = predicate;
+ this.source = source;
+ }
+ SingleOperator.prototype.call = function (subscriber, source) {
+ return source.subscribe(new SingleSubscriber(subscriber, this.predicate, this.source));
+ };
+ return SingleOperator;
+}());
+var SingleSubscriber = (function (_super) {
+ __extends(SingleSubscriber, _super);
+ function SingleSubscriber(destination, predicate, source) {
+ var _this = _super.call(this, destination) || this;
+ _this.predicate = predicate;
+ _this.source = source;
+ _this.seenValue = false;
+ _this.index = 0;
+ return _this;
+ }
+ SingleSubscriber.prototype.applySingleValue = function (value) {
+ if (this.seenValue) {
+ this.destination.error('Sequence contains more than one element');
+ }
+ else {
+ this.seenValue = true;
+ this.singleValue = value;
+ }
+ };
+ SingleSubscriber.prototype._next = function (value) {
+ var index = this.index++;
+ if (this.predicate) {
+ this.tryNext(value, index);
+ }
+ else {
+ this.applySingleValue(value);
+ }
+ };
+ SingleSubscriber.prototype.tryNext = function (value, index) {
+ try {
+ if (this.predicate(value, index, this.source)) {
+ this.applySingleValue(value);
+ }
+ }
+ catch (err) {
+ this.destination.error(err);
+ }
+ };
+ SingleSubscriber.prototype._complete = function () {
+ var destination = this.destination;
+ if (this.index > 0) {
+ destination.next(this.seenValue ? this.singleValue : undefined);
+ destination.complete();
+ }
+ else {
+ destination.error(new EmptyError_1.EmptyError);
+ }
+ };
+ return SingleSubscriber;
+}(Subscriber_1.Subscriber));
+
+},{"../Subscriber":55,"../util/EmptyError":212}],159:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var Subscriber_1 = require("../Subscriber");
+function skip(count) {
+ return function (source) { return source.lift(new SkipOperator(count)); };
+}
+exports.skip = skip;
+var SkipOperator = (function () {
+ function SkipOperator(total) {
+ this.total = total;
+ }
+ SkipOperator.prototype.call = function (subscriber, source) {
+ return source.subscribe(new SkipSubscriber(subscriber, this.total));
+ };
+ return SkipOperator;
+}());
+var SkipSubscriber = (function (_super) {
+ __extends(SkipSubscriber, _super);
+ function SkipSubscriber(destination, total) {
+ var _this = _super.call(this, destination) || this;
+ _this.total = total;
+ _this.count = 0;
+ return _this;
+ }
+ SkipSubscriber.prototype._next = function (x) {
+ if (++this.count > this.total) {
+ this.destination.next(x);
+ }
+ };
+ return SkipSubscriber;
+}(Subscriber_1.Subscriber));
+
+},{"../Subscriber":55}],160:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var Subscriber_1 = require("../Subscriber");
+var ArgumentOutOfRangeError_1 = require("../util/ArgumentOutOfRangeError");
+function skipLast(count) {
+ return function (source) { return source.lift(new SkipLastOperator(count)); };
+}
+exports.skipLast = skipLast;
+var SkipLastOperator = (function () {
+ function SkipLastOperator(_skipCount) {
+ this._skipCount = _skipCount;
+ if (this._skipCount < 0) {
+ throw new ArgumentOutOfRangeError_1.ArgumentOutOfRangeError;
+ }
+ }
+ SkipLastOperator.prototype.call = function (subscriber, source) {
+ if (this._skipCount === 0) {
+ return source.subscribe(new Subscriber_1.Subscriber(subscriber));
+ }
+ else {
+ return source.subscribe(new SkipLastSubscriber(subscriber, this._skipCount));
+ }
+ };
+ return SkipLastOperator;
+}());
+var SkipLastSubscriber = (function (_super) {
+ __extends(SkipLastSubscriber, _super);
+ function SkipLastSubscriber(destination, _skipCount) {
+ var _this = _super.call(this, destination) || this;
+ _this._skipCount = _skipCount;
+ _this._count = 0;
+ _this._ring = new Array(_skipCount);
+ return _this;
+ }
+ SkipLastSubscriber.prototype._next = function (value) {
+ var skipCount = this._skipCount;
+ var count = this._count++;
+ if (count < skipCount) {
+ this._ring[count] = value;
+ }
+ else {
+ var currentIndex = count % skipCount;
+ var ring = this._ring;
+ var oldValue = ring[currentIndex];
+ ring[currentIndex] = value;
+ this.destination.next(oldValue);
+ }
+ };
+ return SkipLastSubscriber;
+}(Subscriber_1.Subscriber));
+
+},{"../Subscriber":55,"../util/ArgumentOutOfRangeError":211}],161:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var OuterSubscriber_1 = require("../OuterSubscriber");
+var InnerSubscriber_1 = require("../InnerSubscriber");
+var subscribeToResult_1 = require("../util/subscribeToResult");
+function skipUntil(notifier) {
+ return function (source) { return source.lift(new SkipUntilOperator(notifier)); };
+}
+exports.skipUntil = skipUntil;
+var SkipUntilOperator = (function () {
+ function SkipUntilOperator(notifier) {
+ this.notifier = notifier;
+ }
+ SkipUntilOperator.prototype.call = function (destination, source) {
+ return source.subscribe(new SkipUntilSubscriber(destination, this.notifier));
+ };
+ return SkipUntilOperator;
+}());
+var SkipUntilSubscriber = (function (_super) {
+ __extends(SkipUntilSubscriber, _super);
+ function SkipUntilSubscriber(destination, notifier) {
+ var _this = _super.call(this, destination) || this;
+ _this.hasValue = false;
+ var innerSubscriber = new InnerSubscriber_1.InnerSubscriber(_this, undefined, undefined);
+ _this.add(innerSubscriber);
+ _this.innerSubscription = innerSubscriber;
+ var innerSubscription = subscribeToResult_1.subscribeToResult(_this, notifier, undefined, undefined, innerSubscriber);
+ if (innerSubscription !== innerSubscriber) {
+ _this.add(innerSubscription);
+ _this.innerSubscription = innerSubscription;
+ }
+ return _this;
+ }
+ SkipUntilSubscriber.prototype._next = function (value) {
+ if (this.hasValue) {
+ _super.prototype._next.call(this, value);
+ }
+ };
+ SkipUntilSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
+ this.hasValue = true;
+ if (this.innerSubscription) {
+ this.innerSubscription.unsubscribe();
+ }
+ };
+ SkipUntilSubscriber.prototype.notifyComplete = function () {
+ };
+ return SkipUntilSubscriber;
+}(OuterSubscriber_1.OuterSubscriber));
+
+},{"../InnerSubscriber":46,"../OuterSubscriber":50,"../util/subscribeToResult":239}],162:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var Subscriber_1 = require("../Subscriber");
+function skipWhile(predicate) {
+ return function (source) { return source.lift(new SkipWhileOperator(predicate)); };
+}
+exports.skipWhile = skipWhile;
+var SkipWhileOperator = (function () {
+ function SkipWhileOperator(predicate) {
+ this.predicate = predicate;
+ }
+ SkipWhileOperator.prototype.call = function (subscriber, source) {
+ return source.subscribe(new SkipWhileSubscriber(subscriber, this.predicate));
+ };
+ return SkipWhileOperator;
+}());
+var SkipWhileSubscriber = (function (_super) {
+ __extends(SkipWhileSubscriber, _super);
+ function SkipWhileSubscriber(destination, predicate) {
+ var _this = _super.call(this, destination) || this;
+ _this.predicate = predicate;
+ _this.skipping = true;
+ _this.index = 0;
+ return _this;
+ }
+ SkipWhileSubscriber.prototype._next = function (value) {
+ var destination = this.destination;
+ if (this.skipping) {
+ this.tryCallPredicate(value);
+ }
+ if (!this.skipping) {
+ destination.next(value);
+ }
+ };
+ SkipWhileSubscriber.prototype.tryCallPredicate = function (value) {
+ try {
+ var result = this.predicate(value, this.index++);
+ this.skipping = Boolean(result);
+ }
+ catch (err) {
+ this.destination.error(err);
+ }
+ };
+ return SkipWhileSubscriber;
+}(Subscriber_1.Subscriber));
+
+},{"../Subscriber":55}],163:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var concat_1 = require("../observable/concat");
+var isScheduler_1 = require("../util/isScheduler");
+function startWith() {
+ var array = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ array[_i] = arguments[_i];
+ }
+ var scheduler = array[array.length - 1];
+ if (isScheduler_1.isScheduler(scheduler)) {
+ array.pop();
+ return function (source) { return concat_1.concat(array, source, scheduler); };
+ }
+ else {
+ return function (source) { return concat_1.concat(array, source); };
+ }
+}
+exports.startWith = startWith;
+
+},{"../observable/concat":63,"../util/isScheduler":230}],164:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var SubscribeOnObservable_1 = require("../observable/SubscribeOnObservable");
+function subscribeOn(scheduler, delay) {
+ if (delay === void 0) { delay = 0; }
+ return function subscribeOnOperatorFunction(source) {
+ return source.lift(new SubscribeOnOperator(scheduler, delay));
+ };
+}
+exports.subscribeOn = subscribeOn;
+var SubscribeOnOperator = (function () {
+ function SubscribeOnOperator(scheduler, delay) {
+ this.scheduler = scheduler;
+ this.delay = delay;
+ }
+ SubscribeOnOperator.prototype.call = function (subscriber, source) {
+ return new SubscribeOnObservable_1.SubscribeOnObservable(source, this.delay, this.scheduler).subscribe(subscriber);
+ };
+ return SubscribeOnOperator;
+}());
+
+},{"../observable/SubscribeOnObservable":59}],165:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var switchMap_1 = require("./switchMap");
+var identity_1 = require("../util/identity");
+function switchAll() {
+ return switchMap_1.switchMap(identity_1.identity);
+}
+exports.switchAll = switchAll;
+
+},{"../util/identity":219,"./switchMap":166}],166:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var OuterSubscriber_1 = require("../OuterSubscriber");
+var InnerSubscriber_1 = require("../InnerSubscriber");
+var subscribeToResult_1 = require("../util/subscribeToResult");
+var map_1 = require("./map");
+var from_1 = require("../observable/from");
+function switchMap(project, resultSelector) {
+ if (typeof resultSelector === 'function') {
+ return function (source) { return source.pipe(switchMap(function (a, i) { return from_1.from(project(a, i)).pipe(map_1.map(function (b, ii) { return resultSelector(a, b, i, ii); })); })); };
+ }
+ return function (source) { return source.lift(new SwitchMapOperator(project)); };
+}
+exports.switchMap = switchMap;
+var SwitchMapOperator = (function () {
+ function SwitchMapOperator(project) {
+ this.project = project;
+ }
+ SwitchMapOperator.prototype.call = function (subscriber, source) {
+ return source.subscribe(new SwitchMapSubscriber(subscriber, this.project));
+ };
+ return SwitchMapOperator;
+}());